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 6CF8E42DA8; Mon, 3 Jul 2023 11:21:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4564242D31; Mon, 3 Jul 2023 11:21:19 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2045.outbound.protection.outlook.com [40.107.220.45]) by mails.dpdk.org (Postfix) with ESMTP id C3F0141143 for ; Sun, 2 Jul 2023 06:58:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5+33nkcn1keoTuBmQHAoHFjKW9GXa9xtLClDB90SWtNHfLxqwMxy1C73zzf2TsJG4nBlsH+UpSjw9jRaCA9sQifPXQ43Z31cR6JG7Jd2YrIKqJyRHno6BLj3W3yTI6uP+qzxNzV/kCUkowkK/ixSuFoEfOdTo+HPNeYrbsw25X6VrpLjSCT6KXLoa1v/6MNBfFDQIS7Ml186OPGyV1Wa4zOCg+rGfhRZ2Pyj/gVmj0OnjNO9Er7vAljbr/CXX/L3BxFQ3L0umH636JrvWJJB+3A4f1Xy+pKxw0Mpmnk5jSm2sqxp0+Nty4V78/DF2XDU9XGVr5apfoq0W/VO7+ZQw== 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=K/+5doOkMxfIEW1Pma3Zo5G+QfLLO4pTqQSHnF1S0r4=; b=FBuf6j7FjAOzqX3TuaWmT4xzEekPVYiXqrIuHhofN8KOuX3m2G1Fc7OQ2n1z/Xc4eb7fttRMrsmuxtAm/XJZM1N4lRkBs+n4M5LLOV3fTXJqYxRUILrIEurOAK2RXuahmVTD51vaOnllaCB1QQNjrd3QWG645q9qQpkT7lSL1pawmmySsruscww4yqhdMsVnWZtJFCFMtOSWQO6VkLOKmWDAxPpHDRcptVn4xs60+U9X9zIJ5/fk0lh3DJl7qIMDz5qMgen1XpkOQf5/tFVZf7lm5fDTTAb9g7d9rL3dNBCluRtpXFNdT/LR9KZTHolvG8ZEovrop4Shu38YPj2cmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=monjalon.net 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=K/+5doOkMxfIEW1Pma3Zo5G+QfLLO4pTqQSHnF1S0r4=; b=HyNx6uwgLPqpt/gKsCY9BM8TX7vUmoxnWIbStijY+XDo8uBO9BEmFvd8vUMIXFFzaTIURC/7/YFRZHZ9fGHJvKOK3Qfpzk6+FTFZl/LObXrVzC+Qf3uetfFz3vajUql0DC2ijACh8CCC81PDAxVSh6FF/LPYdb3YJDdwR6y01WFlGC/+89c0JMrmIfsrPxRciVPQoJEWnyn6xDu5dPWglOwldLBP+WECz+86RnPgpmwG7DsZ9xsvNOZsF5l7sMUA23o9Vn8wLGSW+N9QYvMiivsHo9xhv1rr3IStfH0CZunPZChd463ObMg6wXKSQuTBbLzeNBWhcslpP48H6hAHHw== Received: from DS7PR03CA0190.namprd03.prod.outlook.com (2603:10b6:5:3b6::15) by IA0PR12MB7776.namprd12.prod.outlook.com (2603:10b6:208:430::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Sun, 2 Jul 2023 04:58:31 +0000 Received: from DM6NAM11FT088.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::f7) by DS7PR03CA0190.outlook.office365.com (2603:10b6:5:3b6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.26 via Frontend Transport; Sun, 2 Jul 2023 04:58: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 DM6NAM11FT088.mail.protection.outlook.com (10.13.172.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.43 via Frontend Transport; Sun, 2 Jul 2023 04:58:30 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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; Sat, 1 Jul 2023 21:58:16 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sat, 1 Jul 2023 21:58:15 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Sat, 1 Jul 2023 21:58:13 -0700 From: Itamar Gozlan To: , , , , CC: , , Xueming Li Subject: [v2 4/5] net/mlx5: support symmetric RSS hash function Date: Sun, 2 Jul 2023 07:57:57 +0300 Message-ID: <20230702045758.23244-4-igozlan@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230702045758.23244-1-igozlan@nvidia.com> References: <20230629072125.20369-5-igozlan@nvidia.com> <20230702045758.23244-1-igozlan@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT088:EE_|IA0PR12MB7776:EE_ X-MS-Office365-Filtering-Correlation-Id: 55d398fc-1a71-4041-edaa-08db7ab8fb3c X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wQeRmeqeSv0f7ozy5P2+2B1cMTgqjoO2HD7rUV86PAbZTbFQaaZLxNA/XPq+QUFbTZ1jvjs2KUEkoTyQVgBSUa/HKI65iN8ndlZN6H96GFeesIHtjX7QAKpqoboC15vvbb21NvQSZs/sbT5uaOMNMXXnc3e0V9HRoZguvf2Un3fUKB262R4uURTFWd5+juUHC1V+YpxI270mLZXF/hCGiO94D2Caygprxj6TxqThfUzgV2mpPW0L60YsXBDmdcqVs80cyUYHWQk6fDCqYMTkdq5eBBIHXxkNSWkyxEVNsbKWdUvq5ZG4AAta9+zMGcXtqPtHFft2zzZDNNiikV6uDmAJrGGy+k2eRexyTTNDQSNqqJyJ9HfVjwnNqJgleW7hRpHCE1NG64Oc8XtGP7JHb6pprLoLGfxvHg6v8MiSqvJd3tXQOFPEiXqaQhFNb69Svzw84jCznclsdPQ+kjbEgCFyImxfV8QWZimnPgcH1RDuzdiRuyNPtv1obdh8N7cuFZnBOY8LFA6ggbLvE9jf5aiphJ0Sqo4W8MxlpFBbahOWB0CJ0cL1Kcu2wlIvM6YZUisKf+Vt8I4PFplt84xZwRohiv5UqCbyMXI+Jej7VQgfYfhywKj0J/Gcc0pLRptKzgqqXnNRkmjA19pexUQF6UQosYpW3q4j9W/xYZM2hAqi97Kq1k3mKW0routIZzVzil2LB2JlyFvu8lOesHXECWlQONRrA/AokA1xVJHzA9UMRRIXuke0ou5VFQas5cZAk5KT1e1gAUh6j91lNdBWLvLhvv+YlH24wPjffTMKBqM= 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)(396003)(346002)(376002)(136003)(451199021)(36840700001)(40470700004)(46966006)(55016003)(336012)(426003)(83380400001)(40460700003)(47076005)(30864003)(2616005)(2906002)(7636003)(356005)(82740400003)(36860700001)(40480700001)(36756003)(8936002)(8676002)(82310400005)(110136005)(5660300002)(86362001)(107886003)(54906003)(41300700001)(6636002)(4326008)(70206006)(70586007)(6666004)(316002)(7696005)(478600001)(6286002)(186003)(1076003)(26005)(21314003)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2023 04:58:30.9140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55d398fc-1a71-4041-edaa-08db7ab8fb3c 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: DM6NAM11FT088.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7776 X-Mailman-Approved-At: Mon, 03 Jul 2023 11:21:13 +0200 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: Xueming Li 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 b5b809633c..4fc67c4f36 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1579,6 +1579,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_*). */ @@ -1647,6 +1648,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. */ @@ -1718,6 +1720,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 5082a7e178..d286cfe864 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 45f2210ae7..572763decf 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2204,8 +2204,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, @@ -5720,6 +5723,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.symmetri_hash_function; rss_desc_v[i].key_len = MLX5_RSS_HASH_KEY_LEN; rss_desc_v[i].hash_fields = dev_flow.hash_fields; @@ -7424,6 +7429,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 e273bd958d..e39afc47ad 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1003,6 +1003,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 symmetri_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; @@ -1353,6 +1354,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. */ @@ -1575,6 +1577,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 bae74fd383..ca2143c7cd 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -12875,6 +12875,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->symmetri_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); @@ -13419,6 +13420,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; @@ -15466,6 +15469,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; @@ -15948,10 +15953,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->symmetri_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. */ @@ -17029,6 +17036,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. */ @@ -20153,6 +20162,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 5e5ebbe620..3d2d240f43 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -431,6 +431,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); @@ -716,6 +717,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; } @@ -2217,6 +2220,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); @@ -2304,6 +2308,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 ff48194b9f..bc60dcaeb1 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -282,7 +282,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 6e99c4dde4..77936d463a 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.18.1