cxgbi: bug fixes and code cleanup
Subsystems (5)
PATCH 1/1 cxgbi: bug fixes and code cleanup
[PATCH] cxgbi: bug fixes and code cleanup
From: Karen Xie <[email protected]>
The patch includes the following changes.
- removed un-used code
- renamed alloc_cpl() to alloc_wr().
- fixed connecting over VLAN.
- updated cxgb4i connection setting and pagepod programming.
---
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 65 ++++++++++++++----- drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 126 +++++++++++++++++++----------------- drivers/scsi/cxgbi/cxgb4i/cxgb4i.h | 5 + drivers/scsi/cxgbi/libcxgbi.c | 94 +++++++++++++-------------- drivers/scsi/cxgbi/libcxgbi.h | 18 +---- 5 files changed, 172 insertions(+), 136 deletions(-)
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +49 -16
@@ -320,7 +320,7 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 credits)"csk 0x%p,%u,0x%lx,%u, credit %u, dack %u.\n" , csk, csk->state, csk->flags, csk->tid, credits, dack); - skb =alloc_cpl (sizeof (*req),0 ,GFP_ATOMIC ); + skb =alloc_wr (sizeof (*req),0 ,GFP_ATOMIC );if (!skb) {pr_info ("csk 0x%p, credit %u, OOM.\n" , csk, credits);return 0 ;
@@ -572,7 +572,7 @@ static void act_open_retry_timer(unsigned long data)cxgbi_sock_get (csk);spin_lock_bh (&csk->lock); - skb =alloc_cpl (sizeof (struct cpl_act_open_req ),0 ,GFP_ATOMIC ); + skb =alloc_wr (sizeof (struct cpl_act_open_req ),0 ,GFP_ATOMIC );if (!skb)cxgbi_sock_fail_act_open (csk, -ENOMEM );else {
@@ -589,9 +589,10 @@ static int do_act_open_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)struct cxgbi_sock *csk = ctx;struct cpl_act_open_rpl *rpl =cplhdr (skb); -log_debug (1 <<CXGBI_DBG_TOE |1 <<CXGBI_DBG_SOCK , -"csk 0x%p,%u,0x%lx,%u, status %u.\n" , - csk, csk->state, csk->flags, csk->atid, rpl->status); +pr_info ("csk 0x%p,%u,0x%lx,%u, status %u, %pI4:%u-%pI4:%u.\n" , + csk, csk->state, csk->flags, csk->atid, rpl->status, + &csk->saddr.sin_addr.s_addr,ntohs (csk->saddr.sin_port), + &csk->daddr.sin_addr.s_addr,ntohs (csk->daddr.sin_port)); if (rpl->status != CPL_ERR_TCAM_FULL && rpl->status != CPL_ERR_CONN_EXIST &&
@@ -662,8 +663,7 @@ static int abort_status_to_errno(struct cxgbi_sock *csk, int abort_reason,switch (abort_reason) {case CPL_ERR_BAD_SYN :/* fall through */ case CPL_ERR_CONN_RESET : -return csk->state >CTP_ESTABLISHED ? - -EPIPE : -ECONNRESET ; +return csk->state >CTP_ESTABLISHED ? -EPIPE : -ECONNRESET ;case CPL_ERR_XMIT_TIMEDOUT :case CPL_ERR_PERSIST_TIMEDOUT :case CPL_ERR_FINWAIT2_TIMEDOUT :
@@ -881,16 +881,16 @@ static int do_wr_ack(struct t3cdev *cdev, struct sk_buff *skb, void *ctx)*/ static int alloc_cpls (struct cxgbi_sock *csk) { - csk->cpl_close =alloc_cpl (sizeof (struct cpl_close_con_req ),0 , + csk->cpl_close =alloc_wr (sizeof (struct cpl_close_con_req ),0 ,GFP_KERNEL );if (!csk->cpl_close)return -ENOMEM ; - csk->cpl_abort_req =alloc_cpl (sizeof (struct cpl_abort_req ),0 , + csk->cpl_abort_req =alloc_wr (sizeof (struct cpl_abort_req ),0 ,GFP_KERNEL );if (!csk->cpl_abort_req) goto free_cpl_skbs; - csk->cpl_abort_rpl =alloc_cpl (sizeof (struct cpl_abort_rpl ),0 , + csk->cpl_abort_rpl =alloc_wr (sizeof (struct cpl_abort_rpl ),0 ,GFP_KERNEL );if (!csk->cpl_abort_rpl) goto free_cpl_skbs;
@@ -945,17 +945,44 @@ static void release_offload_resources(struct cxgbi_sock *csk) csk->cdev =NULL ; } +static void update_address (struct cxgbi_hba *chba) +{ +if (chba->ipv4addr) { +if (chba->vdev && + chba->ipv4addr !=cxgb3i_get_private_ipv4addr (chba->vdev)) { +cxgb3i_set_private_ipv4addr (chba->vdev, chba->ipv4addr); +cxgb3i_set_private_ipv4addr (chba->ndev,0 ); +pr_info ("%s set %pI4.\n" , + chba->vdev->name, &chba->ipv4addr); + }else if (chba->ipv4addr != +cxgb3i_get_private_ipv4addr (chba->ndev)) { +cxgb3i_set_private_ipv4addr (chba->ndev, chba->ipv4addr); +pr_info ("%s set %pI4.\n" , + chba->ndev->name, &chba->ipv4addr); + } + }else if (cxgb3i_get_private_ipv4addr (chba->ndev)) { +if (chba->vdev) +cxgb3i_set_private_ipv4addr (chba->vdev,0 ); +cxgb3i_set_private_ipv4addr (chba->ndev,0 ); + } +} +static int init_act_open (struct cxgbi_sock *csk) {struct dst_entry *dst = csk->dst;struct cxgbi_device *cdev = csk->cdev;struct t3cdev *t3dev = (struct t3cdev *)cdev->lldev;struct net_device *ndev = cdev->ports[csk->port_id]; +struct cxgbi_hba *chba = cdev->hbas[csk->port_id];struct sk_buff *skb =NULL ;log_debug (1 <<CXGBI_DBG_TOE |1 <<CXGBI_DBG_SOCK ,"csk 0x%p,%u,0x%lx.\n" , csk, csk->state, csk->flags); +update_address (chba); +if (chba->ipv4addr) + csk->saddr.sin_addr.s_addr = chba->ipv4addr; + csk->rss_qid =0 ; csk->l2t =t3_l2t_get (t3dev, dst->neighbour, ndev);if (!csk->l2t) {
@@ -972,7 +999,7 @@ static int init_act_open(struct cxgbi_sock *csk)cxgbi_sock_set_flag (csk,CTPF_HAS_ATID );cxgbi_sock_get (csk); - skb =alloc_cpl (sizeof (struct cpl_act_open_req ),0 ,GFP_KERNEL ); + skb =alloc_wr (sizeof (struct cpl_act_open_req ),0 ,GFP_KERNEL );if (!skb) goto rel_resource; skb->sk = (struct sock *)csk;
@@ -984,6 +1011,12 @@ static int init_act_open(struct cxgbi_sock *csk)cxgbi_sock_reset_wr_list (csk); csk->err =0 ; +log_debug (1 <<CXGBI_DBG_TOE |1 <<CXGBI_DBG_SOCK , +"csk 0x%p,%u,0x%lx, %pI4:%u-%pI4:%u.\n" , + csk, csk->state, csk->flags, + &csk->saddr.sin_addr.s_addr,ntohs (csk->saddr.sin_port), + &csk->daddr.sin_addr.s_addr,ntohs (csk->daddr.sin_port)); +cxgbi_sock_set_state (csk,CTP_ACTIVE_OPEN );send_act_open_req (csk, skb, csk->l2t);return 0 ;
@@ -1141,11 +1174,11 @@ static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx, "ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt);for (i =0 ; i < cnt; i++) { -struct sk_buff *skb =alloc_cpl (sizeof (struct ulp_mem_io ) + +struct sk_buff *skb =alloc_wr (sizeof (struct ulp_mem_io ) +PPOD_SIZE ,0 , gfp); -if (skb) { +if (skb) ddp->gl_skb[idx + i] = skb; - }else { +else {ddp_free_gl_skb (ddp, idx, i);return -ENOMEM ; }
@@ -1156,7 +1189,7 @@ static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx,static int ddp_setup_conn_pgidx (struct cxgbi_sock *csk,unsigned int tid,int pg_idx,bool reply) { -struct sk_buff *skb =alloc_cpl (sizeof (struct cpl_set_tcb_field ),0 , +struct sk_buff *skb =alloc_wr (sizeof (struct cpl_set_tcb_field ),0 ,GFP_KERNEL );struct cpl_set_tcb_field *req;u64 val = pg_idx <DDP_PGIDX_MAX ? pg_idx :0 ;
@@ -1193,7 +1226,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,static int ddp_setup_conn_digest (struct cxgbi_sock *csk,unsigned int tid,int hcrc,int dcrc,int reply) { -struct sk_buff *skb =alloc_cpl (sizeof (struct cpl_set_tcb_field ),0 , +struct sk_buff *skb =alloc_wr (sizeof (struct cpl_set_tcb_field ),0 ,GFP_KERNEL );struct cpl_set_tcb_field *req;u64 val = (hcrc ?1 :0 ) | (dcrc ?2 :0 );
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +66 -60
275 lines not on this page · raw message
drivers/scsi/cxgbi/cxgb4i/cxgb4i.h +5 -0
@@ -23,6 +23,11 @@#define CXGB4I_TX_HEADER_LEN \ (sizeof(struct fw_ofld_tx_data_wr) + sizeof(struct sge_opaque_hdr)) +struct ulptx_idata { +__be32 cmd_more; +__be32 len; +}; +struct cpl_rx_data_ddp {union opcode_tid ot;__be16 urg;
drivers/scsi/cxgbi/libcxgbi.c +47 -47
212 lines not on this page · raw message
drivers/scsi/cxgbi/libcxgbi.h +5 -13
@@ -162,16 +162,6 @@ struct cxgbi_ddp_info {#define PPOD_VALID (x) ((x) << PPOD_VALID_SHIFT)#define PPOD_VALID_FLAG PPOD_VALID(1U) -#define W_TCB_ULP_TYPE 0 -#define TCB_ULP_TYPE_SHIFT 0 -#define TCB_ULP_TYPE_MASK 0xfULL -#define TCB_ULP_TYPE (x) ((x) << TCB_ULP_TYPE_SHIFT) - -#define W_TCB_ULP_RAW 0 -#define TCB_ULP_RAW_SHIFT 4 -#define TCB_ULP_RAW_MASK 0xffULL -#define TCB_ULP_RAW (x) ((x) << TCB_ULP_RAW_SHIFT) -/* * sge_opaque_hdr - * Opaque version of structure the SGE stores at skb->head of TX_DATA packets
@@ -410,16 +400,15 @@ static inline unsigned int cxgbi_sock_compute_wscale(unsigned int win)return wscale; } -static inline struct sk_buff *alloc_cpl (int cpl_len,int dlen,gfp_t gfp) +static inline struct sk_buff *alloc_wr (int wrlen,int dlen,gfp_t gfp) { -int wrlen =roundup (cpl_len,16 );struct sk_buff *skb =alloc_skb (wrlen + dlen, gfp);if (skb) {__skb_put (skb, wrlen);memset (skb->head,0 , wrlen + dlen); }else -pr_info ("alloc cpl skb %u+%u, OOM.\n" , cpl_len, dlen); +pr_info ("alloc cpl wr skb %u+%u, OOM.\n" , wrlen, dlen);return skb; }
@@ -501,6 +490,7 @@ void cxgbi_sock_free_cpl_skbs(struct cxgbi_sock *);struct cxgbi_hba {struct net_device *ndev; +struct net_device *vdev;/* vlan dev */ struct Scsi_Host *shost;struct cxgbi_device *cdev;__be32 ipv4addr;
@@ -593,6 +583,8 @@ struct cxgbi_task_data {unsigned int count;unsigned int sgoffset; }; +#define iscsi_task_cxgbi_data (task) \ + ((task)->dd_data + sizeof(struct iscsi_tcp_task))static inline int cxgbi_is_ddp_tag (struct cxgbi_tag_format *tformat,u32 tag) {
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Quoted 9 lines · On 09/21/2010 11:09 AM, [email protected] wrote:
[PATCH] cxgbi: bug fixes and code cleanup
From: Karen Xie<[email protected]>
The patch includes the following changes.
- removed un-used code
- renamedalloc_cpl()toalloc_wr().
- fixed connecting over VLAN.
- updated cxgb4i connection setting and pagepod programming.
Could you break up the patch into a patch per change next time?
drivers/scsi/cxgbi/libcxgbi.c void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) · line 1750
Quoted 4 lines
drivers/scsi/cxgbi/libcxgbi.c +0
-1-read_lock (&csk->callback_lock); dskb =skb_peek (&csk->receive_queue);if (!dskb) {read_unlock (&csk->callback_lock);
I think you also have to remove this read_unlock call.
Thanks, Mike.
I will fix the patch and break it into per change. Karen
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Wednesday, September 22, 2010 1:10 PM
To: Karen Xie
Cc: [email protected]; [email protected]; [email protected]; Rakesh Ranjan; [email protected]; [email protected]
Subject: Re: [PATCH] cxgbi: bug fixes and code cleanup
Quoted 9 lines · On 09/21/2010 11:09 AM, [email protected] wrote:
[PATCH] cxgbi: bug fixes and code cleanup
From: Karen Xie<[email protected]>
The patch includes the following changes.
- removed un-used code
- renamedalloc_cpl()toalloc_wr().
- fixed connecting over VLAN.
- updated cxgb4i connection setting and pagepod programming.
Could you break up the patch into a patch per change next time?
drivers/scsi/cxgbi/libcxgbi.c void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) · line 1749
Quoted 4 lines
drivers/scsi/cxgbi/libcxgbi.c +0
-1-read_lock (&csk->callback_lock); dskb =skb_peek (&csk->receive_queue);if (!dskb) {
read_unlock(&csk->callback_lock);
I think you also have to remove this read_unlock call.