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 653E94399F; Tue, 23 Jan 2024 01:17:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E4A240EE2; Tue, 23 Jan 2024 01:17:27 +0100 (CET) Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by mails.dpdk.org (Postfix) with ESMTP id 4630E40E96 for ; Tue, 23 Jan 2024 01:17:24 +0100 (CET) Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc236791689so4956951276.3 for ; Mon, 22 Jan 2024 16:17:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705969043; x=1706573843; 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=PzQnPrMq2zak9OQs3TpSP5joJale4BxohfWzBn5z97I=; b=pZbToeh/SmkfWCr/lboEo8GK9ccxFCkfjOtUzTsPQE58ZBz2lNzwOYejZQhHvbOLgk eXzPsyPTFdynO7hLOqhTjrAWA2Sd9gI88N+GYuzguNK8alDDUmB6E5N7XbCVpq6YVQBa ujCRs1gQeXyXlp9qgRjTefR9DmogOiMXlxq2e+jote7Rdge354bd51y553iEb3tFc4xd m41ZwKLTsqwRMcar7MLrSDZmyWp2fgIL6nx7SpbZ9r810TTD+Eg5RrJOTySzX328yzSv ve0ek26ZhnJCknor2cIKbsSIH1m6s4oP288qaC9vpr84PkrzJnR1/WtNzlyjuBKn6y/Z lFOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705969043; x=1706573843; 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=PzQnPrMq2zak9OQs3TpSP5joJale4BxohfWzBn5z97I=; b=tK6gkWJge9IX9ma3lD7u64XnAU5pYyeYq0eUAuBvbSMIJ2uJBBkFMgBZ2Xe44cYn8r /5f8fSy6YKyj2oFrLqg2b+MHoItQxg2cIpOpN8i4qhDeHJDUS+wYZDdTp9T2W7LkFQsQ 0p+HOPBht3nhWkNesbouc91cL7yLkbf3CC34anJk92oUULR43KhhGbgk/3r9sA8PiGx7 g8pJJCjtw4i42NijlfU3y+Iv6JOx+Ij2H1+0id5+Vwo5WMzpwIuWXznTJqh/FyT7N7vV bHO0VcoTLV2l/KytWUNhYxW/dvjUiJuaffGuRA1n3kpVQ3NwQWKw0d0a7GS/5cPIlP7S A/gA== X-Gm-Message-State: AOJu0Yz9CA5eHmPgFlZH6VDK20aNJLgG33Kt/spZhrBUPwiBVJmoE1pt EjQ0hNLweovE5wjGtk3AdugkvQmRMwuhrE6HKtFM+WtEPkBPdcrSQsS/93YN/BA5j21j3DEwL39 M+YyNtzr2VA== X-Google-Smtp-Source: AGHT+IElpX2phaLNqvkuuhz/oNGPyMpLqNFLUpDnILQUybC/0mYwnEk68PtgzcR1ru7bepAfh3y26C1A5KWqqg== X-Received: from joshwash.sea.corp.google.com ([2620:15c:11c:202:9096:2b97:b7f7:1182]) (user=joshwash job=sendgmr) by 2002:a25:c5c8:0:b0:dc2:1c5d:eed5 with SMTP id v191-20020a25c5c8000000b00dc21c5deed5mr2514451ybe.12.1705969043719; Mon, 22 Jan 2024 16:17:23 -0800 (PST) Date: Mon, 22 Jan 2024 16:16:42 -0800 In-Reply-To: <20240123001645.1507779-1-joshwash@google.com> Mime-Version: 1.0 References: <20240123001645.1507779-1-joshwash@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240123001645.1507779-6-joshwash@google.com> Subject: [PATCH 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. --- 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 76405120b2..aa9b3d8372 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", + 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