From patchwork Tue Aug 17 02:50:13 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: 12440299 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,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 19B89C432BE for ; Tue, 17 Aug 2021 02:50:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECE9160F46 for ; Tue, 17 Aug 2021 02:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233690AbhHQCvC (ORCPT ); Mon, 16 Aug 2021 22:51:02 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:2150 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233438AbhHQCvC (ORCPT ); Mon, 16 Aug 2021 22:51:02 -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 17H2gE8p016760; Tue, 17 Aug 2021 02:50:28 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=l2IKvXVUDj2d5Z7p4OQW98L1ZVUV9pTjPsEuxlbaFoU=; b=wokAaH4WGUHjLBUJLVZRo99Bvd9dnwcPt5Ey/UGIaddbBo4CGp+wmugk7sOsY3Q++46y j5mrwF3FmLvbqiH6wm3Stqkhop+S1NX8MufGxw8lzDG2wA9F8ikCdmb0zS32Zrkdf/wF SaCMbzGrup5VXM8Z0ScApaBxgDL268CPqWHfiV5PKmlradHVlGY9anRPsaOAGhiw4KMQ 8Fn7sEz0tWKMLgcRFIZAFKqO2uXNgCzPbaDPmA66ioVha6STuEhPIQbposC/MLrV6CPr VmVJeDtNU3L3uULbIaMr12CatNaXX3cgo4B2wEVRDW0lvosSY29/s59d/ZU1CbW1z/So pA== 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=l2IKvXVUDj2d5Z7p4OQW98L1ZVUV9pTjPsEuxlbaFoU=; b=fCd6zjkI6SfUOz3gRACbd5tZkRuwmAFEVjAFYNVUMXyVQvotCaadbI5Ewz0m4SkmvPKX VKwT0+NMF0rWrWbAewB5b/nq3v/0wSvZOsGIwYp/nDB/yRC1vaeWpF5UbT+LW49AyyeW KxXZNbLJZJYXOZpqrdk6A+JrWz+8/YdWHf6PeIx1Qke9/8dE+1Bj/ggsA8p8wIfJ6gOL 0aKAw3oszWjOFf/61DOD8DiO8if9yKH5uKRC4lcsFobHI/670PsRbaiLuIJHPLqRBGrT el3HUkYF1oDJ8a6NuXmgUMYmCpv9ive7yrrci15E2dvKHvD7NlJaubfGkPDMs966gRBj nQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3af1q9bntp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Aug 2021 02:50:28 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17H2ijYq132105; Tue, 17 Aug 2021 02:50:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by aserp3020.oracle.com with ESMTP id 3ae5n6qpax-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Aug 2021 02:50:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R4EvjAWSbuwn0ImsZ+mBHBK8xt6FDIHfXcJIj59T7o3d8TAfmbGqXtdSo4cGDuKtSEkicZ9rYOo+JFbzpwnlspmxCYsCa5bhLWS6DEDugx4pPxJbBkLvRAfh/hKlz/CnhpevaAaJ/nDaX+4CINTBzb/B2WwUcG/WO2p3857gz18XjtSO/DEWqDjiS45SN7PGziDml345yhuCNVHmu1bD5rEwvtMqGpuxW2vDDhuzyIkVtbME3Mvz/TCAJLIWVSVcR4puc1o1yPAb0D9Uk8NmQiAQ4u6Vp5+7bG7SthhZkfBM9C+Sn6YjnHNoZ5bVZt8unyPPWSSnerGXVrWom3Kgxw== 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=l2IKvXVUDj2d5Z7p4OQW98L1ZVUV9pTjPsEuxlbaFoU=; b=XR6e3Lpf5p64cYL154h6x4kAO3sKqrs8GyExTXEewpu/y7+V6XWmThAfUBZUaG2v72f52DKu3HqKgQa4vboBxAaJI+9MKtzhvOu7fHSWJjr0bjpt3p3/SGOVoVtH8IbWGsgIIbCCjDTA68vZYW7xhdoc1UQiiyvLf6pYxZ1zO6U0VSpm7IoYYUnzpw/5BZxNlMpMtmlTwPUfmvA30RiZLTdt/HAESD3JEsBSDTt+D6MrglK7LBdMfqAgXPrVbQFaJi7gqsWBphGpLpJly8bTml6QpmUEyWZJdIcRXrg92SIo4bR1V5Z7QdbJ0HgJP17/WsCruCld5lRF3MAzoGy3TQ== 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=l2IKvXVUDj2d5Z7p4OQW98L1ZVUV9pTjPsEuxlbaFoU=; b=XBi+cwU2V4iV7RKvywn4lRDYfm1+gzuKhOsR2u/krL2AUjRkTbCZiPCIHLM6BLvSaoOreRZk+aIHkLFeVxUSVU+JgzetJmeQT2OWIVXjxEwIeQkU5F1YiX2X52TbN5xOzISbRX2ujC5hBVq2R0CYOaMz/fUjAZDNSNTbXSqBY1g= 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 PH0PR10MB5466.namprd10.prod.outlook.com (2603:10b6:510:e2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Tue, 17 Aug 2021 02:50:26 +0000 Received: from PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::c0ed:36a0:7bc8:f2dc]) by PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::c0ed:36a0:7bc8:f2dc%6]) with mapi id 15.20.4415.023; Tue, 17 Aug 2021 02:50:26 +0000 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" , Sreekanth Reddy , Kashyap Desai Subject: [PATCH v3 1/2] scsi: mpt3sas: Use the proper SCSI midlayer interfaces for PI Date: Mon, 16 Aug 2021 22:50:13 -0400 Message-Id: <20210817025014.12085-2-martin.petersen@oracle.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210817025014.12085-1-martin.petersen@oracle.com> References: <20210817025014.12085-1-martin.petersen@oracle.com> X-ClientProxiedBy: SA0PR11CA0175.namprd11.prod.outlook.com (2603:10b6:806:1bb::30) 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 SA0PR11CA0175.namprd11.prod.outlook.com (2603:10b6:806:1bb::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13 via Frontend Transport; Tue, 17 Aug 2021 02:50:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0f40441-57fd-4104-9a93-08d96129c415 X-MS-TrafficTypeDiagnostic: PH0PR10MB5466: 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: lK68dlTxmFHOy6aoBrhEqOCzEq1OzBbPsCXwOREqt212oJ1/hGmHNc3FMp2F81nQLRaj9RCq4jypS3VXgF1Rtci9BGD4z9jMBCYSNSKDB9oMgWoQbgK04EF4q5PrI3EWCAi1LNKpRpYQBWeRLGOdJGsCecrxYQGWXOc5rYSKmR5YX40QQzBDzA7Zphjwl1rwvrs3mOwx5glEGSX5AHP5Vo3TjjM36y/yT9Fo7lQmpYln1WbKw4az+ab89hygEbqayQNZJjGzncJs+/JH10UR6yKMN7i9aFaMtZFDAKaCERHeYFhenxqx9siRUpDNgIDUqPaCIgbmJN/sXZYJssJcOHUqu1wXud4SQ+06cK0nNB/znCGm154HvouCL4FJGrHgPqD10LpwuhUwqgt+MQtqXCPVbcpE/3ay9kFgrizIUOG0OpZ/AQLNTnqBhxiXLSB0B3j5U6mhZCs0Pj0SDWTUtHlLd+MFjjQGuyzJm2CQcx5WY12h2KkyyK0NFJ8rnS3CCerFvLaSbFtIigDnGKNQ8FMpsecTAChkd9lAm/Cf0d7y+v9XZyH7oq7m/+PZb+6Hq2jmhlqQCzfCFCNGLjX69WglO/4GEShNWkSe4fVXy4jn13rM//uWmpYyj2rmz/rpZvd800FEyy9TqAWTUodDevgkZ/T/8Fd0whuDd1JcIHQ/2K+EQS1c6EIC/c9puAlgMhxzD58EF4fsDfddgUejemUj2vIqs65EfxbFf1NRK8U= 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:(376002)(136003)(39860400002)(396003)(346002)(366004)(6916009)(316002)(956004)(2616005)(54906003)(186003)(26005)(83380400001)(6666004)(6486002)(52116002)(7696005)(86362001)(4326008)(5660300002)(8676002)(36756003)(38100700002)(2906002)(38350700002)(66476007)(66946007)(8936002)(66556008)(478600001)(1076003)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9ZeFg6NTN871b8xx5nCgPKPW7tBQOd2acML/ki4Ei2BBsKJd2lXQ5Av14tN6BKbXSFVoU97JE/R0/L8uHyvFtL+i5dyKIsKr6u/i8xt1Lm4qnomCLxWGd+7C09aeMGz0lvdK3SH8rSIBwRfoj6JOA8tLx4Zr5Skjd3yfVhjA6zyAVaxuJ9jIgoqZEehKMF+rVKuiGQotgE/5qcNmSA9owUqcLkobDfNPdrSBGMQShYyBiEhHXdmDMv7WPTAgymOne3HS8zvI7WPdyaWXSzcQacDDM/apHWNobSeHcmpUE30yJwNA9wFsujPz/YTpnuZQReYkO4be4WIZIJ12775HZsSvIDmEuWyGPbulUtJZIkRHHN0VkJa4nXEh2Z0mNomiolvoJFhWhTggRnKDwKPzjz+UOGVy0nqk5LlpVnSG1jkoGfRCdUdWhQh1H1wElWP6CaJ/rk4lDMlfnTe/tiCVWwJpgNhGBAoSSYcshUbj7vefMY4j5aqidrp/W4ZcAtN/qhEoHn9MSZJs0qh9fEI+No10ubJad5MDx180oMwmwKBExbfnSl8kJSeKHa0o759ofG3gTnnF6GhafAvH9X37ibrWQL3AkOgwutGDTuPTxtbgqb0XArmgTEXHXYNsbsRNm0ZPfylS0LZ5mkwTqTMWXgvJGaskMzVtjuRoCI2yoZy8+arOdEu0SyFmMq3HfFOGRdG7tlartHoA79W4QUG7h1aGXGw+U0AntGtnlTZZ7OGtGnAhXvqJGd+ntGXG4mqzXsllpPdAu/cGkQkPn1ktI4q1oW1+kivhZRC0tCIUYDtU2BeDutJ3l8fNBszVTmS5X9se9aTmJSK3c8vFBFdCC2q2bAbE2BKMuaAWuVkQyPKsiMFZvDCW+vKmuGM8eFXJ++SvM6YJTnhmhn7Euc+JRLHwWascRrxCAuyLZEEt3+tLBwGSs8Uai7ViGyqvSWfwRciTNyzvNQ0O3HAPkHrY0safWUNR20rE2Ve+kacZc5wrI9jVVoPgeARq+BmgeB25tgI4h9Ml4ADmNQNhvu57vi0MxotR/OmIWTcK/G4f5e5oY6Wukre5gU3CQWklpJ74biPPJoEZ7dQS2+WCJMCqnrvv059z8MegPG+3asHXdIVknBf360CytxusyimDuRq5w5XzO4luDs0xmOEbGB0RRBYvodLRS3npCZ23bgju9HwBlQiXWhemnJehD7zYZpkwcdiocGAe3QuhQ26NuAMREuWW3u/u+PRCPm9hNgSBN28hS8qK2TFCcnBLUPfcyzKfju1tXu/ulsAQhKljrUdpnkrcGYJF4M4BDJtfWSY3H9vRJnEtF+mFaxmvXzOu0CT4 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0f40441-57fd-4104-9a93-08d96129c415 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4759.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2021 02:50:26.2482 (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: 1tomBf1X/JfbeswyY19M3DFkmk5ecb5pSImYA9+V1bvX1RyoLLbPQb3zAubZFmtMqGIX/B1S1JcY1wv/YlfLVBLTBYunOxWiRkUEYSo2W4U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5466 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10078 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108170015 X-Proofpoint-GUID: e0LUgz-ZHRfggGdINpzQKmE0sMAyYDLv X-Proofpoint-ORIG-GUID: e0LUgz-ZHRfggGdINpzQKmE0sMAyYDLv 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 --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 43 +++++++++------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index cbc7b3d9d913..2f82b1e629af 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -5048,48 +5048,31 @@ _scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, Mpi25SCSIIORequest_t *mpi_request) { u16 eedp_flags; - unsigned char prot_op = scsi_get_prot_op(scmd); - unsigned char prot_type = scsi_get_prot_type(scmd); Mpi25SCSIIORequest_t *mpi_request_3v = (Mpi25SCSIIORequest_t *)mpi_request; - if (prot_type == SCSI_PROT_DIF_TYPE0 || prot_op == SCSI_PROT_NORMAL) - return; - - if (prot_op == SCSI_PROT_READ_STRIP) + switch (scsi_get_prot_op(scmd)) { + case SCSI_PROT_READ_STRIP: eedp_flags = MPI2_SCSIIO_EEDPFLAGS_CHECK_REMOVE_OP; - else if (prot_op == SCSI_PROT_WRITE_INSERT) + break; + case SCSI_PROT_WRITE_INSERT: eedp_flags = MPI2_SCSIIO_EEDPFLAGS_INSERT_OP; - else + break; + default: return; + } - switch (prot_type) { - case SCSI_PROT_DIF_TYPE1: - case SCSI_PROT_DIF_TYPE2: + if (scmd->prot_flags & SCSI_PROT_GUARD_CHECK) + eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD; - /* - * enable ref/guard checking - * auto increment ref tag - */ + if (scmd->prot_flags & 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(scsi_cmd_to_rq(scmd))); - 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 = cpu_to_le16(scsi_prot_interval(scmd)); if (ioc->is_gen35_ioc) eedp_flags |= MPI25_SCSIIO_EEDPFLAGS_APPTAG_DISABLE_MODE; From patchwork Tue Aug 17 02:50:14 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: 12440301 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,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 3F243C4338F for ; Tue, 17 Aug 2021 02:50:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AA8460F46 for ; Tue, 17 Aug 2021 02:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233710AbhHQCvD (ORCPT ); Mon, 16 Aug 2021 22:51:03 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:2748 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233671AbhHQCvC (ORCPT ); Mon, 16 Aug 2021 22:51:02 -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 17H2frP2007587; Tue, 17 Aug 2021 02:50:29 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=0sTnY7EI/Eh0+ENgCuy4KbJYGBG8ujVGYfvAdpxakM8=; b=Fztmqat2+YRHNBF/u5I1NWq1OyhNEGcE5a8Y80QMWvtzEq8K1r0zx82M78yo/VwMSiLD o8bL9M4E8iMAp/4n2+Tn4o8jp8tysYr6ypRTlT8r/4JfjhGi7IwaFLRTwK7T8rfOy2MH /Utm/cfCui3ybJqd5kVaOShCGaq3zYb1iKhkhTFxAa7s4YPSFwPu7O+kV3gE1gjaXKay 5PmpIzzAoILjeUCGAqf46imkgPqykp35MDsNGCgT5DlJ3Zi3B2IH1HMhSsxYA5VY0EZB yQdwVQmHPlrfOEjK9pxRZUjeWMbXReXaaGlDVh/qfVNhE66gdkIgBh0icGIzdyJ2Utg7 Xg== 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=0sTnY7EI/Eh0+ENgCuy4KbJYGBG8ujVGYfvAdpxakM8=; b=BJ0ruqN6h9tyCByJkVKur4vEV2mbYag0Ggwus7OEwRjC6rbncm3H+emijNrrP5gQaIB3 am6sPlOKlg6KuLoh+ePAfzXoujUpNl2DbfU1zVkMQTfArOuJrrEJirRvTP7rBUHDmhYp jrqGoa7DQzTZgbwEsJnT/2zDVo33xjQjzx0uPUTsrdYO7aCyb+30z6wHnHaeyLgNvHpI flQI4wT3KB0hSLymCK0N0xiW34qE1KmOnXIsATaih9QqZ2RRY+KNgXa7wT5Z86HNxw/K 1XLUx6DSf78DQn2fwJ4Bj5GgajV7Nh47uW2bO4APgj/NDFhL04sLGs/CEYal6v+XtRBm UQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3afgpgjm2v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Aug 2021 02:50:29 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17H2ijYr132105; Tue, 17 Aug 2021 02:50:28 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by aserp3020.oracle.com with ESMTP id 3ae5n6qpax-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Aug 2021 02:50:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VA3lv/IF2etpJYbZk3va0pu9g/nUcNKSOTTTvWkRA72cV96B3wAmTz4jLXB9SR4mS/PYgjW65e2NIe4mXiAQSUtuRxFfMXRpUtKFCAw/+5mCP1CLG+bxlagSxmAbDsz4lQJH+QSr1xVm6mS6Gt7MuvJ1g+stIrTD7NJRBqCm5gU5xF7b/CthcRF98bDNv7Y6F4RWU5P2wJwD8iqFO4j5KKTSjQy73YTydyxc9lqbgH7yLBElQ3yjbbPeydhPr1GO+rCIke4y/pAcmvQa73xKU9+VsyGum/RTThieKHSF1ahwQA4K67xSy+zYqWg/RI6ZxZv9KE7E98kLaRGcvrkWNQ== 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=0sTnY7EI/Eh0+ENgCuy4KbJYGBG8ujVGYfvAdpxakM8=; b=aclAniyaZRwqf2otZAKAp7ORfHWNP+pZgo0KQ54zTX/DslC3TDvk+Bs7EIIyZ6CL+eEp2bDn3uIcHM4HmBAR3uo+jQ3a6y97bDLhqoYGEIaaOBcXejHetEwK8dQhGfqW5IeVed2M3AV9dBK4gTjDeBVqPmP0RBn1ooQmVNQ5EfpgBVC67Mym/FuRVrXQqUK2RaUgeuP5T714pw1rrOzAb6Mc6A1k6dC3pzI3DL8wjxdTj/bkSnTtezzcgCeeve99VkTng5MiwgZgydBb85P8KJSR4b7DVMW/jlJy5L0XzWEiLHcDLgOvEOshSNOW9wnELFuORZrxHsIQ0uFM+K7tdg== 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=0sTnY7EI/Eh0+ENgCuy4KbJYGBG8ujVGYfvAdpxakM8=; b=HfK5iKr+MLslkWK5v9zPsRSxz6WCAnSls0XqFgGT643We6kq1el6LC2kb1huv4z266w64md7cTCrqkWhagM9Gg1jkVZmjHRRCGbBQzbXxp0T4cNeR7kGxxvRMkM68gQ4ILe64207M7DJUb5x10SDRxg1UuXQR3Il9SM/H9sQRXE= 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 PH0PR10MB5466.namprd10.prod.outlook.com (2603:10b6:510:e2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Tue, 17 Aug 2021 02:50:27 +0000 Received: from PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::c0ed:36a0:7bc8:f2dc]) by PH0PR10MB4759.namprd10.prod.outlook.com ([fe80::c0ed:36a0:7bc8:f2dc%6]) with mapi id 15.20.4415.023; Tue, 17 Aug 2021 02:50:27 +0000 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" , James Smart , Dick Kennedy Subject: [PATCH v3 2/2] scsi: lpfc: Use the proper SCSI midlayer interfaces for PI Date: Mon, 16 Aug 2021 22:50:14 -0400 Message-Id: <20210817025014.12085-3-martin.petersen@oracle.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210817025014.12085-1-martin.petersen@oracle.com> References: <20210817025014.12085-1-martin.petersen@oracle.com> X-ClientProxiedBy: SA0PR11CA0175.namprd11.prod.outlook.com (2603:10b6:806:1bb::30) 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 SA0PR11CA0175.namprd11.prod.outlook.com (2603:10b6:806:1bb::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13 via Frontend Transport; Tue, 17 Aug 2021 02:50:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c381e9b4-17ce-4c98-67b9-08d96129c48c X-MS-TrafficTypeDiagnostic: PH0PR10MB5466: 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: qlA4aQA1h4OF0oKCq4EfmmuVQ2L8CHZFKCm1XZ3WLlYV9Z0UunZPtpdwplRUKqigzDCT16e+VsathRPqrIk5hfXo4y8Bj7/v6NG1pbMjz2jHJRcpvUnJ9iGNxCvKqPkvBNbxUnzqRAqMKzpLvyMaUcoXuyGolJhbWS9OgRm1ASrZs9LLEz9xai+g2x7hACr2sAOL0EOXY6pMTS1Tgn1E2ACpmsYIYEnyzOPWoKtX8sWEAm/XAj2dnCw/aDRRHApXQTMS/mD8X0BsgkFU3Yeq9XuQ6z7rD8MbUgYsXw8neJlajAI9MqEmTHcoH5wJwYIpLe/s8EN1OuEa3jiEFkHJ2xcizfl4d/8FaVgfew6z5cyIXxxWzzuvAenU1CgnajLv94EL/P3A5bLXrvAQlpI5PWN/rFDcQhnrSVfDxWEIcPbVEVM7dOxySaHzJWr6TuC6NX77G90W3PlmEWL/qMkqoR+S4CeXaqcdcAZ+k5CFknhp1wOwZo8Tkxwv2aIytdAR2dMO8/gwPulCr9RwXpqf+laTPUsjX02PU9NMZsKOqn85oJr8B3oBOEejzUqGPF9hBXgVHlA3W7+oLDJSHdxBItSpRfWxww3T3uhU1eVF8vc2VnJDzD4TpthJHoxxIJT5hSNrAFUUB+bfz70Aldxh4NGOLlEjGG7tcASXdOvt88/4a03XfhwHIj1iOLsNlTe0Z4V5zvG97SEsU5WvJpg/cw== 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:(376002)(136003)(39860400002)(396003)(346002)(366004)(6916009)(316002)(956004)(2616005)(54906003)(186003)(26005)(83380400001)(6666004)(6486002)(52116002)(7696005)(86362001)(4326008)(5660300002)(8676002)(30864003)(36756003)(38100700002)(2906002)(38350700002)(66476007)(66946007)(8936002)(66556008)(478600001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gwSLi1RHD/6h1MEGtrV0w6uoryt8h+ws69oTsOFdP3kseM94eiC57F9ZXLUb8JlDIOVEG9hf+otpopMp7rlL+pRvqHaMWNo6si2S9kXoZE5/ToNxqufVWJQfRGfvkXekXjjszL2dt3X1+Adgmyt8svJJCL248iOeeQ64+VCxs77MFN7OHdwckGeQbMjvB50R7mRuQ7qlghfftqY+9neCdWa6tmjLPmFNFy8P61TmRdr8qKYkNp2AqvQ9E0O4M61/4Y/DNrn3kSJKPFaVV127IFcGZyFRLlfUGQxvKG9pPtz6viaZF0ugtWUHTspfbEyf+GHmsTYv/B5AC9KcGljZpZjCTXGicNPAV/SslokmxaI9jnndWBnDJ1mD+rrHllijoKBFnYw4ePqCobIzHpMO7bIau8gcfKLmnL074LclTgjWPRcO4+gzPoGxmq4cn7xWtYuwXE6oKUBIbk09ZbdT+dZN29dnooNuBdKXQx/LKYZ7ekOz6qPwU9ip17J/AH5kIKGTpNedQi1R3QtlYikaZ8QT1ywHsriUDuVwSOxa9VMfbiUcYS10/+B2nXE/mtasfZtCehCeiJgK8h3IiXYILgnIXLkvK0OfXW9uqLPXy/+e+UGd7CvgZsMFYAIew6xxzv7N5uZCnoaMMxz4iZO6IfQ6u/5gH4G2RFF7f2ymkH/2quMy8rjZevuHKDJAaJkW4FDC7OKO6SmU0bpzjh9aq0jS+zrg+O0Ql5paonyGFwxE8n+Gzlwi6uF8RL4DTZOVO80skPYTUVj6/WeOir5Rb3HtUWM4cPBKHXy6vXm3T85IcalLn526DSsQ/0kiGCgL1nKggGJX/U+ijxWKFt90qahWGCnrCndXbi4RNtu18vncMICUHUi8bUpPqNEzK8o4K6Cz3fi3dKLTXHkfiuF5mUdyzx1JhHRTa5KANBPV460wFuGW24tnwjZNC/8bNHai49NoAv8KciZkrY9wDfrmsvA9gp53gaAqIpVRLBkxtje6fUAk5R+iOqG62jnRZDcgDrk/6w8MfoOMteG+iCDwq3ceEa3YB6DuPctfGoVTFKa9caMTvsD2SXW9OGztMZYGqx2END7kjRV84H8CZ4sG7klUVQSJabLvIuKOfPSqZjJMmpmTSi86UimM1vvq4WUehtaUNCO3mtPUCfX3jxGZeLeLSQxIpBP4NhHYxOZW3HTMSz2ybbOjvFkhwGgnhTXUi7STkfnckHhhvljKcBE9MpZEeiehQoVnwO+8WZPrVtF6WzGzLFG4rOwkpUKKShLwLlYnmpkoThurnmzY24KznQmz9GtGp6wss5DK/qydco8QfwFIEtUR6htSMdLyPlmd X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c381e9b4-17ce-4c98-67b9-08d96129c48c X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4759.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2021 02:50:27.1264 (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: f/FwlPreGU8qYmPHAnMrcEIlOLGP2ti0m3f/ez5NV6MNxnq5yKZ+cdFWCQpN6+EKABLZpx7QhsJkk4/LlsnTXCAElNS6V2dx0uJae6g9u+Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5466 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10078 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108170015 X-Proofpoint-GUID: _DXgzRZxRa8csvjsMCSfvOtRx0GPU7SX X-Proofpoint-ORIG-GUID: _DXgzRZxRa8csvjsMCSfvOtRx0GPU7SX 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 --- drivers/scsi/lpfc/lpfc_scsi.c | 120 ++++++++++++++-------------------- 1 file changed, 48 insertions(+), 72 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index f905a53d050f..d60e31343a07 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(scsi_cmd_to_rq(sc)); + 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(scsi_cmd_to_rq(sc)); + 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(scsi_cmd_to_rq(sc)); + 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(scsi_cmd_to_rq(sc)); + 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(scsi_cmd_to_rq(sc)); + 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(scsi_cmd_to_rq(cmd)); + 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(scsi_cmd_to_rq(cmd)), + 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(scsi_cmd_to_rq(cmd)), + 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(scsi_cmd_to_rq(cmd)), + 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(scsi_cmd_to_rq(cmd)), 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(scsi_cmd_to_rq(cmd)), 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(scsi_cmd_to_rq(cmd)), bgstat, bghm); + scsi_logical_block_count(cmd), bgstat, bghm); } if (lpfc_bgs_get_hi_water_mark_present(bgstat)) { @@ -3066,9 +3042,9 @@ 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(scsi_cmd_to_rq(cmd)), bgstat, bghm); + scsi_logical_block_count(cmd), bgstat, bghm); - /* Calcuate what type of error it was */ + /* Calculate what type of error it was */ lpfc_calc_bg_err(phba, lpfc_cmd); } return ret; @@ -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(scsi_cmd_to_rq(cmd)), - blk_rq_sectors(scsi_cmd_to_rq(cmd)), 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(scsi_cmd_to_rq(cmd)), - blk_rq_sectors(scsi_cmd_to_rq(cmd)), 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(scsi_cmd_to_rq(cmd)), - blk_rq_sectors(scsi_cmd_to_rq(cmd)), 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(scsi_cmd_to_rq(cmd)), - blk_rq_sectors(scsi_cmd_to_rq(cmd)), 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(scsi_cmd_to_rq(cmd)), - blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm); + scsi_prot_ref_tag(cmd), + scsi_logical_block_count(cmd), bgstat, bghm); } if (lpfc_bgs_get_hi_water_mark_present(bgstat)) { @@ -3205,10 +3181,10 @@ 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(scsi_cmd_to_rq(cmd)), - blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm); + scsi_prot_ref_tag(cmd), + scsi_logical_block_count(cmd), bgstat, bghm); - /* Calcuate what type of error it was */ + /* Calculate what type of error it was */ lpfc_calc_bg_err(phba, lpfc_cmd); } out: @@ -5549,8 +5525,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(scsi_cmd_to_rq(cmnd)), - blk_rq_sectors(scsi_cmd_to_rq(cmnd)), + scsi_prot_ref_tag(cmnd), + scsi_logical_block_count(cmnd), (cmnd->cmnd[1]>>5)); } err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); @@ -5561,8 +5537,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(scsi_cmd_to_rq(cmnd)), - blk_rq_sectors(scsi_cmd_to_rq(cmnd)), + scsi_prot_ref_tag(cmnd), + scsi_logical_block_count(cmnd), (cmnd->cmnd[1]>>5)); } err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd);