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 833BC439AD; Wed, 24 Jan 2024 01:04:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A6EC40DFB; Wed, 24 Jan 2024 01:04:42 +0100 (CET) Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by mails.dpdk.org (Postfix) with ESMTP id D888740A71 for ; Wed, 24 Jan 2024 01:04:40 +0100 (CET) Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc2284779caso5609828276.0 for ; Tue, 23 Jan 2024 16:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706054680; x=1706659480; 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=knbBxSwYRSibgn8t8+PICTr5dzF8jP0hxUy1d91WOQU=; b=rGau86Hy+6BFkD3hyMn0AxWfzKqVitYbRT4NyKR9UNgshF0jFcw0SpYwYIRbLHQbK6 dpiKwdB0ImULCyaaSmkbNTBV0bZl5gGqTMfMjVwqycSY+bd37uV/XEwwB2rLQXfGOA7k MJpDFPIJhsbkd15xahkOFffp1iY8MpmZoeLr814ZNU/YStT0ggT8gp+K58J3ZOmjfkL3 /z0p/TBp7TNLX2BplqZxaQDb5k66SMu4DtOuoah53P6SfBGXUoK2kDk3iohUaoq2rbW3 MpAMc23hFd1nCWMxqQuzYyREJ6FDM1TIntOwf0NzOvzaVwE+223VfFYIjqKLN/NMMVMz s5DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706054680; x=1706659480; 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=knbBxSwYRSibgn8t8+PICTr5dzF8jP0hxUy1d91WOQU=; b=NM9dyUY5C/SRyYOIb2sJeXMhG+hSC8kht29Mkdx/T6wcUiIVCwPsUMa7FkCvvEgo6v STg+iIbFQzI2vKx9iRBixNBRFd9P4GNSSR8rscRvyYTiZARgjBF3GToW/LGK51eubdUQ lgVD9oHhS6sGmS4G10FIAprNaMM2ofBdRxP87FI9pmvDQu0znHkXedw54yG1aINY16nD VVtss1whONRIIbuPkVjF75eKppWMWu//+nXsr0DjsWkBWQw/y2WUQPRJyt425PFPR9OZ Tmndd+2eiYpvLsDOkKgyM0p29b+snK1ZqVCA2QzUqYCijkEN9PyfrzVqeeO1L5xpQRb2 klyQ== X-Gm-Message-State: AOJu0YwGG8WtlYGTr3EqpDtRBQTRASofT4ttRAuJNiPCM82CmL4JXm54 iot8L5FcEQURITqIxcsMada2jyXG0AqPV9ze5BOE3G1hGbXXXBghzEsUKFfb8snvQpEfolOnYjm ZaHxo7x69Yg== X-Google-Smtp-Source: AGHT+IGeiqD1yyv+7YdSE4iwzXdERnPxChny2LkZ3/947YZlgTZAIfs5E/VFdic9kddzyBplwVjNGvMUzOV8ig== X-Received: from joshwash.sea.corp.google.com ([2620:15c:11c:202:b9a2:fa74:abc3:bc47]) (user=joshwash job=sendgmr) by 2002:a25:aa02:0:b0:dc2:4ead:4395 with SMTP id s2-20020a25aa02000000b00dc24ead4395mr301ybi.2.1706054680179; Tue, 23 Jan 2024 16:04:40 -0800 (PST) Date: Tue, 23 Jan 2024 16:04:20 -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-3-joshwash@google.com> Subject: [PATCH v3 2/7] net/gve: RSS adminq command changes 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 change introduces admin queue changes that enable the configuration of RSS parameters for the GVE driver. Signed-off-by: Joshua Washington Reviewed-by: Rushil Gupta Reviewed-by: Jeroen de Borst --- drivers/net/gve/base/gve.h | 15 ++++++++ drivers/net/gve/base/gve_adminq.c | 58 +++++++++++++++++++++++++++++++ drivers/net/gve/base/gve_adminq.h | 29 ++++++++++++++++ drivers/net/gve/gve_ethdev.h | 6 +++- 4 files changed, 107 insertions(+), 1 deletion(-) diff --git a/drivers/net/gve/base/gve.h b/drivers/net/gve/base/gve.h index f7b297e759..9c58fc4238 100644 --- a/drivers/net/gve/base/gve.h +++ b/drivers/net/gve/base/gve.h @@ -51,4 +51,19 @@ enum gve_state_flags_bit { GVE_PRIV_FLAGS_NAPI_ENABLED = 4, }; +enum gve_rss_hash_algorithm { + GVE_RSS_HASH_UNDEFINED = 0, + GVE_RSS_HASH_TOEPLITZ = 1, +}; + +struct gve_rss_config { + uint16_t hash_types; + enum gve_rss_hash_algorithm alg; + uint16_t key_size; + uint16_t indir_size; + uint8_t *key; + uint32_t *indir; +}; + + #endif /* _GVE_H_ */ diff --git a/drivers/net/gve/base/gve_adminq.c b/drivers/net/gve/base/gve_adminq.c index 343bd13d67..fede0a4b82 100644 --- a/drivers/net/gve/base/gve_adminq.c +++ b/drivers/net/gve/base/gve_adminq.c @@ -389,6 +389,9 @@ static int gve_adminq_issue_cmd(struct gve_priv *priv, case GVE_ADMINQ_DECONFIGURE_DEVICE_RESOURCES: priv->adminq_dcfg_device_resources_cnt++; break; + case GVE_ADMINQ_CONFIGURE_RSS: + priv->adminq_cfg_rss_cnt++; + break; case GVE_ADMINQ_SET_DRIVER_PARAMETER: priv->adminq_set_driver_parameter_cnt++; break; @@ -938,3 +941,58 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv, gve_free_dma_mem(&ptype_map_dma_mem); return err; } + +int gve_adminq_configure_rss(struct gve_priv *priv, + struct gve_rss_config *rss_config) +{ + struct gve_dma_mem indirection_table_dma_mem; + struct gve_dma_mem rss_key_dma_mem; + union gve_adminq_command cmd; + __be32 *indir = NULL; + u8 *key = NULL; + int err = 0; + int i; + + if (!rss_config->indir_size || !rss_config->key_size) + return -EINVAL; + + indir = gve_alloc_dma_mem(&indirection_table_dma_mem, + rss_config->indir_size * + sizeof(*rss_config->indir)); + if (!indir) { + err = -ENOMEM; + goto out; + } + for (i = 0; i < rss_config->indir_size; i++) + indir[i] = cpu_to_be32(rss_config->indir[i]); + + key = gve_alloc_dma_mem(&rss_key_dma_mem, + rss_config->key_size * + sizeof(*rss_config->key)); + if (!key) { + err = -ENOMEM; + goto out; + } + memcpy(key, rss_config->key, rss_config->key_size); + + memset(&cmd, 0, sizeof(cmd)); + cmd.opcode = cpu_to_be32(GVE_ADMINQ_CONFIGURE_RSS); + cmd.configure_rss = (struct gve_adminq_configure_rss) { + .hash_types = cpu_to_be16(rss_config->hash_types), + .halg = rss_config->alg, + .hkey_len = cpu_to_be16(rss_config->key_size), + .indir_len = cpu_to_be16(rss_config->indir_size), + .hkey_addr = cpu_to_be64(rss_key_dma_mem.pa), + .indir_addr = cpu_to_be64(indirection_table_dma_mem.pa), + }; + + err = gve_adminq_execute_cmd(priv, &cmd); + +out: + if (indir) + gve_free_dma_mem(&indirection_table_dma_mem); + if (key) + gve_free_dma_mem(&rss_key_dma_mem); + return err; +} + diff --git a/drivers/net/gve/base/gve_adminq.h b/drivers/net/gve/base/gve_adminq.h index f05362f85f..95f4960561 100644 --- a/drivers/net/gve/base/gve_adminq.h +++ b/drivers/net/gve/base/gve_adminq.h @@ -19,6 +19,7 @@ enum gve_adminq_opcodes { GVE_ADMINQ_DESTROY_TX_QUEUE = 0x7, GVE_ADMINQ_DESTROY_RX_QUEUE = 0x8, GVE_ADMINQ_DECONFIGURE_DEVICE_RESOURCES = 0x9, + GVE_ADMINQ_CONFIGURE_RSS = 0xA, GVE_ADMINQ_SET_DRIVER_PARAMETER = 0xB, GVE_ADMINQ_REPORT_STATS = 0xC, GVE_ADMINQ_REPORT_LINK_SPEED = 0xD, @@ -377,6 +378,27 @@ struct gve_adminq_get_ptype_map { __be64 ptype_map_addr; }; +#define GVE_RSS_HASH_IPV4 BIT(0) +#define GVE_RSS_HASH_TCPV4 BIT(1) +#define GVE_RSS_HASH_IPV6 BIT(2) +#define GVE_RSS_HASH_IPV6_EX BIT(3) +#define GVE_RSS_HASH_TCPV6 BIT(4) +#define GVE_RSS_HASH_TCPV6_EX BIT(5) +#define GVE_RSS_HASH_UDPV4 BIT(6) +#define GVE_RSS_HASH_UDPV6 BIT(7) +#define GVE_RSS_HASH_UDPV6_EX BIT(8) + +/* RSS configuration command */ +struct gve_adminq_configure_rss { + __be16 hash_types; + u8 halg; /* hash algorithm */ + u8 reserved; + __be16 hkey_len; + __be16 indir_len; + __be64 hkey_addr; + __be64 indir_addr; +}; + union gve_adminq_command { struct { __be32 opcode; @@ -391,6 +413,7 @@ union gve_adminq_command { struct gve_adminq_describe_device describe_device; struct gve_adminq_register_page_list reg_page_list; struct gve_adminq_unregister_page_list unreg_page_list; + struct gve_adminq_configure_rss configure_rss; struct gve_adminq_set_driver_parameter set_driver_param; struct gve_adminq_report_stats report_stats; struct gve_adminq_report_link_speed report_link_speed; @@ -404,6 +427,8 @@ union gve_adminq_command { GVE_CHECK_UNION_LEN(64, gve_adminq_command); +struct gve_priv; +struct gve_queue_page_list; int gve_adminq_alloc(struct gve_priv *priv); void gve_adminq_free(struct gve_priv *priv); void gve_adminq_release(struct gve_priv *priv); @@ -433,4 +458,8 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv, int gve_adminq_verify_driver_compatibility(struct gve_priv *priv, u64 driver_info_len, dma_addr_t driver_info_addr); + +int gve_adminq_configure_rss(struct gve_priv *priv, + struct gve_rss_config *rss_config); + #endif /* _GVE_ADMINQ_H */ diff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h index 14c72ec91a..f7635e829c 100644 --- a/drivers/net/gve/gve_ethdev.h +++ b/drivers/net/gve/gve_ethdev.h @@ -39,7 +39,10 @@ RTE_ETH_RSS_IPV6 | \ RTE_ETH_RSS_IPV6_EX | \ RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ - RTE_ETH_RSS_IPV6_TCP_EX) + RTE_ETH_RSS_IPV6_TCP_EX | \ + RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ + RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ + RTE_ETH_RSS_IPV6_UDP_EX) /* A list of pages registered with the device during setup and used by a queue * as buffers @@ -264,6 +267,7 @@ struct gve_priv { uint32_t adminq_destroy_tx_queue_cnt; uint32_t adminq_destroy_rx_queue_cnt; uint32_t adminq_dcfg_device_resources_cnt; + uint32_t adminq_cfg_rss_cnt; uint32_t adminq_set_driver_parameter_cnt; uint32_t adminq_report_stats_cnt; uint32_t adminq_report_link_speed_cnt; -- 2.43.0.429.g432eaa2c6b-goog