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 7045B439AD; Wed, 24 Jan 2024 01:05:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E818441151; Wed, 24 Jan 2024 01:04:47 +0100 (CET) Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by mails.dpdk.org (Postfix) with ESMTP id 6C85A410FB for ; Wed, 24 Jan 2024 01:04:46 +0100 (CET) Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-5c65e666609so5458499a12.1 for ; Tue, 23 Jan 2024 16:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706054685; x=1706659485; 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=SW3JZkFSSD1naxRvmY8VsdB4LML2W8ItAZao49jLPo0=; b=KXNpH7o2KRZSliu4juY0sIf9XvRkk277VLBs6vr6tAUZVmewjAP4voakgz/Cq7TxY2 S+RsJTmsibfS/NoZr5bS+3bQBxEaZTRZyvn7J17O28LDLMILMyQaYSieqgPhAsU5tZdY 0oXabDP1Byg7xEsWRAiIodMaBoDfSK9lIOubthbbopA8Gc+HwP8G0DLf2Yu7isi4q7Uq 0E4vxFatwC73ErTfQGVOVHaMGwG6iwy84ERkTbd0tpg/oGYKMN583p/5jPX1CtMlT9jD p+YOsMdMPtvoIh3IFixGXDYBQzHAg3UOTwVc/yY0vibPwuLMO5HBg+u4waxisQ9JzSBM pakA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706054685; x=1706659485; 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=SW3JZkFSSD1naxRvmY8VsdB4LML2W8ItAZao49jLPo0=; b=Tb34MuibyappHzgVr1YlOQs6DplCK5+4VAHb7lmOxDrmKRwAG+Et6eBdcUazeSuIv8 kBXWQohTQCaiel1MbWuHvr+HA3CVFhiEjaJdQ5YH/6iEc+JzuFbYVegyPAOnQRgN37PO bMu6vdi4WVQoX+11Rmpo/jOuWXjFzT0899k5eRlA28ZJt3YHBx0aq5UuoMf/9HDkzNC/ EqnyAy8GnPpDXw87BLtyT4Oq9aP1VzDINXsuXpV0Im6q8W4GPdOUKElD1r6SIOSkxCwu LapEMGub+MLKWb0+2IlKqm3Ly8BzhSg5mv8oTTTXgBechBki0aM1IulhLgVmBtch7jud E0Fg== X-Gm-Message-State: AOJu0YyELrfEeUJ0rnWPKxXmosyMxKQhhmA844UpSuqDykbHnMmD+34n 0BSpvlI2NOZMe4RNBWcJrcUpk/efV1q0IQG0WHu5JWYU11CnJk0UAx1LOccaC7MX6NcuPeQPLJQ H2sEydFwS0A== X-Google-Smtp-Source: AGHT+IFVeP3dw84LaxagPgmU3cuM8Ilp1TSWbBir5xZICVzwS+OerRX2rhbWA+OR7njOv2wZmCAoN4VXJtON8w== X-Received: from joshwash.sea.corp.google.com ([2620:15c:11c:202:b9a2:fa74:abc3:bc47]) (user=joshwash job=sendgmr) by 2002:a63:4d52:0:b0:5cf:be1e:33e with SMTP id n18-20020a634d52000000b005cfbe1e033emr36112pgl.9.1706054685523; Tue, 23 Jan 2024 16:04:45 -0800 (PST) Date: Tue, 23 Jan 2024 16:04:23 -0800 In-Reply-To: <20240124000426.418527-1-joshwash@google.com> Mime-Version: 1.0 References: <20240123175831.3219292-1-joshwash@google.com> <20240124000426.418527-1-joshwash@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240124000426.418527-6-joshwash@google.com> Subject: [PATCH v3 5/7] net/gve: RSS redirection table update support From: Joshua Washington To: Junfeng Guo , Jeroen de Borst , Rushil Gupta , Joshua Washington Cc: dev@dpdk.org, Ferruh Yigit Content-Type: text/plain; charset="UTF-8" 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 --- drivers/net/gve/gve_ethdev.c | 95 ++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) 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 -- 2.43.0.429.g432eaa2c6b-goog