.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
7 | 4 | */ |
---|
8 | 5 | |
---|
9 | 6 | #include "cxgbit.h" |
---|
.. | .. |
---|
263 | 260 | r2t->targ_xfer_tag = ttinfo->tag; |
---|
264 | 261 | } |
---|
265 | 262 | |
---|
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) |
---|
267 | 264 | { |
---|
268 | 265 | struct cxgbit_cmd *ccmd = iscsit_priv_cmd(cmd); |
---|
269 | 266 | |
---|
270 | 267 | 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 { |
---|
274 | 271 | struct cxgbit_sock *csk = conn->context; |
---|
275 | 272 | struct cxgbit_device *cdev = csk->com.cdev; |
---|
276 | 273 | struct cxgbi_ppm *ppm = cdev2ppm(cdev); |
---|
| 274 | + struct cxgbi_task_tag_info *ttinfo = &ccmd->ttinfo; |
---|
277 | 275 | |
---|
278 | 276 | /* Abort the TCP conn if DDP is not complete to |
---|
279 | 277 | * avoid any possibility of DDP after freeing |
---|
.. | .. |
---|
283 | 281 | cmd->se_cmd.data_length)) |
---|
284 | 282 | cxgbit_abort_conn(csk); |
---|
285 | 283 | |
---|
| 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 | + } |
---|
286 | 290 | 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)); |
---|
292 | 291 | } |
---|
293 | | - |
---|
294 | 292 | ccmd->release = false; |
---|
295 | 293 | } |
---|
296 | 294 | } |
---|
.. | .. |
---|
300 | 298 | struct cxgb4_lld_info *lldi = &cdev->lldi; |
---|
301 | 299 | struct net_device *ndev = cdev->lldi.ports[0]; |
---|
302 | 300 | struct cxgbi_tag_format tformat; |
---|
303 | | - unsigned int ppmax; |
---|
304 | 301 | int ret, i; |
---|
305 | 302 | |
---|
306 | 303 | if (!lldi->vr->iscsi.size) { |
---|
307 | 304 | pr_warn("%s, iscsi NOT enabled, check config!\n", ndev->name); |
---|
308 | 305 | return -EACCES; |
---|
309 | 306 | } |
---|
310 | | - |
---|
311 | | - ppmax = lldi->vr->iscsi.size >> PPOD_SIZE_SHIFT; |
---|
312 | 307 | |
---|
313 | 308 | memset(&tformat, 0, sizeof(struct cxgbi_tag_format)); |
---|
314 | 309 | for (i = 0; i < 4; i++) |
---|
.. | .. |
---|
318 | 313 | |
---|
319 | 314 | ret = cxgbi_ppm_init(lldi->iscsi_ppm, cdev->lldi.ports[0], |
---|
320 | 315 | 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); |
---|
323 | 320 | if (ret >= 0) { |
---|
324 | 321 | struct cxgbi_ppm *ppm = (struct cxgbi_ppm *)(*lldi->iscsi_ppm); |
---|
325 | 322 | |
---|