hinic3: Add .ndo_features_check

As we cannot solve packets with multiple stacked vlan, so we use
.ndo_features_check to check for these packets and return a smaller
feature without offload features.

Co-developed-by: Zhu Yikai <zhuyikai1@h-partners.com>
Signed-off-by: Zhu Yikai <zhuyikai1@h-partners.com>
Signed-off-by: Fan Gong <gongfan1@huawei.com>
Link: https://patch.msgid.link/3879b20b7ffa20106a3f8f56dbf2d5eb389f260a.1768375903.git.zhuyikai1@h-partners.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Fan Gong 2026-01-14 16:38:24 +08:00 committed by Paolo Abeni
parent 721df7639c
commit 2467a04660

View File

@ -2,7 +2,9 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
#include <linux/netdevice.h>
#include <net/vxlan.h>
#include "hinic3_hwif.h"
#include "hinic3_nic_cfg.h"
@ -624,6 +626,16 @@ static netdev_features_t hinic3_fix_features(struct net_device *netdev,
return features_tmp;
}
static netdev_features_t hinic3_features_check(struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features)
{
features = vlan_features_check(skb, features);
features = vxlan_features_check(skb, features);
return features;
}
int hinic3_set_hw_features(struct net_device *netdev)
{
netdev_features_t wanted, curr;
@ -756,6 +768,7 @@ static const struct net_device_ops hinic3_netdev_ops = {
.ndo_stop = hinic3_close,
.ndo_set_features = hinic3_ndo_set_features,
.ndo_fix_features = hinic3_fix_features,
.ndo_features_check = hinic3_features_check,
.ndo_change_mtu = hinic3_change_mtu,
.ndo_set_mac_address = hinic3_set_mac_addr,
.ndo_tx_timeout = hinic3_tx_timeout,