aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/cxgbi
diff options
context:
space:
mode:
authorkxie@chelsio.com <kxie@chelsio.com>2010-09-23 19:43:23 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-10-07 18:19:32 -0400
commit24d3f95a5b6082ca4aba89071ca6259e15d3e564 (patch)
treed353b736c4e201589ef9ffb1db5c26a3204422ea /drivers/scsi/cxgbi
parentd24099df9e379b150c164da354b8c6fdafc73257 (diff)
[SCSI] cxgbi: rename alloc_cpl to alloc_wr
Signed-off-by: Karen Xie <kxie@chelsio.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/cxgbi')
-rw-r--r--drivers/scsi/cxgbi/cxgb3i/cxgb3i.c18
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c28
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.h5
3 files changed, 25 insertions, 26 deletions
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index a01c1e238938..a2c207f57d61 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -320,7 +320,7 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 credits)
320 "csk 0x%p,%u,0x%lx,%u, credit %u, dack %u.\n", 320 "csk 0x%p,%u,0x%lx,%u, credit %u, dack %u.\n",
321 csk, csk->state, csk->flags, csk->tid, credits, dack); 321 csk, csk->state, csk->flags, csk->tid, credits, dack);
322 322
323 skb = alloc_cpl(sizeof(*req), 0, GFP_ATOMIC); 323 skb = alloc_wr(sizeof(*req), 0, GFP_ATOMIC);
324 if (!skb) { 324 if (!skb) {
325 pr_info("csk 0x%p, credit %u, OOM.\n", csk, credits); 325 pr_info("csk 0x%p, credit %u, OOM.\n", csk, credits);
326 return 0; 326 return 0;
@@ -572,7 +572,7 @@ static void act_open_retry_timer(unsigned long data)
572 572
573 cxgbi_sock_get(csk); 573 cxgbi_sock_get(csk);
574 spin_lock_bh(&csk->lock); 574 spin_lock_bh(&csk->lock);
575 skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC); 575 skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
576 if (!skb) 576 if (!skb)
577 cxgbi_sock_fail_act_open(csk, -ENOMEM); 577 cxgbi_sock_fail_act_open(csk, -ENOMEM);
578 else { 578 else {
@@ -881,16 +881,16 @@ static int do_wr_ack(struct t3cdev *cdev, struct sk_buff *skb, void *ctx)
881 */ 881 */
882static int alloc_cpls(struct cxgbi_sock *csk) 882static int alloc_cpls(struct cxgbi_sock *csk)
883{ 883{
884 csk->cpl_close = alloc_cpl(sizeof(struct cpl_close_con_req), 0, 884 csk->cpl_close = alloc_wr(sizeof(struct cpl_close_con_req), 0,
885 GFP_KERNEL); 885 GFP_KERNEL);
886 if (!csk->cpl_close) 886 if (!csk->cpl_close)
887 return -ENOMEM; 887 return -ENOMEM;
888 csk->cpl_abort_req = alloc_cpl(sizeof(struct cpl_abort_req), 0, 888 csk->cpl_abort_req = alloc_wr(sizeof(struct cpl_abort_req), 0,
889 GFP_KERNEL); 889 GFP_KERNEL);
890 if (!csk->cpl_abort_req) 890 if (!csk->cpl_abort_req)
891 goto free_cpl_skbs; 891 goto free_cpl_skbs;
892 892
893 csk->cpl_abort_rpl = alloc_cpl(sizeof(struct cpl_abort_rpl), 0, 893 csk->cpl_abort_rpl = alloc_wr(sizeof(struct cpl_abort_rpl), 0,
894 GFP_KERNEL); 894 GFP_KERNEL);
895 if (!csk->cpl_abort_rpl) 895 if (!csk->cpl_abort_rpl)
896 goto free_cpl_skbs; 896 goto free_cpl_skbs;
@@ -972,7 +972,7 @@ static int init_act_open(struct cxgbi_sock *csk)
972 cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); 972 cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
973 cxgbi_sock_get(csk); 973 cxgbi_sock_get(csk);
974 974
975 skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL); 975 skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
976 if (!skb) 976 if (!skb)
977 goto rel_resource; 977 goto rel_resource;
978 skb->sk = (struct sock *)csk; 978 skb->sk = (struct sock *)csk;
@@ -1141,7 +1141,7 @@ static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx,
1141 "ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt); 1141 "ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt);
1142 1142
1143 for (i = 0; i < cnt; i++) { 1143 for (i = 0; i < cnt; i++) {
1144 struct sk_buff *skb = alloc_cpl(sizeof(struct ulp_mem_io) + 1144 struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
1145 PPOD_SIZE, 0, gfp); 1145 PPOD_SIZE, 0, gfp);
1146 if (skb) { 1146 if (skb) {
1147 ddp->gl_skb[idx + i] = skb; 1147 ddp->gl_skb[idx + i] = skb;
@@ -1156,7 +1156,7 @@ static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx,
1156static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, 1156static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
1157 unsigned int tid, int pg_idx, bool reply) 1157 unsigned int tid, int pg_idx, bool reply)
1158{ 1158{
1159 struct sk_buff *skb = alloc_cpl(sizeof(struct cpl_set_tcb_field), 0, 1159 struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0,
1160 GFP_KERNEL); 1160 GFP_KERNEL);
1161 struct cpl_set_tcb_field *req; 1161 struct cpl_set_tcb_field *req;
1162 u64 val = pg_idx < DDP_PGIDX_MAX ? pg_idx : 0; 1162 u64 val = pg_idx < DDP_PGIDX_MAX ? pg_idx : 0;
@@ -1193,7 +1193,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
1193static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, 1193static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
1194 int hcrc, int dcrc, int reply) 1194 int hcrc, int dcrc, int reply)
1195{ 1195{
1196 struct sk_buff *skb = alloc_cpl(sizeof(struct cpl_set_tcb_field), 0, 1196 struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0,
1197 GFP_KERNEL); 1197 GFP_KERNEL);
1198 struct cpl_set_tcb_field *req; 1198 struct cpl_set_tcb_field *req;
1199 u64 val = (hcrc ? 1 : 0) | (dcrc ? 2 : 0); 1199 u64 val = (hcrc ? 1 : 0) | (dcrc ? 2 : 0);
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index b375a683a6b0..1056d97e686e 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -332,7 +332,7 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 credits)
332 "csk 0x%p,%u,0x%lx,%u, credit %u.\n", 332 "csk 0x%p,%u,0x%lx,%u, credit %u.\n",
333 csk, csk->state, csk->flags, csk->tid, credits); 333 csk, csk->state, csk->flags, csk->tid, credits);
334 334
335 skb = alloc_cpl(sizeof(*req), 0, GFP_ATOMIC); 335 skb = alloc_wr(sizeof(*req), 0, GFP_ATOMIC);
336 if (!skb) { 336 if (!skb) {
337 pr_info("csk 0x%p, credit %u, OOM.\n", csk, credits); 337 pr_info("csk 0x%p, credit %u, OOM.\n", csk, credits);
338 return 0; 338 return 0;
@@ -388,7 +388,7 @@ static inline void send_tx_flowc_wr(struct cxgbi_sock *csk)
388 int flowclen, i; 388 int flowclen, i;
389 389
390 flowclen = 80; 390 flowclen = 80;
391 skb = alloc_cpl(flowclen, 0, GFP_ATOMIC); 391 skb = alloc_wr(flowclen, 0, GFP_ATOMIC);
392 flowc = (struct fw_flowc_wr *)skb->head; 392 flowc = (struct fw_flowc_wr *)skb->head;
393 flowc->op_to_nparams = 393 flowc->op_to_nparams =
394 htonl(FW_WR_OP(FW_FLOWC_WR) | FW_FLOWC_WR_NPARAMS(8)); 394 htonl(FW_WR_OP(FW_FLOWC_WR) | FW_FLOWC_WR_NPARAMS(8));
@@ -651,7 +651,7 @@ static void csk_act_open_retry_timer(unsigned long data)
651 651
652 cxgbi_sock_get(csk); 652 cxgbi_sock_get(csk);
653 spin_lock_bh(&csk->lock); 653 spin_lock_bh(&csk->lock);
654 skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC); 654 skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
655 if (!skb) 655 if (!skb)
656 cxgbi_sock_fail_act_open(csk, -ENOMEM); 656 cxgbi_sock_fail_act_open(csk, -ENOMEM);
657 else { 657 else {
@@ -1073,18 +1073,18 @@ static void do_set_tcb_rpl(struct cxgbi_device *cdev, struct sk_buff *skb)
1073 1073
1074static int alloc_cpls(struct cxgbi_sock *csk) 1074static int alloc_cpls(struct cxgbi_sock *csk)
1075{ 1075{
1076 csk->cpl_close = alloc_cpl(sizeof(struct cpl_close_con_req), 1076 csk->cpl_close = alloc_wr(sizeof(struct cpl_close_con_req),
1077 0, GFP_NOIO); 1077 0, GFP_KERNEL);
1078 if (!csk->cpl_close) 1078 if (!csk->cpl_close)
1079 return -ENOMEM; 1079 return -ENOMEM;
1080 1080
1081 csk->cpl_abort_req = alloc_cpl(sizeof(struct cpl_abort_req), 1081 csk->cpl_abort_req = alloc_wr(sizeof(struct cpl_abort_req),
1082 0, GFP_NOIO); 1082 0, GFP_KERNEL);
1083 if (!csk->cpl_abort_req) 1083 if (!csk->cpl_abort_req)
1084 goto free_cpls; 1084 goto free_cpls;
1085 1085
1086 csk->cpl_abort_rpl = alloc_cpl(sizeof(struct cpl_abort_rpl), 1086 csk->cpl_abort_rpl = alloc_wr(sizeof(struct cpl_abort_rpl),
1087 0, GFP_NOIO); 1087 0, GFP_KERNEL);
1088 if (!csk->cpl_abort_rpl) 1088 if (!csk->cpl_abort_rpl)
1089 goto free_cpls; 1089 goto free_cpls;
1090 return 0; 1090 return 0;
@@ -1158,7 +1158,7 @@ static int init_act_open(struct cxgbi_sock *csk)
1158 } 1158 }
1159 cxgbi_sock_get(csk); 1159 cxgbi_sock_get(csk);
1160 1160
1161 skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_NOIO); 1161 skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
1162 if (!skb) 1162 if (!skb)
1163 goto rel_resource; 1163 goto rel_resource;
1164 skb->sk = (struct sock *)csk; 1164 skb->sk = (struct sock *)csk;
@@ -1268,7 +1268,7 @@ static int ddp_ppod_write_sgl(struct cxgbi_device *cdev, unsigned int port_id,
1268 dlen = PPOD_SIZE * npods; 1268 dlen = PPOD_SIZE * npods;
1269 pm_addr = idx * PPOD_SIZE + ddp->llimit; 1269 pm_addr = idx * PPOD_SIZE + ddp->llimit;
1270 1270
1271 skb = alloc_cpl(sizeof(*req) + sizeof(*sgl), dlen, GFP_ATOMIC); 1271 skb = alloc_wr(sizeof(*req) + sizeof(*sgl), dlen, GFP_ATOMIC);
1272 if (!skb) { 1272 if (!skb) {
1273 pr_err("cdev 0x%p, idx %u, npods %u, OOM.\n", 1273 pr_err("cdev 0x%p, idx %u, npods %u, OOM.\n",
1274 cdev, idx, npods); 1274 cdev, idx, npods);
@@ -1339,7 +1339,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid,
1339 if (!pg_idx) 1339 if (!pg_idx)
1340 return 0; 1340 return 0;
1341 1341
1342 skb = alloc_cpl(sizeof(*req), 0, GFP_KERNEL); 1342 skb = alloc_wr(sizeof(*req), 0, GFP_KERNEL);
1343 if (!skb) 1343 if (!skb)
1344 return -ENOMEM; 1344 return -ENOMEM;
1345 1345
@@ -1373,7 +1373,7 @@ static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
1373 val = TCB_ULP_RAW(val); 1373 val = TCB_ULP_RAW(val);
1374 val |= TCB_ULP_TYPE(ULP2_MODE_ISCSI); 1374 val |= TCB_ULP_TYPE(ULP2_MODE_ISCSI);
1375 1375
1376 skb = alloc_cpl(sizeof(*req), 0, GFP_KERNEL); 1376 skb = alloc_wr(sizeof(*req), 0, GFP_KERNEL);
1377 if (!skb) 1377 if (!skb)
1378 return -ENOMEM; 1378 return -ENOMEM;
1379 1379
@@ -1516,7 +1516,7 @@ static int t4_uld_rx_handler(void *handle, const __be64 *rsp,
1516 if (pgl == NULL) { 1516 if (pgl == NULL) {
1517 unsigned int len = 64 - sizeof(struct rsp_ctrl) - 8; 1517 unsigned int len = 64 - sizeof(struct rsp_ctrl) - 8;
1518 1518
1519 skb = alloc_cpl(len, 0, GFP_ATOMIC); 1519 skb = alloc_wr(len, 0, GFP_ATOMIC);
1520 if (!skb) 1520 if (!skb)
1521 goto nomem; 1521 goto nomem;
1522 skb_copy_to_linear_data(skb, &rsp[1], len); 1522 skb_copy_to_linear_data(skb, &rsp[1], len);
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 40551f3be5dc..2f2485b0f9ec 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -410,16 +410,15 @@ static inline unsigned int cxgbi_sock_compute_wscale(unsigned int win)
410 return wscale; 410 return wscale;
411} 411}
412 412
413static inline struct sk_buff *alloc_cpl(int cpl_len, int dlen, gfp_t gfp) 413static inline struct sk_buff *alloc_wr(int wrlen, int dlen, gfp_t gfp)
414{ 414{
415 int wrlen = roundup(cpl_len, 16);
416 struct sk_buff *skb = alloc_skb(wrlen + dlen, gfp); 415 struct sk_buff *skb = alloc_skb(wrlen + dlen, gfp);
417 416
418 if (skb) { 417 if (skb) {
419 __skb_put(skb, wrlen); 418 __skb_put(skb, wrlen);
420 memset(skb->head, 0, wrlen + dlen); 419 memset(skb->head, 0, wrlen + dlen);
421 } else 420 } else
422 pr_info("alloc cpl skb %u+%u, OOM.\n", cpl_len, dlen); 421 pr_info("alloc cpl wr skb %u+%u, OOM.\n", wrlen, dlen);
423 return skb; 422 return skb;
424} 423}
425 424