From patchwork Sun Jul 12 21:54:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Herbszt X-Patchwork-Id: 6773261 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D6C29F380 for ; Sun, 12 Jul 2015 21:54:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B4A820617 for ; Sun, 12 Jul 2015 21:54:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B518620602 for ; Sun, 12 Jul 2015 21:54:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751339AbbGLVyn (ORCPT ); Sun, 12 Jul 2015 17:54:43 -0400 Received: from mout.gmx.net ([212.227.17.22]:52496 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbbGLVyn (ORCPT ); Sun, 12 Jul 2015 17:54:43 -0400 Received: from localhost ([88.65.116.206]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LrrRi-1YqWnu48KM-013iHH; Sun, 12 Jul 2015 23:54:33 +0200 Date: Sun, 12 Jul 2015 23:54:25 +0200 From: Sebastian Herbszt To: Cc: , Bart Van Assche , Sebastian Herbszt Subject: [PATCH v2] qla2xxx: use t10_pi_tuple Message-ID: <20150712235425.00001970@localhost> X-Mailer: Claws Mail 3.9.2-55-g74b05b (GTK+ 2.16.6; i586-pc-mingw32msvc) MIME-Version: 1.0 X-Provags-ID: V03:K0:CyiXEmkBUDdauycQfIGviuid7obDa4fDWs/Gw/XsI4jxVfYykBp DNGslMI6lYU/X4i4VE4QrnPpkC66k0TAwSctlr8ebETKJOR7vc7uIQEyN4gHKVNXgTRssP8 U4H2wjrGa1wMssKNlScWvwX1zlEjYesbSyYLDt2RsXRXv6BRWVfq0URA73CPz57a4VUq1KU 3/qfo8scok2eYtTH+o0qA== X-UI-Out-Filterresults: notjunk:1; V01:K0:8d/EShawCeE=:jOnwt0ZDWJV+HSLYBXLTYo c3mUoDgFBowL7gfHbM7ymBATCuzKJ/exoLC2y3akpNOQlbodVE3aKjfBPqR+xMUt8A57QkGXV tySd9SzmVRgDiRuj2lmDmWNQ4u47J3FiyfXY8Fy5MFmECapPjUTGrpi9Kio76+1vv9a2k5H+s Ze7oVedFAnsL0cpMcBVwUtYd4EIeXfqDCTC54w3YaCFE21qxPwhyfpYI/qUevehd7Xx1UNb7t kfAZnMYVQRrl8UV4/C0tw2L077KOscOwz6lewAP72qEml+xjzf18IdmIU03w36Ad97b83S6y+ tVtrLoDEUDBK2/ElUxALzXrS+9W68vQ3Q0J/0t7mwGOAUXP1ZTR3xAgVebU6eGlkwoc/vhIra inVb0sBnqtvSPZzufED+GJi6dkO9qeQhCmLtAT6NI9qvbmsJNP9PJDqpMAAXZbB8xASR+ni05 3rujt2YiQsm13RKwcuX8IbtBX7SufnpW2vYK9vleVXt2c45vknx4t7ifKVyshStIfbkg6MfMa rYiXMFQjrHIFi7hjzFm/it5a5Pq3kqWHwRj2dsAMBdD9gTJFWEFnQCO0+c2ekqMbqbSLT98mr rU7DN+r2/U0lqm8j+WpFa4OQRv7XPM1uygZ6yF+mDw7jeLb5y9e0t3yO5cQL80bLxvLPKJEie 0Kg2SE3eEAMczYgFQpQeTiFYilb570q14yeMCv+7HBZS0z+y0Tg7XS57R0hE7vqTAHLY= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Drop unused scsi_dif_tuple and use t10_pi_tuple instead of own sd_dif_tuple copy. Also use sg_virt() instead of open coding it. Signed-off-by: Sebastian Herbszt Reviewed-by: Bart Van Assche Reviewed-by: Martin K. Petersen --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -urp linux/drivers/scsi/qla2xxx-orig/qla_def.h linux/drivers/scsi/qla2xxx/qla_def.h --- linux/drivers/scsi/qla2xxx-orig/qla_def.h 2015-04-15 06:18:24.681045138 +0200 +++ linux/drivers/scsi/qla2xxx/qla_def.h 2015-07-09 09:45:44.285703687 +0200 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -276,16 +277,6 @@ struct req_que; /* - * (sd.h is not exported, hence local inclusion) - * Data Integrity Field tuple. - */ -struct sd_dif_tuple { - __be16 guard_tag; /* Checksum */ - __be16 app_tag; /* Opaque storage */ - __be32 ref_tag; /* Target LBA or indirect LBA */ -}; - -/* * SCSI Request Block */ struct srb_cmd { diff -urp linux/drivers/scsi/qla2xxx-orig/qla_isr.c linux/drivers/scsi/qla2xxx/qla_isr.c --- linux/drivers/scsi/qla2xxx-orig/qla_isr.c 2015-07-05 22:18:44.157739160 +0200 +++ linux/drivers/scsi/qla2xxx/qla_isr.c 2015-07-12 18:46:24.092536496 +0200 @@ -1711,12 +1711,6 @@ qla2x00_handle_sense(srb_t *sp, uint8_t } } -struct scsi_dif_tuple { - __be16 guard; /* Checksum */ - __be16 app_tag; /* APPL identifier */ - __be32 ref_tag; /* Target LBA or indirect LBA */ -}; - /* * Checks the guard or meta-data for the type of error * detected by the HBA. In case of errors, we set the @@ -1779,7 +1773,7 @@ qla2x00_handle_dif_error(srb_t *sp, stru if (scsi_prot_sg_count(cmd)) { uint32_t i, j = 0, k = 0, num_ent; struct scatterlist *sg; - struct sd_dif_tuple *spt; + struct t10_pi_tuple *pi; /* Patch the corresponding protection tags */ scsi_for_each_prot_sg(cmd, sg, @@ -1801,12 +1795,12 @@ qla2x00_handle_dif_error(srb_t *sp, stru return 1; } - spt = page_address(sg_page(sg)) + sg->offset; - spt += j; + pi = sg_virt(sg); + pi += j; - spt->app_tag = 0xffff; + pi->app_tag = 0xffff; if (scsi_get_prot_type(cmd) == SCSI_PROT_DIF_TYPE3) - spt->ref_tag = 0xffffffff; + pi->ref_tag = 0xffffffff; } return 0; diff -urp linux/drivers/scsi/qla2xxx-orig/qla_target.c linux/drivers/scsi/qla2xxx/qla_target.c --- linux/drivers/scsi/qla2xxx-orig/qla_target.c 2015-07-05 22:18:44.177739161 +0200 +++ linux/drivers/scsi/qla2xxx/qla_target.c 2015-07-12 18:46:46.080537498 +0200 @@ -2589,17 +2589,17 @@ qlt_handle_dif_error(struct scsi_qla_hos } #if 0 - struct sd_dif_tuple *spt; + struct t10_pi_tuple *pi; /* TODO: * This section came from initiator. Is it valid here? * should ulp be override with actual val??? */ - spt = page_address(sg_page(sg)) + sg->offset; - spt += j; + pi = sg_virt(sg); + pi += j; - spt->app_tag = 0xffff; + pi->app_tag = 0xffff; if (cmd->se_cmd.prot_type == SCSI_PROT_DIF_TYPE3) - spt->ref_tag = 0xffffffff; + pi->ref_tag = 0xffffffff; #endif }