backports: add igb driver
v2 cover backports: add igb driver
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.
v2:
Instead of backporting struct ethtool_ops the code in igb has been wrapped in if LINUX_VERSION_CODE statements. This will result in higher maintenance because of conflicts with future upstream igb changes but it seems there's no better solution so far.
The patches in patches/collateral-evolutions/network/82-ethernet have been kept separate but with a leading number to make sure they get applied in the correct order.
The code that activates igb has been pushed to the end of the series to not break any bisecting.
Stefan Assmann (11):
backports: igb fixes for linux-3.12
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
backports: enable igb and add defconfig
backport/backport-include/linux/ethtool.h | 79 ++++++++++++++++++++++ backport/backport-include/linux/gfp.h | 10 +++ backport/backport-include/linux/if.h | 8 +++ 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 | 11 +++ backport/compat/compat-3.8.c | 34 ++++++++++ backport/defconfigs/igb | 2 + copy-list | 4 ++ .../82-ethernet/0001-igb_net_device_ops.patch | 56 +++++++++++++++ .../82-ethernet/0002-igb_pci_sriov_configure.patch | 14 ++++ .../network/82-ethernet/0003-igb_ptp.patch | 17 +++++ .../network/82-ethernet/0004-igb_err_handler.patch | 16 +++++ .../network/82-ethernet/0005-igb_mdi.patch | 49 ++++++++++++++ .../network/82-ethernet/0006-igb_eee.patch | 15 ++++ .../network/82-ethernet/0007-igb_ethtool_ops.patch | 24 +++++++ .../network/82-ethernet/0008-igb_no_fcs.patch | 16 +++++ .../network/82-ethernet/0009-igb_vlan_rx_vid.patch | 64 ++++++++++++++++++ .../network/82-ethernet/0010-igb_ethtool_ops.patch | 16 +++++ .../network/82-ethernet/0011-igb_ethtool_ops.patch | 15 ++++ .../82-ethernet/0012-igb_ndo_set_vf_spoofchk.patch | 24 +++++++ 26 files changed, 743 insertions(+), 2 deletions(-) create mode 100644 backport/backport-include/linux/gfp.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/0001-igb_net_device_ops.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0008-igb_no_fcs.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0009-igb_vlan_rx_vid.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0010-igb_ethtool_ops.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0011-igb_ethtool_ops.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0012-igb_ndo_set_vf_spoofchk.patch
Signature · 1 line
1.8.3.1
RFC PATCH v2 1/11 backports: igb fixes for linux-3.12
- refactor u64_stats_sync.h a bit
- add u64_stats_init define
--- backport/backport-include/linux/u64_stats_sync.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
backport/backport-include/linux/u64_stats_sync.h +14 -2
@@ -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 */
Signature · 1 line
1.8.3.1
RFC PATCH v2 3/11 backports: igb fixes for linux-3.8
In reply to Stefan Assmann- add missing NETDEV_FRAG defines
--- backport/backport-include/linux/skbuff.h | 9 +++++++++ 1 file changed, 9 insertions(+)
backport/backport-include/linux/skbuff.h +9 -0
@@ -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 */
Signature · 1 line
1.8.3.1
RFC PATCH v2 2/11 backports: igb fixes for linux-3.9
In reply to Stefan Assmann- add struct pci_sriov
- add pci_vfs_assigned()
- add PCI_SRIOV defines
- add patches/collateral-evolutions/network/82-ethernet/0001-igb_net_device_ops.patch
--- backport/backport-include/linux/pci.h | 25 ++++++++++ backport/backport-include/linux/pci_regs.h | 8 ++++ backport/compat/backport-3.10.c | 46 ++++++++++++++++++ .../82-ethernet/0001-igb_net_device_ops.patch | 56 ++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 patches/collateral-evolutions/network/82-ethernet/0001-igb_net_device_ops.patch
backport/backport-include/linux/pci.h +25 -0
@@ -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 */
backport/backport-include/linux/pci_regs.h +8 -0
@@ -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 */
backport/compat/backport-3.10.c +46 -0
56 lines not on this page · raw message
patches/collateral-evolutions/network/82-ethernet/0001-igb_net_device_ops.patch new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
1.8.3.1
RFC PATCH v2 5/11 backports: igb fixes for linux-3.6
In reply to Stefan Assmann- backport ethtool_cmd
- backport ethtool_ops
- backport mmd_eee_adv_to_ethtool_adv_t
- add patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch
- add patches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch
- add patches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patch
--- backport/backport-include/linux/mdio.h | 35 ++++++++++++++++ .../network/82-ethernet/0003-igb_ptp.patch | 17 ++++++++ .../network/82-ethernet/0004-igb_err_handler.patch | 16 +++++++ .../network/82-ethernet/0005-igb_mdi.patch | 49 ++++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 backport/backport-include/linux/mdio.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patch
backport/backport-include/linux/mdio.h new file +35 -0
@@ -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 */
patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch new file +17 -0
@@ -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");
patches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch new file +16 -0
@@ -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,
patches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patch new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
1.8.3.1
RFC PATCH v2 6/11 backports: igb fixes for linux-3.5
In reply to Stefan Assmann- add EEE defines
- add struct ethtool_eee
- backport __skb_alloc_page and __skb_alloc_pages
- add patches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patch
--- backport/backport-include/linux/ethtool.h | 31 +++++++++++++++ backport/backport-include/linux/gfp.h | 10 +++++ backport/backport-include/linux/mdio.h | 23 ++++++++++- backport/backport-include/linux/skbuff.h | 46 ++++++++++++++++++++++ .../network/82-ethernet/0006-igb_eee.patch | 15 +++++++ 5 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 backport/backport-include/linux/gfp.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patch
backport/backport-include/linux/ethtool.h +31 -0
@@ -42,4 +42,35 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) }#endif +#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,0 ,0 ) &&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,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ +#endif /* __BACKPORT_LINUX_ETHTOOL_H */
backport/backport-include/linux/gfp.h new file +10 -0
@@ -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 */
backport/backport-include/linux/mdio.h +22 -1
@@ -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 */
backport/backport-include/linux/skbuff.h +46 -0
52 lines not on this page · raw message
patches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patch new file +15 -0
@@ -0,0 +1,15 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index 05fd6f8..43ee8d0 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -3002,8 +3002,10 @@ static const struct ethtool_ops igb_ethtool_ops = { + .get_ts_info = igb_get_ts_info, + .get_rxnfc = igb_get_rxnfc, + .set_rxnfc = igb_set_rxnfc, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) + .get_eee = igb_get_eee, + .set_eee = igb_set_eee, ++#endif + .get_module_info = igb_get_module_info, + .get_module_eeprom = igb_get_module_eeprom, + .get_rxfh_indir_size = igb_get_rxfh_indir_size,
Signature · 1 line
1.8.3.1
RFC PATCH v2 8/11 backports: igb fixes for linux-3.3
In reply to Stefan Assmann- add IFF_SUPP_NOFCS define
- add patches/collateral-evolutions/network/82-ethernet/0008-igb_no_fcs.patch
Is there a better way to handle struct sk_buff changes?
--- backport/backport-include/linux/if.h | 4 ++++ .../network/82-ethernet/0008-igb_no_fcs.patch | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 patches/collateral-evolutions/network/82-ethernet/0008-igb_no_fcs.patch
backport/backport-include/linux/if.h +4 -0
@@ -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 */
patches/collateral-evolutions/network/82-ethernet/0008-igb_no_fcs.patch new file +16 -0
@@ -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; + } +
Signature · 1 line
1.8.3.1
RFC PATCH v2 11/11 backports: enable igb and add defconfig
In reply to Stefan AssmannAdd defconfig and add necessary files to copy-list.
--- backport/defconfigs/igb | 2 ++ copy-list | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 backport/defconfigs/igb
backport/defconfigs/igb new file +2 -0
@@ -0,0 +1,2 @@ +CPTCFG_NET_VENDOR_INTEL=y +CPTCFG_IGB=m
copy-list +4 -0
@@ -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
Signature · 1 line
1.8.3.1
RFC PATCH v2 10/11 backports: igb fixes for linux-3.1
In reply to Stefan Assmann- add IFF_UNICAST_FLT define
- add PCI_DEV_FLAGS_ASSIGNED define
- add skb_frag_size_sub()
- add skb_frag_address()
- add patches/collateral-evolutions/network/82-ethernet/0011-igb_ethtool_ops.patch
- add patches/collateral-evolutions/network/82-ethernet/0012-igb_ndo_set_vf_spoofchk.patch
--- backport/backport-include/linux/if.h | 4 ++++ backport/backport-include/linux/pci.h | 8 ++++++++ backport/backport-include/linux/skbuff.h | 19 +++++++++++++++++ .../network/82-ethernet/0011-igb_ethtool_ops.patch | 15 ++++++++++++++ .../82-ethernet/0012-igb_ndo_set_vf_spoofchk.patch | 24 ++++++++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 patches/collateral-evolutions/network/82-ethernet/0011-igb_ethtool_ops.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0012-igb_ndo_set_vf_spoofchk.patch
backport/backport-include/linux/if.h +4 -0
@@ -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 */
backport/backport-include/linux/pci.h +8 -0
@@ -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) */
backport/backport-include/linux/skbuff.h +19 -0
@@ -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 ,0 ,0 ) &&LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 )/** * __skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data
patches/collateral-evolutions/network/82-ethernet/0011-igb_ethtool_ops.patch new file +15 -0
@@ -0,0 +1,15 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index fcc7eb1..5989862 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -3002,8 +3002,10 @@ static const struct ethtool_ops igb_ethtool_ops = { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) + .get_ts_info = igb_get_ts_info, + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) + .get_rxnfc = igb_get_rxnfc, + .set_rxnfc = igb_set_rxnfc, ++#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) + .get_eee = igb_get_eee, + .set_eee = igb_set_eee,
patches/collateral-evolutions/network/82-ethernet/0012-igb_ndo_set_vf_spoofchk.patch new file +24 -0
@@ -0,0 +1,24 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c +index 6bf0a88..90fd4d6 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, +@@ -7676,7 +7678,9 @@ static int igb_ndo_get_vf_config(struct net_device *netdev, + ivi->tx_rate = adapter->vf_data[vf].tx_rate; + ivi->vlan = adapter->vf_data[vf].pf_vlan; + ivi->qos = adapter->vf_data[vf].pf_qos; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) + ivi->spoofchk = adapter->vf_data[vf].spoofchk_enabled; ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */ + return 0; + } +
Signature · 1 line
1.8.3.1
RFC PATCH v2 7/11 backports: igb fixes for linux-3.4
In reply to Stefan Assmann- add struct ethtool_ts_info
- add struct ethtool_modinfo
- add struct timestamp_event_queue
- add struct ptp_clock
- add ptp_clock_index()
- add patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patch
--- backport/backport-include/linux/ethtool.h | 48 ++++++++++++++++++++++ backport/backport-include/linux/ptp_clock_kernel.h | 35 ++++++++++++++++ backport/compat/compat-3.5.c | 11 +++++ .../network/82-ethernet/0007-igb_ethtool_ops.patch | 24 +++++++++++ 4 files changed, 118 insertions(+) create mode 100644 backport/backport-include/linux/ptp_clock_kernel.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patch
backport/backport-include/linux/ethtool.h +48 -0
@@ -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 ,0 ,0 ) &&LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 )/** * struct ethtool_eee - Energy Efficient Ethernet information
backport/backport-include/linux/ptp_clock_kernel.h new file +35 -0
@@ -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 ,0 ,0 ) &&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,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */ + +#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */
backport/compat/compat-3.5.c +11 -0
@@ -12,6 +12,9 @@#include <linux/highuid.h> #include <linux/ktime.h> #include <linux/hrtimer.h> +#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,0 ,0 ) +#include <linux/ptp_clock_kernel.h> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ #if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 ))#include <linux/device.h>
@@ -64,3 +67,11 @@ int overflowgid = DEFAULT_OVERFLOWGID;EXPORT_SYMBOL_GPL (overflowuid);EXPORT_SYMBOL_GPL (overflowgid);#endif + +#ifdef CONFIG_PTP_1588_CLOCK +int ptp_clock_index (struct ptp_clock *ptp) +{ +return ptp->index; +} +EXPORT_SYMBOL (ptp_clock_index); +#endif /* CONFIG_PTP_1588_CLOCK */
patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patch new file +24 -0
@@ -0,0 +1,24 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index 43ee8d0..b3c07d1 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -2999,15 +2999,19 @@ static const struct ethtool_ops igb_ethtool_ops = { + .get_ethtool_stats = igb_get_ethtool_stats, + .get_coalesce = igb_get_coalesce, + .set_coalesce = igb_set_coalesce, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) + .get_ts_info = igb_get_ts_info, ++#endif + .get_rxnfc = igb_get_rxnfc, + .set_rxnfc = igb_set_rxnfc, + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) + .get_eee = igb_get_eee, + .set_eee = igb_set_eee, + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) + .get_module_info = igb_get_module_info, + .get_module_eeprom = igb_get_module_eeprom, ++#endif + .get_rxfh_indir_size = igb_get_rxfh_indir_size, + .get_rxfh_indir = igb_get_rxfh_indir, + .set_rxfh_indir = igb_set_rxfh_indir,
Signature · 1 line
1.8.3.1
RFC PATCH v2 4/11 backports: igb fixes for linux-3.7
In reply to Stefan Assmann- add pci_sriov_set_totalvfs()
- add patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch
Had to ifdef out igb_pci_sriov_configure in igb because the assignment would have required changes to struct pci_driver.
--- backport/backport-include/linux/pci.h | 5 +++- backport/compat/compat-3.8.c | 34 ++++++++++++++++++++++ .../82-ethernet/0002-igb_pci_sriov_configure.patch | 14 +++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch
backport/backport-include/linux/pci.h +4 -1
@@ -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 */
backport/compat/compat-3.8.c +34 -0
@@ -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,35 @@ int of_property_read_u8_array(const struct device_node *np, }EXPORT_SYMBOL_GPL (of_property_read_u8_array);#endif /* CONFIG_OF */ + +#ifdef CONFIG_PCI_IOV +/** +* 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); +#endif /* CONFIG_PCI_IOV */
patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch new file +14 -0
@@ -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 + }; +
Signature · 1 line
1.8.3.1
RFC PATCH v2 9/11 backports: igb fixes for linux-3.2
In reply to Stefan Assmann- add patches/collateral-evolutions/network/82-ethernet/0009-igb_vlan_rx_vid.patch
- add patches/collateral-evolutions/network/82-ethernet/0010-igb_ethtool_ops.patch
--- .../network/82-ethernet/0009-igb_vlan_rx_vid.patch | 64 ++++++++++++++++++++++ .../network/82-ethernet/0010-igb_ethtool_ops.patch | 16 ++++++ 2 files changed, 80 insertions(+) create mode 100644 patches/collateral-evolutions/network/82-ethernet/0009-igb_vlan_rx_vid.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0010-igb_ethtool_ops.patch
patches/collateral-evolutions/network/82-ethernet/0009-igb_vlan_rx_vid.patch new file +64 -0
@@ -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)
patches/collateral-evolutions/network/82-ethernet/0010-igb_ethtool_ops.patch new file +16 -0
@@ -0,0 +1,16 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index b3c07d1..fcc7eb1 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -3012,9 +3012,11 @@ static const struct ethtool_ops igb_ethtool_ops = { + .get_module_info = igb_get_module_info, + .get_module_eeprom = igb_get_module_eeprom, + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) + .get_rxfh_indir_size = igb_get_rxfh_indir_size, + .get_rxfh_indir = igb_get_rxfh_indir, + .set_rxfh_indir = igb_set_rxfh_indir, ++#endif + .get_channels = igb_get_channels, + .set_channels = igb_set_channels, + .begin = igb_ethtool_begin,
Signature · 1 line
1.8.3.1
Re: [PATCH RFC v2 02/11] backports: igb fixes for linux-3.9
In reply to Stefan AssmannQuoted 33 lines · Stefan Assmann
- add struct
pci_sriov
- addpci_vfs_assigned()
- addPCI_SRIOVdefines
- addpatches/collateral-evolutions/network/82-ethernet/0001-igb_net_device_ops.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/pci.h | 25 ++++++++++ backport/backport-include/linux/pci_regs.h | 8 ++++ backport/compat/backport-3.10.c | 46 ++++++++++++++++++ .../82-ethernet/0001-igb_net_device_ops.patch | 56 ++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 patches/collateral-evolutions/network/82-ethernet/0001-igb_net_device_ops.patchbackport/backport-include/linux/pci.h +11
-0@@ -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 */
backport/backport-include/linux/pci.h bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); · line 201
Quoted 10 lines
backport/backport-include/linux/pci.h +10
-0+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 */ +};
where is this struct used?
backport/backport-include/linux/pci.h bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); · line 203
Quoted 1 line
backport/backport-include/linux/pci.h +1
-0+extern int pci_vfs_assigned (struct pci_dev *dev);
The extern is not needed.
If CONFIG_PCI_IOV is not set backports will not include the implementation of this function, you should add something like this in the header:
#ifdef CONFIG_PCI_IOV
int pci_vfs_assigned(struct pci_dev *dev); #else
static inline int pci_vfs_assigned(struct pci_dev *dev)
{
return 0;
}#endif
Quoted 145 lines
backport/backport-include/linux/pci.h +2
-0+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */ +#endif /* _BACKPORT_LINUX_PCI_H */ backport/backport-include/linux/pci_regs.h +8
-0@@ -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 */ backport/compat/backport-3.10.c +46
-0@@ -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)) */ patches/collateral-evolutions/network/82-ethernet/0001-igb_net_device_ops.patch new file +56
-0@@ -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)
Re: [PATCH RFC v2 05/11] backports: igb fixes for linux-3.6
In reply to Stefan AssmannQuoted 70 lines · Stefan Assmann
- backport
ethtool_cmd
- backportethtool_ops
- backportmmd_eee_adv_to_ethtool_adv_t
- addpatches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch
- addpatches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch
- addpatches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/mdio.h | 35 ++++++++++++++++ .../network/82-ethernet/0003-igb_ptp.patch | 17 ++++++++ .../network/82-ethernet/0004-igb_err_handler.patch | 16 +++++++ .../network/82-ethernet/0005-igb_mdi.patch | 49 ++++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 backport/backport-include/linux/mdio.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patchbackport/backport-include/linux/mdio.h new file +35
-0@@ -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 */ patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch new file +4
-0@@ -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
patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch line 14
Quoted 10 lines
patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch new file +10
-0+@@ -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) */
This could be replaced with in a header file:
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
#define ptp_clock_register(info,parent) ptp_clock_register(info) #endif
Quoted 81 lines
patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch new file +3
-0+ if (IS_ERR(adapter->ptp_clock)) { + adapter->ptp_clock = NULL; + dev_err(&adapter->pdev->dev, "ptp_clock_register failed\n");patches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch new file +16
-0@@ -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,patches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patch new file +49
-0@@ -0,0 +1,49 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index c3143da..05fd6f8 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -249,10 +249,12 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) + else + ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) + if (hw->phy.mdix == AUTO_ALL_MODES) + ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO; + else + ecmd->eth_tp_mdix_ctrl = hw->phy.mdix; ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */ + + return 0; + } +@@ -271,6 +273,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) + return -EINVAL; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) + /* MDI setting is only allowed when autoneg enabled because + * some hardware doesn't allow MDI setting when speed or + * duplex is forced. +@@ -285,6 +288,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) + return -EINVAL; + } + } ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */ + + while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) + msleep(1); +@@ -328,6 +332,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) + /* MDI-X => 2; MDI => 1; Auto => 3 */ + if (ecmd->eth_tp_mdix_ctrl) { + /* fix up the value for auto (3 => 0) as zero is mapped +@@ -338,6 +343,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) + else + hw->phy.mdix = ecmd->eth_tp_mdix_ctrl; + } ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */ + + /* reset the link */ + if (netif_running(adapter->netdev)) {
Re: [PATCH RFC v2 06/11] backports: igb fixes for linux-3.5
In reply to Stefan AssmannQuoted 44 lines · Stefan Assmann
- add EEE defines
- add structethtool_eee
- backport__skb_alloc_pageand__skb_alloc_pages
- addpatches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/ethtool.h | 31 +++++++++++++++ backport/backport-include/linux/gfp.h | 10 +++++ backport/backport-include/linux/mdio.h | 23 ++++++++++- backport/backport-include/linux/skbuff.h | 46 ++++++++++++++++++++++ .../network/82-ethernet/0006-igb_eee.patch | 15 +++++++ 5 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 backport/backport-include/linux/gfp.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patchbackport/backport-include/linux/ethtool.h +20
-0@@ -42,4 +42,35 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) }#endif +#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,0 ,0 ) &&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;
backport/backport-include/linux/ethtool.h static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) · line 74
Quoted 10 lines
backport/backport-include/linux/ethtool.h +10
-0+__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,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
The get_eee and set_eee callbacks in struct ethtool_ops are not available on this kernel, you could also add a #ifdef <kernel version> around igb_get_eee() and igb_set_eee() and remove the struct here.
Quoted 136 lines
backport/backport-include/linux/ethtool.h +1
-0+#endif /* __BACKPORT_LINUX_ETHTOOL_H */ backport/backport-include/linux/gfp.h new file +10
-0@@ -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 */ backport/backport-include/linux/mdio.h +22
-1@@ -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 */ backport/backport-include/linux/skbuff.h +46
-0@@ -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 ,0 ,0 ) &&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,0,0) && 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)patches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patch new file +15
-0@@ -0,0 +1,15 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index 05fd6f8..43ee8d0 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -3002,8 +3002,10 @@ static const struct ethtool_ops igb_ethtool_ops = { + .get_ts_info = igb_get_ts_info, + .get_rxnfc = igb_get_rxnfc, + .set_rxnfc = igb_set_rxnfc, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) + .get_eee = igb_get_eee, + .set_eee = igb_set_eee, ++#endif + .get_module_info = igb_get_module_info, + .get_module_eeprom = igb_get_module_eeprom, + .get_rxfh_indir_size = igb_get_rxfh_indir_size,
Re: [PATCH RFC v2 07/11] backports: igb fixes for linux-3.4
In reply to Stefan AssmannQuoted 132 lines · Stefan Assmann
- add struct
ethtool_ts_info
- add structethtool_modinfo
- add structtimestamp_event_queue
- add structptp_clock
- addptp_clock_index()
- addpatches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/ethtool.h | 48 ++++++++++++++++++++++ backport/backport-include/linux/ptp_clock_kernel.h | 35 ++++++++++++++++ backport/compat/compat-3.5.c | 11 +++++ .../network/82-ethernet/0007-igb_ethtool_ops.patch | 24 +++++++++++ 4 files changed, 118 insertions(+) create mode 100644 backport/backport-include/linux/ptp_clock_kernel.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patchbackport/backport-include/linux/ethtool.h +48
-0@@ -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 ,0 ,0 ) &&LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 )/** * struct ethtool_eee - Energy Efficient Ethernet information backport/backport-include/linux/ptp_clock_kernel.h new file +35
-0@@ -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 ,0 ,0 ) &&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,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */ + +#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */ backport/compat/compat-3.5.c +3
-0@@ -12,6 +12,9 @@#include <linux/highuid.h> #include <linux/ktime.h> #include <linux/hrtimer.h> +#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,0 ,0 ) +#include <linux/ptp_clock_kernel.h> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ #if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 ))#include <linux/device.h>
backport/compat/compat-3.5.c int overflowgid = DEFAULT_OVERFLOWGID; · line 76
Quoted 10 lines
backport/compat/compat-3.5.c +7
-0@@ -64,3 +67,11 @@ int overflowgid = DEFAULT_OVERFLOWGID;EXPORT_SYMBOL_GPL (overflowuid);EXPORT_SYMBOL_GPL (overflowgid);#endif + +#ifdef CONFIG_PTP_1588_CLOCK +int ptp_clock_index (struct ptp_clock *ptp) +{ +return ptp->index; +} +EXPORT_SYMBOL (ptp_clock_index);
ptp_clock_index() is only used in igb_get_ts_info() which which is never called in kernel < 3.5 because this operation does not exist in ethtool_ops there.
Backporting this is not so easy as it looks here, because you added struct ptp_clock here and there is also a version in the kernel, if they differ it could be that this index does not point to the same offset the kernel used as index variable. I would also ifdef the igb_get_ts_info() itself and remove the stuff related to ptp_clock_index(), you are seeing a unused function warning as well.
Quoted 32 lines
backport/compat/compat-3.5.c +1
-0+#endif /* CONFIG_PTP_1588_CLOCK */ patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patch new file +24
-0@@ -0,0 +1,24 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index 43ee8d0..b3c07d1 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -2999,15 +2999,19 @@ static const struct ethtool_ops igb_ethtool_ops = { + .get_ethtool_stats = igb_get_ethtool_stats, + .get_coalesce = igb_get_coalesce, + .set_coalesce = igb_set_coalesce, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) + .get_ts_info = igb_get_ts_info, ++#endif + .get_rxnfc = igb_get_rxnfc, + .set_rxnfc = igb_set_rxnfc, + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) + .get_eee = igb_get_eee, + .set_eee = igb_set_eee, + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) + .get_module_info = igb_get_module_info, + .get_module_eeprom = igb_get_module_eeprom, ++#endif + .get_rxfh_indir_size = igb_get_rxfh_indir_size, + .get_rxfh_indir = igb_get_rxfh_indir, + .set_rxfh_indir = igb_set_rxfh_indir,
Re: [PATCH RFC v2 02/11] backports: igb fixes for linux-3.9
In reply to Hauke MehrtensQuoted 38 lines · Hauke Mehrtens
Quoted 37 lines · Stefan Assmann
- add struct
pci_sriov
- addpci_vfs_assigned()
- addPCI_SRIOVdefines
- addpatches/collateral-evolutions/network/82-ethernet/0001-igb_net_device_ops.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/pci.h | 25 ++++++++++ backport/backport-include/linux/pci_regs.h | 8 ++++ backport/compat/backport-3.10.c | 46 ++++++++++++++++++ .../82-ethernet/0001-igb_net_device_ops.patch | 56 ++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 patches/collateral-evolutions/network/82-ethernet/0001-igb_net_device_ops.patchbackport/backport-include/linux/pci.h +15
-0@@ -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 */
Quoted 8 lines
backport/backport-include/linux/pci.h bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); · line 201
Quoted 6 lines
backport/backport-include/linux/pci.h +6
-0+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 */ +};where is this struct used?
/dev/shm/next/compat/backport-3.10.c: In function pci_vfs_assigned:/dev/shm/next/compat/backport-3.10.c:156: error: dereferencing pointer to incomplete type pci_read_config_word(dev, dev->sriov->pos + PCI_SRIOV_VF_DID, &dev_id);
Quoted 3 lines
backport/backport-include/linux/pci.h bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); · line 203
Quoted 2 lines
backport/backport-include/linux/pci.h +1
-0+extern int pci_vfs_assigned (struct pci_dev *dev);The extern is not needed.
Yes, my bad. Going to fix that.
Quoted 5 lines
If
CONFIG_PCI_IOVis not set backports will not include the implementation of this function, you should add something like this in the header:
Quoted 8 lines
#ifdef
CONFIG_PCI_IOV
intpci_vfs_assigned(struct pci_dev *dev); #else
static inline intpci_vfs_assigned(struct pci_dev *dev){ return 0; }#endif
Agreed.
Stefan
Re: [PATCH RFC v2 05/11] backports: igb fixes for linux-3.6
In reply to Hauke MehrtensQuoted 78 lines · Hauke Mehrtens
Quoted 77 lines · Stefan Assmann
- backport
ethtool_cmd
- backportethtool_ops
- backportmmd_eee_adv_to_ethtool_adv_t
- addpatches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch
- addpatches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch
- addpatches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/mdio.h | 35 ++++++++++++++++ .../network/82-ethernet/0003-igb_ptp.patch | 17 ++++++++ .../network/82-ethernet/0004-igb_err_handler.patch | 16 +++++++ .../network/82-ethernet/0005-igb_mdi.patch | 49 ++++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 backport/backport-include/linux/mdio.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0004-igb_err_handler.patch create mode 100644 patches/collateral-evolutions/network/82-ethernet/0005-igb_mdi.patchbackport/backport-include/linux/mdio.h new file +35
-0@@ -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 */ patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch new file +11
-0@@ -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);
Quoted 8 lines
patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch line 14
Quoted 3 lines
patches/collateral-evolutions/network/82-ethernet/0003-igb_ptp.patch new file +3
-0++#else ++ adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps); ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */This could be replaced with in a header file:
#ifLINUX_VERSION_CODE<KERNEL_VERSION(3,7,0)
#defineptp_clock_register(info,parent)ptp_clock_register(info)#endif
Yes that's better, going to be included in next version.
Stefan
Re: [PATCH RFC v2 06/11] backports: igb fixes for linux-3.5
In reply to Hauke MehrtensQuoted 51 lines · Hauke Mehrtens
Quoted 50 lines · Stefan Assmann
- add EEE defines
- add structethtool_eee
- backport__skb_alloc_pageand__skb_alloc_pages
- addpatches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/ethtool.h | 31 +++++++++++++++ backport/backport-include/linux/gfp.h | 10 +++++ backport/backport-include/linux/mdio.h | 23 ++++++++++- backport/backport-include/linux/skbuff.h | 46 ++++++++++++++++++++++ .../network/82-ethernet/0006-igb_eee.patch | 15 +++++++ 5 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 backport/backport-include/linux/gfp.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patchbackport/backport-include/linux/ethtool.h +26
-0@@ -42,4 +42,35 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) }#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) && 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;
Quoted 8 lines
backport/backport-include/linux/ethtool.h static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) · line 74
Quoted 4 lines
backport/backport-include/linux/ethtool.h +4
-0+__u32 tx_lpi_timer; + __u32 reserved[2]; +}; +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ The
get_eeeandset_eeecallbacks in structethtool_opsare not available on this kernel, you could also add a #ifdef <kernel version> aroundigb_get_eee()andigb_set_eee()and remove the struct here.
True, but that would result in more ifdefs in igb and I'd like to keep the number at a minimum. Results in less maintenance work if upstream changes.
Stefan
Re: [PATCH RFC v2 07/11] backports: igb fixes for linux-3.4
In reply to Hauke MehrtensQuoted 145 lines · Hauke Mehrtens
Quoted 132 lines · Stefan Assmann
- add struct
ethtool_ts_info
- add structethtool_modinfo
- add structtimestamp_event_queue
- add structptp_clock
- addptp_clock_index()
- addpatches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/ethtool.h | 48 ++++++++++++++++++++++ backport/backport-include/linux/ptp_clock_kernel.h | 35 ++++++++++++++++ backport/compat/compat-3.5.c | 11 +++++ .../network/82-ethernet/0007-igb_ethtool_ops.patch | 24 +++++++++++ 4 files changed, 118 insertions(+) create mode 100644 backport/backport-include/linux/ptp_clock_kernel.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patchbackport/backport-include/linux/ethtool.h +48
-0@@ -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 ,0 ,0 ) &&LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 )/** * struct ethtool_eee - Energy Efficient Ethernet information backport/backport-include/linux/ptp_clock_kernel.h new file +35
-0@@ -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 ,0 ,0 ) &&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,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */ + +#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */ backport/compat/compat-3.5.c +3
-0@@ -12,6 +12,9 @@#include <linux/highuid.h> #include <linux/ktime.h> #include <linux/hrtimer.h> +#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,0 ,0 ) +#include <linux/ptp_clock_kernel.h> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ #if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 ))#include <linux/device.h> backport/compat/compat-3.5.c int overflowgid = DEFAULT_OVERFLOWGID; · line 76
Quoted 10 lines
backport/compat/compat-3.5.c +7
-0@@ -64,3 +67,11 @@ int overflowgid = DEFAULT_OVERFLOWGID;EXPORT_SYMBOL_GPL (overflowuid);EXPORT_SYMBOL_GPL (overflowgid);#endif + +#ifdef CONFIG_PTP_1588_CLOCK +int ptp_clock_index (struct ptp_clock *ptp) +{ +return ptp->index; +} +EXPORT_SYMBOL (ptp_clock_index);
ptp_clock_index()is only used inigb_get_ts_info()which which is never
Quoted 8 lines
called in kernel < 3.5 because this operation does not exist in
ethtool_opsthere.
Backporting this is not so easy as it looks here, because you added structptp_clockhere and there is also a version in the kernel, if they differ it could be that this index does not point to the same offset the kernel used as index variable. I would also ifdef theigb_get_ts_info()itself and remove the stuff related toptp_clock_index(), you are seeing a unused function warning as well.
So how about we take the original struct ptp_clock? There's only been
one single change introduced in 3.7 to the struct. No harm should come
from that code then.
As stated earlier I'm trying to keep the changes to igb itself as small
as possible and the unused function warnings are also a good indicator
for what is actually missing in the driver. There's already a bunch of
them if you compile against 3.0:/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c:7643: warning: igb_ndo_set_vf_spoofchk defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c:7359: warning: igb_pci_sriov_configure defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2354: warning: igb_get_ts_info defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2448: warning: igb_get_rxnfc defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2573: warning: igb_set_rxnfc defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2660: warning: igb_set_eee defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2718: warning: igb_get_module_info defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2760: warning: igb_get_module_eeprom defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2810: warning: igb_get_rxfh_indir_size defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2815: warning: igb_get_rxfh_indir defined but not used /dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2861: warning: igb_set_rxfh_indir defined but not used The bottom line is, I'd like to keep them if you're not strictly opposed
to it.
Thanks for the thorough review, I appreciate that!
Stefan
Re: [PATCH RFC v2 06/11] backports: igb fixes for linux-3.5
In reply to Stefan AssmannQuoted 61 lines · Stefan Assmann
Quoted 51 lines · Hauke Mehrtens
Quoted 50 lines · Stefan Assmann
- add EEE defines
- add structethtool_eee
- backport__skb_alloc_pageand__skb_alloc_pages
- addpatches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/ethtool.h | 31 +++++++++++++++ backport/backport-include/linux/gfp.h | 10 +++++ backport/backport-include/linux/mdio.h | 23 ++++++++++- backport/backport-include/linux/skbuff.h | 46 ++++++++++++++++++++++ .../network/82-ethernet/0006-igb_eee.patch | 15 +++++++ 5 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 backport/backport-include/linux/gfp.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0006-igb_eee.patchbackport/backport-include/linux/ethtool.h +26
-0@@ -42,4 +42,35 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) }#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) && 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;Quoted 8 lines
backport/backport-include/linux/ethtool.h static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) · line 74
Quoted 4 lines
backport/backport-include/linux/ethtool.h +4
-0+__u32 tx_lpi_timer; + __u32 reserved[2]; +}; +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ The
get_eeeandset_eeecallbacks in structethtool_opsare not available on this kernel, you could also add a #ifdef <kernel version> aroundigb_get_eee()andigb_set_eee()and remove the struct here.
Quoted 3 lines
True, but that would result in more ifdefs in igb and I'd like to keep the number at a minimum. Results in less maintenance work if upstream changes.
Yes, but on the other side I am getting some build warnings, because these function are static and not used. I do not think this will break often because the order of function isn't changed often and if that is the case it is easy to fix.
Hauke
CC [M]/home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_main.o /home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_main.c:7359:12:
warning: ‘igb_pci_sriov_configure’ defined but not used [-Wunused-function]
CC [M]/home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_ethtool.o /home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_ethtool.c:2354:12:
warning: ‘igb_get_ts_info’ defined but not used [-Wunused-function] /home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_ethtool.c:2660:12:
warning: ‘igb_set_eee’ defined but not used [-Wunused-function] /home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_ethtool.c:2718:12:
warning: ‘igb_get_module_info’ defined but not used [-Wunused-function] /home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_ethtool.c:2760:12:
warning: ‘igb_get_module_eeprom’ defined but not used [-Wunused-function] /home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_ethtool.c:2810:12:
warning: ‘igb_get_rxfh_indir_size’ defined but not used [-Wunused-function] /home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_ethtool.c:2815:12:
warning: ‘igb_get_rxfh_indir’ defined but not used [-Wunused-function] /home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/igb_ethtool.c:2861:12:
warning: ‘igb_set_rxfh_indir’ defined but not used [-Wunused-function]
CC [M]/home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/e1000_82575.o
CC [M]/home/hauke/compat-wireless/backports-20131206/drivers/net/ethernet/intel/igb/e1000_mac.o
Re: [PATCH RFC v2 07/11] backports: igb fixes for linux-3.4
In reply to Stefan AssmannQuoted 155 lines · Stefan Assmann
Quoted 145 lines · Hauke Mehrtens
Quoted 132 lines · Stefan Assmann
- add struct
ethtool_ts_info
- add structethtool_modinfo
- add structtimestamp_event_queue
- add structptp_clock
- addptp_clock_index()
- addpatches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/ethtool.h | 48 ++++++++++++++++++++++ backport/backport-include/linux/ptp_clock_kernel.h | 35 ++++++++++++++++ backport/compat/compat-3.5.c | 11 +++++ .../network/82-ethernet/0007-igb_ethtool_ops.patch | 24 +++++++++++ 4 files changed, 118 insertions(+) create mode 100644 backport/backport-include/linux/ptp_clock_kernel.h create mode 100644 patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patchbackport/backport-include/linux/ethtool.h +48
-0@@ -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 ,0 ,0 ) &&LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 )/** * struct ethtool_eee - Energy Efficient Ethernet information backport/backport-include/linux/ptp_clock_kernel.h new file +35
-0@@ -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 ,0 ,0 ) &&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,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */ + +#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */ backport/compat/compat-3.5.c +3
-0@@ -12,6 +12,9 @@#include <linux/highuid.h> #include <linux/ktime.h> #include <linux/hrtimer.h> +#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,0 ,0 ) +#include <linux/ptp_clock_kernel.h> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ #if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 ))#include <linux/device.h> backport/compat/compat-3.5.c int overflowgid = DEFAULT_OVERFLOWGID; · line 76
Quoted 10 lines
backport/compat/compat-3.5.c +7
-0@@ -64,3 +67,11 @@ int overflowgid = DEFAULT_OVERFLOWGID;EXPORT_SYMBOL_GPL (overflowuid);EXPORT_SYMBOL_GPL (overflowgid);#endif + +#ifdef CONFIG_PTP_1588_CLOCK +int ptp_clock_index (struct ptp_clock *ptp) +{ +return ptp->index; +} +EXPORT_SYMBOL (ptp_clock_index);
ptp_clock_index()is only used inigb_get_ts_info()which which is neverQuoted 8 lines
called in kernel < 3.5 because this operation does not exist in
ethtool_opsthere.
Backporting this is not so easy as it looks here, because you added structptp_clockhere and there is also a version in the kernel, if they differ it could be that this index does not point to the same offset the kernel used as index variable. I would also ifdef theigb_get_ts_info()itself and remove the stuff related toptp_clock_index(), you are seeing a unused function warning as well.
Quoted 3 lines
So how about we take the original struct
ptp_clock? There's only been one single change introduced in 3.7 to the struct. No harm should come from that code then.
Yes adding that struct should work.
Quoted 9 lines
As stated earlier I'm trying to keep the changes to igb itself as small
as possible and the unused function warnings are also a good indicator
for what is actually missing in the driver. There's already a bunch of
them if you compile against 3.0:/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c:7643: warning:igb_ndo_set_vf_spoofchkdefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c:7359: warning:igb_pci_sriov_configuredefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2354: warning:igb_get_ts_infodefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2448: warning:igb_get_rxnfcdefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2573: warning:igb_set_rxnfcdefined but not used
Quoted 8 lines
/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2660: warning:igb_set_eeedefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2718: warning:igb_get_module_infodefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2760: warning:igb_get_module_eepromdefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2810: warning:igb_get_rxfh_indir_sizedefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2815: warning:igb_get_rxfh_indirdefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2861: warning:igb_set_rxfh_indirdefined but not used The bottom line is, I'd like to keep them if you're not strictly opposed
to it.
These warnings do no harm, but it could be that we will miss some serious warnings. Could you eliminate these warnings please.
By the way, with which kernel versions have you done runtime tests?
Hauke
Re: [PATCH RFC v2 07/11] backports: igb fixes for linux-3.4
Quoted 180 lines · Hauke Mehrtens
Quoted 155 lines · Stefan Assmann
Quoted 145 lines · Hauke Mehrtens
Quoted 132 lines · Stefan Assmann
- add struct
ethtool_ts_info
- add structethtool_modinfo
- add structtimestamp_event_queue
- add structptp_clock
- addptp_clock_index()
- addpatches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patchSigned-off-by Stefan Assmann <[email protected]>--- backport/backport-include/linux/ethtool.h | 48 ++++++++++++++++++++++ backport/backport-include/linux/ptp_clock_kernel.h | 35 ++++++++++++++++ backport/compat/compat-3.5.c | 11 +++++ .../network/82-ethernet/0007-igb_ethtool_ops.patch | 24 +++++++++++ 4 files changed, 118 insertions(+)create mode 100644
backport/backport-include/linux/ptp_clock_kernel.h
create mode 100644patches/collateral-evolutions/network/82-ethernet/0007-igb_ethtool_ops.patchbackport/backport-include/linux/ethtool.h +48
-0@@ -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 ,0 ,0 ) &&LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 )/** * struct ethtool_eee - Energy Efficient Ethernet information backport/backport-include/linux/ptp_clock_kernel.h new file +35
-0@@ -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 ,0 ,0 ) &&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,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */ + +#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */ backport/compat/compat-3.5.c +3
-0@@ -12,6 +12,9 @@#include <linux/highuid.h> #include <linux/ktime.h> #include <linux/hrtimer.h> +#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,0 ,0 ) +#include <linux/ptp_clock_kernel.h> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ #if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 ))#include <linux/device.h> backport/compat/compat-3.5.c int overflowgid = DEFAULT_OVERFLOWGID; · line 76
Quoted 10 lines
backport/compat/compat-3.5.c +7
-0@@ -64,3 +67,11 @@ int overflowgid = DEFAULT_OVERFLOWGID;EXPORT_SYMBOL_GPL (overflowuid);EXPORT_SYMBOL_GPL (overflowgid);#endif + +#ifdef CONFIG_PTP_1588_CLOCK +int ptp_clock_index (struct ptp_clock *ptp) +{ +return ptp->index; +} +EXPORT_SYMBOL (ptp_clock_index);
ptp_clock_index()is only used inigb_get_ts_info()which which is neverQuoted 8 lines
called in kernel < 3.5 because this operation does not exist in
ethtool_opsthere.
Backporting this is not so easy as it looks here, because you added structptp_clockhere and there is also a version in the kernel, if they differ it could be that this index does not point to the same offset the kernel used as index variable. I would also ifdef theigb_get_ts_info()itself and remove the stuff related toptp_clock_index(), you are seeing a unused function warning as well.Quoted 3 lines
So how about we take the original struct
ptp_clock? There's only been one single change introduced in 3.7 to the struct. No harm should come from that code then.Yes adding that struct should work.
Quoted 9 lines
As stated earlier I'm trying to keep the changes to igb itself as small
as possible and the unused function warnings are also a good indicator
for what is actually missing in the driver. There's already a bunch of
them if you compile against 3.0:/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c:7643: warning:igb_ndo_set_vf_spoofchkdefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_main.c:7359: warning:igb_pci_sriov_configuredefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2354: warning:igb_get_ts_infodefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2448: warning:igb_get_rxnfcdefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2573: warning:igb_set_rxnfcdefined but not usedQuoted 8 lines
/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2660: warning:igb_set_eeedefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2718: warning:igb_get_module_infodefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2760: warning:igb_get_module_eepromdefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2810: warning:igb_get_rxfh_indir_sizedefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2815: warning:igb_get_rxfh_indirdefined but not used/dev/shm/next/drivers/net/ethernet/intel/igb/igb_ethtool.c:2861: warning:igb_set_rxfh_indirdefined but not used The bottom line is, I'd like to keep them if you're not strictly opposed
to it.
Quoted 2 lines
These warnings do no harm, but it could be that we will miss some serious warnings. Could you eliminate these warnings please.
OK, I'll see to that beginning of next year.
Quoted 1 line
By the way, with which kernel versions have you done runtime tests?
I tested the oldest supported kernel, which is 3.0.
Stefan