Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2477509imm; Thu, 27 Sep 2018 13:35:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV62EReUiTLRaYMAEpBCQnrrEv2gQ3ACp0oPtSxW/06thBvzgYnZNKwjbHda9Js8we1RNRaOa X-Received: by 2002:a17:902:20c5:: with SMTP id v5-v6mr7324919plg.62.1538080549870; Thu, 27 Sep 2018 13:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538080549; cv=none; d=google.com; s=arc-20160816; b=O5pUDaSgsToAlea48BYT8uwRXtRKtpMeMf8h+Q3Z/QAUjqr5tCR/4c4B8VEc5fgjLe 6msUcC3A7MOG3wR2q7DOqmo7D4pT0MXrcUiLd0vlwdI70qmmpViLOuXjlnnFUyjVTv05 rx3gHbaSEOPStvKJnOEd3o9goo+CD0W482C45QkHdr+og5fnTE/IPsmIq6JP4/xj4HPf QlLmbadWeiIGAU4kzaVw7/W1hCbP55KxqUG4AmizDeqXvnKBkGTWud4ygrXUAiLYl3A3 gI0djdANi/v3Xh6gT1lLiMskeHqJe+JGn0mVj1d1Ts6zNy+ywWyiLhiJQ+6fWGpYYiau 8MCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ytHOpUSnGJXSrWPcgZKRJSJ0o7STDb4obx/MyLkkEMo=; b=nRp8LE0hjFI/kwrQAQhEG1nhpv3NgVYZ3T1ZJK2MZBjNaanMokCiFfreRenDSlVT9O DmlLuurjQooy4ELjdP3XTygjsMI/bn2fXFvFwQ7Ye82OdRqy8S0cu74x5dqupa04xTrL TVJC7lRZUsXvZDkveYwBej+qlgwt+5fXhEQ1TB8AnOGsN1IQhrUrTAHd8b8Oj10DkXl9 NsqLNTyu7rC28JPhUADpl8AApoNSvIg2oMlyr4jFLYxxURG5GkT4xCPIce25FyvvYptc /y6juM6ae0n7s7tEiCptzfNWDreQWm5d7egLL3CfKgGCNOP2QkK6g3/yML9C57SgrGZZ pJgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MVtRSz5X; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6-v6si2799148pgk.306.2018.09.27.13.35.33; Thu, 27 Sep 2018 13:35:49 -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=@gmail.com header.s=20161025 header.b=MVtRSz5X; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728529AbeI1CzJ (ORCPT + 99 others); Thu, 27 Sep 2018 22:55:09 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37460 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727294AbeI1CzJ (ORCPT ); Thu, 27 Sep 2018 22:55:09 -0400 Received: by mail-wr1-f68.google.com with SMTP id u12-v6so4039591wrr.4; Thu, 27 Sep 2018 13:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ytHOpUSnGJXSrWPcgZKRJSJ0o7STDb4obx/MyLkkEMo=; b=MVtRSz5XuOTy92fd6YVNhAOueZSbuNfWhFeb6hsb7RFczWBYHnu8d9v90rjVRukdxO hpqhsi6ZaoB2UdxIW1OFvZDv7ecygs+2BBfgPAXPnmvR7+EAUmtFiO46h7xuxWmnYYRD hg0uTZM5gBJNAYxdRKMkTlfaJBQ1qg2UxfnbPg0vY11a2jr7L5K1Y/T+ZyYiwFYNTwkp th8Vv1qlTiPeLvKzeJd2Z5lqWe41ejpYEXrlUTsIqdD16vA4oPi/iNljFz37StKUfrCl WKNV5YC/DM6rzTl8Sx3i40UsDS+6PaGMkzyrJ42ZuIWUVTdZKP8mFqAUA8gwbxqNQREz 0akg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ytHOpUSnGJXSrWPcgZKRJSJ0o7STDb4obx/MyLkkEMo=; b=sGnL9lSE6Em9io9xSxKCGBW0BznljwuwyvIaOMfzkv9wqXE0FEnMu5VgWuakVE5e0f anmz+R7Y7qTjCnr69ikSZKDhUOj6dbBgdFyBo6A9T3SK6AiIVedMx2IgYqUq1CTlKa4C KRq2GrDRbitarvRI41nd+ex/F31CeiGWgn7u2QcQzYGB9gf8w97nGERxYqgPVOZIjtJI pgv7fQBE10e6jIrOleoQRX6YTY1dLUz6+AWKFfKhw1N6zuukiUdPCVs7tfYlFQ1edNUC 8gmjJRfHjH/+nPdWesedqOzeUnlVkP6R2wWhW1MkQeyS2M+1/jz+3YBqUQnkQB6Kcx5p Eu9A== X-Gm-Message-State: ABuFfoiUGwkF4gNR3FWlQLFLkG632orupa5fyYicQsItjcnWqyJL8DVa 6wf4GcrVHDByx5DBAHyMCMI= X-Received: by 2002:a5d:4706:: with SMTP id y6-v6mr1758719wrq.256.1538080502805; Thu, 27 Sep 2018 13:35:02 -0700 (PDT) Received: from flashbox ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id k7-v6sm53709wmf.41.2018.09.27.13.35.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 13:35:02 -0700 (PDT) Date: Thu, 27 Sep 2018 13:35:00 -0700 From: Nathan Chancellor To: Nick Desaulniers Cc: Michal.Kalderon@cavium.com, Ariel.Elior@cavium.com, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org, LKML Subject: Re: [PATCH] RDMA/qedr: Explicitly cast pkt->tx_dest to qed_ll2_tx_dest Message-ID: <20180927203500.GA12450@flashbox> References: <20180927011820.13608-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 27, 2018 at 01:28:12PM -0700, Nick Desaulniers wrote: > 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? > My assumption was that if QED_ROCE_LL2_TX_DEST_MAX was used that the packet would be dropped. Turns out that QED_ROCE_LL2_TX_DEST_MAX isn't actually used anywhere in the tree. I suppose that qed_roce_ll2_tx_dest could just be removed and all other instances of those values could be converted to qed_ll2_tx_dest like the rxe patch. I'll test this now and send a patch along if it works out. Nathan > > > > 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