From patchwork Wed Nov 23 08:52:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Neyelov X-Patchwork-Id: 9442755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19E1860235 for ; Wed, 23 Nov 2016 08:54:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 118B6200DF for ; Wed, 23 Nov 2016 08:54:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06248208C2; Wed, 23 Nov 2016 08:54:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EC6E205AB for ; Wed, 23 Nov 2016 08:54:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933551AbcKWIxt (ORCPT ); Wed, 23 Nov 2016 03:53:49 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:38217 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933488AbcKWIwd (ORCPT ); Wed, 23 Nov 2016 03:52:33 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from vladimirn@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Nov 2016 10:52:24 +0200 Received: from r-vnc09.mtr.labs.mlnx (r-vnc09.mtr.labs.mlnx [10.208.0.120]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id uAN8qOhI029362; Wed, 23 Nov 2016 10:52:24 +0200 Received: from r-vnc09.mtr.labs.mlnx (localhost.localdomain [127.0.0.1]) by r-vnc09.mtr.labs.mlnx (8.13.8/8.13.8) with ESMTP id uAN8qO0g015654; Wed, 23 Nov 2016 10:52:24 +0200 Received: (from vladimirn@localhost) by r-vnc09.mtr.labs.mlnx (8.13.8/8.13.8/Submit) id uAN8qMMU015653; Wed, 23 Nov 2016 10:52:22 +0200 From: Vladimir Neyelov To: linux-rdma@vger.kernel.org, sagi@grimberg.me, maxg@mellanox.com Cc: Vladimir Neyelov Subject: [PATCH] IB/iser: extended CDB support Date: Wed, 23 Nov 2016 10:52:19 +0200 Message-Id: <1479891139-15604-1-git-send-email-vladimirn@mellanox.com> X-Mailer: git-send-email 1.8.2.3 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Support of vendor specific CDBs in iser. SCSI supports max command size SCSI_MAX_VARLEN_CDB_SIZE (260 bytes). ISER currently supports max scsi command 16 bytes. This commit changes max scsi command for ISER (to align with iscsi/tcp) to SCSI_MAX_VARLEN_CDB_SIZE. Signed-off-by: Vladimir Neyelov Reviewed-by: Max Gurtovoy --- drivers/infiniband/ulp/iser/iscsi_iser.c | 17 +++++++++++++---- drivers/infiniband/ulp/iser/iscsi_iser.h | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 64b3d11..865ce48 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -163,7 +163,8 @@ iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode) struct iscsi_iser_task *iser_task = task->dd_data; task->hdr = (struct iscsi_hdr *)&iser_task->desc.iscsi_header; - task->hdr_max = sizeof(iser_task->desc.iscsi_header); + task->hdr_max = sizeof(iser_task->desc.iscsi_header) + + sizeof(iser_task->desc.iscsi_ecdb_header); return 0; } @@ -189,6 +190,14 @@ iser_initialize_task_headers(struct iscsi_task *task, u64 dma_addr; const bool mgmt_task = !task->sc && !in_interrupt(); int ret = 0; + int headers_len = ISER_HEADERS_LEN; + struct scsi_cmnd *sc = task->sc; + + if(sc) { + if(sc->cmd_len > ISCSI_CDB_SIZE) + headers_len += offsetof(struct iscsi_ecdb_ahdr, ecdb) + + (sc->cmd_len - ISCSI_CDB_SIZE); + } if (unlikely(mgmt_task)) mutex_lock(&iser_conn->state_mutex); @@ -199,7 +208,7 @@ iser_initialize_task_headers(struct iscsi_task *task, } dma_addr = ib_dma_map_single(device->ib_device, (void *)tx_desc, - ISER_HEADERS_LEN, DMA_TO_DEVICE); + headers_len, DMA_TO_DEVICE ); if (ib_dma_mapping_error(device->ib_device, dma_addr)) { ret = -ENOMEM; goto out; @@ -209,7 +218,7 @@ iser_initialize_task_headers(struct iscsi_task *task, tx_desc->mapped = true; tx_desc->dma_addr = dma_addr; tx_desc->tx_sg[0].addr = tx_desc->dma_addr; - tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; + tx_desc->tx_sg[0].length = headers_len; tx_desc->tx_sg[0].lkey = device->pd->local_dma_lkey; iser_task->iser_conn = iser_conn; @@ -623,7 +632,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, shost->max_lun = iscsi_max_lun; shost->max_id = 0; shost->max_channel = 0; - shost->max_cmd_len = 16; + shost->max_cmd_len = SCSI_MAX_VARLEN_CDB_SIZE; /* * older userspace tools (before 2.0-870) did not pass us diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index 0be6a7c..e1ae9b8 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h @@ -254,6 +254,7 @@ enum iser_desc_type { struct iser_tx_desc { struct iser_ctrl iser_header; struct iscsi_hdr iscsi_header; + struct iscsi_ecdb_ahdr iscsi_ecdb_header; enum iser_desc_type type; u64 dma_addr; struct ib_sge tx_sg[2];