]> git.openfabrics.org - ~emulex/compat-rdma_3.12.git/commitdiff
iw_cxgb3: Backports for RHEL6.4, RHEL6.5 and SLES11sp3
authorKumar Sanghvi <kumaras@chelsio.com>
Tue, 24 Dec 2013 18:57:24 +0000 (00:27 +0530)
committerVipul Pandya <vipul@chelsio.com>
Thu, 26 Dec 2013 10:08:03 +0000 (02:08 -0800)
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
patches/0008-iw_cxgb3_RHEL64-RHEL65-SLES11SP3-backport.patch [new file with mode: 0644]

diff --git a/patches/0008-iw_cxgb3_RHEL64-RHEL65-SLES11SP3-backport.patch b/patches/0008-iw_cxgb3_RHEL64-RHEL65-SLES11SP3-backport.patch
new file mode 100644 (file)
index 0000000..2628f13
--- /dev/null
@@ -0,0 +1,110 @@
+diff --git a/drivers/infiniband/hw/cxgb3/iwch.h b/drivers/infiniband/hw/cxgb3/iwch.h
+index 8378622..470527f 100644
+--- a/drivers/infiniband/hw/cxgb3/iwch.h
++++ b/drivers/infiniband/hw/cxgb3/iwch.h
+@@ -153,7 +153,7 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr,
+                               void *handle, u32 id)
+ {
+       int ret;
+-
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+       idr_preload(GFP_KERNEL);
+       spin_lock_irq(&rhp->lock);
+@@ -164,6 +164,21 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr,
+       BUG_ON(ret == -ENOSPC);
+       return ret < 0 ? ret : 0;
++#else
++      int newid;
++
++      do {
++              if (!idr_pre_get(idr, GFP_KERNEL)) {
++                      return -ENOMEM;
++              }
++              spin_lock_irq(&rhp->lock);
++              ret = idr_get_new_above(idr, handle, id, &newid);
++              BUG_ON(newid != id);
++              spin_unlock_irq(&rhp->lock);
++      } while (ret == -EAGAIN);
++
++      return ret;
++#endif
+ }
+ static inline void remove_handle(struct iwch_dev *rhp, struct idr *idr, u32 id)
+diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
+index 095bb04..320ea47 100644
+--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
++++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
+@@ -337,12 +337,33 @@ static struct rtable *find_route(struct t3cdev *dev, __be32 local_ip,
+                                __be16 peer_port, u8 tos)
+ {
+       struct rtable *rt;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+       struct flowi4 fl4;
+       rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip,
+                                  peer_port, local_port, IPPROTO_TCP,
+                                  tos, 0);
+       if (IS_ERR(rt))
++#else
++      struct flowi fl = {
++              .oif = 0,
++              .nl_u = {
++                      .ip4_u = {
++                              .daddr = peer_ip,
++                              .saddr = local_ip,
++                              .tos = tos
++                      }
++              },
++              .proto = IPPROTO_TCP,
++              .uli_u = {
++                      .ports = {
++                              .sport = local_port,
++                              .dport = peer_port
++                      }
++              }
++      };
++      if (ip_route_output_flow(&init_net, &rt, &fl, NULL, false))
++#endif
+               return NULL;
+       return rt;
+ }
+@@ -1376,8 +1397,17 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
+                      __func__);
+               goto reject;
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       dst = &rt->dst;
++#else
++      dst = &rt->u.dst;
++#endif
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
+       l2t = t3_l2t_get(tdev, dst, NULL, &req->peer_ip);
++#else
++      l2t = t3_l2t_get(tdev, dst, NULL);
++#endif
+       if (!l2t) {
+               printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n",
+                      __func__);
+@@ -1949,9 +1979,18 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
+               err = -EHOSTUNREACH;
+               goto fail3;
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+       ep->dst = &rt->dst;
++#else
++      ep->dst = &rt->u.dst;
++#endif
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
+       ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL,
+                            &raddr->sin_addr.s_addr);
++#else
++      ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL);
++#endif
+       if (!ep->l2t) {
+               printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__);
+               err = -ENOMEM;