hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8382 -------------------------------- Some NICs support the ntuple feature, but due to driver issues or other reasons, they do not allow external modification. Therefore, we have added a switch here to control whether to check the NIC's ntuple feature. Signed-off-by: Liu Jian <liujian56@huawei.com> --- net/oenetcls/oenetcls.h | 1 + net/oenetcls/oenetcls_flow.c | 2 +- net/oenetcls/oenetcls_main.c | 10 ++++++++++ net/oenetcls/oenetcls_ntuple.c | 10 ++++++---- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/net/oenetcls/oenetcls.h b/net/oenetcls/oenetcls.h index 0be09b153428..3167d11d2ee5 100644 --- a/net/oenetcls/oenetcls.h +++ b/net/oenetcls/oenetcls.h @@ -133,6 +133,7 @@ extern int match_ip_flag; extern int debug; extern int oecls_netdev_num; extern int oecls_numa_num; +extern int check_nic_feature; #define oecls_debug(fmt, ...) \ do { \ diff --git a/net/oenetcls/oenetcls_flow.c b/net/oenetcls/oenetcls_flow.c index d4d9a8f15660..e9730c8abd2e 100644 --- a/net/oenetcls/oenetcls_flow.c +++ b/net/oenetcls/oenetcls_flow.c @@ -137,7 +137,7 @@ static void set_oecls_cpu(struct net_device *dev, struct sk_buff *skb, int rxq_index, rc; if (!skb_rx_queue_recorded(skb) || !dev->rx_cpu_rmap || - !(dev->features & NETIF_F_NTUPLE)) + (!(dev->features & NETIF_F_NTUPLE) && check_nic_feature)) return; rxq_index = flow_get_queue_idx(dev, cpu_to_node(next_cpu), skb); diff --git a/net/oenetcls/oenetcls_main.c b/net/oenetcls/oenetcls_main.c index 458d92c23b3b..983fcfccccb5 100644 --- a/net/oenetcls/oenetcls_main.c +++ b/net/oenetcls/oenetcls_main.c @@ -47,6 +47,10 @@ static char irqname[64] = "comp"; module_param_string(irqname, irqname, sizeof(irqname), 0644); MODULE_PARM_DESC(irqname, "nic irq name string, default comp"); +int check_nic_feature = 1; +module_param(check_nic_feature, int, 0444); +MODULE_PARM_DESC(check_nic_feature, "check nic feature, default 1"); + static bool check_params(void) { if (mode != 0 && mode != 1) @@ -401,6 +405,9 @@ static int oecls_filter_enable(const char *dev_name, bool *old_state) struct cmd_context ctx = {0}; int ret; + if (!check_nic_feature) + return 0; + strncpy(ctx.netdev, dev_name, IFNAMSIZ); eval.cmd = ETHTOOL_GFLAGS; @@ -447,6 +454,9 @@ static void oecls_filter_restore(const char *dev_name, bool old_state) bool cur_filter_state; int ret; + if (!check_nic_feature) + return; + strncpy(ctx.netdev, dev_name, IFNAMSIZ); eval.cmd = ETHTOOL_GFLAGS; diff --git a/net/oenetcls/oenetcls_ntuple.c b/net/oenetcls/oenetcls_ntuple.c index def33d30f642..3c599ad762c7 100644 --- a/net/oenetcls/oenetcls_ntuple.c +++ b/net/oenetcls/oenetcls_ntuple.c @@ -372,10 +372,12 @@ static int do_srxntuple(struct cmd_context *ctx, struct ethtool_rx_flow_spec *fs flow_spec_to_ntuple(fsp, &ntuplecmd.fs); - eval.cmd = ETHTOOL_GFLAGS; - ret = send_ethtool_ioctl(ctx, &eval); - if (ret || !(eval.data & ETH_FLAG_NTUPLE)) - return -1; + if (check_nic_feature) { + eval.cmd = ETHTOOL_GFLAGS; + ret = send_ethtool_ioctl(ctx, &eval); + if (ret || !(eval.data & ETH_FLAG_NTUPLE)) + return -1; + } ntuplecmd.cmd = ETHTOOL_SRXNTUPLE; ret = send_ethtool_ioctl(ctx, &ntuplecmd); -- 2.34.1