From patchwork Sun May 18 15:32:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 4198441 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9F88A9F1CD for ; Sun, 18 May 2014 15:33:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C88062021A for ; Sun, 18 May 2014 15:33:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 030A82022D for ; Sun, 18 May 2014 15:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751753AbaERPc4 (ORCPT ); Sun, 18 May 2014 11:32:56 -0400 Received: from mailp.voltaire.com ([193.47.165.129]:40780 "EHLO mellanox.co.il" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751801AbaERPcy (ORCPT ); Sun, 18 May 2014 11:32:54 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from sagig@mellanox.com) with SMTP; 18 May 2014 18:32:43 +0300 Received: from r-vnc02.mtr.labs.mlnx (r-vnc02.mtr.labs.mlnx [172.30.0.127]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id s4IFWgcW017534; Sun, 18 May 2014 18:32:43 +0300 Received: from r-vnc02.mtr.labs.mlnx (r-vnc02 [127.0.0.1]) by r-vnc02.mtr.labs.mlnx (8.14.4/8.14.4) with ESMTP id s4IFWgEV011360; Sun, 18 May 2014 18:32:42 +0300 Received: (from sagig@localhost) by r-vnc02.mtr.labs.mlnx (8.14.4/8.14.4/Submit) id s4IFWgeE011359; Sun, 18 May 2014 18:32:42 +0300 From: Sagi Grimberg To: roland@kernel.org Cc: linux-rdma@vger.kernel.org, target-devel@vger.kernel.org, martin.petersen@oracle.com, oren@mellanox.com Subject: [PATCH 3/3] mlx5: Copy DIF fields only when input and output space values match Date: Sun, 18 May 2014 18:32:40 +0300 Message-Id: <1400427160-11314-4-git-send-email-sagig@mellanox.com> X-Mailer: git-send-email 1.7.8.2 In-Reply-To: <1400427160-11314-1-git-send-email-sagig@mellanox.com> References: <1400427160-11314-1-git-send-email-sagig@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, 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 Some DIF implementations (SCSI initiator/target) may want to use different input/output values for application tag and/or reference tag. So in case memory/wire domain values don't match HW must not copy them. Signed-off-by: Sagi Grimberg --- drivers/infiniband/hw/mlx5/qp.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 242fb2d..d3fc805 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -2066,6 +2066,7 @@ static int mlx5_set_bsf(struct ib_mr *sig_mr, struct ib_sig_domain *wire = &sig_attrs->wire; int ret, selector; + memset(bsf, 0, sizeof(*bsf)); switch (sig_attrs->mem.sig_type) { case IB_SIG_TYPE_T10_DIF: if (sig_attrs->wire.sig_type != IB_SIG_TYPE_T10_DIF) @@ -2078,9 +2079,11 @@ static int mlx5_set_bsf(struct ib_mr *sig_mr, /* Same block structure */ basic->bsf_size_sbs = 1 << 4; if (mem->sig.dif.bg_type == wire->sig.dif.bg_type) - basic->wire.copy_byte_mask = 0xff; - else - basic->wire.copy_byte_mask = 0x3f; + basic->wire.copy_byte_mask |= 0xc0; + if (mem->sig.dif.app_tag == wire->sig.dif.app_tag) + basic->wire.copy_byte_mask |= 0x30; + if (mem->sig.dif.ref_tag == wire->sig.dif.ref_tag) + basic->wire.copy_byte_mask |= 0x0f; } else basic->wire.bs_selector = bs_selector(wire->sig.dif.pi_interval);