Commit 29fb6f42 authored by Varun Prakash's avatar Varun Prakash Committed by David S. Miller

libcxgb, iw_cxgb4, cxgbit: add cxgb_mk_close_con_req()

Add cxgb_mk_close_con_req() to remove duplicate
code to form CPL_CLOSE_CON_REQ hardware command.
Signed-off-by: default avatarVarun Prakash <varun@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a1a23454
...@@ -637,21 +637,16 @@ static int send_flowc(struct c4iw_ep *ep) ...@@ -637,21 +637,16 @@ static int send_flowc(struct c4iw_ep *ep)
static int send_halfclose(struct c4iw_ep *ep) static int send_halfclose(struct c4iw_ep *ep)
{ {
struct cpl_close_con_req *req;
struct sk_buff *skb = skb_dequeue(&ep->com.ep_skb_list); struct sk_buff *skb = skb_dequeue(&ep->com.ep_skb_list);
int wrlen = roundup(sizeof *req, 16); u32 wrlen = roundup(sizeof(struct cpl_close_con_req), 16);
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
if (WARN_ON(!skb)) if (WARN_ON(!skb))
return -ENOMEM; return -ENOMEM;
set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); cxgb_mk_close_con_req(skb, wrlen, ep->hwtid, ep->txq_idx,
t4_set_arp_err_handler(skb, NULL, arp_failure_discard); NULL, arp_failure_discard);
req = (struct cpl_close_con_req *) skb_put(skb, wrlen);
memset(req, 0, wrlen);
INIT_TP_WR(req, ep->hwtid);
OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_CLOSE_CON_REQ,
ep->hwtid));
return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t);
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <cxgb4.h> #include <cxgb4.h>
#include <t4_msg.h> #include <t4_msg.h>
#include <l2t.h>
void void
cxgb_get_4tuple(struct cpl_pass_accept_req *, enum chip_type, cxgb_get_4tuple(struct cpl_pass_accept_req *, enum chip_type,
...@@ -96,4 +97,19 @@ cxgb_mk_tid_release(struct sk_buff *skb, u32 len, u32 tid, u16 chan) ...@@ -96,4 +97,19 @@ cxgb_mk_tid_release(struct sk_buff *skb, u32 len, u32 tid, u16 chan)
OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_TID_RELEASE, tid)); OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_TID_RELEASE, tid));
set_wr_txq(skb, CPL_PRIORITY_SETUP, chan); set_wr_txq(skb, CPL_PRIORITY_SETUP, chan);
} }
static inline void
cxgb_mk_close_con_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan,
void *handle, arp_err_handler_t handler)
{
struct cpl_close_con_req *req;
req = (struct cpl_close_con_req *)__skb_put(skb, len);
memset(req, 0, len);
INIT_TP_WR(req, tid);
OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, tid));
set_wr_txq(skb, CPL_PRIORITY_DATA, chan);
t4_set_arp_err_handler(skb, handle, handler);
}
#endif #endif
...@@ -615,21 +615,14 @@ void cxgbit_free_np(struct iscsi_np *np) ...@@ -615,21 +615,14 @@ void cxgbit_free_np(struct iscsi_np *np)
static void cxgbit_send_halfclose(struct cxgbit_sock *csk) static void cxgbit_send_halfclose(struct cxgbit_sock *csk)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct cpl_close_con_req *req; u32 len = roundup(sizeof(struct cpl_close_con_req), 16);
unsigned int len = roundup(sizeof(struct cpl_close_con_req), 16);
skb = alloc_skb(len, GFP_ATOMIC); skb = alloc_skb(len, GFP_ATOMIC);
if (!skb) if (!skb)
return; return;
req = (struct cpl_close_con_req *)__skb_put(skb, len); cxgb_mk_close_con_req(skb, len, csk->tid, csk->txq_idx,
memset(req, 0, len); NULL, NULL);
set_wr_txq(skb, CPL_PRIORITY_DATA, csk->txq_idx);
INIT_TP_WR(req, csk->tid);
OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_CLOSE_CON_REQ,
csk->tid));
req->rsvd = 0;
cxgbit_skcb_flags(skb) |= SKCBF_TX_FLAG_COMPL; cxgbit_skcb_flags(skb) |= SKCBF_TX_FLAG_COMPL;
__skb_queue_tail(&csk->txq, skb); __skb_queue_tail(&csk->txq, skb);
......
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