octeontx2-pf: Add additional check for MCAM rules.
PATCH 1/1 octeontx2-pf: Add additional check for MCAM rules.
MCAM drop rule with ether_type==802.1Q and vlan_id==0 is not supported.
Signed-off-by Suman Ghosh <[email protected]>
--- .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 7 +++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 13 +++++++++++++ 2 files changed, 20 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +7 -0
@@ -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 &&
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +13 -0
@@ -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) {
Signature · 1 line
2.25.1