MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx4_mac_addr_add

Function mlx4_mac_addr_add

dpdk/drivers/net/mlx4/mlx4_ethdev.c:484–507  ·  view source on GitHub ↗

* DPDK callback to add a MAC address. * * @param dev * Pointer to Ethernet device structure. * @param mac_addr * MAC address to register. * @param index * MAC address index. * @param vmdq * VMDq pool index to associate address with (ignored). * * @return * 0 on success, negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

482 * 0 on success, negative errno value otherwise and rte_errno is set.
483 */
484int
485mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
486 uint32_t index, uint32_t vmdq)
487{
488 struct mlx4_priv *priv = dev->data->dev_private;
489 struct rte_flow_error error;
490 int ret;
491
492 (void)vmdq;
493 if (index >= RTE_DIM(priv->mac) - priv->mac_mc) {
494 rte_errno = EINVAL;
495 return -rte_errno;
496 }
497 memcpy(&priv->mac[index], mac_addr, sizeof(priv->mac[index]));
498 ret = mlx4_flow_sync(priv, &error);
499 if (!ret)
500 return 0;
501 ERROR("failed to synchronize flow rules after adding MAC address"
502 " at index %d (code %d, \"%s\"),"
503 " flow error type %d, cause %p, message: %s",
504 index, rte_errno, strerror(rte_errno), error.type, error.cause,
505 error.message ? error.message : "(unspecified)");
506 return ret;
507}
508
509/**
510 * DPDK callback to configure multicast addresses.

Callers 1

mlx4_mac_addr_setFunction · 0.85

Calls 2

mlx4_flow_syncFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected