sw_db.h (4161B)
1 /* 2 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 * 4 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 5 * $ 6 */ 7 #ifndef _BCM_DPP_SW_DB_H_ 8 #define _BCM_DPP_SW_DB_H_ 9 10 #include <bcm_int/dpp/vlan.h> 11 #include <bcm/switch.h> 12 #include <bcm/module.h> 13 14 15 #ifdef BCM_ARAD_SUPPORT 16 #include <soc/dpp/ARAD/ARAD_PP/arad_pp_general.h> 17 #endif 18 19 #define _BCM_DPP_L3_NOF_FECS(__unit) (SOC_DPP_CONFIG(__unit)->l3.fec_db_size) 20 21 typedef struct dos_attack_info_s { 22 uint8 tocpu; 23 /* flags for all dos attack traps */ 24 uint8 sipequaldip; 25 uint8 mintcphdrsize; 26 uint8 v4firstfrag; 27 uint8 tcpflags; 28 uint8 l4port; 29 uint8 tcpfrag; 30 uint8 icmp; 31 uint8 icmppktoversize; 32 uint8 macsaequalmacda; 33 uint8 icmpv6pingsize; 34 uint8 icmpfragments; 35 uint8 tcpoffset; 36 uint8 udpportsequal; 37 uint8 tcpportsequal; 38 uint8 tcpflagssf; 39 uint8 tcpflagsfup; 40 uint8 tcphdrpartial; 41 uint8 pingflood; 42 uint8 synflood; 43 uint8 tcpsmurf; 44 uint8 tcpxmas; 45 uint8 l3header; 46 } dos_attack_info_t; 47 48 typedef struct dpp_switch_sw_db_s { 49 dos_attack_info_t dos_attack; 50 } bcm_dpp_switch_sw_db_t; 51 52 typedef struct fec_to_ecmps_s { 53 int *ecmps; 54 int *corresponding_fecs; 55 int nof_ecmps; 56 } fec_to_ecmps_t; 57 58 typedef struct fec_copy_info_s { 59 int ecmp; 60 int real_fec; 61 } fec_copy_info_t; 62 63 64 typedef struct ecmp_size_s { 65 int cur_size; 66 int max_size; 67 } ecmp_size_t; 68 69 typedef struct multi_device_sync_flags_s { 70 int eep; 71 int inlif; 72 } multi_device_sync_flags_t; 73 74 75 typedef struct bcm_dpp_l3_sw_db_s { 76 fec_to_ecmps_t *fec_to_ecmp; /* for real-FEC store copy-FEC and their ECMPs */ 77 ecmp_size_t *ecmp_size; /* size of ECMP and max size */ 78 uint8 *ecmp_successive; /* [y] == 1 --> ECMP y is successsive*/ 79 uint8 *ecmp_protected; /* [y] == 1 --> ECMP y is protected */ 80 fec_copy_info_t *fec_copy_info; /* for copy-fec, store real FEC and my ECMP*/ 81 } bcm_dpp_l3_sw_db_t; 82 83 typedef struct bcm_dpp_mirror_sw_db_s { 84 int mirror_mode; 85 uint8 egress_port_profile[SOC_PPC_MAX_NOF_LOCAL_PORTS_ARAD]; 86 }bcm_dpp_mirror_sw_db_t; 87 88 extern int _bcm_dpp_init_finished_ok[BCM_MAX_NUM_UNITS]; 89 extern int _cell_id_curr[BCM_MAX_NUM_UNITS]; 90 extern bcm_dpp_l3_sw_db_t _l3_sw_db[BCM_MAX_NUM_UNITS]; 91 extern bcm_dpp_switch_sw_db_t _switch_sw_db[BCM_MAX_NUM_UNITS]; 92 extern bcm_dpp_mirror_sw_db_t _mirror_sw_db[BCM_MAX_NUM_UNITS]; 93 94 int 95 _bcm_sw_db_switch_urpf_mode_set(int unit, int urpf_mode); 96 97 int 98 _bcm_sw_db_switch_urpf_mode_get(int unit, int *urpf_mode); 99 100 int 101 _bcm_sw_db_switch_dos_attack_info_set(int unit, bcm_switch_control_t bcm_type, int enable); 102 103 int 104 _bcm_sw_db_switch_dos_attack_info_get(int unit, bcm_switch_control_t bcm_type, int *enable); 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 int 121 bcm_sw_db_l3_fec_to_ecmps_get(int unit, int fec, fec_to_ecmps_t *fec_to_ecmps); 122 123 /* given copy FEC return pointer to real FEC and used ECMP */ 124 int 125 bcm_sw_db_l3_copy_fec_to_ecmps_get(int unit, int l3a_intf, fec_copy_info_t *fec_copy_info); 126 127 int 128 bcm_sw_db_l3_add_fec_mapping_to_ecmp(int unit,uint32 flags, int intf, int ecmp, int cor_fec); 129 130 int 131 bcm_sw_db_l3_fec_remove_fec(int unit, int intf); 132 133 int 134 bcm_sw_db_l3_set_ecmp_sizes(int unit, int mpintf, int max_size, int curr_size); 135 136 int 137 bcm_sw_db_l3_get_ecmp_sizes(int unit, int mpintf, int *max_size, int *curr_size); 138 139 int 140 bcm_sw_db_l3_set_ecmp_is_successive(int unit, int mpintf, uint8 successive); 141 142 int 143 bcm_sw_db_l3_get_ecmp_is_successive(int unit, int mpintf, uint8 *successive); 144 145 int 146 bcm_sw_db_l3_set_ecmp_is_protected(int unit, int mpintf, uint8 protected); 147 148 int 149 bcm_sw_db_l3_get_ecmp_is_protected(int unit, int mpintf, uint8 *protected); 150 151 152 int 153 bcm_sw_db_l3_dump_fec_to_ecmps(int unit, int start, int end); 154 155 int 156 _bcm_sw_db_init(int unit); 157 158 int 159 _bcm_sw_db_deinit(int unit); 160 161 int 162 _bcm_sw_db_cell_id_curr_get(int unit, int *cell_id); 163 164 int 165 _bcm_sw_db_cell_id_curr_set(int unit, int *cell_id); 166 167 int 168 _bcm_sw_db_petra_mirror_mode_set(int unit, int mode); 169 170 int 171 _bcm_sw_db_petra_mirror_mode_get(int unit, int *mode); 172 173 int 174 _bcm_sw_db_outbound_mirror_port_profile_set(int unit, int port, uint8 profile); 175 176 int 177 _bcm_sw_db_outbound_mirror_port_profile_get(int unit, int port, uint8 *profile); 178 179 #endif