* 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. */
| 482 | * 0 on success, negative errno value otherwise and rte_errno is set. |
| 483 | */ |
| 484 | int |
| 485 | mlx4_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. |
no test coverage detected