From: Jakub Kicinski <kuba@kernel.org>
To: Fan Gong <gongfan1@huawei.com>
Cc: Zhu Yikai <zhuyikai1@h-partners.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>, <linux-doc@vger.kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Bjorn Helgaas <helgaas@kernel.org>, luosifu <luosifu@huawei.com>,
Xin Guo <guoxin09@huawei.com>,
Shen Chenyang <shenchenyang1@hisilicon.com>,
Zhou Shuai <zhoushuai28@huawei.com>, Wu Like <wulike1@huawei.com>,
Shi Jing <shijing34@huawei.com>,
Luo Yang <luoyang82@h-partners.com>,
Meny Yossefi <meny.yossefi@huawei.com>,
Gur Stavi <gur.stavi@huawei.com>, Lee Trager <lee@trager.us>,
Michael Ellerman <mpe@ellerman.id.au>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Suman Ghosh <sumang@marvell.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Joe Damato <jdamato@fastly.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: Re: [PATCH net-next v01 5/9] hinic3: Add netdev register interfaces
Date: Wed, 15 Oct 2025 13:10:17 -0700 [thread overview]
Message-ID: <20251015131018.102569da@kernel.org> (raw)
In-Reply-To: <85a6aab1f40d6078279c07e28e08b879bdee207c.1760502478.git.zhuyikai1@h-partners.com>
On Wed, 15 Oct 2025 15:15:31 +0800 Fan Gong wrote:
> +static int hinic3_netdev_event(struct notifier_block *notifier,
> + unsigned long event, void *ptr);
please reorder the code to avoid the fwd declaration
> +/* used for netdev notifier register/unregister */
> +static DEFINE_MUTEX(hinic3_netdev_notifiers_mutex);
> +static int hinic3_netdev_notifiers_ref_cnt;
> +static struct notifier_block hinic3_netdev_notifier = {
> + .notifier_call = hinic3_netdev_event,
> +};
> +
> +static u16 hinic3_get_vlan_depth(struct net_device *netdev)
> +{
> + u16 vlan_depth = 0;
> +
> +#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
> + while (is_vlan_dev(netdev)) {
> + netdev = vlan_dev_priv(netdev)->real_dev;
> + vlan_depth++;
> + }
> +#endif
> + return vlan_depth;
> +}
> +
> +static int hinic3_netdev_event(struct notifier_block *notifier,
> + unsigned long event, void *ptr)
> +{
> + struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
> + u16 vlan_depth;
> +
> + if (!is_vlan_dev(ndev))
> + return NOTIFY_DONE;
> +
> + dev_hold(ndev);
please use netdev_hold()
> + switch (event) {
> + case NETDEV_REGISTER:
> + vlan_depth = hinic3_get_vlan_depth(ndev);
> + if (vlan_depth == HINIC3_MAX_VLAN_DEPTH_OFFLOAD_SUPPORT) {
> + ndev->vlan_features &= (~HINIC3_VLAN_CLEAR_OFFLOAD);
> + } else if (vlan_depth > HINIC3_MAX_VLAN_DEPTH_OFFLOAD_SUPPORT) {
> + ndev->hw_features &= (~HINIC3_VLAN_CLEAR_OFFLOAD);
> + ndev->features &= (~HINIC3_VLAN_CLEAR_OFFLOAD);
> + }
> +
> + break;
> +
> + default:
> + break;
> + };
unnecessary semicolon
> + dev_put(ndev);
--
pw-bot: cr
next prev parent reply other threads:[~2025-10-15 20:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 7:15 [PATCH net-next v01 0/9] net: hinic3: Add a driver for Huawei 3rd gen NIC - PF initialization Fan Gong
2025-10-15 7:15 ` [PATCH net-next v01 1/9] hinic3: Add PF framework Fan Gong
2025-10-15 10:29 ` Pavan Chebbi
2025-10-27 10:00 ` Simon Horman
2025-10-15 7:15 ` [PATCH net-next v01 2/9] hinic3: Add PF management interfaces Fan Gong
2025-10-15 10:00 ` [PATCH net-next " Markus Elfring
2025-10-15 16:46 ` Simon Horman
2025-10-16 8:55 ` Fan Gong
2025-10-16 10:26 ` [net-next " Markus Elfring
2025-10-16 12:46 ` [PATCH net-next " Fan Gong
2025-10-15 7:15 ` [PATCH net-next v01 3/9] hinic3: Add NIC configuration ops Fan Gong
2025-10-15 7:15 ` [PATCH net-next v01 4/9] hinic3: Add mac filter ops Fan Gong
2025-10-15 7:15 ` [PATCH net-next v01 5/9] hinic3: Add netdev register interfaces Fan Gong
2025-10-15 20:10 ` Jakub Kicinski [this message]
2025-10-15 7:15 ` [PATCH net-next v01 6/9] hinic3: Fix netif_queue_set_napi queue_index parameter passing error Fan Gong
2025-10-15 7:15 ` [PATCH net-next v01 7/9] hinic3: Fix code Style(remove empty lines between error handling) Fan Gong
2025-10-15 7:15 ` [PATCH net-next v01 8/9] hinic3: Remove redundant defensive code Fan Gong
2025-10-15 7:15 ` [PATCH net-next v01 9/9] hinic3: Use array_size instead of multiplying Fan Gong
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=20251015131018.102569da@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=christophe.jaillet@wanadoo.fr \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gongfan1@huawei.com \
--cc=guoxin09@huawei.com \
--cc=gur.stavi@huawei.com \
--cc=helgaas@kernel.org \
--cc=horms@kernel.org \
--cc=jdamato@fastly.com \
--cc=lee@trager.us \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luosifu@huawei.com \
--cc=luoyang82@h-partners.com \
--cc=meny.yossefi@huawei.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=shenchenyang1@hisilicon.com \
--cc=shijing34@huawei.com \
--cc=sumang@marvell.com \
--cc=vadim.fedorenko@linux.dev \
--cc=wulike1@huawei.com \
--cc=zhoushuai28@huawei.com \
--cc=zhuyikai1@h-partners.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).