From: Kumar Sanghvi Date: Tue, 24 Dec 2013 18:57:24 +0000 (+0530) Subject: iw_cxgb3: Backports for RHEL6.4, RHEL6.5 and SLES11sp3 X-Git-Tag: compat-rdma-2014-01-30~14 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=e2d43a3febe34d9084d0cef301de34a4b42a214e;p=~emulex%2Fcompat-rdma_3.12.git iw_cxgb3: Backports for RHEL6.4, RHEL6.5 and SLES11sp3 Signed-off-by: Kumar Sanghvi --- 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 index 0000000..2628f13 --- /dev/null +++ b/patches/0008-iw_cxgb3_RHEL64-RHEL65-SLES11SP3-backport.patch @@ -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;