2 * Copyright 2015 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
6 * Ethernet Switch commands
12 #define ETHSW_MAX_CMD_PARAMS 20
13 #define ETHSW_CMD_PORT_ALL -1
15 /* IDs used to track keywords in a command */
16 enum ethsw_keyword_id {
17 ethsw_id_key_end = -1,
25 ethsw_id_count, /* keep last */
28 enum ethsw_keyword_opt_id {
29 ethsw_id_port_no = ethsw_id_count + 1,
30 ethsw_id_count_all, /* keep last */
33 struct ethsw_command_def {
34 int cmd_to_keywords[ETHSW_MAX_CMD_PARAMS];
37 int (*cmd_function)(struct ethsw_command_def *parsed_cmd);
40 /* Structure to be created and initialized by an Ethernet Switch driver */
41 struct ethsw_command_func {
42 const char *ethsw_name;
43 int (*port_enable)(struct ethsw_command_def *parsed_cmd);
44 int (*port_disable)(struct ethsw_command_def *parsed_cmd);
45 int (*port_show)(struct ethsw_command_def *parsed_cmd);
46 int (*port_stats)(struct ethsw_command_def *parsed_cmd);
47 int (*port_stats_clear)(struct ethsw_command_def *parsed_cmd);
50 int ethsw_define_functions(const struct ethsw_command_func *cmd_func);
52 #endif /* _CMD_ETHSW_H_ */