Merge "[qca-ssdk]: add HPPE rss hash UCI feature"
diff --git a/include/shell_lib/shell_io.h b/include/shell_lib/shell_io.h
index 20b0486..cfd0088 100755
--- a/include/shell_lib/shell_io.h
+++ b/include/shell_lib/shell_io.h
@@ -423,6 +423,13 @@
cmd_data_check_servcode_config(char *info, fal_servcode_config_t *val, a_uint32_t size);
#endif
+#ifdef IN_RSS_HASH
+sw_error_t
+cmd_data_check_rss_hash_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+sw_error_t
+cmd_data_check_rss_hash_config(char *info, fal_rss_hash_config_t *val, a_uint32_t size);
+#endif
+
#ifdef IN_MIRROR
sw_error_t
cmd_data_check_mirr_analy_cfg(char *info, void *val, a_uint32_t size);
diff --git a/src/ref/ref_uci.c b/src/ref/ref_uci.c
index 37103f8..90e8e1c 100755
--- a/src/ref/ref_uci.c
+++ b/src/ref/ref_uci.c
@@ -4055,6 +4055,55 @@
#endif
#endif
+#ifdef IN_RSS_HASH
+static int
+parse_rsshash_config(struct switch_val *val)
+{
+ struct switch_ext *switch_ext_p, *ext_value_p;
+ int rv = 0;
+
+ switch_ext_p = val->value.ext_val;
+ while (switch_ext_p) {
+ ext_value_p = switch_ext_p;
+
+ if (!strcmp(ext_value_p->option_name, "name")) {
+ switch_ext_p = switch_ext_p->next;
+ continue;
+ } else if (!strcmp(ext_value_p->option_name, "hash_mode")) {
+ val_ptr[0] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hask_mask")) {
+ val_ptr[1] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_fragment_mode")) {
+ val_ptr[2] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_seed")) {
+ val_ptr[3] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_sip_mix")) {
+ val_ptr[4] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_dip_mix")) {
+ val_ptr[5] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_protocol_mix")) {
+ val_ptr[6] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_sport_mix")) {
+ val_ptr[7] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_dport_mix")) {
+ val_ptr[8] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_fin_inner")) {
+ val_ptr[9] = (char*)ext_value_p->option_value;
+ } else if (!strcmp(ext_value_p->option_name, "hash_fin_outer")) {
+ val_ptr[10] = (char*)ext_value_p->option_value;
+ } else {
+ rv = -1;
+ break;
+ }
+
+ parameter_length++;
+ switch_ext_p = switch_ext_p->next;
+ }
+
+ return rv;
+}
+#endif
+
#ifdef IN_IGMP
static int
parse_igmp_mode(struct switch_val *val)
@@ -10488,6 +10537,19 @@
}
#endif
+#ifdef IN_RSS_HASH
+static int
+parse_rsshash(const char *command_name, struct switch_val *val)
+{
+ int rv = -1;
+ if (!strcmp(command_name, "Config")) {
+ rv = parse_rsshash_config(val);
+ }
+
+ return rv;
+}
+#endif
+
#ifdef IN_IGMP
static int
parse_igmp(const char *command_name, struct switch_val *val)
@@ -11267,6 +11329,10 @@
#ifdef IN_FDB
rv = parse_fdb(command_name, val);
#endif
+ } else if(!strcmp(module_name, "Rsshash")) {
+#ifdef IN_RSS_HASH
+ rv = parse_rsshash(command_name, val);
+#endif
} else if(!strcmp(module_name, "Igmp")) {
#ifdef IN_IGMP
rv = parse_igmp(command_name, val);
diff --git a/src/shell_lib/shell_io.c b/src/shell_lib/shell_io.c
index 007edfb..5798b47 100755
--- a/src/shell_lib/shell_io.c
+++ b/src/shell_lib/shell_io.c
@@ -338,6 +338,10 @@
#ifdef IN_SERVCODE
SW_TYPE_DEF(SW_SERVCODE_CONFIG, (param_check_t)cmd_data_check_servcode_config, NULL),
#endif
+ #ifdef IN_RSS_HASH
+ SW_TYPE_DEF(SW_RSS_HASH_MODE, (param_check_t)cmd_data_check_rss_hash_mode, NULL),
+ SW_TYPE_DEF(SW_RSS_HASH_CONFIG, (param_check_t)cmd_data_check_rss_hash_config, NULL),
+ #endif
#ifdef IN_MIRROR
SW_TYPE_DEF(SW_MIRR_DIRECTION, cmd_data_check_mirr_direction, NULL),
SW_TYPE_DEF(SW_MIRR_ANALYSIS_CONFIG, (param_check_t)cmd_data_check_mirr_analy_cfg, NULL),
@@ -12477,6 +12481,248 @@
}
#endif
+#ifdef IN_RSS_HASH
+sw_error_t
+cmd_data_check_rss_hash_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "ipv4v6"))
+ {
+ *arg_val = FAL_RSS_HASH_IPV4V6;
+ }
+ else if (!strcasecmp(cmd_str, "ipv4"))
+ {
+ *arg_val = FAL_RSS_HASH_IPV4ONLY;
+ }
+ else if (!strcasecmp(cmd_str, "ipv6"))
+ {
+ *arg_val = FAL_RSS_HASH_IPV6ONLY;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_rss_hash_config(char *info, fal_rss_hash_config_t *val, a_uint32_t size)
+{
+ char *cmd = NULL;
+ sw_error_t rv;
+ fal_rss_hash_config_t entry;
+
+ memset(&entry, 0, sizeof (fal_rss_hash_config_t));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_mask", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.hash_mask, sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_fragment_mode", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.hash_fragment_mode,
+ sizeof (a_bool_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_seed", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.hash_seed, sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_sip_mix", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.hash_sip_mix, sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_dip_mix", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.hash_dip_mix, sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_protocol_mix", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, (a_uint32_t *)&(entry.hash_protocol_mix), sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_sport_mix", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, (a_uint32_t *)&(entry.hash_sport_mix), sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_dport_mix", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, (a_uint32_t *)&(entry.hash_dport_mix), sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_fin_inner", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.hash_fin_inner, sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("hash_fin_outer", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.hash_fin_outer, sizeof (a_uint32_t));
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *val = entry;
+ return SW_OK;
+}
+#endif
+
#ifdef IN_MIRROR
sw_error_t
cmd_data_check_mirr_analy_cfg(char *info, void *val, a_uint32_t size)