All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 00/10] backports: add igb driver
@ 2013-12-12  9:27 Stefan Assmann
  2013-12-12  9:27 ` [PATCH RFC 01/10] backports: add igb ethernet network driver Stefan Assmann
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:27 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

This is a RFC for inclusion of the Intel igb wired ethernet driver.
Patches are split per kernel release that makes it easier to review
the changes and gives a nice history of what was necessary for each
release. Also the igb driver changes have been split up into individual
patches in patches/collateral-evolutions/network/82-ethernet. This and
file names are up for discussion, suggestions welcome.

Support goes back to kernel 3.0 since current igb relies on ptp support
which got introduced in 3.0. Currently the patches still break for
kernel before 3.0 but I wanted to get the RFC out, this should be fixed
next time.

One thing I'm not sure how to fix is the following HWMON warning.
make KLIB=/lib/modules/3.0.0 defconfig-igb
make[2]: `conf' is up to date.
boolean symbol HWMON tested for 'm'? test forced to 'n'
boolean symbol HWMON tested for 'm'? test forced to 'n'

Patches apply against tag backports-20131206, feedback is very welcome.

Stefan Assmann (10):
  backports: add igb ethernet network driver
  backports: igb fixes for linux-3.9
  backports: igb fixes for linux-3.8
  backports: igb fixes for linux-3.7
  backports: igb fixes for linux-3.6
  backports: igb fixes for linux-3.5
  backports: igb fixes for linux-3.4
  backports: igb fixes for linux-3.3
  backports: igb fixes for linux-3.2
  backports: igb fixes for linux-3.1

 backport/backport-include/linux/ethtool.h          | 192 +++++++++++++++++++++
 backport/backport-include/linux/gfp.h              |  10 ++
 backport/backport-include/linux/if.h               |   8 +
 backport/backport-include/linux/if_link.h          |  17 ++
 backport/backport-include/linux/mdio.h             |  56 ++++++
 backport/backport-include/linux/pci.h              |  36 ++++
 backport/backport-include/linux/pci_regs.h         |   8 +
 backport/backport-include/linux/ptp_clock_kernel.h |  35 ++++
 backport/backport-include/linux/skbuff.h           |  74 ++++++++
 backport/backport-include/linux/u64_stats_sync.h   |  16 +-
 backport/compat/backport-3.10.c                    |  46 +++++
 backport/compat/compat-3.5.c                       |   7 +
 backport/compat/compat-3.8.c                       |  32 ++++
 backport/defconfigs/igb                            |   7 +
 copy-list                                          |   4 +
 .../network/82-ethernet/igb_err_handler.patch      |  16 ++
 .../82-ethernet/igb_ndo_set_vf_spoofchk.patch      |  14 ++
 .../network/82-ethernet/igb_net_device_ops.patch   |  56 ++++++
 .../network/82-ethernet/igb_no_fcs.patch           |  16 ++
 .../82-ethernet/igb_pci_sriov_configure.patch      |  14 ++
 .../network/82-ethernet/igb_ptp.patch              |  17 ++
 .../network/82-ethernet/igb_vlan_rx_vid.patch      |  64 +++++++
 22 files changed, 743 insertions(+), 2 deletions(-)
 create mode 100644 backport/backport-include/linux/gfp.h
 create mode 100644 backport/backport-include/linux/if_link.h
 create mode 100644 backport/backport-include/linux/mdio.h
 create mode 100644 backport/backport-include/linux/ptp_clock_kernel.h
 create mode 100644 backport/defconfigs/igb
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_ndo_set_vf_spoofchk.patch
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_net_device_ops.patch
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_no_fcs.patch
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_pci_sriov_configure.patch
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_vlan_rx_vid.patch

-- 
1.8.3.1


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

* [PATCH RFC 01/10] backports: add igb ethernet network driver
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
@ 2013-12-12  9:27 ` Stefan Assmann
  2013-12-13  0:27   ` Hauke Mehrtens
  2013-12-12  9:27 ` [PATCH RFC 02/10] backports: igb fixes for linux-3.9 Stefan Assmann
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:27 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- add igb to copy-list
- add igb defconfig
- refactor u64_stats_sync.h a bit
- add u64_stats_init define

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/u64_stats_sync.h | 16 ++++++++++++++--
 backport/defconfigs/igb                          |  7 +++++++
 copy-list                                        |  4 ++++
 3 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100644 backport/defconfigs/igb

diff --git a/backport/backport-include/linux/u64_stats_sync.h b/backport/backport-include/linux/u64_stats_sync.h
index f15116c..ce6b778 100644
--- a/backport/backport-include/linux/u64_stats_sync.h
+++ b/backport/backport-include/linux/u64_stats_sync.h
@@ -1,6 +1,17 @@
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+#ifndef __BACKPORT_LINUX_U64_STATS_SYNC_H
+#define __BACKPORT_LINUX_U64_STATS_SYNC_H
+
 #include_next <linux/u64_stats_sync.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
+# define u64_stats_init(syncp)	seqcount_init(syncp.seq)
 #else
+# define u64_stats_init(syncp)	do { } while (0)
+#endif
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
 #ifndef _LINUX_U64_STATS_SYNC_H
 #define _LINUX_U64_STATS_SYNC_H
 
@@ -141,4 +152,5 @@ static inline bool u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp,
 }
 
 #endif /* _LINUX_U64_STATS_SYNC_H */
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) */
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
+#endif /* __BACKPORT_LINUX_U64_STATS_SYNC_H */
diff --git a/backport/defconfigs/igb b/backport/defconfigs/igb
new file mode 100644
index 0000000..1f85f18
--- /dev/null
+++ b/backport/defconfigs/igb
@@ -0,0 +1,7 @@
+CPTCFG_NETDEVICES=y
+CPTCFG_NET_ETHERNET=y
+CPTCFG_NETDEV_1000=y
+CPTCFG_ETHERNET=y
+CPTCFG_NET_VENDOR_INTEL=y
+CPTCFG_PCI=y
+CPTCFG_IGB=m
diff --git a/copy-list b/copy-list
index 9444aff..2b2e177 100644
--- a/copy-list
+++ b/copy-list
@@ -100,6 +100,10 @@ drivers/net/ethernet/broadcom/Makefile
 drivers/net/ethernet/broadcom/b44.c
 drivers/net/ethernet/broadcom/b44.h
 
+drivers/net/ethernet/intel/Kconfig
+drivers/net/ethernet/intel/Makefile
+drivers/net/ethernet/intel/igb/
+
 # wwan drivers
 include/uapi/linux/usb/cdc.h
 include/uapi/linux/usb/cdc-wdm.h
-- 
1.8.3.1


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

* [PATCH RFC 02/10] backports: igb fixes for linux-3.9
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
  2013-12-12  9:27 ` [PATCH RFC 01/10] backports: add igb ethernet network driver Stefan Assmann
@ 2013-12-12  9:27 ` Stefan Assmann
  2013-12-12  9:27 ` [PATCH RFC 03/10] backports: igb fixes for linux-3.8 Stefan Assmann
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:27 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- add struct pci_sriov
- add pci_vfs_assigned()
- add PCI_SRIOV defines
- add patches/collateral-evolutions/network/82-ethernet/igb_net_device_ops.patch

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/pci.h              | 25 ++++++++++
 backport/backport-include/linux/pci_regs.h         |  8 ++++
 backport/compat/backport-3.10.c                    | 46 ++++++++++++++++++
 .../network/82-ethernet/igb_net_device_ops.patch   | 56 ++++++++++++++++++++++
 4 files changed, 135 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_net_device_ops.patch

diff --git a/backport/backport-include/linux/pci.h b/backport/backport-include/linux/pci.h
index 3a1815a..b56761f 100644
--- a/backport/backport-include/linux/pci.h
+++ b/backport/backport-include/linux/pci.h
@@ -178,4 +178,29 @@ bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
 	.subvendor = (subvend), .subdevice = (subdev)
 #endif /* PCI_DEVICE_SUB */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
+/* Taken from drivers/pci/pci.h */
+struct pci_sriov {
+	int pos;		/* capability position */
+	int nres;		/* number of resources */
+	u32 cap;		/* SR-IOV Capabilities */
+	u16 ctrl;		/* SR-IOV Control */
+	u16 total_VFs;		/* total VFs associated with the PF */
+	u16 initial_VFs;	/* initial VFs associated with the PF */
+	u16 num_VFs;		/* number of VFs available */
+	u16 offset;		/* first VF Routing ID offset */
+	u16 stride;		/* following VF stride */
+	u32 pgsz;		/* page size for BAR alignment */
+	u8 link;		/* Function Dependency Link */
+	u16 driver_max_VFs;	/* max num VFs driver supports */
+	struct pci_dev *dev;	/* lowest numbered PF */
+	struct pci_dev *self;	/* this PF */
+	struct mutex lock;	/* lock for VF bus */
+	struct work_struct mtask; /* VF Migration task */
+	u8 __iomem *mstate;	/* VF Migration State Array */
+};
+
+extern int pci_vfs_assigned(struct pci_dev *dev);
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
+
 #endif /* _BACKPORT_LINUX_PCI_H */
diff --git a/backport/backport-include/linux/pci_regs.h b/backport/backport-include/linux/pci_regs.h
index 5cfa742..b52c4a5 100644
--- a/backport/backport-include/linux/pci_regs.h
+++ b/backport/backport-include/linux/pci_regs.h
@@ -125,4 +125,12 @@
 #define PCI_PM_CAP_PME_SHIFT	11
 #endif
 
+#ifndef PCI_SRIOV_VF_DID
+#define PCI_SRIOV_VF_DID	0x1a	/* VF Device ID */
+#endif
+
+#ifndef PCI_SRIOV_CTRL_VFE
+#define PCI_SRIOV_CTRL_VFE	0x01	/* VF Enable */
+#endif
+
 #endif /* __BACKPORT_UAPI_PCI_REGS_H */
diff --git a/backport/compat/backport-3.10.c b/backport/compat/backport-3.10.c
index 07a8dac..a9f74ed 100644
--- a/backport/compat/backport-3.10.c
+++ b/backport/compat/backport-3.10.c
@@ -14,6 +14,8 @@
 #include <linux/proc_fs.h>
 #include <linux/random.h>
 #include <linux/tty.h>
+#include <linux/pci.h>
+#include <linux/pci_regs.h>
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
 #include <linux/init.h>
@@ -128,4 +130,48 @@ void tty_port_tty_hangup(struct tty_port *port, bool check_clocal)
 }
 EXPORT_SYMBOL_GPL(tty_port_tty_hangup);
 #endif /* CONFIG_TTY */
+
+#ifdef CONFIG_PCI_IOV
+/*
+ * pci_vfs_assigned - returns number of VFs are assigned to a guest
+ * @dev: the PCI device
+ *
+ * Returns number of VFs belonging to this device that are assigned to a guest.
+ * If device is not a physical function returns -ENODEV.
+ */
+int pci_vfs_assigned(struct pci_dev *dev)
+{
+	struct pci_dev *vfdev;
+	unsigned int vfs_assigned = 0;
+	unsigned short dev_id;
+
+	/* only search if we are a PF */
+	if (!dev->is_physfn)
+		return 0;
+
+	/*
+	 * determine the device ID for the VFs, the vendor ID will be the
+	 * same as the PF so there is no need to check for that one
+	 */
+	pci_read_config_word(dev, dev->sriov->pos + PCI_SRIOV_VF_DID, &dev_id);
+
+	/* loop through all the VFs to see if we own any that are assigned */
+	vfdev = pci_get_device(dev->vendor, dev_id, NULL);
+	while (vfdev) {
+		/*
+		 * It is considered assigned if it is a virtual function with
+		 * our dev as the physical function and the assigned bit is set
+		 */
+		if (vfdev->is_virtfn && (vfdev->physfn == dev) &&
+		    (vfdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED))
+			vfs_assigned++;
+
+		vfdev = pci_get_device(dev->vendor, dev_id, vfdev);
+	}
+
+	return vfs_assigned;
+}
+EXPORT_SYMBOL_GPL(pci_vfs_assigned);
+#endif /* CONFIG_PCI_IOV */
+
 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) */
diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_net_device_ops.patch b/patches/collateral-evolutions/network/82-ethernet/igb_net_device_ops.patch
new file mode 100644
index 0000000..981b89e
--- /dev/null
+++ b/patches/collateral-evolutions/network/82-ethernet/igb_net_device_ops.patch
@@ -0,0 +1,56 @@
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
+index 14ad4c7..f2a5abf 100644
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -161,8 +161,13 @@ static int igb_ioctl(struct net_device *, struct ifreq *, int cmd);
+ static void igb_tx_timeout(struct net_device *);
+ static void igb_reset_task(struct work_struct *);
+ static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16);
+ static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16);
++#else
++static int igb_vlan_rx_add_vid(struct net_device *, u16);
++static int igb_vlan_rx_kill_vid(struct net_device *, u16);
++#endif
+ static void igb_restore_vlan(struct igb_adapter *);
+ static void igb_rar_set_qsel(struct igb_adapter *, u8 *, u32 , u8);
+ static void igb_ping_all_vfs(struct igb_adapter *);
+@@ -6959,8 +6964,12 @@ static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features)
+ 	igb_rlpml_set(adapter);
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ static int igb_vlan_rx_add_vid(struct net_device *netdev,
+ 			       __be16 proto, u16 vid)
++#else
++static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
++#endif
+ {
+ 	struct igb_adapter *adapter = netdev_priv(netdev);
+ 	struct e1000_hw *hw = &adapter->hw;
+@@ -6977,8 +6986,12 @@ static int igb_vlan_rx_add_vid(struct net_device *netdev,
+ 	return 0;
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ static int igb_vlan_rx_kill_vid(struct net_device *netdev,
+ 				__be16 proto, u16 vid)
++#else
++static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
++#endif
+ {
+ 	struct igb_adapter *adapter = netdev_priv(netdev);
+ 	struct e1000_hw *hw = &adapter->hw;
+@@ -7004,7 +7017,11 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
+ 	igb_vlan_mode(adapter->netdev, adapter->netdev->features);
+ 
+ 	for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ 		igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
++#else
++		igb_vlan_rx_add_vid(adapter->netdev, vid);
++#endif
+ }
+ 
+ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx)
-- 
1.8.3.1


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

* [PATCH RFC 03/10] backports: igb fixes for linux-3.8
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
  2013-12-12  9:27 ` [PATCH RFC 01/10] backports: add igb ethernet network driver Stefan Assmann
  2013-12-12  9:27 ` [PATCH RFC 02/10] backports: igb fixes for linux-3.9 Stefan Assmann
@ 2013-12-12  9:27 ` Stefan Assmann
  2013-12-12  9:27 ` [PATCH RFC 04/10] backports: igb fixes for linux-3.7 Stefan Assmann
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:27 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- add missing NETDEV_FRAG defines

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/skbuff.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index 43d33ca..7d04b54 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -224,4 +224,13 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
 		     skb = skb->next)
 #endif /* < 2.6.28 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
+#ifndef NETDEV_FRAG_PAGE_MAX_ORDER
+#define NETDEV_FRAG_PAGE_MAX_ORDER get_order(32768)
+#endif
+#ifndef NETDEV_FRAG_PAGE_MAX_SIZE
+#define NETDEV_FRAG_PAGE_MAX_SIZE  (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER)
+#endif
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */
+
 #endif /* __BACKPORT_SKBUFF_H */
-- 
1.8.3.1


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

* [PATCH RFC 04/10] backports: igb fixes for linux-3.7
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
                   ` (2 preceding siblings ...)
  2013-12-12  9:27 ` [PATCH RFC 03/10] backports: igb fixes for linux-3.8 Stefan Assmann
@ 2013-12-12  9:27 ` Stefan Assmann
  2013-12-12  9:27 ` [PATCH RFC 05/10] backports: igb fixes for linux-3.6 Stefan Assmann
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:27 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- add pci_sriov_set_totalvfs()
- add patches/collateral-evolutions/network/82-ethernet/igb_pci_sriov_configure.patch

Thought of backporting struct pci_driver like this:
struct backport_pci_driver {
[...]
};
but that introduces the following.
  CC [M]  /dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.o
/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c: In function ‘igb_init_module’:
/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c:698: warning: passing argument 1 of ‘__pci_register_driver’ from incompatible pointer type
include/linux/pci.h:1002: note: expected ‘struct pci_driver *’ but argument is of type ‘struct backport_pci_driver *’
/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c: In function ‘igb_exit_module’:
/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c:715: warning: passing argument 1 of ‘pci_unregister_driver’ from incompatible pointer type
include/linux/pci.h:1011: note: expected ‘struct pci_driver *’ but argument is of type ‘struct backport_pci_driver *’
Adding these as well would drag along several pci dependencies and I'm not sure
this is really safe. Opinions?

For now I've just commented out the code.

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/pci.h              |  5 +++-
 backport/compat/compat-3.8.c                       | 32 ++++++++++++++++++++++
 .../82-ethernet/igb_pci_sriov_configure.patch      | 14 ++++++++++
 3 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_pci_sriov_configure.patch

diff --git a/backport/backport-include/linux/pci.h b/backport/backport-include/linux/pci.h
index b56761f..c3360f1 100644
--- a/backport/backport-include/linux/pci.h
+++ b/backport/backport-include/linux/pci.h
@@ -178,6 +178,10 @@ bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
 	.subvendor = (subvend), .subdevice = (subdev)
 #endif /* PCI_DEVICE_SUB */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
+int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
 /* Taken from drivers/pci/pci.h */
 struct pci_sriov {
@@ -202,5 +206,4 @@ struct pci_sriov {
 
 extern int pci_vfs_assigned(struct pci_dev *dev);
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
-
 #endif /* _BACKPORT_LINUX_PCI_H */
diff --git a/backport/compat/compat-3.8.c b/backport/compat/compat-3.8.c
index c6824bf..1404f29 100644
--- a/backport/compat/compat-3.8.c
+++ b/backport/compat/compat-3.8.c
@@ -18,6 +18,8 @@
 #include <linux/netdevice.h>
 #include <linux/random.h>
 #include <linux/of.h>
+#include <linux/pci.h>
+#include <linux/pci_regs.h>
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,8))
 void netdev_set_default_ethtool_ops(struct net_device *dev,
@@ -514,3 +516,33 @@ int of_property_read_u8_array(const struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(of_property_read_u8_array);
 #endif /* CONFIG_OF */
+
+/**
+ * pci_sriov_set_totalvfs -- reduce the TotalVFs available
+ * @dev: the PCI PF device
+ * @numvfs: number that should be used for TotalVFs supported
+ *
+ * Should be called from PF driver's probe routine with
+ * device's mutex held.
+ *
+ * Returns 0 if PF is an SRIOV-capable device and
+ * value of numvfs valid. If not a PF return -ENOSYS;
+ * if numvfs is invalid return -EINVAL;
+ * if VFs already enabled, return -EBUSY.
+ */
+int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
+{
+	if (!dev->is_physfn)
+		return -ENOSYS;
+	if (numvfs > dev->sriov->total_VFs)
+		return -EINVAL;
+
+	/* Shouldn't change if VFs already enabled */
+	if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE)
+		return -EBUSY;
+	else
+		dev->sriov->driver_max_VFs = numvfs;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs);
diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_pci_sriov_configure.patch b/patches/collateral-evolutions/network/82-ethernet/igb_pci_sriov_configure.patch
new file mode 100644
index 0000000..bd9b3dd
--- /dev/null
+++ b/patches/collateral-evolutions/network/82-ethernet/igb_pci_sriov_configure.patch
@@ -0,0 +1,14 @@
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
+index f2a5abf..433463d 100644
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -249,7 +249,9 @@ static struct pci_driver igb_driver = {
+ 	.driver.pm = &igb_pm_ops,
+ #endif
+ 	.shutdown = igb_shutdown,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
+ 	.sriov_configure = igb_pci_sriov_configure,
++#endif
+ 	.err_handler = &igb_err_handler
+ };
+ 
-- 
1.8.3.1


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

* [PATCH RFC 05/10] backports: igb fixes for linux-3.6
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
                   ` (3 preceding siblings ...)
  2013-12-12  9:27 ` [PATCH RFC 04/10] backports: igb fixes for linux-3.7 Stefan Assmann
@ 2013-12-12  9:27 ` Stefan Assmann
  2013-12-13  0:46   ` Hauke Mehrtens
  2013-12-12  9:27 ` [PATCH RFC 06/10] backports: igb fixes for linux-3.5 Stefan Assmann
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:27 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- backport ethtool_cmd
- backport ethtool_ops
- backport mmd_eee_adv_to_ethtool_adv_t
- add patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
- add patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/ethtool.h          | 107 +++++++++++++++++++++
 backport/backport-include/linux/mdio.h             |  35 +++++++
 .../network/82-ethernet/igb_err_handler.patch      |  16 +++
 .../network/82-ethernet/igb_ptp.patch              |  17 ++++
 4 files changed, 175 insertions(+)
 create mode 100644 backport/backport-include/linux/mdio.h
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch

diff --git a/backport/backport-include/linux/ethtool.h b/backport/backport-include/linux/ethtool.h
index 647fbf6..ccbec11 100644
--- a/backport/backport-include/linux/ethtool.h
+++ b/backport/backport-include/linux/ethtool.h
@@ -42,4 +42,111 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
 }
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
+#define ETH_TP_MDI_AUTO		0x03 /*                  control: auto-select */
+
+/* This should work for both 32 and 64 bit userland. */
+struct backport_ethtool_cmd {
+	__u32	cmd;
+	__u32	supported;	/* Features this interface supports */
+	__u32	advertising;	/* Features this interface advertises */
+	__u16	speed;	        /* The forced speed (lower bits) in
+				 * Mbps. Please use
+				 * ethtool_cmd_speed()/_set() to
+				 * access it */
+	__u8	duplex;		/* Duplex, half or full */
+	__u8	port;		/* Which connector port */
+	__u8	phy_address;	/* MDIO PHY address (PRTAD for clause 45).
+				 * May be read-only or read-write
+				 * depending on the driver.
+				 */
+	__u8	transceiver;	/* Which transceiver to use */
+	__u8	autoneg;	/* Enable or disable autonegotiation */
+	__u8	mdio_support;	/* MDIO protocols supported.  Read-only.
+				 * Not set by all drivers.
+				 */
+	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
+	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
+	__u16	speed_hi;       /* The forced speed (upper
+				 * bits) in Mbps. Please use
+				 * ethtool_cmd_speed()/_set() to
+				 * access it */
+	__u8	eth_tp_mdix;	/* twisted pair MDI-X status */
+	__u8    eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
+				   * link should be renegotiated if necessary
+				   */
+	__u32	lp_advertising;	/* Features the link partner advertises */
+	__u32	reserved[2];
+};
+#define ethtool_cmd LINUX_BACKPORT(ethtool_cmd)
+
+static inline __u32 backport_ethtool_cmd_speed(const struct ethtool_cmd *ep)
+{
+        return (ep->speed_hi << 16) | ep->speed;
+}
+#define ethtool_cmd_speed LINUX_BACKPORT(ethtool_cmd_speed)
+
+struct backport_ethtool_ops {
+	int	(*get_settings)(struct net_device *, struct ethtool_cmd *);
+	int	(*set_settings)(struct net_device *, struct ethtool_cmd *);
+	void	(*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
+	int	(*get_regs_len)(struct net_device *);
+	void	(*get_regs)(struct net_device *, struct ethtool_regs *, void *);
+	void	(*get_wol)(struct net_device *, struct ethtool_wolinfo *);
+	int	(*set_wol)(struct net_device *, struct ethtool_wolinfo *);
+	u32	(*get_msglevel)(struct net_device *);
+	void	(*set_msglevel)(struct net_device *, u32);
+	int	(*nway_reset)(struct net_device *);
+	u32	(*get_link)(struct net_device *);
+	int	(*get_eeprom_len)(struct net_device *);
+	int	(*get_eeprom)(struct net_device *,
+			      struct ethtool_eeprom *, u8 *);
+	int	(*set_eeprom)(struct net_device *,
+			      struct ethtool_eeprom *, u8 *);
+	int	(*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
+	int	(*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
+	void	(*get_ringparam)(struct net_device *,
+				 struct ethtool_ringparam *);
+	int	(*set_ringparam)(struct net_device *,
+				 struct ethtool_ringparam *);
+	void	(*get_pauseparam)(struct net_device *,
+				  struct ethtool_pauseparam*);
+	int	(*set_pauseparam)(struct net_device *,
+				  struct ethtool_pauseparam*);
+	void	(*self_test)(struct net_device *, struct ethtool_test *, u64 *);
+	void	(*get_strings)(struct net_device *, u32 stringset, u8 *);
+	int	(*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
+	void	(*get_ethtool_stats)(struct net_device *,
+				     struct ethtool_stats *, u64 *);
+	int	(*begin)(struct net_device *);
+	void	(*complete)(struct net_device *);
+	u32	(*get_priv_flags)(struct net_device *);
+	int	(*set_priv_flags)(struct net_device *, u32);
+	int	(*get_sset_count)(struct net_device *, int);
+	int	(*get_rxnfc)(struct net_device *,
+			     struct ethtool_rxnfc *, u32 *rule_locs);
+	int	(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
+	int	(*flash_device)(struct net_device *, struct ethtool_flash *);
+	int	(*reset)(struct net_device *, u32 *);
+	u32	(*get_rxfh_indir_size)(struct net_device *);
+	int	(*get_rxfh_indir)(struct net_device *, u32 *);
+	int	(*set_rxfh_indir)(struct net_device *, const u32 *);
+	void	(*get_channels)(struct net_device *, struct ethtool_channels *);
+	int	(*set_channels)(struct net_device *, struct ethtool_channels *);
+	int	(*get_dump_flag)(struct net_device *, struct ethtool_dump *);
+	int	(*get_dump_data)(struct net_device *,
+				 struct ethtool_dump *, void *);
+	int	(*set_dump)(struct net_device *, struct ethtool_dump *);
+	int	(*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
+	int     (*get_module_info)(struct net_device *,
+				   struct ethtool_modinfo *);
+	int     (*get_module_eeprom)(struct net_device *,
+				     struct ethtool_eeprom *, u8 *);
+	int	(*get_eee)(struct net_device *, struct ethtool_eee *);
+	int	(*set_eee)(struct net_device *, struct ethtool_eee *);
+};
+#define ethtool_ops LINUX_BACKPORT(ethtool_ops)
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
+
 #endif /* __BACKPORT_LINUX_ETHTOOL_H */
diff --git a/backport/backport-include/linux/mdio.h b/backport/backport-include/linux/mdio.h
new file mode 100644
index 0000000..2a38121
--- /dev/null
+++ b/backport/backport-include/linux/mdio.h
@@ -0,0 +1,35 @@
+#ifndef __BACKPORT_LINUX_MDIO_H
+#define __BACKPORT_LINUX_MDIO_H
+#include_next <linux/mdio.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
+/**
+ * mmd_eee_adv_to_ethtool_adv_t
+ * @eee_adv: value of the MMD EEE Advertisement/Link Partner Ability registers
+ *
+ * A small helper function that translates the MMD EEE Advertisment (7.60)
+ * and MMD EEE Link Partner Ability (7.61) bits to ethtool advertisement
+ * settings.
+ */
+static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
+{
+	u32 adv = 0;
+
+	if (eee_adv & MDIO_EEE_100TX)
+		adv |= ADVERTISED_100baseT_Full;
+	if (eee_adv & MDIO_EEE_1000T)
+		adv |= ADVERTISED_1000baseT_Full;
+	if (eee_adv & MDIO_EEE_10GT)
+		adv |= ADVERTISED_10000baseT_Full;
+	if (eee_adv & MDIO_EEE_1000KX)
+		adv |= ADVERTISED_1000baseKX_Full;
+	if (eee_adv & MDIO_EEE_10GKX4)
+		adv |= ADVERTISED_10000baseKX4_Full;
+	if (eee_adv & MDIO_EEE_10GKR)
+		adv |= ADVERTISED_10000baseKR_Full;
+
+	return adv;
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
+
+#endif /* __BACKPORT_LINUX_MDIO_H */
diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch b/patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
new file mode 100644
index 0000000..393e8b5
--- /dev/null
+++ b/patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
@@ -0,0 +1,16 @@
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
+index 67441f2..4df7bce 100644
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -232,7 +232,11 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *,
+ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *);
+ static void igb_io_resume(struct pci_dev *);
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+ static const struct pci_error_handlers igb_err_handler = {
++#else
++static struct pci_error_handlers igb_err_handler = {
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
+ 	.error_detected = igb_io_error_detected,
+ 	.slot_reset = igb_io_slot_reset,
+ 	.resume = igb_io_resume,
diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch b/patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
new file mode 100644
index 0000000..9799466
--- /dev/null
+++ b/patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
@@ -0,0 +1,17 @@
+diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
+index 5a54e3d..97bb1cf 100644
+--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
++++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
+@@ -802,8 +802,12 @@ void igb_ptp_init(struct igb_adapter *adapter)
+ 		wr32(E1000_IMS, E1000_IMS_TS);
+ 	}
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+ 	adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
+ 						&adapter->pdev->dev);
++#else
++	adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps);
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
+ 	if (IS_ERR(adapter->ptp_clock)) {
+ 		adapter->ptp_clock = NULL;
+ 		dev_err(&adapter->pdev->dev, "ptp_clock_register failed\n");
-- 
1.8.3.1


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

* [PATCH RFC 06/10] backports: igb fixes for linux-3.5
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
                   ` (4 preceding siblings ...)
  2013-12-12  9:27 ` [PATCH RFC 05/10] backports: igb fixes for linux-3.6 Stefan Assmann
@ 2013-12-12  9:27 ` Stefan Assmann
  2013-12-12  9:27 ` [PATCH RFC 07/10] backports: igb fixes for linux-3.4 Stefan Assmann
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:27 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- add EEE defines
- add struct ethtool_eee
- backport __skb_alloc_page and __skb_alloc_pages

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/ethtool.h | 32 +++++++++++++++++++++
 backport/backport-include/linux/gfp.h     | 10 +++++++
 backport/backport-include/linux/mdio.h    | 23 +++++++++++++++-
 backport/backport-include/linux/skbuff.h  | 46 +++++++++++++++++++++++++++++++
 4 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 backport/backport-include/linux/gfp.h

diff --git a/backport/backport-include/linux/ethtool.h b/backport/backport-include/linux/ethtool.h
index ccbec11..e375ee9 100644
--- a/backport/backport-include/linux/ethtool.h
+++ b/backport/backport-include/linux/ethtool.h
@@ -42,6 +42,37 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
 }
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
+/**
+ * struct ethtool_eee - Energy Efficient Ethernet information
+ * @cmd: ETHTOOL_{G,S}EEE
+ * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
+ *	for which there is EEE support.
+ * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
+ *	advertised as eee capable.
+ * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
+ *	combinations advertised by the link partner as eee capable.
+ * @eee_active: Result of the eee auto negotiation.
+ * @eee_enabled: EEE configured mode (enabled/disabled).
+ * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
+ *	that eee was negotiated.
+ * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
+ *	its tx lpi (after reaching 'idle' state). Effective only when eee
+ *	was negotiated and tx_lpi_enabled was set.
+ */
+struct ethtool_eee {
+	__u32	cmd;
+	__u32	supported;
+	__u32	advertised;
+	__u32	lp_advertised;
+	__u32	eee_active;
+	__u32	eee_enabled;
+	__u32	tx_lpi_enabled;
+	__u32	tx_lpi_timer;
+	__u32	reserved[2];
+};
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
 #define ETH_TP_MDI_AUTO		0x03 /*                  control: auto-select */
 
@@ -86,6 +117,7 @@ static inline __u32 backport_ethtool_cmd_speed(const struct ethtool_cmd *ep)
 }
 #define ethtool_cmd_speed LINUX_BACKPORT(ethtool_cmd_speed)
 
+struct ethtool_eee;
 struct backport_ethtool_ops {
 	int	(*get_settings)(struct net_device *, struct ethtool_cmd *);
 	int	(*set_settings)(struct net_device *, struct ethtool_cmd *);
diff --git a/backport/backport-include/linux/gfp.h b/backport/backport-include/linux/gfp.h
new file mode 100644
index 0000000..2962290
--- /dev/null
+++ b/backport/backport-include/linux/gfp.h
@@ -0,0 +1,10 @@
+#ifndef __BACKPORT_LINUX_GFP_H
+#define __BACKPORT_LINUX_GFP_H
+#include_next <linux/gfp.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+#define ___GFP_MEMALLOC		0x2000u
+#define __GFP_MEMALLOC	((__force gfp_t)___GFP_MEMALLOC)/* Allow access to emergency reserves */
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) */
+
+#endif /* __BACKPORT_LINUX_GFP_H */
diff --git a/backport/backport-include/linux/mdio.h b/backport/backport-include/linux/mdio.h
index 2a38121..838958a 100644
--- a/backport/backport-include/linux/mdio.h
+++ b/backport/backport-include/linux/mdio.h
@@ -2,6 +2,28 @@
 #define __BACKPORT_LINUX_MDIO_H
 #include_next <linux/mdio.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
+/* EEE Supported/Advertisement/LP Advertisement registers.
+ *
+ * EEE capability Register (3.20), Advertisement (7.60) and
+ * Link partner ability (7.61) registers have and can use the same identical
+ * bit masks.
+ */
+#define MDIO_AN_EEE_ADV_100TX	0x0002	/* Advertise 100TX EEE cap */
+#define MDIO_AN_EEE_ADV_1000T	0x0004	/* Advertise 1000T EEE cap */
+/* Note: the two defines above can be potentially used by the user-land
+ * and cannot remove them now.
+ * So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros
+ * using the previous ones (that can be considered obsolete).
+ */
+#define MDIO_EEE_100TX		MDIO_AN_EEE_ADV_100TX	/* 100TX EEE cap */
+#define MDIO_EEE_1000T		MDIO_AN_EEE_ADV_1000T	/* 1000T EEE cap */
+#define MDIO_EEE_10GT		0x0008	/* 10GT EEE cap */
+#define MDIO_EEE_1000KX		0x0010	/* 1000KX EEE cap */
+#define MDIO_EEE_10GKX4		0x0020	/* 10G KX4 EEE cap */
+#define MDIO_EEE_10GKR		0x0040	/* 10G KR EEE cap */
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
 /**
  * mmd_eee_adv_to_ethtool_adv_t
@@ -31,5 +53,4 @@ static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
 	return adv;
 }
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
-
 #endif /* __BACKPORT_LINUX_MDIO_H */
diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index 7d04b54..31d882a 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -224,6 +224,52 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
 		     skb = skb->next)
 #endif /* < 2.6.28 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
+/**
+ *	__skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data
+ *	@gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX
+ *	@skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used
+ *	@order: size of the allocation
+ *
+ * 	Allocate a new page.
+ *
+ * 	%NULL is returned if there is no free memory.
+*/
+static inline struct page *__skb_alloc_pages(gfp_t gfp_mask,
+					      struct sk_buff *skb,
+					      unsigned int order)
+{
+	struct page *page;
+
+	gfp_mask |= __GFP_COLD;
+#if 0
+	if (!(gfp_mask & __GFP_NOMEMALLOC))
+		gfp_mask |= __GFP_MEMALLOC;
+#endif
+	page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
+#if 0
+	if (skb && page && page->pfmemalloc)
+		skb->pfmemalloc = true;
+#endif
+	return page;
+}
+
+/**
+ *	__skb_alloc_page - allocate a page for ps-rx for a given skb and preserve pfmemalloc data
+ *	@gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX
+ *	@skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used
+ *
+ * 	Allocate a new page.
+ *
+ * 	%NULL is returned if there is no free memory.
+ */
+static inline struct page *__skb_alloc_page(gfp_t gfp_mask,
+					     struct sk_buff *skb)
+{
+	return __skb_alloc_pages(gfp_mask, skb, 0);
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
 #ifndef NETDEV_FRAG_PAGE_MAX_ORDER
 #define NETDEV_FRAG_PAGE_MAX_ORDER get_order(32768)
-- 
1.8.3.1


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

* [PATCH RFC 07/10] backports: igb fixes for linux-3.4
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
                   ` (5 preceding siblings ...)
  2013-12-12  9:27 ` [PATCH RFC 06/10] backports: igb fixes for linux-3.5 Stefan Assmann
@ 2013-12-12  9:27 ` Stefan Assmann
  2013-12-12  9:28 ` [PATCH RFC 08/10] backports: igb fixes for linux-3.3 Stefan Assmann
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:27 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- add struct ethtool_ts_info
- add struct ethtool_modinfo
- add struct timestamp_event_queue
- add struct ptp_clock
- add ptp_clock_index()

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/ethtool.h          | 48 ++++++++++++++++++++++
 backport/backport-include/linux/ptp_clock_kernel.h | 35 ++++++++++++++++
 backport/compat/compat-3.5.c                       |  7 ++++
 3 files changed, 90 insertions(+)
 create mode 100644 backport/backport-include/linux/ptp_clock_kernel.h

diff --git a/backport/backport-include/linux/ethtool.h b/backport/backport-include/linux/ethtool.h
index e375ee9..9a7575f 100644
--- a/backport/backport-include/linux/ethtool.h
+++ b/backport/backport-include/linux/ethtool.h
@@ -42,6 +42,54 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
 }
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
+/* EEPROM Standards for plug in modules */
+#define ETH_MODULE_SFF_8079		0x1
+#define ETH_MODULE_SFF_8079_LEN		256
+#define ETH_MODULE_SFF_8472		0x2
+#define ETH_MODULE_SFF_8472_LEN		512
+
+/**
+ * struct ethtool_ts_info - holds a device's timestamping and PHC association
+ * @cmd: command number = %ETHTOOL_GET_TS_INFO
+ * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
+ * @phc_index: device index of the associated PHC, or -1 if there is none
+ * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
+ * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
+ *
+ * The bits in the 'tx_types' and 'rx_filters' fields correspond to
+ * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
+ * respectively.  For example, if the device supports HWTSTAMP_TX_ON,
+ * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
+ */
+struct ethtool_ts_info {
+	__u32	cmd;
+	__u32	so_timestamping;
+	__s32	phc_index;
+	__u32	tx_types;
+	__u32	tx_reserved[3];
+	__u32	rx_filters;
+	__u32	rx_reserved[3];
+};
+
+/**
+ * struct ethtool_modinfo - plugin module eeprom information
+ * @cmd: %ETHTOOL_GMODULEINFO
+ * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
+ * @eeprom_len: Length of the eeprom
+ *
+ * This structure is used to return the information to
+ * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
+ * The type code indicates the eeprom data format
+ */
+struct ethtool_modinfo {
+	__u32   cmd;
+	__u32   type;
+	__u32   eeprom_len;
+	__u32   reserved[8];
+};
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
 /**
  * struct ethtool_eee - Energy Efficient Ethernet information
diff --git a/backport/backport-include/linux/ptp_clock_kernel.h b/backport/backport-include/linux/ptp_clock_kernel.h
new file mode 100644
index 0000000..1b72093
--- /dev/null
+++ b/backport/backport-include/linux/ptp_clock_kernel.h
@@ -0,0 +1,35 @@
+#ifndef __BACKPORT_PTP_CLOCK_KERNEL_H
+#define __BACKPORT_PTP_CLOCK_KERNEL_H
+#include_next <linux/ptp_clock_kernel.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
+#include <linux/posix-clock.h>
+
+#define PTP_MAX_TIMESTAMPS 128
+#define PTP_BUF_TIMESTAMPS 30
+
+struct timestamp_event_queue {
+	struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS];
+	int head;
+	int tail;
+	spinlock_t lock;
+};
+
+struct ptp_clock {
+	struct posix_clock clock;
+	struct device *dev;
+	struct ptp_clock_info *info;
+	dev_t devid;
+	int index; /* index into clocks.map */
+	struct pps_device *pps_source;
+	long dialed_frequency; /* remembers the frequency adjustment */
+	struct timestamp_event_queue tsevq; /* simple fifo for time stamps */
+	struct mutex tsevq_mux; /* one process at a time reading the fifo */
+	wait_queue_head_t tsev_wq;
+	int defunct; /* tells readers to go away when clock is being removed */
+};
+
+extern int ptp_clock_index(struct ptp_clock *ptp);
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */
+
+#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */
diff --git a/backport/compat/compat-3.5.c b/backport/compat/compat-3.5.c
index 95f52b9..ebc0a19 100644
--- a/backport/compat/compat-3.5.c
+++ b/backport/compat/compat-3.5.c
@@ -12,6 +12,7 @@
 #include <linux/highuid.h>
 #include <linux/ktime.h>
 #include <linux/hrtimer.h>
+#include <linux/ptp_clock_kernel.h>
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
 #include <linux/device.h>
@@ -64,3 +65,9 @@ int overflowgid = DEFAULT_OVERFLOWGID;
 EXPORT_SYMBOL_GPL(overflowuid);
 EXPORT_SYMBOL_GPL(overflowgid);
 #endif
+
+int ptp_clock_index(struct ptp_clock *ptp)
+{
+	return ptp->index;
+}
+EXPORT_SYMBOL(ptp_clock_index);
-- 
1.8.3.1


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

* [PATCH RFC 08/10] backports: igb fixes for linux-3.3
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
                   ` (6 preceding siblings ...)
  2013-12-12  9:27 ` [PATCH RFC 07/10] backports: igb fixes for linux-3.4 Stefan Assmann
@ 2013-12-12  9:28 ` Stefan Assmann
  2013-12-12  9:28 ` [PATCH RFC 09/10] backports: igb fixes for linux-3.2 Stefan Assmann
  2013-12-12  9:28 ` [PATCH RFC 10/10] backports: igb fixes for linux-3.1 Stefan Assmann
  9 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:28 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- patches/collateral-evolutions/network/82-ethernet/igb_no_fcs.patch

How to handle changes in struct sk_buff? Changes just commented out
for now.

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/if.h                     |  4 ++++
 .../network/82-ethernet/igb_no_fcs.patch                 | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_no_fcs.patch

diff --git a/backport/backport-include/linux/if.h b/backport/backport-include/linux/if.h
index 8f85b83..f23d2b8 100644
--- a/backport/backport-include/linux/if.h
+++ b/backport/backport-include/linux/if.h
@@ -33,4 +33,8 @@
 #define IFF_LIVE_ADDR_CHANGE 0x100000
 #endif
 
+#ifndef IFF_SUPP_NOFCS
+#define IFF_SUPP_NOFCS	0x80000		/* device supports sending custom FCS */
+#endif
+
 #endif	/* _BACKPORT_LINUX_IF_H */
diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_no_fcs.patch b/patches/collateral-evolutions/network/82-ethernet/igb_no_fcs.patch
new file mode 100644
index 0000000..f196f2d
--- /dev/null
+++ b/patches/collateral-evolutions/network/82-ethernet/igb_no_fcs.patch
@@ -0,0 +1,16 @@
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
+index fd6a103..a919cfa 100644
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -4480,9 +4480,10 @@ static u32 igb_tx_cmd_type(struct sk_buff *skb, u32 tx_flags)
+ 	cmd_type |= IGB_SET_FLAG(tx_flags, IGB_TX_FLAGS_TSTAMP,
+ 				 (E1000_ADVTXD_MAC_TSTAMP));
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
+ 	/* insert frame checksum */
+ 	cmd_type ^= IGB_SET_FLAG(skb->no_fcs, 1, E1000_ADVTXD_DCMD_IFCS);
+-
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) */
+ 	return cmd_type;
+ }
+ 
-- 
1.8.3.1


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

* [PATCH RFC 09/10] backports: igb fixes for linux-3.2
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
                   ` (7 preceding siblings ...)
  2013-12-12  9:28 ` [PATCH RFC 08/10] backports: igb fixes for linux-3.3 Stefan Assmann
@ 2013-12-12  9:28 ` Stefan Assmann
  2013-12-12  9:28 ` [PATCH RFC 10/10] backports: igb fixes for linux-3.1 Stefan Assmann
  9 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:28 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- handle struct ethtool_ops changes
- add patches/collateral-evolutions/network/82-ethernet/igb_vlan_rx_vid.patch

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/ethtool.h          |  5 ++
 .../network/82-ethernet/igb_vlan_rx_vid.patch      | 64 ++++++++++++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_vlan_rx_vid.patch

diff --git a/backport/backport-include/linux/ethtool.h b/backport/backport-include/linux/ethtool.h
index 9a7575f..c2ab04d 100644
--- a/backport/backport-include/linux/ethtool.h
+++ b/backport/backport-include/linux/ethtool.h
@@ -224,6 +224,11 @@ struct backport_ethtool_ops {
 				     struct ethtool_eeprom *, u8 *);
 	int	(*get_eee)(struct net_device *, struct ethtool_eee *);
 	int	(*set_eee)(struct net_device *, struct ethtool_eee *);
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
+	u32	(*get_rx_csum)(struct net_device *);
+	u32	(*get_flags)(struct net_device *);
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) */
 };
 #define ethtool_ops LINUX_BACKPORT(ethtool_ops)
 
diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_vlan_rx_vid.patch b/patches/collateral-evolutions/network/82-ethernet/igb_vlan_rx_vid.patch
new file mode 100644
index 0000000..44ea22e
--- /dev/null
+++ b/patches/collateral-evolutions/network/82-ethernet/igb_vlan_rx_vid.patch
@@ -0,0 +1,64 @@
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
+index 37e6062..6bf0a88 100644
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -164,10 +164,13 @@ static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16);
+ static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16);
+-#else
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+ static int igb_vlan_rx_add_vid(struct net_device *, u16);
+ static int igb_vlan_rx_kill_vid(struct net_device *, u16);
+-#endif
++#else
++static void igb_vlan_rx_add_vid(struct net_device *, u16);
++static void igb_vlan_rx_kill_vid(struct net_device *, u16);
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) */
+ static void igb_restore_vlan(struct igb_adapter *);
+ static void igb_rar_set_qsel(struct igb_adapter *, u8 *, u32 , u8);
+ static void igb_ping_all_vfs(struct igb_adapter *);
+@@ -6974,8 +6977,10 @@ static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ static int igb_vlan_rx_add_vid(struct net_device *netdev,
+ 			       __be16 proto, u16 vid)
+-#else
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+ static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
++#else
++static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
+ #endif
+ {
+ 	struct igb_adapter *adapter = netdev_priv(netdev);
+@@ -6990,15 +6995,19 @@ static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
+ 
+ 	set_bit(vid, adapter->active_vlans);
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+ 	return 0;
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) */
+ }
+ 
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ static int igb_vlan_rx_kill_vid(struct net_device *netdev,
+ 				__be16 proto, u16 vid)
+-#else
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+ static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
+-#endif
++#else
++static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) */
+ {
+ 	struct igb_adapter *adapter = netdev_priv(netdev);
+ 	struct e1000_hw *hw = &adapter->hw;
+@@ -7014,7 +7023,9 @@ static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
+ 
+ 	clear_bit(vid, adapter->active_vlans);
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+ 	return 0;
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) */
+ }
+ 
+ static void igb_restore_vlan(struct igb_adapter *adapter)
-- 
1.8.3.1


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

* [PATCH RFC 10/10] backports: igb fixes for linux-3.1
  2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
                   ` (8 preceding siblings ...)
  2013-12-12  9:28 ` [PATCH RFC 09/10] backports: igb fixes for linux-3.2 Stefan Assmann
@ 2013-12-12  9:28 ` Stefan Assmann
  9 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-12  9:28 UTC (permalink / raw)
  To: mcgrof; +Cc: backports, hauke, sassmann

- backport struct ifla_vf_info
- backport enum pci_dev_flags
- add skb_frag_size_sub()
- add skb_frag_address()
- add patches/collateral-evolutions/network/82-ethernet/igb_ndo_set_vf_spoofchk.patch

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 backport/backport-include/linux/if.h                  |  4 ++++
 backport/backport-include/linux/if_link.h             | 17 +++++++++++++++++
 backport/backport-include/linux/pci.h                 |  8 ++++++++
 backport/backport-include/linux/skbuff.h              | 19 +++++++++++++++++++
 .../network/82-ethernet/igb_ndo_set_vf_spoofchk.patch | 14 ++++++++++++++
 5 files changed, 62 insertions(+)
 create mode 100644 backport/backport-include/linux/if_link.h
 create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_ndo_set_vf_spoofchk.patch

diff --git a/backport/backport-include/linux/if.h b/backport/backport-include/linux/if.h
index f23d2b8..a072579 100644
--- a/backport/backport-include/linux/if.h
+++ b/backport/backport-include/linux/if.h
@@ -37,4 +37,8 @@
 #define IFF_SUPP_NOFCS	0x80000		/* device supports sending custom FCS */
 #endif
 
+#ifndef IFF_UNICAST_FLT
+#define IFF_UNICAST_FLT	0x20000		/* Supports unicast filtering	*/
+#endif
+
 #endif	/* _BACKPORT_LINUX_IF_H */
diff --git a/backport/backport-include/linux/if_link.h b/backport/backport-include/linux/if_link.h
new file mode 100644
index 0000000..42d4c33
--- /dev/null
+++ b/backport/backport-include/linux/if_link.h
@@ -0,0 +1,17 @@
+#ifndef __BACKPORT_LINUX_IF_LINK_H
+#define __BACKPORT_LINUX_IF_LINK_H
+#include_next <linux/if_link.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
+struct backport_ifla_vf_info {
+	__u32 vf;
+	__u8 mac[32];
+	__u32 vlan;
+	__u32 qos;
+	__u32 tx_rate;
+	__u32 spoofchk;
+};
+#define ifla_vf_info LINUX_BACKPORT(ifla_vf_info)
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) */
+
+#endif /* __BACKPORT_LINUX_IF_LINK_H */
diff --git a/backport/backport-include/linux/pci.h b/backport/backport-include/linux/pci.h
index c3360f1..511e015 100644
--- a/backport/backport-include/linux/pci.h
+++ b/backport/backport-include/linux/pci.h
@@ -178,6 +178,14 @@ bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
 	.subvendor = (subvend), .subdevice = (subdev)
 #endif /* PCI_DEVICE_SUB */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
+enum backport_pci_dev_flags {
+	/* Provide indication device is assigned by a Virtual Machine Manager */
+	PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4,
+};
+#define pci_dev_flags LINUX_BACKPORT(pci_dev_flags);
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */
diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index 31d882a..c3a259f 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -224,6 +224,25 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
 		     skb = skb->next)
 #endif /* < 2.6.28 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
+static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
+{
+	frag->size -= delta;
+}
+
+/**
+ * skb_frag_address - gets the address of the data contained in a paged fragment
+ * @frag: the paged fragment buffer
+ *
+ * Returns the address of the data within @frag. The page must already
+ * be mapped.
+ */
+static inline void *skb_frag_address(const skb_frag_t *frag)
+{
+	return page_address(skb_frag_page(frag)) + frag->page_offset;
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
 /**
  *	__skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data
diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_ndo_set_vf_spoofchk.patch b/patches/collateral-evolutions/network/82-ethernet/igb_ndo_set_vf_spoofchk.patch
new file mode 100644
index 0000000..69ac88f
--- /dev/null
+++ b/patches/collateral-evolutions/network/82-ethernet/igb_ndo_set_vf_spoofchk.patch
@@ -0,0 +1,14 @@
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
+index 6bf0a88..d641e86 100644
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -1932,7 +1932,9 @@ static const struct net_device_ops igb_netdev_ops = {
+ 	.ndo_set_vf_mac		= igb_ndo_set_vf_mac,
+ 	.ndo_set_vf_vlan	= igb_ndo_set_vf_vlan,
+ 	.ndo_set_vf_tx_rate	= igb_ndo_set_vf_bw,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ 	.ndo_set_vf_spoofchk	= igb_ndo_set_vf_spoofchk,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */
+ 	.ndo_get_vf_config	= igb_ndo_get_vf_config,
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+ 	.ndo_poll_controller	= igb_netpoll,
-- 
1.8.3.1


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

* Re: [PATCH RFC 01/10] backports: add igb ethernet network driver
  2013-12-12  9:27 ` [PATCH RFC 01/10] backports: add igb ethernet network driver Stefan Assmann
@ 2013-12-13  0:27   ` Hauke Mehrtens
  2013-12-13  7:39     ` Stefan Assmann
  0 siblings, 1 reply; 15+ messages in thread
From: Hauke Mehrtens @ 2013-12-13  0:27 UTC (permalink / raw)
  To: Stefan Assmann; +Cc: mcgrof, backports

On 12/12/2013 10:27 AM, Stefan Assmann wrote:
> - add igb to copy-list
> - add igb defconfig
> - refactor u64_stats_sync.h a bit
> - add u64_stats_init define
> 
> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
> ---
>  backport/backport-include/linux/u64_stats_sync.h | 16 ++++++++++++++--
>  backport/defconfigs/igb                          |  7 +++++++
>  copy-list                                        |  4 ++++
>  3 files changed, 25 insertions(+), 2 deletions(-)
>  create mode 100644 backport/defconfigs/igb
> 
> diff --git a/backport/backport-include/linux/u64_stats_sync.h b/backport/backport-include/linux/u64_stats_sync.h
> index f15116c..ce6b778 100644
> --- a/backport/backport-include/linux/u64_stats_sync.h
> +++ b/backport/backport-include/linux/u64_stats_sync.h
> @@ -1,6 +1,17 @@
> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
> +#ifndef __BACKPORT_LINUX_U64_STATS_SYNC_H
> +#define __BACKPORT_LINUX_U64_STATS_SYNC_H
> +
>  #include_next <linux/u64_stats_sync.h>
> +
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
> +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
> +# define u64_stats_init(syncp)	seqcount_init(syncp.seq)
>  #else
> +# define u64_stats_init(syncp)	do { } while (0)
> +#endif
> +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) */
> +
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
>  #ifndef _LINUX_U64_STATS_SYNC_H
>  #define _LINUX_U64_STATS_SYNC_H
>  
> @@ -141,4 +152,5 @@ static inline bool u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp,
>  }
>  
>  #endif /* _LINUX_U64_STATS_SYNC_H */
> -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) */
> +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
> +#endif /* __BACKPORT_LINUX_U64_STATS_SYNC_H */
> diff --git a/backport/defconfigs/igb b/backport/defconfigs/igb
> new file mode 100644
> index 0000000..1f85f18
> --- /dev/null
> +++ b/backport/defconfigs/igb
> @@ -0,0 +1,7 @@
> +CPTCFG_NETDEVICES=y
> +CPTCFG_NET_ETHERNET=y
> +CPTCFG_NETDEV_1000=y
> +CPTCFG_ETHERNET=y
> +CPTCFG_NET_VENDOR_INTEL=y
> +CPTCFG_PCI=y
> +CPTCFG_IGB=m

PCI should not be selected here, because it has to be selected in the
kernel you are compiling against. I have not analyzed this, but I thing
the defconfig should just contain these two options, the others should
be already activated in the kernel:

CPTCFG_NET_VENDOR_INTEL=y
CPTCFG_IGB=m

> diff --git a/copy-list b/copy-list
> index 9444aff..2b2e177 100644
> --- a/copy-list
> +++ b/copy-list
> @@ -100,6 +100,10 @@ drivers/net/ethernet/broadcom/Makefile
>  drivers/net/ethernet/broadcom/b44.c
>  drivers/net/ethernet/broadcom/b44.h
>  
> +drivers/net/ethernet/intel/Kconfig
> +drivers/net/ethernet/intel/Makefile
> +drivers/net/ethernet/intel/igb/
> +

This should be added in the last patch otherwise backports will not
compile between this patch and the last one, becaise some parts are missing.

>  # wwan drivers
>  include/uapi/linux/usb/cdc.h
>  include/uapi/linux/usb/cdc-wdm.h
> 


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

* Re: [PATCH RFC 05/10] backports: igb fixes for linux-3.6
  2013-12-12  9:27 ` [PATCH RFC 05/10] backports: igb fixes for linux-3.6 Stefan Assmann
@ 2013-12-13  0:46   ` Hauke Mehrtens
  2013-12-13  8:01     ` Stefan Assmann
  0 siblings, 1 reply; 15+ messages in thread
From: Hauke Mehrtens @ 2013-12-13  0:46 UTC (permalink / raw)
  To: Stefan Assmann; +Cc: mcgrof, backports

On 12/12/2013 10:27 AM, Stefan Assmann wrote:
> - backport ethtool_cmd
> - backport ethtool_ops
> - backport mmd_eee_adv_to_ethtool_adv_t
> - add patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
> - add patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
> 
> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
> ---
>  backport/backport-include/linux/ethtool.h          | 107 +++++++++++++++++++++
>  backport/backport-include/linux/mdio.h             |  35 +++++++
>  .../network/82-ethernet/igb_err_handler.patch      |  16 +++
>  .../network/82-ethernet/igb_ptp.patch              |  17 ++++
>  4 files changed, 175 insertions(+)
>  create mode 100644 backport/backport-include/linux/mdio.h
>  create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
>  create mode 100644 patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
> 
> diff --git a/backport/backport-include/linux/ethtool.h b/backport/backport-include/linux/ethtool.h
> index 647fbf6..ccbec11 100644
> --- a/backport/backport-include/linux/ethtool.h
> +++ b/backport/backport-include/linux/ethtool.h
> @@ -42,4 +42,111 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
>  }
>  #endif
>  
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
> +#define ETH_TP_MDI_AUTO		0x03 /*                  control: auto-select */
> +
> +/* This should work for both 32 and 64 bit userland. */
> +struct backport_ethtool_cmd {
> +	__u32	cmd;
> +	__u32	supported;	/* Features this interface supports */
> +	__u32	advertising;	/* Features this interface advertises */
> +	__u16	speed;	        /* The forced speed (lower bits) in
> +				 * Mbps. Please use
> +				 * ethtool_cmd_speed()/_set() to
> +				 * access it */
> +	__u8	duplex;		/* Duplex, half or full */
> +	__u8	port;		/* Which connector port */
> +	__u8	phy_address;	/* MDIO PHY address (PRTAD for clause 45).
> +				 * May be read-only or read-write
> +				 * depending on the driver.
> +				 */
> +	__u8	transceiver;	/* Which transceiver to use */
> +	__u8	autoneg;	/* Enable or disable autonegotiation */
> +	__u8	mdio_support;	/* MDIO protocols supported.  Read-only.
> +				 * Not set by all drivers.
> +				 */
> +	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
> +	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
> +	__u16	speed_hi;       /* The forced speed (upper
> +				 * bits) in Mbps. Please use
> +				 * ethtool_cmd_speed()/_set() to
> +				 * access it */
> +	__u8	eth_tp_mdix;	/* twisted pair MDI-X status */
> +	__u8    eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
> +				   * link should be renegotiated if necessary
> +				   */
> +	__u32	lp_advertising;	/* Features the link partner advertises */
> +	__u32	reserved[2];
> +};
> +#define ethtool_cmd LINUX_BACKPORT(ethtool_cmd)
> +
> +static inline __u32 backport_ethtool_cmd_speed(const struct ethtool_cmd *ep)
> +{
> +        return (ep->speed_hi << 16) | ep->speed;
> +}
> +#define ethtool_cmd_speed LINUX_BACKPORT(ethtool_cmd_speed)
> +
> +struct backport_ethtool_ops {
> +	int	(*get_settings)(struct net_device *, struct ethtool_cmd *);
> +	int	(*set_settings)(struct net_device *, struct ethtool_cmd *);
> +	void	(*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
> +	int	(*get_regs_len)(struct net_device *);
> +	void	(*get_regs)(struct net_device *, struct ethtool_regs *, void *);
> +	void	(*get_wol)(struct net_device *, struct ethtool_wolinfo *);
> +	int	(*set_wol)(struct net_device *, struct ethtool_wolinfo *);
> +	u32	(*get_msglevel)(struct net_device *);
> +	void	(*set_msglevel)(struct net_device *, u32);
> +	int	(*nway_reset)(struct net_device *);
> +	u32	(*get_link)(struct net_device *);
> +	int	(*get_eeprom_len)(struct net_device *);
> +	int	(*get_eeprom)(struct net_device *,
> +			      struct ethtool_eeprom *, u8 *);
> +	int	(*set_eeprom)(struct net_device *,
> +			      struct ethtool_eeprom *, u8 *);
> +	int	(*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
> +	int	(*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
> +	void	(*get_ringparam)(struct net_device *,
> +				 struct ethtool_ringparam *);
> +	int	(*set_ringparam)(struct net_device *,
> +				 struct ethtool_ringparam *);
> +	void	(*get_pauseparam)(struct net_device *,
> +				  struct ethtool_pauseparam*);
> +	int	(*set_pauseparam)(struct net_device *,
> +				  struct ethtool_pauseparam*);
> +	void	(*self_test)(struct net_device *, struct ethtool_test *, u64 *);
> +	void	(*get_strings)(struct net_device *, u32 stringset, u8 *);
> +	int	(*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
> +	void	(*get_ethtool_stats)(struct net_device *,
> +				     struct ethtool_stats *, u64 *);
> +	int	(*begin)(struct net_device *);
> +	void	(*complete)(struct net_device *);
> +	u32	(*get_priv_flags)(struct net_device *);
> +	int	(*set_priv_flags)(struct net_device *, u32);
> +	int	(*get_sset_count)(struct net_device *, int);
> +	int	(*get_rxnfc)(struct net_device *,
> +			     struct ethtool_rxnfc *, u32 *rule_locs);
> +	int	(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
> +	int	(*flash_device)(struct net_device *, struct ethtool_flash *);
> +	int	(*reset)(struct net_device *, u32 *);
> +	u32	(*get_rxfh_indir_size)(struct net_device *);
> +	int	(*get_rxfh_indir)(struct net_device *, u32 *);
> +	int	(*set_rxfh_indir)(struct net_device *, const u32 *);
> +	void	(*get_channels)(struct net_device *, struct ethtool_channels *);
> +	int	(*set_channels)(struct net_device *, struct ethtool_channels *);
> +	int	(*get_dump_flag)(struct net_device *, struct ethtool_dump *);
> +	int	(*get_dump_data)(struct net_device *,
> +				 struct ethtool_dump *, void *);
> +	int	(*set_dump)(struct net_device *, struct ethtool_dump *);
> +	int	(*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
> +	int     (*get_module_info)(struct net_device *,
> +				   struct ethtool_modinfo *);
> +	int     (*get_module_eeprom)(struct net_device *,
> +				     struct ethtool_eeprom *, u8 *);
> +	int	(*get_eee)(struct net_device *, struct ethtool_eee *);
> +	int	(*set_eee)(struct net_device *, struct ethtool_eee *);
> +};
> +#define ethtool_ops LINUX_BACKPORT(ethtool_ops)

Backporting ethtool_ops does not work so easily. The network stack is in
the old kernel which want to call some function with a pointer from this
strcut, but it accesses this option not by its name but by the offset in
this struct it was compiled with. If the kernel and backports are
getting compiled with a different version of this struct then they could
have a different opinion on where a certain function pointer is placed
which will lead to the kernel calling the wrong function. You have to be
careful when you want to change some structs in backports, this normally
only works when all users of this strut are in backports.

> +
> +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
> +
>  #endif /* __BACKPORT_LINUX_ETHTOOL_H */
> diff --git a/backport/backport-include/linux/mdio.h b/backport/backport-include/linux/mdio.h
> new file mode 100644
> index 0000000..2a38121
> --- /dev/null
> +++ b/backport/backport-include/linux/mdio.h
> @@ -0,0 +1,35 @@
> +#ifndef __BACKPORT_LINUX_MDIO_H
> +#define __BACKPORT_LINUX_MDIO_H
> +#include_next <linux/mdio.h>
> +
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
> +/**
> + * mmd_eee_adv_to_ethtool_adv_t
> + * @eee_adv: value of the MMD EEE Advertisement/Link Partner Ability registers
> + *
> + * A small helper function that translates the MMD EEE Advertisment (7.60)
> + * and MMD EEE Link Partner Ability (7.61) bits to ethtool advertisement
> + * settings.
> + */
> +static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
> +{
> +	u32 adv = 0;
> +
> +	if (eee_adv & MDIO_EEE_100TX)
> +		adv |= ADVERTISED_100baseT_Full;
> +	if (eee_adv & MDIO_EEE_1000T)
> +		adv |= ADVERTISED_1000baseT_Full;
> +	if (eee_adv & MDIO_EEE_10GT)
> +		adv |= ADVERTISED_10000baseT_Full;
> +	if (eee_adv & MDIO_EEE_1000KX)
> +		adv |= ADVERTISED_1000baseKX_Full;
> +	if (eee_adv & MDIO_EEE_10GKX4)
> +		adv |= ADVERTISED_10000baseKX4_Full;
> +	if (eee_adv & MDIO_EEE_10GKR)
> +		adv |= ADVERTISED_10000baseKR_Full;
> +
> +	return adv;
> +}
> +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
> +
> +#endif /* __BACKPORT_LINUX_MDIO_H */
> diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch b/patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
> new file mode 100644
> index 0000000..393e8b5
> --- /dev/null
> +++ b/patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
> @@ -0,0 +1,16 @@
> +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> +index 67441f2..4df7bce 100644
> +--- a/drivers/net/ethernet/intel/igb/igb_main.c
> ++++ b/drivers/net/ethernet/intel/igb/igb_main.c
> +@@ -232,7 +232,11 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *,
> + static pci_ers_result_t igb_io_slot_reset(struct pci_dev *);
> + static void igb_io_resume(struct pci_dev *);
> + 
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
> + static const struct pci_error_handlers igb_err_handler = {
> ++#else
> ++static struct pci_error_handlers igb_err_handler = {
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
> + 	.error_detected = igb_io_error_detected,
> + 	.slot_reset = igb_io_slot_reset,
> + 	.resume = igb_io_resume,
> diff --git a/patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch b/patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
> new file mode 100644
> index 0000000..9799466
> --- /dev/null
> +++ b/patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
> @@ -0,0 +1,17 @@
> +diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> +index 5a54e3d..97bb1cf 100644
> +--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> ++++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> +@@ -802,8 +802,12 @@ void igb_ptp_init(struct igb_adapter *adapter)
> + 		wr32(E1000_IMS, E1000_IMS_TS);
> + 	}
> + 
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
> + 	adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
> + 						&adapter->pdev->dev);
> ++#else
> ++	adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps);
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
> + 	if (IS_ERR(adapter->ptp_clock)) {
> + 		adapter->ptp_clock = NULL;
> + 		dev_err(&adapter->pdev->dev, "ptp_clock_register failed\n");
> 


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

* Re: [PATCH RFC 01/10] backports: add igb ethernet network driver
  2013-12-13  0:27   ` Hauke Mehrtens
@ 2013-12-13  7:39     ` Stefan Assmann
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-13  7:39 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: mcgrof, backports

On 13.12.2013 01:27, Hauke Mehrtens wrote:
> On 12/12/2013 10:27 AM, Stefan Assmann wrote:
>> - add igb to copy-list
>> - add igb defconfig
>> - refactor u64_stats_sync.h a bit
>> - add u64_stats_init define
>>
>> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
>> ---

[...]

>> diff --git a/backport/defconfigs/igb b/backport/defconfigs/igb
>> new file mode 100644
>> index 0000000..1f85f18
>> --- /dev/null
>> +++ b/backport/defconfigs/igb
>> @@ -0,0 +1,7 @@
>> +CPTCFG_NETDEVICES=y
>> +CPTCFG_NET_ETHERNET=y
>> +CPTCFG_NETDEV_1000=y
>> +CPTCFG_ETHERNET=y
>> +CPTCFG_NET_VENDOR_INTEL=y
>> +CPTCFG_PCI=y
>> +CPTCFG_IGB=m
> 
> PCI should not be selected here, because it has to be selected in the
> kernel you are compiling against. I have not analyzed this, but I thing
> the defconfig should just contain these two options, the others should
> be already activated in the kernel:
> 
> CPTCFG_NET_VENDOR_INTEL=y
> CPTCFG_IGB=m

I'll see if I can boil this down. I had some trouble with older kernel
to get igb recognized.

  Stefan

> 
>> diff --git a/copy-list b/copy-list
>> index 9444aff..2b2e177 100644
>> --- a/copy-list
>> +++ b/copy-list
>> @@ -100,6 +100,10 @@ drivers/net/ethernet/broadcom/Makefile
>>  drivers/net/ethernet/broadcom/b44.c
>>  drivers/net/ethernet/broadcom/b44.h
>>  
>> +drivers/net/ethernet/intel/Kconfig
>> +drivers/net/ethernet/intel/Makefile
>> +drivers/net/ethernet/intel/igb/
>> +
> 
> This should be added in the last patch otherwise backports will not
> compile between this patch and the last one, becaise some parts are missing.
> 

Right, this was only a RFC and to see what breaks I had to enable it
early. :)

  Stefan

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

* Re: [PATCH RFC 05/10] backports: igb fixes for linux-3.6
  2013-12-13  0:46   ` Hauke Mehrtens
@ 2013-12-13  8:01     ` Stefan Assmann
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Assmann @ 2013-12-13  8:01 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: mcgrof, backports

On 13.12.2013 01:46, Hauke Mehrtens wrote:
> On 12/12/2013 10:27 AM, Stefan Assmann wrote:
>> - backport ethtool_cmd
>> - backport ethtool_ops
>> - backport mmd_eee_adv_to_ethtool_adv_t
>> - add patches/collateral-evolutions/network/82-ethernet/igb_ptp.patch
>> - add patches/collateral-evolutions/network/82-ethernet/igb_err_handler.patch
>>
>> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
>> ---

[...]

>> +struct backport_ethtool_ops {
>> +	int	(*get_settings)(struct net_device *, struct ethtool_cmd *);
>> +	int	(*set_settings)(struct net_device *, struct ethtool_cmd *);
>> +	void	(*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
>> +	int	(*get_regs_len)(struct net_device *);
>> +	void	(*get_regs)(struct net_device *, struct ethtool_regs *, void *);
>> +	void	(*get_wol)(struct net_device *, struct ethtool_wolinfo *);
>> +	int	(*set_wol)(struct net_device *, struct ethtool_wolinfo *);
>> +	u32	(*get_msglevel)(struct net_device *);
>> +	void	(*set_msglevel)(struct net_device *, u32);
>> +	int	(*nway_reset)(struct net_device *);
>> +	u32	(*get_link)(struct net_device *);
>> +	int	(*get_eeprom_len)(struct net_device *);
>> +	int	(*get_eeprom)(struct net_device *,
>> +			      struct ethtool_eeprom *, u8 *);
>> +	int	(*set_eeprom)(struct net_device *,
>> +			      struct ethtool_eeprom *, u8 *);
>> +	int	(*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
>> +	int	(*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
>> +	void	(*get_ringparam)(struct net_device *,
>> +				 struct ethtool_ringparam *);
>> +	int	(*set_ringparam)(struct net_device *,
>> +				 struct ethtool_ringparam *);
>> +	void	(*get_pauseparam)(struct net_device *,
>> +				  struct ethtool_pauseparam*);
>> +	int	(*set_pauseparam)(struct net_device *,
>> +				  struct ethtool_pauseparam*);
>> +	void	(*self_test)(struct net_device *, struct ethtool_test *, u64 *);
>> +	void	(*get_strings)(struct net_device *, u32 stringset, u8 *);
>> +	int	(*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
>> +	void	(*get_ethtool_stats)(struct net_device *,
>> +				     struct ethtool_stats *, u64 *);
>> +	int	(*begin)(struct net_device *);
>> +	void	(*complete)(struct net_device *);
>> +	u32	(*get_priv_flags)(struct net_device *);
>> +	int	(*set_priv_flags)(struct net_device *, u32);
>> +	int	(*get_sset_count)(struct net_device *, int);
>> +	int	(*get_rxnfc)(struct net_device *,
>> +			     struct ethtool_rxnfc *, u32 *rule_locs);
>> +	int	(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
>> +	int	(*flash_device)(struct net_device *, struct ethtool_flash *);
>> +	int	(*reset)(struct net_device *, u32 *);
>> +	u32	(*get_rxfh_indir_size)(struct net_device *);
>> +	int	(*get_rxfh_indir)(struct net_device *, u32 *);
>> +	int	(*set_rxfh_indir)(struct net_device *, const u32 *);
>> +	void	(*get_channels)(struct net_device *, struct ethtool_channels *);
>> +	int	(*set_channels)(struct net_device *, struct ethtool_channels *);
>> +	int	(*get_dump_flag)(struct net_device *, struct ethtool_dump *);
>> +	int	(*get_dump_data)(struct net_device *,
>> +				 struct ethtool_dump *, void *);
>> +	int	(*set_dump)(struct net_device *, struct ethtool_dump *);
>> +	int	(*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
>> +	int     (*get_module_info)(struct net_device *,
>> +				   struct ethtool_modinfo *);
>> +	int     (*get_module_eeprom)(struct net_device *,
>> +				     struct ethtool_eeprom *, u8 *);
>> +	int	(*get_eee)(struct net_device *, struct ethtool_eee *);
>> +	int	(*set_eee)(struct net_device *, struct ethtool_eee *);
>> +};
>> +#define ethtool_ops LINUX_BACKPORT(ethtool_ops)
> 
> Backporting ethtool_ops does not work so easily. The network stack is in
> the old kernel which want to call some function with a pointer from this
> strcut, but it accesses this option not by its name but by the offset in
> this struct it was compiled with. If the kernel and backports are
> getting compiled with a different version of this struct then they could
> have a different opinion on where a certain function pointer is placed
> which will lead to the kernel calling the wrong function. You have to be
> careful when you want to change some structs in backports, this normally
> only works when all users of this strut are in backports.

I agree with you there, so what would be a better way to deal with
changes in struct ethtool_ops? We probably could ifdef out the code in
igb but I assume that would get very ugly rather quickly and would take a
lot of time to maintain and refresh patches against upstream. A solution
which keeps the changes to upstream minimal would be preferable if you
could think of any.

  Stefan

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

end of thread, other threads:[~2013-12-13  8:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-12  9:27 [PATCH RFC 00/10] backports: add igb driver Stefan Assmann
2013-12-12  9:27 ` [PATCH RFC 01/10] backports: add igb ethernet network driver Stefan Assmann
2013-12-13  0:27   ` Hauke Mehrtens
2013-12-13  7:39     ` Stefan Assmann
2013-12-12  9:27 ` [PATCH RFC 02/10] backports: igb fixes for linux-3.9 Stefan Assmann
2013-12-12  9:27 ` [PATCH RFC 03/10] backports: igb fixes for linux-3.8 Stefan Assmann
2013-12-12  9:27 ` [PATCH RFC 04/10] backports: igb fixes for linux-3.7 Stefan Assmann
2013-12-12  9:27 ` [PATCH RFC 05/10] backports: igb fixes for linux-3.6 Stefan Assmann
2013-12-13  0:46   ` Hauke Mehrtens
2013-12-13  8:01     ` Stefan Assmann
2013-12-12  9:27 ` [PATCH RFC 06/10] backports: igb fixes for linux-3.5 Stefan Assmann
2013-12-12  9:27 ` [PATCH RFC 07/10] backports: igb fixes for linux-3.4 Stefan Assmann
2013-12-12  9:28 ` [PATCH RFC 08/10] backports: igb fixes for linux-3.3 Stefan Assmann
2013-12-12  9:28 ` [PATCH RFC 09/10] backports: igb fixes for linux-3.2 Stefan Assmann
2013-12-12  9:28 ` [PATCH RFC 10/10] backports: igb fixes for linux-3.1 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.