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

Function txgbevf_remove_mac_addr

dpdk/drivers/net/txgbe/txgbe_ethdev_vf.c:1066–1108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1064}
1065
1066static void
1067txgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
1068{
1069 struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1070 struct rte_ether_addr *perm_addr =
1071 (struct rte_ether_addr *)hw->mac.perm_addr;
1072 struct rte_ether_addr *mac_addr;
1073 uint32_t i;
1074 int err;
1075
1076 /*
1077 * The TXGBE_VF_SET_MACVLAN command of the txgbe-pf driver does
1078 * not support the deletion of a given MAC address.
1079 * Instead, it imposes to delete all MAC addresses, then to add again
1080 * all MAC addresses with the exception of the one to be deleted.
1081 */
1082 (void)txgbevf_set_uc_addr_vf(hw, 0, NULL);
1083
1084 /*
1085 * Add again all MAC addresses, with the exception of the deleted one
1086 * and of the permanent MAC address.
1087 */
1088 for (i = 0, mac_addr = dev->data->mac_addrs;
1089 i < hw->mac.num_rar_entries; i++, mac_addr++) {
1090 /* Skip the deleted MAC address */
1091 if (i == index)
1092 continue;
1093 /* Skip NULL MAC addresses */
1094 if (rte_is_zero_ether_addr(mac_addr))
1095 continue;
1096 /* Skip the permanent MAC address */
1097 if (memcmp(perm_addr, mac_addr,
1098 sizeof(struct rte_ether_addr)) == 0)
1099 continue;
1100 err = txgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes);
1101 if (err != 0)
1102 PMD_DRV_LOG(ERR,
1103 "Adding again MAC address "
1104 RTE_ETHER_ADDR_PRT_FMT " failed "
1105 "err=%d",
1106 RTE_ETHER_ADDR_BYTES(mac_addr), err);
1107 }
1108}
1109
1110static int
1111txgbevf_set_default_mac_addr(struct rte_eth_dev *dev,

Callers 1

txgbevf_dev_closeFunction · 0.85

Calls 2

txgbevf_set_uc_addr_vfFunction · 0.85
rte_is_zero_ether_addrFunction · 0.85

Tested by

no test coverage detected