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 ED78645BB4; Wed, 23 Oct 2024 19:01:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA87742F04; Wed, 23 Oct 2024 19:01:01 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 6F43842EE0 for ; Wed, 23 Oct 2024 19:00:54 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2041.outbound.protection.outlook.com [104.47.11.41]) by mx-outbound15-83.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:00:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ICBWS88S9uwPdPdICrYffTK29Aru3jk13kjp44Ft1/uEfz+aHsIDkB2Qe92L9Vwl8d0twAvCcfhzui8o7aRooLIEnmbkjkbOnJL3frJsEuN3qcEJ7hjJlhNO6e4Nu2NMgkGKwsy5IfS/lP6HOIcJVX7diMeG/X0G62VzrbzojZmzuYJFZnld8Qv8akWmAf7t7eJ6yXu0FZbGTWZrV0CE0fYXa+b01C/M8q1qMjWzpB78YvxQ3eLGVDGnNUbpuh0+JfchJMZNCaHN78dvGL1/Suqfar4ZkYjWVOIG5VAhhEC5nI7qlpW8CCmDRFj3KSpgl4ePhW6InZhcDq3jakJohQ== 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=K5D/X7SXwiJ1s0nj/0CiLfStJoXpqrZLFz6eT0KvLkk=; b=ZCj9JAQsgJy+E/6VzNIs4JqE5JyrMRQAzxqSfIhgrBJQXkYg8ZC2+Tt7gM5C6Maz+dzx6N/BsdgolDG3sYCJbXnvHigXoJ7aged8iU6YoMXWiD8ma8BDMzSTzQhOe/kKCgpLcVmM9tB4PoJYJq8dFhbj1KePQBQ7zY3FEDYpnZ899gcLkcPai0u9gwOkkwU61N+0UhVujid5PajmVgf4sKuDhbz/ixi7e0d0IKKngllbRHULyKodR9L4cEJP4eug0j6f8XdAJTO2P1nsW/xfLJJPQCDzf7SRFCKa2ct36HctAi9Js/pHMcj0YGeTtxcIHukfo7dJ5WlRE1xuyVpFAA== 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=K5D/X7SXwiJ1s0nj/0CiLfStJoXpqrZLFz6eT0KvLkk=; b=qHVY0PQg99FHPWRvHWlu+kDbHUi9Lrjtusn10ymrmY3z5Cnblwi67tgLGAIPhW0kynnyCwdLfZCUUKs7wekz65zAyFgQFVrJwsISpBaW1p9VoloTb4/k7bMguUrwYY6geLPw8BpSKgAPItlTaxkqN9AajHLMR7DM5yT+arQuKFU= Received: from DU7PR01CA0012.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::15) by AM0P190MB0769.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:19f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.27; Wed, 23 Oct 2024 17:00:46 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::bc) by DU7PR01CA0012.outlook.office365.com (2603:10a6:10:50f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Wed, 23 Oct 2024 17:00:46 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:00:46 +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 Subject: [PATCH v3 06/73] net/ntnic: add management API for NT flow profile Date: Wed, 23 Oct 2024 18:59:14 +0200 Message-ID: <20241023170032.314155-7-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|AM0P190MB0769:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b5460964-b3f7-48e2-d6a7-08dcf3843ce8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?BLh9xF5ybQ8DY6aG6Kt7M+eI+BA8THPCnVmeQhslblD3i7b/k85TOBvCC08c?= =?us-ascii?Q?WSUWs2Yed4V3TMEkEPfgcYXRWYIhF4QLS2isd+7v3io/eyw+GjwJBHV2Zw80?= =?us-ascii?Q?CXM7uJCX+MTnwumrB2TPVwkknJCCeZVj18jrGmpei4dJwYzTPfTNyku3RdMN?= =?us-ascii?Q?7Y7USTPWX0k2NHsO4v9+GcWgfhhQAo/tlHXxFuiGUQ3oxbF23QaGyvCjYu8o?= =?us-ascii?Q?jLUSxFnRpxq5raTvW11rqLqekyGKizKk3NZmdeHVbpxOwYCI4mV9/jDyfIP7?= =?us-ascii?Q?AamDpx21rdUtZwO2zLE2GcgttlNZx3wf0k+V4NVNT45grIV4nHNdq3rOuYmb?= =?us-ascii?Q?WqJsCKQ0EDidK8xjaSQ38RuHFO2u8Gl+hRQNZen1yCD/2NjT4vSLsEWtGBXr?= =?us-ascii?Q?ADQaZ1EZV0h2lDT2TzT85gkAszUaU7oQtMmILhv3yBhEwwN5phe7Uo/zUGBO?= =?us-ascii?Q?MpDafn7KnopYBQdIprcOYOF1tz3ewneHVHsKCbVaJhzn9zp5NpT9Eu+RgGxk?= =?us-ascii?Q?/788qzY6Io2ynMeFfp88O889CqafSNAzRafLaLa35pvnWyBItZutlpJJJhgJ?= =?us-ascii?Q?wxJAeEjAzkYPr1ESi01cOp9x206TSsuPo5zPQpIe7D7L+gvdDGNi87VZLQCY?= =?us-ascii?Q?qhj+tayNn88F0F18u2BqtpyKJ+jt8NA7CQKP8lfHGB4wwSL+GqYoDRTPi+Ss?= =?us-ascii?Q?merlLSPv9QHVHu1t+0w+VQgisnXFPIIXjv1A4ZOQRHt/SmjYO293I1AWNPg3?= =?us-ascii?Q?H1+cxS2kkMSNvCjAyruHqgGJDiqj5gnnbf/0dkfnFeBQU0GXE038xiV5GBAT?= =?us-ascii?Q?UvvAtwFmeqYMCwAIworDgTHNR8ovFclUVNp8xlW0sAdm1EN4VU+DM5OQg+cY?= =?us-ascii?Q?cAwyH6CcemuUQsM/CKyylHOxmSC/YE0nThZe4orZiKStPR/bnJFY3oe+tXub?= =?us-ascii?Q?16trv4x8xfVfT/F8GnzMyrGPZoTTvkZdjpNYoUK+bBsdPuQ2gobfgucJWvgI?= =?us-ascii?Q?oxQ/gE6YOX34ZuLPiWM/qk8834Vi53SuOWLjcV34r/XYhgAsdkfkxXURC+kC?= =?us-ascii?Q?Q6+RJ2+2DuA7udVGxB4rLniH+kZrCZPYZKrSj81FpHvx5EZL92mqoBUjgsJ0?= =?us-ascii?Q?sX1pRNX+70H6K0YBhJs+CZpnz5WVMAHguuIwiPU24H2DfESQKv5h45KATcFK?= =?us-ascii?Q?p8koMhiGcif0DoQm5WSJnSo4B0dc6Yd8DuBli54rdcE6oVaUme64qX7iTwSB?= =?us-ascii?Q?WMZZ/cj74yMWOCqI91Mq1uioj6Kj/ZOOe+hPquGa8q0paDZIl5OEClst45gk?= =?us-ascii?Q?xCLLnwNczQyeOXwYLGV2BQwh2dPTPS+unOtgSDqhkqwDOxCyboWNnxQQG5Rr?= =?us-ascii?Q?ViWpqfZkLOO+XXbrdYUQuVFairm4VSlNcX1xzq5ogEhu1c5/wA=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)(376014)(36860700013)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: hnK6m5p3EGj+eaMwRu8SKk3jIJ+te4/NsKv4Y2rlErItWk6Kd+HNhkxuLSAhARApxQ6qymJxvNdjGtubjXEvpFG+kXkG3jjTM0hfln7egSyWcQWJvYG7++YVnNO1U4xtB+93KmA1G8Yc158Ia0M2qOWndx5xChX7qKkKRtKyf7u3YkkE1MgaVXbdRd69b7mBqruRLPXPu/QBO5cdnm91x/YTw22XCeP9Y4JdCGrzEkM1Z0zE727eFHcGt3uh7rnIZu+C7g7CGYFA8pckM27hZ8ouVijCqpE8CeejZGTqcXuAH1PK6jhdg5vGclXTcu6VggRufBqWQLp54tWYGJt4+OWD7U39TFTO2ke4N9OsCxfE+9tktuacoHYOerAXtW7FahqcEGaN0kgK8FQgu5G1yOHRFYAm/KDZ5oQiBjtjT44X71yil+iwJ9JgIP8IiUmq7SPEhG6mV/a+PSHoPQmbFrXDw10c3Bqi6w+fYKbOzA/FDSSNtafy9zEQlSqMCrKbsKAxIWLz63iwLyuusTnG9l6GqbOIkKaqzyFSd3wAG009pMX8dczW5kZ/W9MSTj8DjXnrUU/L3FUPmIpeGWkbE82dbohAnl7+6JV2UlznvcxIZnwI/9kGmxDEE87XpgyuaFn8a3hPtJeWvALE3r+ngh+hE+jSnnFhtVmiY/HiDG4= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:00:46.0548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5460964-b3f7-48e2-d6a7-08dcf3843ce8 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P190MB0769 X-BESS-ID: 1729702851-303923-12642-44291-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.41 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuZG5hZAVgZQMDUtxdTUwCjVxC TVJDXRLDUlxdLMKM3ANNXczDDVItVcqTYWAI3s5aNBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259925 [from cloudscan21-4.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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 Management API implements (re)setting of the NT flow dev Signed-off-by: Serhii Iliushyk --- drivers/net/ntnic/include/flow_api.h | 1 + drivers/net/ntnic/include/flow_api_engine.h | 5 ++ drivers/net/ntnic/nthw/flow_api/flow_api.c | 60 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.c | 20 +++++++ .../profile_inline/flow_api_profile_inline.h | 8 +++ drivers/net/ntnic/ntnic_mod_reg.h | 8 +++ 6 files changed, 102 insertions(+) diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h index 3bdfdd4f94..790b2f6b03 100644 --- a/drivers/net/ntnic/include/flow_api.h +++ b/drivers/net/ntnic/include/flow_api.h @@ -55,6 +55,7 @@ struct flow_nic_dev { uint16_t ports; /* number of in-ports addressable on this NIC */ /* flow profile this NIC is initially prepared for */ enum flow_eth_dev_profile flow_profile; + int flow_mgnt_prepared; struct hw_mod_resource_s res[RES_COUNT];/* raw NIC resource allocation table */ void *km_res_handle; diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h index d025677e25..52ff3cb865 100644 --- a/drivers/net/ntnic/include/flow_api_engine.h +++ b/drivers/net/ntnic/include/flow_api_engine.h @@ -46,6 +46,11 @@ enum res_type_e { */ #define MAX_OUTPUT_DEST (128) +struct flow_handle { + struct flow_eth_dev *dev; + struct flow_handle *next; +}; + void km_free_ndev_resource_management(void **handle); void kcc_free_ndev_resource_management(void **handle); diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index d0dad8e8f8..6800a8d834 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -10,6 +10,8 @@ #include "flow_api.h" #include "flow_filter.h" +#define SCATTER_GATHER + const char *dbg_res_descr[] = { /* RES_QUEUE */ "RES_QUEUE", /* RES_CAT_CFN */ "RES_CAT_CFN", @@ -210,10 +212,29 @@ static int nic_remove_eth_port_dev(struct flow_nic_dev *ndev, struct flow_eth_de static void flow_ndev_reset(struct flow_nic_dev *ndev) { + const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops(); + + if (profile_inline_ops == NULL) { + NT_LOG(ERR, FILTER, "%s: profile_inline module uninitialized", __func__); + return; + } + /* Delete all eth-port devices created on this NIC device */ while (ndev->eth_base) flow_delete_eth_dev(ndev->eth_base); + /* Error check */ + while (ndev->flow_base) { + NT_LOG(ERR, FILTER, + "ERROR : Flows still defined but all eth-ports deleted. Flow %p", + ndev->flow_base); + + profile_inline_ops->flow_destroy_profile_inline(ndev->flow_base->dev, + ndev->flow_base, NULL); + } + + profile_inline_ops->done_flow_management_of_ndev_profile_inline(ndev); + km_free_ndev_resource_management(&ndev->km_res_handle); kcc_free_ndev_resource_management(&ndev->kcc_res_handle); @@ -255,6 +276,13 @@ static void flow_ndev_reset(struct flow_nic_dev *ndev) int flow_delete_eth_dev(struct flow_eth_dev *eth_dev) { + const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops(); + + if (profile_inline_ops == NULL) { + NT_LOG(ERR, FILTER, "%s: profile_inline module uninitialized", __func__); + return -1; + } + struct flow_nic_dev *ndev = eth_dev->ndev; if (!ndev) { @@ -271,6 +299,20 @@ int flow_delete_eth_dev(struct flow_eth_dev *eth_dev) /* delete all created flows from this device */ pthread_mutex_lock(&ndev->mtx); + struct flow_handle *flow = ndev->flow_base; + + while (flow) { + if (flow->dev == eth_dev) { + struct flow_handle *flow_next = flow->next; + profile_inline_ops->flow_destroy_locked_profile_inline(eth_dev, flow, + NULL); + flow = flow_next; + + } else { + flow = flow->next; + } + } + /* * remove unmatched queue if setup in QSL * remove exception queue setting in QSL UNM @@ -445,6 +487,24 @@ static struct flow_eth_dev *flow_get_eth_dev(uint8_t adapter_no, uint8_t port_no eth_dev->port = port_no; eth_dev->port_id = port_id; + /* First time then NIC is initialized */ + if (!ndev->flow_mgnt_prepared) { + ndev->flow_profile = flow_profile; + + /* Initialize modules if needed - recipe 0 is used as no-match and must be setup */ + if (profile_inline_ops != NULL && + profile_inline_ops->initialize_flow_management_of_ndev_profile_inline(ndev)) + goto err_exit0; + + } else { + /* check if same flow type is requested, otherwise fail */ + if (ndev->flow_profile != flow_profile) { + NT_LOG(ERR, FILTER, + "ERROR: Different flow types requested on same NIC device. Not supported."); + goto err_exit0; + } + } + /* Allocate the requested queues in HW for this dev */ for (i = 0; i < alloc_rx_queues; i++) { 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 a6293f5f82..c9e4008b7e 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 @@ -8,6 +8,20 @@ #include "flow_api_profile_inline.h" #include "ntnic_mod_reg.h" +/* + * Public functions + */ + +int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev) +{ + return -1; +} + +int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev) +{ + return 0; +} + struct flow_handle *flow_create_profile_inline(struct flow_eth_dev *dev, const struct rte_flow_attr *attr, uint16_t forced_vlan_vid, @@ -51,6 +65,12 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev, struct flow_handle *fl } static const struct profile_inline_ops ops = { + /* + * Management + */ + .done_flow_management_of_ndev_profile_inline = done_flow_management_of_ndev_profile_inline, + .initialize_flow_management_of_ndev_profile_inline = + initialize_flow_management_of_ndev_profile_inline, /* * Flow functionality */ diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h index a83cc299b4..b87f8542ac 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h @@ -11,6 +11,14 @@ #include "flow_api.h" #include "stream_binary_flow_api.h" +/* + * Management + */ + +int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev); + +int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev); + /* * Flow functionality */ diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index d133336fad..149c549112 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -226,6 +226,14 @@ const struct flow_backend_ops *get_flow_backend_ops(void); void flow_backend_init(void); struct profile_inline_ops { + /* + * Management + */ + + int (*done_flow_management_of_ndev_profile_inline)(struct flow_nic_dev *ndev); + + int (*initialize_flow_management_of_ndev_profile_inline)(struct flow_nic_dev *ndev); + /* * Flow functionality */ -- 2.45.0