Commit 052f4731 authored by Varun Prakash's avatar Varun Prakash Committed by David S. Miller

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: default avatarVarun Prakash <varun@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a7e1a97f
...@@ -2705,12 +2705,12 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2705,12 +2705,12 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb)
{ {
struct cpl_abort_req_rss *req = cplhdr(skb); struct cpl_abort_req_rss *req = cplhdr(skb);
struct c4iw_ep *ep; struct c4iw_ep *ep;
struct cpl_abort_rpl *rpl;
struct sk_buff *rpl_skb; struct sk_buff *rpl_skb;
struct c4iw_qp_attributes attrs; struct c4iw_qp_attributes attrs;
int ret; int ret;
int release = 0; int release = 0;
unsigned int tid = GET_TID(req); unsigned int tid = GET_TID(req);
u32 len = roundup(sizeof(struct cpl_abort_rpl), 16);
ep = get_ep_from_tid(dev, tid); ep = get_ep_from_tid(dev, tid);
if (!ep) if (!ep)
...@@ -2809,11 +2809,9 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2809,11 +2809,9 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb)
release = 1; release = 1;
goto out; goto out;
} }
set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx);
rpl = (struct cpl_abort_rpl *) skb_put(rpl_skb, sizeof(*rpl)); cxgb_mk_abort_rpl(rpl_skb, len, ep->hwtid, ep->txq_idx);
INIT_TP_WR(rpl, ep->hwtid);
OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid));
rpl->cmd = CPL_ABORT_NO_RST;
c4iw_ofld_send(&ep->com.dev->rdev, rpl_skb); c4iw_ofld_send(&ep->com.dev->rdev, rpl_skb);
out: out:
if (release) if (release)
......
...@@ -128,4 +128,18 @@ cxgb_mk_abort_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan, ...@@ -128,4 +128,18 @@ cxgb_mk_abort_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan,
set_wr_txq(skb, CPL_PRIORITY_DATA, chan); set_wr_txq(skb, CPL_PRIORITY_DATA, chan);
t4_set_arp_err_handler(skb, handle, handler); t4_set_arp_err_handler(skb, handle, handler);
} }
static inline void
cxgb_mk_abort_rpl(struct sk_buff *skb, u32 len, u32 tid, u16 chan)
{
struct cpl_abort_rpl *rpl;
rpl = (struct cpl_abort_rpl *)__skb_put(skb, len);
memset(rpl, 0, len);
INIT_TP_WR(rpl, tid);
OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, tid));
rpl->cmd = CPL_ABORT_NO_RST;
set_wr_txq(skb, CPL_PRIORITY_DATA, chan);
}
#endif #endif
...@@ -1642,11 +1642,10 @@ static void cxgbit_abort_req_rss(struct cxgbit_sock *csk, struct sk_buff *skb) ...@@ -1642,11 +1642,10 @@ static void cxgbit_abort_req_rss(struct cxgbit_sock *csk, struct sk_buff *skb)
{ {
struct cpl_abort_req_rss *hdr = cplhdr(skb); struct cpl_abort_req_rss *hdr = cplhdr(skb);
unsigned int tid = GET_TID(hdr); unsigned int tid = GET_TID(hdr);
struct cpl_abort_rpl *rpl;
struct sk_buff *rpl_skb; struct sk_buff *rpl_skb;
bool release = false; bool release = false;
bool wakeup_thread = false; bool wakeup_thread = false;
unsigned int len = roundup(sizeof(*rpl), 16); u32 len = roundup(sizeof(struct cpl_abort_rpl), 16);
pr_debug("%s: csk %p; tid %u; state %d\n", pr_debug("%s: csk %p; tid %u; state %d\n",
__func__, csk, tid, csk->com.state); __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,14 +1685,8 @@ static void cxgbit_abort_req_rss(struct cxgbit_sock *csk, struct sk_buff *skb)
cxgbit_send_tx_flowc_wr(csk); cxgbit_send_tx_flowc_wr(csk);
rpl_skb = __skb_dequeue(&csk->skbq); rpl_skb = __skb_dequeue(&csk->skbq);
set_wr_txq(skb, CPL_PRIORITY_DATA, csk->txq_idx);
rpl = (struct cpl_abort_rpl *)__skb_put(rpl_skb, len);
memset(rpl, 0, len);
INIT_TP_WR(rpl, csk->tid); cxgb_mk_abort_rpl(rpl_skb, len, csk->tid, csk->txq_idx);
OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, tid));
rpl->cmd = CPL_ABORT_NO_RST;
cxgbit_ofld_send(csk->com.cdev, rpl_skb); cxgbit_ofld_send(csk->com.cdev, rpl_skb);
if (wakeup_thread) { if (wakeup_thread) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment