blob: 70e4d1860be655f3be0d3af3a0028e98c77c2bf6 [file] [log] [blame]
developer21ea8132022-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
9#define MT7530_T10_TEST_CONTROL 0x145
10
11#define MAX_PORT 6
developerd23a4c12022-11-03 11:33:07 +080012#define MAX_PHY_PORT 5
developer21ea8132022-07-11 11:52:59 +080013#define CONFIG_MTK_7531_DVT 1
14
15extern int chip_name;
16extern struct mt753x_attr *attres;
17extern bool nl_init_flag;
18
19/*basic operation*/
developerd23a4c12022-11-03 11:33:07 +080020int reg_read(unsigned int offset, unsigned int *value);
21int reg_write(unsigned int offset, unsigned int value);
22int mii_mgr_read(unsigned int port_num, unsigned int reg, unsigned int *value);
developer21ea8132022-07-11 11:52:59 +080023int mii_mgr_write(unsigned int port_num, unsigned int reg, unsigned int value);
developerd23a4c12022-11-03 11:33:07 +080024int mii_mgr_c45_read(unsigned int port_num, unsigned int dev, unsigned int reg, unsigned int *value);
developer21ea8132022-07-11 11:52:59 +080025int mii_mgr_c45_write(unsigned int port_num, unsigned int dev, unsigned int reg, unsigned int value);
26
27/*phy setting*/
28int phy_dump(int phy_addr);
29void phy_crossover(int argc, char *argv[]);
30int rw_phy_token_ring(int argc, char *argv[]);
31/*arl setting*/
32void doArlAging(int argc, char *argv[]);
33
34/*acl setting*/
35void acl_mac_add(int argc, char *argv[]);
36void acl_dip_meter(int argc, char *argv[]);
37void acl_dip_trtcm(int argc, char *argv[]);
38void acl_ethertype(int argc, char *argv[]);
39void acl_ethertype(int argc, char *argv[]);
40void acl_dip_modify(int argc, char *argv[]);
41void acl_dip_pppoe(int argc, char *argv[]);
42void acl_dip_add(int argc, char *argv[]);
43void acl_l4_add(int argc, char *argv[]);
44void acl_sp_add(int argc, char *argv[]);
45
46void acl_port_enable(int argc, char *argv[]);
47void acl_table_add(int argc, char *argv[]);
48void acl_mask_table_add(int argc, char *argv[]);
49void acl_rule_table_add(int argc, char *argv[]);
50void acl_rate_table_add(int argc, char *argv[]);
51
52/*dip table*/
53void dip_dump(void);
54void dip_add(int argc, char *argv[]);
55void dip_del(int argc, char *argv[]);
56void dip_clear(void);
57
58/*sip table*/
59void sip_dump(void);
60void sip_add(int argc, char *argv[]);
61void sip_del(int argc, char *argv[]);
62void sip_clear(void);
63
64/*stp*/
65void doStp(int argc, char *argv[]);
66
67/*mac table*/
68void table_dump(void);
69void table_add(int argc, char *argv[]);
70void table_search_mac_vid(int argc, char *argv[]);
71void table_search_mac_fid(int argc, char *argv[]);
72void table_del_fid(int argc, char *argv[]);
73void table_del_vid(int argc, char *argv[]);
74void table_clear(void);
75
76/*vlan table*/
developerd23a4c12022-11-03 11:33:07 +080077void vlan_dump(int argc, char *argv[]);
developer21ea8132022-07-11 11:52:59 +080078void vlan_clear(int argc, char *argv[]);
79void vlan_set(int argc, char *argv[]);
80
81void doVlanSetPvid(int argc, char *argv[]);
82void doVlanSetVid(int argc, char *argv[]);
83void doVlanSetAccFrm(int argc, char *argv[]);
84void doVlanSetPortAttr(int argc, char *argv[]);
85void doVlanSetPortMode(int argc, char *argv[]);
86void doVlanSetEgressTagPCR(int argc, char *argv[]);
87void doVlanSetEgressTagPVC(int argc, char *argv[]);
88
89/*igmp function*/
90void igmp_on(int argc, char *argv[]);
91void igmp_off();
92void igmp_disable(int argc, char *argv[]);
93void igmp_enable(int argc, char *argv[]);
94
95/*mirror function*/
96void set_mirror_to(int argc, char *argv[]);
97void set_mirror_from(int argc, char *argv[]);
98void doMirrorPortBased(int argc, char *argv[]);
99void doMirrorEn(int argc, char *argv[]);
100
101/*rate control*/
102void rate_control(int argc, char *argv[]);
developerd23a4c12022-11-03 11:33:07 +0800103int ingress_rate_set(int on_off, unsigned int port, unsigned int bw);
developer21ea8132022-07-11 11:52:59 +0800104int egress_rate_set(int on_off, int port, int bw);
105
106/*QoS*/
107int qos_sch_select(int argc, char *argv[]);
108void qos_set_base(int argc, char *argv[]);
109void qos_wfq_set_weight(int argc, char *argv[]);
110void qos_set_portpri(int argc, char *argv[]);
111void qos_set_dscppri(int argc, char *argv[]);
112void qos_pri_mapping_queue(int argc, char *argv[]);
113
114/*flow control*/
115int global_set_mac_fc(int argc, char *argv[]);
116int phy_set_fc(int argc, char *argv[]);
117int phy_set_an(int argc, char *argv[]);
118
119/* collision pool functions */
120int collision_pool_enable(int argc, char *argv[]);
121void collision_pool_mac_dump();
122void collision_pool_dip_dump();
123void collision_pool_sip_dump();
124
125/*pfc functions*/
126int set_mac_pfc(int argc, char *argv[]);
127void pfc_get_rx_counter(int argc, char *argv[]);
128void pfc_get_tx_counter(int argc, char *argv[]);
129
130/*switch reset*/
developerd23a4c12022-11-03 11:33:07 +0800131int switch_reset(int argc, char *argv[]);
132
133/* EEE(802.3az) function */
134void eee_enable(int argc, char *argv[]);
135void eee_dump(int argc, char *argv[]);
developer21ea8132022-07-11 11:52:59 +0800136
137void read_mib_counters();
138void clear_mib_counters();
139void read_output_queue_counters();
140void read_free_page_counters();
141
142void phy_crossover(int argc, char *argv[]);
143void exit_free();
developerd23a4c12022-11-03 11:33:07 +0800144#endif