From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3B43545BC0; Tue, 29 Oct 2024 18:19:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BAF25432EC; Tue, 29 Oct 2024 18:17:37 +0100 (CET) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id F0ED9432BA for ; Tue, 29 Oct 2024 18:17:22 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2105.outbound.protection.outlook.com [104.47.18.105]) by mx-outbound17-86.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 17:17:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vpzaMVb2E6I6shtuJMc8rGF0UlLRhReW4DVws/MX3HudJ49PDTlZvWomP+1GEcipFUwSOGRB2z/UUWlN/LvPXLdT5M+PLneQH3/e7GAGw24Earr0N+aHg5/1q4LWX5iOeBI+JjvHqp9ioJCphV6aDxTW4x0UqHHxAFFjYeNl7r3gHlyPE9tZt4/7OK/A70tANB9Lb+WmU/kEeMFYU8UpyRNRKLCduY9QmQHXsgj5NEDr0WRF94hflXFAU+sV0fUA0iDJv1ktc8cL0cQts7il3ZS4VJGsFtNtw7PHV/h0PelYrSxNsUERyDWYCKEU1I7+pTjce408D7T/cy8IiGnTtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=VRMA3QEqY1NYCmPyvRcsFmNBfC07QRnAz8Xbz20TvII=; b=jEhnf5p/rayHxrQYjUIIrkBNK4KQguvQ8WTo05UeFtY7dKd3WpmLcXdOOUM6dNbtC44n2HmKOm2BDK80dzmgqAW/MIIMUPDpTyhD2aLfSE3oLSUhJMRRsTjl+MMFMY/0ui4og8r/NrSuvsA3ABZ2CDpa8upMVWwMyO4mC73FuqsEal08qfW4tnTJYZnKQ/NInY8sHWbNR/L8RsFjDkZrcAKP6cfuSmJAlUlyDBrXR++OLt63g8h9DYdfe/6m53mX6Pk2IOIm+EVr8hXx6h7Idbacuu3rauFjc/L32qgS107ayCZO5EmAhWicylgA32ORwu2P3W391/W42tjyRx6ONw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VRMA3QEqY1NYCmPyvRcsFmNBfC07QRnAz8Xbz20TvII=; b=AxDjvmskROJMOfML7BwTWgwX3ewEUQb1NPyxQ2nqxWd6UlBthpfLLIofHGibV4/EdN3fKY5g1PXSiP1tsv2xhcGsMLELiX6ie9HVuDvJCqUvSUdS2H04MDS37QtlPK40HWKc1XEA2Ev05ju2v+8Zeq9jMfg40/RFk20D5kTbREI= Received: from DUZPR01CA0194.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::19) by AS8P190MB1061.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Tue, 29 Oct 2024 16:44:06 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::a5) by DUZPR01CA0194.outlook.office365.com (2603:10a6:10:4b6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29 via Frontend Transport; Tue, 29 Oct 2024 16:44:06 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Tue, 29 Oct 2024 16:44:06 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com, stephen@networkplumber.org, Danylo Vodopianov Subject: [PATCH v4 74/86] net/ntnic: add action update Date: Tue, 29 Oct 2024 17:42:18 +0100 Message-ID: <20241029164243.1648775-75-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241029164243.1648775-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D06:EE_|AS8P190MB1061:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 6f2ffb2f-0241-4b67-e58a-08dcf838e7a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?D5RL4MUSfPpE2WiyyABxJnATy0xEk947eb3Muijigc7bmS4eH3SeXbOwL2Ii?= =?us-ascii?Q?raRfae39mJF81esGqQH19wS+3vP+XJ/BRkJR0oGwyQih5NZUeiXMksSX+KgO?= =?us-ascii?Q?C3ZD8oKLMrmDoETJ9As0Pc/2iiF20j9bm5JzpPJPXrUUycAyanUnT6UYR/yf?= =?us-ascii?Q?5DQQl+Psbgsq2WJWckg0FeHX+NSu80FWJ0nIf7eky8X0tYVpnPnsdfcN2l1G?= =?us-ascii?Q?FrZaupydBajY6v3JXuO6rOt4h92mVjBbqJvy8MbtsAqsPlqHofI3aeuBNsAP?= =?us-ascii?Q?M5cT+AyUlZEg7VDbExoPRpe/UMrZtDphjFgTVDq4oeu5sPLZlGAa8zOg4Wxs?= =?us-ascii?Q?sw2OKLQ3ps47gww99zo/xGp8Sovcdv6ug43/8CeQdDto0ow1mfdSU2xSHzWY?= =?us-ascii?Q?uQatlAsljQ54EGp+aRr8Cf9VuKnL5D3WmIENRT/QKEuo+9PcQSzyuq4OO3JY?= =?us-ascii?Q?ZK8EHJoUyjo9NLPQcgl/TAHVUKYtYS6/f9ZN9CXoNy8ir2z3jiiQbLVhxCU/?= =?us-ascii?Q?eJ2Or1fH1Js14DnRXultvIZS3W/R2gKy84xvScvUNO6zpLAkFv+sBqnlBK08?= =?us-ascii?Q?np9Zo+2khzKezYkOzIGlHb3WqYfRX1N1pY0qiusBtizUmDl3l5loIQ/LTkxH?= =?us-ascii?Q?N974PsEualldaJwdK7xL8ymdXRA/u4sEolfhaZnVrAFAWXrGNDtvq941azaC?= =?us-ascii?Q?BqFvcuVUt0gnKmyC4XTD6w0q+XpGreE30MPZ+cV3PJlHvQtIsbu/hSsX3CdH?= =?us-ascii?Q?Jwl2axYQoFP4bCKZ6cpkX0i2T4gEq2LyRXkR2Y1h9NYyvrid5Dyg0o5O0U8M?= =?us-ascii?Q?U/X6dljoMWWVK6krG5UzbggJ7SmaoXL5kXbJPBpIZM37UovaA278OJy/dybp?= =?us-ascii?Q?kjMoAo3t/FRso2xl/sxMoQAYesdQrcnT+2ZHVUgGoo8H6cdvxPbwgkEdDOdW?= =?us-ascii?Q?FmrfS6OE7ZODA6QzvzPYJoduwzBj1B2dovsEk3Q+jnHz+x8uqjgGMglxTSEg?= =?us-ascii?Q?Ep6C3IJQvaYVp4AMpDvcF6/9RTXKxWuhSIhd79QFcNHdtFwwdn2Qzr8fDyyY?= =?us-ascii?Q?8TcUFkS53dBelNC0QF0Q+L9vBZu8c2NfctyRzggYMqbHP9BajC6A55aOY7yr?= =?us-ascii?Q?lUncrCSWKLL6I8O/7Ehs7TtKljnANYg+WdGIGJhBf63uFfmlY+LxSj/IwlBr?= =?us-ascii?Q?5xnh7mdVXHR/noFvyLW7W2gc/YN+CZylBTlI4l3lu8xZ6wgWs0tYwHBQlzxw?= =?us-ascii?Q?yPJeRepnsPZiu463YDvxHeJj2GuU+eAlwLTo0xBdCc9D0on8qJP0g5ZZCTa5?= =?us-ascii?Q?J0FQAAPlt+ystCjLlID3hR62tPs63OUaFBH1k4YSotiSn59tqill2xBfrUeD?= =?us-ascii?Q?7YjwlQTB1AgXKAMXgaQTjKXNiavL6UhImh5NSn/YlaY2OOqgOA=3D=3D?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 95USsvjnSBFtkT3t5/VimYj3+xpTFUChXdlMv6njAJcYTdFFipLIIHO909Kwp9yQsHEbUWSVDqBhUooCWzxtL/UlglDoUhogpMyewXncQNpieBcCGfKTnTYYqLgo2nCIp/K0ZwvIbpSP5YwMO3RvSObagTZOTTmpc26vy1avuETA7E693yriivuClD4/Z8wWX+Aqo6fSHcmyBXhnx5YTxKMGq4GOnLHYpZO7QV774NGRADgd7wllk+0La+voN3A38nxrFNIYyTnZoMsFUVdFF7DhJb5Z1kPGvwr57FBgswKH6HJH01aGWcyuuHB0SVLhuTElrVqG126VsmcxNfGUFWozGEHsLPidq9Yvczy91/Nq5hMHeUxrGyCiYY2Me/pfuV3h4nSSm/ufZ7bpYAz/suB+2C8DOi3zAnceE0xp/iFeUsbaXRJ9Z4BBxDIBdkwcbQt0A6Vl4+9zPD9KLVKuRmFL/c+S3sV+lRErx6F4WzsW8weF2n+tMvUs/Vt35PjGEgEIPMvHQVWMvLLwGC/IQWGwRVw6j0atl5fq9rCpMfAYsWLWbkpovAS9xP9ryBzd3kQIZCqt3ufWyTTRUSRl33Q+n1uzu3ZwjvJkzJX8p7jZKlbd1FIrw9kbf+T7fKVNae1eRRTa8KLwdgIsGSc36sDpx7LBemCnvWDD+vR6DF8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:44:06.4803 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f2ffb2f-0241-4b67-e58a-08dcf838e7a1 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P190MB1061 X-OriginatorOrg: napatech.com X-BESS-ID: 1730222240-304438-12707-32041-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.18.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViaGJkZAVgZQMDXNwtQgySAlzd wozdLSPM3U0izZ0DTFMjUp1dwwNSVRqTYWAGVTCQ5BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260064 [from cloudscan15-168.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Danylo Vodopianov rte_flow_ops was extended with action update feature. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 66 +++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 10 +++ 2 files changed, 76 insertions(+) diff --git a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c index 6d65ffd38f..8edaccb65c 100644 --- a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c +++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c @@ -9,6 +9,7 @@ #include "ntnic_mod_reg.h" #include "ntos_system.h" #include "ntos_drv.h" +#include "rte_flow.h" #define MAX_RTE_FLOWS 8192 @@ -703,6 +704,70 @@ static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *er return res; } +static int eth_flow_actions_update(struct rte_eth_dev *eth_dev, + struct rte_flow *flow, + const struct rte_flow_action actions[], + struct rte_flow_error *error) +{ + const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops(); + + if (flow_filter_ops == NULL) { + NT_LOG(ERR, FILTER, "flow_filter module uninitialized"); + return -1; + } + + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + + static struct rte_flow_error flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE, + .message = "none" }; + int res = -1; + + if (internals->flw_dev) { + struct pmd_internals *dev_private = + (struct pmd_internals *)eth_dev->data->dev_private; + struct fpga_info_s *fpga_info = &dev_private->p_drv->ntdrv.adapter_info.fpga_info; + struct cnv_action_s action = { 0 }; + + if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE) { + uint32_t queue_offset = 0; + + if (dev_private->type == PORT_TYPE_OVERRIDE && + dev_private->vpq_nb_vq > 0) { + /* + * The queues coming from the main PMD will always start from 0 + * When the port is a the VF/vDPA port the queues must be changed + * to match the queues allocated for VF/vDPA. + */ + queue_offset = dev_private->vpq[0].id; + } + + if (create_action_elements_inline(&action, actions, MAX_ACTIONS, + queue_offset) != 0) { + rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Error in actions"); + return -1; + } + } + + if (is_flow_handle_typecast(flow)) { + res = flow_filter_ops->flow_actions_update(internals->flw_dev, + (void *)flow, + action.flow_actions, + &flow_error); + + } else { + res = flow_filter_ops->flow_actions_update(internals->flw_dev, + flow->flw_hdl, + action.flow_actions, + &flow_error); + } + } + + convert_error(error, &flow_error); + + return res; +} + static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow, FILE *file, @@ -941,6 +1006,7 @@ static const struct rte_flow_ops dev_flow_ops = { .create = eth_flow_create, .destroy = eth_flow_destroy, .flush = eth_flow_flush, + .actions_update = eth_flow_actions_update, .dev_dump = eth_flow_dev_dump, .get_aged_flows = eth_flow_get_aged_flows, .info_get = eth_flow_info_get, diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 3fbbee6490..563e62ebce 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -292,6 +292,11 @@ struct profile_inline_ops { uint16_t caller_id, struct rte_flow_error *error); + int (*flow_actions_update_profile_inline)(struct flow_eth_dev *dev, + struct flow_handle *flow, + const struct rte_flow_action action[], + struct rte_flow_error *error); + int (*flow_dev_dump_profile_inline)(struct flow_eth_dev *dev, struct flow_handle *flow, uint16_t caller_id, @@ -401,6 +406,11 @@ struct flow_filter_ops { int (*flow_flush)(struct flow_eth_dev *dev, uint16_t caller_id, struct rte_flow_error *error); + int (*flow_actions_update)(struct flow_eth_dev *dev, + struct flow_handle *flow, + const struct rte_flow_action action[], + struct rte_flow_error *error); + int (*flow_get_flm_stats)(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size); /* -- 2.45.0