From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A682DCD11C2 for ; Fri, 5 Apr 2024 07:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5SbqLNrzkWkeFEgcyNTw6ly7Q9RB7XQTrRjW9Px4CoM=; b=so1KHQIH8J/8Ws CAbS03X+1fe7gd0N+DNTHFvtyRRZPCuzitk1Lf4RmilG3YdXm2AXCS/4Tt9NUQBJy6iNgSoE8clP/ 6c3rPANbIoCeM3AfQ8665aaVSXPgtAzu6gyQTlGIPrCpVdJtDbg08LkMhjCoWpOGJkiLtwPcwhrV7 F4KO79FqH9yx35mIMNP0/aVlMp9xhlzvt7xcigo8tTVU9LnDaQYMmwRydEh5p9kGBaq/oXlpF3Zpw MSpmI2dabXikgWlC6PDLUIU469/E73HV2R4bzsknECyMluZdFcKawz6kNU2LE/pRBO0Fq0NhqaRhN wtcc+4aUP7aQrtd/EaAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rseGV-00000005jhk-2J7j; Fri, 05 Apr 2024 07:45:35 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rseGO-00000005jex-2lxn for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2024 07:45:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712303128; x=1743839128; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=hG/7WXbVHwPtjqKBcDc2XwtEgfdfo2i1v9NTvMXhAsY=; b=T8MgeepuB3qWpOsz4yqOt1vGRkVi+YDVepuQj7SHX+dXmuATbp/yDbAH o274Xe2qXdBIO1Hst/P7bBpTdhElxe3fLzHFK/4sFsvhnBvw9NYab/lTB H3ib5PxebXTfVbTqEDAm6mcF4yQgTxjsFi/wrwg64VHf9YB5bFt9jqSns EkWaG4rcUZI+qkzjTS94Isd8Rwo4/RV5v+3e5vjPJ5r8VZ8FHG+b/rvEs RKkippkBfKJC1hew8kjSyiU8c/ySzM/2KwesYPUVVm7s8ZW9xgdCdPARx r0JWElzhQ+0l6hVJlZY2fzj2gYw0YaKxLpDwzvgwnTtbrG4w95wvpOynu w==; X-CSE-ConnectionGUID: LnJ8QAI7QrCTf6/TR/LIZQ== X-CSE-MsgGUID: zx1E/0f7Tt+Tn7q5T9/slQ== X-IronPort-AV: E=Sophos;i="6.07,180,1708412400"; d="scan'208";a="19563251" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 05 Apr 2024 00:45:23 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 5 Apr 2024 00:45:08 -0700 Received: from DEN-DL-M70577.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 5 Apr 2024 00:45:06 -0700 From: Daniel Machon Date: Fri, 5 Apr 2024 09:44:50 +0200 Subject: [PATCH net-next v2 2/2] net: sparx5: add support for tc flower redirect action MIME-Version: 1.0 Message-ID: <20240405-mirror-redirect-actions-v2-2-875d4c1927c8@microchip.com> References: <20240405-mirror-redirect-actions-v2-0-875d4c1927c8@microchip.com> In-Reply-To: <20240405-mirror-redirect-actions-v2-0-875d4c1927c8@microchip.com> To: Lars Povlsen , Steen Hegelund , , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni CC: Ratheesh Kannoth , , , , Daniel Machon X-Mailer: b4 0.14-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_004528_886918_99B0A76B X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for the flower redirect action. Two VCAP actions are encoded in the rule - one for the port mask, and one for the port mask mode. When the rule is hit, the port mask is used as the final destination set, replacing all other port masks. Signed-off-by: Daniel Machon --- .../ethernet/microchip/sparx5/sparx5_tc_flower.c | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index fb2e3004183a..82dd270adae6 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -1038,6 +1038,30 @@ static int sparx5_tc_action_mirred(struct vcap_admin *admin, return vcap_rule_add_action_u72(vrule, VCAP_AF_PORT_MASK, &ports); } +static int sparx5_tc_action_redirect(struct vcap_admin *admin, + struct vcap_rule *vrule, + struct flow_cls_offload *fco, + struct flow_action_entry *act) +{ + struct vcap_u72_action ports = {0}; + int err; + + if (admin->vtype != VCAP_TYPE_IS0 && admin->vtype != VCAP_TYPE_IS2) { + NL_SET_ERR_MSG_MOD(fco->common.extack, + "Redirect action not supported in this VCAP"); + return -EOPNOTSUPP; + } + + err = vcap_rule_add_action_u32(vrule, VCAP_AF_MASK_MODE, + SPX5_PMM_REPLACE_ALL); + if (err) + return err; + + sparx5_tc_flower_set_port_mask(&ports, act->dev); + + return vcap_rule_add_action_u72(vrule, VCAP_AF_PORT_MASK, &ports); +} + /* Remove rule keys that may prevent templates from matching a keyset */ static void sparx5_tc_flower_simplify_rule(struct vcap_admin *admin, struct vcap_rule *vrule, @@ -1189,6 +1213,11 @@ static int sparx5_tc_flower_replace(struct net_device *ndev, if (err) goto out; break; + case FLOW_ACTION_REDIRECT: + err = sparx5_tc_action_redirect(admin, vrule, fco, act); + if (err) + goto out; + break; case FLOW_ACTION_ACCEPT: err = sparx5_tc_set_actionset(admin, vrule); if (err) -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel