From 98ee83982e19ad71b1b7bc98ab1a9111cb1a3215 Mon Sep 17 00:00:00 2001 From: Stefan Assmann Date: Wed, 29 Jan 2014 10:19:03 +0100 Subject: [PATCH] backports: igb fixes for linux-3.6 - backport mmd_eee_adv_to_ethtool_adv_t - add define to map ptp_clock_register() to old version - add patches/collateral-evolutions/network/84-ethernet/0004-igb_err_handler.patch - add patches/collateral-evolutions/network/84-ethernet/0005-igb_mdi.patch Signed-off-by: Stefan Assmann Signed-off-by: Hauke Mehrtens --- backport/backport-include/linux/mdio.h | 36 ++++++++++++++ .../backport-include/linux/ptp_clock_kernel.h | 14 ++++++ .../84-ethernet/0004-igb_err_handler.patch | 16 ++++++ .../network/84-ethernet/0005-igb_mdi.patch | 49 +++++++++++++++++++ 4 files changed, 115 insertions(+) create mode 100644 backport/backport-include/linux/mdio.h create mode 100644 backport/backport-include/linux/ptp_clock_kernel.h create mode 100644 patches/collateral-evolutions/network/84-ethernet/0004-igb_err_handler.patch create mode 100644 patches/collateral-evolutions/network/84-ethernet/0005-igb_mdi.patch diff --git a/backport/backport-include/linux/mdio.h b/backport/backport-include/linux/mdio.h new file mode 100644 index 000000000000..516208796ec3 --- /dev/null +++ b/backport/backport-include/linux/mdio.h @@ -0,0 +1,36 @@ +#ifndef __BACKPORT_LINUX_MDIO_H +#define __BACKPORT_LINUX_MDIO_H +#include_next + +#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. + */ +#define mmd_eee_adv_to_ethtool_adv_t LINUX_BACKPORT(mmd_eee_adv_to_ethtool_adv_t) +static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv) +{ + u32 adv = 0; + + if (eee_adv & MDIO_EEE_100TX) + adv |= ADVERTISED_100baseT_Full; + if (eee_adv & MDIO_EEE_1000T) + adv |= ADVERTISED_1000baseT_Full; + if (eee_adv & MDIO_EEE_10GT) + adv |= ADVERTISED_10000baseT_Full; + if (eee_adv & MDIO_EEE_1000KX) + adv |= ADVERTISED_1000baseKX_Full; + if (eee_adv & MDIO_EEE_10GKX4) + adv |= ADVERTISED_10000baseKX4_Full; + if (eee_adv & MDIO_EEE_10GKR) + adv |= ADVERTISED_10000baseKR_Full; + + return adv; +} +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + +#endif /* __BACKPORT_LINUX_MDIO_H */ diff --git a/backport/backport-include/linux/ptp_clock_kernel.h b/backport/backport-include/linux/ptp_clock_kernel.h new file mode 100644 index 000000000000..daf1182c0ce8 --- /dev/null +++ b/backport/backport-include/linux/ptp_clock_kernel.h @@ -0,0 +1,14 @@ +#ifndef __BACKPORT_PTP_CLOCK_KERNEL_H +#define __BACKPORT_PTP_CLOCK_KERNEL_H + +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) +#include_next + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) +#define ptp_clock_register(info,parent) ptp_clock_register(info) +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ + +#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */ diff --git a/patches/collateral-evolutions/network/84-ethernet/0004-igb_err_handler.patch b/patches/collateral-evolutions/network/84-ethernet/0004-igb_err_handler.patch new file mode 100644 index 000000000000..ada1372411d1 --- /dev/null +++ b/patches/collateral-evolutions/network/84-ethernet/0004-igb_err_handler.patch @@ -0,0 +1,16 @@ +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c +index 67441f2..4df7bce 100644 +--- a/drivers/net/ethernet/intel/igb/igb_main.c ++++ b/drivers/net/ethernet/intel/igb/igb_main.c +@@ -234,7 +234,11 @@ static pci_ers_result_t igb_io_error_det + static pci_ers_result_t igb_io_slot_reset(struct pci_dev *); + static void igb_io_resume(struct pci_dev *); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) + static const struct pci_error_handlers igb_err_handler = { ++#else ++static struct pci_error_handlers igb_err_handler = { ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */ + .error_detected = igb_io_error_detected, + .slot_reset = igb_io_slot_reset, + .resume = igb_io_resume, diff --git a/patches/collateral-evolutions/network/84-ethernet/0005-igb_mdi.patch b/patches/collateral-evolutions/network/84-ethernet/0005-igb_mdi.patch new file mode 100644 index 000000000000..c062d0183854 --- /dev/null +++ b/patches/collateral-evolutions/network/84-ethernet/0005-igb_mdi.patch @@ -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_d + 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_d + 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_d + 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_d + } + } + ++#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_d + 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)) { -- 2.30.2