field.c (1716705B)
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-2019 Broadcom Inc. All rights reserved. 5 * 6 * File: field.c 7 * Purpose: BCM56624 Field Processor installation functions. 8 */ 9 #include <shared/bsl.h> 10 11 #include <soc/defs.h> 12 #if defined(BCM_TRX_SUPPORT) && defined(BCM_FIELD_SUPPORT) 13 14 #include <soc/drv.h> 15 #include <soc/scache.h> 16 #include <bcm/error.h> 17 #include <bcm/l3.h> 18 #include <bcm/field.h> 19 #include <bcm/mirror.h> 20 #include <bcm/tunnel.h> 21 #include <bcm_int/common/field.h> 22 #include <bcm_int/esw/field.h> 23 #include <bcm_int/esw/l3.h> 24 #include <bcm_int/esw/firebolt.h> 25 #include <bcm_int/esw/trx.h> 26 #include <bcm_int/esw/triumph.h> 27 #include <bcm_int/esw/triumph3.h> 28 #include <bcm_int/esw/triumph2.h> 29 #include <bcm_int/esw/trident.h> 30 #include <bcm_int/esw/trident2.h> 31 #include <bcm_int/esw/katana.h> 32 #include <bcm_int/esw/apache.h> 33 #include <bcm_int/esw/monterey.h> 34 #include <bcm_int/esw/scorpion.h> 35 #include <bcm_int/esw/mirror.h> 36 #include <bcm_int/esw/multicast.h> 37 #include <bcm_int/esw/virtual.h> 38 #include <bcm_int/common/multicast.h> 39 #include <bcm_int/esw_dispatch.h> 40 #include <bcm_int/esw/flex_ctr.h> 41 #include <bcm_int/esw/oam.h> 42 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 43 #include <bcm_int/esw/policer.h> 44 #endif 45 #if defined(BCM_TRIDENT2_SUPPORT) 46 #include <bcm_int/esw/nat.h> 47 #endif 48 #if defined(BCM_KATANA2_SUPPORT) 49 #include <bcm_int/esw/katana2.h> 50 #endif 51 #if defined(BCM_SABER2_SUPPORT) 52 #include <bcm_int/esw/saber2.h> 53 #endif 54 #if defined(BCM_HURRICANE3_SUPPORT) 55 #include <bcm_int/esw/hurricane3.h> 56 #include <bcm_int/esw/flowcnt.h> 57 #endif 58 #if defined(BCM_GREYHOUND2_SUPPORT) 59 #include <bcm_int/esw/greyhound2.h> 60 #endif 61 62 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 63 #include <bcm_int/common/xflow_macsec_cmn.h> 64 #endif 65 66 #if defined (BCM_TOMAHAWK3_SUPPORT) 67 #include <bcm_int/esw/tomahawk3.h> 68 #endif 69 70 typedef struct _field_flex_stat_info_s { 71 int flex_mode; 72 int hw_flags; 73 uint8 valid; 74 uint8 flex_stat_map; 75 } _field_flex_stat_info_t; 76 77 soc_tcam_partition_type_t _bcm_field_fp_tcam_partitions[] = { 78 TCAM_PARTITION_ACL_L2C, 79 TCAM_PARTITION_ACL_L2, 80 TCAM_PARTITION_ACL_IP4C, 81 TCAM_PARTITION_ACL_IP4, 82 TCAM_PARTITION_ACL_L2IP4, 83 TCAM_PARTITION_ACL_IP6C, 84 TCAM_PARTITION_ACL_IP6S, 85 TCAM_PARTITION_ACL_IP6F, 86 TCAM_PARTITION_ACL_L2IP6}; 87 88 soc_mem_t _bcm_field_ext_data_mask_mems[] = { 89 EXT_ACL144_TCAM_L2m, EXT_ACL288_TCAM_L2m, 90 EXT_ACL144_TCAM_IPV4m, EXT_ACL288_TCAM_IPV4m, 0, 91 EXT_ACL144_TCAM_IPV6m, 0, 0, 0}; 92 soc_mem_t _bcm_field_ext_data_mems[] = { 93 0, 0, 94 0, 0, EXT_ACL432_TCAM_DATA_L2_IPV4m, 95 0, EXT_ACL360_TCAM_DATA_IPV6_SHORTm, EXT_ACL432_TCAM_DATA_IPV6_LONGm, 96 EXT_ACL432_TCAM_DATA_L2_IPV6m}; 97 soc_mem_t _bcm_field_ext_mask_mems[] = { 98 0, 0, 99 0, 0, EXT_ACL432_TCAM_MASKm, 100 0, EXT_ACL360_TCAM_MASKm, EXT_ACL432_TCAM_MASKm, EXT_ACL432_TCAM_MASKm}; 101 102 soc_mem_t _bcm_field_ext_policy_mems[] = { 103 EXT_FP_POLICY_ACL144_L2m, EXT_FP_POLICY_ACL288_L2m, 104 EXT_FP_POLICY_ACL144_IPV4m, EXT_FP_POLICY_ACL288_IPV4m, 105 EXT_FP_POLICY_ACL432_L2_IPV4m, 106 EXT_FP_POLICY_ACL144_IPV6m, EXT_FP_POLICY_ACL360_IPV6_SHORTm, 107 EXT_FP_POLICY_ACL432_IPV6_LONGm, 108 EXT_FP_POLICY_ACL432_L2_IPV6m}; 109 110 soc_mem_t _bcm_field_ext_counter_mems[] = { 111 EXT_FP_CNTR_ACL144_L2m, 112 EXT_FP_CNTR_ACL288_L2m, 113 EXT_FP_CNTR_ACL144_IPV4m, 114 EXT_FP_CNTR_ACL288_IPV4m, 115 EXT_FP_CNTR_ACL432_L2_IPV4m, 116 EXT_FP_CNTR_ACL144_IPV6m, 117 EXT_FP_CNTR_ACL360_IPV6_SHORTm, 118 EXT_FP_CNTR_ACL432_IPV6_LONGm, 119 EXT_FP_CNTR_ACL432_L2_IPV6m}; 120 const soc_field_t _bcm_field_trx_slice_pairing_field[] = { 121 SLICE1_0_PAIRINGf, 122 SLICE3_2_PAIRINGf, 123 SLICE5_4_PAIRINGf, 124 SLICE7_6_PAIRINGf, 125 SLICE9_8_PAIRINGf, 126 SLICE11_10_PAIRINGf, 127 SLICE13_12_PAIRINGf, 128 SLICE15_14_PAIRINGf 129 }; 130 const soc_field_t _bcm_field_trx_slice_wide_mode_field[16] = { 131 SLICE0_DOUBLE_WIDE_MODEf, 132 SLICE1_DOUBLE_WIDE_MODEf, 133 SLICE2_DOUBLE_WIDE_MODEf, 134 SLICE3_DOUBLE_WIDE_MODEf, 135 SLICE4_DOUBLE_WIDE_MODEf, 136 SLICE5_DOUBLE_WIDE_MODEf, 137 SLICE6_DOUBLE_WIDE_MODEf, 138 SLICE7_DOUBLE_WIDE_MODEf, 139 SLICE8_DOUBLE_WIDE_MODEf, 140 SLICE9_DOUBLE_WIDE_MODEf, 141 SLICE10_DOUBLE_WIDE_MODEf, 142 SLICE11_DOUBLE_WIDE_MODEf, 143 SLICE12_DOUBLE_WIDE_MODEf, 144 SLICE13_DOUBLE_WIDE_MODEf, 145 SLICE14_DOUBLE_WIDE_MODEf, 146 SLICE15_DOUBLE_WIDE_MODEf}; 147 static soc_field_t _trx_efp_slice_mode[4][2] = { 148 {SLICE_0_MODEf, SLICE_0_IPV6_KEY_MODEf}, 149 {SLICE_1_MODEf, SLICE_1_IPV6_KEY_MODEf}, 150 {SLICE_2_MODEf, SLICE_2_IPV6_KEY_MODEf}, 151 {SLICE_3_MODEf, SLICE_3_IPV6_KEY_MODEf}}; 152 const soc_field_t _bcm_field_trx_field_sel[16][3] = { 153 {SLICE0_F1f, SLICE0_F2f, SLICE0_F3f}, 154 {SLICE1_F1f, SLICE1_F2f, SLICE1_F3f}, 155 {SLICE2_F1f, SLICE2_F2f, SLICE2_F3f}, 156 {SLICE3_F1f, SLICE3_F2f, SLICE3_F3f}, 157 {SLICE4_F1f, SLICE4_F2f, SLICE4_F3f}, 158 {SLICE5_F1f, SLICE5_F2f, SLICE5_F3f}, 159 {SLICE6_F1f, SLICE6_F2f, SLICE6_F3f}, 160 {SLICE7_F1f, SLICE7_F2f, SLICE7_F3f}, 161 {SLICE8_F1f, SLICE8_F2f, SLICE8_F3f}, 162 {SLICE9_F1f, SLICE9_F2f, SLICE9_F3f}, 163 {SLICE10_F1f, SLICE10_F2f, SLICE10_F3f}, 164 {SLICE11_F1f, SLICE11_F2f, SLICE11_F3f}, 165 {SLICE12_F1f, SLICE12_F2f, SLICE12_F3f}, 166 {SLICE13_F1f, SLICE13_F2f, SLICE13_F3f}, 167 {SLICE14_F1f, SLICE14_F2f, SLICE14_F3f}, 168 {SLICE15_F1f, SLICE15_F2f, SLICE15_F3f}}; 169 const soc_field_t _bcm_field_trx_d_type_sel[] = { 170 SLICE0_D_TYPE_SELf, SLICE1_D_TYPE_SELf, 171 SLICE2_D_TYPE_SELf, SLICE3_D_TYPE_SELf, 172 SLICE4_D_TYPE_SELf, SLICE5_D_TYPE_SELf, 173 SLICE6_D_TYPE_SELf, SLICE7_D_TYPE_SELf, 174 SLICE8_D_TYPE_SELf, SLICE9_D_TYPE_SELf, 175 SLICE10_D_TYPE_SELf, SLICE11_D_TYPE_SELf, 176 SLICE12_D_TYPE_SELf, SLICE13_D_TYPE_SELf, 177 SLICE14_D_TYPE_SELf, SLICE15_D_TYPE_SELf}; 178 const soc_field_t _bcm_field_trx_s_type_sel[] = { 179 SLICE0_S_TYPE_SELf, SLICE1_S_TYPE_SELf, 180 SLICE2_S_TYPE_SELf, SLICE3_S_TYPE_SELf, 181 SLICE4_S_TYPE_SELf, SLICE5_S_TYPE_SELf, 182 SLICE6_S_TYPE_SELf, SLICE7_S_TYPE_SELf, 183 SLICE8_S_TYPE_SELf, SLICE9_S_TYPE_SELf, 184 SLICE10_S_TYPE_SELf, SLICE11_S_TYPE_SELf, 185 SLICE12_S_TYPE_SELf, SLICE13_S_TYPE_SELf, 186 SLICE14_S_TYPE_SELf, SLICE15_S_TYPE_SELf}; 187 /* 188 * IFP - FP_DOUBLE_WIDE_SELECT fields. 189 */ 190 const soc_field_t _bcm_field_trx_dw_f1_sel[] = { 191 SLICE_0_F1f, SLICE_1_F1f, 192 SLICE_2_F1f, SLICE_3_F1f, 193 SLICE_4_F1f, SLICE_5_F1f, 194 SLICE_6_F1f, SLICE_7_F1f, 195 SLICE_8_F1f, SLICE_9_F1f, 196 SLICE_10_F1f, SLICE_11_F1f, 197 SLICE_12_F1f, SLICE_13_F1f, 198 SLICE_14_F1f, SLICE_15_F1f}; 199 const soc_field_t _bcm_field_trx_dw_f4_sel[] = { 200 SLICE_0_F4f, SLICE_1_F4f, 201 SLICE_2_F4f, SLICE_3_F4f, 202 SLICE_4_F4f, SLICE_5_F4f, 203 SLICE_6_F4f, SLICE_7_F4f, 204 SLICE_8_F4f, SLICE_9_F4f, 205 SLICE_10_F4f, SLICE_11_F4f, 206 SLICE_12_F4f, SLICE_13_F4f, 207 SLICE_14_F4f, SLICE_15_F4f}; 208 const soc_field_t _trx_ifp_double_wide_key[] = { 209 SLICE0_DOUBLE_WIDE_KEY_SELECTf, 210 SLICE1_DOUBLE_WIDE_KEY_SELECTf, 211 SLICE2_DOUBLE_WIDE_KEY_SELECTf, 212 SLICE3_DOUBLE_WIDE_KEY_SELECTf, 213 SLICE4_DOUBLE_WIDE_KEY_SELECTf, 214 SLICE5_DOUBLE_WIDE_KEY_SELECTf, 215 SLICE6_DOUBLE_WIDE_KEY_SELECTf, 216 SLICE7_DOUBLE_WIDE_KEY_SELECTf, 217 SLICE8_DOUBLE_WIDE_KEY_SELECTf, 218 SLICE9_DOUBLE_WIDE_KEY_SELECTf, 219 SLICE10_DOUBLE_WIDE_KEY_SELECTf, 220 SLICE11_DOUBLE_WIDE_KEY_SELECTf, 221 SLICE12_DOUBLE_WIDE_KEY_SELECTf, 222 SLICE13_DOUBLE_WIDE_KEY_SELECTf, 223 SLICE14_DOUBLE_WIDE_KEY_SELECTf, 224 SLICE15_DOUBLE_WIDE_KEY_SELECTf}; 225 soc_field_t _trx_src_class_id_sel[] = { 226 SLICE_0_SRC_CLASS_ID_SELf, 227 SLICE_1_SRC_CLASS_ID_SELf, 228 SLICE_2_SRC_CLASS_ID_SELf, 229 SLICE_3_SRC_CLASS_ID_SELf, 230 SLICE_4_SRC_CLASS_ID_SELf, 231 SLICE_5_SRC_CLASS_ID_SELf, 232 SLICE_6_SRC_CLASS_ID_SELf, 233 SLICE_7_SRC_CLASS_ID_SELf, 234 SLICE_8_SRC_CLASS_ID_SELf, 235 SLICE_9_SRC_CLASS_ID_SELf, 236 SLICE_10_SRC_CLASS_ID_SELf, 237 SLICE_11_SRC_CLASS_ID_SELf, 238 SLICE_12_SRC_CLASS_ID_SELf, 239 SLICE_13_SRC_CLASS_ID_SELf, 240 SLICE_14_SRC_CLASS_ID_SELf, 241 SLICE_15_SRC_CLASS_ID_SELf}; 242 soc_field_t _trx_dst_class_id_sel[] = { 243 SLICE_0_DST_CLASS_ID_SELf, 244 SLICE_1_DST_CLASS_ID_SELf, 245 SLICE_2_DST_CLASS_ID_SELf, 246 SLICE_3_DST_CLASS_ID_SELf, 247 SLICE_4_DST_CLASS_ID_SELf, 248 SLICE_5_DST_CLASS_ID_SELf, 249 SLICE_6_DST_CLASS_ID_SELf, 250 SLICE_7_DST_CLASS_ID_SELf, 251 SLICE_8_DST_CLASS_ID_SELf, 252 SLICE_9_DST_CLASS_ID_SELf, 253 SLICE_10_DST_CLASS_ID_SELf, 254 SLICE_11_DST_CLASS_ID_SELf, 255 SLICE_12_DST_CLASS_ID_SELf, 256 SLICE_13_DST_CLASS_ID_SELf, 257 SLICE_14_DST_CLASS_ID_SELf, 258 SLICE_15_DST_CLASS_ID_SELf}; 259 soc_field_t _trx_interface_class_id_sel[] = { 260 SLICE_0_INTERFACE_CLASS_ID_SELf, 261 SLICE_1_INTERFACE_CLASS_ID_SELf, 262 SLICE_2_INTERFACE_CLASS_ID_SELf, 263 SLICE_3_INTERFACE_CLASS_ID_SELf, 264 SLICE_4_INTERFACE_CLASS_ID_SELf, 265 SLICE_5_INTERFACE_CLASS_ID_SELf, 266 SLICE_6_INTERFACE_CLASS_ID_SELf, 267 SLICE_7_INTERFACE_CLASS_ID_SELf, 268 SLICE_8_INTERFACE_CLASS_ID_SELf, 269 SLICE_9_INTERFACE_CLASS_ID_SELf, 270 SLICE_10_INTERFACE_CLASS_ID_SELf, 271 SLICE_11_INTERFACE_CLASS_ID_SELf, 272 SLICE_12_INTERFACE_CLASS_ID_SELf, 273 SLICE_13_INTERFACE_CLASS_ID_SELf, 274 SLICE_14_INTERFACE_CLASS_ID_SELf, 275 SLICE_15_INTERFACE_CLASS_ID_SELf}; 276 277 const soc_field_t _bcm_field_trx_vfp_double_wide_sel[]= { 278 SLICE_0_DOUBLE_WIDE_KEY_SELECTf, 279 SLICE_1_DOUBLE_WIDE_KEY_SELECTf, 280 SLICE_2_DOUBLE_WIDE_KEY_SELECTf, 281 SLICE_3_DOUBLE_WIDE_KEY_SELECTf 282 }; 283 const soc_field_t _bcm_field_trx_vfp_field_sel[][2] = { 284 { SLICE_0_F2f, SLICE_0_F3f }, 285 { SLICE_1_F2f, SLICE_1_F3f }, 286 { SLICE_2_F2f, SLICE_2_F3f }, 287 { SLICE_3_F2f, SLICE_3_F3f } 288 }; 289 const soc_field_t _bcm_field_trx_vfp_ip_header_sel[]= { 290 SLICE_0_IP_FIELD_SELECTf, 291 SLICE_1_IP_FIELD_SELECTf, 292 SLICE_2_IP_FIELD_SELECTf, 293 SLICE_3_IP_FIELD_SELECTf 294 }; 295 const soc_field_t _trx_vfp_src_type_sel[]= { 296 SLICE_0_SOURCE_TYPE_SELf, SLICE_1_SOURCE_TYPE_SELf, 297 SLICE_2_SOURCE_TYPE_SELf, SLICE_3_SOURCE_TYPE_SELf}; 298 299 #if defined(BCM_TRIUMPH2_SUPPORT) || defined(BCM_TRIDENT_SUPPORT) 300 /* Static variables. */ 301 static soc_field_t _trx2_offset_field[2][8] = { 302 { 303 UDF1_OFFSET0f, UDF1_OFFSET1f, 304 UDF1_OFFSET2f, UDF1_OFFSET3f, 305 UDF1_OFFSET4f, UDF1_OFFSET5f, 306 UDF1_OFFSET6f, UDF1_OFFSET7f 307 }, 308 { 309 UDF2_OFFSET0f, UDF2_OFFSET1f, 310 UDF2_OFFSET2f, UDF2_OFFSET3f, 311 UDF2_OFFSET4f, UDF2_OFFSET5f, 312 UDF2_OFFSET6f, UDF2_OFFSET7f 313 } 314 }; 315 static soc_field_t _trx2_base_field[2][8] = { 316 { 317 UDF1_BASE_OFFSET_0f, UDF1_BASE_OFFSET_1f, 318 UDF1_BASE_OFFSET_2f, UDF1_BASE_OFFSET_3f, 319 UDF1_BASE_OFFSET_4f, UDF1_BASE_OFFSET_5f, 320 UDF1_BASE_OFFSET_6f, UDF1_BASE_OFFSET_7f 321 }, 322 { 323 UDF2_BASE_OFFSET_0f, UDF2_BASE_OFFSET_1f, 324 UDF2_BASE_OFFSET_2f, UDF2_BASE_OFFSET_3f, 325 UDF2_BASE_OFFSET_4f, UDF2_BASE_OFFSET_5f, 326 UDF2_BASE_OFFSET_6f, UDF2_BASE_OFFSET_7f 327 } 328 }; 329 #endif /* BCM_TRIUMPH2_SUPPORT || BCM_TRIDENT_SUPPORT */ 330 #if defined(BCM_TRIDENT2PLUS_SUPPORT) 331 const soc_field_t _bcm_td2plus_oam_overlay_field[] = { 332 SLICE0_OAM_OVERLAY_ENABLEf, 333 SLICE1_OAM_OVERLAY_ENABLEf, 334 SLICE2_OAM_OVERLAY_ENABLEf, 335 SLICE3_OAM_OVERLAY_ENABLEf, 336 SLICE4_OAM_OVERLAY_ENABLEf, 337 SLICE5_OAM_OVERLAY_ENABLEf, 338 SLICE6_OAM_OVERLAY_ENABLEf, 339 SLICE7_OAM_OVERLAY_ENABLEf, 340 SLICE8_OAM_OVERLAY_ENABLEf, 341 SLICE9_OAM_OVERLAY_ENABLEf, 342 SLICE10_OAM_OVERLAY_ENABLEf, 343 SLICE11_OAM_OVERLAY_ENABLEf, 344 }; 345 #endif /* BCM_TRIDENT2PLUS_SUPPORT */ 346 347 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 348 const soc_field_t _bcm_ifp_normalize_fldtbl[][2] = { 349 { SLICE0_NORMALIZE_IP_ADDRf, SLICE0_NORMALIZE_MAC_ADDRf }, 350 { SLICE1_NORMALIZE_IP_ADDRf, SLICE1_NORMALIZE_MAC_ADDRf }, 351 { SLICE2_NORMALIZE_IP_ADDRf, SLICE2_NORMALIZE_MAC_ADDRf }, 352 { SLICE3_NORMALIZE_IP_ADDRf, SLICE3_NORMALIZE_MAC_ADDRf }, 353 { SLICE4_NORMALIZE_IP_ADDRf, SLICE4_NORMALIZE_MAC_ADDRf }, 354 { SLICE5_NORMALIZE_IP_ADDRf, SLICE5_NORMALIZE_MAC_ADDRf }, 355 { SLICE6_NORMALIZE_IP_ADDRf, SLICE6_NORMALIZE_MAC_ADDRf }, 356 { SLICE7_NORMALIZE_IP_ADDRf, SLICE7_NORMALIZE_MAC_ADDRf }, 357 { SLICE8_NORMALIZE_IP_ADDRf, SLICE8_NORMALIZE_MAC_ADDRf }, 358 { SLICE9_NORMALIZE_IP_ADDRf, SLICE9_NORMALIZE_MAC_ADDRf }, 359 { SLICE10_NORMALIZE_IP_ADDRf, SLICE10_NORMALIZE_MAC_ADDRf }, 360 { SLICE11_NORMALIZE_IP_ADDRf, SLICE11_NORMALIZE_MAC_ADDRf }, 361 { SLICE12_NORMALIZE_IP_ADDRf, SLICE12_NORMALIZE_MAC_ADDRf }, 362 { SLICE13_NORMALIZE_IP_ADDRf, SLICE13_NORMALIZE_MAC_ADDRf }, 363 { SLICE14_NORMALIZE_IP_ADDRf, SLICE14_NORMALIZE_MAC_ADDRf }, 364 { SLICE15_NORMALIZE_IP_ADDRf, SLICE15_NORMALIZE_MAC_ADDRf } 365 }; 366 #endif 367 368 const soc_field_t _bcm_trx2_aux_tag_1_field[] = { 369 SLICE0_AUX_TAG_1_SELf, 370 SLICE1_AUX_TAG_1_SELf, 371 SLICE2_AUX_TAG_1_SELf, 372 SLICE3_AUX_TAG_1_SELf, 373 SLICE4_AUX_TAG_1_SELf, 374 SLICE5_AUX_TAG_1_SELf, 375 SLICE6_AUX_TAG_1_SELf, 376 SLICE7_AUX_TAG_1_SELf, 377 SLICE8_AUX_TAG_1_SELf, 378 SLICE9_AUX_TAG_1_SELf, 379 SLICE10_AUX_TAG_1_SELf, 380 SLICE11_AUX_TAG_1_SELf, 381 SLICE12_AUX_TAG_1_SELf, 382 SLICE13_AUX_TAG_1_SELf, 383 SLICE14_AUX_TAG_1_SELf, 384 SLICE15_AUX_TAG_1_SELf 385 }; 386 387 const soc_field_t _bcm_trx2_aux_tag_2_field[] = { 388 SLICE0_AUX_TAG_2_SELf, 389 SLICE1_AUX_TAG_2_SELf, 390 SLICE2_AUX_TAG_2_SELf, 391 SLICE3_AUX_TAG_2_SELf, 392 SLICE4_AUX_TAG_2_SELf, 393 SLICE5_AUX_TAG_2_SELf, 394 SLICE6_AUX_TAG_2_SELf, 395 SLICE7_AUX_TAG_2_SELf, 396 SLICE8_AUX_TAG_2_SELf, 397 SLICE9_AUX_TAG_2_SELf, 398 SLICE10_AUX_TAG_2_SELf, 399 SLICE11_AUX_TAG_2_SELf, 400 SLICE12_AUX_TAG_2_SELf, 401 SLICE13_AUX_TAG_2_SELf, 402 SLICE14_AUX_TAG_2_SELf, 403 SLICE15_AUX_TAG_2_SELf 404 }; 405 406 const soc_field_t _bcm_trx2_vrf_force_forwarding_enable_field[] = { 407 SLICE_0_ENABLEf, 408 SLICE_1_ENABLEf, 409 SLICE_2_ENABLEf, 410 SLICE_3_ENABLEf, 411 SLICE_4_ENABLEf, 412 SLICE_5_ENABLEf, 413 SLICE_6_ENABLEf, 414 SLICE_7_ENABLEf, 415 SLICE_8_ENABLEf, 416 SLICE_9_ENABLEf, 417 SLICE_10_ENABLEf, 418 SLICE_11_ENABLEf, 419 SLICE_12_ENABLEf, 420 SLICE_13_ENABLEf, 421 SLICE_14_ENABLEf, 422 SLICE_15_ENABLEf 423 }; 424 425 const soc_field_t _trx_tcp_slice_control_enable_field[] = { 426 SLICE_0_TCP_FN_SELf, 427 SLICE_1_TCP_FN_SELf, 428 SLICE_2_TCP_FN_SELf, 429 SLICE_3_TCP_FN_SELf, 430 SLICE_4_TCP_FN_SELf, 431 SLICE_5_TCP_FN_SELf, 432 SLICE_6_TCP_FN_SELf, 433 SLICE_7_TCP_FN_SELf, 434 SLICE_8_TCP_FN_SELf, 435 SLICE_9_TCP_FN_SELf, 436 SLICE_10_TCP_FN_SELf, 437 SLICE_11_TCP_FN_SELf, 438 SLICE_12_TCP_FN_SELf, 439 SLICE_13_TCP_FN_SELf, 440 SLICE_14_TCP_FN_SELf, 441 SLICE_15_TCP_FN_SELf 442 }; 443 444 const soc_field_t _trx_ttl_slice_control_enable_field[] = { 445 SLICE_0_TTL_FN_SELf, 446 SLICE_1_TTL_FN_SELf, 447 SLICE_2_TTL_FN_SELf, 448 SLICE_3_TTL_FN_SELf, 449 SLICE_4_TTL_FN_SELf, 450 SLICE_5_TTL_FN_SELf, 451 SLICE_6_TTL_FN_SELf, 452 SLICE_7_TTL_FN_SELf, 453 SLICE_8_TTL_FN_SELf, 454 SLICE_9_TTL_FN_SELf, 455 SLICE_10_TTL_FN_SELf, 456 SLICE_11_TTL_FN_SELf, 457 SLICE_12_TTL_FN_SELf, 458 SLICE_13_TTL_FN_SELf, 459 SLICE_14_TTL_FN_SELf, 460 SLICE_15_TTL_FN_SELf 461 }; 462 463 const soc_field_t _trx_tos_slice_control_enable_field[] = { 464 SLICE_0_TOS_FN_SELf, 465 SLICE_1_TOS_FN_SELf, 466 SLICE_2_TOS_FN_SELf, 467 SLICE_3_TOS_FN_SELf, 468 SLICE_4_TOS_FN_SELf, 469 SLICE_5_TOS_FN_SELf, 470 SLICE_6_TOS_FN_SELf, 471 SLICE_7_TOS_FN_SELf, 472 SLICE_8_TOS_FN_SELf, 473 SLICE_9_TOS_FN_SELf, 474 SLICE_10_TOS_FN_SELf, 475 SLICE_11_TOS_FN_SELf, 476 SLICE_12_TOS_FN_SELf, 477 SLICE_13_TOS_FN_SELf, 478 SLICE_14_TOS_FN_SELf, 479 SLICE_15_TOS_FN_SELf 480 }; 481 482 #ifdef BCM_KATANA_SUPPORT 483 #define _BCM_QOS_MAP_MASK 0x1fff 484 #define _BCM_QOS_MAP_OFFSET_MASK 0x3ff 485 #define _BCM_QOS_MAP_TYPE_SHIFT 10 486 #define _BCM_QOS_MAP_TYPE_ING_QUEUE_OFFSET_MAP_TABLE 5 487 #define _BCM_QOS_MAP_ING_QUEUE_OFFSET_MAX 7 488 #endif 489 490 /* UDF data format flags specific fields */ 491 soc_field_t udf_fields_f[][4] = { 492 {HIGIG_MASKf, HIGIGf, BCM_FIELD_DATA_FORMAT_F_ENCAP_STACK, 493 BCM_FIELD_DATA_FORMAT_F_NO_ENCAP_STACK}, 494 {VNTAG_PRESENT_MASKf, VNTAG_PRESENTf, BCM_FIELD_DATA_FORMAT_F_VNTAG, 495 BCM_FIELD_DATA_FORMAT_F_NO_VNTAG}, 496 {CNTAG_PRESENT_MASKf, CNTAG_PRESENTf, BCM_FIELD_DATA_FORMAT_F_CNTAG, 497 BCM_FIELD_DATA_FORMAT_F_NO_CNTAG}, 498 {ETAG_PACKET_MASKf, ETAG_PACKETf, BCM_FIELD_DATA_FORMAT_F_ETAG, 499 BCM_FIELD_DATA_FORMAT_F_NO_ETAG}, 500 {ICNM_PACKET_MASKf, ICNM_PACKETf, BCM_FIELD_DATA_FORMAT_F_ICNM, 501 BCM_FIELD_DATA_FORMAT_F_NO_ICNM}, 502 {INVALIDf, INVALIDf, 0, 503 0} 504 }; 505 506 #if defined BCM_WARM_BOOT_SUPPORT 507 extern _field_dscp_map_new_eid_list_t *dscp_map_new_eid_list[BCM_MAX_NUM_UNITS]; 508 #if defined INCLUDE_L3 509 _bcm_field_l3_callback_recover_t *_field_l3_cb = NULL; 510 #endif 511 #endif /* BCM_WARM_BOOT_SUPPORT */ 512 513 /* 514 * Function: 515 * _bcm_field_group_qual_copy_and_clear 516 * Purpose: 517 * copy qual_arr from source to destination and reset the source qual_arr 518 * Parameters: 519 * qual_arr_1 - (IN) pointer to qualifier information. 520 * qual_arr_2 - (OUT) pointer to qualifier information to be filled. 521 * 522 * Returns: 523 * BCM_E_XXX 524 */ 525 526 int 527 _bcm_field_group_qual_copy_and_clear(_bcm_field_group_qual_t *qual_arr_1, 528 _bcm_field_group_qual_t *qual_arr_2) 529 { 530 if ((NULL == qual_arr_2) || (NULL == qual_arr_1)) { 531 return BCM_E_INTERNAL; 532 } 533 534 qual_arr_2->qid_arr = qual_arr_1->qid_arr; 535 qual_arr_2->offset_arr = qual_arr_1->offset_arr; 536 qual_arr_2->size = qual_arr_1->size; 537 538 qual_arr_1->qid_arr = NULL; 539 qual_arr_1->offset_arr = NULL; 540 qual_arr_1->size = 0; 541 542 return BCM_E_NONE; 543 } 544 545 /* 546 * Function: 547 * _bcm_field_trx_egress_default_selcode_get 548 * Purpose: 549 * Finds a select encodings that will satisfy the 550 * requested qualifier set (Qset). 551 * Parameters: 552 * unit - (IN) BCM unit number. 553 * stage_fc - (IN) Stage Field control structure. 554 * qset_req - (IN) Client qualifier set. 555 * key_pri - (IN) Primary key id. 556 * key_sec - (IN) Secondary key id. 557 * fg - (IN/OUT)Select code information filled into the group. 558 * 559 * Returns: 560 * BCM_E_XXX 561 */ 562 int 563 _bcm_field_trx_egress_default_selcode_get(int unit, _field_stage_t *stage_fc, 564 bcm_field_qset_t *qset_req, 565 uint8 key_pri, uint8 key_sec, 566 _field_group_t *fg) 567 { 568 int rv; /* Operation return status. */ 569 int rv1; /* Operation return status. */ 570 int idx; 571 _bcm_field_group_qual_t temp_qual[_FP_MAX_ENTRY_WIDTH]; 572 int parts_count = 0; 573 _bcm_field_group_qual_t *qual_arr_1,*qual_arr_2; 574 575 /* Input parameters check. */ 576 if ((NULL == fg) || (NULL == qset_req) || (NULL == stage_fc)) { 577 return (BCM_E_PARAM); 578 } 579 580 qual_arr_1 = NULL; 581 qual_arr_2 = NULL; 582 583 /* Get number of entry parts. */ 584 rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id, 585 fg->flags, &parts_count); 586 BCM_IF_ERROR_RETURN(rv); 587 588 for (idx = 0; idx < parts_count; idx++ ) { 589 qual_arr_1 = &(fg->qual_arr[_FP_ENTRY_TYPE_0][idx]); 590 rv = _bcm_field_group_qual_copy_and_clear(qual_arr_1, &temp_qual[idx]); 591 BCM_IF_ERROR_RETURN(rv); 592 } 593 594 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 595 key_pri, key_sec, fg); 596 if (BCM_SUCCESS(rv)) { 597 598 for (idx = 0; idx < parts_count; idx++ ) { 599 qual_arr_1 = &(fg->qual_arr[_FP_ENTRY_TYPE_0][idx]); 600 qual_arr_2 = &(fg->qual_arr[_FP_ENTRY_TYPE_1][idx]); 601 rv1 = _bcm_field_group_qual_copy_and_clear(qual_arr_1, qual_arr_2); 602 BCM_IF_ERROR_RETURN(rv1); 603 } 604 } 605 606 for (idx = 0; idx < parts_count; idx++ ) { 607 qual_arr_1 = &(fg->qual_arr[_FP_ENTRY_TYPE_0][idx]); 608 rv1 = _bcm_field_group_qual_copy_and_clear(&temp_qual[idx], qual_arr_1); 609 BCM_IF_ERROR_RETURN(rv1); 610 } 611 612 return rv; 613 } 614 615 /* 616 * Function: 617 * _bcm_field_trx_qset_get 618 * Purpose: 619 * Common qualifiers to qset_in and given selector code are 620 * added to qset_out 621 * Parameters: 622 * unit - (IN) BCM unit number. 623 * qset_in - (IN) Input qualifier set. 624 * stage_fc - (IN) Stage Field control structure. 625 * pri_sel_val_primary - (IN) Selctor Code value for primary slice . 626 * pri_sel_val_secondary - (IN) Selctor Code value for secondary slice . 627 * qset_out - (IN/OUT) Output qualifier set. 628 * 629 * Returns: 630 * BCM_E_XXX 631 */ 632 633 int 634 _bcm_field_trx_qset_get(int unit, bcm_field_qset_t *qset_in, 635 _field_stage_t *stage_fc, 636 int pri_sel_val_primary, 637 int pri_sel_val_secondary, 638 bcm_field_qset_t *qset_out, 639 _field_group_t *fg) 640 { 641 uint16 qid; /* Field qualifier id */ 642 int idx; /* Index to qualifer conf_arr */ 643 _bcm_field_qual_info_t *f_qual = NULL; /* Field qualifier info. */ 644 _bcm_field_qual_conf_t *ptr; /* Field qualifier config info */ 645 646 if ((NULL == qset_in) || (NULL == qset_out)) { 647 return BCM_E_PARAM; 648 } 649 650 651 BCM_FIELD_QSET_INIT(*qset_out); 652 for (qid = 0; qid < _bcmFieldQualifyCount; qid++) { 653 /* Skip unused qualifiers. */ 654 if (0 == BCM_FIELD_QSET_TEST(*qset_in, qid)) { 655 continue; 656 } 657 658 f_qual = stage_fc->f_qual_arr[qid]; 659 for (idx =0; idx < f_qual->conf_sz; idx++) { 660 ptr = &(f_qual->conf_arr[idx]); 661 if ((_bcmFieldSliceSelFpf3 == ptr->selector.pri_sel) && 662 ((pri_sel_val_primary == ptr->selector.pri_sel_val) || 663 (pri_sel_val_secondary == ptr->selector.pri_sel_val))) { 664 #if defined(BCM_APACHE_SUPPORT) 665 /* Skip when OamOverlay doesn't match */ 666 if (SOC_IS_APACHE(unit) && 667 (ptr->selector.sec_sel == _bcmFieldSliceSelEgrOamOverlayKey4) && 668 (((fg->sel_codes[0].egr_oam_overlay_sel != _FP_SELCODE_DONT_CARE) && 669 (fg->sel_codes[0].egr_oam_overlay_sel != ptr->selector.sec_sel_val)) || 670 ((fg->sel_codes[1].egr_oam_overlay_sel != _FP_SELCODE_DONT_CARE) && 671 (fg->sel_codes[1].egr_oam_overlay_sel != ptr->selector.sec_sel_val)))) { 672 continue; 673 } 674 #endif 675 BCM_FIELD_QSET_ADD(*qset_out,qid); 676 677 } else { 678 continue; 679 } 680 } 681 } 682 683 if (BCM_FIELD_QSET_TEST(*qset_in, bcmFieldQualifyStageIngress)) { 684 BCM_FIELD_QSET_ADD(*qset_out, bcmFieldQualifyStageIngress); 685 } else if(BCM_FIELD_QSET_TEST(*qset_in, bcmFieldQualifyStageEgress)) { 686 BCM_FIELD_QSET_ADD(*qset_out, bcmFieldQualifyStageEgress); 687 } else if(BCM_FIELD_QSET_TEST(*qset_in, bcmFieldQualifyStageLookup)) { 688 BCM_FIELD_QSET_ADD(*qset_out, bcmFieldQualifyStageLookup); 689 } else if(BCM_FIELD_QSET_TEST(*qset_in, bcmFieldQualifyStageExternal)) { 690 BCM_FIELD_QSET_ADD(*qset_out, bcmFieldQualifyStageExternal); 691 } 692 693 return BCM_E_NONE; 694 } 695 /* 696 * Function: 697 * _bcm_field_trx_egress_selcode_get 698 * Purpose: 699 * Finds a select encodings that will satisfy the 700 * requested qualifier set (Qset). 701 * Parameters: 702 * unit - (IN) BCM unit number. 703 * stage_fc - (IN) Stage Field control structure. 704 * qset_req - (IN) Client qualifier set. 705 * fg - (IN/OUT)Select code information filled into the group. 706 * 707 * Returns: 708 * BCM_E_XXX 709 */ 710 int 711 _bcm_field_trx_egress_selcode_get(int unit, _field_stage_t *stage_fc, 712 bcm_field_qset_t *qset_req, 713 _field_group_t *fg) 714 { 715 int rv; /* Operation return status. */ 716 bcm_field_qset_t new_qset; 717 718 /* Input parameters check. */ 719 if ((NULL == fg) || (NULL == qset_req) || (NULL == stage_fc)) { 720 return (BCM_E_PARAM); 721 } 722 723 if (fg->flags & _FP_GROUP_SPAN_SINGLE_SLICE) { 724 /* Attempt _BCM_FIELD_EFP_KEY4 (L2 key). */ 725 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 726 _BCM_FIELD_EFP_KEY4, 0, fg); 727 if (BCM_SUCCESS(rv)) { 728 729 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 730 _BCM_FIELD_EFP_KEY4, -1, &new_qset, fg); 731 BCM_IF_ERROR_RETURN(rv); 732 733 /* In EFP, for a given qset we can have two selector code 734 combination. So attempt _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 735 736 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 737 &new_qset, 738 _BCM_FIELD_EFP_KEY4, 739 0, fg); 740 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 741 (rv != BCM_E_RESOURCE))) { 742 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY4; 743 return rv; 744 } 745 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 746 return rv; 747 } 748 749 /* Attempt _BCM_FIELD_EFP_KEY1_NO_V4 (L3 any key). */ 750 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 751 _BCM_FIELD_EFP_KEY1_NO_V4, 0, fg); 752 if (BCM_SUCCESS(rv)) { 753 754 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 755 _BCM_FIELD_EFP_KEY4, -1, &new_qset, fg); 756 BCM_IF_ERROR_RETURN(rv); 757 758 /* In EFP, for a given qset we can have two selector code 759 combination. So attempt _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 760 761 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 762 &new_qset, 763 _BCM_FIELD_EFP_KEY4, 764 0, fg); 765 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 766 (rv != BCM_E_RESOURCE))) { 767 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY1_NO_V4; 768 return rv; 769 } 770 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 771 return rv; 772 } 773 774 775 /* Attempt _BCM_FIELD_EFP_KEY1 (IPv4 key). */ 776 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 777 _BCM_FIELD_EFP_KEY1, 0, fg); 778 779 if (BCM_SUCCESS(rv)) { 780 781 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 782 _BCM_FIELD_EFP_KEY4, -1, &new_qset, fg); 783 BCM_IF_ERROR_RETURN(rv); 784 785 786 /* In EFP, for a given qset we can have two selector code 787 combination. So attempt _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 788 789 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 790 &new_qset, 791 _BCM_FIELD_EFP_KEY4, 792 0, fg); 793 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 794 (rv != BCM_E_RESOURCE))) { 795 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY1; 796 return rv; 797 } 798 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 799 return rv; 800 } 801 802 /* Attempt _BCM_FIELD_EFP_KEY2 (IPv6 key). */ 803 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 804 _BCM_FIELD_EFP_KEY2, 0, fg); 805 if (BCM_SUCCESS(rv)) { 806 807 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 808 _BCM_FIELD_EFP_KEY4, -1, &new_qset, fg); 809 BCM_IF_ERROR_RETURN(rv); 810 811 812 /* In EFP, for a given qset we can have two selector code 813 combination. So attempt _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 814 815 816 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 817 &new_qset, 818 _BCM_FIELD_EFP_KEY4, 819 0, fg); 820 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 821 (rv != BCM_E_RESOURCE))) { 822 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY2; 823 return rv; 824 } 825 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 826 return rv; 827 } 828 829 #if defined(BCM_APACHE_SUPPORT) || defined(BCM_TSN_SR_SUPPORT) 830 if (SOC_IS_APACHE(unit) || soc_feature(unit, soc_feature_tsn_sr)) { 831 /* Attempt _BCM_FIELD_EFP_KEY5 (apache:FCOE key tsn_sr:SR key). */ 832 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 833 _BCM_FIELD_EFP_KEY5, 0, fg); 834 if (BCM_SUCCESS(rv)) { 835 836 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 837 _BCM_FIELD_EFP_KEY4, -1, &new_qset, fg); 838 BCM_IF_ERROR_RETURN(rv); 839 840 841 /* In EFP, for a given qset we can have two selector code 842 combination. So attempt _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 843 844 845 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 846 &new_qset, 847 _BCM_FIELD_EFP_KEY4, 848 0, fg); 849 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 850 (rv != BCM_E_RESOURCE))) { 851 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY5; 852 return rv; 853 } 854 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 855 return rv; 856 } 857 } 858 #endif /* BCM_APACHE_SUPPORT || BCM_TSN_SR_SUPPORT */ 859 #if defined(BCM_APACHE_SUPPORT) 860 if (SOC_IS_APACHE(unit)) { 861 /* Attempt _BCM_FIELD_EFP_KEY6 (OAM SAT key). */ 862 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 863 _BCM_FIELD_EFP_KEY6, 0, fg); 864 if (BCM_SUCCESS(rv)) { 865 866 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 867 _BCM_FIELD_EFP_KEY4, -1, &new_qset, fg); 868 BCM_IF_ERROR_RETURN(rv); 869 870 871 /* In EFP, for a given qset we can have two selector code 872 combination. So attempt _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 873 874 875 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 876 &new_qset, 877 _BCM_FIELD_EFP_KEY4, 878 0, fg); 879 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 880 (rv != BCM_E_RESOURCE))) { 881 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY6; 882 return rv; 883 } 884 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 885 return rv; 886 } 887 } 888 #endif 889 890 } else { 891 /* L2 + L3 double wide predefined key. */ 892 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 893 _BCM_FIELD_EFP_KEY1_NO_V4, 894 _BCM_FIELD_EFP_KEY4, fg); 895 if (BCM_SUCCESS(rv)) { 896 897 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 898 _BCM_FIELD_EFP_KEY1, 899 _BCM_FIELD_EFP_KEY4, 900 &new_qset, fg); 901 BCM_IF_ERROR_RETURN(rv); 902 903 904 /* In EFP, for a given qset we can have two selector code 905 combination. So attempt _BCM_FIELD_EFP_KEY1 and 906 _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 907 908 909 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 910 &new_qset, 911 _BCM_FIELD_EFP_KEY1, 912 _BCM_FIELD_EFP_KEY4, 913 fg); 914 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 915 (rv != BCM_E_RESOURCE))) { 916 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY1_NO_V4; 917 fg->sel_codes[1].fpf3= _BCM_FIELD_EFP_KEY4; 918 return rv; 919 } 920 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 921 return rv; 922 } 923 924 /* L2 + L3 v4 double wide predefined key. */ 925 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 926 _BCM_FIELD_EFP_KEY1, 927 _BCM_FIELD_EFP_KEY4, fg); 928 if (BCM_SUCCESS(rv)) { 929 930 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 931 _BCM_FIELD_EFP_KEY1, 932 _BCM_FIELD_EFP_KEY4, 933 &new_qset, fg); 934 BCM_IF_ERROR_RETURN(rv); 935 936 937 /* In EFP, for a given qset we can have two selector code 938 combination. So attempt _BCM_FIELD_EFP_KEY1 and 939 _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 940 941 942 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 943 &new_qset, 944 _BCM_FIELD_EFP_KEY1, 945 _BCM_FIELD_EFP_KEY4, 946 fg); 947 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 948 (rv != BCM_E_RESOURCE))) { 949 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY1; 950 fg->sel_codes[1].fpf3= _BCM_FIELD_EFP_KEY4; 951 return rv; 952 } 953 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 954 return rv; 955 } 956 957 if (SOC_IS_TD2_TT2(unit) || 958 SOC_IS_KATANA2(unit) || SOC_IS_TRIUMPH3(unit) || 959 SOC_IS_GREYHOUND2(unit)) { 960 /* L2 + L3 v6 double wide predefined key. */ 961 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 962 _BCM_FIELD_EFP_KEY2, 963 _BCM_FIELD_EFP_KEY4, fg); 964 965 if (BCM_SUCCESS(rv)) { 966 967 968 /* In EFP, for a given qset we can have two selector code 969 combination. So attempt _BCM_FIELD_EFP_KEY1 and 970 _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 971 972 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 973 _BCM_FIELD_EFP_KEY1, 974 _BCM_FIELD_EFP_KEY4, 975 &new_qset, fg); 976 BCM_IF_ERROR_RETURN(rv); 977 978 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 979 &new_qset, 980 _BCM_FIELD_EFP_KEY1, 981 _BCM_FIELD_EFP_KEY4, 982 fg); 983 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 984 (rv != BCM_E_RESOURCE))) { 985 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY2; 986 fg->sel_codes[1].fpf3= _BCM_FIELD_EFP_KEY4; 987 return rv; 988 } 989 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 990 return rv; 991 } 992 } 993 994 /* IPv6 double wide predefined key. */ 995 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 996 _BCM_FIELD_EFP_KEY3, 997 _BCM_FIELD_EFP_KEY2, fg); 998 if (BCM_SUCCESS(rv)) { 999 1000 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 1001 _BCM_FIELD_EFP_KEY1, 1002 _BCM_FIELD_EFP_KEY4, 1003 &new_qset, fg); 1004 BCM_IF_ERROR_RETURN(rv); 1005 1006 1007 /* In EFP, for a given qset we can have two selector code 1008 combination. So attempt _BCM_FIELD_EFP_KEY1 and 1009 _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 1010 1011 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 1012 &new_qset, 1013 _BCM_FIELD_EFP_KEY1, 1014 _BCM_FIELD_EFP_KEY4, 1015 fg); 1016 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 1017 (rv != BCM_E_RESOURCE))) { 1018 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY3; 1019 fg->sel_codes[1].fpf3= _BCM_FIELD_EFP_KEY2; 1020 return rv; 1021 } 1022 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 1023 return rv; 1024 } 1025 1026 #if defined(BCM_APACHE_SUPPORT) 1027 if (SOC_IS_APACHE(unit)) { 1028 /* FCOE double wide predefined key. */ 1029 rv = _bcm_field_egress_key_attempt(unit, stage_fc, qset_req, 1030 _BCM_FIELD_EFP_KEY5, 1031 _BCM_FIELD_EFP_KEY4, fg); 1032 if (BCM_SUCCESS(rv)) { 1033 1034 rv = _bcm_field_trx_qset_get(unit, qset_req, stage_fc, 1035 _BCM_FIELD_EFP_KEY1, 1036 _BCM_FIELD_EFP_KEY4, 1037 &new_qset, fg); 1038 BCM_IF_ERROR_RETURN(rv); 1039 1040 1041 /* In EFP, for a given qset we can have two selector code 1042 combination. So attempt _BCM_FIELD_EFP_KEY1 and 1043 _BCM_FIELD_EFP_KEY4 (Any Packet type) */ 1044 1045 rv = _bcm_field_trx_egress_default_selcode_get(unit, stage_fc, 1046 &new_qset, 1047 _BCM_FIELD_EFP_KEY1, 1048 _BCM_FIELD_EFP_KEY4, 1049 fg); 1050 if (BCM_SUCCESS(rv) || (BCM_FAILURE(rv) && 1051 (rv != BCM_E_RESOURCE))) { 1052 fg->sel_codes[0].fpf3= _BCM_FIELD_EFP_KEY5; 1053 fg->sel_codes[1].fpf3= _BCM_FIELD_EFP_KEY4; 1054 return rv; 1055 } 1056 } else if(BCM_FAILURE(rv) && (rv != BCM_E_RESOURCE)) { 1057 return rv; 1058 } 1059 } 1060 #endif 1061 } 1062 1063 return (BCM_E_RESOURCE); 1064 } 1065 /* 1066 * Function: 1067 * _bcm_field_trx_egress_mode_get 1068 * 1069 * Purpose: 1070 * Helper function to get the mode of a slice in a 1071 * register value that is to be used for FP_SLICE_CONFIGr. 1072 * 1073 * Parameters: 1074 * unit - (IN) BCM device number. 1075 * fg - (IN) Installed group structure. 1076 * slice_mode - (IN/OUT) Slice mode for the group. 1077 * 1078 * Returns: 1079 * BCM_E_XXX 1080 */ 1081 1082 int 1083 _bcm_field_trx_egress_mode_get(int unit, 1084 _field_group_t *fg, 1085 uint8 *slice_mode) 1086 { 1087 uint32 reg_value; 1088 uint32 slice_num; 1089 soc_field_t _trx_efp_slice_mode[4] = {SLICE_0_MODEf, SLICE_1_MODEf, 1090 SLICE_2_MODEf, SLICE_3_MODEf}; 1091 1092 /* Input parameters check. */ 1093 if ((NULL == fg) || (NULL == slice_mode)) { 1094 return (BCM_E_PARAM); 1095 } 1096 1097 if (_BCM_FIELD_STAGE_EGRESS != fg->stage_id) { 1098 return BCM_E_PARAM; 1099 } 1100 1101 slice_num = fg->slices->slice_number; 1102 1103 if (slice_num >= COUNTOF(_trx_efp_slice_mode)) { 1104 return (BCM_E_PARAM); 1105 } 1106 1107 SOC_IF_ERROR_RETURN(READ_EFP_SLICE_CONTROLr(unit, ®_value)); 1108 *slice_mode = soc_reg_field_get(unit, 1109 EFP_SLICE_CONTROLr, 1110 reg_value, 1111 _trx_efp_slice_mode[slice_num]); 1112 return BCM_E_NONE; 1113 } 1114 /* 1115 * Function: 1116 * _bcm_field_trx_egress_mode_set 1117 * 1118 * Purpose: 1119 * Helper function to _bcm_field_fb_mode_install that sets the mode of a 1120 * slice in a register value that is to be used for FP_SLICE_CONFIGr. 1121 * 1122 * Parameters: 1123 * unit - (IN) BCM device number. 1124 * slice_numb - (IN) Slice number to set mode for. 1125 * fg - (IN) Installed group structure. 1126 * flags - (IN) New group/slice mode. 1127 * 1128 * Returns: 1129 * BCM_E_XXX 1130 */ 1131 1132 int 1133 _bcm_field_trx_egress_mode_set(int unit, uint8 slice_numb, 1134 _field_group_t *fg, uint8 flags) 1135 { 1136 uint32 mode_val[2]; 1137 /* Input parameters check. */ 1138 if ((NULL == fg) || (slice_numb >= COUNTOF(_trx_efp_slice_mode))) { 1139 return (BCM_E_PARAM); 1140 } 1141 1142 mode_val[1] = _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP6; 1143 1144 if (flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 1145 /* IP + L2 Double wide key. */ 1146 if ((_BCM_FIELD_EFP_KEY1_NO_V4 == fg->sel_codes[0].fpf3) && \ 1147 (_BCM_FIELD_EFP_KEY4 == fg->sel_codes[1].fpf3)) { 1148 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY; 1149 } 1150 1151 /* DstIP6 + SrcIp6 or IPv4 + L2 Double wide key. */ 1152 if (((_BCM_FIELD_EFP_KEY3 == fg->sel_codes[0].fpf3) && \ 1153 (_BCM_FIELD_EFP_KEY2 == fg->sel_codes[1].fpf3)) || 1154 BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyIp4)) { 1155 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE; 1156 if ((_BCM_FIELD_EFP_KEY3 == fg->sel_codes[0].fpf3) && \ 1157 (_BCM_FIELD_EFP_KEY2 == fg->sel_codes[1].fpf3) && 1158 (_FP_SELCODE_DONT_CARE != fg->sel_codes[1].ip6_addr_sel)) { 1159 mode_val[1] =fg->sel_codes[1].ip6_addr_sel; 1160 } 1161 } 1162 1163 /* IPv6 + L2 Double wide key. */ 1164 else if ((_BCM_FIELD_EFP_KEY2 == fg->sel_codes[0].fpf3) && \ 1165 (_BCM_FIELD_EFP_KEY4 == fg->sel_codes[1].fpf3)) { 1166 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6; 1167 if (_FP_SELCODE_DONT_CARE != fg->sel_codes[0].ip6_addr_sel) { 1168 mode_val[1] =fg->sel_codes[0].ip6_addr_sel; 1169 } 1170 } 1171 #if defined(BCM_APACHE_SUPPORT) 1172 /* FCOE Double wide key. */ 1173 else if ((_BCM_FIELD_EFP_KEY5 == fg->sel_codes[0].fpf3) && \ 1174 (_BCM_FIELD_EFP_KEY4 == fg->sel_codes[1].fpf3)) { 1175 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_FCOE; 1176 } 1177 #endif 1178 else { 1179 /* IPv4/Don't care + L2 Double wide key. */ 1180 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY; 1181 } 1182 1183 BCM_IF_ERROR_RETURN 1184 (soc_reg_fields32_modify(unit, EFP_SLICE_CONTROLr, REG_PORT_ANY, 2, 1185 _trx_efp_slice_mode[slice_numb], mode_val)); 1186 } else { 1187 if (_BCM_FIELD_EFP_KEY4 == fg->sel_codes[0].fpf3) { 1188 /* L2 - Slice mode. */ 1189 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L2; 1190 1191 } else if (_BCM_FIELD_EFP_KEY1_NO_V4 == fg->sel_codes[0].fpf3) { 1192 /* L3 - Any single wide key. */ 1193 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3_ANY; 1194 1195 } else if ((_BCM_FIELD_EFP_KEY1 == fg->sel_codes[0].fpf3) && 1196 BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyIp4)) { 1197 /* L3 - IPv4 single wide key. */ 1198 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3; 1199 1200 } else if ((_BCM_FIELD_EFP_KEY2 == fg->sel_codes[0].fpf3)) { 1201 /* L3 - IPv6 single wide key. */ 1202 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3; 1203 if (_FP_SELCODE_DONT_CARE != fg->sel_codes[0].ip6_addr_sel) { 1204 mode_val[1] =fg->sel_codes[0].ip6_addr_sel; 1205 } 1206 } 1207 #if defined(BCM_APACHE_SUPPORT) ||\ 1208 defined(BCM_TSN_SUPPORT) || defined(BCM_TSN_SR_SUPPORT) 1209 else if ((_BCM_FIELD_EFP_KEY5 == fg->sel_codes[0].fpf3)) { 1210 #if defined(BCM_TSN_SUPPORT) || defined(BCM_TSN_SR_SUPPORT) 1211 if (soc_feature(unit, soc_feature_tsn) || 1212 soc_feature(unit, soc_feature_tsn_sr)) { 1213 /* SR single wide key. */ 1214 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_SR; 1215 } else 1216 #endif /* BCM_TSN_SUPPORT || BCM_TSN_SR_SUPPORT */ 1217 { 1218 /* FCOE single wide key. */ 1219 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3; 1220 } 1221 } 1222 #endif /* BCM_APACHE_SUPPORT || BCM_TSN_SUPPORT || BCM_TSN_SR_SUPPORT */ 1223 #if defined(BCM_APACHE_SUPPORT) 1224 else if (_BCM_FIELD_EFP_KEY6 == fg->sel_codes[0].fpf3) { 1225 /* OAM SAT - Slice mode. */ 1226 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L2; 1227 } 1228 #endif 1229 else { 1230 /* L3 common key. */ 1231 mode_val[0] = _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3_ANY; 1232 } 1233 1234 BCM_IF_ERROR_RETURN 1235 (soc_reg_fields32_modify(unit, EFP_SLICE_CONTROLr, REG_PORT_ANY, 2, 1236 _trx_efp_slice_mode[slice_numb], mode_val)); 1237 1238 } 1239 return (BCM_E_NONE); 1240 } 1241 1242 /* 1243 * Function: 1244 * _field_fb_egress_slice_clear 1245 * 1246 * Purpose: 1247 * Reset slice configuraton on group deletion event. 1248 * 1249 * Parameters: 1250 * unit - (IN) BCM device number. 1251 * slice_numb - (IN) Slice number to set mode for. 1252 * 1253 * Returns: 1254 * BCM_E_XXX 1255 */ 1256 int 1257 _bcm_field_trx_egress_slice_clear(int unit, uint8 slice_numb) 1258 { 1259 uint32 mode_val[2] = {0, 0}; 1260 int rv; 1261 1262 /* Input parameters check. */ 1263 if (slice_numb >= COUNTOF(_trx_efp_slice_mode)) { 1264 return (BCM_E_PARAM); 1265 } 1266 1267 rv = soc_reg_fields32_modify(unit, EFP_SLICE_CONTROLr, REG_PORT_ANY, 1268 2, _trx_efp_slice_mode[slice_numb], mode_val); 1269 1270 return (rv); 1271 } 1272 1273 /* 1274 * Function: 1275 * _field_trx_mode_set 1276 * 1277 * Purpose: 1278 * Auxiliary routine used to set group pairing mode. 1279 * Parameters: 1280 * unit - (IN) BCM device number. 1281 * slice_numb - (IN) Slice number to set mode for. 1282 * fg - (IN) Installed group structure. 1283 * flags - (IN) New group/slice mode. 1284 * 1285 * Returns: 1286 * BCM_E_XXX 1287 */ 1288 int 1289 _bcm_field_trx_mode_set(int unit, uint8 slice_numb, _field_group_t *fg, uint8 flags) 1290 { 1291 int rv; /* Operation return status. */ 1292 1293 /* Input parameter check. */ 1294 if (NULL == fg) { 1295 return (BCM_E_PARAM); 1296 } 1297 1298 switch (fg->stage_id) { 1299 case _BCM_FIELD_STAGE_INGRESS: 1300 rv = BCM_E_NONE; /* Mode and select codes programmed together. */ 1301 break; 1302 case _BCM_FIELD_STAGE_LOOKUP: 1303 rv = _bcm_field_fb_lookup_mode_set(unit, slice_numb, fg, flags); 1304 break; 1305 case _BCM_FIELD_STAGE_EGRESS: 1306 rv = _bcm_field_trx_egress_mode_set(unit, slice_numb, fg, flags); 1307 break; 1308 #if defined (BCM_TRIUMPH_SUPPORT) 1309 case _BCM_FIELD_STAGE_EXTERNAL: 1310 rv = _bcm_field_tr_external_mode_set(unit, slice_numb, fg, flags); 1311 break; 1312 #endif /* BCM_TRIUMPH_SUPPORT */ 1313 default: 1314 rv = BCM_E_PARAM; 1315 } 1316 return (rv); 1317 } 1318 1319 /* 1320 * Function: 1321 * _bcm_trx_range_checker_selcodes_update 1322 * 1323 * Purpose: 1324 * Update group select codes based on range checker id 1325 * used in field group entry. 1326 * Parameters: 1327 * unit - (IN) BCM device number. 1328 * entry - (IN) Field entry id. 1329 * Returns: 1330 * BCM_E_XXX 1331 */ 1332 int 1333 _bcm_trx_range_checker_selcodes_update(int unit, bcm_field_entry_t entry) 1334 1335 { 1336 uint8 slice_number; /* Slices iterator. */ 1337 uint8 entry_part; /* Wide entry part number. */ 1338 uint32 buf[SOC_MAX_MEM_FIELD_WORDS];/* HW entry buffer. */ 1339 _field_sel_t *sel; /* Group field selectors. */ 1340 _field_group_t *fg; /* Field group structure. */ 1341 _field_slice_t *fs; /* Field slice structure. */ 1342 int rv; /* Operation return status. */ 1343 _field_entry_t *f_ent; /* Field entry structure. */ 1344 1345 1346 /* Get field entry part that contains qualifier. */ 1347 rv = _bcm_field_entry_qual_get(unit, entry, 1348 _bcmFieldQualifyRangeCheckBits24_31, &f_ent); 1349 BCM_IF_ERROR_RETURN(rv); 1350 1351 fg = f_ent->group; 1352 1353 /* Get tcam part. */ 1354 rv = _bcm_field_entry_flags_to_tcam_part (unit, f_ent->flags, fg, 1355 &entry_part); 1356 BCM_IF_ERROR_RETURN(rv); 1357 1358 /* Per slice selectors installed in primary portion only. */ 1359 if ((entry_part > 0) && fg->sel_codes[entry_part].intraslice) { 1360 entry_part--; 1361 } 1362 1363 /* Get slice number for the entry part. */ 1364 rv = _bcm_field_tcam_part_to_slice_number(unit, entry_part, fg, 1365 &slice_number); 1366 BCM_IF_ERROR_RETURN(rv); 1367 1368 /* Update selector value in all group slices. */ 1369 fs = fg->slices + slice_number; 1370 1371 sel = fg->sel_codes + entry_part; 1372 if (3 == sel->intf_class_sel) { 1373 return (BCM_E_NONE); 1374 } else { 1375 sel->intf_class_sel = 3; /* Range checker selector. */ 1376 } 1377 1378 /* Update FP_SLICE_KEY_CONTROL memory entry. */ 1379 sal_memset(buf, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 1380 rv = soc_mem_read(unit, FP_SLICE_KEY_CONTROLm, MEM_BLOCK_ANY, 0, buf); 1381 BCM_IF_ERROR_RETURN(rv); 1382 1383 while (fs != NULL) { 1384 /* Set interface class select field. */ 1385 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1386 _trx_interface_class_id_sel[fs->slice_number], 1387 sel->intf_class_sel); 1388 1389 fs->intf_class_sel = sel->intf_class_sel; 1390 fs = fs->next; 1391 } 1392 rv = soc_mem_write(unit, FP_SLICE_KEY_CONTROLm, MEM_BLOCK_ALL, 0, buf); 1393 return (rv); 1394 } 1395 1396 1397 /* 1398 * Function: 1399 * _bcm_field_trx_ingress_pfs_bmap_get 1400 * 1401 * Purpose: 1402 * Fill in set of (PFS) indexes applicable for the specific group. 1403 * 1404 * Parameters: 1405 * unit - (IN) BCM device number. 1406 * fg - (IN) Field group. 1407 * pbmp - (IN) Group active port bit map. 1408 * selcode_index - (IN) Index into select codes array. 1409 * Returns: 1410 * BCM_E_XXX 1411 */ 1412 int 1413 _bcm_field_trx_ingress_pfs_bmap_get(int unit, _field_group_t *fg, 1414 bcm_pbmp_t *pbmp, int selcode_index, 1415 SHR_BITDCL *pfs_bmp) 1416 { 1417 bcm_port_t idx; /* Device pfs indexes iterator.*/ 1418 _field_sel_t *sel; /* Group field selectors. */ 1419 bcm_pbmp_t all_pbmp; 1420 #if defined(BCM_TRX_SUPPORT) || defined(BCM_SCORPION_SUPPORT) 1421 soc_info_t *si; 1422 #endif 1423 int pfs_idx_count = -1; /* PFS count of indices */ 1424 int id = -1; /* Id for Loop */ 1425 1426 /* Input parameters check. */ 1427 if ((NULL == fg) || (NULL == pbmp) || (NULL == pfs_bmp)) { 1428 return (BCM_E_PARAM); 1429 } 1430 1431 /* Get group select codes. */ 1432 sel = &fg->sel_codes[selcode_index]; 1433 1434 /* Read device port bitmaps. */ 1435 BCM_PBMP_CLEAR(all_pbmp); 1436 BCM_IF_ERROR_RETURN(_bcm_field_valid_pbmp_get(unit, &all_pbmp)); 1437 1438 if (fg->flags & _FP_GROUP_WLAN) { 1439 SHR_BITSET(pfs_bmp, soc_mem_index_max(unit, FP_PORT_FIELD_SELm)); 1440 } else if ((fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) && 1441 ((selcode_index == 1) || (selcode_index == 3)) && 1442 (sel->fpf2 != _FP_SELCODE_DONT_CARE)) { 1443 sal_memcpy(pfs_bmp, &all_pbmp, sizeof(bcm_pbmp_t)); 1444 } else { 1445 sal_memcpy(pfs_bmp, pbmp, sizeof(bcm_pbmp_t)); 1446 } 1447 1448 /* Global All Port Groups */ 1449 if (BCM_PBMP_EQ(all_pbmp,*pbmp)) { 1450 pfs_idx_count = soc_mem_index_count(unit, FP_PORT_FIELD_SELm); 1451 for (id = 0; id < pfs_idx_count;id++) { 1452 SHR_BITSET(pfs_bmp,id); 1453 } 1454 return BCM_E_NONE; 1455 } else { 1456 /* Update Group Flags to denote Port based Group */ 1457 fg->flags |= _FP_GROUP_PER_PORT_OR_PBMP; 1458 } 1459 1460 #if defined(BCM_ENDURO_SUPPORT) 1461 if (SOC_IS_ENDURO(unit) || SOC_IS_HURRICANE(unit) || 1462 SOC_IS_HURRICANE2(unit)) { 1463 /* Have to set up CPU port for Enduro & Hurricane. */ 1464 SHR_BITSET(pfs_bmp, 34); 1465 } 1466 #endif /* BCM_ENDURO_SUPPORT */ 1467 1468 /* Following devices have static FP selector mapping when XE port 1469 * operating on HG mode. 1470 * Rest devices have FPF_sel_index in port table. 1471 */ 1472 #if defined(BCM_TRX_SUPPORT) || defined(BCM_SCORPION_SUPPORT) 1473 si = &SOC_INFO(unit); 1474 if (SOC_IS_ENDURO(unit) || SOC_IS_HURRICANEX(unit) || 1475 SOC_IS_TRIUMPH(unit) || SOC_IS_VALKYRIE(unit) || 1476 SOC_IS_SC_CQ(unit) || SOC_IS_GREYHOUND(unit) || 1477 SOC_IS_GREYHOUND2(unit)) { 1478 for (idx = 0; idx < BCM_PBMP_PORT_MAX; idx++) { 1479 if (SOC_PORT_VALID(unit, idx) && SHR_BITGET(pfs_bmp, idx)) { 1480 if ((si->fp_hg_port_offset != -1) && 1481 (idx >= si->hg_offset)) { 1482 SHR_BITSET(pfs_bmp, idx + si->fp_hg_port_offset); 1483 continue; 1484 } 1485 #if defined(BCM_SCORPION_SUPPORT) 1486 if (SOC_IS_SC_CQ(unit)) { 1487 SHR_BITSET(pfs_bmp, idx + 29); 1488 continue; 1489 } 1490 #endif /* BCM_SCORPION_SUPPORT */ 1491 if (SOC_IS_TRIUMPH(unit) || SOC_IS_VALKYRIE(unit)) { 1492 switch (idx) { 1493 case 2: 1494 SHR_BITSET(pfs_bmp, 54); 1495 break; 1496 case 14: 1497 SHR_BITSET(pfs_bmp, 55); 1498 break; 1499 case 26: 1500 SHR_BITSET(pfs_bmp, 56); 1501 break; 1502 case 27: 1503 SHR_BITSET(pfs_bmp, 57); 1504 break; 1505 case 28: 1506 SHR_BITSET(pfs_bmp, 58); 1507 break; 1508 case 29: 1509 SHR_BITSET(pfs_bmp, 59); 1510 break; 1511 case 30: 1512 SHR_BITSET(pfs_bmp, 60); 1513 break; 1514 case 31: 1515 SHR_BITSET(pfs_bmp, 61); 1516 break; 1517 case 0: 1518 SHR_BITSET(pfs_bmp, 62); 1519 break; 1520 default: 1521 ; 1522 } 1523 } 1524 } 1525 } 1526 } 1527 #endif 1528 #if defined(BCM_TRIUMPH_SUPPORT) 1529 /* FPF programming for loopback port.*/ 1530 if (soc_feature(unit, soc_feature_lport_tab_profile)) { 1531 SHR_BITSET(pfs_bmp, 1532 soc_mem_index_max(unit, FP_PORT_FIELD_SELm) - 1); 1533 /* 1534 * The last index in FP_PORT_FIELD_SEL is dedicated to WLAN, 1535 * Include Loopback Port in the PBMP. 1536 */ 1537 SHR_BITSET(pfs_bmp, 1538 soc_mem_index_max(unit, FP_PORT_FIELD_SELm)); 1539 } 1540 #endif /* BCM_TRIUMPH_SUPPORT */ 1541 1542 return (BCM_E_NONE); 1543 } 1544 /* 1545 * Function: 1546 * _field_trx_ingress_selcodes_install 1547 * 1548 * Purpose: 1549 * Writes the field select codes (ie. FPFx). 1550 * 1551 * Parameters: 1552 * unit - (IN) BCM device number. 1553 * fg - (IN) Field group. 1554 * slice_numb - (IN) Slice number group installed in. 1555 * pbmp - (IN) Group active port bit map. 1556 * selcode_index - (IN) Index into select codes array. 1557 * Returns: 1558 * BCM_E_XXX 1559 */ 1560 int 1561 _bcm_field_trx_ingress_selcodes_install(int unit, _field_group_t *fg, 1562 uint8 slice_num, bcm_pbmp_t *pbmp, 1563 int selcode_index) 1564 { 1565 _field_stage_t *stage_fc; 1566 bcm_port_t idx; /* Device pfs indexes iterator.*/ 1567 uint32 buf[SOC_MAX_MEM_FIELD_WORDS];/* HW entry buffer. */ 1568 SHR_BITDCL *pfs_bmp; /* PFS bitmap. */ 1569 int pfs_idx_count; /* PFS index count. */ 1570 _field_sel_t *sel; /* Group field selectors. */ 1571 soc_field_t fld; /* Port field select field. */ 1572 uint32 value; /* Per slice selector. */ 1573 int rv; /* Operation return status. */ 1574 int ingress_entity = _FP_SELCODE_DONT_CARE; 1575 soc_reg_t double_wide_reg; 1576 1577 /* Input parameters check. */ 1578 1579 if (NULL == fg) { 1580 return (BCM_E_PARAM); 1581 } 1582 1583 rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc); 1584 if (BCM_FAILURE(rv)) { 1585 return (rv); 1586 } 1587 1588 if (slice_num >= stage_fc->tcam_slices) { 1589 return (BCM_E_PARAM); 1590 } 1591 1592 sel = &fg->sel_codes[selcode_index]; 1593 1594 /* Get port field select table size and allocated bitmap of indexes 1595 * applicable to the group. 1596 */ 1597 pfs_bmp = NULL; 1598 pfs_idx_count = soc_mem_index_count(unit, FP_PORT_FIELD_SELm); 1599 _FP_XGS3_ALLOC(pfs_bmp, 1600 MAX(SHR_BITALLOCSIZE(pfs_idx_count), sizeof(bcm_pbmp_t)), 1601 "PFS bmp"); 1602 if (NULL == pfs_bmp) { 1603 return (BCM_E_MEMORY); 1604 } 1605 1606 /* Populate pfs indexes applicable for the group. */ 1607 rv = _bcm_field_trx_ingress_pfs_bmap_get(unit, fg, pbmp, 1608 selcode_index, pfs_bmp); 1609 if (BCM_FAILURE(rv)) { 1610 sal_free(pfs_bmp); 1611 return (rv); 1612 } 1613 1614 if ((fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) && 1615 ((selcode_index == 1) || (selcode_index == 3))) { 1616 1617 /* Write appropriate values in FP_DOUBLE_WIDE_F4_SELECTr and */ 1618 if (SOC_IS_KATANA2(unit)) { 1619 double_wide_reg = FP_DOUBLE_WIDE_SELECTr; 1620 if (sel->fpf1 != _FP_SELCODE_DONT_CARE) { 1621 /* 1622 * F1.0 - L4 1623 * F1.1 - MPLS 1624 */ 1625 rv = soc_reg_field32_modify(unit, double_wide_reg, 1626 REG_PORT_ANY, _bcm_field_trx_dw_f1_sel[slice_num], 1627 sel->fpf1); 1628 if (BCM_FAILURE(rv)) { 1629 sal_free(pfs_bmp); 1630 return (rv); 1631 } 1632 } 1633 } else { 1634 double_wide_reg = FP_DOUBLE_WIDE_F4_SELECTr; 1635 } 1636 if ((sel->fpf4 != _FP_SELCODE_DONT_CARE) && 1637 SOC_REG_FIELD_VALID(unit, double_wide_reg, 1638 _bcm_field_trx_dw_f4_sel[slice_num])) { 1639 rv = soc_reg_field32_modify(unit, double_wide_reg, 1640 REG_PORT_ANY, 1641 _bcm_field_trx_dw_f4_sel[slice_num], 1642 sel->fpf4); 1643 if (BCM_FAILURE(rv)) { 1644 sal_free(pfs_bmp); 1645 return (rv); 1646 } 1647 } 1648 1649 if ((sel->fpf1 != _FP_SELCODE_DONT_CARE) && 1650 SOC_REG_FIELD_VALID(unit, FP_DOUBLE_WIDE_F1_SELECTr, 1651 _bcm_field_trx_dw_f1_sel[slice_num])) { 1652 rv = soc_reg_field32_modify(unit, FP_DOUBLE_WIDE_F1_SELECTr, 1653 REG_PORT_ANY, 1654 _bcm_field_trx_dw_f1_sel[slice_num], 1655 sel->fpf1); 1656 if (BCM_FAILURE(rv)) { 1657 sal_free(pfs_bmp); 1658 return (rv); 1659 } 1660 } 1661 1662 if ((sel->fpf2 != _FP_SELCODE_DONT_CARE) && 1663 SOC_MEM_FIELD_VALID(unit, FP_PORT_FIELD_SELm, 1664 _trx_ifp_double_wide_key[slice_num])) { 1665 /* Do the same thing for each entry in FP_PORT_FIELD_SEL table */ 1666 for (idx = 0; idx < pfs_idx_count; idx++) { 1667 if (0 == SHR_BITGET(pfs_bmp, idx)) { 1668 continue; 1669 } 1670 sal_memset(buf, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 1671 rv = soc_mem_read(unit, FP_PORT_FIELD_SELm, MEM_BLOCK_ANY, 1672 idx, buf); 1673 if (BCM_FAILURE(rv)) { 1674 sal_free(pfs_bmp); 1675 return (rv); 1676 } 1677 soc_mem_field32_set(unit, FP_PORT_FIELD_SELm, buf, 1678 _trx_ifp_double_wide_key[slice_num], 1679 sel->fpf2); 1680 1681 1682 1683 1684 rv = soc_mem_write(unit, FP_PORT_FIELD_SELm, MEM_BLOCK_ALL, 1685 idx, buf); 1686 if (BCM_FAILURE(rv)) { 1687 sal_free(pfs_bmp); 1688 return (rv); 1689 } 1690 } 1691 } 1692 } else { 1693 /* Iterate over all ports */ 1694 for (idx = 0; idx < pfs_idx_count; idx++) { 1695 1696 sal_memset(buf, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 1697 /* Read Port's current entry in FP_PORT_FIELD_SEL table */ 1698 rv = soc_mem_read(unit, FP_PORT_FIELD_SELm, MEM_BLOCK_ANY, idx, buf); 1699 if (BCM_FAILURE(rv)) { 1700 sal_free(pfs_bmp); 1701 return (rv); 1702 } 1703 /* Set slice mode. */ 1704 fld = _bcm_field_trx_slice_wide_mode_field[slice_num]; 1705 if (SOC_MEM_FIELD_VALID(unit, FP_PORT_FIELD_SELm, fld)) { 1706 value = (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) ? 1 : 0; 1707 soc_FP_PORT_FIELD_SELm_field32_set(unit, buf, fld, value); 1708 } 1709 1710 /* Set inter slice pair mode. */ 1711 value = (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) ? 1 : 0; 1712 fld = _bcm_field_trx_slice_pairing_field[slice_num / 2]; 1713 soc_FP_PORT_FIELD_SELm_field32_set(unit, buf, fld, value); 1714 1715 if (0 == SHR_BITGET(pfs_bmp, idx)) { 1716 if ((fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) 1717 || (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE)) { 1718 /* Write each port's new entry */ 1719 rv = soc_mem_write(unit, FP_PORT_FIELD_SELm, 1720 MEM_BLOCK_ALL, idx, buf); 1721 if (BCM_FAILURE(rv)) { 1722 sal_free(pfs_bmp); 1723 return (rv); 1724 } 1725 } 1726 continue; 1727 } 1728 1729 /* modify 0-3 fields depending on state of SELCODE_INVALID */ 1730 if (sel->fpf1 != _FP_SELCODE_DONT_CARE) { 1731 soc_mem_field32_set(unit, 1732 FP_PORT_FIELD_SELm, buf, 1733 _bcm_field_trx_field_sel[slice_num][0], 1734 sel->fpf1); 1735 } 1736 1737 if (sel->fpf2 != _FP_SELCODE_DONT_CARE) { 1738 soc_mem_field32_set(unit, 1739 FP_PORT_FIELD_SELm, buf, 1740 _bcm_field_trx_field_sel[slice_num][1], 1741 sel->fpf2); 1742 } 1743 if (sel->fpf3 != _FP_SELCODE_DONT_CARE) { 1744 soc_mem_field32_set(unit, 1745 FP_PORT_FIELD_SELm, buf, 1746 _bcm_field_trx_field_sel[slice_num][2], 1747 sel->fpf3); 1748 } 1749 1750 /* Set destination forwarding type selection. */ 1751 if (sel->dst_fwd_entity_sel != _FP_SELCODE_DONT_CARE) { 1752 switch (sel->dst_fwd_entity_sel) { 1753 case _bcmFieldFwdEntityMultipath: 1754 value = 7; 1755 break; 1756 case _bcmFieldFwdEntityMplsGport: 1757 case _bcmFieldFwdEntityNivGport: 1758 case _bcmFieldFwdEntityCommonGport: /* for DstGport*/ 1759 case _bcmFieldFwdEntityMimGport: 1760 case _bcmFieldFwdEntityWlanGport: 1761 case _bcmFieldFwdEntityVxlanGport: 1762 case _bcmFieldFwdEntityVlanGport: 1763 value = 3; 1764 break; 1765 case _bcmFieldFwdEntityMulticastGroup: 1766 value = 2; 1767 break; 1768 case _bcmFieldFwdEntityL3Egress: 1769 value = 1; 1770 break; 1771 default: 1772 value = 0; 1773 break; 1774 } 1775 if (SOC_MEM_FIELD_VALID(unit, 1776 FP_PORT_FIELD_SELm, 1777 _bcm_field_trx_d_type_sel[slice_num] 1778 ) 1779 ) { 1780 soc_mem_field32_set(unit, 1781 FP_PORT_FIELD_SELm, 1782 buf, 1783 _bcm_field_trx_d_type_sel[slice_num], 1784 value 1785 ); 1786 } 1787 } 1788 1789 /* Set source entity type selection. */ 1790 if (sel->src_entity_sel != _FP_SELCODE_DONT_CARE) { 1791 ingress_entity = sel->src_entity_sel; 1792 } else if (sel->ingress_entity_sel != _FP_SELCODE_DONT_CARE) { 1793 ingress_entity = sel->ingress_entity_sel; 1794 } 1795 1796 if (ingress_entity != _FP_SELCODE_DONT_CARE) { 1797 switch (ingress_entity) { 1798 case _bcmFieldFwdEntityMplsGport: 1799 case _bcmFieldFwdEntityNivGport: 1800 case _bcmFieldFwdEntityMimGport: 1801 case _bcmFieldFwdEntityWlanGport: 1802 case _bcmFieldFwdEntityVxlanGport: 1803 case _bcmFieldFwdEntityVlanGport: 1804 value = 3; 1805 break; 1806 case _bcmFieldFwdEntityModPortGport: 1807 value = 2; 1808 break; 1809 case _bcmFieldFwdEntityGlp: 1810 value = 1; 1811 break; 1812 case _bcmFieldFwdEntityCommonGport: 1813 /* Value 0 supports SVP (or) SGLP. 1814 * CommonGport can be VP or GLP. 1815 */ 1816 default: 1817 value = 0; 1818 break; 1819 } 1820 if (SOC_MEM_FIELD_VALID(unit, 1821 FP_PORT_FIELD_SELm, 1822 _bcm_field_trx_s_type_sel[slice_num] 1823 ) 1824 ) { 1825 soc_mem_field32_set 1826 (unit, 1827 FP_PORT_FIELD_SELm, 1828 buf, 1829 _bcm_field_trx_s_type_sel[slice_num], 1830 value 1831 ); 1832 } 1833 } 1834 1835 /* Write each port's new entry */ 1836 rv = soc_mem_write(unit, FP_PORT_FIELD_SELm, 1837 MEM_BLOCK_ALL, idx, buf); 1838 if (BCM_FAILURE(rv)) { 1839 sal_free(pfs_bmp); 1840 return (rv); 1841 } 1842 } 1843 } 1844 sal_free(pfs_bmp); 1845 1846 /* Set VRF Force Forwarding Enable Field */ 1847 if (sel->fwd_field_sel != _FP_SELCODE_DONT_CARE) { 1848 if (_bcmFieldFwdFieldVrf == sel->fwd_field_sel) { 1849 rv = soc_reg_field32_modify(unit, FP_FORCE_FORWARDING_FIELDr, 1850 REG_PORT_ANY, 1851 _bcm_trx2_vrf_force_forwarding_enable_field[slice_num], 1); 1852 BCM_IF_ERROR_RETURN(rv); 1853 } 1854 } 1855 1856 /* Update FP_SLICE_KEY_CONTROL memory entry. */ 1857 sal_memset(buf, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 1858 rv = soc_mem_read(unit, FP_SLICE_KEY_CONTROLm, MEM_BLOCK_ANY, 0, buf); 1859 BCM_IF_ERROR_RETURN(rv); 1860 1861 1862 /* Set source class select field. */ 1863 if (sel->src_class_sel != _FP_SELCODE_DONT_CARE) { 1864 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1865 _trx_src_class_id_sel[slice_num], 1866 sel->src_class_sel); 1867 } 1868 /* Set destination class select field. */ 1869 if (sel->dst_class_sel != _FP_SELCODE_DONT_CARE) { 1870 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1871 _trx_dst_class_id_sel[slice_num], 1872 sel->dst_class_sel); 1873 } 1874 1875 /* Set interface class select field. */ 1876 if (sel->intf_class_sel != _FP_SELCODE_DONT_CARE) { 1877 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1878 _trx_interface_class_id_sel[slice_num], 1879 sel->intf_class_sel); 1880 } 1881 1882 /* Set Ttl class select field. */ 1883 if (sel->ttl_class_sel != _FP_SELCODE_DONT_CARE) { 1884 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1885 _trx_ttl_slice_control_enable_field[slice_num], 1886 sel->ttl_class_sel); 1887 } 1888 1889 /* Set Tcp class select field. */ 1890 if (sel->tcp_class_sel != _FP_SELCODE_DONT_CARE) { 1891 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1892 _trx_tcp_slice_control_enable_field[slice_num], 1893 sel->tcp_class_sel); 1894 } 1895 1896 /* Set Tos class select field. */ 1897 if (sel->tos_class_sel != _FP_SELCODE_DONT_CARE) { 1898 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1899 _trx_tos_slice_control_enable_field[slice_num], 1900 sel->tos_class_sel); 1901 } 1902 1903 #if defined BCM_TRIDENT2PLUS_SUPPORT 1904 if (soc_feature(unit, soc_feature_fp_based_oam)) { 1905 if (sel->oam_overlay_sel != _FP_SELCODE_DONT_CARE) { 1906 switch (sel->oam_overlay_sel) { 1907 case _bcmFieldOamOverlayEnable: 1908 value = 1; 1909 break; 1910 case _bcmFieldOamOverlayDisable: 1911 value = 0; 1912 break; 1913 default: 1914 return (BCM_E_INTERNAL); 1915 } 1916 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1917 _bcm_td2plus_oam_overlay_field[slice_num], 1918 value 1919 ); 1920 } 1921 } 1922 #endif 1923 1924 if (sel->aux_tag_1_sel != _FP_SELCODE_DONT_CARE) { 1925 switch (sel->aux_tag_1_sel) { 1926 case _bcmFieldAuxTagAny: 1927 value = 0; 1928 break; 1929 case _bcmFieldAuxTagVn: 1930 value = 1; 1931 break; 1932 /* _bcmFieldAuxTagMimlHeader equals _bcmFieldAuxTagCn */ 1933 case _bcmFieldAuxTagCn: 1934 /* case _bcmFieldAuxTagMimlHeader: */ 1935 value = 2; 1936 break; 1937 /* _bcmFieldAuxTagCustomHeader equals _bcmFieldAuxTagFabricQueue */ 1938 case _bcmFieldAuxTagFabricQueue: 1939 /* case _bcmFieldAuxTagCustomHeader: */ 1940 value = 3; 1941 break; 1942 /* _bcmFieldAuxTagCapwapInfo equals _bcmFieldAuxTagMplsFwdingLabel */ 1943 case _bcmFieldAuxTagMplsFwdingLabel: 1944 /* case _bcmFieldAuxTagCapwapInfo: */ 1945 value = 4; 1946 break; 1947 case _bcmFieldAuxTagMplsCntlWord: 1948 value = 5; 1949 break; 1950 case _bcmFieldAuxTagRtag7A: 1951 value = 6; 1952 break; 1953 case _bcmFieldAuxTagRtag7B: 1954 value = 7; 1955 break; 1956 case _bcmFieldAuxTagVxlanOrLLTag: 1957 value = 8; 1958 break; 1959 case _bcmFieldAuxTagVxlanReserved: 1960 value = 9; 1961 break; 1962 default: 1963 return (BCM_E_INTERNAL); 1964 } 1965 1966 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 1967 _bcm_trx2_aux_tag_1_field[slice_num], 1968 value 1969 ); 1970 } 1971 1972 if (sel->aux_tag_2_sel != _FP_SELCODE_DONT_CARE) { 1973 switch (sel->aux_tag_2_sel) { 1974 case _bcmFieldAuxTagAny: 1975 value = 0; 1976 break; 1977 case _bcmFieldAuxTagVn: 1978 value = 1; 1979 break; 1980 /* _bcmFieldAuxTagMimlHeader equals _bcmFieldAuxTagCn */ 1981 case _bcmFieldAuxTagCn: 1982 /* case _bcmFieldAuxTagMimlHeader: */ 1983 value = 2; 1984 break; 1985 /* _bcmFieldAuxTagCustomHeader equals _bcmFieldAuxTagFabricQueue */ 1986 case _bcmFieldAuxTagFabricQueue: 1987 /* case _bcmFieldAuxTagCustomHeader: */ 1988 value = 3; 1989 break; 1990 /* _bcmFieldAuxTagCapwapInfo equals _bcmFieldAuxTagMplsFwdingLabel */ 1991 case _bcmFieldAuxTagMplsFwdingLabel: 1992 /* case _bcmFieldAuxTagCapwapInfo: */ 1993 value = 4; 1994 break; 1995 case _bcmFieldAuxTagMplsCntlWord: 1996 value = 5; 1997 break; 1998 case _bcmFieldAuxTagRtag7A: 1999 value = 6; 2000 break; 2001 case _bcmFieldAuxTagRtag7B: 2002 value = 7; 2003 break; 2004 case _bcmFieldAuxTagVxlanOrLLTag: 2005 value = 8; 2006 break; 2007 case _bcmFieldAuxTagVxlanReserved: 2008 value = 9; 2009 break; 2010 default: 2011 return (BCM_E_INTERNAL); 2012 } 2013 2014 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 2015 _bcm_trx2_aux_tag_2_field[slice_num], 2016 value 2017 ); 2018 } 2019 2020 rv = soc_mem_write(unit, FP_SLICE_KEY_CONTROLm, MEM_BLOCK_ALL, 0, buf); 2021 return (rv); 2022 } 2023 2024 /* 2025 * Function: 2026 * _field_trx_ingress_slice_clear 2027 * 2028 * Purpose: 2029 * Resets the IFP field slice configuration. 2030 * 2031 * Parameters: 2032 * unit - (IN) BCM device number. 2033 * slice_numb - (IN) Field slice number. 2034 * 2035 * Returns: 2036 * BCM_E_XXX 2037 */ 2038 int 2039 _bcm_field_trx_ingress_slice_clear(int unit, uint8 slice_numb) 2040 { 2041 int index; 2042 int index_max; 2043 fp_port_field_sel_entry_t pfs_entry; 2044 soc_field_t dw_fld; 2045 int rv; 2046 soc_reg_t double_wide_reg; 2047 uint32 buf[SOC_MAX_MEM_FIELD_WORDS];/* HW entry buffer. */ 2048 2049 /* clear FP_SLICE_KEY_CONTROL */ 2050 if (SOC_MEM_IS_VALID(unit, FP_SLICE_KEY_CONTROLm)) { 2051 sal_memset(buf, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 2052 rv = soc_mem_read(unit, FP_SLICE_KEY_CONTROLm, MEM_BLOCK_ANY, 0, buf); 2053 BCM_IF_ERROR_RETURN(rv); 2054 2055 /* Reset SrcClassId Selector */ 2056 if (SOC_MEM_FIELD_VALID(unit, FP_SLICE_KEY_CONTROLm, 2057 _trx_src_class_id_sel[slice_numb])) { 2058 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 2059 _trx_src_class_id_sel[slice_numb], 0); 2060 } 2061 /* Reset DstClassId Selector */ 2062 if (SOC_MEM_FIELD_VALID(unit, FP_SLICE_KEY_CONTROLm, 2063 _trx_dst_class_id_sel[slice_numb])) { 2064 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 2065 _trx_dst_class_id_sel[slice_numb], 0); 2066 } 2067 /* Reset IntfClassId Selector */ 2068 if (SOC_MEM_FIELD_VALID(unit, FP_SLICE_KEY_CONTROLm, 2069 _trx_interface_class_id_sel[slice_numb])) { 2070 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 2071 _trx_interface_class_id_sel[slice_numb], 0); 2072 } 2073 /* Reset Oam Overlay Selector */ 2074 #if defined BCM_TRIDENT2PLUS_SUPPORT 2075 if (soc_feature(unit, soc_feature_fp_based_oam)) { 2076 if (SOC_MEM_FIELD_VALID(unit, FP_SLICE_KEY_CONTROLm, 2077 _bcm_td2plus_oam_overlay_field[slice_numb])) { 2078 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 2079 _bcm_td2plus_oam_overlay_field[slice_numb], 0); 2080 } 2081 } 2082 #endif 2083 /* Reset AuxTag1 Field Selector */ 2084 if (SOC_MEM_FIELD_VALID(unit, FP_SLICE_KEY_CONTROLm, 2085 _bcm_trx2_aux_tag_1_field[slice_numb])) { 2086 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 2087 _bcm_trx2_aux_tag_1_field[slice_numb], 0); 2088 } 2089 /* Reset AuxTag2 Field Selector */ 2090 if (SOC_MEM_FIELD_VALID(unit, FP_SLICE_KEY_CONTROLm, 2091 _bcm_trx2_aux_tag_2_field[slice_numb])) { 2092 soc_mem_field32_set(unit, FP_SLICE_KEY_CONTROLm, buf, 2093 _bcm_trx2_aux_tag_2_field[slice_numb], 0); 2094 } 2095 /* Write into Hardware */ 2096 rv = soc_mem_write(unit, FP_SLICE_KEY_CONTROLm, MEM_BLOCK_ALL, 0, buf); 2097 BCM_IF_ERROR_RETURN(rv); 2098 } 2099 2100 /* Clear FP_PORT_FIELD_SEL*/ 2101 /* Iterate over all indexes */ 2102 index_max = soc_mem_index_max(unit, FP_PORT_FIELD_SELm); 2103 for (index = 0; index < index_max; index++) { 2104 /* Read Port's current entry in FP_PORT_FIELD_SEL table */ 2105 rv = READ_FP_PORT_FIELD_SELm(unit, MEM_BLOCK_ALL, 2106 index, &pfs_entry); 2107 BCM_IF_ERROR_RETURN(rv); 2108 soc_FP_PORT_FIELD_SELm_field32_set 2109 (unit, 2110 &pfs_entry, 2111 _bcm_field_trx_field_sel[slice_numb][0], 2112 0 2113 ); 2114 BCM_IF_ERROR_RETURN(rv); 2115 2116 soc_FP_PORT_FIELD_SELm_field32_set 2117 (unit, 2118 &pfs_entry, 2119 _bcm_field_trx_field_sel[slice_numb][1], 2120 0 2121 ); 2122 BCM_IF_ERROR_RETURN(rv); 2123 soc_FP_PORT_FIELD_SELm_field32_set 2124 (unit, 2125 &pfs_entry, 2126 _bcm_field_trx_field_sel[slice_numb][2], 2127 0 2128 ); 2129 BCM_IF_ERROR_RETURN(rv); 2130 2131 dw_fld = _trx_ifp_double_wide_key[slice_numb]; 2132 if (SOC_MEM_FIELD_VALID(unit, FP_PORT_FIELD_SELm, dw_fld)) { 2133 soc_FP_PORT_FIELD_SELm_field32_set(unit, &pfs_entry, dw_fld, 0); 2134 } 2135 2136 dw_fld = _bcm_field_trx_slice_wide_mode_field[slice_numb]; 2137 if (SOC_MEM_FIELD_VALID(unit, FP_PORT_FIELD_SELm, dw_fld)) { 2138 soc_FP_PORT_FIELD_SELm_field32_set(unit, &pfs_entry, dw_fld, 0); 2139 } 2140 2141 dw_fld = _bcm_field_trx_slice_pairing_field[slice_numb / 2]; 2142 soc_FP_PORT_FIELD_SELm_field32_set(unit, &pfs_entry, dw_fld, 0); 2143 2144 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 2145 if (SOC_MEM_FIELD_VALID(unit, FP_PORT_FIELD_SELm, 2146 _bcm_ifp_normalize_fldtbl[slice_numb][0])) { 2147 soc_FP_PORT_FIELD_SELm_field32_set(unit, &pfs_entry, 2148 _bcm_ifp_normalize_fldtbl[slice_numb][0], 0); 2149 } 2150 if (SOC_MEM_FIELD_VALID(unit, FP_PORT_FIELD_SELm, 2151 _bcm_ifp_normalize_fldtbl[slice_numb][1])) { 2152 soc_FP_PORT_FIELD_SELm_field32_set(unit, &pfs_entry, 2153 _bcm_ifp_normalize_fldtbl[slice_numb][1], 0); 2154 } 2155 #endif 2156 rv = WRITE_FP_PORT_FIELD_SELm(unit, MEM_BLOCK_ALL, index, &pfs_entry); 2157 BCM_IF_ERROR_RETURN(rv); 2158 } 2159 2160 if (SOC_IS_KATANA2(unit)) { 2161 double_wide_reg = FP_DOUBLE_WIDE_SELECTr; 2162 dw_fld = _bcm_field_trx_dw_f1_sel[slice_numb]; 2163 if (SOC_REG_FIELD_VALID(unit, double_wide_reg, dw_fld)) { 2164 rv = soc_reg_field32_modify(unit, double_wide_reg, 2165 REG_PORT_ANY, dw_fld, 0); 2166 BCM_IF_ERROR_RETURN(rv); 2167 } 2168 } else { 2169 double_wide_reg = FP_DOUBLE_WIDE_F4_SELECTr; 2170 } 2171 dw_fld = _bcm_field_trx_dw_f4_sel[slice_numb]; 2172 if (SOC_REG_FIELD_VALID(unit, double_wide_reg, dw_fld)) { 2173 rv = soc_reg_field32_modify(unit, double_wide_reg, 2174 REG_PORT_ANY, dw_fld, 0); 2175 BCM_IF_ERROR_RETURN(rv); 2176 } 2177 2178 dw_fld = _bcm_field_trx_dw_f1_sel[slice_numb]; 2179 if (SOC_REG_FIELD_VALID(unit, FP_DOUBLE_WIDE_F1_SELECTr, dw_fld)) { 2180 rv = soc_reg_field32_modify(unit, FP_DOUBLE_WIDE_F1_SELECTr, 2181 REG_PORT_ANY, dw_fld, 0); 2182 BCM_IF_ERROR_RETURN(rv); 2183 } 2184 2185 /* Clear VRF Force Forwarding Enable Field */ 2186 if (SOC_REG_FIELD_VALID(unit, FP_FORCE_FORWARDING_FIELDr, 2187 _bcm_trx2_vrf_force_forwarding_enable_field[slice_numb])) { 2188 rv = soc_reg_field32_modify(unit, FP_FORCE_FORWARDING_FIELDr, 2189 REG_PORT_ANY, 2190 _bcm_trx2_vrf_force_forwarding_enable_field[slice_numb], 0); 2191 BCM_IF_ERROR_RETURN(rv); 2192 } 2193 return (BCM_E_NONE); 2194 } 2195 /* 2196 * Function: 2197 * _bcm_field_trx_lookup_selcodes_install 2198 * 2199 * Purpose: 2200 * Writes the field select codes (ie. FPFx). 2201 * for VFP (_BCM_FIELD_STAGE_LOOKUP) lookup stage. 2202 * 2203 * Parameters: 2204 * unit - BCM device number 2205 * fs - slice that needs its select codes written 2206 * 2207 * Returns: 2208 * BCM_E_XXX 2209 */ 2210 int 2211 _bcm_field_trx_lookup_selcodes_install(int unit, _field_group_t *fg, 2212 uint8 slice_numb, int selcode_index) 2213 { 2214 uint32 reg_val; 2215 _field_sel_t *sel; 2216 int rv; 2217 sel = &fg->sel_codes[selcode_index]; 2218 2219 rv = READ_VFP_KEY_CONTROLr(unit, ®_val); 2220 BCM_IF_ERROR_RETURN(rv); 2221 2222 if ((fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) && 2223 (selcode_index % 2)) { 2224 if (sel->fpf2 != _FP_SELCODE_DONT_CARE) { 2225 soc_reg_field_set(unit, 2226 VFP_KEY_CONTROLr, 2227 ®_val, 2228 _bcm_field_trx_vfp_double_wide_sel[slice_numb], 2229 sel->fpf2 2230 ); 2231 } 2232 } else { 2233 if (sel->fpf2 != _FP_SELCODE_DONT_CARE) { 2234 soc_reg_field_set(unit, 2235 VFP_KEY_CONTROLr, 2236 ®_val, 2237 _bcm_field_trx_vfp_field_sel[slice_numb][0], 2238 sel->fpf2 2239 ); 2240 } 2241 if (sel->fpf3 != _FP_SELCODE_DONT_CARE) { 2242 soc_reg_field_set(unit, 2243 VFP_KEY_CONTROLr, 2244 ®_val, 2245 _bcm_field_trx_vfp_field_sel[slice_numb][1], 2246 sel->fpf3 2247 ); 2248 } 2249 } 2250 rv = WRITE_VFP_KEY_CONTROLr(unit, reg_val); 2251 BCM_IF_ERROR_RETURN(rv); 2252 2253 /* Set inner/outer ip header selection. */ 2254 if (sel->ip_header_sel != _FP_SELCODE_DONT_CARE) { 2255 rv = soc_reg_field32_modify(unit, 2256 VFP_KEY_CONTROL_2r, 2257 REG_PORT_ANY, 2258 _bcm_field_trx_vfp_ip_header_sel[slice_numb], 2259 sel->ip_header_sel 2260 ); 2261 } 2262 2263 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_KATANA2_SUPPORT) 2264 if (SOC_IS_KATANA(unit)) { 2265 if (sel->src_entity_sel != _FP_SELCODE_DONT_CARE) { 2266 rv = soc_reg_field32_modify(unit, VFP_KEY_CONTROL_2r, REG_PORT_ANY, 2267 _trx_vfp_src_type_sel[slice_numb], 2268 sel->src_entity_sel == _bcmFieldFwdEntityGlp ? 1 : 0); 2269 } 2270 } 2271 2272 if (SOC_IS_KATANA2(unit)) { 2273 if (sel->src_type_sel != _FP_SELCODE_DONT_CARE) { 2274 rv = soc_reg_field32_modify(unit, VFP_KEY_CONTROL_1r, REG_PORT_ANY, 2275 _trx_vfp_src_type_sel[slice_numb], 2276 sel->src_type_sel == _bcmFieldFwdEntityGlp ? 1 :0); 2277 } 2278 } 2279 #endif 2280 return (rv); 2281 } 2282 2283 /* 2284 * Function: 2285 * _field_trx_lookup_slice_clear 2286 * 2287 * Purpose: 2288 * Reset slice configuraton on group deletion event. 2289 * 2290 * Parameters: 2291 * unit - BCM device number 2292 * fs - slice that needs its select codes written 2293 * 2294 * Returns: 2295 * BCM_E_NONE - Success 2296 * 2297 * Note: 2298 * Unit lock should be held by calling function. 2299 */ 2300 STATIC int 2301 _field_trx_lookup_slice_clear(int unit, uint8 slice_numb) 2302 { 2303 uint32 reg_val; 2304 int rv; 2305 2306 SOC_IF_ERROR_RETURN(READ_VFP_KEY_CONTROLr(unit, ®_val)); 2307 soc_reg_field_set(unit, 2308 VFP_KEY_CONTROLr, 2309 ®_val, 2310 _bcm_field_trx_vfp_double_wide_sel[slice_numb], 2311 0 2312 ); 2313 soc_reg_field_set(unit, 2314 VFP_KEY_CONTROLr, 2315 ®_val, 2316 _bcm_field_trx_vfp_field_sel[slice_numb][0], 2317 0 2318 ); 2319 soc_reg_field_set(unit, 2320 VFP_KEY_CONTROLr, 2321 ®_val, 2322 _bcm_field_trx_vfp_field_sel[slice_numb][1], 2323 0 2324 ); 2325 soc_reg_field_set(unit, 2326 VFP_KEY_CONTROLr, 2327 ®_val, 2328 _bcm_field_trx_slice_pairing_field[slice_numb / 2], 2329 0 2330 ); 2331 SOC_IF_ERROR_RETURN(WRITE_VFP_KEY_CONTROLr(unit, reg_val)); 2332 2333 rv = soc_reg_field32_modify(unit, 2334 VFP_KEY_CONTROL_2r, 2335 REG_PORT_ANY, 2336 _bcm_field_trx_vfp_ip_header_sel[slice_numb], 2337 0 2338 ); 2339 if (SOC_IS_KATANA(unit)) { 2340 rv = soc_reg_field32_modify(unit, VFP_KEY_CONTROL_2r, REG_PORT_ANY, 2341 _trx_vfp_src_type_sel[slice_numb], 0); 2342 } 2343 2344 if (SOC_IS_KATANA2(unit)) { 2345 rv = soc_reg_field32_modify(unit, VFP_KEY_CONTROL_1r, REG_PORT_ANY, 2346 _trx_vfp_src_type_sel[slice_numb], 0); 2347 } 2348 return (rv); 2349 } 2350 2351 /* 2352 * Function: 2353 * _bcm_field_trx_slice_clear 2354 * 2355 * Purpose: 2356 * Clear slice configuration on group removal 2357 * 2358 * Parameters: 2359 * unit - BCM device number 2360 * fg - Field group slice belongs to 2361 * fs - Field slice structure. 2362 * 2363 * Returns: 2364 * BCM_E_XXX 2365 */ 2366 int 2367 _bcm_field_trx_slice_clear(int unit, _field_group_t *fg, _field_slice_t *fs) 2368 { 2369 int rv; 2370 2371 switch (fs->stage_id) { 2372 case _BCM_FIELD_STAGE_INGRESS: 2373 rv = _bcm_field_trx_ingress_slice_clear(unit, fs->slice_number); 2374 break; 2375 case _BCM_FIELD_STAGE_LOOKUP: 2376 rv = _field_trx_lookup_slice_clear(unit, fs->slice_number); 2377 break; 2378 case _BCM_FIELD_STAGE_EGRESS: 2379 rv = _bcm_field_trx_egress_slice_clear(unit, fs->slice_number); 2380 break; 2381 #if defined(BCM_TRIUMPH_SUPPORT) 2382 case _BCM_FIELD_STAGE_EXTERNAL: 2383 rv = _bcm_field_tr_external_slice_clear(unit, fg); 2384 break; 2385 #endif /* BCM_TRIUMPH_SUPPORT */ 2386 default: 2387 rv = BCM_E_INTERNAL; 2388 } 2389 return (rv); 2390 } 2391 2392 /* 2393 * Function: 2394 * _bcm_field_trx_selcodes_install 2395 * 2396 * Purpose: 2397 * Writes the field select codes (ie. FPFx). 2398 * 2399 * Parameters: 2400 * unit - BCM device number 2401 * fs - slice that needs its select codes written 2402 * 2403 * Returns: 2404 * BCM_E_INTERNAL - On read/write errors 2405 * BCM_E_NONE - Success 2406 * 2407 * Note: 2408 * Unit lock should be held by calling function. 2409 */ 2410 int 2411 _bcm_field_trx_selcodes_install(int unit, _field_group_t *fg, 2412 uint8 slice_numb, bcm_pbmp_t pbmp, 2413 int selcode_index) 2414 { 2415 int rv; /* Operation return status. */ 2416 2417 /* Input parameters check. */ 2418 if (NULL == fg) { 2419 return (BCM_E_PARAM); 2420 } 2421 2422 /* Set slice mode. Single/Double/Triple, Intraslice */ 2423 rv = _bcm_field_trx_mode_set(unit, slice_numb, fg, fg->flags); 2424 BCM_IF_ERROR_RETURN(rv); 2425 2426 switch (fg->stage_id) { 2427 case _BCM_FIELD_STAGE_INGRESS: 2428 rv = _bcm_field_trx_ingress_selcodes_install(unit, fg, slice_numb, 2429 &pbmp, selcode_index); 2430 break; 2431 case _BCM_FIELD_STAGE_LOOKUP: 2432 rv = _bcm_field_trx_lookup_selcodes_install(unit, fg, slice_numb, 2433 selcode_index); 2434 break; 2435 case _BCM_FIELD_STAGE_EGRESS: 2436 case _BCM_FIELD_STAGE_EXTERNAL: 2437 rv = (BCM_E_NONE); 2438 break; 2439 default: 2440 rv = (BCM_E_PARAM); 2441 } 2442 return (rv); 2443 } 2444 2445 /* 2446 * Function: 2447 * _bcm_field_trx_qual_lists_get 2448 * Purpose: 2449 * Build a group's qualifiers array by assembling 2450 * qualifiers from each select code. 2451 * Parameters: 2452 * unit - (IN) BCM device number. 2453 * stage_fc - (IN) Stage field control structure. 2454 * fg - (IN) Group control structure. 2455 * Returns: 2456 * BCM_E_XXX 2457 */ 2458 int 2459 _bcm_field_trx_qual_lists_get(int unit, _field_stage_t *stage_fc, 2460 _field_group_t *fg) 2461 { 2462 return (BCM_E_NONE); 2463 } 2464 2465 2466 /* 2467 * Function: 2468 * _bcm_field_trx_tcam_get 2469 * Purpose: 2470 * Get the rules to be written into tcam. 2471 * Parameters: 2472 * unit - (IN) BCM device number. 2473 * tcam_mem - (IN) TCAM memory 2474 * f_ent - (IN) Field entry structure to get tcam info from. 2475 * buf - (OUT) TCAM entry 2476 * Returns: 2477 * BCM_E_NONE - Success 2478 * Note: 2479 * Unit lock should be held by calling function. 2480 */ 2481 int 2482 _bcm_field_trx_tcam_get(int unit, soc_mem_t mem, 2483 _field_entry_t *f_ent, uint32 *buf) 2484 { 2485 soc_field_t key_field, mask_field; 2486 _field_tcam_t *tcam; 2487 _field_group_t *fg; 2488 uint32 valid_value = 0; 2489 2490 fg = f_ent->group; 2491 2492 if (_BCM_FIELD_STAGE_INGRESS == fg->stage_id) { 2493 #ifdef BCM_TRIDENT_SUPPORT 2494 if (mem == FP_GM_FIELDSm) { 2495 valid_value = 1; 2496 tcam = &f_ent->extra_tcam; 2497 key_field = KEYf; 2498 mask_field = MASKf; 2499 } else 2500 #endif /* BCM_TRIDENT_SUPPORT */ 2501 if ((SOC_IS_TRIUMPH2(unit) || SOC_IS_APOLLO(unit) || SOC_IS_KATANAX(unit)) 2502 && FP_GLOBAL_MASK_TCAMm == mem) { 2503 if (SOC_IS_KATANAX(unit)) { 2504 valid_value = SOC_IS_KATANA2(unit) ? 3: 1; 2505 } 2506 tcam = &f_ent->extra_tcam; 2507 key_field = IPBMf; 2508 mask_field = IPBM_MASKf; 2509 } else { 2510 valid_value = (fg->flags & _FP_GROUP_LOOKUP_ENABLED) ? 3 : 2; 2511 tcam = &f_ent->tcam; 2512 /* Intra-slice double wide key */ 2513 #ifdef BCM_TRIDENT_SUPPORT 2514 if (SOC_IS_TD_TT(unit)) { 2515 key_field = KEYf; 2516 mask_field = MASKf; 2517 } else 2518 #endif /* BCM_TRIDENT_SUPPORT */ 2519 #if defined(BCM_HURRICANE2_SUPPORT) || defined(BCM_GREYHOUND_SUPPORT) 2520 if (SOC_IS_HURRICANE2(unit) || SOC_IS_GREYHOUND(unit) || 2521 SOC_IS_HURRICANE3(unit) || SOC_IS_GREYHOUND2(unit)) { 2522 key_field = DATA_KEYf; 2523 mask_field = DATA_MASKf; 2524 } else 2525 #endif 2526 { 2527 key_field = DATAf; 2528 mask_field = DATA_MASKf; 2529 } 2530 } 2531 2532 if (soc_mem_field_valid(unit, mem, VALIDf)) { 2533 soc_mem_field32_set(unit, mem, buf, VALIDf, valid_value); 2534 } 2535 soc_mem_field_set(unit, mem, buf, key_field, tcam->key); 2536 soc_mem_field_set(unit, mem, buf, mask_field, tcam->mask); 2537 } else { 2538 #if defined(BCM_TRIDENT2_SUPPORT) 2539 if (SOC_IS_TD2_TT2(unit)) { 2540 if (_BCM_FIELD_STAGE_EGRESS == fg->stage_id && 2541 (f_ent->efp_key_match_type)) { 2542 tcam = &f_ent->key_match_tcam; 2543 } else { 2544 tcam = &f_ent->tcam; 2545 } 2546 } else 2547 #endif 2548 { 2549 tcam = &f_ent->tcam; 2550 } 2551 if (_BCM_FIELD_STAGE_LOOKUP == fg->stage_id) { 2552 mask_field = MASKf; 2553 } else if (_BCM_FIELD_STAGE_EGRESS == fg->stage_id) { 2554 mask_field = KEY_MASKf; 2555 } else { 2556 return (BCM_E_PARAM); 2557 } 2558 2559 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 2560 && (_BCM_FIELD_STAGE_EGRESS == fg->stage_id)) { 2561 soc_mem_field32_set(unit, mem, buf, KEY_SPAREf, 0); 2562 soc_mem_field32_set(unit, mem, buf, KEY_MASK_SPAREf, 0); 2563 } 2564 2565 soc_mem_field_set(unit, mem, buf, KEYf, tcam->key); 2566 soc_mem_field_set(unit, mem, buf, mask_field, tcam->mask); 2567 soc_mem_field32_set(unit, mem, buf, VALIDf, 2568 (fg->flags & _FP_GROUP_LOOKUP_ENABLED) ? 3 : 2); 2569 } 2570 return (BCM_E_NONE); 2571 } 2572 2573 /* 2574 * Function: 2575 * _bcm_field_trx_tcp_ttl_tos_init 2576 * Purpose: 2577 * Initialize the TCP_FN, TTL_FN and TOS_FN tables 2578 * Parameters: 2579 * unit - (IN) BCM device number. 2580 * Returns: 2581 * BCM_E_NONE 2582 * Notes: 2583 */ 2584 int 2585 _bcm_field_trx_tcp_ttl_tos_init(int unit) 2586 { 2587 int i; 2588 tcp_fn_entry_t tcp_entry; 2589 ttl_fn_entry_t ttl_entry; 2590 tos_fn_entry_t tos_entry; 2591 2592 if (SOC_WARM_BOOT(unit)) { 2593 return (BCM_E_NONE); 2594 } 2595 2596 sal_memset(&tcp_entry, 0, sizeof(tcp_fn_entry_t)); 2597 sal_memset(&ttl_entry, 0, sizeof(ttl_fn_entry_t)); 2598 sal_memset(&tos_entry, 0, sizeof(tos_fn_entry_t)); 2599 2600 /* TCP_FN table */ 2601 for (i = soc_mem_index_min(unit, TCP_FNm); 2602 i <= soc_mem_index_max(unit, TCP_FNm); i++) { 2603 2604 soc_mem_field32_set(unit, TCP_FNm, &tcp_entry, FN0f, i); 2605 soc_mem_field32_set(unit, TCP_FNm, &tcp_entry, FN1f, i); 2606 2607 soc_mem_write(unit, TCP_FNm, MEM_BLOCK_ALL, i, &tcp_entry); 2608 } 2609 2610 /* TTL_FN table */ 2611 for (i = soc_mem_index_min(unit, TTL_FNm); 2612 i <= soc_mem_index_max(unit, TTL_FNm); i++) { 2613 2614 soc_mem_field32_set(unit, TTL_FNm, &ttl_entry, FN0f, i); 2615 soc_mem_field32_set(unit, TTL_FNm, &ttl_entry, FN1f, i); 2616 2617 soc_mem_write(unit, TTL_FNm, MEM_BLOCK_ALL, i, &ttl_entry); 2618 } 2619 2620 /* TOS_FN table */ 2621 for (i = soc_mem_index_min(unit, TOS_FNm); 2622 i <= soc_mem_index_max(unit, TOS_FNm); i++) { 2623 2624 soc_mem_field32_set(unit, TOS_FNm, &tos_entry, FN0f, i); 2625 soc_mem_field32_set(unit, TOS_FNm, &tos_entry, FN1f, i); 2626 2627 soc_mem_write(unit, TOS_FNm, MEM_BLOCK_ALL, i, &tos_entry); 2628 } 2629 2630 if (soc_feature(unit, soc_feature_ing_capwap_parser)) { 2631 /* PAYLOAD_TOS_FN table */ 2632 for (i = soc_mem_index_min(unit, PAYLOAD_TOS_FNm); 2633 i <= soc_mem_index_max(unit, PAYLOAD_TOS_FNm); i++) { 2634 2635 soc_mem_field32_set(unit, PAYLOAD_TOS_FNm, &tos_entry, FN0f, i); 2636 soc_mem_field32_set(unit, PAYLOAD_TOS_FNm, &tos_entry, FN1f, i); 2637 2638 soc_mem_write(unit, PAYLOAD_TOS_FNm, MEM_BLOCK_ALL, i, &tos_entry); 2639 } 2640 } 2641 2642 return BCM_E_NONE; 2643 } 2644 2645 /* 2646 * Function: 2647 * _bcm_field_trx_write_slice_map_egress 2648 * 2649 * Purpose: 2650 * Write the EFP_SLICE_MAP (EGRESS) 2651 * 2652 * Parameters: 2653 * unit 2654 * stage_fc - pointer to stage control block 2655 * 2656 * Returns: 2657 * BCM_E_XXX 2658 * 2659 * Notes: 2660 */ 2661 int 2662 _bcm_field_trx_write_slice_map_egress(int unit, _field_stage_t *stage_fc) 2663 { 2664 soc_field_t field; /* HW entry fields. */ 2665 uint32 map_entry; /* HW entry buffer. */ 2666 int vmap_size; /* Virtual map index count. */ 2667 uint32 value; /* Field entry value. */ 2668 int idx; /* Map fields iterator. */ 2669 int rv; /* Operation return status. */ 2670 2671 uint32 virtual_to_physical_map[] = { 2672 VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBERf, 2673 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBERf, 2674 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBERf, 2675 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBERf}; 2676 uint32 virtual_to_group_map[] = { 2677 VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUPf, 2678 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUPf, 2679 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUPf, 2680 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUPf}; 2681 2682 /* Calculate virtual map size. */ 2683 rv = _bcm_field_virtual_map_size_get(unit, stage_fc, &vmap_size); 2684 BCM_IF_ERROR_RETURN(rv); 2685 2686 rv = READ_EFP_SLICE_MAPr(unit, &map_entry); 2687 BCM_IF_ERROR_RETURN(rv); 2688 for (idx = 0; idx < vmap_size; idx++) { 2689 value = (stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][idx]).vmap_key; 2690 field = virtual_to_physical_map[idx]; 2691 soc_reg_field_set(unit, EFP_SLICE_MAPr, &map_entry, field, value); 2692 2693 value = (stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][idx]).virtual_group; 2694 field = virtual_to_group_map[idx]; 2695 soc_reg_field_set(unit, EFP_SLICE_MAPr, &map_entry, field, value); 2696 } 2697 2698 rv = WRITE_EFP_SLICE_MAPr(unit, map_entry); 2699 BCM_IF_ERROR_RETURN(rv); 2700 2701 return (BCM_E_NONE); 2702 } 2703 2704 /* 2705 * Function: 2706 * _bcm_field_trx_write_slice_map_vfp 2707 * 2708 * Purpose: 2709 * Write the VFP_SLICE_MAP (LOOKUP) 2710 * 2711 * Parameters: 2712 * unit 2713 * stage_fc - pointer to stage control block 2714 * 2715 * Returns: 2716 * BCM_E_XXX 2717 */ 2718 int 2719 _bcm_field_trx_write_slice_map_vfp(int unit, _field_stage_t *stage_fc) 2720 { 2721 soc_field_t field; /* HW entry fields. */ 2722 uint32 map_entry; /* HW entry buffer. */ 2723 int vmap_size; /* Virtual map index count. */ 2724 uint32 value; /* Field entry value. */ 2725 int idx; /* Map fields iterator. */ 2726 int rv; /* Operation return status. */ 2727 2728 uint32 virtual_to_physical_map[] = { 2729 VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBERf, 2730 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBERf, 2731 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBERf, 2732 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBERf}; 2733 uint32 virtual_to_group_map[] = { 2734 VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUPf, 2735 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUPf, 2736 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUPf, 2737 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUPf}; 2738 2739 /* Calculate virtual map size. */ 2740 rv = _bcm_field_virtual_map_size_get(unit, stage_fc, &vmap_size); 2741 BCM_IF_ERROR_RETURN(rv); 2742 2743 rv = READ_VFP_SLICE_MAPr(unit, &map_entry); 2744 BCM_IF_ERROR_RETURN(rv); 2745 2746 for (idx = 0; idx < vmap_size; idx++) { 2747 value = (stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][idx]).vmap_key; 2748 field = virtual_to_physical_map[idx]; 2749 soc_reg_field_set(unit, VFP_SLICE_MAPr, &map_entry, field, value); 2750 2751 value = (stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][idx]).virtual_group; 2752 field = virtual_to_group_map[idx]; 2753 soc_reg_field_set(unit, VFP_SLICE_MAPr, &map_entry, field, value); 2754 } 2755 2756 rv = WRITE_VFP_SLICE_MAPr(unit, map_entry); 2757 BCM_IF_ERROR_RETURN(rv); 2758 2759 return (BCM_E_NONE); 2760 } 2761 2762 2763 #ifdef INCLUDE_L3 2764 /* 2765 * Function: 2766 * _field_trx_policy_set_l3_info 2767 * Purpose: 2768 * Install l3 forwarding policy entry. 2769 * Parameters: 2770 * unit - (IN) BCM device number 2771 * mem - (IN) Policy table memory. 2772 * value - (IN) Egress object id or combined next hop information. 2773 * buf - (IN/OUT) Hw entry buffer to write. 2774 * Returns: 2775 * BCM_E_XXX 2776 */ 2777 int 2778 _field_trx_policy_set_l3_info(int unit, soc_mem_t mem, int value, uint32 *buf) 2779 { 2780 uint32 flags; /* L3 forwarding flags */ 2781 int nh_ecmp_id; /* Next hop/Ecmp group id. */ 2782 int retval; /* Operation return value. */ 2783 2784 /* Resove next hop /ecmp group id. */ 2785 retval = _bcm_field_policy_set_l3_nh_resolve(unit, value, 2786 &flags, &nh_ecmp_id); 2787 BCM_IF_ERROR_RETURN(retval); 2788 2789 if (flags & BCM_L3_MULTIPATH) { 2790 LOG_DEBUG(BSL_LS_BCM_FP, 2791 (BSL_META_U(unit, 2792 "FP(unit %d) vverb: Install mpath L3 policy (Ecmp_group: %d)))"), 2793 unit, nh_ecmp_id)); 2794 PolicySet(unit, mem, buf, ECMPf, 1); 2795 PolicySet(unit, mem, buf, ECMP_PTRf, nh_ecmp_id); 2796 } else { 2797 LOG_DEBUG(BSL_LS_BCM_FP, 2798 (BSL_META_U(unit, 2799 "FP(unit %d) vverb: Install unipath L3 policy(Next hop id: %d)))"), 2800 unit, nh_ecmp_id)); 2801 if (SOC_MEM_FIELD_VALID(unit, mem, ECMPf)) { 2802 PolicySet(unit, mem, buf, ECMPf, 0); 2803 } 2804 PolicySet(unit, mem, buf, NEXT_HOP_INDEXf, nh_ecmp_id); 2805 } 2806 return (BCM_E_NONE); 2807 } 2808 2809 /* 2810 * Function: 2811 * _field_trx_policy_egr_nexthop_info_set 2812 * Purpose: 2813 * Set next hop redirection value in the policy table entry. 2814 * Parameters: 2815 * unit - (IN) BCM device number 2816 * mem - (IN) Policy table memory. 2817 * value - (IN) Egress object id or combined next hop information. 2818 * buf - (IN/OUT) Hw entry buffer to write. 2819 * Returns: 2820 * BCM_E_XXX 2821 */ 2822 STATIC int 2823 _field_trx_policy_egr_nexthop_info_set(int unit, soc_mem_t mem, 2824 int value, uint32 *buf) 2825 { 2826 uint32 redirect_to_nhi = 0; /* Hw config + (ECMP or NH Info) */ 2827 uint32 flags; /* L3 forwarding flags. */ 2828 int nh_ecmp_id; /* Next hop/Ecmp group id. */ 2829 2830 /* Resove next hop /ecmp group id. */ 2831 BCM_IF_ERROR_RETURN(_bcm_field_policy_set_l3_nh_resolve(unit, value, 2832 &flags, &nh_ecmp_id)); 2833 2834 /* Check if NextHop is ECMP or regular Next Hop */ 2835 if (flags & BCM_L3_MULTIPATH) { 2836 /* ECMP next hop */ 2837 if (soc_feature(unit, soc_feature_field_action_redirect_ecmp)) { 2838 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 2839 redirect_to_nhi = (0x3 << 18) | nh_ecmp_id; 2840 } else if (SOC_IS_KATANAX(unit)) { 2841 redirect_to_nhi = (0x2 << 16) | nh_ecmp_id; 2842 } else { 2843 redirect_to_nhi = (0x3 << 16) | nh_ecmp_id; 2844 } 2845 } else { 2846 /* Non-Trident devices do not support redirect to ECMP action */ 2847 return (BCM_E_UNAVAIL); 2848 } 2849 LOG_DEBUG(BSL_LS_BCM_FP, 2850 (BSL_META_U(unit, 2851 "FP(unit %d) vverb: Set ECMP (Group id: %d\n)))"), 2852 unit, nh_ecmp_id)); 2853 } else { 2854 /* Regular next hop */ 2855 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 2856 redirect_to_nhi = (0x2 << 18) | nh_ecmp_id; 2857 } else if (SOC_IS_TD_TT(unit)) { 2858 redirect_to_nhi = (0x2 << 16) | nh_ecmp_id; 2859 } else if (SOC_IS_KATANAX(unit) || SOC_IS_GREYHOUND2(unit)) { 2860 redirect_to_nhi = (0x1 << 16) | nh_ecmp_id; 2861 } else if (SOC_IS_HURRICANE3(unit)) { 2862 redirect_to_nhi = (0x1 << 15) | nh_ecmp_id; 2863 } else { 2864 redirect_to_nhi = (0x1 << 14) | nh_ecmp_id; 2865 } 2866 LOG_DEBUG(BSL_LS_BCM_FP, 2867 (BSL_META_U(unit, 2868 "FP(unit %d) vverb: Set unipath (Nexthop index: %d\n)))"), 2869 unit, nh_ecmp_id)); 2870 } 2871 2872 /* Set policy table redirection fields */ 2873 PolicySet(unit, mem, buf, REDIRECTIONf, redirect_to_nhi); 2874 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 1); 2875 return (BCM_E_NONE); 2876 } 2877 #endif /* INCLUDE_L3 */ 2878 2879 /* 2880 * Function: 2881 * _field_trx_action_fabricQueue_actions_set 2882 * Purpose: 2883 * Install add fabric tag action 2884 * Parameters: 2885 * unit - (IN) BCM device number 2886 * mem - (IN) Policy table memory 2887 * cosq_idx - (IN) cosq index or (ucast_queue_group/ucast_subscriber) cosq gport 2888 * profile_idx - (IN) QoS map profile index 2889 * buf - (IN/OUT) Hw entry buffer to write. 2890 * Returns: 2891 * BCM_E_XXX 2892 */ 2893 STATIC int 2894 _field_trx_action_fabricQueue_actions_set(int unit, soc_mem_t mem, _field_action_t *fa, 2895 uint32 *buf) 2896 { 2897 int traffic_manager; /* Indicates the intended application for the 2898 SBX_QUEUE_TAG.0x0-Fabric Interface Chip. 2899 0x1 Traffic Manager.*/ 2900 int tag_type; /* SBX tag type. */ 2901 uint32 param0 = 0; 2902 uint32 in_flags = 0; 2903 uint32 cosq_idx; 2904 #ifdef BCM_KATANA_SUPPORT 2905 bcm_port_t port; 2906 int queue_index = 0, mask = 0, param1 = 0, modid = 0; 2907 ing_queue_map_entry_t ing_queue_entry; 2908 uint32 profile_idx; 2909 #endif 2910 int rv = BCM_E_NONE; 2911 2912 if (NULL == buf || NULL == fa) { 2913 return (BCM_E_PARAM); 2914 } 2915 2916 cosq_idx = fa->param[0]; 2917 2918 param0 = cosq_idx; 2919 2920 #if defined(BCM_KATANA_SUPPORT) 2921 profile_idx = fa->param[1]; 2922 param1 = profile_idx; 2923 /* If param1 BCM_FABRIC_QUEUE_xxx flags are set then 2924 * param0 is ucast_queu_group or ucast_subscriber_queue_group cosq gport 2925 */ 2926 if (SOC_IS_KATANAX(unit)) { 2927 if ((param1 & BCM_FABRIC_QUEUE_DEST_OFFSET) || 2928 (param1 & BCM_FABRIC_QUEUE_CUSTOMER)) { 2929 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(param0) || 2930 BCM_GPORT_IS_UCAST_SUBSCRIBER_QUEUE_GROUP(param0) || 2931 BCM_GPORT_IS_MCAST_SUBSCRIBER_QUEUE_GROUP(param0)) { 2932 #if defined(BCM_KATANA2_SUPPORT) 2933 if (SOC_IS_KATANA2(unit)) { 2934 BCM_IF_ERROR_RETURN(_bcm_kt2_cosq_index_resolve(unit, 2935 param0, 0, _BCM_KT_COSQ_INDEX_STYLE_BUCKET, 2936 &port, (int *)&cosq_idx, NULL)); 2937 } else 2938 #endif 2939 { 2940 if (SOC_IS_KATANA(unit)) { 2941 BCM_IF_ERROR_RETURN(_bcm_kt_cosq_index_resolve(unit, 2942 param0, 0, _BCM_KT_COSQ_INDEX_STYLE_BUCKET, 2943 &port, (int *)&cosq_idx, NULL)); 2944 } 2945 } 2946 in_flags = param1; 2947 } else { 2948 return BCM_E_PARAM; 2949 } 2950 } else { 2951 /* backward compatibility : API passing hw_index directly */ 2952 BCM_IF_ERROR_RETURN( 2953 bcm_kt_cosq_port_get(unit, cosq_idx & 0xffff, &port)); 2954 in_flags = param0; 2955 } 2956 BCM_IF_ERROR_RETURN(bcm_esw_stk_my_modid_get(unit, &modid)); 2957 port = ((modid & 0xff) << 7) | (port & 0x7f); 2958 } else 2959 #endif 2960 { 2961 in_flags = param0; 2962 } 2963 2964 /* Tag type resolution. */ 2965 if (in_flags & BCM_FABRIC_QUEUE_QOS_BASE) { 2966 tag_type = 0x3; /* Offset to base queue number from the 2967 QUEUE_MAP Table. Index into QUEUE_MAP 2968 Table is {DST_MODID, DST_PID} */ 2969 } else if (in_flags & BCM_FABRIC_QUEUE_DEST_OFFSET) { 2970 tag_type = 0x2; /* Index into QUEUE_MAP Table used for lookup. */ 2971 } else { 2972 tag_type = 0x1; /* Explicit queue number. */ 2973 } 2974 2975 PolicySet(unit, mem, buf, EH_TAG_TYPEf, tag_type); 2976 2977 /* Traffic manager vs Fabric chip queue selection. */ 2978 if (soc_mem_field_valid (unit, mem, EH_TMf)) { 2979 traffic_manager = (cosq_idx & BCM_FABRIC_QUEUE_CUSTOMER) ? 0x1 : 0x0; 2980 PolicySet(unit, mem, buf, EH_TMf, traffic_manager); 2981 } 2982 2983 /* Set queue number. */ 2984 PolicySet(unit, mem, buf, EH_QUEUE_TAGf, cosq_idx & 0xffff); 2985 2986 #if defined(BCM_KATANA_SUPPORT) 2987 if (SOC_IS_KATANAX(unit)) { 2988 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x1); 2989 PolicySet(unit, mem, buf, REDIRECTION_DGLPf, port); 2990 2991 if ((tag_type == 0x2) && (fa->flags & _FP_ACTION_DIRTY)) { 2992 queue_index = cosq_idx & 0xffff; 2993 rv = _bcm_field_fabricQueue_action_node_increment_ref_Count ( 2994 unit, queue_index, profile_idx); 2995 if(rv == BCM_E_NOT_FOUND) { 2996 /*entry not found. Add the entry in hw and linked list */ 2997 sal_memset(&ing_queue_entry, 0, sizeof(ing_queue_map_entry_t)); 2998 BCM_IF_ERROR_RETURN (soc_mem_read(unit, ING_QUEUE_MAPm, 2999 MEM_BLOCK_ANY, queue_index, &ing_queue_entry)); 3000 mask = (1 << soc_mem_field_length( 3001 unit, ING_QUEUE_MAPm, QUEUE_OFFSET_PROFILE_INDEXf)) - 1; 3002 soc_mem_field32_set(unit, ING_QUEUE_MAPm, 3003 &ing_queue_entry, QUEUE_SET_BASEf, 3004 queue_index); 3005 soc_mem_field32_set(unit, ING_QUEUE_MAPm, &ing_queue_entry, 3006 QUEUE_OFFSET_PROFILE_INDEXf, 3007 profile_idx & mask); 3008 BCM_IF_ERROR_RETURN(BCM_XGS3_MEM_WRITE(unit, ING_QUEUE_MAPm, 3009 queue_index, &ing_queue_entry)); 3010 BCM_IF_ERROR_RETURN(_bcm_field_fabricQueue_action_node_add ( 3011 unit, queue_index, profile_idx)); 3012 rv = BCM_E_NONE; 3013 } 3014 } 3015 } 3016 #endif 3017 3018 return rv; 3019 } 3020 3021 /* 3022 * Function: 3023 * _field_trx_action_copy_to_cpu 3024 * Purpose: 3025 * Install copy to cpu action in policy table. 3026 * Parameters: 3027 * unit - (IN) BCM device number 3028 * mem - (IN) Policy table memory 3029 * f_ent - (IN) Field entry structure to get policy info from 3030 * fa - (IN Field action 3031 * buf - (OUT) Field Policy table entry 3032 * Returns: 3033 * BCM_E_XXX 3034 */ 3035 int 3036 _field_trx_action_copy_to_cpu(int unit, soc_mem_t mem, _field_entry_t *f_ent, 3037 _field_action_t *fa, uint32 *buf) 3038 { 3039 if (NULL == f_ent || NULL == fa || NULL == buf) { 3040 return (BCM_E_PARAM); 3041 } 3042 3043 switch (fa->action) { 3044 case bcmFieldActionTimeStampToCpu: 3045 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x5); 3046 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x5); 3047 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x5); 3048 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 3049 PolicySet(unit, mem, buf, R_DROPf, 0x1); 3050 PolicySet(unit, mem, buf, Y_DROPf, 0x1); 3051 PolicySet(unit, mem, buf, G_DROPf, 0x1); 3052 } 3053 break; 3054 case bcmFieldActionRpTimeStampToCpu: 3055 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x5); 3056 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 3057 PolicySet(unit, mem, buf, R_DROPf, 0x1); 3058 } 3059 break; 3060 case bcmFieldActionYpTimeStampToCpu: 3061 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x5); 3062 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 3063 PolicySet(unit, mem, buf, Y_DROPf, 0x1); 3064 } 3065 break; 3066 case bcmFieldActionGpTimeStampToCpu: 3067 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x5); 3068 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 3069 PolicySet(unit, mem, buf, G_DROPf, 0x1); 3070 } 3071 break; 3072 case bcmFieldActionCopyToCpu: 3073 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 3074 PolicySet(unit, mem, buf, COPY_TO_CPUf, 0x1); 3075 } else { 3076 #ifdef BCM_APACHE_SUPPORT 3077 if (SOC_IS_APACHE(unit) && 3078 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 3079 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x3); 3080 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x3); 3081 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x3); 3082 } else 3083 #endif 3084 { 3085 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x1); 3086 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x1); 3087 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x1); 3088 } 3089 } 3090 break; 3091 case bcmFieldActionRpCopyToCpu: 3092 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x1); 3093 break; 3094 case bcmFieldActionYpCopyToCpu: 3095 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x1); 3096 break; 3097 case bcmFieldActionGpCopyToCpu: 3098 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x1); 3099 break; 3100 default: 3101 return (BCM_E_INTERNAL); 3102 } 3103 3104 if (fa->param[0] != 0) { 3105 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 3106 PolicySet(unit, mem, buf, VFP_MATCHED_RULEf, fa->param[1]); 3107 } else { 3108 PolicySet(unit, mem, buf, MATCHED_RULEf, fa->param[1]); 3109 } 3110 } 3111 return (BCM_E_NONE); 3112 } 3113 3114 /* 3115 * Function: 3116 * _field_trx_action_copy_to_cpu_cancel 3117 * Purpose: 3118 * Override copy to cpu action in policy table. 3119 * Parameters: 3120 * unit - (IN) BCM device number 3121 * mem - (IN) Policy table memory 3122 * f_ent - (IN) Field entry structure to get policy info from 3123 * fa - (IN Field action 3124 * buf - (OUT) Field Policy table entry 3125 * Returns: 3126 * BCM_E_XXX 3127 */ 3128 STATIC int 3129 _field_trx_action_copy_to_cpu_cancel(int unit, soc_mem_t mem, _field_entry_t *f_ent, 3130 _field_action_t *fa, uint32 *buf) 3131 { 3132 uint32 value = 0; 3133 3134 if (NULL == f_ent || NULL == fa || NULL == buf) { 3135 return (BCM_E_PARAM); 3136 } 3137 3138 switch (fa->action) { 3139 case bcmFieldActionTimeStampToCpuCancel: 3140 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x2); 3141 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x2); 3142 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x2); 3143 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 3144 PolicySet(unit, mem, buf, R_DROPf, 0x2); 3145 PolicySet(unit, mem, buf, Y_DROPf, 0x2); 3146 PolicySet(unit, mem, buf, G_DROPf, 0x2); 3147 } 3148 break; 3149 case bcmFieldActionRpTimeStampToCpuCancel: 3150 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x2); 3151 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 3152 PolicySet(unit, mem, buf, R_DROPf, 0x2); 3153 } 3154 break; 3155 case bcmFieldActionYpTimeStampToCpuCancel: 3156 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x2); 3157 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 3158 PolicySet(unit, mem, buf, Y_DROPf, 0x2); 3159 } 3160 break; 3161 case bcmFieldActionGpTimeStampToCpuCancel: 3162 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x2); 3163 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 3164 PolicySet(unit, mem, buf, G_DROPf, 0x2); 3165 } 3166 break; 3167 case bcmFieldActionCopyToCpuCancel: 3168 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 3169 PolicySet(unit, mem, buf, COPY_TO_CPUf, 0x2); 3170 } else { 3171 value = COPY_TO_CPU_CANCEL; 3172 #if defined(BCM_TRIUMPH3_SUPPORT) 3173 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 3174 SOC_IS_KATANA2(unit)) { 3175 if ((SWITCH_TO_CPU_CANCEL == 3176 PolicyGet(unit, mem, buf, R_COPY_TO_CPUf)) && 3177 (SWITCH_TO_CPU_CANCEL == 3178 PolicyGet(unit, mem, buf, Y_COPY_TO_CPUf)) && 3179 (SWITCH_TO_CPU_CANCEL == 3180 PolicyGet(unit, mem, buf, G_COPY_TO_CPUf))) { 3181 3182 value = COPY_AND_SWITCH_TO_CPU_CANCEL; 3183 } 3184 } 3185 #endif 3186 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, value); 3187 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, value); 3188 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, value); 3189 } 3190 3191 break; 3192 case bcmFieldActionRpCopyToCpuCancel: 3193 value = COPY_TO_CPU_CANCEL; 3194 #if defined(BCM_TRIUMPH3_SUPPORT) 3195 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 3196 SOC_IS_KATANA2(unit)) { 3197 if (SWITCH_TO_CPU_CANCEL == 3198 PolicyGet(unit, mem, buf, R_COPY_TO_CPUf)) { 3199 3200 value = COPY_AND_SWITCH_TO_CPU_CANCEL; 3201 } 3202 } 3203 #endif 3204 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, value); 3205 break; 3206 case bcmFieldActionYpCopyToCpuCancel: 3207 value = COPY_TO_CPU_CANCEL; 3208 #if defined(BCM_TRIUMPH3_SUPPORT) 3209 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 3210 SOC_IS_KATANA2(unit)) { 3211 if (SWITCH_TO_CPU_CANCEL == 3212 PolicyGet(unit, mem, buf, Y_COPY_TO_CPUf)) { 3213 3214 value = COPY_AND_SWITCH_TO_CPU_CANCEL; 3215 } 3216 } 3217 #endif 3218 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, value); 3219 break; 3220 case bcmFieldActionGpCopyToCpuCancel: 3221 value = COPY_TO_CPU_CANCEL; 3222 #if defined(BCM_TRIUMPH3_SUPPORT) 3223 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 3224 SOC_IS_KATANA2(unit)) { 3225 if (SWITCH_TO_CPU_CANCEL == 3226 PolicyGet(unit, mem, buf, G_COPY_TO_CPUf)) { 3227 3228 value = COPY_AND_SWITCH_TO_CPU_CANCEL; 3229 } 3230 } 3231 #endif 3232 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, value); 3233 3234 break; 3235 default: 3236 return (BCM_E_INTERNAL); 3237 } 3238 return (BCM_E_NONE); 3239 } 3240 3241 /* 3242 * Function: 3243 * _field_trx_action_ecn_update 3244 * Purpose: 3245 * Install ECN bits int IP header TOS field update action. 3246 * Parameters: 3247 * unit - (IN) BCM device number 3248 * mem - (IN) Policy table memory. 3249 * f_ent - (IN) Entry structure. 3250 * fa - (IN) Field action. 3251 * buf - (OUT) Field Policy table entry 3252 * Returns: 3253 * BCM_E_XXX 3254 */ 3255 STATIC int 3256 _field_trx_action_ecn_update (int unit, soc_mem_t mem, _field_entry_t *f_ent, 3257 _field_action_t *fa, uint32 *buf) 3258 { 3259 if (NULL == f_ent || NULL == fa || NULL == buf) { 3260 return (BCM_E_PARAM); 3261 } 3262 3263 /* ECN value sanity check. */ 3264 if (SOC_IS_TD2_TT2(unit) || 3265 ((SOC_IS_GREYHOUND(unit) || SOC_IS_HURRICANE3(unit) || 3266 SOC_IS_GREYHOUND2(unit)) && 3267 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS))) { 3268 switch (fa->param[0]) { 3269 case 0x0: 3270 case 0x1: 3271 case 0x2: 3272 case 0x3: 3273 break; 3274 default: 3275 return (BCM_E_PARAM); 3276 } 3277 switch (fa->action) { 3278 case bcmFieldActionEcnNew: 3279 if (soc_mem_field_valid(unit, mem, R_CHANGE_ECNf)) { 3280 PolicySet(unit, mem, buf, R_CHANGE_ECNf, 1); 3281 PolicySet(unit, mem, buf, R_NEW_ECNf, fa->param[0]); 3282 } 3283 if (soc_mem_field_valid(unit, mem, Y_CHANGE_ECNf)) { 3284 PolicySet(unit, mem, buf, Y_CHANGE_ECNf, 1); 3285 PolicySet(unit, mem, buf, Y_NEW_ECNf, fa->param[0]); 3286 } 3287 PolicySet(unit, mem, buf, G_CHANGE_ECNf, 1); 3288 PolicySet(unit, mem, buf, G_NEW_ECNf, fa->param[0]); 3289 break; 3290 case bcmFieldActionRpEcnNew: 3291 PolicySet(unit, mem, buf, R_CHANGE_ECNf, 1); 3292 PolicySet(unit, mem, buf, R_NEW_ECNf, fa->param[0]); 3293 break; 3294 case bcmFieldActionYpEcnNew: 3295 PolicySet(unit, mem, buf, Y_CHANGE_ECNf, 1); 3296 PolicySet(unit, mem, buf, Y_NEW_ECNf, fa->param[0]); 3297 break; 3298 case bcmFieldActionGpEcnNew: 3299 PolicySet(unit, mem, buf, G_CHANGE_ECNf, 1); 3300 PolicySet(unit, mem, buf, G_NEW_ECNf, fa->param[0]); 3301 break; 3302 default: 3303 return (BCM_E_PARAM); 3304 } 3305 } 3306 else { 3307 switch (fa->param[0]) { 3308 case 0x1: 3309 case 0x2: 3310 case 0x3: 3311 break; 3312 case 0x0: 3313 return (BCM_E_UNAVAIL); 3314 default: 3315 return (BCM_E_PARAM); 3316 } 3317 switch (fa->action) { 3318 case bcmFieldActionEcnNew: 3319 PolicySet(unit, mem, buf, R_CHANGE_ECNf, fa->param[0]); 3320 PolicySet(unit, mem, buf, Y_CHANGE_ECNf, fa->param[0]); 3321 PolicySet(unit, mem, buf, G_CHANGE_ECNf, fa->param[0]); 3322 break; 3323 case bcmFieldActionRpEcnNew: 3324 PolicySet(unit, mem, buf, R_CHANGE_ECNf, fa->param[0]); 3325 break; 3326 case bcmFieldActionYpEcnNew: 3327 PolicySet(unit, mem, buf, Y_CHANGE_ECNf, fa->param[0]); 3328 break; 3329 case bcmFieldActionGpEcnNew: 3330 PolicySet(unit, mem, buf, G_CHANGE_ECNf, fa->param[0]); 3331 break; 3332 default: 3333 return (BCM_E_PARAM); 3334 } 3335 } 3336 3337 return (BCM_E_NONE); 3338 } 3339 3340 #if defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_KATANA_SUPPORT) 3341 /* 3342 * Function: 3343 * _field_trx_flex_stat_action_set 3344 * Purpose: 3345 * Install flex counter update action into policy table. 3346 * Parameters: 3347 * unit - (IN) BCM device number 3348 * f_ent - (IN) entry structure to get policy info from 3349 * mem - (IN) Policy table memory 3350 * tcam_idx - (IN) Common index of various tables 3351 * buf - (OUT) Field Policy table entry 3352 * Returns: 3353 * BCM_E_XXX 3354 */ 3355 STATIC int 3356 _field_trx_flex_stat_action_set(int unit, 3357 _field_entry_t *f_ent, 3358 soc_mem_t mem, 3359 int tcam_idx, 3360 uint32 *buf) 3361 { 3362 _field_stat_t *f_st; /* Field statistics descriptor. */ 3363 int idx; /* Stat array index. */ 3364 3365 3366 /* Increment statistics hw reference count. */ 3367 if ((f_ent->statistic.flags & _FP_ENTRY_STAT_VALID) 3368 && !(f_ent->statistic.flags & _FP_ENTRY_STAT_INSTALLED)) { 3369 /* Get statistics entity description structure. */ 3370 BCM_IF_ERROR_RETURN 3371 (_bcm_field_stat_get(unit, f_ent->statistic.sid, &f_st)); 3372 if (_FP_INVALID_INDEX != f_st->hw_index) { 3373 /* 3374 * For STATs that are shared by entries, hardware counters 3375 * are not allocated again. But reference count is incremented 3376 * for these counters. 3377 */ 3378 f_st->hw_ref_count++; 3379 3380 BCM_IF_ERROR_RETURN 3381 (_bcm_esw_stat_flex_attach_ingress_table_counters1 3382 (unit, mem, tcam_idx, f_st->hw_mode, f_st->hw_index, 3383 f_st->pool_index, buf)); 3384 3385 /* Mark entry as installed. */ 3386 f_ent->statistic.flags |= _FP_ENTRY_STAT_INSTALLED; 3387 3388 /* 3389 * Write individual statistics previous value, first time 3390 * entry is installed in hardware. 3391 */ 3392 if (1 == f_st->hw_ref_count) { 3393 for (idx = 0; idx < f_st->nstat; idx++) { 3394 BCM_IF_ERROR_RETURN 3395 (_field_stat_value_set(unit, f_st, f_st->stat_arr[idx], 3396 f_st->stat_values[idx])); 3397 } 3398 } 3399 } 3400 } else if ((f_ent->statistic.flags & _FP_ENTRY_EXTENDED_STAT_VALID) 3401 && !(f_ent->statistic.flags & _FP_ENTRY_EXTENDED_STAT_INSTALLED)) { 3402 /* Get statistics entity description structure. */ 3403 if (soc_feature(unit, soc_feature_flex_stat_compaction_support)) { 3404 BCM_IF_ERROR_RETURN 3405 (_bcm_field_stat_get(unit, f_ent->statistic.extended_sid, &f_st)); 3406 3407 if (_FP_INVALID_INDEX != f_st->hw_index) { 3408 /* 3409 * For STATs that are shared by entries, hardware counters 3410 * are not allocated again. But reference count is incremented 3411 * for these counters. 3412 */ 3413 f_st->hw_ref_count++; 3414 3415 BCM_IF_ERROR_RETURN 3416 (_bcm_esw_stat_flex_attach_ingress_table_counters1 3417 (unit, mem, tcam_idx, f_st->hw_mode, f_st->hw_index, 3418 f_st->pool_index, buf)); 3419 3420 /* Mark entry as installed. */ 3421 f_ent->statistic.flags |= _FP_ENTRY_EXTENDED_STAT_INSTALLED; 3422 f_ent->statistic.flags |= _FP_ENTRY_STAT_INSTALLED; 3423 3424 /* 3425 * Write individual statistics previous value, first time 3426 * entry is installed in hardware. 3427 */ 3428 if (1 == f_st->hw_ref_count) { 3429 for (idx = 0; idx < f_st->nstat; idx++) { 3430 BCM_IF_ERROR_RETURN 3431 (_field_stat_value_set(unit, f_st, f_st->stat_arr[idx], 3432 f_st->stat_values[idx])); 3433 } 3434 } 3435 } 3436 } 3437 } else { 3438 /* Disable counting if counter was not attached to the entry. */ 3439 PolicySet(unit, mem, buf, FLEX_CTR_POOL_NUMBERf, 0); 3440 PolicySet(unit, mem, buf, FLEX_CTR_OFFSET_MODEf, 0); 3441 PolicySet(unit, mem, buf, FLEX_CTR_BASE_COUNTER_IDXf, 0); 3442 } 3443 3444 return (BCM_E_NONE); 3445 } 3446 #endif 3447 3448 #if defined(BCM_HURRICANE3_SUPPORT) 3449 /* 3450 * Function: 3451 * _field_trx_flowcnt_stat_action_set 3452 * Purpose: 3453 * Install flow counter update action into policy table. 3454 * Parameters: 3455 * unit - (IN) BCM device number 3456 * f_ent - (IN) entry structure to get policy info from 3457 * mem - (IN) Policy table memory 3458 * tcam_idx - (IN) Common index of various tables 3459 * buf - (OUT) Field Policy table entry 3460 * Returns: 3461 * BCM_E_XXX 3462 */ 3463 STATIC int 3464 _field_trx_flowcnt_stat_action_set(int unit, 3465 _field_entry_t *f_ent, 3466 soc_mem_t mem, 3467 int tcam_idx, 3468 uint32 *buf) 3469 { 3470 _field_stat_t *f_st; /* Field statistics descriptor. */ 3471 int idx; /* Stat array index. */ 3472 bcm_stat_group_mode_t group; 3473 bcm_stat_object_t object; 3474 uint32 profile_group, pool_idx, base_idx; 3475 3476 3477 /* Increment statistics hw reference count. */ 3478 if ((f_ent->statistic.flags & _FP_ENTRY_STAT_VALID) 3479 && !(f_ent->statistic.flags & _FP_ENTRY_STAT_INSTALLED)) { 3480 /* Get statistics entity description structure. */ 3481 BCM_IF_ERROR_RETURN 3482 (_bcm_field_stat_get(unit, f_ent->statistic.sid, &f_st)); 3483 3484 if (_FP_INVALID_INDEX != f_st->hw_index) { 3485 /* 3486 * For STATs that are shared by entries, hardware counters 3487 * are not allocated again. But reference count is incremented 3488 * for these counters. 3489 */ 3490 f_st->hw_ref_count++; 3491 3492 _bcm_esw_flowcnt_counter_id_get(f_st->flex_mode, 3493 &group, &object, &profile_group, &pool_idx, &base_idx); 3494 BCM_IF_ERROR_RETURN 3495 (_bcm_esw_flowcnt_object_table_attach 3496 (unit, object, mem, tcam_idx, profile_group, base_idx, 3497 pool_idx, buf)); 3498 PolicySet(unit, mem, buf, VLAN_CTR_ENABLEf, 1); 3499 3500 /* Mark entry as installed. */ 3501 f_ent->statistic.flags |= _FP_ENTRY_STAT_INSTALLED; 3502 3503 /* 3504 * Write individual statistics previous value, first time 3505 * entry is installed in hardware. 3506 */ 3507 if ((1 == f_st->hw_ref_count) 3508 && !(f_ent->flags & _FP_ENTRY_INSTALLED)) { 3509 for (idx = 0; idx < f_st->nstat; idx++) { 3510 BCM_IF_ERROR_RETURN 3511 (_field_stat_value_set(unit, f_st, f_st->stat_arr[idx], 3512 f_st->stat_values[idx])); 3513 } 3514 } 3515 } 3516 } else { 3517 /* Disable counting if counter was not attached to the entry. */ 3518 PolicySet(unit, mem, buf, VLAN_CTR_ENABLEf, 0); 3519 PolicySet(unit, mem, buf, VLAN_CTR_BASE_INDEXf, 0); 3520 PolicySet(unit, mem, buf, VLAN_CTR_PROFILE_PTRf, 0); 3521 } 3522 3523 return (BCM_E_NONE); 3524 } 3525 #endif 3526 3527 3528 /* 3529 * Function: 3530 * _bcm_field_trx_stat_action_set 3531 * Purpose: 3532 * Install counter update action into policy table. 3533 * Parameters: 3534 * unit - (IN) BCM device number 3535 * f_ent - (IN) entry structure to get policy info from 3536 * mem - (IN) Policy table memory 3537 * tcam_idx - (IN) Common index of various tables 3538 * buf - (OUT) Field Policy table entry 3539 * Returns: 3540 * BCM_E_XXX 3541 */ 3542 int 3543 _bcm_field_trx_stat_action_set(int unit, _field_entry_t *f_ent, 3544 soc_mem_t mem, int tcam_idx, 3545 uint32 *buf) 3546 { 3547 _field_stat_t *f_st; /* Field statistics descriptor. */ 3548 int mode; /* Counter hw mode. */ 3549 int idx; /* Counter index. */ 3550 int rv; /* Opear return status. */ 3551 3552 if (NULL == f_ent || NULL == buf) { 3553 return (BCM_E_PARAM); 3554 } 3555 3556 /* Initialization. */ 3557 f_st = NULL; 3558 3559 /* VFP doesn't have counters. */ 3560 if ((_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) 3561 && ((0 == soc_feature(unit, soc_feature_field_vfp_flex_counter)) 3562 && (0 == soc_feature(unit, soc_feature_flowcnt)) 3563 && (!soc_feature(unit, soc_feature_advanced_flex_counter)))) { 3564 return (BCM_E_NONE); 3565 } 3566 3567 #if defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_KATANA_SUPPORT) 3568 if (soc_feature(unit, soc_feature_advanced_flex_counter) 3569 && (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id)) { 3570 return (_field_trx_flex_stat_action_set 3571 (unit, f_ent, mem, tcam_idx, buf)); 3572 } 3573 #endif 3574 #if defined(BCM_HURRICANE3_SUPPORT) 3575 if (soc_feature(unit, soc_feature_flowcnt) 3576 && (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id)) { 3577 return (_field_trx_flowcnt_stat_action_set 3578 (unit, f_ent, mem, tcam_idx, buf)); 3579 } 3580 #endif 3581 3582 3583 if ((0 == (f_ent->statistic.flags & _FP_ENTRY_STAT_INSTALLED)) || 3584 ((f_ent->flags & _FP_ENTRY_PRIMARY) && 3585 (f_ent->flags & _FP_ENTRY_STAT_IN_SECONDARY_SLICE))) { 3586 /* Disable counting if counter was not attached to the entry. */ 3587 idx = 0; 3588 mode = 0; 3589 } else { 3590 /* Get statistics entity description structure. */ 3591 rv = _bcm_field_stat_get(unit, f_ent->statistic.sid, &f_st); 3592 BCM_IF_ERROR_RETURN(rv); 3593 idx = f_st->hw_index; 3594 mode = f_st->hw_mode; 3595 3596 /* Adjust counter hw mode for COUNTER_MODE_YES_NO/NO_YES */ 3597 if (f_ent->statistic.flags & _FP_ENTRY_STAT_USE_ODD) { 3598 mode++; 3599 } 3600 3601 } 3602 3603 /* Write policy table counter config. */ 3604 if (_BCM_FIELD_STAGE_EXTERNAL == f_ent->group->stage_id) { 3605 if (NULL != f_st) { 3606 f_st->pool_index = f_ent->fs->slice_number; 3607 f_st->hw_index = f_ent->slice_idx; 3608 } 3609 PolicySet(unit, mem, buf, EXT_COUNTER_MODEf, mode); 3610 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 3611 if ((f_ent->statistic.flags & _FP_ENTRY_STAT_NOT_ALLOWED) == 0) { 3612 PolicySet(unit, mem, buf, PID_COUNTER_MODEf, mode); 3613 PolicySet(unit, mem, buf, PID_COUNTER_INDEXf, idx); 3614 #ifdef BCM_TRIDENT2_SUPPORT 3615 if ((SOC_IS_TD2_TT2(unit)) && (!SOC_IS_TOMAHAWK3(unit))) { 3616 PolicySet(unit, mem, buf, VXLAN_ACTIONf, 0); 3617 } 3618 #endif 3619 } 3620 } else if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 3621 PolicySet(unit, mem, buf, USE_VINTF_CTR_IDXf, mode); 3622 PolicySet(unit, mem, buf, VINTF_CTR_IDXf, idx); 3623 } else { 3624 PolicySet(unit, mem, buf, COUNTER_MODEf, mode); 3625 PolicySet(unit, mem, buf, COUNTER_INDEXf, idx); 3626 } 3627 return (BCM_E_NONE); 3628 } 3629 3630 3631 /* 3632 * Function: 3633 * _field_trx_redirect_profile_get 3634 * Purpose: 3635 * Get the redirect profile for the unit 3636 * Parameters: 3637 * unit - BCM device number 3638 * redirect_profile - (OUT) redirect profile 3639 * Returns: 3640 * BCM_E_XXX 3641 * Notes: 3642 * For triumph, External TCAM and IFP refer to same IFP_REDIRECTION_PROFILEm 3643 */ 3644 int 3645 _field_trx_redirect_profile_get(int unit, soc_profile_mem_t **redirect_profile) 3646 { 3647 _field_control_t *fc = NULL; 3648 3649 /* Get field control structure. */ 3650 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 3651 3652 *redirect_profile = &fc->redirect_profile; 3653 3654 return (BCM_E_NONE); 3655 } 3656 3657 /* 3658 * Function: 3659 * _bcm_field_trx_redirect_profile_ref_count_get 3660 * Purpose: 3661 * Get redirect profile entry use count. 3662 * Parameters: 3663 * unit - (IN) BCM device number. 3664 * index - (IN) Profile entry index. 3665 * ref_count - (OUT) redirect profile use count. 3666 * Returns: 3667 * BCM_E_XXX 3668 */ 3669 int 3670 _bcm_field_trx_redirect_profile_ref_count_get(int unit, int index, int *ref_count) 3671 { 3672 soc_profile_mem_t *redirect_profile; 3673 3674 if (NULL == ref_count) { 3675 return (BCM_E_PARAM); 3676 } 3677 3678 /* Get the redirect profile */ 3679 BCM_IF_ERROR_RETURN 3680 (_field_trx_redirect_profile_get(unit, &redirect_profile)); 3681 3682 BCM_IF_ERROR_RETURN(soc_profile_mem_ref_count_get(unit, redirect_profile, 3683 index, ref_count)); 3684 return (BCM_E_NONE); 3685 } 3686 3687 /* 3688 * Function: 3689 * _bcm_field_trx_redirect_profile_delete 3690 * Purpose: 3691 * Delete redirect profile entry. 3692 * Parameters: 3693 * unit - (IN) BCM device number. 3694 * index - (IN) Profile entry index. 3695 * Returns: 3696 * BCM_E_XXX 3697 */ 3698 int 3699 _bcm_field_trx_redirect_profile_delete(int unit, int index) 3700 { 3701 soc_profile_mem_t *redirect_profile; 3702 3703 /* Get the redirect profile */ 3704 BCM_IF_ERROR_RETURN 3705 (_field_trx_redirect_profile_get(unit, &redirect_profile)); 3706 3707 BCM_IF_ERROR_RETURN(soc_profile_mem_delete(unit, redirect_profile, index)); 3708 return (BCM_E_NONE); 3709 } 3710 3711 /* 3712 * Function: 3713 * _bcm_field_trx_redirect_profile_alloc 3714 * Purpose: 3715 * Allocate redirect profile index 3716 * Parameters: 3717 * unit - (IN) BCM device number. 3718 * f_ent - (IN) Field entry structure to get policy info from. 3719 * fa - (IN) Field action. 3720 * Returns: 3721 * BCM_E_XXX 3722 */ 3723 int 3724 _bcm_field_trx_redirect_profile_alloc(int unit, _field_entry_t *f_ent, 3725 _field_action_t *fa) 3726 { 3727 ifp_redirection_profile_entry_t entry_arr[2]; 3728 uint32 *entry_ptr[2]; 3729 soc_profile_mem_t *redirect_profile; 3730 int rv; 3731 int i = 0; 3732 #ifdef INCLUDE_L3 3733 bcm_pbmp_t ipmc_l2_pbmp, ipmc_l3_pbmp; 3734 int ipmc_index; 3735 int entry_count; 3736 #endif /* INCLUDE_L3 */ 3737 int mcast_index; 3738 bcm_mcast_addr_t mcaddr; 3739 bcm_pbmp_t pbmp; 3740 void *entries[1]; 3741 soc_mem_t profile_mem = IFP_REDIRECTION_PROFILEm; 3742 3743 entry_ptr[0] = (uint32 *)(&entry_arr[0]); 3744 entry_ptr[1] = (uint32 *)(&entry_arr[1]); 3745 entries[0] = (void *)&entry_arr; 3746 3747 if ((NULL == f_ent) || (NULL == fa)) { 3748 return (BCM_E_PARAM); 3749 } 3750 3751 if (soc_feature(unit, soc_feature_th3_style_fp)) { 3752 profile_mem = IFP_OR_REDIRECTION_PROFILEm; 3753 } 3754 3755 /* Reset redirection profile entry. */ 3756 sal_memset(entry_arr, 0, 2*sizeof(ifp_redirection_profile_entry_t)); 3757 3758 /* Get the redirect profile */ 3759 rv = _field_trx_redirect_profile_get(unit, &redirect_profile); 3760 BCM_IF_ERROR_RETURN(rv); 3761 3762 switch (fa->action) { 3763 case bcmFieldActionRedirectPbmp: 3764 case bcmFieldActionRedirectBcastPbmp: 3765 case bcmFieldActionEgressMask: 3766 case bcmFieldActionEgressPortsAdd: 3767 #if defined (BCM_TOMAHAWK3_SUPPORT) 3768 if ((fa->action == bcmFieldActionEgressMask) && 3769 (soc_feature(unit, soc_feature_th3_style_fp))) { 3770 profile_mem = IFP_AND_REDIRECTION_PROFILEm; 3771 /* Get the redirect profile */ 3772 rv = _bcm_field_th3_redirect_profile_get(unit, &redirect_profile); 3773 BCM_IF_ERROR_RETURN(rv); 3774 } 3775 #endif 3776 SOC_PBMP_CLEAR(pbmp); 3777 for (i = 0; (i < _FP_ACTION_PARAM_SZ) && (i < SOC_PBMP_WORD_MAX); i++) { 3778 SOC_PBMP_WORD_SET(pbmp, i, fa->param[i]); 3779 } 3780 3781 soc_mem_pbmp_field_set(unit, profile_mem, entry_ptr[0], BITMAPf, &pbmp); 3782 rv = soc_profile_mem_add(unit, redirect_profile, entries, 3783 1, (uint32*) &fa->hw_index); 3784 BCM_IF_ERROR_RETURN(rv); 3785 break; 3786 #ifdef INCLUDE_L3 3787 case bcmFieldActionRedirectIpmc: 3788 if (_BCM_MULTICAST_IS_SET(fa->param[0])) { 3789 if ((0 == _BCM_MULTICAST_IS_L3(fa->param[0])) && 3790 (0 == _BCM_MULTICAST_IS_WLAN(fa->param[0]) && 3791 (0 == _BCM_MULTICAST_IS_VLAN(fa->param[0])))) { 3792 #if defined(BCM_GREYHOUND2_SUPPORT) 3793 if (soc_feature(unit, soc_feature_vxlan_lite)) { 3794 if ((0 == _BCM_MULTICAST_IS_VXLAN(fa->param[0]))) { 3795 return (BCM_E_PARAM); 3796 } 3797 } else 3798 #endif /* BCM_GREYHOUND2_SUPPORT */ 3799 { 3800 return (BCM_E_PARAM); 3801 } 3802 } 3803 ipmc_index = _BCM_MULTICAST_ID_GET(fa->param[0]); 3804 } else { 3805 ipmc_index = fa->param[0]; 3806 } 3807 BCM_PBMP_CLEAR(ipmc_l2_pbmp); 3808 BCM_PBMP_CLEAR(ipmc_l3_pbmp); 3809 rv = _bcm_esw_multicast_ipmc_read(unit, ipmc_index, 3810 &ipmc_l2_pbmp, &ipmc_l3_pbmp); 3811 BCM_IF_ERROR_RETURN(rv); 3812 if (SOC_IS_TR_VL(unit)) { 3813 entry_count = 2; 3814 soc_mem_pbmp_field_set(unit, profile_mem, entry_ptr[0], BITMAPf, 3815 &ipmc_l3_pbmp); 3816 soc_mem_pbmp_field_set(unit, profile_mem, entry_ptr[1], BITMAPf, 3817 &ipmc_l2_pbmp); 3818 } else { 3819 entry_count = 1; 3820 soc_mem_pbmp_field_set(unit, profile_mem, entry_ptr[0], L3_BITMAPf, 3821 &ipmc_l3_pbmp); 3822 soc_mem_pbmp_field_set(unit, profile_mem, entry_ptr[0], BITMAPf, 3823 &ipmc_l2_pbmp); 3824 } 3825 soc_mem_field32_set(unit, profile_mem, entry_ptr[0], MC_INDEXf, ipmc_index); 3826 /* MTU profile index overlayed on MC_INDEXf. */ 3827 rv = soc_profile_mem_add(unit, redirect_profile, 3828 entries, entry_count, (uint32*)&fa->hw_index); 3829 BCM_IF_ERROR_RETURN(rv); 3830 break; 3831 #endif /* INCLUDE_L3 */ 3832 case bcmFieldActionRedirectMcast: 3833 rv = _bcm_xgs3_mcast_index_port_get(unit, fa->param[0], &mcaddr); 3834 BCM_IF_ERROR_RETURN(rv); 3835 soc_mem_pbmp_field_set(unit, profile_mem, entry_ptr[0], BITMAPf, 3836 &mcaddr.pbmp); 3837 if (_BCM_MULTICAST_IS_SET(fa->param[0])) { 3838 if (0 == _BCM_MULTICAST_IS_L2(fa->param[0])) { 3839 return (BCM_E_PARAM); 3840 } 3841 mcast_index = _BCM_MULTICAST_ID_GET(fa->param[0]); 3842 } else { 3843 mcast_index = fa->param[0]; 3844 } 3845 soc_mem_field32_set(unit, profile_mem, entry_ptr[0], MC_INDEXf, 3846 mcast_index); 3847 rv = soc_profile_mem_add(unit, redirect_profile, entries, 3848 1, (uint32*)&fa->hw_index); 3849 BCM_IF_ERROR_RETURN(rv); 3850 break; 3851 default: 3852 return (BCM_E_PARAM); 3853 } 3854 return (BCM_E_NONE); 3855 } 3856 3857 /* 3858 * Function: 3859 * _bcm_field_trx_action_redirect 3860 * Purpose: 3861 * Install redirect action in policy table. 3862 * Parameters: 3863 * unit - (IN) BCM device number. 3864 * mem - (IN) Policy table memory. 3865 * f_ent - (IN) Field entry structure to get policy info from. 3866 * fa - (IN) Field action. 3867 * buf - (OUT) Field Policy table entry. 3868 * Returns: 3869 * BCM_E_XXX 3870 */ 3871 STATIC int 3872 _field_trx_action_redirect(int unit, soc_mem_t mem, _field_entry_t *f_ent, 3873 _field_action_t *fa, uint32 *buf) 3874 { 3875 uint32 redir_field = 0; 3876 int shift_val; 3877 soc_field_t redir_field_type = INVALIDf; 3878 3879 if (NULL == f_ent || NULL == fa || NULL == buf) { 3880 return (BCM_E_PARAM); 3881 } 3882 3883 switch (fa->action) { 3884 case bcmFieldActionOffloadRedirect: 3885 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_TD2_TT2(unit) || 3886 SOC_IS_GREYHOUND2(unit)) { 3887 redir_field = ((fa->param[0] & 0xff) << 7); 3888 redir_field |= (fa->param[1] & 0x7f); 3889 } else { 3890 redir_field = ((fa->param[0] & 0x7f) << 6); 3891 redir_field |= (fa->param[1] & 0x3f); 3892 } 3893 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x1); 3894 PolicySet(unit, mem, buf, REDIRECTIONf, redir_field); 3895 3896 PolicySet(unit, mem, buf, HI_PRI_ACTION_CONTROLf, 0x1); 3897 PolicySet(unit, mem, buf, HI_PRI_RESOLVEf, 0x1); 3898 PolicySet(unit, mem, buf, SUPPRESS_COLOR_SENSITIVE_ACTIONSf, 0x1); 3899 PolicySet(unit, mem, buf, DEFER_QOS_MARKINGSf, 0x1); 3900 PolicySet(unit, mem, buf, SUPPRESS_SW_ACTIONSf, 0x1); 3901 if (SOC_MEM_FIELD_VALID(unit, 3902 FP_POLICY_TABLEm, SUPPRESS_VXLTf)) { 3903 PolicySet(unit, mem, buf, SUPPRESS_VXLTf, 0x1); 3904 } else if (SOC_MEM_FIELD_VALID(unit, 3905 FP_POLICY_TABLEm, HI_PRI_SUPPRESS_VXLTf)) { 3906 PolicySet(unit, mem, buf, HI_PRI_SUPPRESS_VXLTf, 0x1); 3907 } 3908 break; 3909 case bcmFieldActionRedirect: /* param0 = modid, param1 = port*/ 3910 redir_field_type = REDIRECTIONf; 3911 #ifdef BCM_TRIUMPH3_SUPPORT 3912 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_TD2_TT2(unit)) { 3913 redir_field_type = REDIRECT_DVPf; 3914 if (BCM_GPORT_IS_MPLS_PORT(fa->param[1])) { 3915 redir_field = BCM_GPORT_MPLS_PORT_ID_GET((int)fa->param[1]); 3916 PolicySet(unit, mem, buf, UNICAST_REDIRECT_CONTROLf, 0x6); 3917 } else if (BCM_GPORT_IS_MIM_PORT(fa->param[1])) { 3918 redir_field = BCM_GPORT_MIM_PORT_ID_GET((int)fa->param[1]); 3919 PolicySet(unit, mem, buf, UNICAST_REDIRECT_CONTROLf, 0x6); 3920 } else if (BCM_GPORT_IS_NIV_PORT(fa->param[1])) { 3921 redir_field = BCM_GPORT_NIV_PORT_ID_GET((int)fa->param[1]); 3922 PolicySet(unit, mem, buf, UNICAST_REDIRECT_CONTROLf, 0x6); 3923 } else if (BCM_GPORT_IS_TRILL_PORT(fa->param[1])) { 3924 redir_field = BCM_GPORT_TRILL_PORT_ID_GET((int)fa->param[1]); 3925 PolicySet(unit, mem, buf, UNICAST_REDIRECT_CONTROLf, 0x6); 3926 } else if (BCM_GPORT_IS_L2GRE_PORT(fa->param[1])) { 3927 redir_field = BCM_GPORT_L2GRE_PORT_ID_GET((int)fa->param[1]); 3928 PolicySet(unit, mem, buf, UNICAST_REDIRECT_CONTROLf, 0x6); 3929 } else if (BCM_GPORT_IS_VXLAN_PORT(fa->param[1])) { 3930 redir_field = BCM_GPORT_VXLAN_PORT_ID_GET((bcm_gport_t)fa->param[1]); 3931 PolicySet(unit, mem, buf, UNICAST_REDIRECT_CONTROLf, 0x6); 3932 } else { 3933 if (SOC_IS_APACHE(unit) && 3934 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 3935 redir_field = ((fa->param[0] & 0xff) << 8); 3936 redir_field |= (fa->param[1] & 0xff); 3937 } else { 3938 redir_field_type = REDIRECTIONf; 3939 redir_field = ((fa->param[0] & 0xff) << 7); 3940 redir_field |= (fa->param[1] & 0x7f); 3941 } 3942 } 3943 } else 3944 #endif 3945 #if defined(BCM_KATANA_SUPPORT) 3946 if (SOC_IS_KATANAX(unit)) { 3947 if (BCM_GPORT_IS_MPLS_PORT(fa->param[1]) || 3948 BCM_GPORT_IS_MIM_PORT(fa->param[1]) || 3949 BCM_GPORT_IS_NIV_PORT(fa->param[1]) || 3950 BCM_GPORT_IS_TRILL_PORT(fa->param[1]) || 3951 BCM_GPORT_IS_L2GRE_PORT(fa->param[1]) || 3952 BCM_GPORT_IS_VXLAN_PORT(fa->param[1])) { 3953 LOG_ERROR(BSL_LS_BCM_FP, 3954 (BSL_META_U(unit, 3955 "FP(unit %d) Error: param1=0x%x " 3956 "is not a valid port.\n"), 3957 unit, fa->param[1])); 3958 return (BCM_E_PARAM); 3959 } else { 3960 redir_field = ((fa->param[0] & 0xff) << 7); 3961 redir_field |= (fa->param[1] & 0x7f); 3962 } 3963 } else 3964 #endif /* BCM_KATANA_SUPPORT */ 3965 #ifdef BCM_TRIDENT_SUPPORT 3966 if (SOC_IS_TD_TT(unit)) { 3967 if (BCM_GPORT_IS_MPLS_PORT(fa->param[1])) { 3968 redir_field = BCM_GPORT_MPLS_PORT_ID_GET( 3969 (int)fa->param[1]); 3970 redir_field |= (3 << 17); 3971 } else if (BCM_GPORT_IS_MIM_PORT(fa->param[1])) { 3972 redir_field = BCM_GPORT_MIM_PORT_ID_GET( 3973 (int)fa->param[1]); 3974 redir_field |= (3 << 17); 3975 } else { 3976 redir_field = ((fa->param[0] & 0xff) << 7); 3977 redir_field |= (fa->param[1] & 0x7f); 3978 } 3979 } else 3980 #endif /* BCM_TRIDENT_SUPPORT */ 3981 { 3982 if (SOC_IS_GREYHOUND2(unit)) { 3983 redir_field = ((fa->param[0] & 0xff) << 7); 3984 redir_field |= (fa->param[1] & 0x7f); 3985 } else { 3986 redir_field = ((fa->param[0] & 0x7f) << 6); 3987 redir_field |= (fa->param[1] & 0x3f); 3988 } 3989 } 3990 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 3991 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit) || SOC_IS_APACHE(unit)) { 3992 PolicySet(unit, mem, buf, REDIRECTION_DESTINATIONf, redir_field); 3993 PolicySet(unit, mem, buf, DROP_ORIGINAL_PACKETf, 0x1); 3994 if (SOC_IS_APACHE(unit)) { 3995 PolicySet(unit, mem, buf, R_REDIRECTf, 0x3); 3996 PolicySet(unit, mem, buf, G_REDIRECTf, 0x3); 3997 PolicySet(unit, mem, buf, Y_REDIRECTf, 0x3); 3998 } 3999 } else { 4000 PolicySet(unit, mem, buf, REDIRECTIONf, redir_field); 4001 } 4002 if (SOC_IS_APACHE(unit)) { 4003 PolicySet(unit, mem, buf, REDIRECTION_DEST_TYPEf, 0x5); 4004 } else { 4005 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x5); 4006 } 4007 } else { 4008 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x1); 4009 PolicySet(unit, mem, buf, redir_field_type, redir_field); 4010 } 4011 break; 4012 case bcmFieldActionRedirectTrunk: /* param0 = trunk ID */ 4013 redir_field_type = REDIRECTIONf; 4014 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_TD_TT(unit) || 4015 SOC_IS_KATANAX(unit) || SOC_IS_GREYHOUND2(unit)) { 4016 shift_val = 9; 4017 } else if (SOC_IS_HURRICANE3(unit)) { 4018 shift_val = 8; 4019 } else if (SOC_IS_TR_VL(unit)) { 4020 shift_val = 7; 4021 } else { 4022 shift_val = 8; 4023 } 4024 redir_field |= (0x40 << shift_val); /* Trunk indicator. */ 4025 redir_field |= fa->param[0]; 4026 4027 #if defined(BCM_TRIDENT2_SUPPORT) && defined(INCLUDE_L3) 4028 if (soc_feature(unit, soc_feature_vp_lag)) { 4029 int tid_is_vp_lag = 0; 4030 int vp = -1; 4031 int vp_id_min = -1; 4032 int rv = BCM_E_NONE; 4033 4034 rv = _bcm_esw_trunk_id_is_vp_lag(unit, fa->param[0], 4035 &tid_is_vp_lag); 4036 BCM_IF_ERROR_RETURN(rv); 4037 4038 if (tid_is_vp_lag) { 4039 4040 rv = _bcm_esw_trunk_tid_to_vp_lag_vp(unit, 4041 fa->param[0], &vp); 4042 BCM_IF_ERROR_RETURN(rv); 4043 4044 if (_bcm_vp_used_get(unit, vp, _bcmVpTypeVpLag)) { 4045 rv =_bcm_esw_trunk_chip_info_vp_resource_get(unit, 4046 &vp_id_min, 4047 NULL, NULL); 4048 BCM_IF_ERROR_RETURN(rv); 4049 redir_field = fa->param[0] - vp_id_min; 4050 PolicySet(unit, mem, buf, UNICAST_REDIRECT_CONTROLf, 0x6); 4051 redir_field_type = REDIRECT_DVPf; 4052 } else { 4053 return BCM_E_PARAM; 4054 } 4055 } 4056 } 4057 #endif 4058 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 4059 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit) || SOC_IS_APACHE(unit)) { 4060 PolicySet(unit, mem, buf, REDIRECTION_DESTINATIONf, redir_field); 4061 PolicySet(unit, mem, buf, DROP_ORIGINAL_PACKETf, 0x1); 4062 if (SOC_IS_APACHE(unit)) { 4063 PolicySet(unit, mem, buf, R_REDIRECTf, 0x3); 4064 PolicySet(unit, mem, buf, G_REDIRECTf, 0x3); 4065 PolicySet(unit, mem, buf, Y_REDIRECTf, 0x3); 4066 } 4067 } else { 4068 PolicySet(unit, mem, buf, REDIRECTIONf, redir_field); 4069 } 4070 if (SOC_IS_APACHE(unit)) { 4071 PolicySet(unit, mem, buf, REDIRECTION_DEST_TYPEf, 0x6); 4072 } else { 4073 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x6); 4074 } 4075 } else { 4076 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x1); 4077 PolicySet(unit, mem, buf, redir_field_type, redir_field); 4078 } 4079 break; 4080 case bcmFieldActionRedirectCancel: 4081 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 2); 4082 break; 4083 case bcmFieldActionRedirectPbmp: 4084 PolicySet(unit, mem, buf, REDIRECTIONf, fa->hw_index); 4085 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x3); 4086 break; 4087 case bcmFieldActionEgressMask: 4088 PolicySet(unit, mem, buf, REDIRECTIONf, fa->hw_index); 4089 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x4); 4090 break; 4091 case bcmFieldActionEgressPortsAdd: 4092 PolicySet(unit, mem, buf, REDIRECTIONf, fa->hw_index); 4093 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x5); 4094 break; 4095 #ifdef INCLUDE_L3 4096 case bcmFieldActionRedirectIpmc: 4097 if (soc_feature(unit, soc_feature_field_action_redirect_ipmc)) { 4098 if (_BCM_MULTICAST_IS_SET(fa->param[0])) { 4099 if ((0 == _BCM_MULTICAST_IS_L3(fa->param[0])) && 4100 (0 == _BCM_MULTICAST_IS_WLAN(fa->param[0])) && 4101 (0 == _BCM_MULTICAST_IS_VLAN(fa->param[0])) && 4102 (0 == _BCM_MULTICAST_IS_VPLS(fa->param[0]))) { 4103 #if defined(BCM_GREYHOUND2_SUPPORT) 4104 if (soc_feature(unit, soc_feature_vxlan_lite)) { 4105 if ((0 == _BCM_MULTICAST_IS_VXLAN(fa->param[0]))) { 4106 return (BCM_E_PARAM); 4107 } 4108 } else 4109 #endif /* BCM_GREYHOUND2_SUPPORT */ 4110 { 4111 return (BCM_E_PARAM); 4112 } 4113 } 4114 redir_field = _BCM_MULTICAST_ID_GET(fa->param[0]); 4115 } else { 4116 redir_field = fa->param[0]; 4117 } 4118 } else { 4119 redir_field = fa->hw_index; 4120 } 4121 /* Assign IPMC action to redirect profile index. */ 4122 if ( SOC_IS_TRIUMPH3(unit) 4123 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 4124 SOC_IS_TITAN2X(unit)) { 4125 shift_val = 16; 4126 } else { 4127 shift_val = SOC_IS_TR_VL(unit) ? ((SOC_IS_TD_TT(unit)) ? 13 : 12) : 13; 4128 } 4129 4130 PolicySet(unit, mem, buf, REDIRECTIONf, 4131 (redir_field | (3 << shift_val))); 4132 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x3); 4133 break; 4134 case bcmFieldActionMacSecRedirectIpmc: 4135 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 4136 if (_BCM_MULTICAST_IS_SET(fa->param[0])) { 4137 if (0 == _BCM_MULTICAST_IS_L3(fa->param[0])) { 4138 return (BCM_E_PARAM); 4139 } 4140 redir_field = _BCM_MULTICAST_ID_GET(fa->param[0]); 4141 } else { 4142 redir_field = fa->param[0]; 4143 } 4144 /* Assign IPMC action to redirect profile index. */ 4145 shift_val = 16; 4146 4147 PolicySet(unit, mem, buf, REDIRECTIONf, (redir_field | (3 << shift_val))); 4148 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x6); 4149 break; 4150 #endif /* BCM_MONTEREY_SUPPORT & INCLUDE_XFLOW_MACSEC */ 4151 #endif /* INCLUDE_L3 */ 4152 case bcmFieldActionRedirectMcast: 4153 if (soc_feature(unit, soc_feature_field_action_redirect_ipmc)) { 4154 if (_BCM_MULTICAST_IS_SET(fa->param[0])) { 4155 if (0 == _BCM_MULTICAST_IS_L2(fa->param[0])) { 4156 return (BCM_E_PARAM); 4157 } 4158 redir_field = _BCM_MULTICAST_ID_GET(fa->param[0]); 4159 } else { 4160 redir_field = fa->param[0]; 4161 } 4162 } else { 4163 redir_field = fa->hw_index; 4164 } 4165 4166 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 4167 PolicySet(unit, mem, buf, 4168 ((SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit) || SOC_IS_APACHE(unit)) ? REDIRECTION_DESTINATIONf : 4169 REDIRECTIONf), redir_field); 4170 if (SOC_IS_APACHE(unit)) { 4171 PolicySet(unit, mem, buf, R_REDIRECTf, 0x3); 4172 PolicySet(unit, mem, buf, G_REDIRECTf, 0x3); 4173 PolicySet(unit, mem, buf, Y_REDIRECTf, 0x3); 4174 PolicySet(unit, mem, buf, REDIRECTION_DEST_TYPEf, 0x7); 4175 } else { 4176 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x7); 4177 } 4178 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit)) { 4179 PolicySet(unit, mem, buf, DROP_ORIGINAL_PACKETf, 0x1); 4180 } 4181 } else { 4182 /* Assign MCAST action to redirect profile index. */ 4183 if (SOC_IS_TRIUMPH3(unit) 4184 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 4185 SOC_IS_TITAN2X(unit)) { 4186 shift_val = 16; 4187 } else { 4188 shift_val = SOC_IS_TR_VL(unit) ? ((SOC_IS_TD_TT(unit)) ? 13 : 12) : 13; 4189 } 4190 PolicySet(unit, mem, buf, REDIRECTIONf, 4191 (redir_field | (2 << shift_val))); 4192 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x3); 4193 } 4194 break; 4195 case bcmFieldActionRedirectVlan: 4196 if (SOC_IS_TRIUMPH3(unit) 4197 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 4198 SOC_IS_TITAN2X(unit)) { 4199 shift_val = 16; 4200 } else { 4201 shift_val = SOC_IS_TD_TT(unit) ? 13 : 12; 4202 } 4203 PolicySet(unit, mem, buf, REDIRECTIONf, (1 << shift_val)); 4204 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x3); 4205 break; 4206 case bcmFieldActionRedirectBcastPbmp: 4207 if (SOC_IS_TRIUMPH3(unit) 4208 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 4209 SOC_IS_TITAN2X(unit)) { 4210 shift_val = 16; 4211 } else { 4212 shift_val = SOC_IS_TD_TT(unit) ? 13 : 12; 4213 } 4214 redir_field = fa->hw_index; 4215 PolicySet(unit, mem, buf, REDIRECTIONf, 4216 (redir_field | (1 << 11) | (1 << shift_val))); 4217 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x3); 4218 break; 4219 #ifdef BCM_TRIUMPH3_SUPPORT 4220 case bcmFieldActionUnmodifiedPacketRedirectPort: 4221 if (BCM_GPORT_IS_MODPORT(fa->param[0])) { 4222 redir_field = ((BCM_GPORT_MODPORT_MODID_GET(fa->param[0]) & 0xff) 4223 << 7); 4224 redir_field |= (BCM_GPORT_MODPORT_PORT_GET(fa->param[0]) & 0x7f); 4225 redir_field |= (1 << 18); 4226 } else if (BCM_GPORT_IS_TRUNK(fa->param[0])) { 4227 redir_field = 0x1 << 15; 4228 redir_field |= BCM_GPORT_TRUNK_GET(fa->param[0]); 4229 redir_field |= (1 << 18); 4230 } 4231 4232 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x1); 4233 PolicySet(unit, mem, buf, REDIRECTIONf, redir_field); 4234 break; 4235 #endif /* BCM_TRIUMPH3_SUPPORT */ 4236 default: 4237 return (BCM_E_PARAM); 4238 } 4239 return (BCM_E_NONE); 4240 } 4241 4242 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 4243 defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 4244 /* 4245 * Function: 4246 * _field_action_unicast_cosq_get 4247 * Purpose: 4248 * Get l2 UC cos queue offset and classifier id shift bits 4249 * Parameters: 4250 * unit - (IN) BCM device number. 4251 * fa - (IN) Field action. 4252 * class_id - (OUT) bits need to be shifted to program classifer id 4253 * cosq_new - (OUT) Field Policy table entry. 4254 * Returns: 4255 * BCM_E_XXX 4256 */ 4257 static int 4258 _field_action_unicast_cosq_get(int unit, _field_action_t *fa, int *class_id, int *cosq_new) 4259 { 4260 4261 bcm_port_t local_port = -1; 4262 int local_port_base_queue = BCM_COS_INVALID; 4263 4264 /* Parameter check. Don't allow NULL pointers */ 4265 if ((NULL == fa) || (NULL == class_id) || (NULL == cosq_new)) { 4266 return BCM_E_PARAM; 4267 } 4268 4269 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[1])) { 4270 #if defined(BCM_TRIUMPH3_SUPPORT) 4271 if (SOC_IS_TRIUMPH3(unit)) { 4272 BCM_IF_ERROR_RETURN 4273 (_bcm_tr3_cosq_index_resolve(unit, fa->param[1], 0, 4274 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 4275 NULL, cosq_new, NULL)); 4276 BCM_IF_ERROR_RETURN 4277 (_bcm_tr3_cosq_localport_resolve(unit, fa->param[1], &local_port)); 4278 BCM_IF_ERROR_RETURN 4279 (_bcm_tr3_cosq_index_resolve(unit, local_port, 0, 4280 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 4281 NULL, &local_port_base_queue, NULL)); 4282 /* 1 Bit is reserved for classfier which will be further ORed with ifp_cos_map */ 4283 *class_id = 9; 4284 } else 4285 #endif 4286 #if defined(BCM_KATANA2_SUPPORT) 4287 if (SOC_IS_KATANA2(unit)) { 4288 BCM_IF_ERROR_RETURN 4289 (_bcm_kt2_cosq_index_resolve(unit, fa->param[1], 0, 4290 _BCM_KT2_COSQ_INDEX_STYLE_UCAST_QUEUE, 4291 NULL, cosq_new, NULL)); 4292 BCM_IF_ERROR_RETURN 4293 (_bcm_kt2_cosq_localport_resolve(unit, fa->param[1], &local_port)); 4294 BCM_IF_ERROR_RETURN 4295 (_bcm_kt2_cosq_index_resolve(unit, local_port, 0, 4296 _BCM_KT2_COSQ_INDEX_STYLE_UCAST_QUEUE, 4297 NULL, &local_port_base_queue, NULL)); 4298 /* 4299 * 2 Bits are reserved for classfier in KATANA2 and 4300 * 1 Bit is reserved for classfier in Saber2 and Metrolite 4301 * which will be further ORed with ifp_cos_map 4302 */ 4303 4304 *class_id = (SOC_IS_SABER2(unit) ? 10: 12); 4305 } else 4306 #endif 4307 #if defined(BCM_APACHE_SUPPORT) 4308 if (SOC_IS_APACHE(unit)) { 4309 BCM_IF_ERROR_RETURN 4310 (_bcm_ap_cosq_index_resolve(unit, fa->param[1], 0, 4311 _BCM_AP_COSQ_INDEX_STYLE_UCAST_QUEUE, 4312 NULL, cosq_new, NULL)); 4313 BCM_IF_ERROR_RETURN 4314 (_bcm_ap_cosq_localport_resolve(unit, fa->param[1], &local_port)); 4315 BCM_IF_ERROR_RETURN 4316 (_bcm_ap_cosq_index_resolve(unit, local_port, 0, 4317 _BCM_AP_COSQ_INDEX_STYLE_UCAST_QUEUE, 4318 NULL, &local_port_base_queue, NULL)); 4319 /* 2 Bits are reserved for classfier which will be further ORed with ifp_cos_map */ 4320 *class_id = 12; 4321 } else 4322 #endif 4323 #if defined(BCM_TRIDENT2_SUPPORT) 4324 if (SOC_IS_TD2_TT2(unit)) { 4325 BCM_IF_ERROR_RETURN 4326 (_bcm_td2_cosq_index_resolve(unit, fa->param[1], 0, 4327 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, 4328 NULL, cosq_new, NULL)); 4329 BCM_IF_ERROR_RETURN 4330 (_bcm_td2_cosq_localport_resolve(unit, fa->param[1], &local_port)); 4331 BCM_IF_ERROR_RETURN 4332 (_bcm_td2_cosq_index_resolve(unit, local_port, 0, 4333 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, 4334 NULL, &local_port_base_queue, NULL)); 4335 /* 2 Bits are reserved for classfier which will be further ORed with ifp_cos_map */ 4336 *class_id = 12; 4337 } else 4338 #endif 4339 { 4340 return BCM_E_UNAVAIL; 4341 } 4342 *cosq_new = (*cosq_new - local_port_base_queue); 4343 } else if (BCM_GPORT_IS_SET (fa->param[1])){ 4344 return BCM_E_PARAM; 4345 } else { 4346 *cosq_new = fa->param[1]; 4347 *class_id = SOC_IS_TRIUMPH3(unit) ? 9 : (SOC_IS_SABER2(unit) ? 10 : 12); 4348 } 4349 return BCM_E_NONE; 4350 } 4351 #endif 4352 4353 /* 4354 * Function: 4355 * _bcm_field_trx_action_params_check 4356 * Purpose: 4357 * Check field action parameters. 4358 * Parameters: 4359 * unit - BCM device number 4360 * f_ent - Field entry structure. 4361 * fa - field action 4362 * Returns: 4363 * BCM_E_XXX 4364 */ 4365 int 4366 _bcm_field_trx_action_params_check(int unit,_field_entry_t *f_ent, 4367 _field_action_t *fa) 4368 { 4369 uint32 redir_field = 0; 4370 int shift_val; 4371 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 4372 int subport_num = 0; 4373 #endif 4374 soc_field_t fld; /* Policy table field info */ 4375 soc_field_t redirect_field_type = INVALIDf; 4376 #if defined(INCLUDE_L3) 4377 _field_action_t *fa_iter; /* Field entry actions iterator.*/ 4378 uint32 flags; /* L3 forwarding flags. */ 4379 int nh_ecmp_id; /* Next hop/Ecmp group id. */ 4380 int svp = -1; 4381 int vfi = 0; 4382 #endif /* INCLUDE_L3 */ 4383 soc_mem_t mem; /* Policy table memory id. */ 4384 soc_mem_t tcam_mem; /* Tcam memory id. */ 4385 int rv; /* Operation return value. */ 4386 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT_SUPPORT) || \ 4387 defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT) 4388 int cosq_new = 0; 4389 #endif 4390 #if defined(BCM_KATANA_SUPPORT) 4391 int temp_param; 4392 #endif 4393 #if defined(BCM_KATANA2_SUPPORT) || defined (BCM_TRIDENT2_SUPPORT) || \ 4394 defined(BCM_GREYHOUND2_SUPPORT) 4395 int hw_index = 0; 4396 #endif 4397 #if defined(BCM_MONTEREY_SUPPORT) 4398 int roe_type = 0; 4399 #endif 4400 #ifdef BCM_HURRICANE3_SUPPORT 4401 int index_array[2] = {0}; 4402 #endif 4403 4404 if (NULL == f_ent || NULL == fa) { 4405 return (BCM_E_PARAM); 4406 } 4407 4408 /* Resolve policy memory id. */ 4409 #if defined(BCM_TRIUMPH_SUPPORT) 4410 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXTERNAL) { 4411 #ifdef BCM_TRIUMPH3_SUPPORT 4412 if (SOC_IS_TRIUMPH3(unit)) { 4413 rv = _bcm_field_tr3_external_policy_mem_get(unit, fa, &mem); 4414 } else 4415 #endif 4416 { 4417 rv = _bcm_field_tr_external_policy_mem_get(unit, fa, &mem); 4418 } 4419 BCM_IF_ERROR_RETURN(rv); 4420 } else 4421 #endif /* BCM_TRIUMPH_SUPPORT */ 4422 { 4423 rv = _field_fb_tcam_policy_mem_get(unit, f_ent->group->stage_id, 4424 &tcam_mem, &mem); 4425 BCM_IF_ERROR_RETURN(rv); 4426 } 4427 4428 switch (fa->action) { 4429 case bcmFieldActionMultipathHash: 4430 PolicyCheck(unit, mem, ECMP_HASH_SELf, fa->param[0]); 4431 /* make sure bcmFieldActionMultipathHash is not set as 4432 * it conflicts with bcmFieldActionL3Switch if flag 4433 * BCM_L3_MULTIPATH is not set 4434 */ 4435 #ifdef INCLUDE_L3 4436 fa_iter = f_ent->actions; 4437 while (fa_iter != NULL) { 4438 if ( (fa_iter->flags & _FP_ACTION_VALID) && 4439 ((fa_iter->action == bcmFieldActionL3Switch) || 4440 (fa_iter->action == bcmFieldActionL3ChangeVlan) || 4441 (fa_iter->action == bcmFieldActionL3ChangeMacDa))) { 4442 rv = _bcm_field_policy_set_l3_nh_resolve(unit, 4443 fa_iter->param[0], 4444 &flags, &nh_ecmp_id); 4445 BCM_IF_ERROR_RETURN(rv); 4446 if (!(flags & BCM_L3_MULTIPATH)) { 4447 LOG_ERROR(BSL_LS_BCM_FP,(BSL_META_U(unit, 4448 "bcmFieldActionMultipathHash conflicts with the" 4449 "parameter passed to bcmFieldActionL3Switch or " 4450 "bcmFieldActionL3ChangeVlan or " 4451 "bcmFieldActionL3ChangeMacDa due to overlays.\n"))); 4452 return (BCM_E_PARAM); 4453 } 4454 } 4455 fa_iter = fa_iter->next; 4456 } 4457 #endif 4458 break; 4459 case bcmFieldActionCopyToCpu: 4460 case bcmFieldActionRpCopyToCpu: 4461 case bcmFieldActionYpCopyToCpu: 4462 case bcmFieldActionGpCopyToCpu: 4463 case bcmFieldActionTimeStampToCpu: 4464 case bcmFieldActionRpTimeStampToCpu: 4465 case bcmFieldActionYpTimeStampToCpu: 4466 case bcmFieldActionGpTimeStampToCpu: 4467 if (fa->param[0] != 0) { 4468 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4469 PolicyCheck(unit, mem, VFP_MATCHED_RULEf, fa->param[1]); 4470 } else { 4471 PolicyCheck(unit, mem, MATCHED_RULEf, fa->param[1]); 4472 } 4473 } 4474 break; 4475 case bcmFieldActionClassDestSet: 4476 PolicyCheck(unit, mem, VFP_CLASS_ID_Lf, fa->param[0]); 4477 break; 4478 4479 case bcmFieldActionClassSourceSet: 4480 PolicyCheck(unit, mem, VFP_CLASS_ID_Hf, fa->param[0]); 4481 break; 4482 4483 case bcmFieldActionVrfSet: 4484 if (fa->param[0] > SOC_VRF_MAX(unit)) { 4485 return BCM_E_PARAM; 4486 } 4487 PolicyCheck(unit, mem, VFP_VRF_IDf, fa->param[0]); 4488 break; 4489 4490 case bcmFieldActionDropPrecedence: 4491 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4492 PolicyCheck(unit, mem, NEW_CNGf, fa->param[0]); 4493 } else { 4494 PolicyCheck(unit, mem, R_DROP_PRECEDENCEf, fa->param[0]); 4495 PolicyCheck(unit, mem, Y_DROP_PRECEDENCEf, fa->param[0]); 4496 PolicyCheck(unit, mem, G_DROP_PRECEDENCEf, fa->param[0]); 4497 } 4498 break; 4499 case bcmFieldActionPrioPktNew: 4500 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4501 fld = (soc_mem_field_valid(unit, mem, NEW_OUTER_DOT1Pf) 4502 ? NEW_OUTER_DOT1Pf : NEW_PKT_PRIORITYf); 4503 4504 PolicyCheck(unit, mem, fld, fa->param[0]); 4505 } else { 4506 PolicyCheck(unit, mem, R_NEW_PKT_PRIf, fa->param[0]); 4507 PolicyCheck(unit, mem, Y_NEW_PKT_PRIf, fa->param[0]); 4508 PolicyCheck(unit, mem, G_NEW_PKT_PRIf, fa->param[0]); 4509 } 4510 break; 4511 case bcmFieldActionEcnNew: 4512 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 4513 || (soc_feature(unit, soc_feature_field_multi_pipe_support)) || 4514 ((SOC_IS_GREYHOUND(unit) || SOC_IS_HURRICANE3(unit) || 4515 SOC_IS_GREYHOUND2(unit)) && 4516 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS))) { 4517 if (soc_mem_field_valid(unit, mem, R_NEW_ECNf)) { 4518 PolicyCheck(unit, mem, R_NEW_ECNf, fa->param[0]); 4519 } 4520 if (soc_mem_field_valid(unit, mem, Y_NEW_ECNf)) { 4521 PolicyCheck(unit, mem, Y_NEW_ECNf, fa->param[0]); 4522 } 4523 PolicyCheck(unit, mem, G_NEW_ECNf, fa->param[0]); 4524 } else { 4525 PolicyCheck(unit, mem, R_CHANGE_ECNf, fa->param[0]); 4526 PolicyCheck(unit, mem, Y_CHANGE_ECNf, fa->param[0]); 4527 PolicyCheck(unit, mem, G_CHANGE_ECNf, fa->param[0]); 4528 } 4529 break; 4530 4531 case bcmFieldActionDscpNew: 4532 if (soc_mem_field_valid(unit, mem, R_NEW_DSCPf)) { 4533 PolicyCheck(unit, mem, R_NEW_DSCPf, fa->param[0]); 4534 } 4535 if (soc_mem_field_valid(unit, mem, Y_NEW_DSCPf)) { 4536 PolicyCheck(unit, mem, Y_NEW_DSCPf, fa->param[0]); 4537 } 4538 4539 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 4540 PolicyCheck(unit, mem, G_NEW_DSCPf, fa->param[0]); 4541 } else { 4542 PolicyCheck(unit, mem, G_NEW_DSCP_TOSf, fa->param[0]); 4543 } 4544 break; 4545 4546 case bcmFieldActionCosQNew: 4547 case bcmFieldActionUcastCosQNew: 4548 #if defined(BCM_TRIDENT2_SUPPORT) 4549 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) && 4550 SOC_IS_TD2_TT2(unit)) { 4551 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0, 4552 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 4553 &cosq_new, NULL); 4554 BCM_IF_ERROR_RETURN(rv); 4555 4556 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 4557 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 4558 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 4559 } else 4560 #endif /* BCM_TRIDENT2_SUPPORT */ 4561 #if defined(BCM_TRIDENT_SUPPORT) 4562 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) && 4563 SOC_IS_TD_TT(unit)) { 4564 rv = _bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 4565 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 4566 &cosq_new, NULL); 4567 BCM_IF_ERROR_RETURN(rv); 4568 4569 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 4570 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 4571 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 4572 } else 4573 #endif /* BCM_TRIDENT_SUPPORT */ 4574 #if defined(BCM_KATANA_SUPPORT) 4575 if ((BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) || 4576 BCM_GPORT_IS_UCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0]) || 4577 BCM_GPORT_IS_MCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0])) 4578 && SOC_IS_KATANAX(unit)) { 4579 rv = _bcm_kt_cosq_index_resolve(unit, fa->param[0], 0, 4580 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 4581 &cosq_new, NULL); 4582 BCM_IF_ERROR_RETURN(rv); 4583 4584 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 4585 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 4586 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 4587 } else 4588 #endif /* BCM_KATANA_SUPPORT */ 4589 #if defined(BCM_GREYHOUND2_SUPPORT) 4590 if (SOC_IS_GREYHOUND2(unit)) { 4591 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 4592 rv = bcmi_gh2_cosq_index_resolve(unit, fa->param[0], 4593 &cosq_new); 4594 BCM_IF_ERROR_RETURN(rv); 4595 } else { 4596 cosq_new = fa->param[0]; 4597 } 4598 PolicyCheck(unit, mem, QUEUE_EXTENSION_NUMf, (cosq_new >> 3)); 4599 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new & 0x7); 4600 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new & 0x7); 4601 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new & 0x7); 4602 } else 4603 #endif /* BCM_GREYHOUND2_SUPPORT */ 4604 { 4605 PolicyCheck(unit, mem, R_COS_INT_PRIf, fa->param[0]); 4606 PolicyCheck(unit, mem, Y_COS_INT_PRIf, fa->param[0]); 4607 PolicyCheck(unit, mem, G_COS_INT_PRIf, fa->param[0]); 4608 } 4609 break; 4610 4611 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 4612 case bcmFieldActionMcastCosQNew: 4613 if (SOC_IS_TD_TT(unit) && 4614 BCM_GPORT_IS_MCAST_QUEUE_GROUP(fa->param[0])) { 4615 rv = _bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 4616 _BCM_TD_COSQ_INDEX_STYLE_MCAST_QUEUE, NULL, 4617 &cosq_new, NULL); 4618 BCM_IF_ERROR_RETURN(rv); 4619 PolicyCheck(unit, mem, R_COS_INT_PRIf, (cosq_new << 4)); 4620 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (cosq_new << 4)); 4621 PolicyCheck(unit, mem, G_COS_INT_PRIf, (cosq_new << 4)); 4622 } else { 4623 PolicyCheck(unit, mem, R_COS_INT_PRIf, (fa->param[0] << 4)); 4624 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (fa->param[0] << 4)); 4625 PolicyCheck(unit, mem, G_COS_INT_PRIf, (fa->param[0] << 4)); 4626 } 4627 break; 4628 #endif /* !BCM_TRIDENT_SUPPORT */ 4629 4630 case bcmFieldActionVlanCosQNew: 4631 /* Add 8 to the value since VLAN shaping queues are 8..23 */ 4632 PolicyCheck(unit, mem, R_COS_INT_PRIf, fa->param[0] + 8); 4633 PolicyCheck(unit, mem, Y_COS_INT_PRIf, fa->param[0] + 8); 4634 PolicyCheck(unit, mem, G_COS_INT_PRIf, fa->param[0] + 8); 4635 break; 4636 4637 case bcmFieldActionPrioIntNew: 4638 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4639 PolicyCheck(unit, mem, NEW_INT_PRIORITYf, fa->param[0]); 4640 #if defined BCM_KATANA2_SUPPORT 4641 } else if ((_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) 4642 && SOC_IS_KATANA2(unit)) { 4643 PolicyCheck(unit, mem, R_NEW_REDIR_INT_PRIf, fa->param[0]); 4644 PolicyCheck(unit, mem, Y_NEW_REDIR_INT_PRIf, fa->param[0]); 4645 PolicyCheck(unit, mem, G_NEW_REDIR_INT_PRIf, fa->param[0]); 4646 #endif 4647 } else { 4648 PolicyCheck(unit, mem, R_COS_INT_PRIf, (0xf & fa->param[0])); 4649 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (0xf & fa->param[0])); 4650 PolicyCheck(unit, mem, G_COS_INT_PRIf, (0xf & fa->param[0])); 4651 } 4652 break; 4653 4654 case bcmFieldActionPrioPktAndIntNew: 4655 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4656 #ifdef BCM_TRIDENT_SUPPORT 4657 if (SOC_IS_TD_TT(unit) 4658 || SOC_IS_KATANAX(unit) 4659 || SOC_IS_TRIUMPH3(unit)) { 4660 PolicyCheck(unit, mem, NEW_OUTER_DOT1Pf, fa->param[0]); 4661 } else 4662 #endif /* !BCM_TRIDENT_SUPPORT */ 4663 { 4664 PolicyCheck(unit, mem, NEW_PKT_PRIORITYf, fa->param[0]); 4665 } 4666 PolicyCheck(unit, mem, NEW_INT_PRIORITYf, fa->param[0]); 4667 } else { 4668 PolicyCheck(unit, mem, R_NEW_PKT_PRIf, fa->param[0]); 4669 PolicyCheck(unit, mem, R_COS_INT_PRIf, (0xf & fa->param[0])); 4670 PolicyCheck(unit, mem, Y_NEW_PKT_PRIf, fa->param[0]); 4671 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (0xf & fa->param[0])); 4672 PolicyCheck(unit, mem, G_NEW_PKT_PRIf, fa->param[0]); 4673 PolicyCheck(unit, mem, G_COS_INT_PRIf, (0xf & fa->param[0])); 4674 } 4675 break; 4676 4677 case bcmFieldActionCosQCpuNew: 4678 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4679 PolicyCheck(unit, mem, CPU_COSf, fa->param[0]); 4680 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 4681 PolicyCheck(unit, mem, NEW_CPU_COSf, fa->param[0]); 4682 } else { 4683 PolicyCheck(unit, mem, CPU_COSf, fa->param[0]); 4684 } 4685 break; 4686 4687 case bcmFieldActionOuterVlanPrioNew: 4688 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4689 #ifdef BCM_TRIDENT_SUPPORT 4690 if (SOC_IS_TD_TT(unit) 4691 || SOC_IS_KATANAX(unit) 4692 || SOC_IS_TRIUMPH3(unit)) { 4693 PolicyCheck(unit, mem, NEW_OUTER_DOT1Pf, fa->param[0]); 4694 } 4695 #endif /* !BCM_TRIDENT_SUPPORT */ 4696 } else { 4697 4698 if (soc_mem_field_valid(unit, mem, R_NEW_DOT1Pf)) { 4699 PolicyCheck(unit, mem, R_NEW_DOT1Pf, fa->param[0]); 4700 } 4701 if (soc_mem_field_valid(unit, mem, Y_NEW_DOT1Pf)) { 4702 PolicyCheck(unit, mem, Y_NEW_DOT1Pf, fa->param[0]); 4703 } 4704 PolicyCheck(unit, mem, G_NEW_DOT1Pf, fa->param[0]); 4705 } 4706 break; 4707 4708 case bcmFieldActionInnerVlanPrioNew: 4709 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4710 #ifdef BCM_TRIDENT_SUPPORT 4711 if (SOC_IS_TD_TT(unit) 4712 || SOC_IS_KATANAX(unit) 4713 || SOC_IS_TRIUMPH3(unit)) { 4714 PolicyCheck(unit, mem, NEW_INNER_DOT1Pf, fa->param[0]); 4715 } 4716 #endif /* !BCM_TRIDENT_SUPPORT */ 4717 } else { 4718 PolicyCheck(unit, mem, R_NEW_INNER_PRIf, fa->param[0]); 4719 PolicyCheck(unit, mem, Y_NEW_INNER_PRIf, fa->param[0]); 4720 PolicyCheck(unit, mem, G_NEW_INNER_PRIf, fa->param[0]); 4721 } 4722 break; 4723 4724 case bcmFieldActionOuterVlanCfiNew: 4725 #ifdef BCM_TRIDENT_SUPPORT 4726 if ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || 4727 SOC_IS_TRIUMPH3(unit)) 4728 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4729 PolicyCheck(unit, mem, NEW_OUTER_CFIf, fa->param[0]); 4730 } else 4731 #endif 4732 { 4733 if (soc_mem_field_valid(unit, mem, R_NEW_OUTER_CFIf)) { 4734 PolicyCheck(unit, mem, R_NEW_OUTER_CFIf, fa->param[0]); 4735 } 4736 if (soc_mem_field_valid(unit, mem, Y_NEW_OUTER_CFIf)) { 4737 PolicyCheck(unit, mem, Y_NEW_OUTER_CFIf, fa->param[0]); 4738 } 4739 PolicyCheck(unit, mem, G_NEW_OUTER_CFIf, fa->param[0]); 4740 } 4741 break; 4742 4743 case bcmFieldActionInnerVlanCfiNew: 4744 #ifdef BCM_TRIDENT_SUPPORT 4745 if ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || 4746 SOC_IS_TRIUMPH3(unit)) 4747 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4748 PolicyCheck(unit, mem, NEW_INNER_CFIf, fa->param[0]); 4749 } else 4750 #endif 4751 { 4752 PolicyCheck(unit, mem, R_NEW_INNER_CFIf, fa->param[0]); 4753 PolicyCheck(unit, mem, Y_NEW_INNER_CFIf, fa->param[0]); 4754 PolicyCheck(unit, mem, G_NEW_INNER_CFIf, fa->param[0]); 4755 } 4756 break; 4757 4758 case bcmFieldActionInnerVlanAdd: 4759 PolicyCheck(unit, mem, NEW_INNER_VLANf, fa->param[0]); 4760 break; 4761 4762 case bcmFieldActionOuterVlanAdd: 4763 PolicyCheck(unit, mem, NEW_OUTER_VLANf, fa->param[0]); 4764 break; 4765 4766 case bcmFieldActionOuterVlanLookup: 4767 PolicyCheck(unit, mem, NEW_OUTER_VLANf, fa->param[0]); 4768 break; 4769 4770 case bcmFieldActionInnerVlanNew: 4771 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4772 PolicyCheck(unit, mem, NEW_INNER_VLANf, fa->param[0]); 4773 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 4774 PolicyCheck(unit, mem, PID_NEW_INNER_VIDf, fa->param[0]); 4775 } 4776 break; 4777 4778 case bcmFieldActionOuterVlanNew: 4779 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 4780 PolicyCheck(unit, mem, NEW_OUTER_VLANf, fa->param[0]); 4781 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 4782 PolicyCheck(unit, mem, PID_NEW_OUTER_VIDf, fa->param[0]); 4783 } else { 4784 if (SOC_IS_TRIUMPH2(unit) || SOC_IS_TD_TT(unit) 4785 || SOC_IS_KATANAX(unit) || SOC_IS_APOLLO(unit) 4786 || SOC_IS_ENDURO(unit) || SOC_IS_HURRICANEX(unit) 4787 || SOC_IS_GREYHOUND(unit) || SOC_IS_GREYHOUND2(unit)) { 4788 PolicyCheck(unit, EGR_L3_INTFm, VIDf, fa->param[0]); 4789 } else { 4790 PolicyCheck(unit, EGR_L3_NEXT_HOPm, INTF_NUMf, 4791 fa->param[0]); 4792 } 4793 } 4794 break; 4795 4796 case bcmFieldActionMirrorIngress: 4797 case bcmFieldActionMirrorEgress: 4798 rv = _bcm_field_action_dest_check(unit, fa); 4799 BCM_IF_ERROR_RETURN(rv); 4800 break; 4801 case bcmFieldActionOffloadRedirect: 4802 case bcmFieldActionRedirect: 4803 rv = _bcm_field_action_dest_check(unit, fa); 4804 BCM_IF_ERROR_RETURN(rv); 4805 #ifdef BCM_TRIDENT_SUPPORT 4806 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) { 4807 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 4808 if (BCM_GPORT_IS_MPLS_PORT(fa->param[1]) || 4809 BCM_GPORT_IS_MIM_PORT(fa->param[1]) || 4810 BCM_GPORT_IS_NIV_PORT(fa->param[1]) || 4811 BCM_GPORT_IS_TRILL_PORT(fa->param[1]) || 4812 BCM_GPORT_IS_L2GRE_PORT(fa->param[1]) || 4813 BCM_GPORT_IS_VXLAN_PORT(fa->param[1])) { 4814 LOG_ERROR(BSL_LS_BCM_FP, 4815 (BSL_META_U(unit, 4816 "FP(unit %d) Error: param1=0x%x " 4817 "is not a valid port.\n"), 4818 unit, fa->param[1])); 4819 return (BCM_E_PARAM); 4820 } 4821 #ifdef BCM_APACHE_SUPPORT 4822 if (SOC_IS_APACHE(unit)) { 4823 redir_field = ((fa->param[0] & 0xff) << 8); 4824 redir_field |= (fa->param[1] & 0xff); 4825 } else 4826 #endif 4827 { 4828 redir_field = ((fa->param[0] & 0x7f) << 6); 4829 redir_field |= (fa->param[1] & 0x3f); 4830 } 4831 } else { 4832 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_TD2_TT2(unit)) { 4833 if (BCM_GPORT_IS_MPLS_PORT(fa->param[1])) { 4834 redir_field = BCM_GPORT_MPLS_PORT_ID_GET((int)fa->param[1]); 4835 redir_field |= (6 << 18); 4836 } else if(BCM_GPORT_IS_MIM_PORT(fa->param[1])) { 4837 redir_field = BCM_GPORT_MIM_PORT_ID_GET((int)fa->param[1]); 4838 redir_field |= (6 << 18); 4839 } else if (BCM_GPORT_IS_NIV_PORT(fa->param[1])) { 4840 redir_field = BCM_GPORT_NIV_PORT_ID_GET((int)fa->param[1]); 4841 redir_field |= (6 << 18); 4842 } else if (BCM_GPORT_IS_TRILL_PORT(fa->param[1])) { 4843 redir_field = BCM_GPORT_TRILL_PORT_ID_GET((int)fa->param[1]); 4844 redir_field |= (6 << 18); 4845 } else if (BCM_GPORT_IS_L2GRE_PORT(fa->param[1])) { 4846 redir_field = BCM_GPORT_L2GRE_PORT_ID_GET((int)fa->param[1]); 4847 redir_field |= (6 << 18); 4848 } else if (BCM_GPORT_IS_VXLAN_PORT(fa->param[1])) { 4849 redir_field = BCM_GPORT_VXLAN_PORT_ID_GET((bcm_gport_t)fa->param[1]); 4850 redir_field |= (6 << 18); 4851 } else { 4852 redir_field = ((fa->param[0] & 0xff) << 7); 4853 redir_field |= (fa->param[1] & 0x7f); 4854 } 4855 } else if (SOC_IS_KATANAX(unit)) { 4856 if ( (BCM_GPORT_IS_MPLS_PORT(fa->param[1]) || 4857 BCM_GPORT_IS_MIM_PORT(fa->param[1]) || 4858 BCM_GPORT_IS_NIV_PORT(fa->param[1]) || 4859 BCM_GPORT_IS_TRILL_PORT(fa->param[1]) || 4860 BCM_GPORT_IS_L2GRE_PORT(fa->param[1]) || 4861 BCM_GPORT_IS_VXLAN_PORT(fa->param[1])) ) { 4862 LOG_ERROR(BSL_LS_BCM_FP, 4863 (BSL_META_U(unit, 4864 "FP(unit %d) Error: param1=0x%x " 4865 "is not a valid port.\n"), 4866 unit, fa->param[1])); 4867 return (BCM_E_PARAM); 4868 } else { 4869 redir_field = ((fa->param[0] & 0xff) << 7); 4870 redir_field |= (fa->param[1] & 0x7f); 4871 } 4872 } else if (SOC_IS_TD_TT(unit)) { 4873 if (BCM_GPORT_IS_MPLS_PORT(fa->param[1])) { 4874 redir_field = BCM_GPORT_MPLS_PORT_ID_GET((int)fa->param[1]); 4875 redir_field |= (3 << 17); 4876 } else if (BCM_GPORT_IS_MIM_PORT(fa->param[1])) { 4877 redir_field = BCM_GPORT_MIM_PORT_ID_GET((int)fa->param[1]); 4878 redir_field |= (3 << 17); 4879 } else { 4880 redir_field = ((fa->param[0] & 0xff) << 7); 4881 redir_field |= (fa->param[1] & 0x7f); 4882 } 4883 } 4884 } 4885 } else 4886 #endif /* BCM_TRIDENT_SUPPORT */ 4887 { 4888 redir_field = ((fa->param[0] & 0x7f) << 6); 4889 redir_field |= (fa->param[1] & 0x3f); 4890 } 4891 if ((SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit) || 4892 SOC_IS_APACHE(unit)) && 4893 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 4894 PolicyCheck(unit, mem, REDIRECTION_DESTINATIONf, redir_field); 4895 } 4896 else { 4897 PolicyCheck(unit, mem, REDIRECTIONf, redir_field); 4898 } 4899 break; 4900 case bcmFieldActionRedirectTrunk: /* param0 = trunk ID */ 4901 redirect_field_type = REDIRECTIONf; 4902 if (SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || 4903 SOC_IS_GREYHOUND2(unit)) { 4904 shift_val = 9; 4905 } else if (SOC_IS_HURRICANE3(unit)) { 4906 shift_val = 8; 4907 } else if (SOC_IS_TR_VL(unit)) { 4908 shift_val = 7; 4909 } else { 4910 shift_val = 8; 4911 } 4912 redir_field |= (0x40 << shift_val); /* Trunk indicator. */ 4913 redir_field |= fa->param[0]; 4914 #if defined(BCM_TRIDENT2_SUPPORT) && defined(INCLUDE_L3) 4915 if (soc_feature(unit, soc_feature_vp_lag)) { 4916 int tid_is_vp_lag = 0; 4917 int vp = -1; 4918 int vp_id_min = -1; 4919 4920 rv = _bcm_esw_trunk_id_is_vp_lag(unit, fa->param[0], 4921 &tid_is_vp_lag); 4922 BCM_IF_ERROR_RETURN(rv); 4923 4924 if (tid_is_vp_lag) { 4925 4926 rv = _bcm_esw_trunk_tid_to_vp_lag_vp(unit, 4927 fa->param[0], &vp); 4928 BCM_IF_ERROR_RETURN(rv); 4929 4930 if (_bcm_vp_used_get(unit, vp, _bcmVpTypeVpLag)) { 4931 rv =_bcm_esw_trunk_chip_info_vp_resource_get(unit, 4932 &vp_id_min, 4933 NULL, NULL); 4934 BCM_IF_ERROR_RETURN(rv); 4935 redir_field = fa->param[0] - vp_id_min; 4936 redirect_field_type = REDIRECT_DVPf; 4937 } else { 4938 return BCM_E_PARAM; 4939 } 4940 } 4941 } 4942 #endif 4943 if ((SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit) || 4944 SOC_IS_APACHE(unit)) && 4945 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 4946 PolicyCheck(unit, mem, REDIRECTION_DESTINATIONf, redir_field); 4947 } 4948 else { 4949 PolicyCheck(unit, mem, redirect_field_type, redir_field); 4950 } 4951 break; 4952 #ifdef INCLUDE_L3 4953 case bcmFieldActionRedirectIpmc: 4954 if (soc_feature(unit, soc_feature_field_action_redirect_ipmc)) { 4955 if (_BCM_MULTICAST_IS_SET(fa->param[0])) { 4956 if ((0 == _BCM_MULTICAST_IS_L3(fa->param[0])) && 4957 (0 == _BCM_MULTICAST_IS_WLAN(fa->param[0])) && 4958 (0 == _BCM_MULTICAST_IS_VLAN(fa->param[0])) && 4959 (0 == _BCM_MULTICAST_IS_VPLS(fa->param[0]))) { 4960 #if defined(BCM_GREYHOUND2_SUPPORT) 4961 if (soc_feature(unit, soc_feature_vxlan_lite)) { 4962 if ((0 == _BCM_MULTICAST_IS_VXLAN(fa->param[0]))) { 4963 return (BCM_E_PARAM); 4964 } 4965 } else 4966 #endif /* BCM_GREYHOUND2_SUPPORT */ 4967 { 4968 return (BCM_E_PARAM); 4969 } 4970 } 4971 redir_field = _BCM_MULTICAST_ID_GET(fa->param[0]); 4972 } else { 4973 redir_field = fa->param[0]; 4974 } 4975 } else { 4976 redir_field = 0; 4977 } 4978 /* Assign IPMC action to redirect profile index. */ 4979 if (SOC_IS_TRIUMPH3(unit) 4980 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 4981 SOC_IS_TITAN2X(unit)) { 4982 shift_val = 16; 4983 } else { 4984 shift_val = SOC_IS_TR_VL(unit) ? 4985 ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) ? 13 : 12) : 13; 4986 } 4987 PolicyCheck(unit, mem, REDIRECTIONf, 4988 (redir_field | (3 << shift_val))); 4989 break; 4990 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 4991 case bcmFieldActionMacSecRedirectIpmc: 4992 if (_BCM_MULTICAST_IS_SET(fa->param[0])) { 4993 if (0 == _BCM_MULTICAST_IS_L3(fa->param[0])) { 4994 return (BCM_E_PARAM); 4995 } 4996 redir_field = _BCM_MULTICAST_ID_GET(fa->param[0]); 4997 } else { 4998 redir_field = fa->param[0]; 4999 } 5000 /* Assign IPMC action to redirect profile index. */ 5001 shift_val = 16; 5002 PolicyCheck(unit, mem, REDIRECTIONf, (redir_field | (3 << shift_val))); 5003 break; 5004 #endif /* BCM_MONTEREY_SUPPORT & INCLUDE_XFLOW_MACSEC */ 5005 #endif /* INCLUDE_L3 */ 5006 case bcmFieldActionRedirectMcast: 5007 if (soc_feature(unit, soc_feature_field_action_redirect_ipmc)) { 5008 if (_BCM_MULTICAST_IS_SET(fa->param[0])) { 5009 if (0 == _BCM_MULTICAST_IS_L2(fa->param[0])) { 5010 return (BCM_E_PARAM); 5011 } 5012 redir_field = _BCM_MULTICAST_ID_GET(fa->param[0]); 5013 } else { 5014 redir_field = fa->param[0]; 5015 } 5016 } else { 5017 redir_field = 0; 5018 } 5019 5020 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 5021 PolicyCheck(unit, mem, 5022 ((SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit) || SOC_IS_APACHE(unit)) ? REDIRECTION_DESTINATIONf : 5023 REDIRECTIONf), 5024 redir_field); 5025 } else { 5026 /* Assign MCAST action to redirect profile index. */ 5027 if (SOC_IS_TRIUMPH3(unit) 5028 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 5029 SOC_IS_TITAN2X(unit)) { 5030 shift_val = 16; 5031 } else { 5032 shift_val = SOC_IS_TR_VL(unit) ? 5033 ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) ? 13 : 12) : 13; 5034 } 5035 PolicyCheck(unit, mem, REDIRECTIONf, 5036 (redir_field | (2 << shift_val))); 5037 } 5038 break; 5039 case bcmFieldActionOffloadClassSet: 5040 PolicyCheck(unit, mem, PPD3_CLASS_TAGf, fa->param[0]); 5041 break; 5042 case bcmFieldActionRpDropPrecedence: 5043 PolicyCheck(unit, mem, R_DROP_PRECEDENCEf, fa->param[0]); 5044 break; 5045 case bcmFieldActionRpPrioPktNew: 5046 PolicyCheck(unit, mem, R_NEW_PKT_PRIf, fa->param[0]); 5047 break; 5048 case bcmFieldActionRpEcnNew: 5049 if ((fa->param[0] <= 0) || (fa->param[0] > 3)) { 5050 return (BCM_E_PARAM); 5051 } 5052 break; 5053 case bcmFieldActionRpDscpNew: 5054 PolicyCheck(unit, mem, R_NEW_DSCPf, fa->param[0]); 5055 break; 5056 case bcmFieldActionRpCosQNew: 5057 #if defined(BCM_TRIDENT_SUPPORT) 5058 case bcmFieldActionRpUcastCosQNew: 5059 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) && 5060 SOC_IS_TD_TT(unit)) { 5061 rv = _bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 5062 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 5063 &cosq_new, NULL); 5064 5065 BCM_IF_ERROR_RETURN(rv); 5066 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 5067 } else 5068 #endif /*!BCM_TRIDENT_SUPPORT */ 5069 #if defined(BCM_KATANA_SUPPORT) 5070 if ((BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) || 5071 BCM_GPORT_IS_UCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0]) || 5072 BCM_GPORT_IS_MCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0])) 5073 && SOC_IS_KATANAX(unit)) { 5074 rv = _bcm_kt_cosq_index_resolve(unit, fa->param[0], 0, 5075 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5076 &cosq_new, NULL); 5077 5078 BCM_IF_ERROR_RETURN(rv); 5079 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 5080 } else 5081 #endif /* !BCM_KATANA_SUPPORT*/ 5082 #if defined(BCM_GREYHOUND2_SUPPORT) 5083 if ((BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) 5084 && SOC_IS_GREYHOUND2(unit)) { 5085 rv = bcmi_gh2_cosq_index_resolve(unit, fa->param[0], &cosq_new); 5086 BCM_IF_ERROR_RETURN(rv); 5087 5088 PolicyCheck(unit, mem, QUEUE_EXTENSION_NUMf, (cosq_new >> 3)); 5089 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new & 0x7); 5090 } else 5091 #endif /* BCM_GREYHOUND2_SUPPORT */ 5092 { 5093 PolicyCheck(unit, mem, R_COS_INT_PRIf, fa->param[0]); 5094 } 5095 break; 5096 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 5097 case bcmFieldActionRpMcastCosQNew: 5098 if (SOC_IS_TD_TT(unit) && 5099 BCM_GPORT_IS_MCAST_QUEUE_GROUP(fa->param[0])) { 5100 rv = _bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 5101 _BCM_TD_COSQ_INDEX_STYLE_MCAST_QUEUE, NULL, 5102 &cosq_new, NULL); 5103 BCM_IF_ERROR_RETURN(rv); 5104 PolicyCheck(unit, mem, R_COS_INT_PRIf, (cosq_new << 4)); 5105 } else { 5106 PolicyCheck(unit, mem, R_COS_INT_PRIf, (fa->param[0] << 4)); 5107 } 5108 break; 5109 #endif /* !BCM_TRIDENT_SUPPORT */ 5110 case bcmFieldActionRpVlanCosQNew: 5111 /* Add 8 to the value since VLAN shaping queues are 8..23 */ 5112 PolicyCheck(unit, mem, R_COS_INT_PRIf, fa->param[0] + 8); 5113 break; 5114 case bcmFieldActionRpPrioPktAndIntNew: 5115 PolicyCheck(unit, mem, R_NEW_PKT_PRIf, fa->param[0]); 5116 PolicyCheck(unit, mem, R_COS_INT_PRIf, (0xf & fa->param[0])); 5117 break; 5118 case bcmFieldActionRpOuterVlanPrioNew: 5119 PolicyCheck(unit, mem, R_NEW_DOT1Pf, fa->param[0]); 5120 break; 5121 case bcmFieldActionRpInnerVlanPrioNew: 5122 PolicyCheck(unit, mem, R_NEW_INNER_PRIf, fa->param[0]); 5123 break; 5124 case bcmFieldActionRpOuterVlanCfiNew: 5125 PolicyCheck(unit, mem, R_NEW_OUTER_CFIf, fa->param[0]); 5126 break; 5127 case bcmFieldActionRpInnerVlanCfiNew: 5128 PolicyCheck(unit, mem, R_NEW_INNER_CFIf, fa->param[0]); 5129 break; 5130 case bcmFieldActionRpPrioIntNew: 5131 #if defined BCM_KATANA2_SUPPORT 5132 if ((_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) 5133 && SOC_IS_KATANA2(unit)) { 5134 PolicyCheck(unit, mem, R_NEW_REDIR_INT_PRIf, fa->param[0]); 5135 } else 5136 #endif 5137 { 5138 PolicyCheck(unit, mem, R_COS_INT_PRIf, (0xf & fa->param[0])); 5139 } 5140 break; 5141 case bcmFieldActionYpDropPrecedence: 5142 PolicyCheck(unit, mem, Y_DROP_PRECEDENCEf, fa->param[0]); 5143 break; 5144 case bcmFieldActionYpPrioPktNew: 5145 PolicyCheck(unit, mem, Y_NEW_PKT_PRIf, fa->param[0]); 5146 break; 5147 case bcmFieldActionYpEcnNew: 5148 if ((fa->param[0] <= 0) || (fa->param[0] > 3)) { 5149 return (BCM_E_PARAM); 5150 } 5151 break; 5152 case bcmFieldActionYpDscpNew: 5153 PolicyCheck(unit, mem, Y_NEW_DSCPf, fa->param[0]); 5154 break; 5155 case bcmFieldActionYpCosQNew: 5156 #if defined(BCM_TRIDENT_SUPPORT) 5157 case bcmFieldActionYpUcastCosQNew: 5158 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) && 5159 SOC_IS_TD_TT(unit)) { 5160 rv = _bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 5161 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 5162 &cosq_new, NULL); 5163 5164 BCM_IF_ERROR_RETURN(rv); 5165 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 5166 } else 5167 #endif /*!BCM_TRIDENT_SUPPORT */ 5168 #if defined(BCM_KATANA_SUPPORT) 5169 if ((BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) || 5170 BCM_GPORT_IS_UCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0]) || 5171 BCM_GPORT_IS_MCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0])) 5172 && SOC_IS_KATANAX(unit)) { 5173 rv = _bcm_kt_cosq_index_resolve(unit, fa->param[0], 0, 5174 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5175 &cosq_new, NULL); 5176 5177 BCM_IF_ERROR_RETURN(rv); 5178 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 5179 } else 5180 #endif /* !BCM_KATANA_SUPPORT*/ 5181 #if defined(BCM_GREYHOUND2_SUPPORT) 5182 if ((BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) 5183 && SOC_IS_GREYHOUND2(unit)) { 5184 rv = bcmi_gh2_cosq_index_resolve(unit, fa->param[0], &cosq_new); 5185 BCM_IF_ERROR_RETURN(rv); 5186 5187 PolicyCheck(unit, mem, QUEUE_EXTENSION_NUMf, (cosq_new >> 3)); 5188 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new & 0x7); 5189 } else 5190 #endif /* BCM_GREYHOUND2_SUPPORT */ 5191 { 5192 PolicyCheck(unit, mem, Y_COS_INT_PRIf, fa->param[0]); 5193 } 5194 break; 5195 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 5196 case bcmFieldActionYpMcastCosQNew: 5197 if (SOC_IS_TD_TT(unit) && 5198 BCM_GPORT_IS_MCAST_QUEUE_GROUP(fa->param[0])) { 5199 rv = _bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 5200 _BCM_TD_COSQ_INDEX_STYLE_MCAST_QUEUE, NULL, 5201 &cosq_new, NULL); 5202 BCM_IF_ERROR_RETURN(rv); 5203 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (cosq_new << 4)); 5204 } else 5205 { 5206 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (fa->param[0] << 4)); 5207 } 5208 break; 5209 #endif /* !BCM_TRIDENT_SUPPORT */ 5210 case bcmFieldActionYpVlanCosQNew: 5211 /* Add 8 to the value since VLAN shaping queues are 8..23 */ 5212 PolicyCheck(unit, mem, Y_COS_INT_PRIf, fa->param[0] + 8); 5213 break; 5214 case bcmFieldActionYpPrioPktAndIntNew: 5215 PolicyCheck(unit, mem, Y_NEW_PKT_PRIf, fa->param[0]); 5216 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (0xf & fa->param[0])); 5217 break; 5218 case bcmFieldActionYpOuterVlanPrioNew: 5219 PolicyCheck(unit, mem, Y_NEW_DOT1Pf, fa->param[0]); 5220 break; 5221 case bcmFieldActionYpInnerVlanPrioNew: 5222 PolicyCheck(unit, mem, Y_NEW_INNER_PRIf, fa->param[0]); 5223 break; 5224 case bcmFieldActionYpOuterVlanCfiNew: 5225 PolicyCheck(unit, mem, Y_NEW_OUTER_CFIf, fa->param[0]); 5226 break; 5227 case bcmFieldActionYpInnerVlanCfiNew: 5228 PolicyCheck(unit, mem, Y_NEW_INNER_CFIf, fa->param[0]); 5229 break; 5230 case bcmFieldActionYpPrioIntNew: 5231 #if defined BCM_KATANA2_SUPPORT 5232 if ((_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) 5233 && SOC_IS_KATANA2(unit)) { 5234 PolicyCheck(unit, mem, Y_NEW_REDIR_INT_PRIf, fa->param[0]); 5235 } else 5236 #endif 5237 { 5238 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (0xf & fa->param[0])); 5239 } 5240 break; 5241 case bcmFieldActionGpDropPrecedence: 5242 PolicyCheck(unit, mem, G_DROP_PRECEDENCEf, fa->param[0]); 5243 break; 5244 case bcmFieldActionGpPrioPktNew: 5245 PolicyCheck(unit, mem, G_NEW_PKT_PRIf, fa->param[0]); 5246 break; 5247 case bcmFieldActionGpEcnNew: 5248 if ((fa->param[0] <= 0) || (fa->param[0] > 3)) { 5249 return (BCM_E_PARAM); 5250 } 5251 break; 5252 case bcmFieldActionGpDscpNew: 5253 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 5254 PolicyCheck(unit, mem, G_NEW_DSCPf, fa->param[0]); 5255 } else { 5256 PolicyCheck(unit, mem, G_NEW_DSCP_TOSf, fa->param[0]); 5257 } 5258 break; 5259 case bcmFieldActionGpTosPrecedenceNew: 5260 PolicyCheck(unit, mem, G_NEW_DSCP_TOSf, fa->param[0]); 5261 break; 5262 case bcmFieldActionGpCosQNew: 5263 #if defined(BCM_TRIDENT_SUPPORT) 5264 case bcmFieldActionGpUcastCosQNew: 5265 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) && 5266 SOC_IS_TD_TT(unit)) { 5267 rv = _bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 5268 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 5269 &cosq_new, NULL); 5270 5271 BCM_IF_ERROR_RETURN(rv); 5272 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 5273 } else 5274 #endif /*!BCM_TRIDENT_SUPPORT */ 5275 #if defined(BCM_KATANA_SUPPORT) 5276 if ((BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) || 5277 BCM_GPORT_IS_UCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0]) || 5278 BCM_GPORT_IS_MCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0])) 5279 && SOC_IS_KATANAX(unit)) { 5280 rv = _bcm_kt_cosq_index_resolve(unit, fa->param[0], 0, 5281 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5282 &cosq_new, NULL); 5283 5284 BCM_IF_ERROR_RETURN(rv); 5285 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 5286 } else 5287 #endif /* !BCM_KATANA_SUPPORT*/ 5288 #if defined(BCM_GREYHOUND2_SUPPORT) 5289 if ((BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) 5290 && SOC_IS_GREYHOUND2(unit)) { 5291 rv = bcmi_gh2_cosq_index_resolve(unit, fa->param[0], &cosq_new); 5292 BCM_IF_ERROR_RETURN(rv); 5293 5294 PolicyCheck(unit, mem, QUEUE_EXTENSION_NUMf, (cosq_new >> 3)); 5295 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new & 0x7); 5296 } else 5297 #endif /* BCM_GREYHOUND2_SUPPORT */ 5298 { 5299 PolicyCheck(unit, mem, G_COS_INT_PRIf, fa->param[0]); 5300 } 5301 break; 5302 5303 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 5304 case bcmFieldActionGpMcastCosQNew: 5305 if (SOC_IS_TD_TT(unit) && 5306 BCM_GPORT_IS_MCAST_QUEUE_GROUP(fa->param[0])) { 5307 rv = _bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 5308 _BCM_TD_COSQ_INDEX_STYLE_MCAST_QUEUE, NULL, 5309 &cosq_new, NULL); 5310 BCM_IF_ERROR_RETURN(rv); 5311 PolicyCheck(unit, mem, G_COS_INT_PRIf, (cosq_new << 4)); 5312 } else 5313 { 5314 PolicyCheck(unit, mem, G_COS_INT_PRIf, (fa->param[0] << 4)); 5315 } 5316 break; 5317 #endif /* !BCM_TRIDENT_SUPPORT */ 5318 case bcmFieldActionGpVlanCosQNew: 5319 /* Add 8 to the value since VLAN shaping queues are 8..23 */ 5320 PolicyCheck(unit, mem, G_COS_INT_PRIf, fa->param[0] + 8); 5321 break; 5322 case bcmFieldActionGpPrioPktAndIntNew: 5323 PolicyCheck(unit, mem, G_NEW_PKT_PRIf, fa->param[0]); 5324 PolicyCheck(unit, mem, G_COS_INT_PRIf, (0xf & fa->param[0])); 5325 break; 5326 case bcmFieldActionGpOuterVlanPrioNew: 5327 PolicyCheck(unit, mem, G_NEW_DOT1Pf, fa->param[0]); 5328 break; 5329 case bcmFieldActionGpInnerVlanPrioNew: 5330 PolicyCheck(unit, mem, G_NEW_INNER_PRIf, fa->param[0]); 5331 break; 5332 case bcmFieldActionGpOuterVlanCfiNew: 5333 PolicyCheck(unit, mem, G_NEW_OUTER_CFIf, fa->param[0]); 5334 break; 5335 case bcmFieldActionGpInnerVlanCfiNew: 5336 PolicyCheck(unit, mem, G_NEW_INNER_CFIf, fa->param[0]); 5337 break; 5338 case bcmFieldActionGpPrioIntNew: 5339 #if defined BCM_KATANA2_SUPPORT 5340 if ((_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) 5341 && SOC_IS_KATANA2(unit)) { 5342 PolicyCheck(unit, mem, G_NEW_REDIR_INT_PRIf, fa->param[0]); 5343 } else 5344 #endif 5345 { 5346 PolicyCheck(unit, mem, G_COS_INT_PRIf, (0xf & fa->param[0])); 5347 } 5348 break; 5349 case bcmFieldActionAddClassTag: 5350 /* 5351 * The NEXT_HOP_INDEXf is 14-bits wide in FP_POLICY_TABLEm view. 5352 * But only 13-bits are valid for this action 5353 */ 5354 #ifdef BCM_TRIUMPH_SUPPORT 5355 if (SOC_IS_TR_VL(unit)) { 5356 if (!(fa->param[0] <= ((1 << 13) - 1))) { 5357 return BCM_E_PARAM; 5358 } 5359 } else 5360 #endif /* (BCM_TRIUMPH_SUPPORT) */ 5361 { 5362 PolicyCheck(unit, mem, NEXT_HOP_INDEXf, fa->param[0]); 5363 } 5364 break; 5365 case bcmFieldActionFabricQueue: 5366 #if defined(BCM_KATANA_SUPPORT) 5367 /* For Katana if param1 flags are set then param0 should be 5368 * ucast/ucast_subscriber group cosq gport */ 5369 if (SOC_IS_KATANAX(unit)) { 5370 if ((fa->param[1] & BCM_FABRIC_QUEUE_DEST_OFFSET) || 5371 (fa->param[1] & BCM_FABRIC_QUEUE_CUSTOMER)) { 5372 if (BCM_GPORT_IS_SET(fa->param[0])) { 5373 if(BCM_GPORT_IS_UCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0]) 5374 || BCM_GPORT_IS_MCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0]) 5375 || BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])){ 5376 if (fa->param[1] & BCM_FABRIC_QUEUE_DEST_OFFSET) { 5377 temp_param = fa->param[1] & _BCM_QOS_MAP_MASK; 5378 if (((temp_param >> _BCM_QOS_MAP_TYPE_SHIFT) != 5379 _BCM_QOS_MAP_TYPE_ING_QUEUE_OFFSET_MAP_TABLE) 5380 || ((temp_param & _BCM_QOS_MAP_OFFSET_MASK) > 5381 _BCM_QOS_MAP_ING_QUEUE_OFFSET_MAX)) { 5382 return BCM_E_PARAM; 5383 } 5384 } 5385 } else { 5386 return BCM_E_PARAM; 5387 } 5388 } else { 5389 return BCM_E_PARAM; 5390 } 5391 } else { 5392 /* maintail backward compatibility */ 5393 if ((fa->param[0] & BCM_FABRIC_QUEUE_QOS_BASE) && 5394 (fa->param[0] & BCM_FABRIC_QUEUE_DEST_OFFSET)) { 5395 return (BCM_E_PARAM); 5396 } 5397 5398 if (fa->param[0] & 5399 ~(BCM_FABRIC_QUEUE_CUSTOMER | 5400 BCM_FABRIC_QUEUE_QOS_BASE | 5401 BCM_FABRIC_QUEUE_DEST_OFFSET | 5402 0xffff)) { 5403 return (BCM_E_PARAM); 5404 } 5405 } 5406 } else 5407 #endif 5408 { 5409 if ((fa->param[0] & BCM_FABRIC_QUEUE_QOS_BASE) && 5410 (fa->param[0] & BCM_FABRIC_QUEUE_DEST_OFFSET)) { 5411 return (BCM_E_PARAM); 5412 } 5413 5414 if (fa->param[0] & 5415 ~(BCM_FABRIC_QUEUE_CUSTOMER | 5416 BCM_FABRIC_QUEUE_QOS_BASE | 5417 BCM_FABRIC_QUEUE_DEST_OFFSET | 5418 0xffff)) { 5419 return (BCM_E_PARAM); 5420 } 5421 } 5422 5423 break; 5424 5425 #if defined(BCM_TRIDENT_SUPPORT) 5426 case bcmFieldActionCompressSrcIp6: 5427 case bcmFieldActionCompressDstIp6: 5428 if (SOC_IS_TD_TT(unit) && 5429 (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id)) { 5430 PolicyCheck(unit, mem, IPV6_TO_IPV4_MAP_OFFSET_SETf, 5431 fa->param[0]); 5432 } 5433 break; 5434 #endif /* !BCM_TRIDENT_SUPPORT */ 5435 5436 #ifdef INCLUDE_L3 5437 #if defined(BCM_TRIUMPH_SUPPORT) && defined(BCM_MPLS_SUPPORT) 5438 case bcmFieldActionIncomingMplsPortSet: 5439 if (!BCM_GPORT_IS_MPLS_PORT(fa->param[0])) { 5440 return BCM_E_PARAM; 5441 } 5442 PolicyCheck(unit, mem, SVPf, 5443 BCM_GPORT_MPLS_PORT_ID_GET((bcm_gport_t)fa->param[0])); 5444 #endif 5445 break; 5446 case bcmFieldActionIngressGportSet: 5447 5448 if (BCM_GPORT_IS_MPLS_PORT(fa->param[0]) && 5449 soc_feature(unit, soc_feature_mpls)) { 5450 svp = BCM_GPORT_MPLS_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5451 } else if (BCM_GPORT_IS_MIM_PORT(fa->param[0]) && 5452 soc_feature(unit, soc_feature_mim)) { 5453 svp = BCM_GPORT_MIM_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5454 } else if (BCM_GPORT_IS_L2GRE_PORT(fa->param[0]) && 5455 soc_feature(unit, soc_feature_l2gre)) { 5456 svp = BCM_GPORT_L2GRE_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5457 } else if (BCM_GPORT_IS_WLAN_PORT(fa->param[0]) && 5458 soc_feature(unit, soc_feature_wlan)) { 5459 svp = BCM_GPORT_WLAN_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5460 } else if (BCM_GPORT_IS_TRILL_PORT(fa->param[0]) && 5461 soc_feature(unit, soc_feature_trill)) { 5462 svp = BCM_GPORT_TRILL_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5463 } else if (BCM_GPORT_IS_NIV_PORT(fa->param[0]) && 5464 soc_feature(unit, soc_feature_niv)) { 5465 svp = BCM_GPORT_NIV_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5466 } else if (BCM_GPORT_IS_FLOW_PORT(fa->param[0])) { 5467 svp = BCM_GPORT_FLOW_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5468 } else if (BCM_GPORT_IS_VLAN_PORT(fa->param[0])) { 5469 svp = BCM_GPORT_VLAN_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5470 } else if (BCM_GPORT_IS_VXLAN_PORT(fa->param[0]) && 5471 soc_feature(unit, soc_feature_vxlan)) { 5472 svp = BCM_GPORT_VXLAN_PORT_ID_GET((bcm_gport_t)fa->param[0]); 5473 #if defined(BCM_TRIDENT2_SUPPORT) 5474 if ((SOC_IS_TRIDENT2(unit) || SOC_IS_TITAN2(unit))) { 5475 bcm_vxlan_port_t vxlan_port; 5476 sal_memset (&vxlan_port,0,sizeof(bcm_vxlan_port_t)); 5477 _bcm_td2_vxlan_port_get (unit,BCM_VXLAN_VPN_INVALID,svp,&vxlan_port); 5478 5479 if ((vxlan_port.flags & BCM_VXLAN_PORT_NETWORK)) { 5480 return BCM_E_PARAM; 5481 } 5482 } 5483 #endif 5484 } else { 5485 return BCM_E_PARAM; 5486 } 5487 PolicyCheck(unit, mem, SVPf, svp); 5488 5489 break; 5490 case bcmFieldActionVpnSet: 5491 if (!(soc_feature(unit, soc_feature_vfi_from_vlan_tables) || 5492 soc_feature(unit, soc_feature_vxlan_lite))) { 5493 return BCM_E_UNAVAIL; 5494 } 5495 if (_BCM_VPN_VFI_IS_SET((bcm_vpn_t)fa->param[0])) { 5496 if (fa->param[0] != BCM_VXLAN_VPN_INVALID) { 5497 _BCM_VPN_GET(vfi, _BCM_VPN_TYPE_VFI, 5498 (bcm_vpn_t)fa->param[0]); 5499 } else { 5500 return BCM_E_PARAM; 5501 } 5502 PolicyCheck(unit, mem, VFIf, vfi); 5503 } else { 5504 return BCM_E_PARAM; 5505 } 5506 break; 5507 case bcmFieldActionL3IngressSet: 5508 5509 if (0 == SHR_BITGET(BCM_XGS3_L3_ING_IF_INUSE(unit), fa->param[0])) { 5510 return BCM_E_PARAM; 5511 } 5512 PolicyCheck(unit, mem, L3_IIFf, fa->param[0]); 5513 break; 5514 case bcmFieldActionL3ChangeVlan: 5515 case bcmFieldActionL3ChangeMacDa: 5516 case bcmFieldActionL3Switch: 5517 rv = _bcm_field_policy_set_l3_nh_resolve(unit, fa->param[0], 5518 &flags, &nh_ecmp_id); 5519 BCM_IF_ERROR_RETURN(rv); 5520 if (flags & BCM_L3_MULTIPATH) { 5521 PolicyCheck(unit, mem, ECMP_PTRf, nh_ecmp_id); 5522 } else { 5523 PolicyCheck(unit, mem, NEXT_HOP_INDEXf, nh_ecmp_id); 5524 5525 /* Egress object range sanity. */ 5526 if (!BCM_XGS3_L3_EGRESS_IDX_VALID(unit, fa->param[0]) && 5527 !BCM_XGS3_DVP_EGRESS_IDX_VALID(unit, fa->param[0])) { 5528 return BCM_E_PARAM; 5529 } 5530 /* make sure bcmFieldActionMultipathHash is not set as 5531 * it conflicts with bcmFieldActionL3Switch if flag 5532 * BCM_L3_MULTIPATH is not set 5533 */ 5534 fa_iter = f_ent->actions; 5535 while (fa_iter != NULL) { 5536 if ((fa_iter->flags & _FP_ACTION_VALID) && 5537 (fa_iter->action == bcmFieldActionMultipathHash) ) { 5538 LOG_ERROR(BSL_LS_BCM_FP,(BSL_META_U(unit, 5539 "The parameter passed to bcmFieldActionL3Switch or " 5540 "bcmFieldActionL3ChangeVlan or " 5541 "bcmFieldActionL3ChangeMacDa conflicts with " 5542 "bcmFieldActionMultipathHash due to overlays.\n"))); 5543 return (BCM_E_PARAM); 5544 } 5545 fa_iter = fa_iter->next; 5546 } 5547 } 5548 break; 5549 case bcmFieldActionNatEgressOverride: 5550 if (soc_feature(unit, soc_feature_nat)) { 5551 bcm_l3_nat_egress_t nat_info; 5552 nat_info.nat_id = fa->param[0]; 5553 5554 rv = bcm_esw_l3_nat_egress_get(unit, &nat_info); 5555 if(BCM_FAILURE(rv)){ 5556 return BCM_E_PARAM; 5557 } 5558 } 5559 else { 5560 return BCM_E_UNAVAIL; 5561 } 5562 break; 5563 #endif /* INCLUDE_L3 */ 5564 case bcmFieldActionOamUpMep: 5565 PolicyCheck(unit, mem, OAM_UP_MEPf, fa->param[0]); 5566 break; 5567 case bcmFieldActionOamTx: 5568 PolicyCheck(unit, mem, OAM_TXf, fa->param[0]); 5569 break; 5570 case bcmFieldActionOamLmepMdl: 5571 PolicyCheck(unit, mem, OAM_LMEP_MDLf, fa->param[0]); 5572 break; 5573 case bcmFieldActionOamServicePriMappingPtr: 5574 PolicyCheck(unit, mem, OAM_SERVICE_PRI_MAPPING_PTRf, fa->param[0]); 5575 break; 5576 case bcmFieldActionOamLmBasePtr: 5577 PolicyCheck(unit, mem, OAM_LM_BASE_PTRf, fa->param[0]); 5578 break; 5579 case bcmFieldActionOamDmEnable: 5580 PolicyCheck(unit, mem, OAM_DM_ENf, fa->param[0]); 5581 break; 5582 case bcmFieldActionOamLmEnable: 5583 PolicyCheck(unit, mem, OAM_LM_ENf, fa->param[0]); 5584 break; 5585 #if defined(BCM_TRIUMPH3_SUPPORT) 5586 case bcmFieldActionOamLmDmSampleEnable: 5587 if( (SOC_IS_SABER2(unit)) || (SOC_IS_KATANA2(unit) || SOC_IS_TRIUMPH3(unit)) ) { 5588 PolicyCheck(unit, mem, OAM_ENABLE_LM_DM_SAMPLEf, fa->param[0]); 5589 } else { 5590 return BCM_E_UNAVAIL; 5591 } 5592 break; 5593 #endif 5594 #if defined(BCM_KATANA2_SUPPORT) 5595 case bcmFieldActionOamOlpHeaderAdd: 5596 if (SOC_IS_KATANA2(unit) && (soc_feature(unit, soc_feature_oam))) { 5597 if (_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) { 5598 if (fa->param[0] >= bcmFieldOlpHeaderTypeCount) { 5599 return (BCM_E_PARAM); 5600 } 5601 hw_index = 0; 5602 rv = _bcm_oam_olp_fp_hw_index_get (unit,fa->param[0], 5603 &hw_index); 5604 if (BCM_FAILURE(rv)) { 5605 return BCM_E_PARAM; 5606 } 5607 PolicyCheck(unit, mem, OLP_HDR_ADDf, 1); 5608 PolicyCheck(unit, mem, OLP_HDR_TYPE_COMPRESSEDf, hw_index); 5609 } 5610 } else { 5611 return BCM_E_UNAVAIL; 5612 } 5613 break; 5614 #endif 5615 case bcmFieldActionOamLmepEnable: 5616 PolicyCheck(unit, mem, OAM_LMEP_ENf, fa->param[0]); 5617 break; 5618 case bcmFieldActionOamPbbteLookupEnable: 5619 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 5620 PolicyCheck(unit, mem, OAM_PBBTE_LOOKUP_ENABLEf, fa->param[0]); 5621 } 5622 break; 5623 case bcmFieldActionOamDmTimeFormat: 5624 PolicyCheck(unit, mem, OAM_DM_TYPEf, fa->param[0]); 5625 break; 5626 case bcmFieldActionOamTagStatusCheck: 5627 PolicyCheck(unit, mem, OAM_TAG_STATUS_CHECK_CONTROLf, fa->param[0]); 5628 break; 5629 case bcmFieldActionServicePoolIdNew: 5630 if (0 != (fa->param[0] >> 2)) { 5631 return BCM_E_PARAM; 5632 } 5633 break; 5634 case bcmFieldActionServicePoolIdPrecedenceNew: 5635 if (0 != ((fa->param[0] >> 2) | (fa->param[1] >> 2) | (!fa->param[1]))) { 5636 return BCM_E_PARAM; 5637 } 5638 break; 5639 #if defined(BCM_SABER2_SUPPORT) 5640 case bcmFieldActionOamLmCounterPoolId: 5641 /* 5642 * Only 0,1 and 2 OAM LM counter Pool IDs are valid. 5643 */ 5644 if ((fa->param[0] >> 2) || (0x3 == fa->param[0])) { 5645 return BCM_E_PARAM; 5646 } 5647 break; 5648 #endif 5649 case bcmFieldActionRedirectEgrNextHop: 5650 #ifdef INCLUDE_L3 5651 { 5652 int ifp_type = 0; 5653 5654 if ((!soc_feature(unit, soc_feature_nh_for_ifp_actions)) && 5655 (fa->param[1] == bcmFieldRedirectTypeAll)) { 5656 return BCM_E_UNAVAIL; 5657 } 5658 5659 /* Get next hop info from Egress Object ID param */ 5660 rv = (_bcm_field_l3_egr_object_ifp_type_index_get(unit, fa->param[0], 5661 &ifp_type, &flags, &nh_ecmp_id)); 5662 5663 if (!(((fa->param[1] == bcmFieldRedirectTypeAll) && 5664 (ifp_type == TRUE)) || 5665 ((fa->param[1] == bcmFieldRedirectTypeL3) && 5666 (ifp_type == FALSE)))) { 5667 return BCM_E_PARAM; 5668 } 5669 } 5670 5671 if (flags & BCM_L3_MULTIPATH) { 5672 /* Param0 - ECMP next hop */ 5673 if (0 == soc_feature(unit, soc_feature_field_action_redirect_ecmp)) { 5674 return (BCM_E_PARAM); 5675 } 5676 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 5677 PolicyCheck(unit, mem, REDIRECTIONf, (nh_ecmp_id | (0x3 << 18))); 5678 } else { 5679 PolicyCheck(unit, mem, REDIRECTIONf, (nh_ecmp_id | (0x3 << 16))); 5680 } 5681 } else { 5682 /* Param0 - Regular next hop */ 5683 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 5684 PolicyCheck(unit, mem, REDIRECTIONf, (nh_ecmp_id | (0x2 << 18))); 5685 } else if (SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) { 5686 PolicyCheck(unit, mem, REDIRECTIONf, (nh_ecmp_id | (0x2 << 16))); 5687 } else if (SOC_IS_GREYHOUND2(unit)) { 5688 PolicyCheck(unit, mem, REDIRECTIONf, (nh_ecmp_id | (0x1 << 16))); 5689 } else if (SOC_IS_HURRICANE3(unit)) { 5690 PolicyCheck(unit, mem, REDIRECTIONf, (nh_ecmp_id | (0x1 << 15))); 5691 } else { 5692 PolicyCheck(unit, mem, REDIRECTIONf, (nh_ecmp_id | (0x1 << 14))); 5693 } 5694 } 5695 break; 5696 #else 5697 return BCM_E_UNAVAIL; 5698 #endif /* INCLUDE_L3 */ 5699 #if defined(BCM_GREYHOUND_SUPPORT) 5700 case bcmFieldActionPfcClassNew: 5701 if (soc_feature(unit, soc_feature_field_action_pfc_class)) { 5702 PolicyCheck(unit, mem, NEW_INPUT_PRIORITYf, fa->param[0]); 5703 } 5704 break; 5705 case bcmFieldActionRpIntCongestionNotificationNew: 5706 if (soc_feature(unit, soc_feature_ecn_wred)) { 5707 PolicyCheck(unit, mem, R_NEW_INT_CNf, fa->param[0]); 5708 } 5709 break; 5710 case bcmFieldActionYpIntCongestionNotificationNew: 5711 if (soc_feature(unit, soc_feature_ecn_wred)) { 5712 PolicyCheck(unit, mem, Y_NEW_INT_CNf, fa->param[0]); 5713 } 5714 break; 5715 case bcmFieldActionGpIntCongestionNotificationNew: 5716 if (soc_feature(unit, soc_feature_ecn_wred)) { 5717 PolicyCheck(unit, mem, G_NEW_INT_CNf, fa->param[0]); 5718 } 5719 break; 5720 #endif 5721 #if defined(BCM_GREYHOUND_SUPPORT) || defined(BCM_TOMAHAWK_SUPPORT) 5722 case bcmFieldActionRpHGCongestionClassNew: 5723 if (soc_feature(unit, soc_feature_ecn_wred)) { 5724 PolicyCheck(unit, mem, R_HG_CONGESTION_CLASS_NEWf, fa->param[0]); 5725 } 5726 break; 5727 case bcmFieldActionYpHGCongestionClassNew: 5728 if (soc_feature(unit, soc_feature_ecn_wred)) { 5729 PolicyCheck(unit, mem, Y_HG_CONGESTION_CLASS_NEWf, fa->param[0]); 5730 } 5731 break; 5732 case bcmFieldActionGpHGCongestionClassNew: 5733 if (soc_feature(unit, soc_feature_ecn_wred)) { 5734 PolicyCheck(unit, mem, G_HG_CONGESTION_CLASS_NEWf, fa->param[0]); 5735 } 5736 break; 5737 #endif /* BCM_GREYHOUND_SUPPORT (or) BCM_TOMAHAWK_SUPPORT*/ 5738 #ifdef BCM_TRIUMPH3_SUPPORT 5739 case bcmFieldActionUnmodifiedPacketRedirectPort: 5740 if (BCM_GPORT_IS_MODPORT(fa->param[0])) { 5741 PolicyCheck(unit, mem, REDIRECT_MODIDf, 5742 BCM_GPORT_MODPORT_MODID_GET(fa->param[0])); 5743 PolicyCheck(unit, mem, REDIRECT_PORT_NUMf, 5744 BCM_GPORT_MODPORT_PORT_GET(fa->param[0])); 5745 } else if (BCM_GPORT_IS_TRUNK(fa->param[0])) { 5746 redir_field = 0x1 << 15; 5747 redir_field |= BCM_GPORT_TRUNK_GET(fa->param[0]); 5748 PolicyCheck(unit, mem, REDIRECT_DGLPf, redir_field); 5749 } else { 5750 return BCM_E_PARAM; 5751 } 5752 break; 5753 #endif /* BCM_TRIUMPH3_SUPPORT */ 5754 #if defined(BCM_TRX_SUPPORT) 5755 case bcmFieldActionRedirDropPrecedence: 5756 if ((SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, R_REDIR_DROP_PRECEDENCEf) 5757 || SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, Y_REDIR_DROP_PRECEDENCEf) 5758 || SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, G_REDIR_DROP_PRECEDENCEf)) 5759 && (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 5760 PolicyCheck(unit, mem, R_REDIR_DROP_PRECEDENCEf, fa->param[0]); 5761 PolicyCheck(unit, mem, Y_REDIR_DROP_PRECEDENCEf, fa->param[0]); 5762 PolicyCheck(unit, mem, G_REDIR_DROP_PRECEDENCEf, fa->param[0]); 5763 } else { 5764 return BCM_E_UNAVAIL; 5765 } 5766 break; 5767 case bcmFieldActionRpRedirDropPrecedence: 5768 if (SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, R_REDIR_DROP_PRECEDENCEf) 5769 && (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 5770 PolicyCheck(unit, mem, R_REDIR_DROP_PRECEDENCEf, fa->param[0]); 5771 } else { 5772 return BCM_E_UNAVAIL; 5773 } 5774 break; 5775 case bcmFieldActionYpRedirDropPrecedence: 5776 if (SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, Y_REDIR_DROP_PRECEDENCEf) 5777 && (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 5778 PolicyCheck(unit, mem, Y_REDIR_DROP_PRECEDENCEf, fa->param[0]); 5779 } else { 5780 return BCM_E_UNAVAIL; 5781 } 5782 break; 5783 case bcmFieldActionGpRedirDropPrecedence: 5784 if (SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, G_REDIR_DROP_PRECEDENCEf) 5785 && (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 5786 PolicyCheck(unit, mem, G_REDIR_DROP_PRECEDENCEf, fa->param[0]); 5787 } else { 5788 return BCM_E_UNAVAIL; 5789 } 5790 break; 5791 #endif /* BCM_TRX_SUPPORT */ 5792 #if defined(BCM_KATANA2_SUPPORT) 5793 case bcmFieldActionHiGigClassSelect: 5794 if (fa->param[0] <= BCM_FIELD_HIGIG_CLASS_SELECT_PORT) { 5795 PolicyCheck(unit, mem, HG_CLASSID_SELf, fa->param[0]); 5796 } else { 5797 return BCM_E_PARAM; 5798 } 5799 break; 5800 case bcmFieldActionNewClassId: 5801 PolicyCheck(unit, mem, I2E_CLASSIDf, fa->param[0]); 5802 break; 5803 #endif /* BCM_KATANA2_SUPPORT */ 5804 5805 #if defined BCM_KATANA2_SUPPORT || defined BCM_TRIDENT2_SUPPORT || \ 5806 defined(BCM_GREYHOUND2_SUPPORT) 5807 case bcmFieldActionDscpMapNew: 5808 if (SOC_IS_GREYHOUND2(unit) && 5809 !soc_feature(unit, soc_feature_vxlan_lite_riot)) { 5810 return BCM_E_UNAVAIL; 5811 } 5812 hw_index = 0; 5813 #if defined BCM_TRIUMPH2_SUPPORT 5814 rv = _bcm_tr2_qos_id2idx(unit, fa->param[0], &hw_index); 5815 if (BCM_FAILURE(rv)) { 5816 return BCM_E_PARAM; 5817 } 5818 #endif 5819 PolicyCheck(unit, mem, TRUST_DSCP_PTRf, hw_index); 5820 break; 5821 #endif /* KATANA2 || TRIDENT2 || GREYHOUND2 */ 5822 5823 case bcmFieldActionChangeL2Fields: 5824 #if defined INCLUDE_L3 5825 { 5826 int ifp_type = 0; 5827 uint32 flags; 5828 int nh_ecmp_id = 0; 5829 5830 rv = _bcm_field_l3_egr_object_ifp_type_index_get(unit, 5831 fa->param[0], &ifp_type, &flags, &nh_ecmp_id); 5832 if (ifp_type == TRUE) { 5833 return BCM_E_NONE; 5834 } 5835 return BCM_E_PARAM; 5836 } 5837 #endif /* INCLUDE_L3 */ 5838 return BCM_E_UNAVAIL; 5839 break; 5840 #if defined(BCM_HURRICANE3_SUPPORT) 5841 case bcmFieldActionPfcTx: 5842 PolicyCheck(unit, mem, PFC_STREAM_IDf, fa->param[0]); 5843 PolicyCheck(unit, mem, PFC_TCf, fa->param[1]); 5844 break; 5845 case bcmFieldActionSwitchEncap: 5846 if (soc_feature(unit, soc_feature_miml) || 5847 soc_feature(unit, soc_feature_custom_header)) { 5848 5849 if ((fa->param[0] >> _BCM_SWITCH_ENCAP_SHIFT) == 5850 _BCM_SWITCH_ENCAP_TYPE_MIML) { 5851 rv = _bcm_hr3_switch_encap_id2idx(unit, fa->param[0], 2, index_array); 5852 if (BCM_FAILURE(rv)) { 5853 return BCM_E_PARAM; 5854 } 5855 5856 PolicyCheck(unit, mem, REDIRECTIONf, (index_array[0] | (0x1 << 15))); 5857 PolicyCheck(unit, mem, HEADER_ENCAP_INDEXf, index_array[1]); 5858 } else if ((fa->param[0] >> _BCM_SWITCH_ENCAP_SHIFT) == 5859 _BCM_SWITCH_ENCAP_TYPE_CUSTOM_HEADER) { 5860 rv = _bcm_hr3_switch_encap_id2idx(unit, fa->param[0], 1, index_array); 5861 if (BCM_FAILURE(rv)) { 5862 return BCM_E_PARAM; 5863 } 5864 5865 PolicyCheck(unit, mem, HEADER_ENCAP_INDEXf, index_array[0]); 5866 } else { 5867 return BCM_E_PARAM; 5868 } 5869 } else { 5870 return BCM_E_UNAVAIL; 5871 } 5872 5873 break; 5874 #endif /* BCM_HURRICANE3_SUPPORT */ 5875 5876 #if defined(BCM_GREYHOUND2_SUPPORT) 5877 case bcmFieldActionUseTunnelPayload: 5878 if (soc_feature(unit, soc_feature_vxlan_lite)) { 5879 PolicyCheck(unit, mem, IP_TUNNEL_TERMINATIONf, fa->param[0]); 5880 } else { 5881 return BCM_E_UNAVAIL; 5882 } 5883 break; 5884 #endif /* BCM_GREYHOUND2_SUPPORT */ 5885 5886 #if defined(BCM_KATANA2_SUPPORT) 5887 case bcmFieldActionUcastQueueNew: 5888 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 5889 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5890 &cosq_new, NULL); 5891 5892 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 5893 5894 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 5895 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 5896 break; 5897 5898 case bcmFieldActionRpUcastQueueNew: 5899 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 5900 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5901 &cosq_new, NULL); 5902 5903 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 5904 break; 5905 5906 case bcmFieldActionYpUcastQueueNew: 5907 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 5908 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5909 &cosq_new, NULL); 5910 5911 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 5912 break; 5913 5914 case bcmFieldActionGpUcastQueueNew: 5915 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 5916 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5917 &cosq_new, NULL); 5918 5919 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 5920 break; 5921 5922 case bcmFieldActionIntCosUcastQueueNew: 5923 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 5924 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 5925 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5926 &cosq_new, NULL); 5927 PolicyCheck(unit, mem, R_COS_INT_PRIf, 5928 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 5929 cosq_new)); 5930 5931 PolicyCheck(unit, mem, Y_COS_INT_PRIf, 5932 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 5933 cosq_new)); 5934 PolicyCheck(unit, mem, G_COS_INT_PRIf, 5935 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 5936 cosq_new)); 5937 break; 5938 5939 case bcmFieldActionRpIntCosUcastQueueNew: 5940 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 5941 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 5942 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5943 &cosq_new, NULL); 5944 PolicyCheck(unit, mem, R_COS_INT_PRIf, 5945 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 5946 cosq_new)); 5947 break; 5948 5949 case bcmFieldActionYpIntCosUcastQueueNew: 5950 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 5951 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 5952 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5953 &cosq_new, NULL); 5954 PolicyCheck(unit, mem, Y_COS_INT_PRIf, 5955 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 5956 cosq_new)); 5957 5958 break; 5959 5960 case bcmFieldActionGpIntCosUcastQueueNew: 5961 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 5962 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 5963 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 5964 &cosq_new, NULL); 5965 PolicyCheck(unit, mem, G_COS_INT_PRIf, 5966 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 5967 cosq_new)); 5968 5969 break; 5970 5971 #endif 5972 5973 #if defined(BCM_APACHE_SUPPORT) 5974 case bcmFieldActionRedirectPrioIntNew: 5975 PolicyCheck(unit, mem, R_NEW_REDIR_INT_PRIf, fa->param[0]); 5976 PolicyCheck(unit, mem, Y_NEW_REDIR_INT_PRIf, fa->param[0]); 5977 PolicyCheck(unit, mem, G_NEW_REDIR_INT_PRIf, fa->param[0]); 5978 return BCM_E_NONE; 5979 break; 5980 case bcmFieldActionRpRedirectPrioIntNew: 5981 PolicyCheck(unit, mem, R_NEW_REDIR_INT_PRIf, fa->param[0]); 5982 return BCM_E_NONE; 5983 break; 5984 case bcmFieldActionYpRedirectPrioIntNew: 5985 PolicyCheck(unit, mem, Y_NEW_REDIR_INT_PRIf, fa->param[0]); 5986 return BCM_E_NONE; 5987 break; 5988 case bcmFieldActionGpRedirectPrioIntNew: 5989 PolicyCheck(unit, mem, G_NEW_REDIR_INT_PRIf, fa->param[0]); 5990 return BCM_E_NONE; 5991 break; 5992 #endif /* BCM_APACHE_SUPPORT */ 5993 5994 5995 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 5996 defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 5997 case bcmFieldActionPortPrioIntCosQNew: 5998 case bcmFieldActionRpPortPrioIntCosQNew: 5999 BCM_IF_ERROR_RETURN (_field_action_unicast_cosq_get(unit, fa, &shift_val, &cosq_new)); 6000 if (cosq_new > ((0x1 << ((SOC_IS_KATANA2(unit) || SOC_IS_TD2_TT2(unit)) \ 6001 ? shift_val - 1 : shift_val))-1)) { 6002 return (BCM_E_PARAM); 6003 } 6004 PolicyCheck(unit, mem, R_COS_INT_PRIf, 6005 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | cosq_new)); 6006 break; 6007 case bcmFieldActionYpPortPrioIntCosQNew: 6008 BCM_IF_ERROR_RETURN (_field_action_unicast_cosq_get(unit, fa, &shift_val, &cosq_new)); 6009 if (cosq_new > ((0x1 << ((SOC_IS_KATANA2(unit) || SOC_IS_TD2_TT2(unit)) \ 6010 ? shift_val - 1 : shift_val))-1)) { 6011 return (BCM_E_PARAM); 6012 } 6013 PolicyCheck(unit, mem, Y_COS_INT_PRIf, 6014 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | cosq_new)); 6015 break; 6016 case bcmFieldActionGpPortPrioIntCosQNew: 6017 BCM_IF_ERROR_RETURN (_field_action_unicast_cosq_get(unit, fa, &shift_val, &cosq_new)); 6018 if (cosq_new > ((0x1 << ((SOC_IS_KATANA2(unit) || SOC_IS_TD2_TT2(unit)) \ 6019 ? shift_val - 1 : shift_val))-1)) { 6020 return (BCM_E_PARAM); 6021 } 6022 PolicyCheck(unit, mem, G_COS_INT_PRIf, 6023 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | cosq_new)); 6024 break; 6025 #endif 6026 #if defined(BCM_KATANA2_SUPPORT) 6027 case bcmFieldActionServicePrioIntCosQNew: 6028 case bcmFieldActionRpServicePrioIntCosQNew: 6029 shift_val = SOC_IS_SABER2(unit) ? 10 : 12; 6030 _bcm_kt2_cosq_index_resolve(unit, fa->param[1], 0, 6031 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 6032 &cosq_new, NULL); 6033 PolicyCheck(unit, mem, R_COS_INT_PRIf, 6034 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 0x1 << (shift_val-1) | cosq_new)); 6035 break; 6036 case bcmFieldActionYpServicePrioIntCosQNew: 6037 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 6038 _bcm_kt2_cosq_index_resolve(unit, fa->param[1], 0, 6039 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 6040 &cosq_new, NULL); 6041 PolicyCheck(unit, mem, Y_COS_INT_PRIf, 6042 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 0x1 << (shift_val-1) | cosq_new)); 6043 break; 6044 case bcmFieldActionGpServicePrioIntCosQNew: 6045 _bcm_kt2_cosq_index_resolve(unit, fa->param[1], 0, 6046 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 6047 &cosq_new, NULL); 6048 shift_val = SOC_IS_SABER2(unit) ? 10 : 12; 6049 PolicyCheck(unit, mem, G_COS_INT_PRIf, 6050 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 0x1 << (shift_val-1) | cosq_new)); 6051 break; 6052 #endif 6053 6054 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 6055 case bcmFieldActionMacSecPktTypeSet: 6056 if (fa->param[0] >= bcmFieldMacSecPktTypeCount) { 6057 return BCM_E_PARAM; 6058 } 6059 PolicyCheck(unit, mem, PACKET_TYPEf, fa->param[0]); 6060 break; 6061 case bcmFieldActionMacSecSubPortNumAdd: 6062 subport_num = BCM_XFLOW_MACSEC_SUBPORT_ID_INDEX_GET(fa->param[0]); 6063 if (subport_num < 0) { 6064 return BCM_E_PARAM; 6065 } 6066 PolicyCheck(unit, mem, MACSEC_SUBPORT_NUMf, subport_num); 6067 break; 6068 #endif 6069 #if defined(BCM_TSN_SR_SUPPORT) 6070 case bcmFieldActionSRDuplicateDrop: 6071 if (soc_feature(unit, soc_feature_tsn_sr)) { 6072 if (0 != fa->param[0] || 0 != fa->param[1]) { 6073 return BCM_E_PARAM; 6074 } 6075 } else { 6076 return BCM_E_UNAVAIL; 6077 } 6078 break; 6079 case bcmFieldActionSRDuplicateDropCancel: 6080 if (soc_feature(unit, soc_feature_tsn_sr)) { 6081 if (0 != fa->param[0] || 0 != fa->param[1]) { 6082 return BCM_E_PARAM; 6083 } 6084 } else { 6085 return BCM_E_UNAVAIL; 6086 } 6087 break; 6088 case bcmFieldActionSRNetIdSource: 6089 if (soc_feature(unit, soc_feature_tsn_sr)) { 6090 PolicyCheck(unit, mem, PKT_NET_ID_SOURCEf, fa->param[0]); 6091 } else { 6092 return BCM_E_UNAVAIL; 6093 } 6094 break; 6095 case bcmFieldActionSRCopyToCpu: 6096 if (soc_feature(unit, soc_feature_tsn_sr)) { 6097 if (fa->param[0] != BCM_FIELD_SR_COPYTOCPU_ANY && 6098 fa->param[0] != BCM_FIELD_SR_COPYTOCPU_NON_DUPLICATE) { 6099 return BCM_E_PARAM; 6100 } 6101 PolicyCheck(unit, mem, CPU_OPCODEf, fa->param[1]); 6102 if (fa->param[1] == 0) { 6103 /* User defined CPU Opcode 0 is invalid to chip */ 6104 return BCM_E_PARAM; 6105 } 6106 break; 6107 } else { 6108 return BCM_E_UNAVAIL; 6109 } 6110 case bcmFieldActionSRTagAdd: 6111 case bcmFieldActionSRTagDelete: 6112 if (soc_feature(unit, soc_feature_tsn_sr)) { 6113 if (fa->param[0] > BCM_FIELD_SR_TAG_TYPE_DOT1CB) { 6114 return BCM_E_PARAM; 6115 } 6116 } else { 6117 return BCM_E_UNAVAIL; 6118 } 6119 break; 6120 case bcmFieldActionSRLanIdNew: 6121 if (soc_feature(unit, soc_feature_tsn_sr)) { 6122 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 6123 PolicyCheck(unit, mem, PKT_LAN_IDf, fa->param[0]); 6124 } else { 6125 PolicyCheck(unit, mem, NEW_LAN_IDf, fa->param[0]); 6126 } 6127 } else { 6128 return BCM_E_UNAVAIL; 6129 } 6130 break; 6131 case bcmFieldActionSRNetIdNew: 6132 if (soc_feature(unit, soc_feature_tsn_sr)) { 6133 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 6134 PolicyCheck(unit, mem, PKT_NET_IDf, fa->param[0]); 6135 } else { 6136 PolicyCheck(unit, mem, NEW_NET_IDf, fa->param[0]); 6137 } 6138 } else { 6139 return BCM_E_UNAVAIL; 6140 } 6141 break; 6142 case bcmFieldActionSRFlowIdNew: 6143 if (soc_feature(unit, soc_feature_tsn_sr)) { 6144 uint32 hw_value; 6145 6146 BCM_IF_ERROR_RETURN( 6147 bcmi_esw_tsn_sr_hw_flow_id_get(unit, 6148 (bcm_tsn_sr_flow_t)fa->param[0], 6149 &hw_value)); 6150 PolicyCheck(unit, mem, SR_FLOW_IDf, hw_value); 6151 } else { 6152 return BCM_E_UNAVAIL; 6153 } 6154 break; 6155 case bcmFieldActionSRFlowPriMapIdNew: 6156 if (soc_feature(unit, soc_feature_tsn_sr)) { 6157 uint32 hw_value; 6158 bcm_tsn_pri_map_type_t map_type; 6159 6160 BCM_IF_ERROR_RETURN( 6161 bcmi_esw_tsn_pri_map_hw_index_get(unit, fa->param[0], 6162 &map_type, &hw_value)); 6163 if (bcmTsnPriMapTypeSrFlow != map_type) { 6164 return BCM_E_PARAM; 6165 } 6166 PolicyCheck(unit, mem, SR_PRI_OFFSET_PROFILEf, hw_value); 6167 } else { 6168 return BCM_E_UNAVAIL; 6169 } 6170 break; 6171 #endif /* BCM_TSN_SR_SUPPORT */ 6172 #if defined(BCM_TSN_SUPPORT) 6173 case bcmFieldActionTsnFlowIdNew: 6174 if (soc_feature(unit, soc_feature_tsn)) { 6175 uint32 hw_value; 6176 6177 BCM_IF_ERROR_RETURN( 6178 bcmi_esw_tsn_hw_flow_id_get(unit, 6179 (bcm_tsn_flow_t)fa->param[0], 6180 &hw_value)); 6181 PolicyCheck(unit, mem, TSN_CIRCUIT_IDf, hw_value); 6182 } else { 6183 return BCM_E_UNAVAIL; 6184 } 6185 break; 6186 case bcmFieldActionTsnFlowPriMapIdNew: 6187 if (soc_feature(unit, soc_feature_tsn)) { 6188 uint32 hw_value; 6189 bcm_tsn_pri_map_type_t map_type; 6190 6191 BCM_IF_ERROR_RETURN( 6192 bcmi_esw_tsn_pri_map_hw_index_get(unit, fa->param[0], 6193 &map_type, &hw_value)); 6194 if (bcmTsnPriMapTypeTsnFlow != map_type) { 6195 return BCM_E_PARAM; 6196 } 6197 PolicyCheck(unit, mem, TSN_PRI_OFFSET_PROFILEf, hw_value); 6198 } else { 6199 return BCM_E_UNAVAIL; 6200 } 6201 break; 6202 case bcmFieldActionMtuProfileIdNew: 6203 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 6204 int hw_value; 6205 bcm_tsn_mtu_profile_type_t type; 6206 6207 BCM_IF_ERROR_RETURN( 6208 bcmi_esw_tsn_mtu_hw_profile_id_get(unit, fa->param[0], 6209 &type, &hw_value)); 6210 if (type != bcmTsnMtuProfileTypeIngress) { 6211 return BCM_E_PARAM; 6212 } 6213 PolicyCheck(unit, mem, MTU_PROFILE_INDEXf, hw_value); 6214 } else { 6215 return BCM_E_UNAVAIL; 6216 } 6217 break; 6218 case bcmFieldActionStuProfileIdNew: 6219 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 6220 int hw_value; 6221 bcm_tsn_stu_profile_type_t type; 6222 6223 BCM_IF_ERROR_RETURN( 6224 bcmi_esw_tsn_stu_hw_profile_id_get(unit, fa->param[0], 6225 &type, &hw_value)); 6226 if (type != bcmTsnStuProfileTypeIngress) { 6227 return BCM_E_PARAM; 6228 } 6229 PolicyCheck(unit, mem, STU_PROFILE_INDEXf, hw_value); 6230 } else { 6231 return BCM_E_UNAVAIL; 6232 } 6233 break; 6234 case bcmFieldActionMtuSize: 6235 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 6236 if (0 == fa->param[0] || 0 != fa->param[1]) { 6237 return BCM_E_PARAM; 6238 } 6239 PolicyCheck(unit, mem, MTU_SIZEf, fa->param[0]); 6240 } else { 6241 return BCM_E_UNAVAIL; 6242 } 6243 break; 6244 case bcmFieldActionStuSize: 6245 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 6246 if (0 == fa->param[0] || 0 != fa->param[1]) { 6247 return BCM_E_PARAM; 6248 } 6249 PolicyCheck(unit, mem, STU_SIZEf, fa->param[0]); 6250 } else { 6251 return BCM_E_UNAVAIL; 6252 } 6253 break; 6254 case bcmFieldActionTafGatePriMap: 6255 if (soc_feature(unit, soc_feature_tsn_taf)) { 6256 uint32 hw_value; 6257 bcm_tsn_pri_map_type_t map_type; 6258 6259 BCM_IF_ERROR_RETURN( 6260 bcmi_esw_tsn_pri_map_hw_index_get(unit, fa->param[0], 6261 &map_type, &hw_value)); 6262 if (bcmTsnPriMapTypeTafGate != map_type) { 6263 return BCM_E_PARAM; 6264 } 6265 PolicyCheck(unit, mem, TAF_GATE_ID_PROFILEf, hw_value); 6266 } else { 6267 return BCM_E_UNAVAIL; 6268 } 6269 break; 6270 #endif /* BCM_TSN_SUPPORT */ 6271 #if defined(BCM_MONTEREY_SUPPORT) 6272 case bcmFieldActionRoeFrameTypeSet: 6273 if (fa->param[0] >= bcmFieldRoeFrameTypeCount) { 6274 return BCM_E_PARAM; 6275 } 6276 if (fa->param[0] == bcmFieldRoeFrameTypeNone) { 6277 roe_type = 3; 6278 } else if (fa->param[0] == bcmFieldRoeFrameTypeRoe) { 6279 roe_type = 2; 6280 } else if (fa->param[0] == bcmFieldRoeFrameTypeCustom) { 6281 roe_type = 1; 6282 } 6283 PolicyCheck(unit, mem, ROE_TYPEf, roe_type); 6284 break; 6285 #endif /* BCM_MONTEREY_SUPPORT */ 6286 #if defined(BCM_TOMAHAWK3_SUPPORT) 6287 case bcmFieldActionL3IngressStrengthSet: 6288 if (!((fa->param[0] & BCM_FIELD_L3INGRESS_STRENGTH_HIGH) 6289 || (fa->param[0] & BCM_FIELD_L3INGRESS_STRENGTH_LOW))) { 6290 return (BCM_E_PARAM); 6291 } 6292 break; 6293 #endif 6294 #if defined(BCM_MAVERICK2_SUPPORT) 6295 #if defined(INCLUDE_FLOWTRACKER) 6296 case bcmFieldActionFlowtrackerGroupId: 6297 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 6298 if (soc_feature(unit, soc_feature_mv2_style_flowtracker)) { 6299 PolicyCheck(unit, mem, FLOW_GROUP_IDf, fa->param[0]); 6300 } else { 6301 return BCM_E_UNAVAIL; 6302 } 6303 } 6304 break; 6305 #endif /* INCLUDE_FLOWTRACKER */ 6306 #endif /* BCM_MAVERICK2_SUPPORT */ 6307 default: 6308 return BCM_E_NONE; 6309 } 6310 return (BCM_E_NONE); 6311 } 6312 6313 int 6314 _bcm_field_trx_vlan_format_qualify_is_double_tagged(unsigned data, unsigned mask) 6315 { 6316 if ((mask & (BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED 6317 | BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED_VID_ZERO 6318 ) 6319 ) == 0 6320 || (mask & (BCM_FIELD_VLAN_FORMAT_INNER_TAGGED 6321 | BCM_FIELD_VLAN_FORMAT_INNER_TAGGED_VID_ZERO 6322 ) 6323 ) == 0 6324 || (data & (BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED 6325 | BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED_VID_ZERO 6326 ) 6327 ) == 0 6328 || (data & (BCM_FIELD_VLAN_FORMAT_INNER_TAGGED 6329 | BCM_FIELD_VLAN_FORMAT_INNER_TAGGED_VID_ZERO 6330 ) 6331 ) == 0 6332 ) { 6333 return (FALSE); 6334 } 6335 6336 return (TRUE); 6337 } 6338 6339 /* 6340 * Function: 6341 * _bcm_field_trx_action_depends_check 6342 * Purpose: 6343 * Check field action parameters. 6344 * Parameters: 6345 * unit - BCM device number 6346 * f_ent - Field entry structure. 6347 * fa - field action 6348 * Returns: 6349 * BCM_E_XXX 6350 */ 6351 int 6352 _bcm_field_trx_action_depends_check(int unit, 6353 _field_entry_t *f_ent, 6354 _field_action_t *fa 6355 ) 6356 { 6357 return (BCM_E_NONE); 6358 } 6359 6360 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 6361 /* 6362 * Function: 6363 * _bcm_field_trx_ucast_mcast_action_update 6364 * Purpose: 6365 * Modify Unicast and Multicast queue values 6366 * Parameters: 6367 * unit - (IN) BCM device number. 6368 * mem - (IN) Policy table memory. 6369 * f_ent - (IN) Field entry structure to get policy info from. 6370 * tcam_idx - (IN) Field policy table entry index. 6371 * fa - (IN) Field action. 6372 * buf - (OUT) Field Policy table entry. 6373 * Returns: 6374 * BCM_E_XXX 6375 */ 6376 STATIC 6377 int _bcm_field_trx_ucast_mcast_action_update(int unit, soc_mem_t mem, 6378 _field_entry_t *f_ent, 6379 int tcam_idx, _field_action_t *fa, 6380 uint32 *buf) 6381 { 6382 int ucast_cosq_new = BCM_COS_INVALID; /* Unicast new Queue value */ 6383 int mcast_cosq_new = BCM_COS_INVALID; /* Muliticast new Queue value */ 6384 int ucosq = BCM_COS_INVALID; /* Current unicast queue value */ 6385 int mcosq = BCM_COS_INVALID; /* Current mcast queue value */ 6386 _field_action_t *f_ent_act = NULL; /* Field entry action */ 6387 uint8 mcast_mode_set = 0; /* Multicast action is set */ 6388 uint8 ucast_mode_set = 0; /* Unicast action is set */ 6389 6390 /* Check and return error for invalid cases */ 6391 if (NULL == f_ent || NULL == fa || NULL == buf) { 6392 return (BCM_E_PARAM); 6393 } 6394 6395 if (!(SOC_IS_TD_TT(unit))) { 6396 return BCM_E_UNAVAIL; 6397 } 6398 6399 LOG_DEBUG(BSL_LS_BCM_FP, 6400 (BSL_META_U(unit, 6401 "FP(unit %d) vverb: _bcm_field_trx_ucast_mcast_action_update "), 6402 unit)); 6403 LOG_DEBUG(BSL_LS_BCM_FP, 6404 (BSL_META_U(unit, 6405 "eid=%d, tcam_idx=0x%x\n "), 6406 f_ent->eid, tcam_idx)); 6407 6408 /* Get Queue value for Unicast actions */ 6409 if ((bcmFieldActionCosQNew == fa->action) || 6410 (bcmFieldActionRpCosQNew == fa->action)|| 6411 (bcmFieldActionYpCosQNew == fa->action)|| 6412 (bcmFieldActionGpCosQNew == fa->action)|| 6413 (bcmFieldActionUcastCosQNew == fa->action)|| 6414 (bcmFieldActionRpUcastCosQNew == fa->action) || 6415 (bcmFieldActionYpUcastCosQNew == fa->action) || 6416 (bcmFieldActionGpUcastCosQNew == fa->action)) { 6417 /* 6418 * Check if queue parameter value is of GPORT type. 6419 */ 6420 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 6421 BCM_IF_ERROR_RETURN 6422 (_bcm_td_cosq_index_resolve(unit, fa->param[0], 0, 6423 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 6424 &ucast_cosq_new, NULL)); 6425 } else { 6426 ucast_cosq_new = fa->param[0]; 6427 } 6428 } 6429 6430 /* Get Queue value for Multicast actions */ 6431 if ((bcmFieldActionMcastCosQNew == fa->action) || 6432 (bcmFieldActionRpMcastCosQNew == fa->action) || 6433 (bcmFieldActionYpMcastCosQNew == fa->action) || 6434 (bcmFieldActionGpMcastCosQNew == fa->action)) { 6435 /* 6436 * Check if queue parameter value is of GPORT type. 6437 */ 6438 if (BCM_GPORT_IS_MCAST_QUEUE_GROUP(fa->param[0])) { 6439 BCM_IF_ERROR_RETURN(_bcm_td_cosq_index_resolve(unit, 6440 fa->param[0], 0, _BCM_TD_COSQ_INDEX_STYLE_MCAST_QUEUE, NULL, 6441 &mcast_cosq_new, NULL)); 6442 } else { 6443 mcast_cosq_new = fa->param[0]; 6444 } 6445 } 6446 6447 switch (fa->action) { 6448 case bcmFieldActionCosQNew: 6449 /* Set mode info for all colors */ 6450 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6451 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6452 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6453 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6454 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6455 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6456 /* Set queue info for all colors */ 6457 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6458 (_FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, 6459 ucast_cosq_new))); 6460 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6461 (_FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, 6462 ucast_cosq_new))); 6463 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6464 (_FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, 6465 ucast_cosq_new))); 6466 break; 6467 case bcmFieldActionRpCosQNew: 6468 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6469 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6470 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6471 (_FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, 6472 ucast_cosq_new))); 6473 break; 6474 case bcmFieldActionYpCosQNew: 6475 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6476 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6477 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6478 (_FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, 6479 ucast_cosq_new))); 6480 break; 6481 case bcmFieldActionGpCosQNew: 6482 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6483 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6484 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6485 (_FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, 6486 ucast_cosq_new))); 6487 break; 6488 case bcmFieldActionUcastCosQNew: 6489 /* Check if corresponding multicast action is set for this entry */ 6490 for (f_ent_act = f_ent->actions; fa != NULL; fa = fa->next) { 6491 if (bcmFieldActionMcastCosQNew == f_ent_act->action) { 6492 /* Get current Mcast queue value */ 6493 mcast_mode_set = 1; 6494 if (BCM_GPORT_IS_MCAST_QUEUE_GROUP(f_ent_act->param[0])) { 6495 if (SOC_IS_TD_TT(unit)) { 6496 BCM_IF_ERROR_RETURN(_bcm_td_cosq_index_resolve(unit, 6497 f_ent_act->param[0], 0, 6498 _BCM_TD_COSQ_INDEX_STYLE_MCAST_QUEUE, NULL, 6499 &mcosq, NULL)); 6500 } 6501 } else { 6502 mcosq = f_ent_act->param[0]; 6503 } 6504 } 6505 } 6506 if (0 == mcast_mode_set) { 6507 /* Set Unicast packet queue mode */ 6508 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6509 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6510 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6511 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6512 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6513 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6514 6515 /* Set Unicast packet queue value */ 6516 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6517 _FP_ACTION_UCAST_QUEUE_SET(ucast_cosq_new)); 6518 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6519 _FP_ACTION_UCAST_QUEUE_SET(ucast_cosq_new)); 6520 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6521 _FP_ACTION_UCAST_QUEUE_SET(ucast_cosq_new)); 6522 } else { 6523 /* Set Ucast and Mcast queue modes */ 6524 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6525 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6526 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6527 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6528 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6529 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6530 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6531 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, mcosq)); 6532 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6533 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, mcosq)); 6534 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6535 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, mcosq)); 6536 } 6537 break; 6538 case bcmFieldActionMcastCosQNew: 6539 /* Check if corresponding unicast action is set for this entry */ 6540 for (f_ent_act = f_ent->actions; fa != NULL; fa = fa->next) { 6541 if (bcmFieldActionUcastCosQNew == f_ent_act->action) { 6542 /* Get current Mcast queue value */ 6543 ucast_mode_set = 1; 6544 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(f_ent_act->param[0])) { 6545 if (SOC_IS_TD_TT(unit)) { 6546 BCM_IF_ERROR_RETURN(_bcm_td_cosq_index_resolve(unit, 6547 f_ent_act->param[0], 0, 6548 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 6549 &ucosq, NULL)); 6550 } 6551 } else { 6552 ucosq = f_ent_act->param[0]; 6553 } 6554 } 6555 } 6556 if (0 == ucast_mode_set) { 6557 /* Change Unicast packet queue mode */ 6558 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6559 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 6560 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6561 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 6562 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6563 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 6564 6565 /* Change Unicast packet queue value */ 6566 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6567 _FP_ACTION_MCAST_QUEUE_SET(mcast_cosq_new)); 6568 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6569 _FP_ACTION_MCAST_QUEUE_SET(mcast_cosq_new)); 6570 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6571 _FP_ACTION_MCAST_QUEUE_SET(mcast_cosq_new)); 6572 } else { 6573 /* Set Ucast and Mcast queue modes */ 6574 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6575 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6576 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6577 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6578 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6579 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6580 6581 /* Set Ucast and Mcast queue values */ 6582 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6583 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucosq, mcast_cosq_new)); 6584 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6585 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucosq, mcast_cosq_new)); 6586 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6587 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucosq, mcast_cosq_new)); 6588 } 6589 break; 6590 case bcmFieldActionRpUcastCosQNew: 6591 /* Check if corresponding multicast action is set for this entry */ 6592 for (f_ent_act = f_ent->actions; fa != NULL; fa = fa->next) { 6593 if (bcmFieldActionRpMcastCosQNew == f_ent_act->action) { 6594 /* Get current Mcast queue value */ 6595 mcast_mode_set = 1; 6596 if (BCM_GPORT_IS_MCAST_QUEUE_GROUP(f_ent_act->param[0])) { 6597 if (SOC_IS_TD_TT(unit)) { 6598 BCM_IF_ERROR_RETURN(_bcm_td_cosq_index_resolve(unit, 6599 f_ent_act->param[0], 0, 6600 _BCM_TD_COSQ_INDEX_STYLE_MCAST_QUEUE, NULL, 6601 &mcosq, NULL)); 6602 } 6603 } else { 6604 mcosq = f_ent_act->param[0]; 6605 } 6606 } 6607 } 6608 6609 if (0 == mcast_mode_set) { 6610 /* Set Unicast packet queue mode */ 6611 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6612 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6613 /* Set Unicast packet queue value */ 6614 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6615 _FP_ACTION_UCAST_QUEUE_SET(ucast_cosq_new)); 6616 } else { 6617 /* Set Ucast and Mcast queue modes */ 6618 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6619 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6620 6621 /* Set Ucast and Mcast queue values */ 6622 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6623 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, mcosq)); 6624 } 6625 break; 6626 case bcmFieldActionRpMcastCosQNew: 6627 /* Check if corresponding unicast action is set for this entry */ 6628 for (f_ent_act = f_ent->actions; fa != NULL; fa = fa->next) { 6629 if (bcmFieldActionRpUcastCosQNew == f_ent_act->action) { 6630 /* Get current Mcast queue value */ 6631 ucast_mode_set = 1; 6632 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(f_ent_act->param[0])) { 6633 if (SOC_IS_TD_TT(unit)) { 6634 BCM_IF_ERROR_RETURN(_bcm_td_cosq_index_resolve(unit, 6635 f_ent_act->param[0], 0, 6636 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 6637 &ucosq, NULL)); 6638 } 6639 } else { 6640 ucosq = f_ent_act->param[0]; 6641 } 6642 } 6643 } 6644 if (0 == ucast_mode_set) { 6645 /* Change Unicast packet queue mode */ 6646 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6647 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 6648 6649 /* Change Unicast packet queue value */ 6650 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6651 _FP_ACTION_MCAST_QUEUE_SET(mcast_cosq_new)); 6652 } else { 6653 /* Set Ucast and Mcast queue modes */ 6654 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6655 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6656 6657 /* Set Ucast and Mcast queue values */ 6658 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 6659 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucosq, mcast_cosq_new)); 6660 } 6661 break; 6662 case bcmFieldActionYpUcastCosQNew: 6663 /* Check if corresponding multicast action is set for this entry */ 6664 for (f_ent_act = f_ent->actions; fa != NULL; fa = fa->next) { 6665 if (bcmFieldActionYpMcastCosQNew == f_ent_act->action) { 6666 /* Get current Mcast queue value */ 6667 mcast_mode_set = 1; 6668 mcosq = f_ent_act->param[0]; 6669 } 6670 } 6671 if (0 == mcast_mode_set) { 6672 /* Set Unicast packet queue mode */ 6673 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6674 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6675 /* Set Unicast packet queue value */ 6676 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6677 _FP_ACTION_UCAST_QUEUE_SET(ucast_cosq_new)); 6678 } else { 6679 /* Set Ucast and Mcast queue modes */ 6680 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6681 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6682 6683 /* Set Ucast and Mcast queue values */ 6684 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6685 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, mcosq)); 6686 } 6687 break; 6688 case bcmFieldActionYpMcastCosQNew: 6689 /* Check if corresponding unicast action is set for this entry */ 6690 for (f_ent_act = f_ent->actions; fa != NULL; fa = fa->next) { 6691 if (bcmFieldActionYpUcastCosQNew == f_ent_act->param[0]) { 6692 /* Get current unicast queue value */ 6693 ucast_mode_set = 1; 6694 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(f_ent_act->param[0])) { 6695 if (SOC_IS_TD_TT(unit)) { 6696 BCM_IF_ERROR_RETURN(_bcm_td_cosq_index_resolve(unit, 6697 f_ent_act->param[0], 0, 6698 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 6699 &ucosq, NULL)); 6700 } 6701 } else { 6702 ucosq = f_ent_act->param[0]; 6703 } 6704 } 6705 } 6706 if (0 == ucast_mode_set) { 6707 /* Change Unicast packet queue mode */ 6708 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6709 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 6710 6711 /* Change Unicast packet queue value */ 6712 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6713 _FP_ACTION_MCAST_QUEUE_SET(mcast_cosq_new)); 6714 } else { 6715 /* Set Ucast and Mcast queue modes */ 6716 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6717 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6718 6719 /* Set Ucast and Mcast queue values */ 6720 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 6721 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucosq, mcast_cosq_new)); 6722 6723 } 6724 break; 6725 case bcmFieldActionGpUcastCosQNew: 6726 /* Check if corresponding multicast action is set for this entry */ 6727 for (f_ent_act = f_ent->actions; fa != NULL; fa = fa->next) { 6728 if (bcmFieldActionGpMcastCosQNew == f_ent_act->action) { 6729 /* Get current Mcast queue value */ 6730 mcast_mode_set = 1; 6731 if (BCM_GPORT_IS_MCAST_QUEUE_GROUP(f_ent_act->param[0])) { 6732 if (SOC_IS_TD_TT(unit)) { 6733 BCM_IF_ERROR_RETURN(_bcm_td_cosq_index_resolve(unit, 6734 f_ent_act->param[0], 0, 6735 _BCM_TD_COSQ_INDEX_STYLE_MCAST_QUEUE, NULL, 6736 &mcosq, NULL)); 6737 } 6738 } else { 6739 mcosq = f_ent_act->param[0]; 6740 } 6741 } 6742 } 6743 if (0 == mcast_mode_set) { 6744 /* Set Unicast packet queue mode */ 6745 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6746 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6747 /* Set Unicast packet queue value */ 6748 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6749 _FP_ACTION_UCAST_QUEUE_SET(ucast_cosq_new)); 6750 } else { 6751 /* Set Ucast and Mcast queue modes */ 6752 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6753 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6754 6755 /* Set Ucast and Mcast queue values */ 6756 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6757 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucast_cosq_new, mcosq)); 6758 } 6759 break; 6760 case bcmFieldActionGpMcastCosQNew: 6761 /* Check if corresponding unicast action is set for this entry */ 6762 for (f_ent_act = f_ent->actions; fa != NULL; fa = fa->next) { 6763 if (bcmFieldActionGpUcastCosQNew == f_ent_act->param[0]) { 6764 /* Get current unicast queue value */ 6765 ucast_mode_set = 1; 6766 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(f_ent_act->param[0])) { 6767 if (SOC_IS_TD_TT(unit)) { 6768 BCM_IF_ERROR_RETURN(_bcm_td_cosq_index_resolve(unit, 6769 f_ent_act->param[0], 0, 6770 _BCM_TD_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL, 6771 &ucosq, NULL)); 6772 } 6773 } else { 6774 ucosq = f_ent_act->param[0]; 6775 } 6776 } 6777 } 6778 if (0 == ucast_mode_set) { 6779 /* Change Unicast packet queue mode */ 6780 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6781 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 6782 6783 /* Change Unicast packet queue value */ 6784 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6785 _FP_ACTION_MCAST_QUEUE_SET(mcast_cosq_new)); 6786 } else { 6787 /* Set Ucast and Mcast queue modes */ 6788 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6789 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 6790 6791 /* Set Ucast and Mcast queue values */ 6792 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 6793 _FP_ACTION_UCAST_MCAST_QUEUE_SET(ucosq, mcast_cosq_new)); 6794 } 6795 break; 6796 default: 6797 return (BCM_E_UNAVAIL); 6798 } 6799 return (BCM_E_NONE); 6800 } 6801 #endif /* !BCM_TRIDENT_SUPPORT */ 6802 6803 #if defined(BCM_KATANA_SUPPORT) 6804 /* 6805 * Function: 6806 * _field_kt_action_update 6807 * Purpose: 6808 * Modify action values 6809 * Parameters: 6810 * unit - (IN) BCM device number. 6811 * mem - (IN) Policy table memory. 6812 * f_ent - (IN) Field entry structure to get policy info from. 6813 * tcam_idx - (IN) Field policy table entry index. 6814 * fa - (IN) Field action. 6815 * buf - (OUT) Field Policy table entry. 6816 * Returns: 6817 * BCM_E_XXX 6818 */ 6819 STATIC 6820 int _field_kt_action_update(int unit, soc_mem_t mem, _field_entry_t *f_ent, 6821 int tcam_idx, _field_action_t *fa, uint32 *buf) 6822 { 6823 int cosq_new = BCM_COS_INVALID; /* Unicast new Queue value */ 6824 6825 /* Check and return error for invalid cases */ 6826 if (NULL == f_ent || NULL == fa || NULL == buf) { 6827 return (BCM_E_PARAM); 6828 } 6829 6830 if (!(SOC_IS_KATANAX(unit))) { 6831 return BCM_E_UNAVAIL; 6832 } 6833 6834 LOG_DEBUG(BSL_LS_BCM_FP, 6835 (BSL_META_U(unit, 6836 "FP(unit %d) vverb: _field_kt_action_update "), 6837 unit)); 6838 LOG_DEBUG(BSL_LS_BCM_FP, 6839 (BSL_META_U(unit, 6840 "eid=%d, tcam_idx=0x%x\n "), 6841 f_ent->eid, tcam_idx)); 6842 6843 /* Get Queue value for Unicast actions */ 6844 if ((bcmFieldActionCosQNew == fa->action) || 6845 (bcmFieldActionRpCosQNew == fa->action)|| 6846 (bcmFieldActionYpCosQNew == fa->action)|| 6847 (bcmFieldActionGpCosQNew == fa->action)|| 6848 (bcmFieldActionUcastCosQNew == fa->action)|| 6849 (bcmFieldActionRpUcastCosQNew == fa->action) || 6850 (bcmFieldActionYpUcastCosQNew == fa->action) || 6851 (bcmFieldActionGpUcastCosQNew == fa->action)) { 6852 /* 6853 * Check if queue parameter value is of GPORT type. 6854 */ 6855 if (BCM_GPORT_IS_SET(fa->param[0]) && 6856 (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0]) || 6857 BCM_GPORT_IS_UCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0]) || 6858 BCM_GPORT_IS_MCAST_SUBSCRIBER_QUEUE_GROUP(fa->param[0]))) { 6859 /* The field x_CHANGE_COS_OR_INT_PRI takes 6860 * hardware index number corresponding to the cos queue. 6861 * Currently _bcm_kt_cosq_index_resolve() returns hw index 6862 * when flag is _BCM_KT_COSQ_INDEX_STYLE_BUCKET. 6863 */ 6864 BCM_IF_ERROR_RETURN 6865 (_bcm_kt_cosq_index_resolve(unit, fa->param[0], 0, 6866 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 6867 &cosq_new, NULL)); 6868 } else { 6869 cosq_new = fa->param[0]; 6870 } 6871 } 6872 switch (fa->action) { 6873 case bcmFieldActionCosQNew: 6874 case bcmFieldActionUcastCosQNew: 6875 /* Set mode info for all colors */ 6876 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6877 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6878 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6879 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6880 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6881 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6882 /* Set queue info for all colors */ 6883 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 6884 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 6885 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 6886 break; 6887 case bcmFieldActionRpCosQNew: 6888 case bcmFieldActionRpUcastCosQNew: 6889 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 6890 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6891 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 6892 break; 6893 case bcmFieldActionYpCosQNew: 6894 case bcmFieldActionYpUcastCosQNew: 6895 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 6896 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6897 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 6898 break; 6899 case bcmFieldActionGpCosQNew: 6900 case bcmFieldActionGpUcastCosQNew: 6901 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 6902 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 6903 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 6904 break; 6905 default: 6906 return (BCM_E_UNAVAIL); 6907 } 6908 return (BCM_E_NONE); 6909 } 6910 #endif /* !BCM_KATANA_SUPPORT */ 6911 6912 #if defined(BCM_GREYHOUND2_SUPPORT) 6913 /* 6914 * Function: 6915 * _field_gh2_action_update 6916 * Purpose: 6917 * Modify action values 6918 * Parameters: 6919 * unit - (IN) BCM device number. 6920 * mem - (IN) Policy table memory. 6921 * f_ent - (IN) Field entry structure to get policy info from. 6922 * tcam_idx - (IN) Field policy table entry index. 6923 * fa - (IN) Field action. 6924 * buf - (OUT) Field Policy table entry. 6925 * Returns: 6926 * BCM_E_XXX 6927 */ 6928 STATIC 6929 int _field_gh2_action_update(int unit, soc_mem_t mem, _field_entry_t *f_ent, 6930 int tcam_idx, _field_action_t *fa, uint32 *buf) 6931 { 6932 int cosq_new = BCM_COS_INVALID; 6933 int cosq_ext_num = 0; 6934 6935 /* Check and return error for invalid cases */ 6936 if (NULL == f_ent || NULL == fa || NULL == buf) { 6937 return (BCM_E_PARAM); 6938 } 6939 6940 LOG_DEBUG(BSL_LS_BCM_FP, 6941 (BSL_META_U(unit, 6942 "FP vverb: _field_gh2_action_update "))); 6943 LOG_DEBUG(BSL_LS_BCM_FP, 6944 (BSL_META_U(unit, 6945 "eid=%d, tcam_idx=0x%x\n "), 6946 f_ent->eid, tcam_idx)); 6947 6948 /* Get Queue value for Unicast actions */ 6949 if ((bcmFieldActionCosQNew == fa->action) || 6950 (bcmFieldActionRpCosQNew == fa->action)|| 6951 (bcmFieldActionYpCosQNew == fa->action)|| 6952 (bcmFieldActionGpCosQNew == fa->action)) { 6953 /* 6954 * Check if queue parameter value is of GPORT type. 6955 */ 6956 if (BCM_GPORT_IS_SET(fa->param[0])) { 6957 BCM_IF_ERROR_RETURN 6958 (bcmi_gh2_cosq_index_resolve(unit, 6959 fa->param[0], &cosq_new)); 6960 } else { 6961 cosq_new = fa->param[0]; 6962 } 6963 } 6964 6965 cosq_ext_num = (cosq_new >> 3) & 0x7; 6966 cosq_new &= 0x7; 6967 6968 switch (fa->action) { 6969 case bcmFieldActionCosQNew: 6970 /* Set queue extension number */ 6971 PolicySet(unit, mem, buf, QUEUE_EXTENSION_NUMf, cosq_ext_num); 6972 /* Set mode info */ 6973 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x1); 6974 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x1); 6975 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x1); 6976 /* Set queue info for all colors */ 6977 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 6978 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 6979 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 6980 break; 6981 case bcmFieldActionRpCosQNew: 6982 /* Set queue extension number */ 6983 PolicySet(unit, mem, buf, QUEUE_EXTENSION_NUMf, cosq_ext_num); 6984 /* Set mode info */ 6985 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x1); 6986 /* Set queue info */ 6987 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 6988 break; 6989 case bcmFieldActionYpCosQNew: 6990 /* Set queue extension number */ 6991 PolicySet(unit, mem, buf, QUEUE_EXTENSION_NUMf, cosq_ext_num); 6992 /* Set mode info */ 6993 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x1); 6994 /* Set queue info */ 6995 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 6996 break; 6997 case bcmFieldActionGpCosQNew: 6998 /* Set queue extension number */ 6999 PolicySet(unit, mem, buf, QUEUE_EXTENSION_NUMf, cosq_ext_num); 7000 /* Set mode info */ 7001 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x1); 7002 /* Set queue info */ 7003 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 7004 break; 7005 default: 7006 return (BCM_E_UNAVAIL); 7007 } 7008 return (BCM_E_NONE); 7009 } 7010 #endif /* BCM_GREYHOUND2_SUPPORT */ 7011 7012 #define BCM_FIELD_OAM_SESSION_ID_MAX 0xffff 7013 7014 /* 7015 * Function: 7016 * _bcm_field_trx_action_get 7017 * Purpose: 7018 * Get the actions to be written 7019 * Parameters: 7020 * unit - BCM device number 7021 * mem - Policy table memory 7022 * f_ent - entry structure to get policy info from 7023 * tcam_idx - index into TCAM 7024 * fa - field action 7025 * buf - (OUT) Field Policy table entry 7026 * Returns: 7027 * BCM_E_NONE 7028 * BCM_E_PARAM - Action parameter out-of-range or unrecognized action. 7029 * Notes: 7030 * This is a simple read/modify/write pattern. 7031 * FP unit lock should be held by calling function. 7032 */ 7033 int 7034 _bcm_field_trx_action_get(int unit, soc_mem_t mem, _field_entry_t *f_ent, 7035 int tcam_idx, _field_action_t *fa, uint32 *buf) 7036 { 7037 uint32 mode; 7038 int rv; 7039 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 7040 int subport_num = 0; 7041 #endif 7042 uint32 value = 0; 7043 soc_field_t l3sw_or_change_l2 = INVALIDf; 7044 #ifdef INCLUDE_L3 7045 _field_action_t *fa_temp = NULL; 7046 #endif 7047 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 7048 int shift_val; 7049 #endif 7050 #ifdef INCLUDE_L3 7051 int svp = -1; 7052 int vfi = 0; 7053 #endif 7054 #if defined(BCM_TOMAHAWK_SUPPORT) 7055 uint8 src_is_svp = 0; /* Source type. */ 7056 uint8 mod_id = 0; /* BCM Module ID. */ 7057 uint8 port_id = 0; /* BCM Port Id. */ 7058 int src_svp = -1; /* SVP */ 7059 #endif 7060 #ifdef BCM_KATANA2_SUPPORT 7061 uint32 param0 = 0; 7062 uint32 param1 = 0; 7063 #endif 7064 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 7065 defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 7066 int cosq_new = BCM_COS_INVALID; 7067 #endif 7068 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT) || \ 7069 (defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)) 7070 int hw_index = 0; 7071 #endif 7072 #ifdef BCM_HURRICANE3_SUPPORT 7073 int index_array[2] = {0}; 7074 #endif 7075 #if defined(BCM_APACHE_SUPPORT) 7076 int8 flex_stat_pool_id = 0; 7077 #endif 7078 #if defined(BCM_MONTEREY_SUPPORT) 7079 int roe_type = 0; 7080 #endif 7081 #if defined(BCM_GREYHOUND2_SUPPORT) 7082 uint32 svm_disable = 0; 7083 #endif /* BCM_GREYHOUND2_SUPPORT */ 7084 7085 if (NULL == f_ent || NULL == fa || NULL == buf) { 7086 return (BCM_E_PARAM); 7087 } 7088 7089 LOG_DEBUG(BSL_LS_BCM_FP, 7090 (BSL_META_U(unit, 7091 "FP(unit %d) vverb: BEGIN _bcm_field_trx_action_get(eid=%d, tcam_idx=0x%x)\n"), 7092 unit, f_ent->eid, tcam_idx)); 7093 7094 #if defined(BCM_TRIDENT3_SUPPORT) 7095 if (soc_feature(unit, soc_feature_td3_style_fp)) { 7096 rv = _bcm_field_td3_action_get(unit, mem, f_ent, tcam_idx, fa, buf); 7097 if (BCM_SUCCESS(rv)) { 7098 fa->flags &= ~_FP_ACTION_DIRTY; /* Mark action as installed. */ 7099 return rv; 7100 } 7101 } 7102 #endif /* BCM_TRIDENT3_SUPPORT */ 7103 7104 #ifdef BCM_TRIUMPH3_SUPPORT 7105 if (SOC_IS_TRIUMPH3(unit)) { 7106 rv = _bcm_field_tr3_action_get(unit, mem, f_ent, tcam_idx, fa, 7107 buf); 7108 if (BCM_SUCCESS(rv)) { 7109 fa->flags &= ~_FP_ACTION_DIRTY; /* Mark action as installed. */ 7110 return rv; 7111 } 7112 } 7113 #endif 7114 7115 #if defined(BCM_TRIDENT2_SUPPORT) 7116 if (SOC_IS_TD2_TT2(unit)) { 7117 rv = _bcm_field_td2_action_get(unit, mem, f_ent, tcam_idx, fa, buf); 7118 if (BCM_SUCCESS(rv)) { 7119 fa->flags &= ~_FP_ACTION_DIRTY; /* Mark action as installed. */ 7120 return rv; 7121 } 7122 } 7123 #endif 7124 7125 if (SOC_MEM_FIELD_VALID(unit, mem, G_L3SW_CHANGE_MACDA_OR_VLANf)) { 7126 l3sw_or_change_l2 = G_L3SW_CHANGE_MACDA_OR_VLANf; 7127 } else { 7128 l3sw_or_change_l2 = G_L3SW_CHANGE_L2_FIELDSf; 7129 } 7130 7131 switch (fa->action) { 7132 case bcmFieldActionMultipathHash: 7133 PolicySet(unit, mem, buf, ECMP_HASH_SELf, fa->param[0]); 7134 break; 7135 case bcmFieldActionCopyToCpu: 7136 case bcmFieldActionRpCopyToCpu: 7137 case bcmFieldActionYpCopyToCpu: 7138 case bcmFieldActionGpCopyToCpu: 7139 case bcmFieldActionTimeStampToCpu: 7140 case bcmFieldActionRpTimeStampToCpu: 7141 case bcmFieldActionYpTimeStampToCpu: 7142 case bcmFieldActionGpTimeStampToCpu: 7143 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_APACHE_SUPPORT) 7144 if (SOC_IS_KATANA2(unit) || SOC_IS_APACHE(unit)) { 7145 } else 7146 #endif 7147 { 7148 #ifdef BCM_TRIUMPH2_SUPPORT 7149 if (!soc_feature(unit, soc_feature_internal_loopback) && 7150 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 7151 /* Loopback port is not available */ 7152 return BCM_E_UNAVAIL; 7153 } 7154 #endif 7155 } 7156 rv = _field_trx_action_copy_to_cpu(unit, mem, f_ent, fa, buf); 7157 BCM_IF_ERROR_RETURN(rv); 7158 break; 7159 7160 case bcmFieldActionCopyToCpuCancel: 7161 case bcmFieldActionRpCopyToCpuCancel: 7162 case bcmFieldActionYpCopyToCpuCancel: 7163 case bcmFieldActionGpCopyToCpuCancel: 7164 case bcmFieldActionTimeStampToCpuCancel: 7165 case bcmFieldActionRpTimeStampToCpuCancel: 7166 case bcmFieldActionYpTimeStampToCpuCancel: 7167 case bcmFieldActionGpTimeStampToCpuCancel: 7168 rv = _field_trx_action_copy_to_cpu_cancel(unit, mem, f_ent, fa, buf); 7169 BCM_IF_ERROR_RETURN(rv); 7170 break; 7171 7172 case bcmFieldActionDrop: 7173 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7174 PolicySet(unit, mem, buf, DROPf, 0x1); 7175 } else { 7176 if (SOC_MEM_FIELD_VALID(unit, mem, R_DROPf)) { 7177 PolicySet(unit, mem, buf, R_DROPf, 0x1); 7178 } 7179 if (SOC_MEM_FIELD_VALID(unit, mem, Y_DROPf)) { 7180 PolicySet(unit, mem, buf, Y_DROPf, 0x1); 7181 } 7182 PolicySet(unit, mem, buf, G_DROPf, 0x1); 7183 } 7184 break; 7185 7186 case bcmFieldActionDropCancel: 7187 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7188 PolicySet(unit, mem, buf, DROPf, 0x2); 7189 } else { 7190 if (SOC_MEM_FIELD_VALID(unit, mem, R_DROPf)) { 7191 PolicySet(unit, mem, buf, R_DROPf, 0x2); 7192 } 7193 if (SOC_MEM_FIELD_VALID(unit, mem, Y_DROPf)) { 7194 PolicySet(unit, mem, buf, Y_DROPf, 0x2); 7195 } 7196 PolicySet(unit, mem, buf, G_DROPf, 0x2); 7197 } 7198 break; 7199 7200 case bcmFieldActionClassDestSet: 7201 PolicySet(unit, mem, buf, USE_VFP_CLASS_ID_Lf, 0x1); 7202 PolicySet(unit, mem, buf, VFP_CLASS_ID_Lf, fa->param[0]); 7203 break; 7204 7205 case bcmFieldActionClassSourceSet: 7206 PolicySet(unit, mem, buf, USE_VFP_CLASS_ID_Hf, 0x1); 7207 PolicySet(unit, mem, buf, VFP_CLASS_ID_Hf, fa->param[0]); 7208 break; 7209 7210 case bcmFieldActionVrfSet: 7211 if (soc_feature(unit, soc_feature_mpls)) { 7212 if (SOC_MEM_FIELD_VALID(unit, mem, FIELDS_ACTIONf)) { 7213 PolicySet(unit, mem, buf, FIELDS_ACTIONf, 0x3); 7214 } else { 7215 PolicySet(unit, mem, buf, MPLS_ACTIONf, 0x3); 7216 } 7217 PolicySet(unit, mem, buf, VFP_VRF_IDf, fa->param[0]); 7218 } else { 7219 if (SOC_MEM_FIELD_VALID(unit, mem, FIELDS_ACTIONf)) { 7220 PolicySet(unit, mem, buf, FIELDS_ACTIONf, 0x3); 7221 } else { 7222 PolicySet(unit, mem, buf, USE_VFP_VRF_IDf , 0x1); 7223 } 7224 PolicySet(unit, mem, buf, VFP_VRF_IDf, fa->param[0]); 7225 7226 } 7227 break; 7228 7229 case bcmFieldActionDropPrecedence: 7230 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7231 uint8 hardware_color; 7232 7233 /* Convert to hardware color code because the tr2x 7234 VFP hardware doesn't do it for us */ 7235 7236 switch (fa->param[0]) 7237 { 7238 case BCM_FIELD_COLOR_GREEN: 7239 hardware_color = 0; 7240 break; 7241 7242 case BCM_FIELD_COLOR_RED: 7243 hardware_color = 1; 7244 break; 7245 7246 case BCM_FIELD_COLOR_YELLOW: 7247 hardware_color = 3; 7248 break; 7249 7250 default: 7251 return BCM_E_PARAM; 7252 } 7253 7254 PolicySet(unit, mem, buf, CHANGE_CNGf, 0x1); 7255 PolicySet(unit, mem, buf, NEW_CNGf, hardware_color); 7256 } else { 7257 PolicySet(unit, mem, buf, R_DROP_PRECEDENCEf, fa->param[0]); 7258 PolicySet(unit, mem, buf, Y_DROP_PRECEDENCEf, fa->param[0]); 7259 PolicySet(unit, mem, buf, G_DROP_PRECEDENCEf, fa->param[0]); 7260 } 7261 break; 7262 7263 case bcmFieldActionPrioPktCopy: 7264 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x4); 7265 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x4); 7266 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x4); 7267 break; 7268 7269 case bcmFieldActionPrioPktNew: 7270 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7271 #ifdef BCM_TRIDENT_SUPPORT 7272 if (soc_mem_field_valid(unit, mem, NEW_OUTER_DOT1Pf)) { 7273 PolicySet(unit, mem, buf, CHANGE_OUTER_DOT1Pf, 0x1); 7274 PolicySet(unit, mem, buf, NEW_OUTER_DOT1Pf, fa->param[0]); 7275 } else 7276 #endif /* !BCM_TRIDENT_SUPPORT */ 7277 { 7278 PolicySet(unit, mem, buf, CHANGE_PKT_PRIORITYf, 0x1); 7279 PolicySet(unit, mem, buf, NEW_PKT_PRIORITYf, fa->param[0]); 7280 } 7281 } else { 7282 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x5); 7283 PolicySet(unit, mem, buf, R_NEW_PKT_PRIf, fa->param[0]); 7284 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x5); 7285 PolicySet(unit, mem, buf, Y_NEW_PKT_PRIf, fa->param[0]); 7286 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x5); 7287 PolicySet(unit, mem, buf, G_NEW_PKT_PRIf, fa->param[0]); 7288 } 7289 break; 7290 7291 case bcmFieldActionPrioPktTos: 7292 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x6); 7293 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x6); 7294 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x6); 7295 break; 7296 7297 case bcmFieldActionPrioPktCancel: 7298 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x7); 7299 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x7); 7300 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x7); 7301 break; 7302 7303 case bcmFieldActionEcnNew: 7304 BCM_IF_ERROR_RETURN 7305 (_field_trx_action_ecn_update (unit, mem, f_ent, fa, buf)); 7306 break; 7307 7308 case bcmFieldActionDscpNew: 7309 if (soc_mem_field_valid(unit, mem, R_CHANGE_DSCPf)) { 7310 PolicySet(unit, mem, buf, R_CHANGE_DSCPf, 0x1); 7311 PolicySet(unit, mem, buf, R_NEW_DSCPf, fa->param[0]); 7312 } 7313 if (soc_mem_field_valid(unit, mem, Y_CHANGE_DSCPf)) { 7314 PolicySet(unit, mem, buf, Y_CHANGE_DSCPf, 0x1); 7315 PolicySet(unit, mem, buf, Y_NEW_DSCPf, fa->param[0]); 7316 } 7317 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 7318 PolicySet(unit, mem, buf, G_CHANGE_DSCPf, 0x1); 7319 PolicySet(unit, mem, buf, G_NEW_DSCPf, fa->param[0]); 7320 } else { 7321 PolicySet(unit, mem, buf, G_CHANGE_DSCP_TOSf, 0x3); 7322 PolicySet(unit, mem, buf, G_NEW_DSCP_TOSf, fa->param[0]); 7323 } 7324 break; 7325 7326 case bcmFieldActionDscpCancel: 7327 PolicySet(unit, mem, buf, R_CHANGE_DSCPf, 0x2); 7328 PolicySet(unit, mem, buf, Y_CHANGE_DSCPf, 0x2); 7329 PolicySet(unit, mem, buf, G_CHANGE_DSCP_TOSf, 0x4); 7330 break; 7331 7332 case bcmFieldActionCosQNew: 7333 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 7334 if (SOC_IS_TD_TT(unit)) { 7335 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, 7336 mem, f_ent, tcam_idx, fa, buf)); 7337 } else 7338 #endif 7339 #if defined(BCM_KATANA_SUPPORT) 7340 if (SOC_IS_KATANAX(unit) && BCM_GPORT_IS_SET(fa->param[0])) { 7341 BCM_IF_ERROR_RETURN (_field_kt_action_update(unit, mem, 7342 f_ent, tcam_idx, fa, buf)); 7343 } else 7344 #endif 7345 #if defined(BCM_GREYHOUND2_SUPPORT) 7346 if (SOC_IS_GREYHOUND2(unit)) { 7347 BCM_IF_ERROR_RETURN( 7348 _field_gh2_action_update(unit, mem, f_ent, tcam_idx, fa, buf)); 7349 } else 7350 #endif 7351 { 7352 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x1); 7353 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x1); 7354 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x1); 7355 PolicySet(unit, mem, buf, R_COS_INT_PRIf, fa->param[0]); 7356 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, fa->param[0]); 7357 PolicySet(unit, mem, buf, G_COS_INT_PRIf, fa->param[0]); 7358 } 7359 break; 7360 7361 case bcmFieldActionVlanCosQNew: 7362 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x2); 7363 /* Add 8 to the value since VLAN shaping queues are 8..23 */ 7364 PolicySet(unit, mem, buf, R_COS_INT_PRIf, fa->param[0] + 8); 7365 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x2); 7366 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, fa->param[0] + 8); 7367 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x2); 7368 PolicySet(unit, mem, buf, G_COS_INT_PRIf, fa->param[0] + 8); 7369 break; 7370 7371 #if defined(BCM_TRIDENT_SUPPORT) 7372 case bcmFieldActionUcastCosQNew: 7373 #if defined(BCM_KATANA_SUPPORT) 7374 if (SOC_IS_KATANAX(unit)) { 7375 BCM_IF_ERROR_RETURN (_field_kt_action_update(unit, mem, 7376 f_ent, tcam_idx, fa, buf)); 7377 } else 7378 #endif 7379 { 7380 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, 7381 mem, f_ent, tcam_idx, fa, buf)); 7382 } 7383 break; 7384 case bcmFieldActionMcastCosQNew: 7385 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, mem, 7386 f_ent, tcam_idx, fa, buf)); 7387 break; 7388 #endif /* !BCM_TRIDENT_SUPPORT */ 7389 7390 case bcmFieldActionPrioIntCopy: 7391 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x4); 7392 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x4); 7393 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x4); 7394 break; 7395 7396 case bcmFieldActionPrioIntNew: 7397 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7398 PolicySet(unit, mem, buf, CHANGE_INT_PRIORITYf, 0x1); 7399 PolicySet(unit, mem, buf, NEW_INT_PRIORITYf, fa->param[0]); 7400 #if defined BCM_KATANA2_SUPPORT 7401 } else if ((_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) 7402 && SOC_IS_KATANA2(unit)) { 7403 PolicySet(unit, mem, buf, R_CHANGE_REDIR_INT_PRIf, 0x1); 7404 PolicySet(unit, mem, buf, R_NEW_REDIR_INT_PRIf, (0xf & fa->param[0])); 7405 PolicySet(unit, mem, buf, Y_CHANGE_REDIR_INT_PRIf, 0x1); 7406 PolicySet(unit, mem, buf, Y_NEW_REDIR_INT_PRIf, (0xf & fa->param[0])); 7407 PolicySet(unit, mem, buf, G_CHANGE_REDIR_INT_PRIf, 0x1); 7408 PolicySet(unit, mem, buf, G_NEW_REDIR_INT_PRIf, (0xf & fa->param[0])); 7409 #endif 7410 } else { 7411 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x5); 7412 PolicySet(unit, mem, buf, R_COS_INT_PRIf, (0xf & fa->param[0])); 7413 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x5); 7414 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, (0xf & fa->param[0])); 7415 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x5); 7416 PolicySet(unit, mem, buf, G_COS_INT_PRIf, (0xf & fa->param[0])); 7417 } 7418 break; 7419 7420 case bcmFieldActionPrioIntTos: 7421 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x6); 7422 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x6); 7423 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x6); 7424 break; 7425 7426 case bcmFieldActionPrioIntCancel: 7427 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x7); 7428 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x7); 7429 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x7); 7430 break; 7431 7432 #if defined BCM_KATANA2_SUPPORT 7433 case bcmFieldActionUcastQueueNew: 7434 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x8); 7435 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x8); 7436 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x8); 7437 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 7438 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7439 &cosq_new, NULL); 7440 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 7441 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 7442 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 7443 break; 7444 case bcmFieldActionRpUcastQueueNew: 7445 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x8); 7446 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 7447 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7448 &cosq_new, NULL); 7449 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 7450 break; 7451 case bcmFieldActionYpUcastQueueNew: 7452 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x8); 7453 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 7454 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7455 &cosq_new, NULL); 7456 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 7457 break; 7458 case bcmFieldActionGpUcastQueueNew: 7459 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x8); 7460 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 7461 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7462 &cosq_new, NULL); 7463 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 7464 break; 7465 case bcmFieldActionIntCosUcastQueueNew: 7466 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 7467 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x9); 7468 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x9); 7469 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x9); 7470 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 7471 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7472 &cosq_new, NULL); 7473 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 7474 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 7475 cosq_new)); 7476 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 7477 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 7478 cosq_new)); 7479 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 7480 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 7481 cosq_new)); 7482 break; 7483 case bcmFieldActionRpIntCosUcastQueueNew: 7484 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 7485 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 7486 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7487 &cosq_new, NULL); 7488 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x9); 7489 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 7490 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 7491 cosq_new)); 7492 break; 7493 case bcmFieldActionYpIntCosUcastQueueNew: 7494 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 7495 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 7496 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7497 &cosq_new, NULL); 7498 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x9); 7499 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 7500 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 7501 cosq_new)); 7502 break; 7503 case bcmFieldActionGpIntCosUcastQueueNew: 7504 shift_val = SOC_IS_SABER2(unit) ? 10 :12; 7505 _bcm_kt2_cosq_index_resolve(unit, fa->param[0], 0, 7506 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7507 &cosq_new, NULL); 7508 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x9); 7509 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 7510 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << shift_val | 7511 cosq_new)); 7512 break; 7513 7514 #endif 7515 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 7516 defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 7517 case bcmFieldActionPortPrioIntCosQNew: 7518 BCM_IF_ERROR_RETURN (_field_action_unicast_cosq_get(unit, fa, &shift_val, &cosq_new)); 7519 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 10); 7520 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 10); 7521 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 10); 7522 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 7523 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7524 cosq_new)); 7525 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 7526 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7527 cosq_new)); 7528 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 7529 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7530 cosq_new)); 7531 break; 7532 case bcmFieldActionRpPortPrioIntCosQNew: 7533 BCM_IF_ERROR_RETURN (_field_action_unicast_cosq_get(unit, fa, &shift_val, &cosq_new)); 7534 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 10); 7535 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 7536 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7537 cosq_new)); 7538 break; 7539 case bcmFieldActionYpPortPrioIntCosQNew: 7540 BCM_IF_ERROR_RETURN (_field_action_unicast_cosq_get(unit, fa, &shift_val, &cosq_new)); 7541 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 10); 7542 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 7543 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7544 cosq_new)); 7545 break; 7546 case bcmFieldActionGpPortPrioIntCosQNew: 7547 BCM_IF_ERROR_RETURN (_field_action_unicast_cosq_get(unit, fa, &shift_val, &cosq_new)); 7548 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 10); 7549 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 7550 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7551 cosq_new)); 7552 break; 7553 #endif 7554 #if defined(BCM_KATANA2_SUPPORT) 7555 case bcmFieldActionServicePrioIntCosQNew: 7556 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 10); 7557 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 10); 7558 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 10); 7559 shift_val = SOC_IS_SABER2(unit) ? 10 : 12; 7560 _bcm_kt2_cosq_index_resolve(unit, fa->param[1], 0, 7561 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7562 &cosq_new, NULL); 7563 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 7564 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7565 0x1 << (shift_val-1) | cosq_new)); 7566 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 7567 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7568 0x1 << (shift_val-1) | cosq_new)); 7569 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 7570 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7571 0x1 << (shift_val-1) | cosq_new)); 7572 break; 7573 case bcmFieldActionRpServicePrioIntCosQNew: 7574 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 10); 7575 _bcm_kt2_cosq_index_resolve(unit, fa->param[1], 0, 7576 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7577 &cosq_new, NULL); 7578 shift_val = SOC_IS_SABER2(unit) ? 10 : 12; 7579 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 7580 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7581 0x1 << (shift_val-1) | cosq_new)); 7582 break; 7583 case bcmFieldActionYpServicePrioIntCosQNew: 7584 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 10); 7585 _bcm_kt2_cosq_index_resolve(unit, fa->param[1], 0, 7586 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7587 &cosq_new, NULL); 7588 shift_val = SOC_IS_SABER2(unit) ? 10 : 12; 7589 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 7590 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7591 0x1 << (shift_val-1) | cosq_new)); 7592 break; 7593 case bcmFieldActionGpServicePrioIntCosQNew: 7594 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 10); 7595 _bcm_kt2_cosq_index_resolve(unit, fa->param[1], 0, 7596 _BCM_KT_COSQ_INDEX_STYLE_BUCKET, NULL, 7597 &cosq_new, NULL); 7598 shift_val = SOC_IS_SABER2(unit) ? 10 : 12; 7599 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 7600 (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[0]) << shift_val | 7601 0x1 << (shift_val-1) | cosq_new)); 7602 break; 7603 #endif 7604 7605 case bcmFieldActionPrioPktAndIntNew: 7606 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7607 #ifdef BCM_TRIDENT_SUPPORT 7608 if (SOC_IS_TD_TT(unit) 7609 || SOC_IS_KATANAX(unit) 7610 || SOC_IS_TRIUMPH3(unit)) { 7611 PolicySet(unit, mem, buf, CHANGE_OUTER_DOT1Pf, 0x1); 7612 PolicySet(unit, mem, buf, NEW_OUTER_DOT1Pf, fa->param[0]); 7613 } else 7614 #endif 7615 { 7616 PolicySet(unit, mem, buf, CHANGE_PKT_PRIORITYf, 0x1); 7617 PolicySet(unit, mem, buf, NEW_PKT_PRIORITYf, fa->param[0]); 7618 } 7619 PolicySet(unit, mem, buf, CHANGE_INT_PRIORITYf, 0x1); 7620 PolicySet(unit, mem, buf, NEW_INT_PRIORITYf, fa->param[0]); 7621 } else { 7622 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x5); 7623 PolicySet(unit, mem, buf, R_NEW_PKT_PRIf, fa->param[0]); 7624 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x5); 7625 PolicySet(unit, mem, buf, R_COS_INT_PRIf, (0xf & fa->param[0])); 7626 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x5); 7627 PolicySet(unit, mem, buf, Y_NEW_PKT_PRIf, fa->param[0]); 7628 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x5); 7629 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, (0xf & fa->param[0])); 7630 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x5); 7631 PolicySet(unit, mem, buf, G_NEW_PKT_PRIf, fa->param[0]); 7632 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x5); 7633 PolicySet(unit, mem, buf, G_COS_INT_PRIf, (0xf & fa->param[0])); 7634 } 7635 break; 7636 7637 case bcmFieldActionPrioPktAndIntCopy: 7638 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x4); 7639 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x4); 7640 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x4); 7641 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x4); 7642 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x4); 7643 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x4); 7644 break; 7645 7646 case bcmFieldActionPrioPktAndIntTos: 7647 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x6); 7648 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x6); 7649 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x6); 7650 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x6); 7651 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x6); 7652 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x6); 7653 break; 7654 7655 case bcmFieldActionPrioPktAndIntCancel: 7656 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x7); 7657 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x7); 7658 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x7); 7659 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x7); 7660 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x7); 7661 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x7); 7662 break; 7663 7664 case bcmFieldActionCosQCpuNew: 7665 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7666 PolicySet(unit, mem, buf, CPU_COSf, fa->param[0]); 7667 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 7668 /* Apache EFP doesn't have the control CHANGE_CPU_COS */ 7669 if (!SOC_IS_APACHE(unit)) { 7670 PolicySet(unit, mem, buf, CHANGE_CPU_COSf, 0x1); 7671 } 7672 PolicySet(unit, mem, buf, NEW_CPU_COSf, fa->param[0]); 7673 } else { 7674 PolicySet(unit, mem, buf, CHANGE_CPU_COSf, 0x1); 7675 PolicySet(unit, mem, buf, CPU_COSf, fa->param[0]); 7676 } 7677 break; 7678 7679 case bcmFieldActionOuterVlanPrioNew: 7680 #ifdef BCM_TRIDENT_SUPPORT 7681 if ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || 7682 SOC_IS_TRIUMPH3(unit)) 7683 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7684 PolicySet(unit, mem, buf, CHANGE_OUTER_DOT1Pf, 0x2); 7685 PolicySet(unit, mem, buf, NEW_OUTER_DOT1Pf, fa->param[0]); 7686 } else 7687 #endif 7688 { 7689 if (soc_mem_field_valid(unit, mem, R_CHANGE_DOT1Pf)) { 7690 PolicySet(unit, mem, buf, R_CHANGE_DOT1Pf, 0x1); 7691 PolicySet(unit, mem, buf, R_NEW_DOT1Pf, fa->param[0]); 7692 } 7693 if (soc_mem_field_valid(unit, mem, Y_CHANGE_DOT1Pf)) { 7694 PolicySet(unit, mem, buf, Y_CHANGE_DOT1Pf, 0x1); 7695 PolicySet(unit, mem, buf, Y_NEW_DOT1Pf, fa->param[0]); 7696 } 7697 PolicySet(unit, mem, buf, G_CHANGE_DOT1Pf, 0x1); 7698 PolicySet(unit, mem, buf, G_NEW_DOT1Pf, fa->param[0]); 7699 } 7700 break; 7701 7702 case bcmFieldActionOuterVlanPrioCopyInner: 7703 PolicySet(unit, mem, buf, CHANGE_OUTER_DOT1Pf, 3); 7704 break; 7705 7706 case bcmFieldActionInnerVlanPrioNew: 7707 #ifdef BCM_TRIDENT_SUPPORT 7708 if ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || 7709 SOC_IS_TRIUMPH3(unit)) 7710 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7711 PolicySet(unit, mem, buf, CHANGE_INNER_DOT1Pf, 0x2); 7712 PolicySet(unit, mem, buf, NEW_INNER_DOT1Pf, fa->param[0]); 7713 } else 7714 #endif 7715 { 7716 PolicySet(unit, mem, buf, R_REPLACE_INNER_PRIf, 0x1); 7717 PolicySet(unit, mem, buf, R_NEW_INNER_PRIf, fa->param[0]); 7718 PolicySet(unit, mem, buf, Y_REPLACE_INNER_PRIf, 0x1); 7719 PolicySet(unit, mem, buf, Y_NEW_INNER_PRIf, fa->param[0]); 7720 PolicySet(unit, mem, buf, G_REPLACE_INNER_PRIf, 0x1); 7721 PolicySet(unit, mem, buf, G_NEW_INNER_PRIf, fa->param[0]); 7722 } 7723 break; 7724 7725 case bcmFieldActionInnerVlanPrioCopyOuter: 7726 PolicySet(unit, mem, buf, CHANGE_INNER_DOT1Pf, 3); 7727 break; 7728 7729 case bcmFieldActionOuterVlanCfiNew: 7730 #ifdef BCM_TRIDENT_SUPPORT 7731 if ((SOC_IS_TD_TT(unit) || SOC_IS_TRIUMPH3(unit)) 7732 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7733 PolicySet(unit, mem, buf, CHANGE_OUTER_CFIf, 0x2); 7734 PolicySet(unit, mem, buf, NEW_OUTER_CFIf, fa->param[0]); 7735 } else 7736 #endif 7737 #ifdef BCM_KATANA_SUPPORT 7738 if (SOC_IS_KATANAX(unit) 7739 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7740 PolicySet(unit, mem, buf, CHANGE_OUTER_CFIf, 0x1); 7741 PolicySet(unit, mem, buf, NEW_OUTER_CFIf, fa->param[0]); 7742 } else 7743 #endif 7744 { 7745 if (soc_mem_field_valid(unit, mem, R_CHANGE_OUTER_CFIf)) { 7746 PolicySet(unit, mem, buf, R_CHANGE_OUTER_CFIf, 0x1); 7747 PolicySet(unit, mem, buf, R_NEW_OUTER_CFIf, fa->param[0]); 7748 } 7749 if (soc_mem_field_valid(unit, mem, Y_CHANGE_OUTER_CFIf)) { 7750 PolicySet(unit, mem, buf, Y_CHANGE_OUTER_CFIf, 0x1); 7751 PolicySet(unit, mem, buf, Y_NEW_OUTER_CFIf, fa->param[0]); 7752 } 7753 PolicySet(unit, mem, buf, G_CHANGE_OUTER_CFIf, 0x1); 7754 PolicySet(unit, mem, buf, G_NEW_OUTER_CFIf, fa->param[0]); 7755 } 7756 break; 7757 7758 case bcmFieldActionOuterVlanCfiCopyInner: 7759 PolicySet(unit, mem, buf, CHANGE_OUTER_CFIf, 3); 7760 break; 7761 7762 case bcmFieldActionInnerVlanCfiNew: 7763 #ifdef BCM_TRIDENT_SUPPORT 7764 if ((SOC_IS_TD_TT(unit) || SOC_IS_TRIUMPH3(unit)) 7765 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7766 PolicySet(unit, mem, buf, CHANGE_INNER_CFIf, 0x2); 7767 PolicySet(unit, mem, buf, NEW_INNER_CFIf, fa->param[0]); 7768 } else 7769 #endif 7770 #ifdef BCM_KATANA_SUPPORT 7771 if (SOC_IS_KATANAX(unit) 7772 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7773 PolicySet(unit, mem, buf, CHANGE_INNER_CFIf, 0x1); 7774 PolicySet(unit, mem, buf, NEW_INNER_CFIf, fa->param[0]); 7775 } else 7776 #endif 7777 { 7778 PolicySet(unit, mem, buf, R_CHANGE_INNER_CFIf, 0x1); 7779 PolicySet(unit, mem, buf, R_NEW_INNER_CFIf, fa->param[0]); 7780 PolicySet(unit, mem, buf, Y_CHANGE_INNER_CFIf, 0x1); 7781 PolicySet(unit, mem, buf, Y_NEW_INNER_CFIf, fa->param[0]); 7782 PolicySet(unit, mem, buf, G_CHANGE_INNER_CFIf, 0x1); 7783 PolicySet(unit, mem, buf, G_NEW_INNER_CFIf, fa->param[0]); 7784 } 7785 break; 7786 7787 case bcmFieldActionInnerVlanCfiCopyOuter: 7788 PolicySet(unit, mem, buf, CHANGE_INNER_CFIf, 3); 7789 break; 7790 7791 case bcmFieldActionSwitchToCpuCancel: 7792 value = SWITCH_TO_CPU_CANCEL; 7793 #if defined(BCM_TRIUMPH3_SUPPORT) 7794 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 7795 SOC_IS_KATANA2(unit)) { 7796 if ((COPY_TO_CPU_CANCEL == 7797 PolicyGet(unit, mem, buf, R_COPY_TO_CPUf)) && 7798 (COPY_TO_CPU_CANCEL == 7799 PolicyGet(unit, mem, buf, Y_COPY_TO_CPUf)) && 7800 (COPY_TO_CPU_CANCEL == 7801 PolicyGet(unit, mem, buf, G_COPY_TO_CPUf))) { 7802 7803 value = COPY_AND_SWITCH_TO_CPU_CANCEL; 7804 } 7805 } 7806 #endif 7807 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, value); 7808 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, value); 7809 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, value); 7810 break; 7811 7812 case bcmFieldActionSwitchToCpuReinstate: 7813 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x4); 7814 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x4); 7815 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x4); 7816 break; 7817 7818 case bcmFieldActionInnerVlanAdd: 7819 PolicySet(unit, mem, buf, INNER_VLAN_ACTIONSf, 0x1); 7820 PolicySet(unit, mem, buf, NEW_INNER_VLANf, fa->param[0]); 7821 break; 7822 7823 case bcmFieldActionOuterVlanAdd: 7824 PolicySet(unit, mem, buf, OUTER_VLAN_ACTIONSf, 0x1); 7825 PolicySet(unit, mem, buf, NEW_OUTER_VLANf, fa->param[0]); 7826 break; 7827 7828 case bcmFieldActionInnerVlanDelete: 7829 PolicySet(unit, mem, buf, INNER_VLAN_ACTIONSf, 0x3); 7830 break; 7831 7832 case bcmFieldActionOuterVlanLookup: 7833 PolicySet(unit, mem, buf, OUTER_VLAN_ACTIONSf, 0x3); 7834 PolicySet(unit, mem, buf, NEW_OUTER_VLANf, fa->param[0]); 7835 break; 7836 7837 case bcmFieldActionIpFix: 7838 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 7839 PolicySet(unit, mem, buf, PID_IPFIX_ACTIONSf, 0x1); 7840 #ifdef BCM_TRIDENT2_SUPPORT 7841 if (SOC_IS_TD2_TT2(unit)) { 7842 PolicySet(unit, mem, buf, VXLAN_ACTIONf, 0); 7843 } 7844 #endif 7845 } else { 7846 PolicySet(unit, mem, buf, IPFIX_CONTROLf, 0x1); 7847 } 7848 break; 7849 7850 case bcmFieldActionIpFixCancel: 7851 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 7852 PolicySet(unit, mem, buf, PID_IPFIX_ACTIONSf, 0x2); 7853 #ifdef BCM_TRIDENT2_SUPPORT 7854 if (SOC_IS_TD2_TT2(unit)) { 7855 PolicySet(unit, mem, buf, VXLAN_ACTIONf, 0); 7856 } 7857 #endif 7858 } else { 7859 PolicySet(unit, mem, buf, IPFIX_CONTROLf, 0x2); 7860 } 7861 break; 7862 7863 case bcmFieldActionDoNotLearn: 7864 PolicySet(unit, mem, buf, DO_NOT_LEARNf, 0x1); 7865 break; 7866 7867 case bcmFieldActionDoNotCheckVlan: 7868 PolicySet(unit, mem, buf, DISABLE_VLAN_CHECKSf, 0x1); 7869 break; 7870 7871 case bcmFieldActionEnableVlanCheck: 7872 PolicySet(unit, mem, buf, DISABLE_VLAN_CHECKSf, 0); 7873 break; 7874 7875 #if defined(BCM_TRIUMPH3_SUPPORT) 7876 case bcmFieldActionEsmSearchKeySrcMac: 7877 if (soc_feature(unit, soc_feature_esm_support)) { 7878 PolicySet(unit, mem, buf, ESM_SEARCH_PRIORITYf, 0x7); 7879 PolicySet(unit, mem, buf, ESM_SEARCH_OFFSETf, 0x1); 7880 } 7881 break; 7882 #endif 7883 7884 case bcmFieldActionInnerVlanNew: 7885 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7886 PolicySet(unit, mem, buf, INNER_VLAN_ACTIONSf, 0x2); 7887 PolicySet(unit, mem, buf, NEW_INNER_VLANf, fa->param[0]); 7888 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 7889 PolicySet(unit, mem, buf, PID_REPLACE_INNER_VIDf, 0x1); 7890 PolicySet(unit, mem, buf, PID_NEW_INNER_VIDf, fa->param[0]); 7891 #ifdef BCM_TRIDENT2_SUPPORT 7892 if (SOC_IS_TD2_TT2(unit)) { 7893 PolicySet(unit, mem, buf, VXLAN_ACTIONf, 0); 7894 } 7895 #endif 7896 } 7897 break; 7898 7899 case bcmFieldActionInnerVlanCopyOuter: 7900 PolicySet(unit, mem, buf, INNER_VLAN_ACTIONSf, 4); 7901 break; 7902 7903 case bcmFieldActionOuterVlanNew: 7904 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 7905 PolicySet(unit, mem, buf, OUTER_VLAN_ACTIONSf, 0x2); 7906 PolicySet(unit, mem, buf, NEW_OUTER_VLANf, fa->param[0]); 7907 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 7908 PolicySet(unit, mem, buf, PID_REPLACE_OUTER_VIDf, 0x1); 7909 PolicySet(unit, mem, buf, PID_NEW_OUTER_VIDf, fa->param[0]); 7910 #ifdef BCM_TRIDENT2_SUPPORT 7911 if (SOC_IS_TD2_TT2(unit)) { 7912 if (!(soc_feature(unit, soc_feature_th3_style_fp))) { 7913 PolicySet(unit, mem, buf, VXLAN_ACTIONf, 0); 7914 } 7915 } 7916 #endif 7917 } else { 7918 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x1); 7919 if (SOC_MEM_FIELD_VALID(unit, mem, ECMPf)) { 7920 PolicySet(unit, mem, buf, ECMPf, 0); 7921 } 7922 PolicySet(unit, mem, buf, NEXT_HOP_INDEXf, fa->hw_index); 7923 } 7924 break; 7925 7926 case bcmFieldActionOuterVlanCopyInner: 7927 PolicySet(unit, mem, buf, OUTER_VLAN_ACTIONSf, 4); 7928 break; 7929 7930 case bcmFieldActionSrcMacNew: 7931 case bcmFieldActionDstMacNew: 7932 if (SOC_IS_TD_TT(unit) 7933 || SOC_IS_TRIUMPH2(unit) 7934 || SOC_IS_APOLLO(unit) 7935 || SOC_IS_KATANAX(unit) 7936 || SOC_IS_ENDURO(unit) 7937 || SOC_IS_HURRICANEX(unit) 7938 || SOC_IS_TRIUMPH3(unit) 7939 || SOC_IS_GREYHOUND(unit) 7940 || SOC_IS_GREYHOUND2(unit) 7941 ) { 7942 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x1); 7943 } else { 7944 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x4); 7945 } 7946 if (SOC_MEM_FIELD_VALID(unit, mem, ECMPf)) { 7947 PolicySet(unit, mem, buf, ECMPf, 0); 7948 } 7949 PolicySet(unit, mem, buf, NEXT_HOP_INDEXf, fa->hw_index); 7950 break; 7951 case bcmFieldActionVnTagNew: 7952 case bcmFieldActionVnTagDelete: 7953 case bcmFieldActionEtagNew: 7954 case bcmFieldActionEtagDelete: 7955 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x1); 7956 if (SOC_MEM_FIELD_VALID(unit, mem, ECMPf)) { 7957 PolicySet(unit, mem, buf, ECMPf, 0); 7958 } 7959 PolicySet(unit, mem, buf, NEXT_HOP_INDEXf, fa->hw_index); 7960 break; 7961 case bcmFieldActionOuterTpidNew: 7962 BCM_IF_ERROR_RETURN(_bcm_field_tpid_hw_encode(unit, fa->param[0], &mode)); 7963 PolicySet(unit, mem, buf, PID_REPLACE_OUTER_TPIDf, 1); 7964 PolicySet(unit, mem, buf, PID_OUTER_TPID_INDEXf, mode); 7965 #ifdef BCM_TRIDENT2_SUPPORT 7966 if (SOC_IS_TD2_TT2(unit)) { 7967 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 7968 if (!(soc_feature(unit, soc_feature_th3_style_fp))) { 7969 PolicySet(unit, mem, buf, VXLAN_ACTIONf, 0); 7970 } 7971 } 7972 } 7973 #endif 7974 break; 7975 7976 case bcmFieldActionMirrorOverride: 7977 PolicySet(unit, mem, buf, MIRROR_OVERRIDEf, 1); 7978 break; 7979 7980 case bcmFieldActionDoNotChangeTtl: 7981 PolicySet(unit, mem, buf, DO_NOT_CHANGE_TTLf, 1); 7982 break; 7983 7984 case bcmFieldActionDoNotCheckUrpf: 7985 PolicySet(unit, mem, buf, DO_NOT_URPFf, 1); 7986 break; 7987 7988 case bcmFieldActionCnmCancel: 7989 PolicySet(unit, mem, buf, DO_NOT_GENERATE_CNMf, 1); 7990 break; 7991 #if defined(BCM_TRIDENT_SUPPORT) 7992 case bcmFieldActionDynamicHgTrunkCancel: 7993 #if defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) 7994 if (SOC_IS_TRIUMPH3(unit) 7995 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 7996 PolicySet(unit, mem, buf, HGT_DLB_DISABLEf, 1); 7997 } 7998 #endif 7999 if (SOC_IS_TRIDENT(unit)) { 8000 PolicySet(unit, mem, buf, DISABLE_DYNAMIC_LOAD_BALANCINGf, 1); 8001 } 8002 break; 8003 #endif 8004 case bcmFieldActionMirrorIngress: /* param0=modid, param1=port/tgid */ 8005 BCM_IF_ERROR_RETURN 8006 (_bcm_field_trx_mirror_ingress_add(unit, mem, f_ent, fa, buf)); 8007 break; 8008 case bcmFieldActionMirrorEgress: /* param0=modid, param1=port/tgid */ 8009 BCM_IF_ERROR_RETURN 8010 (_bcm_field_trx_mirror_egress_add(unit, mem, f_ent, fa, buf)); 8011 break; 8012 case bcmFieldActionOffloadRedirect: 8013 case bcmFieldActionRedirect: 8014 case bcmFieldActionRedirectTrunk: 8015 case bcmFieldActionRedirectCancel: 8016 case bcmFieldActionRedirectPbmp: 8017 #ifdef INCLUDE_L3 8018 case bcmFieldActionRedirectIpmc: 8019 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 8020 case bcmFieldActionMacSecRedirectIpmc: 8021 #endif /* BCM_MONTEREY_SUPPORT && INCLUDE_XFLOW_MACSEC*/ 8022 #endif /* INCLUDE_L3 */ 8023 case bcmFieldActionRedirectMcast: 8024 case bcmFieldActionRedirectVlan: 8025 case bcmFieldActionRedirectBcastPbmp: 8026 case bcmFieldActionEgressMask: 8027 case bcmFieldActionEgressPortsAdd: 8028 #if defined(BCM_TRIUMPH3_SUPPORT) 8029 case bcmFieldActionUnmodifiedPacketRedirectPort: 8030 #endif 8031 BCM_IF_ERROR_RETURN 8032 (_field_trx_action_redirect(unit, mem, f_ent, fa, buf)); 8033 break; 8034 case bcmFieldActionOffloadDropIndication: 8035 PolicySet(unit, mem, buf, SPLIT_DROP_RESOLVEf, 0x1); 8036 break; 8037 case bcmFieldActionOffloadClassSet: 8038 if (SOC_MEM_FIELD_VALID(unit, mem, G_L3SW_CHANGE_L2_FIELDSf)) { 8039 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x4); 8040 } 8041 PolicySet(unit, mem, buf, PPD3_CLASS_TAGf, fa->param[0]); 8042 break; 8043 case bcmFieldActionRpDrop: 8044 PolicySet(unit, mem, buf, R_DROPf, 0x1); 8045 break; 8046 case bcmFieldActionRpDropCancel: 8047 PolicySet(unit, mem, buf, R_DROPf, 0x2); 8048 break; 8049 case bcmFieldActionRpDropPrecedence: 8050 PolicySet(unit, mem, buf, R_DROP_PRECEDENCEf, fa->param[0]); 8051 break; 8052 case bcmFieldActionRpSwitchToCpuCancel: 8053 value = SWITCH_TO_CPU_CANCEL; 8054 #if defined(BCM_TRIUMPH3_SUPPORT) 8055 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 8056 SOC_IS_KATANA2(unit)) { 8057 if (COPY_TO_CPU_CANCEL == 8058 PolicyGet(unit, mem, buf, R_COPY_TO_CPUf)) { 8059 8060 value = COPY_AND_SWITCH_TO_CPU_CANCEL; 8061 } 8062 } 8063 #endif 8064 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, value); 8065 break; 8066 case bcmFieldActionRpSwitchToCpuReinstate: 8067 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x4); 8068 break; 8069 case bcmFieldActionRpPrioPktCopy: 8070 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x4); 8071 break; 8072 case bcmFieldActionRpPrioPktNew: 8073 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x5); 8074 PolicySet(unit, mem, buf, R_NEW_PKT_PRIf, fa->param[0]); 8075 break; 8076 case bcmFieldActionRpPrioPktTos: 8077 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x6); 8078 break; 8079 case bcmFieldActionRpPrioPktCancel: 8080 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x7); 8081 break; 8082 case bcmFieldActionRpEcnNew: 8083 BCM_IF_ERROR_RETURN 8084 (_field_trx_action_ecn_update (unit, mem, f_ent, fa, buf)); 8085 break; 8086 case bcmFieldActionRpDscpNew: 8087 PolicySet(unit, mem, buf, R_CHANGE_DSCPf, 0x1); 8088 PolicySet(unit, mem, buf, R_NEW_DSCPf, fa->param[0]); 8089 break; 8090 case bcmFieldActionRpDscpCancel: 8091 PolicySet(unit, mem, buf, R_CHANGE_DSCPf, 0x2); 8092 break; 8093 case bcmFieldActionRpCosQNew: 8094 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 8095 if (SOC_IS_TD_TT(unit)) { 8096 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, 8097 mem, f_ent, tcam_idx, fa, buf)); 8098 } else 8099 #endif 8100 #if defined(BCM_KATANA_SUPPORT) 8101 if (SOC_IS_KATANAX(unit) && BCM_GPORT_IS_SET(fa->param[0])) { 8102 BCM_IF_ERROR_RETURN (_field_kt_action_update(unit, mem, 8103 f_ent, tcam_idx, fa, buf)); 8104 } else 8105 #endif 8106 #if defined(BCM_GREYHOUND2_SUPPORT) 8107 if (SOC_IS_GREYHOUND2(unit)) { 8108 BCM_IF_ERROR_RETURN( 8109 _field_gh2_action_update(unit, mem, f_ent, tcam_idx, fa, buf)); 8110 } else 8111 #endif /* BCM_GREYHOUND2_SUPPORT */ 8112 { 8113 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x1); 8114 PolicySet(unit, mem, buf, R_COS_INT_PRIf, fa->param[0]); 8115 } 8116 break; 8117 case bcmFieldActionRpVlanCosQNew: 8118 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x2); 8119 /* Add 8 to the value since VLAN shaping queues are 8..23 */ 8120 PolicySet(unit, mem, buf, R_COS_INT_PRIf, fa->param[0] + 8); 8121 break; 8122 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 8123 case bcmFieldActionRpUcastCosQNew: 8124 #if defined(BCM_KATANA_SUPPORT) 8125 if (SOC_IS_KATANAX(unit)) { 8126 BCM_IF_ERROR_RETURN (_field_kt_action_update(unit, mem, 8127 f_ent, tcam_idx, fa, buf)); 8128 } else 8129 #endif 8130 { 8131 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, 8132 mem, f_ent, tcam_idx, fa, buf)); 8133 } 8134 break; 8135 case bcmFieldActionRpMcastCosQNew: 8136 BCM_IF_ERROR_RETURN(_bcm_field_trx_ucast_mcast_action_update(unit, mem, 8137 f_ent, tcam_idx, fa, buf)); 8138 break; 8139 #endif /* !BCM_TRIDENT_SUPPORT */ 8140 case bcmFieldActionRpPrioPktAndIntCopy: 8141 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x4); 8142 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x4); 8143 break; 8144 case bcmFieldActionRpPrioPktAndIntNew: 8145 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x5); 8146 PolicySet(unit, mem, buf, R_NEW_PKT_PRIf, fa->param[0]); 8147 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x5); 8148 PolicySet(unit, mem, buf, R_COS_INT_PRIf, (0xf & fa->param[0])); 8149 break; 8150 case bcmFieldActionRpPrioPktAndIntTos: 8151 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x6); 8152 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x6); 8153 break; 8154 case bcmFieldActionRpPrioPktAndIntCancel: 8155 PolicySet(unit, mem, buf, R_CHANGE_PKT_PRIf, 0x7); 8156 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x7); 8157 break; 8158 case bcmFieldActionRpOuterVlanPrioNew: 8159 PolicySet(unit, mem, buf, R_CHANGE_DOT1Pf, 0x1); 8160 PolicySet(unit, mem, buf, R_NEW_DOT1Pf, fa->param[0]); 8161 break; 8162 case bcmFieldActionRpInnerVlanPrioNew: 8163 PolicySet(unit, mem, buf, R_REPLACE_INNER_PRIf, 0x1); 8164 PolicySet(unit, mem, buf, R_NEW_INNER_PRIf, fa->param[0]); 8165 break; 8166 case bcmFieldActionRpOuterVlanCfiNew: 8167 PolicySet(unit, mem, buf, R_CHANGE_OUTER_CFIf, 0x1); 8168 PolicySet(unit, mem, buf, R_NEW_OUTER_CFIf, fa->param[0]); 8169 break; 8170 case bcmFieldActionRpInnerVlanCfiNew: 8171 PolicySet(unit, mem, buf, R_CHANGE_INNER_CFIf, 0x1); 8172 PolicySet(unit, mem, buf, R_NEW_INNER_CFIf, fa->param[0]); 8173 break; 8174 case bcmFieldActionRpPrioIntCopy: 8175 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x4); 8176 break; 8177 case bcmFieldActionRpPrioIntNew: 8178 #if defined BCM_KATANA2_SUPPORT 8179 if ((_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) 8180 && SOC_IS_KATANA2(unit)) { 8181 PolicySet(unit, mem, buf, R_CHANGE_REDIR_INT_PRIf, 0x1); 8182 PolicySet(unit, mem, buf, R_NEW_REDIR_INT_PRIf, (0xf & fa->param[0])); 8183 } else 8184 #endif 8185 { 8186 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x5); 8187 PolicySet(unit, mem, buf, R_COS_INT_PRIf, (0xf & fa->param[0])); 8188 } 8189 break; 8190 case bcmFieldActionRpPrioIntTos: 8191 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x6); 8192 break; 8193 case bcmFieldActionRpPrioIntCancel: 8194 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 0x7); 8195 break; 8196 case bcmFieldActionYpDrop: 8197 PolicySet(unit, mem, buf, Y_DROPf, 0x1); 8198 break; 8199 case bcmFieldActionYpDropCancel: 8200 PolicySet(unit, mem, buf, Y_DROPf, 0x2); 8201 break; 8202 case bcmFieldActionYpDropPrecedence: 8203 PolicySet(unit, mem, buf, Y_DROP_PRECEDENCEf, fa->param[0]); 8204 break; 8205 case bcmFieldActionYpSwitchToCpuCancel: 8206 value = SWITCH_TO_CPU_CANCEL; 8207 #if defined(BCM_TRIUMPH3_SUPPORT) 8208 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 8209 SOC_IS_KATANA2(unit)) { 8210 if (COPY_TO_CPU_CANCEL == 8211 PolicyGet(unit, mem, buf, Y_COPY_TO_CPUf)) { 8212 8213 value = COPY_AND_SWITCH_TO_CPU_CANCEL; 8214 } 8215 } 8216 #endif 8217 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, value); 8218 break; 8219 case bcmFieldActionYpSwitchToCpuReinstate: 8220 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x4); 8221 break; 8222 case bcmFieldActionYpPrioPktCopy: 8223 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x4); 8224 break; 8225 case bcmFieldActionYpPrioPktNew: 8226 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x5); 8227 PolicySet(unit, mem, buf, Y_NEW_PKT_PRIf, fa->param[0]); 8228 break; 8229 case bcmFieldActionYpPrioPktTos: 8230 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x6); 8231 break; 8232 case bcmFieldActionYpPrioPktCancel: 8233 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x7); 8234 break; 8235 case bcmFieldActionYpEcnNew: 8236 BCM_IF_ERROR_RETURN 8237 (_field_trx_action_ecn_update (unit, mem, f_ent, fa, buf)); 8238 break; 8239 case bcmFieldActionYpDscpNew: 8240 PolicySet(unit, mem, buf, Y_CHANGE_DSCPf, 0x1); 8241 PolicySet(unit, mem, buf, Y_NEW_DSCPf, fa->param[0]); 8242 break; 8243 case bcmFieldActionYpDscpCancel: 8244 PolicySet(unit, mem, buf, Y_CHANGE_DSCPf, 0x2); 8245 break; 8246 case bcmFieldActionYpCosQNew: 8247 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 8248 if (SOC_IS_TD_TT(unit)) { 8249 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, 8250 mem, f_ent, tcam_idx, fa, buf)); 8251 } else 8252 #endif 8253 #if defined(BCM_KATANA_SUPPORT) 8254 if (SOC_IS_KATANAX(unit) && BCM_GPORT_IS_SET(fa->param[0])) { 8255 BCM_IF_ERROR_RETURN (_field_kt_action_update(unit, mem, 8256 f_ent, tcam_idx, fa, buf)); 8257 } else 8258 #endif 8259 #if defined(BCM_GREYHOUND2_SUPPORT) 8260 if (SOC_IS_GREYHOUND2(unit)) { 8261 BCM_IF_ERROR_RETURN( 8262 _field_gh2_action_update(unit, mem, f_ent, tcam_idx, fa, buf)); 8263 } else 8264 #endif /* BCM_GREYHOUND2_SUPPORT */ 8265 { 8266 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x1); 8267 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, fa->param[0]); 8268 } 8269 break; 8270 case bcmFieldActionYpVlanCosQNew: 8271 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x2); 8272 /* Add 8 to the value since VLAN shaping queues are 8..23 */ 8273 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, fa->param[0] + 8); 8274 break; 8275 8276 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 8277 case bcmFieldActionYpUcastCosQNew: 8278 #if defined(BCM_KATANA_SUPPORT) 8279 if (SOC_IS_KATANAX(unit)) { 8280 BCM_IF_ERROR_RETURN (_field_kt_action_update(unit, mem, 8281 f_ent, tcam_idx, fa, buf)); 8282 } else 8283 #endif 8284 { 8285 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, 8286 mem, f_ent, tcam_idx, fa, buf)); 8287 } 8288 break; 8289 case bcmFieldActionYpMcastCosQNew: 8290 BCM_IF_ERROR_RETURN(_bcm_field_trx_ucast_mcast_action_update(unit, mem, 8291 f_ent, tcam_idx, fa, buf)); 8292 break; 8293 #endif /* !BCM_TRIDENT_SUPPORT */ 8294 case bcmFieldActionYpPrioPktAndIntCopy: 8295 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x4); 8296 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x4); 8297 break; 8298 case bcmFieldActionYpPrioPktAndIntNew: 8299 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x5); 8300 PolicySet(unit, mem, buf, Y_NEW_PKT_PRIf, fa->param[0]); 8301 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x5); 8302 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, (0xf & fa->param[0])); 8303 break; 8304 case bcmFieldActionYpPrioPktAndIntTos: 8305 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x6); 8306 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x6); 8307 break; 8308 case bcmFieldActionYpPrioPktAndIntCancel: 8309 PolicySet(unit, mem, buf, Y_CHANGE_PKT_PRIf, 0x7); 8310 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x7); 8311 break; 8312 case bcmFieldActionYpOuterVlanPrioNew: 8313 PolicySet(unit, mem, buf, Y_CHANGE_DOT1Pf, 0x1); 8314 PolicySet(unit, mem, buf, Y_NEW_DOT1Pf, fa->param[0]); 8315 break; 8316 case bcmFieldActionYpInnerVlanPrioNew: 8317 PolicySet(unit, mem, buf, Y_REPLACE_INNER_PRIf, 0x1); 8318 PolicySet(unit, mem, buf, Y_NEW_INNER_PRIf, fa->param[0]); 8319 break; 8320 case bcmFieldActionYpOuterVlanCfiNew: 8321 PolicySet(unit, mem, buf, Y_CHANGE_OUTER_CFIf, 0x1); 8322 PolicySet(unit, mem, buf, Y_NEW_OUTER_CFIf, fa->param[0]); 8323 break; 8324 case bcmFieldActionYpInnerVlanCfiNew: 8325 PolicySet(unit, mem, buf, Y_CHANGE_INNER_CFIf, 0x1); 8326 PolicySet(unit, mem, buf, Y_NEW_INNER_CFIf, fa->param[0]); 8327 break; 8328 case bcmFieldActionYpPrioIntCopy: 8329 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x4); 8330 break; 8331 case bcmFieldActionYpPrioIntNew: 8332 #if defined BCM_KATANA2_SUPPORT 8333 if ((_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) 8334 && SOC_IS_KATANA2(unit)) { 8335 PolicySet(unit, mem, buf, Y_CHANGE_REDIR_INT_PRIf, 0x1); 8336 PolicySet(unit, mem, buf, Y_NEW_REDIR_INT_PRIf, (0xf & fa->param[0])); 8337 } else 8338 #endif 8339 { 8340 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x5); 8341 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, (0xf & fa->param[0])); 8342 } 8343 break; 8344 case bcmFieldActionYpPrioIntTos: 8345 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x6); 8346 break; 8347 case bcmFieldActionYpPrioIntCancel: 8348 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 0x7); 8349 break; 8350 case bcmFieldActionGpDrop: 8351 PolicySet(unit, mem, buf, G_DROPf, 0x1); 8352 break; 8353 case bcmFieldActionGpDropCancel: 8354 PolicySet(unit, mem, buf, G_DROPf, 0x2); 8355 break; 8356 case bcmFieldActionGpDropPrecedence: 8357 PolicySet(unit, mem, buf, G_DROP_PRECEDENCEf, fa->param[0]); 8358 break; 8359 case bcmFieldActionGpSwitchToCpuCancel: 8360 value = SWITCH_TO_CPU_CANCEL; 8361 #if defined(BCM_TRIUMPH3_SUPPORT) 8362 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 8363 SOC_IS_KATANA2(unit)) { 8364 if (COPY_TO_CPU_CANCEL == 8365 PolicyGet(unit, mem, buf, G_COPY_TO_CPUf)) { 8366 8367 value = COPY_AND_SWITCH_TO_CPU_CANCEL; 8368 } 8369 } 8370 #endif 8371 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, value); 8372 break; 8373 case bcmFieldActionGpSwitchToCpuReinstate: 8374 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x4); 8375 break; 8376 case bcmFieldActionGpPrioPktCopy: 8377 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x4); 8378 break; 8379 case bcmFieldActionGpPrioPktNew: 8380 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x5); 8381 PolicySet(unit, mem, buf, G_NEW_PKT_PRIf, fa->param[0]); 8382 break; 8383 case bcmFieldActionGpPrioPktTos: 8384 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x6); 8385 break; 8386 case bcmFieldActionGpPrioPktCancel: 8387 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x7); 8388 break; 8389 case bcmFieldActionGpEcnNew: 8390 BCM_IF_ERROR_RETURN 8391 (_field_trx_action_ecn_update (unit, mem, f_ent, fa, buf)); 8392 break; 8393 case bcmFieldActionGpTosPrecedenceNew: 8394 PolicySet(unit, mem, buf, G_CHANGE_DSCP_TOSf, 0x1); 8395 PolicySet(unit, mem, buf, G_NEW_DSCP_TOSf, fa->param[0]); 8396 break; 8397 case bcmFieldActionGpTosPrecedenceCopy: 8398 PolicySet(unit, mem, buf, G_CHANGE_DSCP_TOSf, 0x2); 8399 break; 8400 case bcmFieldActionGpDscpNew: 8401 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 8402 PolicySet(unit, mem, buf, G_CHANGE_DSCPf, 1); 8403 PolicySet(unit, mem, buf, G_NEW_DSCPf, fa->param[0]); 8404 } else { 8405 PolicySet(unit, mem, buf, G_CHANGE_DSCP_TOSf, 0x3); 8406 PolicySet(unit, mem, buf, G_NEW_DSCP_TOSf, fa->param[0]); 8407 } 8408 break; 8409 case bcmFieldActionGpDscpCancel: 8410 PolicySet(unit, mem, buf, G_CHANGE_DSCP_TOSf, 0x4); 8411 break; 8412 case bcmFieldActionGpCosQNew: 8413 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 8414 if (SOC_IS_TD_TT(unit)) { 8415 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, 8416 mem, f_ent, tcam_idx, fa, buf)); 8417 } else 8418 #endif 8419 #if defined(BCM_KATANA_SUPPORT) 8420 if (SOC_IS_KATANAX(unit) && BCM_GPORT_IS_SET(fa->param[0])) { 8421 BCM_IF_ERROR_RETURN (_field_kt_action_update(unit, mem, 8422 f_ent, tcam_idx, fa, buf)); 8423 } else 8424 #endif 8425 #if defined(BCM_GREYHOUND2_SUPPORT) 8426 if (SOC_IS_GREYHOUND2(unit)) { 8427 BCM_IF_ERROR_RETURN( 8428 _field_gh2_action_update(unit, mem, f_ent, tcam_idx, fa, buf)); 8429 } else 8430 #endif /* BCM_GREYHOUND2_SUPPORT */ 8431 { 8432 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x1); 8433 PolicySet(unit, mem, buf, G_COS_INT_PRIf, fa->param[0]); 8434 } 8435 break; 8436 case bcmFieldActionGpVlanCosQNew: 8437 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x2); 8438 /* Add 8 to the value since VLAN shaping queues are 8..23 */ 8439 PolicySet(unit, mem, buf, G_COS_INT_PRIf, fa->param[0] + 8); 8440 break; 8441 8442 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 8443 case bcmFieldActionGpUcastCosQNew: 8444 #if defined(BCM_KATANA_SUPPORT) 8445 if (SOC_IS_KATANAX(unit)) { 8446 BCM_IF_ERROR_RETURN (_field_kt_action_update(unit, mem, 8447 f_ent, tcam_idx, fa, buf)); 8448 } else 8449 #endif 8450 { 8451 BCM_IF_ERROR_RETURN (_bcm_field_trx_ucast_mcast_action_update(unit, 8452 mem, f_ent, tcam_idx, fa, buf)); 8453 } 8454 break; 8455 case bcmFieldActionGpMcastCosQNew: 8456 BCM_IF_ERROR_RETURN(_bcm_field_trx_ucast_mcast_action_update(unit, mem, 8457 f_ent, tcam_idx, fa, buf)); 8458 break; 8459 #endif /* !BCM_TRIDENT_SUPPORT */ 8460 case bcmFieldActionGpPrioPktAndIntCopy: 8461 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x4); 8462 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x4); 8463 break; 8464 case bcmFieldActionGpPrioPktAndIntNew: 8465 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x5); 8466 PolicySet(unit, mem, buf, G_NEW_PKT_PRIf, fa->param[0]); 8467 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x5); 8468 PolicySet(unit, mem, buf, G_COS_INT_PRIf, (0xf & fa->param[0])); 8469 break; 8470 case bcmFieldActionGpPrioPktAndIntTos: 8471 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x6); 8472 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x6); 8473 break; 8474 case bcmFieldActionGpPrioPktAndIntCancel: 8475 PolicySet(unit, mem, buf, G_CHANGE_PKT_PRIf, 0x7); 8476 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x7); 8477 break; 8478 case bcmFieldActionGpOuterVlanPrioNew: 8479 PolicySet(unit, mem, buf, G_CHANGE_DOT1Pf, 0x1); 8480 PolicySet(unit, mem, buf, G_NEW_DOT1Pf, fa->param[0]); 8481 break; 8482 case bcmFieldActionGpInnerVlanPrioNew: 8483 PolicySet(unit, mem, buf, G_REPLACE_INNER_PRIf, 0x1); 8484 PolicySet(unit, mem, buf, G_NEW_INNER_PRIf, fa->param[0]); 8485 break; 8486 case bcmFieldActionGpOuterVlanCfiNew: 8487 PolicySet(unit, mem, buf, G_CHANGE_OUTER_CFIf, 0x1); 8488 PolicySet(unit, mem, buf, G_NEW_OUTER_CFIf, fa->param[0]); 8489 break; 8490 case bcmFieldActionGpInnerVlanCfiNew: 8491 PolicySet(unit, mem, buf, G_CHANGE_INNER_CFIf, 0x1); 8492 PolicySet(unit, mem, buf, G_NEW_INNER_CFIf, fa->param[0]); 8493 break; 8494 case bcmFieldActionGpPrioIntCopy: 8495 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x4); 8496 break; 8497 case bcmFieldActionGpPrioIntNew: 8498 #if defined BCM_KATANA2_SUPPORT 8499 if ((_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) 8500 && SOC_IS_KATANA2(unit)) { 8501 PolicySet(unit, mem, buf, G_CHANGE_REDIR_INT_PRIf, 0x1); 8502 PolicySet(unit, mem, buf, G_NEW_REDIR_INT_PRIf, (0xf & fa->param[0])); 8503 } else 8504 #endif 8505 { 8506 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x5); 8507 PolicySet(unit, mem, buf, G_COS_INT_PRIf, (0xf & fa->param[0])); 8508 } 8509 break; 8510 case bcmFieldActionGpPrioIntTos: 8511 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x6); 8512 break; 8513 case bcmFieldActionGpPrioIntCancel: 8514 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 0x7); 8515 break; 8516 case bcmFieldActionAddClassTag: 8517 if (SOC_MEM_FIELD_VALID(unit, mem, G_L3SW_CHANGE_L2_FIELDSf)) { 8518 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x4); 8519 } else { 8520 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x3); 8521 } 8522 PolicySet(unit, mem, buf, NEXT_HOP_INDEXf, fa->param[0]); 8523 break; 8524 case bcmFieldActionFabricQueue: 8525 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x3); 8526 BCM_IF_ERROR_RETURN 8527 (_field_trx_action_fabricQueue_actions_set(unit, mem, fa, 8528 buf)); 8529 break; 8530 #if defined(BCM_TRIDENT_SUPPORT) 8531 case bcmFieldActionCompressSrcIp6: 8532 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 8533 PolicySet(unit, mem, buf, IPV6_TO_IPV4_MAP_SIP_VALIDf, 0x1); 8534 PolicySet(unit, mem, buf, IPV6_TO_IPV4_MAP_OFFSET_SETf, fa->param[0]); 8535 } 8536 break; 8537 case bcmFieldActionCompressDstIp6: 8538 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 8539 PolicySet(unit, mem, buf, IPV6_TO_IPV4_MAP_DIP_VALIDf, 0x1); 8540 PolicySet(unit, mem, buf, IPV6_TO_IPV4_MAP_OFFSET_SETf, fa->param[0]); 8541 } 8542 break; 8543 #endif /* !BCM_TRIDENT_SUPPORT */ 8544 8545 #ifdef INCLUDE_L3 8546 #if defined(BCM_TRIUMPH_SUPPORT) && defined(BCM_MPLS_SUPPORT) 8547 case bcmFieldActionIncomingMplsPortSet: 8548 if (!BCM_GPORT_IS_MPLS_PORT(fa->param[0])) { 8549 return BCM_E_PARAM; 8550 } 8551 if (((!SOC_IS_TRIDENT2X(unit) && !SOC_IS_TITAN2PLUS(unit))) 8552 && (!soc_feature(unit, soc_feature_field_multi_pipe_support))) { 8553 /* FIELDS_ACTIONSf = 1 for SVP is not valid on Trident2X devices */ 8554 if (SOC_MEM_FIELD_VALID(unit, mem, FIELDS_ACTIONf)) { 8555 PolicySet(unit, mem, buf, FIELDS_ACTIONf, 0x1); 8556 } else { 8557 PolicySet(unit, mem, buf, MPLS_ACTIONf, 0x1); 8558 } 8559 } 8560 svp = BCM_GPORT_MPLS_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8561 PolicySet(unit, mem, buf, SVPf, svp); 8562 8563 /* Search for Action EnableVlanCheck */ 8564 for (fa_temp = f_ent->actions; (NULL != fa_temp) && 8565 (bcmFieldActionEnableVlanCheck != fa_temp->action); fa_temp=fa_temp->next); 8566 8567 if ((NULL == fa_temp)) { 8568 /* 8569 * Set DISABLE_VLAN_CHECKSf if bcmFieldActionEnableVlanCheck 8570 * is not being added earlier 8571 */ 8572 PolicySet(unit, mem, buf, DISABLE_VLAN_CHECKSf, 1); 8573 } 8574 8575 if (((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) 8576 || (soc_feature(unit, soc_feature_field_multi_pipe_support))) { 8577 PolicySet(unit, mem, buf, SVP_VALIDf, 1); 8578 } 8579 break; 8580 #endif 8581 case bcmFieldActionVpnSet: 8582 if(!(soc_feature(unit, soc_feature_vfi_from_vlan_tables) || 8583 soc_feature(unit, soc_feature_vxlan_lite))) { 8584 return BCM_E_UNAVAIL; 8585 } 8586 /* for vxlan*/ 8587 if (_BCM_VPN_VFI_IS_SET((bcm_vpn_t)fa->param[0])) { 8588 _BCM_VPN_GET(vfi, _BCM_VPN_TYPE_VFI, 8589 (bcm_vpn_t)fa->param[0]); 8590 } else { 8591 return BCM_E_PARAM; 8592 } 8593 #ifdef BCM_GREYHOUND2_SUPPORT 8594 if (SOC_IS_GREYHOUND2(unit)) { 8595 /* Setting FIELDS_ACTIONf to resolve the overlay fields with VFIf */ 8596 if (SOC_MEM_FIELD_VALID(unit, mem, FIELDS_ACTIONf)) { 8597 PolicySet(unit, mem, buf, FIELDS_ACTIONf, 0x5); 8598 } 8599 } 8600 #endif /* BCM_GREYHOUND2_SUPPORT */ 8601 PolicySet(unit, mem, buf, VFIf, vfi); 8602 break; 8603 case bcmFieldActionIngressGportSet: 8604 if ((!SOC_IS_TRIDENT2X(unit) && !SOC_IS_TITAN2PLUS(unit)) 8605 && !(soc_feature(unit, soc_feature_field_multi_pipe_support))) { 8606 /* FIELDS_ACTIONSf = 1 for SVP is not valid on Trident2 */ 8607 if (SOC_MEM_FIELD_VALID(unit, mem, FIELDS_ACTIONf)) { 8608 PolicySet(unit, mem, buf, FIELDS_ACTIONf, 0x1); 8609 } else { 8610 PolicySet(unit, mem, buf, MPLS_ACTIONf, 0x1); 8611 } 8612 } 8613 { 8614 uint8 vlan_disable_flg = 0; 8615 8616 if (BCM_GPORT_IS_MPLS_PORT(fa->param[0])) { 8617 svp = BCM_GPORT_MPLS_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8618 vlan_disable_flg = 1; 8619 } else if (BCM_GPORT_IS_MIM_PORT(fa->param[0])) { 8620 svp = BCM_GPORT_MIM_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8621 vlan_disable_flg = 1; 8622 } else if (BCM_GPORT_IS_L2GRE_PORT(fa->param[0])) { 8623 svp = BCM_GPORT_L2GRE_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8624 vlan_disable_flg = 0; 8625 } else if (BCM_GPORT_IS_WLAN_PORT(fa->param[0])) { 8626 svp = BCM_GPORT_WLAN_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8627 vlan_disable_flg = 0; 8628 } else if (BCM_GPORT_IS_TRILL_PORT(fa->param[0])) { 8629 svp = BCM_GPORT_TRILL_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8630 vlan_disable_flg = 0; 8631 } else if (BCM_GPORT_IS_NIV_PORT(fa->param[0])) { 8632 svp = BCM_GPORT_NIV_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8633 vlan_disable_flg = 0; 8634 } else if (BCM_GPORT_IS_VXLAN_PORT(fa->param[0])) { 8635 svp = BCM_GPORT_VXLAN_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8636 vlan_disable_flg = 1; 8637 } else if (BCM_GPORT_IS_FLOW_PORT(fa->param[0])) { 8638 svp = BCM_GPORT_FLOW_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8639 vlan_disable_flg = 1; 8640 } else if (BCM_GPORT_IS_VLAN_PORT(fa->param[0])) { 8641 svp = BCM_GPORT_VLAN_PORT_ID_GET((bcm_gport_t)fa->param[0]); 8642 vlan_disable_flg = 0; 8643 } else { 8644 return BCM_E_PARAM; 8645 } 8646 PolicySet(unit, mem, buf, SVPf, svp); 8647 if (vlan_disable_flg == 1) { 8648 8649 /* Search for Action EnableCheckVlan */ 8650 for (fa_temp = f_ent->actions; (NULL != fa_temp) && 8651 (bcmFieldActionEnableVlanCheck != fa_temp->action); fa_temp=fa_temp->next); 8652 8653 if ((NULL == fa_temp)) { 8654 /* 8655 * Set DISABLE_VLAN_CHECKSf if bcmFieldActionEnableVlanCheck 8656 * is not being added earlier 8657 */ 8658 PolicySet(unit, mem, buf, DISABLE_VLAN_CHECKSf, 1); 8659 } 8660 } 8661 8662 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 8663 || (soc_feature(unit, soc_feature_field_multi_pipe_support))) { 8664 PolicySet(unit, mem, buf, SVP_VALIDf, 1); 8665 } 8666 } 8667 break; 8668 case bcmFieldActionL3IngressSet: 8669 if (SOC_MEM_FIELD_VALID(unit, mem, FIELDS_ACTIONf)) { 8670 PolicySet(unit, mem, buf, FIELDS_ACTIONf, 0x2); 8671 } else { 8672 PolicySet(unit, mem, buf, MPLS_ACTIONf, 0x2); 8673 } 8674 PolicySet(unit, mem, buf, L3_IIFf, fa->param[0]); 8675 break; 8676 case bcmFieldActionL3ChangeVlan: 8677 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x1); 8678 BCM_IF_ERROR_RETURN 8679 (_field_trx_policy_set_l3_info(unit, mem, fa->param[0], buf)); 8680 break; 8681 case bcmFieldActionL3ChangeVlanCancel: 8682 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x2); 8683 break; 8684 case bcmFieldActionL3ChangeMacDa: 8685 if (SOC_MEM_FIELD_VALID(unit, mem, G_L3SW_CHANGE_L2_FIELDSf)) { 8686 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x1); 8687 } else { 8688 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x4); 8689 } 8690 BCM_IF_ERROR_RETURN 8691 (_field_trx_policy_set_l3_info(unit, mem, fa->param[0], buf)); 8692 break; 8693 case bcmFieldActionL3ChangeMacDaCancel: 8694 if (SOC_MEM_FIELD_VALID(unit, mem, G_L3SW_CHANGE_L2_FIELDSf)) { 8695 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x2); 8696 } else { 8697 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x5); 8698 } 8699 break; 8700 case bcmFieldActionL3Switch: 8701 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x6); 8702 BCM_IF_ERROR_RETURN 8703 (_field_trx_policy_set_l3_info(unit, mem, fa->param[0], buf)); 8704 break; 8705 case bcmFieldActionL3SwitchCancel: 8706 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x7); 8707 break; 8708 #endif /* INCLUDE_L3 */ 8709 case bcmFieldActionOamUpMep: 8710 PolicySet(unit, mem, buf, OAM_UP_MEPf, fa->param[0]); 8711 break; 8712 case bcmFieldActionOamTx: 8713 PolicySet(unit, mem, buf, OAM_TXf, fa->param[0]); 8714 break; 8715 case bcmFieldActionOamLmepMdl: 8716 PolicySet(unit, mem, buf, OAM_LMEP_MDLf, fa->param[0]); 8717 break; 8718 case bcmFieldActionOamServicePriMappingPtr: 8719 PolicySet(unit, mem, buf, OAM_SERVICE_PRI_MAPPING_PTRf, fa->param[0]); 8720 break; 8721 case bcmFieldActionOamLmBasePtr: 8722 PolicySet(unit, mem, buf, OAM_LM_BASE_PTRf, fa->param[0]); 8723 break; 8724 case bcmFieldActionOamDmEnable: 8725 PolicySet(unit, mem, buf, OAM_DM_ENf, fa->param[0]); 8726 break; 8727 #if defined(BCM_KATANA2_SUPPORT) 8728 case bcmFieldActionOamLmDmSampleEnable: 8729 if( (SOC_IS_SABER2(unit)) || (SOC_IS_KATANA2(unit)) ) { 8730 PolicySet(unit, mem, buf, OAM_ENABLE_LM_DM_SAMPLEf, fa->param[0]); 8731 } else { 8732 return (BCM_E_UNAVAIL); 8733 } 8734 break; 8735 #endif 8736 case bcmFieldActionOamLmEnable: 8737 PolicySet(unit, mem, buf, OAM_LM_ENf, fa->param[0]); 8738 break; 8739 case bcmFieldActionOamLmepEnable: 8740 PolicySet(unit, mem, buf, OAM_LMEP_ENf, fa->param[0]); 8741 break; 8742 case bcmFieldActionOamPbbteLookupEnable: 8743 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 8744 PolicySet(unit, mem, buf, OAM_PBBTE_LOOKUP_ENABLEf, fa->param[0]); 8745 } 8746 break; 8747 case bcmFieldActionOamDmTimeFormat: 8748 { 8749 unsigned oam_dm_type; 8750 8751 switch (fa->param[0]) { 8752 case BCM_FIELD_OAM_DM_TIME_FORMAT_IEEE1588: 8753 oam_dm_type = 0; 8754 break; 8755 case BCM_FIELD_OAM_DM_TIME_FORMAT_NTP: 8756 oam_dm_type = 1; 8757 break; 8758 default: 8759 /* Invalid parameter should have been caught earlier */ 8760 return (BCM_E_INTERNAL); 8761 } 8762 8763 PolicySet(unit, mem, buf, OAM_DM_TYPEf, oam_dm_type); 8764 } 8765 break; 8766 case bcmFieldActionOamTagStatusCheck: 8767 PolicySet(unit, mem, buf, OAM_TAG_STATUS_CHECK_CONTROLf, fa->param[0]); 8768 break; 8769 8770 case bcmFieldActionServicePoolIdNew: 8771 PolicySet(unit, mem, buf, CHANGE_CPU_COSf, 0x2); 8772 PolicySet(unit, mem, buf, CPU_COSf, ((fa->param[0] << 2) | 0x20)); 8773 break; 8774 case bcmFieldActionServicePoolIdPrecedenceNew: 8775 PolicySet(unit, mem, buf, CHANGE_CPU_COSf, 0x2); 8776 /* SPAP is 2b'00 for BCM_FIELD_COLOR_GREEN 8777 2b'01 for BCM_FIELD_COLOR_RED 8778 2b'11 for BCM_FIELD_COLOR_YELLOW 8779 */ 8780 value = (0x30 | (fa->param[0] << 2) | \ 8781 ((BCM_FIELD_COLOR_GREEN == fa->param[1]) ? 0 : \ 8782 ((BCM_FIELD_COLOR_YELLOW == fa->param[1]) ? 3 : 1))); 8783 PolicySet(unit, mem, buf, CPU_COSf, value); 8784 break; 8785 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \ 8786 defined(BCM_APACHE_SUPPORT) || defined (BCM_GREYHOUND2_SUPPORT) 8787 case bcmFieldActionUseGlobalMeterColor: 8788 if (_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) { 8789 #if defined(BCM_GREYHOUND2_SUPPORT) 8790 if (soc_feature(unit, soc_feature_global_meter) && 8791 SOC_IS_GREYHOUND2(unit)) { 8792 SOC_IF_ERROR_RETURN( 8793 soc_reg32_get(unit, SVM_TSN_CONTROLr, 8794 REG_PORT_ANY, 0, &value)); 8795 svm_disable = 8796 soc_reg_field_get(unit, SVM_TSN_CONTROLr, 8797 value, SVM_BLOCK_DISABLEf); 8798 if (1 != svm_disable) { 8799 PolicySet(unit, mem, buf, USE_SVC_METER_COLORf, 1); 8800 } 8801 } else 8802 #endif /* BCM_GREYHOUND2_SUPPORT */ 8803 if (soc_feature(unit, soc_feature_global_meter)) { 8804 PolicySet(unit, mem, buf, USE_SVC_METER_COLORf,1); 8805 } 8806 } 8807 8808 if (SOC_IS_TRIUMPH3(unit)) { 8809 if (_BCM_FIELD_STAGE_EXTERNAL == f_ent->group->stage_id) { 8810 if (soc_feature(unit, soc_feature_global_meter)) { 8811 PolicySet(unit, mem, buf, USE_SVC_METER_COLORf,1); 8812 } 8813 } 8814 } 8815 break; 8816 #endif 8817 #ifdef INCLUDE_L3 8818 case bcmFieldActionRedirectEgrNextHop: 8819 BCM_IF_ERROR_RETURN 8820 (_field_trx_policy_egr_nexthop_info_set(unit, mem, 8821 fa->param[0], buf)); 8822 break; 8823 #endif 8824 #if defined(BCM_KATANA2_SUPPORT) 8825 case bcmFieldActionOamDomain: 8826 if (SOC_IS_KATANA2(unit) && (soc_feature(unit, soc_feature_oam))) { 8827 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 8828 switch (fa->param[0]) { 8829 case bcmFieldOamDomainCVlan: 8830 case bcmFieldOamDomainSVlan: 8831 case bcmFieldOamDomainDoubleVlan: 8832 case bcmFieldOamDomainPbbTe: 8833 param0 = fa->param[0] + 1; 8834 break; 8835 #if defined(BCM_SABER2_SUPPORT) 8836 case bcmFieldOamDomainMplsLmDmSectionPort: 8837 param0 = _BCM_SB2_OAM_DOMAIN_MPLS_SECTION; 8838 break; 8839 case bcmFieldOamDomainMplsLmDmSectionInnerVlan: 8840 param0 = _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_CVLAN; 8841 break; 8842 case bcmFieldOamDomainMplsLmDmSectionOuterVlan: 8843 param0 = _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_SVLAN; 8844 break; 8845 case bcmFieldOamDomainMplsLmDmSectionOuterPlusInnerVlan: 8846 param0 = _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_S_PLUS_CVLAN; 8847 break; 8848 case bcmFieldOamDomainMplsLmDmPw: 8849 param0 = _BCM_SB2_OAM_DOMAIN_MPLS_LMDM_PW; 8850 break; 8851 case bcmFieldOamDomainMplsLmDmLspLabel: 8852 param0 = _BCM_SB2_OAM_DOMAIN_ING_MPLS_LMDM_LSP; 8853 break; 8854 #endif 8855 case _FP_INVALID_INDEX: 8856 param0 = 0; 8857 break; 8858 default: 8859 return (BCM_E_PARAM); 8860 } 8861 switch (fa->param[1]) { 8862 case bcmFieldOamDomainCVlan: 8863 case bcmFieldOamDomainSVlan: 8864 case bcmFieldOamDomainDoubleVlan: 8865 case bcmFieldOamDomainPbbTe: 8866 param1 = fa->param[1] + 1; 8867 break; 8868 #if defined(BCM_SABER2_SUPPORT) 8869 case bcmFieldOamDomainMplsLmDmSectionPort: 8870 param1 = _BCM_SB2_OAM_DOMAIN_MPLS_SECTION; 8871 break; 8872 case bcmFieldOamDomainMplsLmDmSectionInnerVlan: 8873 param1 = _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_CVLAN; 8874 break; 8875 case bcmFieldOamDomainMplsLmDmSectionOuterVlan: 8876 param1 = _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_SVLAN; 8877 break; 8878 case bcmFieldOamDomainMplsLmDmSectionOuterPlusInnerVlan: 8879 param1 = _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_S_PLUS_CVLAN; 8880 break; 8881 case bcmFieldOamDomainMplsLmDmPw: 8882 param1 = _BCM_SB2_OAM_DOMAIN_MPLS_LMDM_PW; 8883 break; 8884 case bcmFieldOamDomainMplsLmDmLspLabel: 8885 param1 = _BCM_SB2_OAM_DOMAIN_ING_MPLS_LMDM_LSP; 8886 break; 8887 #endif 8888 case _FP_INVALID_INDEX: 8889 param1 = 0; 8890 break; 8891 default: 8892 return (BCM_E_PARAM); 8893 } 8894 PolicySet(unit, mem, buf, OAM_KEY1f, param0); 8895 PolicySet(unit, mem, buf, OAM_KEY2f, param1); 8896 } 8897 8898 } 8899 break; 8900 8901 case bcmFieldActionOamOlpHeaderAdd: 8902 if (SOC_IS_KATANA2(unit) && (soc_feature(unit, soc_feature_oam))) { 8903 if (_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) { 8904 if (fa->param[0] >= bcmFieldOlpHeaderTypeCount) { 8905 return (BCM_E_PARAM); 8906 } 8907 hw_index = 0; 8908 rv = _bcm_oam_olp_fp_hw_index_get (unit,fa->param[0], 8909 &hw_index); 8910 if (BCM_FAILURE(rv)) { 8911 return BCM_E_PARAM; 8912 } 8913 PolicySet(unit, mem, buf, OLP_HDR_ADDf, 1); 8914 PolicySet(unit, mem, buf, OLP_HDR_TYPE_COMPRESSEDf, hw_index); 8915 } 8916 } 8917 break; 8918 8919 case bcmFieldActionOamSessionId: 8920 if (SOC_IS_KATANA2(unit) && (soc_feature(unit, soc_feature_oam))) { 8921 if (_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) { 8922 if (fa->param[0] > BCM_FIELD_OAM_SESSION_ID_MAX) { 8923 return (BCM_E_PARAM); 8924 } 8925 PolicySet(unit, mem, buf, OAM_SESSION_IDf, fa->param[0]); 8926 } 8927 } 8928 break; 8929 #endif 8930 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \ 8931 defined(BCM_APACHE_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) 8932 case bcmFieldActionDoNotOverride: 8933 PolicySet(unit, mem, buf, ACTION_PRI_MODIFIERf, 1); 8934 if (SOC_MEM_FIELD_VALID(unit, mem, SVC_METER_INDEX_PRIORITYf)) { 8935 PolicySet(unit, mem, buf, SVC_METER_INDEX_PRIORITYf, 0); 8936 } 8937 break; 8938 #endif 8939 #if defined(BCM_GREYHOUND_SUPPORT) 8940 case bcmFieldActionPfcClassNew: 8941 if (soc_feature(unit, soc_feature_field_action_pfc_class)) { 8942 PolicySet(unit, mem, buf, CHANGE_INPUT_PRIORITYf, 1); 8943 PolicySet(unit, mem, buf, NEW_INPUT_PRIORITYf, fa->param[0]); 8944 } else { 8945 return (BCM_E_UNAVAIL); 8946 } 8947 break; 8948 case bcmFieldActionRpIntCongestionNotificationNew: 8949 if (soc_feature(unit, soc_feature_ecn_wred)) { 8950 PolicySet(unit, mem, buf, R_CHANGE_INT_CNf, 1); 8951 PolicySet(unit, mem, buf, R_NEW_INT_CNf, fa->param[0]); 8952 } else { 8953 return (BCM_E_UNAVAIL); 8954 } 8955 break; 8956 case bcmFieldActionYpIntCongestionNotificationNew: 8957 if (soc_feature(unit, soc_feature_ecn_wred)) { 8958 PolicySet(unit, mem, buf, Y_CHANGE_INT_CNf, 1); 8959 PolicySet(unit, mem, buf, Y_NEW_INT_CNf, fa->param[0]); 8960 } else { 8961 return (BCM_E_UNAVAIL); 8962 } 8963 break; 8964 case bcmFieldActionGpIntCongestionNotificationNew: 8965 if (soc_feature(unit, soc_feature_ecn_wred)) { 8966 PolicySet(unit, mem, buf, G_CHANGE_INT_CNf, 1); 8967 PolicySet(unit, mem, buf, G_NEW_INT_CNf, fa->param[0]); 8968 } else { 8969 return (BCM_E_UNAVAIL); 8970 } 8971 break; 8972 #endif 8973 #if defined(BCM_GREYHOUND_SUPPORT) || defined(BCM_TOMAHAWK_SUPPORT) 8974 case bcmFieldActionRpHGCongestionClassNew: 8975 if (soc_feature(unit, soc_feature_ecn_wred)) { 8976 PolicySet(unit, mem, buf, R_HG_CONGESTION_CLASS_CHANGEf, 1); 8977 PolicySet(unit, mem, buf, R_HG_CONGESTION_CLASS_NEWf, fa->param[0]); 8978 } else { 8979 return (BCM_E_UNAVAIL); 8980 } 8981 break; 8982 case bcmFieldActionYpHGCongestionClassNew: 8983 if (soc_feature(unit, soc_feature_ecn_wred)) { 8984 PolicySet(unit, mem, buf, Y_HG_CONGESTION_CLASS_CHANGEf, 1); 8985 PolicySet(unit, mem, buf, Y_HG_CONGESTION_CLASS_NEWf, fa->param[0]); 8986 } else { 8987 return (BCM_E_UNAVAIL); 8988 } 8989 break; 8990 case bcmFieldActionGpHGCongestionClassNew: 8991 if (soc_feature(unit, soc_feature_ecn_wred)) { 8992 PolicySet(unit, mem, buf, G_HG_CONGESTION_CLASS_CHANGEf, 1); 8993 PolicySet(unit, mem, buf, G_HG_CONGESTION_CLASS_NEWf, fa->param[0]); 8994 } else { 8995 return (BCM_E_UNAVAIL); 8996 } 8997 break; 8998 #endif /* BCM_GREYHOUND_SUPPORT (or) BCM_TOMAHAWK_SUPPORT */ 8999 #if defined(BCM_TOMAHAWK_SUPPORT) 9000 case bcmFieldActionHiGigDstModuleGportNew: 9001 if (BCM_GPORT_IS_MODPORT(fa->param[0])) { 9002 mod_id = BCM_GPORT_MODPORT_MODID_GET(fa->param[0]); 9003 } else { 9004 return BCM_E_PARAM; 9005 } 9006 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9007 PolicySet(unit, mem, buf, HG_DST_MODID_CHANGEf, 1); 9008 PolicySet(unit, mem, buf, HG_DST_MODID_NEWf, mod_id); 9009 break; 9010 case bcmFieldActionHiGigDstPortGportNew: 9011 if (BCM_GPORT_IS_MODPORT(fa->param[0])) { 9012 port_id = BCM_GPORT_MODPORT_PORT_GET(fa->param[0]); 9013 } else { 9014 return BCM_E_PARAM; 9015 } 9016 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9017 PolicySet(unit, mem, buf, HG_DST_PORT_CHANGEf, 1); 9018 PolicySet(unit, mem, buf, HG_DST_PORT_NEWf, port_id); 9019 break; 9020 case bcmFieldActionHiGigDstGportNew: 9021 if (BCM_GPORT_IS_MODPORT(fa->param[0])) { 9022 mod_id = BCM_GPORT_MODPORT_MODID_GET(fa->param[0]); 9023 port_id = BCM_GPORT_MODPORT_PORT_GET(fa->param[0]); 9024 } else { 9025 return BCM_E_PARAM; 9026 } 9027 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9028 PolicySet(unit, mem, buf, HG_DST_MODID_CHANGEf, 1); 9029 PolicySet(unit, mem, buf, HG_DST_MODID_NEWf, mod_id); 9030 PolicySet(unit, mem, buf, HG_DST_PORT_CHANGEf, 1); 9031 PolicySet(unit, mem, buf, HG_DST_PORT_NEWf, port_id); 9032 break; 9033 case bcmFieldActionGpHiGigDropPrecedenceNew: 9034 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9035 PolicySet(unit, mem, buf, G_HG_DP_CHANGEf, 1); 9036 PolicySet(unit, mem, buf, G_HG_DP_NEWf, fa->param[0]); 9037 break; 9038 case bcmFieldActionYpHiGigDropPrecedenceNew: 9039 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9040 PolicySet(unit, mem, buf, Y_HG_DP_CHANGEf, 1); 9041 PolicySet(unit, mem, buf, Y_HG_DP_NEWf, fa->param[0]); 9042 break; 9043 case bcmFieldActionRpHiGigDropPrecedenceNew: 9044 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9045 PolicySet(unit, mem, buf, R_HG_DP_CHANGEf, 1); 9046 PolicySet(unit, mem, buf, R_HG_DP_NEWf, fa->param[0]); 9047 break; 9048 case bcmFieldActionHiGigDropPrecedenceNew: 9049 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9050 PolicySet(unit, mem, buf, G_HG_DP_CHANGEf, 1); 9051 PolicySet(unit, mem, buf, G_HG_DP_NEWf, fa->param[0]); 9052 PolicySet(unit, mem, buf, Y_HG_DP_CHANGEf, 1); 9053 PolicySet(unit, mem, buf, Y_HG_DP_NEWf, fa->param[0]); 9054 PolicySet(unit, mem, buf, R_HG_DP_CHANGEf, 1); 9055 PolicySet(unit, mem, buf, R_HG_DP_NEWf, fa->param[0]); 9056 break; 9057 case bcmFieldActionGpHiGigIntPriNew: 9058 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9059 PolicySet(unit, mem, buf, G_HG_INT_PRI_CHANGEf, 1); 9060 PolicySet(unit, mem, buf, G_HG_INT_PRI_NEWf, fa->param[0]); 9061 break; 9062 case bcmFieldActionYpHiGigIntPriNew: 9063 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9064 PolicySet(unit, mem, buf, Y_HG_INT_PRI_CHANGEf, 1); 9065 PolicySet(unit, mem, buf, Y_HG_INT_PRI_NEWf, fa->param[0]); 9066 break; 9067 case bcmFieldActionRpHiGigIntPriNew: 9068 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9069 PolicySet(unit, mem, buf, R_HG_INT_PRI_CHANGEf, 1); 9070 PolicySet(unit, mem, buf, R_HG_INT_PRI_NEWf, fa->param[0]); 9071 break; 9072 case bcmFieldActionHiGigIntPriNew: 9073 PolicySet(unit, mem, buf, HG_ACTIONf, 1); 9074 PolicySet(unit, mem, buf, G_HG_INT_PRI_CHANGEf, 1); 9075 PolicySet(unit, mem, buf, G_HG_INT_PRI_NEWf, fa->param[0]); 9076 PolicySet(unit, mem, buf, Y_HG_INT_PRI_CHANGEf, 1); 9077 PolicySet(unit, mem, buf, Y_HG_INT_PRI_NEWf, fa->param[0]); 9078 PolicySet(unit, mem, buf, R_HG_INT_PRI_CHANGEf, 1); 9079 PolicySet(unit, mem, buf, R_HG_INT_PRI_NEWf, fa->param[0]); 9080 break; 9081 case bcmFieldActionLoopbackSrcModuleGportNew: 9082 if (BCM_GPORT_IS_MODPORT(fa->param[0])) { 9083 mod_id = BCM_GPORT_MODPORT_MODID_GET(fa->param[0]); 9084 } else { 9085 return BCM_E_PARAM; 9086 } 9087 PolicySet(unit, mem, buf, HG_ACTIONf, 0); 9088 PolicySet(unit, mem, buf, LB_SRC_TYPE_CHANGEf, 1); 9089 PolicySet(unit, mem, buf, LB_SRC_TYPE_NEWf, 1); 9090 PolicySet(unit, mem, buf, LB_SRC_MODID_CHANGEf, 1); 9091 PolicySet(unit, mem, buf, LB_SRC_MODID_NEWf, mod_id); 9092 break; 9093 case bcmFieldActionLoopbackSrcPortGportNew: 9094 if (BCM_GPORT_IS_MODPORT(fa->param[0])) { 9095 port_id = BCM_GPORT_MODPORT_PORT_GET(fa->param[0]); 9096 } else { 9097 return BCM_E_PARAM; 9098 } 9099 PolicySet(unit, mem, buf, HG_ACTIONf, 0); 9100 PolicySet(unit, mem, buf, LB_SRC_TYPE_CHANGEf, 1); 9101 PolicySet(unit, mem, buf, LB_SRC_TYPE_NEWf, 1); 9102 PolicySet(unit, mem, buf, LB_SRC_PORT_CHANGEf, 1); 9103 PolicySet(unit, mem, buf, LB_SRC_PORT_NEWf, port_id); 9104 break; 9105 case bcmFieldActionLoopbackSrcGportNew: 9106 if (BCM_GPORT_IS_MODPORT(fa->param[0])) { 9107 src_is_svp = 0; 9108 mod_id = BCM_GPORT_MODPORT_MODID_GET(fa->param[0]); 9109 port_id = BCM_GPORT_MODPORT_PORT_GET(fa->param[0]); 9110 } else if (BCM_GPORT_IS_MIM_PORT(fa->param[0])) { 9111 src_is_svp = 1; 9112 src_svp = BCM_GPORT_MIM_PORT_ID_GET(fa->param[0]); 9113 } else if (BCM_GPORT_IS_L2GRE_PORT(fa->param[0])) { 9114 src_is_svp = 1; 9115 src_svp = BCM_GPORT_L2GRE_PORT_ID_GET(fa->param[0]); 9116 } else if (BCM_GPORT_IS_VXLAN_PORT(fa->param[0])) { 9117 src_is_svp = 1; 9118 src_svp = BCM_GPORT_VXLAN_PORT_ID_GET(fa->param[0]); 9119 } else if (BCM_GPORT_IS_TRILL_PORT(fa->param[0])) { 9120 src_is_svp = 1; 9121 src_svp = BCM_GPORT_TRILL_PORT_ID_GET(fa->param[0]); 9122 } else { 9123 return BCM_E_PARAM; 9124 } 9125 PolicySet(unit, mem, buf, HG_ACTIONf, 0); 9126 PolicySet(unit, mem, buf, LB_SRC_MODID_CHANGEf, 1); 9127 PolicySet(unit, mem, buf, LB_SRC_PORT_CHANGEf, 1); 9128 PolicySet(unit, mem, buf, LB_SRC_TYPE_CHANGEf, 1); 9129 if (src_is_svp) { 9130 PolicySet(unit, mem, buf, LB_SRC_TYPE_NEWf, 0); 9131 PolicySet(unit, mem, buf, LB_SRC_MODID_NEWf, 9132 ((src_svp >> 0x8) & 0xff)); 9133 PolicySet(unit, mem, buf, LB_SRC_PORT_NEWf, (src_svp & 0xff)); 9134 } else { 9135 PolicySet(unit, mem, buf, LB_SRC_TYPE_NEWf, 1); 9136 PolicySet(unit, mem, buf, LB_SRC_MODID_NEWf, mod_id); 9137 PolicySet(unit, mem, buf, LB_SRC_PORT_NEWf, port_id); 9138 } 9139 break; 9140 case bcmFieldActionLoopbackCpuMasqueradePktProfileNew: 9141 if (!(soc_feature(unit, soc_feature_th3_style_fp))) { 9142 PolicySet(unit, mem, buf, HG_ACTIONf, 0); 9143 } 9144 PolicySet(unit, mem, buf, LB_PACKET_PROFILE_CHANGEf, 1); 9145 PolicySet(unit, mem, buf, LB_PACKET_PROFILE_NEWf, fa->param[0]); 9146 break; 9147 case bcmFieldActionLoopbackPacketProcessingPortNew: 9148 if (!(soc_feature(unit, soc_feature_th3_style_fp))) { 9149 PolicySet(unit, mem, buf, HG_ACTIONf, 0); 9150 } 9151 PolicySet(unit, mem, buf, LB_PP_PORT_CHANGEf, 1); 9152 PolicySet(unit, mem, buf, LB_PP_PORT_NEWf, fa->param[0]); 9153 break; 9154 case bcmFieldActionLoopBackTypeNew: 9155 if (!(soc_feature(unit, soc_feature_th3_style_fp))) { 9156 PolicySet(unit, mem, buf, HG_ACTIONf, 0); 9157 } 9158 PolicySet(unit, mem, buf, LB_TYPE_CHANGEf, 1); 9159 PolicySet(unit, mem, buf, LB_TYPE_NEWf, fa->param[0]); 9160 break; 9161 #endif /* BCM_TOMAHAWK_SUPPORT */ 9162 #if defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 9163 case bcmFieldActionRecoverableDropCancel: 9164 if (SOC_IS_TD2P_TT2P(unit) 9165 || SOC_IS_TRIUMPH3(unit)) { 9166 PolicySet(unit, mem, buf, PROTECTION_SWITCHING_DROP_OVERIDEf, 1); 9167 } 9168 break; 9169 #endif 9170 #if defined (BCM_TRX_SUPPORT) 9171 case bcmFieldActionRedirDropPrecedence: 9172 if ((SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, R_REDIR_DROP_PRECEDENCEf) || 9173 SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, Y_REDIR_DROP_PRECEDENCEf) || 9174 SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, G_REDIR_DROP_PRECEDENCEf)) && 9175 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 9176 PolicySet(unit, mem, buf, R_REDIR_DROP_PRECEDENCEf, fa->param[0]); 9177 PolicySet(unit, mem, buf, Y_REDIR_DROP_PRECEDENCEf, fa->param[0]); 9178 PolicySet(unit, mem, buf, G_REDIR_DROP_PRECEDENCEf, fa->param[0]); 9179 } else { 9180 return BCM_E_UNAVAIL; 9181 } 9182 break; 9183 case bcmFieldActionRpRedirDropPrecedence: 9184 if (SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, R_REDIR_DROP_PRECEDENCEf) && 9185 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 9186 PolicySet(unit, mem, buf, R_REDIR_DROP_PRECEDENCEf, fa->param[0]); 9187 } else { 9188 return BCM_E_UNAVAIL; 9189 } 9190 break; 9191 case bcmFieldActionYpRedirDropPrecedence: 9192 if (SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, Y_REDIR_DROP_PRECEDENCEf) && 9193 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 9194 PolicySet(unit, mem, buf, Y_REDIR_DROP_PRECEDENCEf, fa->param[0]); 9195 } else { 9196 return BCM_E_UNAVAIL; 9197 } 9198 break; 9199 case bcmFieldActionGpRedirDropPrecedence: 9200 if (SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, G_REDIR_DROP_PRECEDENCEf) && 9201 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 9202 PolicySet(unit, mem, buf, G_REDIR_DROP_PRECEDENCEf, fa->param[0]); 9203 } else { 9204 return BCM_E_UNAVAIL; 9205 } 9206 break; 9207 #endif /* BCM_TRX_SUPPORT */ 9208 #if defined(BCM_KATANA2_SUPPORT) 9209 case bcmFieldActionEgressClassSelect: 9210 { 9211 unsigned i2e_cl_sel; 9212 9213 switch (fa->param[0]) { 9214 case BCM_FIELD_EGRESS_CLASS_SELECT_PORT: 9215 i2e_cl_sel = 0x1; 9216 break; 9217 case BCM_FIELD_EGRESS_CLASS_SELECT_SVP: 9218 i2e_cl_sel = 0x2; 9219 break; 9220 case BCM_FIELD_EGRESS_CLASS_SELECT_L3_IIF: 9221 i2e_cl_sel = 0x3; 9222 break; 9223 case BCM_FIELD_EGRESS_CLASS_SELECT_FIELD_SRC: 9224 i2e_cl_sel = 0x4; /* VFP hi */ 9225 break; 9226 case BCM_FIELD_EGRESS_CLASS_SELECT_FIELD_DST: 9227 i2e_cl_sel = 0x5; /* VFP lo */ 9228 break; 9229 case BCM_FIELD_EGRESS_CLASS_SELECT_L2_SRC: 9230 i2e_cl_sel = 0x6; 9231 break; 9232 case BCM_FIELD_EGRESS_CLASS_SELECT_L2_DST: 9233 i2e_cl_sel = 0x7; 9234 break; 9235 case BCM_FIELD_EGRESS_CLASS_SELECT_L3_SRC: 9236 i2e_cl_sel = 0x8; 9237 break; 9238 case BCM_FIELD_EGRESS_CLASS_SELECT_L3_DST: 9239 i2e_cl_sel = 0x9; 9240 break; 9241 case BCM_FIELD_EGRESS_CLASS_SELECT_VLAN: 9242 i2e_cl_sel = 0xa; 9243 break; 9244 case BCM_FIELD_EGRESS_CLASS_SELECT_VRF: 9245 i2e_cl_sel = 0xb; 9246 break; 9247 case BCM_FIELD_EGRESS_CLASS_SELECT_NEW: 9248 i2e_cl_sel = 0xf; 9249 break; 9250 default: 9251 /* Invalid parameter should have been caught earlier */ 9252 return (BCM_E_INTERNAL); 9253 } 9254 if (SOC_MEM_FIELD_VALID(unit, mem, I2E_CLASSID_SELf) && 9255 (_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id)) { 9256 PolicySet(unit, mem, buf, I2E_CLASSID_SELf, i2e_cl_sel); 9257 PolicySet(unit, mem, buf, G_L3SW_CHANGE_L2_FIELDSf, 0x5); 9258 } 9259 } 9260 break; 9261 case bcmFieldActionHiGigClassSelect: 9262 { 9263 unsigned hg_cl_sel; 9264 9265 switch (fa->param[0]) { 9266 case BCM_FIELD_HIGIG_CLASS_SELECT_EGRESS: 9267 hg_cl_sel = 1; 9268 break; 9269 case BCM_FIELD_HIGIG_CLASS_SELECT_EGR_DVP: 9270 hg_cl_sel = 4; 9271 break; 9272 case BCM_FIELD_HIGIG_CLASS_SELECT_EGR_L3_INTERFACE: 9273 hg_cl_sel = 3; 9274 break; 9275 case BCM_FIELD_HIGIG_CLASS_SELECT_EGR_NEXT_HOP: 9276 hg_cl_sel = 2; 9277 break; 9278 case BCM_FIELD_HIGIG_CLASS_SELECT_PORT: 9279 hg_cl_sel = 7; 9280 break; 9281 default: 9282 /* Invalid parameter should have been caught earlier */ 9283 return (BCM_E_INTERNAL); 9284 } 9285 9286 PolicySet(unit, mem, buf, HG_CLASSID_SELf, hg_cl_sel); 9287 } 9288 break; 9289 case bcmFieldActionNewClassId: 9290 PolicySet(unit, mem, buf, I2E_CLASSIDf, fa->param[0]); 9291 if (SOC_MEM_FIELD_VALID(unit, mem, 9292 G_L3SW_CHANGE_L2_FIELDSf)) { 9293 PolicySet(unit, mem, buf, G_L3SW_CHANGE_L2_FIELDSf, 0x5); 9294 } 9295 break; 9296 #endif /* BCM_KATANA2_SUPPORT */ 9297 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT) 9298 case bcmFieldActionDscpMapNew: 9299 if (SOC_IS_GREYHOUND2(unit) && 9300 !soc_feature(unit, soc_feature_vxlan_lite_riot)) { 9301 return BCM_E_UNAVAIL; 9302 } 9303 hw_index = 0; 9304 #if defined BCM_TRIUMPH2_SUPPORT 9305 rv = _bcm_tr2_qos_id2idx(unit, fa->param[0], &hw_index); 9306 if (BCM_FAILURE(rv)) { 9307 return BCM_E_PARAM; 9308 } 9309 #endif 9310 PolicySet(unit, mem, buf, TRUST_DSCP_PTRf, hw_index); 9311 PolicySet(unit, mem, buf, TRUST_DSCPf, 1); 9312 break; 9313 #endif /* BCM_KATANA2_SUPPORT || BCM_GREYHOUND2_SUPPORT */ 9314 case bcmFieldActionChangeL2Fields: 9315 #if defined INCLUDE_L3 9316 PolicySet(unit, mem, buf, l3sw_or_change_l2, 0x1); 9317 BCM_IF_ERROR_RETURN 9318 (_field_trx_policy_set_l3_info(unit, mem, fa->param[0], buf)); 9319 #endif /* INCLUDE_L3 */ 9320 break; 9321 #if defined(BCM_HURRICANE3_SUPPORT) 9322 case bcmFieldActionPfcTx: 9323 PolicySet(unit, mem, buf, PFC_TRIGGERf, 1); 9324 PolicySet(unit, mem, buf, PFC_STREAM_IDf, fa->param[0]); 9325 PolicySet(unit, mem, buf, PFC_TCf, fa->param[1]); 9326 break; 9327 case bcmFieldActionSwitchEncap: 9328 if (soc_feature(unit, soc_feature_miml) || 9329 soc_feature(unit, soc_feature_custom_header)) { 9330 9331 if ((fa->param[0] >> _BCM_SWITCH_ENCAP_SHIFT) == 9332 _BCM_SWITCH_ENCAP_TYPE_MIML) { 9333 int nhi_offset = SOC_IS_HURRICANE3(unit)? 15: 16; 9334 rv = _bcm_hr3_switch_encap_id2idx(unit, fa->param[0], 2, index_array); 9335 if (BCM_FAILURE(rv)) { 9336 return BCM_E_PARAM; 9337 } 9338 9339 /* Set policy table redirection fields */ 9340 PolicySet(unit, mem, buf, REDIRECTIONf, 9341 ((0x1 << nhi_offset) | index_array[0])); 9342 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 1); 9343 9344 PolicySet(unit, mem, buf, HEADER_ENCAP_INDEXf, index_array[1]); 9345 PolicySet(unit, mem, buf, ASSIGN_HEADER_ENCAP_FIELDSf, 1); 9346 9347 LOG_DEBUG(BSL_LS_BCM_FP, 9348 (BSL_META_U(unit, 9349 "FP(unit %d) vverb: Set MiML Encap \ 9350 (Nexthop index: %d, CustomHeader index: %d\n)))"), 9351 unit, index_array[0], index_array[1])); 9352 } else if ((fa->param[0] >> _BCM_SWITCH_ENCAP_SHIFT) == 9353 _BCM_SWITCH_ENCAP_TYPE_CUSTOM_HEADER) { 9354 rv = _bcm_hr3_switch_encap_id2idx(unit, fa->param[0], 1, index_array); 9355 if (BCM_FAILURE(rv)) { 9356 return BCM_E_PARAM; 9357 } 9358 9359 /* Set policy table redirection fields */ 9360 PolicySet(unit, mem, buf, HEADER_ENCAP_INDEXf, index_array[0]); 9361 PolicySet(unit, mem, buf, ASSIGN_HEADER_ENCAP_FIELDSf, 1); 9362 LOG_DEBUG(BSL_LS_BCM_FP, 9363 (BSL_META_U(unit, 9364 "FP(unit %d) vverb: Set Custom Header Encap \ 9365 (CustomHeader index: %d\n)))"), 9366 unit, index_array[0])); 9367 } else { 9368 return BCM_E_PARAM; 9369 } 9370 } else { 9371 return BCM_E_UNAVAIL; 9372 } 9373 break; 9374 #endif /* BCM_HURRICANE3_SUPPORT */ 9375 #if defined(BCM_GREYHOUND2_SUPPORT) 9376 case bcmFieldActionDoNotCutThrough: 9377 PolicySet(unit, mem, buf, DO_NOT_CUT_THROUGHf, 0x1); 9378 break; 9379 case bcmFieldActionVxlanTerminate: 9380 if (soc_feature(unit, soc_feature_vxlan_lite)) { 9381 PolicySet(unit, mem, buf, VXLAN_DECAPf, 0x1); 9382 } else { 9383 return BCM_E_UNAVAIL; 9384 } 9385 break; 9386 case bcmFieldActionUseTunnelPayload: 9387 if (soc_feature(unit, soc_feature_vxlan_lite)) { 9388 PolicySet(unit, mem, buf, IP_TUNNEL_TERMINATIONf, fa->param[0]); 9389 } else { 9390 return BCM_E_UNAVAIL; 9391 } 9392 break; 9393 #endif /* BCM_GREYHOUND2_SUPPORT */ 9394 #if defined(BCM_TSN_SR_SUPPORT) 9395 case bcmFieldActionSRDuplicateDrop: 9396 if (soc_feature(unit, soc_feature_tsn_sr)) { 9397 PolicySet(unit, mem, buf, DROP_SR_FRAMEf, 0x1); 9398 } else { 9399 return BCM_E_UNAVAIL; 9400 } 9401 break; 9402 case bcmFieldActionSRDuplicateDropCancel: 9403 if (soc_feature(unit, soc_feature_tsn_sr)) { 9404 PolicySet(unit, mem, buf, DROP_SR_FRAMEf, 0x2); 9405 } else { 9406 return BCM_E_UNAVAIL; 9407 } 9408 break; 9409 case bcmFieldActionSRNetIdFilter: 9410 if (soc_feature(unit, soc_feature_tsn_sr)) { 9411 PolicySet(unit, mem, buf, APPLY_NETID_FILTERINGf, 0x1); 9412 } else { 9413 return BCM_E_UNAVAIL; 9414 } 9415 break; 9416 case bcmFieldActionSRNetIdSource: 9417 if (soc_feature(unit, soc_feature_tsn_sr)) { 9418 PolicySet(unit, mem, buf, PKT_NET_ID_SOURCEf, fa->param[0]); 9419 } else { 9420 return BCM_E_UNAVAIL; 9421 } 9422 break; 9423 case bcmFieldActionFilterSrcMacPorts: 9424 if (soc_feature(unit, soc_feature_tsn_sr)) { 9425 PolicySet(unit, mem, buf, APPLY_PROXY_MAC_FILTERINGf, 0x1); 9426 } else { 9427 return BCM_E_UNAVAIL; 9428 } 9429 break; 9430 case bcmFieldActionSRCopyToCpu: 9431 if (soc_feature(unit, soc_feature_tsn_sr)) { 9432 if (BCM_FIELD_SR_COPYTOCPU_ANY == fa->param[0]) { 9433 PolicySet(unit, mem, buf, SR_COPY_TO_CPUf, 0x1); 9434 } else if (BCM_FIELD_SR_COPYTOCPU_NON_DUPLICATE == fa->param[0]) { 9435 PolicySet(unit, mem, buf, SR_COPY_TO_CPUf, 0x2); 9436 } 9437 PolicySet(unit, mem, buf, CPU_OPCODEf, fa->param[1]); 9438 } else { 9439 return BCM_E_UNAVAIL; 9440 } 9441 break; 9442 case bcmFieldActionSRTagAdd: 9443 if (soc_feature(unit, soc_feature_tsn_sr)) { 9444 switch (fa->param[0]) { 9445 case BCM_FIELD_SR_TAG_TYPE_RESERVED: 9446 PolicySet(unit, mem, buf, SR_TAG_ADDf, 4); 9447 break; 9448 case BCM_FIELD_SR_TAG_TYPE_HSR: 9449 PolicySet(unit, mem, buf, SR_TAG_ADDf, 1); 9450 break; 9451 case BCM_FIELD_SR_TAG_TYPE_PRP: 9452 PolicySet(unit, mem, buf, SR_TAG_ADDf, 2); 9453 break; 9454 case BCM_FIELD_SR_TAG_TYPE_DOT1CB: 9455 PolicySet(unit, mem, buf, SR_TAG_ADDf, 3); 9456 break; 9457 default: 9458 return BCM_E_PARAM; 9459 } 9460 } else { 9461 return BCM_E_UNAVAIL; 9462 } 9463 break; 9464 case bcmFieldActionSRTagDelete: 9465 if (soc_feature(unit, soc_feature_tsn_sr)) { 9466 switch (fa->param[0]) { 9467 case BCM_FIELD_SR_TAG_TYPE_RESERVED: 9468 PolicySet(unit, mem, buf, SR_TAG_REMOVEf, 2); 9469 break; 9470 case BCM_FIELD_SR_TAG_TYPE_HSR: 9471 PolicySet(unit, mem, buf, SR_TAG_REMOVEf, 1); 9472 break; 9473 case BCM_FIELD_SR_TAG_TYPE_PRP: 9474 PolicySet(unit, mem, buf, SR_TAG_REMOVEf, 4); 9475 break; 9476 case BCM_FIELD_SR_TAG_TYPE_DOT1CB: 9477 PolicySet(unit, mem, buf, SR_TAG_REMOVEf, 3); 9478 break; 9479 default: 9480 return BCM_E_PARAM; 9481 } 9482 } else { 9483 return BCM_E_UNAVAIL; 9484 } 9485 break; 9486 case bcmFieldActionSRLanIdNew: 9487 if (soc_feature(unit, soc_feature_tsn_sr)) { 9488 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 9489 PolicySet(unit, mem, buf, PKT_LAN_IDf, fa->param[0]); 9490 PolicySet(unit, mem, buf, PKT_LAN_ID_VALIDf, 1); 9491 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 9492 PolicySet(unit, mem, buf, NEW_LAN_IDf, fa->param[0]); 9493 PolicySet(unit, mem, buf, NEW_LAN_ID_VALIDf, 1); 9494 } 9495 } else { 9496 return BCM_E_UNAVAIL; 9497 } 9498 break; 9499 case bcmFieldActionSRNetIdNew: 9500 if (soc_feature(unit, soc_feature_tsn_sr)) { 9501 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 9502 PolicySet(unit, mem, buf, PKT_NET_IDf, fa->param[0]); 9503 PolicySet(unit, mem, buf, PKT_NET_ID_VALIDf, 1); 9504 } else if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 9505 PolicySet(unit, mem, buf, NEW_NET_IDf, fa->param[0]); 9506 PolicySet(unit, mem, buf, NEW_NET_ID_VALIDf, 1); 9507 } 9508 } else { 9509 return BCM_E_UNAVAIL; 9510 } 9511 break; 9512 case bcmFieldActionSRFlowIdNew: 9513 if (soc_feature(unit, soc_feature_tsn_sr)) { 9514 uint32 hw_value; 9515 9516 BCM_IF_ERROR_RETURN( 9517 bcmi_esw_tsn_sr_hw_flow_id_get(unit, 9518 (bcm_tsn_sr_flow_t)fa->param[0], 9519 &hw_value)); 9520 PolicySet(unit, mem, buf, SR_FLOW_IDf, hw_value); 9521 } else { 9522 return BCM_E_UNAVAIL; 9523 } 9524 break; 9525 case bcmFieldActionSRFlowPriMapIdNew: 9526 if (soc_feature(unit, soc_feature_tsn_sr)) { 9527 uint32 hw_value; 9528 bcm_tsn_pri_map_type_t map_type; 9529 9530 BCM_IF_ERROR_RETURN( 9531 bcmi_esw_tsn_pri_map_hw_index_get(unit, fa->param[0], 9532 &map_type, &hw_value)); 9533 if (bcmTsnPriMapTypeSrFlow != map_type) { 9534 return BCM_E_PARAM; 9535 } 9536 PolicySet(unit, mem, buf, SR_PRI_OFFSET_PROFILEf, hw_value); 9537 } else { 9538 return BCM_E_UNAVAIL; 9539 } 9540 break; 9541 #endif /* BCM_TSN_SR_SUPPORT */ 9542 #if defined(BCM_TSN_SUPPORT) 9543 case bcmFieldActionTsnFlowIdNew: 9544 if (soc_feature(unit, soc_feature_tsn)) { 9545 uint32 hw_value; 9546 9547 BCM_IF_ERROR_RETURN( 9548 bcmi_esw_tsn_hw_flow_id_get(unit, (bcm_tsn_flow_t)fa->param[0], 9549 &hw_value)); 9550 PolicySet(unit, mem, buf, TSN_CIRCUIT_IDf, hw_value); 9551 } else { 9552 return BCM_E_UNAVAIL; 9553 } 9554 break; 9555 case bcmFieldActionTsnFlowPriMapIdNew: 9556 if (soc_feature(unit, soc_feature_tsn)) { 9557 uint32 hw_value; 9558 bcm_tsn_pri_map_type_t map_type; 9559 9560 BCM_IF_ERROR_RETURN( 9561 bcmi_esw_tsn_pri_map_hw_index_get(unit, fa->param[0], 9562 &map_type, &hw_value)); 9563 if (bcmTsnPriMapTypeTsnFlow != map_type) { 9564 return BCM_E_PARAM; 9565 } 9566 PolicySet(unit, mem, buf, TSN_PRI_OFFSET_PROFILEf, hw_value); 9567 } else { 9568 return BCM_E_UNAVAIL; 9569 } 9570 break; 9571 case bcmFieldActionMtuProfileIdNew: 9572 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 9573 int hw_value; 9574 bcm_tsn_mtu_profile_type_t type; 9575 9576 BCM_IF_ERROR_RETURN( 9577 bcmi_esw_tsn_mtu_hw_profile_id_get(unit, fa->param[0], 9578 &type, &hw_value)); 9579 if (type != bcmTsnMtuProfileTypeIngress) { 9580 return BCM_E_PARAM; 9581 } 9582 PolicySet(unit, mem, buf, MTU_PROFILE_INDEXf, hw_value); 9583 } else { 9584 return BCM_E_UNAVAIL; 9585 } 9586 break; 9587 case bcmFieldActionStuProfileIdNew: 9588 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 9589 int hw_value; 9590 bcm_tsn_stu_profile_type_t type; 9591 9592 BCM_IF_ERROR_RETURN( 9593 bcmi_esw_tsn_stu_hw_profile_id_get(unit, fa->param[0], 9594 &type, &hw_value)); 9595 if (type != bcmTsnStuProfileTypeIngress) { 9596 return BCM_E_PARAM; 9597 } 9598 PolicySet(unit, mem, buf, STU_PROFILE_INDEXf, hw_value); 9599 } else { 9600 return BCM_E_UNAVAIL; 9601 } 9602 break; 9603 case bcmFieldActionMtuSize: 9604 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 9605 PolicySet(unit, mem, buf, MTU_SIZEf, fa->param[0]); 9606 } else { 9607 return BCM_E_UNAVAIL; 9608 } 9609 break; 9610 case bcmFieldActionStuSize: 9611 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 9612 PolicySet(unit, mem, buf, STU_SIZEf, fa->param[0]); 9613 } else { 9614 return BCM_E_UNAVAIL; 9615 } 9616 break; 9617 case bcmFieldActionTafGatePriMap: 9618 if (soc_feature(unit, soc_feature_tsn_taf)) { 9619 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 9620 uint32 hw_value; 9621 bcm_tsn_pri_map_type_t map_type; 9622 9623 if (fa->param[0] == (uint32)BCM_TSN_PRI_MAP_INVALID) { 9624 return BCM_E_PARAM; 9625 } 9626 9627 BCM_IF_ERROR_RETURN( 9628 bcmi_esw_tsn_pri_map_hw_index_get(unit, fa->param[0], 9629 &map_type, &hw_value)); 9630 if (bcmTsnPriMapTypeTafGate != map_type) { 9631 return BCM_E_PARAM; 9632 } 9633 PolicySet(unit, mem, buf, 9634 TAF_GATE_ID_PROFILEf, hw_value); 9635 } 9636 } else { 9637 return BCM_E_UNAVAIL; 9638 } 9639 break; 9640 #endif /* BCM_TSN_SUPPORT */ 9641 #if defined(BCM_APACHE_SUPPORT) 9642 case bcmFieldActionStrength: 9643 PolicySet(unit, mem, buf, REDIR_STRENGTHf, fa->param[0]); 9644 break; 9645 case bcmFieldActionRedirectBufferPriority: 9646 PolicySet(unit, mem, buf, REDIR_RDB_PRIORITYf, fa->param[0]); 9647 break; 9648 case bcmFieldActionRedirectPrioIntNew: 9649 PolicySet(unit, mem, buf, R_NEW_REDIR_INT_PRIf, fa->param[0]); 9650 PolicySet(unit, mem, buf, R_CHANGE_REDIR_INT_PRIf, 0x1); 9651 PolicySet(unit, mem, buf, Y_NEW_REDIR_INT_PRIf, fa->param[0]); 9652 PolicySet(unit, mem, buf, Y_CHANGE_REDIR_INT_PRIf, 0x1); 9653 PolicySet(unit, mem, buf, G_NEW_REDIR_INT_PRIf, fa->param[0]); 9654 PolicySet(unit, mem, buf, G_CHANGE_REDIR_INT_PRIf, 0x1); 9655 break; 9656 case bcmFieldActionRpRedirectPrioIntNew: 9657 PolicySet(unit, mem, buf, R_NEW_REDIR_INT_PRIf, fa->param[0]); 9658 PolicySet(unit, mem, buf, R_CHANGE_REDIR_INT_PRIf, 0x1); 9659 break; 9660 case bcmFieldActionYpRedirectPrioIntNew: 9661 PolicySet(unit, mem, buf, Y_NEW_REDIR_INT_PRIf, fa->param[0]); 9662 PolicySet(unit, mem, buf, Y_CHANGE_REDIR_INT_PRIf, 0x1); 9663 break; 9664 case bcmFieldActionGpRedirectPrioIntNew: 9665 PolicySet(unit, mem, buf, G_NEW_REDIR_INT_PRIf, fa->param[0]); 9666 PolicySet(unit, mem, buf, G_CHANGE_REDIR_INT_PRIf, 0x1); 9667 break; 9668 case bcmFieldActionOamStatObjectSessionId: 9669 BCM_IF_ERROR_RETURN(_field_oam_lm_stat_pool_id_get(unit, fa->param[0], 9670 0, &flex_stat_pool_id)); 9671 PolicySet(unit, mem, buf, SESSION_ID_POOL_SELECTORf, flex_stat_pool_id); 9672 break; 9673 case bcmFieldActionLoopbackOamResponse: 9674 PolicySet(unit, mem, buf, LOOPBACKf, 0x1); 9675 break; 9676 case bcmFieldActionLoopbackSatResponse: 9677 PolicySet(unit, mem, buf, LOOPBACKf, 0x2); 9678 break; 9679 #endif /* BCM_APACHE_SUPPORT */ 9680 9681 #if defined(BCM_METROLITE_SUPPORT) 9682 case bcmFieldActionSwapMacDaSa: 9683 PolicySet(unit, mem, buf, DA_SA_SWAPf, 0x1); 9684 break; 9685 case bcmFieldActionSwapSourceIPDestIP: 9686 PolicySet(unit, mem, buf, SIP_DIP_SWAPf, 0x1); 9687 break; 9688 case bcmFieldActionReplaceTtl: 9689 PolicySet(unit, mem, buf, REPLACE_TTLf, 0x1); 9690 break; 9691 case bcmFieldActionPacketIsL3SAT: 9692 PolicySet(unit, mem, buf, L3SATf, 0x1); 9693 break; 9694 #endif 9695 #if defined(BCM_SABER2_SUPPORT) 9696 case bcmFieldActionOamLmCounterPoolId: 9697 PolicySet(unit, mem, buf, LM_CTR_POOL_IDf, fa->param[0]); 9698 break; 9699 #endif 9700 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 9701 case bcmFieldActionMacSecDecrypt: 9702 PolicySet(unit, mem, buf, MACSEC_DECRYPTf, 0x1); 9703 if (soc_feature(unit, soc_feature_olp)) { 9704 PolicySet(unit, mem, buf, ADD_OLP_HEADERf, 1); 9705 hw_index = bcmFieldOlpHeaderTypeMacSecDecrypt - 1; 9706 if (soc_feature(unit, soc_feature_fp_based_oam)) { 9707 rv = _bcm_oam_olp_fp_hw_index_get(unit, 9708 bcmFieldOlpHeaderTypeMacSecDecrypt, 9709 &hw_index); 9710 if (BCM_FAILURE(rv)) { 9711 return BCM_E_PARAM; 9712 } 9713 } 9714 PolicySet(unit, mem, buf, OLP_HDR_TYPE_COMPRESSEDf, hw_index); 9715 } 9716 break; 9717 case bcmFieldActionMacSecEncrypt: 9718 PolicySet(unit, mem, buf, MACSEC_ENCRYPTf, 0x1); 9719 if (soc_feature(unit, soc_feature_olp)) { 9720 PolicySet(unit, mem, buf, ADD_OLP_HEADERf, 1); 9721 hw_index = bcmFieldOlpHeaderTypeMacSecEncrypt - 1; 9722 if (soc_feature(unit, soc_feature_fp_based_oam)) { 9723 rv = _bcm_oam_olp_fp_hw_index_get(unit, 9724 bcmFieldOlpHeaderTypeMacSecEncrypt, 9725 &hw_index); 9726 if (BCM_FAILURE(rv)) { 9727 return BCM_E_PARAM; 9728 } 9729 } 9730 PolicySet(unit, mem, buf, OLP_HDR_TYPE_COMPRESSEDf, hw_index); 9731 } 9732 break; 9733 case bcmFieldActionMacSecPktTypeSet: 9734 PolicySet(unit, mem, buf, PACKET_TYPEf, fa->param[0]); 9735 break; 9736 case bcmFieldActionMacSecSubPortNumAdd: 9737 subport_num = BCM_XFLOW_MACSEC_SUBPORT_ID_INDEX_GET(fa->param[0]); 9738 PolicySet(unit, mem, buf, MACSEC_SUBPORT_NUMf, subport_num); 9739 break; 9740 #endif 9741 #if defined(BCM_TRIDENT2PLUS_SUPPORT) 9742 case bcmFieldActionProtectionSwitchingDrop: 9743 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 9744 PolicySet(unit, mem, buf, DROP_DATA_ENABLEf, 1); 9745 } 9746 break; 9747 #endif 9748 #if defined (BCM_TRIUMPH3_SUPPORT) 9749 case bcmFieldActionReplaceSrcMac: 9750 case bcmFieldActionReplaceDstMac: 9751 case bcmFieldActionReplaceInnerVlan: 9752 case bcmFieldActionReplaceOuterVlan: 9753 case bcmFieldActionReplaceInnerVlanPriority: 9754 case bcmFieldActionReplaceOuterVlanPriority: 9755 if(f_ent->eid != _FP_INTERNAL_RESERVED_ID) { 9756 rv = _bcm__field_tr3_action_replaceL2Fields(unit, fa); 9757 if(rv < 0) { 9758 return BCM_E_PARAM; 9759 } 9760 } 9761 PolicySet(unit, mem, buf, L2MOD_TBL_INDEXf, fa->hw_index); 9762 PolicySet(unit, mem, buf, G_L3SW_CHANGE_L2_FIELDSf, 0x9); 9763 break; 9764 #endif 9765 #if defined (BCM_TOMAHAWK3_SUPPORT) 9766 case bcmFieldActionMplsLookupEnable: 9767 PolicySet(unit, mem, buf, RESET_MPLS_ENABLEf, 1); 9768 if (fa->param[0] == BCM_FIELD_MPLS_ENABLE) { 9769 PolicySet(unit, mem, buf, MPLS_ENABLEf, 1); 9770 } 9771 break; 9772 case bcmFieldActionTerminationAllowed: 9773 PolicySet(unit, mem, buf, RESET_MY_STATION_LOOKUP_RESULTf, 1); 9774 if (fa->param[0] & BCM_FIELD_MPLS_TERM_ALLOWED) { 9775 PolicySet(unit, mem, buf, MPLS_TERMINATION_ALLOWEDf, 1); 9776 } 9777 if (fa->param[0] & BCM_FIELD_IPV4_TERM_ALLOWED) { 9778 PolicySet(unit, mem, buf, IPV4_TERMINATION_ALLOWEDf, 1); 9779 } 9780 if (fa->param[0] & BCM_FIELD_IPV6_TERM_ALLOWED) { 9781 PolicySet(unit, mem, buf, IPV6_TERMINATION_ALLOWEDf, 1); 9782 } 9783 if (fa->param[0] & BCM_FIELD_IPV4_MCAST_TERM_ALLOWED) { 9784 PolicySet(unit, mem, buf, IPV4_MULTICAST_TERMINATION_ALLOWEDf, 1); 9785 } 9786 if (fa->param[0] & BCM_FIELD_IPV6_MCAST_TERM_ALLOWED) { 9787 PolicySet(unit, mem, buf, IPV6_MULTICAST_TERMINATION_ALLOWEDf, 1); 9788 } 9789 if (fa->param[0] & BCM_FIELD_ARP_RARP_TERM_ALLOWED) { 9790 PolicySet(unit, mem, buf, ARP_RARP_TERMINATION_ALLOWEDf, 1); 9791 } 9792 break; 9793 9794 #endif 9795 #if defined(BCM_MONTEREY_SUPPORT) 9796 case bcmFieldActionRoeFrameTypeSet: 9797 if (fa->param[0] == bcmFieldRoeFrameTypeNone) { 9798 roe_type = 3; 9799 } else if (fa->param[0] == bcmFieldRoeFrameTypeRoe) { 9800 roe_type = 2; 9801 } else if (fa->param[0] == bcmFieldRoeFrameTypeCustom) { 9802 roe_type = 1; 9803 } 9804 PolicySet(unit, mem, buf, ROE_TYPEf, roe_type); 9805 break; 9806 #endif /* BCM_MONTEREY_SUPPORT */ 9807 case bcmFieldActionLatencyMonitorEnable: 9808 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 9809 PolicySet(unit, mem, buf, LAT_MON_ENf, fa->param[0]); 9810 PolicySet(unit, mem, buf, LAT_MON_OVERRIDEf, 1); 9811 } 9812 break; 9813 case bcmFieldActionLatencyMonitorDisable: 9814 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 9815 PolicySet(unit, mem, buf, LAT_MON_DISf, fa->param[0]); 9816 PolicySet(unit, mem, buf, LAT_MON_OVERRIDEf, 1); 9817 } 9818 break; 9819 #if defined(BCM_MAVERICK2_SUPPORT) 9820 #if defined(INCLUDE_FLOWTRACKER) 9821 case bcmFieldActionFlowtrackerGroupId: 9822 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 9823 if (soc_feature(unit, soc_feature_mv2_style_flowtracker)) { 9824 PolicySet(unit, mem, buf, FLOW_GROUP_IDf, fa->param[0]); 9825 } else { 9826 return BCM_E_UNAVAIL; 9827 } 9828 } 9829 break; 9830 #endif /* INCLUDE_FLOWTRACKER */ 9831 #endif /* BCM_MAVERICK2_SUPPORT */ 9832 #if defined (BCM_TOMAHAWK3_SUPPORT) 9833 case bcmFieldActionVisibilityEnable: 9834 PolicySet(unit, mem, buf, VISIBILITY_PACKETf, 1); 9835 break; 9836 #endif 9837 #if defined (BCM_TOMAHAWK3_SUPPORT) 9838 case bcmFieldActionL3IngressStrengthSet: 9839 PolicySet(unit, mem, buf, ACTION_PRI_MODIFIERf, fa->param[0]); 9840 break; 9841 #endif 9842 #if defined (BCM_TRIDENT3_SUPPORT) 9843 case bcmFieldActionAssignOpaqueObject4: 9844 case bcmFieldActionAssignOpaqueObject3: 9845 case bcmFieldActionAssignOpaqueObject2: 9846 case bcmFieldActionAssignOpaqueObject1: 9847 switch(fa->action) { 9848 case bcmFieldActionAssignOpaqueObject4: 9849 value = 0x4; 9850 break; 9851 case bcmFieldActionAssignOpaqueObject3: 9852 value = 0x3; 9853 break; 9854 case bcmFieldActionAssignOpaqueObject2: 9855 value = 0x2; 9856 break; 9857 case bcmFieldActionAssignOpaqueObject1: 9858 value = 0x1; 9859 break; 9860 default: 9861 return BCM_E_INTERNAL; 9862 } 9863 /* Lower 3 bits holds type of Opaque and upper 16 holds value of Opaque */ 9864 value = value | (fa->param[0] << 3); 9865 PolicySet(unit, mem, buf, OPAQUE_OBJECTf, value); 9866 break; 9867 case bcmFieldActionAssignExtractionCtrlId: 9868 PolicySet(unit, mem, buf, EXTRACTION_CTRL_ID_ACTIONf, fa->param[0] | (fa->param[1] << 8)); 9869 break; 9870 #endif 9871 #if defined (BCM_HELIX5_SUPPORT) 9872 case bcmFieldActionCosMapSelect: 9873 switch(fa->param[0]) { 9874 case bcmFieldCosMapSelectWired: 9875 value = 0x1; 9876 break; 9877 case bcmFieldCosMapSelectWireless: 9878 value = 0x2; 9879 break; 9880 default: 9881 return BCM_E_INTERNAL; 9882 } 9883 PolicySet(unit, mem, buf, WIRED_WIRELESSf, value); 9884 break; 9885 #endif 9886 default: 9887 return (BCM_E_UNAVAIL); 9888 } 9889 9890 9891 #if defined(BCM_TOMAHAWK_SUPPORT) 9892 /* 9893 * Add VFP Class ID to the Policy Table along with CopyToCpu Action. 9894 */ 9895 if (SOC_INFO(unit).th_ctc_replace_enabled) { 9896 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 9897 uint8 enable; 9898 9899 enable = PolicyGet(unit, mem, buf, COPY_TO_CPUf); 9900 if (enable == 1) { 9901 PolicySet(unit, mem, buf, USE_VFP_CLASS_ID_Hf, 0x1); 9902 PolicySet(unit, mem, buf, VFP_CLASS_ID_Hf, 9903 _BCM_FIELD_COPYTOCPU_WAR_RESERVED_CLASSID); 9904 } 9905 } 9906 } 9907 #endif /* BCM_TOMAHAWK_SUPPORT */ 9908 9909 fa->flags &= ~_FP_ACTION_DIRTY; /* Mark action as installed. */ 9910 9911 LOG_DEBUG(BSL_LS_BCM_FP, 9912 (BSL_META_U(unit, 9913 "FP(unit %d) vverb: END _bcm_field_trx_action_get()\n"), 9914 unit)); 9915 return (BCM_E_NONE); 9916 } 9917 9918 /* 9919 * Function: 9920 * _field_trx2_mirror_add 9921 * Purpose: 9922 * Set mirroring destination & enable mirroring for rule matching 9923 * packets. 9924 * Parameters: 9925 * unit - (IN) BCM device number 9926 * mem - (IN) Policy table memory 9927 * f_ent - (IN) Entry structure to get policy info from 9928 * fa - (IN) field action 9929 * buf - (IN/OUT) Field Policy table entry 9930 * Returns: 9931 * BCM_E_XXX 9932 */ 9933 int 9934 _field_trx2_mirror_add(int unit, soc_mem_t mem, _field_entry_t *f_ent, 9935 _field_action_t *fa, uint32 *buf) 9936 { 9937 int mtp_index; 9938 uint32 enable; 9939 int mtp_type_index; 9940 int flexibleMirror; 9941 int directedMirror; 9942 int rv; 9943 9944 soc_field_t mtp_field[] = { 9945 MTP_INDEX0f, MTP_INDEX1f, 9946 MTP_INDEX2f, MTP_INDEX3f}; 9947 9948 /* Input parameters check. */ 9949 if (NULL == f_ent || NULL == fa || NULL == buf) { 9950 return (BCM_E_PARAM); 9951 } 9952 mtp_index = fa->hw_index; 9953 mtp_type_index = mtp_index; 9954 9955 /* shifting the index back since flexible slot shift was done 9956 * prior to this 9957 */ 9958 rv = bcm_esw_switch_control_get(unit,bcmSwitchFlexibleMirrorDestinations, 9959 &flexibleMirror); 9960 BCM_IF_ERROR_RETURN(rv); 9961 9962 rv = bcm_esw_switch_control_get(unit,bcmSwitchDirectedMirroring, 9963 &directedMirror); 9964 BCM_IF_ERROR_RETURN(rv); 9965 9966 if (soc_feature(unit, soc_feature_mirror_flexible) 9967 && flexibleMirror && directedMirror) { 9968 mtp_index = (fa->hw_index & BCM_MIRROR_MTP_FLEX_SLOT_MASK); 9969 mtp_type_index = ((fa->hw_index >> BCM_MIRROR_MTP_FLEX_SLOT_SHIFT) 9970 & BCM_MIRROR_MTP_FLEX_SLOT_MASK); 9971 } 9972 9973 if (mtp_type_index >= COUNTOF(mtp_field)) { 9974 fa->hw_index = _FP_INVALID_INDEX; 9975 return (BCM_E_INTERNAL); 9976 } 9977 9978 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 9979 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit) || SOC_IS_APACHE(unit)) { 9980 enable = PolicyGet(unit, mem, buf, REDIRECTION_DESTINATIONf); 9981 PolicySet(unit, mem, buf, 9982 REDIRECTION_DESTINATIONf, (enable | 0x1 << mtp_index)); 9983 } else { 9984 enable = PolicyGet(unit, mem, buf, REDIRECTIONf); 9985 PolicySet(unit, mem, buf, REDIRECTIONf, (enable | 0x1 << mtp_index)); 9986 } 9987 if (SOC_IS_APACHE(unit)) { 9988 PolicySet(unit, mem, buf, R_REDIRECTf, 0x3); 9989 PolicySet(unit, mem, buf, G_REDIRECTf, 0x3); 9990 PolicySet(unit, mem, buf, Y_REDIRECTf, 0x3); 9991 PolicySet(unit, mem, buf, REDIRECTION_DEST_TYPEf, 0x4); 9992 } else { 9993 PolicySet(unit, mem, buf, G_PACKET_REDIRECTIONf, 0x4); 9994 } 9995 } else { 9996 enable = PolicyGet(unit, mem, buf, MIRRORf); 9997 PolicySet(unit, mem, buf, mtp_field[mtp_type_index], mtp_index); 9998 PolicySet(unit, mem, buf, MIRRORf, (enable | (0x1 << mtp_type_index))); 9999 } 10000 10001 return (BCM_E_NONE); 10002 } 10003 10004 /* 10005 * Function: 10006 * _bcm_field_trx_mirror_ingress_add 10007 * Purpose: 10008 * Set ingress mirroring destination & enable mirroring for rule matching 10009 * packets. 10010 * Parameters: 10011 * unit - (IN) BCM device number 10012 * mem - (IN) Policy table memory 10013 * f_ent - (IN) Entry structure to get policy info from 10014 * fa - (IN) field action 10015 * buf - (IN/OUT) Field Policy table entry 10016 * Returns: 10017 * BCM_E_XXX 10018 */ 10019 int 10020 _bcm_field_trx_mirror_ingress_add(int unit, soc_mem_t mem, _field_entry_t *f_ent, 10021 _field_action_t *fa, uint32 *buf) 10022 { 10023 int mtp_index; 10024 uint32 enable; 10025 int mtp_slot_check = 0; /* MTP Slot map status. */ 10026 int orig_enable_mtp_map = 0; /* Original Ingress enable */ 10027 int flags = 0; /* Slot Check Flag */ 10028 int rv; /* Return Status */ 10029 int mirror_ex_en = _BCM_SWITCH_MIRROR_NON_EXCLUSIVE; 10030 10031 /* Input parameters check. */ 10032 if (NULL == f_ent || NULL == fa || NULL == buf) { 10033 return (BCM_E_PARAM); 10034 } 10035 10036 #ifdef BCM_TRIUMPH2_SUPPORT 10037 if (soc_feature(unit, soc_feature_mirror_flexible)) { 10038 return _field_trx2_mirror_add(unit, mem, f_ent, fa, buf); 10039 } 10040 #endif 10041 10042 /* Allocate mirror to index. */ 10043 mtp_index = fa->hw_index; 10044 enable = PolicyGet(unit, mem, buf, INGRESS_MIRRORf); 10045 10046 /* Check if slot container are occupied earlier by other module , ignore if not set*/ 10047 rv = _bcm_esw_mirror_exclusive_get(unit, &mirror_ex_en); 10048 10049 if(BCM_SUCCESS(rv) && (mirror_ex_en == _BCM_SWITCH_MIRROR_EXCLUSIVE)) { 10050 orig_enable_mtp_map = enable; 10051 flags |= (_BCM_MIRROR_SLOT_INGRESS | _BCM_MIRROR_SLOT_FP); 10052 BCM_IF_ERROR_RETURN 10053 (_bcm_esw_mtp_slot_valid_get(unit, 10054 flags, 10055 &mtp_slot_check)); 10056 enable = enable | mtp_slot_check; 10057 } 10058 10059 /* If destination 0 not in use install new mtp to destination 0. */ 10060 if(0 == (enable & 0x1)) { 10061 10062 /* Retreive orig enable on port */ 10063 if (mirror_ex_en == _BCM_SWITCH_MIRROR_EXCLUSIVE) { 10064 enable = orig_enable_mtp_map; 10065 BCM_IF_ERROR_RETURN 10066 (_bcm_esw_mirror_fp_slot_add_ref(unit, 10067 flags, 10068 _BCM_MIRROR_SLOT_CONT0)); 10069 } 10070 10071 PolicySet(unit, mem, buf, IM0_MTP_INDEXf, mtp_index); 10072 PolicySet(unit, mem, buf, INGRESS_MIRRORf, (enable | 0x1)); 10073 f_ent->ing_mtp_slot_map |= 0x1; 10074 return (BCM_E_NONE); 10075 } 10076 10077 /* If destination 1 not in use install new mtp to destination 1. */ 10078 if(0 == (enable & 0x2) && SOC_MEM_FIELD_VALID(unit, mem, IM1_MTP_INDEXf)) { 10079 10080 /* Retreive orig enable on port */ 10081 if (mirror_ex_en == _BCM_SWITCH_MIRROR_EXCLUSIVE) { 10082 enable = orig_enable_mtp_map; 10083 BCM_IF_ERROR_RETURN 10084 (_bcm_esw_mirror_fp_slot_add_ref(unit, 10085 flags, 10086 _BCM_MIRROR_SLOT_CONT1)); 10087 } 10088 10089 PolicySet(unit, mem, buf, IM1_MTP_INDEXf, mtp_index); 10090 PolicySet(unit, mem, buf, INGRESS_MIRRORf, (enable | 0x2)); 10091 f_ent->ing_mtp_slot_map |= 0x2; 10092 return (BCM_E_NONE); 10093 } 10094 return (BCM_E_RESOURCE); 10095 } 10096 10097 /* 10098 * Function: 10099 * _bcm_field_trx_mirror_egress_add 10100 * Purpose: 10101 * Set ingress mirroring destination & enable mirroring for rule matching 10102 * packets. 10103 * Parameters: 10104 * unit - (IN) BCM device number 10105 * mem - (IN) Policy table memory 10106 * f_ent - (IN) Entry structure to get policy info from 10107 * fa - (IN) field action 10108 * buf - (IN/OUT) Field Policy table entry 10109 * Returns: 10110 * BCM_E_XXX 10111 */ 10112 int 10113 _bcm_field_trx_mirror_egress_add(int unit, soc_mem_t mem, _field_entry_t *f_ent, 10114 _field_action_t *fa, uint32 *buf) 10115 { 10116 int mtp_index; 10117 int enable; 10118 int mtp_slot_check = 0; /* MTP Slot map status. */ 10119 int orig_enable_mtp_map = 0; /* Original Egress enable */ 10120 int flags = 0; /* Slot Check Flag */ 10121 int mirror_ex_en = _BCM_SWITCH_MIRROR_NON_EXCLUSIVE; 10122 int rv; 10123 10124 /* Input parameters check. */ 10125 if (NULL == f_ent || NULL == fa || NULL == buf) { 10126 return (BCM_E_PARAM); 10127 } 10128 10129 #ifdef BCM_TRIUMPH2_SUPPORT 10130 if (soc_feature(unit, soc_feature_mirror_flexible)) { 10131 return _field_trx2_mirror_add(unit, mem, f_ent, fa, buf); 10132 } 10133 #endif 10134 10135 /* Allocate mirror to index. */ 10136 mtp_index = fa->hw_index; 10137 enable = PolicyGet(unit, mem, buf, EGRESS_MIRRORf); 10138 10139 /* Check if slot container are occupied earlier by other module , ignore if not set*/ 10140 rv = _bcm_esw_mirror_exclusive_get(unit, &mirror_ex_en); 10141 10142 if(BCM_SUCCESS(rv) && (mirror_ex_en == _BCM_SWITCH_MIRROR_EXCLUSIVE)) { 10143 orig_enable_mtp_map = enable; 10144 flags |= (_BCM_MIRROR_SLOT_EGRESS | _BCM_MIRROR_SLOT_FP); 10145 BCM_IF_ERROR_RETURN 10146 (_bcm_esw_mtp_slot_valid_get(unit, 10147 flags, 10148 &mtp_slot_check)); 10149 enable = enable | mtp_slot_check; 10150 } 10151 10152 /* If destination 0 not in use install new mtp to destination 0. */ 10153 if(0 == (enable & 0x1)) { 10154 10155 /* Retreive orig enable on port */ 10156 if (mirror_ex_en == _BCM_SWITCH_MIRROR_EXCLUSIVE) { 10157 enable = orig_enable_mtp_map; 10158 BCM_IF_ERROR_RETURN 10159 (_bcm_esw_mirror_fp_slot_add_ref(unit, 10160 flags, 10161 _BCM_MIRROR_SLOT_CONT0)); 10162 } 10163 10164 PolicySet(unit, mem, buf, EM0_MTP_INDEXf, mtp_index); 10165 PolicySet(unit, mem, buf, EGRESS_MIRRORf, (enable | 0x1)); 10166 f_ent->egr_mtp_slot_map |= 0x1; 10167 return (BCM_E_NONE); 10168 } 10169 10170 /* If destination 1 not in use install new mtp to destination 1. */ 10171 if(0 == (enable & 0x2) && SOC_MEM_FIELD_VALID(unit, mem, EM1_MTP_INDEXf)) { 10172 10173 /* Retreive orig enable on port */ 10174 if (mirror_ex_en == _BCM_SWITCH_MIRROR_EXCLUSIVE) { 10175 enable = orig_enable_mtp_map; 10176 BCM_IF_ERROR_RETURN 10177 (_bcm_esw_mirror_fp_slot_add_ref(unit, 10178 flags, 10179 _BCM_MIRROR_SLOT_CONT1)); 10180 } 10181 10182 PolicySet(unit, mem, buf, EM1_MTP_INDEXf, mtp_index); 10183 PolicySet(unit, mem, buf, EGRESS_MIRRORf, (enable | 0x2)); 10184 f_ent->egr_mtp_slot_map |= 0x2; 10185 return (BCM_E_NONE); 10186 } 10187 return (BCM_E_RESOURCE); 10188 } 10189 10190 /* 10191 * Function: 10192 * _bcm_field_trx_action_support_check 10193 * 10194 * Purpose: 10195 * Check if action is supported by device. 10196 * 10197 * Parameters: 10198 * unit -(IN) BCM device number 10199 * f_ent -(IN) Field entry structure. 10200 * action -(IN) Action to check(bcmFieldActionXXX) 10201 * result -(OUT) 10202 * TRUE - action is supported by device 10203 * FALSE - action is NOT supported by device 10204 * Returns: 10205 * BCM_E_XXX 10206 */ 10207 int 10208 _bcm_field_trx_stage_action_support_check(int unit, 10209 unsigned stage, 10210 bcm_field_action_t action, 10211 int *result 10212 ) 10213 { 10214 /* 10215 * Initialize with FALSE case so that no need to assign explicitly for not supported cases 10216 */ 10217 #if defined(BCM_TRIDENT_SUPPORT) 10218 int vfp_compress_en = 0; 10219 #endif /* !BCM_TRIDENT_SUPPORT */ 10220 *result = FALSE; 10221 10222 if (stage == _BCM_FIELD_STAGE_EGRESS) { 10223 switch (action) { 10224 case bcmFieldActionDrop: 10225 case bcmFieldActionDropCancel: 10226 case bcmFieldActionInnerVlanNew: 10227 case bcmFieldActionOuterVlanNew: 10228 case bcmFieldActionOuterTpidNew: 10229 case bcmFieldActionOuterVlanPrioNew: 10230 case bcmFieldActionInnerVlanPrioNew: 10231 case bcmFieldActionOuterVlanCfiNew: 10232 case bcmFieldActionInnerVlanCfiNew: 10233 *result = TRUE; 10234 break; 10235 case bcmFieldActionMirrorEgress: 10236 *result = soc_feature(unit, soc_feature_egr_mirror_true) \ 10237 ? TRUE : FALSE; 10238 break; 10239 case bcmFieldActionIpFix: 10240 case bcmFieldActionIpFixCancel: 10241 *result = soc_feature(unit, soc_feature_ipfix) ? TRUE : FALSE; 10242 break; 10243 case bcmFieldActionDscpNew: 10244 case bcmFieldActionRpDrop: 10245 case bcmFieldActionRpDropCancel: 10246 case bcmFieldActionRpDscpNew: 10247 case bcmFieldActionRpOuterVlanPrioNew: 10248 case bcmFieldActionRpInnerVlanPrioNew: 10249 case bcmFieldActionRpOuterVlanCfiNew: 10250 case bcmFieldActionRpInnerVlanCfiNew: 10251 10252 case bcmFieldActionYpDrop: 10253 case bcmFieldActionYpDropCancel: 10254 case bcmFieldActionYpDscpNew: 10255 case bcmFieldActionYpOuterVlanPrioNew: 10256 case bcmFieldActionYpInnerVlanPrioNew: 10257 case bcmFieldActionYpOuterVlanCfiNew: 10258 case bcmFieldActionYpInnerVlanCfiNew: 10259 10260 case bcmFieldActionGpDrop: 10261 case bcmFieldActionGpDropCancel: 10262 case bcmFieldActionGpDscpNew: 10263 case bcmFieldActionGpOuterVlanPrioNew: 10264 case bcmFieldActionGpInnerVlanPrioNew: 10265 case bcmFieldActionGpOuterVlanCfiNew: 10266 case bcmFieldActionGpInnerVlanCfiNew: 10267 *result = TRUE; 10268 break; 10269 case bcmFieldActionEcnNew: 10270 case bcmFieldActionRpEcnNew: 10271 case bcmFieldActionYpEcnNew: 10272 case bcmFieldActionGpEcnNew: 10273 *result = SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, 10274 G_CHANGE_ECNf) ? TRUE : FALSE; 10275 break; 10276 case bcmFieldActionCopyToCpu: 10277 case bcmFieldActionRpCopyToCpu: 10278 case bcmFieldActionYpCopyToCpu: 10279 case bcmFieldActionGpCopyToCpu: 10280 #ifdef BCM_MONTEREY_SUPPORT 10281 if (SOC_IS_MONTEREY(unit)) { 10282 *result = FALSE; 10283 break; 10284 } 10285 #endif 10286 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_APACHE_SUPPORT) 10287 if (SOC_IS_KATANA2(unit) || SOC_IS_APACHE(unit)) { 10288 } else 10289 #endif 10290 { 10291 #ifdef BCM_TRIUMPH2_SUPPORT 10292 if (!soc_feature(unit, soc_feature_internal_loopback)) { 10293 /* Loopback port is not available */ 10294 *result = FALSE; 10295 break; 10296 } 10297 #endif 10298 } 10299 *result = SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, 10300 G_COPY_TO_CPUf) ? TRUE : FALSE; 10301 break; 10302 case bcmFieldActionCopyToCpuCancel: 10303 case bcmFieldActionRpCopyToCpuCancel: 10304 case bcmFieldActionYpCopyToCpuCancel: 10305 case bcmFieldActionGpCopyToCpuCancel: 10306 *result = SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, 10307 G_COPY_TO_CPUf) ? TRUE : FALSE; 10308 #ifdef BCM_APACHE_SUPPORT 10309 if (SOC_IS_APACHE(unit)) { 10310 *result = FALSE; 10311 } 10312 #endif 10313 break; 10314 case bcmFieldActionCosQCpuNew: 10315 #ifdef BCM_MONTEREY_SUPPORT 10316 if (SOC_IS_MONTEREY(unit)) { 10317 *result = FALSE; 10318 break; 10319 } 10320 #endif 10321 *result = SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, 10322 NEW_CPU_COSf) ? TRUE : FALSE; 10323 break; 10324 case bcmFieldActionRedirect: 10325 case bcmFieldActionRedirectTrunk: 10326 case bcmFieldActionRedirectMcast: 10327 if (SOC_IS_TRIUMPH3(unit) && 10328 soc_feature(unit, soc_feature_axp)) { 10329 *result = TRUE; 10330 } 10331 else if (SOC_IS_KATANA2(unit) || 10332 soc_feature(unit, soc_feature_ep_redirect_v2)) { 10333 *result = TRUE; 10334 } 10335 else { 10336 *result = FALSE; 10337 } 10338 break; 10339 #if defined(BCM_GREYHOUND_SUPPORT) || defined(BCM_TOMAHAWK_SUPPORT) 10340 case bcmFieldActionRpHGCongestionClassNew: 10341 case bcmFieldActionYpHGCongestionClassNew: 10342 case bcmFieldActionGpHGCongestionClassNew: 10343 if (soc_feature(unit, soc_feature_ecn_wred)) { 10344 *result = TRUE; 10345 } else { 10346 *result = FALSE; 10347 } 10348 break; 10349 #endif /* BCM_GREYHOUND_SUPPORT (or) BCM_TOMAHAWK_SUPPORT */ 10350 #if defined (BCM_TRX_SUPPORT) 10351 case bcmFieldActionRedirDropPrecedence: 10352 #ifdef BCM_MONTEREY_SUPPORT 10353 if (SOC_IS_MONTEREY(unit)) { 10354 *result = FALSE; 10355 break; 10356 } 10357 #endif 10358 *result = 10359 (SOC_MEM_FIELD_VALID(unit, 10360 EFP_POLICY_TABLEm, R_REDIR_DROP_PRECEDENCEf) || 10361 SOC_MEM_FIELD_VALID(unit, 10362 EFP_POLICY_TABLEm, Y_REDIR_DROP_PRECEDENCEf) || 10363 SOC_MEM_FIELD_VALID(unit, 10364 EFP_POLICY_TABLEm, G_REDIR_DROP_PRECEDENCEf)) ? 10365 TRUE : FALSE; 10366 break; 10367 case bcmFieldActionRpRedirDropPrecedence: 10368 #ifdef BCM_MONTEREY_SUPPORT 10369 if (SOC_IS_MONTEREY(unit)) { 10370 *result = FALSE; 10371 break; 10372 } 10373 #endif 10374 *result = SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, 10375 R_REDIR_DROP_PRECEDENCEf) ? TRUE : FALSE; 10376 break; 10377 case bcmFieldActionYpRedirDropPrecedence: 10378 #ifdef BCM_MONTEREY_SUPPORT 10379 if (SOC_IS_MONTEREY(unit)) { 10380 *result = FALSE; 10381 break; 10382 } 10383 #endif 10384 *result = SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, 10385 Y_REDIR_DROP_PRECEDENCEf) ? TRUE : FALSE; 10386 break; 10387 case bcmFieldActionGpRedirDropPrecedence: 10388 #ifdef BCM_MONTEREY_SUPPORT 10389 if (SOC_IS_MONTEREY(unit)) { 10390 *result = FALSE; 10391 break; 10392 } 10393 #endif 10394 *result = SOC_MEM_FIELD_VALID(unit, EFP_POLICY_TABLEm, 10395 G_REDIR_DROP_PRECEDENCEf) ? TRUE : FALSE; 10396 break; 10397 #endif /* BCM_TRX_SUPPORT */ 10398 #if defined (BCM_KATANA2_SUPPORT) 10399 case bcmFieldActionPrioIntNew: 10400 case bcmFieldActionGpPrioIntNew: 10401 case bcmFieldActionRpPrioIntNew: 10402 case bcmFieldActionYpPrioIntNew: 10403 *result = SOC_IS_KATANA2(unit) ? TRUE : FALSE; 10404 break; 10405 #endif 10406 #if defined(BCM_APACHE_SUPPORT) 10407 case bcmFieldActionRedirectPrioIntNew: 10408 case bcmFieldActionRpRedirectPrioIntNew: 10409 case bcmFieldActionYpRedirectPrioIntNew: 10410 case bcmFieldActionGpRedirectPrioIntNew: 10411 *result = (SOC_IS_APACHE(unit) && !SOC_IS_MONTEREY(unit)) ? TRUE : FALSE; 10412 break; 10413 #endif /* BCM_APACHE_SUPPORT */ 10414 10415 #if defined(BCM_TSN_SUPPORT) 10416 case bcmFieldActionMtuSize: 10417 case bcmFieldActionStuSize: 10418 *result = (soc_feature(unit, soc_feature_tsn_mtu_stu)) ? 10419 TRUE : FALSE; 10420 break; 10421 #endif /* BCM_TSN_SUPPORT */ 10422 10423 #if defined(BCM_TSN_SR_SUPPORT) 10424 case bcmFieldActionSRDuplicateDrop: 10425 case bcmFieldActionSRDuplicateDropCancel: 10426 case bcmFieldActionSRTagAdd: 10427 case bcmFieldActionSRTagDelete: 10428 case bcmFieldActionSRLanIdNew: 10429 case bcmFieldActionSRNetIdNew: 10430 *result = (soc_feature(unit, soc_feature_tsn_sr)) ? 10431 TRUE : FALSE; 10432 break; 10433 #endif /* BCM_TSN_SR_SUPPORT */ 10434 10435 default: 10436 *result = FALSE; 10437 } 10438 return (BCM_E_NONE); 10439 } 10440 if (stage == _BCM_FIELD_STAGE_LOOKUP) { 10441 switch (action) { 10442 case bcmFieldActionDrop: 10443 case bcmFieldActionDropCancel: 10444 case bcmFieldActionCopyToCpu: 10445 case bcmFieldActionCopyToCpuCancel: 10446 case bcmFieldActionPrioPktNew: 10447 case bcmFieldActionInnerVlanAdd: 10448 case bcmFieldActionInnerVlanNew: 10449 case bcmFieldActionInnerVlanDelete: 10450 case bcmFieldActionOuterVlanAdd: 10451 case bcmFieldActionOuterVlanNew: 10452 case bcmFieldActionOuterVlanLookup: 10453 case bcmFieldActionCosQCpuNew: 10454 case bcmFieldActionPrioPktAndIntNew: 10455 case bcmFieldActionPrioIntNew: 10456 case bcmFieldActionDropPrecedence: 10457 case bcmFieldActionDoNotLearn: 10458 case bcmFieldActionDoNotCheckVlan: 10459 case bcmFieldActionEnableVlanCheck: 10460 case bcmFieldActionClassDestSet: 10461 case bcmFieldActionClassSourceSet: 10462 *result = TRUE; 10463 break; 10464 case bcmFieldActionEsmSearchKeySrcMac: 10465 *result = (SOC_IS_TRIUMPH3(unit) && soc_feature(unit, soc_feature_esm_support)) ? TRUE : FALSE; 10466 break; 10467 case bcmFieldActionVrfSet: 10468 *result = SOC_IS_HURRICANE2(unit) ? FALSE : TRUE; 10469 break; 10470 case bcmFieldActionIncomingMplsPortSet: 10471 *result = soc_feature(unit, soc_feature_mpls) ? TRUE : FALSE; 10472 break; 10473 case bcmFieldActionIngressGportSet: 10474 *result = ( soc_feature(unit, soc_feature_mpls) || 10475 soc_feature(unit, soc_feature_l2gre) || 10476 soc_feature(unit, soc_feature_mim) || 10477 soc_feature(unit, soc_feature_trill) || 10478 soc_feature(unit, soc_feature_niv) || 10479 soc_feature(unit, soc_feature_vlan_vp)|| 10480 soc_feature(unit, soc_feature_wlan) ) ? TRUE : FALSE; 10481 break; 10482 case bcmFieldActionVpnSet: 10483 *result = (soc_feature(unit, soc_feature_vfi_from_vlan_tables) || 10484 soc_feature(unit, soc_feature_vxlan_lite)) ? TRUE : FALSE; 10485 break; 10486 case bcmFieldActionL3IngressSet: 10487 if (SOC_MEM_FIELD_VALID(unit, VFP_POLICY_TABLEm, L3_IIFf)) { 10488 *result = TRUE; 10489 } else { 10490 *result = FALSE; 10491 } 10492 break; 10493 case bcmFieldActionOamPbbteLookupEnable: 10494 *result = soc_feature(unit, 10495 soc_feature_field_oam_actions) ? TRUE : FALSE; 10496 break; 10497 case bcmFieldActionOuterVlanCopyInner: 10498 case bcmFieldActionOuterVlanPrioCopyInner: 10499 case bcmFieldActionOuterVlanCfiCopyInner: 10500 case bcmFieldActionInnerVlanCopyOuter: 10501 case bcmFieldActionInnerVlanPrioCopyOuter: 10502 case bcmFieldActionInnerVlanCfiCopyOuter: 10503 case bcmFieldActionInnerVlanCfiNew: 10504 case bcmFieldActionOuterVlanCfiNew: 10505 case bcmFieldActionOuterVlanPrioNew: 10506 case bcmFieldActionInnerVlanPrioNew: 10507 #ifdef BCM_TRIDENT_SUPPORT 10508 *result = (SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || 10509 SOC_IS_TRIUMPH3(unit)); 10510 break; 10511 case bcmFieldActionCompressSrcIp6: 10512 case bcmFieldActionCompressDstIp6: 10513 if (SOC_IS_TD_TT(unit) && 10514 SOC_MEM_FIELD_VALID(unit, VFP_POLICY_TABLEm, 10515 IPV6_TO_IPV4_MAP_OFFSET_SETf)) { 10516 BCM_IF_ERROR_RETURN(bcm_esw_switch_control_get(unit, 10517 bcmSwitchIp6CompressEnable, &vfp_compress_en)); 10518 *result = vfp_compress_en ? TRUE : FALSE; 10519 } else { 10520 *result = FALSE; 10521 } 10522 break; 10523 #endif /* !BCM_TRIDENT_SUPPORT */ 10524 #if defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIDENT3_SUPPORT) 10525 case bcmFieldActionProtectionSwitchingDrop: 10526 *result = SOC_IS_TD2P_TT2P(unit) || 10527 SOC_IS_APACHE(unit) || 10528 SOC_IS_TRIDENT3X(unit); 10529 break; 10530 #endif 10531 case bcmFieldActionRegexActionCancel: 10532 *result = soc_feature(unit, soc_feature_regex) ? TRUE : FALSE; 10533 break; 10534 10535 #if defined(BCM_KATANA2_SUPPORT) 10536 case bcmFieldActionOamDomain: 10537 if (SOC_IS_KATANA2(unit) && (soc_feature(unit, soc_feature_oam))) { 10538 *result = TRUE; 10539 } else { 10540 *result = FALSE; 10541 } 10542 break; 10543 #endif /* BCM_KATANA2_SUPPORT */ 10544 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \ 10545 defined(BCM_APACHE_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) 10546 case bcmFieldActionDoNotOverride: 10547 if (SOC_IS_KATANA2(unit) || SOC_IS_TRIUMPH3(unit) || 10548 (SOC_IS_APACHE(unit) && !SOC_IS_MONTEREY(unit)) 10549 || SOC_IS_TD2_TT2(unit)) { 10550 *result = TRUE; 10551 } else { 10552 *result = FALSE; 10553 } 10554 break; 10555 #endif 10556 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 10557 defined(BCM_GREYHOUND2_SUPPORT) 10558 case bcmFieldActionDscpMapNew: 10559 if ((SOC_IS_KATANA2(unit)) || 10560 (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 10561 (soc_feature(unit, soc_feature_vxlan_lite_riot))) { 10562 *result = (stage == _BCM_FIELD_STAGE_LOOKUP); 10563 break; 10564 } 10565 *result = FALSE; 10566 break; 10567 #endif 10568 10569 #if defined(BCM_GREYHOUND2_SUPPORT) 10570 case bcmFieldActionUseTunnelPayload: 10571 *result = (soc_feature(unit, soc_feature_vxlan_lite)) ? TRUE : FALSE; 10572 break; 10573 #endif /* BCM_GREYHOUND2_SUPPORT */ 10574 10575 #if defined(BCM_TSN_SUPPORT) 10576 case bcmFieldActionTsnFlowIdNew: 10577 case bcmFieldActionTsnFlowPriMapIdNew: 10578 case bcmFieldActionMtuProfileIdNew: 10579 case bcmFieldActionStuProfileIdNew: 10580 *result = (soc_feature(unit, soc_feature_tsn)) ? TRUE : FALSE; 10581 break; 10582 case bcmFieldActionTafGatePriMap: 10583 *result = (soc_feature(unit, soc_feature_tsn_taf)) ? TRUE : FALSE; 10584 break; 10585 #endif /* BCM_TSN_SUPPORT */ 10586 10587 #if defined(BCM_TSN_SR_SUPPORT) 10588 case bcmFieldActionSRLanIdNew: 10589 case bcmFieldActionSRNetIdNew: 10590 case bcmFieldActionSRFlowIdNew: 10591 case bcmFieldActionSRFlowPriMapIdNew: 10592 *result = (soc_feature(unit, soc_feature_tsn_sr)) ? TRUE : FALSE; 10593 break; 10594 #endif /* BCM_TSN_SR_SUPPORT */ 10595 10596 default: 10597 *result = FALSE; 10598 } 10599 return (BCM_E_NONE); 10600 } 10601 10602 if ((stage == _BCM_FIELD_STAGE_INGRESS) || 10603 (stage == _BCM_FIELD_STAGE_EXTERNAL)) { 10604 switch (action) { 10605 case bcmFieldActionRedirectEgrNextHop: 10606 #if defined(INCLUDE_L3) 10607 if (soc_feature(unit, soc_feature_field_action_redirect_nexthop) 10608 || soc_feature(unit, soc_feature_field_action_redirect_ecmp)) { 10609 *result = TRUE; 10610 } else 10611 #endif 10612 { 10613 *result = FALSE; 10614 } 10615 break; 10616 case bcmFieldActionAddClassTag: 10617 case bcmFieldActionCopyToCpu: 10618 case bcmFieldActionCopyToCpuCancel: 10619 case bcmFieldActionDrop: 10620 case bcmFieldActionDropCancel: 10621 case bcmFieldActionDropPrecedence: 10622 case bcmFieldActionColorIndependent: 10623 case bcmFieldActionL3ChangeVlan: 10624 case bcmFieldActionL3ChangeVlanCancel: 10625 case bcmFieldActionL3ChangeMacDa: 10626 case bcmFieldActionL3ChangeMacDaCancel: 10627 case bcmFieldActionPrioPktCopy: 10628 case bcmFieldActionPrioPktNew: 10629 case bcmFieldActionPrioPktTos: 10630 case bcmFieldActionPrioPktCancel: 10631 case bcmFieldActionEcnNew: 10632 case bcmFieldActionDscpNew: 10633 case bcmFieldActionDscpCancel: 10634 case bcmFieldActionCosQNew: 10635 case bcmFieldActionCosQCpuNew: 10636 case bcmFieldActionVlanCosQNew: 10637 case bcmFieldActionMirrorOverride: 10638 case bcmFieldActionSwitchToCpuCancel: 10639 case bcmFieldActionSwitchToCpuReinstate: 10640 case bcmFieldActionRedirect: 10641 case bcmFieldActionRedirectTrunk: 10642 case bcmFieldActionRedirectCancel: 10643 case bcmFieldActionRedirectPbmp: 10644 case bcmFieldActionRedirectIpmc: 10645 case bcmFieldActionRedirectMcast: 10646 *result = TRUE; 10647 break; 10648 case bcmFieldActionMacSecRedirectIpmc: 10649 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 10650 *result = soc_feature(unit, soc_feature_xflow_macsec); 10651 #endif 10652 break; 10653 case bcmFieldActionL3Switch: 10654 case bcmFieldActionL3SwitchCancel: 10655 if (soc_feature(unit, 10656 soc_feature_field_action_l3_route_disabled)) { 10657 *result = FALSE; 10658 } else { 10659 *result = TRUE; 10660 } 10661 break; 10662 case bcmFieldActionRedirectBcastPbmp: 10663 if (SOC_IS_TD_TT(unit) || SOC_IS_ENDURO(unit) || 10664 SOC_IS_KATANAX(unit) || SOC_IS_TRIUMPH2(unit) || 10665 SOC_IS_TRIUMPH3(unit) || SOC_IS_APOLLO(unit) || 10666 SOC_IS_GREYHOUND(unit) || SOC_IS_HURRICANE3(unit) || 10667 SOC_IS_GREYHOUND2(unit)) { 10668 *result = TRUE; 10669 } else { 10670 *result = FALSE; 10671 } 10672 break; 10673 case bcmFieldActionRedirectVlan: 10674 if (SOC_IS_TR_VL(unit)) { 10675 *result= TRUE; 10676 } else { 10677 *result = FALSE; 10678 } 10679 break; 10680 case bcmFieldActionEgressMask: 10681 case bcmFieldActionEgressPortsAdd: 10682 case bcmFieldActionDoNotChangeTtl: 10683 *result = TRUE; 10684 break; 10685 case bcmFieldActionDoNotCheckUrpf: 10686 *result = SOC_MEM_FIELD_VALID(unit, FP_POLICY_TABLEm, DO_NOT_URPFf); 10687 break; 10688 case bcmFieldActionPrioPktAndIntCopy: 10689 case bcmFieldActionPrioPktAndIntNew: 10690 case bcmFieldActionPrioPktAndIntTos: 10691 case bcmFieldActionPrioPktAndIntCancel: 10692 case bcmFieldActionPrioIntCopy: 10693 case bcmFieldActionPrioIntNew: 10694 case bcmFieldActionPrioIntTos: 10695 case bcmFieldActionPrioIntCancel: 10696 case bcmFieldActionMirrorIngress: 10697 case bcmFieldActionMirrorEgress: 10698 10699 case bcmFieldActionRpDrop: 10700 case bcmFieldActionRpDropCancel: 10701 case bcmFieldActionRpDropPrecedence: 10702 case bcmFieldActionRpCopyToCpu: 10703 case bcmFieldActionRpCopyToCpuCancel: 10704 case bcmFieldActionRpPrioPktCopy: 10705 case bcmFieldActionRpPrioPktNew: 10706 case bcmFieldActionRpPrioPktTos: 10707 case bcmFieldActionRpPrioPktCancel: 10708 case bcmFieldActionRpDscpNew: 10709 case bcmFieldActionRpDscpCancel: 10710 case bcmFieldActionRpEcnNew: 10711 case bcmFieldActionRpCosQNew: 10712 case bcmFieldActionRpVlanCosQNew: 10713 case bcmFieldActionRpPrioPktAndIntCopy: 10714 case bcmFieldActionRpPrioPktAndIntNew: 10715 case bcmFieldActionRpPrioPktAndIntTos: 10716 case bcmFieldActionRpPrioPktAndIntCancel: 10717 case bcmFieldActionRpSwitchToCpuCancel: 10718 case bcmFieldActionRpSwitchToCpuReinstate: 10719 case bcmFieldActionRpPrioIntCopy: 10720 case bcmFieldActionRpPrioIntNew: 10721 case bcmFieldActionRpPrioIntTos: 10722 case bcmFieldActionRpPrioIntCancel: 10723 10724 case bcmFieldActionYpDrop: 10725 case bcmFieldActionYpDropCancel: 10726 case bcmFieldActionYpDropPrecedence: 10727 case bcmFieldActionYpCopyToCpu: 10728 case bcmFieldActionYpCopyToCpuCancel: 10729 case bcmFieldActionYpPrioPktCopy: 10730 case bcmFieldActionYpPrioPktNew: 10731 case bcmFieldActionYpPrioPktTos: 10732 case bcmFieldActionYpPrioPktCancel: 10733 case bcmFieldActionYpDscpNew: 10734 case bcmFieldActionYpDscpCancel: 10735 case bcmFieldActionYpEcnNew: 10736 case bcmFieldActionYpCosQNew: 10737 case bcmFieldActionYpVlanCosQNew: 10738 case bcmFieldActionYpPrioPktAndIntCopy: 10739 case bcmFieldActionYpPrioPktAndIntNew: 10740 case bcmFieldActionYpPrioPktAndIntTos: 10741 case bcmFieldActionYpPrioPktAndIntCancel: 10742 case bcmFieldActionYpSwitchToCpuCancel: 10743 case bcmFieldActionYpSwitchToCpuReinstate: 10744 case bcmFieldActionYpPrioIntCopy: 10745 case bcmFieldActionYpPrioIntNew: 10746 case bcmFieldActionYpPrioIntTos: 10747 case bcmFieldActionYpPrioIntCancel: 10748 10749 case bcmFieldActionGpDrop: 10750 case bcmFieldActionGpDropCancel: 10751 case bcmFieldActionGpDropPrecedence: 10752 case bcmFieldActionGpCopyToCpu: 10753 case bcmFieldActionGpCopyToCpuCancel: 10754 case bcmFieldActionGpPrioPktCopy: 10755 case bcmFieldActionGpPrioPktNew: 10756 case bcmFieldActionGpPrioPktTos: 10757 case bcmFieldActionGpPrioPktCancel: 10758 case bcmFieldActionGpDscpNew: 10759 case bcmFieldActionGpTosPrecedenceNew: 10760 case bcmFieldActionGpTosPrecedenceCopy: 10761 case bcmFieldActionGpDscpCancel: 10762 case bcmFieldActionGpEcnNew: 10763 case bcmFieldActionGpCosQNew: 10764 case bcmFieldActionGpVlanCosQNew: 10765 case bcmFieldActionGpPrioPktAndIntCopy: 10766 case bcmFieldActionGpPrioPktAndIntNew: 10767 case bcmFieldActionGpPrioPktAndIntTos: 10768 case bcmFieldActionGpPrioPktAndIntCancel: 10769 case bcmFieldActionGpSwitchToCpuCancel: 10770 case bcmFieldActionGpSwitchToCpuReinstate: 10771 case bcmFieldActionGpPrioIntCopy: 10772 case bcmFieldActionGpPrioIntNew: 10773 case bcmFieldActionGpPrioIntTos: 10774 case bcmFieldActionGpPrioIntCancel: 10775 *result = TRUE; 10776 break; 10777 case bcmFieldActionMultipathHash: 10778 *result = SOC_MEM_FIELD_VALID(unit, FP_POLICY_TABLEm, ECMP_HASH_SELf); 10779 break; 10780 case bcmFieldActionIpFix: 10781 case bcmFieldActionIpFixCancel: 10782 *result = soc_feature(unit, soc_feature_ipfix) ? TRUE : FALSE; 10783 break; 10784 case bcmFieldActionOamUpMep: 10785 case bcmFieldActionOamTx: 10786 case bcmFieldActionOamLmepMdl: 10787 case bcmFieldActionOamServicePriMappingPtr: 10788 case bcmFieldActionOamLmBasePtr: 10789 case bcmFieldActionOamDmEnable: 10790 case bcmFieldActionOamLmEnable: 10791 case bcmFieldActionOamLmepEnable: 10792 *result = soc_feature(unit, 10793 soc_feature_field_oam_actions) ? TRUE : FALSE; 10794 break; 10795 #if defined(BCM_KATANA2_SUPPORT) 10796 case bcmFieldActionOamLmDmSampleEnable: 10797 *result = (soc_feature(unit, 10798 soc_feature_field_oam_actions) 10799 && ((SOC_IS_SABER2(unit)) || (SOC_IS_KATANA2(unit)))) 10800 ? TRUE : FALSE; 10801 break; 10802 #endif 10803 case bcmFieldActionOamDmTimeFormat: 10804 *result = SOC_MEM_FIELD_VALID(unit, 10805 FP_POLICY_TABLEm, OAM_DM_TYPEf); 10806 break; 10807 case bcmFieldActionOamTagStatusCheck: 10808 *result = SOC_MEM_FIELD_VALID(unit, 10809 FP_POLICY_TABLEm, OAM_TAG_STATUS_CHECK_CONTROLf); 10810 break; 10811 case bcmFieldActionTimeStampToCpu: 10812 case bcmFieldActionRpTimeStampToCpu: 10813 case bcmFieldActionYpTimeStampToCpu: 10814 case bcmFieldActionGpTimeStampToCpu: 10815 case bcmFieldActionTimeStampToCpuCancel: 10816 case bcmFieldActionRpTimeStampToCpuCancel: 10817 case bcmFieldActionYpTimeStampToCpuCancel: 10818 case bcmFieldActionGpTimeStampToCpuCancel: 10819 *result = soc_feature(unit, soc_feature_field_action_timestamp) ? \ 10820 TRUE : FALSE; 10821 break; 10822 case bcmFieldActionOffloadRedirect: 10823 case bcmFieldActionOffloadClassSet: 10824 case bcmFieldActionOffloadDropIndication: 10825 *result = (SOC_MEM_FIELD_VALID(unit, 10826 FP_POLICY_TABLEm, HI_PRI_ACTION_CONTROLf) 10827 && (stage == _BCM_FIELD_STAGE_INGRESS)); 10828 break; 10829 case bcmFieldActionFabricQueue: 10830 *result = (soc_feature(unit, 10831 soc_feature_field_action_fabric_queue) 10832 && (stage == _BCM_FIELD_STAGE_INGRESS)) 10833 ? TRUE : FALSE; 10834 break; 10835 10836 case bcmFieldActionUcastQueueNew: 10837 case bcmFieldActionRpUcastQueueNew: 10838 case bcmFieldActionYpUcastQueueNew: 10839 case bcmFieldActionGpUcastQueueNew: 10840 *result = ((stage == _BCM_FIELD_STAGE_INGRESS) && (SOC_IS_KATANA2(unit) || SOC_IS_TRIUMPH3(unit))); 10841 break; 10842 case bcmFieldActionIntCosUcastQueueNew: 10843 case bcmFieldActionRpIntCosUcastQueueNew: 10844 case bcmFieldActionYpIntCosUcastQueueNew: 10845 case bcmFieldActionGpIntCosUcastQueueNew: 10846 *result = ((stage == _BCM_FIELD_STAGE_INGRESS) && (SOC_IS_KATANA2(unit) || SOC_IS_TRIUMPH3(unit))); 10847 break; 10848 10849 case bcmFieldActionPortPrioIntCosQNew: 10850 case bcmFieldActionRpPortPrioIntCosQNew: 10851 case bcmFieldActionYpPortPrioIntCosQNew: 10852 case bcmFieldActionGpPortPrioIntCosQNew: 10853 *result = (soc_feature(unit, 10854 soc_feature_field_ingress_cosq_override) 10855 && (SOC_IS_KATANA2(unit) 10856 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 10857 || SOC_IS_TRIUMPH3(unit))); 10858 break; 10859 case bcmFieldActionServicePrioIntCosQNew: 10860 case bcmFieldActionRpServicePrioIntCosQNew: 10861 case bcmFieldActionYpServicePrioIntCosQNew: 10862 case bcmFieldActionGpServicePrioIntCosQNew: 10863 *result = (soc_feature(unit, 10864 soc_feature_field_ingress_cosq_override) 10865 && SOC_IS_KATANA2(unit)); 10866 break; 10867 10868 case bcmFieldActionSrcMacNew: 10869 #if defined(INCLUDE_L3) 10870 if ((stage == _BCM_FIELD_STAGE_INGRESS) 10871 && (!SOC_IS_MONTEREY(unit)) 10872 && (SOC_IS_TD_TT(unit) 10873 || SOC_IS_TRIUMPH2(unit) 10874 || SOC_IS_APOLLO(unit) 10875 || SOC_IS_KATANAX(unit) 10876 || SOC_IS_ENDURO(unit) 10877 || SOC_IS_HURRICANEX(unit) 10878 || SOC_IS_TRIUMPH3(unit) 10879 || SOC_IS_GREYHOUND(unit) 10880 || SOC_IS_GREYHOUND2(unit) 10881 ) 10882 ) { 10883 *result = (soc_feature(unit, 10884 soc_feature_field_action_l2_change) && 10885 soc_feature(unit, 10886 soc_feature_l3)) ? TRUE : FALSE; 10887 } else { 10888 *result = FALSE; 10889 } 10890 #else /* INCLUDE_L3 */ 10891 *result = FALSE; 10892 #endif /* !INCLUDE_L3 */ 10893 break; 10894 case bcmFieldActionDstMacNew: 10895 case bcmFieldActionOuterVlanNew: 10896 #if defined(INCLUDE_L3) 10897 if ((stage == _BCM_FIELD_STAGE_INGRESS) 10898 && (!SOC_IS_MONTEREY(unit))) { 10899 *result = (soc_feature(unit, 10900 soc_feature_field_action_l2_change) && 10901 soc_feature(unit, 10902 soc_feature_l3)) ? TRUE : FALSE; 10903 } else { 10904 *result = FALSE; 10905 } 10906 #else /* INCLUDE_L3 */ 10907 *result = FALSE; 10908 #endif /* !INCLUDE_L3 */ 10909 break; 10910 case bcmFieldActionVnTagNew: 10911 case bcmFieldActionVnTagDelete: 10912 #if defined(INCLUDE_L3) 10913 if ((stage == _BCM_FIELD_STAGE_INGRESS) 10914 && (!SOC_IS_MONTEREY(unit))) { 10915 *result = (soc_feature(unit, 10916 soc_feature_field_action_l2_change) && 10917 soc_feature(unit, 10918 soc_feature_l3) && 10919 soc_feature(unit, 10920 soc_feature_niv)) ? TRUE : FALSE; 10921 } else 10922 #endif 10923 { 10924 *result = soc_feature(unit, soc_feature_niv) ? TRUE : FALSE; 10925 } 10926 break; 10927 case bcmFieldActionEtagNew: 10928 case bcmFieldActionEtagDelete: 10929 #if defined(INCLUDE_L3) 10930 if ((stage == _BCM_FIELD_STAGE_INGRESS) 10931 && (!SOC_IS_MONTEREY(unit))) { 10932 *result = (soc_feature(unit, 10933 soc_feature_field_action_l2_change) && 10934 soc_feature(unit, 10935 soc_feature_l3) && 10936 soc_feature(unit, 10937 soc_feature_port_extension)) ? TRUE : FALSE; 10938 } else 10939 #endif 10940 { 10941 *result = soc_feature(unit, soc_feature_port_extension) ? TRUE : FALSE; 10942 } 10943 break; 10944 case bcmFieldActionCnmCancel: 10945 *result = SOC_MEM_FIELD_VALID(unit, FP_POLICY_TABLEm, 10946 DO_NOT_GENERATE_CNMf); 10947 break; 10948 #if defined(BCM_TRIDENT_SUPPORT) 10949 case bcmFieldActionDynamicHgTrunkCancel: 10950 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_TRIDENT(unit) || 10951 (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 10952 *result = TRUE; 10953 } else { 10954 *result = FALSE; 10955 } 10956 break; 10957 #endif 10958 case bcmFieldActionUcastCosQNew: 10959 case bcmFieldActionGpUcastCosQNew: 10960 case bcmFieldActionYpUcastCosQNew: 10961 case bcmFieldActionRpUcastCosQNew: 10962 *result = (soc_feature(unit, soc_feature_ets) || 10963 SOC_IS_KATANAX(unit)) ? TRUE : FALSE; 10964 break; 10965 case bcmFieldActionMcastCosQNew: 10966 case bcmFieldActionGpMcastCosQNew: 10967 case bcmFieldActionYpMcastCosQNew: 10968 case bcmFieldActionRpMcastCosQNew: 10969 *result = soc_feature(unit, soc_feature_ets) ? TRUE : FALSE; 10970 break; 10971 case bcmFieldActionServicePoolIdPrecedenceNew: 10972 case bcmFieldActionServicePoolIdNew: 10973 if (SOC_IS_TRIUMPH2(unit) || SOC_IS_APOLLO(unit) || 10974 SOC_IS_TD_TT(unit) || SOC_IS_VALKYRIE2(unit)) { 10975 *result = TRUE; 10976 } else { 10977 *result = FALSE; 10978 } 10979 break; 10980 case bcmFieldActionNatCancel: 10981 case bcmFieldActionNat: 10982 case bcmFieldActionNatEgressOverride: 10983 if (0 == soc_feature(unit, soc_feature_nat)) { 10984 *result = FALSE; 10985 } 10986 else { 10987 *result = TRUE; 10988 } 10989 break; 10990 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \ 10991 defined(BCM_APACHE_SUPPORT) || defined (BCM_GREYHOUND2_SUPPORT) 10992 case bcmFieldActionUseGlobalMeterColor: 10993 *result = soc_feature(unit, soc_feature_global_meter) ? TRUE : FALSE; 10994 break; 10995 #endif /* BCM_KATANA_SUPPORT or BCM_TRIUMPH3_SUPPORT */ 10996 10997 #if defined(BCM_KATANA2_SUPPORT) 10998 case bcmFieldActionOamOlpHeaderAdd: 10999 if (SOC_IS_KATANA2(unit) && 11000 (soc_feature(unit, soc_feature_oam))) { 11001 *result = TRUE; 11002 } else { 11003 *result = FALSE; 11004 } 11005 break; 11006 case bcmFieldActionOamSessionId: 11007 if (SOC_IS_KATANA2(unit) && 11008 (soc_feature(unit, soc_feature_oam))) { 11009 *result = TRUE; 11010 } else { 11011 *result = FALSE; 11012 } 11013 break; 11014 case bcmFieldActionEgressClassSelect: 11015 if (SOC_IS_KATANA2(unit)) { 11016 if (stage == _BCM_FIELD_STAGE_INGRESS) { 11017 *result = SOC_MEM_FIELD_VALID(unit, FP_POLICY_TABLEm, 11018 I2E_CLASSID_SELf) ? \ 11019 TRUE : FALSE; 11020 } 11021 } else { 11022 *result = FALSE; 11023 } 11024 break; 11025 case bcmFieldActionHiGigClassSelect: 11026 if (SOC_IS_KATANA2(unit) && (stage == _BCM_FIELD_STAGE_INGRESS)) { 11027 *result = SOC_MEM_FIELD_VALID(unit, FP_POLICY_TABLEm, 11028 HG_CLASSID_SELf) ? \ 11029 TRUE : FALSE; 11030 } else { 11031 *result = FALSE; 11032 } 11033 break; 11034 case bcmFieldActionNewClassId: 11035 if (SOC_IS_KATANA2(unit) && (stage == _BCM_FIELD_STAGE_INGRESS)) { 11036 *result = SOC_MEM_FIELD_VALID(unit, FP_POLICY_TABLEm, 11037 I2E_CLASSIDf) ? \ 11038 TRUE : FALSE; 11039 } else { 11040 *result = FALSE; 11041 } 11042 break; 11043 #endif /* BCM_KATANA2_SUPPORT */ 11044 #if defined(BCM_TRIDENT2_SUPPORT) 11045 case bcmFieldActionTrunkResilientHashCancel: 11046 case bcmFieldActionHgTrunkResilientHashCancel: 11047 case bcmFieldActionEcmpResilientHashCancel: 11048 if (SOC_IS_TD2_TT2(unit)) { 11049 *result = TRUE; 11050 } else { 11051 *result = FALSE; 11052 } 11053 break; 11054 #endif 11055 #if defined(BCM_GREYHOUND_SUPPORT) 11056 case bcmFieldActionPfcClassNew: 11057 if (soc_feature(unit, soc_feature_field_action_pfc_class)) { 11058 *result = TRUE; 11059 } else { 11060 *result = FALSE; 11061 } 11062 break; 11063 case bcmFieldActionRpIntCongestionNotificationNew: 11064 case bcmFieldActionYpIntCongestionNotificationNew: 11065 case bcmFieldActionGpIntCongestionNotificationNew: 11066 if (soc_feature(unit, soc_feature_ecn_wred)) { 11067 *result = TRUE; 11068 } else { 11069 *result = FALSE; 11070 } 11071 break; 11072 #endif /* BCM_GREYHOUND_SUPPORT */ 11073 #if defined(BCM_TRIUMPH3_SUPPORT) 11074 case bcmFieldActionUnmodifiedPacketRedirectPort: 11075 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 11076 *result = TRUE; 11077 } else { 11078 *result = FALSE; 11079 } 11080 break; 11081 #endif 11082 #if defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 11083 case bcmFieldActionRecoverableDropCancel: 11084 if (SOC_IS_TD2P_TT2P(unit) 11085 || SOC_IS_TRIUMPH3(unit)) { 11086 *result = (stage == _BCM_FIELD_STAGE_INGRESS); 11087 } else { 11088 *result = FALSE; 11089 } 11090 return (BCM_E_NONE); 11091 break; 11092 #endif 11093 case bcmFieldActionChangeL2Fields: 11094 #if defined(INCLUDE_L3) 11095 if (stage == _BCM_FIELD_STAGE_INGRESS) { 11096 *result = 11097 (soc_feature(unit, soc_feature_field_action_l2_change) && 11098 soc_feature(unit, soc_feature_nh_for_ifp_actions) && 11099 soc_feature(unit, soc_feature_l3)) ? TRUE : FALSE; 11100 } else { 11101 *result = FALSE; 11102 } 11103 #else /* INCLUDE_L3 */ 11104 *result = FALSE; 11105 #endif /* !INCLUDE_L3 */ 11106 break; 11107 11108 #if defined(BCM_HURRICANE3_SUPPORT) 11109 case bcmFieldActionPfcTx: 11110 if ((SOC_IS_HURRICANE3(unit) || SOC_IS_GREYHOUND2(unit)) && 11111 (stage == _BCM_FIELD_STAGE_INGRESS)) { 11112 *result = TRUE; 11113 } else { 11114 *result = FALSE; 11115 } 11116 break; 11117 case bcmFieldActionSwitchEncap: 11118 if (stage == _BCM_FIELD_STAGE_INGRESS) { 11119 *result = (soc_feature(unit, soc_feature_miml) || 11120 soc_feature(unit, soc_feature_custom_header)) ? TRUE : FALSE; 11121 } else { 11122 *result = FALSE; 11123 } 11124 break; 11125 #endif /* BCM_HURRICANE3_SUPPORT */ 11126 #if defined(BCM_GREYHOUND2_SUPPORT) 11127 case bcmFieldActionDoNotCutThrough: 11128 if (soc_feature(unit, soc_feature_asf) && 11129 (stage == _BCM_FIELD_STAGE_INGRESS)) { 11130 *result = TRUE; 11131 } else { 11132 *result = FALSE; 11133 } 11134 break; 11135 case bcmFieldActionVxlanTerminate: 11136 if (soc_feature(unit, soc_feature_vxlan_lite) && 11137 (stage == _BCM_FIELD_STAGE_INGRESS)) { 11138 *result = TRUE; 11139 } else { 11140 *result = FALSE; 11141 } 11142 break; 11143 #endif /* BCM_GREYHOUND2_SUPPORT */ 11144 #if defined(BCM_TSN_SUPPORT) 11145 case bcmFieldActionMtuSize: 11146 case bcmFieldActionStuSize: 11147 if (soc_feature(unit, soc_feature_tsn_mtu_stu) && 11148 (stage == _BCM_FIELD_STAGE_INGRESS)) { 11149 *result = TRUE; 11150 } else { 11151 *result = FALSE; 11152 } 11153 break; 11154 #endif /* BCM_TSN_SUPPORT */ 11155 #if defined(BCM_TSN_SR_SUPPORT) 11156 case bcmFieldActionSRDuplicateDrop: 11157 case bcmFieldActionSRDuplicateDropCancel: 11158 if (soc_feature(unit, soc_feature_tsn_sr) && 11159 (stage == _BCM_FIELD_STAGE_INGRESS)) { 11160 *result = TRUE; 11161 } else { 11162 *result = FALSE; 11163 } 11164 break; 11165 case bcmFieldActionSRNetIdFilter: 11166 case bcmFieldActionSRNetIdSource: 11167 case bcmFieldActionFilterSrcMacPorts: 11168 case bcmFieldActionSRCopyToCpu: 11169 if (soc_feature(unit, soc_feature_tsn_sr) && 11170 (stage == _BCM_FIELD_STAGE_INGRESS)) { 11171 *result = TRUE; 11172 } else { 11173 *result = FALSE; 11174 } 11175 break; 11176 #endif /* BCM_TSN_SR_SUPPORT */ 11177 11178 #if defined(BCM_SABER2_SUPPORT) 11179 case bcmFieldActionOamLmCounterPoolId: 11180 *result = SOC_IS_SABER2(unit)? TRUE: FALSE; 11181 break; 11182 #endif /* BCM_SABER2_SUPPORT */ 11183 11184 #if defined(BCM_METROLITE_SUPPORT) 11185 case bcmFieldActionSwapMacDaSa: 11186 case bcmFieldActionSwapSourceIPDestIP: 11187 case bcmFieldActionReplaceTtl: 11188 case bcmFieldActionPacketIsL3SAT: 11189 if (SOC_IS_METROLITE(unit)) { 11190 *result = TRUE; 11191 } else { 11192 *result = FALSE; 11193 } 11194 break; 11195 #endif /* BCM_METROLITE_SUPPORT */ 11196 11197 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 11198 case bcmFieldActionMacSecDecrypt: 11199 case bcmFieldActionMacSecEncrypt: 11200 case bcmFieldActionMacSecPktTypeSet: 11201 case bcmFieldActionMacSecSubPortNumAdd: 11202 *result = SOC_IS_MONTEREY(unit); 11203 break; 11204 #endif 11205 #if defined(BCM_MONTEREY_SUPPORT) 11206 case bcmFieldActionRoeFrameTypeSet: 11207 *result = SOC_IS_MONTEREY(unit); 11208 break; 11209 #endif 11210 default: 11211 *result = FALSE; 11212 } 11213 } 11214 return (BCM_E_NONE); 11215 } 11216 11217 11218 int 11219 _bcm_field_trx_action_support_check(int unit, _field_entry_t *f_ent, 11220 bcm_field_action_t action, int *result) 11221 { 11222 /* Input parameters check */ 11223 if ((NULL == f_ent) || (NULL == result)) { 11224 return (BCM_E_PARAM); 11225 } 11226 if (NULL == f_ent->group) { 11227 return (BCM_E_PARAM); 11228 } 11229 11230 return (_bcm_field_trx_stage_action_support_check(unit, f_ent->group->stage_id, 11231 action, result)); 11232 } 11233 #if defined(BCM_TRIDENT_SUPPORT) 11234 /* 11235 * Function: 11236 * _bcm_field_trx_multiwide_group_action_conflict_check 11237 * 11238 * Purpose: 11239 * Check if two action not conflicting in 11240 * multi wide mode 11241 * Parameters: 11242 * unit -(IN)BCM device number 11243 * f_ent -(IN)Field entry structure. 11244 * action -(IN) Action to check(bcmFieldActionXXX) 11245 * action1 -(IN) Action to check(bcmFieldActionXXX) 11246 * 11247 * Returns: 11248 * BCM_E_CONFIG - if actions do conflict 11249 * BCM_E_NONE - if there is no conflict 11250 */ 11251 int 11252 _bcm_field_trx_multiwide_group_action_conflict_check( 11253 int unit, 11254 unsigned stage, 11255 bcm_field_action_t action1, 11256 bcm_field_action_t action 11257 ) 11258 { 11259 int rv = BCM_E_CONFIG; 11260 11261 if (stage == _BCM_FIELD_STAGE_INGRESS) { 11262 switch (action1) { 11263 case bcmFieldActionCosQCpuNew: 11264 if ((action == bcmFieldActionServicePoolIdNew) || (action == bcmFieldActionServicePoolIdPrecedenceNew)) { 11265 rv = BCM_E_NONE; 11266 } 11267 break; 11268 case bcmFieldActionServicePoolIdNew: 11269 if ((action == bcmFieldActionCosQCpuNew) || (action != bcmFieldActionServicePoolIdPrecedenceNew)) { 11270 rv = BCM_E_NONE; 11271 } 11272 break; 11273 case bcmFieldActionServicePoolIdPrecedenceNew: 11274 if ((action == bcmFieldActionCosQCpuNew) || (action != bcmFieldActionServicePoolIdNew)) { 11275 rv = BCM_E_NONE; 11276 } 11277 break; 11278 default: 11279 break; 11280 } 11281 } 11282 11283 return rv; 11284 } 11285 #endif 11286 /* 11287 * Function: 11288 * _bcm_field_trx_action_conflict_check 11289 * 11290 * Purpose: 11291 * Check if two action conflict (occupy the same field in FP policy table) 11292 * 11293 * Parameters: 11294 * unit -(IN)BCM device number 11295 * f_ent -(IN)Field entry structure. 11296 * action -(IN) Action to check(bcmFieldActionXXX) 11297 * action1 -(IN) Action to check(bcmFieldActionXXX) 11298 * 11299 * Returns: 11300 * BCM_E_CONFIG - if actions do conflict 11301 * BCM_E_NONE - if there is no conflict 11302 */ 11303 int 11304 _bcm_field_trx_stage_action_conflict_check(int unit, 11305 unsigned stage, 11306 bcm_field_action_t action1, 11307 bcm_field_action_t action 11308 ) 11309 { 11310 /* Two identical actions are forbidden. */ 11311 if (action1 == action) { 11312 if ((action != bcmFieldActionMirrorIngress) && 11313 (action != bcmFieldActionMirrorEgress)) { 11314 return (BCM_E_CONFIG); 11315 } 11316 } 11317 11318 if (stage == _BCM_FIELD_STAGE_EGRESS) { 11319 switch (action1) { 11320 case bcmFieldActionDrop: 11321 case bcmFieldActionDropCancel: 11322 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 11323 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 11324 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDrop); 11325 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropCancel); 11326 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDrop); 11327 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropCancel); 11328 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDrop); 11329 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropCancel); 11330 break; 11331 case bcmFieldActionRpDrop: 11332 case bcmFieldActionRpDropCancel: 11333 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 11334 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 11335 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDrop); 11336 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropCancel); 11337 break; 11338 case bcmFieldActionYpDrop: 11339 case bcmFieldActionYpDropCancel: 11340 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 11341 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 11342 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDrop); 11343 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropCancel); 11344 break; 11345 case bcmFieldActionGpDrop: 11346 case bcmFieldActionGpDropCancel: 11347 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 11348 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 11349 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDrop); 11350 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropCancel); 11351 break; 11352 case bcmFieldActionCopyToCpu: 11353 case bcmFieldActionCopyToCpuCancel: 11354 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11355 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11356 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11357 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11358 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 11359 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 11360 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 11361 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 11362 break; 11363 case bcmFieldActionRpCopyToCpu: 11364 case bcmFieldActionRpCopyToCpuCancel: 11365 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11366 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11367 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11368 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11369 break; 11370 case bcmFieldActionYpCopyToCpu: 11371 case bcmFieldActionYpCopyToCpuCancel: 11372 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11373 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11374 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 11375 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 11376 break; 11377 case bcmFieldActionGpCopyToCpu: 11378 case bcmFieldActionGpCopyToCpuCancel: 11379 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11380 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11381 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 11382 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 11383 break; 11384 case bcmFieldActionOuterVlanPrioNew: 11385 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOuterVlanPrioNew); 11386 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOuterVlanPrioNew); 11387 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOuterVlanPrioNew); 11388 break; 11389 case bcmFieldActionRpOuterVlanPrioNew: 11390 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanPrioNew); 11391 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOuterVlanPrioNew); 11392 break; 11393 case bcmFieldActionYpOuterVlanPrioNew: 11394 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanPrioNew); 11395 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOuterVlanPrioNew); 11396 break; 11397 case bcmFieldActionGpOuterVlanPrioNew: 11398 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanPrioNew); 11399 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOuterVlanPrioNew); 11400 break; 11401 case bcmFieldActionInnerVlanPrioNew: 11402 _FP_ACTIONS_CONFLICT(bcmFieldActionRpInnerVlanPrioNew); 11403 _FP_ACTIONS_CONFLICT(bcmFieldActionYpInnerVlanPrioNew); 11404 _FP_ACTIONS_CONFLICT(bcmFieldActionGpInnerVlanPrioNew); 11405 break; 11406 case bcmFieldActionRpInnerVlanPrioNew: 11407 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanPrioNew); 11408 _FP_ACTIONS_CONFLICT(bcmFieldActionRpInnerVlanPrioNew); 11409 break; 11410 case bcmFieldActionYpInnerVlanPrioNew: 11411 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanPrioNew); 11412 _FP_ACTIONS_CONFLICT(bcmFieldActionYpInnerVlanPrioNew); 11413 break; 11414 case bcmFieldActionGpInnerVlanPrioNew: 11415 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanPrioNew); 11416 _FP_ACTIONS_CONFLICT(bcmFieldActionGpInnerVlanPrioNew); 11417 break; 11418 case bcmFieldActionIpFix: 11419 case bcmFieldActionIpFixCancel: 11420 _FP_ACTIONS_CONFLICT(bcmFieldActionIpFix); 11421 _FP_ACTIONS_CONFLICT(bcmFieldActionIpFixCancel); 11422 break; 11423 case bcmFieldActionOuterVlanCfiNew: 11424 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOuterVlanCfiNew); 11425 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOuterVlanCfiNew); 11426 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOuterVlanCfiNew); 11427 break; 11428 case bcmFieldActionRpOuterVlanCfiNew: 11429 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanCfiNew); 11430 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOuterVlanCfiNew); 11431 break; 11432 case bcmFieldActionYpOuterVlanCfiNew: 11433 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanCfiNew); 11434 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOuterVlanCfiNew); 11435 break; 11436 case bcmFieldActionGpOuterVlanCfiNew: 11437 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanCfiNew); 11438 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOuterVlanCfiNew); 11439 break; 11440 case bcmFieldActionInnerVlanCfiNew: 11441 _FP_ACTIONS_CONFLICT(bcmFieldActionRpInnerVlanCfiNew); 11442 _FP_ACTIONS_CONFLICT(bcmFieldActionYpInnerVlanCfiNew); 11443 _FP_ACTIONS_CONFLICT(bcmFieldActionGpInnerVlanCfiNew); 11444 break; 11445 case bcmFieldActionRpInnerVlanCfiNew: 11446 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanCfiNew); 11447 _FP_ACTIONS_CONFLICT(bcmFieldActionRpInnerVlanCfiNew); 11448 break; 11449 case bcmFieldActionYpInnerVlanCfiNew: 11450 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanCfiNew); 11451 _FP_ACTIONS_CONFLICT(bcmFieldActionYpInnerVlanCfiNew); 11452 break; 11453 case bcmFieldActionGpInnerVlanCfiNew: 11454 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanCfiNew); 11455 _FP_ACTIONS_CONFLICT(bcmFieldActionGpInnerVlanCfiNew); 11456 break; 11457 case bcmFieldActionInnerVlanNew: 11458 case bcmFieldActionOuterVlanNew: 11459 case bcmFieldActionOuterTpidNew: 11460 case bcmFieldActionRpDscpNew: 11461 case bcmFieldActionYpDscpNew: 11462 case bcmFieldActionGpDscpNew: 11463 break; 11464 case bcmFieldActionRedirDropPrecedence: 11465 _FP_ACTIONS_CONFLICT(bcmFieldActionRpRedirDropPrecedence); 11466 _FP_ACTIONS_CONFLICT(bcmFieldActionYpRedirDropPrecedence); 11467 _FP_ACTIONS_CONFLICT(bcmFieldActionGpRedirDropPrecedence); 11468 break; 11469 case bcmFieldActionRpRedirDropPrecedence: 11470 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirDropPrecedence); 11471 _FP_ACTIONS_CONFLICT(bcmFieldActionRpRedirDropPrecedence); 11472 break; 11473 case bcmFieldActionYpRedirDropPrecedence: 11474 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirDropPrecedence); 11475 _FP_ACTIONS_CONFLICT(bcmFieldActionYpRedirDropPrecedence); 11476 break; 11477 case bcmFieldActionGpRedirDropPrecedence: 11478 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirDropPrecedence); 11479 _FP_ACTIONS_CONFLICT(bcmFieldActionGpRedirDropPrecedence); 11480 break; 11481 case bcmFieldActionLoopbackSrcModuleGportNew: 11482 case bcmFieldActionLoopbackSrcPortGportNew: 11483 case bcmFieldActionLoopbackSrcGportNew: 11484 case bcmFieldActionLoopbackCpuMasqueradePktProfileNew: 11485 case bcmFieldActionLoopbackPacketProcessingPortNew: 11486 case bcmFieldActionLoopBackTypeNew: 11487 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDstModuleGportNew); 11488 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDstPortGportNew); 11489 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDstGportNew); 11490 _FP_ACTIONS_CONFLICT(bcmFieldActionGpHiGigDropPrecedenceNew); 11491 _FP_ACTIONS_CONFLICT(bcmFieldActionYpHiGigDropPrecedenceNew); 11492 _FP_ACTIONS_CONFLICT(bcmFieldActionRpHiGigDropPrecedenceNew); 11493 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDropPrecedenceNew); 11494 _FP_ACTIONS_CONFLICT(bcmFieldActionGpHiGigIntPriNew); 11495 _FP_ACTIONS_CONFLICT(bcmFieldActionYpHiGigIntPriNew); 11496 _FP_ACTIONS_CONFLICT(bcmFieldActionRpHiGigIntPriNew); 11497 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigIntPriNew); 11498 break; 11499 case bcmFieldActionHiGigDstModuleGportNew: 11500 case bcmFieldActionHiGigDstPortGportNew: 11501 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDstGportNew); 11502 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11503 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11504 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11505 _FP_ACTIONS_CONFLICT( 11506 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11507 _FP_ACTIONS_CONFLICT( 11508 bcmFieldActionLoopbackPacketProcessingPortNew); 11509 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11510 break; 11511 case bcmFieldActionHiGigDstGportNew: 11512 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDstModuleGportNew); 11513 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDstPortGportNew); 11514 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11515 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11516 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11517 _FP_ACTIONS_CONFLICT( 11518 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11519 _FP_ACTIONS_CONFLICT( 11520 bcmFieldActionLoopbackPacketProcessingPortNew); 11521 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11522 break; 11523 case bcmFieldActionGpHiGigDropPrecedenceNew: 11524 _FP_ACTIONS_CONFLICT(bcmFieldActionGpHiGigDropPrecedenceNew); 11525 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDropPrecedenceNew); 11526 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11527 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11528 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11529 _FP_ACTIONS_CONFLICT( 11530 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11531 _FP_ACTIONS_CONFLICT( 11532 bcmFieldActionLoopbackPacketProcessingPortNew); 11533 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11534 break; 11535 case bcmFieldActionYpHiGigDropPrecedenceNew: 11536 _FP_ACTIONS_CONFLICT(bcmFieldActionYpHiGigDropPrecedenceNew); 11537 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDropPrecedenceNew); 11538 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11539 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11540 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11541 _FP_ACTIONS_CONFLICT( 11542 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11543 _FP_ACTIONS_CONFLICT( 11544 bcmFieldActionLoopbackPacketProcessingPortNew); 11545 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11546 break; 11547 case bcmFieldActionRpHiGigDropPrecedenceNew: 11548 _FP_ACTIONS_CONFLICT(bcmFieldActionRpHiGigDropPrecedenceNew); 11549 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDropPrecedenceNew); 11550 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11551 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11552 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11553 _FP_ACTIONS_CONFLICT( 11554 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11555 _FP_ACTIONS_CONFLICT( 11556 bcmFieldActionLoopbackPacketProcessingPortNew); 11557 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11558 break; 11559 case bcmFieldActionHiGigDropPrecedenceNew: 11560 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigDropPrecedenceNew); 11561 _FP_ACTIONS_CONFLICT(bcmFieldActionGpHiGigDropPrecedenceNew); 11562 _FP_ACTIONS_CONFLICT(bcmFieldActionYpHiGigDropPrecedenceNew); 11563 _FP_ACTIONS_CONFLICT(bcmFieldActionRpHiGigDropPrecedenceNew); 11564 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11565 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11566 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11567 _FP_ACTIONS_CONFLICT( 11568 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11569 _FP_ACTIONS_CONFLICT( 11570 bcmFieldActionLoopbackPacketProcessingPortNew); 11571 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11572 break; 11573 case bcmFieldActionGpHiGigIntPriNew: 11574 _FP_ACTIONS_CONFLICT(bcmFieldActionGpHiGigIntPriNew); 11575 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigIntPriNew); 11576 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11577 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11578 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11579 _FP_ACTIONS_CONFLICT( 11580 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11581 _FP_ACTIONS_CONFLICT( 11582 bcmFieldActionLoopbackPacketProcessingPortNew); 11583 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11584 break; 11585 case bcmFieldActionYpHiGigIntPriNew: 11586 _FP_ACTIONS_CONFLICT(bcmFieldActionYpHiGigIntPriNew); 11587 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigIntPriNew); 11588 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11589 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11590 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11591 _FP_ACTIONS_CONFLICT( 11592 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11593 _FP_ACTIONS_CONFLICT( 11594 bcmFieldActionLoopbackPacketProcessingPortNew); 11595 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11596 break; 11597 case bcmFieldActionRpHiGigIntPriNew: 11598 _FP_ACTIONS_CONFLICT(bcmFieldActionRpHiGigIntPriNew); 11599 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigIntPriNew); 11600 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11601 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11602 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11603 _FP_ACTIONS_CONFLICT( 11604 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11605 _FP_ACTIONS_CONFLICT( 11606 bcmFieldActionLoopbackPacketProcessingPortNew); 11607 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11608 break; 11609 case bcmFieldActionHiGigIntPriNew: 11610 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigIntPriNew); 11611 _FP_ACTIONS_CONFLICT(bcmFieldActionGpHiGigIntPriNew); 11612 _FP_ACTIONS_CONFLICT(bcmFieldActionYpHiGigIntPriNew); 11613 _FP_ACTIONS_CONFLICT(bcmFieldActionRpHiGigIntPriNew); 11614 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcModuleGportNew); 11615 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcPortGportNew); 11616 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSrcGportNew); 11617 _FP_ACTIONS_CONFLICT( 11618 bcmFieldActionLoopbackCpuMasqueradePktProfileNew); 11619 _FP_ACTIONS_CONFLICT( 11620 bcmFieldActionLoopbackPacketProcessingPortNew); 11621 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopBackTypeNew); 11622 break; 11623 #if defined(BCM_APACHE_SUPPORT) 11624 case bcmFieldActionRedirectPrioIntNew: 11625 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPrioIntNew); 11626 _FP_ACTIONS_CONFLICT(bcmFieldActionRpRedirectPrioIntNew); 11627 _FP_ACTIONS_CONFLICT(bcmFieldActionYpRedirectPrioIntNew); 11628 _FP_ACTIONS_CONFLICT(bcmFieldActionGpRedirectPrioIntNew); 11629 break; 11630 case bcmFieldActionRpRedirectPrioIntNew: 11631 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPrioIntNew); 11632 _FP_ACTIONS_CONFLICT(bcmFieldActionRpRedirectPrioIntNew); 11633 break; 11634 case bcmFieldActionYpRedirectPrioIntNew: 11635 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPrioIntNew); 11636 _FP_ACTIONS_CONFLICT(bcmFieldActionYpRedirectPrioIntNew); 11637 break; 11638 case bcmFieldActionGpRedirectPrioIntNew: 11639 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPrioIntNew); 11640 _FP_ACTIONS_CONFLICT(bcmFieldActionGpRedirectPrioIntNew); 11641 break; 11642 #endif /* BCM_APACHE_SUPPORT */ 11643 default: 11644 break; 11645 } 11646 return (BCM_E_NONE); 11647 } 11648 if (stage == _BCM_FIELD_STAGE_LOOKUP) { 11649 switch (action1) { 11650 case bcmFieldActionDrop: 11651 case bcmFieldActionDropCancel: 11652 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 11653 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 11654 break; 11655 case bcmFieldActionCopyToCpu: 11656 case bcmFieldActionCopyToCpuCancel: 11657 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11658 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11659 break; 11660 case bcmFieldActionInnerVlanAdd: 11661 case bcmFieldActionInnerVlanNew: 11662 case bcmFieldActionInnerVlanDelete: 11663 #if defined(BCM_TRX_SUPPORT) 11664 if (SOC_IS_TRIUMPH(unit) || SOC_IS_VALKYRIE(unit) 11665 || SOC_IS_SCORPION(unit)) { 11666 /* VFP_VRF_ID and NEW_INNER_VLAN fields in VFP_POLICY_TABLE are 11667 overlaying bits, leading to conflicting actions */ 11668 _FP_ACTIONS_CONFLICT(bcmFieldActionVrfSet); 11669 } 11670 #endif 11671 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanAdd); 11672 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanNew); 11673 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanDelete); 11674 break; 11675 case bcmFieldActionOuterVlanAdd: 11676 case bcmFieldActionOuterVlanNew: 11677 case bcmFieldActionOuterVlanLookup: 11678 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanAdd); 11679 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 11680 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanLookup); 11681 break; 11682 case bcmFieldActionPrioPktNew: 11683 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 11684 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 11685 break; 11686 case bcmFieldActionPrioIntNew: 11687 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 11688 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 11689 break; 11690 case bcmFieldActionPrioPktAndIntNew: 11691 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 11692 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 11693 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 11694 break; 11695 case bcmFieldActionCosQCpuNew: 11696 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 11697 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 11698 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 11699 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 11700 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePoolIdNew); 11701 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePoolIdPrecedenceNew); 11702 break; 11703 case bcmFieldActionVrfSet: 11704 #if defined(BCM_TRX_SUPPORT) 11705 if (SOC_IS_TRIUMPH(unit) || SOC_IS_VALKYRIE(unit) 11706 || SOC_IS_SCORPION(unit)) { 11707 /* VFP_VRF_ID and NEW_INNER_VLAN fields in VFP_POLICY_TABLE are 11708 overlaying bits, leading to conflicting actions */ 11709 _FP_ACTIONS_CONFLICT(bcmFieldActionVrfSet); 11710 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanAdd); 11711 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanNew); 11712 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanDelete); 11713 } 11714 #endif 11715 case bcmFieldActionDropPrecedence: 11716 case bcmFieldActionDoNotLearn: 11717 case bcmFieldActionClassDestSet: 11718 case bcmFieldActionClassSourceSet: 11719 case bcmFieldActionOamPbbteLookupEnable: 11720 break; 11721 case bcmFieldActionEnableVlanCheck: 11722 _FP_ACTIONS_CONFLICT(bcmFieldActionEnableVlanCheck); 11723 _FP_ACTIONS_CONFLICT(bcmFieldActionDoNotCheckVlan); 11724 break; 11725 case bcmFieldActionDoNotCheckVlan: 11726 _FP_ACTIONS_CONFLICT(bcmFieldActionEnableVlanCheck); 11727 /* 11728 * coverity[fallthrough] 11729 * This is intentional as the rest of the statements should be 11730 * executed for this case also 11731 */ 11732 case bcmFieldActionIncomingMplsPortSet: 11733 case bcmFieldActionIngressGportSet: 11734 case bcmFieldActionL3IngressSet: 11735 _FP_ACTIONS_CONFLICT(bcmFieldActionDoNotCheckVlan); 11736 _FP_ACTIONS_CONFLICT(bcmFieldActionIncomingMplsPortSet); 11737 _FP_ACTIONS_CONFLICT(bcmFieldActionIngressGportSet); 11738 _FP_ACTIONS_CONFLICT(bcmFieldActionL3IngressSet); 11739 break; 11740 case bcmFieldActionOuterVlanCopyInner: 11741 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanCopyOuter); 11742 break; 11743 case bcmFieldActionOuterVlanPrioCopyInner: 11744 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanPrioCopyOuter); 11745 break; 11746 case bcmFieldActionOuterVlanCfiCopyInner: 11747 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanCfiCopyOuter); 11748 break; 11749 case bcmFieldActionInnerVlanCopyOuter: 11750 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanCopyInner); 11751 break; 11752 case bcmFieldActionInnerVlanPrioCopyOuter: 11753 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanPrioCopyInner); 11754 break; 11755 case bcmFieldActionInnerVlanCfiCopyOuter: 11756 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanCfiCopyInner); 11757 break; 11758 default: 11759 break; 11760 } 11761 return (BCM_E_NONE); 11762 } 11763 11764 if ((stage == _BCM_FIELD_STAGE_INGRESS) || 11765 (stage == _BCM_FIELD_STAGE_EXTERNAL)) { 11766 switch (action1) { 11767 11768 case bcmFieldActionCopyToCpuCancel: 11769 #if defined(BCM_TRIUMPH3_SUPPORT) 11770 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 11771 SOC_IS_KATANA2(unit)) { 11772 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11773 #if defined(BCM_HELIX5_SUPPORT) 11774 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 11775 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOamCopyToCpu); 11776 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOamCopyToCpu); 11777 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOamCopyToCpu); 11778 #endif 11779 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11780 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11781 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11782 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 11783 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11784 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 11785 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 11786 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 11787 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 11788 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 11789 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 11790 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 11791 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 11792 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11793 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11794 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 11795 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 11796 } else 11797 #endif 11798 { 11799 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11800 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11801 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 11802 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11803 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11804 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11805 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 11806 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11807 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 11808 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 11809 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 11810 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 11811 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 11812 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 11813 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 11814 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 11815 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11816 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11817 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 11818 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 11819 } 11820 break; 11821 case bcmFieldActionSwitchToCpuCancel: 11822 #if defined(BCM_TRIUMPH3_SUPPORT) 11823 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 11824 SOC_IS_KATANA2(unit)) { 11825 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11826 #if defined(BCM_HELIX5_SUPPORT) 11827 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 11828 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOamCopyToCpu); 11829 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOamCopyToCpu); 11830 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOamCopyToCpu); 11831 #endif 11832 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11833 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11834 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11835 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 11836 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11837 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 11838 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 11839 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 11840 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 11841 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 11842 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 11843 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 11844 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 11845 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11846 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 11847 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11848 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 11849 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 11850 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 11851 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 11852 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 11853 } else 11854 #endif 11855 { 11856 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11857 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11858 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 11859 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11860 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11861 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11862 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 11863 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11864 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 11865 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 11866 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 11867 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 11868 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 11869 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 11870 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 11871 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 11872 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11873 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 11874 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11875 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 11876 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 11877 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 11878 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 11879 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 11880 } 11881 break; 11882 case bcmFieldActionCopyToCpu: 11883 case bcmFieldActionOamCopyToCpu: 11884 case bcmFieldActionSwitchToCpuReinstate: 11885 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11886 #if defined(BCM_HELIX5_SUPPORT) 11887 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 11888 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOamCopyToCpu); 11889 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOamCopyToCpu); 11890 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOamCopyToCpu); 11891 #endif 11892 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11893 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 11894 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11895 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11896 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11897 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 11898 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11899 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 11900 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 11901 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 11902 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 11903 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 11904 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 11905 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 11906 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 11907 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11908 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 11909 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11910 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 11911 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 11912 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 11913 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 11914 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 11915 break; 11916 case bcmFieldActionRpCopyToCpuCancel: 11917 #if defined(BCM_TRIUMPH3_SUPPORT) 11918 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 11919 SOC_IS_KATANA2(unit)) { 11920 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11921 #if defined(BCM_HELIX5_SUPPORT) 11922 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 11923 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOamCopyToCpu); 11924 #endif 11925 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11926 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 11927 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11928 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11929 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11930 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11931 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11932 } else 11933 #endif 11934 { 11935 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11936 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11937 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 11938 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11939 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11940 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11941 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 11942 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11943 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11944 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11945 } 11946 break; 11947 case bcmFieldActionRpSwitchToCpuCancel: 11948 #if defined(BCM_TRIUMPH3_SUPPORT) 11949 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 11950 SOC_IS_KATANA2(unit)) { 11951 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11952 #if defined(BCM_HELIX5_SUPPORT) 11953 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 11954 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOamCopyToCpu); 11955 #endif 11956 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11957 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 11958 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11959 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11960 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11961 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11962 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 11963 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11964 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 11965 } else 11966 #endif 11967 { 11968 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11969 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11970 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 11971 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11972 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11973 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11974 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 11975 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11976 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11977 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 11978 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 11979 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 11980 } 11981 break; 11982 case bcmFieldActionRpCopyToCpu: 11983 case bcmFieldActionRpOamCopyToCpu: 11984 case bcmFieldActionRpSwitchToCpuReinstate: 11985 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 11986 #if defined(BCM_HELIX5_SUPPORT) 11987 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 11988 _FP_ACTIONS_CONFLICT(bcmFieldActionRpOamCopyToCpu); 11989 #endif 11990 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 11991 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 11992 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 11993 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 11994 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 11995 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 11996 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 11997 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 11998 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 11999 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 12000 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 12001 break; 12002 case bcmFieldActionYpCopyToCpuCancel: 12003 #if defined(BCM_TRIUMPH3_SUPPORT) 12004 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 12005 SOC_IS_KATANA2(unit)) { 12006 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12007 #if defined(BCM_HELIX5_SUPPORT) 12008 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 12009 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOamCopyToCpu); 12010 #endif 12011 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12012 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12013 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12014 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 12015 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 12016 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12017 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 12018 } else 12019 #endif 12020 { 12021 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12022 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12023 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12024 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12025 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 12026 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 12027 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 12028 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 12029 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12030 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 12031 } 12032 break; 12033 case bcmFieldActionYpSwitchToCpuCancel: 12034 #if defined(BCM_TRIUMPH3_SUPPORT) 12035 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 12036 SOC_IS_KATANA2(unit)) { 12037 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12038 #if defined(BCM_HELIX5_SUPPORT) 12039 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 12040 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOamCopyToCpu); 12041 #endif 12042 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12043 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12044 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12045 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 12046 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 12047 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12048 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12049 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 12050 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 12051 } else 12052 #endif 12053 { 12054 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12055 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12056 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12057 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12058 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 12059 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 12060 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 12061 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 12062 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12063 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12064 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 12065 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 12066 } 12067 break; 12068 case bcmFieldActionYpCopyToCpu: 12069 case bcmFieldActionYpOamCopyToCpu: 12070 case bcmFieldActionYpSwitchToCpuReinstate: 12071 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12072 #if defined(BCM_HELIX5_SUPPORT) 12073 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 12074 _FP_ACTIONS_CONFLICT(bcmFieldActionYpOamCopyToCpu); 12075 #endif 12076 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12077 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12078 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12079 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 12080 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 12081 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 12082 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 12083 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12084 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12085 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 12086 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 12087 break; 12088 case bcmFieldActionGpCopyToCpuCancel: 12089 #if defined(BCM_TRIUMPH3_SUPPORT) 12090 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 12091 SOC_IS_KATANA2(unit)) { 12092 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12093 #if defined(BCM_HELIX5_SUPPORT) 12094 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 12095 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOamCopyToCpu); 12096 #endif 12097 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12098 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12099 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12100 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 12101 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 12102 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12103 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 12104 } else 12105 #endif 12106 { 12107 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12108 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12109 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12110 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12111 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 12112 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 12113 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 12114 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 12115 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12116 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 12117 } 12118 break; 12119 case bcmFieldActionGpSwitchToCpuCancel: 12120 #if defined(BCM_TRIUMPH3_SUPPORT) 12121 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit) || 12122 SOC_IS_KATANA2(unit)) { 12123 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12124 #if defined(BCM_HELIX5_SUPPORT) 12125 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 12126 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOamCopyToCpu); 12127 #endif 12128 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12129 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12130 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12131 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 12132 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 12133 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12134 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12135 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 12136 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 12137 } else 12138 #endif 12139 { 12140 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12141 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12142 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12143 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12144 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 12145 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 12146 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 12147 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 12148 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12149 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12150 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 12151 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 12152 } 12153 break; 12154 case bcmFieldActionGpCopyToCpu: 12155 case bcmFieldActionGpOamCopyToCpu: 12156 case bcmFieldActionGpSwitchToCpuReinstate: 12157 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 12158 #if defined(BCM_HELIX5_SUPPORT) 12159 _FP_ACTIONS_CONFLICT(bcmFieldActionOamCopyToCpu); 12160 _FP_ACTIONS_CONFLICT(bcmFieldActionGpOamCopyToCpu); 12161 #endif 12162 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 12163 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 12164 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 12165 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 12166 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 12167 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 12168 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 12169 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12170 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12171 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 12172 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 12173 break; 12174 case bcmFieldActionDrop: 12175 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 12176 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 12177 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDrop); 12178 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropCancel); 12179 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDrop); 12180 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropCancel); 12181 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDrop); 12182 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropCancel); 12183 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 12184 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12185 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 12186 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 12187 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 12188 } 12189 break; 12190 case bcmFieldActionDropCancel: 12191 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 12192 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 12193 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDrop); 12194 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropCancel); 12195 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDrop); 12196 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropCancel); 12197 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDrop); 12198 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropCancel); 12199 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 12200 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12201 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 12202 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 12203 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 12204 } 12205 break; 12206 case bcmFieldActionRpDrop: 12207 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 12208 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 12209 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDrop); 12210 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropCancel); 12211 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 12212 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12213 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 12214 } 12215 break; 12216 case bcmFieldActionRpDropCancel: 12217 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 12218 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 12219 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDrop); 12220 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropCancel); 12221 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 12222 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12223 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 12224 } 12225 break; 12226 case bcmFieldActionYpDrop: 12227 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 12228 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 12229 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDrop); 12230 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropCancel); 12231 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 12232 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12233 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 12234 } 12235 break; 12236 case bcmFieldActionYpDropCancel: 12237 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 12238 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 12239 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDrop); 12240 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropCancel); 12241 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 12242 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12243 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 12244 } 12245 break; 12246 case bcmFieldActionGpDrop: 12247 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 12248 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 12249 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDrop); 12250 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropCancel); 12251 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 12252 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 12253 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 12254 } 12255 break; 12256 case bcmFieldActionGpDropCancel: 12257 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 12258 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 12259 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDrop); 12260 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropCancel); 12261 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 12262 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 12263 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 12264 } 12265 break; 12266 case bcmFieldActionL3ChangeVlan: 12267 case bcmFieldActionL3ChangeVlanCancel: 12268 case bcmFieldActionL3ChangeMacDa: 12269 case bcmFieldActionL3ChangeMacDaCancel: 12270 case bcmFieldActionFabricQueue: 12271 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12272 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12273 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12274 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12275 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12276 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12277 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12278 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12279 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12280 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12281 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12282 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12283 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12284 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12285 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12286 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12287 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12288 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12289 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12290 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12291 #if defined(BCM_KATANA_SUPPORT) 12292 if (SOC_IS_KATANAX(unit)) { 12293 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12294 } else 12295 #endif /* BCM_KATANA_SUPPORT */ 12296 { 12297 if (action1 != bcmFieldActionFabricQueue) { 12298 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12299 } 12300 } 12301 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12302 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12303 #endif 12304 #if defined(BCM_TRIUMPH3_SUPPORT) 12305 if (SOC_IS_TRIUMPH3(unit)) { 12306 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12307 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12308 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12309 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12310 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12311 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12312 } 12313 #endif 12314 break; 12315 case bcmFieldActionAddClassTag: 12316 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12317 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12318 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12319 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12320 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12321 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12322 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12323 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12324 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12325 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12326 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12327 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12328 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12329 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12330 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12331 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12332 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12333 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12334 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12335 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12336 #if defined(BCM_TRIUMPH3_SUPPORT) 12337 if (SOC_IS_TRIUMPH3(unit)) { 12338 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12339 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12340 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12341 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12342 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12343 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12344 } 12345 #endif 12346 break; 12347 case bcmFieldActionL3SwitchCancel: 12348 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12349 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12350 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12351 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12352 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12353 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12354 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12355 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12356 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12357 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12358 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12359 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12360 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12361 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12362 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12363 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12364 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12365 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12366 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12367 #if defined(BCM_TRIUMPH3_SUPPORT) 12368 if (SOC_IS_TRIUMPH3(unit)) { 12369 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12370 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12371 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12372 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12373 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12374 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12375 } 12376 #endif 12377 break; 12378 case bcmFieldActionL3Switch: 12379 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12380 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12381 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12382 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12383 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12384 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12385 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12386 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12387 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12388 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12389 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12390 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12391 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12392 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12393 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12394 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12395 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12396 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12397 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12398 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12399 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12400 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPbmp); 12401 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12402 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12403 #endif 12404 #if defined(BCM_TRIUMPH3_SUPPORT) 12405 if (SOC_IS_TRIUMPH3(unit)) { 12406 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12407 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12408 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12409 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12410 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12411 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12412 } 12413 #endif 12414 break; 12415 case bcmFieldActionOuterVlanNew: 12416 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12417 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12418 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12419 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12420 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12421 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12422 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12423 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12424 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12425 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12426 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12427 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12428 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12429 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12430 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12431 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12432 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12433 #endif 12434 #if defined(BCM_TRIUMPH3_SUPPORT) 12435 if (SOC_IS_TRIUMPH3(unit)) { 12436 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12437 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12438 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12439 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12440 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12441 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12442 } 12443 #endif 12444 break; 12445 case bcmFieldActionVnTagDelete: 12446 case bcmFieldActionVnTagNew: 12447 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12448 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12449 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12450 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12451 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12452 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12453 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12454 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12455 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12456 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12457 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12458 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12459 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12460 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12461 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12462 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12463 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12464 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12465 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12466 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12467 #endif 12468 #if defined(BCM_TRIUMPH3_SUPPORT) 12469 if (SOC_IS_TRIUMPH3(unit)) { 12470 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12471 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12472 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12473 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12474 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12475 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12476 } 12477 #endif 12478 break; 12479 case bcmFieldActionEtagDelete: 12480 case bcmFieldActionEtagNew: 12481 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12482 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12483 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12484 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12485 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12486 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12487 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12488 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12489 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12490 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12491 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12492 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12493 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12494 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12495 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12496 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12497 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12498 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12499 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12500 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12501 #endif 12502 #if defined (BCM_TRIUMPH3_SUPPORT) 12503 if (SOC_IS_TRIUMPH3(unit)) { 12504 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12505 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12506 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12507 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12508 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12509 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12510 } 12511 #endif 12512 break; 12513 case bcmFieldActionSrcMacNew: 12514 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12515 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12516 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12517 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12518 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12519 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12520 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12521 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12522 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12523 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12524 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12525 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12526 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12527 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12528 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12529 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12530 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12531 #endif 12532 #if defined(BCM_TRIUMPH3_SUPPORT) 12533 if (SOC_IS_TRIUMPH3(unit)) { 12534 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12535 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12536 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12537 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12538 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12539 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12540 } 12541 #endif 12542 break; 12543 case bcmFieldActionDstMacNew: 12544 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12545 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12546 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12547 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12548 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12549 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12550 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12551 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12552 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12553 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12554 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12555 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12556 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 12557 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12558 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12559 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12560 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12561 #endif 12562 #if defined (BCM_TRIUMPH3_SUPPORT) 12563 if (SOC_IS_TRIUMPH3(unit)) { 12564 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12565 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12566 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12567 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12568 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12569 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12570 } 12571 #endif 12572 break; 12573 case bcmFieldActionNewClassId: 12574 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12575 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12576 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12577 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12578 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12579 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12580 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12581 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12582 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12583 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12584 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12585 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12586 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12587 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12588 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12589 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12590 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12591 #if defined(BCM_TRIUMPH3_SUPPORT) 12592 if (SOC_IS_TRIUMPH3(unit)) { 12593 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12594 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12595 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12596 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12597 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12598 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12599 } 12600 #endif 12601 break; 12602 case bcmFieldActionEgressClassSelect: 12603 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12604 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12605 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12606 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12607 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12608 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12609 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12610 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12611 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12612 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12613 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12614 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12615 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12616 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12617 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12618 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12619 #if defined(BCM_TRIUMPH3_SUPPORT) 12620 if (SOC_IS_TRIUMPH3(unit)) { 12621 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 12622 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 12623 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 12624 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 12625 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 12626 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 12627 } 12628 #endif 12629 break; 12630 case bcmFieldActionHiGigClassSelect: 12631 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12632 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12633 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12634 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12635 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12636 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12637 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12638 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12639 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12640 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12641 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12642 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12643 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12644 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12645 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12646 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12647 break; 12648 case bcmFieldActionRedirect: 12649 case bcmFieldActionRedirectTrunk: 12650 case bcmFieldActionRedirectPbmp: 12651 case bcmFieldActionRedirectMcast: 12652 case bcmFieldActionRedirectVlan: 12653 case bcmFieldActionRedirectBcastPbmp: 12654 case bcmFieldActionOffloadRedirect: 12655 case bcmFieldActionEgressMask: 12656 case bcmFieldActionEgressPortsAdd: 12657 case bcmFieldActionUnmodifiedPacketRedirectPort: 12658 _FP_ACTIONS_CONFLICT(bcmFieldActionOffloadRedirect); 12659 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressMask); 12660 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressPortsAdd); 12661 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirect); 12662 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectTrunk); 12663 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectCancel); 12664 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPbmp); 12665 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12666 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectMcast); 12667 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectVlan); 12668 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectBcastPbmp); 12669 _FP_ACTIONS_CONFLICT(bcmFieldActionUnmodifiedPacketRedirectPort); 12670 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12671 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12672 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12673 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12674 #endif 12675 break; 12676 case bcmFieldActionRedirectCancel: 12677 _FP_ACTIONS_CONFLICT(bcmFieldActionOffloadRedirect); 12678 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressMask); 12679 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressPortsAdd); 12680 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirect); 12681 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectTrunk); 12682 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectCancel); 12683 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPbmp); 12684 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12685 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectMcast); 12686 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectVlan); 12687 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectBcastPbmp); 12688 _FP_ACTIONS_CONFLICT(bcmFieldActionUnmodifiedPacketRedirectPort); 12689 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12690 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12691 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12692 #endif 12693 break; 12694 case bcmFieldActionRedirectEgrNextHop: 12695 case bcmFieldActionRedirectIpmc: 12696 _FP_ACTIONS_CONFLICT(bcmFieldActionOffloadRedirect); 12697 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressMask); 12698 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressPortsAdd); 12699 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirect); 12700 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectTrunk); 12701 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectCancel); 12702 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPbmp); 12703 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectMcast); 12704 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectVlan); 12705 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectBcastPbmp); 12706 _FP_ACTIONS_CONFLICT(bcmFieldActionUnmodifiedPacketRedirectPort); 12707 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12708 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12709 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12710 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12711 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12712 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12713 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12714 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12715 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12716 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12717 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12718 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12719 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12720 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12721 #if defined(BCM_KATANA_SUPPORT) 12722 if (SOC_IS_KATANAX(unit)) { 12723 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12724 } else 12725 #endif /* BCM_KATANA_SUPPORT */ 12726 { 12727 if (action1 != bcmFieldActionRedirectIpmc) { 12728 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12729 } 12730 } 12731 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 12732 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 12733 #endif 12734 break; 12735 case bcmFieldActionMacSecRedirectIpmc: 12736 _FP_ACTIONS_CONFLICT(bcmFieldActionOffloadRedirect); 12737 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressMask); 12738 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressPortsAdd); 12739 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirect); 12740 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectTrunk); 12741 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectCancel); 12742 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPbmp); 12743 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectMcast); 12744 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectVlan); 12745 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectBcastPbmp); 12746 _FP_ACTIONS_CONFLICT(bcmFieldActionUnmodifiedPacketRedirectPort); 12747 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12748 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12749 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12750 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12751 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12752 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12753 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12754 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12755 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 12756 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 12757 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12758 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12759 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12760 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12761 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12762 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 12763 break; 12764 case bcmFieldActionReplaceSrcMac: 12765 case bcmFieldActionReplaceDstMac: 12766 case bcmFieldActionReplaceInnerVlan: 12767 case bcmFieldActionReplaceOuterVlan: 12768 case bcmFieldActionReplaceInnerVlanPriority: 12769 case bcmFieldActionReplaceOuterVlanPriority: 12770 #if defined(BCM_TRIUMPH3_SUPPORT) 12771 if (SOC_IS_TRIUMPH3(unit)) { 12772 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 12773 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 12774 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 12775 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 12776 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 12777 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 12778 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 12779 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 12780 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 12781 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 12782 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 12783 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 12784 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 12785 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 12786 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 12787 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 12788 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 12789 } 12790 #endif 12791 break; 12792 case bcmFieldActionPrioPktCopy: 12793 case bcmFieldActionPrioPktNew: 12794 case bcmFieldActionPrioPktTos: 12795 case bcmFieldActionPrioPktCancel: 12796 case bcmFieldActionDot1pPreserve: 12797 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCopy); 12798 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 12799 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktTos); 12800 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCancel); 12801 _FP_ACTIONS_CONFLICT(bcmFieldActionDot1pPreserve); 12802 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 12803 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 12804 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 12805 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 12806 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktCopy); 12807 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktNew); 12808 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktTos); 12809 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktCancel); 12810 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCopy); 12811 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 12812 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntTos); 12813 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCancel); 12814 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDot1pPreserve); 12815 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktCopy); 12816 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktNew); 12817 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktTos); 12818 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktCancel); 12819 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCopy); 12820 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 12821 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntTos); 12822 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCancel); 12823 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDot1pPreserve); 12824 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktCopy); 12825 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktNew); 12826 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktTos); 12827 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktCancel); 12828 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCopy); 12829 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 12830 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntTos); 12831 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCancel); 12832 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDot1pPreserve); 12833 break; 12834 case bcmFieldActionPrioPktAndIntCopy: 12835 case bcmFieldActionPrioPktAndIntNew: 12836 case bcmFieldActionPrioPktAndIntTos: 12837 case bcmFieldActionPrioPktAndIntCancel: 12838 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCopy); 12839 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 12840 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktTos); 12841 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCancel); 12842 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 12843 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 12844 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 12845 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 12846 _FP_ACTIONS_CONFLICT(bcmFieldActionDot1pPreserve); 12847 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktCopy); 12848 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktNew); 12849 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktTos); 12850 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktCancel); 12851 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCopy); 12852 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 12853 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntTos); 12854 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCancel); 12855 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDot1pPreserve); 12856 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktCopy); 12857 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktNew); 12858 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktTos); 12859 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktCancel); 12860 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCopy); 12861 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 12862 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntTos); 12863 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCancel); 12864 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDot1pPreserve); 12865 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktCopy); 12866 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktNew); 12867 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktTos); 12868 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktCancel); 12869 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCopy); 12870 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 12871 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntTos); 12872 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCancel); 12873 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDot1pPreserve); 12874 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 12875 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 12876 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 12877 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 12878 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 12879 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 12880 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 12881 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 12882 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 12883 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 12884 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 12885 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 12886 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 12887 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 12888 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 12889 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 12890 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 12891 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 12892 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 12893 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 12894 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 12895 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 12896 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 12897 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 12898 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 12899 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 12900 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 12901 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 12902 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 12903 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 12904 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 12905 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 12906 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 12907 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 12908 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 12909 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 12910 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 12911 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 12912 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 12913 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 12914 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 12915 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 12916 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 12917 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 12918 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 12919 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 12920 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 12921 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 12922 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 12923 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 12924 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 12925 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 12926 break; 12927 case bcmFieldActionUcastQueueNew: 12928 case bcmFieldActionIntCosUcastQueueNew: 12929 case bcmFieldActionPrioIntNew: 12930 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 12931 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 12932 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 12933 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 12934 /* 12935 * coverity[fallthrough] 12936 * This is intentional as the rest of the statements should be 12937 * executed for this case also 12938 */ 12939 case bcmFieldActionPrioIntCopy: 12940 case bcmFieldActionPrioIntTos: 12941 case bcmFieldActionPrioIntCancel: 12942 case bcmFieldActionVlanCosQNew: 12943 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 12944 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 12945 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 12946 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 12947 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 12948 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 12949 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 12950 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 12951 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 12952 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 12953 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 12954 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 12955 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 12956 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 12957 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 12958 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 12959 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 12960 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 12961 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 12962 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 12963 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 12964 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 12965 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 12966 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 12967 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 12968 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 12969 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 12970 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 12971 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 12972 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 12973 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 12974 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 12975 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 12976 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 12977 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 12978 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 12979 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 12980 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 12981 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 12982 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 12983 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 12984 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 12985 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 12986 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 12987 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 12988 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 12989 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 12990 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 12991 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 12992 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 12993 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 12994 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 12995 break; 12996 case bcmFieldActionCosQNew: 12997 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 12998 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 12999 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13000 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13001 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13002 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13003 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13004 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13005 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13006 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 13007 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 13008 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 13009 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 13010 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 13011 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 13012 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 13013 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 13014 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 13015 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 13016 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 13017 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 13018 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 13019 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 13020 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 13021 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 13022 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 13023 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 13024 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13025 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13026 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13027 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13028 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13029 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13030 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 13031 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 13032 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 13033 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13034 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 13035 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 13036 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 13037 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13038 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 13039 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 13040 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13041 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13042 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 13043 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 13044 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13045 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13046 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 13047 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 13048 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 13049 break; 13050 case bcmFieldActionUcastCosQNew: 13051 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13052 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13053 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13054 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13055 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13056 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13057 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13058 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13059 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 13060 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 13061 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 13062 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 13063 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 13064 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 13065 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 13066 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 13067 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 13068 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 13069 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 13070 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 13071 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 13072 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 13073 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 13074 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 13075 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 13076 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 13077 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13078 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13079 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13080 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13081 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13082 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13083 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 13084 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 13085 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 13086 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13087 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 13088 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 13089 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 13090 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13091 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 13092 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 13093 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13094 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13095 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 13096 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 13097 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13098 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13099 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 13100 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 13101 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 13102 break; 13103 case bcmFieldActionMcastCosQNew: 13104 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13105 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13106 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13107 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13108 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13109 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13110 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13111 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13112 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 13113 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 13114 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 13115 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 13116 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 13117 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 13118 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 13119 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 13120 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 13121 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 13122 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 13123 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 13124 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 13125 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 13126 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 13127 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 13128 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 13129 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 13130 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13131 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13132 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13133 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13134 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13135 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13136 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 13137 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 13138 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 13139 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13140 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 13141 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 13142 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 13143 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13144 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 13145 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 13146 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13147 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13148 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 13149 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 13150 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13151 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13152 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 13153 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 13154 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 13155 break; 13156 case bcmFieldActionRpPrioPktCopy: 13157 case bcmFieldActionRpPrioPktNew: 13158 case bcmFieldActionRpPrioPktTos: 13159 case bcmFieldActionRpPrioPktCancel: 13160 case bcmFieldActionRpDot1pPreserve: 13161 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCopy); 13162 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 13163 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktTos); 13164 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCancel); 13165 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 13166 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 13167 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 13168 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 13169 _FP_ACTIONS_CONFLICT(bcmFieldActionDot1pPreserve); 13170 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktCopy); 13171 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktNew); 13172 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktTos); 13173 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktCancel); 13174 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCopy); 13175 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 13176 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntTos); 13177 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCancel); 13178 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDot1pPreserve); 13179 break; 13180 case bcmFieldActionRpPrioPktAndIntCopy: 13181 case bcmFieldActionRpPrioPktAndIntNew: 13182 case bcmFieldActionRpPrioPktAndIntTos: 13183 case bcmFieldActionRpPrioPktAndIntCancel: 13184 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCopy); 13185 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 13186 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktTos); 13187 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCancel); 13188 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 13189 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 13190 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 13191 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 13192 _FP_ACTIONS_CONFLICT(bcmFieldActionDot1pPreserve); 13193 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktCopy); 13194 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktNew); 13195 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktTos); 13196 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktCancel); 13197 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCopy); 13198 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 13199 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntTos); 13200 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCancel); 13201 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDot1pPreserve); 13202 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13203 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13204 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13205 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13206 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13207 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13208 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13209 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13210 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 13211 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 13212 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 13213 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 13214 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 13215 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 13216 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13217 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 13218 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 13219 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 13220 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 13221 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13222 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 13223 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13224 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 13225 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13226 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 13227 break; 13228 case bcmFieldActionRpPrioIntCopy: 13229 case bcmFieldActionRpUcastQueueNew: 13230 case bcmFieldActionRpIntCosUcastQueueNew: 13231 case bcmFieldActionRpPrioIntNew: 13232 case bcmFieldActionRpPrioIntTos: 13233 case bcmFieldActionRpPrioIntCancel: 13234 case bcmFieldActionRpCosQNew: 13235 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13236 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13237 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13238 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13239 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13240 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13241 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13242 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13243 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13244 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 13245 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 13246 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 13247 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 13248 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 13249 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 13250 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 13251 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 13252 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 13253 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13254 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 13255 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13256 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 13257 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13258 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 13259 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13260 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 13261 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13262 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 13263 break; 13264 case bcmFieldActionRpUcastCosQNew: 13265 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13266 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13267 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13268 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13269 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13270 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13271 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13272 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13273 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13274 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13275 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 13276 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 13277 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 13278 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 13279 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 13280 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 13281 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 13282 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 13283 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13284 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 13285 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13286 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 13287 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13288 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 13289 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13290 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 13291 break; 13292 case bcmFieldActionRpMcastCosQNew: 13293 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13294 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13295 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13296 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13297 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13298 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13299 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13300 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13301 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13302 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13303 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 13304 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 13305 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 13306 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 13307 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 13308 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 13309 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosMapNew); 13310 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 13311 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13312 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 13313 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13314 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 13315 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13316 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 13317 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13318 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 13319 break; 13320 case bcmFieldActionYpPrioPktCopy: 13321 case bcmFieldActionYpPrioPktNew: 13322 case bcmFieldActionYpPrioPktTos: 13323 case bcmFieldActionYpPrioPktCancel: 13324 case bcmFieldActionYpDot1pPreserve: 13325 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCopy); 13326 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 13327 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktTos); 13328 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCancel); 13329 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 13330 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 13331 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 13332 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 13333 _FP_ACTIONS_CONFLICT(bcmFieldActionDot1pPreserve); 13334 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktCopy); 13335 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktNew); 13336 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktTos); 13337 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktCancel); 13338 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCopy); 13339 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 13340 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntTos); 13341 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCancel); 13342 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDot1pPreserve); 13343 break; 13344 case bcmFieldActionYpPrioPktAndIntCopy: 13345 case bcmFieldActionYpPrioPktAndIntNew: 13346 case bcmFieldActionYpPrioPktAndIntTos: 13347 case bcmFieldActionYpPrioPktAndIntCancel: 13348 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCopy); 13349 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 13350 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktTos); 13351 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCancel); 13352 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 13353 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 13354 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 13355 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 13356 _FP_ACTIONS_CONFLICT(bcmFieldActionDot1pPreserve); 13357 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktCopy); 13358 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktNew); 13359 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktTos); 13360 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktCancel); 13361 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCopy); 13362 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 13363 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntTos); 13364 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCancel); 13365 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDot1pPreserve); 13366 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13367 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13368 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13369 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13370 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13371 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13372 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13373 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13374 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 13375 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 13376 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 13377 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 13378 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 13379 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 13380 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13381 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 13382 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 13383 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 13384 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13385 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 13386 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13387 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 13388 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13389 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 13390 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13391 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 13392 break; 13393 case bcmFieldActionYpPrioIntCopy: 13394 case bcmFieldActionYpUcastQueueNew: 13395 case bcmFieldActionYpIntCosUcastQueueNew: 13396 case bcmFieldActionYpPrioIntNew: 13397 case bcmFieldActionYpPrioIntTos: 13398 case bcmFieldActionYpPrioIntCancel: 13399 case bcmFieldActionYpCosQNew: 13400 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13401 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13402 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13403 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13404 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13405 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13406 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13407 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13408 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13409 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 13410 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 13411 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 13412 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 13413 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 13414 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 13415 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 13416 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 13417 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 13418 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 13419 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13420 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13421 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 13422 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13423 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 13424 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13425 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 13426 break; 13427 case bcmFieldActionYpUcastCosQNew: 13428 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13429 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13430 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13431 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13432 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13433 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13434 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13435 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13436 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13437 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13438 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 13439 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 13440 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 13441 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 13442 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 13443 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 13444 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 13445 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 13446 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 13447 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13448 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13449 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 13450 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13451 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 13452 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13453 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 13454 break; 13455 case bcmFieldActionYpMcastCosQNew: 13456 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13457 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13458 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13459 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13460 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13461 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13462 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13463 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13464 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13465 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13466 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 13467 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 13468 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 13469 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 13470 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 13471 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 13472 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosMapNew); 13473 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 13474 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 13475 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13476 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13477 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 13478 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13479 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 13480 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13481 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 13482 break; 13483 case bcmFieldActionGpPrioPktCopy: 13484 case bcmFieldActionGpPrioPktNew: 13485 case bcmFieldActionGpPrioPktTos: 13486 case bcmFieldActionGpPrioPktCancel: 13487 case bcmFieldActionGpDot1pPreserve: 13488 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCopy); 13489 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 13490 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktTos); 13491 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCancel); 13492 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 13493 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 13494 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 13495 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 13496 _FP_ACTIONS_CONFLICT(bcmFieldActionDot1pPreserve); 13497 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktCopy); 13498 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktNew); 13499 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktTos); 13500 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktCancel); 13501 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCopy); 13502 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 13503 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntTos); 13504 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCancel); 13505 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDot1pPreserve); 13506 break; 13507 case bcmFieldActionGpPrioPktAndIntCopy: 13508 case bcmFieldActionGpPrioPktAndIntNew: 13509 case bcmFieldActionGpPrioPktAndIntTos: 13510 case bcmFieldActionGpPrioPktAndIntCancel: 13511 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCopy); 13512 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktNew); 13513 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktTos); 13514 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktCancel); 13515 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 13516 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 13517 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 13518 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 13519 _FP_ACTIONS_CONFLICT(bcmFieldActionDot1pPreserve); 13520 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktCopy); 13521 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktNew); 13522 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktTos); 13523 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktCancel); 13524 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCopy); 13525 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 13526 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntTos); 13527 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCancel); 13528 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDot1pPreserve); 13529 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13530 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13531 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13532 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13533 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13534 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13535 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13536 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13537 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13538 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13539 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13540 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13541 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13542 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13543 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13544 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 13545 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 13546 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 13547 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13548 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 13549 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13550 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13551 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13552 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13553 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13554 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 13555 break; 13556 case bcmFieldActionGpPrioIntCopy: 13557 case bcmFieldActionGpUcastQueueNew: 13558 case bcmFieldActionGpIntCosUcastQueueNew: 13559 case bcmFieldActionGpPrioIntNew: 13560 case bcmFieldActionGpPrioIntTos: 13561 case bcmFieldActionGpPrioIntCancel: 13562 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13563 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13564 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13565 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13566 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13567 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13568 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13569 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13570 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13571 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13572 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13573 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13574 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13575 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13576 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13577 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 13578 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 13579 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 13580 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13581 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 13582 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13583 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13584 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13585 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13586 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13587 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 13588 break; 13589 case bcmFieldActionGpCosQNew: 13590 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13591 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13592 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13593 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13594 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13595 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13596 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13597 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13598 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13599 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13600 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13601 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13602 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13603 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13604 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13605 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 13606 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 13607 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 13608 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13609 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 13610 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13611 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13612 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13613 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13614 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13615 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 13616 break; 13617 case bcmFieldActionGpUcastCosQNew: 13618 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13619 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13620 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13621 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13622 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13623 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13624 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13625 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13626 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13627 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13628 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13629 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13630 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13631 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13632 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13633 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 13634 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 13635 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13636 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 13637 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13638 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13639 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13640 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13641 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13642 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 13643 break; 13644 case bcmFieldActionGpMcastCosQNew: 13645 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13646 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13647 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13648 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13649 _FP_ACTIONS_CONFLICT(bcmFieldActionCosMapNew); 13650 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13651 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 13652 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13653 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13654 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13655 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13656 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13657 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13658 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13659 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13660 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosMapNew); 13661 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 13662 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 13663 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 13664 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13665 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13666 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13667 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13668 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13669 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 13670 break; 13671 case bcmFieldActionDropPrecedence: 13672 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropPrecedence); 13673 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropPrecedence); 13674 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropPrecedence); 13675 break; 13676 case bcmFieldActionRpDropPrecedence: 13677 _FP_ACTIONS_CONFLICT(bcmFieldActionDropPrecedence); 13678 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropPrecedence); 13679 break; 13680 case bcmFieldActionYpDropPrecedence: 13681 _FP_ACTIONS_CONFLICT(bcmFieldActionDropPrecedence); 13682 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropPrecedence); 13683 break; 13684 case bcmFieldActionGpDropPrecedence: 13685 _FP_ACTIONS_CONFLICT(bcmFieldActionDropPrecedence); 13686 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropPrecedence); 13687 break; 13688 case bcmFieldActionTimeStampToCpu: 13689 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 13690 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 13691 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 13692 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 13693 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 13694 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 13695 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 13696 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 13697 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 13698 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 13699 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 13700 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 13701 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 13702 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 13703 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 13704 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 13705 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 13706 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 13707 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 13708 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 13709 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 13710 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 13711 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 13712 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 13713 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 13714 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 13715 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropCancel); 13716 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropCancel); 13717 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropCancel); 13718 } 13719 break; 13720 case bcmFieldActionTimeStampToCpuCancel: 13721 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 13722 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 13723 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 13724 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 13725 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 13726 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 13727 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 13728 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 13729 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 13730 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 13731 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 13732 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 13733 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 13734 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 13735 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 13736 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 13737 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 13738 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 13739 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 13740 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 13741 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 13742 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 13743 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDrop); 13744 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDrop); 13745 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDrop); 13746 } 13747 break; 13748 case bcmFieldActionRpTimeStampToCpu: 13749 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 13750 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 13751 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 13752 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 13753 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 13754 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpuCancel); 13755 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 13756 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 13757 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 13758 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 13759 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 13760 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 13761 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 13762 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 13763 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDropCancel); 13764 } 13765 break; 13766 case bcmFieldActionRpTimeStampToCpuCancel: 13767 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 13768 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 13769 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpu); 13770 _FP_ACTIONS_CONFLICT(bcmFieldActionRpTimeStampToCpuCancel); 13771 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCopyToCpu); 13772 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuCancel); 13773 _FP_ACTIONS_CONFLICT(bcmFieldActionRpSwitchToCpuReinstate); 13774 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 13775 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 13776 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 13777 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 13778 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 13779 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDrop); 13780 } 13781 break; 13782 case bcmFieldActionYpTimeStampToCpu: 13783 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 13784 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 13785 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 13786 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 13787 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 13788 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 13789 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 13790 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 13791 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 13792 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpuCancel); 13793 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 13794 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 13795 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 13796 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 13797 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDropCancel); 13798 } 13799 break; 13800 case bcmFieldActionYpTimeStampToCpuCancel: 13801 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 13802 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 13803 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpu); 13804 _FP_ACTIONS_CONFLICT(bcmFieldActionYpTimeStampToCpuCancel); 13805 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 13806 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 13807 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 13808 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCopyToCpu); 13809 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuCancel); 13810 _FP_ACTIONS_CONFLICT(bcmFieldActionYpSwitchToCpuReinstate); 13811 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 13812 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 13813 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDrop); 13814 } 13815 break; 13816 case bcmFieldActionGpTimeStampToCpu: 13817 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 13818 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 13819 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 13820 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 13821 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 13822 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 13823 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpuCancel); 13824 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 13825 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 13826 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpuCancel); 13827 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 13828 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 13829 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 13830 _FP_ACTIONS_CONFLICT(bcmFieldActionDropCancel); 13831 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDropCancel); 13832 } 13833 break; 13834 case bcmFieldActionGpTimeStampToCpuCancel: 13835 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpu); 13836 _FP_ACTIONS_CONFLICT(bcmFieldActionTimeStampToCpuCancel); 13837 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpu); 13838 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTimeStampToCpuCancel); 13839 _FP_ACTIONS_CONFLICT(bcmFieldActionCopyToCpu); 13840 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuReinstate); 13841 _FP_ACTIONS_CONFLICT(bcmFieldActionSwitchToCpuCancel); 13842 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCopyToCpu); 13843 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuCancel); 13844 _FP_ACTIONS_CONFLICT(bcmFieldActionGpSwitchToCpuReinstate); 13845 if (!soc_feature(unit, soc_feature_ifp_timestamptocpu_optimized)) { 13846 _FP_ACTIONS_CONFLICT(bcmFieldActionDrop); 13847 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDrop); 13848 } 13849 break; 13850 case bcmFieldActionIpFix: 13851 case bcmFieldActionIpFixCancel: 13852 _FP_ACTIONS_CONFLICT(bcmFieldActionIpFix); 13853 _FP_ACTIONS_CONFLICT(bcmFieldActionIpFixCancel); 13854 break; 13855 case bcmFieldActionDscpNew: 13856 case bcmFieldActionDscpCancel: 13857 case bcmFieldActionOamSessionId: 13858 case bcmFieldActionDscpPreserve: 13859 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpNew); 13860 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpCancel); 13861 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpPreserve); 13862 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDscpNew); 13863 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDscpCancel); 13864 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDscpPreserve); 13865 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDscpNew); 13866 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDscpCancel); 13867 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDscpPreserve); 13868 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDscpNew); 13869 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDscpCancel); 13870 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDscpPreserve); 13871 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTosPrecedenceNew); 13872 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTosPrecedenceCopy); 13873 _FP_ACTIONS_CONFLICT(bcmFieldActionOamSessionId); 13874 break; 13875 case bcmFieldActionRpDscpNew: 13876 case bcmFieldActionRpDscpCancel: 13877 case bcmFieldActionRpDscpPreserve: 13878 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpNew); 13879 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpCancel); 13880 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpPreserve); 13881 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDscpNew); 13882 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDscpCancel); 13883 _FP_ACTIONS_CONFLICT(bcmFieldActionRpDscpPreserve); 13884 _FP_ACTIONS_CONFLICT(bcmFieldActionOamSessionId); 13885 break; 13886 case bcmFieldActionYpDscpNew: 13887 case bcmFieldActionYpDscpCancel: 13888 case bcmFieldActionYpDscpPreserve: 13889 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpNew); 13890 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpCancel); 13891 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpPreserve); 13892 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDscpNew); 13893 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDscpCancel); 13894 _FP_ACTIONS_CONFLICT(bcmFieldActionYpDscpPreserve); 13895 _FP_ACTIONS_CONFLICT(bcmFieldActionOamSessionId); 13896 break; 13897 case bcmFieldActionGpDscpNew: 13898 case bcmFieldActionGpDscpCancel: 13899 case bcmFieldActionGpTosPrecedenceNew: 13900 case bcmFieldActionGpTosPrecedenceCopy: 13901 case bcmFieldActionGpDscpPreserve: 13902 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpNew); 13903 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpCancel); 13904 _FP_ACTIONS_CONFLICT(bcmFieldActionDscpPreserve); 13905 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDscpNew); 13906 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTosPrecedenceNew); 13907 _FP_ACTIONS_CONFLICT(bcmFieldActionGpTosPrecedenceCopy); 13908 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDscpCancel); 13909 _FP_ACTIONS_CONFLICT(bcmFieldActionGpDscpPreserve); 13910 _FP_ACTIONS_CONFLICT(bcmFieldActionOamSessionId); 13911 break; 13912 case bcmFieldActionEcnNew: 13913 _FP_ACTIONS_CONFLICT(bcmFieldActionRpEcnNew); 13914 _FP_ACTIONS_CONFLICT(bcmFieldActionYpEcnNew); 13915 _FP_ACTIONS_CONFLICT(bcmFieldActionGpEcnNew); 13916 break; 13917 case bcmFieldActionRpEcnNew: 13918 _FP_ACTIONS_CONFLICT(bcmFieldActionEcnNew); 13919 _FP_ACTIONS_CONFLICT(bcmFieldActionRpEcnNew); 13920 break; 13921 case bcmFieldActionYpEcnNew: 13922 _FP_ACTIONS_CONFLICT(bcmFieldActionEcnNew); 13923 _FP_ACTIONS_CONFLICT(bcmFieldActionYpEcnNew); 13924 break; 13925 case bcmFieldActionGpEcnNew: 13926 _FP_ACTIONS_CONFLICT(bcmFieldActionEcnNew); 13927 _FP_ACTIONS_CONFLICT(bcmFieldActionGpEcnNew); 13928 break; 13929 case bcmFieldActionMirrorIngress: 13930 _FP_ACTIONS_CONFLICT(bcmFieldActionMirrorOverride); 13931 break; 13932 case bcmFieldActionMirrorEgress: 13933 _FP_ACTIONS_CONFLICT(bcmFieldActionMirrorOverride); 13934 break; 13935 case bcmFieldActionMirrorOverride: 13936 _FP_ACTIONS_CONFLICT(bcmFieldActionMirrorIngress); 13937 _FP_ACTIONS_CONFLICT(bcmFieldActionMirrorEgress); 13938 break; 13939 case bcmFieldActionPortPrioIntCosQNew: 13940 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 13941 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 13942 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 13943 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 13944 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 13945 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 13946 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 13947 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 13948 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 13949 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 13950 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 13951 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 13952 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 13953 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 13954 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 13955 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 13956 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 13957 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 13958 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 13959 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCopy); 13960 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntTos); 13961 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCancel); 13962 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 13963 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 13964 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 13965 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 13966 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 13967 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 13968 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 13969 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 13970 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 13971 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCopy); 13972 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntTos); 13973 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCancel); 13974 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 13975 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 13976 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 13977 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 13978 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 13979 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 13980 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 13981 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 13982 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 13983 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCopy); 13984 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntTos); 13985 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCancel); 13986 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 13987 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 13988 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 13989 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 13990 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 13991 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 13992 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 13993 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 13994 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 13995 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 13996 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 13997 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 13998 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 13999 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 14000 break; 14001 case bcmFieldActionRpPortPrioIntCosQNew: 14002 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 14003 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 14004 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 14005 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 14006 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 14007 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 14008 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 14009 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 14010 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 14011 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 14012 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 14013 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 14014 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 14015 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 14016 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 14017 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 14018 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 14019 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 14020 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 14021 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCopy); 14022 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntTos); 14023 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCancel); 14024 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 14025 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 14026 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 14027 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 14028 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 14029 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 14030 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 14031 _FP_ACTIONS_CONFLICT(bcmFieldActionRpServicePrioIntCosQNew); 14032 break; 14033 case bcmFieldActionYpPortPrioIntCosQNew: 14034 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 14035 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 14036 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 14037 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 14038 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 14039 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 14040 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 14041 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 14042 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 14043 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 14044 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 14045 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 14046 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 14047 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 14048 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 14049 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 14050 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 14051 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 14052 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 14053 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCopy); 14054 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntTos); 14055 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCancel); 14056 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 14057 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 14058 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 14059 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 14060 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 14061 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 14062 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 14063 _FP_ACTIONS_CONFLICT(bcmFieldActionYpServicePrioIntCosQNew); 14064 break; 14065 case bcmFieldActionGpPortPrioIntCosQNew: 14066 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 14067 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 14068 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 14069 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 14070 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 14071 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 14072 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 14073 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 14074 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 14075 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 14076 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 14077 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 14078 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 14079 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 14080 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 14081 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 14082 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 14083 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 14084 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 14085 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCopy); 14086 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntTos); 14087 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCancel); 14088 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 14089 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 14090 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 14091 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 14092 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 14093 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 14094 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePrioIntCosQNew); 14095 _FP_ACTIONS_CONFLICT(bcmFieldActionGpServicePrioIntCosQNew); 14096 break; 14097 case bcmFieldActionServicePrioIntCosQNew: 14098 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 14099 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 14100 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 14101 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 14102 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 14103 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 14104 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 14105 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 14106 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 14107 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 14108 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 14109 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 14110 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 14111 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 14112 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 14113 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 14114 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 14115 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 14116 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 14117 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCopy); 14118 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntTos); 14119 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCancel); 14120 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 14121 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 14122 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 14123 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 14124 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 14125 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 14126 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 14127 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 14128 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 14129 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCopy); 14130 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntTos); 14131 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCancel); 14132 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 14133 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 14134 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 14135 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 14136 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 14137 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 14138 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 14139 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 14140 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 14141 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCopy); 14142 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntTos); 14143 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCancel); 14144 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 14145 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 14146 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 14147 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 14148 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 14149 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 14150 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 14151 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 14152 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 14153 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 14154 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 14155 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 14156 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 14157 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 14158 break; 14159 case bcmFieldActionRpServicePrioIntCosQNew: 14160 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 14161 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 14162 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 14163 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 14164 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 14165 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 14166 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 14167 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 14168 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 14169 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 14170 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 14171 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 14172 _FP_ACTIONS_CONFLICT(bcmFieldActionRpCosQNew); 14173 _FP_ACTIONS_CONFLICT(bcmFieldActionRpVlanCosQNew); 14174 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCopy); 14175 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntNew); 14176 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntTos); 14177 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioIntCancel); 14178 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntNew); 14179 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCopy); 14180 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntTos); 14181 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPrioPktAndIntCancel); 14182 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastCosQNew); 14183 _FP_ACTIONS_CONFLICT(bcmFieldActionRpMcastCosQNew); 14184 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 14185 _FP_ACTIONS_CONFLICT(bcmFieldActionRpUcastQueueNew); 14186 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 14187 _FP_ACTIONS_CONFLICT(bcmFieldActionRpIntCosUcastQueueNew); 14188 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 14189 _FP_ACTIONS_CONFLICT(bcmFieldActionRpPortPrioIntCosQNew); 14190 break; 14191 case bcmFieldActionYpServicePrioIntCosQNew: 14192 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 14193 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 14194 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 14195 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 14196 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 14197 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 14198 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 14199 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 14200 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 14201 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 14202 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 14203 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 14204 _FP_ACTIONS_CONFLICT(bcmFieldActionYpCosQNew); 14205 _FP_ACTIONS_CONFLICT(bcmFieldActionYpVlanCosQNew); 14206 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCopy); 14207 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntNew); 14208 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntTos); 14209 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioIntCancel); 14210 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntNew); 14211 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCopy); 14212 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntTos); 14213 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPrioPktAndIntCancel); 14214 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastCosQNew); 14215 _FP_ACTIONS_CONFLICT(bcmFieldActionYpMcastCosQNew); 14216 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 14217 _FP_ACTIONS_CONFLICT(bcmFieldActionYpUcastQueueNew); 14218 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 14219 _FP_ACTIONS_CONFLICT(bcmFieldActionYpIntCosUcastQueueNew); 14220 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 14221 _FP_ACTIONS_CONFLICT(bcmFieldActionYpPortPrioIntCosQNew); 14222 break; 14223 case bcmFieldActionGpServicePrioIntCosQNew: 14224 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQNew); 14225 _FP_ACTIONS_CONFLICT(bcmFieldActionVlanCosQNew); 14226 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCopy); 14227 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntNew); 14228 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntTos); 14229 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioIntCancel); 14230 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntNew); 14231 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCopy); 14232 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntTos); 14233 _FP_ACTIONS_CONFLICT(bcmFieldActionPrioPktAndIntCancel); 14234 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastCosQNew); 14235 _FP_ACTIONS_CONFLICT(bcmFieldActionMcastCosQNew); 14236 _FP_ACTIONS_CONFLICT(bcmFieldActionGpCosQNew); 14237 _FP_ACTIONS_CONFLICT(bcmFieldActionGpVlanCosQNew); 14238 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCopy); 14239 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntNew); 14240 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntTos); 14241 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioIntCancel); 14242 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntNew); 14243 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCopy); 14244 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntTos); 14245 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPrioPktAndIntCancel); 14246 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastCosQNew); 14247 _FP_ACTIONS_CONFLICT(bcmFieldActionGpMcastCosQNew); 14248 _FP_ACTIONS_CONFLICT(bcmFieldActionUcastQueueNew); 14249 _FP_ACTIONS_CONFLICT(bcmFieldActionGpUcastQueueNew); 14250 _FP_ACTIONS_CONFLICT(bcmFieldActionIntCosUcastQueueNew); 14251 _FP_ACTIONS_CONFLICT(bcmFieldActionGpIntCosUcastQueueNew); 14252 _FP_ACTIONS_CONFLICT(bcmFieldActionPortPrioIntCosQNew); 14253 _FP_ACTIONS_CONFLICT(bcmFieldActionGpPortPrioIntCosQNew); 14254 break; 14255 case bcmFieldActionColorIndependent: 14256 _FP_ACTIONS_CONFLICT(bcmFieldActionColorIndependent); 14257 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 14258 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 14259 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 14260 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 14261 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 14262 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 14263 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 14264 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 14265 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 14266 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 14267 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectVlan); 14268 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectMcast); 14269 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 14270 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 14271 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 14272 #endif 14273 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressPortsAdd); 14274 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressMask); 14275 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectCancel); 14276 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirect); 14277 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectTrunk); 14278 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 14279 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 14280 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 14281 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 14282 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 14283 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectPbmp); 14284 _FP_ACTIONS_CONFLICT(bcmFieldActionOffloadRedirect); 14285 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectBcastPbmp); 14286 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 14287 _FP_ACTIONS_CONFLICT(bcmFieldActionMirrorEgress); 14288 _FP_ACTIONS_CONFLICT(bcmFieldActionUnmodifiedPacketRedirectPort); 14289 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 14290 break; 14291 case bcmFieldActionDynamicHgTrunkCancel: 14292 _FP_ACTIONS_CONFLICT(bcmFieldActionTrunkLoadBalanceCancel); 14293 break; 14294 case bcmFieldActionTrunkLoadBalanceCancel: 14295 _FP_ACTIONS_CONFLICT(bcmFieldActionDynamicHgTrunkCancel); 14296 _FP_ACTIONS_CONFLICT(bcmFieldActionTrunkResilientHashCancel); 14297 _FP_ACTIONS_CONFLICT(bcmFieldActionHgTrunkResilientHashCancel); 14298 break; 14299 case bcmFieldActionHgTrunkResilientHashCancel: 14300 case bcmFieldActionTrunkResilientHashCancel: 14301 _FP_ACTIONS_CONFLICT(bcmFieldActionTrunkLoadBalanceCancel); 14302 break; 14303 case bcmFieldActionCosQCpuNew: 14304 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 14305 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePoolIdNew); 14306 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePoolIdPrecedenceNew); 14307 break; 14308 case bcmFieldActionServicePoolIdNew: 14309 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 14310 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePoolIdPrecedenceNew); 14311 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePoolIdNew); 14312 break; 14313 case bcmFieldActionServicePoolIdPrecedenceNew: 14314 _FP_ACTIONS_CONFLICT(bcmFieldActionCosQCpuNew); 14315 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePoolIdNew); 14316 _FP_ACTIONS_CONFLICT(bcmFieldActionServicePoolIdPrecedenceNew); 14317 break; 14318 case bcmFieldActionNatCancel: 14319 _FP_ACTIONS_CONFLICT(bcmFieldActionNatCancel); 14320 _FP_ACTIONS_CONFLICT(bcmFieldActionNat); 14321 break; 14322 case bcmFieldActionNat: 14323 _FP_ACTIONS_CONFLICT(bcmFieldActionNatCancel); 14324 _FP_ACTIONS_CONFLICT(bcmFieldActionNat); 14325 break; 14326 case bcmFieldActionMultipathHash: 14327 _FP_ACTIONS_CONFLICT(bcmFieldActionMultipathHash); 14328 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 14329 break; 14330 case bcmFieldActionDoNotChangeTtl: 14331 case bcmFieldActionDoNotCheckUrpf: 14332 case bcmFieldActionOamUpMep: 14333 case bcmFieldActionOamTx: 14334 case bcmFieldActionOamLmepMdl: 14335 case bcmFieldActionOamServicePriMappingPtr: 14336 case bcmFieldActionOamLmBasePtr: 14337 case bcmFieldActionOamDmEnable: 14338 case bcmFieldActionOamLmEnable: 14339 case bcmFieldActionOamLmepEnable: 14340 case bcmFieldActionOffloadClassSet: 14341 case bcmFieldActionOffloadDropIndication: 14342 case bcmFieldActionCnmCancel: 14343 break; 14344 case bcmFieldActionChangeL2Fields: 14345 _FP_ACTIONS_CONFLICT(bcmFieldActionChangeL2Fields); 14346 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew); 14347 _FP_ACTIONS_CONFLICT(bcmFieldActionSrcMacNew); 14348 _FP_ACTIONS_CONFLICT(bcmFieldActionDstMacNew); 14349 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagDelete); 14350 _FP_ACTIONS_CONFLICT(bcmFieldActionVnTagNew); 14351 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagDelete); 14352 _FP_ACTIONS_CONFLICT(bcmFieldActionEtagNew); 14353 _FP_ACTIONS_CONFLICT(bcmFieldActionFabricQueue); 14354 _FP_ACTIONS_CONFLICT(bcmFieldActionAddClassTag); 14355 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlan); 14356 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeVlanCancel); 14357 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDa); 14358 _FP_ACTIONS_CONFLICT(bcmFieldActionL3ChangeMacDaCancel); 14359 _FP_ACTIONS_CONFLICT(bcmFieldActionL3Switch); 14360 _FP_ACTIONS_CONFLICT(bcmFieldActionL3SwitchCancel); 14361 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectEgrNextHop); 14362 _FP_ACTIONS_CONFLICT(bcmFieldActionNewClassId); 14363 _FP_ACTIONS_CONFLICT(bcmFieldActionEgressClassSelect); 14364 _FP_ACTIONS_CONFLICT(bcmFieldActionHiGigClassSelect); 14365 _FP_ACTIONS_CONFLICT(bcmFieldActionRedirectIpmc); 14366 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 14367 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecRedirectIpmc); 14368 #endif 14369 #if defined(BCM_TRIUMPH3_SUPPORT) 14370 if (SOC_IS_TRIUMPH3(unit)) { 14371 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceSrcMac); 14372 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceDstMac); 14373 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlan); 14374 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlan); 14375 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceInnerVlanPriority); 14376 _FP_ACTIONS_CONFLICT(bcmFieldActionReplaceOuterVlanPriority); 14377 } 14378 #endif 14379 break; 14380 14381 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 14382 case bcmFieldActionMacSecEncrypt: 14383 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecDecrypt); 14384 if (soc_feature(unit, soc_feature_fp_based_oam)) { 14385 _FP_ACTIONS_CONFLICT(bcmFieldActionOamOlpHeaderAdd); 14386 _FP_ACTIONS_CONFLICT(bcmFieldActionNat); 14387 _FP_ACTIONS_CONFLICT(bcmFieldActionNatCancel); 14388 _FP_ACTIONS_CONFLICT(bcmFieldActionNatEgressOverride); 14389 } 14390 break; 14391 case bcmFieldActionMacSecDecrypt: 14392 _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecEncrypt); 14393 if (soc_feature(unit, soc_feature_fp_based_oam)) { 14394 _FP_ACTIONS_CONFLICT(bcmFieldActionOamOlpHeaderAdd); 14395 _FP_ACTIONS_CONFLICT(bcmFieldActionNat); 14396 _FP_ACTIONS_CONFLICT(bcmFieldActionNatCancel); 14397 _FP_ACTIONS_CONFLICT(bcmFieldActionNatEgressOverride); 14398 } 14399 break; 14400 #endif 14401 14402 default: 14403 break; 14404 } 14405 } 14406 return (BCM_E_NONE); 14407 } 14408 14409 14410 int 14411 _bcm_field_trx_action_conflict_check(int unit, 14412 _field_entry_t *f_ent, 14413 bcm_field_action_t action1, 14414 bcm_field_action_t action 14415 ) 14416 { 14417 /* Input parameters check */ 14418 if (NULL == f_ent) { 14419 return (BCM_E_PARAM); 14420 } 14421 if (NULL == f_ent->group) { 14422 return (BCM_E_PARAM); 14423 } 14424 14425 #if defined(BCM_TOMAHAWK3_SUPPORT) 14426 if (SOC_IS_TOMAHAWK3(unit)) { 14427 /* Allow action install in secondary/ternary parts for default 14428 action resolution id groups */ 14429 if (((f_ent->group->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) || 14430 (f_ent->group->flags & _FP_GROUP_SPAN_TRIPLE_SLICE)) && 14431 (f_ent->group->action_res_id == BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT)){ 14432 if (BCM_E_NONE == 14433 _bcm_field_trx_multiwide_group_action_conflict_check(unit, 14434 f_ent->group->stage_id, action1, action)) { 14435 return BCM_E_NONE; 14436 } 14437 } 14438 } else 14439 #endif 14440 #if defined(BCM_TRIDENT_SUPPORT) 14441 if (SOC_IS_TD_TT(unit)) { 14442 /* Allow action install in secondary/ternary parts for default 14443 action resolution id groups */ 14444 if (((f_ent->group->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) || 14445 (f_ent->group->flags & _FP_GROUP_SPAN_TRIPLE_SLICE) || 14446 (f_ent->group->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE)) && 14447 (f_ent->group->action_res_id == BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT)){ 14448 if (BCM_E_NONE == 14449 _bcm_field_trx_multiwide_group_action_conflict_check(unit, 14450 f_ent->group->stage_id, action1, action)) { 14451 return BCM_E_NONE; 14452 } 14453 } 14454 } 14455 #endif 14456 return (_bcm_field_trx_stage_action_conflict_check(unit, f_ent->group->stage_id, action1, action)); 14457 } 14458 14459 /* 14460 * Function: 14461 * _bcm_field_trx_egress_key_match_type_set 14462 * 14463 * Purpose: 14464 * Set key match type based on entry group. 14465 * NOTE: For double wide entries key type must be the same for 14466 * both parts of the entry. 14467 * Parameters: 14468 * unit - (IN) BCM device number 14469 * f_ent - (IN) Slice number to enable 14470 * Returns: 14471 * BCM_E_XXX 14472 */ 14473 int 14474 _bcm_field_trx_egress_key_match_type_set (int unit, _field_entry_t *f_ent) 14475 { 14476 _field_group_t *fg; /* Field group entry belongs to. */ 14477 uint32 data; /* Key match type. */ 14478 uint32 mask; /* Key match type mask. */ 14479 uint32 default_data; /* Key match type. */ 14480 int rv; /* Operation return status. */ 14481 14482 /* Key match type offset. */ 14483 _bcm_field_qual_offset_t q_offset; 14484 { 14485 sal_memset(&q_offset, 0, sizeof(q_offset)); 14486 q_offset.field = KEYf; 14487 q_offset.num_offsets = 1; 14488 q_offset.offset[0] = 207; 14489 q_offset.width[0] = 3; 14490 } 14491 14492 /* Input parameters check. */ 14493 if (NULL == f_ent) { 14494 return (BCM_E_PARAM); 14495 } 14496 if (NULL == (fg = f_ent->group)) { 14497 return (BCM_E_PARAM); 14498 } 14499 14500 if (fg->flags & _FP_GROUP_SPAN_SINGLE_SLICE) { 14501 switch (fg->sel_codes[0].fpf3) { 14502 case _BCM_FIELD_EFP_KEY1: 14503 data = _BCM_FIELD_EFP_KEY1_MATCH_TYPE; 14504 default_data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE; 14505 break; 14506 case _BCM_FIELD_EFP_KEY2: 14507 data = _BCM_FIELD_EFP_KEY2_MATCH_TYPE; 14508 default_data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE; 14509 break; 14510 case _BCM_FIELD_EFP_KEY4: 14511 data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE; 14512 default_data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE; 14513 break; 14514 case _BCM_FIELD_EFP_KEY1_NO_V4: 14515 data = _BCM_FIELD_EFP_KEY1_MATCH_TYPE; 14516 default_data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE; 14517 break; 14518 #if defined(BCM_APACHE_SUPPORT) || defined(BCM_TSN_SR_SUPPORT) 14519 case _BCM_FIELD_EFP_KEY5: 14520 data = _BCM_FIELD_EFP_KEY5_MATCH_TYPE; 14521 default_data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE; 14522 break; 14523 #endif /* BCM_APACHE_SUPPORT || BCM_TSN_SR_SUPPORT */ 14524 #if defined(BCM_APACHE_SUPPORT) 14525 case _BCM_FIELD_EFP_KEY6: 14526 data = _BCM_FIELD_EFP_KEY6_MATCH_TYPE; 14527 default_data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE; 14528 break; 14529 #endif 14530 default: 14531 return (BCM_E_INTERNAL); 14532 } 14533 } else { 14534 switch (fg->sel_codes[1].fpf3) { 14535 case _BCM_FIELD_EFP_KEY2: 14536 data = _BCM_FIELD_EFP_KEY2_KEY3_MATCH_TYPE; 14537 default_data = _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE; 14538 break; 14539 case _BCM_FIELD_EFP_KEY4: 14540 if ((_BCM_FIELD_EFP_KEY1 == fg->sel_codes[0].fpf3) || 14541 (_BCM_FIELD_EFP_KEY1_NO_V4 == fg->sel_codes[0].fpf3)) { 14542 data = _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE; 14543 } 14544 #if defined(BCM_APACHE_SUPPORT) 14545 else if (_BCM_FIELD_EFP_KEY5 == fg->sel_codes[0].fpf3) { 14546 data = _BCM_FIELD_EFP_KEY5_KEY4_MATCH_TYPE; 14547 } 14548 #endif 14549 else { 14550 data = _BCM_FIELD_EFP_KEY2_KEY4_MATCH_TYPE; 14551 } 14552 default_data = _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE; 14553 break; 14554 default: 14555 return (BCM_E_INTERNAL); 14556 } 14557 } 14558 14559 if (SOC_IS_TD2_TT2(unit)) { 14560 q_offset.offset[0] += 23; 14561 q_offset.width[0] += 1; 14562 } else if (SOC_IS_GREYHOUND2(unit)) { 14563 q_offset.offset[0] += 7; 14564 } 14565 else if (SOC_IS_TR_VL(unit)) { 14566 q_offset.offset[0] += 4; 14567 } 14568 14569 if (SOC_IS_TD2_TT2(unit)) { 14570 mask = 0xf; 14571 } 14572 else { 14573 mask = 0x7; 14574 } 14575 14576 /* 14577 * COVERITY 14578 * 14579 * This flow takes care of the Out-of-bounds access issue 14580 * for data and mask. 14581 */ 14582 /* coverity[callee_ptr_arith : FALSE] */ 14583 rv = _bcm_field_qual_value_set_by_entry_type(unit, &q_offset, f_ent, 14584 &data, &mask, _FP_ENTRY_TYPE_0); 14585 if (SOC_IS_TD2_TT2(unit)) { 14586 if (BCM_SUCCESS(rv)) { 14587 /* 14588 * COVERITY 14589 * 14590 *This flow takes care of the Out-of-bounds access issue 14591 * for data and mask. 14592 */ 14593 /* coverity[callee_ptr_arith : FALSE] */ 14594 rv = _bcm_field_qual_value_set_by_entry_type(unit, &q_offset, f_ent, 14595 &default_data, &mask, 14596 _FP_ENTRY_TYPE_1); 14597 } 14598 } 14599 return rv; 14600 } 14601 14602 /* 14603 * Function: 14604 * _bcm_field_trx_qualify_ip_type 14605 * Purpose: 14606 * Install ip type qualifier into TCAM 14607 * Parameters: 14608 * unit - (IN) BCM device number 14609 * entry - (IN) Field entry Index. 14610 * type - (IN) Ip Type. 14611 * qual - (IN) Qualifier(IpType/InnerIpType) 14612 * Returns: 14613 * BCM_E_XXX 14614 * Notes: 14615 */ 14616 int 14617 _bcm_field_trx_qualify_ip_type(int unit, bcm_field_entry_t entry, 14618 bcm_field_IpType_t type, 14619 bcm_field_qualify_t qual) 14620 { 14621 uint32 data = 0x0, 14622 mask = 0x0; 14623 14624 switch (type) { 14625 case bcmFieldIpTypeAny: 14626 data = 0x0; 14627 mask = 0x0; 14628 break; 14629 case bcmFieldIpTypeNonIp: 14630 data = 0xf; 14631 mask = 0xf; 14632 break; 14633 case bcmFieldIpTypeIp: 14634 data = 0x0; 14635 mask = 0x8; 14636 break; 14637 break; 14638 case bcmFieldIpTypeIpv4NoOpts: 14639 data = 0x0; 14640 mask = 0xf; 14641 break; 14642 case bcmFieldIpTypeIpv4WithOpts: 14643 data = 0x1; 14644 mask = 0xf; 14645 break; 14646 case bcmFieldIpTypeIpv4Any: 14647 data = 0x0; 14648 mask = 0xe; 14649 break; 14650 case bcmFieldIpTypeIpv6NoExtHdr: 14651 data = 0x4; 14652 mask = 0xf; 14653 break; 14654 case bcmFieldIpTypeIpv6OneExtHdr: 14655 data = 0x5; 14656 mask = 0xf; 14657 break; 14658 case bcmFieldIpTypeIpv6TwoExtHdr: 14659 data = 0x6; 14660 mask = 0xf; 14661 break; 14662 case bcmFieldIpTypeIpv6: 14663 data = 0x4; 14664 mask = 0xc; 14665 break; 14666 case bcmFieldIpTypeArp: 14667 data = 0x8; 14668 mask = 0xe; 14669 break; 14670 case bcmFieldIpTypeArpRequest: 14671 data = 0x8; 14672 mask = 0xf; 14673 break; 14674 case bcmFieldIpTypeArpReply: 14675 data = 0x9; 14676 mask = 0xf; 14677 break; 14678 case bcmFieldIpTypeTrill: 14679 data = 0xa; 14680 mask = 0xf; 14681 break; 14682 case bcmFieldIpTypeMplsUnicast: 14683 data = 0xc; 14684 mask = 0xf; 14685 break; 14686 case bcmFieldIpTypeMplsMulticast: 14687 data = 0xd; 14688 mask = 0xf; 14689 break; 14690 case bcmFieldIpTypeMpls: 14691 data = 0xc; 14692 mask = 0xe; 14693 break; 14694 case bcmFieldIpTypeMim: 14695 data = 0xe; 14696 mask = 0xf; 14697 break; 14698 default: 14699 return (BCM_E_UNAVAIL); 14700 break; 14701 } 14702 LOG_DEBUG(BSL_LS_BCM_FP, 14703 (BSL_META_U(unit, 14704 "FP(unit %d) qualifying on Iptype, data=%#x, mask=%#x\n))"), 14705 unit, data, mask)); 14706 14707 return _field_qualify32(unit, entry, qual, 14708 data, mask); 14709 } 14710 14711 /* 14712 * Function: 14713 * _bcm_field_trx_qualify_ip_type_get 14714 * Purpose: 14715 * Read ip type qualifier match criteria from the HW. 14716 * Parameters: 14717 * unit - (IN) BCM device number 14718 * entry - (IN) Field entry index 14719 * type - (OUT) Ip Type. 14720 * qual - (IN) Qualifier(IpType/InnerIpType) 14721 * Returns: 14722 * BCM_E_XXX 14723 * Notes: 14724 */ 14725 int 14726 _bcm_field_trx_qualify_ip_type_get(int unit, bcm_field_entry_t entry, 14727 bcm_field_IpType_t *type, 14728 bcm_field_qualify_t qual) 14729 { 14730 uint32 hw_data; /* HW encoded qualifier data. */ 14731 uint32 hw_mask; /* HW encoding qualifier mask. */ 14732 int rv; /* Operation return status. */ 14733 14734 /* Input parameters checks. */ 14735 if (NULL == type) { 14736 return (BCM_E_PARAM); 14737 } 14738 14739 /* Read qualifier match value and mask. */ 14740 rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 14741 qual, 14742 &hw_data, &hw_mask); 14743 BCM_IF_ERROR_RETURN(rv); 14744 14745 /* Read IpType encoding for qualifier data and mask */ 14746 rv = _bcm_field_trx_qualify_ip_type_encode_get(unit, hw_data, 14747 hw_mask, type); 14748 return rv; 14749 14750 } 14751 /* 14752 * Function: 14753 * _bcm_field_trx_qualify_ip_type_encode_get 14754 * Purpose: 14755 * Get ip type qualifier encode value for given data and mask. 14756 * Parameters: 14757 * unit - (IN) BCM device number 14758 * data - (IN) qualifier data. 14759 * mask - (IN) qualifier mask. 14760 * type - (OUT) Ip Type. 14761 * Returns: 14762 * BCM_E_XXX 14763 * Notes: 14764 */ 14765 int 14766 _bcm_field_trx_qualify_ip_type_encode_get(int unit, 14767 uint32 hw_data, 14768 uint32 hw_mask, 14769 bcm_field_IpType_t *type) 14770 { 14771 14772 if ((0 == hw_data) && (0 == hw_mask)) { 14773 *type = bcmFieldIpTypeAny; 14774 } else if ((0xf == hw_data) && (0xf == hw_mask)) { 14775 *type = bcmFieldIpTypeNonIp; 14776 } else if ((0x0 == hw_data) && (0x8 == hw_mask)) { 14777 *type = bcmFieldIpTypeIp; 14778 } else if ((0x0 == hw_data) && (0xf == hw_mask)) { 14779 *type = bcmFieldIpTypeIpv4NoOpts; 14780 } else if ((0x1 == hw_data) && (0xf == hw_mask)) { 14781 *type = bcmFieldIpTypeIpv4WithOpts; 14782 } else if ((0x0 == hw_data) && (0xe == hw_mask)) { 14783 *type = bcmFieldIpTypeIpv4Any; 14784 } else if ((0x4 == hw_data) && (0xf == hw_mask)) { 14785 *type = bcmFieldIpTypeIpv6NoExtHdr; 14786 } else if ((0x5 == hw_data) && (0xf == hw_mask)) { 14787 *type = bcmFieldIpTypeIpv6OneExtHdr; 14788 } else if ((0x6 == hw_data) && (0xf == hw_mask)) { 14789 *type = bcmFieldIpTypeIpv6TwoExtHdr; 14790 } else if ((0x4 == hw_data) && (0xc == hw_mask)) { 14791 *type = bcmFieldIpTypeIpv6; 14792 } else if ((0x8 == hw_data) && (0xe == hw_mask)) { 14793 *type = bcmFieldIpTypeArp; 14794 } else if ((0x8 == hw_data) && (0xf == hw_mask)) { 14795 *type = bcmFieldIpTypeArpRequest; 14796 } else if ((0x9 == hw_data) && (0xf == hw_mask)) { 14797 *type = bcmFieldIpTypeArpReply; 14798 } else if ((0xa == hw_data) && (0xf == hw_mask)) { 14799 *type = bcmFieldIpTypeTrill; 14800 } else if ((0xc == hw_data) && (0xf == hw_mask)) { 14801 *type = bcmFieldIpTypeMplsUnicast; 14802 } else if ((0xd == hw_data) && (0xf == hw_mask)) { 14803 *type = bcmFieldIpTypeMplsMulticast; 14804 } else if ((0xc == hw_data) && (0xe == hw_mask)) { 14805 *type = bcmFieldIpTypeMpls; 14806 } else if ((0xe == hw_data) && (0xf == hw_mask)) { 14807 *type = bcmFieldIpTypeMim; 14808 } else { 14809 return (BCM_E_INTERNAL); 14810 } 14811 return (BCM_E_NONE); 14812 } 14813 14814 /* 14815 * Function: 14816 * _bcm_field_trx_range_check_set 14817 * Purpose: 14818 * Write the group's range checking parameters into the 14819 * FP_RANGE_CHECK memory. 14820 * Parameters: 14821 * unit - (IN) BCM device number. 14822 * range - (IN) Range HW index 14823 * flags - (IN) One of more of the BCM_FIELD_RANGE_* flags 14824 * enable - (IN) TRUE or FALSE 14825 * min - (IN) Lower bounds of port range to be checked 14826 * max - (IN) Upper bounds of port range to be checked 14827 * Returns: 14828 * BCM_E_XXX 14829 */ 14830 int 14831 _bcm_field_trx_range_check_set(int unit, int range, uint32 flags, int enable, 14832 bcm_l4_port_t min, bcm_l4_port_t max) 14833 { 14834 /* Range table entry buffer. */ 14835 uint32 tbl_entry[SOC_MAX_MEM_FIELD_WORDS]; 14836 14837 soc_mem_t fp_range_check_mem; /* Range table memory. */ 14838 uint32 range_type_encoded = 0; /* Range type encoded. */ 14839 uint32 range_type = 0; /* Range type. */ 14840 14841 #if defined(BCM_TRIUMPH_SUPPORT) 14842 if (flags & BCM_FIELD_RANGE_EXTERNAL) { 14843 fp_range_check_mem = ESM_RANGE_CHECKm; 14844 } else 14845 #endif /* BCM_TRIUMPH_SUPPORT */ 14846 { 14847 #if defined(BCM_TOMAHAWK_SUPPORT) 14848 if (soc_feature(unit, soc_feature_field_multi_pipe_support)) { 14849 fp_range_check_mem = IFP_RANGE_CHECKm; 14850 } else 14851 #endif 14852 { 14853 fp_range_check_mem = FP_RANGE_CHECKm; 14854 } 14855 } 14856 14857 /* Index sanity check. */ 14858 if (!soc_mem_index_valid(unit, fp_range_check_mem, range)) { 14859 return (BCM_E_PARAM); 14860 } 14861 14862 if (enable) { 14863 range_type = flags & (BCM_FIELD_RANGE_SRCPORT | \ 14864 BCM_FIELD_RANGE_DSTPORT | \ 14865 BCM_FIELD_RANGE_OUTER_VLAN | \ 14866 BCM_FIELD_RANGE_PACKET_LENGTH); 14867 switch (range_type) { 14868 case BCM_FIELD_RANGE_SRCPORT: 14869 range_type_encoded = 0x0; 14870 break; 14871 case BCM_FIELD_RANGE_DSTPORT: 14872 range_type_encoded = 0x1; 14873 break; 14874 case BCM_FIELD_RANGE_OUTER_VLAN: 14875 range_type_encoded = 0x2; 14876 break; 14877 case BCM_FIELD_RANGE_PACKET_LENGTH: 14878 range_type_encoded = 0x3; 14879 break; 14880 default: 14881 LOG_ERROR(BSL_LS_BCM_FP, 14882 (BSL_META_U(unit, 14883 "FP(unit %d) Error: unsupported flags %#x\n"), 14884 unit, flags)); 14885 return (BCM_E_PARAM); 14886 } 14887 } 14888 14889 /* read/modify/write range check memory */ 14890 sal_memset(tbl_entry, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 14891 14892 /* Set source/destination port selection. */ 14893 soc_mem_field_set(unit, fp_range_check_mem, tbl_entry, 14894 FIELD_SELECTf, &range_type_encoded); 14895 14896 if (SOC_MEM_FIELD_VALID(unit, fp_range_check_mem, ENABLEf)) { 14897 soc_mem_field_set(unit, fp_range_check_mem, tbl_entry, 14898 ENABLEf, (uint32 *) &enable); 14899 } 14900 14901 /* Set range min value. */ 14902 soc_mem_field_set(unit, fp_range_check_mem, tbl_entry, 14903 LOWER_BOUNDSf, (uint32 *) &min); 14904 14905 /* Set range max value. */ 14906 soc_mem_field_set(unit, fp_range_check_mem, tbl_entry, 14907 UPPER_BOUNDSf, (uint32 *) &max); 14908 14909 /* Write entry back to hw. */ 14910 BCM_IF_ERROR_RETURN(soc_mem_write(unit, fp_range_check_mem, 14911 MEM_BLOCK_ALL, range, tbl_entry)); 14912 14913 return (BCM_E_NONE); 14914 } 14915 14916 /* 14917 * Function: 14918 * _bcm_field_trx_udf_index_to_flags 14919 * Purpose: 14920 * Translate the FP_UDF_OFFSETm table index to API flags. 14921 * Parameters: 14922 * tbl_idx - (IN) Index into FP_UDF_OFFSET table 14923 * flags - (OUT) Client specified flags. 14924 * Returns: 14925 * BCM_E_XXX 14926 * Notes: 14927 */ 14928 int 14929 _bcm_field_trx_udf_index_to_flags(int unit, uint32 tbl_idx, int *flags) 14930 { 14931 int index; 14932 14933 /* Input parameters check. */ 14934 if (NULL == flags) { 14935 return (BCM_E_PARAM); 14936 } 14937 14938 if (SOC_IS_TR_VL(unit)) { 14939 index = tbl_idx & 0x1f; 14940 } else if (SOC_IS_SC_CQ(unit)) { 14941 index = tbl_idx & 0xf; 14942 } else { 14943 index = tbl_idx & 0x1f; /* TRX */ 14944 } 14945 14946 switch (index) { 14947 case 0x0: 14948 *flags |= _BCM_FIELD_USER_IP4_HDR_ONLY; 14949 break; 14950 case 0x1: 14951 *flags |= _BCM_FIELD_USER_IP6_HDR_ONLY; 14952 break; 14953 case 0x2: 14954 *flags |= _BCM_FIELD_USER_IP4_OVER_IP4; 14955 break; 14956 case 0x3: 14957 *flags |= _BCM_FIELD_USER_IP6_OVER_IP4; 14958 break; 14959 case 0x4: 14960 *flags |= _BCM_FIELD_USER_IP4_OVER_IP6; 14961 break; 14962 case 0x5: 14963 *flags |= _BCM_FIELD_USER_IP6_OVER_IP6; 14964 break; 14965 case 0x6: 14966 *flags |= _BCM_FIELD_USER_GRE_IP4_OVER_IP4; 14967 break; 14968 case 0x7: 14969 *flags |= _BCM_FIELD_USER_GRE_IP6_OVER_IP4; 14970 break; 14971 case 0x8: 14972 *flags |= _BCM_FIELD_USER_GRE_IP4_OVER_IP6; 14973 break; 14974 case 0x9: 14975 *flags |= _BCM_FIELD_USER_GRE_IP6_OVER_IP6; 14976 break; 14977 case 0xa: 14978 if (SOC_IS_SC_CQ(unit)) { 14979 *flags |= _BCM_FIELD_USER_IP_NOTUSED; 14980 } else { 14981 *flags |= _BCM_FIELD_USER_ONE_MPLS_LABEL; 14982 } 14983 break; 14984 case 0xb: 14985 if (SOC_IS_SC_CQ(unit)) { 14986 /* _BCM_FIELD_DATA_FORMAT_IP4_PROTOCOL0 */ 14987 } else { 14988 *flags |= _BCM_FIELD_USER_TWO_MPLS_LABELS; 14989 } 14990 break; 14991 case 0xc: 14992 if (SOC_IS_SC_CQ(unit)) { 14993 /* _BCM_FIELD_DATA_FORMAT_IP4_PROTOCOL1 */ 14994 } else { 14995 *flags |= _BCM_FIELD_USER_IP_NOTUSED; 14996 } 14997 break; 14998 case 0xd: 14999 if (SOC_IS_SC_CQ(unit)) { 15000 /* _BCM_FIELD_DATA_FORMAT_IP6_PROTOCOL0 */ 15001 } else { 15002 /* _BCM_FIELD_DATA_FORMAT_IP4_PROTOCOL0 */ 15003 } 15004 case 0xe: 15005 if (SOC_IS_SC_CQ(unit)) { 15006 /* _BCM_FIELD_DATA_FORMAT_IP6_PROTOCOL1 */ 15007 } else { 15008 /* _BCM_FIELD_DATA_FORMAT_IP4_PROTOCOL1 */ 15009 } 15010 case 0xf: 15011 if (SOC_IS_TR_VL(unit)) { 15012 /* _BCM_FIELD_DATA_FORMAT_IP6_PROTOCOL0 */ 15013 } 15014 case 0x10: 15015 if (SOC_IS_TR_VL(unit)) { 15016 /* _BCM_FIELD_DATA_FORMAT_IP6_PROTOCOL0 */ 15017 } 15018 default: 15019 return (BCM_E_INTERNAL); 15020 } 15021 15022 index = (tbl_idx >> (SOC_IS_SC_CQ(unit) ? 4 : 5)) & 0x3; 15023 switch (index) { 15024 case 0x0: 15025 *flags |= _BCM_FIELD_USER_L2_ETHERNET2; 15026 break; 15027 case 0x1: 15028 *flags |= _BCM_FIELD_USER_L2_SNAP; 15029 break; 15030 case 0x2: 15031 *flags |= _BCM_FIELD_USER_L2_LLC; 15032 break; 15033 default: 15034 return (BCM_E_INTERNAL); 15035 } 15036 15037 index = (tbl_idx >> (SOC_IS_SC_CQ(unit) ? 6 : 7)); 15038 switch (index) { 15039 case 0x0: 15040 *flags |= _BCM_FIELD_USER_VLAN_NOTAG; 15041 break; 15042 case 0x1: 15043 *flags |= _BCM_FIELD_USER_VLAN_ONETAG; 15044 break; 15045 case 0x2: 15046 *flags |= _BCM_FIELD_USER_VLAN_TWOTAG; 15047 break; 15048 default: 15049 return (BCM_E_INTERNAL); 15050 } 15051 return (BCM_E_NONE); 15052 } 15053 15054 int 15055 _bcm_field_trx_control_arp_set(int unit, bcm_field_control_t control, uint32 state) 15056 { 15057 uint64 regval; 15058 uint32 enable; 15059 15060 BCM_IF_ERROR_RETURN(READ_ING_CONFIG_64r(unit, ®val)); 15061 15062 enable = soc_reg64_field32_get(unit, ING_CONFIG_64r, 15063 regval, ARP_RARP_TO_FPf); 15064 15065 switch (control) { 15066 case bcmFieldControlArpAsIp: 15067 if (state) { 15068 enable |= (0x1); 15069 } else { 15070 enable &= ~(0x1); 15071 } 15072 break; 15073 case bcmFieldControlRarpAsIp: 15074 if (state) { 15075 enable |= (0x2); 15076 } else { 15077 enable &= ~(0x2); 15078 } 15079 break; 15080 default: 15081 return (BCM_E_UNAVAIL); 15082 } 15083 15084 soc_reg64_field32_set(unit, ING_CONFIG_64r, ®val, ARP_RARP_TO_FPf, enable); 15085 BCM_IF_ERROR_RETURN(WRITE_ING_CONFIG_64r(unit, regval)); 15086 return (BCM_E_NONE); 15087 } 15088 15089 /* 15090 * Function: 15091 * _bcm_field_trx_stat_hw_mode_to_bmap 15092 * 15093 * Description: 15094 * HW counter mode to statistics bitmap. 15095 * Parameters: 15096 * unit - (IN) BCM device number. 15097 * mode - (IN) HW counter mode. 15098 * stage_id - (IN) Stage id. 15099 * hw_bmap - (OUT) Statistics bitmap. 15100 * hw_entry_count - (OUT) Number of counters required. 15101 * Returns: 15102 * BCM_E_XXX 15103 */ 15104 int 15105 _bcm_field_trx_stat_hw_mode_to_bmap(int unit, uint16 mode, 15106 _field_stage_id_t stage_id, 15107 uint32 *hw_bmap, uint8 *hw_entry_count) 15108 { 15109 uint32 value = 0; 15110 /* Input parameters check. */ 15111 if ((NULL == hw_bmap) || (NULL == hw_entry_count)) { 15112 return (BCM_E_PARAM); 15113 } 15114 switch (mode) { 15115 case 1: 15116 value |= (1 << (int)bcmFieldStatPackets); 15117 value |= (1 << (int)bcmFieldStatBytes); 15118 *hw_entry_count = 1; 15119 break; 15120 case 2: 15121 if (_BCM_FIELD_STAGE_EXTERNAL == stage_id) { 15122 value |= (1 << (int)bcmFieldStatGreenBytes); 15123 value |= (1 << (int)bcmFieldStatGreenPackets); 15124 } else { 15125 value |= (1 << (int)bcmFieldStatPackets); 15126 value |= (1 << (int)bcmFieldStatBytes); 15127 } 15128 *hw_entry_count = 1; 15129 break; 15130 case 3: 15131 if (_BCM_FIELD_STAGE_EXTERNAL == stage_id) { 15132 value |= (1 << (int)bcmFieldStatYellowBytes); 15133 value |= (1 << (int)bcmFieldStatYellowPackets); 15134 *hw_entry_count = 1; 15135 } else { 15136 value |= (1 << (int)bcmFieldStatRedBytes); 15137 value |= (1 << (int)bcmFieldStatRedPackets); 15138 value |= (1 << (int)bcmFieldStatNotRedBytes); 15139 value |= (1 << (int)bcmFieldStatNotRedPackets); 15140 *hw_entry_count = 2; 15141 } 15142 break; 15143 case 4: 15144 if (_BCM_FIELD_STAGE_EXTERNAL == stage_id) { 15145 value |= (1 << (int)bcmFieldStatRedBytes); 15146 value |= (1 << (int)bcmFieldStatRedPackets); 15147 *hw_entry_count = 1; 15148 } else { 15149 value |= (1 << (int)bcmFieldStatGreenBytes); 15150 value |= (1 << (int)bcmFieldStatGreenPackets); 15151 value |= (1 << (int)bcmFieldStatNotGreenBytes); 15152 value |= (1 << (int)bcmFieldStatNotGreenPackets); 15153 *hw_entry_count = 2; 15154 } 15155 break; 15156 case 5: 15157 if (_BCM_FIELD_STAGE_EXTERNAL == stage_id) { 15158 value |= (1 << (int)bcmFieldStatNotGreenBytes); 15159 value |= (1 << (int)bcmFieldStatNotGreenPackets); 15160 *hw_entry_count = 1; 15161 } else { 15162 value |= (1 << (int)bcmFieldStatGreenBytes); 15163 value |= (1 << (int)bcmFieldStatGreenPackets); 15164 value |= (1 << (int)bcmFieldStatRedBytes); 15165 value |= (1 << (int)bcmFieldStatRedPackets); 15166 value |= (1 << (int)bcmFieldStatNotYellowBytes); 15167 value |= (1 << (int)bcmFieldStatNotYellowPackets); 15168 *hw_entry_count = 2; 15169 } 15170 break; 15171 case 6: 15172 if (_BCM_FIELD_STAGE_EXTERNAL == stage_id) { 15173 value |= (1 << (int)bcmFieldStatNotYellowBytes); 15174 value |= (1 << (int)bcmFieldStatNotYellowPackets); 15175 *hw_entry_count = 1; 15176 } else { 15177 value |= (1 << (int)bcmFieldStatGreenBytes); 15178 value |= (1 << (int)bcmFieldStatGreenPackets); 15179 value |= (1 << (int)bcmFieldStatYellowBytes); 15180 value |= (1 << (int)bcmFieldStatYellowPackets); 15181 value |= (1 << (int)bcmFieldStatNotRedBytes); 15182 value |= (1 << (int)bcmFieldStatNotRedPackets); 15183 *hw_entry_count = 2; 15184 } 15185 break; 15186 case 7: 15187 if (_BCM_FIELD_STAGE_EXTERNAL == stage_id) { 15188 value |= (1 << (int)bcmFieldStatNotRedBytes); 15189 value |= (1 << (int)bcmFieldStatNotRedPackets); 15190 *hw_entry_count = 1; 15191 } else { 15192 value |= (1 << (int)bcmFieldStatRedBytes); 15193 value |= (1 << (int)bcmFieldStatRedPackets); 15194 value |= (1 << (int)bcmFieldStatYellowBytes); 15195 value |= (1 << (int)bcmFieldStatYellowPackets); 15196 value |= (1 << (int)bcmFieldStatNotGreenBytes); 15197 value |= (1 << (int)bcmFieldStatNotGreenPackets); 15198 *hw_entry_count = 2; 15199 } 15200 break; 15201 default: 15202 *hw_entry_count = 0; 15203 } 15204 *hw_bmap = value; 15205 return (BCM_E_NONE); 15206 } 15207 15208 /* 15209 * Function: 15210 * _field_trx_meter_table_get 15211 * Purpose: 15212 * Get policer table name. 15213 * Parameters: 15214 * unit - (IN) BCM device number. 15215 * stage_id - (IN) Field entry pipeline stage. 15216 * mem_x - (OUT) Policer table name X pipeline. 15217 * mem_y - (OUT) Policer table name Y pipeline. 15218 * Returns: 15219 * BCM_E_XXX 15220 */ 15221 int 15222 _field_trx_meter_table_get(int unit, _field_stage_id_t stage_id, 15223 soc_mem_t *mem_x, soc_mem_t *mem_y) 15224 { 15225 if ((NULL == mem_x) || (NULL == mem_y)) { 15226 return (BCM_E_PARAM); 15227 } 15228 15229 *mem_x = *mem_y = INVALIDm; 15230 15231 /* Resolve meter table name. */ 15232 switch (stage_id) { 15233 case _BCM_FIELD_STAGE_INGRESS: 15234 case _BCM_FIELD_STAGE_EXTERNAL: 15235 *mem_x = FP_METER_TABLEm; 15236 break; 15237 case _BCM_FIELD_STAGE_EGRESS: 15238 if (SOC_IS_APACHE(unit)) { 15239 *mem_x = EFP_METER_TABLEm; 15240 } else if (SOC_IS_SC_CQ(unit) || 15241 SOC_IS_TD_TT(unit)) { 15242 *mem_x = EFP_METER_TABLE_Xm; 15243 *mem_y = EFP_METER_TABLE_Ym; 15244 } else { 15245 *mem_x = EFP_METER_TABLEm; 15246 } 15247 break; 15248 default: 15249 return (BCM_E_INTERNAL); 15250 } 15251 return (BCM_E_NONE); 15252 } 15253 15254 /* 15255 * Function: 15256 * _field_trx_policer_hw_update 15257 * Purpose: 15258 * Update (Install) the policer parameters 15259 * Parameters: 15260 * unit - (IN) BCM device number. 15261 * f_ent - (IN) Field entry policer attached to. 15262 * index_mtr - (IN) Peak/Committed 15263 * bucket_size - (IN) Encoded bucket size. 15264 * refresh_rate - (IN) Tokens refresh rate. 15265 * granularity - (IN) Tokens granularity. 15266 * Returns: 15267 * BCM_E_XXX 15268 */ 15269 STATIC int 15270 _field_trx_policer_hw_update(int unit, _field_entry_t *f_ent, 15271 _field_policer_t *f_pl, uint8 index_mtr, 15272 uint32 bucket_size, uint32 refresh_rate, 15273 uint32 granularity, soc_mem_t meter_table) 15274 { 15275 uint32 meter_entry[SOC_MAX_MEM_FIELD_WORDS]; /* HW entry buffer.*/ 15276 int bucket_cnt_bitsize; /* Bucket count field bit size. */ 15277 int bucket_max_bitsize; /* Bucket size field bit size. */ 15278 int meter_hw_idx; /* Meter table index. */ 15279 uint32 bucketcount; /* Bucket count initial value. */ 15280 int meter_offset; /* Peak/Comm meter selection. */ 15281 _field_stage_t *stage_fc; /* Field stage control. */ 15282 int rv; /* Operation return status. */ 15283 uint32 set_bucket_size; 15284 _field_stage_id_t stage_id; /* Stage id used for metering. */ 15285 15286 if ((NULL == f_pl) || (NULL == f_ent) || (INVALIDm == meter_table)) { 15287 return (BCM_E_PARAM); 15288 } 15289 15290 stage_id = (_BCM_FIELD_STAGE_EXACTMATCH == f_ent->fs->stage_id) ? \ 15291 _BCM_FIELD_STAGE_INGRESS : f_ent->fs->stage_id; 15292 15293 /* Get stage field control structure. */ 15294 rv = _field_stage_control_get(unit, stage_id, &stage_fc); 15295 BCM_IF_ERROR_RETURN(rv); 15296 15297 15298 /* Calculate initial backet count. 15299 * bucket size << (bit count diff - 1(sign) -1 (overflow)) - 1 15300 */ 15301 if (bucket_size) { 15302 bucket_cnt_bitsize = soc_mem_field_length(unit, meter_table, 15303 BUCKETCOUNTf); 15304 bucket_max_bitsize = soc_mem_field_length(unit, meter_table, 15305 BUCKETSIZEf); 15306 /* coverity[negative_shift] */ 15307 bucketcount = (bucket_size 15308 << (bucket_cnt_bitsize - bucket_max_bitsize - 2)) - 1; 15309 bucketcount &= ((1 << bucket_cnt_bitsize) - 1); 15310 } else { 15311 bucketcount = 0; 15312 } 15313 15314 meter_offset = (BCM_FIELD_METER_PEAK == index_mtr) ? 0 : 1; 15315 15316 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) { 15317 /* 15318 * Hw index is: 15319 * ((Pool number * pool_size) + (2 * pair number) + meter_offset) 15320 */ 15321 meter_hw_idx = (f_pl->pool_index * 15322 stage_fc->meter_pool[f_ent->group->instance] 15323 [f_pl->pool_index]->pool_size) 15324 + (2 * f_pl->hw_index) + meter_offset; 15325 LOG_DEBUG(BSL_LS_BCM_FP, 15326 (BSL_META_U(unit, 15327 "FP(unit %d) vverb: pool_idx:%d pool_sz:%d pair_num:%d" 15328 " hw_idx:%d\n"), unit, f_pl->pool_index, 15329 stage_fc->meter_pool[f_ent->group->instance] 15330 [f_pl->pool_index]->pool_size, 15331 f_pl->hw_index, 15332 meter_hw_idx)); 15333 } else { 15334 /* 15335 * Hw index is: 15336 * ((slice index) + (2 * pair number) + meter_offset) 15337 */ 15338 meter_hw_idx = 15339 stage_fc->slices[f_ent->group->instance] 15340 [f_pl->pool_index].start_tcam_idx + \ 15341 (2 * f_pl->hw_index) + meter_offset; 15342 15343 LOG_DEBUG(BSL_LS_BCM_FP, 15344 (BSL_META_U(unit, 15345 "FP(unit %d) vverb: slice_num:%d tcam_idx:%d pair_num:%d" 15346 " hw_idx%d\n"), unit, f_pl->pool_index, 15347 stage_fc->slices[f_ent->group->instance] 15348 [f_pl->pool_index].start_tcam_idx, 15349 f_pl->hw_index, 15350 meter_hw_idx)); 15351 } 15352 15353 if (meter_hw_idx < soc_mem_index_min(unit, meter_table) || 15354 meter_hw_idx > soc_mem_index_max(unit, meter_table)) { 15355 return (BCM_E_INTERNAL); 15356 } 15357 15358 /* Update meter config in hw. */ 15359 rv = soc_mem_read(unit, meter_table, MEM_BLOCK_ANY, 15360 meter_hw_idx, &meter_entry); 15361 BCM_IF_ERROR_RETURN(rv); 15362 15363 if ((f_pl->cfg.flags & BCM_POLICER_AS_PACKET_COUNTER) && 15364 (SOC_IS_KATANA2(unit))) { 15365 /* Poilcer is used as packet counter 15366 bucket count is set to max value 15367 meter test odd/even is set to 0 15368 set refresh count to 0 15369 set bucket size to 0 15370 */ 15371 refresh_rate = 0; 15372 bucket_size = 0xfff; 15373 granularity = 7; /* Max gran of 250 token per packet */ 15374 bucketcount = bucket_size << 16; 15375 } 15376 15377 soc_mem_field32_set(unit, meter_table, &meter_entry, REFRESHCOUNTf, 15378 refresh_rate); 15379 soc_mem_field32_set(unit, meter_table, &meter_entry, METER_GRANf, 15380 granularity); 15381 15382 soc_mem_field_get(unit, meter_table, meter_entry, BUCKETSIZEf, &set_bucket_size); 15383 15384 if (bucket_size != set_bucket_size) { 15385 soc_mem_field32_set(unit, meter_table, &meter_entry, BUCKETCOUNTf, 15386 bucketcount); 15387 soc_mem_field32_set(unit, meter_table, &meter_entry, BUCKETSIZEf, 15388 bucket_size); 15389 } 15390 15391 /* Refresh mode is only set to 1 for Single Rate. Other modes get 0 */ 15392 if (f_pl->cfg.mode == bcmPolicerModeSrTcm) { 15393 soc_mem_field32_set(unit, meter_table, &meter_entry, REFRESH_MODEf, 1); 15394 } else if (f_pl->cfg.mode == bcmPolicerModeCoupledTrTcmDs) { 15395 soc_mem_field32_set(unit, meter_table, &meter_entry, REFRESH_MODEf, 2); 15396 } else { 15397 soc_mem_field32_set(unit, meter_table, &meter_entry, REFRESH_MODEf, 0); 15398 } 15399 15400 if (soc_feature(unit, soc_feature_field_packet_based_metering) 15401 && (soc_mem_field_valid(unit, meter_table, PKTS_BYTESf))) { 15402 if (f_pl->cfg.flags & BCM_POLICER_MODE_PACKETS) { 15403 soc_mem_field32_set(unit, meter_table, &meter_entry, PKTS_BYTESf, 1); 15404 } else { 15405 soc_mem_field32_set(unit, meter_table, &meter_entry, PKTS_BYTESf, 0); 15406 } 15407 } 15408 #if defined(BCM_GREYHOUND2_SUPPORT) 15409 /* 15410 * Enable TSN Metering: register METER_MODE_TSN_MODIFIER 15411 * 0 = DEFAULT (backward compatible) ; 1 = TSN Metering 15412 */ 15413 if (SOC_MEM_FIELD_VALID(unit, meter_table, METER_MODE_TSN_MODIFIERf)) { 15414 if (f_pl->cfg.mode == bcmPolicerModeSrTcmTsn) { 15415 soc_mem_field32_set(unit, meter_table, 15416 &meter_entry, REFRESH_MODEf, 1); 15417 soc_mem_field32_set(unit, meter_table, 15418 &meter_entry, METER_MODE_TSN_MODIFIERf, 1); 15419 } else { 15420 soc_mem_field32_set(unit, meter_table, 15421 &meter_entry, METER_MODE_TSN_MODIFIERf, 0); 15422 } 15423 } 15424 #endif /* BCM_GREYHOUND2_SUPPORT */ 15425 rv = soc_mem_write(unit, meter_table, MEM_BLOCK_ALL, 15426 meter_hw_idx, meter_entry); 15427 15428 return (rv); 15429 } 15430 15431 /* 15432 * Function: 15433 * _bcm_field_trx_policer_hw_update 15434 * Purpose: 15435 * Update (Install) the policer parameters 15436 * Parameters: 15437 * unit - (IN) BCM device number. 15438 * f_ent - (IN) Field entry policer attached to. 15439 * index_mtr - (IN) Peak/Committed 15440 * bucket_size - (IN) Encoded bucket size. 15441 * refresh_rate - (IN) Tokens refresh rate. 15442 * granularity - (IN) Tokens granularity. 15443 * Returns: 15444 * BCM_E_XXX 15445 */ 15446 int 15447 _bcm_field_trx_policer_hw_update(int unit, _field_entry_t *f_ent, 15448 _field_policer_t *f_pl, uint8 index_mtr, 15449 uint32 bucket_size, uint32 refresh_rate, 15450 uint32 granularity, soc_mem_t meter_table) 15451 { 15452 return _field_trx_policer_hw_update(unit, f_ent, f_pl, index_mtr, 15453 bucket_size, refresh_rate, 15454 granularity, meter_table); 15455 } 15456 /* 15457 * Function: 15458 * _field_trx_default_policer_set 15459 * 15460 * Purpose: 15461 * Get metering portion of Policy Table. 15462 * 15463 * Parameters: 15464 * unit - (IN)BCM device number. 15465 * stage_fc - (IN)Stage control structure. 15466 * level - (IN)Policer level. 15467 * mem - (IN)Policy table memory. 15468 * buf - (IN/OUT)Hardware policy entry 15469 * 15470 * Returns: 15471 * BCM_E_NONE - Success 15472 */ 15473 STATIC int 15474 _field_trx_default_policer_set(int unit, _field_stage_t *stage_fc, 15475 int level, soc_mem_t mem, uint32 *buf) 15476 { 15477 soc_field_t pair_mode_field;/* Hw field for pair mode. */ 15478 soc_field_t modifier_field; /* Hw field for meter update.*/ 15479 15480 /* Input parameter check. */ 15481 if ((NULL == stage_fc) || (NULL == buf)) { 15482 return (BCM_E_PARAM); 15483 } 15484 15485 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) { 15486 if (level) { 15487 pair_mode_field = METER_SHARING_MODEf; 15488 modifier_field = METER_SHARING_MODE_MODIFIERf; 15489 } else { 15490 pair_mode_field = METER_PAIR_MODEf; 15491 modifier_field = METER_PAIR_MODE_MODIFIERf; 15492 } 15493 15494 /* Set the meter mode to default. */ 15495 soc_mem_field32_set(unit, mem, buf, pair_mode_field, 0); 15496 /* Preserve packet color. */ 15497 soc_mem_field32_set(unit, mem, buf, modifier_field, 1); 15498 } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) { 15499 if (0 == level) { 15500 /* Set the meter mode to default. */ 15501 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODEf, 0); 15502 /* Preserve packet color. */ 15503 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 1); 15504 } 15505 } else { 15506 return BCM_E_PARAM; 15507 } 15508 return (BCM_E_NONE); 15509 } 15510 15511 /* 15512 * Function: 15513 * _bcm_field_trx_policer_action_set 15514 * 15515 * Purpose: 15516 * Get metering portion of Policy Table. 15517 * 15518 * Parameters: 15519 * unit - (IN)BCM device number. 15520 * f_ent - (IN)Software entry structure to get tcam info from. 15521 * mem - (IN)Policy table memory. 15522 * buf - (IN/OUT)Hardware policy entry 15523 * 15524 * Returns: 15525 * BCM_E_NONE - Success 15526 */ 15527 int 15528 _bcm_field_trx_policer_action_set(int unit, _field_entry_t *f_ent, 15529 soc_mem_t mem, uint32 *buf) 15530 { 15531 _field_entry_policer_t *f_ent_pl; /* Field entry policer descriptor.*/ 15532 _field_stage_t *stage_fc; /* Stage field control structure. */ 15533 bcm_field_stage_t stage_id; /* Stage that contains meter. */ 15534 _field_policer_t *f_pl; /* Field policer descriptor. */ 15535 int idx; /* Policers levels iterator. */ 15536 uint32 meter_pair_mode = BCM_FIELD_METER_MODE_DEFAULT; 15537 /* Hw meter usage bits. */ 15538 soc_field_t pair_mode_field;/* Hw field for pair mode. */ 15539 soc_field_t index_field; /* Hw field for meter index. */ 15540 soc_field_t modifier_field; /* Hw field for meter update.*/ 15541 int meter_pair_idx; /* Meter pair index. */ 15542 uint32 meter_merge = 0;/* Meter merge mode. */ 15543 int rv; /* Operation return status. */ 15544 15545 15546 /* Input parameter check. */ 15547 if ((NULL == f_ent) || (NULL == buf)) { 15548 return (BCM_E_PARAM); 15549 } 15550 if (NULL == f_ent->group) { 15551 return (BCM_E_PARAM); 15552 } 15553 15554 stage_id = (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXTERNAL) 15555 ? _BCM_FIELD_STAGE_INGRESS : f_ent->group->stage_id; 15556 15557 /* No policers at lookup stage. */ 15558 if (_BCM_FIELD_STAGE_LOOKUP == stage_id) { 15559 return (BCM_E_NONE); 15560 } 15561 15562 if (f_ent->flags & _FP_ENTRY_POLICER_IN_SECONDARY_SLICE) { 15563 return (BCM_E_NONE); 15564 } 15565 15566 /* Get stage control structure. */ 15567 rv = _field_stage_control_get(unit, stage_id, &stage_fc); 15568 BCM_IF_ERROR_RETURN(rv); 15569 15570 for (idx = 0; idx < _FP_POLICER_LEVEL_COUNT; idx++) { 15571 f_ent_pl = f_ent->policer + idx; 15572 15573 #ifdef BCM_TRIDENT_SUPPORT 15574 if (SOC_IS_TD_TT(unit) && (idx > 0)) { 15575 /* Trident device does not support Level1 policers */ 15576 break; 15577 } 15578 #endif 15579 if (0 == (f_ent_pl->flags & _FP_POLICER_INSTALLED)) { 15580 /* Install preserve the color policer. */ 15581 rv = _field_trx_default_policer_set(unit, stage_fc, idx, 15582 mem, buf); 15583 BCM_IF_ERROR_RETURN(rv); 15584 continue; 15585 } 15586 15587 /* Get policer config. */ 15588 rv = _bcm_field_policer_get(unit, f_ent_pl->pid, &f_pl); 15589 BCM_IF_ERROR_RETURN(rv); 15590 15591 if (0 == f_pl->level) { 15592 /* Get hw encoding for meter mode. */ 15593 rv = _bcm_field_meter_pair_mode_get(unit, f_pl, &meter_pair_mode); 15594 BCM_IF_ERROR_RETURN(rv); 15595 /* If level 0 policer is Modified trTcm -> 15596 * meter sharing mode is dual. 15597 */ 15598 if ((f_pl->cfg.mode == bcmPolicerModeTrTcmDs) || 15599 (f_pl->cfg.mode == bcmPolicerModeCoupledTrTcmDs)) { 15600 meter_merge = 3; 15601 } 15602 } 15603 15604 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 15605 /* Pair index is (Pool number * Pairs in Pool + Pair number) */ 15606 meter_pair_idx = (f_pl->pool_index * 15607 (stage_fc->meter_pool[f_ent->group->instance] 15608 [f_pl->pool_index]->num_meter_pairs)) 15609 + (f_pl->hw_index); 15610 #ifdef BCM_TRIDENT_SUPPORT 15611 if (SOC_IS_TD_TT(unit)) { 15612 soc_mem_field32_set(unit, mem, buf, METER_PAIR_INDEX_ODDf, 15613 meter_pair_idx); 15614 soc_mem_field32_set(unit, mem, buf, METER_PAIR_INDEX_EVENf, 15615 meter_pair_idx); 15616 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODEf, 15617 meter_pair_mode); 15618 15619 /* 15620 * Flow mode is the only one that cares about the test and 15621 * update bits. 15622 */ 15623 if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 15624 /* Excess meter - even index. */ 15625 soc_mem_field32_set(unit, mem, buf, METER_TEST_ODDf, 0); 15626 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 1); 15627 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_ODDf, 0); 15628 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_EVENf, 1); 15629 } else if (_FP_POLICER_COMMITTED_HW_METER(f_pl)) { 15630 /* Committed meter - odd index. */ 15631 soc_mem_field32_set(unit, mem, buf, METER_TEST_ODDf, 1); 15632 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 0); 15633 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_ODDf, 1); 15634 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_EVENf, 0); 15635 } 15636 15637 if ((f_pl->cfg.mode == bcmPolicerModePassThrough) || 15638 (f_pl->cfg.mode == bcmPolicerModeSrTcmModified)) { 15639 soc_mem_field32_set(unit, mem, buf, 15640 METER_PAIR_MODE_MODIFIERf, 1); 15641 } 15642 return (BCM_E_NONE); 15643 } else 15644 #endif 15645 { 15646 /* 15647 * Get the meter index in the global meter pool 15648 * IMP: This is the meter pair index, not the individual meter's 15649 * which will be 2x (+1) (see _field_triumph_meter_install) 15650 */ 15651 if (f_pl->level) { 15652 pair_mode_field = METER_SHARING_MODEf; 15653 index_field = SHARED_METER_PAIR_INDEXf; 15654 modifier_field = METER_SHARING_MODE_MODIFIERf; 15655 meter_pair_mode = (meter_merge) ? meter_merge 15656 : ((f_pl->cfg.flags 15657 & BCM_POLICER_COLOR_MERGE_OR) 15658 ? 1 : 2); 15659 } else { 15660 pair_mode_field = METER_PAIR_MODEf; 15661 index_field = METER_PAIR_INDEXf; 15662 modifier_field = METER_PAIR_MODE_MODIFIERf; 15663 } 15664 15665 soc_mem_field32_set(unit, mem, buf, index_field, 15666 meter_pair_idx); 15667 15668 /* Set the meter mode */ 15669 soc_mem_field32_set(unit, mem, buf, pair_mode_field, 15670 meter_pair_mode); 15671 15672 /* 15673 * Flow mode cares about the MODIFIER field 15674 * Excess (Even): 0 15675 * COMMITTED/PASS THROUGH (Odd): 1 15676 */ 15677 if ((f_pl->cfg.mode == bcmPolicerModePassThrough) 15678 || (f_pl->cfg.mode == bcmPolicerModeSrTcmModified) 15679 || (_FP_POLICER_COMMITTED_HW_METER(f_pl))) { 15680 soc_mem_field32_set(unit, mem, buf, modifier_field, 1); 15681 } else if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 15682 soc_mem_field32_set(unit, mem, buf, modifier_field, 0); 15683 } 15684 } 15685 } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) { 15686 /* Get the even and odd indexes from the entry. The even and odd 15687 * meter indices are the same. 15688 */ 15689 soc_mem_field32_set(unit, mem, buf, METER_INDEX_EVENf, 15690 f_pl->hw_index); 15691 soc_mem_field32_set(unit, mem, buf, METER_INDEX_ODDf, 15692 f_pl->hw_index); 15693 15694 /* Get the meter mode */ 15695 15696 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODEf, 15697 meter_pair_mode); 15698 15699 /* 15700 * Flow mode is the only one that cares about the test and 15701 * update bits. 15702 */ 15703 if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 15704 /* Excess meter - even index. */ 15705 soc_mem_field32_set(unit, mem, buf, METER_TEST_ODDf, 0); 15706 if (SOC_IS_KATANA2(unit) && 15707 (f_pl->cfg.flags & BCM_POLICER_AS_PACKET_COUNTER)) { 15708 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 0); 15709 } else { 15710 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 1); 15711 } 15712 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_ODDf, 0); 15713 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_EVENf, 1); 15714 } else if (_FP_POLICER_COMMITTED_HW_METER(f_pl)) { 15715 /* Committed meter - odd index. */ 15716 if (SOC_IS_KATANA2(unit) && 15717 (f_pl->cfg.flags & BCM_POLICER_AS_PACKET_COUNTER)) { 15718 soc_mem_field32_set(unit, mem, buf, METER_TEST_ODDf, 0); 15719 } else { 15720 soc_mem_field32_set(unit, mem, buf, METER_TEST_ODDf, 1); 15721 } 15722 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 0); 15723 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_ODDf, 1); 15724 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_EVENf, 0); 15725 } else if (f_pl->cfg.mode == bcmPolicerModePassThrough) { 15726 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 1); 15727 } 15728 #if defined(BCM_TRIDENT2_SUPPORT) 15729 else if (f_pl->cfg.mode == bcmPolicerModeSrTcmModified 15730 && (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 15731 soc_mem_field32_set(unit, mem, buf, 15732 METER_MODE_MODIFIERf, 1); 15733 } 15734 #endif 15735 } else { 15736 return BCM_E_PARAM; 15737 } 15738 } 15739 return (BCM_E_NONE); 15740 } 15741 15742 15743 /* 15744 * Function: 15745 * _bcm_field_trx_policer_install 15746 * Purpose: 15747 * Install a meter pair into the hardware tables. 15748 * Parameters: 15749 * unit - (IN) BCM device number. 15750 * f_ent - (IN) Field entry. 15751 * f_pl - (IN) Field policer descriptor. 15752 * Returns: 15753 * BCM_E_XXX 15754 */ 15755 int 15756 _bcm_field_trx_policer_install(int unit, _field_entry_t *f_ent, 15757 _field_policer_t *f_pl) 15758 { 15759 uint32 bucketsize_peak = 0; /* Bucket size. */ 15760 uint32 refresh_rate_peak = 0; /* Policer refresh rate. */ 15761 uint32 granularity_peak = 0; /* Policer granularity. */ 15762 uint32 bucketsize_commit = 0; /* Bucket size. */ 15763 uint32 refresh_rate_commit = 0; /* Policer refresh rate. */ 15764 uint32 granularity_commit = 0; /* Policer granularity. */ 15765 int refresh_bitsize; /* Number of bits for the 15766 refresh rate field. */ 15767 int bucket_max_bitsize; /* Number of bits for the 15768 bucket max field. */ 15769 int rv; /* Operation return status. */ 15770 soc_mem_t meter_table_x; /* Meter table name. */ 15771 soc_mem_t meter_table_y; /* Meter table name. */ 15772 uint32 flags; /* Policer flags. */ 15773 15774 /* Input parameters check. */ 15775 if ((NULL == f_ent) || (NULL == f_pl)) { 15776 return (BCM_E_PARAM); 15777 } 15778 15779 if (NULL == f_ent->group || NULL == f_ent->fs) { 15780 return (BCM_E_INTERNAL); 15781 } 15782 15783 if (0 == (f_pl->hw_flags & _FP_POLICER_DIRTY)) { 15784 return (BCM_E_NONE); 15785 } 15786 15787 /* Resolve meter table name. */ 15788 rv = _field_trx_meter_table_get(unit, f_ent->fs->stage_id, 15789 &meter_table_x, &meter_table_y); 15790 BCM_IF_ERROR_RETURN(rv); 15791 15792 refresh_bitsize = soc_mem_field_length(unit, meter_table_x, REFRESHCOUNTf); 15793 bucket_max_bitsize = soc_mem_field_length(unit, meter_table_x, BUCKETSIZEf); 15794 15795 /* lookup bucket size from tables */ 15796 flags = _BCM_XGS_METER_FLAG_GRANULARITY | _BCM_XGS_METER_FLAG_FP_POLICER; 15797 15798 15799 /* TD2 has change in granularity calculation */ 15800 if ((SOC_IS_TD2_TT2(unit)) && 15801 (f_pl->cfg.flags & BCM_POLICER_MODE_PACKETS)) { 15802 flags = flags | _BCM_XGS_METER_FLAG_FP_TD2_POLICER; 15803 } 15804 15805 /* Set packet mode flags setting */ 15806 if (f_pl->cfg.flags & BCM_POLICER_MODE_PACKETS) { 15807 flags |= _BCM_XGS_METER_FLAG_PACKET_MODE; 15808 } else { 15809 flags &= ~_BCM_XGS_METER_FLAG_PACKET_MODE; 15810 } 15811 15812 if (f_pl->cfg.mode != bcmPolicerModeSrTcm) { 15813 if (f_pl->hw_flags & _FP_POLICER_COMMITTED_DIRTY) { 15814 /* Calculate policer bucket size/refresh_rate/granularity. */ 15815 rv = _bcm_xgs_kbits_to_bucket_encoding(f_pl->cfg.ckbits_sec, 15816 f_pl->cfg.ckbits_burst, 15817 flags, refresh_bitsize, 15818 bucket_max_bitsize, 15819 &refresh_rate_commit, 15820 &bucketsize_commit, 15821 &granularity_commit); 15822 BCM_IF_ERROR_RETURN(rv); 15823 /* Programm policer parameters into hw. */ 15824 rv = _field_trx_policer_hw_update(unit, f_ent, f_pl, 15825 BCM_FIELD_METER_COMMITTED, 15826 bucketsize_commit, 15827 refresh_rate_commit, 15828 granularity_commit, meter_table_x); 15829 15830 if (BCM_SUCCESS(rv) && (INVALIDm != meter_table_y)) { 15831 rv = _field_trx_policer_hw_update(unit, f_ent, f_pl, 15832 BCM_FIELD_METER_COMMITTED, 15833 bucketsize_commit, 15834 refresh_rate_commit, 15835 granularity_commit, 15836 meter_table_y); 15837 } 15838 BCM_IF_ERROR_RETURN(rv); 15839 f_pl->hw_flags &= ~_FP_POLICER_COMMITTED_DIRTY; 15840 } 15841 15842 if (f_pl->hw_flags & _FP_POLICER_PEAK_DIRTY) { 15843 15844 if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 15845 /* 15846 * Rates are always set in committed variables, 15847 * for flow meters. 15848 */ 15849 f_pl->cfg.pkbits_sec = f_pl->cfg.ckbits_sec; 15850 f_pl->cfg.pkbits_burst = f_pl->cfg.ckbits_burst; 15851 } 15852 15853 /* Calculate policer bucket size/refresh_rate/granularity. */ 15854 rv = _bcm_xgs_kbits_to_bucket_encoding(f_pl->cfg.pkbits_sec, 15855 f_pl->cfg.pkbits_burst, 15856 flags, 15857 refresh_bitsize, 15858 bucket_max_bitsize, 15859 &refresh_rate_peak, 15860 &bucketsize_peak, 15861 &granularity_peak); 15862 BCM_IF_ERROR_RETURN(rv); 15863 /* Programm policer parameters into hw. */ 15864 rv = _field_trx_policer_hw_update(unit, f_ent, f_pl, 15865 BCM_FIELD_METER_PEAK, 15866 bucketsize_peak, refresh_rate_peak, 15867 granularity_peak, meter_table_x); 15868 15869 if (BCM_SUCCESS(rv) && (INVALIDm != meter_table_y)) { 15870 rv = _field_trx_policer_hw_update(unit, f_ent, f_pl, 15871 BCM_FIELD_METER_PEAK, 15872 bucketsize_peak, 15873 refresh_rate_peak, 15874 granularity_peak, 15875 meter_table_y); 15876 } 15877 BCM_IF_ERROR_RETURN(rv); 15878 f_pl->hw_flags &= ~_FP_POLICER_PEAK_DIRTY; 15879 15880 if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 15881 /* Reset peak meter rates. */ 15882 f_pl->cfg.pkbits_sec = 0; 15883 f_pl->cfg.pkbits_burst = 0; 15884 } 15885 } 15886 } else { 15887 if (f_pl->hw_flags & _FP_POLICER_COMMITTED_DIRTY) { 15888 /* Calculate policer bucket size/refresh_rate/granularity. */ 15889 rv = _bcm_xgs_kbits_to_bucket_encoding(f_pl->cfg.ckbits_sec, 15890 f_pl->cfg.ckbits_burst, 15891 flags, refresh_bitsize, 15892 bucket_max_bitsize, 15893 &refresh_rate_commit, 15894 &bucketsize_commit, 15895 &granularity_commit); 15896 BCM_IF_ERROR_RETURN(rv); 15897 } 15898 15899 if (f_pl->hw_flags & _FP_POLICER_PEAK_DIRTY) { 15900 /* Calculate policer bucket size/refresh_rate/granularity. */ 15901 rv = _bcm_xgs_kbits_to_bucket_encoding(f_pl->cfg.pkbits_sec, 15902 f_pl->cfg.pkbits_burst, 15903 flags, 15904 refresh_bitsize, 15905 bucket_max_bitsize, 15906 &refresh_rate_peak, 15907 &bucketsize_peak, 15908 &granularity_peak); 15909 BCM_IF_ERROR_RETURN(rv); 15910 } 15911 15912 if (granularity_commit != granularity_peak) { 15913 if (granularity_commit < granularity_peak) { 15914 rv = _bcm_xgs_kbits_to_dual_bucket_encoding(f_pl->cfg.ckbits_sec, 15915 f_pl->cfg.ckbits_burst, 15916 flags, 15917 refresh_bitsize, 15918 bucket_max_bitsize, 15919 granularity_peak, 15920 &refresh_rate_commit, 15921 &bucketsize_commit, 15922 &granularity_commit); 15923 } else if (granularity_commit > granularity_peak) { 15924 rv = _bcm_xgs_kbits_to_dual_bucket_encoding(f_pl->cfg.pkbits_sec, 15925 f_pl->cfg.pkbits_burst, 15926 flags, 15927 refresh_bitsize, 15928 bucket_max_bitsize, 15929 granularity_commit, 15930 &refresh_rate_peak, 15931 &bucketsize_peak, 15932 &granularity_peak); 15933 } 15934 BCM_IF_ERROR_RETURN(rv); 15935 } 15936 /* Programm policer parameters into hw. */ 15937 rv = _field_trx_policer_hw_update(unit, f_ent, f_pl, 15938 BCM_FIELD_METER_COMMITTED, 15939 bucketsize_commit, 15940 refresh_rate_commit, 15941 granularity_commit, meter_table_x); 15942 15943 if (BCM_SUCCESS(rv) && (INVALIDm != meter_table_y)) { 15944 rv = _field_trx_policer_hw_update(unit, f_ent, f_pl, 15945 BCM_FIELD_METER_COMMITTED, 15946 bucketsize_commit, 15947 refresh_rate_commit, 15948 granularity_commit, 15949 meter_table_y); 15950 } 15951 BCM_IF_ERROR_RETURN(rv); 15952 f_pl->hw_flags &= ~_FP_POLICER_COMMITTED_DIRTY; 15953 15954 /* Programm policer parameters into hw. */ 15955 rv = _field_trx_policer_hw_update(unit, f_ent, f_pl, 15956 BCM_FIELD_METER_PEAK, 15957 bucketsize_peak, refresh_rate_peak, 15958 granularity_peak, meter_table_x); 15959 15960 if (BCM_SUCCESS(rv) && (INVALIDm != meter_table_y)) { 15961 rv = _field_trx_policer_hw_update(unit, f_ent, f_pl, 15962 BCM_FIELD_METER_PEAK, 15963 bucketsize_peak, 15964 refresh_rate_peak, 15965 granularity_peak, 15966 meter_table_y); 15967 } 15968 15969 f_pl->hw_flags &= ~_FP_POLICER_PEAK_DIRTY; 15970 } 15971 15972 BCM_IF_ERROR_RETURN(rv); 15973 /* Update current policer counters from hw */ 15974 rv = _field_entry_policer_update_actual_hw_rates(unit, meter_table_x, 15975 _FP_DEF_INST, f_ent, f_pl); 15976 15977 return rv; 15978 } 15979 15980 /* 15981 * Function: 15982 * _field_trx_policer_packet_counter_hw_get 15983 * Purpose: 15984 * Get the policer token bucket parameters 15985 * Parameters: 15986 * unit - (IN) BCM device number. 15987 * f_pl - (IN) Field policer descriptor. 15988 * Count - (OUT) Token bucket count. 15989 * Returns: 15990 * BCM_E_XXX 15991 */ 15992 int 15993 _field_trx_policer_packet_counter_hw_get(int unit, _field_policer_t *f_pl, 15994 soc_mem_t meter_table, 15995 uint32 *count) 15996 { 15997 uint32 meter_entry[SOC_MAX_MEM_FIELD_WORDS]; /* HW entry buffer.*/ 15998 int meter_hw_idx; /* Meter table index. */ 15999 int meter_offset; /* Peak/Comm meter selection. */ 16000 _field_stage_t *stage_fc; /* Field stage control. */ 16001 int rv; /* Operation return status. */ 16002 16003 if ((NULL == f_pl) || (INVALIDm == meter_table) || (NULL == count)) { 16004 return (BCM_E_PARAM); 16005 } 16006 16007 /* Get stage field control structure. */ 16008 rv = _field_stage_control_get(unit, f_pl->stage_id, &stage_fc); 16009 BCM_IF_ERROR_RETURN(rv); 16010 16011 if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 16012 meter_offset = 0; 16013 } else { 16014 meter_offset = 1; 16015 } 16016 16017 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) { 16018 /* 16019 * Hw index is: 16020 * ((Pool number * pool_size) + (2 * pair number) + meter_offset) 16021 */ 16022 meter_hw_idx = (f_pl->pool_index * 16023 stage_fc->meter_pool[_FP_DEF_INST] 16024 [f_pl->pool_index]->pool_size) + \ 16025 (2 * f_pl->hw_index) + meter_offset; 16026 LOG_DEBUG(BSL_LS_BCM_FP, 16027 (BSL_META_U(unit, 16028 "FP(unit %d) vverb: pool_idx:%d pool_sz:%d pair_num:%d" 16029 " hw_idx:%d\n"), unit, f_pl->pool_index, 16030 stage_fc->meter_pool[_FP_DEF_INST] 16031 [f_pl->pool_index]->pool_size, 16032 f_pl->hw_index, 16033 meter_hw_idx)); 16034 } else { 16035 /* 16036 * Hw index is: 16037 * ((slice index) + (2 * pair number) + meter_offset) 16038 */ 16039 meter_hw_idx = stage_fc->slices[_FP_DEF_INST] 16040 [f_pl->pool_index].start_tcam_idx + \ 16041 (2 * f_pl->hw_index) + meter_offset; 16042 16043 LOG_DEBUG(BSL_LS_BCM_FP, 16044 (BSL_META_U(unit, 16045 "FP(unit %d) vverb: slice_num:%d tcam_idx:%d pair_num:%d" 16046 " hw_idx%d\n"), unit, f_pl->pool_index, 16047 stage_fc->slices[_FP_DEF_INST] 16048 [f_pl->pool_index].start_tcam_idx, 16049 f_pl->hw_index, 16050 meter_hw_idx)); 16051 } 16052 16053 if (meter_hw_idx < soc_mem_index_min(unit, meter_table) || 16054 meter_hw_idx > soc_mem_index_max(unit, meter_table)) { 16055 return (BCM_E_INTERNAL); 16056 } 16057 16058 /* Update meter config in hw. */ 16059 rv = soc_mem_read(unit, meter_table, MEM_BLOCK_ANY, 16060 meter_hw_idx, &meter_entry); 16061 16062 BCM_IF_ERROR_RETURN(rv); 16063 16064 *count = soc_mem_field32_get(unit, meter_table, 16065 &meter_entry, BUCKETCOUNTf); 16066 16067 return rv; 16068 } 16069 16070 /* 16071 * Function: 16072 * _field_trx_policer_packet_counter_hw_set 16073 * Purpose: 16074 * Reset & Get the policer token bucket parameters 16075 * Parameters: 16076 * unit - (IN) BCM device number. 16077 * f_pl - (IN) Field policer descriptor. 16078 * Count - (IN) Token bucket count. 16079 * Returns: 16080 * BCM_E_XXX 16081 */ 16082 int 16083 _field_trx_policer_packet_counter_hw_set(int unit, _field_policer_t *f_pl, 16084 soc_mem_t meter_table, 16085 uint32 count) 16086 { 16087 uint32 meter_entry[SOC_MAX_MEM_FIELD_WORDS]; /* HW entry buffer.*/ 16088 int meter_hw_idx; /* Meter table index. */ 16089 int meter_offset; /* Peak/Comm meter selection. */ 16090 _field_stage_t *stage_fc; /* Field stage control. */ 16091 int rv; /* Operation return status. */ 16092 16093 if ((NULL == f_pl) || (INVALIDm == meter_table)) { 16094 return (BCM_E_PARAM); 16095 } 16096 16097 /* Get stage field control structure. */ 16098 rv = _field_stage_control_get(unit, f_pl->stage_id, &stage_fc); 16099 BCM_IF_ERROR_RETURN(rv); 16100 16101 if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 16102 meter_offset = 0; 16103 } else { 16104 meter_offset = 1; 16105 } 16106 16107 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) { 16108 /* 16109 * Hw index is: 16110 * ((Pool number * pool_size) + (2 * pair number) + meter_offset) 16111 */ 16112 meter_hw_idx = (f_pl->pool_index * 16113 stage_fc->meter_pool[_FP_DEF_INST] 16114 [f_pl->pool_index]->pool_size) + \ 16115 (2 * f_pl->hw_index) + meter_offset; 16116 LOG_DEBUG(BSL_LS_BCM_FP, 16117 (BSL_META_U(unit, 16118 "FP(unit %d) vverb: pool_idx:%d pool_sz:%d pair_num:%d" 16119 " hw_idx:%d\n"), unit, f_pl->pool_index, 16120 stage_fc->meter_pool[_FP_DEF_INST] 16121 [f_pl->pool_index]->pool_size, 16122 f_pl->hw_index, 16123 meter_hw_idx)); 16124 } else { 16125 /* 16126 * Hw index is: 16127 * ((slice index) + (2 * pair number) + meter_offset) 16128 */ 16129 meter_hw_idx = stage_fc->slices[_FP_DEF_INST] 16130 [f_pl->pool_index].start_tcam_idx + \ 16131 (2 * f_pl->hw_index) + meter_offset; 16132 16133 LOG_DEBUG(BSL_LS_BCM_FP, 16134 (BSL_META_U(unit, 16135 "FP(unit %d) vverb: slice_num:%d tcam_idx:%d pair_num:%d" 16136 " hw_idx%d\n"), unit, f_pl->pool_index, 16137 stage_fc->slices[_FP_DEF_INST] 16138 [f_pl->pool_index].start_tcam_idx, 16139 f_pl->hw_index, 16140 meter_hw_idx)); 16141 } 16142 16143 if (meter_hw_idx < soc_mem_index_min(unit, meter_table) || 16144 meter_hw_idx > soc_mem_index_max(unit, meter_table)) { 16145 return (BCM_E_INTERNAL); 16146 } 16147 16148 /* Update meter config in hw. */ 16149 rv = soc_mem_read(unit, meter_table, MEM_BLOCK_ANY, 16150 meter_hw_idx, &meter_entry); 16151 16152 BCM_IF_ERROR_RETURN(rv); 16153 16154 soc_mem_field32_set(unit, meter_table, &meter_entry, BUCKETCOUNTf, 16155 count); 16156 16157 rv = soc_mem_write(unit, meter_table, MEM_BLOCK_ALL, 16158 meter_hw_idx, meter_entry); 16159 16160 return rv; 16161 } 16162 16163 /* 16164 * Function: 16165 * _bcm_field_trx_policer_packet_counter_get 16166 * Purpose: 16167 * Get the policer token bucket parameters 16168 * Parameters: 16169 * unit - (IN) BCM device number. 16170 * f_pl - (IN) Field policer descriptor. 16171 * count - (OUT) Packet count 16172 * Returns: 16173 * BCM_E_XXX 16174 */ 16175 int 16176 _bcm_field_trx_policer_packet_counter_get(int unit, _field_policer_t *f_pl, uint32 *count) 16177 { 16178 int rv; /* Operation return status. */ 16179 soc_mem_t meter_table_x; /* Meter table name. */ 16180 soc_mem_t meter_table_y; /* Meter table name. */ 16181 16182 /* Input parameters check. */ 16183 if ((NULL == f_pl) || (NULL == count)) { 16184 return (BCM_E_PARAM); 16185 } 16186 16187 /* Entry should not be dirty */ 16188 if (0 != (f_pl->hw_flags & _FP_POLICER_DIRTY)) { 16189 return (BCM_E_NONE); 16190 } 16191 16192 if (!((f_pl->cfg.flags & BCM_POLICER_AS_PACKET_COUNTER) && 16193 (f_pl->cfg.mode == bcmPolicerModeCommitted) && 16194 (SOC_IS_KATANA2(unit)))) { 16195 return (BCM_E_PARAM); 16196 } 16197 16198 if (_BCM_FIELD_STAGE_EGRESS != f_pl->stage_id) { 16199 return (BCM_E_PARAM); 16200 } 16201 16202 /* Resolve meter table name. */ 16203 rv = _field_trx_meter_table_get(unit, f_pl->stage_id, 16204 &meter_table_x, &meter_table_y); 16205 16206 BCM_IF_ERROR_RETURN(rv); 16207 16208 /* For Katana2 EFP only Meter x is valid*/ 16209 /* Programm policer parameters from hw. */ 16210 rv = _field_trx_policer_packet_counter_hw_get(unit, f_pl, 16211 meter_table_x, count); 16212 16213 return rv; 16214 } 16215 16216 /* 16217 * Function: 16218 * _bcm_field_trx_policer_packet_reset_counter_get 16219 * Purpose: 16220 * Reset & Get the policer token bucket parameters 16221 * Parameters: 16222 * unit - (IN) BCM device number. 16223 * f_pl - (IN) Field policer descriptor. 16224 * count - (OUT) Packet count 16225 * Returns: 16226 * BCM_E_XXX 16227 */ 16228 int 16229 _bcm_field_trx_policer_packet_reset_counter_get(int unit, _field_policer_t *f_pl, uint32 *count) 16230 { 16231 int rv; /* Operation return status. */ 16232 soc_mem_t meter_table_x; /* Meter table name. */ 16233 soc_mem_t meter_table_y; /* Meter table name. */ 16234 16235 /* Input parameters check. */ 16236 if ((NULL == f_pl) || (NULL == count)) { 16237 return (BCM_E_PARAM); 16238 } 16239 16240 /* Entry is not dirty */ 16241 if (0 != (f_pl->hw_flags & _FP_POLICER_DIRTY)) { 16242 return (BCM_E_NONE); 16243 } 16244 16245 if (!((f_pl->cfg.flags & BCM_POLICER_AS_PACKET_COUNTER) && 16246 (f_pl->cfg.mode == bcmPolicerModeCommitted) && 16247 (SOC_IS_KATANA2(unit)))) { 16248 return (BCM_E_PARAM); 16249 } 16250 16251 if (_BCM_FIELD_STAGE_EGRESS != f_pl->stage_id) { 16252 return (BCM_E_PARAM); 16253 } 16254 16255 /* Resolve meter table name. */ 16256 rv = _field_trx_meter_table_get(unit, f_pl->stage_id, 16257 &meter_table_x, &meter_table_y); 16258 BCM_IF_ERROR_RETURN(rv); 16259 16260 /* For Katana2 EFP only Meter x is valid*/ 16261 /* Programm policer parameters into hw. */ 16262 *count = 0xfff0000; 16263 rv = _field_trx_policer_packet_counter_hw_set(unit, f_pl, 16264 meter_table_x, *count); 16265 return rv; 16266 } 16267 16268 /* 16269 * Function: 16270 * _bcm_field_trx_stat_index_get 16271 * Purpose: 16272 * Get hw indexes and flags needed to compose requested statistic. 16273 * 16274 * Parameters: 16275 * unit - (IN) BCM device number. 16276 * f_st - (IN) Field statistics entity. 16277 * stat - (IN) Counter type. 16278 * idx1 - (OUT) Primary counter index. 16279 * idx2 - (OUT) Secondary counter index. 16280 * out_flags - (OUT) Counter flags. 16281 * Returns: 16282 * BCM_E_XXX 16283 */ 16284 int 16285 _bcm_field_trx_stat_index_get(int unit, _field_stat_t *f_st, 16286 bcm_field_stat_t stat, 16287 int *idx1, int *idx2, int *idx3, uint32 *out_flags) 16288 { 16289 _field_stage_t *stage_fc; /* Stage field control structure. */ 16290 int rv; /* Operation return status. */ 16291 uint32 flags = 0; /* _FP_STAT_XXX flags. */ 16292 uint32 counter_tbl_idx; /* Counter table index. */ 16293 int index1 = _FP_INVALID_INDEX; 16294 int index2 = _FP_INVALID_INDEX; 16295 #if defined(BCM_TRIDENT_SUPPORT) 16296 int lower_cntr_mode = 0; 16297 int upper_cntr_mode = 0; 16298 #endif 16299 16300 /* Input parameters check. */ 16301 if ((NULL == idx1) || (NULL == idx2) || 16302 (NULL == out_flags) || (NULL == f_st)) { 16303 return (BCM_E_PARAM); 16304 } 16305 16306 /* Initialization. */ 16307 *idx1 = *idx2 = *idx3 = _FP_INVALID_INDEX; 16308 16309 /* Get stage field control structure. */ 16310 rv = _field_stage_control_get(unit, f_st->stage_id, &stage_fc); 16311 BCM_IF_ERROR_RETURN(rv); 16312 16313 #if defined (BCM_TRIUMPH_SUPPORT) 16314 /* External stage counter index translation. */ 16315 if (_BCM_FIELD_STAGE_EXTERNAL == f_st->stage_id) { 16316 rv = _bcm_field_tr_external_counter_idx_get(unit, f_st->pool_index, 16317 f_st->hw_index, idx1); 16318 switch (stat) { 16319 case bcmFieldStatBytes: 16320 case bcmFieldStatGreenBytes: 16321 case bcmFieldStatYellowBytes: 16322 case bcmFieldStatRedBytes: 16323 case bcmFieldStatNotGreenBytes: 16324 case bcmFieldStatNotYellowBytes: 16325 case bcmFieldStatNotRedBytes: 16326 flags |= _FP_STAT_BYTES; 16327 break; 16328 default: 16329 break; 16330 } 16331 *out_flags = flags; 16332 return (rv); 16333 } 16334 #endif /* BCM_TRIUMPH_SUPPORT */ 16335 16336 /* Stat entity indexes are adjusted for policy table counter pairs. */ 16337 counter_tbl_idx = f_st->hw_index << 1; 16338 16339 #if defined(BCM_TRIDENT_SUPPORT) || defined(BCM_KATANA_SUPPORT) 16340 if ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) && 16341 (f_st->stage_id == _BCM_FIELD_STAGE_INGRESS)) { 16342 16343 lower_cntr_mode = (f_st->hw_mode & 0x7); 16344 upper_cntr_mode = ((f_st->hw_mode & (0x7 << 3)) >> 3); 16345 switch ((int)stat) { 16346 case bcmFieldStatGreenBytes: 16347 flags |= _FP_STAT_BYTES; 16348 case bcmFieldStatGreenPackets: 16349 if (upper_cntr_mode & 0x1) { 16350 index1 = counter_tbl_idx + 1; 16351 } else if (lower_cntr_mode & 0x1) { 16352 index1 = counter_tbl_idx; 16353 } else { 16354 return BCM_E_INTERNAL; 16355 } 16356 break; 16357 16358 case bcmFieldStatYellowBytes: 16359 flags |= _FP_STAT_BYTES; 16360 case bcmFieldStatYellowPackets: 16361 if (upper_cntr_mode & 0x2) { 16362 index1 = counter_tbl_idx + 1; 16363 } else if (lower_cntr_mode & 0x2) { 16364 index1 = counter_tbl_idx; 16365 } else { 16366 return BCM_E_INTERNAL; 16367 } 16368 break; 16369 16370 case bcmFieldStatRedBytes: 16371 flags |= _FP_STAT_BYTES; 16372 case bcmFieldStatRedPackets: 16373 if (upper_cntr_mode & 0x4) { 16374 index1 = counter_tbl_idx + 1; 16375 } else if (lower_cntr_mode & 0x4) { 16376 index1 = counter_tbl_idx; 16377 } else { 16378 return BCM_E_INTERNAL; 16379 } 16380 break; 16381 16382 case bcmFieldStatNotGreenBytes: 16383 flags |= _FP_STAT_BYTES; 16384 case bcmFieldStatNotGreenPackets: 16385 if (upper_cntr_mode & 0x6) { 16386 index1 = counter_tbl_idx + 1; 16387 } else if (((upper_cntr_mode & 0x6) == 0) || 16388 (upper_cntr_mode & 0x1)) { 16389 switch (lower_cntr_mode) { 16390 case 0x2: 16391 case 0x4: 16392 case 0x6: 16393 index1 = counter_tbl_idx; 16394 break; 16395 default: 16396 return BCM_E_INTERNAL; 16397 } 16398 } else if (((upper_cntr_mode & 0x2) && (lower_cntr_mode & 0x4)) || 16399 ((upper_cntr_mode & 0x4) && (lower_cntr_mode & 0x2))) { 16400 index1 = counter_tbl_idx; 16401 index2 = counter_tbl_idx + 1; 16402 flags = _FP_STAT_ADD; 16403 } else if ((lower_cntr_mode & 0x6) == 0) { 16404 switch (upper_cntr_mode) { 16405 case 0x2: 16406 case 0x4: 16407 case 0x6: 16408 index1 = counter_tbl_idx + 1; 16409 break; 16410 default: 16411 return BCM_E_INTERNAL; 16412 } 16413 } else { 16414 return BCM_E_INTERNAL; 16415 } 16416 break; 16417 16418 case bcmFieldStatNotYellowBytes: 16419 flags |= _FP_STAT_BYTES; 16420 case bcmFieldStatNotYellowPackets: 16421 if (upper_cntr_mode & 0x5) { 16422 index1 = counter_tbl_idx + 1; 16423 } else if (((upper_cntr_mode & 0x5) == 0) || 16424 ((upper_cntr_mode & 0x2))) { 16425 switch (lower_cntr_mode) { 16426 case 0x1: 16427 case 0x4: 16428 case 0x5: 16429 index1 = counter_tbl_idx; 16430 break; 16431 default: 16432 return BCM_E_INTERNAL; 16433 } 16434 } else if (((upper_cntr_mode & 0x1) && (lower_cntr_mode & 0x4)) || 16435 ((upper_cntr_mode & 0x4) && (lower_cntr_mode & 0x1))) { 16436 index1 = counter_tbl_idx; 16437 index2 = counter_tbl_idx + 1; 16438 flags = _FP_STAT_ADD; 16439 } else if ((lower_cntr_mode & 0x5) == 0) { 16440 switch (upper_cntr_mode) { 16441 case 0x1: 16442 case 0x4: 16443 case 0x5: 16444 index1 = counter_tbl_idx + 1; 16445 break; 16446 default: 16447 return BCM_E_INTERNAL; 16448 } 16449 } else { 16450 return BCM_E_INTERNAL; 16451 } 16452 break; 16453 16454 case bcmFieldStatNotRedBytes: 16455 flags |= _FP_STAT_BYTES; 16456 case bcmFieldStatNotRedPackets: 16457 if (upper_cntr_mode & 0x3) { 16458 index1 = counter_tbl_idx + 1; 16459 } else if (((upper_cntr_mode & 0x3) == 0) || 16460 ((upper_cntr_mode & 0x4))) { 16461 switch (lower_cntr_mode) { 16462 case 0x1: 16463 case 0x2: 16464 case 0x3: 16465 index1 = counter_tbl_idx; 16466 break; 16467 default: 16468 return BCM_E_INTERNAL; 16469 } 16470 } else if (((upper_cntr_mode & 0x1) && (lower_cntr_mode & 0x2)) || 16471 ((upper_cntr_mode & 0x2) && (lower_cntr_mode & 0x1))) { 16472 index1 = counter_tbl_idx; 16473 index2 = counter_tbl_idx + 1; 16474 flags = _FP_STAT_ADD; 16475 } else if ((lower_cntr_mode & 0x3) == 0) { 16476 switch (upper_cntr_mode) { 16477 case 0x1: 16478 case 0x2: 16479 case 0x3: 16480 index1 = counter_tbl_idx + 1; 16481 break; 16482 default: 16483 return BCM_E_INTERNAL; 16484 } 16485 } else { 16486 return BCM_E_INTERNAL; 16487 } 16488 break; 16489 16490 case bcmFieldStatBytes: 16491 flags |= _FP_STAT_BYTES; 16492 case bcmFieldStatPackets: 16493 if ((lower_cntr_mode ^ upper_cntr_mode) && 16494 ((lower_cntr_mode != 0) && 16495 (upper_cntr_mode != 0))) { 16496 index1 = counter_tbl_idx; 16497 index2 = counter_tbl_idx + 1; 16498 flags = _FP_STAT_ADD; 16499 } else if (upper_cntr_mode && 16500 (lower_cntr_mode & 0x7) == 0) { 16501 index1 = counter_tbl_idx + 1; 16502 } else if (upper_cntr_mode == 0 && lower_cntr_mode) { 16503 index1 = counter_tbl_idx; 16504 } else if ((lower_cntr_mode == 0x7) && 16505 (upper_cntr_mode == 0x7)) { 16506 index1 = counter_tbl_idx + 1; 16507 } else { 16508 return BCM_E_INTERNAL; 16509 } 16510 break; 16511 16512 16513 default: 16514 return (BCM_E_INTERNAL); 16515 } 16516 } else 16517 #endif /* BCM_TRIDENT_SUPPORT || BCM_KATANA_SUPPORT*/ 16518 { 16519 switch ((int)stat) { 16520 case bcmFieldStatBytes: 16521 flags |= _FP_STAT_BYTES; 16522 case bcmFieldStatPackets: 16523 switch (f_st->hw_mode) { 16524 case (0x2): 16525 index1 = counter_tbl_idx + 1; 16526 break; 16527 case (0x1): 16528 index1 = counter_tbl_idx; 16529 break; 16530 default: 16531 return (BCM_E_INTERNAL); 16532 } 16533 break; 16534 case bcmFieldStatGreenBytes: 16535 flags |= _FP_STAT_BYTES; 16536 case bcmFieldStatGreenPackets: 16537 index1 = counter_tbl_idx + 1; 16538 break; 16539 16540 case bcmFieldStatYellowBytes: 16541 flags |= _FP_STAT_BYTES; 16542 case bcmFieldStatYellowPackets: 16543 index1 = counter_tbl_idx; 16544 break; 16545 16546 case bcmFieldStatRedBytes: 16547 flags |= _FP_STAT_BYTES; 16548 case bcmFieldStatRedPackets: 16549 switch (f_st->hw_mode) { 16550 case 0x3: 16551 case 0x7: 16552 index1 = counter_tbl_idx + 1; 16553 break; 16554 case 0x5: 16555 index1 = counter_tbl_idx; 16556 break; 16557 default: 16558 return (BCM_E_INTERNAL); 16559 } 16560 break; 16561 16562 case bcmFieldStatNotGreenBytes: 16563 flags |= _FP_STAT_BYTES; 16564 case bcmFieldStatNotGreenPackets: 16565 switch (f_st->hw_mode) { 16566 case 0x4: 16567 index1 = counter_tbl_idx; 16568 break; 16569 case 0x7: 16570 index1 = counter_tbl_idx; 16571 index2 = counter_tbl_idx + 1; 16572 flags |= _FP_STAT_ADD; 16573 break; 16574 default: 16575 return (BCM_E_INTERNAL); 16576 } 16577 break; 16578 16579 case bcmFieldStatNotYellowBytes: 16580 flags |= _FP_STAT_BYTES; 16581 case bcmFieldStatNotYellowPackets: 16582 switch (f_st->hw_mode) { 16583 case 0x5: 16584 index1 = counter_tbl_idx; 16585 index2 = counter_tbl_idx + 1; 16586 flags |= _FP_STAT_ADD; 16587 break; 16588 default: 16589 return (BCM_E_INTERNAL); 16590 } 16591 break; 16592 16593 case bcmFieldStatNotRedBytes: 16594 flags |= _FP_STAT_BYTES; 16595 case bcmFieldStatNotRedPackets: 16596 switch (f_st->hw_mode) { 16597 case (0x3): 16598 index1 = counter_tbl_idx; 16599 break; 16600 case (0x6): 16601 index1 = counter_tbl_idx; 16602 index2 = counter_tbl_idx + 1; 16603 flags |= _FP_STAT_ADD; 16604 break; 16605 default: 16606 return (BCM_E_INTERNAL); 16607 } 16608 break; 16609 default: 16610 return (BCM_E_INTERNAL); 16611 } 16612 } 16613 16614 16615 /* Calculate counter table entry index. */ 16616 if (_FP_INVALID_INDEX != index1) { 16617 if (stage_fc->flags & _FP_STAGE_GLOBAL_COUNTERS) { 16618 *idx1 = index1; 16619 } else { 16620 *idx1 = 16621 stage_fc->slices[_FP_DEF_INST][f_st->pool_index].start_tcam_idx 16622 + index1; 16623 } 16624 } else { 16625 *idx1 = _FP_INVALID_INDEX; 16626 } 16627 16628 if (_FP_INVALID_INDEX != index2) { 16629 if (stage_fc->flags & _FP_STAGE_GLOBAL_COUNTERS) { 16630 *idx2 = index2; 16631 } else { 16632 *idx2 = 16633 stage_fc->slices[_FP_DEF_INST][f_st->pool_index].start_tcam_idx 16634 + index2; 16635 } 16636 } else { 16637 *idx2 = _FP_INVALID_INDEX; 16638 } 16639 *out_flags = flags; 16640 return (BCM_E_NONE); 16641 } 16642 16643 #if defined(BCM_TRIDENT_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT) 16644 /* 16645 * Function: 16646 * _field_trx2_udf_tcam_entry_move 16647 * Purpose: 16648 * Move a single entry in udf tcam and offset tables. 16649 * Parameters: 16650 * unit - (IN) BCM device number. 16651 * data_ctrl - (IN) Data control structure. 16652 * dest - (IN) Insertion target index. 16653 * free_slot - (IN) Free slot. 16654 * Returns: 16655 * BCM_E_XXX 16656 */ 16657 STATIC int 16658 _field_trx2_udf_tcam_entry_move(int unit, 16659 _field_data_control_t *data_ctrl, 16660 int src, int dst) 16661 { 16662 uint32 hw_buf[SOC_MAX_MEM_FIELD_WORDS]; /* Buffer to read hw entry. */ 16663 int rv; /* Operation return status. */ 16664 16665 /* Input parameters check. */ 16666 if (NULL == data_ctrl) { 16667 return (BCM_E_PARAM); 16668 } 16669 16670 rv = soc_mem_read(unit, FP_UDF_OFFSETm, MEM_BLOCK_ANY, src, hw_buf); 16671 BCM_IF_ERROR_RETURN(rv); 16672 rv = soc_mem_write(unit, FP_UDF_OFFSETm, MEM_BLOCK_ALL, dst, hw_buf); 16673 BCM_IF_ERROR_RETURN(rv); 16674 rv = soc_mem_read(unit, FP_UDF_TCAMm, MEM_BLOCK_ANY, src, hw_buf); 16675 BCM_IF_ERROR_RETURN(rv); 16676 rv = soc_mem_write(unit, FP_UDF_TCAMm, MEM_BLOCK_ALL, dst, hw_buf); 16677 BCM_IF_ERROR_RETURN(rv); 16678 16679 /* Clear entries at old index. */ 16680 rv = soc_mem_write(unit, FP_UDF_OFFSETm, MEM_BLOCK_ALL, src, 16681 soc_mem_entry_null(unit, FP_UDF_OFFSETm)); 16682 BCM_IF_ERROR_RETURN(rv); 16683 16684 rv = soc_mem_write(unit, FP_UDF_TCAMm, MEM_BLOCK_ALL, src, 16685 soc_mem_entry_null(unit, FP_UDF_TCAMm)); 16686 BCM_IF_ERROR_RETURN(rv); 16687 16688 /* Update sw structure tracking entry use. */ 16689 sal_memcpy(data_ctrl->tcam_entry_arr + dst, 16690 data_ctrl->tcam_entry_arr + src, 16691 sizeof(_field_data_tcam_entry_t)); 16692 sal_memset(data_ctrl->tcam_entry_arr + src, 0, 16693 sizeof(_field_data_tcam_entry_t)); 16694 return (BCM_E_NONE); 16695 } 16696 16697 /* 16698 * Function: 16699 * _field_trx2_udf_tcam_move_down 16700 * Purpose: 16701 * Moved udf tcam entries down 16702 * Parameters: 16703 * unit - (IN) BCM device number. 16704 * data_ctrl - (IN) Data control structure. 16705 * dest - (IN) Insertion target index. 16706 * free_slot - (IN) Free slot. 16707 * Returns: 16708 * BCM_E_XXX 16709 */ 16710 STATIC int 16711 _field_trx2_udf_tcam_move_down(int unit, 16712 _field_data_control_t *data_ctrl, 16713 int dest, int free_slot) 16714 { 16715 int idx; /* Entries iterator. */ 16716 int rv; /* Operation return status. */ 16717 16718 /* Input parameters check. */ 16719 if (NULL == data_ctrl) { 16720 return (BCM_E_PARAM); 16721 } 16722 16723 for (idx = free_slot; idx < dest; idx ++) { 16724 rv = _field_trx2_udf_tcam_entry_move(unit, data_ctrl, idx + 1, idx); 16725 BCM_IF_ERROR_RETURN(rv); 16726 } 16727 return (BCM_E_NONE); 16728 } 16729 16730 /* 16731 * Function: 16732 * _field_trx2_udf_tcam_move_up 16733 * Purpose: 16734 * Moved udf tcam entries up. 16735 * Parameters: 16736 * unit - (IN) BCM device number. 16737 * data_ctrl - (IN) Data control structure. 16738 * dest - (IN) Insertion target index. 16739 * free_slot - (IN) Free slot. 16740 * Returns: 16741 * BCM_E_XXX 16742 */ 16743 STATIC int 16744 _field_trx2_udf_tcam_move_up(int unit, 16745 _field_data_control_t *data_ctrl, 16746 int dest, int free_slot) 16747 { 16748 int idx; /* Entries iterator. */ 16749 int rv; /* Operation return status. */ 16750 16751 /* Input parameters check. */ 16752 if (NULL == data_ctrl) { 16753 return (BCM_E_PARAM); 16754 } 16755 16756 for (idx = free_slot; idx > dest; idx --) { 16757 rv = _field_trx2_udf_tcam_entry_move(unit, data_ctrl, idx - 1, idx); 16758 BCM_IF_ERROR_RETURN(rv); 16759 } 16760 return (BCM_E_NONE); 16761 } 16762 16763 /* 16764 * Function: 16765 * _field_trx2_udf_tcam_entries_compare 16766 * Purpose: 16767 * To find out if a duplicate entry already exists. 16768 * Parameters: 16769 * unit - (IN) BCM device number. 16770 * hw_entry - (IN) Hardware entry. 16771 * sw_entry - (IN) Software entry to be matched. 16772 * flags_hw - (IN) Flag bits denote hadware entry details. 16773 * flags_sw - (IN) Flag bits denote software entry details. 16774 * Returns: 16775 * TRUE or FALSE 16776 */ 16777 16778 STATIC int 16779 _field_trx2_udf_tcam_entries_compare(int unit, uint32 *hw_entry, 16780 uint32 *sw_entry, uint32 flags_hw, 16781 uint32 flags_sw) 16782 { 16783 uint16 hw_etype_mask = 0; 16784 uint16 hw_etype = 0; 16785 uint16 sw_etype_mask = 0; 16786 uint16 sw_etype = 0; 16787 16788 uint32 hw_ipproto_mask = 0; 16789 uint32 hw_ipproto= 0; 16790 uint32 sw_ipproto_mask = 0; 16791 uint32 sw_ipproto= 0; 16792 16793 if (0 == (flags_hw ^ flags_sw)) { 16794 /* Ip Protocol is the higher 8 bits of the L3_FIELDSf(bits 16:23). 16795 * Check if the Hw and Sw has different IP protocol value, then 16796 * return False, to create new Hardware Index for the incoming values. 16797 */ 16798 if ((hw_ipproto_mask = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_entry, 16799 L3_FIELDS_MASKf))) { 16800 hw_ipproto = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_entry, 16801 L3_FIELDSf); 16802 } 16803 if ((sw_ipproto_mask = soc_mem_field32_get(unit, FP_UDF_TCAMm, sw_entry, 16804 L3_FIELDS_MASKf))) { 16805 sw_ipproto = soc_mem_field32_get(unit, FP_UDF_TCAMm, sw_entry, 16806 L3_FIELDSf); 16807 } 16808 16809 hw_ipproto_mask = (hw_ipproto_mask >> 16) & 0xff; 16810 hw_ipproto = (hw_ipproto >> 16) & 0xff; 16811 sw_ipproto_mask = (sw_ipproto_mask >> 16) & 0xff; 16812 sw_ipproto = (sw_ipproto >> 16) & 0xff; 16813 16814 if (hw_ipproto_mask && sw_ipproto_mask) { 16815 if ((hw_ipproto_mask & hw_ipproto) != (sw_ipproto_mask & sw_ipproto)) { 16816 return (FALSE); 16817 } 16818 } 16819 16820 if ((hw_etype_mask = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_entry, 16821 L2_ETHER_TYPE_MASKf))) { 16822 hw_etype = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_entry, 16823 L2_ETHER_TYPEf); 16824 } 16825 16826 if ((sw_etype_mask = soc_mem_field32_get(unit, FP_UDF_TCAMm, sw_entry, 16827 L2_ETHER_TYPE_MASKf))) { 16828 sw_etype = soc_mem_field32_get(unit, FP_UDF_TCAMm, sw_entry, 16829 L2_ETHER_TYPEf); 16830 } 16831 16832 /* 16833 * Perform slow protocol PDU Ethertype match. 16834 * Examples: 16835 * Case 1: 16836 * if (0x800 or 0x86DD or 0x8847 or 0x8906 or 0x8914) != (0x8809) 16837 * return FALSE; 16838 * Case 2: 16839 * if (0x8809 == 0x8809) then check VLAN Tag match. 16840 */ 16841 if ((hw_etype_mask && sw_etype_mask) 16842 && (hw_etype == 0x8809 || sw_etype == 0x8809)) { 16843 16844 /* 16845 * For Ethertype == 0x8809. 16846 * Compare number of VLAN tags in hardware entry vs new entry. 16847 */ 16848 if ((hw_etype == sw_etype) 16849 && ((flags_hw & _BCM_FIELD_USER_VLAN_MASK) 16850 == (flags_sw & _BCM_FIELD_USER_VLAN_MASK))) { 16851 16852 /* Matching entry already exists. */ 16853 return (TRUE); 16854 16855 } else { 16856 /* 16857 * Ethertype vales are not same or Number of VLAN Tags 16858 * are different. 16859 */ 16860 return (FALSE); 16861 } 16862 } 16863 if ((hw_etype_mask & hw_etype) != (sw_etype_mask & sw_etype)) { 16864 /* 16865 * Ethertype vales are not same. 16866 */ 16867 return (FALSE); 16868 } 16869 /* Matching entry already exists. */ 16870 return (TRUE); 16871 } else { 16872 /* Matching entry does not exist. */ 16873 return (FALSE); 16874 } 16875 } 16876 16877 /* 16878 * Function: 16879 * _field_trx2_udf_tcam_entry_match 16880 * Purpose: 16881 * Match tcam entry against currently instllaed ones 16882 * Parameters: 16883 * unit - (IN) BCM device number. 16884 * stage_fc - (IN) Stage field control structure. 16885 * hw_buf - (IN) Hw buffer. 16886 * tcam_idx - (IN) Allocated tcam index. 16887 * Returns: 16888 * BCM_E_XXX 16889 */ 16890 STATIC int 16891 _field_trx2_udf_tcam_entry_match(int unit, _field_stage_t *stage_fc, 16892 uint32 *hw_buf, int *tcam_idx) 16893 { 16894 uint32 *buffer; /* Hw buffer to dma udf tcam. */ 16895 uint32 *entry_ptr = 0; /* Tcam entry pointer. */ 16896 int alloc_size; /* Memory allocation size. */ 16897 int entry_size; /* Single tcam entry size. */ 16898 soc_mem_t mem; /* Udf tcam memory id. */ 16899 int idx_count; /* Tcam entry count. */ 16900 int idx; /* Tcam entries iterator. */ 16901 int rv; /* Operation return status. */ 16902 uint32 flags_hw = 0; /* UDF entry in Hw */ 16903 uint32 flags_sw = 0; /* UDF entry in Sw */ 16904 16905 /* Input parameters check. */ 16906 if ((NULL == hw_buf) || (NULL == stage_fc) || (NULL == tcam_idx)) { 16907 return (BCM_E_PARAM); 16908 } 16909 16910 mem = FP_UDF_TCAMm; 16911 idx_count = soc_mem_index_count(unit, mem); 16912 entry_size = sizeof(fp_udf_tcam_entry_t); 16913 alloc_size = entry_size * idx_count; 16914 16915 /* Allocate memory buffer. */ 16916 buffer = soc_cm_salloc(unit, alloc_size, "Udf tcam"); 16917 if (buffer == NULL) { 16918 return (BCM_E_MEMORY); 16919 } 16920 16921 sal_memset(buffer, 0, alloc_size); 16922 16923 /* Read table to the buffer. */ 16924 rv = soc_mem_read_range(unit, mem, MEM_BLOCK_ANY, 16925 soc_mem_index_min(unit, mem), 16926 soc_mem_index_max(unit, mem), buffer); 16927 if (BCM_FAILURE(rv)) { 16928 soc_cm_sfree(unit, buffer); 16929 return (BCM_E_INTERNAL); 16930 } 16931 16932 for (idx = 0; idx < idx_count; idx++) { 16933 if (stage_fc->data_ctrl->tcam_entry_arr[idx].ref_count) { 16934 entry_ptr = soc_mem_table_idx_to_pointer(unit, mem, uint32 *, 16935 buffer, idx); 16936 /* Parse entry key to udf flags. */ 16937 rv = _bcm_field_trx2_udf_tcam_entry_parse(unit, entry_ptr, 16938 &flags_hw); 16939 if (BCM_FAILURE(rv)) { 16940 soc_cm_sfree(unit, buffer); 16941 return rv; 16942 } 16943 16944 /* Parse entry key to udf flags. */ 16945 rv = _bcm_field_trx2_udf_tcam_entry_parse(unit, hw_buf, &flags_sw); 16946 if (BCM_FAILURE(rv)) { 16947 soc_cm_sfree(unit, buffer); 16948 return rv; 16949 } 16950 16951 /* 16952 * Compare hardware entry with new entry to be inserted. 16953 * If an entry already exists for this packet match format, 16954 * then return the hardware index of existing entry to increment 16955 * its reference count. 16956 */ 16957 if (_field_trx2_udf_tcam_entries_compare(unit, entry_ptr, hw_buf, 16958 flags_hw, flags_sw)) { 16959 *tcam_idx = idx; 16960 break; 16961 } 16962 } 16963 } 16964 soc_cm_sfree(unit, buffer); 16965 return (idx < idx_count) ? BCM_E_NONE : BCM_E_NOT_FOUND; 16966 } 16967 16968 /* 16969 * Function: 16970 * _field_trx2_udf_tcam_entry_insert 16971 * Purpose: 16972 * Insert udf tcam entry into the tcam. 16973 * No actual write happens in this routine 16974 * only tcam reorganization and index allocation. 16975 * SW must write FP_UDF_OFFSET table before inserting 16976 * valid tcam entry. 16977 * Parameters: 16978 * unit - (IN) BCM device number. 16979 * hw_buf - (IN) Hw buffer. 16980 * priority - (IN) Inserted rule priority. 16981 * tcam_idx - (IN) Allocated tcam index. 16982 * Returns: 16983 * BCM_E_XXX 16984 */ 16985 STATIC int 16986 _field_trx2_udf_tcam_entry_insert(int unit, uint32 *hw_buf, 16987 uint8 priority, int *tcam_idx) 16988 { 16989 _field_data_tcam_entry_t *tcam_entry_arr; /* Tcam entries array. */ 16990 _field_stage_t *stage_fc; /* Stage field contral structure. */ 16991 int unused_entry_min; /* Unused entry before the range. */ 16992 int unused_entry_max; /* Unused entry after the range. */ 16993 int range_min; /* Index min for entry insertion. */ 16994 int range_max; /* Index max for entry insertion. */ 16995 int idx_max; /* FP UDF tcam table index max. */ 16996 int idx; /* FP UDF tcam table interator. */ 16997 int rv; /* Operation return status. */ 16998 16999 /* Input parameters check. */ 17000 if (NULL == tcam_idx) { 17001 return (BCM_E_PARAM); 17002 } 17003 17004 /* Initialization. */ 17005 idx_max = soc_mem_index_max(unit, FP_UDF_TCAMm); 17006 range_min = soc_mem_index_min(unit, FP_UDF_TCAMm); 17007 range_max = idx_max; 17008 unused_entry_min = unused_entry_max = -1; 17009 17010 17011 /* Get stage field control structure. */ 17012 rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 17013 BCM_IF_ERROR_RETURN(rv); 17014 tcam_entry_arr = stage_fc->data_ctrl->tcam_entry_arr; 17015 17016 17017 /* Check if identical entry already exists. */ 17018 rv = _field_trx2_udf_tcam_entry_match(unit, stage_fc, hw_buf, tcam_idx); 17019 if (BCM_SUCCESS(rv)) { 17020 if (tcam_entry_arr[*tcam_idx].priority != priority) { 17021 return (BCM_E_RESOURCE); 17022 } 17023 tcam_entry_arr[*tcam_idx].ref_count++; 17024 return (BCM_E_NONE); 17025 } else if (rv != BCM_E_NOT_FOUND) { 17026 return (rv); 17027 } 17028 17029 /* No identical entry found try to allocate an unused entry and 17030 * reshuffle tcam if necessary to organize entries by priority. 17031 */ 17032 for (idx = 0; idx <= idx_max; idx++) { 17033 if (0 == stage_fc->data_ctrl->tcam_entry_arr[idx].ref_count) { 17034 if (idx <= range_max) { 17035 /* Any free index below range max can be used for insertion. */ 17036 unused_entry_min = idx; 17037 } else { 17038 /* There is no point to continue after first 17039 * free index above range max. 17040 */ 17041 unused_entry_max = idx; 17042 break; 17043 } 17044 continue; 17045 } 17046 /* Identify insertion range. */ 17047 if (tcam_entry_arr[idx].priority > priority) { 17048 range_min = idx; 17049 } else if (tcam_entry_arr[idx].priority < priority) { 17050 if (idx < range_max) { 17051 range_max = idx; 17052 } 17053 } 17054 } 17055 17056 /* Check if tcam is completely full. */ 17057 if ((unused_entry_min == -1) && (unused_entry_max == -1)) { 17058 return (BCM_E_FULL); 17059 } 17060 17061 /* Tcam entries shuffling. */ 17062 if (unused_entry_min > range_min) { 17063 *tcam_idx = unused_entry_min; 17064 } else if (unused_entry_min == -1) { 17065 rv = _field_trx2_udf_tcam_move_up(unit, stage_fc->data_ctrl, 17066 range_max, unused_entry_max); 17067 17068 BCM_IF_ERROR_RETURN(rv); 17069 *tcam_idx = range_max; 17070 } else if (unused_entry_max == -1) { 17071 rv = _field_trx2_udf_tcam_move_down(unit, stage_fc->data_ctrl, 17072 range_min, unused_entry_min); 17073 BCM_IF_ERROR_RETURN(rv); 17074 *tcam_idx = range_min; 17075 } else if ((range_min - unused_entry_min) > 17076 (unused_entry_max - range_max)) { 17077 rv = _field_trx2_udf_tcam_move_up(unit, stage_fc->data_ctrl, 17078 range_max, unused_entry_max); 17079 BCM_IF_ERROR_RETURN(rv); 17080 *tcam_idx = range_max; 17081 } else { 17082 rv = _field_trx2_udf_tcam_move_down(unit, stage_fc->data_ctrl, 17083 range_min, unused_entry_min); 17084 BCM_IF_ERROR_RETURN(rv); 17085 *tcam_idx = range_min; 17086 } 17087 17088 /* Index was successfully allocated. */ 17089 tcam_entry_arr[*tcam_idx].ref_count = 1; 17090 tcam_entry_arr[*tcam_idx].priority = priority; 17091 return (BCM_E_NONE); 17092 } 17093 17094 /* 17095 * Function: 17096 * _field_trx2_udf_offset_entry_write 17097 * Purpose: 17098 * Write the udf offsets to FP_UDF_OFFSETm 17099 * Parameters: 17100 * unit - (IN) BCM device number. 17101 * flag - (IN) TRUE for delete, FALSE for others 17102 * entry_idx - (IN) Entry index in FP_UDF_OFFSETm. 17103 * udf_num - (IN) 0 for UDF1_xxx, 1 for UDF2_xxx. 17104 * user_num - (IN) 0 for UDFx_OFFSET0, 1 for UDFx_OFFSET1, ... 17105 * offset_base - (IN) Offset number base point. 17106 * offset_value - (IN) Offset word number. 17107 * Returns: 17108 * BCM_E_XXX 17109 */ 17110 STATIC int 17111 _field_trx2_udf_offset_entry_write(int unit, uint8 flag, int entry_idx, 17112 int udf_num, int user_num, 17113 bcm_field_data_offset_base_t offset_base, 17114 uint32 offset_value) 17115 { 17116 fp_udf_offset_entry_t offset_buf; /* Udf offset entry. */ 17117 int offset_base_encoding; /* Hw udf offset base encodings. */ 17118 int rv; /* Operation return status. */ 17119 17120 offset_value &= ~_BCM_FIELD_USER_OFFSET_FLAGS; 17121 17122 /* Maximum Offset value can be 63 */ 17123 if ((offset_value >= 17124 ((uint32)1 << soc_mem_field_length(unit, FP_UDF_OFFSETm, 17125 _trx2_offset_field[udf_num][user_num]))) || 17126 (offset_value > 63)) { 17127 return BCM_E_PARAM; 17128 } 17129 17130 soc_mem_field32_set(unit, FP_UDF_OFFSETm, (uint32 *)&offset_buf, 17131 _trx2_offset_field[udf_num][user_num], offset_value); 17132 17133 rv = soc_mem_read(unit, FP_UDF_OFFSETm, MEM_BLOCK_ANY, 17134 entry_idx, (uint32 *)&offset_buf); 17135 BCM_IF_ERROR_RETURN(rv); 17136 17137 /* Set udf offset base. */ 17138 switch (offset_base) { 17139 case bcmFieldDataOffsetBaseHigigHeader: 17140 case bcmFieldDataOffsetBaseHigig2Header: 17141 offset_base_encoding = 0; 17142 break; 17143 case bcmFieldDataOffsetBasePacketStart: 17144 offset_base_encoding = 1; 17145 /* Offset value 126 (2bytes). Offset value 0 pkt offset 2 */ 17146 break; 17147 case bcmFieldDataOffsetBaseTrillHeader: 17148 case bcmFieldDataOffsetBaseOuterL3Header: 17149 case bcmFieldDataOffsetBaseFcoeHeader: 17150 offset_base_encoding = 2; 17151 break; 17152 case bcmFieldDataOffsetBaseInnerL3Header: 17153 case bcmFieldDataOffsetBaseOuterL4Header: 17154 offset_base_encoding = 3; 17155 break; 17156 case bcmFieldDataOffsetBaseTrillPayload: 17157 case bcmFieldDataOffsetBaseInnerL4Header: 17158 offset_base_encoding = 4; 17159 break; 17160 default: 17161 return (BCM_E_PARAM); 17162 } 17163 17164 if (flag) { 17165 /* For delete reset value to 0*/ 17166 offset_base_encoding = 0; 17167 } 17168 17169 /* Set udf offset. */ 17170 soc_mem_field32_set(unit, FP_UDF_OFFSETm, (uint32 *)&offset_buf, 17171 _trx2_offset_field[udf_num][user_num], offset_value); 17172 soc_mem_field32_set(unit, FP_UDF_OFFSETm, (uint32 *)&offset_buf, 17173 _trx2_base_field[udf_num][user_num], 17174 offset_base_encoding); 17175 /* Write udf offset entry back to HW. */ 17176 rv = soc_mem_write(unit, FP_UDF_OFFSETm, MEM_BLOCK_ALL, 17177 entry_idx, (uint32 *)&offset_buf); 17178 return (rv); 17179 } 17180 17181 /* 17182 * Function: 17183 * _field_trx2_udf_tcam_entry_l3_parse 17184 * Purpose: 17185 * Parse udf tcam entry l3 format match key. 17186 * Parameters: 17187 * unit - (IN) BCM device number. 17188 * hw_buf - (IN) Hw buffer. 17189 * pkt_fmt - (OUT) Packet format structure. 17190 * Returns: 17191 * BCM_E_XXX 17192 */ 17193 int 17194 _field_trx2_udf_tcam_entry_l3_parse(int unit, uint32 *hw_buf, 17195 bcm_field_data_packet_format_t *pkt_fmt) 17196 { 17197 uint32 ethertype = -1; 17198 uint32 inner_iptype = -1; 17199 uint32 ethertype_mask = -1; 17200 uint32 outer_iptype = -1; 17201 uint32 outer_iptype_ip4_val = -1; 17202 uint32 outer_iptype_ip6_val = -1; 17203 uint32 outer_iptype_mask = -1; 17204 uint32 inner_iptype_mask = -1; 17205 uint32 l3fields = -1; 17206 uint32 l3fields_mask = -1; 17207 soc_mem_t mem = FP_UDF_TCAMm; 17208 uint32 iptype_none_val = 0; 17209 uint8 fc_header_encode = 0; 17210 uint8 fc_hdr_encode_mask = 0; 17211 17212 /* Input parameters check. */ 17213 if ((NULL == hw_buf) || (NULL == pkt_fmt)) { 17214 return (BCM_E_PARAM); 17215 } 17216 if (SOC_IS_TD_TT(unit) 17217 || SOC_IS_KATANAX(unit) 17218 || SOC_IS_TRIUMPH3(unit)) { 17219 iptype_none_val = 2; 17220 } 17221 17222 if ((ethertype_mask = 17223 soc_mem_field32_get(unit, mem, hw_buf, L2_ETHER_TYPE_MASKf))) { 17224 ethertype = soc_mem_field32_get(unit, mem, hw_buf, L2_ETHER_TYPEf); 17225 } 17226 17227 if ((inner_iptype_mask = 17228 soc_mem_field32_get(unit, mem, hw_buf, INNER_IP_TYPE_MASKf))) { 17229 inner_iptype = soc_mem_field32_get(unit, mem, hw_buf, INNER_IP_TYPEf); 17230 } 17231 17232 outer_iptype = soc_mem_field32_get(unit, mem, hw_buf, OUTER_IP_TYPEf); 17233 outer_iptype_mask = soc_mem_field32_get(unit, mem, 17234 hw_buf, OUTER_IP_TYPE_MASKf); 17235 17236 if ((l3fields_mask = 17237 soc_mem_field32_get(unit, mem, hw_buf, L3_FIELDS_MASKf))) { 17238 l3fields = soc_mem_field32_get(unit, mem, hw_buf, L3_FIELDSf); 17239 } else if (0x8847 == ethertype) { 17240 /* MPLS_ANY has L3_FIELDSf == 0 */ 17241 l3fields = soc_mem_field32_get(unit, mem, hw_buf, L3_FIELDSf); 17242 } 17243 17244 outer_iptype_ip4_val = 2; 17245 outer_iptype_ip6_val = 4; 17246 #if defined(BCM_TRIDENT_SUPPORT) 17247 if (SOC_IS_TRIUMPH3(unit) 17248 || SOC_IS_TD_TT(unit)) { 17249 outer_iptype_ip4_val = 1; 17250 outer_iptype_ip6_val = 5; 17251 } 17252 #endif 17253 17254 /* 17255 * Logic below implicitly checks Ethertype value for IP, MPLS and FCoE 17256 * frames. 17257 * 0x0800 - IPv4, 0x86DD - IPv6, 0x8847 - MPLS , 0x8906 + 0x8914 - FCoE 17258 */ 17259 17260 if ((ethertype == 0x800) && (outer_iptype == outer_iptype_ip4_val)) { 17261 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_NONE; 17262 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP4_WITH_OPTIONS; 17263 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP_NONE; 17264 } else if ((ethertype == 0x86dd) && 17265 (outer_iptype == outer_iptype_ip6_val)) { 17266 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_NONE; 17267 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP6_WITH_OPTIONS; 17268 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP_NONE; 17269 } else if ((ethertype == 0x800) && (inner_iptype == iptype_none_val)) { 17270 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_NONE; 17271 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP4; 17272 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP_NONE; 17273 } else if ((ethertype == 0x86dd) && (inner_iptype == iptype_none_val)) { 17274 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_NONE; 17275 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP6; 17276 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP_NONE; 17277 } else if ((ethertype == 0x800) && (l3fields == 0x40000)) { 17278 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_IP_IN_IP; 17279 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP4; 17280 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP4; 17281 } else if ((ethertype == 0x800) && (l3fields == 0x290000)) { 17282 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_IP_IN_IP; 17283 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP4; 17284 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP6; 17285 } else if ((ethertype == 0x86dd) && (l3fields == 0x40000)) { 17286 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_IP_IN_IP; 17287 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP6; 17288 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP4; 17289 } else if ((ethertype == 0x86dd) && (l3fields == 0x290000)) { 17290 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_IP_IN_IP; 17291 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP6; 17292 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP6; 17293 } else if ((ethertype == 0x800) && (l3fields == 0x2f0800)) { 17294 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_GRE; 17295 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP4; 17296 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP4; 17297 } else if ((ethertype == 0x800) && (l3fields == 0x2f86dd)) { 17298 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_GRE; 17299 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP4; 17300 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP6; 17301 } else if ((ethertype == 0x86dd) && (l3fields == 0x2f0800)) { 17302 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_GRE; 17303 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP6; 17304 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP4; 17305 } else if ((ethertype == 0x86dd) && (l3fields == 0x2f86dd)) { 17306 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_GRE; 17307 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP6; 17308 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP6; 17309 } else if ((ethertype == 0x8847) && (l3fields == 0x1)) { 17310 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_MPLS; 17311 pkt_fmt->mpls = BCM_FIELD_DATA_FORMAT_MPLS_ONE_LABEL; 17312 } else if ((ethertype == 0x8847) && (l3fields == 0x2)) { 17313 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_MPLS; 17314 pkt_fmt->mpls = BCM_FIELD_DATA_FORMAT_MPLS_TWO_LABELS; 17315 } else if ((ethertype == 0x8847) && (l3fields == 0x3)) { 17316 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_MPLS; 17317 pkt_fmt->mpls = BCM_FIELD_DATA_FORMAT_MPLS_THREE_LABELS; 17318 } else if ((ethertype == 0x8847) && (l3fields == 0x4)) { 17319 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_MPLS; 17320 pkt_fmt->mpls = BCM_FIELD_DATA_FORMAT_MPLS_FOUR_LABELS; 17321 } else if ((ethertype == 0x8847) && (l3fields == 0x5)) { 17322 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_MPLS; 17323 pkt_fmt->mpls = BCM_FIELD_DATA_FORMAT_MPLS_FIVE_LABELS; 17324 } else if ((ethertype == 0x8847) && (l3fields == 0x0)) { 17325 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_MPLS; 17326 pkt_fmt->mpls = BCM_FIELD_DATA_FORMAT_MPLS_ANY; 17327 } else if (ethertype == 0x8906 || ethertype == 0x8914) { 17328 pkt_fmt->tunnel = (ethertype == 0x8906) 17329 ? BCM_FIELD_DATA_FORMAT_TUNNEL_FCOE 17330 : BCM_FIELD_DATA_FORMAT_TUNNEL_FCOE_INIT; 17331 17332 17333 fc_header_encode = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, 17334 FC_HDR_ENCODE_1f); 17335 fc_hdr_encode_mask = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, 17336 FC_HDR_ENCODE_1_MASKf); 17337 17338 17339 switch (fc_header_encode & fc_hdr_encode_mask) { 17340 case 0: 17341 pkt_fmt->fibre_chan_outer 17342 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY; 17343 break; 17344 case 1: 17345 pkt_fmt->fibre_chan_outer 17346 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN; 17347 break; 17348 case 2: 17349 pkt_fmt->fibre_chan_outer 17350 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_VIRTUAL; 17351 break; 17352 case 3: 17353 pkt_fmt->fibre_chan_outer 17354 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ENCAP; 17355 break; 17356 case 4: 17357 pkt_fmt->fibre_chan_outer 17358 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ROUTED; 17359 break; 17360 default: 17361 return (BCM_E_INTERNAL); 17362 } 17363 17364 fc_header_encode = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, 17365 FC_HDR_ENCODE_2f); 17366 fc_hdr_encode_mask = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, 17367 FC_HDR_ENCODE_2_MASKf); 17368 17369 17370 switch (fc_header_encode & fc_hdr_encode_mask) { 17371 case 0: 17372 pkt_fmt->fibre_chan_inner 17373 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY; 17374 break; 17375 case 1: 17376 pkt_fmt->fibre_chan_inner 17377 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN; 17378 break; 17379 case 2: 17380 pkt_fmt->fibre_chan_inner 17381 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_VIRTUAL; 17382 break; 17383 case 3: 17384 pkt_fmt->fibre_chan_inner 17385 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ENCAP; 17386 break; 17387 case 4: 17388 pkt_fmt->fibre_chan_inner 17389 = BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ROUTED; 17390 break; 17391 default: 17392 return (BCM_E_INTERNAL); 17393 } 17394 } else if (outer_iptype_mask == 0x7) { 17395 /* 17396 * For Non-IP traffic: OUTER_IP_TYPE_MASK = 0x7 and 17397 * OUTER_IP_TYPE = 0 (TR2) or 2 (Trident, Katana). 17398 */ 17399 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_NONE; 17400 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP_NONE; 17401 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP_NONE; 17402 } else if (0x0 == ethertype_mask && 0x0 == inner_iptype_mask 17403 && 0x0 == outer_iptype_mask && 0x0 == l3fields_mask) { 17404 /* 17405 * Do not care about IP headers and Tunnel Type. 17406 */ 17407 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_ANY; 17408 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP_ANY; 17409 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP_ANY; 17410 } else if ((outer_iptype_mask == 0x0) && 17411 (inner_iptype_mask == 0x7)){ 17412 /* 17413 * Do not care about Outer IP. Inner IP is not valid 17414 * as its not a Tunnel. 17415 */ 17416 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_NONE; 17417 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP_ANY; 17418 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP_ANY; 17419 } else if (((0xffff == ethertype_mask) || 17420 (0xff0000 == l3fields_mask)) && 17421 (outer_iptype_mask == 0x0 && 17422 inner_iptype_mask == 0x0)) { 17423 /* since l3_init is not done in UDF 17424 bcm_field_data_qualifier_ip_protocol_add() 17425 bcm_field_data_qualifier_ethertype_add(). 17426 Just a place holder to detect UDF 17427 bcm_field_data_qualifier_packet_format_add() */ 17428 pkt_fmt->tunnel = BCM_FIELD_DATA_FORMAT_TUNNEL_NONE; 17429 pkt_fmt->outer_ip = BCM_FIELD_DATA_FORMAT_IP_ANY; 17430 pkt_fmt->inner_ip = BCM_FIELD_DATA_FORMAT_IP_NONE; 17431 } else { 17432 return (BCM_E_INTERNAL); 17433 } 17434 17435 return (BCM_E_NONE); 17436 } 17437 17438 /* 17439 * Function: 17440 * _field_trx2_udf_tcam_entry_l3_init 17441 * Purpose: 17442 * Initialize udf tcam entry l2 format match key. 17443 * Parameters: 17444 * unit - (IN) BCM device number. 17445 * pkt_fmt - (IN) Packet format structure. 17446 * hw_buf - (IN/OUT) Hw buffer. 17447 * priority - (IN/OUT) udf tcam entry priority. 17448 * Returns: 17449 * BCM_E_XXX 17450 */ 17451 STATIC int 17452 _field_trx2_udf_tcam_entry_l3_init(int unit, 17453 bcm_field_data_packet_format_t *pkt_fmt, 17454 uint32 *hw_buf, uint8 *priority) 17455 { 17456 int key; 17457 int mask; 17458 uint32 iptype_none_val = 0; 17459 uint32 outer_iptype_ip4_val = 0; 17460 uint32 outer_iptype_ip6_val = 0; 17461 17462 /* Input parameters check. */ 17463 if ((NULL == hw_buf) || (NULL == priority)) { 17464 return (BCM_E_PARAM); 17465 } 17466 17467 if (SOC_IS_TD_TT(unit) 17468 || SOC_IS_KATANAX(unit) 17469 || SOC_IS_TRIUMPH3(unit)) { 17470 iptype_none_val = 2; 17471 } 17472 17473 outer_iptype_ip4_val = 2; 17474 outer_iptype_ip6_val = 4; 17475 #if defined(BCM_TRIDENT_SUPPORT) 17476 if (SOC_IS_TRIUMPH3(unit) 17477 || SOC_IS_TD_TT(unit)) { 17478 outer_iptype_ip4_val = 1; 17479 outer_iptype_ip6_val = 5; 17480 } 17481 #endif 17482 17483 if (pkt_fmt->tunnel == BCM_FIELD_DATA_FORMAT_TUNNEL_NONE) { 17484 17485 *priority += _FP_DATA_QUALIFIER_PRIO_L3_FORMAT; 17486 /* inner ip type (none). */ 17487 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17488 INNER_IP_TYPEf, iptype_none_val); 17489 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17490 INNER_IP_TYPE_MASKf, 0x7); 17491 17492 if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP4_WITH_OPTIONS) { 17493 /* L2 ether type 0x800 */ 17494 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17495 L2_ETHER_TYPEf, 0x800); 17496 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17497 L2_ETHER_TYPE_MASKf, 0xffff); 17498 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17499 OUTER_IP_TYPEf, outer_iptype_ip4_val); 17500 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17501 OUTER_IP_TYPE_MASKf, 0x7); 17502 } else if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP6_WITH_OPTIONS) { 17503 /* L2 ether type 0x86dd */ 17504 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17505 L2_ETHER_TYPEf, 0x86dd); 17506 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17507 L2_ETHER_TYPE_MASKf, 0xffff); 17508 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17509 OUTER_IP_TYPEf, outer_iptype_ip6_val); 17510 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17511 OUTER_IP_TYPE_MASKf, 0x7); 17512 } else if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP4) { 17513 /* L2 ether type 0x800 */ 17514 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17515 L2_ETHER_TYPEf, 0x800); 17516 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17517 L2_ETHER_TYPE_MASKf, 0xffff); 17518 } else if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP6) { 17519 /* L2 ether type 0x86dd */ 17520 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17521 L2_ETHER_TYPEf, 0x86dd); 17522 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17523 L2_ETHER_TYPE_MASKf, 0xffff); 17524 } else if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP_NONE) { 17525 /* Non IP traffic only */ 17526 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17527 OUTER_IP_TYPEf, iptype_none_val); 17528 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17529 OUTER_IP_TYPE_MASKf, 0x7); 17530 } else { 17531 /* Outer ip type don't care */ 17532 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17533 OUTER_IP_TYPE_MASKf, 0x0); 17534 } 17535 } else if (pkt_fmt->tunnel == BCM_FIELD_DATA_FORMAT_TUNNEL_IP_IN_IP) { 17536 *priority += _FP_DATA_QUALIFIER_PRIO_L3_FORMAT; 17537 if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP4) { 17538 /* L2 ether type 0x800 */ 17539 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17540 L2_ETHER_TYPEf, 0x800); 17541 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17542 L2_ETHER_TYPE_MASKf, 0xffff); 17543 17544 if (pkt_fmt->inner_ip == BCM_FIELD_DATA_FORMAT_IP4) { 17545 /* Inner ip protocol v4. */ 17546 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17547 L3_FIELDSf, 0x40000); 17548 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17549 L3_FIELDS_MASKf, 0xff0000); 17550 } else if (pkt_fmt->inner_ip == BCM_FIELD_DATA_FORMAT_IP6) { 17551 /* Inner ip protocol v6. */ 17552 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17553 L3_FIELDSf, 0x290000); 17554 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17555 L3_FIELDS_MASKf, 0xff0000); 17556 } else { 17557 return (BCM_E_UNAVAIL); 17558 } 17559 } else if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP6) { 17560 /* L2 ether type 0x86dd */ 17561 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17562 L2_ETHER_TYPEf, 0x86dd); 17563 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17564 L2_ETHER_TYPE_MASKf, 0xffff); 17565 17566 if (pkt_fmt->inner_ip == BCM_FIELD_DATA_FORMAT_IP4) { 17567 /* Inner ip protocol v4. */ 17568 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17569 L3_FIELDSf, 0x40000); 17570 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17571 L3_FIELDS_MASKf, 0xff0000); 17572 } else if (pkt_fmt->inner_ip == BCM_FIELD_DATA_FORMAT_IP6) { 17573 /* Inner ip protocol v6. */ 17574 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17575 L3_FIELDSf, 0x290000); 17576 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17577 L3_FIELDS_MASKf, 0xff0000); 17578 } else { 17579 return (BCM_E_UNAVAIL); 17580 } 17581 } else { 17582 return (BCM_E_UNAVAIL); 17583 } 17584 } else if (pkt_fmt->tunnel == BCM_FIELD_DATA_FORMAT_TUNNEL_GRE) { 17585 17586 *priority += _FP_DATA_QUALIFIER_PRIO_L3_FORMAT; 17587 if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP4) { 17588 /* L2 ether type 0x800 */ 17589 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17590 L2_ETHER_TYPEf, 0x800); 17591 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17592 L2_ETHER_TYPE_MASKf, 0xffff); 17593 17594 if (pkt_fmt->inner_ip == BCM_FIELD_DATA_FORMAT_IP4) { 17595 /* Inner ip protocol gre, gre ethertype 0x800. */ 17596 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17597 L3_FIELDSf, 0x02f0800); 17598 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17599 L3_FIELDS_MASKf, 0xffffff); 17600 } else if (pkt_fmt->inner_ip == BCM_FIELD_DATA_FORMAT_IP6) { 17601 /* Inner ip protocol gre, gre ethertype 0x86dd. */ 17602 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17603 L3_FIELDSf, 0x02f86dd); 17604 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17605 L3_FIELDS_MASKf, 0xffffff); 17606 } else { 17607 return (BCM_E_UNAVAIL); 17608 } 17609 } else if (pkt_fmt->outer_ip == BCM_FIELD_DATA_FORMAT_IP6) { 17610 /* L2 ether type 0x86dd */ 17611 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17612 L2_ETHER_TYPEf, 0x86dd); 17613 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17614 L2_ETHER_TYPE_MASKf, 0xffff); 17615 17616 if (pkt_fmt->inner_ip == BCM_FIELD_DATA_FORMAT_IP4) { 17617 /* Inner ip protocol gre, gre ethertype 0x800. */ 17618 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17619 L3_FIELDSf, 0x02f0800); 17620 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17621 L3_FIELDS_MASKf, 0xffffff); 17622 } else if (pkt_fmt->inner_ip == BCM_FIELD_DATA_FORMAT_IP6) { 17623 /* Inner ip protocol gre, gre ethertype 0x86dd. */ 17624 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17625 L3_FIELDSf, 0x02f86dd); 17626 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17627 L3_FIELDS_MASKf, 0xffffff); 17628 } else { 17629 return (BCM_E_UNAVAIL); 17630 } 17631 } else { 17632 return (BCM_E_UNAVAIL); 17633 } 17634 } else if (pkt_fmt->tunnel == BCM_FIELD_DATA_FORMAT_TUNNEL_MPLS) { 17635 17636 *priority += _FP_DATA_QUALIFIER_PRIO_MPLS_FORMAT; 17637 17638 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17639 L2_ETHER_TYPEf, 0x8847); 17640 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17641 L2_ETHER_TYPE_MASKf, 0xffff); 17642 if (pkt_fmt->mpls == BCM_FIELD_DATA_FORMAT_MPLS_ONE_LABEL) { 17643 17644 *priority += _FP_DATA_QUALIFIER_PRIO_MPLS_ONE_LABEL; 17645 17646 /* L2 ether type 0x8847, outer label1 bos == 1 */ 17647 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17648 L3_FIELDSf, 0x1); 17649 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17650 L3_FIELDS_MASKf, 0xffffff); 17651 } else if (pkt_fmt->mpls == BCM_FIELD_DATA_FORMAT_MPLS_TWO_LABELS) { 17652 17653 *priority += _FP_DATA_QUALIFIER_PRIO_MPLS_TWO_LABEL; 17654 17655 /* L2 ether type 0x8847, outer label1 bos == 0 */ 17656 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17657 L3_FIELDSf, 0x2); 17658 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17659 L3_FIELDS_MASKf, 0xffffff); 17660 } 17661 #if defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_KATANA2_SUPPORT) 17662 else if ((SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit)) && 17663 (pkt_fmt->mpls == BCM_FIELD_DATA_FORMAT_MPLS_THREE_LABELS)) { 17664 17665 *priority += _FP_DATA_QUALIFIER_PRIO_MPLS_THREE_LABEL; 17666 17667 /* L2 ether type 0x8847, outer label1 bos == 0 */ 17668 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17669 L3_FIELDSf, 0x3); 17670 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17671 L3_FIELDS_MASKf, 0xffffff); 17672 } else if ((SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit)) && 17673 (pkt_fmt->mpls == BCM_FIELD_DATA_FORMAT_MPLS_FOUR_LABELS)) { 17674 17675 *priority += _FP_DATA_QUALIFIER_PRIO_MPLS_FOUR_LABEL; 17676 17677 /* L2 ether type 0x8847, outer label1 bos == 0 */ 17678 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17679 L3_FIELDSf, 0x4); 17680 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17681 L3_FIELDS_MASKf, 0xffffff); 17682 } else if ((SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit)) && 17683 (pkt_fmt->mpls == BCM_FIELD_DATA_FORMAT_MPLS_FIVE_LABELS)) { 17684 17685 *priority += _FP_DATA_QUALIFIER_PRIO_MPLS_FIVE_LABEL; 17686 17687 /* L2 ether type 0x8847, outer label1 bos == 0 */ 17688 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17689 L3_FIELDSf, 0x5); 17690 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17691 L3_FIELDS_MASKf, 0xffffff); 17692 } 17693 #endif /* BCM_TRIUMPH3_SUPPORT || BCM_KATANA2_SUPPORT */ 17694 else if (pkt_fmt->mpls == BCM_FIELD_DATA_FORMAT_MPLS_ANY) { 17695 /* L2 ether type 0x8847 */ 17696 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17697 L3_FIELDSf, 0x0); 17698 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17699 L3_FIELDS_MASKf, 0x0); 17700 } else { 17701 return (BCM_E_UNAVAIL); 17702 } 17703 } else if (pkt_fmt->tunnel == BCM_FIELD_DATA_FORMAT_TUNNEL_FCOE || 17704 pkt_fmt->tunnel == BCM_FIELD_DATA_FORMAT_TUNNEL_FCOE_INIT) { 17705 if (!SOC_MEM_FIELD_VALID(unit, FP_UDF_TCAMm, FC_HDR_ENCODE_1f)) { 17706 return BCM_E_UNAVAIL; 17707 } 17708 17709 *priority += _FP_DATA_QUALIFIER_PRIO_FCOE_FORMAT; 17710 17711 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, L2_ETHER_TYPEf, 17712 pkt_fmt->tunnel == 17713 BCM_FIELD_DATA_FORMAT_TUNNEL_FCOE ? 17714 0x8906 : 0x8914); 17715 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, L2_ETHER_TYPE_MASKf, 17716 0xffff); 17717 17718 mask = 0x7; 17719 switch (pkt_fmt->fibre_chan_outer) { 17720 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN: 17721 key = 1; 17722 break; 17723 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ENCAP: 17724 key = 3; 17725 break; 17726 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_VIRTUAL: 17727 key = 2; 17728 break; 17729 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ROUTED: 17730 key = 4; 17731 break; 17732 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY: 17733 key = 0; 17734 mask = 0; 17735 break; 17736 default: 17737 return BCM_E_UNAVAIL; 17738 } 17739 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, FC_HDR_ENCODE_1f, 17740 key); 17741 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, FC_HDR_ENCODE_1_MASKf, 17742 mask); 17743 17744 /* Entry matching on two extended headers has higher priority */ 17745 if ((pkt_fmt->fibre_chan_outer != BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY) && 17746 (pkt_fmt->fibre_chan_inner != BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY)) { 17747 *priority += _FP_DATA_QUALIFIER_PRIO_FCOE_FORMAT; 17748 } 17749 mask = 0x07; 17750 17751 switch (pkt_fmt->fibre_chan_inner) { 17752 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN: 17753 key = 1; 17754 break; 17755 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ENCAP: 17756 key = 3; 17757 break; 17758 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_VIRTUAL: 17759 key = 2; 17760 break; 17761 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ROUTED: 17762 key = 4; 17763 break; 17764 case BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY: 17765 key = 0; 17766 mask = 0; 17767 break; 17768 default: 17769 return BCM_E_UNAVAIL; 17770 } 17771 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17772 FC_HDR_ENCODE_2f, key); 17773 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17774 FC_HDR_ENCODE_2_MASKf, mask); 17775 } else if (BCM_FIELD_DATA_FORMAT_TUNNEL_ANY == pkt_fmt->tunnel 17776 && BCM_FIELD_DATA_FORMAT_IP_ANY == pkt_fmt->outer_ip 17777 && BCM_FIELD_DATA_FORMAT_IP_ANY == pkt_fmt->inner_ip) { 17778 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, L2_ETHER_TYPEf, 0x0); 17779 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, L2_ETHER_TYPE_MASKf, 17780 0x0); 17781 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, L3_FIELDSf, 0x0); 17782 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, L3_FIELDS_MASKf, 0x0); 17783 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, OUTER_IP_TYPEf, 0x0); 17784 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, OUTER_IP_TYPE_MASKf, 17785 0x0); 17786 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, INNER_IP_TYPEf, 0x0); 17787 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, INNER_IP_TYPE_MASKf, 17788 0x0); 17789 if (SOC_MEM_FIELD_VALID(unit,FP_UDF_TCAMm,FC_HDR_ENCODE_1f)) { 17790 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, FC_HDR_ENCODE_1f, 0); 17791 } 17792 if (SOC_MEM_FIELD_VALID(unit,FP_UDF_TCAMm,FC_HDR_ENCODE_1_MASKf)) { 17793 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, FC_HDR_ENCODE_1_MASKf, 0x0); 17794 } 17795 if (SOC_MEM_FIELD_VALID(unit,FP_UDF_TCAMm,FC_HDR_ENCODE_2f)) { 17796 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, FC_HDR_ENCODE_2f, 0); 17797 } 17798 if (SOC_MEM_FIELD_VALID(unit,FP_UDF_TCAMm,FC_HDR_ENCODE_2_MASKf)) { 17799 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, FC_HDR_ENCODE_2_MASKf, 0x0); 17800 } 17801 } else { 17802 return (BCM_E_UNAVAIL); 17803 } 17804 17805 *priority += _FP_DATA_QUALIFIER_PRIO_L3_FORMAT; 17806 return (BCM_E_NONE); 17807 } 17808 17809 /* 17810 * Function: 17811 * _field_trx2_udf_tcam_entry_vlanformat_parse 17812 * Purpose: 17813 * Parse udf tcam entry l2 format match key. 17814 * Parameters: 17815 * unit - (IN) BCM device number. 17816 * hw_buf - (IN) Hw buffer. 17817 * vlanformat - (OUT) BCM_FIELD_DATA_FORMAT_L2_XXX 17818 * Returns: 17819 * BCM_E_XXX 17820 */ 17821 int 17822 _field_trx2_udf_tcam_entry_vlanformat_parse(int unit, uint32 *hw_buf, 17823 uint16 *vlanformat) 17824 { 17825 uint32 tag_status; 17826 17827 /* Input parameters check. */ 17828 if ((NULL == hw_buf) || (NULL == vlanformat)) { 17829 return (BCM_E_PARAM); 17830 } 17831 17832 if (soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, L2_TAG_STATUS_MASKf)) { 17833 tag_status = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, 17834 L2_TAG_STATUSf); 17835 switch (tag_status) { 17836 case 0: 17837 *vlanformat = BCM_FIELD_DATA_FORMAT_VLAN_NO_TAG; 17838 break; 17839 case 1: 17840 *vlanformat = BCM_FIELD_DATA_FORMAT_VLAN_SINGLE_TAGGED; 17841 break; 17842 case 2: 17843 *vlanformat = BCM_FIELD_DATA_FORMAT_VLAN_DOUBLE_TAGGED; 17844 break; 17845 default: 17846 break; 17847 } 17848 } else { 17849 *vlanformat = BCM_FIELD_DATA_FORMAT_VLAN_TAG_ANY; 17850 } 17851 return (BCM_E_NONE); 17852 } 17853 17854 /* 17855 * Function: 17856 * _field_trx2_udf_tcam_entry_vlanformat_init 17857 * Purpose: 17858 * Initialize udf tcam entry vlan tag format match key. 17859 * Parameters: 17860 * unit - (IN) BCM device number. 17861 * vlanformat - (IN) BCM_FIELD_DATA_FORMAT_L2_XXX 17862 * hw_buf - (IN/OUT) Hw buffer. 17863 * priority - (OUT) tcam entry priority. 17864 * Returns: 17865 * BCM_E_XXX 17866 */ 17867 STATIC int 17868 _field_trx2_udf_tcam_entry_vlanformat_init(int unit, uint16 vlanformat, 17869 uint32 *hw_buf, uint8 *priority) 17870 { 17871 /* Input parameters check. */ 17872 if ((NULL == hw_buf) || (NULL == priority)) { 17873 return (BCM_E_PARAM); 17874 } 17875 17876 /* Translate L2 flag bits to index */ 17877 switch (vlanformat) { 17878 case BCM_FIELD_DATA_FORMAT_VLAN_NO_TAG: 17879 /* L2 Format . */ 17880 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17881 L2_TAG_STATUSf, 0); 17882 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17883 L2_TAG_STATUS_MASKf, 0x3); 17884 *priority += _FP_DATA_QUALIFIER_PRIO_VLAN_FORMAT; 17885 break; 17886 case BCM_FIELD_DATA_FORMAT_VLAN_SINGLE_TAGGED: 17887 /* L2 Format . */ 17888 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17889 L2_TAG_STATUSf, 1); 17890 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17891 L2_TAG_STATUS_MASKf, 0x3); 17892 *priority += _FP_DATA_QUALIFIER_PRIO_VLAN_FORMAT; 17893 break; 17894 case BCM_FIELD_DATA_FORMAT_VLAN_DOUBLE_TAGGED: 17895 /* L2 Format . */ 17896 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17897 L2_TAG_STATUSf, 2); 17898 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17899 L2_TAG_STATUS_MASKf, 0x3); 17900 *priority += _FP_DATA_QUALIFIER_PRIO_VLAN_FORMAT; 17901 break; 17902 case BCM_FIELD_DATA_FORMAT_VLAN_TAG_ANY: 17903 /* L2 Format . */ 17904 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17905 L2_TAG_STATUSf, 0); 17906 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 17907 L2_TAG_STATUS_MASKf, 0); 17908 break; 17909 default: 17910 return (BCM_E_PARAM); 17911 } 17912 return (BCM_E_NONE); 17913 } 17914 17915 /* 17916 * Function: 17917 * _field_trx2_udf_tcam_entry_l2format_parse 17918 * Purpose: 17919 * Parse udf tcam entry l2 format match key. 17920 * Parameters: 17921 * unit - (IN) BCM device number. 17922 * hw_buf - (IN) Hw buffer. 17923 * l2format - (OUT) BCM_FIELD_DATA_FORMAT_L2_XXX 17924 * Returns: 17925 * BCM_E_XXX 17926 */ 17927 int 17928 _field_trx2_udf_tcam_entry_l2format_parse(int unit, uint32 *hw_buf, 17929 uint16 *l2format) 17930 { 17931 uint32 l2type; 17932 17933 /* Input parameters check. */ 17934 if ((NULL == hw_buf) || (NULL == l2format)) { 17935 return (BCM_E_PARAM); 17936 } 17937 17938 if (soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, L2_TYPE_MASKf)) { 17939 l2type = soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, L2_TYPEf); 17940 switch (l2type) { 17941 case 0: 17942 *l2format = BCM_FIELD_DATA_FORMAT_L2_ETH_II; 17943 break; 17944 case 1: 17945 *l2format = BCM_FIELD_DATA_FORMAT_L2_SNAP; 17946 break; 17947 case 2: 17948 *l2format = BCM_FIELD_DATA_FORMAT_L2_LLC; 17949 break; 17950 default: 17951 break; 17952 } 17953 } else { 17954 *l2format = BCM_FIELD_DATA_FORMAT_L2_ANY; 17955 } 17956 return (BCM_E_NONE); 17957 } 17958 17959 /* 17960 * Function: 17961 * _field_trx2_udf_tcam_entry_flags_parse 17962 * Purpose: 17963 * Parse udf tcam entry flags format match key. 17964 * Parameters: 17965 * unit - (IN) BCM device number. 17966 * hw_buf - (IN) Hw buffer. 17967 * flags - (OUT) BCM_FIELD_DATA_FORMAT_F_XXX 17968 * Returns: 17969 * BCM_E_XXX 17970 */ 17971 int 17972 _field_trx2_udf_tcam_entry_flags_parse(int unit, uint32 *hw_buf, 17973 uint32 *flags) 17974 { 17975 uint32 type; 17976 uint32 field_mask = 0; 17977 uint32 field = 1; 17978 uint32 flag = 2; 17979 uint32 no_flag = 3; 17980 uint32 ct; 17981 17982 17983 /* Input parameters check. */ 17984 if ((NULL == hw_buf) || (NULL == flags)) { 17985 return (BCM_E_PARAM); 17986 } 17987 17988 for (ct = 0; ; ct++) { 17989 if (udf_fields_f[ct][field] == INVALIDf) { 17990 break; 17991 } 17992 /* Validate udf field flags */ 17993 if (soc_mem_field_valid(unit, FP_UDF_TCAMm, 17994 udf_fields_f[ct][field]) == FALSE) { 17995 continue; 17996 } 17997 17998 if (soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, 17999 udf_fields_f[ct][field_mask])) { 18000 type = soc_mem_field32_get(unit, FP_UDF_TCAMm, 18001 hw_buf, 18002 udf_fields_f[ct][field]); 18003 switch (type) { 18004 case 0: 18005 *flags |= udf_fields_f[ct][no_flag]; 18006 break; 18007 case 1: 18008 *flags |= udf_fields_f[ct][flag]; 18009 break; 18010 default: 18011 break; 18012 } 18013 } 18014 } 18015 18016 return (BCM_E_NONE); 18017 } 18018 18019 18020 /* 18021 * Function: 18022 * _field_trx2_udf_tcam_entry_l2format_init 18023 * Purpose: 18024 * Initialize udf tcam entry l2 format match key. 18025 * Parameters: 18026 * unit - (IN) BCM device number. 18027 * l2format - (IN) BCM_FIELD_DATA_FORMAT_L2_XXX 18028 * hw_buf - (OUT) Hw buffer. 18029 * priority - (OUT) Tcam entry priority 18030 * Returns: 18031 * BCM_E_XXX 18032 */ 18033 STATIC int 18034 _field_trx2_udf_tcam_entry_l2format_init(int unit, uint16 l2format, 18035 uint32 *hw_buf, uint8 *priority) 18036 { 18037 /* Input parameters check. */ 18038 if ((NULL == hw_buf) || (NULL == priority)) { 18039 return (BCM_E_PARAM); 18040 } 18041 18042 /* Translate L2 flag bits to index */ 18043 switch (l2format) { 18044 case BCM_FIELD_DATA_FORMAT_L2_ETH_II: 18045 /* L2 Format . */ 18046 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18047 L2_TYPEf, 0); 18048 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18049 L2_TYPE_MASKf, 0x3); 18050 *priority += _FP_DATA_QUALIFIER_PRIO_L2_FORMAT; 18051 break; 18052 case BCM_FIELD_DATA_FORMAT_L2_SNAP: 18053 /* L2 Format . */ 18054 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18055 L2_TYPEf, 1); 18056 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18057 L2_TYPE_MASKf, 0x3); 18058 *priority += _FP_DATA_QUALIFIER_PRIO_L2_FORMAT; 18059 break; 18060 case BCM_FIELD_DATA_FORMAT_L2_LLC: 18061 /* L2 Format . */ 18062 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18063 L2_TYPEf, 2); 18064 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18065 L2_TYPE_MASKf, 0x3); 18066 *priority += _FP_DATA_QUALIFIER_PRIO_L2_FORMAT; 18067 break; 18068 case BCM_FIELD_DATA_FORMAT_L2_ANY: 18069 /* L2 Format . */ 18070 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18071 L2_TYPEf, 0); 18072 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18073 L2_TYPE_MASKf, 0); 18074 break; 18075 default: 18076 return (BCM_E_PARAM); 18077 } 18078 return (BCM_E_NONE); 18079 } 18080 18081 /* 18082 * Function: 18083 * _field_trx2_udf_tcam_entry_flags_init 18084 * Purpose: 18085 * Initialize udf tcam entry flags match key. 18086 * Parameters: 18087 * unit - (IN) BCM device number. 18088 * flags - (IN) BCM_FIELD_DATA_FORMAT_F_XXX 18089 * hw_buf - (OUT) Hw buffer. 18090 * priority - (OUT) Tcam entry priority 18091 * Returns: 18092 * BCM_E_XXX 18093 */ 18094 STATIC int 18095 _field_trx2_udf_tcam_entry_flags_init(int unit, uint32 flags, 18096 uint32 *hw_buf, uint8 *priority) 18097 { 18098 int8 valid = 0; 18099 uint32 field_mask = 0; 18100 uint32 field = 1; 18101 uint32 flag = 2; 18102 uint32 no_flag = 3; 18103 uint32 ct, data, mask; 18104 18105 /* Input parameters check. */ 18106 if ((NULL == hw_buf) || (NULL == priority)) { 18107 return (BCM_E_PARAM); 18108 } 18109 18110 for (ct = 0; ; ct++) { 18111 if (udf_fields_f[ct][field] == INVALIDf) { 18112 break; 18113 } 18114 /* Validate udf field flags */ 18115 valid = soc_mem_field_valid(unit, FP_UDF_TCAMm, 18116 udf_fields_f[ct][field]); 18117 if (valid == TRUE) { 18118 if (flags & udf_fields_f[ct][flag]) { 18119 data = 1; 18120 mask = 1; 18121 *priority += _FP_DATA_QUALIFIER_PRIO_FLAGS; 18122 } else if (flags & udf_fields_f[ct][no_flag]) { 18123 data = 0; 18124 mask = 1; 18125 *priority += _FP_DATA_QUALIFIER_PRIO_FLAGS; 18126 } else { 18127 continue; 18128 } 18129 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18130 udf_fields_f[ct][field], data); 18131 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18132 udf_fields_f[ct][field_mask], mask); 18133 } else if (flags & udf_fields_f[ct][flag]) { 18134 return (BCM_E_UNAVAIL); 18135 } 18136 } 18137 18138 return (BCM_E_NONE); 18139 } 18140 18141 /* 18142 * Function: 18143 * _bcm_field_trx2_udf_tcam_entry_parse 18144 * Purpose: 18145 * Parse udf tcam entry key 18146 * Parameters: 18147 * unit - (IN) BCM device number. 18148 * hw_buf - (IN) Hw buffer. 18149 * flags - (OUT) Udf spec index (encoded flags). 18150 * Returns: 18151 * BCM_E_XXX 18152 */ 18153 int 18154 _bcm_field_trx2_udf_tcam_entry_parse(int unit, uint32 *hw_buf, uint32 *flags) 18155 { 18156 bcm_field_data_packet_format_t pkt_fmt; 18157 int rv; 18158 18159 /* Input parameters check. */ 18160 if ((NULL == hw_buf) || (NULL == flags)) { 18161 return (BCM_E_PARAM); 18162 } 18163 bcm_field_data_packet_format_t_init(&pkt_fmt); 18164 18165 /* Get valid bit. */ 18166 if (soc_mem_field32_get(unit, FP_UDF_TCAMm, hw_buf, VALIDf)) { 18167 *flags = _BCM_FIELD_USER_OFFSET_VALID; 18168 } else { 18169 *flags = 0; 18170 return (BCM_E_NONE); 18171 } 18172 18173 /* Parse vlan_tag format.*/ 18174 rv = _field_trx2_udf_tcam_entry_vlanformat_parse(unit, hw_buf, 18175 &pkt_fmt.vlan_tag); 18176 BCM_IF_ERROR_RETURN(rv); 18177 18178 /* Parse l2 format.*/ 18179 rv = _field_trx2_udf_tcam_entry_l2format_parse(unit, hw_buf, &pkt_fmt.l2); 18180 BCM_IF_ERROR_RETURN(rv); 18181 18182 /* Parse l3 fields.*/ 18183 rv = _field_trx2_udf_tcam_entry_l3_parse(unit, hw_buf, &pkt_fmt); 18184 BCM_IF_ERROR_RETURN(rv); 18185 18186 /* Parse Flags fields */ 18187 rv = _field_trx2_udf_tcam_entry_flags_parse(unit, hw_buf, &pkt_fmt.flags); 18188 BCM_IF_ERROR_RETURN(rv); 18189 18190 /* 18191 * Translate Data qualifier representation to UDF flag bits value. 18192 */ 18193 18194 /* IPv4, IPv6, MPLS and FCoE packet formats are taken care below. */ 18195 if (BCM_FIELD_DATA_FORMAT_TUNNEL_NONE == pkt_fmt.tunnel) { 18196 if (BCM_FIELD_DATA_FORMAT_IP4_WITH_OPTIONS == pkt_fmt.outer_ip) { 18197 *flags |= (_BCM_FIELD_USER_IP4_HDR_ONLY | 18198 _BCM_FIELD_USER_OPTION_ADJUST); 18199 } else if (BCM_FIELD_DATA_FORMAT_IP6_WITH_OPTIONS == pkt_fmt.outer_ip) { 18200 *flags |= (_BCM_FIELD_USER_IP6_HDR_ONLY | 18201 _BCM_FIELD_USER_OPTION_ADJUST); 18202 } else if (BCM_FIELD_DATA_FORMAT_IP4 == pkt_fmt.outer_ip) { 18203 *flags |= _BCM_FIELD_USER_IP4_HDR_ONLY; 18204 } else if (BCM_FIELD_DATA_FORMAT_IP6 == pkt_fmt.outer_ip) { 18205 *flags |= _BCM_FIELD_USER_IP6_HDR_ONLY; 18206 } else { 18207 *flags |= _BCM_FIELD_USER_IP_NOTUSED; 18208 } 18209 } else if (BCM_FIELD_DATA_FORMAT_TUNNEL_IP_IN_IP == pkt_fmt.tunnel) { 18210 if (BCM_FIELD_DATA_FORMAT_IP4 == pkt_fmt.outer_ip) { 18211 if (BCM_FIELD_DATA_FORMAT_IP4 == pkt_fmt.inner_ip) { 18212 *flags |= _BCM_FIELD_USER_IP4_OVER_IP4; 18213 } else if (BCM_FIELD_DATA_FORMAT_IP6 == pkt_fmt.inner_ip) { 18214 *flags |= _BCM_FIELD_USER_IP6_OVER_IP4; 18215 } 18216 } else { 18217 if (BCM_FIELD_DATA_FORMAT_IP4 == pkt_fmt.inner_ip) { 18218 *flags |= _BCM_FIELD_USER_IP4_OVER_IP6; 18219 } else if (BCM_FIELD_DATA_FORMAT_IP6 == pkt_fmt.inner_ip) { 18220 *flags |= _BCM_FIELD_USER_IP6_OVER_IP6; 18221 } 18222 } 18223 } else if (BCM_FIELD_DATA_FORMAT_TUNNEL_GRE == pkt_fmt.tunnel) { 18224 if (BCM_FIELD_DATA_FORMAT_IP4 == pkt_fmt.outer_ip) { 18225 if (BCM_FIELD_DATA_FORMAT_IP4 == pkt_fmt.inner_ip) { 18226 *flags |= _BCM_FIELD_USER_GRE_IP4_OVER_IP4; 18227 } else if (BCM_FIELD_DATA_FORMAT_IP6 == pkt_fmt.inner_ip) { 18228 *flags |= _BCM_FIELD_USER_GRE_IP6_OVER_IP4; 18229 } 18230 } else { 18231 if (BCM_FIELD_DATA_FORMAT_IP4 == pkt_fmt.inner_ip) { 18232 *flags |= _BCM_FIELD_USER_GRE_IP4_OVER_IP6; 18233 } else if (BCM_FIELD_DATA_FORMAT_IP6 == pkt_fmt.inner_ip) { 18234 *flags |= _BCM_FIELD_USER_GRE_IP6_OVER_IP6; 18235 } 18236 } 18237 } else if (BCM_FIELD_DATA_FORMAT_TUNNEL_MPLS == pkt_fmt.tunnel) { 18238 if (BCM_FIELD_DATA_FORMAT_MPLS_ONE_LABEL == pkt_fmt.mpls) { 18239 *flags |= _BCM_FIELD_USER_ONE_MPLS_LABEL; 18240 } else if (BCM_FIELD_DATA_FORMAT_MPLS_TWO_LABELS == pkt_fmt.mpls) { 18241 *flags |= _BCM_FIELD_USER_TWO_MPLS_LABELS; 18242 } else if (BCM_FIELD_DATA_FORMAT_MPLS_THREE_LABELS == pkt_fmt.mpls) { 18243 *flags |= _BCM_FIELD_USER_THREE_MPLS_LABELS; 18244 } else if (BCM_FIELD_DATA_FORMAT_MPLS_FOUR_LABELS == pkt_fmt.mpls) { 18245 *flags |= _BCM_FIELD_USER_FOUR_MPLS_LABELS; 18246 } else if (BCM_FIELD_DATA_FORMAT_MPLS_FIVE_LABELS == pkt_fmt.mpls) { 18247 *flags |= _BCM_FIELD_USER_FIVE_MPLS_LABELS; 18248 } else if (BCM_FIELD_DATA_FORMAT_MPLS_ANY == pkt_fmt.mpls) { 18249 *flags |= _BCM_FIELD_USER_ANY_MPLS_LABELS; 18250 } 18251 } else if ((BCM_FIELD_DATA_FORMAT_TUNNEL_FCOE == pkt_fmt.tunnel) 18252 || (BCM_FIELD_DATA_FORMAT_TUNNEL_FCOE_INIT == pkt_fmt.tunnel)) { 18253 if ((BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY != pkt_fmt.fibre_chan_inner) && 18254 (BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY != pkt_fmt.fibre_chan_outer)) { 18255 *flags |= _BCM_FIELD_USER_TWO_FCOE_HEADER; 18256 } else if ((BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY 18257 != pkt_fmt.fibre_chan_outer) 18258 && (BCM_FIELD_DATA_FORMAT_FIBRE_CHAN_ANY 18259 == pkt_fmt.fibre_chan_inner)) { 18260 *flags |= _BCM_FIELD_USER_ONE_FCOE_HEADER; 18261 } 18262 } 18263 18264 18265 /* Get VLAN tag format flags. */ 18266 switch (pkt_fmt.vlan_tag) { 18267 case BCM_FIELD_DATA_FORMAT_VLAN_NO_TAG: 18268 *flags |= _BCM_FIELD_USER_VLAN_NOTAG; 18269 break; 18270 case BCM_FIELD_DATA_FORMAT_VLAN_SINGLE_TAGGED: 18271 *flags |= _BCM_FIELD_USER_VLAN_ONETAG; 18272 break; 18273 case BCM_FIELD_DATA_FORMAT_VLAN_DOUBLE_TAGGED: 18274 *flags |= _BCM_FIELD_USER_VLAN_TWOTAG; 18275 break; 18276 default: 18277 /* For VLAN Tag Any. */ 18278 *flags |= _BCM_FIELD_USER_VLAN_NOTUSED; 18279 break; 18280 } 18281 18282 /* Get L2 format flags. */ 18283 switch (pkt_fmt.l2) { 18284 case BCM_FIELD_DATA_FORMAT_L2_ETH_II: 18285 *flags |= _BCM_FIELD_USER_L2_ETHERNET2; 18286 break; 18287 case BCM_FIELD_DATA_FORMAT_L2_SNAP: 18288 *flags |= _BCM_FIELD_USER_L2_SNAP; 18289 break; 18290 case BCM_FIELD_DATA_FORMAT_L2_LLC: 18291 *flags |= _BCM_FIELD_USER_L2_LLC; 18292 break; 18293 default: 18294 /* For L2 Tag Any. */ 18295 *flags |= _BCM_FIELD_USER_L2_OTHER; 18296 break; 18297 } 18298 18299 /* Get UDF flags format */ 18300 if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_ENCAP_STACK) { 18301 *flags |= _BCM_FIELD_USER_F_ENCAP_STACK; 18302 } else if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_NO_ENCAP_STACK) { 18303 *flags |= _BCM_FIELD_USER_F_NO_ENCAP_STACK; 18304 } else { 18305 *flags |= _BCM_FIELD_USER_F_ENCAP_STACK_ANY; 18306 } 18307 18308 if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_VNTAG) { 18309 *flags |= _BCM_FIELD_USER_F_VNTAG; 18310 } else if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_NO_VNTAG) { 18311 *flags |= _BCM_FIELD_USER_F_NO_VNTAG; 18312 } else { 18313 *flags |= _BCM_FIELD_USER_F_VNTAG_ANY; 18314 } 18315 18316 if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_CNTAG) { 18317 *flags |= _BCM_FIELD_USER_F_CNTAG; 18318 } else if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_NO_CNTAG) { 18319 *flags |= _BCM_FIELD_USER_F_NO_CNTAG; 18320 } else { 18321 *flags |= _BCM_FIELD_USER_F_CNTAG_ANY; 18322 } 18323 18324 if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_ETAG) { 18325 *flags |= _BCM_FIELD_USER_F_ETAG; 18326 } else if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_NO_ETAG) { 18327 *flags |= _BCM_FIELD_USER_F_NO_ETAG; 18328 } else { 18329 *flags |= _BCM_FIELD_USER_F_ETAG_ANY; 18330 } 18331 18332 if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_ICNM) { 18333 *flags |= _BCM_FIELD_USER_F_ICNM; 18334 } else if (pkt_fmt.flags & BCM_FIELD_DATA_FORMAT_F_NO_ICNM) { 18335 *flags |= _BCM_FIELD_USER_F_NO_ICNM; 18336 } else { 18337 *flags |= _BCM_FIELD_USER_F_ICNM_ANY; 18338 } 18339 18340 return (BCM_E_NONE); 18341 } 18342 18343 /* 18344 * Function: 18345 * _field_trx2_data_offset_install 18346 * Purpose: 18347 * Write the info in udf_tcam/udf_offset to the hardware 18348 * Parameters: 18349 * unit - (IN) BCM device number. 18350 * flag - (IN) TRUE for delete, FALSE for others 18351 * tbl_idx - (IN) FP_UDF_OFFSET table index. 18352 * f_dq - (IN) Data qualifier structure. 18353 * offset - (IN) Word offset value FP_UDF_OFFSETm. 18354 * Returns: 18355 * BCM_E_XXX 18356 */ 18357 STATIC int 18358 _field_trx2_data_tcam_offset_install(int unit, uint8 flag, 18359 _field_data_qualifier_t *f_dq, 18360 int tbl_idx, int offset) 18361 { 18362 _field_stage_t *stage_fc; 18363 uint32 word_offset; /* Offset iterator. */ 18364 int udf_idx, user_idx; 18365 int rv; /* Operation return status. */ 18366 18367 /* Input parameters check. */ 18368 if (NULL == f_dq) { 18369 return (BCM_E_PARAM); 18370 } 18371 18372 BCM_IF_ERROR_RETURN 18373 (_field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc)); 18374 18375 word_offset = (offset < 0) ? 0 : (uint32)offset; 18376 18377 /* Find a proper word to insert the data. */ 18378 for (udf_idx = 0; udf_idx < 2; udf_idx++) { 18379 for (user_idx = 0; user_idx < stage_fc->data_ctrl->num_elems; 18380 user_idx++) { 18381 if (!(f_dq->hw_bmap & 18382 (1 << (udf_idx * 18383 stage_fc->data_ctrl->num_elems + user_idx)))) { 18384 continue; 18385 } 18386 18387 rv = _field_trx2_udf_offset_entry_write(unit, flag, tbl_idx, udf_idx, 18388 user_idx, 18389 f_dq->offset_base, 18390 word_offset); 18391 BCM_IF_ERROR_RETURN(rv); 18392 18393 if (offset >= 0) { 18394 word_offset++; 18395 } 18396 } 18397 } 18398 18399 return BCM_E_NONE; 18400 } 18401 18402 /* 18403 * Function: 18404 * _field_trx2_data_elem_offset_calc 18405 * Purpose: 18406 * Calculate element offset based on data qualifier 18407 * relative offset, base offset and common offset. 18408 * Parameters: 18409 * unit - (IN) BCM device number. 18410 * f_dq - (IN) Data qualifier structure. 18411 * reltive_offset - (IN) Word offset value FP_UDF_OFFSETm. 18412 * elem_offset - (OUT) Calculated index value. 18413 * Returns: 18414 * BCM_E_XXX 18415 */ 18416 STATIC int 18417 _field_trx2_data_elem_offset_calc(int unit, _field_data_qualifier_t *f_dq, 18418 int relative_offset, int *elem_offset) 18419 { 18420 _field_stage_t *stage_fc; 18421 int offset; 18422 18423 /* Input parameters check. */ 18424 if ((NULL == f_dq) || (NULL == elem_offset)) { 18425 return (BCM_E_PARAM); 18426 } 18427 18428 BCM_IF_ERROR_RETURN 18429 (_field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc)); 18430 18431 offset = f_dq->offset + relative_offset; 18432 18433 if (stage_fc->data_ctrl->elem_size <= 2) { /* no wrap around needed */ 18434 offset = (offset % 128) / stage_fc->data_ctrl->elem_size; 18435 } else { 18436 switch (f_dq->offset_base) { 18437 case bcmFieldDataOffsetBaseHigigHeader: 18438 case bcmFieldDataOffsetBaseHigig2Header: 18439 offset = ((offset + 2) % 128) / 4; 18440 break; 18441 case bcmFieldDataOffsetBasePacketStart: 18442 offset = ((offset + 2) % 128) / 4; 18443 break; 18444 default: 18445 offset = (offset % 128) / 4; 18446 break; 18447 } 18448 } 18449 18450 *elem_offset = offset; 18451 return (BCM_E_NONE); 18452 } 18453 18454 /* 18455 * Function: 18456 * _field_trx2_data_qualifier_etype_tcam_key_init 18457 * Purpose: 18458 * Initialize ethertype based udf tcam entry. 18459 * Parameters: 18460 * unit - (IN) bcm device. 18461 * etype - (IN) Ethertype based offset specification. 18462 * hw_buf - (OUT) Hardware buffer. 18463 * priority - (OUT) Tcam entry priority 18464 * Returns: 18465 * BCM_E_XXX 18466 */ 18467 int 18468 _field_trx2_data_qualifier_etype_tcam_key_init(int unit, 18469 bcm_field_data_ethertype_t *etype, 18470 uint32 *hw_buf, uint8 *priority) 18471 { 18472 int rv; /* Operation return status. */ 18473 18474 /* Input parameters check. */ 18475 if ((NULL == hw_buf) || (NULL == priority)) { 18476 return (BCM_E_PARAM); 18477 } 18478 18479 *priority = 0; 18480 18481 /* Set valid bit. */ 18482 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, VALIDf, 1); 18483 18484 /* Set l2 format. */ 18485 rv = _field_trx2_udf_tcam_entry_l2format_init(unit, etype->l2, 18486 hw_buf, priority); 18487 BCM_IF_ERROR_RETURN(rv); 18488 18489 /* Set vlan tag format. */ 18490 rv = _field_trx2_udf_tcam_entry_vlanformat_init(unit, etype->vlan_tag, 18491 hw_buf, priority); 18492 BCM_IF_ERROR_RETURN(rv); 18493 18494 /* Set Flags packet format */ 18495 BCM_IF_ERROR_RETURN(_field_trx2_udf_tcam_entry_flags_init(unit, 18496 etype->flags, 18497 hw_buf, 18498 priority)); 18499 /* Set ethertype value. */ 18500 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18501 L2_ETHER_TYPEf, etype->ethertype); 18502 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18503 L2_ETHER_TYPE_MASKf, 0xffff); 18504 *priority += _FP_DATA_QUALIFIER_PRIO_MISC; 18505 18506 return (rv); 18507 } 18508 18509 /* 18510 * Function: 18511 * _field_trx2_data_qualifier_ip_proto_tcam_key_init 18512 * Purpose: 18513 * Initialize ethertype based udf tcam entry. 18514 * Parameters: 18515 * unit - (IN) bcm device. 18516 * ip_proto - (IN) Ip Protocol based offset specification. 18517 * hw_buf - (OUT) Hardware buffer. 18518 * priority - (OUT) Tcam entry priority 18519 * Returns: 18520 * BCM_E_XXX 18521 */ 18522 int 18523 _field_trx2_data_qualifier_ip_proto_tcam_key_init(int unit, 18524 bcm_field_data_ip_protocol_t *ip_proto, 18525 uint32 *hw_buf, uint8 *priority) 18526 { 18527 int rv; /* Operation return status. */ 18528 18529 /* Input parameters check. */ 18530 if ((NULL == hw_buf) || (NULL == priority)) { 18531 return (BCM_E_PARAM); 18532 } 18533 18534 *priority = 0; 18535 18536 /* Set valid bit. */ 18537 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, VALIDf, 1); 18538 18539 /* Set l2 format. */ 18540 rv = _field_trx2_udf_tcam_entry_l2format_init(unit, ip_proto->l2, 18541 hw_buf, priority); 18542 BCM_IF_ERROR_RETURN(rv); 18543 18544 /* Set vlan tag format. */ 18545 rv = _field_trx2_udf_tcam_entry_vlanformat_init(unit, ip_proto->vlan_tag, 18546 hw_buf, priority); 18547 BCM_IF_ERROR_RETURN(rv); 18548 18549 /* Set ethertype value. */ 18550 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18551 L3_FIELDSf, (ip_proto->ip << 16)); 18552 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, 18553 L3_FIELDS_MASKf, 0xff0000); 18554 if (ip_proto->ip) { 18555 *priority += _FP_DATA_QUALIFIER_PRIO_IPPROTO; 18556 } 18557 *priority += _FP_DATA_QUALIFIER_PRIO_MISC; 18558 18559 return (rv); 18560 } 18561 18562 /* 18563 * Function: 18564 * _field_trx2_data_qualifier_pkt_format_tcam_key_init 18565 * Purpose: 18566 * Initialize ethertype based udf tcam entry. 18567 * Parameters: 18568 * unit - (IN) bcm device. 18569 * pkt_format - (IN) Packet format based offset specification. 18570 * hw_buf - (OUT) Hardware buffer. 18571 * priority - (OUT) Tcam entry priority 18572 * Returns: 18573 * BCM_E_XXX 18574 */ 18575 int 18576 _field_trx2_data_qualifier_pkt_format_tcam_key_init(int unit, 18577 bcm_field_data_packet_format_t *pkt_format, 18578 uint32 *hw_buf, uint8 *priority) 18579 { 18580 int rv; /* Operation return status. */ 18581 18582 /* Input parameters check. */ 18583 if ((NULL == hw_buf) || (NULL == priority)) { 18584 return (BCM_E_PARAM); 18585 } 18586 18587 *priority = 0; 18588 18589 /* Set valid bit. */ 18590 soc_mem_field32_set(unit, FP_UDF_TCAMm, hw_buf, VALIDf, 1); 18591 18592 /* Set l2 format. */ 18593 rv = _field_trx2_udf_tcam_entry_l2format_init(unit, pkt_format->l2, 18594 hw_buf, priority); 18595 BCM_IF_ERROR_RETURN(rv); 18596 18597 /* Set vlan tag format. */ 18598 rv = _field_trx2_udf_tcam_entry_vlanformat_init(unit, pkt_format->vlan_tag, 18599 hw_buf, priority); 18600 BCM_IF_ERROR_RETURN(rv); 18601 18602 /* Set l3 packet format. */ 18603 rv = _field_trx2_udf_tcam_entry_l3_init(unit, pkt_format, hw_buf, priority); 18604 BCM_IF_ERROR_RETURN(rv); 18605 18606 /* Set Flags packet format */ 18607 rv = _field_trx2_udf_tcam_entry_flags_init(unit, pkt_format->flags, hw_buf, 18608 priority); 18609 return (rv); 18610 } 18611 18612 /* 18613 * Function: 18614 * _bcm_field_trx2_data_qualifier_ethertype_add 18615 * Purpose: 18616 * Add ethertype based offset to data qualifier object. 18617 * Parameters: 18618 * unit - (IN) bcm device. 18619 * qual_id - (IN) Data qualifier id. 18620 * etype - (IN) Ethertype based offset specification. 18621 * Returns: 18622 * BCM_E_XXX 18623 */ 18624 int 18625 _bcm_field_trx2_data_qualifier_ethertype_add(int unit, int qual_id, 18626 bcm_field_data_ethertype_t *etype) 18627 { 18628 fp_udf_tcam_entry_t tcam_buf; /* Udf tcam entry. */ 18629 _field_stage_t *stage_fc; /* Stage field control. */ 18630 _field_data_qualifier_t *f_dq; /* Data qualifier descriptor. */ 18631 uint8 priority; /* Udf tcam entry priority. */ 18632 int tcam_idx; /* Tcam insertion index. */ 18633 int offset; /* Qualifier tcam offset. */ 18634 int rv; /* Operation return status. */ 18635 18636 /* Input parameters check. */ 18637 if (NULL == etype) { 18638 return (BCM_E_PARAM); 18639 } 18640 18641 /* Initialization. */ 18642 sal_memset(&tcam_buf, 0, sizeof(fp_udf_tcam_entry_t)); 18643 18644 /* Get stage field control structure. */ 18645 rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 18646 BCM_IF_ERROR_RETURN(rv); 18647 18648 /* Get data qualifier info. */ 18649 rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id, &f_dq); 18650 BCM_IF_ERROR_RETURN(rv); 18651 18652 /* Initialize ethertype data qualifier key. */ 18653 rv = _field_trx2_data_qualifier_etype_tcam_key_init(unit, etype, 18654 (uint32 *)&tcam_buf, 18655 &priority); 18656 BCM_IF_ERROR_RETURN(rv); 18657 18658 /* Reorganize the tcam and reserve an index for the entry. */ 18659 rv = _field_trx2_udf_tcam_entry_insert(unit, (uint32*)&tcam_buf, 18660 priority, &tcam_idx); 18661 BCM_IF_ERROR_RETURN(rv); 18662 18663 /* Calculate element offset. */ 18664 rv = _field_trx2_data_elem_offset_calc(unit, f_dq, 18665 etype->relative_offset, &offset); 18666 BCM_IF_ERROR_RETURN(rv); 18667 18668 /* Initialize udf offset entry. */ 18669 rv = _field_trx2_data_tcam_offset_install(unit, FALSE, f_dq, tcam_idx, offset); 18670 BCM_IF_ERROR_RETURN(rv); 18671 18672 /* Insert udf tcam entry. */ 18673 rv = soc_mem_write(unit, FP_UDF_TCAMm, MEM_BLOCK_ALL, tcam_idx, &tcam_buf); 18674 BCM_IF_ERROR_RETURN(rv); 18675 18676 return (BCM_E_NONE); 18677 } 18678 18679 /* 18680 * Function: 18681 * _bcm_field_trx2_data_qualifier_ethertype_delete 18682 * Purpose: 18683 * Remove ethertype based offset from data qualifier object. 18684 * Parameters: 18685 * unit - (IN) bcm device. 18686 * qual_id - (IN) Data qualifier id. 18687 * etype - (IN) Ethertype based offset specification. 18688 * Returns: 18689 * BCM_E_XXX 18690 */ 18691 int 18692 _bcm_field_trx2_data_qualifier_ethertype_delete(int unit, int qual_id, 18693 bcm_field_data_ethertype_t *etype) 18694 { 18695 _field_data_tcam_entry_t *tcam_entry_arr; /* Tcam entries array. */ 18696 fp_udf_tcam_entry_t tcam_buf; /* Udf tcam entry. */ 18697 _field_stage_t *stage_fc; /* Stage field control. */ 18698 _field_data_qualifier_t *f_dq; /* Data qualifier descriptor. */ 18699 uint8 priority; /* Udf tcam entry priority. */ 18700 int tcam_idx; /* Tcam insertion index. */ 18701 int rv; /* Operation return status. */ 18702 18703 /* Input parameters check. */ 18704 if (NULL == etype) { 18705 return (BCM_E_PARAM); 18706 } 18707 18708 /* Initialization. */ 18709 sal_memset(&tcam_buf, 0, sizeof(fp_udf_tcam_entry_t)); 18710 18711 /* Get stage field control structure. */ 18712 rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 18713 BCM_IF_ERROR_RETURN(rv); 18714 18715 18716 /* Get data qualifier info. */ 18717 rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id, &f_dq); 18718 BCM_IF_ERROR_RETURN(rv); 18719 18720 /* Initialize ethertype data qualifier key. */ 18721 rv = _field_trx2_data_qualifier_etype_tcam_key_init(unit, etype, 18722 (uint32 *)&tcam_buf, 18723 &priority); 18724 BCM_IF_ERROR_RETURN(rv); 18725 18726 /* Match the tcam entry. */ 18727 rv = _field_trx2_udf_tcam_entry_match(unit, stage_fc, 18728 (uint32*)&tcam_buf, &tcam_idx); 18729 BCM_IF_ERROR_RETURN(rv); 18730 18731 tcam_entry_arr = stage_fc->data_ctrl->tcam_entry_arr; 18732 if (tcam_entry_arr[tcam_idx].ref_count > 0) { 18733 tcam_entry_arr[tcam_idx].ref_count--; 18734 } 18735 18736 /* Initialize udf offset entry. */ 18737 rv = _field_trx2_data_tcam_offset_install(unit, TRUE, f_dq, tcam_idx, -1); 18738 BCM_IF_ERROR_RETURN(rv); 18739 18740 if (0 == tcam_entry_arr[tcam_idx].ref_count) { 18741 /* Reset udf tcam entry. */ 18742 rv = soc_mem_write(unit, FP_UDF_TCAMm, MEM_BLOCK_ALL, tcam_idx, 18743 &soc_mem_entry_null(unit, FP_UDF_TCAMm)); 18744 BCM_IF_ERROR_RETURN(rv); 18745 } 18746 18747 return (BCM_E_NONE); 18748 } 18749 18750 /* 18751 * Function: 18752 * _bcm_field_trx2_data_qualifier_ip_protocol_add 18753 * Purpose: 18754 * Add ipprotocol based offset to data qualifier object. 18755 * Parameters: 18756 * unit - (IN) bcm device. 18757 * qual_id - (IN) Data qualifier id. 18758 * ip_proto - (IN) Ip protocol based offset specification. 18759 * Returns: 18760 * BCM_E_XXX 18761 */ 18762 int 18763 _bcm_field_trx2_data_qualifier_ip_protocol_add(int unit, int qual_id, 18764 bcm_field_data_ip_protocol_t *ip_proto) 18765 { 18766 fp_udf_tcam_entry_t tcam_buf; /* Udf tcam entry. */ 18767 _field_stage_t *stage_fc; /* Stage field control. */ 18768 _field_data_qualifier_t *f_dq; /* Data qualifier descriptor. */ 18769 uint8 priority; /* Udf tcam entry priority. */ 18770 int tcam_idx; /* Tcam insertion index. */ 18771 int offset; /* Qualifier tcam offset. */ 18772 int rv; /* Operation return status. */ 18773 18774 /* Input parameters check. */ 18775 if (NULL == ip_proto) { 18776 return (BCM_E_PARAM); 18777 } 18778 18779 /* Initialization. */ 18780 sal_memset(&tcam_buf, 0, sizeof(fp_udf_tcam_entry_t)); 18781 18782 /* Get stage field control structure. */ 18783 rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 18784 BCM_IF_ERROR_RETURN(rv); 18785 18786 /* Get data qualifier info. */ 18787 rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id, &f_dq); 18788 BCM_IF_ERROR_RETURN(rv); 18789 18790 /* Initialize ipprotocol data qualifier key. */ 18791 rv = _field_trx2_data_qualifier_ip_proto_tcam_key_init(unit, ip_proto, 18792 (uint32 *)&tcam_buf, 18793 &priority); 18794 BCM_IF_ERROR_RETURN(rv); 18795 18796 /* Reorganize the tcam and reserve an index for the entry. */ 18797 rv = _field_trx2_udf_tcam_entry_insert(unit, (uint32*)&tcam_buf, 18798 priority, &tcam_idx); 18799 BCM_IF_ERROR_RETURN(rv); 18800 18801 /* Calculate elem offset. */ 18802 rv = _field_trx2_data_elem_offset_calc(unit, f_dq, 18803 ip_proto->relative_offset, &offset); 18804 BCM_IF_ERROR_RETURN(rv); 18805 18806 /* Initialize udf offset entry. */ 18807 rv = _field_trx2_data_tcam_offset_install(unit, FALSE, f_dq, tcam_idx, offset); 18808 BCM_IF_ERROR_RETURN(rv); 18809 18810 /* Insert udf tcam entry. */ 18811 rv = soc_mem_write(unit, FP_UDF_TCAMm, MEM_BLOCK_ALL, tcam_idx, &tcam_buf); 18812 BCM_IF_ERROR_RETURN(rv); 18813 18814 return (BCM_E_NONE); 18815 } 18816 18817 /* 18818 * Function: 18819 * _bcm_field_trx2_data_qualifier_ip_protocol_delete 18820 * Purpose: 18821 * Remove ipprotocol based offset from data qualifier object. 18822 * Parameters: 18823 * unit - (IN) bcm device. 18824 * qual_id - (IN) Data qualifier id. 18825 * ip_proto - (IN) Ip protocol based offset specification. 18826 * Returns: 18827 * BCM_E_XXX 18828 */ 18829 int 18830 _bcm_field_trx2_data_qualifier_ip_protocol_delete(int unit, int qual_id, 18831 bcm_field_data_ip_protocol_t *ip_proto) 18832 { 18833 _field_data_tcam_entry_t *tcam_entry_arr; /* Tcam entries array. */ 18834 fp_udf_tcam_entry_t tcam_buf; /* Udf tcam entry. */ 18835 _field_stage_t *stage_fc; /* Stage field control. */ 18836 _field_data_qualifier_t *f_dq; /* Data qualifier descriptor. */ 18837 uint8 priority; /* Udf tcam entry priority. */ 18838 int tcam_idx; /* Tcam insertion index. */ 18839 int rv; /* Operation return status. */ 18840 18841 /* Input parameters check. */ 18842 if (NULL == ip_proto) { 18843 return (BCM_E_PARAM); 18844 } 18845 18846 /* Initialization. */ 18847 sal_memset(&tcam_buf, 0, sizeof(fp_udf_tcam_entry_t)); 18848 18849 /* Get stage field control structure. */ 18850 rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 18851 BCM_IF_ERROR_RETURN(rv); 18852 18853 /* Get data qualifier info. */ 18854 rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id, &f_dq); 18855 BCM_IF_ERROR_RETURN(rv); 18856 18857 /* Initialize ipprotocol data qualifier key. */ 18858 rv = _field_trx2_data_qualifier_ip_proto_tcam_key_init(unit, ip_proto, 18859 (uint32 *)&tcam_buf, 18860 &priority); 18861 BCM_IF_ERROR_RETURN(rv); 18862 18863 /* Match the tcam entry. */ 18864 rv = _field_trx2_udf_tcam_entry_match(unit, stage_fc, 18865 (uint32*)&tcam_buf, &tcam_idx); 18866 BCM_IF_ERROR_RETURN(rv); 18867 18868 tcam_entry_arr = stage_fc->data_ctrl->tcam_entry_arr; 18869 if (tcam_entry_arr[tcam_idx].ref_count > 0) { 18870 tcam_entry_arr[tcam_idx].ref_count--; 18871 } 18872 18873 /* Initialize udf offset entry. */ 18874 rv = _field_trx2_data_tcam_offset_install(unit, TRUE, f_dq, tcam_idx, -1); 18875 BCM_IF_ERROR_RETURN(rv); 18876 18877 if (0 == tcam_entry_arr[tcam_idx].ref_count) { 18878 /* Reset udf tcam entry. */ 18879 rv = soc_mem_write(unit, FP_UDF_TCAMm, MEM_BLOCK_ALL, tcam_idx, 18880 &soc_mem_entry_null(unit, FP_UDF_TCAMm)); 18881 BCM_IF_ERROR_RETURN(rv); 18882 } 18883 18884 return (BCM_E_NONE); 18885 } 18886 18887 /* 18888 * Function: 18889 * _bcm_field_trx2_data_qualifier_packet_format_add 18890 * Purpose: 18891 * Add ipprotocol based offset to data qualifier object. 18892 * Parameters: 18893 * unit - (IN) bcm device. 18894 * qual_id - (IN) Data qualifier id. 18895 * pkt_format - (IN) Packet format based offset specification. 18896 * Returns: 18897 * BCM_E_XXX 18898 */ 18899 int 18900 _bcm_field_trx2_data_qualifier_packet_format_add(int unit, int qual_id, 18901 bcm_field_data_packet_format_t *pkt_format) 18902 { 18903 fp_udf_tcam_entry_t tcam_buf; /* Udf tcam entry. */ 18904 _field_stage_t *stage_fc; /* Stage field control. */ 18905 _field_data_qualifier_t *f_dq; /* Data qualifier descriptor. */ 18906 uint8 priority; /* Udf tcam entry priority. */ 18907 int tcam_idx; /* Tcam insertion index. */ 18908 int offset; /* Qualifier tcam offset. */ 18909 int rv; /* Operation return status. */ 18910 18911 /* Input parameters check. */ 18912 if (NULL == pkt_format) { 18913 return (BCM_E_PARAM); 18914 } 18915 18916 /* Initialization. */ 18917 sal_memset(&tcam_buf, 0, sizeof(fp_udf_tcam_entry_t)); 18918 18919 /* Get stage field control structure. */ 18920 rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 18921 BCM_IF_ERROR_RETURN(rv); 18922 18923 /* Get data qualifier info. */ 18924 rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id, &f_dq); 18925 BCM_IF_ERROR_RETURN(rv); 18926 18927 /* Initialize packet format data qualifier key. */ 18928 rv = _field_trx2_data_qualifier_pkt_format_tcam_key_init(unit, pkt_format, 18929 (uint32 *)&tcam_buf, 18930 &priority); 18931 BCM_IF_ERROR_RETURN(rv); 18932 18933 /* Reorganize the tcam and reserve an index for the entry. */ 18934 rv = _field_trx2_udf_tcam_entry_insert(unit, (uint32*)&tcam_buf, 18935 priority, &tcam_idx); 18936 BCM_IF_ERROR_RETURN(rv); 18937 18938 /* Calculate elem offset. */ 18939 rv = _field_trx2_data_elem_offset_calc(unit, f_dq, 18940 pkt_format->relative_offset, 18941 &offset); 18942 BCM_IF_ERROR_RETURN(rv); 18943 18944 /* Initialize udf offset entry. */ 18945 rv = _field_trx2_data_tcam_offset_install(unit, FALSE, f_dq, tcam_idx, offset); 18946 BCM_IF_ERROR_RETURN(rv); 18947 18948 /* Insert udf tcam entry. */ 18949 rv = soc_mem_write(unit, FP_UDF_TCAMm, MEM_BLOCK_ALL, tcam_idx, &tcam_buf); 18950 BCM_IF_ERROR_RETURN(rv); 18951 18952 return (BCM_E_NONE); 18953 } 18954 18955 /* 18956 * Function: 18957 * _bcm_field_trx2_data_qualifier_packet_format_delete 18958 * Purpose: 18959 * Remove ipprotocol based offset from data qualifier object. 18960 * Parameters: 18961 * unit - (IN) bcm device. 18962 * qual_id - (IN) Data qualifier id. 18963 * pkt_format - (IN) Packet format based udf offset specification. 18964 * Returns: 18965 * BCM_E_XXX 18966 */ 18967 int 18968 _bcm_field_trx2_data_qualifier_packet_format_delete(int unit, int qual_id, 18969 bcm_field_data_packet_format_t *pkt_format) 18970 { 18971 _field_data_tcam_entry_t *tcam_entry_arr; /* Tcam entries array. */ 18972 fp_udf_tcam_entry_t tcam_buf; /* Udf tcam entry. */ 18973 _field_stage_t *stage_fc; /* Stage field control. */ 18974 _field_data_qualifier_t *f_dq; /* Data qualifier descriptor. */ 18975 uint8 priority; /* Udf tcam entry priority. */ 18976 int tcam_idx; /* Tcam insertion index. */ 18977 int rv; /* Operation return status. */ 18978 18979 /* Input parameters check. */ 18980 if (NULL == pkt_format) { 18981 return (BCM_E_PARAM); 18982 } 18983 18984 /* Initialization. */ 18985 sal_memset(&tcam_buf, 0, sizeof(fp_udf_tcam_entry_t)); 18986 18987 /* Get stage field control structure. */ 18988 rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 18989 BCM_IF_ERROR_RETURN(rv); 18990 18991 /* Get data qualifier info. */ 18992 rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id, &f_dq); 18993 BCM_IF_ERROR_RETURN(rv); 18994 18995 /* Initialize packet_format data qualifier key. */ 18996 rv = _field_trx2_data_qualifier_pkt_format_tcam_key_init(unit, pkt_format, 18997 (uint32 *)&tcam_buf, 18998 &priority); 18999 BCM_IF_ERROR_RETURN(rv); 19000 19001 /* Match the tcam entry. */ 19002 rv = _field_trx2_udf_tcam_entry_match(unit, stage_fc, 19003 (uint32*)&tcam_buf, &tcam_idx); 19004 BCM_IF_ERROR_RETURN(rv); 19005 19006 tcam_entry_arr = stage_fc->data_ctrl->tcam_entry_arr; 19007 if (tcam_entry_arr[tcam_idx].ref_count > 0) { 19008 tcam_entry_arr[tcam_idx].ref_count--; 19009 } 19010 19011 /* Initialize udf offset entry. */ 19012 rv = _field_trx2_data_tcam_offset_install(unit, TRUE, f_dq, tcam_idx, -1); 19013 BCM_IF_ERROR_RETURN(rv); 19014 19015 if (0 == tcam_entry_arr[tcam_idx].ref_count) { 19016 /* Reset udf tcam entry. */ 19017 rv = soc_mem_write(unit, FP_UDF_TCAMm, MEM_BLOCK_ALL, tcam_idx, 19018 &soc_mem_entry_null(unit, FP_UDF_TCAMm)); 19019 BCM_IF_ERROR_RETURN(rv); 19020 } 19021 19022 return (BCM_E_NONE); 19023 } 19024 #endif /* BCM_TRIUMPH2_SUPPORT || BCM_TRIDENT_SUPPORT */ 19025 19026 #ifdef BCM_WARM_BOOT_SUPPORT 19027 19028 STATIC soc_field_t _vfp_slice_wide_mode_field[4] = { 19029 SLICE_0_DOUBLE_WIDE_MODEf, 19030 SLICE_1_DOUBLE_WIDE_MODEf, 19031 SLICE_2_DOUBLE_WIDE_MODEf, 19032 SLICE_3_DOUBLE_WIDE_MODEf}; 19033 19034 #if defined (BCM_KATANA_SUPPORT) || defined (BCM_TRIUMPH3_SUPPORT) \ 19035 || defined (BCM_TRIDENT2_SUPPORT) || defined (BCM_TRIUMPH2_SUPPORT) 19036 static _field_flex_stat_info_t flex_info[BCM_MAX_NUM_UNITS] = {{0}}; 19037 #endif 19038 19039 int 19040 _bcm_field_trx_meter_rate_burst_recover(uint32 unit, 19041 uint32 meter_table, 19042 uint32 mem_idx, 19043 uint32 *prate, 19044 uint32 *pburst, 19045 uint32 *cfg_flags 19046 ) 19047 { 19048 uint32 ent[SOC_MAX_MEM_FIELD_WORDS]; 19049 uint32 refresh_rate, granularity, bucket_max; 19050 uint32 flags = (_BCM_XGS_METER_FLAG_GRANULARITY 19051 | _BCM_XGS_METER_FLAG_FP_POLICER); 19052 19053 BCM_IF_ERROR_RETURN(soc_mem_read(unit, meter_table, MEM_BLOCK_ANY, 19054 mem_idx, ent)); 19055 19056 refresh_rate = soc_mem_field32_get(unit, meter_table, ent, REFRESHCOUNTf); 19057 granularity = soc_mem_field32_get(unit, meter_table, ent, METER_GRANf); 19058 bucket_max = soc_mem_field32_get(unit, meter_table, ent, BUCKETSIZEf); 19059 19060 if (SOC_MEM_FIELD_VALID(unit, meter_table, PKTS_BYTESf)) { 19061 if ((soc_mem_field32_get(unit, meter_table, ent, PKTS_BYTESf) == 0x1)) { 19062 flags |= _BCM_XGS_METER_FLAG_PACKET_MODE; 19063 if (SOC_IS_TD2_TT2(unit)) { 19064 flags |= _BCM_XGS_METER_FLAG_FP_TD2_POLICER; 19065 } 19066 *cfg_flags |= BCM_POLICER_MODE_PACKETS; 19067 } 19068 } 19069 19070 BCM_IF_ERROR_RETURN(_bcm_xgs_bucket_encoding_to_kbits 19071 (refresh_rate, bucket_max, granularity, flags, 19072 prate, pburst)); 19073 19074 return (BCM_E_NONE); 19075 } 19076 19077 /* 19078 * Function: 19079 * _field_trx_meter_pool_resolve 19080 * Purpose: 19081 * Given meter pair index, determine meter pool number and meter index 19082 * in meter pool. 19083 * Parameters: 19084 * unit - (IN) BCM device number. 19085 * stage_fc - (IN) FP stage control info. 19086 * meter_pair_idx - (IN) Global meter pair index value. 19087 * pool_num - (OUT) Meter pool number. 19088 * meter_idx - (OUT) Meter pair index in pool number context. 19089 * Returns: 19090 * BCM_E_XXX 19091 */ 19092 19093 int _field_trx_meter_pool_resolve(int unit, _field_stage_t *stage_fc, 19094 int meter_pair_idx, int *pool_num, 19095 int *meter_idx) 19096 { 19097 int pool_idx = _FP_INVALID_INDEX; /* Meter pool number. */ 19098 int meter_index = _FP_INVALID_INDEX; /* Meter index. */ 19099 19100 /* Input parameter check. */ 19101 if (NULL == stage_fc || NULL == pool_num || NULL == meter_idx) { 19102 return (BCM_E_INTERNAL); 19103 } 19104 19105 /* Calculate pool_index and hw_index */ 19106 for (meter_index = meter_pair_idx, pool_idx = 0; 19107 meter_index 19108 >= (stage_fc->meter_pool[_FP_DEF_INST][pool_idx]->num_meter_pairs); 19109 meter_index 19110 -= (stage_fc->meter_pool[_FP_DEF_INST][pool_idx]->num_meter_pairs), 19111 ++pool_idx); 19112 *pool_num = pool_idx; 19113 *meter_idx = meter_index; 19114 return (BCM_E_NONE); 19115 } 19116 19117 /* 19118 * Function: 19119 * _field_trx_meter_index_in_use 19120 * Purpose: 19121 * Returns success if meter index/meter pair is in use. 19122 * Parameters: 19123 * unit - (IN) BCM device number. 19124 * stage_fc - (IN) FP stage control info. 19125 * fs - (IN) Slice where meter resides. 19126 * f_mp - (IN) Meter pool info. 19127 * meter_pair_mode - (IN) Meter mode. 19128 * meter_offset - (IN) Odd/Even meter offset value. 19129 * idx - (IN) Meter pair index. 19130 * Returns: 19131 * BCM_E_XXX 19132 */ 19133 int _field_trx_meter_index_in_use(int unit, _field_stage_t *stage_fc, 19134 _field_slice_t *fs, 19135 _field_meter_pool_t *f_mp, 19136 uint32 meter_pair_mode, 19137 uint32 meter_offset, 19138 int idx) 19139 { 19140 /* Input parameter check. */ 19141 if (NULL == stage_fc || NULL == fs) { 19142 return (BCM_E_INTERNAL); 19143 } 19144 19145 if ((stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) && 19146 (NULL == f_mp)) { 19147 return (BCM_E_INTERNAL); 19148 } 19149 19150 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) { 19151 /* Device stage supports global meter pools. */ 19152 if (meter_pair_mode == BCM_FIELD_METER_MODE_FLOW 19153 && _FP_METER_BMP_TEST(f_mp->meter_bmp, ((idx * 2) + meter_offset))) { 19154 /* Flow mode meter index in use. */ 19155 return (BCM_E_NONE); 19156 } else if (_FP_METER_BMP_TEST(f_mp->meter_bmp, (idx * 2)) 19157 && _FP_METER_BMP_TEST(f_mp->meter_bmp, ((idx * 2) + 1))) { 19158 /* Non-Flow mode meter pair index in use. */ 19159 return (BCM_E_NONE); 19160 } 19161 } else { 19162 /* Meters are per-slice resource. */ 19163 if (meter_pair_mode == BCM_FIELD_METER_MODE_FLOW 19164 && _FP_METER_BMP_TEST(fs->meter_bmp, ((idx * 2) + meter_offset))) { 19165 /* Flow mode meter index in use. */ 19166 return (BCM_E_NONE); 19167 } else if (_FP_METER_BMP_TEST(fs->meter_bmp, (idx * 2)) 19168 && _FP_METER_BMP_TEST(fs->meter_bmp, ((idx * 2) + 1))) { 19169 /* Non-Flow mode meter pair index in use. */ 19170 return (BCM_E_NONE); 19171 } 19172 } 19173 19174 return (BCM_E_NOT_FOUND); 19175 } 19176 19177 /* 19178 * Function: 19179 * _field_trx_meter_recover 19180 * Purpose: 19181 * Recover field entry polier configuration. 19182 * Parameters: 19183 * unit - (IN) BCM device number. 19184 * f_ent - (IN) Field entry structure. 19185 * part - (IN) Field entry part number. 19186 * pid - (IN) Policer identifier. 19187 * level - (IN) Policer level (0/1). 19188 * polic_mem - (IN) Policy table memory name. 19189 * policy_buf - (IN) Policy table entry pointer. 19190 * Returns: 19191 * BCM_E_XXX 19192 */ 19193 STATIC int 19194 _field_trx_meter_recover(int unit, 19195 _field_entry_t *f_ent, 19196 int part, 19197 bcm_policer_t pid, 19198 uint32 level, 19199 soc_mem_t policy_mem, 19200 uint32 *policy_buf, 19201 uint8 *already_recovered 19202 ) 19203 { 19204 _field_group_t *fg; /* Field group information. */ 19205 _field_stage_t *stage_fc; /* Field stage information. */ 19206 _field_control_t *fc; /* Unit field control information. */ 19207 _field_slice_t *fs; /* Field slice information. */ 19208 _field_policer_t *f_pl = NULL; /* Policer descriptor pointer type. */ 19209 _field_entry_policer_t *f_ent_pl; /* Policer attached to entry. */ 19210 int rv, policer_id, meter_hw_idx; /* Meter pair/flow meter hw index. */ 19211 int pair_index = _FP_INVALID_INDEX; /* Global meter pair index value. */ 19212 int pool_index = _FP_INVALID_INDEX; /* Meter pool number. */ 19213 int hw_index = _FP_INVALID_INDEX; /* Pool local meter pair index. */ 19214 soc_field_t mpair_idx_f; /* Meter pair index field. */ 19215 soc_field_t modifier_f; /* Meter modifier field. */ 19216 uint32 idx, found = 0; /* Policer hash idx; Policer found. */ 19217 uint32 flags = 0; /* Policer flags. */ 19218 uint32 meter_pair_mode = 0; /* Flow/SrTcm/TrTcm meter modes. */ 19219 uint32 modifier_mode = 0; /* Committed - 1/Excess meter - 0. */ 19220 uint32 meter_offset = 0; /* Even or Odd meter index. */ 19221 _field_meter_pool_t *f_mp = NULL; /* Meter pool information. */ 19222 _meter_config_t meter_conf; /* Meter configuration in hardware. */ 19223 soc_mem_t meter_mem = INVALIDm; /* Meter memory name. */ 19224 uint32 meter_sharing_mode = -1; /* Meter BW sharing mode */ 19225 /* allocate even meter index for ingress metering for flow mode. 19226 * If set, the non-flow mode is disabled. Is available only for 19227 * Trident+ devices as there is an issue with metering on Y-pipe ports 19228 */ 19229 int use_even_meter; 19230 int is_trident_plus_use_even_meter; 19231 uint16 devid; 19232 uint8 revid; 19233 #if defined(BCM_GREYHOUND2_SUPPORT) 19234 uint32 ent[SOC_MAX_MEM_FIELD_WORDS]; 19235 uint32 meter_mode_tsn_modifier = 0; /* TSN srTCM mode enable or not */ 19236 #endif /* BCM_GREYHOUND2_SUPPORT */ 19237 fg = f_ent->group; 19238 fs = f_ent[part].fs; 19239 19240 sal_memset(&meter_conf, 0, sizeof(_meter_config_t)); 19241 19242 /* Get field control */ 19243 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 19244 19245 /* Get stage control */ 19246 rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc); 19247 BCM_IF_ERROR_RETURN(rv); 19248 19249 is_trident_plus_use_even_meter = 0; 19250 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 19251 use_even_meter = soc_property_get(unit, 19252 spn_FP_EVEN_INDEX_FOR_INGRESS_FLOW_METER, 0); 19253 if (use_even_meter) { 19254 soc_cm_get_id(unit, &devid, &revid); 19255 if ((devid == BCM56842_DEVICE_ID)||(devid == BCM56844_DEVICE_ID)|| 19256 (devid == BCM56846_DEVICE_ID)||(devid == BCM56847_DEVICE_ID)|| 19257 (devid == BCM56053_DEVICE_ID)||(devid == BCM56549_DEVICE_ID)|| 19258 (devid == BCM56831_DEVICE_ID)||(devid == BCM56835_DEVICE_ID)|| 19259 (devid == BCM56838_DEVICE_ID)||(devid == BCM56849_DEVICE_ID) 19260 ) { 19261 is_trident_plus_use_even_meter = 1; 19262 } 19263 } 19264 } 19265 /* Retrieve meter config parameters from policy table and meter table. */ 19266 switch (fg->stage_id) { 19267 case _BCM_FIELD_STAGE_INGRESS: 19268 meter_mem = FP_METER_TABLEm; 19269 /* Get - Flow/SrTcm/TrTcm mode. */ 19270 if (level == 1) { 19271 /* meter BW/Sharing mode 0=OFF, 1=MIN, 2=MAX, 3=MIN+MAX */ 19272 if ((meter_sharing_mode = soc_mem_field32_get( 19273 unit, policy_mem, 19274 policy_buf, 19275 METER_SHARING_MODEf)) 19276 == 0) { 19277 return (BCM_E_NONE); 19278 } 19279 19280 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 19281 SHARED_METER_PAIR_MODEf)){ 19282 meter_pair_mode = soc_mem_field32_get 19283 (unit, policy_mem, 19284 policy_buf, SHARED_METER_PAIR_MODEf); 19285 } 19286 19287 /* Mode - Flow/TrTcmDs */ 19288 switch (meter_pair_mode) { 19289 case 0: 19290 meter_pair_mode = BCM_FIELD_METER_MODE_FLOW; 19291 break; 19292 case 1: 19293 meter_pair_mode = 4; 19294 /* no macro created yet */ 19295 break; 19296 default: 19297 return BCM_E_NONE; 19298 } 19299 mpair_idx_f = SHARED_METER_PAIR_INDEXf; 19300 modifier_f = METER_SHARING_MODE_MODIFIERf; 19301 } else { 19302 if ((meter_pair_mode = soc_mem_field32_get 19303 (unit, policy_mem, 19304 policy_buf, METER_PAIR_MODEf)) 19305 == 0) { 19306 return (BCM_E_NONE); 19307 } 19308 mpair_idx_f = SOC_IS_TD_TT(unit) ? METER_PAIR_INDEX_EVENf 19309 : METER_PAIR_INDEXf; 19310 modifier_f = METER_PAIR_MODE_MODIFIERf; 19311 } 19312 19313 /* Get meter pair index value from policy table. */ 19314 pair_index = soc_mem_field32_get(unit, policy_mem, policy_buf, 19315 mpair_idx_f); 19316 19317 /* modifier_mode: 0 = Excess Meter, 1 = Committed Meter. */ 19318 modifier_mode = soc_mem_field32_get(unit, policy_mem, policy_buf, 19319 modifier_f); 19320 19321 /* Determine meter offset value for flow meters. */ 19322 if (BCM_FIELD_METER_MODE_FLOW == meter_pair_mode) { 19323 /* Trident device supports only Level0 policer mode. */ 19324 if (SOC_IS_TD_TT(unit) && (0 == level)) { 19325 meter_offset = (1 == soc_mem_field32_get(unit, 19326 policy_mem, policy_buf, 19327 METER_TEST_EVENf)) ? 0 : 1; 19328 } else { 19329 meter_offset = (0 == modifier_mode) ? 0 : 1; 19330 } 19331 } 19332 19333 /* Get meter pool number and meter pair index in pool context. */ 19334 BCM_IF_ERROR_RETURN 19335 (_field_trx_meter_pool_resolve(unit, stage_fc, pair_index, 19336 &pool_index, &hw_index)); 19337 19338 /* Get meter pool info pointer. */ 19339 f_mp = stage_fc->meter_pool[_FP_DEF_INST][pool_index]; 19340 19341 /* Setup meter pool to entry slice mapping. */ 19342 if (_FP_INVALID_INDEX == f_mp->slice_id) { 19343 f_mp->slice_id = fg->slices->slice_number; 19344 f_mp->level = level; 19345 } 19346 break; 19347 19348 case _BCM_FIELD_STAGE_EGRESS: 19349 19350 if (stage_fc->oper_mode == bcmFieldGroupOperModeGlobal) { 19351 meter_mem = EFP_METER_TABLEm; 19352 } else if (stage_fc->oper_mode == bcmFieldGroupOperModePipeLocal) { 19353 if (f_ent->group->instance == 0) { 19354 meter_mem = EFP_METER_TABLE_PIPE0m; 19355 } else if (f_ent->group->instance == 1) { 19356 meter_mem = EFP_METER_TABLE_PIPE1m; 19357 } else if (f_ent->group->instance == 2) { 19358 meter_mem = EFP_METER_TABLE_PIPE2m; 19359 } else if (f_ent->group->instance == 3) { 19360 meter_mem = EFP_METER_TABLE_PIPE3m; 19361 } else { 19362 return BCM_E_INTERNAL; 19363 } 19364 } else { 19365 return BCM_E_INTERNAL; 19366 } 19367 19368 meter_conf.meter_mode = soc_mem_field32_get(unit, policy_mem, 19369 policy_buf, 19370 METER_PAIR_MODEf); 19371 meter_conf.meter_idx = soc_mem_field32_get(unit, policy_mem, 19372 policy_buf, 19373 METER_INDEX_EVENf); 19374 meter_conf.meter_update_odd = soc_mem_field32_get(unit, 19375 policy_mem, policy_buf, 19376 METER_UPDATE_ODDf); 19377 meter_conf.meter_test_odd = soc_mem_field32_get(unit, policy_mem, 19378 policy_buf, 19379 METER_TEST_ODDf); 19380 meter_conf.meter_update_even = soc_mem_field32_get(unit, 19381 policy_mem, policy_buf, 19382 METER_UPDATE_EVENf); 19383 meter_conf.meter_test_even = soc_mem_field32_get(unit, 19384 policy_mem, 19385 policy_buf, 19386 METER_TEST_EVENf); 19387 19388 #if defined(BCM_TRIDENT2_SUPPORT) 19389 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 19390 modifier_mode = soc_mem_field32_get(unit, policy_mem, policy_buf, 19391 METER_MODE_MODIFIERf); 19392 } 19393 #endif 19394 /* Get - Flow/SrTcm/TrTcm mode. */ 19395 meter_pair_mode = meter_conf.meter_mode; 19396 19397 /* modifier_mode: 0 = Excess Meter, 1 = Committed Meter. */ 19398 if (BCM_FIELD_METER_MODE_FLOW == meter_pair_mode) { 19399 if (SOC_IS_KATANA2(unit)) { 19400 /* test mode will be set 0 when EFP WAR is enabled */ 19401 modifier_mode = (meter_conf.meter_update_even) ? 0 : 1; 19402 } else { 19403 modifier_mode = (meter_conf.meter_update_even 19404 && meter_conf.meter_test_even) ? 0 : 1; 19405 } 19406 meter_offset = (0 == modifier_mode) ? 0 : 1; 19407 } 19408 19409 /* Slice in which meter config resides. */ 19410 pool_index = fs->slice_number; 19411 19412 /* Slice meter pair index. */ 19413 hw_index = meter_conf.meter_idx; 19414 19415 if ((BCM_FIELD_METER_MODE_DEFAULT == meter_pair_mode) 19416 && (0 == hw_index)) { 19417 /* bcmPolicerModePassThrough */ 19418 return BCM_E_NONE; 19419 } 19420 break; 19421 19422 case _BCM_FIELD_STAGE_EXTERNAL: 19423 meter_mem = FP_METER_TABLEm; 19424 19425 /* Get - Flow/SrTcm/TrTcm mode. */ 19426 if (level == 1) { 19427 if ((meter_pair_mode = soc_mem_field32_get 19428 (unit, policy_mem, policy_buf, 19429 METER_SHARING_MODEf)) 19430 == 0) { 19431 return (BCM_E_NONE); 19432 } 19433 mpair_idx_f = METER_PAIR_INDEXf; 19434 modifier_f = METER_SHARING_MODE_MODIFIERf; 19435 } else { 19436 if ((meter_pair_mode = soc_mem_field32_get(unit, policy_mem, 19437 policy_buf, 19438 METER_PAIR_MODEf)) 19439 == 0) { 19440 return (BCM_E_NONE); 19441 } 19442 19443 mpair_idx_f = METER_PAIR_INDEXf; 19444 modifier_f = METER_PAIR_MODE_MODIFIERf; 19445 } 19446 19447 pair_index = soc_mem_field32_get(unit, policy_mem, policy_buf, 19448 mpair_idx_f); 19449 19450 /* modifier_mode: 0 = Excess Meter, 1 = Committed Meter. */ 19451 modifier_mode = soc_mem_field32_get(unit, policy_mem, policy_buf, 19452 modifier_f); 19453 19454 /* Determine meter offset value for flow meters. */ 19455 if (BCM_FIELD_METER_MODE_FLOW == meter_pair_mode) { 19456 meter_offset = (0 == modifier_mode) ? 0 : 1; 19457 } 19458 19459 /* Get meter pool number and meter index. */ 19460 BCM_IF_ERROR_RETURN 19461 (_field_trx_meter_pool_resolve(unit, stage_fc, pair_index, 19462 &pool_index, &hw_index)); 19463 f_mp = stage_fc->meter_pool[_FP_DEF_INST][pool_index]; 19464 if (_FP_INVALID_INDEX == f_mp->slice_id) { 19465 f_mp->slice_id = stage_fc->tcam_slices; 19466 f_mp->level = level; 19467 } 19468 break; 19469 19470 default: 19471 /* Must be a valid stage. */ 19472 return (BCM_E_INTERNAL); 19473 } 19474 19475 /* Check if meter index is already in use. */ 19476 if (BCM_SUCCESS(_field_trx_meter_index_in_use(unit, stage_fc, fs, f_mp, 19477 meter_pair_mode, 19478 meter_offset, 19479 hw_index))) { 19480 found = 0; 19481 /* 19482 * Check and increment reference count for poliers that are 19483 * attached to more than one entry. 19484 */ 19485 for (idx = 0; idx < _FP_HASH_SZ(fc); idx++) { 19486 f_pl = fc->policer_hash[idx]; 19487 while (f_pl != NULL) { 19488 if ((f_pl->hw_index == hw_index) && 19489 (f_pl->pool_index == pool_index) && 19490 (f_pl->stage_id == fg->stage_id)) { 19491 if (meter_pair_mode == BCM_FIELD_METER_MODE_FLOW) { 19492 if (SOC_IS_TD_TT(unit) && 19493 (f_pl->stage_id == _BCM_FIELD_STAGE_INGRESS)) { 19494 if (((meter_offset == 1) && 19495 (_FP_POLICER_EXCESS_HW_METER(f_pl))) || 19496 ((meter_offset == 0) && 19497 !(_FP_POLICER_EXCESS_HW_METER(f_pl)))) { 19498 f_pl = f_pl->next; 19499 continue; 19500 } else { 19501 found = 1; 19502 break; 19503 } 19504 } else { 19505 if (((modifier_mode == 1) && 19506 (_FP_POLICER_EXCESS_HW_METER(f_pl))) || 19507 ((modifier_mode == 0) && 19508 !(_FP_POLICER_EXCESS_HW_METER(f_pl)))) { 19509 f_pl = f_pl->next; 19510 continue; 19511 } else { 19512 found =1; 19513 break; 19514 } 19515 } 19516 } else { 19517 found = 1; 19518 break; 19519 } 19520 } 19521 f_pl = f_pl->next; 19522 } 19523 if (found) { 19524 break; 19525 } 19526 } 19527 if (!found) { 19528 return BCM_E_INTERNAL; 19529 } 19530 f_pl->hw_ref_count++; 19531 f_pl->sw_ref_count++; 19532 } else { 19533 /* Policer does not exist => Allocate new policer object */ 19534 if (fc->l2warm) { 19535 policer_id = pid; 19536 } else { 19537 BCM_IF_ERROR_RETURN(_field_policer_id_alloc(unit, &policer_id)); 19538 } 19539 19540 _FP_XGS3_ALLOC(f_pl, sizeof (_field_policer_t), "Field policer entity"); 19541 if (f_pl == NULL) { 19542 return (BCM_E_MEMORY); 19543 } 19544 19545 flags |= _FP_POLICER_INSTALLED; 19546 if ((f_pl->level = level) == 1 && meter_sharing_mode == 1) { 19547 f_pl->cfg.flags |= BCM_POLICER_COLOR_MERGE_OR; 19548 } 19549 f_pl->sw_ref_count = 2; 19550 f_pl->hw_ref_count = 1; 19551 f_pl->pid = policer_id; 19552 f_pl->stage_id = fg->stage_id; 19553 f_pl->pool_index = pool_index; 19554 f_pl->cfg.pool_id = f_pl->pool_index; 19555 f_pl->hw_index = hw_index; 19556 19557 /* Calculate hardware meter index. */ 19558 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) { 19559 /* 19560 * Hw index is: 19561 * ((Pool number * pool_size) + (2 * pair number) 19562 */ 19563 meter_hw_idx = (pool_index * 19564 stage_fc->meter_pool[_FP_DEF_INST][pool_index]->size) 19565 + (2 * hw_index); 19566 } else { 19567 /* 19568 * Hw index is: 19569 * (slice index) + (2 * pair number) 19570 */ 19571 meter_hw_idx = 19572 stage_fc->slices[_FP_DEF_INST][pool_index].start_tcam_idx 19573 + (2 * hw_index); 19574 } 19575 19576 switch (meter_pair_mode) { 19577 case BCM_FIELD_METER_MODE_DEFAULT: /* 0 */ 19578 f_pl->cfg.mode = bcmPolicerModeGreen; 19579 break; 19580 19581 case BCM_FIELD_METER_MODE_FLOW: /* 1 */ 19582 switch (fg->stage_id) { 19583 case _BCM_FIELD_STAGE_INGRESS: 19584 case _BCM_FIELD_STAGE_EXTERNAL: 19585 if (SOC_IS_TD_TT(unit)) { 19586 f_pl->cfg.mode = bcmPolicerModeCommitted; 19587 if (meter_offset) { 19588 /* Flow mode using committed hardware meter. */ 19589 _FP_POLICER_EXCESS_HW_METER_CLEAR(f_pl); 19590 } else { 19591 /* Flow mode using excess hardware meter. */ 19592 _FP_POLICER_EXCESS_HW_METER_SET(f_pl); 19593 } 19594 } else { 19595 f_pl->cfg.mode = bcmPolicerModeCommitted; 19596 if (1 == modifier_mode) { 19597 /* Flow mode using committed hardware meter. */ 19598 _FP_POLICER_EXCESS_HW_METER_CLEAR(f_pl); 19599 } else if (0 == modifier_mode) { 19600 /* Flow mode using excess hardware meter. */ 19601 _FP_POLICER_EXCESS_HW_METER_SET(f_pl); 19602 } else { 19603 sal_free(f_pl); 19604 return BCM_E_INTERNAL; 19605 } 19606 } 19607 19608 /* Update with meter_offset for flow mode meters. */ 19609 meter_hw_idx += meter_offset; 19610 19611 /* Get policer rates. */ 19612 _bcm_field_trx_meter_rate_burst_recover(unit, 19613 FP_METER_TABLEm, meter_hw_idx, 19614 &f_pl->cfg.ckbits_sec, 19615 &f_pl->cfg.ckbits_burst, 19616 &f_pl->cfg.flags); 19617 break; 19618 19619 case _BCM_FIELD_STAGE_EGRESS: 19620 f_pl->cfg.mode = bcmPolicerModeCommitted; 19621 if (1 == modifier_mode) { 19622 /* Flow mode using committed hardware meter. */ 19623 _FP_POLICER_EXCESS_HW_METER_CLEAR(f_pl); 19624 } else if (0 == modifier_mode) { 19625 /* Flow mode using excess hardware meter. */ 19626 _FP_POLICER_EXCESS_HW_METER_SET(f_pl); 19627 } else { 19628 sal_free(f_pl); 19629 return BCM_E_INTERNAL; 19630 } 19631 19632 /* Update with meter_offset for flow mode meters. */ 19633 meter_hw_idx += meter_offset; 19634 19635 _bcm_field_trx_meter_rate_burst_recover(unit, 19636 meter_mem, meter_hw_idx, 19637 &f_pl->cfg.ckbits_sec, 19638 &f_pl->cfg.ckbits_burst, 19639 &f_pl->cfg.flags); 19640 19641 if (SOC_IS_KATANA2(unit) && 19642 ((_FP_POLICER_EXCESS_HW_METER(f_pl) && 19643 (0 == meter_conf.meter_test_even)) || 19644 (_FP_POLICER_COMMITTED_HW_METER(f_pl) && 19645 (0 == meter_conf.meter_test_odd)))) { 19646 f_pl->cfg.flags |= BCM_POLICER_AS_PACKET_COUNTER; 19647 f_pl->cfg.flags |= BCM_POLICER_MODE_PACKETS; 19648 f_pl->cfg.ckbits_sec = 0; 19649 f_pl->cfg.ckbits_burst = 0; 19650 f_pl->cfg.bucket_width = 30; 19651 f_pl->cfg.token_gran = 250; 19652 f_pl->cfg.bucket_init_val = 0xFFF << 16; 19653 f_pl->cfg.bucket_rollover_val = 0x20000052; 19654 } 19655 break; 19656 default: 19657 /* Must be a valid pipeline stage. */ 19658 return (BCM_E_INTERNAL); 19659 } 19660 break; 19661 19662 case BCM_FIELD_METER_MODE_trTCM_COLOR_BLIND: /* 2 */ 19663 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 19664 /* Fall through */ 19665 case BCM_FIELD_METER_MODE_trTCM_COLOR_AWARE: /* 3 */ 19666 f_pl->cfg.mode = bcmPolicerModeTrTcm; 19667 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 19668 meter_hw_idx, &f_pl->cfg.pkbits_sec, 19669 &f_pl->cfg.pkbits_burst, 19670 &f_pl->cfg.flags); 19671 19672 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 19673 meter_hw_idx + 1, &f_pl->cfg.ckbits_sec, 19674 &f_pl->cfg.ckbits_burst, 19675 &f_pl->cfg.flags); 19676 break; 19677 19678 case BCM_FIELD_METER_MODE_srTCM_COLOR_BLIND: /* 6 */ 19679 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 19680 /* Fall through */ 19681 case BCM_FIELD_METER_MODE_srTCM_COLOR_AWARE: /* 7 */ 19682 f_pl->cfg.mode = modifier_mode 19683 ? bcmPolicerModeSrTcmModified 19684 : bcmPolicerModeSrTcm; 19685 #if defined(BCM_GREYHOUND2_SUPPORT) 19686 if (SOC_IS_GREYHOUND2(unit)) { 19687 /* Update with meter_offset for flow mode meters. */ 19688 meter_hw_idx += meter_offset; 19689 if (SOC_MEM_FIELD_VALID(unit, meter_mem, 19690 METER_MODE_TSN_MODIFIERf)) { 19691 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 19692 meter_mem, 19693 MEM_BLOCK_ANY, 19694 meter_hw_idx, 19695 ent)); 19696 meter_mode_tsn_modifier = 19697 soc_mem_field32_get(unit, meter_mem, 19698 ent, METER_MODE_TSN_MODIFIERf); 19699 if (1 == meter_mode_tsn_modifier) { 19700 f_pl->cfg.mode = bcmPolicerModeSrTcmTsn; 19701 } 19702 } 19703 } 19704 #endif /* BCM_GREYHOUND2_SUPPORT */ 19705 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 19706 meter_hw_idx, &f_pl->cfg.pkbits_sec, 19707 &f_pl->cfg.pkbits_burst, 19708 &f_pl->cfg.flags); 19709 19710 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 19711 meter_hw_idx + 1, &f_pl->cfg.ckbits_sec, 19712 &f_pl->cfg.ckbits_burst, 19713 &f_pl->cfg.flags); 19714 break; 19715 case 4: 19716 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 19717 /* Fall through */ 19718 case 5: 19719 f_pl->cfg.mode = modifier_mode 19720 ? bcmPolicerModeCoupledTrTcmDs 19721 : bcmPolicerModeTrTcmDs; 19722 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 19723 meter_hw_idx, &f_pl->cfg.pkbits_sec, 19724 &f_pl->cfg.pkbits_burst, 19725 &f_pl->cfg.flags); 19726 19727 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 19728 meter_hw_idx + 1, &f_pl->cfg.ckbits_sec, 19729 &f_pl->cfg.ckbits_burst, 19730 &f_pl->cfg.flags); 19731 break; 19732 default: 19733 ; 19734 } 19735 19736 /* In Tomahawk EFP metering, Refresh tick duration has changed from 19737 * 7.8125us to 15.625us ,but the RTL does not double the REFRESHCOUNT 19738 * while putting the tokens into the bucket which is causing 50% lesser 19739 * traffic rate than expected. So the work around is the value programmed 19740 * from software in EFP meters needs to be doubled. 19741 */ 19742 19743 if ((soc_feature(unit, soc_feature_field_multi_pipe_support)) 19744 && (_BCM_FIELD_STAGE_EGRESS == stage_fc->stage_id)) { 19745 f_pl->cfg.ckbits_sec = (f_pl->cfg.ckbits_sec / 2) ; 19746 f_pl->cfg.pkbits_sec = (f_pl->cfg.pkbits_sec / 2) ; 19747 } 19748 19749 /* Assume policer was created using the policer_create API */ 19750 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 19751 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 19752 if ((part == 2) || (part == 3)) { 19753 f_ent->flags |= _FP_ENTRY_POLICER_IN_SECONDARY_SLICE; 19754 } 19755 } else { 19756 if (part == 1) { 19757 f_ent->flags |= _FP_ENTRY_POLICER_IN_SECONDARY_SLICE; 19758 } 19759 } 19760 } 19761 19762 _FP_HASH_INSERT(fc->policer_hash, f_pl, 19763 (policer_id & _FP_HASH_INDEX_MASK(fc))); 19764 fc->policer_count++; 19765 19766 /* Mark meter index as used in slice/pool */ 19767 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS 19768 && (_BCM_FIELD_STAGE_EGRESS != fg->stage_id)) { 19769 if (!_FP_POLICER_IS_FLOW_MODE(f_pl)) { 19770 _FP_METER_BMP_ADD(f_mp->meter_bmp, (hw_index * 2)); 19771 _FP_METER_BMP_ADD(f_mp->meter_bmp, ((hw_index * 2) + 1)); 19772 f_mp->free_meters -= 2; 19773 } else { 19774 _FP_METER_BMP_ADD(f_mp->meter_bmp, 19775 ((hw_index * 2) + meter_offset)); 19776 f_mp->free_meters--; 19777 if (is_trident_plus_use_even_meter) { 19778 f_mp->free_meters--; 19779 } 19780 } 19781 } else { 19782 if (!_FP_POLICER_IS_FLOW_MODE(f_pl)) { 19783 _FP_METER_BMP_ADD(fs->meter_bmp, (hw_index * 2)); 19784 _FP_METER_BMP_ADD(fs->meter_bmp, ((hw_index * 2) + 1)); 19785 } else { 19786 _FP_METER_BMP_ADD(fs->meter_bmp, 19787 ((hw_index * 2) + meter_offset)); 19788 } 19789 } 19790 fg->group_status.meter_count++; 19791 if (is_trident_plus_use_even_meter) { 19792 fg->group_status.meter_count++; 19793 } 19794 } 19795 19796 /* Associate the policer object with the entry */ 19797 f_ent_pl = &f_ent->policer[level]; 19798 f_ent_pl->flags |= (_FP_POLICER_VALID | flags); 19799 f_ent_pl->pid = f_pl->pid; 19800 *already_recovered = 1; 19801 19802 return BCM_E_NONE; 19803 } 19804 19805 /* 19806 * Function: 19807 * _field_sc_cq_meter_recover 19808 * Purpose: 19809 * Recover field entry polier configuration. 19810 * Parameters: 19811 * unit - (IN) BCM device number. 19812 * f_ent - (IN) Field entry structure. 19813 * part - (IN) Field entry part number. 19814 * pid - (IN) Policer identifier. 19815 * policy_buf - (IN) Policy table entry pointer. 19816 * already_recovered - (IN) Flag to check already recovered policers 19817 * Returns: 19818 * BCM_E_XXX 19819 */ 19820 STATIC int 19821 _field_sc_cq_meter_recover(int unit, 19822 _field_entry_t *f_ent, 19823 int part, 19824 bcm_policer_t pid, 19825 uint32 *policy_buf, 19826 uint8 *already_recovered 19827 ) 19828 { 19829 int rv, policer_id; /* Policer identifier. */ 19830 int pair_index = _FP_INVALID_INDEX; /* Global meter pair index. */ 19831 int meter_hw_idx = _FP_INVALID_INDEX; /* Meter index value. */ 19832 int pool_index = _FP_INVALID_INDEX; /* Meter pool index. */ 19833 int hw_index = _FP_INVALID_INDEX; /* Pool local meter pair index. */ 19834 uint32 ent_pl_flags = 0; /* Entry policer flags. */ 19835 uint32 stage_id; /* Field processor Stage ID. */ 19836 uint32 meter_pair_mode = 0; /* Flow/SrTcm/TrTcm meter modes. */ 19837 uint32 modifier_mode = 0; /* Committed(1)/Excess(0) meter. */ 19838 uint32 meter_offset = 0; /* Even or Odd meter index. */ 19839 _field_group_t *fg; /* Field group information. */ 19840 _field_stage_t *stage_fc; /* Field stage information. */ 19841 _field_control_t *fc; /* Field control information. */ 19842 _field_slice_t *fs; /* Field slice information. */ 19843 _field_policer_t *f_pl = NULL; /* Policer descriptor info. */ 19844 _field_entry_policer_t *f_ent_pl; /* Policer attached to entry. */ 19845 _field_meter_pool_t *f_mp = NULL; /* Meter pool information. */ 19846 _meter_config_t meter_conf; /* Meter config in hardware. */ 19847 soc_mem_t meter_mem; /* Meter memory name. */ 19848 19849 fg = f_ent->group; 19850 fs = f_ent[part].fs; 19851 19852 /* Get field control handle. */ 19853 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 19854 stage_id = f_ent->group->stage_id; 19855 19856 /* Get unit stage control handle. */ 19857 rv = _field_stage_control_get(unit, stage_id, &stage_fc); 19858 BCM_IF_ERROR_RETURN(rv); 19859 19860 switch (stage_id) { 19861 /* Ingress stage */ 19862 case _BCM_FIELD_STAGE_INGRESS: 19863 meter_mem = FP_METER_TABLEm; 19864 meter_conf.meter_mode 19865 = soc_mem_field32_get(unit, FP_POLICY_TABLEm, policy_buf, 19866 METER_PAIR_MODEf); 19867 meter_conf.meter_mode_modifier 19868 = soc_mem_field32_get(unit, FP_POLICY_TABLEm, policy_buf, 19869 METER_PAIR_MODE_MODIFIERf); 19870 meter_conf.meter_idx 19871 = soc_mem_field32_get(unit, FP_POLICY_TABLEm, policy_buf, 19872 METER_INDEX_EVENf); 19873 meter_conf.meter_update_odd 19874 = soc_mem_field32_get(unit, FP_POLICY_TABLEm, policy_buf, 19875 METER_UPDATE_ODDf); 19876 meter_conf.meter_test_odd 19877 = soc_mem_field32_get(unit, FP_POLICY_TABLEm, policy_buf, 19878 METER_TEST_ODDf); 19879 meter_conf.meter_update_even 19880 = soc_mem_field32_get(unit, FP_POLICY_TABLEm, policy_buf, 19881 METER_UPDATE_EVENf); 19882 meter_conf.meter_test_even 19883 = soc_mem_field32_get(unit, FP_POLICY_TABLEm, policy_buf, 19884 METER_TEST_EVENf); 19885 19886 meter_pair_mode = meter_conf.meter_mode; 19887 pair_index = meter_conf.meter_idx; 19888 if ((meter_pair_mode == 0) && (pair_index == 0)) { 19889 return BCM_E_NONE; 19890 } 19891 19892 if (BCM_FIELD_METER_MODE_FLOW == meter_pair_mode) { 19893 /* modifier_mode: 0 = Excess Meter, 1 = Committed Meter. */ 19894 modifier_mode = meter_conf.meter_mode_modifier; 19895 /* Determine meter offset value for flow meters. */ 19896 meter_offset = (0 == modifier_mode) ? 0 : 1; 19897 } 19898 19899 /* Get meter pool number and meter index. */ 19900 BCM_IF_ERROR_RETURN 19901 (_field_trx_meter_pool_resolve(unit, stage_fc, pair_index, 19902 &pool_index, &hw_index)); 19903 19904 f_mp = stage_fc->meter_pool[_FP_DEF_INST][pool_index]; 19905 if (_FP_INVALID_INDEX == f_mp->slice_id) { 19906 f_mp->slice_id = fg->slices->slice_number; 19907 f_mp->level = 0; 19908 } 19909 break; 19910 case _BCM_FIELD_STAGE_EGRESS: 19911 /* Egress stage */ 19912 meter_mem = EFP_METER_TABLEm; 19913 meter_conf.meter_mode = soc_mem_field32_get(unit, EFP_POLICY_TABLEm, 19914 policy_buf, 19915 METER_PAIR_MODEf); 19916 meter_conf.meter_idx = soc_mem_field32_get(unit, EFP_POLICY_TABLEm, 19917 policy_buf, 19918 METER_INDEX_EVENf); 19919 meter_conf.meter_update_odd = soc_mem_field32_get(unit, 19920 EFP_POLICY_TABLEm, policy_buf, 19921 METER_UPDATE_ODDf); 19922 meter_conf.meter_test_odd = soc_mem_field32_get(unit, 19923 EFP_POLICY_TABLEm, policy_buf, 19924 METER_TEST_ODDf); 19925 meter_conf.meter_update_even = soc_mem_field32_get(unit, 19926 EFP_POLICY_TABLEm, policy_buf, 19927 METER_UPDATE_EVENf); 19928 meter_conf.meter_test_even = soc_mem_field32_get(unit, 19929 EFP_POLICY_TABLEm, policy_buf, 19930 METER_TEST_EVENf); 19931 meter_pair_mode = meter_conf.meter_mode; 19932 pool_index = fs->slice_number; 19933 hw_index = meter_conf.meter_idx; 19934 if ((meter_pair_mode == 0) && (hw_index == 0)) { 19935 return BCM_E_NONE; 19936 } 19937 19938 if (BCM_FIELD_METER_MODE_FLOW == meter_pair_mode) { 19939 /* modifier_mode: 0 = Excess Meter, 1 = Committed Meter. */ 19940 modifier_mode = (meter_conf.meter_update_even 19941 && meter_conf.meter_test_even) ? 0 : 1; 19942 /* Determine meter offset value for flow meters. */ 19943 meter_offset = (0 == modifier_mode) ? 0 : 1; 19944 } 19945 break; 19946 default: 19947 /* Must be a valid stage. */ 19948 return (BCM_E_INTERNAL); 19949 } 19950 19951 /* Check if meter index is already in use. */ 19952 if (BCM_SUCCESS(_field_trx_meter_index_in_use(unit, stage_fc, fs, f_mp, 19953 meter_pair_mode, 19954 meter_offset, 19955 hw_index))) { 19956 uint32 idx, found = 0; 19957 19958 for (idx = 0; idx < _FP_HASH_SZ(fc); idx++) { 19959 f_pl = fc->policer_hash[idx]; 19960 while (f_pl != NULL) { 19961 if ((f_pl->hw_index == hw_index) && 19962 (f_pl->pool_index == pool_index) && 19963 (f_pl->stage_id == fg->stage_id)) { 19964 if (meter_pair_mode == BCM_FIELD_METER_MODE_FLOW) { 19965 if (((meter_offset == 1) && 19966 (_FP_POLICER_EXCESS_HW_METER(f_pl))) || 19967 ((meter_offset == 0) && 19968 !(_FP_POLICER_EXCESS_HW_METER(f_pl)))) { 19969 f_pl = f_pl->next; 19970 continue; 19971 } else { 19972 found = 1; 19973 break; 19974 } 19975 } else { 19976 found = 1; 19977 break; 19978 } 19979 } 19980 f_pl = f_pl->next; 19981 } 19982 if (found) { 19983 break; 19984 } 19985 } 19986 if (!found) { 19987 return BCM_E_INTERNAL; 19988 } 19989 f_pl->hw_ref_count++; 19990 f_pl->sw_ref_count++; 19991 } else { 19992 /* Policer does not exist => Allocate new policer object */ 19993 if (fc->l2warm) { 19994 policer_id = pid; 19995 } else { 19996 BCM_IF_ERROR_RETURN(_field_policer_id_alloc(unit, &policer_id)); 19997 } 19998 19999 _FP_XGS3_ALLOC(f_pl, sizeof (_field_policer_t), "Field policer entity"); 20000 if (f_pl == NULL) { 20001 return (BCM_E_MEMORY); 20002 } 20003 20004 ent_pl_flags |= _FP_POLICER_INSTALLED; 20005 f_pl->sw_ref_count = 2; 20006 f_pl->hw_ref_count = 1; 20007 f_pl->pid = policer_id; 20008 f_pl->stage_id = fg->stage_id; 20009 f_pl->pool_index = pool_index; 20010 f_pl->cfg.pool_id = f_pl->pool_index; 20011 f_pl->hw_index = hw_index; 20012 20013 /* Calculate hardware meter index. */ 20014 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) { 20015 /* 20016 * Hw index is: 20017 * ((Pool number * pool_size) + (2 * pair number) 20018 */ 20019 meter_hw_idx = (pool_index * 20020 stage_fc->meter_pool[_FP_DEF_INST][pool_index]->size) 20021 + (2 * hw_index); 20022 } else { 20023 /* 20024 * Hw index is: 20025 * (slice index) + (2 * pair number) 20026 */ 20027 meter_hw_idx = 20028 stage_fc->slices[_FP_DEF_INST][pool_index].start_tcam_idx 20029 + (2 * hw_index); 20030 } 20031 20032 switch (meter_pair_mode) { 20033 case BCM_FIELD_METER_MODE_DEFAULT: 20034 f_pl->cfg.mode = bcmPolicerModeGreen; 20035 break; 20036 20037 case BCM_FIELD_METER_MODE_FLOW: 20038 f_pl->cfg.mode = bcmPolicerModeCommitted; 20039 if (meter_offset) { 20040 /* Flow mode using committed hardware meter. */ 20041 _FP_POLICER_EXCESS_HW_METER_CLEAR(f_pl); 20042 } else { 20043 /* Flow mode using excess hardware meter. */ 20044 _FP_POLICER_EXCESS_HW_METER_SET(f_pl); 20045 } 20046 meter_hw_idx += meter_offset; 20047 _bcm_field_trx_meter_rate_burst_recover(unit, 20048 meter_mem, meter_hw_idx, &f_pl->cfg.ckbits_sec, 20049 &f_pl->cfg.ckbits_burst, 20050 &f_pl->cfg.flags); 20051 break; 20052 20053 case BCM_FIELD_METER_MODE_trTCM_COLOR_BLIND: 20054 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 20055 /* Fall through */ 20056 case BCM_FIELD_METER_MODE_trTCM_COLOR_AWARE: 20057 f_pl->cfg.mode = bcmPolicerModeTrTcm; 20058 20059 /* Get excess meter config from hardware. */ 20060 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 20061 meter_hw_idx, &f_pl->cfg.pkbits_sec, 20062 &f_pl->cfg.pkbits_burst, 20063 &f_pl->cfg.flags); 20064 20065 /* Get committed meter config from hardware. */ 20066 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 20067 (meter_hw_idx + 1), &f_pl->cfg.ckbits_sec, 20068 &f_pl->cfg.ckbits_burst, 20069 &f_pl->cfg.flags); 20070 20071 break; 20072 case 4: 20073 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 20074 /* Fall through */ 20075 case 5: 20076 f_pl->cfg.mode = bcmPolicerModeTrTcmDs; 20077 20078 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 20079 meter_hw_idx, &f_pl->cfg.pkbits_sec, 20080 &f_pl->cfg.pkbits_burst, 20081 &f_pl->cfg.flags); 20082 20083 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 20084 meter_hw_idx + 1, &f_pl->cfg.ckbits_sec, 20085 &f_pl->cfg.ckbits_burst, 20086 &f_pl->cfg.flags); 20087 break; 20088 case BCM_FIELD_METER_MODE_srTCM_COLOR_BLIND: 20089 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 20090 /* Fall through */ 20091 case BCM_FIELD_METER_MODE_srTCM_COLOR_AWARE: 20092 f_pl->cfg.mode = bcmPolicerModeSrTcm; 20093 20094 /* Get excess meter config from hardware. */ 20095 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 20096 meter_hw_idx, &f_pl->cfg.pkbits_sec, 20097 &f_pl->cfg.pkbits_burst, 20098 &f_pl->cfg.flags); 20099 20100 /* Get committed meter config from hardware. */ 20101 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 20102 (meter_hw_idx + 1), &f_pl->cfg.ckbits_sec, 20103 &f_pl->cfg.ckbits_burst, 20104 &f_pl->cfg.flags); 20105 20106 break; 20107 default: 20108 break; 20109 } 20110 20111 /* Assume policer was created using the policer_create API */ 20112 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 20113 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 20114 if ((part == 2) || (part == 3)) { 20115 f_ent->flags |= _FP_ENTRY_POLICER_IN_SECONDARY_SLICE; 20116 } 20117 } else { 20118 if (part == 1) { 20119 f_ent->flags |= _FP_ENTRY_POLICER_IN_SECONDARY_SLICE; 20120 } 20121 } 20122 } 20123 _FP_HASH_INSERT(fc->policer_hash, f_pl, 20124 (policer_id & _FP_HASH_INDEX_MASK(fc))); 20125 fc->policer_count++; 20126 20127 /* Mark meter index as used in slice/pool */ 20128 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS 20129 && (_BCM_FIELD_STAGE_EGRESS != stage_id)) { 20130 if (!_FP_POLICER_IS_FLOW_MODE(f_pl)) { 20131 _FP_METER_BMP_ADD(f_mp->meter_bmp, (hw_index * 2)); 20132 _FP_METER_BMP_ADD(f_mp->meter_bmp, ((hw_index * 2) + 1)); 20133 f_mp->free_meters -= 2; 20134 } else { 20135 _FP_METER_BMP_ADD(f_mp->meter_bmp, 20136 ((hw_index * 2) + meter_offset)); 20137 f_mp->free_meters--; 20138 } 20139 } else { 20140 if (!_FP_POLICER_IS_FLOW_MODE(f_pl)) { 20141 _FP_METER_BMP_ADD(fs->meter_bmp, (hw_index * 2)); 20142 _FP_METER_BMP_ADD(fs->meter_bmp, ((hw_index * 2) + 1)); 20143 } else { 20144 _FP_METER_BMP_ADD(fs->meter_bmp, 20145 ((hw_index * 2) + meter_offset)); 20146 } 20147 } 20148 fg->group_status.meter_count++; 20149 } 20150 20151 /* Associate the policer object with the entry */ 20152 f_ent_pl = &f_ent->policer[0]; 20153 f_ent_pl->flags |= (_FP_POLICER_VALID | ent_pl_flags); 20154 f_ent_pl->pid = f_pl->pid; 20155 *already_recovered = 1; 20156 20157 return BCM_E_NONE; 20158 } 20159 20160 STATIC int 20161 _field_tr2_counter_recover(int unit, 20162 _field_entry_t *f_ent, 20163 uint32 ctr_mode, 20164 uint32 ctr_idx, 20165 int part, 20166 bcm_field_stat_t sid 20167 ) 20168 { 20169 _field_group_t *fg; 20170 _field_stage_t *stage_fc; 20171 _field_stage_id_t stage_id; 20172 _field_control_t *fc; 20173 _field_slice_t *fs; 20174 _field_stat_t *f_st = NULL; 20175 _field_entry_stat_t *f_ent_st = NULL; 20176 int rv, idx, stat_id, found; 20177 uint32 sub_mode = 0, ent_st_flags = 0; 20178 bcm_field_stat_t stat_arr[4]; 20179 uint8 nstat = 2; 20180 uint8 hw_entry_count = 1; 20181 #if defined(BCM_TRIDENT_SUPPORT) 20182 int index = 0, rshift = 0; 20183 #endif 20184 20185 fg = f_ent->group; 20186 fs = f_ent[part].fs; 20187 20188 /* Get field control and stage control */ 20189 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 20190 stage_id = f_ent->group->stage_id; 20191 rv = _field_stage_control_get(unit, stage_id, &stage_fc); 20192 BCM_IF_ERROR_RETURN(rv); 20193 20194 sal_memset(stat_arr, 0, sizeof(stat_arr)); 20195 20196 /* Search if counter has already been detected */ 20197 /* Go over the counter in the slice */ 20198 #if defined(BCM_TRIDENT_SUPPORT) 20199 if ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) && 20200 (stage_id == _BCM_FIELD_STAGE_INGRESS)){ 20201 hw_entry_count = 20202 ((ctr_mode & (0x7)) ? 1 : 0) + ((ctr_mode & (0x7 << 3)) ? 1 : 0); 20203 } else 20204 #endif 20205 { 20206 sub_mode = ctr_mode & ~BCM_FIELD_COUNTER_MODE_BYTES; 20207 if ((sub_mode == BCM_FIELD_COUNTER_MODE_RED) || 20208 (sub_mode == BCM_FIELD_COUNTER_MODE_YELLOW) || 20209 (sub_mode == BCM_FIELD_COUNTER_MODE_GREEN) || 20210 (sub_mode == BCM_FIELD_COUNTER_MODE_YES_NO) || 20211 (sub_mode == BCM_FIELD_COUNTER_MODE_DEFAULT)) { 20212 hw_entry_count = 1; 20213 } else { 20214 hw_entry_count = 2; 20215 } 20216 } 20217 20218 found = 0; 20219 if (stage_id != _BCM_FIELD_STAGE_EXTERNAL) { 20220 if (((_FP_COUNTER_BMP_TEST(fs->counter_bmp, 2 * ctr_idx)) && 20221 (_FP_COUNTER_BMP_TEST(fs->counter_bmp, 2 * ctr_idx + 1)) && 20222 (hw_entry_count == 2)) || 20223 ((_FP_COUNTER_BMP_TEST(fs->counter_bmp, 2 * ctr_idx + 1)) && 20224 (hw_entry_count == 1) && (ctr_mode % 2 == 0)) || 20225 ((_FP_COUNTER_BMP_TEST(fs->counter_bmp, 2 * ctr_idx)) && 20226 (hw_entry_count == 1) && (ctr_mode % 2))) { 20227 /* Counter has been detected - increment reference count */ 20228 /* Happens when counter is shared by different entries */ 20229 /* Search the hash to match against the HW index */ 20230 20231 for (idx = 0; idx < _FP_HASH_SZ(fc); idx++) { 20232 f_st = fc->stat_hash[idx]; 20233 while (f_st != NULL) { 20234 if ((f_st->hw_index == ctr_idx) && 20235 (f_st->pool_index == fs->slice_number) && 20236 (f_st->hw_mode == ctr_mode) && 20237 (f_st->stage_id == stage_id)) { 20238 found = 1; 20239 break; 20240 } 20241 f_st = f_st->next; 20242 } 20243 if (found) { 20244 break; 20245 } 20246 } 20247 if (!found) { 20248 return BCM_E_INTERNAL; 20249 } 20250 f_st->hw_ref_count++; 20251 f_st->sw_ref_count++; 20252 f_ent_st = &f_ent->statistic; 20253 } 20254 } 20255 20256 if (!found) { 20257 /* Allocate new stat object */ 20258 if (fc->l2warm) { 20259 stat_id = sid; 20260 } else { 20261 BCM_IF_ERROR_RETURN(_bcm_field_stat_id_alloc(unit, &stat_id)); 20262 } 20263 _FP_XGS3_ALLOC(f_st, sizeof (_field_stat_t), "Field stat entity"); 20264 if (NULL == f_st) { 20265 return (BCM_E_MEMORY); 20266 } 20267 ent_st_flags |= _FP_ENTRY_STAT_INSTALLED; 20268 f_st->sw_ref_count = 2; 20269 f_st->hw_ref_count = 1; 20270 f_st->pool_index = fs->slice_number; 20271 f_st->hw_index = ctr_idx; 20272 f_st->sid = stat_id; 20273 f_st->stage_id = fg->stage_id; 20274 f_st->gid = fg->gid; 20275 f_st->hw_mode = ctr_mode; 20276 f_ent_st = &f_ent->statistic; 20277 #if defined(BCM_TRIDENT_SUPPORT) 20278 if ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) && 20279 (stage_id == _BCM_FIELD_STAGE_INGRESS)){ 20280 while (hw_entry_count >= 1) { 20281 20282 /* Lower counter is not used */ 20283 if ((1 == hw_entry_count) && 20284 (2 == nstat) && 20285 (0 == ((ctr_mode) & 0x7))) { 20286 rshift += 3; 20287 } 20288 20289 switch ((ctr_mode >> rshift) & 0x7) { 20290 case 1: 20291 /* TR Mode = 4 */ 20292 /* 001 */ 20293 stat_arr[index++] = bcmFieldStatGreenBytes; 20294 stat_arr[index++] = bcmFieldStatGreenPackets; 20295 break; 20296 case 2: 20297 /* 010 */ 20298 stat_arr[index++] = bcmFieldStatYellowBytes; 20299 stat_arr[index++] = bcmFieldStatYellowPackets; 20300 break; 20301 case 3: 20302 /* TR Mode = 3 */ 20303 /* TR Mode = 6 */ 20304 /* 011 */ 20305 stat_arr[index++] = bcmFieldStatNotRedBytes; 20306 stat_arr[index++] = bcmFieldStatNotRedPackets; 20307 break; 20308 case 4: 20309 /* TR Mode = 3 */ 20310 /* 100 */ 20311 stat_arr[index++] = bcmFieldStatRedBytes; 20312 stat_arr[index++] = bcmFieldStatRedPackets; 20313 break; 20314 case 5: 20315 /* TR Mode = 5 */ 20316 /* 101 */ 20317 stat_arr[index++] = bcmFieldStatNotYellowBytes; 20318 stat_arr[index++] = bcmFieldStatNotYellowPackets; 20319 break; 20320 case 6: 20321 /* TR Mode = 4 */ 20322 /* TR Mode = 7 */ 20323 /* 110 */ 20324 stat_arr[index++] = bcmFieldStatNotGreenBytes; 20325 stat_arr[index++] = bcmFieldStatNotGreenPackets; 20326 break; 20327 case 7: 20328 /* TR Mode = 1 */ 20329 /* 111 */ 20330 stat_arr[index++] = bcmFieldStatBytes; 20331 stat_arr[index++] = bcmFieldStatPackets; 20332 break; 20333 default: 20334 break; 20335 } 20336 hw_entry_count--; 20337 /* Get Upper counter mode */ 20338 rshift += 3; 20339 /* Upper and Lower both counters used */ 20340 if (1 == hw_entry_count) { 20341 nstat += 2; 20342 } 20343 } 20344 } else 20345 #endif 20346 { 20347 switch (sub_mode) { 20348 case BCM_FIELD_COUNTER_MODE_DEFAULT: 20349 stat_arr[0] = bcmFieldStatBytes; 20350 stat_arr[1] = bcmFieldStatPackets; 20351 nstat = 2; 20352 break; 20353 case BCM_FIELD_COUNTER_MODE_YES_NO: 20354 stat_arr[0] = bcmFieldStatBytes; 20355 stat_arr[1] = bcmFieldStatPackets; 20356 nstat = 2; 20357 break; 20358 case BCM_FIELD_COUNTER_MODE_RED_NOTRED: 20359 stat_arr[0] = bcmFieldStatRedBytes; 20360 stat_arr[1] = bcmFieldStatRedPackets; 20361 stat_arr[2] = bcmFieldStatNotRedBytes; 20362 stat_arr[3] = bcmFieldStatNotRedPackets; 20363 nstat = 4; 20364 break; 20365 case BCM_FIELD_COUNTER_MODE_GREEN_NOTGREEN: 20366 stat_arr[0] = bcmFieldStatGreenBytes; 20367 stat_arr[1] = bcmFieldStatGreenPackets; 20368 stat_arr[2] = bcmFieldStatNotGreenBytes; 20369 stat_arr[3] = bcmFieldStatNotGreenPackets; 20370 nstat = 4; 20371 break; 20372 case BCM_FIELD_COUNTER_MODE_GREEN_RED: 20373 stat_arr[0] = bcmFieldStatGreenBytes; 20374 stat_arr[1] = bcmFieldStatGreenPackets; 20375 stat_arr[2] = bcmFieldStatRedBytes; 20376 stat_arr[3] = bcmFieldStatRedPackets; 20377 nstat = 4; 20378 break; 20379 case BCM_FIELD_COUNTER_MODE_GREEN_YELLOW: 20380 stat_arr[0] = bcmFieldStatGreenBytes; 20381 stat_arr[1] = bcmFieldStatGreenPackets; 20382 stat_arr[2] = bcmFieldStatYellowBytes; 20383 stat_arr[3] = bcmFieldStatYellowPackets; 20384 nstat = 4; 20385 break; 20386 case BCM_FIELD_COUNTER_MODE_RED_YELLOW: 20387 stat_arr[0] = bcmFieldStatRedBytes; 20388 stat_arr[1] = bcmFieldStatRedPackets; 20389 stat_arr[2] = bcmFieldStatYellowBytes; 20390 stat_arr[3] = bcmFieldStatYellowPackets; 20391 nstat = 4; 20392 break; 20393 default: 20394 break; 20395 } 20396 } 20397 rv = _bcm_field_stat_array_init(unit, fc, f_st, nstat, stat_arr); 20398 if (BCM_FAILURE(rv)) { 20399 sal_free(f_st); 20400 return rv; 20401 } 20402 20403 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 20404 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 20405 if ((part == 2) || (part == 3)) { 20406 f_ent->flags |= _FP_ENTRY_STAT_IN_SECONDARY_SLICE; 20407 } 20408 } else { 20409 if (part == 1) { 20410 f_ent->flags |= _FP_ENTRY_STAT_IN_SECONDARY_SLICE; 20411 } 20412 } 20413 } 20414 _FP_HASH_INSERT(fc->stat_hash, f_st, 20415 (stat_id & _FP_HASH_INDEX_MASK(fc))); 20416 fc->stat_count++; 20417 20418 if (stage_id != _BCM_FIELD_STAGE_EXTERNAL) { 20419 /* Mark as used in the slice */ 20420 if (2 == f_st->hw_entry_count) { 20421 _FP_COUNTER_BMP_ADD(fs->counter_bmp, 2 * ctr_idx); 20422 _FP_COUNTER_BMP_ADD(fs->counter_bmp, 2 * ctr_idx + 1); 20423 } else { 20424 if ((ctr_mode % 2) == 0) { 20425 _FP_COUNTER_BMP_ADD(fs->counter_bmp, 2 * ctr_idx + 1); 20426 } else { 20427 _FP_COUNTER_BMP_ADD(fs->counter_bmp, 2 * ctr_idx); 20428 } 20429 } 20430 } 20431 20432 fg->group_status.counter_count = 20433 fg->group_status.counter_count + f_st->hw_entry_count; 20434 } 20435 20436 /* Associate the stat object with the entry */ 20437 f_ent_st->flags |= (_FP_ENTRY_STAT_VALID | ent_st_flags); 20438 f_ent_st->sid = f_st->sid; 20439 20440 return (BCM_E_NONE); 20441 } 20442 20443 20444 int 20445 _field_trx_actions_recover_action_add(int unit, 20446 _field_entry_t *f_ent, 20447 bcm_field_action_t action, 20448 uint32 param0, 20449 uint32 param1, 20450 uint32 param2, 20451 uint32 param3, 20452 uint32 param4, 20453 uint32 param5, 20454 uint32 hw_index 20455 ) 20456 { 20457 int rv; 20458 _field_action_t *fa = NULL; 20459 20460 rv = _field_action_alloc(unit, action, 20461 param0, param1, param2, param3, param4, param5, &fa); 20462 if (BCM_FAILURE(rv)) { 20463 return rv; 20464 } 20465 20466 fa->hw_index = hw_index; 20467 20468 fa->flags &= ~_FP_ACTION_DIRTY; /* Mark action as installed. */ 20469 20470 /* Add action to front of entry's linked-list. */ 20471 fa->next = f_ent->actions; 20472 f_ent->actions = fa; 20473 20474 return (BCM_E_NONE); 20475 } 20476 20477 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) \ 20478 || defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT) 20479 /* 20480 * Function: 20481 * _field_flex_counter_recover 20482 * Purpose: 20483 * Recovers flex counter stat entry in warm-boot stage 20484 * 20485 * Parameters: 20486 * unit - (IN) BCM unit number. 20487 * f_ent - (IN) Field entry. 20488 * part - (IN) Field entry part 20489 * sid - (IN) stat id 20490 * 20491 * Returns: 20492 * BCM_E_XXX 20493 */ 20494 int _field_flex_counter_recover(int unit, 20495 _field_entry_t *f_ent, 20496 int part, 20497 int sid) 20498 { 20499 _field_group_t *fg=NULL; 20500 _field_stage_t *stage_fc=NULL; 20501 _field_stage_id_t stage_id; 20502 _field_control_t *fc=NULL; 20503 _field_stat_t *f_st = NULL; 20504 _field_entry_stat_t *f_ent_st = NULL; 20505 int rv=0; 20506 int stat_id=0; 20507 bcm_field_stat_t stat_arr[2]={bcmFieldStatBytes, bcmFieldStatPackets}; 20508 uint8 nstat = 2; 20509 #if defined(BCM_KATANA2_SUPPORT) 20510 bcm_stat_group_mode_t stat_mode; /* Stat type bcmStatGroupModeXXX. */ 20511 bcm_stat_object_t stat_obj; /* Stat object type. */ 20512 uint32 pool_num; /* Flex Stat Hw Pool No. */ 20513 uint32 base_index; /* Flex Stat counter base index. */ 20514 int offset_mode = 0; 20515 #endif 20516 20517 fg = f_ent->group; 20518 20519 /* Get field control and stage control */ 20520 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 20521 stage_id = f_ent->group->stage_id; 20522 rv = _field_stage_control_get(unit, stage_id, &stage_fc); 20523 BCM_IF_ERROR_RETURN(rv); 20524 20525 rv = _bcm_field_stat_get(unit, sid, &f_st); 20526 if (!((rv == BCM_E_NOT_FOUND) || (rv == BCM_E_NONE))) { 20527 return rv; 20528 } 20529 if (rv == BCM_E_NOT_FOUND) { 20530 BCM_IF_ERROR_RETURN(_bcm_field_stat_id_alloc(unit, &stat_id)); 20531 _FP_XGS3_ALLOC(f_st, sizeof (_field_stat_t), "Field stat entity"); 20532 if (NULL == f_st) { 20533 return (BCM_E_MEMORY); 20534 } 20535 f_st->hw_ref_count = 0; 20536 f_st->sw_ref_count = 1; 20537 f_st->pool_index = _FP_INVALID_INDEX; 20538 f_st->hw_index = _FP_INVALID_INDEX; 20539 f_st->sid = sid; 20540 f_st->hw_flags = 0; /* INTERNAL */ 20541 f_st->stage_id = fg->stage_id; 20542 f_st->gid = fg->gid; 20543 /* Allocate counters array. */ 20544 if (flex_info[unit].valid == 1) { 20545 switch(flex_info[unit].flex_stat_map) { 20546 case 1: 20547 nstat = 1; 20548 stat_arr[0] = bcmFieldStatBytes; 20549 LOG_VERBOSE(BSL_LS_BCM_FP, 20550 (BSL_META_U(unit, 20551 "_field_flex_counter_recover: StatBytes \n"))); 20552 break; 20553 case 2: 20554 nstat = 1; 20555 stat_arr[0] = bcmFieldStatPackets; 20556 LOG_VERBOSE(BSL_LS_BCM_FP, 20557 (BSL_META_U(unit, 20558 "_field_flex_counter_recover: StatPackets \n"))); 20559 break; 20560 case 3: 20561 LOG_VERBOSE(BSL_LS_BCM_FP, 20562 (BSL_META_U(unit, 20563 "_field_flex_counter_recover:StatBytes & Packets\n"))); 20564 break; 20565 default: 20566 LOG_WARN(BSL_LS_BCM_FP, 20567 (BSL_META_U(unit, 20568 "_field_flex_counter_recover:Default Bytes&Pkts.\n"))); 20569 break; 20570 } 20571 } else { 20572 LOG_WARN(BSL_LS_BCM_FP, 20573 (BSL_META_U(unit, 20574 "_field_flex_counter_recover: flex info not valid!.\n"))); 20575 } 20576 rv = _bcm_field_stat_array_init(unit, fc, f_st, nstat, stat_arr); 20577 if (BCM_FAILURE(rv)) { 20578 sal_free(f_st); 20579 return (rv); 20580 } 20581 f_st->hw_entry_count = 1; 20582 _FP_HASH_INSERT(fc->stat_hash, f_st, 20583 (sid & _FP_HASH_INDEX_MASK(fc))); 20584 fc->stat_count++; 20585 } 20586 f_ent_st = &f_ent->statistic; 20587 f_st->hw_ref_count++; 20588 f_st->sw_ref_count++; 20589 /* Associate the stat object with the entry */ 20590 #if defined(BCM_KATANA2_SUPPORT) 20591 if ((stage_id == _BCM_FIELD_STAGE_LOOKUP) && 20592 soc_feature(unit, soc_feature_flex_stat_compaction_support) && 20593 (flex_info[unit].valid == 1) && (flex_info[unit].flex_mode != 0)) { 20594 f_ent_st->flags |= (_FP_ENTRY_EXTENDED_STAT_VALID | _FP_ENTRY_STAT_INSTALLED | 20595 _FP_ENTRY_EXTENDED_STAT_INSTALLED); 20596 f_ent_st->extended_sid = f_st->sid; 20597 f_ent_st->stat_action = bcmFieldStatActionIncrement; 20598 20599 f_st->flex_mode = flex_info[unit].flex_mode; 20600 f_st->hw_flags = flex_info[unit].hw_flags; 20601 _bcm_esw_stat_get_counter_id_info(unit, f_st->flex_mode, 20602 &stat_mode, 20603 &stat_obj, 20604 (uint32 *)&offset_mode, 20605 &pool_num, 20606 &base_index); 20607 f_st->hw_index = base_index; 20608 f_st->pool_index = pool_num; 20609 f_st->hw_mode = offset_mode; /* offset_mode from counter info */ 20610 f_st->hw_entry_count = 1; /* PlsNote:For SingleMode=1 */ 20611 } else 20612 #endif 20613 { 20614 f_ent_st->flags |= (_FP_ENTRY_STAT_VALID | _FP_ENTRY_STAT_INSTALLED); 20615 f_ent_st->sid = f_st->sid; 20616 } 20617 return BCM_E_NONE; 20618 } 20619 #endif 20620 20621 #if defined(BCM_TRIUMPH2_SUPPORT) 20622 /* 20623 * Function: 20624 * _field_vfp_flex_counter_recover 20625 * Purpose: 20626 * Recovers flex counter stat entry in warm-boot stage 20627 * 20628 * Parameters: 20629 * unit - (IN) BCM unit number. 20630 * f_ent - (IN) Field entry. 20631 * part - (IN) Field entry part 20632 * cntr_idx - (IN) counter HW index 20633 * sid - (IN) stat id 20634 * 20635 * Returns: 20636 * BCM_E_XXX 20637 */ 20638 STATIC 20639 int _field_vfp_flex_counter_recover(int unit, 20640 _field_entry_t *f_ent, 20641 int part, 20642 int cntr_idx, 20643 int sid) 20644 { 20645 _field_stat_t *f_st = NULL; 20646 int rv=0; 20647 20648 BCM_IF_ERROR_RETURN(_field_flex_counter_recover( 20649 unit, f_ent, part, sid)); 20650 20651 rv = _bcm_field_stat_get(unit, sid, &f_st); 20652 20653 if (BCM_SUCCESS(rv) && 20654 (f_st->hw_index == _FP_INVALID_INDEX)) { 20655 f_st->hw_index = cntr_idx; 20656 } 20657 20658 return rv; 20659 } 20660 #endif 20661 20662 #if defined(BCM_HURRICANE3_SUPPORT) 20663 /* 20664 * Function: 20665 * _field_flowcnt_counter_recover 20666 * Purpose: 20667 * Recovers flowcnt counter stat entry in warm-boot stage 20668 * 20669 * Parameters: 20670 * unit - (IN) BCM unit number. 20671 * f_ent - (IN) Field entry. 20672 * part - (IN) Field entry part 20673 * sid - (IN) stat id 20674 * 20675 * Returns: 20676 * BCM_E_XXX 20677 */ 20678 STATIC 20679 int _field_flowcnt_counter_recover(int unit, 20680 _field_entry_t *f_ent, 20681 int part, 20682 int sid) 20683 { 20684 _field_group_t *fg=NULL; 20685 _field_stage_t *stage_fc=NULL; 20686 _field_stage_id_t stage_id; 20687 _field_control_t *fc=NULL; 20688 _field_stat_t *f_st = NULL; 20689 _field_entry_stat_t *f_ent_st = NULL; 20690 int rv=0; 20691 int stat_id=0; 20692 bcm_field_stat_t stat_arr[1]={bcmFieldStatBytes}; 20693 uint8 nstat = 1; 20694 20695 fg = f_ent->group; 20696 20697 /* Get field control and stage control */ 20698 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 20699 stage_id = f_ent->group->stage_id; 20700 rv = _field_stage_control_get(unit, stage_id, &stage_fc); 20701 BCM_IF_ERROR_RETURN(rv); 20702 20703 rv = _bcm_field_stat_get(unit, sid, &f_st); 20704 if (!((rv == BCM_E_NOT_FOUND) || (rv == BCM_E_NONE))) { 20705 return rv; 20706 } 20707 if (rv == BCM_E_NOT_FOUND) { 20708 BCM_IF_ERROR_RETURN(_bcm_field_stat_id_alloc(unit, &stat_id)); 20709 _FP_XGS3_ALLOC(f_st, sizeof (_field_stat_t), "Field stat entity"); 20710 if (NULL == f_st) { 20711 return (BCM_E_MEMORY); 20712 } 20713 f_st->hw_ref_count = 0; 20714 f_st->sw_ref_count = 1; 20715 f_st->pool_index = _FP_INVALID_INDEX; 20716 f_st->hw_index = _FP_INVALID_INDEX; 20717 f_st->sid = sid; 20718 f_st->hw_flags = 0; /* INTERNAL */ 20719 f_st->stage_id = fg->stage_id; 20720 f_st->gid = fg->gid; 20721 /* Allocate counters array. */ 20722 if (flex_info[unit].valid == 1) { 20723 switch(flex_info[unit].flex_stat_map) { 20724 case 1: 20725 nstat = 1; 20726 stat_arr[0] = bcmFieldStatBytes; 20727 LOG_VERBOSE(BSL_LS_BCM_FP, 20728 (BSL_META_U(unit, 20729 "_field_flowcnt_counter_recover: StatBytes \n"))); 20730 break; 20731 case 2: 20732 nstat = 1; 20733 stat_arr[0] = bcmFieldStatPackets; 20734 LOG_VERBOSE(BSL_LS_BCM_FP, 20735 (BSL_META_U(unit, 20736 "_field_flowcnt_counter_recover: StatPackets \n"))); 20737 break; 20738 default: 20739 LOG_WARN(BSL_LS_BCM_FP, 20740 (BSL_META_U(unit, 20741 "_field_flowcnt_counter_recover:Default Bytes.\n"))); 20742 break; 20743 } 20744 } else { 20745 LOG_WARN(BSL_LS_BCM_FP, 20746 (BSL_META_U(unit, 20747 "_field_flowcnt_counter_recover: flex info not valid!.\n"))); 20748 } 20749 rv = _bcm_field_stat_array_init(unit, fc, f_st, nstat, stat_arr); 20750 if (BCM_FAILURE(rv)) { 20751 sal_free(f_st); 20752 return (rv); 20753 } 20754 f_st->hw_entry_count = 1; 20755 _FP_HASH_INSERT(fc->stat_hash, f_st, 20756 (sid & _FP_HASH_INDEX_MASK(fc))); 20757 fc->stat_count++; 20758 } 20759 f_ent_st = &f_ent->statistic; 20760 f_st->hw_ref_count++; 20761 f_st->sw_ref_count++; 20762 /* Associate the stat object with the entry */ 20763 f_ent_st->flags |= (_FP_ENTRY_STAT_VALID | _FP_ENTRY_STAT_INSTALLED); 20764 f_ent_st->sid = f_st->sid; 20765 return BCM_E_NONE; 20766 } 20767 #endif 20768 20769 #if defined(INCLUDE_L3) 20770 /* 20771 * Function: 20772 * _bcm_field_l3_recover_callback 20773 * Purpose: 20774 * Callback routine from L3 reinit to recover field actions dependant on 20775 * L3 module. 20776 * 20777 * Parameters: 20778 * unit - (IN) BCM unit number. 20779 * 20780 * Returns: 20781 * BCM_E_XXX 20782 */ 20783 int _bcm_field_l3_recover_callback(int unit) 20784 { 20785 _bcm_field_l3_callback_recover_t *l3_cb = NULL; 20786 egr_l3_next_hop_entry_t egr_l3_next_hop_entry; 20787 unsigned if_idx; 20788 egr_l3_intf_entry_t egr_l3_intf_entry; 20789 sal_mac_addr_t mac_addr; 20790 uint32 mac_addr_words[2]; 20791 soc_field_t fp_action_fld; 20792 _field_entry_t *f_ent = NULL; 20793 int rv, hw_index; 20794 bcm_l3_egress_t l3_egr; 20795 20796 if (_field_l3_cb == NULL) { 20797 return BCM_E_NONE; 20798 } 20799 20800 l3_cb = _field_l3_cb; 20801 while (l3_cb != NULL) { 20802 switch (l3_cb->action) { 20803 case bcmFieldActionChangeL2Fields: 20804 20805 /* Fetch L3 next-hop and interface records */ 20806 hw_index = l3_cb->hw_index; 20807 f_ent = l3_cb->f_ent; 20808 20809 /* Get next hop info from Egress Object ID param */ 20810 rv = bcm_esw_l3_egress_get(unit, l3_cb->param0, &l3_egr); 20811 if (BCM_SUCCESS(rv)) { 20812 /* 20813 * Action bcmFieldActionChangeL2Fields is set for all actions which 20814 * were programmed in G_L3SW_CHANGE_L2_FIELDSf 20815 * In order to differentiate between bcmFieldActionChangeL2Fields and 20816 * others BCM_L3_FLAGS2_FIELD_ONLY flag will be set in L3 20817 */ 20818 if (l3_egr.flags2 & BCM_L3_FLAGS2_FIELD_ONLY) { 20819 rv = _field_trx_actions_recover_action_add( 20820 unit, l3_cb->f_ent, l3_cb->action, 20821 l3_cb->param0, 0, 0, 0, 0, 0, hw_index); 20822 if (BCM_FAILURE(rv)) { 20823 return (rv); 20824 } 20825 break; 20826 } 20827 } else { 20828 if (BCM_XGS3_L3_EGRESS_MODE_ISSET(unit)) { 20829 LOG_ERROR(BSL_LS_BCM_FP, 20830 (BSL_META_U(unit, 20831 "FP(unit %d) Error: Getting next hop info failed" 20832 "from Egress Object ID param : %d\n"), 20833 unit, l3_cb->param0)); 20834 return (rv); 20835 } 20836 } 20837 rv = soc_mem_read(unit, 20838 EGR_L3_NEXT_HOPm, 20839 MEM_BLOCK_ANY, 20840 hw_index, 20841 egr_l3_next_hop_entry.entry_data); 20842 20843 if (BCM_FAILURE(rv)) { 20844 return (rv); 20845 } 20846 20847 if (SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) { 20848 if (soc_mem_field32_get(unit, EGR_L3_NEXT_HOPm, 20849 egr_l3_next_hop_entry.entry_data, 20850 ENTRY_TYPEf) != 6) { 20851 return (BCM_E_INTERNAL) ; 20852 } 20853 20854 if_idx = soc_mem_field32_get(unit, EGR_L3_NEXT_HOPm, 20855 egr_l3_next_hop_entry.entry_data, 20856 IFP_ACTIONS__INTF_NUMf); 20857 20858 rv = soc_mem_read(unit, 20859 EGR_L3_INTFm, 20860 MEM_BLOCK_ANY, 20861 if_idx, 20862 egr_l3_intf_entry.entry_data); 20863 20864 if (BCM_FAILURE(rv)) { 20865 return (rv); 20866 } 20867 20868 /* Inform L3 module these interface and next-hop 20869 records are in use. 20870 */ 20871 20872 /* L3 module is not initialized yet; 20873 L3 to supply function calls for reference count accounting, 20874 callable at this point. 20875 */ 20876 if (!(BCM_XGS3_L3_EGRESS_MODE_ISSET(unit))) { 20877 BCM_L3_INTF_USED_SET(unit, if_idx); 20878 _bcm_xgs3_nh_ref_cnt_incr(unit, hw_index); 20879 } 20880 if (SOC_IS_KATANA2(unit)) { 20881 fp_action_fld = IFP_ACTIONS__L3_DA_DISABLEf; 20882 } else { 20883 fp_action_fld = IFP_ACTIONS__L3_UC_DA_DISABLEf; 20884 } 20885 if (soc_mem_field32_get(unit, EGR_L3_NEXT_HOPm, 20886 egr_l3_next_hop_entry.entry_data, 20887 fp_action_fld) == 0) { 20888 /* Replace MACDA not disabled => Recover value for new MAC DA */ 20889 soc_mem_mac_addr_get(unit, 20890 EGR_L3_NEXT_HOPm, 20891 egr_l3_next_hop_entry.entry_data, 20892 IFP_ACTIONS__MAC_ADDRESSf, 20893 mac_addr); 20894 20895 SAL_MAC_ADDR_TO_UINT32(mac_addr, mac_addr_words); 20896 rv = _field_trx_actions_recover_action_add( 20897 unit, f_ent, bcmFieldActionDstMacNew, 20898 mac_addr_words[0], mac_addr_words[1], 20899 0, 0, 0, 0, hw_index); 20900 if (BCM_FAILURE(rv)) { 20901 return (rv); 20902 } 20903 } 20904 if (SOC_IS_KATANA2(unit)) { 20905 fp_action_fld = IFP_ACTIONS__L3_SA_DISABLEf; 20906 } else { 20907 fp_action_fld = IFP_ACTIONS__L3_UC_SA_DISABLEf; 20908 } 20909 20910 if (soc_mem_field32_get(unit, EGR_L3_NEXT_HOPm, 20911 egr_l3_next_hop_entry.entry_data, 20912 fp_action_fld) == 0) { 20913 /* Replace MACSA not disabled => Recover value for new MAC SA */ 20914 soc_mem_mac_addr_get(unit, EGR_L3_INTFm, 20915 egr_l3_intf_entry.entry_data, 20916 MAC_ADDRESSf, mac_addr); 20917 20918 SAL_MAC_ADDR_TO_UINT32(mac_addr, mac_addr_words); 20919 20920 rv = _field_trx_actions_recover_action_add( 20921 unit, f_ent, bcmFieldActionSrcMacNew, 20922 mac_addr_words[0], mac_addr_words[1], 20923 0, 0, 0, 0, hw_index); 20924 if (BCM_FAILURE(rv)) { 20925 return (rv); 20926 } 20927 } 20928 if (SOC_IS_KATANA2(unit)) { 20929 fp_action_fld = IFP_ACTIONS__L3_VLAN_DISABLEf; 20930 } else { 20931 fp_action_fld = IFP_ACTIONS__L3_UC_VLAN_DISABLEf; 20932 } 20933 20934 if (soc_mem_field32_get( 20935 unit, EGR_L3_NEXT_HOPm, 20936 egr_l3_next_hop_entry.entry_data, 20937 fp_action_fld) == 0) { 20938 /* Replace outer VID not disabled => Recover value for new outer VID */ 20939 20940 rv = _field_trx_actions_recover_action_add( 20941 unit, f_ent, bcmFieldActionOuterVlanNew, 20942 soc_mem_field32_get(unit, EGR_L3_INTFm, 20943 egr_l3_intf_entry.entry_data, VIDf), 20944 0, 0, 0, 0, 0, hw_index); 20945 if (BCM_FAILURE(rv)) { 20946 return (rv); 20947 } 20948 } 20949 20950 if (SOC_MEM_FIELD_VALID(unit, EGR_L3_NEXT_HOPm, 20951 IFP_ACTIONS__VNTAG_ACTIONf)) { 20952 switch (soc_mem_field32_get(unit, EGR_L3_NEXT_HOPm, 20953 egr_l3_next_hop_entry.entry_data, 20954 IFP_ACTIONS__VNTAG_ACTIONf)) { 20955 case 1: 20956 /* Replace VNTAG => Recover value for new VNTAG */ 20957 rv = _field_trx_actions_recover_action_add( 20958 unit, 20959 f_ent, 20960 bcmFieldActionVnTagNew, 20961 soc_mem_field32_get( 20962 unit, 20963 EGR_L3_NEXT_HOPm, 20964 egr_l3_next_hop_entry.entry_data, 20965 IFP_ACTIONS__VNTAGf), 20966 0, 0, 0, 0, 0, hw_index); 20967 if (BCM_FAILURE(rv)) { 20968 return (rv); 20969 } 20970 break; 20971 20972 case 2: 20973 /* Replace ETAG => Recover value for new ETAG */ 20974 rv = _field_trx_actions_recover_action_add( 20975 unit, 20976 f_ent, 20977 bcmFieldActionEtagNew, 20978 soc_mem_field32_get( 20979 unit, 20980 EGR_L3_NEXT_HOPm, 20981 egr_l3_next_hop_entry.entry_data, 20982 IFP_ACTIONS__VNTAGf), 20983 0, 0, 0, 0, 0, hw_index); 20984 if (BCM_FAILURE(rv)) { 20985 return (rv); 20986 } 20987 break; 20988 20989 case 3: 20990 /* VNTAG delete */ 20991 rv = _field_trx_actions_recover_action_add( 20992 unit, 20993 f_ent, 20994 bcmFieldActionVnTagDelete, 20995 0, 0, 0, 0, 0, 0, hw_index); 20996 if (BCM_FAILURE(rv)) { 20997 return (rv); 20998 } 20999 break; 21000 21001 default: 21002 ; 21003 21004 } 21005 } 21006 } else { 21007 /* Non-Trident */ 21008 if_idx = soc_mem_field32_get( 21009 unit, 21010 EGR_L3_NEXT_HOPm, 21011 egr_l3_next_hop_entry.entry_data, 21012 L3__INTF_NUMf); 21013 rv = soc_mem_read(unit, 21014 EGR_L3_INTFm, 21015 MEM_BLOCK_ANY, 21016 if_idx, 21017 egr_l3_intf_entry.entry_data); 21018 if (BCM_FAILURE(rv)) { 21019 return (rv); 21020 } 21021 21022 /* Inform L3 module these interface and next-hop 21023 records are in use. 21024 */ 21025 21026 /* L3 module is not initialized yet; 21027 L3 to supply function calls for reference count accounting, 21028 callable at this point. 21029 */ 21030 21031 if (!(BCM_XGS3_L3_EGRESS_MODE_ISSET(unit))) { 21032 BCM_L3_INTF_USED_SET(unit, if_idx); 21033 _bcm_xgs3_nh_ref_cnt_incr(unit, hw_index); 21034 } 21035 21036 if (soc_mem_field32_get(unit, EGR_L3_NEXT_HOPm, 21037 egr_l3_next_hop_entry.entry_data, 21038 L3__L3_UC_DA_DISABLEf) == 0) { 21039 /* Replace MAC DA not disabled 21040 => Recover value for new MAC DA 21041 */ 21042 soc_mem_mac_addr_get(unit, EGR_L3_NEXT_HOPm, 21043 egr_l3_next_hop_entry.entry_data, 21044 L3__MAC_ADDRESSf, mac_addr); 21045 21046 SAL_MAC_ADDR_TO_UINT32(mac_addr, mac_addr_words); 21047 21048 rv = _field_trx_actions_recover_action_add( 21049 unit, f_ent, bcmFieldActionDstMacNew, 21050 mac_addr_words[0], mac_addr_words[1], 21051 0, 0, 0, 0, hw_index); 21052 if (BCM_FAILURE(rv)) { 21053 return (rv); 21054 } 21055 } 21056 21057 if (soc_mem_field32_get( 21058 unit, EGR_L3_NEXT_HOPm, 21059 egr_l3_next_hop_entry.entry_data, 21060 L3__L3_UC_SA_DISABLEf) == 0) { 21061 /* Replace MAC SA not disabled 21062 => Recover value for new MAC SA 21063 */ 21064 21065 soc_mem_mac_addr_get(unit, 21066 EGR_L3_INTFm, 21067 egr_l3_intf_entry.entry_data, 21068 MAC_ADDRESSf, 21069 mac_addr); 21070 21071 SAL_MAC_ADDR_TO_UINT32(mac_addr, mac_addr_words); 21072 21073 rv = _field_trx_actions_recover_action_add( 21074 unit, f_ent, bcmFieldActionSrcMacNew, 21075 mac_addr_words[0], mac_addr_words[1], 21076 0, 0, 0, 0, hw_index); 21077 if (BCM_FAILURE(rv)) { 21078 return (rv); 21079 } 21080 } 21081 21082 if (soc_mem_field32_get( 21083 unit, EGR_L3_NEXT_HOPm, 21084 egr_l3_next_hop_entry.entry_data, 21085 L3__L3_UC_VLAN_DISABLEf) == 0) { 21086 /* Replace outer VID not disabled 21087 => Recover value for new outer VID 21088 */ 21089 21090 rv = _field_trx_actions_recover_action_add( 21091 unit, f_ent, 21092 bcmFieldActionOuterVlanNew, 21093 soc_mem_field32_get( 21094 unit, 21095 EGR_L3_INTFm, 21096 egr_l3_intf_entry.entry_data, 21097 VIDf), 21098 0, 0, 0, 0, 0, hw_index); 21099 if (BCM_FAILURE(rv)) { 21100 return (rv); 21101 } 21102 } 21103 #if defined(BCM_TRIUMPH3_SUPPORT) 21104 if ((SOC_MEM_FIELD_VALID(unit, EGR_L3_NEXT_HOPm, 21105 L2_ACTIONS__VNTAG_ACTIONf)) 21106 & (SOC_IS_TRIUMPH3(unit))) { 21107 switch (soc_mem_field32_get( 21108 unit, 21109 EGR_L3_NEXT_HOPm, 21110 egr_l3_next_hop_entry.entry_data, 21111 L2_ACTIONS__VNTAG_ACTIONf)) { 21112 21113 case 2: 21114 /* Replace ETAG 21115 => Recover value for new ETAG 21116 */ 21117 21118 rv = _field_trx_actions_recover_action_add( 21119 unit, 21120 f_ent, 21121 bcmFieldActionEtagNew, 21122 soc_mem_field32_get( 21123 unit, EGR_L3_NEXT_HOPm, 21124 egr_l3_next_hop_entry.entry_data, 21125 L2_ACTIONS__VNTAGf), 21126 0, 0, 0, 0, 0, hw_index); 21127 if (BCM_FAILURE(rv)) { 21128 return (rv); 21129 } 21130 break; 21131 21132 case 3: 21133 /* ETAG delete */ 21134 21135 rv = _field_trx_actions_recover_action_add( 21136 unit, f_ent, bcmFieldActionEtagDelete, 21137 0, 0, 0, 0, 0, 0, hw_index); 21138 if (BCM_FAILURE(rv)) { 21139 return (rv); 21140 } 21141 break; 21142 21143 default: 21144 ; 21145 21146 } 21147 } 21148 #endif /* BCM_TRIUMPH3_SUPPORT */ 21149 } 21150 21151 break; 21152 21153 default: 21154 return BCM_E_INTERNAL; 21155 } 21156 21157 /* Remove the callback and de-allocate it from the list */ 21158 _field_l3_cb = l3_cb->next; 21159 sal_free(l3_cb); 21160 l3_cb = _field_l3_cb; 21161 } 21162 21163 return BCM_E_NONE; 21164 } 21165 #endif /* INCLUDE_L3 */ 21166 21167 int 21168 _field_tr2_actions_recover(int unit, 21169 soc_mem_t policy_mem, 21170 uint32 *policy_entry, 21171 _field_entry_t *f_ent, 21172 int part, 21173 _field_entry_wb_info_t *f_ent_wb_info 21174 ) 21175 { 21176 soc_field_t fld; /* Policy table field info */ 21177 uint32 fldval, hw_index, append; 21178 soc_field_t fldTemp; 21179 uint32 fldValTemp = 0; 21180 int is_action_add = 0; 21181 uint32 param0, param1, param2 = 0, param3 = 0, param4 = 0, param5 = 0; 21182 uint32 ctr_mode, ctr_idx; /* Counter mode and index info */ 21183 bcm_field_action_t action; /* Action type */ 21184 int rv, i, num_fields; /* Number of fields in policy table info */ 21185 int ecmp_paths, nh_ecmp; 21186 soc_mem_t profile_mem = IFP_REDIRECTION_PROFILEm; /* Redirection profile 21187 * table */ 21188 ifp_redirection_profile_entry_t entry_arr[2]; /* Redirection profile entry */ 21189 uint32 *entry_ptr[2]; /* Redirection profile pointer */ 21190 soc_profile_mem_t *redirect_profile; /* Redirect Profile info */ 21191 bcm_pbmp_t pbmp; /* Port bitmap info */ 21192 uint8 pkt_int_new = 0; /* Packet and Internal Priority info */ 21193 bcm_module_t modid; /* Modid Info */ 21194 bcm_gport_t gport; /* GPORT info */ 21195 uint32 mirror_pbm; /* Mirror bitmap info */ 21196 uint16 bit_pos; /* Bit position info*/ 21197 int mtp_index; /* Mirror to port index */ 21198 egr_l3_next_hop_entry_t egr_l3_next_hop_entry; /* Egress Next Hop table 21199 * entry info */ 21200 sal_mac_addr_t mac_addr; /* MAC address info */ 21201 uint32 mac_addr_words[2]; /* MAC address info for Param[0], Param[1] */ 21202 uint16 vlan_id; /* VLAN ID info */ 21203 int8 uc_cosq = -1; /* Unicast COS Queue value */ 21204 int8 mc_cosq = -1; /* Multicast COS Queue value */ 21205 soc_field_t tmp_fld; 21206 #if defined (BCM_KATANA_SUPPORT) 21207 uint32 cosq_idx = 0; 21208 int tag_type = 0; 21209 #endif 21210 #if defined BCM_TRIDENT2PLUS_SUPPORT 21211 _field_oam_action_recover_t oam_action[3]; /* Oam Actions */ 21212 #endif 21213 #if defined(BCM_TRIDENT2_SUPPORT) 21214 /* lookup hash selection profile table */ 21215 soc_mem_t hash_select_profile_mem[2] = { VFP_HASH_FIELD_BMAP_TABLE_Am, 21216 VFP_HASH_FIELD_BMAP_TABLE_Bm}; 21217 vfp_hash_field_bmap_table_a_entry_t hash_select_entry_arr[2]; /* hash select 21218 * profile 21219 * entry*/ 21220 uint32 *hash_select_entry_ptr[2]; 21221 soc_profile_mem_t *hash_select_profile[2]; 21222 int is_trunk = 0; 21223 21224 #endif /* BCM_TRIDENT2_SUPPORT */ 21225 #if defined (BCM_TRIUMPH3_SUPPORT) 21226 int index; 21227 #endif 21228 #if defined(BCM_TOMAHAWK_SUPPORT) 21229 uint8 modid_new; /* ModId Info */ 21230 uint8 portid_new; /* Physical Port Info */ 21231 uint8 change_modid; /* Flag to indicate change in ModId */ 21232 uint8 change_portid; /* Flag to indicate change in 21233 Physical PortId */ 21234 uint8 is_not_svp; /* Flag to indicate port type */ 21235 uint32 svp; /* SVP ID */ 21236 #endif 21237 bcm_field_stat_action_t stat_action; 21238 #if defined BCM_TRIUMPH2_SUPPORT 21239 _field_dscp_map_new_eid_list_t *dscp_map_new_eid_node = NULL; 21240 #endif 21241 #if defined INCLUDE_L3 21242 _bcm_field_l3_callback_recover_t *l3_cb = NULL; 21243 #endif 21244 int action_sync = 1; 21245 int val = 0; 21246 _field_control_t *fc = NULL; /* Pointer to field control */ 21247 21248 if (f_ent_wb_info == NULL) { 21249 return BCM_E_INTERNAL; 21250 } 21251 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 21252 21253 entry_ptr[0] = (uint32 *)(&entry_arr[0]); 21254 entry_ptr[1] = (uint32 *)(&entry_arr[1]); 21255 21256 sal_memset (&stat_action, 0, sizeof (stat_action)); 21257 21258 /* Reset redirection profile entry. */ 21259 sal_memset(entry_arr, 0, 2*sizeof(ifp_redirection_profile_entry_t)); 21260 21261 /* Get the redirect profile */ 21262 rv = _field_trx_redirect_profile_get(unit, &redirect_profile); 21263 BCM_IF_ERROR_RETURN(rv); 21264 21265 SOC_PBMP_CLEAR(pbmp); 21266 #if defined(BCM_TRIDENT2_SUPPORT) 21267 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit) || 21268 soc_feature(unit, soc_feature_field_multi_pipe_support) )) { 21269 hash_select_entry_ptr[0] = (uint32 *)hash_select_entry_arr; 21270 hash_select_entry_ptr[1] = hash_select_entry_ptr[0] + 21271 soc_mem_entry_words(unit, 21272 hash_select_profile_mem[0]); 21273 21274 /* Reset hash select profile entry. */ 21275 sal_memcpy(hash_select_entry_ptr[0], 21276 soc_mem_entry_null(unit, hash_select_profile_mem[0]), 21277 soc_mem_entry_words(unit, hash_select_profile_mem[0]) * 21278 sizeof(uint32)); 21279 sal_memcpy(hash_select_entry_ptr[1], 21280 soc_mem_entry_null(unit, hash_select_profile_mem[0]), 21281 soc_mem_entry_words(unit, hash_select_profile_mem[0]) * 21282 sizeof(uint32)); 21283 21284 /* Get the hash select profile */ 21285 rv = _bcm_field_td2_hash_select_profile_get(unit, 21286 hash_select_profile_mem[0], 21287 &hash_select_profile[0]); 21288 BCM_IF_ERROR_RETURN(rv); 21289 21290 rv = _bcm_field_td2_hash_select_profile_get(unit, 21291 hash_select_profile_mem[1], 21292 &hash_select_profile[1]); 21293 BCM_IF_ERROR_RETURN(rv); 21294 } 21295 #endif /* BCM_TRIDENT2_SUPPORT */ 21296 21297 #if defined BCM_TRIDENT2PLUS_SUPPORT 21298 sal_memset (oam_action, 0, sizeof (oam_action) ); 21299 #endif 21300 21301 num_fields = SOC_MEM_INFO(unit, policy_mem).nFields; 21302 21303 if (f_ent_wb_info->action_bmp == NULL || f_ent_wb_info->action_bmp->w == NULL) { 21304 action_sync = 0; 21305 } 21306 for (i = 0; i < num_fields; i++) { 21307 uint8 already_recovered = 0; 21308 fld = SOC_MEM_INFO(unit, policy_mem).fields[i].field; 21309 21310 /* Skip FP_POLICY_TABLE_A/B, PROFILE_SET fields. */ 21311 if (soc_mem_field_length(unit, policy_mem, fld) > 32){ 21312 continue; 21313 } 21314 21315 fldval = PolicyGet(unit, policy_mem, policy_entry, fld); 21316 action = param0 = param1 = param2 = param3 = param4 = param5 = hw_index = append = 0; 21317 uc_cosq = mc_cosq = -1; 21318 21319 switch (fld) { 21320 case ECMP_HASH_SELf: 21321 /* MultipathHash is overlayed with other actions(like NewClassId) which set 21322 * G_L3SW_CHANGE_L2_FIELDSf 21323 */ 21324 fldValTemp = 0; 21325 is_action_add = 0; 21326 if (fldval != 0) { 21327 if (soc_mem_field_valid(unit, policy_mem, 21328 G_L3SW_CHANGE_MACDA_OR_VLANf) 21329 && soc_mem_field_valid(unit, policy_mem, 21330 G_L3SW_CHANGE_L2_FIELDSf)) { 21331 fldTemp = G_L3SW_CHANGE_L2_FIELDSf; 21332 fldValTemp = PolicyGet(unit, policy_mem, 21333 policy_entry,G_L3SW_CHANGE_L2_FIELDSf); 21334 } else if (soc_mem_field_valid(unit, policy_mem, 21335 G_L3SW_CHANGE_MACDA_OR_VLANf)) { 21336 fldTemp = G_L3SW_CHANGE_MACDA_OR_VLANf; 21337 fldValTemp = PolicyGet(unit, policy_mem, 21338 policy_entry,G_L3SW_CHANGE_MACDA_OR_VLANf); 21339 } else { 21340 fldTemp = G_L3SW_CHANGE_L2_FIELDSf; 21341 fldValTemp = PolicyGet(unit, policy_mem, 21342 policy_entry, G_L3SW_CHANGE_L2_FIELDSf); 21343 } 21344 21345 /* if the field value is zero.then add the action */ 21346 if (fldValTemp == 0) { 21347 is_action_add = 1; 21348 } else { 21349 if (fldTemp == G_L3SW_CHANGE_MACDA_OR_VLANf) { 21350 /* consider cases where fldTemp is conflicting*/ 21351 if ((fldValTemp == 1) || (fldValTemp == 2) || 21352 (fldValTemp == 4) || (fldValTemp == 5) || 21353 (fldValTemp == 6)) { 21354 if (soc_mem_field_valid(unit, policy_mem,ECMPf) && 21355 (PolicyGet(unit, policy_mem, 21356 policy_entry, ECMPf) != 0)) { 21357 is_action_add = 1; 21358 } 21359 } 21360 } else { 21361 if ((fldValTemp == 1) || (fldValTemp == 2)) { 21362 if (soc_mem_field_valid(unit, policy_mem,ECMPf) && 21363 (PolicyGet(unit, policy_mem, 21364 policy_entry, ECMPf) != 0)) { 21365 is_action_add = 1; 21366 } 21367 } else if (fldValTemp == 5) { 21368 if (!(SOC_IS_KATANA2(unit) || 21369 SOC_IS_SABER2(unit))) { 21370 if (!((action_sync == 1) && 21371 SHR_BITGET(f_ent_wb_info->action_bmp->w, 21372 _bcmFieldActionNoParamNewClassId))) { 21373 is_action_add = 1; 21374 } 21375 } 21376 } else if (fldValTemp == 8) { 21377 if (!(SOC_IS_TRIUMPH3(unit) || 21378 SOC_IS_TRIDENT2X(unit) || 21379 SOC_IS_TITAN2PLUS(unit))) { 21380 if (!((action_sync == 1) && 21381 SHR_BITGET(f_ent_wb_info->action_bmp->w, 21382 _bcmFieldActionNoParamNewClassId))) { 21383 is_action_add = 1; 21384 } 21385 } 21386 } else if ((fldValTemp == 6) || (fldValTemp == 7)) { 21387 if (soc_mem_field_valid(unit, policy_mem,ECMPf) && 21388 (PolicyGet(unit, policy_mem, 21389 policy_entry, ECMPf) != 0)) { 21390 is_action_add = 1; 21391 } 21392 } 21393 } 21394 } 21395 if (is_action_add) { 21396 action = bcmFieldActionMultipathHash; 21397 param0 = fldval; 21398 append = 1; 21399 } 21400 } 21401 break; 21402 21403 case GREEN_TO_PIDf: 21404 if (fldval) { 21405 f_ent->flags |= _FP_ENTRY_COLOR_INDEPENDENT; 21406 } 21407 break; 21408 case ECN_CNGf: 21409 if (fldval) { 21410 action = bcmFieldActionEcnNew; 21411 append = 1; 21412 } 21413 break; 21414 case RP_CHANGE_DSCPf: 21415 switch (fldval) { 21416 case 1: 21417 action = bcmFieldActionRpDscpNew; 21418 param0 = PolicyGet(unit, policy_mem, policy_entry, RP_DSCPf); 21419 append = 1; 21420 break; 21421 default: 21422 break; /* Do nothing */ 21423 } 21424 break; 21425 case YP_CHANGE_DSCPf: 21426 switch (fldval) { 21427 case 1: 21428 action = bcmFieldActionYpDscpNew; 21429 param0 = PolicyGet(unit, policy_mem, policy_entry, YP_DSCPf); 21430 append = 1; 21431 break; 21432 default: 21433 break; /* Do nothing */ 21434 } 21435 break; 21436 case COPY_TO_CPUf: 21437 switch (fldval) { 21438 case 1: 21439 action = bcmFieldActionCopyToCpu; 21440 if ((fldval = PolicyGet(unit, 21441 policy_mem, 21442 policy_entry, 21443 VFP_MATCHED_RULEf 21444 ) 21445 ) 21446 != 0 21447 ) { 21448 param0 = 1; 21449 param1 = fldval; 21450 } 21451 21452 append = 1; 21453 21454 break; 21455 21456 case 2: 21457 action = bcmFieldActionCopyToCpuCancel; 21458 append = 1; 21459 21460 break; 21461 21462 default: 21463 break; /* Do nothing */ 21464 } 21465 break; 21466 case G_COPY_TO_CPUf: 21467 #ifdef BCM_APACHE_SUPPORT 21468 if (fldval && f_ent_wb_info->action_copytocpu_wb.valid) { 21469 if (fldval == 0x1) { 21470 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21471 BCM_FIELD_COPYTOCPU_GREEN_NOT_DROPPED_PACKET; 21472 } else if (fldval == 0x2) { 21473 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21474 BCM_FIELD_COPYTOCPU_GREEN_DROPPED_PACKET; 21475 } else if (fldval == 0x3) { 21476 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21477 BCM_FIELD_COPYTOCPU_GREEN_PACKET; 21478 } 21479 break; 21480 } 21481 #endif 21482 21483 switch (fldval) { 21484 case 1: 21485 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21486 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21487 action = bcmFieldActionCopyToCpu; 21488 } else { 21489 action = bcmFieldActionGpCopyToCpu; 21490 } 21491 param1 = PolicyGet(unit, policy_mem, policy_entry, MATCHED_RULEf); 21492 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21493 _bcmFieldActionNoParamCopyToCpuZeroParam1)) || 21494 (param1 != 0)) { 21495 param0 = 1; 21496 } 21497 append = 1; 21498 break; 21499 case 2: 21500 val = PolicyGet(unit, policy_mem, policy_entry, G_DROPf); 21501 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21502 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21503 action = (val == 2) 21504 ? bcmFieldActionTimeStampToCpuCancel 21505 : bcmFieldActionCopyToCpuCancel; 21506 } else { 21507 action = (val == 2) 21508 ? bcmFieldActionGpTimeStampToCpuCancel 21509 : bcmFieldActionGpCopyToCpuCancel; 21510 } 21511 append = 1; 21512 break; 21513 case 3: 21514 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21515 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21516 action = bcmFieldActionSwitchToCpuCancel; 21517 } else { 21518 action = bcmFieldActionGpSwitchToCpuCancel; 21519 } 21520 append = 1; 21521 break; 21522 case 4: 21523 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21524 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21525 action = bcmFieldActionSwitchToCpuReinstate; 21526 } else { 21527 action = bcmFieldActionGpSwitchToCpuReinstate; 21528 } 21529 append = 1; 21530 break; 21531 case 5: 21532 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21533 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21534 action = bcmFieldActionTimeStampToCpu; 21535 } else { 21536 action = bcmFieldActionGpTimeStampToCpu; 21537 } 21538 param1 = PolicyGet(unit, policy_mem, policy_entry, MATCHED_RULEf); 21539 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21540 _bcmFieldActionNoParamCopyToCpuZeroParam1)) || 21541 (param1 != 0)) { 21542 param0 = 1; 21543 } 21544 append = 1; 21545 break; 21546 case 6: 21547 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21548 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21549 action = bcmFieldActionCopyToCpuCancel; 21550 } else { 21551 action = bcmFieldActionGpCopyToCpuCancel; 21552 } 21553 rv = _field_trx_actions_recover_action_add(unit, 21554 f_ent, 21555 action, 21556 param0, 21557 param1, 21558 param2, 21559 param3, 21560 param4, 21561 param5, 21562 hw_index); 21563 if (BCM_FAILURE(rv)) { 21564 return rv; 21565 } 21566 21567 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21568 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21569 action = bcmFieldActionSwitchToCpuCancel; 21570 } else { 21571 action = bcmFieldActionGpSwitchToCpuCancel; 21572 } 21573 rv = _field_trx_actions_recover_action_add(unit, 21574 f_ent, 21575 action, 21576 param0, 21577 param1, 21578 param2, 21579 param3, 21580 param4, 21581 param5, 21582 hw_index); 21583 if (BCM_FAILURE(rv)) { 21584 return rv; 21585 } 21586 append = 0; 21587 break; 21588 default: 21589 break; /* Do nothing */ 21590 } 21591 break; 21592 case Y_COPY_TO_CPUf: 21593 #ifdef BCM_APACHE_SUPPORT 21594 if (fldval && f_ent_wb_info->action_copytocpu_wb.valid) { 21595 if (fldval == 0x1) { 21596 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21597 BCM_FIELD_COPYTOCPU_YELLOW_NOT_DROPPED_PACKET; 21598 } else if (fldval == 0x2) { 21599 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21600 BCM_FIELD_COPYTOCPU_YELLOW_DROPPED_PACKET; 21601 } else if (fldval == 0x3) { 21602 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21603 BCM_FIELD_COPYTOCPU_YELLOW_PACKET; 21604 } 21605 break; 21606 } 21607 #endif 21608 switch (fldval) { 21609 case 1: 21610 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21611 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21612 break; 21613 } 21614 action = bcmFieldActionYpCopyToCpu; 21615 param1 = PolicyGet(unit, policy_mem, policy_entry, MATCHED_RULEf); 21616 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21617 _bcmFieldActionNoParamYpCopyToCpuZeroParam1)) || 21618 (param1 != 0)) { 21619 param0 = 1; 21620 } 21621 append = 1; 21622 break; 21623 case 2: 21624 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21625 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21626 break; 21627 } 21628 action = PolicyGet(unit, policy_mem, policy_entry, Y_DROPf) == 2 21629 ? bcmFieldActionYpTimeStampToCpuCancel 21630 : bcmFieldActionYpCopyToCpuCancel; 21631 append = 1; 21632 break; 21633 case 3: 21634 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21635 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21636 break; 21637 } 21638 action = bcmFieldActionYpSwitchToCpuCancel; 21639 append = 1; 21640 break; 21641 case 4: 21642 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21643 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21644 break; 21645 } 21646 action = bcmFieldActionYpSwitchToCpuReinstate; 21647 append = 1; 21648 break; 21649 case 5: 21650 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21651 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21652 break; 21653 } 21654 action = bcmFieldActionYpTimeStampToCpu; 21655 param1 = PolicyGet(unit, policy_mem, policy_entry, MATCHED_RULEf); 21656 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21657 _bcmFieldActionNoParamYpCopyToCpuZeroParam1)) || 21658 (param1 != 0)) { 21659 param0 = 1; 21660 } 21661 append = 1; 21662 break; 21663 case 6: 21664 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21665 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21666 break; 21667 } 21668 action = bcmFieldActionYpCopyToCpuCancel; 21669 rv = _field_trx_actions_recover_action_add(unit, 21670 f_ent, 21671 action, 21672 param0, 21673 param1, 21674 param2, 21675 param3, 21676 param4, 21677 param5, 21678 hw_index); 21679 if (BCM_FAILURE(rv)) { 21680 return rv; 21681 } 21682 21683 action = bcmFieldActionYpSwitchToCpuCancel; 21684 rv = _field_trx_actions_recover_action_add(unit, 21685 f_ent, 21686 action, 21687 param0, 21688 param1, 21689 param2, 21690 param3, 21691 param4, 21692 param5, 21693 hw_index); 21694 if (BCM_FAILURE(rv)) { 21695 return rv; 21696 } 21697 append = 0; 21698 break; 21699 default: 21700 break; /* Do nothing */ 21701 } 21702 break; 21703 case R_COPY_TO_CPUf: 21704 #ifdef BCM_APACHE_SUPPORT 21705 if (fldval && f_ent_wb_info->action_copytocpu_wb.valid) { 21706 if (fldval == 0x1) { 21707 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21708 BCM_FIELD_COPYTOCPU_RED_NOT_DROPPED_PACKET; 21709 } else if (fldval == 0x2) { 21710 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21711 BCM_FIELD_COPYTOCPU_RED_DROPPED_PACKET; 21712 } else if (fldval == 0x3) { 21713 f_ent_wb_info->action_copytocpu_wb.params.flags |= 21714 BCM_FIELD_COPYTOCPU_RED_PACKET; 21715 } 21716 break; 21717 } 21718 #endif 21719 switch (fldval) { 21720 case 1: 21721 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21722 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21723 break; 21724 } 21725 action = bcmFieldActionRpCopyToCpu; 21726 param1 = PolicyGet(unit, policy_mem, policy_entry, MATCHED_RULEf); 21727 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21728 _bcmFieldActionNoParamRpCopyToCpuZeroParam1)) || 21729 (param1 != 0)) { 21730 param0 = 1; 21731 } 21732 append = 1; 21733 break; 21734 case 2: 21735 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21736 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21737 break; 21738 } 21739 action = PolicyGet(unit, policy_mem, policy_entry, R_DROPf) == 2 21740 ? bcmFieldActionRpTimeStampToCpuCancel 21741 : bcmFieldActionRpCopyToCpuCancel; 21742 append = 1; 21743 break; 21744 case 3: 21745 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21746 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21747 break; 21748 } 21749 action = bcmFieldActionRpSwitchToCpuCancel; 21750 append = 1; 21751 break; 21752 case 4: 21753 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21754 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21755 break; 21756 } 21757 action = bcmFieldActionRpSwitchToCpuReinstate; 21758 append = 1; 21759 break; 21760 case 5: 21761 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21762 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21763 break; 21764 } 21765 action = bcmFieldActionRpTimeStampToCpu; 21766 param1 = PolicyGet(unit, policy_mem, policy_entry, MATCHED_RULEf); 21767 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21768 _bcmFieldActionNoParamRpCopyToCpuZeroParam1)) || 21769 (param1 != 0)) { 21770 param0 = 1; 21771 } 21772 append = 1; 21773 break; 21774 case 6: 21775 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21776 _bcmFieldActionNoParamCopyToCpuNoColor)) { 21777 break; 21778 } 21779 action = bcmFieldActionRpCopyToCpuCancel; 21780 rv = _field_trx_actions_recover_action_add(unit, 21781 f_ent, 21782 action, 21783 param0, 21784 param1, 21785 param2, 21786 param3, 21787 param4, 21788 param5, 21789 hw_index); 21790 if (BCM_FAILURE(rv)) { 21791 return rv; 21792 } 21793 21794 action = bcmFieldActionRpSwitchToCpuCancel; 21795 rv = _field_trx_actions_recover_action_add(unit, 21796 f_ent, 21797 action, 21798 param0, 21799 param1, 21800 param2, 21801 param3, 21802 param4, 21803 param5, 21804 hw_index); 21805 if (BCM_FAILURE(rv)) { 21806 return rv; 21807 } 21808 append = 0; 21809 break; 21810 default: 21811 break; /* Do nothing */ 21812 } 21813 break; 21814 case PACKET_REDIRECTIONf: 21815 switch (fldval) { 21816 case 1: 21817 if (PolicyGet(unit, policy_mem, policy_entry, 21818 REDIRECTIONf) & 0x20) { 21819 action = bcmFieldActionRedirectTrunk; 21820 param0 = PolicyGet(unit, policy_mem, policy_entry, 21821 REDIRECTIONf) & 0x1f; 21822 } else { 21823 action = bcmFieldActionRedirect; 21824 if (SOC_IS_GREYHOUND2(unit)) { 21825 param0 = PolicyGet(unit, policy_mem, policy_entry, 21826 REDIRECTIONf) >> 7; 21827 param1 = PolicyGet(unit, policy_mem, policy_entry, 21828 REDIRECTIONf) & 0x7f; 21829 } else { 21830 param0 = PolicyGet(unit, policy_mem, policy_entry, 21831 REDIRECTIONf) >> 6; 21832 param1 = PolicyGet(unit, policy_mem, policy_entry, 21833 REDIRECTIONf) & 0x3f; 21834 } 21835 } 21836 append = 1; 21837 break; 21838 case 2: 21839 action = bcmFieldActionRedirectCancel; 21840 append = 1; 21841 break; 21842 case 3: 21843 action = bcmFieldActionRedirectPbmp; 21844 param0 = PolicyGet(unit, policy_mem, policy_entry, REDIRECTIONf); 21845 append = 1; 21846 break; 21847 case 4: 21848 action = bcmFieldActionEgressMask; 21849 param0 = PolicyGet(unit, policy_mem, policy_entry, REDIRECTIONf); 21850 append = 1; 21851 break; 21852 default: 21853 break; /* Do nothing */ 21854 } 21855 break; 21856 case DROPf: 21857 switch (fldval) { 21858 case 1: 21859 action = bcmFieldActionDrop; 21860 append = 1; 21861 break; 21862 case 2: 21863 action = bcmFieldActionDropCancel; 21864 append = 1; 21865 break; 21866 default: 21867 break; /* Do nothing */ 21868 } 21869 break; 21870 21871 case R_DROPf: 21872 switch (fldval) { 21873 case 1: 21874 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21875 _bcmFieldActionNoParamDropNoColor)) { 21876 break; 21877 } 21878 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS 21879 && PolicyGet(unit, 21880 policy_mem, 21881 policy_entry, 21882 R_COPY_TO_CPUf 21883 ) 21884 == 5 21885 ) { 21886 break; 21887 } 21888 21889 action = bcmFieldActionRpDrop; 21890 append = 1; 21891 21892 break; 21893 21894 case 2: 21895 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21896 _bcmFieldActionNoParamDropNoColor)) { 21897 break; 21898 } 21899 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS 21900 && PolicyGet(unit, 21901 policy_mem, 21902 policy_entry, 21903 R_COPY_TO_CPUf 21904 ) 21905 == 2 21906 ) { 21907 break; 21908 } 21909 21910 action = bcmFieldActionRpDropCancel; 21911 append = 1; 21912 21913 break; 21914 21915 default: 21916 ; 21917 } 21918 21919 break; 21920 21921 case Y_DROPf: 21922 switch (fldval) { 21923 case 1: 21924 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21925 _bcmFieldActionNoParamDropNoColor)) { 21926 break; 21927 } 21928 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS 21929 && PolicyGet(unit, 21930 policy_mem, 21931 policy_entry, 21932 Y_COPY_TO_CPUf 21933 ) 21934 == 5 21935 ) { 21936 break; 21937 } 21938 21939 action = bcmFieldActionYpDrop; 21940 append = 1; 21941 21942 break; 21943 21944 case 2: 21945 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21946 _bcmFieldActionNoParamDropNoColor)) { 21947 break; 21948 } 21949 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS 21950 && PolicyGet(unit, 21951 policy_mem, 21952 policy_entry, 21953 Y_COPY_TO_CPUf 21954 ) 21955 == 2 21956 ) { 21957 break; 21958 } 21959 21960 action = bcmFieldActionYpDropCancel; 21961 append = 1; 21962 21963 break; 21964 21965 default: 21966 ; 21967 } 21968 21969 break; 21970 21971 case G_DROPf: 21972 switch (fldval) { 21973 case 1: 21974 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21975 _bcmFieldActionNoParamDropNoColor)) { 21976 action = bcmFieldActionDrop; 21977 append = 1; 21978 break; 21979 } 21980 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS 21981 && PolicyGet(unit, 21982 policy_mem, 21983 policy_entry, 21984 G_COPY_TO_CPUf 21985 ) 21986 == 5 21987 ) { 21988 break; 21989 } 21990 21991 action = bcmFieldActionGpDrop; 21992 append = 1; 21993 21994 break; 21995 21996 case 2: 21997 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 21998 _bcmFieldActionNoParamDropNoColor)) { 21999 action = bcmFieldActionDropCancel; 22000 append = 1; 22001 break; 22002 } 22003 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS 22004 && PolicyGet(unit, 22005 policy_mem, 22006 policy_entry, 22007 G_COPY_TO_CPUf 22008 ) 22009 == 2 22010 ) { 22011 break; 22012 } 22013 22014 action = bcmFieldActionGpDropCancel; 22015 append = 1; 22016 22017 break; 22018 22019 default: 22020 ; 22021 } 22022 22023 break; 22024 22025 case MIRROR_OVERRIDEf: 22026 if (fldval) { 22027 action = bcmFieldActionMirrorOverride; 22028 append = 1; 22029 } 22030 22031 break; 22032 case G_L3SW_CHANGE_MACDA_OR_VLANf: 22033 /* Some chips (e.g. TR2, Apollo) have 2 names for the same field */ 22034 if (soc_mem_field_valid(unit, policy_mem, 22035 G_L3SW_CHANGE_MACDA_OR_VLANf) 22036 && soc_mem_field_valid(unit, policy_mem, 22037 G_L3SW_CHANGE_L2_FIELDSf) 22038 && fld == G_L3SW_CHANGE_MACDA_OR_VLANf) { 22039 /* Both names valid 22040 * => Skip the second (older) name of this field 22041 */ 22042 continue; 22043 } 22044 switch (fldval) { 22045 case 1: 22046 action = bcmFieldActionL3ChangeVlan; 22047 if (PolicyGet(unit, policy_mem, policy_entry, ECMPf)) { 22048 ecmp_paths = PolicyGet(unit, policy_mem, 22049 policy_entry, ECMP_COUNTf) + 1; 22050 nh_ecmp = PolicyGet(unit, policy_mem, 22051 policy_entry, ECMP_PTRf); 22052 param0 = _FP_L3_ACTION_PACK_ECMP(nh_ecmp, ecmp_paths); 22053 } else { 22054 nh_ecmp = PolicyGet(unit, policy_mem, 22055 policy_entry, NEXT_HOP_INDEXf); 22056 param0 = _FP_L3_ACTION_PACK_NEXT_HOP(nh_ecmp); 22057 } 22058 append = 1; 22059 22060 if (PolicyGet(unit, policy_mem, policy_entry, ECMPf) == 0) { 22061 22062 /* Get the Next Hop Index value */ 22063 hw_index = PolicyGet(unit, policy_mem, policy_entry, 22064 NEXT_HOP_INDEXf); 22065 22066 /* Read Next Hop information into entry */ 22067 rv = soc_mem_read(unit, EGR_L3_NEXT_HOPm, 22068 MEM_BLOCK_ANY, hw_index, 22069 egr_l3_next_hop_entry.entry_data); 22070 if (BCM_FAILURE(rv)) { 22071 return (rv); 22072 } 22073 22074 /* Get the VLAN ID infomation */ 22075 if (SOC_IS_SC_CQ(unit)) { 22076 vlan_id = soc_mem_field32_get(unit, EGR_L3_NEXT_HOPm, 22077 egr_l3_next_hop_entry.entry_data, 22078 INTF_NUMf); 22079 } else { 22080 vlan_id = soc_mem_field32_get(unit, EGR_L3_NEXT_HOPm, 22081 egr_l3_next_hop_entry.entry_data, 22082 OVIDf); 22083 } 22084 22085 /* Re-Create bcmFieldActionOuterVlanNew action for the 22086 * FP entry */ 22087 rv = _field_trx_actions_recover_action_add(unit, 22088 f_ent, bcmFieldActionOuterVlanNew, vlan_id, 0, 22089 0, 0, 0, 0, hw_index); 22090 if (BCM_FAILURE(rv)) { 22091 return (rv); 22092 } 22093 } 22094 break; 22095 case 2: 22096 action = bcmFieldActionL3ChangeVlanCancel; 22097 append = 1; 22098 break; 22099 case 3: 22100 action = bcmFieldActionAddClassTag; 22101 nh_ecmp = PolicyGet(unit, policy_mem, policy_entry, 22102 NEXT_HOP_INDEXf); 22103 param0 = _FP_L3_ACTION_PACK_NEXT_HOP(nh_ecmp); 22104 append = 1; 22105 break; 22106 case 4: 22107 action = bcmFieldActionL3ChangeMacDa; 22108 if (PolicyGet(unit, policy_mem, policy_entry, ECMPf)) { 22109 ecmp_paths = PolicyGet(unit, policy_mem, 22110 policy_entry, ECMP_COUNTf) + 1; 22111 nh_ecmp = PolicyGet(unit, policy_mem, 22112 policy_entry, ECMP_PTRf); 22113 param0 = _FP_L3_ACTION_PACK_ECMP(nh_ecmp, ecmp_paths); 22114 } else { 22115 nh_ecmp = PolicyGet(unit, policy_mem, 22116 policy_entry, NEXT_HOP_INDEXf); 22117 param0 = _FP_L3_ACTION_PACK_NEXT_HOP(nh_ecmp); 22118 } 22119 append = 1; 22120 22121 if (PolicyGet(unit, policy_mem, policy_entry, ECMPf) == 0) { 22122 22123 /* Get the Next Hop Index value */ 22124 hw_index = PolicyGet(unit, policy_mem, policy_entry, 22125 NEXT_HOP_INDEXf); 22126 22127 /* Read Next Hop information into entry */ 22128 rv = soc_mem_read(unit, EGR_L3_NEXT_HOPm, 22129 MEM_BLOCK_ANY, hw_index, 22130 egr_l3_next_hop_entry.entry_data); 22131 if (BCM_FAILURE(rv)) { 22132 return (rv); 22133 } 22134 22135 /* Get the DA/DMAC infomation */ 22136 soc_mem_mac_addr_get(unit, EGR_L3_NEXT_HOPm, 22137 egr_l3_next_hop_entry.entry_data, 22138 MAC_ADDRESSf, mac_addr); 22139 SAL_MAC_ADDR_TO_UINT32(mac_addr, mac_addr_words); 22140 22141 /* Re-Create bcmFieldActionDstMacNew action for the 22142 * FP entry */ 22143 rv = _field_trx_actions_recover_action_add(unit, 22144 f_ent, bcmFieldActionDstMacNew, 22145 mac_addr_words[0], mac_addr_words[1], 0, 0, 22146 0, 0, hw_index); 22147 if (BCM_FAILURE(rv)) { 22148 return (rv); 22149 } 22150 } 22151 break; 22152 case 5: 22153 action = bcmFieldActionL3ChangeMacDaCancel; 22154 append = 1; 22155 break; 22156 case 6: 22157 action = bcmFieldActionL3Switch; 22158 #if defined INCLUDE_L3 22159 if (PolicyGet(unit, policy_mem, policy_entry, ECMPf)) { 22160 ecmp_paths = PolicyGet(unit, policy_mem, 22161 policy_entry, ECMPf) + 1; 22162 nh_ecmp = PolicyGet(unit, policy_mem, 22163 policy_entry, ECMP_NH_INFOf); 22164 param0 = (nh_ecmp) + 22165 (BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit)); 22166 } else { 22167 nh_ecmp = PolicyGet(unit, policy_mem, 22168 policy_entry, NEXT_HOP_INDEXf); 22169 param0 = (nh_ecmp) + 22170 (BCM_XGS3_EGRESS_IDX_MIN(unit)); 22171 } 22172 append = 1; 22173 #endif 22174 break; 22175 case 7: 22176 action = bcmFieldActionL3SwitchCancel; 22177 append = 1; 22178 break; 22179 default: 22180 break; /* Do nothing */ 22181 } 22182 break; 22183 22184 case G_L3SW_CHANGE_L2_FIELDSf: 22185 switch (fldval) { 22186 int class_tag; 22187 case 1: 22188 #if defined INCLUDE_L3 22189 if (SOC_MEM_FIELD_VALID(unit, policy_mem, ECMPf) && 22190 PolicyGet(unit, policy_mem, policy_entry, ECMPf)) { 22191 ecmp_paths = PolicyGet(unit, policy_mem, 22192 policy_entry, ECMPf) + 1; 22193 nh_ecmp = PolicyGet(unit, policy_mem, 22194 policy_entry, ECMP_PTRf); 22195 param0 = (nh_ecmp) + (BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit)); 22196 action = bcmFieldActionChangeL2Fields; 22197 append = 1; 22198 break; 22199 } 22200 /* 22201 * Skip recovery for actions under this field as it has 22202 * dependency with L3 module. As L3 module recovery happends 22203 * after Field module, the recovery for these actions has to 22204 * be performed after getting callback from L3. 22205 */ 22206 _FP_XGS3_ALLOC(l3_cb, sizeof(_bcm_field_l3_callback_recover_t), 22207 "Field L3 Callback Recover Alloc."); 22208 if (l3_cb == NULL) { 22209 return BCM_E_MEMORY; 22210 } 22211 22212 l3_cb->f_ent = f_ent; 22213 l3_cb->action = bcmFieldActionChangeL2Fields; 22214 l3_cb->next = NULL; 22215 22216 nh_ecmp = PolicyGet(unit, policy_mem, policy_entry, 22217 NEXT_HOP_INDEXf); 22218 l3_cb->param0 = (nh_ecmp) + (BCM_XGS3_EGRESS_IDX_MIN(unit)); 22219 l3_cb->hw_index = nh_ecmp; 22220 22221 if (_field_l3_cb == NULL) { 22222 _field_l3_cb = l3_cb; 22223 } else { 22224 _bcm_field_l3_callback_recover_t *_cb; 22225 22226 for (_cb = _field_l3_cb; _cb != NULL; _cb = _cb->next) { 22227 if (_cb->next == NULL) { 22228 _cb->next = l3_cb; 22229 break; 22230 } 22231 } 22232 } 22233 #endif /* INCLUDE_L3 */ 22234 break; 22235 case 3: 22236 /*recover fabricQueue action*/ 22237 if ((action_sync == 1) && 22238 SHR_BITGET(f_ent_wb_info->action_bmp->w, 22239 _bcmFieldActionNoParamFabricQueue)) { 22240 action = bcmFieldActionFabricQueue; 22241 append = 1; 22242 param0 = f_ent_wb_info->action_fabricQueue_wb.cosq_gport; 22243 #if defined(BCM_KATANA_SUPPORT) 22244 tag_type = PolicyGet(unit, policy_mem, policy_entry, 22245 EH_TAG_TYPEf); 22246 if (SOC_IS_KATANAX(unit) && tag_type == 2) { 22247 param1 = f_ent_wb_info->action_fabricQueue_wb.profile_idx; 22248 cosq_idx = PolicyGet(unit, policy_mem, policy_entry, 22249 EH_QUEUE_TAGf); 22250 rv = _bcm_field_fabricQueue_action_node_increment_ref_Count( 22251 unit, cosq_idx, param1); 22252 if (rv == BCM_E_NOT_FOUND) { 22253 rv = _bcm_field_fabricQueue_action_node_add ( 22254 unit, cosq_idx, param1); 22255 if (BCM_FAILURE(rv)) { 22256 return (rv); 22257 } 22258 } 22259 } 22260 #endif /*BCM_KATANA_SUPPORT */ 22261 } 22262 break; 22263 case 4: 22264 action = bcmFieldActionAddClassTag; 22265 class_tag = PolicyGet(unit, policy_mem, policy_entry, 22266 NEXT_HOP_INDEXf); 22267 param0 = _FP_L3_ACTION_PACK_NEXT_HOP(class_tag); 22268 append = 1; 22269 break; 22270 case 6: 22271 action = bcmFieldActionL3Switch; 22272 #if defined INCLUDE_L3 22273 if (PolicyGet(unit, policy_mem, policy_entry, ECMPf)) { 22274 ecmp_paths = PolicyGet(unit, policy_mem, 22275 policy_entry, ECMPf) + 1; 22276 nh_ecmp = PolicyGet(unit, policy_mem, 22277 policy_entry, ECMP_PTRf); 22278 param0 = (nh_ecmp) + 22279 (BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit)); 22280 } else { 22281 nh_ecmp = PolicyGet(unit, policy_mem, 22282 policy_entry, NEXT_HOP_INDEXf); 22283 param0 = (nh_ecmp) + 22284 (BCM_XGS3_EGRESS_IDX_MIN(unit)); 22285 } 22286 append = 1; 22287 #endif /* INCLUDE_L3 */ 22288 break; 22289 case 7: 22290 action = bcmFieldActionL3SwitchCancel; 22291 append = 1; 22292 break; 22293 #if defined (BCM_TRIUMPH3_SUPPORT) 22294 case 9: 22295 if (SOC_IS_TRIUMPH3(unit)) { 22296 index = PolicyGet(unit, policy_mem, 22297 policy_entry, L2MOD_TBL_INDEXf); 22298 rv = _field_tr3_actions_recover_replaceL2Fields(unit, 22299 index, 22300 f_ent); 22301 if (BCM_FAILURE(rv)) { 22302 return (rv); 22303 } 22304 } 22305 break; 22306 #endif 22307 default: 22308 ; 22309 } 22310 22311 break; 22312 22313 case DROP_PRECEDENCEf: 22314 if (fldval) { 22315 action = bcmFieldActionDropPrecedence; 22316 param0 = fldval; 22317 append = 1; 22318 } 22319 break; 22320 case RP_DROP_PRECEDENCEf: 22321 if (fldval) { 22322 action = bcmFieldActionRpDropPrecedence; 22323 param0 = fldval; 22324 append = 1; 22325 } 22326 break; 22327 case YP_DROP_PRECEDENCEf: 22328 if (fldval) { 22329 action = bcmFieldActionYpDropPrecedence; 22330 param0 = fldval; 22331 append = 1; 22332 } 22333 break; 22334 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) \ 22335 || defined(BCM_TRIDENT2_SUPPORT) 22336 case FLEX_CTR_BASE_COUNTER_IDXf: 22337 #if defined BCM_TRIDENT2PLUS_SUPPORT 22338 if ((SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) 22339 && (f_ent->group->stage_id 22340 == _BCM_FIELD_STAGE_INGRESS)) { 22341 if (fldval) { 22342 if(PolicyGet(unit, policy_mem, policy_entry, 22343 G_L3SW_CHANGE_L2_FIELDSf) == 0x9) { 22344 stat_action = PolicyGet(unit, policy_mem, 22345 policy_entry, FLEX_COUNTER_ACTIONf); 22346 if (f_ent_wb_info->f_ent_oam_wb != NULL) { 22347 BCM_IF_ERROR_RETURN( 22348 _field_extended_flex_counter_recover(unit, 22349 f_ent, part, f_ent_wb_info->sid, f_ent_wb_info->f_ent_oam_wb, 22350 stat_action)); 22351 } 22352 } 22353 } 22354 } else if ((SOC_IS_TRIDENT3X(unit) || SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) 22355 && (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 22356 if (fldval) { 22357 stat_action = bcmFieldStatActionIncrement; 22358 if(PolicyGet(unit, policy_mem, policy_entry, 22359 FLEX_COUNTER_DSCP_SELf) == 0x1) { 22360 if (SOC_IS_APACHE(unit)) { 22361 stat_action = PolicyGet(unit, policy_mem, 22362 policy_entry, FLEX_COUNTER_ACTIONf); 22363 } 22364 if (f_ent_wb_info->f_ent_oam_wb != NULL) { 22365 BCM_IF_ERROR_RETURN( 22366 _field_extended_flex_counter_recover(unit, 22367 f_ent, part, f_ent_wb_info->sid, f_ent_wb_info->f_ent_oam_wb, 22368 stat_action)); 22369 } 22370 } 22371 } 22372 } else 22373 #endif 22374 { 22375 if (fldval) { 22376 BCM_IF_ERROR_RETURN(_field_flex_counter_recover( 22377 unit, f_ent, part, f_ent_wb_info->sid)); 22378 } 22379 } 22380 break; 22381 #endif 22382 #if defined(BCM_HURRICANE3_SUPPORT) 22383 case VLAN_CTR_ENABLEf: 22384 if (fldval) { 22385 BCM_IF_ERROR_RETURN(_field_flowcnt_counter_recover( 22386 unit, f_ent, part, f_ent_wb_info->sid)); 22387 } 22388 break; 22389 #endif 22390 case COUNTER_MODEf: 22391 if (fldval) { 22392 ctr_mode = fldval; 22393 ctr_idx = PolicyGet(unit, policy_mem, policy_entry, 22394 COUNTER_INDEXf); 22395 BCM_IF_ERROR_RETURN 22396 (_field_tr2_counter_recover(unit, 22397 f_ent, 22398 ctr_mode, 22399 ctr_idx, 22400 part, 22401 f_ent_wb_info->sid 22402 ) 22403 ); 22404 } 22405 break; 22406 22407 case EXT_COUNTER_MODEf: 22408 if (fldval != 0) { 22409 BCM_IF_ERROR_RETURN 22410 (_field_tr2_counter_recover(unit, 22411 f_ent, 22412 fldval, 22413 f_ent->slice_idx, 22414 part, 22415 f_ent_wb_info->sid 22416 ) 22417 ); 22418 } 22419 22420 break; 22421 22422 #ifdef BCM_TRIUMPH3_SUPPORT 22423 case COUNTER_SETf: 22424 if (fldval) { 22425 BCM_IF_ERROR_RETURN 22426 (_bcm_field_tr3_counter_recover(unit, 22427 f_ent, 22428 policy_entry, 22429 part, 22430 f_ent_wb_info->sid)); 22431 } 22432 break; 22433 #endif 22434 22435 case METER_PAIR_MODEf: 22436 #ifdef BCM_TRIUMPH3_SUPPORT 22437 if (SOC_IS_TRIUMPH3(unit)) { 22438 BCM_IF_ERROR_RETURN 22439 (_bcm_field_tr3_meter_recover(unit, 22440 f_ent, 22441 part, 22442 f_ent_wb_info->pid, 22443 0, 22444 policy_mem, 22445 policy_entry, 22446 &already_recovered 22447 ) 22448 ); 22449 } else 22450 #endif 22451 { 22452 BCM_IF_ERROR_RETURN( 22453 SOC_IS_SC_CQ(unit) 22454 ? _field_sc_cq_meter_recover(unit, 22455 f_ent, 22456 part, 22457 f_ent_wb_info->pid, 22458 policy_entry, 22459 &already_recovered 22460 ) 22461 : _field_trx_meter_recover(unit, 22462 f_ent, 22463 part, 22464 f_ent_wb_info->pid, 22465 0, 22466 policy_mem, 22467 policy_entry, 22468 &already_recovered 22469 ) 22470 ); 22471 } 22472 if (1 == already_recovered) { 22473 _field_trx_meter_recover_configured_rates(unit, 22474 f_ent, 0, 22475 f_ent_wb_info); 22476 } 22477 break; 22478 22479 case METER_SHARING_MODEf: 22480 #ifdef BCM_TRIUMPH3_SUPPORT 22481 if (SOC_IS_TRIUMPH3(unit)) { 22482 BCM_IF_ERROR_RETURN 22483 (_bcm_field_tr3_meter_recover(unit, 22484 f_ent, 22485 part, 22486 f_ent_wb_info->pid1, 22487 1, 22488 policy_mem, 22489 policy_entry, 22490 &already_recovered 22491 ) 22492 ); 22493 } else 22494 #endif 22495 { 22496 22497 BCM_IF_ERROR_RETURN 22498 (_field_trx_meter_recover(unit, 22499 f_ent, 22500 part, 22501 f_ent_wb_info->pid1, 22502 1, 22503 policy_mem, 22504 policy_entry, 22505 &already_recovered 22506 ) 22507 ); 22508 } 22509 if (1 == already_recovered) { 22510 _field_trx_meter_recover_configured_rates(unit, 22511 f_ent, 1, 22512 f_ent_wb_info); 22513 } 22514 break; 22515 22516 case CHANGE_CPU_COSf: 22517 switch (fldval) { 22518 case 1: /* Change CPU CoS */ 22519 action = bcmFieldActionCosQCpuNew; 22520 param0 = PolicyGet(unit, 22521 policy_mem, 22522 policy_entry, 22523 soc_mem_field_valid(unit, policy_mem, NEW_CPU_COSf) 22524 ? NEW_CPU_COSf : CPU_COSf 22525 ); 22526 append = 1; 22527 22528 break; 22529 22530 case 2: 22531 val = PolicyGet(unit, policy_mem, policy_entry, 22532 CPU_COSf); 22533 if ((val & 0x10) && (val & 0x20)) { 22534 action = bcmFieldActionServicePoolIdPrecedenceNew; 22535 param1 = (val & 0x3); 22536 /* SPAP is 2b'00 for BCM_FIELD_COLOR_GREEN 22537 2b'01 for BCM_FIELD_COLOR_RED 22538 2b'11 for BCM_FIELD_COLOR_YELLOW 22539 */ 22540 param1 = ((0 == param1) ? BCM_FIELD_COLOR_GREEN : \ 22541 ((3 == param1) ? BCM_FIELD_COLOR_YELLOW : BCM_FIELD_COLOR_RED)); 22542 } 22543 else if (val & 0x20) { 22544 action = bcmFieldActionServicePoolIdNew; 22545 } 22546 else { 22547 break; 22548 } 22549 param0 = ((val >> 2) & 0x3); 22550 append = 1; 22551 break; 22552 22553 22554 default: 22555 ; 22556 } 22557 22558 break; 22559 22560 case PID_IPFIX_ACTIONSf: 22561 #ifdef BCM_TRIDENT2_SUPPORT 22562 if (fldval) { 22563 if (SOC_IS_TD2_TT2(unit)) { 22564 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22565 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22566 break; 22567 } 22568 } 22569 } 22570 } 22571 #endif 22572 switch (fldval) { 22573 case 1: 22574 action = bcmFieldActionIpFix; 22575 append = 1; 22576 break; 22577 case 2: 22578 action = bcmFieldActionIpFixCancel; 22579 append = 1; 22580 break; 22581 default: 22582 break; /* Do nothing */ 22583 } 22584 break; 22585 case PID_REPLACE_INNER_VIDf: 22586 if (fldval) { 22587 #ifdef BCM_TRIDENT2_SUPPORT 22588 if (SOC_IS_TD2_TT2(unit)) { 22589 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22590 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22591 break; 22592 } 22593 } 22594 } 22595 #endif 22596 action = bcmFieldActionInnerVlanNew; 22597 param0 = PolicyGet(unit, policy_mem, policy_entry, PID_NEW_INNER_VIDf); 22598 append = 1; 22599 } 22600 break; 22601 case PID_REPLACE_INNER_PRIf: 22602 if (fldval) { 22603 #ifdef BCM_TRIDENT2_SUPPORT 22604 if (SOC_IS_TD2_TT2(unit)) { 22605 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22606 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22607 break; 22608 } 22609 } 22610 } 22611 #endif 22612 action = bcmFieldActionInnerVlanPrioNew; 22613 param0 = PolicyGet(unit, policy_mem, policy_entry, PID_NEW_INNER_PRIf); 22614 append = 1; 22615 } 22616 break; 22617 case PID_REPLACE_OUTER_VIDf: 22618 if (fldval) { 22619 #ifdef BCM_TRIDENT2_SUPPORT 22620 if (SOC_IS_TD2_TT2(unit)) { 22621 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22622 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22623 break; 22624 } 22625 } 22626 } 22627 #endif 22628 action = bcmFieldActionOuterVlanNew; 22629 param0 = PolicyGet(unit, policy_mem, policy_entry, PID_NEW_OUTER_VIDf); 22630 append = 1; 22631 } 22632 break; 22633 case PID_REPLACE_OUTER_TPIDf: 22634 if (fldval) { 22635 uint32 mode; 22636 uint16 tpid; 22637 22638 #ifdef BCM_TRIDENT2_SUPPORT 22639 if (SOC_IS_TD2_TT2(unit)) { 22640 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22641 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22642 break; 22643 } 22644 } 22645 } 22646 #endif 22647 action = bcmFieldActionOuterTpidNew; 22648 mode = PolicyGet(unit, policy_mem, policy_entry, PID_OUTER_TPID_INDEXf); 22649 BCM_IF_ERROR_RETURN 22650 (_field_tpid_hw_decode(unit, mode, &tpid)); 22651 param0 = tpid; 22652 append = 1; 22653 } 22654 break; 22655 22656 case VXLAN_RESERVED_2f: 22657 if (fldval) { 22658 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22659 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22660 action = bcmFieldActionVxlanHeaderBits56_63_Set; 22661 param0 = PolicyGet(unit, policy_mem, policy_entry, VXLAN_RESERVED_2f); 22662 append = 1; 22663 } 22664 } 22665 } 22666 break; 22667 case VXLAN_RESERVED_1f: 22668 if (fldval) { 22669 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22670 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22671 action = bcmFieldActionVxlanHeaderBits8_31_Set; 22672 param0 = PolicyGet(unit, policy_mem, policy_entry, VXLAN_RESERVED_1f); 22673 append = 1; 22674 } 22675 } 22676 } 22677 break; 22678 case VXLAN_FLAGSf: 22679 if (fldval) { 22680 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22681 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22682 action = bcmFieldActionVxlanHeaderFlags; 22683 param0 = PolicyGet(unit, policy_mem, policy_entry, VXLAN_FLAGSf); 22684 append = 1; 22685 } 22686 } 22687 } 22688 break; 22689 case R_CHANGE_DSCPf: 22690 #if defined BCM_TRIDENT2PLUS_SUPPORT 22691 if ((SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) && 22692 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 22693 if(PolicyGet(unit, policy_mem, policy_entry, 22694 FLEX_COUNTER_DSCP_SELf) == 0x1) { 22695 break; 22696 } 22697 } 22698 #endif 22699 switch (fldval) { 22700 case 1: 22701 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 22702 _bcmFieldActionNoParamDscpNoColor)) { 22703 break; 22704 } 22705 action = bcmFieldActionRpDscpNew; 22706 param0 = PolicyGet(unit, policy_mem, policy_entry, R_NEW_DSCPf); 22707 append = 1; 22708 break; 22709 22710 case 2: 22711 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 22712 _bcmFieldActionNoParamDscpNoColor)) { 22713 break; 22714 } 22715 action = bcmFieldActionRpDscpCancel; 22716 append = 1; 22717 break; 22718 22719 default: 22720 ; 22721 } 22722 break; 22723 22724 case Y_CHANGE_DSCPf: 22725 #if defined BCM_TRIDENT2PLUS_SUPPORT 22726 if ((SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) && 22727 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 22728 if(PolicyGet(unit, policy_mem, policy_entry, 22729 FLEX_COUNTER_DSCP_SELf) == 0x1) { 22730 break; 22731 } 22732 } 22733 #endif 22734 switch (fldval) { 22735 case 1: 22736 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 22737 _bcmFieldActionNoParamDscpNoColor)) { 22738 break; 22739 } 22740 action = bcmFieldActionYpDscpNew; 22741 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_NEW_DSCPf); 22742 append = 1; 22743 break; 22744 22745 case 2: 22746 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 22747 _bcmFieldActionNoParamDscpNoColor)) { 22748 break; 22749 } 22750 action = bcmFieldActionYpDscpCancel; 22751 append = 1; 22752 break; 22753 22754 default: 22755 ; 22756 } 22757 22758 break; 22759 22760 case G_CHANGE_DSCPf: 22761 #if defined BCM_TRIDENT2PLUS_SUPPORT 22762 if ((SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) && 22763 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 22764 if(PolicyGet(unit, policy_mem, policy_entry, 22765 FLEX_COUNTER_DSCP_SELf) == 0x1) { 22766 break; 22767 } 22768 } 22769 #endif 22770 switch (fldval) { 22771 case 1: 22772 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 22773 _bcmFieldActionNoParamDscpNoColor)) { 22774 action = bcmFieldActionDscpNew; 22775 } else { 22776 action = bcmFieldActionGpDscpNew; 22777 } 22778 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_DSCPf); 22779 append = 1; 22780 break; 22781 22782 case 2: 22783 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 22784 _bcmFieldActionNoParamDscpNoColor)) { 22785 action = bcmFieldActionDscpCancel; 22786 } else { 22787 action = bcmFieldActionGpDscpCancel; 22788 } 22789 append = 1; 22790 break; 22791 22792 default: 22793 ; 22794 } 22795 22796 break; 22797 22798 case G_CHANGE_DSCP_TOSf: 22799 switch (fldval) { 22800 case 1: 22801 action = bcmFieldActionGpTosPrecedenceNew; 22802 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_DSCP_TOSf); 22803 22804 append = 1; 22805 22806 break; 22807 22808 case 2: 22809 action = bcmFieldActionGpTosPrecedenceCopy; 22810 22811 append = 1; 22812 22813 break; 22814 22815 case 3: 22816 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 22817 _bcmFieldActionNoParamDscpNoColor)) { 22818 action = bcmFieldActionDscpNew; 22819 } else { 22820 action = bcmFieldActionGpDscpNew; 22821 } 22822 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_DSCP_TOSf); 22823 append = 1; 22824 break; 22825 22826 case 4: 22827 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 22828 _bcmFieldActionNoParamDscpNoColor)) { 22829 action = bcmFieldActionDscpCancel; 22830 } else { 22831 action = bcmFieldActionGpDscpCancel; 22832 } 22833 append = 1; 22834 break; 22835 22836 default: 22837 ; 22838 } 22839 22840 break; 22841 22842 case R_REPLACE_INNER_PRIf: 22843 if (fldval) { 22844 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22845 _bcmFieldActionNoParamInnerVlanPriNewNoColor))) { 22846 break; 22847 } 22848 action = bcmFieldActionRpInnerVlanPrioNew; 22849 param0 = PolicyGet(unit, policy_mem, policy_entry, R_NEW_INNER_PRIf); 22850 append = 1; 22851 } 22852 break; 22853 case Y_REPLACE_INNER_PRIf: 22854 if (fldval) { 22855 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22856 _bcmFieldActionNoParamInnerVlanPriNewNoColor))) { 22857 break; 22858 } 22859 action = bcmFieldActionYpInnerVlanPrioNew; 22860 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_NEW_INNER_PRIf); 22861 append = 1; 22862 } 22863 break; 22864 case G_REPLACE_INNER_PRIf: 22865 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22866 _bcmFieldActionNoParamInnerVlanPriNewNoColor))) { 22867 action = bcmFieldActionInnerVlanPrioNew; 22868 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_INNER_PRIf); 22869 append = 1; 22870 } else if (fldval) { 22871 action = bcmFieldActionGpInnerVlanPrioNew; 22872 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_INNER_PRIf); 22873 append = 1; 22874 } 22875 break; 22876 case R_CHANGE_DOT1Pf: 22877 if (fldval) { 22878 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22879 _bcmFieldActionNoParamOuterVlanPriNewNoColor))) { 22880 break; 22881 } 22882 action = bcmFieldActionRpOuterVlanPrioNew; 22883 param0 = PolicyGet(unit, policy_mem, policy_entry, R_NEW_DOT1Pf); 22884 append = 1; 22885 } 22886 break; 22887 case Y_CHANGE_DOT1Pf: 22888 if (fldval) { 22889 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22890 _bcmFieldActionNoParamOuterVlanPriNewNoColor))) { 22891 break; 22892 } 22893 action = bcmFieldActionYpOuterVlanPrioNew; 22894 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_NEW_DOT1Pf); 22895 append = 1; 22896 } 22897 break; 22898 case G_CHANGE_DOT1Pf: 22899 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22900 _bcmFieldActionNoParamOuterVlanPriNewNoColor))) { 22901 action = bcmFieldActionOuterVlanPrioNew; 22902 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_DOT1Pf); 22903 append = 1; 22904 } 22905 if (fldval) { 22906 action = bcmFieldActionGpOuterVlanPrioNew; 22907 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_DOT1Pf); 22908 append = 1; 22909 } 22910 break; 22911 case R_CHANGE_INNER_CFIf: 22912 if (fldval) { 22913 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22914 _bcmFieldActionNoParamInnerVlanCfiNewNoColor))) { 22915 break; 22916 } 22917 action = bcmFieldActionRpInnerVlanCfiNew; 22918 param0 = PolicyGet(unit, policy_mem, policy_entry, R_NEW_INNER_CFIf); 22919 append = 1; 22920 } 22921 break; 22922 case Y_CHANGE_INNER_CFIf: 22923 if (fldval) { 22924 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22925 _bcmFieldActionNoParamInnerVlanCfiNewNoColor))) { 22926 break; 22927 } 22928 action = bcmFieldActionYpInnerVlanCfiNew; 22929 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_NEW_INNER_CFIf); 22930 append = 1; 22931 } 22932 break; 22933 case G_CHANGE_INNER_CFIf: 22934 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22935 _bcmFieldActionNoParamInnerVlanCfiNewNoColor))) { 22936 action = bcmFieldActionInnerVlanCfiNew; 22937 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_INNER_CFIf); 22938 append = 1; 22939 } else if (fldval) { 22940 action = bcmFieldActionGpInnerVlanCfiNew; 22941 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_INNER_CFIf); 22942 append = 1; 22943 } 22944 break; 22945 case R_CHANGE_OUTER_CFIf: 22946 if (fldval) { 22947 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22948 _bcmFieldActionNoParamOuterVlanCfiNewNoColor))) { 22949 break; 22950 } 22951 action = bcmFieldActionRpOuterVlanCfiNew; 22952 param0 = PolicyGet(unit, policy_mem, policy_entry, R_NEW_OUTER_CFIf); 22953 append = 1; 22954 } 22955 break; 22956 case Y_CHANGE_OUTER_CFIf: 22957 if (fldval) { 22958 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22959 _bcmFieldActionNoParamOuterVlanCfiNewNoColor))) { 22960 break; 22961 } 22962 action = bcmFieldActionYpOuterVlanCfiNew; 22963 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_NEW_OUTER_CFIf); 22964 append = 1; 22965 } 22966 break; 22967 case G_CHANGE_OUTER_CFIf: 22968 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 22969 _bcmFieldActionNoParamOuterVlanCfiNewNoColor))) { 22970 action = bcmFieldActionOuterVlanCfiNew; 22971 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_OUTER_CFIf); 22972 append = 1; 22973 } 22974 if (fldval) { 22975 action = bcmFieldActionGpOuterVlanCfiNew; 22976 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_OUTER_CFIf); 22977 append = 1; 22978 } 22979 break; 22980 case PID_COUNTER_MODEf: 22981 if (fldval) { 22982 #ifdef BCM_TRIDENT2_SUPPORT 22983 if ((SOC_IS_TD2_TT2(unit)) && 22984 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 22985 if (SOC_MEM_FIELD_VALID(unit, policy_mem, VXLAN_ACTIONf)) { 22986 if (PolicyGet(unit, policy_mem, policy_entry, VXLAN_ACTIONf) == 1) { 22987 break; 22988 } 22989 } 22990 } 22991 #endif 22992 22993 ctr_mode = fldval; 22994 ctr_idx = PolicyGet(unit, policy_mem, policy_entry, 22995 PID_COUNTER_INDEXf); 22996 BCM_IF_ERROR_RETURN 22997 (_field_tr2_counter_recover(unit, 22998 f_ent, 22999 ctr_mode, 23000 ctr_idx, 23001 part, 23002 f_ent_wb_info->sid 23003 ) 23004 ); 23005 } 23006 break; 23007 case OAM_PBBTE_LOOKUP_ENABLEf: 23008 if (fldval) { 23009 action = bcmFieldActionOamPbbteLookupEnable; 23010 param0 = fldval; 23011 append = 1; 23012 } 23013 break; 23014 #if defined(BCM_TRIUMPH2_SUPPORT) 23015 case USE_VINTF_CTR_IDXf: 23016 if (fldval && flex_info[unit].valid) { 23017 ctr_idx = PolicyGet(unit, policy_mem, policy_entry, 23018 VINTF_CTR_IDXf); 23019 if (ctr_idx) { 23020 BCM_IF_ERROR_RETURN(_field_vfp_flex_counter_recover( 23021 unit, f_ent, part, ctr_idx, f_ent_wb_info->sid)); 23022 } 23023 } 23024 break; 23025 #endif 23026 case CPU_COSf: 23027 if ((_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) && fldval) { 23028 action = bcmFieldActionCosQCpuNew; 23029 param0 = fldval; 23030 append = 1; 23031 } 23032 break; 23033 case DO_NOT_LEARNf: 23034 if (fldval) { 23035 action = bcmFieldActionDoNotLearn; 23036 append = 1; 23037 } 23038 break; 23039 case CHANGE_INT_PRIORITYf: 23040 if (fldval) { 23041 if (!soc_feature(unit, soc_feature_td3_style_fp)) { 23042 if (SOC_IS_TD_TT(unit) 23043 || SOC_IS_KATANAX(unit) 23044 || SOC_IS_TRIUMPH3(unit)) { 23045 pkt_int_new = PolicyGet(unit, policy_mem, policy_entry, 23046 CHANGE_OUTER_DOT1Pf); 23047 } else { 23048 pkt_int_new = PolicyGet(unit, policy_mem, policy_entry, 23049 CHANGE_PKT_PRIORITYf); 23050 } 23051 } 23052 23053 if (1 == pkt_int_new) { 23054 action = bcmFieldActionPrioPktAndIntNew; 23055 } else { 23056 action = bcmFieldActionPrioIntNew; 23057 } 23058 param0 = PolicyGet(unit, policy_mem, policy_entry, NEW_INT_PRIORITYf); 23059 append = 1; 23060 } 23061 break; 23062 case CHANGE_PKT_PRIORITYf: 23063 if (fldval) { 23064 if (PolicyGet(unit, policy_mem, policy_entry, 23065 CHANGE_INT_PRIORITYf) == 1) { 23066 action = bcmFieldActionPrioPktAndIntNew; 23067 } else { 23068 action = bcmFieldActionPrioPktNew; 23069 } 23070 param0 = PolicyGet(unit, policy_mem, policy_entry, NEW_PKT_PRIORITYf); 23071 append = 1; 23072 } 23073 break; 23074 case OUTER_VLAN_ACTIONSf: 23075 switch (fldval) { 23076 case 1: 23077 action = bcmFieldActionOuterVlanAdd; 23078 param0 = PolicyGet(unit, policy_mem, policy_entry, NEW_OUTER_VLANf); 23079 append = 1; 23080 break; 23081 case 2: 23082 action = bcmFieldActionOuterVlanNew; 23083 param0 = PolicyGet(unit, policy_mem, policy_entry, NEW_OUTER_VLANf); 23084 append = 1; 23085 break; 23086 case 3: 23087 action = bcmFieldActionOuterVlanLookup; 23088 param0 = PolicyGet(unit, policy_mem, policy_entry, NEW_OUTER_VLANf); 23089 append = 1; 23090 break; 23091 case 4: 23092 action = bcmFieldActionOuterVlanCopyInner; 23093 append = 1; 23094 default: 23095 break; /* Do nothing */ 23096 } 23097 break; 23098 case INNER_VLAN_ACTIONSf: 23099 switch (fldval) { 23100 case 1: 23101 action = bcmFieldActionInnerVlanAdd; 23102 param0 = PolicyGet(unit, policy_mem, policy_entry, NEW_INNER_VLANf); 23103 append = 1; 23104 break; 23105 case 2: 23106 action = bcmFieldActionInnerVlanNew; 23107 param0 = PolicyGet(unit, policy_mem, policy_entry, NEW_INNER_VLANf); 23108 append = 1; 23109 break; 23110 case 3: 23111 action = bcmFieldActionInnerVlanDelete; 23112 append = 1; 23113 break; 23114 case 4: 23115 action = bcmFieldActionInnerVlanCopyOuter; 23116 append = 1; 23117 break; 23118 default: 23119 break; /* Do nothing */ 23120 } 23121 break; 23122 case CHANGE_CNGf: 23123 if (fldval) { 23124 param0 = PolicyGet(unit, policy_mem, policy_entry, NEW_CNGf); 23125 action = bcmFieldActionDropPrecedence; 23126 switch (param0) { 23127 case 0: 23128 param0 = BCM_FIELD_COLOR_GREEN; 23129 append = 1; 23130 break; 23131 case 1: 23132 param0 = BCM_FIELD_COLOR_RED; 23133 append = 1; 23134 break; 23135 case 3: 23136 param0 = BCM_FIELD_COLOR_YELLOW; 23137 append = 1; 23138 break; 23139 default: 23140 break; /* Do nothing */ 23141 } 23142 } 23143 break; 23144 23145 case R_CHANGE_PKT_PRIf: 23146 switch (fldval) { 23147 case 4: 23148 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23149 _bcmFieldActionNoParamPrioPktNoColor))) { 23150 break; 23151 } 23152 action = PolicyGet(unit, 23153 policy_mem, 23154 policy_entry, 23155 R_CHANGE_COS_OR_INT_PRIf 23156 ) 23157 == 4 23158 ? bcmFieldActionRpPrioPktAndIntCopy 23159 : bcmFieldActionRpPrioPktCopy; 23160 append = 1; 23161 23162 break; 23163 23164 case 5: 23165 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23166 _bcmFieldActionNoParamPrioPktNoColor))) { 23167 break; 23168 } 23169 action = PolicyGet(unit, 23170 policy_mem, 23171 policy_entry, 23172 R_CHANGE_COS_OR_INT_PRIf 23173 ) 23174 == 5 23175 ? bcmFieldActionRpPrioPktAndIntNew 23176 : bcmFieldActionRpPrioPktNew; 23177 param0 = PolicyGet(unit, policy_mem, policy_entry, R_NEW_PKT_PRIf); 23178 append = 1; 23179 23180 break; 23181 23182 case 6: 23183 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23184 _bcmFieldActionNoParamPrioPktNoColor))) { 23185 break; 23186 } 23187 action = PolicyGet(unit, 23188 policy_mem, 23189 policy_entry, 23190 R_CHANGE_COS_OR_INT_PRIf 23191 ) 23192 == 6 23193 ? bcmFieldActionRpPrioPktAndIntTos 23194 : bcmFieldActionRpPrioPktTos; 23195 append = 1; 23196 23197 break; 23198 23199 case 7: 23200 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23201 _bcmFieldActionNoParamPrioPktNoColor))) { 23202 break; 23203 } 23204 action = PolicyGet(unit, 23205 policy_mem, 23206 policy_entry, 23207 R_CHANGE_COS_OR_INT_PRIf 23208 ) 23209 == 7 23210 ? bcmFieldActionRpPrioPktAndIntCancel 23211 : bcmFieldActionRpPrioPktCancel; 23212 append = 1; 23213 23214 break; 23215 23216 default: 23217 ; 23218 } 23219 23220 break; 23221 23222 case R_CHANGE_COS_OR_INT_PRIf: 23223 switch (fldval) { 23224 case 1: 23225 if (SOC_IS_TD_TT(unit)) { 23226 /* Recovered as part of G_CHANGE_COS_OR_INT_PRIf */ 23227 if ((1 == PolicyGet(unit, policy_mem, policy_entry, 23228 G_CHANGE_COS_OR_INT_PRIf)) 23229 && (1 == PolicyGet(unit, policy_mem, policy_entry, 23230 Y_CHANGE_COS_OR_INT_PRIf))) { 23231 continue; 23232 } 23233 action = bcmFieldActionRpCosQNew; 23234 param0 = PolicyGet(unit, 23235 policy_mem, 23236 policy_entry, 23237 R_COS_INT_PRIf 23238 ) 23239 & 0xf; 23240 append = 1; 23241 } else if (SOC_IS_TRIUMPH3(unit)) { 23242 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf); 23243 uc_cosq = param0 & 0xf; 23244 mc_cosq = (param0 >> 0x4) & 0xf; 23245 23246 if (uc_cosq != mc_cosq) { 23247 rv = _field_trx_actions_recover_action_add(unit, 23248 f_ent, bcmFieldActionRpUcastCosQNew, uc_cosq, 23249 0, 0, 0, 0, 0, hw_index); 23250 if (BCM_FAILURE(rv)) { 23251 return (rv); 23252 } 23253 rv = _field_trx_actions_recover_action_add(unit, 23254 f_ent, bcmFieldActionRpMcastCosQNew, mc_cosq, 23255 0, 0, 0, 0, 0, hw_index); 23256 if (BCM_FAILURE(rv)) { 23257 return (rv); 23258 } 23259 } else { 23260 action = bcmFieldActionRpCosQNew; 23261 param0 = uc_cosq; 23262 append = 1; 23263 } 23264 } else if (SOC_IS_GREYHOUND2(unit)) { 23265 /* Recovered as part of G_CHANGE_COS_OR_INT_PRIf */ 23266 if ((1 == PolicyGet(unit, policy_mem, policy_entry, 23267 G_CHANGE_COS_OR_INT_PRIf)) 23268 && (1 == PolicyGet(unit, policy_mem, policy_entry, 23269 Y_CHANGE_COS_OR_INT_PRIf))) { 23270 continue; 23271 } 23272 action = bcmFieldActionRpCosQNew; 23273 param0 = PolicyGet(unit, policy_mem, 23274 policy_entry, R_COS_INT_PRIf); 23275 append = 1; 23276 } else { 23277 action = bcmFieldActionRpCosQNew; 23278 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf); 23279 23280 append = 1; 23281 } 23282 23283 break; 23284 23285 case 2: 23286 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 23287 || SOC_IS_TRIUMPH3(unit)) { 23288 action= bcmFieldActionRpUcastQueueNew; 23289 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf); 23290 append = 1; 23291 } else if (SOC_IS_TD_TT(unit)) { 23292 action = bcmFieldActionRpCosQNew; 23293 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0x7f; 23294 append = 1; 23295 } else { 23296 action = bcmFieldActionRpVlanCosQNew; 23297 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) - 8; 23298 append = 1; 23299 } 23300 23301 break; 23302 23303 case 3: 23304 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 23305 action= bcmFieldActionRpIntCosUcastQueueNew; 23306 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0xfff; 23307 param1 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) >> 12; 23308 append = 1; 23309 } else if (SOC_IS_TRIUMPH3(unit)) { 23310 action= bcmFieldActionRpIntCosUcastQueueNew; 23311 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0x3ff; 23312 append = 1; 23313 } 23314 break; 23315 23316 23317 case 4: 23318 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23319 _bcmFieldActionNoParamPrioIntNoColor)) { 23320 break; 23321 } 23322 if (PolicyGet(unit, 23323 policy_mem, 23324 policy_entry, 23325 R_CHANGE_PKT_PRIf 23326 ) 23327 != 4 23328 ) { 23329 action = bcmFieldActionRpPrioIntCopy; 23330 23331 append = 1; 23332 } 23333 23334 break; 23335 23336 case 5: 23337 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23338 _bcmFieldActionNoParamPrioIntNoColor)) { 23339 break; 23340 } 23341 if (PolicyGet(unit, 23342 policy_mem, 23343 policy_entry, 23344 R_CHANGE_PKT_PRIf 23345 ) 23346 != 5 23347 ) { 23348 action = bcmFieldActionRpPrioIntNew; 23349 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf); 23350 23351 append = 1; 23352 } 23353 23354 break; 23355 23356 case 6: 23357 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23358 _bcmFieldActionNoParamPrioIntNoColor)) { 23359 break; 23360 } 23361 if (PolicyGet(unit, 23362 policy_mem, 23363 policy_entry, 23364 R_CHANGE_PKT_PRIf 23365 ) 23366 != 6 23367 ) { 23368 action = bcmFieldActionRpPrioIntTos; 23369 23370 append = 1; 23371 } 23372 23373 break; 23374 23375 case 7: 23376 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23377 _bcmFieldActionNoParamPrioIntNoColor)) { 23378 break; 23379 } 23380 if (PolicyGet(unit, 23381 policy_mem, 23382 policy_entry, 23383 R_CHANGE_PKT_PRIf 23384 ) 23385 != 7 23386 ) { 23387 action = bcmFieldActionRpPrioIntCancel; 23388 23389 append = 1; 23390 } 23391 23392 break; 23393 case 8: 23394 if (SOC_IS_TD_TT(unit)) { 23395 if ((8 == PolicyGet(unit, policy_mem, policy_entry, 23396 G_CHANGE_COS_OR_INT_PRIf)) 23397 && (8 == PolicyGet(unit, policy_mem, policy_entry, 23398 Y_CHANGE_COS_OR_INT_PRIf))) { 23399 /* recovered as part of G_CHANGE_COS_OR_INT_PRIf */ 23400 continue; 23401 } else { 23402 action = bcmFieldActionRpUcastCosQNew; 23403 param0 = PolicyGet(unit, 23404 policy_mem, 23405 policy_entry, 23406 R_COS_INT_PRIf) 23407 & 0xf; 23408 append = 1; 23409 } 23410 } else if (SOC_IS_TRIUMPH3(unit)) { 23411 action = bcmFieldActionRpUcastCosQNew; 23412 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf); 23413 append = 1; 23414 } else if ( SOC_IS_KATANA2(unit)) { 23415 action = bcmFieldActionRpUcastQueueNew; 23416 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf); 23417 append = 1; 23418 } 23419 23420 break; 23421 case 9: 23422 if (SOC_IS_TD_TT(unit)) { 23423 if ((9 == PolicyGet(unit, policy_mem, policy_entry, 23424 G_CHANGE_COS_OR_INT_PRIf)) 23425 && (9 == PolicyGet(unit, policy_mem, policy_entry, 23426 Y_CHANGE_COS_OR_INT_PRIf))) { 23427 /* recovered as part of G_CHANGE_COS_OR_INT_PRIf */ 23428 continue; 23429 } else { 23430 action = bcmFieldActionRpMcastCosQNew; 23431 param0 = (PolicyGet(unit, 23432 policy_mem, 23433 policy_entry, 23434 R_COS_INT_PRIf) >> 0x4) 23435 & 0xf; 23436 append = 1; 23437 } 23438 } else if (SOC_IS_TRIUMPH3(unit)) { 23439 action = bcmFieldActionRpMcastCosQNew; 23440 param0 = (PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) >> 0x4) & 0xf; 23441 append = 1; 23442 } else if (SOC_IS_SABER2(unit)) { 23443 action = bcmFieldActionRpIntCosUcastQueueNew; 23444 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0x3ff; 23445 param1 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) >> 10; 23446 append = 1; 23447 } else if (SOC_IS_KATANA2(unit)) { 23448 action = bcmFieldActionRpIntCosUcastQueueNew; 23449 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0xfff; 23450 param1 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) >> 12; 23451 append = 1; 23452 } 23453 23454 break; 23455 23456 23457 case 10 : 23458 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 23459 defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 23460 if (SOC_IS_SABER2(unit)) { 23461 if (PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0x400) { 23462 action = bcmFieldActionRpServicePrioIntCosQNew; 23463 } else { 23464 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23465 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 23466 break; 23467 } else { 23468 action = bcmFieldActionRpPortPrioIntCosQNew; 23469 } 23470 } 23471 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23472 _bcmFieldActionNoParamRpPortPrioIntCosQNew)) { 23473 param1 = f_ent_wb_info->rp_port_prio_int_gport; 23474 } else { 23475 param1 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0x1ff; 23476 } 23477 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) >> 10; 23478 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 23479 append = 1; 23480 } else if (SOC_IS_KATANA2(unit) 23481 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 23482 if (SOC_IS_KATANA2(unit) && PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0x800) { 23483 action = bcmFieldActionRpServicePrioIntCosQNew; 23484 } else { 23485 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23486 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 23487 break; 23488 } else { 23489 action = bcmFieldActionRpPortPrioIntCosQNew; 23490 } 23491 } 23492 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23493 _bcmFieldActionNoParamRpPortPrioIntCosQNew)) { 23494 param1 = f_ent_wb_info->rp_port_prio_int_gport; 23495 } else { 23496 param1 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0x3ff; 23497 } 23498 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) >> 12; 23499 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 23500 append = 1; 23501 } else if (SOC_IS_TRIUMPH3(unit)) { 23502 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23503 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 23504 break; 23505 } else { 23506 action = bcmFieldActionRpPortPrioIntCosQNew; 23507 } 23508 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23509 _bcmFieldActionNoParamRpPortPrioIntCosQNew)) { 23510 param1 = f_ent_wb_info->rp_port_prio_int_gport; 23511 } else { 23512 param1 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) & 0x1ff; 23513 } 23514 param0 = PolicyGet(unit, policy_mem, policy_entry, R_COS_INT_PRIf) >> 9; 23515 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 23516 append = 1; 23517 } 23518 #endif 23519 default: 23520 ; 23521 } 23522 23523 break; 23524 23525 case Y_CHANGE_PKT_PRIf: 23526 switch (fldval) { 23527 case 4: 23528 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23529 _bcmFieldActionNoParamPrioPktNoColor))) { 23530 break; 23531 } 23532 action = PolicyGet(unit, 23533 policy_mem, 23534 policy_entry, 23535 Y_CHANGE_COS_OR_INT_PRIf 23536 ) 23537 == 4 23538 ? bcmFieldActionYpPrioPktAndIntCopy 23539 : bcmFieldActionYpPrioPktCopy; 23540 append = 1; 23541 23542 break; 23543 23544 case 5: 23545 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23546 _bcmFieldActionNoParamPrioPktNoColor))) { 23547 break; 23548 } 23549 action = PolicyGet(unit, 23550 policy_mem, 23551 policy_entry, 23552 Y_CHANGE_COS_OR_INT_PRIf 23553 ) 23554 == 5 23555 ? bcmFieldActionYpPrioPktAndIntNew 23556 : bcmFieldActionYpPrioPktNew; 23557 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_NEW_PKT_PRIf); 23558 append = 1; 23559 23560 break; 23561 23562 case 6: 23563 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23564 _bcmFieldActionNoParamPrioPktNoColor))) { 23565 break; 23566 } 23567 action = PolicyGet(unit, 23568 policy_mem, 23569 policy_entry, 23570 Y_CHANGE_COS_OR_INT_PRIf 23571 ) 23572 == 6 23573 ? bcmFieldActionYpPrioPktAndIntTos 23574 : bcmFieldActionYpPrioPktTos; 23575 append = 1; 23576 23577 break; 23578 23579 case 7: 23580 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23581 _bcmFieldActionNoParamPrioPktNoColor))) { 23582 break; 23583 } 23584 action = PolicyGet(unit, 23585 policy_mem, 23586 policy_entry, 23587 Y_CHANGE_COS_OR_INT_PRIf 23588 ) 23589 == 7 23590 ? bcmFieldActionYpPrioPktAndIntCancel 23591 : bcmFieldActionYpPrioPktCancel; 23592 append = 1; 23593 23594 break; 23595 23596 default: 23597 ; 23598 } 23599 23600 break; 23601 23602 case Y_CHANGE_COS_OR_INT_PRIf: 23603 switch (fldval) { 23604 case 1: 23605 if (SOC_IS_TD_TT(unit)) { 23606 /* Recovered as part of G_CHANGE_COS_OR_INT_PRIf */ 23607 if ((1 == PolicyGet(unit, policy_mem, policy_entry, 23608 G_CHANGE_COS_OR_INT_PRIf)) 23609 && (1 == PolicyGet(unit, policy_mem, policy_entry, 23610 R_CHANGE_COS_OR_INT_PRIf))) { 23611 continue; 23612 } 23613 action = bcmFieldActionYpCosQNew; 23614 param0 = PolicyGet(unit, 23615 policy_mem, 23616 policy_entry, 23617 Y_COS_INT_PRIf 23618 ) 23619 & 0xf; 23620 23621 append = 1; 23622 } else if (SOC_IS_TRIUMPH3(unit)) { 23623 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf); 23624 uc_cosq = param0 & 0xf; 23625 mc_cosq = (param0 >> 0x4) & 0xf; 23626 23627 if (uc_cosq != mc_cosq) { 23628 rv = _field_trx_actions_recover_action_add(unit, 23629 f_ent, bcmFieldActionYpUcastCosQNew, uc_cosq, 23630 0, 0, 0, 0, 0, hw_index); 23631 if (BCM_FAILURE(rv)) { 23632 return (rv); 23633 } 23634 rv = _field_trx_actions_recover_action_add(unit, 23635 f_ent, bcmFieldActionYpMcastCosQNew, mc_cosq, 23636 0, 0, 0, 0, 0, hw_index); 23637 if (BCM_FAILURE(rv)) { 23638 return (rv); 23639 } 23640 } else { 23641 action = bcmFieldActionYpCosQNew; 23642 param0 = uc_cosq; 23643 append = 1; 23644 } 23645 } else if (SOC_IS_GREYHOUND2(unit)) { 23646 /* Recovered as part of G_CHANGE_COS_OR_INT_PRIf */ 23647 if ((1 == PolicyGet(unit, policy_mem, policy_entry, 23648 G_CHANGE_COS_OR_INT_PRIf)) 23649 && (1 == PolicyGet(unit, policy_mem, policy_entry, 23650 R_CHANGE_COS_OR_INT_PRIf))) { 23651 continue; 23652 } 23653 action = bcmFieldActionYpCosQNew; 23654 param0 = PolicyGet(unit, policy_mem, 23655 policy_entry, Y_COS_INT_PRIf); 23656 append = 1; 23657 } else { 23658 action = bcmFieldActionYpCosQNew; 23659 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf); 23660 23661 append = 1; 23662 } 23663 23664 break; 23665 23666 case 2: 23667 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 23668 || SOC_IS_TRIUMPH3(unit)) { 23669 action= bcmFieldActionYpUcastQueueNew; 23670 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf); 23671 append = 1; 23672 } else if (SOC_IS_TD_TT(unit)) { 23673 action = bcmFieldActionYpCosQNew; 23674 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0x7f; 23675 append = 1; 23676 } else { 23677 action = bcmFieldActionYpVlanCosQNew; 23678 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) - 8; 23679 append = 1; 23680 } 23681 break; 23682 23683 case 3: 23684 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 23685 action= bcmFieldActionYpIntCosUcastQueueNew; 23686 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0xfff; 23687 param1 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) >> 12; 23688 append = 1; 23689 } else if (SOC_IS_TRIUMPH3(unit)) { 23690 action= bcmFieldActionYpIntCosUcastQueueNew; 23691 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0x3ff; 23692 append = 1; 23693 } 23694 break; 23695 23696 case 4: 23697 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23698 _bcmFieldActionNoParamPrioIntNoColor)) { 23699 break; 23700 } 23701 if (PolicyGet(unit, 23702 policy_mem, 23703 policy_entry, 23704 Y_CHANGE_PKT_PRIf 23705 ) 23706 != 4 23707 ) { 23708 action = bcmFieldActionYpPrioIntCopy; 23709 23710 append = 1; 23711 } 23712 23713 break; 23714 23715 case 5: 23716 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23717 _bcmFieldActionNoParamPrioIntNoColor)) { 23718 break; 23719 } 23720 if (PolicyGet(unit, 23721 policy_mem, 23722 policy_entry, 23723 Y_CHANGE_PKT_PRIf 23724 ) 23725 != 5 23726 ) { 23727 action = bcmFieldActionYpPrioIntNew; 23728 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf); 23729 23730 append = 1; 23731 } 23732 23733 break; 23734 23735 case 6: 23736 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23737 _bcmFieldActionNoParamPrioIntNoColor)) { 23738 break; 23739 } 23740 if (PolicyGet(unit, 23741 policy_mem, 23742 policy_entry, 23743 Y_CHANGE_PKT_PRIf 23744 ) 23745 != 6 23746 ) { 23747 action = bcmFieldActionYpPrioIntTos; 23748 23749 append = 1; 23750 } 23751 23752 break; 23753 23754 case 7: 23755 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23756 _bcmFieldActionNoParamPrioIntNoColor)) { 23757 break; 23758 } 23759 if (PolicyGet(unit, 23760 policy_mem, 23761 policy_entry, 23762 Y_CHANGE_PKT_PRIf 23763 ) 23764 != 7 23765 ) { 23766 action = bcmFieldActionYpPrioIntCancel; 23767 23768 append = 1; 23769 } 23770 23771 break; 23772 case 8: 23773 if (SOC_IS_TD_TT(unit)) { 23774 if ((8 == PolicyGet(unit, policy_mem, policy_entry, 23775 G_CHANGE_COS_OR_INT_PRIf)) 23776 && (8 == PolicyGet(unit, policy_mem, policy_entry, 23777 R_CHANGE_COS_OR_INT_PRIf))) { 23778 /* recovered as part of G_CHANGE_COS_OR_INT_PRIf */ 23779 continue; 23780 } else { 23781 action = bcmFieldActionYpUcastCosQNew; 23782 param0 = PolicyGet(unit, 23783 policy_mem, 23784 policy_entry, 23785 Y_COS_INT_PRIf) 23786 & 0xf; 23787 append = 1; 23788 } 23789 } else if (SOC_IS_TRIUMPH3(unit)) { 23790 action = bcmFieldActionYpUcastCosQNew; 23791 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf); 23792 append = 1; 23793 } else if ( SOC_IS_KATANA2(unit)) { 23794 action = bcmFieldActionYpUcastQueueNew; 23795 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf); 23796 append = 1; 23797 } 23798 23799 break; 23800 case 9: 23801 if (SOC_IS_TD_TT(unit)) { 23802 if ((9 == PolicyGet(unit, policy_mem, policy_entry, 23803 G_CHANGE_COS_OR_INT_PRIf)) 23804 && (9 == PolicyGet(unit, policy_mem, policy_entry, 23805 R_CHANGE_COS_OR_INT_PRIf))) { 23806 /* recovered as part of G_CHANGE_COS_OR_INT_PRIf */ 23807 continue; 23808 } else { 23809 action = bcmFieldActionYpMcastCosQNew; 23810 param0 = (PolicyGet(unit, 23811 policy_mem, 23812 policy_entry, 23813 Y_COS_INT_PRIf) >> 0x4) 23814 & 0xf; 23815 append = 1; 23816 } 23817 } else if (SOC_IS_TRIUMPH3(unit)) { 23818 action = bcmFieldActionYpMcastCosQNew; 23819 param0 = (PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) >> 0x4) & 0xf; 23820 append = 1; 23821 } else if (SOC_IS_SABER2(unit)) { 23822 action = bcmFieldActionYpIntCosUcastQueueNew; 23823 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0x3ff; 23824 param1 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) >> 10; 23825 append = 1; 23826 } else if (SOC_IS_KATANA2(unit)) { 23827 action = bcmFieldActionYpIntCosUcastQueueNew; 23828 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0xfff; 23829 param1 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) >> 12; 23830 append = 1; 23831 } 23832 break; 23833 23834 case 10 : 23835 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 23836 defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 23837 if (SOC_IS_SABER2(unit)) { 23838 if (PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0x400) { 23839 action = bcmFieldActionYpServicePrioIntCosQNew; 23840 } else { 23841 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23842 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 23843 break; 23844 } else { 23845 action = bcmFieldActionYpPortPrioIntCosQNew; 23846 } 23847 } 23848 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23849 _bcmFieldActionNoParamYpPortPrioIntCosQNew)) { 23850 param1 = f_ent_wb_info->yp_port_prio_int_gport; 23851 } else { 23852 param1 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0x1ff; 23853 } 23854 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) >> 10; 23855 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 23856 append = 1; 23857 } else if (SOC_IS_KATANA2(unit) 23858 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 23859 if (SOC_IS_KATANA2(unit) && PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0x800) { 23860 action = bcmFieldActionYpServicePrioIntCosQNew; 23861 } else { 23862 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23863 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 23864 break; 23865 } else { 23866 action = bcmFieldActionYpPortPrioIntCosQNew; 23867 } 23868 } 23869 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23870 _bcmFieldActionNoParamYpPortPrioIntCosQNew)) { 23871 param1 = f_ent_wb_info->yp_port_prio_int_gport; 23872 } else { 23873 param1 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0x3ff; 23874 } 23875 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) >> 12; 23876 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 23877 append = 1; 23878 } else if (SOC_IS_TRIUMPH3(unit)) { 23879 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23880 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 23881 break; 23882 } else { 23883 action = bcmFieldActionYpPortPrioIntCosQNew; 23884 } 23885 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 23886 _bcmFieldActionNoParamYpPortPrioIntCosQNew)) { 23887 param1 = f_ent_wb_info->yp_port_prio_int_gport; 23888 } else { 23889 param1 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) & 0x1ff; 23890 } 23891 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_COS_INT_PRIf) >> 9; 23892 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 23893 append = 1; 23894 } 23895 #endif 23896 default: 23897 ; 23898 } 23899 23900 break; 23901 23902 case G_CHANGE_PKT_PRIf: 23903 switch (fldval) { 23904 case 4: 23905 val = PolicyGet(unit, 23906 policy_mem, 23907 policy_entry, 23908 G_CHANGE_COS_OR_INT_PRIf); 23909 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23910 _bcmFieldActionNoParamPrioPktNoColor))) { 23911 action = (val == 4) ? bcmFieldActionPrioPktAndIntCopy 23912 : bcmFieldActionPrioPktCopy; 23913 } else { 23914 action = (val == 4) ? bcmFieldActionGpPrioPktAndIntCopy 23915 : bcmFieldActionGpPrioPktCopy; 23916 } 23917 append = 1; 23918 break; 23919 23920 case 5: 23921 val = PolicyGet(unit, 23922 policy_mem, 23923 policy_entry, 23924 G_CHANGE_COS_OR_INT_PRIf); 23925 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23926 _bcmFieldActionNoParamPrioPktNoColor))) { 23927 action = (val == 5) ? bcmFieldActionPrioPktAndIntNew 23928 : bcmFieldActionPrioPktNew; 23929 } else { 23930 action = (val == 5) ? bcmFieldActionGpPrioPktAndIntNew 23931 : bcmFieldActionGpPrioPktNew; 23932 } 23933 param0 = PolicyGet(unit, policy_mem, policy_entry, G_NEW_PKT_PRIf); 23934 append = 1; 23935 break; 23936 23937 case 6: 23938 val = PolicyGet(unit, 23939 policy_mem, 23940 policy_entry, 23941 G_CHANGE_COS_OR_INT_PRIf); 23942 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23943 _bcmFieldActionNoParamPrioPktNoColor))) { 23944 action = (val == 6) ? bcmFieldActionPrioPktAndIntTos 23945 : bcmFieldActionPrioPktTos; 23946 } else { 23947 action = (val == 6) ? bcmFieldActionGpPrioPktAndIntTos 23948 : bcmFieldActionGpPrioPktTos; 23949 } 23950 append = 1; 23951 break; 23952 23953 case 7: 23954 val = PolicyGet(unit, 23955 policy_mem, 23956 policy_entry, 23957 G_CHANGE_COS_OR_INT_PRIf); 23958 if ((action_sync == 1) && (SHR_BITGET(f_ent_wb_info->action_bmp->w, 23959 _bcmFieldActionNoParamPrioPktNoColor))) { 23960 action = (val == 7) ? bcmFieldActionPrioPktAndIntCancel 23961 : bcmFieldActionPrioPktCancel; 23962 } else { 23963 action = (val == 7) ? bcmFieldActionGpPrioPktAndIntCancel 23964 : bcmFieldActionGpPrioPktCancel; 23965 } 23966 append = 1; 23967 break; 23968 23969 default: 23970 ; 23971 } 23972 23973 break; 23974 23975 case G_CHANGE_COS_OR_INT_PRIf: 23976 switch (fldval) { 23977 case 1: 23978 if (SOC_IS_TD_TT(unit)) { 23979 if ((1 == PolicyGet(unit, policy_mem, policy_entry, 23980 Y_CHANGE_COS_OR_INT_PRIf)) 23981 && (1 == PolicyGet(unit, policy_mem, policy_entry, 23982 R_CHANGE_COS_OR_INT_PRIf))) { 23983 uc_cosq = PolicyGet(unit, 23984 policy_mem, 23985 policy_entry, 23986 G_COS_INT_PRIf) 23987 & 0xf; 23988 mc_cosq = ((PolicyGet(unit, 23989 policy_mem, 23990 policy_entry, 23991 G_COS_INT_PRIf) >> 0x4) 23992 & 0xf); 23993 if (uc_cosq == mc_cosq) { 23994 /* 23995 * Since queue values are same, cold boot action 23996 * was set using bcmFieldActionCosQNew 23997 */ 23998 action = bcmFieldActionCosQNew; 23999 param0 = uc_cosq; 24000 append = 1; 24001 } else { 24002 /* 24003 * UC and MC COS queues are different. So, cold 24004 * boot config was done using two actions 24005 * bcmFieldActionUcastCosQNew and 24006 * bcmFieldActionMcastCosQNew 24007 */ 24008 rv = _field_trx_actions_recover_action_add(unit, 24009 f_ent, bcmFieldActionUcastCosQNew, uc_cosq, 24010 0, 0, 0, 0, 0, hw_index); 24011 if (BCM_FAILURE(rv)) { 24012 return (rv); 24013 } 24014 rv = _field_trx_actions_recover_action_add(unit, 24015 f_ent, bcmFieldActionMcastCosQNew, mc_cosq, 24016 0, 0, 0, 0, 0, hw_index); 24017 if (BCM_FAILURE(rv)) { 24018 return (rv); 24019 } 24020 } 24021 } else { 24022 action = bcmFieldActionGpCosQNew; 24023 param0 = PolicyGet(unit, 24024 policy_mem, 24025 policy_entry, 24026 G_COS_INT_PRIf) 24027 & 0xf; 24028 append = 1; 24029 } 24030 } else if (SOC_IS_TRIUMPH3(unit)) { 24031 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf); 24032 uc_cosq = param0 & 0xf; 24033 mc_cosq = (param0 >> 0x4) & 0xf; 24034 24035 if (uc_cosq != mc_cosq) { 24036 rv = _field_trx_actions_recover_action_add(unit, 24037 f_ent, bcmFieldActionGpUcastCosQNew, uc_cosq, 24038 0, 0, 0, 0, 0, hw_index); 24039 if (BCM_FAILURE(rv)) { 24040 return (rv); 24041 } 24042 rv = _field_trx_actions_recover_action_add(unit, 24043 f_ent, bcmFieldActionGpMcastCosQNew, mc_cosq, 24044 0, 0, 0, 0, 0, hw_index); 24045 if (BCM_FAILURE(rv)) { 24046 return (rv); 24047 } 24048 } else { 24049 action = bcmFieldActionGpCosQNew; 24050 param0 = uc_cosq; 24051 append = 1; 24052 } 24053 } else if (SOC_IS_GREYHOUND2(unit)) { 24054 if ((1 == PolicyGet(unit, policy_mem, policy_entry, 24055 Y_CHANGE_COS_OR_INT_PRIf)) 24056 && (1 == PolicyGet(unit, policy_mem, policy_entry, 24057 R_CHANGE_COS_OR_INT_PRIf))) { 24058 /* 24059 * Since G/Y/R are all set, cold boot section set 24060 * action is bcmFieldActionCosQNew 24061 */ 24062 action = bcmFieldActionCosQNew; 24063 param0 = PolicyGet(unit, policy_mem, 24064 policy_entry, G_COS_INT_PRIf); 24065 append = 1; 24066 } else { 24067 action = bcmFieldActionGpCosQNew; 24068 param0 = PolicyGet(unit, policy_mem, 24069 policy_entry, G_COS_INT_PRIf); 24070 append = 1; 24071 } 24072 } else { 24073 action = bcmFieldActionGpCosQNew; 24074 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf); 24075 append = 1; 24076 } 24077 24078 break; 24079 24080 case 2: 24081 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 24082 || SOC_IS_TRIUMPH3(unit)) { 24083 action= bcmFieldActionGpUcastQueueNew; 24084 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf); 24085 append = 1; 24086 } else if (SOC_IS_TD_TT(unit)) { 24087 action = bcmFieldActionGpCosQNew; 24088 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0x7f; 24089 append = 1; 24090 } else { 24091 action = bcmFieldActionGpVlanCosQNew; 24092 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) - 8; 24093 append = 1; 24094 } 24095 break; 24096 24097 case 3: 24098 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 24099 action= bcmFieldActionGpIntCosUcastQueueNew; 24100 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0xfff; 24101 param1 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) >> 12; 24102 append = 1; 24103 } else if (SOC_IS_TRIUMPH3(unit)) { 24104 action= bcmFieldActionGpIntCosUcastQueueNew; 24105 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0x3ff; 24106 append = 1; 24107 } 24108 break; 24109 24110 case 4: 24111 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24112 _bcmFieldActionNoParamPrioIntNoColor)) { 24113 action = bcmFieldActionPrioIntCopy; 24114 append = 1; 24115 break; 24116 } 24117 if (PolicyGet(unit, 24118 policy_mem, 24119 policy_entry, 24120 G_CHANGE_PKT_PRIf 24121 ) 24122 != 4 24123 ) { 24124 action = bcmFieldActionGpPrioIntCopy; 24125 append = 1; 24126 } 24127 24128 break; 24129 24130 case 5: 24131 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24132 _bcmFieldActionNoParamPrioIntNoColor)) { 24133 action = bcmFieldActionPrioIntNew; 24134 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf); 24135 append = 1; 24136 break; 24137 } 24138 if (PolicyGet(unit, 24139 policy_mem, 24140 policy_entry, 24141 G_CHANGE_PKT_PRIf 24142 ) 24143 != 5 24144 ) { 24145 action = bcmFieldActionGpPrioIntNew; 24146 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf); 24147 24148 append = 1; 24149 } 24150 24151 break; 24152 24153 case 6: 24154 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24155 _bcmFieldActionNoParamPrioIntNoColor)) { 24156 action = bcmFieldActionPrioIntTos; 24157 append = 1; 24158 break; 24159 } 24160 if (PolicyGet(unit, 24161 policy_mem, 24162 policy_entry, 24163 G_CHANGE_PKT_PRIf 24164 ) 24165 != 6 24166 ) { 24167 action = bcmFieldActionGpPrioIntTos; 24168 24169 append = 1; 24170 } 24171 24172 break; 24173 24174 case 7: 24175 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24176 _bcmFieldActionNoParamPrioIntNoColor)) { 24177 action = bcmFieldActionPrioIntCancel; 24178 append = 1; 24179 break; 24180 } 24181 if (PolicyGet(unit, 24182 policy_mem, 24183 policy_entry, 24184 G_CHANGE_PKT_PRIf 24185 ) 24186 != 7 24187 ) { 24188 action = bcmFieldActionGpPrioIntCancel; 24189 24190 append = 1; 24191 } 24192 24193 break; 24194 24195 case 8: 24196 if (SOC_IS_TD_TT(unit)) { 24197 uc_cosq = PolicyGet(unit, 24198 policy_mem, 24199 policy_entry, 24200 G_COS_INT_PRIf) 24201 & 0xf; 24202 if ((8 == PolicyGet(unit, policy_mem, policy_entry, 24203 Y_CHANGE_COS_OR_INT_PRIf)) 24204 && (8 == PolicyGet(unit, policy_mem, policy_entry, 24205 R_CHANGE_COS_OR_INT_PRIf))) { 24206 action = bcmFieldActionUcastCosQNew; 24207 param0 = uc_cosq; 24208 append = 1; 24209 } else { 24210 action = bcmFieldActionGpUcastCosQNew; 24211 param0 = uc_cosq; 24212 append = 1; 24213 } 24214 } else if (SOC_IS_TRIUMPH3(unit)) { 24215 action = bcmFieldActionGpUcastCosQNew; 24216 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf); 24217 append = 1; 24218 } else if ( SOC_IS_KATANA2(unit)) { 24219 action = bcmFieldActionGpUcastQueueNew; 24220 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf); 24221 append = 1; 24222 } 24223 24224 break; 24225 24226 case 9: 24227 if (SOC_IS_TD_TT(unit)) { 24228 mc_cosq = (PolicyGet(unit, 24229 policy_mem, 24230 policy_entry, 24231 G_COS_INT_PRIf) >> 0x4) 24232 & 0xf; 24233 if ((9 == PolicyGet(unit, policy_mem, policy_entry, 24234 Y_CHANGE_COS_OR_INT_PRIf)) 24235 && (9 == PolicyGet(unit, policy_mem, policy_entry, 24236 R_CHANGE_COS_OR_INT_PRIf))) { 24237 action = bcmFieldActionMcastCosQNew; 24238 param0 = mc_cosq; 24239 append = 1; 24240 } else { 24241 action = bcmFieldActionGpMcastCosQNew; 24242 param0 = mc_cosq; 24243 append = 1; 24244 } 24245 } else if (SOC_IS_TRIUMPH3(unit)) { 24246 action = bcmFieldActionGpMcastCosQNew; 24247 param0 = (PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) >> 0x4) & 0xf; 24248 append = 1; 24249 } else if (SOC_IS_SABER2(unit)) { 24250 action = bcmFieldActionGpIntCosUcastQueueNew; 24251 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0x3ff; 24252 param1 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) >> 10; 24253 append = 1; 24254 } else if (SOC_IS_KATANA2(unit)) { 24255 action = bcmFieldActionGpIntCosUcastQueueNew; 24256 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0xfff; 24257 param1 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) >> 12; 24258 append = 1; 24259 } 24260 break; 24261 24262 case 10 : 24263 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 24264 defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 24265 if (SOC_IS_SABER2(unit)) { 24266 if (PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0x400) { 24267 action = bcmFieldActionGpServicePrioIntCosQNew; 24268 } else { 24269 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24270 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 24271 action = bcmFieldActionPortPrioIntCosQNew; 24272 } else { 24273 action = bcmFieldActionGpPortPrioIntCosQNew; 24274 } 24275 } 24276 if ((action_sync == 1) && ((SHR_BITGET(f_ent_wb_info->action_bmp->w, 24277 _bcmFieldActionNoParamGpPortPrioIntCosQNew)) || 24278 (SHR_BITGET(f_ent_wb_info->action_bmp->w, 24279 _bcmFieldActionNoParamPortPrioIntCosQNew)))) { 24280 param1 = f_ent_wb_info->port_prio_int_gport; 24281 } else { 24282 param1 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0x1ff; 24283 } 24284 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) >> 10; 24285 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 24286 append = 1; 24287 } else if (SOC_IS_KATANA2(unit) 24288 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 24289 if (SOC_IS_KATANA2(unit) && PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0x800) { 24290 action = bcmFieldActionGpServicePrioIntCosQNew; 24291 } else { 24292 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24293 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 24294 action = bcmFieldActionPortPrioIntCosQNew; 24295 } else { 24296 action = bcmFieldActionGpPortPrioIntCosQNew; 24297 } 24298 } 24299 if ((action_sync == 1) && ((SHR_BITGET(f_ent_wb_info->action_bmp->w, 24300 _bcmFieldActionNoParamGpPortPrioIntCosQNew)) || 24301 (SHR_BITGET(f_ent_wb_info->action_bmp->w, 24302 _bcmFieldActionNoParamPortPrioIntCosQNew)))) { 24303 param1 = f_ent_wb_info->port_prio_int_gport; 24304 } else { 24305 param1 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0x3ff; 24306 } 24307 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) >> 12; 24308 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 24309 append = 1; 24310 } else if (SOC_IS_TRIUMPH3(unit)) { 24311 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24312 _bcmFieldActionNoParamPortPrioIntCosQNew)) { 24313 action = bcmFieldActionPortPrioIntCosQNew; 24314 } else { 24315 action = bcmFieldActionGpPortPrioIntCosQNew; 24316 } 24317 if ((action_sync == 1) && ((SHR_BITGET(f_ent_wb_info->action_bmp->w, 24318 _bcmFieldActionNoParamGpPortPrioIntCosQNew)) || 24319 (SHR_BITGET(f_ent_wb_info->action_bmp->w, 24320 _bcmFieldActionNoParamPortPrioIntCosQNew)))) { 24321 param1 = f_ent_wb_info->port_prio_int_gport; 24322 } else { 24323 param1 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) & 0x1ff; 24324 } 24325 param0 = PolicyGet(unit, policy_mem, policy_entry, G_COS_INT_PRIf) >> 9; 24326 _BCM_COSQ_CLASSIFIER_FIELD_SET(param0, param0); 24327 append = 1; 24328 } 24329 #endif 24330 break; 24331 24332 24333 default: 24334 ; 24335 } 24336 24337 break; 24338 24339 case R_DROP_PRECEDENCEf: 24340 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24341 _bcmFieldActionNoParamDropPrecedenceNoColor)) { 24342 break; 24343 } 24344 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24345 _bcmFieldActionNoParamRpDropPrecedence))|| (fldval)) { 24346 action = bcmFieldActionRpDropPrecedence; 24347 param0 = fldval; 24348 append = 1; 24349 } 24350 24351 break; 24352 24353 case Y_DROP_PRECEDENCEf: 24354 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24355 _bcmFieldActionNoParamDropPrecedenceNoColor)) { 24356 break; 24357 } 24358 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24359 _bcmFieldActionNoParamYpDropPrecedence))|| (fldval)) { 24360 action = bcmFieldActionYpDropPrecedence; 24361 param0 = fldval; 24362 append = 1; 24363 } 24364 24365 break; 24366 24367 case G_DROP_PRECEDENCEf: 24368 if (((action_sync == 1) && 24369 (SHR_BITGET(f_ent_wb_info->action_bmp->w, 24370 _bcmFieldActionNoParamDropPrecedenceNoColor) || 24371 SHR_BITGET(f_ent_wb_info->action_bmp->w, 24372 _bcmFieldActionNoParamGpDropPrecedence))) || 24373 (fldval)) { 24374 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24375 _bcmFieldActionNoParamDropPrecedenceNoColor)) { 24376 action = bcmFieldActionDropPrecedence; 24377 } else { 24378 action = bcmFieldActionGpDropPrecedence; 24379 } 24380 param0 = fldval; 24381 append = 1; 24382 } 24383 24384 break; 24385 24386 case USE_VFP_CLASS_ID_Lf: 24387 if (fldval) { 24388 action = bcmFieldActionClassDestSet; 24389 param0 = PolicyGet(unit, policy_mem, policy_entry, VFP_CLASS_ID_Lf); 24390 append = 1; 24391 } 24392 break; 24393 case USE_VFP_CLASS_ID_Hf: 24394 if (fldval) { 24395 action = bcmFieldActionClassSourceSet; 24396 param0 = PolicyGet(unit, policy_mem, policy_entry, VFP_CLASS_ID_Hf); 24397 append = 1; 24398 } 24399 break; 24400 case FIELDS_ACTIONf: 24401 case MPLS_ACTIONf: 24402 { 24403 uint32 data = 0; 24404 if ((fld == MPLS_ACTIONf) 24405 && (soc_mem_field_valid(unit, policy_mem, FIELDS_ACTIONf))) { 24406 /* Recovery to be done as a part of FIELDS_ACTIONf, if present. 24407 If FIELDS_ACTIONf is not present, then recover from 24408 MPLS_ACTIONSf. 24409 */ 24410 continue; 24411 } 24412 switch (fldval) { 24413 case 1: 24414 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3) 24415 /* Virtual Port Actions will be recovered as Gport, 24416 * even if they were to be configured using respective 24417 * actions (like bcmFieldActionIncomingMplsPortSet). 24418 */ 24419 if ((!SOC_IS_TRIDENT2X(unit) && !SOC_IS_TITAN2PLUS(unit)) 24420 && !(soc_feature(unit, soc_feature_field_multi_pipe_support))) { 24421 /* FIELDS_ACTION = 1 for SVP is not valid on Trident2X devices */ 24422 action = bcmFieldActionIngressGportSet; 24423 24424 data = PolicyGet(unit, policy_mem, policy_entry, SVPf); 24425 /* Virtual port need to be converted back to Gport. */ 24426 if (action_sync == 1) { 24427 int gport_type; 24428 _field_control_t *fc; 24429 24430 action = -1; 24431 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 24432 _bcmFieldActionNoParamIngressGportSet)) { 24433 action = bcmFieldActionIngressGportSet; 24434 } 24435 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 24436 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_19) { 24437 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 24438 _bcmFieldActionNoParamIncomingMplsPortSet)) { 24439 action = bcmFieldActionIncomingMplsPortSet; 24440 } 24441 } 24442 24443 if (action == -1) { 24444 param0 = data; 24445 append = 1; 24446 break; 24447 } 24448 24449 append = 1; 24450 gport_type = f_ent_wb_info->ing_gport_type; 24451 if (gport_type == _bcmVpTypeMpls) { 24452 BCM_GPORT_MPLS_PORT_ID_SET(param0, data); 24453 } else if (gport_type == _bcmVpTypeL2Gre) { 24454 BCM_GPORT_L2GRE_PORT_ID_SET(param0, data); 24455 } else if (gport_type == _bcmVpTypeMim) { 24456 BCM_GPORT_MIM_PORT_ID_SET(param0, data); 24457 } else if (gport_type == _bcmVpTypeWlan) { 24458 BCM_GPORT_WLAN_PORT_ID_SET(param0, data); 24459 } else if (gport_type == _bcmVpTypeTrill) { 24460 BCM_GPORT_TRILL_PORT_ID_SET(param0, data); 24461 } else if (gport_type == _bcmVpTypeNiv) { 24462 BCM_GPORT_NIV_PORT_ID_SET(param0, data); 24463 } else if (gport_type == _bcmVpTypeVxlan) { 24464 BCM_GPORT_VXLAN_PORT_ID_SET(param0, data); 24465 } else if (gport_type == _bcmVpTypeVlan) { 24466 BCM_GPORT_VLAN_PORT_ID_SET(param0, data); 24467 } else { 24468 append = 0; 24469 } 24470 } else { 24471 param0 = data; 24472 append = 1; 24473 } 24474 } 24475 #endif /* INCLUDE_L3 */ 24476 break; 24477 case 2: 24478 action = bcmFieldActionL3IngressSet; 24479 data = PolicyGet(unit, policy_mem, policy_entry, L3_IIFf); 24480 /* L3_IIF needs to be converted back to Ingress L3 interface. */ 24481 param0 = data; 24482 append = 1; 24483 break; 24484 case 3: 24485 action = bcmFieldActionVrfSet; 24486 param0 = PolicyGet(unit, policy_mem, policy_entry, VFP_VRF_IDf); 24487 append = 1; 24488 break; 24489 case 5: 24490 action = bcmFieldActionVpnSet; 24491 param0 = PolicyGet(unit, policy_mem, policy_entry, VFIf); 24492 append = 1; 24493 break; 24494 default: 24495 break; /* Do nothing */ 24496 } 24497 } 24498 break; 24499 case DISABLE_VLAN_CHECKSf: 24500 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24501 _bcmFieldActionNoParamEnableVlanCheck)) { 24502 action = bcmFieldActionEnableVlanCheck; 24503 append = 1; 24504 } else if (((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 24505 || (soc_feature(unit, soc_feature_field_multi_pipe_support))) 24506 && (!(soc_feature(unit, soc_feature_th3_style_fp)))) { 24507 if ((PolicyGet(unit, policy_mem, policy_entry, SVPf) == 0) 24508 || (PolicyGet(unit, policy_mem, 24509 policy_entry, SVP_VALIDf) == 0)) { 24510 if (fldval) { 24511 action = bcmFieldActionDoNotCheckVlan; 24512 append = 1; 24513 } 24514 } 24515 } else { 24516 tmp_fld = (soc_mem_field_valid(unit, policy_mem, FIELDS_ACTIONf) 24517 ? FIELDS_ACTIONf : MPLS_ACTIONf); 24518 if (!soc_mem_field_valid(unit, policy_mem, tmp_fld) 24519 || PolicyGet(unit, policy_mem, policy_entry, tmp_fld) != 1 24520 ) { 24521 if (fldval) { 24522 action = bcmFieldActionDoNotCheckVlan; 24523 append = 1; 24524 } 24525 } 24526 } 24527 break; 24528 #if defined(BCM_TRIUMPH3_SUPPORT) 24529 case ESM_SEARCH_PRIORITYf : 24530 if (soc_feature(unit, soc_feature_esm_support) && fldval) { 24531 action = bcmFieldActionEsmSearchKeySrcMac; 24532 append = 1; 24533 } 24534 break; 24535 24536 #endif 24537 case SVPf: 24538 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3) 24539 /* Only in trident2 device SVPf needs to be read directly to get source 24540 * virtual ports. In Other devices FIELDS_ACTIONf and MPLS_ACTIONSf 24541 * call SVPf indirectly to obtain source virtual ports. 24542 */ 24543 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 24544 || (soc_feature(unit, soc_feature_field_multi_pipe_support))) { 24545 if ((PolicyGet(unit, policy_mem, 24546 policy_entry, SVP_VALIDf) == 1) && (fldval != 0)) { 24547 action = bcmFieldActionIngressGportSet; 24548 /* Virtual port need to be converted back to Gport. */ 24549 if (action_sync == 1) { 24550 int gport_type; 24551 _field_control_t *fc; 24552 24553 action = -1; 24554 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 24555 _bcmFieldActionNoParamIngressGportSet)) { 24556 action = bcmFieldActionIngressGportSet; 24557 } 24558 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 24559 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_19) { 24560 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 24561 _bcmFieldActionNoParamIncomingMplsPortSet)) { 24562 action = bcmFieldActionIncomingMplsPortSet; 24563 } 24564 } 24565 24566 if (action == -1) { 24567 param0 = fldval; 24568 append = 1; 24569 break; 24570 } 24571 24572 append = 1; 24573 gport_type = f_ent_wb_info->ing_gport_type; 24574 if (gport_type == _bcmVpTypeMpls) { 24575 BCM_GPORT_MPLS_PORT_ID_SET(param0, fldval); 24576 } else if (gport_type == _bcmVpTypeL2Gre) { 24577 BCM_GPORT_L2GRE_PORT_ID_SET(param0, fldval); 24578 } else if (gport_type == _bcmVpTypeMim) { 24579 BCM_GPORT_MIM_PORT_ID_SET(param0, fldval); 24580 } else if (gport_type == _bcmVpTypeWlan) { 24581 BCM_GPORT_WLAN_PORT_ID_SET(param0, fldval); 24582 } else if (gport_type == _bcmVpTypeTrill) { 24583 BCM_GPORT_TRILL_PORT_ID_SET(param0, fldval); 24584 } else if (gport_type == _bcmVpTypeNiv) { 24585 BCM_GPORT_NIV_PORT_ID_SET(param0, fldval); 24586 } else if (gport_type == _bcmVpTypeVxlan) { 24587 BCM_GPORT_VXLAN_PORT_ID_SET(param0, fldval); 24588 } else if (gport_type == _bcmVpTypeFlow) { 24589 BCM_GPORT_FLOW_PORT_ID_SET(param0, fldval); 24590 } else { 24591 append = 0; 24592 } 24593 } else { 24594 param0 = fldval; 24595 append = 1; 24596 } 24597 } 24598 } 24599 #endif /* INCLUDE_L3 */ 24600 break; 24601 case VFIf: 24602 if (fldval != 0) { 24603 #ifdef BCM_GREYHOUND2_SUPPORT 24604 if (SOC_IS_GREYHOUND2(unit)) { 24605 if (soc_mem_field_valid(unit, policy_mem, 24606 FIELDS_ACTIONf)) { 24607 if (PolicyGet(unit, policy_mem, policy_entry, 24608 FIELDS_ACTIONf) != 5) { 24609 break; 24610 } 24611 } 24612 } 24613 #endif /* BCM_GREYHOUND2_SUPPORT */ 24614 if (soc_feature(unit, soc_feature_vfi_from_vlan_tables) || 24615 soc_feature(unit, soc_feature_vxlan_lite)) { 24616 param0 = PolicyGet(unit, policy_mem, 24617 policy_entry, VFIf); 24618 action = bcmFieldActionVpnSet; 24619 append = 1; 24620 } 24621 } 24622 break; 24623 case R_CHANGE_ECNf: 24624 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24625 _bcmFieldActionNoParamEcnNewNoColor)) { 24626 break; 24627 } 24628 if (fldval != 0) { 24629 action = bcmFieldActionRpEcnNew; 24630 param0 = fldval; 24631 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 24632 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 24633 param0 = PolicyGet(unit, policy_mem, 24634 policy_entry, R_NEW_ECNf); 24635 } 24636 #endif 24637 #if defined(BCM_GREYHOUND_SUPPORT) 24638 if ((SOC_IS_GREYHOUND(unit) || SOC_IS_HURRICANE3(unit) || 24639 SOC_IS_GREYHOUND2(unit)) && 24640 (policy_mem == EFP_POLICY_TABLEm)) { 24641 param0 = PolicyGet(unit, policy_mem, 24642 policy_entry, R_NEW_ECNf); 24643 } 24644 #endif 24645 append = 1; 24646 } 24647 24648 break; 24649 24650 case Y_CHANGE_ECNf: 24651 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24652 _bcmFieldActionNoParamEcnNewNoColor)) { 24653 break; 24654 } 24655 if (fldval != 0) { 24656 action = bcmFieldActionYpEcnNew; 24657 param0 = fldval; 24658 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 24659 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 24660 param0 = PolicyGet(unit, policy_mem, 24661 policy_entry, Y_NEW_ECNf); 24662 } 24663 #endif 24664 #if defined(BCM_GREYHOUND_SUPPORT) 24665 if ((SOC_IS_GREYHOUND(unit) || SOC_IS_HURRICANE3(unit) || 24666 SOC_IS_GREYHOUND2(unit)) && 24667 (policy_mem == EFP_POLICY_TABLEm)) { 24668 param0 = PolicyGet(unit, policy_mem, 24669 policy_entry, Y_NEW_ECNf); 24670 } 24671 #endif 24672 append = 1; 24673 } 24674 24675 break; 24676 24677 case G_CHANGE_ECNf: 24678 if (fldval != 0) { 24679 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 24680 _bcmFieldActionNoParamEcnNewNoColor)) { 24681 action = bcmFieldActionEcnNew; 24682 } else { 24683 action = bcmFieldActionGpEcnNew; 24684 } 24685 param0 = fldval; 24686 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 24687 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 24688 param0 = PolicyGet(unit, policy_mem, 24689 policy_entry, G_NEW_ECNf); 24690 } 24691 #endif 24692 #if defined(BCM_GREYHOUND_SUPPORT) 24693 if ((SOC_IS_GREYHOUND(unit) || SOC_IS_HURRICANE3(unit) || 24694 SOC_IS_GREYHOUND2(unit)) && 24695 (policy_mem == EFP_POLICY_TABLEm)) { 24696 param0 = PolicyGet(unit, policy_mem, 24697 policy_entry, G_NEW_ECNf); 24698 } 24699 #endif 24700 append = 1; 24701 } 24702 24703 break; 24704 24705 case DO_NOT_CHANGE_TTLf: 24706 if (fldval) { 24707 action = bcmFieldActionDoNotChangeTtl; 24708 24709 append = 1; 24710 } 24711 24712 break; 24713 24714 case DO_NOT_URPFf: 24715 if (fldval) { 24716 action = bcmFieldActionDoNotCheckUrpf; 24717 24718 append = 1; 24719 } 24720 24721 break; 24722 24723 /***** Mirroring recovery, for Triumph / Valkyrie / Enduro *****/ 24724 24725 case INGRESS_MIRRORf: 24726 /*This field is not required on KATANA and ENDURO devices, 24727 *but only retained for C-code compilation*/ 24728 if (!SOC_IS_KATANA(unit) && !SOC_IS_ENDURO(unit)) { 24729 if (fldval & (1U << 0)) { 24730 bcm_module_t modid; 24731 bcm_gport_t port; 24732 24733 hw_index = PolicyGet(unit, 24734 policy_mem, 24735 policy_entry, 24736 soc_mem_field_valid(unit, policy_mem, MTP_INDEX0f) 24737 ? MTP_INDEX0f 24738 : IM0_MTP_INDEXf 24739 ); 24740 24741 /* Translate hw index into (module_num, port_num) */ 24742 24743 _bcm_esw_mirror_mtp_to_modport(unit, 24744 hw_index, 24745 FALSE, 24746 BCM_MIRROR_PORT_INGRESS, 24747 &modid, 24748 &port 24749 ); 24750 24751 rv = _field_trx_actions_recover_action_add( 24752 unit, 24753 f_ent, 24754 bcmFieldActionMirrorIngress, 24755 modid, 24756 port, 24757 0, 24758 0, 24759 0, 24760 0, 24761 hw_index 24762 ); 24763 24764 if (BCM_FAILURE(rv)) { 24765 return rv; 24766 } 24767 } 24768 24769 if (fldval & (1U << 1)) { 24770 bcm_module_t modid; 24771 bcm_gport_t port; 24772 24773 hw_index = PolicyGet(unit, 24774 policy_mem, 24775 policy_entry, 24776 soc_mem_field_valid(unit, policy_mem, MTP_INDEX1f) 24777 ? MTP_INDEX1f 24778 : IM1_MTP_INDEXf 24779 ); 24780 24781 /* Translate hw index into (module_num, port_num) */ 24782 24783 _bcm_esw_mirror_mtp_to_modport(unit, 24784 hw_index, 24785 FALSE, 24786 BCM_MIRROR_PORT_INGRESS, 24787 &modid, 24788 &port 24789 ); 24790 24791 rv = _field_trx_actions_recover_action_add( 24792 unit, 24793 f_ent, 24794 bcmFieldActionMirrorIngress, 24795 modid, 24796 port, 24797 0, 24798 0, 24799 0, 24800 0, 24801 hw_index 24802 ); 24803 if (BCM_FAILURE(rv)) { 24804 return rv; 24805 } 24806 } 24807 24808 } 24809 24810 break; 24811 24812 case EGRESS_MIRRORf: 24813 /*This field is not required on KATANA and ENDURO devices, 24814 *but only retained for C-code compilation*/ 24815 if (!SOC_IS_KATANA(unit) && !SOC_IS_ENDURO(unit)) { 24816 if (fldval & (1U << 0)) { 24817 bcm_module_t modid; 24818 bcm_gport_t port; 24819 24820 hw_index = PolicyGet(unit, 24821 policy_mem, 24822 policy_entry, 24823 soc_mem_field_valid(unit, policy_mem, MTP_INDEX2f) 24824 ? MTP_INDEX2f 24825 : EM0_MTP_INDEXf 24826 ); 24827 24828 /* Translate hw index into (module_num, port_num) */ 24829 24830 _bcm_esw_mirror_mtp_to_modport(unit, 24831 hw_index, 24832 FALSE, 24833 BCM_MIRROR_PORT_EGRESS, 24834 &modid, 24835 &port 24836 ); 24837 24838 rv = _field_trx_actions_recover_action_add( 24839 unit, 24840 f_ent, 24841 bcmFieldActionMirrorEgress, 24842 modid, 24843 port, 24844 0, 24845 0, 24846 0, 24847 0, 24848 hw_index 24849 ); 24850 if (BCM_FAILURE(rv)) { 24851 return rv; 24852 } 24853 } 24854 24855 if (fldval & (1U << 1)) { 24856 bcm_module_t modid; 24857 bcm_gport_t port; 24858 24859 hw_index = PolicyGet(unit, 24860 policy_mem, 24861 policy_entry, 24862 soc_mem_field_valid(unit, policy_mem, MTP_INDEX3f) 24863 ? MTP_INDEX3f 24864 : EM1_MTP_INDEXf 24865 ); 24866 24867 /* Translate hw index into (module_num, port_num) */ 24868 24869 _bcm_esw_mirror_mtp_to_modport(unit, 24870 hw_index, 24871 FALSE, 24872 BCM_MIRROR_PORT_EGRESS, 24873 &modid, 24874 &port 24875 ); 24876 24877 rv = _field_trx_actions_recover_action_add( 24878 unit, 24879 f_ent, 24880 bcmFieldActionMirrorEgress, 24881 modid, 24882 port, 24883 0, 24884 0, 24885 0, 24886 0, 24887 hw_index 24888 ); 24889 if (BCM_FAILURE(rv)) { 24890 return rv; 24891 } 24892 } 24893 } 24894 24895 break; 24896 24897 /***** Mirroring recovery, for Triumph2/Apollo *****/ 24898 24899 case MIRRORf: 24900 { 24901 static const unsigned mtp_index_field[] = { 24902 MTP_INDEX0f, MTP_INDEX1f, MTP_INDEX2f, MTP_INDEX3f 24903 }; 24904 24905 uint32 ms_reg, mtp_type; 24906 unsigned b, i; 24907 bcm_module_t modid; 24908 bcm_gport_t port; 24909 bcm_field_action_t action; 24910 _bcmFieldActionNoParam_t _action; 24911 _bcmFieldActionNoParam_t ingress_mirror_actions[] = { 24912 _bcmFieldActionNoParamMirrorIngress, 24913 _bcmFieldActionNoParamMirrorIngress1, 24914 _bcmFieldActionNoParamMirrorIngress2, 24915 _bcmFieldActionNoParamMirrorIngress3}; 24916 _bcmFieldActionNoParam_t egress_mirror_actions[] = { 24917 _bcmFieldActionNoParamMirrorEgress, 24918 _bcmFieldActionNoParamMirrorEgress1, 24919 _bcmFieldActionNoParamMirrorEgress2, 24920 _bcmFieldActionNoParamMirrorEgress3}; 24921 24922 if (SOC_IS_ENDURO(unit) || SOC_IS_HURRICANEX(unit) || 24923 SOC_IS_GREYHOUND(unit) || SOC_IS_GREYHOUND2(unit)) { 24924 /* Enduro/Katana has this field, but as an overlay -- 24925 mirroring for Enduro/Katana is handled above. 24926 */ 24927 24928 break; 24929 } 24930 24931 /* Get the mirroring direction control setting */ 24932 BCM_IF_ERROR_RETURN(READ_MIRROR_SELECTr(unit, &ms_reg)); 24933 mtp_type = soc_reg_field_get(unit, MIRROR_SELECTr, ms_reg, MTP_TYPEf); 24934 24935 /* For each mirroring slot in the policy entry, ... */ 24936 for (b = 1, i = 0; i < COUNTOF(mtp_index_field); ++i, b <<= 1) { 24937 if (!(fldval & b)) { 24938 /* Slot not in use => Skip */ 24939 24940 continue; 24941 } 24942 24943 /* Slot in use => Recover mirror action */ 24944 hw_index = PolicyGet(unit, 24945 policy_mem, 24946 policy_entry, 24947 mtp_index_field[i] 24948 ); 24949 24950 action = (mtp_type & b) ? bcmFieldActionMirrorEgress : bcmFieldActionMirrorIngress; 24951 if (mtp_type & b) { 24952 if (fc->l2warm && fc->wb_recovered_version >= BCM_FIELD_WB_VERSION_1_21) { 24953 _action = egress_mirror_actions[i]; 24954 } else { 24955 _action = _bcmFieldActionNoParamMirrorEgress; 24956 } 24957 } else { 24958 if (fc->l2warm && fc->wb_recovered_version >= BCM_FIELD_WB_VERSION_1_21) { 24959 _action = ingress_mirror_actions[i]; 24960 } else { 24961 _action = _bcmFieldActionNoParamMirrorIngress; 24962 } 24963 } 24964 24965 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, _action)) { 24966 /* 24967 * It indicates the parameter present in the action is 24968 * Mirror destination ID instead of ModPort. 24969 */ 24970 param0 = 0; 24971 if (action == bcmFieldActionMirrorIngress) { 24972 if (_action == _bcmFieldActionNoParamMirrorIngress) { 24973 param1 = f_ent_wb_info->ingress_mirror[0]; 24974 } else { 24975 param1 = f_ent_wb_info->ingress_mirror[i]; 24976 } 24977 } else { 24978 if (_action == _bcmFieldActionNoParamMirrorEgress) { 24979 param1 = f_ent_wb_info->egress_mirror[0]; 24980 } else { 24981 param1 = f_ent_wb_info->egress_mirror[i]; 24982 } 24983 } 24984 } else { 24985 /* Translate hw index into (module_num, port_num) */ 24986 _bcm_esw_mirror_mtp_to_modport(unit, 24987 hw_index, 24988 FALSE, 24989 mtp_type & b 24990 ? BCM_MIRROR_PORT_EGRESS 24991 : BCM_MIRROR_PORT_INGRESS, 24992 &modid, 24993 &port 24994 ); 24995 param0 = modid; 24996 param1 = port; 24997 } 24998 24999 rv = _field_trx_actions_recover_action_add(unit, f_ent, 25000 action, param0, param1, 0, 0, 0, 0, hw_index); 25001 if (BCM_FAILURE(rv)) { 25002 return rv; 25003 } 25004 } 25005 } 25006 break; 25007 25008 case G_PACKET_REDIRECTIONf: 25009 { 25010 soc_field_t redir_fld = REDIRECTIONf; 25011 uint32 redir = 0, nhi_sh = 0; 25012 #if (defined BCM_TRIDENT_SUPPORT) 25013 uint32 redir_offset = 0; 25014 #endif 25015 unsigned sh = (SOC_IS_TR_VL(unit) && (!SOC_IS_HURRICANE3(unit))) 25016 ? ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || 25017 SOC_IS_GREYHOUND2(unit)) ? 9 : 7) 25018 : 8, 25019 m = (1 << sh) - 1; 25020 25021 if ((action_sync == 1) && 25022 SHR_BITGET(f_ent_wb_info->action_bmp->w, 25023 _bcmFieldActionNoParamFabricQueue)) { 25024 break; 25025 } 25026 25027 if (SOC_IS_HURRICANE3(unit)) { 25028 nhi_sh = 15; 25029 } else if (SOC_IS_GREYHOUND2(unit)) { 25030 nhi_sh = 16; 25031 } else { 25032 nhi_sh = 14; 25033 } 25034 25035 if ((SOC_IS_TRIUMPH3(unit) || SOC_IS_KATANA2(unit)) && 25036 (policy_mem == EFP_POLICY_TABLEm) && 25037 (soc_mem_field_valid(unit, policy_mem, REDIRECTION_DESTINATIONf))) { 25038 redir_fld = REDIRECTION_DESTINATIONf; 25039 } 25040 redir = PolicyGet(unit, 25041 policy_mem, 25042 policy_entry, 25043 redir_fld 25044 ); 25045 25046 #if (defined BCM_TRIDENT_SUPPORT) 25047 if (SOC_IS_TD2_TT2(unit) || SOC_IS_TRIUMPH3(unit)) { 25048 redir_offset = 3; 25049 } 25050 #endif 25051 25052 switch (fldval) { 25053 case 1: 25054 if (SOC_IS_KATANAX(unit)) { 25055 /* 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 */ 25056 /* RED[17:16] == 0 REDIRECT TO DGLP */ 25057 /* DST_T : RED[15]: Trunk Group Bit */ 25058 /* DST_MODID : RED[14:7] */ 25059 /* DST_PORTID : RED[ 6:0] */ 25060 /* RED[17:16] == 1 REDIRECT TO NHI */ 25061 /* NHI : RED[13:0] */ 25062 /* RED[17:16] == 2 REDIRECT TO ECMP GROUP */ 25063 /* ECMP Group Point : RED[ 9:0] */ 25064 /* RED[17:16] == 3 INVALID */ 25065 /* Should get constants from regfile! */ 25066 switch((redir >> 16) & 0x3) { 25067 case 0: /* REDIRECT TO DGLP */ 25068 if ((redir & 0x8000) == 0x8000) { 25069 action = bcmFieldActionRedirectTrunk; 25070 param0 = redir & 0x7ff; 25071 } else { 25072 action = bcmFieldActionRedirect; 25073 param0 = (redir >> 7) & 0xff; 25074 param1 = (redir & 0x7f); 25075 } 25076 break; 25077 case 1: /* REDIRECT TO NHI */ 25078 #ifdef INCLUDE_L3 25079 action = bcmFieldActionRedirectEgrNextHop; 25080 param0 = (redir & 0x3fff) + 25081 (BCM_XGS3_EGRESS_IDX_MIN(unit)); 25082 #endif 25083 break; 25084 case 2: /* REDIRECT TO ECMP GROUP */ 25085 #ifdef INCLUDE_L3 25086 action = bcmFieldActionRedirectEgrNextHop; 25087 param0 = (redir & 0x3ff) + 25088 (BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit)); 25089 #endif 25090 break; 25091 case 3: 25092 default: /* Wrong */ 25093 return BCM_E_CONFIG; 25094 } 25095 } else 25096 #ifdef BCM_TRIDENT_SUPPORT 25097 if (SOC_IS_TD_TT(unit) || SOC_IS_TRIUMPH3(unit)) { 25098 25099 redir_offset = (SOC_IS_TD2_TT2(unit) || 25100 SOC_IS_TRIUMPH3(unit)) ? 2 : 0; 25101 25102 switch ((redir >> (16 + redir_offset)) & 0x7) { 25103 case 0x1: 25104 action = 25105 bcmFieldActionUnmodifiedPacketRedirectPort; 25106 if (redir & (0x1 << 15)) { 25107 BCM_GPORT_TRUNK_SET(param0, 25108 (redir & 0x3ff)); 25109 } else { 25110 BCM_GPORT_MODPORT_SET(param0, 25111 ((redir >> 7) & 0xff), (redir & 0x7f)); 25112 } 25113 break; 25114 #ifdef INCLUDE_L3 25115 case 0x2: /* Regular Next Hop */ 25116 action = bcmFieldActionRedirectEgrNextHop; 25117 param0 = (redir & ((1 << 16) - 1)) 25118 + (BCM_XGS3_EGRESS_IDX_MIN(unit)); 25119 break; 25120 case 0x3: /* ECMP Next Hop Group */ 25121 action = bcmFieldActionRedirectEgrNextHop; 25122 param0 = (redir & ((1 << 16) - 1)) 25123 + (BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit)); 25124 break; 25125 case 0x6: 25126 #if defined(BCM_TRIDENT2_SUPPORT) 25127 is_trunk = 0; 25128 /* Recovering Redirect to VPLAG. */ 25129 if (soc_feature(unit, soc_feature_vp_lag)) { 25130 if ((action_sync == 1) && 25131 ((fc->wb_recovered_version) >= 25132 BCM_FIELD_WB_VERSION_1_24) ) { 25133 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 25134 _bcmFieldActionNoParamRedirectTrunk)) { 25135 is_trunk = 1; 25136 } 25137 } else { 25138 /* to support releases older than ver 24 */ 25139 is_trunk = 1; 25140 } 25141 } 25142 if (is_trunk) { 25143 int tid_is_vp_lag = 0; 25144 int vp_id_min = -1; 25145 25146 param0 = redir & ((1 << 13) - 1); 25147 25148 rv = _bcm_esw_trunk_chip_info_vp_resource_get( 25149 unit, &vp_id_min, NULL, NULL); 25150 25151 BCM_IF_ERROR_RETURN(rv); 25152 25153 param0 += vp_id_min; 25154 25155 rv = _bcm_esw_trunk_id_is_vp_lag(unit, param0, 25156 &tid_is_vp_lag); 25157 BCM_IF_ERROR_RETURN(rv); 25158 25159 if (tid_is_vp_lag) { 25160 action = bcmFieldActionRedirectTrunk; 25161 param1 = 0; 25162 } else { 25163 action = bcmFieldActionRedirect; 25164 /* Virtual port need to be converted 25165 * back to Gport. */ 25166 param1 = redir & ((1 << 13) - 1); 25167 param0 = 0; 25168 } 25169 } else 25170 #endif 25171 { 25172 action = bcmFieldActionRedirect; 25173 /* Virtual port need to be converted 25174 * back to Gport. */ 25175 param1 = redir & ((1 << 13) - 1); 25176 #ifdef BCM_TRIUMPH3_SUPPORT 25177 if (SOC_IS_TRIUMPH3(unit) || SOC_IS_TD2_TT2(unit)) { 25178 if (action_sync == 1) { 25179 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 25180 _bcmFieldActionNoParamRedirectMpls)) { 25181 BCM_GPORT_MPLS_PORT_ID_SET(param1, param1); 25182 } else if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 25183 _bcmFieldActionNoParamRedirectMim)) { 25184 BCM_GPORT_MIM_PORT_ID_SET(param1, param1); 25185 } else if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 25186 _bcmFieldActionNoParamRedirectNiv)) { 25187 BCM_GPORT_NIV_PORT_ID_SET(param1, param1); 25188 } else if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 25189 _bcmFieldActionNoParamRedirectTrill)) { 25190 BCM_GPORT_TRILL_PORT_ID_SET(param1, param1); 25191 } else if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 25192 _bcmFieldActionNoParamRedirectL2Gre)) { 25193 BCM_GPORT_L2GRE_PORT_ID_SET(param1, param1); 25194 } else if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 25195 _bcmFieldActionNoParamRedirectVxLan)) { 25196 BCM_GPORT_VXLAN_PORT_ID_SET(param1, param1); 25197 } 25198 } 25199 } 25200 #endif 25201 } 25202 #endif /* INCLUDE_L3 */ 25203 break; 25204 default: /* 0x0 */ 25205 if (redir & (0x1 << 15)) { 25206 action = bcmFieldActionRedirectTrunk; 25207 param0 = redir & 0x3ff; 25208 } else { 25209 action = bcmFieldActionRedirect; 25210 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 25211 HI_PRI_ACTION_CONTROLf)) { 25212 soc_field_t suppress_vxlt = INVALIDf; 25213 25214 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 25215 SUPPRESS_VXLTf)) { 25216 suppress_vxlt = SUPPRESS_VXLTf; 25217 } else { 25218 suppress_vxlt = HI_PRI_SUPPRESS_VXLTf; 25219 } 25220 25221 action = PolicyGet(unit, 25222 policy_mem, 25223 policy_entry, 25224 HI_PRI_ACTION_CONTROLf 25225 ) 25226 == 1 25227 && PolicyGet(unit, 25228 policy_mem, 25229 policy_entry, 25230 HI_PRI_RESOLVEf 25231 ) 25232 == 1 25233 && PolicyGet(unit, 25234 policy_mem, 25235 policy_entry, 25236 SUPPRESS_COLOR_SENSITIVE_ACTIONSf 25237 ) 25238 == 1 25239 && PolicyGet(unit, 25240 policy_mem, 25241 policy_entry, 25242 DEFER_QOS_MARKINGSf 25243 ) 25244 == 1 25245 && PolicyGet(unit, 25246 policy_mem, 25247 policy_entry, 25248 SUPPRESS_SW_ACTIONSf 25249 ) 25250 == 1 25251 && PolicyGet(unit, 25252 policy_mem, 25253 policy_entry, 25254 suppress_vxlt 25255 ) 25256 == 1 25257 ? bcmFieldActionOffloadRedirect : 25258 bcmFieldActionRedirect; 25259 25260 } 25261 param0 = (redir >> 7) & 0xff; 25262 param1 = (redir & 0x7f); 25263 } 25264 break; 25265 } 25266 } else 25267 #endif /* BCM_TRIDENT_SUPPORT */ 25268 if (((redir >> nhi_sh) == 0x1) 25269 && soc_feature(unit, soc_feature_field_action_redirect_nexthop)) { 25270 #if defined(BCM_HURRICANE3_SUPPORT) 25271 if (soc_feature(unit, soc_feature_miml) && (PolicyGet(unit, 25272 policy_mem, policy_entry, ASSIGN_HEADER_ENCAP_FIELDSf))) { 25273 /* MiML Switch Encap */ 25274 action = bcmFieldActionSwitchEncap; 25275 hw_index = PolicyGet(unit, policy_mem, policy_entry, 25276 HEADER_ENCAP_INDEXf); 25277 param0 = redir & ((1 << nhi_sh) - 1); 25278 param0 |= (hw_index << 25279 _BCM_SWITCH_ENCAP_MIML_EGR_HEADER_ENCAP_SHIFT); 25280 param0 |= (_BCM_SWITCH_ENCAP_TYPE_MIML << 25281 _BCM_SWITCH_ENCAP_SHIFT); 25282 } else 25283 #endif /* BCM_HURRICANE3_SUPPORT */ 25284 { 25285 #ifdef INCLUDE_L3 25286 /* Regular Next Hop */ 25287 action = bcmFieldActionRedirectEgrNextHop; 25288 param0 = (redir & ((1 << nhi_sh) - 1)) 25289 + (BCM_XGS3_EGRESS_IDX_MIN(unit)); 25290 #endif /* INCLUDE_L3 */ 25291 } 25292 } else if (redir & (0x40 << sh)) { 25293 action = bcmFieldActionRedirectTrunk; 25294 param0 = redir & m; 25295 } else { 25296 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 25297 HI_PRI_ACTION_CONTROLf)) { 25298 soc_field_t suppress_vxlt = INVALIDf; 25299 25300 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 25301 SUPPRESS_VXLTf)) { 25302 suppress_vxlt = SUPPRESS_VXLTf; 25303 } else { 25304 suppress_vxlt = HI_PRI_SUPPRESS_VXLTf; 25305 } 25306 25307 action = PolicyGet(unit, 25308 policy_mem, 25309 policy_entry, 25310 HI_PRI_ACTION_CONTROLf 25311 ) 25312 == 1 25313 && PolicyGet(unit, 25314 policy_mem, 25315 policy_entry, 25316 HI_PRI_RESOLVEf 25317 ) 25318 == 1 25319 && PolicyGet(unit, 25320 policy_mem, 25321 policy_entry, 25322 SUPPRESS_COLOR_SENSITIVE_ACTIONSf 25323 ) 25324 == 1 25325 && PolicyGet(unit, 25326 policy_mem, 25327 policy_entry, 25328 DEFER_QOS_MARKINGSf 25329 ) 25330 == 1 25331 && PolicyGet(unit, 25332 policy_mem, 25333 policy_entry, 25334 SUPPRESS_SW_ACTIONSf 25335 ) 25336 == 1 25337 && PolicyGet(unit, 25338 policy_mem, 25339 policy_entry, 25340 suppress_vxlt 25341 ) 25342 == 1 25343 ? bcmFieldActionOffloadRedirect : 25344 bcmFieldActionRedirect; 25345 param0 = redir >> 6; 25346 param1 = redir & 0x3f; 25347 if (action == bcmFieldActionOffloadRedirect) { 25348 param0 = param0 & 0x7f; 25349 } 25350 } else { 25351 action = bcmFieldActionRedirect; 25352 param0 = redir >> 6; 25353 param1 = redir & 0x3f; 25354 } 25355 } 25356 25357 append = 1; 25358 25359 break; 25360 25361 case 2: 25362 action = bcmFieldActionRedirectCancel; 25363 25364 break; 25365 25366 case 3: 25367 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */ 25368 if (SOC_IS_KATANAX(unit)) { 25369 /* 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 */ 25370 /* RED[13:12] == 1 Broadcast Replace PortBitMap */ 25371 /* PortBitMapIndex = RED[11:0] */ 25372 /* RED[13:12] == 2 L2MC Replace Port BitMap */ 25373 /* L2MC_Index=PortBitMapIndex = RED[11:0] */ 25374 /* RED[13:12] == 3 L3MC Replace Port BitMap */ 25375 /* L3MC_Index=PortBitMapIndex = RED[11:0] */ 25376 /* Should get constants from regfile! */ 25377 switch((redir >> 12) & 0x3) { 25378 case 1 : /* Broadcast */ 25379 if ((redir >> 11) & 0x01) { 25380 /* RedirectBcastPbmp */ 25381 hw_index = (redir & 0x3ff); 25382 action = bcmFieldActionRedirectBcastPbmp; 25383 rv = soc_mem_read(unit, profile_mem, 25384 MEM_BLOCK_ANY, hw_index, 25385 entry_ptr[0]); 25386 BCM_IF_ERROR_RETURN(rv); 25387 soc_mem_pbmp_field_get(unit, profile_mem, 25388 entry_ptr[0], BITMAPf, &pbmp); 25389 param0 = SOC_PBMP_WORD_GET(pbmp, 0); 25390 param1 = SOC_PBMP_WORD_GET(pbmp, 1); 25391 param2 = SOC_PBMP_WORD_GET(pbmp, 2); 25392 if (SOC_IS_KATANA2(unit)) { 25393 param3 = SOC_PBMP_WORD_GET(pbmp, 3); 25394 param4 = SOC_PBMP_WORD_GET(pbmp, 4); 25395 param5 = SOC_PBMP_WORD_GET(pbmp, 5); 25396 } 25397 SOC_PROFILE_MEM_REFERENCE(unit, 25398 redirect_profile, hw_index, 1); 25399 SOC_PROFILE_MEM_ENTRIES_PER_SET(unit, 25400 redirect_profile, hw_index, 1); 25401 } else { 25402 /* RedirectVlan */ 25403 action = bcmFieldActionRedirectVlan; 25404 } 25405 break; 25406 case 2 : /* L2MC */ 25407 /* RedirectMcast */ 25408 action = bcmFieldActionRedirectMcast; 25409 if (soc_feature(unit, 25410 soc_feature_field_action_redirect_ipmc)) { 25411 param0 = (redir & 0xfff); 25412 } else { 25413 hw_index = (redir & 0xfff); 25414 } 25415 break; 25416 case 3 : /* L3MC */ 25417 /* RedirectIpmc */ 25418 action = bcmFieldActionRedirectIpmc; 25419 if (soc_feature(unit, 25420 soc_feature_field_action_redirect_ipmc)) { 25421 param0 = (redir & 0xfff); 25422 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25423 _bcmFieldActionNoParamRedirectIpmcWlan)) { 25424 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_WLAN, 25425 param0); 25426 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25427 _bcmFieldActionNoParamRedirectIpmcVpls)) { 25428 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_VPLS, 25429 param0); 25430 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25431 _bcmFieldActionNoParamRedirectIpmcL3)){ 25432 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_L3, 25433 param0); 25434 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25435 _bcmFieldActionNoParamRedirectIpmcVlan)){ 25436 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_VLAN, 25437 param0); 25438 } 25439 } else { 25440 hw_index = (redir & 0xfff); 25441 } 25442 break; 25443 default : 25444 /* RedirectPbmp */ 25445 hw_index = redir; 25446 action = bcmFieldActionRedirectPbmp; 25447 rv = soc_mem_read(unit, profile_mem, MEM_BLOCK_ANY, 25448 hw_index, entry_ptr[0]); 25449 BCM_IF_ERROR_RETURN(rv); 25450 soc_mem_pbmp_field_get(unit, profile_mem, entry_ptr[0], 25451 BITMAPf, &pbmp); 25452 param0 = SOC_PBMP_WORD_GET(pbmp, 0); 25453 param1 = SOC_PBMP_WORD_GET(pbmp, 1); 25454 param2 = SOC_PBMP_WORD_GET(pbmp, 2); 25455 if (SOC_IS_KATANA2(unit)) { 25456 param3 = SOC_PBMP_WORD_GET(pbmp, 3); 25457 param4 = SOC_PBMP_WORD_GET(pbmp, 4); 25458 param5 = SOC_PBMP_WORD_GET(pbmp, 5); 25459 } 25460 SOC_PROFILE_MEM_REFERENCE(unit, redirect_profile, 25461 hw_index, 1); 25462 SOC_PROFILE_MEM_ENTRIES_PER_SET(unit, redirect_profile, 25463 hw_index, 1); 25464 } 25465 } else if (SOC_IS_TD_TT(unit) || SOC_IS_TRIUMPH3(unit)) { 25466 switch ((redir >> (13 + redir_offset)) & 0x03) { 25467 case 0x01: 25468 if ((redir >> 11) & 0x01) { 25469 /* RedirectBcastPbmp */ 25470 hw_index = (redir & 0x3ff); 25471 action = bcmFieldActionRedirectBcastPbmp; 25472 rv = soc_mem_read(unit, profile_mem, MEM_BLOCK_ANY, 25473 hw_index, entry_ptr[0]); 25474 BCM_IF_ERROR_RETURN(rv); 25475 soc_mem_pbmp_field_get(unit, profile_mem, entry_ptr[0], 25476 BITMAPf, &pbmp); 25477 param0 = SOC_PBMP_WORD_GET(pbmp, 0); 25478 param1 = SOC_PBMP_WORD_GET(pbmp, 1); 25479 param2 = SOC_PBMP_WORD_GET(pbmp, 2); 25480 if (SOC_IS_KATANA2(unit)) { 25481 param3 = SOC_PBMP_WORD_GET(pbmp, 3); 25482 param4 = SOC_PBMP_WORD_GET(pbmp, 4); 25483 param5 = SOC_PBMP_WORD_GET(pbmp, 5); 25484 } 25485 25486 if (SOC_IS_TD2_TT2(unit)) { 25487 param3 = SOC_PBMP_WORD_GET(pbmp, 3); 25488 } 25489 SOC_PROFILE_MEM_REFERENCE(unit, redirect_profile, 25490 hw_index, 1); 25491 SOC_PROFILE_MEM_ENTRIES_PER_SET(unit, redirect_profile, 25492 hw_index, 1); 25493 break; 25494 } else { 25495 /* RedirectVlan */ 25496 action = bcmFieldActionRedirectVlan; 25497 break; 25498 } 25499 break; 25500 case 0x02: 25501 /* RedirectMcast */ 25502 action = bcmFieldActionRedirectMcast; 25503 if (soc_feature(unit, 25504 soc_feature_field_action_redirect_ipmc)) { 25505 param0 = (redir & 0x1fff); 25506 } else { 25507 hw_index = (redir & 0x1fff); 25508 } 25509 break; 25510 case 0x03: 25511 /* RedirectIpmc */ 25512 action = bcmFieldActionRedirectIpmc; 25513 if (soc_feature(unit, 25514 soc_feature_field_action_redirect_ipmc)) { 25515 param0 = (redir & 0xfff); 25516 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25517 _bcmFieldActionNoParamRedirectIpmcWlan)) { 25518 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_WLAN, 25519 param0); 25520 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25521 _bcmFieldActionNoParamRedirectIpmcVpls)) { 25522 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_VPLS, 25523 param0); 25524 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25525 _bcmFieldActionNoParamRedirectIpmcL3)){ 25526 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_L3, 25527 param0); 25528 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25529 _bcmFieldActionNoParamRedirectIpmcVlan)){ 25530 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_VLAN, 25531 param0); 25532 } 25533 } else { 25534 hw_index = (redir & 0xfff); 25535 } 25536 break; 25537 default: 25538 /* RedirectPbmp */ 25539 hw_index = redir; 25540 action = bcmFieldActionRedirectPbmp; 25541 rv = soc_mem_read(unit, profile_mem, MEM_BLOCK_ANY, 25542 hw_index, entry_ptr[0]); 25543 BCM_IF_ERROR_RETURN(rv); 25544 soc_mem_pbmp_field_get(unit, profile_mem, entry_ptr[0], 25545 BITMAPf, &pbmp); 25546 param0 = SOC_PBMP_WORD_GET(pbmp, 0); 25547 param1 = SOC_PBMP_WORD_GET(pbmp, 1); 25548 param2 = SOC_PBMP_WORD_GET(pbmp, 2); 25549 if (SOC_IS_KATANA2(unit)) { 25550 param3 = SOC_PBMP_WORD_GET(pbmp, 3); 25551 param4 = SOC_PBMP_WORD_GET(pbmp, 4); 25552 param5 = SOC_PBMP_WORD_GET(pbmp, 5); 25553 } 25554 25555 if (SOC_IS_TD2_TT2(unit)) { 25556 param3 = SOC_PBMP_WORD_GET(pbmp, 3); 25557 } 25558 SOC_PROFILE_MEM_REFERENCE(unit, redirect_profile, 25559 hw_index, 1); 25560 SOC_PROFILE_MEM_ENTRIES_PER_SET(unit, redirect_profile, 25561 hw_index, 1); 25562 } 25563 } else 25564 #endif /* !BCM_TRIDENT_SUPPORT */ 25565 { 25566 switch ((redir >> 11) & 0x07) { 25567 case 0x02: 25568 action = bcmFieldActionRedirectVlan; 25569 break; 25570 case 0x03: 25571 hw_index = (redir & 0x3ff); 25572 action = bcmFieldActionRedirectBcastPbmp; 25573 rv = soc_mem_read(unit, profile_mem, MEM_BLOCK_ANY, 25574 hw_index, entry_ptr[0]); 25575 BCM_IF_ERROR_RETURN(rv); 25576 soc_mem_pbmp_field_get(unit, profile_mem, entry_ptr[0], 25577 BITMAPf, &pbmp); 25578 param0 = SOC_PBMP_WORD_GET(pbmp, 0); 25579 param1 = SOC_PBMP_WORD_GET(pbmp, 1); 25580 SOC_PROFILE_MEM_REFERENCE(unit, redirect_profile, 25581 hw_index, 1); 25582 SOC_PROFILE_MEM_ENTRIES_PER_SET(unit, redirect_profile, 25583 hw_index, 1); 25584 break; 25585 case 0x04: 25586 action = bcmFieldActionRedirectMcast; 25587 25588 if (soc_feature(unit, 25589 soc_feature_field_action_redirect_ipmc)) { 25590 param0 = redir; 25591 } else { 25592 hw_index = redir; 25593 } 25594 break; 25595 case 0x06: 25596 action = bcmFieldActionRedirectIpmc; 25597 if (soc_feature(unit, 25598 soc_feature_field_action_redirect_ipmc)) { 25599 param0 = redir; 25600 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25601 _bcmFieldActionNoParamRedirectIpmcWlan)) { 25602 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_WLAN, 25603 param0); 25604 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25605 _bcmFieldActionNoParamRedirectIpmcVpls)) { 25606 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_VPLS, 25607 param0); 25608 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25609 _bcmFieldActionNoParamRedirectIpmcL3)){ 25610 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_L3, 25611 param0); 25612 } else if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25613 _bcmFieldActionNoParamRedirectIpmcVlan)){ 25614 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_VLAN, 25615 param0); 25616 } 25617 } else { 25618 hw_index = redir; 25619 } 25620 break; 25621 default: 25622 hw_index = redir; 25623 action = bcmFieldActionRedirectPbmp; 25624 rv = soc_mem_read(unit, profile_mem, MEM_BLOCK_ANY, 25625 hw_index, entry_ptr[0]); 25626 BCM_IF_ERROR_RETURN(rv); 25627 soc_mem_pbmp_field_get(unit, profile_mem, entry_ptr[0], 25628 BITMAPf, &pbmp); 25629 param0 = SOC_PBMP_WORD_GET(pbmp, 0); 25630 param1 = SOC_PBMP_WORD_GET(pbmp, 1); 25631 SOC_PROFILE_MEM_REFERENCE(unit, redirect_profile, 25632 hw_index, 1); 25633 SOC_PROFILE_MEM_ENTRIES_PER_SET(unit, redirect_profile, 25634 hw_index, 1); 25635 } 25636 } 25637 append = 1; 25638 break; 25639 case 4: 25640 if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) { 25641 mirror_pbm = PolicyGet(unit, policy_mem, 25642 policy_entry, redir_fld); 25643 for (bit_pos = 1, mtp_index = 0; 25644 mtp_index < BCM_MIRROR_MTP_COUNT; 25645 ++mtp_index, bit_pos <<= 1) { 25646 if (!(mirror_pbm & bit_pos)) { 25647 /* Slot not in use => Skip */ 25648 continue; 25649 } 25650 /* Translate hw index into (module_num, port_num) */ 25651 _bcm_esw_mirror_mtp_to_modport(unit, mtp_index, 25652 TRUE, BCM_MIRROR_PORT_EGRESS_TRUE, &modid, 25653 &gport); 25654 rv = _field_trx_actions_recover_action_add(unit, 25655 f_ent, bcmFieldActionMirrorEgress, 0, 25656 gport, 0, 0, 0, 0, mtp_index); 25657 if (BCM_FAILURE(rv)) { 25658 return rv; 25659 } 25660 } 25661 } else { 25662 action = bcmFieldActionEgressMask; 25663 hw_index = redir; 25664 rv = soc_mem_read(unit, profile_mem, MEM_BLOCK_ANY, 25665 hw_index, entry_ptr[0]); 25666 BCM_IF_ERROR_RETURN(rv); 25667 soc_mem_pbmp_field_get(unit, profile_mem, entry_ptr[0], 25668 BITMAPf, &pbmp); 25669 param0 = SOC_PBMP_WORD_GET(pbmp, 0); 25670 param1 = SOC_PBMP_WORD_GET(pbmp, 1); 25671 param2 = SOC_PBMP_WORD_GET(pbmp, 2); 25672 param3 = SOC_PBMP_WORD_GET(pbmp, 3); 25673 param4 = SOC_PBMP_WORD_GET(pbmp, 4); 25674 param5 = SOC_PBMP_WORD_GET(pbmp, 5); 25675 25676 SOC_PROFILE_MEM_REFERENCE(unit, redirect_profile, 25677 hw_index, 1); 25678 SOC_PROFILE_MEM_ENTRIES_PER_SET(unit, redirect_profile, 25679 hw_index, 1); 25680 append = 1; 25681 } 25682 break; 25683 25684 case 5: 25685 if (SOC_IS_KATANA2(unit) 25686 && (policy_mem == EFP_POLICY_TABLEm)) { 25687 action = bcmFieldActionRedirect; 25688 param0 = redir >> 7; 25689 param1 = redir & 0x7f; 25690 } else if (SOC_IS_TRIUMPH3(unit) && 25691 (policy_mem == EFP_POLICY_TABLEm)) { 25692 action = bcmFieldActionRedirect; 25693 param0 = redir >> 6; 25694 param1 = redir & 0x3f; 25695 } else { 25696 action = bcmFieldActionEgressPortsAdd; 25697 hw_index = redir; 25698 rv = soc_mem_read(unit, profile_mem, MEM_BLOCK_ANY, 25699 hw_index, entry_ptr[0]); 25700 BCM_IF_ERROR_RETURN(rv); 25701 soc_mem_pbmp_field_get(unit, profile_mem, entry_ptr[0], 25702 BITMAPf, &pbmp); 25703 param0 = SOC_PBMP_WORD_GET(pbmp, 0); 25704 param1 = SOC_PBMP_WORD_GET(pbmp, 1); 25705 param2 = SOC_PBMP_WORD_GET(pbmp, 2); 25706 param3 = SOC_PBMP_WORD_GET(pbmp, 3); 25707 param4 = SOC_PBMP_WORD_GET(pbmp, 4); 25708 param5 = SOC_PBMP_WORD_GET(pbmp, 5); 25709 SOC_PROFILE_MEM_REFERENCE(unit, redirect_profile, 25710 hw_index, 1); 25711 SOC_PROFILE_MEM_ENTRIES_PER_SET(unit, redirect_profile, 25712 hw_index, 1); 25713 } 25714 append = 1; 25715 break; 25716 25717 case 6 : 25718 if ((SOC_IS_KATANA2(unit) || SOC_IS_TRIUMPH3(unit)) 25719 && (policy_mem == EFP_POLICY_TABLEm)) { 25720 action = bcmFieldActionRedirectTrunk; 25721 param0 = redir & m; 25722 append = 1; 25723 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 25724 } else if (soc_feature(unit, soc_feature_xflow_macsec)) { 25725 action = bcmFieldActionMacSecRedirectIpmc; 25726 param0 = redir; 25727 _BCM_MULTICAST_GROUP_SET(param0, _BCM_MULTICAST_TYPE_L3, param0); 25728 append = 1; 25729 #endif 25730 } 25731 break; 25732 25733 case 7 : 25734 if ((SOC_IS_KATANA2(unit) || SOC_IS_TRIUMPH3(unit)) 25735 && (policy_mem == EFP_POLICY_TABLEm)) { 25736 action = bcmFieldActionRedirectMcast; 25737 param0 = redir; 25738 append =1; 25739 } 25740 break; 25741 25742 default: 25743 ; 25744 } 25745 } 25746 25747 break; 25748 25749 case PPD3_CLASS_TAGf: 25750 if (fldval != 0) { 25751 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 25752 G_L3SW_CHANGE_L2_FIELDSf)) { 25753 if(PolicyGet(unit, policy_mem, policy_entry, 25754 G_L3SW_CHANGE_L2_FIELDSf) == 0x4) { 25755 action = bcmFieldActionOffloadClassSet; 25756 param0 = fldval; 25757 append = 1; 25758 } 25759 } 25760 } 25761 25762 break; 25763 25764 /* Additions for Enduro */ 25765 25766 case OAM_LMEP_ENf: 25767 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25768 _bcmFieldActionNoParamOamLmepEnable)) || 25769 (fldval)) { 25770 action = bcmFieldActionOamLmepEnable; 25771 param0 = fldval; 25772 append = 1; 25773 } 25774 25775 break; 25776 25777 case OAM_LM_ENf: 25778 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25779 _bcmFieldActionNoParamOamLmEnable)) || 25780 (fldval)) { 25781 action = bcmFieldActionOamLmEnable; 25782 param0 = fldval; 25783 append = 1; 25784 } 25785 25786 break; 25787 25788 case OAM_DM_ENf: 25789 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25790 _bcmFieldActionNoParamOamDmEnable)) || 25791 (fldval)) { 25792 action = bcmFieldActionOamDmEnable; 25793 param0 = fldval; 25794 append = 1; 25795 } 25796 25797 break; 25798 case OAM_ENABLE_LM_DM_SAMPLEf: 25799 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25800 _bcmFieldActionNoParamOamLmDmSampleEnable)) || 25801 (fldval)) { 25802 action = bcmFieldActionOamLmDmSampleEnable; 25803 param0 = fldval; 25804 append = 1; 25805 } 25806 break; 25807 case LM_CTR_POOL_IDf: 25808 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25809 _bcmFieldActionNoParamOamLmCounterPoolId)) { 25810 action = bcmFieldActionOamLmCounterPoolId; 25811 param0 = fldval; 25812 append = 1; 25813 } 25814 break; 25815 case OAM_LM_BASE_PTRf: 25816 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25817 _bcmFieldActionNoParamOamLmBasePtr)) || 25818 (fldval)) { 25819 action = bcmFieldActionOamLmBasePtr; 25820 param0 = fldval; 25821 append = 1; 25822 } 25823 25824 break; 25825 25826 case OAM_SERVICE_PRI_MAPPING_PTRf: 25827 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25828 _bcmFieldActionNoParamOamServicePriMappingPtr)) || 25829 (fldval)) { 25830 action = bcmFieldActionOamServicePriMappingPtr; 25831 param0 = fldval; 25832 append = 1; 25833 } 25834 25835 break; 25836 25837 case OAM_LMEP_MDLf: 25838 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25839 _bcmFieldActionNoParamOamLmepMdl)) || 25840 (fldval)) { 25841 action = bcmFieldActionOamLmepMdl; 25842 param0 = fldval; 25843 append = 1; 25844 } 25845 25846 break; 25847 25848 case OAM_TXf: 25849 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25850 _bcmFieldActionNoParamOamTx)) || 25851 (fldval)) { 25852 action = bcmFieldActionOamTx; 25853 param0 = fldval; 25854 append = 1; 25855 } 25856 25857 break; 25858 25859 case OAM_UP_MEPf: 25860 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 25861 _bcmFieldActionNoParamOamUpMep)) || 25862 (fldval)) { 25863 action = bcmFieldActionOamUpMep; 25864 param0 = fldval; 25865 append = 1; 25866 } 25867 break; 25868 25869 case DO_NOT_GENERATE_CNMf: 25870 if (fldval) { 25871 action = bcmFieldActionCnmCancel; 25872 append = 1; 25873 } 25874 25875 break; 25876 25877 case DISABLE_DYNAMIC_LOAD_BALANCINGf: 25878 case HGT_DLB_DISABLEf: 25879 if (fldval) { 25880 action = bcmFieldActionDynamicHgTrunkCancel; 25881 append = 1; 25882 #if (defined(BCM_TRIDENT_SUPPORT) && defined(BCM_TRIUMPH3_SUPPORT)) || \ 25883 (defined(BCM_TRIDENT_SUPPORT) && defined(BCM_TRIDENT2_SUPPORT)) 25884 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 25885 if (PolicyGet(unit, policy_mem, policy_entry, 25886 LAG_RH_DISABLEf) && PolicyGet(unit, policy_mem, 25887 policy_entry, HGT_RH_DISABLEf)) { 25888 action = bcmFieldActionTrunkLoadBalanceCancel; 25889 } 25890 } else if (SOC_IS_TRIUMPH3(unit)) { 25891 if (PolicyGet(unit, policy_mem, policy_entry, 25892 LAG_DLB_DISABLEf)) { 25893 action = bcmFieldActionTrunkLoadBalanceCancel; 25894 } 25895 } 25896 #endif 25897 } 25898 25899 break; 25900 25901 case CHANGE_OUTER_DOT1Pf: 25902 switch (fldval) { 25903 case 1: 25904 action 25905 = PolicyGet(unit, policy_mem, policy_entry, 25906 CHANGE_INT_PRIORITYf) 25907 ? bcmFieldActionPrioPktAndIntNew 25908 : bcmFieldActionPrioPktNew; 25909 if (bcmFieldActionPrioPktAndIntNew == action) { 25910 /* 25911 * PrioPktAndIntNew action is recovered by 25912 * CHANGE_INT_PRIORITYf 25913 */ 25914 continue; 25915 } 25916 param0 = PolicyGet(unit, 25917 policy_mem, 25918 policy_entry, 25919 NEW_OUTER_DOT1Pf 25920 ); 25921 25922 append = 1; 25923 25924 break; 25925 case 2: 25926 #ifdef BCM_TRIDENT_SUPPORT 25927 if ((SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || 25928 SOC_IS_TRIUMPH3(unit)) 25929 && _BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) { 25930 25931 action = bcmFieldActionOuterVlanPrioNew; 25932 param0 = PolicyGet(unit, 25933 policy_mem, 25934 policy_entry, 25935 NEW_OUTER_DOT1Pf 25936 ); 25937 append = 1; 25938 } 25939 #endif 25940 break; 25941 case 3: 25942 action = bcmFieldActionOuterVlanPrioCopyInner; 25943 append = 1; 25944 25945 break; 25946 25947 default: 25948 ; 25949 } 25950 25951 break; 25952 25953 case CHANGE_OUTER_CFIf: 25954 switch (fldval) { 25955 case 2: 25956 action = bcmFieldActionOuterVlanCfiNew; 25957 param0 = PolicyGet(unit, 25958 policy_mem, 25959 policy_entry, 25960 NEW_OUTER_CFIf 25961 ); 25962 25963 append = 1; 25964 25965 break; 25966 case 3: 25967 action = bcmFieldActionOuterVlanCfiCopyInner; 25968 append = 1; 25969 25970 break; 25971 25972 default: 25973 ; 25974 } 25975 25976 break; 25977 25978 case CHANGE_INNER_DOT1Pf: 25979 switch (fldval) { 25980 case 2: 25981 /* No corresponding cold config (?) */ 25982 action = bcmFieldActionInnerVlanPrioNew; 25983 param0 = PolicyGet(unit, 25984 policy_mem, 25985 policy_entry, 25986 NEW_INNER_DOT1Pf 25987 ); 25988 append = 1; 25989 25990 break; 25991 25992 case 3: 25993 action = bcmFieldActionInnerVlanPrioCopyOuter; 25994 append = 1; 25995 25996 break; 25997 25998 default: 25999 ; 26000 } 26001 26002 break; 26003 26004 case CHANGE_INNER_CFIf: 26005 switch (fldval) { 26006 case 2: 26007 action = bcmFieldActionInnerVlanCfiNew; 26008 param0 = PolicyGet(unit, 26009 policy_mem, 26010 policy_entry, 26011 NEW_INNER_CFIf 26012 ); 26013 append = 1; 26014 break; 26015 26016 case 3: 26017 action = bcmFieldActionInnerVlanCfiCopyOuter; 26018 append = 1; 26019 26020 break; 26021 26022 default: 26023 ; 26024 } 26025 26026 break; 26027 26028 case IPV6_TO_IPV4_MAP_SIP_VALIDf: 26029 if (fldval != 0) { 26030 action = bcmFieldActionCompressSrcIp6; 26031 param0 = PolicyGet(unit, 26032 policy_mem, 26033 policy_entry, 26034 IPV6_TO_IPV4_MAP_OFFSET_SETf); 26035 append = 1; 26036 } 26037 break; 26038 26039 case IPV6_TO_IPV4_MAP_DIP_VALIDf: 26040 if (fldval != 0) { 26041 action = bcmFieldActionCompressDstIp6; 26042 param0 = PolicyGet(unit, 26043 policy_mem, 26044 policy_entry, 26045 IPV6_TO_IPV4_MAP_OFFSET_SETf); 26046 append = 1; 26047 } 26048 break; 26049 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \ 26050 defined(BCM_APACHE_SUPPORT) || defined (BCM_GREYHOUND2_SUPPORT) 26051 case USE_SVC_METER_COLORf: 26052 if (fldval != 0) { 26053 action = bcmFieldActionUseGlobalMeterColor; 26054 append = 1; 26055 } 26056 break; 26057 #endif 26058 case USE_VFP_VRF_IDf: 26059 if (fldval) { 26060 action = bcmFieldActionVrfSet; 26061 param0 = PolicyGet(unit, policy_mem, policy_entry, VFP_VRF_IDf); 26062 append = 1; 26063 } 26064 break; 26065 26066 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT)\ 26067 || defined (BCM_TRIDENT2PLUS_SUPPORT) 26068 case OAM_KEY1f: 26069 if (fldval != 0) { 26070 action = bcmFieldActionOamDomain; 26071 param0 = PolicyGet(unit, policy_mem, policy_entry, OAM_KEY1f) - 1; 26072 param1 = PolicyGet(unit, policy_mem, policy_entry, OAM_KEY2f) - 1; 26073 append = 1; 26074 } 26075 break; 26076 26077 case OLP_HDR_ADDf: 26078 if (fldval != 0) { 26079 action = bcmFieldActionOamOlpHeaderAdd; 26080 if (soc_feature(unit, soc_feature_oam)) { 26081 hw_index = PolicyGet(unit, policy_mem, policy_entry, 26082 OLP_HDR_TYPE_COMPRESSEDf); 26083 param0 = 0; 26084 rv = _bcm_oam_olp_hw_index_olp_type_get (unit, 26085 hw_index, ¶m0); 26086 if (BCM_FAILURE(rv)) { 26087 return rv; 26088 } 26089 append = 1; 26090 } 26091 } 26092 break; 26093 26094 case ADD_OLP_HEADERf: 26095 if (fldval != 0) { 26096 if (soc_feature(unit, soc_feature_fp_based_oam)) { 26097 hw_index = PolicyGet(unit, policy_mem, policy_entry, 26098 OLP_HDR_TYPE_COMPRESSEDf); 26099 param0 = 0; 26100 rv = _bcm_oam_olp_hw_index_olp_type_get (unit, 26101 hw_index, ¶m0); 26102 if (BCM_FAILURE(rv)) { 26103 return rv; 26104 } 26105 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 26106 /* Action is recovered as part of other MACSEC actions */ 26107 if ((soc_feature(unit, soc_feature_xflow_macsec)) && 26108 (0xB == (param0 >> 1))) { 26109 append = 0; 26110 break; 26111 } 26112 #endif /* BCM_MONTEREY_SUPPORT & INCLUDE_XFLOW_MACSEC */ 26113 /* NAT_OAM_ACTION_SELECTf = _bcmFieldNatOamValidOam 26114 * for Trident2Plus */ 26115 if (SOC_MEM_FIELD_VALID(unit, policy_mem, NAT_OAM_ACTION_SELECTf) 26116 && (PolicyGet(unit, policy_mem, policy_entry, 26117 NAT_OAM_ACTION_SELECTf) != _bcmFieldNatOamValidOam)) { 26118 break; 26119 } 26120 26121 action = bcmFieldActionOamOlpHeaderAdd; 26122 append = 1; 26123 } 26124 } 26125 break; 26126 26127 case SAMPLE_TIMESTAMPf: 26128 if (fldval != 0) { 26129 action = bcmFieldActionOamDmTimeFormat; 26130 if (soc_feature(unit, soc_feature_fp_based_oam)) { 26131 /* NAT_OAM_ACTION_SELECTf = _bcmFieldNatOamValidOam 26132 * for Trident2Plus */ 26133 if (SOC_MEM_FIELD_VALID(unit, policy_mem, NAT_OAM_ACTION_SELECTf)) { 26134 if(PolicyGet(unit, policy_mem, policy_entry, 26135 NAT_OAM_ACTION_SELECTf) != _bcmFieldNatOamValidOam) { 26136 break; 26137 } 26138 } 26139 26140 if (fldval == 1) { 26141 param0 = BCM_FIELD_OAM_DM_TIME_FORMAT_IEEE1588; 26142 } else if(fldval == 2) { 26143 param0 = BCM_FIELD_OAM_DM_TIME_FORMAT_NTP; 26144 } else { 26145 return BCM_E_INTERNAL; 26146 } 26147 append = 1; 26148 } 26149 } 26150 break; 26151 26152 case OAM_SESSION_IDf: 26153 if (fldval != 0) { 26154 /* OAM_SESSION_ID is overlayed with DSCP acion */ 26155 if (!(PolicyGet(unit, policy_mem, policy_entry, G_CHANGE_DSCP_TOSf) || 26156 PolicyGet(unit, policy_mem, policy_entry, Y_CHANGE_DSCPf) || 26157 PolicyGet(unit, policy_mem, policy_entry, R_CHANGE_DSCPf))) { 26158 action = bcmFieldActionOamSessionId; 26159 param0 = PolicyGet(unit, policy_mem, policy_entry, 26160 OAM_SESSION_IDf); 26161 append = 1; 26162 } 26163 } 26164 break; 26165 #endif 26166 #if defined(BCM_TRIDENT2_SUPPORT) 26167 case FCOE_SRC_BIND_CHECK_ENABLEf: 26168 if (fldval != 0) { 26169 action = bcmFieldActionFibreChanSrcBindEnable; 26170 param0 = PolicyGet(unit, policy_mem, policy_entry, 26171 FCOE_SRC_BIND_CHECK_ENABLEf); 26172 append = 1; 26173 } 26174 break; 26175 case FCOE_SRC_FPMA_PREFIX_CHECK_ENABLEf: 26176 if (fldval != 0) { 26177 action = bcmFieldActionFibreChanFpmaPrefixCheckEnable; 26178 param0 = PolicyGet(unit, policy_mem, policy_entry, 26179 FCOE_SRC_FPMA_PREFIX_CHECK_ENABLEf); 26180 append = 1; 26181 } 26182 break; 26183 case FCOE_ZONE_CHECK_ENABLEf: 26184 if (fldval != 0) { 26185 action = bcmFieldActionFibreChanZoneCheckEnable; 26186 param0 = PolicyGet(unit, policy_mem, policy_entry, 26187 FCOE_ZONE_CHECK_ENABLEf); 26188 append = 1; 26189 } 26190 break; 26191 case FCOE_VSAN_IDf: 26192 if (fldval != 0) { 26193 action = bcmFieldActionFibreChanVsanId; 26194 param0 = PolicyGet(unit, policy_mem, policy_entry, 26195 FCOE_VSAN_IDf); 26196 append = 1; 26197 } 26198 break; 26199 case FCOE_ZONE_CHECK_ACTIONf: 26200 if (fldval != 0) { 26201 action = bcmFieldActionFibreChanZoneCheckActionCancel; 26202 param0 = PolicyGet(unit, policy_mem, policy_entry, 26203 FCOE_ZONE_CHECK_ACTIONf); 26204 append = 1; 26205 } 26206 break; 26207 case FCOE_VSAN_PRI_VALIDf: 26208 if (fldval != 0) { 26209 action = bcmFieldActionFibreChanIntVsanPri; 26210 param0 = PolicyGet(unit, policy_mem, policy_entry, 26211 FCOE_VSAN_PRIf); 26212 append = 1; 26213 } 26214 break; 26215 case DO_NOT_NATf: 26216 /* NAT_OAM_ACTION_SELECTf = _bcmFieldNatOamValidNat 26217 * for Trident2Plus */ 26218 if (SOC_MEM_FIELD_VALID(unit, policy_mem, NAT_OAM_ACTION_SELECTf)) { 26219 if(PolicyGet(unit, policy_mem, policy_entry, 26220 NAT_OAM_ACTION_SELECTf) != _bcmFieldNatOamValidNat) { 26221 break; 26222 } 26223 } 26224 if (fldval != 0) { 26225 action = bcmFieldActionNatCancel; 26226 param0 = PolicyGet(unit, policy_mem, policy_entry, 26227 DO_NOT_NATf); 26228 append = 1; 26229 } 26230 break; 26231 case NAT_ENABLEf: 26232 /* NAT_OAM_ACTION_SELECTf = _bcmFieldNatOamValidNat 26233 * for Trident2Plus */ 26234 if (SOC_MEM_FIELD_VALID(unit, policy_mem, NAT_OAM_ACTION_SELECTf)) { 26235 if(PolicyGet(unit, policy_mem, policy_entry, 26236 NAT_OAM_ACTION_SELECTf) != _bcmFieldNatOamValidNat) { 26237 break; 26238 } 26239 } 26240 if (fldval != 0) { 26241 action = bcmFieldActionNat; 26242 param0 = PolicyGet(unit, policy_mem, policy_entry, 26243 NAT_ENABLEf); 26244 append = 1; 26245 } 26246 break; 26247 #ifdef INCLUDE_L3 26248 case NAT_PACKET_EDIT_IDXf: 26249 /* NAT_OAM_ACTION_SELECTf = _bcmFieldNatOamValidNat 26250 * for Trident2Plus */ 26251 if (SOC_MEM_FIELD_VALID(unit, policy_mem, NAT_OAM_ACTION_SELECTf)) { 26252 if(PolicyGet(unit, policy_mem, policy_entry, 26253 NAT_OAM_ACTION_SELECTf) != _bcmFieldNatOamValidNat) { 26254 break; 26255 } 26256 } 26257 if (fldval != 0) { 26258 action = bcmFieldActionNatEgressOverride; 26259 param0 = BCM_L3_NAT_EGRESS_SW_IDX_GET(PolicyGet(unit, policy_mem, 26260 policy_entry, NAT_PACKET_EDIT_IDXf), 26261 PolicyGet(unit, policy_mem, policy_entry, 26262 NAT_PACKET_EDIT_ENTRY_SELf)); 26263 append = 1; 26264 } 26265 break; 26266 case NAT_PACKET_EDIT_ENTRY_SELf: 26267 /* The param value is updated in NAT_PACKET_EDIT_IDXf */ 26268 break; 26269 #endif /* INCLUDE_L3 */ 26270 case SFLOW_ING_SAMPLEf: 26271 if (fldval != 0) { 26272 action = bcmFieldActionIngSampleEnable; 26273 append = 1; 26274 } 26275 break; 26276 case SFLOW_EGR_SAMPLEf: 26277 if (fldval != 0) { 26278 action = bcmFieldActionEgrSampleEnable; 26279 append = 1; 26280 } 26281 break; 26282 case HASH_FIELD_BITMAP_PTR_Af: 26283 if ((SOC_IS_TRIDENT2X(unit) || 26284 SOC_IS_TITAN2PLUS(unit) || 26285 soc_feature(unit, soc_feature_field_multi_pipe_support) )) { 26286 hw_index = PolicyGet(unit, policy_mem, policy_entry, 26287 HASH_FIELD_BITMAP_PTR_Af); 26288 action = bcmFieldActionHashSelect0; 26289 rv = soc_mem_read(unit, hash_select_profile_mem[0], 26290 MEM_BLOCK_ANY, hw_index, 26291 entry_ptr[0]); 26292 BCM_IF_ERROR_RETURN(rv); 26293 param0 = PolicyGet(unit, hash_select_profile_mem[0], 26294 entry_ptr[0], BITMAPf); 26295 if (param0) { 26296 append = 1; 26297 } 26298 rv = soc_profile_mem_reference(unit, 26299 hash_select_profile[0], hw_index, 1); 26300 BCM_IF_ERROR_RETURN(rv); 26301 } 26302 break; 26303 case HASH_FIELD_BITMAP_PTR_Bf: 26304 if ((SOC_IS_TRIDENT2X(unit) || 26305 SOC_IS_TITAN2PLUS(unit) || 26306 soc_feature(unit, soc_feature_field_multi_pipe_support) )) { 26307 hw_index = PolicyGet(unit, policy_mem, policy_entry, 26308 HASH_FIELD_BITMAP_PTR_Bf); 26309 action = bcmFieldActionHashSelect1; 26310 rv = soc_mem_read(unit, hash_select_profile_mem[1], 26311 MEM_BLOCK_ANY, hw_index, 26312 entry_ptr[0]); 26313 BCM_IF_ERROR_RETURN(rv); 26314 param0 = PolicyGet(unit, hash_select_profile_mem[1], 26315 entry_ptr[0], BITMAPf); 26316 if (param0) { 26317 append = 1; 26318 } 26319 rv = soc_profile_mem_reference(unit, 26320 hash_select_profile[1], hw_index, 1); 26321 BCM_IF_ERROR_RETURN(rv); 26322 } 26323 break; 26324 case LAG_RH_DISABLEf: 26325 if (fldval != 0) { 26326 action = bcmFieldActionTrunkResilientHashCancel; 26327 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 26328 if (PolicyGet(unit, policy_mem, policy_entry, 26329 HGT_DLB_DISABLEf) && PolicyGet(unit, policy_mem, 26330 policy_entry, HGT_RH_DISABLEf)) { 26331 action = bcmFieldActionTrunkLoadBalanceCancel; 26332 } 26333 } 26334 append = 1; 26335 } 26336 break; 26337 case HGT_RH_DISABLEf: 26338 if (fldval != 0) { 26339 action = bcmFieldActionHgTrunkResilientHashCancel; 26340 if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 26341 if (PolicyGet(unit, policy_mem, policy_entry, 26342 HGT_DLB_DISABLEf) && PolicyGet(unit, policy_mem, 26343 policy_entry, LAG_RH_DISABLEf)) { 26344 action = bcmFieldActionTrunkLoadBalanceCancel; 26345 } 26346 } 26347 append = 1; 26348 } 26349 break; 26350 case ECMP_RH_DISABLEf: 26351 if (fldval != 0) { 26352 action = bcmFieldActionEcmpResilientHashCancel; 26353 append = 1; 26354 } 26355 break; 26356 #endif /* BCM_TRIDENT2_SUPPORT */ 26357 #if defined(BCM_GREYHOUND_SUPPORT) || defined(BCM_TOMAHAWK_SUPPORT) 26358 case G_HG_CONGESTION_CLASS_CHANGEf: 26359 append = 0; 26360 if (soc_feature(unit, soc_feature_ecn_wred) && fldval) { 26361 param0 = PolicyGet(unit, policy_mem, policy_entry, 26362 G_HG_CONGESTION_CLASS_NEWf); 26363 action = bcmFieldActionGpHGCongestionClassNew; 26364 append = 1; 26365 } 26366 break; 26367 case Y_HG_CONGESTION_CLASS_CHANGEf: 26368 append = 0; 26369 if (soc_feature(unit, soc_feature_ecn_wred) && fldval) { 26370 param0 = PolicyGet(unit, policy_mem, policy_entry, 26371 Y_HG_CONGESTION_CLASS_NEWf); 26372 action = bcmFieldActionYpHGCongestionClassNew; 26373 append = 1; 26374 } 26375 break; 26376 case R_HG_CONGESTION_CLASS_CHANGEf: 26377 append = 0; 26378 if (soc_feature(unit, soc_feature_ecn_wred) && fldval) { 26379 param0 = PolicyGet(unit, policy_mem, policy_entry, 26380 R_HG_CONGESTION_CLASS_NEWf); 26381 action = bcmFieldActionRpHGCongestionClassNew; 26382 append = 1; 26383 } 26384 break; 26385 #endif 26386 #if defined(BCM_TOMAHAWK_SUPPORT) 26387 case HG_DST_MODID_CHANGEf: 26388 if (PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf)) { 26389 /* HiGiG header modification actions */ 26390 change_modid = fldval; 26391 change_portid = PolicyGet(unit, policy_mem, policy_entry, 26392 HG_DST_PORT_CHANGEf); 26393 modid_new = PolicyGet(unit, policy_mem, policy_entry, 26394 HG_DST_MODID_NEWf); 26395 portid_new = PolicyGet(unit, policy_mem, policy_entry, 26396 HG_DST_PORT_NEWf); 26397 26398 if (change_modid && change_portid) { 26399 26400 /* 26401 * Though new HiGiG "Destination module" and 26402 * "Destination Port" actions in Cold Boot are assigned 26403 * using bcmFieldActionHiGigDstModuleGportNew and 26404 * bcmFieldActionHiGigDstPortGportNew respectively, 26405 * in Warm Boot it is recover as single field qualifier 26406 * bcmFieldActionHiGigDstGportNew. 26407 */ 26408 26409 BCM_GPORT_MODPORT_SET(gport, modid_new, portid_new); 26410 action = bcmFieldActionHiGigDstGportNew; 26411 param0 = gport; 26412 append = 1; 26413 } else if (change_modid && !change_portid) { 26414 portid_new = 0; 26415 BCM_GPORT_MODPORT_SET(gport, modid_new, portid_new); 26416 action = bcmFieldActionHiGigDstModuleGportNew; 26417 param0 = gport; 26418 append = 1; 26419 } else if (!change_modid && change_portid) { 26420 modid_new = 0; 26421 BCM_GPORT_MODPORT_SET(gport, modid_new, portid_new); 26422 action = bcmFieldActionHiGigDstPortGportNew; 26423 param0 = gport; 26424 append = 1; 26425 } else { 26426 append = 0; 26427 } 26428 } 26429 break; 26430 case G_HG_DP_CHANGEf: 26431 append = 0; 26432 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26433 _bcmFieldActionNoParamHiGigDropPrecedenceNew)) { 26434 break; 26435 } else if (PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf) && 26436 fldval) { 26437 action = bcmFieldActionGpHiGigDropPrecedenceNew; 26438 param0 = PolicyGet(unit, policy_mem, policy_entry, G_HG_DP_NEWf); 26439 append = 1; 26440 } 26441 break; 26442 case Y_HG_DP_CHANGEf: 26443 append = 0; 26444 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26445 _bcmFieldActionNoParamHiGigDropPrecedenceNew)) { 26446 break; 26447 } else if (PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf) && 26448 fldval) { 26449 action = bcmFieldActionYpHiGigDropPrecedenceNew; 26450 param0 = PolicyGet(unit, policy_mem, policy_entry, Y_HG_DP_NEWf); 26451 append = 1; 26452 } 26453 break; 26454 case R_HG_DP_CHANGEf: 26455 append = 0; 26456 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26457 _bcmFieldActionNoParamHiGigDropPrecedenceNew)) { 26458 action = bcmFieldActionHiGigDropPrecedenceNew; 26459 param0 = PolicyGet(unit, policy_mem, policy_entry, R_HG_DP_NEWf); 26460 append = 1; 26461 } else if (PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf) && 26462 fldval) { 26463 action = bcmFieldActionRpHiGigDropPrecedenceNew; 26464 param0 = PolicyGet(unit, policy_mem, policy_entry, R_HG_DP_NEWf); 26465 append = 1; 26466 } 26467 break; 26468 case G_HG_INT_PRI_CHANGEf: 26469 append = 0; 26470 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26471 _bcmFieldActionNoParamHiGigIntPriNew)) { 26472 break; 26473 } else if (PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf) && 26474 fldval) { 26475 action = bcmFieldActionGpHiGigIntPriNew; 26476 param0 = PolicyGet(unit, policy_mem, policy_entry, 26477 G_HG_INT_PRI_NEWf); 26478 append = 1; 26479 } 26480 break; 26481 case Y_HG_INT_PRI_CHANGEf: 26482 append = 0; 26483 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26484 _bcmFieldActionNoParamHiGigIntPriNew)) { 26485 break; 26486 } else if (PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf) && 26487 fldval) { 26488 action = bcmFieldActionYpHiGigIntPriNew; 26489 param0 = PolicyGet(unit, policy_mem, policy_entry, 26490 Y_HG_INT_PRI_NEWf); 26491 append = 1; 26492 } 26493 break; 26494 case R_HG_INT_PRI_CHANGEf: 26495 append = 0; 26496 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26497 _bcmFieldActionNoParamHiGigIntPriNew)) { 26498 action = bcmFieldActionHiGigIntPriNew; 26499 param0 = PolicyGet(unit, policy_mem, policy_entry, 26500 R_HG_INT_PRI_NEWf); 26501 append = 1; 26502 } else if (PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf) && 26503 fldval) { 26504 action = bcmFieldActionRpHiGigIntPriNew; 26505 param0 = PolicyGet(unit, policy_mem, policy_entry, 26506 R_HG_INT_PRI_NEWf); 26507 append = 1; 26508 } 26509 break; 26510 case LB_SRC_MODID_CHANGEf: 26511 if (!PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf) && 26512 PolicyGet(unit, policy_mem, policy_entry, LB_SRC_TYPE_CHANGEf)) { 26513 /* HiGiG header modification actions */ 26514 change_modid = fldval; 26515 change_portid = PolicyGet(unit, policy_mem, policy_entry, 26516 LB_SRC_PORT_CHANGEf); 26517 modid_new = PolicyGet(unit, policy_mem, policy_entry, 26518 LB_SRC_MODID_NEWf); 26519 portid_new = PolicyGet(unit, policy_mem, policy_entry, 26520 LB_SRC_PORT_NEWf); 26521 is_not_svp = PolicyGet(unit, policy_mem, policy_entry, 26522 LB_SRC_TYPE_NEWf); 26523 26524 if (change_modid && change_portid) { 26525 /* 26526 * Though new LoopBack "Source module" and 26527 * "Source Port" actions in Cold Boot are assigned 26528 * using bcmFieldActionLoopbackSrcModuleGportNew and 26529 * bcmFieldActionLoopbackSrcPortGportNew respectively, 26530 * in Warm Boot it is recover as single field qualifier 26531 * bcmFieldActionLoopbackSrcGportNew. 26532 */ 26533 if (is_not_svp) { 26534 BCM_GPORT_MODPORT_SET(gport, modid_new, portid_new); 26535 } else { 26536 /* Any SVP(MiM, TRILL, L2GRE or VXLAN) is recovered as 26537 * VXLAN SVP, as h/w doent have svp type information. 26538 */ 26539 svp = ((uint32)modid_new << 0x8) | (portid_new & 0xff); 26540 BCM_GPORT_VXLAN_PORT_ID_SET(gport, svp); 26541 } 26542 action = bcmFieldActionLoopbackSrcGportNew; 26543 param0 = gport; 26544 append = 1; 26545 } else if (change_modid && !change_portid) { 26546 portid_new = 0; 26547 BCM_GPORT_MODPORT_SET(gport, modid_new, portid_new); 26548 action = bcmFieldActionLoopbackSrcModuleGportNew; 26549 param0 = gport; 26550 append = 1; 26551 } else if (!change_modid && change_portid) { 26552 modid_new = 0; 26553 BCM_GPORT_MODPORT_SET(gport, modid_new, portid_new); 26554 action = bcmFieldActionLoopbackSrcPortGportNew; 26555 param0 = gport; 26556 append = 1; 26557 } else { 26558 append = 0; 26559 } 26560 } 26561 break; 26562 case LB_PACKET_PROFILE_CHANGEf: 26563 append = 0; 26564 if (((soc_feature(unit, soc_feature_th3_style_fp)) 26565 || (!PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf))) && fldval) { 26566 action = bcmFieldActionLoopbackCpuMasqueradePktProfileNew; 26567 param0 = PolicyGet(unit, policy_mem, policy_entry, 26568 LB_PACKET_PROFILE_NEWf); 26569 append = 1; 26570 } 26571 break; 26572 case LB_PP_PORT_CHANGEf: 26573 append = 0; 26574 if (((soc_feature(unit, soc_feature_th3_style_fp)) 26575 || (!PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf))) && fldval) { 26576 action = bcmFieldActionLoopbackPacketProcessingPortNew; 26577 param0 = PolicyGet(unit, policy_mem, policy_entry, 26578 LB_PP_PORT_NEWf); 26579 append = 1; 26580 } 26581 break; 26582 case LB_TYPE_CHANGEf: 26583 append = 0; 26584 if (((soc_feature(unit, soc_feature_th3_style_fp)) 26585 || (!PolicyGet(unit, policy_mem, policy_entry,HG_ACTIONf))) && fldval) { 26586 action = bcmFieldActionLoopBackTypeNew; 26587 param0 = PolicyGet(unit, policy_mem, policy_entry, 26588 LB_TYPE_NEWf); 26589 append = 1; 26590 } 26591 break; 26592 #endif 26593 #if defined(INCLUDE_L3) 26594 #if defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \ 26595 defined(BCM_TOMAHAWK_SUPPORT) 26596 case PROTECTION_SWITCHING_DROP_OVERIDEf: 26597 #if defined(BCM_TOMAHAWK2_SUPPORT) 26598 case PROTECTION_SWITCHING_DROP_OVERRIDEf: 26599 #endif 26600 if (fldval != 0) { 26601 action = bcmFieldActionRecoverableDropCancel; 26602 append = 1; 26603 } 26604 break; 26605 #endif 26606 #endif /* INCLUDE_L3 */ 26607 case DROP_DATA_ENABLEf: 26608 if ((fldval != 0) && 26609 (f_ent->group->stage_id == _BCM_FIELD_STAGE_LOOKUP)) { 26610 action = bcmFieldActionProtectionSwitchingDrop; 26611 append = 1; 26612 } 26613 break; 26614 #if defined (BCM_TRX_SUPPORT) 26615 case R_REDIR_DROP_PRECEDENCEf: 26616 if (fldval != 0) { 26617 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26618 _bcmFieldActionNoParamRedirDropPrecedenceNoColor)) { 26619 break; 26620 } 26621 action = bcmFieldActionRpRedirDropPrecedence; 26622 param0 = fldval; 26623 append = 1; 26624 switch (param0) { 26625 case 0: 26626 param0 = BCM_FIELD_COLOR_PRESERVE; 26627 break; 26628 case 1: 26629 param0 = BCM_FIELD_COLOR_GREEN; 26630 break; 26631 case 2: 26632 param0 = BCM_FIELD_COLOR_YELLOW; 26633 break; 26634 case 3: 26635 param0 = BCM_FIELD_COLOR_RED; 26636 break; 26637 default: 26638 break; /* Do nothing */ 26639 } 26640 } 26641 break; 26642 case Y_REDIR_DROP_PRECEDENCEf: 26643 if (fldval != 0) { 26644 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26645 _bcmFieldActionNoParamRedirDropPrecedenceNoColor)) { 26646 break; 26647 } 26648 action = bcmFieldActionYpRedirDropPrecedence; 26649 param0 = fldval; 26650 append = 1; 26651 switch (param0) { 26652 case 0: 26653 param0 = BCM_FIELD_COLOR_PRESERVE; 26654 break; 26655 case 1: 26656 param0 = BCM_FIELD_COLOR_GREEN; 26657 break; 26658 case 2: 26659 param0 = BCM_FIELD_COLOR_YELLOW; 26660 break; 26661 case 3: 26662 param0 = BCM_FIELD_COLOR_RED; 26663 break; 26664 default: 26665 break; /* Do nothing */ 26666 } 26667 } 26668 break; 26669 case G_REDIR_DROP_PRECEDENCEf: 26670 if (fldval != 0) { 26671 if ((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26672 _bcmFieldActionNoParamRedirDropPrecedenceNoColor)) { 26673 action = bcmFieldActionRedirDropPrecedence; 26674 } else { 26675 action = bcmFieldActionGpRedirDropPrecedence; 26676 } 26677 param0 = fldval; 26678 append = 1; 26679 switch (param0) { 26680 case 0: 26681 param0 = BCM_FIELD_COLOR_PRESERVE; 26682 break; 26683 case 1: 26684 param0 = BCM_FIELD_COLOR_GREEN; 26685 break; 26686 case 2: 26687 param0 = BCM_FIELD_COLOR_YELLOW; 26688 break; 26689 case 3: 26690 param0 = BCM_FIELD_COLOR_RED; 26691 break; 26692 default: 26693 break; /* Do nothing */ 26694 } 26695 } 26696 break; 26697 #endif /* BCM_TRX_SUPPORT */ 26698 #if defined(BCM_TRIDENT2_SUPPORT) || defined (BCM_KATANA2_SUPPORT) || \ 26699 defined(BCM_TRIUMPH3_SUPPORT) 26700 case I2E_CLASSID_SELf: 26701 if((SOC_IS_KATANA2(unit) 26702 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 26703 SOC_IS_SABER2(unit) || SOC_IS_TRIUMPH3(unit) ) && 26704 (fldval != 0) ) { 26705 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 26706 G_L3SW_CHANGE_L2_FIELDSf)) { 26707 int val; 26708 26709 val = PolicyGet(unit, policy_mem, policy_entry, 26710 G_L3SW_CHANGE_L2_FIELDSf); 26711 if ((SOC_IS_KATANA2(unit) && val == 0x5) || 26712 (SOC_IS_TRIUMPH3(unit) && val == 0x8) || 26713 ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 26714 && val == 0x8)) { 26715 param0 = fldval; 26716 action = bcmFieldActionEgressClassSelect; 26717 append = 1; 26718 switch (param0) { 26719 case 0x1: 26720 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_PORT; 26721 break; 26722 case 0x2: 26723 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_SVP; 26724 break; 26725 case 0x3: 26726 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_L3_IIF; 26727 break; 26728 case 0x4: 26729 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_FIELD_SRC; 26730 break; 26731 case 0x5: 26732 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_FIELD_DST; 26733 break; 26734 case 0x6: 26735 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_L2_SRC; 26736 break; 26737 case 0x7: 26738 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_L2_DST; 26739 break; 26740 case 0x8: 26741 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_L3_SRC; 26742 break; 26743 case 0x9: 26744 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_L3_DST; 26745 break; 26746 case 0xa: 26747 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_VLAN; 26748 break; 26749 case 0xb: 26750 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_VRF; 26751 break; 26752 case 0xf: 26753 param0 = BCM_FIELD_EGRESS_CLASS_SELECT_NEW; 26754 break; 26755 default: 26756 break;/* Do nothing */ 26757 } 26758 } 26759 } 26760 } 26761 break; 26762 case HG_CLASSID_SELf: 26763 /* HiGigClassSelect is overlayed with many other actions which set 26764 G_L3SW_CHANGE_L2_FIELDSf */ 26765 if(fldval) { 26766 int val; 26767 26768 val = PolicyGet(unit, policy_mem, policy_entry, 26769 G_L3SW_CHANGE_L2_FIELDSf); 26770 if ((0 == val) || (SOC_IS_KATANA2(unit) && val == 0x5) || 26771 ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 26772 && val == 0x8)) { 26773 param0 = fldval; 26774 action = bcmFieldActionHiGigClassSelect; 26775 append = 1; 26776 switch (param0) { 26777 case 0x1: 26778 param0 = BCM_FIELD_HIGIG_CLASS_SELECT_EGRESS; 26779 break; 26780 case 0x2: 26781 param0 = BCM_FIELD_HIGIG_CLASS_SELECT_EGR_NEXT_HOP; 26782 break; 26783 case 0x3: 26784 param0 = BCM_FIELD_HIGIG_CLASS_SELECT_EGR_L3_INTERFACE; 26785 break; 26786 case 0x4: 26787 param0 = BCM_FIELD_HIGIG_CLASS_SELECT_EGR_DVP; 26788 break; 26789 case 0x7: 26790 param0 = BCM_FIELD_HIGIG_CLASS_SELECT_PORT; 26791 break; 26792 default: 26793 break;/* Do nothing */ 26794 } 26795 } 26796 } 26797 break; 26798 case I2E_CLASSIDf: 26799 if (((action_sync == 1) && SHR_BITGET(f_ent_wb_info->action_bmp->w, 26800 _bcmFieldActionNoParamNewClassId)) || 26801 (fldval != 0)) { 26802 if(SOC_IS_KATANA2(unit) 26803 || (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) || 26804 SOC_IS_SABER2(unit) || SOC_IS_TRIUMPH3(unit) ) { 26805 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 26806 G_L3SW_CHANGE_L2_FIELDSf)) { 26807 int val; 26808 val = PolicyGet(unit, policy_mem, policy_entry, 26809 G_L3SW_CHANGE_L2_FIELDSf); 26810 if ((SOC_IS_KATANA2(unit) && val == 0x5) || 26811 (SOC_IS_SABER2(unit) && val == 0x5) || 26812 (SOC_IS_TRIUMPH3(unit) && val == 0x8) || 26813 ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)) 26814 && val == 0x8)) { 26815 action = bcmFieldActionNewClassId; 26816 param0 = fldval; 26817 append = 1; 26818 } 26819 } 26820 } else { 26821 action = bcmFieldActionNewClassId; 26822 param0 = fldval; 26823 append = 1; 26824 } 26825 } 26826 break; 26827 #endif /* BCM_KATANA2_SUPPORT */ 26828 case ACTION_PRI_MODIFIERf: 26829 if (fldval != 0) { 26830 #if defined (BCM_TOMAHAWK3_SUPPORT) 26831 if (soc_feature(unit, soc_feature_th3_style_fp)) { 26832 action = bcmFieldActionL3IngressStrengthSet; 26833 append = 1; 26834 } else 26835 #endif 26836 { 26837 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \ 26838 defined(BCM_APACHE_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) 26839 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 26840 SVC_METER_INDEX_PRIORITYf)) { 26841 if(0 == PolicyGet(unit, policy_mem, 26842 policy_entry, 26843 SVC_METER_INDEX_PRIORITYf)) { 26844 action = bcmFieldActionDoNotOverride; 26845 append = 1; 26846 } 26847 } else { 26848 action = bcmFieldActionDoNotOverride; 26849 append = 1; 26850 } 26851 #endif 26852 } 26853 } 26854 break; 26855 case CHANGE_INPUT_PRIORITYf: 26856 switch (fldval) { 26857 case 1: 26858 action = bcmFieldActionPfcClassNew; 26859 param0 = PolicyGet(unit, policy_mem, policy_entry, 26860 NEW_INPUT_PRIORITYf); 26861 append = 1; 26862 break; 26863 default: 26864 break; /* Do nothing */ 26865 } 26866 break; 26867 case G_CHANGE_INT_CNf: 26868 switch (fldval) { 26869 case 1: 26870 action = bcmFieldActionGpIntCongestionNotificationNew; 26871 param0 = PolicyGet(unit, policy_mem, policy_entry, 26872 G_NEW_INT_CNf); 26873 append = 1; 26874 break; 26875 default: 26876 break; /* Do nothing */ 26877 } 26878 break; 26879 case Y_CHANGE_INT_CNf: 26880 switch (fldval) { 26881 case 1: 26882 action = bcmFieldActionYpIntCongestionNotificationNew; 26883 param0 = PolicyGet(unit, policy_mem, policy_entry, 26884 Y_NEW_INT_CNf); 26885 append = 1; 26886 break; 26887 default: 26888 break; /* Do nothing */ 26889 } 26890 break; 26891 case R_CHANGE_INT_CNf: 26892 switch (fldval) { 26893 case 1: 26894 action = bcmFieldActionRpIntCongestionNotificationNew; 26895 param0 = PolicyGet(unit, policy_mem, policy_entry, 26896 R_NEW_INT_CNf); 26897 append = 1; 26898 break; 26899 default: 26900 break; /* Do nothing */ 26901 } 26902 break; 26903 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_APACHE_SUPPORT) 26904 case R_CHANGE_REDIR_INT_PRIf: 26905 if (fldval) { 26906 if (SOC_IS_KATANA2(unit)) { 26907 action = bcmFieldActionRpPrioIntNew; 26908 param0 = PolicyGet(unit, policy_mem, policy_entry, 26909 R_NEW_REDIR_INT_PRIf); 26910 append = 1; 26911 } else if (SOC_IS_APACHE(unit)) { 26912 action = bcmFieldActionRpRedirectPrioIntNew; 26913 param0 = PolicyGet(unit, policy_mem, policy_entry, 26914 R_NEW_REDIR_INT_PRIf); 26915 append = 1; 26916 } 26917 } 26918 break; 26919 case G_CHANGE_REDIR_INT_PRIf: 26920 if (fldval) { 26921 if (SOC_IS_KATANA2(unit)) { 26922 action = bcmFieldActionGpPrioIntNew; 26923 param0 = PolicyGet(unit, policy_mem, policy_entry, 26924 G_NEW_REDIR_INT_PRIf); 26925 append = 1; 26926 } else if (SOC_IS_APACHE(unit)) { 26927 action = bcmFieldActionGpRedirectPrioIntNew; 26928 param0 = PolicyGet(unit, policy_mem, policy_entry, 26929 G_NEW_REDIR_INT_PRIf); 26930 append = 1; 26931 } 26932 } 26933 break; 26934 case Y_CHANGE_REDIR_INT_PRIf: 26935 if (fldval) { 26936 if (SOC_IS_KATANA2(unit)) { 26937 action = bcmFieldActionYpPrioIntNew; 26938 param0 = PolicyGet(unit, policy_mem, policy_entry, 26939 Y_NEW_REDIR_INT_PRIf); 26940 append = 1; 26941 } else if (SOC_IS_APACHE(unit)) { 26942 action = bcmFieldActionYpRedirectPrioIntNew; 26943 param0 = PolicyGet(unit, policy_mem, policy_entry, 26944 Y_NEW_REDIR_INT_PRIf); 26945 append = 1; 26946 } 26947 } 26948 break; 26949 #endif /* BCM_KATANA2_SUPPORT || BCM_APACHE_SUPPORT */ 26950 #if defined(BCM_APACHE_SUPPORT) 26951 case NEW_CPU_COSf: 26952 if (fldval) { 26953 if (SOC_IS_APACHE(unit) && 26954 (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id)) { 26955 action = bcmFieldActionCosQCpuNew; 26956 param0 = fldval; 26957 append = 1; 26958 } 26959 } 26960 break; 26961 case REDIR_STRENGTHf: 26962 if (fldval) { 26963 if (SOC_IS_APACHE(unit)) { 26964 action = bcmFieldActionStrength; 26965 param0 = fldval; 26966 append = 1; 26967 } 26968 } 26969 break; 26970 case REDIR_RDB_PRIORITYf: 26971 if (fldval) { 26972 if (SOC_IS_APACHE(unit)) { 26973 action = bcmFieldActionRedirectBufferPriority; 26974 param0 = fldval; 26975 append = 1; 26976 } 26977 } 26978 break; 26979 case LOOPBACKf: 26980 if (fldval) { 26981 if (SOC_IS_APACHE(unit)) { 26982 append = 1; 26983 if (fldval == 0x1) { 26984 action = bcmFieldActionLoopbackOamResponse; 26985 } else if (fldval == 0x2) { 26986 action = bcmFieldActionLoopbackSatResponse; 26987 } else { 26988 append = 0; 26989 } 26990 } 26991 } 26992 break; 26993 case SESSION_ID_POOL_SELECTORf: 26994 if (SOC_IS_APACHE(unit) && 26995 f_ent_wb_info->action_StatObjSId_wb.valid) { 26996 f_ent_wb_info->action_StatObjSId_wb.valid = 0; 26997 append = 1; 26998 action = bcmFieldActionOamStatObjectSessionId; 26999 param0 = f_ent_wb_info->action_StatObjSId_wb.stat_object; 27000 } 27001 break; 27002 case COPY_TO_CPU_FIRST_CELL_ONLYf: 27003 if (fldval && f_ent_wb_info->action_copytocpu_wb.valid) { 27004 f_ent_wb_info->action_copytocpu_wb.params.flags |= 27005 BCM_FIELD_COPYTOCPU_TRUNCATE; 27006 } 27007 break; 27008 case REDIR_FIRST_CELL_ONLYf: 27009 if (fldval && f_ent_wb_info->action_redir_wb.valid) { 27010 f_ent_wb_info->action_redir_wb.params.flags |= 27011 BCM_FIELD_REDIRECT_TRUNCATE; 27012 } 27013 break; 27014 case REDIR_SOURCEf: 27015 if (fldval && f_ent_wb_info->action_redir_wb.valid) { 27016 uint32 redir = 0; 27017 if (fldval == 0x1) { 27018 f_ent_wb_info->action_redir_wb.params.flags |= 27019 BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_DESTINATION; 27020 } else if (fldval == 0x2) { 27021 f_ent_wb_info->action_redir_wb.params.flags |= 27022 BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_SOURCE; 27023 } else if (fldval == 0x3) { 27024 f_ent_wb_info->action_redir_wb.params.flags |= 27025 BCM_FIELD_REDIRECT_SOURCE_USE_CONFIGURED; 27026 redir = PolicyGet(unit, policy_mem, policy_entry,REDIR_SOURCE_VALUEf); 27027 switch(f_ent_wb_info->action_redir_wb.params.source_port) { 27028 case 1: 27029 BCM_GPORT_MPLS_PORT_ID_SET(f_ent_wb_info->action_redir_wb.params.source_port, 27030 redir); 27031 break; 27032 case 2: 27033 BCM_GPORT_NIV_PORT_ID_SET(f_ent_wb_info->action_redir_wb.params.source_port, 27034 redir); 27035 break; 27036 case 3: 27037 BCM_GPORT_MIM_PORT_ID_SET(f_ent_wb_info->action_redir_wb.params.source_port, 27038 redir); 27039 break; 27040 case 4: 27041 BCM_GPORT_TRILL_PORT_ID_SET(f_ent_wb_info->action_redir_wb.params.source_port, 27042 redir); 27043 break; 27044 case 5: 27045 BCM_GPORT_L2GRE_PORT_ID_SET(f_ent_wb_info->action_redir_wb.params.source_port, 27046 redir); 27047 break; 27048 case 6: 27049 BCM_GPORT_VXLAN_PORT_ID_SET(f_ent_wb_info->action_redir_wb.params.source_port, 27050 redir); 27051 break; 27052 default: 27053 BCM_GPORT_MODPORT_SET(f_ent_wb_info->action_redir_wb.params.source_port, 27054 ((redir >> 8) & 0xff), (redir & 0xff)); 27055 break; 27056 } 27057 } 27058 } 27059 break; 27060 case G_REDIRECTf: 27061 if (fldval && f_ent_wb_info->action_redir_wb.valid) { 27062 if (fldval == 0x1) { 27063 f_ent_wb_info->action_redir_wb.params.flags |= 27064 BCM_FIELD_REDIRECT_GREEN_NOT_DROPPED_PACKET; 27065 } else if (fldval == 0x2) { 27066 f_ent_wb_info->action_redir_wb.params.flags |= 27067 BCM_FIELD_REDIRECT_GREEN_DROPPED_PACKET; 27068 } else if (fldval == 0x3) { 27069 f_ent_wb_info->action_redir_wb.params.flags |= 27070 BCM_FIELD_REDIRECT_GREEN_PACKET; 27071 } 27072 } 27073 break; 27074 case Y_REDIRECTf: 27075 if (fldval && f_ent_wb_info->action_redir_wb.valid) { 27076 if (fldval == 0x1) { 27077 f_ent_wb_info->action_redir_wb.params.flags |= 27078 BCM_FIELD_REDIRECT_YELLOW_NOT_DROPPED_PACKET; 27079 } else if (fldval == 0x2) { 27080 f_ent_wb_info->action_redir_wb.params.flags |= 27081 BCM_FIELD_REDIRECT_YELLOW_DROPPED_PACKET; 27082 } else if (fldval == 0x3) { 27083 f_ent_wb_info->action_redir_wb.params.flags |= 27084 BCM_FIELD_REDIRECT_YELLOW_PACKET; 27085 } 27086 } 27087 break; 27088 case R_REDIRECTf: 27089 if (fldval && f_ent_wb_info->action_redir_wb.valid) { 27090 if (fldval == 0x1) { 27091 f_ent_wb_info->action_redir_wb.params.flags |= 27092 BCM_FIELD_REDIRECT_RED_NOT_DROPPED_PACKET; 27093 } else if (fldval == 0x2) { 27094 f_ent_wb_info->action_redir_wb.params.flags |= 27095 BCM_FIELD_REDIRECT_RED_DROPPED_PACKET; 27096 } else if (fldval == 0x3) { 27097 f_ent_wb_info->action_redir_wb.params.flags |= 27098 BCM_FIELD_REDIRECT_RED_PACKET; 27099 } 27100 } 27101 break; 27102 case REDIRECTION_DEST_TYPEf: 27103 if (fldval) { 27104 uint32 redir = 0; 27105 redir = PolicyGet(unit, 27106 policy_mem, 27107 policy_entry, 27108 REDIRECTION_DESTINATIONf 27109 ); 27110 switch(fldval) { 27111 case 0x4: 27112 mirror_pbm = redir; 27113 for (bit_pos = 1, mtp_index = 0; 27114 mtp_index < BCM_MIRROR_MTP_COUNT; 27115 ++mtp_index, bit_pos <<= 1) { 27116 if (!(mirror_pbm & bit_pos)) { 27117 /* Slot not in use => Skip */ 27118 continue; 27119 } 27120 /* Translate hw index into (module_num, port_num) */ 27121 _bcm_esw_mirror_mtp_to_modport(unit, mtp_index, 27122 TRUE, BCM_MIRROR_PORT_EGRESS_TRUE, &modid, 27123 &gport); 27124 rv = _field_trx_actions_recover_action_add(unit, 27125 f_ent, bcmFieldActionMirrorEgress, 0, 27126 gport, 0, 0, 0, 0, mtp_index); 27127 if (BCM_FAILURE(rv)) { 27128 return rv; 27129 } 27130 } 27131 break; 27132 case 0x5: 27133 param0 = (redir >> 8) & 0xff; 27134 param1 = redir & 0xff; 27135 if (f_ent_wb_info->action_redir_wb.valid) { 27136 f_ent_wb_info->action_redir_wb.params.destination_type = 27137 bcmFieldRedirectDestinationPort; 27138 BCM_GPORT_MODPORT_SET( 27139 f_ent_wb_info->action_redir_wb.params.destination, 27140 param0, param1); 27141 } else { 27142 action = bcmFieldActionRedirect; 27143 append = 1; 27144 } 27145 break; 27146 case 0x6: 27147 param0 = redir & 0x1ff; 27148 if (f_ent_wb_info->action_redir_wb.valid) { 27149 f_ent_wb_info->action_redir_wb.params.destination_type = 27150 bcmFieldRedirectDestinationTrunk; 27151 if (f_ent_wb_info->action_redir_wb.valid == 0x1) { 27152 BCM_GPORT_TRUNK_SET( 27153 f_ent_wb_info->action_redir_wb.params.destination, 27154 param0); 27155 } else { 27156 f_ent_wb_info->action_redir_wb.params.destination = param0; 27157 } 27158 } else { 27159 action = bcmFieldActionRedirectTrunk; 27160 append = 1; 27161 } 27162 break; 27163 case 0x7: 27164 if (f_ent_wb_info->action_redir_wb.valid) { 27165 f_ent_wb_info->action_redir_wb.params.destination_type = 27166 bcmFieldRedirectDestinationMCast; 27167 _BCM_MULTICAST_GROUP_SET( 27168 f_ent_wb_info->action_redir_wb.params.destination, 27169 _BCM_MULTICAST_TYPE_L2, 27170 redir & 0xfff); 27171 } else { 27172 action = bcmFieldActionRedirectMcast; 27173 if (soc_feature(unit, 27174 soc_feature_field_action_redirect_ipmc)) { 27175 param0 = redir & 0xfff; 27176 } else { 27177 hw_index = redir & 0xfff; 27178 } 27179 append = 1; 27180 } 27181 break; 27182 default : 27183 break; 27184 } 27185 } 27186 break; 27187 #endif /* BCM_APACHE_SUPPORT */ 27188 #if !defined(BCM_GREYHOUND_SUPPORT) && !defined(BCM_TOMAHAWK_SUPPORT) 27189 case G_HG_CONGESTION_CLASS_CHANGEf: 27190 switch (fldval) { 27191 case 1: 27192 action = bcmFieldActionGpHGCongestionClassNew; 27193 param0 = PolicyGet(unit, policy_mem, policy_entry, 27194 G_HG_CONGESTION_CLASS_NEWf); 27195 append = 1; 27196 break; 27197 default: 27198 break; /* Do nothing */ 27199 } 27200 break; 27201 case Y_HG_CONGESTION_CLASS_CHANGEf: 27202 switch (fldval) { 27203 case 1: 27204 action = bcmFieldActionYpHGCongestionClassNew; 27205 param0 = PolicyGet(unit, policy_mem, policy_entry, 27206 Y_HG_CONGESTION_CLASS_NEWf); 27207 append = 1; 27208 break; 27209 default: 27210 break; /* Do nothing */ 27211 } 27212 break; 27213 case R_HG_CONGESTION_CLASS_CHANGEf: 27214 switch (fldval) { 27215 case 1: 27216 action = bcmFieldActionRpHGCongestionClassNew; 27217 param0 = PolicyGet(unit, policy_mem, policy_entry, 27218 R_HG_CONGESTION_CLASS_NEWf); 27219 append = 1; 27220 break; 27221 default: 27222 break; /* Do nothing */ 27223 } 27224 break; 27225 #endif 27226 #if defined BCM_TRIDENT2PLUS_SUPPORT 27227 case LM_COUNTER_POOL_ACTION_Af: 27228 /* NAT_OAM_ACTION_SELECTf = _bcmFieldNatOamValidOam 27229 * for Trident2Plus */ 27230 if (SOC_MEM_FIELD_VALID(unit, policy_mem, NAT_OAM_ACTION_SELECTf)) { 27231 /* When NAT_OAM_ACTION_SELECTf is valid, automatically 27232 * LM_COUNTER fields are also valid*/ 27233 if(PolicyGet(unit, policy_mem, policy_entry, 27234 NAT_OAM_ACTION_SELECTf) != _bcmFieldNatOamValidOam) { 27235 break; 27236 } 27237 } 27238 if ((fldval == 0) && 27239 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 27240 break; 27241 } 27242 27243 oam_action[0].flex_pool_id = PolicyGet(unit, policy_mem, 27244 policy_entry, LM_COUNTER_POOL_ID_Af); 27245 oam_action[0].action = PolicyGet(unit, policy_mem, 27246 policy_entry, LM_COUNTER_POOL_ACTION_Af); 27247 break; 27248 case LM_COUNTER_POOL_ACTION_Bf: 27249 /* NAT_OAM_ACTION_SELECTf = _bcmFieldNatOamValidOam 27250 * for Trident2Plus */ 27251 if (SOC_MEM_FIELD_VALID(unit, policy_mem, NAT_OAM_ACTION_SELECTf)) { 27252 /* When NAT_OAM_ACTION_SELECTf is valid, automatically 27253 * LM_COUNTER fields are also valid*/ 27254 if(PolicyGet(unit, policy_mem, policy_entry, 27255 NAT_OAM_ACTION_SELECTf) != _bcmFieldNatOamValidOam) { 27256 break; 27257 } 27258 } 27259 if ((fldval == 0) && 27260 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 27261 break; 27262 } 27263 27264 oam_action[1].flex_pool_id = PolicyGet(unit, policy_mem, 27265 policy_entry, LM_COUNTER_POOL_ID_Bf); 27266 oam_action[1].action = PolicyGet(unit, policy_mem, 27267 policy_entry, LM_COUNTER_POOL_ACTION_Bf); 27268 break; 27269 case LM_COUNTER_POOL_ACTION_Cf: 27270 /* NAT_OAM_ACTION_SELECTf = _bcmFieldNatOamValidOam 27271 * for Trident2Plus */ 27272 if (SOC_MEM_FIELD_VALID(unit, policy_mem, NAT_OAM_ACTION_SELECTf)) { 27273 /* When NAT_OAM_ACTION_SELECTf is valid, automatically 27274 * LM_COUNTER fields are also valid*/ 27275 if(PolicyGet(unit, policy_mem, policy_entry, 27276 NAT_OAM_ACTION_SELECTf) != _bcmFieldNatOamValidOam) { 27277 break; 27278 } 27279 } 27280 if ((fldval == 0) && 27281 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 27282 break; 27283 } 27284 27285 oam_action[2].flex_pool_id = PolicyGet(unit, policy_mem, 27286 policy_entry, LM_COUNTER_POOL_ID_Cf); 27287 oam_action[2].action = PolicyGet(unit, policy_mem, 27288 policy_entry, LM_COUNTER_POOL_ACTION_Cf); 27289 break; 27290 #endif 27291 case INSTRUMENTATION_TRIGGERS_ENABLEf: 27292 if (fldval) { 27293 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_LOOKUP) { 27294 action = bcmFieldActionPacketTraceEnable; 27295 append = 1; 27296 } else { 27297 action = bcmFieldActionEgressPbmpNullCopyToCpu; 27298 param0 = PolicyGet(unit, policy_mem, policy_entry, 27299 INSTRUMENTATION_TRIGGERS_ENABLEf); 27300 append = 1; 27301 } 27302 } 27303 break; 27304 case PIM_BIDIR_FORWARDf: 27305 if (fldval) { 27306 action = bcmFieldActionPimBidirFwd; 27307 append = 1; 27308 } 27309 break; 27310 case TRUST_DSCPf: 27311 #if defined BCM_TRIUMPH2_SUPPORT 27312 if (fldval) { 27313 if ((SOC_IS_KATANA2(unit)) || 27314 ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) || 27315 (soc_feature(unit, soc_feature_vxlan_lite_riot))) { 27316 if (SOC_MEM_FIELD_VALID(unit, policy_mem, TRUST_DSCP_PTRf)) { 27317 action = bcmFieldActionDscpMapNew; 27318 hw_index = PolicyGet(unit, policy_mem, 27319 policy_entry, TRUST_DSCP_PTRf); 27320 param0 = hw_index; 27321 append = 1; 27322 27323 /* Allocate memory for dscp_map_new_eid_list */ 27324 _FP_XGS3_ALLOC (dscp_map_new_eid_node, 27325 sizeof (_field_dscp_map_new_eid_list_t), 27326 "dscp_map_new_eid_node"); 27327 if (NULL == dscp_map_new_eid_node) { 27328 return BCM_E_MEMORY; 27329 } 27330 27331 /* fill the node and add to the eid_list. 27332 * list will be free in _bcm_notify_qos_reinit_to_fp 27333 * function*/ 27334 dscp_map_new_eid_node->eid = f_ent->eid; 27335 dscp_map_new_eid_node->next = NULL; 27336 27337 if ( dscp_map_new_eid_list[unit] != NULL) { 27338 dscp_map_new_eid_node->next = dscp_map_new_eid_list[unit]; 27339 } 27340 dscp_map_new_eid_list[unit] = dscp_map_new_eid_node; 27341 } 27342 } 27343 } 27344 #endif 27345 break; 27346 #if defined (BCM_HURRICANE3_SUPPORT) 27347 case PFC_TRIGGERf: 27348 if (fldval) { 27349 action = bcmFieldActionPfcTx; 27350 param0 = PolicyGet(unit, policy_mem, policy_entry, 27351 PFC_STREAM_IDf); 27352 param1 = PolicyGet(unit, policy_mem, policy_entry, 27353 PFC_TCf); 27354 append = 1; 27355 break; 27356 } 27357 break; 27358 case ASSIGN_HEADER_ENCAP_FIELDSf: 27359 if (fldval) { 27360 if (!PolicyGet(unit, policy_mem, policy_entry, G_PACKET_REDIRECTIONf)) { 27361 /* Custom Header Switch Encap */ 27362 action = bcmFieldActionSwitchEncap; 27363 param0 = PolicyGet(unit, policy_mem, policy_entry, 27364 HEADER_ENCAP_INDEXf); 27365 param0 |= (_BCM_SWITCH_ENCAP_TYPE_CUSTOM_HEADER << 27366 _BCM_SWITCH_ENCAP_SHIFT); 27367 append = 1; 27368 break; 27369 } 27370 } 27371 break; 27372 #endif /* BCM_HURRICANE3_SUPPORT */ 27373 27374 #if defined (BCM_METROLITE_SUPPORT) 27375 case DA_SA_SWAPf: 27376 if (fldval) { 27377 action = bcmFieldActionSwapMacDaSa; 27378 append = 1; 27379 } 27380 break; 27381 case SIP_DIP_SWAPf: 27382 if (fldval) { 27383 action = bcmFieldActionSwapSourceIPDestIP; 27384 append = 1; 27385 } 27386 break; 27387 case REPLACE_TTLf: 27388 if (fldval) { 27389 action = bcmFieldActionReplaceTtl; 27390 append = 1; 27391 } 27392 break; 27393 case L3SATf: 27394 if (fldval) { 27395 action = bcmFieldActionPacketIsL3SAT; 27396 append = 1; 27397 } 27398 break; 27399 #endif /* (BCM_METROLITE_SUPPORT) */ 27400 27401 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC) 27402 case MACSEC_ENCRYPTf: 27403 if (fldval) { 27404 action = bcmFieldActionMacSecEncrypt; 27405 append = 1; 27406 } 27407 break; 27408 27409 case MACSEC_DECRYPTf: 27410 if (fldval) { 27411 action = bcmFieldActionMacSecDecrypt; 27412 append = 1; 27413 } 27414 break; 27415 27416 case PACKET_TYPEf: 27417 if (fldval) { 27418 action = bcmFieldActionMacSecPktTypeSet; 27419 param0 = fldval; 27420 append = 1; 27421 } 27422 break; 27423 case MACSEC_SUBPORT_NUMf: 27424 if (SOC_IS_MONTEREY(unit) && (action_sync == 1) && 27425 (SHR_BITGET(f_ent_wb_info->action_bmp->w, 27426 _bcmFieldActionNoParamMacSecSubPortEncrypt) || 27427 SHR_BITGET(f_ent_wb_info->action_bmp->w, 27428 _bcmFieldActionNoParamMacSecSubPortDecrypt))) { 27429 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, 27430 _bcmFieldActionNoParamMacSecSubPortEncrypt)) { 27431 param0 = BCM_XFLOW_MACSEC_SUBPORT_ID_CREATE(BCM_XFLOW_MACSEC_ENCRYPT, fldval); 27432 } else { 27433 param0 = BCM_XFLOW_MACSEC_SUBPORT_ID_CREATE(BCM_XFLOW_MACSEC_DECRYPT, fldval); 27434 } 27435 action = bcmFieldActionMacSecSubPortNumAdd; 27436 append = 1; 27437 } 27438 break; 27439 #endif 27440 27441 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT) 27442 case DO_NOT_CUT_THROUGHf: 27443 if (fldval) { 27444 action = bcmFieldActionDoNotCutThrough; 27445 append = 1; 27446 } 27447 break; 27448 #endif /* BCM_TRIDENT2_SUPPORT || BCM_GREYHOUND2_SUPPORT */ 27449 27450 #if defined(BCM_GREYHOUND2_SUPPORT) 27451 case VXLAN_DECAPf: 27452 if (fldval) { 27453 if (soc_feature(unit, soc_feature_vxlan_lite)) { 27454 action = bcmFieldActionVxlanTerminate; 27455 append = 1; 27456 } 27457 } 27458 break; 27459 case IP_TUNNEL_TERMINATIONf: 27460 if (fldval) { 27461 if (soc_feature(unit, soc_feature_vxlan_lite)) { 27462 param0 = PolicyGet(unit, policy_mem, policy_entry, 27463 IP_TUNNEL_TERMINATIONf); 27464 action = bcmFieldActionUseTunnelPayload; 27465 append = 1; 27466 } 27467 } 27468 break; 27469 #endif /* BCM_GREYHOUND2_SUPPORT */ 27470 case CHANGE_EXPf: 27471 append = 0; 27472 if (fldval) { 27473 action = bcmFieldActionMplsLabel1ExpNew; 27474 param0 = PolicyGet(unit, policy_mem, policy_entry, EXPf); 27475 append = 1; 27476 } 27477 break; 27478 #if defined(BCM_TSN_SR_SUPPORT) 27479 case DROP_SR_FRAMEf: 27480 if (fldval) { 27481 if (soc_feature(unit, soc_feature_tsn_sr)) { 27482 if (0x1 == fldval) { 27483 action = bcmFieldActionSRDuplicateDrop; 27484 append = 1; 27485 } else if (0x2 == fldval) { 27486 action = bcmFieldActionSRDuplicateDropCancel; 27487 append = 1; 27488 } 27489 } 27490 } 27491 break; 27492 case APPLY_NETID_FILTERINGf: 27493 if (fldval) { 27494 if (soc_feature(unit, soc_feature_tsn_sr)) { 27495 action = bcmFieldActionSRNetIdFilter; 27496 append = 1; 27497 } 27498 } 27499 break; 27500 case PKT_NET_ID_SOURCEf: 27501 if (soc_feature(unit, soc_feature_tsn_sr)) { 27502 /* action_sync == 1 : it means that scache exist */ 27503 if ((action_sync == 1) && 27504 SHR_BITGET(f_ent_wb_info->action_bmp->w, 27505 _bcmFieldActionNoParamSRNetIdSource)) { 27506 action = bcmFieldActionSRNetIdSource; 27507 param0 = fldval; 27508 append = 1; 27509 } 27510 } 27511 break; 27512 case APPLY_PROXY_MAC_FILTERINGf: 27513 if (fldval) { 27514 if (soc_feature(unit, soc_feature_tsn_sr)) { 27515 action = bcmFieldActionFilterSrcMacPorts; 27516 append = 1; 27517 } 27518 } 27519 break; 27520 case SR_COPY_TO_CPUf: 27521 if (fldval) { 27522 if (soc_feature(unit, soc_feature_tsn_sr)) { 27523 if (0x1 == fldval) { 27524 param0 = BCM_FIELD_SR_COPYTOCPU_ANY; 27525 } else if (0x2 == fldval) { 27526 param0 = BCM_FIELD_SR_COPYTOCPU_NON_DUPLICATE; 27527 } 27528 action = bcmFieldActionSRCopyToCpu; 27529 param1 = PolicyGet(unit, policy_mem, policy_entry, 27530 CPU_OPCODEf); 27531 append = 1; 27532 } 27533 } 27534 break; 27535 case SR_TAG_ADDf: 27536 if (fldval) { 27537 if (soc_feature(unit, soc_feature_tsn_sr)) { 27538 action = bcmFieldActionSRTagAdd; 27539 if (4 == fldval) { 27540 param0 = BCM_FIELD_SR_TAG_TYPE_RESERVED; 27541 append = 1; 27542 } else if (1 == fldval) { 27543 param0 = BCM_FIELD_SR_TAG_TYPE_HSR; 27544 append = 1; 27545 } else if (2 == fldval) { 27546 param0 = BCM_FIELD_SR_TAG_TYPE_PRP; 27547 append = 1; 27548 } else if (3 == fldval) { 27549 param0 = BCM_FIELD_SR_TAG_TYPE_DOT1CB; 27550 append = 1; 27551 } 27552 } 27553 } 27554 break; 27555 case SR_TAG_REMOVEf: 27556 if (fldval) { 27557 if (soc_feature(unit, soc_feature_tsn_sr)) { 27558 action = bcmFieldActionSRTagDelete; 27559 if (2 == fldval) { 27560 param0 = BCM_FIELD_SR_TAG_TYPE_RESERVED; 27561 append = 1; 27562 } else if (1 == fldval) { 27563 param0 = BCM_FIELD_SR_TAG_TYPE_HSR; 27564 append = 1; 27565 } else if (4 == fldval) { 27566 param0 = BCM_FIELD_SR_TAG_TYPE_PRP; 27567 append = 1; 27568 } else if (3 == fldval) { 27569 param0 = BCM_FIELD_SR_TAG_TYPE_DOT1CB; 27570 append = 1; 27571 } 27572 } 27573 } 27574 break; 27575 case PKT_LAN_IDf: 27576 if (soc_feature(unit, soc_feature_tsn_sr)) { 27577 if (PolicyGet(unit, policy_mem, policy_entry, PKT_LAN_ID_VALIDf)) { 27578 action = bcmFieldActionSRLanIdNew; 27579 param0 = fldval; 27580 append = 1; 27581 } 27582 } 27583 break; 27584 case NEW_LAN_IDf: 27585 if (soc_feature(unit, soc_feature_tsn_sr)) { 27586 if (PolicyGet(unit, policy_mem, policy_entry, NEW_LAN_ID_VALIDf)) { 27587 action = bcmFieldActionSRLanIdNew; 27588 param0 = fldval; 27589 append = 1; 27590 } 27591 } 27592 break; 27593 case PKT_NET_IDf: 27594 if (soc_feature(unit, soc_feature_tsn_sr)) { 27595 if (PolicyGet(unit, policy_mem, policy_entry, PKT_NET_ID_VALIDf)) { 27596 action = bcmFieldActionSRNetIdNew; 27597 param0 = fldval; 27598 append = 1; 27599 } 27600 } 27601 break; 27602 case NEW_NET_IDf: 27603 if (soc_feature(unit, soc_feature_tsn_sr)) { 27604 if (PolicyGet(unit, policy_mem, policy_entry, NEW_NET_ID_VALIDf)) { 27605 action = bcmFieldActionSRNetIdNew; 27606 param0 = fldval; 27607 append = 1; 27608 } 27609 } 27610 break; 27611 case SR_FLOW_IDf: 27612 if (fldval) { 27613 if (soc_feature(unit, soc_feature_tsn_sr)) { 27614 action = bcmFieldActionSRFlowIdNew; 27615 append = 1; 27616 BCM_IF_ERROR_RETURN( 27617 bcmi_esw_tsn_sr_sw_flow_id_get( 27618 unit, fldval, (bcm_tsn_sr_flow_t *)¶m0)); 27619 } 27620 } 27621 break; 27622 case SR_PRI_OFFSET_PROFILEf: 27623 if (fldval) { 27624 if (soc_feature(unit, soc_feature_tsn_sr)) { 27625 action = bcmFieldActionSRFlowPriMapIdNew; 27626 append = 1; 27627 BCM_IF_ERROR_RETURN( 27628 bcmi_esw_tsn_pri_map_map_id_get( 27629 unit, bcmTsnPriMapTypeSrFlow, 27630 fldval, (bcm_tsn_pri_map_t *)¶m0)); 27631 } 27632 } 27633 break; 27634 #endif /* BCM_TSN_SR_SUPPORT */ 27635 #if defined(BCM_TSN_SUPPORT) 27636 case MTU_SIZEf: 27637 if (fldval) { 27638 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 27639 action = bcmFieldActionMtuSize; 27640 param0 = fldval; 27641 append = 1; 27642 } 27643 } 27644 break; 27645 case STU_SIZEf: 27646 if (fldval) { 27647 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 27648 action = bcmFieldActionStuSize; 27649 param0 = fldval; 27650 append = 1; 27651 } 27652 } 27653 break; 27654 case MTU_PROFILE_INDEXf: 27655 if (fldval) { 27656 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 27657 action = bcmFieldActionMtuProfileIdNew; 27658 append = 1; 27659 BCM_IF_ERROR_RETURN( 27660 bcmi_esw_tsn_mtu_sw_profile_id_get( 27661 unit, bcmTsnMtuProfileTypeIngress, 27662 fldval, (int*)(¶m0))); 27663 } 27664 } 27665 break; 27666 case STU_PROFILE_INDEXf: 27667 if (fldval) { 27668 if (soc_feature(unit, soc_feature_tsn_mtu_stu)) { 27669 action = bcmFieldActionStuProfileIdNew; 27670 append = 1; 27671 BCM_IF_ERROR_RETURN( 27672 bcmi_esw_tsn_stu_sw_profile_id_get( 27673 unit, bcmTsnStuProfileTypeIngress, 27674 fldval, (int*)(¶m0))); 27675 } 27676 } 27677 break; 27678 case TSN_CIRCUIT_IDf: 27679 if (fldval) { 27680 if (soc_feature(unit, soc_feature_tsn)) { 27681 action = bcmFieldActionTsnFlowIdNew; 27682 append = 1; 27683 BCM_IF_ERROR_RETURN( 27684 bcmi_esw_tsn_sw_flow_id_get( 27685 unit, fldval, (bcm_tsn_flow_t *)¶m0)); 27686 } 27687 } 27688 break; 27689 case TSN_PRI_OFFSET_PROFILEf: 27690 if (fldval) { 27691 if (soc_feature(unit, soc_feature_tsn)) { 27692 action = bcmFieldActionTsnFlowPriMapIdNew; 27693 append = 1; 27694 BCM_IF_ERROR_RETURN( 27695 bcmi_esw_tsn_pri_map_map_id_get( 27696 unit, bcmTsnPriMapTypeTsnFlow, 27697 fldval, (bcm_tsn_pri_map_t *)¶m0)); 27698 } 27699 } 27700 break; 27701 case TAF_GATE_ID_PROFILEf: 27702 if (fldval) { 27703 if (soc_feature(unit, soc_feature_tsn_taf)) { 27704 action = bcmFieldActionTafGatePriMap; 27705 append = 1; 27706 BCM_IF_ERROR_RETURN( 27707 bcmi_esw_tsn_pri_map_map_id_get( 27708 unit, bcmTsnPriMapTypeTafGate, 27709 fldval, (bcm_tsn_pri_map_t *)¶m0)); 27710 } 27711 } 27712 break; 27713 #endif /* BCM_TSN_SUPPORT */ 27714 27715 #if defined(BCM_TRIDENT3_SUPPORT) 27716 case TAG_ACTION_PROFILE_PTRf: 27717 if (fldval) { 27718 bcm_vlan_action_set_t *actions = NULL; 27719 if (actions == NULL) { 27720 _FP_XGS3_ALLOC(actions, sizeof(bcm_vlan_action_set_t), 27721 "FP Entry WB VLAN Action set"); 27722 if (actions == NULL) { 27723 return BCM_E_MEMORY; 27724 } 27725 } 27726 27727 _bcm_trx_vlan_action_profile_entry_increment(unit, fldval); 27728 rv = _bcm_field_td3_vlan_action_profile_entry_get(unit, policy_mem, 27729 policy_entry, fldval, actions); 27730 BCM_IF_ERROR_RETURN(rv); 27731 27732 f_ent->vlan_action_set = actions; 27733 27734 action = bcmFieldActionVlanActions; 27735 hw_index = fldval; 27736 append = 1; 27737 } 27738 break; 27739 #endif /* BCM_TRIDENT3_SUPPORT */ 27740 #if defined (BCM_TOMAHAWK3_SUPPORT) 27741 case RESET_MPLS_ENABLEf: 27742 if (fldval) { 27743 action = bcmFieldActionMplsLookupEnable; 27744 param0 = PolicyGet(unit, policy_mem, policy_entry, 27745 MPLS_ENABLEf); 27746 if (param0 == 0) { 27747 param0 = BCM_FIELD_MPLS_DISABLE; 27748 } 27749 append = 1; 27750 } 27751 break; 27752 case RESET_MY_STATION_LOOKUP_RESULTf: 27753 if (fldval) { 27754 action = bcmFieldActionTerminationAllowed; 27755 param0 = 0; 27756 param1 = PolicyGet(unit, policy_mem, policy_entry, 27757 MPLS_TERMINATION_ALLOWEDf); 27758 if (param1 == 1) { 27759 param0 |= BCM_FIELD_MPLS_TERM_ALLOWED; 27760 } 27761 param1 = PolicyGet(unit, policy_mem, policy_entry, 27762 IPV4_TERMINATION_ALLOWEDf); 27763 if (param1 == 1) { 27764 param0 |= BCM_FIELD_IPV4_TERM_ALLOWED; 27765 } 27766 param1 = PolicyGet(unit, policy_mem, policy_entry, 27767 IPV6_TERMINATION_ALLOWEDf); 27768 if (param1 == 1) { 27769 param0 |= BCM_FIELD_IPV6_TERM_ALLOWED; 27770 } 27771 param1 = PolicyGet(unit, policy_mem, policy_entry, 27772 IPV4_MULTICAST_TERMINATION_ALLOWEDf); 27773 if (param1 == 1) { 27774 param0 |= BCM_FIELD_IPV4_MCAST_TERM_ALLOWED; 27775 } 27776 param1 = PolicyGet(unit, policy_mem, policy_entry, 27777 IPV6_MULTICAST_TERMINATION_ALLOWEDf); 27778 if (param1 == 1) { 27779 param0 |= BCM_FIELD_IPV6_MCAST_TERM_ALLOWED; 27780 } 27781 27782 param1 = PolicyGet(unit, policy_mem, policy_entry, 27783 ARP_RARP_TERMINATION_ALLOWEDf); 27784 if (param1 == 1) { 27785 param0 |= BCM_FIELD_ARP_RARP_TERM_ALLOWED; 27786 } 27787 param1 = 0; 27788 append = 1; 27789 } 27790 break; 27791 27792 #endif 27793 #if defined(BCM_MONTEREY_SUPPORT) 27794 case ROE_TYPEf: 27795 if (fldval) { 27796 if (fldval == 1) { 27797 param0 = bcmFieldRoeFrameTypeCustom; 27798 } else if (fldval == 2) { 27799 param0 = bcmFieldRoeFrameTypeRoe; 27800 } else if (fldval == 3) { 27801 param0 = bcmFieldRoeFrameTypeNone; 27802 } else { 27803 return BCM_E_INTERNAL; 27804 } 27805 action = bcmFieldActionRoeFrameTypeSet; 27806 append = 1; 27807 } 27808 break; 27809 #endif /* BCM_MONTEREY_SUPPORT */ 27810 case LAT_MON_ENf: 27811 if (fldval) { 27812 param0 = fldval; 27813 action = bcmFieldActionLatencyMonitorEnable; 27814 append = 1; 27815 } 27816 break; 27817 case LAT_MON_DISf: 27818 if (fldval) { 27819 param0 = fldval; 27820 action = bcmFieldActionLatencyMonitorDisable; 27821 append = 1; 27822 } 27823 break; 27824 #if defined(BCM_MAVERICK2_SUPPORT) 27825 #if defined(INCLUDE_FLOWTRACKER) 27826 case FLOW_GROUP_IDf: 27827 if (fldval) { 27828 if (soc_feature(unit, soc_feature_mv2_style_flowtracker)) { 27829 action = bcmFieldActionFlowtrackerGroupId; 27830 param0 = fldval; 27831 append = 1; 27832 } 27833 } 27834 break; 27835 #endif /* INCLUDE_FLOWTRACKER */ 27836 #endif /* BCM_MAVERICK2_SUPPORT */ 27837 #if defined (BCM_TOMAHAWK3_SUPPORT) 27838 case VISIBILITY_PACKETf: 27839 if (fldval) { 27840 action = bcmFieldActionVisibilityEnable; 27841 append = 1; 27842 } 27843 break; 27844 #endif 27845 #if defined (BCM_TRIDENT3_SUPPORT) 27846 case OPAQUE_OBJECTf: 27847 if (!fldval) { 27848 break; 27849 } 27850 /* Lower 3 bits holds type of Opaque and upper 16 holds value of Opaque */ 27851 switch (fldval & 0x7) { 27852 case 1: 27853 action = bcmFieldActionAssignOpaqueObject1; 27854 break; 27855 case 2: 27856 action = bcmFieldActionAssignOpaqueObject2; 27857 break; 27858 case 3: 27859 action = bcmFieldActionAssignOpaqueObject3; 27860 break; 27861 case 4: 27862 action = bcmFieldActionAssignOpaqueObject4; 27863 break; 27864 default: 27865 return BCM_E_INTERNAL; 27866 } 27867 param0 = fldval >> 3; 27868 append = 1; 27869 break; 27870 case EXTRACTION_CTRL_ID_ACTIONf: 27871 if (fldval) { 27872 action = bcmFieldActionAssignExtractionCtrlId; 27873 param0 = fldval & 0xff; 27874 param1 = fldval >> 8; 27875 append = 1; 27876 } 27877 break; 27878 #endif 27879 #if defined (BCM_HELIX5_SUPPORT) 27880 case WIRED_WIRELESSf: 27881 if (fldval) { 27882 switch (fldval) { 27883 case 0x1 : 27884 param0 = bcmFieldCosMapSelectWired; 27885 break; 27886 case 0x2 : 27887 param0 = bcmFieldCosMapSelectWireless; 27888 break; 27889 default: 27890 return BCM_E_INTERNAL; 27891 } 27892 action = bcmFieldActionCosMapSelect; 27893 append = 1; 27894 } 27895 break; 27896 #endif 27897 default: 27898 break; /* Do nothing */ 27899 } 27900 27901 27902 if (append) { 27903 rv = _field_trx_actions_recover_action_add(unit, 27904 f_ent, 27905 action, 27906 param0, 27907 param1, 27908 param2, 27909 param3, 27910 param4, 27911 param5, 27912 hw_index 27913 ); 27914 if (BCM_FAILURE(rv)) { 27915 #if defined(BCM_TRIDENT3_SUPPORT) 27916 if (fld == TAG_ACTION_PROFILE_PTRf) { 27917 if ((f_ent != NULL) && 27918 (f_ent->vlan_action_set != NULL)) { 27919 sal_free(f_ent->vlan_action_set); 27920 f_ent->vlan_action_set = NULL; 27921 } 27922 } 27923 #endif 27924 return rv; 27925 } 27926 } 27927 } 27928 #if defined BCM_TRIDENT2PLUS_SUPPORT 27929 if (soc_feature(unit, soc_feature_fp_based_oam) && 27930 ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) || 27931 (SOC_IS_APACHE(unit) && 27932 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)))) { 27933 rv = _field_oam_stat_action_wb_add (unit, f_ent, oam_action); 27934 if (BCM_FAILURE(rv)) { 27935 return rv; 27936 } 27937 } 27938 #endif /* BCM_TRIDENT2PLUS_SUPPORT */ 27939 #if defined BCM_APACHE_SUPPORT 27940 rv = _field_apache_actions_recovery(unit, policy_mem, policy_entry, 27941 f_ent, f_ent_wb_info); 27942 if (BCM_FAILURE(rv)) { 27943 return rv; 27944 } 27945 #endif /* BCM_APACHE_SUPPORT */ 27946 27947 return BCM_E_NONE; 27948 } 27949 27950 STATIC int 27951 _field_src_dst_entity_compare(_bcm_field_fwd_entity_sel_t entity1, 27952 _bcm_field_fwd_entity_sel_t entity2) 27953 { 27954 switch (entity1) { 27955 case _bcmFieldFwdEntityMplsGport: 27956 case _bcmFieldFwdEntityNivGport: 27957 case _bcmFieldFwdEntityCommonGport: /* For DstGport */ 27958 case _bcmFieldFwdEntityMimGport: 27959 case _bcmFieldFwdEntityWlanGport: 27960 case _bcmFieldFwdEntityVxlanGport: 27961 case _bcmFieldFwdEntityVlanGport: 27962 if ((entity2 == _bcmFieldFwdEntityMplsGport) || 27963 (entity2 == _bcmFieldFwdEntityNivGport) || 27964 (entity2 == _bcmFieldFwdEntityCommonGport) || 27965 (entity2 == _bcmFieldFwdEntityMimGport) || 27966 (entity2 == _bcmFieldFwdEntityWlanGport) || 27967 (entity2 == _bcmFieldFwdEntityVlanGport) || 27968 (entity2 == _bcmFieldFwdEntityVxlanGport)) { 27969 return TRUE; 27970 } else { 27971 return FALSE; 27972 } 27973 break; 27974 default: 27975 if (entity1 != entity2) { 27976 return FALSE; 27977 } 27978 break; 27979 } 27980 return TRUE; 27981 } 27982 27983 27984 int 27985 _field_tr2_slice_key_control_entry_recover(int unit, 27986 unsigned slice_num, 27987 _field_sel_t *sel 27988 ) 27989 { 27990 int rv; 27991 fp_slice_key_control_entry_t buf; 27992 27993 sel->src_class_sel 27994 = sel->dst_class_sel 27995 = sel->intf_class_sel 27996 = sel->aux_tag_1_sel 27997 = sel->aux_tag_2_sel 27998 = _FP_SELCODE_DONT_CARE; 27999 28000 if (!SOC_MEM_IS_VALID(unit, FP_SLICE_KEY_CONTROLm)) { 28001 return (BCM_E_NONE); 28002 } 28003 28004 rv = soc_mem_read(unit, 28005 FP_SLICE_KEY_CONTROLm, 28006 MEM_BLOCK_ALL, 28007 0, 28008 buf.entry_data 28009 ); 28010 if (BCM_FAILURE(rv)) { 28011 return (rv); 28012 } 28013 28014 /* Get source class select field. */ 28015 sel->src_class_sel = soc_mem_field32_get(unit, 28016 FP_SLICE_KEY_CONTROLm, 28017 buf.entry_data, 28018 _trx_src_class_id_sel[slice_num] 28019 ); 28020 28021 /* Get destination class select field. */ 28022 sel->dst_class_sel = soc_mem_field32_get(unit, 28023 FP_SLICE_KEY_CONTROLm, 28024 buf.entry_data, 28025 _trx_dst_class_id_sel[slice_num] 28026 ); 28027 sel->ttl_class_sel = soc_mem_field32_get(unit, 28028 FP_SLICE_KEY_CONTROLm, 28029 buf.entry_data, 28030 _trx_ttl_slice_control_enable_field[slice_num] 28031 ); 28032 sel->tcp_class_sel = soc_mem_field32_get(unit, 28033 FP_SLICE_KEY_CONTROLm, 28034 buf.entry_data, 28035 _trx_tcp_slice_control_enable_field[slice_num] 28036 ); 28037 sel->tos_class_sel = soc_mem_field32_get(unit, 28038 FP_SLICE_KEY_CONTROLm, 28039 buf.entry_data, 28040 _trx_tos_slice_control_enable_field[slice_num] 28041 ); 28042 28043 /* Get interface class select field. */ 28044 sel->intf_class_sel = soc_mem_field32_get( 28045 unit, 28046 FP_SLICE_KEY_CONTROLm, 28047 buf.entry_data, 28048 _trx_interface_class_id_sel[slice_num] 28049 ); 28050 28051 sel->aux_tag_1_sel = soc_mem_field32_get_def( 28052 unit, 28053 FP_SLICE_KEY_CONTROLm, 28054 buf.entry_data, 28055 _bcm_trx2_aux_tag_1_field[slice_num], 28056 _FP_SELCODE_DONT_CARE 28057 ); 28058 28059 sel->aux_tag_2_sel = soc_mem_field32_get_def( 28060 unit, 28061 FP_SLICE_KEY_CONTROLm, 28062 buf.entry_data, 28063 _bcm_trx2_aux_tag_2_field[slice_num], 28064 _FP_SELCODE_DONT_CARE 28065 ); 28066 28067 #if defined BCM_TRIDENT2PLUS_SUPPORT 28068 if (soc_feature(unit, soc_feature_fp_based_oam)) { 28069 sel->oam_overlay_sel= soc_mem_field32_get_def( 28070 unit, 28071 FP_SLICE_KEY_CONTROLm, 28072 buf.entry_data, 28073 _bcm_td2plus_oam_overlay_field[slice_num], 28074 _FP_SELCODE_DONT_CARE 28075 ); 28076 } 28077 #endif /* BCM_TRIDENT2PLUS_SUPPORT */ 28078 return (BCM_E_NONE); 28079 } 28080 28081 /* Allocate and initialize a group structure */ 28082 28083 int 28084 _field_tr2_group_construct_alloc(int unit, _field_group_t **pfg) 28085 { 28086 _field_group_t *fg = 0; 28087 unsigned i; 28088 28089 _FP_XGS3_ALLOC(fg, sizeof(*fg), "field group"); 28090 if (fg == 0) { 28091 return BCM_E_MEMORY; 28092 } 28093 28094 for (i = 0; i < COUNTOF(fg->sel_codes); ++i) { 28095 _FIELD_SELCODE_CLEAR(fg->sel_codes[i]); 28096 fg->sel_codes[i].intraslice = _FP_SELCODE_DONT_USE; 28097 } 28098 _bcm_field_group_status_init(unit, &fg->group_status); 28099 fg->action_res_id = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 28100 for (i = 0; i < _FP_PAIR_MAX; i++) { 28101 fg->vmap_group[i] = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 28102 } 28103 28104 *pfg = fg; 28105 28106 return (BCM_E_NONE); 28107 } 28108 28109 /* Add the given qualifier to the given group */ 28110 28111 int 28112 _field_trx_group_qual_add(_bcm_field_group_qual_t *grp_qual, 28113 unsigned qid, 28114 _bcm_field_qual_offset_t *qual_offset 28115 ) 28116 { 28117 uint16 *new_qid_arr; 28118 _bcm_field_qual_offset_t *new_qoffset_arr; 28119 unsigned new_size; 28120 28121 new_size = grp_qual->size + 1; 28122 28123 new_qid_arr = (uint16 *) sal_alloc(new_size * sizeof(grp_qual->qid_arr[0]), 28124 "Group qual id" 28125 ); 28126 if (new_qid_arr == 0) { 28127 return (BCM_E_MEMORY); 28128 } 28129 28130 new_qoffset_arr = (_bcm_field_qual_offset_t *) 28131 sal_alloc(new_size * sizeof(grp_qual->offset_arr[0]), 28132 "Group qual offset"); 28133 if (new_qoffset_arr == 0) { 28134 sal_free(new_qid_arr); 28135 28136 return (BCM_E_MEMORY); 28137 } 28138 28139 if (grp_qual->size != 0) { 28140 sal_memcpy(new_qid_arr, 28141 grp_qual->qid_arr, 28142 grp_qual->size * sizeof(grp_qual->qid_arr[0]) 28143 ); 28144 sal_memcpy(new_qoffset_arr, 28145 grp_qual->offset_arr, 28146 grp_qual->size * sizeof(grp_qual->offset_arr[0]) 28147 ); 28148 28149 sal_free(grp_qual->qid_arr); 28150 sal_free(grp_qual->offset_arr); 28151 } 28152 28153 new_qid_arr[new_size - 1] = qid; 28154 new_qoffset_arr[new_size - 1] = *qual_offset; 28155 28156 grp_qual->qid_arr = new_qid_arr; 28157 grp_qual->offset_arr = new_qoffset_arr; 28158 grp_qual->size = new_size; 28159 28160 return (BCM_E_NONE); 28161 } 28162 28163 STATIC int 28164 _field_trx_wb_group_selcode_compare(int unit, 28165 _field_group_t *fg, 28166 _field_group_t *new_fg 28167 ) 28168 { 28169 int idx; 28170 int parts_cnt; 28171 28172 BCM_IF_ERROR_RETURN(_bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 28173 fg->flags, &parts_cnt)); 28174 28175 for (idx = 0; idx < parts_cnt; idx++) { 28176 if ((new_fg->sel_codes[idx].fpf0 != _FP_SELCODE_DONT_CARE) && 28177 (new_fg->sel_codes[idx].fpf0 != fg->sel_codes[idx].fpf0)) { 28178 return BCM_E_INTERNAL; 28179 } 28180 if ((new_fg->sel_codes[idx].fpf1 != _FP_SELCODE_DONT_CARE) && 28181 (new_fg->sel_codes[idx].fpf1 != fg->sel_codes[idx].fpf1)) { 28182 return BCM_E_INTERNAL; 28183 } 28184 if ((new_fg->sel_codes[idx].fpf2 != _FP_SELCODE_DONT_CARE) && 28185 (new_fg->sel_codes[idx].fpf2 != fg->sel_codes[idx].fpf2)) { 28186 return BCM_E_INTERNAL; 28187 } 28188 if ((new_fg->sel_codes[idx].fpf3 != _FP_SELCODE_DONT_CARE) && 28189 (new_fg->sel_codes[idx].fpf3 != fg->sel_codes[idx].fpf3)) { 28190 return BCM_E_INTERNAL; 28191 } 28192 if ((new_fg->sel_codes[idx].fpf4 != _FP_SELCODE_DONT_CARE) && 28193 (new_fg->sel_codes[idx].fpf4 != fg->sel_codes[idx].fpf4)) { 28194 return BCM_E_INTERNAL; 28195 } 28196 if ((new_fg->sel_codes[idx].extn != _FP_SELCODE_DONT_CARE) && 28197 (new_fg->sel_codes[idx].extn != fg->sel_codes[idx].extn)) { 28198 return BCM_E_INTERNAL; 28199 } 28200 if ((new_fg->sel_codes[idx].src_class_sel != _FP_SELCODE_DONT_CARE) && 28201 (new_fg->sel_codes[idx].src_class_sel != fg->sel_codes[idx].src_class_sel)) { 28202 return BCM_E_INTERNAL; 28203 } 28204 if ((new_fg->sel_codes[idx].dst_class_sel != _FP_SELCODE_DONT_CARE) && 28205 (new_fg->sel_codes[idx].dst_class_sel != fg->sel_codes[idx].dst_class_sel)) { 28206 return BCM_E_INTERNAL; 28207 } 28208 if ((new_fg->sel_codes[idx].intf_class_sel != _FP_SELCODE_DONT_CARE) && 28209 (new_fg->sel_codes[idx].intf_class_sel != fg->sel_codes[idx].intf_class_sel)) { 28210 return BCM_E_INTERNAL; 28211 } 28212 if ((new_fg->sel_codes[idx].ttl_class_sel != _FP_SELCODE_DONT_CARE) && 28213 (new_fg->sel_codes[idx].ttl_class_sel != fg->sel_codes[idx].ttl_class_sel)) { 28214 return BCM_E_INTERNAL; 28215 } 28216 if ((new_fg->sel_codes[idx].tcp_class_sel != _FP_SELCODE_DONT_CARE) && 28217 (new_fg->sel_codes[idx].tcp_class_sel != fg->sel_codes[idx].tcp_class_sel)) { 28218 return BCM_E_INTERNAL; 28219 } 28220 if ((new_fg->sel_codes[idx].tos_class_sel != _FP_SELCODE_DONT_CARE) && 28221 (new_fg->sel_codes[idx].tos_class_sel != fg->sel_codes[idx].tos_class_sel)) { 28222 return BCM_E_INTERNAL; 28223 } 28224 if ((new_fg->sel_codes[idx].ingress_entity_sel != _FP_SELCODE_DONT_CARE) && 28225 (new_fg->sel_codes[idx].ingress_entity_sel != fg->sel_codes[idx].ingress_entity_sel)) { 28226 return BCM_E_INTERNAL; 28227 } 28228 if ((new_fg->sel_codes[idx].src_entity_sel != _FP_SELCODE_DONT_CARE) && 28229 (new_fg->sel_codes[idx].src_entity_sel != fg->sel_codes[idx].src_entity_sel)) { 28230 return BCM_E_INTERNAL; 28231 } 28232 if ((new_fg->sel_codes[idx].dst_fwd_entity_sel != _FP_SELCODE_DONT_CARE) && 28233 (new_fg->sel_codes[idx].dst_fwd_entity_sel != fg->sel_codes[idx].dst_fwd_entity_sel)) { 28234 return BCM_E_INTERNAL; 28235 } 28236 if ((new_fg->sel_codes[idx].fwd_field_sel != _FP_SELCODE_DONT_CARE) && 28237 (new_fg->sel_codes[idx].fwd_field_sel != fg->sel_codes[idx].fwd_field_sel)) { 28238 return BCM_E_INTERNAL; 28239 } 28240 if ((new_fg->sel_codes[idx].loopback_type_sel != _FP_SELCODE_DONT_CARE) && 28241 (new_fg->sel_codes[idx].loopback_type_sel != fg->sel_codes[idx].loopback_type_sel)) { 28242 return BCM_E_INTERNAL; 28243 } 28244 if ((new_fg->sel_codes[idx].ip_header_sel != _FP_SELCODE_DONT_CARE) && 28245 (new_fg->sel_codes[idx].ip_header_sel != fg->sel_codes[idx].ip_header_sel)) { 28246 return BCM_E_INTERNAL; 28247 } 28248 if ((new_fg->sel_codes[idx].ip6_addr_sel != _FP_SELCODE_DONT_CARE) && 28249 (new_fg->sel_codes[idx].ip6_addr_sel != fg->sel_codes[idx].ip6_addr_sel)) { 28250 return BCM_E_INTERNAL; 28251 } 28252 28253 #if 0 /* Not required, since group is created with appropriate mode */ 28254 if ((new_fg->sel_codes[idx].intraslice != _FP_SELCODE_DONT_CARE) && 28255 (new_fg->sel_codes[idx].intraslice != fg->sel_codes[idx].intraslice)) { 28256 return BCM_E_INTERNAL; 28257 } 28258 if ((new_fg->sel_codes[idx].secondary != _FP_SELCODE_DONT_CARE) && 28259 (new_fg->sel_codes[idx].secondary != fg->sel_codes[idx].secondary)) { 28260 return BCM_E_INTERNAL; 28261 } 28262 #endif 28263 28264 if ((new_fg->sel_codes[idx].inner_vlan_overlay != _FP_SELCODE_DONT_CARE) && 28265 (new_fg->sel_codes[idx].inner_vlan_overlay != fg->sel_codes[idx].inner_vlan_overlay)) { 28266 return BCM_E_INTERNAL; 28267 } 28268 if ((new_fg->sel_codes[idx].intraslice_vfp_sel != _FP_SELCODE_DONT_CARE) && 28269 (new_fg->sel_codes[idx].intraslice_vfp_sel != fg->sel_codes[idx].intraslice_vfp_sel)) { 28270 return BCM_E_INTERNAL; 28271 } 28272 if ((new_fg->sel_codes[idx].aux_tag_1_sel != _FP_SELCODE_DONT_CARE) && 28273 (new_fg->sel_codes[idx].aux_tag_1_sel != fg->sel_codes[idx].aux_tag_1_sel)) { 28274 return BCM_E_INTERNAL; 28275 } 28276 if ((new_fg->sel_codes[idx].aux_tag_2_sel != _FP_SELCODE_DONT_CARE) && 28277 (new_fg->sel_codes[idx].aux_tag_2_sel != fg->sel_codes[idx].aux_tag_2_sel)) { 28278 return BCM_E_INTERNAL; 28279 } 28280 if ((new_fg->sel_codes[idx].oam_overlay_sel != _FP_SELCODE_DONT_CARE) && 28281 (new_fg->sel_codes[idx].oam_overlay_sel != fg->sel_codes[idx].oam_overlay_sel)) { 28282 return BCM_E_INTERNAL; 28283 } 28284 if ((new_fg->sel_codes[idx].normalize_ip_sel != _FP_SELCODE_DONT_CARE) && 28285 (new_fg->sel_codes[idx].normalize_ip_sel != fg->sel_codes[idx].normalize_ip_sel)) { 28286 return BCM_E_INTERNAL; 28287 } 28288 if ((new_fg->sel_codes[idx].normalize_mac_sel != _FP_SELCODE_DONT_CARE) && 28289 (new_fg->sel_codes[idx].normalize_mac_sel != fg->sel_codes[idx].normalize_mac_sel)) { 28290 return BCM_E_INTERNAL; 28291 } 28292 if ((new_fg->sel_codes[idx].egr_class_f1_sel != _FP_SELCODE_DONT_CARE) && 28293 (new_fg->sel_codes[idx].egr_class_f1_sel != fg->sel_codes[idx].egr_class_f1_sel)) { 28294 return BCM_E_INTERNAL; 28295 } 28296 if ((new_fg->sel_codes[idx].egr_class_f2_sel != _FP_SELCODE_DONT_CARE) && 28297 (new_fg->sel_codes[idx].egr_class_f2_sel != fg->sel_codes[idx].egr_class_f2_sel)) { 28298 return BCM_E_INTERNAL; 28299 } 28300 if ((new_fg->sel_codes[idx].egr_class_f3_sel != _FP_SELCODE_DONT_CARE) && 28301 (new_fg->sel_codes[idx].egr_class_f3_sel != fg->sel_codes[idx].egr_class_f3_sel)) { 28302 return BCM_E_INTERNAL; 28303 } 28304 if ((new_fg->sel_codes[idx].egr_class_f4_sel != _FP_SELCODE_DONT_CARE) && 28305 (new_fg->sel_codes[idx].egr_class_f4_sel != fg->sel_codes[idx].egr_class_f4_sel)) { 28306 return BCM_E_INTERNAL; 28307 } 28308 if ((new_fg->sel_codes[idx].egr_class_f6_sel != _FP_SELCODE_DONT_CARE) && 28309 (new_fg->sel_codes[idx].egr_class_f6_sel != fg->sel_codes[idx].egr_class_f6_sel)) { 28310 return BCM_E_INTERNAL; 28311 } 28312 if ((new_fg->sel_codes[idx].egr_class_f7_sel != _FP_SELCODE_DONT_CARE) && 28313 (new_fg->sel_codes[idx].egr_class_f7_sel != fg->sel_codes[idx].egr_class_f7_sel)) { 28314 return BCM_E_INTERNAL; 28315 } 28316 if ((new_fg->sel_codes[idx].egr_class_f8_sel != _FP_SELCODE_DONT_CARE) && 28317 (new_fg->sel_codes[idx].egr_class_f8_sel != fg->sel_codes[idx].egr_class_f8_sel)) { 28318 return BCM_E_INTERNAL; 28319 } 28320 if ((new_fg->sel_codes[idx].src_dest_class_f1_sel != _FP_SELCODE_DONT_CARE) && 28321 (new_fg->sel_codes[idx].src_dest_class_f1_sel != fg->sel_codes[idx].src_dest_class_f1_sel)) { 28322 return BCM_E_INTERNAL; 28323 } 28324 if ((new_fg->sel_codes[idx].src_dest_class_f3_sel != _FP_SELCODE_DONT_CARE) && 28325 (new_fg->sel_codes[idx].src_dest_class_f3_sel != fg->sel_codes[idx].src_dest_class_f3_sel)) { 28326 return BCM_E_INTERNAL; 28327 } 28328 if ((new_fg->sel_codes[idx].src_type_sel != _FP_SELCODE_DONT_CARE) && 28329 (new_fg->sel_codes[idx].src_type_sel != fg->sel_codes[idx].src_type_sel)) { 28330 return BCM_E_INTERNAL; 28331 } 28332 if ((new_fg->sel_codes[idx].egr_key4_dvp_sel != _FP_SELCODE_DONT_CARE) && 28333 (new_fg->sel_codes[idx].egr_key4_dvp_sel != fg->sel_codes[idx].egr_key4_dvp_sel)) { 28334 return BCM_E_INTERNAL; 28335 } 28336 if ((new_fg->sel_codes[idx].egr_key8_dvp_sel != _FP_SELCODE_DONT_CARE) && 28337 (new_fg->sel_codes[idx].egr_key8_dvp_sel != fg->sel_codes[idx].egr_key8_dvp_sel)) { 28338 return BCM_E_INTERNAL; 28339 } 28340 if ((new_fg->sel_codes[idx].egr_dest_port_f1_sel != _FP_SELCODE_DONT_CARE) && 28341 (new_fg->sel_codes[idx].egr_dest_port_f1_sel != fg->sel_codes[idx].egr_dest_port_f1_sel)) { 28342 return BCM_E_INTERNAL; 28343 } 28344 if ((new_fg->sel_codes[idx].egr_dest_port_f5_sel != _FP_SELCODE_DONT_CARE) && 28345 (new_fg->sel_codes[idx].egr_dest_port_f5_sel != fg->sel_codes[idx].egr_dest_port_f5_sel)) { 28346 return BCM_E_INTERNAL; 28347 } 28348 if ((new_fg->sel_codes[idx].egr_key4_mdl_sel != _FP_SELCODE_DONT_CARE) && 28349 (new_fg->sel_codes[idx].egr_key4_mdl_sel != fg->sel_codes[idx].egr_key4_mdl_sel)) { 28350 return BCM_E_INTERNAL; 28351 } 28352 if ((new_fg->sel_codes[idx].egr_oam_overlay_sel != _FP_SELCODE_DONT_CARE) && 28353 (new_fg->sel_codes[idx].egr_oam_overlay_sel != fg->sel_codes[idx].egr_oam_overlay_sel)) { 28354 return BCM_E_INTERNAL; 28355 } 28356 if ((new_fg->sel_codes[idx].oam_intf_class_sel != _FP_SELCODE_DONT_CARE) && 28357 (new_fg->sel_codes[idx].oam_intf_class_sel != fg->sel_codes[idx].oam_intf_class_sel)) { 28358 return BCM_E_INTERNAL; 28359 } 28360 #if defined (BCM_TRIDENT3_SUPPORT) 28361 if (soc_feature(unit, soc_feature_td3_style_fp)) { 28362 if ((new_fg->sel_codes[idx].egr_classId_B_f1_sel != _FP_SELCODE_DONT_CARE) && 28363 (new_fg->sel_codes[idx].egr_classId_B_f1_sel != fg->sel_codes[idx].egr_classId_B_f1_sel)) { 28364 return BCM_E_INTERNAL; 28365 } 28366 if ((new_fg->sel_codes[idx].egr_classId_B_f2_sel != _FP_SELCODE_DONT_CARE) && 28367 (new_fg->sel_codes[idx].egr_classId_B_f2_sel != fg->sel_codes[idx].egr_classId_B_f2_sel)) { 28368 return BCM_E_INTERNAL; 28369 } 28370 if ((new_fg->sel_codes[idx].egr_classId_B_f3_sel != _FP_SELCODE_DONT_CARE) && 28371 (new_fg->sel_codes[idx].egr_classId_B_f3_sel != fg->sel_codes[idx].egr_classId_B_f3_sel)) { 28372 return BCM_E_INTERNAL; 28373 } 28374 if ((new_fg->sel_codes[idx].egr_classId_B_f4_sel != _FP_SELCODE_DONT_CARE) && 28375 (new_fg->sel_codes[idx].egr_classId_B_f4_sel != fg->sel_codes[idx].egr_classId_B_f4_sel)) { 28376 return BCM_E_INTERNAL; 28377 } 28378 if ((new_fg->sel_codes[idx].egr_classId_B_f5_sel != _FP_SELCODE_DONT_CARE) && 28379 (new_fg->sel_codes[idx].egr_classId_B_f5_sel != fg->sel_codes[idx].egr_classId_B_f5_sel)) { 28380 return BCM_E_INTERNAL; 28381 } 28382 if ((new_fg->sel_codes[idx].egr_classId_B_f6_sel != _FP_SELCODE_DONT_CARE) && 28383 (new_fg->sel_codes[idx].egr_classId_B_f6_sel != fg->sel_codes[idx].egr_classId_B_f6_sel)) { 28384 return BCM_E_INTERNAL; 28385 } 28386 if ((new_fg->sel_codes[idx].egr_classId_B_f7_sel != _FP_SELCODE_DONT_CARE) && 28387 (new_fg->sel_codes[idx].egr_classId_B_f7_sel != fg->sel_codes[idx].egr_classId_B_f7_sel)) { 28388 return BCM_E_INTERNAL; 28389 } 28390 if ((new_fg->sel_codes[idx].egr_classId_B_f8_sel != _FP_SELCODE_DONT_CARE) && 28391 (new_fg->sel_codes[idx].egr_classId_B_f8_sel != fg->sel_codes[idx].egr_classId_B_f8_sel)) { 28392 return BCM_E_INTERNAL; 28393 } 28394 if ((new_fg->sel_codes[idx].egr_dest_port_f1_sel != _FP_SELCODE_DONT_CARE) && 28395 (new_fg->sel_codes[idx].egr_dest_port_f1_sel != fg->sel_codes[idx].egr_dest_port_f1_sel)) { 28396 return BCM_E_INTERNAL; 28397 } 28398 if ((new_fg->sel_codes[idx].egr_dest_port_f5_sel != _FP_SELCODE_DONT_CARE) && 28399 (new_fg->sel_codes[idx].egr_dest_port_f5_sel != fg->sel_codes[idx].egr_dest_port_f5_sel)) { 28400 return BCM_E_INTERNAL; 28401 } 28402 } 28403 #endif 28404 } 28405 return BCM_E_NONE; 28406 } 28407 28408 /* Recover qualifiers offset for the given group 28409 * based the dummy group create using group qset and entry type 28410 * Dummy group selcodes are compared with HW recovered selcodes 28411 * before copying the qualifier offset 28412 */ 28413 28414 int 28415 _field_trx_group_construct_quals_add(int unit, 28416 _field_control_t *fc, 28417 _field_group_t *fg, 28418 uint8 fg_entry_type, 28419 bcm_field_qset_t *new_qset, 28420 int8 pri_key1, 28421 int8 pri_key2 28422 ) 28423 { 28424 _field_group_t new_fg; 28425 _field_stage_t *stage_fc = NULL; 28426 bcm_field_qset_t group_qset; 28427 int idx; /* Generic iteration index. */ 28428 int rv = BCM_E_NONE; 28429 uint8 entry_type; 28430 28431 if (!fc->l2warm) { 28432 return BCM_E_INTERNAL; 28433 } 28434 28435 if ((fg_entry_type == _FP_ENTRY_TYPE_1) && 28436 (new_qset == NULL)) { 28437 return BCM_E_INTERNAL; 28438 } 28439 28440 /* Qualifier offset recovery based on group create 28441 * is restricted to IFP, VFP & EFP */ 28442 if ((fg->stage_id != _BCM_FIELD_STAGE_INGRESS) && 28443 (fg->stage_id != _BCM_FIELD_STAGE_LOOKUP) && 28444 (fg->stage_id != _BCM_FIELD_STAGE_EGRESS)) { 28445 return BCM_E_INTERNAL; 28446 } 28447 28448 /* EFP stage group recovery based on dummy group create 28449 * for only new device which have 28450 * soc_feature_fp_qual_recovery_with_group_create enabled. 28451 * For older devices fallback to old approach for qual recovery. 28452 */ 28453 if (!soc_feature(unit, soc_feature_fp_qual_recovery_with_group_create) && 28454 (fg->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 28455 return BCM_E_INTERNAL; 28456 } 28457 28458 sal_memset(&new_fg, 0, sizeof(_field_group_t)); 28459 new_fg.flags = fg->flags & _FP_GROUP_SPAN_MASK; 28460 new_fg.stage_id = fg->stage_id; 28461 28462 BCM_FIELD_QSET_INIT(group_qset); 28463 group_qset = fg->qset; 28464 28465 /* Clear the group's slice Qsets. */ 28466 for (idx = 0; idx < _FP_MAX_ENTRY_WIDTH; idx++) { 28467 _FIELD_SELCODE_CLEAR(new_fg.sel_codes[idx]); 28468 } 28469 28470 /* For EFP Copy KEY's from recovered group */ 28471 if (fg->stage_id == _BCM_FIELD_STAGE_EGRESS) { 28472 BCM_IF_ERROR_RETURN(_field_stage_control_get(unit, fg->stage_id, &stage_fc)); 28473 if (fg_entry_type == _FP_ENTRY_TYPE_1) { 28474 /* Create dummy group with primary key and compare selcodes 28475 * if primary selcodes match, then proceed with secondary key's. 28476 * Dummy group create with primary key is required 28477 * since secondary key should have the same secondary 28478 * selectors as that of primary key. 28479 */ 28480 new_fg.sel_codes[0].fpf3 = pri_key1; 28481 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 28482 new_fg.sel_codes[1].fpf3 = pri_key2; 28483 } 28484 28485 rv = _bcm_field_selcode_get(unit, stage_fc, &group_qset, &new_fg); 28486 if (BCM_SUCCESS(rv)) { 28487 new_fg.sel_codes[0].fpf3 = fg->sel_codes[0].fpf3; 28488 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 28489 new_fg.sel_codes[1].fpf3 = fg->sel_codes[1].fpf3; 28490 } 28491 rv = _field_trx_wb_group_selcode_compare(unit, fg, &new_fg); 28492 } 28493 28494 28495 /* Free memory allocated for qualifier offset during group create */ 28496 for (idx = 0; idx < _FP_MAX_ENTRY_WIDTH; idx++) { 28497 BCM_IF_ERROR_RETURN(_bcm_field_group_qualifiers_free(&new_fg, idx)); 28498 } 28499 28500 /* Update Qset as per the secondary key */ 28501 group_qset = *new_qset; 28502 } else { 28503 new_fg.sel_codes[0].fpf3 = fg->sel_codes[0].fpf3; 28504 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 28505 new_fg.sel_codes[1].fpf3 = fg->sel_codes[1].fpf3; 28506 } 28507 } 28508 if (BCM_SUCCESS(rv)) { 28509 rv = _bcm_field_selcode_get(unit, stage_fc, &group_qset, &new_fg); 28510 } 28511 } else { 28512 /* Dummy group create to compare selcodes and copy qualifier offsets */ 28513 rv = _field_selcode_assign(unit, group_qset, 0, &new_fg); 28514 } 28515 28516 if (BCM_SUCCESS(rv)) { 28517 rv = _field_trx_wb_group_selcode_compare(unit, fg, &new_fg); 28518 } 28519 28520 if (BCM_SUCCESS(rv)) { 28521 LOG_DEBUG(BSL_LS_BCM_FP, 28522 (BSL_META_U(unit, "FP(unit %d) Qualifier offset recovery based" 28523 "on group create approach for stage id %d " 28524 "group id %d type %d group flags %d\n"), unit, 28525 fg->stage_id, fg->gid, fg_entry_type, new_fg.flags)); 28526 /* Copy Qualifier offsets */ 28527 for (idx = 0; idx < _FP_MAX_ENTRY_WIDTH; idx++) { 28528 for (entry_type = 0; entry_type < _FP_MAX_ENTRY_TYPES; entry_type++) { 28529 if (entry_type == 0) { 28530 fg->qual_arr[fg_entry_type][idx] = new_fg.qual_arr[entry_type][idx]; 28531 new_fg.qual_arr[entry_type][idx].qid_arr = NULL; 28532 new_fg.qual_arr[entry_type][idx].offset_arr = NULL; 28533 new_fg.qual_arr[entry_type][idx].size = 0; 28534 } 28535 } 28536 } 28537 } else { 28538 LOG_DEBUG(BSL_LS_BCM_FP, 28539 (BSL_META_U(unit, "FP(unit %d) Qualifier offset recovery based" 28540 " on HW based selcodes approach for stage id %d " 28541 "group id %d type %d group flags %d\n"), unit, 28542 fg->stage_id, fg->gid, fg_entry_type, new_fg.flags)); 28543 } 28544 28545 /* Clear memory allocated for qual offset in dummy group */ 28546 for (idx = 0; idx < _FP_MAX_ENTRY_WIDTH; idx++) { 28547 BCM_IF_ERROR_RETURN(_bcm_field_group_qualifiers_free(&new_fg, idx)); 28548 } 28549 28550 return rv; 28551 } 28552 28553 /* Recover all qualifiers for the given group, based on its selector codes */ 28554 28555 STATIC int 28556 _field_tr2_group_construct_quals_add(int unit, 28557 _field_control_t *fc, 28558 _field_stage_t *stage_fc, 28559 _field_group_t *fg 28560 ) 28561 { 28562 int rv; 28563 int parts_cnt, part_idx, sel_idx; 28564 uint8 e_type = _FP_ENTRY_TYPE_DEFAULT; 28565 _field_sel_t temp_sel_codes[_FP_MAX_ENTRY_WIDTH]; 28566 uint8 intraslice = 0; 28567 28568 if (fc->l2warm) { 28569 rv = _field_trx_group_construct_quals_add(unit, fc, fg, e_type, 28570 NULL, -1, -1); 28571 if (BCM_SUCCESS(rv)) { 28572 return rv; 28573 } 28574 } 28575 28576 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 28577 fg->flags, &parts_cnt); 28578 if (BCM_FAILURE(rv)) { 28579 return (rv); 28580 } 28581 28582 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 28583 intraslice = 1; 28584 } 28585 28586 for (part_idx = 0; part_idx < parts_cnt; ++part_idx) { 28587 _bcm_field_group_qual_t *grp_qual = &fg->qual_arr[e_type][part_idx]; 28588 unsigned qid; 28589 28590 for (qid = 0; qid < _bcmFieldQualifyCount; ++qid) { 28591 _bcm_field_qual_info_t *f_qual_arr = stage_fc->f_qual_arr[qid]; 28592 unsigned j; 28593 uint8 diff_cnt; 28594 28595 if (f_qual_arr == NULL) { 28596 continue; /* Qualifier does not exist in this stage */ 28597 } 28598 28599 if (fc->l2warm && !BCM_FIELD_QSET_TEST(fg->qset, qid)) { 28600 continue; /* Qualifier not present in the group */ 28601 } 28602 28603 /* Add all of the stage's qualifiers that match the recovered 28604 selector codes. Qualifiers that appear more than once 28605 (because more than one configuration of a qualifier matches 28606 the recovered selector codes) will be cleaned up later. 28607 */ 28608 28609 for (j = 0; j < f_qual_arr->conf_sz; j++) { 28610 if (_field_selector_diff(unit, 28611 fg->sel_codes, 28612 part_idx, 28613 &f_qual_arr->conf_arr[j].selector, 28614 &diff_cnt 28615 ) 28616 != BCM_E_NONE 28617 || diff_cnt != 0 28618 ) { 28619 if (fc->l2warm && (qid == _bcmFieldQualifyRangeCheckBits24_31) && 28620 BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyRangeCheck) && 28621 (_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id)) { 28622 28623 for (sel_idx = 0 ; sel_idx < _FP_MAX_ENTRY_WIDTH ; sel_idx++) { 28624 temp_sel_codes[sel_idx] = fg->sel_codes[sel_idx]; 28625 } 28626 28627 /* Update secondary selector in sel codes */ 28628 /* Primary slice */ 28629 if ((part_idx == 0) && (temp_sel_codes[0].fpf3 == 7)) { 28630 if (temp_sel_codes[0].intf_class_sel != 3) { 28631 temp_sel_codes[0].intf_class_sel = 3; 28632 } 28633 } else if (part_idx == 1) { 28634 /* Intraslice */ 28635 if (intraslice && (temp_sel_codes[1].fpf2 == 0)) { 28636 if (temp_sel_codes[0].intf_class_sel != 3) { 28637 temp_sel_codes[0].intf_class_sel = 3; 28638 } 28639 } else if ((!intraslice) && (temp_sel_codes[1].fpf3 == 7)) { 28640 /* Secondary slice */ 28641 if (temp_sel_codes[1].intf_class_sel != 3) { 28642 temp_sel_codes[1].intf_class_sel = 3; 28643 } 28644 } 28645 } else if ((part_idx == 2) && (temp_sel_codes[2].fpf3 == 7)) { 28646 if (temp_sel_codes[2].intf_class_sel != 3) { 28647 temp_sel_codes[2].intf_class_sel = 3; 28648 } 28649 } else if ((part_idx == 3) && (temp_sel_codes[3].fpf2 == 0)) { 28650 if (temp_sel_codes[2].intf_class_sel != 3) { 28651 temp_sel_codes[2].intf_class_sel = 3; 28652 } 28653 } 28654 28655 if (_field_selector_diff(unit, 28656 temp_sel_codes, 28657 part_idx, 28658 &f_qual_arr->conf_arr[j].selector, 28659 &diff_cnt 28660 ) 28661 != BCM_E_NONE 28662 || diff_cnt != 0 28663 ) { 28664 continue; 28665 } 28666 } else { 28667 continue; 28668 } 28669 } 28670 28671 if (!fc->l2warm) { 28672 BCM_FIELD_QSET_ADD(fg->qset, qid); 28673 } 28674 28675 _field_trx_group_qual_add(grp_qual, 28676 qid, 28677 &f_qual_arr->conf_arr[j].offset 28678 ); 28679 28680 _field_qset_udf_bmap_reinit(unit, 28681 stage_fc, 28682 &fg->qset, 28683 qid 28684 ); 28685 } 28686 } 28687 } 28688 28689 return (BCM_E_NONE); 28690 } 28691 28692 /* function to resole the selcodes of destination 28693 * virtual port qualifiers 28694 */ 28695 28696 int 28697 _field_dst_vp_selcode_resolve(int part_no, 28698 _field_group_t *fg_ptr 28699 ) 28700 { 28701 if ((BCM_FIELD_QSET_TEST (fg_ptr->qset, 28702 bcmFieldQualifyDstMplsGport)) || 28703 (BCM_FIELD_QSET_TEST (fg_ptr->qset, 28704 bcmFieldQualifyDstMplsGports))) { 28705 fg_ptr->sel_codes[part_no].dst_fwd_entity_sel 28706 = _bcmFieldFwdEntityMplsGport; 28707 } else if ((BCM_FIELD_QSET_TEST 28708 (fg_ptr->qset, bcmFieldQualifyDstNivGport)) || 28709 (BCM_FIELD_QSET_TEST (fg_ptr->qset, 28710 bcmFieldQualifyDstNivGports))) { 28711 fg_ptr->sel_codes[part_no].dst_fwd_entity_sel 28712 = _bcmFieldFwdEntityNivGport; 28713 } else if ((BCM_FIELD_QSET_TEST 28714 (fg_ptr->qset, bcmFieldQualifyDstGport)) || 28715 (BCM_FIELD_QSET_TEST (fg_ptr->qset, 28716 bcmFieldQualifyDstGports))) { 28717 fg_ptr->sel_codes[part_no].dst_fwd_entity_sel 28718 = _bcmFieldFwdEntityCommonGport; 28719 } else if ((BCM_FIELD_QSET_TEST 28720 (fg_ptr->qset, bcmFieldQualifyDstMimGport)) || 28721 (BCM_FIELD_QSET_TEST (fg_ptr->qset, 28722 bcmFieldQualifyDstMimGports))) { 28723 fg_ptr->sel_codes[part_no].dst_fwd_entity_sel 28724 = _bcmFieldFwdEntityMimGport; 28725 } else if ((BCM_FIELD_QSET_TEST 28726 (fg_ptr->qset, bcmFieldQualifyDstWlanGport)) || 28727 (BCM_FIELD_QSET_TEST (fg_ptr->qset, 28728 bcmFieldQualifyDstWlanGports))) { 28729 fg_ptr->sel_codes[part_no].dst_fwd_entity_sel 28730 = _bcmFieldFwdEntityWlanGport; 28731 } else if ((BCM_FIELD_QSET_TEST 28732 (fg_ptr->qset, bcmFieldQualifyDstVlanGport)) || 28733 (BCM_FIELD_QSET_TEST (fg_ptr->qset, 28734 bcmFieldQualifyDstVlanGports))) { 28735 fg_ptr->sel_codes[part_no].dst_fwd_entity_sel 28736 = _bcmFieldFwdEntityVlanGport; 28737 } 28738 return (BCM_E_NONE); 28739 } 28740 28741 /* function to resole the selcodes of source 28742 * virtual port qualifiers 28743 */ 28744 28745 int 28746 _field_src_vp_selcode_resolve(int part_no, 28747 _field_group_t *fg_ptr, 28748 int is_td2_td2p_ifp 28749 ) 28750 { 28751 if (is_td2_td2p_ifp) { 28752 if (fg_ptr->sel_codes[part_no].ingress_entity_sel == 2) { 28753 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28754 bcmFieldQualifySrcMplsGport)) || 28755 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28756 bcmFieldQualifySrcMplsGports))) { 28757 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28758 _bcmFieldFwdEntityMplsGport; 28759 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28760 bcmFieldQualifySrcNivGport)) || 28761 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28762 bcmFieldQualifySrcNivGports))) { 28763 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28764 _bcmFieldFwdEntityNivGport; 28765 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28766 bcmFieldQualifySrcMimGport)) || 28767 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28768 bcmFieldQualifySrcMimGports))) { 28769 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28770 _bcmFieldFwdEntityMimGport; 28771 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28772 bcmFieldQualifySrcWlanGport)) || 28773 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28774 bcmFieldQualifySrcWlanGports))) { 28775 fg_ptr->sel_codes[part_no].src_entity_sel = 28776 _bcmFieldFwdEntityWlanGport; 28777 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28778 bcmFieldQualifySrcVlanGport)) || 28779 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28780 bcmFieldQualifySrcVlanGports))) { 28781 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28782 _bcmFieldFwdEntityVlanGport; 28783 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28784 bcmFieldQualifySrcVxlanGport)) || 28785 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28786 bcmFieldQualifySrcVxlanGports))) { 28787 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28788 _bcmFieldFwdEntityVxlanGport; 28789 } 28790 } else if (fg_ptr->sel_codes[part_no].ingress_entity_sel == 6) { 28791 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28792 bcmFieldQualifySrcModPortGport)) || 28793 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28794 bcmFieldQualifySrcModPortGports)) || 28795 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28796 bcmFieldQualifySrcTrunkMemberGport)) || 28797 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28798 bcmFieldQualifySrcModuleGport)) || 28799 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28800 bcmFieldQualifyTrunkMemberSourceModuleId))) { 28801 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28802 _bcmFieldFwdEntityModPortGport; 28803 } 28804 } else if (fg_ptr->sel_codes[part_no].ingress_entity_sel == 5) { 28805 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28806 bcmFieldQualifySrcPort)) || 28807 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28808 bcmFieldQualifySrcTrunk))) { 28809 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28810 _bcmFieldFwdEntityGlp; 28811 } 28812 } else if (fg_ptr->sel_codes[part_no].ingress_entity_sel == 0) { 28813 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28814 bcmFieldQualifySrcGport)) || 28815 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28816 bcmFieldQualifySrcGports))) { 28817 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28818 _bcmFieldFwdEntityCommonGport; 28819 } 28820 } 28821 } else { 28822 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28823 bcmFieldQualifySrcMplsGport)) || 28824 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28825 bcmFieldQualifySrcMplsGports))) { 28826 if (_FP_SELCODE_DONT_CARE 28827 != fg_ptr->sel_codes[part_no].ingress_entity_sel) { 28828 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28829 _bcmFieldFwdEntityMplsGport; 28830 } else if (_bcmFieldFwdEntityAny 28831 != fg_ptr->sel_codes[part_no].src_entity_sel) { 28832 fg_ptr->sel_codes[part_no].src_entity_sel = 28833 _bcmFieldFwdEntityMplsGport; 28834 } 28835 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28836 bcmFieldQualifySrcNivGport)) || 28837 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28838 bcmFieldQualifySrcNivGports))) { 28839 if (_FP_SELCODE_DONT_CARE 28840 != fg_ptr->sel_codes[part_no].ingress_entity_sel) { 28841 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28842 _bcmFieldFwdEntityNivGport; 28843 } else if (_bcmFieldFwdEntityAny 28844 != fg_ptr->sel_codes[part_no].src_entity_sel) { 28845 fg_ptr->sel_codes[part_no].src_entity_sel = 28846 _bcmFieldFwdEntityNivGport; 28847 } 28848 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28849 bcmFieldQualifySrcMimGport)) || 28850 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28851 bcmFieldQualifySrcMimGports))) { 28852 if (_FP_SELCODE_DONT_CARE 28853 != fg_ptr->sel_codes[part_no].ingress_entity_sel) { 28854 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28855 _bcmFieldFwdEntityMimGport; 28856 } else if (_bcmFieldFwdEntityAny 28857 != fg_ptr->sel_codes[part_no].src_entity_sel) { 28858 fg_ptr->sel_codes[part_no].src_entity_sel = 28859 _bcmFieldFwdEntityMimGport; 28860 } 28861 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28862 bcmFieldQualifySrcWlanGport)) || 28863 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28864 bcmFieldQualifySrcWlanGports))) { 28865 if (_bcmFieldFwdEntityAny 28866 != fg_ptr->sel_codes[part_no].src_entity_sel) { 28867 fg_ptr->sel_codes[part_no].src_entity_sel = 28868 _bcmFieldFwdEntityWlanGport; 28869 } 28870 } else if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 28871 bcmFieldQualifySrcVlanGport)) || 28872 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 28873 bcmFieldQualifySrcVlanGports))) { 28874 if (_FP_SELCODE_DONT_CARE 28875 != fg_ptr->sel_codes[part_no].ingress_entity_sel) { 28876 fg_ptr->sel_codes[part_no].ingress_entity_sel = 28877 _bcmFieldFwdEntityVlanGport; 28878 } else if (_bcmFieldFwdEntityAny 28879 != fg_ptr->sel_codes[part_no].src_entity_sel) { 28880 fg_ptr->sel_codes[part_no].src_entity_sel = 28881 _bcmFieldFwdEntityVlanGport; 28882 } 28883 } 28884 } 28885 return BCM_E_NONE; 28886 } 28887 28888 28889 int 28890 _is_qset_conflicts(int unit, 28891 bcm_field_qset_t *qset, 28892 int *is_conflict 28893 ) 28894 { 28895 int conflict_count = 0; 28896 int indx = 0; 28897 uint16 qid_list[12] = {bcmFieldQualifySrcMplsGport, 28898 bcmFieldQualifySrcMplsGports, 28899 bcmFieldQualifySrcNivGport, 28900 bcmFieldQualifySrcNivGports, 28901 bcmFieldQualifySrcMimGport, 28902 bcmFieldQualifySrcMimGports, 28903 bcmFieldQualifySrcWlanGport, 28904 bcmFieldQualifySrcWlanGports, 28905 bcmFieldQualifySrcVlanGport, 28906 bcmFieldQualifySrcVlanGports, 28907 bcmFieldQualifySrcVxlanGport, 28908 bcmFieldQualifySrcVxlanGports 28909 }; 28910 28911 for (indx = 0; (indx<12 && conflict_count<2); indx++) { 28912 if (BCM_FIELD_QSET_TEST(*qset, qid_list[indx])) { 28913 conflict_count++; 28914 } 28915 } 28916 if (conflict_count == 2) { 28917 *is_conflict = 1; 28918 } else { 28919 *is_conflict = 0; 28920 } 28921 return (BCM_E_NONE); 28922 } 28923 28924 int 28925 _field_tr2_group_construct(int unit, 28926 int inst, 28927 _field_hw_qual_info_t *hw_sel, 28928 int intraslice, 28929 int paired, 28930 _field_control_t *fc, 28931 bcm_port_t port, 28932 _field_stage_id_t stage_id, 28933 int slice_idx 28934 ) 28935 { 28936 int rv = BCM_E_NONE; 28937 _field_group_t *fg_ptr = fc->groups; 28938 bcm_field_group_t gid; 28939 int priority; 28940 int group_flags = 0; 28941 _field_stage_t *stage_fc; 28942 bcm_field_qset_t qset; 28943 bcm_pbmp_t all_pbmp; 28944 bcm_pbmp_t group_pbmp; 28945 int action_res_id = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 28946 int is_td2_td2p = 0; 28947 int is_qset_conflict = 0; 28948 int8 sec_sel_pri_value = 0; 28949 int8 sec_sel_sec_value = 0; 28950 /* the below change is to recover the ingress_entity selcode 28951 * value for stage ingress of td2 and td2p devices. The value 28952 * is actually recovered into src_entity. 28953 * But, for ingress stage, src_entity is not used but only 28954 * ingress entity is used. hence, the below changes are required. 28955 * however,from WB version 1_18, the src_entity and ingress_entity 28956 * values are synced into scache and recovered and hence the below 28957 * fix is not required for WB upgrades from ver 1_18 and above. 28958 */ 28959 /* check if its td2 or td2p*/ 28960 #ifdef BCM_TRIDENT2_SUPPORT 28961 if (SOC_IS_TRIDENT2(unit) || SOC_IS_TITAN2(unit)) { 28962 is_td2_td2p = 1; 28963 } 28964 #endif 28965 28966 #ifdef BCM_TRIDENT2PLUS_SUPPORT 28967 if (SOC_IS_TD2P_TT2P(unit)) { 28968 is_td2_td2p = 1; 28969 } 28970 #endif 28971 bcm_field_qset_t_init(&qset); 28972 28973 /* Get the stage control structure */ 28974 BCM_IF_ERROR_RETURN(_field_stage_control_get(unit, stage_id, &stage_fc)); 28975 SOC_PBMP_CLEAR(group_pbmp); 28976 28977 /* Iterate over groups and compare all selectors */ 28978 fg_ptr = fc->groups; 28979 if (fg_ptr != NULL) { 28980 if ((is_td2_td2p) && 28981 (_BCM_FIELD_STAGE_INGRESS == stage_id) && 28982 ((fc->wb_recovered_version) < BCM_FIELD_WB_VERSION_1_18)) { 28983 sec_sel_pri_value = hw_sel->pri_slice[0].src_entity_sel; 28984 sec_sel_sec_value = hw_sel->sec_slice[0].src_entity_sel; 28985 } else { 28986 sec_sel_pri_value = hw_sel->pri_slice[0].ingress_entity_sel; 28987 sec_sel_sec_value = hw_sel->sec_slice[0].ingress_entity_sel; 28988 } 28989 } 28990 while (fg_ptr != NULL) { 28991 if (stage_id != fg_ptr->stage_id) { 28992 fg_ptr = fg_ptr->next; 28993 continue; 28994 } 28995 if (intraslice && !(fg_ptr->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE)) { 28996 fg_ptr = fg_ptr->next; 28997 continue; 28998 } 28999 if (!intraslice && (fg_ptr->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE)) { 29000 fg_ptr = fg_ptr->next; 29001 continue; 29002 } 29003 if (paired && (fg_ptr->flags & _FP_GROUP_SPAN_SINGLE_SLICE)) { 29004 fg_ptr = fg_ptr->next; 29005 continue; 29006 } 29007 if (!paired && (fg_ptr->flags & _FP_GROUP_SPAN_DOUBLE_SLICE)) { 29008 fg_ptr = fg_ptr->next; 29009 continue; 29010 } 29011 29012 /* 29013 * Check for the given instance and primary slice numbers, there may be 29014 * groups with the same QSET but residing in different slices. 29015 */ 29016 if ((inst != fg_ptr->instance) || 29017 (slice_idx != fg_ptr->slices[0].slice_number)) { 29018 fg_ptr = fg_ptr->next; 29019 continue; 29020 } 29021 29022 /* Compare primary slice selectors */ 29023 if ((fg_ptr->sel_codes[0].fpf1 != hw_sel->pri_slice[0].fpf1) || 29024 (fg_ptr->sel_codes[0].fpf2 != hw_sel->pri_slice[0].fpf2) || 29025 (fg_ptr->sel_codes[0].fpf3 != hw_sel->pri_slice[0].fpf3) || 29026 (fg_ptr->sel_codes[0].fpf4 != hw_sel->pri_slice[0].fpf4) || 29027 (!_field_src_dst_entity_compare(fg_ptr->sel_codes[0].src_entity_sel, 29028 hw_sel->pri_slice[0].src_entity_sel)) || 29029 (!_field_src_dst_entity_compare 29030 (fg_ptr->sel_codes[0].ingress_entity_sel, 29031 sec_sel_pri_value)) || 29032 (!_field_src_dst_entity_compare 29033 (fg_ptr->sel_codes[0].dst_fwd_entity_sel, 29034 hw_sel->pri_slice[0].dst_fwd_entity_sel 29035 ) 29036 ) || 29037 (fg_ptr->sel_codes[0].aux_tag_1_sel != hw_sel->pri_slice[0].aux_tag_1_sel) || 29038 (fg_ptr->sel_codes[0].aux_tag_2_sel != hw_sel->pri_slice[0].aux_tag_2_sel) 29039 || ((SOC_IS_TRIUMPH2(unit) 29040 || SOC_IS_APOLLO(unit) 29041 || SOC_IS_VALKYRIE2(unit) 29042 || SOC_IS_TRIUMPH3(unit) 29043 || SOC_IS_ENDURO(unit) 29044 || SOC_IS_KATANAX(unit)) 29045 && (fg_ptr->sel_codes[0].loopback_type_sel 29046 != hw_sel->pri_slice[0].loopback_type_sel))) { 29047 fg_ptr = fg_ptr->next; 29048 continue; 29049 } 29050 if (intraslice 29051 && (fg_ptr->sel_codes[1].fpf2 != hw_sel->pri_slice[1].fpf2 29052 || fg_ptr->sel_codes[1].fpf4 != hw_sel->pri_slice[1].fpf4 29053 || !_field_src_dst_entity_compare 29054 (fg_ptr->sel_codes[1].dst_fwd_entity_sel, 29055 hw_sel->pri_slice[1].dst_fwd_entity_sel) 29056 ) 29057 ) { 29058 fg_ptr = fg_ptr->next; 29059 continue; 29060 } 29061 /* Compare second and third slice config if mode is paired and intraslice**/ 29062 if (paired && intraslice) { 29063 if ((fg_ptr->sel_codes[2].fpf1 != hw_sel->sec_slice[0].fpf1) || 29064 (fg_ptr->sel_codes[2].fpf2 != hw_sel->sec_slice[0].fpf2) || 29065 (fg_ptr->sel_codes[2].fpf3 != hw_sel->sec_slice[0].fpf3) || 29066 (fg_ptr->sel_codes[2].fpf4 != hw_sel->sec_slice[0].fpf4) || 29067 (!_field_src_dst_entity_compare 29068 (fg_ptr->sel_codes[2].src_entity_sel, 29069 hw_sel->sec_slice[0].src_entity_sel)) || 29070 (!_field_src_dst_entity_compare 29071 (fg_ptr->sel_codes[2].ingress_entity_sel, 29072 sec_sel_sec_value)) || 29073 (!_field_src_dst_entity_compare 29074 (fg_ptr->sel_codes[2].dst_fwd_entity_sel, 29075 hw_sel->sec_slice[0].dst_fwd_entity_sel 29076 ) 29077 ) || 29078 (fg_ptr->sel_codes[2].aux_tag_1_sel != hw_sel->sec_slice[0].aux_tag_1_sel) || 29079 (fg_ptr->sel_codes[2].aux_tag_2_sel != hw_sel->sec_slice[0].aux_tag_2_sel) 29080 ) { 29081 fg_ptr = fg_ptr->next; 29082 continue; 29083 } 29084 if (fg_ptr->sel_codes[3].fpf2 != hw_sel->sec_slice[1].fpf2 29085 || fg_ptr->sel_codes[3].fpf4 != hw_sel->sec_slice[1].fpf4 29086 || !_field_src_dst_entity_compare 29087 (fg_ptr->sel_codes[3].dst_fwd_entity_sel, 29088 hw_sel->sec_slice[1].dst_fwd_entity_sel) 29089 ) { 29090 fg_ptr = fg_ptr->next; 29091 continue; 29092 } 29093 } 29094 29095 /* Compare secondary slice if paired */ 29096 if (paired && !intraslice) { 29097 if ((fg_ptr->sel_codes[1].fpf1 != hw_sel->sec_slice[0].fpf1) || 29098 (fg_ptr->sel_codes[1].fpf2 != hw_sel->sec_slice[0].fpf2) || 29099 (fg_ptr->sel_codes[1].fpf3 != hw_sel->sec_slice[0].fpf3) || 29100 (fg_ptr->sel_codes[1].fpf4 != hw_sel->sec_slice[0].fpf4) || 29101 (!_field_src_dst_entity_compare 29102 (fg_ptr->sel_codes[1].src_entity_sel, 29103 hw_sel->sec_slice[0].src_entity_sel)) || 29104 (!_field_src_dst_entity_compare 29105 (fg_ptr->sel_codes[1].ingress_entity_sel, 29106 sec_sel_sec_value)) || 29107 (!_field_src_dst_entity_compare 29108 (fg_ptr->sel_codes[1].dst_fwd_entity_sel, 29109 hw_sel->sec_slice[0].dst_fwd_entity_sel)) || 29110 (fg_ptr->sel_codes[1].aux_tag_1_sel != hw_sel->sec_slice[0].aux_tag_1_sel) || 29111 (fg_ptr->sel_codes[1].aux_tag_2_sel != hw_sel->sec_slice[0].aux_tag_2_sel) 29112 ) { 29113 fg_ptr = fg_ptr->next; 29114 continue; 29115 } 29116 } 29117 29118 if ((fc->wb_recovered_version) < BCM_FIELD_WB_VERSION_1_21) { 29119 /* Found a match - add port to group pbmp */ 29120 BCM_PBMP_PORT_ADD(fg_ptr->pbmp, port); 29121 BCM_PBMP_OR(fg_ptr->slices[0].pbmp, fg_ptr->pbmp); 29122 if (1 == paired) { 29123 BCM_PBMP_OR(fg_ptr->slices[1].pbmp, fg_ptr->pbmp); 29124 } 29125 } 29126 29127 if (fc->l2warm) { 29128 /* Get stored group ID and QSET for Level 2 */ 29129 BCM_IF_ERROR_RETURN 29130 (_field_group_info_retrieve(unit, port, inst, 29131 &gid, &priority, 29132 &action_res_id, 29133 &group_pbmp, 29134 NULL, 29135 &group_flags, 29136 &qset, 29137 fc 29138 ) 29139 ); 29140 if (gid != -1) { 29141 sal_memcpy(&fg_ptr->qset, &qset, sizeof(bcm_field_qset_t)); 29142 fg_ptr->gid = gid; 29143 fg_ptr->priority = priority; 29144 fg_ptr->action_res_id = action_res_id; 29145 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_21) { 29146 SOC_PBMP_ASSIGN(fg_ptr->pbmp, group_pbmp); 29147 } 29148 fg_ptr->instance = inst; 29149 if (group_flags & _FP_GROUP_SELECT_AUTO_EXPANSION) { 29150 fg_ptr->flags = fg_ptr->flags | 29151 _FP_GROUP_SELECT_AUTO_EXPANSION; 29152 } 29153 29154 /* Recover group qualifiers based on selector codes */ 29155 _field_tr2_group_construct_quals_add(unit, 29156 fc, 29157 stage_fc, 29158 fg_ptr 29159 ); 29160 } 29161 } 29162 break; 29163 } 29164 if (fg_ptr == NULL) { 29165 /* No match - create a new group and populate the group structure */ 29166 29167 rv = _field_tr2_group_construct_alloc(unit, &fg_ptr); 29168 if (BCM_FAILURE(rv)) { 29169 return (rv); 29170 } 29171 29172 /* Initialize action res id and VMAP group to default */ 29173 action_res_id = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 29174 29175 if (fc->l2warm) { 29176 /* Get stored group ID and QSET for Level 2 */ 29177 rv = _field_group_info_retrieve(unit, port, inst, 29178 &gid, &priority, 29179 &action_res_id, 29180 &group_pbmp, 29181 NULL, 29182 &group_flags, 29183 &qset, 29184 fc); 29185 if (gid != -1) { 29186 sal_memcpy(&fg_ptr->qset, &qset, sizeof(bcm_field_qset_t)); 29187 } else { 29188 sal_free(fg_ptr); 29189 return rv; 29190 } 29191 } else { 29192 /* Generate group ID (a ++ operation) for Level 1 */ 29193 29194 unsigned vmap, vslice; 29195 29196 rv = _bcm_field_group_id_generate(unit, &gid); 29197 29198 if (BCM_SUCCESS(rv)) { 29199 for (priority = -1, vmap = 0; priority == -1 && vmap < _FP_VMAP_CNT; ++vmap) { 29200 for (vslice = 0; vslice < COUNTOF(stage_fc->vmap[inst][0]); ++vslice) { 29201 if (stage_fc->vmap[inst][vmap][vslice].vmap_key == slice_idx) { 29202 priority = stage_fc->vmap[inst][vmap][vslice].priority; 29203 29204 break; 29205 } 29206 } 29207 } 29208 29209 if (priority == -1) { 29210 rv = BCM_E_INTERNAL; 29211 } 29212 } 29213 } 29214 if (BCM_FAILURE(rv)) { 29215 sal_free(fg_ptr); 29216 return rv; 29217 } 29218 29219 fg_ptr->gid = gid; 29220 fg_ptr->priority = priority; 29221 fg_ptr->action_res_id = action_res_id; 29222 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_21) { 29223 SOC_PBMP_ASSIGN(fg_ptr->pbmp, group_pbmp); 29224 } 29225 fg_ptr->stage_id = stage_id; 29226 fg_ptr->instance = inst; 29227 if (group_flags & _FP_GROUP_SELECT_AUTO_EXPANSION) { 29228 fg_ptr->flags = fg_ptr->flags | _FP_GROUP_SELECT_AUTO_EXPANSION; 29229 } 29230 29231 /* Set group's selector codes to those recovered from hardware */ 29232 fg_ptr->sel_codes[0] = hw_sel->pri_slice[0]; 29233 if (paired && intraslice) { 29234 /* 4 parts */ 29235 fg_ptr->sel_codes[1] = hw_sel->pri_slice[1]; 29236 fg_ptr->sel_codes[2] = hw_sel->sec_slice[0]; 29237 fg_ptr->sel_codes[3] = hw_sel->sec_slice[1]; 29238 } else if (paired && !intraslice) { 29239 /* 2 parts */ 29240 fg_ptr->sel_codes[1] = hw_sel->sec_slice[0]; 29241 } else if (!paired && intraslice) { 29242 /* 2 parts */ 29243 fg_ptr->sel_codes[1] = hw_sel->pri_slice[1]; 29244 } 29245 29246 /* Refine selector codes, if possible */ 29247 if (fc->l2warm) { 29248 /* check if conflicting qset*/ 29249 /* This is required, because the qualifiers with same primary 29250 * selcode andand different secondary selector will be added 29251 * in two different slices. In the recovery, it cannot be 29252 * differentiated as which conflicting qual was assigned to 29253 * which slice. hence, if such a case arises, the wb recovery 29254 * of such qual is skipped 29255 */ 29256 if (is_td2_td2p) { 29257 is_qset_conflict = 0; 29258 _is_qset_conflicts(unit,&(fg_ptr->qset), &is_qset_conflict); 29259 } 29260 29261 if (is_td2_td2p && (is_qset_conflict == 0) && 29262 (_BCM_FIELD_STAGE_INGRESS == stage_id) && 29263 ((fc->wb_recovered_version) < BCM_FIELD_WB_VERSION_1_18)) { 29264 fg_ptr->sel_codes[0].ingress_entity_sel = 29265 hw_sel->pri_slice[0].src_entity_sel; 29266 if (paired && intraslice) { 29267 /* 4 parts */ 29268 fg_ptr->sel_codes[1].ingress_entity_sel = 29269 hw_sel->pri_slice[1].src_entity_sel; 29270 fg_ptr->sel_codes[2].ingress_entity_sel = 29271 hw_sel->sec_slice[0].src_entity_sel; 29272 fg_ptr->sel_codes[3].ingress_entity_sel = 29273 hw_sel->sec_slice[1].src_entity_sel; 29274 } else if (paired && !intraslice) { 29275 /* 2 parts */ 29276 fg_ptr->sel_codes[1].ingress_entity_sel = 29277 hw_sel->sec_slice[0].src_entity_sel; 29278 } else if (!paired && intraslice) { 29279 /* 2 parts */ 29280 fg_ptr->sel_codes[1].ingress_entity_sel = 29281 hw_sel->pri_slice[1].src_entity_sel; 29282 } 29283 } 29284 /* Refine VP selectors only if it's used in hardware. */ 29285 if (hw_sel->pri_slice[0].dst_fwd_entity_sel 29286 == _bcmFieldFwdEntityMimGport) { 29287 _field_dst_vp_selcode_resolve(0, fg_ptr); 29288 } 29289 29290 if (_BCM_FIELD_STAGE_LOOKUP == stage_id) { 29291 29292 /* primary part */ 29293 switch(hw_sel->pri_slice[0].src_entity_sel) 29294 { 29295 case 4: 29296 fg_ptr->sel_codes[0].src_entity_sel = 29297 _bcmFieldFwdEntityPortGroupNum; 29298 break; 29299 case 3: 29300 fg_ptr->sel_codes[0].src_entity_sel = 29301 _bcmFieldFwdEntityMplsGport; 29302 break; 29303 case 2: 29304 fg_ptr->sel_codes[0].src_entity_sel = 29305 _bcmFieldFwdEntityModPortGport; 29306 break; 29307 case 1: 29308 fg_ptr->sel_codes[0].src_entity_sel = 29309 _bcmFieldFwdEntityGlp; 29310 break; 29311 default: 29312 fg_ptr->sel_codes[0].src_entity_sel = 29313 _FP_SELCODE_DONT_CARE; 29314 break; 29315 } 29316 29317 if (intraslice) { 29318 29319 switch(hw_sel->pri_slice[1].src_entity_sel) 29320 { 29321 case 4: 29322 fg_ptr->sel_codes[1].src_entity_sel = 29323 _bcmFieldFwdEntityPortGroupNum; 29324 break; 29325 case 3: 29326 fg_ptr->sel_codes[1].src_entity_sel = 29327 _bcmFieldFwdEntityMplsGport; 29328 break; 29329 case 2: 29330 fg_ptr->sel_codes[1].src_entity_sel = 29331 _bcmFieldFwdEntityModPortGport; 29332 break; 29333 case 1: 29334 fg_ptr->sel_codes[1].src_entity_sel = 29335 _bcmFieldFwdEntityGlp; 29336 break; 29337 default: 29338 fg_ptr->sel_codes[1].src_entity_sel = 29339 _FP_SELCODE_DONT_CARE; 29340 break; 29341 } 29342 } 29343 29344 if (paired && (!intraslice)) { 29345 switch(hw_sel->sec_slice[0].src_entity_sel) 29346 { 29347 case 4: 29348 fg_ptr->sel_codes[1].src_entity_sel = 29349 _bcmFieldFwdEntityPortGroupNum; 29350 break; 29351 case 3: 29352 fg_ptr->sel_codes[1].src_entity_sel = 29353 _bcmFieldFwdEntityMplsGport; 29354 break; 29355 case 2: 29356 fg_ptr->sel_codes[1].src_entity_sel = 29357 _bcmFieldFwdEntityModPortGport; 29358 break; 29359 case 1: 29360 fg_ptr->sel_codes[1].src_entity_sel = 29361 _bcmFieldFwdEntityGlp; 29362 break; 29363 default: 29364 fg_ptr->sel_codes[1].src_entity_sel = 29365 _FP_SELCODE_DONT_CARE; 29366 break; 29367 } 29368 } 29369 29370 if (paired && intraslice) { 29371 switch(hw_sel->sec_slice[0].src_entity_sel) 29372 { 29373 case 4: 29374 fg_ptr->sel_codes[2].src_entity_sel = 29375 _bcmFieldFwdEntityPortGroupNum; 29376 break; 29377 case 3: 29378 fg_ptr->sel_codes[2].src_entity_sel = 29379 _bcmFieldFwdEntityMplsGport; 29380 break; 29381 case 2: 29382 fg_ptr->sel_codes[2].src_entity_sel = 29383 _bcmFieldFwdEntityModPortGport; 29384 break; 29385 case 1: 29386 fg_ptr->sel_codes[2].src_entity_sel = 29387 _bcmFieldFwdEntityGlp; 29388 break; 29389 default: 29390 fg_ptr->sel_codes[2].src_entity_sel = 29391 _FP_SELCODE_DONT_CARE; 29392 break; 29393 } 29394 29395 switch(hw_sel->sec_slice[1].src_entity_sel) 29396 { 29397 case 4: 29398 fg_ptr->sel_codes[3].src_entity_sel = 29399 _bcmFieldFwdEntityPortGroupNum; 29400 break; 29401 case 3: 29402 fg_ptr->sel_codes[3].src_entity_sel = 29403 _bcmFieldFwdEntityMplsGport; 29404 break; 29405 case 2: 29406 fg_ptr->sel_codes[3].src_entity_sel = 29407 _bcmFieldFwdEntityModPortGport; 29408 break; 29409 case 1: 29410 fg_ptr->sel_codes[3].src_entity_sel = 29411 _bcmFieldFwdEntityGlp; 29412 break; 29413 default: 29414 fg_ptr->sel_codes[3].src_entity_sel = 29415 _FP_SELCODE_DONT_CARE; 29416 break; 29417 } 29418 29419 } 29420 29421 } 29422 29423 if (is_td2_td2p && (is_qset_conflict == 0) && 29424 (_BCM_FIELD_STAGE_INGRESS == stage_id) && 29425 ((fc->wb_recovered_version) < BCM_FIELD_WB_VERSION_1_18)) { 29426 _field_src_vp_selcode_resolve(0, fg_ptr, 1); 29427 } else { 29428 _field_src_vp_selcode_resolve(0, fg_ptr, 0); 29429 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 29430 bcmFieldQualifyInPort) || 29431 BCM_FIELD_QSET_TEST(fg_ptr->qset, 29432 bcmFieldQualifyInterfaceClassPort)) 29433 && (_BCM_FIELD_STAGE_LOOKUP == stage_id)) { 29434 /* Only for VFP. IFP uses IPBM for InPort */ 29435 if (_bcmFieldFwdEntityAny 29436 != fg_ptr->sel_codes[0].src_entity_sel) { 29437 fg_ptr->sel_codes[0].src_entity_sel = 29438 _bcmFieldFwdEntityPortGroupNum; 29439 } 29440 } 29441 29442 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 29443 bcmFieldQualifySrcVxlanGport)) || 29444 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 29445 bcmFieldQualifySrcVxlanGports))) { 29446 if (_FP_SELCODE_DONT_CARE 29447 != fg_ptr->sel_codes[0].ingress_entity_sel) { 29448 fg_ptr->sel_codes[0].ingress_entity_sel = 29449 _bcmFieldFwdEntityVxlanGport; 29450 } 29451 } 29452 } 29453 29454 29455 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 29456 bcmFieldQualifySrcVxlanGport)) || 29457 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 29458 bcmFieldQualifySrcVxlanGports))) { 29459 if (_FP_SELCODE_DONT_CARE 29460 != fg_ptr->sel_codes[0].ingress_entity_sel) { 29461 fg_ptr->sel_codes[0].ingress_entity_sel = 29462 _bcmFieldFwdEntityVxlanGport; 29463 } 29464 } 29465 29466 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 29467 bcmFieldQualifyDstVxlanGport)) || 29468 (BCM_FIELD_QSET_TEST(fg_ptr->qset, 29469 bcmFieldQualifyDstVxlanGports))) { 29470 if (_FP_SELCODE_DONT_CARE 29471 != fg_ptr->sel_codes[0].dst_fwd_entity_sel) { 29472 fg_ptr->sel_codes[0].dst_fwd_entity_sel = 29473 _bcmFieldFwdEntityVxlanGport; 29474 } 29475 } 29476 29477 /* If vpn qualifier is part of the qset, update the field group 29478 selector */ 29479 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyVpn)) { 29480 if (_bcmFieldFwdFieldAny 29481 != fg_ptr->sel_codes[0].fwd_field_sel) { 29482 fg_ptr->sel_codes[0].fwd_field_sel = _bcmFieldFwdFieldVpn; 29483 } 29484 } 29485 29486 /* If vrf qualifier is part of the qset, update the field group 29487 selector */ 29488 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyVrf)) { 29489 if (_bcmFieldFwdFieldAny 29490 != fg_ptr->sel_codes[0].fwd_field_sel) { 29491 fg_ptr->sel_codes[0].fwd_field_sel = _bcmFieldFwdFieldVrf; 29492 } 29493 } 29494 29495 /* If vlanid qualifier is part of the qset, update the field group 29496 selector */ 29497 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyForwardingVlanId)) { 29498 if (_bcmFieldFwdFieldAny 29499 != fg_ptr->sel_codes[0].fwd_field_sel) { 29500 fg_ptr->sel_codes[0].fwd_field_sel = _bcmFieldFwdFieldVlan; 29501 } 29502 } 29503 29504 /* If QSET has srcGport, the ingress entity select must to common gport */ 29505 if (hw_sel->pri_slice[0].ingress_entity_sel 29506 == _bcmFieldFwdEntityMimGport) { 29507 if (BCM_FIELD_QSET_TEST 29508 (fg_ptr->qset, bcmFieldQualifySrcGport) || 29509 BCM_FIELD_QSET_TEST 29510 (fg_ptr->qset, bcmFieldQualifySrcGports)) { 29511 fg_ptr->sel_codes[0].ingress_entity_sel = _bcmFieldFwdEntityCommonGport; 29512 } 29513 } 29514 } 29515 29516 if (port != -1) { 29517 BCM_PBMP_PORT_ADD(fg_ptr->pbmp, port); 29518 } else { 29519 if (soc_feature(unit, soc_feature_field_multi_pipe_support) && 29520 (stage_fc->oper_mode != bcmFieldGroupOperModeGlobal)) { 29521 SOC_PBMP_ASSIGN(fg_ptr->pbmp, PBMP_PIPE(unit, inst)); 29522 BCM_PBMP_REMOVE(fg_ptr->pbmp, PBMP_LB(unit)); 29523 } else { 29524 SOC_PBMP_CLEAR(all_pbmp); 29525 SOC_PBMP_ASSIGN(all_pbmp, PBMP_PORT_ALL(unit)); 29526 SOC_PBMP_OR(all_pbmp, PBMP_CMIC(unit)); 29527 #if defined(BCM_KATANA2_SUPPORT) 29528 if (soc_feature(unit, soc_feature_linkphy_coe) || 29529 soc_feature(unit, soc_feature_subtag_coe)) { 29530 _bcm_kt2_subport_pbmp_update(unit, &all_pbmp); 29531 } 29532 if (SOC_IS_KATANA2(unit) && soc_feature(unit, soc_feature_flex_port)) { 29533 #if defined(BCM_SABER2_SUPPORT) 29534 if((SOC_IS_SABER2(unit)) && 29535 (fc->wb_recovered_version < BCM_FIELD_WB_VERSION_1_19) && 29536 (bcm_sb2_wb_v2_flexio_update == 0)) { 29537 rv = _bcm_sb2_wb_v1_flexio_pbmp_update(unit, &all_pbmp); 29538 } else 29539 #endif 29540 { 29541 rv = (_bcm_kt2_flexio_pbmp_update(unit, &all_pbmp)); 29542 } 29543 if (BCM_FAILURE(rv)) { 29544 sal_free(fg_ptr); 29545 return rv; 29546 } 29547 } 29548 #endif 29549 SOC_PBMP_ASSIGN(fg_ptr->pbmp, all_pbmp); 29550 } 29551 } 29552 29553 /* double-wide but not paired */ 29554 if (intraslice) { 29555 fg_ptr->flags |= _FP_GROUP_INTRASLICE_DOUBLEWIDE; 29556 29557 if (fc->l2warm 29558 && (hw_sel->pri_slice[1].dst_fwd_entity_sel 29559 == _bcmFieldFwdEntityMimGport)) { 29560 /* Refine VP selectors only if it's used in hardware. */ 29561 _field_dst_vp_selcode_resolve(1, fg_ptr); 29562 } 29563 29564 if (fc->l2warm) { 29565 /* If QSET has srcGport, the ingress entity select must to common gport */ 29566 if (hw_sel->pri_slice[1].ingress_entity_sel 29567 == _bcmFieldFwdEntityMimGport) { 29568 if (BCM_FIELD_QSET_TEST 29569 (fg_ptr->qset, bcmFieldQualifySrcGport) || 29570 BCM_FIELD_QSET_TEST 29571 (fg_ptr->qset, bcmFieldQualifySrcGports)) { 29572 fg_ptr->sel_codes[1].ingress_entity_sel = _bcmFieldFwdEntityCommonGport; 29573 } 29574 } 29575 } 29576 } 29577 29578 if ((1 == paired) && (1 == intraslice)) { 29579 fg_ptr->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE; 29580 fg_ptr->flags |= _FP_GROUP_INTRASLICE_DOUBLEWIDE; 29581 29582 if (fc->l2warm) { 29583 /* Refine VP selectors only if it's used in hardware. */ 29584 if (hw_sel->sec_slice[0].dst_fwd_entity_sel 29585 == _bcmFieldFwdEntityMimGport) { 29586 _field_dst_vp_selcode_resolve(2, fg_ptr); 29587 } 29588 29589 if (is_td2_td2p && (is_qset_conflict == 0) && 29590 (_BCM_FIELD_STAGE_INGRESS == stage_id) && 29591 ((fc->wb_recovered_version) < BCM_FIELD_WB_VERSION_1_18)) { 29592 _field_src_vp_selcode_resolve(2, fg_ptr, 1); 29593 29594 } else { 29595 _field_src_vp_selcode_resolve(2, fg_ptr, 0); 29596 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 29597 bcmFieldQualifyInPort) || 29598 BCM_FIELD_QSET_TEST(fg_ptr->qset, 29599 bcmFieldQualifyInterfaceClassPort)) 29600 && (_BCM_FIELD_STAGE_LOOKUP == stage_id)) { 29601 /* Only for VFP. IFP uses IPBM for InPort */ 29602 if (_bcmFieldFwdEntityAny 29603 != fg_ptr->sel_codes[2].src_entity_sel) { 29604 fg_ptr->sel_codes[2].src_entity_sel = 29605 _bcmFieldFwdEntityPortGroupNum; 29606 } 29607 } 29608 } 29609 29610 /* part-4 */ 29611 if (hw_sel->sec_slice[1].dst_fwd_entity_sel 29612 == _bcmFieldFwdEntityMimGport) { 29613 _field_dst_vp_selcode_resolve(3, fg_ptr); 29614 } 29615 /* If vpn qualifier is part of the qset, update the field group 29616 selector */ 29617 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyVpn)) { 29618 if (_bcmFieldFwdFieldAny 29619 != fg_ptr->sel_codes[2].fwd_field_sel) { 29620 fg_ptr->sel_codes[2].fwd_field_sel = _bcmFieldFwdFieldVpn; 29621 } 29622 } 29623 29624 /* If vrf qualifier is part of the qset, update the field group 29625 selector */ 29626 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyVrf)) { 29627 if (_bcmFieldFwdFieldAny 29628 != fg_ptr->sel_codes[2].fwd_field_sel) { 29629 fg_ptr->sel_codes[2].fwd_field_sel = _bcmFieldFwdFieldVrf; 29630 } 29631 } 29632 29633 /* If vlanid qualifier is part of the qset, update the field group 29634 selector */ 29635 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyForwardingVlanId)) { 29636 if (_bcmFieldFwdFieldAny 29637 != fg_ptr->sel_codes[2].fwd_field_sel) { 29638 fg_ptr->sel_codes[2].fwd_field_sel = _bcmFieldFwdFieldVlan; 29639 } 29640 } 29641 29642 /* If QSET has srcGport, the ingress entity select must to common gport */ 29643 if (hw_sel->sec_slice[0].dst_fwd_entity_sel 29644 == _bcmFieldFwdEntityMimGport) { 29645 if (BCM_FIELD_QSET_TEST 29646 (fg_ptr->qset, bcmFieldQualifySrcGport) || 29647 BCM_FIELD_QSET_TEST 29648 (fg_ptr->qset, bcmFieldQualifySrcGports)) { 29649 fg_ptr->sel_codes[2].ingress_entity_sel = _bcmFieldFwdEntityCommonGport; 29650 } 29651 } 29652 } 29653 } else if ((1 == paired) && (0 == intraslice)) { 29654 /* paired but not intraslice */ 29655 fg_ptr->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE; 29656 29657 if (fc->l2warm) { 29658 /* part-2 */ 29659 /* Refine VP selectors only if it's used in hardware. */ 29660 if (hw_sel->sec_slice[0].dst_fwd_entity_sel 29661 == _bcmFieldFwdEntityMimGport) { 29662 _field_dst_vp_selcode_resolve(1, fg_ptr); 29663 } 29664 29665 if (is_td2_td2p && (is_qset_conflict == 0) && 29666 (_BCM_FIELD_STAGE_INGRESS == stage_id) && 29667 ((fc->wb_recovered_version) < BCM_FIELD_WB_VERSION_1_18)) { 29668 _field_src_vp_selcode_resolve(1, fg_ptr, 1); 29669 } else { 29670 _field_src_vp_selcode_resolve(1, fg_ptr, 0); 29671 if ((BCM_FIELD_QSET_TEST(fg_ptr->qset, 29672 bcmFieldQualifyInPort) || 29673 BCM_FIELD_QSET_TEST(fg_ptr->qset, 29674 bcmFieldQualifyInterfaceClassPort)) 29675 && (_BCM_FIELD_STAGE_LOOKUP == stage_id)) { 29676 /* Only for VFP. IFP uses IPBM for InPort */ 29677 if (_bcmFieldFwdEntityAny 29678 != fg_ptr->sel_codes[1].src_entity_sel) { 29679 fg_ptr->sel_codes[1].src_entity_sel = 29680 _bcmFieldFwdEntityPortGroupNum; 29681 } 29682 } 29683 } 29684 29685 29686 /* If vpn qualifier is part of the qset, update the field group 29687 selector */ 29688 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyVpn)) { 29689 if (_bcmFieldFwdFieldAny 29690 != fg_ptr->sel_codes[1].fwd_field_sel) { 29691 fg_ptr->sel_codes[1].fwd_field_sel = _bcmFieldFwdFieldVpn; 29692 } 29693 } 29694 29695 /* If vrf qualifier is part of the qset, update the field group 29696 selector */ 29697 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyVrf)) { 29698 if (_bcmFieldFwdFieldAny 29699 != fg_ptr->sel_codes[1].fwd_field_sel) { 29700 fg_ptr->sel_codes[1].fwd_field_sel = _bcmFieldFwdFieldVrf; 29701 } 29702 } 29703 29704 /* If vlanid qualifier is part of the qset, update the field group 29705 selector */ 29706 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyForwardingVlanId)) { 29707 if (_bcmFieldFwdFieldAny 29708 != fg_ptr->sel_codes[1].fwd_field_sel) { 29709 fg_ptr->sel_codes[1].fwd_field_sel = _bcmFieldFwdFieldVlan; 29710 } 29711 } 29712 29713 /* If QSET has srcGport, the ingress entity select must to common gport */ 29714 if (hw_sel->sec_slice[0].ingress_entity_sel 29715 == _bcmFieldFwdEntityMimGport) { 29716 if (BCM_FIELD_QSET_TEST 29717 (fg_ptr->qset, bcmFieldQualifySrcGport) || 29718 BCM_FIELD_QSET_TEST 29719 (fg_ptr->qset, bcmFieldQualifySrcGports)) { 29720 fg_ptr->sel_codes[1].ingress_entity_sel = _bcmFieldFwdEntityCommonGport; 29721 } 29722 } 29723 29724 } 29725 } else { 29726 fg_ptr->flags |= _FP_GROUP_SPAN_SINGLE_SLICE; 29727 } 29728 29729 #if defined(BCM_TRX_SUPPORT) 29730 /* Add Range check internal qualifier */ 29731 if (fc->l2warm && SOC_IS_TRX(unit) && (_BCM_FIELD_STAGE_INGRESS == stage_id)) { 29732 if (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifyRangeCheck) && 29733 !(BCM_FIELD_QSET_TEST(fg_ptr->qset, bcmFieldQualifyInterfaceClassPort) || 29734 BCM_FIELD_QSET_TEST(fg_ptr->qset, bcmFieldQualifyInterfaceClassL3) || 29735 BCM_FIELD_QSET_TEST(fg_ptr->qset, bcmFieldQualifyInterfaceClassVPort) || 29736 BCM_FIELD_QSET_TEST(fg_ptr->qset, bcmFieldQualifyInterfaceClassL2)) && 29737 BCM_FIELD_QSET_TEST(stage_fc->_field_supported_qset, 29738 _bcmFieldQualifyRangeCheckBits24_31)) { 29739 BCM_FIELD_QSET_ADD(fg_ptr->qset, _bcmFieldQualifyRangeCheckBits24_31); 29740 } 29741 } 29742 #endif 29743 29744 /* Skip qual offset construct for IFP and VFP stage 29745 * for the devices using sync function 29746 * _field_tr2_group_entry_write, quals add will be done as part of 29747 * _field_tr2_group_construct_quals_with_sel_update 29748 */ 29749 if (SOC_IS_ENDURO(unit) || SOC_IS_HURRICANE(unit) || 29750 SOC_IS_HURRICANE2(unit) || SOC_IS_GREYHOUND(unit) || 29751 (!(fc->l2warm && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) && 29752 ((_BCM_FIELD_STAGE_INGRESS == stage_id) || 29753 (_BCM_FIELD_STAGE_LOOKUP == stage_id))))) { 29754 if (SOC_IS_TRIDENT2(unit) && (_BCM_FIELD_STAGE_INGRESS == stage_id) && 29755 (BCM_FIELD_QSET_TEST (fg_ptr->qset, bcmFieldQualifySrcPort))) { 29756 if ((fg_ptr->sel_codes[0].src_entity_sel != _FP_SELCODE_DONT_CARE) && 29757 (fg_ptr->sel_codes[0].src_entity_sel != 0)) { 29758 fg_ptr->sel_codes[0].ingress_entity_sel = 29759 fg_ptr->sel_codes[0].src_entity_sel; 29760 fg_ptr->sel_codes[0].src_entity_sel = -1; 29761 } 29762 if (fg_ptr->flags & _FP_GROUP_SPAN_DOUBLE_SLICE ) { 29763 if ((fg_ptr->sel_codes[1].src_entity_sel != _FP_SELCODE_DONT_CARE) && 29764 (fg_ptr->sel_codes[1].src_entity_sel != 0)) { 29765 fg_ptr->sel_codes[1].ingress_entity_sel = 29766 fg_ptr->sel_codes[1].src_entity_sel; 29767 fg_ptr->sel_codes[1].src_entity_sel = -1; 29768 } 29769 } 29770 } 29771 29772 _field_tr2_group_construct_quals_add(unit, 29773 fc, 29774 stage_fc, 29775 fg_ptr 29776 ); 29777 } 29778 29779 /* Associate slice(s) to group */ 29780 if (fg_ptr->slices == NULL) { 29781 fg_ptr->slices = stage_fc->slices[inst] + slice_idx; 29782 if (1 == intraslice) { 29783 fg_ptr->slices->group_flags |= _FP_GROUP_INTRASLICE_DOUBLEWIDE; 29784 if (1 == paired) { 29785 fg_ptr->slices[1].group_flags |= 29786 _FP_GROUP_INTRASLICE_DOUBLEWIDE; 29787 } 29788 } 29789 } 29790 29791 BCM_PBMP_OR(fg_ptr->slices[0].pbmp, fg_ptr->pbmp); 29792 if (1 == paired) { 29793 BCM_PBMP_OR(fg_ptr->slices[1].pbmp, fg_ptr->pbmp); 29794 } 29795 29796 /* Initialize group default ASET list. */ 29797 rv = _field_group_default_aset_set(unit, fg_ptr); 29798 if (BCM_FAILURE(rv)) { 29799 return (rv); 29800 } 29801 29802 if (fc->l2warm 29803 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15)) { 29804 if (group_flags & _FP_GROUP_LOOKUP_ENABLED) { 29805 fg_ptr->flags = fg_ptr->flags | _FP_GROUP_LOOKUP_ENABLED; 29806 } 29807 if (group_flags & _FP_GROUP_WLAN) { 29808 fg_ptr->flags = fg_ptr->flags | _FP_GROUP_WLAN; 29809 } 29810 } else { 29811 fg_ptr->flags |= _FP_GROUP_LOOKUP_ENABLED; 29812 } 29813 29814 fg_ptr->next = fc->groups; 29815 fc->groups = fg_ptr; 29816 } 29817 29818 return rv; 29819 } 29820 29821 29822 /* Delete the qualifier at the given index from the given group's qualifier array */ 29823 29824 STATIC void 29825 _field_tr2_group_qual_del(_bcm_field_group_qual_t *grp_qual, unsigned idx) 29826 { 29827 uint16 *qidp = &grp_qual->qid_arr[idx]; 29828 _bcm_field_qual_offset_t *offsetp = &grp_qual->offset_arr[idx]; 29829 unsigned n; 29830 29831 /* Shuffle all qualifier entries down by one slot, overwriting the one to be deleted */ 29832 29833 for (n = grp_qual->size - 1 - idx; n; --n, ++qidp, ++offsetp) { 29834 qidp[0] = qidp[1]; 29835 offsetp[0] = offsetp[1]; 29836 } 29837 29838 /* Reduce qualifier count */ 29839 29840 --grp_qual->size; 29841 } 29842 29843 /* Eliminate duplicate (i.e. unused) qualifiers from a group's qualifier array */ 29844 29845 STATIC void 29846 _field_tr2_group_part_cleanup(_bcm_field_group_qual_t *grp_qual, uint8 *cnt_arr, 29847 uint32 *tcam_mask, int part_idx) 29848 { 29849 unsigned i; 29850 29851 for (i = 0; i < grp_qual->size; ) { 29852 _bcm_field_qual_offset_t *q = &grp_qual->offset_arr[i]; 29853 unsigned b = 0, b_set = 0, ct; 29854 uint8 *cntp = &cnt_arr[grp_qual->qid_arr[i]]; 29855 29856 if ((*cntp == 1) 29857 || ((0 == part_idx) 29858 && (bcmFieldQualifyInPort == grp_qual->qid_arr[i] 29859 || bcmFieldQualifyInPorts == grp_qual->qid_arr[i] 29860 || bcmFieldQualifyStage == grp_qual->qid_arr[i] 29861 || bcmFieldQualifyStageIngress == grp_qual->qid_arr[i] 29862 || bcmFieldQualifyStageLookup == grp_qual->qid_arr[i] 29863 || bcmFieldQualifyStageExternal == grp_qual->qid_arr[i] 29864 || bcmFieldQualifyStageEgress == grp_qual->qid_arr[i]))) { 29865 /* Qualifier appears only once OR dup qualifier should not 29866 * be removed from primary part_idx. 29867 * => Don't delete it from the group. 29868 */ 29869 ++i; 29870 29871 continue; 29872 } 29873 29874 /* Check the qualifier against the given TCAM mask */ 29875 for (ct = 0; ct < q->num_offsets; ct++) { 29876 SHR_BITTEST_RANGE(tcam_mask, q->offset[ct], q->width[ct], b); 29877 b_set |= b; 29878 } 29879 29880 if (b_set) { 29881 /* Qualifier is in use (i.e. has a non-empty mask) 29882 => Don't delete it from the group. 29883 */ 29884 29885 ++i; 29886 29887 continue; 29888 } 29889 29890 /* Qualifier appears more than once, and this instance does not 29891 appear in the given TCAM mask 29892 => Delete qualifier from group. 29893 */ 29894 29895 _field_tr2_group_qual_del(grp_qual, i); 29896 --*cntp; 29897 } 29898 } 29899 29900 int 29901 _field_tr2_pbmp_status_get_from_fp_gm(int unit, int phys_tcam_idx, 29902 uint8 *clearInPorts, 29903 _field_table_pointers_t *fp_table_pointers) 29904 { 29905 fp_global_mask_tcam_entry_t *global_mask_tcam_entry; 29906 fp_tcam_entry_t *tcam_entry; 29907 bcm_pbmp_t entry_pbmp, entry_mask_pbmp; 29908 #if (defined (BCM_TRIDENT_SUPPORT) || defined(BCM_SCORPION_SUPPORT) || defined(BCM_CONQUEROR_SUPPORT)) 29909 bcm_pbmp_t temp_pbmp, temp_pbm_mask; 29910 #endif 29911 uint32 *fp_tcam_buf = NULL; 29912 char *fp_gm_tcam_buf = NULL; /* Buffer to read the 29913 * FP_GLOBAL_MASK_TCAM 29914 * table */ 29915 29916 #if defined(BCM_TRIDENT_SUPPORT) 29917 char *fp_gm_tcam_x_buf = NULL; /* Buffer to read 29918 * FP_GLOBAL_MASK_TCAM_Y 29919 * table. */ 29920 fp_global_mask_tcam_x_entry_t *fp_gm_tcam_x_entry; /* Pointer to 29921 * FP_GLOBAL_MASK_TCAM_Y 29922 * entry */ 29923 char *fp_gm_tcam_y_buf = NULL; /* Buffer to read 29924 * FP_GLOBAL_MASK_TCAM_Y 29925 * table. */ 29926 fp_global_mask_tcam_y_entry_t *fp_gm_tcam_y_entry; /* Pointer to 29927 * FP_GLOBAL_MASK_TCAM_Y 29928 * entry */ 29929 #endif 29930 #if defined(BCM_SCORPION_SUPPORT) || defined(BCM_CONQUEROR_SUPPORT) 29931 uint32 tcam_dual_pipe_entry[SOC_MAX_MEM_FIELD_WORDS]; /* Y-Pipe FP_TCAM 29932 * entry. */ 29933 #endif 29934 29935 29936 if ((NULL == clearInPorts) || (NULL == fp_table_pointers)) { 29937 return (BCM_E_INTERNAL); 29938 } 29939 29940 BCM_PBMP_CLEAR(entry_pbmp); 29941 BCM_PBMP_CLEAR(entry_mask_pbmp); 29942 #if (defined (BCM_TRIDENT_SUPPORT) || defined(BCM_SCORPION_SUPPORT) || defined(BCM_CONQUEROR_SUPPORT)) 29943 BCM_PBMP_CLEAR(temp_pbmp); 29944 BCM_PBMP_CLEAR(temp_pbm_mask); 29945 #endif 29946 29947 if (soc_mem_is_valid(unit, FP_GLOBAL_MASK_TCAMm)) { 29948 #if defined (BCM_TRIDENT_SUPPORT) 29949 if (SOC_IS_TD_TT(unit) && 29950 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Xm) && 29951 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Ym)) { 29952 29953 fp_gm_tcam_x_buf = fp_table_pointers->fp_gm_tcam_x_buf; 29954 fp_gm_tcam_y_buf = fp_table_pointers->fp_gm_tcam_y_buf; 29955 29956 if ((NULL == fp_gm_tcam_x_buf) || (NULL == fp_gm_tcam_y_buf )) { 29957 return (BCM_E_INTERNAL); 29958 } 29959 29960 /* Get X-Pipe IPBM KEY and MASK value. */ 29961 fp_gm_tcam_x_entry = soc_mem_table_idx_to_pointer(unit, 29962 FP_GLOBAL_MASK_TCAM_Xm, 29963 fp_global_mask_tcam_x_entry_t *, 29964 fp_gm_tcam_x_buf, 29965 phys_tcam_idx); 29966 soc_mem_pbmp_field_get(unit, 29967 FP_GLOBAL_MASK_TCAM_Xm, 29968 fp_gm_tcam_x_entry, 29969 IPBMf, 29970 &entry_pbmp); 29971 soc_mem_pbmp_field_get(unit, 29972 FP_GLOBAL_MASK_TCAM_Xm, 29973 fp_gm_tcam_x_entry, 29974 IPBM_MASKf, 29975 &entry_mask_pbmp); 29976 29977 /* Get Y-Pipe IPBM KEY and MASK value. */ 29978 fp_gm_tcam_y_entry = soc_mem_table_idx_to_pointer(unit, 29979 FP_GLOBAL_MASK_TCAM_Ym, 29980 fp_global_mask_tcam_y_entry_t *, 29981 fp_gm_tcam_y_buf, 29982 phys_tcam_idx); 29983 soc_mem_pbmp_field_get(unit, 29984 FP_GLOBAL_MASK_TCAM_Ym, 29985 fp_gm_tcam_y_entry, 29986 IPBMf, 29987 &temp_pbmp); 29988 soc_mem_pbmp_field_get(unit, 29989 FP_GLOBAL_MASK_TCAM_Ym, 29990 fp_gm_tcam_y_entry, 29991 IPBM_MASKf, 29992 &temp_pbm_mask); 29993 SOC_PBMP_OR(entry_pbmp, temp_pbmp); 29994 SOC_PBMP_OR(entry_mask_pbmp, temp_pbm_mask); 29995 } else 29996 #endif 29997 { 29998 fp_gm_tcam_buf = fp_table_pointers->fp_global_mask_tcam_buf; 29999 30000 if (NULL == fp_gm_tcam_buf) { 30001 return BCM_E_INTERNAL; 30002 } 30003 global_mask_tcam_entry = soc_mem_table_idx_to_pointer(unit, 30004 FP_GLOBAL_MASK_TCAMm, 30005 fp_global_mask_tcam_entry_t *, 30006 fp_gm_tcam_buf, 30007 phys_tcam_idx); 30008 soc_mem_pbmp_field_get(unit, 30009 FP_GLOBAL_MASK_TCAMm, 30010 global_mask_tcam_entry, 30011 IPBMf, 30012 &entry_pbmp); 30013 soc_mem_pbmp_field_get(unit, 30014 FP_GLOBAL_MASK_TCAMm, 30015 global_mask_tcam_entry, 30016 IPBM_MASKf, 30017 &entry_mask_pbmp); 30018 } 30019 30020 } else { 30021 30022 fp_tcam_buf = fp_table_pointers->fp_tcam_buf; 30023 if (NULL == fp_tcam_buf) { 30024 return BCM_E_INTERNAL; 30025 } 30026 tcam_entry = soc_mem_table_idx_to_pointer(unit, FP_TCAMm, 30027 fp_tcam_entry_t *, 30028 fp_tcam_buf, 30029 phys_tcam_idx); 30030 30031 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 0) { 30032 return BCM_E_INTERNAL; 30033 } 30034 30035 30036 soc_mem_pbmp_field_get(unit, 30037 FP_TCAMm, 30038 tcam_entry, 30039 IPBMf, 30040 &entry_pbmp); 30041 soc_mem_pbmp_field_get(unit, 30042 FP_TCAMm, 30043 tcam_entry, 30044 IPBM_MASKf, 30045 &entry_mask_pbmp); 30046 #if defined(BCM_SCORPION_SUPPORT) || defined(BCM_CONQUEROR_SUPPORT) 30047 /* 30048 * Scorpion and Conqurer are dual pipe line devices. 30049 * Retrieve IPBMf and IPBM_MASKf field values from Y Pipleline 30050 * FP_TCAM table. 30051 */ 30052 if (SOC_IS_SC_CQ(unit)) { 30053 sal_memset(&tcam_dual_pipe_entry, 0,sizeof(tcam_dual_pipe_entry)); 30054 30055 BCM_IF_ERROR_RETURN(soc_mem_read(unit, FP_TCAM_Ym, MEM_BLOCK_ANY, 30056 phys_tcam_idx, tcam_dual_pipe_entry)); 30057 30058 soc_mem_pbmp_field_get(unit, 30059 FP_TCAM_Ym, 30060 tcam_dual_pipe_entry, 30061 IPBMf, 30062 &temp_pbmp); 30063 soc_mem_pbmp_field_get(unit, 30064 FP_TCAM_Ym, 30065 tcam_dual_pipe_entry, 30066 IPBM_MASKf, 30067 &temp_pbm_mask); 30068 SOC_PBMP_OR(entry_pbmp, temp_pbmp); 30069 SOC_PBMP_OR(entry_mask_pbmp, temp_pbm_mask); 30070 } 30071 #endif 30072 30073 } 30074 30075 if(BCM_PBMP_IS_NULL(entry_pbmp) && BCM_PBMP_IS_NULL(entry_mask_pbmp)) { 30076 *clearInPorts = 1; 30077 } else { 30078 *clearInPorts = 0; 30079 } 30080 30081 return BCM_E_NONE; 30082 } 30083 30084 /* Eliminate duplicate qualifiers from all groups in the given stage */ 30085 30086 int 30087 _field_tr2_stage_reinit_all_groups_cleanup(int unit, 30088 _field_control_t *fc, 30089 unsigned stage_id, 30090 _field_table_pointers_t *fp_table_pointers) 30091 { 30092 int idx, rv = BCM_E_NONE; 30093 uint8 clear_inports = 0, installed_entry_found = 0; 30094 unsigned cnt_arr_sz; 30095 uint8 *cnt_arr; 30096 uint8 e_type = _FP_ENTRY_TYPE_DEFAULT; /* Entry type */ 30097 _field_group_t *fg; 30098 _field_entry_t *f_ent = NULL; 30099 30100 30101 cnt_arr_sz = _bcmFieldQualifyCount * sizeof(cnt_arr[0]); 30102 if ((cnt_arr = (uint8 *) sal_alloc(cnt_arr_sz, "qual cnt array")) == 0) { 30103 return (BCM_E_MEMORY); 30104 } 30105 30106 /* For all groups, ... */ 30107 30108 for (fg = fc->groups; fg; fg = fg->next) { 30109 int parts_cnt, part_idx; 30110 unsigned duplf; 30111 30112 /* In the given stage, ... */ 30113 30114 if (fg->stage_id != stage_id) { 30115 continue; 30116 } 30117 30118 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 30119 fg->flags, &parts_cnt); 30120 if (BCM_FAILURE(rv)) { 30121 goto cleanup; 30122 } 30123 30124 /* Construct an array of counts, 1 per qualifier, and set each count 30125 to the number times the qualifier occurs in the given group 30126 */ 30127 30128 for (e_type = 0; e_type < _FP_MAX_ENTRY_TYPES; e_type++) { 30129 30130 /* No Default entry exists only for EFP. */ 30131 if (_FP_ENTRY_TYPE_DEFAULT != e_type) { 30132 30133 if (_BCM_FIELD_STAGE_EGRESS != stage_id) { 30134 break; 30135 } 30136 30137 /* Prior to TD2 SDK maintains only _FP_ENTRY_TYPE_DEFAULT */ 30138 if (!SOC_IS_TD2_TT2(unit)) { 30139 break; 30140 } 30141 } 30142 30143 sal_memset(cnt_arr, 0, cnt_arr_sz); 30144 duplf = FALSE; 30145 for (part_idx = 0; part_idx < parts_cnt; ++part_idx) { 30146 _bcm_field_group_qual_t *grp_qual = 30147 &fg->qual_arr[e_type][part_idx]; 30148 unsigned i; 30149 30150 /* Construct an array of counts, 1 per qualifier, and set each 30151 * count to the number times the qualifier occurs in the given 30152 * group 30153 */ 30154 30155 for (i = 0; i < grp_qual->size; ++i) { 30156 if (++cnt_arr[grp_qual->qid_arr[i]] > 1) { 30157 /* Count for a qualifier just exceeded 1 */ 30158 /* Indicate there are duplicate qualifiers */ 30159 duplf = TRUE; 30160 } 30161 } 30162 } 30163 30164 if (!duplf) { 30165 /* No duplicate qualifiers => Skip to next group */ 30166 continue; 30167 } 30168 30169 /* There are some duplicate qualifiers 30170 * => Compute the union of all TCAM masks, over all entries in 30171 * group, and use that to determine which qualifiers are in use. 30172 */ 30173 30174 for (part_idx = 0; part_idx < parts_cnt; ++part_idx) { 30175 _bcm_field_group_qual_t *grp_qual = 30176 &fg->qual_arr[e_type][part_idx]; 30177 unsigned i; 30178 uint32 tcam_mask[SOC_MAX_MEM_FIELD_WORDS]; 30179 30180 sal_memset(tcam_mask, 0, sizeof(tcam_mask)); 30181 30182 for (i = 0; i < fg->group_status.entry_count; ++i) { 30183 _field_entry_t *f_ent = &fg->entry_arr[i][part_idx]; 30184 unsigned free_entry_tcam_buff = (f_ent->tcam.key == 0); 30185 unsigned j; 30186 30187 rv = _bcm_field_qual_tcam_key_mask_get(unit, f_ent); 30188 if (BCM_FAILURE(rv)) { 30189 goto cleanup; 30190 } 30191 30192 for (j = 0; 30193 j < (f_ent->tcam.key_size / sizeof(uint32)); ++j) { 30194 tcam_mask[j] |= f_ent->tcam.mask[j]; 30195 } 30196 30197 if (free_entry_tcam_buff) { 30198 if (f_ent->tcam.key != 0) { 30199 sal_free(f_ent->tcam.key); 30200 sal_free(f_ent->tcam.mask); 30201 } 30202 30203 if (f_ent->flags & _FP_ENTRY_USES_IPBM_OVERLAY) { 30204 if (f_ent->extra_tcam.key != 0) { 30205 sal_free(f_ent->extra_tcam.key); 30206 sal_free(f_ent->extra_tcam.mask); 30207 } 30208 } 30209 30210 f_ent->tcam.key 30211 = f_ent->tcam.mask 30212 = f_ent->extra_tcam.key 30213 = f_ent->extra_tcam.mask 30214 = 0; 30215 } 30216 } 30217 30218 /* Use the union of all TCAM masks for all entries in the group to 30219 eliminate duplicate qualifiers from group 30220 */ 30221 30222 _field_tr2_group_part_cleanup(grp_qual, cnt_arr, 30223 tcam_mask, part_idx); 30224 } 30225 30226 if (_BCM_FIELD_STAGE_INGRESS == stage_id) { 30227 30228 if (BCM_FIELD_QSET_TEST(fg->qset,bcmFieldQualifyLoopback) || 30229 BCM_FIELD_QSET_TEST(fg->qset,bcmFieldQualifyLoopbackType)) { 30230 30231 clear_inports = 0; 30232 installed_entry_found = 0; 30233 30234 for(idx = 0; idx < fg->group_status.entry_count; idx++) { 30235 f_ent = fg->entry_arr[idx]; 30236 if (_FP_ENTRY_INSTALLED & f_ent->flags) { 30237 installed_entry_found =1; 30238 break; 30239 } 30240 } 30241 30242 if (installed_entry_found) { 30243 30244 rv = _field_tr2_pbmp_status_get_from_fp_gm(unit, 30245 f_ent->slice_idx, 30246 &clear_inports, 30247 fp_table_pointers); 30248 if (BCM_FAILURE(rv)) { 30249 goto cleanup; 30250 } 30251 30252 if (clear_inports) { 30253 BCM_FIELD_QSET_REMOVE(fg->qset, 30254 bcmFieldQualifyInPort); 30255 BCM_FIELD_QSET_REMOVE(fg->qset, 30256 bcmFieldQualifyInPorts); 30257 } 30258 } 30259 } 30260 } 30261 } 30262 } 30263 30264 cleanup: 30265 sal_free(cnt_arr); 30266 30267 return (rv); 30268 } 30269 30270 30271 int 30272 _field_tr2_ifp_slice_expanded_status_get(int unit, 30273 _field_control_t *fc, 30274 _field_stage_t *stage_fc, 30275 int *expanded, 30276 int *slice_master_idx 30277 ) 30278 { 30279 static const soc_field_t ifp_virtual_to_physical_map_tr[][16] = { 30280 { VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30281 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30282 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30283 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30284 VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30285 VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30286 VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30287 VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30288 VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30289 VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30290 VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30291 VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30292 VIRTUAL_SLICE_12_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30293 VIRTUAL_SLICE_13_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30294 VIRTUAL_SLICE_14_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 30295 VIRTUAL_SLICE_15_PHYSICAL_SLICE_NUMBER_ENTRY_0f 30296 30297 }, 30298 { VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30299 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30300 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30301 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30302 VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30303 VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30304 VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30305 VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30306 VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30307 VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30308 VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30309 VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30310 VIRTUAL_SLICE_12_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30311 VIRTUAL_SLICE_13_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30312 VIRTUAL_SLICE_14_PHYSICAL_SLICE_NUMBER_ENTRY_1f, 30313 VIRTUAL_SLICE_15_PHYSICAL_SLICE_NUMBER_ENTRY_1f 30314 30315 }, 30316 { VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30317 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30318 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30319 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30320 VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30321 VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30322 VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30323 VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30324 VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30325 VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30326 VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30327 VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30328 VIRTUAL_SLICE_12_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30329 VIRTUAL_SLICE_13_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30330 VIRTUAL_SLICE_14_PHYSICAL_SLICE_NUMBER_ENTRY_2f, 30331 VIRTUAL_SLICE_15_PHYSICAL_SLICE_NUMBER_ENTRY_2f 30332 } 30333 }; 30334 static const soc_field_t ifp_virtual_to_group_map_tr[][16] = { 30335 { VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30336 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30337 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30338 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30339 VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30340 VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30341 VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30342 VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30343 VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30344 VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30345 VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30346 VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30347 VIRTUAL_SLICE_12_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30348 VIRTUAL_SLICE_13_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30349 VIRTUAL_SLICE_14_VIRTUAL_SLICE_GROUP_ENTRY_0f, 30350 VIRTUAL_SLICE_15_VIRTUAL_SLICE_GROUP_ENTRY_0f 30351 30352 }, 30353 { VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30354 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30355 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30356 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30357 VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30358 VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30359 VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30360 VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30361 VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30362 VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30363 VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30364 VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30365 VIRTUAL_SLICE_12_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30366 VIRTUAL_SLICE_13_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30367 VIRTUAL_SLICE_14_VIRTUAL_SLICE_GROUP_ENTRY_1f, 30368 VIRTUAL_SLICE_15_VIRTUAL_SLICE_GROUP_ENTRY_1f 30369 }, 30370 { VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30371 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30372 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30373 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30374 VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30375 VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30376 VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30377 VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30378 VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30379 VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30380 VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30381 VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30382 VIRTUAL_SLICE_12_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30383 VIRTUAL_SLICE_13_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30384 VIRTUAL_SLICE_14_VIRTUAL_SLICE_GROUP_ENTRY_2f, 30385 VIRTUAL_SLICE_15_VIRTUAL_SLICE_GROUP_ENTRY_2f 30386 } 30387 }; 30388 30389 int i, vmap, vmap_cnt, vslice, slice_idx, vgroup = -1, max = -1; 30390 int nslices; 30391 fp_slice_map_entry_t map_entry; 30392 soc_field_t fld; 30393 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 30394 30395 if (!soc_mem_field_valid(unit, 30396 FP_SLICE_MAPm, 30397 ifp_virtual_to_physical_map_tr[0][0] 30398 ) 30399 ) { 30400 /* Fall back to Firebolt */ 30401 30402 return (_field_slice_expanded_status_get(unit, fc, stage_fc, expanded, slice_master_idx)); 30403 } 30404 30405 BCM_IF_ERROR_RETURN(READ_FP_SLICE_MAPm(unit, MEM_BLOCK_ANY, 0, &map_entry)); 30406 nslices = stage_fc->tcam_slices; 30407 /* Iterate over virtual slices to get physical slices and virtual groups */ 30408 30409 30410 30411 vmap_cnt = 30412 /* Trident uses the field nomenclature from TR2, but has only 1 vmap */ 30413 (SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) ? 1 : _FP_VMAP_CNT; 30414 30415 for (vmap = 0; vmap < vmap_cnt; ++vmap) { 30416 for (vslice = 0; vslice < nslices; vslice++) { 30417 fld = ifp_virtual_to_physical_map_tr[vmap][vslice]; 30418 if (!soc_mem_field_valid(unit,FP_SLICE_MAPm,fld)) { 30419 continue; 30420 } 30421 slice_idx = soc_FP_SLICE_MAPm_field32_get(unit, &map_entry, fld); 30422 /* Now get virtual group for this virtual slice */ 30423 fld = ifp_virtual_to_group_map_tr[vmap][vslice]; 30424 if (!soc_mem_field_valid(unit,FP_SLICE_MAPm,fld)) { 30425 continue; 30426 } 30427 vgroup = soc_FP_SLICE_MAPm_field32_get(unit, &map_entry, fld); 30428 /* Phys slice_idx <=> virtual vslice <=> vgroup */ 30429 stage_fc->vmap[_FP_DEF_INST][vmap][vslice].vmap_key = slice_idx; 30430 stage_fc->vmap[_FP_DEF_INST][vmap][vslice].virtual_group = vgroup; 30431 stage_fc->vmap[_FP_DEF_INST][vmap][vslice].priority = vgroup; 30432 30433 } 30434 30435 /* See if virtual slice is the highest number in the virtual group */ 30436 for (vslice = 0; (vslice < nslices) && (vmap == 0); vslice++) { 30437 max = -1; 30438 for (i = 0; i < nslices; i++) { 30439 if ((stage_fc->vmap[_FP_DEF_INST][vmap][vslice].virtual_group == 30440 stage_fc->vmap[_FP_DEF_INST][vmap][i].virtual_group)) { 30441 if (i > max) { 30442 max = i; 30443 } 30444 } 30445 } 30446 30447 if (!((fc->l2warm) 30448 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8))) { 30449 if ((max != vslice) && (max != -1)) { 30450 expanded[stage_fc->vmap[_FP_DEF_INST][vmap][vslice].vmap_key] = 1; 30451 } 30452 } 30453 } 30454 } 30455 30456 /* Software mantains 3 MAPS, make them identical if only 1 map is present */ 30457 if ((stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) 30458 && (vmap_cnt == 1)) { 30459 for (vmap = 1; vmap < _FP_VMAP_CNT; ++vmap) { 30460 for (vslice = 0; vslice < nslices; vslice++) { 30461 stage_fc->vmap[_FP_DEF_INST][vmap][vslice] = 30462 stage_fc->vmap[_FP_DEF_INST][0][vslice]; 30463 } 30464 } 30465 } 30466 30467 if ((fc->l2warm) 30468 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8)) { 30469 for (i = 0; i < nslices; i++) { 30470 expanded[i] = buf[fc->scache_pos] & 0x1; 30471 slice_master_idx[i] = buf[fc->scache_pos] >> 1; 30472 30473 LOG_DEBUG(BSL_LS_BCM_FP, 30474 (BSL_META_U(unit, 30475 "_field_tr2_ifp_slice_expanded_status_get: Read slice %d" 30476 " map expanded %d master slice %d @ byte %d...\n"), 30477 i, expanded[i], slice_master_idx[i], fc->scache_pos)); 30478 30479 fc->scache_pos++; 30480 } 30481 } 30482 30483 return BCM_E_NONE; 30484 } 30485 30486 int _field_entry_oam_wb_scache_sync (int unit, _field_control_t *fc, 30487 _field_stage_t *stage_fc, uint8 *scache_ptr, 30488 _field_entry_oam_wb_t *f_ent_oam_wb) 30489 { 30490 uint8 *curr_scache_ptr = scache_ptr; /* Scache Pointer */ 30491 int oam_stat_size = 0; 30492 _field_extended_stat_wb_t *extended_stat_wb = NULL; 30493 30494 if ((fc == NULL) || (stage_fc == NULL) 30495 || (scache_ptr == NULL) || (f_ent_oam_wb == NULL)) { 30496 return BCM_E_PARAM; 30497 } 30498 30499 if ((stage_fc->stage_id != _BCM_FIELD_STAGE_INGRESS) 30500 && (stage_fc->stage_id != _BCM_FIELD_STAGE_EGRESS)) { 30501 return BCM_E_NONE; 30502 } 30503 30504 sal_memcpy (curr_scache_ptr, 30505 &(f_ent_oam_wb->is_present_bmp), sizeof (uint32)); 30506 fc->scache_pos += sizeof (uint32); 30507 curr_scache_ptr += sizeof (uint32); 30508 30509 if (soc_feature(unit, soc_feature_fp_based_oam)) { 30510 if (f_ent_oam_wb->is_present_bmp & _FP_OAM_STAT_ACTION_WB_SYNC) { 30511 sal_memcpy (curr_scache_ptr, 30512 &(f_ent_oam_wb->oam_stat_action_count), sizeof (uint8)); 30513 fc->scache_pos += sizeof (uint8); 30514 curr_scache_ptr += sizeof (uint8); 30515 30516 oam_stat_size = sizeof (_field_oam_stat_action_wb_t) 30517 * f_ent_oam_wb->oam_stat_action_count; 30518 sal_memcpy (curr_scache_ptr, 30519 (f_ent_oam_wb->oam_stat_action_wb), oam_stat_size); 30520 fc->scache_pos += oam_stat_size; 30521 curr_scache_ptr += oam_stat_size; 30522 } 30523 } 30524 30525 if (f_ent_oam_wb->is_present_bmp & _FP_EXTENDED_STATS_WB_SYNC) { 30526 extended_stat_wb = f_ent_oam_wb->extended_stat_wb; 30527 if (extended_stat_wb != NULL) { 30528 sal_memcpy (curr_scache_ptr, &(extended_stat_wb->stat_id), 30529 sizeof (extended_stat_wb->stat_id)); 30530 fc->scache_pos += sizeof (extended_stat_wb->stat_id); 30531 curr_scache_ptr += sizeof (extended_stat_wb->stat_id); 30532 30533 sal_memcpy (curr_scache_ptr, &(extended_stat_wb->flex_mode), 30534 sizeof (extended_stat_wb->flex_mode)); 30535 fc->scache_pos += sizeof (extended_stat_wb->flex_mode); 30536 curr_scache_ptr += sizeof (extended_stat_wb->flex_mode); 30537 30538 sal_memcpy (curr_scache_ptr, &(extended_stat_wb->hw_flags), 30539 sizeof (extended_stat_wb->hw_flags)); 30540 fc->scache_pos += sizeof (extended_stat_wb->hw_flags); 30541 curr_scache_ptr += sizeof (extended_stat_wb->hw_flags); 30542 30543 sal_memcpy (curr_scache_ptr, &(extended_stat_wb->flex_stat_map), 30544 sizeof (extended_stat_wb->flex_stat_map)); 30545 fc->scache_pos += sizeof (extended_stat_wb->flex_stat_map); 30546 curr_scache_ptr += sizeof (extended_stat_wb->flex_stat_map); 30547 } 30548 } 30549 30550 return BCM_E_NONE; 30551 } 30552 30553 30554 int _field_entry_oam_wb_scache_recover (int unit, _field_control_t *fc, 30555 _field_stage_t *stage_fc, uint8 *scache_ptr, 30556 _field_entry_oam_wb_t *f_ent_oam_wb) 30557 { 30558 uint8 *curr_scache_ptr = scache_ptr; /* Scache Pointer */ 30559 int oam_stat_size = 0; 30560 _field_extended_stat_wb_t *extended_stat_wb = NULL; 30561 30562 if ((fc == NULL) || (stage_fc == NULL) 30563 || (scache_ptr == NULL) || (f_ent_oam_wb == NULL)) { 30564 return BCM_E_PARAM; 30565 } 30566 30567 if ((stage_fc->stage_id != _BCM_FIELD_STAGE_INGRESS) && 30568 (stage_fc->stage_id != _BCM_FIELD_STAGE_EGRESS)) { 30569 return BCM_E_NONE; 30570 } 30571 30572 sal_memcpy (&(f_ent_oam_wb->is_present_bmp), 30573 curr_scache_ptr,sizeof (uint32)); 30574 fc->scache_pos += sizeof (uint32); 30575 curr_scache_ptr += sizeof (uint32); 30576 30577 if (soc_feature(unit, soc_feature_fp_based_oam)) { 30578 if (f_ent_oam_wb->is_present_bmp & _FP_OAM_STAT_ACTION_WB_SYNC) { 30579 sal_memcpy (&(f_ent_oam_wb->oam_stat_action_count), 30580 curr_scache_ptr, sizeof (uint8)); 30581 fc->scache_pos += sizeof (uint8); 30582 curr_scache_ptr += sizeof (uint8); 30583 30584 oam_stat_size = sizeof (_field_oam_stat_action_wb_t) 30585 * f_ent_oam_wb->oam_stat_action_count; 30586 _FP_XGS3_ALLOC(f_ent_oam_wb->oam_stat_action_wb, 30587 oam_stat_size, "Oam Stat Warmboot"); 30588 if (f_ent_oam_wb->oam_stat_action_wb == NULL) { 30589 return BCM_E_MEMORY; 30590 } 30591 30592 sal_memcpy ((f_ent_oam_wb->oam_stat_action_wb), 30593 curr_scache_ptr,oam_stat_size); 30594 fc->scache_pos += oam_stat_size; 30595 curr_scache_ptr += oam_stat_size; 30596 } 30597 } 30598 30599 if (f_ent_oam_wb->is_present_bmp & _FP_EXTENDED_STATS_WB_SYNC) { 30600 _FP_XGS3_ALLOC(f_ent_oam_wb->extended_stat_wb, 30601 (sizeof (_field_extended_stat_wb_t)), 30602 "Extended Stat WB"); 30603 if (f_ent_oam_wb->extended_stat_wb == NULL) { 30604 return BCM_E_MEMORY; 30605 } 30606 extended_stat_wb = f_ent_oam_wb->extended_stat_wb; 30607 if (extended_stat_wb != NULL) { 30608 sal_memcpy (&(extended_stat_wb->stat_id), curr_scache_ptr, 30609 sizeof (extended_stat_wb->stat_id)); 30610 fc->scache_pos += sizeof(extended_stat_wb->stat_id); 30611 curr_scache_ptr += sizeof(extended_stat_wb->stat_id); 30612 30613 sal_memcpy (&(extended_stat_wb->flex_mode), curr_scache_ptr, 30614 sizeof (extended_stat_wb->flex_mode)); 30615 fc->scache_pos += sizeof (extended_stat_wb->flex_mode); 30616 curr_scache_ptr += sizeof (extended_stat_wb->flex_mode); 30617 30618 sal_memcpy (&(extended_stat_wb->hw_flags), curr_scache_ptr, 30619 sizeof (extended_stat_wb->hw_flags)); 30620 fc->scache_pos += sizeof (extended_stat_wb->hw_flags); 30621 curr_scache_ptr += sizeof (extended_stat_wb->hw_flags); 30622 30623 sal_memcpy (&(extended_stat_wb->flex_stat_map), curr_scache_ptr, 30624 sizeof (extended_stat_wb->flex_stat_map)); 30625 fc->scache_pos += sizeof (extended_stat_wb->flex_stat_map); 30626 curr_scache_ptr += sizeof (extended_stat_wb->flex_stat_map); 30627 } 30628 } 30629 30630 return BCM_E_NONE; 30631 } 30632 30633 int _field_entry_oam_wb_free (int unit, _field_entry_oam_wb_t **f_ent_oam_wb) 30634 { 30635 if (f_ent_oam_wb == NULL) { 30636 return BCM_E_PARAM; 30637 } 30638 30639 if (*f_ent_oam_wb == NULL) { 30640 return BCM_E_NONE; 30641 } 30642 30643 if ((*f_ent_oam_wb)->oam_stat_action_wb != NULL) { 30644 sal_free ((*f_ent_oam_wb)->oam_stat_action_wb); 30645 (*f_ent_oam_wb)->oam_stat_action_wb = NULL; 30646 } 30647 30648 if ((*f_ent_oam_wb)->extended_stat_wb != NULL) { 30649 sal_free ((*f_ent_oam_wb)->extended_stat_wb); 30650 (*f_ent_oam_wb)->extended_stat_wb = NULL; 30651 } 30652 30653 sal_free (*f_ent_oam_wb); 30654 *f_ent_oam_wb = NULL; 30655 30656 return BCM_E_NONE; 30657 } 30658 30659 /* 30660 * Function: 30661 * _field_trx_meter_recover_configured_rates 30662 * 30663 * Purpose: 30664 * Recover configured packet committed rate and burst size and 30665 * peak rate and peak burst size. 30666 * 30667 * Parameters: 30668 * unit - (IN) BCM device number. 30669 * f_ent - (IN) Field entry structure 30670 * level - (IN) Policer level 30671 * f_ent_wb_info - (IN) Warmboot Field entry structure. 30672 * 30673 * Returns: 30674 * BCM_E_XXX 30675 */ 30676 int 30677 _field_trx_meter_recover_configured_rates(int unit, _field_entry_t *f_ent, 30678 uint32 level, 30679 _field_entry_wb_info_t *f_ent_wb_info) 30680 { 30681 _field_policer_t *f_pl; /* Internal policer descriptor. */ 30682 _field_entry_policer_t *f_ent_pl; /* Field entry policer structure. */ 30683 int rv; 30684 30685 if ((f_ent == NULL) || (f_ent_wb_info == NULL)) { 30686 return BCM_E_PARAM; 30687 } 30688 30689 if (f_ent_wb_info->f_ent_policer_wb == NULL) { 30690 return BCM_E_NONE; 30691 } 30692 30693 f_ent_pl = f_ent->policer + level; 30694 30695 rv = _bcm_field_policer_get(unit, f_ent_pl->pid, &f_pl); 30696 if (BCM_SUCCESS(rv)) { 30697 if (f_pl->sw_ref_count == 2) { 30698 /* A policer can be attached to more than one field entry. 30699 * Calculate configured rates only when its a new policer 30700 * object after Warmboot. */ 30701 f_pl->cfg.actual_ckbits_sec = f_pl->cfg.ckbits_sec; 30702 f_pl->cfg.ckbits_sec = f_pl->cfg.actual_ckbits_sec - 30703 f_ent_wb_info->f_ent_policer_wb->policer_delta_rates[level][0]; 30704 30705 f_pl->cfg.actual_ckbits_burst = f_pl->cfg.ckbits_burst; 30706 f_pl->cfg.ckbits_burst = f_pl->cfg.actual_ckbits_burst - 30707 f_ent_wb_info->f_ent_policer_wb->policer_delta_rates[level][1]; 30708 30709 f_pl->cfg.actual_pkbits_sec = f_pl->cfg.pkbits_sec; 30710 f_pl->cfg.pkbits_sec = f_pl->cfg.actual_pkbits_sec - 30711 f_ent_wb_info->f_ent_policer_wb->policer_delta_rates[level][2]; 30712 30713 f_pl->cfg.actual_pkbits_burst = f_pl->cfg.pkbits_burst; 30714 f_pl->cfg.pkbits_burst = f_pl->cfg.actual_pkbits_burst - 30715 f_ent_wb_info->f_ent_policer_wb->policer_delta_rates[level][3]; 30716 } 30717 } 30718 30719 return BCM_E_NONE; 30720 } 30721 30722 /* 30723 * Function: 30724 * _field_entry_policer_delta_rates_sync 30725 * 30726 * Purpose: 30727 * Sync the delta between the actual hardware rate and burst 30728 * and the configured rate and burst 30729 * 30730 * Parameters: 30731 * unit - (IN) BCM device number. 30732 * stage_fc - (IN) Field stage control structure. 30733 * scache_ptr - (IN) Scache Pointer 30734 * f_ent - (IN) Field entry structure 30735 * 30736 * Returns: 30737 * BCM_E_XXX 30738 */ 30739 int _field_entry_policer_delta_rates_sync(int unit, _field_control_t *fc, 30740 _field_stage_t *stage_fc, uint8 *scache_ptr, 30741 _field_entry_t *f_ent) 30742 { 30743 uint8 *curr_scache_ptr = scache_ptr; /* Scache Pointer */ 30744 _field_policer_t *f_pl; /* Internal policer descriptor. */ 30745 _field_entry_policer_t *f_ent_pl; /* Field entry policer structure. */ 30746 int idx; /* Policers levels iterator. */ 30747 int rv; 30748 uint16 kbits_diff = 0; 30749 30750 if ((fc == NULL) || (stage_fc == NULL) 30751 || (scache_ptr == NULL) || (f_ent == NULL)) { 30752 return BCM_E_PARAM; 30753 } 30754 30755 if ((stage_fc->stage_id != _BCM_FIELD_STAGE_INGRESS) 30756 && (stage_fc->stage_id != _BCM_FIELD_STAGE_EGRESS)) { 30757 return BCM_E_NONE; 30758 } 30759 30760 for (idx = 0; idx < _FP_POLICER_LEVEL_COUNT; idx++) { 30761 f_ent_pl = f_ent->policer + idx; 30762 30763 rv = _bcm_field_policer_get(unit, f_ent_pl->pid, &f_pl); 30764 if (BCM_SUCCESS(rv)) { 30765 30766 if(!(f_ent->policer[idx].flags & _FP_POLICER_INSTALLED)) { 30767 continue; 30768 } 30769 30770 kbits_diff = f_pl->cfg.actual_ckbits_sec - f_pl->cfg.ckbits_sec; 30771 sal_memcpy (curr_scache_ptr, &kbits_diff, sizeof (uint16)); 30772 fc->scache_pos += sizeof (uint16); 30773 curr_scache_ptr += sizeof (uint16); 30774 30775 kbits_diff = f_pl->cfg.actual_ckbits_burst - f_pl->cfg.ckbits_burst; 30776 sal_memcpy (curr_scache_ptr, &kbits_diff, sizeof (uint16)); 30777 fc->scache_pos += sizeof (uint16); 30778 curr_scache_ptr += sizeof (uint16); 30779 30780 kbits_diff = f_pl->cfg.actual_pkbits_sec - f_pl->cfg.pkbits_sec; 30781 sal_memcpy (curr_scache_ptr, &kbits_diff, sizeof (uint16)); 30782 fc->scache_pos += sizeof (uint16); 30783 curr_scache_ptr += sizeof (uint16); 30784 30785 kbits_diff = f_pl->cfg.actual_pkbits_burst - f_pl->cfg.pkbits_burst; 30786 sal_memcpy (curr_scache_ptr, &kbits_diff, sizeof (uint16)); 30787 fc->scache_pos += sizeof (uint16); 30788 curr_scache_ptr += sizeof (uint16); 30789 } 30790 } 30791 return BCM_E_NONE; 30792 } 30793 30794 /* 30795 * Function: 30796 * _field_entry_policer_delta_rates_recover 30797 * 30798 * Purpose: 30799 * Recover the synced delta rates of the policer hardware and 30800 * configured values. 30801 * 30802 * Parameters: 30803 * unit - (IN) BCM device number. 30804 * fc - (IN) Field control structure. 30805 * stage_fc - (IN) Field stage control structure. 30806 * scache_ptr - (IN) Scache Pointer 30807 * f_ent_policer_wb - (IN) Warmboot field entry policer structure. 30808 * pol_present - (IN) Level 0 policer is present 30809 * pol_present1 - (IN) Level 1 policer is present 30810 */ 30811 30812 int _field_entry_policer_delta_rates_recover (int unit, _field_control_t *fc, 30813 _field_stage_t *stage_fc, uint8 *scache_ptr, 30814 _field_entry_policer_wb_t *f_ent_policer_wb, 30815 uint8 pol_present, uint8 pol_present1) 30816 { 30817 uint8 *curr_scache_ptr = scache_ptr; /* Scache Pointer */ 30818 30819 if ((fc == NULL) || (stage_fc == NULL) 30820 || (scache_ptr == NULL)) { 30821 return BCM_E_PARAM; 30822 } 30823 30824 if ((stage_fc->stage_id != _BCM_FIELD_STAGE_INGRESS) 30825 && (stage_fc->stage_id != _BCM_FIELD_STAGE_EGRESS)) { 30826 return BCM_E_NONE; 30827 } 30828 30829 if (f_ent_policer_wb == NULL) { 30830 return BCM_E_PARAM; 30831 } 30832 30833 if (pol_present) { 30834 sal_memcpy (&(f_ent_policer_wb->policer_delta_rates[0][0]), 30835 curr_scache_ptr, sizeof(uint16)); 30836 fc->scache_pos += sizeof (uint16); 30837 curr_scache_ptr += sizeof (uint16); 30838 30839 sal_memcpy (&(f_ent_policer_wb->policer_delta_rates[0][1]), 30840 curr_scache_ptr, sizeof(uint16)); 30841 fc->scache_pos += sizeof (uint16); 30842 curr_scache_ptr += sizeof (uint16); 30843 30844 sal_memcpy (&(f_ent_policer_wb->policer_delta_rates[0][2]), 30845 curr_scache_ptr, sizeof(uint16)); 30846 fc->scache_pos += sizeof (uint16); 30847 curr_scache_ptr += sizeof (uint16); 30848 30849 sal_memcpy (&(f_ent_policer_wb->policer_delta_rates[0][3]), 30850 curr_scache_ptr, sizeof(uint16)); 30851 fc->scache_pos += sizeof (uint16); 30852 curr_scache_ptr += sizeof (uint16); 30853 } 30854 30855 if (pol_present1) { 30856 sal_memcpy (&(f_ent_policer_wb->policer_delta_rates[1][0]), 30857 curr_scache_ptr, sizeof(uint16)); 30858 fc->scache_pos += sizeof (uint16); 30859 curr_scache_ptr += sizeof (uint16); 30860 30861 sal_memcpy (&(f_ent_policer_wb->policer_delta_rates[1][1]), 30862 curr_scache_ptr, sizeof(uint16)); 30863 fc->scache_pos += sizeof (uint16); 30864 curr_scache_ptr += sizeof (uint16); 30865 30866 sal_memcpy (&(f_ent_policer_wb->policer_delta_rates[1][2]), 30867 curr_scache_ptr, sizeof(uint16)); 30868 fc->scache_pos += sizeof (uint16); 30869 curr_scache_ptr += sizeof (uint16); 30870 30871 sal_memcpy (&(f_ent_policer_wb->policer_delta_rates[1][3]), 30872 curr_scache_ptr, sizeof(uint16)); 30873 fc->scache_pos += sizeof (uint16); 30874 curr_scache_ptr += sizeof (uint16); 30875 } 30876 return BCM_E_NONE; 30877 } 30878 30879 int 30880 _field_tr2_group_entry_write(int unit, int instance, int slice_idx, 30881 _field_slice_t *fs, _field_control_t *fc, 30882 _field_stage_t *stage_fc) 30883 { 30884 int qset_count, ratio, idx, prev_prio, multigroup, master_slice; 30885 uint8 stat_present, pol_present, prio_ctrl, pol_present1; 30886 uint8 group_auto_expansion = 0, next_group_valid = 0; 30887 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 30888 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 30889 _field_group_t *fg; 30890 _field_entry_t *f_ent; 30891 bcm_port_t port; 30892 bcm_field_qualify_t q; 30893 bcm_pbmp_t port_cmic_pbmp; 30894 _field_slice_t *temp_fs = fs; 30895 _field_entry_oam_wb_t *f_ent_oam_wb = NULL; 30896 int rv = BCM_E_NONE; 30897 uint8 color_independent = 0; 30898 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) \ 30899 || defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT) \ 30900 || defined(BCM_HURRICANE3_SUPPORT) 30901 _field_stat_t *f_st; 30902 int flex_mode=0; 30903 int hw_flags=0; 30904 uint8 flex_stat_map=0; 30905 #endif 30906 uint8 *count = NULL; 30907 _field_stage_t *ingress_stage_fc = NULL; 30908 uint8 max_udf_count = 0; 30909 uint8 udf_idx; 30910 int part_idx; 30911 int parts_cnt; 30912 uint8 group_flags = 0; 30913 30914 BCM_IF_ERROR_RETURN(_field_stage_control_get(unit, 30915 _BCM_FIELD_STAGE_INGRESS, &ingress_stage_fc)); 30916 30917 if (ingress_stage_fc->data_ctrl) { 30918 max_udf_count = ingress_stage_fc->data_ctrl->num_elems * 2; 30919 } 30920 30921 SOC_PBMP_ASSIGN(port_cmic_pbmp, PBMP_PORT_ALL(unit)); 30922 SOC_PBMP_OR(port_cmic_pbmp, PBMP_CMIC(unit)); 30923 #if defined(BCM_KATANA2_SUPPORT) 30924 if (soc_feature(unit, soc_feature_linkphy_coe) || 30925 soc_feature(unit, soc_feature_subtag_coe)) { 30926 _bcm_kt2_subport_pbmp_update(unit, &port_cmic_pbmp); 30927 } 30928 if (SOC_IS_KATANA2(unit) && soc_feature(unit, soc_feature_flex_port)) { 30929 BCM_IF_ERROR_RETURN(_bcm_kt2_flexio_pbmp_update(unit, &port_cmic_pbmp)); 30930 } 30931 #endif 30932 30933 multigroup = 0; 30934 if ((stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) && 30935 (!SOC_PBMP_EQ(fs->pbmp, port_cmic_pbmp))) { 30936 LOG_DEBUG(BSL_LS_BCM_FP, 30937 (BSL_META_U(unit, 30938 "_field_scache_sync: Multigroup.\n"))); 30939 multigroup = 1; 30940 } 30941 30942 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 30943 "_field_scache_sync: Writing slice %d @ byte %d...\n"), 30944 slice_idx, fc->scache_pos)); 30945 30946 buf[fc->scache_pos] = (slice_idx << 1) | multigroup; 30947 fc->scache_pos++; 30948 30949 /* Get the master slice if expanded */ 30950 master_slice = slice_idx; 30951 while (temp_fs->prev != NULL) { 30952 temp_fs = temp_fs->prev; 30953 master_slice = temp_fs->slice_number; 30954 } 30955 30956 /* Traverse all groups and dump group data for this slice */ 30957 fg = fc->groups; 30958 while (fg != NULL) { 30959 if ((fg->instance != instance) || 30960 (fg->stage_id != stage_fc->stage_id) || 30961 (fg->slices[0].slice_number != master_slice)) { 30962 fg = fg->next; 30963 LOG_DEBUG(BSL_LS_BCM_FP, 30964 (BSL_META_U(unit, 30965 "_field_scache_sync: No match on group %d.\n"), 30966 fg->gid)); 30967 continue; /* Not in this stage */ 30968 } 30969 30970 LOG_DEBUG(BSL_LS_BCM_FP, 30971 (BSL_META_U(unit, 30972 "_field_scache_sync: Match on group %d...\n"), 30973 fg->gid)); 30974 30975 LOG_DEBUG(BSL_LS_BCM_FP, 30976 (BSL_META_U(unit, 30977 "_field_scache_sync: Writing group %d @ byte %d...\n"), 30978 fg->gid, fc->scache_pos)); 30979 30980 if (BCM_PBMP_IS_NULL(fg->pbmp)) { 30981 LOG_ERROR(BSL_LS_BCM_FP, 30982 (BSL_META_U(unit, 30983 "FP WB Group Sync failed: At least one port has to be" 30984 " part of group's pbmp with GID :[%d] for successful warmboot \n"), 30985 fg->gid)); 30986 return BCM_E_CONFIG; 30987 } 30988 30989 SOC_PBMP_ITER(fg->pbmp, port) { 30990 break; /* Pick first port found as representative */ 30991 } 30992 30993 if (fc->flags & _FP_STABLE_SAVE_LONG_IDS) { 30994 /* Save long GID */ 30995 30996 buf[fc->scache_pos] = fg->gid; 30997 fc->scache_pos++; 30998 buf[fc->scache_pos] = fg->gid >> 8; 30999 fc->scache_pos++; 31000 buf[fc->scache_pos] = fg->gid >> 16; 31001 fc->scache_pos++; 31002 buf[fc->scache_pos] = fg->gid >> 24; 31003 fc->scache_pos++; 31004 } else { 31005 /* Save compact GID */ 31006 31007 buf[fc->scache_pos] = fg->gid; /* GID_lo */ 31008 fc->scache_pos++; 31009 buf[fc->scache_pos] = fg->gid >> 8; /* GID_hi */ 31010 fc->scache_pos++; 31011 } 31012 buf[fc->scache_pos] = port; /* Rep_port */ 31013 fc->scache_pos++; 31014 31015 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_21) { 31016 int i = 0; 31017 for (i = 0; i < _SHR_PBMP_WORD_MAX; i++) { 31018 buf[fc->scache_pos] = fg->pbmp.pbits[i]; 31019 fc->scache_pos++; 31020 buf[fc->scache_pos] = fg->pbmp.pbits[i] >> 8; 31021 fc->scache_pos++; 31022 buf[fc->scache_pos] = fg->pbmp.pbits[i] >> 16; 31023 fc->scache_pos++; 31024 buf[fc->scache_pos] = fg->pbmp.pbits[i] >> 24; 31025 fc->scache_pos++; 31026 } 31027 } 31028 /* Write group priority */ 31029 buf[fc->scache_pos] = fg->priority; 31030 fc->scache_pos++; 31031 buf[fc->scache_pos] = fg->priority >> 8; 31032 fc->scache_pos++; 31033 buf[fc->scache_pos] = fg->priority >> 16; 31034 fc->scache_pos++; 31035 buf[fc->scache_pos] = fg->priority >> 24; 31036 fc->scache_pos++; 31037 31038 /* Write group action res id */ 31039 buf[fc->scache_pos] = fg->action_res_id; 31040 fc->scache_pos++; 31041 buf[fc->scache_pos] = fg->action_res_id >> 8; 31042 fc->scache_pos++; 31043 buf[fc->scache_pos] = fg->action_res_id >> 16; 31044 fc->scache_pos++; 31045 buf[fc->scache_pos] = fg->action_res_id >> 24; 31046 fc->scache_pos++; 31047 31048 /* Obtain list of qualifiers in fg->qset */ 31049 qset_count = 0; 31050 _FIELD_QSET_ITER(fg->qset, q) { 31051 qset_count++; 31052 } 31053 31054 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31055 "Before Writing qset count (%d) @ byte s_pos=%d s_pos1=%d...\n\r"), 31056 qset_count, fc->scache_pos, fc->scache_pos1)); 31057 31058 buf[fc->scache_pos] = qset_count; /* qset_count */ 31059 fc->scache_pos++; 31060 _FIELD_QSET_ITER(fg->qset, q) { 31061 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31062 "_field_scache_sync: Writing qid %d @ byte %d...\n"), 31063 q, fc->scache_pos)); 31064 31065 buf[fc->scache_pos] = q; /* QID */ 31066 fc->scache_pos++; 31067 if(NULL != buf1) { 31068 buf1[fc->scache_pos1] = q >> 8; 31069 fc->scache_pos1++; 31070 } 31071 } 31072 31073 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31074 "After Writing qset count (%d) @ byte s_pos=%d s_pos1=%d...\n\r"), 31075 qset_count, fc->scache_pos, fc->scache_pos1)); 31076 31077 count = &buf[fc->scache_pos]; 31078 fc->scache_pos++; 31079 *count = 0; 31080 31081 for (q = bcmFieldQualifyCount; q < ((int)_bcmFieldQualifyCount); q++) { 31082 if (((fc->wb_current_version) < BCM_FIELD_WB_VERSION_1_25) && 31083 soc_feature(unit, soc_feature_field_multi_pipe_support) && 31084 !soc_feature(unit, soc_feature_td3_style_fp) && 31085 (_BCM_FIELD_STAGE_LOOKUP == stage_fc->stage_id) && 31086 (((int)_bcmFieldQualifyData2) <= q)) { 31087 continue; 31088 } 31089 if (BCM_FIELD_QSET_TEST(fg->qset, q)) { 31090 buf[fc->scache_pos] = q - bcmFieldQualifyCount; 31091 fc->scache_pos++; 31092 if(NULL != buf1) { 31093 buf1[fc->scache_pos1] = (q - bcmFieldQualifyCount) >> 8; 31094 fc->scache_pos1++; 31095 } 31096 *count = *count + 1; 31097 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31098 "_field_scache_sync: Writing internal qid idx %d @ byte %d...\n"), 31099 q, fc->scache_pos - 1)); 31100 } 31101 } 31102 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31103 "_field_scache_sync: Writing internal qset count (%d) @ byte %d...\n"), 31104 *count, fc->scache_pos - 1 - *count)); 31105 31106 count = &buf[fc->scache_pos]; 31107 fc->scache_pos++; 31108 *count = 0; 31109 31110 for (udf_idx = 0; udf_idx < max_udf_count ; udf_idx++) { 31111 if (SHR_BITGET(fg->qset.udf_map, udf_idx)) { 31112 buf[fc->scache_pos] = udf_idx; 31113 fc->scache_pos++; 31114 *count = *count + 1; 31115 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31116 "_field_scache_sync: Writing UDF idx %d @ byte %d...\n"), 31117 udf_idx, fc->scache_pos - 1)); 31118 } 31119 } 31120 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31121 "Writing udf count (%d) @ byte s_pos=%d...\n\r"), 31122 *count, fc->scache_pos - 1 - *count)); 31123 31124 /* Sync EFP KEY info */ 31125 if (((SOC_IS_TRIDENT2X(unit) && 31126 ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_15)) || 31127 ((SOC_IS_TITAN2PLUS(unit) || 31128 soc_feature(unit, soc_feature_field_multi_pipe_support)) && 31129 ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_16))) 31130 && (fg->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 31131 31132 buf[fc->scache_pos] = fg->sel_codes[0].fpf3 & 0xf; 31133 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 31134 buf[fc->scache_pos] |= (fg->sel_codes[1].fpf3 & 0xf) << 4; 31135 } 31136 fc->scache_pos++; 31137 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31138 "Writing EFP KEY Info @ byte s_pos=%d...\n\r"), 31139 fc->scache_pos - 1)); 31140 } 31141 31142 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_18) { 31143 if ((fg->stage_id == _BCM_FIELD_STAGE_INGRESS) || 31144 (fg->stage_id == _BCM_FIELD_STAGE_LOOKUP)) { 31145 parts_cnt = 0; 31146 BCM_IF_ERROR_RETURN(_bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 31147 fg->flags, &parts_cnt)); 31148 /* Sync Group part count for ingress and src entity sel sync */ 31149 buf[fc->scache_pos] = parts_cnt; 31150 fc->scache_pos++; 31151 for (part_idx = 0; part_idx < parts_cnt; part_idx++) { 31152 if (fg->stage_id == _BCM_FIELD_STAGE_INGRESS) { 31153 buf[fc->scache_pos] = fg->sel_codes[part_idx].ingress_entity_sel; 31154 fc->scache_pos++; 31155 buf[fc->scache_pos] = fg->sel_codes[part_idx].dst_fwd_entity_sel; 31156 fc->scache_pos++; 31157 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_23) { 31158 buf[fc->scache_pos] = fg->sel_codes[part_idx].loopback_type_sel; 31159 fc->scache_pos++; 31160 } 31161 } 31162 buf[fc->scache_pos] = fg->sel_codes[part_idx].src_entity_sel; 31163 fc->scache_pos++; 31164 } 31165 } 31166 } 31167 31168 if (fg->flags & _FP_GROUP_SELECT_AUTO_EXPANSION) { 31169 group_auto_expansion = _FIELD_GROUP_AUTO_EXPANSION; 31170 } else { 31171 group_auto_expansion = 0; 31172 } 31173 31174 group_flags = 0; 31175 31176 if (fg->flags & _FP_GROUP_LOOKUP_ENABLED) { 31177 group_flags |= _FIELD_GROUP_LOOKUP_ENABLED; 31178 } 31179 31180 if (fg->flags & _FP_GROUP_WLAN) { 31181 group_flags |= _FIELD_GROUP_WLAN; 31182 } 31183 31184 /* Next group not valid */ 31185 next_group_valid = 0x0; 31186 fg = fg->next; 31187 while (fg != NULL) { 31188 if (multigroup 31189 && (fg->stage_id == stage_fc->stage_id) 31190 && (fg->slices[0].slice_number == master_slice)) { 31191 /* Next group valid */ 31192 next_group_valid = _FIELD_GROUP_NEXT_GROUP_VALID; 31193 break; 31194 } 31195 fg = fg->next; 31196 } 31197 31198 /* 31199 * In this byte, 6 bits are used as below 31200 * bit 0 -- to indicate wheather next group 31201 * in this slice is valid or not 31202 * bit 1,2 -- contains group's instance for version < 1_26 31203 * bit 1,2 -- free bits for version >= 1_26 31204 * bit 5 -- to indicate group lookup enable status. 31205 * bit 6 -- to indicate group is WLAN. 31206 * bit 7 -- to indicate group auto expansion status. 31207 */ 31208 31209 buf[fc->scache_pos] = (group_auto_expansion | next_group_valid | group_flags); 31210 31211 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31212 "%s(): Writing group_auto_exp:%d and" 31213 " next_group_valid:%d @ byte %d...\n\r"), 31214 __func__, group_auto_expansion, next_group_valid, fc->scache_pos)); 31215 31216 if ((fc->wb_current_version) < BCM_FIELD_WB_VERSION_1_26) { 31217 /* 31218 * Write instance at 1st bit position of the same byte 31219 */ 31220 buf[fc->scache_pos] |= ((instance << 1) & 0x6); 31221 31222 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31223 "%s(): Writing instance:%d @ byte %d...\n\r"), 31224 __func__, instance, fc->scache_pos)); 31225 fc->scache_pos++; 31226 } else { 31227 fc->scache_pos++; 31228 /* 31229 * Write instance at the next byte [4 bits used] 31230 */ 31231 buf[fc->scache_pos] = (instance & 0xf); 31232 31233 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31234 "%s(): Writing instance:%d @ byte %d...\n\r"), 31235 __func__, instance, fc->scache_pos)); 31236 fc->scache_pos++; 31237 31238 } 31239 } 31240 31241 /* Traverse all entries and dump entry data for this slice */ 31242 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 31243 ratio = 2; 31244 } else { 31245 ratio = 1; 31246 } 31247 prev_prio = -1; 31248 31249 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31250 "%s(%d): Before Entry write instance:%d @ byte %d...\n\r"), 31251 __func__, __LINE__,instance, fc->scache_pos)); 31252 31253 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31254 "%s(%d): Slice Info: id %d entry count %d ratio %d...\n\r"), 31255 __func__, __LINE__, fs->slice_number, fs->entry_count, ratio)); 31256 31257 for (idx = 0; idx < fs->entry_count / ratio; idx++) { 31258 /* Find EID that matches this HW index */ 31259 f_ent = fs->entries[idx]; 31260 if (f_ent == NULL) { 31261 continue; 31262 } 31263 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31264 "%s(%d): Before Entry write idx %d @ byte %d...\n\r"), 31265 __func__, __LINE__, f_ent->eid, fc->scache_pos)); 31266 if (f_ent->flags & _FP_ENTRY_INSTALLED) { 31267 prio_ctrl = (f_ent->prio != prev_prio) ? 1 : 0; 31268 stat_present = (f_ent->statistic.flags & 31269 _FP_ENTRY_STAT_INSTALLED) ? 1 : 0; 31270 pol_present = (f_ent->policer[0].flags & 31271 _FP_POLICER_INSTALLED) ? 1 : 0; 31272 pol_present1 = (f_ent->policer[1].flags & 31273 _FP_POLICER_INSTALLED) ? 1 : 0; 31274 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) \ 31275 || defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT) \ 31276 || defined(BCM_HURRICANE3_SUPPORT) 31277 if ((stat_present) && 31278 (((soc_feature(unit, soc_feature_advanced_flex_counter) || 31279 soc_feature(unit, soc_feature_field_vfp_flex_counter) || 31280 soc_feature(unit, soc_feature_flowcnt)) && 31281 (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id)) || 31282 (soc_feature(unit, soc_feature_advanced_flex_counter) && 31283 (_BCM_FIELD_STAGE_EXTERNAL == f_ent->group->stage_id)))) { 31284 if (soc_feature(unit, 31285 soc_feature_flex_stat_compaction_support)) { 31286 if (f_ent->statistic.extended_sid != 0) { 31287 BCM_IF_ERROR_RETURN(_bcm_field_stat_get( 31288 unit, f_ent->statistic.extended_sid, &f_st)); 31289 } else { 31290 BCM_IF_ERROR_RETURN(_bcm_field_stat_get( 31291 unit, f_ent->statistic.sid, &f_st)); 31292 } 31293 } else { 31294 BCM_IF_ERROR_RETURN(_bcm_field_stat_get( 31295 unit, f_ent->statistic.sid, &f_st)); 31296 } 31297 flex_mode = f_st->flex_mode; 31298 hw_flags = f_st->hw_flags; 31299 switch(f_st->nstat) { 31300 case 1:if(f_st->stat_arr[0] == bcmFieldStatBytes) { 31301 flex_stat_map = 1; 31302 } else { 31303 flex_stat_map = 2; 31304 } 31305 break; 31306 case 2: 31307 default: /* Although 0-and-default cases are invalid */ 31308 flex_stat_map=3; 31309 break; 31310 } 31311 } 31312 #endif 31313 if (fc->flags & _FP_STABLE_SAVE_LONG_IDS) { 31314 /* Save long EID */ 31315 31316 buf[fc->scache_pos] = f_ent->eid; 31317 fc->scache_pos++; 31318 buf[fc->scache_pos] = f_ent->eid >> 8; 31319 fc->scache_pos++; 31320 buf[fc->scache_pos] = f_ent->eid >> 16; 31321 fc->scache_pos++; 31322 buf[fc->scache_pos] = f_ent->eid >> 24; 31323 fc->scache_pos++; 31324 31325 buf[fc->scache_pos] = prio_ctrl 31326 | (stat_present << 1) 31327 | (pol_present << 2); 31328 fc->scache_pos++; 31329 31330 } else { 31331 /* Save compact EID */ 31332 31333 buf[fc->scache_pos] = f_ent->eid & 0xFF; /* EID_lo */ 31334 fc->scache_pos++; 31335 buf[fc->scache_pos] = ((f_ent->eid >> 8) & 0x1F) | (prio_ctrl << 5) | 31336 (stat_present << 6) | (pol_present << 7); 31337 /* EID_hi + control bits */ 31338 fc->scache_pos++; 31339 } 31340 31341 if (multigroup) { 31342 /* Multiple groups in slice => Save id of group entry belongs to */ 31343 31344 if (fc->flags & _FP_STABLE_SAVE_LONG_IDS) { 31345 /* Save complete GID */ 31346 31347 buf[fc->scache_pos] = f_ent->group->gid; 31348 fc->scache_pos++; 31349 buf[fc->scache_pos] = f_ent->group->gid >> 8; 31350 fc->scache_pos++; 31351 buf[fc->scache_pos] = f_ent->group->gid >> 16; 31352 fc->scache_pos++; 31353 buf[fc->scache_pos] = f_ent->group->gid >> 24; 31354 fc->scache_pos++; 31355 } else { 31356 /* Save compact GID */ 31357 31358 buf[fc->scache_pos] = f_ent->group->gid; /* GID_lo */ 31359 fc->scache_pos++; 31360 buf[fc->scache_pos] = f_ent->group->gid >> 8; /* GID_hi */ 31361 fc->scache_pos++; 31362 } 31363 } 31364 if (prio_ctrl) { 31365 /* 32-bit priority is written */ 31366 buf[fc->scache_pos] = f_ent->prio & 0xFF; 31367 fc->scache_pos++; 31368 buf[fc->scache_pos] = (f_ent->prio >> 8) & 0xFF; 31369 fc->scache_pos++; 31370 buf[fc->scache_pos] = (f_ent->prio >> 16) & 0xFF; 31371 fc->scache_pos++; 31372 buf[fc->scache_pos] = (f_ent->prio >> 24) & 0xFF; 31373 fc->scache_pos++; 31374 prev_prio = f_ent->prio; 31375 } 31376 31377 /* Write policer and stat object IDs if present */ 31378 if (soc_feature(unit, 31379 soc_feature_flex_stat_compaction_support)) { 31380 if(f_ent->statistic.flags & 31381 _FP_ENTRY_EXTENDED_STAT_INSTALLED) { 31382 f_ent->statistic.sid = f_ent->statistic.extended_sid; 31383 } 31384 } 31385 31386 if (fc->flags & _FP_STABLE_SAVE_LONG_IDS) { 31387 /* Save complete policer and stat ids */ 31388 31389 if (pol_present) { 31390 buf[fc->scache_pos] = f_ent->policer[0].pid; 31391 fc->scache_pos++; 31392 buf[fc->scache_pos] = f_ent->policer[0].pid >> 8; 31393 fc->scache_pos++; 31394 buf[fc->scache_pos] = f_ent->policer[0].pid >> 16; 31395 fc->scache_pos++; 31396 buf[fc->scache_pos] = f_ent->policer[0].pid >> 24; 31397 fc->scache_pos++; 31398 } 31399 31400 if (stat_present) { 31401 buf[fc->scache_pos] = f_ent->statistic.sid; 31402 fc->scache_pos++; 31403 buf[fc->scache_pos] = f_ent->statistic.sid >> 8; 31404 fc->scache_pos++; 31405 buf[fc->scache_pos] = f_ent->statistic.sid >> 16; 31406 fc->scache_pos++; 31407 buf[fc->scache_pos] = f_ent->statistic.sid >> 24; 31408 fc->scache_pos++; 31409 } 31410 } else { 31411 /* Save compact policer and stat ids */ 31412 31413 if (pol_present) { 31414 buf[fc->scache_pos] = (f_ent->policer[0].pid) & 0xFF; 31415 fc->scache_pos++; 31416 } 31417 if (stat_present) { 31418 if (pol_present) { 31419 buf[fc->scache_pos] = 31420 (((f_ent->policer[0].pid >> 8) & 0xF) << 4) | 31421 (f_ent->statistic.sid & 0xF); 31422 fc->scache_pos++; 31423 } else { 31424 buf[fc->scache_pos] = f_ent->statistic.sid & 0xF; 31425 fc->scache_pos++; 31426 } 31427 buf[fc->scache_pos] = (f_ent->statistic.sid >> 4) & 0xFF; 31428 fc->scache_pos++; 31429 } else if (pol_present) { 31430 buf[fc->scache_pos] = 31431 ((f_ent->policer[0].pid >> 8) & 0xF) << 4; 31432 fc->scache_pos++; 31433 } 31434 } 31435 31436 parts_cnt = 0; 31437 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_18) { 31438 if ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) || 31439 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) || 31440 (f_ent->group->stage_id == _BCM_FIELD_STAGE_LOOKUP)) { 31441 /* Sync entry part count for SVP & DVP type */ 31442 BCM_IF_ERROR_RETURN(_bcm_field_entry_tcam_parts_count(unit, 31443 f_ent->group->stage_id, f_ent->group->flags, 31444 &parts_cnt)); 31445 31446 buf[fc->scache_pos] = parts_cnt; 31447 fc->scache_pos++; 31448 } 31449 } 31450 31451 /* Save Dvp Type */ 31452 buf[fc->scache_pos] = f_ent->dvp_type; 31453 fc->scache_pos++; 31454 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_18) { 31455 for (part_idx = 1; part_idx < parts_cnt; part_idx++) { 31456 buf[fc->scache_pos] = f_ent[part_idx].dvp_type; 31457 fc->scache_pos++; 31458 } 31459 } 31460 31461 /* Save SVP Type */ 31462 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_16) { 31463 buf[fc->scache_pos] = f_ent->svp_type; 31464 fc->scache_pos++; 31465 } 31466 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_18) { 31467 for (part_idx = 1; part_idx < parts_cnt; part_idx++) { 31468 buf[fc->scache_pos] = f_ent[part_idx].svp_type; 31469 fc->scache_pos++; 31470 } 31471 } 31472 31473 #if defined(BCM_APACHE_SUPPORT) 31474 if (SOC_IS_APACHE(unit)) { 31475 BCM_IF_ERROR_RETURN(_field_apache_entry_info_sync(unit, 31476 fc, stage_fc, f_ent)); 31477 } 31478 #endif 31479 31480 31481 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) \ 31482 || defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT) \ 31483 || defined(BCM_HURRICANE3_SUPPORT) 31484 if ((stat_present) && 31485 (((soc_feature(unit, soc_feature_advanced_flex_counter) || 31486 (((fc->wb_current_version) 31487 >= BCM_FIELD_WB_VERSION_1_12) && 31488 soc_feature(unit, soc_feature_field_vfp_flex_counter)) || 31489 soc_feature(unit, soc_feature_flowcnt)) && 31490 (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id)) || 31491 (soc_feature(unit, soc_feature_advanced_flex_counter) && 31492 (_BCM_FIELD_STAGE_EXTERNAL == f_ent->group->stage_id) && 31493 ((fc->wb_current_version) 31494 >= BCM_FIELD_WB_VERSION_1_14)))) { 31495 buf[fc->scache_pos] = flex_mode; 31496 fc->scache_pos++; 31497 buf[fc->scache_pos] = flex_mode >> 8; 31498 fc->scache_pos++; 31499 buf[fc->scache_pos] = flex_mode >> 16; 31500 fc->scache_pos++; 31501 buf[fc->scache_pos] = flex_mode >> 24; 31502 fc->scache_pos++; 31503 buf[fc->scache_pos] = hw_flags; 31504 fc->scache_pos++; 31505 buf[fc->scache_pos] = hw_flags >> 8; 31506 fc->scache_pos++; 31507 buf[fc->scache_pos] = hw_flags >> 16; 31508 fc->scache_pos++; 31509 buf[fc->scache_pos] = hw_flags >> 24; 31510 fc->scache_pos++; 31511 buf[fc->scache_pos] = flex_stat_map; 31512 fc->scache_pos++; 31513 } 31514 #endif 31515 31516 if ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) 31517 || (((fc->wb_current_version) 31518 >= BCM_FIELD_WB_VERSION_1_11) && 31519 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS))) { 31520 _FP_XGS3_ALLOC(f_ent_oam_wb, sizeof (_field_entry_oam_wb_t), 31521 "Field Entry Warmboot"); 31522 if (f_ent_oam_wb == NULL) { 31523 return BCM_E_MEMORY; 31524 } 31525 #if defined BCM_TRIDENT2PLUS_SUPPORT 31526 if (soc_feature(unit, soc_feature_fp_based_oam)) { 31527 rv = _field_oam_stat_action_scache_sync 31528 (unit, stage_fc, f_ent, f_ent_oam_wb); 31529 if (BCM_FAILURE(rv)) { 31530 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 31531 return rv; 31532 } 31533 } 31534 31535 if (SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) { 31536 rv = _field_extended_stat_scache_sync (unit, stage_fc, 31537 f_ent, f_ent_oam_wb); 31538 if (BCM_FAILURE(rv)) { 31539 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 31540 return rv; 31541 } 31542 } 31543 #endif /* BCM_TRIDENT2PLUS_SUPPORT */ 31544 /* Writing f_ent_oam_wb in Scache */ 31545 rv = _field_entry_oam_wb_scache_sync (unit, fc, 31546 stage_fc, &buf[fc->scache_pos], f_ent_oam_wb); 31547 if (BCM_FAILURE(rv)) { 31548 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 31549 return rv; 31550 } 31551 } 31552 { 31553 if ((fc->wb_current_version) 31554 >= BCM_FIELD_WB_VERSION_1_13) { 31555 /* Save Entry Color independent flag */ 31556 color_independent = (f_ent->flags & 31557 _FP_ENTRY_COLOR_INDEPENDENT) ? 1 : 0; 31558 } 31559 if ((fc->wb_current_version) 31560 < BCM_FIELD_WB_VERSION_1_15) { 31561 pol_present1 = 0; 31562 } 31563 31564 if ((fc->wb_current_version) 31565 >= BCM_FIELD_WB_VERSION_1_13) { 31566 buf[fc->scache_pos] = ((color_independent << 7) 31567 | (pol_present1 << 6)); 31568 fc->scache_pos++; 31569 } 31570 } 31571 31572 if (pol_present1) { 31573 buf[fc->scache_pos] = f_ent->policer[1].pid; 31574 fc->scache_pos++; 31575 buf[fc->scache_pos] = f_ent->policer[1].pid >> 8; 31576 fc->scache_pos++; 31577 buf[fc->scache_pos] = f_ent->policer[1].pid >> 16; 31578 fc->scache_pos++; 31579 buf[fc->scache_pos] = f_ent->policer[1].pid >> 24; 31580 fc->scache_pos++; 31581 } 31582 31583 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_15) { 31584 rv = _field_entry_no_param_actions_scache_sync(unit, stage_fc, 31585 fc, f_ent, buf); 31586 } 31587 if (BCM_FAILURE(rv)) { 31588 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 31589 return rv; 31590 } 31591 31592 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_17) { 31593 if (pol_present || pol_present1) { 31594 rv = _field_entry_policer_delta_rates_sync (unit, fc, 31595 stage_fc, &buf[fc->scache_pos], f_ent); 31596 if (BCM_FAILURE(rv)) { 31597 return rv; 31598 } 31599 } 31600 } 31601 31602 /* Free the f_ent_oam_wb structure since it has been 31603 * written in scache */ 31604 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 31605 } 31606 31607 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31608 "%s(%d): After Entry write idx %d @ byte %d...\n\r"), 31609 __func__, __LINE__,f_ent->eid, fc->scache_pos)); 31610 } 31611 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 31612 "%s(%d): After Entry write instance:%d @ byte %d...\n\r"), 31613 __func__, __LINE__,instance, fc->scache_pos)); 31614 /* Mark next slice valid */ 31615 return BCM_E_NONE; 31616 } 31617 31618 /* 31619 * This function manages the Level 2 warm boot cache. The data will be stored 31620 * in the following format: 31621 * Start indicator (32 bits): Value = IFP/EFP/VFP 31622 * 31623 * Range check IDs (IFP) 31624 * 8-bit ID count (1 uint8) 31625 * ID0 (4 x uint8) 31626 * . 31627 * IDN (4 x uint8) 31628 * 31629 * Data qualifier data, as follows: 31630 * If the device has a FP_UDF_TCAM, the following is present, for each TCAM entry: 31631 * 8-bit TCAM entry reference count (1 uint 8) 31632 * Followed by: 31633 * 8-bit data qualifier count (1 uint 8) 31634 * 32-bit data qualifier id (1 int) 31635 * 2-bit "length remainder" | 3-bit flags | 3-bit offset base (1 uint 8) 31636 * 16-bit data qualifier match-data offset (1 uint 16) 31637 * 16-bit hw_bmap field of data qualifier 31638 * (Note that this field is linked to the hardware; namely, the width of this 31639 * bitmap is the number of UDF n-byte chunks supported, i.e. the number of 31640 * "columns" in the UDF_OFFSET table.) 31641 * 31642 * Group/entry data 31643 * Slice num (5 bits) | Multigroup slice indicator (1 bit): (1 uint8) 31644 * GID_lo (8 bits): (1 uint 8) 31645 * GID_hi (8 bits): (1 uint 8) 31646 * Representative_port (8 bits): (1 uint 8) 31647 * Group priority (32 bits): (4 uint 8) 31648 * Qualifier count (8 bits): (1 uint 8) 31649 * QID 1 (8 bits): (1 uint 8) 31650 * . 31651 * QID N (8 bits): (1 uint 8) 31652 * Next_group_valid (1 bit) | Reserved (7 bits): (1 uint 8) 31653 * 31654 * Groups are immediately followed by entries, which can have one of the 31655 * following two formats depending on the multigroup slice indicator: 31656 * Long format: 31657 * 8 bit EID_lo: (1 uint 8) 31658 * 5 bit EID_hi | priority_ctrl (1 bit) | Policer (1 bit) | Stat (1 bit): 31659 (1 uint 8) 31660 * 8 bit GID_lo: (1 uint 8) 31661 * 8 bit GID_hi: (1 uint 8) 31662 * priority_0: (1 uint 8) 31663 * priority_1: (1 uint 8) <---- The 32-bit priority is stored only if it is 31664 * priority_2: (1 uint 8) different from the entry before it. 31665 * priority_3: (1 uint 8) 31666 * PID_lo (8 bits): (1 uint8) 31667 * PID_hi (4 bits) | SID_lo (4 bits): (1 uint8) 31668 * SID_hi (4 bits): (1 uint 8) 31669 * Short format: 31670 * 8 bit EID_lo: (1 uint 8) 31671 * 5 bit EID_hi | priority_ctrl (1 bit) | Policer (1 bit) | Stat (1 bit): 31672 (1 uint 8) 31673 * priority_0: (1 uint 8) 31674 * priority_1: (1 uint 8) <---- The 32-bit priority is stored only if it is 31675 * priority_2: (1 uint 8) different from the entry before it. 31676 * priority_3: (1 uint 8) 31677 * PID_lo (8 bits): (1 uint8) 31678 * PID_hi (4 bits) | SID_lo (4 bits): (1 uint8) 31679 * SID_hi (8 bits): (1 uint 8) 31680 * End indicator (32 bits): Value = IFP/EFP/VFP 31681 */ 31682 31683 STATIC int 31684 _field_tr2_ext_scache_sync_chk(int unit, 31685 _field_control_t *fc, 31686 _field_stage_t *stage_fc 31687 ); 31688 STATIC int 31689 _field_tr2_ext_scache_sync(int unit, 31690 _field_control_t *fc, 31691 _field_stage_t *stage_fc 31692 ); 31693 31694 /* Function: _field_egr_ports_recovery_scache_recover 31695 * 31696 * Purpose: 31697 * Recover EgressPortBitmap Database from scache 31698 * Parameters: 31699 * unit - BCM device number 31700 * fc - Field Control 31701 * stage_fc - Stage Control 31702 * scache_ptr - Scache Pointer. 31703 31704 * Returns: 31705 BCM_E_NONE - Success 31706 */ 31707 int _field_egr_ports_recovery_scache_recover (int unit, 31708 _field_control_t *fc, 31709 _field_stage_t *stage_fc, 31710 uint8 *scache_ptr) 31711 { 31712 int entryCnt = 0; 31713 int entryId = 0; 31714 int idx = 0; 31715 bcm_pbmp_t egrPortsPbmp; 31716 uint8 *currScachePtr = scache_ptr; 31717 31718 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 31719 /* Recover Entry Count */ 31720 sal_memcpy (&entryCnt, currScachePtr, sizeof (int)); 31721 entryCnt = entryCnt - (stage_fc->tcam_slices * 2); 31722 fc->scache_pos += sizeof (int); 31723 currScachePtr += sizeof (int); 31724 31725 /* Recover Entry Id, egrPortPbmp and add it to 31726 egr_ports_pbm_recovery database */ 31727 for (idx = 0 ; idx < entryCnt; idx++) { 31728 /* Recover Entry Id*/ 31729 sal_memcpy (&entryId, currScachePtr, sizeof (bcm_field_entry_t)); 31730 fc->scache_pos += sizeof (int); 31731 currScachePtr += sizeof (int); 31732 31733 /* Recover EgressPortsAdd*/ 31734 sal_memset (&egrPortsPbmp, 0, sizeof(bcm_pbmp_t)); 31735 sal_memcpy (&egrPortsPbmp, currScachePtr, sizeof(bcm_pbmp_t)); 31736 fc->scache_pos += sizeof (bcm_pbmp_t); 31737 currScachePtr += sizeof (bcm_pbmp_t); 31738 31739 /* Add to redirect_pbm_recovery database*/ 31740 _bcm_trx_field_egr_ports_recovery_add (unit, entryId, egrPortsPbmp); 31741 } 31742 } 31743 return BCM_E_NONE; 31744 } 31745 31746 /* Function: _field_egr_ports_recovery_scache_sync 31747 * 31748 * Purpose: 31749 * Sync Recover EgressPortBitmap Database from scache 31750 * Parameters: 31751 * unit - BCM device number 31752 * fc - Field Control 31753 * stage_fc - Stage Control 31754 * scache_ptr - Scache Pointer. 31755 31756 * Returns: 31757 BCM_E_NONE - Success 31758 */ 31759 int _field_egr_ports_recovery_scache_sync(int unit, 31760 _field_control_t *fc, 31761 _field_stage_t *stage_fc, 31762 uint8 *scache_ptr) 31763 { 31764 _field_egr_ports_entry_ids_list_t *entryIds = NULL; 31765 _field_egr_ports_entry_ids_list_t *eId = NULL; 31766 int entryCnt = 0; 31767 int entryCntSync = 0; 31768 uint8 *curr_scache_ptr = scache_ptr; 31769 int idx = 0; 31770 31771 /* Get entry count and list of entries where 31772 EgressPortsAdd action is configured*/ 31773 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 31774 31775 _bcm_trx_field_egr_ports_recovery_entry_ids_list_get (unit, 31776 &entryIds, &entryCnt); 31777 eId = entryIds; 31778 31779 /* Bumping up the entryCnt by 31780 * (stage_fc->tcam_slices * 2) during sync and must be 31781 * subracted during recovery. 31782 * This is done for the following reason :- 31783 * When no groups are installed,the last scache buf[fc->scache_pos] 31784 * value is 0xEF. 31785 * The _field_trx_scache_slice_group_recover function (last recovery 31786 * function) expects the buf[fc->scache_pos] value as 31787 * (slice_number * 2) or 0xEF as valid group number 31788 * and tries to recover entries based on those values. 31789 * This leads to undefined behaviour. 31790 * Hence the values are bumped up by (2 * maximum tcam) slices 31791 */ 31792 31793 entryCntSync = (stage_fc->tcam_slices * 2) + entryCnt; 31794 31795 /* Sync Entry Count followed by Entry Id and corresponding 31796 * EgressPortsAdd */ 31797 sal_memcpy (curr_scache_ptr, &entryCntSync, sizeof (int)); 31798 fc->scache_pos += sizeof (int); 31799 curr_scache_ptr += sizeof (int); 31800 31801 for (idx = 0 ; idx < entryCnt; idx++) { 31802 if (eId == NULL) { 31803 return BCM_E_INTERNAL; 31804 } 31805 /* Sync EntryId*/ 31806 sal_memcpy (curr_scache_ptr, &(eId->eid), 31807 sizeof (bcm_field_entry_t)); 31808 fc->scache_pos += sizeof (int); 31809 curr_scache_ptr += sizeof (int); 31810 31811 /* Sync EgressPortsAdd */ 31812 sal_memcpy (curr_scache_ptr, &(eId->egr_ports_pbmp), 31813 sizeof(bcm_pbmp_t)); 31814 fc->scache_pos += sizeof (bcm_pbmp_t); 31815 curr_scache_ptr += sizeof (bcm_pbmp_t); 31816 31817 eId = eId->next; 31818 } 31819 31820 _bcm_trx_field_egr_ports_recovery_entry_list_destroy (unit, &entryIds); 31821 } 31822 return BCM_E_NONE; 31823 } 31824 31825 int 31826 _field_tr2_scache_sync(int unit, 31827 _field_control_t *fc, 31828 _field_stage_t *stage_fc 31829 ) 31830 { 31831 int slice_idx, range_count = 0; 31832 int rv = BCM_E_NONE; 31833 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 31834 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 31835 _field_slice_t *fs; 31836 _field_group_t *fg; 31837 uint32 start_char, end_char; 31838 soc_field_t fld; 31839 int efp_slice_mode, paired = 0; 31840 uint32 val; 31841 fp_port_field_sel_entry_t pfs; 31842 _field_data_control_t *data_ctrl; 31843 _field_range_t *fr; 31844 int ratio = 0; 31845 int idx; 31846 _field_entry_t *f_ent; 31847 uint64 val64; 31848 31849 soc_field_t _fb2_slice_pairing_field[8] = { 31850 SLICE1_0_PAIRINGf, SLICE3_2_PAIRINGf, 31851 SLICE5_4_PAIRINGf, SLICE7_6_PAIRINGf, 31852 SLICE9_8_PAIRINGf, SLICE11_10_PAIRINGf, 31853 SLICE13_12_PAIRINGf, SLICE15_14_PAIRINGf}; 31854 soc_field_t _efp_slice_mode[] = {SLICE_0_MODEf, SLICE_1_MODEf, 31855 SLICE_2_MODEf, SLICE_3_MODEf}; 31856 31857 switch (stage_fc->stage_id) { 31858 case _BCM_FIELD_STAGE_INGRESS: 31859 start_char = _FIELD_IFP_DATA_START; 31860 end_char = _FIELD_IFP_DATA_END; 31861 break; 31862 case _BCM_FIELD_STAGE_EGRESS: 31863 start_char = _FIELD_EFP_DATA_START; 31864 end_char = _FIELD_EFP_DATA_END; 31865 break; 31866 case _BCM_FIELD_STAGE_LOOKUP: 31867 start_char = _FIELD_VFP_DATA_START; 31868 end_char = _FIELD_VFP_DATA_END; 31869 break; 31870 case _BCM_FIELD_STAGE_EXTERNAL: 31871 if (_field_tr2_ext_scache_sync_chk(unit, fc, stage_fc)) { 31872 return (_field_tr2_ext_scache_sync(unit, fc, stage_fc)); 31873 } 31874 start_char = _FIELD_EXTFP_DATA_START; 31875 end_char = _FIELD_EXTFP_DATA_END; 31876 break; 31877 default: 31878 return BCM_E_PARAM; 31879 } 31880 31881 LOG_DEBUG(BSL_LS_BCM_FP, 31882 (BSL_META_U(unit, 31883 "_field_scache_sync: Synching scache for FP stage %d...\n"), 31884 stage_fc->stage_id)); 31885 31886 _field_scache_stage_hdr_save(fc, start_char); 31887 31888 /* Save the range check IDs */ 31889 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 31890 31891 fr = stage_fc->ranges; 31892 while (fr) { 31893 fr = fr->next; 31894 range_count++; 31895 } 31896 buf[fc->scache_pos] = (uint8)range_count; 31897 fc->scache_pos++; 31898 if (range_count) { 31899 fr = stage_fc->ranges; 31900 while (fr) { 31901 buf[fc->scache_pos] = fr->rid & 0xFF; 31902 fc->scache_pos++; 31903 buf[fc->scache_pos] = (fr->rid >> 8) & 0xFF; 31904 fc->scache_pos++; 31905 buf[fc->scache_pos] = (fr->rid >> 16) & 0xFF; 31906 fc->scache_pos++; 31907 buf[fc->scache_pos] = (fr->rid >> 24) & 0xFF; 31908 fc->scache_pos++; 31909 fr = fr->next; 31910 } 31911 } 31912 31913 /* Sync Hints information */ 31914 if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) { 31915 LOG_DEBUG(BSL_LS_BCM_FP, 31916 (BSL_META_U(unit,"Syncing hints @pos= %d\r\n"), 31917 fc->scache_pos)); 31918 BCM_IF_ERROR_RETURN (_bcm_field_hints_scache_sync(unit, 31919 fc, stage_fc, &buf[fc->scache_pos])); 31920 } 31921 31922 /* Write data qual count */ 31923 buf[fc->scache_pos] = (uint8)(bcmFieldQualifyCount >> 8); 31924 fc->scache_pos++; 31925 buf[fc->scache_pos] = (uint8)bcmFieldQualifyCount; 31926 fc->scache_pos++; 31927 31928 } 31929 31930 /* Save data qualifiers */ 31931 31932 if ((data_ctrl = stage_fc->data_ctrl) != 0) { 31933 if (soc_mem_is_valid(unit, FP_UDF_TCAMm)) { 31934 /* Device has UDF TCAM => 31935 Save internal information regarding TCAM entry usage 31936 */ 31937 31938 _field_data_tcam_entry_t *p; 31939 unsigned n; 31940 31941 for (p = data_ctrl->tcam_entry_arr, 31942 n = soc_mem_index_count(unit, FP_UDF_TCAMm); 31943 n; 31944 --n, ++p 31945 ) { 31946 buf[fc->scache_pos] = p->ref_count; 31947 fc->scache_pos++; 31948 } 31949 } 31950 31951 _field_scache_sync_data_quals_write(fc, data_ctrl); 31952 } 31953 31954 _field_slice_map_write(unit, fc, stage_fc); 31955 31956 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 31957 LOG_DEBUG(BSL_LS_BCM_FP, 31958 (BSL_META_U(unit, 31959 "_field_scache_sync: Checking slice %d...\n"), 31960 slice_idx)); 31961 /* Skip slices without groups */ 31962 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 31963 fg = fc->groups; 31964 while (fg != NULL) { 31965 if (fg->stage_id != stage_fc->stage_id) { 31966 fg = fg->next; 31967 continue; /* Not in this stage */ 31968 } 31969 if (fg->slices[0].slice_number == slice_idx) { 31970 break; 31971 } 31972 fg = fg->next; 31973 } 31974 if (fg == NULL) { 31975 continue; /* No group found */ 31976 } 31977 /* Also skip expanded slices */ 31978 if ((stage_fc->slices[_FP_DEF_INST] + slice_idx)->prev != NULL) { 31979 continue; 31980 } 31981 31982 paired = 0; 31983 31984 /* Ignore secondary slice in paired mode */ 31985 switch (stage_fc->stage_id) { 31986 case _BCM_FIELD_STAGE_INGRESS: 31987 BCM_IF_ERROR_RETURN(soc_mem_read(unit, FP_PORT_FIELD_SELm, 31988 MEM_BLOCK_ANY, 0, &pfs)); 31989 fld = _fb2_slice_pairing_field[slice_idx / 2]; 31990 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit, 31991 &pfs, fld); 31992 break; 31993 case _BCM_FIELD_STAGE_EGRESS: 31994 BCM_IF_ERROR_RETURN(READ_EFP_SLICE_CONTROLr(unit, &val)); 31995 efp_slice_mode = soc_reg_field_get(unit, EFP_SLICE_CONTROLr, 31996 val,_efp_slice_mode[slice_idx]); 31997 if ((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE) || 31998 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY) || 31999 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6)) { 32000 paired = 1; 32001 } 32002 break; 32003 case _BCM_FIELD_STAGE_LOOKUP: 32004 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 32005 if (SOC_IS_KATANA2(unit)) { 32006 BCM_IF_ERROR_RETURN(READ_VFP_KEY_CONTROL_1r(unit, &val64)); 32007 paired = soc_reg64_field32_get(unit, VFP_KEY_CONTROL_1r, val64, fld); 32008 } else { 32009 BCM_IF_ERROR_RETURN(READ_VFP_KEY_CONTROLr(unit, &val)); 32010 paired = soc_reg_field_get(unit, VFP_KEY_CONTROLr, val, fld); 32011 } 32012 break; 32013 case _BCM_FIELD_STAGE_EXTERNAL: 32014 paired = 0; 32015 break; 32016 default: 32017 return BCM_E_PARAM; 32018 break; 32019 } 32020 if (paired && (slice_idx % 2)) { 32021 continue; 32022 } 32023 BCM_IF_ERROR_RETURN 32024 (_field_tr2_group_entry_write(unit, _FP_DEF_INST, slice_idx, 32025 fs, fc, stage_fc)); 32026 } 32027 32028 /* Now sync the expanded slices */ 32029 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 32030 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 32031 /* Skip empty slices */ 32032 if (fs->entry_count == fs->free_count) { 32033 LOG_DEBUG(BSL_LS_BCM_FP, 32034 (BSL_META_U(unit, 32035 "_field_scache_sync: Slice is empty.\n"))); 32036 continue; 32037 } 32038 /* Skip master slices */ 32039 if (stage_fc->slices[_FP_DEF_INST][slice_idx].prev == NULL) { 32040 continue; 32041 } 32042 32043 /* 32044 * Skip expanded slices with no entries installed in Hw 32045 * to match recovery logic. 32046 */ 32047 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 32048 ratio = 2; 32049 } else { 32050 ratio = 1; 32051 } 32052 32053 for (idx = 0; idx < fs->entry_count / ratio; idx++) { 32054 /* Find EID that matches this HW index */ 32055 f_ent = fs->entries[idx]; 32056 if (f_ent == NULL) { 32057 continue; 32058 } 32059 if (!(f_ent->flags & _FP_ENTRY_INSTALLED)) { 32060 continue; 32061 } 32062 break; 32063 } 32064 32065 if (idx == (fs->entry_count / ratio)) { 32066 continue; 32067 } 32068 32069 paired = 0; 32070 32071 /* Ignore secondary slice in paired mode */ 32072 switch (stage_fc->stage_id) { 32073 case _BCM_FIELD_STAGE_INGRESS: 32074 BCM_IF_ERROR_RETURN(soc_mem_read(unit, FP_PORT_FIELD_SELm, 32075 MEM_BLOCK_ANY, 0, &pfs)); 32076 fld = _fb2_slice_pairing_field[slice_idx / 2]; 32077 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit, 32078 &pfs, fld); 32079 break; 32080 case _BCM_FIELD_STAGE_EGRESS: 32081 BCM_IF_ERROR_RETURN(READ_EFP_SLICE_CONTROLr(unit, &val)); 32082 efp_slice_mode = soc_reg_field_get(unit, EFP_SLICE_CONTROLr, 32083 val,_efp_slice_mode[slice_idx]); 32084 if ((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE) || 32085 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY) || 32086 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6)) { 32087 paired = 1; 32088 } 32089 break; 32090 case _BCM_FIELD_STAGE_LOOKUP: 32091 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 32092 if (SOC_IS_KATANA2(unit)) { 32093 BCM_IF_ERROR_RETURN(READ_VFP_KEY_CONTROL_1r(unit, &val64)); 32094 paired = soc_reg64_field32_get(unit, VFP_KEY_CONTROL_1r, val64, fld); 32095 } else { 32096 BCM_IF_ERROR_RETURN(READ_VFP_KEY_CONTROLr(unit, &val)); 32097 paired = soc_reg_field_get(unit, VFP_KEY_CONTROLr, val, fld); 32098 } 32099 break; 32100 case _BCM_FIELD_STAGE_EXTERNAL: 32101 paired = 0; 32102 break; 32103 default: 32104 return BCM_E_PARAM; 32105 break; 32106 } 32107 if (paired && (slice_idx % 2)) { 32108 continue; 32109 } 32110 BCM_IF_ERROR_RETURN 32111 (_field_tr2_group_entry_write(unit, _FP_DEF_INST, slice_idx, 32112 fs, fc, stage_fc)); 32113 } 32114 32115 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_15) { 32116 /* Mark end of Slice Info */ 32117 buf[fc->scache_pos] = _FP_WB_END_OF_SLICES; 32118 fc->scache_pos++; 32119 } 32120 32121 /* Sync EgressPortsAdd Workaround Information */ 32122 if (soc_feature(unit, soc_feature_epc_linkflap_recover)) { 32123 BCM_IF_ERROR_RETURN (_field_egr_ports_recovery_scache_sync 32124 (unit, fc, stage_fc, &buf[fc->scache_pos])); 32125 } 32126 32127 if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) { 32128 if ( stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS || 32129 stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS || 32130 stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP 32131 ) { 32132 LOG_DEBUG(BSL_LS_BCM_FP, 32133 (BSL_META_U(unit,"FP(unit %d) vverb:" 32134 "_bcm_field_td2_scache_sync() - section Writing" 32135 " HintIds information @ byte %d.\n"), 32136 unit, fc->scache_pos)); 32137 BCM_IF_ERROR_RETURN (_bcm_hints_scache_hintid_sync (unit, stage_fc, 32138 &buf[fc->scache_pos])); 32139 } 32140 } 32141 32142 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_15) { 32143 /* Group Slice Selectors */ 32144 BCM_IF_ERROR_RETURN(_field_group_slice_selectors_sync(unit, 32145 &buf[fc->scache_pos], stage_fc->stage_id)); 32146 } 32147 LOG_DEBUG(BSL_LS_BCM_FP, 32148 (BSL_META_U(unit, 32149 "_field_scache_sync: Writing end of section @ byte %d.\n"), 32150 fc->scache_pos)); 32151 32152 /* Mark the end of the section */ 32153 buf[fc->scache_pos] = end_char & 0xFF; 32154 fc->scache_pos++; 32155 buf[fc->scache_pos] = (end_char >> 8) & 0xFF; 32156 fc->scache_pos++; 32157 buf[fc->scache_pos] = (end_char >> 16) & 0xFF; 32158 fc->scache_pos++; 32159 buf[fc->scache_pos] = (end_char >> 24) & 0xFF; 32160 fc->scache_pos++; 32161 fc->scache_usage = fc->scache_pos; /* Usage in bytes */ 32162 32163 if(NULL != buf1) { 32164 /* Mark the end of the section */ 32165 buf1[fc->scache_pos1] = end_char & 0xFF; 32166 fc->scache_pos1++; 32167 buf1[fc->scache_pos1] = (end_char >> 8) & 0xFF; 32168 fc->scache_pos1++; 32169 buf1[fc->scache_pos1] = (end_char >> 16) & 0xFF; 32170 fc->scache_pos1++; 32171 buf1[fc->scache_pos1] = (end_char >> 24) & 0xFF; 32172 fc->scache_pos1++; 32173 } 32174 32175 /* Check for overflow */ 32176 if (fc->scache_pos > fc->scache_size[_FIELD_SCACHE_PART_0]) { 32177 LOG_DEBUG(BSL_LS_BCM_FP, 32178 (BSL_META_U(unit, 32179 "FP(unit %d) Error: Current Scache Position[%u] exceeds Scache size[%u]\n"), 32180 unit, fc->scache_pos, fc->scache_size[_FIELD_SCACHE_PART_0])); 32181 return BCM_E_INTERNAL; 32182 } 32183 32184 if (buf1 != NULL) { 32185 if (fc->scache_pos1 > fc->scache_size[_FIELD_SCACHE_PART_1]) { 32186 LOG_DEBUG(BSL_LS_BCM_FP, 32187 (BSL_META_U(unit, 32188 "FP(unit %d) Error: Current Scache Position1[%u] exceeds Scache size[%u]\n"), 32189 unit, fc->scache_pos1, fc->scache_size[_FIELD_SCACHE_PART_1])); 32190 return BCM_E_INTERNAL; 32191 } 32192 } 32193 32194 return rv; 32195 } 32196 32197 32198 /* Retrieve all GIDs from a slice during Level 2 warm boot */ 32199 int 32200 _field_trx_scache_slice_group_recover(int unit, 32201 _field_control_t *fc, 32202 int instance, 32203 int slice_num, 32204 int *multigroup, 32205 _field_stage_t *stage_fc, 32206 int recovered_count 32207 ) 32208 { 32209 int i, slice_idx; 32210 int next_group_valid; 32211 int rv = BCM_E_INTERNAL; 32212 int qset_count; 32213 int qset; 32214 bcm_field_group_t gid; 32215 int priority; 32216 bcm_port_t port; 32217 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 32218 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 32219 _field_slice_group_info_t *new_grp; 32220 int vmap_size; /* Virtual map index count. */ 32221 int action_res_id; 32222 int revert_scache_pos = 0; 32223 int revert_scache_pos1 = 0; 32224 soc_pbmp_t group_pbmp; 32225 uint8 udf_count = 0; 32226 uint8 udf_idx = 0; 32227 int8 part_idx; 32228 int8 parts_cnt; 32229 32230 if (SOC_IS_ENDURO(unit) || SOC_IS_HURRICANE(unit) || 32231 SOC_IS_HURRICANE2(unit) || SOC_IS_GREYHOUND(unit)) { 32232 return (_field_scache_slice_group_recover(unit, 32233 fc, slice_num, multigroup)); 32234 } 32235 32236 revert_scache_pos = fc->scache_pos; 32237 revert_scache_pos1 = fc->scache_pos1; 32238 /* Parse the scache buffer to recover GIDs and QSETs */ 32239 /* To be used in stage reinit */ 32240 slice_idx = buf[fc->scache_pos] >> 1; 32241 LOG_DEBUG(BSL_LS_BCM_FP, 32242 (BSL_META_U(unit, 32243 "Read slice index %d @ byte %d\n"), 32244 slice_idx, fc->scache_pos)); 32245 if (multigroup) { 32246 *multigroup = buf[fc->scache_pos] & 0x1; 32247 } 32248 32249 fc->scache_pos++; 32250 if (slice_idx != slice_num) { 32251 /* No groups stored for this slice */ 32252 fc->scache_pos--; 32253 return BCM_E_NOT_FOUND; 32254 } 32255 fc->group_arr = NULL; 32256 32257 /* Parse all the group data for this slice */ 32258 do { 32259 SOC_PBMP_CLEAR(group_pbmp); 32260 if (fc->flags & _FP_STABLE_SAVE_LONG_IDS) { 32261 /* Read long group id */ 32262 32263 gid = buf[fc->scache_pos]; 32264 fc->scache_pos++; 32265 gid |= buf[fc->scache_pos] << 8; 32266 fc->scache_pos++; 32267 gid |= buf[fc->scache_pos] << 16; 32268 fc->scache_pos++; 32269 gid |= buf[fc->scache_pos] << 24; 32270 fc->scache_pos++; 32271 } else { 32272 /* Read compact group id */ 32273 32274 gid = buf[fc->scache_pos]; /* GID_lo */ 32275 fc->scache_pos++; 32276 gid |= (buf[fc->scache_pos] << 8); /* GID_hi */ 32277 fc->scache_pos++; 32278 } 32279 32280 port = buf[fc->scache_pos]; /* Rep_port */ 32281 fc->scache_pos++; 32282 32283 LOG_DEBUG(BSL_LS_BCM_FP, 32284 (BSL_META_U(unit, 32285 "Read group id %d @ %d.\n"), 32286 gid, fc->scache_pos - 3)); 32287 32288 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_21) { 32289 int i = 0; 32290 for (i = 0; i < _SHR_PBMP_WORD_MAX; i++) { 32291 group_pbmp.pbits[i] = buf[fc->scache_pos]; 32292 fc->scache_pos++; 32293 group_pbmp.pbits[i] |= buf[fc->scache_pos] << 8; 32294 fc->scache_pos++; 32295 group_pbmp.pbits[i] |= buf[fc->scache_pos] << 16; 32296 fc->scache_pos++; 32297 group_pbmp.pbits[i] |= buf[fc->scache_pos] << 24; 32298 fc->scache_pos++; 32299 } 32300 } 32301 32302 /* Read group priority */ 32303 priority = 0; 32304 priority |= buf[fc->scache_pos]; 32305 fc->scache_pos++; 32306 priority |= buf[fc->scache_pos] << 8; 32307 fc->scache_pos++; 32308 priority |= buf[fc->scache_pos] << 16; 32309 fc->scache_pos++; 32310 priority |= buf[fc->scache_pos] << 24; 32311 fc->scache_pos++; 32312 32313 /* Read group action res id */ 32314 action_res_id = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 32315 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8) { 32316 action_res_id = 0; 32317 action_res_id |= buf[fc->scache_pos]; 32318 fc->scache_pos++; 32319 action_res_id |= buf[fc->scache_pos] << 8; 32320 fc->scache_pos++; 32321 action_res_id |= buf[fc->scache_pos] << 16; 32322 fc->scache_pos++; 32323 action_res_id |= buf[fc->scache_pos] << 24; 32324 fc->scache_pos++; 32325 } 32326 32327 /* Add group info to temp linked list */ 32328 new_grp = NULL; 32329 _FP_XGS3_ALLOC(new_grp, sizeof(_field_slice_group_info_t), 32330 "Temp group info"); 32331 if (NULL == new_grp) { 32332 return (BCM_E_MEMORY); 32333 } 32334 new_grp->gid = gid; 32335 new_grp->priority = priority; 32336 new_grp->action_res_id = action_res_id; 32337 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_21) { 32338 SOC_PBMP_ASSIGN(new_grp->pbmp, group_pbmp); 32339 } 32340 BCM_PBMP_PORT_ADD(new_grp->pbmp, port); 32341 new_grp->next = fc->group_arr; 32342 fc->group_arr = new_grp; 32343 qset_count = buf[fc->scache_pos]; /* QSET_count */ 32344 fc->scache_pos++; 32345 32346 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32347 "Read qset count %d @ s_pos:%d s_pos1:%d.\n\r"), 32348 qset_count, fc->scache_pos, fc->scache_pos1)); 32349 32350 for (i = 0; i < qset_count; i++) { 32351 qset = 0; 32352 qset = buf[fc->scache_pos]; 32353 fc->scache_pos++; 32354 if(NULL != buf1) { 32355 qset |= buf1[fc->scache_pos1] << 8; 32356 fc->scache_pos1++; 32357 } 32358 if ((qset >= recovered_count) && (recovered_count!=0)) { 32359 qset = qset + (bcmFieldQualifyCount - recovered_count); 32360 } 32361 BCM_FIELD_QSET_ADD(new_grp->qset, qset); 32362 32363 LOG_DEBUG(BSL_LS_BCM_FP, 32364 (BSL_META_U(unit, 32365 "Read qualifier %d @ %d.\n"), 32366 qset, fc->scache_pos - 1)); 32367 } 32368 32369 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32370 "After qset count %d @ s_pos:%d s_pos1:%d.\n\r"), 32371 qset_count, fc->scache_pos, fc->scache_pos1)); 32372 32373 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_10) { 32374 qset_count = buf[fc->scache_pos]; /* Internal QSET_count */ 32375 fc->scache_pos++; 32376 32377 LOG_VERBOSE(BSL_LS_BCM_FP, (BSL_META_U(unit, 32378 "Read Internal Qset count %d @ s_pos=%d s_pos1=%d\n"), 32379 qset_count, fc->scache_pos - 1 , fc->scache_pos1)); 32380 32381 for (i = 0; i < qset_count; i++) { 32382 qset = 0; 32383 qset |= buf[fc->scache_pos]; 32384 fc->scache_pos++; 32385 if(NULL != buf1) { 32386 qset |= buf1[fc->scache_pos1] << 8; 32387 fc->scache_pos1++; 32388 } 32389 qset += bcmFieldQualifyCount; 32390 BCM_FIELD_QSET_ADD(new_grp->qset, qset); 32391 32392 LOG_VERBOSE(BSL_LS_BCM_FP, 32393 (BSL_META_U(unit, 32394 "Read internal qualifier %d @ %d.\n"), 32395 qset, fc->scache_pos - 1)); 32396 } 32397 32398 LOG_VERBOSE(BSL_LS_BCM_FP, (BSL_META_U(unit, 32399 "After Internal qset count %d @ s_pos=%d s_pos1=%d\n"), 32400 qset_count, fc->scache_pos, fc->scache_pos1)); 32401 32402 udf_count = buf[fc->scache_pos]; 32403 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32404 "Read udf count %d @ s_pos:%d \n\r"), 32405 udf_count, fc->scache_pos)); 32406 fc->scache_pos++; 32407 for (i = 0; i < udf_count; i++) { 32408 udf_idx = buf[fc->scache_pos]; 32409 fc->scache_pos++; 32410 SHR_BITSET(new_grp->qset.udf_map, udf_idx); 32411 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32412 "Read UDF idx %d @ %d.\n"), 32413 udf_idx, fc->scache_pos - 1)); 32414 } 32415 32416 if (((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_24) && 32417 soc_feature(unit, soc_feature_field_multi_pipe_support) && 32418 !soc_feature(unit, soc_feature_td3_style_fp) && 32419 (_BCM_FIELD_STAGE_LOOKUP == stage_fc->stage_id)) { 32420 int offset_2_3 = 0; /* HW offset 0 and 1 usage status. */ 32421 int offset_4_5 = 0; /* HW offset 2 and 3 usage status. */ 32422 int offset_6_7 = 0; /* HW offset 4 and 5 usage status. */ 32423 int offset_a_b = 0; /* HW offset 8 and 9 usage status. */ 32424 int offset_c_d = 0; /* HW offset a and b usage status. */ 32425 int offset_e_f = 0; /* HW offset c and d usage status. */ 32426 32427 /* Clear already added Inetrnal UDF qual and update based on UDF_MAP */ 32428 BCM_FIELD_QSET_REMOVE_INTERNAL(new_grp->qset, _bcmFieldQualifyData0); 32429 BCM_FIELD_QSET_REMOVE_INTERNAL(new_grp->qset, _bcmFieldQualifyData1); 32430 if (SHR_BITGET(new_grp->qset.udf_map, 0x0)) { 32431 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData0); 32432 } 32433 if (SHR_BITGET(new_grp->qset.udf_map, 0x1)) { 32434 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData1); 32435 } 32436 if (SHR_BITGET(new_grp->qset.udf_map, 0x8)) { 32437 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData5); 32438 } 32439 if (SHR_BITGET(new_grp->qset.udf_map, 0x9)) { 32440 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData6); 32441 } 32442 32443 /* 32_bit qualifiers are over a range of udf_map and hence 32444 * get HW offsets usage status. */ 32445 32446 SHR_BITTEST_RANGE(new_grp->qset.udf_map, 0x2, 2, offset_2_3); 32447 SHR_BITTEST_RANGE(new_grp->qset.udf_map, 0x4, 2, offset_4_5); 32448 SHR_BITTEST_RANGE(new_grp->qset.udf_map, 0x6, 2, offset_6_7); 32449 SHR_BITTEST_RANGE(new_grp->qset.udf_map, 0xa, 2, offset_a_b); 32450 SHR_BITTEST_RANGE(new_grp->qset.udf_map, 0xc, 2, offset_c_d); 32451 SHR_BITTEST_RANGE(new_grp->qset.udf_map, 0xe, 2, offset_e_f); 32452 32453 if (offset_2_3) { 32454 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData2); 32455 } 32456 if (offset_4_5) { 32457 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData3); 32458 } 32459 if (offset_6_7) { 32460 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData4); 32461 } 32462 if (offset_a_b) { 32463 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData7); 32464 } 32465 if (offset_c_d) { 32466 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData8); 32467 } 32468 if (offset_e_f) { 32469 BCM_FIELD_QSET_ADD_INTERNAL(new_grp->qset, _bcmFieldQualifyData9); 32470 } 32471 } 32472 LOG_VERBOSE(BSL_LS_BCM_FP, (BSL_META_U(unit, 32473 "After UDF count %d @ s_pos=%d s_pos1=%d\n"), 32474 udf_count, fc->scache_pos, fc->scache_pos1)); 32475 } 32476 32477 if (((SOC_IS_TRIDENT2X(unit) && 32478 ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15)) || 32479 ((SOC_IS_TITAN2PLUS(unit) || 32480 soc_feature(unit, soc_feature_field_multi_pipe_support)) && 32481 ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_16))) && 32482 (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS)) { 32483 new_grp->efp_pri_key = buf[fc->scache_pos] & 0xf; 32484 new_grp->efp_sec_key = (buf[fc->scache_pos] >> 4) & 0xf; 32485 LOG_VERBOSE(BSL_LS_BCM_FP, (BSL_META_U(unit, 32486 "Reading EFP Key Info@ s_pos=%d s_pos1=%d\n"), 32487 fc->scache_pos, fc->scache_pos1)); 32488 fc->scache_pos++; 32489 } 32490 32491 if (((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) && 32492 ((stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) || 32493 (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP))) { 32494 /* Recover group parts count and src and ingress entity sel */ 32495 parts_cnt = buf[fc->scache_pos]; 32496 fc->scache_pos++; 32497 for (part_idx = 0; part_idx < parts_cnt; part_idx++) { 32498 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 32499 new_grp->sel_ingress_entity[part_idx] = buf[fc->scache_pos]; 32500 fc->scache_pos++; 32501 new_grp->sel_dst_fwd_entity[part_idx] = buf[fc->scache_pos]; 32502 fc->scache_pos++; 32503 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_23) { 32504 new_grp->sel_loopback_type[part_idx] = buf[fc->scache_pos]; 32505 fc->scache_pos++; 32506 } 32507 } 32508 new_grp->sel_src_entity[part_idx] = buf[fc->scache_pos]; 32509 fc->scache_pos++; 32510 } 32511 } 32512 32513 /* 32514 * In this byte, 6 bits are used as below 32515 * bit 0 -- to indicate wheather next group 32516 * in this slice is valid or not 32517 * bit 1,2 -- contains group's instance for version < 1_26 32518 * bit 1,2 -- free bits for version >= 1_26 32519 * bit 5 -- to indicate group lookup enable status. 32520 * bit 6 -- to indicate group is WLAN. 32521 * bit 7 -- to indicate group auto expansion status. 32522 */ 32523 /* stage efp and vfp doesnot support multigroup. hence, 32524 * its set to zero*/ 32525 if ((stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) || 32526 (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP)) { 32527 next_group_valid = 0; 32528 } else { 32529 next_group_valid = buf[fc->scache_pos] & 32530 _FIELD_GROUP_NEXT_GROUP_VALID; 32531 } 32532 if (buf[fc->scache_pos] & _FIELD_GROUP_AUTO_EXPANSION) { 32533 new_grp->flags = new_grp->flags | _FP_GROUP_SELECT_AUTO_EXPANSION; 32534 } 32535 32536 if (buf[fc->scache_pos] & _FIELD_GROUP_LOOKUP_ENABLED) { 32537 new_grp->flags = new_grp->flags | _FP_GROUP_LOOKUP_ENABLED; 32538 } 32539 32540 if (buf[fc->scache_pos] & _FIELD_GROUP_WLAN) { 32541 new_grp->flags = new_grp->flags | _FP_GROUP_WLAN; 32542 } 32543 32544 if ((fc->wb_recovered_version) < BCM_FIELD_WB_VERSION_1_26) { 32545 new_grp->instance = ((buf[fc->scache_pos] >> 1) & 0x3); 32546 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32547 "%s(): Recover instance[%d], byte data:0x%x @ byte %d...\n"), 32548 __func__, new_grp->instance, buf[fc->scache_pos], 32549 fc->scache_pos)); 32550 32551 } else { 32552 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32553 "%s(): Recover byte data:0x%x @ byte %d...\n"), 32554 __func__, buf[fc->scache_pos], 32555 fc->scache_pos)); 32556 32557 fc->scache_pos++; 32558 new_grp->instance = (buf[fc->scache_pos] & 0xf); 32559 32560 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32561 "%s(): Recover instance[%d] @ byte %d...\n"), 32562 __func__, new_grp->instance, 32563 fc->scache_pos)); 32564 } 32565 32566 if (instance != new_grp->instance) { 32567 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32568 "%s(): Inst[%d] retrieved is different from the input inst[%d]\n\r"), 32569 __func__, new_grp->instance, instance)); 32570 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32571 "%s(): revert_scache_pos:[%d] fc->scache_pos:[%d]\n\r"), 32572 __func__, revert_scache_pos, fc->scache_pos)); 32573 fc->scache_pos = revert_scache_pos; 32574 fc->scache_pos1 = revert_scache_pos1; 32575 return BCM_E_NOT_FOUND; 32576 } 32577 32578 fc->scache_pos++; 32579 } while (next_group_valid); 32580 32581 /* The pointer has now advanced to the "entries" section */ 32582 32583 /* Calculate virtual map size. */ 32584 rv = _bcm_field_virtual_map_size_get(unit, stage_fc, &vmap_size); 32585 BCM_IF_ERROR_RETURN(rv); 32586 32587 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32588 "Done reading slice @ %d.\n"), fc->scache_pos)); 32589 return rv; 32590 } 32591 32592 int 32593 _field_trx_entry_info_retrieve(int unit, 32594 _field_control_t *fc, 32595 _field_stage_t *stage_fc, 32596 int multigroup, 32597 int *prev_prio, 32598 _field_entry_wb_info_t *f_ent_wb_info 32599 ) 32600 { 32601 uint8 stat_present, pol_present, prio_ctrl; 32602 uint8 pol_present1 = 0; /* Level 1 policer present */ 32603 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 32604 uint8 part_index = 0; 32605 uint8 part_count = 0; 32606 _bcmFieldActionNoParam_t ingress_mirror_actions[] = { 32607 _bcmFieldActionNoParamMirrorIngress, 32608 _bcmFieldActionNoParamMirrorIngress1, 32609 _bcmFieldActionNoParamMirrorIngress2, 32610 _bcmFieldActionNoParamMirrorIngress3}; 32611 _bcmFieldActionNoParam_t egress_mirror_actions[] = { 32612 _bcmFieldActionNoParamMirrorEgress, 32613 _bcmFieldActionNoParamMirrorEgress1, 32614 _bcmFieldActionNoParamMirrorEgress2, 32615 _bcmFieldActionNoParamMirrorEgress3}; 32616 32617 if (f_ent_wb_info == NULL) { 32618 return BCM_E_INTERNAL; 32619 } 32620 32621 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3) 32622 for (part_index = 0; part_index < _FP_MAX_ENTRY_WIDTH; part_index++) { 32623 f_ent_wb_info->dvp_type[part_index] = _bcmVpTypeAny; 32624 f_ent_wb_info->svp_type[part_index] = _bcmVpTypeAny; 32625 } 32626 #endif 32627 32628 if (SOC_IS_ENDURO(unit) || SOC_IS_HURRICANE(unit) || 32629 SOC_IS_HURRICANE2(unit) || SOC_IS_GREYHOUND(unit)) { 32630 return (_field_entry_info_retrieve(unit, 32631 fc, stage_fc, 32632 multigroup, 32633 prev_prio, 32634 f_ent_wb_info 32635 ) 32636 ); 32637 } 32638 32639 f_ent_wb_info->eid = 0; 32640 f_ent_wb_info->sid = 0; 32641 f_ent_wb_info->pid = f_ent_wb_info->pid1 = 0; 32642 f_ent_wb_info->color_independent = (fc->flags & _FP_COLOR_INDEPENDENT) ? 1 : 0; 32643 32644 if (fc->flags & _FP_STABLE_SAVE_LONG_IDS) { 32645 /* Read long EID and flags */ 32646 32647 f_ent_wb_info->eid |= buf[fc->scache_pos]; 32648 fc->scache_pos++; 32649 f_ent_wb_info->eid |= buf[fc->scache_pos] << 8; 32650 fc->scache_pos++; 32651 f_ent_wb_info->eid |= buf[fc->scache_pos] << 16; 32652 fc->scache_pos++; 32653 f_ent_wb_info->eid |= buf[fc->scache_pos] << 24; 32654 fc->scache_pos++; 32655 32656 prio_ctrl = buf[fc->scache_pos] & 1; 32657 stat_present = (buf[fc->scache_pos] >> 1) & 1; 32658 pol_present = (buf[fc->scache_pos] >> 2) & 1; 32659 fc->scache_pos++; 32660 32661 } else { 32662 /* Read compact EID and flags */ 32663 32664 f_ent_wb_info->eid |= buf[fc->scache_pos]; /* EID_lo */ 32665 fc->scache_pos++; 32666 f_ent_wb_info->eid |= (buf[fc->scache_pos] & 0x1F) << 8; /* EID_hi */ 32667 prio_ctrl = (buf[fc->scache_pos] >> 5) & 0x1; 32668 stat_present = (buf[fc->scache_pos] >> 6) & 0x1; 32669 pol_present = (buf[fc->scache_pos] >> 7) & 0x1; 32670 fc->scache_pos++; 32671 } 32672 32673 LOG_DEBUG(BSL_LS_BCM_FP, 32674 (BSL_META_U(unit, 32675 "Read entry id %d @ byte %d.\n"), 32676 f_ent_wb_info->eid, fc->scache_pos - 2)); 32677 32678 if (multigroup) { 32679 fc->scache_pos += (fc->flags & _FP_STABLE_SAVE_LONG_IDS) ? 4 : 2; /* Skip over GID */ 32680 } 32681 32682 if (prio_ctrl) { 32683 f_ent_wb_info->prio = 0; 32684 f_ent_wb_info->prio |= buf[fc->scache_pos]; 32685 fc->scache_pos++; 32686 f_ent_wb_info->prio |= buf[fc->scache_pos] << 8; 32687 fc->scache_pos++; 32688 f_ent_wb_info->prio |= buf[fc->scache_pos] << 16; 32689 fc->scache_pos++; 32690 f_ent_wb_info->prio |= buf[fc->scache_pos] << 24; 32691 fc->scache_pos++; 32692 *prev_prio = f_ent_wb_info->prio; 32693 } else { 32694 f_ent_wb_info->prio = *prev_prio; 32695 } 32696 32697 if (fc->flags & _FP_STABLE_SAVE_LONG_IDS) { 32698 /* Read long policer and stat ids, if present */ 32699 32700 if (pol_present) { 32701 f_ent_wb_info->pid |= buf[fc->scache_pos]; 32702 fc->scache_pos++; 32703 f_ent_wb_info->pid |= buf[fc->scache_pos] << 8; 32704 fc->scache_pos++; 32705 f_ent_wb_info->pid |= buf[fc->scache_pos] << 16; 32706 fc->scache_pos++; 32707 f_ent_wb_info->pid |= buf[fc->scache_pos] << 24; 32708 fc->scache_pos++; 32709 } 32710 32711 if (stat_present) { 32712 f_ent_wb_info->sid |= buf[fc->scache_pos]; 32713 fc->scache_pos++; 32714 f_ent_wb_info->sid |= buf[fc->scache_pos] << 8; 32715 fc->scache_pos++; 32716 f_ent_wb_info->sid |= buf[fc->scache_pos] << 16; 32717 fc->scache_pos++; 32718 f_ent_wb_info->sid |= buf[fc->scache_pos] << 24; 32719 fc->scache_pos++; 32720 } 32721 } else { 32722 /* Read compact policer and stat ids, if present */ 32723 32724 if (pol_present) { 32725 f_ent_wb_info->pid |= buf[fc->scache_pos]; 32726 fc->scache_pos++; 32727 } 32728 if (stat_present) { 32729 if (pol_present) { 32730 f_ent_wb_info->pid |= (buf[fc->scache_pos] & 0xf0) << 4; 32731 } 32732 f_ent_wb_info->sid |= buf[fc->scache_pos] & 0xf; 32733 fc->scache_pos++; 32734 f_ent_wb_info->sid |= buf[fc->scache_pos] << 4; 32735 fc->scache_pos++; 32736 } else if (pol_present) { 32737 f_ent_wb_info->pid |= (buf[fc->scache_pos] & 0xf0) << 4; 32738 fc->scache_pos++; 32739 } 32740 } 32741 32742 /* Retrieve Entry part count */ 32743 if (((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) && 32744 ((stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) || 32745 (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) || 32746 (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP))) { 32747 part_count = buf[fc->scache_pos]; 32748 fc->scache_pos++; 32749 } else { 32750 part_count = 0; 32751 } 32752 32753 /* Retrieve DVP_type */ 32754 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_6) { 32755 f_ent_wb_info->dvp_type[0] = buf[fc->scache_pos]; 32756 fc->scache_pos++; 32757 part_index = 1; 32758 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) { 32759 for (; part_index < part_count; part_index++) { 32760 f_ent_wb_info->dvp_type[part_index] = buf[fc->scache_pos]; 32761 fc->scache_pos++; 32762 } 32763 } 32764 for (; part_index < _FP_MAX_ENTRY_WIDTH; part_index++) { 32765 f_ent_wb_info->dvp_type[part_index] = f_ent_wb_info->dvp_type[0]; 32766 } 32767 } 32768 32769 /* Retrieve SVP Type */ 32770 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_16) { 32771 f_ent_wb_info->svp_type[0] = buf[fc->scache_pos]; 32772 fc->scache_pos++; 32773 part_index = 1; 32774 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) { 32775 for (; part_index < part_count; part_index++) { 32776 f_ent_wb_info->svp_type[part_index] = buf[fc->scache_pos]; 32777 fc->scache_pos++; 32778 } 32779 } 32780 for (; part_index < _FP_MAX_ENTRY_WIDTH; part_index++) { 32781 f_ent_wb_info->svp_type[part_index] = f_ent_wb_info->svp_type[0]; 32782 } 32783 } 32784 32785 #if defined(BCM_APACHE_SUPPORT) 32786 if (SOC_IS_APACHE(unit)) { 32787 BCM_IF_ERROR_RETURN(_field_apache_entry_info_recovery(unit, 32788 fc, stage_fc, f_ent_wb_info)); 32789 } 32790 #endif 32791 32792 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) \ 32793 || defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT) \ 32794 || defined(BCM_HURRICANE3_SUPPORT) 32795 if ((stat_present) && 32796 (((soc_feature(unit, soc_feature_advanced_flex_counter) || 32797 (((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_12) && 32798 soc_feature(unit, soc_feature_field_vfp_flex_counter)) || 32799 soc_feature(unit, soc_feature_flowcnt)) && 32800 (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP)) || 32801 (soc_feature(unit, soc_feature_advanced_flex_counter) && 32802 (stage_fc->stage_id == _BCM_FIELD_STAGE_EXTERNAL) && 32803 ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_14))) && 32804 (flex_info[unit].valid == 0)) { 32805 flex_info[unit].flex_mode = buf[fc->scache_pos]; 32806 fc->scache_pos++; 32807 flex_info[unit].flex_mode |= buf[fc->scache_pos] << 8; 32808 fc->scache_pos++; 32809 flex_info[unit].flex_mode |= buf[fc->scache_pos] << 16; 32810 fc->scache_pos++; 32811 flex_info[unit].flex_mode |= buf[fc->scache_pos] << 24; 32812 fc->scache_pos++; 32813 flex_info[unit].hw_flags = buf[fc->scache_pos]; 32814 fc->scache_pos++; 32815 flex_info[unit].hw_flags |= buf[fc->scache_pos] << 8; 32816 fc->scache_pos++; 32817 flex_info[unit].hw_flags |= buf[fc->scache_pos] << 16; 32818 fc->scache_pos++; 32819 flex_info[unit].hw_flags |= buf[fc->scache_pos] << 24; 32820 fc->scache_pos++; 32821 flex_info[unit].flex_stat_map |= buf[fc->scache_pos]; 32822 fc->scache_pos++; 32823 32824 flex_info[unit].valid = 1; 32825 } 32826 #endif 32827 /* Recover f_ent_oam_wb structure 32828 * Note: f_ent_oam_wb should be allocated by the 32829 * parent function 32830 */ 32831 if ((((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8) && 32832 (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS)) || 32833 (((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_11) && 32834 (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS))) { 32835 BCM_IF_ERROR_RETURN(_field_entry_oam_wb_scache_recover (unit, fc, 32836 stage_fc, &buf[fc->scache_pos], f_ent_wb_info->f_ent_oam_wb)); 32837 } 32838 32839 /*Retrieve Color Indpendent info*/ 32840 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_13) { 32841 f_ent_wb_info->color_independent = (buf[fc->scache_pos] >> 7) & 0x1; 32842 } 32843 32844 /*Retrieve level 1 policer */ 32845 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 32846 pol_present1 = (buf[fc->scache_pos] >> 6) & 0x1; 32847 } 32848 32849 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_13) { 32850 fc->scache_pos++; 32851 } 32852 32853 if (pol_present1) { 32854 f_ent_wb_info->pid1 |= buf[fc->scache_pos]; 32855 fc->scache_pos++; 32856 f_ent_wb_info->pid1 |= buf[fc->scache_pos] << 8; 32857 fc->scache_pos++; 32858 f_ent_wb_info->pid1 |= buf[fc->scache_pos] << 16; 32859 fc->scache_pos++; 32860 f_ent_wb_info->pid1 |= buf[fc->scache_pos] << 24; 32861 fc->scache_pos++; 32862 } 32863 32864 /* Retrieve Action bitmap */ 32865 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 32866 if ((stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) || 32867 (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) || 32868 (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP)) { 32869 if(f_ent_wb_info->action_bmp->w == NULL) { 32870 return BCM_E_PARAM; 32871 } 32872 32873 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 32874 "Read action bitmap[0x%x] @ byte %d.\n"), 32875 buf[fc->scache_pos], fc->scache_pos)); 32876 32877 f_ent_wb_info->action_bmp->w[0] = buf[fc->scache_pos]; 32878 fc->scache_pos++; 32879 f_ent_wb_info->action_bmp->w[0] |= buf[fc->scache_pos] << 8; 32880 fc->scache_pos++; 32881 f_ent_wb_info->action_bmp->w[0] |= buf[fc->scache_pos] << 16; 32882 fc->scache_pos++; 32883 f_ent_wb_info->action_bmp->w[0] |= buf[fc->scache_pos] << 24; 32884 fc->scache_pos++; 32885 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_19) { 32886 f_ent_wb_info->action_bmp->w[1] = buf[fc->scache_pos]; 32887 fc->scache_pos++; 32888 f_ent_wb_info->action_bmp->w[1] |= buf[fc->scache_pos] << 8; 32889 fc->scache_pos++; 32890 f_ent_wb_info->action_bmp->w[1] |= buf[fc->scache_pos] << 16; 32891 fc->scache_pos++; 32892 f_ent_wb_info->action_bmp->w[1] |= buf[fc->scache_pos] << 24; 32893 fc->scache_pos++; 32894 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT) || \ 32895 defined(BCM_TRIDENT2PLUS_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 32896 /* Retrieve only if actions are present and synced */ 32897 if ((SHR_BITGET(f_ent_wb_info->action_bmp->w, _bcmFieldActionNoParamPortPrioIntCosQNew)) || 32898 (SHR_BITGET(f_ent_wb_info->action_bmp->w, _bcmFieldActionNoParamGpPortPrioIntCosQNew))) { 32899 f_ent_wb_info->port_prio_int_gport |= buf[fc->scache_pos]; 32900 fc->scache_pos++; 32901 f_ent_wb_info->port_prio_int_gport |= buf[fc->scache_pos] << 8; 32902 fc->scache_pos++; 32903 f_ent_wb_info->port_prio_int_gport |= buf[fc->scache_pos] << 16; 32904 fc->scache_pos++; 32905 f_ent_wb_info->port_prio_int_gport |= buf[fc->scache_pos] << 24; 32906 fc->scache_pos++; 32907 } 32908 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, _bcmFieldActionNoParamYpPortPrioIntCosQNew)) { 32909 f_ent_wb_info->yp_port_prio_int_gport |= buf[fc->scache_pos]; 32910 fc->scache_pos++; 32911 f_ent_wb_info->yp_port_prio_int_gport |= buf[fc->scache_pos] << 8; 32912 fc->scache_pos++; 32913 f_ent_wb_info->yp_port_prio_int_gport |= buf[fc->scache_pos] << 16; 32914 fc->scache_pos++; 32915 f_ent_wb_info->yp_port_prio_int_gport |= buf[fc->scache_pos] << 24; 32916 fc->scache_pos++; 32917 } 32918 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, _bcmFieldActionNoParamRpPortPrioIntCosQNew)) { 32919 f_ent_wb_info->rp_port_prio_int_gport |= buf[fc->scache_pos]; 32920 fc->scache_pos++; 32921 f_ent_wb_info->rp_port_prio_int_gport |= buf[fc->scache_pos] << 8; 32922 fc->scache_pos++; 32923 f_ent_wb_info->rp_port_prio_int_gport |= buf[fc->scache_pos] << 16; 32924 fc->scache_pos++; 32925 f_ent_wb_info->rp_port_prio_int_gport |= buf[fc->scache_pos] << 24; 32926 fc->scache_pos++; 32927 } 32928 #endif 32929 } 32930 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_16) { 32931 /* Recover IngressGportType Entry Action. */ 32932 f_ent_wb_info->ing_gport_type = buf[fc->scache_pos]; 32933 fc->scache_pos++; 32934 } 32935 32936 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_20) { 32937 uint8 index, max_index = 1; 32938 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_21) { 32939 max_index = 4; 32940 } 32941 for (index = 0 ; index < max_index ; index++) { 32942 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, ingress_mirror_actions[index])) { 32943 f_ent_wb_info->ingress_mirror[index] = buf[fc->scache_pos]; 32944 fc->scache_pos++; 32945 f_ent_wb_info->ingress_mirror[index] |= buf[fc->scache_pos] << 8; 32946 fc->scache_pos++; 32947 f_ent_wb_info->ingress_mirror[index] |= buf[fc->scache_pos] << 16; 32948 fc->scache_pos++; 32949 f_ent_wb_info->ingress_mirror[index] |= buf[fc->scache_pos] << 24; 32950 fc->scache_pos++; 32951 } 32952 } 32953 for (index = 0 ; index < max_index ; index++) { 32954 if (SHR_BITGET(f_ent_wb_info->action_bmp->w, egress_mirror_actions[index])) { 32955 f_ent_wb_info->egress_mirror[index] = buf[fc->scache_pos]; 32956 fc->scache_pos++; 32957 f_ent_wb_info->egress_mirror[index] |= buf[fc->scache_pos] << 8; 32958 fc->scache_pos++; 32959 f_ent_wb_info->egress_mirror[index] |= buf[fc->scache_pos] << 16; 32960 fc->scache_pos++; 32961 f_ent_wb_info->egress_mirror[index] |= buf[fc->scache_pos] << 24; 32962 fc->scache_pos++; 32963 } 32964 } 32965 if ( SHR_BITGET(f_ent_wb_info->action_bmp->w, 32966 _bcmFieldActionNoParamFabricQueue)){ 32967 (f_ent_wb_info->action_fabricQueue_wb.cosq_gport) = 32968 buf[fc->scache_pos]; 32969 fc->scache_pos++; 32970 (f_ent_wb_info->action_fabricQueue_wb.cosq_gport) |= 32971 buf[fc->scache_pos] << 8; 32972 fc->scache_pos++; 32973 (f_ent_wb_info->action_fabricQueue_wb.cosq_gport) |= 32974 buf[fc->scache_pos] << 16; 32975 fc->scache_pos++; 32976 (f_ent_wb_info->action_fabricQueue_wb.cosq_gport) |= 32977 buf[fc->scache_pos] << 24; 32978 fc->scache_pos++; 32979 #if defined(BCM_KATANA_SUPPORT) 32980 if (SOC_IS_KATANAX(unit)) { 32981 (f_ent_wb_info->action_fabricQueue_wb.profile_idx) = 32982 buf[fc->scache_pos]; 32983 fc->scache_pos++; 32984 (f_ent_wb_info->action_fabricQueue_wb.profile_idx) |= 32985 buf[fc->scache_pos] << 8; 32986 fc->scache_pos++; 32987 (f_ent_wb_info->action_fabricQueue_wb.profile_idx) |= 32988 buf[fc->scache_pos] << 16; 32989 fc->scache_pos++; 32990 (f_ent_wb_info->action_fabricQueue_wb.profile_idx) |= 32991 buf[fc->scache_pos] << 24; 32992 fc->scache_pos++; 32993 } 32994 #endif /* BCM_KATANA_SUPPORT */ 32995 } 32996 } 32997 } 32998 } 32999 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_17) { 33000 LOG_DEBUG (BSL_LS_BCM_FP, (BSL_META_U(unit, 33001 "Read policer delta rates @ %d\n"), fc->scache_pos)); 33002 BCM_IF_ERROR_RETURN (_field_entry_policer_delta_rates_recover (unit, fc, 33003 stage_fc, &buf[fc->scache_pos], f_ent_wb_info->f_ent_policer_wb, 33004 pol_present, pol_present1)); 33005 LOG_DEBUG (BSL_LS_BCM_FP, (BSL_META_U(unit, 33006 "Done reading policer delta rates @ %d\n"), fc->scache_pos)); 33007 } 33008 LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, 33009 "Done reading entry @ %d.\n"), fc->scache_pos)); 33010 33011 return BCM_E_NONE; 33012 } 33013 33014 /* Loops through the WB groups info of the slice 33015 * gets the appropriate group in fc to update 33016 * ingress and src entity selcode and 33017 * add qual offset 33018 */ 33019 int 33020 _field_tr2_group_construct_quals_with_sel_update(int unit, 33021 _field_control_t *fc, 33022 _field_stage_t *stage_fc) 33023 { 33024 _field_slice_group_info_t *curr_ptr = NULL; 33025 _field_group_t *grp_ptr = NULL; 33026 int i, parts_count; 33027 33028 if ((fc == NULL) || (stage_fc == NULL)) { 33029 return BCM_E_INTERNAL; 33030 } 33031 33032 if (SOC_IS_ENDURO(unit) || SOC_IS_HURRICANE(unit) || 33033 SOC_IS_HURRICANE2(unit) || SOC_IS_GREYHOUND(unit)) { 33034 return BCM_E_NONE; 33035 } 33036 33037 for (curr_ptr = fc->group_arr; curr_ptr != NULL; curr_ptr = curr_ptr->next) { 33038 /* loop through the fc->groups to find the matching group id */ 33039 for (grp_ptr = fc->groups; grp_ptr != NULL ; grp_ptr = grp_ptr->next) { 33040 if (curr_ptr->gid == grp_ptr->gid) { 33041 33042 BCM_IF_ERROR_RETURN(_bcm_field_entry_tcam_parts_count(unit, 33043 grp_ptr->stage_id, grp_ptr->flags, &parts_count)); 33044 33045 /* Updates ingress and src entity selcode and 33046 * free qual offset arr if allocated previously 33047 */ 33048 for (i = 0; i < parts_count; i++) { 33049 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 33050 grp_ptr->sel_codes[i].ingress_entity_sel = curr_ptr->sel_ingress_entity[i]; 33051 grp_ptr->sel_codes[i].dst_fwd_entity_sel = curr_ptr->sel_dst_fwd_entity[i]; 33052 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_23) { 33053 grp_ptr->sel_codes[i].loopback_type_sel = curr_ptr->sel_loopback_type[i]; 33054 } 33055 } 33056 /* for TD2 ingress, the secondary selector _bcm_fieldSrcEntrity 33057 * is not used. It wa wrongly used in older releaess (prior to 6_5_12). 33058 * below code is used to set the replace _bcm_fieldSrcEntrity to 33059 * _bcm_fieldIngressEntrity during warmboot recovery 33060 */ 33061 if ((stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) && 33062 (SOC_IS_TRIDENT2(unit))) { 33063 if ((curr_ptr->sel_src_entity[i] == _FP_SELCODE_DONT_CARE) || 33064 (curr_ptr->sel_src_entity[i] == 0)) { 33065 grp_ptr->sel_codes[i].src_entity_sel = 33066 curr_ptr->sel_src_entity[i]; 33067 } else { 33068 grp_ptr->sel_codes[i].ingress_entity_sel = 33069 curr_ptr->sel_src_entity[i]; 33070 } 33071 } else { 33072 grp_ptr->sel_codes[i].src_entity_sel = 33073 curr_ptr->sel_src_entity[i]; 33074 } 33075 BCM_IF_ERROR_RETURN(_bcm_field_group_qualifiers_free(grp_ptr, i)); 33076 } 33077 33078 /* Recover group qualifiers based on selector codes */ 33079 _field_tr2_group_construct_quals_add(unit, 33080 fc, 33081 stage_fc, 33082 grp_ptr 33083 ); 33084 break; 33085 } 33086 } 33087 } 33088 return BCM_E_NONE; 33089 } 33090 33091 #if defined(BCM_TRIUMPH3_SUPPORT) 33092 /* 33093 * Function: 33094 * _field_stat_mode_entry_count_get 33095 * 33096 * Purpose: 33097 * Sets number of counters for the stat group mode in field 33098 * stat structure 33099 * 33100 * Parameters: 33101 * unit - (IN) BCM device number 33102 * f_st - (IN) Field stat structure pointer 33103 * 33104 * Returns: 33105 * BCM_E_XXX 33106 */ 33107 int _field_stat_mode_entry_count_get(int unit, _field_stat_t *f_st) 33108 { 33109 if (f_st == NULL) { 33110 return (BCM_E_INTERNAL); 33111 } 33112 33113 switch(f_st->hw_mode) { 33114 case bcmStatGroupModeSingle: 33115 f_st->hw_entry_count = 1; 33116 break; 33117 case bcmStatGroupModeTrafficType: 33118 f_st->hw_entry_count = 3; 33119 break; 33120 case bcmStatGroupModeDlfAll: 33121 f_st->hw_entry_count = 2; 33122 break; 33123 case bcmStatGroupModeDlfIntPri: 33124 f_st->hw_entry_count = 17; 33125 break; 33126 case bcmStatGroupModeTyped: 33127 f_st->hw_entry_count = 4; 33128 break; 33129 case bcmStatGroupModeTypedAll: 33130 f_st->hw_entry_count = 5; 33131 break; 33132 case bcmStatGroupModeTypedIntPri: 33133 f_st->hw_entry_count = 20; 33134 break; 33135 case bcmStatGroupModeSingleWithControl: 33136 f_st->hw_entry_count = 2; 33137 break; 33138 case bcmStatGroupModeTrafficTypeWithControl: 33139 f_st->hw_entry_count = 4; 33140 break; 33141 case bcmStatGroupModeDlfAllWithControl: 33142 f_st->hw_entry_count = 3; 33143 break; 33144 case bcmStatGroupModeDlfIntPriWithControl: 33145 f_st->hw_entry_count = 18; 33146 break; 33147 case bcmStatGroupModeTypedWithControl: 33148 f_st->hw_entry_count = 5; 33149 break; 33150 case bcmStatGroupModeTypedAllWithControl: 33151 f_st->hw_entry_count = 6; 33152 break; 33153 case bcmStatGroupModeTypedIntPriWithControl: 33154 f_st->hw_entry_count = 21; 33155 break; 33156 case bcmStatGroupModeDot1P: 33157 f_st->hw_entry_count = 8; 33158 break; 33159 case bcmStatGroupModeIntPri: 33160 f_st->hw_entry_count = 16; 33161 break; 33162 case bcmStatGroupModeIntPriCng: 33163 f_st->hw_entry_count = 64; 33164 break; 33165 case bcmStatGroupModeSvpType: 33166 f_st->hw_entry_count = 2; 33167 break; 33168 case bcmStatGroupModeDscp: 33169 f_st->hw_entry_count = 64; 33170 break; 33171 case bcmStatGroupModeDvpType: 33172 f_st->hw_entry_count = 0; 33173 break; 33174 case bcmStatGroupModeCng: 33175 f_st->hw_entry_count = 4; 33176 break; 33177 default: 33178 f_st->hw_entry_count = 0; 33179 break; 33180 } 33181 return BCM_E_NONE; 33182 } 33183 #endif 33184 33185 33186 #if defined(BCM_TRIUMPH2_SUPPORT) 33187 int _field_vfp_flex_stat_info_retrieve(int unit, int stat_id) 33188 { 33189 _field_stat_t *f_st = NULL; 33190 _bcm_flex_stat_type_t fs_type; 33191 33192 if (!soc_feature(unit, soc_feature_field_vfp_flex_counter)) { 33193 return BCM_E_INTERNAL; 33194 } 33195 33196 if (flex_info[unit].valid == 1) { 33197 BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, stat_id, &f_st)); 33198 33199 /* Update only for the first ref of stat */ 33200 if (f_st->hw_ref_count == 1) { 33201 33202 f_st->flex_mode = flex_info[unit].flex_mode; 33203 f_st->hw_flags = flex_info[unit].hw_flags; 33204 33205 /* During WARM BOOT, the controlling module should check if the 33206 * flexible statistic index for a particular handle is non-zero. If so, 33207 * the flexible stats must be notified so the SW data structures are 33208 * maintained.*/ 33209 33210 if (flex_info[unit].flex_mode) { 33211 fs_type = _BCM_FLEX_STAT_TYPE(f_st->flex_mode); 33212 } else { 33213 fs_type = _bcmFlexStatTypeFp; 33214 } 33215 33216 if (f_st->hw_index != _FP_INVALID_INDEX) { 33217 _bcm_esw_flex_stat_reinit_add(unit, fs_type, 33218 f_st->hw_index, f_st->sid); 33219 } 33220 } 33221 } 33222 flex_info[unit].valid=0; 33223 return BCM_E_NONE; 33224 } 33225 #endif 33226 #if defined(BCM_HURRICANE3_SUPPORT) 33227 int _field_flowcnt_stat_info_retrieve(int unit, int stat_id) 33228 { 33229 _field_stat_t *f_st = NULL; 33230 bcm_stat_group_mode_t stat_mode; /* Stat type bcmStatGroupModeXXX. */ 33231 bcm_stat_object_t stat_obj; /* Stat object type. */ 33232 uint32 pool_num = 0; /* Flowcnt Stat Hw Pool No. */ 33233 uint32 base_index = 0; /* Flowcnt Stat counter base index. */ 33234 uint32 profile_group = 0; /* Flowcnt Stat profile num */ 33235 33236 if (flex_info[unit].valid == 1) { 33237 BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, stat_id, &f_st)); 33238 33239 /* Update only for the first ref of stat */ 33240 if (f_st->hw_ref_count == 1) { 33241 33242 f_st->flex_mode = flex_info[unit].flex_mode; 33243 f_st->hw_flags = flex_info[unit].hw_flags; 33244 33245 _bcm_esw_flowcnt_counter_id_get(f_st->flex_mode, 33246 &stat_mode, &stat_obj, &profile_group, 33247 &pool_num, &base_index); 33248 f_st->hw_index = base_index; 33249 f_st->pool_index = pool_num; 33250 f_st->hw_mode = stat_mode; 33251 f_st->hw_entry_count = 1; 33252 } 33253 } 33254 flex_info[unit].valid=0; 33255 return BCM_E_NONE; 33256 } 33257 #endif 33258 33259 33260 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) \ 33261 || defined(BCM_TRIDENT2_SUPPORT) 33262 int _field_adv_flex_stat_info_retrieve(int unit, int stat_id) 33263 { 33264 _field_stat_t *f_st = NULL; 33265 bcm_stat_group_mode_t stat_mode; /* Stat type bcmStatGroupModeXXX. */ 33266 bcm_stat_object_t stat_obj; /* Stat object type. */ 33267 uint32 pool_num; /* Flex Stat Hw Pool No. */ 33268 uint32 base_index; /* Flex Stat counter base index. */ 33269 int offset_mode = 0; 33270 33271 if (!soc_feature(unit, soc_feature_advanced_flex_counter)) { 33272 return BCM_E_INTERNAL; 33273 } 33274 33275 if ((flex_info[unit].valid == 1) && (flex_info[unit].flex_mode != 0)) { 33276 BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, stat_id, &f_st)); 33277 33278 f_st->flex_mode = flex_info[unit].flex_mode; 33279 f_st->hw_flags = flex_info[unit].hw_flags; 33280 _bcm_esw_stat_get_counter_id_info(unit, f_st->flex_mode, 33281 &stat_mode, 33282 &stat_obj, 33283 (uint32 *)&offset_mode, 33284 &pool_num, 33285 &base_index 33286 ); 33287 f_st->hw_index = base_index; 33288 f_st->pool_index = pool_num; 33289 f_st->hw_mode = offset_mode; /* offset_mode from counter info */ 33290 f_st->hw_entry_count = 1; /* PlsNote:For SingleMode=1 */ 33291 /* Currently OnlySingleMode is supportes so above OK */ 33292 /* else decision will be based on stat_mode */ 33293 33294 #if defined(BCM_TRIUMPH3_SUPPORT) 33295 if (SOC_IS_TRIUMPH3(unit)) { 33296 /* For TR3, multiple stat group modes are supported. Based on the 33297 stat group mode, set hw_entry_count */ 33298 BCM_IF_ERROR_RETURN(_field_stat_mode_entry_count_get(unit, f_st)); 33299 } 33300 #endif 33301 } 33302 flex_info[unit].valid=0; 33303 return BCM_E_NONE; 33304 } 33305 #endif 33306 33307 #if 0 33308 STATIC int 33309 mem_read(int unit, int mem, char *str, void **buf) 33310 { 33311 if ((*buf = soc_cm_salloc(unit, 33312 soc_mem_index_count(unit, mem) 33313 * soc_mem_entry_bytes(unit, mem), 33314 str 33315 ) 33316 ) 33317 == NULL 33318 ) { 33319 return (BCM_E_MEMORY); 33320 } 33321 33322 return (soc_mem_read_range(unit, 33323 mem, 33324 MEM_BLOCK_ANY, 33325 soc_mem_index_min(unit, mem), 33326 soc_mem_index_max(unit, mem), 33327 *buf 33328 ) 33329 ); 33330 } 33331 #endif 33332 33333 /* 33334 * Function: 33335 * _field_tr2_loopback_type_sel_recover 33336 * 33337 * Purpose: 33338 * Retrieve slice TunnelType/LoopbackType settings from installed 33339 * field entry. 33340 * 33341 * Parameters: 33342 * unit - (IN) BCM device number 33343 * slice_idx - (IN) Slice number to enable 33344 * fp_tcam_buf - (IN) TCAM entry 33345 * stage_fc - (IN) FP stage control info. 33346 * intraslice - (IN) Slice in Intra-Slice Double Wide mode. 33347 * loopback_type_sel - (OUT) Tunnel/Loopback Type selector value 33348 * 33349 * Returns: 33350 * Nothing 33351 */ 33352 STATIC int 33353 _field_tr2_loopback_type_sel_recover(int unit, 33354 int slice_idx, 33355 uint32 *fp_tcam_buf, 33356 _field_stage_t *stage_fc, 33357 int intraslice, 33358 int8 *loopback_type_sel) 33359 { 33360 fp_tcam_entry_t *tcam_entry; /* Installed TCAM entry. */ 33361 uint32 tunnel_loopback_type = 0; /* Hw Tunnel/Loopback value. */ 33362 fp_slice_map_entry_t fp_slice_map_buf; /* Slice map table entry. */ 33363 _field_slice_t *fs; /* Pointer to Slice info. */ 33364 _field_control_t *fc; /* Pointer to field control */ 33365 int slice_ent_cnt; /* No. of entries in slice. */ 33366 int idx; /* Slice index. */ 33367 int vmap_size, index; /* Virtual Map entry size. */ 33368 int virtual_group = -1; /* Virtual Group ID. */ 33369 int phy_slice; /* Physical slice value. */ 33370 33371 static const soc_field_t physical_slice[] = { 33372 VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33373 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33374 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33375 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33376 VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33377 VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33378 VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33379 VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33380 VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33381 VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33382 VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33383 VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33384 VIRTUAL_SLICE_12_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33385 VIRTUAL_SLICE_13_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33386 VIRTUAL_SLICE_14_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33387 VIRTUAL_SLICE_15_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 33388 VIRTUAL_SLICE_16_PHYSICAL_SLICE_NUMBER_ENTRY_0f 33389 }, slice_group[] = { 33390 VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33391 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33392 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33393 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33394 VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33395 VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33396 VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33397 VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33398 VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33399 VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33400 VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33401 VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33402 VIRTUAL_SLICE_12_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33403 VIRTUAL_SLICE_13_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33404 VIRTUAL_SLICE_14_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33405 VIRTUAL_SLICE_15_VIRTUAL_SLICE_GROUP_ENTRY_0f, 33406 VIRTUAL_SLICE_16_VIRTUAL_SLICE_GROUP_ENTRY_0f 33407 }; 33408 33409 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 33410 33411 vmap_size = stage_fc->tcam_slices; 33412 if (fc->flags & _FP_EXTERNAL_PRESENT) { 33413 ++vmap_size; 33414 } 33415 33416 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 33417 FP_SLICE_MAPm, 33418 MEM_BLOCK_ANY, 33419 0, 33420 fp_slice_map_buf.entry_data 33421 ) 33422 ); 33423 33424 /* Get the virtual group id for given slice_idx. */ 33425 for (index = 0; index < vmap_size; index++) { 33426 phy_slice = soc_mem_field32_get(unit, 33427 FP_SLICE_MAPm, 33428 fp_slice_map_buf.entry_data, 33429 physical_slice[index]); 33430 if (slice_idx != phy_slice) { 33431 continue; 33432 } 33433 virtual_group = soc_mem_field32_get(unit, 33434 FP_SLICE_MAPm, 33435 fp_slice_map_buf.entry_data, 33436 slice_group[index]); 33437 break; 33438 } 33439 33440 /* Must be a valid virtual_group to proceed further. */ 33441 if (-1 == virtual_group) { 33442 return (BCM_E_INTERNAL); 33443 } 33444 33445 /* 33446 * For expanded group slices, check if any entry in 33447 * this slice has loopback_type_sel selector set. 33448 */ 33449 for (index = 0; index < vmap_size; index++) { 33450 if (virtual_group 33451 != soc_mem_field32_get(unit, 33452 FP_SLICE_MAPm, 33453 fp_slice_map_buf.entry_data, 33454 slice_group[index])) { 33455 continue; 33456 } 33457 33458 phy_slice = soc_mem_field32_get(unit, 33459 FP_SLICE_MAPm, 33460 fp_slice_map_buf.entry_data, 33461 physical_slice[index]); 33462 fs = stage_fc->slices[_FP_DEF_INST] + phy_slice; 33463 slice_ent_cnt = fs->entry_count; 33464 33465 if (intraslice) { 33466 slice_ent_cnt >>= 1; 33467 } 33468 33469 for (idx = 0; idx < slice_ent_cnt; idx++) { 33470 tcam_entry = soc_mem_table_idx_to_pointer 33471 (unit, 33472 FP_TCAMm, 33473 fp_tcam_entry_t *, 33474 fp_tcam_buf, 33475 idx + slice_ent_cnt * phy_slice 33476 ); 33477 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) != 0) { 33478 /* Extract Tunnel Info from tcam_entry */ 33479 _field_extract((uint32 *)tcam_entry, 33480 21, 33481 4, 33482 &tunnel_loopback_type 33483 ); 33484 switch (tunnel_loopback_type) { 33485 case 0x1: /* IP_TUNNEL */ 33486 case 0x2: /* MPLS_TUNNEL */ 33487 case 0x3: /* MIM_TUNNEL */ 33488 case 0x4: /* WLAN_WTP TUNNEL */ 33489 case 0x5: /* WLAN_AC TUNNEL */ 33490 case 0x6: /* AMT_TUNNEL */ 33491 case 0x7: /* TRILL_TUNNEL */ 33492 *loopback_type_sel = 1; 33493 break; 33494 case 0x8: /* NONE */ 33495 case 0x9: /* EP REDIRECTION LOOPBACK */ 33496 case 0xb: /* MiM LOOPBACK */ 33497 case 0xc: /* WLAN LOOPBACK || Trill Network Loopback */ 33498 case 0xd: /* Trill Access Loopback */ 33499 case 0xe: /* EGRESS MIRROR LOOPBACK */ 33500 *loopback_type_sel = 0; 33501 break; 33502 default: 33503 ; 33504 } 33505 33506 if (*loopback_type_sel != _FP_SELCODE_DONT_CARE) { 33507 goto done; 33508 } 33509 } 33510 } 33511 } 33512 33513 done: 33514 return (BCM_E_NONE); 33515 } 33516 33517 void 33518 _field_tr2_ingress_entity_get(int unit, int slice_idx, uint32 *fp_tcam_buf, 33519 int slice_ent_cnt, _field_stage_t *stage_fc, 33520 int8 *ingress_entity_sel) 33521 { 33522 fp_tcam_entry_t *tcam_entry; 33523 uint32 svp_valid = 0; 33524 int idx; 33525 uint32 offset = 0; 33526 33527 if (SOC_IS_TD2_TT2(unit)) { 33528 offset = 138 + 5; /* FIXED Start = 138, SVP_VALID offset = 5 */ 33529 } else { 33530 offset = 10 + 4; /* FIXED Start = 10, SVP_VALID offset = 4 */ 33531 } 33532 for (idx = 0; idx < slice_ent_cnt; idx++) { 33533 tcam_entry = soc_mem_table_idx_to_pointer(unit, FP_TCAMm, 33534 fp_tcam_entry_t *, 33535 fp_tcam_buf, idx + 33536 slice_ent_cnt * 33537 slice_idx); 33538 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) != 0) { 33539 _field_extract((uint32 *)tcam_entry, offset, 1, &svp_valid); 33540 if (svp_valid) { 33541 break; 33542 } 33543 } 33544 } 33545 if (svp_valid) { 33546 *ingress_entity_sel = _bcmFieldFwdEntityMimGport; 33547 } 33548 return; 33549 } 33550 33551 int _field_action_params_pbmp_get (int unit, uint32 param[], 33552 bcm_pbmp_t *pbmp) 33553 { 33554 int i; 33555 BCM_PBMP_CLEAR(*pbmp); 33556 33557 for (i = 0; (i < _FP_ACTION_PARAM_SZ) && (i < SOC_PBMP_WORD_MAX); i++) { 33558 SOC_PBMP_WORD_SET(*pbmp, i, param[i]); 33559 } 33560 return BCM_E_NONE; 33561 } 33562 33563 /* Function: _field_egr_ports_recovery_wb_upgrade_add 33564 * 33565 * Purpose: 33566 * Handle Warmboot Upgrade case for Egress Portbitmap 33567 * Recovery Database. 33568 * Parameters: 33569 * unit - BCM device number 33570 * fg - Group Structure Pointer 33571 * Returns: 33572 BCM_E_NONE - Success 33573 */ 33574 int _field_egr_ports_recovery_wb_upgrade_add (int unit, 33575 _field_group_t *fg 33576 ) 33577 { 33578 int idx = -1; 33579 _field_entry_t *f_ent; /* Field entry info */ 33580 _field_action_t *fa; /* Field action descriptor */ 33581 bcm_pbmp_t pbmp; /* Egress Ports Pbmp */ 33582 33583 while (fg != NULL) { 33584 if (fg->stage_id != _BCM_FIELD_STAGE_INGRESS) { 33585 fg = fg->next; 33586 } else { 33587 for (idx = 0; idx < fg->group_status.entry_count; idx++) { 33588 f_ent = fg->entry_arr[idx]; 33589 33590 if (f_ent != NULL) { 33591 for (fa = f_ent->actions; fa != NULL; fa = fa->next) { 33592 if (fa->action == bcmFieldActionEgressPortsAdd) { 33593 /* Add code to insert Database */ 33594 _field_action_params_pbmp_get (unit, fa->param, 33595 &pbmp); 33596 _bcm_trx_field_egr_ports_recovery_add (unit, 33597 f_ent->eid, pbmp); 33598 break; 33599 } 33600 } 33601 } 33602 } 33603 fg = fg->next; 33604 } 33605 } 33606 return BCM_E_NONE; 33607 } 33608 33609 int 33610 _field_tr2_stage_ingress_reinit(int unit, 33611 _field_control_t *fc, 33612 _field_stage_t *stage_fc 33613 ) 33614 { 33615 static const soc_field_t ifp_en_flds[] = { 33616 FP_SLICE_ENABLE_SLICE_0f, 33617 FP_SLICE_ENABLE_SLICE_1f, 33618 FP_SLICE_ENABLE_SLICE_2f, 33619 FP_SLICE_ENABLE_SLICE_3f, 33620 FP_SLICE_ENABLE_SLICE_4f, 33621 FP_SLICE_ENABLE_SLICE_5f, 33622 FP_SLICE_ENABLE_SLICE_6f, 33623 FP_SLICE_ENABLE_SLICE_7f, 33624 FP_SLICE_ENABLE_SLICE_8f, 33625 FP_SLICE_ENABLE_SLICE_9f, 33626 FP_SLICE_ENABLE_SLICE_10f, 33627 FP_SLICE_ENABLE_SLICE_11f, 33628 FP_SLICE_ENABLE_SLICE_12f, 33629 FP_SLICE_ENABLE_SLICE_13f, 33630 FP_SLICE_ENABLE_SLICE_14f, 33631 FP_SLICE_ENABLE_SLICE_15f 33632 }; 33633 static const soc_field_t ifp_lk_en_flds[] = { 33634 FP_LOOKUP_ENABLE_SLICE_0f, 33635 FP_LOOKUP_ENABLE_SLICE_1f, 33636 FP_LOOKUP_ENABLE_SLICE_2f, 33637 FP_LOOKUP_ENABLE_SLICE_3f, 33638 FP_LOOKUP_ENABLE_SLICE_4f, 33639 FP_LOOKUP_ENABLE_SLICE_5f, 33640 FP_LOOKUP_ENABLE_SLICE_6f, 33641 FP_LOOKUP_ENABLE_SLICE_7f, 33642 FP_LOOKUP_ENABLE_SLICE_8f, 33643 FP_LOOKUP_ENABLE_SLICE_9f, 33644 FP_LOOKUP_ENABLE_SLICE_10f, 33645 FP_LOOKUP_ENABLE_SLICE_11f, 33646 FP_LOOKUP_ENABLE_SLICE_12f, 33647 FP_LOOKUP_ENABLE_SLICE_13f, 33648 FP_LOOKUP_ENABLE_SLICE_14f, 33649 FP_LOOKUP_ENABLE_SLICE_15f 33650 }; 33651 static const soc_field_t ifp_en_field_tbl[][3] = { 33652 { SLICE0_F1f, SLICE0_F2f, SLICE0_F3f }, 33653 { SLICE1_F1f, SLICE1_F2f, SLICE1_F3f }, 33654 { SLICE2_F1f, SLICE2_F2f, SLICE2_F3f }, 33655 { SLICE3_F1f, SLICE3_F2f, SLICE3_F3f }, 33656 { SLICE4_F1f, SLICE4_F2f, SLICE4_F3f }, 33657 { SLICE5_F1f, SLICE5_F2f, SLICE5_F3f }, 33658 { SLICE6_F1f, SLICE6_F2f, SLICE6_F3f }, 33659 { SLICE7_F1f, SLICE7_F2f, SLICE7_F3f }, 33660 { SLICE8_F1f, SLICE8_F2f, SLICE8_F3f }, 33661 { SLICE9_F1f, SLICE9_F2f, SLICE9_F3f }, 33662 { SLICE10_F1f, SLICE10_F2f, SLICE10_F3f }, 33663 { SLICE11_F1f, SLICE11_F2f, SLICE11_F3f }, 33664 { SLICE12_F1f, SLICE12_F2f, SLICE12_F3f }, 33665 { SLICE13_F1f, SLICE13_F2f, SLICE13_F3f }, 33666 { SLICE14_F1f, SLICE14_F2f, SLICE14_F3f }, 33667 { SLICE15_F1f, SLICE15_F2f, SLICE15_F3f } 33668 }; 33669 static const soc_field_t ifp_en_sd_type_field_tbl[][2] = { 33670 { SLICE0_S_TYPE_SELf, SLICE0_D_TYPE_SELf}, 33671 { SLICE1_S_TYPE_SELf, SLICE1_D_TYPE_SELf}, 33672 { SLICE2_S_TYPE_SELf, SLICE2_D_TYPE_SELf}, 33673 { SLICE3_S_TYPE_SELf, SLICE3_D_TYPE_SELf}, 33674 { SLICE4_S_TYPE_SELf, SLICE4_D_TYPE_SELf}, 33675 { SLICE5_S_TYPE_SELf, SLICE5_D_TYPE_SELf}, 33676 { SLICE6_S_TYPE_SELf, SLICE6_D_TYPE_SELf}, 33677 { SLICE7_S_TYPE_SELf, SLICE7_D_TYPE_SELf}, 33678 { SLICE8_S_TYPE_SELf, SLICE8_D_TYPE_SELf}, 33679 { SLICE9_S_TYPE_SELf, SLICE9_D_TYPE_SELf}, 33680 { SLICE10_S_TYPE_SELf, SLICE10_D_TYPE_SELf}, 33681 { SLICE11_S_TYPE_SELf, SLICE11_D_TYPE_SELf}, 33682 { SLICE12_S_TYPE_SELf, SLICE12_D_TYPE_SELf}, 33683 { SLICE13_S_TYPE_SELf, SLICE13_D_TYPE_SELf}, 33684 { SLICE14_S_TYPE_SELf, SLICE14_D_TYPE_SELf}, 33685 { SLICE15_S_TYPE_SELf, SLICE15_D_TYPE_SELf} 33686 }; 33687 static const soc_field_t ifp_en_slice_wide_mode_field[] = { 33688 SLICE0_DOUBLE_WIDE_MODEf, 33689 SLICE1_DOUBLE_WIDE_MODEf, 33690 SLICE2_DOUBLE_WIDE_MODEf, 33691 SLICE3_DOUBLE_WIDE_MODEf, 33692 SLICE4_DOUBLE_WIDE_MODEf, 33693 SLICE5_DOUBLE_WIDE_MODEf, 33694 SLICE6_DOUBLE_WIDE_MODEf, 33695 SLICE7_DOUBLE_WIDE_MODEf, 33696 SLICE8_DOUBLE_WIDE_MODEf, 33697 SLICE9_DOUBLE_WIDE_MODEf, 33698 SLICE10_DOUBLE_WIDE_MODEf, 33699 SLICE11_DOUBLE_WIDE_MODEf, 33700 SLICE12_DOUBLE_WIDE_MODEf, 33701 SLICE13_DOUBLE_WIDE_MODEf, 33702 SLICE14_DOUBLE_WIDE_MODEf, 33703 SLICE15_DOUBLE_WIDE_MODEf 33704 }; 33705 static const soc_field_t ifp_en_double_wide_key[] = { 33706 SLICE0_DOUBLE_WIDE_KEY_SELECTf, 33707 SLICE1_DOUBLE_WIDE_KEY_SELECTf, 33708 SLICE2_DOUBLE_WIDE_KEY_SELECTf, 33709 SLICE3_DOUBLE_WIDE_KEY_SELECTf, 33710 SLICE4_DOUBLE_WIDE_KEY_SELECTf, 33711 SLICE5_DOUBLE_WIDE_KEY_SELECTf, 33712 SLICE6_DOUBLE_WIDE_KEY_SELECTf, 33713 SLICE7_DOUBLE_WIDE_KEY_SELECTf, 33714 SLICE8_DOUBLE_WIDE_KEY_SELECTf, 33715 SLICE9_DOUBLE_WIDE_KEY_SELECTf, 33716 SLICE10_DOUBLE_WIDE_KEY_SELECTf, 33717 SLICE11_DOUBLE_WIDE_KEY_SELECTf, 33718 SLICE12_DOUBLE_WIDE_KEY_SELECTf, 33719 SLICE13_DOUBLE_WIDE_KEY_SELECTf, 33720 SLICE14_DOUBLE_WIDE_KEY_SELECTf, 33721 SLICE15_DOUBLE_WIDE_KEY_SELECTf 33722 }; 33723 static const soc_field_t ifp_en_slice_pairing_field[] = { 33724 SLICE1_0_PAIRINGf, 33725 SLICE3_2_PAIRINGf, 33726 SLICE5_4_PAIRINGf, 33727 SLICE7_6_PAIRINGf, 33728 SLICE9_8_PAIRINGf, 33729 SLICE11_10_PAIRINGf, 33730 SLICE13_12_PAIRINGf, 33731 SLICE15_14_PAIRINGf 33732 }; 33733 static const soc_field_t ifp_en_ing_f4_reg[] = { 33734 SLICE_0_F4f, 33735 SLICE_1_F4f, 33736 SLICE_2_F4f, 33737 SLICE_3_F4f, 33738 SLICE_4_F4f, 33739 SLICE_5_F4f, 33740 SLICE_6_F4f, 33741 SLICE_7_F4f, 33742 SLICE_8_F4f, 33743 SLICE_9_F4f, 33744 SLICE_10_F4f, 33745 SLICE_11_F4f, 33746 SLICE_12_F4f, 33747 SLICE_13_F4f, 33748 SLICE_14_F4f, 33749 SLICE_15_F4f 33750 }; 33751 static const soc_field_t ifp_en_ing_f1_reg[] = { 33752 SLICE_0_F1f, 33753 SLICE_1_F1f, 33754 SLICE_2_F1f, 33755 SLICE_3_F1f, 33756 SLICE_4_F1f, 33757 SLICE_5_F1f, 33758 SLICE_6_F1f, 33759 SLICE_7_F1f, 33760 SLICE_8_F1f, 33761 SLICE_9_F1f, 33762 SLICE_10_F1f, 33763 SLICE_11_F1f, 33764 SLICE_12_F1f, 33765 SLICE_13_F1f, 33766 SLICE_14_F1f, 33767 SLICE_15_F1f 33768 }; 33769 33770 int idx, idx1, slice_idx, vslice_idx,index_min, index_max, rv = BCM_E_NONE; 33771 int group_found, mem_sz, parts_count, slice_ent_cnt; 33772 int i, pri_tcam_idx, part_index, slice_number, expanded[16], slice_master_idx[16]; 33773 int prev_prio, multigroup, max, master_slice; 33774 uint16 recovered_ver_part0 = 0; 33775 uint32 *fp_tcam_buf = NULL; /* Buffer to read the FP_TCAM table */ 33776 char *fp_pfs_buf = NULL; /* Buffer to read the FP_PORT_FIELD_SEL table */ 33777 char *fp_policy_buf = NULL; /* Buffer to read the FP_POLICY table */ 33778 char *fp_global_mask_tcam_buf = NULL; /* Buffer to read the FP_GLOBAL_MASK_TCAM table */ 33779 uint32 rval, paired, intraslice; 33780 uint32 temp; 33781 soc_field_t fld; 33782 bcm_port_t port; 33783 fp_port_field_sel_entry_t *pfs_entry; 33784 fp_tcam_entry_t *tcam_entry; 33785 fp_policy_table_entry_t *policy_entry; 33786 fp_global_mask_tcam_entry_t *global_mask_tcam_entry; 33787 _field_hw_qual_info_t hw_sels; 33788 _field_slice_t *fs; 33789 _field_group_t *fg = NULL, *group = NULL; 33790 _field_entry_t *f_ent = NULL; 33791 bcm_pbmp_t entry_pbmp, entry_mask_pbmp, temp_pbmp, valid_pbm; 33792 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 33793 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 33794 bcm_pbmp_t port_cmic_pbmp; 33795 int8 s_field, d_field; 33796 int phys_tcam_idx; 33797 uint8 old_physical_slice, slice_num; 33798 uint32 entry_flags; 33799 _field_slice_t *fs_temp = NULL; 33800 uint16 recovered_count = 0; 33801 _field_table_pointers_t *fp_table_pointers = NULL; 33802 soc_reg_t double_wide_reg = 0; 33803 _field_entry_oam_wb_t *f_ent_oam_wb = NULL; 33804 _field_entry_policer_wb_t *f_ent_policer_wb = NULL; 33805 uint32 fwd_field_sel; 33806 33807 #if defined(BCM_TRIDENT_SUPPORT) \ 33808 || defined(BCM_SCORPION_SUPPORT) \ 33809 || defined(BCM_CONQUEROR_SUPPORT) 33810 bcm_pbmp_t temp_pbm_mask; /* Y-Pipe IPBM MASK value. */ 33811 #endif 33812 #if defined(BCM_SCORPION_SUPPORT) || defined(BCM_CONQUEROR_SUPPORT) 33813 uint32 tcam_dual_pipe_entry[SOC_MAX_MEM_FIELD_WORDS]; /* Y-Pipe FP_TCAM 33814 * entry. */ 33815 #endif 33816 #if defined(BCM_TRIDENT_SUPPORT) 33817 char *fp_gm_tcam_x_buf = NULL; /* Buffer to read 33818 * FP_GLOBAL_MASK_TCAM_Y 33819 * table. */ 33820 fp_global_mask_tcam_x_entry_t *fp_gm_tcam_x_entry; /* Pointer to 33821 * FP_GLOBAL_MASK_TCAM_Y 33822 * entry */ 33823 char *fp_gm_tcam_y_buf = NULL; /* Buffer to read 33824 * FP_GLOBAL_MASK_TCAM_Y 33825 * table. */ 33826 fp_global_mask_tcam_y_entry_t *fp_gm_tcam_y_entry; /* Pointer to 33827 * FP_GLOBAL_MASK_TCAM_Y 33828 * entry */ 33829 #endif 33830 _field_action_bmp_t action_bmp; 33831 _field_entry_wb_info_t f_ent_wb_info; 33832 33833 BCM_PBMP_ASSIGN(port_cmic_pbmp, PBMP_PORT_ALL(unit)); 33834 BCM_PBMP_OR(port_cmic_pbmp, PBMP_CMIC(unit)); 33835 BCM_PBMP_CLEAR(entry_pbmp); 33836 BCM_PBMP_CLEAR(entry_mask_pbmp); 33837 33838 fc->scache_pos = 0; 33839 fc->scache_pos1 = 0; 33840 33841 /* Reset Action bitmap to NULL. */ 33842 action_bmp.w = NULL; 33843 33844 /* Valid PBMP Supported on the Device */ 33845 BCM_PBMP_CLEAR(valid_pbm); 33846 BCM_PBMP_ASSIGN(valid_pbm, PBMP_ALL(unit)); 33847 BCM_PBMP_REMOVE(valid_pbm, PBMP_LB(unit)); 33848 BCM_PBMP_REMOVE(valid_pbm, PBMP_RDB_ALL(unit)); 33849 BCM_PBMP_REMOVE(valid_pbm, PBMP_MACSEC_ALL(unit)); 33850 #ifdef BCM_KATANA2_SUPPORT 33851 if (soc_feature(unit, soc_feature_linkphy_coe) || 33852 soc_feature(unit, soc_feature_subtag_coe)) { 33853 _bcm_kt2_subport_pbmp_update(unit, &valid_pbm); 33854 } 33855 if (SOC_IS_KATANA2(unit) && soc_feature(unit, soc_feature_flex_port)) { 33856 #if defined(BCM_SABER2_SUPPORT) 33857 if((SOC_IS_SABER2(unit)) && 33858 (fc->wb_recovered_version < BCM_FIELD_WB_VERSION_1_19) && 33859 (bcm_sb2_wb_v2_flexio_update == 0)) { 33860 rv = _bcm_sb2_wb_v1_flexio_pbmp_update(unit, &valid_pbm); 33861 } else 33862 #endif 33863 { 33864 rv = (_bcm_kt2_flexio_pbmp_update(unit, &valid_pbm)); 33865 } 33866 if (BCM_FAILURE(rv)) { 33867 goto cleanup; 33868 } 33869 } 33870 #endif /* BCM_KATANA2_SUPPORT */ 33871 33872 if (fc->l2warm) { 33873 recovered_ver_part0 = (fc->wb_recovered_version); 33874 33875 if ((fc->wb_recovered_version) > (fc->wb_current_version)) { 33876 /* Notify the application with an event */ 33877 /* The application will then need to reconcile the 33878 version differences using the documented behavioral 33879 differences on per module (handle) basis */ 33880 SOC_IF_ERROR_RETURN 33881 (soc_event_generate(unit, SOC_SWITCH_EVENT_WARM_BOOT_DOWNGRADE, 33882 BCM_MODULE_FIELD, (fc->wb_recovered_version), 33883 (fc->wb_current_version))); 33884 } 33885 33886 fc->scache_pos += SOC_WB_SCACHE_CONTROL_SIZE; 33887 33888 if(NULL != fc->scache_ptr[_FIELD_SCACHE_PART_1]) { 33889 if ((fc->wb_recovered_version) > (fc->wb_current_version)) { 33890 /* Notify the application with an event */ 33891 /* The application will then need to reconcile the 33892 version differences using the documented behavioral 33893 differences on per module (handle) basis */ 33894 SOC_IF_ERROR_RETURN 33895 (soc_event_generate(unit, 33896 SOC_SWITCH_EVENT_WARM_BOOT_DOWNGRADE, 33897 BCM_MODULE_FIELD, (fc->wb_recovered_version), 33898 (fc->wb_current_version))); 33899 } 33900 33901 fc->scache_pos1 += SOC_WB_SCACHE_CONTROL_SIZE; 33902 } 33903 } 33904 33905 SOC_PBMP_CLEAR(entry_pbmp); 33906 sal_memset(expanded, 0, 16 * sizeof(int)); 33907 sal_memset(slice_master_idx, 0, 16 * sizeof(int)); 33908 33909 if (fc->l2warm) { 33910 rv = _field_scache_stage_hdr_chk(fc, _FIELD_IFP_DATA_START); 33911 if (BCM_FAILURE(rv)) { 33912 return (rv); 33913 } 33914 } 33915 33916 fp_table_pointers = soc_cm_salloc(unit, sizeof(_field_table_pointers_t), 33917 "FP Table buffer Pointers"); 33918 33919 if (NULL == fp_table_pointers) { 33920 return BCM_E_MEMORY; 33921 } 33922 rv = _field_table_pointers_init(unit, fp_table_pointers); 33923 BCM_IF_ERROR_RETURN(rv); 33924 33925 /* DMA various tables */ 33926 33927 fp_tcam_buf = soc_cm_salloc(unit, sizeof(fp_tcam_entry_t) * 33928 soc_mem_index_count(unit, FP_TCAMm), 33929 "FP TCAM buffer"); 33930 if (NULL == fp_tcam_buf) { 33931 return BCM_E_MEMORY; 33932 } 33933 sal_memset(fp_tcam_buf, 0, sizeof(fp_tcam_entry_t) * 33934 soc_mem_index_count(unit, FP_TCAMm)); 33935 index_min = soc_mem_index_min(unit, FP_TCAMm); 33936 index_max = soc_mem_index_max(unit, FP_TCAMm); 33937 fs = stage_fc->slices[_FP_DEF_INST]; 33938 if (stage_fc->flags & _FP_STAGE_HALF_SLICE) { 33939 slice_ent_cnt = fs->entry_count * 2; 33940 /* DMA in chunks */ 33941 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 33942 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 33943 33944 if (soc_feature(unit, 33945 soc_feature_field_half_slice_single_tcam)) { 33946 if ((rv = soc_mem_read_range(unit, FP_TCAMm, MEM_BLOCK_ALL, 33947 slice_idx * slice_ent_cnt, 33948 slice_idx * slice_ent_cnt + 33949 fs->entry_count - 1, 33950 fp_tcam_buf + slice_idx * 33951 slice_ent_cnt * 33952 soc_mem_entry_words(unit, FP_TCAMm))) < 0 ) { 33953 goto cleanup; 33954 } 33955 } else { 33956 if ((rv = soc_mem_read_range(unit, FP_TCAMm, MEM_BLOCK_ALL, 33957 slice_idx * slice_ent_cnt, 33958 slice_idx * slice_ent_cnt + 33959 fs->entry_count / 2 - 1, 33960 fp_tcam_buf + slice_idx * 33961 slice_ent_cnt * 33962 soc_mem_entry_words(unit, FP_TCAMm))) < 0 ) { 33963 goto cleanup; 33964 } 33965 if ((rv = soc_mem_read_range(unit, FP_TCAMm, MEM_BLOCK_ALL, 33966 slice_idx * slice_ent_cnt + 33967 fs->entry_count, 33968 slice_idx * slice_ent_cnt + 33969 fs->entry_count + 33970 fs->entry_count / 2 - 1, 33971 fp_tcam_buf + (slice_idx * 33972 slice_ent_cnt + fs->entry_count) * 33973 soc_mem_entry_words(unit, FP_TCAMm))) < 0 ) { 33974 goto cleanup; 33975 } 33976 } 33977 } 33978 } else { 33979 slice_ent_cnt = fs->entry_count; 33980 if ((rv = soc_mem_read_range(unit, FP_TCAMm, MEM_BLOCK_ALL, 33981 index_min, index_max, fp_tcam_buf)) < 0 ) { 33982 goto cleanup; 33983 } 33984 } 33985 33986 fp_pfs_buf = soc_cm_salloc(unit, SOC_MEM_TABLE_BYTES(unit, 33987 FP_PORT_FIELD_SELm), 33988 "FP PORT_FIELD_SEL buffer"); 33989 if (NULL == fp_pfs_buf) { 33990 rv = BCM_E_MEMORY; 33991 goto cleanup; 33992 } 33993 index_min = soc_mem_index_min(unit, FP_PORT_FIELD_SELm); 33994 index_max = soc_mem_index_max(unit, FP_PORT_FIELD_SELm); 33995 if ((rv = soc_mem_read_range(unit, FP_PORT_FIELD_SELm, MEM_BLOCK_ALL, 33996 index_min, index_max, fp_pfs_buf)) < 0 ) { 33997 goto cleanup; 33998 } 33999 34000 fp_policy_buf = soc_cm_salloc(unit, SOC_MEM_TABLE_BYTES 34001 (unit, FP_POLICY_TABLEm), 34002 "FP POLICY TABLE buffer"); 34003 if (NULL == fp_policy_buf) { 34004 rv = BCM_E_MEMORY; 34005 goto cleanup; 34006 } 34007 index_min = soc_mem_index_min(unit, FP_POLICY_TABLEm); 34008 index_max = soc_mem_index_max(unit, FP_POLICY_TABLEm); 34009 if ((rv = soc_mem_read_range(unit, FP_POLICY_TABLEm, MEM_BLOCK_ALL, 34010 index_min, index_max, fp_policy_buf)) < 0 ) { 34011 goto cleanup; 34012 } 34013 34014 if (soc_mem_is_valid(unit, FP_GLOBAL_MASK_TCAMm)) { 34015 #if defined(BCM_TRIDENT_SUPPORT) 34016 /* Allocate buffer to DMA X/Y-Pipe GM TCAM table entries. */ 34017 if (SOC_IS_TD_TT(unit) && 34018 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Xm) && 34019 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Ym)) { 34020 fp_gm_tcam_x_buf = soc_cm_salloc(unit, 34021 SOC_MEM_TABLE_BYTES 34022 (unit, 34023 FP_GLOBAL_MASK_TCAM_Xm), 34024 "FP_GLOBAL_MASK_TCAM X-buffer" 34025 ); 34026 if (fp_gm_tcam_x_buf == NULL) { 34027 rv = BCM_E_MEMORY; 34028 goto cleanup; 34029 } 34030 34031 index_min = soc_mem_index_min(unit, FP_GLOBAL_MASK_TCAM_Xm); 34032 index_max = soc_mem_index_max(unit, FP_GLOBAL_MASK_TCAM_Xm); 34033 if ((rv = soc_mem_read_range(unit, 34034 FP_GLOBAL_MASK_TCAM_Xm, 34035 MEM_BLOCK_ALL, 34036 index_min, 34037 index_max, 34038 fp_gm_tcam_x_buf 34039 )) < 0) { 34040 goto cleanup; 34041 } 34042 34043 fp_gm_tcam_y_buf = soc_cm_salloc(unit, 34044 SOC_MEM_TABLE_BYTES 34045 (unit, 34046 FP_GLOBAL_MASK_TCAM_Ym), 34047 "FP_GLOBAL_MASK_TCAM Y-buffer" 34048 ); 34049 if (fp_gm_tcam_y_buf == NULL) { 34050 rv = BCM_E_MEMORY; 34051 goto cleanup; 34052 } 34053 34054 index_min = soc_mem_index_min(unit, FP_GLOBAL_MASK_TCAM_Ym); 34055 index_max = soc_mem_index_max(unit, FP_GLOBAL_MASK_TCAM_Ym); 34056 if ((rv = soc_mem_read_range(unit, 34057 FP_GLOBAL_MASK_TCAM_Ym, 34058 MEM_BLOCK_ALL, 34059 index_min, 34060 index_max, 34061 fp_gm_tcam_y_buf 34062 )) < 0) { 34063 goto cleanup; 34064 } 34065 } else 34066 #endif 34067 { 34068 fp_global_mask_tcam_buf = soc_cm_salloc(unit, 34069 SOC_MEM_TABLE_BYTES( 34070 unit, 34071 FP_GLOBAL_MASK_TCAMm), 34072 "FP_GLOBAL_MASK_TCAM buffer"); 34073 if (fp_global_mask_tcam_buf == NULL) { 34074 rv = BCM_E_MEMORY; 34075 goto cleanup; 34076 } 34077 index_min = soc_mem_index_min(unit, FP_GLOBAL_MASK_TCAMm); 34078 index_max = soc_mem_index_max(unit, FP_GLOBAL_MASK_TCAMm); 34079 if ((rv = soc_mem_read_range(unit, 34080 FP_GLOBAL_MASK_TCAMm, 34081 MEM_BLOCK_ALL, 34082 index_min, 34083 index_max, 34084 fp_global_mask_tcam_buf)) < 0) { 34085 goto cleanup; 34086 } 34087 } 34088 } else { 34089 /* No global mask TCAM 34090 => Entries apply to all ports 34091 */ 34092 34093 BCM_PBMP_ASSIGN(entry_pbmp, PBMP_ALL(unit)); 34094 BCM_PBMP_ASSIGN(entry_mask_pbmp, PBMP_ALL(unit)); 34095 #if defined(BCM_KATANA2_SUPPORT) 34096 if (soc_feature(unit, soc_feature_linkphy_coe) || 34097 soc_feature(unit, soc_feature_subtag_coe)) { 34098 _bcm_kt2_subport_pbmp_update(unit, &entry_pbmp); 34099 _bcm_kt2_subport_pbmp_update(unit, &entry_mask_pbmp); 34100 } 34101 #endif 34102 34103 } 34104 34105 #if defined(BCM_TRIDENT_SUPPORT) 34106 fp_table_pointers->fp_gm_tcam_x_buf = fp_gm_tcam_x_buf; 34107 fp_table_pointers->fp_gm_tcam_y_buf = fp_gm_tcam_y_buf; 34108 #endif 34109 fp_table_pointers->fp_global_mask_tcam_buf = fp_global_mask_tcam_buf; 34110 34111 /* Recover range checkers */ 34112 rv = _field_range_check_reinit(unit, stage_fc, fc); 34113 if (BCM_FAILURE(rv)) { 34114 goto cleanup; 34115 } 34116 34117 if (fc->l2warm) { 34118 if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) { 34119 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_7) { 34120 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 34121 LOG_DEBUG(BSL_LS_BCM_FP, 34122 (BSL_META_U(unit,"Recovering hints from " 34123 "pos = %d\r\n"), fc->scache_pos)); 34124 BCM_IF_ERROR_RETURN (_bcm_field_hints_scache_recover (unit, 34125 fc, stage_fc, &buf[fc->scache_pos])); 34126 } 34127 } 34128 } 34129 } 34130 34131 if (fc->l2warm) { 34132 if (!(SOC_IS_ENDURO(unit) || SOC_IS_HURRICANE(unit) 34133 || SOC_IS_HURRICANE2(unit) || SOC_IS_GREYHOUND(unit))) { 34134 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_5) { 34135 /* Read field qualifier count */ 34136 recovered_count |= (buf[fc->scache_pos] << 8); 34137 fc->scache_pos++; 34138 recovered_count |= buf[fc->scache_pos]; 34139 fc->scache_pos++; 34140 } 34141 } 34142 } 34143 34144 /* Recover data qualifiers */ 34145 rv = _field_data_qual_recover(unit, fc, stage_fc); 34146 if (BCM_FAILURE(rv)) { 34147 goto cleanup; 34148 } 34149 34150 /* Get slice expansion status and virtual map */ 34151 if ((rv = _field_tr2_ifp_slice_expanded_status_get(unit, 34152 fc, 34153 stage_fc, 34154 expanded, 34155 slice_master_idx 34156 ) 34157 ) < 0 34158 ) { 34159 goto cleanup; 34160 } 34161 34162 /* Iterate over the slices */ 34163 if ((rv = READ_FP_SLICE_ENABLEr(unit, &rval)) < 0) { 34164 goto cleanup; 34165 } 34166 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 34167 /* Ignore disabled slice */ 34168 if ((soc_reg_field_get(unit, 34169 FP_SLICE_ENABLEr, 34170 rval, 34171 ifp_en_flds[slice_idx] 34172 ) 34173 == 0 34174 ) || soc_reg_field_get(unit, 34175 FP_SLICE_ENABLEr, 34176 rval, 34177 ifp_lk_en_flds[slice_idx] 34178 ) 34179 == 0 34180 ) { 34181 continue; 34182 } 34183 /* Ignore secondary slice in paired mode */ 34184 pfs_entry = soc_mem_table_idx_to_pointer(unit, FP_PORT_FIELD_SELm, 34185 fp_port_field_sel_entry_t *, 34186 fp_pfs_buf, 0); 34187 fld = ifp_en_slice_pairing_field[slice_idx / 2]; 34188 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit, 34189 pfs_entry, fld); 34190 34191 intraslice = 34192 soc_mem_field32_get_def(unit, 34193 FP_PORT_FIELD_SELm, 34194 pfs_entry, 34195 ifp_en_slice_wide_mode_field[slice_idx], 34196 FALSE 34197 ); 34198 34199 if (paired && (slice_idx % 2)) { 34200 continue; 34201 } 34202 34203 /* Don't need to read selectors for expanded slice */ 34204 if (expanded[slice_idx]) { 34205 continue; 34206 } 34207 34208 /* Skip if slice has no valid groups and entries */ 34209 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 34210 slice_ent_cnt = fs->entry_count; 34211 for (idx = 0; idx < slice_ent_cnt; idx++) { 34212 if (_bcm_field_slice_offset_to_tcam_idx(unit, 34213 stage_fc, 34214 _FP_DEF_INST, 34215 slice_idx, 34216 idx, 34217 &phys_tcam_idx 34218 ) 34219 != BCM_E_NONE 34220 ) { 34221 rv = BCM_E_INTERNAL; 34222 goto cleanup; 34223 } 34224 tcam_entry = soc_mem_table_idx_to_pointer(unit, FP_TCAMm, 34225 fp_tcam_entry_t *, 34226 fp_tcam_buf, 34227 phys_tcam_idx 34228 ); 34229 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) != 0) { 34230 break; 34231 } 34232 } 34233 if ((idx == slice_ent_cnt) && !fc->l2warm) { 34234 continue; 34235 } 34236 34237 /* If Level 2, retrieve the GIDs in this slice */ 34238 if (fc->l2warm) { 34239 rv = _field_trx_scache_slice_group_recover(unit, 34240 fc, _FP_DEF_INST, 34241 slice_idx, 34242 &multigroup, 34243 stage_fc, 34244 recovered_count 34245 ); 34246 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 34247 fc->l2warm = 0; 34248 goto cleanup; 34249 } 34250 if (rv == BCM_E_NOT_FOUND) { 34251 rv = BCM_E_NONE; 34252 continue; 34253 } 34254 } 34255 34256 /* Iterate over FP_PORT_FIELD_SEL for all ports and this slice 34257 * to identify bins for selectors (also groups for level 1) */ 34258 BCM_PBMP_ITER(valid_pbm, port) { 34259 if (IS_LB_PORT(unit, port)) { 34260 continue; 34261 } 34262 34263 _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[0]); 34264 hw_sels.pri_slice[0].intraslice 34265 = hw_sels.pri_slice[0].secondary = _FP_SELCODE_DONT_USE; 34266 _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[1]); 34267 hw_sels.pri_slice[1].intraslice 34268 = hw_sels.pri_slice[1].secondary = _FP_SELCODE_DONT_USE; 34269 _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[0]); 34270 hw_sels.sec_slice[0].intraslice 34271 = hw_sels.sec_slice[0].secondary = _FP_SELCODE_DONT_USE; 34272 _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[1]); 34273 hw_sels.sec_slice[1].intraslice 34274 = hw_sels.sec_slice[1].secondary = _FP_SELCODE_DONT_USE; 34275 34276 pfs_entry = soc_mem_table_idx_to_pointer 34277 (unit, FP_PORT_FIELD_SELm, 34278 fp_port_field_sel_entry_t *, fp_pfs_buf, port); 34279 /* Get primary slice's selectors */ 34280 hw_sels.pri_slice[0].fpf1 = soc_FP_PORT_FIELD_SELm_field32_get( 34281 unit, 34282 pfs_entry, 34283 ifp_en_field_tbl[slice_idx][0] 34284 ); 34285 hw_sels.pri_slice[0].fpf2 = soc_FP_PORT_FIELD_SELm_field32_get( 34286 unit, 34287 pfs_entry, 34288 ifp_en_field_tbl[slice_idx][1] 34289 ); 34290 hw_sels.pri_slice[0].fpf3 = soc_FP_PORT_FIELD_SELm_field32_get( 34291 unit, 34292 pfs_entry, 34293 ifp_en_field_tbl[slice_idx][2] 34294 ); 34295 /* Retrieve Tunnel Type information */ 34296 if (SOC_IS_TRIUMPH2(unit) 34297 || SOC_IS_APOLLO(unit) 34298 || SOC_IS_VALKYRIE2(unit) 34299 || SOC_IS_ENDURO(unit) 34300 || SOC_IS_KATANA(unit)) { 34301 rv = _field_tr2_loopback_type_sel_recover 34302 (unit, 34303 slice_idx, 34304 fp_tcam_buf, 34305 stage_fc, 34306 intraslice, 34307 &(hw_sels.pri_slice[0].loopback_type_sel) 34308 ); 34309 if (BCM_FAILURE(rv)) { 34310 goto cleanup; 34311 } 34312 #if defined(BCM_KATANA2_SUPPORT) 34313 } else if (SOC_IS_KATANA2(unit)) { 34314 rv = _bcm_field_kt2_loopback_type_sel_recover 34315 (unit, 34316 slice_idx, 34317 fp_global_mask_tcam_buf, 34318 stage_fc, 34319 intraslice, 34320 &(hw_sels.pri_slice[0].loopback_type_sel) 34321 ); 34322 if (BCM_FAILURE(rv)) { 34323 goto cleanup; 34324 } 34325 #endif 34326 } 34327 34328 if (SOC_REG_FIELD_VALID(unit, FP_FORCE_FORWARDING_FIELDr, 34329 _bcm_trx2_vrf_force_forwarding_enable_field[slice_idx])) { 34330 READ_FP_FORCE_FORWARDING_FIELDr(unit, &fwd_field_sel); 34331 34332 if(soc_reg_field_get(unit, 34333 FP_FORCE_FORWARDING_FIELDr, 34334 fwd_field_sel, 34335 _bcm_trx2_vrf_force_forwarding_enable_field[slice_idx] 34336 )) { 34337 hw_sels.pri_slice[0].fwd_field_sel = 1; 34338 } 34339 } 34340 34341 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 34342 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 34343 _bcm_ifp_normalize_fldtbl[slice_idx][0])) { 34344 hw_sels.pri_slice[0].normalize_ip_sel = 0; 34345 if(soc_FP_PORT_FIELD_SELm_field32_get( 34346 unit, 34347 pfs_entry, 34348 _bcm_ifp_normalize_fldtbl[slice_idx][0] 34349 )) { 34350 hw_sels.pri_slice[0].normalize_ip_sel = 1; 34351 } 34352 } 34353 34354 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 34355 _bcm_ifp_normalize_fldtbl[slice_idx][1])) { 34356 hw_sels.pri_slice[0].normalize_mac_sel = 0; 34357 if(soc_FP_PORT_FIELD_SELm_field32_get( 34358 unit, 34359 pfs_entry, 34360 _bcm_ifp_normalize_fldtbl[slice_idx][1] 34361 )) { 34362 hw_sels.pri_slice[0].normalize_mac_sel = 1; 34363 } 34364 } 34365 #endif 34366 34367 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, SLICE0_S_TYPE_SELf)) { 34368 s_field = soc_FP_PORT_FIELD_SELm_field32_get( 34369 unit, 34370 pfs_entry, 34371 ifp_en_sd_type_field_tbl[slice_idx][0] 34372 ); 34373 d_field = soc_FP_PORT_FIELD_SELm_field32_get( 34374 unit, 34375 pfs_entry, 34376 ifp_en_sd_type_field_tbl[slice_idx][1] 34377 ); 34378 /* Check for L3_IIF or SVP */ 34379 _field_tr2_ingress_entity_get(unit, slice_idx, fp_tcam_buf, 34380 slice_ent_cnt, stage_fc, 34381 &(hw_sels.pri_slice[0].ingress_entity_sel)); 34382 } else { 34383 /* Device (Triumph, for one) does not support source and destination qualification 34384 => Use a default value 34385 */ 34386 34387 s_field = d_field = -1; 34388 } 34389 34390 switch (s_field) { 34391 case 1: 34392 hw_sels.pri_slice[0].src_entity_sel = _bcmFieldFwdEntityGlp; 34393 break; 34394 case 2: 34395 hw_sels.pri_slice[0].src_entity_sel = 34396 _bcmFieldFwdEntityModPortGport; 34397 break; 34398 case 3: 34399 /* Need to adjust later based on actual VP */ 34400 hw_sels.pri_slice[0].src_entity_sel = 34401 _bcmFieldFwdEntityMimGport; 34402 break; 34403 default: 34404 hw_sels.pri_slice[0].src_entity_sel = _bcmFieldFwdEntityAny; 34405 break; 34406 } 34407 34408 switch (d_field) { 34409 case 0: 34410 hw_sels.pri_slice[0].dst_fwd_entity_sel = 34411 _bcmFieldFwdEntityGlp; 34412 break; 34413 case 1: 34414 hw_sels.pri_slice[0].dst_fwd_entity_sel = 34415 _bcmFieldFwdEntityL3Egress; 34416 break; 34417 case 2: 34418 hw_sels.pri_slice[0].dst_fwd_entity_sel = 34419 _bcmFieldFwdEntityMulticastGroup; 34420 break; 34421 case 3: 34422 /* Need to adjust later based on actual VP */ 34423 hw_sels.pri_slice[0].dst_fwd_entity_sel = 34424 _bcmFieldFwdEntityMimGport; 34425 break; 34426 case 7: 34427 hw_sels.pri_slice[0].dst_fwd_entity_sel = 34428 _bcmFieldFwdEntityMultipath; 34429 break; 34430 default: 34431 hw_sels.pri_slice[0].dst_fwd_entity_sel = _bcmFieldFwdEntityAny; 34432 break; 34433 } 34434 34435 _field_tr2_slice_key_control_entry_recover(unit, 34436 slice_idx, 34437 &hw_sels.pri_slice[0] 34438 ); 34439 34440 /* If intraslice, get double-wide key */ 34441 if (intraslice) { 34442 uint32 dwf4sel, dwf1sel; 34443 34444 hw_sels.pri_slice[1].intraslice = TRUE; 34445 hw_sels.pri_slice[1].fpf2 34446 = soc_mem_field32_get(unit, 34447 FP_PORT_FIELD_SELm, 34448 pfs_entry, 34449 ifp_en_double_wide_key[slice_idx] 34450 ); 34451 34452 if (SOC_IS_KATANA2(unit)) { 34453 double_wide_reg = FP_DOUBLE_WIDE_SELECTr; 34454 soc_reg32_get(unit, double_wide_reg, 34455 REG_PORT_ANY, 0, &dwf1sel); 34456 hw_sels.pri_slice[1].fpf1 34457 = soc_reg_field_get(unit, 34458 double_wide_reg, 34459 dwf1sel, 34460 ifp_en_ing_f1_reg[slice_idx] 34461 ); 34462 } else { 34463 double_wide_reg = FP_DOUBLE_WIDE_F4_SELECTr; 34464 } 34465 soc_reg32_get(unit, double_wide_reg, REG_PORT_ANY, 0, &dwf4sel); 34466 hw_sels.pri_slice[1].fpf4 34467 = soc_reg_field_get(unit, 34468 double_wide_reg, 34469 dwf4sel, 34470 ifp_en_ing_f4_reg[slice_idx] 34471 ); 34472 34473 if (SOC_REG_FIELD_VALID(unit, FP_DOUBLE_WIDE_F1_SELECTr, 34474 ifp_en_ing_f1_reg[slice_idx])) { 34475 soc_reg32_get(unit, FP_DOUBLE_WIDE_F1_SELECTr, 34476 REG_PORT_ANY, 0, &dwf1sel); 34477 hw_sels.pri_slice[1].fpf1 34478 = soc_reg_field_get(unit, 34479 FP_DOUBLE_WIDE_F1_SELECTr, 34480 dwf1sel, 34481 ifp_en_ing_f1_reg[slice_idx] 34482 ); 34483 } 34484 34485 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 34486 SLICE0_S_TYPE_SELf)) { 34487 d_field = soc_mem_field32_get(unit, 34488 FP_PORT_FIELD_SELm, 34489 pfs_entry, 34490 ifp_en_sd_type_field_tbl[slice_idx][1] 34491 ); 34492 switch (d_field) { 34493 case 0: 34494 hw_sels.pri_slice[1].dst_fwd_entity_sel = 34495 _bcmFieldFwdEntityGlp; 34496 break; 34497 case 1: 34498 hw_sels.pri_slice[1].dst_fwd_entity_sel = 34499 _bcmFieldFwdEntityL3Egress; 34500 break; 34501 case 2: 34502 hw_sels.pri_slice[1].dst_fwd_entity_sel = 34503 _bcmFieldFwdEntityMulticastGroup; 34504 break; 34505 case 3: 34506 /* Need to adjust later based on actual VP */ 34507 hw_sels.pri_slice[1].dst_fwd_entity_sel = 34508 _bcmFieldFwdEntityMimGport; 34509 break; 34510 case 7: 34511 hw_sels.pri_slice[1].dst_fwd_entity_sel = 34512 _bcmFieldFwdEntityMultipath; 34513 break; 34514 default: 34515 hw_sels.pri_slice[1].dst_fwd_entity_sel = 34516 _bcmFieldFwdEntityGlp; 34517 break; 34518 } 34519 } 34520 } 34521 /* If paired, get secondary slice's selectors */ 34522 if (paired) { 34523 hw_sels.sec_slice[0].secondary = _FP_SELCODE_DONT_CARE; 34524 34525 hw_sels.sec_slice[0].fpf1 = soc_FP_PORT_FIELD_SELm_field32_get 34526 (unit, pfs_entry, 34527 ifp_en_field_tbl[slice_idx + 1][0]); 34528 hw_sels.sec_slice[0].fpf2 = soc_FP_PORT_FIELD_SELm_field32_get 34529 (unit, pfs_entry, 34530 ifp_en_field_tbl[slice_idx + 1][1]); 34531 hw_sels.sec_slice[0].fpf3 = soc_FP_PORT_FIELD_SELm_field32_get 34532 (unit, pfs_entry, 34533 ifp_en_field_tbl[slice_idx + 1][2]); 34534 34535 if (SOC_REG_FIELD_VALID(unit, FP_FORCE_FORWARDING_FIELDr, 34536 _bcm_trx2_vrf_force_forwarding_enable_field[slice_idx + 1])) { 34537 READ_FP_FORCE_FORWARDING_FIELDr(unit, &fwd_field_sel); 34538 34539 if (soc_reg_field_get(unit, 34540 FP_FORCE_FORWARDING_FIELDr, 34541 fwd_field_sel, 34542 _bcm_trx2_vrf_force_forwarding_enable_field[slice_idx + 1] 34543 )) { 34544 hw_sels.sec_slice[0].fwd_field_sel = 1; 34545 } 34546 } 34547 34548 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 34549 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 34550 _bcm_ifp_normalize_fldtbl[slice_idx + 1][0])) { 34551 hw_sels.sec_slice[0].normalize_ip_sel = 0; 34552 if(soc_FP_PORT_FIELD_SELm_field32_get( 34553 unit, 34554 pfs_entry, 34555 _bcm_ifp_normalize_fldtbl[slice_idx + 1][0] 34556 )) { 34557 hw_sels.sec_slice[0].normalize_ip_sel = 1; 34558 } 34559 } 34560 34561 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 34562 _bcm_ifp_normalize_fldtbl[slice_idx + 1][1])) { 34563 hw_sels.sec_slice[0].normalize_mac_sel = 0; 34564 if(soc_FP_PORT_FIELD_SELm_field32_get( 34565 unit, 34566 pfs_entry, 34567 _bcm_ifp_normalize_fldtbl[slice_idx + 1][1] 34568 )) { 34569 hw_sels.sec_slice[0].normalize_mac_sel = 1; 34570 } 34571 } 34572 #endif 34573 34574 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 34575 SLICE0_S_TYPE_SELf)) { 34576 s_field = soc_FP_PORT_FIELD_SELm_field32_get( 34577 unit, 34578 pfs_entry, 34579 ifp_en_sd_type_field_tbl[slice_idx + 1][0] 34580 ); 34581 d_field = soc_FP_PORT_FIELD_SELm_field32_get( 34582 unit, 34583 pfs_entry, 34584 ifp_en_sd_type_field_tbl[slice_idx + 1][1] 34585 ); 34586 /* Check for L3_IIF or SVP */ 34587 _field_tr2_ingress_entity_get(unit, slice_idx, 34588 fp_tcam_buf, 34589 slice_ent_cnt, stage_fc, 34590 &(hw_sels.sec_slice[0].ingress_entity_sel)); 34591 } 34592 switch (s_field) { 34593 case 1: 34594 hw_sels.sec_slice[0].src_entity_sel = _bcmFieldFwdEntityGlp; 34595 break; 34596 case 2: 34597 hw_sels.sec_slice[0].src_entity_sel = 34598 _bcmFieldFwdEntityModPortGport; 34599 break; 34600 case 3: 34601 /* Need to adjust later based on actual VP */ 34602 hw_sels.sec_slice[0].src_entity_sel = 34603 _bcmFieldFwdEntityMimGport; 34604 break; 34605 default: 34606 hw_sels.sec_slice[0].src_entity_sel = _bcmFieldFwdEntityAny; 34607 break; 34608 } 34609 34610 switch (d_field) { 34611 case 0: 34612 hw_sels.sec_slice[0].dst_fwd_entity_sel = 34613 _bcmFieldFwdEntityGlp; 34614 break; 34615 case 1: 34616 hw_sels.sec_slice[0].dst_fwd_entity_sel = 34617 _bcmFieldFwdEntityL3Egress; 34618 break; 34619 case 2: 34620 hw_sels.pri_slice[0].dst_fwd_entity_sel = 34621 _bcmFieldFwdEntityMulticastGroup; 34622 break; 34623 case 3: 34624 /* Need to adjust later based on actual VP */ 34625 hw_sels.sec_slice[0].dst_fwd_entity_sel = 34626 _bcmFieldFwdEntityMimGport; 34627 break; 34628 case 7: 34629 hw_sels.pri_slice[0].dst_fwd_entity_sel = 34630 _bcmFieldFwdEntityMultipath; 34631 break; 34632 default: 34633 hw_sels.sec_slice[0].dst_fwd_entity_sel = 34634 _bcmFieldFwdEntityAny; 34635 break; 34636 } 34637 34638 _field_tr2_slice_key_control_entry_recover(unit, 34639 slice_idx + 1, 34640 &hw_sels.sec_slice[0] 34641 ); 34642 34643 if (intraslice) { 34644 uint32 dwf4sel; 34645 34646 hw_sels.sec_slice[1].intraslice = TRUE; 34647 hw_sels.sec_slice[1].fpf2 34648 = soc_mem_field32_get(unit, 34649 FP_PORT_FIELD_SELm, 34650 pfs_entry, 34651 ifp_en_double_wide_key[slice_idx + 1] 34652 ); 34653 if (SOC_IS_KATANA2(unit)) { 34654 double_wide_reg = FP_DOUBLE_WIDE_SELECTr; 34655 } else { 34656 double_wide_reg = FP_DOUBLE_WIDE_F4_SELECTr; 34657 } 34658 soc_reg32_get(unit, double_wide_reg, REG_PORT_ANY, 0, &dwf4sel); 34659 hw_sels.sec_slice[1].fpf4 34660 = soc_reg_field_get(unit, 34661 double_wide_reg, 34662 dwf4sel, 34663 ifp_en_ing_f4_reg[slice_idx + 1] 34664 ); 34665 34666 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 34667 SLICE0_S_TYPE_SELf)) { 34668 d_field = soc_mem_field32_get(unit, 34669 FP_PORT_FIELD_SELm, 34670 pfs_entry, 34671 ifp_en_sd_type_field_tbl[slice_idx][1] 34672 ); 34673 switch (d_field) { 34674 case 0: 34675 hw_sels.sec_slice[1].dst_fwd_entity_sel = 34676 _bcmFieldFwdEntityGlp; 34677 break; 34678 case 1: 34679 hw_sels.sec_slice[1].dst_fwd_entity_sel = 34680 _bcmFieldFwdEntityL3Egress; 34681 break; 34682 case 2: 34683 hw_sels.sec_slice[1].dst_fwd_entity_sel = 34684 _bcmFieldFwdEntityMulticastGroup; 34685 break; 34686 case 3: 34687 /* Need to adjust later based on actual VP */ 34688 hw_sels.sec_slice[1].dst_fwd_entity_sel = 34689 _bcmFieldFwdEntityMimGport; 34690 break; 34691 case 7: 34692 hw_sels.pri_slice[1].dst_fwd_entity_sel = 34693 _bcmFieldFwdEntityMultipath; 34694 break; 34695 default: 34696 hw_sels.sec_slice[1].dst_fwd_entity_sel = 34697 _bcmFieldFwdEntityGlp; 34698 break; 34699 } 34700 } 34701 } 34702 } 34703 /* Create a group based on HW qualifiers (or find existing) */ 34704 rv = _field_tr2_group_construct(unit, 34705 _FP_DEF_INST, 34706 &hw_sels, 34707 intraslice, 34708 paired, 34709 fc, 34710 port, 34711 _BCM_FIELD_STAGE_INGRESS, 34712 slice_idx 34713 ); 34714 if (BCM_FAILURE(rv)) { 34715 goto cleanup; 34716 } 34717 } 34718 34719 /* Now go over the entries in this slice */ 34720 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 34721 slice_ent_cnt = fs->entry_count; 34722 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 34723 slice_ent_cnt >>= 1; 34724 fs->free_count >>= 1; 34725 } 34726 prev_prio = -1; 34727 for (idx = 0; idx < slice_ent_cnt; idx++) { 34728 group_found = 0; 34729 34730 if (_bcm_field_slice_offset_to_tcam_idx(unit, 34731 stage_fc, 34732 _FP_DEF_INST, 34733 slice_idx, 34734 idx, 34735 &phys_tcam_idx 34736 ) 34737 != BCM_E_NONE 34738 ) { 34739 rv = BCM_E_INTERNAL; 34740 goto cleanup; 34741 } 34742 tcam_entry = soc_mem_table_idx_to_pointer(unit, FP_TCAMm, 34743 fp_tcam_entry_t *, 34744 fp_tcam_buf, 34745 phys_tcam_idx 34746 ); 34747 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 0) { 34748 continue; 34749 } 34750 34751 /* Check which ports are applicable to this entry */ 34752 34753 if (soc_mem_is_valid(unit, FP_GLOBAL_MASK_TCAMm)) { 34754 #if defined (BCM_TRIDENT_SUPPORT) 34755 if (SOC_IS_TD_TT(unit) && 34756 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Xm) && 34757 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Ym)) { 34758 /* Get X-Pipe IPBM KEY and MASK value. */ 34759 fp_gm_tcam_x_entry = soc_mem_table_idx_to_pointer( 34760 unit, 34761 FP_GLOBAL_MASK_TCAM_Xm, 34762 fp_global_mask_tcam_x_entry_t *, 34763 fp_gm_tcam_x_buf, 34764 phys_tcam_idx); 34765 soc_mem_pbmp_field_get(unit, 34766 FP_GLOBAL_MASK_TCAM_Xm, 34767 fp_gm_tcam_x_entry, 34768 IPBMf, 34769 &entry_pbmp); 34770 soc_mem_pbmp_field_get(unit, 34771 FP_GLOBAL_MASK_TCAM_Xm, 34772 fp_gm_tcam_x_entry, 34773 IPBM_MASKf, 34774 &entry_mask_pbmp); 34775 34776 /* Get Y-Pipe IPBM KEY and MASK value. */ 34777 fp_gm_tcam_y_entry = soc_mem_table_idx_to_pointer( 34778 unit, 34779 FP_GLOBAL_MASK_TCAM_Ym, 34780 fp_global_mask_tcam_y_entry_t *, 34781 fp_gm_tcam_y_buf, 34782 phys_tcam_idx); 34783 soc_mem_pbmp_field_get(unit, 34784 FP_GLOBAL_MASK_TCAM_Ym, 34785 fp_gm_tcam_y_entry, 34786 IPBMf, 34787 &temp_pbmp); 34788 soc_mem_pbmp_field_get(unit, 34789 FP_GLOBAL_MASK_TCAM_Ym, 34790 fp_gm_tcam_y_entry, 34791 IPBM_MASKf, 34792 &temp_pbm_mask); 34793 SOC_PBMP_OR(entry_pbmp, temp_pbmp); 34794 SOC_PBMP_OR(entry_mask_pbmp, temp_pbm_mask); 34795 } else 34796 #endif 34797 { 34798 global_mask_tcam_entry = soc_mem_table_idx_to_pointer( 34799 unit, 34800 FP_GLOBAL_MASK_TCAMm, 34801 fp_global_mask_tcam_entry_t *, 34802 fp_global_mask_tcam_buf, 34803 phys_tcam_idx); 34804 soc_mem_pbmp_field_get(unit, 34805 FP_GLOBAL_MASK_TCAMm, 34806 global_mask_tcam_entry, 34807 IPBMf, 34808 &entry_pbmp); 34809 soc_mem_pbmp_field_get(unit, 34810 FP_GLOBAL_MASK_TCAMm, 34811 global_mask_tcam_entry, 34812 IPBM_MASKf, 34813 &entry_mask_pbmp); 34814 } 34815 } else { 34816 soc_mem_pbmp_field_get(unit, 34817 FP_TCAMm, 34818 tcam_entry, 34819 IPBMf, 34820 &entry_pbmp 34821 ); 34822 soc_mem_pbmp_field_get(unit, 34823 FP_TCAMm, 34824 tcam_entry, 34825 IPBM_MASKf, 34826 &entry_mask_pbmp 34827 ); 34828 #if defined(BCM_SCORPION_SUPPORT) || defined(BCM_CONQUEROR_SUPPORT) 34829 /* 34830 * Scorpion and Conqurer are dual pipe line devices. 34831 * Retrieve IPBMf and IPBM_MASKf field values from Y Pipleline 34832 * FP_TCAM table. 34833 */ 34834 if (SOC_IS_SC_CQ(unit)) { 34835 sal_memset(&tcam_dual_pipe_entry, 0, 34836 sizeof(tcam_dual_pipe_entry)); 34837 rv = soc_mem_read(unit, FP_TCAM_Ym, MEM_BLOCK_ANY, 34838 phys_tcam_idx, tcam_dual_pipe_entry); 34839 if (BCM_FAILURE(rv)) { 34840 goto cleanup; 34841 } 34842 soc_mem_pbmp_field_get(unit, 34843 FP_TCAM_Ym, 34844 tcam_dual_pipe_entry, 34845 IPBMf, 34846 &temp_pbmp 34847 ); 34848 soc_mem_pbmp_field_get(unit, 34849 FP_TCAM_Ym, 34850 tcam_dual_pipe_entry, 34851 IPBM_MASKf, 34852 &temp_pbm_mask 34853 ); 34854 SOC_PBMP_OR(entry_pbmp, temp_pbmp); 34855 SOC_PBMP_OR(entry_mask_pbmp, temp_pbm_mask); 34856 } 34857 #endif 34858 } 34859 34860 /* Search groups to find match */ 34861 fg = fc->groups; 34862 while (fg != NULL) { 34863 /* Check if group is in this slice */ 34864 fs = &fg->slices[0]; 34865 if ((fg->stage_id != stage_fc->stage_id) 34866 || (fs->slice_number != slice_idx)) { 34867 fg = fg->next; 34868 continue; 34869 } 34870 34871 /* Check if entry_pbmp is a subset of group pbmp */ 34872 34873 SOC_PBMP_CLEAR(temp_pbmp); 34874 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp); 34875 SOC_PBMP_OR(temp_pbmp, PBMP_LB(unit)); 34876 SOC_PBMP_AND(temp_pbmp, entry_pbmp); 34877 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) { 34878 group_found = 1; 34879 break; 34880 } 34881 34882 fg = fg->next; 34883 } 34884 if (!group_found) { 34885 return BCM_E_INTERNAL; /* Should never happen */ 34886 } 34887 34888 /* Allocate memory for the entry */ 34889 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 34890 fg->flags, &parts_count); 34891 if (BCM_FAILURE(rv)) { 34892 goto cleanup; 34893 } 34894 mem_sz = parts_count * sizeof (_field_entry_t); 34895 _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry"); 34896 if (f_ent == NULL) { 34897 rv = BCM_E_MEMORY; 34898 goto cleanup; 34899 } 34900 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 34901 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 34902 } 34903 34904 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 34905 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 34906 if (fc->l2warm) { 34907 /* Recover f_ent_oam_wb structure from here */ 34908 /* Allocate f_ent_oam_wb structure and pass it to 34909 * corresponding function */ 34910 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8) { 34911 _FP_XGS3_ALLOC(f_ent_oam_wb, sizeof (_field_entry_oam_wb_t), 34912 "Field Entry Warmboot"); 34913 if (f_ent_oam_wb == NULL) { 34914 sal_free (f_ent); 34915 return BCM_E_MEMORY; 34916 } 34917 } 34918 f_ent_wb_info.f_ent_oam_wb = f_ent_oam_wb; 34919 34920 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 34921 action_bmp.w = NULL; 34922 _FP_XGS3_ALLOC(action_bmp.w, 34923 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 34924 "Action No Param Bitmap"); 34925 if (action_bmp.w == NULL) { 34926 rv = BCM_E_MEMORY; 34927 sal_free(f_ent); 34928 goto cleanup; 34929 } 34930 } 34931 f_ent_wb_info.action_bmp = &action_bmp; 34932 34933 /* Recover f_ent_policer_wb structure from here */ 34934 /* Allocate f_ent_policer_wb structure and pass it to 34935 * corresponding function */ 34936 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_17) { 34937 _FP_XGS3_ALLOC(f_ent_policer_wb, sizeof (_field_entry_policer_wb_t), 34938 "Field Entry Warmboot"); 34939 if (f_ent_policer_wb == NULL) { 34940 rv = BCM_E_MEMORY; 34941 sal_free (f_ent); 34942 goto cleanup; 34943 } 34944 } 34945 f_ent_wb_info.f_ent_policer_wb = f_ent_policer_wb; 34946 34947 rv = _field_trx_entry_info_retrieve(unit, 34948 fc, 34949 stage_fc, 34950 multigroup, 34951 &prev_prio, 34952 &f_ent_wb_info 34953 ); 34954 34955 if (BCM_FAILURE(rv)) { 34956 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 34957 sal_free(f_ent); 34958 goto cleanup; 34959 } 34960 } else { 34961 _bcm_field_last_alloc_eid_incr(unit); 34962 } 34963 pri_tcam_idx = phys_tcam_idx; 34964 34965 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 34966 slice_idx, stage_fc); 34967 if (vslice_idx == -1) { 34968 rv = BCM_E_INTERNAL; 34969 sal_free(f_ent); 34970 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 34971 goto cleanup; 34972 } 34973 34974 for (i = 0; i < parts_count; i++) { 34975 if (fc->l2warm) { 34976 /* Use retrieved EID and priority */ 34977 f_ent[i].eid = f_ent_wb_info.eid; 34978 /* 34979 * In warm boot level 2, during sync, entry priority is 34980 * written only for the first part of the entry and during 34981 * recovery, the priority value from the first part is 34982 * assigned to all parts of entry 34983 */ 34984 f_ent[i].prio = f_ent_wb_info.prio; 34985 34986 /* Set retrieved dvp_type and svp_type */ 34987 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 34988 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 34989 #if defined(BCM_APACHE_SUPPORT) 34990 /* Set retrieved OAM MEP type */ 34991 if (SOC_IS_APACHE(unit) && (i == 0)) { 34992 f_ent[i].eth_oam_ctrl_mep_type = f_ent_wb_info.ingress_oam_mep_type[0]; 34993 f_ent[i].eth_oam_data_mep_type = f_ent_wb_info.ingress_oam_mep_type[1]; 34994 f_ent[i].mpls_oam_ctrl_mep_type = f_ent_wb_info.ingress_oam_mep_type[2]; 34995 f_ent[i].mpls_oam_data_mep_type = f_ent_wb_info.ingress_oam_mep_type[3]; 34996 } 34997 #endif 34998 34999 } else { 35000 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 35001 /* 35002 * For warm boot level 1, priority derived from vslice_idx 35003 * is assigned to all parts of the entry 35004 */ 35005 f_ent[i].prio = (vslice_idx << 10) | (slice_ent_cnt - idx); 35006 } 35007 f_ent[i].group = fg; 35008 if (i == 0) { 35009 BCM_PBMP_ASSIGN(f_ent[i].pbmp.data, entry_pbmp); 35010 BCM_PBMP_ASSIGN(f_ent[i].pbmp.mask, entry_mask_pbmp); 35011 } 35012 35013 rv = _bcm_field_tcam_part_to_entry_flags(unit, i, fg, 35014 &f_ent[i].flags); 35015 if (BCM_FAILURE(rv)) { 35016 sal_free(f_ent); 35017 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35018 goto cleanup; 35019 } 35020 if (f_ent_wb_info.color_independent) { 35021 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 35022 } 35023 rv = _bcm_field_entry_part_tcam_idx_get(unit, f_ent, 35024 pri_tcam_idx, 35025 i, &part_index); 35026 if (BCM_FAILURE(rv)) { 35027 sal_free(f_ent); 35028 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35029 goto cleanup; 35030 } 35031 rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc, 35032 _FP_DEF_INST, 35033 part_index, 35034 &slice_number, 35035 (int *)&f_ent[i].slice_idx); 35036 if (BCM_FAILURE(rv)) { 35037 sal_free(f_ent); 35038 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35039 goto cleanup; 35040 } 35041 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 35042 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp); 35043 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 35044 /* Decrement slice free entry count for primary 35045 entries. */ 35046 f_ent[i].fs->free_count--; 35047 } 35048 /* Assign entry to a slice */ 35049 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 35050 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 35051 35052 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 3) { 35053 f_ent[i].flags |= _FP_ENTRY_ENABLED; 35054 } 35055 35056 if (((!SOC_IS_TRIDENT2X(unit) && !SOC_IS_TITAN2PLUS(unit))) 35057 && (SOC_IS_TD_TT(unit))) { 35058 if (paired && i == 1) { 35059 f_ent[i].flags |= _FP_ENTRY_USES_IPBM_OVERLAY; 35060 } 35061 } else if (SOC_IS_KATANAX(unit) && intraslice && 35062 ((i == 1) || (i == 3))) { 35063 f_ent[i].flags |= _FP_ENTRY_USES_IPBM_OVERLAY; 35064 } 35065 35066 #if defined BCM_TRIDENT2PLUS_SUPPORT 35067 if (soc_feature(unit, soc_feature_fp_based_oam)) { 35068 rv = _field_oam_stat_action_scache_recover 35069 (unit, stage_fc, f_ent, f_ent_oam_wb); 35070 if (BCM_FAILURE(rv)) { 35071 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35072 sal_free(f_ent); 35073 goto cleanup; 35074 } 35075 } 35076 #endif /* BCM_TRIDENT2PLUS_SUPPORT */ 35077 /* Get the actions associated with this part of the entry */ 35078 35079 policy_entry = soc_mem_table_idx_to_pointer( 35080 unit, 35081 FP_POLICY_TABLEm, 35082 fp_policy_table_entry_t *, 35083 fp_policy_buf, 35084 part_index); 35085 35086 rv = _field_tr2_actions_recover(unit, 35087 FP_POLICY_TABLEm, 35088 (uint32 *) policy_entry, 35089 f_ent, 35090 i, 35091 &f_ent_wb_info); 35092 if (BCM_FAILURE(rv)) { 35093 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35094 sal_free(f_ent); 35095 goto cleanup; 35096 } 35097 if (action_bmp.w != NULL) { 35098 _FP_ACTION_BMP_FREE(action_bmp); 35099 action_bmp.w = NULL; 35100 } 35101 } 35102 35103 /* Add to the group */ 35104 rv = _field_group_entry_add(unit, fg, f_ent); 35105 if (BCM_FAILURE(rv)) { 35106 sal_free(f_ent); 35107 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35108 goto cleanup; 35109 } 35110 f_ent = NULL; 35111 35112 /* Entry has been added to group, 35113 * so free f_ent_oam_wb structure */ 35114 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35115 if (f_ent_policer_wb != NULL) { 35116 sal_free(f_ent_policer_wb); 35117 f_ent_policer_wb = NULL; 35118 } 35119 } 35120 35121 /* Free up the temporary slice group info */ 35122 if (fc->l2warm) { 35123 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) { 35124 /* update selcode and construct group qual offset */ 35125 rv = _field_tr2_group_construct_quals_with_sel_update(unit, fc, stage_fc); 35126 if (BCM_FAILURE(rv)) { 35127 goto cleanup; 35128 } 35129 } 35130 _field_scache_slice_group_free(unit, 35131 fc, 35132 slice_idx 35133 ); 35134 } 35135 } 35136 35137 /* Now go over the expanded slices */ 35138 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 35139 if (!expanded[slice_idx]) { 35140 continue; 35141 } 35142 /* Ignore secondary slice in paired mode */ 35143 pfs_entry = soc_mem_table_idx_to_pointer(unit, FP_PORT_FIELD_SELm, 35144 fp_port_field_sel_entry_t *, 35145 fp_pfs_buf, 0); 35146 fld = ifp_en_slice_pairing_field[slice_idx / 2]; 35147 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit, 35148 pfs_entry, fld); 35149 35150 if (paired && (slice_idx % 2)) { 35151 continue; 35152 } 35153 intraslice = 35154 soc_mem_field32_get_def(unit, 35155 FP_PORT_FIELD_SELm, 35156 pfs_entry, 35157 ifp_en_slice_wide_mode_field[slice_idx], 35158 FALSE 35159 ); 35160 /* Skip if slice has no valid entries */ 35161 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 35162 slice_ent_cnt = fs->entry_count; 35163 for (idx = 0; idx < slice_ent_cnt; idx++) { 35164 if (_bcm_field_slice_offset_to_tcam_idx(unit, 35165 stage_fc, 35166 _FP_DEF_INST, 35167 slice_idx, 35168 idx, 35169 &phys_tcam_idx 35170 ) 35171 != BCM_E_NONE 35172 ) { 35173 rv = BCM_E_INTERNAL; 35174 goto cleanup; 35175 } 35176 tcam_entry = soc_mem_table_idx_to_pointer(unit, FP_TCAMm, 35177 fp_tcam_entry_t *, 35178 fp_tcam_buf, 35179 phys_tcam_idx 35180 ); 35181 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) != 0) { 35182 break; 35183 } 35184 } 35185 if (idx == slice_ent_cnt) { 35186 continue; 35187 } 35188 /* If Level 2, retrieve the GIDs in this slice */ 35189 if (fc->l2warm) { 35190 rv = _field_trx_scache_slice_group_recover(unit, 35191 fc, _FP_DEF_INST, 35192 slice_idx, 35193 &multigroup, 35194 stage_fc, 35195 recovered_count 35196 ); 35197 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 35198 fc->l2warm = 0; 35199 goto cleanup; 35200 } 35201 if (rv == BCM_E_NOT_FOUND) { 35202 rv = BCM_E_NONE; 35203 continue; 35204 } 35205 } 35206 /* Now find the master slice for this virtual group */ 35207 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 35208 slice_idx, stage_fc); 35209 if (vslice_idx < 0) { 35210 rv = BCM_E_INTERNAL; 35211 35212 goto cleanup; 35213 } 35214 35215 if (fc->l2warm 35216 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8)) { 35217 master_slice = slice_master_idx[slice_idx]; 35218 } else { 35219 max = -1; 35220 for (i = 0; i < stage_fc->tcam_slices; i++) { 35221 if ((stage_fc->vmap[_FP_DEF_INST][0][vslice_idx].virtual_group == 35222 stage_fc->vmap[_FP_DEF_INST][0][i].virtual_group) && (i != vslice_idx)) { 35223 if (i > max) { 35224 max = i; 35225 } 35226 } 35227 } 35228 if (max < 0) { 35229 rv = BCM_E_INTERNAL; 35230 35231 goto cleanup; 35232 } 35233 35234 master_slice = stage_fc->vmap[_FP_DEF_INST][0][max].vmap_key; 35235 } 35236 /* See which group is in this slice - can be only one */ 35237 fg = fc->groups; 35238 while (fg != NULL) { 35239 /* Check if group is in this slice */ 35240 fs = &fg->slices[0]; 35241 if ((fg->stage_id == stage_fc->stage_id) 35242 && (fs->slice_number == master_slice)) { 35243 break; 35244 } 35245 fg = fg->next; 35246 } 35247 if (fg == NULL) { 35248 rv = BCM_E_INTERNAL; 35249 35250 goto cleanup; 35251 } 35252 35253 /* Get number of entry parts for the group. */ 35254 rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id, 35255 fg->flags, &parts_count); 35256 BCM_IF_ERROR_RETURN(rv); 35257 35258 old_physical_slice = fs->slice_number; 35259 35260 /* Set up the new physical slice parameters in Software */ 35261 for(part_index = parts_count - 1; part_index >= 0; part_index--) { 35262 /* Get entry flags. */ 35263 rv = _bcm_field_tcam_part_to_entry_flags(unit, part_index, fg, &entry_flags); 35264 BCM_IF_ERROR_RETURN(rv); 35265 35266 /* Get slice id for entry part */ 35267 rv = _bcm_field_tcam_part_to_slice_number(unit, part_index, 35268 fg, &slice_num); 35269 BCM_IF_ERROR_RETURN(rv); 35270 35271 /* Get slice pointer. */ 35272 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx 35273 + slice_num; 35274 35275 if (0 == (entry_flags & _FP_ENTRY_SECOND_HALF)) { 35276 /* Set per slice configuration & number of free entries in the slice.*/ 35277 fs->free_count = fs->entry_count; 35278 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 35279 fs->free_count >>= 1; 35280 } 35281 /* Set group flags in in slice.*/ 35282 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 35283 35284 /* Add slice to slices linked list . */ 35285 fs_temp = stage_fc->slices[_FP_DEF_INST] + old_physical_slice + slice_num; 35286 /* To handle more than one auto expanded slice in a group */ 35287 while (fs_temp->next != NULL) { 35288 fs_temp = fs_temp->next; 35289 } 35290 fs_temp->next = fs; 35291 fs->prev = fs_temp; 35292 } 35293 } 35294 35295 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 35296 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 35297 slice_ent_cnt = fs->entry_count; 35298 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 35299 slice_ent_cnt >>= 1; 35300 } 35301 35302 prev_prio = -1; 35303 for (idx = 0; idx < slice_ent_cnt; idx++) { 35304 group_found = 0; 35305 if (_bcm_field_slice_offset_to_tcam_idx(unit, 35306 stage_fc, 35307 _FP_DEF_INST, 35308 slice_idx, 35309 idx, 35310 &phys_tcam_idx 35311 ) 35312 != BCM_E_NONE 35313 ) { 35314 rv = BCM_E_INTERNAL; 35315 goto cleanup; 35316 } 35317 tcam_entry = soc_mem_table_idx_to_pointer(unit, FP_TCAMm, 35318 fp_tcam_entry_t *, 35319 fp_tcam_buf, 35320 phys_tcam_idx 35321 ); 35322 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 0) { 35323 continue; 35324 } 35325 /* Check which ports are applicable to this entry */ 35326 35327 if (soc_mem_is_valid(unit, FP_GLOBAL_MASK_TCAMm)) { 35328 #if defined (BCM_TRIDENT_SUPPORT) 35329 if (SOC_IS_TD_TT(unit) && 35330 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Xm) && 35331 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Ym)) { 35332 /* Get X-Pipe IPBM KEY and MASK value. */ 35333 fp_gm_tcam_x_entry = soc_mem_table_idx_to_pointer( 35334 unit, 35335 FP_GLOBAL_MASK_TCAM_Xm, 35336 fp_global_mask_tcam_x_entry_t *, 35337 fp_gm_tcam_x_buf, 35338 phys_tcam_idx); 35339 soc_mem_pbmp_field_get(unit, 35340 FP_GLOBAL_MASK_TCAM_Xm, 35341 fp_gm_tcam_x_entry, 35342 IPBMf, 35343 &entry_pbmp); 35344 soc_mem_pbmp_field_get(unit, 35345 FP_GLOBAL_MASK_TCAM_Xm, 35346 fp_gm_tcam_x_entry, 35347 IPBM_MASKf, 35348 &entry_mask_pbmp); 35349 35350 /* Get Y-Pipe IPBM KEY and MASK value. */ 35351 fp_gm_tcam_y_entry = soc_mem_table_idx_to_pointer( 35352 unit, 35353 FP_GLOBAL_MASK_TCAM_Ym, 35354 fp_global_mask_tcam_y_entry_t *, 35355 fp_gm_tcam_y_buf, 35356 phys_tcam_idx); 35357 soc_mem_pbmp_field_get(unit, 35358 FP_GLOBAL_MASK_TCAM_Ym, 35359 fp_gm_tcam_y_entry, 35360 IPBMf, 35361 &temp_pbmp); 35362 soc_mem_pbmp_field_get(unit, 35363 FP_GLOBAL_MASK_TCAM_Ym, 35364 fp_gm_tcam_y_entry, 35365 IPBM_MASKf, 35366 &temp_pbm_mask); 35367 SOC_PBMP_OR(entry_pbmp, temp_pbmp); 35368 SOC_PBMP_OR(entry_mask_pbmp, temp_pbm_mask); 35369 } else 35370 #endif 35371 { 35372 global_mask_tcam_entry = soc_mem_table_idx_to_pointer( 35373 unit, 35374 FP_GLOBAL_MASK_TCAMm, 35375 fp_global_mask_tcam_entry_t *, 35376 fp_global_mask_tcam_buf, 35377 phys_tcam_idx); 35378 soc_mem_pbmp_field_get(unit, 35379 FP_GLOBAL_MASK_TCAMm, 35380 global_mask_tcam_entry, 35381 IPBMf, 35382 &entry_pbmp); 35383 soc_mem_pbmp_field_get(unit, 35384 FP_GLOBAL_MASK_TCAMm, 35385 global_mask_tcam_entry, 35386 IPBM_MASKf, 35387 &entry_mask_pbmp); 35388 } 35389 } else { 35390 soc_mem_pbmp_field_get(unit, 35391 FP_TCAMm, 35392 tcam_entry, 35393 IPBMf, 35394 &entry_pbmp 35395 ); 35396 soc_mem_pbmp_field_get(unit, 35397 FP_TCAMm, 35398 tcam_entry, 35399 IPBM_MASKf, 35400 &entry_mask_pbmp 35401 ); 35402 #if defined(BCM_SCORPION_SUPPORT) || defined(BCM_CONQUEROR_SUPPORT) 35403 /* 35404 * Scorpion and Conqurer are dual pipe line devices. 35405 * Retrieve IPBMf and IPBM_MASKf field values from Y Pipleline 35406 * FP_TCAM table. 35407 */ 35408 if (SOC_IS_SC_CQ(unit)) { 35409 sal_memset(&tcam_dual_pipe_entry, 0, 35410 sizeof(tcam_dual_pipe_entry)); 35411 rv = soc_mem_read(unit, FP_TCAM_Ym, MEM_BLOCK_ANY, 35412 phys_tcam_idx, tcam_dual_pipe_entry); 35413 if (BCM_FAILURE(rv)) { 35414 goto cleanup; 35415 } 35416 soc_mem_pbmp_field_get(unit, 35417 FP_TCAM_Ym, 35418 tcam_dual_pipe_entry, 35419 IPBMf, 35420 &temp_pbmp 35421 ); 35422 soc_mem_pbmp_field_get(unit, 35423 FP_TCAM_Ym, 35424 tcam_dual_pipe_entry, 35425 IPBM_MASKf, 35426 &temp_pbm_mask 35427 ); 35428 SOC_PBMP_OR(entry_pbmp, temp_pbmp); 35429 SOC_PBMP_OR(entry_mask_pbmp, temp_pbm_mask); 35430 } 35431 #endif 35432 } 35433 35434 /* Search groups to find match */ 35435 fg = fc->groups; 35436 while (fg != NULL) { 35437 /* Check if group is in this slice */ 35438 fs = &fg->slices[0]; 35439 if ((fg->stage_id != stage_fc->stage_id) 35440 || (fs->slice_number != master_slice)) { 35441 fg = fg->next; 35442 continue; 35443 } 35444 35445 /* Check if entry_pbmp is a subset of group pbmp */ 35446 35447 SOC_PBMP_CLEAR(temp_pbmp); 35448 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp); 35449 SOC_PBMP_OR(temp_pbmp, PBMP_LB(unit)); 35450 SOC_PBMP_AND(temp_pbmp, entry_pbmp); 35451 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) { 35452 group_found = 1; 35453 break; 35454 } 35455 35456 fg = fg->next; 35457 } 35458 if (!group_found) { 35459 return BCM_E_INTERNAL; /* Should never happen */ 35460 } 35461 35462 /* Allocate memory for the entry */ 35463 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 35464 fg->flags, &parts_count); 35465 if (BCM_FAILURE(rv)) { 35466 goto cleanup; 35467 } 35468 mem_sz = parts_count * sizeof (_field_entry_t); 35469 _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry"); 35470 if (f_ent == NULL) { 35471 rv = BCM_E_MEMORY; 35472 goto cleanup; 35473 } 35474 35475 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 35476 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 35477 } 35478 35479 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 35480 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 35481 if (fc->l2warm) { 35482 /* Recover f_ent_oam_wb structure from here */ 35483 /* Allocate f_ent_oam_wb structure and pass it to 35484 * corresponding function */ 35485 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8) { 35486 _FP_XGS3_ALLOC(f_ent_oam_wb, sizeof (_field_entry_oam_wb_t), 35487 "Field Entry Warmboot"); 35488 if (f_ent_oam_wb == NULL) { 35489 sal_free (f_ent); 35490 return BCM_E_MEMORY; 35491 } 35492 } 35493 f_ent_wb_info.f_ent_oam_wb = f_ent_oam_wb; 35494 35495 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 35496 action_bmp.w = NULL; 35497 _FP_XGS3_ALLOC(action_bmp.w, 35498 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 35499 "Action No Param Bitmap"); 35500 if (action_bmp.w == NULL) { 35501 rv = BCM_E_MEMORY; 35502 sal_free(f_ent); 35503 goto cleanup; 35504 } 35505 } 35506 f_ent_wb_info.action_bmp = &action_bmp; 35507 35508 /* Recover f_ent_policer_wb structure from here */ 35509 /* Allocate f_ent_policer_wb structure and pass it to 35510 * corresponding function */ 35511 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_17) { 35512 _FP_XGS3_ALLOC(f_ent_policer_wb, sizeof (_field_entry_policer_wb_t), 35513 "Field Entry Warmboot"); 35514 if (f_ent_policer_wb == NULL) { 35515 rv = BCM_E_MEMORY; 35516 sal_free (f_ent); 35517 goto cleanup; 35518 } 35519 } 35520 f_ent_wb_info.f_ent_policer_wb = f_ent_policer_wb; 35521 35522 rv = _field_trx_entry_info_retrieve(unit, 35523 fc, 35524 stage_fc, 35525 multigroup, 35526 &prev_prio, 35527 &f_ent_wb_info 35528 ); 35529 35530 if (BCM_FAILURE(rv)) { 35531 sal_free(f_ent); 35532 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35533 goto cleanup; 35534 } 35535 } else { 35536 _bcm_field_last_alloc_eid_incr(unit); 35537 } 35538 pri_tcam_idx = phys_tcam_idx; 35539 for (i = 0; i < parts_count; i++) { 35540 if (fc->l2warm) { 35541 /* Use retrieved EID and priority */ 35542 f_ent[i].eid = f_ent_wb_info.eid; 35543 /* 35544 * In warm boot level 2, during sync, entry priority is 35545 * written only for the first part of the entry and during 35546 * recovery, the priority value from the first part is 35547 * assigned to all parts of entry 35548 */ 35549 f_ent[i].prio = f_ent_wb_info.prio; 35550 35551 /* Set retrieved dvp_type and svp_type */ 35552 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 35553 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 35554 #if defined(BCM_APACHE_SUPPORT) 35555 /* Set retrieved OAM MEP type */ 35556 if (SOC_IS_APACHE(unit) && (i == 0)) { 35557 f_ent[i].eth_oam_ctrl_mep_type = f_ent_wb_info.ingress_oam_mep_type[0]; 35558 f_ent[i].eth_oam_data_mep_type = f_ent_wb_info.ingress_oam_mep_type[1]; 35559 f_ent[i].mpls_oam_ctrl_mep_type = f_ent_wb_info.ingress_oam_mep_type[2]; 35560 f_ent[i].mpls_oam_data_mep_type = f_ent_wb_info.ingress_oam_mep_type[3]; 35561 } 35562 #endif 35563 } else { 35564 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 35565 /* 35566 * For warm boot level 1, priority derived from vslice_idx 35567 * is assigned to all parts of the entry 35568 */ 35569 f_ent[i].prio = (vslice_idx << 10) | (slice_ent_cnt - idx); 35570 } 35571 f_ent[i].group = fg; 35572 if (i == 0) { 35573 BCM_PBMP_ASSIGN(f_ent[i].pbmp.data, entry_pbmp); 35574 BCM_PBMP_ASSIGN(f_ent[i].pbmp.mask, entry_mask_pbmp); 35575 } 35576 35577 rv = _bcm_field_tcam_part_to_entry_flags(unit, i, fg, 35578 &f_ent[i].flags); 35579 if (BCM_FAILURE(rv)) { 35580 sal_free(f_ent); 35581 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35582 goto cleanup; 35583 } 35584 if (f_ent_wb_info.color_independent) { 35585 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 35586 } 35587 rv = _bcm_field_entry_part_tcam_idx_get(unit, f_ent, 35588 pri_tcam_idx, 35589 i, &part_index); 35590 if (BCM_FAILURE(rv)) { 35591 sal_free(f_ent); 35592 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35593 goto cleanup; 35594 } 35595 rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc, 35596 _FP_DEF_INST, 35597 part_index, 35598 &slice_number, 35599 (int *)&f_ent[i].slice_idx); 35600 if (BCM_FAILURE(rv)) { 35601 sal_free(f_ent); 35602 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35603 goto cleanup; 35604 } 35605 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 35606 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp); 35607 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 35608 /* Decrement slice free entry count for primary 35609 entries. */ 35610 f_ent[i].fs->free_count--; 35611 } 35612 /* Assign entry to a slice */ 35613 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 35614 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 35615 35616 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 3) { 35617 f_ent[i].flags |= _FP_ENTRY_ENABLED; 35618 } 35619 35620 if (((!SOC_IS_TRIDENT2X(unit) && !SOC_IS_TITAN2PLUS(unit))) 35621 && (SOC_IS_TD_TT(unit))) { 35622 if (paired && i == 1) { 35623 f_ent[i].flags |= _FP_ENTRY_USES_IPBM_OVERLAY; 35624 } 35625 } else if (SOC_IS_KATANAX(unit) && intraslice && 35626 ((i == 1) || (i == 3))) { 35627 f_ent[i].flags |= _FP_ENTRY_USES_IPBM_OVERLAY; 35628 } 35629 35630 /* Get the actions associated with this part of the entry */ 35631 35632 #if defined BCM_TRIDENT2PLUS_SUPPORT 35633 if (soc_feature(unit, soc_feature_fp_based_oam)) { 35634 rv = _field_oam_stat_action_scache_recover 35635 (unit, stage_fc, f_ent, f_ent_oam_wb); 35636 if (BCM_FAILURE(rv)) { 35637 sal_free(f_ent); 35638 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35639 goto cleanup; 35640 } 35641 } 35642 #endif /* BCM_TRIDENT2PLUS_SUPPORT */ 35643 35644 policy_entry = soc_mem_table_idx_to_pointer( 35645 unit, 35646 FP_POLICY_TABLEm, 35647 fp_policy_table_entry_t *, 35648 fp_policy_buf, 35649 part_index 35650 ); 35651 rv = _field_tr2_actions_recover(unit, 35652 FP_POLICY_TABLEm, 35653 (uint32 *) policy_entry, 35654 f_ent, 35655 i, 35656 &f_ent_wb_info); 35657 if (BCM_FAILURE(rv)) { 35658 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35659 sal_free(f_ent); 35660 goto cleanup; 35661 } 35662 if (action_bmp.w != NULL) { 35663 _FP_ACTION_BMP_FREE(action_bmp); 35664 action_bmp.w = NULL; 35665 } 35666 } 35667 /* Add to the group */ 35668 rv = _field_group_entry_add(unit, fg, f_ent); 35669 if (BCM_FAILURE(rv)) { 35670 sal_free(f_ent); 35671 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35672 goto cleanup; 35673 } 35674 f_ent = NULL; 35675 /* Entry has been added to group, 35676 * so free f_ent_oam_wb structure */ 35677 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 35678 if (f_ent_policer_wb != NULL) { 35679 sal_free(f_ent_policer_wb); 35680 f_ent_policer_wb = NULL; 35681 } 35682 } 35683 /* Free up the temporary slice group info */ 35684 if (fc->l2warm) { 35685 _field_scache_slice_group_free(unit, 35686 fc, 35687 slice_idx 35688 ); 35689 } 35690 } 35691 35692 /* Recover EgressPortsAdd Workaround Information */ 35693 if (fc->l2warm) { 35694 35695 /* Mark end of Slice Info */ 35696 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 35697 fc->scache_pos++; 35698 } 35699 35700 if (soc_feature(unit, soc_feature_epc_linkflap_recover)) { 35701 if (recovered_ver_part0 >= BCM_FIELD_WB_VERSION_1_6) { 35702 BCM_IF_ERROR_RETURN (_field_egr_ports_recovery_scache_recover 35703 (unit,fc, stage_fc, &buf[fc->scache_pos])); 35704 } else { 35705 BCM_IF_ERROR_RETURN (_field_egr_ports_recovery_wb_upgrade_add 35706 (unit, fg)); 35707 } 35708 } 35709 } 35710 35711 /* To set per port flags */ 35712 group = fc->groups; 35713 while (group != NULL) { 35714 if (group->stage_id == _BCM_FIELD_STAGE_INGRESS) { 35715 if (!BCM_PBMP_EQ(valid_pbm, group->pbmp)) { 35716 /* Update Group Flags to denote Port based Group */ 35717 group->flags |= _FP_GROUP_PER_PORT_OR_PBMP; 35718 } 35719 } 35720 group = group->next; 35721 } 35722 35723 if (fc->l2warm) { 35724 35725 if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) { 35726 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_7) { 35727 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 35728 LOG_DEBUG(BSL_LS_BCM_FP, 35729 (BSL_META_U(unit,"Recovering hint Ids " 35730 "from pos = %d\r\n"), fc->scache_pos)); 35731 BCM_IF_ERROR_RETURN (_bcm_hints_scache_hintid_recover(unit, stage_fc, 35732 fc, &buf[fc->scache_pos])); 35733 } 35734 } 35735 } 35736 35737 /* Group Slice Selectors */ 35738 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 35739 rv = (_field_group_slice_selectors_recover(unit, 35740 &buf[fc->scache_pos], stage_fc->stage_id)); 35741 if (BCM_FAILURE(rv)) { 35742 goto cleanup; 35743 } 35744 } 35745 35746 temp = 0; 35747 temp |= buf[fc->scache_pos]; 35748 fc->scache_pos++; 35749 temp |= buf[fc->scache_pos] << 8; 35750 fc->scache_pos++; 35751 temp |= buf[fc->scache_pos] << 16; 35752 fc->scache_pos++; 35753 temp |= buf[fc->scache_pos] << 24; 35754 fc->scache_pos++; 35755 if (temp != _FIELD_IFP_DATA_END) { 35756 fc->l2warm = 0; 35757 rv = BCM_E_INTERNAL; 35758 } 35759 35760 if (NULL != buf1) { 35761 temp = 0; 35762 temp |= buf1[fc->scache_pos1]; 35763 fc->scache_pos1++; 35764 temp |= buf1[fc->scache_pos1] << 8; 35765 fc->scache_pos1++; 35766 temp |= buf1[fc->scache_pos1] << 16; 35767 fc->scache_pos1++; 35768 temp |= buf1[fc->scache_pos1] << 24; 35769 fc->scache_pos1++; 35770 if (temp != _FIELD_IFP_DATA_END) { 35771 fc->l2warm = 0; 35772 rv = BCM_E_INTERNAL; 35773 } 35774 } 35775 } 35776 35777 if (BCM_SUCCESS(rv)) { 35778 _field_group_slice_vmap_recovery(unit, fc, stage_fc); 35779 } 35780 35781 _field_tr2_stage_reinit_all_groups_cleanup(unit, fc, 35782 _BCM_FIELD_STAGE_INGRESS, 35783 fp_table_pointers); 35784 35785 cleanup: 35786 #if defined(BCM_TRIDENT_SUPPORT) 35787 if (SOC_IS_TD_TT(unit) && 35788 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Xm) && 35789 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Ym)) { 35790 if (fp_gm_tcam_x_buf) { 35791 soc_cm_sfree(unit, fp_gm_tcam_x_buf); 35792 } 35793 if (fp_gm_tcam_y_buf) { 35794 soc_cm_sfree(unit, fp_gm_tcam_y_buf); 35795 } 35796 } else 35797 #endif 35798 { 35799 if (fp_global_mask_tcam_buf) { 35800 soc_cm_sfree(unit, fp_global_mask_tcam_buf); 35801 } 35802 } 35803 35804 if (fp_tcam_buf) { 35805 soc_cm_sfree(unit, fp_tcam_buf); 35806 } 35807 if (fp_pfs_buf) { 35808 soc_cm_sfree(unit, fp_pfs_buf); 35809 } 35810 if (fp_policy_buf) { 35811 soc_cm_sfree(unit, fp_policy_buf); 35812 } 35813 if (fp_table_pointers) { 35814 soc_cm_sfree(unit, fp_table_pointers); 35815 } 35816 if (action_bmp.w != NULL) { 35817 _FP_ACTION_BMP_FREE(action_bmp); 35818 action_bmp.w = NULL; 35819 } 35820 if(f_ent_policer_wb != NULL) { 35821 sal_free(f_ent_policer_wb); 35822 f_ent_policer_wb = NULL; 35823 } 35824 return rv; 35825 } 35826 35827 /* 35828 * Function: 35829 * _bcm_field_trx_egress_secondary_selcode_set 35830 * 35831 * Purpose: 35832 * Sets the secondary select codes based on field values in different 35833 * registers EFP_CLASSID_SELECTORr, EFP_KEY4_DVP_SELECTORr and 35834 * EFP_KEY4_MDL_SELECTORr. 35835 * 35836 * Parameters: 35837 * unit - (IN) BCM unit number. 35838 * fg - (IN/OUT) Select code information filled into the group 35839 * slice_idx - (IN) Slice id 35840 * part_idx - (IN) Part id of the given slice in the given group 35841 * 35842 * Returns: 35843 * BCM_E_XXX 35844 * Notes: 35845 * This function is required for the devices Helix4, Katana2, Triumph3 , 35846 * Trident2, GreyHound and Enduro. Because these devices have atleast one 35847 * of the three register mentioned below. 35848 * 1. EFP_CLASSID_SELECTORr - (HX4, KT2, TR3, TD2, TH) 35849 * 2. EFP_KEY4_DVP_SELECTORr - (HX4, KT2, TR3, TD2, TH) 35850 * 3. EFP_KEY4_MDL_SELECTORr - (HX4, KT2, TR3, TD2, GreyHound, Enduro, TH) 35851 * 4. EFP_KEY8_DVP_SELECTORr - (TH) 35852 * This function is called in _field_tr2_stage_egress_reinit as all the 35853 * above mentioned devices use _field_tr2_stage_egress_reinit 35854 * for efp reinitialization during warmboot. 35855 */ 35856 int 35857 _bcm_field_trx_egress_secondary_selcodes_set(int unit, _field_group_t *fg, 35858 int slice_idx, uint8 part_idx) 35859 { 35860 soc_field_t field; /* H/W Register field. */ 35861 uint64 reg_val64; /* 64 bit H/W Register value. */ 35862 uint32 reg_val32; /* 32 bit H/W register value. */ 35863 uint32 fldval; /* Field in a H/W register value. */ 35864 uint8 num_fields; /* Number of fields. */ 35865 soc_reg_t reg; /* H/W register. */ 35866 int rv = BCM_E_NONE; /* Operation status. */ 35867 int idx; /* Index. */ 35868 35869 static const soc_field_t efp_classid_selector_flds[][7] = { 35870 {SLICE_0_F1f, SLICE_0_F2f, SLICE_0_F3f, SLICE_0_F4f, 35871 SLICE_0_F6f, SLICE_0_F7f, SLICE_0_F8f}, 35872 {SLICE_1_F1f, SLICE_1_F2f, SLICE_1_F3f, SLICE_1_F4f, 35873 SLICE_1_F6f, SLICE_1_F7f, SLICE_1_F8f}, 35874 {SLICE_2_F1f, SLICE_2_F2f, SLICE_2_F3f, SLICE_2_F4f, 35875 SLICE_2_F6f, SLICE_2_F7f, SLICE_2_F8f}, 35876 {SLICE_3_F1f, SLICE_3_F2f, SLICE_3_F3f, SLICE_3_F4f, 35877 SLICE_3_F6f, SLICE_3_F7f, SLICE_3_F8f}, 35878 }; 35879 35880 static const soc_field_t efp_dvp_selector_flds[][1] = { 35881 {SLICE_0f}, {SLICE_1f}, {SLICE_2f}, {SLICE_3f} 35882 }; 35883 35884 static const soc_field_t efp_mdl_selector_flds[][1] = { 35885 {SLICE_0f}, {SLICE_1f}, {SLICE_2f}, {SLICE_3f} 35886 }; 35887 35888 #if defined(BCM_TRIDENT2PLUS_SUPPORT) 35889 static const soc_field_t oamoverlaytbl[4] = { 35890 SLICE_0_OAM_OVERLAY_ENABLEf,SLICE_1_OAM_OVERLAY_ENABLEf, 35891 SLICE_2_OAM_OVERLAY_ENABLEf, SLICE_3_OAM_OVERLAY_ENABLEf }; 35892 35893 static const soc_field_t efp_dest_port_selector_flds[][2] = { 35894 {SLICE_0_F1_DEST_SELf, SLICE_0_F5_DEST_SELf}, 35895 {SLICE_1_F1_DEST_SELf, SLICE_1_F5_DEST_SELf}, 35896 {SLICE_2_F1_DEST_SELf, SLICE_2_F5_DEST_SELf}, 35897 {SLICE_3_F1_DEST_SELf, SLICE_3_F5_DEST_SELf}, 35898 }; 35899 #endif 35900 35901 35902 if (NULL == fg) { 35903 return BCM_E_PARAM; 35904 } 35905 35906 35907 fg->sel_codes[part_idx].egr_class_f1_sel = _FP_SELCODE_DONT_CARE; 35908 fg->sel_codes[part_idx].egr_class_f2_sel = _FP_SELCODE_DONT_CARE; 35909 fg->sel_codes[part_idx].egr_class_f3_sel = _FP_SELCODE_DONT_CARE; 35910 fg->sel_codes[part_idx].egr_class_f4_sel = _FP_SELCODE_DONT_CARE; 35911 fg->sel_codes[part_idx].egr_class_f6_sel = _FP_SELCODE_DONT_CARE; 35912 fg->sel_codes[part_idx].egr_class_f7_sel = _FP_SELCODE_DONT_CARE; 35913 fg->sel_codes[part_idx].egr_class_f8_sel = _FP_SELCODE_DONT_CARE; 35914 fg->sel_codes[part_idx].egr_key4_dvp_sel = _FP_SELCODE_DONT_CARE; 35915 fg->sel_codes[part_idx].egr_key8_dvp_sel = _FP_SELCODE_DONT_CARE; 35916 fg->sel_codes[part_idx].egr_key4_mdl_sel = _FP_SELCODE_DONT_CARE; 35917 35918 rv = READ_EFP_CLASSID_SELECTORr(unit, ®_val64); 35919 reg = EFP_CLASSID_SELECTORr; 35920 num_fields = sizeof(efp_classid_selector_flds[0]) / 35921 sizeof(efp_classid_selector_flds[0][0]); 35922 35923 if (BCM_SUCCESS(rv)) { 35924 for (idx = 0 ; idx < num_fields; idx++) { 35925 field = efp_classid_selector_flds[slice_idx][idx]; 35926 if (!soc_reg_field_valid(unit, reg, field)) { 35927 continue; 35928 } 35929 fldval = soc_reg64_field_get(unit, reg, reg_val64, field); 35930 35931 switch(idx) { 35932 case 0: 35933 fg->sel_codes[part_idx].egr_class_f1_sel = fldval; 35934 break; 35935 case 1: 35936 fg->sel_codes[part_idx].egr_class_f2_sel = fldval; 35937 break; 35938 case 2: 35939 fg->sel_codes[part_idx].egr_class_f3_sel = fldval; 35940 break; 35941 case 3: 35942 fg->sel_codes[part_idx].egr_class_f4_sel = fldval; 35943 break; 35944 case 4: 35945 fg->sel_codes[part_idx].egr_class_f6_sel = fldval; 35946 break; 35947 case 5: 35948 fg->sel_codes[part_idx].egr_class_f7_sel = fldval; 35949 break; 35950 case 6: 35951 fg->sel_codes[part_idx].egr_class_f8_sel = fldval; 35952 break; 35953 default: 35954 LOG_ERROR(BSL_LS_BCM_FP, 35955 (BSL_META_U(unit, 35956 "FP(unit %d) Error:Invalid field in efp classid selector \n"), 35957 unit)); 35958 return BCM_E_INTERNAL; 35959 } 35960 } 35961 } 35962 35963 rv = READ_EFP_KEY4_DVP_SELECTORr(unit, ®_val32); 35964 reg = EFP_KEY4_DVP_SELECTORr; 35965 num_fields = sizeof(efp_dvp_selector_flds[0]) / 35966 sizeof(efp_dvp_selector_flds[0][0]); 35967 35968 if (BCM_SUCCESS(rv)) { 35969 for (idx = 0 ; idx < num_fields; idx++) { 35970 field = efp_dvp_selector_flds[slice_idx][idx]; 35971 if (!soc_reg_field_valid(unit, reg, field)) { 35972 continue; 35973 } 35974 fldval = soc_reg_field_get(unit, reg, reg_val32, field); 35975 switch (idx) { 35976 case 0: 35977 fg->sel_codes[part_idx].egr_key4_dvp_sel = fldval; 35978 break; 35979 default: 35980 LOG_ERROR(BSL_LS_BCM_FP, 35981 (BSL_META_U(unit, 35982 "FP(unit %d) Error:Invalid field in efp key4 dvp selector \n"), 35983 unit)); 35984 return BCM_E_INTERNAL; 35985 } 35986 } 35987 } 35988 35989 rv = READ_EFP_KEY8_DVP_SELECTORr(unit, ®_val32); 35990 reg = EFP_KEY8_DVP_SELECTORr; 35991 num_fields = sizeof(efp_dvp_selector_flds[0]) / 35992 sizeof(efp_dvp_selector_flds[0][0]); 35993 35994 if (BCM_SUCCESS(rv)) { 35995 for (idx = 0 ; idx < num_fields; idx++) { 35996 field = efp_dvp_selector_flds[slice_idx][idx]; 35997 if (!soc_reg_field_valid(unit, reg, field)) { 35998 continue; 35999 } 36000 fldval = soc_reg_field_get(unit, reg, reg_val32, field); 36001 switch (idx) { 36002 case 0: 36003 fg->sel_codes[part_idx].egr_key8_dvp_sel = fldval; 36004 break; 36005 default: 36006 LOG_ERROR(BSL_LS_BCM_FP, 36007 (BSL_META_U(unit, 36008 "FP(unit %d) Error:Invalid field in efp key8 dvp selector \n"), 36009 unit)); 36010 return BCM_E_INTERNAL; 36011 } 36012 } 36013 } 36014 36015 rv = READ_EFP_KEY4_MDL_SELECTORr(unit, ®_val32); 36016 reg = EFP_KEY4_MDL_SELECTORr; 36017 num_fields = sizeof(efp_mdl_selector_flds[0]) / 36018 sizeof(efp_mdl_selector_flds[0][0]); 36019 36020 if (BCM_SUCCESS(rv)) { 36021 for (idx = 0 ; idx < num_fields; idx++) { 36022 field = efp_mdl_selector_flds[slice_idx][idx]; 36023 if (!soc_reg_field_valid(unit, reg, field)) { 36024 continue; 36025 } 36026 fldval = soc_reg_field_get(unit, reg, reg_val32, field); 36027 36028 switch(idx) { 36029 case 0: 36030 fg->sel_codes[part_idx].egr_key4_mdl_sel = fldval; 36031 break; 36032 default: 36033 LOG_ERROR(BSL_LS_BCM_FP, 36034 (BSL_META_U(unit, 36035 "FP(unit %d) Error:Invalid field in efp mdl selector \n"), 36036 unit)); 36037 return BCM_E_INTERNAL; 36038 } 36039 } 36040 #if defined BCM_TRIDENT2PLUS_SUPPORT 36041 if (soc_feature(unit, soc_feature_fp_based_oam)) { 36042 field = oamoverlaytbl[slice_idx]; 36043 if (soc_reg_field_valid(unit, reg, field)) { 36044 fldval = soc_reg_field_get(unit, reg, reg_val32, field); 36045 fg->sel_codes[part_idx].egr_oam_overlay_sel = fldval; 36046 } 36047 } 36048 #endif 36049 } 36050 36051 #if defined BCM_TRIDENT2PLUS_SUPPORT 36052 if (SOC_REG_IS_VALID(unit, EFP_DEST_PORT_SELECTORr)) { 36053 36054 rv = READ_EFP_DEST_PORT_SELECTORr(unit, ®_val32); 36055 reg = EFP_DEST_PORT_SELECTORr; 36056 num_fields = sizeof(efp_dest_port_selector_flds[0]) / 36057 sizeof(efp_dest_port_selector_flds[0][0]); 36058 36059 if (BCM_SUCCESS(rv)) { 36060 for (idx = 0 ; idx < num_fields; idx++) { 36061 field = efp_dest_port_selector_flds[slice_idx][idx]; 36062 if (!soc_reg_field_valid(unit, reg, field)) { 36063 continue; 36064 } 36065 fldval = soc_reg_field_get(unit, reg, reg_val32, field); 36066 36067 switch(idx) { 36068 case 0: 36069 fg->sel_codes[part_idx].egr_dest_port_f1_sel = fldval; 36070 break; 36071 case 1: 36072 fg->sel_codes[part_idx].egr_dest_port_f5_sel = fldval; 36073 break; 36074 default: 36075 LOG_ERROR(BSL_LS_BCM_FP, 36076 (BSL_META_U(unit, 36077 "FP(unit %d) Error:Invalid field in efp dest port selector \n"), 36078 unit)); 36079 return BCM_E_INTERNAL; 36080 } 36081 } 36082 } 36083 36084 } 36085 #endif 36086 36087 return BCM_E_NONE; 36088 } 36089 36090 /* 36091 * Function: 36092 * _bcm_field_trx_egress_selcode_set 36093 * 36094 * Purpose: 36095 * Sets the select code based on the EFP slice mode and key match type 36096 * 36097 * Parameters: 36098 * unit - (IN) BCM unit number. 36099 * fc - (IN) Device field control structure pointer 36100 * fg - (IN/OUT) Select code information filled into the group 36101 * efp_slice_mode - (IN) EFP slice mode from EFP_SLICE_CONTROl register 36102 * efp_key_mode - (IN) EFP key mode from EFP_SLICE_CONTROl register 36103 * key_match_type - (IN) EFP key match type 36104 * parts_count - (OUT) Number of parts in entry 36105 * 36106 * Returns: 36107 * BCM_E_XXX 36108 */ 36109 int 36110 _bcm_field_trx_egress_selcode_set(int unit, _field_control_t *fc, _field_group_t *fg, 36111 uint32 efp_slice_mode, uint32 efp_key_mode, 36112 uint32 key_match_type, int *parts_count) 36113 { 36114 switch (efp_slice_mode) { 36115 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L2: 36116 fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE; 36117 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY4; 36118 *parts_count = 1; 36119 break; 36120 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3: 36121 fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE; 36122 if (key_match_type == ~0 /* No entries */ 36123 || key_match_type == _BCM_FIELD_EFP_KEY1_MATCH_TYPE 36124 ) { 36125 /* IPv4 single wide key */ 36126 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1; 36127 *parts_count = 1; 36128 fg->sel_codes[0].ip6_addr_sel = _FP_SELCODE_DONT_CARE; 36129 } else { 36130 /* key_match_type == _BCM_FIELD_EFP_KEY2_MATCH_TYPE */ 36131 /* IPv6 single wide key */ 36132 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY2; 36133 *parts_count = 1; 36134 fg->sel_codes[0].ip6_addr_sel = efp_key_mode; 36135 } 36136 break; 36137 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3_ANY: 36138 fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE; 36139 if ((fc->l2warm) && 36140 (BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifySrcIp) || 36141 BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyDstIp) || 36142 BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyIpFrag))) { 36143 if (key_match_type == ~0 /* No entries */ 36144 || key_match_type == _BCM_FIELD_EFP_KEY1_MATCH_TYPE) { 36145 /* IPv4 single wide key */ 36146 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1; 36147 *parts_count = 1; 36148 fg->sel_codes[0].ip6_addr_sel = _FP_SELCODE_DONT_CARE; 36149 } 36150 } else { 36151 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1_NO_V4; 36152 *parts_count = 1; 36153 } 36154 break; 36155 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE: 36156 fg->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE; 36157 if (key_match_type == ~0 /* No entries */ 36158 || key_match_type == _BCM_FIELD_EFP_KEY2_KEY3_MATCH_TYPE 36159 ) { 36160 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY3; 36161 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY2; 36162 fg->sel_codes[1].ip6_addr_sel = efp_key_mode; 36163 } else { /* _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE */ 36164 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1; 36165 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4; 36166 } 36167 *parts_count = 2; 36168 break; 36169 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY: 36170 fg->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE; 36171 if ((fc->l2warm) && 36172 (BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifySrcIp) || 36173 BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyDstIp) || 36174 BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyIpFrag))) { 36175 if (key_match_type == ~0 /* No entries */ 36176 || key_match_type == _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE) { 36177 /* IPv4 double wide key */ 36178 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1; 36179 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4; 36180 } 36181 } else { 36182 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1_NO_V4; 36183 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4; 36184 } 36185 *parts_count = 2; 36186 break; 36187 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6: 36188 fg->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE; 36189 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY2; 36190 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4; 36191 fg->sel_codes[0].ip6_addr_sel = efp_key_mode; 36192 *parts_count = 2; 36193 break; 36194 #if defined(BCM_TSN_SUPPORT) || defined(BCM_TSN_SR_SUPPORT) 36195 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_SR: 36196 if (soc_feature(unit, soc_feature_tsn) || 36197 soc_feature(unit, soc_feature_tsn_sr)) { 36198 fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE; 36199 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY5; 36200 *parts_count = 1; 36201 } 36202 break; 36203 #endif /* BCM_TSN_SUPPORT || BCM_TSN_SR_SUPPORT */ 36204 default: 36205 break; 36206 } 36207 36208 return (BCM_E_NONE); 36209 } 36210 36211 36212 int 36213 _field_tr2_stage_egress_reinit(int unit, _field_control_t *fc, 36214 _field_stage_t *stage_fc) 36215 { 36216 int idx, idx1, slice_idx, vslice_idx, index_min, index_max, rv = BCM_E_NONE; 36217 int mem_sz, slice_ent_cnt, parts_count = 1; 36218 int i, pri_tcam_idx, part_index, slice_number, phys_tcam_idx; 36219 int prev_prio, expanded[4], slice_master_idx[4]; 36220 uint32 *efp_tcam_buf = NULL; /* Buffer to read the EFP_TCAM table */ 36221 char *efp_policy_buf = NULL; /* Buffer to read the EFP_POLICY table */ 36222 uint32 rval, efp_slice_mode, efp_key_mode, temp; 36223 bcm_field_group_t gid; 36224 int priority = 0, multigroup = 0, max, master_slice; 36225 int group_flags = 0; 36226 efp_tcam_entry_t *efp_tcam_entry; 36227 efp_policy_table_entry_t *efp_policy_entry; 36228 _field_slice_t *fs; 36229 _field_group_t *fg; 36230 _field_entry_t *f_ent = NULL; 36231 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 36232 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 36233 bcm_field_qset_t qset; 36234 uint8 old_physical_slice, slice_num; 36235 uint32 entry_flags; 36236 bcm_pbmp_t all_pbmp; 36237 bcm_pbmp_t group_pbmp; 36238 uint32 key_match_type[2]; 36239 #if defined(BCM_TRIDENT2_SUPPORT) 36240 uint32 entry_type = 0; 36241 int8 fpf3 = ~0; 36242 _field_action_t *fa = NULL; 36243 int8 fpf3_temp[2]; 36244 #endif 36245 int action_res_id; 36246 _field_entry_oam_wb_t *f_ent_oam_wb = NULL; 36247 _field_entry_policer_wb_t *f_ent_policer_wb = NULL; 36248 _field_slice_t *fs_temp = NULL; 36249 int8 efp_key_info[2]; 36250 36251 soc_field_t efp_en_flds[4] = {SLICE_ENABLE_SLICE_0f, SLICE_ENABLE_SLICE_1f, 36252 SLICE_ENABLE_SLICE_2f, SLICE_ENABLE_SLICE_3f}; 36253 36254 soc_field_t efp_lk_en_flds[4] = 36255 {LOOKUP_ENABLE_SLICE_0f, LOOKUP_ENABLE_SLICE_1f, 36256 LOOKUP_ENABLE_SLICE_2f, LOOKUP_ENABLE_SLICE_3f}; 36257 _field_action_bmp_t action_bmp; 36258 _field_entry_wb_info_t f_ent_wb_info; 36259 36260 /* Reset Action bitmap to NULL. */ 36261 action_bmp.w = NULL; 36262 36263 sal_memset(expanded, 0, 4 * sizeof(int)); 36264 sal_memset(slice_master_idx, 0, 4 * sizeof(int)); 36265 36266 if (fc->l2warm) { 36267 rv = _field_scache_stage_hdr_chk(fc, _FIELD_EFP_DATA_START); 36268 if (BCM_FAILURE(rv)) { 36269 return (rv); 36270 } 36271 } 36272 36273 /* DMA various tables */ 36274 efp_tcam_buf = soc_cm_salloc(unit, sizeof(efp_tcam_entry_t) * 36275 soc_mem_index_count(unit, EFP_TCAMm), 36276 "EFP TCAM buffer"); 36277 if (NULL == efp_tcam_buf) { 36278 return BCM_E_MEMORY; 36279 } 36280 sal_memset(efp_tcam_buf, 0, sizeof(efp_tcam_entry_t) * 36281 soc_mem_index_count(unit, EFP_TCAMm)); 36282 index_min = soc_mem_index_min(unit, EFP_TCAMm); 36283 index_max = soc_mem_index_max(unit, EFP_TCAMm); 36284 fs = stage_fc->slices[_FP_DEF_INST]; 36285 if (stage_fc->flags & _FP_STAGE_HALF_SLICE) { 36286 slice_ent_cnt = fs->entry_count * 2; 36287 /* DMA in chunks */ 36288 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 36289 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 36290 if ((rv = soc_mem_read_range(unit, EFP_TCAMm, MEM_BLOCK_ALL, 36291 slice_idx * slice_ent_cnt, 36292 slice_idx * slice_ent_cnt + 36293 fs->entry_count - 1, 36294 efp_tcam_buf + slice_idx * 36295 slice_ent_cnt * 36296 soc_mem_entry_words(unit, EFP_TCAMm))) < 0 ) { 36297 goto cleanup; 36298 } 36299 } 36300 } else { 36301 slice_ent_cnt = fs->entry_count; 36302 if ((rv = soc_mem_read_range(unit, EFP_TCAMm, MEM_BLOCK_ALL, 36303 index_min, index_max, 36304 efp_tcam_buf)) < 0 ) { 36305 goto cleanup; 36306 } 36307 } 36308 efp_policy_buf = soc_cm_salloc(unit, SOC_MEM_TABLE_BYTES 36309 (unit, EFP_POLICY_TABLEm), 36310 "EFP POLICY TABLE buffer"); 36311 if (NULL == efp_policy_buf) { 36312 return BCM_E_MEMORY; 36313 } 36314 index_min = soc_mem_index_min(unit, EFP_POLICY_TABLEm); 36315 index_max = soc_mem_index_max(unit, EFP_POLICY_TABLEm); 36316 if ((rv = soc_mem_read_range(unit, EFP_POLICY_TABLEm, MEM_BLOCK_ALL, 36317 index_min, index_max, 36318 efp_policy_buf)) < 0 ) { 36319 goto cleanup; 36320 } 36321 36322 /* Get slice expansion status and virtual map */ 36323 if ((rv = _field_slice_expanded_status_get(unit, fc, stage_fc, expanded, slice_master_idx)) < 0) { 36324 goto cleanup; 36325 } 36326 36327 /* Iterate over the slices */ 36328 if ((rv = READ_EFP_SLICE_CONTROLr(unit, &rval)) < 0) { 36329 goto cleanup; 36330 } 36331 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 36332 /* Ignore disabled slice */ 36333 if ((soc_reg_field_get(unit, EFP_SLICE_CONTROLr, rval, 36334 efp_en_flds[slice_idx]) == 0) || 36335 (soc_reg_field_get(unit, EFP_SLICE_CONTROLr, rval, 36336 efp_lk_en_flds[slice_idx]) == 0)) { 36337 continue; 36338 } 36339 36340 efp_slice_mode = soc_reg_field_get(unit, EFP_SLICE_CONTROLr, rval, 36341 _trx_efp_slice_mode[slice_idx][0]); 36342 efp_key_mode = soc_reg_field_get(unit, EFP_SLICE_CONTROLr, rval, 36343 _trx_efp_slice_mode[slice_idx][1]); 36344 /* Skip if slice has no valid groups and entries */ 36345 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 36346 key_match_type[0] = ~0; 36347 key_match_type[1] = ~0; 36348 #if defined(BCM_TRIDENT2_SUPPORT) 36349 if (SOC_IS_TD2_TT2(unit)) { 36350 /* Get KEY_MATCH_TYPE from the valid entries of EFP_TCAM */ 36351 for (idx = 0; idx < slice_ent_cnt; idx++) { 36352 efp_tcam_entry = soc_mem_table_idx_to_pointer 36353 (unit, EFP_TCAMm, efp_tcam_entry_t *, 36354 efp_tcam_buf, idx + 36355 slice_ent_cnt * slice_idx); 36356 if (soc_EFP_TCAMm_field32_get(unit, efp_tcam_entry, 36357 VALIDf) != 0) { 36358 /* In TD2, EFP_TCAM entry KEY field width is 36359 (230 + 2b VALID) */ 36360 if (key_match_type[0] == ~0) { 36361 _field_extract((uint32 *)efp_tcam_entry, 230 + 2, 4, 36362 &key_match_type[0]); 36363 continue; 36364 } 36365 if (key_match_type[1] == ~0) { 36366 _field_extract((uint32 *)efp_tcam_entry, 230 + 2, 4, 36367 &key_match_type[1]); 36368 if (key_match_type[0] == key_match_type[1]) { 36369 key_match_type[1] = ~0; 36370 } else { 36371 /* break once possible two key match types are 36372 extracted from the valid entries */ 36373 break; 36374 } 36375 } 36376 } 36377 } 36378 if (key_match_type[0] == ~0 && !fc->l2warm) { 36379 continue; 36380 } 36381 } else 36382 #endif 36383 { 36384 for (idx = 0; idx < slice_ent_cnt; idx++) { 36385 efp_tcam_entry = soc_mem_table_idx_to_pointer 36386 (unit, EFP_TCAMm, efp_tcam_entry_t *, 36387 efp_tcam_buf, idx + 36388 slice_ent_cnt * slice_idx); 36389 if (soc_EFP_TCAMm_field32_get(unit, efp_tcam_entry, 36390 VALIDf) != 0) { 36391 /* Get KEY_MATCH_TYPE from first valid entry */ 36392 #if defined(BCM_TRIUMPH3_SUPPORT) 36393 /* In TR3, EFP_TCAM entry KEY field width is 36394 (231 + 2b VALID) */ 36395 if (SOC_IS_TRIUMPH3(unit)) { 36396 _field_extract((uint32 *)efp_tcam_entry, 231 + 2, 3, 36397 &key_match_type[0]); 36398 } else 36399 #endif 36400 #if defined(BCM_GREYHOUND2_SUPPORT) 36401 /* In GH2, EFP_TCAM entry KEY field width is 36402 (214 + 2b VALID) */ 36403 if (SOC_IS_GREYHOUND2(unit)) { 36404 _field_extract((uint32 *)efp_tcam_entry, 214 + 2, 3, 36405 &key_match_type[0]); 36406 } else 36407 #endif 36408 { 36409 _field_extract((uint32 *)efp_tcam_entry, 211 + 2, 3, 36410 &key_match_type[0]); 36411 } 36412 break; 36413 } 36414 } 36415 if (idx == slice_ent_cnt && !fc->l2warm) { 36416 continue; 36417 } 36418 } 36419 /* Skip second part of slice pair */ 36420 if (((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE) || 36421 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY) || 36422 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6)) && 36423 (slice_idx % 2)) { 36424 continue; 36425 } 36426 /* Don't need to read selectors for expanded slice */ 36427 if (expanded[slice_idx]) { 36428 continue; 36429 } 36430 fg = NULL; 36431 if (efp_slice_mode <= 6) { /* Valid values */ 36432 /* If Level 2, retrieve the GIDs in this slice */ 36433 if (fc->l2warm) { 36434 rv = _field_trx_scache_slice_group_recover(unit, 36435 fc, _FP_DEF_INST, 36436 slice_idx, 36437 &multigroup, 36438 stage_fc, 36439 0); 36440 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 36441 fc->l2warm = 0; 36442 goto cleanup; 36443 } 36444 if (rv == BCM_E_NOT_FOUND) { 36445 rv = BCM_E_NONE; 36446 continue; 36447 } 36448 } 36449 36450 rv = _field_tr2_group_construct_alloc(unit, &fg); 36451 if (BCM_FAILURE(rv)) { 36452 goto cleanup; 36453 } 36454 36455 action_res_id = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 36456 36457 group_flags = 0; 36458 if (fc->l2warm) { 36459 /* Get stored group ID and QSET for Level 2 */ 36460 rv = _field_group_info_retrieve(unit, -1, _FP_DEF_INST, 36461 &gid, &priority, 36462 &action_res_id, 36463 &group_pbmp, 36464 efp_key_info, 36465 &group_flags, 36466 &qset, 36467 fc 36468 ); 36469 if (gid != -1) { 36470 sal_memcpy(&fg->qset, &qset, sizeof(bcm_field_qset_t)); 36471 } else { 36472 sal_free(fg); 36473 rv = BCM_E_INTERNAL; 36474 goto cleanup; 36475 } 36476 } else { 36477 if ((rv = _bcm_field_group_id_generate(unit, &gid)) == BCM_E_NONE) { 36478 unsigned vmap, vslice; 36479 36480 for (priority = -1, vmap = 0; priority == -1 && vmap < _FP_VMAP_CNT; ++vmap) { 36481 for (vslice = 0; vslice < COUNTOF(stage_fc->vmap[_FP_DEF_INST][0]); ++vslice) { 36482 if (stage_fc->vmap[_FP_DEF_INST][vmap][vslice].vmap_key == slice_idx) { 36483 priority = stage_fc->vmap[_FP_DEF_INST][vmap][vslice].priority; 36484 36485 break; 36486 } 36487 } 36488 } 36489 36490 if (priority == -1) { 36491 rv = BCM_E_INTERNAL; 36492 } 36493 } 36494 } 36495 if (BCM_FAILURE(rv)) { 36496 sal_free(fg); 36497 goto cleanup; 36498 } 36499 36500 fg->gid = gid; 36501 fg->priority = priority; 36502 fg->action_res_id = action_res_id; 36503 if (group_flags & _FP_GROUP_SELECT_AUTO_EXPANSION) { 36504 fg->flags = fg->flags | _FP_GROUP_SELECT_AUTO_EXPANSION; 36505 } 36506 fg->stage_id = stage_fc->stage_id; 36507 36508 /* Set the selector code based on the EFP slice mode and 36509 key_match_type[0] */ 36510 #if defined(BCM_TRIDENT2_SUPPORT) 36511 if (fc->l2warm && ((((fc->wb_recovered_version) 36512 >= BCM_FIELD_WB_VERSION_1_15) 36513 && SOC_IS_TRIDENT2X(unit)) || 36514 (((fc->wb_recovered_version) 36515 >= BCM_FIELD_WB_VERSION_1_16) && 36516 SOC_IS_TITAN2PLUS(unit)))) { 36517 /* Update efp primary key value */ 36518 fg->sel_codes[0].fpf3 = efp_key_info[0]; 36519 36520 /* Update efp secondary key value based on mode */ 36521 if ((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE) || 36522 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY) || 36523 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6) || 36524 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_FCOE)) { 36525 fg->sel_codes[1].fpf3 = efp_key_info[1]; 36526 parts_count = 2; 36527 fg->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE; 36528 } else { 36529 parts_count = 1; 36530 fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE; 36531 } 36532 if (efp_key_info[0] == _BCM_FIELD_EFP_KEY2) { 36533 fg->sel_codes[0].ip6_addr_sel = efp_key_mode; 36534 } else if (efp_key_info[1] == _BCM_FIELD_EFP_KEY2) { 36535 fg->sel_codes[1].ip6_addr_sel = efp_key_mode; 36536 } 36537 fpf3 = fg->sel_codes[0].fpf3; 36538 } else if (SOC_IS_TD2_TT2(unit)) { 36539 rv = _bcm_field_td2_egress_selcode_set(unit, fg, efp_slice_mode, 36540 efp_key_mode, key_match_type[0], &parts_count); 36541 if (BCM_FAILURE(rv)) { 36542 sal_free(fg); 36543 goto cleanup; 36544 } 36545 36546 fpf3 = fg->sel_codes[0].fpf3; 36547 } else 36548 #endif 36549 { 36550 rv = _bcm_field_trx_egress_selcode_set(unit, fc, fg, 36551 efp_slice_mode, efp_key_mode, 36552 key_match_type[0], &parts_count); 36553 if (BCM_FAILURE(rv)) { 36554 sal_free(fg); 36555 goto cleanup; 36556 } 36557 } 36558 36559 for (part_index = 0; part_index < parts_count; part_index++) { 36560 /* Populate all secondary selectors for the given group */ 36561 rv = _bcm_field_trx_egress_secondary_selcodes_set(unit, fg, 36562 slice_idx + part_index, 36563 part_index); 36564 if (BCM_FAILURE(rv)) { 36565 sal_free(fg); 36566 goto cleanup; 36567 } 36568 } 36569 36570 part_index = 0; 36571 36572 /* Recover all qualifiers for the given group, based on its 36573 selector codes */ 36574 rv = _field_tr2_group_construct_quals_add(unit, fc, stage_fc, fg); 36575 if (BCM_FAILURE(rv)) { 36576 sal_free(fg); 36577 goto cleanup; 36578 } 36579 36580 #if defined(BCM_TRIDENT2_SUPPORT) 36581 if (fc->l2warm && ((((fc->wb_recovered_version) 36582 >= BCM_FIELD_WB_VERSION_1_15) 36583 && SOC_IS_TRIDENT2X(unit)) || 36584 (((fc->wb_recovered_version) 36585 >= BCM_FIELD_WB_VERSION_1_16) && 36586 SOC_IS_TITAN2PLUS(unit)))) { 36587 /* Store primary key's */ 36588 fpf3_temp[0] = fg->sel_codes[0].fpf3; 36589 fpf3_temp[1] = fg->sel_codes[1].fpf3; 36590 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 36591 /* Get new qset that is part of _BCM_FIELD_EFP_KEY1 36592 and _BCM_FIELD_EFP_KEY4 */ 36593 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1; 36594 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4; 36595 } else { 36596 /* Get new qset that is part of _BCM_FIELD_EFP_KEY4 */ 36597 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY4; 36598 } 36599 36600 /* Recover all qualifiers for the new qset of the group, 36601 based on its selector codes */ 36602 rv = _bcm_field_td2_group_construct_quals_add(unit, fc, 36603 stage_fc, 36604 _FP_ENTRY_TYPE_1, fg, fpf3_temp[0], fpf3_temp[1]); 36605 if (BCM_FAILURE(rv)) { 36606 sal_free(fg); 36607 goto cleanup; 36608 } 36609 /* Restore primary key's */ 36610 fg->sel_codes[0].fpf3 = fpf3_temp[0]; 36611 fg->sel_codes[1].fpf3 = fpf3_temp[1]; 36612 } else if (SOC_IS_TD2_TT2(unit)) { 36613 if ((key_match_type[1] != ~0) && 36614 (key_match_type[0] != key_match_type[1])) { 36615 fpf3_temp[0] = fg->sel_codes[0].fpf3; 36616 fpf3_temp[1] = fg->sel_codes[1].fpf3; 36617 if (fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY4) { 36618 /* Set the select code based on the EFP slice mode and 36619 key_match_type[1] */ 36620 rv = _bcm_field_td2_egress_selcode_set(unit, fg, 36621 efp_slice_mode, efp_key_mode, 36622 key_match_type[1], &parts_count); 36623 if (BCM_FAILURE(rv)) { 36624 sal_free(fg); 36625 goto cleanup; 36626 } 36627 36628 /* Recover all qualifiers for the new qset of the group, 36629 based on its selector codes */ 36630 rv = _bcm_field_td2_group_construct_quals_add(unit, fc, 36631 stage_fc, 36632 _FP_ENTRY_TYPE_1, fg, fpf3_temp[0], fpf3_temp[1]); 36633 if (BCM_FAILURE(rv)) { 36634 sal_free(fg); 36635 goto cleanup; 36636 } 36637 36638 } else if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) || 36639 (fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY2) || 36640 (fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1_NO_V4)) { 36641 /* Set the select code based on the EFP slice mode and 36642 key_match_type[1] */ 36643 rv = _bcm_field_td2_egress_selcode_set(unit, fg, 36644 efp_slice_mode, efp_key_mode, 36645 key_match_type[1], &parts_count); 36646 if (BCM_FAILURE(rv)) { 36647 sal_free(fg); 36648 goto cleanup; 36649 } 36650 36651 /* Recover all qualifiers for the new qset of the group, 36652 based on its selector codes */ 36653 rv = _bcm_field_td2_group_construct_quals_add(unit, fc, 36654 stage_fc, 36655 _FP_ENTRY_TYPE_1, fg, fpf3_temp[0], fpf3_temp[1]); 36656 if (BCM_FAILURE(rv)) { 36657 sal_free(fg); 36658 goto cleanup; 36659 } 36660 36661 } else if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1_NO_V4)&& 36662 (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4)) || 36663 ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY2) && 36664 (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4)) || 36665 ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY3) && 36666 (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY2))) { 36667 /* Set the select code based on the EFP slice mode and 36668 key_match_type[1] */ 36669 rv = _bcm_field_td2_egress_selcode_set(unit, fg, 36670 efp_slice_mode, efp_key_mode, 36671 key_match_type[1], &parts_count); 36672 if (BCM_FAILURE(rv)) { 36673 sal_free(fg); 36674 goto cleanup; 36675 } 36676 36677 /* Recover all qualifiers for the new qset of the group, 36678 based on its selector codes */ 36679 rv = _bcm_field_td2_group_construct_quals_add(unit, fc, 36680 stage_fc, 36681 _FP_ENTRY_TYPE_1, fg, fpf3_temp[0], fpf3_temp[1]); 36682 if (BCM_FAILURE(rv)) { 36683 sal_free(fg); 36684 goto cleanup; 36685 } 36686 } 36687 } 36688 } 36689 #endif 36690 /* Associate slice(s) to group */ 36691 fg->slices = stage_fc->slices[_FP_DEF_INST] + slice_idx; 36692 SOC_PBMP_CLEAR(all_pbmp); 36693 SOC_PBMP_ASSIGN(all_pbmp, PBMP_PORT_ALL(unit)); 36694 SOC_PBMP_OR(all_pbmp, PBMP_CMIC(unit)); 36695 #if defined(BCM_KATANA2_SUPPORT) 36696 if (soc_feature(unit, soc_feature_linkphy_coe) || 36697 soc_feature(unit, soc_feature_subtag_coe)) { 36698 _bcm_kt2_subport_pbmp_update(unit, &all_pbmp); 36699 } 36700 if (SOC_IS_KATANA2(unit) && soc_feature(unit, soc_feature_flex_port)) { 36701 #if defined(BCM_SABER2_SUPPORT) 36702 if((SOC_IS_SABER2(unit)) && 36703 (fc->wb_recovered_version < BCM_FIELD_WB_VERSION_1_19) && 36704 (bcm_sb2_wb_v2_flexio_update == 0)) { 36705 rv = _bcm_sb2_wb_v1_flexio_pbmp_update(unit, &all_pbmp); 36706 } else 36707 #endif 36708 { 36709 rv = (_bcm_kt2_flexio_pbmp_update(unit, &all_pbmp)); 36710 } 36711 if (BCM_FAILURE(rv)) { 36712 goto cleanup; 36713 } 36714 } 36715 #endif 36716 SOC_PBMP_ASSIGN(fg->pbmp, all_pbmp); 36717 BCM_PBMP_OR(fs->pbmp, fg->pbmp); 36718 36719 /* Initialize group default ASET list. */ 36720 rv = _field_group_default_aset_set(unit, fg); 36721 if (BCM_FAILURE(rv)) { 36722 sal_free(fg); 36723 goto cleanup; 36724 } 36725 36726 if (fc->l2warm 36727 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15)) { 36728 if (group_flags & _FP_GROUP_LOOKUP_ENABLED) { 36729 fg->flags = fg->flags | _FP_GROUP_LOOKUP_ENABLED; 36730 } 36731 if (group_flags & _FP_GROUP_WLAN) { 36732 fg->flags = fg->flags | _FP_GROUP_WLAN; 36733 } 36734 } else { 36735 fg->flags |= _FP_GROUP_LOOKUP_ENABLED; 36736 } 36737 36738 fg->next = fc->groups; 36739 fc->groups = fg; 36740 36741 /* Now go over the entries in this slice */ 36742 prev_prio = -1; 36743 for (idx = 0; idx < slice_ent_cnt; idx++) { 36744 efp_tcam_entry = soc_mem_table_idx_to_pointer 36745 (unit, EFP_TCAMm, efp_tcam_entry_t *, 36746 efp_tcam_buf, idx + 36747 slice_ent_cnt * slice_idx); 36748 if (soc_EFP_TCAMm_field32_get(unit, efp_tcam_entry, 36749 VALIDf) == 0) { 36750 continue; 36751 } 36752 #if defined(BCM_TRIDENT2_SUPPORT) 36753 if (SOC_IS_TD2_TT2(unit)) { 36754 _field_extract((uint32 *)efp_tcam_entry, 230 + 2, 4, 36755 &entry_type); 36756 } 36757 #endif 36758 /* Allocate memory for this entry */ 36759 mem_sz = parts_count * sizeof (_field_entry_t); 36760 _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry"); 36761 if (f_ent == NULL) { 36762 rv = BCM_E_MEMORY; 36763 goto cleanup; 36764 } 36765 36766 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 36767 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 36768 } 36769 36770 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 36771 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 36772 if (fc->l2warm) { 36773 /* Recover f_ent_oam_wb structure from here */ 36774 /* Allocate f_ent_oam_wb structure and pass it to 36775 * corresponding function */ 36776 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_11) { 36777 _FP_XGS3_ALLOC(f_ent_oam_wb, sizeof (_field_entry_oam_wb_t), 36778 "Field Entry Warmboot"); 36779 if (f_ent_oam_wb == NULL) { 36780 sal_free (f_ent); 36781 return BCM_E_MEMORY; 36782 } 36783 } 36784 f_ent_wb_info.f_ent_oam_wb = f_ent_oam_wb; 36785 36786 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 36787 action_bmp.w = NULL; 36788 _FP_XGS3_ALLOC(action_bmp.w, 36789 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 36790 "Action No Param Bitmap"); 36791 if (action_bmp.w == NULL) { 36792 rv = BCM_E_MEMORY; 36793 sal_free(f_ent); 36794 goto cleanup; 36795 } 36796 } 36797 f_ent_wb_info.action_bmp = &action_bmp; 36798 36799 /* Recover f_ent_policer_wb structure from here */ 36800 /* Allocate f_ent_policer_wb structure and pass it to 36801 * corresponding function */ 36802 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_17) { 36803 _FP_XGS3_ALLOC(f_ent_policer_wb, sizeof (_field_entry_policer_wb_t), 36804 "Field Entry Warmboot"); 36805 if (f_ent_policer_wb == NULL) { 36806 rv = BCM_E_MEMORY; 36807 sal_free (f_ent); 36808 goto cleanup; 36809 } 36810 } 36811 f_ent_wb_info.f_ent_policer_wb = f_ent_policer_wb; 36812 36813 rv = _field_trx_entry_info_retrieve(unit, 36814 fc, 36815 stage_fc, 36816 multigroup, 36817 &prev_prio, 36818 &f_ent_wb_info 36819 ); 36820 36821 if (BCM_FAILURE(rv)) { 36822 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 36823 sal_free(f_ent); 36824 goto cleanup; 36825 } 36826 } else { 36827 _bcm_field_last_alloc_eid_incr(unit); 36828 } 36829 36830 #if defined(BCM_TRIDENT2_SUPPORT) 36831 if (fc->l2warm && ((((fc->wb_recovered_version) 36832 >= BCM_FIELD_WB_VERSION_1_15) 36833 && SOC_IS_TRIDENT2X(unit)) || 36834 (((fc->wb_recovered_version) 36835 >= BCM_FIELD_WB_VERSION_1_16) && 36836 SOC_IS_TITAN2PLUS(unit)))) { 36837 switch (efp_slice_mode) { 36838 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L2: 36839 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY4) 36840 && (entry_type == _BCM_FIELD_EFP_KEY4_MATCH_TYPE)) { 36841 f_ent->efp_key_match_type = 0; 36842 } else if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY6) 36843 && (entry_type == _BCM_FIELD_EFP_KEY6_MATCH_TYPE)) { 36844 f_ent->efp_key_match_type = 0; 36845 } else { 36846 f_ent->efp_key_match_type = 1; 36847 } 36848 break; 36849 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3: 36850 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) && 36851 (entry_type == _BCM_FIELD_EFP_KEY1_MATCH_TYPE)) { 36852 f_ent->efp_key_match_type = 0; 36853 } else if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY2) && 36854 (entry_type == _BCM_FIELD_EFP_KEY2_MATCH_TYPE)) { 36855 f_ent->efp_key_match_type = 0; 36856 } else if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY5) && 36857 (entry_type == _BCM_FIELD_EFP_KEY5_MATCH_TYPE)) { 36858 f_ent->efp_key_match_type = 0; 36859 } else { 36860 f_ent->efp_key_match_type = 1; 36861 } 36862 break; 36863 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3_ANY: 36864 if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) || 36865 (fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1_NO_V4)) && 36866 (entry_type == _BCM_FIELD_EFP_KEY1_MATCH_TYPE)) { 36867 f_ent->efp_key_match_type = 0; 36868 } else { 36869 f_ent->efp_key_match_type = 1; 36870 } 36871 break; 36872 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE: 36873 if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY3) 36874 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY2)) 36875 && (entry_type == _BCM_FIELD_EFP_KEY2_KEY3_MATCH_TYPE)) { 36876 f_ent->efp_key_match_type = 0; 36877 (f_ent+1)->efp_key_match_type = 0; 36878 } else if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY5) 36879 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4)) 36880 && (entry_type == _BCM_FIELD_EFP_KEY5_KEY4_MATCH_TYPE)) { 36881 f_ent->efp_key_match_type = 0; 36882 (f_ent+1)->efp_key_match_type = 0; 36883 } else if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) 36884 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4)) 36885 && (entry_type == _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE)) { 36886 f_ent->efp_key_match_type = 0; 36887 (f_ent+1)->efp_key_match_type = 0; 36888 } else { 36889 f_ent->efp_key_match_type = 1; 36890 (f_ent+1)->efp_key_match_type = 1; 36891 } 36892 break; 36893 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY: 36894 if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) || 36895 (fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1_NO_V4)) 36896 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4) 36897 && (entry_type == _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE)) { 36898 f_ent->efp_key_match_type = 0; 36899 (f_ent+1)->efp_key_match_type = 0; 36900 } else { 36901 f_ent->efp_key_match_type = 1; 36902 (f_ent+1)->efp_key_match_type = 1; 36903 } 36904 break; 36905 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6: 36906 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY2) 36907 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4) 36908 && (entry_type == _BCM_FIELD_EFP_KEY2_KEY4_MATCH_TYPE)) { 36909 f_ent->efp_key_match_type = 0; 36910 (f_ent+1)->efp_key_match_type = 0; 36911 } else { 36912 f_ent->efp_key_match_type = 1; 36913 (f_ent+1)->efp_key_match_type = 1; 36914 } 36915 break; 36916 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_FCOE: 36917 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY5) 36918 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4) 36919 && (entry_type == _BCM_FIELD_EFP_KEY5_KEY4_MATCH_TYPE)) { 36920 f_ent->efp_key_match_type = 0; 36921 (f_ent+1)->efp_key_match_type = 0; 36922 } else { 36923 f_ent->efp_key_match_type = 1; 36924 (f_ent+1)->efp_key_match_type = 1; 36925 } 36926 break; 36927 default: 36928 rv = BCM_E_INTERNAL; 36929 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 36930 sal_free(f_ent); 36931 goto cleanup; 36932 } 36933 } else if (SOC_IS_TD2_TT2(unit)) { 36934 /* Populate entry type based on the slice mode and entry 36935 key match type */ 36936 switch (efp_slice_mode) { 36937 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L2: 36938 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY4) 36939 && (entry_type == 5)) { 36940 f_ent->efp_key_match_type = 0; 36941 } 36942 break; 36943 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3: 36944 if (((fpf3 == _BCM_FIELD_EFP_KEY1) && 36945 (entry_type == 1)) || 36946 ((fpf3 == _BCM_FIELD_EFP_KEY2) && 36947 (entry_type == 2))) { 36948 f_ent->efp_key_match_type = 1; 36949 } else if ((fg->sel_codes[0].fpf3 == 36950 _BCM_FIELD_EFP_KEY4) && 36951 (entry_type == 5)) { 36952 f_ent->efp_key_match_type = 0; 36953 } 36954 break; 36955 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE: 36956 if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY3) 36957 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY2)) 36958 && (entry_type == 3)) { 36959 f_ent->efp_key_match_type = 1; 36960 } else if (((fg->sel_codes[0].fpf3 == 36961 _BCM_FIELD_EFP_KEY1) && 36962 (fg->sel_codes[1].fpf3 == 36963 _BCM_FIELD_EFP_KEY4)) && 36964 (entry_type == 4)) { 36965 f_ent->efp_key_match_type = 0; 36966 } 36967 break; 36968 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3_ANY: 36969 if ((fpf3 == _BCM_FIELD_EFP_KEY4) && 36970 (entry_type == 5)) { 36971 f_ent->efp_key_match_type = 0; 36972 } else if ((fg->sel_codes[0].fpf3 == 36973 _BCM_FIELD_EFP_KEY1) && 36974 (entry_type == 1)) { 36975 f_ent->efp_key_match_type = 1; 36976 } 36977 break; 36978 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY: 36979 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) 36980 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4) 36981 && (entry_type == 4)) { 36982 f_ent->efp_key_match_type = 0; 36983 (f_ent+1)->efp_key_match_type = 0; 36984 } 36985 break; 36986 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6: 36987 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY2) 36988 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4) 36989 && (entry_type == 6)) { 36990 f_ent->efp_key_match_type = 0; 36991 (f_ent+1)->efp_key_match_type = 0; 36992 } else if ((fg->sel_codes[0].fpf3 == 36993 _BCM_FIELD_EFP_KEY1) && 36994 (fg->sel_codes[1].fpf3 == 36995 _BCM_FIELD_EFP_KEY4) && 36996 (entry_type == 4)) { 36997 f_ent->efp_key_match_type = 1; 36998 (f_ent+1)->efp_key_match_type = 1; 36999 } 37000 break; 37001 default: 37002 rv = BCM_E_INTERNAL; 37003 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37004 sal_free(f_ent); 37005 goto cleanup; 37006 } 37007 } 37008 #endif 37009 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 37010 slice_idx, stage_fc); 37011 if (vslice_idx < 0) { 37012 rv = BCM_E_INTERNAL; 37013 37014 goto cleanup; 37015 } 37016 37017 pri_tcam_idx = idx + slice_ent_cnt * slice_idx; 37018 for (i = 0; i < parts_count; i++) { 37019 if (fc->l2warm) { 37020 f_ent[i].eid = f_ent_wb_info.eid; 37021 /* Set retrieved dvp_type and svp_type */ 37022 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 37023 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 37024 f_ent[i].prio = f_ent_wb_info.prio; 37025 37026 } else { 37027 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 37028 f_ent[i].prio = (vslice_idx << 10) 37029 | (slice_ent_cnt - idx); 37030 } 37031 f_ent[i].group = fg; 37032 rv = _bcm_field_tcam_part_to_entry_flags(unit, i, fg, 37033 &f_ent[i].flags); 37034 if (BCM_FAILURE(rv)) { 37035 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37036 sal_free(f_ent); 37037 goto cleanup; 37038 } 37039 if (f_ent_wb_info.color_independent) { 37040 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 37041 } 37042 rv = _bcm_field_entry_part_tcam_idx_get(unit, f_ent, 37043 pri_tcam_idx, 37044 i, &part_index); 37045 if (BCM_FAILURE(rv)) { 37046 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37047 sal_free(f_ent); 37048 goto cleanup; 37049 } 37050 rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc, 37051 _FP_DEF_INST, 37052 part_index, 37053 &slice_number, 37054 (int *)&f_ent[i].slice_idx); 37055 if (BCM_FAILURE(rv)) { 37056 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37057 sal_free(f_ent); 37058 goto cleanup; 37059 } 37060 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] 37061 + slice_number; 37062 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 37063 /* Decrement slice free entry count for primary 37064 entries. */ 37065 f_ent[i].fs->free_count--; 37066 } 37067 /* Assign entry to a slice */ 37068 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 37069 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 37070 37071 if (soc_EFP_TCAMm_field32_get(unit, efp_tcam_entry, VALIDf) == 3) { 37072 f_ent[i].flags |= _FP_ENTRY_ENABLED; 37073 } 37074 37075 /* Get the actions associated with this entry part */ 37076 efp_policy_entry = soc_mem_table_idx_to_pointer 37077 (unit, EFP_POLICY_TABLEm, 37078 efp_policy_table_entry_t *, 37079 efp_policy_buf, part_index); 37080 rv = _field_tr2_actions_recover(unit, 37081 EFP_POLICY_TABLEm, 37082 (uint32 *) efp_policy_entry, 37083 f_ent, 37084 i, 37085 &f_ent_wb_info); 37086 if (BCM_FAILURE(rv)) { 37087 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37088 sal_free(f_ent); 37089 goto cleanup; 37090 } 37091 if (action_bmp.w != NULL) { 37092 _FP_ACTION_BMP_FREE(action_bmp); 37093 action_bmp.w = NULL; 37094 } 37095 } 37096 #if defined BCM_TRIDENT2_SUPPORT 37097 /* Set action stat flags */ 37098 if (SOC_IS_TD2_TT2(unit)) { 37099 fa = f_ent->actions; 37100 while (fa != NULL) { 37101 rv = _bcm_field_action_stat_flag_update(unit, f_ent, 37102 fa, TRUE); 37103 if (rv < 0) { 37104 goto cleanup; 37105 } 37106 fa = fa->next; 37107 } 37108 } 37109 #endif 37110 /* Add to the group */ 37111 rv = _field_group_entry_add(unit, fg, f_ent); 37112 if (BCM_FAILURE(rv)) { 37113 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37114 sal_free(f_ent); 37115 goto cleanup; 37116 } 37117 f_ent = NULL; 37118 37119 /* Entry has been added to group, 37120 * so free f_ent_oam_wb structure */ 37121 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37122 if (f_ent_policer_wb != NULL) { 37123 sal_free(f_ent_policer_wb); 37124 f_ent_policer_wb = NULL; 37125 } 37126 } 37127 } 37128 /* Free up the temporary slice group info */ 37129 if (fc->l2warm) { 37130 _field_scache_slice_group_free(unit, 37131 fc, 37132 slice_idx 37133 ); 37134 } 37135 } 37136 37137 /* Now go over the expanded slices */ 37138 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 37139 if (!expanded[slice_idx]) { 37140 continue; 37141 } 37142 /* Ignore secondary slice in paired mode */ 37143 efp_slice_mode = soc_reg_field_get(unit, EFP_SLICE_CONTROLr, rval, 37144 _trx_efp_slice_mode[slice_idx][0]); 37145 if (((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE) || 37146 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY) || 37147 (efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6)) && 37148 (slice_idx % 2)) { 37149 continue; 37150 } 37151 /* Skip if slice has no valid entries */ 37152 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 37153 slice_ent_cnt = fs->entry_count; 37154 for (idx = 0; idx < slice_ent_cnt; idx++) { 37155 if (_bcm_field_slice_offset_to_tcam_idx(unit, stage_fc, 37156 _FP_DEF_INST, slice_idx, idx, &phys_tcam_idx) != BCM_E_NONE) { 37157 rv = BCM_E_INTERNAL; 37158 goto cleanup; 37159 } 37160 efp_tcam_entry = soc_mem_table_idx_to_pointer(unit, 37161 EFP_TCAMm, efp_tcam_entry_t *, 37162 efp_tcam_buf, phys_tcam_idx); 37163 if (soc_EFP_TCAMm_field32_get(unit, efp_tcam_entry, VALIDf) != 0) { 37164 break; 37165 } 37166 } 37167 if (idx == slice_ent_cnt) { 37168 continue; 37169 } 37170 /* If Level 2, retrieve the GIDs in this slice */ 37171 if (fc->l2warm) { 37172 rv = _field_trx_scache_slice_group_recover(unit, 37173 fc, _FP_DEF_INST, 37174 slice_idx, 37175 &multigroup, 37176 stage_fc, 37177 0); 37178 37179 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 37180 fc->l2warm = 0; 37181 goto cleanup; 37182 } 37183 if (rv == BCM_E_NOT_FOUND) { 37184 rv = BCM_E_NONE; 37185 continue; 37186 } 37187 } 37188 /* Now find the master slice for this virtual group */ 37189 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 37190 slice_idx, stage_fc); 37191 if (vslice_idx < 0) { 37192 rv = BCM_E_INTERNAL; 37193 37194 goto cleanup; 37195 } 37196 37197 if (fc->l2warm 37198 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8)) { 37199 master_slice = slice_master_idx[slice_idx]; 37200 } else { 37201 max = -1; 37202 for (i = 0; i < stage_fc->tcam_slices; i++) { 37203 if ((stage_fc->vmap[_FP_DEF_INST][0][vslice_idx].virtual_group == 37204 stage_fc->vmap[_FP_DEF_INST][0][i].virtual_group) && (i != vslice_idx)) { 37205 if (i > max) { 37206 max = i; 37207 } 37208 } 37209 } 37210 if (max < 0) { 37211 rv = BCM_E_INTERNAL; 37212 37213 goto cleanup; 37214 } 37215 37216 master_slice = stage_fc->vmap[_FP_DEF_INST][0][max].vmap_key; 37217 } 37218 /* See which group is in this slice - can be only one */ 37219 fg = fc->groups; 37220 while (fg != NULL) { 37221 /* Check if group is in this slice */ 37222 fs = &fg->slices[0]; 37223 if ((fg->stage_id == stage_fc->stage_id) 37224 && (fs->slice_number == master_slice)) { 37225 break; 37226 } 37227 fg = fg->next; 37228 } 37229 if (fg == NULL) { 37230 rv = BCM_E_INTERNAL; 37231 37232 goto cleanup; 37233 } 37234 37235 old_physical_slice = fs->slice_number; 37236 37237 /* Set up the new physical slice parameters in Software */ 37238 for(part_index = parts_count - 1; part_index >= 0; part_index--) { 37239 /* Get entry flags. */ 37240 rv = _bcm_field_tcam_part_to_entry_flags(unit, part_index, fg, &entry_flags); 37241 BCM_IF_ERROR_RETURN(rv); 37242 37243 /* Get slice id for entry part */ 37244 rv = _bcm_field_tcam_part_to_slice_number(unit, part_index, 37245 fg, &slice_num); 37246 BCM_IF_ERROR_RETURN(rv); 37247 37248 /* Get slice pointer. */ 37249 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx + slice_num; 37250 37251 if (0 == (entry_flags & _FP_ENTRY_SECOND_HALF)) { 37252 /* Set per slice configuration & number of free entries in the slice.*/ 37253 fs->free_count = fs->entry_count; 37254 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 37255 fs->free_count >>= 1; 37256 } 37257 /* Set group flags in in slice.*/ 37258 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 37259 37260 /* Add slice to slices linked list . */ 37261 fs_temp = stage_fc->slices[_FP_DEF_INST] + old_physical_slice + slice_num; 37262 /* To handle more than one auto expanded slice in a group */ 37263 while (fs_temp->next != NULL) { 37264 fs_temp = fs_temp->next; 37265 } 37266 fs_temp->next = fs; 37267 fs->prev = fs_temp; 37268 } 37269 } 37270 37271 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 37272 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 37273 37274 prev_prio = -1; 37275 SOC_PBMP_CLEAR(all_pbmp); 37276 SOC_PBMP_ASSIGN(all_pbmp, PBMP_PORT_ALL(unit)); 37277 SOC_PBMP_OR(all_pbmp, PBMP_CMIC(unit)); 37278 #if defined(BCM_KATANA2_SUPPORT) 37279 if (soc_feature(unit, soc_feature_linkphy_coe) || 37280 soc_feature(unit, soc_feature_subtag_coe)) { 37281 _bcm_kt2_subport_pbmp_update(unit, &all_pbmp); 37282 } 37283 if (SOC_IS_KATANA2(unit) && soc_feature(unit, soc_feature_flex_port)) { 37284 #if defined(BCM_SABER2_SUPPORT) 37285 if((SOC_IS_SABER2(unit)) && 37286 (fc->wb_recovered_version < BCM_FIELD_WB_VERSION_1_19) && 37287 (bcm_sb2_wb_v2_flexio_update == 0)) { 37288 rv = _bcm_sb2_wb_v1_flexio_pbmp_update(unit, &all_pbmp); 37289 } else 37290 #endif 37291 { 37292 rv = (_bcm_kt2_flexio_pbmp_update(unit, &all_pbmp)); 37293 } 37294 if (BCM_FAILURE(rv)) { 37295 goto cleanup; 37296 } 37297 } 37298 #endif 37299 SOC_PBMP_ASSIGN(fg->pbmp, all_pbmp); 37300 BCM_PBMP_OR(fs->pbmp, fg->pbmp); 37301 for (idx = 0; idx < slice_ent_cnt; idx++) { 37302 if (_bcm_field_slice_offset_to_tcam_idx(unit, stage_fc, 37303 _FP_DEF_INST, slice_idx, idx, &phys_tcam_idx) != BCM_E_NONE) { 37304 rv = BCM_E_INTERNAL; 37305 goto cleanup; 37306 } 37307 efp_tcam_entry = soc_mem_table_idx_to_pointer(unit, 37308 EFP_TCAMm, efp_tcam_entry_t *, 37309 efp_tcam_buf, phys_tcam_idx); 37310 if (soc_EFP_TCAMm_field32_get(unit, efp_tcam_entry, VALIDf) == 0) { 37311 continue; 37312 } 37313 #if defined(BCM_TRIDENT2_SUPPORT) 37314 if (SOC_IS_TD2_TT2(unit)) { 37315 _field_extract((uint32 *)efp_tcam_entry, 230 + 2, 4, 37316 &entry_type); 37317 } 37318 #endif 37319 37320 /* Allocate memory for the entry */ 37321 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 37322 fg->flags, &parts_count); 37323 if (BCM_FAILURE(rv)) { 37324 goto cleanup; 37325 } 37326 mem_sz = parts_count * sizeof (_field_entry_t); 37327 _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry"); 37328 if (f_ent == NULL) { 37329 rv = BCM_E_MEMORY; 37330 goto cleanup; 37331 } 37332 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 37333 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 37334 } 37335 37336 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 37337 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 37338 if (fc->l2warm) { 37339 /* Recover f_ent_oam_wb structure from here */ 37340 /* Allocate f_ent_oam_wb structure and pass it to 37341 * corresponding function */ 37342 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_11) { 37343 _FP_XGS3_ALLOC(f_ent_oam_wb, sizeof (_field_entry_oam_wb_t), 37344 "Field Entry Warmboot"); 37345 if (f_ent_oam_wb == NULL) { 37346 sal_free (f_ent); 37347 return BCM_E_MEMORY; 37348 } 37349 } 37350 f_ent_wb_info.f_ent_oam_wb = f_ent_oam_wb; 37351 37352 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 37353 action_bmp.w = NULL; 37354 _FP_XGS3_ALLOC(action_bmp.w, 37355 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 37356 "Action No Param Bitmap"); 37357 if (action_bmp.w == NULL) { 37358 rv = BCM_E_MEMORY; 37359 sal_free(f_ent); 37360 goto cleanup; 37361 } 37362 } 37363 f_ent_wb_info.action_bmp = &action_bmp; 37364 37365 /* Recover f_ent_policer_wb structure from here */ 37366 /* Allocate f_ent_policer_wb structure and pass it to 37367 * corresponding function */ 37368 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_17) { 37369 _FP_XGS3_ALLOC(f_ent_policer_wb, sizeof (_field_entry_policer_wb_t), 37370 "Field Entry Warmboot"); 37371 if (f_ent_policer_wb == NULL) { 37372 rv = BCM_E_MEMORY; 37373 sal_free (f_ent); 37374 goto cleanup; 37375 } 37376 } 37377 f_ent_wb_info.f_ent_policer_wb = f_ent_policer_wb; 37378 37379 rv = _field_trx_entry_info_retrieve(unit, 37380 fc, stage_fc, multigroup, &prev_prio, &f_ent_wb_info); 37381 37382 if (BCM_FAILURE(rv)) { 37383 sal_free(f_ent); 37384 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37385 goto cleanup; 37386 } 37387 } else { 37388 _bcm_field_last_alloc_eid_incr(unit); 37389 } 37390 #if defined(BCM_TRIDENT2_SUPPORT) 37391 if (fc->l2warm && ((((fc->wb_recovered_version) 37392 >= BCM_FIELD_WB_VERSION_1_15) 37393 && SOC_IS_TRIDENT2X(unit)) || 37394 (((fc->wb_recovered_version) 37395 >= BCM_FIELD_WB_VERSION_1_16) && 37396 SOC_IS_TITAN2PLUS(unit)))) { 37397 switch (efp_slice_mode) { 37398 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L2: 37399 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY4) 37400 && (entry_type == _BCM_FIELD_EFP_KEY4_MATCH_TYPE)) { 37401 f_ent->efp_key_match_type = 0; 37402 } else if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY6) 37403 && (entry_type == _BCM_FIELD_EFP_KEY6_MATCH_TYPE)) { 37404 f_ent->efp_key_match_type = 0; 37405 } else { 37406 f_ent->efp_key_match_type = 1; 37407 } 37408 break; 37409 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3: 37410 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) && 37411 (entry_type == _BCM_FIELD_EFP_KEY1_MATCH_TYPE)) { 37412 f_ent->efp_key_match_type = 0; 37413 } else if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY2) && 37414 (entry_type == _BCM_FIELD_EFP_KEY2_MATCH_TYPE)) { 37415 f_ent->efp_key_match_type = 0; 37416 } else if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY5) && 37417 (entry_type == _BCM_FIELD_EFP_KEY5_MATCH_TYPE)) { 37418 f_ent->efp_key_match_type = 0; 37419 } else { 37420 f_ent->efp_key_match_type = 1; 37421 } 37422 break; 37423 case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3_ANY: 37424 if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) || 37425 (fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1_NO_V4)) && 37426 (entry_type == _BCM_FIELD_EFP_KEY1_MATCH_TYPE)) { 37427 f_ent->efp_key_match_type = 0; 37428 } else { 37429 f_ent->efp_key_match_type = 1; 37430 } 37431 break; 37432 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE: 37433 if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY3) 37434 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY2)) 37435 && (entry_type == _BCM_FIELD_EFP_KEY2_KEY3_MATCH_TYPE)) { 37436 f_ent->efp_key_match_type = 0; 37437 (f_ent+1)->efp_key_match_type = 0; 37438 } else if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY5) 37439 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4)) 37440 && (entry_type == _BCM_FIELD_EFP_KEY5_KEY4_MATCH_TYPE)) { 37441 f_ent->efp_key_match_type = 0; 37442 (f_ent+1)->efp_key_match_type = 0; 37443 } else if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) 37444 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4)) 37445 && (entry_type == _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE)) { 37446 f_ent->efp_key_match_type = 0; 37447 (f_ent+1)->efp_key_match_type = 0; 37448 } else { 37449 f_ent->efp_key_match_type = 1; 37450 (f_ent+1)->efp_key_match_type = 1; 37451 } 37452 break; 37453 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY: 37454 if (((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1) || 37455 (fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY1_NO_V4)) 37456 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4) 37457 && (entry_type == _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE)) { 37458 f_ent->efp_key_match_type = 0; 37459 (f_ent+1)->efp_key_match_type = 0; 37460 } else { 37461 f_ent->efp_key_match_type = 1; 37462 (f_ent+1)->efp_key_match_type = 1; 37463 } 37464 break; 37465 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6: 37466 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY2) 37467 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4) 37468 && (entry_type == _BCM_FIELD_EFP_KEY2_KEY4_MATCH_TYPE)) { 37469 f_ent->efp_key_match_type = 0; 37470 (f_ent+1)->efp_key_match_type = 0; 37471 } else { 37472 f_ent->efp_key_match_type = 1; 37473 (f_ent+1)->efp_key_match_type = 1; 37474 } 37475 break; 37476 case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_FCOE: 37477 if ((fg->sel_codes[0].fpf3 == _BCM_FIELD_EFP_KEY5) 37478 && (fg->sel_codes[1].fpf3 == _BCM_FIELD_EFP_KEY4) 37479 && (entry_type == _BCM_FIELD_EFP_KEY5_KEY4_MATCH_TYPE)) { 37480 f_ent->efp_key_match_type = 0; 37481 (f_ent+1)->efp_key_match_type = 0; 37482 } else { 37483 f_ent->efp_key_match_type = 1; 37484 (f_ent+1)->efp_key_match_type = 1; 37485 } 37486 break; 37487 default: 37488 rv = BCM_E_INTERNAL; 37489 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37490 sal_free(f_ent); 37491 goto cleanup; 37492 } 37493 } 37494 #endif 37495 pri_tcam_idx = phys_tcam_idx; 37496 for (i = 0; i < parts_count; i++) { 37497 if (fc->l2warm) { 37498 /* Use retrieved EID */ 37499 f_ent[i].eid = f_ent_wb_info.eid; 37500 /* Set retrieved dvp_type and svp_type */ 37501 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 37502 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 37503 f_ent[i].prio = f_ent_wb_info.prio; 37504 } else { 37505 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 37506 f_ent[i].prio = (vslice_idx << 10) | (slice_ent_cnt - idx); 37507 } 37508 f_ent[i].group = fg; 37509 37510 rv = _bcm_field_tcam_part_to_entry_flags(unit, i, fg, 37511 &f_ent[i].flags); 37512 if (BCM_FAILURE(rv)) { 37513 sal_free(f_ent); 37514 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37515 goto cleanup; 37516 } 37517 if (f_ent_wb_info.color_independent) { 37518 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 37519 } 37520 rv = _bcm_field_entry_part_tcam_idx_get(unit, 37521 f_ent, pri_tcam_idx, i, &part_index); 37522 if (BCM_FAILURE(rv)) { 37523 sal_free(f_ent); 37524 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37525 goto cleanup; 37526 } 37527 rv = _bcm_field_tcam_idx_to_slice_offset(unit, 37528 stage_fc, _FP_DEF_INST, part_index, &slice_number, 37529 (int *)&f_ent[i].slice_idx); 37530 if (BCM_FAILURE(rv)) { 37531 sal_free(f_ent); 37532 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37533 goto cleanup; 37534 } 37535 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 37536 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 37537 /* Decrement slice free entry count for primary 37538 entries. */ 37539 f_ent[i].fs->free_count--; 37540 } 37541 /* Assign entry to a slice */ 37542 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 37543 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 37544 37545 if (soc_EFP_TCAMm_field32_get(unit, efp_tcam_entry, VALIDf) == 3) { 37546 f_ent[i].flags |= _FP_ENTRY_ENABLED; 37547 } 37548 37549 /* Get the actions associated with this part of the entry */ 37550 efp_policy_entry = soc_mem_table_idx_to_pointer( 37551 unit, EFP_POLICY_TABLEm, efp_policy_table_entry_t *, 37552 efp_policy_buf, part_index); 37553 rv = _field_tr2_actions_recover(unit, 37554 EFP_POLICY_TABLEm, (uint32 *) efp_policy_entry, 37555 f_ent, i, &f_ent_wb_info); 37556 if (BCM_FAILURE(rv)) { 37557 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37558 sal_free(f_ent); 37559 goto cleanup; 37560 } 37561 if (action_bmp.w != NULL) { 37562 _FP_ACTION_BMP_FREE(action_bmp); 37563 action_bmp.w = NULL; 37564 } 37565 } 37566 37567 #if defined BCM_TRIDENT2_SUPPORT 37568 /* Set action stat flags */ 37569 if (SOC_IS_TD2_TT2(unit)) { 37570 fa = f_ent->actions; 37571 while (fa != NULL) { 37572 rv = _bcm_field_action_stat_flag_update(unit, f_ent, 37573 fa, TRUE); 37574 if (rv < 0) { 37575 sal_free(f_ent); 37576 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37577 goto cleanup; 37578 } 37579 fa = fa->next; 37580 } 37581 } 37582 #endif 37583 37584 rv = _field_group_entry_add(unit, fg, f_ent); 37585 if (BCM_FAILURE(rv)) { 37586 sal_free(f_ent); 37587 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37588 goto cleanup; 37589 } 37590 f_ent = NULL; 37591 37592 /* Entry has been added to group, 37593 * so free f_ent_oam_wb structure */ 37594 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 37595 if (f_ent_policer_wb != NULL) { 37596 sal_free(f_ent_policer_wb); 37597 f_ent_policer_wb = NULL; 37598 } 37599 } 37600 /* Free up the temporary slice group info */ 37601 if (fc->l2warm) { 37602 _field_scache_slice_group_free(unit, fc, slice_idx); 37603 } 37604 } 37605 37606 if (fc->l2warm) { 37607 37608 /* Mark end of Slice Info */ 37609 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 37610 fc->scache_pos++; 37611 } 37612 37613 if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) { 37614 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 37615 if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) { 37616 LOG_DEBUG(BSL_LS_BCM_FP, 37617 (BSL_META_U(unit,"Recovering hint Ids " 37618 "from pos = %d\r\n"), fc->scache_pos)); 37619 BCM_IF_ERROR_RETURN (_bcm_hints_scache_hintid_recover(unit, stage_fc, 37620 fc, &buf[fc->scache_pos])); 37621 } 37622 } 37623 } 37624 37625 /* Group Slice Selectors */ 37626 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 37627 rv = (_field_group_slice_selectors_recover(unit, 37628 &buf[fc->scache_pos], stage_fc->stage_id)); 37629 if (BCM_FAILURE(rv)) { 37630 goto cleanup; 37631 } 37632 } 37633 37634 temp = 0; 37635 temp |= buf[fc->scache_pos]; 37636 fc->scache_pos++; 37637 temp |= buf[fc->scache_pos] << 8; 37638 fc->scache_pos++; 37639 temp |= buf[fc->scache_pos] << 16; 37640 fc->scache_pos++; 37641 temp |= buf[fc->scache_pos] << 24; 37642 fc->scache_pos++; 37643 if (temp != _FIELD_EFP_DATA_END) { 37644 fc->l2warm = 0; 37645 rv = BCM_E_INTERNAL; 37646 } 37647 37648 if (NULL != buf1) { 37649 temp = 0; 37650 temp |= buf1[fc->scache_pos1]; 37651 fc->scache_pos1++; 37652 temp |= buf1[fc->scache_pos1] << 8; 37653 fc->scache_pos1++; 37654 temp |= buf1[fc->scache_pos1] << 16; 37655 fc->scache_pos1++; 37656 temp |= buf1[fc->scache_pos1] << 24; 37657 fc->scache_pos1++; 37658 if (temp != _FIELD_EFP_DATA_END) { 37659 fc->l2warm = 0; 37660 rv = BCM_E_INTERNAL; 37661 } 37662 } 37663 37664 } 37665 37666 if (BCM_SUCCESS(rv)) { 37667 _field_group_slice_vmap_recovery(unit, fc, stage_fc); 37668 } 37669 37670 _field_tr2_stage_reinit_all_groups_cleanup(unit, fc, 37671 _BCM_FIELD_STAGE_EGRESS, 37672 NULL); 37673 37674 cleanup: 37675 if (efp_tcam_buf) { 37676 soc_cm_sfree(unit, efp_tcam_buf); 37677 } 37678 if (efp_policy_buf) { 37679 soc_cm_sfree(unit, efp_policy_buf); 37680 } 37681 if (action_bmp.w != NULL) { 37682 _FP_ACTION_BMP_FREE(action_bmp); 37683 action_bmp.w = NULL; 37684 } 37685 if (f_ent_policer_wb != NULL) { 37686 sal_free(f_ent_policer_wb); 37687 f_ent_policer_wb = NULL; 37688 } 37689 return rv; 37690 } 37691 37692 int 37693 _field_tr2_stage_lookup_reinit(int unit, _field_control_t *fc, 37694 _field_stage_t *stage_fc) 37695 { 37696 int vslice_idx, max, master_slice; 37697 int idx, idx1, slice_idx, index_min, index_max, ratio, rv = BCM_E_NONE; 37698 int group_found, mem_sz, parts_count, slice_ent_cnt, expanded[4], slice_master_idx[4]; 37699 int i, pri_tcam_idx, part_index, slice_number, prev_prio, multigroup = 0; 37700 uint32 *vfp_tcam_buf = NULL; /* Buffer to read the VFP_TCAM table */ 37701 char *vfp_policy_buf = NULL; /* Buffer to read the VFP_POLICY table */ 37702 uint32 rval, paired, intraslice, dbl_wide_key, dbl_wide_key_sec; 37703 uint32 vfp_key, temp; 37704 uint32 vfp_key2 = 0; 37705 #if defined(BCM_KATANA2_SUPPORT) 37706 uint64 vfp_key_1 = 0; 37707 #endif 37708 soc_field_t fld; 37709 vfp_tcam_entry_t *vfp_tcam_entry; 37710 vfp_policy_table_entry_t *vfp_policy_entry; 37711 _field_hw_qual_info_t hw_sels; 37712 _field_slice_t *fs; 37713 _field_group_t *fg; 37714 _field_entry_t *f_ent = NULL; 37715 bcm_pbmp_t entry_pbmp, temp_pbmp; 37716 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 37717 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 37718 #if defined(BCM_KATANA_SUPPORT) 37719 _field_stat_t *f_st = NULL; 37720 bcm_stat_group_mode_t stat_mode; /* Stat type bcmStatGroupModeXXX. */ 37721 bcm_stat_object_t stat_obj; /* Stat object type. */ 37722 uint32 pool_num; /* Flex Stat Hw Pool No. */ 37723 uint32 base_index; /* Flex Stat counter base index. */ 37724 #endif 37725 uint8 old_physical_slice, slice_num; 37726 uint32 entry_flags; 37727 _field_slice_t *fs_temp = NULL; 37728 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_GLOBAL_METER_SUPPORT) 37729 int offset_mode = 0, policer_index = 0; 37730 #endif /* BCM_KATANA_SUPPORT || BCM_GLOBAL_METER_SUPPORT */ 37731 soc_field_t vfp_en_flds[4] = {SLICE_ENABLE_SLICE_0f, SLICE_ENABLE_SLICE_1f, 37732 SLICE_ENABLE_SLICE_2f, SLICE_ENABLE_SLICE_3f}; 37733 37734 soc_field_t vfp_lk_en_flds[4] = 37735 {LOOKUP_ENABLE_SLICE_0f, LOOKUP_ENABLE_SLICE_1f, 37736 LOOKUP_ENABLE_SLICE_2f, LOOKUP_ENABLE_SLICE_3f}; 37737 37738 _field_action_bmp_t action_bmp; 37739 _field_entry_wb_info_t f_ent_wb_info; 37740 37741 /* Reset Action bitmap to NULL. */ 37742 action_bmp.w = NULL; 37743 37744 SOC_PBMP_CLEAR(entry_pbmp); 37745 sal_memset(expanded, 0, 4 * sizeof(int)); 37746 sal_memset(slice_master_idx, 0, 4 * sizeof(int)); 37747 37748 if (fc->l2warm) { 37749 rv = _field_scache_stage_hdr_chk(fc, _FIELD_VFP_DATA_START); 37750 if (BCM_FAILURE(rv)) { 37751 return (rv); 37752 } 37753 } 37754 37755 /* DMA various tables */ 37756 vfp_tcam_buf = soc_cm_salloc(unit, sizeof(vfp_tcam_entry_t) * 37757 soc_mem_index_count(unit, VFP_TCAMm), 37758 "VFP TCAM buffer"); 37759 if (NULL == vfp_tcam_buf) { 37760 return BCM_E_MEMORY; 37761 } 37762 sal_memset(vfp_tcam_buf, 0, sizeof(vfp_tcam_entry_t) * 37763 soc_mem_index_count(unit, VFP_TCAMm)); 37764 index_min = soc_mem_index_min(unit, VFP_TCAMm); 37765 index_max = soc_mem_index_max(unit, VFP_TCAMm); 37766 fs = stage_fc->slices[_FP_DEF_INST]; 37767 if (stage_fc->flags & _FP_STAGE_HALF_SLICE) { 37768 slice_ent_cnt = fs->entry_count * 2; 37769 /* DMA in chunks */ 37770 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 37771 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 37772 if ((rv = soc_mem_read_range(unit, VFP_TCAMm, MEM_BLOCK_ALL, 37773 slice_idx * slice_ent_cnt, 37774 slice_idx * slice_ent_cnt + 37775 fs->entry_count / 2 - 1, 37776 vfp_tcam_buf + slice_idx * 37777 slice_ent_cnt * 37778 soc_mem_entry_words(unit, VFP_TCAMm))) < 0 ) { 37779 goto cleanup; 37780 } 37781 if ((rv = soc_mem_read_range(unit, VFP_TCAMm, MEM_BLOCK_ALL, 37782 slice_idx * slice_ent_cnt + 37783 fs->entry_count, 37784 slice_idx * slice_ent_cnt + 37785 fs->entry_count + 37786 fs->entry_count / 2 - 1, 37787 vfp_tcam_buf + (slice_idx * 37788 slice_ent_cnt + fs->entry_count) * 37789 soc_mem_entry_words(unit, VFP_TCAMm))) < 0 ) { 37790 goto cleanup; 37791 } 37792 } 37793 } else { 37794 slice_ent_cnt = fs->entry_count; 37795 if ((rv = soc_mem_read_range(unit, VFP_TCAMm, MEM_BLOCK_ALL, 37796 index_min, index_max, 37797 vfp_tcam_buf)) < 0 ) { 37798 goto cleanup; 37799 } 37800 } 37801 vfp_policy_buf = soc_cm_salloc(unit, SOC_MEM_TABLE_BYTES 37802 (unit, VFP_POLICY_TABLEm), 37803 "VFP POLICY TABLE buffer"); 37804 if (NULL == vfp_policy_buf) { 37805 return BCM_E_MEMORY; 37806 } 37807 index_min = soc_mem_index_min(unit, VFP_POLICY_TABLEm); 37808 index_max = soc_mem_index_max(unit, VFP_POLICY_TABLEm); 37809 if ((rv = soc_mem_read_range(unit, VFP_POLICY_TABLEm, MEM_BLOCK_ALL, 37810 index_min, index_max, 37811 vfp_policy_buf)) < 0 ) { 37812 goto cleanup; 37813 } 37814 37815 /* Get slice expansion status and virtual map */ 37816 if ((rv = _field_slice_expanded_status_get(unit, fc, stage_fc, expanded, slice_master_idx)) < 0) { 37817 goto cleanup; 37818 } 37819 37820 /* Iterate over the slices */ 37821 if ((rv = READ_VFP_SLICE_CONTROLr(unit, &rval)) < 0) { 37822 goto cleanup; 37823 } 37824 if ((rv = READ_VFP_KEY_CONTROLr(unit, &vfp_key)) < 0) { 37825 goto cleanup; 37826 } 37827 if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) { 37828 if ((rv = READ_VFP_KEY_CONTROL_2r(unit, &vfp_key2)) < 0) { 37829 goto cleanup; 37830 } 37831 } 37832 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 37833 /* Ignore disabled slice */ 37834 if ((soc_reg_field_get(unit, VFP_SLICE_CONTROLr, rval, 37835 vfp_en_flds[slice_idx]) == 0) || 37836 (soc_reg_field_get(unit, VFP_SLICE_CONTROLr, rval, 37837 vfp_lk_en_flds[slice_idx]) == 0)) { 37838 continue; 37839 } 37840 /* Ignore secondary slice in paired mode */ 37841 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 37842 paired = soc_reg_field_get(unit, VFP_KEY_CONTROLr, vfp_key, fld); 37843 fld = _vfp_slice_wide_mode_field[slice_idx]; 37844 if (soc_reg_field_valid(unit, VFP_KEY_CONTROLr, fld)) { 37845 intraslice = soc_reg_field_get(unit, VFP_KEY_CONTROLr, vfp_key, fld); 37846 } else { 37847 intraslice = 0; 37848 } 37849 if (paired && (slice_idx % 2)) { 37850 continue; 37851 } 37852 /* Don't need to read selectors for expanded slice */ 37853 if (expanded[slice_idx]) { 37854 continue; 37855 } 37856 /* Skip if slice has no valid groups and entries */ 37857 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 37858 for (idx = 0; idx < slice_ent_cnt; idx++) { 37859 vfp_tcam_entry = soc_mem_table_idx_to_pointer 37860 (unit, VFP_TCAMm, vfp_tcam_entry_t *, 37861 vfp_tcam_buf, idx + 37862 slice_ent_cnt * slice_idx); 37863 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, 37864 VALIDf) != 0) { 37865 break; 37866 } 37867 } 37868 if (idx == slice_ent_cnt && !fc->l2warm) { 37869 continue; 37870 } 37871 /* If Level 2, retrieve the GIDs in this slice */ 37872 if (fc->l2warm) { 37873 rv = _field_trx_scache_slice_group_recover(unit, 37874 fc, _FP_DEF_INST, 37875 slice_idx, 37876 &multigroup, 37877 stage_fc, 37878 0); 37879 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 37880 fc->l2warm = 0; 37881 goto cleanup; 37882 } 37883 if (rv == BCM_E_NOT_FOUND) { 37884 rv = BCM_E_NONE; 37885 continue; 37886 } 37887 } 37888 37889 /* Construct the group based on HW selector values */ 37890 _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[0]); 37891 hw_sels.pri_slice[0].intraslice = _FP_SELCODE_DONT_USE; 37892 _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[1]); 37893 hw_sels.pri_slice[1].intraslice = _FP_SELCODE_DONT_USE; 37894 _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[0]); 37895 hw_sels.sec_slice[0].intraslice = _FP_SELCODE_DONT_USE; 37896 _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[1]); 37897 hw_sels.sec_slice[1].intraslice = _FP_SELCODE_DONT_USE; 37898 37899 /* Get primary slice's selectors */ 37900 hw_sels.pri_slice[0].fpf1 = 0; 37901 hw_sels.pri_slice[0].fpf2 37902 = soc_reg_field_get(unit, 37903 VFP_KEY_CONTROLr, 37904 vfp_key, 37905 _bcm_field_trx_vfp_field_sel[slice_idx][0] 37906 ); 37907 hw_sels.pri_slice[0].fpf3 37908 = soc_reg_field_get(unit, 37909 VFP_KEY_CONTROLr, 37910 vfp_key, 37911 _bcm_field_trx_vfp_field_sel[slice_idx][1] 37912 ); 37913 if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) { 37914 hw_sels.pri_slice[0].ip_header_sel 37915 = soc_reg_field_get(unit, 37916 VFP_KEY_CONTROL_2r, 37917 vfp_key2, 37918 _bcm_field_trx_vfp_ip_header_sel[slice_idx] 37919 ); 37920 } 37921 #if defined(BCM_KATANA_SUPPORT) 37922 if (SOC_IS_KATANA(unit)) { 37923 hw_sels.pri_slice[0].src_entity_sel 37924 = soc_reg_field_get(unit, 37925 VFP_KEY_CONTROL_2r, 37926 vfp_key2, 37927 _trx_vfp_src_type_sel[slice_idx] 37928 ); 37929 } 37930 #endif 37931 #if defined (BCM_KATANA2_SUPPORT) 37932 if (SOC_IS_KATANA2(unit)) { 37933 hw_sels.pri_slice[0].src_entity_sel 37934 = soc_reg_field_get(unit, 37935 VFP_KEY_CONTROL_1r, 37936 vfp_key_1, 37937 _trx_vfp_src_type_sel[slice_idx] 37938 ); 37939 } 37940 #endif 37941 /* If intraslice, get double-wide key - only 2 options */ 37942 if (intraslice) { 37943 dbl_wide_key = soc_reg_field_get( 37944 unit, 37945 VFP_KEY_CONTROLr, 37946 vfp_key, 37947 _bcm_field_trx_vfp_double_wide_sel[slice_idx] 37948 ); 37949 hw_sels.pri_slice[1].intraslice = TRUE; 37950 hw_sels.pri_slice[1].fpf2 = dbl_wide_key; 37951 hw_sels.pri_slice[1].fpf3 = 0; 37952 if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) { 37953 hw_sels.pri_slice[1].ip_header_sel 37954 = soc_reg_field_get(unit, 37955 VFP_KEY_CONTROL_2r, vfp_key2, 37956 _bcm_field_trx_vfp_ip_header_sel[slice_idx] 37957 ); 37958 } 37959 #if defined(BCM_KATANA_SUPPORT) 37960 if (SOC_IS_KATANA(unit)) { 37961 hw_sels.pri_slice[1].src_entity_sel 37962 = soc_reg_field_get(unit, 37963 VFP_KEY_CONTROL_2r, 37964 vfp_key2, 37965 _trx_vfp_src_type_sel[slice_idx] 37966 ); 37967 } 37968 #endif 37969 #if defined(BCM_KATANA2_SUPPORT) 37970 if (SOC_IS_KATANA2(unit)) { 37971 hw_sels.pri_slice[1].src_entity_sel 37972 = soc_reg_field_get(unit, 37973 VFP_KEY_CONTROL_1r, 37974 vfp_key_1, 37975 _trx_vfp_src_type_sel[slice_idx] 37976 ); 37977 } 37978 #endif 37979 } 37980 /* If paired, get secondary slice's selectors */ 37981 if (paired) { 37982 hw_sels.sec_slice[0].fpf1 = 0; 37983 hw_sels.sec_slice[0].fpf2 37984 = soc_reg_field_get( 37985 unit, 37986 VFP_KEY_CONTROLr, 37987 vfp_key, 37988 _bcm_field_trx_vfp_field_sel[slice_idx + 1][0] 37989 ); 37990 hw_sels.sec_slice[0].fpf3 37991 = soc_reg_field_get( 37992 unit, 37993 VFP_KEY_CONTROLr, 37994 vfp_key, 37995 _bcm_field_trx_vfp_field_sel[slice_idx + 1][1] 37996 ); 37997 if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) { 37998 hw_sels.sec_slice[0].ip_header_sel 37999 = soc_reg_field_get(unit, 38000 VFP_KEY_CONTROL_2r, vfp_key2, 38001 _bcm_field_trx_vfp_ip_header_sel[slice_idx + 1]); 38002 } 38003 #if defined(BCM_KATANA_SUPPORT) 38004 if (SOC_IS_KATANA(unit)) { 38005 hw_sels.sec_slice[0].src_entity_sel 38006 = soc_reg_field_get(unit, 38007 VFP_KEY_CONTROL_2r, 38008 vfp_key2, 38009 _trx_vfp_src_type_sel[slice_idx + 1] 38010 ); 38011 } 38012 #endif 38013 #if defined(BCM_KATANA2_SUPPORT) 38014 if (SOC_IS_KATANA2(unit)) { 38015 hw_sels.sec_slice[0].src_entity_sel 38016 = soc_reg_field_get(unit, 38017 VFP_KEY_CONTROL_1r, 38018 vfp_key_1, 38019 _trx_vfp_src_type_sel[slice_idx + 1] 38020 ); 38021 } 38022 #endif 38023 if (intraslice) { 38024 dbl_wide_key_sec 38025 = soc_reg_field_get( 38026 unit, 38027 VFP_KEY_CONTROLr, 38028 vfp_key, 38029 _bcm_field_trx_vfp_double_wide_sel[slice_idx + 1] 38030 ); 38031 hw_sels.sec_slice[1].intraslice = TRUE; 38032 hw_sels.sec_slice[1].fpf2 = dbl_wide_key_sec; 38033 hw_sels.sec_slice[1].fpf3 = 0; 38034 if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) { 38035 hw_sels.sec_slice[1].ip_header_sel 38036 = soc_reg_field_get( 38037 unit, 38038 VFP_KEY_CONTROL_2r, 38039 vfp_key2, 38040 _bcm_field_trx_vfp_ip_header_sel[slice_idx + 1] 38041 ); 38042 } 38043 #if defined(BM_KATANA_SUPPORT) 38044 if (SOC_IS_KATANA(unit)) { 38045 hw_sels.sec_slice[1].src_entity_sel 38046 = soc_reg_field_get(unit, 38047 VFP_KEY_CONTROL_2r, 38048 vfp_key2, 38049 _trx_vfp_src_type_sel[slice_idx + 1] 38050 ); 38051 } 38052 #endif 38053 #if defined (BCM_KATANA2_SUPPORT) 38054 if (SOC_IS_KATANA2(unit)) { 38055 hw_sels.sec_slice[1].src_entity_sel 38056 = soc_reg_field_get(unit, 38057 VFP_KEY_CONTROL_1r, 38058 vfp_key_1, 38059 _trx_vfp_src_type_sel[slice_idx + 1] 38060 ); 38061 } 38062 #endif 38063 } 38064 } 38065 /* Create a group based on HW qualifiers (or find existing) */ 38066 rv = _field_tr2_group_construct(unit, _FP_DEF_INST, &hw_sels, intraslice, 38067 paired, fc, -1, 38068 _BCM_FIELD_STAGE_LOOKUP, 38069 slice_idx 38070 ); 38071 if (BCM_FAILURE(rv)) { 38072 goto cleanup; 38073 } 38074 /* Now go over the entries */ 38075 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 38076 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 38077 fs->free_count >>= 1; 38078 ratio = 2; 38079 } else { 38080 ratio = 1; 38081 } 38082 prev_prio = -1; 38083 for (idx = 0; idx < slice_ent_cnt / ratio; idx++) { 38084 group_found = 0; 38085 vfp_tcam_entry = soc_mem_table_idx_to_pointer 38086 (unit, VFP_TCAMm, vfp_tcam_entry_t *, 38087 vfp_tcam_buf, idx + 38088 slice_ent_cnt * slice_idx); 38089 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, 38090 VALIDf) == 0) { 38091 continue; 38092 } 38093 /* All ports are applicable to this entry */ 38094 SOC_PBMP_ASSIGN(entry_pbmp, PBMP_PORT_ALL(unit)); 38095 SOC_PBMP_OR(entry_pbmp, PBMP_CMIC(unit)); 38096 #if defined(BCM_KATANA2_SUPPORT) 38097 if (soc_feature(unit, soc_feature_linkphy_coe) || 38098 soc_feature(unit, soc_feature_subtag_coe)) { 38099 _bcm_kt2_subport_pbmp_update(unit, &entry_pbmp); 38100 } 38101 #endif 38102 /* Search groups to find match */ 38103 fg = fc->groups; 38104 while (fg != NULL) { 38105 /* Check if group is in this slice */ 38106 fs = &fg->slices[0]; 38107 if (fs->slice_number != slice_idx) { 38108 fg = fg->next; 38109 continue; 38110 } 38111 /* Check if entry_pbmp is a subset of group pbmp */ 38112 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp); 38113 SOC_PBMP_AND(temp_pbmp, entry_pbmp); 38114 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) { 38115 group_found = 1; 38116 break; 38117 } 38118 fg = fg->next; 38119 } 38120 if (!group_found) { 38121 return BCM_E_INTERNAL; /* Should never happen */ 38122 } 38123 /* Allocate memory for the entry */ 38124 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 38125 fg->flags, &parts_count); 38126 if (BCM_FAILURE(rv)) { 38127 goto cleanup; 38128 } 38129 mem_sz = parts_count * sizeof (_field_entry_t); 38130 _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry"); 38131 if (f_ent == NULL) { 38132 rv = BCM_E_MEMORY; 38133 goto cleanup; 38134 } 38135 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 38136 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 38137 } 38138 38139 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 38140 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 38141 if (fc->l2warm) { 38142 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 38143 action_bmp.w = NULL; 38144 _FP_XGS3_ALLOC(action_bmp.w, 38145 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 38146 "Action No Param Bitmap"); 38147 if (action_bmp.w == NULL) { 38148 rv = BCM_E_MEMORY; 38149 sal_free(f_ent); 38150 goto cleanup; 38151 } 38152 } 38153 f_ent_wb_info.action_bmp = &action_bmp; 38154 38155 rv = _field_trx_entry_info_retrieve(unit, 38156 fc, 38157 stage_fc, 38158 multigroup, 38159 &prev_prio, 38160 &f_ent_wb_info 38161 ); 38162 38163 if (BCM_FAILURE(rv)) { 38164 sal_free(f_ent); 38165 goto cleanup; 38166 } 38167 } else { 38168 _bcm_field_last_alloc_eid_incr(unit); 38169 } 38170 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 38171 slice_idx, stage_fc); 38172 if (vslice_idx < 0) { 38173 rv = BCM_E_INTERNAL; 38174 goto cleanup; 38175 } 38176 38177 pri_tcam_idx = idx + slice_ent_cnt * slice_idx; 38178 for (i = 0; i < parts_count; i++) { 38179 if (fc->l2warm) { 38180 /* Use retrieved EID */ 38181 f_ent[i].eid = f_ent_wb_info.eid; 38182 /* Set retrieved dvp_type and svp_type */ 38183 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 38184 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 38185 f_ent[i].prio = f_ent_wb_info.prio; 38186 } else { 38187 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 38188 f_ent[i].prio = (vslice_idx << 10) | (slice_ent_cnt - idx); 38189 } 38190 f_ent[i].group = fg; 38191 rv = _bcm_field_tcam_part_to_entry_flags(unit, i, fg, 38192 &f_ent[i].flags); 38193 if (BCM_FAILURE(rv)) { 38194 sal_free(f_ent); 38195 goto cleanup; 38196 } 38197 if (f_ent_wb_info.color_independent) { 38198 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 38199 } 38200 rv = _bcm_field_entry_part_tcam_idx_get(unit, f_ent, 38201 pri_tcam_idx, 38202 i, &part_index); 38203 if (BCM_FAILURE(rv)) { 38204 sal_free(f_ent); 38205 goto cleanup; 38206 } 38207 rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc, 38208 _FP_DEF_INST, 38209 part_index, 38210 &slice_number, 38211 (int *)&f_ent[i].slice_idx); 38212 if (BCM_FAILURE(rv)) { 38213 sal_free(f_ent); 38214 goto cleanup; 38215 } 38216 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 38217 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 38218 /* Decrement slice free entry count for primary 38219 entries. */ 38220 f_ent[i].fs->free_count--; 38221 } 38222 /* Assign entry to a slice */ 38223 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 38224 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp); 38225 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 38226 38227 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, VALIDf) == 3) { 38228 f_ent[i].flags |= _FP_ENTRY_ENABLED; 38229 } 38230 38231 /* Get the actions associated with this part of the entry */ 38232 vfp_policy_entry = soc_mem_table_idx_to_pointer 38233 (unit, VFP_POLICY_TABLEm, 38234 vfp_policy_table_entry_t *, 38235 vfp_policy_buf, part_index); 38236 rv = _field_tr2_actions_recover(unit, 38237 VFP_POLICY_TABLEm, 38238 (uint32 *) vfp_policy_entry, 38239 f_ent, 38240 i, 38241 &f_ent_wb_info); 38242 if (BCM_FAILURE(rv)) { 38243 sal_free(f_ent); 38244 goto cleanup; 38245 } 38246 if (action_bmp.w != NULL) { 38247 _FP_ACTION_BMP_FREE(action_bmp); 38248 action_bmp.w = NULL; 38249 } 38250 #if defined(BCM_KATANA_SUPPORT) 38251 if (SOC_IS_KATANAX(unit)) { 38252 if ((flex_info[unit].valid == 1) && (flex_info[unit].flex_mode != 0)) { 38253 BCM_IF_ERROR_RETURN(_bcm_field_stat_get( 38254 unit, f_ent->statistic.sid, &f_st)); 38255 f_st->flex_mode = flex_info[unit].flex_mode; 38256 f_st->hw_flags = flex_info[unit].hw_flags; 38257 _bcm_esw_stat_get_counter_id_info(unit, f_st->flex_mode, 38258 &stat_mode, 38259 &stat_obj, 38260 (uint32 *)&offset_mode, 38261 &pool_num, 38262 &base_index 38263 ); 38264 f_st->hw_index = base_index; 38265 f_st->pool_index = pool_num; 38266 f_st->hw_mode = stat_mode; /* Shouldn't be offset_mode*/ 38267 f_st->hw_entry_count = 1; /* PlsNote:For SingleMode=1 */ 38268 /* Currently OnlySingleMode is supportes so above OK */ 38269 /* else decision will be based on stat_mode 38270 Probably one helper function will be required */ 38271 } 38272 flex_info[unit].valid=0; 38273 } 38274 #endif 38275 #if defined(BCM_TRIUMPH2_SUPPORT) 38276 if (soc_feature(unit, soc_feature_field_vfp_flex_counter)) { 38277 _field_vfp_flex_stat_info_retrieve(unit, f_ent->statistic.sid); 38278 } 38279 #endif 38280 #if defined(BCM_HURRICANE3_SUPPORT) 38281 if (soc_feature(unit, soc_feature_flowcnt)) { 38282 rv = _field_flowcnt_stat_info_retrieve(unit, 38283 f_ent->statistic.sid); 38284 if (BCM_FAILURE(rv)) { 38285 sal_free(f_ent); 38286 goto cleanup; 38287 } 38288 } 38289 38290 #endif /* BCM_HURRICANE3_SUPPORT */ 38291 38292 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_GLOBAL_METER_SUPPORT) 38293 if (soc_feature(unit, soc_feature_global_meter) || 38294 SOC_IS_KATANAX(unit)) { 38295 policer_index = PolicyGet(unit, 38296 VFP_POLICY_TABLEm, 38297 vfp_policy_entry, 38298 SVC_METER_INDEXf); 38299 offset_mode = PolicyGet(unit, 38300 VFP_POLICY_TABLEm, 38301 vfp_policy_entry, 38302 SVC_METER_OFFSET_MODEf); 38303 rv = _bcm_esw_get_policer_id_from_index_offset(unit, 38304 policer_index, offset_mode, 38305 &(f_ent->global_meter_policer.pid)); 38306 if (BCM_FAILURE(rv)) { 38307 sal_free(f_ent); 38308 goto cleanup; 38309 } 38310 if (SOC_IS_KATANAX(unit)) { 38311 f_ent->global_meter_policer.flags = 38312 PolicyGet(unit, VFP_POLICY_TABLEm, 38313 vfp_policy_entry, 38314 SVC_METER_INDEX_PRIORITYf); 38315 } 38316 } 38317 #endif /* BCM_KATANA_SUPPORT || BCM_GLOBAL_METER_SUPPORT */ 38318 38319 } 38320 rv = _field_group_entry_add(unit, fg, f_ent); 38321 if (BCM_FAILURE(rv)) { 38322 sal_free(f_ent); 38323 goto cleanup; 38324 } 38325 f_ent = NULL; 38326 } 38327 /* Free up the temporary slice group info */ 38328 if (fc->l2warm) { 38329 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) { 38330 /* update selcode and construct group qual offset */ 38331 rv = _field_tr2_group_construct_quals_with_sel_update(unit, fc, stage_fc); 38332 if (BCM_FAILURE(rv)) { 38333 goto cleanup; 38334 } 38335 } 38336 _field_scache_slice_group_free(unit, 38337 fc, 38338 slice_idx 38339 ); 38340 } 38341 } 38342 38343 /* Now go over the expanded slices */ 38344 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 38345 if (!expanded[slice_idx]) { 38346 continue; 38347 } 38348 /* Ignore secondary slice in paired mode */ 38349 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 38350 paired = soc_reg_field_get(unit, VFP_KEY_CONTROLr, vfp_key, fld); 38351 if (paired && (slice_idx % 2)) { 38352 continue; 38353 } 38354 /* Skip if slice has no valid groups and entries */ 38355 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 38356 for (idx = 0; idx < slice_ent_cnt; idx++) { 38357 vfp_tcam_entry = soc_mem_table_idx_to_pointer 38358 (unit, VFP_TCAMm, vfp_tcam_entry_t *, 38359 vfp_tcam_buf, idx + 38360 slice_ent_cnt * slice_idx); 38361 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, 38362 VALIDf) != 0) { 38363 break; 38364 } 38365 } 38366 38367 if (idx == slice_ent_cnt) { 38368 continue; 38369 } 38370 38371 /* If Level 2, retrieve the GIDs in this slice */ 38372 if (fc->l2warm) { 38373 rv = _field_trx_scache_slice_group_recover(unit, 38374 fc, _FP_DEF_INST, 38375 slice_idx, 38376 &multigroup, 38377 stage_fc, 38378 0); 38379 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 38380 fc->l2warm = 0; 38381 goto cleanup; 38382 } 38383 if (rv == BCM_E_NOT_FOUND) { 38384 rv = BCM_E_NONE; 38385 continue; 38386 } 38387 } 38388 38389 /* Now find the master slice for this virtual group */ 38390 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 38391 slice_idx, stage_fc); 38392 if (vslice_idx < 0) { 38393 rv = BCM_E_INTERNAL; 38394 goto cleanup; 38395 } 38396 38397 if (fc->l2warm 38398 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8)) { 38399 master_slice = slice_master_idx[slice_idx]; 38400 } else { 38401 max = -1; 38402 for (i = 0; i < stage_fc->tcam_slices; i++) { 38403 if ((stage_fc->vmap[_FP_DEF_INST][0][vslice_idx].virtual_group == 38404 stage_fc->vmap[_FP_DEF_INST][0][i].virtual_group) && (i != vslice_idx)) { 38405 if (i > max) { 38406 max = i; 38407 } 38408 } 38409 } 38410 if (max < 0) { 38411 rv = BCM_E_INTERNAL; 38412 38413 goto cleanup; 38414 } 38415 38416 master_slice = stage_fc->vmap[_FP_DEF_INST][0][max].vmap_key; 38417 } 38418 /* See which group is in this slice - can be only one */ 38419 fg = fc->groups; 38420 while (fg != NULL) { 38421 /* Check if group is in this slice */ 38422 fs = &fg->slices[0]; 38423 if ((fg->stage_id == stage_fc->stage_id) 38424 && (fs->slice_number == master_slice)) { 38425 break; 38426 } 38427 fg = fg->next; 38428 } 38429 if (fg == NULL) { 38430 rv = BCM_E_INTERNAL; 38431 38432 goto cleanup; 38433 } 38434 38435 /* Get number of entry parts for the group. */ 38436 rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id, 38437 fg->flags, &parts_count); 38438 BCM_IF_ERROR_RETURN(rv); 38439 38440 old_physical_slice = fs->slice_number; 38441 38442 /* Set up the new physical slice parameters in Software */ 38443 for(part_index = parts_count - 1; part_index >= 0; part_index--) { 38444 /* Get entry flags. */ 38445 rv = _bcm_field_tcam_part_to_entry_flags(unit, part_index, fg, &entry_flags); 38446 BCM_IF_ERROR_RETURN(rv); 38447 38448 /* Get slice id for entry part */ 38449 rv = _bcm_field_tcam_part_to_slice_number(unit, part_index, 38450 fg, &slice_num); 38451 BCM_IF_ERROR_RETURN(rv); 38452 38453 /* Get slice pointer. */ 38454 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx 38455 + slice_num; 38456 38457 if (0 == (entry_flags & _FP_ENTRY_SECOND_HALF)) { 38458 /* Set per slice configuration & number of free entries in the slice.*/ 38459 fs->free_count = fs->entry_count; 38460 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 38461 fs->free_count >>= 1; 38462 } 38463 /* Set group flags in in slice.*/ 38464 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 38465 38466 /* Add slice to slices linked list . */ 38467 fs_temp = stage_fc->slices[_FP_DEF_INST] + old_physical_slice + slice_num; 38468 /* To handle more than one auto expanded slice in a group */ 38469 while (fs_temp->next != NULL) { 38470 fs_temp = fs_temp->next; 38471 } 38472 fs_temp->next = fs; 38473 fs->prev = fs_temp; 38474 } 38475 } 38476 38477 /* Now go over the entries */ 38478 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 38479 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 38480 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 38481 ratio = 2; 38482 } else { 38483 ratio = 1; 38484 } 38485 38486 prev_prio = -1; 38487 for (idx = 0; idx < slice_ent_cnt / ratio; idx++) { 38488 group_found = 0; 38489 vfp_tcam_entry = soc_mem_table_idx_to_pointer 38490 (unit, VFP_TCAMm, vfp_tcam_entry_t *, 38491 vfp_tcam_buf, idx + 38492 slice_ent_cnt * slice_idx); 38493 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, 38494 VALIDf) == 0) { 38495 continue; 38496 } 38497 38498 /* All ports are applicable to this entry */ 38499 SOC_PBMP_ASSIGN(entry_pbmp, PBMP_PORT_ALL(unit)); 38500 SOC_PBMP_OR(entry_pbmp, PBMP_CMIC(unit)); 38501 #if defined(BCM_KATANA2_SUPPORT) 38502 if (soc_feature(unit, soc_feature_linkphy_coe) || 38503 soc_feature(unit, soc_feature_subtag_coe)) { 38504 _bcm_kt2_subport_pbmp_update(unit, &entry_pbmp); 38505 } 38506 #endif 38507 /* Search groups to find match */ 38508 fg = fc->groups; 38509 while (fg != NULL) { 38510 /* Check if group is in this slice */ 38511 fs = &fg->slices[0]; 38512 if ((fg->stage_id != stage_fc->stage_id) 38513 || (fs->slice_number != master_slice)) { 38514 fg = fg->next; 38515 continue; 38516 } 38517 /* Check if entry_pbmp is a subset of group pbmp */ 38518 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp); 38519 SOC_PBMP_AND(temp_pbmp, entry_pbmp); 38520 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) { 38521 group_found = 1; 38522 break; 38523 } 38524 fg = fg->next; 38525 } 38526 if (!group_found) { 38527 return BCM_E_INTERNAL; /* Should never happen */ 38528 } 38529 /* Allocate memory for the entry */ 38530 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 38531 fg->flags, &parts_count); 38532 if (BCM_FAILURE(rv)) { 38533 goto cleanup; 38534 } 38535 mem_sz = parts_count * sizeof (_field_entry_t); 38536 _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry"); 38537 if (f_ent == NULL) { 38538 rv = BCM_E_MEMORY; 38539 goto cleanup; 38540 } 38541 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 38542 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 38543 } 38544 38545 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 38546 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 38547 if (fc->l2warm) { 38548 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 38549 action_bmp.w = NULL; 38550 _FP_XGS3_ALLOC(action_bmp.w, 38551 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 38552 "Action No Param Bitmap"); 38553 if (action_bmp.w == NULL) { 38554 rv = BCM_E_MEMORY; 38555 sal_free(f_ent); 38556 goto cleanup; 38557 } 38558 } 38559 f_ent_wb_info.action_bmp = &action_bmp; 38560 rv = _field_trx_entry_info_retrieve(unit, 38561 fc, 38562 stage_fc, 38563 multigroup, 38564 &prev_prio, 38565 &f_ent_wb_info 38566 ); 38567 38568 if (BCM_FAILURE(rv)) { 38569 sal_free(f_ent); 38570 goto cleanup; 38571 } 38572 } else { 38573 _bcm_field_last_alloc_eid_incr(unit); 38574 } 38575 pri_tcam_idx = idx + slice_ent_cnt * slice_idx; 38576 for (i = 0; i < parts_count; i++) { 38577 if (fc->l2warm) { 38578 /* Use retrieved EID */ 38579 f_ent[i].eid = f_ent_wb_info.eid; 38580 /* Set retrieved dvp_type and svp_type */ 38581 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 38582 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 38583 f_ent[i].prio = f_ent_wb_info.prio; 38584 } else { 38585 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 38586 f_ent[i].prio = (vslice_idx << 10) | (slice_ent_cnt - idx); 38587 } 38588 f_ent[i].group = fg; 38589 rv = _bcm_field_tcam_part_to_entry_flags(unit, i, fg, 38590 &f_ent[i].flags); 38591 if (BCM_FAILURE(rv)) { 38592 sal_free(f_ent); 38593 goto cleanup; 38594 } 38595 if (f_ent_wb_info.color_independent) { 38596 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 38597 } 38598 rv = _bcm_field_entry_part_tcam_idx_get(unit, f_ent, 38599 pri_tcam_idx, 38600 i, &part_index); 38601 if (BCM_FAILURE(rv)) { 38602 sal_free(f_ent); 38603 goto cleanup; 38604 } 38605 rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc, 38606 _FP_DEF_INST, 38607 part_index, 38608 &slice_number, 38609 (int *)&f_ent[i].slice_idx); 38610 if (BCM_FAILURE(rv)) { 38611 sal_free(f_ent); 38612 goto cleanup; 38613 } 38614 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 38615 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 38616 /* Decrement slice free entry count for primary 38617 entries. */ 38618 f_ent[i].fs->free_count--; 38619 } 38620 /* Assign entry to a slice */ 38621 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 38622 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp); 38623 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 38624 38625 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, VALIDf) == 3) { 38626 f_ent[i].flags |= _FP_ENTRY_ENABLED; 38627 } 38628 38629 /* Get the actions associated with this part of the entry */ 38630 vfp_policy_entry = soc_mem_table_idx_to_pointer 38631 (unit, VFP_POLICY_TABLEm, 38632 vfp_policy_table_entry_t *, 38633 vfp_policy_buf, part_index); 38634 rv = _field_tr2_actions_recover(unit, 38635 VFP_POLICY_TABLEm, 38636 (uint32 *) vfp_policy_entry, 38637 f_ent, 38638 i, 38639 &f_ent_wb_info); 38640 if (BCM_FAILURE(rv)) { 38641 sal_free(f_ent); 38642 goto cleanup; 38643 } 38644 if (action_bmp.w != NULL) { 38645 _FP_ACTION_BMP_FREE(action_bmp); 38646 action_bmp.w = NULL; 38647 } 38648 #if defined(BCM_KATANA_SUPPORT) 38649 if (SOC_IS_KATANAX(unit)) { 38650 if ((flex_info[unit].valid == 1) && (flex_info[unit].flex_mode != 0)) { 38651 BCM_IF_ERROR_RETURN(_bcm_field_stat_get( 38652 unit, f_ent->statistic.sid, &f_st)); 38653 f_st->flex_mode = flex_info[unit].flex_mode; 38654 f_st->hw_flags = flex_info[unit].hw_flags; 38655 _bcm_esw_stat_get_counter_id_info(unit, f_st->flex_mode, 38656 &stat_mode, 38657 &stat_obj, 38658 (uint32 *)&offset_mode, 38659 &pool_num, 38660 &base_index 38661 ); 38662 f_st->hw_index = base_index; 38663 f_st->pool_index = pool_num; 38664 f_st->hw_mode = stat_mode; /* Shouldn't be offset_mode*/ 38665 f_st->hw_entry_count = 1; /* PlsNote:For SingleMode=1 */ 38666 /* Currently OnlySingleMode is supportes so above OK */ 38667 /* else decision will be based on stat_mode 38668 Probably one helper function will be required */ 38669 } 38670 flex_info[unit].valid=0; 38671 } 38672 #endif 38673 #if defined(BCM_TRIUMPH2_SUPPORT) 38674 if (soc_feature(unit, soc_feature_field_vfp_flex_counter)) { 38675 _field_vfp_flex_stat_info_retrieve(unit, f_ent->statistic.sid); 38676 } 38677 #endif 38678 #if defined(BCM_HURRICANE3_SUPPORT) 38679 if (soc_feature(unit, soc_feature_flowcnt)) { 38680 rv = _field_flowcnt_stat_info_retrieve(unit, 38681 f_ent->statistic.sid); 38682 if (BCM_FAILURE(rv)) { 38683 sal_free(f_ent); 38684 goto cleanup; 38685 } 38686 } 38687 #endif /* BCM_HURRICANE3_SUPPORT */ 38688 38689 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_GLOBAL_METER_SUPPORT) 38690 /* Retrieving meter flags. */ 38691 if (soc_feature(unit, soc_feature_global_meter) || 38692 SOC_IS_KATANAX(unit)) { 38693 policer_index = PolicyGet(unit, 38694 VFP_POLICY_TABLEm, 38695 vfp_policy_entry, 38696 SVC_METER_INDEXf); 38697 offset_mode = PolicyGet(unit, 38698 VFP_POLICY_TABLEm, 38699 vfp_policy_entry, 38700 SVC_METER_OFFSET_MODEf); 38701 rv = _bcm_esw_get_policer_id_from_index_offset(unit, 38702 policer_index, offset_mode, 38703 &(f_ent->global_meter_policer.pid)); 38704 if (BCM_FAILURE(rv)) { 38705 sal_free(f_ent); 38706 goto cleanup; 38707 } 38708 if (SOC_IS_KATANAX(unit)) { 38709 f_ent->global_meter_policer.flags = 38710 PolicyGet(unit, VFP_POLICY_TABLEm, 38711 vfp_policy_entry, 38712 SVC_METER_INDEX_PRIORITYf); 38713 } 38714 } 38715 #endif /* BCM_KATANA_SUPPORT || BCM_GLOBAL_METER_SUPPORT */ 38716 } 38717 rv = _field_group_entry_add(unit, fg, f_ent); 38718 if (BCM_FAILURE(rv)) { 38719 sal_free(f_ent); 38720 goto cleanup; 38721 } 38722 f_ent = NULL; 38723 } 38724 /* Free up the temporary slice group info */ 38725 if (fc->l2warm) { 38726 _field_scache_slice_group_free(unit, 38727 fc, 38728 slice_idx 38729 ); 38730 } 38731 } 38732 38733 if (fc->l2warm) { 38734 38735 /* Mark end of Slice Info */ 38736 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 38737 fc->scache_pos++; 38738 } 38739 38740 if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) { 38741 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 38742 if (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP) { 38743 LOG_DEBUG(BSL_LS_BCM_FP, 38744 (BSL_META_U(unit,"Recovering hint Ids " 38745 "from pos = %d\r\n"), fc->scache_pos)); 38746 BCM_IF_ERROR_RETURN (_bcm_hints_scache_hintid_recover(unit, stage_fc, 38747 fc, &buf[fc->scache_pos])); 38748 } 38749 } 38750 } 38751 38752 /* Group Slice Selectors */ 38753 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 38754 rv = (_field_group_slice_selectors_recover(unit, 38755 &buf[fc->scache_pos], stage_fc->stage_id)); 38756 if (BCM_FAILURE(rv)) { 38757 goto cleanup; 38758 } 38759 } 38760 38761 temp = 0; 38762 temp |= buf[fc->scache_pos]; 38763 fc->scache_pos++; 38764 temp |= buf[fc->scache_pos] << 8; 38765 fc->scache_pos++; 38766 temp |= buf[fc->scache_pos] << 16; 38767 fc->scache_pos++; 38768 temp |= buf[fc->scache_pos] << 24; 38769 fc->scache_pos++; 38770 if (temp != _FIELD_VFP_DATA_END) { 38771 fc->l2warm = 0; 38772 rv = BCM_E_INTERNAL; 38773 } 38774 if (NULL != buf1) { 38775 temp = 0; 38776 temp |= buf1[fc->scache_pos1]; 38777 fc->scache_pos1++; 38778 temp |= buf1[fc->scache_pos1] << 8; 38779 fc->scache_pos1++; 38780 temp |= buf1[fc->scache_pos1] << 16; 38781 fc->scache_pos1++; 38782 temp |= buf1[fc->scache_pos1] << 24; 38783 fc->scache_pos1++; 38784 if (temp != _FIELD_VFP_DATA_END) { 38785 fc->l2warm = 0; 38786 rv = BCM_E_INTERNAL; 38787 } 38788 } 38789 38790 } 38791 38792 if (BCM_SUCCESS(rv)) { 38793 _field_group_slice_vmap_recovery(unit, fc, stage_fc); 38794 } 38795 38796 _field_tr2_stage_reinit_all_groups_cleanup(unit, fc, 38797 _BCM_FIELD_STAGE_LOOKUP, 38798 NULL); 38799 38800 cleanup: 38801 38802 if (vfp_tcam_buf) { 38803 soc_cm_sfree(unit, vfp_tcam_buf); 38804 } 38805 if (vfp_policy_buf) { 38806 soc_cm_sfree(unit, vfp_policy_buf); 38807 } 38808 if (action_bmp.w != NULL) { 38809 _FP_ACTION_BMP_FREE(action_bmp); 38810 action_bmp.w = NULL; 38811 } 38812 return rv; 38813 } 38814 38815 #if 0 38816 /* Returns: 1 if any bit of buf is set between offset->offset and 38817 * offset->offset + offset->width 38818 * 0 otherwise 38819 */ 38820 STATIC int 38821 _ext_mask_is_set(int unit, 38822 _bcm_field_qual_offset_t *offset, 38823 soc_mem_t mem, 38824 uint32 *buf 38825 ) 38826 38827 { 38828 soc_mem_info_t *meminfo = &SOC_MEM_INFO(unit, mem); 38829 int len = offset->width, bp = offset->offset; 38830 uint32 temp; 38831 38832 switch (mem) { 38833 case EXT_ACL144_TCAM_L2m: 38834 case EXT_ACL144_TCAM_IPV4m: 38835 case EXT_ACL144_TCAM_IPV6m: 38836 bp += 144; 38837 break; 38838 38839 case EXT_ACL288_TCAM_L2m: 38840 case EXT_ACL288_TCAM_IPV4m: 38841 bp += 288; 38842 break; 38843 38844 default: 38845 ; 38846 } 38847 38848 #define FIX_MEM_ORDER_E(v,m) (((m)->flags & SOC_MEM_FLAG_BE) ? \ 38849 BYTES2WORDS((m)->bytes)-1-(v) : \ 38850 (v)) 38851 while (len > 0) { 38852 temp = 0; 38853 do { 38854 /* coverity [forward_null] */ 38855 temp = 38856 (temp << 1) | 38857 ((buf[FIX_MEM_ORDER_E(bp / 32, meminfo)] >> 38858 (bp & (32 - 1))) & 1); 38859 if (temp > 0) { 38860 return TRUE; 38861 } 38862 len--; 38863 bp++; 38864 } while (len & (32 - 1)); 38865 } 38866 return FALSE; 38867 } 38868 #endif 38869 38870 /*************************************************************************** 38871 * 38872 * Support for use of external memory as scache 38873 */ 38874 38875 #define FIELD_SIZE(t, f) (sizeof(((t *) 0)->f)) 38876 38877 STATIC void 38878 _field_tr2_ext_part_mems(int unit, unsigned part_idx, soc_mem_t *mems) 38879 { 38880 /* mems[0] = policy mem 38881 mems[1] = data mem or data-and-mask mem 38882 mems[2] = mask mem or INVALIDm 38883 */ 38884 38885 mems[0] = _bcm_field_ext_policy_mems[part_idx]; 38886 if ((mems[1] = _bcm_field_ext_data_mask_mems[part_idx]) == 0) { 38887 mems[1] = _bcm_field_ext_data_mems[part_idx]; 38888 mems[2] = _bcm_field_ext_mask_mems[part_idx]; 38889 } else { 38890 mems[2] = INVALIDm; 38891 } 38892 } 38893 38894 38895 STATIC unsigned 38896 _field_tr2_ext_scache_usable_bytes_per_word(int unit, 38897 soc_mem_t *mems, 38898 unsigned mem_idx 38899 ) 38900 { 38901 switch (mem_idx) { 38902 case 0: /* policy mem */ 38903 return (SOC_MEM_BYTES(unit, mems[0]) - 3); 38904 case 1: /* data+mask or data mem */ 38905 return (soc_mem_field_length(unit, mems[1], DATAf) >> 3); 38906 default: 38907 ; 38908 } 38909 38910 return (0); 38911 } 38912 38913 38914 STATIC uint32 38915 _field_tr2_ext_scache_size_prop_get(int unit, unsigned part_idx) 38916 { 38917 static const char * const scache_size_props[] = { 38918 spn_EXT_L2C_ACL_TABLE_SCACHE_SIZE, 38919 spn_EXT_L2_ACL_TABLE_SCACHE_SIZE, 38920 spn_EXT_IP4C_ACL_TABLE_SCACHE_SIZE, 38921 spn_EXT_IP4_ACL_TABLE_SCACHE_SIZE, 38922 spn_EXT_L2IP4_ACL_TABLE_SCACHE_SIZE, 38923 spn_EXT_IP6C_ACL_TABLE_SCACHE_SIZE, 38924 spn_EXT_IP6S_ACL_TABLE_SCACHE_SIZE, 38925 spn_EXT_IP6F_ACL_TABLE_SCACHE_SIZE, 38926 spn_EXT_L2IP6_ACL_TABLE_SCACHE_SIZE 38927 }; 38928 38929 return (soc_property_get(unit, scache_size_props[part_idx], 0xffffffff)); 38930 } 38931 38932 38933 unsigned 38934 _field_trx_ext_scache_size(int unit, 38935 unsigned part_idx, 38936 soc_mem_t *mems 38937 ) 38938 { 38939 uint32 sz; 38940 38941 if ((sz = _field_tr2_ext_scache_size_prop_get(unit, part_idx)) == 0xffffffff) { 38942 /* Scache size not specified => Don't reserve any entries */ 38943 38944 return (0); 38945 } 38946 38947 if (sz == 0) { 38948 /* Scache size specified as 0 38949 => Calculate space needed to store all entries */ 38950 38951 /* Calculate usable bytes (i.e. width) of an entry in TCAM and policy memory 38952 * - Consider both data and mask mems, as appicable 38953 * - Last byte in a data or mask entry might be a partial byte (i.e. less 38954 * than 8 bits), so don't include it 38955 */ 38956 38957 unsigned i, w, f, n, T; 38958 38959 for (w = 0, i = 0; i < 2; ++i) { 38960 w += _field_tr2_ext_scache_usable_bytes_per_word(unit, mems, i); 38961 } 38962 38963 /* Let 38964 T = total number of entries in slice 38965 S = number of entries reserved for scache 38966 E = number of usable entries 38967 38968 Thus, E + S = T 38969 38970 Let 38971 f = Fixed scache storage required, in bytes 38972 n = Number of bytes of scache storage per entry 38973 w = Width of an scache word, in bytes 38974 38975 So, S = ceiling((f + nE) / w) 38976 38977 Therefore, (f + nE) <= wS <= (f + nE + w - 1) 38978 [aobve as inequalify, all values are whole numbers] 38979 38980 But, E = T - S [from above] 38981 38982 So, (f + nT) <= (n + w)S <= (f + nT + w - 1) 38983 38984 Therefore, S = floor((f + nT + w - 1) / (n + w)) 38985 */ 38986 38987 f = 38988 /* header */ 38989 4 38990 /* group-present flag */ 38991 + 1 38992 /* group id */ 38993 + FIELD_SIZE(_field_group_t, gid) 38994 /* group priority */ 38995 + FIELD_SIZE(_field_group_t, priority) 38996 /* group qset (a guess at a reasonable upper limit) */ 38997 + 20 38998 /* trailer */ 38999 + 4; 39000 n = 39001 /* entry id */ 39002 FIELD_SIZE(_field_entry_t, eid) 39003 /* priority/stat/policer flags */ 39004 + 1 39005 /* entry priority */ 39006 + FIELD_SIZE(_field_entry_t, prio) 39007 /* stat id */ 39008 + FIELD_SIZE(_field_entry_t, statistic.sid) 39009 /* policer id */ 39010 + FIELD_SIZE(_field_entry_t, policer[0].pid); 39011 T = soc_mem_index_count(unit, mems[0]); 39012 39013 return((f + n * T + w - 1) / (n + w)); 39014 } 39015 39016 /* Otherwise, use specified value */ 39017 39018 return (sz); 39019 } 39020 39021 39022 int 39023 _bcm_esw_field_tr2_ext_scache_size(int unit, 39024 unsigned part_idx 39025 ) 39026 { 39027 soc_mem_t mems[3]; 39028 39029 _field_tr2_ext_part_mems(unit, part_idx, mems); 39030 return (_field_trx_ext_scache_size(unit, part_idx, mems)); 39031 } 39032 39033 39034 struct _field_tr2_ext_scache_rw { 39035 int unit; 39036 _field_control_t *fc; 39037 soc_mem_t mems[3]; 39038 unsigned scache_nwords, scache_idx_min, scache_idx_max; 39039 struct _field_tr2_scache_mem_info { 39040 uint32 bytes_per_word; 39041 uint32 *buf; 39042 } mem_info[3]; 39043 struct _field_tr2_scache_chunk { 39044 uint8 usable_bytes_per_word; 39045 uint32 *pos, *limit, w; 39046 } chunk[2]; 39047 unsigned cur_chunk_idx; 39048 }; 39049 39050 STATIC int 39051 _field_tr2_ext_scache_init(struct _field_tr2_ext_scache_rw *h, 39052 int unit, 39053 unsigned part_idx 39054 ) 39055 { 39056 struct _field_tr2_scache_chunk *ch; 39057 unsigned n, i; 39058 39059 sal_memset(h, 0, sizeof(*h)); 39060 39061 h->unit = unit; 39062 BCM_IF_ERROR_RETURN(_field_control_get(h->unit, &h->fc)); 39063 _field_tr2_ext_part_mems(unit, part_idx, h->mems); 39064 for (i = 0; i < COUNTOF(h->mems); ++i) { 39065 if (h->mems[i] == INVALIDm) { 39066 break; 39067 } 39068 h->mem_info[i].bytes_per_word 39069 = WORDS2BYTES(SOC_MEM_WORDS(h->unit, h->mems[i])); 39070 } 39071 h->scache_nwords = _field_trx_ext_scache_size(h->unit, 39072 part_idx, 39073 h->mems 39074 ); 39075 if (h->scache_nwords != 0) { 39076 /* Set up for ext mem as scache */ 39077 39078 h->scache_idx_max = soc_mem_index_max(h->unit, h->mems[0]); 39079 h->scache_idx_min = h->scache_idx_max + 1 - h->scache_nwords; 39080 39081 for (i = 0, ch = h->chunk, n = COUNTOF(h->chunk); n; --n, ++ch, ++i) { 39082 ch->usable_bytes_per_word 39083 = _field_tr2_ext_scache_usable_bytes_per_word(h->unit, h->mems, i); 39084 } 39085 } 39086 39087 return (BCM_E_NONE); 39088 } 39089 39090 STATIC void 39091 _field_tr2_ext_scache_release(struct _field_tr2_ext_scache_rw *h) 39092 { 39093 unsigned i; 39094 39095 for (i = 0; i < COUNTOF(h->mem_info); ++i) { 39096 if (h->mem_info[i].buf) { 39097 soc_cm_sfree(h->unit, h->mem_info[i].buf); 39098 39099 h->mem_info[i].buf = 0; 39100 } 39101 } 39102 } 39103 39104 STATIC int 39105 _field_tr2_ext_scache_wr_init(struct _field_tr2_ext_scache_rw *h, 39106 int unit, 39107 unsigned part_idx 39108 ) 39109 { 39110 struct _field_tr2_scache_chunk *ch; 39111 unsigned n, i; 39112 39113 _field_tr2_ext_scache_init(h, unit, part_idx); 39114 39115 if (h->scache_nwords != 0) { 39116 for (ch = h->chunk, i = 0, n = COUNTOF(h->chunk); n; --n, ++i, ++ch) { 39117 unsigned s; 39118 uint32 *buf; 39119 39120 s = h->scache_nwords * h->mem_info[i].bytes_per_word; 39121 if ((buf = soc_cm_salloc(unit, s, "")) == 0) { 39122 _field_tr2_ext_scache_release(h); 39123 return (BCM_E_MEMORY); 39124 } 39125 h->mem_info[i].buf = buf; 39126 39127 ch->pos = buf; 39128 ch->limit = (uint32 *)((uint8 *) buf + s); 39129 } 39130 } 39131 39132 return (BCM_E_NONE); 39133 } 39134 39135 STATIC int 39136 _field_tr2_ext_scache_wr(struct _field_tr2_ext_scache_rw *h, uint8 val) 39137 { 39138 if (h->scache_nwords != 0) { 39139 struct _field_tr2_scache_chunk *ch = &h->chunk[h->cur_chunk_idx]; 39140 unsigned sh; 39141 uint32 *p; 39142 39143 if (ch->pos >= ch->limit) { 39144 if (++h->cur_chunk_idx >= COUNTOF(h->chunk)) { 39145 _field_tr2_ext_scache_release(h); 39146 return (BCM_E_FAIL); 39147 } 39148 ch = &h->chunk[h->cur_chunk_idx]; 39149 } 39150 39151 sh = (ch->w & 3) << 3; 39152 p = &ch->pos[ch->w >> 2]; 39153 *p = (*p & ~(0xff << sh)) | val << sh; 39154 39155 if (++ch->w >= ch->usable_bytes_per_word) { 39156 ch->pos = (uint32 *)((uint8 *) ch->pos 39157 + h->mem_info[h->cur_chunk_idx].bytes_per_word 39158 ); 39159 ch->w = 0; 39160 } 39161 } else { 39162 _field_control_t *fc = h->fc; 39163 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 39164 buf[fc->scache_pos] = val; 39165 ++fc->scache_pos; 39166 } 39167 39168 return (BCM_E_NONE); 39169 } 39170 39171 STATIC int 39172 _field_tr2_ext_scache_wr_uint(struct _field_tr2_ext_scache_rw *h, 39173 uint32 val, 39174 unsigned nbytes 39175 ) 39176 { 39177 return (_field_tr2_ext_scache_wr(h, val) != BCM_E_NONE 39178 || (nbytes > 1 && _field_tr2_ext_scache_wr(h, val >> 8) != BCM_E_NONE) 39179 || (nbytes > 2 && _field_tr2_ext_scache_wr(h, val >> 16) != BCM_E_NONE) 39180 || (nbytes > 2 && _field_tr2_ext_scache_wr(h, val >> 24) != BCM_E_NONE) 39181 ? BCM_E_FAIL : BCM_E_NONE 39182 ); 39183 } 39184 39185 #define _FIELD_TR2_EXT_SCACHE_WR_UINT(h, x) \ 39186 (_field_tr2_ext_scache_wr_uint((h), (x), sizeof(x))) 39187 39188 STATIC int 39189 _field_tr2_ext_scache_wr_commit(struct _field_tr2_ext_scache_rw *h) 39190 { 39191 int result = BCM_E_NONE; 39192 39193 if (h->scache_nwords != 0) { 39194 uint32 m[(432 + 31) >> 5]; 39195 39196 result = soc_mem_write_range(h->unit, 39197 h->mems[0], 39198 MEM_BLOCK_ALL, 39199 h->scache_idx_min, 39200 h->scache_idx_max, 39201 h->mem_info[0].buf 39202 ); 39203 if (result != BCM_E_NONE) { 39204 goto cleanup; 39205 } 39206 39207 sal_memset(m, 0xff, sizeof(m)); 39208 39209 if (h->mems[2] == INVALIDm) { 39210 unsigned n; 39211 uint32 *p; 39212 39213 for (p = h->mem_info[1].buf, n = h->scache_nwords; 39214 n; 39215 --n, p = (uint32 *)((uint8 *) p + h->mem_info[1].bytes_per_word) 39216 ) { 39217 soc_mem_mask_field_set(h->unit, h->mems[1], p, MASKf, m); 39218 } 39219 } else { 39220 uint32 mm[COUNTOF(m)]; 39221 39222 soc_mem_mask_field_set(h->unit, h->mems[2], mm, MASKf, m); 39223 soc_mem_write(h->unit, h->mems[2], MEM_BLOCK_ALL, 0, mm); 39224 } 39225 39226 result = soc_mem_write_range(h->unit, 39227 h->mems[1], 39228 MEM_BLOCK_ALL, 39229 h->scache_idx_min, 39230 h->scache_idx_max, 39231 h->mem_info[1].buf 39232 ); 39233 39234 cleanup: 39235 _field_tr2_ext_scache_release(h); 39236 } 39237 39238 return (result); 39239 } 39240 39241 STATIC int 39242 _field_tr2_ext_scache_rd_init(struct _field_tr2_ext_scache_rw *h, 39243 int unit, 39244 unsigned part_idx 39245 ) 39246 { 39247 int result = BCM_E_NONE; 39248 unsigned i; 39249 39250 _field_tr2_ext_scache_init(h, unit, part_idx); 39251 39252 for (i = 0; i < COUNTOF(h->mem_info); ++i) { 39253 uint32 *buf; 39254 39255 if (h->mems[i] == INVALIDm) { 39256 break; 39257 } 39258 39259 if ((buf = soc_cm_salloc(unit, 39260 soc_mem_index_count(unit, h->mems[0]) 39261 * h->mem_info[i].bytes_per_word, 39262 "" 39263 ) 39264 ) 39265 == 0 39266 ) { 39267 _field_tr2_ext_scache_release(h); 39268 return (BCM_E_MEMORY); 39269 } 39270 39271 h->mem_info[i].buf = buf; 39272 } 39273 39274 result = soc_mem_read_range(h->unit, 39275 h->mems[0], 39276 MEM_BLOCK_ANY, 39277 soc_mem_index_min(h->unit, h->mems[0]), 39278 soc_mem_index_max(h->unit, h->mems[0]), 39279 h->mem_info[0].buf 39280 ); 39281 39282 if (result != BCM_E_NONE) { 39283 goto done; 39284 } 39285 39286 if (h->mems[2] == INVALIDm) { 39287 result = soc_mem_read_range(h->unit, 39288 h->mems[1], 39289 MEM_BLOCK_ANY, 39290 soc_mem_index_min(h->unit, h->mems[1]), 39291 soc_mem_index_max(h->unit, h->mems[1]), 39292 h->mem_info[1].buf 39293 ); 39294 } else { 39295 unsigned n; 39296 uint32 *p1, *p2; 39297 39298 for (p1 = h->mem_info[1].buf, p2 = h->mem_info[2].buf, 39299 i = soc_mem_index_min(h->unit, h->mems[1]), 39300 n = soc_mem_index_count(h->unit, h->mems[1]); 39301 n; 39302 --n, ++i, 39303 p1 = (uint32 *)((uint8 *) p1 + h->mem_info[1].bytes_per_word), 39304 p2 = (uint32 *)((uint8 *) p2 + h->mem_info[2].bytes_per_word) 39305 ) { 39306 if ((result = soc_mem_read(h->unit, 39307 h->mems[1], 39308 MEM_BLOCK_ANY, 39309 i, 39310 p1 39311 ) 39312 ) 39313 != BCM_E_NONE 39314 || (result = soc_mem_read(h->unit, 39315 h->mems[2], 39316 MEM_BLOCK_ANY, 39317 0, 39318 p2 39319 ) 39320 ) 39321 != BCM_E_NONE 39322 ) { 39323 goto done; 39324 } 39325 } 39326 } 39327 39328 if (h->scache_nwords != 0) { 39329 for (i = 0; i < COUNTOF(h->chunk); ++i) { 39330 h->chunk[i].pos = (uint32 *)((uint8 *) h->mem_info[i].buf 39331 + h->scache_idx_min 39332 * h->mem_info[i].bytes_per_word 39333 ); 39334 h->chunk[i].limit = (uint32 *)((uint8 *) h->chunk[i].pos 39335 + h->scache_nwords 39336 * h->mem_info[i].bytes_per_word 39337 ); 39338 } 39339 } 39340 39341 done: 39342 if (result != BCM_E_NONE) { 39343 _field_tr2_ext_scache_release(h); 39344 } 39345 39346 return (result); 39347 } 39348 39349 STATIC int 39350 _field_tr2_ext_scache_rd(struct _field_tr2_ext_scache_rw *h, uint8 *val) 39351 { 39352 if (h->scache_nwords != 0) { 39353 struct _field_tr2_scache_chunk *ch = &h->chunk[h->cur_chunk_idx]; 39354 39355 if (ch->pos >= ch->limit) { 39356 if (++h->cur_chunk_idx >= COUNTOF(h->chunk)) { 39357 _field_tr2_ext_scache_release(h); 39358 return (BCM_E_FAIL); 39359 } 39360 ch = &h->chunk[h->cur_chunk_idx]; 39361 } 39362 39363 *val = ch->pos[ch->w >> 2] >> ((ch->w & 3) << 3); 39364 39365 if (++ch->w >= ch->usable_bytes_per_word) { 39366 ch->pos = (uint32 *)((uint8 *) ch->pos 39367 + h->mem_info[h->cur_chunk_idx].bytes_per_word 39368 ); 39369 ch->w = 0; 39370 } 39371 } else { 39372 _field_control_t *fc = h->fc; 39373 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 39374 *val = buf[fc->scache_pos]; 39375 ++fc->scache_pos; 39376 } 39377 39378 return (BCM_E_NONE); 39379 } 39380 39381 STATIC int 39382 _field_tr2_ext_scache_rd_uint(struct _field_tr2_ext_scache_rw *h, 39383 uint32 *val, 39384 unsigned nbytes 39385 ) 39386 { 39387 uint8 b; 39388 uint32 result; 39389 39390 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd(h, &b)); 39391 result = b; 39392 if (nbytes > 1) { 39393 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd(h, &b)); 39394 result |= b << 8; 39395 } 39396 if (nbytes > 2) { 39397 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd(h, &b)); 39398 result |= b << 16; 39399 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd(h, &b)); 39400 result |= b << 24; 39401 } 39402 39403 *val = result; 39404 39405 return (BCM_E_NONE); 39406 } 39407 39408 #define _FIELD_TR2_EXT_SCACHE_RD_UINT(h, x) \ 39409 (_field_tr2_ext_scache_rd_uint((h), &(x), sizeof(x))) 39410 39411 STATIC uint32 * 39412 _field_tr2_ext_scache_rd_rec_ptr(struct _field_tr2_ext_scache_rw *h, 39413 unsigned mem_idx, 39414 unsigned rec_idx 39415 ) 39416 { 39417 return ((uint32 *)((uint8 *) h->mem_info[mem_idx].buf 39418 + rec_idx * h->mem_info[mem_idx].bytes_per_word 39419 ) 39420 ); 39421 } 39422 39423 39424 STATIC int 39425 _field_tr2_ext_scache_sync_chk(int unit, 39426 _field_control_t *fc, 39427 _field_stage_t *stage_fc 39428 ) 39429 { 39430 unsigned slice_idx; 39431 39432 for (slice_idx = 0; slice_idx < _FP_EXT_NUM_PARTITIONS; ++slice_idx) { 39433 if (_bcm_esw_field_tr2_ext_scache_size(unit, slice_idx) != 0) { 39434 return (TRUE); 39435 } 39436 } 39437 39438 return (FALSE); 39439 } 39440 39441 39442 STATIC int 39443 _field_tr2_ext_scache_sync(int unit, 39444 _field_control_t *fc, 39445 _field_stage_t *stage_fc 39446 ) 39447 { 39448 unsigned slice_idx; 39449 39450 for (slice_idx = 0; slice_idx < _FP_EXT_NUM_PARTITIONS; ++slice_idx) { 39451 _field_slice_t *fs; 39452 _field_group_t *fg; 39453 struct _field_tr2_ext_scache_rw h[1]; 39454 39455 fs = &stage_fc->slices[_FP_DEF_INST][slice_idx]; 39456 39457 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_wr_init(h, unit, slice_idx)); 39458 39459 /* Write start sequence */ 39460 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_wr_uint(h, 39461 _FIELD_EXTFP_DATA_START, 39462 4 39463 ) 39464 ); 39465 39466 /* Find group for partition (slice) */ 39467 for (fg = fc->groups; fg; fg = fg->next) { 39468 if (fg->stage_id == _BCM_FIELD_STAGE_EXTERNAL 39469 && fg->slices->slice_number == slice_idx 39470 ) { 39471 break; 39472 } 39473 } 39474 if (fg == 0) { 39475 /* No group found */ 39476 39477 /* Write group-present flag as FALSE */ 39478 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_wr(h, FALSE)); 39479 } else { 39480 /* Group found */ 39481 39482 unsigned n, q; 39483 _field_entry_t **p, *f_ent; 39484 int prev_pri = 0; 39485 39486 /* Write group-present flag as TRUE */ 39487 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_wr(h, TRUE)); 39488 39489 /* Write group id */ 39490 BCM_IF_ERROR_RETURN(_FIELD_TR2_EXT_SCACHE_WR_UINT(h, fg->gid)); 39491 39492 /* Write group priority */ 39493 BCM_IF_ERROR_RETURN(_FIELD_TR2_EXT_SCACHE_WR_UINT(h, fg->priority)); 39494 39495 /* Write group qset */ 39496 n = 0; 39497 _FIELD_QSET_INCL_INTERNAL_ITER(fg->qset, q) { 39498 ++n; 39499 } 39500 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_wr(h, n)); 39501 _FIELD_QSET_INCL_INTERNAL_ITER(fg->qset, q) { 39502 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_wr(h, q)); 39503 } 39504 39505 /* Write entries */ 39506 for (p = fs->entries, n = fs->entry_count; n; --n, ++p) { 39507 unsigned ent_prif, ent_statf, ent_polf; 39508 39509 if ((f_ent = *p) == 0) { 39510 continue; 39511 } 39512 39513 /* Write entry id */ 39514 BCM_IF_ERROR_RETURN(_FIELD_TR2_EXT_SCACHE_WR_UINT(h, 39515 f_ent->eid 39516 ) 39517 ); 39518 39519 ent_prif = (n == fs->entry_count || f_ent->prio != prev_pri); 39520 ent_statf = (f_ent->statistic.flags & _FP_ENTRY_STAT_INSTALLED) 39521 ? 1 : 0; 39522 ent_polf = (f_ent->policer[0].flags & _FP_POLICER_INSTALLED) 39523 ? 1 : 0; 39524 39525 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_wr( 39526 h, 39527 (ent_prif << 2) 39528 | (ent_statf << 1) 39529 | ent_polf 39530 ) 39531 ); 39532 39533 if (ent_prif) { 39534 /* First entry, or priority differs from previous entry */ 39535 39536 /* Write entry priority */ 39537 BCM_IF_ERROR_RETURN(_FIELD_TR2_EXT_SCACHE_WR_UINT( 39538 h, 39539 f_ent->prio 39540 ) 39541 ); 39542 } 39543 39544 if (ent_statf) { 39545 /* Stat defined for entry */ 39546 39547 /* Write stat id */ 39548 BCM_IF_ERROR_RETURN(_FIELD_TR2_EXT_SCACHE_WR_UINT( 39549 h, 39550 f_ent->statistic.sid 39551 ) 39552 ); 39553 } 39554 39555 if (ent_polf) { 39556 /* Policer defined for entry */ 39557 39558 /* Write policer id */ 39559 BCM_IF_ERROR_RETURN(_FIELD_TR2_EXT_SCACHE_WR_UINT( 39560 h, 39561 f_ent->policer[0].pid 39562 ) 39563 ); 39564 } 39565 39566 prev_pri = f_ent->prio; 39567 } 39568 } 39569 39570 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_wr_uint(h, 39571 _FIELD_EXTFP_DATA_END, 39572 4 39573 ) 39574 ); 39575 39576 _field_tr2_ext_scache_wr_commit(h); 39577 } 39578 39579 return (BCM_E_NONE); 39580 } 39581 39582 39583 STATIC int 39584 _field_tr2_ext_slice_to_pkt_type(_field_slice_t *fs, unsigned *pkt_type) 39585 { 39586 switch (fs->slice_number) { 39587 case _FP_EXT_ACL_144_L2: 39588 case _FP_EXT_ACL_L2: 39589 *pkt_type = _FP_EXT_L2; 39590 break; 39591 case _FP_EXT_ACL_144_IPV4: 39592 case _FP_EXT_ACL_IPV4: 39593 case _FP_EXT_ACL_L2_IPV4: 39594 *pkt_type = _FP_EXT_IP4; 39595 break; 39596 case _FP_EXT_ACL_144_IPV6: 39597 case _FP_EXT_ACL_IPV6_SHORT: 39598 case _FP_EXT_ACL_IPV6_FULL: 39599 case _FP_EXT_ACL_L2_IPV6: 39600 *pkt_type = _FP_EXT_IP6; 39601 break; 39602 default: 39603 return (BCM_E_INTERNAL); 39604 } 39605 39606 return (BCM_E_NONE); 39607 } 39608 39609 39610 STATIC int 39611 _field_tr2_stage_ext_group_construct( 39612 int unit, 39613 _field_control_t *fc, 39614 _field_stage_t *stage_fc, 39615 _field_slice_t *fs, 39616 unsigned pkt_type, 39617 bcm_field_group_t gid, 39618 int pri, 39619 bcm_field_qset_t *qset, 39620 _field_group_t **pfg 39621 ) 39622 { 39623 int result = BCM_E_NONE; 39624 uint8 e_type = _FP_ENTRY_TYPE_DEFAULT; /* Entry type */ 39625 _field_group_t *fg = 0; 39626 unsigned i, j; 39627 bcm_port_t port; 39628 unsigned qual_idx; 39629 _bcm_field_qual_info_t *f_qual_arr; 39630 int idx; 39631 39632 _FP_XGS3_ALLOC(fg, sizeof(*fg), "field group"); 39633 if (fg == NULL) { 39634 result = BCM_E_MEMORY; 39635 goto done; 39636 } 39637 39638 /* Initialize action res id and VMAP group to default */ 39639 fg->action_res_id = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 39640 for (idx = 0; idx < _FP_PAIR_MAX; idx++) { 39641 fg->vmap_group[idx] = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 39642 } 39643 39644 fg->gid = gid; 39645 fg->priority = pri; 39646 fg->qset = *qset; 39647 39648 /* Recover group's qual_arr */ 39649 39650 for (fg->qual_arr[e_type][0].size = qual_idx = 0; 39651 qual_idx < _bcmFieldQualifyCount; ++qual_idx) { 39652 if (BCM_FIELD_QSET_TEST(fg->qset, qual_idx)) { 39653 ++fg->qual_arr[e_type][0].size; 39654 } 39655 } 39656 39657 _FP_XGS3_ALLOC(fg->qual_arr[e_type][0].qid_arr, 39658 (fg->qual_arr[e_type][0].size * 39659 sizeof(fg->qual_arr[e_type][0].qid_arr[0])), 39660 "Group qual id" 39661 ); 39662 _FP_XGS3_ALLOC(fg->qual_arr[e_type][0].offset_arr, 39663 (fg->qual_arr[e_type][0].size * 39664 sizeof(fg->qual_arr[e_type][0].offset_arr[0])), 39665 "Group qual offset" 39666 ); 39667 39668 for (i = qual_idx = 0; qual_idx < _bcmFieldQualifyCount; ++qual_idx) { 39669 if (!BCM_FIELD_QSET_TEST(fg->qset, qual_idx)) { 39670 continue; 39671 } 39672 39673 fg->qual_arr[e_type][0].qid_arr[i] = qual_idx; 39674 39675 f_qual_arr = stage_fc->f_qual_arr[qual_idx]; 39676 39677 for (j = 0; j < f_qual_arr->conf_sz; ++j) { 39678 /* assert(f_qual_arr->conf_arr[i].selector.pri_sel) == _bcmFieldSliceSelExternal */ 39679 39680 if (f_qual_arr->conf_arr[j].selector.pri_sel_val == fs->slice_number) { 39681 fg->qual_arr[e_type][0].offset_arr[i] = 39682 f_qual_arr->conf_arr[j].offset; 39683 break; 39684 } 39685 } 39686 39687 ++i; 39688 } 39689 39690 fg->stage_id = stage_fc->stage_id; 39691 for (i = 0; i < COUNTOF(fg->sel_codes); ++i) { 39692 _FIELD_SELCODE_CLEAR(fg->sel_codes[i]); 39693 } 39694 fg->sel_codes[0].intraslice = fg->sel_codes[0].secondary = _FP_SELCODE_DONT_USE; 39695 fg->sel_codes[0].extn = fs->slice_number; 39696 fg->flags = _FP_GROUP_SPAN_SINGLE_SLICE | _FP_GROUP_LOOKUP_ENABLED; 39697 fg->slices = fs; 39698 fs->group_flags = _FP_GROUP_SPAN_SINGLE_SLICE; 39699 39700 /* Recover ports for group */ 39701 39702 BCM_PBMP_CLEAR(fg->pbmp); 39703 PBMP_ALL_ITER(unit, port) { 39704 uint32 esm_port_mode; 39705 39706 result = soc_reg32_read(unit, soc_reg_addr(unit, ESM_MODE_PER_PORTr, port, 0), &esm_port_mode); 39707 if (result != BCM_E_NONE) { 39708 goto done; 39709 } 39710 39711 switch (pkt_type) { 39712 case _FP_EXT_L2: 39713 if (soc_reg_field_get(unit, ESM_MODE_PER_PORTr, esm_port_mode, L2_ACL_ENf) != 0) { 39714 BCM_PBMP_PORT_ADD(fg->pbmp, port); 39715 } 39716 break; 39717 case _FP_EXT_IP4: 39718 if (soc_reg_field_get(unit, ESM_MODE_PER_PORTr, esm_port_mode, IPV4_ACL_MODEf) != 0) { 39719 BCM_PBMP_PORT_ADD(fg->pbmp, port); 39720 } 39721 break; 39722 case _FP_EXT_IP6: 39723 if (soc_reg_field_get(unit, ESM_MODE_PER_PORTr, esm_port_mode, IPV6_ACL_MODEf) != 0) { 39724 BCM_PBMP_PORT_ADD(fg->pbmp, port); 39725 } 39726 break; 39727 default: 39728 ; 39729 } 39730 } 39731 39732 fs->pbmp = fg->pbmp; 39733 39734 _bcm_field_group_status_init(unit, &fg->group_status); 39735 39736 /* Hook new group into stage */ 39737 39738 fg->next = fc->groups; 39739 fc->groups = fg; 39740 39741 done: 39742 if (result == BCM_E_NONE) { 39743 *pfg = fg; 39744 } else if (fg) { 39745 sal_free(fg); 39746 } 39747 39748 return (result); 39749 } 39750 39751 39752 STATIC int 39753 _field_tr2_stage_external_reinit_old(int unit, 39754 _field_control_t *fc, 39755 _field_stage_t *stage_fc 39756 ) 39757 { 39758 int rv = BCM_E_NONE, i, j; 39759 uint8 e_type = _FP_ENTRY_TYPE_DEFAULT; /* Entry type */ 39760 unsigned slice_idx, cum_slice_entry_cnt[TCAM_PARTITION_ACL_L2IP6 + 1 - TCAM_PARTITION_ACL_L2]; 39761 _field_group_t *fg = 0; 39762 _field_entry_t *f_ent = 0; 39763 int group_flags = 0; 39764 int action_res_id; 39765 bcm_pbmp_t group_pbmp; 39766 int idx; 39767 _field_entry_wb_info_t f_ent_wb_info; 39768 39769 39770 for (j = 0, i = stage_fc->tcam_slices - 1; i >= 0; --i) { 39771 cum_slice_entry_cnt[i] = j 39772 + stage_fc->slices[_FP_DEF_INST][i].entry_count; 39773 j = cum_slice_entry_cnt[i]; 39774 } 39775 39776 /* For each slice, ... */ 39777 39778 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; ++slice_idx) { 39779 _field_slice_t *fs = &stage_fc->slices[_FP_DEF_INST][slice_idx]; 39780 int port; 39781 unsigned pkt_type=0, entry_idx, entry_cnt; 39782 soc_mem_t tcam_data_mask_mem = _bcm_field_ext_data_mask_mems[slice_idx]; 39783 soc_mem_t tcam_data_mem = _bcm_field_ext_data_mems[slice_idx]; 39784 soc_mem_t tcam_mask_mem = _bcm_field_ext_mask_mems[slice_idx]; 39785 soc_mem_t policy_mem = _bcm_field_ext_policy_mems[slice_idx]; 39786 39787 switch (slice_idx) { 39788 case _FP_EXT_ACL_144_L2: 39789 case _FP_EXT_ACL_L2: 39790 pkt_type = _FP_EXT_L2; 39791 break; 39792 case _FP_EXT_ACL_144_IPV4: 39793 case _FP_EXT_ACL_IPV4: 39794 case _FP_EXT_ACL_L2_IPV4: 39795 pkt_type = _FP_EXT_IP4; 39796 break; 39797 case _FP_EXT_ACL_144_IPV6: 39798 case _FP_EXT_ACL_IPV6_SHORT: 39799 case _FP_EXT_ACL_IPV6_FULL: 39800 case _FP_EXT_ACL_L2_IPV6: 39801 pkt_type = _FP_EXT_IP6; 39802 break; 39803 default: 39804 ; 39805 } 39806 39807 /* Find all valid entries in slice's TCAM */ 39808 39809 for (entry_cnt = entry_idx = 0; 39810 entry_idx < fs->entry_count; 39811 ++entry_idx 39812 ) { 39813 ext_fp_policy_entry_t policy_buf; 39814 ext_ifp_action_profile_entry_t ext_ifp_action_buf; 39815 int multigroup=0; 39816 int prev_prio = -1; 39817 unsigned qual_idx; 39818 _bcm_field_qual_info_t *f_qual_arr; 39819 39820 39821 rv = soc_mem_read(unit, policy_mem, MEM_BLOCK_ANY, entry_idx, policy_buf.entry_data); 39822 if (rv != BCM_E_NONE) { 39823 goto cleanup; 39824 } 39825 if (soc_mem_field32_get(unit, policy_mem, policy_buf.entry_data, VALIDf) == 0) { 39826 /* TCAM entry not in use => Skip */ 39827 39828 continue; 39829 } 39830 39831 /* TCAM entry in use */ 39832 39833 if (entry_cnt == 0) { 39834 /* First in-use entry found => Create group */ 39835 39836 int multigroup = FALSE; /* Will always be FALSE for external */ 39837 bcm_field_group_t gid; 39838 int priority; 39839 bcm_field_qset_t qset; 39840 39841 /* If Level 2, retrieve the GIDs in this slice */ 39842 /* For external, will be exactly 1 group */ 39843 if (fc->l2warm) { 39844 rv = _field_trx_scache_slice_group_recover(unit, 39845 fc, _FP_DEF_INST, 39846 slice_idx, 39847 &multigroup, 39848 stage_fc, 39849 0); 39850 if (BCM_FAILURE(rv)) { 39851 goto cleanup; 39852 } 39853 } 39854 39855 _FP_XGS3_ALLOC(fg, sizeof(*fg), "field group"); 39856 if (fg == NULL) { 39857 return BCM_E_MEMORY; 39858 } 39859 39860 /* Initialize action res id and VMAP group to default */ 39861 action_res_id = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 39862 for (idx = 0; idx < _FP_PAIR_MAX; idx++) { 39863 fg->vmap_group[idx] = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 39864 } 39865 39866 group_flags = 0; 39867 if (fc->l2warm) { 39868 /* Get stored group ID and QSET for Level 2 */ 39869 rv = _field_group_info_retrieve(unit, 0 /* port */, 39870 _FP_DEF_INST, &gid, 39871 &priority, 39872 &action_res_id, 39873 &group_pbmp, 39874 NULL, 39875 &group_flags, 39876 &qset, 39877 fc); 39878 if (gid != -1) { 39879 sal_memcpy(&fg->qset, &qset, sizeof(fg->qset)); 39880 } else { 39881 rv = BCM_E_INTERNAL; 39882 } 39883 } else { 39884 /* Generate group ID (a ++ operation) for Level 1 */ 39885 39886 if ((rv = _bcm_field_group_id_generate(unit, &gid)) 39887 == BCM_E_NONE) { 39888 unsigned vmap, vslice; 39889 39890 for (priority = -1, vmap = 0; priority == -1 && vmap < _FP_VMAP_CNT; ++vmap) { 39891 for (vslice = 0; vslice < COUNTOF(stage_fc->vmap[_FP_DEF_INST][0]); ++vslice) { 39892 if (stage_fc->vmap[_FP_DEF_INST][vmap][vslice].vmap_key == slice_idx) { 39893 priority = stage_fc->vmap[_FP_DEF_INST][vmap][vslice].priority; 39894 39895 break; 39896 } 39897 } 39898 } 39899 39900 if (priority == -1) { 39901 rv = BCM_E_INTERNAL; 39902 } 39903 } 39904 39905 /* Recover group's qset */ 39906 39907 BCM_FIELD_QSET_INIT(fg->qset); 39908 BCM_FIELD_QSET_ADD(fg->qset, bcmFieldQualifyStage); 39909 BCM_FIELD_QSET_ADD(fg->qset, bcmFieldQualifyStageExternal); 39910 39911 for (qual_idx = 0; qual_idx < _bcmFieldQualifyCount; ++qual_idx) { 39912 f_qual_arr = stage_fc->f_qual_arr[qual_idx]; 39913 39914 if (f_qual_arr == NULL) { 39915 continue; /* Qualifier does not exist in this stage */ 39916 } 39917 39918 for (i = 0; i < f_qual_arr->conf_sz; ++i) { 39919 /* assert(f_qual_arr->conf_arr[i].selector.pri_sel) == _bcmFieldSliceSelExternal */ 39920 39921 if (f_qual_arr->conf_arr[i].selector.pri_sel_val == slice_idx) { 39922 BCM_FIELD_QSET_ADD(fg->qset, qual_idx); 39923 39924 break; 39925 } 39926 } 39927 } 39928 } 39929 39930 if (BCM_FAILURE(rv)) { 39931 goto cleanup; 39932 } 39933 /* Recover group's qual_arr */ 39934 39935 for (fg->qual_arr[e_type][0].size = qual_idx = 0; 39936 qual_idx < _bcmFieldQualifyCount; ++qual_idx) { 39937 if (BCM_FIELD_QSET_TEST(fg->qset, qual_idx)) { 39938 ++fg->qual_arr[e_type][0].size; 39939 } 39940 } 39941 39942 _FP_XGS3_ALLOC(fg->qual_arr[e_type][0].qid_arr, 39943 (fg->qual_arr[e_type][0].size * 39944 sizeof(fg->qual_arr[e_type][0].qid_arr[0])), 39945 "Group qual id" 39946 ); 39947 _FP_XGS3_ALLOC(fg->qual_arr[e_type][0].offset_arr, 39948 (fg->qual_arr[e_type][0].size * 39949 sizeof(fg->qual_arr[e_type][0].offset_arr[0])), 39950 "Group qual offset" 39951 ); 39952 39953 for (j = qual_idx = 0; qual_idx < _bcmFieldQualifyCount; ++qual_idx) { 39954 if (!BCM_FIELD_QSET_TEST(fg->qset, qual_idx)) { 39955 continue; 39956 } 39957 39958 fg->qual_arr[e_type][0].qid_arr[j] = qual_idx; 39959 39960 f_qual_arr = stage_fc->f_qual_arr[qual_idx]; 39961 39962 for (i = 0; i < f_qual_arr->conf_sz; ++i) { 39963 /* assert(f_qual_arr->conf_arr[i].selector.pri_sel) == _bcmFieldSliceSelExternal */ 39964 39965 if (f_qual_arr->conf_arr[i].selector.pri_sel_val == slice_idx) { 39966 fg->qual_arr[e_type][0].offset_arr[j] = 39967 f_qual_arr->conf_arr[i].offset; 39968 39969 break; 39970 } 39971 } 39972 39973 ++j; 39974 } 39975 39976 fg->gid = gid; 39977 fg->priority = priority; 39978 fg->action_res_id = action_res_id; 39979 fg->stage_id = stage_fc->stage_id; 39980 fg->sel_codes[0].extn = slice_idx; 39981 fg->slices = fs; 39982 fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE; 39983 if (fc->l2warm 39984 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15)) { 39985 if (group_flags & _FP_GROUP_LOOKUP_ENABLED) { 39986 fg->flags = fg->flags | _FP_GROUP_LOOKUP_ENABLED; 39987 } 39988 if (group_flags & _FP_GROUP_WLAN) { 39989 fg->flags = fg->flags | _FP_GROUP_WLAN; 39990 } 39991 } else { 39992 fg->flags |= _FP_GROUP_LOOKUP_ENABLED; 39993 } 39994 39995 /* Recover ports for group */ 39996 39997 BCM_PBMP_CLEAR(fg->pbmp); 39998 PBMP_ALL_ITER(unit, port) { 39999 uint32 esm_port_mode; 40000 40001 rv = soc_reg32_read(unit, soc_reg_addr(unit, ESM_MODE_PER_PORTr, port, 0), &esm_port_mode); 40002 if (rv != BCM_E_NONE) { 40003 goto cleanup; 40004 } 40005 40006 switch (pkt_type) { 40007 case _FP_EXT_L2: 40008 if (soc_reg_field_get(unit, ESM_MODE_PER_PORTr, esm_port_mode, L2_ACL_ENf) != 0) { 40009 BCM_PBMP_PORT_ADD(fg->pbmp, port); 40010 } 40011 break; 40012 case _FP_EXT_IP4: 40013 if (soc_reg_field_get(unit, ESM_MODE_PER_PORTr, esm_port_mode, IPV4_ACL_MODEf) != 0) { 40014 BCM_PBMP_PORT_ADD(fg->pbmp, port); 40015 } 40016 break; 40017 case _FP_EXT_IP6: 40018 if (soc_reg_field_get(unit, ESM_MODE_PER_PORTr, esm_port_mode, IPV6_ACL_MODEf) != 0) { 40019 BCM_PBMP_PORT_ADD(fg->pbmp, port); 40020 } 40021 break; 40022 default: 40023 ; 40024 } 40025 } 40026 40027 fs->pbmp = fg->pbmp; 40028 40029 /* Hook new group into stage */ 40030 40031 fg->next = fc->groups; 40032 fc->groups = fg; 40033 } 40034 40035 /* Add entry to group */ 40036 40037 _FP_XGS3_ALLOC(f_ent, sizeof(*f_ent), "field entry"); 40038 if (f_ent == NULL) { 40039 rv = BCM_E_MEMORY; 40040 goto cleanup; 40041 } 40042 40043 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 40044 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 40045 if (fc->l2warm) { 40046 rv = _field_trx_entry_info_retrieve(unit, 40047 fc, 40048 stage_fc, 40049 multigroup, 40050 &prev_prio, 40051 &f_ent_wb_info 40052 ); 40053 40054 if (BCM_FAILURE(rv)) { 40055 goto cleanup; 40056 } 40057 } else { 40058 _bcm_field_last_alloc_eid_incr(unit); 40059 } 40060 40061 if (fc->l2warm) { 40062 /* Use retrieved EID */ 40063 f_ent->eid = f_ent_wb_info.eid; 40064 /* Set retrieved dvp_type and svp_type */ 40065 f_ent->dvp_type = f_ent_wb_info.dvp_type[0]; 40066 f_ent->svp_type = f_ent_wb_info.svp_type[0]; 40067 } else { 40068 f_ent->eid = _bcm_field_last_alloc_eid_get(unit); 40069 } 40070 f_ent->group = fg; 40071 40072 /* ??? 40073 BCM_PBMP_ASSIGN(f_ent[i].pbmp.data, entry_pbmp); 40074 BCM_PBMP_ASSIGN(f_ent[i].pbmp.mask, PBMP_ALL(unit)); 40075 */ 40076 40077 f_ent->flags = _FP_ENTRY_PRIMARY; 40078 f_ent->slice_idx = entry_idx; 40079 f_ent->fs = fs; 40080 40081 if (f_ent_wb_info.color_independent) { 40082 f_ent->flags |= _FP_ENTRY_COLOR_INDEPENDENT; 40083 } 40084 40085 f_ent->tcam.key_size = ((soc_mem_field_length(unit, tcam_data_mask_mem ? tcam_data_mask_mem : tcam_data_mem, DATAf) + 31) & ~31) >> (5 - 2); 40086 40087 f_ent->tcam.key_hw = sal_alloc(f_ent->tcam.key_size, "TCAM data buf"); 40088 f_ent->tcam.mask_hw = sal_alloc(f_ent->tcam.key_size, "TCAM mask buf"); 40089 40090 if (tcam_data_mask_mem != 0) { 40091 ext_acl288_tcam_entry_t tcam_buf; 40092 40093 rv = soc_mem_read(unit, tcam_data_mask_mem, MEM_BLOCK_ANY, entry_idx, tcam_buf.entry_data); 40094 if (rv != BCM_E_NONE) { 40095 goto cleanup; 40096 } 40097 soc_mem_field_get(unit, tcam_data_mask_mem, tcam_buf.entry_data, DATAf, f_ent->tcam.key_hw); 40098 soc_mem_mask_field_get(unit, tcam_data_mask_mem, tcam_buf.entry_data, MASKf, f_ent->tcam.mask_hw); 40099 } else { 40100 ext_acl432_tcam_data_entry_t tcam_buf; 40101 40102 rv = soc_mem_read(unit, tcam_data_mem, MEM_BLOCK_ANY, entry_idx, tcam_buf.entry_data); 40103 if (rv != BCM_E_NONE) { 40104 goto cleanup; 40105 } 40106 soc_mem_field_get(unit, tcam_data_mem, tcam_buf.entry_data, DATAf, f_ent->tcam.key_hw); 40107 40108 /* Depth of EXT_ACL432_TCAM_MASKm table is one, i.e. has only one valid index */ 40109 rv = soc_mem_read(unit, tcam_mask_mem, MEM_BLOCK_ANY, 0, tcam_buf.entry_data); 40110 if (rv != BCM_E_NONE) { 40111 goto cleanup; 40112 } 40113 soc_mem_mask_field_get(unit, tcam_mask_mem, tcam_buf.entry_data, MASKf, f_ent->tcam.mask_hw); 40114 } 40115 40116 /* Assign entry to a slice */ 40117 fs->entries[entry_idx] = f_ent; 40118 f_ent->flags |= _FP_ENTRY_INSTALLED; 40119 40120 /* Recover actions */ 40121 40122 rv = _field_tr2_actions_recover(unit, 40123 policy_mem, 40124 policy_buf.entry_data, 40125 f_ent, 40126 0, 40127 &f_ent_wb_info); 40128 if (BCM_FAILURE(rv)) { 40129 goto cleanup; 40130 } 40131 40132 /* Recover actions in EXT_IFP_ACTION_PROFILEm */ 40133 40134 rv = soc_mem_read(unit, 40135 EXT_IFP_ACTION_PROFILEm, 40136 MEM_BLOCK_ANY, 40137 soc_mem_field32_get(unit, policy_mem, policy_buf.entry_data, PROFILE_PTRf), 40138 ext_ifp_action_buf.entry_data 40139 ); 40140 if (rv != BCM_E_NONE) { 40141 goto cleanup; 40142 } 40143 rv = _field_tr2_actions_recover(unit, 40144 EXT_IFP_ACTION_PROFILEm, 40145 ext_ifp_action_buf.entry_data, 40146 f_ent, 40147 0, 40148 &f_ent_wb_info); 40149 40150 if (BCM_FAILURE(rv)) { 40151 goto cleanup; 40152 } 40153 /* Add to the group */ 40154 if (fc->l2warm) { 40155 f_ent->prio = f_ent_wb_info.prio; 40156 } else { 40157 f_ent->prio = cum_slice_entry_cnt[slice_idx] - entry_idx; 40158 } 40159 rv = _field_group_entry_add(unit, fg, f_ent); 40160 if (BCM_FAILURE(rv)) { 40161 goto cleanup; 40162 } 40163 40164 f_ent = 0; 40165 40166 ++entry_cnt; 40167 } 40168 40169 /* Free up the temporary slice group info */ 40170 if (fc->l2warm) { 40171 _field_scache_slice_group_free(unit, 40172 fc, 40173 slice_idx 40174 ); 40175 } 40176 40177 fg = 0; 40178 } 40179 40180 cleanup: 40181 if (f_ent) { 40182 sal_free(f_ent); 40183 } 40184 if (fg) { 40185 sal_free(fg); 40186 } 40187 40188 return (rv); 40189 } 40190 40191 40192 int 40193 _field_tr2_stage_external_reinit(int unit, 40194 _field_control_t *fc, 40195 _field_stage_t *stage_fc 40196 ) 40197 { 40198 int result = BCM_E_NONE; 40199 int i, j, idx1; 40200 unsigned slice_idx; 40201 unsigned cum_slice_entry_cnt[ 40202 TCAM_PARTITION_ACL_L2IP6 + 1 - TCAM_PARTITION_ACL_L2 40203 ]; 40204 _field_group_t *fg = 0; 40205 _field_entry_t *f_ent = 0; 40206 _field_entry_wb_info_t f_ent_wb_info; 40207 40208 if (!_field_tr2_ext_scache_sync_chk(unit, fc, stage_fc)) { 40209 return (_field_tr2_stage_external_reinit_old(unit, fc, stage_fc)); 40210 } 40211 40212 /* Compute cumulative entry counts (number of entries in each and all 40213 preceding slices) */ 40214 40215 for (j = 0, i = stage_fc->tcam_slices - 1; i >= 0; --i) { 40216 cum_slice_entry_cnt[i] = j 40217 + stage_fc->slices[_FP_DEF_INST][i].entry_count; 40218 j = cum_slice_entry_cnt[i]; 40219 } 40220 40221 /* For each slice, ... */ 40222 40223 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; ++slice_idx) { 40224 _field_slice_t *fs = &stage_fc->slices[_FP_DEF_INST][slice_idx]; 40225 unsigned entry_idx, entry_cnt; 40226 struct _field_tr2_ext_scache_rw h[1]; 40227 bcm_field_group_t gid; 40228 bcm_field_qset_t qset; 40229 int pri; 40230 unsigned n, pkt_type = 0; 40231 uint32 x; 40232 40233 _field_tr2_ext_slice_to_pkt_type(fs, &pkt_type); 40234 40235 _field_tr2_ext_scache_rd_init(h, unit, slice_idx); 40236 40237 if (fc->l2warm) { 40238 /* Check for start sequence */ 40239 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd_uint(h, &x, 4)); 40240 if (x != _FIELD_EXTFP_DATA_START) { 40241 /* Start sequence not found */ 40242 40243 result = BCM_E_INTERNAL; 40244 goto error; 40245 } 40246 40247 /* Read group-present flag */ 40248 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd_uint(h, &x, 1)); 40249 if (!x) { 40250 /* Group not present */ 40251 40252 /* Skip to next slice */ 40253 goto slice_done; 40254 } 40255 40256 /* Group is present */ 40257 40258 /* Read group's id, priority and qset */ 40259 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd_uint( 40260 h, 40261 &x, 40262 sizeof(fg->gid) 40263 ) 40264 ); 40265 gid = (bcm_field_group_t) x; 40266 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd_uint( 40267 h, 40268 &x, 40269 sizeof(fg->priority) 40270 ) 40271 ); 40272 pri = (bcm_field_group_t) x; 40273 40274 bcm_field_qset_t_init(&qset); 40275 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd_uint(h, &x, 1)); 40276 for (n = x; n; --n) { 40277 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd_uint(h, &x, 1)); 40278 BCM_FIELD_QSET_ADD(qset, x); 40279 } 40280 40281 /* Create group */ 40282 _field_tr2_stage_ext_group_construct(unit, 40283 fc, 40284 stage_fc, 40285 fs, 40286 pkt_type, 40287 gid, 40288 pri, 40289 &qset, 40290 &fg 40291 ); 40292 } 40293 40294 /* Find all valid entries in slice's TCAM */ 40295 40296 for (entry_cnt = entry_idx = 0; 40297 entry_idx < fs->entry_count; 40298 ++entry_idx 40299 ) { 40300 uint32 *policy; 40301 ext_ifp_action_profile_entry_t ext_ifp_action_buf; 40302 int prev_pri = 0; 40303 unsigned profile_ptr; 40304 40305 policy = _field_tr2_ext_scache_rd_rec_ptr(h, 0, entry_idx); 40306 if (soc_mem_field32_get(unit, h->mems[0], policy, VALIDf) == 0) { 40307 /* TCAM entry not in use => Skip */ 40308 40309 continue; 40310 } 40311 40312 /* TCAM entry in use */ 40313 40314 if (entry_cnt == 0 && !fc->l2warm) { 40315 /* First in-use entry found, and level-1 warm start 40316 => Create group 40317 */ 40318 40319 unsigned qual_idx; 40320 _bcm_field_qual_info_t *f_qual_arr; 40321 _field_stage_t *stage_fc_ifp; 40322 unsigned vslice; 40323 40324 /* Generate group ID (a ++ operation) for Level 1 */ 40325 40326 result = _bcm_field_group_id_generate(unit, &gid); 40327 if (result != BCM_E_NONE) { 40328 goto error; 40329 } 40330 40331 /* Recover group's qset */ 40332 40333 BCM_FIELD_QSET_INIT(qset); 40334 BCM_FIELD_QSET_ADD(qset, bcmFieldQualifyStage); 40335 BCM_FIELD_QSET_ADD(qset, bcmFieldQualifyStageExternal); 40336 40337 for (qual_idx = 0; 40338 qual_idx < _bcmFieldQualifyCount; 40339 ++qual_idx 40340 ) { 40341 f_qual_arr = stage_fc->f_qual_arr[qual_idx]; 40342 40343 if (f_qual_arr == NULL) { 40344 continue; /* Qualifier does not exist in this stage */ 40345 } 40346 40347 for (i = 0; i < f_qual_arr->conf_sz; ++i) { 40348 /* assert(f_qual_arr->conf_arr[i].selector.pri_sel) 40349 == _bcmFieldSliceSelExternal */ 40350 40351 if (f_qual_arr->conf_arr[i].selector.pri_sel_val 40352 == slice_idx 40353 ) { 40354 BCM_FIELD_QSET_ADD(qset, qual_idx); 40355 40356 break; 40357 } 40358 } 40359 } 40360 40361 result = _field_stage_control_get(unit, 40362 _BCM_FIELD_STAGE_INGRESS, 40363 &stage_fc_ifp 40364 ); 40365 if (result != BCM_E_NONE) { 40366 goto error; 40367 } 40368 40369 for (pri = -1, vslice = 0; 40370 vslice < COUNTOF(stage_fc_ifp->vmap[_FP_DEF_INST][0]); 40371 ++vslice 40372 ) { 40373 if (stage_fc_ifp->vmap[_FP_DEF_INST][pkt_type][vslice].vmap_key 40374 == slice_idx 40375 ) { 40376 pri = stage_fc->vmap[_FP_DEF_INST][pkt_type][vslice].priority; 40377 40378 break; 40379 } 40380 } 40381 40382 if (pri == -1) { 40383 result = BCM_E_INTERNAL; 40384 goto error; 40385 } 40386 40387 _field_tr2_stage_ext_group_construct(unit, 40388 fc, 40389 stage_fc, 40390 fs, 40391 pkt_type, 40392 gid, 40393 pri, 40394 &qset, 40395 &fg 40396 ); 40397 } 40398 40399 _FP_XGS3_ALLOC(f_ent, sizeof(*f_ent), "field entry"); 40400 if (f_ent == NULL) { 40401 result = BCM_E_MEMORY; 40402 goto error; 40403 } 40404 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 40405 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 40406 } 40407 40408 40409 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 40410 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 40411 if (fc->l2warm) { 40412 /* Level-2 warm start */ 40413 40414 uint8 f; 40415 40416 /* Read entry id */ 40417 _field_tr2_ext_scache_rd_uint(h, &x, sizeof(f_ent->eid)); 40418 f_ent->eid = (bcm_field_entry_t) x; 40419 40420 /* Read priority/stat/policer flags */ 40421 result = _field_tr2_ext_scache_rd(h, &f); 40422 if (result != BCM_E_NONE) { 40423 goto error; 40424 } 40425 40426 if (f & (1 << 2)) { 40427 /* Read entry priority */ 40428 _field_tr2_ext_scache_rd_uint(h, &x, sizeof(f_ent->prio)); 40429 prev_pri = f_ent->prio = (int) x; 40430 } else { 40431 /* Assign entry same priority as previous entry */ 40432 f_ent->prio = prev_pri; 40433 } 40434 if (f & (1 << 1)) { 40435 /* Read stat id */ 40436 _field_tr2_ext_scache_rd_uint(h, 40437 &x, 40438 sizeof(f_ent->statistic.sid) 40439 ); 40440 f_ent_wb_info.sid = (int) x; 40441 } 40442 if (f & (1 << 0)) { 40443 /* Read policer id */ 40444 _field_tr2_ext_scache_rd_uint(h, 40445 &x, 40446 sizeof(f_ent->policer[0].pid) 40447 ); 40448 f_ent_wb_info.pid = (bcm_policer_t) x; 40449 } 40450 f_ent_wb_info.eid = f_ent->eid; 40451 f_ent_wb_info.prio = f_ent->prio; 40452 } else { 40453 /* Level-1 warm start */ 40454 40455 /* Assign arbitary (last + 1) entry id */ 40456 _bcm_field_last_alloc_eid_incr(unit); 40457 f_ent->eid = _bcm_field_last_alloc_eid_get(unit); 40458 40459 /* Assign entry priority based on position in TCAM */ 40460 f_ent->prio = cum_slice_entry_cnt[slice_idx] - entry_idx; 40461 } 40462 40463 /* ??? 40464 BCM_PBMP_ASSIGN(f_ent[i].pbmp.data, entry_pbmp); 40465 BCM_PBMP_ASSIGN(f_ent[i].pbmp.mask, PBMP_ALL(unit)); 40466 */ 40467 40468 f_ent->flags = _FP_ENTRY_PRIMARY; 40469 f_ent->slice_idx = entry_idx; 40470 f_ent->fs = fs; 40471 40472 f_ent->tcam.key_size = ((soc_mem_field_length(unit, 40473 h->mems[1], 40474 DATAf 40475 ) 40476 + 31 40477 ) 40478 & ~31 40479 ) 40480 >> (5 - 2); 40481 40482 f_ent->tcam.key_hw = sal_alloc(f_ent->tcam.key_size, "TCAM data buf"); 40483 f_ent->tcam.mask_hw = sal_alloc(f_ent->tcam.key_size, "TCAM mask buf"); 40484 40485 if (h->mems[2] == INVALIDm) { 40486 uint32 *p; 40487 40488 p = _field_tr2_ext_scache_rd_rec_ptr(h, 1, entry_idx); 40489 soc_mem_field_get(unit, 40490 h->mems[1], 40491 p, 40492 DATAf, 40493 f_ent->tcam.key_hw 40494 ); 40495 soc_mem_mask_field_get(unit, 40496 h->mems[1], 40497 p, 40498 MASKf, 40499 f_ent->tcam.mask_hw 40500 ); 40501 } else { 40502 soc_mem_field_get(unit, 40503 h->mems[1], 40504 _field_tr2_ext_scache_rd_rec_ptr( 40505 h, 40506 1, 40507 entry_idx 40508 ), 40509 DATAf, 40510 f_ent->tcam.key_hw 40511 ); 40512 40513 soc_mem_mask_field_get(unit, 40514 h->mems[2], 40515 _field_tr2_ext_scache_rd_rec_ptr( 40516 h, 40517 2, 40518 entry_idx 40519 ), 40520 MASKf, 40521 f_ent->tcam.mask_hw 40522 ); 40523 } 40524 40525 /* Assign entry to a slice */ 40526 fs->entries[entry_idx] = f_ent; 40527 f_ent->flags |= _FP_ENTRY_INSTALLED; 40528 --fs->free_count; 40529 40530 /* Assign entry to group */ 40531 f_ent->group = fg; 40532 40533 /* Recover actions */ 40534 40535 result =_field_tr2_actions_recover(unit, 40536 h->mems[0], 40537 policy, 40538 f_ent, 40539 0, 40540 &f_ent_wb_info); 40541 if (BCM_FAILURE(result)) { 40542 goto error; 40543 } 40544 40545 /* Recover actions in EXT_IFP_ACTION_PROFILEm */ 40546 40547 profile_ptr = soc_mem_field32_get(unit, 40548 h->mems[0], 40549 policy, 40550 PROFILE_PTRf 40551 ); 40552 40553 soc_profile_mem_reference(unit, 40554 &stage_fc->ext_act_profile, 40555 profile_ptr, 40556 1 40557 ); 40558 40559 result = soc_mem_read(unit, 40560 EXT_IFP_ACTION_PROFILEm, 40561 MEM_BLOCK_ANY, 40562 profile_ptr, 40563 ext_ifp_action_buf.entry_data 40564 ); 40565 if (result != BCM_E_NONE) { 40566 goto error; 40567 } 40568 result = _field_tr2_actions_recover(unit, 40569 EXT_IFP_ACTION_PROFILEm, 40570 ext_ifp_action_buf.entry_data, 40571 f_ent, 40572 0, 40573 &f_ent_wb_info); 40574 if (BCM_FAILURE(result)) { 40575 goto error; 40576 } 40577 40578 /* Add entry to the group */ 40579 result = _field_group_entry_add(unit, fg, f_ent); 40580 if (BCM_FAILURE(result)) { 40581 sal_free(f_ent); 40582 f_ent = 0; 40583 goto error; 40584 } 40585 40586 f_ent = 0; 40587 40588 ++entry_cnt; 40589 } 40590 40591 slice_done: 40592 result = _bcm_field_prio_mgmt_slice_reinit(unit, stage_fc, fs); 40593 if (BCM_FAILURE(result)) { 40594 goto error; 40595 } 40596 40597 if (fc->l2warm) { 40598 uint32 x; 40599 40600 /* Check for end sequence */ 40601 BCM_IF_ERROR_RETURN(_field_tr2_ext_scache_rd_uint(h, &x, 4)); 40602 if (x != _FIELD_EXTFP_DATA_END) { 40603 /* End sequence not found */ 40604 40605 /* Indicate error */ 40606 result = BCM_E_INTERNAL; 40607 } 40608 } 40609 40610 error: 40611 _field_tr2_ext_scache_release(h); 40612 40613 if (result != BCM_E_NONE) { 40614 break; 40615 } 40616 40617 fg = 0; 40618 } 40619 40620 if (BCM_SUCCESS(result)) { 40621 _field_group_slice_vmap_recovery(unit, fc, stage_fc); 40622 } 40623 40624 if (f_ent) { 40625 sal_free(f_ent); 40626 } 40627 if (fg) { 40628 sal_free(fg); 40629 } 40630 40631 return (result); 40632 } 40633 40634 #endif /* BCM_WARM_BOOT_SUPPORT */ 40635 40636 /* Function: _bcm_trx_field_egr_ports_recovery_print 40637 * 40638 * Purpose: 40639 * Print _entry_egr_ports_recovery database. 40640 * Parameters: 40641 40642 * Returns: 40643 BCM_E_NONE - Success 40644 */ 40645 int _bcm_trx_field_egr_ports_recovery_print (int unit) 40646 { 40647 int port = 0; 40648 _field_entry_recover_egr_ports_t *egrPortDbEntry = NULL; 40649 _field_egr_ports_entry_ids_list_t *tmp = NULL; 40650 _field_entry_recover_egr_ports_t *head; 40651 _field_egr_ports_recovery_t *f_egr_recovery = NULL; 40652 int entry_count = 0; 40653 40654 _field_egr_ports_recovery_control_get (unit, &f_egr_recovery); 40655 40656 _bcm_trx_field_egr_ports_recovery_entry_ids_list_get (unit, 40657 &tmp,&entry_count); 40658 LOG_CLI((BSL_META_U(unit, 40659 "FP (%d) RECOVER_EGR_PORTS_DB: Entry Count = %d"), 40660 unit, entry_count)); 40661 40662 while (tmp != NULL) 40663 { 40664 LOG_CLI((BSL_META_U(unit, 40665 "FP (%d) RECOVER_EGR_PORTS_DB: Entry = %d"), unit, tmp->eid)); 40666 tmp=tmp->next; 40667 } 40668 _bcm_trx_field_egr_ports_recovery_entry_list_destroy (unit, &tmp); 40669 40670 for (port = 1; port < SOC_MAX_NUM_PORTS; port++) 40671 { 40672 head = f_egr_recovery->entry_recover_egr_ports[port]; 40673 if (NULL != head) { 40674 egrPortDbEntry = head; 40675 while (egrPortDbEntry != NULL) { 40676 LOG_CLI((BSL_META_U(unit, 40677 "FP (%d) RECOVER_EGR_PORTS_DB: Port = %d Entry = %d"), 40678 unit, port, egrPortDbEntry->eid)); 40679 egrPortDbEntry = egrPortDbEntry->next; 40680 } 40681 } 40682 } 40683 40684 return BCM_E_NONE; 40685 } 40686 40687 40688 /* Function: _bcm_trx_field_egr_ports_recovery_entry_pbmp_get 40689 * Purpose : 40690 * For an entry, return the Pbmp present in redirect_pbm_recovery database 40691 * Parameters : 40692 * unit : (IN) - BCM device number 40693 * entry : (IN) - Entry ID 40694 * egrPortsPbmp : (OUT) - EgressPortsAdd for bcmFieldActionEgressPortsAdd 40695 */ 40696 int _bcm_trx_field_egr_ports_recovery_entry_pbmp_get (int unit, 40697 bcm_field_entry_t entry, 40698 bcm_pbmp_t *egrPortsPbmp) 40699 { 40700 bcm_pbmp_t or_pbmp; 40701 int port = 0; 40702 _field_entry_recover_egr_ports_t *egrPortDbEntry = NULL; 40703 _field_entry_recover_egr_ports_t *head; 40704 _field_egr_ports_recovery_t *f_egr_recovery = NULL; 40705 40706 sal_memset (&or_pbmp, 0 , sizeof (bcm_pbmp_t)); 40707 40708 _field_egr_ports_recovery_control_get (unit, &f_egr_recovery); 40709 40710 for (port = 1; port < SOC_MAX_NUM_PORTS; port++) 40711 { 40712 head = 40713 f_egr_recovery->entry_recover_egr_ports[port]; 40714 if (NULL != head) { 40715 egrPortDbEntry = head; 40716 while (egrPortDbEntry != NULL) { 40717 if (egrPortDbEntry->eid == entry) { 40718 /* coverity[overrun-local] */ 40719 BCM_PBMP_PORT_ADD (or_pbmp,port); 40720 } 40721 egrPortDbEntry = egrPortDbEntry->next; 40722 } 40723 } 40724 } 40725 40726 if (BCM_PBMP_IS_NULL (or_pbmp)) { 40727 return BCM_E_NOT_FOUND; 40728 } 40729 sal_memcpy (egrPortsPbmp, &or_pbmp, sizeof(bcm_pbmp_t)); 40730 return BCM_E_NONE; 40731 } 40732 40733 /* Function: _bcm_trx_field_egr_ports_recovery_entry_list_destroy 40734 * 40735 * Purpose: 40736 * Destroy the list of entries which was obtained using 40737 * _bcm_trx_field_egr_ports_recovery_entry_ids_list_get API 40738 * Parameters: 40739 * entries - pointer to link list which will be populated 40740 40741 * Returns: 40742 BCM_E_NONE - Success 40743 BCM_E_MEMORY- pbmp is NULL 40744 */ 40745 int _bcm_trx_field_egr_ports_recovery_entry_list_destroy (int unit, 40746 _field_egr_ports_entry_ids_list_t **entries) 40747 { 40748 _field_egr_ports_entry_ids_list_t *tmp = NULL; 40749 40750 while ((*entries) != NULL) { 40751 tmp = *entries; 40752 *entries = (*entries)->next; 40753 sal_free(tmp); 40754 tmp = NULL; 40755 } 40756 return BCM_E_NONE; 40757 } 40758 40759 40760 /* Function: _bcm_trx_field_egr_ports_recovery_entry_ids_list_get 40761 * 40762 * Purpose: 40763 * Return list of entries where EgressPortsAdd action has been configured. 40764 * Parameters: 40765 * entries - pointer to link list which will be populated 40766 40767 * Returns: 40768 BCM_E_NONE - Success 40769 BCM_E_MEMORY- pbmp is NULL 40770 40771 * Note: This entry allocates memory to return list of entries. 40772 field_egr_ports_recovery_entry_list_destroy 40773 should be invoked subsequently to free the allocated memory. 40774 */ 40775 int _bcm_trx_field_egr_ports_recovery_entry_ids_list_get (int unit, 40776 _field_egr_ports_entry_ids_list_t **entryIdList, int *entryIdCnt) 40777 { 40778 _field_egr_ports_entry_ids_list_t *eId = NULL; 40779 _field_egr_ports_entry_ids_list_t *tmp = NULL; 40780 _field_egr_ports_entry_ids_list_t *prev = NULL; 40781 _field_entry_recover_egr_ports_t *egrPortDbEntry = NULL; 40782 _field_entry_recover_egr_ports_t *head; 40783 _field_egr_ports_recovery_t *f_egr_recovery = NULL; 40784 int port = 0; 40785 int eIdCount = 0; 40786 40787 _field_egr_ports_recovery_control_get (unit, &f_egr_recovery); 40788 40789 /* Loop through the redirect_pbm_recovery database and generate a 40790 * linked-list of FP entry Ids that are present in 40791 * database*/ 40792 40793 for (port = 1; port < SOC_MAX_NUM_PORTS; port++) 40794 { 40795 head = 40796 f_egr_recovery->entry_recover_egr_ports[port]; 40797 if (NULL != head) { 40798 egrPortDbEntry = head; 40799 while (egrPortDbEntry != NULL) { 40800 eId = NULL; 40801 tmp = *entryIdList; 40802 prev = NULL; 40803 40804 /* if list is empty or if new node is to be inserted 40805 * before the first node */ 40806 while(tmp != NULL && (egrPortDbEntry->eid > tmp->eid)){ 40807 prev = tmp; 40808 tmp = tmp->next; 40809 } 40810 if ((tmp != NULL) && (tmp->eid == egrPortDbEntry->eid)) { 40811 /* Entry already added to list. 40812 * Update the Pbmp for the port 40813 */ 40814 /* coverity[overrun-local] */ 40815 BCM_PBMP_PORT_ADD (tmp->egr_ports_pbmp, port); 40816 } else { 40817 _FP_XGS3_ALLOC (eId, 40818 sizeof (_field_egr_ports_entry_ids_list_t), 40819 "egr_port_recovery_eid_list"); 40820 if (eId == NULL) { 40821 return BCM_E_MEMORY; 40822 } 40823 eId->eid = egrPortDbEntry->eid; 40824 BCM_PBMP_PORT_ADD (eId->egr_ports_pbmp, port); 40825 eIdCount++; 40826 40827 if (prev == NULL) { 40828 eId->next = (*entryIdList); 40829 *entryIdList = eId; 40830 } else { 40831 prev->next = eId; 40832 eId->next = tmp; 40833 } 40834 } 40835 egrPortDbEntry = egrPortDbEntry->next; 40836 } 40837 } 40838 } 40839 *entryIdCnt = eIdCount; 40840 return BCM_E_NONE; 40841 } 40842 40843 /* Function: _bcm_trx_field_egr_ports_recovery_search 40844 * 40845 * Purpose: 40846 * Search for port-entry combination in 40847 _field_egr_ports_recovery database. 40848 * Parameters: 40849 * unit - BCM device number 40850 * entry - Entry ID 40851 * pbmp - EgressPortsAdd from bcmFieldActionEgressPortsAdd. 40852 40853 * Returns: 40854 BCM_E_NONE - Success 40855 BCM_E_PARAM - pbmp is NULL 40856 */ 40857 int _bcm_trx_field_egr_ports_recovery_search (int unit, 40858 int port, bcm_field_entry_t entry) 40859 { 40860 _field_entry_recover_egr_ports_t *egrPortDbEntry = NULL; 40861 _field_entry_recover_egr_ports_t *head; 40862 _field_egr_ports_recovery_t *f_egr_recovery = NULL; 40863 40864 _field_egr_ports_recovery_control_get (unit, &f_egr_recovery); 40865 40866 head = f_egr_recovery->entry_recover_egr_ports[port]; 40867 egrPortDbEntry = head; 40868 40869 while (egrPortDbEntry != NULL) { 40870 if (egrPortDbEntry->eid == entry) { 40871 return BCM_E_EXISTS; 40872 } 40873 egrPortDbEntry = egrPortDbEntry->next; 40874 } 40875 return BCM_E_NONE; 40876 } 40877 40878 /* Function: _bcm_trx_field_egr_ports_recovery_add 40879 * 40880 * Purpose: 40881 * Save pbmp from bcmFieldActionEgressPortsAdd action 40882 * into _entry_egr_ports_recovery database. 40883 * Parameters: 40884 * unit - BCM device number 40885 * entry - Entry ID 40886 * pbmp - EgressPortsAdd from bcmFieldActionEgressPortsAdd. 40887 40888 * Returns: 40889 BCM_E_NONE - Success 40890 BCM_E_PARAM - pbmp is NULL 40891 */ 40892 int _bcm_trx_field_egr_ports_recovery_add (int unit, 40893 bcm_field_entry_t entry, 40894 bcm_pbmp_t pbmp) 40895 { 40896 _field_entry_recover_egr_ports_t *egrPortDbEntry = NULL; 40897 _field_entry_recover_egr_ports_t *or_pbm_new = NULL; 40898 _field_entry_recover_egr_ports_t *head; 40899 _field_egr_ports_recovery_t *f_egr_recovery = NULL; 40900 int mem_sz; /* Memory size. */ 40901 int port; 40902 int rv; 40903 40904 _field_egr_ports_recovery_control_get (unit, &f_egr_recovery); 40905 40906 BCM_PBMP_ITER(pbmp, port) { 40907 rv = _bcm_trx_field_egr_ports_recovery_search (unit, port, entry); 40908 if (rv == BCM_E_EXISTS) { 40909 continue; 40910 } 40911 40912 /* If entry doesn't exist, allocate a new entry and update 40913 * recovery database based on whether head is already available 40914 * or not. 40915 */ 40916 40917 mem_sz = sizeof (_field_entry_recover_egr_ports_t); 40918 _FP_XGS3_ALLOC (or_pbm_new, mem_sz, 40919 "Field redirect_pbm_recovery Entry"); 40920 if (NULL == or_pbm_new) { 40921 return (BCM_E_MEMORY); 40922 } 40923 or_pbm_new->eid = entry; 40924 40925 head = 40926 f_egr_recovery->entry_recover_egr_ports[port]; 40927 40928 if (NULL != head) { 40929 egrPortDbEntry = head; 40930 or_pbm_new->next = egrPortDbEntry; 40931 f_egr_recovery->entry_recover_egr_ports[port] = or_pbm_new; 40932 or_pbm_new = NULL; 40933 } else { 40934 or_pbm_new->next = NULL; 40935 f_egr_recovery->entry_recover_egr_ports[port] = or_pbm_new; 40936 or_pbm_new = NULL; 40937 } 40938 } 40939 return (BCM_E_NONE); 40940 } 40941 40942 /* Function: _bcm_trx_field_egr_ports_recovery_entry_remove 40943 * 40944 * Purpose: 40945 * Remove EntryId from _entry_egr_ports_recovery database. 40946 * Parameters: 40947 * unit - BCM device number 40948 * entry - Entry ID 40949 40950 * Returns: 40951 BCM_E_NONE - Success 40952 BCM_E_PARAM - pbmp is NULL 40953 */ 40954 int _bcm_trx_field_egr_ports_recovery_entry_remove (int unit, 40955 bcm_field_entry_t entry) 40956 { 40957 _field_entry_recover_egr_ports_t *egrPortDbEntry = NULL; 40958 _field_entry_recover_egr_ports_t *prev_entry= NULL; 40959 _field_egr_ports_recovery_t *f_egr_recovery = NULL; 40960 int port; 40961 40962 LOG_DEBUG(BSL_LS_BCM_FP,(BSL_META_U(unit, 40963 "FP (unit %d) Clear Entry %d from redirect_pbm_recovery database))"), unit, entry)); 40964 _field_egr_ports_recovery_control_get (unit, &f_egr_recovery); 40965 40966 for (port=1; port < SOC_MAX_NUM_PORTS; port++) { 40967 prev_entry = NULL; 40968 for (prev_entry = egrPortDbEntry = 40969 f_egr_recovery->entry_recover_egr_ports[port]; 40970 egrPortDbEntry != NULL; egrPortDbEntry = egrPortDbEntry->next) { 40971 if (egrPortDbEntry->eid == entry) { 40972 prev_entry->next = egrPortDbEntry->next; 40973 if (egrPortDbEntry == 40974 f_egr_recovery->entry_recover_egr_ports[port]) { 40975 f_egr_recovery->entry_recover_egr_ports[port] = egrPortDbEntry->next; 40976 } 40977 sal_free(egrPortDbEntry); 40978 egrPortDbEntry = NULL; 40979 break; 40980 } 40981 prev_entry = egrPortDbEntry; 40982 } 40983 } 40984 return BCM_E_NONE; 40985 } 40986 40987 40988 #else /* BCM_TRX_SUPPORT && BCM_FIELD_SUPPORT */ 40989 int _trx_field_not_empty; 40990 #endif /* BCM_TRX_SUPPORT && BCM_FIELD_SUPPORT */