From patchwork Tue May 3 11:57:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12835675 X-Patchwork-Delegate: kuba@kernel.org 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 828AFC433FE for ; Tue, 3 May 2022 11:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234979AbiECMBm (ORCPT ); Tue, 3 May 2022 08:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234977AbiECMBb (ORCPT ); Tue, 3 May 2022 08:01:31 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80054.outbound.protection.outlook.com [40.107.8.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECFBE2E6A0 for ; Tue, 3 May 2022 04:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=heBnbI/SXQPfWw/HNUD6k7rZ42zNDFb65wain9Attu1ytsP5998GiH7xEkozbBZqWD5w+XFCGufjUwnapeNGvFjK9aYgcldibU9Se+DwilvaRuB0XrbS8AkWKnOdcWt/7OvPqTTO/tXHeDlpwyziNmHKkyUQAtqeApxAK6b9D31csNPzsQxlcMtM5BfAzBW+Zx8mIEsk/xfaxej47TwhSxb48AeYlNMyJaJtR3PUr6T49Yz3stzbr2OyalJmvgbzP4bZI15exgYhZgqPQzrE0eKXBycye7OgACy5sAvYMr/Nzi73JOiGRWbSwn4LovV5EoaTBRG8+RJkxX2Jq+hWJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OISQ4WW5Wt5BjgCvi3n7jql5wEL6vqi3Eil0dqImHU4=; b=c9GVLVvkF/+vN+O3WCe/1wxsMK7sZmW8rDQsgClksqahDDVclMGvL6mv9L3tX8RibAcwuXegXiS9CY0H7YQc2tJ5MSocWZwp4Nh3AVXPS730DoV3Z5trmLKJy1hgOmiLkm1GNFbJjcNwnJ9SVVI1zWgXvsvtp3o9vb+NptXZ/K8W60pmcv4bu8msPjMJaQ/mroUUV3KTgkceXnV0EqeVu4bHHxPXfr/TpBfVX3YDy0gV9aDitx7D03u+2zMOUR7FqElG+8MNCvxr2ZGpCcbIx41M3lA9l/6NN2R3txf6951rKdoW2T9qhMp0EHtETWwEq9lsV1azAGP4+82M7G3GdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OISQ4WW5Wt5BjgCvi3n7jql5wEL6vqi3Eil0dqImHU4=; b=A37fgD2KL/Sy8BPyB7L6Dp3zj4f4guK0yl/pxwnMpV5MX8HIfzy1Cerk7UZM5OgfL9eAqWCRjghmQ2djtKPk6eZRu1ZsT953tSiz2yfksCH3FNJGVAeWP+h6wMTfFkYg67PDEcF74yDq95v2h2CiBDXS4rq2AKAoXgny+tUvDic= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB5121.eurprd04.prod.outlook.com (2603:10a6:208:c1::16) by DB7PR04MB5513.eurprd04.prod.outlook.com (2603:10a6:10:88::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24; Tue, 3 May 2022 11:57:56 +0000 Received: from AM0PR04MB5121.eurprd04.prod.outlook.com ([fe80::d42:c23c:780e:78eb]) by AM0PR04MB5121.eurprd04.prod.outlook.com ([fe80::d42:c23c:780e:78eb%4]) with mapi id 15.20.5206.024; Tue, 3 May 2022 11:57:56 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , Paolo Abeni , Eric Dumazet , Florian Fainelli , Vivien Didelot , Andrew Lunn , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Xiaoliang Yang , Colin Foster Subject: [PATCH net 5/6] net: mscc: ocelot: restrict tc-trap actions to VCAP IS2 lookup 0 Date: Tue, 3 May 2022 14:57:27 +0300 Message-Id: <20220503115728.834457-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220503115728.834457-1-vladimir.oltean@nxp.com> References: <20220503115728.834457-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1P190CA0009.EURP190.PROD.OUTLOOK.COM (2603:10a6:802:2b::22) To AM0PR04MB5121.eurprd04.prod.outlook.com (2603:10a6:208:c1::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 12855711-2fce-4d97-c077-08da2cfc2991 X-MS-TrafficTypeDiagnostic: DB7PR04MB5513:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4PF3zmxDUB1KpBEr7YCWdjw4W1D/hPTgWKhFctfTUzLkX6VoDTxSfrwnZZzaYFG85RWNDfgg8nwU17hvZH9zU122PvXNy7Da21oHwtriKbP5XyDbB/uCHgA2T7s6SnhsHytfAKCPoIAzA07qvAu4Mz4SnDmQx/5hJRcuNLXEfm3CqXTn7fwudGqP6JTQ+TiklxqfK0JWQaY8poAcKHIIGQEi7sde0eG13KqDA1WO8sKkRvcpGzCZIjNT0Wf3d3LJk02EhO3/W5JiJM6yOSynpnvC5TiXOjw/T6gSGJ/O4eNgWi1DZsZo94vPJ40VC04gvZDIo9wjwx353wRg/pXWNw6vRG3dwzM6X0i6uHhXzpjVM+lf++cYInCkOVwkZWNZZkp228XaPrkzDaaJp1u1UXOsxZ1h+yUEAI8bDlVPlPDnnpgpYMnfLEyEh2XEz/LlaSdoBcPxuMSDWrn6dB2Akwh3jpRgd1n3XTUPi8no7AIyWcqMlIxCaQT4sSPLGekJVndSKifzmBggOVC7lqlt6g13YmD+RVzDiiYv5MtzjREnrzOhRVXla/xmF3uC7Q3LXE0wC+wzh+WlB+yx0AeRBV0Ln+Zy78Ab4Nqab4ySfbKnb1Z2lphX84nZa6BFaIwDRYu9NOuHqRK5XE1glOvKWaUp8gdlxHc8/1H8HF+ZxkwUAth7a5wOyBdG94l3tjAERNdI5vVdDBKxaybA0SeHyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB5121.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(52116002)(26005)(6512007)(6506007)(83380400001)(2616005)(186003)(54906003)(1076003)(86362001)(8936002)(4326008)(8676002)(66476007)(66556008)(66946007)(6486002)(6666004)(2906002)(316002)(7416002)(508600001)(5660300002)(44832011)(38350700002)(38100700002)(36756003)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tuS1wkrzzjw1xSWQjDSHRfJUYoye/lrfAIANAKCeGPdazXyDpZqixWFaRzRqtwJL9SHQj4/ewAQpFtDm/5tegWhh5bYaZSU7su/l8iTkyL1Se0mjwLEvQIqsRcGLLlCY12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jY1ud1w3dJlZdqdOwURa+xfDx2ftQE1eMYtNMA0c4rAuYa1ysCC+ZuwLkdRkecfOWb41mhkrL5xKLfmhuiJPjuP/MjrAVN99p7b8fRk3Xo7PFt6uWNarzA524LxnreujKJXumOANSOoFk3vgv0KG4SoxgRYpcVcQgtydO/HXX1TgnasjS5BZNDW2RXAX9xJtz/bGS6uTqjL6/+mx3on6QN9F3/mmZpHszLGT41EjFcI7SIuN+jIpgA5XyYC4yNDb6w5608rg/abKoK1vJxoFzMaZDVnWBnbLH2gApWZSXm9RRbjFyVK51/Eq2HN52PUpSp2pq+45ozZeVoPWA/3qph73Up1TLTe02bozrHvFsZd2lPWo0T0H0r1S9+50a45D18wbfK9fd1/WTShJrqCuV2jDn20ZsHQp1QCTTuj0EPTAcjuvE/q3eHnUB1uykg9OkmO0g/PRKSs+kJYlt0sS3HaisAAqj669saM/YKNPqJf739bI1smxSpHPVPF125Il6eRKS64vIbJIItMP1Us8LE5YRZyDww5wjsU2KPvjNKXOBs= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12855711-2fce-4d97-c077-08da2cfc2991 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5121.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2022 11:57:56.8863 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TjKtipX74NQQpFauWH0J6ECOQv6y/VABBFiWFr1OILnALh7g4tHyiLRY2WCkSiHnxtq/9KqZedMqavrGaiHYGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5513 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Once the CPU port was added to the destination port mask of a packet, it can never be cleared, so even packets marked as dropped by the MASK_MODE of a VCAP IS2 filter will still reach it. This is why we need the OCELOT_POLICER_DISCARD to "kill dropped packets dead" and make software stop seeing them. We disallow policer rules from being put on any other chain than the one for the first lookup, but we don't do this for "drop" rules, although we should. This change is merely ascertaining that the rules dont't (completely) work and letting the user know. The blamed commit is the one that introduced the multi-chain architecture in ocelot. Prior to that, we should have always offloaded the filters to VCAP IS2 lookup 0, where they did work. Fixes: 1397a2eb52e2 ("net: mscc: ocelot: create TCAM skeleton from tc filter chains") Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_flower.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c index b8617e940063..e598308ef09d 100644 --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -280,9 +280,10 @@ static int ocelot_flower_parse_action(struct ocelot *ocelot, int port, filter->type = OCELOT_VCAP_FILTER_OFFLOAD; break; case FLOW_ACTION_TRAP: - if (filter->block_id != VCAP_IS2) { + if (filter->block_id != VCAP_IS2 || + filter->lookup != 0) { NL_SET_ERR_MSG_MOD(extack, - "Trap action can only be offloaded to VCAP IS2"); + "Trap action can only be offloaded to VCAP IS2 lookup 0"); return -EOPNOTSUPP; } if (filter->goto_target != -1) {