From patchwork Wed Apr 3 18:41:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13616592 X-Patchwork-Delegate: kuba@kernel.org Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B022015359C; Wed, 3 Apr 2024 18:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712169737; cv=none; b=DUzcbyx1yOtDFaRnmTQ2scqgNFQysg2SCHlMgU0zHgOY/JhCXDWiwF/x7d7Hgr0DCJjDPv8CJGbsTZ1QHEphHv/IkaPAO7anwiBYePW2L58mrQL5zom6IYVyC+4ehsmpu+z6bVZOYaFQQJIsYOMGr/3N+adht0evpEP2lbqzatM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712169737; c=relaxed/simple; bh=otSGrqELwfG2u5gWiiACNPA1KqM19QjHPY37cn0Pw7M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=oC1mKRUdmqB7KI39VyE1dUokK9ao8L2MU9JvWrNIrsifVrXRCF0VlwolZ8lkgA+eHKdt84svxawETM8WZJqCPrBQNyEizWF2A1w8vZt63zL6HvUw2HPjTvO5dZQmX1I9Gr3wioWBNS+OTOhCxhUlOZa8tQkK216vG47Y2fi5DQk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=YLnKeusc; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="YLnKeusc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712169734; x=1743705734; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=otSGrqELwfG2u5gWiiACNPA1KqM19QjHPY37cn0Pw7M=; b=YLnKeusc6bhryot9ig0m0Uf2mTNB8GleLy6x7VtZJwXcCvTJV9gUYq8m CtVgH/E6h9h8uX3Nfx92IOV8CgAX16/qM7P0heedakn2JhmbCw/Nk8sPg CSK/HXb8fJz02ZHr9gJ2dBTRZO/tid+20HOW+HnrhB5F10y8C09F2LWtS vRqAHXaDeLE9wZGblp1mLJ9jzEqPrQgBtUBaOqKCPWKoAFxVP+5e4ygI9 BR+V3r8dWEQ8qCzJK4usfdU1y+jdk/U6CzB4vd06T0NfmuQ9XFxZ7iOsX vCfit90nEr3l5B3palHz88VjI4nGp7apT3tsE1hC2hMdDpmwwS2tISsuK A==; X-CSE-ConnectionGUID: S7G30frMRjS4zHdERZ8jng== X-CSE-MsgGUID: zGSWXMK5TQOOroPrNouTCQ== X-IronPort-AV: E=Sophos;i="6.07,177,1708412400"; d="scan'208";a="21259575" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 03 Apr 2024 11:42:13 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 3 Apr 2024 11:42:10 -0700 Received: from DEN-DL-M70577.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 3 Apr 2024 11:42:08 -0700 From: Daniel Machon Date: Wed, 3 Apr 2024 20:41:42 +0200 Subject: [PATCH net-next 1/3] net: sparx5: support 72-bit VCAP actions Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240403-mirror-redirect-actions-v1-1-c8e7c8132c89@microchip.com> References: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com> In-Reply-To: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com> To: Lars Povlsen , Steen Hegelund , , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni CC: , , , Daniel Machon X-Mailer: b4 0.14-dev X-Patchwork-Delegate: kuba@kernel.org In preparation for supporting tc flower mirred and redirect action, extend the VCAP API to support 72-bit wide VCAP actions. Signed-off-by: Daniel Machon --- drivers/net/ethernet/microchip/vcap/vcap_api.c | 12 ++++++++++++ drivers/net/ethernet/microchip/vcap/vcap_api_client.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c index ef980e4e5bc2..80ae5e1708a6 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c @@ -2907,6 +2907,18 @@ int vcap_rule_add_action_u32(struct vcap_rule *rule, } EXPORT_SYMBOL_GPL(vcap_rule_add_action_u32); +/* Add a 72 bit action field with value to the rule */ +int vcap_rule_add_action_u72(struct vcap_rule *rule, + enum vcap_action_field action, + struct vcap_u72_action *fieldval) +{ + struct vcap_client_actionfield_data data; + + memcpy(&data.u72, fieldval, sizeof(data.u72)); + return vcap_rule_add_action(rule, action, VCAP_FIELD_U72, &data); +} +EXPORT_SYMBOL_GPL(vcap_rule_add_action_u72); + static int vcap_read_counter(struct vcap_rule_internal *ri, struct vcap_counter *ctr) { diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_client.h b/drivers/net/ethernet/microchip/vcap/vcap_api_client.h index 88641508f885..56874f2adbba 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api_client.h +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_client.h @@ -200,6 +200,8 @@ int vcap_rule_add_action_bit(struct vcap_rule *rule, enum vcap_action_field action, enum vcap_bit val); int vcap_rule_add_action_u32(struct vcap_rule *rule, enum vcap_action_field action, u32 value); +int vcap_rule_add_action_u72(struct vcap_rule *rule, enum vcap_action_field action, + struct vcap_u72_action *fieldval); /* Get number of rules in a vcap instance lookup chain id range */ int vcap_admin_rule_count(struct vcap_admin *admin, int cid); From patchwork Wed Apr 3 18:41:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13616593 X-Patchwork-Delegate: kuba@kernel.org Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06A2F153BD6; Wed, 3 Apr 2024 18:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712169740; cv=none; b=sA3m4VWlwOkNjkB75CGRK8QG3MhNl7r03Kn4AFrFRN8o9wu+RgypPxNFVG491p0ob67Hx6gVy+6vvCDPEJ2vtpIvPaNLGpxs9xuuAazG1ENe/sqx7NGR8I3jfFx1DVCpx9tfl6AtYp6819qbvABU/IoGMweDq0nHaOA3ii4eBhY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712169740; c=relaxed/simple; bh=0BQfTNJh7WCqTooxO5jQh9nq8Nvly6zUvYcfVjQ186M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=QqOqa6nLke4LFrOVJs6BUmxpHvVzMBd5jSrUigD7HkoqOOJDusMpwZKRrTiZkOXKJ9eZiKgF0S7an/EylZyH9mUdaIa3ZJwQD8Df1pUB7aUSktq0ho/6kZUSdGnpmvsNFQL+FUO2oj9MNljpQKhHGhDzf8cyLzHGZ2/CNs4RW4o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=b/byF7Lx; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="b/byF7Lx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712169737; x=1743705737; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=0BQfTNJh7WCqTooxO5jQh9nq8Nvly6zUvYcfVjQ186M=; b=b/byF7Lx2yJkEBXIeIhFt6D70ituv07OKtBmnnraxqRQbwaz2lO/X4lk 8TwbFn/nSaN3FbbPlx8Cb0XKNV0+B8Y9+ovwvq8lEAtxguRws/nuhJZ9+ jFlHHvWwbT9L3J4K39yO/uI7EDyR4JpRViETb+oT2eZ0AQCrIumOJnkF4 TQC3bPRbD+45m6tShzZ4mCvpmdMIbYwrViJq8nBb+lOKpgsHS6JPiTIAW YEyvba6OkZtoEvyt23acjy+51gPyCQ4EpkHUYEJlnM6tSLcEi+zUD4eKb EtSGLzoJDl6co/pR+HNrIWoLiMPX/WZ6nZYO1y+T+Juke3wS8ROW9e2hO w==; X-CSE-ConnectionGUID: S7G30frMRjS4zHdERZ8jng== X-CSE-MsgGUID: Gp10ytTDSTaEhG2Ch+jTtQ== X-IronPort-AV: E=Sophos;i="6.07,177,1708412400"; d="scan'208";a="21259577" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 03 Apr 2024 11:42:13 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 3 Apr 2024 11:42:12 -0700 Received: from DEN-DL-M70577.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 3 Apr 2024 11:42:10 -0700 From: Daniel Machon Date: Wed, 3 Apr 2024 20:41:43 +0200 Subject: [PATCH net-next 2/3] net: sparx5: add support for tc flower mirred action. Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240403-mirror-redirect-actions-v1-2-c8e7c8132c89@microchip.com> References: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com> In-Reply-To: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com> To: Lars Povlsen , Steen Hegelund , , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni CC: , , , Daniel Machon X-Mailer: b4 0.14-dev X-Patchwork-Delegate: kuba@kernel.org Add support for tc flower mirred 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 destination mask is OR'ed with the port mask. Also add helper to set port forwarding mask. Signed-off-by: Daniel Machon --- .../ethernet/microchip/sparx5/sparx5_tc_flower.c | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index 523e0c470894..a86ce1f8f3e5 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -1004,6 +1004,44 @@ static int sparx5_tc_action_vlan_push(struct vcap_admin *admin, return err; } +static void sparx5_tc_flower_set_port_mask(struct vcap_u72_action *ports, + struct net_device *ndev) +{ + struct sparx5_port *port = netdev_priv(ndev); + int byidx = port->portno / BITS_PER_BYTE; + int biidx = port->portno % BITS_PER_BYTE; + + ports->value[byidx] |= BIT(biidx); +} + +static int sparx5_tc_action_mirred(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, + "Mirror action not supported in this VCAP"); + return -EOPNOTSUPP; + } + + err = vcap_rule_add_action_u32(vrule, VCAP_AF_MASK_MODE, + SPX5_PMM_OR_DSTMASK); + if (err) + return err; + + sparx5_tc_flower_set_port_mask(&ports, act->dev); + + err = vcap_rule_add_action_u72(vrule, VCAP_AF_PORT_MASK, &ports); + if (err) + return err; + + return 0; +} + /* 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, @@ -1150,6 +1188,11 @@ static int sparx5_tc_flower_replace(struct net_device *ndev, if (err) goto out; break; + case FLOW_ACTION_MIRRED: + err = sparx5_tc_action_mirred(admin, vrule, fco, act); + if (err) + goto out; + break; case FLOW_ACTION_ACCEPT: err = sparx5_tc_set_actionset(admin, vrule); if (err) From patchwork Wed Apr 3 18:41:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13616595 X-Patchwork-Delegate: kuba@kernel.org Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28892146D62; Wed, 3 Apr 2024 18:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712169770; cv=none; b=aP2ryVp792LUYKtHvHncZJFqj5k0gjvLmZkkw6w95sDZxgrmVdAGe6Cy3wCYcwPtjeGIgMs6yG2/pcJ741oRxllOl30jgKkuMn7t7tDON6YNxLwsdBiB+jXt/DLxhKwVSYDXqsbxIBZ+rs+4eQ1idCkPhtk25tqCmk04lMAyI6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712169770; c=relaxed/simple; bh=g9OGTjriFjC5okqqsdE43uxvtzt0NrohNgdOIFqLUPc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Pt8vfiu512NAdhFd59c2pMfnmIzxRwCNwwrDeB1KpvVHn1bY7XronKDK5TI6QdTGI0I4/1yfMQSPrc8Z5mcFfbWokfd4TvPCnfUIMry4RQrvZ67eaNjF0ukX4eDUOaFUeoHQnS+RXyBJCDPsmKZY+wDHKA2nV3AwPssSNoXbJIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=pYr8Vq9v; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="pYr8Vq9v" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712169769; x=1743705769; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=g9OGTjriFjC5okqqsdE43uxvtzt0NrohNgdOIFqLUPc=; b=pYr8Vq9ve23Kd4NzOdN3PxsKUWZ2eLfX70rdBTBYMuj5NBC26ZMSKHjQ yuCW2NAeyO1uJV+YpSQVF2u2cwbyyf5Z3B8Pda5yeVbIYunxf0OWoRFAM rCPqT5AZ4toxLoliGGygEdrSyc4IHKQEQD0wAe8EBY9k/7c0aa5LI3iJr 7z4sKO4GpWVlC9cim9z2PBPg9lfhvz4VD0bItM4QWrJBHG4eM5gM6YdKi GAdqx7ViQnd27x8XgTDENoJG6ULf7Z2R0nWnIQ3lLwkckB7Qn6dGqkcVM 0UuHGqsyeVOqtPLPk8pbG7aUptWT2xayBuaSvThTtU9LFLBh88QQ8+xvd g==; X-CSE-ConnectionGUID: By3oU9PeTtGY31IsBtby0Q== X-CSE-MsgGUID: roZiApLfSA2APbX12J9Lhw== X-IronPort-AV: E=Sophos;i="6.07,177,1708412400"; d="scan'208";a="21259638" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 03 Apr 2024 11:42:48 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 3 Apr 2024 11:42:15 -0700 Received: from DEN-DL-M70577.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 3 Apr 2024 11:42:13 -0700 From: Daniel Machon Date: Wed, 3 Apr 2024 20:41:44 +0200 Subject: [PATCH net-next 3/3] net: sparx5: add support for tc flower redirect action Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240403-mirror-redirect-actions-v1-3-c8e7c8132c89@microchip.com> References: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com> In-Reply-To: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com> To: Lars Povlsen , Steen Hegelund , , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni CC: , , , Daniel Machon X-Mailer: b4 0.14-dev X-Patchwork-Delegate: kuba@kernel.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 | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index a86ce1f8f3e5..0df8724251a0 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -1042,6 +1042,34 @@ static int sparx5_tc_action_mirred(struct vcap_admin *admin, return 0; } +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); + + err = vcap_rule_add_action_u72(vrule, VCAP_AF_PORT_MASK, &ports); + if (err) + return err; + + return 0; +} + /* 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, @@ -1193,6 +1221,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)