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 EF26945BCC; Thu, 31 Oct 2024 00:15:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A35243520; Thu, 31 Oct 2024 00:15:05 +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 33AC4434EF for ; Thu, 31 Oct 2024 00:15:03 +0100 (CET) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2172.outbound.protection.outlook.com [104.47.51.172]) 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 23:15:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZQ04B8YAEhaOY6FQB4vI85Joq1kjyZ6h113MGEl19Lx4MkiCwR+wgqsD5nZ+Tom7yRI20lKwuoqRkWvndx/RxXO4o7pR9IqDZyf1d07Kw6jU09OQLSdXEU2jROFSo88KDj+5fN82At4yPl9BaJBLXtg+aQ7aVBf8+gFXicQQoKRSr/F3zKB5jeCl2dZbpQMtWoBe+0TniWwQxEvWVIaV0x8kaaXg6mRgEpbauAKz5TxRuru7bdbM+CRLryaT/7YBLtJ5een4dWwMF5YijzxxuUo6cKvC+Kr3ULiCFagdwP5JIwxjD6TA8D6zjDcGf1UC4Hns1WJ5pAl1Cx3Dwg8n3A== 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=w1uso9R8xPLCAAcAEYcqgtsVM4ArtYAc1jqLoBooMBKS5SObDj46Ar2vvfVLWUuklK6MT1fQLeULcihRzJKvcEq48wiI4CMWK/w/XeM73eBjvXk7Ck0xqd1MefotwCgZPY/tos+WxkofnpISJlbqtfrwAeoaEDkV/Texu7mWbc71s3vkECRiP+l8oWamiTmqwhgglC60TC0lqygfGKdO3DYaqVh5pYi0ESmbdVTQB57bc/t2amy4m5U/Xrd1QWIWJ0ZRxKy24Gnp3a5K7c/FVnEw+2hDREmpnDw1kYDvmCHcr/CXOPgy5+FnxaJCp9FmPnEC3BhycJc0ol8C77W4Jg== 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=lCLOvB12o7n+uqJArh7mj6SedNYxLvYh2Z9DdU9XHrsSe1RhntX3S8Sw4Gk79HelDItpnmrBh5Z6zUR2rMzctqzF/txcWxg8FnXwj021s5rvwtaSpZIBzLQ0SJ5W8lNSvrhRLIMCuaojx9Awd4PWycdH7E+KL2b7wlRAizU4Mxc= Received: from DUZPR01CA0006.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::13) by PA4P190MB1117.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:105::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 21:41:02 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::75) 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:02 +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:02 +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 71/80] net/ntnic: add action update support Date: Wed, 30 Oct 2024 22:39:18 +0100 Message-ID: <20241030213940.3470062-72-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_|PA4P190MB1117:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ed37c043-d595-44ce-08c1-08dcf92b8d0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ptPgaCTGG6ch6Ac8qJrgTVrZS5Ja2AF5SDwwaaUt9k4xeuUJXNFQns9GDohi?= =?us-ascii?Q?WBNwmCnaqFE0NTzBt2C7TE3cV/CmoJto46JMfiX2ugFxtF93oalmgb7I3nSo?= =?us-ascii?Q?lV8+goaOu3Q6u5KTFhGpYzUZFXmnQ7enFaHzv1wpgurNhJo32eejaRRXxklE?= =?us-ascii?Q?Hi4sGT1BHFKwnfnjTd4Z3Qy8OlmG81YlAdUPhCYiyy/BJLpIG2IzfbUHZvJK?= =?us-ascii?Q?iKdXmnaJmqWhAvcCsJE0ZHqGYOGfh4Iv4UPHzZq1ImEafNyqLgQSbiOHmq0R?= =?us-ascii?Q?CNUOAy9MQLwfZtmeOFcgpS2gAefYeegXmOo9aH/FKgjk8tsHuKg2tT6wxNfS?= =?us-ascii?Q?xLKItTHwGwr2ieeXQp8c8D+wQGiuZnpuVukF2C5Nu/1udashgocDCDIQUgGg?= =?us-ascii?Q?m1qBMwvizOQQLp19HK/Sodra21hK/bT7F8x2V5KtVD2BqoKwIxEKJ66C7ypo?= =?us-ascii?Q?ukLTRIt6VyqDeocv2uYI/w5/qxctUcXACFWjq4Zew4+b6CxD95jo9k5QMT6Y?= =?us-ascii?Q?OAP+7w37muH26+pwG0nOD8yViNoUAluU71OvkiT73i4QLkj5rK7XvVpDDgk2?= =?us-ascii?Q?2PzB+9T0uWNqlrzFREy7OFvti5Uzb+SOxH0+zTumK11Qrjot5okas5nhhbsI?= =?us-ascii?Q?lR79hqg8IPPp9YbN8AmpVwiC0w42yFIoiBz7a1NZWfbL/NjdaGDA/TLXbvpd?= =?us-ascii?Q?/RDhCZN6VALSd/p67QCjy/C4bUFf0UmoWPX0U230hvpyhY/ECuXOyC7WHizp?= =?us-ascii?Q?/7O+wE9kE3Ca7q4eo8VGCDI96FnnsUOtkks1EZbfWC1C+Elfoogg4OnWLMYD?= =?us-ascii?Q?hzyMy2ytEh8d3RPpWQ1FyBJ4tiGIk+qiM4ov1NqOyWQ7yX9Yckqarvi1NCh2?= =?us-ascii?Q?c54ZXGq25WGuJ8Nb0AVvLG6hPyhO5j+jAMV2uF+O216xqjcH8qCHOksB+3q+?= =?us-ascii?Q?W8UBeisai9q+CSBjzCfoRph283WW3UPEUMcI1FfUcPJKxSnbZ2Ljtrli1Yx+?= =?us-ascii?Q?puM41jghNJHXKOQG1zxMinbsi3FNA49wl7QzJr0cBmWVP2xwbH3yx9pMbEeM?= =?us-ascii?Q?JdINfApsZ40h5Z+OMXFRyS0HYDmGeyWU3juNKyecM2rDhFN4kLpg1U5dtDhk?= =?us-ascii?Q?Y0cZFkHb8qeW8R4t01b5CJfkrlM5mYMRxwNlD77l12BOyUwVp5+tC+Z9Y8t2?= =?us-ascii?Q?zGy3RtLjhLHX1aF8sETQYYmmf2vA+0AnqQaG8ZOEysAZijBZuw/PwJIQimPt?= =?us-ascii?Q?e5cRsg6itj1EOQRvFA2+nT7FFneRMuhGLaYlkec4xC4F+RLeZ/R6uMG6YQvT?= =?us-ascii?Q?b50A6omnj1o6ljNeUuWddbuDS2mw3uQYHACq0F3QA2Se7PmKT+xct7xZfNTE?= =?us-ascii?Q?laoJF0BuGKD8iQbSGl1DTXdZMiAvQqoHA5ItF60NbhETcSpzkA=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)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: OfcGfjzosMV8ShDP35bTSek4RB9tM2gIc3N4v5wTW/qNmlBQAsfq+gInofHSyBWl4zHrR4Bh065I3xeU3Ye/cxRbZ7BWcl28sz9oCzztDHLfzMdjiAtGzNro9Mbto0V3JqIJ6vDcRmQZa94jC5ZGQiXh6x+MJqBkMbgT2FAEJS9wthVvi9ooqxa7rd0Jrtf+ICBIi/IhuxhQwFNdKMAcPuHkAIi8XSG6+QFHjmS6pyG5uZfmN2qy/iK53rsuOdajI2UlFsOJX1sKVwgUPXjVjnqwQDmMAv0lA69OmMaU/cbD3yGqUqop924MHl41pHFGtMrFZyRRS34PVy4nJSJL8Y+sMMiut9Om1QmaKLAj1zYw/E7I+t43HKtvAz2nHStD6cqqT2dcdZSMLyb96XrEVkqtxMaJ7ZTKIcRJufslyFUOCuf0XU4qQBDZKcdyAcU6jMKsKFzkWzTu+V+Df+Q7xXI2FXiPxXvoxoC7bmeUydiAkDeiXA6dSZdp7+V/jyUxASAm5KvhdJN1hQv9cFJtIDDgWkWUdQlPFJFA0Q5A2dTZRkd8rR5IdNZCieYBRp/+rlY03hAsUumnqWGW6AGifLpoJ5O4AwK35sv4BXjtE4pidsJsH1biaoTjRofpnRFegmGhIeciFnSJS3ry3i0rNe0/0IRYiTUyHitvkj0J3kI= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:41:02.1929 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed37c043-d595-44ce-08c1-08dcf92b8d0c 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: PA4P190MB1117 X-OriginatorOrg: napatech.com X-BESS-ID: 1730330100-302901-12791-46866-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.172 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.260092 [from cloudscan15-95.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