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 0018545BCC; Wed, 30 Oct 2024 23:15:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8F5A434A7; Wed, 30 Oct 2024 23:15:32 +0100 (CET) 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 8E1FC434A0 for ; Wed, 30 Oct 2024 23:15:31 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2105.outbound.protection.outlook.com [104.47.18.105]) by mx-outbound47-144.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 22:15:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sTUurg7xuM0+/6NJzTbZIS3jWjHBhfGRLI1iDw9WMhMLaZXseRBEAaMy1S0GA2yzHAKLnFl9zl97NzIUHl/g1arH9GaguNm+bfQsXI0DYnd7Wk0jEEtKS3CoSDxm2w2Sgf7QF39Iehx9cYNKNp6kvYNDs+P5mp9Yom5d/dzYchbuvplJickz6aynqMaBrVJ1TBLIWrS9ggtiVwIzBI0ng7HzCuBnTod+3IJDo99qsQSv5pffDKxxl/G5B1MRYscNSY2zGKyfwhbZTjDWEQ4x57JD+Im1ZX+zMntmEAItPof8f3skAxOJzVmgIiQjCBjyBEe/y3zBAhj+L08lKwYtAA== 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=DjYWPhdMaOq1DircVOfaqQlbriy/S2C717wMXXlhKxU=; b=SSLl3bkKbPqxPMHc5WJj9UsUT09Q00p+U2p2B/vjDpFYhZPM56KwG7WlRWsefXaAMuAQ4m8BqeLWUJLOTfb9yyXO3UwiNUU55QALSOhi5M/TFfjx3Fy9615r8+nuqBuOsKfmkvOLgfNniHn3P73lDRLiw+R5GSv6GuGr+xv69ySZTv9qFn0WznLvQi7NqZuKQUIxT5L0IT8QHHQE3mVT2upEx4eqN0NlcXYEPLH8lM/fhvb4386rFK/1ptMNfTRvp8cfcIlGPh5xi0ucLWgN1hXuNQLI+2EIqikSTp4FQGVI2FJeanHGSR85j+ZuD7/AS7g7auv0N8t+LW2NUoEGcA== 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=DjYWPhdMaOq1DircVOfaqQlbriy/S2C717wMXXlhKxU=; b=g7iTqcuze/m+IoofGLm6x+caxIsJcwgUx2ZHt9t9Q3raP7S8tcK/4zo4xCXN/COAYDNtdfCRk2Sr2cIIJbg+2iET0vUNi44oJGhklZ96QIj5JuaxFf/K74yKlCnk405j1R6QjlzttQhzXSG0oKHQn6fWBuYfWkA6vkkrbqZq9do= Received: from DUZPR01CA0013.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::6) by PR3P190MB0939.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:8c::13) 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:11 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::f1) by DUZPR01CA0013.outlook.office365.com (2603:10a6:10:3c3::6) 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:11 +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:11 +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, Oleksandr Kolomeiets Subject: [PATCH v5 80/80] net/ntnic: add MTU configuration Date: Wed, 30 Oct 2024 22:39:27 +0100 Message-ID: <20241030213940.3470062-81-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_|PR3P190MB0939:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2f827cd6-0a7e-4548-7e1c-08dcf92b9251 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?2ReS+r6uhN2TanoLXtPVBBhxSjtLMN4+KeeWbSa/xQoyIlB1yGBlpr7Sa9hP?= =?us-ascii?Q?vS1yLWatclhXzW6eG5KP29+bWrkkM53nx9Bc7GT2KjNHIq6AMYUjz/ZyW+XB?= =?us-ascii?Q?7zaHeHZZ8YTcy7KwOVNKj0RnPQhped8WlocIvWAiklyYA+ds6RcCi3SBhk3v?= =?us-ascii?Q?vRCVzbpb6fQF3PnvVNcEhWeG63V07lO3RGvL9IApTiBuUtpo7RSSZxDtM1p3?= =?us-ascii?Q?dSFjiKJ9vwFrL0LSlxFuGMI+/vkqgeDhKe1yKRkBaAs7lnAEFtWGL334Eq36?= =?us-ascii?Q?TqywI0UwemCxw4fLZEYJhljkWOkxXBL2qxlviP3aewMJiLc5VNyD9cmyWeUF?= =?us-ascii?Q?0b3eIaW1BMgCklmWO6NNj9pQHacKt68FKoLrPXqjijx5+gAsSOojk74CLsD3?= =?us-ascii?Q?HUnM7Day4F3KSTriykxjLyqlwc3Fwzt6vi5k8jpMrsiI7d0AVB4+XOZbLCGp?= =?us-ascii?Q?0zm0oiZwdj5KVGf6Rr6qCqNhwcKoxpqk4FGPnn4qh5/h2A62W0O9VVZoxrIn?= =?us-ascii?Q?R990ZR4hSq40N1mIx40IPqCXjwX0hwLbYvuzLVOIuEJSqoDy46h+gW8TCEr6?= =?us-ascii?Q?A4DtpMfGY62Cqh49NxBJeLPjOAntxBmv5SanT8XloHBkMi206o7Peku+dcDi?= =?us-ascii?Q?HYwNwgvkcew7YYpjWF8Had0SQvw5XYWeG4Bjf7R26fWM6Qr1Al5VQ/tRfqMY?= =?us-ascii?Q?kSV5o6OtITd5yMjKVhDForODNoFNNBpI3CUewgLWaqSma/4SHwp95nE6wihZ?= =?us-ascii?Q?mC9MlC7GGMQW5RH2Psi2eFsdqfYJjv0bUWeskn1xH230/yGhXqFTB3tYT323?= =?us-ascii?Q?h8CnXu7iiDjLjsjc/aw2Sf110B4JllWYWMLPEBzScMF8Pw58ECqhJb0F3EbW?= =?us-ascii?Q?ZY6E0mLmvDGnamH9YckQ7CfLnG/5hxOA/ZmoKB5TSZLNc+4OHNiilyP/onXv?= =?us-ascii?Q?ZZj1IvhlCKX/YKvNMvNC3Yty93U9gteKr4VbZaIAJVkASWkkX7wYx+ZBZHwU?= =?us-ascii?Q?v/VZHrvC+aNc8nafgDd90eDmzTlzgy5fzJ78RiZIi4odNfaSk6v7fbmX+6lz?= =?us-ascii?Q?2L/mEb26fwY5HEue7bvno/MqKFgutPJp9zxiVKRJQ8BzF2Pu8tA0RysbjbyN?= =?us-ascii?Q?VB/7xAL98ZNCs+VUW429SiR6ImrmXtaY+9lzePtDyi1nD2V+TwmiCW6GmBoq?= =?us-ascii?Q?HvjJie5eOCcXyiNNa60HQYt6xYEQ4gAFJnkqsG8gb/i5jywPXTk6kXCAiQMi?= =?us-ascii?Q?TB2cvBBuM75C2Hqoxol90mBIF2iMBASFkIpCmNOfiOD8fsDSnF5BDWdn+/8p?= =?us-ascii?Q?ZUxkGattrT8P4b2OB6q79PLPj6nD1HeT7JDSRi0c/jFPayj9IiWFlIiJJXjd?= =?us-ascii?Q?bk9+aqmpNzwmKrwnNHJoWQygOTMv61lkaTef9r+FfXoByZu2pw=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: 3RFm9uWthwAg0prlHsNHJfnD7VEhdOFHEKg389lZbr3OhrWemjZ0r/CH0oDDlksyZUONmJC/sogOVCB0uPnvzdWTjcLAQJji95OGmEclEWcY7LvOVtfeHts8OTaeIPuuaONR8UoZeeR7zqOpvUxRNrmb2qQzm8EULMFo/G7PygtlDqFKf9CKeAnpXPMbVJZHrFbrKcgHqRDqpliuyX3XhDwawmlnwgiSvmZPWvjmwzRztA5gYjWn984C+JmmGWU+HkhbTi5ygpFBRKBobFciTuQQmfDOaP9PNI/wg2ru5890BArPrg7l37g26K9i4f2ilkCvDQ3fx4c4SgFG4CuiTbsxmMIZ+impE82R1tvJp447lprZZqtRJ18zH6o0/Xs/sgmdL86mB4wL8Vg3dmW5hu9e6CxKyRGl6BovQsddxQI4WUyQgZI8L82cD7BQI76S2yxH1AC9NkUy2j1ZWSNlw/GNAqUfP4JeumM/2PWXnsnoYtUOQLlHlHPIB5bhavddm5JCtVYJhmgPEdEnCJBAK984bsk3BoMF3P1ctWR8zmcXw4YkyHPel4HGM+Ytf6A+y5Cw12imePzsOfkBM8vFC8vW/xEMNR/kwToC45fGUdE3xzCTFw5mnd5a4pIDwOuubmQABovy1niJFUovhyFNJz5cR4+LfVgQu16a8X9JiR8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:41:11.0523 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f827cd6-0a7e-4548-7e1c-08dcf92b9251 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: PR3P190MB0939 X-OriginatorOrg: napatech.com X-BESS-ID: 1730326528-312176-12708-41958-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.18.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkYG5hYWQGYGUDTFLNEkOc3c3M QyNTHFxDDF2NzYKCnNwCAtNTnV2NzISKk2FgBByzXGQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260092 [from cloudscan20-80.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 From: Oleksandr Kolomeiets Add supporting API rte_eth_dev_set_mtu Signed-off-by: Oleksandr Kolomeiets --- doc/guides/nics/features/default.ini | 2 +- doc/guides/nics/features/ntnic.ini | 1 + doc/guides/nics/ntnic.rst | 1 + doc/guides/rel_notes/release_24_11.rst | 1 + drivers/net/ntnic/include/flow_api_engine.h | 7 ++ drivers/net/ntnic/include/hw_mod_backend.h | 4 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c | 96 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.c | 82 +++++++++++++++- .../profile_inline/flow_api_profile_inline.h | 9 ++ .../flow_api_profile_inline_config.h | 50 ++++++++++ drivers/net/ntnic/ntnic_ethdev.c | 41 ++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 5 + 12 files changed, 296 insertions(+), 3 deletions(-) diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 1e9a156a2a..a0c392f463 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -180,7 +180,7 @@ nvgre_decap = nvgre_encap = of_copy_ttl_in = of_copy_ttl_out = -of_dec_mpls_ttl = +of_dec_mpls_ttl =MTU update = Y of_dec_nw_ttl = of_pop_mpls = of_pop_vlan = diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index 884365f1a0..1bf9bd76db 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -14,6 +14,7 @@ RSS hash = Y RSS key update = Y Basic stats = Y Extended stats = Y +MTU update = Y Linux = Y x86-64 = Y diff --git a/doc/guides/nics/ntnic.rst b/doc/guides/nics/ntnic.rst index fa6cd2b95c..e12553e415 100644 --- a/doc/guides/nics/ntnic.rst +++ b/doc/guides/nics/ntnic.rst @@ -71,6 +71,7 @@ Features - Flow metering, including meter policy API. - Flow update. Update of the action list for specific flow - Asynchronous flow support +- MTU update Limitations ~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index 13f7dada4b..517085f0b3 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -168,6 +168,7 @@ New Features * Added meter flow metering and flow policy support * Added flow actions update support * Added asynchronous flow support + * Added MTU update * **Added cryptodev queue pair reset support.** diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h index 8604dde995..5eace2614f 100644 --- a/drivers/net/ntnic/include/flow_api_engine.h +++ b/drivers/net/ntnic/include/flow_api_engine.h @@ -280,6 +280,11 @@ struct nic_flow_def { * AGE action timeout */ struct age_def_s age; + + /* + * TX fragmentation IFR/RPP_LR MTU recipe + */ + uint8_t flm_mtu_fragmentation_recipe; }; enum flow_handle_type { @@ -340,6 +345,8 @@ struct flow_handle { uint8_t flm_qfi; uint8_t flm_scrub_prof; + uint8_t flm_mtu_fragmentation_recipe; + /* Flow specific pointer to application template table cell stored during * flow create. */ diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 7a36e4c6d6..f91a3ed058 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -958,8 +958,12 @@ int hw_mod_tpe_rpp_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, i uint32_t value); int hw_mod_tpe_rpp_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_tpe_rpp_ifr_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index, + uint32_t value); int hw_mod_tpe_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_tpe_ifr_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index, + uint32_t value); int hw_mod_tpe_ins_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); int hw_mod_tpe_ins_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index, diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c index ba8f2d0dbb..2c3ed2355b 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c @@ -152,6 +152,54 @@ int hw_mod_tpe_rpp_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, i return be->iface->tpe_rpp_ifr_rcp_flush(be->be_dev, &be->tpe, start_idx, count); } +static int hw_mod_tpe_rpp_ifr_rcp_mod(struct flow_api_backend_s *be, enum hw_tpe_e field, + uint32_t index, uint32_t *value, int get) +{ + if (index >= be->tpe.nb_ifr_categories) + return INDEX_TOO_LARGE; + + switch (_VER_) { + case 3: + switch (field) { + case HW_TPE_IFR_RCP_IPV4_EN: + GET_SET(be->tpe.v3.rpp_ifr_rcp[index].ipv4_en, value); + break; + + case HW_TPE_IFR_RCP_IPV4_DF_DROP: + GET_SET(be->tpe.v3.rpp_ifr_rcp[index].ipv4_df_drop, value); + break; + + case HW_TPE_IFR_RCP_IPV6_EN: + GET_SET(be->tpe.v3.rpp_ifr_rcp[index].ipv6_en, value); + break; + + case HW_TPE_IFR_RCP_IPV6_DROP: + GET_SET(be->tpe.v3.rpp_ifr_rcp[index].ipv6_drop, value); + break; + + case HW_TPE_IFR_RCP_MTU: + GET_SET(be->tpe.v3.rpp_ifr_rcp[index].mtu, value); + break; + + default: + return UNSUP_FIELD; + } + + break; + + default: + return UNSUP_VER; + } + + return 0; +} + +int hw_mod_tpe_rpp_ifr_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index, + uint32_t value) +{ + return hw_mod_tpe_rpp_ifr_rcp_mod(be, field, index, &value, 0); +} + /* * RPP_RCP */ @@ -262,6 +310,54 @@ int hw_mod_tpe_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int c return be->iface->tpe_ifr_rcp_flush(be->be_dev, &be->tpe, start_idx, count); } +static int hw_mod_tpe_ifr_rcp_mod(struct flow_api_backend_s *be, enum hw_tpe_e field, + uint32_t index, uint32_t *value, int get) +{ + if (index >= be->tpe.nb_ifr_categories) + return INDEX_TOO_LARGE; + + switch (_VER_) { + case 3: + switch (field) { + case HW_TPE_IFR_RCP_IPV4_EN: + GET_SET(be->tpe.v3.ifr_rcp[index].ipv4_en, value); + break; + + case HW_TPE_IFR_RCP_IPV4_DF_DROP: + GET_SET(be->tpe.v3.ifr_rcp[index].ipv4_df_drop, value); + break; + + case HW_TPE_IFR_RCP_IPV6_EN: + GET_SET(be->tpe.v3.ifr_rcp[index].ipv6_en, value); + break; + + case HW_TPE_IFR_RCP_IPV6_DROP: + GET_SET(be->tpe.v3.ifr_rcp[index].ipv6_drop, value); + break; + + case HW_TPE_IFR_RCP_MTU: + GET_SET(be->tpe.v3.ifr_rcp[index].mtu, value); + break; + + default: + return UNSUP_FIELD; + } + + break; + + default: + return UNSUP_VER; + } + + return 0; +} + +int hw_mod_tpe_ifr_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index, + uint32_t value) +{ + return hw_mod_tpe_ifr_rcp_mod(be, field, index, &value, 0); +} + /* * INS_RCP */ 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 9fd943365f..a34839e00c 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 @@ -803,6 +803,11 @@ static inline void set_key_def_sw(struct flm_flow_key_def_s *key_def, unsigned i } } +static inline uint8_t convert_port_to_ifr_mtu_recipe(uint32_t port) +{ + return port + 1; +} + static uint8_t get_port_from_port_id(const struct flow_nic_dev *ndev, uint32_t port_id) { struct flow_eth_dev *dev = ndev->eth_base; @@ -1023,6 +1028,8 @@ static int flm_flow_programming(struct flow_handle *fh, uint32_t flm_op) learn_record->rqi = fh->flm_rqi; /* Lower 10 bits used for RPL EXT PTR */ learn_record->color = fh->flm_rpl_ext_ptr & 0x3ff; + /* Bit [13:10] used for MTU recipe */ + learn_record->color |= (fh->flm_mtu_fragmentation_recipe & 0xf) << 10; learn_record->ent = 0; learn_record->op = flm_op & 0xf; @@ -1121,6 +1128,9 @@ static int interpret_flow_actions(const struct flow_eth_dev *dev, fd->dst_id[fd->dst_num_avail].active = 1; fd->dst_num_avail++; + fd->flm_mtu_fragmentation_recipe = + convert_port_to_ifr_mtu_recipe(port); + if (fd->full_offload < 0) fd->full_offload = 1; @@ -3070,6 +3080,8 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def break; } } + + fh->flm_mtu_fragmentation_recipe = fd->flm_mtu_fragmentation_recipe; fh->context = fd->age.context; } @@ -3187,7 +3199,7 @@ static int setup_flow_flm_actions(struct flow_eth_dev *dev, /* Setup COT */ struct hw_db_inline_cot_data cot_data = { .matcher_color_contrib = empty_pattern ? 0x0 : 0x4, /* FT key C */ - .frag_rcp = 0, + .frag_rcp = empty_pattern ? fd->flm_mtu_fragmentation_recipe : 0, }; struct hw_db_cot_idx cot_idx = hw_db_inline_cot_add(dev->ndev, dev->ndev->hw_db_handle, &cot_data); @@ -3501,7 +3513,7 @@ static struct flow_handle *create_flow_filter(struct flow_eth_dev *dev, struct n /* Setup COT */ struct hw_db_inline_cot_data cot_data = { .matcher_color_contrib = 0, - .frag_rcp = 0, + .frag_rcp = fd->flm_mtu_fragmentation_recipe, }; struct hw_db_cot_idx cot_idx = hw_db_inline_cot_add(dev->ndev, dev->ndev->hw_db_handle, @@ -5412,6 +5424,67 @@ int flow_get_flm_stats_profile_inline(struct flow_nic_dev *ndev, uint64_t *data, return 0; } +int flow_set_mtu_inline(struct flow_eth_dev *dev, uint32_t port, uint16_t mtu) +{ + if (port >= 255) + return -1; + + uint32_t ipv4_en_frag; + uint32_t ipv4_action; + uint32_t ipv6_en_frag; + uint32_t ipv6_action; + + if (port == 0) { + ipv4_en_frag = PORT_0_IPV4_FRAGMENTATION; + ipv4_action = PORT_0_IPV4_DF_ACTION; + ipv6_en_frag = PORT_0_IPV6_FRAGMENTATION; + ipv6_action = PORT_0_IPV6_ACTION; + + } else if (port == 1) { + ipv4_en_frag = PORT_1_IPV4_FRAGMENTATION; + ipv4_action = PORT_1_IPV4_DF_ACTION; + ipv6_en_frag = PORT_1_IPV6_FRAGMENTATION; + ipv6_action = PORT_1_IPV6_ACTION; + + } else { + ipv4_en_frag = DISABLE_FRAGMENTATION; + ipv4_action = IPV4_DF_DROP; + ipv6_en_frag = DISABLE_FRAGMENTATION; + ipv6_action = IPV6_DROP; + } + + int err = 0; + uint8_t ifr_mtu_recipe = convert_port_to_ifr_mtu_recipe(port); + struct flow_nic_dev *ndev = dev->ndev; + + err |= hw_mod_tpe_rpp_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_IPV4_EN, ifr_mtu_recipe, + ipv4_en_frag); + err |= hw_mod_tpe_rpp_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_IPV6_EN, ifr_mtu_recipe, + ipv6_en_frag); + err |= hw_mod_tpe_rpp_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_MTU, ifr_mtu_recipe, mtu); + err |= hw_mod_tpe_rpp_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_IPV4_DF_DROP, ifr_mtu_recipe, + ipv4_action); + err |= hw_mod_tpe_rpp_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_IPV6_DROP, ifr_mtu_recipe, + ipv6_action); + + err |= hw_mod_tpe_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_IPV4_EN, ifr_mtu_recipe, + ipv4_en_frag); + err |= hw_mod_tpe_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_IPV6_EN, ifr_mtu_recipe, + ipv6_en_frag); + err |= hw_mod_tpe_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_MTU, ifr_mtu_recipe, mtu); + err |= hw_mod_tpe_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_IPV4_DF_DROP, ifr_mtu_recipe, + ipv4_action); + err |= hw_mod_tpe_ifr_rcp_set(&ndev->be, HW_TPE_IFR_RCP_IPV6_DROP, ifr_mtu_recipe, + ipv6_action); + + if (err == 0) { + err |= hw_mod_tpe_rpp_ifr_rcp_flush(&ndev->be, ifr_mtu_recipe, 1); + err |= hw_mod_tpe_ifr_rcp_flush(&ndev->be, ifr_mtu_recipe, 1); + } + + return err; +} + int flow_info_get_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id, struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info, struct rte_flow_error *error) @@ -5996,6 +6069,11 @@ static const struct profile_inline_ops ops = { .flm_free_queues = flm_free_queues, .flm_mtr_read_stats = flm_mtr_read_stats, .flm_update = flm_update, + + /* + * Config API + */ + .flow_set_mtu_inline = flow_set_mtu_inline, }; void profile_inline_init(void) 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 0dc89085ec..ce1a0669ee 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,10 @@ #include "flow_api.h" #include "stream_binary_flow_api.h" +#define DISABLE_FRAGMENTATION 0 +#define IPV4_DF_DROP 1 +#define IPV6_DROP 1 + /* * Management */ @@ -120,4 +124,9 @@ int flow_configure_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id, const struct rte_flow_queue_attr *queue_attr[], struct rte_flow_error *error); +/* + * Config API + */ +int flow_set_mtu_inline(struct flow_eth_dev *dev, uint32_t port, uint16_t mtu); + #endif /* _FLOW_API_PROFILE_INLINE_H_ */ diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h index 3b53288ddf..c665cab16a 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h @@ -6,6 +6,56 @@ #ifndef _FLOW_API_PROFILE_INLINE_CONFIG_H_ #define _FLOW_API_PROFILE_INLINE_CONFIG_H_ +/* + * Per port configuration for IPv4 fragmentation and DF flag handling + * + * ||-------------------------------------||-------------------------||----------|| + * || Configuration || Egress packet type || || + * ||-------------------------------------||-------------------------|| Action || + * || IPV4_FRAGMENTATION | IPV4_DF_ACTION || Exceeding MTU | DF flag || || + * ||-------------------------------------||-------------------------||----------|| + * || DISABLE | - || - | - || Forward || + * ||-------------------------------------||-------------------------||----------|| + * || ENABLE | DF_DROP || no | - || Forward || + * || | || yes | 0 || Fragment || + * || | || yes | 1 || Drop || + * ||-------------------------------------||-------------------------||----------|| + * || ENABLE | DF_FORWARD || no | - || Forward || + * || | || yes | 0 || Fragment || + * || | || yes | 1 || Forward || + * ||-------------------------------------||-------------------------||----------|| + */ + +#define PORT_0_IPV4_FRAGMENTATION DISABLE_FRAGMENTATION +#define PORT_0_IPV4_DF_ACTION IPV4_DF_DROP + +#define PORT_1_IPV4_FRAGMENTATION DISABLE_FRAGMENTATION +#define PORT_1_IPV4_DF_ACTION IPV4_DF_DROP + +/* + * Per port configuration for IPv6 fragmentation + * + * ||-------------------------------------||-------------------------||----------|| + * || Configuration || Egress packet type || || + * ||-------------------------------------||-------------------------|| Action || + * || IPV6_FRAGMENTATION | IPV6_ACTION || Exceeding MTU || || + * ||-------------------------------------||-------------------------||----------|| + * || DISABLE | - || - || Forward || + * ||-------------------------------------||-------------------------||----------|| + * || ENABLE | DROP || no || Forward || + * || | || yes || Drop || + * ||-------------------------------------||-------------------------||----------|| + * || ENABLE | FRAGMENT || no || Forward || + * || | || yes || Fragment || + * ||-------------------------------------||-------------------------||----------|| + */ + +#define PORT_0_IPV6_FRAGMENTATION DISABLE_FRAGMENTATION +#define PORT_0_IPV6_ACTION IPV6_DROP + +#define PORT_1_IPV6_FRAGMENTATION DISABLE_FRAGMENTATION +#define PORT_1_IPV6_ACTION IPV6_DROP + /* * Statistics are generated each time the byte counter crosses a limit. * If BYTE_LIMIT is zero then the byte counter does not trigger statistics diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 77436eb02d..2a2643a106 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -39,6 +39,7 @@ const rte_thread_attr_t thread_attr = { .priority = RTE_THREAD_PRIORITY_NORMAL } #define THREAD_RETURN (0) #define HW_MAX_PKT_LEN (10000) #define MAX_MTU (HW_MAX_PKT_LEN - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN) +#define MIN_MTU_INLINE 512 #define EXCEPTION_PATH_HID 0 @@ -70,6 +71,8 @@ const rte_thread_attr_t thread_attr = { .priority = RTE_THREAD_PRIORITY_NORMAL } #define MAX_RX_PACKETS 128 #define MAX_TX_PACKETS 128 +#define MTUINITVAL 1500 + uint64_t rte_tsc_freq; static void (*previous_handler)(int sig); @@ -338,6 +341,7 @@ eth_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info dev_info->max_mtu = MAX_MTU; if (p_adapter_info->fpga_info.profile == FPGA_INFO_PROFILE_INLINE) { + dev_info->min_mtu = MIN_MTU_INLINE; dev_info->flow_type_rss_offloads = NT_ETH_RSS_OFFLOAD_MASK; dev_info->hash_key_size = MAX_RSS_KEY_LEN; @@ -1149,6 +1153,26 @@ static int eth_tx_scg_queue_setup(struct rte_eth_dev *eth_dev, return 0; } +static int dev_set_mtu_inline(struct rte_eth_dev *eth_dev, uint16_t mtu) +{ + const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops(); + + if (profile_inline_ops == NULL) { + NT_LOG_DBGX(ERR, NTNIC, "profile_inline module uninitialized"); + return -1; + } + + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + + struct flow_eth_dev *flw_dev = internals->flw_dev; + int ret = -1; + + if (internals->type == PORT_TYPE_PHYSICAL && mtu >= MIN_MTU_INLINE && mtu <= MAX_MTU) + ret = profile_inline_ops->flow_set_mtu_inline(flw_dev, internals->port, mtu); + + return ret ? -EINVAL : 0; +} + static int eth_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { eth_dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; @@ -1714,6 +1738,7 @@ static struct eth_dev_ops nthw_eth_dev_ops = { .xstats_reset = eth_xstats_reset, .xstats_get_by_id = eth_xstats_get_by_id, .xstats_get_names_by_id = eth_xstats_get_names_by_id, + .mtu_set = NULL, .promiscuous_enable = promiscuous_enable, .rss_hash_update = eth_dev_rss_hash_update, .rss_hash_conf_get = rss_hash_conf_get, @@ -2277,6 +2302,7 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) internals->pci_dev = pci_dev; internals->n_intf_no = n_intf_no; internals->type = PORT_TYPE_PHYSICAL; + internals->port = n_intf_no; internals->nb_rx_queues = nb_rx_queues; internals->nb_tx_queues = nb_tx_queues; @@ -2386,6 +2412,21 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) /* increase initialized ethernet devices - PF */ p_drv->n_eth_dev_init_count++; + if (get_flow_filter_ops() != NULL) { + if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE && + internals->flw_dev->ndev->be.tpe.ver >= 2) { + assert(nthw_eth_dev_ops.mtu_set == dev_set_mtu_inline || + nthw_eth_dev_ops.mtu_set == NULL); + nthw_eth_dev_ops.mtu_set = dev_set_mtu_inline; + dev_set_mtu_inline(eth_dev, MTUINITVAL); + NT_LOG_DBGX(DBG, NTNIC, "INLINE MTU supported, tpe version %d", + internals->flw_dev->ndev->be.tpe.ver); + + } else { + NT_LOG(DBG, NTNIC, "INLINE MTU not supported"); + } + } + /* Port event thread */ if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE) { res = THREAD_CTRL_CREATE(&p_nt_drv->port_event_thread, "nt_port_event_thr", diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index eb764356eb..71861c6dea 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -408,6 +408,11 @@ struct profile_inline_ops { const struct rte_flow_port_attr *port_attr, uint16_t nb_queue, const struct rte_flow_queue_attr *queue_attr[], struct rte_flow_error *error); + + /* + * Config API + */ + int (*flow_set_mtu_inline)(struct flow_eth_dev *dev, uint32_t port, uint16_t mtu); }; void register_profile_inline_ops(const struct profile_inline_ops *ops); -- 2.45.0