Skip to content

Commit

Permalink
common/cnxk: fix RSS key configuration
Browse files Browse the repository at this point in the history
[ upstream commit 56fa6f9 ]

Limit the configuring RSS key with rte_flow operations as
it is a global resource. Key can be update only with ethdev dev
operations using rte_eth_dev_rss_hash_update().

Fixes: 51dc6a8 ("common/cnxk: support RSS action in NPC rule")

Signed-off-by: Kiran Kumar K <[email protected]>
Signed-off-by: Satheesh Paul <[email protected]>
Reviewed-by: Jerin Jacob <[email protected]>
  • Loading branch information
Kiran Kumar K authored and kevintraynor committed Dec 4, 2024
1 parent d0fd4d4 commit d1ce0b4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
33 changes: 26 additions & 7 deletions drivers/common/cnxk/roc_npc.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,35 @@ npc_rss_action_configure(struct roc_npc *roc_npc,
uint8_t key[ROC_NIX_RSS_KEY_LEN];
const uint8_t *key_ptr;
uint8_t flowkey_algx;
uint32_t key_len;
uint16_t *reta;
int rc;

roc_nix_rss_key_get(roc_nix, key);
if (rss->key == NULL) {
key_ptr = key;
} else {
key_len = rss->key_len;
if (key_len > ROC_NIX_RSS_KEY_LEN)
key_len = ROC_NIX_RSS_KEY_LEN;

for (i = 0; i < key_len; i++) {
if (key[i] != rss->key[i]) {
plt_err("RSS key config not supported");
plt_err("New Key:");
for (i = 0; i < key_len; i++)
plt_dump_no_nl("0x%.2x ", rss->key[i]);
plt_dump_no_nl("\n");
plt_err("Configured Key:");
for (i = 0; i < ROC_NIX_RSS_KEY_LEN; i++)
plt_dump_no_nl("0x%.2x ", key[i]);
plt_dump_no_nl("\n");
return -ENOTSUP;
}
}
key_ptr = rss->key;
}

rc = npc_rss_free_grp_get(npc, &rss_grp_idx);
/* RSS group :0 is not usable for flow rss action */
if (rc < 0 || rss_grp_idx == 0)
Expand All @@ -733,13 +759,6 @@ npc_rss_action_configure(struct roc_npc *roc_npc,

*rss_grp = rss_grp_idx;

if (rss->key == NULL) {
roc_nix_rss_key_default_fill(roc_nix, key);
key_ptr = key;
} else {
key_ptr = rss->key;
}

roc_nix_rss_key_set(roc_nix, key_ptr);

/* If queue count passed in the rss action is less than
Expand Down
3 changes: 2 additions & 1 deletion drivers/common/cnxk/roc_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ extern int cnxk_logtype_tm;
#define plt_info(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args)
#define plt_warn(fmt, args...) RTE_LOG(WARNING, PMD, fmt "\n", ##args)
#define plt_print(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args)
#define plt_dump(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
#define plt_dump(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
#define plt_dump_no_nl(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)

/**
* Log debug message if given subsystem logging is enabled.
Expand Down

0 comments on commit d1ce0b4

Please sign in to comment.