From: Vladimir Sokolovsky Date: Thu, 23 Jan 2014 16:09:26 +0000 (+0200) Subject: Refreshed backport patches X-Git-Tag: compat-rdma-2014-01-30~1 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=5a78c9bde37b888ce47287f66461a83cf88ed99c;p=~emulex%2Fcompat-rdma_3.12.git Refreshed backport patches Fixed patches format to support git-am Signed-off-by: Vladimir Sokolovsky --- diff --git a/patches/0006-cxgb3-cxgb4-Fix-pr_fmt-warnings.patch b/patches/0006-cxgb3-cxgb4-Fix-pr_fmt-warnings.patch index f4a6145..d936cee 100644 --- a/patches/0006-cxgb3-cxgb4-Fix-pr_fmt-warnings.patch +++ b/patches/0006-cxgb3-cxgb4-Fix-pr_fmt-warnings.patch @@ -1,6 +1,4 @@ -From 6e82a8471598de501464ffa6ef2d0847d438c95c Mon Sep 17 00:00:00 2001 From: Kumar Sanghvi -Date: Mon, 16 Dec 2013 13:06:47 +0530 Subject: [PATCH] cxgb3/cxgb4: Fix pr_fmt warnings Signed-off-by: Kumar Sanghvi @@ -11,7 +9,7 @@ Signed-off-by: Kumar Sanghvi 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c -index b650951..a69ebcc 100644 +index xxxxxxx..xxxxxxx xxxxxx --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -30,6 +30,7 @@ @@ -23,7 +21,7 @@ index b650951..a69ebcc 100644 #include diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c -index 76ae099..a58dd28 100644 +index xxxxxxx..xxxxxxx xxxxxx --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c @@ -30,6 +30,7 @@ @@ -35,7 +33,7 @@ index 76ae099..a58dd28 100644 #include diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -index a9bce6b..4c3c875 100644 +index xxxxxxx..xxxxxxx xxxxxx --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -32,6 +32,7 @@ @@ -46,6 +44,3 @@ index a9bce6b..4c3c875 100644 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include --- -1.7.1 - diff --git a/patches/0007-cxgb3-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch b/patches/0007-cxgb3-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch new file mode 100644 index 0000000..6aadf9a --- /dev/null +++ b/patches/0007-cxgb3-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch @@ -0,0 +1,686 @@ +From: Kumar Sanghvi +Subject: [PATCH] cxgb3: Backports for RHEL6.4, RHEL6.5 and SLES11sp3 + +Signed-off-by: Kumar Sanghvi +--- + drivers/net/ethernet/chelsio/cxgb3/adapter.h | 19 +++ + drivers/net/ethernet/chelsio/cxgb3/common.h | 3 + + drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 118 +++++++++++++++++++- + drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c | 107 ++++++++++++++++++- + drivers/net/ethernet/chelsio/cxgb3/l2t.c | 9 ++ + drivers/net/ethernet/chelsio/cxgb3/l2t.h | 5 + + drivers/net/ethernet/chelsio/cxgb3/sge.c | 46 ++++++++ + drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 4 + + drivers/net/ethernet/chelsio/cxgb3/xgmac.c | 17 +++- + 9 files changed, 325 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb3/adapter.h b/drivers/net/ethernet/chelsio/cxgb3/adapter.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/adapter.h ++++ b/drivers/net/ethernet/chelsio/cxgb3/adapter.h +@@ -45,10 +45,20 @@ + #include "t3cdev.h" + #include + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) ++struct vlan_group; ++#endif + struct adapter; + struct sge_qset; + struct port_info; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++enum { /* rx_offload flags */ ++ T3_RX_CSUM = 1 << 0, ++ T3_LRO = 1 << 1, ++}; ++#endif ++ + enum mac_idx_types { + LAN_MAC_IDX = 0, + SAN_MAC_IDX, +@@ -65,8 +75,14 @@ struct iscsi_config { + + struct port_info { + struct adapter *adapter; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) ++ struct vlan_group *vlan_grp; ++#endif + struct sge_qset *qs; + u8 port_id; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++ u8 rx_offload; ++#endif + u8 nqsets; + u8 first_qset; + struct cphy phy; +@@ -204,6 +220,9 @@ struct sge_qset { /* an SGE queue set */ + struct sge_fl fl[SGE_RXQ_PER_SET]; + struct sge_txq txq[SGE_TXQ_PER_SET]; + int nomem; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++ int lro_enabled; ++#endif + void *lro_va; + struct net_device *netdev; + struct netdev_queue *tx_q; /* associated netdev TX queue */ +diff --git a/drivers/net/ethernet/chelsio/cxgb3/common.h b/drivers/net/ethernet/chelsio/cxgb3/common.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/common.h ++++ b/drivers/net/ethernet/chelsio/cxgb3/common.h +@@ -316,6 +316,9 @@ struct tp_params { + + struct qset_params { /* SGE queue set parameters */ + unsigned int polling; /* polling/interrupt service for rspq */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++ unsigned int lro; /* large receive offload */ ++#endif + unsigned int coalesce_usecs; /* irq coalescing timer */ + unsigned int rspq_size; /* # of entries in response queue */ + unsigned int fl_size; /* # of entries in regular free list */ +diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +@@ -648,6 +648,28 @@ static void enable_all_napi(struct adapter *adap) + napi_enable(&adap->sge.qs[i].napi); + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++/** ++ * set_qset_lro - Turn a queue set's LRO capability on and off ++ * @dev: the device the qset is attached to ++ * @qset_idx: the queue set index ++ * @val: the LRO switch ++ * ++ * Sets LRO on or off for a particular queue set. ++ * the device's features flag is updated to reflect the LRO ++ * capability when all queues belonging to the device are ++ * in the same state. ++ */ ++static void set_qset_lro(struct net_device *dev, int qset_idx, int val) ++{ ++ struct port_info *pi = netdev_priv(dev); ++ struct adapter *adapter = pi->adapter; ++ ++ adapter->params.sge.qset[qset_idx].lro = !!val; ++ adapter->sge.qs[qset_idx].lro_enabled = !!val; ++} ++#endif ++ + /** + * setup_sge_qsets - configure SGE Tx/Rx/response queues + * @adap: the adapter +@@ -1175,6 +1197,7 @@ static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) + { + struct port_info *pi = netdev_priv(dev); +@@ -1196,6 +1219,27 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) + } + t3_synchronize_rx(adapter, pi); + } ++#else ++static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp) ++{ ++ struct port_info *pi = netdev_priv(dev); ++ struct adapter *adapter = pi->adapter; ++ ++ pi->vlan_grp = grp; ++ if (adapter->params.rev > 0) ++ t3_set_vlan_accel(adapter, 1 << pi->port_id, grp != NULL); ++ else { ++ /* single control for all ports */ ++ unsigned int i, have_vlans = 0; ++ for_each_port(adapter, i) ++ have_vlans |= adap2pinfo(adapter, i)->vlan_grp != NULL; ++ ++ t3_set_vlan_accel(adapter, 1, have_vlans); ++ } ++ t3_synchronize_rx(adapter, pi); ++} ++#endif ++ + + /** + * cxgb_up - enable the adapter +@@ -1209,7 +1253,10 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) + */ + static int cxgb_up(struct adapter *adap) + { +- int i, err; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) ++ int i; ++#endif ++ int err; + + if (!(adap->flags & FULL_INIT_DONE)) { + err = t3_check_fw_version(adap); +@@ -1246,8 +1293,10 @@ static int cxgb_up(struct adapter *adap) + if (err) + goto out; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + for_each_port(adap, i) + cxgb_vlan_mode(adap->port[i], adap->port[i]->features); ++#endif + + setup_rss(adap); + if (!(adap->flags & NAPI_INIT)) +@@ -1776,6 +1825,7 @@ static int restart_autoneg(struct net_device *dev) + return 0; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + static int set_phys_id(struct net_device *dev, + enum ethtool_phys_id_state state) + { +@@ -1798,6 +1848,28 @@ static int set_phys_id(struct net_device *dev, + + return 0; + } ++#else ++static int cxgb3_phys_id(struct net_device *dev, u32 data) ++{ ++ struct port_info *pi = netdev_priv(dev); ++ struct adapter *adapter = pi->adapter; ++ int i; ++ ++ if (data == 0) ++ data = 2; ++ ++ for (i = 0; i < data * 2; i++) { ++ t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, ++ (i & 1) ? F_GPIO0_OUT_VAL : 0); ++ if (msleep_interruptible(500)) ++ break; ++ } ++ ++ t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, ++ F_GPIO0_OUT_VAL); ++ return 0; ++} ++#endif + + static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd) + { +@@ -2111,7 +2183,11 @@ static const struct ethtool_ops cxgb_ethtool_ops = { + .set_pauseparam = set_pauseparam, + .get_link = ethtool_op_get_link, + .get_strings = get_strings, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + .set_phys_id = set_phys_id, ++#else ++ .phys_id = cxgb3_phys_id, ++#endif + .nway_reset = restart_autoneg, + .get_sset_count = get_sset_count, + .get_ethtool_stats = get_stats, +@@ -2226,6 +2302,7 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + if (t.lro >= 0) { + if (t.lro) + dev->wanted_features |= NETIF_F_GRO; +@@ -2233,6 +2310,10 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) + dev->wanted_features &= ~NETIF_F_GRO; + netdev_update_features(dev); + } ++#else ++ if (t.lro >= 0) ++ set_qset_lro(dev, t.qset_idx, t.lro); ++#endif + + break; + } +@@ -2558,6 +2639,7 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) + return 0; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + static netdev_features_t cxgb_fix_features(struct net_device *dev, + netdev_features_t features) + { +@@ -2582,6 +2664,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) + + return 0; + } ++#endif + + #ifdef CONFIG_NET_POLL_CONTROLLER + static void cxgb_netpoll(struct net_device *dev) +@@ -3043,11 +3126,19 @@ static void t3_io_resume(struct pci_dev *pdev) + rtnl_unlock(); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) + static const struct pci_error_handlers t3_err_handler = { + .error_detected = t3_io_error_detected, + .slot_reset = t3_io_slot_reset, + .resume = t3_io_resume, + }; ++#else ++static struct pci_error_handlers t3_err_handler = { ++ .error_detected = t3_io_error_detected, ++ .slot_reset = t3_io_slot_reset, ++ .resume = t3_io_resume, ++}; ++#endif + + /* + * Set the number of qsets based on the number of CPUs and the number of ports, +@@ -3163,8 +3254,12 @@ static const struct net_device_ops cxgb_netdev_ops = { + .ndo_do_ioctl = cxgb_ioctl, + .ndo_change_mtu = cxgb_change_mtu, + .ndo_set_mac_address = cxgb_set_mac_addr, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + .ndo_fix_features = cxgb_fix_features, + .ndo_set_features = cxgb_set_features, ++#else ++ .ndo_vlan_rx_register = vlan_rx_register, ++#endif + #ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = cxgb_netpoll, + #endif +@@ -3291,14 +3386,35 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + netdev->irq = pdev->irq; + netdev->mem_start = mmio_start; + netdev->mem_end = mmio_start + mmio_len - 1; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) ++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0) ++ netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | ++ NETIF_F_TSO | NETIF_F_RXCSUM; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) ++ netdev->features |= netdev->hw_features | ++ NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; ++#else ++ netdev->features |= netdev->hw_features | ++ NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */ ++#else + netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; + netdev->features |= netdev->hw_features | + NETIF_F_HW_VLAN_CTAG_TX; ++#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3,0, 0) */ ++#else ++ netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; ++ netdev->features |= NETIF_F_GRO; ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */ + netdev->vlan_features |= netdev->features & VLAN_FEAT; + if (pci_using_dac) + netdev->features |= NETIF_F_HIGHDMA; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++ netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; ++#endif ++ + netdev->netdev_ops = &cxgb_netdev_ops; + SET_ETHTOOL_OPS(netdev, &cxgb_ethtool_ops); + } +diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +@@ -65,8 +65,14 @@ static const unsigned int MAX_ATIDS = 64 * 1024; + static const unsigned int ATID_BASE = 0x10000; + + static void cxgb_neigh_update(struct neighbour *neigh); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, +- struct neighbour *neigh, const void *daddr); ++ struct neighbour *neigh, ++ const void *daddr); ++#else ++static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new); ++#endif + + static inline int offload_activated(struct t3cdev *tdev) + { +@@ -181,18 +187,36 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter, + int i; + + for_each_port(adapter, i) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) ++ struct vlan_group *grp; ++#endif + struct net_device *dev = adapter->port[i]; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) ++ const struct port_info *p = netdev_priv(dev); ++#endif + + if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) { + rcu_read_lock(); + if (vlan && vlan != VLAN_VID_MASK) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + dev = __vlan_find_dev_deep(dev, htons(ETH_P_8021Q), vlan); ++#else ++ grp = p->vlan_grp; ++ dev = NULL; ++ if (grp) ++ dev = vlan_group_get_device(grp, vlan); ++#endif + } else if (netif_is_bond_slave(dev)) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + struct net_device *upper_dev; + + while ((upper_dev = + netdev_master_upper_dev_get_rcu(dev))) + dev = upper_dev; ++#else ++ while (dev->master) ++ dev = dev->master; ++#endif + } + rcu_read_unlock(); + return dev; +@@ -970,9 +994,14 @@ static int nb_callback(struct notifier_block *self, unsigned long event, + } + case (NETEVENT_REDIRECT):{ + struct netevent_redirect *nr = ctx; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + cxgb_redirect(nr->old, nr->new, nr->neigh, + nr->daddr); + cxgb_neigh_update(nr->neigh); ++#else ++ cxgb_redirect(nr->old, nr->new); ++ cxgb_neigh_update(dst_get_neighbour(nr->new)); ++#endif + break; + } + default: +@@ -1108,6 +1137,7 @@ static void set_l2t_ix(struct t3cdev *tdev, u32 tid, struct l2t_entry *e) + tdev->send(tdev, skb); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, + struct neighbour *neigh, + const void *daddr) +@@ -1128,7 +1158,11 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, + BUG_ON(!tdev); + + /* Add new L2T entry */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + e = t3_l2t_get(tdev, new, dev, daddr); ++#else ++ e = t3_l2t_get(tdev, new, dev); ++#endif + if (!e) { + pr_err("%s: couldn't allocate new l2t entry!\n", __func__); + return; +@@ -1151,6 +1185,77 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, + } + l2t_release(tdev, e); + } ++#else ++static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) ++{ ++ struct net_device *olddev, *newdev; ++ struct neighbour *n; ++ struct tid_info *ti; ++ struct t3cdev *tdev; ++ u32 tid; ++ int update_tcb; ++ struct l2t_entry *e; ++ struct t3c_tid_entry *te; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) ++ n = dst_get_neighbour_noref(old); ++#else ++ n = dst_get_neighbour(old); ++#endif ++ if (!n) ++ return; ++ olddev = n->dev; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) ++ n = dst_get_neighbour_noref(new); ++#else ++ n = dst_get_neighbour(new); ++#endif ++ if (!n) ++ return; ++ newdev = n->dev; ++ ++ if (!is_offloading(olddev)) ++ return; ++ if (!is_offloading(newdev)) { ++ printk(KERN_WARNING "%s: Redirect to non-offload " ++ "device ignored.\n", __func__); ++ return; ++ } ++ tdev = dev2t3cdev(olddev); ++ BUG_ON(!tdev); ++ if (tdev != dev2t3cdev(newdev)) { ++ printk(KERN_WARNING "%s: Redirect to different " ++ "offload device ignored.\n", __func__); ++ return; ++ } ++ ++ /* Add new L2T entry */ ++ e = t3_l2t_get(tdev, new, newdev); ++ if (!e) { ++ printk(KERN_ERR "%s: couldn't allocate new l2t entry!\n", ++ __func__); ++ return; ++ } ++ ++ /* Walk tid table and notify clients of dst change. */ ++ ti = &(T3C_DATA(tdev))->tid_maps; ++ for (tid = 0; tid < ti->ntids; tid++) { ++ te = lookup_tid(ti, tid); ++ BUG_ON(!te); ++ if (te && te->ctx && te->client && te->client->redirect) { ++ update_tcb = te->client->redirect(te->ctx, old, new, e); ++ if (update_tcb) { ++ rcu_read_lock(); ++ l2t_hold(L2DATA(tdev), e); ++ rcu_read_unlock(); ++ set_l2t_ix(tdev, tid, e); ++ } ++ } ++ } ++ l2t_release(tdev, e); ++} ++#endif + + /* + * Allocate a chunk of memory using kmalloc or, if that fails, vmalloc. +diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.c b/drivers/net/ethernet/chelsio/cxgb3/l2t.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.c +@@ -298,8 +298,13 @@ static inline void reuse_entry(struct l2t_entry *e, struct neighbour *neigh) + spin_unlock(&e->lock); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, + struct net_device *dev, const void *daddr) ++#else ++struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, ++ struct net_device *dev) ++#endif + { + struct l2t_entry *e = NULL; + struct neighbour *neigh; +@@ -311,7 +316,11 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, + int smt_idx; + + rcu_read_lock(); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + neigh = dst_neigh_lookup(dst, daddr); ++#else ++ neigh = dst_get_neighbour(dst); ++#endif + if (!neigh) + goto done_rcu; + +diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.h b/drivers/net/ethernet/chelsio/cxgb3/l2t.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.h ++++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.h +@@ -109,8 +109,13 @@ static inline void set_arp_failure_handler(struct sk_buff *skb, + + void t3_l2e_free(struct l2t_data *d, struct l2t_entry *e); + void t3_l2t_update(struct t3cdev *dev, struct neighbour *neigh); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, + struct net_device *dev, const void *daddr); ++#else ++struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, ++ struct net_device *dev); ++#endif + int t3_l2t_send_slow(struct t3cdev *dev, struct sk_buff *skb, + struct l2t_entry *e); + void t3_l2t_send_event(struct t3cdev *dev, struct l2t_entry *e); +diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c +@@ -2019,7 +2019,11 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq, + skb_pull(skb, sizeof(*p) + pad); + skb->protocol = eth_type_trans(skb, adap->port[p->iff]); + pi = netdev_priv(skb->dev); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + if ((skb->dev->features & NETIF_F_RXCSUM) && p->csum_valid && ++#else ++ if ((pi->rx_offload & T3_RX_CSUM) && p->csum_valid && ++#endif + p->csum == htons(0xffff) && !p->fragment) { + qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; + skb->ip_summed = CHECKSUM_UNNECESSARY; +@@ -2027,11 +2031,38 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq, + skb_checksum_none_assert(skb); + skb_record_rx_queue(skb, qs - &adap->sge.qs[pi->first_qset]); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + if (p->vlan_valid) { ++#else ++ if (unlikely(p->vlan_valid)) { ++ struct vlan_group *grp = pi->vlan_grp; ++#endif + qs->port_stats[SGE_PSTAT_VLANEX]++; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(p->vlan)); + } + if (rq->polling) { ++#else ++ if (likely(grp)) ++ if (lro) ++ vlan_gro_receive(&qs->napi, grp, ++ ntohs(p->vlan), skb); ++ else { ++ if (unlikely(pi->iscsic.flags)) { ++ unsigned short vtag = ntohs(p->vlan) & ++ VLAN_VID_MASK; ++ skb->dev = vlan_group_get_device(grp, ++ vtag); ++ cxgb3_process_iscsi_prov_pack(pi, skb); ++ } ++ __vlan_hwaccel_rx(skb, grp, ntohs(p->vlan), ++ rq->polling); ++ } ++ else ++ dev_kfree_skb_any(skb); ++ } else if (rq->polling) { ++#endif ++ + if (lro) + napi_gro_receive(&qs->napi, skb); + else { +@@ -2103,7 +2134,11 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, + offset = 2 + sizeof(struct cpl_rx_pkt); + cpl = qs->lro_va = sd->pg_chunk.va + 2; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + if ((qs->netdev->features & NETIF_F_RXCSUM) && ++#else ++ if ((pi->rx_offload & T3_RX_CSUM) && ++#endif + cpl->csum_valid && cpl->csum == htons(0xffff)) { + skb->ip_summed = CHECKSUM_UNNECESSARY; + qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; +@@ -2129,10 +2164,21 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, + + skb_record_rx_queue(skb, qs - &adap->sge.qs[pi->first_qset]); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + if (cpl->vlan_valid) { + qs->port_stats[SGE_PSTAT_VLANEX]++; + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cpl->vlan)); + } ++#else ++ if (unlikely(cpl->vlan_valid)) { ++ struct vlan_group *grp = pi->vlan_grp; ++ ++ if (likely(grp != NULL)) { ++ vlan_gro_frags(&qs->napi, grp, ntohs(cpl->vlan)); ++ return; ++ } ++ } ++#endif + napi_gro_frags(&qs->napi); + } + +diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c +@@ -3307,7 +3307,11 @@ static void config_pcie(struct adapter *adap) + G_NUMFSTTRNSEQRX(t3_read_reg(adap, A_PCIE_MODE)); + log2_width = fls(adap->params.pci.width) - 1; + acklat = ack_lat[log2_width][pldsize]; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (val & PCI_EXP_LNKCTL_ASPM_L0S) /* check LOsEnable */ ++#else ++ if (val & 1) ++#endif + acklat += fst_trn_tx * 4; + rpllmt = rpl_tmr[log2_width][pldsize] + fst_trn_rx * 4; + +diff --git a/drivers/net/ethernet/chelsio/cxgb3/xgmac.c b/drivers/net/ethernet/chelsio/cxgb3/xgmac.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/xgmac.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/xgmac.c +@@ -311,17 +311,32 @@ int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev) + if (dev->flags & IFF_ALLMULTI) + hash_lo = hash_hi = 0xffffffff; + else { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + struct netdev_hw_addr *ha; ++#else ++ struct dev_mc_list *dmi; ++#endif + int exact_addr_idx = mac->nucast; + + hash_lo = hash_hi = 0; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + netdev_for_each_mc_addr(ha, dev) ++#else ++ netdev_for_each_mc_addr(dmi, dev) ++#endif + if (exact_addr_idx < EXACT_ADDR_FILTERS) + set_addr_filter(mac, exact_addr_idx++, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + ha->addr); ++#else ++ dmi->dmi_addr); ++#endif + else { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + int hash = hash_hw_addr(ha->addr); +- ++#else ++ int hash = hash_hw_addr(dmi->dmi_addr); ++#endif + if (hash < 32) + hash_lo |= (1 << hash); + else diff --git a/patches/0007-cxgb3-RHEL64-RHEL65-SLES11SP3-backport.patch b/patches/0007-cxgb3-RHEL64-RHEL65-SLES11SP3-backport.patch deleted file mode 100644 index 196cc91..0000000 --- a/patches/0007-cxgb3-RHEL64-RHEL65-SLES11SP3-backport.patch +++ /dev/null @@ -1,670 +0,0 @@ -diff --git a/drivers/net/ethernet/chelsio/cxgb3/adapter.h b/drivers/net/ethernet/chelsio/cxgb3/adapter.h -index 8b395b5..27bd384 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/adapter.h -+++ b/drivers/net/ethernet/chelsio/cxgb3/adapter.h -@@ -45,10 +45,20 @@ - #include "t3cdev.h" - #include - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) -+struct vlan_group; -+#endif - struct adapter; - struct sge_qset; - struct port_info; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+enum { /* rx_offload flags */ -+ T3_RX_CSUM = 1 << 0, -+ T3_LRO = 1 << 1, -+}; -+#endif -+ - enum mac_idx_types { - LAN_MAC_IDX = 0, - SAN_MAC_IDX, -@@ -65,8 +75,14 @@ struct iscsi_config { - - struct port_info { - struct adapter *adapter; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) -+ struct vlan_group *vlan_grp; -+#endif - struct sge_qset *qs; - u8 port_id; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+ u8 rx_offload; -+#endif - u8 nqsets; - u8 first_qset; - struct cphy phy; -@@ -204,6 +220,9 @@ struct sge_qset { /* an SGE queue set */ - struct sge_fl fl[SGE_RXQ_PER_SET]; - struct sge_txq txq[SGE_TXQ_PER_SET]; - int nomem; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+ int lro_enabled; -+#endif - void *lro_va; - struct net_device *netdev; - struct netdev_queue *tx_q; /* associated netdev TX queue */ -diff --git a/drivers/net/ethernet/chelsio/cxgb3/common.h b/drivers/net/ethernet/chelsio/cxgb3/common.h -index 8c82248..97bd0a7 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/common.h -+++ b/drivers/net/ethernet/chelsio/cxgb3/common.h -@@ -316,6 +316,9 @@ struct tp_params { - - struct qset_params { /* SGE queue set parameters */ - unsigned int polling; /* polling/interrupt service for rspq */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+ unsigned int lro; /* large receive offload */ -+#endif - unsigned int coalesce_usecs; /* irq coalescing timer */ - unsigned int rspq_size; /* # of entries in response queue */ - unsigned int fl_size; /* # of entries in regular free list */ -diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c -index b650951..df32cc5 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c -+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c -@@ -647,6 +647,28 @@ static void enable_all_napi(struct adapter *adap) - napi_enable(&adap->sge.qs[i].napi); - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+/** -+ * set_qset_lro - Turn a queue set's LRO capability on and off -+ * @dev: the device the qset is attached to -+ * @qset_idx: the queue set index -+ * @val: the LRO switch -+ * -+ * Sets LRO on or off for a particular queue set. -+ * the device's features flag is updated to reflect the LRO -+ * capability when all queues belonging to the device are -+ * in the same state. -+ */ -+static void set_qset_lro(struct net_device *dev, int qset_idx, int val) -+{ -+ struct port_info *pi = netdev_priv(dev); -+ struct adapter *adapter = pi->adapter; -+ -+ adapter->params.sge.qset[qset_idx].lro = !!val; -+ adapter->sge.qs[qset_idx].lro_enabled = !!val; -+} -+#endif -+ - /** - * setup_sge_qsets - configure SGE Tx/Rx/response queues - * @adap: the adapter -@@ -1174,6 +1196,7 @@ static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) - } - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) - { - struct port_info *pi = netdev_priv(dev); -@@ -1195,6 +1218,27 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) - } - t3_synchronize_rx(adapter, pi); - } -+#else -+static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp) -+{ -+ struct port_info *pi = netdev_priv(dev); -+ struct adapter *adapter = pi->adapter; -+ -+ pi->vlan_grp = grp; -+ if (adapter->params.rev > 0) -+ t3_set_vlan_accel(adapter, 1 << pi->port_id, grp != NULL); -+ else { -+ /* single control for all ports */ -+ unsigned int i, have_vlans = 0; -+ for_each_port(adapter, i) -+ have_vlans |= adap2pinfo(adapter, i)->vlan_grp != NULL; -+ -+ t3_set_vlan_accel(adapter, 1, have_vlans); -+ } -+ t3_synchronize_rx(adapter, pi); -+} -+#endif -+ - - /** - * cxgb_up - enable the adapter -@@ -1208,7 +1252,10 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) - */ - static int cxgb_up(struct adapter *adap) - { -- int i, err; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) -+ int i; -+#endif -+ int err; - - if (!(adap->flags & FULL_INIT_DONE)) { - err = t3_check_fw_version(adap); -@@ -1245,8 +1292,10 @@ static int cxgb_up(struct adapter *adap) - if (err) - goto out; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - for_each_port(adap, i) - cxgb_vlan_mode(adap->port[i], adap->port[i]->features); -+#endif - - setup_rss(adap); - if (!(adap->flags & NAPI_INIT)) -@@ -1775,6 +1824,7 @@ static int restart_autoneg(struct net_device *dev) - return 0; - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - static int set_phys_id(struct net_device *dev, - enum ethtool_phys_id_state state) - { -@@ -1797,6 +1847,28 @@ static int set_phys_id(struct net_device *dev, - - return 0; - } -+#else -+static int cxgb3_phys_id(struct net_device *dev, u32 data) -+{ -+ struct port_info *pi = netdev_priv(dev); -+ struct adapter *adapter = pi->adapter; -+ int i; -+ -+ if (data == 0) -+ data = 2; -+ -+ for (i = 0; i < data * 2; i++) { -+ t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, -+ (i & 1) ? F_GPIO0_OUT_VAL : 0); -+ if (msleep_interruptible(500)) -+ break; -+ } -+ -+ t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, -+ F_GPIO0_OUT_VAL); -+ return 0; -+} -+#endif - - static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd) - { -@@ -2110,7 +2182,11 @@ static const struct ethtool_ops cxgb_ethtool_ops = { - .set_pauseparam = set_pauseparam, - .get_link = ethtool_op_get_link, - .get_strings = get_strings, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - .set_phys_id = set_phys_id, -+#else -+ .phys_id = cxgb3_phys_id, -+#endif - .nway_reset = restart_autoneg, - .get_sset_count = get_sset_count, - .get_ethtool_stats = get_stats, -@@ -2225,6 +2301,7 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) - } - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - if (t.lro >= 0) { - if (t.lro) - dev->wanted_features |= NETIF_F_GRO; -@@ -2232,6 +2309,10 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) - dev->wanted_features &= ~NETIF_F_GRO; - netdev_update_features(dev); - } -+#else -+ if (t.lro >= 0) -+ set_qset_lro(dev, t.qset_idx, t.lro); -+#endif - - break; - } -@@ -2557,6 +2638,7 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) - return 0; - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - static netdev_features_t cxgb_fix_features(struct net_device *dev, - netdev_features_t features) - { -@@ -2581,6 +2663,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) - - return 0; - } -+#endif - - #ifdef CONFIG_NET_POLL_CONTROLLER - static void cxgb_netpoll(struct net_device *dev) -@@ -3042,11 +3125,19 @@ static void t3_io_resume(struct pci_dev *pdev) - rtnl_unlock(); - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) - static const struct pci_error_handlers t3_err_handler = { - .error_detected = t3_io_error_detected, - .slot_reset = t3_io_slot_reset, - .resume = t3_io_resume, - }; -+#else -+static struct pci_error_handlers t3_err_handler = { -+ .error_detected = t3_io_error_detected, -+ .slot_reset = t3_io_slot_reset, -+ .resume = t3_io_resume, -+}; -+#endif - - /* - * Set the number of qsets based on the number of CPUs and the number of ports, -@@ -3162,8 +3253,12 @@ static const struct net_device_ops cxgb_netdev_ops = { - .ndo_do_ioctl = cxgb_ioctl, - .ndo_change_mtu = cxgb_change_mtu, - .ndo_set_mac_address = cxgb_set_mac_addr, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - .ndo_fix_features = cxgb_fix_features, - .ndo_set_features = cxgb_set_features, -+#else -+ .ndo_vlan_rx_register = vlan_rx_register, -+#endif - #ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = cxgb_netpoll, - #endif -@@ -3290,14 +3385,35 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - netdev->irq = pdev->irq; - netdev->mem_start = mmio_start; - netdev->mem_end = mmio_start + mmio_len - 1; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) -+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0) -+ netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | -+ NETIF_F_TSO | NETIF_F_RXCSUM; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) -+ netdev->features |= netdev->hw_features | -+ NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; -+#else -+ netdev->features |= netdev->hw_features | -+ NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; -+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */ -+#else - netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; - netdev->features |= netdev->hw_features | - NETIF_F_HW_VLAN_CTAG_TX; -+#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3,0, 0) */ -+#else -+ netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; -+ netdev->features |= NETIF_F_GRO; -+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */ - netdev->vlan_features |= netdev->features & VLAN_FEAT; - if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+ netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; -+#endif -+ - netdev->netdev_ops = &cxgb_netdev_ops; - SET_ETHTOOL_OPS(netdev, &cxgb_ethtool_ops); - } -diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c -index 76ae099..3033d05 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c -+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c -@@ -64,8 +64,14 @@ static const unsigned int MAX_ATIDS = 64 * 1024; - static const unsigned int ATID_BASE = 0x10000; - - static void cxgb_neigh_update(struct neighbour *neigh); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, -- struct neighbour *neigh, const void *daddr); -+ struct neighbour *neigh, -+ const void *daddr); -+#else -+static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new); -+#endif - - static inline int offload_activated(struct t3cdev *tdev) - { -@@ -180,18 +186,36 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter, - int i; - - for_each_port(adapter, i) { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) -+ struct vlan_group *grp; -+#endif - struct net_device *dev = adapter->port[i]; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) -+ const struct port_info *p = netdev_priv(dev); -+#endif - - if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) { - rcu_read_lock(); - if (vlan && vlan != VLAN_VID_MASK) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - dev = __vlan_find_dev_deep(dev, htons(ETH_P_8021Q), vlan); -+#else -+ grp = p->vlan_grp; -+ dev = NULL; -+ if (grp) -+ dev = vlan_group_get_device(grp, vlan); -+#endif - } else if (netif_is_bond_slave(dev)) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - struct net_device *upper_dev; - - while ((upper_dev = - netdev_master_upper_dev_get_rcu(dev))) - dev = upper_dev; -+#else -+ while (dev->master) -+ dev = dev->master; -+#endif - } - rcu_read_unlock(); - return dev; -@@ -969,9 +993,14 @@ static int nb_callback(struct notifier_block *self, unsigned long event, - } - case (NETEVENT_REDIRECT):{ - struct netevent_redirect *nr = ctx; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - cxgb_redirect(nr->old, nr->new, nr->neigh, - nr->daddr); - cxgb_neigh_update(nr->neigh); -+#else -+ cxgb_redirect(nr->old, nr->new); -+ cxgb_neigh_update(dst_get_neighbour(nr->new)); -+#endif - break; - } - default: -@@ -1107,6 +1136,7 @@ static void set_l2t_ix(struct t3cdev *tdev, u32 tid, struct l2t_entry *e) - tdev->send(tdev, skb); - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, - struct neighbour *neigh, - const void *daddr) -@@ -1127,7 +1157,11 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, - BUG_ON(!tdev); - - /* Add new L2T entry */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - e = t3_l2t_get(tdev, new, dev, daddr); -+#else -+ e = t3_l2t_get(tdev, new, dev); -+#endif - if (!e) { - pr_err("%s: couldn't allocate new l2t entry!\n", __func__); - return; -@@ -1150,6 +1184,77 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, - } - l2t_release(tdev, e); - } -+#else -+static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) -+{ -+ struct net_device *olddev, *newdev; -+ struct neighbour *n; -+ struct tid_info *ti; -+ struct t3cdev *tdev; -+ u32 tid; -+ int update_tcb; -+ struct l2t_entry *e; -+ struct t3c_tid_entry *te; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) -+ n = dst_get_neighbour_noref(old); -+#else -+ n = dst_get_neighbour(old); -+#endif -+ if (!n) -+ return; -+ olddev = n->dev; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) -+ n = dst_get_neighbour_noref(new); -+#else -+ n = dst_get_neighbour(new); -+#endif -+ if (!n) -+ return; -+ newdev = n->dev; -+ -+ if (!is_offloading(olddev)) -+ return; -+ if (!is_offloading(newdev)) { -+ printk(KERN_WARNING "%s: Redirect to non-offload " -+ "device ignored.\n", __func__); -+ return; -+ } -+ tdev = dev2t3cdev(olddev); -+ BUG_ON(!tdev); -+ if (tdev != dev2t3cdev(newdev)) { -+ printk(KERN_WARNING "%s: Redirect to different " -+ "offload device ignored.\n", __func__); -+ return; -+ } -+ -+ /* Add new L2T entry */ -+ e = t3_l2t_get(tdev, new, newdev); -+ if (!e) { -+ printk(KERN_ERR "%s: couldn't allocate new l2t entry!\n", -+ __func__); -+ return; -+ } -+ -+ /* Walk tid table and notify clients of dst change. */ -+ ti = &(T3C_DATA(tdev))->tid_maps; -+ for (tid = 0; tid < ti->ntids; tid++) { -+ te = lookup_tid(ti, tid); -+ BUG_ON(!te); -+ if (te && te->ctx && te->client && te->client->redirect) { -+ update_tcb = te->client->redirect(te->ctx, old, new, e); -+ if (update_tcb) { -+ rcu_read_lock(); -+ l2t_hold(L2DATA(tdev), e); -+ rcu_read_unlock(); -+ set_l2t_ix(tdev, tid, e); -+ } -+ } -+ } -+ l2t_release(tdev, e); -+} -+#endif - - /* - * Allocate a chunk of memory using kmalloc or, if that fails, vmalloc. -diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.c b/drivers/net/ethernet/chelsio/cxgb3/l2t.c -index 8d53438..ea9bd19 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/l2t.c -+++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.c -@@ -298,8 +298,13 @@ static inline void reuse_entry(struct l2t_entry *e, struct neighbour *neigh) - spin_unlock(&e->lock); - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, - struct net_device *dev, const void *daddr) -+#else -+struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, -+ struct net_device *dev) -+#endif - { - struct l2t_entry *e = NULL; - struct neighbour *neigh; -@@ -311,7 +316,11 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, - int smt_idx; - - rcu_read_lock(); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - neigh = dst_neigh_lookup(dst, daddr); -+#else -+ neigh = dst_get_neighbour(dst); -+#endif - if (!neigh) - goto done_rcu; - -diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.h b/drivers/net/ethernet/chelsio/cxgb3/l2t.h -index 8cffcdf..1db5a71 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/l2t.h -+++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.h -@@ -109,8 +109,13 @@ static inline void set_arp_failure_handler(struct sk_buff *skb, - - void t3_l2e_free(struct l2t_data *d, struct l2t_entry *e); - void t3_l2t_update(struct t3cdev *dev, struct neighbour *neigh); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, - struct net_device *dev, const void *daddr); -+#else -+struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, -+ struct net_device *dev); -+#endif - int t3_l2t_send_slow(struct t3cdev *dev, struct sk_buff *skb, - struct l2t_entry *e); - void t3_l2t_send_event(struct t3cdev *dev, struct l2t_entry *e); -diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c -index 9c89dc8..9414ae0 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/sge.c -+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c -@@ -2019,7 +2019,11 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq, - skb_pull(skb, sizeof(*p) + pad); - skb->protocol = eth_type_trans(skb, adap->port[p->iff]); - pi = netdev_priv(skb->dev); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - if ((skb->dev->features & NETIF_F_RXCSUM) && p->csum_valid && -+#else -+ if ((pi->rx_offload & T3_RX_CSUM) && p->csum_valid && -+#endif - p->csum == htons(0xffff) && !p->fragment) { - qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; - skb->ip_summed = CHECKSUM_UNNECESSARY; -@@ -2027,11 +2031,38 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq, - skb_checksum_none_assert(skb); - skb_record_rx_queue(skb, qs - &adap->sge.qs[pi->first_qset]); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - if (p->vlan_valid) { -+#else -+ if (unlikely(p->vlan_valid)) { -+ struct vlan_group *grp = pi->vlan_grp; -+#endif - qs->port_stats[SGE_PSTAT_VLANEX]++; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(p->vlan)); - } - if (rq->polling) { -+#else -+ if (likely(grp)) -+ if (lro) -+ vlan_gro_receive(&qs->napi, grp, -+ ntohs(p->vlan), skb); -+ else { -+ if (unlikely(pi->iscsic.flags)) { -+ unsigned short vtag = ntohs(p->vlan) & -+ VLAN_VID_MASK; -+ skb->dev = vlan_group_get_device(grp, -+ vtag); -+ cxgb3_process_iscsi_prov_pack(pi, skb); -+ } -+ __vlan_hwaccel_rx(skb, grp, ntohs(p->vlan), -+ rq->polling); -+ } -+ else -+ dev_kfree_skb_any(skb); -+ } else if (rq->polling) { -+#endif -+ - if (lro) - napi_gro_receive(&qs->napi, skb); - else { -@@ -2103,7 +2134,11 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, - offset = 2 + sizeof(struct cpl_rx_pkt); - cpl = qs->lro_va = sd->pg_chunk.va + 2; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - if ((qs->netdev->features & NETIF_F_RXCSUM) && -+#else -+ if ((pi->rx_offload & T3_RX_CSUM) && -+#endif - cpl->csum_valid && cpl->csum == htons(0xffff)) { - skb->ip_summed = CHECKSUM_UNNECESSARY; - qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; -@@ -2129,10 +2164,21 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, - - skb_record_rx_queue(skb, qs - &adap->sge.qs[pi->first_qset]); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - if (cpl->vlan_valid) { - qs->port_stats[SGE_PSTAT_VLANEX]++; - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cpl->vlan)); - } -+#else -+ if (unlikely(cpl->vlan_valid)) { -+ struct vlan_group *grp = pi->vlan_grp; -+ -+ if (likely(grp != NULL)) { -+ vlan_gro_frags(&qs->napi, grp, ntohs(cpl->vlan)); -+ return; -+ } -+ } -+#endif - napi_gro_frags(&qs->napi); - } - -diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c -index c74a898..83103f0 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c -+++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c -@@ -3307,7 +3307,11 @@ static void config_pcie(struct adapter *adap) - G_NUMFSTTRNSEQRX(t3_read_reg(adap, A_PCIE_MODE)); - log2_width = fls(adap->params.pci.width) - 1; - acklat = ack_lat[log2_width][pldsize]; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - if (val & PCI_EXP_LNKCTL_ASPM_L0S) /* check LOsEnable */ -+#else -+ if (val & 1) -+#endif - acklat += fst_trn_tx * 4; - rpllmt = rpl_tmr[log2_width][pldsize] + fst_trn_rx * 4; - -diff --git a/drivers/net/ethernet/chelsio/cxgb3/xgmac.c b/drivers/net/ethernet/chelsio/cxgb3/xgmac.c -index 3af19a5..b3c99fd 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/xgmac.c -+++ b/drivers/net/ethernet/chelsio/cxgb3/xgmac.c -@@ -311,17 +311,32 @@ int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev) - if (dev->flags & IFF_ALLMULTI) - hash_lo = hash_hi = 0xffffffff; - else { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - struct netdev_hw_addr *ha; -+#else -+ struct dev_mc_list *dmi; -+#endif - int exact_addr_idx = mac->nucast; - - hash_lo = hash_hi = 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - netdev_for_each_mc_addr(ha, dev) -+#else -+ netdev_for_each_mc_addr(dmi, dev) -+#endif - if (exact_addr_idx < EXACT_ADDR_FILTERS) - set_addr_filter(mac, exact_addr_idx++, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - ha->addr); -+#else -+ dmi->dmi_addr); -+#endif - else { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - int hash = hash_hw_addr(ha->addr); -- -+#else -+ int hash = hash_hw_addr(dmi->dmi_addr); -+#endif - if (hash < 32) - hash_lo |= (1 << hash); - else diff --git a/patches/0008-iw_cxgb3-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch b/patches/0008-iw_cxgb3-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch new file mode 100644 index 0000000..9da5869 --- /dev/null +++ b/patches/0008-iw_cxgb3-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch @@ -0,0 +1,119 @@ +From: Kumar Sanghvi +Subject: [PATCH] iw_cxgb3: Backports for RHEL6.4, RHEL6.5 and SLES11sp3 + +Signed-off-by: Kumar Sanghvi +--- + drivers/infiniband/hw/cxgb3/iwch.h | 17 +++++++++++++- + drivers/infiniband/hw/cxgb3/iwch_cm.c | 39 +++++++++++++++++++++++++++++++++ + 2 files changed, 55 insertions(+), 1 deletions(-) + +diff --git a/drivers/infiniband/hw/cxgb3/iwch.h b/drivers/infiniband/hw/cxgb3/iwch.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/cxgb3/iwch.h ++++ b/drivers/infiniband/hw/cxgb3/iwch.h +@@ -153,7 +153,7 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr, + void *handle, u32 id) + { + int ret; +- ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + idr_preload(GFP_KERNEL); + spin_lock_irq(&rhp->lock); + +@@ -164,6 +164,21 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr, + + BUG_ON(ret == -ENOSPC); + return ret < 0 ? ret : 0; ++#else ++ int newid; ++ ++ do { ++ if (!idr_pre_get(idr, GFP_KERNEL)) { ++ return -ENOMEM; ++ } ++ spin_lock_irq(&rhp->lock); ++ ret = idr_get_new_above(idr, handle, id, &newid); ++ BUG_ON(newid != id); ++ spin_unlock_irq(&rhp->lock); ++ } while (ret == -EAGAIN); ++ ++ return ret; ++#endif + } + + static inline void remove_handle(struct iwch_dev *rhp, struct idr *idr, u32 id) +diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c ++++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c +@@ -337,12 +337,33 @@ static struct rtable *find_route(struct t3cdev *dev, __be32 local_ip, + __be16 peer_port, u8 tos) + { + struct rtable *rt; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + struct flowi4 fl4; + + rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, + peer_port, local_port, IPPROTO_TCP, + tos, 0); + if (IS_ERR(rt)) ++#else ++ struct flowi fl = { ++ .oif = 0, ++ .nl_u = { ++ .ip4_u = { ++ .daddr = peer_ip, ++ .saddr = local_ip, ++ .tos = tos ++ } ++ }, ++ .proto = IPPROTO_TCP, ++ .uli_u = { ++ .ports = { ++ .sport = local_port, ++ .dport = peer_port ++ } ++ } ++ }; ++ if (ip_route_output_flow(&init_net, &rt, &fl, NULL, false)) ++#endif + return NULL; + return rt; + } +@@ -1376,8 +1397,17 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) + __func__); + goto reject; + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) + dst = &rt->dst; ++#else ++ dst = &rt->u.dst; ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + l2t = t3_l2t_get(tdev, dst, NULL, &req->peer_ip); ++#else ++ l2t = t3_l2t_get(tdev, dst, NULL); ++#endif + if (!l2t) { + printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", + __func__); +@@ -1949,9 +1979,18 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) + err = -EHOSTUNREACH; + goto fail3; + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) + ep->dst = &rt->dst; ++#else ++ ep->dst = &rt->u.dst; ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL, + &raddr->sin_addr.s_addr); ++#else ++ ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL); ++#endif + if (!ep->l2t) { + printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); + err = -ENOMEM; diff --git a/patches/0008-iw_cxgb3_RHEL64-RHEL65-SLES11SP3-backport.patch b/patches/0008-iw_cxgb3_RHEL64-RHEL65-SLES11SP3-backport.patch deleted file mode 100644 index 2628f13..0000000 --- a/patches/0008-iw_cxgb3_RHEL64-RHEL65-SLES11SP3-backport.patch +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/drivers/infiniband/hw/cxgb3/iwch.h b/drivers/infiniband/hw/cxgb3/iwch.h -index 8378622..470527f 100644 ---- a/drivers/infiniband/hw/cxgb3/iwch.h -+++ b/drivers/infiniband/hw/cxgb3/iwch.h -@@ -153,7 +153,7 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr, - void *handle, u32 id) - { - int ret; -- -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - idr_preload(GFP_KERNEL); - spin_lock_irq(&rhp->lock); - -@@ -164,6 +164,21 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr, - - BUG_ON(ret == -ENOSPC); - return ret < 0 ? ret : 0; -+#else -+ int newid; -+ -+ do { -+ if (!idr_pre_get(idr, GFP_KERNEL)) { -+ return -ENOMEM; -+ } -+ spin_lock_irq(&rhp->lock); -+ ret = idr_get_new_above(idr, handle, id, &newid); -+ BUG_ON(newid != id); -+ spin_unlock_irq(&rhp->lock); -+ } while (ret == -EAGAIN); -+ -+ return ret; -+#endif - } - - static inline void remove_handle(struct iwch_dev *rhp, struct idr *idr, u32 id) -diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c -index 095bb04..320ea47 100644 ---- a/drivers/infiniband/hw/cxgb3/iwch_cm.c -+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c -@@ -337,12 +337,33 @@ static struct rtable *find_route(struct t3cdev *dev, __be32 local_ip, - __be16 peer_port, u8 tos) - { - struct rtable *rt; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - struct flowi4 fl4; - - rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, - peer_port, local_port, IPPROTO_TCP, - tos, 0); - if (IS_ERR(rt)) -+#else -+ struct flowi fl = { -+ .oif = 0, -+ .nl_u = { -+ .ip4_u = { -+ .daddr = peer_ip, -+ .saddr = local_ip, -+ .tos = tos -+ } -+ }, -+ .proto = IPPROTO_TCP, -+ .uli_u = { -+ .ports = { -+ .sport = local_port, -+ .dport = peer_port -+ } -+ } -+ }; -+ if (ip_route_output_flow(&init_net, &rt, &fl, NULL, false)) -+#endif - return NULL; - return rt; - } -@@ -1376,8 +1397,17 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) - __func__); - goto reject; - } -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - dst = &rt->dst; -+#else -+ dst = &rt->u.dst; -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - l2t = t3_l2t_get(tdev, dst, NULL, &req->peer_ip); -+#else -+ l2t = t3_l2t_get(tdev, dst, NULL); -+#endif - if (!l2t) { - printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", - __func__); -@@ -1949,9 +1979,18 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) - err = -EHOSTUNREACH; - goto fail3; - } -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - ep->dst = &rt->dst; -+#else -+ ep->dst = &rt->u.dst; -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL, - &raddr->sin_addr.s_addr); -+#else -+ ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL); -+#endif - if (!ep->l2t) { - printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); - err = -ENOMEM; diff --git a/patches/0009-cxgb4-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch b/patches/0009-cxgb4-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch new file mode 100644 index 0000000..8cf45f0 --- /dev/null +++ b/patches/0009-cxgb4-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch @@ -0,0 +1,735 @@ +From: Kumar Sanghvi +Subject: [PATCH] cxgb4: Backports for RHEL6.4, RHEL6.5 and SLES11sp3 + +Signed-off-by: Kumar Sanghvi +--- + drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 17 ++ + drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 208 ++++++++++++++++++++--- + drivers/net/ethernet/chelsio/cxgb4/sge.c | 108 ++++++++++++ + 3 files changed, 308 insertions(+), 25 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +@@ -309,6 +309,9 @@ struct sge_rspq; + + struct port_info { + struct adapter *adapter; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) ++ struct vlan_group *vlan_grp; ++#endif + u16 viid; + s16 xact_addr_filt; /* index of exact MAC address filter */ + u16 rss_size; /* size of VI's RSS table slice */ +@@ -318,6 +321,9 @@ struct port_info { + u8 port_id; + u8 tx_chan; + u8 lport; /* associated offload logical port */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++ u8 rx_offload; /* CSO, etc */ ++#endif + u8 nqsets; /* # of qsets */ + u8 first_qset; /* index of first qset */ + u8 rss_mode; +@@ -325,6 +331,13 @@ struct port_info { + u16 *rss; + }; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++/* port_info.rx_offload flags */ ++enum { ++ RX_CSO = 1 << 0, ++}; ++#endif ++ + struct dentry; + struct work_struct; + +@@ -359,7 +372,11 @@ struct sge_fl { /* SGE free-buffer queue state */ + + /* A packet gather list */ + struct pkt_gl { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + struct page_frag frags[MAX_SKB_FRAGS]; ++#else ++ skb_frag_t frags[MAX_SKB_FRAGS]; ++#endif + void *va; /* virtual address of first byte */ + unsigned int nfrags; /* # of fragments */ + unsigned int tot_len; /* total length of fragments */ +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +@@ -70,8 +70,6 @@ + #include "t4fw_api.h" + #include "l2t.h" + +-#include <../drivers/net/bonding/bonding.h> +- + #ifdef DRV_VERSION + #undef DRV_VERSION + #endif +@@ -482,14 +480,25 @@ static int set_addr_filters(const struct net_device *dev, bool sleep) + u16 filt_idx[7]; + const u8 *addr[7]; + int ret, naddr = 0; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) ++ const struct dev_addr_list *d; ++#endif + const struct netdev_hw_addr *ha; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + int uc_cnt = netdev_uc_count(dev); + int mc_cnt = netdev_mc_count(dev); ++#else ++ int uc_cnt = ((&(dev)->uc)->count); ++#endif + const struct port_info *pi = netdev_priv(dev); + unsigned int mb = pi->adapter->fn; + + /* first do the secondary unicast addresses */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + netdev_for_each_uc_addr(ha, dev) { ++#else ++ list_for_each_entry(ha, &(&(dev)->uc)->list, list) { ++#endif + addr[naddr++] = ha->addr; + if (--uc_cnt == 0 || naddr >= ARRAY_SIZE(addr)) { + ret = t4_alloc_mac_filt(pi->adapter, mb, pi->viid, free, +@@ -503,9 +512,15 @@ static int set_addr_filters(const struct net_device *dev, bool sleep) + } + + /* next set up the multicast addresses */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + netdev_for_each_mc_addr(ha, dev) { + addr[naddr++] = ha->addr; + if (--mc_cnt == 0 || naddr >= ARRAY_SIZE(addr)) { ++#else ++ netdev_for_each_mc_addr(d, dev) { ++ addr[naddr++] = d->dmi_addr; ++ if (naddr >= ARRAY_SIZE(addr) || d->next == NULL) { ++#endif + ret = t4_alloc_mac_filt(pi->adapter, mb, pi->viid, free, + naddr, addr, filt_idx, &mhash, sleep); + if (ret < 0) +@@ -2748,10 +2763,19 @@ static int set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) + return err; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + static int cxgb_set_features(struct net_device *dev, netdev_features_t features) ++#else ++static int cxgb_set_features(struct net_device *dev, u32 features) ++#endif + { + const struct port_info *pi = netdev_priv(dev); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + netdev_features_t changed = dev->features ^ features; ++#else ++ u32 changed = dev->features ^ features; ++#endif + int err; + + if (!(changed & NETIF_F_HW_VLAN_CTAG_RX)) +@@ -2764,14 +2788,55 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) + dev->features = features ^ NETIF_F_HW_VLAN_CTAG_RX; + return err; + } ++#else ++#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) ++ ++static int set_tso(struct net_device *dev, u32 value) ++{ ++ if (value) ++ dev->features |= TSO_FLAGS; ++ else ++ dev->features &= ~TSO_FLAGS; ++ return 0; ++} ++ ++static int set_flags(struct net_device *dev, u32 flags) ++{ ++ int err; ++ unsigned long old_feat = dev->features; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) ++ err = ethtool_op_set_flags(dev, flags, ETH_FLAG_RXHASH | ++ ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN); ++#else ++ err = ethtool_op_set_flags(dev, flags); ++#endif ++ if (err) ++ return err; ++ ++ if ((old_feat ^ dev->features) & NETIF_F_HW_VLAN_RX) { ++ const struct port_info *pi = netdev_priv(dev); ++ ++ err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1, ++ -1, -1, -1, !!(flags & ETH_FLAG_RXVLAN), ++ true); ++ if (err) ++ dev->features = old_feat; ++ } ++ return err; ++} ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + static u32 get_rss_table_size(struct net_device *dev) + { + const struct port_info *pi = netdev_priv(dev); + + return pi->rss_size; + } ++#endif + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) + static int get_rss_table(struct net_device *dev, u32 *p) + { + const struct port_info *pi = netdev_priv(dev); +@@ -2793,9 +2858,14 @@ static int set_rss_table(struct net_device *dev, const u32 *p) + return write_rss(pi, pi->rss); + return 0; + } ++#endif + + static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + u32 *rules) ++#else ++ void *rules) ++#endif + { + const struct port_info *pi = netdev_priv(dev); + +@@ -2874,7 +2944,11 @@ static const struct ethtool_ops cxgb_ethtool_ops = { + .set_pauseparam = set_pauseparam, + .get_link = ethtool_op_get_link, + .get_strings = get_strings, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + .set_phys_id = identify_port, ++#else ++ .phys_id = identify_port, ++#endif + .nway_reset = restart_autoneg, + .get_sset_count = get_sset_count, + .get_ethtool_stats = get_stats, +@@ -2882,10 +2956,18 @@ static const struct ethtool_ops cxgb_ethtool_ops = { + .get_regs = get_regs, + .get_wol = get_wol, + .set_wol = set_wol, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++ .set_tso = set_tso, ++ .set_flags = set_flags, ++#endif + .get_rxnfc = get_rxnfc, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + .get_rxfh_indir_size = get_rss_table_size, ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) + .get_rxfh_indir = get_rss_table, + .set_rxfh_indir = set_rss_table, ++#endif + .flash_device = set_flash, + }; + +@@ -2896,7 +2978,11 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos) + { + loff_t pos = *ppos; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + loff_t avail = file_inode(file)->i_size; ++#else ++ loff_t avail = file->f_path.dentry->d_inode->i_size; ++#endif + unsigned int mem = (uintptr_t)file->private_data & 3; + struct adapter *adap = file->private_data - mem; + +@@ -3983,33 +4069,10 @@ static int cxgb4_inet6addr_handler(struct notifier_block *this, + struct inet6_ifaddr *ifa = data; + struct net_device *event_dev; + int ret = NOTIFY_DONE; +- struct bonding *bond = netdev_priv(ifa->idev->dev); +- struct slave *slave; +- struct pci_dev *first_pdev = NULL; + + if (ifa->idev->dev->priv_flags & IFF_802_1Q_VLAN) { + event_dev = vlan_dev_real_dev(ifa->idev->dev); + ret = clip_add(event_dev, ifa, event); +- } else if (ifa->idev->dev->flags & IFF_MASTER) { +- /* It is possible that two different adapters are bonded in one +- * bond. We need to find such different adapters and add clip +- * in all of them only once. +- */ +- read_lock(&bond->lock); +- bond_for_each_slave(bond, slave) { +- if (!first_pdev) { +- ret = clip_add(slave->dev, ifa, event); +- /* If clip_add is success then only initialize +- * first_pdev since it means it is our device +- */ +- if (ret == NOTIFY_OK) +- first_pdev = to_pci_dev( +- slave->dev->dev.parent); +- } else if (first_pdev != +- to_pci_dev(slave->dev->dev.parent)) +- ret = clip_add(slave->dev, ifa, event); +- } +- read_unlock(&bond->lock); + } else + ret = clip_add(ifa->idev->dev, ifa, event); + +@@ -4035,7 +4098,11 @@ static int update_dev_clip(struct net_device *root_dev, struct net_device *dev) + return ret; + + read_lock_bh(&idev->lock); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + list_for_each_entry(ifa, &idev->addr_list, if_list) { ++#else ++ for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) { ++#endif + ret = cxgb4_clip_get(dev, + (const struct in6_addr *)ifa->addr.s6_addr); + if (ret < 0) +@@ -4049,6 +4116,10 @@ static int update_dev_clip(struct net_device *root_dev, struct net_device *dev) + static int update_root_dev_clip(struct net_device *dev) + { + struct net_device *root_dev = NULL; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) ++ struct vlan_group *grp; ++ const struct port_info *p = netdev_priv(dev); ++#endif + int i, ret = 0; + + /* First populate the real net device's IPv6 addresses */ +@@ -4058,7 +4129,13 @@ static int update_root_dev_clip(struct net_device *dev) + + /* Parse all bond and vlan devices layered on top of the physical dev */ + for (i = 0; i < VLAN_N_VID; i++) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + root_dev = __vlan_find_dev_deep(dev, htons(ETH_P_8021Q), i); ++#else ++ grp = p->vlan_grp; ++ if (grp) ++ root_dev = vlan_group_get_device(grp, i); ++#endif + if (!root_dev) + continue; + +@@ -4318,6 +4395,7 @@ int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid, + } + EXPORT_SYMBOL(cxgb4_remove_server_filter); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) + static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev, + struct rtnl_link_stats64 *ns) + { +@@ -4359,6 +4437,50 @@ static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev, + ns->rx_length_errors + stats.rx_len_err + ns->rx_fifo_errors; + return ns; + } ++#else ++static struct net_device_stats *cxgb_get_stats(struct net_device *dev) ++{ ++ struct port_stats stats; ++ struct port_info *p = netdev_priv(dev); ++ struct adapter *adapter = p->adapter; ++ struct net_device_stats *ns = &dev->stats; ++ ++ spin_lock(&adapter->stats_lock); ++ t4_get_port_stats(adapter, p->tx_chan, &stats); ++ spin_unlock(&adapter->stats_lock); ++ ++ ns->tx_bytes = stats.tx_octets; ++ ns->tx_packets = stats.tx_frames; ++ ns->rx_bytes = stats.rx_octets; ++ ns->rx_packets = stats.rx_frames; ++ ns->multicast = stats.rx_mcast_frames; ++ ++ /* detailed rx_errors */ ++ ns->rx_length_errors = stats.rx_jabber + stats.rx_too_long + ++ stats.rx_runt; ++ ns->rx_over_errors = 0; ++ ns->rx_crc_errors = stats.rx_fcs_err; ++ ns->rx_frame_errors = stats.rx_symbol_err; ++ ns->rx_fifo_errors = stats.rx_ovflow0 + stats.rx_ovflow1 + ++ stats.rx_ovflow2 + stats.rx_ovflow3 + ++ stats.rx_trunc0 + stats.rx_trunc1 + ++ stats.rx_trunc2 + stats.rx_trunc3; ++ ns->rx_missed_errors = 0; ++ ++ /* detailed tx_errors */ ++ ns->tx_aborted_errors = 0; ++ ns->tx_carrier_errors = 0; ++ ns->tx_fifo_errors = 0; ++ ns->tx_heartbeat_errors = 0; ++ ns->tx_window_errors = 0; ++ ++ ns->tx_errors = stats.tx_error_frames; ++ ns->rx_errors = stats.rx_symbol_err + stats.rx_fcs_err + ++ ns->rx_length_errors + stats.rx_len_err + ns->rx_fifo_errors; ++ return ns; ++} ++#endif ++ + + static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd) + { +@@ -4459,10 +4581,16 @@ static const struct net_device_ops cxgb4_netdev_ops = { + .ndo_open = cxgb_open, + .ndo_stop = cxgb_close, + .ndo_start_xmit = t4_eth_xmit, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) + .ndo_get_stats64 = cxgb_get_stats, ++#else ++ .ndo_get_stats = cxgb_get_stats, ++#endif + .ndo_set_rx_mode = cxgb_set_rxmode, + .ndo_set_mac_address = cxgb_set_mac_addr, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + .ndo_set_features = cxgb_set_features, ++#endif + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = cxgb_ioctl, + .ndo_change_mtu = cxgb_change_mtu, +@@ -5555,11 +5683,19 @@ static void eeh_resume(struct pci_dev *pdev) + rtnl_unlock(); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) + static const struct pci_error_handlers cxgb4_eeh = { + .error_detected = eeh_err_detected, + .slot_reset = eeh_slot_reset, + .resume = eeh_resume, + }; ++#else ++static struct pci_error_handlers cxgb4_eeh = { ++ .error_detected = eeh_err_detected, ++ .slot_reset = eeh_slot_reset, ++ .resume = eeh_resume, ++}; ++#endif + + static inline bool is_10g_port(const struct link_config *lc) + { +@@ -5752,7 +5888,11 @@ static int init_rss(struct adapter *adap) + if (!pi->rss) + return -ENOMEM; + for (j = 0; j < pi->rss_size; j++) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + pi->rss[j] = ethtool_rxfh_indir_default(j, pi->nqsets); ++#else ++ pi->rss[j] = j % pi->nqsets; ++#endif + } + return 0; + } +@@ -5824,7 +5964,9 @@ static void free_some_resources(struct adapter *adapter) + t4_fw_bye(adapter, adapter->fn); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + #define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) ++#endif + #define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \ + NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA) + #define SEGMENT_SIZE 128 +@@ -5958,19 +6100,35 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + pi = netdev_priv(netdev); + pi->adapter = adapter; + pi->xact_addr_filt = -1; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) ++ pi->rx_offload = RX_CSO; ++#endif + pi->port_id = i; + netdev->irq = pdev->irq; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + netdev->hw_features = NETIF_F_SG | TSO_FLAGS | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM | NETIF_F_RXHASH | + NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + if (highdma) + netdev->hw_features |= NETIF_F_HIGHDMA; + netdev->features |= netdev->hw_features; ++#else ++ netdev->features |= netdev->hw_features | highdma; ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) */ ++#else ++ netdev->features |= NETIF_F_SG | TSO_FLAGS; ++ netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; ++ netdev->features |= NETIF_F_GRO | NETIF_F_RXHASH | highdma; ++ netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; ++#endif + netdev->vlan_features = netdev->features & VLAN_FEAT; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + netdev->priv_flags |= IFF_UNICAST_FLT; ++#endif + + netdev->netdev_ops = &cxgb4_netdev_ops; + SET_ETHTOOL_OPS(netdev, &cxgb_ethtool_ops); +diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c +@@ -68,6 +68,11 @@ + */ + #define RX_PKT_SKB_LEN 512 + ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 6, 0) ++/* Ethernet header padding prepended to RX_PKTs */ ++#define RX_PKT_PAD 2 ++#endif ++ + /* + * Max number of Tx descriptors we clean up at a time. Should be modest as + * freeing skbs isn't cheap and it happens while holding locks. We just need +@@ -134,6 +139,15 @@ + */ + #define MAX_CTRL_WR_LEN SGE_MAX_WR_LEN + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) ++enum { ++ /* packet alignment in FL buffers */ ++ FL_ALIGN = L1_CACHE_BYTES < 32 ? 32 : L1_CACHE_BYTES, ++ /* egress status entry size */ ++ STAT_LEN = L1_CACHE_BYTES > 64 ? 128 : 64 ++}; ++#endif ++ + struct tx_sw_desc { /* SW state per Tx descriptor */ + struct sk_buff *skb; + struct ulptx_sgl *sgl; +@@ -247,8 +261,13 @@ static int map_skb(struct device *dev, const struct sk_buff *skb, + end = &si->frags[si->nr_frags]; + + for (fp = si->frags; fp < end; fp++) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + *++addr = skb_frag_dma_map(dev, fp, 0, skb_frag_size(fp), + DMA_TO_DEVICE); ++#else ++ *++addr = dma_map_page(dev, fp->page, fp->page_offset, ++ skb_frag_size(fp), DMA_TO_DEVICE); ++#endif + if (dma_mapping_error(dev, *addr)) + goto unwind; + } +@@ -588,7 +607,11 @@ static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n, + + alloc_small_pages: + while (n--) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + pg = __skb_alloc_page(gfp, NULL); ++#else ++ pg = alloc_page(gfp); ++#endif + if (unlikely(!pg)) { + q->alloc_failed++; + break; +@@ -1505,9 +1528,14 @@ int cxgb4_ofld_send(struct net_device *dev, struct sk_buff *skb) + } + EXPORT_SYMBOL(cxgb4_ofld_send); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + static inline void copy_frags(struct sk_buff *skb, ++#else ++static inline void copy_frags(struct skb_shared_info *ssi, ++#endif + const struct pkt_gl *gl, unsigned int offset) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + int i; + + /* usually there's just one frag */ +@@ -1522,6 +1550,22 @@ static inline void copy_frags(struct sk_buff *skb, + + /* get a reference to the last page, we don't own it */ + get_page(gl->frags[gl->nfrags - 1].page); ++#else ++ unsigned int n; ++ ++ /* usually there's just one frag */ ++ ssi->frags[0].page = gl->frags[0].page; ++ ssi->frags[0].page_offset = gl->frags[0].page_offset + offset; ++ skb_frag_size_set(&ssi->frags[0], ++ skb_frag_size(&gl->frags[0]) - offset); ++ ssi->nr_frags = gl->nfrags; ++ n = gl->nfrags - 1; ++ if (n) ++ memcpy(&ssi->frags[1], &gl->frags[1], n * sizeof(skb_frag_t)); ++ ++ /* get a reference to the last page, we don't own it */ ++ get_page(gl->frags[n].page); ++#endif + } + + /** +@@ -1556,7 +1600,11 @@ struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, + __skb_put(skb, pull_len); + skb_copy_to_linear_data(skb, gl->va, pull_len); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + copy_frags(skb, gl, pull_len); ++#else ++ copy_frags(skb_shinfo(skb), gl, pull_len); ++#endif + skb->len = gl->tot_len; + skb->data_len = skb->len - pull_len; + skb->truesize += skb->data_len; +@@ -1575,7 +1623,11 @@ EXPORT_SYMBOL(cxgb4_pktgl_to_skb); + static void t4_pktgl_free(const struct pkt_gl *gl) + { + int n; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + const struct page_frag *p; ++#else ++ const skb_frag_t *p; ++#endif + + for (p = gl->frags, n = gl->nfrags - 1; n--; p++) + put_page(p->page); +@@ -1623,7 +1675,11 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, + return; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + copy_frags(skb, gl, s->pktshift); ++#else ++ copy_frags(skb_shinfo(skb), gl, RX_PKT_PAD); ++#endif + skb->len = gl->tot_len - s->pktshift; + skb->data_len = skb->len; + skb->truesize += skb->data_len; +@@ -1633,7 +1689,16 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, + skb->rxhash = (__force u32)pkt->rsshdr.hash_val; + + if (unlikely(pkt->vlan_ex)) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan)); ++#else ++ struct port_info *pi = netdev_priv(rxq->rspq.netdev); ++ struct vlan_group *grp = pi->vlan_grp; ++ ++ if (likely(grp)) ++ ret = vlan_gro_frags(&rxq->rspq.napi, grp, ++ be16_to_cpu(pkt->vlan)); ++#endif + rxq->stats.vlan_ex++; + } + ret = napi_gro_frags(&rxq->rspq.napi); +@@ -1663,6 +1728,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, + struct sge *s = &q->adap->sge; + int cpl_trace_pkt = is_t4(q->adap->chip) ? + CPL_TRACE_PKT : CPL_TRACE_PKT_T5; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) ++ struct port_info *pi; ++#endif + + if (unlikely(*(u8 *)rsp == cpl_trace_pkt)) + return handle_trace_pkt(q->adap, si); +@@ -1687,10 +1755,17 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, + skb_record_rx_queue(skb, q->idx); + if (skb->dev->features & NETIF_F_RXHASH) + skb->rxhash = (__force u32)pkt->rsshdr.hash_val; ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 1, 0) ++ pi = netdev_priv(skb->dev); ++#endif + + rxq->stats.pkts++; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + if (csum_ok && (q->netdev->features & NETIF_F_RXCSUM) && ++#else ++ if (csum_ok && (pi->rx_offload & RX_CSO) && ++#endif + (pkt->l2info & htonl(RXF_UDP | RXF_TCP))) { + if (!pkt->ip_frag) { + skb->ip_summed = CHECKSUM_UNNECESSARY; +@@ -1705,7 +1780,15 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, + skb_checksum_none_assert(skb); + + if (unlikely(pkt->vlan_ex)) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan)); ++#else ++ struct vlan_group *grp = pi->vlan_grp; ++ if (likely(grp)) ++ vlan_hwaccel_receive_skb(skb, grp, ntohs(pkt->vlan)); ++ else ++ dev_kfree_skb_any(skb); ++#endif + rxq->stats.vlan_ex++; + } + netif_receive_skb(skb); +@@ -1794,7 +1877,9 @@ static int process_responses(struct sge_rspq *q, int budget) + const struct rsp_ctrl *rc; + struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); + struct adapter *adapter = q->adap; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + struct sge *s = &adapter->sge; ++#endif + + while (likely(budget_left)) { + rc = (void *)q->cur_desc + (q->iqe_len - sizeof(*rc)); +@@ -1804,7 +1889,11 @@ static int process_responses(struct sge_rspq *q, int budget) + rmb(); + rsp_type = RSPD_TYPE(rc->type_gen); + if (likely(rsp_type == RSP_TYPE_FLBUF)) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + struct page_frag *fp; ++#else ++ skb_frag_t *fp; ++#endif + struct pkt_gl si; + const struct rx_sw_desc *rsd; + u32 len = ntohl(rc->pldbuflen_qid), bufsz, frags; +@@ -1823,9 +1912,15 @@ static int process_responses(struct sge_rspq *q, int budget) + rsd = &rxq->fl.sdesc[rxq->fl.cidx]; + bufsz = get_buf_size(adapter, rsd); + fp->page = rsd->page; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + fp->offset = q->offset; + fp->size = min(bufsz, len); + len -= fp->size; ++#else ++ fp->page_offset = q->offset; ++ skb_frag_size_set(fp, min(bufsz, len)); ++ len -= skb_frag_size(fp); ++#endif + if (!len) + break; + unmap_rx_buf(q->adap, &rxq->fl); +@@ -1837,16 +1932,29 @@ static int process_responses(struct sge_rspq *q, int budget) + */ + dma_sync_single_for_cpu(q->adap->pdev_dev, + get_buf_addr(rsd), ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + fp->size, DMA_FROM_DEVICE); ++#else ++ skb_frag_size(fp), ++ DMA_FROM_DEVICE); ++#endif + + si.va = page_address(si.frags[0].page) + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + si.frags[0].offset; ++#else ++ si.frags[0].page_offset; ++#endif + prefetch(si.va); + + si.nfrags = frags + 1; + ret = q->handler(q, q->cur_desc, &si); + if (likely(ret == 0)) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + q->offset += ALIGN(fp->size, s->fl_align); ++#else ++ q->offset += ALIGN(skb_frag_size(fp), FL_ALIGN); ++#endif + else + restore_rx_bufs(&si, &rxq->fl, frags); + } else if (likely(rsp_type == RSP_TYPE_CPL)) { diff --git a/patches/0009-cxgb4_RHEL64-RHEL65-SLES11SP3-backport.patch b/patches/0009-cxgb4_RHEL64-RHEL65-SLES11SP3-backport.patch deleted file mode 100644 index 2fe0fe7..0000000 --- a/patches/0009-cxgb4_RHEL64-RHEL65-SLES11SP3-backport.patch +++ /dev/null @@ -1,725 +0,0 @@ -diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h -index 6154404..ad01c8b 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h -+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h -@@ -367,6 +367,9 @@ struct sge_rspq; - - struct port_info { - struct adapter *adapter; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) -+ struct vlan_group *vlan_grp; -+#endif - u16 viid; - s16 xact_addr_filt; /* index of exact MAC address filter */ - u16 rss_size; /* size of VI's RSS table slice */ -@@ -376,6 +379,9 @@ struct port_info { - u8 port_id; - u8 tx_chan; - u8 lport; /* associated offload logical port */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+ u8 rx_offload; /* CSO, etc */ -+#endif - u8 nqsets; /* # of qsets */ - u8 first_qset; /* index of first qset */ - u8 rss_mode; -@@ -383,6 +389,13 @@ struct port_info { - u16 *rss; - }; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+/* port_info.rx_offload flags */ -+enum { -+ RX_CSO = 1 << 0, -+}; -+#endif -+ - struct dentry; - struct work_struct; - -@@ -417,7 +430,11 @@ struct sge_fl { /* SGE free-buffer queue state */ - - /* A packet gather list */ - struct pkt_gl { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - struct page_frag frags[MAX_SKB_FRAGS]; -+#else -+ skb_frag_t frags[MAX_SKB_FRAGS]; -+#endif - void *va; /* virtual address of first byte */ - unsigned int nfrags; /* # of fragments */ - unsigned int tot_len; /* total length of fragments */ -diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -index 4c3c875..846cc48 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -@@ -70,8 +70,6 @@ - #include "t4fw_api.h" - #include "l2t.h" - --#include <../drivers/net/bonding/bonding.h> -- - #ifdef DRV_VERSION - #undef DRV_VERSION - #endif -@@ -482,14 +480,25 @@ static int set_addr_filters(const struct net_device *dev, bool sleep) - u16 filt_idx[7]; - const u8 *addr[7]; - int ret, naddr = 0; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) -+ const struct dev_addr_list *d; -+#endif - const struct netdev_hw_addr *ha; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - int uc_cnt = netdev_uc_count(dev); - int mc_cnt = netdev_mc_count(dev); -+#else -+ int uc_cnt = ((&(dev)->uc)->count); -+#endif - const struct port_info *pi = netdev_priv(dev); - unsigned int mb = pi->adapter->fn; - - /* first do the secondary unicast addresses */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - netdev_for_each_uc_addr(ha, dev) { -+#else -+ list_for_each_entry(ha, &(&(dev)->uc)->list, list) { -+#endif - addr[naddr++] = ha->addr; - if (--uc_cnt == 0 || naddr >= ARRAY_SIZE(addr)) { - ret = t4_alloc_mac_filt(pi->adapter, mb, pi->viid, free, -@@ -503,9 +512,15 @@ static int set_addr_filters(const struct net_device *dev, bool sleep) - } - - /* next set up the multicast addresses */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - netdev_for_each_mc_addr(ha, dev) { - addr[naddr++] = ha->addr; - if (--mc_cnt == 0 || naddr >= ARRAY_SIZE(addr)) { -+#else -+ netdev_for_each_mc_addr(d, dev) { -+ addr[naddr++] = d->dmi_addr; -+ if (naddr >= ARRAY_SIZE(addr) || d->next == NULL) { -+#endif - ret = t4_alloc_mac_filt(pi->adapter, mb, pi->viid, free, - naddr, addr, filt_idx, &mhash, sleep); - if (ret < 0) -@@ -2682,10 +2697,19 @@ static int set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) - return err; - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) - static int cxgb_set_features(struct net_device *dev, netdev_features_t features) -+#else -+static int cxgb_set_features(struct net_device *dev, u32 features) -+#endif - { - const struct port_info *pi = netdev_priv(dev); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) - netdev_features_t changed = dev->features ^ features; -+#else -+ u32 changed = dev->features ^ features; -+#endif - int err; - - if (!(changed & NETIF_F_HW_VLAN_CTAG_RX)) -@@ -2698,14 +2722,55 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) - dev->features = features ^ NETIF_F_HW_VLAN_CTAG_RX; - return err; - } -+#else -+#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) -+ -+static int set_tso(struct net_device *dev, u32 value) -+{ -+ if (value) -+ dev->features |= TSO_FLAGS; -+ else -+ dev->features &= ~TSO_FLAGS; -+ return 0; -+} -+ -+static int set_flags(struct net_device *dev, u32 flags) -+{ -+ int err; -+ unsigned long old_feat = dev->features; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) -+ err = ethtool_op_set_flags(dev, flags, ETH_FLAG_RXHASH | -+ ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN); -+#else -+ err = ethtool_op_set_flags(dev, flags); -+#endif -+ if (err) -+ return err; -+ -+ if ((old_feat ^ dev->features) & NETIF_F_HW_VLAN_RX) { -+ const struct port_info *pi = netdev_priv(dev); -+ -+ err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1, -+ -1, -1, -1, !!(flags & ETH_FLAG_RXVLAN), -+ true); -+ if (err) -+ dev->features = old_feat; -+ } -+ return err; -+} -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) - static u32 get_rss_table_size(struct net_device *dev) - { - const struct port_info *pi = netdev_priv(dev); - - return pi->rss_size; - } -+#endif - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - static int get_rss_table(struct net_device *dev, u32 *p) - { - const struct port_info *pi = netdev_priv(dev); -@@ -2727,9 +2792,14 @@ static int set_rss_table(struct net_device *dev, const u32 *p) - return write_rss(pi, pi->rss); - return 0; - } -+#endif - - static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - u32 *rules) -+#else -+ void *rules) -+#endif - { - const struct port_info *pi = netdev_priv(dev); - -@@ -2808,7 +2878,11 @@ static const struct ethtool_ops cxgb_ethtool_ops = { - .set_pauseparam = set_pauseparam, - .get_link = ethtool_op_get_link, - .get_strings = get_strings, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - .set_phys_id = identify_port, -+#else -+ .phys_id = identify_port, -+#endif - .nway_reset = restart_autoneg, - .get_sset_count = get_sset_count, - .get_ethtool_stats = get_stats, -@@ -2816,10 +2890,18 @@ static const struct ethtool_ops cxgb_ethtool_ops = { - .get_regs = get_regs, - .get_wol = get_wol, - .set_wol = set_wol, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+ .set_tso = set_tso, -+ .set_flags = set_flags, -+#endif - .get_rxnfc = get_rxnfc, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) - .get_rxfh_indir_size = get_rss_table_size, -+#endif -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - .get_rxfh_indir = get_rss_table, - .set_rxfh_indir = set_rss_table, -+#endif - .flash_device = set_flash, - }; - -@@ -2830,7 +2912,11 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count, - loff_t *ppos) - { - loff_t pos = *ppos; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - loff_t avail = file_inode(file)->i_size; -+#else -+ loff_t avail = file->f_path.dentry->d_inode->i_size; -+#endif - unsigned int mem = (uintptr_t)file->private_data & 3; - struct adapter *adap = file->private_data - mem; - -@@ -3947,33 +4033,10 @@ static int cxgb4_inet6addr_handler(struct notifier_block *this, - struct inet6_ifaddr *ifa = data; - struct net_device *event_dev; - int ret = NOTIFY_DONE; -- struct bonding *bond = netdev_priv(ifa->idev->dev); -- struct slave *slave; -- struct pci_dev *first_pdev = NULL; - - if (ifa->idev->dev->priv_flags & IFF_802_1Q_VLAN) { - event_dev = vlan_dev_real_dev(ifa->idev->dev); - ret = clip_add(event_dev, ifa, event); -- } else if (ifa->idev->dev->flags & IFF_MASTER) { -- /* It is possible that two different adapters are bonded in one -- * bond. We need to find such different adapters and add clip -- * in all of them only once. -- */ -- read_lock(&bond->lock); -- bond_for_each_slave(bond, slave) { -- if (!first_pdev) { -- ret = clip_add(slave->dev, ifa, event); -- /* If clip_add is success then only initialize -- * first_pdev since it means it is our device -- */ -- if (ret == NOTIFY_OK) -- first_pdev = to_pci_dev( -- slave->dev->dev.parent); -- } else if (first_pdev != -- to_pci_dev(slave->dev->dev.parent)) -- ret = clip_add(slave->dev, ifa, event); -- } -- read_unlock(&bond->lock); - } else - ret = clip_add(ifa->idev->dev, ifa, event); - -@@ -3999,7 +4062,11 @@ static int update_dev_clip(struct net_device *root_dev, struct net_device *dev) - return ret; - - read_lock_bh(&idev->lock); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - list_for_each_entry(ifa, &idev->addr_list, if_list) { -+#else -+ for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) { -+#endif - ret = cxgb4_clip_get(dev, - (const struct in6_addr *)ifa->addr.s6_addr); - if (ret < 0) -@@ -4013,6 +4080,10 @@ static int update_dev_clip(struct net_device *root_dev, struct net_device *dev) - static int update_root_dev_clip(struct net_device *dev) - { - struct net_device *root_dev = NULL; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) -+ struct vlan_group *grp; -+ const struct port_info *p = netdev_priv(dev); -+#endif - int i, ret = 0; - - /* First populate the real net device's IPv6 addresses */ -@@ -4022,7 +4093,13 @@ static int update_root_dev_clip(struct net_device *dev) - - /* Parse all bond and vlan devices layered on top of the physical dev */ - for (i = 0; i < VLAN_N_VID; i++) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - root_dev = __vlan_find_dev_deep(dev, htons(ETH_P_8021Q), i); -+#else -+ grp = p->vlan_grp; -+ if (grp) -+ root_dev = vlan_group_get_device(grp, i); -+#endif - if (!root_dev) - continue; - -@@ -4287,6 +4364,7 @@ int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid, - } - EXPORT_SYMBOL(cxgb4_remove_server_filter); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev, - struct rtnl_link_stats64 *ns) - { -@@ -4328,6 +4406,50 @@ static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev, - ns->rx_length_errors + stats.rx_len_err + ns->rx_fifo_errors; - return ns; - } -+#else -+static struct net_device_stats *cxgb_get_stats(struct net_device *dev) -+{ -+ struct port_stats stats; -+ struct port_info *p = netdev_priv(dev); -+ struct adapter *adapter = p->adapter; -+ struct net_device_stats *ns = &dev->stats; -+ -+ spin_lock(&adapter->stats_lock); -+ t4_get_port_stats(adapter, p->tx_chan, &stats); -+ spin_unlock(&adapter->stats_lock); -+ -+ ns->tx_bytes = stats.tx_octets; -+ ns->tx_packets = stats.tx_frames; -+ ns->rx_bytes = stats.rx_octets; -+ ns->rx_packets = stats.rx_frames; -+ ns->multicast = stats.rx_mcast_frames; -+ -+ /* detailed rx_errors */ -+ ns->rx_length_errors = stats.rx_jabber + stats.rx_too_long + -+ stats.rx_runt; -+ ns->rx_over_errors = 0; -+ ns->rx_crc_errors = stats.rx_fcs_err; -+ ns->rx_frame_errors = stats.rx_symbol_err; -+ ns->rx_fifo_errors = stats.rx_ovflow0 + stats.rx_ovflow1 + -+ stats.rx_ovflow2 + stats.rx_ovflow3 + -+ stats.rx_trunc0 + stats.rx_trunc1 + -+ stats.rx_trunc2 + stats.rx_trunc3; -+ ns->rx_missed_errors = 0; -+ -+ /* detailed tx_errors */ -+ ns->tx_aborted_errors = 0; -+ ns->tx_carrier_errors = 0; -+ ns->tx_fifo_errors = 0; -+ ns->tx_heartbeat_errors = 0; -+ ns->tx_window_errors = 0; -+ -+ ns->tx_errors = stats.tx_error_frames; -+ ns->rx_errors = stats.rx_symbol_err + stats.rx_fcs_err + -+ ns->rx_length_errors + stats.rx_len_err + ns->rx_fifo_errors; -+ return ns; -+} -+#endif -+ - - static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd) - { -@@ -4428,10 +4550,16 @@ static const struct net_device_ops cxgb4_netdev_ops = { - .ndo_open = cxgb_open, - .ndo_stop = cxgb_close, - .ndo_start_xmit = t4_eth_xmit, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - .ndo_get_stats64 = cxgb_get_stats, -+#else -+ .ndo_get_stats = cxgb_get_stats, -+#endif - .ndo_set_rx_mode = cxgb_set_rxmode, - .ndo_set_mac_address = cxgb_set_mac_addr, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - .ndo_set_features = cxgb_set_features, -+#endif - .ndo_validate_addr = eth_validate_addr, - .ndo_do_ioctl = cxgb_ioctl, - .ndo_change_mtu = cxgb_change_mtu, -@@ -5586,11 +5714,19 @@ static void eeh_resume(struct pci_dev *pdev) - rtnl_unlock(); - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) - static const struct pci_error_handlers cxgb4_eeh = { - .error_detected = eeh_err_detected, - .slot_reset = eeh_slot_reset, - .resume = eeh_resume, - }; -+#else -+static struct pci_error_handlers cxgb4_eeh = { -+ .error_detected = eeh_err_detected, -+ .slot_reset = eeh_slot_reset, -+ .resume = eeh_resume, -+}; -+#endif - - static inline bool is_10g_port(const struct link_config *lc) - { -@@ -5783,7 +5919,11 @@ static int init_rss(struct adapter *adap) - if (!pi->rss) - return -ENOMEM; - for (j = 0; j < pi->rss_size; j++) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) - pi->rss[j] = ethtool_rxfh_indir_default(j, pi->nqsets); -+#else -+ pi->rss[j] = j % pi->nqsets; -+#endif - } - return 0; - } -@@ -5855,7 +5995,9 @@ static void free_some_resources(struct adapter *adapter) - t4_fw_bye(adapter, adapter->fn); - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - #define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) -+#endif - #define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \ - NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA) - #define SEGMENT_SIZE 128 -@@ -5989,19 +6131,35 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - pi = netdev_priv(netdev); - pi->adapter = adapter; - pi->xact_addr_filt = -1; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -+ pi->rx_offload = RX_CSO; -+#endif - pi->port_id = i; - netdev->irq = pdev->irq; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - netdev->hw_features = NETIF_F_SG | TSO_FLAGS | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | NETIF_F_RXHASH | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) - if (highdma) - netdev->hw_features |= NETIF_F_HIGHDMA; - netdev->features |= netdev->hw_features; -+#else -+ netdev->features |= netdev->hw_features | highdma; -+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) */ -+#else -+ netdev->features |= NETIF_F_SG | TSO_FLAGS; -+ netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; -+ netdev->features |= NETIF_F_GRO | NETIF_F_RXHASH | highdma; -+ netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; -+#endif - netdev->vlan_features = netdev->features & VLAN_FEAT; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - netdev->priv_flags |= IFF_UNICAST_FLT; -+#endif - - netdev->netdev_ops = &cxgb4_netdev_ops; - SET_ETHTOOL_OPS(netdev, &cxgb_ethtool_ops); -diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c -index cc380c3..ae3f8aa 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/sge.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c -@@ -68,6 +68,11 @@ - */ - #define RX_PKT_SKB_LEN 512 - -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 6, 0) -+/* Ethernet header padding prepended to RX_PKTs */ -+#define RX_PKT_PAD 2 -+#endif -+ - /* - * Max number of Tx descriptors we clean up at a time. Should be modest as - * freeing skbs isn't cheap and it happens while holding locks. We just need -@@ -134,6 +139,15 @@ - */ - #define MAX_CTRL_WR_LEN SGE_MAX_WR_LEN - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) -+enum { -+ /* packet alignment in FL buffers */ -+ FL_ALIGN = L1_CACHE_BYTES < 32 ? 32 : L1_CACHE_BYTES, -+ /* egress status entry size */ -+ STAT_LEN = L1_CACHE_BYTES > 64 ? 128 : 64 -+}; -+#endif -+ - struct tx_sw_desc { /* SW state per Tx descriptor */ - struct sk_buff *skb; - struct ulptx_sgl *sgl; -@@ -247,8 +261,13 @@ static int map_skb(struct device *dev, const struct sk_buff *skb, - end = &si->frags[si->nr_frags]; - - for (fp = si->frags; fp < end; fp++) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - *++addr = skb_frag_dma_map(dev, fp, 0, skb_frag_size(fp), - DMA_TO_DEVICE); -+#else -+ *++addr = dma_map_page(dev, fp->page, fp->page_offset, -+ skb_frag_size(fp), DMA_TO_DEVICE); -+#endif - if (dma_mapping_error(dev, *addr)) - goto unwind; - } -@@ -588,7 +607,11 @@ static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n, - - alloc_small_pages: - while (n--) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - pg = __skb_alloc_page(gfp, NULL); -+#else -+ pg = alloc_page(gfp); -+#endif - if (unlikely(!pg)) { - q->alloc_failed++; - break; -@@ -1505,9 +1528,14 @@ int cxgb4_ofld_send(struct net_device *dev, struct sk_buff *skb) - } - EXPORT_SYMBOL(cxgb4_ofld_send); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - static inline void copy_frags(struct sk_buff *skb, -+#else -+static inline void copy_frags(struct skb_shared_info *ssi, -+#endif - const struct pkt_gl *gl, unsigned int offset) - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - int i; - - /* usually there's just one frag */ -@@ -1522,6 +1550,22 @@ static inline void copy_frags(struct sk_buff *skb, - - /* get a reference to the last page, we don't own it */ - get_page(gl->frags[gl->nfrags - 1].page); -+#else -+ unsigned int n; -+ -+ /* usually there's just one frag */ -+ ssi->frags[0].page = gl->frags[0].page; -+ ssi->frags[0].page_offset = gl->frags[0].page_offset + offset; -+ skb_frag_size_set(&ssi->frags[0], -+ skb_frag_size(&gl->frags[0]) - offset); -+ ssi->nr_frags = gl->nfrags; -+ n = gl->nfrags - 1; -+ if (n) -+ memcpy(&ssi->frags[1], &gl->frags[1], n * sizeof(skb_frag_t)); -+ -+ /* get a reference to the last page, we don't own it */ -+ get_page(gl->frags[n].page); -+#endif - } - - /** -@@ -1556,7 +1600,11 @@ struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, - __skb_put(skb, pull_len); - skb_copy_to_linear_data(skb, gl->va, pull_len); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - copy_frags(skb, gl, pull_len); -+#else -+ copy_frags(skb_shinfo(skb), gl, pull_len); -+#endif - skb->len = gl->tot_len; - skb->data_len = skb->len - pull_len; - skb->truesize += skb->data_len; -@@ -1575,7 +1623,11 @@ EXPORT_SYMBOL(cxgb4_pktgl_to_skb); - static void t4_pktgl_free(const struct pkt_gl *gl) - { - int n; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - const struct page_frag *p; -+#else -+ const skb_frag_t *p; -+#endif - - for (p = gl->frags, n = gl->nfrags - 1; n--; p++) - put_page(p->page); -@@ -1623,7 +1675,11 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, - return; - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - copy_frags(skb, gl, s->pktshift); -+#else -+ copy_frags(skb_shinfo(skb), gl, RX_PKT_PAD); -+#endif - skb->len = gl->tot_len - s->pktshift; - skb->data_len = skb->len; - skb->truesize += skb->data_len; -@@ -1633,7 +1689,16 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, - skb->rxhash = (__force u32)pkt->rsshdr.hash_val; - - if (unlikely(pkt->vlan_ex)) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan)); -+#else -+ struct port_info *pi = netdev_priv(rxq->rspq.netdev); -+ struct vlan_group *grp = pi->vlan_grp; -+ -+ if (likely(grp)) -+ ret = vlan_gro_frags(&rxq->rspq.napi, grp, -+ be16_to_cpu(pkt->vlan)); -+#endif - rxq->stats.vlan_ex++; - } - ret = napi_gro_frags(&rxq->rspq.napi); -@@ -1663,6 +1728,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, - struct sge *s = &q->adap->sge; - int cpl_trace_pkt = is_t4(q->adap->params.chip) ? - CPL_TRACE_PKT : CPL_TRACE_PKT_T5; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) -+ struct port_info *pi; -+#endif - - if (unlikely(*(u8 *)rsp == cpl_trace_pkt)) - return handle_trace_pkt(q->adap, si); -@@ -1687,10 +1755,17 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, - skb_record_rx_queue(skb, q->idx); - if (skb->dev->features & NETIF_F_RXHASH) - skb->rxhash = (__force u32)pkt->rsshdr.hash_val; -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 1, 0) -+ pi = netdev_priv(skb->dev); -+#endif - - rxq->stats.pkts++; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - if (csum_ok && (q->netdev->features & NETIF_F_RXCSUM) && -+#else -+ if (csum_ok && (pi->rx_offload & RX_CSO) && -+#endif - (pkt->l2info & htonl(RXF_UDP | RXF_TCP))) { - if (!pkt->ip_frag) { - skb->ip_summed = CHECKSUM_UNNECESSARY; -@@ -1705,7 +1780,15 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, - skb_checksum_none_assert(skb); - - if (unlikely(pkt->vlan_ex)) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan)); -+#else -+ struct vlan_group *grp = pi->vlan_grp; -+ if (likely(grp)) -+ vlan_hwaccel_receive_skb(skb, grp, ntohs(pkt->vlan)); -+ else -+ dev_kfree_skb_any(skb); -+#endif - rxq->stats.vlan_ex++; - } - netif_receive_skb(skb); -@@ -1794,7 +1877,9 @@ static int process_responses(struct sge_rspq *q, int budget) - const struct rsp_ctrl *rc; - struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); - struct adapter *adapter = q->adap; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - struct sge *s = &adapter->sge; -+#endif - - while (likely(budget_left)) { - rc = (void *)q->cur_desc + (q->iqe_len - sizeof(*rc)); -@@ -1804,7 +1889,11 @@ static int process_responses(struct sge_rspq *q, int budget) - rmb(); - rsp_type = RSPD_TYPE(rc->type_gen); - if (likely(rsp_type == RSP_TYPE_FLBUF)) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - struct page_frag *fp; -+#else -+ skb_frag_t *fp; -+#endif - struct pkt_gl si; - const struct rx_sw_desc *rsd; - u32 len = ntohl(rc->pldbuflen_qid), bufsz, frags; -@@ -1823,9 +1912,15 @@ static int process_responses(struct sge_rspq *q, int budget) - rsd = &rxq->fl.sdesc[rxq->fl.cidx]; - bufsz = get_buf_size(adapter, rsd); - fp->page = rsd->page; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - fp->offset = q->offset; - fp->size = min(bufsz, len); - len -= fp->size; -+#else -+ fp->page_offset = q->offset; -+ skb_frag_size_set(fp, min(bufsz, len)); -+ len -= skb_frag_size(fp); -+#endif - if (!len) - break; - unmap_rx_buf(q->adap, &rxq->fl); -@@ -1837,16 +1932,29 @@ static int process_responses(struct sge_rspq *q, int budget) - */ - dma_sync_single_for_cpu(q->adap->pdev_dev, - get_buf_addr(rsd), -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - fp->size, DMA_FROM_DEVICE); -+#else -+ skb_frag_size(fp), -+ DMA_FROM_DEVICE); -+#endif - - si.va = page_address(si.frags[0].page) + -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - si.frags[0].offset; -+#else -+ si.frags[0].page_offset; -+#endif - prefetch(si.va); - - si.nfrags = frags + 1; - ret = q->handler(q, q->cur_desc, &si); - if (likely(ret == 0)) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - q->offset += ALIGN(fp->size, s->fl_align); -+#else -+ q->offset += ALIGN(skb_frag_size(fp), FL_ALIGN); -+#endif - else - restore_rx_bufs(&si, &rxq->fl, frags); - } else if (likely(rsp_type == RSP_TYPE_CPL)) { diff --git a/patches/0010-iw_cxgb4-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch b/patches/0010-iw_cxgb4-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch new file mode 100644 index 0000000..e4a7541 --- /dev/null +++ b/patches/0010-iw_cxgb4-Backports-for-RHEL6.4-RHEL6.5-and-SLES11sp3.patch @@ -0,0 +1,220 @@ +From: Kumar Sanghvi +Subject: [PATCH] iw_cxgb4: Backports for RHEL6.4, RHEL6.5 and SLES11sp3 + +Signed-off-by: Kumar Sanghvi +--- + drivers/infiniband/hw/cxgb4/cm.c | 79 ++++++++++++++++++++++++++++++++ + drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 17 +++++++ + drivers/infiniband/hw/cxgb4/mem.c | 1 + + 3 files changed, 97 insertions(+), 0 deletions(-) + +diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/cxgb4/cm.c ++++ b/drivers/infiniband/hw/cxgb4/cm.c +@@ -363,6 +363,7 @@ static struct dst_entry *find_route6(struct c4iw_dev *dev, __u8 *local_ip, + struct dst_entry *dst = NULL; + + if (IS_ENABLED(CONFIG_IPV6)) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + struct flowi6 fl6; + + memset(&fl6, 0, sizeof(fl6)); +@@ -371,6 +372,18 @@ static struct dst_entry *find_route6(struct c4iw_dev *dev, __u8 *local_ip, + if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL) + fl6.flowi6_oif = sin6_scope_id; + dst = ip6_route_output(&init_net, NULL, &fl6); ++#else ++ struct flowi fl; ++ ++ memset(&fl, 0, sizeof(fl)); ++ fl.proto = IPPROTO_TCP; ++ ipv6_addr_copy(&fl.fl6_src, (struct in6_addr *)local_ip); ++ ipv6_addr_copy(&fl.fl6_dst, (struct in6_addr *)peer_ip); ++ fl.fl_ip_dport = peer_port; ++ fl.fl_ip_sport = local_port; ++ ++ dst = ip6_route_output(&init_net, NULL, &fl); ++#endif + if (!dst) + goto out; + if (!our_interface(dev, ip6_dst_idev(dst)->dev) && +@@ -389,6 +402,7 @@ static struct dst_entry *find_route(struct c4iw_dev *dev, __be32 local_ip, + __be16 peer_port, u8 tos) + { + struct rtable *rt; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + struct flowi4 fl4; + struct neighbour *n; + +@@ -397,7 +411,12 @@ static struct dst_entry *find_route(struct c4iw_dev *dev, __be32 local_ip, + tos, 0); + if (IS_ERR(rt)) + return NULL; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + n = dst_neigh_lookup(&rt->dst, &peer_ip); ++#endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) ++ n = dst_get_neighbour(&rt->dst); ++#endif + if (!n) + return NULL; + if (!our_interface(dev, n->dev)) { +@@ -406,6 +425,33 @@ static struct dst_entry *find_route(struct c4iw_dev *dev, __be32 local_ip, + } + neigh_release(n); + return &rt->dst; ++#else ++ struct flowi fl = { ++ .oif = 0, ++ .nl_u = { ++ .ip4_u = { ++ .daddr = peer_ip, ++ .saddr = local_ip, ++ .tos = tos} ++ }, ++ .proto = IPPROTO_TCP, ++ .uli_u = { ++ .ports = { ++ .sport = local_port, ++ .dport = peer_port} ++ } ++ }; ++ ++ if (ip_route_output_flow(&init_net, &rt, &fl, NULL, 0)) ++ return NULL; ++ ++ if (!our_interface(dev, rt->u.dst.neighbour->dev) && ++ !(rt->u.dst.neighbour->dev->flags & IFF_LOOPBACK)) { ++ dst_release(&rt->u.dst); ++ return NULL; ++ } ++ return &rt->u.dst; ++#endif + } + + static void arp_failure_discard(void *handle, struct sk_buff *skb) +@@ -1696,11 +1742,22 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, + int err, step; + struct net_device *pdev; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) + n = dst_neigh_lookup(dst, peer_ip); + if (!n) + return -ENODEV; + + rcu_read_lock(); ++#else ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) ++ n = dst_get_neighbour_noref(dst); ++#else ++ n = dst_get_neighbour(dst); ++#endif ++ err = -ENODEV; ++ if (!n) ++ goto out; ++#endif + err = -ENOMEM; + if (n->dev->flags & IFF_LOOPBACK) { + if (iptype == 4) +@@ -1762,7 +1819,9 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, + out: + rcu_read_unlock(); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) + neigh_release(n); ++#endif + + return err; + } +@@ -2688,7 +2747,11 @@ static int get_lladdr(struct net_device *dev, struct in6_addr *addr, + struct inet6_ifaddr *ifp; + + read_lock_bh(&idev->lock); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + list_for_each_entry(ifp, &idev->addr_list, if_list) { ++#else ++ for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) { ++#endif + if (ifp->scope == IFA_LINK && + !(ifp->flags & banned_flags)) { + memcpy(addr, &ifp->addr, 16); +@@ -3200,7 +3263,15 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos) + */ + memset(&tmp_opt, 0, sizeof(tmp_opt)); + tcp_clear_options(&tmp_opt); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + tcp_parse_options(skb, &tmp_opt, 0, NULL); ++#else ++ tcp_parse_options(skb, &tmp_opt, 0, 0); ++#endif ++#else ++ tcp_parse_options(skb, &tmp_opt, 0); ++#endif + + req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req)); + memset(req, 0, sizeof(*req)); +@@ -3364,7 +3435,15 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) + __func__); + goto reject; + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) + neigh = dst_neigh_lookup_skb(dst, skb); ++#else ++ neigh = dst_get_neighbour(dst); ++#endif ++#else ++ neigh = dst->neighbour; ++#endif + + if (!neigh) { + pr_err("%s - failed to allocate neigh!\n", +diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h ++++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +@@ -261,6 +261,7 @@ static inline int _insert_handle(struct c4iw_dev *rhp, struct idr *idr, + { + int ret; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + if (lock) { + idr_preload(GFP_KERNEL); + spin_lock_irq(&rhp->lock); +@@ -275,6 +276,22 @@ static inline int _insert_handle(struct c4iw_dev *rhp, struct idr *idr, + + BUG_ON(ret == -ENOSPC); + return ret < 0 ? ret : 0; ++#else ++ int newid; ++ ++ do { ++ if (!idr_pre_get(idr, lock ? GFP_KERNEL : GFP_ATOMIC)) ++ return -ENOMEM; ++ if (lock) ++ spin_lock_irq(&rhp->lock); ++ ret = idr_get_new_above(idr, handle, id, &newid); ++ BUG_ON(!ret && newid != id); ++ if (lock) ++ spin_unlock_irq(&rhp->lock); ++ } while (ret == -EAGAIN); ++ ++ return ret; ++#endif + } + + static inline int insert_handle(struct c4iw_dev *rhp, struct idr *idr, +diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/cxgb4/mem.c ++++ b/drivers/infiniband/hw/cxgb4/mem.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + #include "iw_cxgb4.h" + diff --git a/patches/0010-iw_cxgb4_RHEL64-RHEL65-SLES11SP3-backport.patch b/patches/0010-iw_cxgb4_RHEL64-RHEL65-SLES11SP3-backport.patch deleted file mode 100644 index 1ea60b4..0000000 --- a/patches/0010-iw_cxgb4_RHEL64-RHEL65-SLES11SP3-backport.patch +++ /dev/null @@ -1,210 +0,0 @@ -diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c -index 4512687..5a1bf82 100644 ---- a/drivers/infiniband/hw/cxgb4/cm.c -+++ b/drivers/infiniband/hw/cxgb4/cm.c -@@ -363,6 +363,7 @@ static struct dst_entry *find_route6(struct c4iw_dev *dev, __u8 *local_ip, - struct dst_entry *dst = NULL; - - if (IS_ENABLED(CONFIG_IPV6)) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - struct flowi6 fl6; - - memset(&fl6, 0, sizeof(fl6)); -@@ -371,6 +372,18 @@ static struct dst_entry *find_route6(struct c4iw_dev *dev, __u8 *local_ip, - if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL) - fl6.flowi6_oif = sin6_scope_id; - dst = ip6_route_output(&init_net, NULL, &fl6); -+#else -+ struct flowi fl; -+ -+ memset(&fl, 0, sizeof(fl)); -+ fl.proto = IPPROTO_TCP; -+ ipv6_addr_copy(&fl.fl6_src, (struct in6_addr *)local_ip); -+ ipv6_addr_copy(&fl.fl6_dst, (struct in6_addr *)peer_ip); -+ fl.fl_ip_dport = peer_port; -+ fl.fl_ip_sport = local_port; -+ -+ dst = ip6_route_output(&init_net, NULL, &fl); -+#endif - if (!dst) - goto out; - if (!our_interface(dev, ip6_dst_idev(dst)->dev) && -@@ -389,6 +402,7 @@ static struct dst_entry *find_route(struct c4iw_dev *dev, __be32 local_ip, - __be16 peer_port, u8 tos) - { - struct rtable *rt; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - struct flowi4 fl4; - struct neighbour *n; - -@@ -397,7 +411,12 @@ static struct dst_entry *find_route(struct c4iw_dev *dev, __be32 local_ip, - tos, 0); - if (IS_ERR(rt)) - return NULL; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - n = dst_neigh_lookup(&rt->dst, &peer_ip); -+#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) -+ n = dst_get_neighbour(&rt->dst); -+#endif - if (!n) - return NULL; - if (!our_interface(dev, n->dev)) { -@@ -406,6 +425,33 @@ static struct dst_entry *find_route(struct c4iw_dev *dev, __be32 local_ip, - } - neigh_release(n); - return &rt->dst; -+#else -+ struct flowi fl = { -+ .oif = 0, -+ .nl_u = { -+ .ip4_u = { -+ .daddr = peer_ip, -+ .saddr = local_ip, -+ .tos = tos} -+ }, -+ .proto = IPPROTO_TCP, -+ .uli_u = { -+ .ports = { -+ .sport = local_port, -+ .dport = peer_port} -+ } -+ }; -+ -+ if (ip_route_output_flow(&init_net, &rt, &fl, NULL, 0)) -+ return NULL; -+ -+ if (!our_interface(dev, rt->u.dst.neighbour->dev) && -+ !(rt->u.dst.neighbour->dev->flags & IFF_LOOPBACK)) { -+ dst_release(&rt->u.dst); -+ return NULL; -+ } -+ return &rt->u.dst; -+#endif - } - - static void arp_failure_discard(void *handle, struct sk_buff *skb) -@@ -1657,11 +1703,22 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, - int err, step; - struct net_device *pdev; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - n = dst_neigh_lookup(dst, peer_ip); - if (!n) - return -ENODEV; - - rcu_read_lock(); -+#else -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) -+ n = dst_get_neighbour_noref(dst); -+#else -+ n = dst_get_neighbour(dst); -+#endif -+ err = -ENODEV; -+ if (!n) -+ goto out; -+#endif - err = -ENOMEM; - if (n->dev->flags & IFF_LOOPBACK) { - if (iptype == 4) -@@ -1723,7 +1780,9 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, - out: - rcu_read_unlock(); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - neigh_release(n); -+#endif - - return err; - } -@@ -2649,7 +2708,11 @@ static int get_lladdr(struct net_device *dev, struct in6_addr *addr, - struct inet6_ifaddr *ifp; - - read_lock_bh(&idev->lock); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - list_for_each_entry(ifp, &idev->addr_list, if_list) { -+#else -+ for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) { -+#endif - if (ifp->scope == IFA_LINK && - !(ifp->flags & banned_flags)) { - memcpy(addr, &ifp->addr, 16); -@@ -3162,7 +3225,15 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos) - */ - memset(&tmp_opt, 0, sizeof(tmp_opt)); - tcp_clear_options(&tmp_opt); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - tcp_parse_options(skb, &tmp_opt, 0, NULL); -+#else -+ tcp_parse_options(skb, &tmp_opt, 0, 0); -+#endif -+#else -+ tcp_parse_options(skb, &tmp_opt, 0); -+#endif - - req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req)); - memset(req, 0, sizeof(*req)); -@@ -3324,7 +3395,15 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) - __func__); - goto reject; - } -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - neigh = dst_neigh_lookup_skb(dst, skb); -+#else -+ neigh = dst_get_neighbour(dst); -+#endif -+#else -+ neigh = dst->neighbour; -+#endif - - if (!neigh) { - pr_err("%s - failed to allocate neigh!\n", -diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h -index 23eaeab..8fb094c 100644 ---- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h -+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h -@@ -261,6 +261,7 @@ static inline int _insert_handle(struct c4iw_dev *rhp, struct idr *idr, - { - int ret; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - if (lock) { - idr_preload(GFP_KERNEL); - spin_lock_irq(&rhp->lock); -@@ -275,6 +276,22 @@ static inline int _insert_handle(struct c4iw_dev *rhp, struct idr *idr, - - BUG_ON(ret == -ENOSPC); - return ret < 0 ? ret : 0; -+#else -+ int newid; -+ -+ do { -+ if (!idr_pre_get(idr, lock ? GFP_KERNEL : GFP_ATOMIC)) -+ return -ENOMEM; -+ if (lock) -+ spin_lock_irq(&rhp->lock); -+ ret = idr_get_new_above(idr, handle, id, &newid); -+ BUG_ON(!ret && newid != id); -+ if (lock) -+ spin_unlock_irq(&rhp->lock); -+ } while (ret == -EAGAIN); -+ -+ return ret; -+#endif - } - - static inline int insert_handle(struct c4iw_dev *rhp, struct idr *idr, -diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c -index 4cb8eb2..0804aca 100644 ---- a/drivers/infiniband/hw/cxgb4/mem.c -+++ b/drivers/infiniband/hw/cxgb4/mem.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - - #include "iw_cxgb4.h" - diff --git a/patches/0011-cxgb4-Update-driver-version-to-reflect-ofed.patch b/patches/0011-cxgb4-Update-driver-version-to-reflect-ofed.patch new file mode 100644 index 0000000..56edfe7 --- /dev/null +++ b/patches/0011-cxgb4-Update-driver-version-to-reflect-ofed.patch @@ -0,0 +1,21 @@ +From: Kumar Sanghvi +Subject: [PATCH] cxgb4: Update driver version to reflect ofed + +Signed-off-by: Kumar Sanghvi +--- + drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +@@ -73,7 +73,7 @@ + #ifdef DRV_VERSION + #undef DRV_VERSION + #endif +-#define DRV_VERSION "2.0.0-ko" ++#define DRV_VERSION "2.0.0-ofed" + #define DRV_DESC "Chelsio T4/T5 Network Driver" + + /* diff --git a/patches/0011-cxgb4-update-driver-version.patch b/patches/0011-cxgb4-update-driver-version.patch deleted file mode 100644 index 1ed21d2..0000000 --- a/patches/0011-cxgb4-update-driver-version.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -index 94a6e62..99f43a6 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -@@ -73,7 +73,7 @@ - #ifdef DRV_VERSION - #undef DRV_VERSION - #endif --#define DRV_VERSION "2.0.0-ko" -+#define DRV_VERSION "2.0.0-ofed" - #define DRV_DESC "Chelsio T4/T5 Network Driver" - - /* diff --git a/patches/0012-cxgb3-Update-driver-version-to-reflect-ofed.patch b/patches/0012-cxgb3-Update-driver-version-to-reflect-ofed.patch new file mode 100644 index 0000000..72f3ebc --- /dev/null +++ b/patches/0012-cxgb3-Update-driver-version-to-reflect-ofed.patch @@ -0,0 +1,21 @@ +From: Kumar Sanghvi +Subject: [PATCH] cxgb3: Update driver version to reflect ofed + +Signed-off-by: Kumar Sanghvi +--- + drivers/net/ethernet/chelsio/cxgb3/version.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb3/version.h b/drivers/net/ethernet/chelsio/cxgb3/version.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/net/ethernet/chelsio/cxgb3/version.h ++++ b/drivers/net/ethernet/chelsio/cxgb3/version.h +@@ -35,7 +35,7 @@ + #define DRV_DESC "Chelsio T3 Network Driver" + #define DRV_NAME "cxgb3" + /* Driver version */ +-#define DRV_VERSION "1.1.5-ko" ++#define DRV_VERSION "1.1.5-ofed" + + /* Firmware version */ + #define FW_VERSION_MAJOR 7 diff --git a/patches/0012-cxgb3-update-driver-version.patch b/patches/0012-cxgb3-update-driver-version.patch deleted file mode 100644 index f4aacb5..0000000 --- a/patches/0012-cxgb3-update-driver-version.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/drivers/net/ethernet/chelsio/cxgb3/version.h b/drivers/net/ethernet/chelsio/cxgb3/version.h -index 165bfb9..1cfffe2 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/version.h -+++ b/drivers/net/ethernet/chelsio/cxgb3/version.h -@@ -35,7 +35,7 @@ - #define DRV_DESC "Chelsio T3 Network Driver" - #define DRV_NAME "cxgb3" - /* Driver version */ --#define DRV_VERSION "1.1.5-ko" -+#define DRV_VERSION "1.1.5-ofed" - - /* Firmware version */ - #define FW_VERSION_MAJOR 7 diff --git a/patches/0013-IB-qib-backport-qib_fs.c-before-2.6.35.patch b/patches/0013-IB-qib-backport-qib_fs.c-before-2.6.35.patch index 2bab478..a71d90f 100644 --- a/patches/0013-IB-qib-backport-qib_fs.c-before-2.6.35.patch +++ b/patches/0013-IB-qib-backport-qib_fs.c-before-2.6.35.patch @@ -10,7 +10,7 @@ diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_ index xxxxxxx..xxxxxxx xxxxxx --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c -@@ -58,7 +58,9 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry, +@@ -59,7 +59,9 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry, goto bail; } @@ -18,9 +18,9 @@ index xxxxxxx..xxxxxxx xxxxxx inode->i_ino = get_next_ino(); +#endif inode->i_mode = mode; - inode->i_uid = 0; - inode->i_gid = 0; -@@ -453,14 +455,27 @@ static int remove_file(struct dentry *parent, char *name) + inode->i_uid = GLOBAL_ROOT_UID; + inode->i_gid = GLOBAL_ROOT_GID; +@@ -454,14 +456,27 @@ static int remove_file(struct dentry *parent, char *name) goto bail; } @@ -48,7 +48,7 @@ index xxxxxxx..xxxxxxx xxxxxx } ret = 0; -@@ -552,6 +567,7 @@ bail: +@@ -553,6 +568,7 @@ bail: return ret; } @@ -56,7 +56,7 @@ index xxxxxxx..xxxxxxx xxxxxx static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { -@@ -559,6 +575,15 @@ static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags, +@@ -560,6 +576,15 @@ static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags, ret = mount_single(fs_type, flags, data, qibfs_fill_super); if (!IS_ERR(ret)) qib_super = ret->d_sb; @@ -72,7 +72,7 @@ index xxxxxxx..xxxxxxx xxxxxx return ret; } -@@ -600,7 +625,11 @@ int qibfs_remove(struct qib_devdata *dd) +@@ -601,7 +626,11 @@ int qibfs_remove(struct qib_devdata *dd) static struct file_system_type qibfs_fs_type = { .owner = THIS_MODULE, .name = "ipathfs", @@ -83,4 +83,4 @@ index xxxxxxx..xxxxxxx xxxxxx +#endif .kill_sb = qibfs_kill_super, }; - + MODULE_ALIAS_FS("ipathfs"); diff --git a/patches/0015-IB-ipath-backport-qib_fs.c-before-2.6.35.patch b/patches/0015-IB-ipath-backport-qib_fs.c-before-2.6.35.patch index b751b78..f27a3aa 100644 --- a/patches/0015-IB-ipath-backport-qib_fs.c-before-2.6.35.patch +++ b/patches/0015-IB-ipath-backport-qib_fs.c-before-2.6.35.patch @@ -77,4 +77,4 @@ index xxxxxxx..xxxxxxx xxxxxx +#endif .kill_sb = ipathfs_kill_super, }; - + MODULE_ALIAS_FS("ipathfs"); diff --git a/patches/0017-Deal-with-struct-pci-changes.patch b/patches/0017-Deal-with-struct-pci-changes.patch new file mode 100644 index 0000000..c6fc73c --- /dev/null +++ b/patches/0017-Deal-with-struct-pci-changes.patch @@ -0,0 +1,71 @@ +From: Dennis Dalessandro +Subject: [PATCH] Deal with struct pci changes. + +Signed-off-by: Dennis Dalessandro +--- + drivers/infiniband/hw/qib/qib_pcie.c | 21 +++++++++++++++++++++ + 1 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/drivers/infiniband/hw/qib/qib_pcie.c b/drivers/infiniband/hw/qib/qib_pcie.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/qib/qib_pcie.c ++++ b/drivers/infiniband/hw/qib/qib_pcie.c +@@ -283,12 +283,20 @@ int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent, + goto bail; + } + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) ++ pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSIX); ++#else + pos = dd->pcidev->msix_cap; ++#endif + if (nent && *nent && pos) { + qib_msix_setup(dd, pos, nent, entry); + ret = 0; /* did it, either MSIx or INTx */ + } else { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) ++ pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI); ++#else + pos = dd->pcidev->msi_cap; ++#endif + if (pos) + ret = qib_msi_setup(dd, pos); + else +@@ -357,7 +365,11 @@ int qib_reinit_intr(struct qib_devdata *dd) + if (!dd->msi_lo) + goto bail; + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) ++ pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI); ++#else + pos = dd->pcidev->msi_cap; ++#endif + if (!pos) { + qib_dev_err(dd, + "Can't find MSI capability, can't restore MSI settings\n"); +@@ -425,8 +437,12 @@ void qib_enable_intx(struct pci_dev *pdev) + new = cw & ~PCI_COMMAND_INTX_DISABLE; + if (new != cw) + pci_write_config_word(pdev, PCI_COMMAND, new); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) + ++ pos = pci_find_capability(pdev, PCI_CAP_ID_MSI); ++#else + pos = pdev->msi_cap; ++#endif + if (pos) { + /* then turn off MSI */ + pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &cw); +@@ -434,7 +450,12 @@ void qib_enable_intx(struct pci_dev *pdev) + if (new != cw) + pci_write_config_word(pdev, pos + PCI_MSI_FLAGS, new); + } ++ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) ++ pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); ++#else + pos = pdev->msix_cap; ++#endif + if (pos) { + /* then turn off MSIx */ + pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, &cw); diff --git a/patches/0017-IB-qib-backport-3.12-struct-pci-changes.patch b/patches/0017-IB-qib-backport-3.12-struct-pci-changes.patch deleted file mode 100644 index 13bdf33..0000000 --- a/patches/0017-IB-qib-backport-3.12-struct-pci-changes.patch +++ /dev/null @@ -1,72 +0,0 @@ -Deal with struct pci changes. - -From: Dennis Dalessandro - - ---- - drivers/infiniband/hw/qib/qib_pcie.c | 21 +++++++++++++++++++++ - 1 files changed, 21 insertions(+), 0 deletions(-) - -diff --git a/drivers/infiniband/hw/qib/qib_pcie.c b/drivers/infiniband/hw/qib/qib_pcie.c -index 3f14009..340845c 100644 ---- a/drivers/infiniband/hw/qib/qib_pcie.c -+++ b/drivers/infiniband/hw/qib/qib_pcie.c -@@ -283,12 +283,20 @@ int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent, - goto bail; - } - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) -+ pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSIX); -+#else - pos = dd->pcidev->msix_cap; -+#endif - if (nent && *nent && pos) { - qib_msix_setup(dd, pos, nent, entry); - ret = 0; /* did it, either MSIx or INTx */ - } else { -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) -+ pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI); -+#else - pos = dd->pcidev->msi_cap; -+#endif - if (pos) - ret = qib_msi_setup(dd, pos); - else -@@ -357,7 +365,11 @@ int qib_reinit_intr(struct qib_devdata *dd) - if (!dd->msi_lo) - goto bail; - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) -+ pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI); -+#else - pos = dd->pcidev->msi_cap; -+#endif - if (!pos) { - qib_dev_err(dd, - "Can't find MSI capability, can't restore MSI settings\n"); -@@ -425,8 +437,12 @@ void qib_enable_intx(struct pci_dev *pdev) - new = cw & ~PCI_COMMAND_INTX_DISABLE; - if (new != cw) - pci_write_config_word(pdev, PCI_COMMAND, new); -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) - -+ pos = pci_find_capability(pdev, PCI_CAP_ID_MSI); -+#else - pos = pdev->msi_cap; -+#endif - if (pos) { - /* then turn off MSI */ - pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &cw); -@@ -434,7 +450,12 @@ void qib_enable_intx(struct pci_dev *pdev) - if (new != cw) - pci_write_config_word(pdev, pos + PCI_MSI_FLAGS, new); - } -+ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) -+ pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); -+#else - pos = pdev->msix_cap; -+#endif - if (pos) { - /* then turn off MSIx */ - pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, &cw); diff --git a/patches/0018-IB-qib-backport-before-idr-style-init.patch b/patches/0018-IB-qib-backport-before-idr-style-init.patch deleted file mode 100644 index 3d422b3..0000000 --- a/patches/0018-IB-qib-backport-before-idr-style-init.patch +++ /dev/null @@ -1,66 +0,0 @@ -Work around new idr style - -From: Dennis Dalessandro - - ---- - drivers/infiniband/hw/qib/qib_init.c | 23 +++++++++++++++++++++-- - 1 files changed, 21 insertions(+), 2 deletions(-) - -diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c -index 24e802f..6dcb460 100644 ---- a/drivers/infiniband/hw/qib/qib_init.c -+++ b/drivers/infiniband/hw/qib/qib_init.c -@@ -1096,6 +1096,12 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) - struct qib_devdata *dd; - int ret; - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) -+ if (!idr_pre_get(&qib_unit_table, GFP_KERNEL)) { -+ dd = ERR_PTR(-ENOMEM); -+ goto bail; -+ } -+#endif - dd = (struct qib_devdata *) ib_alloc_device(sizeof(*dd) + extra); - if (!dd) { - dd = ERR_PTR(-ENOMEM); -@@ -1106,6 +1112,7 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) - qib_dbg_ibdev_init(&dd->verbs_dev); - #endif - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) - idr_preload(GFP_KERNEL); - spin_lock_irqsave(&qib_devs_lock, flags); - -@@ -1114,10 +1121,15 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) - dd->unit = ret; - list_add(&dd->list, &qib_dev_list); - } -- - spin_unlock_irqrestore(&qib_devs_lock, flags); - idr_preload_end(); -- -+#else -+ spin_lock_irqsave(&qib_devs_lock, flags); -+ ret = idr_get_new(&qib_unit_table, dd, &dd->unit); -+ if (ret >= 0) -+ list_add(&dd->list, &qib_dev_list); -+ spin_unlock_irqrestore(&qib_devs_lock, flags); -+#endif - if (ret < 0) { - qib_early_err(&pdev->dev, - "Could not allocate unit ID: error %d\n", -ret); -@@ -1247,6 +1259,13 @@ static int __init qlogic_ib_init(void) - * the PCI subsystem. - */ - idr_init(&qib_unit_table); -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) -+ if (!idr_pre_get(&qib_unit_table, GFP_KERNEL)) { -+ pr_err("idr_pre_get() failed\n"); -+ ret = -ENOMEM; -+ goto bail_dev; -+ } -+#endif - - #ifdef CONFIG_INFINIBAND_QIB_DCA - dca_register_notify(&dca_notifier); diff --git a/patches/0018-Work-around-new-idr-style.patch b/patches/0018-Work-around-new-idr-style.patch new file mode 100644 index 0000000..4b1f97f --- /dev/null +++ b/patches/0018-Work-around-new-idr-style.patch @@ -0,0 +1,65 @@ +From: Dennis Dalessandro +Subject: [PATCH] Work around new idr style + +Signed-off-by: Dennis Dalessandro +--- + drivers/infiniband/hw/qib/qib_init.c | 23 +++++++++++++++++++++-- + 1 files changed, 21 insertions(+), 2 deletions(-) + +diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/qib/qib_init.c ++++ b/drivers/infiniband/hw/qib/qib_init.c +@@ -1096,6 +1096,12 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) + struct qib_devdata *dd; + int ret; + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) ++ if (!idr_pre_get(&qib_unit_table, GFP_KERNEL)) { ++ dd = ERR_PTR(-ENOMEM); ++ goto bail; ++ } ++#endif + dd = (struct qib_devdata *) ib_alloc_device(sizeof(*dd) + extra); + if (!dd) { + dd = ERR_PTR(-ENOMEM); +@@ -1106,6 +1112,7 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) + qib_dbg_ibdev_init(&dd->verbs_dev); + #endif + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) + idr_preload(GFP_KERNEL); + spin_lock_irqsave(&qib_devs_lock, flags); + +@@ -1114,10 +1121,15 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) + dd->unit = ret; + list_add(&dd->list, &qib_dev_list); + } +- + spin_unlock_irqrestore(&qib_devs_lock, flags); + idr_preload_end(); +- ++#else ++ spin_lock_irqsave(&qib_devs_lock, flags); ++ ret = idr_get_new(&qib_unit_table, dd, &dd->unit); ++ if (ret >= 0) ++ list_add(&dd->list, &qib_dev_list); ++ spin_unlock_irqrestore(&qib_devs_lock, flags); ++#endif + if (ret < 0) { + qib_early_err(&pdev->dev, + "Could not allocate unit ID: error %d\n", -ret); +@@ -1247,6 +1259,13 @@ static int __init qlogic_ib_init(void) + * the PCI subsystem. + */ + idr_init(&qib_unit_table); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) ++ if (!idr_pre_get(&qib_unit_table, GFP_KERNEL)) { ++ pr_err("idr_pre_get() failed\n"); ++ ret = -ENOMEM; ++ goto bail_dev; ++ } ++#endif + + #ifdef CONFIG_INFINIBAND_QIB_DCA + dca_register_notify(&dca_notifier); diff --git a/patches/0019-RDMA-nes-3.12-backport-patches.patch b/patches/0019-RDMA-nes-3.12-backport-patches.patch new file mode 100644 index 0000000..6bc566e --- /dev/null +++ b/patches/0019-RDMA-nes-3.12-backport-patches.patch @@ -0,0 +1,298 @@ +From: Tatyana Nikolova +Subject: [PATCH] RDMA/nes: 3.12 backport patches + +Signed-off-by: Tatyana Nikolova +--- + drivers/infiniband/hw/nes/nes.c | 4 ++ + drivers/infiniband/hw/nes/nes_cm.c | 14 +++++- + drivers/infiniband/hw/nes/nes_hw.c | 28 +++++++++-- + drivers/infiniband/hw/nes/nes_hw.h | 6 ++ + drivers/infiniband/hw/nes/nes_nic.c | 96 ++++++++++++++++++++++++++++++++-- + 5 files changed, 137 insertions(+), 11 deletions(-) + +diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/nes/nes.c ++++ b/drivers/infiniband/hw/nes/nes.c +@@ -146,7 +146,11 @@ static int nes_inetaddr_event(struct notifier_block *notifier, + nesdev, nesdev->netdev[0]->name); + netdev = nesdev->netdev[0]; + nesvnic = netdev_priv(netdev); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) + upper_dev = netdev_master_upper_dev_get(netdev); ++#else ++ upper_dev = netdev->master; ++#endif + is_bonded = netif_is_bond_slave(netdev) && + (upper_dev == event_netdev); + if ((netdev == event_netdev) || is_bonded) { +diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/nes/nes_cm.c ++++ b/drivers/infiniband/hw/nes/nes_cm.c +@@ -1331,16 +1331,28 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi + int rc = arpindex; + struct net_device *netdev; + struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) ++ struct flowi fl; + ++ memset(&fl, 0, sizeof fl); ++ fl.nl_u.ip4_u.daddr = htonl(dst_ip); ++ if (ip_route_output_key(&init_net, &rt, &fl)) { ++#else + rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0); + if (IS_ERR(rt)) { ++#endif + printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n", + __func__, dst_ip); + return rc; + } + +- if (netif_is_bond_slave(nesvnic->netdev)) ++ if (netif_is_bond_slave(nesvnic->netdev)) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) + netdev = netdev_master_upper_dev_get(nesvnic->netdev); ++#else ++ netdev = nesvnic->netdev->master; ++#endif ++ } + else + netdev = nesvnic->netdev; + +diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/nes/nes_hw.c ++++ b/drivers/infiniband/hw/nes/nes_hw.c +@@ -2909,7 +2909,11 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq) + if ((cqe_errv & + (NES_NIC_ERRV_BITS_IPV4_CSUM_ERR | NES_NIC_ERRV_BITS_TCPUDP_CSUM_ERR | + NES_NIC_ERRV_BITS_IPH_ERR | NES_NIC_ERRV_BITS_WQE_OVERRUN)) == 0) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) ++ if (nesvnic->rx_checksum_disabled == 0) ++#else + if (nesvnic->netdev->features & NETIF_F_RXCSUM) ++#endif + rx_skb->ip_summed = CHECKSUM_UNNECESSARY; + } else + nes_debug(NES_DBG_CQ, "%s: unsuccessfully checksummed TCP or UDP packet." +@@ -2920,11 +2924,12 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq) + if ((cqe_errv & + (NES_NIC_ERRV_BITS_IPV4_CSUM_ERR | NES_NIC_ERRV_BITS_IPH_ERR | + NES_NIC_ERRV_BITS_WQE_OVERRUN)) == 0) { +- if (nesvnic->netdev->features & NETIF_F_RXCSUM) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) ++ if (nesvnic->rx_checksum_disabled == 0) ++#else ++ if (nesvnic->netdev->features & NETIF_F_RXCSUM) ++#endif + rx_skb->ip_summed = CHECKSUM_UNNECESSARY; +- /* nes_debug(NES_DBG_CQ, "%s: Reporting successfully checksummed IPv4 packet.\n", +- nesvnic->netdev->name); */ +- } + } else + nes_debug(NES_DBG_CQ, "%s: unsuccessfully checksummed TCP or UDP packet." + " errv = 0x%X, pkt_type = 0x%X.\n", +@@ -2948,7 +2953,22 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq) + nes_debug(NES_DBG_CQ, "%s: Reporting stripped VLAN packet. Tag = 0x%04X\n", + nesvnic->netdev->name, vlan_tag); + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) ++ if (nesvnic->vlan_grp != NULL) { ++ if (nes_use_lro) ++ lro_vlan_hwaccel_receive_skb(&nesvnic->lro_mgr, rx_skb, ++ nesvnic->vlan_grp, vlan_tag, NULL); ++ else ++ vlan_hwaccel_receive_skb(rx_skb, nesvnic->vlan_grp, vlan_tag); ++ goto skip_rx_indicate0; ++ } ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) ++ __vlan_hwaccel_put_tag(rx_skb, vlan_tag); ++#else + __vlan_hwaccel_put_tag(rx_skb, htons(ETH_P_8021Q), vlan_tag); ++#endif + } + if (nes_use_lro) + lro_receive_skb(&nesvnic->lro_mgr, rx_skb, NULL); +diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/nes/nes_hw.h ++++ b/drivers/infiniband/hw/nes/nes_hw.h +@@ -1269,6 +1269,12 @@ struct nes_vnic { + u8 next_qp_nic_index; + u8 of_device_registered; + u8 rdma_enabled; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) ++ struct vlan_group *vlan_grp; ++#endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) ++ u8 rx_checksum_disabled; ++#endif + u32 lro_max_aggr; + struct net_lro_mgr lro_mgr; + struct net_lro_desc lro_desc[NES_MAX_LRO_DESCRIPTORS]; +diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/nes/nes_nic.c ++++ b/drivers/infiniband/hw/nes/nes_nic.c +@@ -904,16 +904,24 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev) + if (!mc_all_on) { + char *addrs; + int i; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) + struct netdev_hw_addr *ha; +- ++#else ++ struct dev_mc_list *mcaddr; ++#endif + addrs = kmalloc(ETH_ALEN * mc_count, GFP_ATOMIC); + if (!addrs) { + set_allmulti(nesdev, nic_active_bit); + goto unlock; + } + i = 0; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) + netdev_for_each_mc_addr(ha, netdev) + memcpy(get_addr(addrs, i++), ha->addr, ETH_ALEN); ++#else ++ netdev_for_each_mc_addr(mcaddr, netdev) ++ memcpy(get_addr(addrs, i++), mcaddr->dmi_addr, ETH_ALEN); ++#endif + + perfect_filter_register_address = NES_IDX_PERFECT_FILTER_LOW + + pft_entries_preallocated * 0x8; +@@ -1572,6 +1580,34 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd + return 0; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) ++/** ++ * nes_netdev_get_rx_csum ++ */ ++static u32 nes_netdev_get_rx_csum (struct net_device *netdev) ++{ ++ struct nes_vnic *nesvnic = netdev_priv(netdev); ++ ++ if (nesvnic->rx_checksum_disabled) ++ return 0; ++ else ++ return 1; ++} ++ ++/** ++ * nes_netdev_set_rc_csum ++ */ ++static int nes_netdev_set_rx_csum(struct net_device *netdev, u32 enable) ++{ ++ struct nes_vnic *nesvnic = netdev_priv(netdev); ++ ++ if (enable) ++ nesvnic->rx_checksum_disabled = 0; ++ else ++ nesvnic->rx_checksum_disabled = 1; ++ return 0; ++} ++#endif + + static const struct ethtool_ops nes_ethtool_ops = { + .get_link = ethtool_op_get_link, +@@ -1585,8 +1621,46 @@ static const struct ethtool_ops nes_ethtool_ops = { + .set_coalesce = nes_netdev_set_coalesce, + .get_pauseparam = nes_netdev_get_pauseparam, + .set_pauseparam = nes_netdev_set_pauseparam, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) ++ .get_tx_csum = ethtool_op_get_tx_csum, ++ .set_tx_csum = ethtool_op_set_tx_csum, ++ .get_rx_csum = nes_netdev_get_rx_csum, ++ .set_rx_csum = nes_netdev_set_rx_csum, ++ .get_sg = ethtool_op_get_sg, ++ .set_sg = ethtool_op_set_sg, ++ .get_tso = ethtool_op_get_tso, ++ .set_tso = ethtool_op_set_tso, ++ .get_flags = ethtool_op_get_flags, ++ .set_flags = ethtool_op_set_flags ++#endif + }; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) ++static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) ++{ ++ struct nes_vnic *nesvnic = netdev_priv(netdev); ++ struct nes_device *nesdev = nesvnic->nesdev; ++ struct nes_adapter *nesadapter = nesdev->nesadapter; ++ u32 u32temp; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&nesadapter->phy_lock, flags); ++ nesvnic->vlan_grp = grp; ++ ++ nes_debug(NES_DBG_NETDEV, "%s: %s\n", __func__, netdev->name); ++ ++ /* Enable/Disable VLAN Stripping */ ++ u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG); ++ if (grp) ++ u32temp &= 0xfdffffff; ++ else ++ u32temp |= 0x02000000; ++ ++ nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp); ++ spin_unlock_irqrestore(&nesadapter->phy_lock, flags); ++} ++#endif ++ + static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, netdev_features_t features) + { + struct nes_adapter *nesadapter = nesdev->nesadapter; +@@ -1608,6 +1682,7 @@ static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, + spin_unlock_irqrestore(&nesadapter->phy_lock, flags); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) + static netdev_features_t nes_fix_features(struct net_device *netdev, netdev_features_t features) + { + /* +@@ -1633,6 +1708,7 @@ static int nes_set_features(struct net_device *netdev, netdev_features_t feature + + return 0; + } ++#endif + + static const struct net_device_ops nes_netdev_ops = { + .ndo_open = nes_netdev_open, +@@ -1644,8 +1720,13 @@ static const struct net_device_ops nes_netdev_ops = { + .ndo_set_rx_mode = nes_netdev_set_multicast_list, + .ndo_change_mtu = nes_netdev_change_mtu, + .ndo_validate_addr = eth_validate_addr, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) + .ndo_fix_features = nes_fix_features, + .ndo_set_features = nes_set_features, ++#endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) ++ .ndo_vlan_rx_register = nes_netdev_vlan_rx_register, ++#endif + }; + + /** +@@ -1706,12 +1787,15 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, + netdev->dev_addr[4] = (u8)(u64temp>>8); + netdev->dev_addr[5] = (u8)u64temp; + +- netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; +- if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) +- netdev->hw_features |= NETIF_F_TSO; ++ netdev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; ++ ++ if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) ++ netdev->features |= NETIF_F_TSO; + +- netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX; +- netdev->hw_features |= NETIF_F_LRO; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) ++ netdev->hw_features |= netdev->features | NETIF_F_LRO; ++#endif ++ netdev->features |= NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX; + + nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d," + " nic_index = %d, logical_port = %d, mac_index = %d.\n", diff --git a/patches/0019-nes-RHEL64-RHEL65-SLES11SP3-backport.patch b/patches/0019-nes-RHEL64-RHEL65-SLES11SP3-backport.patch deleted file mode 100644 index 44d9126..0000000 --- a/patches/0019-nes-RHEL64-RHEL65-SLES11SP3-backport.patch +++ /dev/null @@ -1,300 +0,0 @@ -RDMA/nes: Backport patch for RHEL6.4, RHEL6.5 and SLES11 SP3 - -Signed-off-by: Tatyana Nikolova ---- - drivers/infiniband/hw/nes/nes.c | 4 ++ - drivers/infiniband/hw/nes/nes_cm.c | 14 +++++- - drivers/infiniband/hw/nes/nes_hw.c | 28 +++++++++-- - drivers/infiniband/hw/nes/nes_hw.h | 6 ++ - drivers/infiniband/hw/nes/nes_nic.c | 96 ++++++++++++++++++++++++++++++++-- - 5 files changed, 137 insertions(+), 11 deletions(-) - -diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c -index 4291410..570b0f5 100644 ---- a/drivers/infiniband/hw/nes/nes.c -+++ b/drivers/infiniband/hw/nes/nes.c -@@ -146,7 +146,11 @@ static int nes_inetaddr_event(struct notifier_block *notifier, - nesdev, nesdev->netdev[0]->name); - netdev = nesdev->netdev[0]; - nesvnic = netdev_priv(netdev); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) - upper_dev = netdev_master_upper_dev_get(netdev); -+#else -+ upper_dev = netdev->master; -+#endif - is_bonded = netif_is_bond_slave(netdev) && - (upper_dev == event_netdev); - if ((netdev == event_netdev) || is_bonded) { -diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c -index 6b29249..18c3162 100644 ---- a/drivers/infiniband/hw/nes/nes_cm.c -+++ b/drivers/infiniband/hw/nes/nes_cm.c -@@ -1331,16 +1331,28 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi - int rc = arpindex; - struct net_device *netdev; - struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) -+ struct flowi fl; - -+ memset(&fl, 0, sizeof fl); -+ fl.nl_u.ip4_u.daddr = htonl(dst_ip); -+ if (ip_route_output_key(&init_net, &rt, &fl)) { -+#else - rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0); - if (IS_ERR(rt)) { -+#endif - printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n", - __func__, dst_ip); - return rc; - } - -- if (netif_is_bond_slave(nesvnic->netdev)) -+ if (netif_is_bond_slave(nesvnic->netdev)) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) - netdev = netdev_master_upper_dev_get(nesvnic->netdev); -+#else -+ netdev = nesvnic->netdev->master; -+#endif -+ } - else - netdev = nesvnic->netdev; - -diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c -index 9020024..86afebb 100644 ---- a/drivers/infiniband/hw/nes/nes_hw.c -+++ b/drivers/infiniband/hw/nes/nes_hw.c -@@ -2909,7 +2909,11 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq) - if ((cqe_errv & - (NES_NIC_ERRV_BITS_IPV4_CSUM_ERR | NES_NIC_ERRV_BITS_TCPUDP_CSUM_ERR | - NES_NIC_ERRV_BITS_IPH_ERR | NES_NIC_ERRV_BITS_WQE_OVERRUN)) == 0) { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) -+ if (nesvnic->rx_checksum_disabled == 0) -+#else - if (nesvnic->netdev->features & NETIF_F_RXCSUM) -+#endif - rx_skb->ip_summed = CHECKSUM_UNNECESSARY; - } else - nes_debug(NES_DBG_CQ, "%s: unsuccessfully checksummed TCP or UDP packet." -@@ -2920,11 +2924,12 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq) - if ((cqe_errv & - (NES_NIC_ERRV_BITS_IPV4_CSUM_ERR | NES_NIC_ERRV_BITS_IPH_ERR | - NES_NIC_ERRV_BITS_WQE_OVERRUN)) == 0) { -- if (nesvnic->netdev->features & NETIF_F_RXCSUM) { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) -+ if (nesvnic->rx_checksum_disabled == 0) -+#else -+ if (nesvnic->netdev->features & NETIF_F_RXCSUM) -+#endif - rx_skb->ip_summed = CHECKSUM_UNNECESSARY; -- /* nes_debug(NES_DBG_CQ, "%s: Reporting successfully checksummed IPv4 packet.\n", -- nesvnic->netdev->name); */ -- } - } else - nes_debug(NES_DBG_CQ, "%s: unsuccessfully checksummed TCP or UDP packet." - " errv = 0x%X, pkt_type = 0x%X.\n", -@@ -2948,7 +2953,22 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq) - nes_debug(NES_DBG_CQ, "%s: Reporting stripped VLAN packet. Tag = 0x%04X\n", - nesvnic->netdev->name, vlan_tag); - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) -+ if (nesvnic->vlan_grp != NULL) { -+ if (nes_use_lro) -+ lro_vlan_hwaccel_receive_skb(&nesvnic->lro_mgr, rx_skb, -+ nesvnic->vlan_grp, vlan_tag, NULL); -+ else -+ vlan_hwaccel_receive_skb(rx_skb, nesvnic->vlan_grp, vlan_tag); -+ goto skip_rx_indicate0; -+ } -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) -+ __vlan_hwaccel_put_tag(rx_skb, vlan_tag); -+#else - __vlan_hwaccel_put_tag(rx_skb, htons(ETH_P_8021Q), vlan_tag); -+#endif - } - if (nes_use_lro) - lro_receive_skb(&nesvnic->lro_mgr, rx_skb, NULL); -diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h -index d748e4b..72e5934 100644 ---- a/drivers/infiniband/hw/nes/nes_hw.h -+++ b/drivers/infiniband/hw/nes/nes_hw.h -@@ -1269,6 +1269,12 @@ struct nes_vnic { - u8 next_qp_nic_index; - u8 of_device_registered; - u8 rdma_enabled; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) -+ struct vlan_group *vlan_grp; -+#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) -+ u8 rx_checksum_disabled; -+#endif - u32 lro_max_aggr; - struct net_lro_mgr lro_mgr; - struct net_lro_desc lro_desc[NES_MAX_LRO_DESCRIPTORS]; -diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c -index 49eb511..795d305 100644 ---- a/drivers/infiniband/hw/nes/nes_nic.c -+++ b/drivers/infiniband/hw/nes/nes_nic.c -@@ -904,16 +904,24 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev) - if (!mc_all_on) { - char *addrs; - int i; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) - struct netdev_hw_addr *ha; -- -+#else -+ struct dev_mc_list *mcaddr; -+#endif - addrs = kmalloc(ETH_ALEN * mc_count, GFP_ATOMIC); - if (!addrs) { - set_allmulti(nesdev, nic_active_bit); - goto unlock; - } - i = 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) - netdev_for_each_mc_addr(ha, netdev) - memcpy(get_addr(addrs, i++), ha->addr, ETH_ALEN); -+#else -+ netdev_for_each_mc_addr(mcaddr, netdev) -+ memcpy(get_addr(addrs, i++), mcaddr->dmi_addr, ETH_ALEN); -+#endif - - perfect_filter_register_address = NES_IDX_PERFECT_FILTER_LOW + - pft_entries_preallocated * 0x8; -@@ -1572,6 +1580,34 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd - return 0; - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) -+/** -+ * nes_netdev_get_rx_csum -+ */ -+static u32 nes_netdev_get_rx_csum (struct net_device *netdev) -+{ -+ struct nes_vnic *nesvnic = netdev_priv(netdev); -+ -+ if (nesvnic->rx_checksum_disabled) -+ return 0; -+ else -+ return 1; -+} -+ -+/** -+ * nes_netdev_set_rc_csum -+ */ -+static int nes_netdev_set_rx_csum(struct net_device *netdev, u32 enable) -+{ -+ struct nes_vnic *nesvnic = netdev_priv(netdev); -+ -+ if (enable) -+ nesvnic->rx_checksum_disabled = 0; -+ else -+ nesvnic->rx_checksum_disabled = 1; -+ return 0; -+} -+#endif - - static const struct ethtool_ops nes_ethtool_ops = { - .get_link = ethtool_op_get_link, -@@ -1585,8 +1621,46 @@ static const struct ethtool_ops nes_ethtool_ops = { - .set_coalesce = nes_netdev_set_coalesce, - .get_pauseparam = nes_netdev_get_pauseparam, - .set_pauseparam = nes_netdev_set_pauseparam, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) -+ .get_tx_csum = ethtool_op_get_tx_csum, -+ .set_tx_csum = ethtool_op_set_tx_csum, -+ .get_rx_csum = nes_netdev_get_rx_csum, -+ .set_rx_csum = nes_netdev_set_rx_csum, -+ .get_sg = ethtool_op_get_sg, -+ .set_sg = ethtool_op_set_sg, -+ .get_tso = ethtool_op_get_tso, -+ .set_tso = ethtool_op_set_tso, -+ .get_flags = ethtool_op_get_flags, -+ .set_flags = ethtool_op_set_flags -+#endif - }; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) -+static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) -+{ -+ struct nes_vnic *nesvnic = netdev_priv(netdev); -+ struct nes_device *nesdev = nesvnic->nesdev; -+ struct nes_adapter *nesadapter = nesdev->nesadapter; -+ u32 u32temp; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&nesadapter->phy_lock, flags); -+ nesvnic->vlan_grp = grp; -+ -+ nes_debug(NES_DBG_NETDEV, "%s: %s\n", __func__, netdev->name); -+ -+ /* Enable/Disable VLAN Stripping */ -+ u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG); -+ if (grp) -+ u32temp &= 0xfdffffff; -+ else -+ u32temp |= 0x02000000; -+ -+ nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp); -+ spin_unlock_irqrestore(&nesadapter->phy_lock, flags); -+} -+#endif -+ - static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, netdev_features_t features) - { - struct nes_adapter *nesadapter = nesdev->nesadapter; -@@ -1608,6 +1682,7 @@ static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, - spin_unlock_irqrestore(&nesadapter->phy_lock, flags); - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) - static netdev_features_t nes_fix_features(struct net_device *netdev, netdev_features_t features) - { - /* -@@ -1633,6 +1708,7 @@ static int nes_set_features(struct net_device *netdev, netdev_features_t feature - - return 0; - } -+#endif - - static const struct net_device_ops nes_netdev_ops = { - .ndo_open = nes_netdev_open, -@@ -1644,8 +1720,13 @@ static const struct net_device_ops nes_netdev_ops = { - .ndo_set_rx_mode = nes_netdev_set_multicast_list, - .ndo_change_mtu = nes_netdev_change_mtu, - .ndo_validate_addr = eth_validate_addr, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) - .ndo_fix_features = nes_fix_features, - .ndo_set_features = nes_set_features, -+#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) -+ .ndo_vlan_rx_register = nes_netdev_vlan_rx_register, -+#endif - }; - - /** -@@ -1706,12 +1787,15 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, - netdev->dev_addr[4] = (u8)(u64temp>>8); - netdev->dev_addr[5] = (u8)u64temp; - -- netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; -- if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) -- netdev->hw_features |= NETIF_F_TSO; -+ netdev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; -+ -+ if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) -+ netdev->features |= NETIF_F_TSO; - -- netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX; -- netdev->hw_features |= NETIF_F_LRO; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) -+ netdev->hw_features |= netdev->features | NETIF_F_LRO; -+#endif -+ netdev->features |= NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX; - - nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d," - " nic_index = %d, logical_port = %d, mac_index = %d.\n", --- -1.7.1 -