RE: [EXT] Re: [net PATCH V4] octeontx2-pf: Add additional check for MCAM rules

From: Suman Ghosh
Date: Mon Jul 10 2023 - 06:29:25 EST



>----------------------------------------------------------------------
>On Fri, Jul 07, 2023 at 09:23:21AM +0530, Suman Ghosh wrote:
>> Due to hardware limitation, MCAM drop rule with ether_type == 802.1Q
>> and vlan_id == 0 is not supported. Hence rejecting such rules.
>>
>> Fixes: dce677da57c0 ("octeontx2-pf: Add vlan-etype to ntuple filters")
>> Signed-off-by: Suman Ghosh <sumang@xxxxxxxxxxx>
>
>(...)
>
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
>> @@ -604,6 +604,19 @@ static int otx2_tc_prepare_flow(struct otx2_nic
>*nic, struct otx2_tc_flow *node,
>> return -EOPNOTSUPP;
>> }
>>
>> + if (!match.mask->vlan_id) {
>> + struct flow_action_entry *act;
>> + int i;
>> +
>> + flow_action_for_each(i, act, &rule->action) {
>> + if (act->id == FLOW_ACTION_DROP) {
>> + netdev_err(nic->netdev, "vlan tpid 0x%x with
>vlan_id %d is not supported for DROP rule.\n",
>> + ntohs(match.key->vlan_tpid), match.key-
>>vlan_id);
>> + return -EOPNOTSUPP;
>
>The code got very nested here.
>Please consider moving the above check to a separate helper function, or
>at least reformatting the error log to fix the checkpatch warning about
>80 chars, for example:
[Suman] Will do the suggested reformatting in next version.
>
> flow_action_for_each(i, act, &rule->action) {
> if (act->id == FLOW_ACTION_DROP) {
> netdev_err(nic->netdev,
> "vlan tpid 0x%x with vlan_id %d is not
>supported for DROP rule.\n",
> ntohs(match.key->vlan_tpid),
> match.key->vlan_id);
> return -EOPNOTSUPP;
> }
>
>Thanks,
>Michal