From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753977AbdDKOfq (ORCPT ); Tue, 11 Apr 2017 10:35:46 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:59790 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753337AbdDKOfm (ORCPT ); Tue, 11 Apr 2017 10:35:42 -0400 Date: Tue, 11 Apr 2017 10:35:35 -0400 (EDT) Message-Id: <20170411.103535.2136552403177283944.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 From: David Miller In-Reply-To: <1491894754-16384-3-git-send-email-sean.wang@mediatek.com> References: <1491894754-16384-1-git-send-email-sean.wang@mediatek.com> <1491894754-16384-3-git-send-email-sean.wang@mediatek.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 11 Apr 2017 06:54:18 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: 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.