* [PATCH] i40e: handle setting administratively set MAC address back to zero
@ 2017-06-23 7:46 Stefan Assmann
2017-06-25 6:21 ` Leon Romanovsky
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Assmann @ 2017-06-23 7:46 UTC (permalink / raw)
To: intel-wired-lan; +Cc: netdev, davem, jeffrey.t.kirsher, sassmann
When an administratively set MAC was previously set and should now be
switched back to 00:00:00:00:00:00 the pf_set_mac flag did not get
toggled back to false.
As a result VFs were still treated as if an administratively set MAC was
present.
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index ecbe40e..af0ff61 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2764,7 +2764,6 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
spin_unlock_bh(&vsi->mac_filter_hash_lock);
- dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id);
/* program mac filter */
if (i40e_sync_vsi_filters(vsi)) {
dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
@@ -2772,7 +2771,16 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
goto error_param;
}
ether_addr_copy(vf->default_lan_addr.addr, mac);
- vf->pf_set_mac = true;
+
+ if (is_zero_ether_addr(mac)) {
+ vf->pf_set_mac = false;
+ dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id);
+ } else {
+ vf->pf_set_mac = true;
+ dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n",
+ mac, vf_id);
+ }
+
/* Force the VF driver stop so it has to reload with new MAC address */
i40e_vc_disable_vf(pf, vf);
dev_info(&pf->pdev->dev, "Reload the VF driver to make this change effective.\n");
--
2.9.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i40e: handle setting administratively set MAC address back to zero
2017-06-23 7:46 [PATCH] i40e: handle setting administratively set MAC address back to zero Stefan Assmann
@ 2017-06-25 6:21 ` Leon Romanovsky
2017-06-25 11:10 ` Stefan Assmann
0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2017-06-25 6:21 UTC (permalink / raw)
To: Stefan Assmann; +Cc: intel-wired-lan, netdev, davem, jeffrey.t.kirsher
[-- Attachment #1: Type: text/plain, Size: 1961 bytes --]
On Fri, Jun 23, 2017 at 09:46:24AM +0200, Stefan Assmann wrote:
> When an administratively set MAC was previously set and should now be
> switched back to 00:00:00:00:00:00 the pf_set_mac flag did not get
> toggled back to false.
> As a result VFs were still treated as if an administratively set MAC was
> present.
>
> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
> ---
> drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> index ecbe40e..af0ff61 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> @@ -2764,7 +2764,6 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
>
> spin_unlock_bh(&vsi->mac_filter_hash_lock);
>
> - dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id);
> /* program mac filter */
> if (i40e_sync_vsi_filters(vsi)) {
> dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
> @@ -2772,7 +2771,16 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
> goto error_param;
> }
> ether_addr_copy(vf->default_lan_addr.addr, mac);
> - vf->pf_set_mac = true;
> +
> + if (is_zero_ether_addr(mac)) {
> + vf->pf_set_mac = false;
> + dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id);
> + } else {
> + vf->pf_set_mac = true;
> + dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n",
> + mac, vf_id);
> + }
> +
It can be removed to be one line change, because I'm not sure that
dev_info prints are necessary here.
+ vf->pf_set_mac = is_zero_ether_addr(mac);
Thanks
> /* Force the VF driver stop so it has to reload with new MAC address */
> i40e_vc_disable_vf(pf, vf);
> dev_info(&pf->pdev->dev, "Reload the VF driver to make this change effective.\n");
> --
> 2.9.4
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i40e: handle setting administratively set MAC address back to zero
2017-06-25 6:21 ` Leon Romanovsky
@ 2017-06-25 11:10 ` Stefan Assmann
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Assmann @ 2017-06-25 11:10 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: intel-wired-lan, netdev, davem, jeffrey.t.kirsher
On 25.06.2017 08:21, Leon Romanovsky wrote:
> On Fri, Jun 23, 2017 at 09:46:24AM +0200, Stefan Assmann wrote:
>> When an administratively set MAC was previously set and should now be
>> switched back to 00:00:00:00:00:00 the pf_set_mac flag did not get
>> toggled back to false.
>> As a result VFs were still treated as if an administratively set MAC was
>> present.
>>
>> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
>> ---
>> drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
>> index ecbe40e..af0ff61 100644
>> --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
>> +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
>> @@ -2764,7 +2764,6 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
>>
>> spin_unlock_bh(&vsi->mac_filter_hash_lock);
>>
>> - dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id);
>> /* program mac filter */
>> if (i40e_sync_vsi_filters(vsi)) {
>> dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
>> @@ -2772,7 +2771,16 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
>> goto error_param;
>> }
>> ether_addr_copy(vf->default_lan_addr.addr, mac);
>> - vf->pf_set_mac = true;
>> +
>> + if (is_zero_ether_addr(mac)) {
>> + vf->pf_set_mac = false;
>> + dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id);
>> + } else {
>> + vf->pf_set_mac = true;
>> + dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n",
>> + mac, vf_id);
>> + }
>> +
>
> It can be removed to be one line change, because I'm not sure that
> dev_info prints are necessary here.
> + vf->pf_set_mac = is_zero_ether_addr(mac);
>
> Thanks
This matches ixgbe behavior, so I'd prefer to keep it this way.
Thanks!
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-25 11:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-23 7:46 [PATCH] i40e: handle setting administratively set MAC address back to zero Stefan Assmann
2017-06-25 6:21 ` Leon Romanovsky
2017-06-25 11:10 ` Stefan Assmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).