[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251015131018.102569da@kernel.org>
Date: Wed, 15 Oct 2025 13:10:17 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Fan Gong <gongfan1@...wei.com>
Cc: Zhu Yikai <zhuyikai1@...artners.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon
Horman <horms@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
<linux-doc@...r.kernel.org>, Jonathan Corbet <corbet@....net>, Bjorn
Helgaas <helgaas@...nel.org>, luosifu <luosifu@...wei.com>, Xin Guo
<guoxin09@...wei.com>, Shen Chenyang <shenchenyang1@...ilicon.com>, Zhou
Shuai <zhoushuai28@...wei.com>, Wu Like <wulike1@...wei.com>, Shi Jing
<shijing34@...wei.com>, Luo Yang <luoyang82@...artners.com>, Meny Yossefi
<meny.yossefi@...wei.com>, Gur Stavi <gur.stavi@...wei.com>, Lee Trager
<lee@...ger.us>, Michael Ellerman <mpe@...erman.id.au>, Vadim Fedorenko
<vadim.fedorenko@...ux.dev>, Suman Ghosh <sumang@...vell.com>, Przemek
Kitszel <przemyslaw.kitszel@...el.com>, Joe Damato <jdamato@...tly.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: Re: [PATCH net-next v01 5/9] hinic3: Add netdev register interfaces
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
Powered by blists - more mailing lists