1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2015 Freescale Semiconductor, Inc.
5 * Ethernet Switch commands
11 #define ETHSW_MAX_CMD_PARAMS 20
12 #define ETHSW_CMD_PORT_ALL -1
13 #define ETHSW_CMD_VLAN_ALL -1
14 #define ETHSW_CMD_AGGR_GRP_NONE -1
16 /* IDs used to track keywords in a command */
17 enum ethsw_keyword_id {
18 ethsw_id_key_end = -1,
45 ethsw_id_count, /* keep last */
48 enum ethsw_keyword_opt_id {
49 ethsw_id_port_no = ethsw_id_count + 1,
55 ethsw_id_count_all, /* keep last */
58 struct ethsw_command_def {
59 int cmd_to_keywords[ETHSW_MAX_CMD_PARAMS];
65 int (*cmd_function)(struct ethsw_command_def *parsed_cmd);
68 /* Structure to be created and initialized by an Ethernet Switch driver */
69 struct ethsw_command_func {
70 const char *ethsw_name;
71 int (*port_enable)(struct ethsw_command_def *parsed_cmd);
72 int (*port_disable)(struct ethsw_command_def *parsed_cmd);
73 int (*port_show)(struct ethsw_command_def *parsed_cmd);
74 int (*port_stats)(struct ethsw_command_def *parsed_cmd);
75 int (*port_stats_clear)(struct ethsw_command_def *parsed_cmd);
76 int (*port_learn)(struct ethsw_command_def *parsed_cmd);
77 int (*port_learn_show)(struct ethsw_command_def *parsed_cmd);
78 int (*fdb_show)(struct ethsw_command_def *parsed_cmd);
79 int (*fdb_flush)(struct ethsw_command_def *parsed_cmd);
80 int (*fdb_entry_add)(struct ethsw_command_def *parsed_cmd);
81 int (*fdb_entry_del)(struct ethsw_command_def *parsed_cmd);
82 int (*pvid_show)(struct ethsw_command_def *parsed_cmd);
83 int (*pvid_set)(struct ethsw_command_def *parsed_cmd);
84 int (*vlan_show)(struct ethsw_command_def *parsed_cmd);
85 int (*vlan_set)(struct ethsw_command_def *parsed_cmd);
86 int (*port_untag_show)(struct ethsw_command_def *parsed_cmd);
87 int (*port_untag_set)(struct ethsw_command_def *parsed_cmd);
88 int (*port_egr_vlan_show)(struct ethsw_command_def *parsed_cmd);
89 int (*port_egr_vlan_set)(struct ethsw_command_def *parsed_cmd);
90 int (*vlan_learn_show)(struct ethsw_command_def *parsed_cmd);
91 int (*vlan_learn_set)(struct ethsw_command_def *parsed_cmd);
92 int (*port_ingr_filt_show)(struct ethsw_command_def *parsed_cmd);
93 int (*port_ingr_filt_set)(struct ethsw_command_def *parsed_cmd);
94 int (*port_aggr_show)(struct ethsw_command_def *parsed_cmd);
95 int (*port_aggr_set)(struct ethsw_command_def *parsed_cmd);
98 int ethsw_define_functions(const struct ethsw_command_func *cmd_func);
100 #endif /* _CMD_ETHSW_H_ */