* [PATCH v2 1/2] net/ntnic: fix incorrect error message
2024-11-22 22:49 [PATCH v2 0/2] Bugfixes Serhii Iliushyk
@ 2024-11-22 22:49 ` Serhii Iliushyk
2024-11-22 23:08 ` Stephen Hemminger
2024-11-22 22:49 ` [PATCH v2 2/2] net/ntnic: fix of Toeplitz key and log with mask Serhii Iliushyk
1 sibling, 1 reply; 4+ messages in thread
From: Serhii Iliushyk @ 2024-11-22 22:49 UTC (permalink / raw)
To: dev; +Cc: mko-plv, sil-plv, ckm, andrew.rybchenko, ferruh.yigit, stephen
Add missed error messages to the list to avoid incorrect logs.
Change order base initializers to index base initializers.
Add static assertions to control the completeness of the list of messages.
Fixes: 11ea97805ba1 ("net/ntnic: add minimal flow inline profile")
Signed-off-by: Serhii Iliushyk <sil-plv@napatech.com>
---
v2
* Change order base initializers to index base initializers
* Add static assertions to control the completeness
of the list of messages.
---
drivers/net/ntnic/include/flow_api.h | 3 +-
drivers/net/ntnic/include/flow_api_engine.h | 3 +-
drivers/net/ntnic/nthw/flow_api/flow_api.c | 164 ++++++++++++++------
3 files changed, 118 insertions(+), 52 deletions(-)
diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h
index d5382669da..dcad7f6839 100644
--- a/drivers/net/ntnic/include/flow_api.h
+++ b/drivers/net/ntnic/include/flow_api.h
@@ -168,7 +168,8 @@ enum flow_nic_err_msg_e {
ERR_ACTION_MULTIPLE_PORT_ID_UNSUPPORTED = 40,
ERR_RSS_TOO_LONG_KEY = 41,
ERR_ACTION_AGE_UNSUPPORTED_GROUP_0 = 42,
- ERR_MSG_NO_MSG
+ ERR_MSG_NO_MSG = 43,
+ ERR_MSG_END,
};
void flow_nic_set_error(enum flow_nic_err_msg_e msg, struct rte_flow_error *error);
diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h
index 5eace2614f..636c53b260 100644
--- a/drivers/net/ntnic/include/flow_api_engine.h
+++ b/drivers/net/ntnic/include/flow_api_engine.h
@@ -44,7 +44,8 @@ enum res_type_e {
RES_TPE_RPL,
RES_SCRUB_RCP,
RES_COUNT,
- RES_INVALID
+ RES_INVALID,
+ RES_END
};
/*
diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c
index d4993eb58a..842b0075ed 100644
--- a/drivers/net/ntnic/nthw/flow_api/flow_api.c
+++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c
@@ -19,28 +19,31 @@
}
const char *dbg_res_descr[] = {
- /* RES_QUEUE */ "RES_QUEUE",
- /* RES_CAT_CFN */ "RES_CAT_CFN",
- /* RES_CAT_COT */ "RES_CAT_COT",
- /* RES_CAT_EXO */ "RES_CAT_EXO",
- /* RES_CAT_LEN */ "RES_CAT_LEN",
- /* RES_KM_FLOW_TYPE */ "RES_KM_FLOW_TYPE",
- /* RES_KM_CATEGORY */ "RES_KM_CATEGORY",
- /* RES_HSH_RCP */ "RES_HSH_RCP",
- /* RES_PDB_RCP */ "RES_PDB_RCP",
- /* RES_QSL_RCP */ "RES_QSL_RCP",
- /* RES_QSL_LTX */ "RES_QSL_LTX",
- /* RES_QSL_QST */ "RES_QSL_QST",
- /* RES_SLC_LR_RCP */ "RES_SLC_LR_RCP",
- /* RES_FLM_FLOW_TYPE */ "RES_FLM_FLOW_TYPE",
- /* RES_FLM_RCP */ "RES_FLM_RCP",
- /* RES_TPE_RCP */ "RES_TPE_RCP",
- /* RES_TPE_EXT */ "RES_TPE_EXT",
- /* RES_TPE_RPL */ "RES_TPE_RPL",
- /* RES_COUNT */ "RES_COUNT",
- /* RES_INVALID */ "RES_INVALID"
+ [RES_QUEUE] = "RES_QUEUE",
+ [RES_CAT_CFN] = "RES_CAT_CFN",
+ [RES_CAT_COT] = "RES_CAT_COT",
+ [RES_CAT_EXO] = "RES_CAT_EXO",
+ [RES_CAT_LEN] = "RES_CAT_LEN",
+ [RES_KM_FLOW_TYPE] = "RES_KM_FLOW_TYPE",
+ [RES_KM_CATEGORY] = "RES_KM_CATEGORY",
+ [RES_HSH_RCP] = "RES_HSH_RCP",
+ [RES_PDB_RCP] = "RES_PDB_RCP",
+ [RES_QSL_RCP] = "RES_QSL_RCP",
+ [RES_QSL_QST] = "RES_QSL_QST",
+ [RES_SLC_LR_RCP] = "RES_SLC_LR_RCP",
+ [RES_FLM_FLOW_TYPE] = "RES_FLM_FLOW_TYPE",
+ [RES_FLM_RCP] = "RES_FLM_RCP",
+ [RES_TPE_RCP] = "RES_TPE_RCP",
+ [RES_TPE_EXT] = "RES_TPE_EXT",
+ [RES_TPE_RPL] = "RES_TPE_RPL",
+ [RES_SCRUB_RCP] = "RES_SCRUB_RCP",
+ [RES_COUNT] = "RES_COUNT",
+ [RES_INVALID] = "RES_INVALID"
};
+static_assert(RTE_DIM(dbg_res_descr) == RES_END,
+ "The list of debug descriptions is not fully completed");
+
static struct flow_nic_dev *dev_base;
static rte_spinlock_t base_mtx = RTE_SPINLOCK_INITIALIZER;
@@ -51,38 +54,99 @@ static rte_spinlock_t base_mtx = RTE_SPINLOCK_INITIALIZER;
static const struct {
const char *message;
} err_msg[] = {
- /* 00 */ { "Operation successfully completed" },
- /* 01 */ { "Operation failed" },
- /* 02 */ { "Memory allocation failed" },
- /* 03 */ { "Too many output destinations" },
- /* 04 */ { "Too many output queues for RSS" },
- /* 05 */ { "The VLAN TPID specified is not supported" },
- /* 06 */ { "The VxLan Push header specified is not accepted" },
- /* 07 */ { "While interpreting VxLan Pop action, could not find a destination port" },
- /* 08 */ { "Failed in creating a HW-internal VTEP port" },
- /* 09 */ { "Too many VLAN tag matches" },
- /* 10 */ { "IPv6 invalid header specified" },
- /* 11 */ { "Too many tunnel ports. HW limit reached" },
- /* 12 */ { "Unknown or unsupported flow match element received" },
- /* 13 */ { "Match failed because of HW limitations" },
- /* 14 */ { "Match failed because of HW resource limitations" },
- /* 15 */ { "Match failed because of too complex element definitions" },
- /* 16 */ { "Action failed. To too many output destinations" },
- /* 17 */ { "Action Output failed, due to HW resource exhaustion" },
- /* 18 */ { "Push Tunnel Header action cannot output to multiple destination queues" },
- /* 19 */ { "Inline action HW resource exhaustion" },
- /* 20 */ { "Action retransmit/recirculate HW resource exhaustion" },
- /* 21 */ { "Flow counter HW resource exhaustion" },
- /* 22 */ { "Internal HW resource exhaustion to handle Actions" },
- /* 23 */ { "Internal HW QSL compare failed" },
- /* 24 */ { "Internal CAT CFN reuse failed" },
- /* 25 */ { "Match variations too complex" },
- /* 26 */ { "Match failed because of CAM/TCAM full" },
- /* 27 */ { "Internal creation of a tunnel end point port failed" },
- /* 28 */ { "Unknown or unsupported flow action received" },
- /* 29 */ { "Removing flow failed" },
+ [ERR_SUCCESS] = {
+ "Operation successfully completed" },
+ [ERR_FAILED] = {
+ "Operation failed" },
+ [ERR_MEMORY] = {
+ "Memory allocation failed" },
+ [ERR_OUTPUT_TOO_MANY] = {
+ "Too many output destinations" },
+ [ERR_RSS_TOO_MANY_QUEUES] = {
+ "Too many output queues for RSS" },
+ [ERR_VLAN_TYPE_NOT_SUPPORTED] = {
+ "The VLAN TPID specified is not supported" },
+ [ERR_VXLAN_HEADER_NOT_ACCEPTED] = {
+ "The VxLan Push header specified is not accepted" },
+ [ERR_VXLAN_POP_INVALID_RECIRC_PORT] = {
+ "While interpreting VxLan Pop action, could not find a destination port" },
+ [ERR_VXLAN_POP_FAILED_CREATING_VTEP] = {
+ "Failed in creating a HW-internal VTEP port" },
+ [ERR_MATCH_VLAN_TOO_MANY] = {
+ "Too many VLAN tag matches" },
+ [ERR_MATCH_INVALID_IPV6_HDR] = {
+ "IPv6 invalid header specified" },
+ [ERR_MATCH_TOO_MANY_TUNNEL_PORTS] = {
+ "Too many tunnel ports. HW limit reached" },
+ [ERR_MATCH_INVALID_OR_UNSUPPORTED_ELEM] = {
+ "Unknown or unsupported flow match element received" },
+ [ERR_MATCH_FAILED_BY_HW_LIMITS] = {
+ "Match failed because of HW limitations" },
+ [ERR_MATCH_RESOURCE_EXHAUSTION] = {
+ "Match failed because of HW resource limitations" },
+ [ERR_MATCH_FAILED_TOO_COMPLEX] = {
+ "Match failed because of too complex element definitions" },
+ [ERR_ACTION_REPLICATION_FAILED] = {
+ "Action failed. To too many output destinations" },
+ [ERR_ACTION_OUTPUT_RESOURCE_EXHAUSTION] = {
+ "Action Output failed, due to HW resource exhaustion" },
+ [ERR_ACTION_TUNNEL_HEADER_PUSH_OUTPUT_LIMIT] = {
+ "Push Tunnel Header action cannot output to multiple destination queues" },
+ [ERR_ACTION_INLINE_MOD_RESOURCE_EXHAUSTION] = {
+ "Inline action HW resource exhaustion" },
+ [ERR_ACTION_RETRANSMIT_RESOURCE_EXHAUSTION] = {
+ "Action retransmit/recirculate HW resource exhaustion" },
+ [ERR_ACTION_FLOW_COUNTER_EXHAUSTION] = {
+ "Flow counter HW resource exhaustion" },
+ [ERR_ACTION_INTERNAL_RESOURCE_EXHAUSTION] = {
+ "Internal HW resource exhaustion to handle Actions" },
+ [ERR_INTERNAL_QSL_COMPARE_FAILED] = {
+ "Internal HW QSL compare failed" },
+ [ERR_INTERNAL_CAT_FUNC_REUSE_FAILED] = {
+ "Internal CAT CFN reuse failed" },
+ [ERR_MATCH_ENTROPHY_FAILED] = {
+ "Match variations too complex" },
+ [ERR_MATCH_CAM_EXHAUSTED] = {
+ "Match failed because of CAM/TCAM full" },
+ [ERR_INTERNAL_VIRTUAL_PORT_CREATION_FAILED] = {
+ "Internal creation of a tunnel end point port failed" },
+ [ERR_ACTION_UNSUPPORTED] = {
+ "Unknown or unsupported flow action received" },
+ [ERR_REMOVE_FLOW_FAILED] = {
+ "Removing flow failed" },
+ [ERR_ACTION_NO_OUTPUT_DEFINED_USE_DEFAULT] = {
+ "No output queue specified. Ignore this flow offload and uses default queue"},
+ [ERR_ACTION_NO_OUTPUT_QUEUE_FOUND] = {
+ "No output queue found"},
+ [ERR_MATCH_UNSUPPORTED_ETHER_TYPE] = {
+ "Unsupported EtherType or rejected caused by offload policy"},
+ [ERR_OUTPUT_INVALID] = {
+ "Destination port specified is invalid or not reachable from this NIC"},
+ [ERR_MATCH_PARTIAL_OFFLOAD_NOT_SUPPORTED] = {
+ "Partial offload is not supported in this configuration"},
+ [ERR_MATCH_CAT_CAM_EXHAUSTED] = {
+ "Match failed because of CAT CAM exhausted"},
+ [ERR_MATCH_KCC_KEY_CLASH] = {
+ "Match failed because of CAT CAM Key clashed with an existing KCC Key"},
+ [ERR_MATCH_CAT_CAM_FAILED] = {
+ "Match failed because of CAT CAM write failed"},
+ [ERR_PARTIAL_FLOW_MARK_TOO_BIG] = {
+ "Partial flow mark too big for device"},
+ [ERR_FLOW_PRIORITY_VALUE_INVALID] = {
+ "Invalid priority value"},
+ [ERR_ACTION_MULTIPLE_PORT_ID_UNSUPPORTED] = {
+ "Multiple port_id actions for one flow is not supported"},
+ [ERR_RSS_TOO_LONG_KEY] = {
+ "Too long hash key for RSS"},
+ [ERR_ACTION_AGE_UNSUPPORTED_GROUP_0] = {
+ "Action AGE is not supported for flow in group 0"},
+ [ERR_MSG_NO_MSG] = {
+ "Unknown error"},
};
+static_assert(RTE_DIM(err_msg) == ERR_MSG_END,
+ "The list of error messages is not fully completed.");
+
void flow_nic_set_error(enum flow_nic_err_msg_e msg, struct rte_flow_error *error)
{
assert(msg < ERR_MSG_NO_MSG);
--
2.45.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] net/ntnic: fix of Toeplitz key and log with mask
2024-11-22 22:49 [PATCH v2 0/2] Bugfixes Serhii Iliushyk
2024-11-22 22:49 ` [PATCH v2 1/2] net/ntnic: fix incorrect error message Serhii Iliushyk
@ 2024-11-22 22:49 ` Serhii Iliushyk
1 sibling, 0 replies; 4+ messages in thread
From: Serhii Iliushyk @ 2024-11-22 22:49 UTC (permalink / raw)
To: dev
Cc: mko-plv, sil-plv, ckm, andrew.rybchenko, ferruh.yigit, stephen,
Danylo Vodopianov
Toeplitz secret key word order was reversed during programming into
FPGA, which lead to unexpected rss hash values.
Fixes: 7fa0bf29e667 ("net/ntnic: add hash module")
Signed-off-by: Serhii Iliushyk <sil-plv@napatech.com>
---
.../profile_inline/flow_api_profile_inline.c | 61 +++++++------------
1 file changed, 21 insertions(+), 40 deletions(-)
diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c
index a34839e00c..fbe8ee2795 100644
--- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c
+++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c
@@ -3825,7 +3825,6 @@ struct hsh_words {
* is used for hash mask calculation
*/
uint8_t index;
- uint8_t toeplitz_index; /* offset in Bytes of given [Q]W inside Toeplitz RSS key */
enum hw_hsh_e pe; /* offset to header part, e.g. beginning of L4 */
enum hw_hsh_e ofs; /* relative offset in BYTES to 'pe' header offset above */
uint16_t bit_len; /* max length of header part in bits to fit into QW/W */
@@ -3874,7 +3873,6 @@ static int flow_nic_set_hasher_part_inline(struct flow_nic_dev *ndev, int hsh_id
/* set HW_HSH_RCP_WORD_MASK based on used QW/W and given 'bit_len' */
int mask_bit_len = bit_len;
uint32_t mask = 0x0;
- uint32_t mask_be = 0x0;
uint32_t toeplitz_mask[9] = { 0x0 };
/* iterate through all words of QW */
uint16_t words_count = words[word].bit_len / 32;
@@ -3883,27 +3881,23 @@ static int flow_nic_set_hasher_part_inline(struct flow_nic_dev *ndev, int hsh_id
if (mask_bit_len >= 32) {
mask_bit_len -= 32;
mask = 0xffffffff;
- mask_be = mask;
} else if (mask_bit_len > 0) {
- /* keep bits from left to right, i.e. little to big endian */
- mask_be = 0xffffffff >> (32 - mask_bit_len);
- mask = mask_be << (32 - mask_bit_len);
+ mask = 0xffffffff >> (32 - mask_bit_len) << (32 - mask_bit_len);
mask_bit_len = 0;
} else {
mask = 0x0;
- mask_be = 0x0;
}
/* reorder QW words mask from little to big endian */
res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_WORD_MASK, hsh_idx,
words[word].index + words_count - mask_off, mask);
- NT_LOG(DBG, FILTER,
- "hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_WORD_MASK, %d, %d, 0x%" PRIX32
+ NT_LOG_DBGX(DBG, FILTER,
+ "hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_WORD_MASK, %d, %d, 0x%08" PRIX32
")",
hsh_idx, words[word].index + words_count - mask_off, mask);
- toeplitz_mask[words[word].toeplitz_index + mask_off - 1] = mask_be;
+ toeplitz_mask[words[word].index + mask_off - 1] = mask;
}
if (toeplitz) {
@@ -3911,9 +3905,9 @@ static int flow_nic_set_hasher_part_inline(struct flow_nic_dev *ndev, int hsh_id
"Partial Toeplitz RSS key mask: %08" PRIX32 " %08" PRIX32 " %08" PRIX32
" %08" PRIX32 " %08" PRIX32 " %08" PRIX32 " %08" PRIX32 " %08" PRIX32
" %08" PRIX32 "",
- toeplitz_mask[8], toeplitz_mask[7], toeplitz_mask[6], toeplitz_mask[5],
- toeplitz_mask[4], toeplitz_mask[3], toeplitz_mask[2], toeplitz_mask[1],
- toeplitz_mask[0]);
+ toeplitz_mask[0], toeplitz_mask[1], toeplitz_mask[2], toeplitz_mask[3],
+ toeplitz_mask[4], toeplitz_mask[5], toeplitz_mask[6], toeplitz_mask[7],
+ toeplitz_mask[8]);
NT_LOG(DBG, FILTER,
" MSB LSB");
}
@@ -4632,11 +4626,11 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev, int hsh_idx,
* word | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
*/
struct hsh_words words[HSH_WORDS_SIZE] = {
- { 0, 5, HW_HSH_RCP_QW0_PE, HW_HSH_RCP_QW0_OFS, 128, true },
- { 4, 1, HW_HSH_RCP_QW4_PE, HW_HSH_RCP_QW4_OFS, 128, true },
- { 8, 0, HW_HSH_RCP_W8_PE, HW_HSH_RCP_W8_OFS, 32, true },
+ { 0, HW_HSH_RCP_QW0_PE, HW_HSH_RCP_QW0_OFS, 128, true },
+ { 4, HW_HSH_RCP_QW4_PE, HW_HSH_RCP_QW4_OFS, 128, true },
+ { 8, HW_HSH_RCP_W8_PE, HW_HSH_RCP_W8_OFS, 32, true },
{
- 9, 255, HW_HSH_RCP_W9_PE, HW_HSH_RCP_W9_OFS, 32,
+ 9, HW_HSH_RCP_W9_PE, HW_HSH_RCP_W9_OFS, 32,
true
}, /* not supported for Toeplitz */
};
@@ -4664,34 +4658,21 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev, int hsh_idx,
res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_TOEPLITZ, hsh_idx, 0, 1);
uint8_t empty_key = 0;
- /* Toeplitz key (always 40B) must be encoded from little to big endian */
- for (uint8_t i = 0; i <= (MAX_RSS_KEY_LEN - 8); i += 8) {
- res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, hsh_idx, i / 4,
- rss_conf.rss_key[i + 4] << 24 |
- rss_conf.rss_key[i + 5] << 16 |
- rss_conf.rss_key[i + 6] << 8 |
- rss_conf.rss_key[i + 7]);
- NT_LOG(DBG, FILTER,
- "hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, %d, %d, 0x%" PRIX32
- ")",
- hsh_idx, i / 4,
- rss_conf.rss_key[i + 4] << 24 | rss_conf.rss_key[i + 5] << 16 |
- rss_conf.rss_key[i + 6] << 8 | rss_conf.rss_key[i + 7]);
- res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, hsh_idx, i / 4 + 1,
- rss_conf.rss_key[i] << 24 |
- rss_conf.rss_key[i + 1] << 16 |
- rss_conf.rss_key[i + 2] << 8 |
- rss_conf.rss_key[i + 3]);
- NT_LOG(DBG, FILTER,
+ /* Toeplitz key (always 40B) words have to be programmed in reverse order */
+ for (uint8_t i = 0; i <= (MAX_RSS_KEY_LEN - 4); i += 4) {
+ res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, hsh_idx, 9 - i / 4,
+ rss_conf.rss_key[i] << 24 |
+ rss_conf.rss_key[i + 1] << 16 |
+ rss_conf.rss_key[i + 2] << 8 |
+ rss_conf.rss_key[i + 3]);
+ NT_LOG_DBG(DBG, FILTER,
"hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, %d, %d, 0x%" PRIX32
")",
- hsh_idx, i / 4 + 1,
+ hsh_idx, 9 - i / 4,
rss_conf.rss_key[i] << 24 | rss_conf.rss_key[i + 1] << 16 |
rss_conf.rss_key[i + 2] << 8 | rss_conf.rss_key[i + 3]);
empty_key |= rss_conf.rss_key[i] | rss_conf.rss_key[i + 1] |
- rss_conf.rss_key[i + 2] | rss_conf.rss_key[i + 3] |
- rss_conf.rss_key[i + 4] | rss_conf.rss_key[i + 5] |
- rss_conf.rss_key[i + 6] | rss_conf.rss_key[i + 7];
+ rss_conf.rss_key[i + 2] | rss_conf.rss_key[i + 3];
}
if (empty_key == 0) {
--
2.45.0
^ permalink raw reply [flat|nested] 4+ messages in thread