From patchwork Fri Aug 6 04:00:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 12422613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2406C4320A for ; Fri, 6 Aug 2021 04:00:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCA81611C5 for ; Fri, 6 Aug 2021 04:00:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234965AbhHFEAv (ORCPT ); Fri, 6 Aug 2021 00:00:51 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:50514 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhHFEAu (ORCPT ); Fri, 6 Aug 2021 00:00:50 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1763uLlH012215; Fri, 6 Aug 2021 04:00:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=S+9lNb+zqnvUq1Ow16XZvYG/4MPRZPXvOBkNHWeCBzM=; b=lRF1SsIGWmdReuHqh1mOnb2JuAxhhssZxHZR513fAGoOtvr3KEmBowdgl3jNK+iDsggx Jwh/7jKV84yL+cqvsiUo7dU9rTRcPAgO6wr1iP0PiKlL7nwgCMJxdN+jenS+MPlsXCXt eNen+YeEgR+Ae5llXAws8ewHkPt8x9m9gWCDFOoTn4EkbnXefa7K4xHPjpnZv90geiZw wJ7P9+Az2N5siwpRPZgIJ5/HJhK2XojDmHAbLWBjxJeDxvqnEneo8ltHAwo3WPEnBtGU yjpZWKz+0o1zAuAeVRRviVzdAki3Bv97Q5ZxNO65x/H/JjD5cUrUS2XLYUEzwFj4ZOUC BA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=S+9lNb+zqnvUq1Ow16XZvYG/4MPRZPXvOBkNHWeCBzM=; b=HaZeCPtpdiEbNlyTNr3spkkqGtKohQLloCuxgF5FAHVCSqhEieaz/A5msuMLCZxw3nK7 eLhiy3Hz5ORAAP2I/Pq8Xklp9lq8YvJqXWODY5is+EAIvE5Ekp977KX2/8mTJ9hgkWYs 5tTtuMFTFW/p8XQVyiqzKh1ZQxrO5RMlT4HYp9WyeyUDLsoRAfGs5soQXXvs9ukgZI5P 8Dr6I7W7rV65qTwERm8iIycVjYdxp1BjXYz/bTx4QqoxChZfYU0+Lp0HV06+cPl7gxkn yZ8kKVnwhUVGl4pHF98kgUIo/GCRyLOGfs3G8h+rpPTsoov7Vp+BbX/TgGr1giu4qOy1 Fg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3a843pay3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Aug 2021 04:00:33 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1763tZHH085580; Fri, 6 Aug 2021 04:00:32 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by userp3020.oracle.com with ESMTP id 3a5ga1g8hs-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Aug 2021 04:00:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M/VIry2ZAHz57B6HsldKqkGSVNeeSlDBENz8kiA1A/+a+ghHGBU0RyQYoYmNM02GXSSg/G2NxPLs/E90z1+QL6oZ+wDoKdLEwPXYg7cmr7UQCMCsNqKSE+rKLy4/3AHKJhti7K5V3E89D9l1MCgAcqxlqFTXjlZVxkxvzUE4Gk6/xMo9k4mFMWYq9WFdWisdPBLnGEqx3qKF3z5tEY8WuqWI7lbkn3Yioy2drecFx+qf2bN7W4f8AS9bkfsV7u/IsOb0ZikBljTVGhyVXenZsUYUBMxDZ8d0eyr5n9EsRHW8G6o5Tqk70XM/GFs3YbzdIw3RX7tmicSoLWLbOhpYyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S+9lNb+zqnvUq1Ow16XZvYG/4MPRZPXvOBkNHWeCBzM=; b=HXWF6b+ewHBDGICMvdPV+MTXmTZoVbZyeSZbiTytfy0U15+TEizpzc5Gr8adbsnK+VAmZRmLj2scCI4eGYgj5ljH8uAACwTNFtsugz7L/Rm21VJTR+Lh0wpiSg7jU45OvlSpg3modlGXjMfSli5fjbNILAmQOgm1L2EM22SnM9YKtRRae0mHoi9GzqnVsfo8B9x153FZFV97bJFxUFO//MQ3zSMqBAeZRE4cmsg403UGmM0oltC7W4rnIFmhGKKDcRO1iqA9tDcsnuvibWll4xMXGpm/iV75C72SqRDoUZGCd0z1UBezRZQxsFu/qcP6x6zh2hqKIpJQkZTyJMvXzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S+9lNb+zqnvUq1Ow16XZvYG/4MPRZPXvOBkNHWeCBzM=; b=vZhsFrTy2aF+FdlFsMAsUWZRi+NA4yFdT7vlpwKHsJjfWgjqrp9WszBWLfFAnt7uUTmjbAPROy/iDKe01s8hUPTIGXEKgjq1khxinavXa2ZMZo+lp2oMWKKhokRs7l0+AIdHysuKvcRmIBcsqINBzWusjx/pSOu17c6BFu4Dxwg= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) by PH0PR10MB5515.namprd10.prod.outlook.com (2603:10b6:510:109::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.21; Fri, 6 Aug 2021 04:00:31 +0000 Received: from PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1]) by PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1%8]) with mapi id 15.20.4373.026; Fri, 6 Aug 2021 04:00:31 +0000 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" , Bart Van Assche Subject: [PATCH v2 1/5] scsi: core: Add helper to return number of logical blocks in a request Date: Fri, 6 Aug 2021 00:00:19 -0400 Message-Id: <20210806040023.5355-2-martin.petersen@oracle.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806040023.5355-1-martin.petersen@oracle.com> References: <20210806040023.5355-1-martin.petersen@oracle.com> X-ClientProxiedBy: SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) To PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ca-mkp.mkp.ca.oracle.com (138.3.201.9) by SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Fri, 6 Aug 2021 04:00:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b85d974-0f30-43cd-4534-08d9588ebbcc X-MS-TrafficTypeDiagnostic: PH0PR10MB5515: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:561; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XjjZ3x1Yb0xP6OeK6RTPOEEbFA6yJ/UBoqn4RAt31PaI1TyvJs2EE1IEL4qgt2IRJWuIxfOH538UhTTLnGA8mwzqO/dGkhrkU+4+NZsLP4vdTlaTP2yapxJpUy7klLWLBSaLyVuptu89wDTBTtU75bgAyGCdWBW9yzoBgMgDIoaql8As9Pyr+cH1LG+rmUAelYzLSj/XtUjpqQ+Jb8MqaX4MPpfyE8WSIxz/jUbmsaudOL7VeIKYnW8fa/kcSaTl2LX360UHbPYdCHR0A/BhMVNIfG7aHE03Va2IGjbmM56f7QJoEYQssH3H+/XQ535KoyeWz9p+ZjTO7x5CNoHa5sW8X/jXY7cf1CsueTApWxvQIPC3wzFPVv5oJmvHqz0kJvMeHgxoydC2dnqwtPuaDfI9gsnCCqHXgC0xMJlZmYFcRzvqmGPRHQ55Jl3RnuIdqBwXhGrybeZ9Hnwm4AWmoMnJBxSvTe/NfzFZn0F9KpEqkTLAJwhFrJZBOgZ4SlvjT0hIK27u2Rf0KayC54+Bx1fSTj6UM80SZLOjShJ78iX79spTfmksKX2A0CZquJJzY443t8fyg6XMyB/PBmMLBu/XstjN+EEEaC4oRRpqGv7QlEl/LTchbsXA9XcADHeWUHfImF6RpPKX36lb4QYJC9lJ+inmawdtRi4YSe24hl5hbM7xqjM0hxzkjTSx05a7M073dZNCxICiVTedfhtLzQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB4759.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(86362001)(1076003)(8936002)(66946007)(8676002)(186003)(6916009)(4326008)(66476007)(66556008)(26005)(6666004)(83380400001)(38100700002)(508600001)(956004)(316002)(2616005)(36756003)(38350700002)(2906002)(4744005)(54906003)(7696005)(6486002)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hZwQmzTkcCHxf7bgERBRVgM/XB8coN7bXf89FVa1odti6WVmpqK0HJqKkLFFbLT4vW2Ru4vB1rGFbOPP0uipBwCMev4PnkS6Oc+4v2fX7D/M78D1sKgN+Lx/DDxnyHq4iKCqTyKRvB85xYCaKR6OyYBYSZJqt3hyJFiRE7yvIBlccxyr7WubjCzyGakC8ZsZTNEwidIdNM71BNg6toE3fdz3EYUNW0VpuHjD67BzxHk6xZ9JNkW75wa1tCN45AO9cp1kQfA+qhzNo1ekUGMHUPSUPPd4hm0u4NFShp0BBtfGdeg8xlh3RNKwK0wVyO9b3w55wAaG5Mri7EKSO3fe/Qd5iFjNq8w2tGiR8vvpZed8MQv8+jlNW3qEhX1rDGsFJLJA9Alo6HeC6N2ktRLoPOyh/JEhg0PsCSsFEJvAUaDZ0gDea6FJxcK+DpZ8drnQx0EKgQIn6C8C3bRlZpMZffYv+pSArR5rvl+SHZE+r5rlFV+J/r6c6vwg/wb9ROl0rFTQVu3vjKpszV9ZJF0VhXSoHQicjFOjZ+RyaDYZygbL8v0+tLv5+E61AMbi8fNud9LMgVl2sPsL7lUDE1i3Hhgw0IhUevF6u+PdoL725QcZZ++XK8kx0NvXcFxNfy+t7kl0bB0BePAHYVlMsklRWoRJfsW2Ts99qtVvTAojqq+ZEctsjptbnw/o9PwfP+w2M6i/VNekiXHM4rxq6M83UdNm9fe6mNXL4EhG3onGH9EWZX5gcZNh8b1PhCj8j3Lf3jyagU452AVDYYKJf+w+TAWdmqZYEPTWeLQM7XKx7ODqCGRZD5N/HoR5PE00mrv0UegZmSsqClnGRYagFd4ghohFR+Tw1XHjkBVBRSHtS9x4hyKNd93BKcIpcB2hNIIHINrXKatp8sfy6KZirm6Eb6aP0GG/ziNhdxtL7O044wvIEh7i1o8DSR3kDRWgbVm/DyDW8Tq4rx89BS0NRotZVymiSQEMxBBtf37ngqJ9vuL3T9WUw2NZjarmXKiJAme1E6+BWa8hLjb/b60gTmjDqMpzp5WaDFtWbDZkvYGNgO9KIajgvjbnpa5Qy188ro1gVS4X5hUhq2SJrz7IgqX+gdXbfgS2xn8T+KfrIaztlHAyfbfKihLHyx0mm6QWgpKM8Ok9kbk2tlljGWwDjoKIKb1vZPLVYgNFf6q3MIdwwlhzG3mp/rbcGT8SjqVTxLbI+1XSrEXH/JR1Gaf29ShS276yT0nZyZY4Zouo6xh/HCKoAobQwD+nWyjMV8JwmjSuoqalRhDDNAuxGD9N6N3J49vL7juIrKpeNSLU33VZDNgVxXzXabnCuEkiC8q1Bkxd X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b85d974-0f30-43cd-4534-08d9588ebbcc X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4759.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2021 04:00:31.3642 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k+YiaxNjzy9MzZ4f+zLHr0igTDV2BQEeGFCa2X2r/VmPbtfXTWK2hMjTI8tiOlJzx5wV4+eyRYJMtYNdi0zm9li/OSG7LiiYVrXcAzspHlg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5515 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10067 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108060024 X-Proofpoint-ORIG-GUID: NTBT-hcBbhCcliAHIxjn5-Qi7xHv62_D X-Proofpoint-GUID: NTBT-hcBbhCcliAHIxjn5-Qi7xHv62_D Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Cc: Bart Van Assche Signed-off-by: Martin K. Petersen Reviewed-by: Bart Van Assche --- include/scsi/scsi_cmnd.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 90da9617d28a..804b2b33da4a 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -232,6 +232,13 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd) return blk_rq_pos(scmd->request) >> shift; } +static inline unsigned int scsi_logical_block_count(struct scsi_cmnd *scmd) +{ + unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT; + + return blk_rq_bytes(scmd->request) >> shift; +} + /* * The operations below are hints that tell the controller driver how * to handle I/Os with DIF or similar types of protection information. From patchwork Fri Aug 6 04:00:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 12422611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B57BC432BE for ; Fri, 6 Aug 2021 04:00:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2819E611CA for ; Fri, 6 Aug 2021 04:00:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234933AbhHFEAv (ORCPT ); Fri, 6 Aug 2021 00:00:51 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:49056 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231388AbhHFEAt (ORCPT ); Fri, 6 Aug 2021 00:00:49 -0400 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1763v3ZS021412 for ; Fri, 6 Aug 2021 04:00:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=9Ypisb0+vvelrTwcgD35F6/OzT3ZOBfnw9z47Pipow4=; b=UFSRLXV4gazkQmapi2O2hgBCIJdw3pRji2L5HVeP4C2TYbgKOmlXck+ZK0OWhGTbgZJq V7enL3ijStMLZVZSTnFD2JX31UHjHGpSzjiu/8prhOpJP4EAGmmowKhGczN8h0o10ELs u9n7LzktUOSxeiZi5rICIx4QDUahewXmhe4R/pL4OOVIIwq8oGEH7AUQH64jPxQd1J9g uTwxgSgFXW5a40Sq1ZMp8+KxtbqdsRTXKsGXKK5/SdJqh6GWmoa8NWFGc8a3kUPoSG5P V7spzNOuti6I52PTfdcu+gu7JJpiFI9+7VA4t3vHaytNXw+htABSsw+v/fZi10wnGokc UQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=9Ypisb0+vvelrTwcgD35F6/OzT3ZOBfnw9z47Pipow4=; b=yGzfBOosmC0H1cTbp45nVHAGVyT9eiggw+3wt9x8PRg5kqmkgWNk+zjj9bG3XWGrCWBQ QfN1aZQh5AKqsOE4lhRlMfGkEJmipJVepIS9alXGEFzS92ZNuMka0AHh0FisUNPlx+zv GHMI5FvkJUwXR6P7ceRZmz1QbzAVnaKLT63nuL8JYiZ4+luvFW8LICL+A8RfEroN7AVZ SSaiB98IWm/Bdzd5GXYTpPfImjD7/0s3r4njI7neKjQ6FxoxB0WfBeHIAoZQOq+1luIb TmB1TxjTgDGW71C0AOa/IWIdfUm4ZIZ7eAM1hHy7MoiKW8Ka+jmMfGuL6/WSaX5o18oC yw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3a7wqubvm3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 06 Aug 2021 04:00:34 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1763tZHI085580 for ; Fri, 6 Aug 2021 04:00:33 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by userp3020.oracle.com with ESMTP id 3a5ga1g8hs-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 06 Aug 2021 04:00:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FoP7EiJ7u+n9uYyF9ciMUhKO8hMkdUfgL3ruunSvk65KhA01TeHXTF371K1+yxDs9nAJCpph0T35D8sfZ0oyu4l0/ED/K4dglT6se68Tq+JlCSrd5C2X/sz7hzT68dgpYJf55JcSnsQzkArrFL7uPcS5cuaan8o5lh8VsxPbsNJWdHca0Df9iEkvlX/hmYdIKoz+MdurkCPQLVFKeDvnF7i7Cju3bk1xb0YPM1WpVOeLPXwy+Zm7eZXW2yQoubRPnWYlRuaQzC5vKGK3Lruad7pwEqUpj9eLq0W+Ewsut49odIS7qROlw1ccNZDbAWT3wo6cuMYVZrsJZz/7ZRieRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Ypisb0+vvelrTwcgD35F6/OzT3ZOBfnw9z47Pipow4=; b=cmD0kGUf0fE2PyjFPTgv9G9TWHDlg9FBTu11mQ39hJ5P35SuALIm3vGlwfmAQFEjJPmM4oPO9CD3/8kxV5LReCBmQr2RnSAMwHkhK5eIJCu/3GoaJzG6a+yzVCsZp7UvoG/KLoQEx1LcjhWD1Ix3NkxHLh0lGUIwLDVURSGslHaJ0N3DGLXqhBFlI+hM6PHIDKB5nt9Y7ia0XInvp89wdCL41LvOeZH9BDthNMu4ydlBs9dYjj0xD6Z3OiNW2fRicjGRVWzh2bZaEMkYAAJeyZgb31bHoR+X8i810Y0LB5G3Gy5dL8zox1GaxEElT21aR0GrfrLXYZTpuS1hzBy24g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Ypisb0+vvelrTwcgD35F6/OzT3ZOBfnw9z47Pipow4=; b=IDot6fZHQ04FXSnrLHUbmSZLlCbaENmD4Sb4c9qo+NAtEI94kn0EfQZq20FdjAwWjOQz3CMjKxi/UVL4KaNj5H6s91s/LZ6pDpMHvS5wbNKc/TObVn0f+N/0eYB+gGXQvWKIinsnW2PtJVgmOfCKxjc2MYEXY0PQvIwKO08RNAo= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) by PH0PR10MB5515.namprd10.prod.outlook.com (2603:10b6:510:109::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.21; Fri, 6 Aug 2021 04:00:32 +0000 Received: from PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1]) by PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1%8]) with mapi id 15.20.4373.026; Fri, 6 Aug 2021 04:00:32 +0000 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" Subject: [PATCH v2 2/5] scsi: isci: Use the proper SCSI midlayer interfaces for PI Date: Fri, 6 Aug 2021 00:00:20 -0400 Message-Id: <20210806040023.5355-3-martin.petersen@oracle.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806040023.5355-1-martin.petersen@oracle.com> References: <20210806040023.5355-1-martin.petersen@oracle.com> X-ClientProxiedBy: SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) To PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ca-mkp.mkp.ca.oracle.com (138.3.201.9) by SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Fri, 6 Aug 2021 04:00:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36a394f9-1da9-44ff-0a03-08d9588ebc70 X-MS-TrafficTypeDiagnostic: PH0PR10MB5515: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DQnDw28IxdHR9/f6/hxZ3TRR5rXck4xsfryVtMV8NjNKdOKV0DkqQ828t50KvKyuMv6/xWtl6R4wShT+jGw/BgFLso40vXPUCXtqMC1oKLIqpi9tvr3MvPVihtiHjds04Svn3wri7UYpzSvwRJf3Vi53JfyzeRCdPQPhZQ1xPlpa9D/coelOpKu2FpdaVLftN6LJwavhSePe3aAH45L6DZYie59tuetJtBOsCvT07mCzSdSle/GDcMIBPyC8ITqtxUEaC7I0wwTE236VjhhEOxmV0bKtywAESf2iOZi10V6UTo/ADIf/9G0s85PBxOgUP4ucdkLp2y2PDOX/H3qJ5uVNwJXJ241HmPpTzMEJuWspLnifTI6RvbiwqX/laz2BO+DtNMZJ2NqRkW5pUuBTcUJaM6roYrxyZKqQA3Aq5tBsu/R9D2XlCjCtmEYRoZf4jck6zHWfM9ZP/nWAcLYyxDaTeCzgPgviQR2ZgWQK7KigVBciQj7uKItMs4eO0V/0YH9qJTBIZITqiypW9a2fIp9Ixk2kYkU7sVAlJ32/9ZwFmyMhICP2xkACP6Xm9MTSZymhRGhCaBVecStlvVg7FcyNCRRiHsDKsWMHJKppzjKZhFt903gR+CuN/CCGzy4t8dBrOdW4xz6m9EC5K1dA36wCLWZZpFcQwkGaqLhs/tse57jsi8yRAuCzaPqc6dPIynY/7oeB+UXcTQw1jZ3GHA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB4759.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(86362001)(1076003)(8936002)(66946007)(8676002)(186003)(6916009)(4326008)(66476007)(66556008)(26005)(6666004)(83380400001)(38100700002)(508600001)(956004)(316002)(107886003)(2616005)(36756003)(38350700002)(2906002)(7696005)(6486002)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XAtBPF6kOj6xZMKssqzzZ2vzEei43XCfZ5rQP/z9xSgGqkwOPaJY209CJsGH1RXTszIieL4s5BLHZpxABWiUTzTuxBh7HBNoaZKvs3hGeVyidcszbb6nmtPwXrDZ1F4QtK5MqQegttkDAFK5YpSq0+YqtVSljsnAwYzKEbr+pYIDM/4KtgNLr0vowTLQHpZVDqMxInwRT2MxWWV8iEFTJlqvV8ToJCxFzyCr6D5hYd5fGt5t29quR3RXxNi02fuphm/Istj6zUrbI+PtTyFk6JST6OeUt7wL/NitqawCj7vzCn/bprfHbMp0O55KXTKGUvsA9z7iXwHOjIIfFVtGJiN634WA3pu4BSu1udxI45aEHjWd/+jSK79eVzDTRDPPvlx4T2meHPD4EVkE44IirPvi1JS3CZgey6qiuuoMQYE5kMHqr8rDTWTFdamDZv+wBTX/aYQlrdWUJJhpR8OS4kULzEWJslNrCSxmiNh7erSKm6LiTBh5/Ss900j1eUBsRrxAywAEBjWglru15ppTUNQFAsKSea9v9fNEtQswbipwM1PZlr1Rsr/WUMJU1hrZBH6+sHZhIDkWKgaBPqr27Ex8Gak9Vz7r6GLAWw+9RhbhwAPJ8DBKY4M7gHwGNth6s+XVNIxQQJjkISU1VljsUruUsri5pPx+Mzj7Qkn/iCV1/mNYZLRQXNvJt1gWISsD0qbgbtDj+If1NCbJ6/Z7Z3xck74dDO1BranfCyWrK1lKjid+uLSmjWLmAlUIc5XMwgaGjYYuSTrv0m54gEsOFBiL/qXQSgM6k3MxN5xxVtzh2vvTx3MiHgGaqEEmUtgx6pjax8Q76RH7DTZl4e7LMq+RvXf/2fJByLbP+eZP4R8ZxQvMe/07k8CGTPT02L4WyDOKaYDWCKQK5menJGgL3Refbr9m8xpzzruRhlgz0N1ISbvkQXp0aSthtknw7j6gK3L4FBcR0Eokf17o4hceM7EGCtyTK+d97SOHvkUAU4lB57C31lEGZ0DuGc8cLrM+WlV4x+UeDpSusR3Lw0n2IgtNIxW0CQlUIrvgpQxQTSIzTSf3bxWeKHKGA5LUTb6NEoabdqRTUvtgB+jnQEG1wFI8DGq0jy4rDSLwMLtKUTDjPULKMT/MDBImGJe2AefuVapuYMRXt+YWmbJbe03YcGIaj/2a77pCI3tryjlovIPhrIePKzNW4USx6oRfRLqI+UCNep/3WrF/a+U50bn+B/OfItrNby3ViJ0F63D/MHaTNZ7WyfhZifOCgheFusu4qfGYr4flPvMKcizGlu+e6SvzrckKYD1GF0w2HRnOoT16aOLq5NUiLlxsVCGXLMLW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36a394f9-1da9-44ff-0a03-08d9588ebc70 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4759.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2021 04:00:32.1706 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: juc4uDwh8k+7Kc3OfKD8X5yIzJemKcJT0Vdz2YXFbmgeWfCJ+SvGrBxSy37GTAr76TDxpRhXWEpltYP0WrBtLldjO9P1vv7H8RSJLlLHmLs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5515 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10067 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108060024 X-Proofpoint-GUID: 1DQbo6mwGZCDzMgIJ_gNEmEHvq-ZcX2a X-Proofpoint-ORIG-GUID: 1DQbo6mwGZCDzMgIJ_gNEmEHvq-ZcX2a Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use scsi_prot_ref_tag() instead of scsi_get_lba() to get the reference tag for a given I/O. Signed-off-by: Martin K. Petersen Reviewed-by: Bart Van Assche --- drivers/scsi/isci/request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index e1ff79464131..fcaa84a3c210 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c @@ -341,7 +341,7 @@ static void scu_ssp_ireq_dif_insert(struct isci_request *ireq, u8 type, u8 op) tc->reserved_E8_0 = 0; if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2)) - tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff; + tc->ref_tag_seed_gen = scsi_prot_ref_tag(scmd); else if (type & SCSI_PROT_DIF_TYPE3) tc->ref_tag_seed_gen = 0; } @@ -369,7 +369,7 @@ static void scu_ssp_ireq_dif_strip(struct isci_request *ireq, u8 type, u8 op) tc->app_tag_gen = 0; if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2)) - tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff; + tc->ref_tag_seed_verify = scsi_prot_ref_tag(scmd); else if (type & SCSI_PROT_DIF_TYPE3) tc->ref_tag_seed_verify = 0; From patchwork Fri Aug 6 04:00:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 12422617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 329AEC432BE for ; Fri, 6 Aug 2021 04:00:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14958611C6 for ; Fri, 6 Aug 2021 04:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236367AbhHFEA4 (ORCPT ); Fri, 6 Aug 2021 00:00:56 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:14104 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235416AbhHFEAx (ORCPT ); Fri, 6 Aug 2021 00:00:53 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1763tejO004705; Fri, 6 Aug 2021 04:00:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=EHxbfiXOr8AmuXUao0jGUJigZ9wMFu5N24G/8uV6XxI=; b=OqUOAAI+tTM5ujh5kyfiKTedwq28u80vO+VDU0rWCKKcT21jtl8zaJ4X7enCFMRcN/7S QUtM0vCKS0xmr+TX0ueXfZc74UltshDtS+LO7hAIKRUn//UgcwNkY9AeY8aJBJ+o9uYG 9zTMBbrzoUdbQ9+0+UWjdFeMfNSyJjkgqhb3sN/3bQ0WFy3fopr1ERhrX3XDDEGPCU+O tqWA/hGq0KtKwp96ZxTMIOgWpdhEMjJXvi+SXH9NHeofxnKBSw4I0hnA5rzphiJZtvCv ooWqbAzxJjTMTBhk2oLNfFeeHGhFuWgyW9fsRISHmIYLK+a70/5NOjKrHdWz+ia4OHpB 7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=EHxbfiXOr8AmuXUao0jGUJigZ9wMFu5N24G/8uV6XxI=; b=dnObSKsFmtxpZMBkrgmxQOxrFGf1Vcv9DgEnqzDKKpIOCE188ilS8lWelV78aoMBEl1h QxDJ8tOXQaULGetMf+jxppy9hoBdFxsvI/PbbHce0I6Ztgpl8Ul19chXWzQSpM0HhfG+ EKq5WwBTJS7R+GhK3luZC8Q9Rxfu4Y99a2c7U9hJsxiTdhc1yz3Q5jg9r4Z938vi67Z0 2DHQw3MLEsBenfj5Db8KsU8UeaR1wdsacIkn9WVg6ZEy0rgfnsv+B0MNq/Bv9cS1pA9y pbNcHzbzh1JwzImL1RSK9ncXyQo1Nvkrk0WF7xpa2jepsv0DS0MbjJs8Ofq/va9WRk0y sQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3a8p6rgmb5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Aug 2021 04:00:37 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1763thsX153451; Fri, 6 Aug 2021 04:00:35 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by userp3030.oracle.com with ESMTP id 3a4un511hj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Aug 2021 04:00:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=naQ2q+dJKp2pgfGMT1RlxhuR6n2Q6MNDmPtQvXfQZODTWCfZkLHjkyKsYXDXEdMhVJkBk+ho5l2HX4YwTB2jETVxEZ22X1/QmzE9IUzm2Z7n1JVhpR6ZRzo28Uf1IlQLbOsPOFsHqqPDFsW2gxSrl42yG8oUur271Sa6WES5j2CmWNaFa61u90WgAw3pzEJkoMR6HTUJf/D7t+zswfda0nDhu1ztLq1dWXOPT7en9qYeTB8yEdE//re+09EhErMfi3keqgctpWGyySLgMH/dN2taH4RA3EV+x+X0Enu+N9rObiWc03RO8MA0JLOrvOmhW2F16puih+uJadDXf+U4Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EHxbfiXOr8AmuXUao0jGUJigZ9wMFu5N24G/8uV6XxI=; b=FNzxZCY8+ksJD+oiEMyX+v8F5h9qjAR20lKJxxCQixx7Niv5dMvk9w31Z64yO8WxsRtop7N4T93q79UVFWmtZbJ4maTZDWXsuJcbCbOxcgwH6hKwF1/TfsykfuVw4b5aJoHd7DBnbZcj6EqhAJ4HHu8wSHayC6eHdvHQe9i/l/2zIM8YAwzAuC7FC5B1f5YUhGwTqt5j4FrfST+NoAT1W8PXJckZ8Z96eayp6frOb7NmFOa/eI5xDspEIrzGA+1zLhrGJ2GNQ4jWFL0DsNGl/uPpg/dL4u45TqRu6zqEreUOS28ixLeJ50EEbvm2yBiZ53ozGAxyBWie1mOvGrXgSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EHxbfiXOr8AmuXUao0jGUJigZ9wMFu5N24G/8uV6XxI=; b=ChAdOm/9wIbJa90CVw3MyIj/MV1mrrQgTkohSQw4W1iBhE/Se0FpUIGBCPTCS7LGNzkCI4Qp1zLHk95r+wLyCrDJKeGaRoOVedPsmLQRTEyVryEfxNjx+zPJeuwUZBar2txYsA8xLKoO8PI6FRIwFQu5iIfpF2ETLUUShWeJOBc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) by PH0PR10MB5515.namprd10.prod.outlook.com (2603:10b6:510:109::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.21; Fri, 6 Aug 2021 04:00:33 +0000 Received: from PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1]) by PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1%8]) with mapi id 15.20.4373.026; Fri, 6 Aug 2021 04:00:33 +0000 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" , Sreekanth Reddy , Kashyap Desai Subject: [PATCH v2 3/5] scsi: mpi3mr: Use the proper SCSI midlayer interfaces for PI Date: Fri, 6 Aug 2021 00:00:21 -0400 Message-Id: <20210806040023.5355-4-martin.petersen@oracle.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806040023.5355-1-martin.petersen@oracle.com> References: <20210806040023.5355-1-martin.petersen@oracle.com> X-ClientProxiedBy: SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) To PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ca-mkp.mkp.ca.oracle.com (138.3.201.9) by SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Fri, 6 Aug 2021 04:00:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e5cf2a3-a682-4812-db42-08d9588ebd03 X-MS-TrafficTypeDiagnostic: PH0PR10MB5515: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1247; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IeBC1gxlWWlX/+UqP+L8c4LKX80YpUx1L4dT9tmCNIsWFcfMnLtDL1pyMip23XCb97kW9WCwKBIAjDcQB5VSpnC8ShbbW1Ph1iiCOy6iU3+dddfFD9E72dW2Hjo/NxUqIuACnAJq/I0pxK+2SxMvL1xf36VDHm418kp5pvEmR2Xc4M2CY8PYbO85VYORYuoNZMgjrAj6t5eilsbIIXSfDRXAkaYIOvBGmCmvxfVtkoGwKErUE2XCu04GTTq+eAS3+3dFWWVW5F2rqTXd8uQ9LFUImK/VZj/rLUXh8x4B/M0GoVYNJHLVOhk6GZW4xJ/875YPTepAeAOvbIQdOpalrkGRTC1ZJX8dyLbTZ4zJAVtFXfZUfLb4tI/FuQPjPH3BX1z1yLSHTLwmsTfJEvKQ7FQ+v0W/iAmtn53DFYtyBgz0fQPyh6TSqKoxZWfJ5SbAYcAIrxOOJswIq2YJp9CjicoimAPXgbE359rJbBoVuD3lvlbgbEWxjDvJI3BlI1ExtfBxpuRB01Nspy6lKxVaIM6JlMH5Bqwy9MDQHGJnD05tnQq1ju4JbP7YGtZGxAhjOBdboMaxQkBgmYfpL+ocekMrHRYcZXV87tno4MUcR3YTDK3eMWG1Rf9/eDeWZ8xetsNHAUyPR8ZVovbd4HFOjz7WXzewC8deKATFSAMH7YvqTTOFwmCaKme74DeKs3cmWN7sIm3pL0lgqtqgvmGTBaZ7K2EwWP1lrlCTNoQeiZ8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB4759.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(86362001)(1076003)(8936002)(66946007)(8676002)(186003)(6916009)(4326008)(66476007)(66556008)(26005)(6666004)(83380400001)(38100700002)(508600001)(956004)(316002)(2616005)(36756003)(38350700002)(2906002)(54906003)(7696005)(6486002)(52116002)(5660300002)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IKX9g/UUgu1M/YhzQMT36up9hGBrE2CWAptkqTFjbCm2HnKlj0wCnNESJg1GIDP4pvHkEmTUICEkvMTEcbu+o/WtybKwRTHt9luc9txsAof+MsivgVnw/rLL/d49mSMjdyPLSufdwORdQ3qg+FJNoi3EhBVBqdzSczWvvOFwvrWOdvbH1G3OmykGON/efirOHe8g/x+o4Tu2uZz77RJa3WAS3RSbh1JSsTwAeBmHrThlHnh25/ZzVNPU3Ex8anE8ADJwvBGYoFQJpkjRys7twXIYKh+ZKdpO7Hwp2yDuzPtYlUC82knvn2jPlFZo+ylAttA9pqY+X+u0SqVDRiARuUkQnio7nUKA7ZSFFiTADeWxLkRTTdOYIOdeO/0d/i4E1l8eoo2fvWPtKhZB4sb/vnt2y/LmblGJEDJnfnAfk5v92v1+qxiGBjgdFx3qb2+UmuKMTx4oO2++BBs+TNHQGvbdyqlWJvHnSNUd64O/BMPCx389QORTCB6ycjPYIoaGyQ/e30VSoVpVHxJ/mpVDECKnbbUmqGG+n1jD33JHCh2VGo1Dy1N9GfMEZF1JSG3xFRCZeBPpC8O7HZPqR+HkZcksw0rtN4Suapl/3ap86JaOodc98IypqDKSU8Ez3YlPg/s0CXnkb+qZDwO90BDg8FvXfytByWwE1wRdtvStjy4D41V+dImhBa9SlRht4IVMRr2jOyytX2IMcEshTfU6GCW/HhM/Xk06RDRe5q74EwttseVEoelUbXU8e7ojQ5WC64gFrKJNUc2yOLojh1sseGh+evEDTmkgZ1wIA3q4+0VcnRpIPCSf/7o0APaNT9gX31QO8WMuhJzbiQqh6GxWcjYNqsmpg0TT8bb2OJ/OnkkqwST4iJLilEzMAokek2JyTA5U16IoxRCIjULPxG09iCSfL3vBmZeYehGIjSDTt63Vzer7XqiE1gB0nn1pRJumtzoWFQzslhm0DWUBK4UUicrdb7VjW6RUvVdfWW+uMsx08SwL84ktq8tKxRFsyT/Acg+BgKWFK6BNZaESjoA4TfakD5h34jFbYdbJPIu7Zg35dRogGbyiNyrYwi94xC/LHSl0Hph7cKzqul7ihpGsQz4QovEBmRe1Td5P1PKyBtKDBLXOBnXnO0lvzdPkwoQfnxYfpRZBY7Y/DaTOgn6gSdDS4RWKWxbH/rAvzBe4CmiPy++6wB3msq9DZgTRYVRJtx7Ay4xd9TeZXmizLFrAW3eW2h3Dpyc65gaFVFOhmuH2K87r4bjN8eJhRjtQb4bW31z5W2pWmKzl0BPwNTfbvlYA76efc6YE+wX8jiwgpcFuGCPmu7TRZlgFZYmoTXR6 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e5cf2a3-a682-4812-db42-08d9588ebd03 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4759.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2021 04:00:33.0906 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uzJF7yjjxql7CGynEsdGXcABNmaoM831Rn/0bvrhEKKny/L0NEuIkZgn6XGN8RZjq7Nt3Rd9lll+FEeVQEQ0tggNUjpvbePT/eeumE5p6LA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5515 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10067 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108060024 X-Proofpoint-ORIG-GUID: rD5yl_LYfwz0OuwozvqlpUTUBElRjVYf X-Proofpoint-GUID: rD5yl_LYfwz0OuwozvqlpUTUBElRjVYf Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use the SCSI midlayer interfaces to query protection interval, reference tag, and per-command DIX flags Cc: Sreekanth Reddy Cc: Kashyap Desai Signed-off-by: Martin K. Petersen Acked-by: Kashyap Desai --- drivers/scsi/mpi3mr/mpi3mr_os.c | 59 +++++++++++---------------------- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 24ac7ddec749..3df5507c4768 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -1963,7 +1963,6 @@ static void mpi3mr_setup_eedp(struct mpi3mr_ioc *mrioc, { u16 eedp_flags = 0; unsigned char prot_op = scsi_get_prot_op(scmd); - unsigned char prot_type = scsi_get_prot_type(scmd); switch (prot_op) { case SCSI_PROT_NORMAL: @@ -1983,60 +1982,42 @@ static void mpi3mr_setup_eedp(struct mpi3mr_ioc *mrioc, scsiio_req->msg_flags |= MPI3_SCSIIO_MSGFLAGS_METASGL_VALID; break; case SCSI_PROT_READ_PASS: - eedp_flags = MPI3_EEDPFLAGS_EEDP_OP_CHECK | - MPI3_EEDPFLAGS_CHK_REF_TAG | MPI3_EEDPFLAGS_CHK_APP_TAG | - MPI3_EEDPFLAGS_CHK_GUARD; + eedp_flags = MPI3_EEDPFLAGS_EEDP_OP_CHECK; scsiio_req->msg_flags |= MPI3_SCSIIO_MSGFLAGS_METASGL_VALID; break; case SCSI_PROT_WRITE_PASS: - if (scsi_host_get_guard(scmd->device->host) - & SHOST_DIX_GUARD_IP) { - eedp_flags = MPI3_EEDPFLAGS_EEDP_OP_CHECK_REGEN | - MPI3_EEDPFLAGS_CHK_APP_TAG | - MPI3_EEDPFLAGS_CHK_GUARD | - MPI3_EEDPFLAGS_INCR_PRI_REF_TAG; + if (scmd->prot_flags & SCSI_PROT_IP_CHECKSUM) { + eedp_flags = MPI3_EEDPFLAGS_EEDP_OP_CHECK_REGEN; scsiio_req->sgl[0].eedp.application_tag_translation_mask = 0xffff; - } else { - eedp_flags = MPI3_EEDPFLAGS_EEDP_OP_CHECK | - MPI3_EEDPFLAGS_CHK_REF_TAG | - MPI3_EEDPFLAGS_CHK_APP_TAG | - MPI3_EEDPFLAGS_CHK_GUARD; - } + } else + eedp_flags = MPI3_EEDPFLAGS_EEDP_OP_CHECK; + scsiio_req->msg_flags |= MPI3_SCSIIO_MSGFLAGS_METASGL_VALID; break; default: return; } - if (scsi_host_get_guard(scmd->device->host) & SHOST_DIX_GUARD_IP) + if (scmd->prot_flags & SCSI_PROT_GUARD_CHECK) + eedp_flags |= MPI3_EEDPFLAGS_CHK_GUARD; + + if (scmd->prot_flags & SCSI_PROT_IP_CHECKSUM) eedp_flags |= MPI3_EEDPFLAGS_HOST_GUARD_IP_CHKSUM; - switch (prot_type) { - case SCSI_PROT_DIF_TYPE0: - eedp_flags |= MPI3_EEDPFLAGS_INCR_PRI_REF_TAG; + if (scmd->prot_flags & SCSI_PROT_REF_CHECK) { + eedp_flags |= MPI3_EEDPFLAGS_CHK_REF_TAG | + MPI3_EEDPFLAGS_INCR_PRI_REF_TAG; scsiio_req->cdb.eedp32.primary_reference_tag = - cpu_to_be32(t10_pi_ref_tag(scmd->request)); - break; - case SCSI_PROT_DIF_TYPE1: - case SCSI_PROT_DIF_TYPE2: - eedp_flags |= MPI3_EEDPFLAGS_INCR_PRI_REF_TAG | - MPI3_EEDPFLAGS_ESC_MODE_APPTAG_DISABLE | - MPI3_EEDPFLAGS_CHK_GUARD; - scsiio_req->cdb.eedp32.primary_reference_tag = - cpu_to_be32(t10_pi_ref_tag(scmd->request)); - break; - case SCSI_PROT_DIF_TYPE3: - eedp_flags |= MPI3_EEDPFLAGS_CHK_GUARD | - MPI3_EEDPFLAGS_ESC_MODE_APPTAG_DISABLE; - break; - - default: - scsiio_req->msg_flags &= ~(MPI3_SCSIIO_MSGFLAGS_METASGL_VALID); - return; + cpu_to_be32(scsi_prot_ref_tag(scmd)); } - switch (scmd->device->sector_size) { + if (scmd->prot_flags & SCSI_PROT_REF_INCREMENT) + eedp_flags |= MPI3_EEDPFLAGS_INCR_PRI_REF_TAG; + + eedp_flags |= MPI3_EEDPFLAGS_ESC_MODE_APPTAG_DISABLE; + + switch (scsi_prot_interval(scmd)) { case 512: scsiio_req->sgl[0].eedp.user_data_size = MPI3_EEDP_UDS_512; break; From patchwork Fri Aug 6 04:00:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 12422615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7526C4338F for ; Fri, 6 Aug 2021 04:00:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B163A611C6 for ; Fri, 6 Aug 2021 04:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235696AbhHFEA4 (ORCPT ); Fri, 6 Aug 2021 00:00:56 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:54708 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhHFEAx (ORCPT ); Fri, 6 Aug 2021 00:00:53 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1763uvXC003359; Fri, 6 Aug 2021 04:00:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=x2VD5ZYiiW4lvdsyGVqRQiGCVdLxONp33LV2+ekog5I=; b=Z5NKNAWoM9JDXP0WdREuFgtE5qnx2dvBaT+ftyX247w6Tf/yW0dLCYQV59iEuiULPZo0 UjMHM6YDRyuan00VjrMgpDGbS7o1offeP6Sp4EnauZd6+3mHYw9aCKKHJQZRUWCsl/CN /verTGgjXyJ1bv+s7vgJ9OQR+8SiSLgb05twlF58IeOx8i6ekUpzf2cG0yA0g/yawXNI ICviCvydK5FUTF4Qf+2ciMXGI4Q6kBjj79F/u+zfIlECjNLp+wjdmzoJMvVlfc+LZTGT wu+R+Pt65xAlugxv16Wa3HFMgYPni90mnPd+leQpUwHApA0PsP+VsoKFmn4DBwaWDGiF EA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=x2VD5ZYiiW4lvdsyGVqRQiGCVdLxONp33LV2+ekog5I=; b=Bw3+pV9uLMKhNTRMfFQkXJHbxCIxl31zncTdHpEGYA2El6ob+gwG8JM+XxxyiNdPdBKi A1pIwmENAwMIfhzH9l2gO4P36KrTUEt0AZ82am26G4HcLzDln8e/OLPAfb0eCeHAMxHy ZennYNHbitZSLFKzfNhOG88vjRe9JzHaoYb9mZOKUPnR0wZkzP4jSLUP2gPrGiUcm0Gt zCGIr9iygdXsctuwDilZ8x8xjqsv5jlkutLXeQTWZfBfIMF/5L988aM4y/vrkgXzqlFW 7pfcXD05xUqzrl7lzBAGZqSsgG/Lz8aJTaf+KSDmG6+E+SYuei6VSeeNu95PEfFY9mId QA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3a7wqv3utc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Aug 2021 04:00:36 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1763thsY153451; Fri, 6 Aug 2021 04:00:35 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by userp3030.oracle.com with ESMTP id 3a4un511hj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Aug 2021 04:00:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XAoJ72HS/vgxyzxrNeGKPGhpdbQH0jr8TLEexYX0IvLE+69Ctz3GxdCYDllcBy4/w0CZaMDsjUQkaPi/kk62kfxHx9ii4PJFvY/0R/vgxbHd7pxInj7C3QhSSYd68tSZjvrfP8Bb0h4w3vo1cARKHc9FSIrYi208LlNUIhlOEXx4nFMu/ukeb4ITg4lribiIU4TBSWNlQ5j4s7Hr2e34aXOnu4dcivv1lAzbukkV7xah44hYGHmmiyGAfiS/UbA5V6p1D0SVsrDC+e89SuWuLXBHg1MkcHFskJmrwxMmWtHaaW0Y+tFx068dSixJr9FqY4bXd/OOrnSukgZiwzZcXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x2VD5ZYiiW4lvdsyGVqRQiGCVdLxONp33LV2+ekog5I=; b=e/HMlCpsKthVbnwVjItK46C904Uxx6eRXqKtXiNdO0T7P6IF+O4o+8E6RxXh7B5k2qxUskdxdJdEsaxO0kwUf7MNrN76UZbfVyVNYAoyHNmuicGghq0+fNWlNzt9mZ948pEJTxT2L/iap0/FZFnx4XquLd/hDJkbugRyx6OEkZ7wwZprokt4qjQh9wkDJuGJwAwGoWmm42yyhGerfu689HGYK59y78o4IFxm80WAx0COHGhgN7ROMGfzbPYr/HhgJUFSTkOQmhtKtGDA1Mn/uSOmFgshJHojWiEaZh7vwlH0wD5i5/HtOuFez8kRBun/+da0UOGE3LeumG0hYxbSWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x2VD5ZYiiW4lvdsyGVqRQiGCVdLxONp33LV2+ekog5I=; b=WjkWJ4rrpviSkmdS4PkM3FvlnWW3y5WZmjnLzkrNAD8DoZkyD4KZE+zapZ2U0vBsydCmqJgcJ8xRZrp40grbIX2jJhr8kdMp3oeF2jCwNXJnnF3taZTMNnLG35TWQGv/VhmPi13gMeVtAQ+7ErMrjsZkaf3GIYOH7k2gxfO/f6c= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) by PH0PR10MB5515.namprd10.prod.outlook.com (2603:10b6:510:109::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.21; Fri, 6 Aug 2021 04:00:34 +0000 Received: from PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1]) by PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1%8]) with mapi id 15.20.4373.026; Fri, 6 Aug 2021 04:00:34 +0000 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" , Sreekanth Reddy , Kashyap Desai Subject: [PATCH v2 4/5] scsi: mpt3sas: Use the proper SCSI midlayer interfaces for PI Date: Fri, 6 Aug 2021 00:00:22 -0400 Message-Id: <20210806040023.5355-5-martin.petersen@oracle.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806040023.5355-1-martin.petersen@oracle.com> References: <20210806040023.5355-1-martin.petersen@oracle.com> X-ClientProxiedBy: SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) To PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ca-mkp.mkp.ca.oracle.com (138.3.201.9) by SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Fri, 6 Aug 2021 04:00:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3cdabf94-9a6b-44b9-2a99-08d9588ebd8f X-MS-TrafficTypeDiagnostic: PH0PR10MB5515: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1247; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PgreySQpeZRwp9FWHu/Uw+tgNY+3AZeXg6YksTrmJiUYfzCCk97zdjVWGhE5VCR40Mf4nFRPSNuPJqHIvVUszG9wEEpSG5JurAfBX3gxpBV5KA0H55EHuI203Q6P7n8dh/wT28+tOF/4WMt8Q9sK+mkNki4We+RRVtlS53+GuQhI62UdozYmzwhiCSYSPpF0PbFVOm0E0mcFLBJqd/6FSbe90hOAybKLUR8AqVQKnmNwRY8c9X1PV8Yge3ooihVEXIILk10XpRjcQV4yGEM2U0w0E+WulraVkRY/zjKQ8DVIDoXtfGAt+vvb7uvwpa/9wMJUzSzqs3QaJQTNYUvE8m7dRYmwCiKjZJk60Nv9ItaaEu64WvGEJ3oUCw312VBXPLB8yqgiuvOt6CrUDXaH8/M2ZlMPmGhNaCWfgUMA9SlLA/mmkuXzm1gqwt5PejoZP6BtNJVf4waztqVAjNWKs+zIjgVnWEe6k2dwBUoHEqJ7W6OkEPs0MEJ2+MZzkQ5h6s81uQpurfa55knuFv/iSZ+zIdHP64fJrAs6OSQhUWKG37KNpXk5Wny8VLJTIxD/iL2pWiwxYhFVPwAbL7rVD0OghgHVnc8iLO04hF0CkgwCSSCrwYIkbs0laS4hpkJ6pTtt4BKtsxWcavf25el8TIfKX/g4zs7t9R/kzkJldOtGhiV3SGy/jVQMyRCXfp8+IdBZSnznhcb8jlCjZEYusjF5N2t2fp6bL1/POdddRNQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB4759.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(86362001)(1076003)(8936002)(66946007)(8676002)(186003)(6916009)(4326008)(66476007)(66556008)(26005)(6666004)(83380400001)(38100700002)(508600001)(956004)(316002)(2616005)(36756003)(38350700002)(2906002)(54906003)(7696005)(6486002)(52116002)(5660300002)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ICoKnOiEjpDvgp6mF3QoLPVQeUl7wtMAQhwX3G20RbF/02n8PkrOtt2L64HdsScd64UkSrg5lSgbk0Xfdraq6+qMXHfId0vKrMWszpAI7nBHjifu/RYKTwIO1UT6wKpF8jw2qUVjLNiwm+5CEtrLh8ELCrKcrLS8gS9KSh+oTk6cG5J9KaBgFiwBGoUPl3CukRWYNlDInsf9sc+0HuB6fSbbIN2jmlM5hHbCi/qk1qoOd2YnJlYJUA+5+Jbto9IQnGpS07EkcT9ToMtvZqP+yw4rXM8CYtSJAgwOq2xzW9jcrqUjOhh57qCJPJPbg3ubLkfEQ8fsfsMsM+NDtV7ecAH/rPMOleFZ7pxMP5Qsh/G8X6w5dX/RobUFChQQsrY4T6CB5s2RrW2k8NqDxNlcJ+XPoDIaIbiVXNfkjYaNg8/UPakQPxMHgVjdVER330PE7YhTOyaGabZ84ZWhiZ/sKHOFklh4XG3gP6ACBUI0xR4XQ7UZwX9q7h5S4Cp6a0umfifJ5mkQdht9GRBFMWEpabbX4wdZDCkAUcQ0rnmDVtkt2/YOxuRDIOwGUfGhavMAeJ1CUQrXXYTwXm7CqzIppEmZywLHYDlaaqbEu8loDeHQFQ06evPzmQhXmkYL2Y7mQgO5rgl6wse97XUh03sqvwyTk+7RAFr4AFP2iPMlGz032AAikMZtNxUw5fSATAEbuPeAJy4cuB7hTGeezDjHnIxZrhxkdYEWenn6A7InwYxZkBuRUIhqdIUFBOxiVhsBh48BNTf11q/KlfgkFeu2lAWSmjWFLUe+lvgNfGtuOsnP9iBMmhp91c2K8ffzbXBYZMuk1Ll8kV9hccHUGkojpPB5IMDpQe2Pt8MRdu4osnZFtr3eoevxJjKkLodYzBtSw/jGEjVcdJPPzll9tbtPu3215La3FhdVj4QNP0muXE70XJAM4Wdw4ZwepkiVYvv+FiQUiBnhS0R0OT0AKXkQdt3slL6mQTDSlt9ppmrSXMBO+SX/82uwObY4CmvNwbxRuYX+TcR7doBTEFNvYqhj5M0KESxyNESCIECrcwMSYCOPab6ciSPzY2h2e2sPdbEv45sbBPeBev6o22kUXj2dyk4qPlhZ1bUKzUOyi2/8DK8en4l1sgK1uz6mDKNx2MeKiIfPV9nfRjfJdPEUf/pELwBKFK3uJsLkgiogExR4kzcgTHlewPQJmbM8t1mhQL/BiIJVLBU8AF8+BSqG19ydaVmb/Phg9TJ3hVnl7t+w7+IFoLqL0PxKGqgVr9QM6JA+8GarthtsX023F+Q1oXy3eXCb45FrbDHKZtQTLboXiDodPXPIbgsxA6Jpnhlno1CV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3cdabf94-9a6b-44b9-2a99-08d9588ebd8f X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4759.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2021 04:00:34.0274 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5oQWwPsJ/USm8x5KGWuxddQnlOBPPo0VgKbnYEXUW2/gXRhjc90+Ygv19zfcRSKvOyL3boQGZiaUvV8CsddQw93gQwhU4l2PNTz4o9hF4rw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5515 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10067 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108060024 X-Proofpoint-GUID: FeuAtUlhJHNT9C_EVxnZ6AjNKEx5rkcH X-Proofpoint-ORIG-GUID: FeuAtUlhJHNT9C_EVxnZ6AjNKEx5rkcH Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use the SCSI midlayer interfaces to query protection interval, reference tag, and per-command DIX flags. Cc: Sreekanth Reddy Cc: Kashyap Desai Signed-off-by: Martin K. Petersen Reported-by: kernel test robot --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 866d118f7931..a66cea57fa96 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -5062,33 +5062,17 @@ _scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, else return; - switch (prot_type) { - case SCSI_PROT_DIF_TYPE1: - case SCSI_PROT_DIF_TYPE2: + if (scmd->prot_op & SCSI_PROT_GUARD_CHECK) + eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD; - /* - * enable ref/guard checking - * auto increment ref tag - */ + if (scmd->prot_op & SCSI_PROT_REF_CHECK) { eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG | - MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG | - MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD; + MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG; mpi_request->CDB.EEDP32.PrimaryReferenceTag = - cpu_to_be32(t10_pi_ref_tag(scmd->request)); - break; - - case SCSI_PROT_DIF_TYPE3: - - /* - * enable guard checking - */ - eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD; - - break; + cpu_to_be32(scsi_prot_ref_tag(scmd)); } - mpi_request_3v->EEDPBlockSize = - cpu_to_le16(scmd->device->sector_size); + mpi_request_3v->EEDPBlockSize = scsi_prot_interval(scmd); if (ioc->is_gen35_ioc) eedp_flags |= MPI25_SCSIIO_EEDPFLAGS_APPTAG_DISABLE_MODE; From patchwork Fri Aug 6 04:00:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 12422619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87880C4320A for ; Fri, 6 Aug 2021 04:00:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67F44611C5 for ; Fri, 6 Aug 2021 04:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236742AbhHFEA5 (ORCPT ); Fri, 6 Aug 2021 00:00:57 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:55606 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235355AbhHFEAy (ORCPT ); Fri, 6 Aug 2021 00:00:54 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1763uLpi012206; Fri, 6 Aug 2021 04:00:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=YviDSQJP9md+3VbFrMcjINm5/gRY+KieCsNkmNc8Xgo=; b=WnczntRdEcO8qGwELSj9J4vqBW4Qc/I0kN4H2Z0VjzfoQAv0CBCk2BDtHuJNjN11v1MV WGiNKmCb4P36wzLHZdO2+/pXh1ikm1DLyHWX8GLWiepoSbkF+1RaDi+j48vP+eZjjqAE xa+6GncuU/6oMJHafchzQwwQ3Oqv2JZc9ixQxOChI/cZ6Qep84JxOUuhcbn6zbyUqRyO j0SVLbPNKIOF+esW+c/efs19K6EbiGcoC905ydPq1qm0DqFAuT6V1qiDhpP6BymNxSUW szaocwbq78qzYYxUDFkWfyEfE1lv+MQsFoaB9TehCekHJjonVi0rPuiHhQgnA5+Rh4Mw jg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=YviDSQJP9md+3VbFrMcjINm5/gRY+KieCsNkmNc8Xgo=; b=FYD6AXxVfU0QQKwYH1Z+45XSSwVVD4UDoyvko+E/lFHBmvmoag5/5ufu1QD/ZFS4COEI 3KtY03Zi63vIb2iEttV3WRdBigrkotATLTfw3MwQP4vAyY5Jq2rTolNShnnbYrTOnGIM gwJ/JGr9oZyUjNZS1L4/+Nkz7iNQTZdmJuZPH+l+Z/jQdv38FRYgqyThCwrzYA6dQaB5 k4C4MGdGVjuu5hkIcsiwsFFjdlxqgYFafKvs9S1M6cXUvHvKGV+QN0dS7XJ/rqjjtMnW L8vJQjnxNgJqnbxJy+qW1tOuHzW2h5DUs+E7oPO4JXvdccBqk4B/i7TkzLYXtMBrRJo8 lg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3a843pay3g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Aug 2021 04:00:37 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17640L3I002843; Fri, 6 Aug 2021 04:00:37 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2041.outbound.protection.outlook.com [104.47.56.41]) by aserp3030.oracle.com with ESMTP id 3a78d9tj6d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Aug 2021 04:00:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bB6nD84TU+yIlrwnCtpX1lq9fZL96XsCW5p07pymYW1jZku01xuSIukCZbTmt5lY10CZftfIFn+euKEdfQV6MbM3s6qBwfB1/+J3ipg8ZtjYCL8zANY5sy3bJn89gTEWyEJTJjyPh44nvYcgyYLsaluCxJohonr2pAesofglToMTYRDK5wEFz1VKmrMK1oPL+1JolPrIv8qoHzsCLH+tdNc+M5kCjRee6jPFT0n/38DbSRDStDGEO6dZYKNvFQ0aOuq0OtNNZHDDkV3DSNiEAEBrU50wT7FRGK8703IFZuM2gCM/sFa+/qLtVFBPtLevX17/pdt3h8gwlPOIXK0FHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YviDSQJP9md+3VbFrMcjINm5/gRY+KieCsNkmNc8Xgo=; b=iH7hZZv8Vqx4ukoO5hnvpRZOTLJ7H95RzDz7YPrDlpygMpAC2E8wxQ0WcvQBEm3WoSnMdUmZsRX2LtW/t8ax+nsOH2RC9KfPDkWMP2Lt8N6/8tnSfq9PuuCFm7xPIm7xP8Y9gDfS63cW3Q9g6ZKaj+2LsNidOyoc2rtlYyI0LYrzCgDhzYZzACNmsf3OoJrwpYwTJgBOICyNJk3hLu97L49jJ1UZqZZ8fB9v/LO4zfRW8Hw7xqnm5WXjY5n2VVG3CulEdQI7TcYshBvORTIubzQyxrSUynnENMiDE/o/Raul3tB5LnSAy1RemLa0q0ZX3DanhYd4ntH3dpojEVDyBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YviDSQJP9md+3VbFrMcjINm5/gRY+KieCsNkmNc8Xgo=; b=bxBu2yrlkF7iXSlGpDiZc6YrE577DM/6xekb0yI3XJEPgcMzg32dYiPeR4RnljD+ZDYkk2LG+1tpx2QCBtwlSmLFofzFYYSY8wXUlGdEMwc0PrylpEoN8FHKKtfen3GCBtVn2WH84ntATR4sYwQgpI94XJyP9z7H3dhmeKYbRAc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) by PH0PR10MB5595.namprd10.prod.outlook.com (2603:10b6:510:f7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17; Fri, 6 Aug 2021 04:00:35 +0000 Received: from PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1]) by PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::153e:22d1:d177:d4f1%8]) with mapi id 15.20.4373.026; Fri, 6 Aug 2021 04:00:35 +0000 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" , James Smart , Dick Kennedy Subject: [PATCH v2 5/5] scsi: lpfc: Use the proper SCSI midlayer interfaces for PI Date: Fri, 6 Aug 2021 00:00:23 -0400 Message-Id: <20210806040023.5355-6-martin.petersen@oracle.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806040023.5355-1-martin.petersen@oracle.com> References: <20210806040023.5355-1-martin.petersen@oracle.com> X-ClientProxiedBy: SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) To PH0PR10MB4759.namprd10.prod.outlook.com (2603:10b6:510:3d::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ca-mkp.mkp.ca.oracle.com (138.3.201.9) by SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Fri, 6 Aug 2021 04:00:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd01e1ff-79ab-4e3e-e1c0-08d9588ebe1e X-MS-TrafficTypeDiagnostic: PH0PR10MB5595: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:339; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RoX+mgBJ27qD69z5gfcXIDYnv5U3x63T2bP29u8K5oLL740h9s5w4XpZwUWC05246I1xU8JmSHVhvJIRcAeP6I0QbJmJAH6iWszT7j/ZQj0CO1CwyEGvYhffgJJQBb/5BOw4N0Eipi5PZXKcuCdA/aPkBxdDpvj1DLDVlAuPOKeYI0OX06wIwWTnNcKWH2FkvQ3HFrrJ2DKIeT5WigLLAhU1MrPg4EzYN4PgfE1jd8OG6nVQ3+DCK0opWTPD0o1Izw90nvOk4FBQxx7bmV8hIF3eYh7KQ1/hXuEcej4G9BKJWCwnXCqzOzsfHFOLgjR+e6kpQetHrck/OfGPE6jW5I9QJRQjzQrfwaJQhjuEJTecs24SlZZj9q2usC3h66501FGEq/3NBAxpTkDQRn+jsLCsmF++GEr4GvtVIXP5kUzWJ8PONB0ox666Z7enyz9XqbPyugKfEM8uL8u/iPeLKj0O+B2ab40JTRPYYGcg5ZfwvW4rwEYHxZYAu/dHynK/qR9CqwpqmscGy/ri0srcMQvQn5XHVayNuQT4yac1OmGaSvVv5e026guhcZj19+2zBxuCF3Jq3x5bjQbg1gxhZ3DCPqorjz2bOdzuu1NkhXbdmBsJvny2vYdF16+A0Rqeu6lpuCo5rxAwEJDj69eD6E5Bvj+ZIyW4nPu0eTxgr5boTfv3BHl4gtji+spn4f+leabxSUj8n9MBDXHvR68yFA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB4759.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(136003)(39860400002)(346002)(376002)(366004)(8936002)(6916009)(8676002)(36756003)(52116002)(316002)(7696005)(2906002)(66946007)(54906003)(6666004)(26005)(30864003)(6486002)(186003)(2616005)(956004)(83380400001)(66476007)(86362001)(4326008)(1076003)(38100700002)(478600001)(38350700002)(5660300002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 53+Qlmwr8RTTp3UqTVefD5eLUr7eonbLk0WJdOkZ1JFoJHNNttIwYp/Vz7xEE44QardDG1loaH0u6eDVjH3lSZSSV4/chqINXK6wGCFoV3dDVsRB8JN17GnWQVhiqgmb4YUCY8ufqb0Mk01S9Azm3Z7sZpj/BCA2GeEJBLkuNdZ9mQojzA4Mnv8v9bq7uJL2IA0m6CuYCEQlcDUdBOqVX+Wq9Nz11u2zCPyXzseZ3oHfLK8oE0lTkuZMPufcr4jRpckWBU5+r/AHOM9XKGB/J40GR5kh+P3H9zKqzC0EIakN8+XxWIQ0A9ZVpsek+89N5F1E5B3qcn7kNZ82YOP4tO1x/xfdUTHmOwk1TH3JzdBoYyd7znRNhwwu7VIxbqchxMF413sYHL7iU3SiI4YPF5vaCr9PPUBwPE8ecg7lhbS6iZpMO2yVGSZ7L5zyopoz8pOAG9Mq9xuRjf4sNOW+mbv/Cy1sALiKz0EyUWp1+TYcDnjW1DsNtPYXXEoR4KXVEv9JUsEDNYuHUUgBxo1vGGy5Dp+eGCv5QB7iDTXtfWpr2TEkbPovsL1zUpxvIfRKA9qSc6Z8CrcT3aDx9Av4edAC97Cdg/cPO5wzOldSPvdJcKmQXvFgkS2iS/gbPorW+1ZCacRaJnlAdIKEBZ9brlTQCIzPSB38uY3+MvhHzqrsH1f26Gdbwh2he2LyQ2mEbZE6Zwq9EN403NDGnro5SOvaGsncnaSe+MbEvxCB05jv36CCbYTTjit0GMcun5NkHSgvb2vh1c6jwhli0aX/d9Um0BD+CTr1REfAWkeZ0OcSteXMH7l2heIQbmcMshXwCl3mLlAOL44dqsSCsg42F3DPzjLl6YxYDfevOFmmLbF9ksqmIy8uS5jMqiseBWkv5kCh89iKZlOF0iIsZ10VsFJOHjpXTJbI0Ca+TKvTXUWNWU3MagodvHemeJZ8J3cjyIJFmMfGl4dMt6LAE/L5pD2grsXqZJTd2lrM/ODCkn7YfZKAfRNaB1t5xZ84jBICvugKTvHWDUUGCuW7yvz8TB5n8cYIBiNii40FK/A+Be9ciX8QgSlkAa681O179fPJBPXImo5/El/5JZ3J/MCVbjp+Lo9isvScO86Fv+NDdqKzDuBrA3I459XQB+AMxJLOPWd2MTClA9JTN6KebFX0bfZu6DLlS3vqHQYWyvSys95w6PV6OlTR4zM1VDzEl+pLwLxn1Zp8Ixt6fesqVpKJ15HLLCPjjbzRBOhFYbr20q3UHRBf68G0qmDmS2YKMQAK/6/FcwrZ6tmQIjZ49yAaXWfU4GKGROMWNR71UCpdDTnFSXSABdh+P/FaAIsYA/j/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd01e1ff-79ab-4e3e-e1c0-08d9588ebe1e X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4759.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2021 04:00:34.9543 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /rj1J46EIyAxjFWfoGLe38wknMCSLFlnlL5IKl9U0nJMSpyqNzvCspMkzjaF3peC/zL2JwUofVW/R/tcHztQcRt2SJ9VjxHrszm4LLxdrX0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5595 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10067 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108060025 X-Proofpoint-ORIG-GUID: KNjUH6MsuS7c_DTHHEhPQyJbsLWL4P-w X-Proofpoint-GUID: KNjUH6MsuS7c_DTHHEhPQyJbsLWL4P-w Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use the SCSI midlayer interfaces to query protection interval, reference tag, per-command DIX flags, and logical block count. CC: James Smart CC: Dick Kennedy Signed-off-by: Martin K. Petersen Reviewed-by: James Smart --- drivers/scsi/lpfc/lpfc_scsi.c | 116 ++++++++++++++-------------------- 1 file changed, 46 insertions(+), 70 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index ee4ff4855866..9c27f285d86e 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -96,30 +96,6 @@ static void lpfc_vmid_update_entry(struct lpfc_vport *vport, struct scsi_cmnd static void lpfc_vmid_assign_cs_ctl(struct lpfc_vport *vport, struct lpfc_vmid *vmid); -static inline unsigned -lpfc_cmd_blksize(struct scsi_cmnd *sc) -{ - return sc->device->sector_size; -} - -#define LPFC_CHECK_PROTECT_GUARD 1 -#define LPFC_CHECK_PROTECT_REF 2 -static inline unsigned -lpfc_cmd_protect(struct scsi_cmnd *sc, int flag) -{ - return 1; -} - -static inline unsigned -lpfc_cmd_guard_csum(struct scsi_cmnd *sc) -{ - if (lpfc_prot_group_type(NULL, sc) == LPFC_PG_TYPE_NO_DIF) - return 0; - if (scsi_host_get_guard(sc->device->host) == SHOST_DIX_GUARD_IP) - return 1; - return 0; -} - /** * lpfc_sli4_set_rsp_sgl_last - Set the last bit in the response sge. * @phba: Pointer to HBA object. @@ -1046,13 +1022,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc, return 0; sgpe = scsi_prot_sglist(sc); - lba = t10_pi_ref_tag(sc->request); + lba = scsi_prot_ref_tag(sc); if (lba == LPFC_INVALID_REFTAG) return 0; /* First check if we need to match the LBA */ if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) { - blksize = lpfc_cmd_blksize(sc); + blksize = scsi_prot_interval(sc); numblks = (scsi_bufflen(sc) + blksize - 1) / blksize; /* Make sure we have the right LBA if one is specified */ @@ -1441,7 +1417,7 @@ lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, { uint8_t ret = 0; - if (lpfc_cmd_guard_csum(sc)) { + if (sc->prot_flags & SCSI_PROT_IP_CHECKSUM) { switch (scsi_get_prot_op(sc)) { case SCSI_PROT_READ_INSERT: case SCSI_PROT_WRITE_STRIP: @@ -1521,7 +1497,7 @@ lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, { uint8_t ret = 0; - if (lpfc_cmd_guard_csum(sc)) { + if (sc->prot_flags & SCSI_PROT_IP_CHECKSUM) { switch (scsi_get_prot_op(sc)) { case SCSI_PROT_READ_INSERT: case SCSI_PROT_WRITE_STRIP: @@ -1629,7 +1605,7 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc, goto out; /* extract some info from the scsi command for pde*/ - reftag = t10_pi_ref_tag(sc->request); + reftag = scsi_prot_ref_tag(sc); if (reftag == LPFC_INVALID_REFTAG) goto out; @@ -1668,12 +1644,12 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc, * protection data is automatically generated, not checked. */ if (datadir == DMA_FROM_DEVICE) { - if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) + if (sc->prot_flags & SCSI_PROT_GUARD_CHECK) bf_set(pde6_ce, pde6, checking); else bf_set(pde6_ce, pde6, 0); - if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF)) + if (sc->prot_flags & SCSI_PROT_REF_CHECK) bf_set(pde6_re, pde6, checking); else bf_set(pde6_re, pde6, 0); @@ -1791,8 +1767,8 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, goto out; /* extract some info from the scsi command */ - blksize = lpfc_cmd_blksize(sc); - reftag = t10_pi_ref_tag(sc->request); + blksize = scsi_prot_interval(sc); + reftag = scsi_prot_ref_tag(sc); if (reftag == LPFC_INVALID_REFTAG) goto out; @@ -1832,12 +1808,12 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, bf_set(pde6_optx, pde6, txop); bf_set(pde6_oprx, pde6, rxop); - if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) + if (sc->prot_flags & SCSI_PROT_GUARD_CHECK) bf_set(pde6_ce, pde6, checking); else bf_set(pde6_ce, pde6, 0); - if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF)) + if (sc->prot_flags & SCSI_PROT_REF_CHECK) bf_set(pde6_re, pde6, checking); else bf_set(pde6_re, pde6, 0); @@ -2023,7 +1999,7 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, goto out; /* extract some info from the scsi command for pde*/ - reftag = t10_pi_ref_tag(sc->request); + reftag = scsi_prot_ref_tag(sc); if (reftag == LPFC_INVALID_REFTAG) goto out; @@ -2051,12 +2027,12 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, * protection data is automatically generated, not checked. */ if (sc->sc_data_direction == DMA_FROM_DEVICE) { - if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) + if (sc->prot_flags & SCSI_PROT_GUARD_CHECK) bf_set(lpfc_sli4_sge_dif_ce, diseed, checking); else bf_set(lpfc_sli4_sge_dif_ce, diseed, 0); - if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF)) + if (sc->prot_flags & SCSI_PROT_REF_CHECK) bf_set(lpfc_sli4_sge_dif_re, diseed, checking); else bf_set(lpfc_sli4_sge_dif_re, diseed, 0); @@ -2223,8 +2199,8 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, goto out; /* extract some info from the scsi command */ - blksize = lpfc_cmd_blksize(sc); - reftag = t10_pi_ref_tag(sc->request); + blksize = scsi_prot_interval(sc); + reftag = scsi_prot_ref_tag(sc); if (reftag == LPFC_INVALID_REFTAG) goto out; @@ -2281,9 +2257,8 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, diseed->ref_tag = cpu_to_le32(reftag); diseed->ref_tag_tran = diseed->ref_tag; - if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) { + if (sc->prot_flags & SCSI_PROT_GUARD_CHECK) { bf_set(lpfc_sli4_sge_dif_ce, diseed, checking); - } else { bf_set(lpfc_sli4_sge_dif_ce, diseed, 0); /* @@ -2300,7 +2275,7 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, } - if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF)) + if (sc->prot_flags & SCSI_PROT_REF_CHECK) bf_set(lpfc_sli4_sge_dif_re, diseed, checking); else bf_set(lpfc_sli4_sge_dif_re, diseed, 0); @@ -2557,7 +2532,7 @@ lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba, * DIF (trailer) attached to it. Must ajust FCP data length * to account for the protection data. */ - fcpdl += (fcpdl / lpfc_cmd_blksize(sc)) * 8; + fcpdl += (fcpdl / scsi_prot_interval(sc)) * 8; return fcpdl; } @@ -2811,14 +2786,14 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) * data length is a multiple of the blksize. */ sgde = scsi_sglist(cmd); - blksize = lpfc_cmd_blksize(cmd); + blksize = scsi_prot_interval(cmd); data_src = (uint8_t *)sg_virt(sgde); data_len = sgde->length; if ((data_len & (blksize - 1)) == 0) chk_guard = 1; src = (struct scsi_dif_tuple *)sg_virt(sgpe); - start_ref_tag = t10_pi_ref_tag(cmd->request); + start_ref_tag = scsi_prot_ref_tag(cmd); if (start_ref_tag == LPFC_INVALID_REFTAG) goto out; start_app_tag = src->app_tag; @@ -2839,7 +2814,8 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) /* First Guard Tag checking */ if (chk_guard) { guard_tag = src->guard_tag; - if (lpfc_cmd_guard_csum(cmd)) + if (cmd->prot_flags + & SCSI_PROT_IP_CHECKSUM) sum = lpfc_bg_csum(data_src, blksize); else @@ -2910,7 +2886,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) phba->bg_guard_err_cnt++; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, "9069 BLKGRD: reftag %x grd_tag err %x != %x\n", - t10_pi_ref_tag(cmd->request), + scsi_prot_ref_tag(cmd), sum, guard_tag); } else if (err_type == BGS_REFTAG_ERR_MASK) { @@ -2920,7 +2896,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) phba->bg_reftag_err_cnt++; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, "9066 BLKGRD: reftag %x ref_tag err %x != %x\n", - t10_pi_ref_tag(cmd->request), + scsi_prot_ref_tag(cmd), ref_tag, start_ref_tag); } else if (err_type == BGS_APPTAG_ERR_MASK) { @@ -2930,7 +2906,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) phba->bg_apptag_err_cnt++; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, "9041 BLKGRD: reftag %x app_tag err %x != %x\n", - t10_pi_ref_tag(cmd->request), + scsi_prot_ref_tag(cmd), app_tag, start_app_tag); } } @@ -2992,7 +2968,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, " 0x%x lba 0x%llx blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_logical_block_count(cmd), bgstat, bghm); } if (lpfc_bgs_get_reftag_err(bgstat)) { @@ -3007,7 +2983,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, " 0x%x lba 0x%llx blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_logical_block_count(cmd), bgstat, bghm); } if (lpfc_bgs_get_apptag_err(bgstat)) { @@ -3022,7 +2998,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, " 0x%x lba 0x%llx blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_logical_block_count(cmd), bgstat, bghm); } if (lpfc_bgs_get_hi_water_mark_present(bgstat)) { @@ -3066,7 +3042,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, " 0x%x lba 0x%llx blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_logical_block_count(cmd), bgstat, bghm); /* Calcuate what type of error it was */ lpfc_calc_bg_err(phba, lpfc_cmd); @@ -3103,8 +3079,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, "9072 BLKGRD: Invalid BG Profile in cmd " "0x%x reftag 0x%x blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], - t10_pi_ref_tag(cmd->request), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_prot_ref_tag(cmd), + scsi_logical_block_count(cmd), bgstat, bghm); ret = (-1); goto out; } @@ -3115,8 +3091,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, "9073 BLKGRD: Invalid BG PDIF Block in cmd " "0x%x reftag 0x%x blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], - t10_pi_ref_tag(cmd->request), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_prot_ref_tag(cmd), + scsi_logical_block_count(cmd), bgstat, bghm); ret = (-1); goto out; } @@ -3131,8 +3107,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, "9055 BLKGRD: Guard Tag error in cmd " "0x%x reftag 0x%x blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], - t10_pi_ref_tag(cmd->request), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_prot_ref_tag(cmd), + scsi_logical_block_count(cmd), bgstat, bghm); } if (lpfc_bgs_get_reftag_err(bgstat)) { @@ -3146,8 +3122,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, "9056 BLKGRD: Ref Tag error in cmd " "0x%x reftag 0x%x blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], - t10_pi_ref_tag(cmd->request), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_prot_ref_tag(cmd), + scsi_logical_block_count(cmd), bgstat, bghm); } if (lpfc_bgs_get_apptag_err(bgstat)) { @@ -3161,8 +3137,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, "9061 BLKGRD: App Tag error in cmd " "0x%x reftag 0x%x blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], - t10_pi_ref_tag(cmd->request), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_prot_ref_tag(cmd), + scsi_logical_block_count(cmd), bgstat, bghm); } if (lpfc_bgs_get_hi_water_mark_present(bgstat)) { @@ -3205,8 +3181,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, "9057 BLKGRD: Unknown error in cmd " "0x%x reftag 0x%x blk cnt 0x%x " "bgstat=x%x bghm=x%x\n", cmd->cmnd[0], - t10_pi_ref_tag(cmd->request), - blk_rq_sectors(cmd->request), bgstat, bghm); + scsi_prot_ref_tag(cmd), + scsi_logical_block_count(cmd), bgstat, bghm); /* Calcuate what type of error it was */ lpfc_calc_bg_err(phba, lpfc_cmd); @@ -5553,8 +5529,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) "reftag x%x cnt %u pt %x\n", dif_op_str[scsi_get_prot_op(cmnd)], cmnd->cmnd[0], - t10_pi_ref_tag(cmnd->request), - blk_rq_sectors(cmnd->request), + scsi_prot_ref_tag(cmnd), + scsi_logical_block_count(cmnd), (cmnd->cmnd[1]>>5)); } err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); @@ -5565,8 +5541,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) "9038 BLKGRD: rcvd PROT_NORMAL cmd: " "x%x reftag x%x cnt %u pt %x\n", cmnd->cmnd[0], - t10_pi_ref_tag(cmnd->request), - blk_rq_sectors(cmnd->request), + scsi_prot_ref_tag(cmnd), + scsi_logical_block_count(cmnd), (cmnd->cmnd[1]>>5)); } err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd);