* DPDK callback to set primary MAC address. * * @param dev * Pointer to Ethernet device structure. * @param mac_addr * MAC address to register. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 149 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 150 | */ |
| 151 | int |
| 152 | mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) |
| 153 | { |
| 154 | uint16_t port_id; |
| 155 | struct mlx5_priv *priv = dev->data->dev_private; |
| 156 | struct mlx5_priv *pf_priv; |
| 157 | |
| 158 | /* |
| 159 | * Configuring the VF instead of its representor, |
| 160 | * need to skip the special cases: |
| 161 | * - HPF on BlueField, |
| 162 | * - SF representors, |
| 163 | * - uplink ports when running in MPESW mode. |
| 164 | */ |
| 165 | if (priv->representor && !mlx5_is_hpf(dev) && !mlx5_is_sf_repr(dev) && |
| 166 | !priv->mpesw_uplink) { |
| 167 | DRV_LOG(DEBUG, "VF represented by port %u setting primary MAC address", |
| 168 | dev->data->port_id); |
| 169 | if (priv->pf_bond >= 0) { |
| 170 | /* Bonding, get owner PF ifindex from shared data. */ |
| 171 | return mlx5_os_vf_mac_addr_modify |
| 172 | (priv, |
| 173 | priv->sh->bond.ports[priv->pf_bond].ifindex, |
| 174 | mac_addr, |
| 175 | MLX5_REPRESENTOR_REPR(priv->representor_id)); |
| 176 | } |
| 177 | RTE_ETH_FOREACH_DEV_SIBLING(port_id, dev->data->port_id) { |
| 178 | pf_priv = rte_eth_devices[port_id].data->dev_private; |
| 179 | if (pf_priv->master == 1) |
| 180 | return mlx5_os_vf_mac_addr_modify |
| 181 | (priv, pf_priv->if_index, mac_addr, |
| 182 | MLX5_REPRESENTOR_REPR |
| 183 | (priv->representor_id)); |
| 184 | } |
| 185 | rte_errno = -ENOTSUP; |
| 186 | return rte_errno; |
| 187 | } |
| 188 | |
| 189 | DRV_LOG(DEBUG, "port %u setting primary MAC address", |
| 190 | dev->data->port_id); |
| 191 | return mlx5_mac_addr_add(dev, mac_addr, 0, 0); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * DPDK callback to set multicast addresses list. |
nothing calls this directly
no test coverage detected