get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/136244/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 136244,
    "url": "http://patches.dpdk.org/api/patches/136244/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240131221308.2208815-5-joshwash@google.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20240131221308.2208815-5-joshwash@google.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240131221308.2208815-5-joshwash@google.com",
    "date": "2024-01-31T22:13:07",
    "name": "[v5,4/5] net/gve: add RSS configuration update support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "dec89da89a3d9da56be85e5019194eb79b0fa892",
    "submitter": {
        "id": 2921,
        "url": "http://patches.dpdk.org/api/people/2921/?format=api",
        "name": "Joshua Washington",
        "email": "joshwash@google.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240131221308.2208815-5-joshwash@google.com/mbox/",
    "series": [
        {
            "id": 30957,
            "url": "http://patches.dpdk.org/api/series/30957/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30957",
            "date": "2024-01-31T22:13:03",
            "name": "net/gve: RSS Support for GVE Driver",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/30957/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/136244/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/136244/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8E22643A26;\n\tWed, 31 Jan 2024 23:14:31 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id AFE0442DD8;\n\tWed, 31 Jan 2024 23:14:12 +0100 (CET)",
            "from mail-pl1-f201.google.com (mail-pl1-f201.google.com\n [209.85.214.201])\n by mails.dpdk.org (Postfix) with ESMTP id C3A6342DC5\n for <dev@dpdk.org>; Wed, 31 Jan 2024 23:14:08 +0100 (CET)",
            "by mail-pl1-f201.google.com with SMTP id\n d9443c01a7336-1d8e7857e11so2624125ad.0\n for <dev@dpdk.org>; Wed, 31 Jan 2024 14:14:08 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=google.com; s=20230601; t=1706739248; x=1707344048; darn=dpdk.org;\n h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n :date:from:to:cc:subject:date:message-id:reply-to;\n bh=L3+N8pDDEhbSnokeWzgwRZBeXRsUtfOfGoBLILscGTs=;\n b=2B6uuZZdhUfA86PngQyIR/ivPpj5+bYqUd2lTXabCWxSEiK5uRJCQNc9O5rYH3hwm2\n EsHNZUeH+U3pnMN3bWuAdV63bepM4d5qNuelEvdBmrevqWiK2LecrFBAJFqpTDyS0UNO\n /UV4GfYOUrui2lDgxTFldd8R9sYumOeGqSiRq0ujKETQrvtZ7ghFw6I9KObPY8B8OS6Z\n L7kgIdm3uPqWUtWWWXB49Cn3LA68VoE/sABMBMXhPqCeGb9TQ87gEEsKOnfSEZ6/NjgT\n 0qOXj2q7qoE84xPoiIPSF8vw6zE0aCbVNOuPgAKy3arFOX+6cYs0t4s5Bj9YDvUlAifz\n 3r+A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1706739248; x=1707344048;\n h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=L3+N8pDDEhbSnokeWzgwRZBeXRsUtfOfGoBLILscGTs=;\n b=WB1GAaeCQWy31Xj1/gssnnwqjYxoK7KH4Nslzs4dDYRkAuDhnorsFaS3UCK1b/Uv4I\n fGwvuCo5TQIGpWLSwfXRdiknfOk5SSC1rxSZWesO6mAGdYxd5GJ++1875Ag5b+FfJ0Cc\n D7Cxox4PE+VkfO9sM9SHpyVVGGZ/jTFOd6z8Sl2GM+KwueVoKLjeiH4ZrbQUyD8Lnb4u\n u5lX7dxfOZsI4V7Rp4Hcb9JgcPhYb8WACpJJ44J4mDweV1LLgC9jj9lC84xSb7jj+MeV\n JBfawhpKUBmmUhNWzcLT/7/MgdnCIQ5yT5gL9aa2psRfEs5RAdcAnZacKTRRpAYEHNlY\n zJSg==",
        "X-Gm-Message-State": "AOJu0YwkEWs8bPFaogaX9Apwub/Z0v9jFgkeZ93sK4mD/gxOmOT9trWx\n wbWmqC9aN/m8z0Hbr5qE6hpPBjTNIbrlyRFl4wd23GU3aZ5ge9R3xPzS7J72zx1WR2duIKl+JZI\n b1cEO7BpcWQ==",
        "X-Google-Smtp-Source": "\n AGHT+IFHKLeAm2NyFPIBp91G9A2+HstA75OqAR9YN9p4JxJ41aWYKSM1109BQsii/y4z6TFgkjGcUpZeUgBmiA==",
        "X-Received": "from joshwash.sea.corp.google.com\n ([2620:15c:11c:202:9a96:68e3:c6ee:7117])\n (user=joshwash job=sendgmr) by 2002:a17:903:208b:b0:1d8:e4b8:95d1 with SMTP\n id d11-20020a170903208b00b001d8e4b895d1mr8234plc.2.1706739247984; Wed, 31 Jan\n 2024 14:14:07 -0800 (PST)",
        "Date": "Wed, 31 Jan 2024 14:13:07 -0800",
        "In-Reply-To": "<20240131221308.2208815-1-joshwash@google.com>",
        "Mime-Version": "1.0",
        "References": "<20240126173317.2779230-2-joshwash@google.com>\n <20240131221308.2208815-1-joshwash@google.com>",
        "X-Mailer": "git-send-email 2.43.0.429.g432eaa2c6b-goog",
        "Message-ID": "<20240131221308.2208815-5-joshwash@google.com>",
        "Subject": "[PATCH v5 4/5] net/gve: add RSS configuration update support",
        "From": "Joshua Washington <joshwash@google.com>",
        "To": "Junfeng Guo <junfeng.guo@intel.com>,\n Jeroen de Borst <jeroendb@google.com>,\n Rushil Gupta <rushilg@google.com>, Joshua Washington <joshwash@google.com>",
        "Cc": "dev@dpdk.org, Ferruh Yigit <ferruh.yigit@amd.com>",
        "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 <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This patch adds support for updating the RSS hash key and hash fields\nin the GVE PMD through the implementation of rss_hash_update and\nrss_hash_conf_get.\n\nThe RSS hash key for gVNIC is required to be 40 bytes. On initial\nconfiguration of the RSS hash key, the RSS redirection table will be\nset to a static default, using a round-robin approach for all queues.\nNote, however, that this patch does not include support for setting the\nredirection table explicitly. In dev_configure, if the static\nredirection table has been set, it will be updated to reflect the new\nqueue count, if it has changed.\n\nThe RSS key must be set before any other RSS configuration can happen.\nAs such, an attempt to set the hash types before the key is configured\nwill fail.\n\nSigned-off-by: Joshua Washington <joshwash@google.com>\nReviewed-by: Rushil Gupta <rushilg@google.com>\nReviewed-by: Jeroen de Borst <jeroendb@google.com>\n---\n doc/guides/nics/features/gve.ini |   1 +\n doc/guides/nics/gve.rst          |  20 +++--\n drivers/net/gve/gve_ethdev.c     | 132 ++++++++++++++++++++++++++++++-\n drivers/net/gve/gve_ethdev.h     |   3 +\n 4 files changed, 148 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/features/gve.ini b/doc/guides/nics/features/gve.ini\nindex 838edd456a..4381b1565f 100644\n--- a/doc/guides/nics/features/gve.ini\n+++ b/doc/guides/nics/features/gve.ini\n@@ -9,6 +9,7 @@ Link status          = Y\n MTU update           = Y\n TSO                  = Y\n RSS hash             = Y\n+RSS key update       = Y\n L4 checksum offload  = Y\n Basic stats          = Y\n Linux                = Y\ndiff --git a/doc/guides/nics/gve.rst b/doc/guides/nics/gve.rst\nindex 1c3eaf03ef..908b2aab11 100644\n--- a/doc/guides/nics/gve.rst\n+++ b/doc/guides/nics/gve.rst\n@@ -70,6 +70,7 @@ Supported features of the GVE PMD are:\n - Link state information\n - Tx multi-segments (Scatter Tx)\n - Tx UDP/TCP/SCTP Checksum\n+- RSS hash configuration\n \n Currently, only GQI_QPL and GQI_RDA queue format are supported in PMD.\n Jumbo Frame is not supported in PMD for now.\n@@ -77,10 +78,17 @@ It'll be added in a future DPDK release.\n Also, only GQI_QPL queue format is in use on GCP\n since GQI_RDA hasn't been released in production.\n \n-Currently, setting MTU with value larger than 1460 is not supported.\n+RSS\n+^^^\n+\n+GVE RSS can be enabled and configured using the standard interfaces. The driver\n+does not support querying the initial RSS configuration.\n+\n+The RSS hash key must be exactly 40 bytes. Upon RSS hash configuration, a\n+default redirection table will be set using a round-robin assignment of hash\n+values to queues. The default GVE redirection table has 128 entries.\n+\n+Note that the initial configuration requires a hash key to be provided if one\n+had not been provided before. Attempting to set hash types alone without the\n+existence of a set key will result in a failed request.\n \n-Currently, only \"RSS hash\" is force enabled\n-so that the backend hardware device calculated hash values\n-could be shared with applications.\n-But for RSS, there is no such API to config RSS hash function or RETA table.\n-So, limited RSS is supported only with default config/setting.\ndiff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c\nindex 936ca22cb9..2a68d31808 100644\n--- a/drivers/net/gve/gve_ethdev.c\n+++ b/drivers/net/gve/gve_ethdev.c\n@@ -1,5 +1,6 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(C) 2022 Intel Corporation\n+ * Copyright(C) 2022-2023 Intel Corporation\n+ * Copyright(C) 2023 Google LLC\n  */\n \n #include \"gve_ethdev.h\"\n@@ -8,6 +9,7 @@\n #include \"base/gve_osdep.h\"\n #include \"gve_version.h\"\n #include \"rte_ether.h\"\n+#include \"gve_rss.h\"\n \n static void\n gve_write_version(uint8_t *driver_version_register)\n@@ -88,12 +90,31 @@ gve_dev_configure(struct rte_eth_dev *dev)\n {\n \tstruct gve_priv *priv = dev->data->dev_private;\n \n-\tif (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)\n+\tif (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {\n \t\tdev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;\n+\t\tpriv->rss_config.alg = GVE_RSS_HASH_TOEPLITZ;\n+\t}\n \n \tif (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO)\n \t\tpriv->enable_rsc = 1;\n \n+\t/* Reset RSS RETA in case number of queues changed. */\n+\tif (priv->rss_config.indir) {\n+\t\tstruct gve_rss_config update_reta_config;\n+\t\tgve_init_rss_config_from_priv(priv, &update_reta_config);\n+\t\tgve_generate_rss_reta(dev, &update_reta_config);\n+\n+\t\tint err = gve_adminq_configure_rss(priv, &update_reta_config);\n+\t\tif (err)\n+\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t\"Could not reconfigure RSS redirection table.\");\n+\t\telse\n+\t\t\tgve_update_priv_rss_config(priv, &update_reta_config);\n+\n+\t\tgve_free_rss_config(&update_reta_config);\n+\t\treturn err;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -443,6 +464,8 @@ gve_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \t};\n \n \tdev_info->flow_type_rss_offloads = GVE_RTE_RSS_OFFLOAD_ALL;\n+\tdev_info->hash_key_size = GVE_RSS_HASH_KEY_SIZE;\n+\tdev_info->reta_size = GVE_RSS_INDIR_SIZE;\n \n \treturn 0;\n }\n@@ -646,6 +669,107 @@ gve_xstats_get_names(struct rte_eth_dev *dev,\n \treturn count;\n }\n \n+\n+static int\n+gve_rss_hash_update(struct rte_eth_dev *dev,\n+\t\t\tstruct rte_eth_rss_conf *rss_conf)\n+{\n+\tstruct gve_priv *priv = dev->data->dev_private;\n+\tstruct gve_rss_config gve_rss_conf;\n+\tint rss_reta_size;\n+\tint err;\n+\n+\tif (gve_validate_rss_hf(rss_conf->rss_hf)) {\n+\t\tPMD_DRV_LOG(ERR, \"Unsupported hash function.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_TOEPLITZ &&\n+\t\trss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT) {\n+\t\tPMD_DRV_LOG(ERR, \"Device only supports Toeplitz algorithm.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (rss_conf->rss_key_len) {\n+\t\tif (rss_conf->rss_key_len != GVE_RSS_HASH_KEY_SIZE) {\n+\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t\"Invalid hash key size. Only RSS hash key size \"\n+\t\t\t\t\"of %u supported\", GVE_RSS_HASH_KEY_SIZE);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tif (!rss_conf->rss_key) {\n+\t\t\tPMD_DRV_LOG(ERR, \"RSS key must be non-null.\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t} else {\n+\t\tif (!priv->rss_config.key_size) {\n+\t\t\tPMD_DRV_LOG(ERR, \"RSS key must be initialized before \"\n+\t\t\t\t\"any other configuration.\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\trss_conf->rss_key_len = priv->rss_config.key_size;\n+\t}\n+\n+\trss_reta_size = priv->rss_config.indir ?\n+\t\t\tpriv->rss_config.indir_size :\n+\t\t\tGVE_RSS_INDIR_SIZE;\n+\terr = gve_init_rss_config(&gve_rss_conf, rss_conf->rss_key_len,\n+\t\trss_reta_size);\n+\tif (err)\n+\t\treturn err;\n+\n+\tgve_rss_conf.alg = GVE_RSS_HASH_TOEPLITZ;\n+\terr = gve_update_rss_hash_types(priv, &gve_rss_conf, rss_conf);\n+\tif (err)\n+\t\tgoto err;\n+\terr = gve_update_rss_key(priv, &gve_rss_conf, rss_conf);\n+\tif (err)\n+\t\tgoto err;\n+\n+\t/* Set redirection table to default or preexisting. */\n+\tif (!priv->rss_config.indir)\n+\t\tgve_generate_rss_reta(dev, &gve_rss_conf);\n+\telse\n+\t\tmemcpy(gve_rss_conf.indir, priv->rss_config.indir,\n+\t\t\tgve_rss_conf.indir_size * sizeof(*priv->rss_config.indir));\n+\n+\terr = gve_adminq_configure_rss(priv, &gve_rss_conf);\n+\tif (!err)\n+\t\tgve_update_priv_rss_config(priv, &gve_rss_conf);\n+\n+err:\n+\tgve_free_rss_config(&gve_rss_conf);\n+\treturn err;\n+}\n+\n+static int\n+gve_rss_hash_conf_get(struct rte_eth_dev *dev,\n+\t\t\tstruct rte_eth_rss_conf *rss_conf)\n+{\n+\tstruct gve_priv *priv = dev->data->dev_private;\n+\n+\tif (!(dev->data->dev_conf.rxmode.offloads &\n+\t\t\tRTE_ETH_RX_OFFLOAD_RSS_HASH)) {\n+\t\tPMD_DRV_LOG(ERR, \"RSS not configured.\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\n+\tgve_to_rte_rss_hf(priv->rss_config.hash_types, rss_conf);\n+\trss_conf->rss_key_len = priv->rss_config.key_size;\n+\tif (rss_conf->rss_key) {\n+\t\tif (!priv->rss_config.key) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Unable to retrieve default RSS hash key.\");\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\t\tmemcpy(rss_conf->rss_key, priv->rss_config.key,\n+\t\t\trss_conf->rss_key_len * sizeof(*rss_conf->rss_key));\n+\t}\n+\n+\treturn 0;\n+}\n+\n static const struct eth_dev_ops gve_eth_dev_ops = {\n \t.dev_configure        = gve_dev_configure,\n \t.dev_start            = gve_dev_start,\n@@ -666,6 +790,8 @@ static const struct eth_dev_ops gve_eth_dev_ops = {\n \t.mtu_set              = gve_dev_mtu_set,\n \t.xstats_get           = gve_xstats_get,\n \t.xstats_get_names     = gve_xstats_get_names,\n+\t.rss_hash_update      = gve_rss_hash_update,\n+\t.rss_hash_conf_get    = gve_rss_hash_conf_get,\n };\n \n static const struct eth_dev_ops gve_eth_dev_ops_dqo = {\n@@ -688,6 +814,8 @@ static const struct eth_dev_ops gve_eth_dev_ops_dqo = {\n \t.mtu_set              = gve_dev_mtu_set,\n \t.xstats_get           = gve_xstats_get,\n \t.xstats_get_names     = gve_xstats_get_names,\n+\t.rss_hash_update      = gve_rss_hash_update,\n+\t.rss_hash_conf_get    = gve_rss_hash_conf_get,\n };\n \n static void\ndiff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h\nindex bc486cb941..d713657d10 100644\n--- a/drivers/net/gve/gve_ethdev.h\n+++ b/drivers/net/gve/gve_ethdev.h\n@@ -29,6 +29,9 @@\n #define GVE_RX_MIN_BUF_SIZE_GQI    2048\n #define GVE_RX_MAX_BUF_SIZE_GQI    4096\n \n+#define GVE_RSS_HASH_KEY_SIZE 40\n+#define GVE_RSS_INDIR_SIZE 128\n+\n #define GVE_TX_CKSUM_OFFLOAD_MASK (\t\t\\\n \t\tRTE_MBUF_F_TX_L4_MASK  |\t\\\n \t\tRTE_MBUF_F_TX_TCP_SEG)\n",
    "prefixes": [
        "v5",
        "4/5"
    ]
}