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 70FC645B96; Mon, 21 Oct 2024 23:11:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2EA46427B4; Mon, 21 Oct 2024 23:06:58 +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 02DE84064C for ; Mon, 21 Oct 2024 23:06:13 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2170.outbound.protection.outlook.com [104.47.17.170]) by mx-outbound46-162.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:06:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Vm3g4SAdb/8KpsB/OlirDwoy2SVeQBdPbXZ8Od2Rok7eNDorhgC69+dP3SDnXxcws5EdCLW64GskTSu0VdQ6kq9osj7+Llxe2sSRO7SSD4/z6urz3Ut+eXUzI7im4qbDey3S8egGHYc1g3kFMek7Ombs/KhsgPduW70Q/QLuJ70HKJkkYmxfJUOdSK7rhjC+D8m0PUujFZEIl8o1y/TgrVowihLAZmClNgevYUiXCPqo2PwV1NfN8Rui8jAD/6gWKPWD5H2PNclG7lC47R9of3FRi0nznXAjhBcvQ8J/lXBWKyo15Becv88EYCTBi4H8aW3RO+4Qcwqty9bVqcTa+w== 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=7hqIMVwI0xeCSr0euqDd8I/gn8cRCu8HYJzBd91Lgdw=; b=er9nJB+RFHBNOILXGxDt/3hFGhZMDYvpQwNdhMVs/ysEK7u2aurV1ZcNYIuTemo144PL1eGV26MdG2pwfsBCVoMHumsCgXdsvQtoIw/GVlXHoLz0I9FrsXGANASCcjN/gSScTlw3YiPSfkJv318NCLBbXFkBzX2gJhkgdssD6mNqUDgwfdkPE9FjIRJFnMg0ajty4+icfsmL3XNsNbeFUpIlqLAUiZzPqrd6ze4iTYRW8jtQDp0tHPrv+UMWZaVSNUjPuuEL5Irkplg8mvGUfd0sM9d1TjUxLzOH6zMgHs0hIVrWTS0/KVuTt1CBoBI06MruFTBFBYNrwI2GsUUExg== 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=7hqIMVwI0xeCSr0euqDd8I/gn8cRCu8HYJzBd91Lgdw=; b=Q2GEKMh2cSvz6KJNGvbLG3Rp3ejKXbh6kaW/0TQomWqYKIOpne6J/xP+ZfFTAXVDmvudrA5TZ6XlVnyHZXejaVF5Wt+C5azzf/XJSyAAzG/C3R5Q9ZTKlLssYA4cm6rvwhtg8tLvbPcjJu22E8F2XwUZvwxTsl8NtpU6UmmMT2A= Received: from AS9PR04CA0135.eurprd04.prod.outlook.com (2603:10a6:20b:48a::10) by AM0P190MB0724.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:19f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 21:06:09 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::c9) by AS9PR04CA0135.outlook.office365.com (2603:10a6:20b:48a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28 via Frontend Transport; Mon, 21 Oct 2024 21:06:09 +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 AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:06:09 +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 v1 53/73] net/ntnic: enable RSS feature Date: Mon, 21 Oct 2024 23:04:55 +0200 Message-ID: <20241021210527.2075431-54-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|AM0P190MB0724:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 22aaa147-ea0a-4698-f544-08dcf2142fb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?KQKKwfdQMIJJcMIMBzu6Od5TUiitVTV9+cjBNtMKWcsIuelm+2asP9JHr1wz?= =?us-ascii?Q?mivqzlcezgl9XOPbcRfno2Y83P310BcD6/EuM5dr3Njd2U3PuaVUDinw3VG0?= =?us-ascii?Q?PEcllK/cv+mCtUwoAxYWWvXQxWxA/VKoDv9X2ixSOgLr7Cf4gCDMzG1NLmzC?= =?us-ascii?Q?Z0wPkzAWM9z3PjaOYX+Ho8GY8+ElmQqR2Dqj/vhqPCMPmhTcwWwVTzTqmze8?= =?us-ascii?Q?LgqMexV9jMpffgwo8a03KucGRNm+eXRXiUVQE5M9T0A6dMrcnIvuWsP2SvYp?= =?us-ascii?Q?eMwT7A6SikNT6I5AZvk8gyVE4ute529jSam+6Vb1t3K7bGbvFheVOh127+Oy?= =?us-ascii?Q?GM03rLDrgh5uy6zxfNhX97pzY+gcrMoivIiqw2X2e5HYOqIyRRqZhYfx6kXP?= =?us-ascii?Q?x4Q2TUg18r5V55Y3/mSuECw0bSDWDQK2O9F+B3FKdKLTeo47qThGcRC2iT7j?= =?us-ascii?Q?fKgCnQgvfhtYkk2+YOSFW+BNlGwpydxfcWSsdeI5pC/hbWQgDqPXpviWS/uD?= =?us-ascii?Q?mrtzbTokgyYzXOxjkvKdQYvSQuWLlgg7nFzohnAZA7uHTXsEEwErw+kwNhbr?= =?us-ascii?Q?3IczDjAIAs8dnkiy7tsMnhaIN6c8yPnPmH1GIM+p2cZOTidlHEfwsfFG/i//?= =?us-ascii?Q?eKUx1+eEJAnzqIq8Od7tb3mXOM6YUOnkSqI80FQdphXTKlBTO5124q+qx/Zp?= =?us-ascii?Q?dk7omz0p1nHikYMqMS81YyccXnH78DjJXF2slbQir9zJusgvr56nwGHtwmkS?= =?us-ascii?Q?QVo78ExZRUvP9SKmUL4ID1UjEZXC20BiBmv6SdH3tc5ur5Feq6EZ/kpja5Wu?= =?us-ascii?Q?Eztvi/0z5NeH5S0XvSblEXiu7+GicV4XfvOhGkihEfCJuxFzD1hRh+bmPfd5?= =?us-ascii?Q?I8EAWWoPJXUbp87tHDAaSnidnoKuE8Y/LfcAvLdcRDdNYrsWHuaSaT83Z84J?= =?us-ascii?Q?zZDTqvQA0OFYGCug+B8MX7CVUBYHaI8a1DuNqsKqUOKQ/5Na1HifrBzYQncx?= =?us-ascii?Q?bKvuekEYKKqH0aGrLjPBF6aFiuN10cQg1R8a7WvbKmkGO+0lntiJz44+9bNQ?= =?us-ascii?Q?I1vCozz1tmGebULM/Is2Fz+nU4e/AzNKp5PFMCK9MDJhoh0o1oSfEPDP3gMQ?= =?us-ascii?Q?wH8P91AvH1tGDp3N8pbDtcWy258iytz2xRYggN4P0Hj/AN6dwpr6ZG7XjC6a?= =?us-ascii?Q?zjS9GiJMDQHV/P7gEElQocIB2himmAd68Gl7FE3VAdah+nvtSMRpSdwWzq13?= =?us-ascii?Q?gdx/DflyZlJ4Ehras4nkWcb6P+sARegaUZvSRToQF5eHc+G54Z7+vlANQzVF?= =?us-ascii?Q?Q6niH38jVA6gmNbMVazMX2AE+oBeyk6lc+m+gmSUJ+Mtb+TkWnIm/K+dSd2E?= =?us-ascii?Q?3He0c8iviBeBllkLQSMzKD3Egz3T1BdOKYBRmYN/8JHdatQsfQ=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)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bm6hRJqO7wzmuJZ4i3HO+eATSQvvcXqdxsU8kEifQHzuJpujRG4qvuSGDbEUqaJr+0KwLWrVYdMVhwS75gW+9l429hP5Nz2MZQJI49Cwa2+5eDQO2RAnieFSM6u/7VvgtI55dAyuXd+o4fxxEGkH3ilVY4zqx9Gc3HoXNEq4pZGuJiQpZf9J5m5HSB17BagBLJ08ndPvBABcDnr04/tiIa4B0d9pknstH3MMoNKYoWhDvTuTdyNQknantyrW8tfSWWrEOc2HIIqFxbp2ihmjcMvt0HZvDtjNHYnor5xUYyA2PvOfAZ95JqQVs4IAs+MM9rUeWO2Ow4yCyHkNqXv3/vwnEsN2nSV0eaqU1Q4wjeF+tpZDGbTiWJnycDH+2VYllyMDI7DL3o3huNJjBYsi2S43NkARghn1LNw3x2fYTtfUrPt8E84POXv+imYwgB1CLTucmmSvgL0VsX/RijbxQvWuGnJk5y6yV1iWOpa0a0l/1G72ZwQAaWdsdd6V8wWmYT6g2xIPUR0PxwyEtcFmtaynf98NU9dXlpEGT6j9G8pE5N1UJBbGlN/uwPCAMhbgLMPHQ/fFBVFxe5eUfEJMC3GzxSe7c3s1Ox9j54o13+yTtWQFRPbIvc8ZaoCZj5FBXf+rCww4B4AYX5PhRwWLzduVzBEvlOP/Uwl4kPAvVgo= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:06:09.2083 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22aaa147-ea0a-4698-f544-08dcf2142fb5 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: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P190MB0724 X-BESS-ID: 1729544771-311938-13027-41096-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGxubmQGYGUNQyMc3CKNEiNc 0yLdHEwNIk2cDc3NLENNXMMNXUMs3SSKk2FgAUubMyQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan8-241.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 a2cb9a68b4..ea27f96865 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -1071,6 +1071,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 0cb9451390..afb1c13f57 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 @@ -602,6 +602,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