@@ -5122,6 +5122,7 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
5122
5122
struct ice_hw * hw = & pf -> hw ;
5123
5123
struct sockaddr * addr = pi ;
5124
5124
enum ice_status status ;
5125
+ u8 old_mac [ETH_ALEN ];
5125
5126
u8 flags = 0 ;
5126
5127
int err = 0 ;
5127
5128
u8 * mac ;
@@ -5144,8 +5145,13 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
5144
5145
}
5145
5146
5146
5147
netif_addr_lock_bh (netdev );
5148
+ ether_addr_copy (old_mac , netdev -> dev_addr );
5149
+ /* change the netdev's MAC address */
5150
+ memcpy (netdev -> dev_addr , mac , netdev -> addr_len );
5151
+ netif_addr_unlock_bh (netdev );
5152
+
5147
5153
/* Clean up old MAC filter. Not an error if old filter doesn't exist */
5148
- status = ice_fltr_remove_mac (vsi , netdev -> dev_addr , ICE_FWD_TO_VSI );
5154
+ status = ice_fltr_remove_mac (vsi , old_mac , ICE_FWD_TO_VSI );
5149
5155
if (status && status != ICE_ERR_DOES_NOT_EXIST ) {
5150
5156
err = - EADDRNOTAVAIL ;
5151
5157
goto err_update_filters ;
@@ -5168,13 +5174,12 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
5168
5174
if (err ) {
5169
5175
netdev_err (netdev , "can't set MAC %pM. filter update failed\n" ,
5170
5176
mac );
5177
+ netif_addr_lock_bh (netdev );
5178
+ ether_addr_copy (netdev -> dev_addr , old_mac );
5171
5179
netif_addr_unlock_bh (netdev );
5172
5180
return err ;
5173
5181
}
5174
5182
5175
- /* change the netdev's MAC address */
5176
- memcpy (netdev -> dev_addr , mac , netdev -> addr_len );
5177
- netif_addr_unlock_bh (netdev );
5178
5183
netdev_dbg (vsi -> netdev , "updated MAC address to %pM\n" ,
5179
5184
netdev -> dev_addr );
5180
5185
0 commit comments