diff options
Diffstat (limited to 'drivers/scsi/cxgbi/cxgb3i')
-rw-r--r-- | drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 51 |
1 files changed, 7 insertions, 44 deletions
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c index a129a170b47b..e2362b97f329 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 | ||
1154 | static 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 | |||
1168 | static 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 | |||
1189 | static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, | 1154 | static 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; |