From 8e146028ec1281bb5bad65e66aff2f8d520d981d Mon Sep 17 00:00:00 2001 From: Stefan Assmann Date: Wed, 29 Jan 2014 10:19:04 +0100 Subject: [PATCH] backports: igb fixes for linux-3.5 - add EEE defines - backport __skb_alloc_page and __skb_alloc_pages - add patches/collateral-evolutions/network/84-ethernet/0006-igb_eee.patch Signed-off-by: Stefan Assmann Signed-off-by: Hauke Mehrtens --- backport/backport-include/linux/mdio.h | 22 +++++++++ backport/backport-include/linux/skbuff.h | 46 +++++++++++++++++++ .../network/84-ethernet/0006-igb_eee.patch | 31 +++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 patches/collateral-evolutions/network/84-ethernet/0006-igb_eee.patch diff --git a/backport/backport-include/linux/mdio.h b/backport/backport-include/linux/mdio.h index 516208796ec3..5b1c0c34613a 100644 --- a/backport/backport-include/linux/mdio.h +++ b/backport/backport-include/linux/mdio.h @@ -2,6 +2,28 @@ #define __BACKPORT_LINUX_MDIO_H #include_next +#ifndef MDIO_EEE_100TX +/* 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 /* MDIO_EEE_100TX */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) /** * mmd_eee_adv_to_ethtool_adv_t diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h index 7d04b542bbc8..c1b27537604b 100644 --- a/backport/backport-include/linux/skbuff.h +++ b/backport/backport-include/linux/skbuff.h @@ -224,6 +224,52 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list, skb = skb->next) #endif /* < 2.6.28 */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,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) diff --git a/patches/collateral-evolutions/network/84-ethernet/0006-igb_eee.patch b/patches/collateral-evolutions/network/84-ethernet/0006-igb_eee.patch new file mode 100644 index 000000000000..334ca44dd69a --- /dev/null +++ b/patches/collateral-evolutions/network/84-ethernet/0006-igb_eee.patch @@ -0,0 +1,31 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index 9b15820..9767f11 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -2590,6 +2590,7 @@ static int igb_set_rxnfc(struct net_devi + return ret; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) + static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata) + { + struct igb_adapter *adapter = netdev_priv(netdev); +@@ -2718,6 +2719,7 @@ static int igb_set_eee(struct net_device + + return 0; + } ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ + + static int igb_get_module_info(struct net_device *netdev, + struct ethtool_modinfo *modinfo) +@@ -3006,8 +3008,10 @@ static const struct ethtool_ops igb_etht + .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, -- 2.30.2