From 3bacd6653d2d0cbbd883c06184b98b5ce193f901 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Wed, 9 Feb 2022 14:44:59 -0700 Subject: [PATCH] idxd: No longer set token configuration This has changed to control the number of read buffers allocated to the group, but it is only valid to set this register if the device has indicated it supports it. Further, the default value is what we want anyway, so we can skip setting it altogether. Signed-off-by: Ben Walker Change-Id: Ic54672ea6cb16acc7613860e36d9f7033048bd98 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11484 Reviewed-by: Jim Harris Reviewed-by: Paul Luse Reviewed-by: Changpeng Liu Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot --- include/spdk/idxd_spec.h | 16 ++++++++-------- lib/idxd/idxd_user.c | 4 ---- test/unit/lib/idxd/idxd_user.c/idxd_user_ut.c | 4 +--- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/include/spdk/idxd_spec.h b/include/spdk/idxd_spec.h index 9d4a518f2..419a5b11b 100644 --- a/include/spdk/idxd_spec.h +++ b/include/spdk/idxd_spec.h @@ -540,14 +540,14 @@ SPDK_STATIC_ASSERT(sizeof(struct idxd_registers) == 0xE0, "size mismatch"); union idxd_group_flags { struct { - uint32_t tc_a: 3; - uint32_t tc_b: 3; - uint32_t rsvd: 1; - uint32_t use_token_limit: 1; - uint32_t tokens_reserved: 8; - uint32_t rsvd2: 4; - uint32_t tokens_allowed: 8; - uint32_t rsvd3: 4; + uint32_t tc_a : 3; + uint32_t tc_b : 3; + uint32_t reserved0 : 1; + uint32_t global_read_buffer_limit : 1; + uint32_t read_buffers_reserved : 8; + uint32_t reserved1 : 4; + uint32_t read_buffers_allowed : 8; + uint32_t reserved2 : 4; }; uint32_t raw; }; diff --git a/lib/idxd/idxd_user.c b/lib/idxd/idxd_user.c index 4b39beb9e..b3548c238 100644 --- a/lib/idxd/idxd_user.c +++ b/lib/idxd/idxd_user.c @@ -238,10 +238,6 @@ idxd_group_config(struct spdk_idxd_device *idxd) for (i = 0; i < g_user_dev_cfg.num_groups; i++) { idxd->groups[i].idxd = idxd; idxd->groups[i].id = i; - - /* Divide BW tokens evenly */ - idxd->groups[i].grpcfg.flags.tokens_allowed = - user_idxd->registers.groupcap.read_bufs / g_user_dev_cfg.num_groups; } /* diff --git a/test/unit/lib/idxd/idxd_user.c/idxd_user_ut.c b/test/unit/lib/idxd/idxd_user.c/idxd_user_ut.c index c77bc89b4..989c2360f 100644 --- a/test/unit/lib/idxd/idxd_user.c/idxd_user_ut.c +++ b/test/unit/lib/idxd/idxd_user.c/idxd_user_ut.c @@ -41,7 +41,6 @@ #define FAKE_REG_SIZE 0x800 #define GRP_CFG_OFFSET 0x400 -#define MAX_TOKENS 0x40 #define MAX_ARRAY_SIZE 0x20 SPDK_LOG_REGISTER_COMPONENT(idxd); @@ -172,7 +171,6 @@ test_idxd_group_config(void) user_idxd.registers.groupcap.num_groups = g_user_dev_cfg.num_groups; user_idxd.registers.enginecap.num_engines = g_user_dev_cfg.total_engines; user_idxd.registers.wqcap.num_wqs = g_user_dev_cfg.total_wqs; - user_idxd.registers.groupcap.read_bufs = MAX_TOKENS; user_idxd.grpcfg_offset = GRP_CFG_OFFSET; rc = idxd_group_config(idxd); @@ -187,7 +185,7 @@ test_idxd_group_config(void) /* wqe and engine arrays are indexed by group id and are bitmaps of assigned elements. */ CU_ASSERT(wqs[0] == 0x1); CU_ASSERT(engines[0] == 0xf); - CU_ASSERT(flags[0].tokens_allowed == MAX_TOKENS / g_user_dev_cfg.num_groups); + CU_ASSERT(flags[0].raw == 0); /* groups allocated by code under test. */ free(idxd->groups);