Skip to contentSkip to conversation

sfc: Nic specific sriov functions, netdev_ops and sriov_configure

PATCH Superseded Shradha Shah 3 participants 9 messages Apr 8, 2015 – Apr 9, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 sfc: Own header for nic-specific sriov functions, single instance of netdev_ops and sriov removed from Falcon code

In reply to Shradha Shah

By putting all the efx_{siena,ef10}_sriov_* declarations in {siena,ef10}_sriov.h, ensure they cannot be called from nic-generic code. Also fixes up an instance of this, where mcdi.c was calling efx_siena_sriov_flr.

The single instance of netdev_ops should call general high level functions that can then call something adapter specific in efx_nic_type. We should only do adapter specialisation via efx_nic_type.

Removal of sriov functionality from the Falcon code means that tests are needed for the presence of some callbacks.

---
 drivers/net/ethernet/sfc/Makefile      |   2 +-
 drivers/net/ethernet/sfc/ef10.c        |   6 ++
 drivers/net/ethernet/sfc/ef10_sriov.h  |  56 +++++++++++++++++
 drivers/net/ethernet/sfc/efx.c         |  95 ++++++++++++----------------
 drivers/net/ethernet/sfc/efx.h         |   7 +++
 drivers/net/ethernet/sfc/falcon.c      |  10 ---
 drivers/net/ethernet/sfc/farch.c       |  48 +++++++-------
 drivers/net/ethernet/sfc/mcdi.c        |   4 +-
 drivers/net/ethernet/sfc/net_driver.h  |   8 +++
 drivers/net/ethernet/sfc/nic.h         | 111 ---------------------------------
 drivers/net/ethernet/sfc/siena.c       |   6 ++
 drivers/net/ethernet/sfc/siena_sriov.c |  53 +++++++++++++---
 drivers/net/ethernet/sfc/siena_sriov.h |  78 +++++++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.c       |  64 +++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.h       |  27 ++++++++
 15 files changed, 368 insertions(+), 207 deletions(-)
 create mode 100644 drivers/net/ethernet/sfc/ef10_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/siena_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/sriov.c
 create mode 100644 drivers/net/ethernet/sfc/sriov.h
drivers/net/ethernet/sfc/Makefile +1 -1
index 3a83c0d..a08a789 100644
@@ -3,6 +3,6 @@ sfc-y			+= efx.o nic.o farch.o falcon.o siena.o ef10.o tx.o \
 			   tenxpress.o txc43128_phy.o falcon_boards.o \
 			   mcdi.o mcdi_port.o mcdi_mon.o ptp.o
 sfc-$(CONFIG_SFC_MTD)	+= mtd.o
-sfc-$(CONFIG_SFC_SRIOV)	+= siena_sriov.o
+sfc-$(CONFIG_SFC_SRIOV)	+= sriov.o siena_sriov.o
 
 obj-$(CONFIG_SFC)	+= sfc.o
drivers/net/ethernet/sfc/ef10.c +6 -0
index fbb6cfa..4dab1b9 100644
@@ -15,6 +15,7 @@
 #include "nic.h"
 #include "workarounds.h"
 #include "selftest.h"
+#include "ef10_sriov.h"
 #include <linux/in.h>
 #include <linux/jhash.h>
 #include <linux/wait.h>
@@ -3694,6 +3695,11 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
 	.sriov_mac_address_changed = efx_ef10_sriov_mac_address_changed,
 	.sriov_wanted = efx_ef10_sriov_wanted,
 	.sriov_reset = efx_ef10_sriov_reset,
+	.sriov_flr = efx_ef10_sriov_flr,
+	.sriov_set_vf_mac = efx_ef10_sriov_set_vf_mac,
+	.sriov_set_vf_vlan = efx_ef10_sriov_set_vf_vlan,
+	.sriov_set_vf_spoofchk = efx_ef10_sriov_set_vf_spoofchk,
+	.sriov_get_vf_config = efx_ef10_sriov_get_vf_config,
 
 	.revision = EFX_REV_HUNT_A0,
 	.max_dma_mask = DMA_BIT_MASK(ESF_DZ_TX_KER_BUF_ADDR_WIDTH),
drivers/net/ethernet/sfc/ef10_sriov.h new file +56 -0

56 lines not on this page · raw message

drivers/net/ethernet/sfc/efx.c +41 -54

169 lines not on this page · raw message

drivers/net/ethernet/sfc/efx.h +7 -0
index 2587c58..bc4e4b3 100644
@@ -220,6 +220,13 @@ static inline void efx_mtd_rename(struct efx_nic *efx) {}
 static inline void efx_mtd_remove(struct efx_nic *efx) {}
 #endif
 
+#ifdef CONFIG_SFC_SRIOV
+static inline unsigned int efx_vf_size(struct efx_nic *efx)
+{
+	return 1 << efx->vi_scale;
+}
+#endif
+
 static inline void efx_schedule_channel(struct efx_channel *channel)
 {
 	netif_vdbg(channel->efx, intr, channel->efx->net_dev,
drivers/net/ethernet/sfc/falcon.c +0 -10
index f166c8e..1570375 100644
@@ -2766,11 +2766,6 @@ const struct efx_nic_type falcon_a1_nic_type = {
 	.mtd_write = falcon_mtd_write,
 	.mtd_sync = falcon_mtd_sync,
 #endif
-	.sriov_init = efx_falcon_sriov_init,
-	.sriov_fini = efx_falcon_sriov_fini,
-	.sriov_mac_address_changed = efx_falcon_sriov_mac_address_changed,
-	.sriov_wanted = efx_falcon_sriov_wanted,
-	.sriov_reset = efx_falcon_sriov_reset,
 
 	.revision = EFX_REV_FALCON_A1,
 	.txd_ptr_tbl_base = FR_AA_TX_DESC_PTR_TBL_KER,
@@ -2867,11 +2862,6 @@ const struct efx_nic_type falcon_b0_nic_type = {
 	.mtd_write = falcon_mtd_write,
 	.mtd_sync = falcon_mtd_sync,
 #endif
-	.sriov_init = efx_falcon_sriov_init,
-	.sriov_fini = efx_falcon_sriov_fini,
-	.sriov_mac_address_changed = efx_falcon_sriov_mac_address_changed,
-	.sriov_wanted = efx_falcon_sriov_wanted,
-	.sriov_reset = efx_falcon_sriov_reset,
 
 	.revision = EFX_REV_FALCON_B0,
 	.txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL,
drivers/net/ethernet/sfc/farch.c +27 -21

61 lines not on this page · raw message

drivers/net/ethernet/sfc/mcdi.c +3 -1
index d37928f..6502ada 100644
@@ -1035,7 +1035,9 @@ void efx_mcdi_process_event(struct efx_channel *channel,
 		/* MAC stats are gather lazily.  We can ignore this. */
 		break;
 	case MCDI_EVENT_CODE_FLR:
-		efx_siena_sriov_flr(efx, MCDI_EVENT_FIELD(*event, FLR_VF));
+		if (efx->type->sriov_flr)
+			efx->type->sriov_flr(efx,
+					     MCDI_EVENT_FIELD(*event, FLR_VF));
 		break;
 	case MCDI_EVENT_CODE_PTP_RX:
 	case MCDI_EVENT_CODE_PTP_FAULT:
drivers/net/ethernet/sfc/net_driver.h +8 -0
index 325dd94..ae0d145 100644
@@ -1335,6 +1335,14 @@ struct efx_nic_type {
 	void (*sriov_mac_address_changed)(struct efx_nic *efx);
 	bool (*sriov_wanted)(struct efx_nic *efx);
 	void (*sriov_reset)(struct efx_nic *efx);
+	void (*sriov_flr)(struct efx_nic *efx, unsigned vf_i);
+	int (*sriov_set_vf_mac)(struct efx_nic *efx, int vf_i, u8 *mac);
+	int (*sriov_set_vf_vlan)(struct efx_nic *efx, int vf_i, u16 vlan,
+				 u8 qos);
+	int (*sriov_set_vf_spoofchk)(struct efx_nic *efx, int vf_i,
+				     bool spoofchk);
+	int (*sriov_get_vf_config)(struct efx_nic *efx, int vf_i,
+				   struct ifla_vf_info *ivi);
 
 	int revision;
 	unsigned int txd_ptr_tbl_base;
drivers/net/ethernet/sfc/nic.h +0 -111

120 lines not on this page · raw message

drivers/net/ethernet/sfc/siena.c +6 -0
index 3583f02..3671e1d 100644
@@ -25,6 +25,7 @@
 #include "mcdi.h"
 #include "mcdi_pcol.h"
 #include "selftest.h"
+#include "siena_sriov.h"
 
 /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */
 
@@ -1002,6 +1003,11 @@ const struct efx_nic_type siena_a0_nic_type = {
 	.sriov_mac_address_changed = efx_siena_sriov_mac_address_changed,
 	.sriov_wanted = efx_siena_sriov_wanted,
 	.sriov_reset = efx_siena_sriov_reset,
+	.sriov_flr = efx_siena_sriov_flr,
+	.sriov_set_vf_mac = efx_siena_sriov_set_vf_mac,
+	.sriov_set_vf_vlan = efx_siena_sriov_set_vf_vlan,
+	.sriov_set_vf_spoofchk = efx_siena_sriov_set_vf_spoofchk,
+	.sriov_get_vf_config = efx_siena_sriov_get_vf_config,
 
 	.revision = EFX_REV_SIENA_A0,
 	.txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL,
drivers/net/ethernet/sfc/siena_sriov.c +44 -9

216 lines not on this page · raw message

drivers/net/ethernet/sfc/siena_sriov.h new file +78 -0

78 lines not on this page · raw message

drivers/net/ethernet/sfc/sriov.c new file +64 -0

64 lines not on this page · raw message

drivers/net/ethernet/sfc/sriov.h new file +27 -0
new file mode 100644
index 0000000..0b9f0f6
@@ -0,0 +1,27 @@
+/****************************************************************************
+ * Driver for Solarflare network controllers and boards
+ * Copyright 2014-2015 Solarflare Communications Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation, incorporated herein by reference.
+ */
+
+#ifndef EFX_SRIOV_H
+#define EFX_SRIOV_H
+
+#include "net_driver.h"
+
+#ifdef CONFIG_SFC_SRIOV
+
+int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac);
+int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan,
+			  u8 qos);
+int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i,
+			      bool spoofchk);
+int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i,
+			    struct ifla_vf_info *ivi);
+
+#endif /* CONFIG_SFC_SRIOV */
+
+#endif /* EFX_SRIOV_H */
#0 lore raw

cover sfc: Nic specific sriov functions, netdev_ops and sriov_configure

First two patches among the series of patches to support SRIOV on EF10.

First patch declares nic specific sriov functions in nic specific headers, creates only one instance of the netdev_ops, removes sriov functionality from Falcon code.

Second patch adds support for sriov_configure.

The Virtual Functions can be enabled but they do not bind to the SFC driver just yet.

Shradha Shah (2):
sfc: Own header for nic-specific sriov functions, single instance of
netdev_ops and sriov removed from Falcon code
sfc: Enable VF's via a write to the sysfs file sriov_numvfs

 drivers/net/ethernet/sfc/Makefile      |   2 +-
 drivers/net/ethernet/sfc/ef10.c        |   7 ++
 drivers/net/ethernet/sfc/ef10_sriov.c  |  52 +++++++++++++++
 drivers/net/ethernet/sfc/ef10_sriov.h  |  58 ++++++++++++++++
 drivers/net/ethernet/sfc/efx.c         | 118 ++++++++++++++++++---------------
 drivers/net/ethernet/sfc/efx.h         |   7 ++
 drivers/net/ethernet/sfc/falcon.c      |  10 ---
 drivers/net/ethernet/sfc/farch.c       |  48 ++++++++------
 drivers/net/ethernet/sfc/mcdi.c        |   4 +-
 drivers/net/ethernet/sfc/net_driver.h  |   9 +++
 drivers/net/ethernet/sfc/nic.h         | 111 -------------------------------
 drivers/net/ethernet/sfc/siena.c       |   7 ++
 drivers/net/ethernet/sfc/siena_sriov.c |  58 +++++++++++++---
 drivers/net/ethernet/sfc/siena_sriov.h |  79 ++++++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.c       |  64 ++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.h       |  27 ++++++++
 16 files changed, 454 insertions(+), 207 deletions(-)
 create mode 100644 drivers/net/ethernet/sfc/ef10_sriov.c
 create mode 100644 drivers/net/ethernet/sfc/ef10_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/siena_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/sriov.c
 create mode 100644 drivers/net/ethernet/sfc/sriov.h
#7 lore raw

PATCH 2/2 sfc: Enable VF's via a write to the sysfs file sriov_numvfs

This patch adds support for the use of sriov_configure on EF10 to enable Virtual Functions while the driver is loaded.

---
 drivers/net/ethernet/sfc/Makefile      |  2 +-
 drivers/net/ethernet/sfc/ef10.c        |  1 +
 drivers/net/ethernet/sfc/ef10_sriov.c  | 52 ++++++++++++++++++++++++++++++++++
 drivers/net/ethernet/sfc/ef10_sriov.h  |  2 ++
 drivers/net/ethernet/sfc/efx.c         | 23 +++++++++++++++
 drivers/net/ethernet/sfc/net_driver.h  |  1 +
 drivers/net/ethernet/sfc/siena.c       |  1 +
 drivers/net/ethernet/sfc/siena_sriov.c |  5 ++++
 drivers/net/ethernet/sfc/siena_sriov.h |  1 +
 9 files changed, 87 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/sfc/ef10_sriov.c
drivers/net/ethernet/sfc/Makefile +1 -1
index a08a789..ce8470fe7 100644
@@ -3,6 +3,6 @@ sfc-y			+= efx.o nic.o farch.o falcon.o siena.o ef10.o tx.o \
 			   tenxpress.o txc43128_phy.o falcon_boards.o \
 			   mcdi.o mcdi_port.o mcdi_mon.o ptp.o
 sfc-$(CONFIG_SFC_MTD)	+= mtd.o
-sfc-$(CONFIG_SFC_SRIOV)	+= sriov.o siena_sriov.o
+sfc-$(CONFIG_SFC_SRIOV)	+= sriov.o siena_sriov.o ef10_sriov.o
 
 obj-$(CONFIG_SFC)	+= sfc.o
drivers/net/ethernet/sfc/ef10.c +1 -0
index 4dab1b9..6890029 100644
@@ -3690,6 +3690,7 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
 	.ptp_write_host_time = efx_ef10_ptp_write_host_time,
 	.ptp_set_ts_sync_events = efx_ef10_ptp_set_ts_sync_events,
 	.ptp_set_ts_config = efx_ef10_ptp_set_ts_config,
+	.sriov_configure = efx_ef10_sriov_configure,
 	.sriov_init = efx_ef10_sriov_init,
 	.sriov_fini = efx_ef10_sriov_fini,
 	.sriov_mac_address_changed = efx_ef10_sriov_mac_address_changed,
drivers/net/ethernet/sfc/ef10_sriov.c new file +52 -0

52 lines not on this page · raw message

drivers/net/ethernet/sfc/ef10_sriov.h +2 -0
index 030bca4..6ea115e 100644
@@ -17,6 +17,8 @@ static inline bool efx_ef10_sriov_wanted(struct efx_nic *efx)
 	return false;
 }
 
+int efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs);
+
 static inline int efx_ef10_sriov_init(struct efx_nic *efx)
 {
 	return -EOPNOTSUPP;
drivers/net/ethernet/sfc/efx.c +23 -0
index 232c766..fa9ce2a 100644
@@ -3047,6 +3047,26 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
 	return rc;
 }
 
+/* efx_pci_sriov_configure returns the actual number of Virtual Functions
+ * enabled on success
+ */
+#ifdef CONFIG_SFC_SRIOV
+static int efx_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
+{
+	int rc;
+	struct efx_nic *efx = pci_get_drvdata(dev);
+
+	if (efx->type->sriov_configure) {
+		rc = efx->type->sriov_configure(efx, num_vfs);
+		if (rc)
+			return rc;
+		else
+			return num_vfs;
+	} else
+		return -ENOSYS;
+}
+#endif
+
 static int efx_pm_freeze(struct device *dev)
 {
 	struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
@@ -3269,6 +3289,9 @@ static struct pci_driver efx_pci_driver = {
 	.remove		= efx_pci_remove,
 	.driver.pm	= &efx_pm_ops,
 	.err_handler	= &efx_err_handlers,
+#ifdef CONFIG_SFC_SRIOV
+	.sriov_configure = efx_pci_sriov_configure,
+#endif
 };
 
 /**************************************************************************
drivers/net/ethernet/sfc/net_driver.h +1 -0
index ae0d145..a6f4d9a 100644
@@ -1330,6 +1330,7 @@ struct efx_nic_type {
 	int (*ptp_set_ts_sync_events)(struct efx_nic *efx, bool en, bool temp);
 	int (*ptp_set_ts_config)(struct efx_nic *efx,
 				 struct hwtstamp_config *init);
+	int (*sriov_configure)(struct efx_nic *efx, int num_vfs);
 	int (*sriov_init)(struct efx_nic *efx);
 	void (*sriov_fini)(struct efx_nic *efx);
 	void (*sriov_mac_address_changed)(struct efx_nic *efx);
drivers/net/ethernet/sfc/siena.c +1 -0
index 3671e1d..4979228 100644
@@ -998,6 +998,7 @@ const struct efx_nic_type siena_a0_nic_type = {
 #endif
 	.ptp_write_host_time = siena_ptp_write_host_time,
 	.ptp_set_ts_config = siena_ptp_set_ts_config,
+	.sriov_configure = efx_siena_sriov_configure,
 	.sriov_init = efx_siena_sriov_init,
 	.sriov_fini = efx_siena_sriov_fini,
 	.sriov_mac_address_changed = efx_siena_sriov_mac_address_changed,
drivers/net/ethernet/sfc/siena_sriov.c +5 -0
index ccadd46..9366756 100644
@@ -1701,3 +1701,8 @@ bool efx_siena_sriov_wanted(struct efx_nic *efx)
 	return false;
 #endif
 }
+
+int efx_siena_sriov_configure(struct efx_nic *efx, int num_vfs)
+{
+	return 0;
+}
drivers/net/ethernet/sfc/siena_sriov.h +1 -0
index 5014ae4..8b2ca43 100644
@@ -41,6 +41,7 @@
 	((EFX_MAX_VF_EVQ_SIZE + 2 * EFX_MAX_DMAQ_SIZE) *	\
 	 sizeof(efx_qword_t) / EFX_BUF_SIZE)
 
+int efx_siena_sriov_configure(struct efx_nic *efx, int num_vfs);
 int efx_siena_sriov_init(struct efx_nic *efx);
 void efx_siena_sriov_fini(struct efx_nic *efx);
 void efx_siena_sriov_mac_address_changed(struct efx_nic *efx);
maintainer
#8 lore raw
In reply to Shradha Shah

From: Shradha Shah <[email protected]>
Date: Wed, 8 Apr 2015 15:22:50 +0100

Quoted 10 lines

First two patches among the series of patches to support SRIOV on EF10.

First patch declares nic specific sriov functions in nic specific headers, creates only one instance of the netdev_ops, removes sriov functionality from Falcon code.

Second patch adds support for sriov_configure.

The Virtual Functions can be enabled but they do not bind to the SFC driver just yet.

Series applied, thanks.

#2 lore raw

Re: [PATCH net-next 1/2] sfc: Own header for nic-specific sriov functions, single instance of netdev_ops and sriov removed from Falcon code

In reply to Shradha Shah
Quoted 60 lines · Shradha Shah

By putting all the efx_{siena,ef10}_sriov_* declarations in {siena,ef10}_sriov.h, ensure they cannot be called from nic-generic code. Also fixes up an instance of this, where mcdi.c was calling efx_siena_sriov_flr.

The single instance of netdev_ops should call general high level functions that can then call something adapter specific in efx_nic_type. We should only do adapter specialisation via efx_nic_type.

Removal of sriov functionality from the Falcon code means that tests are needed for the presence of some callbacks.

---
 drivers/net/ethernet/sfc/Makefile      |   2 +-
 drivers/net/ethernet/sfc/ef10.c        |   6 ++
 drivers/net/ethernet/sfc/ef10_sriov.h  |  56 +++++++++++++++++
 drivers/net/ethernet/sfc/efx.c         |  95 ++++++++++++----------------
 drivers/net/ethernet/sfc/efx.h         |   7 +++
 drivers/net/ethernet/sfc/falcon.c      |  10 ---
 drivers/net/ethernet/sfc/farch.c       |  48 +++++++-------
 drivers/net/ethernet/sfc/mcdi.c        |   4 +-
 drivers/net/ethernet/sfc/net_driver.h  |   8 +++
 drivers/net/ethernet/sfc/nic.h         | 111 ---------------------------------
 drivers/net/ethernet/sfc/siena.c       |   6 ++
 drivers/net/ethernet/sfc/siena_sriov.c |  53 +++++++++++++---
 drivers/net/ethernet/sfc/siena_sriov.h |  78 +++++++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.c       |  64 +++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.h       |  27 ++++++++
 15 files changed, 368 insertions(+), 207 deletions(-)
 create mode 100644 drivers/net/ethernet/sfc/ef10_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/siena_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/sriov.c
 create mode 100644 drivers/net/ethernet/sfc/sriov.h
drivers/net/ethernet/sfc/Makefile +1 -1
index 3a83c0d..a08a789 100644
@@ -3,6 +3,6 @@ sfc-y			+= efx.o nic.o farch.o falcon.o siena.o ef10.o tx.o \
 			   tenxpress.o txc43128_phy.o falcon_boards.o \
 			   mcdi.o mcdi_port.o mcdi_mon.o ptp.o
 sfc-$(CONFIG_SFC_MTD)	+= mtd.o
-sfc-$(CONFIG_SFC_SRIOV)	+= siena_sriov.o
+sfc-$(CONFIG_SFC_SRIOV)	+= sriov.o siena_sriov.o
 
 obj-$(CONFIG_SFC)	+= sfc.o
drivers/net/ethernet/sfc/ef10.c +1 -0
index fbb6cfa..4dab1b9 100644
@@ -15,6 +15,7 @@
 #include "nic.h"
 #include "workarounds.h"
 #include "selftest.h"
+#include "ef10_sriov.h"
 #include <linux/in.h>
 #include <linux/jhash.h>
 #include <linux/wait.h>

drivers/net/ethernet/sfc/ef10.c const struct efx_nic_type efx_hunt_a0_nic_type = { · line 3703

Quoted 9 lines
drivers/net/ethernet/sfc/ef10.c +5 -0
@@ -3694,6 +3695,11 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
 	.sriov_mac_address_changed = efx_ef10_sriov_mac_address_changed,
 	.sriov_wanted = efx_ef10_sriov_wanted,
 	.sriov_reset = efx_ef10_sriov_reset,
+	.sriov_flr = efx_ef10_sriov_flr,
+	.sriov_set_vf_mac = efx_ef10_sriov_set_vf_mac,
+	.sriov_set_vf_vlan = efx_ef10_sriov_set_vf_vlan,
+	.sriov_set_vf_spoofchk = efx_ef10_sriov_set_vf_spoofchk,
+	.sriov_get_vf_config = efx_ef10_sriov_get_vf_config,
 

Hmm...

CC [M] drivers/net/ethernet/sfc/qt202x_phy.o
drivers/net/ethernet/sfc/siena.c:1008:22: error: 'efx_siena_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1009:23: error: 'efx_siena_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1010:27: error: 'efx_siena_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1011:25: error: 'efx_siena_sriov_get_vf_config' undeclared here (not in a function)
CC [M] drivers/net/ethernet/sfc/mdio_10g.o
make[5]: *** [drivers/net/ethernet/sfc/siena.o] Error 1
make[5]: *** Waiting for unfinished jobs....
drivers/net/ethernet/sfc/ef10.c:3700:22: error: 'efx_ef10_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3701:23: error: 'efx_ef10_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3702:27: error: 'efx_ef10_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3703:25: error: 'efx_ef10_sriov_get_vf_config' undeclared here (not in a function) make[5]: *** [drivers/net/ethernet/sfc/ef10.o] Error 1

#3 lore raw

Re: [PATCH net-next 1/2] sfc: Own header for nic-specific sriov functions, single instance of netdev_ops and sriov removed from Falcon code

Quoted 73 lines · Eric Dumazet
Quoted 60 lines · Shradha Shah

By putting all the efx_{siena,ef10}_sriov_* declarations in {siena,ef10}_sriov.h, ensure they cannot be called from nic-generic code. Also fixes up an instance of this, where mcdi.c was calling efx_siena_sriov_flr.

The single instance of netdev_ops should call general high level functions that can then call something adapter specific in efx_nic_type. We should only do adapter specialisation via efx_nic_type.

Removal of sriov functionality from the Falcon code means that tests are needed for the presence of some callbacks.

---
 drivers/net/ethernet/sfc/Makefile      |   2 +-
 drivers/net/ethernet/sfc/ef10.c        |   6 ++
 drivers/net/ethernet/sfc/ef10_sriov.h  |  56 +++++++++++++++++
 drivers/net/ethernet/sfc/efx.c         |  95 ++++++++++++----------------
 drivers/net/ethernet/sfc/efx.h         |   7 +++
 drivers/net/ethernet/sfc/falcon.c      |  10 ---
 drivers/net/ethernet/sfc/farch.c       |  48 +++++++-------
 drivers/net/ethernet/sfc/mcdi.c        |   4 +-
 drivers/net/ethernet/sfc/net_driver.h  |   8 +++
 drivers/net/ethernet/sfc/nic.h         | 111 ---------------------------------
 drivers/net/ethernet/sfc/siena.c       |   6 ++
 drivers/net/ethernet/sfc/siena_sriov.c |  53 +++++++++++++---
 drivers/net/ethernet/sfc/siena_sriov.h |  78 +++++++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.c       |  64 +++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.h       |  27 ++++++++
 15 files changed, 368 insertions(+), 207 deletions(-)
 create mode 100644 drivers/net/ethernet/sfc/ef10_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/siena_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/sriov.c
 create mode 100644 drivers/net/ethernet/sfc/sriov.h
drivers/net/ethernet/sfc/Makefile +1 -1
index 3a83c0d..a08a789 100644
@@ -3,6 +3,6 @@ sfc-y			+= efx.o nic.o farch.o falcon.o siena.o ef10.o tx.o \
 			   tenxpress.o txc43128_phy.o falcon_boards.o \
 			   mcdi.o mcdi_port.o mcdi_mon.o ptp.o
 sfc-$(CONFIG_SFC_MTD)	+= mtd.o
-sfc-$(CONFIG_SFC_SRIOV)	+= siena_sriov.o
+sfc-$(CONFIG_SFC_SRIOV)	+= sriov.o siena_sriov.o
 
 obj-$(CONFIG_SFC)	+= sfc.o
drivers/net/ethernet/sfc/ef10.c +1 -0
index fbb6cfa..4dab1b9 100644
@@ -15,6 +15,7 @@
 #include "nic.h"
 #include "workarounds.h"
 #include "selftest.h"
+#include "ef10_sriov.h"
 #include <linux/in.h>
 #include <linux/jhash.h>
 #include <linux/wait.h>

drivers/net/ethernet/sfc/ef10.c const struct efx_nic_type efx_hunt_a0_nic_type = { · line 3703

Quoted 9 lines
drivers/net/ethernet/sfc/ef10.c +5 -0
@@ -3694,6 +3695,11 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
 	.sriov_mac_address_changed = efx_ef10_sriov_mac_address_changed,
 	.sriov_wanted = efx_ef10_sriov_wanted,
 	.sriov_reset = efx_ef10_sriov_reset,
+	.sriov_flr = efx_ef10_sriov_flr,
+	.sriov_set_vf_mac = efx_ef10_sriov_set_vf_mac,
+	.sriov_set_vf_vlan = efx_ef10_sriov_set_vf_vlan,
+	.sriov_set_vf_spoofchk = efx_ef10_sriov_set_vf_spoofchk,
+	.sriov_get_vf_config = efx_ef10_sriov_get_vf_config,
 

Hmm...

Quoted 14 lines

CC [M] drivers/net/ethernet/sfc/qt202x_phy.o
drivers/net/ethernet/sfc/siena.c:1008:22: error: 'efx_siena_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1009:23: error: 'efx_siena_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1010:27: error: 'efx_siena_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1011:25: error: 'efx_siena_sriov_get_vf_config' undeclared here (not in a function)
CC [M] drivers/net/ethernet/sfc/mdio_10g.o
make[5]: *** [drivers/net/ethernet/sfc/siena.o] Error 1
make[5]: *** Waiting for unfinished jobs....
drivers/net/ethernet/sfc/ef10.c:3700:22: error: 'efx_ef10_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3701:23: error: 'efx_ef10_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3702:27: error: 'efx_ef10_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3703:25: error: 'efx_ef10_sriov_get_vf_config' undeclared here (not in a function) make[5]: *** [drivers/net/ethernet/sfc/ef10.o] Error 1

Please test your driver with :

$ grep PCI_IOV .config
# CONFIG_PCI_IOV is not set
$ grep SFC_SRIOV .config
$ 
maintainer
#4 lore raw

Re: [PATCH net-next 1/2] sfc: Own header for nic-specific sriov functions, single instance of netdev_ops and sriov removed from Falcon code

From: Eric Dumazet <[email protected]>
Date: Wed, 08 Apr 2015 12:57:05 -0700

Quoted 17 lines · Eric Dumazet
Quoted 6 lines · Shradha Shah

CC [M] drivers/net/ethernet/sfc/qt202x_phy.o
drivers/net/ethernet/sfc/siena.c:1008:22: error: 'efx_siena_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1009:23: error: 'efx_siena_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1010:27: error: 'efx_siena_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1011:25: error: 'efx_siena_sriov_get_vf_config' undeclared here (not in a function)

Quoted 9 lines

CC [M] drivers/net/ethernet/sfc/mdio_10g.o
make[5]: *** [drivers/net/ethernet/sfc/siena.o] Error 1
make[5]: *** Waiting for unfinished jobs....
drivers/net/ethernet/sfc/ef10.c:3700:22: error: 'efx_ef10_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3701:23: error: 'efx_ef10_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3702:27: error: 'efx_ef10_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3703:25: error: 'efx_ef10_sriov_get_vf_config' undeclared here (not in a function) make[5]: *** [drivers/net/ethernet/sfc/ef10.o] Error 1

Quoted 6 lines

Please test your driver with :

$ grep PCI_IOV .config
# CONFIG_PCI_IOV is not set
$ grep SFC_SRIOV .config
$ 

This is really terrible.

siena_sriov.c is only build when CONFIG_SFC_SRIOV is enabled, but it has CONFIG_SFC_SRIOV CPP checks all over the file. I don't know what better can define a low quality patch submission...

I tried to fix this up, but it's way too broken for a quick cure, therefore I'm reverting everything.

#6 lore raw

Re: [PATCH net-next 1/2] sfc: Own header for nic-specific sriov functions, single instance of netdev_ops and sriov removed from Falcon code

In reply to Eric Dumazet

Sorry, I will look into this again.

Quoted 99 lines · Eric Dumazet
Quoted 73 lines · Eric Dumazet
Quoted 60 lines · Shradha Shah

By putting all the efx_{siena,ef10}_sriov_* declarations in {siena,ef10}_sriov.h, ensure they cannot be called from nic-generic code. Also fixes up an instance of this, where mcdi.c was calling efx_siena_sriov_flr.

The single instance of netdev_ops should call general high level functions that can then call something adapter specific in efx_nic_type. We should only do adapter specialisation via efx_nic_type.

Removal of sriov functionality from the Falcon code means that tests are needed for the presence of some callbacks.

---
 drivers/net/ethernet/sfc/Makefile      |   2 +-
 drivers/net/ethernet/sfc/ef10.c        |   6 ++
 drivers/net/ethernet/sfc/ef10_sriov.h  |  56 +++++++++++++++++
 drivers/net/ethernet/sfc/efx.c         |  95 ++++++++++++----------------
 drivers/net/ethernet/sfc/efx.h         |   7 +++
 drivers/net/ethernet/sfc/falcon.c      |  10 ---
 drivers/net/ethernet/sfc/farch.c       |  48 +++++++-------
 drivers/net/ethernet/sfc/mcdi.c        |   4 +-
 drivers/net/ethernet/sfc/net_driver.h  |   8 +++
 drivers/net/ethernet/sfc/nic.h         | 111 ---------------------------------
 drivers/net/ethernet/sfc/siena.c       |   6 ++
 drivers/net/ethernet/sfc/siena_sriov.c |  53 +++++++++++++---
 drivers/net/ethernet/sfc/siena_sriov.h |  78 +++++++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.c       |  64 +++++++++++++++++++
 drivers/net/ethernet/sfc/sriov.h       |  27 ++++++++
 15 files changed, 368 insertions(+), 207 deletions(-)
 create mode 100644 drivers/net/ethernet/sfc/ef10_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/siena_sriov.h
 create mode 100644 drivers/net/ethernet/sfc/sriov.c
 create mode 100644 drivers/net/ethernet/sfc/sriov.h
drivers/net/ethernet/sfc/Makefile +1 -1
index 3a83c0d..a08a789 100644
@@ -3,6 +3,6 @@ sfc-y			+= efx.o nic.o farch.o falcon.o siena.o ef10.o tx.o \
 			   tenxpress.o txc43128_phy.o falcon_boards.o \
 			   mcdi.o mcdi_port.o mcdi_mon.o ptp.o
 sfc-$(CONFIG_SFC_MTD)	+= mtd.o
-sfc-$(CONFIG_SFC_SRIOV)	+= siena_sriov.o
+sfc-$(CONFIG_SFC_SRIOV)	+= sriov.o siena_sriov.o
 
 obj-$(CONFIG_SFC)	+= sfc.o
drivers/net/ethernet/sfc/ef10.c +1 -0
index fbb6cfa..4dab1b9 100644
@@ -15,6 +15,7 @@
 #include "nic.h"
 #include "workarounds.h"
 #include "selftest.h"
+#include "ef10_sriov.h"
 #include <linux/in.h>
 #include <linux/jhash.h>
 #include <linux/wait.h>

drivers/net/ethernet/sfc/ef10.c const struct efx_nic_type efx_hunt_a0_nic_type = { · line 3703

Quoted 9 lines
drivers/net/ethernet/sfc/ef10.c +5 -0
@@ -3694,6 +3695,11 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
 	.sriov_mac_address_changed = efx_ef10_sriov_mac_address_changed,
 	.sriov_wanted = efx_ef10_sriov_wanted,
 	.sriov_reset = efx_ef10_sriov_reset,
+	.sriov_flr = efx_ef10_sriov_flr,
+	.sriov_set_vf_mac = efx_ef10_sriov_set_vf_mac,
+	.sriov_set_vf_vlan = efx_ef10_sriov_set_vf_vlan,
+	.sriov_set_vf_spoofchk = efx_ef10_sriov_set_vf_spoofchk,
+	.sriov_get_vf_config = efx_ef10_sriov_get_vf_config,
 

Hmm...

Quoted 14 lines

CC [M] drivers/net/ethernet/sfc/qt202x_phy.o
drivers/net/ethernet/sfc/siena.c:1008:22: error: 'efx_siena_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1009:23: error: 'efx_siena_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1010:27: error: 'efx_siena_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1011:25: error: 'efx_siena_sriov_get_vf_config' undeclared here (not in a function)
CC [M] drivers/net/ethernet/sfc/mdio_10g.o
make[5]: *** [drivers/net/ethernet/sfc/siena.o] Error 1
make[5]: *** Waiting for unfinished jobs....
drivers/net/ethernet/sfc/ef10.c:3700:22: error: 'efx_ef10_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3701:23: error: 'efx_ef10_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3702:27: error: 'efx_ef10_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3703:25: error: 'efx_ef10_sriov_get_vf_config' undeclared here (not in a function) make[5]: *** [drivers/net/ethernet/sfc/ef10.o] Error 1

Please test your driver with :

$ grep PCI_IOV .config
# CONFIG_PCI_IOV is not set
$ grep SFC_SRIOV .config
$ 
Signature · 3 lines
Many Thanks,
Regards,
Shradha Shah
#5 lore raw

Re: [PATCH net-next 1/2] sfc: Own header for nic-specific sriov functions, single instance of netdev_ops and sriov removed from Falcon code

In reply to David Miller
Quoted 20 lines · David Miller

From: Eric Dumazet <[email protected]>
Date: Wed, 08 Apr 2015 12:57:05 -0700

Quoted 17 lines · Eric Dumazet
Quoted 15 lines · Shradha Shah

CC [M] drivers/net/ethernet/sfc/qt202x_phy.o
drivers/net/ethernet/sfc/siena.c:1008:22: error: 'efx_siena_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1009:23: error: 'efx_siena_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1010:27: error: 'efx_siena_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/siena.c:1011:25: error: 'efx_siena_sriov_get_vf_config' undeclared here (not in a function)
CC [M] drivers/net/ethernet/sfc/mdio_10g.o
make[5]: *** [drivers/net/ethernet/sfc/siena.o] Error 1
make[5]: *** Waiting for unfinished jobs....
drivers/net/ethernet/sfc/ef10.c:3700:22: error: 'efx_ef10_sriov_set_vf_mac' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3701:23: error: 'efx_ef10_sriov_set_vf_vlan' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3702:27: error: 'efx_ef10_sriov_set_vf_spoofchk' undeclared here (not in a function) drivers/net/ethernet/sfc/ef10.c:3703:25: error: 'efx_ef10_sriov_get_vf_config' undeclared here (not in a function) make[5]: *** [drivers/net/ethernet/sfc/ef10.o] Error 1

Quoted 8 lines
Quoted 6 lines

Please test your driver with :

$ grep PCI_IOV .config
# CONFIG_PCI_IOV is not set
$ grep SFC_SRIOV .config
$ 

This is really terrible.

I apologize. I will correct this in net_driver.h

Quoted 4 lines

siena_sriov.c is only build when CONFIG_SFC_SRIOV is enabled, but it has CONFIG_SFC_SRIOV CPP checks all over the file. I don't know what better can define a low quality patch submission...

siena_sriov.c is not a new file. I think a cleanup patch for cleaning up all the CONFIG_SFC_SRIOV CPP checks is required before I post any new patches.

Will correct and send out a v2.

Quoted 4 lines

I tried to fix this up, but it's way too broken for a quick cure, therefore I'm reverting everything.

Signature · 3 lines
Many Thanks,
Regards,
Shradha Shah