Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2472711imm; Thu, 27 Sep 2018 13:30:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV61z5evXjkTZKV3ecP1zhsYVnv3n2gCow8Epj+Z1XUBCxU/4hPuIoln/ByrCarROS3Cuv8rI X-Received: by 2002:a17:902:680e:: with SMTP id h14-v6mr12791756plk.177.1538080230919; Thu, 27 Sep 2018 13:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538080230; cv=none; d=google.com; s=arc-20160816; b=psa8bC4TffsSYWZ1MIVFkz7DZIFQe9ZTAEE3nJ5ZS53vXVn8a9idanQ/A5eR2LthUf J1XqB3wo5dcGRpl/zm+oVfxQGyuVoYgj0O19Sqk8rsWXKg11mvJedqghCpYuOxoTk77g T2v+bTdmXa6zj+ImSTgpdylMdyz3cwsIZx2lLRRailXPwmt/+CrDzyS3oR7xjDCA9RuC zw1VMhWG9JHxtI1e3Jl7an3aG77Rn5CcHtDRuh06Xyjh2dqJNPIcF5ZSG/rAntluNNhL 8QB4eCbluq5KZ21rVk2voVL+kAV0GwGMrUPbyzFnecrpAcA+CefcoCzxX/pGqOmob0Rr tLsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KyByWbXBedQV+jchaM0ForXlqaPlL4mhmg6KeFjAyWc=; b=j5xVObjEuZxxWWTHKLO8pCkHleEHKUl+qMwOoVS2Tt3Uq70SS5XFuS7zUU0dgIASYr vNVOgL7EtwmTRHGB/zwPehX/xg5+AScNCqJCGfKKRAPZv98PxErzwt3wwtKUEGJPuXbr ibqTjCe7hhFwYzAq/iTzRLv2/dgG5N/3qw97evWYNT8iDdkuYC+fxc1N67QEfeUko0Ex rCAJj8v2QTKSkn53q3cT7NcarFFE4PcGJdMc3faqvsHStIg1gqSLfxerz7rb3KKk7e+D 6y59vyDwiVWC93rOk2ezyx+/j1bTIolEEskyWo8RICKxqx1Vl+jkTcOnQl1JA/Cm/9+v E5QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZoOOTtD+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d28-v6si2919837pgn.203.2018.09.27.13.30.15; Thu, 27 Sep 2018 13:30:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZoOOTtD+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727621AbeI1Cs1 (ORCPT + 99 others); Thu, 27 Sep 2018 22:48:27 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43273 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbeI1Cs0 (ORCPT ); Thu, 27 Sep 2018 22:48:26 -0400 Received: by mail-pg1-f193.google.com with SMTP id q19-v6so2748834pgn.10 for ; Thu, 27 Sep 2018 13:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KyByWbXBedQV+jchaM0ForXlqaPlL4mhmg6KeFjAyWc=; b=ZoOOTtD+fsVVxuHg3p6/lbaLpOakEZV+JHje7Y6YozCtfBz6R1JwQqzTJ5s3nE5eip AFUe8k32shLrLm85prI19wBUWN+TjfBaBgHpHJjClcwsl6MkczByji+M6ukND1jJ00id pWcvANk1yn1GbnM9e+BcbTViUbNp9Ow1bppAByJGfTFzS/VrVXGdzkOyDXPn0zXhkZxe JpTc5ACGJOMB5ky5H8uTiOphGPtV6xGIEioHlohDDRSy0mRjgwFZIIJfWGHukr79KaYu nodgER5SiZWtKV5j57sfmcK4o4yotAVpqOSw7mnHTJZSPZ68xsst+bMO+w9v0dfya9rO koJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KyByWbXBedQV+jchaM0ForXlqaPlL4mhmg6KeFjAyWc=; b=aku/xu7kIukSpeAe5uzaxzPQVy3QbJMSmMHW7f0MVofa5u2SEdNaP1qhp5jHIZpzQg CBfWNRKOO8CnpF+E8QtqKzDWIkxF940R74KhKzohBrQL7NcK0YKnlI4SzXHRnTMmVFSL r2FmFhVCcIpWmQuzFJSIQmXIsx39vPORt7E+MA1ENKklg36AhPcz/BC1jjeDdef+UsnS UxUneTfPgzI+5W9bIV6LXS0EJgfXgkqQ3Wj+refgqyFJ5rlLFhUvG0DpbYz9zjriX+sS gbBdvrdELBwpPyLC6u+QUG0b33B70zyuMwd1cdq6ZaIDcPX/LvS304DRykX7pxK7dF0y tfGg== X-Gm-Message-State: ABuFfojENjfvcKuGvUPlP6mnIl93UR4R2uPPOe7Tw5T6tbDLPBf3hly5 lKdseC3uRfxLzt+N03HCMzpFVVvkkHgm2iflcszryg== X-Received: by 2002:a63:1921:: with SMTP id z33-v6mr12124692pgl.302.1538080103331; Thu, 27 Sep 2018 13:28:23 -0700 (PDT) MIME-Version: 1.0 References: <20180927011820.13608-1-natechancellor@gmail.com> In-Reply-To: <20180927011820.13608-1-natechancellor@gmail.com> From: Nick Desaulniers Date: Thu, 27 Sep 2018 13:28:12 -0700 Message-ID: Subject: Re: [PATCH] RDMA/qedr: Explicitly cast pkt->tx_dest to qed_ll2_tx_dest To: Nathan Chancellor Cc: Michal.Kalderon@cavium.com, Ariel.Elior@cavium.com, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 26, 2018 at 6:18 PM Nathan Chancellor wrote: > > Clang warns when one enumerated type is explicitly converted to another. > > drivers/infiniband/hw/qedr/qedr_roce_cm.c:198:28: warning: implicit > conversion from enumeration type 'enum qed_roce_ll2_tx_dest' to > different enumeration type 'enum qed_ll2_tx_dest' [-Wenum-conversion] > ll2_tx_pkt.tx_dest = pkt->tx_dest; > ~ ~~~~~^~~~~~~ > 1 warning generated. > > Avoid this warning by explicitly casting pkt->tx_dest to > qed_112_tx_dest, which has the expected values from the > type qed_roce_ll2_tx_dest. But these enums are different lengths, which is problematic for this patch. Is this code broken, or that it's ok for ll2_tx_pkt.tx_dest to have a value that's not a valid enumeration value for enum qed_ll2_tx_dest? (QED_LL2_TX_DEST_MAX 's value (3) is outside the enumeration values of enum qed_roce_ll2_tx_dest). include/linux/qed/qed_rdma_if.h: 42 enum qed_roce_ll2_tx_dest { 43 /* Light L2 TX Destination to the Network */ 44 QED_ROCE_LL2_TX_DEST_NW, 45 46 /* Light L2 TX Destination to the Loopback */ 47 QED_ROCE_LL2_TX_DEST_LB, 48 QED_ROCE_LL2_TX_DEST_MAX 49 }; include/linux/qed/qed_ll2_if.h: 64 enum qed_ll2_tx_dest { 65 QED_LL2_TX_DEST_NW, /* Light L2 TX Destination to the Network */ 66 QED_LL2_TX_DEST_LB, /* Light L2 TX Destination to the Loopback */ 67 QED_LL2_TX_DEST_DROP, /* Light L2 Drop the TX packet */ 68 QED_LL2_TX_DEST_MAX 69 }; Maybe the maintainers can clarify? > > Reported-by: Nick Desaulniers > Signed-off-by: Nathan Chancellor > --- > drivers/infiniband/hw/qedr/qedr_roce_cm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/infiniband/hw/qedr/qedr_roce_cm.c b/drivers/infiniband/hw/qedr/qedr_roce_cm.c > index 85578887421b..147e0d69003d 100644 > --- a/drivers/infiniband/hw/qedr/qedr_roce_cm.c > +++ b/drivers/infiniband/hw/qedr/qedr_roce_cm.c > @@ -195,7 +195,7 @@ static int qedr_ll2_post_tx(struct qedr_dev *dev, > > ll2_tx_pkt.num_of_bds = 1 /* hdr */ + pkt->n_seg; > ll2_tx_pkt.vlan = 0; > - ll2_tx_pkt.tx_dest = pkt->tx_dest; > + ll2_tx_pkt.tx_dest = (enum qed_ll2_tx_dest)pkt->tx_dest; > ll2_tx_pkt.qed_roce_flavor = roce_flavor; > ll2_tx_pkt.first_frag = pkt->header.baddr; > ll2_tx_pkt.first_frag_len = pkt->header.len; > -- > 2.19.0 > -- Thanks, ~Nick Desaulniers