blob: cc16c20e33a9775a1aad688d9d494d7c79b4a4ca [file] [log] [blame]
developer880c8292022-07-11 11:52:59 +08001/*
2* switch_fun.h: switch function sets
3*/
4#ifndef SWITCH_FUN_H
5#define SWITCH_FUN_H
6
7#include <stdbool.h>
8
developere78dab52024-03-25 14:26:39 +08009void (*pf_chip_func)(int argc, char *argv[]);
10
11struct switch_func_s {
12 void (*pf_table_dump)(int argc, char *argv[]);
13 void (*pf_table_clear)(int argc, char *argv[]);
14 void (*pf_switch_reset)(int argc, char *argv[]);
15 void (*pf_doArlAging)(int argc, char *argv[]);
16 void (*pf_read_mib_counters)(int argc, char *argv[]);
17 void (*pf_clear_mib_counters)(int argc, char *argv[]);
18 void (*pf_read_output_queue_counters)(int argc, char *argv[]);
19 void (*pf_read_free_page_counters)(int argc, char *argv[]);
20 void (*pf_rate_control)(int argc, char *argv[]);
21 void (*pf_igress_rate_set)(int argc, char *argv[]);
22 void (*pf_egress_rate_set)(int argc, char *argv[]);
23 void (*pf_table_add)(int argc, char *argv[]);
24 void (*pf_table_del_fid)(int argc, char *argv[]);
25 void (*pf_table_del_vid)(int argc, char *argv[]);
26 void (*pf_table_search_mac_fid)(int argc, char *argv[]);
27 void (*pf_table_search_mac_vid)(int argc, char *argv[]);
28 void (*pf_global_set_mac_fc)(int argc, char *argv[]);
29 void (*pf_set_mac_pfc)(int argc, char *argv[]);
30 void (*pf_qos_sch_select)(int argc, char *argv[]);
31 void (*pf_qos_set_base)(int argc, char *argv[]);
32 void (*pf_qos_wfq_set_weight)(int argc, char *argv[]);
33 void (*pf_qos_set_portpri)(int argc, char *argv[]);
34 void (*pf_qos_set_dscppri)(int argc, char *argv[]);
35 void (*pf_qos_pri_mapping_queue)(int argc, char *argv[]);
36 void (*pf_doStp)(int argc, char *argv[]);
37 void (*pf_sip_dump)(int argc, char *argv[]);
38 void (*pf_sip_add)(int argc, char *argv[]);
39 void (*pf_sip_del)(int argc, char *argv[]);
40 void (*pf_sip_clear)(int argc, char *argv[]);
41 void (*pf_dip_dump)(int argc, char *argv[]);
42 void (*pf_dip_add)(int argc, char *argv[]);
43 void (*pf_dip_del)(int argc, char *argv[]);
44 void (*pf_dip_clear)(int argc, char *argv[]);
45 void (*pf_set_mirror_to)(int argc, char *argv[]);
46 void (*pf_set_mirror_from)(int argc, char *argv[]);
47 void (*pf_doMirrorEn)(int argc, char *argv[]);
48 void (*pf_doMirrorPortBased)(int argc, char *argv[]);
49 void (*pf_acl_dip_add)(int argc, char *argv[]);
50 void (*pf_acl_dip_modify)(int argc, char *argv[]);
51 void (*pf_acl_dip_pppoe)(int argc, char *argv[]);
52 void (*pf_acl_dip_trtcm)(int argc, char *argv[]);
53 void (*pf_acl_dip_meter)(int argc, char *argv[]);
54 void (*pf_acl_mac_add)(int argc, char *argv[]);
55 void (*pf_acl_ethertype)(int argc, char *argv[]);
56 void (*pf_acl_sp_add)(int argc, char *argv[]);
57 void (*pf_acl_l4_add)(int argc, char *argv[]);
58 void (*pf_acl_port_enable)(int argc, char *argv[]);
59 void (*pf_acl_table_add)(int argc, char *argv[]);
60 void (*pf_acl_mask_table_add)(int argc, char *argv[]);
61 void (*pf_acl_rule_table_add)(int argc, char *argv[]);
62 void (*pf_acl_rate_table_add)(int argc, char *argv[]);
63 void (*pf_vlan_dump)(int argc, char *argv[]);
64 void (*pf_vlan_set)(int argc, char *argv[]);
65 void (*pf_vlan_clear)(int argc, char *argv[]);
66 void (*pf_doVlanSetVid)(int argc, char *argv[]);
67 void (*pf_doVlanSetPvid)(int argc, char *argv[]);
68 void (*pf_doVlanSetAccFrm)(int argc, char *argv[]);
69 void (*pf_doVlanSetPortAttr)(int argc, char *argv[]);
70 void (*pf_doVlanSetPortMode)(int argc, char *argv[]);
71 void (*pf_doVlanSetEgressTagPCR)(int argc, char *argv[]);
72 void (*pf_doVlanSetEgressTagPVC)(int argc, char *argv[]);
73 void (*pf_igmp_on)(int argc, char *argv[]);
74 void (*pf_igmp_off)(int argc, char *argv[]);
75 void (*pf_igmp_enable)(int argc, char *argv[]);
76 void (*pf_igmp_disable)(int argc, char *argv[]);
77 void (*pf_collision_pool_enable)(int argc, char *argv[]);
78 void (*pf_collision_pool_mac_dump)(int argc, char *argv[]);
79 void (*pf_collision_pool_dip_dump)(int argc, char *argv[]);
80 void (*pf_collision_pool_sip_dump)(int argc, char *argv[]);
81 void (*pf_pfc_get_rx_counter)(int argc, char *argv[]);
82 void (*pf_pfc_get_tx_counter)(int argc, char *argv[]);
83 void (*pf_eee_enable)(int argc, char *argv[]);
84 void (*pf_eee_dump)(int argc, char *argv[]);
85};
86
developer880c8292022-07-11 11:52:59 +080087#define MT7530_T10_TEST_CONTROL 0x145
88
89#define MAX_PORT 6
developer5dfa8b72022-11-03 11:33:07 +080090#define MAX_PHY_PORT 5
developer880c8292022-07-11 11:52:59 +080091#define CONFIG_MTK_7531_DVT 1
92
93extern int chip_name;
94extern struct mt753x_attr *attres;
95extern bool nl_init_flag;
developere78dab52024-03-25 14:26:39 +080096extern struct switch_func_s mt753x_switch_func;
97extern struct switch_func_s an8855_switch_func;
developer880c8292022-07-11 11:52:59 +080098
99/*basic operation*/
developer5dfa8b72022-11-03 11:33:07 +0800100int reg_read(unsigned int offset, unsigned int *value);
101int reg_write(unsigned int offset, unsigned int value);
102int mii_mgr_read(unsigned int port_num, unsigned int reg, unsigned int *value);
developer880c8292022-07-11 11:52:59 +0800103int mii_mgr_write(unsigned int port_num, unsigned int reg, unsigned int value);
developere78dab52024-03-25 14:26:39 +0800104int mii_mgr_c45_read(unsigned int port_num, unsigned int dev, unsigned int reg,
105 unsigned int *value);
106int mii_mgr_c45_write(unsigned int port_num, unsigned int dev, unsigned int reg,
107 unsigned int value);
developer880c8292022-07-11 11:52:59 +0800108
109/*phy setting*/
110int phy_dump(int phy_addr);
111void phy_crossover(int argc, char *argv[]);
112int rw_phy_token_ring(int argc, char *argv[]);
113/*arl setting*/
114void doArlAging(int argc, char *argv[]);
115
116/*acl setting*/
117void acl_mac_add(int argc, char *argv[]);
118void acl_dip_meter(int argc, char *argv[]);
119void acl_dip_trtcm(int argc, char *argv[]);
120void acl_ethertype(int argc, char *argv[]);
121void acl_ethertype(int argc, char *argv[]);
122void acl_dip_modify(int argc, char *argv[]);
123void acl_dip_pppoe(int argc, char *argv[]);
124void acl_dip_add(int argc, char *argv[]);
125void acl_l4_add(int argc, char *argv[]);
126void acl_sp_add(int argc, char *argv[]);
127
128void acl_port_enable(int argc, char *argv[]);
129void acl_table_add(int argc, char *argv[]);
130void acl_mask_table_add(int argc, char *argv[]);
131void acl_rule_table_add(int argc, char *argv[]);
132void acl_rate_table_add(int argc, char *argv[]);
133
134/*dip table*/
developere78dab52024-03-25 14:26:39 +0800135void dip_dump(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800136void dip_add(int argc, char *argv[]);
137void dip_del(int argc, char *argv[]);
developere78dab52024-03-25 14:26:39 +0800138void dip_clear(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800139
140/*sip table*/
developere78dab52024-03-25 14:26:39 +0800141void sip_dump(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800142void sip_add(int argc, char *argv[]);
143void sip_del(int argc, char *argv[]);
developere78dab52024-03-25 14:26:39 +0800144void sip_clear(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800145
146/*stp*/
147void doStp(int argc, char *argv[]);
148
149/*mac table*/
developere78dab52024-03-25 14:26:39 +0800150void table_dump(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800151void table_add(int argc, char *argv[]);
152void table_search_mac_vid(int argc, char *argv[]);
153void table_search_mac_fid(int argc, char *argv[]);
154void table_del_fid(int argc, char *argv[]);
155void table_del_vid(int argc, char *argv[]);
developere78dab52024-03-25 14:26:39 +0800156void table_clear(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800157
158/*vlan table*/
developer5dfa8b72022-11-03 11:33:07 +0800159void vlan_dump(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800160void vlan_clear(int argc, char *argv[]);
161void vlan_set(int argc, char *argv[]);
162
163void doVlanSetPvid(int argc, char *argv[]);
164void doVlanSetVid(int argc, char *argv[]);
165void doVlanSetAccFrm(int argc, char *argv[]);
166void doVlanSetPortAttr(int argc, char *argv[]);
167void doVlanSetPortMode(int argc, char *argv[]);
168void doVlanSetEgressTagPCR(int argc, char *argv[]);
169void doVlanSetEgressTagPVC(int argc, char *argv[]);
170
171/*igmp function*/
172void igmp_on(int argc, char *argv[]);
developere78dab52024-03-25 14:26:39 +0800173void igmp_off(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800174void igmp_disable(int argc, char *argv[]);
175void igmp_enable(int argc, char *argv[]);
176
177/*mirror function*/
178void set_mirror_to(int argc, char *argv[]);
179void set_mirror_from(int argc, char *argv[]);
180void doMirrorPortBased(int argc, char *argv[]);
181void doMirrorEn(int argc, char *argv[]);
182
183/*rate control*/
184void rate_control(int argc, char *argv[]);
developere78dab52024-03-25 14:26:39 +0800185void ingress_rate_set(int argc, char *argv[]);
186void egress_rate_set(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800187
188/*QoS*/
developere78dab52024-03-25 14:26:39 +0800189void qos_sch_select(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800190void qos_set_base(int argc, char *argv[]);
191void qos_wfq_set_weight(int argc, char *argv[]);
192void qos_set_portpri(int argc, char *argv[]);
193void qos_set_dscppri(int argc, char *argv[]);
194void qos_pri_mapping_queue(int argc, char *argv[]);
195
196/*flow control*/
developere78dab52024-03-25 14:26:39 +0800197void global_set_mac_fc(int argc, char *argv[]);
198void phy_set_fc(int argc, char *argv[]);
199void phy_set_an(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800200
201/* collision pool functions */
developere78dab52024-03-25 14:26:39 +0800202void collision_pool_enable(int argc, char *argv[]);
203void collision_pool_mac_dump(int argc, char *argv[]);
204void collision_pool_dip_dump(int argc, char *argv[]);
205void collision_pool_sip_dump(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800206
207/*pfc functions*/
developere78dab52024-03-25 14:26:39 +0800208void set_mac_pfc(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800209void pfc_get_rx_counter(int argc, char *argv[]);
210void pfc_get_tx_counter(int argc, char *argv[]);
211
212/*switch reset*/
developere78dab52024-03-25 14:26:39 +0800213void switch_reset(int argc, char *argv[]);
developer5dfa8b72022-11-03 11:33:07 +0800214
215/* EEE(802.3az) function */
216void eee_enable(int argc, char *argv[]);
217void eee_dump(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800218
developere78dab52024-03-25 14:26:39 +0800219void read_mib_counters(int argc, char *argv[]);
220void clear_mib_counters(int argc, char *argv[]);
221void read_output_queue_counters(int argc, char *argv[]);
222void read_free_page_counters(int argc, char *argv[]);
developer880c8292022-07-11 11:52:59 +0800223
224void phy_crossover(int argc, char *argv[]);
225void exit_free();
developer5dfa8b72022-11-03 11:33:07 +0800226#endif