Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ice: Fix check for removing/adding mac filters

In function ice_set_mac_address, we will remove old dev_addr before
adding the new MAC. In the removing and adding process of the MAC,
there is no need to return error if the check finds the to-be-removed
dev_addr does not exist in the MAC filter list or the to-be-added mac
already exists, keep going or return success accordingly.

Signed-off-by: Lihong Yang <lihong.yang@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

authored by

Lihong Yang and committed by
Jeff Kirsher
757976ab 1b8f15b6

+10 -5
+10 -5
drivers/net/ethernet/intel/ice/ice_main.c
··· 3707 3707 return -EBUSY; 3708 3708 } 3709 3709 3710 - /* Clean up old MAC filter before changing the MAC address */ 3710 + /* Clean up old MAC filter. Not an error if old filter doesn't exist */ 3711 3711 status = ice_fltr_remove_mac(vsi, netdev->dev_addr, ICE_FWD_TO_VSI); 3712 - if (status) { 3712 + if (status && status != ICE_ERR_DOES_NOT_EXIST) { 3713 3713 err = -EADDRNOTAVAIL; 3714 3714 goto err_update_filters; 3715 3715 } 3716 3716 3717 + /* Add filter for new MAC. If filter exists, just return success */ 3717 3718 status = ice_fltr_add_mac(vsi, mac, ICE_FWD_TO_VSI); 3718 - if (status) { 3719 - err = -EADDRNOTAVAIL; 3720 - goto err_update_filters; 3719 + if (status == ICE_ERR_ALREADY_EXISTS) { 3720 + netdev_dbg(netdev, "filter for MAC %pM already exists\n", mac); 3721 + return 0; 3721 3722 } 3723 + 3724 + /* error if the new filter addition failed */ 3725 + if (status) 3726 + err = -EADDRNOTAVAIL; 3722 3727 3723 3728 err_update_filters: 3724 3729 if (err) {