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 E65EC42DE7; Thu, 6 Jul 2023 13:56:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD769410FA; Thu, 6 Jul 2023 13:56:35 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2052.outbound.protection.outlook.com [40.107.223.52]) by mails.dpdk.org (Postfix) with ESMTP id E416A40A79 for ; Thu, 6 Jul 2023 13:56:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xn2sNWfBwv5gsLZrqHaxpyqq4itpRZZNB+m06lE7fZIE14fqwXz8GKTofvJcICOpXQqNDoehr44IwHUa5frHaMObPDp20QnhbrBcbQAp/W7QQVXbaswLbiP12lR3QnK7FfZ+XgU05X3bAncNeGghXrWFQFj7YQVoFJb5TiwxmIvkRTqCHaD7oVmQu9RE0HBjn1bzqzkJdUzay1iAj9v213cZPxpT13MrBedA7X/6bwNMEATDDw1/Cpd+AoNe3yKiZcNzWnaeW+Gds74jppaoqmTOvuQ+MM0ScpvOrHDaJPUvNS3KrfzSwymKv3rwPJ7pcj7/YN4OpwPAipq6kS5fmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Q6YaW5rETq25o4Vo0eTBV/MYN0blc515SdnbYPj5dj0=; b=Esfy39Za/WLpr75ANBkji7LJb8gu1sqAVVM8UMRZO9EVK10KZuMXjskOCtRXiCZxTV2LDcppi6BF9HJ9o4DIEaJqIDbZ2C0vQXD+Z5/VqhRmeftL7lJMjEjTwxGJ0ds7WvwKXGV7xiz4DXbgwwfnW2ZuAn2ic4agzZP1Ue0UljAWUv/9Iqwxau7XxaJLT0KqBJUXDYO0MudTZO4p+xPrztjgoBM23qRgzq6pwRqy056f5t0qsQUl3pZaO9F6aDbVH7KGp6RVctF62l9SvAIPcx2ycIhXVTiKsPLYaeXpOC6MzUYAkDvWj0hqxrE67JsfL5LCTJB8Y1T4QvyLp7LpdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q6YaW5rETq25o4Vo0eTBV/MYN0blc515SdnbYPj5dj0=; b=r+iPidqN9rReQPZPry7cMthUfTYJvrYrv3771QxNw5JXqm45FVvCdcXcUW1sg/xG+omksm54umQPeJkrnU7W9Wxw0ZqiTW3c7DvxPig4b8nNs19FIKIjj31ogIrxkqAM45ZeB7qDQICaW1wt3QNeFs1oSJsmKs/l/GIpccUubOn3c+cBJ3m9Y2NrmqmzRw8zLq/O0wgTTlzlALOWQBuPXw4my/glyGaSGeYB6DoZF1+69IUsrBlgIvTTSHr+QVxWBtb6ibRefEZZFXh59XhKNyHqWnaRhJCWQrWn2Aj9Nnj/vbHZQqA/mEoqGQNhkwfQZsI4xIVc1uuWMb3WJsMr2g== Received: from BN9PR03CA0157.namprd03.prod.outlook.com (2603:10b6:408:f4::12) by BN9PR12MB5177.namprd12.prod.outlook.com (2603:10b6:408:11a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.24; Thu, 6 Jul 2023 11:56:31 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f4:cafe::a3) by BN9PR03CA0157.outlook.office365.com (2603:10b6:408:f4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.24 via Frontend Transport; Thu, 6 Jul 2023 11:56:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.45 via Frontend Transport; Thu, 6 Jul 2023 11:56:31 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 6 Jul 2023 04:56:13 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 6 Jul 2023 04:56:10 -0700 From: Xueming Li To: Matan Azrad , Viacheslav Ovsiienko , Ori Kam , Suanming Mou CC: , Subject: [PATCH v2] net/mlx5: support symmetric RSS hash function Date: Thu, 6 Jul 2023 19:55:57 +0800 Message-ID: <20230706115557.8114-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230630073744.16247-1-xuemingl@nvidia.com> References: <20230630073744.16247-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|BN9PR12MB5177:EE_ X-MS-Office365-Filtering-Correlation-Id: 150bcc2e-ea91-4edb-9ddf-08db7e1809ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8rrjGjC9E31AfCxQCHkZf31K8/asLnxTc6gk6RQiKtEVklzV1Z4XYdLSPJIl8unZptGc6mJViW42nBljlpUjoymOM008VJRABNarVtuyjZUBl0QqRRzHy8b/z4z9Zbv8lw+utIt76pQloZPQLqlflLiKxw/CkRpDDPcJO2t+OQ1P2wGlOwNCv5xDU2Wyj0g3EUg3TtBFYOMMXJva50fPPH46cnx3BKnycU9/v3nr/DH0NpzZrs2uk4lqUDNkpNkg6Tjeezh+ey7SDQ2WpnXVMAYC1iw2kPbjzn0Ig9jIDcDasCLkJ5USNJcjMUGMr4vyA6DKdO/M0P97IA1lPFkazVn8QMYnISAXcAg+yQK70Rhodfr+XwWC9u1IUS0r0SajIm7oPP7ldgdkEDmECHeVLLXLQDui+Wx51J8tGBTivGmmvjMyrr4Az4ciheDQEFy6OJRBsZ+Fc7bBwo0VTnb+zaV6k+yj0C+50oVCwuIWM4YbzyXcrIEzQTBa/+MJYj02K1Ix09e3lf1jitNibQCsCx5wOq/VFf0hHHp5svrC3JfpSblysxfDyh8x2WWy8V+qQX7WX51ZVVCqn2IgwenwfouVvxgShYm1hzPdBTk23zbwNf4TwFZX6wzxfwbVKtM0xHrbEF20eP9sCF2/0ZSnxIxk+0/4cUp/V3pIldN79rjqkzg98MyJqSNdC+sxHrE/7AeXZ6N2sMMX+g3NgQIiYEqezcH2JeQ2WHBVPvCOc+/LTY4qouUL+JoJ/XAJlCz6op8bBV/d3pg7TLQoE15Kk9biSY1HtxnNRnbcU41PM4g= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(346002)(376002)(136003)(396003)(451199021)(36840700001)(46966006)(40470700004)(426003)(336012)(47076005)(36860700001)(83380400001)(82740400003)(356005)(7636003)(86362001)(36756003)(40480700001)(55016003)(82310400005)(40460700003)(478600001)(54906003)(110136005)(6666004)(7696005)(8676002)(8936002)(5660300002)(316002)(4326008)(6636002)(41300700001)(2906002)(70206006)(70586007)(30864003)(186003)(6286002)(16526019)(2616005)(1076003)(26005)(21314003)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 11:56:31.1555 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 150bcc2e-ea91-4edb-9ddf-08db7e1809ea X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5177 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 This patch supports symmetric hash function that creating same hash result for bi-direction traffic which having reverse source and destination IP and L4 port. Since the hash algorithom is different than spec(XOR), leave a warning in validation. Signed-off-by: Xueming Li --- doc/guides/nics/mlx5.rst | 4 ++++ drivers/net/mlx5/mlx5.h | 3 +++ drivers/net/mlx5/mlx5_devx.c | 11 ++++++++--- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow.h | 5 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 7 +++++++ drivers/net/mlx5/mlx5_rx.h | 2 +- drivers/net/mlx5/mlx5_rxq.c | 8 +++++--- 9 files changed, 53 insertions(+), 10 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index b9843edbd9..20420c7feb 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -110,6 +110,7 @@ Features and source only, destination only or both. - Several RSS hash keys, one for each flow type. - Default RSS operation with no hash key specification. +- Symmetric RSS function. - Configurable RETA table. - Link flow control (pause frame). - Support for multiple MAC addresses. @@ -708,6 +709,9 @@ Limitations The flow engine of a process cannot move from active to standby mode if preceding active application rules are still present and vice versa. +- The symmetric RSS function is supported by swapping source and desitination + addresses and ports + Statistics ---------- diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 2a82348135..b7534933bc 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1509,6 +1509,7 @@ struct mlx5_mtr_config { /* RSS description. */ struct mlx5_flow_rss_desc { + bool symmetric_hash_function; /**< Symmetric hash function */ uint32_t level; uint32_t queue_num; /**< Number of entries in @p queue. */ uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */ @@ -1577,6 +1578,7 @@ struct mlx5_hrxq { #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) void *action; /* DV QP action pointer. */ #endif + bool symmetric_hash_function; /* Symmetric hash function */ uint32_t hws_flags; /* Hw steering flags. */ uint64_t hash_fields; /* Verbs Hash fields. */ uint32_t rss_key_len; /* Hash key length in bytes. */ @@ -1648,6 +1650,7 @@ struct mlx5_obj_ops { int (*hrxq_modify)(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, const uint8_t *rss_key, uint64_t hash_fields, + bool symmetric_hash_function, const struct mlx5_ind_table_obj *ind_tbl); void (*hrxq_destroy)(struct mlx5_hrxq *hrxq); int (*drop_action_create)(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c index 4369d2557e..f9d8dc6987 100644 --- a/drivers/net/mlx5/mlx5_devx.c +++ b/drivers/net/mlx5/mlx5_devx.c @@ -803,7 +803,8 @@ static void mlx5_devx_tir_attr_set(struct rte_eth_dev *dev, const uint8_t *rss_key, uint64_t hash_fields, const struct mlx5_ind_table_obj *ind_tbl, - int tunnel, struct mlx5_devx_tir_attr *tir_attr) + int tunnel, bool symmetric_hash_function, + struct mlx5_devx_tir_attr *tir_attr) { struct mlx5_priv *priv = dev->data->dev_private; bool is_hairpin; @@ -834,6 +835,7 @@ mlx5_devx_tir_attr_set(struct rte_eth_dev *dev, const uint8_t *rss_key, tir_attr->disp_type = MLX5_TIRC_DISP_TYPE_INDIRECT; tir_attr->rx_hash_fn = MLX5_RX_HASH_FN_TOEPLITZ; tir_attr->tunneled_offload_en = !!tunnel; + tir_attr->rx_hash_symmetric = symmetric_hash_function; /* If needed, translate hash_fields bitmap to PRM format. */ if (hash_fields) { struct mlx5_rx_hash_field_select *rx_hash_field_select = @@ -902,7 +904,8 @@ mlx5_devx_hrxq_new(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, int err; mlx5_devx_tir_attr_set(dev, hrxq->rss_key, hrxq->hash_fields, - hrxq->ind_table, tunnel, &tir_attr); + hrxq->ind_table, tunnel, hrxq->symmetric_hash_function, + &tir_attr); hrxq->tir = mlx5_devx_cmd_create_tir(priv->sh->cdev->ctx, &tir_attr); if (!hrxq->tir) { DRV_LOG(ERR, "Port %u cannot create DevX TIR.", @@ -969,13 +972,13 @@ static int mlx5_devx_hrxq_modify(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, const uint8_t *rss_key, uint64_t hash_fields, + bool symmetric_hash_function, const struct mlx5_ind_table_obj *ind_tbl) { struct mlx5_devx_modify_tir_attr modify_tir = {0}; /* * untested for modification fields: - * - rx_hash_symmetric not set in hrxq_new(), * - rx_hash_fn set hard-coded in hrxq_new(), * - lro_xxx not set after rxq setup */ @@ -983,11 +986,13 @@ mlx5_devx_hrxq_modify(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, modify_tir.modify_bitmask |= MLX5_MODIFY_TIR_IN_MODIFY_BITMASK_INDIRECT_TABLE; if (hash_fields != hrxq->hash_fields || + symmetric_hash_function != hrxq->symmetric_hash_function || memcmp(hrxq->rss_key, rss_key, MLX5_RSS_HASH_KEY_LEN)) modify_tir.modify_bitmask |= MLX5_MODIFY_TIR_IN_MODIFY_BITMASK_HASH; mlx5_devx_tir_attr_set(dev, rss_key, hash_fields, ind_tbl, 0, /* N/A - tunnel modification unsupported */ + symmetric_hash_function, &modify_tir.tir); modify_tir.tirn = hrxq->tir->id; if (mlx5_devx_cmd_modify_tir(hrxq->tir, &modify_tir)) { diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index df0f1dfe52..a8c53f227c 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2164,8 +2164,11 @@ mlx5_validate_action_rss(struct rte_eth_dev *dev, const char *message; uint32_t queue_idx; - if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT && - rss->func != RTE_ETH_HASH_FUNCTION_TOEPLITZ) + if (rss->func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) { + DRV_LOG(WARNING, "port %u symmetric RSS supported with SORT", + dev->data->port_id); + } else if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT && + rss->func != RTE_ETH_HASH_FUNCTION_TOEPLITZ) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, &rss->func, @@ -5578,6 +5581,8 @@ get_meter_sub_policy(struct rte_eth_dev *dev, items, rss_actions, error)) goto exit; rss_desc_v[i] = wks->rss_desc; + rss_desc_v[i].symmetric_hash_function = + dev_flow.symmetric_hash_function; rss_desc_v[i].key_len = MLX5_RSS_HASH_KEY_LEN; rss_desc_v[i].hash_fields = dev_flow.hash_fields; @@ -7275,6 +7280,7 @@ flow_list_create(struct rte_eth_dev *dev, enum mlx5_flow_type type, rss = flow_get_rss_action(dev, p_actions_rx); if (rss) { MLX5_ASSERT(rss->queue_num <= RTE_ETH_RSS_RETA_SIZE_512); + rss_desc->symmetric_hash_function = MLX5_RSS_IS_SYMM(rss->func); /* * The following information is required by * mlx5_flow_hashfields_adjust() in advance. diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 62789853ab..3d89afb802 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -900,6 +900,7 @@ struct mlx5_flow { bool external; /**< true if the flow is created external to PMD. */ uint8_t ingress:1; /**< 1 if the flow is ingress. */ uint8_t skip_scale:2; + uint8_t symmetric_hash_function:1; /** * Each Bit be set to 1 if Skip the scale the flow group with factor. * If bit0 be set to 1, then skip the scale the original flow group; @@ -1249,6 +1250,7 @@ struct mlx5_action_construct_data { uint32_t mask[MLX5_ACT_MAX_MOD_FIELDS]; } modify_header; struct { + bool symmetric_hash_function; /* Symmetric RSS hash */ uint64_t types; /* RSS hash types. */ uint32_t level; /* RSS level. */ uint32_t idx; /* Shared action index. */ @@ -1452,6 +1454,9 @@ struct rte_flow_template_table { MLX5_RSS_HASH_ESP_SPI) #define MLX5_RSS_HASH_NONE 0ULL +#define MLX5_RSS_IS_SYMM(func) \ + ((func) == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) + /* extract next protocol type from Ethernet & VLAN headers */ #define MLX5_ETHER_TYPE_FROM_HEADER(_s, _m, _itm, _prt) do { \ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 8290d085ba..a8dd9920e6 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -12006,6 +12006,7 @@ flow_dv_hrxq_prepare(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq; MLX5_ASSERT(rss_desc->queue_num); + rss_desc->symmetric_hash_function = dev_flow->symmetric_hash_function; rss_desc->key_len = MLX5_RSS_HASH_KEY_LEN; rss_desc->hash_fields = dev_flow->hash_fields; rss_desc->tunnel = !!(dh->layers & MLX5_FLOW_LAYER_TUNNEL); @@ -12550,6 +12551,8 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev, const uint8_t *rss_key; rss = sub_actions->conf; + rss_desc->symmetric_hash_function = + MLX5_RSS_IS_SYMM(rss->func); memcpy(rss_desc->queue, rss->queue, rss->queue_num * sizeof(uint16_t)); rss_desc->queue_num = rss->queue_num; @@ -14478,6 +14481,8 @@ flow_dv_translate(struct rte_eth_dev *dev, break; case RTE_FLOW_ACTION_TYPE_RSS: rss = actions->conf; + rss_desc->symmetric_hash_function = + MLX5_RSS_IS_SYMM(rss->func); memcpy(rss_desc->queue, rss->queue, rss->queue_num * sizeof(uint16_t)); rss_desc->queue_num = rss->queue_num; @@ -14944,10 +14949,12 @@ flow_dv_translate(struct rte_eth_dev *dev, error); if (ret) return -rte_errno; - if (action_flags & MLX5_FLOW_ACTION_RSS) + if (action_flags & MLX5_FLOW_ACTION_RSS) { + dev_flow->symmetric_hash_function = rss_desc->symmetric_hash_function; flow_dv_hashfields_set(dev_flow->handle->layers, rss_desc, &dev_flow->hash_fields); + } /* If has RSS action in the sample action, the Sample/Mirror resource * should be registered after the hash filed be update. */ @@ -16022,6 +16029,8 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev, "cannot setup indirection table"); memcpy(rss_desc.key, shared_rss->origin.key, MLX5_RSS_HASH_KEY_LEN); rss_desc.key_len = MLX5_RSS_HASH_KEY_LEN; + rss_desc.symmetric_hash_function = + MLX5_RSS_IS_SYMM(shared_rss->origin.func); rss_desc.const_q = shared_rss->origin.queue; rss_desc.queue_num = shared_rss->origin.queue_num; /* Set non-zero value to indicate a shared RSS. */ @@ -19146,6 +19155,8 @@ flow_dv_mtr_policy_rss_compare(const struct rte_flow_action_rss *r1, if (!(r1->level <= 1 && r2->level <= 1) && !(r1->level > 1 && r2->level > 1)) return 1; + if (r1->func != r2->func) + return 1; if (r1->types != r2->types && !((r1->types == 0 || r1->types == RTE_ETH_RSS_IP) && (r2->types == 0 || r2->types == RTE_ETH_RSS_IP))) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 330386df77..0a62add823 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -405,6 +405,7 @@ flow_hw_tir_action_register(struct rte_eth_dev *dev, MLX5_RSS_HASH_KEY_LEN); rss_desc.key_len = MLX5_RSS_HASH_KEY_LEN; rss_desc.types = !rss->types ? RTE_ETH_RSS_IP : rss->types; + rss_desc.symmetric_hash_function = MLX5_RSS_IS_SYMM(rss->func); flow_hw_hashfields_set(&rss_desc, &rss_desc.hash_fields); flow_dv_action_rss_l34_hash_adjust(rss->types, &rss_desc.hash_fields); @@ -674,6 +675,8 @@ __flow_hw_act_data_shared_rss_append(struct mlx5_priv *priv, act_data->shared_rss.types = !rss->origin.types ? RTE_ETH_RSS_IP : rss->origin.types; act_data->shared_rss.idx = idx; + act_data->shared_rss.symmetric_hash_function = + MLX5_RSS_IS_SYMM(rss->origin.func); LIST_INSERT_HEAD(&acts->act_list, act_data, next); return 0; } @@ -1913,6 +1916,7 @@ flow_hw_shared_action_get(struct rte_eth_dev *dev, case MLX5_RTE_FLOW_ACTION_TYPE_RSS: rss_desc.level = act_data->shared_rss.level; rss_desc.types = act_data->shared_rss.types; + rss_desc.symmetric_hash_function = act_data->shared_rss.symmetric_hash_function; flow_dv_hashfields_set(item_flags, &rss_desc, &hash_fields); hrxq_idx = flow_dv_action_rss_hrxq_lookup (dev, act_data->shared_rss.idx, hash_fields); @@ -2000,6 +2004,9 @@ flow_hw_shared_action_construct(struct rte_eth_dev *dev, uint32_t queue, act_data.shared_rss.types = !shared_rss->origin.types ? RTE_ETH_RSS_IP : shared_rss->origin.types; + act_data.shared_rss.symmetric_hash_function = + MLX5_RSS_IS_SYMM(shared_rss->origin.func); + item_flags = table->its[it_idx]->item_flags; if (flow_hw_shared_action_get (dev, &act_data, item_flags, rule_act)) diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index 3514edd84e..690eb25aae 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -284,7 +284,7 @@ uint64_t mlx5_get_rx_queue_offloads(struct rte_eth_dev *dev); void mlx5_rxq_timestamp_set(struct rte_eth_dev *dev); int mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hxrq_idx, const uint8_t *rss_key, uint32_t rss_key_len, - uint64_t hash_fields, + uint64_t hash_fields, bool symmetric_hash_function, const uint16_t *queues, uint32_t queues_n); /* mlx5_rx.c */ diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index b314c0482b..ec713009d7 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2759,6 +2759,7 @@ mlx5_hrxq_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, struct mlx5_hrxq *hrxq = container_of(entry, typeof(*hrxq), entry); return (hrxq->rss_key_len != rss_desc->key_len || + hrxq->symmetric_hash_function != rss_desc->symmetric_hash_function || memcmp(hrxq->rss_key, rss_desc->key, rss_desc->key_len) || hrxq->hws_flags != rss_desc->hws_flags || hrxq->hash_fields != rss_desc->hash_fields || @@ -2792,7 +2793,7 @@ mlx5_hrxq_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, int mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx, const uint8_t *rss_key, uint32_t rss_key_len, - uint64_t hash_fields, + uint64_t hash_fields, bool symmetric_hash_function, const uint16_t *queues, uint32_t queues_n) { int err; @@ -2837,8 +2838,8 @@ mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx, return -rte_errno; } MLX5_ASSERT(priv->obj_ops.hrxq_modify); - ret = priv->obj_ops.hrxq_modify(dev, hrxq, rss_key, - hash_fields, ind_tbl); + ret = priv->obj_ops.hrxq_modify(dev, hrxq, rss_key, hash_fields, + symmetric_hash_function, ind_tbl); if (ret) { rte_errno = errno; goto error; @@ -2938,6 +2939,7 @@ __mlx5_hrxq_create(struct rte_eth_dev *dev, hrxq->rss_key_len = rss_key_len; hrxq->hash_fields = rss_desc->hash_fields; hrxq->hws_flags = rss_desc->hws_flags; + hrxq->symmetric_hash_function = rss_desc->symmetric_hash_function; memcpy(hrxq->rss_key, rss_key, rss_key_len); ret = priv->obj_ops.hrxq_new(dev, hrxq, rss_desc->tunnel); if (ret < 0) -- 2.25.1