Linux-HyperV Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v8 net-next 0/2] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)
@ 2021-04-16 20:11 Dexuan Cui
  2021-04-16 20:11 ` [PATCH v8 net-next 1/2] hv_netvsc: Make netvsc/VF binding check both MAC and serial number Dexuan Cui
       [not found] ` <20210416201159.25807-3-decui@microsoft.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Dexuan Cui @ 2021-04-16 20:11 UTC (permalink / raw)
  To: davem, kuba, kys, haiyangz, stephen, sthemmin, wei.liu, liuwe,
	netdev, leon, andrew, bernd, rdunlap, shacharr
  Cc: linux-kernel, linux-hyperv, Dexuan Cui

The patchset adds the VF driver for Microsoft Azure Network Adapter (MANA),
and also changes the hv_netvsc driver's netvsc/VF binding logic to check
both the MAC address and the serial number (this is required by the MANA VF
driver).

v7 contains both the netvsc change and the VF driver. This version (v8)
posts them in 2 separate patches, as suggested by Stephen Hemminger.

Please refer to "[PATCH v8 net-next 2/2]" for the history of v1~v7.

Thanks,
Dexuan

Dexuan Cui (2):
  hv_netvsc: Make netvsc/VF binding check both MAC and serial number
  net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)

 MAINTAINERS                                   |    4 +-
 drivers/net/ethernet/Kconfig                  |    1 +
 drivers/net/ethernet/Makefile                 |    1 +
 drivers/net/ethernet/microsoft/Kconfig        |   29 +
 drivers/net/ethernet/microsoft/Makefile       |    5 +
 drivers/net/ethernet/microsoft/mana/Makefile  |    6 +
 drivers/net/ethernet/microsoft/mana/gdma.h    |  673 ++++++
 .../net/ethernet/microsoft/mana/gdma_main.c   | 1415 ++++++++++++
 .../net/ethernet/microsoft/mana/hw_channel.c  |  843 ++++++++
 .../net/ethernet/microsoft/mana/hw_channel.h  |  190 ++
 drivers/net/ethernet/microsoft/mana/mana.h    |  533 +++++
 drivers/net/ethernet/microsoft/mana/mana_en.c | 1895 +++++++++++++++++
 .../ethernet/microsoft/mana/mana_ethtool.c    |  250 +++
 .../net/ethernet/microsoft/mana/shm_channel.c |  291 +++
 .../net/ethernet/microsoft/mana/shm_channel.h |   21 +
 drivers/net/hyperv/netvsc_drv.c               |   14 +-
 16 files changed, 6168 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/ethernet/microsoft/Kconfig
 create mode 100644 drivers/net/ethernet/microsoft/Makefile
 create mode 100644 drivers/net/ethernet/microsoft/mana/Makefile
 create mode 100644 drivers/net/ethernet/microsoft/mana/gdma.h
 create mode 100644 drivers/net/ethernet/microsoft/mana/gdma_main.c
 create mode 100644 drivers/net/ethernet/microsoft/mana/hw_channel.c
 create mode 100644 drivers/net/ethernet/microsoft/mana/hw_channel.h
 create mode 100644 drivers/net/ethernet/microsoft/mana/mana.h
 create mode 100644 drivers/net/ethernet/microsoft/mana/mana_en.c
 create mode 100644 drivers/net/ethernet/microsoft/mana/mana_ethtool.c
 create mode 100644 drivers/net/ethernet/microsoft/mana/shm_channel.c
 create mode 100644 drivers/net/ethernet/microsoft/mana/shm_channel.h

-- 
2.25.1


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

* [PATCH v8 net-next 1/2] hv_netvsc: Make netvsc/VF binding check both MAC and serial number
  2021-04-16 20:11 [PATCH v8 net-next 0/2] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Dexuan Cui
@ 2021-04-16 20:11 ` Dexuan Cui
  2021-04-19 15:53   ` Stephen Hemminger
       [not found] ` <20210416201159.25807-3-decui@microsoft.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Dexuan Cui @ 2021-04-16 20:11 UTC (permalink / raw)
  To: davem, kuba, kys, haiyangz, stephen, sthemmin, wei.liu, liuwe,
	netdev, leon, andrew, bernd, rdunlap, shacharr
  Cc: linux-kernel, linux-hyperv, Dexuan Cui

Currently the netvsc/VF binding logic only checks the PCI serial number.

The upcoming Microsoft Azure Network Adapter (MANA) supports multiple
net_device interfaces (each such interface is called a "vPort", and has
its unique MAC address) which are backed by the same VF PCI device, so
the binding logic should check both the MAC address and the PCI serial
number.

The change should not break any other existing VF drivers, because
Hyper-V NIC SR-IOV implementation requires the netvsc network
interface and the VF network interface have the same MAC address.

Co-developed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Co-developed-by: Shachar Raindel <shacharr@microsoft.com>
Signed-off-by: Shachar Raindel <shacharr@microsoft.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
 drivers/net/hyperv/netvsc_drv.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 7349a70af083..f682a5572d84 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -2297,6 +2297,7 @@ static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev)
 {
 	struct device *parent = vf_netdev->dev.parent;
 	struct net_device_context *ndev_ctx;
+	struct net_device *ndev;
 	struct pci_dev *pdev;
 	u32 serial;
 
@@ -2319,8 +2320,17 @@ static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev)
 		if (!ndev_ctx->vf_alloc)
 			continue;
 
-		if (ndev_ctx->vf_serial == serial)
-			return hv_get_drvdata(ndev_ctx->device_ctx);
+		if (ndev_ctx->vf_serial != serial)
+			continue;
+
+		ndev = hv_get_drvdata(ndev_ctx->device_ctx);
+		if (ndev->addr_len != vf_netdev->addr_len ||
+		    memcmp(ndev->perm_addr, vf_netdev->perm_addr,
+			   ndev->addr_len) != 0)
+			continue;
+
+		return ndev;
+
 	}
 
 	netdev_notice(vf_netdev,
-- 
2.25.1


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

* Re: [PATCH v8 net-next 1/2] hv_netvsc: Make netvsc/VF binding check both MAC and serial number
  2021-04-16 20:11 ` [PATCH v8 net-next 1/2] hv_netvsc: Make netvsc/VF binding check both MAC and serial number Dexuan Cui
@ 2021-04-19 15:53   ` Stephen Hemminger
  2021-04-22  0:18     ` Dexuan Cui
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2021-04-19 15:53 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: davem, kuba, kys, haiyangz, sthemmin, wei.liu, liuwe, netdev,
	leon, andrew, bernd, rdunlap, shacharr, linux-kernel,
	linux-hyperv

On Fri, 16 Apr 2021 13:11:58 -0700
Dexuan Cui <decui@microsoft.com> wrote:

> Currently the netvsc/VF binding logic only checks the PCI serial number.
> 
> The upcoming Microsoft Azure Network Adapter (MANA) supports multiple
> net_device interfaces (each such interface is called a "vPort", and has
> its unique MAC address) which are backed by the same VF PCI device, so
> the binding logic should check both the MAC address and the PCI serial
> number.
> 
> The change should not break any other existing VF drivers, because
> Hyper-V NIC SR-IOV implementation requires the netvsc network
> interface and the VF network interface have the same MAC address.
> 
> Co-developed-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Co-developed-by: Shachar Raindel <shacharr@microsoft.com>
> Signed-off-by: Shachar Raindel <shacharr@microsoft.com>
> Signed-off-by: Dexuan Cui <decui@microsoft.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

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

* Re: [PATCH v8 net-next 2/2] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)
       [not found] ` <20210416201159.25807-3-decui@microsoft.com>
@ 2021-04-19 15:54   ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2021-04-19 15:54 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: davem, kuba, kys, haiyangz, sthemmin, wei.liu, liuwe, netdev,
	leon, andrew, bernd, rdunlap, shacharr, linux-kernel,
	linux-hyperv

On Fri, 16 Apr 2021 13:11:59 -0700
Dexuan Cui <decui@microsoft.com> wrote:

> Add a VF driver for Microsoft Azure Network Adapter (MANA) that will be
> available in the future.
> 
> Co-developed-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Co-developed-by: Shachar Raindel <shacharr@microsoft.com>
> Signed-off-by: Shachar Raindel <shacharr@microsoft.com>
> Signed-off-by: Dexuan Cui <decui@microsoft.com>

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

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

* RE: [PATCH v8 net-next 1/2] hv_netvsc: Make netvsc/VF binding check both MAC and serial number
  2021-04-19 15:53   ` Stephen Hemminger
@ 2021-04-22  0:18     ` Dexuan Cui
  0 siblings, 0 replies; 5+ messages in thread
From: Dexuan Cui @ 2021-04-22  0:18 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: Stephen Hemminger, KY Srinivasan, Haiyang Zhang,
	Stephen Hemminger, wei.liu, Wei Liu, leon, andrew, bernd,
	rdunlap, Shachar Raindel, linux-kernel, linux-hyperv,
	Joseph Salisbury

> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Monday, April 19, 2021 8:54 AM
> To: Dexuan Cui <decui@microsoft.com>
>  ...
> On Fri, 16 Apr 2021 13:11:58 -0700
> Dexuan Cui <decui@microsoft.com> wrote:
> 
> > Currently the netvsc/VF binding logic only checks the PCI serial number.
> >
> > The upcoming Microsoft Azure Network Adapter (MANA) supports multiple
> > net_device interfaces (each such interface is called a "vPort", and has
> > its unique MAC address) which are backed by the same VF PCI device, so
> > the binding logic should check both the MAC address and the PCI serial
> > number.
> >
> > The change should not break any other existing VF drivers, because
> > Hyper-V NIC SR-IOV implementation requires the netvsc network
> > interface and the VF network interface have the same MAC address.
> >
> > Co-developed-by: Haiyang Zhang <haiyangz@microsoft.com>
> > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > Co-developed-by: Shachar Raindel <shacharr@microsoft.com>
> > Signed-off-by: Shachar Raindel <shacharr@microsoft.com>
> > Signed-off-by: Dexuan Cui <decui@microsoft.com>
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Hi David, Jakub,
The "2/2" patch has been in the net-next tree since Monday, but this
"1/2" patch is not in -- can you please pick up this patch as well? This
patch is needed by the "2/2" patch.

Thanks,
-- Dexuan

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 20:11 [PATCH v8 net-next 0/2] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Dexuan Cui
2021-04-16 20:11 ` [PATCH v8 net-next 1/2] hv_netvsc: Make netvsc/VF binding check both MAC and serial number Dexuan Cui
2021-04-19 15:53   ` Stephen Hemminger
2021-04-22  0:18     ` Dexuan Cui
     [not found] ` <20210416201159.25807-3-decui@microsoft.com>
2021-04-19 15:54   ` [PATCH v8 net-next 2/2] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Stephen Hemminger

Linux-HyperV Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hyperv/0 linux-hyperv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hyperv linux-hyperv/ https://lore.kernel.org/linux-hyperv \
		linux-hyperv@vger.kernel.org
	public-inbox-index linux-hyperv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hyperv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git