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