blob: 8f1c4145a182c4d5e92970f4c19635fa9099963d [file] [log] [blame]
Codrin Ciubotariu4ea54e32015-07-24 16:55:27 +03001/*
2 * Copyright 2015 Freescale Semiconductor, Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 *
6 * Ethernet Switch commands
7 */
8
9#ifndef _CMD_ETHSW_H_
10#define _CMD_ETHSW_H_
11
12#define ETHSW_MAX_CMD_PARAMS 20
13#define ETHSW_CMD_PORT_ALL -1
14
15/* IDs used to track keywords in a command */
16enum ethsw_keyword_id {
17 ethsw_id_key_end = -1,
18 ethsw_id_help,
19 ethsw_id_show,
20 ethsw_id_port,
21 ethsw_id_enable,
22 ethsw_id_disable,
Codrin Ciubotariu86719f02015-07-24 16:55:29 +030023 ethsw_id_statistics,
24 ethsw_id_clear,
Codrin Ciubotariu4ea54e32015-07-24 16:55:27 +030025 ethsw_id_count, /* keep last */
26};
27
28enum ethsw_keyword_opt_id {
29 ethsw_id_port_no = ethsw_id_count + 1,
30 ethsw_id_count_all, /* keep last */
31};
32
33struct ethsw_command_def {
34 int cmd_to_keywords[ETHSW_MAX_CMD_PARAMS];
35 int cmd_keywords_nr;
36 int port;
37 int (*cmd_function)(struct ethsw_command_def *parsed_cmd);
38};
39
40/* Structure to be created and initialized by an Ethernet Switch driver */
41struct 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);
Codrin Ciubotariu86719f02015-07-24 16:55:29 +030046 int (*port_stats)(struct ethsw_command_def *parsed_cmd);
47 int (*port_stats_clear)(struct ethsw_command_def *parsed_cmd);
Codrin Ciubotariu4ea54e32015-07-24 16:55:27 +030048};
49
50int ethsw_define_functions(const struct ethsw_command_func *cmd_func);
51
52#endif /* _CMD_ETHSW_H_ */