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 EF16A45BB4; Wed, 23 Oct 2024 19:07:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5933E43291; Wed, 23 Oct 2024 19:02:27 +0200 (CEST) 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 BC15842ECA for ; Wed, 23 Oct 2024 19:01:32 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2109.outbound.protection.outlook.com [104.47.17.109]) by mx-outbound42-14.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:01:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bLibjmz6BwaN2267ez1SFiXD4BSrq8Ac4KyOAiuzxVAzPrgemGnA0kEDhV8kc4Lzz1DGMeeJf+CwUQ2ixsL1Qrh+CvRLtRof85vFWYN+Ypw/141xwJiV97utwtAcDhIN4BCAu/unz8+sUE/sniyIqOCIe1Zq2swq6cpo1KeHmekd36RAuL+4/CvQiA2A5udx+/nWztXdN+Fkkl3XXhL3yCSp6IbK+c35ZfQs54ki44IeRh1F+d24Kq1fy1iSbO4Jk1mO/NrQ+oUTveTSzdZND3tbviZJuZDKJ11xia0tE+vf3Zju3EyQghgChnZBa0PlF8FevbSEkc/KRBMTvrou2A== 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=/tB7CJEZ+v59rYQLX/sUkC2rymuCDByCVWL2+SYTC6M=; b=u+QY+54vqahy5G+ClLI6RyKBDQca79J+D1Yss70y9pvY7PMC7nXKjb0reajcdYtRxXhStJixC8IHys44d6p775KG22rN7M+1iscgHzuy9WqX6ttQ+br+FL8GMHfh9f+Y6n9AiO9z9oFxg1gqhHxXb5dkR46ULF2IkFOJwYK5U2WUuk/M98Ecq6j/LLNltmn2wmMg6or8FYEtHXd4IkU7ZLRJeFpQDoVHaSJpxrdaW6hfMS/vb+tL+5ra+ZjsTsrQuuPHoG/HNARwiHB7XJEdM0E7keXZlUCvsv7ZoxeKHvFd0kmRL2P+JM4kQWsEU0yStAsmjjOsOVgCwdHOTmIoDA== 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=/tB7CJEZ+v59rYQLX/sUkC2rymuCDByCVWL2+SYTC6M=; b=btzdsMbut00Fu3Dx6MrUAlItTutby4T8OmyZWDVUE7IMTfnBy2oWt+4EUupMNac6TSD4hMnOTsPTbrE5ommp3wgey5geoSsibGyM02For69drQAm640Yfj8nE2LjEeL/cNJfdQKGQFKQFOUxT3wCG1z36kyRTHpiJdBuo8HrCEM= Received: from DU7PR01CA0006.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::6) by DU5P190MB2049.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:51f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 17:01:29 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::89) by DU7PR01CA0006.outlook.office365.com (2603:10a6:10:50f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.31 via Frontend Transport; Wed, 23 Oct 2024 17:01:29 +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:01:29 +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 53/73] net/ntnic: enable RSS feature Date: Wed, 23 Oct 2024 19:00:01 +0200 Message-ID: <20241023170032.314155-54-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_|DU5P190MB2049:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: f959ce54-9d86-43ec-af7b-08dcf38456f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wHS4y6Ns9Cakt3ZCthMK+UOdVKxwX4eePwpRjmOPYUN/rc76S8KJIM/+h3Xl?= =?us-ascii?Q?r3mhFnLq1IdoTilSmlrB7byfhGX9YMg3oOBTZRFbyrSic503n2MF/tVoaF3W?= =?us-ascii?Q?gBYYiU8OtL2Anye7mP0x+dZVe656y2FX2KnUoNavbkyzBtx7SYks7cDUvqjq?= =?us-ascii?Q?uCdrkxeE6/HXjvit3Owv/ookTahEsU8JEabNxuU1QSSqzpck8x728SclBnR0?= =?us-ascii?Q?5z/7qtUayDhQI1q6AsSeoSq3xgkFebvLWTSn7kcsLenisePTmnZPvX/FPeGC?= =?us-ascii?Q?0EWNmltsan9s/AcCuogtz8WUDtSRExmRolwAP4ppWyzxx98IuHVZjPcbEahy?= =?us-ascii?Q?6mQolk8HoMW/+0hf1CCjjHKYVpSN/QprUexrbkQmWJtcGmr+X0cboq1sXlLJ?= =?us-ascii?Q?TWvNoNeZEuzA4PFprRwmulTHFsaOg2zMWEHtNY9/4CNhv9VtRIk1sEiHlzlu?= =?us-ascii?Q?DU2sZfBL6Fq2CQCiZdINX1Yh0ZzFAr6PEsEQxYmELO9NXdtcNlWmZk4bpez9?= =?us-ascii?Q?OQmCRXCpwJM5IW9vDA537qX5y9RdmT5ikdI5Z3WEJdfdyQ9iU/+j35BwQgQ3?= =?us-ascii?Q?SUAoyWEcsMyI4VaweBsVLRTJwa2qHZSgQ4v5DmKycU5QnakBme/EVRmvXW54?= =?us-ascii?Q?5wXebpt1OK1iwld9Y+gDeuaMb5WKKsTlwzv+XB1W+hApSGxB6SVK36QA5X/M?= =?us-ascii?Q?K+2jzgtYuGQLQlKmSPex48EYU9xvNZucsUsmJzKMsKnx/dFUsIkakKtSECs0?= =?us-ascii?Q?nJUg6dXP5r4g36mlAw1BiWI6QM0nwVaMCCs+ErRoh5V5Hee3dFro5owAdxv1?= =?us-ascii?Q?ImJetNAdRNq9k5HwvQj86iVxS6ijLqtrw6p8aZS5lwQw14tB23di5Lu4DCBY?= =?us-ascii?Q?FrF4rtkk0mwXJPUyXcMw1Y74wlN1Vp7LmioKXweNkOtTJFfhgvbD6H7V82fq?= =?us-ascii?Q?+rseyAqBhPhKUbnC74qMN8mCLXn+FKjmIhPqzE0SDViwYmA1ApUDtZzZvbld?= =?us-ascii?Q?kaNStr9PA8O32A4l8koHOsdgKof4pYvJHSUdyt/xmWRo67YmWfkGDrMVoQ8k?= =?us-ascii?Q?VZHSJLGGwRRLg4Bk2ghGcJ8kQNKlrYAilnxopquhLXj0vvMvetVba16RpKVO?= =?us-ascii?Q?svaYS9/fX6jtw0rp1tOltHb7Hu8oEtqi8pjNJPBTmKVUY27eQ04VK/f810f7?= =?us-ascii?Q?g0AzoEeBq25ZdGZPr7RauWhfp7UUmcsg9Ns+Ok5laTFmL9fYd4TRg/o0xYeS?= =?us-ascii?Q?T+6zJYAcvUgg2eg3+BS8kmpLoKXvBsVf2oRsctevprsVY4YV2Qj89Pm3UuWz?= =?us-ascii?Q?4vKjMaM1PBsKTjQ28YNgWG1+ypzMP3LpQqVZBlZ4t/DHwDDHuDxG8tF5Q1Lh?= =?us-ascii?Q?TvuNWiFLW0Bm87BC6hhRaSpaba0eMbM2l88sjsJXRLKCfwLp8g=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)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nSqTQTjYfWo9g+Fo5LOgQAc2z5WqW4GZhL8UW4AysMUr1/B/XDdAetss+6xu9dOUbyRTwwlOaaR9bmasJOakNlOFgNfqi0rAa90vcji1LJjVFdTHwxQeU2yCphDYuUnYx4sjm/Y9+QT5KKQbCsio2Xm6pINB0kx/pVG5itP3UCmcD0HtNxkNe38PBuJX3BF/xkpNgmTVByaO8ng5yxKltsRcNX/Ld0q4Vj6ePmCP0MjvCRFxrgmoCCKSAQWBCYH7mZsVLGNcgLhp21TC/W/GDIhVf/kgQN83t32l75x01ywjX61u4vLKYTkCsh2C8YHfuPN6K3ENkQhNjr6DLrlTwlDm1Y/Bkjj8ODAjG7m8Q0l8RLfiLIN7Xkku10CNcsp+pOVRr7kHztQbMVjdvXqmN0R4CrY9veDAH1UzrCisOJNIGsrgT6RYLGMdOtpJkdFjNrw15NMtJAHfW/wxkNID8Y3QWLKBwm0qNRQaPEkjFI/gdrmhGsBEZAaz2SWdgLLIeMv1UCNTo2g0wXzBbQjdCgViohFVCnub3cHbzcsMVPao5LPWZObVyuzLqIFkbpvGNOp9gJl7o/i7XxsB6It++Pz+knfffNdMsDTOs9GihahTNK8LDWOSevcO7se6Ko7rqFrJ6Maamy2gRh8Uywj6QXBI4+nflcynN6NiNX7HiZA= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:01:29.7270 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f959ce54-9d86-43ec-af7b-08dcf38456f0 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: DU5P190MB2049 X-BESS-ID: 1729702891-310766-12792-42118-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.109 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGxubmQGYGUNTE2NLCONEwxS AxzSTVwNgk1TApxcwy0TTZJNEsycTSUKk2FgBnh3SCQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259925 [from cloudscan12-179.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 Enable receive side scaling Signed-off-by: Serhii Iliushyk --- doc/guides/nics/features/ntnic.ini | 3 + drivers/net/ntnic/include/create_elements.h | 1 + drivers/net/ntnic/include/flow_api.h | 2 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 6 ++ .../profile_inline/flow_api_profile_inline.c | 43 +++++++++++ drivers/net/ntnic/ntnic_ethdev.c | 77 +++++++++++++++++++ drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 73 ++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 7 ++ 8 files changed, 212 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index 4cb9509742..e5d5abd0ed 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -10,6 +10,8 @@ Link status = Y Queue start/stop = Y Unicast MAC filter = Y Multicast MAC filter = Y +RSS hash = Y +RSS key update = Y Linux = Y x86-64 = Y @@ -37,3 +39,4 @@ port_id = Y queue = Y raw_decap = Y raw_encap = Y +rss = Y diff --git a/drivers/net/ntnic/include/create_elements.h b/drivers/net/ntnic/include/create_elements.h index 70e6cad195..eaa578e72a 100644 --- a/drivers/net/ntnic/include/create_elements.h +++ b/drivers/net/ntnic/include/create_elements.h @@ -27,6 +27,7 @@ struct cnv_attr_s { struct cnv_action_s { struct rte_flow_action flow_actions[MAX_ACTIONS]; + struct rte_flow_action_rss flow_rss; struct flow_action_raw_encap encap; struct flow_action_raw_decap decap; struct rte_flow_action_queue queue; diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h index 2e96fa5bed..4a1525f237 100644 --- a/drivers/net/ntnic/include/flow_api.h +++ b/drivers/net/ntnic/include/flow_api.h @@ -114,6 +114,8 @@ struct flow_nic_dev { struct flow_eth_dev *eth_base; pthread_mutex_t mtx; + /* RSS hashing configuration */ + struct nt_eth_rss_conf rss_conf; /* next NIC linked list */ struct flow_nic_dev *next; }; diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 34f2cad2cd..d61044402d 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -1061,6 +1061,12 @@ static const struct flow_filter_ops ops = { .flow_destroy = flow_destroy, .flow_flush = flow_flush, .flow_dev_dump = flow_dev_dump, + + /* + * Other + */ + .hw_mod_hsh_rcp_flush = hw_mod_hsh_rcp_flush, + .flow_nic_set_hasher_fields = flow_nic_set_hasher_fields, }; void init_flow_filter(void) 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 1dfd96eaac..bbf450697c 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 @@ -603,6 +603,49 @@ static int interpret_flow_actions(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ACTION_TYPE_RSS: + NT_LOG(DBG, FILTER, "Dev:%p: RTE_FLOW_ACTION_TYPE_RSS", dev); + + if (action[aidx].conf) { + struct rte_flow_action_rss rss_tmp; + const struct rte_flow_action_rss *rss = + memcpy_mask_if(&rss_tmp, action[aidx].conf, + action_mask ? action_mask[aidx].conf : NULL, + sizeof(struct rte_flow_action_rss)); + + if (rss->key_len > MAX_RSS_KEY_LEN) { + NT_LOG(ERR, FILTER, + "ERROR: RSS hash key length %u exceeds maximum value %u", + rss->key_len, MAX_RSS_KEY_LEN); + flow_nic_set_error(ERR_RSS_TOO_LONG_KEY, error); + return -1; + } + + for (uint32_t i = 0; i < rss->queue_num; ++i) { + int hw_id = rx_queue_idx_to_hw_id(dev, rss->queue[i]); + + fd->dst_id[fd->dst_num_avail].owning_port_id = dev->port; + fd->dst_id[fd->dst_num_avail].id = hw_id; + fd->dst_id[fd->dst_num_avail].type = PORT_VIRT; + fd->dst_id[fd->dst_num_avail].active = 1; + fd->dst_num_avail++; + } + + fd->hsh.func = rss->func; + fd->hsh.types = rss->types; + fd->hsh.key = rss->key; + fd->hsh.key_len = rss->key_len; + + NT_LOG(DBG, FILTER, + "Dev:%p: RSS func: %d, types: 0x%" PRIX64 ", key_len: %d", + dev, rss->func, rss->types, rss->key_len); + + fd->full_offload = 0; + *num_queues += rss->queue_num; + } + + break; + case RTE_FLOW_ACTION_TYPE_MARK: NT_LOG(DBG, FILTER, "Dev:%p: RTE_FLOW_ACTION_TYPE_MARK", dev); diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index bfca8f28b1..1b25621537 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -214,6 +214,14 @@ eth_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info dev_info->max_rx_pktlen = HW_MAX_PKT_LEN; dev_info->max_mtu = MAX_MTU; + if (p_adapter_info->fpga_info.profile == FPGA_INFO_PROFILE_INLINE) { + dev_info->flow_type_rss_offloads = NT_ETH_RSS_OFFLOAD_MASK; + dev_info->hash_key_size = MAX_RSS_KEY_LEN; + + dev_info->rss_algo_capa = RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT) | + RTE_ETH_HASH_ALGO_CAPA_MASK(TOEPLITZ); + } + if (internals->p_drv) { dev_info->max_rx_queues = internals->nb_rx_queues; dev_info->max_tx_queues = internals->nb_tx_queues; @@ -1372,6 +1380,73 @@ promiscuous_enable(struct rte_eth_dev __rte_unused(*dev)) return 0; } +static int eth_dev_rss_hash_update(struct rte_eth_dev *eth_dev, struct rte_eth_rss_conf *rss_conf) +{ + const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops(); + + if (flow_filter_ops == NULL) { + NT_LOG_DBGX(ERR, NTNIC, "flow_filter module uninitialized"); + return -1; + } + + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + + struct flow_nic_dev *ndev = internals->flw_dev->ndev; + struct nt_eth_rss_conf tmp_rss_conf = { 0 }; + const int hsh_idx = 0; /* hsh index 0 means the default receipt in HSH module */ + int res = 0; + + if (rss_conf->rss_key != NULL) { + if (rss_conf->rss_key_len > MAX_RSS_KEY_LEN) { + NT_LOG(ERR, NTNIC, + "ERROR: - RSS hash key length %u exceeds maximum value %u", + rss_conf->rss_key_len, MAX_RSS_KEY_LEN); + return -1; + } + + rte_memcpy(&tmp_rss_conf.rss_key, rss_conf->rss_key, rss_conf->rss_key_len); + } + + tmp_rss_conf.algorithm = rss_conf->algorithm; + + tmp_rss_conf.rss_hf = rss_conf->rss_hf; + res = flow_filter_ops->flow_nic_set_hasher_fields(ndev, hsh_idx, tmp_rss_conf); + + if (res == 0) { + flow_filter_ops->hw_mod_hsh_rcp_flush(&ndev->be, hsh_idx, 1); + rte_memcpy(&ndev->rss_conf, &tmp_rss_conf, sizeof(struct nt_eth_rss_conf)); + + } else { + NT_LOG(ERR, NTNIC, "ERROR: - RSS hash update failed with error %i", res); + } + + return res; +} + +static int rss_hash_conf_get(struct rte_eth_dev *eth_dev, struct rte_eth_rss_conf *rss_conf) +{ + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + struct flow_nic_dev *ndev = internals->flw_dev->ndev; + + rss_conf->algorithm = (enum rte_eth_hash_function)ndev->rss_conf.algorithm; + + rss_conf->rss_hf = ndev->rss_conf.rss_hf; + + /* + * copy full stored key into rss_key and pad it with + * zeros up to rss_key_len / MAX_RSS_KEY_LEN + */ + if (rss_conf->rss_key != NULL) { + int key_len = rss_conf->rss_key_len < MAX_RSS_KEY_LEN ? rss_conf->rss_key_len + : MAX_RSS_KEY_LEN; + memset(rss_conf->rss_key, 0, rss_conf->rss_key_len); + rte_memcpy(rss_conf->rss_key, &ndev->rss_conf.rss_key, key_len); + rss_conf->rss_key_len = key_len; + } + + return 0; +} + static const struct eth_dev_ops nthw_eth_dev_ops = { .dev_configure = eth_dev_configure, .dev_start = eth_dev_start, @@ -1395,6 +1470,8 @@ static const struct eth_dev_ops nthw_eth_dev_ops = { .set_mc_addr_list = eth_set_mc_addr_list, .flow_ops_get = dev_flow_ops_get, .promiscuous_enable = promiscuous_enable, + .rss_hash_update = eth_dev_rss_hash_update, + .rss_hash_conf_get = rss_hash_conf_get, }; /* diff --git a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c index 87b26bd315..4962ab8d5a 100644 --- a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c +++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c @@ -317,6 +317,79 @@ int create_action_elements_inline(struct cnv_action_s *action, * Non-compatible actions handled here */ switch (type) { + case RTE_FLOW_ACTION_TYPE_RSS: { + const struct rte_flow_action_rss *rss = + (const struct rte_flow_action_rss *)actions[aidx].conf; + + switch (rss->func) { + case RTE_ETH_HASH_FUNCTION_DEFAULT: + action->flow_rss.func = + (enum rte_eth_hash_function) + RTE_ETH_HASH_FUNCTION_DEFAULT; + break; + + case RTE_ETH_HASH_FUNCTION_TOEPLITZ: + action->flow_rss.func = + (enum rte_eth_hash_function) + RTE_ETH_HASH_FUNCTION_TOEPLITZ; + + if (rte_is_power_of_2(rss->queue_num) == 0) { + NT_LOG(ERR, FILTER, + "RTE ACTION RSS - for Toeplitz the number of queues must be power of two"); + return -1; + } + + break; + + case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR: + case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ: + case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT: + case RTE_ETH_HASH_FUNCTION_MAX: + default: + NT_LOG(ERR, FILTER, + "RTE ACTION RSS - unsupported function: %u", + rss->func); + return -1; + } + + uint64_t tmp_rss_types = 0; + + switch (rss->level) { + case 1: + /* clear/override level mask specified at types */ + tmp_rss_types = rss->types & (~RTE_ETH_RSS_LEVEL_MASK); + action->flow_rss.types = + tmp_rss_types | RTE_ETH_RSS_LEVEL_OUTERMOST; + break; + + case 2: + /* clear/override level mask specified at types */ + tmp_rss_types = rss->types & (~RTE_ETH_RSS_LEVEL_MASK); + action->flow_rss.types = + tmp_rss_types | RTE_ETH_RSS_LEVEL_INNERMOST; + break; + + case 0: + /* keep level mask specified at types */ + action->flow_rss.types = rss->types; + break; + + default: + NT_LOG(ERR, FILTER, + "RTE ACTION RSS - unsupported level: %u", + rss->level); + return -1; + } + + action->flow_rss.level = 0; + action->flow_rss.key_len = rss->key_len; + action->flow_rss.queue_num = rss->queue_num; + action->flow_rss.key = rss->key; + action->flow_rss.queue = rss->queue; + action->flow_actions[aidx].conf = &action->flow_rss; + } + break; + case RTE_FLOW_ACTION_TYPE_RAW_DECAP: { const struct rte_flow_action_raw_decap *decap = (const struct rte_flow_action_raw_decap *)actions[aidx] diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 12baa13800..e40ed9b949 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -316,6 +316,13 @@ struct flow_filter_ops { int (*flow_flush)(struct flow_eth_dev *dev, uint16_t caller_id, struct rte_flow_error *error); + + /* + * Other + */ + int (*flow_nic_set_hasher_fields)(struct flow_nic_dev *ndev, int hsh_idx, + struct nt_eth_rss_conf rss_conf); + int (*hw_mod_hsh_rcp_flush)(struct flow_api_backend_s *be, int start_idx, int count); }; void register_dev_flow_ops(const struct rte_flow_ops *ops); -- 2.45.0