diff options
author | Varun Prakash <varun@chelsio.com> | 2016-09-13 11:54:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-15 20:49:20 -0400 |
commit | 052f4731ed1fd6b132a14c56f49435377a246834 (patch) | |
tree | 1e904169efd9d415d54e18512faec57ec46c5d3a | |
parent | a7e1a97f88058ed9b6aa054b38167fbe62f59f50 (diff) |
libcxgb,iw_cxgb4,cxgbit: add cxgb_mk_abort_rpl()
Add cxgb_mk_abort_rpl() to remove duplicate
code to form CPL_ABORT_RPL 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 | 14 | ||||
-rw-r--r-- | drivers/target/iscsi/cxgbit/cxgbit_cm.c | 11 |
3 files changed, 20 insertions, 15 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 484196e8a49c..a6d5fcb9d8d7 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -2705,12 +2705,12 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2705 | { | 2705 | { |
2706 | struct cpl_abort_req_rss *req = cplhdr(skb); | 2706 | struct cpl_abort_req_rss *req = cplhdr(skb); |
2707 | struct c4iw_ep *ep; | 2707 | struct c4iw_ep *ep; |
2708 | struct cpl_abort_rpl *rpl; | ||
2709 | struct sk_buff *rpl_skb; | 2708 | struct sk_buff *rpl_skb; |
2710 | struct c4iw_qp_attributes attrs; | 2709 | struct c4iw_qp_attributes attrs; |
2711 | int ret; | 2710 | int ret; |
2712 | int release = 0; | 2711 | int release = 0; |
2713 | unsigned int tid = GET_TID(req); | 2712 | unsigned int tid = GET_TID(req); |
2713 | u32 len = roundup(sizeof(struct cpl_abort_rpl), 16); | ||
2714 | 2714 | ||
2715 | ep = get_ep_from_tid(dev, tid); | 2715 | ep = get_ep_from_tid(dev, tid); |
2716 | if (!ep) | 2716 | if (!ep) |
@@ -2809,11 +2809,9 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2809 | release = 1; | 2809 | release = 1; |
2810 | goto out; | 2810 | goto out; |
2811 | } | 2811 | } |
2812 | set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); | 2812 | |
2813 | rpl = (struct cpl_abort_rpl *) skb_put(rpl_skb, sizeof(*rpl)); | 2813 | cxgb_mk_abort_rpl(rpl_skb, len, ep->hwtid, ep->txq_idx); |
2814 | INIT_TP_WR(rpl, ep->hwtid); | 2814 | |
2815 | OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid)); | ||
2816 | rpl->cmd = CPL_ABORT_NO_RST; | ||
2817 | c4iw_ofld_send(&ep->com.dev->rdev, rpl_skb); | 2815 | c4iw_ofld_send(&ep->com.dev->rdev, rpl_skb); |
2818 | out: | 2816 | out: |
2819 | if (release) | 2817 | if (release) |
diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h index 2d3a3bfb1919..70999e8cf4b7 100644 --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h | |||
@@ -128,4 +128,18 @@ cxgb_mk_abort_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan, | |||
128 | set_wr_txq(skb, CPL_PRIORITY_DATA, chan); | 128 | set_wr_txq(skb, CPL_PRIORITY_DATA, chan); |
129 | t4_set_arp_err_handler(skb, handle, handler); | 129 | t4_set_arp_err_handler(skb, handle, handler); |
130 | } | 130 | } |
131 | |||
132 | static inline void | ||
133 | cxgb_mk_abort_rpl(struct sk_buff *skb, u32 len, u32 tid, u16 chan) | ||
134 | { | ||
135 | struct cpl_abort_rpl *rpl; | ||
136 | |||
137 | rpl = (struct cpl_abort_rpl *)__skb_put(skb, len); | ||
138 | memset(rpl, 0, len); | ||
139 | |||
140 | INIT_TP_WR(rpl, tid); | ||
141 | OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, tid)); | ||
142 | rpl->cmd = CPL_ABORT_NO_RST; | ||
143 | set_wr_txq(skb, CPL_PRIORITY_DATA, chan); | ||
144 | } | ||
131 | #endif | 145 | #endif |
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c index f2b737e6fa6a..9bdbe3b84e19 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c | |||
@@ -1642,11 +1642,10 @@ static void cxgbit_abort_req_rss(struct cxgbit_sock *csk, struct sk_buff *skb) | |||
1642 | { | 1642 | { |
1643 | struct cpl_abort_req_rss *hdr = cplhdr(skb); | 1643 | struct cpl_abort_req_rss *hdr = cplhdr(skb); |
1644 | unsigned int tid = GET_TID(hdr); | 1644 | unsigned int tid = GET_TID(hdr); |
1645 | struct cpl_abort_rpl *rpl; | ||
1646 | struct sk_buff *rpl_skb; | 1645 | struct sk_buff *rpl_skb; |
1647 | bool release = false; | 1646 | bool release = false; |
1648 | bool wakeup_thread = false; | 1647 | bool wakeup_thread = false; |
1649 | unsigned int len = roundup(sizeof(*rpl), 16); | 1648 | u32 len = roundup(sizeof(struct cpl_abort_rpl), 16); |
1650 | 1649 | ||
1651 | pr_debug("%s: csk %p; tid %u; state %d\n", | 1650 | pr_debug("%s: csk %p; tid %u; state %d\n", |
1652 | __func__, csk, tid, csk->com.state); | 1651 | __func__, csk, tid, csk->com.state); |
@@ -1686,14 +1685,8 @@ static void cxgbit_abort_req_rss(struct cxgbit_sock *csk, struct sk_buff *skb) | |||
1686 | cxgbit_send_tx_flowc_wr(csk); | 1685 | cxgbit_send_tx_flowc_wr(csk); |
1687 | 1686 | ||
1688 | rpl_skb = __skb_dequeue(&csk->skbq); | 1687 | rpl_skb = __skb_dequeue(&csk->skbq); |
1689 | set_wr_txq(skb, CPL_PRIORITY_DATA, csk->txq_idx); | ||
1690 | |||
1691 | rpl = (struct cpl_abort_rpl *)__skb_put(rpl_skb, len); | ||
1692 | memset(rpl, 0, len); | ||
1693 | 1688 | ||
1694 | INIT_TP_WR(rpl, csk->tid); | 1689 | cxgb_mk_abort_rpl(rpl_skb, len, csk->tid, csk->txq_idx); |
1695 | OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, tid)); | ||
1696 | rpl->cmd = CPL_ABORT_NO_RST; | ||
1697 | cxgbit_ofld_send(csk->com.cdev, rpl_skb); | 1690 | cxgbit_ofld_send(csk->com.cdev, rpl_skb); |
1698 | 1691 | ||
1699 | if (wakeup_thread) { | 1692 | if (wakeup_thread) { |