]> git.openfabrics.org - ~emulex/for-vlad/compat-rdma.git/commitdiff
Refresh patches for linux-3.5
authorVladimir Sokolovsky <vlad@mellanox.com>
Sun, 5 Aug 2012 19:10:32 +0000 (22:10 +0300)
committerVladimir Sokolovsky <vlad@mellanox.com>
Sun, 5 Aug 2012 19:10:32 +0000 (22:10 +0300)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
29 files changed:
patches/0001-ib_core-backport-dst_fetch_ha.patch
patches/0002-ib-core-Backport-flowi4-and-flowi6.patch
patches/0003-BACKPORT-core-netlink-for-kernels-3.4.patch
patches/0004-ib-core-Backport-pinned_vm-for-kernels-3.2.patch
patches/0005-ib-core-Backport-CLASS_ATTR-for-kernels-2.6.34.patch
patches/0006-Backport-mlx4_ib.patch
patches/0007-BACKPORT-ucma-Revert-sysctl-registrations.patch
patches/0008-RDMA-nes-Backports-for-RHEL-6.2-and-6.3.patch
patches/0009-iw_cxgb3-iw_cxgb4-Enable-header-file-inclusion-with-.patch
patches/0009-qib-fs-backport.patch [deleted file]
patches/0010-IB-qib-backport-qib_fs.c-before-2.6.35.patch [new file with mode: 0644]
patches/0010-cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch [deleted file]
patches/0010-qib-pinned-vm.patch [deleted file]
patches/0011-cxgb3-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch [new file with mode: 0644]
patches/0011-cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch [deleted file]
patches/0011-ipath-fs-backport.patch [deleted file]
patches/0012-IB-qib-backport-3.2-for-pinned_vm-field.patch [new file with mode: 0644]
patches/0012-ipath-pinned-vm.patch [deleted file]
patches/0012-iw_cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch [deleted file]
patches/0013-cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch [new file with mode: 0644]
patches/0013-iw_cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch [deleted file]
patches/0014-IB-ipath-backport-qib_fs.c-before-2.6.35.patch [new file with mode: 0644]
patches/0014-IPoIB-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch [deleted file]
patches/0015-IB-ipath-backport-3.2-for-pinned_vm-field.patch [new file with mode: 0644]
patches/0016-iw_cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch [new file with mode: 0644]
patches/0017-iw_cxgb4-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP.patch [new file with mode: 0644]
patches/0018-IPoIB-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch [new file with mode: 0644]
patches/0019-mlx4_en-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP.patch [deleted file]
patches/0019-mlx4_en-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch [new file with mode: 0644]

index a835b3d725f98fcc86684ebd969f994df5cfd64f..1c76365405a921bb09d117ff0635c7fca84bca45 100644 (file)
@@ -1,7 +1,7 @@
-From 0bdb36768a4a4b5ed3984c671e76f29dbcc20ee6 Mon Sep 17 00:00:00 2001
+From 0038f903e7318e5e0ef15949acd78290b9c665a3 Mon Sep 17 00:00:00 2001
 From: Vladimir Sokolovsky <vlad@mellanox.com>
 Date: Tue, 10 Jul 2012 15:57:24 +0300
-Subject: [PATCH 1/8] ib_core: backport dst_fetch_ha
+Subject: [PATCH 01/19] ib_core: backport dst_fetch_ha
 
 Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
index adfa99217af20d01f3ab35abbd3c81f3dd68a6a5..7e72f817bf2194733d79c5acd750ee335f4eca91 100644 (file)
@@ -1,7 +1,7 @@
-From bb3f1ecdb6baee2740a108b6df5710c7b69cd6f3 Mon Sep 17 00:00:00 2001
+From afcded5e038e760d131e231d5c4ef9b1aab47ef4 Mon Sep 17 00:00:00 2001
 From: Vladimir Sokolovsky <vlad@mellanox.com>
 Date: Tue, 10 Jul 2012 17:21:25 +0300
-Subject: [PATCH 2/8] ib/core: Backport flowi4 and flowi6
+Subject: [PATCH 02/19] ib/core: Backport flowi4 and flowi6
 
 Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
index c7641058e69a2d66b80bb12125b4b6744fb0adb1..34da210ea7d51b158a38979ad9c0c8a3c3333b20 100644 (file)
@@ -1,7 +1,7 @@
-From 99c4d483228edc17d03d7b4ee21c36943b4bcaca Mon Sep 17 00:00:00 2001
+From 7692a8ee4653116ca742acfbf84b008ef98a2fa2 Mon Sep 17 00:00:00 2001
 From: Vladimir Sokolovsky <vlad@mellanox.com>
 Date: Mon, 25 Jun 2012 22:28:24 +0300
-Subject: [PATCH 3/8] BACKPORT: core/netlink for kernels <= 3.4
+Subject: [PATCH 03/19] BACKPORT: core/netlink for kernels <= 3.4
 
 Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
index 277cd15781fd094167dd180297569c13ca1d2f2b..c2d7eed1720f7b8da306298d90cbf108dd37cef2 100644 (file)
@@ -1,7 +1,7 @@
-From 812b253a1afb7e046ca7d60330692a4fcb1d0e84 Mon Sep 17 00:00:00 2001
+From 723354e9a6c86869c6bed9a2c7935551f494ca48 Mon Sep 17 00:00:00 2001
 From: Vladimir Sokolovsky <vlad@mellanox.com>
 Date: Tue, 10 Jul 2012 17:41:31 +0300
-Subject: [PATCH 4/8] ib/core: Backport pinned_vm for kernels <= 3.2
+Subject: [PATCH 04/19] ib/core: Backport pinned_vm for kernels <= 3.2
 
 Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
index 1befd6ca4c85df805132fb2b5354e4f282cb3190..edf420b6ed5b08e69eb2ae8f66ae7c4de57f4f79 100644 (file)
@@ -1,7 +1,7 @@
-From 12dcf9f472a1fc297b9909e84a4c7b2a82faeaa1 Mon Sep 17 00:00:00 2001
+From 83914b4f3d83330c6ad822f9452d4b2c81f328bd Mon Sep 17 00:00:00 2001
 From: Vladimir Sokolovsky <vlad@mellanox.com>
 Date: Tue, 10 Jul 2012 18:06:16 +0300
-Subject: [PATCH 5/8] ib/core: Backport CLASS_ATTR for kernels < 2.6.34
+Subject: [PATCH 05/19] ib/core: Backport CLASS_ATTR for kernels < 2.6.34
 
 Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
index ee0d2a1db6aab25a889042c68ff71a93c47a6ec1..ec0c93ba57b4a7b57b1e8d123d07a940eb77b44b 100644 (file)
@@ -1,7 +1,7 @@
-From d7e2b00aaca04e9c1f976001189f8289117ff1ca Mon Sep 17 00:00:00 2001
+From 29b2e01be91deea5444b21c4345184c65e2126c5 Mon Sep 17 00:00:00 2001
 From: Vladimir Sokolovsky <vlad@mellanox.com>
 Date: Thu, 12 Jul 2012 22:31:24 +0300
-Subject: [PATCH 6/8] Backport mlx4_ib
+Subject: [PATCH 06/19] Backport mlx4_ib
 
 Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
index c9ba19d0c2988ca246574b2fdd7795bf53b50d29..f5b1831b6af6f5dba2191ab1d65101bc7d626557 100644 (file)
@@ -1,7 +1,7 @@
-From 74269c6e48ef212f4151a99ea9a0a0ce58427535 Mon Sep 17 00:00:00 2001
+From 2db8dcb3b0cde969104eefb7fd59f9d912d258b6 Mon Sep 17 00:00:00 2001
 From: Vladimir Sokolovsky <vlad@mellanox.com>
 Date: Fri, 13 Jul 2012 00:24:56 +0300
-Subject: [PATCH 7/8] BACKPORT ucma: Revert sysctl registrations
+Subject: [PATCH 07/19] BACKPORT ucma: Revert sysctl registrations
 
 Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
index 199249330367af088e148f8e026fbc75af24702b..bb2c448122989ac47ad4e874c6963ae53fdccaf8 100644 (file)
@@ -1,7 +1,7 @@
-From 80aaf4b94ca74d3d0c661932ec05d46da4c42022 Mon Sep 17 00:00:00 2001
+From 5b576bba91da600067fb95cc76b13d57433b0767 Mon Sep 17 00:00:00 2001
 From: Tatyana Nikolova <Tatyana.E.Nikolova@intel.com>
 Date: Mon, 16 Jul 2012 17:14:31 +0300
-Subject: [PATCH 8/8] RDMA/nes: Backports for RHEL 6.2 and 6.3
+Subject: [PATCH 08/19] RDMA/nes: Backports for RHEL 6.2 and 6.3
 
 Backports for linux-3.5 nes to RHEL-6.2 and RHEL-6.3
 
index cd0b57e6c3f7dc78edd4a8be68617a02f3982a5d..3b9e8c2231ab9017aac211fbe05e12b37561af06 100644 (file)
@@ -1,7 +1,7 @@
-From b8ff2564c8451779f2892756c107f0a5f829342d Mon Sep 17 00:00:00 2001
+From bdb1401c1b46e21549c53f1681f6b7b03bb60ebc Mon Sep 17 00:00:00 2001
 From: Vipul Pandya <vipul@chelsio.com>
 Date: Mon, 7 May 2012 12:43:41 +0530
-Subject: [PATCH] iw_cxgb3/iw_cxgb4: Enable header file inclusion with absolute path
+Subject: [PATCH 09/19] iw_cxgb3/iw_cxgb4: Enable header file inclusion with absolute path
 
 iw_cxgb3/iw_cxgb4 driver includes header files of cxgb3/cxgb4 drivers
 respectively. OFED build environment is not able to find the header files
@@ -24,7 +24,7 @@ index 2761364..c780a7a 100644
  obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o
  
 diff --git a/drivers/infiniband/hw/cxgb4/Makefile b/drivers/infiniband/hw/cxgb4/Makefile
-index 46b878c..b26d54c 100644
+index e11cf72..2f9fbf3 100644
 --- a/drivers/infiniband/hw/cxgb4/Makefile
 +++ b/drivers/infiniband/hw/cxgb4/Makefile
 @@ -1,4 +1,4 @@
diff --git a/patches/0009-qib-fs-backport.patch b/patches/0009-qib-fs-backport.patch
deleted file mode 100644 (file)
index 517e99a..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-IB/qib: backport qib_fs.c before 2.6.35
-
-Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
-
-diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
-index 05e0f17..4ea3926 100644
---- 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,
-               goto bail;
-       }
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
-       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)
-               goto bail;
-       }
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
-+      spin_lock(&dcache_lock);
-+#endif
-       spin_lock(&tmp->d_lock);
-       if (!(d_unhashed(tmp) && tmp->d_inode)) {
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
-+              dget_locked(tmp);
-+#else
-               dget_dlock(tmp);
-+#endif
-               __d_drop(tmp);
-               spin_unlock(&tmp->d_lock);
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
-+              spin_unlock(&dcache_lock);
-+#endif
-               simple_unlink(parent->d_inode, tmp);
-       } else {
-               spin_unlock(&tmp->d_lock);
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
-+              spin_unlock(&dcache_lock);
-+#endif
-       }
-       ret = 0;
-@@ -552,6 +567,7 @@ bail:
-       return ret;
- }
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
- 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,
-       ret = mount_single(fs_type, flags, data, qibfs_fill_super);
-       if (!IS_ERR(ret))
-               qib_super = ret->d_sb;
-+#else
-+static int qibfs_get_sb(struct file_system_type *fs_type, int flags,
-+                      const char *dev_name, void *data, struct vfsmount *mnt)
-+{
-+      int ret = get_sb_single(fs_type, flags, data,
-+                                      qibfs_fill_super, mnt);
-+      if (ret >= 0)
-+              qib_super = mnt->mnt_sb;
-+#endif
-       return ret;
- }
-@@ -600,7 +625,11 @@ int qibfs_remove(struct qib_devdata *dd)
- static struct file_system_type qibfs_fs_type = {
-       .owner =        THIS_MODULE,
-       .name =         "ipathfs",
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
-       .mount =        qibfs_mount,
-+#else
-+      .get_sb =        qibfs_get_sb,
-+#endif
-       .kill_sb =      qibfs_kill_super,
- };
diff --git a/patches/0010-IB-qib-backport-qib_fs.c-before-2.6.35.patch b/patches/0010-IB-qib-backport-qib_fs.c-before-2.6.35.patch
new file mode 100644 (file)
index 0000000..9a124d2
--- /dev/null
@@ -0,0 +1,91 @@
+From 62a485e26214924a1e2f4611460113c3f584038e Mon Sep 17 00:00:00 2001
+From: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Date: Thu, 2 Aug 2012 18:11:27 +0300
+Subject: [PATCH 10/19] IB/qib: backport qib_fs.c before 2.6.35
+
+Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+---
+ drivers/infiniband/hw/qib/qib_fs.c |   29 +++++++++++++++++++++++++++++
+ 1 files changed, 29 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
+index 05e0f17..4ea3926 100644
+--- 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,
+               goto bail;
+       }
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
+       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)
+               goto bail;
+       }
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
++      spin_lock(&dcache_lock);
++#endif
+       spin_lock(&tmp->d_lock);
+       if (!(d_unhashed(tmp) && tmp->d_inode)) {
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
++              dget_locked(tmp);
++#else
+               dget_dlock(tmp);
++#endif
+               __d_drop(tmp);
+               spin_unlock(&tmp->d_lock);
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
++              spin_unlock(&dcache_lock);
++#endif
+               simple_unlink(parent->d_inode, tmp);
+       } else {
+               spin_unlock(&tmp->d_lock);
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
++              spin_unlock(&dcache_lock);
++#endif
+       }
+       ret = 0;
+@@ -552,6 +567,7 @@ bail:
+       return ret;
+ }
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
+ 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,
+       ret = mount_single(fs_type, flags, data, qibfs_fill_super);
+       if (!IS_ERR(ret))
+               qib_super = ret->d_sb;
++#else
++static int qibfs_get_sb(struct file_system_type *fs_type, int flags,
++                      const char *dev_name, void *data, struct vfsmount *mnt)
++{
++      int ret = get_sb_single(fs_type, flags, data,
++                                      qibfs_fill_super, mnt);
++      if (ret >= 0)
++              qib_super = mnt->mnt_sb;
++#endif
+       return ret;
+ }
+@@ -600,7 +625,11 @@ int qibfs_remove(struct qib_devdata *dd)
+ static struct file_system_type qibfs_fs_type = {
+       .owner =        THIS_MODULE,
+       .name =         "ipathfs",
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
+       .mount =        qibfs_mount,
++#else
++      .get_sb =        qibfs_get_sb,
++#endif
+       .kill_sb =      qibfs_kill_super,
+ };
+-- 
+1.7.0.4
+
diff --git a/patches/0010-cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch b/patches/0010-cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch
deleted file mode 100644 (file)
index 0fe9490..0000000
+++ /dev/null
@@ -1,636 +0,0 @@
-From 309e01c042f77e96dbd705178f43235ec6a23cbf Mon Sep 17 00:00:00 2001
-From: Vipul Pandya <root@silicon.(none)>
-Date: Mon, 30 Jul 2012 19:08:37 +0530
-Subject: [PATCH] cxgb3: Backports for RHEL6.2 RHEL6.3 and SLES11 SP2
-
-Signed-off-by: Vipul Pandya <vipul@chelsio.com>
----
- drivers/net/ethernet/chelsio/cxgb3/adapter.h       |   19 +++
- drivers/net/ethernet/chelsio/cxgb3/common.h        |    3 +
- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c    |  165 +++++++++++++++++++-
- drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c |   25 +++
- drivers/net/ethernet/chelsio/cxgb3/l2t.c           |    4 +
- drivers/net/ethernet/chelsio/cxgb3/sge.c           |   49 ++++++
- drivers/net/ethernet/chelsio/cxgb3/xgmac.c         |   17 ++-
- 7 files changed, 280 insertions(+), 2 deletions(-)
-
-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 <asm/io.h>
-+#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 df01b63..9ef8b57 100644
---- a/drivers/net/ethernet/chelsio/cxgb3/common.h
-+++ b/drivers/net/ethernet/chelsio/cxgb3/common.h
-@@ -317,6 +317,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 abb6ce7..a4c4f6a 100644
---- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
-+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
-@@ -643,6 +643,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
-@@ -665,6 +687,9 @@ static int setup_sge_qsets(struct adapter *adap)
-               pi->qs = &adap->sge.qs[pi->first_qset];
-               for (j = 0; j < pi->nqsets; ++j, ++qset_idx) {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+                      set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO);
-+#endif
-                       err = t3_sge_alloc_qset(adap, qset_idx, 1,
-                               (adap->flags & USING_MSIX) ? qset_idx + 1 :
-                                                            irq_idx,
-@@ -1170,6 +1195,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);
-@@ -1190,6 +1216,26 @@ 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
-@@ -1203,7 +1249,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);
-@@ -1240,8 +1289,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))
-@@ -1383,7 +1434,9 @@ out:
- static int offload_close(struct t3cdev *tdev)
- {
-       struct adapter *adapter = tdev2adap(tdev);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
-       struct t3c_data *td = T3C_DATA(tdev);
-+#endif
-       if (!test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map))
-               return 0;
-@@ -1394,7 +1447,11 @@ static int offload_close(struct t3cdev *tdev)
-       sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group);
-       /* Flush work scheduled while releasing TIDs */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
-       flush_work_sync(&td->tid_release_task);
-+#else
-+      flush_scheduled_work();
-+#endif
-       tdev->lldev = NULL;
-       cxgb3_set_dummy_ops(tdev);
-@@ -1771,6 +1828,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)
- {
-@@ -1793,6 +1851,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)
- {
-@@ -1934,6 +2014,31 @@ static int set_pauseparam(struct net_device *dev,
-       return 0;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+static u32 get_rx_csum(struct net_device *dev)
-+{
-+      struct port_info *p = netdev_priv(dev);
-+
-+      return p->rx_offload & T3_RX_CSUM;
-+}
-+
-+static int set_rx_csum(struct net_device *dev, u32 data)
-+{
-+      struct port_info *p = netdev_priv(dev);
-+
-+      if (data) {
-+              p->rx_offload |= T3_RX_CSUM;
-+      } else {
-+              int i;
-+
-+              p->rx_offload &= ~(T3_RX_CSUM | T3_LRO);
-+              for (i = p->first_qset; i < p->first_qset + p->nqsets; i++)
-+                      set_qset_lro(dev, i, 0);
-+      }
-+      return 0;
-+}
-+#endif
-+
- static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
- {
-       struct port_info *pi = netdev_priv(dev);
-@@ -2104,15 +2209,28 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
-       .set_eeprom = set_eeprom,
-       .get_pauseparam = get_pauseparam,
-       .set_pauseparam = set_pauseparam,
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+      .get_rx_csum = get_rx_csum,
-+      .set_rx_csum = set_rx_csum,
-+      .set_tx_csum = ethtool_op_set_tx_csum,
-+      .set_sg = ethtool_op_set_sg,
-+#endif
-       .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,
-       .get_regs_len = get_regs_len,
-       .get_regs = get_regs,
-       .get_wol = get_wol,
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+      .set_tso = ethtool_op_set_tso,
-+#endif
- };
- static int in_range(int val, int lo, int hi)
-@@ -2160,6 +2278,17 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
-                             MAX_RSPQ_ENTRIES))
-                       return -EINVAL;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+              if ((adapter->flags & FULL_INIT_DONE) && t.lro > 0)
-+                      for_each_port(adapter, i) {
-+                              pi = adap2pinfo(adapter, i);
-+                              if (t.qset_idx >= pi->first_qset &&
-+                                  t.qset_idx < pi->first_qset + pi->nqsets &&
-+                                  !(pi->rx_offload & T3_RX_CSUM))
-+                                      return -EINVAL;
-+                      }
-+#endif
-+
-               if ((adapter->flags & FULL_INIT_DONE) &&
-                       (t.rspq_size >= 0 || t.fl_size[0] >= 0 ||
-                       t.fl_size[1] >= 0 || t.txq_size[0] >= 0 ||
-@@ -2221,6 +2350,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;
-@@ -2228,6 +2358,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;
-       }
-@@ -2261,7 +2395,11 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
-               t.fl_size[0] = q->fl_size;
-               t.fl_size[1] = q->jumbo_size;
-               t.polling = q->polling;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
-               t.lro = !!(dev->features & NETIF_F_GRO);
-+#else
-+              t.lro = q->lro;
-+#endif
-               t.intr_lat = q->coalesce_usecs;
-               t.cong_thres = q->cong_thres;
-               t.qnum = q1;
-@@ -2553,6 +2691,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)
- {
-@@ -2577,6 +2716,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)
-@@ -3158,8 +3298,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
-@@ -3285,17 +3429,36 @@ static int __devinit init_one(struct pci_dev *pdev,
-               adapter->port[i] = netdev;
-               pi = netdev_priv(netdev);
-               pi->adapter = adapter;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+              pi->rx_offload = T3_RX_CSUM | T3_LRO;
-+#endif
-               pi->port_id = i;
-               netif_carrier_off(netdev);
-               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;
-+              netdev->features |= netdev->hw_features |
-+                      NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-+
-+#else
-               netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
-                       NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX;
-               netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_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) */
-               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 65e4b28..0dd8f2f 100644
---- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
-+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
-@@ -177,13 +177,26 @@ 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)) {
-                       if (vlan && vlan != VLAN_VID_MASK) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
-                               rcu_read_lock();
-                               dev = __vlan_find_dev_deep(dev, vlan);
-                               rcu_read_unlock();
-+#else
-+                              grp = p->vlan_grp;
-+                              dev = NULL;
-+                              if (grp)
-+                                      dev = vlan_group_get_device(grp, vlan);
-+#endif
-                       } else if (netif_is_bond_slave(dev)) {
-                               while (dev->master)
-                                       dev = dev->master;
-@@ -969,7 +982,11 @@ static int nb_callback(struct notifier_block *self, unsigned long event,
-       case (NETEVENT_REDIRECT):{
-               struct netevent_redirect *nr = ctx;
-               cxgb_redirect(nr->old, nr->new);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
-               cxgb_neigh_update(dst_get_neighbour_noref(nr->new));
-+#else
-+              cxgb_neigh_update(dst_get_neighbour(nr->new));
-+#endif
-               break;
-       }
-       default:
-@@ -1118,12 +1135,20 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
-       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;
-diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.c b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
-index 3fa3c88..4206b33 100644
---- a/drivers/net/ethernet/chelsio/cxgb3/l2t.c
-+++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
-@@ -311,7 +311,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, 3, 0)
-       neigh = dst_get_neighbour_noref(dst);
-+#else
-+      neigh = dst_get_neighbour(dst);
-+#endif
-       if (!neigh)
-               goto done_rcu;
-diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
-index cfb60e1..2684f32 100644
---- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
-+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
-@@ -2020,7 +2020,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;
-@@ -2028,11 +2032,37 @@ 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, 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 {
-@@ -2104,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]++;
-@@ -2130,8 +2164,19 @@ 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)
-               __vlan_hwaccel_put_tag(skb, 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);
- }
-@@ -2263,8 +2308,12 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs,
-       q->next_holdoff = q->holdoff_tmr;
-       while (likely(budget_left && is_new_response(r, q))) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
-               int packet_complete, eth, ethpad = 2;
-               int lro = !!(qs->netdev->features & NETIF_F_GRO);
-+#else
-+              int packet_complete, eth, ethpad = 2, lro = qs->lro_enabled;
-+#endif
-               struct sk_buff *skb = NULL;
-               u32 len, flags;
-               __be32 rss_hi, rss_lo;
-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
--- 
-1.7.1
-
diff --git a/patches/0010-qib-pinned-vm.patch b/patches/0010-qib-pinned-vm.patch
deleted file mode 100644 (file)
index ef850c2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-IB/qib: backport < 3.2 for pinned_vm field
-
-Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
-
-diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c
-index 2bc1d2b..80d6ea5 100644
---- a/drivers/infiniband/hw/qib/qib_user_pages.c
-+++ b/drivers/infiniband/hw/qib/qib_user_pages.c
-@@ -74,7 +74,11 @@ static int __qib_get_user_pages(unsigned long start_page, size_t num_pages,
-                       goto bail_release;
-       }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       current->mm->pinned_vm += num_pages;
-+#else
-+      current->mm->locked_vm += num_pages;
-+#endif
-       ret = 0;
-       goto bail;
-@@ -151,7 +155,11 @@ void qib_release_user_pages(struct page **p, size_t num_pages)
-       __qib_release_user_pages(p, num_pages, 1);
-       if (current->mm) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               current->mm->pinned_vm -= num_pages;
-+#else
-+              current->mm->locked_vm -= num_pages;
-+#endif
-               up_write(&current->mm->mmap_sem);
-       }
- }
diff --git a/patches/0011-cxgb3-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch b/patches/0011-cxgb3-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch
new file mode 100644 (file)
index 0000000..22e936c
--- /dev/null
@@ -0,0 +1,636 @@
+From 1e960f512bff5b850142ff281598bdca4333fae4 Mon Sep 17 00:00:00 2001
+From: Vipul Pandya <root@silicon.(none)>
+Date: Mon, 30 Jul 2012 19:08:37 +0530
+Subject: [PATCH 11/19] cxgb3: Backports for RHEL6.2 RHEL6.3 and SLES11 SP2
+
+Signed-off-by: Vipul Pandya <vipul@chelsio.com>
+---
+ drivers/net/ethernet/chelsio/cxgb3/adapter.h       |   19 +++
+ drivers/net/ethernet/chelsio/cxgb3/common.h        |    3 +
+ drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c    |  165 +++++++++++++++++++-
+ drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c |   25 +++
+ drivers/net/ethernet/chelsio/cxgb3/l2t.c           |    4 +
+ drivers/net/ethernet/chelsio/cxgb3/sge.c           |   49 ++++++
+ drivers/net/ethernet/chelsio/cxgb3/xgmac.c         |   17 ++-
+ 7 files changed, 280 insertions(+), 2 deletions(-)
+
+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 <asm/io.h>
++#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 df01b63..9ef8b57 100644
+--- a/drivers/net/ethernet/chelsio/cxgb3/common.h
++++ b/drivers/net/ethernet/chelsio/cxgb3/common.h
+@@ -317,6 +317,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 abb6ce7..f800119 100644
+--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+@@ -643,6 +643,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
+@@ -665,6 +687,9 @@ static int setup_sge_qsets(struct adapter *adap)
+               pi->qs = &adap->sge.qs[pi->first_qset];
+               for (j = 0; j < pi->nqsets; ++j, ++qset_idx) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++                      set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO);
++#endif
+                       err = t3_sge_alloc_qset(adap, qset_idx, 1,
+                               (adap->flags & USING_MSIX) ? qset_idx + 1 :
+                                                            irq_idx,
+@@ -1170,6 +1195,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);
+@@ -1190,6 +1216,26 @@ 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
+@@ -1203,7 +1249,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);
+@@ -1240,8 +1289,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))
+@@ -1383,7 +1434,9 @@ out:
+ static int offload_close(struct t3cdev *tdev)
+ {
+       struct adapter *adapter = tdev2adap(tdev);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
+       struct t3c_data *td = T3C_DATA(tdev);
++#endif
+       if (!test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map))
+               return 0;
+@@ -1394,7 +1447,11 @@ static int offload_close(struct t3cdev *tdev)
+       sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group);
+       /* Flush work scheduled while releasing TIDs */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
+       flush_work_sync(&td->tid_release_task);
++#else
++      flush_scheduled_work();
++#endif
+       tdev->lldev = NULL;
+       cxgb3_set_dummy_ops(tdev);
+@@ -1771,6 +1828,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)
+ {
+@@ -1793,6 +1851,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)
+ {
+@@ -1934,6 +2014,31 @@ static int set_pauseparam(struct net_device *dev,
+       return 0;
+ }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++static u32 get_rx_csum(struct net_device *dev)
++{
++      struct port_info *p = netdev_priv(dev);
++
++      return p->rx_offload & T3_RX_CSUM;
++}
++
++static int set_rx_csum(struct net_device *dev, u32 data)
++{
++      struct port_info *p = netdev_priv(dev);
++
++      if (data) {
++              p->rx_offload |= T3_RX_CSUM;
++      } else {
++              int i;
++
++              p->rx_offload &= ~(T3_RX_CSUM | T3_LRO);
++              for (i = p->first_qset; i < p->first_qset + p->nqsets; i++)
++                      set_qset_lro(dev, i, 0);
++      }
++      return 0;
++}
++#endif
++
+ static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
+ {
+       struct port_info *pi = netdev_priv(dev);
+@@ -2104,15 +2209,28 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
+       .set_eeprom = set_eeprom,
+       .get_pauseparam = get_pauseparam,
+       .set_pauseparam = set_pauseparam,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++      .get_rx_csum = get_rx_csum,
++      .set_rx_csum = set_rx_csum,
++      .set_tx_csum = ethtool_op_set_tx_csum,
++      .set_sg = ethtool_op_set_sg,
++#endif
+       .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,
+       .get_regs_len = get_regs_len,
+       .get_regs = get_regs,
+       .get_wol = get_wol,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++      .set_tso = ethtool_op_set_tso,
++#endif
+ };
+ static int in_range(int val, int lo, int hi)
+@@ -2160,6 +2278,17 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
+                             MAX_RSPQ_ENTRIES))
+                       return -EINVAL;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++              if ((adapter->flags & FULL_INIT_DONE) && t.lro > 0)
++                      for_each_port(adapter, i) {
++                              pi = adap2pinfo(adapter, i);
++                              if (t.qset_idx >= pi->first_qset &&
++                                  t.qset_idx < pi->first_qset + pi->nqsets &&
++                                  !(pi->rx_offload & T3_RX_CSUM))
++                                      return -EINVAL;
++                      }
++#endif
++
+               if ((adapter->flags & FULL_INIT_DONE) &&
+                       (t.rspq_size >= 0 || t.fl_size[0] >= 0 ||
+                       t.fl_size[1] >= 0 || t.txq_size[0] >= 0 ||
+@@ -2221,6 +2350,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;
+@@ -2228,6 +2358,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;
+       }
+@@ -2261,7 +2395,11 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
+               t.fl_size[0] = q->fl_size;
+               t.fl_size[1] = q->jumbo_size;
+               t.polling = q->polling;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+               t.lro = !!(dev->features & NETIF_F_GRO);
++#else
++              t.lro = q->lro;
++#endif
+               t.intr_lat = q->coalesce_usecs;
+               t.cong_thres = q->cong_thres;
+               t.qnum = q1;
+@@ -2553,6 +2691,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)
+ {
+@@ -2577,6 +2716,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)
+@@ -3158,8 +3298,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
+@@ -3285,17 +3429,36 @@ static int __devinit init_one(struct pci_dev *pdev,
+               adapter->port[i] = netdev;
+               pi = netdev_priv(netdev);
+               pi->adapter = adapter;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++              pi->rx_offload = T3_RX_CSUM | T3_LRO;
++#endif
+               pi->port_id = i;
+               netif_carrier_off(netdev);
+               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;
++              netdev->features |= netdev->hw_features |
++                      NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
++
++#else
+               netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
+                       NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX;
+               netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_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) */
+               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 65e4b28..0dd8f2f 100644
+--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
+@@ -177,13 +177,26 @@ 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)) {
+                       if (vlan && vlan != VLAN_VID_MASK) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+                               rcu_read_lock();
+                               dev = __vlan_find_dev_deep(dev, vlan);
+                               rcu_read_unlock();
++#else
++                              grp = p->vlan_grp;
++                              dev = NULL;
++                              if (grp)
++                                      dev = vlan_group_get_device(grp, vlan);
++#endif
+                       } else if (netif_is_bond_slave(dev)) {
+                               while (dev->master)
+                                       dev = dev->master;
+@@ -969,7 +982,11 @@ static int nb_callback(struct notifier_block *self, unsigned long event,
+       case (NETEVENT_REDIRECT):{
+               struct netevent_redirect *nr = ctx;
+               cxgb_redirect(nr->old, nr->new);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
+               cxgb_neigh_update(dst_get_neighbour_noref(nr->new));
++#else
++              cxgb_neigh_update(dst_get_neighbour(nr->new));
++#endif
+               break;
+       }
+       default:
+@@ -1118,12 +1135,20 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
+       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;
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.c b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
+index 3fa3c88..4206b33 100644
+--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
+@@ -311,7 +311,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, 3, 0)
+       neigh = dst_get_neighbour_noref(dst);
++#else
++      neigh = dst_get_neighbour(dst);
++#endif
+       if (!neigh)
+               goto done_rcu;
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
+index cfb60e1..6be199f 100644
+--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
+@@ -2020,7 +2020,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;
+@@ -2028,11 +2032,37 @@ 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, 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 {
+@@ -2104,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]++;
+@@ -2130,8 +2164,19 @@ 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)
+               __vlan_hwaccel_put_tag(skb, 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);
+ }
+@@ -2263,8 +2308,12 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs,
+       q->next_holdoff = q->holdoff_tmr;
+       while (likely(budget_left && is_new_response(r, q))) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+               int packet_complete, eth, ethpad = 2;
+               int lro = !!(qs->netdev->features & NETIF_F_GRO);
++#else
++              int packet_complete, eth, ethpad = 2, lro = qs->lro_enabled;
++#endif
+               struct sk_buff *skb = NULL;
+               u32 len, flags;
+               __be32 rss_hi, rss_lo;
+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
+-- 
+1.7.0.4
+
diff --git a/patches/0011-cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch b/patches/0011-cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch
deleted file mode 100644 (file)
index 2f5f8c5..0000000
+++ /dev/null
@@ -1,598 +0,0 @@
-From 867d62561a8a95e35469b72b4c82589524e069b3 Mon Sep 17 00:00:00 2001
-From: Vipul Pandya <vipul@chelsio.com>
-Date: Mon, 30 Jul 2012 12:06:12 +0530
-Subject: [PATCH 1/4] cxgb4: Backports for RHEL6.2 RHEL 6.3 and SLES11 SP2
-
-Signed-off-by: Vipul Pandya <vipul@chelsio.com>
----
- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      |   13 ++
- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |  190 ++++++++++++++++++++++-
- drivers/net/ethernet/chelsio/cxgb4/sge.c        |   72 +++++++++-
- 3 files changed, 273 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
-index ec2dafe..84fa932 100644
---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
-+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
-@@ -300,6 +300,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;
-@@ -307,6 +310,12 @@ 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;
-@@ -337,7 +346,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 e1f96fb..12a0dba 100644
---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
-+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
-@@ -31,7 +31,9 @@
-  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  * SOFTWARE.
-  */
--
-+#ifdef pr_fmt
-+#undef pr_fmt
-+#endif
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
- #include <linux/bitmap.h>
-@@ -324,14 +326,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,
-@@ -345,9 +358,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)
-@@ -1537,6 +1556,26 @@ static int set_pauseparam(struct net_device *dev,
-       return 0;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+static u32 get_rx_csum(struct net_device *dev)
-+{
-+      struct port_info *p = netdev_priv(dev);
-+
-+      return p->rx_offload & RX_CSO;
-+}
-+
-+static int set_rx_csum(struct net_device *dev, u32 data)
-+{
-+      struct port_info *p = netdev_priv(dev);
-+
-+      if (data)
-+              p->rx_offload |= RX_CSO;
-+      else
-+              p->rx_offload &= ~RX_CSO;
-+      return 0;
-+}
-+#endif
-+
- static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
- {
-       const struct port_info *pi = netdev_priv(dev);
-@@ -1858,10 +1897,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_RX))
-@@ -1874,14 +1922,55 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features)
-               dev->features = features ^ NETIF_F_HW_VLAN_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);
-@@ -1903,6 +1992,7 @@ 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,
-                    u32 *rules)
-@@ -1982,9 +2072,19 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
-       .set_eeprom        = set_eeprom,
-       .get_pauseparam    = get_pauseparam,
-       .set_pauseparam    = set_pauseparam,
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+      .get_rx_csum       = get_rx_csum,
-+      .set_rx_csum       = set_rx_csum,
-+      .set_tx_csum       = ethtool_op_set_tx_ipv6_csum,
-+      .set_sg            = ethtool_op_set_sg,
-+#endif
-       .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,
-@@ -1992,10 +2092,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,
- };
-@@ -2902,6 +3010,7 @@ static int cxgb_close(struct net_device *dev)
-       return t4_enable_vi(adapter, adapter->fn, pi->viid, false, false);
- }
-+#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)
- {
-@@ -2943,6 +3052,49 @@ 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)
- {
-@@ -3043,10 +3195,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,
-@@ -3650,7 +3808,11 @@ static int __devinit 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;
- }
-@@ -3729,7 +3891,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)
-@@ -3738,7 +3902,11 @@ static int __devinit init_one(struct pci_dev *pdev,
- {
-       int func, i, err;
-       struct port_info *pi;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
-       bool highdma = false;
-+#else
-+      unsigned int highdma = 0;
-+#endif
-       struct adapter *adapter = NULL;
-       printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION);
-@@ -3764,7 +3932,11 @@ static int __devinit init_one(struct pci_dev *pdev,
-       }
-       if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
-               highdma = true;
-+#else
-+              highdma = NETIF_F_HIGHDMA;
-+#endif
-               err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-               if (err) {
-                       dev_err(&pdev->dev, "unable to obtain 64-bit DMA for "
-@@ -3834,19 +4006,35 @@ static int __devinit init_one(struct pci_dev *pdev,
-               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_TX | NETIF_F_HW_VLAN_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 e111d97..e25544f 100644
---- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
-+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
-@@ -216,8 +216,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;
-       }
-@@ -1415,9 +1420,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 */
-@@ -1429,9 +1439,24 @@ static inline void copy_frags(struct sk_buff *skb,
-               __skb_fill_page_desc(skb, i, gl->frags[i].page,
-                                    gl->frags[i].offset,
-                                    gl->frags[i].size);
--
-       /* 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
- }
- /**
-@@ -1466,7 +1491,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;
-@@ -1485,7 +1514,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);
-@@ -1529,7 +1562,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, RX_PKT_PAD);
-+#else
-+      copy_frags(skb_shinfo(skb), gl, RX_PKT_PAD);
-+#endif
-       skb->len = gl->tot_len - RX_PKT_PAD;
-       skb->data_len = skb->len;
-       skb->truesize += skb->data_len;
-@@ -1564,6 +1601,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
- {
-       bool csum_ok;
-       struct sk_buff *skb;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
-+      struct port_info *pi;
-+#endif
-       const struct cpl_rx_pkt *pkt;
-       struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);
-@@ -1591,9 +1631,16 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
-       if (skb->dev->features & NETIF_F_RXHASH)
-               skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 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 +1752,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;
-@@ -1724,9 +1775,15 @@ static int process_responses(struct sge_rspq *q, int budget)
-                               rsd = &rxq->fl.sdesc[rxq->fl.cidx];
-                               bufsz = get_buf_size(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);
-@@ -1738,16 +1795,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, 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)) {
--- 
-1.7.1
-
diff --git a/patches/0011-ipath-fs-backport.patch b/patches/0011-ipath-fs-backport.patch
deleted file mode 100644 (file)
index 2945b73..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-IB/ipath: backport qib_fs.c before 2.6.35
-
-Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
-
-diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
-index a4de9d5..5ec9c66 100644
---- a/drivers/infiniband/hw/ipath/ipath_fs.c
-+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
-@@ -57,7 +57,9 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
-               goto bail;
-       }
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
-       inode->i_ino = get_next_ino();
-+#endif
-       inode->i_mode = mode;
-       inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-       inode->i_private = data;
-@@ -277,11 +279,21 @@ static int remove_file(struct dentry *parent, char *name)
-               goto bail;
-       }
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
-+      spin_lock(&dcache_lock);
-+#endif
-       spin_lock(&tmp->d_lock);
-       if (!(d_unhashed(tmp) && tmp->d_inode)) {
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
-+              dget_locked(tmp);
-+#else
-               dget_dlock(tmp);
-+#endif
-               __d_drop(tmp);
-               spin_unlock(&tmp->d_lock);
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
-+              spin_unlock(&dcache_lock);
-+#endif
-               simple_unlink(parent->d_inode, tmp);
-       } else
-               spin_unlock(&tmp->d_lock);
-@@ -358,6 +370,7 @@ bail:
-       return ret;
- }
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
- static struct dentry *ipathfs_mount(struct file_system_type *fs_type,
-                       int flags, const char *dev_name, void *data)
- {
-@@ -365,6 +378,15 @@ static struct dentry *ipathfs_mount(struct file_system_type *fs_type,
-       ret = mount_single(fs_type, flags, data, ipathfs_fill_super);
-       if (!IS_ERR(ret))
-               ipath_super = ret->d_sb;
-+#else
-+static int ipathfs_get_sb(struct file_system_type *fs_type, int flags,
-+                      const char *dev_name, void *data, struct vfsmount *mnt)
-+{
-+      int ret = get_sb_single(fs_type, flags, data,
-+                                      ipathfs_fill_super, mnt);
-+      if (ret >= 0)
-+              ipath_super = mnt->mnt_sb;
-+#endif
-       return ret;
- }
-@@ -407,7 +429,11 @@ bail:
- static struct file_system_type ipathfs_fs_type = {
-       .owner =        THIS_MODULE,
-       .name =         "ipathfs",
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
-       .mount =        ipathfs_mount,
-+#else
-+      .get_sb =   ipathfs_get_sb,
-+#endif
-       .kill_sb =      ipathfs_kill_super,
- };
diff --git a/patches/0012-IB-qib-backport-3.2-for-pinned_vm-field.patch b/patches/0012-IB-qib-backport-3.2-for-pinned_vm-field.patch
new file mode 100644 (file)
index 0000000..34fbcc8
--- /dev/null
@@ -0,0 +1,41 @@
+From 7996c9a696ae6954721ce66a8ab300c9df8b7f2e Mon Sep 17 00:00:00 2001
+From: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Date: Thu, 2 Aug 2012 18:11:27 +0300
+Subject: [PATCH 12/19] IB/qib: backport < 3.2 for pinned_vm field
+
+Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+---
+ drivers/infiniband/hw/qib/qib_user_pages.c |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c
+index 2bc1d2b..80d6ea5 100644
+--- a/drivers/infiniband/hw/qib/qib_user_pages.c
++++ b/drivers/infiniband/hw/qib/qib_user_pages.c
+@@ -74,7 +74,11 @@ static int __qib_get_user_pages(unsigned long start_page, size_t num_pages,
+                       goto bail_release;
+       }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+       current->mm->pinned_vm += num_pages;
++#else
++      current->mm->locked_vm += num_pages;
++#endif
+       ret = 0;
+       goto bail;
+@@ -151,7 +155,11 @@ void qib_release_user_pages(struct page **p, size_t num_pages)
+       __qib_release_user_pages(p, num_pages, 1);
+       if (current->mm) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+               current->mm->pinned_vm -= num_pages;
++#else
++              current->mm->locked_vm -= num_pages;
++#endif
+               up_write(&current->mm->mmap_sem);
+       }
+ }
+-- 
+1.7.0.4
+
diff --git a/patches/0012-ipath-pinned-vm.patch b/patches/0012-ipath-pinned-vm.patch
deleted file mode 100644 (file)
index 17d62ee..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-IB/ipath: backport < 3.2 for pinned_vm field
-
-Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
-
-diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c
-index dc66c45..f2858e6 100644
---- a/drivers/infiniband/hw/ipath/ipath_user_pages.c
-+++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c
-@@ -79,7 +79,11 @@ static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages,
-                       goto bail_release;
-       }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       current->mm->pinned_vm += num_pages;
-+#else
-+      current->mm->locked_vm += num_pages;
-+#endif
-       ret = 0;
-       goto bail;
-@@ -178,7 +182,11 @@ void ipath_release_user_pages(struct page **p, size_t num_pages)
-       __ipath_release_user_pages(p, num_pages, 1);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       current->mm->pinned_vm -= num_pages;
-+#else
-+      current->mm->locked_vm -= num_pages;
-+#endif
-       up_write(&current->mm->mmap_sem);
- }
-@@ -195,7 +203,11 @@ static void user_pages_account(struct work_struct *_work)
-               container_of(_work, struct ipath_user_pages_work, work);
-       down_write(&work->mm->mmap_sem);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       work->mm->pinned_vm -= work->num_pages;
-+#else
-+      work->mm->locked_vm -= work->num_pages;
-+#endif
-       up_write(&work->mm->mmap_sem);
-       mmput(work->mm);
-       kfree(work);
diff --git a/patches/0012-iw_cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch b/patches/0012-iw_cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch
deleted file mode 100644 (file)
index 249b410..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-From 822db87429e1fe56599a65ed355359362c4d5804 Mon Sep 17 00:00:00 2001
-From: Vipul Pandya <vipul@chelsio.com>
-Date: Mon, 30 Jul 2012 12:38:36 +0530
-Subject: [PATCH 3/4] iw_cxgb3: Backports for RHEL6.2 RHEL 6.3 and SLES11 SP2
-
-Signed-off-by: Vipul Pandya <vipul@chelsio.com>
----
- drivers/infiniband/hw/cxgb3/iwch_cm.c |   29 +++++++++++++++++++++++++++++
- 1 files changed, 29 insertions(+), 0 deletions(-)
-
-diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
-index 740dcc0..07bef67 100644
---- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
-+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
-@@ -338,12 +338,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;
- }
-@@ -1373,7 +1394,11 @@ 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
-       l2t = t3_l2t_get(tdev, dst, NULL);
-       if (!l2t) {
-               printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n",
-@@ -1941,7 +1966,11 @@ 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
-       ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL);
-       if (!ep->l2t) {
-               printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__);
--- 
-1.7.1
-
diff --git a/patches/0013-cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch b/patches/0013-cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-SP2.patch
new file mode 100644 (file)
index 0000000..5cfa4a2
--- /dev/null
@@ -0,0 +1,598 @@
+From b316d1c7c58e9a499efd68a4072d7e566b50d733 Mon Sep 17 00:00:00 2001
+From: Vipul Pandya <vipul@chelsio.com>
+Date: Mon, 30 Jul 2012 12:06:12 +0530
+Subject: [PATCH 13/19] cxgb4: Backports for RHEL6.2 RHEL 6.3 and SLES11 SP2
+
+Signed-off-by: Vipul Pandya <vipul@chelsio.com>
+---
+ drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      |   13 ++
+ drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |  190 ++++++++++++++++++++++-
+ drivers/net/ethernet/chelsio/cxgb4/sge.c        |   72 +++++++++-
+ 3 files changed, 273 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+index ec2dafe..84fa932 100644
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+@@ -300,6 +300,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;
+@@ -307,6 +310,12 @@ 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;
+@@ -337,7 +346,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 e1f96fb..ec57e1c 100644
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+@@ -31,7 +31,9 @@
+  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  * SOFTWARE.
+  */
+-
++#ifdef pr_fmt
++#undef pr_fmt
++#endif
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/bitmap.h>
+@@ -324,14 +326,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,
+@@ -345,9 +358,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)
+@@ -1537,6 +1556,26 @@ static int set_pauseparam(struct net_device *dev,
+       return 0;
+ }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++static u32 get_rx_csum(struct net_device *dev)
++{
++      struct port_info *p = netdev_priv(dev);
++
++      return p->rx_offload & RX_CSO;
++}
++
++static int set_rx_csum(struct net_device *dev, u32 data)
++{
++      struct port_info *p = netdev_priv(dev);
++
++      if (data)
++              p->rx_offload |= RX_CSO;
++      else
++              p->rx_offload &= ~RX_CSO;
++      return 0;
++}
++#endif
++
+ static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
+ {
+       const struct port_info *pi = netdev_priv(dev);
+@@ -1858,10 +1897,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_RX))
+@@ -1874,14 +1922,55 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features)
+               dev->features = features ^ NETIF_F_HW_VLAN_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);
+@@ -1903,6 +1992,7 @@ 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,
+                    u32 *rules)
+@@ -1982,9 +2072,19 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
+       .set_eeprom        = set_eeprom,
+       .get_pauseparam    = get_pauseparam,
+       .set_pauseparam    = set_pauseparam,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++      .get_rx_csum       = get_rx_csum,
++      .set_rx_csum       = set_rx_csum,
++      .set_tx_csum       = ethtool_op_set_tx_ipv6_csum,
++      .set_sg            = ethtool_op_set_sg,
++#endif
+       .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,
+@@ -1992,10 +2092,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,
+ };
+@@ -2902,6 +3010,7 @@ static int cxgb_close(struct net_device *dev)
+       return t4_enable_vi(adapter, adapter->fn, pi->viid, false, false);
+ }
++#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)
+ {
+@@ -2943,6 +3052,49 @@ 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)
+ {
+@@ -3043,10 +3195,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,
+@@ -3650,7 +3808,11 @@ static int __devinit 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;
+ }
+@@ -3729,7 +3891,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)
+@@ -3738,7 +3902,11 @@ static int __devinit init_one(struct pci_dev *pdev,
+ {
+       int func, i, err;
+       struct port_info *pi;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
+       bool highdma = false;
++#else
++      unsigned int highdma = 0;
++#endif
+       struct adapter *adapter = NULL;
+       printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION);
+@@ -3764,7 +3932,11 @@ static int __devinit init_one(struct pci_dev *pdev,
+       }
+       if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
+               highdma = true;
++#else
++              highdma = NETIF_F_HIGHDMA;
++#endif
+               err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+               if (err) {
+                       dev_err(&pdev->dev, "unable to obtain 64-bit DMA for "
+@@ -3834,19 +4006,35 @@ static int __devinit init_one(struct pci_dev *pdev,
+               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_TX | NETIF_F_HW_VLAN_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 e111d97..b97bea7 100644
+--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
+@@ -216,8 +216,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;
+       }
+@@ -1415,9 +1420,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 */
+@@ -1429,9 +1439,24 @@ static inline void copy_frags(struct sk_buff *skb,
+               __skb_fill_page_desc(skb, i, gl->frags[i].page,
+                                    gl->frags[i].offset,
+                                    gl->frags[i].size);
+-
+       /* 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
+ }
+ /**
+@@ -1466,7 +1491,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;
+@@ -1485,7 +1514,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);
+@@ -1529,7 +1562,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, RX_PKT_PAD);
++#else
++      copy_frags(skb_shinfo(skb), gl, RX_PKT_PAD);
++#endif
+       skb->len = gl->tot_len - RX_PKT_PAD;
+       skb->data_len = skb->len;
+       skb->truesize += skb->data_len;
+@@ -1564,6 +1601,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
+ {
+       bool csum_ok;
+       struct sk_buff *skb;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++      struct port_info *pi;
++#endif
+       const struct cpl_rx_pkt *pkt;
+       struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);
+@@ -1591,9 +1631,16 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
+       if (skb->dev->features & NETIF_F_RXHASH)
+               skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 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 +1752,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;
+@@ -1724,9 +1775,15 @@ static int process_responses(struct sge_rspq *q, int budget)
+                               rsd = &rxq->fl.sdesc[rxq->fl.cidx];
+                               bufsz = get_buf_size(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);
+@@ -1738,16 +1795,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, 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)) {
+-- 
+1.7.0.4
+
diff --git a/patches/0013-iw_cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch b/patches/0013-iw_cxgb4-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch
deleted file mode 100644 (file)
index 94b782c..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-From c359992f6044321a92bccf3bc1f69a4356a1782d Mon Sep 17 00:00:00 2001
-From: Vipul Pandya <root@silicon.(none)>
-Date: Mon, 30 Jul 2012 16:59:42 +0530
-Subject: [PATCH] iw_cxgb4: Backports for RHEL6.2 RHEL6.3 and SLES11 SP2
-
-Signed-off-by: Vipul Pandya <root@silicon.(none)>
----
- drivers/infiniband/hw/cxgb4/cm.c       |   45 ++++++++++++++++++++++++++++++++
- drivers/infiniband/hw/cxgb4/cq.c       |   12 ++++++++
- drivers/infiniband/hw/cxgb4/iw_cxgb4.h |    4 +++
- drivers/infiniband/hw/cxgb4/mem.c      |    8 +++++
- drivers/infiniband/hw/cxgb4/qp.c       |   17 +++++++++++-
- drivers/infiniband/hw/cxgb4/t4.h       |   12 ++++++++
- 6 files changed, 97 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
-index b18870c..c1805bd 100644
---- a/drivers/infiniband/hw/cxgb4/cm.c
-+++ b/drivers/infiniband/hw/cxgb4/cm.c
-@@ -316,12 +316,33 @@ static struct rtable *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;
-       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;
- }
-@@ -1583,11 +1604,23 @@ static int import_ep(struct c4iw_ep *ep, __be32 peer_ip, struct dst_entry *dst,
-       struct neighbour *n;
-       int err, step;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
-       n = dst_neigh_lookup(dst, &peer_ip);
-       if (!n)
-               return -ENODEV;
-       rcu_read_lock();
-+#else
-+      rcu_read_lock();
-+#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) {
-               struct net_device *pdev;
-@@ -1676,7 +1709,11 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
-                      __func__);
-               goto reject;
-       }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
-       dst = &rt->dst;
-+#else
-+      dst = &rt->u.dst;
-+#endif
-       child_ep = alloc_ep(sizeof(*child_ep), GFP_KERNEL);
-       if (!child_ep) {
-@@ -1868,7 +1905,11 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
-               err = -EHOSTUNREACH;
-               goto fail3;
-       }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
-       ep->dst = &rt->dst;
-+#else
-+      ep->dst = &rt->u.dst;
-+#endif
-       err = import_ep(ep, ep->com.cm_id->remote_addr.sin_addr.s_addr,
-                       ep->dst, ep->com.dev, false);
-@@ -2311,7 +2352,11 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
-               err = -EHOSTUNREACH;
-               goto fail3;
-       }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
-       ep->dst = &rt->dst;
-+#else
-+      ep->dst = &rt->u.dst;
-+#endif
-       err = import_ep(ep, cm_id->remote_addr.sin_addr.s_addr,
-                       ep->dst, ep->com.dev, true);
-diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
-index 0f1607c..4046852 100644
---- a/drivers/infiniband/hw/cxgb4/cq.c
-+++ b/drivers/infiniband/hw/cxgb4/cq.c
-@@ -70,7 +70,11 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
-       kfree(cq->sw_queue);
-       dma_free_coherent(&(rdev->lldi.pdev->dev),
-                         cq->memsize, cq->queue,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-                         dma_unmap_addr(cq, mapping));
-+#else
-+                        pci_unmap_addr(cq, mapping));
-+#endif
-       c4iw_put_cqid(rdev, cq->cqid, uctx);
-       return ret;
- }
-@@ -105,7 +109,11 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
-               ret = -ENOMEM;
-               goto err3;
-       }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-       dma_unmap_addr_set(cq, mapping, cq->dma_addr);
-+#else
-+      pci_unmap_addr_set(cq, mapping, cq->dma_addr);
-+#endif
-       memset(cq->queue, 0, cq->memsize);
-       /* build fw_ri_res_wr */
-@@ -165,7 +173,11 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
-       return 0;
- err4:
-       dma_free_coherent(&rdev->lldi.pdev->dev, cq->memsize, cq->queue,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-                         dma_unmap_addr(cq, mapping));
-+#else
-+                        pci_unmap_addr(cq, mapping));
-+#endif
- err3:
-       kfree(cq->sw_queue);
- err2:
-diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
-index 9beb3a9..9a9df48 100644
---- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
-+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
-@@ -359,7 +359,11 @@ static inline struct c4iw_mw *to_c4iw_mw(struct ib_mw *ibmw)
- struct c4iw_fr_page_list {
-       struct ib_fast_reg_page_list ibpl;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-       DEFINE_DMA_UNMAP_ADDR(mapping);
-+#else
-+      DECLARE_PCI_UNMAP_ADDR(mapping);
-+#endif
-       dma_addr_t dma_addr;
-       struct c4iw_dev *dev;
-       int size;
-diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
-index 57e07c6..375da95 100644
---- a/drivers/infiniband/hw/cxgb4/mem.c
-+++ b/drivers/infiniband/hw/cxgb4/mem.c
-@@ -764,7 +764,11 @@ struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(struct ib_device *device,
-       if (!c4pl)
-               return ERR_PTR(-ENOMEM);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-       dma_unmap_addr_set(c4pl, mapping, dma_addr);
-+#else
-+      pci_unmap_addr_set(c4pl, mapping, dma_addr);
-+#endif
-       c4pl->dma_addr = dma_addr;
-       c4pl->dev = dev;
-       c4pl->size = size;
-@@ -779,7 +783,11 @@ void c4iw_free_fastreg_pbl(struct ib_fast_reg_page_list *ibpl)
-       struct c4iw_fr_page_list *c4pl = to_c4iw_fr_page_list(ibpl);
-       dma_free_coherent(&c4pl->dev->rdev.lldi.pdev->dev, c4pl->size,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-                         c4pl, dma_unmap_addr(c4pl, mapping));
-+#else
-+                        c4pl, pci_unmap_addr(c4pl, mapping));
-+#endif
- }
- int c4iw_dereg_mr(struct ib_mr *ib_mr)
-diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
-index 45aedf1..e83249c 100644
---- a/drivers/infiniband/hw/cxgb4/qp.c
-+++ b/drivers/infiniband/hw/cxgb4/qp.c
-@@ -109,7 +109,11 @@ static int destroy_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
-        */
-       dma_free_coherent(&(rdev->lldi.pdev->dev),
-                         wq->rq.memsize, wq->rq.queue,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-                         dma_unmap_addr(&wq->rq, mapping));
-+#else
-+                        pci_unmap_addr(&wq->rq, mapping));
-+#endif
-       dealloc_sq(rdev, &wq->sq);
-       c4iw_rqtpool_free(rdev, wq->rq.rqt_hwaddr, wq->rq.rqt_size);
-       kfree(wq->rq.sw_rq);
-@@ -167,7 +171,11 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
-               if (alloc_host_sq(rdev, &wq->sq))
-                       goto err5;
-       memset(wq->sq.queue, 0, wq->sq.memsize);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-       dma_unmap_addr_set(&wq->sq, mapping, wq->sq.dma_addr);
-+#else
-+      pci_unmap_addr_set(&wq->sq, mapping, wq->sq.dma_addr);
-+#endif
-       wq->rq.queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev),
-                                         wq->rq.memsize, &(wq->rq.dma_addr),
-@@ -180,8 +188,11 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
-               wq->rq.queue,
-               (unsigned long long)virt_to_phys(wq->rq.queue));
-       memset(wq->rq.queue, 0, wq->rq.memsize);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-       dma_unmap_addr_set(&wq->rq, mapping, wq->rq.dma_addr);
--
-+#else
-+      pci_unmap_addr_set(&wq->rq, mapping, wq->rq.dma_addr);
-+#endif
-       wq->db = rdev->lldi.db_reg;
-       wq->gts = rdev->lldi.gts_reg;
-       if (user) {
-@@ -279,7 +290,11 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
- err7:
-       dma_free_coherent(&(rdev->lldi.pdev->dev),
-                         wq->rq.memsize, wq->rq.queue,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-                         dma_unmap_addr(&wq->rq, mapping));
-+#else
-+                        pci_unmap_addr(&wq->rq, mapping));
-+#endif
- err6:
-       dealloc_sq(rdev, &wq->sq);
- err5:
-diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h
-index 16f26ab..cafdb7c 100644
---- a/drivers/infiniband/hw/cxgb4/t4.h
-+++ b/drivers/infiniband/hw/cxgb4/t4.h
-@@ -296,7 +296,11 @@ enum {
- struct t4_sq {
-       union t4_wr *queue;
-       dma_addr_t dma_addr;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-       DEFINE_DMA_UNMAP_ADDR(mapping);
-+#else
-+      DECLARE_PCI_UNMAP_ADDR(mapping);
-+#endif
-       unsigned long phys_addr;
-       struct t4_swsqe *sw_sq;
-       struct t4_swsqe *oldest_read;
-@@ -318,7 +322,11 @@ struct t4_swrqe {
- struct t4_rq {
-       union  t4_recv_wr *queue;
-       dma_addr_t dma_addr;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-       DEFINE_DMA_UNMAP_ADDR(mapping);
-+#else
-+      DECLARE_PCI_UNMAP_ADDR(mapping);
-+#endif
-       struct t4_swrqe *sw_rq;
-       u64 udb;
-       size_t memsize;
-@@ -476,7 +484,11 @@ static inline int t4_wq_db_enabled(struct t4_wq *wq)
- struct t4_cq {
-       struct t4_cqe *queue;
-       dma_addr_t dma_addr;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
-       DEFINE_DMA_UNMAP_ADDR(mapping);
-+#else
-+      DECLARE_PCI_UNMAP_ADDR(mapping);
-+#endif
-       struct t4_cqe *sw_queue;
-       void __iomem *gts;
-       struct c4iw_rdev *rdev;
--- 
-1.7.1
-
diff --git a/patches/0014-IB-ipath-backport-qib_fs.c-before-2.6.35.patch b/patches/0014-IB-ipath-backport-qib_fs.c-before-2.6.35.patch
new file mode 100644 (file)
index 0000000..273de3c
--- /dev/null
@@ -0,0 +1,85 @@
+From 6de2e2a1dec734bab9788b2602edcbda1ce34cf2 Mon Sep 17 00:00:00 2001
+From: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Date: Thu, 2 Aug 2012 18:11:27 +0300
+Subject: [PATCH 14/19] IB/ipath: backport qib_fs.c before 2.6.35
+
+Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+---
+ drivers/infiniband/hw/ipath/ipath_fs.c |   26 ++++++++++++++++++++++++++
+ 1 files changed, 26 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
+index a4de9d5..5ec9c66 100644
+--- a/drivers/infiniband/hw/ipath/ipath_fs.c
++++ b/drivers/infiniband/hw/ipath/ipath_fs.c
+@@ -57,7 +57,9 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
+               goto bail;
+       }
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
+       inode->i_ino = get_next_ino();
++#endif
+       inode->i_mode = mode;
+       inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+       inode->i_private = data;
+@@ -277,11 +279,21 @@ static int remove_file(struct dentry *parent, char *name)
+               goto bail;
+       }
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
++      spin_lock(&dcache_lock);
++#endif
+       spin_lock(&tmp->d_lock);
+       if (!(d_unhashed(tmp) && tmp->d_inode)) {
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
++              dget_locked(tmp);
++#else
+               dget_dlock(tmp);
++#endif
+               __d_drop(tmp);
+               spin_unlock(&tmp->d_lock);
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36))
++              spin_unlock(&dcache_lock);
++#endif
+               simple_unlink(parent->d_inode, tmp);
+       } else
+               spin_unlock(&tmp->d_lock);
+@@ -358,6 +370,7 @@ bail:
+       return ret;
+ }
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
+ static struct dentry *ipathfs_mount(struct file_system_type *fs_type,
+                       int flags, const char *dev_name, void *data)
+ {
+@@ -365,6 +378,15 @@ static struct dentry *ipathfs_mount(struct file_system_type *fs_type,
+       ret = mount_single(fs_type, flags, data, ipathfs_fill_super);
+       if (!IS_ERR(ret))
+               ipath_super = ret->d_sb;
++#else
++static int ipathfs_get_sb(struct file_system_type *fs_type, int flags,
++                      const char *dev_name, void *data, struct vfsmount *mnt)
++{
++      int ret = get_sb_single(fs_type, flags, data,
++                                      ipathfs_fill_super, mnt);
++      if (ret >= 0)
++              ipath_super = mnt->mnt_sb;
++#endif
+       return ret;
+ }
+@@ -407,7 +429,11 @@ bail:
+ static struct file_system_type ipathfs_fs_type = {
+       .owner =        THIS_MODULE,
+       .name =         "ipathfs",
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
+       .mount =        ipathfs_mount,
++#else
++      .get_sb =   ipathfs_get_sb,
++#endif
+       .kill_sb =      ipathfs_kill_super,
+ };
+-- 
+1.7.0.4
+
diff --git a/patches/0014-IPoIB-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch b/patches/0014-IPoIB-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch
deleted file mode 100644 (file)
index 5cb54fa..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-From c2ecb52764e5787acd7c0731b613dcfc8c101bfc Mon Sep 17 00:00:00 2001
-From: Vladimir Sokolovsky <vlad@mellanox.com>
-Date: Thu, 2 Aug 2012 16:12:39 +0300
-Subject: [PATCH] IPoIB: Backports for RHEL6.2 RHEL6.3 and SLES11 SP2
-
-Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
----
- drivers/infiniband/ulp/ipoib/ipoib.h           |    3 +++
- drivers/infiniband/ulp/ipoib/ipoib_cm.c        |   21 +++++++++++++++++++++
- drivers/infiniband/ulp/ipoib/ipoib_main.c      |   18 ++++++++++++++++++
- drivers/infiniband/ulp/ipoib/ipoib_multicast.c |   19 +++++++++++++++++++
- 4 files changed, 61 insertions(+), 0 deletions(-)
-
-diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
-index 86df632..a876f24 100644
---- a/drivers/infiniband/ulp/ipoib/ipoib.h
-+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
-@@ -92,6 +92,9 @@ enum {
-       IPOIB_STOP_REAPER         = 7,
-       IPOIB_FLAG_ADMIN_CM       = 9,
-       IPOIB_FLAG_UMCAST         = 10,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+      IPOIB_FLAG_CSUM           = 11,
-+#endif
-       IPOIB_MAX_BACKOFF_SECONDS = 16,
-diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
-index 014504d..b83efdf 100644
---- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
-+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
-@@ -1378,7 +1378,11 @@ static void ipoib_cm_skb_reap(struct work_struct *work)
-                       icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
- #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-               else if (skb->protocol == htons(ETH_P_IPV6))
-+#if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
-                       icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
-+#else
-+                      icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, priv->dev);
-+#endif
- #endif
-               dev_kfree_skb_any(skb);
-@@ -1465,7 +1469,15 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
-               set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
-               ipoib_warn(priv, "enabling connected mode "
-                          "will cause multicast packet drops\n");
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
-               netdev_update_features(dev);
-+#else
-+              dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO);
-+              if (ipoib_cm_max_mtu(dev) > priv->mcast_mtu)
-+                      ipoib_warn(priv, "mtu > %d will cause multicast packet drops.\n",
-+                                 priv->mcast_mtu);
-+              dev_set_mtu(dev, ipoib_cm_max_mtu(dev));
-+#endif
-               rtnl_unlock();
-               priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
-@@ -1475,7 +1487,16 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
-       if (!strcmp(buf, "datagram\n")) {
-               clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
-               netdev_update_features(dev);
-+#else
-+              if (test_bit(IPOIB_FLAG_CSUM, &priv->flags)) {
-+                      dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
-+                      priv->dev->features |= NETIF_F_GRO;
-+                      if (priv->hca_caps & IB_DEVICE_UD_TSO)
-+                              dev->features |= NETIF_F_TSO;
-+              } 
-+#endif
-               dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu));
-               rtnl_unlock();
-               ipoib_flush_paths(dev);
-diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
-index 3974c29..f35bd5c 100644
---- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
-+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
-@@ -171,6 +171,7 @@ static int ipoib_stop(struct net_device *dev)
-       return 0;
- }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_features_t features)
- {
-       struct ipoib_dev_priv *priv = netdev_priv(dev);
-@@ -180,6 +181,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu
-       return features;
- }
-+#endif
- static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
- {
-@@ -715,7 +717,11 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
-       rcu_read_lock();
-       if (likely(skb_dst(skb))) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-               n = dst_get_neighbour_noref(skb_dst(skb));
-+#else
-+              n = dst_get_neighbour(skb_dst(skb));
-+#endif
-               if (!n) {
-                       ++dev->stats.tx_dropped;
-                       dev_kfree_skb_any(skb);
-@@ -986,7 +992,9 @@ static const struct net_device_ops ipoib_netdev_ops = {
-       .ndo_open                = ipoib_open,
-       .ndo_stop                = ipoib_stop,
-       .ndo_change_mtu          = ipoib_change_mtu,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-       .ndo_fix_features        = ipoib_fix_features,
-+#endif
-       .ndo_start_xmit          = ipoib_start_xmit,
-       .ndo_tx_timeout          = ipoib_timeout,
-       .ndo_set_rx_mode         = ipoib_set_mcast_list,
-@@ -1167,6 +1175,7 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
-       kfree(device_attr);
-       if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
-               priv->dev->hw_features = NETIF_F_SG |
-                       NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
-@@ -1174,6 +1183,13 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
-                       priv->dev->hw_features |= NETIF_F_TSO;
-               priv->dev->features |= priv->dev->hw_features;
-+#else
-+              priv->dev->features |= NETIF_F_SG |
-+                      NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
-+
-+              if (priv->hca_caps & IB_DEVICE_UD_TSO)
-+                      priv->dev->features |= NETIF_F_TSO;
-+#endif
-       }
-       return 0;
-@@ -1205,7 +1221,9 @@ static struct net_device *ipoib_add_port(const char *format,
-       priv->dev->mtu  = IPOIB_UD_MTU(priv->max_ib_mtu);
-       priv->mcast_mtu  = priv->admin_mtu = priv->dev->mtu;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-       priv->dev->neigh_priv_len = sizeof(struct ipoib_neigh);
-+#endif
-       result = ib_query_pkey(hca, port, 0, &priv->pkey);
-       if (result) {
-diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
-index 20ebc6f..4a4c64a 100644
---- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
-+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
-@@ -720,7 +720,11 @@ out:
-               rcu_read_lock();
-               if (dst)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-                       n = dst_get_neighbour_noref(dst);
-+#else
-+                      n = dst_get_neighbour(dst);
-+#endif
-               if (n && !*to_ipoib_neigh(n)) {
-                       struct ipoib_neigh *neigh = ipoib_neigh_alloc(n,
-                                                                     skb->dev);
-@@ -788,7 +792,11 @@ void ipoib_mcast_restart_task(struct work_struct *work)
-       struct ipoib_dev_priv *priv =
-               container_of(work, struct ipoib_dev_priv, restart_task);
-       struct net_device *dev = priv->dev;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-       struct netdev_hw_addr *ha;
-+#else
-+      struct dev_mc_list *mclist;
-+#endif
-       struct ipoib_mcast *mcast, *tmcast;
-       LIST_HEAD(remove_list);
-       unsigned long flags;
-@@ -813,6 +821,7 @@ void ipoib_mcast_restart_task(struct work_struct *work)
-               clear_bit(IPOIB_MCAST_FLAG_FOUND, &mcast->flags);
-       /* Mark all of the entries that are found or don't exist */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-       netdev_for_each_mc_addr(ha, dev) {
-               union ib_gid mgid;
-@@ -820,6 +829,16 @@ void ipoib_mcast_restart_task(struct work_struct *work)
-                       continue;
-               memcpy(mgid.raw, ha->addr + 4, sizeof mgid);
-+#else
-+      for (mclist = dev->mc_list; mclist; mclist = mclist->next) {
-+              union ib_gid mgid;
-+
-+              if (!ipoib_mcast_addr_is_valid(mclist->dmi_addr,
-+                                              dev->broadcast))
-+                      continue;
-+
-+              memcpy(mgid.raw, mclist->dmi_addr + 4, sizeof mgid);
-+#endif
-               mcast = __ipoib_mcast_find(dev, &mgid);
-               if (!mcast || test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) {
--- 
-1.7.5.4
-
diff --git a/patches/0015-IB-ipath-backport-3.2-for-pinned_vm-field.patch b/patches/0015-IB-ipath-backport-3.2-for-pinned_vm-field.patch
new file mode 100644 (file)
index 0000000..d0db622
--- /dev/null
@@ -0,0 +1,53 @@
+From 4c438e025af2c1e3b6da2e80aa4cdeb22879b233 Mon Sep 17 00:00:00 2001
+From: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Date: Thu, 2 Aug 2012 18:11:27 +0300
+Subject: [PATCH 15/19] IB/ipath: backport < 3.2 for pinned_vm field
+
+Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+---
+ drivers/infiniband/hw/ipath/ipath_user_pages.c |   12 ++++++++++++
+ 1 files changed, 12 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c
+index dc66c45..f2858e6 100644
+--- a/drivers/infiniband/hw/ipath/ipath_user_pages.c
++++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c
+@@ -79,7 +79,11 @@ static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages,
+                       goto bail_release;
+       }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+       current->mm->pinned_vm += num_pages;
++#else
++      current->mm->locked_vm += num_pages;
++#endif
+       ret = 0;
+       goto bail;
+@@ -178,7 +182,11 @@ void ipath_release_user_pages(struct page **p, size_t num_pages)
+       __ipath_release_user_pages(p, num_pages, 1);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+       current->mm->pinned_vm -= num_pages;
++#else
++      current->mm->locked_vm -= num_pages;
++#endif
+       up_write(&current->mm->mmap_sem);
+ }
+@@ -195,7 +203,11 @@ static void user_pages_account(struct work_struct *_work)
+               container_of(_work, struct ipath_user_pages_work, work);
+       down_write(&work->mm->mmap_sem);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+       work->mm->pinned_vm -= work->num_pages;
++#else
++      work->mm->locked_vm -= work->num_pages;
++#endif
+       up_write(&work->mm->mmap_sem);
+       mmput(work->mm);
+       kfree(work);
+-- 
+1.7.0.4
+
diff --git a/patches/0016-iw_cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch b/patches/0016-iw_cxgb3-Backports-for-RHEL6.2-RHEL-6.3-and-SLES11-S.patch
new file mode 100644 (file)
index 0000000..424ff3c
--- /dev/null
@@ -0,0 +1,75 @@
+From 6a037dd6124f663462974233e166febc4f743a4b Mon Sep 17 00:00:00 2001
+From: Vipul Pandya <vipul@chelsio.com>
+Date: Mon, 30 Jul 2012 12:38:36 +0530
+Subject: [PATCH 16/19] iw_cxgb3: Backports for RHEL6.2 RHEL 6.3 and SLES11 SP2
+
+Signed-off-by: Vipul Pandya <vipul@chelsio.com>
+---
+ drivers/infiniband/hw/cxgb3/iwch_cm.c |   29 +++++++++++++++++++++++++++++
+ 1 files changed, 29 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
+index 740dcc0..c0b492f 100644
+--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
++++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
+@@ -338,12 +338,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;
+ }
+@@ -1373,7 +1394,11 @@ 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
+       l2t = t3_l2t_get(tdev, dst, NULL);
+       if (!l2t) {
+               printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n",
+@@ -1941,7 +1966,11 @@ 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
+       ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL);
+       if (!ep->l2t) {
+               printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__);
+-- 
+1.7.0.4
+
diff --git a/patches/0017-iw_cxgb4-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP.patch b/patches/0017-iw_cxgb4-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP.patch
new file mode 100644 (file)
index 0000000..60d1498
--- /dev/null
@@ -0,0 +1,293 @@
+From 7042b9602eddcccd36c970f11d5123db52883b0c Mon Sep 17 00:00:00 2001
+From: Vipul Pandya <root@silicon.(none)>
+Date: Mon, 30 Jul 2012 16:59:42 +0530
+Subject: [PATCH 17/19] iw_cxgb4: Backports for RHEL6.2 RHEL6.3 and SLES11 SP2
+
+Signed-off-by: Vipul Pandya <root@silicon.(none)>
+---
+ drivers/infiniband/hw/cxgb4/cm.c       |   45 ++++++++++++++++++++++++++++++++
+ drivers/infiniband/hw/cxgb4/cq.c       |   12 ++++++++
+ drivers/infiniband/hw/cxgb4/iw_cxgb4.h |    4 +++
+ drivers/infiniband/hw/cxgb4/mem.c      |    8 +++++
+ drivers/infiniband/hw/cxgb4/qp.c       |   17 +++++++++++-
+ drivers/infiniband/hw/cxgb4/t4.h       |   12 ++++++++
+ 6 files changed, 97 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
+index b18870c..c1805bd 100644
+--- a/drivers/infiniband/hw/cxgb4/cm.c
++++ b/drivers/infiniband/hw/cxgb4/cm.c
+@@ -316,12 +316,33 @@ static struct rtable *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;
+       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;
+ }
+@@ -1583,11 +1604,23 @@ static int import_ep(struct c4iw_ep *ep, __be32 peer_ip, struct dst_entry *dst,
+       struct neighbour *n;
+       int err, step;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+       n = dst_neigh_lookup(dst, &peer_ip);
+       if (!n)
+               return -ENODEV;
+       rcu_read_lock();
++#else
++      rcu_read_lock();
++#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) {
+               struct net_device *pdev;
+@@ -1676,7 +1709,11 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
+                      __func__);
+               goto reject;
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+       dst = &rt->dst;
++#else
++      dst = &rt->u.dst;
++#endif
+       child_ep = alloc_ep(sizeof(*child_ep), GFP_KERNEL);
+       if (!child_ep) {
+@@ -1868,7 +1905,11 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
+               err = -EHOSTUNREACH;
+               goto fail3;
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+       ep->dst = &rt->dst;
++#else
++      ep->dst = &rt->u.dst;
++#endif
+       err = import_ep(ep, ep->com.cm_id->remote_addr.sin_addr.s_addr,
+                       ep->dst, ep->com.dev, false);
+@@ -2311,7 +2352,11 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
+               err = -EHOSTUNREACH;
+               goto fail3;
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+       ep->dst = &rt->dst;
++#else
++      ep->dst = &rt->u.dst;
++#endif
+       err = import_ep(ep, cm_id->remote_addr.sin_addr.s_addr,
+                       ep->dst, ep->com.dev, true);
+diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
+index 0f1607c..550eb82 100644
+--- a/drivers/infiniband/hw/cxgb4/cq.c
++++ b/drivers/infiniband/hw/cxgb4/cq.c
+@@ -70,7 +70,11 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
+       kfree(cq->sw_queue);
+       dma_free_coherent(&(rdev->lldi.pdev->dev),
+                         cq->memsize, cq->queue,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+                         dma_unmap_addr(cq, mapping));
++#else
++                        pci_unmap_addr(cq, mapping));
++#endif
+       c4iw_put_cqid(rdev, cq->cqid, uctx);
+       return ret;
+ }
+@@ -105,7 +109,11 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
+               ret = -ENOMEM;
+               goto err3;
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       dma_unmap_addr_set(cq, mapping, cq->dma_addr);
++#else
++      pci_unmap_addr_set(cq, mapping, cq->dma_addr);
++#endif
+       memset(cq->queue, 0, cq->memsize);
+       /* build fw_ri_res_wr */
+@@ -165,7 +173,11 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
+       return 0;
+ err4:
+       dma_free_coherent(&rdev->lldi.pdev->dev, cq->memsize, cq->queue,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+                         dma_unmap_addr(cq, mapping));
++#else
++                        pci_unmap_addr(cq, mapping));
++#endif
+ err3:
+       kfree(cq->sw_queue);
+ err2:
+diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+index 9beb3a9..9a9df48 100644
+--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
++++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+@@ -359,7 +359,11 @@ static inline struct c4iw_mw *to_c4iw_mw(struct ib_mw *ibmw)
+ struct c4iw_fr_page_list {
+       struct ib_fast_reg_page_list ibpl;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       DEFINE_DMA_UNMAP_ADDR(mapping);
++#else
++      DECLARE_PCI_UNMAP_ADDR(mapping);
++#endif
+       dma_addr_t dma_addr;
+       struct c4iw_dev *dev;
+       int size;
+diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
+index 57e07c6..375da95 100644
+--- a/drivers/infiniband/hw/cxgb4/mem.c
++++ b/drivers/infiniband/hw/cxgb4/mem.c
+@@ -764,7 +764,11 @@ struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(struct ib_device *device,
+       if (!c4pl)
+               return ERR_PTR(-ENOMEM);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       dma_unmap_addr_set(c4pl, mapping, dma_addr);
++#else
++      pci_unmap_addr_set(c4pl, mapping, dma_addr);
++#endif
+       c4pl->dma_addr = dma_addr;
+       c4pl->dev = dev;
+       c4pl->size = size;
+@@ -779,7 +783,11 @@ void c4iw_free_fastreg_pbl(struct ib_fast_reg_page_list *ibpl)
+       struct c4iw_fr_page_list *c4pl = to_c4iw_fr_page_list(ibpl);
+       dma_free_coherent(&c4pl->dev->rdev.lldi.pdev->dev, c4pl->size,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+                         c4pl, dma_unmap_addr(c4pl, mapping));
++#else
++                        c4pl, pci_unmap_addr(c4pl, mapping));
++#endif
+ }
+ int c4iw_dereg_mr(struct ib_mr *ib_mr)
+diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
+index 45aedf1..e83249c 100644
+--- a/drivers/infiniband/hw/cxgb4/qp.c
++++ b/drivers/infiniband/hw/cxgb4/qp.c
+@@ -109,7 +109,11 @@ static int destroy_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
+        */
+       dma_free_coherent(&(rdev->lldi.pdev->dev),
+                         wq->rq.memsize, wq->rq.queue,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+                         dma_unmap_addr(&wq->rq, mapping));
++#else
++                        pci_unmap_addr(&wq->rq, mapping));
++#endif
+       dealloc_sq(rdev, &wq->sq);
+       c4iw_rqtpool_free(rdev, wq->rq.rqt_hwaddr, wq->rq.rqt_size);
+       kfree(wq->rq.sw_rq);
+@@ -167,7 +171,11 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
+               if (alloc_host_sq(rdev, &wq->sq))
+                       goto err5;
+       memset(wq->sq.queue, 0, wq->sq.memsize);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       dma_unmap_addr_set(&wq->sq, mapping, wq->sq.dma_addr);
++#else
++      pci_unmap_addr_set(&wq->sq, mapping, wq->sq.dma_addr);
++#endif
+       wq->rq.queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev),
+                                         wq->rq.memsize, &(wq->rq.dma_addr),
+@@ -180,8 +188,11 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
+               wq->rq.queue,
+               (unsigned long long)virt_to_phys(wq->rq.queue));
+       memset(wq->rq.queue, 0, wq->rq.memsize);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       dma_unmap_addr_set(&wq->rq, mapping, wq->rq.dma_addr);
+-
++#else
++      pci_unmap_addr_set(&wq->rq, mapping, wq->rq.dma_addr);
++#endif
+       wq->db = rdev->lldi.db_reg;
+       wq->gts = rdev->lldi.gts_reg;
+       if (user) {
+@@ -279,7 +290,11 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
+ err7:
+       dma_free_coherent(&(rdev->lldi.pdev->dev),
+                         wq->rq.memsize, wq->rq.queue,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+                         dma_unmap_addr(&wq->rq, mapping));
++#else
++                        pci_unmap_addr(&wq->rq, mapping));
++#endif
+ err6:
+       dealloc_sq(rdev, &wq->sq);
+ err5:
+diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h
+index 16f26ab..cafdb7c 100644
+--- a/drivers/infiniband/hw/cxgb4/t4.h
++++ b/drivers/infiniband/hw/cxgb4/t4.h
+@@ -296,7 +296,11 @@ enum {
+ struct t4_sq {
+       union t4_wr *queue;
+       dma_addr_t dma_addr;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       DEFINE_DMA_UNMAP_ADDR(mapping);
++#else
++      DECLARE_PCI_UNMAP_ADDR(mapping);
++#endif
+       unsigned long phys_addr;
+       struct t4_swsqe *sw_sq;
+       struct t4_swsqe *oldest_read;
+@@ -318,7 +322,11 @@ struct t4_swrqe {
+ struct t4_rq {
+       union  t4_recv_wr *queue;
+       dma_addr_t dma_addr;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       DEFINE_DMA_UNMAP_ADDR(mapping);
++#else
++      DECLARE_PCI_UNMAP_ADDR(mapping);
++#endif
+       struct t4_swrqe *sw_rq;
+       u64 udb;
+       size_t memsize;
+@@ -476,7 +484,11 @@ static inline int t4_wq_db_enabled(struct t4_wq *wq)
+ struct t4_cq {
+       struct t4_cqe *queue;
+       dma_addr_t dma_addr;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       DEFINE_DMA_UNMAP_ADDR(mapping);
++#else
++      DECLARE_PCI_UNMAP_ADDR(mapping);
++#endif
+       struct t4_cqe *sw_queue;
+       void __iomem *gts;
+       struct c4iw_rdev *rdev;
+-- 
+1.7.0.4
+
diff --git a/patches/0018-IPoIB-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch b/patches/0018-IPoIB-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch
new file mode 100644 (file)
index 0000000..55e06b6
--- /dev/null
@@ -0,0 +1,206 @@
+From fb296cd5f46e72878911b20e3e346b605ea84c4d Mon Sep 17 00:00:00 2001
+From: Vladimir Sokolovsky <vlad@mellanox.com>
+Date: Thu, 2 Aug 2012 16:12:39 +0300
+Subject: [PATCH 18/19] IPoIB: Backports for RHEL6.2 RHEL6.3 and SLES11 SP2
+
+Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
+---
+ drivers/infiniband/ulp/ipoib/ipoib.h           |    3 +++
+ drivers/infiniband/ulp/ipoib/ipoib_cm.c        |   21 +++++++++++++++++++++
+ drivers/infiniband/ulp/ipoib/ipoib_main.c      |   18 ++++++++++++++++++
+ drivers/infiniband/ulp/ipoib/ipoib_multicast.c |   19 +++++++++++++++++++
+ 4 files changed, 61 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
+index 86df632..a876f24 100644
+--- a/drivers/infiniband/ulp/ipoib/ipoib.h
++++ b/drivers/infiniband/ulp/ipoib/ipoib.h
+@@ -92,6 +92,9 @@ enum {
+       IPOIB_STOP_REAPER         = 7,
+       IPOIB_FLAG_ADMIN_CM       = 9,
+       IPOIB_FLAG_UMCAST         = 10,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++      IPOIB_FLAG_CSUM           = 11,
++#endif
+       IPOIB_MAX_BACKOFF_SECONDS = 16,
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+index 014504d..b83efdf 100644
+--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+@@ -1378,7 +1378,11 @@ static void ipoib_cm_skb_reap(struct work_struct *work)
+                       icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
+ #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+               else if (skb->protocol == htons(ETH_P_IPV6))
++#if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+                       icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
++#else
++                      icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, priv->dev);
++#endif
+ #endif
+               dev_kfree_skb_any(skb);
+@@ -1465,7 +1469,15 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
+               set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
+               ipoib_warn(priv, "enabling connected mode "
+                          "will cause multicast packet drops\n");
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+               netdev_update_features(dev);
++#else
++              dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO);
++              if (ipoib_cm_max_mtu(dev) > priv->mcast_mtu)
++                      ipoib_warn(priv, "mtu > %d will cause multicast packet drops.\n",
++                                 priv->mcast_mtu);
++              dev_set_mtu(dev, ipoib_cm_max_mtu(dev));
++#endif
+               rtnl_unlock();
+               priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
+@@ -1475,7 +1487,16 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
+       if (!strcmp(buf, "datagram\n")) {
+               clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+               netdev_update_features(dev);
++#else
++              if (test_bit(IPOIB_FLAG_CSUM, &priv->flags)) {
++                      dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
++                      priv->dev->features |= NETIF_F_GRO;
++                      if (priv->hca_caps & IB_DEVICE_UD_TSO)
++                              dev->features |= NETIF_F_TSO;
++              } 
++#endif
+               dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu));
+               rtnl_unlock();
+               ipoib_flush_paths(dev);
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
+index 3974c29..f35bd5c 100644
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
+@@ -171,6 +171,7 @@ static int ipoib_stop(struct net_device *dev)
+       return 0;
+ }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_features_t features)
+ {
+       struct ipoib_dev_priv *priv = netdev_priv(dev);
+@@ -180,6 +181,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu
+       return features;
+ }
++#endif
+ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
+ {
+@@ -715,7 +717,11 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
+       rcu_read_lock();
+       if (likely(skb_dst(skb))) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+               n = dst_get_neighbour_noref(skb_dst(skb));
++#else
++              n = dst_get_neighbour(skb_dst(skb));
++#endif
+               if (!n) {
+                       ++dev->stats.tx_dropped;
+                       dev_kfree_skb_any(skb);
+@@ -986,7 +992,9 @@ static const struct net_device_ops ipoib_netdev_ops = {
+       .ndo_open                = ipoib_open,
+       .ndo_stop                = ipoib_stop,
+       .ndo_change_mtu          = ipoib_change_mtu,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+       .ndo_fix_features        = ipoib_fix_features,
++#endif
+       .ndo_start_xmit          = ipoib_start_xmit,
+       .ndo_tx_timeout          = ipoib_timeout,
+       .ndo_set_rx_mode         = ipoib_set_mcast_list,
+@@ -1167,6 +1175,7 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
+       kfree(device_attr);
+       if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+               priv->dev->hw_features = NETIF_F_SG |
+                       NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
+@@ -1174,6 +1183,13 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
+                       priv->dev->hw_features |= NETIF_F_TSO;
+               priv->dev->features |= priv->dev->hw_features;
++#else
++              priv->dev->features |= NETIF_F_SG |
++                      NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
++
++              if (priv->hca_caps & IB_DEVICE_UD_TSO)
++                      priv->dev->features |= NETIF_F_TSO;
++#endif
+       }
+       return 0;
+@@ -1205,7 +1221,9 @@ static struct net_device *ipoib_add_port(const char *format,
+       priv->dev->mtu  = IPOIB_UD_MTU(priv->max_ib_mtu);
+       priv->mcast_mtu  = priv->admin_mtu = priv->dev->mtu;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+       priv->dev->neigh_priv_len = sizeof(struct ipoib_neigh);
++#endif
+       result = ib_query_pkey(hca, port, 0, &priv->pkey);
+       if (result) {
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+index 20ebc6f..4a4c64a 100644
+--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+@@ -720,7 +720,11 @@ out:
+               rcu_read_lock();
+               if (dst)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+                       n = dst_get_neighbour_noref(dst);
++#else
++                      n = dst_get_neighbour(dst);
++#endif
+               if (n && !*to_ipoib_neigh(n)) {
+                       struct ipoib_neigh *neigh = ipoib_neigh_alloc(n,
+                                                                     skb->dev);
+@@ -788,7 +792,11 @@ void ipoib_mcast_restart_task(struct work_struct *work)
+       struct ipoib_dev_priv *priv =
+               container_of(work, struct ipoib_dev_priv, restart_task);
+       struct net_device *dev = priv->dev;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+       struct netdev_hw_addr *ha;
++#else
++      struct dev_mc_list *mclist;
++#endif
+       struct ipoib_mcast *mcast, *tmcast;
+       LIST_HEAD(remove_list);
+       unsigned long flags;
+@@ -813,6 +821,7 @@ void ipoib_mcast_restart_task(struct work_struct *work)
+               clear_bit(IPOIB_MCAST_FLAG_FOUND, &mcast->flags);
+       /* Mark all of the entries that are found or don't exist */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+       netdev_for_each_mc_addr(ha, dev) {
+               union ib_gid mgid;
+@@ -820,6 +829,16 @@ void ipoib_mcast_restart_task(struct work_struct *work)
+                       continue;
+               memcpy(mgid.raw, ha->addr + 4, sizeof mgid);
++#else
++      for (mclist = dev->mc_list; mclist; mclist = mclist->next) {
++              union ib_gid mgid;
++
++              if (!ipoib_mcast_addr_is_valid(mclist->dmi_addr,
++                                              dev->broadcast))
++                      continue;
++
++              memcpy(mgid.raw, mclist->dmi_addr + 4, sizeof mgid);
++#endif
+               mcast = __ipoib_mcast_find(dev, &mgid);
+               if (!mcast || test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) {
+-- 
+1.7.0.4
+
diff --git a/patches/0019-mlx4_en-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP.patch b/patches/0019-mlx4_en-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP.patch
deleted file mode 100644 (file)
index 26430d8..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-From c1581892ecffb984628a4d44f93b267fe086974b Mon Sep 17 00:00:00 2001
-From: Vladimir Sokolovsky <vlad@mellanox.com>
-Date: Sun, 5 Aug 2012 22:00:42 +0300
-Subject: [PATCH] mlx4_en: Backports for RHEL6.2 RHEL6.3 and SLES11 SP2
-
-Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
----
- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c |    4 ++
- drivers/net/ethernet/mellanox/mlx4/en_netdev.c  |   29 ++++++++++++
- drivers/net/ethernet/mellanox/mlx4/en_rx.c      |   56 +++++++++++++++++++++++
- drivers/net/ethernet/mellanox/mlx4/en_tx.c      |    4 ++
- 4 files changed, 93 insertions(+), 0 deletions(-)
-
-diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
-index 72901ce..332e851 100644
---- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
-+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
-@@ -528,6 +528,7 @@ static void mlx4_en_get_ringparam(struct net_device *dev,
-       param->tx_pending = priv->tx_ring[0].size;
- }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev)
- {
-       struct mlx4_en_priv *priv = netdev_priv(dev);
-@@ -598,6 +599,7 @@ static int mlx4_en_set_rxfh_indir(struct net_device *dev,
-       mutex_unlock(&mdev->state_lock);
-       return err;
- }
-+#endif
- static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
-                            u32 *rule_locs)
-@@ -637,9 +639,11 @@ const struct ethtool_ops mlx4_en_ethtool_ops = {
-       .get_ringparam = mlx4_en_get_ringparam,
-       .set_ringparam = mlx4_en_set_ringparam,
-       .get_rxnfc = mlx4_en_get_rxnfc,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-       .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size,
-       .get_rxfh_indir = mlx4_en_get_rxfh_indir,
-       .set_rxfh_indir = mlx4_en_set_rxfh_indir,
-+#endif
- };
-diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
-index 926d8aa..ac66efe 100644
---- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
-+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
-@@ -45,6 +45,7 @@
- #include "mlx4_en.h"
- #include "en_port.h"
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- static int mlx4_en_setup_tc(struct net_device *dev, u8 up)
- {
-       struct mlx4_en_priv *priv = netdev_priv(dev);
-@@ -65,6 +66,7 @@ static int mlx4_en_setup_tc(struct net_device *dev, u8 up)
-       return 0;
- }
-+#endif
- static int mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
- {
-@@ -179,7 +181,11 @@ static void mlx4_en_clear_list(struct net_device *dev)
- static void mlx4_en_cache_mclist(struct net_device *dev)
- {
-       struct mlx4_en_priv *priv = netdev_priv(dev);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-       struct netdev_hw_addr *ha;
-+#else
-+      struct dev_mc_list *mclist;
-+#endif
-       char *mc_addrs;
-       int mc_addrs_cnt = netdev_mc_count(dev);
-       int i;
-@@ -190,8 +196,13 @@ static void mlx4_en_cache_mclist(struct net_device *dev)
-               return;
-       }
-       i = 0;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-       netdev_for_each_mc_addr(ha, dev)
-               memcpy(mc_addrs + i++ * ETH_ALEN, ha->addr, ETH_ALEN);
-+#else
-+      netdev_for_each_mc_addr(mclist, dev)
-+              memcpy(mc_addrs + i++ * ETH_ALEN, mclist->dmi_addr, ETH_ALEN);
-+#endif
-       mlx4_en_clear_list(dev);
-       priv->mc_addrs = mc_addrs;
-       priv->mc_addrs_cnt = mc_addrs_cnt;
-@@ -1040,6 +1051,7 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
-       return 0;
- }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- static int mlx4_en_set_features(struct net_device *netdev,
-               netdev_features_t features)
- {
-@@ -1054,6 +1066,7 @@ static int mlx4_en_set_features(struct net_device *netdev,
-       return 0;
- }
-+#endif
- static const struct net_device_ops mlx4_netdev_ops = {
-       .ndo_open               = mlx4_en_open,
-@@ -1071,8 +1084,10 @@ static const struct net_device_ops mlx4_netdev_ops = {
- #ifdef CONFIG_NET_POLL_CONTROLLER
-       .ndo_poll_controller    = mlx4_en_netpoll,
- #endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
-       .ndo_set_features       = mlx4_en_set_features,
-       .ndo_setup_tc           = mlx4_en_setup_tc,
-+#endif
- };
- int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
-@@ -1178,6 +1193,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
-       /*
-        * Set driver features
-        */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
-       dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
-       if (mdev->LSO_support)
-               dev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
-@@ -1189,6 +1205,19 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
-                       NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
-                       NETIF_F_HW_VLAN_FILTER;
-       dev->hw_features |= NETIF_F_LOOPBACK;
-+#else
-+      dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
-+      if (mdev->LSO_support)
-+              dev->features |= NETIF_F_TSO | NETIF_F_TSO6;
-+
-+      dev->vlan_features = dev->features;
-+
-+      dev->features |= NETIF_F_RXCSUM | NETIF_F_RXHASH;
-+      dev->features |= NETIF_F_HIGHDMA |
-+                      NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
-+                      NETIF_F_HW_VLAN_FILTER;
-+      dev->features |= NETIF_F_LOOPBACK;
-+#endif
-       mdev->pndev[port] = dev;
-diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
-index d49a7ac..ae1c6a9 100644
---- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
-+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
-@@ -44,7 +44,11 @@
- static int mlx4_en_alloc_frag(struct mlx4_en_priv *priv,
-                             struct mlx4_en_rx_desc *rx_desc,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-                             struct page_frag *skb_frags,
-+#else
-+                            struct skb_frag_struct *skb_frags,
-+#endif
-                             struct mlx4_en_rx_alloc *ring_alloc,
-                             int i)
- {
-@@ -60,7 +64,11 @@ static int mlx4_en_alloc_frag(struct mlx4_en_priv *priv,
-                       return -ENOMEM;
-               skb_frags[i].page = page_alloc->page;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               skb_frags[i].offset = page_alloc->offset;
-+#else
-+              skb_frags[i].page_offset = page_alloc->offset;
-+#endif
-               page_alloc->page = page;
-               page_alloc->offset = frag_info->frag_align;
-       } else {
-@@ -68,11 +76,19 @@ static int mlx4_en_alloc_frag(struct mlx4_en_priv *priv,
-               get_page(page);
-               skb_frags[i].page = page;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               skb_frags[i].offset = page_alloc->offset;
-+#else
-+              skb_frags[i].page_offset = page_alloc->offset;
-+#endif
-               page_alloc->offset += frag_info->frag_stride;
-       }
-       dma = dma_map_single(priv->ddev, page_address(skb_frags[i].page) +
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-                            skb_frags[i].offset, frag_info->frag_size,
-+#else
-+                           skb_frags[i].page_offset, frag_info->frag_size,
-+#endif
-                            PCI_DMA_FROMDEVICE);
-       rx_desc->data[i].addr = cpu_to_be64(dma);
-       return 0;
-@@ -156,8 +172,13 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv,
-                                  struct mlx4_en_rx_ring *ring, int index)
- {
-       struct mlx4_en_rx_desc *rx_desc = ring->buf + (index * ring->stride);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       struct page_frag *skb_frags = ring->rx_info +
-                                     (index << priv->log_rx_info);
-+#else
-+      struct skb_frag_struct *skb_frags = ring->rx_info +
-+                                          (index << priv->log_rx_info);
-+#endif
-       int i;
-       for (i = 0; i < priv->num_frags; i++)
-@@ -185,7 +206,11 @@ static void mlx4_en_free_rx_desc(struct mlx4_en_priv *priv,
-                                struct mlx4_en_rx_ring *ring,
-                                int index)
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       struct page_frag *skb_frags;
-+#else
-+      struct skb_frag_struct *skb_frags;
-+#endif
-       struct mlx4_en_rx_desc *rx_desc = ring->buf + (index << ring->log_stride);
-       dma_addr_t dma;
-       int nr;
-@@ -196,8 +221,13 @@ static void mlx4_en_free_rx_desc(struct mlx4_en_priv *priv,
-               dma = be64_to_cpu(rx_desc->data[nr].addr);
-               en_dbg(DRV, priv, "Unmapping buffer at dma:0x%llx\n", (u64) dma);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               dma_unmap_single(priv->ddev, dma, skb_frags[nr].size,
-                                PCI_DMA_FROMDEVICE);
-+#else
-+              dma_unmap_single(priv->ddev, dma, skb_frag_size(&skb_frags[nr]),
-+                               PCI_DMA_FROMDEVICE);
-+#endif
-               put_page(skb_frags[nr].page);
-       }
- }
-@@ -404,7 +434,11 @@ void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,
- /* Unmap a completed descriptor and free unused pages */
- static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
-                                   struct mlx4_en_rx_desc *rx_desc,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-                                   struct page_frag *skb_frags,
-+#else
-+                                  struct skb_frag_struct *skb_frags,
-+#endif
-                                   struct sk_buff *skb,
-                                   struct mlx4_en_rx_alloc *page_alloc,
-                                   int length)
-@@ -421,9 +455,15 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
-                       break;
-               /* Save page reference in skb */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               __skb_frag_set_page(&skb_frags_rx[nr], skb_frags[nr].page);
-               skb_frag_size_set(&skb_frags_rx[nr], skb_frags[nr].size);
-               skb_frags_rx[nr].page_offset = skb_frags[nr].offset;
-+#else
-+              skb_frags_rx[nr].page = skb_frags[nr].page;
-+              skb_frag_size_set(&skb_frags_rx[nr], skb_frag_size(&skb_frags[nr]));
-+              skb_frags_rx[nr].page_offset = skb_frags[nr].page_offset;
-+#endif
-               skb->truesize += frag_info->frag_stride;
-               dma = be64_to_cpu(rx_desc->data[nr].addr);
-@@ -454,7 +494,11 @@ fail:
- static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
-                                     struct mlx4_en_rx_desc *rx_desc,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-                                     struct page_frag *skb_frags,
-+#else
-+                                    struct skb_frag_struct *skb_frags,
-+#endif
-                                     struct mlx4_en_rx_alloc *page_alloc,
-                                     unsigned int length)
- {
-@@ -473,7 +517,11 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
-       /* Get pointer to first fragment so we could copy the headers into the
-        * (linear part of the) skb */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       va = page_address(skb_frags[0].page) + skb_frags[0].offset;
-+#else
-+      va = page_address(skb_frags[0].page) + skb_frags[0].page_offset;
-+#endif
-       if (length <= SMALL_PACKET_SIZE) {
-               /* We are copying all relevant data to the skb - temporarily
-@@ -531,7 +579,11 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
-       struct mlx4_en_priv *priv = netdev_priv(dev);
-       struct mlx4_cqe *cqe;
-       struct mlx4_en_rx_ring *ring = &priv->rx_ring[cq->ring];
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       struct page_frag *skb_frags;
-+#else
-+      struct skb_frag_struct *skb_frags;
-+#endif
-       struct mlx4_en_rx_desc *rx_desc;
-       struct sk_buff *skb;
-       int index;
-@@ -580,7 +632,11 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
-               /* Get pointer to first fragment since we haven't skb yet and
-                * cast it to ethhdr struct */
-               ethh = (struct ethhdr *)(page_address(skb_frags[0].page) +
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-                                        skb_frags[0].offset);
-+#else
-+                                       skb_frags[0].page_offset);
-+#endif
-               s_mac = mlx4_en_mac_to_u64(ethh->h_source);
-               /* If source MAC is equal to our own MAC and not performing
-diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
-index 019d856..5a2bddd 100644
---- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
-+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
-@@ -529,7 +529,11 @@ u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb)
-       u16 rings_p_up = priv->mdev->profile.num_tx_rings_p_up;
-       u8 up = 0;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
-       if (dev->num_tc)
-+#else
-+      if (netdev_get_num_tc(dev))
-+#endif
-               return skb_tx_hash(dev, skb);
-       if (vlan_tx_tag_present(skb))
--- 
-1.5.4.3
-
diff --git a/patches/0019-mlx4_en-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch b/patches/0019-mlx4_en-Backports-for-RHEL6.2-RHEL6.3-and-SLES11-SP2.patch
new file mode 100644 (file)
index 0000000..428cc86
--- /dev/null
@@ -0,0 +1,329 @@
+From 8d37aed4c921582f6cdacc00b1c9fbb933bfa9f1 Mon Sep 17 00:00:00 2001
+From: Vladimir Sokolovsky <vlad@mellanox.com>
+Date: Sun, 5 Aug 2012 22:00:42 +0300
+Subject: [PATCH 19/19] mlx4_en: Backports for RHEL6.2 RHEL6.3 and SLES11 SP2
+
+Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
+---
+ drivers/net/ethernet/mellanox/mlx4/en_ethtool.c |    4 ++
+ drivers/net/ethernet/mellanox/mlx4/en_netdev.c  |   29 ++++++++++++
+ drivers/net/ethernet/mellanox/mlx4/en_rx.c      |   56 +++++++++++++++++++++++
+ drivers/net/ethernet/mellanox/mlx4/en_tx.c      |    4 ++
+ 4 files changed, 93 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+index 72901ce..332e851 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+@@ -528,6 +528,7 @@ static void mlx4_en_get_ringparam(struct net_device *dev,
+       param->tx_pending = priv->tx_ring[0].size;
+ }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev)
+ {
+       struct mlx4_en_priv *priv = netdev_priv(dev);
+@@ -598,6 +599,7 @@ static int mlx4_en_set_rxfh_indir(struct net_device *dev,
+       mutex_unlock(&mdev->state_lock);
+       return err;
+ }
++#endif
+ static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
+                            u32 *rule_locs)
+@@ -637,9 +639,11 @@ const struct ethtool_ops mlx4_en_ethtool_ops = {
+       .get_ringparam = mlx4_en_get_ringparam,
+       .set_ringparam = mlx4_en_set_ringparam,
+       .get_rxnfc = mlx4_en_get_rxnfc,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+       .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size,
+       .get_rxfh_indir = mlx4_en_get_rxfh_indir,
+       .set_rxfh_indir = mlx4_en_set_rxfh_indir,
++#endif
+ };
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+index 073b85b..2a53952 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+@@ -45,6 +45,7 @@
+ #include "mlx4_en.h"
+ #include "en_port.h"
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ static int mlx4_en_setup_tc(struct net_device *dev, u8 up)
+ {
+       struct mlx4_en_priv *priv = netdev_priv(dev);
+@@ -65,6 +66,7 @@ static int mlx4_en_setup_tc(struct net_device *dev, u8 up)
+       return 0;
+ }
++#endif
+ static int mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
+ {
+@@ -179,7 +181,11 @@ static void mlx4_en_clear_list(struct net_device *dev)
+ static void mlx4_en_cache_mclist(struct net_device *dev)
+ {
+       struct mlx4_en_priv *priv = netdev_priv(dev);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+       struct netdev_hw_addr *ha;
++#else
++      struct dev_mc_list *mclist;
++#endif
+       char *mc_addrs;
+       int mc_addrs_cnt = netdev_mc_count(dev);
+       int i;
+@@ -190,8 +196,13 @@ static void mlx4_en_cache_mclist(struct net_device *dev)
+               return;
+       }
+       i = 0;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+       netdev_for_each_mc_addr(ha, dev)
+               memcpy(mc_addrs + i++ * ETH_ALEN, ha->addr, ETH_ALEN);
++#else
++      netdev_for_each_mc_addr(mclist, dev)
++              memcpy(mc_addrs + i++ * ETH_ALEN, mclist->dmi_addr, ETH_ALEN);
++#endif
+       mlx4_en_clear_list(dev);
+       priv->mc_addrs = mc_addrs;
+       priv->mc_addrs_cnt = mc_addrs_cnt;
+@@ -1044,6 +1055,7 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
+       return 0;
+ }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ static int mlx4_en_set_features(struct net_device *netdev,
+               netdev_features_t features)
+ {
+@@ -1058,6 +1070,7 @@ static int mlx4_en_set_features(struct net_device *netdev,
+       return 0;
+ }
++#endif
+ static const struct net_device_ops mlx4_netdev_ops = {
+       .ndo_open               = mlx4_en_open,
+@@ -1075,8 +1088,10 @@ static const struct net_device_ops mlx4_netdev_ops = {
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = mlx4_en_netpoll,
+ #endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+       .ndo_set_features       = mlx4_en_set_features,
+       .ndo_setup_tc           = mlx4_en_setup_tc,
++#endif
+ };
+ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
+@@ -1182,6 +1197,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
+       /*
+        * Set driver features
+        */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+       dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+       if (mdev->LSO_support)
+               dev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
+@@ -1193,6 +1209,19 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
+                       NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
+                       NETIF_F_HW_VLAN_FILTER;
+       dev->hw_features |= NETIF_F_LOOPBACK;
++#else
++      dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
++      if (mdev->LSO_support)
++              dev->features |= NETIF_F_TSO | NETIF_F_TSO6;
++
++      dev->vlan_features = dev->features;
++
++      dev->features |= NETIF_F_RXCSUM | NETIF_F_RXHASH;
++      dev->features |= NETIF_F_HIGHDMA |
++                      NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
++                      NETIF_F_HW_VLAN_FILTER;
++      dev->features |= NETIF_F_LOOPBACK;
++#endif
+       mdev->pndev[port] = dev;
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+index d49a7ac..ae1c6a9 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+@@ -44,7 +44,11 @@
+ static int mlx4_en_alloc_frag(struct mlx4_en_priv *priv,
+                             struct mlx4_en_rx_desc *rx_desc,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+                             struct page_frag *skb_frags,
++#else
++                            struct skb_frag_struct *skb_frags,
++#endif
+                             struct mlx4_en_rx_alloc *ring_alloc,
+                             int i)
+ {
+@@ -60,7 +64,11 @@ static int mlx4_en_alloc_frag(struct mlx4_en_priv *priv,
+                       return -ENOMEM;
+               skb_frags[i].page = page_alloc->page;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+               skb_frags[i].offset = page_alloc->offset;
++#else
++              skb_frags[i].page_offset = page_alloc->offset;
++#endif
+               page_alloc->page = page;
+               page_alloc->offset = frag_info->frag_align;
+       } else {
+@@ -68,11 +76,19 @@ static int mlx4_en_alloc_frag(struct mlx4_en_priv *priv,
+               get_page(page);
+               skb_frags[i].page = page;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+               skb_frags[i].offset = page_alloc->offset;
++#else
++              skb_frags[i].page_offset = page_alloc->offset;
++#endif
+               page_alloc->offset += frag_info->frag_stride;
+       }
+       dma = dma_map_single(priv->ddev, page_address(skb_frags[i].page) +
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+                            skb_frags[i].offset, frag_info->frag_size,
++#else
++                           skb_frags[i].page_offset, frag_info->frag_size,
++#endif
+                            PCI_DMA_FROMDEVICE);
+       rx_desc->data[i].addr = cpu_to_be64(dma);
+       return 0;
+@@ -156,8 +172,13 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv,
+                                  struct mlx4_en_rx_ring *ring, int index)
+ {
+       struct mlx4_en_rx_desc *rx_desc = ring->buf + (index * ring->stride);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+       struct page_frag *skb_frags = ring->rx_info +
+                                     (index << priv->log_rx_info);
++#else
++      struct skb_frag_struct *skb_frags = ring->rx_info +
++                                          (index << priv->log_rx_info);
++#endif
+       int i;
+       for (i = 0; i < priv->num_frags; i++)
+@@ -185,7 +206,11 @@ static void mlx4_en_free_rx_desc(struct mlx4_en_priv *priv,
+                                struct mlx4_en_rx_ring *ring,
+                                int index)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+       struct page_frag *skb_frags;
++#else
++      struct skb_frag_struct *skb_frags;
++#endif
+       struct mlx4_en_rx_desc *rx_desc = ring->buf + (index << ring->log_stride);
+       dma_addr_t dma;
+       int nr;
+@@ -196,8 +221,13 @@ static void mlx4_en_free_rx_desc(struct mlx4_en_priv *priv,
+               dma = be64_to_cpu(rx_desc->data[nr].addr);
+               en_dbg(DRV, priv, "Unmapping buffer at dma:0x%llx\n", (u64) dma);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+               dma_unmap_single(priv->ddev, dma, skb_frags[nr].size,
+                                PCI_DMA_FROMDEVICE);
++#else
++              dma_unmap_single(priv->ddev, dma, skb_frag_size(&skb_frags[nr]),
++                               PCI_DMA_FROMDEVICE);
++#endif
+               put_page(skb_frags[nr].page);
+       }
+ }
+@@ -404,7 +434,11 @@ void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,
+ /* Unmap a completed descriptor and free unused pages */
+ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
+                                   struct mlx4_en_rx_desc *rx_desc,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+                                   struct page_frag *skb_frags,
++#else
++                                  struct skb_frag_struct *skb_frags,
++#endif
+                                   struct sk_buff *skb,
+                                   struct mlx4_en_rx_alloc *page_alloc,
+                                   int length)
+@@ -421,9 +455,15 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
+                       break;
+               /* Save page reference in skb */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+               __skb_frag_set_page(&skb_frags_rx[nr], skb_frags[nr].page);
+               skb_frag_size_set(&skb_frags_rx[nr], skb_frags[nr].size);
+               skb_frags_rx[nr].page_offset = skb_frags[nr].offset;
++#else
++              skb_frags_rx[nr].page = skb_frags[nr].page;
++              skb_frag_size_set(&skb_frags_rx[nr], skb_frag_size(&skb_frags[nr]));
++              skb_frags_rx[nr].page_offset = skb_frags[nr].page_offset;
++#endif
+               skb->truesize += frag_info->frag_stride;
+               dma = be64_to_cpu(rx_desc->data[nr].addr);
+@@ -454,7 +494,11 @@ fail:
+ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
+                                     struct mlx4_en_rx_desc *rx_desc,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+                                     struct page_frag *skb_frags,
++#else
++                                    struct skb_frag_struct *skb_frags,
++#endif
+                                     struct mlx4_en_rx_alloc *page_alloc,
+                                     unsigned int length)
+ {
+@@ -473,7 +517,11 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
+       /* Get pointer to first fragment so we could copy the headers into the
+        * (linear part of the) skb */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+       va = page_address(skb_frags[0].page) + skb_frags[0].offset;
++#else
++      va = page_address(skb_frags[0].page) + skb_frags[0].page_offset;
++#endif
+       if (length <= SMALL_PACKET_SIZE) {
+               /* We are copying all relevant data to the skb - temporarily
+@@ -531,7 +579,11 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
+       struct mlx4_en_priv *priv = netdev_priv(dev);
+       struct mlx4_cqe *cqe;
+       struct mlx4_en_rx_ring *ring = &priv->rx_ring[cq->ring];
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+       struct page_frag *skb_frags;
++#else
++      struct skb_frag_struct *skb_frags;
++#endif
+       struct mlx4_en_rx_desc *rx_desc;
+       struct sk_buff *skb;
+       int index;
+@@ -580,7 +632,11 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
+               /* Get pointer to first fragment since we haven't skb yet and
+                * cast it to ethhdr struct */
+               ethh = (struct ethhdr *)(page_address(skb_frags[0].page) +
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+                                        skb_frags[0].offset);
++#else
++                                       skb_frags[0].page_offset);
++#endif
+               s_mac = mlx4_en_mac_to_u64(ethh->h_source);
+               /* If source MAC is equal to our own MAC and not performing
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+index 019d856..5a2bddd 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+@@ -529,7 +529,11 @@ u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb)
+       u16 rings_p_up = priv->mdev->profile.num_tx_rings_p_up;
+       u8 up = 0;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+       if (dev->num_tc)
++#else
++      if (netdev_get_num_tc(dev))
++#endif
+               return skb_tx_hash(dev, skb);
+       if (vlan_tx_tag_present(skb))
+-- 
+1.7.0.4
+