From patchwork Fri Jun 2 21:21:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9763487 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 3BBC160360 for ; Fri, 2 Jun 2017 21:22:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F22028590 for ; Fri, 2 Jun 2017 21:22:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23C7B285D5; Fri, 2 Jun 2017 21:22:39 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 9772F28590 for ; Fri, 2 Jun 2017 21:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751277AbdFBVWh (ORCPT ); Fri, 2 Jun 2017 17:22:37 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:25089 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbdFBVWT (ORCPT ); Fri, 2 Jun 2017 17:22:19 -0400 X-IronPort-AV: E=Sophos;i="5.39,286,1493654400"; d="scan'208";a="23661915" Received: from mail-sn1nam01lp0117.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.117]) by ob1.hgst.iphmx.com with ESMTP; 03 Jun 2017 05:22:18 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=P/EMFpjPdoAvtxpsJ+UkCybpHEBeAuAVg7XsAwNKTpw=; b=B2ZLp0/WA5njRY5gnxUR1RMfcVfUGPcM9YxvXiBgityEgKs1mE8zDYpe+iK6s6ruBZiZYsQZ0hLaa75iLZktdmDu2kMYas6X++TrhCPhLFeOmLIgBmGD6mNWNKTMA2B6sHKLWjqSlY7vXB57CS7IC8L3/YMIIVs9947umOtmo3A= Received: from MWHPR04CA0096.namprd04.prod.outlook.com (10.174.173.37) by BN6PR04MB0403.namprd04.prod.outlook.com (10.173.198.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Fri, 2 Jun 2017 21:22:16 +0000 Received: from SN1NAM04FT020.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4c::203) by MWHPR04CA0096.outlook.office365.com (2603:10b6:301:3a::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10 via Frontend Transport; Fri, 2 Jun 2017 21:22:15 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by SN1NAM04FT020.mail.protection.outlook.com (10.152.88.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1101.12 via Frontend Transport; Fri, 2 Jun 2017 21:22:13 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 53.D5.51736.407D1395; Fri, 2 Jun 2017 14:22:12 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Fri, 2 Jun 2017 14:22:06 -0700 X-AuditID: 0ac94369-6dc8f9800000ca18-62-5931d704bf78 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 30.B4.18148.EF6D1395; Fri, 2 Jun 2017 14:22:06 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , James Bottomley CC: , Christoph Hellwig , "Bart Van Assche" , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH v3 08/12] Introduce scsi_mq_sgl_size() Date: Fri, 2 Jun 2017 14:21:59 -0700 Message-ID: <20170602212203.30401-9-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170602212203.30401-1-bart.vanassche@sandisk.com> References: <20170602212203.30401-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsXCddJ5kS7LdcNIg85ThhYL3uxls1i5+iiT xcZ+DovHXTNYLbqv72CzWH78H5MDm8e0SafYPHbfbGDz+Pj0FovH+i1XWTw2n672+LxJLoAt issmJTUnsyy1SN8ugStjZdd+poL3/BX7di5la2Ccy9vFyMkhIWAicejVKrYuRi4OIYGlTBIf DrYzQzjbGSU2tJ5hhanqnPyLFSKxmVHiy5cHYAk2ASOJb+9nsoDYIgKFEpe2dTCCFDEL7GGU aNnXwgiSEBYwk9i24xwziM0ioCLx/GgDE4jNK2Av8bV9JtQGeYmzW3aC1XAKOEh861gCZHMA bbOXmPpXC2SmhMAiVoklNxoZIXoFJU7OfAK2mFlAQuLgixdgvUIC6hInl8xnmsAoNAtJ2Swk ZQsYmVYxiuVm5hTnpqcWGJrqFSfmpWQWZ+sl5+duYoREQOYOxrtPvA8xCnAwKvHwZpQZRgqx JpYVV+YeYpTgYFYS4d09CyjEm5JYWZValB9fVJqTWnyIUZqDRUmc95zM1AghgfTEktTs1NSC 1CKYLBMHp1QDo/nRFWsrvFSjwgWkbwpEFL3PMufmy/75feHb+2W2/iKzGC8ucBc53bwwYeee YoYTW3K+t0gKKVjXHE042qr/+59O1O3Abf9uLk8zzTwVWHyrUiJFbea/99NX5IQJBymYHWJ9 Jjz7cvTUhG17djD+6NvUtMFeqPxe1YejUk9yVcIaKhgYr/ziVWIpzkg01GIuKk4EAMzCRup8 AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBJMWRmVeSWpSXmKPExsXCtZEjRfffNcNIg0Or2C0O/mxjtFjwZi+b xcrVR5ksNvZzWDzumsFq0X19B5vF8uP/mBzYPaZNOsXmsftmA5vHx6e3WDymrTnP5LF+y1UW j82nqz0+b5ILYI/isklJzcksSy3St0vgyljZtZ+p4D1/xb6dS9kaGOfydjFyckgImEh0Tv7F 2sXIxSEksJFRYseXiawgCTYBI4lv72eygNgiAoUS90+fZgMpYhbYxyjxuPUNG0hCWMBMYtuO c8wgNouAqkT/l8dgzbwC9hIvH29igtggL3F2y06wGk4BB4lvHUuAbA6gbfYSU/9qTWDkXsDI sIpRLDczpzg3PbPA0EivODEvJbM4Wy85P3cTIzhsOKN2MF6faH6IkYmDU6qB0aGF5eocVsFr AYKMHg/yYn4w3p7xmsn828Za68j5fGefnFiek/hv+43Q02+ms84VWvr358SVm3p2PFCL79ws UVrspKlx2NJt/4nZG6Zs+7z9WVTSrodNbznfCOYm66l3vP6d1DtlffzJB/lZE4y9tcSe/5bj Lg2aYNTm6tO63MF1XUapSNTts0osxRmJhlrMRcWJAKfRHNPLAQAA MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39400400002)(39850400002)(39860400002)(39840400002)(39450400003)(39410400002)(2980300002)(438002)(189002)(199003)(9170700003)(106466001)(305945005)(50466002)(48376002)(1076002)(47776003)(77096006)(478600001)(4326008)(5003940100001)(54906002)(72206003)(81166006)(8676002)(5660300001)(356003)(38730400002)(50226002)(8936002)(86362001)(189998001)(2906002)(53936002)(33646002)(36756003)(50986999)(76176999)(6666003)(2950100002); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR04MB0403; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM04FT020; 1:xrTbn8JXnQ4BCDtpQwbtj2D9fQzcoiwG8g05VbW9/CNsSODdm7QOm9yRMpNdVc+XQJb7vK5dcfic1LBC/ZzZzbT2YV/f0ksuG44RzHs3kkvALeXpphjgyCAsPO6CzD6wNctA9FUhipY2i954j6HHmb3j+vI/nTx5OvaXs/5T0IUmZ3DPPNXuHfo0OV0a5weifc5GJWy4SI1u7ANHJ21OJq4Xd6XfEGN0CwyGbVT6zhcwimO1XFvVD6JVG1/wySnZT3rAjORmKmhqmQWMMaB7m50p9Nm8dlzDlB+VAiBKmxUPzaZ3IrEBA2/ZRKL0ztn8FLyZc+zO6EOnmtYHQG5Ypo9I+OlXtFKNH4Q3h2ME3+BtSStqIlDEP7qYSbHxZa3YZd3t4YG5bEAgzP+bYInoItaBLkQ+I8AHV9e+nus+blA5yfI6kkaQD+vY1KeGQgAOg71gc9/FNebYHop+XW5pHf9lRF7wYmEPwydkI+QinOqrNx9U5uBiDNDhrRV65m0NZlsj05DtGMFLphJUUUDsxYTs/KIBMsMYDKJtJLeMTdoUZHytiA1AVVK2TjO2s6v1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PR04MB0403: X-MS-Office365-Filtering-Correlation-Id: 2f2eacfd-ae02-4ec1-a442-08d4a9fd70a8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:BN6PR04MB0403; X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0403; 3:OLf/CGCmBs+X3V2Jih2gR0srYV9ow52bKmv/a6SXWdLtGSvWaufYZBSrP3I+/E3Tbtq519WdZhYAK5GB+CIlry5iY8TfM9/BQosiMq59g/Jhrseci5DAYvKvC/vM81mNhhwKMPuWY70f81FFO2S4Y3NR+c+Mh29nB7BnF5P5CEuEYn+unWVwLGMnmcyCmxiy7WfmPUXVEh7OOvUMzm0pPWiuvEwg4rB6y4F/xYtw14bhs8fW5ELNtiIiMCkyndYk82fnxT5XihNMPJ2+eHxgmaV7nQCK+CDIMIqcEYHHfQOXr/PVyebX4SHbByiXxbtnPjDKEkSn0IidDX9Szp9BoUWWE4s6KbuMRYlMBKCNqoCsRINJxvyKNCy+KtCmSTZGxgJhajPeABGE+IkTM8pKvCUk72yYJqaqX6LsAOkBnngmO3qtX3WcSJNCe4YIBEXYWgu+6lsc9eVujddFkq3f3zE17wqCJ2iPKMYZiB3J5gqjvNrkzQEG+/9P+ICnGRM6 X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0403; 25:mohN1nbTuneU695GLpfyULOishtmTjIu7yYipw+oDaB1nM4amftG0Lon1Vcs1FPp2ARIMNB4nXHOjCnNvDr6BzuZTip72YvVx2TTXPusUMNzdR4EilfhWSYxHVeEGRXoxIqIsK3Gi0Fq3iOJTeJMn07MH2yryPug47/yO0HCpquR3e3P+phkJ1cJI+jxpRPjvODjicyJ8Cqi4HTTokU9SIbmt1xlKoFSh5s6jBHF6Rhp1OjKOV37+nbRR/DCcXwdMqsTGfkURVIPmjgeGr44tHkiGEYEB9fhn74GpQqlUMJdi126Ojr2kpc8/oKiYiPxrhGY9I2uoxfQm6rzZGUx91qJUEEtcvSoSuk8ruh+ZH/eA2bL1On0lv8whwBHD9QUnveD6aoN2qnVg9Igfv9ifxFeVO8xViBaC/BVBjIBHiTRmYTGGyTI4j1TAhYthUgbzOAQZZoRWAZIqNNHqs4LSu9+ieeApWzEdUpH7PmoWYQ=; 31:9GgYnobnzckqITxySNb6ZfoHHmmu92yhlghvskqYCDQT8dhHQAtkITzFWG4JI/1OZZsIQi/723TlSFlMYkpMKCqwVL3W6WgVP8uUtSBduuJU6LPsonXJj9ak+B1J6Y1YnAZ/fkXV4tJ46YnSnxsjJyJs28+Ow/olWbtJIM0e/TbzvNINDImjy4MC8mjuF6M3bGVztJPrbaxHYPpzOHQN63CPQ6+rkWEsLRGSoUxzvIHwAGu4K5D3qnhCo/bXZzyWWeNDLJWn9uqZomf9Z31/XA== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0403; 20:5mK+ORt/8IsNqsOjM7Y3JnKZK+c8k+F0wp7evPIylIOmS7R7fSC6ZRSFIh2QU72f8eW85CQImZjrBG0Y/8C946CXVTjl+VLpvswWYLTDnhvLYV2+M2FRgAKPG0bIsladTkdBYqto2O9Prn2u66y4lzPWhyE5PvQK33xpAQJP+N4WoRBGNrR5wD5oTqu6kCMvQ0yaGt47gEu6XqdHw66i2/02yi08HIIoiwbpARcUr1L00FlmIuOZtstc2uLGN6+y/r28EmB0Kfr2J1u2HObW264fweORvDxe83RRDmX4xoapd3ViMKM4eZU0vTrYXlqZhOafYTZddTYNnP79nX4boEunxXXanfP671yTWx2KusPaGGuEK0jedJo3l0icvZKJepwMRmJ3T71awuBGcwE1HO4pXtiRiMBq381XNIr/0jgBXMYUALhleym8vRruhglrMg/qgrjJpYcpz7W5Vme0Q9XQpqyr0En6BrHukxyu381bByOxplklCVLOoW7dVTud X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(13018025)(8121501046)(5005006)(13016025)(100000703101)(100105400095)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR04MB0403; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR04MB0403; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR04MB0403; 4:0kA5C5iOdqZ8IH8EDgGSPkHlgffYTG1o1PVEIfb7N7?= =?us-ascii?Q?gprBiQi/n/TE+XP8cWcDmsd9OO8+iLd4gOpZvReXmnOd/tiCsUDUBHUunP1S?= =?us-ascii?Q?buJIDWDn0Bga6FZ/0LmEbKMwiDY0bQ/9GqzKJLQxpCcDEspRpTsZMnLmaJjk?= =?us-ascii?Q?0D8RMXz30DtczD/ndJMDSzHtaCWx375OX9u3eqdoU+JdhcJy4ZysxuaX7Ol1?= =?us-ascii?Q?p+su/muzi8ipXPZCdNI5gZZ19fUVy6PlbI/vgTp/NuRNgEs7t4Ett7vO2sdJ?= =?us-ascii?Q?/hYnEP5gvTjixi/2lNqgnDXb/aeMWGqI7zIiokZ0U3S748DcOxu5mEwj4HOG?= =?us-ascii?Q?KSmC4rUPTidn/0DWwxT1SHVBDQx8ZykXVV/vNrbfkvXPfb8C0f3ByXYbxvBM?= =?us-ascii?Q?M8Li9dA6IcIRBUTuz0/gkcF9aqnIiyubTPHjzfiogOn8jkTh8XJPmjwKTZGW?= =?us-ascii?Q?BPwCmzYPuxDa4+uAKkDZ9a6U5eSJBnVXT01pNJbXOWsobzFi8crM7EsdZH3S?= =?us-ascii?Q?YthY2lNeBxOVIKukUCa5CeLh/jeLztiNE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W15I6sbXkmx3k+8k5GPN4Z+F3pJs0Rmst9HlsRO2x6KFfAkpCRmRjoch1n/MdTLrLobCH+VoZEyE1PqBzSylRso5gkVYANve21dBJZAraQNlFOunbImiZXH+M6LO7Hx3gn30UqNFtoLUhSzQPVamaCrdtY/Wcyha1IWKBWc5LCeSyCRklap7TJ91Hr4UTASok09hXiDIMDaAQ5P7j+s1; 24:3LxhX5Vqhg96X4qd+nVxb6YPmSKnNmq1MUhmxf+bMhYDuUwiUOho5obBdCeEA2aSAT2REvo2jjfMeXJqoc9WDEzdPtR9CBaUVodDO4np15M= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0403; 7:PNvPx+xpxHsMSf0zhQgdXmi9Y+kYafmXx89mjX24XZljtYlpYnaN97SqGXe3eJogLl9CzhghkyAGPxiODSpwvzNZjZkBbBMHg0DmHz6H6cUI/sI5JPzxo+VID+pkG67R0WT/j5hZ7vvW+70LLA8mH8NZSQjIM8jgGfNwKbvGkbPAjlz2PaOc82kw3t8tH8UFgvTsirXk7Chy/z1t6yHqGAPWN/2u+y2RkYz4jcoMwUAyjEiaRZ2oHNqUnfQaUD1tzek1tln+6sGeFKP3vQd+kDJgUuA7NwJva9gmogHo/KB5ljLBvnaRFY4zBkaVjanQyQMwBw1J+EE8BM30dAKZFw==; 20:THfh5pkNeRBnMA4+0tdj+azgCb08dYby9Q36JqyiystKLt2x+kUWgHESQe0RnP9WGw/PQzaIV2mf18yXWRN0G7KkXQxLx6eGwq4EamJjl6RM6JekaFIpJydbP8v2Va87t8f0uXUK+te6xSektFn0OqHUHrH1BdvRXAI5HWDrH0A= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2017 21:22:13.5949 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR04MB0403 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch does not change any functionality but makes the next patch easier to read. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/scsi_lib.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2c43b500e9f4..6b4fb48033fb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1858,6 +1858,13 @@ static inline int prep_to_mq(int ret) } } +/* Size in bytes of the sg-list stored in the scsi-mq command-private data. */ +static unsigned int scsi_mq_sgl_size(struct Scsi_Host *shost) +{ + return min_t(unsigned int, shost->sg_tablesize, SG_CHUNK_SIZE) * + sizeof(struct scatterlist); +} + static int scsi_mq_prep_fn(struct request *req) { struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); @@ -1892,10 +1899,7 @@ static int scsi_mq_prep_fn(struct request *req) cmd->sdb.table.sgl = sg; if (scsi_host_get_prot(shost)) { - cmd->prot_sdb = (void *)sg + - min_t(unsigned int, - shost->sg_tablesize, SG_CHUNK_SIZE) * - sizeof(struct scatterlist); + cmd->prot_sdb = (void *)sg + scsi_mq_sgl_size(shost); memset(cmd->prot_sdb, 0, sizeof(struct scsi_data_buffer)); cmd->prot_sdb->table.sgl = @@ -2201,12 +2205,9 @@ struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev) int scsi_mq_setup_tags(struct Scsi_Host *shost) { - unsigned int cmd_size, sgl_size, tbl_size; + unsigned int cmd_size, sgl_size; - tbl_size = shost->sg_tablesize; - if (tbl_size > SG_CHUNK_SIZE) - tbl_size = SG_CHUNK_SIZE; - sgl_size = tbl_size * sizeof(struct scatterlist); + sgl_size = scsi_mq_sgl_size(shost); cmd_size = sizeof(struct scsi_cmnd) + shost->hostt->cmd_size + sgl_size; if (scsi_host_get_prot(shost)) cmd_size += sizeof(struct scsi_data_buffer) + sgl_size;