aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/cxgbi/cxgb3i/cxgb3i.c51
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c2
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c15
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.h3
4 files changed, 8 insertions, 63 deletions
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index a129a170b47..e2362b97f32 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -1108,10 +1108,11 @@ static int ddp_set_map(struct cxgbi_sock *csk, struct cxgbi_pagepod_hdr *hdr,
1108 csk, idx, npods, gl); 1108 csk, idx, npods, gl);
1109 1109
1110 for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) { 1110 for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) {
1111 struct sk_buff *skb = ddp->gl_skb[idx]; 1111 struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
1112 PPOD_SIZE, 0, GFP_ATOMIC);
1112 1113
1113 /* hold on to the skb until we clear the ddp mapping */ 1114 if (!skb)
1114 skb_get(skb); 1115 return -ENOMEM;
1115 1116
1116 ulp_mem_io_set_hdr(skb, pm_addr); 1117 ulp_mem_io_set_hdr(skb, pm_addr);
1117 cxgbi_ddp_ppod_set((struct cxgbi_pagepod *)(skb->head + 1118 cxgbi_ddp_ppod_set((struct cxgbi_pagepod *)(skb->head +
@@ -1136,56 +1137,20 @@ static void ddp_clear_map(struct cxgbi_hba *chba, unsigned int tag,
1136 cdev, idx, npods, tag); 1137 cdev, idx, npods, tag);
1137 1138
1138 for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) { 1139 for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) {
1139 struct sk_buff *skb = ddp->gl_skb[idx]; 1140 struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
1141 PPOD_SIZE, 0, GFP_ATOMIC);
1140 1142
1141 if (!skb) { 1143 if (!skb) {
1142 pr_err("tag 0x%x, 0x%x, %d/%u, skb NULL.\n", 1144 pr_err("tag 0x%x, 0x%x, %d/%u, skb OOM.\n",
1143 tag, idx, i, npods); 1145 tag, idx, i, npods);
1144 continue; 1146 continue;
1145 } 1147 }
1146 ddp->gl_skb[idx] = NULL;
1147 memset(skb->head + sizeof(struct ulp_mem_io), 0, PPOD_SIZE);
1148 ulp_mem_io_set_hdr(skb, pm_addr); 1148 ulp_mem_io_set_hdr(skb, pm_addr);
1149 skb->priority = CPL_PRIORITY_CONTROL; 1149 skb->priority = CPL_PRIORITY_CONTROL;
1150 cxgb3_ofld_send(cdev->lldev, skb); 1150 cxgb3_ofld_send(cdev->lldev, skb);
1151 } 1151 }
1152} 1152}
1153 1153
1154static void ddp_free_gl_skb(struct cxgbi_ddp_info *ddp, int idx, int cnt)
1155{
1156 int i;
1157
1158 log_debug(1 << CXGBI_DBG_DDP,
1159 "ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt);
1160
1161 for (i = 0; i < cnt; i++, idx++)
1162 if (ddp->gl_skb[idx]) {
1163 kfree_skb(ddp->gl_skb[idx]);
1164 ddp->gl_skb[idx] = NULL;
1165 }
1166}
1167
1168static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, int idx,
1169 int cnt, gfp_t gfp)
1170{
1171 int i;
1172
1173 log_debug(1 << CXGBI_DBG_DDP,
1174 "ddp 0x%p, idx %d, cnt %d.\n", ddp, idx, cnt);
1175
1176 for (i = 0; i < cnt; i++) {
1177 struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
1178 PPOD_SIZE, 0, gfp);
1179 if (skb)
1180 ddp->gl_skb[idx + i] = skb;
1181 else {
1182 ddp_free_gl_skb(ddp, idx, i);
1183 return -ENOMEM;
1184 }
1185 }
1186 return 0;
1187}
1188
1189static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, 1154static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
1190 unsigned int tid, int pg_idx, bool reply) 1155 unsigned int tid, int pg_idx, bool reply)
1191{ 1156{
@@ -1316,8 +1281,6 @@ static int cxgb3i_ddp_init(struct cxgbi_device *cdev)
1316 } 1281 }
1317 tdev->ulp_iscsi = ddp; 1282 tdev->ulp_iscsi = ddp;
1318 1283
1319 cdev->csk_ddp_free_gl_skb = ddp_free_gl_skb;
1320 cdev->csk_ddp_alloc_gl_skb = ddp_alloc_gl_skb;
1321 cdev->csk_ddp_setup_digest = ddp_setup_conn_digest; 1284 cdev->csk_ddp_setup_digest = ddp_setup_conn_digest;
1322 cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx; 1285 cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx;
1323 cdev->csk_ddp_set = ddp_set_map; 1286 cdev->csk_ddp_set = ddp_set_map;
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 8c04fada710..5b1f0785daf 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1425,8 +1425,6 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev)
1425 cxgbi_ddp_page_size_factor(pgsz_factor); 1425 cxgbi_ddp_page_size_factor(pgsz_factor);
1426 cxgb4_iscsi_init(lldi->ports[0], tagmask, pgsz_factor); 1426 cxgb4_iscsi_init(lldi->ports[0], tagmask, pgsz_factor);
1427 1427
1428 cdev->csk_ddp_free_gl_skb = NULL;
1429 cdev->csk_ddp_alloc_gl_skb = NULL;
1430 cdev->csk_ddp_setup_digest = ddp_setup_conn_digest; 1428 cdev->csk_ddp_setup_digest = ddp_setup_conn_digest;
1431 cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx; 1429 cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx;
1432 cdev->csk_ddp_set = ddp_set_map; 1430 cdev->csk_ddp_set = ddp_set_map;
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 6de6a6f3f1e..b2acdef3dcb 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -1277,12 +1277,6 @@ static int ddp_tag_reserve(struct cxgbi_sock *csk, unsigned int tid,
1277 return idx; 1277 return idx;
1278 } 1278 }
1279 1279
1280 if (cdev->csk_ddp_alloc_gl_skb) {
1281 err = cdev->csk_ddp_alloc_gl_skb(ddp, idx, npods, gfp);
1282 if (err < 0)
1283 goto unmark_entries;
1284 }
1285
1286 tag = cxgbi_ddp_tag_base(tformat, sw_tag); 1280 tag = cxgbi_ddp_tag_base(tformat, sw_tag);
1287 tag |= idx << PPOD_IDX_SHIFT; 1281 tag |= idx << PPOD_IDX_SHIFT;
1288 1282
@@ -1293,11 +1287,8 @@ static int ddp_tag_reserve(struct cxgbi_sock *csk, unsigned int tid,
1293 hdr.page_offset = htonl(gl->offset); 1287 hdr.page_offset = htonl(gl->offset);
1294 1288
1295 err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl); 1289 err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl);
1296 if (err < 0) { 1290 if (err < 0)
1297 if (cdev->csk_ddp_free_gl_skb)
1298 cdev->csk_ddp_free_gl_skb(ddp, idx, npods);
1299 goto unmark_entries; 1291 goto unmark_entries;
1300 }
1301 1292
1302 ddp->idx_last = idx; 1293 ddp->idx_last = idx;
1303 log_debug(1 << CXGBI_DBG_DDP, 1294 log_debug(1 << CXGBI_DBG_DDP,
@@ -1363,8 +1354,6 @@ static void ddp_destroy(struct kref *kref)
1363 >> PPOD_PAGES_SHIFT; 1354 >> PPOD_PAGES_SHIFT;
1364 pr_info("cdev 0x%p, ddp %d + %d.\n", cdev, i, npods); 1355 pr_info("cdev 0x%p, ddp %d + %d.\n", cdev, i, npods);
1365 kfree(gl); 1356 kfree(gl);
1366 if (cdev->csk_ddp_free_gl_skb)
1367 cdev->csk_ddp_free_gl_skb(ddp, i, npods);
1368 i += npods; 1357 i += npods;
1369 } else 1358 } else
1370 i++; 1359 i++;
@@ -1407,8 +1396,6 @@ int cxgbi_ddp_init(struct cxgbi_device *cdev,
1407 return -ENOMEM; 1396 return -ENOMEM;
1408 } 1397 }
1409 ddp->gl_map = (struct cxgbi_gather_list **)(ddp + 1); 1398 ddp->gl_map = (struct cxgbi_gather_list **)(ddp + 1);
1410 ddp->gl_skb = (struct sk_buff **)(((char *)ddp->gl_map) +
1411 ppmax * sizeof(struct cxgbi_gather_list *));
1412 cdev->ddp = ddp; 1399 cdev->ddp = ddp;
1413 1400
1414 spin_lock_init(&ddp->map_lock); 1401 spin_lock_init(&ddp->map_lock);
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index c57d59db000..23cbc585450 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -131,7 +131,6 @@ struct cxgbi_ddp_info {
131 unsigned int rsvd_tag_mask; 131 unsigned int rsvd_tag_mask;
132 spinlock_t map_lock; 132 spinlock_t map_lock;
133 struct cxgbi_gather_list **gl_map; 133 struct cxgbi_gather_list **gl_map;
134 struct sk_buff **gl_skb;
135}; 134};
136 135
137#define DDP_PGIDX_MAX 4 136#define DDP_PGIDX_MAX 4
@@ -536,8 +535,6 @@ struct cxgbi_device {
536 struct cxgbi_ddp_info *ddp; 535 struct cxgbi_ddp_info *ddp;
537 536
538 void (*dev_ddp_cleanup)(struct cxgbi_device *); 537 void (*dev_ddp_cleanup)(struct cxgbi_device *);
539 void (*csk_ddp_free_gl_skb)(struct cxgbi_ddp_info *, int, int);
540 int (*csk_ddp_alloc_gl_skb)(struct cxgbi_ddp_info *, int, int, gfp_t);
541 int (*csk_ddp_set)(struct cxgbi_sock *, struct cxgbi_pagepod_hdr *, 538 int (*csk_ddp_set)(struct cxgbi_sock *, struct cxgbi_pagepod_hdr *,
542 unsigned int, unsigned int, 539 unsigned int, unsigned int,
543 struct cxgbi_gather_list *); 540 struct cxgbi_gather_list *);