Skip to content

Commit c279acf

Browse files
msudheer337Ma Wupeng
authored andcommitted
iavf: Fix TC config comparison with existing adapter TC config
stable inclusion from stable-v6.6.30 commit 2f7cc2dfc15999e8878b7689d172053b57fb3ebb bugzilla: https://gitee.com/openeuler/kernel/issues/I9MPZ8 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2f7cc2dfc15999e8878b7689d172053b57fb3ebb -------------------------------- [ Upstream commit 54976cf58d6168b8d15cebb395069f23b2f34b31 ] Same number of TCs doesn't imply that underlying TC configs are same. The config could be different due to difference in number of queues in each TC. Add utility function to determine if TC configs are same. Fixes: d5b33d0 ("i40evf: add ndo_setup_tc callback to i40evf") Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com> Tested-by: Mineri Bhange <minerix.bhange@intel.com> (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Link: https://lore.kernel.org/r/20240423182723.740401-4-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
1 parent e90f658 commit c279acf

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3574,6 +3574,34 @@ static void iavf_del_all_cloud_filters(struct iavf_adapter *adapter)
35743574
spin_unlock_bh(&adapter->cloud_filter_list_lock);
35753575
}
35763576

3577+
/**
3578+
* iavf_is_tc_config_same - Compare the mqprio TC config with the
3579+
* TC config already configured on this adapter.
3580+
* @adapter: board private structure
3581+
* @mqprio_qopt: TC config received from kernel.
3582+
*
3583+
* This function compares the TC config received from the kernel
3584+
* with the config already configured on the adapter.
3585+
*
3586+
* Return: True if configuration is same, false otherwise.
3587+
**/
3588+
static bool iavf_is_tc_config_same(struct iavf_adapter *adapter,
3589+
struct tc_mqprio_qopt *mqprio_qopt)
3590+
{
3591+
struct virtchnl_channel_info *ch = &adapter->ch_config.ch_info[0];
3592+
int i;
3593+
3594+
if (adapter->num_tc != mqprio_qopt->num_tc)
3595+
return false;
3596+
3597+
for (i = 0; i < adapter->num_tc; i++) {
3598+
if (ch[i].count != mqprio_qopt->count[i] ||
3599+
ch[i].offset != mqprio_qopt->offset[i])
3600+
return false;
3601+
}
3602+
return true;
3603+
}
3604+
35773605
/**
35783606
* __iavf_setup_tc - configure multiple traffic classes
35793607
* @netdev: network interface device structure
@@ -3631,7 +3659,7 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data)
36313659
if (ret)
36323660
return ret;
36333661
/* Return if same TC config is requested */
3634-
if (adapter->num_tc == num_tc)
3662+
if (iavf_is_tc_config_same(adapter, &mqprio_qopt->qopt))
36353663
return 0;
36363664
adapter->num_tc = num_tc;
36373665

0 commit comments

Comments
 (0)