From: David Miller <davem@davemloft.net>
To: sean.wang@mediatek.com
Cc: john@phrozen.org, nbd@openwrt.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
keyhaede@gmail.com
Subject: Re: [PATCH net 2/2] net: ethernet: mediatek: fix inconsistency of port number carried in TXD
Date: Tue, 11 Apr 2017 10:35:35 -0400 (EDT) [thread overview]
Message-ID: <20170411.103535.2136552403177283944.davem@davemloft.net> (raw)
In-Reply-To: <1491894754-16384-3-git-send-email-sean.wang@mediatek.com>
From: <sean.wang@mediatek.com>
Date: Tue, 11 Apr 2017 15:12:34 +0800
> @@ -410,12 +410,18 @@ struct mtk_hw_stats {
> struct u64_stats_sync syncp;
> };
>
> -/* PDMA descriptor can point at 1-2 segments. This enum allows us to track how
> - * memory was allocated so that it can be freed properly
> - */
> enum mtk_tx_flags {
> + /* PDMA descriptor can point at 1-2 segments. This enum allows us to
> + * track how memory was allocated so that it can be freed properly.
> + */
> MTK_TX_FLAGS_SINGLE0 = 0x01,
> MTK_TX_FLAGS_PAGE0 = 0x02,
> +
> + /* MTK_TX_FLAGS_FPORTx allows tracking which port the transmitted
> + * SKB out instead of looking up through hardware TX descriptor.
> + */
> + MTK_TX_FLAGS_FPORT1 = 0x03,
> + MTK_TX_FLAGS_FPORT0 = 0x04,
> };
You're creating a confusing situation here and asking for bugs to be introduced
into the driver.
The existing two enumeration values are "bit masks", but these two new values
are bit numbers and must be used with BIT().
Make them consistent, and I would suggest to make all of them bit masks, thus:
MTK_TX_FLAGS_FPORT1 = 0x04,
MTK_TX_FLAGS_FPORT0 = 0x08,
And then remove the use of BIT() to these values.
Thanks.
prev parent reply other threads:[~2017-04-11 14:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 7:12 [PATCH net 0/2] Fix crash caused by reporting inconsistent skb->len to BQL sean.wang
2017-04-11 7:12 ` [PATCH net 1/2] net: ethernet: mediatek: fix inconsistency between TXD and the used buffer sean.wang
2017-04-11 7:12 ` [PATCH net 2/2] net: ethernet: mediatek: fix inconsistency of port number carried in TXD sean.wang
2017-04-11 14:35 ` David Miller [this message]
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=20170411.103535.2136552403177283944.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=john@phrozen.org \
--cc=keyhaede@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=nbd@openwrt.org \
--cc=netdev@vger.kernel.org \
--cc=sean.wang@mediatek.com \
/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;
as well as URLs for NNTP newsgroup(s).