rte_spinlock_unlock(&hw->lock);
return -EINVAL;
}
- ret = hns3_add_mc_mac_addr(hw, mac_addr);
+ ret = hw->ops.add_mc_mac_addr(hw, mac_addr);
} else {
- ret = hns3_add_uc_mac_addr(hw, mac_addr);
+ ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
}
if (ret) {
rte_spinlock_unlock(&hw->lock);
rte_spinlock_lock(&hw->lock);
if (rte_is_multicast_ether_addr(mac_addr))
- ret = hns3_remove_mc_mac_addr(hw, mac_addr);
+ ret = hw->ops.del_mc_mac_addr(hw, mac_addr);
else
- ret = hns3_remove_uc_mac_addr(hw, mac_addr);
+ ret = hw->ops.del_uc_mac_addr(hw, mac_addr);
rte_spinlock_unlock(&hw->lock);
if (ret) {
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
rte_spinlock_lock(&hw->lock);
oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
- ret = hns3_remove_uc_mac_addr(hw, oaddr);
+ ret = hw->ops.del_uc_mac_addr(hw, oaddr);
if (ret) {
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
oaddr);
return ret;
}
- ret = hns3_add_uc_mac_addr(hw, mac_addr);
+ ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
if (ret) {
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
mac_addr);
return 0;
err_pause_addr_cfg:
- ret_val = hns3_remove_uc_mac_addr(hw, mac_addr);
+ ret_val = hw->ops.del_uc_mac_addr(hw, mac_addr);
if (ret_val) {
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
mac_addr);
}
err_add_uc_addr:
- ret_val = hns3_add_uc_mac_addr(hw, oaddr);
+ ret_val = hw->ops.add_uc_mac_addr(hw, oaddr);
if (ret_val) {
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, oaddr);
hns3_warn(hw, "Failed to restore old uc mac addr(%s): %d",
if (rte_is_zero_ether_addr(addr))
continue;
if (rte_is_multicast_ether_addr(addr))
- ret = del ? hns3_remove_mc_mac_addr(hw, addr) :
- hns3_add_mc_mac_addr(hw, addr);
+ ret = del ? ops->del_mc_mac_addr(hw, addr) :
+ ops->add_mc_mac_addr(hw, addr);
else
- ret = del ? hns3_remove_uc_mac_addr(hw, addr) :
- hns3_add_uc_mac_addr(hw, addr);
+ ret = del ? ops->del_uc_mac_addr(hw, addr) :
+ ops->add_uc_mac_addr(hw, addr);
if (ret) {
err = ret;
for (i = 0; i < rm_addr_num; i++) {
num = rm_addr_num - i - 1;
addr = &rm_addr_list[num];
- ret = hns3_remove_mc_mac_addr(hw, addr);
+ ret = hw->ops.del_mc_mac_addr(hw, addr);
if (ret) {
rte_spinlock_unlock(&hw->lock);
return ret;
/* Add mc mac addresses */
for (i = 0; i < add_addr_num; i++) {
addr = &add_addr_list[i];
- ret = hns3_add_mc_mac_addr(hw, addr);
+ ret = hw->ops.add_mc_mac_addr(hw, addr);
if (ret) {
rte_spinlock_unlock(&hw->lock);
return ret;
if (!rte_is_multicast_ether_addr(addr))
continue;
if (del)
- ret = hns3_remove_mc_mac_addr(hw, addr);
+ ret = hw->ops.del_mc_mac_addr(hw, addr);
else
- ret = hns3_add_mc_mac_addr(hw, addr);
+ ret = hw->ops.add_mc_mac_addr(hw, addr);
if (ret) {
err = ret;
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
rte_spinlock_unlock(&hw->lock);
return -EINVAL;
}
- ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
+ ret = hw->ops.add_mc_mac_addr(hw, mac_addr);
} else {
- ret = hns3vf_add_uc_mac_addr(hw, mac_addr);
+ ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
}
rte_spinlock_unlock(&hw->lock);
rte_spinlock_lock(&hw->lock);
if (rte_is_multicast_ether_addr(mac_addr))
- ret = hns3vf_remove_mc_mac_addr(hw, mac_addr);
+ ret = hw->ops.del_mc_mac_addr(hw, mac_addr);
else
- ret = hns3vf_remove_uc_mac_addr(hw, mac_addr);
+ ret = hw->ops.del_uc_mac_addr(hw, mac_addr);
rte_spinlock_unlock(&hw->lock);
if (ret) {
static int
hns3vf_configure_mac_addr(struct hns3_adapter *hns, bool del)
{
+ char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
struct hns3_hw *hw = &hns->hw;
+ struct hns3_hw_ops *ops = &hw->ops;
struct rte_ether_addr *addr;
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
int err = 0;
int ret;
int i;
if (rte_is_zero_ether_addr(addr))
continue;
if (rte_is_multicast_ether_addr(addr))
- ret = del ? hns3vf_remove_mc_mac_addr(hw, addr) :
- hns3vf_add_mc_mac_addr(hw, addr);
+ ret = del ? ops->del_mc_mac_addr(hw, addr) :
+ ops->add_mc_mac_addr(hw, addr);
else
- ret = del ? hns3vf_remove_uc_mac_addr(hw, addr) :
- hns3vf_add_uc_mac_addr(hw, addr);
+ ret = del ? ops->del_uc_mac_addr(hw, addr) :
+ ops->add_uc_mac_addr(hw, addr);
if (ret) {
err = ret;
for (i = 0; i < cur_addr_num; i++) {
num = cur_addr_num - i - 1;
addr = &hw->mc_addrs[num];
- ret = hns3vf_remove_mc_mac_addr(hw, addr);
+ ret = hw->ops.del_mc_mac_addr(hw, addr);
if (ret) {
rte_spinlock_unlock(&hw->lock);
return ret;
set_addr_num = (int)nb_mc_addr;
for (i = 0; i < set_addr_num; i++) {
addr = &mc_addr_set[i];
- ret = hns3vf_add_mc_mac_addr(hw, addr);
+ ret = hw->ops.add_mc_mac_addr(hw, addr);
if (ret) {
rte_spinlock_unlock(&hw->lock);
return ret;
if (!rte_is_multicast_ether_addr(addr))
continue;
if (del)
- ret = hns3vf_remove_mc_mac_addr(hw, addr);
+ ret = hw->ops.del_mc_mac_addr(hw, addr);
else
- ret = hns3vf_add_mc_mac_addr(hw, addr);
+ ret = hw->ops.add_mc_mac_addr(hw, addr);
if (ret) {
err = ret;
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,