aboutsummaryrefslogtreecommitdiff
path: root/common/cmd_ethsw.c
diff options
context:
space:
mode:
authorCodrin Ciubotariu2015-07-24 16:55:30 +0300
committerYork Sun2015-09-21 08:29:47 -0700
commit68c929da6bf754ace639b2159e2d5b9e22323aaa (patch)
tree0c4be2ff82ca86a48eeaee9d330e5318202ad89a /common/cmd_ethsw.c
parent86719f0cd55bc13186798217b08fa6a048eda27c (diff)
drivers/net/vsc9953: Add commands to enable/disable HW learning
The command: ethsw [port <port_no>] learning { [help] | show | auto | disable } can be used to enable/disable HW learning on a port. This patch also adds this command to the generic ethsw parser from cmd_ethsw. Signed-off-by: Johnson Leung <johnson.leung@freescale.com> Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: York Sun <yorksun@freescale.com>
Diffstat (limited to 'common/cmd_ethsw.c')
-rw-r--r--common/cmd_ethsw.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/common/cmd_ethsw.c b/common/cmd_ethsw.c
index 8c54a3d7e46..c1c33d10482 100644
--- a/common/cmd_ethsw.c
+++ b/common/cmd_ethsw.c
@@ -23,6 +23,17 @@ static int ethsw_port_stats_help_key_func(struct ethsw_command_def *parsed_cmd)
return CMD_RET_SUCCESS;
}
+#define ETHSW_LEARN_HELP "ethsw [port <port_no>] learning " \
+"{ [help] | show | auto | disable } " \
+"- enable/disable/show learning configuration on a port"
+
+static int ethsw_learn_help_key_func(struct ethsw_command_def *parsed_cmd)
+{
+ printf(ETHSW_LEARN_HELP"\n");
+
+ return CMD_RET_SUCCESS;
+}
+
static struct keywords_to_function {
enum ethsw_keyword_id cmd_keyword[ETHSW_MAX_CMD_PARAMS];
int cmd_func_offset;
@@ -77,6 +88,48 @@ static struct keywords_to_function {
.cmd_func_offset = offsetof(struct ethsw_command_func,
port_stats_clear),
.keyword_function = NULL,
+ }, {
+ .cmd_keyword = {
+ ethsw_id_learning,
+ ethsw_id_key_end,
+ },
+ .cmd_func_offset = -1,
+ .keyword_function = &ethsw_learn_help_key_func,
+ }, {
+ .cmd_keyword = {
+ ethsw_id_learning,
+ ethsw_id_help,
+ ethsw_id_key_end,
+ },
+ .cmd_func_offset = -1,
+ .keyword_function = &ethsw_learn_help_key_func,
+ }, {
+ .cmd_keyword = {
+ ethsw_id_learning,
+ ethsw_id_show,
+ ethsw_id_key_end,
+ },
+ .cmd_func_offset = offsetof(struct ethsw_command_func,
+ port_learn_show),
+ .keyword_function = NULL,
+ }, {
+ .cmd_keyword = {
+ ethsw_id_learning,
+ ethsw_id_auto,
+ ethsw_id_key_end,
+ },
+ .cmd_func_offset = offsetof(struct ethsw_command_func,
+ port_learn),
+ .keyword_function = NULL,
+ }, {
+ .cmd_keyword = {
+ ethsw_id_learning,
+ ethsw_id_disable,
+ ethsw_id_key_end,
+ },
+ .cmd_func_offset = offsetof(struct ethsw_command_func,
+ port_learn),
+ .keyword_function = NULL,
},
};
@@ -129,6 +182,12 @@ struct keyword_def {
}, {
.keyword_name = "clear",
.match = &keyword_match_gen,
+ }, {
+ .keyword_name = "learning",
+ .match = &keyword_match_gen,
+ }, {
+ .keyword_name = "auto",
+ .match = &keyword_match_gen,
},
};
@@ -386,4 +445,5 @@ U_BOOT_CMD(ethsw, ETHSW_MAX_CMD_PARAMS, 0, do_ethsw,
"Ethernet l2 switch commands",
ETHSW_PORT_CONF_HELP"\n"
ETHSW_PORT_STATS_HELP"\n"
+ ETHSW_LEARN_HELP"\n"
);