From: Paolo Abeni <pabeni@redhat.com>
To: Fan Gong <gongfan1@huawei.com>,
Zhu Yikai <zhuyikai1@h-partners.com>,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Markus Elfring <Markus.Elfring@web.de>,
Pavan Chebbi <pavan.chebbi@broadcom.com>,
ALOK TIWARI <alok.a.tiwari@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-doc@vger.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>
Subject: Re: [PATCH net-next v07 8/9] hinic3: Add netdev notifier interfaces
Date: Tue, 25 Nov 2025 11:46:46 +0100 [thread overview]
Message-ID: <ea2ce128-537a-4718-aa70-d9192cfb94b8@redhat.com> (raw)
In-Reply-To: <ff986bcacacf77b6d86a241139eedee9fce4145c.1763555878.git.zhuyikai1@h-partners.com>
On 11/19/25 1:43 PM, Fan Gong wrote:
> Add netdev notifier interfaces.
> As we stipulate that netdevices with a vlan depth greater than 1
> should disable the offload feature, Layer 1 vlan netdevices use
> notifier to modify vlan_features.
As mentioned by Jakub in the previous revision, the net stack can send
packets with multiple stacked vlans. You need to implement
ndo_features_check(), check for the problematic packet layout there and
ev return a smaller features check excluding the relevant offloads.
> +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;
AFAICS the above can return any number >=
HINIC3_MAX_VLAN_DEPTH_OFFLOAD_SUPPORT ...
> +}
> +
> +static int hinic3_netdev_event(struct notifier_block *notifier,
> + unsigned long event, void *ptr)
> +{
> + struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
> + struct hinic3_nic_dev *nic_dev = netdev_priv(ndev);
> + u16 vlan_depth;
> +
> + if (!is_vlan_dev(ndev))
> + return NOTIFY_DONE;
> +
> + netdev_hold(ndev, &nic_dev->tracker, GFP_ATOMIC);
> +
> + switch (event) {
> + case NETDEV_REGISTER:
> + vlan_depth = hinic3_get_vlan_depth(ndev);
> + if (vlan_depth == HINIC3_MAX_VLAN_DEPTH_OFFLOAD_SUPPORT)
... so here you should use '>='> + ndev->vlan_features &=
(~HINIC3_VLAN_CLEAR_OFFLOAD);
> +
> + break;
> +
> + default:
> + break;
> + }
> +
> + netdev_put(ndev, &nic_dev->tracker);
> +
> + return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block hinic3_netdev_notifier = {
> + .notifier_call = hinic3_netdev_event,
> +};
> +
> static void init_intr_coal_param(struct net_device *netdev)
> {
> struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> @@ -309,6 +364,36 @@ static int hinic3_set_default_hw_feature(struct net_device *netdev)
> return 0;
> }
>
> +static void hinic3_register_notifier(struct net_device *netdev)
> +{
> + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> + int err;
> +
> + mutex_lock(&hinic3_netdev_notifiers_mutex);
> + hinic3_netdev_notifiers_ref_cnt++;
> + if (hinic3_netdev_notifiers_ref_cnt == 1) {
Why do you need this notifier accounting? Instead you should be able to
call hinic3_register_notifier() only once.
/P
next prev parent reply other threads:[~2025-11-25 10:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 12:43 [PATCH net-next v07 0/9] net: hinic3: PF initialization Fan Gong
2025-11-19 12:43 ` [PATCH net-next v07 1/9] hinic3: Add PF framework Fan Gong
2025-11-19 12:43 ` [PATCH net-next v07 2/9] hinic3: Add PF management interfaces Fan Gong
2025-11-19 12:43 ` [PATCH net-next v07 3/9] hinic3: Add .ndo_tx_timeout and .ndo_get_stats64 Fan Gong
2025-11-19 12:43 ` [PATCH net-next v07 4/9] hinic3: Add .ndo_set_features and .ndo_fix_features Fan Gong
2025-11-19 12:43 ` [PATCH net-next v07 5/9] hinic3: Add .ndo_vlan_rx_add/kill_vid and .ndo_validate_addr Fan Gong
2025-11-19 12:43 ` [PATCH net-next v07 6/9] hinic3: Add adaptive IRQ coalescing with DIM Fan Gong
2025-11-19 12:43 ` [PATCH net-next v07 7/9] hinic3: Add mac filter ops Fan Gong
2025-11-19 12:43 ` [PATCH net-next v07 8/9] hinic3: Add netdev notifier interfaces Fan Gong
2025-11-25 10:46 ` Paolo Abeni [this message]
2025-11-19 12:43 ` [PATCH net-next v07 9/9] hinic3: Add HW event handler 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=ea2ce128-537a-4718-aa70-d9192cfb94b8@redhat.com \
--to=pabeni@redhat.com \
--cc=Markus.Elfring@web.de \
--cc=alok.a.tiwari@oracle.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gongfan1@huawei.com \
--cc=guoxin09@huawei.com \
--cc=gur.stavi@huawei.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--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=netdev@vger.kernel.org \
--cc=pavan.chebbi@broadcom.com \
--cc=shenchenyang1@hisilicon.com \
--cc=shijing34@huawei.com \
--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
all inboxes | Powered by JetHome®