Skip to content

Commit 8278ee2

Browse files
sumang-mrvlPaolo Abeni
authored andcommitted
octeontx2-pf: Add additional check for MCAM rules
Due to hardware limitation, MCAM drop rule with ether_type == 802.1Q and vlan_id == 0 is not supported. Hence rejecting such rules. Fixes: dce677d ("octeontx2-pf: Add vlan-etype to ntuple filters") Signed-off-by: Suman Ghosh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 04499f2 commit 8278ee2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,14 @@ static int otx2_prepare_flow_request(struct ethtool_rx_flow_spec *fsp,
872872
return -EINVAL;
873873

874874
vlan_etype = be16_to_cpu(fsp->h_ext.vlan_etype);
875+
876+
/* Drop rule with vlan_etype == 802.1Q
877+
* and vlan_id == 0 is not supported
878+
*/
879+
if (vlan_etype == ETH_P_8021Q && !fsp->m_ext.vlan_tci &&
880+
fsp->ring_cookie == RX_CLS_FLOW_DISC)
881+
return -EINVAL;
882+
875883
/* Only ETH_P_8021Q and ETH_P_802AD types supported */
876884
if (vlan_etype != ETH_P_8021Q &&
877885
vlan_etype != ETH_P_8021AD)

drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,21 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node,
597597
return -EOPNOTSUPP;
598598
}
599599

600+
if (!match.mask->vlan_id) {
601+
struct flow_action_entry *act;
602+
int i;
603+
604+
flow_action_for_each(i, act, &rule->action) {
605+
if (act->id == FLOW_ACTION_DROP) {
606+
netdev_err(nic->netdev,
607+
"vlan tpid 0x%x with vlan_id %d is not supported for DROP rule.\n",
608+
ntohs(match.key->vlan_tpid),
609+
match.key->vlan_id);
610+
return -EOPNOTSUPP;
611+
}
612+
}
613+
}
614+
600615
if (match.mask->vlan_id ||
601616
match.mask->vlan_dei ||
602617
match.mask->vlan_priority) {

0 commit comments

Comments
 (0)