Skip to content

Commit 54976cf

Browse files
msudheer337kuba-moo
authored andcommitted
iavf: Fix TC config comparison with existing adapter TC config
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 <[email protected]> Tested-by: Mineri Bhange <[email protected]> (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ef3c313 commit 54976cf

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
@@ -3502,6 +3502,34 @@ static void iavf_del_all_cloud_filters(struct iavf_adapter *adapter)
35023502
spin_unlock_bh(&adapter->cloud_filter_list_lock);
35033503
}
35043504

3505+
/**
3506+
* iavf_is_tc_config_same - Compare the mqprio TC config with the
3507+
* TC config already configured on this adapter.
3508+
* @adapter: board private structure
3509+
* @mqprio_qopt: TC config received from kernel.
3510+
*
3511+
* This function compares the TC config received from the kernel
3512+
* with the config already configured on the adapter.
3513+
*
3514+
* Return: True if configuration is same, false otherwise.
3515+
**/
3516+
static bool iavf_is_tc_config_same(struct iavf_adapter *adapter,
3517+
struct tc_mqprio_qopt *mqprio_qopt)
3518+
{
3519+
struct virtchnl_channel_info *ch = &adapter->ch_config.ch_info[0];
3520+
int i;
3521+
3522+
if (adapter->num_tc != mqprio_qopt->num_tc)
3523+
return false;
3524+
3525+
for (i = 0; i < adapter->num_tc; i++) {
3526+
if (ch[i].count != mqprio_qopt->count[i] ||
3527+
ch[i].offset != mqprio_qopt->offset[i])
3528+
return false;
3529+
}
3530+
return true;
3531+
}
3532+
35053533
/**
35063534
* __iavf_setup_tc - configure multiple traffic classes
35073535
* @netdev: network interface device structure
@@ -3559,7 +3587,7 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data)
35593587
if (ret)
35603588
return ret;
35613589
/* Return if same TC config is requested */
3562-
if (adapter->num_tc == num_tc)
3590+
if (iavf_is_tc_config_same(adapter, &mqprio_qopt->qopt))
35633591
return 0;
35643592
adapter->num_tc = num_tc;
35653593

0 commit comments

Comments
 (0)