From nobody Sat Feb 7 18:20:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27E89EB64D9 for ; Mon, 10 Jul 2023 10:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232269AbjGJKbZ (ORCPT ); Mon, 10 Jul 2023 06:31:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232817AbjGJKbP (ORCPT ); Mon, 10 Jul 2023 06:31:15 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6791AE2; Mon, 10 Jul 2023 03:30:50 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36A6C3Ak021884; Mon, 10 Jul 2023 03:30:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Ht0zG3SbuK8XFLIxJVSHU6f9E9fnWCCCBF1cwN6I8+k=; b=C4xTBNk4+rsv4RdMFMwHpmE68X+RvLYqqA36/koS52T+7ucEdhqNR1B1KKZUOVpwiLq2 ls8pLwgeVHfRRnsG6BClgvgX83nzuVEOFRsraa/iY/ydu3N0uPqGKOoxbvs2Oi9aZXOZ 6pp83opENIZUspeaBHzaxHXxYA9+YsXWK2a8XySPsZdepw6ef+yNKPsTNcGW41zGJeD8 g5jmxZOS4CND8Hsiu0k/kL5uYriVSfZEsm5bexHIrS24feJh7uRhRo5Nk+rk9m82I91L EM7SVbM6hw8Lq8LzuuBsRI60efjkk4TwKfMtEPE9SYXo4v551iSEPGzIqBF/YHnBy+AY TQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3rq7ajv3qg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 03:30:36 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 10 Jul 2023 03:30:34 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 10 Jul 2023 03:30:34 -0700 Received: from localhost.localdomain (unknown [10.28.36.166]) by maili.marvell.com (Postfix) with ESMTP id 0F27C3F7069; Mon, 10 Jul 2023 03:30:30 -0700 (PDT) From: Suman Ghosh To: , , , , , , , , , CC: Suman Ghosh Subject: [net PATCH V5] octeontx2-pf: Add additional check for MCAM rules Date: Mon, 10 Jul 2023 16:00:27 +0530 Message-ID: <20230710103027.2244139-1-sumang@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: -qDacU7kfu9c9CqdMDMTKKPRdi4zztPP X-Proofpoint-GUID: -qDacU7kfu9c9CqdMDMTKKPRdi4zztPP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_08,2023-07-06_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Due to hardware limitation, MCAM drop rule with ether_type =3D=3D 802.1Q and vlan_id =3D=3D 0 is not supported. Hence rejec= ting such rules. Fixes: dce677da57c0 ("octeontx2-pf: Add vlan-etype to ntuple filters") Signed-off-by: Suman Ghosh --- changes since v4: - Reformatted text in file otx2_tc.c as per review comment. .../ethernet/marvell/octeontx2/nic/otx2_flows.c | 8 ++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/driv= ers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c index 10e11262d48a..2d7713a1a153 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c @@ -872,6 +872,14 @@ static int otx2_prepare_flow_request(struct ethtool_rx= _flow_spec *fsp, return -EINVAL; =20 vlan_etype =3D be16_to_cpu(fsp->h_ext.vlan_etype); + + /* Drop rule with vlan_etype =3D=3D 802.1Q + * and vlan_id =3D=3D 0 is not supported + */ + if (vlan_etype =3D=3D ETH_P_8021Q && !fsp->m_ext.vlan_tci && + fsp->ring_cookie =3D=3D RX_CLS_FLOW_DISC) + return -EINVAL; + /* Only ETH_P_8021Q and ETH_P_802AD types supported */ if (vlan_etype !=3D ETH_P_8021Q && vlan_etype !=3D ETH_P_8021AD) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers= /net/ethernet/marvell/octeontx2/nic/otx2_tc.c index 044cc211424e..d3498f3ecaac 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c @@ -604,6 +604,21 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, = struct otx2_tc_flow *node, return -EOPNOTSUPP; } =20 + if (!match.mask->vlan_id) { + struct flow_action_entry *act; + int i; + + flow_action_for_each(i, act, &rule->action) { + if (act->id =3D=3D 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) { --=20 2.25.1