hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/9102 -------------------------------- Only use NIC current hardware channels for flow steer. Signed-off-by: Yue Haibing <yuehaibing@huawei.com> Signed-off-by: Li Xiasong <lixiasong1@huawei.com> --- net/venetcls/venetcls_main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/net/venetcls/venetcls_main.c b/net/venetcls/venetcls_main.c index 2072e330941e..fefdbd7d552a 100644 --- a/net/venetcls/venetcls_main.c +++ b/net/venetcls/venetcls_main.c @@ -397,8 +397,20 @@ static bool check_irq_name(const char *irq_name, struct vecls_netdev_info *vecls static void get_netdev_queue_info(struct vecls_netdev_info *vecls_dev) { struct vecls_netdev_queue_info *rxq_info; + struct ethtool_channels echannels = {0}; + int irq, cpu, ret, combined_channels; + struct cmd_context ctx = {0}; struct irq_desc *desc; - int irq, cpu; + + strscpy(ctx.netdev, vecls_dev->dev_name, IFNAMSIZ); + echannels.cmd = ETHTOOL_GCHANNELS; + ret = send_ethtool_ioctl(&ctx, &echannels); + if (ret) { + vecls_error("get %s channels fail ret:%d\n", vecls_dev->dev_name, ret); + return; + } + + combined_channels = echannels.combined_count; for_each_irq_desc(irq, desc) { if (!desc->action) @@ -409,6 +421,10 @@ static void get_netdev_queue_info(struct vecls_netdev_info *vecls_dev) continue; if (vecls_dev->rxq_num >= VECLS_MAX_RXQ_NUM_PER_DEV) break; + if (vecls_dev->rxq_num > combined_channels - 1) + break; + vecls_debug("rxq_num:%d channels:%d\n", vecls_dev->rxq_num, combined_channels); + rxq_info = &vecls_dev->rxq[vecls_dev->rxq_num++]; rxq_info->irq = irq; cpu = cpumask_first(irq_data_get_effective_affinity_mask(&desc->irq_data)); -- 2.34.1