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

Function mlx5_mac_addr_set

dpdk/drivers/net/mlx5/mlx5_mac.c:151–192  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

149 * 0 on success, a negative errno value otherwise and rte_errno is set.
150 */
151int
152mlx5_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.

Callers

nothing calls this directly

Calls 4

mlx5_is_hpfFunction · 0.85
mlx5_is_sf_reprFunction · 0.85
mlx5_mac_addr_addFunction · 0.85

Tested by

no test coverage detected