Re: [PATCH V3] octeontx2-pf: Add additional check for MCAM rules

From: Simon Horman
Date: Tue Jul 04 2023 - 09:48:08 EST


On Mon, Jul 03, 2023 at 10:30:54PM +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>
> ---
> Changes since v2:
> - Added "fixes" tag
>
> .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 7 +++++++
> .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 13 +++++++++++++
> 2 files changed, 20 insertions(+)
>
> 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;
> +

Hi Suman,

vlan_etype appears to be uninitialised here.

> vlan_etype = be16_to_cpu(fsp->h_ext.vlan_etype);

Perhaps the new check should go here.

> /* Only ETH_P_8021Q and ETH_P_802AD types supported */
> if (vlan_etype != ETH_P_8021Q &&

As noted by Jakub elsewhere, please allow 24h from the posting of v3
before posting v4.

--
pw-bot: changes-requested