i40e: Fix setting PF MAC filters when changing MAC address
Subsystems (2)
PATCH 1/1 i40e: Fix setting PF MAC filters when changing MAC address
When changing PFs MAC address the old MAC filter was not removed due to incorrect order of copying MAC from netdev and deleting the old MAC filter.
Changed how the old MAC filter is removed to remove the proper filter.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +5 -1
@@ -1561,6 +1561,7 @@ int i40e_del_mac_filter(struct i40e_vsi *vsi, const u8 *macaddr)static int i40e_set_mac (struct net_device *netdev,void *p) {struct i40e_netdev_priv *np =netdev_priv (netdev); +struct sockaddr addr_tmp = {0 };struct i40e_vsi *vsi = np->vsi;struct i40e_pf *pf = vsi->back;struct i40e_hw *hw = &pf->hw;
@@ -1591,8 +1592,11 @@ static int i40e_set_mac(struct net_device *netdev, void *p)* - Copy new address * - Add new address to MAC filter */ + +ether_addr_copy (addr_tmp.sa_data, netdev->dev_addr); +spin_lock_bh (&vsi->mac_filter_hash_lock); -i40e_del_mac_filter (vsi, netdev->dev_addr); +i40e_del_mac_filter (vsi, addr_tmp.sa_data);ether_addr_copy (netdev->dev_addr, addr->sa_data);i40e_add_mac_filter (vsi, netdev->dev_addr);spin_unlock_bh (&vsi->mac_filter_hash_lock);
Signature · 7 lines
2.17.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN. Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
PATCH 1/1 i40e: Fix setting PF MAC filters when changing MAC address
Quoted 30 lines · Mateusz Palczewski
When changing PFs MAC address the old MAC filter was not removed due to incorrect order of copying MAC from netdev and deleting the old MAC filter.
Changed how the old MAC filter is removed to remove the proper filter.Fixes 158daed16efb("i40e: fix mac filter delete when setting mac address")Signed-off-by Sylwester Dziedziuch <[email protected]>Signed-off-by Mateusz Palczewski <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemyslaw Patynowski <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/i40e/i40e_main.c +1
-0@@ -1561,6 +1561,7 @@ int i40e_del_mac_filter(struct i40e_vsi *vsi, const u8 *macaddr)static int i40e_set_mac (struct net_device *netdev,void *p) {struct i40e_netdev_priv *np =netdev_priv (netdev); +struct sockaddr addr_tmp = {0 };struct i40e_vsi *vsi = np->vsi;struct i40e_pf *pf = vsi->back;struct i40e_hw *hw = &pf->hw;@@ -1591,8 +1592,11 @@ static int i40e_set_mac(struct net_device *netdev, void *p)* - Copy new address * - Add new address to MAC filter
drivers/net/ethernet/intel/i40e/i40e_main.c static int i40e_set_mac(struct net_device *netdev, void *p) · line 1602
Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +4
-1*/ + +ether_addr_copy (addr_tmp.sa_data, netdev->dev_addr); +spin_lock_bh (&vsi->mac_filter_hash_lock); -i40e_del_mac_filter (vsi, netdev->dev_addr); +i40e_del_mac_filter (vsi, addr_tmp.sa_data);ether_addr_copy (netdev->dev_addr, addr->sa_data);i40e_add_mac_filter (vsi, netdev->dev_addr);spin_unlock_bh (&vsi->mac_filter_hash_lock);
Could you please point out what exactly goes wrong in the original code and how this patch does correct that? I fail to understand either.
Stefan