diff options
author | Varun Prakash <varun@chelsio.com> | 2016-09-13 11:54:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-15 20:49:20 -0400 |
commit | a1a234542b7817c28770ad4e80be1bf69e6a4f86 (patch) | |
tree | 98ceeb893034c8504f40aa0ed91f32c330aeec48 | |
parent | cc516700c7edab4197d08998ac023c3043369391 (diff) |
libcxgb,iw_cxgb4,cxgbit: add cxgb_mk_tid_release()
Add cxgb_mk_tid_release() to remove duplicate code
to form CPL_TID_RELEASE hardware command.
Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cm.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h | 13 | ||||
-rw-r--r-- | drivers/target/iscsi/cxgbit/cxgbit_cm.c | 11 |
3 files changed, 19 insertions, 15 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index b9d77df0a2f6..b818bd6d1fb5 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -240,15 +240,13 @@ int c4iw_ofld_send(struct c4iw_rdev *rdev, struct sk_buff *skb) | |||
240 | 240 | ||
241 | static void release_tid(struct c4iw_rdev *rdev, u32 hwtid, struct sk_buff *skb) | 241 | static void release_tid(struct c4iw_rdev *rdev, u32 hwtid, struct sk_buff *skb) |
242 | { | 242 | { |
243 | struct cpl_tid_release *req; | 243 | u32 len = roundup(sizeof(struct cpl_tid_release), 16); |
244 | 244 | ||
245 | skb = get_skb(skb, sizeof *req, GFP_KERNEL); | 245 | skb = get_skb(skb, len, GFP_KERNEL); |
246 | if (!skb) | 246 | if (!skb) |
247 | return; | 247 | return; |
248 | req = (struct cpl_tid_release *) skb_put(skb, sizeof(*req)); | 248 | |
249 | INIT_TP_WR(req, hwtid); | 249 | cxgb_mk_tid_release(skb, len, hwtid, 0); |
250 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid)); | ||
251 | set_wr_txq(skb, CPL_PRIORITY_SETUP, 0); | ||
252 | c4iw_ofld_send(rdev, skb); | 250 | c4iw_ofld_send(rdev, skb); |
253 | return; | 251 | return; |
254 | } | 252 | } |
diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h index ecf3baa940b9..fbb973e9ec29 100644 --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h | |||
@@ -83,4 +83,17 @@ static inline u32 cxgb_compute_wscale(u32 win) | |||
83 | wscale++; | 83 | wscale++; |
84 | return wscale; | 84 | return wscale; |
85 | } | 85 | } |
86 | |||
87 | static inline void | ||
88 | cxgb_mk_tid_release(struct sk_buff *skb, u32 len, u32 tid, u16 chan) | ||
89 | { | ||
90 | struct cpl_tid_release *req; | ||
91 | |||
92 | req = (struct cpl_tid_release *)__skb_put(skb, len); | ||
93 | memset(req, 0, len); | ||
94 | |||
95 | INIT_TP_WR(req, tid); | ||
96 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_TID_RELEASE, tid)); | ||
97 | set_wr_txq(skb, CPL_PRIORITY_SETUP, chan); | ||
98 | } | ||
86 | #endif | 99 | #endif |
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c index cd29c91d01fc..994058f0c4e0 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c | |||
@@ -961,21 +961,14 @@ int cxgbit_ofld_send(struct cxgbit_device *cdev, struct sk_buff *skb) | |||
961 | 961 | ||
962 | static void cxgbit_release_tid(struct cxgbit_device *cdev, u32 tid) | 962 | static void cxgbit_release_tid(struct cxgbit_device *cdev, u32 tid) |
963 | { | 963 | { |
964 | struct cpl_tid_release *req; | 964 | u32 len = roundup(sizeof(struct cpl_tid_release), 16); |
965 | unsigned int len = roundup(sizeof(*req), 16); | ||
966 | struct sk_buff *skb; | 965 | struct sk_buff *skb; |
967 | 966 | ||
968 | skb = alloc_skb(len, GFP_ATOMIC); | 967 | skb = alloc_skb(len, GFP_ATOMIC); |
969 | if (!skb) | 968 | if (!skb) |
970 | return; | 969 | return; |
971 | 970 | ||
972 | req = (struct cpl_tid_release *)__skb_put(skb, len); | 971 | cxgb_mk_tid_release(skb, len, tid, 0); |
973 | memset(req, 0, len); | ||
974 | |||
975 | INIT_TP_WR(req, tid); | ||
976 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID( | ||
977 | CPL_TID_RELEASE, tid)); | ||
978 | set_wr_txq(skb, CPL_PRIORITY_SETUP, 0); | ||
979 | cxgbit_ofld_send(cdev, skb); | 972 | cxgbit_ofld_send(cdev, skb); |
980 | } | 973 | } |
981 | 974 | ||