diff mbox series

[net,V2] octeontx2-pf: Add additional check for MCAM rules.

Message ID 20230703095600.2048397-1-sumang@marvell.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net,V2] octeontx2-pf: Add additional check for MCAM rules. | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang fail Errors and warnings before: 18 this patch: 21
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning WARNING: line length of 100 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Suman Ghosh July 3, 2023, 9:56 a.m. UTC
Due to hardware limitation, MCAM drop rule with
ether_type == 802.1Q and vlan_id == 0 is not supported. Hence rejecting
such rules.

Signed-off-by: Suman Ghosh <sumang@marvell.com>
---
Changes since v1:
- Updated commit message

 .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c |  7 +++++++
 .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c    | 13 +++++++++++++
 2 files changed, 20 insertions(+)

Comments

Alexander Lobakin July 3, 2023, 4:32 p.m. UTC | #1
From: Suman Ghosh <sumang@marvell.com>
Date: Mon, 3 Jul 2023 15:26:00 +0530

> Re: [net PATCH V2] octeontx2-pf: Add additional check for MCAM rules.

Please no periods at the end of commit messages.

> Due to hardware limitation, MCAM drop rule with
> ether_type == 802.1Q and vlan_id == 0 is not supported. Hence rejecting
> such rules.
> 
> Signed-off-by: Suman Ghosh <sumang@marvell.com>

Targeted to net/fixes with no "Fixes:" tagging the blamed commit.

> ---
> Changes since v1:
> - Updated commit message
> 
>  .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c |  7 +++++++
>  .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c    | 13 +++++++++++++
>  2 files changed, 20 insertions(+)

[...]

Thanks,
Olek
Suman Ghosh July 3, 2023, 5:42 p.m. UTC | #2
>External Email
>
>----------------------------------------------------------------------
>From: Suman Ghosh <sumang@marvell.com>
>Date: Mon, 3 Jul 2023 15:26:00 +0530
>
>> Re: [net PATCH V2] octeontx2-pf: Add additional check for MCAM rules.
>
>Please no periods at the end of commit messages.
[Suman] Done
>
>> Due to hardware limitation, MCAM drop rule with ether_type == 802.1Q
>> and vlan_id == 0 is not supported. Hence rejecting such rules.
>>
>> Signed-off-by: Suman Ghosh <sumang@marvell.com>
>
>Targeted to net/fixes with no "Fixes:" tagging the blamed commit.
[Suman] Added fixes tag.
>
>> ---
>> Changes since v1:
>> - Updated commit message
>>
>>  .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c |  7 +++++++
>>  .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c    | 13
>+++++++++++++
>>  2 files changed, 20 insertions(+)
>
>[...]
>
>Thanks,
>Olek
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
index 10e11262d48a..49ba27875111 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
@@ -871,6 +871,13 @@  static int otx2_prepare_flow_request(struct ethtool_rx_flow_spec *fsp,
 			if (be16_to_cpu(fsp->m_ext.vlan_etype) != 0xFFFF)
 				return -EINVAL;
 
+			/* Drop rule with vlan_etype == 802.1Q
+			 * and vlan_id == 0 is not supported
+			 */
+			if (vlan_etype == ETH_P_8021Q && !fsp->m_ext.vlan_tci &&
+			    fsp->ring_cookie == RX_CLS_FLOW_DISC)
+				return -EINVAL;
+
 			vlan_etype = be16_to_cpu(fsp->h_ext.vlan_etype);
 			/* Only ETH_P_8021Q and ETH_P_802AD types supported */
 			if (vlan_etype != ETH_P_8021Q &&
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
index 044cc211424e..6c0fdc2bad73 100644
--- 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;
+				}
+			}
+		}
+
 		if (match.mask->vlan_id ||
 		    match.mask->vlan_dei ||
 		    match.mask->vlan_priority) {