Subject: Re: [PATCH net 3/3] iavf: enable tc filter configuration only if hw-tc-offload is on

From: Jakub Kicinski <[email-masked]>
Date: Wed, 27 Jul 2022 18:10:39 -0700

On Wed, 27 Jul 2022 23:37:27 +0000 Mogilappagari, Sudheer wrote:
> > > +	if (!(adapter->netdev->features & NETIF_F_HW_TC)) {
> > > +		dev_err(&adapter->pdev->dev,
> > > +			"Can't apply TC flower filters, turn ON hw-tc-offload and try again");  
> > > +		return -EOPNOTSUPP;
> > > +	}
> > > +
> > >  	filter = kzalloc(sizeof(*filter), GFP_KERNEL);
> > >  	if (!filter)
> > >  		return -ENOMEM;  
> > 
> > tc_can_offload() checks this in the core already, no?  
> 
> Hi Jakub,
> Seems like there is no check in core code in this path. Tested again
> to confirm that no error is thrown by core code. Below is the call
> trace while adding filter.
> [  927.358001]  dump_stack_lvl+0x44/0x58
> [  927.358009]  ice_add_cls_flower+0x73/0x90 [ice]
> [  927.358066]  tc_setup_cb_add+0xc7/0x1e0
> [  927.358074]  fl_hw_replace_filter+0x143/0x1e0 [cls_flower]
> [  927.358081]  fl_change+0xbc3/0xed8 [cls_flower]
> [  927.358086]  tc_new_tfilter+0x382/0xbc0

Oh, you're right, we moved to drivers doing the check it seems.

But you already have a check in iavf_setup_tc_block_cb()
- tc_cls_can_offload_and_chain0() should validate the device has
TC offload enabled. It that not working somehow?