netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/ixgbe: Allow resetting VF admin mac to zero
@ 2016-07-01  9:19 Juerg Haefliger
  2016-07-07  3:57 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Juerg Haefliger @ 2016-07-01  9:19 UTC (permalink / raw)
  To: netdev, jeffrey.t.kirsher; +Cc: linux-kernel, Juerg Haefliger

The VF administrative mac addresses (stored in the PF driver) are
initialized to zero when the PF driver starts up.

These addresses may be modified in the PF driver through ndo calls
initiated by iproute2 or libvirt.

While we allow the PF/host to change the VF admin mac address from zero
to a valid unicast mac, we do not allow restoring the VF admin mac to
zero. We currently only allow changing this mac to a different unicast mac.

This leads to problems when libvirt scripts are used to deal with
VF mac addresses, and libvirt attempts to revoke the mac so this
host will not use it anymore.

Fix this by allowing resetting a VF administrative MAC back to zero.

Implementation and commit message shamelessly stolen from:
commit 6e5224224faa ("net/mlx4_core: Allow resetting VF admin mac to zero")

Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index c5caacd..d075387 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -1280,7 +1280,7 @@ void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter)
 int ixgbe_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
 {
 	struct ixgbe_adapter *adapter = netdev_priv(netdev);
-	if (!is_valid_ether_addr(mac) || (vf >= adapter->num_vfs))
+	if (is_multicast_ether_addr(mac) || (vf >= adapter->num_vfs))
 		return -EINVAL;
 	adapter->vfinfo[vf].pf_set_mac = true;
 	dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf);
-- 
2.8.1

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

* Re: [PATCH] net/ixgbe: Allow resetting VF admin mac to zero
  2016-07-01  9:19 [PATCH] net/ixgbe: Allow resetting VF admin mac to zero Juerg Haefliger
@ 2016-07-07  3:57 ` Stephen Hemminger
  2016-07-07 15:38   ` Alexander Duyck
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2016-07-07  3:57 UTC (permalink / raw)
  To: Juerg Haefliger; +Cc: netdev, jeffrey.t.kirsher, linux-kernel

On Fri,  1 Jul 2016 11:19:38 +0200
Juerg Haefliger <juerg.haefliger@hpe.com> wrote:

> The VF administrative mac addresses (stored in the PF driver) are
> initialized to zero when the PF driver starts up.
> 
> These addresses may be modified in the PF driver through ndo calls
> initiated by iproute2 or libvirt.
> 
> While we allow the PF/host to change the VF admin mac address from zero
> to a valid unicast mac, we do not allow restoring the VF admin mac to
> zero. We currently only allow changing this mac to a different unicast mac.
> 
> This leads to problems when libvirt scripts are used to deal with
> VF mac addresses, and libvirt attempts to revoke the mac so this
> host will not use it anymore.
> 
> Fix this by allowing resetting a VF administrative MAC back to zero.
> 
> Implementation and commit message shamelessly stolen from:
> commit 6e5224224faa ("net/mlx4_core: Allow resetting VF admin mac to zero")
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>

Since set mac is allowed any time even when device is up, you must
prevent a a device that is in UP state from having all zero MAC address.

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

* Re: [PATCH] net/ixgbe: Allow resetting VF admin mac to zero
  2016-07-07  3:57 ` Stephen Hemminger
@ 2016-07-07 15:38   ` Alexander Duyck
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Duyck @ 2016-07-07 15:38 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Juerg Haefliger, Netdev, Jeff Kirsher,
	linux-kernel@vger.kernel.org

On Wed, Jul 6, 2016 at 8:57 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Fri,  1 Jul 2016 11:19:38 +0200
> Juerg Haefliger <juerg.haefliger@hpe.com> wrote:
>
>> The VF administrative mac addresses (stored in the PF driver) are
>> initialized to zero when the PF driver starts up.
>>
>> These addresses may be modified in the PF driver through ndo calls
>> initiated by iproute2 or libvirt.
>>
>> While we allow the PF/host to change the VF admin mac address from zero
>> to a valid unicast mac, we do not allow restoring the VF admin mac to
>> zero. We currently only allow changing this mac to a different unicast mac.
>>
>> This leads to problems when libvirt scripts are used to deal with
>> VF mac addresses, and libvirt attempts to revoke the mac so this
>> host will not use it anymore.
>>
>> Fix this by allowing resetting a VF administrative MAC back to zero.
>>
>> Implementation and commit message shamelessly stolen from:
>> commit 6e5224224faa ("net/mlx4_core: Allow resetting VF admin mac to zero")
>>
>> Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>
>
> Since set mac is allowed any time even when device is up, you must
> prevent a a device that is in UP state from having all zero MAC address.

I'm pretty sure the actual MAC address of the VF does not change in
such a case, it should retain the last MAC address it was given from
the PF and report link down until a new one is assigned.

- Alex

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

end of thread, other threads:[~2016-07-07 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-01  9:19 [PATCH] net/ixgbe: Allow resetting VF admin mac to zero Juerg Haefliger
2016-07-07  3:57 ` Stephen Hemminger
2016-07-07 15:38   ` Alexander Duyck

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).