All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net v1] i40e: Fix setting PF MAC filters when changing MAC address
@ 2020-12-30 14:42 Mateusz Palczewski
  2021-01-05  8:02 ` Stefan Assmann
  0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Palczewski @ 2020-12-30 14:42 UTC (permalink / raw)
  To: intel-wired-lan

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 <sylwesterx.dziedziuch@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 630258e..de5e0fb 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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);
-- 
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.
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Intel-wired-lan] [PATCH net v1] i40e: Fix setting PF MAC filters when changing MAC address
  2020-12-30 14:42 [Intel-wired-lan] [PATCH net v1] i40e: Fix setting PF MAC filters when changing MAC address Mateusz Palczewski
@ 2021-01-05  8:02 ` Stefan Assmann
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Assmann @ 2021-01-05  8:02 UTC (permalink / raw)
  To: intel-wired-lan

On 2020-12-30 14:42, Mateusz Palczewski wrote:
> 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 <sylwesterx.dziedziuch@intel.com>
> Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Reviewed-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 630258e..de5e0fb 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -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);

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-05  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30 14:42 [Intel-wired-lan] [PATCH net v1] i40e: Fix setting PF MAC filters when changing MAC address Mateusz Palczewski
2021-01-05  8:02 ` Stefan Assmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.