From patchwork Wed Jan 31 22:13:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Washington X-Patchwork-Id: 136245 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23AAB43A26; Wed, 31 Jan 2024 23:14:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E48EE42DDC; Wed, 31 Jan 2024 23:14:13 +0100 (CET) Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by mails.dpdk.org (Postfix) with ESMTP id 68C8942DCB for ; Wed, 31 Jan 2024 23:14:10 +0100 (CET) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6041c45ce1cso527867b3.1 for ; Wed, 31 Jan 2024 14:14:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706739250; x=1707344050; darn=dpdk.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pWegFo2mXANUvf5i4pDtGVcxN5FDU1BHvUx/e0NQpYk=; b=IAsgKlBi+YODD+2QffuMa7nR0ctjrTil7MksUc/2DoWmMDcN1lT8RA301w1XO0qp1n h9ybUuIdPlxkighdu3jbqg0ygV/AD/H301DO/PLiEkEhqINUqRG43eJoT2LpznzyGMS6 A6H3Gnbn48iFU/FAQ3izojIryGCKw0LwYfoq4muWeemBNQlNezuc9PZK/DwgmP/qBa1y liyaFb5zCLvKbjexsZ5g/ejfhEDnmd5fEka0+IJYz89oHNgHuR7CCbmBxrYlZRLWvklb hOOkc1DMVBJjcxTompKPzDv4uTj9qxKDPurHRIsh6tr/HkuOnUjm2Gop0xjZ4Yw5xHuf vVWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706739250; x=1707344050; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pWegFo2mXANUvf5i4pDtGVcxN5FDU1BHvUx/e0NQpYk=; b=pSL5jXglKwkxsyRMGe+eFc8sCX2kIGlMw7YJrLldJIvXo1hL59VyCdoUsw98givNAy mCyD7eec1gPlzKciC64MuH6uiHwZX5d0LLkybF3/iMJAy9/wtMwbIkUQeaELuG/A3bj+ fPAzeKUJoJFQktfEPa7P7HiOxu4jv0mdO45Csaxt8aRpAxMIDknIv9D/3bWlOnsKEOLB yPyxJxmtPko0FQcE8OL45VMXbjYCUqBLOsNCOOZfdsndjmgjxPO+kurVZ4JnnSBHwn5c RKvofRACDXN7edFn1PVobWh5Z+G0TA4m7JjhoxMP/SIlxIX5NB6gg52PPuKcsi4xvRqU VMpg== X-Gm-Message-State: AOJu0YzZ0VNnzdpe6w0rB9J1/ii/Rd4x0D0ZXs262AtsmNfgWtAHKjSu UtSbpdv5mdqXswEHa0OhugsYZjIzCggZpM5QBeYwdkBPnoT77CNsvwjSvoYrqtjupiFVhVlx1r8 DutW83iaiYg== X-Google-Smtp-Source: AGHT+IEnOEW2qji7tzQd5E4K6bk6jrybQsGRC1WqaMp1mKyq5/IVJvvB9Ay9sgH3LAPlVv6uaeZkexTCxxNqjA== X-Received: from joshwash.sea.corp.google.com ([2620:15c:11c:202:9a96:68e3:c6ee:7117]) (user=joshwash job=sendgmr) by 2002:a05:690c:f8d:b0:5ff:b07b:fb83 with SMTP id df13-20020a05690c0f8d00b005ffb07bfb83mr67683ywb.4.1706739249820; Wed, 31 Jan 2024 14:14:09 -0800 (PST) Date: Wed, 31 Jan 2024 14:13:08 -0800 In-Reply-To: <20240131221308.2208815-1-joshwash@google.com> Mime-Version: 1.0 References: <20240126173317.2779230-2-joshwash@google.com> <20240131221308.2208815-1-joshwash@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240131221308.2208815-6-joshwash@google.com> Subject: [PATCH v5 5/5] net/gve: add RSS redirection table update support From: Joshua Washington To: Junfeng Guo , Jeroen de Borst , Rushil Gupta , Joshua Washington Cc: dev@dpdk.org, Ferruh Yigit 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 introduces support for updating the RSS redirection table in the GVE PMD through the implementation of rss_reta_update and rss_reta_query. Due to an infrastructure limitation, the RSS hash key must be manually configured before the redirection table can be updated or queried. The redirection table is expected to be exactly 128 bytes. Signed-off-by: Joshua Washington Reviewed-by: Rushil Gupta Reviewed-by: Jeroen de Borst --- doc/guides/nics/features/gve.ini | 1 + doc/guides/nics/gve.rst | 8 +++ drivers/net/gve/gve_ethdev.c | 95 ++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) diff --git a/doc/guides/nics/features/gve.ini b/doc/guides/nics/features/gve.ini index 4381b1565f..8dfa229bb0 100644 --- a/doc/guides/nics/features/gve.ini +++ b/doc/guides/nics/features/gve.ini @@ -10,6 +10,7 @@ MTU update = Y TSO = Y RSS hash = Y RSS key update = Y +RSS reta update = Y L4 checksum offload = Y Basic stats = Y Linux = Y diff --git a/doc/guides/nics/gve.rst b/doc/guides/nics/gve.rst index 908b2aab11..69e4eaabdb 100644 --- a/doc/guides/nics/gve.rst +++ b/doc/guides/nics/gve.rst @@ -71,6 +71,7 @@ Supported features of the GVE PMD are: - Tx multi-segments (Scatter Tx) - Tx UDP/TCP/SCTP Checksum - RSS hash configuration +- RSS redirection table query and update Currently, only GQI_QPL and GQI_RDA queue format are supported in PMD. Jumbo Frame is not supported in PMD for now. @@ -92,3 +93,10 @@ Note that the initial configuration requires a hash key to be provided if one had not been provided before. Attempting to set hash types alone without the existence of a set key will result in a failed request. +As stated above, the RSS redirection table has exactly 128 entries. The RSS hash +must be configured before the redirection table can be updated using the standard +interface. Because the initial RSS hash creates a default redirection table, the +redirection table will be available for querying upon initial hash configuration. +When performing redirection table updates, it is possible to update individual +table entries. + diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c index 2a68d31808..3b8ec5872d 100644 --- a/drivers/net/gve/gve_ethdev.c +++ b/drivers/net/gve/gve_ethdev.c @@ -770,6 +770,97 @@ gve_rss_hash_conf_get(struct rte_eth_dev *dev, return 0; } +static int +gve_rss_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) +{ + struct gve_priv *priv = dev->data->dev_private; + struct gve_rss_config gve_rss_conf; + int table_id; + int err; + int i; + + /* RSS key must be set before the redirection table can be set. */ + if (!priv->rss_config.key || priv->rss_config.key_size == 0) { + PMD_DRV_LOG(ERR, "RSS hash key msut be set before the " + "redirection table can be updated."); + return -ENOTSUP; + } + + if (reta_size != GVE_RSS_INDIR_SIZE) { + PMD_DRV_LOG(ERR, "Redirection table must have %hu elements", + (uint16_t)GVE_RSS_INDIR_SIZE); + return -EINVAL; + } + + err = gve_init_rss_config_from_priv(priv, &gve_rss_conf); + if (err) { + PMD_DRV_LOG(ERR, "Error allocating new RSS config."); + return err; + } + + table_id = 0; + for (i = 0; i < priv->rss_config.indir_size; i++) { + int table_entry = i % RTE_ETH_RETA_GROUP_SIZE; + if (reta_conf[table_id].mask & (1ULL << table_entry)) + gve_rss_conf.indir[i] = + reta_conf[table_id].reta[table_entry]; + + if (table_entry == RTE_ETH_RETA_GROUP_SIZE - 1) + table_id++; + } + + err = gve_adminq_configure_rss(priv, &gve_rss_conf); + if (err) + PMD_DRV_LOG(ERR, "Problem configuring RSS with device."); + else + gve_update_priv_rss_config(priv, &gve_rss_conf); + + gve_free_rss_config(&gve_rss_conf); + return err; +} + +static int +gve_rss_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) +{ + struct gve_priv *priv = dev->data->dev_private; + int table_id; + int i; + + if (!(dev->data->dev_conf.rxmode.offloads & + RTE_ETH_RX_OFFLOAD_RSS_HASH)) { + PMD_DRV_LOG(ERR, "RSS not configured."); + return -ENOTSUP; + } + + /* RSS key must be set before the redirection table can be queried. */ + if (!priv->rss_config.key) { + PMD_DRV_LOG(ERR, "RSS hash key must be set before the " + "redirection table can be initialized."); + return -ENOTSUP; + } + + if (reta_size != priv->rss_config.indir_size) { + PMD_DRV_LOG(ERR, "RSS redirection table must have %d entries.", + priv->rss_config.indir_size); + return -EINVAL; + } + + table_id = 0; + for (i = 0; i < priv->rss_config.indir_size; i++) { + int table_entry = i % RTE_ETH_RETA_GROUP_SIZE; + if (reta_conf[table_id].mask & (1ULL << table_entry)) + reta_conf[table_id].reta[table_entry] = + priv->rss_config.indir[i]; + + if (table_entry == RTE_ETH_RETA_GROUP_SIZE - 1) + table_id++; + } + + return 0; +} + static const struct eth_dev_ops gve_eth_dev_ops = { .dev_configure = gve_dev_configure, .dev_start = gve_dev_start, @@ -792,6 +883,8 @@ static const struct eth_dev_ops gve_eth_dev_ops = { .xstats_get_names = gve_xstats_get_names, .rss_hash_update = gve_rss_hash_update, .rss_hash_conf_get = gve_rss_hash_conf_get, + .reta_update = gve_rss_reta_update, + .reta_query = gve_rss_reta_query, }; static const struct eth_dev_ops gve_eth_dev_ops_dqo = { @@ -816,6 +909,8 @@ static const struct eth_dev_ops gve_eth_dev_ops_dqo = { .xstats_get_names = gve_xstats_get_names, .rss_hash_update = gve_rss_hash_update, .rss_hash_conf_get = gve_rss_hash_conf_get, + .reta_update = gve_rss_reta_update, + .reta_query = gve_rss_reta_query, }; static void