hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
....@@ -1,9 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2016 Chelsio Communications, Inc.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 as
6
- * published by the Free Software Foundation.
74 */
85
96 #include "cxgbit.h"
....@@ -263,17 +260,18 @@
263260 r2t->targ_xfer_tag = ttinfo->tag;
264261 }
265262
266
-void cxgbit_release_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
263
+void cxgbit_unmap_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
267264 {
268265 struct cxgbit_cmd *ccmd = iscsit_priv_cmd(cmd);
269266
270267 if (ccmd->release) {
271
- struct cxgbi_task_tag_info *ttinfo = &ccmd->ttinfo;
272
-
273
- if (ttinfo->sgl) {
268
+ if (cmd->se_cmd.se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) {
269
+ put_page(sg_page(&ccmd->sg));
270
+ } else {
274271 struct cxgbit_sock *csk = conn->context;
275272 struct cxgbit_device *cdev = csk->com.cdev;
276273 struct cxgbi_ppm *ppm = cdev2ppm(cdev);
274
+ struct cxgbi_task_tag_info *ttinfo = &ccmd->ttinfo;
277275
278276 /* Abort the TCP conn if DDP is not complete to
279277 * avoid any possibility of DDP after freeing
....@@ -283,14 +281,14 @@
283281 cmd->se_cmd.data_length))
284282 cxgbit_abort_conn(csk);
285283
284
+ if (unlikely(ttinfo->sgl)) {
285
+ dma_unmap_sg(&ppm->pdev->dev, ttinfo->sgl,
286
+ ttinfo->nents, DMA_FROM_DEVICE);
287
+ ttinfo->nents = 0;
288
+ ttinfo->sgl = NULL;
289
+ }
286290 cxgbi_ppm_ppod_release(ppm, ttinfo->idx);
287
-
288
- dma_unmap_sg(&ppm->pdev->dev, ttinfo->sgl,
289
- ttinfo->nents, DMA_FROM_DEVICE);
290
- } else {
291
- put_page(sg_page(&ccmd->sg));
292291 }
293
-
294292 ccmd->release = false;
295293 }
296294 }
....@@ -300,15 +298,12 @@
300298 struct cxgb4_lld_info *lldi = &cdev->lldi;
301299 struct net_device *ndev = cdev->lldi.ports[0];
302300 struct cxgbi_tag_format tformat;
303
- unsigned int ppmax;
304301 int ret, i;
305302
306303 if (!lldi->vr->iscsi.size) {
307304 pr_warn("%s, iscsi NOT enabled, check config!\n", ndev->name);
308305 return -EACCES;
309306 }
310
-
311
- ppmax = lldi->vr->iscsi.size >> PPOD_SIZE_SHIFT;
312307
313308 memset(&tformat, 0, sizeof(struct cxgbi_tag_format));
314309 for (i = 0; i < 4; i++)
....@@ -318,8 +313,10 @@
318313
319314 ret = cxgbi_ppm_init(lldi->iscsi_ppm, cdev->lldi.ports[0],
320315 cdev->lldi.pdev, &cdev->lldi, &tformat,
321
- ppmax, lldi->iscsi_llimit,
322
- lldi->vr->iscsi.start, 2);
316
+ lldi->vr->iscsi.size, lldi->iscsi_llimit,
317
+ lldi->vr->iscsi.start, 2,
318
+ lldi->vr->ppod_edram.start,
319
+ lldi->vr->ppod_edram.size);
323320 if (ret >= 0) {
324321 struct cxgbi_ppm *ppm = (struct cxgbi_ppm *)(*lldi->iscsi_ppm);
325322