From: Nathan Chancellor <natechancellor@gmail.com>
To: "Tayar, Tomer" <Tomer.Tayar@cavium.com>
Cc: "Elior, Ariel" <Ariel.Elior@cavium.com>,
Dept-Eng Everest Linux L2 <Dept-EngEverestLinuxL2@cavium.com>,
"David S. Miller" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH] qed: Remove unneeded enumerated type core_tx_dest
Date: Thu, 4 Oct 2018 09:27:36 -0700 [thread overview]
Message-ID: <20181004162736.GA9947@flashbox> (raw)
In-Reply-To: <CY1PR07MB2554AFA55E8084990E14D55780EA0@CY1PR07MB2554.namprd07.prod.outlook.com>
On Thu, Oct 04, 2018 at 04:23:43PM +0000, Tayar, Tomer wrote:
> From: Nathan Chancellor <natechancellor@gmail.com>
> Sent: Thursday, October 04, 2018 3:09 AM
>
> > Clang warns when one enumerated type is implicitly converted to another.
> >
> > drivers/net/ethernet/qlogic/qed/qed_ll2.c:799:32: warning: implicit
> > conversion from enumeration type 'enum core_tx_dest' to different
> > enumeration type 'enum qed_ll2_tx_dest' [-Wenum-conversion]
> > tx_pkt.tx_dest = p_ll2_conn->tx_dest;
> > ~ ~~~~~~~~~~~~^~~~~~~
> > 1 warning generated.
> >
> > These enumerated types are not 1 to 1:
> >
> > /* Light L2 TX Destination */
> > enum core_tx_dest {
> > CORE_TX_DEST_NW,
> > CORE_TX_DEST_LB,
> > CORE_TX_DEST_RESERVED,
> > CORE_TX_DEST_DROP,
> > MAX_CORE_TX_DEST
> > };
> >
> > enum qed_ll2_tx_dest {
> > QED_LL2_TX_DEST_NW, /* Light L2 TX Destination to the Network */
> > QED_LL2_TX_DEST_LB, /* Light L2 TX Destination to the Loopback */
> > QED_LL2_TX_DEST_DROP, /* Light L2 Drop the TX packet */
> > QED_LL2_TX_DEST_MAX
> > };
> >
> > Fix this conversion warning by adding CORE_TX_DEST_DROP to
> > qed_ll2_tx_dest and converting all values of core_tx_dest to
> > the equivalent value in qed_ll2_tx_dest so that there is no
> > conversion warning or functional change.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/125
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
>
> [...]
>
> > -/* Light L2 TX Destination */
> > -enum core_tx_dest {
> > - CORE_TX_DEST_NW,
> > - CORE_TX_DEST_LB,
> > - CORE_TX_DEST_RESERVED,
> > - CORE_TX_DEST_DROP,
> > - MAX_CORE_TX_DEST
> > -};
>
> [...]
>
> > QED_LL2_TX_DEST_NW, /* Light L2 TX Destination to the Network */
> > QED_LL2_TX_DEST_LB, /* Light L2 TX Destination to the Loopback */
> > QED_LL2_TX_DEST_DROP, /* Light L2 Drop the TX packet */
> > + QED_LL2_TX_DEST_DROP_CORE, /* CORE_TX_DEST_DROP value */
> > QED_LL2_TX_DEST_MAX
> > };
>
> Thanks Nathan for finding this issue.
> "enum core_tx_dest" is for the interface with the device FW, while "enum qed_ll2_tx_dest" is for the interface with other qed* kernel modules.
> The distinction is on purpose, so "enum core_tx_dest" shouldn't be deleted.
> Maybe an explicit switch/case would be better as a fix?
> E.g. -
> - tx_pkt.tx_dest = p_ll2_conn->tx_dest;
> + switch (p_ll2_conn->tx_dest) {
> + case CORE_TX_DEST_NW:
> + tx_pkt.tx_dest = QED_LL2_TX_DEST_NW;
> + break;
> + case CORE_TX_DEST_LB:
> + tx_pkt.tx_dest = QED_LL2_TX_DEST_LB;
> + break;
> + case CORE_TX_DEST_DROP:
> + tx_pkt.tx_dest = QED_LL2_TX_DEST_DROP;
> + break;
> + default:
> + tx_pkt.tx_dest = QED_LL2_TX_DEST_DROP;
> + }
>
Hi Tomer,
Yes, that should work and it would match the rest of the driver's
handling of this distinction. I will go ahead and spin up a v2 here
shortly for review, thank you.
Nathan
next prev parent reply other threads:[~2018-10-04 16:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-04 0:09 [PATCH] qed: Remove unneeded enumerated type core_tx_dest Nathan Chancellor
2018-10-04 16:23 ` Tayar, Tomer
2018-10-04 16:27 ` Nathan Chancellor [this message]
2018-10-04 16:39 ` [PATCH v2] qed: Avoid implicit enum conversion in qed_ooo_submit_tx_buffers Nathan Chancellor
2018-10-04 16:46 ` Tayar, Tomer
2018-10-04 16:58 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181004162736.GA9947@flashbox \
--to=natechancellor@gmail.com \
--cc=Ariel.Elior@cavium.com \
--cc=Dept-EngEverestLinuxL2@cavium.com \
--cc=Tomer.Tayar@cavium.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox