Re: [PATCH net-next v06 5/5] hinic3: Add netdev register interfaces

From: Jakub Kicinski
Date: Mon Nov 10 2025 - 22:05:11 EST


On Sat, 8 Nov 2025 14:41:40 +0800 Fan Gong wrote:
> Add netdev notifier to accept netdev event.
> Refine port event type to change link status.

Please explain the "why", why is this patch needed.
This commit message is woefully inadequate for this patch.
Plus the patch seems to, again, be doing multiple things.

> +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) {
> + 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);
> + }

Why are you doing this? Are vlan_features inherited across multiple
layers of vlan devices? Vlan tags can be pushed in multiple ways, not
just by stacking a device on top. If your device can't handle stacked
vlans and (somehow?) the stack is serving you multi-vlan frames I think
you need to fix it in ndo_features_check