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 E95D442D73; Fri, 30 Jun 2023 09:55:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C264F406B5; Fri, 30 Jun 2023 09:55:03 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2069.outbound.protection.outlook.com [40.107.220.69]) by mails.dpdk.org (Postfix) with ESMTP id 063614021F for ; Fri, 30 Jun 2023 09:55:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YwxDrejY7lQ5GKGcLJe8X73I5IzFYhhBP/23JzZ32KfviH3I7qB+f5kSzr/FQSCkLA/LC5E4yS8x6Y3sgTyn+jq8iRMpDqq6MGrYQKvfix8T5DW2m1C3kcOJnZWCFt/6R+FQkp8UW+gQQASKrY2lfFwakrjrJ7ceRVKMujAyBrZnMFTeuZxcOjDx5aJgdPptj8stImwSs00mspvDhXc9bmdz2sPyJawhsEEUjNaXi+WXDpR+3e8siOYRbYzu2Ms+DEMmvCUXLO0q9ng85IhphvNrveyFQrfuz0Q7MrVAu8adIDj3Jd7OPJ70n+EbXCtwxZw+yrnms9kvXN5arlAONg== 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=oLjiEHBpUYmNF5MICDNQlPQ9WV72CwG/idHFTRFjkPc=; b=YZqV83kqULxhFnOAKAPKRDjmz1yKdkRLPHJxVN5cGNAfMGQ/zOfo+oG0FvKE2pol8+qRcaMbwegTqh9ezlvMl8BjBQ8pRpq/vmwIVhou/dFSH5CR8f+1hjQuxu4RqZipUSGSrWY/VPFn/3K5fTJQHA9jth15pEPM4lC9AKGdxBaeUoHhoHK8b1WeeI2X2iSaJCoyc8px1Fa5LUxIuSm5ep5X6zbaDPly8MeXD4Qe2fjnU0aP9NRHW1LakhwlLusUWnMzAZ72SyXRTeDQK1cokB12Din+TCPVllxO3ZhsLZLq2UdUMlmoG8srxWOrwjr9ZpTA2iOAovkhou+SJgHqXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=oLjiEHBpUYmNF5MICDNQlPQ9WV72CwG/idHFTRFjkPc=; b=dxDMW2N/zc+tbFFrpJlhxUGbkVLNRqjuwfunc6SoOrF8oP60zw9Qf7tWeFyB0vIgJtc0ahTMico7bAfoFh1yX+PxXRMZsj+HnDQir5i08IhV3Xwc2dVPagOlHLnOkoehMRoo2C16CJU+/AmX7SxLoR9XxiFgnBHQEDlM9PAI0XWEuhD7cZRzvthrJhsbVSyNbVgKDijbLvPPRlZS7MG9h0sXgXMiUHziFA8ROjWWGpexjuWuc2bHVOaf4Xa2xMKHAgVNacw4XnxDxiNu/Wwl0vr/Il7hYCcTLRYFh3uue4D+ZY9eS9o73OJ6kqA9mb+URcQJCjIUeaWe9QjM7UohMg== Received: from MW4PR03CA0039.namprd03.prod.outlook.com (2603:10b6:303:8e::14) by DM4PR12MB5375.namprd12.prod.outlook.com (2603:10b6:5:389::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Fri, 30 Jun 2023 07:54:59 +0000 Received: from CO1NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::7c) by MW4PR03CA0039.outlook.office365.com (2603:10b6:303:8e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 07:54:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT107.mail.protection.outlook.com (10.13.175.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.48 via Frontend Transport; Fri, 30 Jun 2023 07:54:59 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 30 Jun 2023 00:54:56 -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; Fri, 30 Jun 2023 00:54:53 -0700 From: Xueming Li To: Matan Azrad , Viacheslav Ovsiienko , Ori Kam , Suanming Mou CC: , Subject: [PATCH v1] net/mlx5: support symmetric RSS hash function Date: Fri, 30 Jun 2023 15:54:39 +0800 Message-ID: <20230630075439.19359-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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT107:EE_|DM4PR12MB5375:EE_ X-MS-Office365-Filtering-Correlation-Id: 92458f0c-f3ef-4700-a767-08db793f4dba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XLyuyQRKsszLWZFUTAtmhG+jNlVnu0wWV35Yn5FdRcheB/WePEx3yTd+9s4xH/gU8+jYf7IwXl+HA7psf37Fltf6gxwHnpNL1dsivX50K5rjL2xfvPkOlPTdpw25rAmXONNW8566rZgnH/DeFKNiM55gAKUGA2CsK0rOopjiE9lRmSvDrKwAvd9QLnIumEvJztajQGdNd6QvNwR1De5ZE+zcn/FK3VdC30IXGLkQ6iu/s7bvjtCzMRxXOQzR5lrkrQGgHZ3oobcxzPuL5nmrqS7i+7TX9GGN2TIsdb7x+R/OPMn+YP8IRKs1ObYgxYQICCMuWyzhSRKcuAHBiX0wcwiuDTtpchPj/dUcZLaIqNaeuaeHO93m9nc9kGqkWT1vxD9ODUwE/BrOL9fTVeZyyfDZilSpC3U68yUf9YpzVeeQWzeNkXqNJN6P/N1fSEtKC19GWuNUYv/FUmoxd1ZDKhH6/bDl2Zyn5xgVreT/rEmRmXgL6xWWLcHZqscldov2f/CcTgGZL5kAAgG1MYtAMqJQsLjWvG1RY34a/YIbEPiYGd28yS06dStWc+LK/Bx/lC6OLIuE/r8cwNw7ZptlecinBy1YZMGHW6sXvfUZ4c776OEs6zaQVq0FJrzWWbewxgOpOT+KlG4eAMpwQ4irxWdAw2XbUfqEvdTZ+lJDTQhCHxUh9KVEPCh7YwA1rM/vw7yKu9K4LnqrZQ7d9HhG9j6aj6D6+j44xHlPgtT/CPRalXMJmqdpg3ZqWI13aGEOqwVBUpzxbRtB+KEvKMo+i7/fUM+K+CGHFSxshO1f6IQ= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199021)(40470700004)(46966006)(36840700001)(86362001)(36756003)(110136005)(54906003)(70206006)(316002)(70586007)(6636002)(4326008)(6666004)(478600001)(7696005)(40480700001)(55016003)(82310400005)(1076003)(41300700001)(8676002)(8936002)(30864003)(2906002)(5660300002)(82740400003)(356005)(7636003)(2616005)(336012)(426003)(83380400001)(16526019)(186003)(26005)(6286002)(36860700001)(47076005)(40460700003)(21314003)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 07:54:59.6098 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92458f0c-f3ef-4700-a767-08db793f4dba 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5375 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 --- 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 +++++--- 8 files changed, 49 insertions(+), 10 deletions(-) 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 cf83db7b60..6c1703bbed 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2163,8 +2163,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, @@ -5577,6 +5580,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; @@ -7305,6 +7310,7 @@ flow_list_create(struct rte_eth_dev *dev, enum mlx5_flow_type type, if (rss) { if (flow_rss_workspace_adjust(wks, rss_desc, rss->queue_num)) return 0; + 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 003e7da3a6..79d7907ac2 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 b5137a822a..3dc1810bd7 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; } @@ -1911,6 +1914,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); @@ -1998,6 +2002,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 ad8fd13cbe..7d0ecc1126 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