Add a MAC address, and update filters */
| 4286 | |
| 4287 | /* Add a MAC address, and update filters */ |
| 4288 | static int |
| 4289 | i40e_macaddr_add(struct rte_eth_dev *dev, |
| 4290 | struct rte_ether_addr *mac_addr, |
| 4291 | __rte_unused uint32_t index, |
| 4292 | uint32_t pool) |
| 4293 | { |
| 4294 | struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); |
| 4295 | struct i40e_mac_filter_info mac_filter; |
| 4296 | struct i40e_vsi *vsi; |
| 4297 | struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; |
| 4298 | int ret; |
| 4299 | |
| 4300 | /* If VMDQ not enabled or configured, return */ |
| 4301 | if (pool != 0 && (!(pf->flags & I40E_FLAG_VMDQ) || |
| 4302 | !pf->nb_cfg_vmdq_vsi)) { |
| 4303 | PMD_DRV_LOG(ERR, "VMDQ not %s, can't set mac to pool %u", |
| 4304 | pf->flags & I40E_FLAG_VMDQ ? "configured" : "enabled", |
| 4305 | pool); |
| 4306 | return -ENOTSUP; |
| 4307 | } |
| 4308 | |
| 4309 | if (pool > pf->nb_cfg_vmdq_vsi) { |
| 4310 | PMD_DRV_LOG(ERR, "Pool number %u invalid. Max pool is %u", |
| 4311 | pool, pf->nb_cfg_vmdq_vsi); |
| 4312 | return -EINVAL; |
| 4313 | } |
| 4314 | |
| 4315 | rte_memcpy(&mac_filter.mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); |
| 4316 | if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) |
| 4317 | mac_filter.filter_type = I40E_MACVLAN_PERFECT_MATCH; |
| 4318 | else |
| 4319 | mac_filter.filter_type = I40E_MAC_PERFECT_MATCH; |
| 4320 | |
| 4321 | if (pool == 0) |
| 4322 | vsi = pf->main_vsi; |
| 4323 | else |
| 4324 | vsi = pf->vmdq[pool - 1].vsi; |
| 4325 | |
| 4326 | ret = i40e_vsi_add_mac(vsi, &mac_filter); |
| 4327 | if (ret != I40E_SUCCESS) { |
| 4328 | PMD_DRV_LOG(ERR, "Failed to add MACVLAN filter"); |
| 4329 | return -ENODEV; |
| 4330 | } |
| 4331 | return 0; |
| 4332 | } |
| 4333 | |
| 4334 | /* Remove a MAC address, and update filters */ |
| 4335 | static void |
nothing calls this directly
no test coverage detected