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 6933B45BCC; Wed, 30 Oct 2024 23:15:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 551D443400; Wed, 30 Oct 2024 23:15:58 +0100 (CET) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 7231043400 for ; Wed, 30 Oct 2024 23:15:52 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2174.outbound.protection.outlook.com [104.47.17.174]) by mx-outbound11-85.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 22:15:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wxTOWGhBowff5T5U1e4nHBjnTrhBSmIkkfGC/cu2a2EeDwKMx60RyYjJMxHtoOLGS4q8S30sQeylPy7ebXot5A+47v55FXpKL/sRrXm/oL98wRqtMfonY9/05pxJ9zRI+Q0rFUCVFEswfTZAQ9LdGvd/ipA+ImEJURrwmXYoQYMM9wO3D2UbVcJWbB11YNNGLsAFLSWAtmG6UegMswc6hdnX5WpfYhYjSAB5bd4RefAlNbHt+yRScSxZlZG6HtV8YISsIksGa9YxmwKPwVTDfw4bKn2OOI1MrVIct8eJ4BlqAoKbDIQwhvP4VqFGAX9cu9S+21tt/UpJELlJkCRQGg== 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=kbUMOM9xYGg1D2KW1DtthqDrxO9BVzw8RWO31TTZoiQ=; b=E70R/zQ9/DngPePY/ECmJR/e5+8NdDEQSTN+sJydsUKYwdursk8lX6XhCAeG5aW1zCkxxJeT3Da7iSm3dBwGzrKKrPqAgMPgubL0BbifZwehNlsqwFr4Q9zI0zbUdFfQVXlzDFcgI5KGS0eW8ZqzWNayDcU2gbdzQoGFgBgcw0Ejx8LjUNHX+j5s60Zqz8SLn/M/JsOn+ytee866CWt3J2tJBVhcKovqnE+LiynqIL9ELmUw6r9bs6szvdooTnV+B6oh3VnlF7UPDFSB/xXBSuI5EzxrFGv8gSbP2Wnn89JJXTsK0OmYmEzoonJJHt/JEDq62QZLA1ehNZYKWAje0w== 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=kbUMOM9xYGg1D2KW1DtthqDrxO9BVzw8RWO31TTZoiQ=; b=VL5Fbu+FTvQhaQa6cWVpuHPKPHqbJHhwhIAexSEkL8OYnj+MmQwTY8AV0TzamY6fWgOdjBzfKLYZ8lRpRaYlEMIjMV6Y04YHju/lM4Cdz73IoW0r7anwr2oko4SvJO8FsqlIaiXnXlEhcYtny3AJ8kj0v68hZljPh76w3bjXFA8= Received: from DUZPR01CA0006.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::13) by GVXP190MB2094.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:1b5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 21:41:04 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::4) by DUZPR01CA0006.outlook.office365.com (2603:10a6:10:3c3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Wed, 30 Oct 2024 21:41:04 +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 DU2PEPF00028D13.mail.protection.outlook.com (10.167.242.27) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Wed, 30 Oct 2024 21:41:04 +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 v5 73/80] net/ntnic: add flow actions update Date: Wed, 30 Oct 2024 22:39:20 +0100 Message-ID: <20241030213940.3470062-74-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241030213940.3470062-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241030213940.3470062-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D13:EE_|GVXP190MB2094:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9bd085c7-8026-4b04-973a-08dcf92b8e5e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DppF+8v0as9RbWdJLsbL592Zg2GSF4Ns5rIxHuSCY212Y3unuxWrxpw+T1ps?= =?us-ascii?Q?6uWU+M97oGeTVexsmzpANoEIZpQLPQQdZc25Q189YrM2wRY8fcZC3BGYJB33?= =?us-ascii?Q?IgmhvQkGHa6XP/oXK1EVjTZPEbnp5gg1fEDCkl+ahdcE7LaXpqPGkLSL8Svi?= =?us-ascii?Q?8X58lEtu2sW+IDd9EArieogjKeXycICSSc2t8so5Tiyxsb6K+6pxQ6LvbPry?= =?us-ascii?Q?7k7rVBQhJfiHn4c8HpEkfZBvnlCqSRGqiOEiimZIg+9doZeztgTXL65zG8Gl?= =?us-ascii?Q?56FQinwJ8NNH3V1xuOP623pCmoBipv9MJaxJ4iTOS+bD0DoDu+firemzDLH3?= =?us-ascii?Q?Yhwjrls3E2StRCfwTkonxRK3plFGCQGAGGnrqxuUbBNW3sKo4NzjNAlXruxh?= =?us-ascii?Q?FskSDmG7YsJ3gs4jfrsMZgZkmwndCrZ/6QmLk8D37d4QH1mKvxXhlJcvhwEi?= =?us-ascii?Q?Sq66cVOLocLAMHbeUvNRYBbH2aNgyGkv/jrl+9spyApWwbquPshN5n/R8QBn?= =?us-ascii?Q?8IhixjFXUCziahLFiXlSyd98GlDVzfvv0xEFuDpiJ+kTzX3obdxpSCgbssbm?= =?us-ascii?Q?QYi9XytWNd9xc1Zqb58+dQM8cXcQzykhkZMao/uWDuoTy+zVSMsvw+ZDLmDZ?= =?us-ascii?Q?CCGYkZUpe3h6eOtvO92rpVf8AglXi1cdlI4iXXcvHXZRhsOwFA0FVB8Y+Eq5?= =?us-ascii?Q?+Y+kRtIsV0SgeHv3ksUWAKoWnjoIiIxk+NQibuaxz/VRolWvtecVlVg85bmd?= =?us-ascii?Q?L8tuVlJREZtB+dCxqkSUuRepxLL3Q0o8Nad6w2DsH0HQ1CgiIlAOWMoe9qWU?= =?us-ascii?Q?wozp1lhLfrBy2HDd0I55sWvSLQysIKfflTIWwi3xKhO3xA7JBj1mD2oi7XlA?= =?us-ascii?Q?XD9Vids2veC4yJj9AoPXnYx3Rb76k/nVNkvc5DnSfJ7iZT99T+BCG3X17QmU?= =?us-ascii?Q?+xf/D3H/83NJgwatN3H3zYDkno/Hp5P0olaOGVKYn0/EExnVA8hieMS6Bnaz?= =?us-ascii?Q?6jyVyne0uSLy7+sSd/4BZ+E8BVWm3Jx5JX7ebEeF3QpsBmYDxJdx+9fW20hI?= =?us-ascii?Q?hHJvoxPueqvbU2a4TCEIAR8F4QHF5yhkxHaz0vBjwSlbSck3/HmfxAar5yi0?= =?us-ascii?Q?13tQSd5eAbfRrKzmpcQErsqFFw1GybHTWsGSf6Jc3ZXGEBg30HIvwFenjnpd?= =?us-ascii?Q?+Fccybim+s6w4ws0CnU8cw6NGisUcCzfTJ98AOFLRgjjCYtcu5XCYhfvMZta?= =?us-ascii?Q?Nnk8ISlWYP6Y4Jm9MFh1JNsnOTJqCY+vLEPCMhmVr46c9ro0VWlDgDiuc6GT?= =?us-ascii?Q?pLMZaSyvXgQqy765btY/gG7/1+RH2B/a0lUXrMRHzpzhuC2igC5OQtJ+ma0l?= =?us-ascii?Q?G3bAupQimre6NHC1Aeuuz8ITnh6Rm5DfwZ1AbcVg5JbCnMTU8g=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)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HDDFAy+0uWZDsxhbFt9CAa5v26sd5nurySq2w7jjDz/6hcCQpLiYqM+W+Q6tPg98H6iLatKjtDht+Sp+hnUg6f7GDwxSFyDnwimoasr01fNlhjzJATIs015f0d20WSvDrvcjfrdWLLJGzrPYTXYSpUgzGKnhyNCq2iVJwu8AvwsxZIjmTIifdkKjgCH+yDxnrrN/erZdwVaijTGg5sB3EiKq4cRvBQOwUFRjJpZZ8WTIeRRMNrgAo/Pa1rXOYx+8NOdaowIr3Mf2DG/MPYvebsBkueVIQXQS7cruNEYY2U8RXur0JOYqFFD5cH8jkxSvsPCDhAqEVeXdsUaMHWfnelhLjseni0UCbAgmPPi/PB9bcgRDPvh12jPmwaRBp6SjtMGZPNcK5Wm1m+L4rre1YaDrI+h6yaqf8KPcFsfcPeZYLKL837mEpE1V5JeoHeJwJIb1aPRyp5d32zaTdGl02UQBtouUq3l78vflDLBQEywnTSxuALZfo/h2tz8v0hlxd+VSaFwIq/Lf3H50o7DE4lWuAGH9wexz2y9nebGHVs0rvb6e/Wh8TKsOj9VhRDIgdo3CjOstLBV0JZB549PIqARLYuipjYYWg+VvVfzAjK7dbqthAaQz4Gc9CuoAamYwZKKMH3/rcyqMgHIrd+tO8dJOeo1F267WWU5PoencP9M= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:41:04.4116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9bd085c7-8026-4b04-973a-08dcf92b8e5e 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: DU2PEPF00028D13.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXP190MB2094 X-OriginatorOrg: napatech.com X-BESS-ID: 1730326549-302901-12792-44830-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuaGBuZAVgZQ0CIt0SjNzDjRMi nRzNjI0jDVIsnEKMUwJdnMyDw5McVUqTYWAOI8qllBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260092 [from cloudscan16-249.eu-central-1b.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 Flow action update was implemented. Signed-off-by: Danylo Vodopianov --- doc/guides/nics/ntnic.rst | 1 + doc/guides/rel_notes/release_24_11.rst | 1 + .../profile_inline/flow_api_profile_inline.c | 165 ++++++++++++++++++ 3 files changed, 167 insertions(+) diff --git a/doc/guides/nics/ntnic.rst b/doc/guides/nics/ntnic.rst index bf5743f196..afdaf22e0b 100644 --- a/doc/guides/nics/ntnic.rst +++ b/doc/guides/nics/ntnic.rst @@ -69,6 +69,7 @@ Features - Flow statistics - Flow aging support - Flow metering, including meter policy API. +- Flow update. Update of the action list for specific flow Limitations ~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index 76d5efc97c..735a295f6e 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -166,6 +166,7 @@ New Features * Added statistics support * Added age rte flow action support * Added meter flow metering and flow policy support + * Added flow actions update support * **Added cryptodev queue pair reset support.** diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c index 189bdf01d6..aae794864e 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c @@ -15,6 +15,7 @@ #include "flow_api_hw_db_inline.h" #include "flow_api_profile_inline_config.h" #include "flow_id_table.h" +#include "rte_flow.h" #include "stream_binary_flow_api.h" #include "flow_api_profile_inline.h" @@ -36,6 +37,7 @@ #define NT_FLM_UNHANDLED_FLOW_TYPE 1 #define NT_FLM_OP_UNLEARN 0 #define NT_FLM_OP_LEARN 1 +#define NT_FLM_OP_RELEARN 2 #define NT_FLM_VIOLATING_MBR_FLOW_TYPE 15 #define NT_VIOLATING_MBR_CFN 0 @@ -4381,6 +4383,168 @@ int flow_flush_profile_inline(struct flow_eth_dev *dev, return err; } +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) +{ + assert(dev); + assert(flow); + + uint32_t num_dest_port = 0; + uint32_t num_queues = 0; + + int group = (int)flow->flm_kid - 2; + + flow_nic_set_error(ERR_SUCCESS, error); + + if (flow->type != FLOW_HANDLE_TYPE_FLM) { + NT_LOG(ERR, FILTER, + "Flow actions update not supported for group 0 or default flows"); + flow_nic_set_error(ERR_MATCH_INVALID_OR_UNSUPPORTED_ELEM, error); + return -1; + } + + struct nic_flow_def *fd = allocate_nic_flow_def(); + + if (fd == NULL) { + error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED; + error->message = "Failed to allocate nic_flow_def"; + return -1; + } + + fd->non_empty = 1; + + int res = + interpret_flow_actions(dev, action, NULL, fd, error, &num_dest_port, &num_queues); + + if (res) { + free(fd); + return -1; + } + + pthread_mutex_lock(&dev->ndev->mtx); + + /* Setup new actions */ + uint32_t local_idx_counter = 0; + uint32_t local_idxs[RES_COUNT]; + memset(local_idxs, 0x0, sizeof(uint32_t) * RES_COUNT); + + struct hw_db_inline_qsl_data qsl_data; + setup_db_qsl_data(fd, &qsl_data, num_dest_port, num_queues); + + struct hw_db_inline_hsh_data hsh_data; + setup_db_hsh_data(fd, &hsh_data); + + { + uint32_t flm_ft = 0; + uint32_t flm_scrub = 0; + + /* Setup FLM RCP */ + const struct hw_db_inline_flm_rcp_data *flm_data = + hw_db_inline_find_data(dev->ndev, dev->ndev->hw_db_handle, + HW_DB_IDX_TYPE_FLM_RCP, + (struct hw_db_idx *)flow->flm_db_idxs, + flow->flm_db_idx_counter); + + if (flm_data == NULL) { + NT_LOG(ERR, FILTER, "Could not retrieve FLM RPC resource"); + flow_nic_set_error(ERR_MATCH_INVALID_OR_UNSUPPORTED_ELEM, error); + goto error_out; + } + + struct hw_db_flm_idx flm_idx = + hw_db_inline_flm_add(dev->ndev, dev->ndev->hw_db_handle, flm_data, group); + + local_idxs[local_idx_counter++] = flm_idx.raw; + + if (flm_idx.error) { + NT_LOG(ERR, FILTER, "Could not reference FLM RPC resource"); + flow_nic_set_error(ERR_MATCH_RESOURCE_EXHAUSTION, error); + goto error_out; + } + + if (setup_flow_flm_actions(dev, fd, &qsl_data, &hsh_data, group, local_idxs, + &local_idx_counter, &flow->flm_rpl_ext_ptr, &flm_ft, + &flm_scrub, error)) { + goto error_out; + } + + /* Update flow_handle */ + for (int i = 0; i < MAX_FLM_MTRS_SUPPORTED; ++i) { + struct flm_flow_mtr_handle_s *handle = dev->ndev->flm_mtr_handle; + struct flm_mtr_stat_s *mtr_stat = + handle->port_stats[flow->caller_id]->stats; + flow->flm_mtr_ids[i] = + fd->mtr_ids[i] == UINT32_MAX ? 0 : mtr_stat[fd->mtr_ids[i]].flm_id; + } + + for (unsigned int i = 0; i < fd->modify_field_count; ++i) { + switch (fd->modify_field[i].select) { + case CPY_SELECT_DSCP_IPV4: + + /* fallthrough */ + case CPY_SELECT_DSCP_IPV6: + flow->flm_dscp = fd->modify_field[i].value8[0]; + break; + + case CPY_SELECT_RQI_QFI: + flow->flm_rqi = (fd->modify_field[i].value8[0] >> 6) & 0x1; + flow->flm_qfi = fd->modify_field[i].value8[0] & 0x3f; + break; + + case CPY_SELECT_IPV4: + flow->flm_nat_ipv4 = ntohl(fd->modify_field[i].value32[0]); + break; + + case CPY_SELECT_PORT: + flow->flm_nat_port = ntohs(fd->modify_field[i].value16[0]); + break; + + case CPY_SELECT_TEID: + flow->flm_teid = ntohl(fd->modify_field[i].value32[0]); + break; + + default: + NT_LOG(DBG, FILTER, "Unknown modify field: %d", + fd->modify_field[i].select); + break; + } + } + + flow->flm_ft = (uint8_t)flm_ft; + flow->flm_scrub_prof = (uint8_t)flm_scrub; + flow->context = fd->age.context; + + /* Program flow */ + flm_flow_programming(flow, NT_FLM_OP_RELEARN); + + hw_db_inline_deref_idxs(dev->ndev, dev->ndev->hw_db_handle, + (struct hw_db_idx *)flow->flm_db_idxs, + flow->flm_db_idx_counter); + memset(flow->flm_db_idxs, 0x0, sizeof(struct hw_db_idx) * RES_COUNT); + + flow->flm_db_idx_counter = local_idx_counter; + + for (int i = 0; i < RES_COUNT; ++i) + flow->flm_db_idxs[i] = local_idxs[i]; + } + + pthread_mutex_unlock(&dev->ndev->mtx); + + free(fd); + return 0; + +error_out: + hw_db_inline_deref_idxs(dev->ndev, dev->ndev->hw_db_handle, (struct hw_db_idx *)local_idxs, + local_idx_counter); + + pthread_mutex_unlock(&dev->ndev->mtx); + + free(fd); + return -1; +} + static __rte_always_inline bool all_bits_enabled(uint64_t hash_mask, uint64_t hash_bits) { return (hash_mask & hash_bits) == hash_bits; @@ -5324,6 +5488,7 @@ static const struct profile_inline_ops ops = { .flow_create_profile_inline = flow_create_profile_inline, .flow_destroy_profile_inline = flow_destroy_profile_inline, .flow_flush_profile_inline = flow_flush_profile_inline, + .flow_actions_update_profile_inline = flow_actions_update_profile_inline, .flow_nic_set_hasher_fields_inline = flow_nic_set_hasher_fields_inline, .flow_get_aged_flows_profile_inline = flow_get_aged_flows_profile_inline, /* -- 2.45.0