From patchwork Mon Jan 16 17:44:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Gurtovoy X-Patchwork-Id: 9519263 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 37D8E60210 for ; Mon, 16 Jan 2017 17:44:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28EB028491 for ; Mon, 16 Jan 2017 17:44:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D8C328447; Mon, 16 Jan 2017 17:44:56 +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 9F3D32849E for ; Mon, 16 Jan 2017 17:44:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751103AbdAPRor (ORCPT ); Mon, 16 Jan 2017 12:44:47 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:45546 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750927AbdAPRop (ORCPT ); Mon, 16 Jan 2017 12:44:45 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from maxg@mellanox.com) with ESMTPS (AES256-SHA encrypted); 16 Jan 2017 19:44:42 +0200 Received: from r-vnc08.mtr.labs.mlnx (r-vnc08.mtr.labs.mlnx [10.208.0.121]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v0GHifHU003581; Mon, 16 Jan 2017 19:44:42 +0200 From: Max Gurtovoy To: swise@opengridcomputing.com, sagi@grimberg.me, hch@lst.de, dledford@redhat.com, linux-rdma@vger.kernel.org Cc: Max Gurtovoy Subject: [PATCHv1 1/1] IB/iser: Fix sg_tablesize calculation Date: Mon, 16 Jan 2017 19:44:41 +0200 Message-Id: <1484588681-12987-2-git-send-email-maxg@mellanox.com> X-Mailer: git-send-email 1.7.8.2 In-Reply-To: <1484588681-12987-1-git-send-email-maxg@mellanox.com> References: <1484588681-12987-1-git-send-email-maxg@mellanox.com> 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 For devices that can register page list that is bigger than USHRT_MAX, we actually take the wrong value for sg_tablesize. E.g: for CX4 max_fast_reg_page_list_len is 65536 (bigger than USHRT_MAX) so we set sg_tablesize to 0 by mistake. Therefore, each IO that is bigger than 4k splitted to "< 4k" chunks that cause performance degredation. Fixes: 7854550ae6d8 ("RDMA/iser: Limit sgs to the device fastreg depth") Signed-off-by: Max Gurtovoy --- drivers/infiniband/ulp/iser/iscsi_iser.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 9104e6b..ff37f19 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -656,7 +656,8 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task) * max fastreg page list length. */ shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize, - ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len); + min_t(unsigned int, USHRT_MAX, + ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len)); if (iscsi_host_add(shost, ib_conn->device->ib_device->dma_device)) {