field.c (906649B)
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: BCM56640 Field Processor installation functions. 8 */ 9 10 #include <shared/bsl.h> 11 12 #include <soc/defs.h> 13 #if defined(BCM_TRIUMPH3_SUPPORT) && defined(BCM_FIELD_SUPPORT) 14 15 #include <soc/drv.h> 16 #include <soc/scache.h> 17 #include <soc/triumph3.h> 18 19 #include <bcm/error.h> 20 #include <bcm/l3.h> 21 #include <bcm/field.h> 22 #include <bcm/tunnel.h> 23 24 #include <bcm_int/common/multicast.h> 25 26 #include <bcm_int/esw_dispatch.h> 27 28 #include <bcm_int/esw/field.h> 29 #include <bcm_int/esw/l3.h> 30 #include <bcm_int/esw/policer.h> 31 #include <bcm_int/esw/flex_ctr.h> 32 #include <bcm_int/esw/mirror.h> 33 34 #include <bcm_int/esw/firebolt.h> 35 #include <bcm_int/esw/trx.h> 36 #include <bcm_int/esw/triumph.h> 37 #include <bcm_int/esw/triumph3.h> 38 39 #ifndef BIT 40 #define BIT(n) (1U << (n)) 41 #endif 42 #define ALIGN32(x) (((x) + 31) & ~31) 43 44 45 /* Device info */ 46 47 #define NUM_CNTR_POOLS_IFP 16 48 #define NUM_CNTRS_PER_POOL_IFP 512 49 50 #define NUM_METER_POOLS_IFP 8 51 #define NUM_METER_PAIRS_PER_POOL_IFP 512 52 53 #define NUM_LOGICAL_METER_POOLS_IFP 16 54 #define NUM_LOGICAL_METER_PAIRS_PER_POOL_IFP 256 55 56 /* IP Protocol */ 57 #define IP_PROTO_ICMP 0x1 58 #define IP_PROTO_IGMP 0x2 59 #define IP_PROTO_IPv4 0x4 60 #define IP_PROTO_TCP 0x6 61 #define IP_PROTO_UDP 0x11 62 #define IP_PROTO_IPv6 0x29 63 #define IP_PROTO_MPLS 0x89 64 65 /* 66 * IFP - FP_DOUBLE_WIDE_SELECT fields. 67 */ 68 const soc_field_t _tr3_dw_f1_sel[] = { 69 SLICE_0_F1f, SLICE_1_F1f, 70 SLICE_2_F1f, SLICE_3_F1f, 71 SLICE_4_F1f, SLICE_5_F1f, 72 SLICE_6_F1f, SLICE_7_F1f, 73 SLICE_8_F1f, SLICE_9_F1f, 74 SLICE_10_F1f, SLICE_11_F1f, 75 SLICE_12_F1f, SLICE_13_F1f, 76 SLICE_14_F1f, SLICE_15_F1f 77 }; 78 79 static const soc_field_t s_type_fld_tbl[] = { 80 SLICE_0_S_TYPE_SELf, 81 SLICE_1_S_TYPE_SELf, 82 SLICE_2_S_TYPE_SELf, 83 SLICE_3_S_TYPE_SELf 84 }; 85 86 /* 87 * - Check all "structured" qualifiers 88 * (S_TYPE, S_FIELD), (D_TYPE, DFIELD), etc. 89 * Qualifier table definition 90 * Set/get functions 91 */ 92 93 /* We extend the buffer used by the entry for the TCAM word to be a 94 concatentation of device memory words. For TR3, the entry's buffer looks 95 like this: 96 97 +---------- 98 | 99 | Buffer for FP_TCAM (key/mask) 100 | 101 +---------- 102 | Padding (if any), to bring next buffer to 32-bit boundary 103 +---------- 104 | 105 | Buffer for FP_GLOBAL_MASK_TCAM (key/mask) 106 | 107 +---------- 108 109 It will be the responsibility of the entry hardware write and read 110 functions to know which part of the logical buffer goes where. 111 */ 112 113 /* 114 * Function: 115 * _field_tr3_ingress_qualifiers_init 116 * Purpose: 117 * Initialize device stage ingress qualifiers 118 * select codes & offsets 119 * Parameters: 120 * unit - (IN) BCM device number. 121 * stage_fc - (IN) Field Processor stage control structure. 122 * 123 * Returns: 124 * BCM_E_NONE 125 */ 126 STATIC int 127 _field_tr3_ingress_qualifiers_init(int unit, _field_stage_t *stage_fc) 128 { 129 130 131 const unsigned 132 fp_tcam_ofs = 0, 133 f1_ofs = 187 - 2, 134 f2_ofs = 59 - 2, 135 f3_ofs = 10 - 2, 136 dw_f1_ofs = 170 - 3 + 1, 137 dw_f2_ofs = 42 - 3 + 1, 138 dw_f3_ofs = 10 - 3 + 1, 139 dw_f4_ofs = 3 - 3 + 1, 140 fp_global_mask_tcam_ofs = ALIGN32(soc_mem_field_length(unit, FP_TCAMm, KEYf)), 141 dw_f0_ofs = 1 - 1, 142 fixed_ofs = 65 - 1; 143 144 _FP_QUAL_DECL; 145 146 /* Input parameters check. */ 147 if (NULL == stage_fc) { 148 return (BCM_E_PARAM); 149 } 150 151 /***** Special qualifiers *****/ 152 153 /* Handled outside normal qualifier set/get scheme */ 154 155 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage, 156 _bcmFieldSliceSelDisable, 0, 157 0, 0 158 ); 159 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageIngress, 160 _bcmFieldSliceSelDisable, 0, 161 0, 0 162 ); 163 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 164 _bcmFieldSliceSelDisable, 0, 165 0, 0 166 ); 167 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 168 _bcmFieldSliceSelDisable, 0, 169 0, 0 170 ); 171 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 172 _bcmFieldSliceSelDisable, 0, 173 0, 0 174 ); 175 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts, 176 _bcmFieldSliceSelDisable, 0, 177 0, 0 178 ); 179 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNormalizeIpAddrs, 180 _bcmFieldSliceSelDisable, 0, 181 0, 0 182 ); 183 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNormalizeMacAddrs, 184 _bcmFieldSliceSelDisable, 0, 185 0, 0 186 ); 187 188 /***** FIXED single-wide *****/ 189 190 /* N.B. Fixed field is in FP_GLOBAL_MASK_TCAM */ 191 192 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 193 _bcmFieldSliceSelDisable, 0, 194 fp_global_mask_tcam_ofs + fixed_ofs, 1 195 ); 196 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 197 _bcmFieldSliceSelDisable, 0, 198 fp_global_mask_tcam_ofs + fixed_ofs + 1, 3 199 ); 200 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifySvpValid, 201 _bcmFieldSliceSelDisable, 0, 202 fp_global_mask_tcam_ofs + fixed_ofs + 4, 1 203 ); 204 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 205 _bcmFieldSliceSelDisable, 0, 206 fp_global_mask_tcam_ofs + fixed_ofs + 4, 1 207 ); 208 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 209 _bcmFieldSliceSelDisable, 0, 210 fp_global_mask_tcam_ofs + fixed_ofs + 5, 4 211 ); 212 /* (fp_global_mask_tcam_ofs + fixed_ofs + 9, 1) is reserved */ 213 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 214 _bcmFieldSliceSelDisable, 0, 215 fp_global_mask_tcam_ofs + fixed_ofs + 10, 1 216 ); 217 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 218 _bcmFieldSliceSelDisable, 0, 219 fp_global_mask_tcam_ofs + fixed_ofs + 11, 1 220 ); 221 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopbackType, 222 _bcmFieldSliceSelDisable, 0, 223 _bcmFieldSliceLoopbackTypeSelect, 0, 224 fp_global_mask_tcam_ofs + fixed_ofs + 12, 5 225 ); 226 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTunnelType, 227 _bcmFieldSliceSelDisable, 0, 228 _bcmFieldSliceLoopbackTypeSelect, 1, 229 fp_global_mask_tcam_ofs + fixed_ofs + 12, 5 230 ); 231 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopback, 232 _bcmFieldSliceSelDisable, 0, 233 _bcmFieldSliceLoopbackTypeSelect, 0, 234 fp_global_mask_tcam_ofs + fixed_ofs + 16, 1 235 ); 236 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 237 _bcmFieldSliceSelDisable, 0, 238 fp_global_mask_tcam_ofs + fixed_ofs + 17, 1 239 ); 240 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRecoverableDrop, 241 _bcmFieldSliceSelDisable, 0, 242 fp_global_mask_tcam_ofs + fixed_ofs + 18, 1 243 ); 244 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 245 _bcmFieldSliceSelDisable, 0, 246 fp_global_mask_tcam_ofs + fixed_ofs + 19, 1 247 ); 248 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 249 _bcmFieldSliceSelDisable, 0, 250 fp_global_mask_tcam_ofs + fixed_ofs + 20, 1 251 ); 252 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRepCopy, 253 _bcmFieldSliceSelDisable, 0, 254 fp_global_mask_tcam_ofs + fixed_ofs + 21, 1 255 ); 256 257 /***** FPF1 single-wide *****/ 258 259 /* FPF1 = 0 */ 260 261 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 262 _bcmFieldSliceSelFpf1, 0, 263 _bcmFieldSliceSrcClassSelect, 0, 264 _bcmFieldSliceFpf1SrcDstClassSelect, 0, 265 fp_tcam_ofs + f1_ofs, 10 266 ); 267 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 268 _bcmFieldSliceSelFpf1, 0, 269 _bcmFieldSliceSrcClassSelect, 1, 270 _bcmFieldSliceFpf1SrcDstClassSelect, 0, 271 fp_tcam_ofs + f1_ofs, 10 272 ); 273 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 274 _bcmFieldSliceSelFpf1, 0, 275 _bcmFieldSliceSrcClassSelect, 2, 276 _bcmFieldSliceFpf1SrcDstClassSelect, 0, 277 fp_tcam_ofs + f1_ofs, 10 278 ); 279 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 280 _bcmFieldSliceSelFpf1, 0, 281 _bcmFieldSliceSrcClassSelect, 3, 282 _bcmFieldSliceFpf1SrcDstClassSelect, 0, 283 fp_tcam_ofs + f1_ofs, 10 284 ); 285 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 286 _bcmFieldSliceSelFpf1, 0, 287 _bcmFieldSliceDstClassSelect, 0, 288 _bcmFieldSliceFpf1SrcDstClassSelect, 1, 289 fp_tcam_ofs + f1_ofs, 10 290 ); 291 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 292 _bcmFieldSliceSelFpf1, 0, 293 _bcmFieldSliceDstClassSelect, 1, 294 _bcmFieldSliceFpf1SrcDstClassSelect, 1, 295 fp_tcam_ofs + f1_ofs, 10 296 ); 297 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 298 _bcmFieldSliceSelFpf1, 0, 299 _bcmFieldSliceDstClassSelect, 2, 300 _bcmFieldSliceFpf1SrcDstClassSelect, 1, 301 fp_tcam_ofs + f1_ofs, 10 302 ); 303 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 304 _bcmFieldSliceSelFpf1, 0, 305 _bcmFieldSliceDstClassSelect, 3, 306 _bcmFieldSliceFpf1SrcDstClassSelect, 1, 307 fp_tcam_ofs + f1_ofs, 10 308 ); 309 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 310 _bcmFieldSliceSelFpf1, 0, 311 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 312 fp_tcam_ofs + f1_ofs + 10, 14 313 ); 314 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 315 _bcmFieldSliceSelFpf1, 0, 316 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 317 fp_tcam_ofs + f1_ofs + 10, 14 318 ); 319 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 320 _bcmFieldSliceSelFpf1, 0, 321 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 322 fp_tcam_ofs + f1_ofs + 10, 14 323 ); 324 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 325 _bcmFieldSliceSelFpf1, 0, 326 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMplsGport, 327 fp_tcam_ofs + f1_ofs + 24, 16 328 ); 329 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 330 _bcmFieldSliceSelFpf1, 0, 331 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityVlanGport, 332 fp_tcam_ofs + f1_ofs + 24, 16 333 ); 334 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 335 _bcmFieldSliceSelFpf1, 0, 336 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMimGport, 337 fp_tcam_ofs + f1_ofs + 24, 16 338 ); 339 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 340 _bcmFieldSliceSelFpf1, 0, 341 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityWlanGport, 342 fp_tcam_ofs + f1_ofs + 24, 16 343 ); 344 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 345 _bcmFieldSliceSelFpf1, 0, 346 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 347 fp_tcam_ofs + f1_ofs + 24, 16 348 ); 349 350 /* FPF1 = 1 */ 351 352 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 353 _bcmFieldSliceSelFpf1, 1, 354 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 355 fp_tcam_ofs + f1_ofs, 21 356 ); 357 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 358 _bcmFieldSliceSelFpf1, 1, 359 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 360 fp_tcam_ofs + f1_ofs, 21 361 ); 362 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 363 _bcmFieldSliceSelFpf1, 1, 364 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 365 fp_tcam_ofs + f1_ofs, 21 366 ); 367 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 368 _bcmFieldSliceSelFpf1, 1, 369 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 370 fp_tcam_ofs + f1_ofs, 21 371 ); 372 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 373 _bcmFieldSliceSelFpf1, 1, 374 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 375 fp_tcam_ofs + f1_ofs, 21 376 ); 377 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 378 _bcmFieldSliceSelFpf1, 1, 379 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 380 fp_tcam_ofs + f1_ofs, 21 381 ); 382 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 383 _bcmFieldSliceSelFpf1, 1, 384 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 385 fp_tcam_ofs + f1_ofs, 21 386 ); 387 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 388 _bcmFieldSliceSelFpf1, 1, 389 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 390 fp_tcam_ofs + f1_ofs, 21 391 ); 392 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 393 _bcmFieldSliceSelFpf1, 1, 394 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 395 fp_tcam_ofs + f1_ofs, 21 396 ); 397 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 398 _bcmFieldSliceSelFpf1, 1, 399 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 400 fp_tcam_ofs + f1_ofs, 21 401 ); 402 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 403 _bcmFieldSliceSelFpf1, 1, 404 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 405 fp_tcam_ofs + f1_ofs + 21, 17 406 ); 407 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 408 _bcmFieldSliceSelFpf1, 1, 409 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 410 fp_tcam_ofs + f1_ofs + 21, 17 411 ); 412 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 413 _bcmFieldSliceSelFpf1, 1, 414 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMplsGport, 415 fp_tcam_ofs + f1_ofs + 21, 17 416 ); 417 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 418 _bcmFieldSliceSelFpf1, 1, 419 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVlanGport, 420 fp_tcam_ofs + f1_ofs + 21, 17 421 ); 422 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 423 _bcmFieldSliceSelFpf1, 1, 424 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMimGport, 425 fp_tcam_ofs + f1_ofs + 21, 17 426 ); 427 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 428 _bcmFieldSliceSelFpf1, 1, 429 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 430 fp_tcam_ofs + f1_ofs + 21, 17 431 ); 432 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 433 _bcmFieldSliceSelFpf1, 1, 434 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityWlanGport, 435 fp_tcam_ofs + f1_ofs + 21, 17 436 ); 437 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 438 _bcmFieldSliceSelFpf1, 1, 439 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 440 fp_tcam_ofs + f1_ofs + 21, 17 441 ); 442 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport, 443 _bcmFieldSliceSelFpf1, 1, 444 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 445 fp_tcam_ofs + f1_ofs + 21, 17 446 ); 447 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 448 _bcmFieldSliceSelFpf1, 1, 449 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 450 fp_tcam_ofs + f1_ofs + 21 + 7, 10 451 ); 452 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId, 453 _bcmFieldSliceSelFpf1, 1, 454 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 455 fp_tcam_ofs + f1_ofs + 21 + 7, 8 456 ); 457 458 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 459 _bcmFieldSliceSelFpf1, 1, 460 fp_tcam_ofs + f1_ofs + 37, 1 461 ); 462 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 463 _bcmFieldSliceSelFpf1, 1, 464 fp_tcam_ofs + f1_ofs + 38, 3 465 ); 466 467 /* FPF1 = 2 */ 468 469 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 470 _bcmFieldSliceSelFpf1, 2, 471 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 472 fp_tcam_ofs + f1_ofs, 21 473 ); 474 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 475 _bcmFieldSliceSelFpf1, 2, 476 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 477 fp_tcam_ofs + f1_ofs, 21 478 ); 479 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 480 _bcmFieldSliceSelFpf1, 2, 481 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 482 fp_tcam_ofs + f1_ofs, 21 483 ); 484 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 485 _bcmFieldSliceSelFpf1, 2, 486 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 487 fp_tcam_ofs + f1_ofs, 21 488 ); 489 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 490 _bcmFieldSliceSelFpf1, 2, 491 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 492 fp_tcam_ofs + f1_ofs, 21 493 ); 494 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 495 _bcmFieldSliceSelFpf1, 2, 496 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 497 fp_tcam_ofs + f1_ofs, 21 498 ); 499 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 500 _bcmFieldSliceSelFpf1, 2, 501 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 502 fp_tcam_ofs + f1_ofs, 21 503 ); 504 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 505 _bcmFieldSliceSelFpf1, 2, 506 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 507 fp_tcam_ofs + f1_ofs, 21 508 ); 509 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 510 _bcmFieldSliceSelFpf1, 2, 511 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 512 fp_tcam_ofs + f1_ofs, 21 513 ); 514 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 515 _bcmFieldSliceSelFpf1, 2, 516 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 517 fp_tcam_ofs + f1_ofs, 21 518 ); 519 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 520 _bcmFieldSliceSelFpf1, 2, 521 fp_tcam_ofs + f1_ofs + 21, 3 522 ); 523 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 524 _bcmFieldSliceSelFpf1, 2, 525 _bcmFieldSliceDstClassSelect, 0, 526 fp_tcam_ofs + f1_ofs + 24, 10 527 ); 528 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 529 _bcmFieldSliceSelFpf1, 2, 530 _bcmFieldSliceDstClassSelect, 1, 531 fp_tcam_ofs + f1_ofs + 24, 10 532 ); 533 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 534 _bcmFieldSliceSelFpf1, 2, 535 _bcmFieldSliceDstClassSelect, 2, 536 fp_tcam_ofs + f1_ofs + 24, 10 537 ); 538 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 539 _bcmFieldSliceSelFpf1, 2, 540 _bcmFieldSliceDstClassSelect, 3, 541 fp_tcam_ofs + f1_ofs + 24, 10 542 ); 543 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 544 _bcmFieldSliceSelFpf1, 2, 545 _bcmFieldSliceSrcClassSelect, 0, 546 fp_tcam_ofs + f1_ofs + 34, 10 547 ); 548 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 549 _bcmFieldSliceSelFpf1, 2, 550 _bcmFieldSliceSrcClassSelect, 1, 551 fp_tcam_ofs + f1_ofs + 34, 10 552 ); 553 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 554 _bcmFieldSliceSelFpf1, 2, 555 _bcmFieldSliceSrcClassSelect, 2, 556 fp_tcam_ofs + f1_ofs + 34, 10 557 ); 558 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 559 _bcmFieldSliceSelFpf1, 2, 560 _bcmFieldSliceSrcClassSelect, 3, 561 fp_tcam_ofs + f1_ofs + 34, 10 562 ); 563 564 /* FPF1 = 3 */ 565 566 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 567 _bcmFieldSliceSelFpf1, 3, 568 fp_tcam_ofs + f1_ofs, 16 569 ); 570 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 571 _bcmFieldSliceSelFpf1, 3, 572 fp_tcam_ofs + f1_ofs, 12 573 ); 574 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 575 _bcmFieldSliceSelFpf1, 3, 576 fp_tcam_ofs + f1_ofs + 12, 1 577 ); 578 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 579 _bcmFieldSliceSelFpf1, 3, 580 fp_tcam_ofs + f1_ofs + 13, 3 581 ); 582 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 583 _bcmFieldSliceSelFpf1, 3, 584 fp_tcam_ofs + f1_ofs + 16, 16 585 ); 586 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 587 _bcmFieldSliceSelFpf1, 3, 588 fp_tcam_ofs + f1_ofs + 16, 12 589 ); 590 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 591 _bcmFieldSliceSelFpf1, 3, 592 fp_tcam_ofs + f1_ofs + 16 + 12, 1 593 ); 594 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 595 _bcmFieldSliceSelFpf1, 3, 596 fp_tcam_ofs + f1_ofs + 16 + 13, 3 597 ); 598 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid, 599 _bcmFieldSliceSelFpf1, 3, 600 fp_tcam_ofs + f1_ofs + 32, 2 601 ); 602 603 /* FPF1 = 4 */ 604 605 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 606 _bcmFieldSliceSelFpf1, 4, 607 fp_tcam_ofs + f1_ofs, 16 608 ); 609 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 610 _bcmFieldSliceSelFpf1, 4, 611 fp_tcam_ofs + f1_ofs, 12 612 ); 613 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 614 _bcmFieldSliceSelFpf1, 4, 615 fp_tcam_ofs + f1_ofs + 12, 1 616 ); 617 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 618 _bcmFieldSliceSelFpf1, 4, 619 fp_tcam_ofs + f1_ofs + 13, 3 620 ); 621 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 622 _bcmFieldSliceSelFpf1, 4, 623 fp_tcam_ofs + f1_ofs + 16, 16 624 ); 625 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter, 626 _bcmFieldSliceSelFpf1, 4, 627 fp_tcam_ofs + f1_ofs + 32, 3 628 ); 629 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner, 630 _bcmFieldSliceSelFpf1, 4, 631 fp_tcam_ofs + f1_ofs + 35, 3 632 ); 633 634 /* FPF1 = 5 */ 635 636 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 637 _bcmFieldSliceSelFpf1, 5, 638 fp_tcam_ofs + f1_ofs, 1 639 ); 640 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 641 _bcmFieldSliceSelFpf1, 5, 642 fp_tcam_ofs + f1_ofs + 1, 1 643 ); 644 /* Bit 2 is VXLT0/VXLT1 hit indicator; not used */ 645 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 646 _bcmFieldSliceSelFpf1, 5, 647 fp_tcam_ofs + f1_ofs + 3, 1 648 ); 649 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 650 _bcmFieldSliceSelFpf1, 5, 651 fp_tcam_ofs + f1_ofs + 4, 2 652 ); 653 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 654 _bcmFieldSliceSelFpf1, 5, 655 fp_tcam_ofs + f1_ofs + 6, 1 656 ); 657 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 658 _bcmFieldSliceSelFpf1, 5, 659 fp_tcam_ofs + f1_ofs + 7, 1 660 ); 661 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 662 _bcmFieldSliceSelFpf1, 5, 663 fp_tcam_ofs + f1_ofs + 8, 1 664 ); 665 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 666 _bcmFieldSliceSelFpf1, 5, 667 fp_tcam_ofs + f1_ofs + 9, 1 668 ); 669 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 670 _bcmFieldSliceSelFpf1, 5, 671 fp_tcam_ofs + f1_ofs + 10, 1 672 ); 673 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 674 _bcmFieldSliceSelFpf1, 5, 675 fp_tcam_ofs + f1_ofs + 10, 1 676 ); 677 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 678 _bcmFieldSliceSelFpf1, 5, 679 fp_tcam_ofs + f1_ofs + 11, 1 680 ); 681 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 682 _bcmFieldSliceSelFpf1, 5, 683 fp_tcam_ofs + f1_ofs + 12, 1 684 ); 685 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 686 _bcmFieldSliceSelFpf1, 5, 687 fp_tcam_ofs + f1_ofs + 13, 1 688 ); 689 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 690 _bcmFieldSliceSelFpf1, 5, 691 fp_tcam_ofs + f1_ofs + 14, 1 692 ); 693 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit, 694 _bcmFieldSliceSelFpf1, 5, 695 fp_tcam_ofs + f1_ofs + 15, 1 696 ); 697 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit, 698 _bcmFieldSliceSelFpf1, 5, 699 fp_tcam_ofs + f1_ofs + 16, 1 700 ); 701 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit, 702 _bcmFieldSliceSelFpf1, 5, 703 fp_tcam_ofs + f1_ofs + 16, 1 704 ); 705 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit, 706 _bcmFieldSliceSelFpf1, 5, 707 fp_tcam_ofs + f1_ofs + 16, 1 708 ); 709 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit, 710 _bcmFieldSliceSelFpf1, 5, 711 fp_tcam_ofs + f1_ofs + 16, 1 712 ); 713 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit, 714 _bcmFieldSliceSelFpf1, 5, 715 fp_tcam_ofs + f1_ofs + 17, 1 716 ); 717 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit, 718 _bcmFieldSliceSelFpf1, 5, 719 fp_tcam_ofs + f1_ofs + 17, 1 720 ); 721 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit, 722 _bcmFieldSliceSelFpf1, 5, 723 fp_tcam_ofs + f1_ofs + 17, 1 724 ); 725 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit, 726 _bcmFieldSliceSelFpf1, 5, 727 fp_tcam_ofs + f1_ofs + 17, 1 728 ); 729 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 730 _bcmFieldSliceSelFpf1, 5, 731 fp_tcam_ofs + f1_ofs + 20, 6 732 ); 733 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 734 _bcmFieldSliceSelFpf1, 5, 735 fp_tcam_ofs + f1_ofs + 26, 16 736 ); 737 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 738 _bcmFieldSliceSelFpf1, 5, 739 fp_tcam_ofs + f1_ofs + 26, 12 740 ); 741 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 742 _bcmFieldSliceSelFpf1, 5, 743 fp_tcam_ofs + f1_ofs + 26 + 12, 1 744 ); 745 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 746 _bcmFieldSliceSelFpf1, 5, 747 fp_tcam_ofs + f1_ofs + 26 + 13, 3 748 ); 749 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid, 750 _bcmFieldSliceSelFpf1, 5, 751 fp_tcam_ofs + f1_ofs + 42, 2 752 ); 753 754 /* FPF1 = 6 */ 755 756 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 757 _bcmFieldSliceSelFpf1, 6, 758 fp_tcam_ofs + f1_ofs, 16 759 ); 760 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 761 _bcmFieldSliceSelFpf1, 6, 762 fp_tcam_ofs + f1_ofs, 12 763 ); 764 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 765 _bcmFieldSliceSelFpf1, 6, 766 fp_tcam_ofs + f1_ofs + 12, 1 767 ); 768 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 769 _bcmFieldSliceSelFpf1, 6, 770 fp_tcam_ofs + f1_ofs + 13, 3 771 ); 772 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 773 _bcmFieldSliceSelFpf1, 6, 774 fp_tcam_ofs + f1_ofs + 16, 2 775 ); 776 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 777 _bcmFieldSliceSelFpf1, 6, 778 fp_tcam_ofs + f1_ofs + 16 + 2, 2 779 ); 780 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 781 _bcmFieldSliceSelFpf1, 6, 782 fp_tcam_ofs + f1_ofs + 20, 2 783 ); 784 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 785 _bcmFieldSliceSelFpf1, 6, 786 fp_tcam_ofs + f1_ofs + 22, 3 787 ); 788 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 789 _bcmFieldSliceSelFpf1, 6, 790 fp_tcam_ofs + f1_ofs + 25, 6 791 ); 792 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo, 793 _bcmFieldSliceSelFpf1, 6, 794 fp_tcam_ofs + f1_ofs + 31, 3 795 ); 796 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter, 797 _bcmFieldSliceSelFpf1, 6, 798 fp_tcam_ofs + f1_ofs + 34, 3 799 ); 800 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner, 801 _bcmFieldSliceSelFpf1, 6, 802 fp_tcam_ofs + f1_ofs + 37, 3 803 ); 804 805 /* FPF1 = 7 */ 806 807 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 808 _bcmFieldSliceSelFpf1, 7, 809 fp_tcam_ofs + f1_ofs, 16 810 ); 811 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 812 _bcmFieldSliceSelFpf1, 7, 813 fp_tcam_ofs + f1_ofs, 12 814 ); 815 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 816 _bcmFieldSliceSelFpf1, 7, 817 fp_tcam_ofs + f1_ofs + 12, 1 818 ); 819 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 820 _bcmFieldSliceSelFpf1, 7, 821 fp_tcam_ofs + f1_ofs + 13, 3 822 ); 823 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 824 _bcmFieldSliceSelFpf1, 7, 825 _bcmFieldSliceSrcClassSelect, 0, 826 fp_tcam_ofs + f1_ofs + 16, 10 827 ); 828 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 829 _bcmFieldSliceSelFpf1, 7, 830 _bcmFieldSliceSrcClassSelect, 1, 831 fp_tcam_ofs + f1_ofs + 16, 10 832 ); 833 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 834 _bcmFieldSliceSelFpf1, 7, 835 _bcmFieldSliceSrcClassSelect, 2, 836 fp_tcam_ofs + f1_ofs + 16, 10 837 ); 838 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 839 _bcmFieldSliceSelFpf1, 7, 840 _bcmFieldSliceSrcClassSelect, 3, 841 fp_tcam_ofs + f1_ofs + 16, 10 842 ); 843 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 844 _bcmFieldSliceSelFpf1, 7, 845 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 846 fp_tcam_ofs + f1_ofs + 26, 14 847 ); 848 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 849 _bcmFieldSliceSelFpf1, 7, 850 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 851 fp_tcam_ofs + f1_ofs + 26, 14 852 ); 853 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 854 _bcmFieldSliceSelFpf1, 7, 855 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 856 fp_tcam_ofs + f1_ofs + 26, 14 857 ); 858 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid, 859 _bcmFieldSliceSelFpf1, 7, 860 fp_tcam_ofs + f1_ofs + 40, 1 861 ); 862 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid, 863 _bcmFieldSliceSelFpf1, 7, 864 fp_tcam_ofs + f1_ofs + 41, 1 865 ); 866 867 /* FPF1 = 8 */ 868 869 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 870 _bcmFieldSliceSelFpf1, 8, 871 fp_tcam_ofs + f1_ofs, 8 872 ); 873 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 874 _bcmFieldSliceSelFpf1, 8, 875 _bcmFieldSliceTosClassSelect, 0, 876 fp_tcam_ofs + f1_ofs + 8, 8 877 ); 878 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 879 _bcmFieldSliceSelFpf1, 8, 880 _bcmFieldSliceTosClassSelect, 0, 881 fp_tcam_ofs + f1_ofs + 8, 8 882 ); 883 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 884 _bcmFieldSliceSelFpf1, 8, 885 _bcmFieldSliceTosClassSelect, 1, 886 fp_tcam_ofs + f1_ofs + 8, 8 887 ); 888 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 889 _bcmFieldSliceSelFpf1, 8, 890 _bcmFieldSliceSrcClassSelect, 0, 891 fp_tcam_ofs + f1_ofs + 16, 10 892 ); 893 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 894 _bcmFieldSliceSelFpf1, 8, 895 _bcmFieldSliceSrcClassSelect, 1, 896 fp_tcam_ofs + f1_ofs + 16, 10 897 ); 898 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 899 _bcmFieldSliceSelFpf1, 8, 900 _bcmFieldSliceSrcClassSelect, 2, 901 fp_tcam_ofs + f1_ofs + 16, 10 902 ); 903 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 904 _bcmFieldSliceSelFpf1, 8, 905 _bcmFieldSliceSrcClassSelect, 3, 906 fp_tcam_ofs + f1_ofs + 16, 10 907 ); 908 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 909 _bcmFieldSliceSelFpf1, 8, 910 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 911 fp_tcam_ofs + f1_ofs + 26, 14 912 ); 913 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 914 _bcmFieldSliceSelFpf1, 8, 915 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 916 fp_tcam_ofs + f1_ofs + 26, 14 917 ); 918 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 919 _bcmFieldSliceSelFpf1, 8, 920 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 921 fp_tcam_ofs + f1_ofs + 26, 14 922 ); 923 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal, 924 _bcmFieldSliceSelFpf1, 8, 925 fp_tcam_ofs + f1_ofs + 40, 1 926 ); 927 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpAddrsNormalized, 928 _bcmFieldSliceSelFpf1, 8, 929 fp_tcam_ofs + f1_ofs + 41, 1 930 ); 931 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized, 932 _bcmFieldSliceSelFpf1, 8, 933 fp_tcam_ofs + f1_ofs + 42, 1 934 ); 935 936 /* FPF1 = 9 */ 937 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData2, 938 _bcmFieldSliceSelFpf1, 9, 939 fp_tcam_ofs + f1_ofs, 32 940 ); 941 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid, 942 _bcmFieldSliceSelFpf1, 9, 943 fp_tcam_ofs + f1_ofs + 32, 1 944 ); 945 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid, 946 _bcmFieldSliceSelFpf1, 9, 947 fp_tcam_ofs + f1_ofs + 33, 1 948 ); 949 950 /* 951 * FPF1=9 - UDF1_31_0 952 */ 953 954 /* FPF1 = 10 */ 955 956 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 957 _bcmFieldSliceSelFpf1, 10, 958 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 959 fp_tcam_ofs + f1_ofs, 21 960 ); 961 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 962 _bcmFieldSliceSelFpf1, 10, 963 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 964 fp_tcam_ofs + f1_ofs, 21 965 ); 966 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 967 _bcmFieldSliceSelFpf1, 10, 968 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 969 fp_tcam_ofs + f1_ofs, 21 970 ); 971 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 972 _bcmFieldSliceSelFpf1, 10, 973 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 974 fp_tcam_ofs + f1_ofs, 21 975 ); 976 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 977 _bcmFieldSliceSelFpf1, 10, 978 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 979 fp_tcam_ofs + f1_ofs, 21 980 ); 981 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 982 _bcmFieldSliceSelFpf1, 10, 983 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 984 fp_tcam_ofs + f1_ofs, 21 985 ); 986 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 987 _bcmFieldSliceSelFpf1, 10, 988 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 989 fp_tcam_ofs + f1_ofs, 21 990 ); 991 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 992 _bcmFieldSliceSelFpf1, 10, 993 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 994 fp_tcam_ofs + f1_ofs, 21 995 ); 996 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 997 _bcmFieldSliceSelFpf1, 10, 998 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 999 fp_tcam_ofs + f1_ofs, 21 1000 ); 1001 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 1002 _bcmFieldSliceSelFpf1, 10, 1003 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 1004 fp_tcam_ofs + f1_ofs, 21 1005 ); 1006 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 1007 _bcmFieldSliceSelFpf1, 10, 1008 fp_tcam_ofs + f1_ofs + 21, 16 1009 ); 1010 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 1011 _bcmFieldSliceSelFpf1, 10, 1012 fp_tcam_ofs + f1_ofs + 21, 16 1013 ); 1014 1015 /* FPF1 = 11 */ 1016 1017 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 1018 _bcmFieldSliceSelFpf1, 11, 1019 fp_tcam_ofs + f1_ofs, 16 1020 ); 1021 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 1022 _bcmFieldSliceSelFpf1, 11, 1023 fp_tcam_ofs + f1_ofs, 16 1024 ); 1025 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 1026 _bcmFieldSliceSelFpf1, 11, 1027 fp_tcam_ofs + f1_ofs, 16 1028 ); 1029 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 1030 _bcmFieldSliceSelFpf1, 11, 1031 fp_tcam_ofs + f1_ofs + 7, 9 1032 ); 1033 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 1034 _bcmFieldSliceSelFpf1, 11, 1035 fp_tcam_ofs + f1_ofs + 16, 17 1036 ); 1037 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 1038 _bcmFieldSliceSelFpf1, 11, 1039 fp_tcam_ofs + f1_ofs + 16, 17 1040 ); 1041 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 1042 _bcmFieldSliceSelFpf1, 11, 1043 fp_tcam_ofs + f1_ofs + 16, 17 1044 ); 1045 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 1046 _bcmFieldSliceSelFpf1, 11, 1047 fp_tcam_ofs + f1_ofs + 16, 17 1048 ); 1049 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 1050 _bcmFieldSliceSelFpf1, 11, 1051 fp_tcam_ofs + f1_ofs + 32, 1 1052 ); 1053 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 1054 _bcmFieldSliceSelFpf1, 11, 1055 fp_tcam_ofs + f1_ofs + 33, 4 1056 ); 1057 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor, 1058 _bcmFieldSliceSelFpf1, 11, 1059 fp_tcam_ofs + f1_ofs + 37, 2 1060 ); 1061 1062 /* FPF1 = 12 */ 1063 1064 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1065 _bcmFieldSliceSelFpf1, 12, 1066 fp_tcam_ofs + f1_ofs, 12 1067 ); 1068 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 1069 _bcmFieldSliceSelFpf1, 12, 1070 _bcmFieldSliceSrcClassSelect, 0, 1071 fp_tcam_ofs + f1_ofs + 12, 10 1072 ); 1073 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 1074 _bcmFieldSliceSelFpf1, 12, 1075 _bcmFieldSliceSrcClassSelect, 1, 1076 fp_tcam_ofs + f1_ofs + 12, 10 1077 ); 1078 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 1079 _bcmFieldSliceSelFpf1, 12, 1080 _bcmFieldSliceSrcClassSelect, 2, 1081 fp_tcam_ofs + f1_ofs + 12, 10 1082 ); 1083 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 1084 _bcmFieldSliceSelFpf1, 12, 1085 _bcmFieldSliceSrcClassSelect, 3, 1086 fp_tcam_ofs + f1_ofs + 12, 10 1087 ); 1088 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 1089 _bcmFieldSliceSelFpf1, 12, 1090 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMplsGport, 1091 fp_tcam_ofs + f1_ofs + 22, 16 1092 ); 1093 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 1094 _bcmFieldSliceSelFpf1, 12, 1095 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityVlanGport, 1096 fp_tcam_ofs + f1_ofs + 22, 16 1097 ); 1098 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 1099 _bcmFieldSliceSelFpf1, 12, 1100 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMimGport, 1101 fp_tcam_ofs + f1_ofs + 22, 16 1102 ); 1103 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 1104 _bcmFieldSliceSelFpf1, 12, 1105 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 1106 fp_tcam_ofs + f1_ofs + 22, 16 1107 ); 1108 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 1109 _bcmFieldSliceSelFpf1, 12, 1110 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityWlanGport, 1111 fp_tcam_ofs + f1_ofs + 22, 16 1112 ); 1113 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 1114 _bcmFieldSliceSelFpf1, 12, 1115 _bcmFieldSliceDstClassSelect, 0, 1116 fp_tcam_ofs + f1_ofs + 38, 10 1117 ); 1118 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 1119 _bcmFieldSliceSelFpf1, 12, 1120 _bcmFieldSliceDstClassSelect, 1, 1121 fp_tcam_ofs + f1_ofs + 38, 10 1122 ); 1123 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 1124 _bcmFieldSliceSelFpf1, 12, 1125 _bcmFieldSliceDstClassSelect, 2, 1126 fp_tcam_ofs + f1_ofs + 38, 10 1127 ); 1128 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 1129 _bcmFieldSliceSelFpf1, 12, 1130 _bcmFieldSliceDstClassSelect, 3, 1131 fp_tcam_ofs + f1_ofs + 38, 10 1132 ); 1133 1134 /* FPF1 = 13 */ 1135 1136 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag, 1137 _bcmFieldSliceSelFpf1, 13, 1138 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagVn, 1139 fp_tcam_ofs + f1_ofs, 33 1140 ); 1141 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag, 1142 _bcmFieldSliceSelFpf1, 13, 1143 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagCn, 1144 fp_tcam_ofs + f1_ofs, 33 1145 ); 1146 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag, 1147 _bcmFieldSliceSelFpf1, 13, 1148 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagFabricQueue, 1149 fp_tcam_ofs + f1_ofs, 33 1150 ); 1151 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabel, 1152 _bcmFieldSliceSelFpf1, 13, 1153 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 1154 fp_tcam_ofs + f1_ofs, 33 1155 ); 1156 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelTtl, 1157 _bcmFieldDevSelDisable, 0, 1158 _bcmFieldSliceSelFpf1, 13, 1159 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 1160 0, 1161 fp_tcam_ofs + f1_ofs, 8, 1162 fp_tcam_ofs + f1_ofs + 32, 1, 1163 0, 0, 1164 0 1165 ); 1166 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelBos, 1167 _bcmFieldDevSelDisable, 0, 1168 _bcmFieldSliceSelFpf1, 13, 1169 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 1170 0, 1171 fp_tcam_ofs + f1_ofs + 8, 1, 1172 fp_tcam_ofs + f1_ofs + 32, 1, 1173 0, 0, 1174 0 1175 ); 1176 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelExp, 1177 _bcmFieldDevSelDisable, 0, 1178 _bcmFieldSliceSelFpf1, 13, 1179 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 1180 0, 1181 fp_tcam_ofs + f1_ofs + 9, 3, 1182 fp_tcam_ofs + f1_ofs + 32, 1, 1183 0, 0, 1184 0 1185 ); 1186 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelId, 1187 _bcmFieldSliceSelFpf1, 13, 1188 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 1189 fp_tcam_ofs + f1_ofs + 12, 21 1190 ); 1191 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord, 1192 _bcmFieldSliceSelFpf1, 13, 1193 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsCntlWord, 1194 fp_tcam_ofs + f1_ofs, 33 1195 ); 1196 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper, 1197 _bcmFieldSliceSelFpf1, 13, 1198 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7A, 1199 fp_tcam_ofs + f1_ofs + 16, 17 1200 ); 1201 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower, 1202 _bcmFieldDevSelDisable, 0, 1203 _bcmFieldSliceSelFpf1, 13, 1204 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7A, 1205 0, 1206 fp_tcam_ofs + f1_ofs, 16, 1207 fp_tcam_ofs + f1_ofs + 32, 1, 1208 0, 0, 1209 0 1210 ); 1211 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper, 1212 _bcmFieldSliceSelFpf1, 13, 1213 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7B, 1214 fp_tcam_ofs + f1_ofs + 16, 17 1215 ); 1216 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower, 1217 _bcmFieldDevSelDisable, 0, 1218 _bcmFieldSliceSelFpf1, 13, 1219 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7B, 1220 0, 1221 fp_tcam_ofs + f1_ofs, 16, 1222 fp_tcam_ofs + f1_ofs + 32, 1, 1223 0, 0, 1224 0 1225 ); 1226 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction, 1227 _bcmFieldSliceSelFpf1, 13, 1228 fp_tcam_ofs + f1_ofs + 33, 3 1229 ); 1230 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid, 1231 _bcmFieldSliceSelFpf1, 13, 1232 fp_tcam_ofs + f1_ofs + 36, 1 1233 ); 1234 1235 /***** FPF2 single-wide *****/ 1236 1237 /* FPF2 = 0 */ 1238 1239 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1240 _bcmFieldSliceSelFpf2, 0, 1241 _bcmFieldSliceTtlClassSelect, 0, 1242 fp_tcam_ofs + f2_ofs, 8 1243 ); 1244 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 1245 _bcmFieldSliceSelFpf2, 0, 1246 _bcmFieldSliceTtlClassSelect, 0, 1247 fp_tcam_ofs + f2_ofs, 8 1248 ); 1249 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 1250 _bcmFieldSliceSelFpf2, 0, 1251 _bcmFieldSliceTtlClassSelect, 1, 1252 fp_tcam_ofs + f2_ofs, 8 1253 ); 1254 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 1255 _bcmFieldSliceSelFpf2, 0, 1256 _bcmFieldSliceTcpClassSelect, 0, 1257 fp_tcam_ofs + f2_ofs + 8, 6 1258 ); 1259 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero, 1260 _bcmFieldSliceSelFpf2, 0, 1261 _bcmFieldSliceTcpClassSelect, 0, 1262 fp_tcam_ofs + f2_ofs + 8, 6 1263 ); 1264 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne, 1265 _bcmFieldSliceSelFpf2, 0, 1266 _bcmFieldSliceTcpClassSelect, 1, 1267 fp_tcam_ofs + f2_ofs + 8, 6 1268 ); 1269 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFlags, 1270 _bcmFieldSliceSelFpf2, 0, 1271 fp_tcam_ofs + f2_ofs + 14, 2 1272 ); 1273 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 1274 _bcmFieldSliceSelFpf2, 0, 1275 _bcmFieldSliceTosClassSelect, 0, 1276 fp_tcam_ofs + f2_ofs + 16, 8 1277 ); 1278 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 1279 _bcmFieldSliceSelFpf2, 0, 1280 _bcmFieldSliceTosClassSelect, 0, 1281 fp_tcam_ofs + f2_ofs + 16, 8 1282 ); 1283 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 1284 _bcmFieldSliceSelFpf2, 0, 1285 _bcmFieldSliceTosClassSelect, 1, 1286 fp_tcam_ofs + f2_ofs + 16, 8 1287 ); 1288 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 1289 _bcmFieldSliceSelFpf2, 0, 1290 fp_tcam_ofs + f2_ofs + 24, 16 1291 ); 1292 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 1293 _bcmFieldSliceSelFpf2, 0, 1294 fp_tcam_ofs + f2_ofs + 40, 16 1295 ); 1296 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode, 1297 _bcmFieldSliceSelFpf2, 0, 1298 fp_tcam_ofs + f2_ofs + 40, 16 1299 ); 1300 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1301 _bcmFieldSliceSelFpf2, 0, 1302 fp_tcam_ofs + f2_ofs + 56, 8 1303 ); 1304 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 1305 _bcmFieldSliceSelFpf2, 0, 1306 fp_tcam_ofs + f2_ofs + 64, 32 1307 ); 1308 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 1309 _bcmFieldSliceSelFpf2, 0, 1310 fp_tcam_ofs + f2_ofs + 96, 32 1311 ); 1312 1313 /* FPF2 = 1 */ 1314 1315 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1316 _bcmFieldSliceSelFpf2, 1, 1317 _bcmFieldSliceTtlClassSelect, 0, 1318 fp_tcam_ofs + f2_ofs, 8 1319 ); 1320 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 1321 _bcmFieldSliceSelFpf2, 1, 1322 _bcmFieldSliceTtlClassSelect, 0, 1323 fp_tcam_ofs + f2_ofs, 8 1324 ); 1325 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 1326 _bcmFieldSliceSelFpf2, 1, 1327 _bcmFieldSliceTtlClassSelect, 1, 1328 fp_tcam_ofs + f2_ofs, 8 1329 ); 1330 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 1331 _bcmFieldSliceSelFpf2, 1, 1332 _bcmFieldSliceTcpClassSelect, 0, 1333 fp_tcam_ofs + f2_ofs + 8, 6 1334 ); 1335 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero, 1336 _bcmFieldSliceSelFpf2, 1, 1337 _bcmFieldSliceTcpClassSelect, 0, 1338 fp_tcam_ofs + f2_ofs + 8, 6 1339 ); 1340 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne, 1341 _bcmFieldSliceSelFpf2, 1, 1342 _bcmFieldSliceTcpClassSelect, 1, 1343 fp_tcam_ofs + f2_ofs + 8, 6 1344 ); 1345 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 1346 _bcmFieldSliceSelFpf2, 1, 1347 fp_tcam_ofs + f2_ofs + 14, 2 1348 ); 1349 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 1350 _bcmFieldSliceSelFpf2, 1, 1351 _bcmFieldSliceTosClassSelect, 0, 1352 fp_tcam_ofs + f2_ofs + 16, 8 1353 ); 1354 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 1355 _bcmFieldSliceSelFpf2, 1, 1356 _bcmFieldSliceTosClassSelect, 0, 1357 fp_tcam_ofs + f2_ofs + 16, 8 1358 ); 1359 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 1360 _bcmFieldSliceSelFpf2, 1, 1361 _bcmFieldSliceTosClassSelect, 1, 1362 fp_tcam_ofs + f2_ofs + 16, 8 1363 ); 1364 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 1365 _bcmFieldSliceSelFpf2, 1, 1366 fp_tcam_ofs + f2_ofs + 24, 16 1367 ); 1368 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 1369 _bcmFieldSliceSelFpf2, 1, 1370 fp_tcam_ofs + f2_ofs + 40, 16 1371 ); 1372 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode, 1373 _bcmFieldSliceSelFpf2, 1, 1374 fp_tcam_ofs + f2_ofs + 40, 16 1375 ); 1376 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1377 _bcmFieldSliceSelFpf2, 1, 1378 fp_tcam_ofs + f2_ofs + 56, 8 1379 ); 1380 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 1381 _bcmFieldSliceSelFpf2, 1, 1382 fp_tcam_ofs + f2_ofs + 64, 32 1383 ); 1384 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 1385 _bcmFieldSliceSelFpf2, 1, 1386 fp_tcam_ofs + f2_ofs + 96, 32 1387 ); 1388 1389 /* FPF2 = 2 */ 1390 1391 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 1392 _bcmFieldSliceSelFpf2, 2, 1393 fp_tcam_ofs + f2_ofs, 128 1394 ); 1395 1396 /* FPF2 = 3 */ 1397 1398 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 1399 _bcmFieldSliceSelFpf2, 3, 1400 fp_tcam_ofs + f2_ofs, 128 1401 ); 1402 1403 /* FPF2 = 4 */ 1404 1405 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1406 _bcmFieldSliceSelFpf2, 4, 1407 _bcmFieldSliceTtlClassSelect, 0, 1408 fp_tcam_ofs + f2_ofs, 8 1409 ); 1410 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 1411 _bcmFieldSliceSelFpf2, 4, 1412 _bcmFieldSliceTtlClassSelect, 0, 1413 fp_tcam_ofs + f2_ofs, 8 1414 ); 1415 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 1416 _bcmFieldSliceSelFpf2, 4, 1417 _bcmFieldSliceTtlClassSelect, 1, 1418 fp_tcam_ofs + f2_ofs, 8 1419 ); 1420 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 1421 _bcmFieldSliceSelFpf2, 4, 1422 _bcmFieldSliceTcpClassSelect, 0, 1423 fp_tcam_ofs + f2_ofs + 8, 6 1424 ); 1425 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero, 1426 _bcmFieldSliceSelFpf2, 4, 1427 _bcmFieldSliceTcpClassSelect, 0, 1428 fp_tcam_ofs + f2_ofs + 8, 6 1429 ); 1430 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne, 1431 _bcmFieldSliceSelFpf2, 4, 1432 _bcmFieldSliceTcpClassSelect, 1, 1433 fp_tcam_ofs + f2_ofs + 8, 6 1434 ); 1435 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel, 1436 _bcmFieldSliceSelFpf2, 4, 1437 fp_tcam_ofs + f2_ofs + 14, 20 1438 ); 1439 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 1440 _bcmFieldSliceSelFpf2, 4, 1441 _bcmFieldSliceTosClassSelect, 0, 1442 fp_tcam_ofs + f2_ofs + 34, 8 1443 ); 1444 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 1445 _bcmFieldSliceSelFpf2, 4, 1446 _bcmFieldSliceTosClassSelect, 0, 1447 fp_tcam_ofs + f2_ofs + 34, 8 1448 ); 1449 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 1450 _bcmFieldSliceSelFpf2, 4, 1451 _bcmFieldSliceTosClassSelect, 1, 1452 fp_tcam_ofs + f2_ofs + 34, 8 1453 ); 1454 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1455 _bcmFieldSliceSelFpf2, 4, 1456 fp_tcam_ofs + f2_ofs + 42, 8 1457 ); 1458 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 1459 _bcmFieldSliceSelFpf2, 4, 1460 fp_tcam_ofs + f2_ofs + 64, 64 1461 ); 1462 1463 /* FPF2 = 5 */ 1464 1465 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1466 _bcmFieldSliceSelFpf2, 5, 1467 fp_tcam_ofs + f2_ofs, 16 1468 ); 1469 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1470 _bcmFieldSliceSelFpf2, 5, 1471 fp_tcam_ofs + f2_ofs, 12 1472 ); 1473 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1474 _bcmFieldSliceSelFpf2, 5, 1475 fp_tcam_ofs + f2_ofs + 12, 1 1476 ); 1477 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1478 _bcmFieldSliceSelFpf2, 5, 1479 fp_tcam_ofs + f2_ofs + 13, 3 1480 ); 1481 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 1482 _bcmFieldSliceSelFpf2, 5, 1483 fp_tcam_ofs + f2_ofs + 16, 16 1484 ); 1485 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 1486 _bcmFieldSliceSelFpf2, 5, 1487 fp_tcam_ofs + f2_ofs + 32, 48 1488 ); 1489 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 1490 _bcmFieldSliceSelFpf2, 5, 1491 fp_tcam_ofs + f2_ofs + 80, 48 1492 ); 1493 1494 /* FPF2 = 6 */ 1495 1496 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1497 _bcmFieldSliceSelFpf2, 6, 1498 fp_tcam_ofs + f2_ofs, 16 1499 ); 1500 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1501 _bcmFieldSliceSelFpf2, 6, 1502 fp_tcam_ofs + f2_ofs, 12 1503 ); 1504 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1505 _bcmFieldSliceSelFpf2, 6, 1506 fp_tcam_ofs + f2_ofs + 12, 1 1507 ); 1508 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1509 _bcmFieldSliceSelFpf2, 6, 1510 fp_tcam_ofs + f2_ofs + 13, 3 1511 ); 1512 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 1513 _bcmFieldSliceSelFpf2, 6, 1514 fp_tcam_ofs + f2_ofs + 16, 16 1515 ); 1516 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 1517 _bcmFieldSliceSelFpf2, 6, 1518 fp_tcam_ofs + f2_ofs + 32, 48 1519 ); 1520 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 1521 _bcmFieldSliceSelFpf2, 6, 1522 fp_tcam_ofs + f2_ofs + 80, 32 1523 ); 1524 1525 /* FPF2 = 7 */ 1526 1527 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1528 _bcmFieldSliceSelFpf2, 7, 1529 fp_tcam_ofs + f2_ofs, 16 1530 ); 1531 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1532 _bcmFieldSliceSelFpf2, 7, 1533 fp_tcam_ofs + f2_ofs, 12 1534 ); 1535 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1536 _bcmFieldSliceSelFpf2, 7, 1537 fp_tcam_ofs + f2_ofs + 12, 1 1538 ); 1539 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1540 _bcmFieldSliceSelFpf2, 7, 1541 fp_tcam_ofs + f2_ofs + 13, 3 1542 ); 1543 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 1544 _bcmFieldSliceSelFpf2, 7, 1545 fp_tcam_ofs + f2_ofs + 16, 16 1546 ); 1547 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1548 _bcmFieldSliceSelFpf2, 7, 1549 _bcmFieldSliceTtlClassSelect, 0, 1550 fp_tcam_ofs + f2_ofs + 32, 8 1551 ); 1552 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 1553 _bcmFieldSliceSelFpf2, 7, 1554 _bcmFieldSliceTtlClassSelect, 0, 1555 fp_tcam_ofs + f2_ofs + 32, 8 1556 ); 1557 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 1558 _bcmFieldSliceSelFpf2, 7, 1559 _bcmFieldSliceTtlClassSelect, 1, 1560 fp_tcam_ofs + f2_ofs + 32, 8 1561 ); 1562 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1563 _bcmFieldSliceSelFpf2, 7, 1564 fp_tcam_ofs + f2_ofs + 40, 8 1565 ); 1566 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 1567 _bcmFieldSliceSelFpf2, 7, 1568 fp_tcam_ofs + f2_ofs + 48, 32 1569 ); 1570 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 1571 _bcmFieldSliceSelFpf2, 7, 1572 fp_tcam_ofs + f2_ofs + 80, 48 1573 ); 1574 1575 /* FPF2 = 8 */ 1576 1577 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0, 1578 _bcmFieldSliceSelFpf2, 8, 1579 fp_tcam_ofs + f2_ofs, 128 1580 ); 1581 1582 /* FPF2 = 9 */ 1583 1584 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1, 1585 _bcmFieldSliceSelFpf2, 9, 1586 fp_tcam_ofs + f2_ofs, 128 1587 ); 1588 1589 /* FPF2 = 10 */ 1590 1591 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High, 1592 _bcmFieldSliceSelFpf2, 10, 1593 fp_tcam_ofs + f2_ofs, 64 1594 ); 1595 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 1596 _bcmFieldSliceSelFpf2, 10, 1597 fp_tcam_ofs + f2_ofs + 64, 64 1598 ); 1599 1600 /* FPF2 = 11 */ 1601 1602 /* 1603 * DIP_127_96 omitted -- no qualifier? Omitted in Trident, too. 1604 */ 1605 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 1606 _bcmFieldSliceSelFpf2, 11, 1607 fp_tcam_ofs + f2_ofs + 32, 48 1608 ); 1609 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 1610 _bcmFieldSliceSelFpf2, 11, 1611 fp_tcam_ofs + f2_ofs + 80, 48 1612 ); 1613 1614 /***** FPF3 single-wide *****/ 1615 1616 /* FPF3 = 0 */ 1617 1618 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 1619 _bcmFieldSliceSelFpf3, 0, 1620 _bcmFieldSliceSrcClassSelect, 0, 1621 _bcmFieldSliceFpf3SrcDstClassSelect, 0, 1622 fp_tcam_ofs + f3_ofs, 10 1623 ); 1624 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 1625 _bcmFieldSliceSelFpf3, 0, 1626 _bcmFieldSliceSrcClassSelect, 1, 1627 _bcmFieldSliceFpf3SrcDstClassSelect, 0, 1628 fp_tcam_ofs + f3_ofs, 10 1629 ); 1630 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 1631 _bcmFieldSliceSelFpf3, 0, 1632 _bcmFieldSliceSrcClassSelect, 2, 1633 _bcmFieldSliceFpf3SrcDstClassSelect, 0, 1634 fp_tcam_ofs + f3_ofs, 10 1635 ); 1636 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 1637 _bcmFieldSliceSelFpf3, 0, 1638 _bcmFieldSliceSrcClassSelect, 3, 1639 _bcmFieldSliceFpf3SrcDstClassSelect, 0, 1640 fp_tcam_ofs + f3_ofs, 10 1641 ); 1642 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 1643 _bcmFieldSliceSelFpf3, 0, 1644 _bcmFieldSliceDstClassSelect, 0, 1645 _bcmFieldSliceFpf3SrcDstClassSelect, 1, 1646 fp_tcam_ofs + f3_ofs, 10 1647 ); 1648 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 1649 _bcmFieldSliceSelFpf3, 0, 1650 _bcmFieldSliceDstClassSelect, 1, 1651 _bcmFieldSliceFpf3SrcDstClassSelect, 1, 1652 fp_tcam_ofs + f3_ofs, 10 1653 ); 1654 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 1655 _bcmFieldSliceSelFpf3, 0, 1656 _bcmFieldSliceDstClassSelect, 2, 1657 _bcmFieldSliceFpf3SrcDstClassSelect, 1, 1658 fp_tcam_ofs + f3_ofs, 10 1659 ); 1660 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 1661 _bcmFieldSliceSelFpf3, 0, 1662 _bcmFieldSliceDstClassSelect, 3, 1663 _bcmFieldSliceFpf3SrcDstClassSelect, 1, 1664 fp_tcam_ofs + f3_ofs, 10 1665 ); 1666 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 1667 _bcmFieldSliceSelFpf3, 0, 1668 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 1669 fp_tcam_ofs + f3_ofs + 10, 14 1670 ); 1671 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 1672 _bcmFieldSliceSelFpf3, 0, 1673 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 1674 fp_tcam_ofs + f3_ofs + 10, 14 1675 ); 1676 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 1677 _bcmFieldSliceSelFpf3, 0, 1678 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 1679 fp_tcam_ofs + f3_ofs + 10, 14 1680 ); 1681 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 1682 _bcmFieldSliceSelFpf3, 0, 1683 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMplsGport, 1684 fp_tcam_ofs + f3_ofs + 24, 16 1685 ); 1686 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 1687 _bcmFieldSliceSelFpf3, 0, 1688 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityVlanGport, 1689 fp_tcam_ofs + f3_ofs + 24, 16 1690 ); 1691 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 1692 _bcmFieldSliceSelFpf3, 0, 1693 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMimGport, 1694 fp_tcam_ofs + f3_ofs + 24, 16 1695 ); 1696 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 1697 _bcmFieldSliceSelFpf3, 0, 1698 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 1699 fp_tcam_ofs + f3_ofs + 24, 16 1700 ); 1701 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 1702 _bcmFieldSliceSelFpf3, 0, 1703 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityWlanGport, 1704 fp_tcam_ofs + f3_ofs + 24, 16 1705 ); 1706 1707 /* FPF3 = 1 */ 1708 1709 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 1710 _bcmFieldSliceSelFpf3, 1, 1711 _bcmFieldSliceSrcClassSelect, 0, 1712 fp_tcam_ofs + f3_ofs, 10 1713 ); 1714 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 1715 _bcmFieldSliceSelFpf3, 1, 1716 _bcmFieldSliceSrcClassSelect, 1, 1717 fp_tcam_ofs + f3_ofs, 10 1718 ); 1719 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 1720 _bcmFieldSliceSelFpf3, 1, 1721 _bcmFieldSliceSrcClassSelect, 2, 1722 fp_tcam_ofs + f3_ofs, 10 1723 ); 1724 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 1725 _bcmFieldSliceSelFpf3, 1, 1726 _bcmFieldSliceSrcClassSelect, 3, 1727 fp_tcam_ofs + f3_ofs, 10 1728 ); 1729 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 1730 _bcmFieldSliceSelFpf3, 1, 1731 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 1732 fp_tcam_ofs + f3_ofs + 10, 14 1733 ); 1734 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 1735 _bcmFieldSliceSelFpf3, 1, 1736 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 1737 fp_tcam_ofs + f3_ofs + 10, 14 1738 ); 1739 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 1740 _bcmFieldSliceSelFpf3, 1, 1741 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 1742 fp_tcam_ofs + f3_ofs + 10, 14 1743 ); 1744 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1745 _bcmFieldSliceSelFpf3, 1, 1746 fp_tcam_ofs + f3_ofs + 24, 12 1747 ); 1748 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 1749 _bcmFieldSliceSelFpf3, 1, 1750 _bcmFieldSliceDstClassSelect, 0, 1751 fp_tcam_ofs + f3_ofs + 36, 10 1752 ); 1753 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 1754 _bcmFieldSliceSelFpf3, 1, 1755 _bcmFieldSliceDstClassSelect, 1, 1756 fp_tcam_ofs + f3_ofs + 36, 10 1757 ); 1758 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 1759 _bcmFieldSliceSelFpf3, 1, 1760 _bcmFieldSliceDstClassSelect, 2, 1761 fp_tcam_ofs + f3_ofs + 36, 10 1762 ); 1763 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 1764 _bcmFieldSliceSelFpf3, 1, 1765 _bcmFieldSliceDstClassSelect, 3, 1766 fp_tcam_ofs + f3_ofs + 36, 10 1767 ); 1768 1769 /* FPF3 = 2 */ 1770 1771 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 1772 _bcmFieldSliceSelFpf3, 2, 1773 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 1774 fp_tcam_ofs + f3_ofs, 21 1775 ); 1776 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 1777 _bcmFieldSliceSelFpf3, 2, 1778 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 1779 fp_tcam_ofs + f3_ofs, 21 1780 ); 1781 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 1782 _bcmFieldSliceSelFpf3, 2, 1783 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 1784 fp_tcam_ofs + f3_ofs, 21 1785 ); 1786 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 1787 _bcmFieldSliceSelFpf3, 2, 1788 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 1789 fp_tcam_ofs + f3_ofs, 21 1790 ); 1791 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 1792 _bcmFieldSliceSelFpf3, 2, 1793 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 1794 fp_tcam_ofs + f3_ofs, 21 1795 ); 1796 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 1797 _bcmFieldSliceSelFpf3, 2, 1798 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 1799 fp_tcam_ofs + f3_ofs, 21 1800 ); 1801 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 1802 _bcmFieldSliceSelFpf3, 2, 1803 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 1804 fp_tcam_ofs + f3_ofs, 21 1805 ); 1806 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 1807 _bcmFieldSliceSelFpf3, 2, 1808 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 1809 fp_tcam_ofs + f3_ofs, 21 1810 ); 1811 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 1812 _bcmFieldSliceSelFpf3, 2, 1813 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 1814 fp_tcam_ofs + f3_ofs, 21 1815 ); 1816 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 1817 _bcmFieldSliceSelFpf3, 2, 1818 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 1819 fp_tcam_ofs + f3_ofs, 21 1820 ); 1821 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 1822 _bcmFieldSliceSelFpf3, 2, 1823 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 1824 fp_tcam_ofs + f3_ofs + 21, 17 1825 ); 1826 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 1827 _bcmFieldSliceSelFpf3, 2, 1828 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 1829 fp_tcam_ofs + f3_ofs + 21, 17 1830 ); 1831 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 1832 _bcmFieldSliceSelFpf3, 2, 1833 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMplsGport, 1834 fp_tcam_ofs + f3_ofs + 21, 17 1835 ); 1836 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 1837 _bcmFieldSliceSelFpf3, 2, 1838 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVlanGport, 1839 fp_tcam_ofs + f3_ofs + 21, 17 1840 ); 1841 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 1842 _bcmFieldSliceSelFpf3, 2, 1843 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMimGport, 1844 fp_tcam_ofs + f3_ofs + 21, 17 1845 ); 1846 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 1847 _bcmFieldSliceSelFpf3, 2, 1848 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 1849 fp_tcam_ofs + f3_ofs + 21, 17 1850 ); 1851 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 1852 _bcmFieldSliceSelFpf3, 2, 1853 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityWlanGport, 1854 fp_tcam_ofs + f3_ofs + 21, 17 1855 ); 1856 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 1857 _bcmFieldSliceSelFpf3, 2, 1858 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 1859 fp_tcam_ofs + f3_ofs + 21, 17 1860 ); 1861 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport, 1862 _bcmFieldSliceSelFpf3, 2, 1863 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 1864 fp_tcam_ofs + f3_ofs + 21, 17 1865 ); 1866 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 1867 _bcmFieldSliceSelFpf3, 2, 1868 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 1869 fp_tcam_ofs + f3_ofs + 21 + 7, 10 1870 ); 1871 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId, 1872 _bcmFieldSliceSelFpf3, 2, 1873 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 1874 fp_tcam_ofs + f3_ofs + 21 + 7, 8 1875 ); 1876 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 1877 _bcmFieldSliceSelFpf3, 2, 1878 fp_tcam_ofs + f3_ofs + 37, 1 1879 ); 1880 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 1881 _bcmFieldSliceSelFpf3, 2, 1882 fp_tcam_ofs + f3_ofs + 38, 3 1883 ); 1884 1885 /* FPF3 = 3 */ 1886 1887 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1888 _bcmFieldSliceSelFpf3, 3, 1889 fp_tcam_ofs + f3_ofs, 16 1890 ); 1891 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1892 _bcmFieldSliceSelFpf3, 3, 1893 fp_tcam_ofs + f3_ofs, 12 1894 ); 1895 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1896 _bcmFieldSliceSelFpf3, 3, 1897 fp_tcam_ofs + f3_ofs + 12, 1 1898 ); 1899 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1900 _bcmFieldSliceSelFpf3, 3, 1901 fp_tcam_ofs + f3_ofs + 13, 3 1902 ); 1903 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 1904 _bcmFieldSliceSelFpf3, 3, 1905 fp_tcam_ofs + f3_ofs + 16, 2 1906 ); 1907 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 1908 _bcmFieldSliceSelFpf3, 3, 1909 fp_tcam_ofs + f3_ofs + 16 + 2, 2 1910 ); 1911 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 1912 _bcmFieldSliceSelFpf3, 3, 1913 fp_tcam_ofs + f3_ofs + 20, 2 1914 ); 1915 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 1916 _bcmFieldSliceSelFpf3, 3, 1917 fp_tcam_ofs + f3_ofs + 22, 3 1918 ); 1919 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 1920 _bcmFieldSliceSelFpf3, 3, 1921 fp_tcam_ofs + f3_ofs + 25, 6 1922 ); 1923 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo, 1924 _bcmFieldSliceSelFpf3, 3, 1925 fp_tcam_ofs + f3_ofs + 31, 3 1926 ); 1927 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter, 1928 _bcmFieldSliceSelFpf3, 3, 1929 fp_tcam_ofs + f3_ofs + 34, 3 1930 ); 1931 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner, 1932 _bcmFieldSliceSelFpf3, 3, 1933 fp_tcam_ofs + f3_ofs + 37, 3 1934 ); 1935 1936 /* FPF3 = 4 */ 1937 1938 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1939 _bcmFieldSliceSelFpf3, 4, 1940 fp_tcam_ofs + f3_ofs, 16 1941 ); 1942 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1943 _bcmFieldSliceSelFpf3, 4, 1944 fp_tcam_ofs + f3_ofs, 12 1945 ); 1946 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1947 _bcmFieldSliceSelFpf3, 4, 1948 fp_tcam_ofs + f3_ofs + 12, 1 1949 ); 1950 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1951 _bcmFieldSliceSelFpf3, 4, 1952 fp_tcam_ofs + f3_ofs + 13, 3 1953 ); 1954 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 1955 _bcmFieldSliceSelFpf3, 4, 1956 fp_tcam_ofs + f3_ofs + 16, 16 1957 ); 1958 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 1959 _bcmFieldSliceSelFpf3, 4, 1960 fp_tcam_ofs + f3_ofs + 16, 12 1961 ); 1962 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 1963 _bcmFieldSliceSelFpf3, 4, 1964 fp_tcam_ofs + f3_ofs + 16 + 12, 1 1965 ); 1966 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 1967 _bcmFieldSliceSelFpf3, 4, 1968 fp_tcam_ofs + f3_ofs + 16 + 13, 3 1969 ); 1970 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 1971 _bcmFieldSliceSelFpf3, 4, 1972 fp_tcam_ofs + f3_ofs + 32, 4 1973 ); 1974 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor, 1975 _bcmFieldSliceSelFpf3, 4, 1976 fp_tcam_ofs + f3_ofs + 36, 2 1977 ); 1978 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal, 1979 _bcmFieldSliceSelFpf3, 4, 1980 fp_tcam_ofs + f3_ofs + 38, 1 1981 ); 1982 1983 /* FPF3 = 5 */ 1984 1985 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1986 _bcmFieldSliceSelFpf3, 5, 1987 fp_tcam_ofs + f3_ofs, 16 1988 ); 1989 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1990 _bcmFieldSliceSelFpf3, 5, 1991 fp_tcam_ofs + f3_ofs, 12 1992 ); 1993 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1994 _bcmFieldSliceSelFpf3, 5, 1995 fp_tcam_ofs + f3_ofs + 12, 1 1996 ); 1997 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1998 _bcmFieldSliceSelFpf3, 5, 1999 fp_tcam_ofs + f3_ofs + 13, 3 2000 ); 2001 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 2002 _bcmFieldSliceSelFpf3, 5, 2003 fp_tcam_ofs + f3_ofs + 16, 16 2004 ); 2005 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter, 2006 _bcmFieldSliceSelFpf3, 5, 2007 fp_tcam_ofs + f3_ofs + 32, 3 2008 ); 2009 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner, 2010 _bcmFieldSliceSelFpf3, 5, 2011 fp_tcam_ofs + f3_ofs + 35, 3 2012 ); 2013 2014 /* FPF3 = 6 */ 2015 2016 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 2017 _bcmFieldSliceSelFpf3, 6, 2018 fp_tcam_ofs + f3_ofs, 1 2019 ); 2020 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 2021 _bcmFieldSliceSelFpf3, 6, 2022 fp_tcam_ofs + f3_ofs + 1, 1 2023 ); 2024 /* Bit 2 is VXLT0/VXLT1 hit indicator; not used */ 2025 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 2026 _bcmFieldSliceSelFpf3, 6, 2027 fp_tcam_ofs + f3_ofs + 3, 1 2028 ); 2029 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 2030 _bcmFieldSliceSelFpf3, 6, 2031 fp_tcam_ofs + f3_ofs + 4, 2 2032 ); 2033 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 2034 _bcmFieldSliceSelFpf3, 6, 2035 fp_tcam_ofs + f3_ofs + 6, 1 2036 ); 2037 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 2038 _bcmFieldSliceSelFpf3, 6, 2039 fp_tcam_ofs + f3_ofs + 7, 1 2040 ); 2041 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 2042 _bcmFieldSliceSelFpf3, 6, 2043 fp_tcam_ofs + f3_ofs + 8, 1 2044 ); 2045 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 2046 _bcmFieldSliceSelFpf3, 6, 2047 fp_tcam_ofs + f3_ofs + 9, 1 2048 ); 2049 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 2050 _bcmFieldSliceSelFpf3, 6, 2051 fp_tcam_ofs + f3_ofs + 10, 1 2052 ); 2053 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 2054 _bcmFieldSliceSelFpf3, 6, 2055 fp_tcam_ofs + f3_ofs + 10, 1 2056 ); 2057 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 2058 _bcmFieldSliceSelFpf3, 6, 2059 fp_tcam_ofs + f3_ofs + 11, 1 2060 ); 2061 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 2062 _bcmFieldSliceSelFpf3, 6, 2063 fp_tcam_ofs + f3_ofs + 12, 1 2064 ); 2065 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 2066 _bcmFieldSliceSelFpf3, 6, 2067 fp_tcam_ofs + f3_ofs + 13, 1 2068 ); 2069 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 2070 _bcmFieldSliceSelFpf3, 6, 2071 fp_tcam_ofs + f3_ofs + 14, 1 2072 ); 2073 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit, 2074 _bcmFieldSliceSelFpf3, 6, 2075 fp_tcam_ofs + f3_ofs + 15, 1 2076 ); 2077 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit, 2078 _bcmFieldSliceSelFpf3, 6, 2079 fp_tcam_ofs + f3_ofs + 16, 1 2080 ); 2081 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit, 2082 _bcmFieldSliceSelFpf3, 6, 2083 fp_tcam_ofs + f3_ofs + 16, 1 2084 ); 2085 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit, 2086 _bcmFieldSliceSelFpf3, 6, 2087 fp_tcam_ofs + f3_ofs + 16, 1 2088 ); 2089 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit, 2090 _bcmFieldSliceSelFpf3, 6, 2091 fp_tcam_ofs + f3_ofs + 16, 1 2092 ); 2093 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit, 2094 _bcmFieldSliceSelFpf3, 6, 2095 fp_tcam_ofs + f3_ofs + 17, 1 2096 ); 2097 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit, 2098 _bcmFieldSliceSelFpf3, 6, 2099 fp_tcam_ofs + f3_ofs + 17, 1 2100 ); 2101 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit, 2102 _bcmFieldSliceSelFpf3, 6, 2103 fp_tcam_ofs + f3_ofs + 17, 1 2104 ); 2105 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit, 2106 _bcmFieldSliceSelFpf3, 6, 2107 fp_tcam_ofs + f3_ofs + 17, 1 2108 ); 2109 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 2110 _bcmFieldSliceSelFpf3, 6, 2111 fp_tcam_ofs + f3_ofs + 20, 6 2112 ); 2113 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 2114 _bcmFieldSliceSelFpf3, 6, 2115 fp_tcam_ofs + f3_ofs + 26, 16 2116 ); 2117 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 2118 _bcmFieldSliceSelFpf3, 6, 2119 fp_tcam_ofs + f3_ofs + 26, 12 2120 ); 2121 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 2122 _bcmFieldSliceSelFpf3, 6, 2123 fp_tcam_ofs + f3_ofs + 26 + 12, 1 2124 ); 2125 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 2126 _bcmFieldSliceSelFpf3, 6, 2127 fp_tcam_ofs + f3_ofs + 26 + 13, 3 2128 ); 2129 2130 /* FPF3 = 7 */ 2131 2132 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 2133 _bcmFieldSliceSelFpf3, 7, 2134 fp_tcam_ofs + f3_ofs, 24 2135 ); 2136 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31, 2137 _bcmFieldSliceSelFpf3, 7, 2138 _bcmFieldSliceIntfClassSelect, 3, 2139 fp_tcam_ofs + f3_ofs + 24, 8 2140 ); 2141 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 2142 _bcmFieldSliceSelFpf3, 7, 2143 _bcmFieldSliceIntfClassSelect, 0, 2144 fp_tcam_ofs + f3_ofs + 24, 12 2145 ); 2146 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 2147 _bcmFieldSliceSelFpf3, 7, 2148 _bcmFieldSliceIntfClassSelect, 1, 2149 fp_tcam_ofs + f3_ofs + 24, 12 2150 ); 2151 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassVPort, 2152 _bcmFieldSliceSelFpf3, 7, 2153 _bcmFieldSliceIntfClassSelect, 1, 2154 fp_tcam_ofs + f3_ofs + 24, 12 2155 ); 2156 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 2157 _bcmFieldSliceSelFpf3, 7, 2158 _bcmFieldSliceIntfClassSelect, 2, 2159 fp_tcam_ofs + f3_ofs + 24, 12 2160 ); 2161 2162 /* FPF3 = 8 */ 2163 2164 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel, 2165 _bcmFieldSliceSelFpf3, 8, 2166 fp_tcam_ofs + f3_ofs, 20 2167 ); 2168 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 2169 _bcmFieldSliceSelFpf3, 8, 2170 fp_tcam_ofs + f3_ofs + 20, 2 2171 ); 2172 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 2173 _bcmFieldSliceSelFpf3, 8, 2174 fp_tcam_ofs + f3_ofs + 20 + 2, 2 2175 ); 2176 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 2177 _bcmFieldSliceSelFpf3, 8, 2178 fp_tcam_ofs + f3_ofs + 24, 2 2179 ); 2180 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid, 2181 _bcmFieldSliceSelFpf3, 8, 2182 fp_tcam_ofs + f3_ofs + 26, 2 2183 ); 2184 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid, 2185 _bcmFieldSliceSelFpf3, 8, 2186 fp_tcam_ofs + f3_ofs + 28, 2 2187 ); 2188 2189 /* FPF3 = 9 */ 2190 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData3, 2191 _bcmFieldSliceSelFpf3, 9, 2192 fp_tcam_ofs + f3_ofs, 32 2193 ); 2194 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid, 2195 _bcmFieldSliceSelFpf3, 9, 2196 fp_tcam_ofs + f3_ofs + 32, 1 2197 ); 2198 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid, 2199 _bcmFieldSliceSelFpf3, 9, 2200 fp_tcam_ofs + f3_ofs + 33, 1 2201 ); 2202 2203 /* 2204 * FPF3=9 - UDF1_95_64 2205 */ 2206 2207 /* FPF3 = 10 */ 2208 2209 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 2210 _bcmFieldSliceSelFpf3, 10, 2211 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 2212 fp_tcam_ofs + f3_ofs, 21 2213 ); 2214 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 2215 _bcmFieldSliceSelFpf3, 10, 2216 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 2217 fp_tcam_ofs + f3_ofs, 21 2218 ); 2219 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 2220 _bcmFieldSliceSelFpf3, 10, 2221 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 2222 fp_tcam_ofs + f3_ofs, 21 2223 ); 2224 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 2225 _bcmFieldSliceSelFpf3, 10, 2226 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 2227 fp_tcam_ofs + f3_ofs, 21 2228 ); 2229 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 2230 _bcmFieldSliceSelFpf3, 10, 2231 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 2232 fp_tcam_ofs + f3_ofs, 21 2233 ); 2234 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 2235 _bcmFieldSliceSelFpf3, 10, 2236 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 2237 fp_tcam_ofs + f3_ofs, 21 2238 ); 2239 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 2240 _bcmFieldSliceSelFpf3, 10, 2241 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 2242 fp_tcam_ofs + f3_ofs, 21 2243 ); 2244 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 2245 _bcmFieldSliceSelFpf3, 10, 2246 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 2247 fp_tcam_ofs + f3_ofs, 21 2248 ); 2249 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 2250 _bcmFieldSliceSelFpf3, 10, 2251 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 2252 fp_tcam_ofs + f3_ofs, 21 2253 ); 2254 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 2255 _bcmFieldSliceSelFpf3, 10, 2256 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 2257 fp_tcam_ofs + f3_ofs, 21 2258 ); 2259 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 2260 _bcmFieldSliceSelFpf3, 10, 2261 fp_tcam_ofs + f3_ofs + 21, 16 2262 ); 2263 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 2264 _bcmFieldSliceSelFpf3, 10, 2265 fp_tcam_ofs + f3_ofs + 21, 16 2266 ); 2267 2268 /* FPF3 = 11 */ 2269 2270 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 2271 _bcmFieldSliceSelFpf3, 11, 2272 fp_tcam_ofs + f3_ofs, 16 2273 ); 2274 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 2275 _bcmFieldSliceSelFpf3, 11, 2276 fp_tcam_ofs + f3_ofs, 16 2277 ); 2278 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 2279 _bcmFieldSliceSelFpf3, 11, 2280 fp_tcam_ofs + f3_ofs, 16 2281 ); 2282 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 2283 _bcmFieldSliceSelFpf3, 11, 2284 fp_tcam_ofs + f3_ofs + 7, 9 2285 ); 2286 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 2287 _bcmFieldSliceSelFpf3, 11, 2288 fp_tcam_ofs + f3_ofs + 16, 17 2289 ); 2290 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 2291 _bcmFieldSliceSelFpf3, 11, 2292 fp_tcam_ofs + f3_ofs + 16, 17 2293 ); 2294 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 2295 _bcmFieldSliceSelFpf3, 11, 2296 fp_tcam_ofs + f3_ofs + 16, 17 2297 ); 2298 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 2299 _bcmFieldSliceSelFpf3, 11, 2300 fp_tcam_ofs + f3_ofs + 16, 17 2301 ); 2302 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 2303 _bcmFieldSliceSelFpf3, 11, 2304 fp_tcam_ofs + f3_ofs + 32, 1 2305 ); 2306 2307 /* FPF3 = 12 */ 2308 2309 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag, 2310 _bcmFieldSliceSelFpf3, 12, 2311 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagVn, 2312 fp_tcam_ofs + f3_ofs, 33 2313 ); 2314 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag, 2315 _bcmFieldSliceSelFpf3, 12, 2316 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagCn, 2317 fp_tcam_ofs + f3_ofs, 33 2318 ); 2319 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag, 2320 _bcmFieldSliceSelFpf3, 12, 2321 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagFabricQueue, 2322 fp_tcam_ofs + f3_ofs, 33 2323 ); 2324 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabel, 2325 _bcmFieldSliceSelFpf3, 12, 2326 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 2327 fp_tcam_ofs + f3_ofs, 33 2328 ); 2329 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelTtl, 2330 _bcmFieldDevSelDisable, 0, 2331 _bcmFieldSliceSelFpf3, 12, 2332 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 2333 0, 2334 fp_tcam_ofs + f3_ofs, 8, 2335 fp_tcam_ofs + f3_ofs + 32, 1, 2336 0, 0, 2337 0 2338 ); 2339 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelBos, 2340 _bcmFieldDevSelDisable, 0, 2341 _bcmFieldSliceSelFpf3, 12, 2342 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 2343 0, 2344 fp_tcam_ofs + f3_ofs + 8, 1, 2345 fp_tcam_ofs + f3_ofs + 32, 1, 2346 0, 0, 2347 0 2348 ); 2349 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelExp, 2350 _bcmFieldDevSelDisable, 0, 2351 _bcmFieldSliceSelFpf3, 12, 2352 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 2353 0, 2354 fp_tcam_ofs + f3_ofs + 9, 3, 2355 fp_tcam_ofs + f3_ofs + 32, 1, 2356 0, 0, 2357 0 2358 ); 2359 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelId, 2360 _bcmFieldSliceSelFpf3, 12, 2361 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 2362 fp_tcam_ofs + f3_ofs + 12, 21 2363 ); 2364 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord, 2365 _bcmFieldSliceSelFpf3, 12, 2366 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsCntlWord, 2367 fp_tcam_ofs + f3_ofs, 33 2368 ); 2369 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper, 2370 _bcmFieldSliceSelFpf3, 12, 2371 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7A, 2372 fp_tcam_ofs + f3_ofs + 16, 17 2373 ); 2374 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower, 2375 _bcmFieldDevSelDisable, 0, 2376 _bcmFieldSliceSelFpf3, 12, 2377 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7A, 2378 0, 2379 fp_tcam_ofs + f3_ofs, 16, 2380 fp_tcam_ofs + f3_ofs + 32, 1, 2381 0, 0, 2382 0 2383 ); 2384 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper, 2385 _bcmFieldSliceSelFpf3, 12, 2386 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7B, 2387 fp_tcam_ofs + f3_ofs + 16, 17 2388 ); 2389 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower, 2390 _bcmFieldDevSelDisable, 0, 2391 _bcmFieldSliceSelFpf3, 12, 2392 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7B, 2393 0, 2394 fp_tcam_ofs + f3_ofs, 16, 2395 fp_tcam_ofs + f3_ofs + 32, 1, 2396 0, 0, 2397 0 2398 ); 2399 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction, 2400 _bcmFieldSliceSelFpf3, 12, 2401 fp_tcam_ofs + f3_ofs + 33, 3 2402 ); 2403 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid, 2404 _bcmFieldSliceSelFpf3, 12, 2405 fp_tcam_ofs + f3_ofs + 36, 1 2406 ); 2407 2408 /* FPF3 = 13 */ 2409 2410 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 2411 _bcmFieldSliceSelFpf3, 13, 2412 _bcmFieldSliceTosClassSelect, 0, 2413 fp_tcam_ofs + f3_ofs, 8 2414 ); 2415 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 2416 _bcmFieldSliceSelFpf3, 13, 2417 _bcmFieldSliceTosClassSelect, 0, 2418 fp_tcam_ofs + f3_ofs, 8 2419 ); 2420 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 2421 _bcmFieldSliceSelFpf3, 13, 2422 _bcmFieldSliceTosClassSelect, 1, 2423 fp_tcam_ofs + f3_ofs, 8 2424 ); 2425 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeader2Type, 2426 _bcmFieldSliceSelFpf3, 13, 2427 fp_tcam_ofs + f3_ofs + 8, 8 2428 ); 2429 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 2430 _bcmFieldSliceSelFpf3, 13, 2431 fp_tcam_ofs + f3_ofs + 16, 8 2432 ); 2433 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 2434 _bcmFieldSliceSelFpf3, 13, 2435 fp_tcam_ofs + f3_ofs + 24, 8 2436 ); 2437 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal, 2438 _bcmFieldSliceSelFpf3, 13, 2439 fp_tcam_ofs + f3_ofs + 32, 1 2440 ); 2441 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpAddrsNormalized, 2442 _bcmFieldSliceSelFpf3, 13, 2443 fp_tcam_ofs + f3_ofs + 33, 1 2444 ); 2445 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized, 2446 _bcmFieldSliceSelFpf3, 13, 2447 fp_tcam_ofs + f3_ofs + 34, 1 2448 ); 2449 2450 /***** FPF0 double-wide *****/ 2451 2452 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 2453 _bcmFieldSliceSelDisable, 0, 2454 _bcmFieldSliceSelDisable, 0, 2455 fp_global_mask_tcam_ofs + dw_f0_ofs, 16 2456 ); 2457 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 2458 _bcmFieldSliceSelDisable, 0, 2459 _bcmFieldSliceSelDisable, 0, 2460 fp_global_mask_tcam_ofs + dw_f0_ofs, 16 2461 ); 2462 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 2463 _bcmFieldSliceSelDisable, 0, 2464 _bcmFieldSliceSelDisable, 0, 2465 fp_global_mask_tcam_ofs + dw_f0_ofs + 16, 17 2466 ); 2467 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 2468 _bcmFieldSliceSelDisable, 0, 2469 _bcmFieldSliceSelDisable, 0, 2470 fp_global_mask_tcam_ofs + dw_f0_ofs + 16, 17 2471 ); 2472 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 2473 _bcmFieldSliceSelDisable, 0, 2474 _bcmFieldSliceSelDisable, 0, 2475 fp_global_mask_tcam_ofs + dw_f0_ofs + 16, 17 2476 ); 2477 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 2478 _bcmFieldSliceSelDisable, 0, 2479 _bcmFieldSliceSelDisable, 0, 2480 fp_global_mask_tcam_ofs + dw_f0_ofs + 16, 17 2481 ); 2482 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 2483 _bcmFieldSliceSelDisable, 0, 2484 _bcmFieldSliceSelDisable, 0, 2485 fp_global_mask_tcam_ofs + dw_f0_ofs + 32, 1 2486 ); 2487 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyColor, 2488 _bcmFieldSliceSelDisable, 0, 2489 _bcmFieldSliceSelDisable, 0, 2490 fp_global_mask_tcam_ofs + dw_f0_ofs + 33, 2 2491 ); 2492 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 2493 _bcmFieldSliceSelDisable, 0, 2494 _bcmFieldSliceSelDisable, 0, 2495 fp_global_mask_tcam_ofs + dw_f0_ofs + 35, 2 2496 ); 2497 2498 /***** FPF1 double-wide *****/ 2499 2500 /* FPF1 = 0 */ 2501 2502 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl, 2503 _bcmFieldSliceSelFpf1, 0, 2504 _bcmFieldSliceTtlClassSelect, 0, 2505 fp_tcam_ofs + dw_f1_ofs, 8 2506 ); 2507 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 2508 _bcmFieldSliceSelFpf1, 0, 2509 _bcmFieldSliceTtlClassSelect, 0, 2510 fp_tcam_ofs + dw_f1_ofs, 8 2511 ); 2512 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 2513 _bcmFieldSliceSelFpf1, 0, 2514 _bcmFieldSliceTtlClassSelect, 1, 2515 fp_tcam_ofs + dw_f1_ofs, 8 2516 ); 2517 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 2518 _bcmFieldSliceSelFpf1, 0, 2519 _bcmFieldSliceSelDisable, 0, 2520 fp_tcam_ofs + dw_f1_ofs + 8, 16 2521 ); 2522 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 2523 _bcmFieldSliceSelFpf1, 0, 2524 _bcmFieldSliceSelDisable, 0, 2525 fp_tcam_ofs + dw_f1_ofs + 24, 16 2526 ); 2527 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode, 2528 _bcmFieldSliceSelFpf1, 0, 2529 _bcmFieldSliceSelDisable, 0, 2530 fp_tcam_ofs + dw_f1_ofs + 24, 16 2531 ); 2532 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 2533 _bcmFieldSliceSelFpf1, 0, 2534 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 2535 fp_tcam_ofs + dw_f1_ofs + 40, 21 2536 ); 2537 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 2538 _bcmFieldSliceSelFpf1, 0, 2539 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 2540 fp_tcam_ofs + dw_f1_ofs + 40, 21 2541 ); 2542 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 2543 _bcmFieldSliceSelFpf1, 0, 2544 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 2545 fp_tcam_ofs + dw_f1_ofs + 40, 21 2546 ); 2547 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 2548 _bcmFieldSliceSelFpf1, 0, 2549 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 2550 fp_tcam_ofs + dw_f1_ofs + 40, 21 2551 ); 2552 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 2553 _bcmFieldSliceSelFpf1, 0, 2554 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 2555 fp_tcam_ofs + dw_f1_ofs + 40, 21 2556 ); 2557 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 2558 _bcmFieldSliceSelFpf1, 0, 2559 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 2560 fp_tcam_ofs + dw_f1_ofs + 40, 21 2561 ); 2562 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 2563 _bcmFieldSliceSelFpf1, 0, 2564 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 2565 fp_tcam_ofs + dw_f1_ofs + 40, 21 2566 ); 2567 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 2568 _bcmFieldSliceSelFpf1, 0, 2569 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 2570 fp_tcam_ofs + dw_f1_ofs + 40, 21 2571 ); 2572 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 2573 _bcmFieldSliceSelFpf1, 0, 2574 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 2575 fp_tcam_ofs + dw_f1_ofs + 40, 21 2576 ); 2577 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 2578 _bcmFieldSliceSelFpf1, 0, 2579 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 2580 fp_tcam_ofs + dw_f1_ofs + 40, 21 2581 ); 2582 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 2583 _bcmFieldSliceSelFpf1, 0, 2584 _bcmFieldSliceSelDisable, 0, 2585 fp_tcam_ofs + dw_f1_ofs + 61, 4 2586 ); 2587 2588 /* FPF1 = 1 */ 2589 2590 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelId, 2591 _bcmFieldSliceSelFpf1, 1, 2592 _bcmFieldSliceSelDisable, 0, 2593 fp_tcam_ofs + dw_f1_ofs, 20 2594 ); 2595 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction, 2596 _bcmFieldSliceSelFpf1, 1, 2597 _bcmFieldSliceSelDisable, 0, 2598 fp_tcam_ofs + dw_f1_ofs + 20, 3 2599 ); 2600 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord, 2601 _bcmFieldSliceSelFpf1, 1, 2602 _bcmFieldSliceSelDisable, 0, 2603 fp_tcam_ofs + dw_f1_ofs + 23, 32 2604 ); 2605 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid, 2606 _bcmFieldSliceSelFpf1, 1, 2607 _bcmFieldSliceSelDisable, 0, 2608 fp_tcam_ofs + dw_f1_ofs + 55, 1 2609 ); 2610 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 2611 _bcmFieldSliceSelFpf1, 1, 2612 _bcmFieldSliceSelDisable, 0, 2613 fp_tcam_ofs + dw_f1_ofs + 56, 4 2614 ); 2615 2616 /***** FPF2 double-wide *****/ 2617 2618 /* FPF2 = 0 */ 2619 2620 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 2621 _bcmFieldSliceSelFpf2, 0, 2622 _bcmFieldSliceSelDisable, 0, 2623 fp_tcam_ofs + dw_f2_ofs + 2, 1 2624 ); 2625 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 2626 _bcmFieldSliceSelFpf2, 0, 2627 _bcmFieldSliceSelDisable, 0, 2628 fp_tcam_ofs + dw_f2_ofs + 2 + 1, 1 2629 ); 2630 /* Bit 2 is VXLT0/VXLT1 hit indicator; not used */ 2631 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 2632 _bcmFieldSliceSelFpf2, 0, 2633 _bcmFieldSliceSelDisable, 0, 2634 fp_tcam_ofs + dw_f2_ofs + 2 + 3, 1 2635 ); 2636 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 2637 _bcmFieldSliceSelFpf2, 0, 2638 _bcmFieldSliceSelDisable, 0, 2639 fp_tcam_ofs + dw_f2_ofs + 2 + 4, 2 2640 ); 2641 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 2642 _bcmFieldSliceSelFpf2, 0, 2643 _bcmFieldSliceSelDisable, 0, 2644 fp_tcam_ofs + dw_f2_ofs + 2 + 6, 1 2645 ); 2646 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 2647 _bcmFieldSliceSelFpf2, 0, 2648 _bcmFieldSliceSelDisable, 0, 2649 fp_tcam_ofs + dw_f2_ofs + 2 + 7, 1 2650 ); 2651 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 2652 _bcmFieldSliceSelFpf2, 0, 2653 _bcmFieldSliceSelDisable, 0, 2654 fp_tcam_ofs + dw_f2_ofs + 2 + 8, 1 2655 ); 2656 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 2657 _bcmFieldSliceSelFpf2, 0, 2658 _bcmFieldSliceSelDisable, 0, 2659 fp_tcam_ofs + dw_f2_ofs + 2 + 9, 1 2660 ); 2661 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 2662 _bcmFieldSliceSelFpf2, 0, 2663 _bcmFieldSliceSelDisable, 0, 2664 fp_tcam_ofs + dw_f2_ofs + 2 + 10, 1 2665 ); 2666 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 2667 _bcmFieldSliceSelFpf2, 0, 2668 _bcmFieldSliceSelDisable, 0, 2669 fp_tcam_ofs + dw_f2_ofs + 2 + 10, 1 2670 ); 2671 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 2672 _bcmFieldSliceSelFpf2, 0, 2673 _bcmFieldSliceSelDisable, 0, 2674 fp_tcam_ofs + dw_f2_ofs + 2 + 11, 1 2675 ); 2676 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 2677 _bcmFieldSliceSelFpf2, 0, 2678 _bcmFieldSliceSelDisable, 0, 2679 fp_tcam_ofs + dw_f2_ofs + 2 + 12, 1 2680 ); 2681 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 2682 _bcmFieldSliceSelFpf2, 0, 2683 _bcmFieldSliceSelDisable, 0, 2684 fp_tcam_ofs + dw_f2_ofs + 2 + 13, 1 2685 ); 2686 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 2687 _bcmFieldSliceSelFpf2, 0, 2688 _bcmFieldSliceSelDisable, 0, 2689 fp_tcam_ofs + dw_f2_ofs + 2 + 14, 1 2690 ); 2691 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit, 2692 _bcmFieldSliceSelFpf2, 0, 2693 _bcmFieldSliceSelDisable, 0, 2694 fp_tcam_ofs + dw_f2_ofs + 2 + 15, 1 2695 ); 2696 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit, 2697 _bcmFieldSliceSelFpf2, 0, 2698 _bcmFieldSliceSelDisable, 0, 2699 fp_tcam_ofs + dw_f2_ofs + 2 + 16, 1 2700 ); 2701 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit, 2702 _bcmFieldSliceSelFpf2, 0, 2703 _bcmFieldSliceSelDisable, 0, 2704 fp_tcam_ofs + dw_f2_ofs + 2 + 16, 1 2705 ); 2706 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit, 2707 _bcmFieldSliceSelFpf2, 0, 2708 _bcmFieldSliceSelDisable, 0, 2709 fp_tcam_ofs + dw_f2_ofs + 2 + 16, 1 2710 ); 2711 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit, 2712 _bcmFieldSliceSelFpf2, 0, 2713 _bcmFieldSliceSelDisable, 0, 2714 fp_tcam_ofs + dw_f2_ofs + 2 + 16, 1 2715 ); 2716 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit, 2717 _bcmFieldSliceSelFpf2, 0, 2718 _bcmFieldSliceSelDisable, 0, 2719 fp_tcam_ofs + dw_f2_ofs + 2 + 17, 1 2720 ); 2721 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit, 2722 _bcmFieldSliceSelFpf2, 0, 2723 _bcmFieldSliceSelDisable, 0, 2724 fp_tcam_ofs + dw_f2_ofs + 2 + 17, 1 2725 ); 2726 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit, 2727 _bcmFieldSliceSelFpf2, 0, 2728 _bcmFieldSliceSelDisable, 0, 2729 fp_tcam_ofs + dw_f2_ofs + 2 + 17, 1 2730 ); 2731 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit, 2732 _bcmFieldSliceSelFpf2, 0, 2733 _bcmFieldSliceSelDisable, 0, 2734 fp_tcam_ofs + dw_f2_ofs + 2 + 17, 1 2735 ); 2736 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 2737 _bcmFieldSliceSelFpf2, 0, 2738 _bcmFieldSliceSelDisable, 0, 2739 fp_tcam_ofs + dw_f2_ofs + 22, 6 2740 ); 2741 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 2742 _bcmFieldSliceSelFpf2, 0, 2743 _bcmFieldSliceSelDisable, 0, 2744 fp_tcam_ofs + dw_f2_ofs + 28, 24 2745 ); 2746 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31, 2747 _bcmFieldSliceSelFpf2, 0, 2748 _bcmFieldSliceIntfClassSelect, 3, 2749 fp_tcam_ofs + dw_f2_ofs + 52, 8 2750 ); 2751 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 2752 _bcmFieldSliceSelFpf2, 0, 2753 _bcmFieldSliceIntfClassSelect, 0, 2754 fp_tcam_ofs + dw_f2_ofs + 52, 12 2755 ); 2756 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassVPort, 2757 _bcmFieldSliceSelFpf2, 0, 2758 _bcmFieldSliceIntfClassSelect, 1, 2759 fp_tcam_ofs + dw_f2_ofs + 52, 12 2760 ); 2761 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 2762 _bcmFieldSliceSelFpf2, 0, 2763 _bcmFieldSliceIntfClassSelect, 1, 2764 fp_tcam_ofs + dw_f2_ofs + 52, 12 2765 ); 2766 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 2767 _bcmFieldSliceSelFpf2, 0, 2768 _bcmFieldSliceIntfClassSelect, 2, 2769 fp_tcam_ofs + dw_f2_ofs + 52, 12 2770 ); 2771 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 2772 _bcmFieldSliceSelFpf2, 0, 2773 _bcmFieldSliceSelDisable, 0, 2774 fp_tcam_ofs + dw_f2_ofs + 64, 32 2775 ); 2776 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 2777 _bcmFieldSliceSelFpf2, 0, 2778 _bcmFieldSliceSelDisable, 0, 2779 fp_tcam_ofs + dw_f2_ofs + 96, 32 2780 ); 2781 2782 /* FPF2 = 1 */ 2783 2784 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 2785 _bcmFieldSliceSelFpf2, 1, 2786 _bcmFieldSliceSelDisable, 0, 2787 fp_tcam_ofs + dw_f2_ofs, 128 2788 ); 2789 2790 /* FPF2 = 2 */ 2791 2792 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 2793 _bcmFieldSliceSelFpf2, 2, 2794 _bcmFieldSliceSelDisable, 0, 2795 fp_tcam_ofs + dw_f2_ofs, 128 2796 ); 2797 2798 /* FPF2 = 3 */ 2799 2800 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1, 2801 _bcmFieldSliceSelFpf2, 3, 2802 _bcmFieldSliceSelDisable, 0, 2803 fp_tcam_ofs + dw_f2_ofs, 128 2804 ); 2805 2806 /***** FPF3 double-wide *****/ 2807 2808 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos, 2809 _bcmFieldSliceSelDisable, 0, 2810 _bcmFieldSliceTosClassSelect, 0, 2811 fp_tcam_ofs + dw_f3_ofs, 8 2812 ); 2813 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 2814 _bcmFieldSliceSelDisable, 0, 2815 _bcmFieldSliceTosClassSelect, 0, 2816 fp_tcam_ofs + dw_f3_ofs, 8 2817 ); 2818 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 2819 _bcmFieldSliceSelDisable, 0, 2820 _bcmFieldSliceTosClassSelect, 1, 2821 fp_tcam_ofs + dw_f3_ofs, 8 2822 ); 2823 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 2824 _bcmFieldSliceSelDisable, 0, 2825 _bcmFieldSliceSelDisable, 0, 2826 fp_tcam_ofs + dw_f3_ofs + 8, 8 2827 ); 2828 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 2829 _bcmFieldSliceSelDisable, 0, 2830 _bcmFieldSliceSelDisable, 0, 2831 fp_tcam_ofs + dw_f3_ofs + 16, 8 2832 ); 2833 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 2834 _bcmFieldSliceSelDisable, 0, 2835 _bcmFieldSliceSelDisable, 0, 2836 fp_tcam_ofs + dw_f3_ofs + 24, 8 2837 ); 2838 2839 /***** FPF4 double-wide *****/ 2840 2841 /* FPF4 = 0 */ 2842 2843 2844 2845 /* FPF4 = 1 */ 2846 2847 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 2848 _bcmFieldSliceSelFpf4, 1, 2849 _bcmFieldSliceTcpClassSelect, 0, 2850 fp_tcam_ofs + dw_f4_ofs, 6 2851 ); 2852 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero, 2853 _bcmFieldSliceSelFpf4, 1, 2854 _bcmFieldSliceTcpClassSelect, 0, 2855 fp_tcam_ofs + dw_f4_ofs, 6 2856 ); 2857 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne, 2858 _bcmFieldSliceSelFpf4, 1, 2859 _bcmFieldSliceTcpClassSelect, 1, 2860 fp_tcam_ofs + dw_f4_ofs, 6 2861 ); 2862 return (BCM_E_NONE); 2863 } 2864 2865 /* 2866 * Function: 2867 * _field_tr3_lookup_qualifiers_init 2868 * Purpose: 2869 * Initialize device stage lookup qaualifiers 2870 * select codes & offsets 2871 * Parameters: 2872 * unit - (IN) BCM device number. 2873 * stage_fc - (IN) Field Processor stage control structure. 2874 * 2875 * Returns: 2876 * BCM_E_NONE 2877 */ 2878 STATIC int 2879 _field_tr3_lookup_qualifiers_init(int unit, _field_stage_t *stage_fc) 2880 { 2881 const unsigned f1_ofs = 164, f2_ofs = 36, f3_ofs = 0; 2882 2883 _FP_QUAL_DECL; 2884 2885 /* Input parameters check. */ 2886 if (NULL == stage_fc) { 2887 return (BCM_E_PARAM); 2888 } 2889 2890 /* Enable the overlay of Sender Ethernet Address onto MACSA 2891 * on ARP/RARP packets. 2892 */ 2893 BCM_IF_ERROR_RETURN 2894 (soc_reg_field32_modify(unit, ING_CONFIG_64r, REG_PORT_ANY, 2895 ARP_VALIDATION_ENf, 1)); 2896 2897 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageLookup, 2898 _bcmFieldSliceSelDisable, 0, 0, 0); 2899 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 2900 _bcmFieldSliceSelDisable, 0, 0, 0); 2901 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 2902 _bcmFieldSliceSelDisable, 0, 0, 0); 2903 2904 /* FPF3 */ 2905 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 2906 _bcmFieldSliceSelFpf3, 0, f3_ofs, 16); 2907 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 2908 _bcmFieldSliceSelFpf3, 0, f3_ofs, 12); 2909 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 2910 _bcmFieldSliceSelFpf3, 0, f3_ofs + 12, 1); 2911 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 2912 _bcmFieldSliceSelFpf3, 0, f3_ofs + 13, 3); 2913 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 2914 _bcmFieldSliceSelFpf3, 0, f3_ofs + 16, 16); 2915 2916 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort, 2917 _bcmFieldSliceSelFpf3, 1, 2918 _bcmFieldSliceIpHeaderSelect, 1, f3_ofs, 16); 2919 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 2920 _bcmFieldSliceSelFpf3, 1, 2921 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs, 16); 2922 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort, 2923 _bcmFieldSliceSelFpf3, 1, 2924 _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 16, 16); 2925 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 2926 _bcmFieldSliceSelFpf3, 1, 2927 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 16, 16); 2928 2929 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos, 2930 _bcmFieldSliceSelFpf3, 2, 2931 _bcmFieldSliceIpHeaderSelect, 1, f3_ofs, 8); 2932 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 2933 _bcmFieldSliceSelFpf3, 2, 2934 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs, 8); 2935 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol, 2936 _bcmFieldSliceSelFpf3, 2, 2937 _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 8, 8); 2938 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 2939 _bcmFieldSliceSelFpf3, 2, 2940 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 8, 8); 2941 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 2942 _bcmFieldSliceSelFpf3, 2, f3_ofs + 16, 8); 2943 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 2944 _bcmFieldSliceSelFpf3, 2, f3_ofs + 24, 8); 2945 2946 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 2947 _bcmFieldSliceSelFpf3, 3, f3_ofs, 12); 2948 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 2949 _bcmFieldSliceSelFpf3, 3, f3_ofs + 12, 16); 2950 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 2951 _bcmFieldSliceSelFpf3, 3, f3_ofs + 12, 12); 2952 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 2953 _bcmFieldSliceSelFpf3, 3, f3_ofs + 24, 1); 2954 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 2955 _bcmFieldSliceSelFpf3, 3, f3_ofs + 25, 3); 2956 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 2957 _bcmFieldSliceSelFpf3, 3, f3_ofs + 28, 8); 2958 2959 2960 2961 /* FPF2 */ 2962 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl, 2963 _bcmFieldSliceSelFpf2, 0, 2964 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 8); 2965 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 2966 _bcmFieldSliceSelFpf2, 0, 2967 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 8); 2968 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 2969 _bcmFieldSliceSelFpf2, 0, f2_ofs + 8, 6); 2970 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag, 2971 _bcmFieldSliceSelFpf2, 0, 2972 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 14, 2); 2973 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 2974 _bcmFieldSliceSelFpf2, 0, 2975 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 14, 2); 2976 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos, 2977 _bcmFieldSliceSelFpf2, 0, 2978 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 16, 8); 2979 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 2980 _bcmFieldSliceSelFpf2, 0, 2981 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 16, 8); 2982 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort, 2983 _bcmFieldSliceSelFpf2, 0, 2984 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 24, 16); 2985 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 2986 _bcmFieldSliceSelFpf2, 0, 2987 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 24, 16); 2988 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort, 2989 _bcmFieldSliceSelFpf2, 0, 2990 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 40, 16); 2991 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 2992 _bcmFieldSliceSelFpf2, 0, 2993 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 40, 16); 2994 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol, 2995 _bcmFieldSliceSelFpf2, 0, 2996 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 56, 8); 2997 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 2998 _bcmFieldSliceSelFpf2, 0, 2999 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 56, 8); 3000 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp, 3001 _bcmFieldSliceSelFpf2, 0, 3002 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 64, 32); 3003 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 3004 _bcmFieldSliceSelFpf2, 0, 3005 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 64, 32); 3006 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp, 3007 _bcmFieldSliceSelFpf2, 0, 3008 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 96, 32); 3009 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 3010 _bcmFieldSliceSelFpf2, 0, 3011 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 96, 32); 3012 3013 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6, 3014 _bcmFieldSliceSelFpf2, 1, 3015 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 128); 3016 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 3017 _bcmFieldSliceSelFpf2, 1, 3018 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 128); 3019 3020 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp6, 3021 _bcmFieldSliceSelFpf2, 2, 3022 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 128); 3023 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 3024 _bcmFieldSliceSelFpf2, 2, 3025 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 128); 3026 3027 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 3028 _bcmFieldSliceSelFpf2, 3, f2_ofs + 16, 16); 3029 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 3030 _bcmFieldSliceSelFpf2, 3, f2_ofs + 32, 48); 3031 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 3032 _bcmFieldSliceSelFpf2, 3, f2_ofs + 80, 48); 3033 3034 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos, 3035 _bcmFieldSliceSelFpf2, 4, 3036 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 8); 3037 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 3038 _bcmFieldSliceSelFpf2, 4, 3039 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 8); 3040 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol, 3041 _bcmFieldSliceSelFpf2, 4, 3042 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 8, 8); 3043 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 3044 _bcmFieldSliceSelFpf2, 4, 3045 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 8, 8); 3046 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp, 3047 _bcmFieldSliceSelFpf2, 4, 3048 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 16, 32); 3049 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 3050 _bcmFieldSliceSelFpf2, 4, 3051 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 16, 32); 3052 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp, 3053 _bcmFieldSliceSelFpf2, 4, 3054 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 48, 32); 3055 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 3056 _bcmFieldSliceSelFpf2, 4, 3057 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 48, 32); 3058 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 3059 _bcmFieldSliceSelFpf2, 4, f2_ofs + 80, 48); 3060 3061 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos, 3062 _bcmFieldSliceSelFpf2, 5, 3063 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 8); 3064 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 3065 _bcmFieldSliceSelFpf2, 5, 3066 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 8); 3067 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol, 3068 _bcmFieldSliceSelFpf2, 5, 3069 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 8, 8); 3070 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 3071 _bcmFieldSliceSelFpf2, 5, 3072 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 8, 8); 3073 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp, 3074 _bcmFieldSliceSelFpf2, 5, 3075 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 16, 32); 3076 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 3077 _bcmFieldSliceSelFpf2, 5, 3078 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 16, 32); 3079 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp, 3080 _bcmFieldSliceSelFpf2, 5, 3081 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 48, 32); 3082 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 3083 _bcmFieldSliceSelFpf2, 5, 3084 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 48, 32); 3085 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 3086 _bcmFieldSliceSelFpf2, 5, f2_ofs + 80, 48); 3087 3088 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6High, 3089 _bcmFieldSliceSelFpf2, 6, 3090 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 64); 3091 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High, 3092 _bcmFieldSliceSelFpf2, 6, 3093 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 64); 3094 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp6High, 3095 _bcmFieldSliceSelFpf2, 6, 3096 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 64, 64); 3097 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 3098 _bcmFieldSliceSelFpf2, 6, 3099 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 64, 64); 3100 3101 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVnTag, 3102 _bcmFieldSliceSelFpf2, 7, f2_ofs, 33); 3103 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySnap, 3104 _bcmFieldSliceSelFpf2, 7, f2_ofs + 64, 40); 3105 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyLlc, 3106 _bcmFieldSliceSelFpf2, 7, f2_ofs + 104, 24); 3107 3108 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0, 3109 _bcmFieldSliceSelFpf2, 8, f2_ofs, 128); 3110 3111 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1, 3112 _bcmFieldSliceSelFpf2, 9, f2_ofs, 128); 3113 3114 /* FPF1 */ 3115 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 3116 bcmFieldQualifyInnerIpProtocolCommon, 3117 _bcmFieldSliceSelFpf1, 0, 3118 _bcmFieldSliceIpHeaderSelect, 1, f1_ofs, 3); 3119 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocolCommon, 3120 _bcmFieldSliceSelFpf1, 0, 3121 _bcmFieldSliceIpHeaderSelect, 0, f1_ofs, 3); 3122 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 3123 _bcmFieldSliceSelFpf1, 0, f1_ofs + 3, 1); 3124 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo, 3125 _bcmFieldSliceSelFpf1, 0, f1_ofs + 4, 1); 3126 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid, 3127 _bcmFieldSliceSelFpf1, 0, f1_ofs + 5, 2); 3128 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid, 3129 _bcmFieldSliceSelFpf1, 0, f1_ofs + 7, 2); 3130 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 3131 _bcmFieldSliceSelFpf1, 0, f1_ofs + 9, 2); 3132 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 3133 _bcmFieldSliceSelFpf1, 0, f1_ofs + 11, 1); 3134 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 3135 _bcmFieldSliceSelFpf1, 0, f1_ofs + 12, 1); 3136 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 3137 _bcmFieldSliceSelFpf1, 0, f1_ofs + 13, 16); 3138 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 3139 _bcmFieldSliceSelFpf1, 0, f1_ofs + 13, 12); 3140 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 3141 _bcmFieldSliceSelFpf1, 0, f1_ofs + 13 + 12, 1); 3142 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 3143 _bcmFieldSliceSelFpf1, 0, f1_ofs + 13 + 13, 3); 3144 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 3145 _bcmFieldSliceSelFpf1, 0, f1_ofs + 29, 2); 3146 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 3147 _bcmFieldSliceSelFpf1, 0, 3148 _bcmFieldSliceIpHeaderSelect, 0, f1_ofs + 31, 4); 3149 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpType, 3150 _bcmFieldSliceSelFpf1, 0, 3151 _bcmFieldSliceIpHeaderSelect, 1, f1_ofs + 31, 4); 3152 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 3153 _bcmFieldSliceSelFpf1, 0, f1_ofs + 35, 1); 3154 3155 3156 3157 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 3158 _bcmFieldDevSelDisable, 0, 3159 _bcmFieldSliceSelFpf1, 0, 3160 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 3161 0, 3162 f1_ofs + 36, 7, /* Port value in SGLP */ 3163 f1_ofs + 43, 8, /* Module value in SGLP */ 3164 f1_ofs + 51, 1, /* Trunk bit in SGLP (should be 0) */ 3165 0 3166 ); 3167 3168 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 3169 _bcmFieldDevSelDisable, 0, 3170 _bcmFieldSliceSelFpf1, 0, 3171 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 3172 0, 3173 f1_ofs + 36, 15, /* trunk id field of SGLP */ 3174 f1_ofs + 51, 1, /* trunk bit of SGLP */ 3175 0, 0, 3176 0 3177 ); 3178 3179 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 3180 _bcmFieldDevSelDisable, 0, 3181 _bcmFieldSliceSelFpf1, 0, 3182 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMplsGport, 3183 0, 3184 f1_ofs + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */ 3185 0, 0, 3186 0, 0, 3187 0 3188 ); 3189 3190 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 3191 _bcmFieldDevSelDisable, 0, 3192 _bcmFieldSliceSelFpf1, 0, 3193 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVlanGport, 3194 0, 3195 f1_ofs + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */ 3196 0, 0, 3197 0, 0, 3198 0 3199 ); 3200 3201 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 3202 _bcmFieldDevSelDisable, 0, 3203 _bcmFieldSliceSelFpf1, 0, 3204 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMimGport, 3205 0, 3206 f1_ofs + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */ 3207 0, 0, 3208 0, 0, 3209 0 3210 ); 3211 3212 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 3213 _bcmFieldDevSelDisable, 0, 3214 _bcmFieldSliceSelFpf1, 0, 3215 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityWlanGport, 3216 0, 3217 f1_ofs + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */ 3218 0, 0, 3219 0, 0, 3220 0 3221 ); 3222 3223 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 3224 _bcmFieldDevSelDisable, 0, 3225 _bcmFieldSliceSelFpf1, 0, 3226 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 3227 0, 3228 f1_ofs + 36, 15, /* mod + port field of unresolved SGLP */ 3229 0, 0, 3230 0, 0, 3231 0 3232 ); 3233 3234 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 3235 _bcmFieldDevSelDisable, 0, 3236 _bcmFieldSliceSelFpf1, 0, 3237 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 3238 0, 3239 f1_ofs + 36 + 7, 8, /* mod field of unresolved SGLP */ 3240 0, 0, 3241 0, 0, 3242 0 3243 ); 3244 3245 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId, 3246 _bcmFieldDevSelDisable, 0, 3247 _bcmFieldSliceSelFpf1, 0, 3248 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 3249 0, 3250 f1_ofs + 36 + 7, 8, /* mod field of unresolved SGLP */ 3251 0, 0, 3252 0, 0, 3253 0 3254 ); 3255 3256 3257 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyInPort, 3258 _bcmFieldDevSelDisable, 0, 3259 _bcmFieldSliceSelFpf1, 0, 3260 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityPortGroupNum, 3261 0, 3262 f1_ofs + 36, 7, /* ingress port field */ 3263 0, 0, 3264 0, 0, 3265 0 3266 ); 3267 3268 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 3269 _bcmFieldDevSelDisable, 0, 3270 _bcmFieldSliceSelFpf1, 0, 3271 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityPortGroupNum, 3272 0, 3273 f1_ofs + 36 + 7, 8, /* ingress port group field */ 3274 0, 0, 3275 0, 0, 3276 0 3277 ); 3278 3279 /* DWF3 */ 3280 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos, 3281 _bcmFieldSliceSelFpf3, 0, 3282 _bcmFieldSliceIpHeaderSelect, 1, f3_ofs, 8); 3283 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos, 3284 _bcmFieldSliceSelFpf3, 0, 3285 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs, 8); 3286 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl, 3287 _bcmFieldSliceSelFpf3, 0, 3288 _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 8, 8); 3289 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl, 3290 _bcmFieldSliceSelFpf3, 0, 3291 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 8, 8); 3292 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 3293 _bcmFieldSliceSelFpf3, 0, 3294 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 16, 6); 3295 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag, 3296 _bcmFieldSliceSelFpf3, 0, 3297 _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 22, 2); 3298 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 3299 _bcmFieldSliceSelFpf3, 0, 3300 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 22, 2); 3301 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol, 3302 _bcmFieldSliceSelFpf3, 0, 3303 _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 24, 8); 3304 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 3305 _bcmFieldSliceSelFpf3, 0, 3306 _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 24, 8); 3307 3308 /* DWF2 */ 3309 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl, 3310 _bcmFieldSliceSelFpf2, 0, 3311 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 8); 3312 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl, 3313 _bcmFieldSliceSelFpf2, 0, 3314 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 8); 3315 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 3316 _bcmFieldSliceSelFpf2, 0, 3317 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 8, 6); 3318 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag, 3319 _bcmFieldSliceSelFpf2, 0, 3320 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 14, 2); 3321 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 3322 _bcmFieldSliceSelFpf2, 0, 3323 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 14, 2); 3324 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos, 3325 _bcmFieldSliceSelFpf2, 0, 3326 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 16, 8); 3327 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos, 3328 _bcmFieldSliceSelFpf2, 0, 3329 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 16, 8); 3330 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort, 3331 _bcmFieldSliceSelFpf2, 0, 3332 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 24, 16); 3333 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 3334 _bcmFieldSliceSelFpf2, 0, 3335 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 24, 16); 3336 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort, 3337 _bcmFieldSliceSelFpf2, 0, 3338 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 40, 16); 3339 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 3340 _bcmFieldSliceSelFpf2, 0, 3341 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 40, 16); 3342 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol, 3343 _bcmFieldSliceSelFpf2, 0, 3344 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 56, 8); 3345 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 3346 _bcmFieldSliceSelFpf2, 0, 3347 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 56, 8); 3348 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp, 3349 _bcmFieldSliceSelFpf2, 0, 3350 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 64, 32); 3351 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 3352 _bcmFieldSliceSelFpf2, 0, 3353 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 64, 32); 3354 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp, 3355 _bcmFieldSliceSelFpf2, 0, 3356 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 96, 32); 3357 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 3358 _bcmFieldSliceSelFpf2, 0, 3359 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 96, 32); 3360 3361 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6, 3362 _bcmFieldSliceSelFpf2, 1, 3363 _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 128); 3364 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 3365 _bcmFieldSliceSelFpf2, 1, 3366 _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 128); 3367 3368 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1, 3369 _bcmFieldSliceSelFpf2, 2, 3370 _bcmFieldSliceSelDisable, 0, 3371 f2_ofs, 128); 3372 3373 /* DWF1 */ 3374 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, 3375 bcmFieldQualifyExtensionHeaderSubCode, 3376 _bcmFieldSliceSelFpf1, 0, 3377 _bcmFieldSliceIpHeaderSelect, 0, f1_ofs, 8); 3378 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 3379 _bcmFieldSliceSelFpf1, 0, 3380 _bcmFieldSliceIpHeaderSelect, 0, f1_ofs + 8, 8); 3381 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 3382 _bcmFieldSliceSelFpf1, 0, 3383 _bcmFieldSliceIpHeaderSelect, 0, f1_ofs + 16, 12); 3384 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 3385 _bcmFieldSliceSelFpf1, 0, 3386 _bcmFieldSliceIpHeaderSelect, 0, f1_ofs + 28, 16); 3387 3388 3389 return (BCM_E_NONE); 3390 } 3391 3392 3393 /* 3394 * Function: 3395 * _field_tr3_egress_qualifiers_init 3396 * Purpose: 3397 * Initialize device stage egress qaualifiers 3398 * select codes & offsets 3399 * Parameters: 3400 * unit - (IN) BCM device number. 3401 * stage_fc - (IN) Field Processor stage control structure. 3402 * 3403 * Returns: 3404 * BCM_E_NONE 3405 */ 3406 STATIC int 3407 _field_tr3_egress_qualifiers_init(int unit, _field_stage_t *stage_fc) 3408 { 3409 _FP_QUAL_DECL; 3410 _key_fld_ = KEYf; 3411 3412 /* Input parameters check. */ 3413 if (NULL == stage_fc) { 3414 return (BCM_E_PARAM); 3415 } 3416 3417 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 3418 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 0, 1); 3419 3420 /* EG_NEXT_HOP_CLASS_ID */ 3421 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass, 3422 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3423 _bcmFieldSliceSelEgrDvpKey4, 1, 3424 2, 12); 3425 /* EG_L3_INTF_CLASS_ID */ 3426 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL3Interface, 3427 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3428 _bcmFieldSliceSelEgrDvpKey4, 2, 3429 2, 12); 3430 /* EG_DVP_CLASS_ID */ 3431 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre, 3432 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3433 _bcmFieldSliceSelEgrDvpKey4, 3, 3434 2, 12); 3435 /* DVP */ 3436 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 3437 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3438 _bcmFieldSliceSelEgrDvpKey4, 0, 3439 1, 17); 3440 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 3441 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3442 _bcmFieldSliceSelEgrDvpKey4, 0, 3443 1, 17); 3444 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 3445 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3446 _bcmFieldSliceSelEgrDvpKey4, 0, 3447 1, 17); 3448 3449 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 3450 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 18, 4); 3451 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor, 3452 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 22, 2); 3453 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 3454 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 24, 2); 3455 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 3456 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 26, 16); 3457 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 3458 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 42, 48); 3459 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 3460 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 90, 48); 3461 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 3462 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 138, 1); 3463 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 3464 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 139, 1); 3465 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 3466 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 140, 1); 3467 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 3468 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 141, 16); 3469 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 3470 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 141, 1); 3471 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 3472 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 142, 3); 3473 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 3474 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 145, 12); 3475 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 3476 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 157, 7); 3477 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 3478 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 164, 1); 3479 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 3480 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 165, 1); 3481 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 3482 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 166, 16); 3483 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 3484 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 166, 12); 3485 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 3486 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 178, 1); 3487 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 3488 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 179, 3); 3489 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 3490 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 182, 2); 3491 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig, 3492 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 184, 1); 3493 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 3494 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 185, 8); 3495 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 3496 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3497 _bcmFieldSliceSelEgrClassF4, 0, 3498 193, 13 3499 ); 3500 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 3501 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3502 _bcmFieldSliceSelEgrClassF4, 0, 3503 193, 13 3504 ); 3505 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 3506 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3507 _bcmFieldSliceSelEgrClassF4, 0, 3508 193, 13 3509 ); 3510 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 3511 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3512 _bcmFieldSliceSelEgrClassF4, 0, 3513 193, 13 3514 ); 3515 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 3516 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3517 _bcmFieldSliceSelEgrClassF4, 0, 3518 193, 13 3519 ); 3520 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 3521 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3522 _bcmFieldSliceSelEgrClassF4, 0, 3523 193, 13 3524 ); 3525 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 3526 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3527 _bcmFieldSliceSelEgrClassF4, 0, 3528 193, 13 3529 ); 3530 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 3531 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3532 _bcmFieldSliceSelEgrClassF4, 0, 3533 193, 13 3534 ); 3535 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOutPort, 3536 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3537 _bcmFieldSliceSelEgrClassF4, 1, 3538 193, 7); 3539 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField, 3540 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3541 _bcmFieldSliceSelEgrClassF4, 0, 3542 193, 13 3543 ); 3544 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 3545 bcmFieldQualifyIngressInterfaceClassPort, 3546 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3547 _bcmFieldSliceSelEgrClassF4, 0, 3548 193, 13 3549 ); 3550 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 3551 bcmFieldQualifyIngressInterfaceClassVPort, 3552 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3553 _bcmFieldSliceSelEgrClassF4, 0, 3554 193, 13 3555 ); 3556 /* CPUCOS */ 3557 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCpuQueue, 3558 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3559 _bcmFieldSliceSelEgrClassF4, 2, 3560 193, 6); 3561 /* L3_PKT_TYPE */ 3562 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 3563 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3564 _bcmFieldSliceSelEgrMdlKey4, 0, 3565 206, 4); 3566 /* MDL */ 3567 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOamMdl, 3568 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3569 _bcmFieldSliceSelEgrMdlKey4, 1, 3570 206, 3); 3571 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 3572 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 210, 1); 3573 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 3574 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3575 211, 14 3576 ); 3577 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 3578 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3579 211, 14 3580 ); 3581 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 3582 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3583 211, 14 3584 ); 3585 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 3586 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 3587 225, 2 3588 ); 3589 3590 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageEgress, 3591 _bcmFieldSliceSelDisable, 0, 0, 0); 3592 3593 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 3594 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 1); 3595 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 3596 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 1, 4); 3597 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor, 3598 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 5, 2); 3599 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 3600 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 7, 2); 3601 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 3602 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 9, 6); 3603 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 3604 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 15, 16); 3605 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 3606 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 31, 16); 3607 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 3608 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 47, 8); 3609 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 3610 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 55, 8); 3611 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 3612 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 63, 32); 3613 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 3614 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 95, 32); 3615 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 3616 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 127, 8); 3617 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 3618 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 135, 1); 3619 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 3620 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 136, 1); 3621 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 3622 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 137, 12); 3623 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 3624 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 149, 7); 3625 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 3626 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 156, 1); 3627 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 3628 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 157, 1); 3629 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 3630 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 158, 16); 3631 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 3632 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 158, 12); 3633 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 3634 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 170, 1); 3635 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 3636 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 171, 3); 3637 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 3638 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 174, 2); 3639 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig, 3640 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 176, 1); 3641 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 3642 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 177, 8); 3643 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort, 3644 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 185, 7); 3645 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 3646 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 192, 4); 3647 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 3648 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 196, 1); 3649 3650 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 3651 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3652 _bcmFieldSliceSelEgrClassF1, 0, 3653 197, 13 3654 ); 3655 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 3656 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3657 _bcmFieldSliceSelEgrClassF1, 0, 3658 197, 13 3659 ); 3660 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 3661 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3662 _bcmFieldSliceSelEgrClassF1, 0, 3663 197, 13 3664 ); 3665 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 3666 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3667 _bcmFieldSliceSelEgrClassF1, 0, 3668 197, 13 3669 ); 3670 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 3671 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3672 _bcmFieldSliceSelEgrClassF1, 0, 3673 197, 13 3674 ); 3675 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 3676 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3677 _bcmFieldSliceSelEgrClassF1, 0, 3678 197, 13 3679 ); 3680 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 3681 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3682 _bcmFieldSliceSelEgrClassF1, 0, 3683 197, 13 3684 ); 3685 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 3686 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3687 _bcmFieldSliceSelEgrClassF1, 0, 3688 197, 13 3689 ); 3690 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass, 3691 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3692 _bcmFieldSliceSelEgrClassF1, 1, 3693 197, 12); 3694 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL3Interface, 3695 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3696 _bcmFieldSliceSelEgrClassF1, 2, 3697 197, 12); 3698 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre, 3699 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3700 _bcmFieldSliceSelEgrClassF1, 3, 3701 197, 12); 3702 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField, 3703 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3704 _bcmFieldSliceSelEgrClassF1, 0, 3705 197, 13 3706 ); 3707 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 3708 bcmFieldQualifyIngressInterfaceClassPort, 3709 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3710 _bcmFieldSliceSelEgrClassF1, 0, 3711 197, 13 3712 ); 3713 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 3714 bcmFieldQualifyIngressInterfaceClassVPort, 3715 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3716 _bcmFieldSliceSelEgrClassF1, 0, 3717 197, 13 3718 ); 3719 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 3720 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3721 210, 14 3722 ); 3723 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 3724 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3725 210, 14 3726 ); 3727 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 3728 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3729 210, 14 3730 ); 3731 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 3732 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3733 224, 2 3734 ); 3735 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 3736 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 0); 3737 3738 /* KEY1 without v4 specific fields. */ 3739 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 3740 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 0, 1); 3741 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 3742 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 1, 4); 3743 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor, 3744 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 5, 2); 3745 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 3746 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 9, 6); 3747 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 3748 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 15, 16); 3749 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 3750 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 31, 16); 3751 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 3752 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 47, 8); 3753 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 3754 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 55, 8); 3755 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 3756 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 127, 8); 3757 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 3758 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 135, 1); 3759 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 3760 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 136, 1); 3761 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 3762 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 137, 12); 3763 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 3764 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 149, 7); 3765 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 3766 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 156, 1); 3767 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 3768 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 157, 1); 3769 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 3770 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 158, 16); 3771 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 3772 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 158, 12); 3773 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 3774 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 170, 1); 3775 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 3776 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 171, 3); 3777 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 3778 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 174, 2); 3779 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig, 3780 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 176, 1); 3781 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 3782 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 177, 8); 3783 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort, 3784 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 185, 7); 3785 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 3786 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 192, 4); 3787 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 3788 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 196, 1); 3789 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 3790 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3791 _bcmFieldSliceSelEgrClassF1, 0, 3792 197, 13 3793 ); 3794 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 3795 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3796 _bcmFieldSliceSelEgrClassF1, 0, 3797 197, 13 3798 ); 3799 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 3800 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3801 _bcmFieldSliceSelEgrClassF1, 0, 3802 197, 13 3803 ); 3804 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 3805 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3806 _bcmFieldSliceSelEgrClassF1, 0, 3807 197, 13 3808 ); 3809 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 3810 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3811 _bcmFieldSliceSelEgrClassF1, 0, 3812 197, 13 3813 ); 3814 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 3815 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3816 _bcmFieldSliceSelEgrClassF1, 0, 3817 197, 13 3818 ); 3819 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 3820 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3821 _bcmFieldSliceSelEgrClassF1, 0, 3822 197, 13 3823 ); 3824 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 3825 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3826 _bcmFieldSliceSelEgrClassF1, 0, 3827 197, 13 3828 ); 3829 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass, 3830 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3831 _bcmFieldSliceSelEgrClassF1, 1, 3832 197, 12); 3833 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL3Interface, 3834 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3835 _bcmFieldSliceSelEgrClassF1, 2, 3836 197, 12); 3837 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre, 3838 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3839 _bcmFieldSliceSelEgrClassF1, 3, 3840 197, 12); 3841 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField, 3842 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3843 _bcmFieldSliceSelEgrClassF1, 0, 3844 197, 13 3845 ); 3846 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressInterfaceClassPort, 3847 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3848 _bcmFieldSliceSelEgrClassF1, 0, 3849 197, 13 3850 ); 3851 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressInterfaceClassVPort, 3852 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3853 _bcmFieldSliceSelEgrClassF1, 0, 3854 197, 13 3855 ); 3856 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 3857 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3858 210, 14 3859 ); 3860 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 3861 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3862 210, 14 3863 ); 3864 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 3865 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3866 210, 14 3867 ); 3868 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 3869 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 3870 224, 2 3871 ); 3872 3873 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 3874 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 1); 3875 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 3876 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 1, 8); 3877 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 3878 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3879 _bcmFieldSliceIp6AddrSelect, 3880 _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP6, 3881 9, 128); 3882 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 3883 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3884 _bcmFieldSliceIp6AddrSelect, 3885 _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_DIP6, 3886 9, 128); 3887 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High, 3888 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3889 _bcmFieldSliceIp6AddrSelect, 3890 _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64, 3891 9, 64); 3892 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 3893 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3894 _bcmFieldSliceIp6AddrSelect, 3895 _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64, 3896 73, 64); 3897 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 3898 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 137, 8); 3899 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 3900 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 145, 1); 3901 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 3902 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 146, 1); 3903 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 3904 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 147, 12); 3905 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 3906 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 159, 7); 3907 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 3908 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 166, 1); 3909 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 3910 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 167, 1); 3911 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 3912 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 168, 16); 3913 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 3914 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 168, 12); 3915 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 3916 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 180, 1); 3917 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 3918 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 181, 3); 3919 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 3920 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 184, 2); 3921 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig, 3922 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 186, 1); 3923 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 3924 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 187, 8); 3925 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 3926 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3927 _bcmFieldSliceSelEgrClassF2, 0, 3928 195, 13 3929 ); 3930 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 3931 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3932 _bcmFieldSliceSelEgrClassF2, 0, 3933 195, 13 3934 ); 3935 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 3936 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3937 _bcmFieldSliceSelEgrClassF2, 0, 3938 195, 13 3939 ); 3940 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 3941 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3942 _bcmFieldSliceSelEgrClassF2, 0, 3943 195, 13 3944 ); 3945 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 3946 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3947 _bcmFieldSliceSelEgrClassF2, 0, 3948 195, 13 3949 ); 3950 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 3951 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3952 _bcmFieldSliceSelEgrClassF2, 0, 3953 195, 13 3954 ); 3955 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 3956 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3957 _bcmFieldSliceSelEgrClassF2, 0, 3958 195, 13 3959 ); 3960 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 3961 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 3962 _bcmFieldSliceSelEgrClassF2, 0, 3963 195, 13 3964 ); 3965 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass, 3966 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3967 _bcmFieldSliceSelEgrClassF2, 1, 3968 195, 12); 3969 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL3Interface, 3970 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3971 _bcmFieldSliceSelEgrClassF2, 2, 3972 195, 12); 3973 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOutPort, 3974 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3975 _bcmFieldSliceSelEgrClassF2, 3, 3976 195, 7); 3977 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField, 3978 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3979 _bcmFieldSliceSelEgrClassF2, 0, 3980 195, 13 3981 ); 3982 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 3983 bcmFieldQualifyIngressInterfaceClassPort, 3984 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3985 _bcmFieldSliceSelEgrClassF2, 0, 3986 195, 13 3987 ); 3988 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 3989 bcmFieldQualifyIngressInterfaceClassVPort, 3990 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 3991 _bcmFieldSliceSelEgrClassF2, 0, 3992 195, 13 3993 ); 3994 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 3995 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 208, 4); 3996 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 3997 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 212, 1); 3998 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 3999 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 0); 4000 4001 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 4002 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 1); 4003 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 4004 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 1, 4); 4005 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor, 4006 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 5, 2); 4007 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4008 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 7, 2); 4009 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 4010 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 9, 6); 4011 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4012 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 15, 16); 4013 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4014 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 31, 16); 4015 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 4016 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 47, 8); 4017 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 4018 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 55, 128); 4019 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 4020 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 183, 8); 4021 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 4022 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 191, 8); 4023 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 4024 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 199, 4); 4025 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 4026 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 203, 1); 4027 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass, 4028 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 4029 _bcmFieldSliceSelEgrClassF3, 0, 4030 204, 12); 4031 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL3Interface, 4032 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 4033 _bcmFieldSliceSelEgrClassF3, 1, 4034 204, 12); 4035 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre, 4036 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 4037 _bcmFieldSliceSelEgrClassF3, 2, 4038 204, 12); 4039 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 4040 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 0); 4041 4042 return (BCM_E_NONE); 4043 } 4044 4045 4046 STATIC int 4047 _field_tr3_external_qualifiers_init(int unit, _field_stage_t *stage_fc) 4048 { 4049 _FP_QUAL_DECL; 4050 4051 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage, 4052 _bcmFieldSliceSelDisable, 0, 0, 0); 4053 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageExternal, 4054 _bcmFieldSliceSelDisable, 0, 0, 0); 4055 4056 /* _FP_EXT_ACL_144_L2 */ 4057 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 4058 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_L2, 0, 1); 4059 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 4060 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_L2, 24, 48); 4061 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4062 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_L2, 72, 16); 4063 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4064 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_L2, 72, 12); 4065 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4066 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_L2, 84, 1); 4067 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4068 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_L2, 85, 3); 4069 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 4070 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_L2, 88, 48); 4071 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 4072 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_L2, 136, 16); 4073 4074 /* _FP_EXT_ACL_L2 */ 4075 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4076 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 0, 1); 4077 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4078 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 1, 2); 4079 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4080 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 3, 1); 4081 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 4082 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 5, 1); 4083 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 4084 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 6, 1); 4085 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 4086 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 7, 2); 4087 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 4088 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 9, 1); 4089 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 4090 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 10, 4); 4091 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 4092 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 14, 1); 4093 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 4094 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 24, 16); 4095 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 4096 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 24, 12); 4097 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 4098 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 36, 1); 4099 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 4100 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 37, 3); 4101 4102 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 4103 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 56, 10); 4104 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 4105 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 56, 10); 4106 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 4107 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 56, 10); 4108 4109 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 4110 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 66, 10); 4111 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 4112 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 66, 10); 4113 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 4114 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 66, 10); 4115 4116 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 4117 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 76, 12); 4118 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 4119 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 76, 12); 4120 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 4121 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 76, 12); 4122 4123 4124 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 4125 _bcmFieldDevSelDisable, 0, 4126 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 4127 _bcmFieldSliceSelDisable, 0, 4128 0, 4129 88, 7, /* Port value in SGLP */ 4130 95, 8, /* Module value in SGLP */ 4131 103, 1, /* Trunk bit in SGLP */ 4132 0 4133 ); 4134 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 4135 _bcmFieldDevSelDisable, 0, 4136 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 4137 _bcmFieldSliceSelDisable, 0, 4138 0, 4139 88, 15, /* trunk id field of SGLP */ 4140 103, 1, /* trunk bit of SGLP (should be 1) */ 4141 0, 0, 4142 0 4143 ); 4144 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 4145 _bcmFieldDevSelDisable, 0, 4146 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 4147 _bcmFieldSliceSelDisable, 0, 4148 0, 4149 88, 16, /* SVP */ 4150 4, 1, /* SVP valid (should be 1) */ 4151 0, 0, 4152 0 4153 ); 4154 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 4155 _bcmFieldDevSelDisable, 0, 4156 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 4157 _bcmFieldSliceSelDisable, 0, 4158 0, 4159 88, 16, /* SVP */ 4160 4, 1, /* SVP valid (should be 1) */ 4161 0, 0, 4162 0 4163 ); 4164 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 4165 _bcmFieldDevSelDisable, 0, 4166 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 4167 _bcmFieldSliceSelDisable, 0, 4168 0, 4169 88, 16, /* SVP */ 4170 4, 1, /* SVP valid (should be 1) */ 4171 0, 0, 4172 0 4173 ); 4174 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 4175 _bcmFieldDevSelDisable, 0, 4176 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 4177 _bcmFieldSliceSelDisable, 0, 4178 0, 4179 88, 16, /* SVP */ 4180 4, 1, /* SVP valid (should be 1) */ 4181 0, 0, 4182 0 4183 ); 4184 4185 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 4186 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 104, 48); 4187 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4188 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 152, 16); 4189 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4190 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 152, 12); 4191 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4192 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 164, 1); 4193 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4194 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 165, 3); 4195 4196 /* Emulate the behavior of the ext_tcam_mode SOC propert */ 4197 if (soc_property_get(unit, spn_EXT_TCAM_MODE, 0) == 1) { 4198 /* Was non-7K in TR2 */ 4199 4200 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4201 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 40, 16); 4202 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 4203 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 232, 16); 4204 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 4205 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 248, 48); 4206 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 4207 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 296, 16); 4208 } else { 4209 /* Was 7K in TR2 */ 4210 4211 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 4212 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 40, 16); 4213 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 4214 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 232, 48); 4215 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 4216 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2, 280, 16); 4217 } 4218 4219 /* _FP_EXT_ACL_144_IPV4 */ 4220 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 4221 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 0, 0); 4222 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4223 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 0, 1); 4224 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4225 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 1, 2); 4226 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4227 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 3, 1); 4228 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 4229 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 4, 1); 4230 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4231 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 8, 13); 4232 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4233 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 22, 2); 4234 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 4235 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 24, 8); 4236 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 4237 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 32, 8); 4238 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4239 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 40, 16); 4240 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4241 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 56, 16); 4242 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 4243 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 72, 32); 4244 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 4245 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 104, 32); 4246 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4247 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 136, 16); 4248 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4249 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 136, 12); 4250 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4251 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 148, 1); 4252 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4253 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV4, 149, 3); 4254 4255 /* _FP_EXT_ACL_IPV4 */ 4256 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 4257 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 0, 0); 4258 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4259 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 0, 1); 4260 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4261 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 1, 2); 4262 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4263 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 3, 1); 4264 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 4265 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 4, 4); 4266 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 4267 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 8, 1); 4268 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 4269 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 9, 1); 4270 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 4271 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 10, 1); 4272 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 4273 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 11, 4); 4274 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 4275 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 15, 1); 4276 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 4277 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 16, 8); 4278 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 4279 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 24, 8); 4280 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4281 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 32, 13); 4282 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4283 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 46, 2); 4284 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 4285 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 48, 16); 4286 4287 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 4288 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 64, 10); 4289 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 4290 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 64, 10); 4291 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 4292 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 64, 10); 4293 4294 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 4295 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 74, 10); 4296 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 4297 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 74, 10); 4298 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 4299 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 74, 10); 4300 4301 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 4302 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 84, 12); 4303 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 4304 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 84, 12); 4305 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 4306 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 84, 12); 4307 4308 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4309 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 96, 16); 4310 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4311 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 112, 16); 4312 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 4313 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 128, 32); 4314 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 4315 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV4, 160, 32); 4316 4317 4318 if (soc_property_get(unit, spn_EXT_TCAM_MODE, 0) == 0) { 4319 /* Was non-7K in TR2 */ 4320 ; 4321 } else { 4322 /* Was 7K in TR2 */ 4323 ; 4324 } 4325 4326 /* _FP_EXT_ACL_L2_IPV4 */ 4327 if (soc_property_get(unit, spn_EXT_L2IP4_ACL_TABLE_MASTER_KEY_TYPE, 0) == 1) { 4328 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 4329 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 0, 0); 4330 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4331 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 0, 1); 4332 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4333 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 1, 2); 4334 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4335 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 3, 1); 4336 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 4337 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 4, 1); 4338 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 4339 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 5, 2); 4340 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 4341 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 7, 1); 4342 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 4343 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 8, 1); 4344 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 4345 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 9, 1); 4346 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 4347 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 10, 1); 4348 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 4349 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 11, 1); 4350 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 4351 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 11, 1); 4352 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 4353 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 12, 1); 4354 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 4355 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 13, 1); 4356 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 4357 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 14, 1); 4358 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 4359 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 15, 1); 4360 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4361 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 16, 13); 4362 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4363 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 30, 2); 4364 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDSCP, 4365 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 32, 8); 4366 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 4367 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 40, 8); 4368 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 4369 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 48, 16); 4370 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 4371 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 48, 16); 4372 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 4373 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 64, 16); 4374 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 4375 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 64, 16); 4376 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4377 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 80, 16); 4378 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4379 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 96, 16); 4380 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 4381 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 112, 32); 4382 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 4383 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 144, 32); 4384 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 4385 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 176, 16); 4386 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 4387 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 192, 48); 4388 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4389 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 240, 16); 4390 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4391 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 240, 12); 4392 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4393 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 252, 1); 4394 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4395 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 253, 3); 4396 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 4397 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 256, 48); 4398 } else { 4399 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 4400 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 0, 0); 4401 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4402 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 0, 1); 4403 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4404 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 1, 2); 4405 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4406 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 3, 1); 4407 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 4408 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 4, 4); 4409 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 4410 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 8, 1); 4411 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 4412 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 9, 1); 4413 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 4414 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 10, 1); 4415 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 4416 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 11, 4); 4417 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 4418 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 15, 1); 4419 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 4420 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 16, 8); 4421 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 4422 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 24, 8); 4423 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4424 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 32, 13); 4425 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4426 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 46, 2); 4427 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 4428 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 48, 16); 4429 4430 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 4431 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 64, 10); 4432 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 4433 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 64, 10); 4434 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 4435 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 64, 10); 4436 4437 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 4438 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 74, 10); 4439 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 4440 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 74, 10); 4441 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 4442 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 74, 10); 4443 4444 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 4445 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 84, 12); 4446 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 4447 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 84, 12); 4448 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 4449 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 84, 12); 4450 4451 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4452 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 96, 16); 4453 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4454 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 112, 16); 4455 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 4456 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 128, 32); 4457 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 4458 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 160, 32); 4459 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 4460 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 192, 16); 4461 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 4462 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 192, 16); 4463 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4464 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 192, 16); 4465 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 4466 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 208, 48); 4467 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 4468 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV4, 256, 48); 4469 } 4470 /* _FP_EXT_ACL_144_IPV6 */ 4471 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 4472 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV6, 0, 0); 4473 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4474 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV6, 0, 16); 4475 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4476 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV6, 0, 12); 4477 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4478 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV6, 12, 1); 4479 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4480 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV6, 13, 3); 4481 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 4482 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV6, 16, 64); 4483 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High, 4484 _bcmFieldSliceSelExternal, _FP_EXT_ACL_144_IPV6, 80, 64); 4485 4486 /* _FP_EXT_ACL_IPV6_SHORT */ 4487 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 4488 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 0, 0); 4489 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 4490 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 0, 128); 4491 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4492 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 128, 1); 4493 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4494 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 129, 2); 4495 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4496 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 131, 1); 4497 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 4498 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 132, 4); 4499 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 4500 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 136, 1); 4501 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 4502 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 137, 4); 4503 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 4504 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 141, 1); 4505 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4506 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 144, 13); 4507 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4508 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 158, 2); 4509 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 4510 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 160, 8); 4511 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6TrafficClass, 4512 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 168, 8); 4513 4514 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 4515 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 176, 10); 4516 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 4517 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 176, 10); 4518 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 4519 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 176, 10); 4520 4521 #if 0 /* For V6 SHORT, F5 is set to F5_CLASSID_SRC so interface class 4522 * qualifiers are not applicable */ 4523 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 4524 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 186, 6); 4525 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 4526 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 186, 6); 4527 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 4528 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 186, 6); 4529 #endif 4530 4531 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4532 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 192, 16); 4533 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4534 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 208, 16); 4535 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 4536 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 224, 16); 4537 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4538 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 240, 16); 4539 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4540 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 240, 12); 4541 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4542 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 252, 1); 4543 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4544 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 253, 3); 4545 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 4546 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_SHORT, 256, 128); 4547 4548 /* _FP_EXT_ACL_IPV6_FULL */ 4549 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 4550 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 0, 0); 4551 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 4552 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 0, 128); 4553 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4554 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 128, 1); 4555 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4556 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 129, 2); 4557 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4558 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 131, 1); 4559 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 4560 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 132, 1); 4561 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 4562 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 133, 1); 4563 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 4564 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 134, 1); 4565 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 4566 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 135, 4); 4567 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 4568 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 139, 1); 4569 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4570 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 144, 13); 4571 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4572 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 158, 2); 4573 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 4574 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 160, 8); 4575 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6TrafficClass, 4576 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 168, 8); 4577 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 4578 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 176, 8); 4579 4580 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 4581 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 192, 10); 4582 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 4583 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 192, 10); 4584 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 4585 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 192, 10); 4586 4587 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 4588 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 202, 10); 4589 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 4590 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 202, 10); 4591 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 4592 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 202, 10); 4593 4594 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 4595 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 212, 12); 4596 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 4597 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 212, 12); 4598 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 4599 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 212, 12); 4600 4601 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4602 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 224, 16); 4603 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4604 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 240, 16); 4605 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4606 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 256, 16); 4607 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4608 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 256, 12); 4609 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4610 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 268, 1); 4611 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4612 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 269, 3); 4613 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 4614 _bcmFieldSliceSelExternal, _FP_EXT_ACL_IPV6_FULL, 272, 128); 4615 4616 /* _FP_EXT_ACL_L2_IPV6 */ 4617 if (soc_property_get(unit, spn_EXT_L2IP6_ACL_TABLE_MASTER_KEY_TYPE, 0) == 1) { 4618 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 4619 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 0, 0); 4620 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 4621 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 0, 128); 4622 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4623 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 128, 1); 4624 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4625 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 129, 2); 4626 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4627 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 131, 1); 4628 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 4629 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 132, 1); 4630 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 4631 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 133, 2); 4632 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 4633 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 135, 1); 4634 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 4635 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 136, 1); 4636 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 4637 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 137, 1); 4638 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 4639 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 138, 1); 4640 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 4641 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 139, 1); 4642 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 4643 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 139, 1); 4644 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 4645 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 140, 1); 4646 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 4647 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 141, 1); 4648 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 4649 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 142, 1); 4650 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 4651 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 143, 1); 4652 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4653 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 150, 2); 4654 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4655 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 152, 16); 4656 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4657 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 152, 12); 4658 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4659 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 164, 1); 4660 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4661 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 165, 3); 4662 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6TrafficClass, 4663 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 168, 8); 4664 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6NextHeader, 4665 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 176, 8); 4666 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4667 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 184, 16); 4668 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4669 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 200, 16); 4670 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 4671 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 216, 16); 4672 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 4673 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 216, 16); 4674 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 4675 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 232, 16); 4676 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 4677 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 232, 16); 4678 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 4679 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 249, 6); 4680 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel, 4681 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 284, 20); 4682 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 4683 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 304, 128); 4684 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 4685 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 432, 48); 4686 } else { 4687 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 4688 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 0, 0); 4689 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 4690 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 0, 128); 4691 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4692 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 128, 1); 4693 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4694 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 129, 2); 4695 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4696 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 131, 1); 4697 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 4698 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 132, 1); 4699 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 4700 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 133, 1); 4701 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4702 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 136, 13); 4703 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 4704 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 149, 3); 4705 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 4706 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 152, 16); 4707 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 4708 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 152, 12); 4709 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 4710 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 164, 1); 4711 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 4712 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 165, 3); 4713 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6TrafficClass, 4714 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 168, 8); 4715 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6NextHeader, 4716 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 176, 8); 4717 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 4718 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 184, 16); 4719 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 4720 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 200, 16); 4721 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 4722 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 216, 128); 4723 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 4724 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 344, 48); 4725 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 4726 _bcmFieldSliceSelExternal, _FP_EXT_ACL_L2_IPV6, 392, 48); 4727 } 4728 return (BCM_E_NONE); 4729 } 4730 4731 #ifdef BCM_HELIX4_SUPPORT 4732 /* 4733 * Function: 4734 * _field_hx4_ingress_qualifiers_init 4735 * Purpose: 4736 * Initialize device stage ingress qualifiers 4737 * select codes & offsets 4738 * Parameters: 4739 * unit - (IN) BCM device number. 4740 * stage_fc - (IN) Field Processor stage control structure. 4741 * 4742 * Returns: 4743 * BCM_E_NONE 4744 */ 4745 STATIC int 4746 _field_hx4_ingress_qualifiers_init(int unit, _field_stage_t *stage_fc) 4747 { 4748 4749 4750 const unsigned 4751 fp_tcam_ofs = 0, 4752 f1_ofs = 187 - 2, 4753 f2_ofs = 59 - 2, 4754 f3_ofs = 10 - 2, 4755 dw_f1_ofs = 170 - 3 + 1, 4756 dw_f2_ofs = 42 - 3 + 1, 4757 dw_f3_ofs = 10 - 3 + 1, 4758 dw_f4_ofs = 3 - 3 + 1, 4759 fp_global_mask_tcam_ofs = ALIGN32(soc_mem_field_length(unit, FP_TCAMm, KEYf)), 4760 dw_f0_ofs = 1 - 1, 4761 fixed_ofs = 65 - 1; 4762 4763 _FP_QUAL_DECL; 4764 4765 /* Input parameters check. */ 4766 if (NULL == stage_fc) { 4767 return (BCM_E_PARAM); 4768 } 4769 4770 /***** Special qualifiers *****/ 4771 4772 /* Handled outside normal qualifier set/get scheme */ 4773 4774 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage, 4775 _bcmFieldSliceSelDisable, 0, 4776 0, 0 4777 ); 4778 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageIngress, 4779 _bcmFieldSliceSelDisable, 0, 4780 0, 0 4781 ); 4782 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 4783 _bcmFieldSliceSelDisable, 0, 4784 0, 0 4785 ); 4786 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 4787 _bcmFieldSliceSelDisable, 0, 4788 0, 0 4789 ); 4790 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 4791 _bcmFieldSliceSelDisable, 0, 4792 0, 0 4793 ); 4794 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts, 4795 _bcmFieldSliceSelDisable, 0, 4796 0, 0 4797 ); 4798 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNormalizeIpAddrs, 4799 _bcmFieldSliceSelDisable, 0, 4800 0, 0 4801 ); 4802 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNormalizeMacAddrs, 4803 _bcmFieldSliceSelDisable, 0, 4804 0, 0 4805 ); 4806 4807 /***** FIXED single-wide *****/ 4808 4809 /* N.B. Fixed field is in FP_GLOBAL_MASK_TCAM */ 4810 4811 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 4812 _bcmFieldSliceSelDisable, 0, 4813 fp_global_mask_tcam_ofs + fixed_ofs, 1 4814 ); 4815 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType, 4816 _bcmFieldSliceSelDisable, 0, 4817 fp_global_mask_tcam_ofs + fixed_ofs + 1, 3 4818 ); 4819 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifySvpValid, 4820 _bcmFieldSliceSelDisable, 0, 4821 fp_global_mask_tcam_ofs + fixed_ofs + 4, 1 4822 ); 4823 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 4824 _bcmFieldSliceSelDisable, 0, 4825 fp_global_mask_tcam_ofs + fixed_ofs + 4, 1 4826 ); 4827 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 4828 _bcmFieldSliceSelDisable, 0, 4829 fp_global_mask_tcam_ofs + fixed_ofs + 5, 4 4830 ); 4831 /* (fp_global_mask_tcam_ofs + fixed_ofs + 9, 1) is reserved */ 4832 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 4833 _bcmFieldSliceSelDisable, 0, 4834 fp_global_mask_tcam_ofs + fixed_ofs + 10, 1 4835 ); 4836 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 4837 _bcmFieldSliceSelDisable, 0, 4838 fp_global_mask_tcam_ofs + fixed_ofs + 11, 1 4839 ); 4840 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopbackType, 4841 _bcmFieldSliceSelDisable, 0, 4842 _bcmFieldSliceLoopbackTypeSelect, 0, 4843 fp_global_mask_tcam_ofs + fixed_ofs + 12, 5 4844 ); 4845 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTunnelType, 4846 _bcmFieldSliceSelDisable, 0, 4847 _bcmFieldSliceLoopbackTypeSelect, 1, 4848 fp_global_mask_tcam_ofs + fixed_ofs + 12, 5 4849 ); 4850 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopback, 4851 _bcmFieldSliceSelDisable, 0, 4852 _bcmFieldSliceLoopbackTypeSelect, 0, 4853 fp_global_mask_tcam_ofs + fixed_ofs + 16, 1 4854 ); 4855 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 4856 _bcmFieldSliceSelDisable, 0, 4857 fp_global_mask_tcam_ofs + fixed_ofs + 17, 1 4858 ); 4859 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRecoverableDrop, 4860 _bcmFieldSliceSelDisable, 0, 4861 fp_global_mask_tcam_ofs + fixed_ofs + 18, 1 4862 ); 4863 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 4864 _bcmFieldSliceSelDisable, 0, 4865 fp_global_mask_tcam_ofs + fixed_ofs + 19, 1 4866 ); 4867 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit, 4868 _bcmFieldSliceSelDisable, 0, 4869 fp_global_mask_tcam_ofs + fixed_ofs + 20, 1 4870 ); 4871 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRepCopy, 4872 _bcmFieldSliceSelDisable, 0, 4873 fp_global_mask_tcam_ofs + fixed_ofs + 21, 1 4874 ); 4875 4876 /***** FPF1 single-wide *****/ 4877 4878 /* FPF1 = 0 */ 4879 4880 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 4881 _bcmFieldSliceSelFpf1, 0, 4882 _bcmFieldSliceSrcClassSelect, 0, 4883 _bcmFieldSliceFpf1SrcDstClassSelect, 0, 4884 fp_tcam_ofs + f1_ofs, 10 4885 ); 4886 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 4887 _bcmFieldSliceSelFpf1, 0, 4888 _bcmFieldSliceSrcClassSelect, 1, 4889 _bcmFieldSliceFpf1SrcDstClassSelect, 0, 4890 fp_tcam_ofs + f1_ofs, 10 4891 ); 4892 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 4893 _bcmFieldSliceSelFpf1, 0, 4894 _bcmFieldSliceSrcClassSelect, 2, 4895 _bcmFieldSliceFpf1SrcDstClassSelect, 0, 4896 fp_tcam_ofs + f1_ofs, 10 4897 ); 4898 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 4899 _bcmFieldSliceSelFpf1, 0, 4900 _bcmFieldSliceSrcClassSelect, 3, 4901 _bcmFieldSliceFpf1SrcDstClassSelect, 0, 4902 fp_tcam_ofs + f1_ofs, 10 4903 ); 4904 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 4905 _bcmFieldSliceSelFpf1, 0, 4906 _bcmFieldSliceDstClassSelect, 0, 4907 _bcmFieldSliceFpf1SrcDstClassSelect, 1, 4908 fp_tcam_ofs + f1_ofs, 10 4909 ); 4910 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 4911 _bcmFieldSliceSelFpf1, 0, 4912 _bcmFieldSliceDstClassSelect, 1, 4913 _bcmFieldSliceFpf1SrcDstClassSelect, 1, 4914 fp_tcam_ofs + f1_ofs, 10 4915 ); 4916 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 4917 _bcmFieldSliceSelFpf1, 0, 4918 _bcmFieldSliceDstClassSelect, 2, 4919 _bcmFieldSliceFpf1SrcDstClassSelect, 1, 4920 fp_tcam_ofs + f1_ofs, 10 4921 ); 4922 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 4923 _bcmFieldSliceSelFpf1, 0, 4924 _bcmFieldSliceDstClassSelect, 3, 4925 _bcmFieldSliceFpf1SrcDstClassSelect, 1, 4926 fp_tcam_ofs + f1_ofs, 10 4927 ); 4928 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 4929 _bcmFieldSliceSelFpf1, 0, 4930 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 4931 fp_tcam_ofs + f1_ofs + 10, 14 4932 ); 4933 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 4934 _bcmFieldSliceSelFpf1, 0, 4935 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 4936 fp_tcam_ofs + f1_ofs + 10, 14 4937 ); 4938 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 4939 _bcmFieldSliceSelFpf1, 0, 4940 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 4941 fp_tcam_ofs + f1_ofs + 10, 14 4942 ); 4943 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 4944 _bcmFieldSliceSelFpf1, 0, 4945 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMplsGport, 4946 fp_tcam_ofs + f1_ofs + 24, 13 4947 ); 4948 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 4949 _bcmFieldSliceSelFpf1, 0, 4950 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityVlanGport, 4951 fp_tcam_ofs + f1_ofs + 24, 13 4952 ); 4953 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 4954 _bcmFieldSliceSelFpf1, 0, 4955 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMimGport, 4956 fp_tcam_ofs + f1_ofs + 24, 13 4957 ); 4958 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 4959 _bcmFieldSliceSelFpf1, 0, 4960 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 4961 fp_tcam_ofs + f1_ofs + 24, 13 4962 ); 4963 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 4964 _bcmFieldSliceSelFpf1, 0, 4965 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityWlanGport, 4966 fp_tcam_ofs + f1_ofs + 24, 13 4967 ); 4968 4969 /* FPF1 = 1 */ 4970 4971 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 4972 _bcmFieldSliceSelFpf1, 1, 4973 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 4974 fp_tcam_ofs + f1_ofs, 21 4975 ); 4976 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 4977 _bcmFieldSliceSelFpf1, 1, 4978 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 4979 fp_tcam_ofs + f1_ofs, 21 4980 ); 4981 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 4982 _bcmFieldSliceSelFpf1, 1, 4983 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 4984 fp_tcam_ofs + f1_ofs, 21 4985 ); 4986 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 4987 _bcmFieldSliceSelFpf1, 1, 4988 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 4989 fp_tcam_ofs + f1_ofs, 21 4990 ); 4991 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 4992 _bcmFieldSliceSelFpf1, 1, 4993 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 4994 fp_tcam_ofs + f1_ofs, 21 4995 ); 4996 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 4997 _bcmFieldSliceSelFpf1, 1, 4998 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 4999 fp_tcam_ofs + f1_ofs, 21 5000 ); 5001 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 5002 _bcmFieldSliceSelFpf1, 1, 5003 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 5004 fp_tcam_ofs + f1_ofs, 21 5005 ); 5006 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 5007 _bcmFieldSliceSelFpf1, 1, 5008 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 5009 fp_tcam_ofs + f1_ofs, 21 5010 ); 5011 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 5012 _bcmFieldSliceSelFpf1, 1, 5013 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 5014 fp_tcam_ofs + f1_ofs, 21 5015 ); 5016 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 5017 _bcmFieldSliceSelFpf1, 1, 5018 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 5019 fp_tcam_ofs + f1_ofs, 21 5020 ); 5021 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 5022 _bcmFieldSliceSelFpf1, 1, 5023 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 5024 fp_tcam_ofs + f1_ofs + 21, 17 5025 ); 5026 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 5027 _bcmFieldSliceSelFpf1, 1, 5028 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 5029 fp_tcam_ofs + f1_ofs + 21, 17 5030 ); 5031 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 5032 _bcmFieldSliceSelFpf1, 1, 5033 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMplsGport, 5034 fp_tcam_ofs + f1_ofs + 21, 17 5035 ); 5036 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 5037 _bcmFieldSliceSelFpf1, 1, 5038 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVlanGport, 5039 fp_tcam_ofs + f1_ofs + 21, 17 5040 ); 5041 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 5042 _bcmFieldSliceSelFpf1, 1, 5043 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMimGport, 5044 fp_tcam_ofs + f1_ofs + 21, 17 5045 ); 5046 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 5047 _bcmFieldSliceSelFpf1, 1, 5048 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 5049 fp_tcam_ofs + f1_ofs + 21, 17 5050 ); 5051 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 5052 _bcmFieldSliceSelFpf1, 1, 5053 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityWlanGport, 5054 fp_tcam_ofs + f1_ofs + 21, 17 5055 ); 5056 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 5057 _bcmFieldSliceSelFpf1, 1, 5058 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 5059 fp_tcam_ofs + f1_ofs + 21, 17 5060 ); 5061 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport, 5062 _bcmFieldSliceSelFpf1, 1, 5063 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 5064 fp_tcam_ofs + f1_ofs + 21, 17 5065 ); 5066 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 5067 _bcmFieldSliceSelFpf1, 1, 5068 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 5069 fp_tcam_ofs + f1_ofs + 21 + 7, 10 5070 ); 5071 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId, 5072 _bcmFieldSliceSelFpf1, 1, 5073 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 5074 fp_tcam_ofs + f1_ofs + 21 + 7, 8 5075 ); 5076 5077 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 5078 _bcmFieldSliceSelFpf1, 1, 5079 fp_tcam_ofs + f1_ofs + 37, 1 5080 ); 5081 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 5082 _bcmFieldSliceSelFpf1, 1, 5083 fp_tcam_ofs + f1_ofs + 38, 3 5084 ); 5085 5086 /* FPF1 = 2 */ 5087 5088 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 5089 _bcmFieldSliceSelFpf1, 2, 5090 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 5091 fp_tcam_ofs + f1_ofs, 21 5092 ); 5093 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 5094 _bcmFieldSliceSelFpf1, 2, 5095 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 5096 fp_tcam_ofs + f1_ofs, 21 5097 ); 5098 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 5099 _bcmFieldSliceSelFpf1, 2, 5100 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 5101 fp_tcam_ofs + f1_ofs, 21 5102 ); 5103 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 5104 _bcmFieldSliceSelFpf1, 2, 5105 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 5106 fp_tcam_ofs + f1_ofs, 21 5107 ); 5108 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 5109 _bcmFieldSliceSelFpf1, 2, 5110 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 5111 fp_tcam_ofs + f1_ofs, 21 5112 ); 5113 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 5114 _bcmFieldSliceSelFpf1, 2, 5115 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 5116 fp_tcam_ofs + f1_ofs, 21 5117 ); 5118 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 5119 _bcmFieldSliceSelFpf1, 2, 5120 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 5121 fp_tcam_ofs + f1_ofs, 21 5122 ); 5123 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 5124 _bcmFieldSliceSelFpf1, 2, 5125 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 5126 fp_tcam_ofs + f1_ofs, 21 5127 ); 5128 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 5129 _bcmFieldSliceSelFpf1, 2, 5130 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 5131 fp_tcam_ofs + f1_ofs, 21 5132 ); 5133 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 5134 _bcmFieldSliceSelFpf1, 2, 5135 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 5136 fp_tcam_ofs + f1_ofs, 21 5137 ); 5138 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 5139 _bcmFieldSliceSelFpf1, 2, 5140 fp_tcam_ofs + f1_ofs + 21, 3 5141 ); 5142 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 5143 _bcmFieldSliceSelFpf1, 2, 5144 _bcmFieldSliceDstClassSelect, 0, 5145 fp_tcam_ofs + f1_ofs + 24, 10 5146 ); 5147 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 5148 _bcmFieldSliceSelFpf1, 2, 5149 _bcmFieldSliceDstClassSelect, 1, 5150 fp_tcam_ofs + f1_ofs + 24, 10 5151 ); 5152 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 5153 _bcmFieldSliceSelFpf1, 2, 5154 _bcmFieldSliceDstClassSelect, 2, 5155 fp_tcam_ofs + f1_ofs + 24, 10 5156 ); 5157 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 5158 _bcmFieldSliceSelFpf1, 2, 5159 _bcmFieldSliceDstClassSelect, 3, 5160 fp_tcam_ofs + f1_ofs + 24, 10 5161 ); 5162 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 5163 _bcmFieldSliceSelFpf1, 2, 5164 _bcmFieldSliceSrcClassSelect, 0, 5165 fp_tcam_ofs + f1_ofs + 34, 10 5166 ); 5167 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 5168 _bcmFieldSliceSelFpf1, 2, 5169 _bcmFieldSliceSrcClassSelect, 1, 5170 fp_tcam_ofs + f1_ofs + 34, 10 5171 ); 5172 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 5173 _bcmFieldSliceSelFpf1, 2, 5174 _bcmFieldSliceSrcClassSelect, 2, 5175 fp_tcam_ofs + f1_ofs + 34, 10 5176 ); 5177 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 5178 _bcmFieldSliceSelFpf1, 2, 5179 _bcmFieldSliceSrcClassSelect, 3, 5180 fp_tcam_ofs + f1_ofs + 34, 10 5181 ); 5182 5183 /* FPF1 = 3 */ 5184 5185 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 5186 _bcmFieldSliceSelFpf1, 3, 5187 fp_tcam_ofs + f1_ofs, 16 5188 ); 5189 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 5190 _bcmFieldSliceSelFpf1, 3, 5191 fp_tcam_ofs + f1_ofs, 12 5192 ); 5193 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 5194 _bcmFieldSliceSelFpf1, 3, 5195 fp_tcam_ofs + f1_ofs + 12, 1 5196 ); 5197 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 5198 _bcmFieldSliceSelFpf1, 3, 5199 fp_tcam_ofs + f1_ofs + 13, 3 5200 ); 5201 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 5202 _bcmFieldSliceSelFpf1, 3, 5203 fp_tcam_ofs + f1_ofs + 16, 16 5204 ); 5205 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 5206 _bcmFieldSliceSelFpf1, 3, 5207 fp_tcam_ofs + f1_ofs + 16, 12 5208 ); 5209 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 5210 _bcmFieldSliceSelFpf1, 3, 5211 fp_tcam_ofs + f1_ofs + 16 + 12, 1 5212 ); 5213 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 5214 _bcmFieldSliceSelFpf1, 3, 5215 fp_tcam_ofs + f1_ofs + 16 + 13, 3 5216 ); 5217 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid, 5218 _bcmFieldSliceSelFpf1, 3, 5219 fp_tcam_ofs + f1_ofs + 32, 2 5220 ); 5221 5222 /* FPF1 = 4 */ 5223 5224 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 5225 _bcmFieldSliceSelFpf1, 4, 5226 fp_tcam_ofs + f1_ofs, 16 5227 ); 5228 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 5229 _bcmFieldSliceSelFpf1, 4, 5230 fp_tcam_ofs + f1_ofs, 12 5231 ); 5232 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 5233 _bcmFieldSliceSelFpf1, 4, 5234 fp_tcam_ofs + f1_ofs + 12, 1 5235 ); 5236 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 5237 _bcmFieldSliceSelFpf1, 4, 5238 fp_tcam_ofs + f1_ofs + 13, 3 5239 ); 5240 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 5241 _bcmFieldSliceSelFpf1, 4, 5242 fp_tcam_ofs + f1_ofs + 16, 16 5243 ); 5244 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter, 5245 _bcmFieldSliceSelFpf1, 4, 5246 fp_tcam_ofs + f1_ofs + 32, 3 5247 ); 5248 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner, 5249 _bcmFieldSliceSelFpf1, 4, 5250 fp_tcam_ofs + f1_ofs + 35, 3 5251 ); 5252 5253 /* FPF1 = 5 */ 5254 5255 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 5256 _bcmFieldSliceSelFpf1, 5, 5257 fp_tcam_ofs + f1_ofs, 1 5258 ); 5259 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 5260 _bcmFieldSliceSelFpf1, 5, 5261 fp_tcam_ofs + f1_ofs + 1, 1 5262 ); 5263 /* Bit 2 is VXLT0/VXLT1 hit indicator; not used */ 5264 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 5265 _bcmFieldSliceSelFpf1, 5, 5266 fp_tcam_ofs + f1_ofs + 3, 1 5267 ); 5268 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 5269 _bcmFieldSliceSelFpf1, 5, 5270 fp_tcam_ofs + f1_ofs + 4, 2 5271 ); 5272 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 5273 _bcmFieldSliceSelFpf1, 5, 5274 fp_tcam_ofs + f1_ofs + 6, 1 5275 ); 5276 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 5277 _bcmFieldSliceSelFpf1, 5, 5278 fp_tcam_ofs + f1_ofs + 7, 1 5279 ); 5280 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 5281 _bcmFieldSliceSelFpf1, 5, 5282 fp_tcam_ofs + f1_ofs + 8, 1 5283 ); 5284 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 5285 _bcmFieldSliceSelFpf1, 5, 5286 fp_tcam_ofs + f1_ofs + 9, 1 5287 ); 5288 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 5289 _bcmFieldSliceSelFpf1, 5, 5290 fp_tcam_ofs + f1_ofs + 10, 1 5291 ); 5292 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 5293 _bcmFieldSliceSelFpf1, 5, 5294 fp_tcam_ofs + f1_ofs + 10, 1 5295 ); 5296 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 5297 _bcmFieldSliceSelFpf1, 5, 5298 fp_tcam_ofs + f1_ofs + 11, 1 5299 ); 5300 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 5301 _bcmFieldSliceSelFpf1, 5, 5302 fp_tcam_ofs + f1_ofs + 12, 1 5303 ); 5304 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 5305 _bcmFieldSliceSelFpf1, 5, 5306 fp_tcam_ofs + f1_ofs + 13, 1 5307 ); 5308 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 5309 _bcmFieldSliceSelFpf1, 5, 5310 fp_tcam_ofs + f1_ofs + 14, 1 5311 ); 5312 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit, 5313 _bcmFieldSliceSelFpf1, 5, 5314 fp_tcam_ofs + f1_ofs + 15, 1 5315 ); 5316 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit, 5317 _bcmFieldSliceSelFpf1, 5, 5318 fp_tcam_ofs + f1_ofs + 16, 1 5319 ); 5320 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit, 5321 _bcmFieldSliceSelFpf1, 5, 5322 fp_tcam_ofs + f1_ofs + 16, 1 5323 ); 5324 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit, 5325 _bcmFieldSliceSelFpf1, 5, 5326 fp_tcam_ofs + f1_ofs + 16, 1 5327 ); 5328 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit, 5329 _bcmFieldSliceSelFpf1, 5, 5330 fp_tcam_ofs + f1_ofs + 16, 1 5331 ); 5332 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit, 5333 _bcmFieldSliceSelFpf1, 5, 5334 fp_tcam_ofs + f1_ofs + 17, 1 5335 ); 5336 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit, 5337 _bcmFieldSliceSelFpf1, 5, 5338 fp_tcam_ofs + f1_ofs + 17, 1 5339 ); 5340 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit, 5341 _bcmFieldSliceSelFpf1, 5, 5342 fp_tcam_ofs + f1_ofs + 17, 1 5343 ); 5344 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit, 5345 _bcmFieldSliceSelFpf1, 5, 5346 fp_tcam_ofs + f1_ofs + 17, 1 5347 ); 5348 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 5349 _bcmFieldSliceSelFpf1, 5, 5350 fp_tcam_ofs + f1_ofs + 20, 6 5351 ); 5352 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 5353 _bcmFieldSliceSelFpf1, 5, 5354 fp_tcam_ofs + f1_ofs + 26, 16 5355 ); 5356 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 5357 _bcmFieldSliceSelFpf1, 5, 5358 fp_tcam_ofs + f1_ofs + 26, 12 5359 ); 5360 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 5361 _bcmFieldSliceSelFpf1, 5, 5362 fp_tcam_ofs + f1_ofs + 26 + 12, 1 5363 ); 5364 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 5365 _bcmFieldSliceSelFpf1, 5, 5366 fp_tcam_ofs + f1_ofs + 26 + 13, 3 5367 ); 5368 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid, 5369 _bcmFieldSliceSelFpf1, 5, 5370 fp_tcam_ofs + f1_ofs + 42, 2 5371 ); 5372 5373 /* FPF1 = 6 */ 5374 5375 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 5376 _bcmFieldSliceSelFpf1, 6, 5377 fp_tcam_ofs + f1_ofs, 16 5378 ); 5379 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 5380 _bcmFieldSliceSelFpf1, 6, 5381 fp_tcam_ofs + f1_ofs, 12 5382 ); 5383 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 5384 _bcmFieldSliceSelFpf1, 6, 5385 fp_tcam_ofs + f1_ofs + 12, 1 5386 ); 5387 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 5388 _bcmFieldSliceSelFpf1, 6, 5389 fp_tcam_ofs + f1_ofs + 13, 3 5390 ); 5391 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 5392 _bcmFieldSliceSelFpf1, 6, 5393 fp_tcam_ofs + f1_ofs + 16, 2 5394 ); 5395 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 5396 _bcmFieldSliceSelFpf1, 6, 5397 fp_tcam_ofs + f1_ofs + 16 + 2, 2 5398 ); 5399 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 5400 _bcmFieldSliceSelFpf1, 6, 5401 fp_tcam_ofs + f1_ofs + 20, 2 5402 ); 5403 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 5404 _bcmFieldSliceSelFpf1, 6, 5405 fp_tcam_ofs + f1_ofs + 22, 3 5406 ); 5407 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 5408 _bcmFieldSliceSelFpf1, 6, 5409 fp_tcam_ofs + f1_ofs + 25, 6 5410 ); 5411 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo, 5412 _bcmFieldSliceSelFpf1, 6, 5413 fp_tcam_ofs + f1_ofs + 31, 3 5414 ); 5415 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter, 5416 _bcmFieldSliceSelFpf1, 6, 5417 fp_tcam_ofs + f1_ofs + 34, 3 5418 ); 5419 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner, 5420 _bcmFieldSliceSelFpf1, 6, 5421 fp_tcam_ofs + f1_ofs + 37, 3 5422 ); 5423 5424 /* FPF1 = 7 */ 5425 5426 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 5427 _bcmFieldSliceSelFpf1, 7, 5428 fp_tcam_ofs + f1_ofs, 16 5429 ); 5430 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 5431 _bcmFieldSliceSelFpf1, 7, 5432 fp_tcam_ofs + f1_ofs, 12 5433 ); 5434 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 5435 _bcmFieldSliceSelFpf1, 7, 5436 fp_tcam_ofs + f1_ofs + 12, 1 5437 ); 5438 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 5439 _bcmFieldSliceSelFpf1, 7, 5440 fp_tcam_ofs + f1_ofs + 13, 3 5441 ); 5442 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 5443 _bcmFieldSliceSelFpf1, 7, 5444 _bcmFieldSliceSrcClassSelect, 0, 5445 fp_tcam_ofs + f1_ofs + 16, 10 5446 ); 5447 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 5448 _bcmFieldSliceSelFpf1, 7, 5449 _bcmFieldSliceSrcClassSelect, 1, 5450 fp_tcam_ofs + f1_ofs + 16, 10 5451 ); 5452 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 5453 _bcmFieldSliceSelFpf1, 7, 5454 _bcmFieldSliceSrcClassSelect, 2, 5455 fp_tcam_ofs + f1_ofs + 16, 10 5456 ); 5457 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 5458 _bcmFieldSliceSelFpf1, 7, 5459 _bcmFieldSliceSrcClassSelect, 3, 5460 fp_tcam_ofs + f1_ofs + 16, 10 5461 ); 5462 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 5463 _bcmFieldSliceSelFpf1, 7, 5464 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 5465 fp_tcam_ofs + f1_ofs + 26, 14 5466 ); 5467 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 5468 _bcmFieldSliceSelFpf1, 7, 5469 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 5470 fp_tcam_ofs + f1_ofs + 26, 14 5471 ); 5472 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 5473 _bcmFieldSliceSelFpf1, 7, 5474 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 5475 fp_tcam_ofs + f1_ofs + 26, 14 5476 ); 5477 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid, 5478 _bcmFieldSliceSelFpf1, 7, 5479 fp_tcam_ofs + f1_ofs + 40, 1 5480 ); 5481 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid, 5482 _bcmFieldSliceSelFpf1, 7, 5483 fp_tcam_ofs + f1_ofs + 41, 1 5484 ); 5485 5486 /* FPF1 = 8 */ 5487 5488 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 5489 _bcmFieldSliceSelFpf1, 8, 5490 fp_tcam_ofs + f1_ofs, 8 5491 ); 5492 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 5493 _bcmFieldSliceSelFpf1, 8, 5494 fp_tcam_ofs + f1_ofs + 8, 8 5495 ); 5496 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 5497 _bcmFieldSliceSelFpf1, 8, 5498 _bcmFieldSliceSrcClassSelect, 0, 5499 fp_tcam_ofs + f1_ofs + 16, 10 5500 ); 5501 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 5502 _bcmFieldSliceSelFpf1, 8, 5503 _bcmFieldSliceSrcClassSelect, 1, 5504 fp_tcam_ofs + f1_ofs + 16, 10 5505 ); 5506 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 5507 _bcmFieldSliceSelFpf1, 8, 5508 _bcmFieldSliceSrcClassSelect, 2, 5509 fp_tcam_ofs + f1_ofs + 16, 10 5510 ); 5511 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 5512 _bcmFieldSliceSelFpf1, 8, 5513 _bcmFieldSliceSrcClassSelect, 3, 5514 fp_tcam_ofs + f1_ofs + 16, 10 5515 ); 5516 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 5517 _bcmFieldSliceSelFpf1, 8, 5518 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 5519 fp_tcam_ofs + f1_ofs + 26, 14 5520 ); 5521 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 5522 _bcmFieldSliceSelFpf1, 8, 5523 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 5524 fp_tcam_ofs + f1_ofs + 26, 14 5525 ); 5526 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 5527 _bcmFieldSliceSelFpf1, 8, 5528 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 5529 fp_tcam_ofs + f1_ofs + 26, 14 5530 ); 5531 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal, 5532 _bcmFieldSliceSelFpf1, 8, 5533 fp_tcam_ofs + f1_ofs + 40, 1 5534 ); 5535 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpAddrsNormalized, 5536 _bcmFieldSliceSelFpf1, 8, 5537 fp_tcam_ofs + f1_ofs + 41, 1 5538 ); 5539 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized, 5540 _bcmFieldSliceSelFpf1, 8, 5541 fp_tcam_ofs + f1_ofs + 42, 1 5542 ); 5543 5544 /* FPF1 = 9 */ 5545 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData2, 5546 _bcmFieldSliceSelFpf1, 9, 5547 fp_tcam_ofs + f1_ofs, 32 5548 ); 5549 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid, 5550 _bcmFieldSliceSelFpf1, 9, 5551 fp_tcam_ofs + f1_ofs + 32, 1 5552 ); 5553 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid, 5554 _bcmFieldSliceSelFpf1, 9, 5555 fp_tcam_ofs + f1_ofs + 33, 1 5556 ); 5557 5558 /* 5559 * FPF1=9 - UDF1_31_0 5560 */ 5561 5562 /* FPF1 = 10 */ 5563 5564 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 5565 _bcmFieldSliceSelFpf1, 10, 5566 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 5567 fp_tcam_ofs + f1_ofs, 21 5568 ); 5569 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 5570 _bcmFieldSliceSelFpf1, 10, 5571 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 5572 fp_tcam_ofs + f1_ofs, 21 5573 ); 5574 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 5575 _bcmFieldSliceSelFpf1, 10, 5576 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 5577 fp_tcam_ofs + f1_ofs, 21 5578 ); 5579 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 5580 _bcmFieldSliceSelFpf1, 10, 5581 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 5582 fp_tcam_ofs + f1_ofs, 21 5583 ); 5584 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 5585 _bcmFieldSliceSelFpf1, 10, 5586 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 5587 fp_tcam_ofs + f1_ofs, 21 5588 ); 5589 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 5590 _bcmFieldSliceSelFpf1, 10, 5591 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 5592 fp_tcam_ofs + f1_ofs, 21 5593 ); 5594 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 5595 _bcmFieldSliceSelFpf1, 10, 5596 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 5597 fp_tcam_ofs + f1_ofs, 21 5598 ); 5599 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 5600 _bcmFieldSliceSelFpf1, 10, 5601 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 5602 fp_tcam_ofs + f1_ofs, 21 5603 ); 5604 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 5605 _bcmFieldSliceSelFpf1, 10, 5606 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 5607 fp_tcam_ofs + f1_ofs, 21 5608 ); 5609 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 5610 _bcmFieldSliceSelFpf1, 10, 5611 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 5612 fp_tcam_ofs + f1_ofs, 21 5613 ); 5614 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 5615 _bcmFieldSliceSelFpf1, 10, 5616 fp_tcam_ofs + f1_ofs + 21, 16 5617 ); 5618 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 5619 _bcmFieldSliceSelFpf1, 10, 5620 fp_tcam_ofs + f1_ofs + 21, 16 5621 ); 5622 5623 /* FPF1 = 11 */ 5624 5625 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 5626 _bcmFieldSliceSelFpf1, 11, 5627 fp_tcam_ofs + f1_ofs, 16 5628 ); 5629 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 5630 _bcmFieldSliceSelFpf1, 11, 5631 fp_tcam_ofs + f1_ofs, 16 5632 ); 5633 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 5634 _bcmFieldSliceSelFpf1, 11, 5635 fp_tcam_ofs + f1_ofs, 16 5636 ); 5637 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 5638 _bcmFieldSliceSelFpf1, 11, 5639 fp_tcam_ofs + f1_ofs + 7, 9 5640 ); 5641 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 5642 _bcmFieldSliceSelFpf1, 11, 5643 fp_tcam_ofs + f1_ofs + 16, 14 5644 ); 5645 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 5646 _bcmFieldSliceSelFpf1, 11, 5647 fp_tcam_ofs + f1_ofs + 16, 14 5648 ); 5649 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 5650 _bcmFieldSliceSelFpf1, 11, 5651 fp_tcam_ofs + f1_ofs + 16, 14 5652 ); 5653 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 5654 _bcmFieldSliceSelFpf1, 11, 5655 fp_tcam_ofs + f1_ofs + 16, 14 5656 ); 5657 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 5658 _bcmFieldSliceSelFpf1, 11, 5659 fp_tcam_ofs + f1_ofs + 29, 1 5660 ); 5661 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 5662 _bcmFieldSliceSelFpf1, 11, 5663 fp_tcam_ofs + f1_ofs + 30, 4 5664 ); 5665 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor, 5666 _bcmFieldSliceSelFpf1, 11, 5667 fp_tcam_ofs + f1_ofs + 34, 2 5668 ); 5669 5670 /* FPF1 = 12 */ 5671 5672 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 5673 _bcmFieldSliceSelFpf1, 12, 5674 fp_tcam_ofs + f1_ofs, 12 5675 ); 5676 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 5677 _bcmFieldSliceSelFpf1, 12, 5678 _bcmFieldSliceSrcClassSelect, 0, 5679 fp_tcam_ofs + f1_ofs + 12, 10 5680 ); 5681 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 5682 _bcmFieldSliceSelFpf1, 12, 5683 _bcmFieldSliceSrcClassSelect, 1, 5684 fp_tcam_ofs + f1_ofs + 12, 10 5685 ); 5686 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 5687 _bcmFieldSliceSelFpf1, 12, 5688 _bcmFieldSliceSrcClassSelect, 2, 5689 fp_tcam_ofs + f1_ofs + 12, 10 5690 ); 5691 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 5692 _bcmFieldSliceSelFpf1, 12, 5693 _bcmFieldSliceSrcClassSelect, 3, 5694 fp_tcam_ofs + f1_ofs + 12, 10 5695 ); 5696 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 5697 _bcmFieldSliceSelFpf1, 12, 5698 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMplsGport, 5699 fp_tcam_ofs + f1_ofs + 22, 13 5700 ); 5701 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 5702 _bcmFieldSliceSelFpf1, 12, 5703 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityVlanGport, 5704 fp_tcam_ofs + f1_ofs + 22, 13 5705 ); 5706 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 5707 _bcmFieldSliceSelFpf1, 12, 5708 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMimGport, 5709 fp_tcam_ofs + f1_ofs + 22, 13 5710 ); 5711 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 5712 _bcmFieldSliceSelFpf1, 12, 5713 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 5714 fp_tcam_ofs + f1_ofs + 22, 13 5715 ); 5716 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 5717 _bcmFieldSliceSelFpf1, 12, 5718 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityWlanGport, 5719 fp_tcam_ofs + f1_ofs + 22, 13 5720 ); 5721 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 5722 _bcmFieldSliceSelFpf1, 12, 5723 _bcmFieldSliceDstClassSelect, 0, 5724 fp_tcam_ofs + f1_ofs + 35, 10 5725 ); 5726 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 5727 _bcmFieldSliceSelFpf1, 12, 5728 _bcmFieldSliceDstClassSelect, 1, 5729 fp_tcam_ofs + f1_ofs + 35, 10 5730 ); 5731 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 5732 _bcmFieldSliceSelFpf1, 12, 5733 _bcmFieldSliceDstClassSelect, 2, 5734 fp_tcam_ofs + f1_ofs + 35, 10 5735 ); 5736 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 5737 _bcmFieldSliceSelFpf1, 12, 5738 _bcmFieldSliceDstClassSelect, 3, 5739 fp_tcam_ofs + f1_ofs + 35, 10 5740 ); 5741 5742 /* FPF1 = 13 */ 5743 5744 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag, 5745 _bcmFieldSliceSelFpf1, 13, 5746 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagVn, 5747 fp_tcam_ofs + f1_ofs, 33 5748 ); 5749 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag, 5750 _bcmFieldSliceSelFpf1, 13, 5751 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagCn, 5752 fp_tcam_ofs + f1_ofs, 33 5753 ); 5754 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag, 5755 _bcmFieldSliceSelFpf1, 13, 5756 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagFabricQueue, 5757 fp_tcam_ofs + f1_ofs, 33 5758 ); 5759 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabel, 5760 _bcmFieldSliceSelFpf1, 13, 5761 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 5762 fp_tcam_ofs + f1_ofs, 33 5763 ); 5764 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelTtl, 5765 _bcmFieldDevSelDisable, 0, 5766 _bcmFieldSliceSelFpf1, 13, 5767 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 5768 0, 5769 fp_tcam_ofs + f1_ofs, 8, 5770 fp_tcam_ofs + f1_ofs + 32, 1, 5771 0, 0, 5772 0 5773 ); 5774 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelBos, 5775 _bcmFieldDevSelDisable, 0, 5776 _bcmFieldSliceSelFpf1, 13, 5777 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 5778 0, 5779 fp_tcam_ofs + f1_ofs + 8, 1, 5780 fp_tcam_ofs + f1_ofs + 32, 1, 5781 0, 0, 5782 0 5783 ); 5784 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelExp, 5785 _bcmFieldDevSelDisable, 0, 5786 _bcmFieldSliceSelFpf1, 13, 5787 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 5788 0, 5789 fp_tcam_ofs + f1_ofs + 9, 3, 5790 fp_tcam_ofs + f1_ofs + 32, 1, 5791 0, 0, 5792 0 5793 ); 5794 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelId, 5795 _bcmFieldSliceSelFpf1, 13, 5796 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel, 5797 fp_tcam_ofs + f1_ofs + 12, 21 5798 ); 5799 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord, 5800 _bcmFieldSliceSelFpf1, 13, 5801 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsCntlWord, 5802 fp_tcam_ofs + f1_ofs, 33 5803 ); 5804 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper, 5805 _bcmFieldSliceSelFpf1, 13, 5806 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7A, 5807 fp_tcam_ofs + f1_ofs + 16, 17 5808 ); 5809 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower, 5810 _bcmFieldDevSelDisable, 0, 5811 _bcmFieldSliceSelFpf1, 13, 5812 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7A, 5813 0, 5814 fp_tcam_ofs + f1_ofs, 16, 5815 fp_tcam_ofs + f1_ofs + 32, 1, 5816 0, 0, 5817 0 5818 ); 5819 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper, 5820 _bcmFieldSliceSelFpf1, 13, 5821 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7B, 5822 fp_tcam_ofs + f1_ofs + 16, 17 5823 ); 5824 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower, 5825 _bcmFieldDevSelDisable, 0, 5826 _bcmFieldSliceSelFpf1, 13, 5827 _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7B, 5828 0, 5829 fp_tcam_ofs + f1_ofs, 16, 5830 fp_tcam_ofs + f1_ofs + 32, 1, 5831 0, 0, 5832 0 5833 ); 5834 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction, 5835 _bcmFieldSliceSelFpf1, 13, 5836 fp_tcam_ofs + f1_ofs + 33, 3 5837 ); 5838 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid, 5839 _bcmFieldSliceSelFpf1, 13, 5840 fp_tcam_ofs + f1_ofs + 36, 1 5841 ); 5842 5843 /***** FPF2 single-wide *****/ 5844 5845 /* FPF2 = 0 */ 5846 5847 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 5848 _bcmFieldSliceSelFpf2, 0, 5849 fp_tcam_ofs + f2_ofs, 8 5850 ); 5851 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 5852 _bcmFieldSliceSelFpf2, 0, 5853 fp_tcam_ofs + f2_ofs + 8, 6 5854 ); 5855 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFlags, 5856 _bcmFieldSliceSelFpf2, 0, 5857 fp_tcam_ofs + f2_ofs + 14, 2 5858 ); 5859 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 5860 _bcmFieldSliceSelFpf2, 0, 5861 fp_tcam_ofs + f2_ofs + 16, 8 5862 ); 5863 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 5864 _bcmFieldSliceSelFpf2, 0, 5865 fp_tcam_ofs + f2_ofs + 24, 16 5866 ); 5867 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 5868 _bcmFieldSliceSelFpf2, 0, 5869 fp_tcam_ofs + f2_ofs + 40, 16 5870 ); 5871 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode, 5872 _bcmFieldSliceSelFpf2, 0, 5873 fp_tcam_ofs + f2_ofs + 40, 16 5874 ); 5875 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 5876 _bcmFieldSliceSelFpf2, 0, 5877 fp_tcam_ofs + f2_ofs + 56, 8 5878 ); 5879 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 5880 _bcmFieldSliceSelFpf2, 0, 5881 fp_tcam_ofs + f2_ofs + 64, 32 5882 ); 5883 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 5884 _bcmFieldSliceSelFpf2, 0, 5885 fp_tcam_ofs + f2_ofs + 96, 32 5886 ); 5887 5888 /* FPF2 = 1 */ 5889 5890 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 5891 _bcmFieldSliceSelFpf2, 1, 5892 fp_tcam_ofs + f2_ofs, 8 5893 ); 5894 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 5895 _bcmFieldSliceSelFpf2, 1, 5896 fp_tcam_ofs + f2_ofs + 8, 6 5897 ); 5898 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 5899 _bcmFieldSliceSelFpf2, 1, 5900 fp_tcam_ofs + f2_ofs + 14, 2 5901 ); 5902 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 5903 _bcmFieldSliceSelFpf2, 1, 5904 fp_tcam_ofs + f2_ofs + 16, 8 5905 ); 5906 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 5907 _bcmFieldSliceSelFpf2, 1, 5908 fp_tcam_ofs + f2_ofs + 24, 16 5909 ); 5910 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 5911 _bcmFieldSliceSelFpf2, 1, 5912 fp_tcam_ofs + f2_ofs + 40, 16 5913 ); 5914 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode, 5915 _bcmFieldSliceSelFpf2, 1, 5916 fp_tcam_ofs + f2_ofs + 40, 16 5917 ); 5918 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 5919 _bcmFieldSliceSelFpf2, 1, 5920 fp_tcam_ofs + f2_ofs + 56, 8 5921 ); 5922 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 5923 _bcmFieldSliceSelFpf2, 1, 5924 fp_tcam_ofs + f2_ofs + 64, 32 5925 ); 5926 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 5927 _bcmFieldSliceSelFpf2, 1, 5928 fp_tcam_ofs + f2_ofs + 96, 32 5929 ); 5930 5931 /* FPF2 = 2 */ 5932 5933 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 5934 _bcmFieldSliceSelFpf2, 2, 5935 fp_tcam_ofs + f2_ofs, 128 5936 ); 5937 5938 /* FPF2 = 3 */ 5939 5940 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 5941 _bcmFieldSliceSelFpf2, 3, 5942 fp_tcam_ofs + f2_ofs, 128 5943 ); 5944 5945 /* FPF2 = 4 */ 5946 5947 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 5948 _bcmFieldSliceSelFpf2, 4, 5949 fp_tcam_ofs + f2_ofs, 8 5950 ); 5951 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 5952 _bcmFieldSliceSelFpf2, 4, 5953 fp_tcam_ofs + f2_ofs + 8, 6 5954 ); 5955 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel, 5956 _bcmFieldSliceSelFpf2, 4, 5957 fp_tcam_ofs + f2_ofs + 14, 20 5958 ); 5959 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 5960 _bcmFieldSliceSelFpf2, 4, 5961 fp_tcam_ofs + f2_ofs + 34, 8 5962 ); 5963 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 5964 _bcmFieldSliceSelFpf2, 4, 5965 fp_tcam_ofs + f2_ofs + 42, 8 5966 ); 5967 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 5968 _bcmFieldSliceSelFpf2, 4, 5969 fp_tcam_ofs + f2_ofs + 64, 64 5970 ); 5971 5972 /* FPF2 = 5 */ 5973 5974 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 5975 _bcmFieldSliceSelFpf2, 5, 5976 fp_tcam_ofs + f2_ofs, 16 5977 ); 5978 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 5979 _bcmFieldSliceSelFpf2, 5, 5980 fp_tcam_ofs + f2_ofs, 12 5981 ); 5982 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 5983 _bcmFieldSliceSelFpf2, 5, 5984 fp_tcam_ofs + f2_ofs + 12, 1 5985 ); 5986 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 5987 _bcmFieldSliceSelFpf2, 5, 5988 fp_tcam_ofs + f2_ofs + 13, 3 5989 ); 5990 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 5991 _bcmFieldSliceSelFpf2, 5, 5992 fp_tcam_ofs + f2_ofs + 16, 16 5993 ); 5994 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 5995 _bcmFieldSliceSelFpf2, 5, 5996 fp_tcam_ofs + f2_ofs + 32, 48 5997 ); 5998 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 5999 _bcmFieldSliceSelFpf2, 5, 6000 fp_tcam_ofs + f2_ofs + 80, 48 6001 ); 6002 6003 /* FPF2 = 6 */ 6004 6005 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 6006 _bcmFieldSliceSelFpf2, 6, 6007 fp_tcam_ofs + f2_ofs, 16 6008 ); 6009 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 6010 _bcmFieldSliceSelFpf2, 6, 6011 fp_tcam_ofs + f2_ofs, 12 6012 ); 6013 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 6014 _bcmFieldSliceSelFpf2, 6, 6015 fp_tcam_ofs + f2_ofs + 12, 1 6016 ); 6017 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 6018 _bcmFieldSliceSelFpf2, 6, 6019 fp_tcam_ofs + f2_ofs + 13, 3 6020 ); 6021 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 6022 _bcmFieldSliceSelFpf2, 6, 6023 fp_tcam_ofs + f2_ofs + 16, 16 6024 ); 6025 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 6026 _bcmFieldSliceSelFpf2, 6, 6027 fp_tcam_ofs + f2_ofs + 32, 48 6028 ); 6029 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 6030 _bcmFieldSliceSelFpf2, 6, 6031 fp_tcam_ofs + f2_ofs + 80, 32 6032 ); 6033 6034 /* FPF2 = 7 */ 6035 6036 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 6037 _bcmFieldSliceSelFpf2, 7, 6038 fp_tcam_ofs + f2_ofs, 16 6039 ); 6040 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 6041 _bcmFieldSliceSelFpf2, 7, 6042 fp_tcam_ofs + f2_ofs, 12 6043 ); 6044 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 6045 _bcmFieldSliceSelFpf2, 7, 6046 fp_tcam_ofs + f2_ofs + 12, 1 6047 ); 6048 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 6049 _bcmFieldSliceSelFpf2, 7, 6050 fp_tcam_ofs + f2_ofs + 13, 3 6051 ); 6052 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 6053 _bcmFieldSliceSelFpf2, 7, 6054 fp_tcam_ofs + f2_ofs + 16, 16 6055 ); 6056 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 6057 _bcmFieldSliceSelFpf2, 7, 6058 fp_tcam_ofs + f2_ofs + 32, 8 6059 ); 6060 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 6061 _bcmFieldSliceSelFpf2, 7, 6062 fp_tcam_ofs + f2_ofs + 40, 8 6063 ); 6064 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 6065 _bcmFieldSliceSelFpf2, 7, 6066 fp_tcam_ofs + f2_ofs + 48, 32 6067 ); 6068 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 6069 _bcmFieldSliceSelFpf2, 7, 6070 fp_tcam_ofs + f2_ofs + 80, 48 6071 ); 6072 6073 /* FPF2 = 8 */ 6074 6075 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0, 6076 _bcmFieldSliceSelFpf2, 8, 6077 fp_tcam_ofs + f2_ofs, 128 6078 ); 6079 6080 /* FPF2 = 9 */ 6081 6082 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1, 6083 _bcmFieldSliceSelFpf2, 9, 6084 fp_tcam_ofs + f2_ofs, 128 6085 ); 6086 6087 /* FPF2 = 10 */ 6088 6089 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High, 6090 _bcmFieldSliceSelFpf2, 10, 6091 fp_tcam_ofs + f2_ofs, 64 6092 ); 6093 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 6094 _bcmFieldSliceSelFpf2, 10, 6095 fp_tcam_ofs + f2_ofs + 64, 64 6096 ); 6097 6098 /* FPF2 = 11 */ 6099 6100 /* 6101 * DIP_127_96 omitted -- no qualifier? Omitted in Trident, too. 6102 */ 6103 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 6104 _bcmFieldSliceSelFpf2, 11, 6105 fp_tcam_ofs + f2_ofs + 32, 48 6106 ); 6107 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 6108 _bcmFieldSliceSelFpf2, 11, 6109 fp_tcam_ofs + f2_ofs + 80, 48 6110 ); 6111 6112 /***** FPF3 single-wide *****/ 6113 6114 /* FPF3 = 0 */ 6115 6116 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 6117 _bcmFieldSliceSelFpf3, 0, 6118 _bcmFieldSliceSrcClassSelect, 0, 6119 _bcmFieldSliceFpf3SrcDstClassSelect, 0, 6120 fp_tcam_ofs + f3_ofs, 10 6121 ); 6122 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 6123 _bcmFieldSliceSelFpf3, 0, 6124 _bcmFieldSliceSrcClassSelect, 1, 6125 _bcmFieldSliceFpf3SrcDstClassSelect, 0, 6126 fp_tcam_ofs + f3_ofs, 10 6127 ); 6128 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 6129 _bcmFieldSliceSelFpf3, 0, 6130 _bcmFieldSliceSrcClassSelect, 2, 6131 _bcmFieldSliceFpf3SrcDstClassSelect, 0, 6132 fp_tcam_ofs + f3_ofs, 10 6133 ); 6134 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 6135 _bcmFieldSliceSelFpf3, 0, 6136 _bcmFieldSliceSrcClassSelect, 3, 6137 _bcmFieldSliceFpf3SrcDstClassSelect, 0, 6138 fp_tcam_ofs + f3_ofs, 10 6139 ); 6140 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 6141 _bcmFieldSliceSelFpf3, 0, 6142 _bcmFieldSliceDstClassSelect, 0, 6143 _bcmFieldSliceFpf3SrcDstClassSelect, 1, 6144 fp_tcam_ofs + f3_ofs, 10 6145 ); 6146 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 6147 _bcmFieldSliceSelFpf3, 0, 6148 _bcmFieldSliceDstClassSelect, 1, 6149 _bcmFieldSliceFpf3SrcDstClassSelect, 1, 6150 fp_tcam_ofs + f3_ofs, 10 6151 ); 6152 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 6153 _bcmFieldSliceSelFpf3, 0, 6154 _bcmFieldSliceDstClassSelect, 2, 6155 _bcmFieldSliceFpf3SrcDstClassSelect, 1, 6156 fp_tcam_ofs + f3_ofs, 10 6157 ); 6158 _FP_QUAL_THREE_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 6159 _bcmFieldSliceSelFpf3, 0, 6160 _bcmFieldSliceDstClassSelect, 3, 6161 _bcmFieldSliceFpf3SrcDstClassSelect, 1, 6162 fp_tcam_ofs + f3_ofs, 10 6163 ); 6164 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 6165 _bcmFieldSliceSelFpf3, 0, 6166 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 6167 fp_tcam_ofs + f3_ofs + 10, 14 6168 ); 6169 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 6170 _bcmFieldSliceSelFpf3, 0, 6171 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 6172 fp_tcam_ofs + f3_ofs + 10, 14 6173 ); 6174 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 6175 _bcmFieldSliceSelFpf3, 0, 6176 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 6177 fp_tcam_ofs + f3_ofs + 10, 14 6178 ); 6179 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 6180 _bcmFieldSliceSelFpf3, 0, 6181 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMplsGport, 6182 fp_tcam_ofs + f3_ofs + 24, 13 6183 ); 6184 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 6185 _bcmFieldSliceSelFpf3, 0, 6186 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityVlanGport, 6187 fp_tcam_ofs + f3_ofs + 24, 13 6188 ); 6189 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 6190 _bcmFieldSliceSelFpf3, 0, 6191 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityMimGport, 6192 fp_tcam_ofs + f3_ofs + 24, 13 6193 ); 6194 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 6195 _bcmFieldSliceSelFpf1, 12, 6196 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 6197 fp_tcam_ofs + f3_ofs + 24, 13 6198 ); 6199 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 6200 _bcmFieldSliceSelFpf3, 0, 6201 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityWlanGport, 6202 fp_tcam_ofs + f3_ofs + 24, 13 6203 ); 6204 6205 /* FPF3 = 1 */ 6206 6207 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 6208 _bcmFieldSliceSelFpf3, 1, 6209 _bcmFieldSliceSrcClassSelect, 0, 6210 fp_tcam_ofs + f3_ofs, 10 6211 ); 6212 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 6213 _bcmFieldSliceSelFpf3, 1, 6214 _bcmFieldSliceSrcClassSelect, 1, 6215 fp_tcam_ofs + f3_ofs, 10 6216 ); 6217 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 6218 _bcmFieldSliceSelFpf3, 1, 6219 _bcmFieldSliceSrcClassSelect, 2, 6220 fp_tcam_ofs + f3_ofs, 10 6221 ); 6222 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 6223 _bcmFieldSliceSelFpf3, 1, 6224 _bcmFieldSliceSrcClassSelect, 3, 6225 fp_tcam_ofs + f3_ofs, 10 6226 ); 6227 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 6228 _bcmFieldSliceSelFpf3, 1, 6229 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVrf, 6230 fp_tcam_ofs + f3_ofs + 10, 14 6231 ); 6232 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn, 6233 _bcmFieldSliceSelFpf3, 1, 6234 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVpn, 6235 fp_tcam_ofs + f3_ofs + 10, 14 6236 ); 6237 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId, 6238 _bcmFieldSliceSelFpf3, 1, 6239 _bcmFieldSliceFwdFieldSelect, _bcmFieldFwdFieldVlan, 6240 fp_tcam_ofs + f3_ofs + 10, 14 6241 ); 6242 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 6243 _bcmFieldSliceSelFpf3, 1, 6244 fp_tcam_ofs + f3_ofs + 24, 12 6245 ); 6246 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 6247 _bcmFieldSliceSelFpf3, 1, 6248 _bcmFieldSliceDstClassSelect, 0, 6249 fp_tcam_ofs + f3_ofs + 36, 10 6250 ); 6251 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 6252 _bcmFieldSliceSelFpf3, 1, 6253 _bcmFieldSliceDstClassSelect, 1, 6254 fp_tcam_ofs + f3_ofs + 36, 10 6255 ); 6256 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 6257 _bcmFieldSliceSelFpf3, 1, 6258 _bcmFieldSliceDstClassSelect, 2, 6259 fp_tcam_ofs + f3_ofs + 36, 10 6260 ); 6261 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 6262 _bcmFieldSliceSelFpf3, 1, 6263 _bcmFieldSliceDstClassSelect, 3, 6264 fp_tcam_ofs + f3_ofs + 36, 10 6265 ); 6266 6267 /* FPF3 = 2 */ 6268 6269 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 6270 _bcmFieldSliceSelFpf3, 2, 6271 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 6272 fp_tcam_ofs + f3_ofs, 21 6273 ); 6274 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 6275 _bcmFieldSliceSelFpf3, 2, 6276 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 6277 fp_tcam_ofs + f3_ofs, 21 6278 ); 6279 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 6280 _bcmFieldSliceSelFpf3, 2, 6281 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 6282 fp_tcam_ofs + f3_ofs, 21 6283 ); 6284 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 6285 _bcmFieldSliceSelFpf3, 2, 6286 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 6287 fp_tcam_ofs + f3_ofs, 21 6288 ); 6289 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 6290 _bcmFieldSliceSelFpf3, 2, 6291 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 6292 fp_tcam_ofs + f3_ofs, 21 6293 ); 6294 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 6295 _bcmFieldSliceSelFpf3, 2, 6296 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 6297 fp_tcam_ofs + f3_ofs, 21 6298 ); 6299 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 6300 _bcmFieldSliceSelFpf3, 2, 6301 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 6302 fp_tcam_ofs + f3_ofs, 21 6303 ); 6304 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 6305 _bcmFieldSliceSelFpf3, 2, 6306 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 6307 fp_tcam_ofs + f3_ofs, 21 6308 ); 6309 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 6310 _bcmFieldSliceSelFpf3, 2, 6311 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 6312 fp_tcam_ofs + f3_ofs, 21 6313 ); 6314 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 6315 _bcmFieldSliceSelFpf3, 2, 6316 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 6317 fp_tcam_ofs + f3_ofs, 21 6318 ); 6319 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 6320 _bcmFieldSliceSelFpf3, 2, 6321 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 6322 fp_tcam_ofs + f3_ofs + 21, 17 6323 ); 6324 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 6325 _bcmFieldSliceSelFpf3, 2, 6326 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp, 6327 fp_tcam_ofs + f3_ofs + 21, 17 6328 ); 6329 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 6330 _bcmFieldSliceSelFpf3, 2, 6331 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMplsGport, 6332 fp_tcam_ofs + f3_ofs + 21, 17 6333 ); 6334 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 6335 _bcmFieldSliceSelFpf3, 2, 6336 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVlanGport, 6337 fp_tcam_ofs + f3_ofs + 21, 17 6338 ); 6339 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 6340 _bcmFieldSliceSelFpf3, 2, 6341 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMimGport, 6342 fp_tcam_ofs + f3_ofs + 21, 17 6343 ); 6344 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress, 6345 _bcmFieldSliceSelFpf3, 2, 6346 _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress, 6347 fp_tcam_ofs + f3_ofs + 21, 17 6348 ); 6349 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 6350 _bcmFieldSliceSelFpf3, 2, 6351 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityWlanGport, 6352 fp_tcam_ofs + f3_ofs + 21, 17 6353 ); 6354 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 6355 _bcmFieldSliceSelFpf3, 2, 6356 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 6357 fp_tcam_ofs + f3_ofs + 21, 17 6358 ); 6359 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport, 6360 _bcmFieldSliceSelFpf3, 2, 6361 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 6362 fp_tcam_ofs + f3_ofs + 21, 17 6363 ); 6364 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 6365 _bcmFieldSliceSelFpf3, 2, 6366 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 6367 fp_tcam_ofs + f3_ofs + 21 + 7, 10 6368 ); 6369 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId, 6370 _bcmFieldSliceSelFpf3, 2, 6371 _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport, 6372 fp_tcam_ofs + f3_ofs + 21 + 7, 8 6373 ); 6374 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 6375 _bcmFieldSliceSelFpf3, 2, 6376 fp_tcam_ofs + f3_ofs + 37, 1 6377 ); 6378 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 6379 _bcmFieldSliceSelFpf3, 2, 6380 fp_tcam_ofs + f3_ofs + 38, 3 6381 ); 6382 6383 /* FPF3 = 3 */ 6384 6385 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 6386 _bcmFieldSliceSelFpf3, 3, 6387 fp_tcam_ofs + f3_ofs, 16 6388 ); 6389 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 6390 _bcmFieldSliceSelFpf3, 3, 6391 fp_tcam_ofs + f3_ofs, 12 6392 ); 6393 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 6394 _bcmFieldSliceSelFpf3, 3, 6395 fp_tcam_ofs + f3_ofs + 12, 1 6396 ); 6397 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 6398 _bcmFieldSliceSelFpf3, 3, 6399 fp_tcam_ofs + f3_ofs + 13, 3 6400 ); 6401 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 6402 _bcmFieldSliceSelFpf3, 3, 6403 fp_tcam_ofs + f3_ofs + 16, 2 6404 ); 6405 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 6406 _bcmFieldSliceSelFpf3, 3, 6407 fp_tcam_ofs + f3_ofs + 16 + 2, 2 6408 ); 6409 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 6410 _bcmFieldSliceSelFpf3, 3, 6411 fp_tcam_ofs + f3_ofs + 20, 2 6412 ); 6413 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 6414 _bcmFieldSliceSelFpf3, 3, 6415 fp_tcam_ofs + f3_ofs + 22, 3 6416 ); 6417 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 6418 _bcmFieldSliceSelFpf3, 3, 6419 fp_tcam_ofs + f3_ofs + 25, 6 6420 ); 6421 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo, 6422 _bcmFieldSliceSelFpf3, 3, 6423 fp_tcam_ofs + f3_ofs + 31, 3 6424 ); 6425 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter, 6426 _bcmFieldSliceSelFpf3, 3, 6427 fp_tcam_ofs + f3_ofs + 34, 3 6428 ); 6429 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner, 6430 _bcmFieldSliceSelFpf3, 3, 6431 fp_tcam_ofs + f3_ofs + 37, 3 6432 ); 6433 6434 /* FPF3 = 4 */ 6435 6436 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 6437 _bcmFieldSliceSelFpf3, 4, 6438 fp_tcam_ofs + f3_ofs, 16 6439 ); 6440 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 6441 _bcmFieldSliceSelFpf3, 4, 6442 fp_tcam_ofs + f3_ofs, 12 6443 ); 6444 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 6445 _bcmFieldSliceSelFpf3, 4, 6446 fp_tcam_ofs + f3_ofs + 12, 1 6447 ); 6448 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 6449 _bcmFieldSliceSelFpf3, 4, 6450 fp_tcam_ofs + f3_ofs + 13, 3 6451 ); 6452 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 6453 _bcmFieldSliceSelFpf3, 4, 6454 fp_tcam_ofs + f3_ofs + 16, 16 6455 ); 6456 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 6457 _bcmFieldSliceSelFpf3, 4, 6458 fp_tcam_ofs + f3_ofs + 16, 12 6459 ); 6460 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 6461 _bcmFieldSliceSelFpf3, 4, 6462 fp_tcam_ofs + f3_ofs + 16 + 12, 1 6463 ); 6464 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 6465 _bcmFieldSliceSelFpf3, 4, 6466 fp_tcam_ofs + f3_ofs + 16 + 13, 3 6467 ); 6468 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 6469 _bcmFieldSliceSelFpf3, 4, 6470 fp_tcam_ofs + f3_ofs + 32, 4 6471 ); 6472 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor, 6473 _bcmFieldSliceSelFpf3, 4, 6474 fp_tcam_ofs + f3_ofs + 36, 2 6475 ); 6476 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal, 6477 _bcmFieldSliceSelFpf3, 4, 6478 fp_tcam_ofs + f3_ofs + 38, 1 6479 ); 6480 6481 /* FPF3 = 5 */ 6482 6483 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 6484 _bcmFieldSliceSelFpf3, 5, 6485 fp_tcam_ofs + f3_ofs, 16 6486 ); 6487 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 6488 _bcmFieldSliceSelFpf3, 5, 6489 fp_tcam_ofs + f3_ofs, 12 6490 ); 6491 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 6492 _bcmFieldSliceSelFpf3, 5, 6493 fp_tcam_ofs + f3_ofs + 12, 1 6494 ); 6495 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 6496 _bcmFieldSliceSelFpf3, 5, 6497 fp_tcam_ofs + f3_ofs + 13, 3 6498 ); 6499 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 6500 _bcmFieldSliceSelFpf3, 5, 6501 fp_tcam_ofs + f3_ofs + 16, 16 6502 ); 6503 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter, 6504 _bcmFieldSliceSelFpf3, 5, 6505 fp_tcam_ofs + f3_ofs + 32, 3 6506 ); 6507 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner, 6508 _bcmFieldSliceSelFpf3, 5, 6509 fp_tcam_ofs + f3_ofs + 35, 3 6510 ); 6511 6512 /* FPF3 = 6 */ 6513 6514 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 6515 _bcmFieldSliceSelFpf3, 6, 6516 fp_tcam_ofs + f3_ofs, 1 6517 ); 6518 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 6519 _bcmFieldSliceSelFpf3, 6, 6520 fp_tcam_ofs + f3_ofs + 1, 1 6521 ); 6522 /* Bit 2 is VXLT0/VXLT1 hit indicator; not used */ 6523 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 6524 _bcmFieldSliceSelFpf3, 6, 6525 fp_tcam_ofs + f3_ofs + 3, 1 6526 ); 6527 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 6528 _bcmFieldSliceSelFpf3, 6, 6529 fp_tcam_ofs + f3_ofs + 4, 2 6530 ); 6531 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 6532 _bcmFieldSliceSelFpf3, 6, 6533 fp_tcam_ofs + f3_ofs + 6, 1 6534 ); 6535 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 6536 _bcmFieldSliceSelFpf3, 6, 6537 fp_tcam_ofs + f3_ofs + 7, 1 6538 ); 6539 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 6540 _bcmFieldSliceSelFpf3, 6, 6541 fp_tcam_ofs + f3_ofs + 8, 1 6542 ); 6543 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 6544 _bcmFieldSliceSelFpf3, 6, 6545 fp_tcam_ofs + f3_ofs + 9, 1 6546 ); 6547 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 6548 _bcmFieldSliceSelFpf3, 6, 6549 fp_tcam_ofs + f3_ofs + 10, 1 6550 ); 6551 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 6552 _bcmFieldSliceSelFpf3, 6, 6553 fp_tcam_ofs + f3_ofs + 10, 1 6554 ); 6555 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 6556 _bcmFieldSliceSelFpf3, 6, 6557 fp_tcam_ofs + f3_ofs + 11, 1 6558 ); 6559 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 6560 _bcmFieldSliceSelFpf3, 6, 6561 fp_tcam_ofs + f3_ofs + 12, 1 6562 ); 6563 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 6564 _bcmFieldSliceSelFpf3, 6, 6565 fp_tcam_ofs + f3_ofs + 13, 1 6566 ); 6567 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 6568 _bcmFieldSliceSelFpf3, 6, 6569 fp_tcam_ofs + f3_ofs + 14, 1 6570 ); 6571 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit, 6572 _bcmFieldSliceSelFpf3, 6, 6573 fp_tcam_ofs + f3_ofs + 15, 1 6574 ); 6575 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit, 6576 _bcmFieldSliceSelFpf3, 6, 6577 fp_tcam_ofs + f3_ofs + 16, 1 6578 ); 6579 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit, 6580 _bcmFieldSliceSelFpf3, 6, 6581 fp_tcam_ofs + f3_ofs + 16, 1 6582 ); 6583 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit, 6584 _bcmFieldSliceSelFpf3, 6, 6585 fp_tcam_ofs + f3_ofs + 16, 1 6586 ); 6587 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit, 6588 _bcmFieldSliceSelFpf3, 6, 6589 fp_tcam_ofs + f3_ofs + 16, 1 6590 ); 6591 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit, 6592 _bcmFieldSliceSelFpf3, 6, 6593 fp_tcam_ofs + f3_ofs + 17, 1 6594 ); 6595 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit, 6596 _bcmFieldSliceSelFpf3, 6, 6597 fp_tcam_ofs + f3_ofs + 17, 1 6598 ); 6599 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit, 6600 _bcmFieldSliceSelFpf3, 6, 6601 fp_tcam_ofs + f3_ofs + 17, 1 6602 ); 6603 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit, 6604 _bcmFieldSliceSelFpf3, 6, 6605 fp_tcam_ofs + f3_ofs + 17, 1 6606 ); 6607 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 6608 _bcmFieldSliceSelFpf3, 6, 6609 fp_tcam_ofs + f3_ofs + 20, 6 6610 ); 6611 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 6612 _bcmFieldSliceSelFpf3, 6, 6613 fp_tcam_ofs + f3_ofs + 26, 16 6614 ); 6615 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 6616 _bcmFieldSliceSelFpf3, 6, 6617 fp_tcam_ofs + f3_ofs + 26, 12 6618 ); 6619 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 6620 _bcmFieldSliceSelFpf3, 6, 6621 fp_tcam_ofs + f3_ofs + 26 + 12, 1 6622 ); 6623 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 6624 _bcmFieldSliceSelFpf3, 6, 6625 fp_tcam_ofs + f3_ofs + 26 + 13, 3 6626 ); 6627 6628 /* FPF3 = 7 */ 6629 6630 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 6631 _bcmFieldSliceSelFpf3, 7, 6632 fp_tcam_ofs + f3_ofs, 24 6633 ); 6634 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31, 6635 _bcmFieldSliceSelFpf3, 7, 6636 _bcmFieldSliceIntfClassSelect, 3, 6637 fp_tcam_ofs + f3_ofs + 24, 8 6638 ); 6639 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 6640 _bcmFieldSliceSelFpf3, 7, 6641 _bcmFieldSliceIntfClassSelect, 0, 6642 fp_tcam_ofs + f3_ofs + 24, 12 6643 ); 6644 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 6645 _bcmFieldSliceSelFpf3, 7, 6646 _bcmFieldSliceIntfClassSelect, 1, 6647 fp_tcam_ofs + f3_ofs + 24, 12 6648 ); 6649 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 6650 _bcmFieldSliceSelFpf3, 7, 6651 _bcmFieldSliceIntfClassSelect, 2, 6652 fp_tcam_ofs + f3_ofs + 24, 12 6653 ); 6654 6655 /* FPF3 = 8 */ 6656 6657 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel, 6658 _bcmFieldSliceSelFpf3, 8, 6659 fp_tcam_ofs + f3_ofs, 20 6660 ); 6661 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 6662 _bcmFieldSliceSelFpf3, 8, 6663 fp_tcam_ofs + f3_ofs + 20, 2 6664 ); 6665 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 6666 _bcmFieldSliceSelFpf3, 8, 6667 fp_tcam_ofs + f3_ofs + 20 + 2, 2 6668 ); 6669 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 6670 _bcmFieldSliceSelFpf3, 8, 6671 fp_tcam_ofs + f3_ofs + 24, 2 6672 ); 6673 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid, 6674 _bcmFieldSliceSelFpf3, 8, 6675 fp_tcam_ofs + f3_ofs + 26, 2 6676 ); 6677 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid, 6678 _bcmFieldSliceSelFpf3, 8, 6679 fp_tcam_ofs + f3_ofs + 28, 2 6680 ); 6681 6682 /* FPF3 = 9 */ 6683 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData3, 6684 _bcmFieldSliceSelFpf3, 9, 6685 fp_tcam_ofs + f3_ofs, 32 6686 ); 6687 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid, 6688 _bcmFieldSliceSelFpf3, 9, 6689 fp_tcam_ofs + f3_ofs + 32, 1 6690 ); 6691 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid, 6692 _bcmFieldSliceSelFpf3, 9, 6693 fp_tcam_ofs + f3_ofs + 33, 1 6694 ); 6695 6696 /* 6697 * FPF3=9 - UDF1_95_64 6698 */ 6699 6700 /* FPF3 = 10 */ 6701 6702 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 6703 _bcmFieldSliceSelFpf3, 10, 6704 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 6705 fp_tcam_ofs + f3_ofs, 21 6706 ); 6707 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 6708 _bcmFieldSliceSelFpf3, 10, 6709 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 6710 fp_tcam_ofs + f3_ofs, 21 6711 ); 6712 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 6713 _bcmFieldSliceSelFpf3, 10, 6714 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 6715 fp_tcam_ofs + f3_ofs, 21 6716 ); 6717 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 6718 _bcmFieldSliceSelFpf3, 10, 6719 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 6720 fp_tcam_ofs + f3_ofs, 21 6721 ); 6722 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 6723 _bcmFieldSliceSelFpf3, 10, 6724 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 6725 fp_tcam_ofs + f3_ofs, 21 6726 ); 6727 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 6728 _bcmFieldSliceSelFpf3, 10, 6729 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 6730 fp_tcam_ofs + f3_ofs, 21 6731 ); 6732 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 6733 _bcmFieldSliceSelFpf3, 10, 6734 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 6735 fp_tcam_ofs + f3_ofs, 21 6736 ); 6737 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 6738 _bcmFieldSliceSelFpf3, 10, 6739 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 6740 fp_tcam_ofs + f3_ofs, 21 6741 ); 6742 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 6743 _bcmFieldSliceSelFpf3, 10, 6744 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 6745 fp_tcam_ofs + f3_ofs, 21 6746 ); 6747 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 6748 _bcmFieldSliceSelFpf3, 10, 6749 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 6750 fp_tcam_ofs + f3_ofs, 21 6751 ); 6752 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 6753 _bcmFieldSliceSelFpf3, 10, 6754 fp_tcam_ofs + f3_ofs + 21, 16 6755 ); 6756 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 6757 _bcmFieldSliceSelFpf3, 10, 6758 fp_tcam_ofs + f3_ofs + 21, 16 6759 ); 6760 6761 /* FPF3 = 11 */ 6762 6763 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 6764 _bcmFieldSliceSelFpf3, 11, 6765 fp_tcam_ofs + f3_ofs, 16 6766 ); 6767 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 6768 _bcmFieldSliceSelFpf3, 11, 6769 fp_tcam_ofs + f3_ofs, 16 6770 ); 6771 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport, 6772 _bcmFieldSliceSelFpf3, 11, 6773 fp_tcam_ofs + f3_ofs, 16 6774 ); 6775 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport, 6776 _bcmFieldSliceSelFpf3, 11, 6777 fp_tcam_ofs + f3_ofs + 7, 9 6778 ); 6779 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 6780 _bcmFieldSliceSelFpf3, 11, 6781 fp_tcam_ofs + f3_ofs + 16, 14 6782 ); 6783 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 6784 _bcmFieldSliceSelFpf3, 11, 6785 fp_tcam_ofs + f3_ofs + 16, 14 6786 ); 6787 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 6788 _bcmFieldSliceSelFpf3, 11, 6789 fp_tcam_ofs + f3_ofs + 16, 14 6790 ); 6791 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 6792 _bcmFieldSliceSelFpf3, 11, 6793 fp_tcam_ofs + f3_ofs + 16, 14 6794 ); 6795 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 6796 _bcmFieldSliceSelFpf3, 11, 6797 fp_tcam_ofs + f3_ofs + 29, 1 6798 ); 6799 6800 /* FPF3 = 12 */ 6801 6802 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag, 6803 _bcmFieldSliceSelFpf3, 12, 6804 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagVn, 6805 fp_tcam_ofs + f3_ofs, 33 6806 ); 6807 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag, 6808 _bcmFieldSliceSelFpf3, 12, 6809 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagCn, 6810 fp_tcam_ofs + f3_ofs, 33 6811 ); 6812 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag, 6813 _bcmFieldSliceSelFpf3, 12, 6814 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagFabricQueue, 6815 fp_tcam_ofs + f3_ofs, 33 6816 ); 6817 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabel, 6818 _bcmFieldSliceSelFpf3, 12, 6819 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 6820 fp_tcam_ofs + f3_ofs, 33 6821 ); 6822 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelTtl, 6823 _bcmFieldDevSelDisable, 0, 6824 _bcmFieldSliceSelFpf3, 12, 6825 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 6826 0, 6827 fp_tcam_ofs + f3_ofs, 8, 6828 fp_tcam_ofs + f3_ofs + 32, 1, 6829 0, 0, 6830 0 6831 ); 6832 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelBos, 6833 _bcmFieldDevSelDisable, 0, 6834 _bcmFieldSliceSelFpf3, 12, 6835 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 6836 0, 6837 fp_tcam_ofs + f3_ofs + 8, 1, 6838 fp_tcam_ofs + f3_ofs + 32, 1, 6839 0, 0, 6840 0 6841 ); 6842 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelExp, 6843 _bcmFieldDevSelDisable, 0, 6844 _bcmFieldSliceSelFpf3, 12, 6845 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 6846 0, 6847 fp_tcam_ofs + f3_ofs + 9, 3, 6848 fp_tcam_ofs + f3_ofs + 32, 1, 6849 0, 0, 6850 0 6851 ); 6852 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelId, 6853 _bcmFieldSliceSelFpf3, 12, 6854 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel, 6855 fp_tcam_ofs + f3_ofs + 12, 21 6856 ); 6857 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord, 6858 _bcmFieldSliceSelFpf3, 12, 6859 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsCntlWord, 6860 fp_tcam_ofs + f3_ofs, 33 6861 ); 6862 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper, 6863 _bcmFieldSliceSelFpf3, 12, 6864 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7A, 6865 fp_tcam_ofs + f3_ofs + 16, 17 6866 ); 6867 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower, 6868 _bcmFieldDevSelDisable, 0, 6869 _bcmFieldSliceSelFpf3, 12, 6870 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7A, 6871 0, 6872 fp_tcam_ofs + f3_ofs, 16, 6873 fp_tcam_ofs + f3_ofs + 32, 1, 6874 0, 0, 6875 0 6876 ); 6877 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper, 6878 _bcmFieldSliceSelFpf3, 12, 6879 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7B, 6880 fp_tcam_ofs + f3_ofs + 16, 17 6881 ); 6882 _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower, 6883 _bcmFieldDevSelDisable, 0, 6884 _bcmFieldSliceSelFpf3, 12, 6885 _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7B, 6886 0, 6887 fp_tcam_ofs + f3_ofs, 16, 6888 fp_tcam_ofs + f3_ofs + 32, 1, 6889 0, 0, 6890 0 6891 ); 6892 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction, 6893 _bcmFieldSliceSelFpf3, 12, 6894 fp_tcam_ofs + f3_ofs + 33, 3 6895 ); 6896 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid, 6897 _bcmFieldSliceSelFpf3, 12, 6898 fp_tcam_ofs + f3_ofs + 36, 1 6899 ); 6900 6901 /* FPF3 = 13 */ 6902 6903 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 6904 _bcmFieldSliceSelFpf3, 13, 6905 fp_tcam_ofs + f3_ofs, 8 6906 ); 6907 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeader2Type, 6908 _bcmFieldSliceSelFpf3, 13, 6909 fp_tcam_ofs + f3_ofs + 8, 8 6910 ); 6911 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 6912 _bcmFieldSliceSelFpf3, 13, 6913 fp_tcam_ofs + f3_ofs + 16, 8 6914 ); 6915 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 6916 _bcmFieldSliceSelFpf3, 13, 6917 fp_tcam_ofs + f3_ofs + 24, 8 6918 ); 6919 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal, 6920 _bcmFieldSliceSelFpf3, 13, 6921 fp_tcam_ofs + f3_ofs + 32, 1 6922 ); 6923 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpAddrsNormalized, 6924 _bcmFieldSliceSelFpf3, 13, 6925 fp_tcam_ofs + f3_ofs + 33, 1 6926 ); 6927 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized, 6928 _bcmFieldSliceSelFpf3, 13, 6929 fp_tcam_ofs + f3_ofs + 34, 1 6930 ); 6931 6932 /***** FPF0 double-wide *****/ 6933 6934 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 6935 _bcmFieldSliceSelDisable, 0, 6936 _bcmFieldSliceSelDisable, 0, 6937 fp_global_mask_tcam_ofs + dw_f0_ofs, 16 6938 ); 6939 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 6940 _bcmFieldSliceSelDisable, 0, 6941 _bcmFieldSliceSelDisable, 0, 6942 fp_global_mask_tcam_ofs + dw_f0_ofs, 16 6943 ); 6944 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport, 6945 _bcmFieldSliceSelDisable, 0, 6946 _bcmFieldSliceSelDisable, 0, 6947 fp_global_mask_tcam_ofs + dw_f0_ofs + 16, 17 6948 ); 6949 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport, 6950 _bcmFieldSliceSelDisable, 0, 6951 _bcmFieldSliceSelDisable, 0, 6952 fp_global_mask_tcam_ofs + dw_f0_ofs + 16, 17 6953 ); 6954 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport, 6955 _bcmFieldSliceSelDisable, 0, 6956 _bcmFieldSliceSelDisable, 0, 6957 fp_global_mask_tcam_ofs + dw_f0_ofs + 16, 17 6958 ); 6959 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport, 6960 _bcmFieldSliceSelDisable, 0, 6961 _bcmFieldSliceSelDisable, 0, 6962 fp_global_mask_tcam_ofs + dw_f0_ofs + 16, 17 6963 ); 6964 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid, 6965 _bcmFieldSliceSelDisable, 0, 6966 _bcmFieldSliceSelDisable, 0, 6967 fp_global_mask_tcam_ofs + dw_f0_ofs + 32, 1 6968 ); 6969 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyColor, 6970 _bcmFieldSliceSelDisable, 0, 6971 _bcmFieldSliceSelDisable, 0, 6972 fp_global_mask_tcam_ofs + dw_f0_ofs + 33, 2 6973 ); 6974 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 6975 _bcmFieldSliceSelDisable, 0, 6976 _bcmFieldSliceSelDisable, 0, 6977 fp_global_mask_tcam_ofs + dw_f0_ofs + 35, 2 6978 ); 6979 6980 /***** FPF1 double-wide *****/ 6981 6982 /* FPF1 = 0 */ 6983 6984 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl, 6985 _bcmFieldSliceSelFpf1, 0, 6986 _bcmFieldSliceSelDisable, 0, 6987 fp_tcam_ofs + dw_f1_ofs, 8 6988 ); 6989 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 6990 _bcmFieldSliceSelFpf1, 0, 6991 _bcmFieldSliceSelDisable, 0, 6992 fp_tcam_ofs + dw_f1_ofs + 8, 16 6993 ); 6994 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 6995 _bcmFieldSliceSelFpf1, 0, 6996 _bcmFieldSliceSelDisable, 0, 6997 fp_tcam_ofs + dw_f1_ofs + 24, 16 6998 ); 6999 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode, 7000 _bcmFieldSliceSelFpf1, 0, 7001 _bcmFieldSliceSelDisable, 0, 7002 fp_tcam_ofs + dw_f1_ofs + 24, 16 7003 ); 7004 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 7005 _bcmFieldSliceSelFpf1, 0, 7006 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 7007 fp_tcam_ofs + dw_f1_ofs + 40, 21 7008 ); 7009 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 7010 _bcmFieldSliceSelFpf1, 0, 7011 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityGlp, 7012 fp_tcam_ofs + dw_f1_ofs + 40, 21 7013 ); 7014 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstGport, 7015 _bcmFieldSliceSelFpf1, 0, 7016 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityCommonGport, 7017 fp_tcam_ofs + dw_f1_ofs + 40, 21 7018 ); 7019 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport, 7020 _bcmFieldSliceSelFpf1, 0, 7021 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMplsGport, 7022 fp_tcam_ofs + dw_f1_ofs + 40, 21 7023 ); 7024 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport, 7025 _bcmFieldSliceSelFpf1, 0, 7026 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityVlanGport, 7027 fp_tcam_ofs + dw_f1_ofs + 40, 21 7028 ); 7029 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport, 7030 _bcmFieldSliceSelFpf1, 0, 7031 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMimGport, 7032 fp_tcam_ofs + dw_f1_ofs + 40, 21 7033 ); 7034 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress, 7035 _bcmFieldSliceSelFpf1, 0, 7036 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 7037 fp_tcam_ofs + dw_f1_ofs + 40, 21 7038 ); 7039 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops, 7040 _bcmFieldSliceSelFpf1, 0, 7041 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityL3Egress, 7042 fp_tcam_ofs + dw_f1_ofs + 40, 21 7043 ); 7044 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup, 7045 _bcmFieldSliceSelFpf1, 0, 7046 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMulticastGroup, 7047 fp_tcam_ofs + dw_f1_ofs + 40, 21 7048 ); 7049 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath, 7050 _bcmFieldSliceSelFpf1, 0, 7051 _bcmFieldSliceDstFwdEntitySelect, _bcmFieldFwdEntityMultipath, 7052 fp_tcam_ofs + dw_f1_ofs + 40, 21 7053 ); 7054 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 7055 _bcmFieldSliceSelFpf1, 0, 7056 _bcmFieldSliceSelDisable, 0, 7057 fp_tcam_ofs + dw_f1_ofs + 61, 4 7058 ); 7059 7060 /* FPF1 = 1 */ 7061 7062 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelId, 7063 _bcmFieldSliceSelFpf1, 1, 7064 _bcmFieldSliceSelDisable, 0, 7065 fp_tcam_ofs + dw_f1_ofs, 20 7066 ); 7067 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction, 7068 _bcmFieldSliceSelFpf1, 1, 7069 _bcmFieldSliceSelDisable, 0, 7070 fp_tcam_ofs + dw_f1_ofs + 20, 3 7071 ); 7072 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord, 7073 _bcmFieldSliceSelFpf1, 1, 7074 _bcmFieldSliceSelDisable, 0, 7075 fp_tcam_ofs + dw_f1_ofs + 23, 32 7076 ); 7077 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid, 7078 _bcmFieldSliceSelFpf1, 1, 7079 _bcmFieldSliceSelDisable, 0, 7080 fp_tcam_ofs + dw_f1_ofs + 55, 1 7081 ); 7082 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIntPriority, 7083 _bcmFieldSliceSelFpf1, 1, 7084 _bcmFieldSliceSelDisable, 0, 7085 fp_tcam_ofs + dw_f1_ofs + 56, 4 7086 ); 7087 7088 /***** FPF2 double-wide *****/ 7089 7090 /* FPF2 = 0 */ 7091 7092 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated, 7093 _bcmFieldSliceSelFpf2, 0, 7094 _bcmFieldSliceSelDisable, 0, 7095 fp_tcam_ofs + dw_f2_ofs + 2, 1 7096 ); 7097 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 7098 _bcmFieldSliceSelFpf2, 0, 7099 _bcmFieldSliceSelDisable, 0, 7100 fp_tcam_ofs + dw_f2_ofs + 2 + 1, 1 7101 ); 7102 /* Bit 2 is VXLT0/VXLT1 hit indicator; not used */ 7103 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 7104 _bcmFieldSliceSelFpf2, 0, 7105 _bcmFieldSliceSelDisable, 0, 7106 fp_tcam_ofs + dw_f2_ofs + 2 + 3, 1 7107 ); 7108 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 7109 _bcmFieldSliceSelFpf2, 0, 7110 _bcmFieldSliceSelDisable, 0, 7111 fp_tcam_ofs + dw_f2_ofs + 2 + 4, 2 7112 ); 7113 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 7114 _bcmFieldSliceSelFpf2, 0, 7115 _bcmFieldSliceSelDisable, 0, 7116 fp_tcam_ofs + dw_f2_ofs + 2 + 6, 1 7117 ); 7118 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 7119 _bcmFieldSliceSelFpf2, 0, 7120 _bcmFieldSliceSelDisable, 0, 7121 fp_tcam_ofs + dw_f2_ofs + 2 + 7, 1 7122 ); 7123 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 7124 _bcmFieldSliceSelFpf2, 0, 7125 _bcmFieldSliceSelDisable, 0, 7126 fp_tcam_ofs + dw_f2_ofs + 2 + 8, 1 7127 ); 7128 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 7129 _bcmFieldSliceSelFpf2, 0, 7130 _bcmFieldSliceSelDisable, 0, 7131 fp_tcam_ofs + dw_f2_ofs + 2 + 9, 1 7132 ); 7133 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 7134 _bcmFieldSliceSelFpf2, 0, 7135 _bcmFieldSliceSelDisable, 0, 7136 fp_tcam_ofs + dw_f2_ofs + 2 + 10, 1 7137 ); 7138 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 7139 _bcmFieldSliceSelFpf2, 0, 7140 _bcmFieldSliceSelDisable, 0, 7141 fp_tcam_ofs + dw_f2_ofs + 2 + 10, 1 7142 ); 7143 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 7144 _bcmFieldSliceSelFpf2, 0, 7145 _bcmFieldSliceSelDisable, 0, 7146 fp_tcam_ofs + dw_f2_ofs + 2 + 11, 1 7147 ); 7148 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 7149 _bcmFieldSliceSelFpf2, 0, 7150 _bcmFieldSliceSelDisable, 0, 7151 fp_tcam_ofs + dw_f2_ofs + 2 + 12, 1 7152 ); 7153 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 7154 _bcmFieldSliceSelFpf2, 0, 7155 _bcmFieldSliceSelDisable, 0, 7156 fp_tcam_ofs + dw_f2_ofs + 2 + 13, 1 7157 ); 7158 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 7159 _bcmFieldSliceSelFpf2, 0, 7160 _bcmFieldSliceSelDisable, 0, 7161 fp_tcam_ofs + dw_f2_ofs + 2 + 14, 1 7162 ); 7163 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit, 7164 _bcmFieldSliceSelFpf2, 0, 7165 _bcmFieldSliceSelDisable, 0, 7166 fp_tcam_ofs + dw_f2_ofs + 2 + 15, 1 7167 ); 7168 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit, 7169 _bcmFieldSliceSelFpf2, 0, 7170 _bcmFieldSliceSelDisable, 0, 7171 fp_tcam_ofs + dw_f2_ofs + 2 + 16, 1 7172 ); 7173 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit, 7174 _bcmFieldSliceSelFpf2, 0, 7175 _bcmFieldSliceSelDisable, 0, 7176 fp_tcam_ofs + dw_f2_ofs + 2 + 16, 1 7177 ); 7178 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit, 7179 _bcmFieldSliceSelFpf2, 0, 7180 _bcmFieldSliceSelDisable, 0, 7181 fp_tcam_ofs + dw_f2_ofs + 2 + 16, 1 7182 ); 7183 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit, 7184 _bcmFieldSliceSelFpf2, 0, 7185 _bcmFieldSliceSelDisable, 0, 7186 fp_tcam_ofs + dw_f2_ofs + 2 + 16, 1 7187 ); 7188 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit, 7189 _bcmFieldSliceSelFpf2, 0, 7190 _bcmFieldSliceSelDisable, 0, 7191 fp_tcam_ofs + dw_f2_ofs + 2 + 17, 1 7192 ); 7193 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit, 7194 _bcmFieldSliceSelFpf2, 0, 7195 _bcmFieldSliceSelDisable, 0, 7196 fp_tcam_ofs + dw_f2_ofs + 2 + 17, 1 7197 ); 7198 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit, 7199 _bcmFieldSliceSelFpf2, 0, 7200 _bcmFieldSliceSelDisable, 0, 7201 fp_tcam_ofs + dw_f2_ofs + 2 + 17, 1 7202 ); 7203 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit, 7204 _bcmFieldSliceSelFpf2, 0, 7205 _bcmFieldSliceSelDisable, 0, 7206 fp_tcam_ofs + dw_f2_ofs + 2 + 17, 1 7207 ); 7208 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 7209 _bcmFieldSliceSelFpf2, 0, 7210 _bcmFieldSliceSelDisable, 0, 7211 fp_tcam_ofs + dw_f2_ofs + 22, 6 7212 ); 7213 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 7214 _bcmFieldSliceSelFpf2, 0, 7215 _bcmFieldSliceSelDisable, 0, 7216 fp_tcam_ofs + dw_f2_ofs + 28, 24 7217 ); 7218 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31, 7219 _bcmFieldSliceSelFpf2, 0, 7220 _bcmFieldSliceIntfClassSelect, 3, 7221 fp_tcam_ofs + dw_f2_ofs + 52, 8 7222 ); 7223 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 7224 _bcmFieldSliceSelFpf2, 0, 7225 _bcmFieldSliceIntfClassSelect, 0, 7226 fp_tcam_ofs + dw_f2_ofs + 52, 12 7227 ); 7228 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 7229 _bcmFieldSliceSelFpf2, 0, 7230 _bcmFieldSliceIntfClassSelect, 1, 7231 fp_tcam_ofs + dw_f2_ofs + 52, 12 7232 ); 7233 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 7234 _bcmFieldSliceSelFpf2, 0, 7235 _bcmFieldSliceIntfClassSelect, 2, 7236 fp_tcam_ofs + dw_f2_ofs + 52, 12 7237 ); 7238 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 7239 _bcmFieldSliceSelFpf2, 0, 7240 _bcmFieldSliceSelDisable, 0, 7241 fp_tcam_ofs + dw_f2_ofs + 64, 32 7242 ); 7243 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 7244 _bcmFieldSliceSelFpf2, 0, 7245 _bcmFieldSliceSelDisable, 0, 7246 fp_tcam_ofs + dw_f2_ofs + 96, 32 7247 ); 7248 7249 /* FPF2 = 1 */ 7250 7251 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 7252 _bcmFieldSliceSelFpf2, 1, 7253 _bcmFieldSliceSelDisable, 0, 7254 fp_tcam_ofs + dw_f2_ofs, 128 7255 ); 7256 7257 /* FPF2 = 2 */ 7258 7259 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 7260 _bcmFieldSliceSelFpf2, 2, 7261 _bcmFieldSliceSelDisable, 0, 7262 fp_tcam_ofs + dw_f2_ofs, 128 7263 ); 7264 7265 /* FPF2 = 3 */ 7266 7267 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1, 7268 _bcmFieldSliceSelFpf2, 3, 7269 _bcmFieldSliceSelDisable, 0, 7270 fp_tcam_ofs + dw_f2_ofs, 128 7271 ); 7272 7273 /***** FPF3 double-wide *****/ 7274 7275 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos, 7276 _bcmFieldSliceSelDisable, 0, 7277 _bcmFieldSliceSelDisable, 0, 7278 fp_tcam_ofs + dw_f3_ofs, 8 7279 ); 7280 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 7281 _bcmFieldSliceSelDisable, 0, 7282 _bcmFieldSliceSelDisable, 0, 7283 fp_tcam_ofs + dw_f3_ofs + 8, 8 7284 ); 7285 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 7286 _bcmFieldSliceSelDisable, 0, 7287 _bcmFieldSliceSelDisable, 0, 7288 fp_tcam_ofs + dw_f3_ofs + 16, 8 7289 ); 7290 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 7291 _bcmFieldSliceSelDisable, 0, 7292 _bcmFieldSliceSelDisable, 0, 7293 fp_tcam_ofs + dw_f3_ofs + 24, 8 7294 ); 7295 7296 /***** FPF4 double-wide *****/ 7297 7298 /* FPF4 = 0 */ 7299 7300 7301 7302 /* FPF4 = 1 */ 7303 7304 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 7305 _bcmFieldSliceSelFpf4, 1, 7306 _bcmFieldSliceSelDisable, 0, 7307 fp_tcam_ofs + dw_f4_ofs, 6 7308 ); 7309 return (BCM_E_NONE); 7310 } 7311 #endif /* BCM_HELIX4_SUPPORT */ 7312 7313 /* 7314 * Function: 7315 * _field_tr3_qualifiers_init 7316 * Purpose: 7317 * Initialize device qaualifiers select codes & offsets 7318 * Parameters: 7319 * unit - (IN) BCM device number. 7320 * stage_fc - (IN) Field Processor stage control structure. 7321 * 7322 * Returns: 7323 * BCM_E_NONE 7324 * Notes: 7325 */ 7326 STATIC int 7327 _field_tr3_qualifiers_init(int unit, _field_stage_t *stage_fc) 7328 { 7329 /* Allocated stage qualifiers configuration array. */ 7330 _FP_XGS3_ALLOC(stage_fc->f_qual_arr, 7331 (_bcmFieldQualifyCount * sizeof(_bcm_field_qual_info_t *)), 7332 "Field qualifiers"); 7333 if (stage_fc->f_qual_arr == 0) { 7334 return (BCM_E_MEMORY); 7335 } 7336 7337 switch (stage_fc->stage_id) { 7338 case _BCM_FIELD_STAGE_LOOKUP: 7339 return (_field_tr3_lookup_qualifiers_init(unit, stage_fc)); 7340 case _BCM_FIELD_STAGE_INGRESS: 7341 #ifdef BCM_HELIX4_SUPPORT 7342 if (SOC_IS_HELIX4(unit)) { 7343 return (_field_hx4_ingress_qualifiers_init(unit, stage_fc)); 7344 } else 7345 #endif /* BCM_HELIX4_SUPPORT */ 7346 { 7347 return (_field_tr3_ingress_qualifiers_init(unit, stage_fc)); 7348 } 7349 case _BCM_FIELD_STAGE_EXTERNAL: 7350 return (_field_tr3_external_qualifiers_init(unit, stage_fc)); 7351 case _BCM_FIELD_STAGE_EGRESS: 7352 return (_field_tr3_egress_qualifiers_init(unit, stage_fc)); 7353 default: 7354 ; 7355 } 7356 7357 sal_free(stage_fc->f_qual_arr); 7358 return (BCM_E_INTERNAL); 7359 } 7360 7361 7362 STATIC int 7363 _field_tr3_ingress_slice_enable_set(int unit, 7364 _field_stage_t *stage_fc, 7365 _field_slice_t *fs, 7366 unsigned endis 7367 ) 7368 { 7369 static const soc_field_t regfield[] = { 7370 FP_SLICE_ENABLE_SLICE_0f, 7371 FP_SLICE_ENABLE_SLICE_1f, 7372 FP_SLICE_ENABLE_SLICE_2f, 7373 FP_SLICE_ENABLE_SLICE_3f, 7374 FP_SLICE_ENABLE_SLICE_4f, 7375 FP_SLICE_ENABLE_SLICE_5f, 7376 FP_SLICE_ENABLE_SLICE_6f, 7377 FP_SLICE_ENABLE_SLICE_7f, 7378 FP_SLICE_ENABLE_SLICE_8f, 7379 FP_SLICE_ENABLE_SLICE_9f, 7380 FP_SLICE_ENABLE_SLICE_10f, 7381 FP_SLICE_ENABLE_SLICE_11f, 7382 FP_SLICE_ENABLE_SLICE_12f, 7383 FP_SLICE_ENABLE_SLICE_13f, 7384 FP_SLICE_ENABLE_SLICE_14f, 7385 FP_SLICE_ENABLE_SLICE_15f 7386 }; 7387 7388 uint32 regval[1]; 7389 7390 BCM_IF_ERROR_RETURN(soc_reg32_get(unit, 7391 FP_SLICE_ENABLEr, 7392 REG_PORT_ANY, 7393 0, 7394 regval 7395 ) 7396 ); 7397 7398 soc_reg_field_set(unit, 7399 FP_SLICE_ENABLEr, 7400 regval, 7401 regfield[fs->slice_number], 7402 endis ? 1 : 0 7403 ); 7404 7405 return (soc_reg32_set(unit, FP_SLICE_ENABLEr, REG_PORT_ANY, 0, regval[0])); 7406 } 7407 7408 7409 7410 int 7411 _bcm_field_tr3_slice_enable_set(int unit, 7412 _field_stage_t *stage_fc, 7413 _field_group_t *fg, 7414 _field_slice_t *fs, 7415 unsigned endis 7416 ) 7417 { 7418 switch (stage_fc->stage_id) { 7419 case _BCM_FIELD_STAGE_INGRESS: 7420 return (_field_tr3_ingress_slice_enable_set(unit, stage_fc, fs, endis)); 7421 default: 7422 ; 7423 } 7424 7425 return (_bcm_field_fb_slice_enable_set(unit, fg, fs->slice_number, endis)); 7426 7427 } 7428 7429 7430 STATIC int 7431 _field_tr3_lookup_slice_clear(int unit, unsigned slice_num) 7432 { 7433 uint64 reg_val; 7434 7435 BCM_IF_ERROR_RETURN(soc_reg64_get(unit, 7436 VFP_KEY_CONTROL_1r, 7437 REG_PORT_ANY, 7438 0, 7439 ®_val 7440 ) 7441 ); 7442 soc_reg64_field32_set(unit, 7443 VFP_KEY_CONTROL_1r, 7444 ®_val, 7445 _bcm_field_trx_vfp_double_wide_sel[slice_num], 7446 0 7447 ); 7448 soc_reg64_field32_set(unit, 7449 VFP_KEY_CONTROL_1r, 7450 ®_val, 7451 _bcm_field_trx_vfp_field_sel[slice_num][0], 7452 0 7453 ); 7454 soc_reg64_field32_set(unit, 7455 VFP_KEY_CONTROL_1r, 7456 ®_val, 7457 _bcm_field_trx_vfp_field_sel[slice_num][1], 7458 0 7459 ); 7460 soc_reg64_field32_set(unit, 7461 VFP_KEY_CONTROL_1r, 7462 ®_val, 7463 _bcm_field_trx_slice_pairing_field[slice_num >> 1], 7464 0 7465 ); 7466 BCM_IF_ERROR_RETURN(soc_reg64_set(unit, 7467 VFP_KEY_CONTROL_1r, 7468 REG_PORT_ANY, 7469 0, 7470 reg_val 7471 ) 7472 ); 7473 7474 return (soc_reg_field32_modify(unit, 7475 VFP_KEY_CONTROL_2r, 7476 REG_PORT_ANY, 7477 _bcm_field_trx_vfp_ip_header_sel[slice_num], 7478 0 7479 ) 7480 ); 7481 } 7482 7483 /* 7484 * Function: 7485 * _field_tr3_ingress_slice_clear 7486 * 7487 * Purpose: 7488 * Resets the IFP field slice configuration. 7489 * 7490 * Parameters: 7491 * unit - (IN) BCM device number. 7492 * slice_numb - (IN) Field slice number. 7493 * 7494 * Returns: 7495 * BCM_E_XXX 7496 */ 7497 STATIC int 7498 _field_tr3_ingress_slice_clear(int unit, uint8 slice_numb) 7499 { 7500 uint32 rval; 7501 7502 BCM_IF_ERROR_RETURN 7503 (_bcm_field_trx_ingress_slice_clear(unit, slice_numb)); 7504 7505 /* Get Src/Dest ClassID select for F1.0 & F3.0 keys. */ 7506 BCM_IF_ERROR_RETURN 7507 (soc_reg32_get(unit, 7508 IFP_KEY_CLASSID_SELECTr, 7509 REG_PORT_ANY, 7510 0, 7511 &rval 7512 ) 7513 ); 7514 7515 /* Reset slice F1_0 Src/Dst classid selection. */ 7516 soc_reg_field_set(unit, 7517 IFP_KEY_CLASSID_SELECTr, 7518 &rval, 7519 F1_0_SLICEf, 7520 (soc_reg_field_get(unit, 7521 IFP_KEY_CLASSID_SELECTr, 7522 rval, 7523 F1_0_SLICEf) 7524 & ~(1 << slice_numb) 7525 ) 7526 ); 7527 7528 /* Reset slice F3_0 Src/Dst classid selection. */ 7529 soc_reg_field_set(unit, 7530 IFP_KEY_CLASSID_SELECTr, 7531 &rval, 7532 F3_0_SLICEf, 7533 (soc_reg_field_get(unit, 7534 IFP_KEY_CLASSID_SELECTr, 7535 rval, 7536 F3_0_SLICEf) 7537 & ~(1 << slice_numb) 7538 ) 7539 ); 7540 7541 /* Update hardware register. */ 7542 BCM_IF_ERROR_RETURN 7543 (soc_reg32_set(unit, 7544 IFP_KEY_CLASSID_SELECTr, 7545 REG_PORT_ANY, 7546 0, 7547 rval 7548 ) 7549 ); 7550 7551 /* Clear double wide key selector settings. */ 7552 BCM_IF_ERROR_RETURN 7553 (soc_reg_field32_modify(unit, 7554 FP_DOUBLE_WIDE_SELECTr, 7555 REG_PORT_ANY, 7556 _tr3_dw_f1_sel[slice_numb], 7557 0 7558 ) 7559 ); 7560 BCM_IF_ERROR_RETURN 7561 (soc_reg_field32_modify(unit, 7562 FP_DOUBLE_WIDE_SELECTr, 7563 REG_PORT_ANY, 7564 _bcm_field_trx_dw_f4_sel[slice_numb], 7565 0 7566 ) 7567 ); 7568 7569 return (BCM_E_NONE); 7570 } 7571 7572 STATIC int 7573 _field_tr3_slice_clear(int unit, _field_group_t *fg, _field_slice_t *fs) 7574 { 7575 switch (fs->stage_id) { 7576 case _BCM_FIELD_STAGE_LOOKUP: 7577 return (_field_tr3_lookup_slice_clear(unit, fs->slice_number)); 7578 case _BCM_FIELD_STAGE_INGRESS: 7579 return (_field_tr3_ingress_slice_clear(unit, fs->slice_number)); 7580 case _BCM_FIELD_STAGE_EXTERNAL: 7581 return (BCM_E_NONE); 7582 case _BCM_FIELD_STAGE_EGRESS: 7583 return (_bcm_field_trx_egress_slice_clear(unit, fs->slice_number)); 7584 default: 7585 ; 7586 } 7587 7588 return (BCM_E_INTERNAL); 7589 } 7590 7591 7592 int 7593 _bcm_field_tr3_group_qset_update(int unit, _field_group_t *fg) 7594 { 7595 /* Add fields of MPLS forwarding label */ 7596 7597 if (BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyMplsForwardingLabel)) { 7598 BCM_FIELD_QSET_ADD(fg->qset, bcmFieldQualifyMplsForwardingLabelTtl); 7599 BCM_FIELD_QSET_ADD(fg->qset, bcmFieldQualifyMplsForwardingLabelBos); 7600 BCM_FIELD_QSET_ADD(fg->qset, bcmFieldQualifyMplsForwardingLabelExp); 7601 BCM_FIELD_QSET_ADD(fg->qset, bcmFieldQualifyMplsForwardingLabelId); 7602 } 7603 7604 return (BCM_E_NONE); 7605 } 7606 7607 7608 STATIC int 7609 _field_tr3_ingress_selcode_get(int unit, 7610 _field_stage_t *stage_fc, 7611 bcm_field_qset_t *qset_req, 7612 _field_group_t *fg 7613 ) 7614 { 7615 if (BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifySrcMac) 7616 || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyDstMac) 7617 ) { 7618 /* Qset includes MAC address qualifier 7619 => Set selector code for MAC address normalization 7620 */ 7621 fg->sel_codes[0].normalize_mac_sel 7622 = BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyNormalizeMacAddrs) 7623 ? 1 : 0; 7624 } 7625 7626 if (BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifySrcIp) 7627 || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyDstIp) 7628 || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifySrcIp6) 7629 || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyDstIp6) 7630 || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyL4SrcPort) 7631 || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyL4DstPort) 7632 ) { 7633 /* Qset includes L3 or L4 address qualifier 7634 => Set selector code for IP (and L4) address normalization 7635 */ 7636 fg->sel_codes[0].normalize_ip_sel 7637 = BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyNormalizeIpAddrs) 7638 ? 1 : 0; 7639 } 7640 7641 return (BCM_E_NONE); 7642 } 7643 7644 7645 STATIC int 7646 _field_tr3_selcode_get(int unit, 7647 _field_stage_t *stage_fc, 7648 bcm_field_qset_t *qset_req, 7649 _field_group_t *fg 7650 ) 7651 { 7652 BCM_IF_ERROR_RETURN(_bcm_field_tr_selcode_get(unit, stage_fc, qset_req, fg)); 7653 7654 switch (fg->stage_id) { 7655 case _BCM_FIELD_STAGE_INGRESS: 7656 return (_field_tr3_ingress_selcode_get(unit, stage_fc, qset_req, fg)); 7657 default: 7658 ; 7659 } 7660 7661 return (BCM_E_NONE); 7662 } 7663 7664 7665 STATIC int 7666 _field_tr3_lookup_selcodes_install(int unit, 7667 _field_group_t *fg, 7668 uint8 slice_num, 7669 bcm_pbmp_t *pbmp, 7670 int selcode_idx 7671 ) 7672 { 7673 _field_sel_t * const sel = &fg->sel_codes[selcode_idx]; 7674 int errcode = BCM_E_NONE; 7675 uint64 regval; 7676 uint64 val; 7677 7678 BCM_IF_ERROR_RETURN(soc_reg64_get(unit, 7679 VFP_KEY_CONTROL_1r, 7680 REG_PORT_ANY, 7681 0, 7682 ®val 7683 ) 7684 ); 7685 7686 if ((fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) 7687 && (selcode_idx & 1) 7688 ) { 7689 if (sel->fpf2 != _FP_SELCODE_DONT_CARE) { 7690 COMPILER_64_SET(val, 0, sel->fpf2); 7691 soc_reg64_field_set(unit, 7692 VFP_KEY_CONTROL_1r, 7693 ®val, 7694 _bcm_field_trx_vfp_double_wide_sel[slice_num], 7695 val 7696 ); 7697 } 7698 } else { 7699 if (sel->fpf2 != _FP_SELCODE_DONT_CARE) { 7700 COMPILER_64_SET(val, 0, sel->fpf2); 7701 soc_reg64_field_set(unit, 7702 VFP_KEY_CONTROL_1r, 7703 ®val, 7704 _bcm_field_trx_vfp_field_sel[slice_num][0], 7705 val 7706 ); 7707 } 7708 if (sel->fpf3 != _FP_SELCODE_DONT_CARE) { 7709 COMPILER_64_SET(val, 0, sel->fpf3); 7710 soc_reg64_field_set(unit, 7711 VFP_KEY_CONTROL_1r, 7712 ®val, 7713 _bcm_field_trx_vfp_field_sel[slice_num][1], 7714 val 7715 ); 7716 } 7717 } 7718 7719 if (sel->src_entity_sel != _FP_SELCODE_DONT_CARE) { 7720 uint32 value; 7721 7722 switch (sel->src_entity_sel) { 7723 case _bcmFieldFwdEntityPortGroupNum: 7724 value = 4; 7725 break; 7726 case _bcmFieldFwdEntityMplsGport: 7727 case _bcmFieldFwdEntityMimGport: 7728 case _bcmFieldFwdEntityWlanGport: 7729 case _bcmFieldFwdEntityVxlanGport: 7730 case _bcmFieldFwdEntityVlanGport: 7731 value = 0; 7732 break; 7733 case _bcmFieldFwdEntityModPortGport: 7734 value = 2; 7735 break; 7736 case _bcmFieldFwdEntityGlp: 7737 value = 1; 7738 break; 7739 default: 7740 return (BCM_E_INTERNAL); 7741 } 7742 COMPILER_64_SET(val, 0, value); 7743 soc_reg64_field_set(unit, 7744 VFP_KEY_CONTROL_1r, 7745 ®val, 7746 s_type_fld_tbl[slice_num], 7747 val 7748 ); 7749 } 7750 7751 BCM_IF_ERROR_RETURN(soc_reg64_set(unit, 7752 VFP_KEY_CONTROL_1r, 7753 REG_PORT_ANY, 7754 0, 7755 regval 7756 ) 7757 ); 7758 7759 /* Set inner/outer ip header selection. */ 7760 if (sel->ip_header_sel != _FP_SELCODE_DONT_CARE) { 7761 errcode = soc_reg_field32_modify( 7762 unit, 7763 VFP_KEY_CONTROL_2r, 7764 REG_PORT_ANY, 7765 _bcm_field_trx_vfp_ip_header_sel[slice_num], 7766 sel->ip_header_sel 7767 ); 7768 } 7769 7770 return (errcode); 7771 } 7772 7773 7774 STATIC int 7775 _field_tr3_ingress_selcodes_install(int unit, 7776 _field_group_t *fg, 7777 uint8 slice_num, 7778 bcm_pbmp_t *pbmp, 7779 int selcode_idx 7780 ) 7781 { 7782 _field_sel_t * const sel = &fg->sel_codes[selcode_idx]; 7783 const unsigned pfs_idx_count = soc_mem_index_count(unit, 7784 FP_PORT_FIELD_SELm 7785 ); 7786 int errcode = BCM_E_NONE; 7787 bcm_port_t idx; 7788 uint32 buf[SOC_MAX_MEM_FIELD_WORDS]; 7789 SHR_BITDCL *pfs_bmp = 0; 7790 uint32 regval; 7791 7792 BCM_IF_ERROR_RETURN(_bcm_field_trx_ingress_selcodes_install(unit, 7793 fg, 7794 slice_num, 7795 pbmp, 7796 selcode_idx 7797 ) 7798 ); 7799 7800 /* Get port field select table size and allocated bitmap of indexes 7801 * applicable to the group. 7802 */ 7803 _FP_XGS3_ALLOC(pfs_bmp, 7804 MAX(SHR_BITALLOCSIZE(pfs_idx_count), 7805 sizeof(bcm_pbmp_t) 7806 ), 7807 "PFS bmp" 7808 ); 7809 if (pfs_bmp == 0) { 7810 return (BCM_E_MEMORY); 7811 } 7812 7813 /* Populate pfs indexes applicable for the group. */ 7814 errcode = _bcm_field_trx_ingress_pfs_bmap_get(unit, 7815 fg, 7816 pbmp, 7817 selcode_idx, 7818 pfs_bmp 7819 ); 7820 if (BCM_FAILURE(errcode)) { 7821 goto cleanup; 7822 } 7823 7824 /* Selector code field for DW F2 got a new name, so program it */ 7825 if ((fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) 7826 && (selcode_idx == _FP_INTRA_SLICE_PART_1 7827 || selcode_idx == _FP_INTRA_SLICE_PART_3)) { 7828 7829 if (sel->fpf2 != _FP_SELCODE_DONT_CARE) { 7830 /* Do the same thing for each entry in FP_PORT_FIELD_SEL table */ 7831 for (idx = 0; idx < pfs_idx_count; idx++) { 7832 static soc_field_t dw_f2_key_sel_fld[] = { 7833 SLICE0_DOUBLE_WIDE_F2_KEY_SELECTf, 7834 SLICE1_DOUBLE_WIDE_F2_KEY_SELECTf, 7835 SLICE2_DOUBLE_WIDE_F2_KEY_SELECTf, 7836 SLICE3_DOUBLE_WIDE_F2_KEY_SELECTf, 7837 SLICE4_DOUBLE_WIDE_F2_KEY_SELECTf, 7838 SLICE5_DOUBLE_WIDE_F2_KEY_SELECTf, 7839 SLICE6_DOUBLE_WIDE_F2_KEY_SELECTf, 7840 SLICE7_DOUBLE_WIDE_F2_KEY_SELECTf, 7841 SLICE8_DOUBLE_WIDE_F2_KEY_SELECTf, 7842 SLICE9_DOUBLE_WIDE_F2_KEY_SELECTf, 7843 SLICE10_DOUBLE_WIDE_F2_KEY_SELECTf, 7844 SLICE11_DOUBLE_WIDE_F2_KEY_SELECTf, 7845 SLICE12_DOUBLE_WIDE_F2_KEY_SELECTf, 7846 SLICE13_DOUBLE_WIDE_F2_KEY_SELECTf, 7847 SLICE14_DOUBLE_WIDE_F2_KEY_SELECTf, 7848 SLICE15_DOUBLE_WIDE_F2_KEY_SELECTf 7849 }; 7850 7851 if (SHR_BITGET(pfs_bmp, idx) == 0) { 7852 continue; 7853 } 7854 errcode = soc_mem_read(unit, FP_PORT_FIELD_SELm, MEM_BLOCK_ANY, 7855 idx, buf); 7856 if (BCM_FAILURE(errcode)) { 7857 goto cleanup; 7858 } 7859 soc_mem_field32_set(unit, FP_PORT_FIELD_SELm, buf, 7860 dw_f2_key_sel_fld[slice_num], 7861 sel->fpf2); 7862 errcode = soc_mem_write(unit, FP_PORT_FIELD_SELm, MEM_BLOCK_ALL, 7863 idx, buf); 7864 if (BCM_FAILURE(errcode)) { 7865 goto cleanup; 7866 } 7867 } 7868 } 7869 7870 /* Write appropriate values in FP_DOUBLE_WIDE_SELECTr */ 7871 if (sel->fpf1 != _FP_SELCODE_DONT_CARE) { 7872 /* 7873 * F1.0 - L4 7874 * F1.1 - MPLS 7875 */ 7876 errcode = soc_reg_field32_modify 7877 (unit, 7878 FP_DOUBLE_WIDE_SELECTr, 7879 REG_PORT_ANY, 7880 _tr3_dw_f1_sel[slice_num], 7881 sel->fpf1 7882 ); 7883 if (BCM_FAILURE(errcode)) { 7884 goto cleanup; 7885 } 7886 } 7887 if (sel->fpf4 != _FP_SELCODE_DONT_CARE) { 7888 /* 7889 * F4.0 - PORT_FIELD_SEL_INDEX 7890 * F4.1 - TCP_FLAGS 7891 */ 7892 errcode = soc_reg_field32_modify 7893 (unit, 7894 FP_DOUBLE_WIDE_SELECTr, 7895 REG_PORT_ANY, 7896 _bcm_field_trx_dw_f4_sel[slice_num], 7897 sel->fpf4 7898 ); 7899 if (BCM_FAILURE(errcode)) { 7900 goto cleanup; 7901 } 7902 } 7903 } 7904 7905 for (idx = 0; idx < pfs_idx_count; idx++) { 7906 static const soc_field_t fldtbl[][2] = { 7907 { SLICE0_NORMALIZE_IP_ADDRf, SLICE0_NORMALIZE_MAC_ADDRf }, 7908 { SLICE1_NORMALIZE_IP_ADDRf, SLICE1_NORMALIZE_MAC_ADDRf }, 7909 { SLICE2_NORMALIZE_IP_ADDRf, SLICE2_NORMALIZE_MAC_ADDRf }, 7910 { SLICE3_NORMALIZE_IP_ADDRf, SLICE3_NORMALIZE_MAC_ADDRf }, 7911 { SLICE4_NORMALIZE_IP_ADDRf, SLICE4_NORMALIZE_MAC_ADDRf }, 7912 { SLICE5_NORMALIZE_IP_ADDRf, SLICE5_NORMALIZE_MAC_ADDRf }, 7913 { SLICE6_NORMALIZE_IP_ADDRf, SLICE6_NORMALIZE_MAC_ADDRf }, 7914 { SLICE7_NORMALIZE_IP_ADDRf, SLICE7_NORMALIZE_MAC_ADDRf }, 7915 { SLICE8_NORMALIZE_IP_ADDRf, SLICE8_NORMALIZE_MAC_ADDRf }, 7916 { SLICE9_NORMALIZE_IP_ADDRf, SLICE9_NORMALIZE_MAC_ADDRf }, 7917 { SLICE10_NORMALIZE_IP_ADDRf, SLICE10_NORMALIZE_MAC_ADDRf }, 7918 { SLICE11_NORMALIZE_IP_ADDRf, SLICE11_NORMALIZE_MAC_ADDRf }, 7919 { SLICE12_NORMALIZE_IP_ADDRf, SLICE12_NORMALIZE_MAC_ADDRf }, 7920 { SLICE13_NORMALIZE_IP_ADDRf, SLICE13_NORMALIZE_MAC_ADDRf }, 7921 { SLICE14_NORMALIZE_IP_ADDRf, SLICE14_NORMALIZE_MAC_ADDRf }, 7922 { SLICE15_NORMALIZE_IP_ADDRf, SLICE15_NORMALIZE_MAC_ADDRf } 7923 }; 7924 7925 if (0 == SHR_BITGET(pfs_bmp, idx)) { 7926 continue; 7927 } 7928 sal_memset(buf, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 7929 /* Read Port's current entry in FP_PORT_FIELD_SEL table */ 7930 errcode = soc_mem_read(unit, 7931 FP_PORT_FIELD_SELm, 7932 MEM_BLOCK_ANY, 7933 idx, 7934 buf 7935 ); 7936 if (BCM_FAILURE(errcode)) { 7937 goto cleanup; 7938 } 7939 7940 if (sel->normalize_ip_sel != _FP_SELCODE_DONT_CARE) { 7941 soc_mem_field32_set(unit, 7942 FP_PORT_FIELD_SELm, 7943 buf, 7944 fldtbl[slice_num][0], 7945 sel->normalize_ip_sel 7946 ); 7947 } 7948 if (sel->normalize_mac_sel != _FP_SELCODE_DONT_CARE) { 7949 soc_mem_field32_set(unit, 7950 FP_PORT_FIELD_SELm, 7951 buf, 7952 fldtbl[slice_num][1], 7953 sel->normalize_mac_sel 7954 ); 7955 } 7956 7957 /* Write each port's new entry */ 7958 errcode = soc_mem_write(unit, 7959 FP_PORT_FIELD_SELm, 7960 MEM_BLOCK_ALL, 7961 idx, 7962 buf 7963 ); 7964 if (BCM_FAILURE(errcode)) { 7965 goto cleanup; 7966 } 7967 } 7968 7969 errcode = soc_reg32_get(unit, 7970 IFP_KEY_CLASSID_SELECTr, 7971 REG_PORT_ANY, 7972 0, 7973 ®val 7974 ); 7975 if (BCM_FAILURE(errcode)) { 7976 goto cleanup; 7977 } 7978 7979 if (sel->src_dest_class_f1_sel != _FP_SELCODE_DONT_CARE) { 7980 soc_reg_field_set(unit, 7981 IFP_KEY_CLASSID_SELECTr, 7982 ®val, 7983 F1_0_SLICEf, 7984 (soc_reg_field_get(unit, 7985 IFP_KEY_CLASSID_SELECTr, 7986 regval, 7987 F1_0_SLICEf 7988 ) 7989 & ~(1 << slice_num) 7990 ) 7991 | (sel->src_dest_class_f1_sel << slice_num) 7992 ); 7993 } 7994 if (sel->src_dest_class_f3_sel != _FP_SELCODE_DONT_CARE) { 7995 soc_reg_field_set(unit, 7996 IFP_KEY_CLASSID_SELECTr, 7997 ®val, 7998 F3_0_SLICEf, 7999 (soc_reg_field_get(unit, 8000 IFP_KEY_CLASSID_SELECTr, 8001 regval, 8002 F3_0_SLICEf 8003 ) 8004 & ~(1 << slice_num) 8005 ) 8006 | (sel->src_dest_class_f3_sel << slice_num) 8007 ); 8008 } 8009 8010 errcode = soc_reg32_set(unit, 8011 IFP_KEY_CLASSID_SELECTr, 8012 REG_PORT_ANY, 8013 0, 8014 regval 8015 ); 8016 8017 cleanup: 8018 if (pfs_bmp) { 8019 sal_free(pfs_bmp); 8020 } 8021 return (errcode); 8022 } 8023 8024 8025 STATIC int 8026 _field_tr3_egress_selcodes_install(int unit, 8027 _field_group_t *fg, 8028 uint8 slice_num, 8029 bcm_pbmp_t *pbmp, 8030 int selcode_idx 8031 ) 8032 { 8033 static const soc_field_t fldtbl[][4] = { 8034 { SLICE_0_F1f, SLICE_1_F1f, SLICE_2_F1f, SLICE_3_F1f }, 8035 { SLICE_0_F2f, SLICE_1_F2f, SLICE_2_F2f, SLICE_3_F2f }, 8036 { SLICE_0_F3f, SLICE_1_F3f, SLICE_2_F3f, SLICE_3_F3f }, 8037 { SLICE_0_F4f, SLICE_1_F4f, SLICE_2_F4f, SLICE_3_F4f } 8038 }; 8039 8040 static const soc_field_t dvpfldtbl[4] = { 8041 SLICE_0f, SLICE_1f, SLICE_2f, SLICE_3f }; 8042 8043 static const soc_field_t mdlfldtbl[4] = { 8044 SLICE_0f, SLICE_1f, SLICE_2f, SLICE_3f }; 8045 8046 _field_sel_t * const sel = &fg->sel_codes[selcode_idx]; 8047 8048 if (sel->egr_class_f1_sel != _FP_SELCODE_DONT_CARE) { 8049 BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit, 8050 EFP_CLASSID_SELECTORr, 8051 REG_PORT_ANY, 8052 fldtbl[0][slice_num], 8053 sel->egr_class_f1_sel 8054 ) 8055 ); 8056 } 8057 if (sel->egr_class_f2_sel != _FP_SELCODE_DONT_CARE) { 8058 BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit, 8059 EFP_CLASSID_SELECTORr, 8060 REG_PORT_ANY, 8061 fldtbl[1][slice_num], 8062 sel->egr_class_f2_sel 8063 ) 8064 ); 8065 } 8066 if (sel->egr_class_f3_sel != _FP_SELCODE_DONT_CARE) { 8067 BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit, 8068 EFP_CLASSID_SELECTORr, 8069 REG_PORT_ANY, 8070 fldtbl[2][slice_num], 8071 sel->egr_class_f3_sel 8072 ) 8073 ); 8074 } 8075 if (sel->egr_class_f4_sel != _FP_SELCODE_DONT_CARE) { 8076 BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit, 8077 EFP_CLASSID_SELECTORr, 8078 REG_PORT_ANY, 8079 fldtbl[3][slice_num], 8080 sel->egr_class_f4_sel 8081 ) 8082 ); 8083 } 8084 8085 /* SELECTOR CODES for EFP_KEY4_DVP_SELECTOR register */ 8086 if (sel->egr_key4_dvp_sel != _FP_SELCODE_DONT_CARE) { 8087 BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit, 8088 EFP_KEY4_DVP_SELECTORr, 8089 REG_PORT_ANY, 8090 dvpfldtbl[slice_num], 8091 sel->egr_key4_dvp_sel 8092 ) 8093 ); 8094 } 8095 /* SELECTOR CODES for EFP_KEY4_MDL_SELECTOR register */ 8096 if (sel->egr_key4_mdl_sel != _FP_SELCODE_DONT_CARE) { 8097 BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit, 8098 EFP_KEY4_MDL_SELECTORr, 8099 REG_PORT_ANY, 8100 mdlfldtbl[slice_num], 8101 sel->egr_key4_mdl_sel 8102 ) 8103 ); 8104 } 8105 8106 return (BCM_E_NONE); 8107 } 8108 8109 8110 8111 STATIC int 8112 _field_tr3_lookup_mode_set(int unit, 8113 uint8 slice_num, 8114 _field_group_t *fg, 8115 uint8 flags 8116 ) 8117 { 8118 static const soc_field_t wide_mode_flds[] = { 8119 SLICE_0_DOUBLE_WIDE_MODEf, 8120 SLICE_1_DOUBLE_WIDE_MODEf, 8121 SLICE_2_DOUBLE_WIDE_MODEf, 8122 SLICE_3_DOUBLE_WIDE_MODEf 8123 }, pairing_flds[] = { 8124 SLICE1_0_PAIRINGf, 8125 SLICE3_2_PAIRINGf 8126 }; 8127 8128 uint64 vfp_key_control_1_buf; 8129 8130 BCM_IF_ERROR_RETURN(soc_reg64_get(unit, 8131 VFP_KEY_CONTROL_1r, 8132 REG_PORT_ANY, 8133 0, 8134 &vfp_key_control_1_buf 8135 ) 8136 ); 8137 8138 soc_reg64_field32_set(unit, 8139 VFP_KEY_CONTROL_1r, 8140 &vfp_key_control_1_buf, 8141 pairing_flds[slice_num >> 1], 8142 flags & _FP_GROUP_SPAN_DOUBLE_SLICE ? 1 : 0 8143 ); 8144 soc_reg64_field32_set(unit, 8145 VFP_KEY_CONTROL_1r, 8146 &vfp_key_control_1_buf, 8147 wide_mode_flds[slice_num], 8148 flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE ? 1 : 0 8149 ); 8150 8151 return (soc_reg64_set(unit, 8152 VFP_KEY_CONTROL_1r, 8153 REG_PORT_ANY, 8154 0, 8155 vfp_key_control_1_buf 8156 ) 8157 ); 8158 } 8159 8160 8161 STATIC int 8162 _field_tr3_external_mode_set(int unit, 8163 uint8 slice_num, 8164 _field_group_t *fg, 8165 uint8 flags 8166 ) 8167 { 8168 unsigned pkt_type; 8169 soc_tcam_partition_type_t tcam_part; 8170 8171 switch (slice_num) { 8172 case _FP_EXT_ACL_144_L2: 8173 pkt_type = PKT_TYPE_L2; 8174 tcam_part = TCAM_PARTITION_ACL_L2C; 8175 break; 8176 case _FP_EXT_ACL_L2: 8177 pkt_type = PKT_TYPE_L2; 8178 tcam_part = TCAM_PARTITION_ACL_L2; 8179 break; 8180 case _FP_EXT_ACL_144_IPV4: 8181 pkt_type = PKT_TYPE_IPV4; 8182 tcam_part = TCAM_PARTITION_ACL_IP4C; 8183 break; 8184 case _FP_EXT_ACL_IPV4: 8185 pkt_type = PKT_TYPE_IPV4; 8186 tcam_part = TCAM_PARTITION_ACL_IP4; 8187 break; 8188 case _FP_EXT_ACL_L2_IPV4: 8189 pkt_type = PKT_TYPE_IPV4; 8190 tcam_part = TCAM_PARTITION_ACL_L2IP4; 8191 break; 8192 case _FP_EXT_ACL_144_IPV6: 8193 pkt_type = PKT_TYPE_IPV6; 8194 tcam_part = TCAM_PARTITION_ACL_IP6C; 8195 break; 8196 case _FP_EXT_ACL_IPV6_SHORT: 8197 pkt_type = PKT_TYPE_IPV6; 8198 tcam_part = TCAM_PARTITION_ACL_IP6S; 8199 break; 8200 case _FP_EXT_ACL_IPV6_FULL: 8201 pkt_type = PKT_TYPE_IPV6; 8202 tcam_part = TCAM_PARTITION_ACL_IP6F; 8203 break; 8204 case _FP_EXT_ACL_L2_IPV6: 8205 pkt_type = PKT_TYPE_IPV6; 8206 tcam_part = TCAM_PARTITION_ACL_L2IP6; 8207 break; 8208 default: 8209 return (BCM_E_INTERNAL); 8210 } 8211 8212 return (soc_tr3_esm_pkt_type_to_slice_map_set(unit, pkt_type, tcam_part)); 8213 } 8214 8215 8216 STATIC int 8217 _field_tr3_mode_set(int unit, uint8 slice_num, _field_group_t *fg, uint8 flags) 8218 { 8219 int (*func)(int unit, uint8 slice_num, _field_group_t *fg, uint8 flags); 8220 8221 switch (fg->stage_id) { 8222 case _BCM_FIELD_STAGE_LOOKUP: 8223 func = _field_tr3_lookup_mode_set; 8224 break; 8225 case _BCM_FIELD_STAGE_INGRESS: 8226 return (BCM_E_NONE); 8227 case _BCM_FIELD_STAGE_EXTERNAL: 8228 func = _field_tr3_external_mode_set; 8229 break; 8230 case _BCM_FIELD_STAGE_EGRESS: 8231 func = _bcm_field_trx_egress_mode_set; 8232 break; 8233 default: 8234 return (BCM_E_INTERNAL); 8235 } 8236 8237 return ((*func)(unit, slice_num, fg, flags)); 8238 } 8239 8240 STATIC int 8241 _field_tr3_selcodes_install(int unit, 8242 _field_group_t *fg, 8243 uint8 slice_num, 8244 bcm_pbmp_t pbmp, 8245 int selcode_idx 8246 ) 8247 { 8248 int (*func)(int, _field_group_t *, uint8, bcm_pbmp_t *, int); 8249 8250 BCM_IF_ERROR_RETURN(_field_tr3_mode_set(unit, slice_num, fg, fg->flags)); 8251 8252 switch (fg->stage_id) { 8253 case _BCM_FIELD_STAGE_LOOKUP: 8254 func = _field_tr3_lookup_selcodes_install; 8255 break; 8256 case _BCM_FIELD_STAGE_INGRESS: 8257 func = _field_tr3_ingress_selcodes_install; 8258 break; 8259 case _BCM_FIELD_STAGE_EXTERNAL: 8260 return (BCM_E_NONE); 8261 case _BCM_FIELD_STAGE_EGRESS: 8262 func = _field_tr3_egress_selcodes_install; 8263 break; 8264 default: 8265 return (BCM_E_INTERNAL); 8266 } 8267 8268 return ((*func)(unit, fg, slice_num, &pbmp, selcode_idx)); 8269 } 8270 8271 8272 STATIC int 8273 _field_tr3_external_tcam_data_mem(int unit, unsigned slice_num, soc_mem_t *tcam_data_mem) 8274 { 8275 static const soc_mem_t tcam_data_mems[] = { 8276 EXT_ACL144_TCAM_L2m, 8277 EXT_ACL288_TCAM_L2m, 8278 EXT_ACL144_TCAM_IPV4m, 8279 EXT_ACL288_TCAM_IPV4m, 8280 EXT_ACL432_TCAM_DATA_L2_IPV4m, 8281 EXT_ACL144_TCAM_IPV6m, 8282 EXT_ACL360_TCAM_DATA_IPV6_SHORTm, 8283 EXT_ACL432_TCAM_DATA_IPV6_LONGm, 8284 EXT_ACL432_TCAM_DATA_L2_IPV6m 8285 }; 8286 8287 if (slice_num >= COUNTOF(tcam_data_mems)) { 8288 *tcam_data_mem = INVALIDm; 8289 return (BCM_E_INTERNAL); 8290 } 8291 8292 *tcam_data_mem = tcam_data_mems[slice_num]; 8293 return (BCM_E_NONE); 8294 } 8295 8296 8297 STATIC int 8298 _field_tr3_external_tcam_mask_mem(int unit, unsigned slice_num, soc_mem_t *tcam_mask_mem) 8299 { 8300 static const soc_mem_t tcam_mask_mems[] = { 8301 INVALIDm, 8302 INVALIDm, 8303 INVALIDm, 8304 INVALIDm, 8305 INVALIDm, 8306 INVALIDm, 8307 EXT_ACL360_TCAM_MASK_IPV6_SHORTm, 8308 EXT_ACL432_TCAM_MASK_IPV6_LONGm, 8309 EXT_ACL432_TCAM_MASK_L2_IPV6m 8310 }; 8311 8312 if (slice_num >= COUNTOF(tcam_mask_mems)) { 8313 *tcam_mask_mem = INVALIDm; 8314 return (BCM_E_INTERNAL); 8315 } 8316 8317 *tcam_mask_mem = tcam_mask_mems[slice_num]; 8318 return (BCM_E_NONE); 8319 } 8320 8321 8322 STATIC int 8323 _field_tr3_external_policy_mem(int unit, unsigned slice_num, soc_mem_t *policy_mem) 8324 { 8325 static const soc_mem_t policy_mems[][_FP_EXT_NUM_PARTITIONS] = { 8326 { INVALIDm, 8327 INVALIDm, 8328 INVALIDm, 8329 INVALIDm, 8330 INVALIDm, 8331 INVALIDm, 8332 INVALIDm, 8333 INVALIDm, 8334 INVALIDm 8335 }, 8336 { EXT_FP_POLICY_ACL144_L2_1Xm, 8337 EXT_FP_POLICY_ACL288_L2_1Xm, 8338 EXT_FP_POLICY_ACL144_IPV4_1Xm, 8339 EXT_FP_POLICY_ACL288_IPV4_1Xm, 8340 EXT_FP_POLICY_ACL432_L2_IPV4_1Xm, 8341 EXT_FP_POLICY_ACL144_IPV6_1Xm, 8342 EXT_FP_POLICY_ACL360_IPV6_SHORT_1Xm, 8343 EXT_FP_POLICY_ACL432_IPV6_LONG_1Xm, 8344 EXT_FP_POLICY_ACL432_L2_IPV6_1Xm 8345 }, 8346 { EXT_FP_POLICY_ACL144_L2_2Xm, 8347 EXT_FP_POLICY_ACL288_L2_2Xm, 8348 EXT_FP_POLICY_ACL144_IPV4_2Xm, 8349 EXT_FP_POLICY_ACL288_IPV4_2Xm, 8350 EXT_FP_POLICY_ACL432_L2_IPV4_2Xm, 8351 EXT_FP_POLICY_ACL144_IPV6_2Xm, 8352 EXT_FP_POLICY_ACL360_IPV6_SHORT_2Xm, 8353 EXT_FP_POLICY_ACL432_IPV6_LONG_2Xm, 8354 EXT_FP_POLICY_ACL432_L2_IPV6_2Xm 8355 }, 8356 { EXT_FP_POLICY_ACL144_L2_3Xm, 8357 EXT_FP_POLICY_ACL288_L2_3Xm, 8358 EXT_FP_POLICY_ACL144_IPV4_3Xm, 8359 EXT_FP_POLICY_ACL288_IPV4_3Xm, 8360 EXT_FP_POLICY_ACL432_L2_IPV4_3Xm, 8361 EXT_FP_POLICY_ACL144_IPV6_3Xm, 8362 EXT_FP_POLICY_ACL360_IPV6_SHORT_3Xm, 8363 EXT_FP_POLICY_ACL432_IPV6_LONG_3Xm, 8364 EXT_FP_POLICY_ACL432_L2_IPV6_3Xm 8365 }, 8366 { EXT_FP_POLICY_ACL144_L2_4Xm, 8367 EXT_FP_POLICY_ACL288_L2_4Xm, 8368 EXT_FP_POLICY_ACL144_IPV4_4Xm, 8369 EXT_FP_POLICY_ACL288_IPV4_4Xm, 8370 EXT_FP_POLICY_ACL432_L2_IPV4_4Xm, 8371 EXT_FP_POLICY_ACL144_IPV6_4Xm, 8372 EXT_FP_POLICY_ACL360_IPV6_SHORT_4Xm, 8373 EXT_FP_POLICY_ACL432_IPV6_LONG_4Xm, 8374 EXT_FP_POLICY_ACL432_L2_IPV6_4Xm 8375 }, 8376 { INVALIDm, 8377 INVALIDm, 8378 INVALIDm, 8379 INVALIDm, 8380 INVALIDm, 8381 INVALIDm, 8382 INVALIDm, 8383 INVALIDm, 8384 INVALIDm 8385 }, 8386 { EXT_FP_POLICY_ACL144_L2_6Xm, 8387 EXT_FP_POLICY_ACL288_L2_6Xm, 8388 EXT_FP_POLICY_ACL144_IPV4_6Xm, 8389 EXT_FP_POLICY_ACL288_IPV4_6Xm, 8390 EXT_FP_POLICY_ACL432_L2_IPV4_6Xm, 8391 EXT_FP_POLICY_ACL144_IPV6_6Xm, 8392 EXT_FP_POLICY_ACL360_IPV6_SHORT_6Xm, 8393 EXT_FP_POLICY_ACL432_IPV6_LONG_6Xm, 8394 EXT_FP_POLICY_ACL432_L2_IPV6_6Xm 8395 } 8396 }; 8397 8398 static const char * const policy_width_props[] = { 8399 spn_EXT_L2C_ACL_TABLE_POLICY_WIDTH, 8400 spn_EXT_L2_ACL_TABLE_POLICY_WIDTH, 8401 spn_EXT_IP4C_ACL_TABLE_POLICY_WIDTH, 8402 spn_EXT_IP4_ACL_TABLE_POLICY_WIDTH, 8403 spn_EXT_L2IP4_ACL_TABLE_POLICY_WIDTH, 8404 spn_EXT_IP6C_ACL_TABLE_POLICY_WIDTH, 8405 spn_EXT_IP6S_ACL_TABLE_POLICY_WIDTH, 8406 spn_EXT_IP6F_ACL_TABLE_POLICY_WIDTH, 8407 spn_EXT_L2IP6_ACL_TABLE_POLICY_WIDTH 8408 }; 8409 8410 unsigned width; 8411 8412 if ((width = soc_property_get(unit, policy_width_props[slice_num], 1)) >= COUNTOF(policy_mems) 8413 || slice_num >= COUNTOF(policy_mems[0]) 8414 ) { 8415 *policy_mem = INVALIDm; 8416 return (BCM_E_INTERNAL); 8417 } 8418 8419 *policy_mem = policy_mems[width][slice_num]; 8420 return (BCM_E_NONE); 8421 } 8422 8423 8424 int 8425 _bcm_field_tr3_external_present(int unit) 8426 { 8427 /* Check that all EXTFP TCAMs are valid, and it is not the case that they 8428 are all zero size 8429 */ 8430 8431 unsigned slice_num, n, z; 8432 8433 for (slice_num = z = 0, n = _FP_EXT_NUM_PARTITIONS; n; --n, ++slice_num) { 8434 soc_mem_t ext_tcam_data_mem; 8435 8436 if (BCM_FAILURE(_field_tr3_external_tcam_data_mem(unit, 8437 slice_num, 8438 &ext_tcam_data_mem 8439 ) 8440 ) 8441 || !SOC_MEM_IS_VALID(unit, ext_tcam_data_mem) 8442 ) { 8443 return (FALSE); 8444 } 8445 if (soc_mem_index_count(unit, ext_tcam_data_mem) == 0) { 8446 ++z; 8447 } 8448 } 8449 8450 return (z != _FP_EXT_NUM_PARTITIONS); 8451 } 8452 8453 8454 STATIC int 8455 _field_tr3_stage_action_support_check(int unit, 8456 unsigned stage, 8457 bcm_field_action_t action, 8458 int *result 8459 ) 8460 { 8461 switch (action) { 8462 case bcmFieldActionNewClassId: 8463 case bcmFieldActionTrunkLoadBalanceCancel: 8464 case bcmFieldActionEcmpLoadBalanceCancel: 8465 case bcmFieldActionEgressClassSelect: 8466 case bcmFieldActionHiGigClassSelect: 8467 case bcmFieldActionOamDmTimeFormat: 8468 case bcmFieldActionOamLmDmSampleEnable: 8469 case bcmFieldActionOamTagStatusCheck: 8470 case bcmFieldActionOamTunnelControl: 8471 case bcmFieldActionReplaceInnerVlanPriority: 8472 case bcmFieldActionReplaceOuterVlanPriority: 8473 case bcmFieldActionReplaceInnerVlan: 8474 case bcmFieldActionReplaceOuterVlan: 8475 case bcmFieldActionReplaceSrcMac: 8476 case bcmFieldActionReplaceDstMac: 8477 *result = (stage == _BCM_FIELD_STAGE_INGRESS); 8478 return (BCM_E_NONE); 8479 8480 case bcmFieldActionRegex: 8481 case bcmFieldActionNoRegex: 8482 *result = (stage == _BCM_FIELD_STAGE_LOOKUP); 8483 return (BCM_E_NONE); 8484 8485 case bcmFieldActionPolicerLevel0: 8486 case bcmFieldActionPolicerLevel1: 8487 *result = ((stage == _BCM_FIELD_STAGE_INGRESS) || (stage == _BCM_FIELD_STAGE_EXTERNAL)); 8488 return (BCM_E_NONE); 8489 8490 case bcmFieldActionPolicerGroup: 8491 case bcmFieldActionStatGroup: 8492 *result = ((stage == _BCM_FIELD_STAGE_LOOKUP) || (stage == _BCM_FIELD_STAGE_EXTERNAL)); 8493 return (BCM_E_NONE); 8494 8495 case bcmFieldActionCopyToCpu: 8496 case bcmFieldActionRpCopyToCpu: 8497 case bcmFieldActionYpCopyToCpu: 8498 case bcmFieldActionGpCopyToCpu: 8499 *result = ((stage == _BCM_FIELD_STAGE_INGRESS) || 8500 (stage == _BCM_FIELD_STAGE_LOOKUP) || 8501 (stage == _BCM_FIELD_STAGE_EXTERNAL)) ? TRUE 8502 : (soc_feature(unit, soc_feature_axp) 8503 && (_BCM_FIELD_STAGE_EGRESS == stage)); 8504 return (BCM_E_NONE); 8505 default: 8506 ; 8507 } 8508 8509 return (_bcm_field_trx_stage_action_support_check(unit, stage, action, result)); 8510 } 8511 8512 8513 STATIC int 8514 _field_tr3_action_support_check(int unit, 8515 _field_entry_t *f_ent, 8516 bcm_field_action_t action, 8517 int *result 8518 ) 8519 { 8520 return (_field_tr3_stage_action_support_check(unit, 8521 f_ent->group->stage_id, 8522 action, 8523 result 8524 ) 8525 ); 8526 } 8527 8528 8529 int 8530 _bcm_field_tr3_external_policy_mem_get(int unit, 8531 _field_action_t *fa, 8532 soc_mem_t *mem 8533 ) 8534 { 8535 *mem = FP_POLICY_TABLEm; 8536 8537 return (BCM_E_NONE); 8538 } 8539 8540 8541 STATIC int 8542 _field_tr3_action_params_check(int unit, 8543 _field_entry_t *f_ent, 8544 _field_action_t *fa 8545 ) 8546 { 8547 uint32 arg = fa->param[0]; /* Action param value */ 8548 soc_mem_t mem; /* Policy table memory id. */ 8549 soc_mem_t tcam_mem; /* Tcam memory id. */ 8550 bcm_port_t local_port; 8551 int index; 8552 int rv = 0; 8553 int cosq_new; 8554 8555 if (_BCM_FIELD_STAGE_EXTERNAL != f_ent->group->stage_id) { 8556 8557 BCM_IF_ERROR_RETURN(_field_fb_tcam_policy_mem_get(unit, 8558 f_ent->group->stage_id, &tcam_mem, &mem)); 8559 8560 switch (fa->action) { 8561 case bcmFieldActionNewClassId: 8562 PolicyCheck(unit, mem, I2E_CLASSIDf, arg); 8563 return (BCM_E_NONE); 8564 8565 case bcmFieldActionEgressClassSelect: 8566 return (arg <= BCM_FIELD_EGRESS_CLASS_SELECT_NEW 8567 ? BCM_E_NONE : BCM_E_PARAM 8568 ); 8569 8570 case bcmFieldActionHiGigClassSelect: 8571 return (arg <= BCM_FIELD_HIGIG_CLASS_SELECT_PORT 8572 ? BCM_E_NONE : BCM_E_PARAM 8573 ); 8574 8575 case bcmFieldActionOamDmTimeFormat: 8576 return (arg <= BCM_FIELD_OAM_DM_TIME_FORMAT_NTP 8577 ? BCM_E_NONE : BCM_E_PARAM 8578 ); 8579 8580 case bcmFieldActionOamTagStatusCheck: 8581 return (arg < (BCM_FIELD_OAM_TAG_STATUS_INNER_L2_INNER_MASK << 1) 8582 ? BCM_E_NONE : BCM_E_PARAM 8583 ); 8584 8585 case bcmFieldActionOamTunnelControl: 8586 return (arg <= BCM_FIELD_OAM_TUNNEL_CONTROL_NOT_TUNNELDED 8587 ? BCM_E_NONE : BCM_E_PARAM 8588 ); 8589 8590 case bcmFieldActionEcnNew: 8591 case bcmFieldActionRpEcnNew: 8592 case bcmFieldActionYpEcnNew: 8593 case bcmFieldActionGpEcnNew: 8594 return (arg <= 3 ? BCM_E_NONE : BCM_E_PARAM); 8595 8596 case bcmFieldActionUcastCosQNew: 8597 if (BCM_GPORT_IS_MCAST_QUEUE_GROUP(fa->param[0])) { 8598 return BCM_E_PARAM; 8599 } 8600 /* passthru */ 8601 /* coverity[MISSING_BREAK: FALSE] */ 8602 case bcmFieldActionCosQNew: 8603 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 8604 BCM_IF_ERROR_RETURN 8605 (_bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8606 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 8607 &local_port, &index, NULL)); 8608 8609 PolicyCheck(unit, mem, R_COS_INT_PRIf, index); 8610 PolicyCheck(unit, mem, Y_COS_INT_PRIf, index); 8611 PolicyCheck(unit, mem, G_COS_INT_PRIf, index); 8612 } else { 8613 PolicyCheck(unit, mem, R_COS_INT_PRIf, arg); 8614 PolicyCheck(unit, mem, Y_COS_INT_PRIf, arg); 8615 PolicyCheck(unit, mem, G_COS_INT_PRIf, arg); 8616 } 8617 return (BCM_E_NONE); 8618 case bcmFieldActionGpCosQNew: 8619 case bcmFieldActionGpUcastCosQNew: 8620 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 8621 BCM_IF_ERROR_RETURN 8622 (_bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8623 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 8624 &local_port, &index, NULL)); 8625 8626 PolicyCheck(unit, mem, G_COS_INT_PRIf, index); 8627 } else { 8628 PolicyCheck(unit, mem, G_COS_INT_PRIf, arg); 8629 } 8630 return (BCM_E_NONE); 8631 8632 case bcmFieldActionYpCosQNew: 8633 case bcmFieldActionYpUcastCosQNew: 8634 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 8635 BCM_IF_ERROR_RETURN 8636 (_bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8637 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 8638 &local_port, &index, NULL)); 8639 8640 PolicyCheck(unit, mem, Y_COS_INT_PRIf, index); 8641 } else { 8642 PolicyCheck(unit, mem, Y_COS_INT_PRIf, arg); 8643 } 8644 return (BCM_E_NONE); 8645 8646 case bcmFieldActionRpCosQNew: 8647 case bcmFieldActionRpUcastCosQNew: 8648 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 8649 BCM_IF_ERROR_RETURN 8650 (_bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8651 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 8652 &local_port, &index, NULL)); 8653 8654 PolicyCheck(unit, mem, R_COS_INT_PRIf, index); 8655 } else { 8656 PolicyCheck(unit, mem, R_COS_INT_PRIf, arg); 8657 } 8658 return (BCM_E_NONE); 8659 8660 case bcmFieldActionMcastCosQNew: 8661 PolicyCheck(unit, mem, R_COS_INT_PRIf, (arg << 4)); 8662 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (arg << 4)); 8663 PolicyCheck(unit, mem, G_COS_INT_PRIf, (arg << 4)); 8664 return (BCM_E_NONE); 8665 8666 case bcmFieldActionGpMcastCosQNew: 8667 PolicyCheck(unit, mem, G_COS_INT_PRIf, (arg << 4)); 8668 return (BCM_E_NONE); 8669 8670 case bcmFieldActionYpMcastCosQNew: 8671 PolicyCheck(unit, mem, Y_COS_INT_PRIf, (arg << 4)); 8672 return (BCM_E_NONE); 8673 8674 case bcmFieldActionRpMcastCosQNew: 8675 PolicyCheck(unit, mem, R_COS_INT_PRIf, (arg << 4)); 8676 return (BCM_E_NONE); 8677 8678 case bcmFieldActionUcastQueueNew: 8679 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8680 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 8681 &cosq_new, NULL); 8682 if (BCM_FAILURE(rv)) { 8683 return BCM_E_PARAM; 8684 } 8685 8686 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 8687 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 8688 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 8689 return (BCM_E_NONE); 8690 break; 8691 8692 case bcmFieldActionRpUcastQueueNew: 8693 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8694 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 8695 &cosq_new, NULL); 8696 if (BCM_FAILURE(rv)) { 8697 return BCM_E_PARAM; 8698 } 8699 8700 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 8701 return (BCM_E_NONE); 8702 break; 8703 8704 case bcmFieldActionYpUcastQueueNew: 8705 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8706 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 8707 &cosq_new, NULL); 8708 if (BCM_FAILURE(rv)) { 8709 return BCM_E_PARAM; 8710 } 8711 8712 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 8713 return (BCM_E_NONE); 8714 break; 8715 8716 case bcmFieldActionGpUcastQueueNew: 8717 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8718 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 8719 &cosq_new, NULL); 8720 if (BCM_FAILURE(rv)) { 8721 return BCM_E_PARAM; 8722 } 8723 8724 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 8725 return (BCM_E_NONE); 8726 break; 8727 8728 case bcmFieldActionIntCosUcastQueueNew: 8729 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8730 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 8731 &cosq_new, NULL); 8732 if (BCM_FAILURE(rv)) { 8733 return BCM_E_PARAM; 8734 } 8735 8736 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 8737 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 8738 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 8739 return (BCM_E_NONE); 8740 break; 8741 8742 case bcmFieldActionRpIntCosUcastQueueNew: 8743 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8744 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 8745 &cosq_new, NULL); 8746 if (BCM_FAILURE(rv)) { 8747 return BCM_E_PARAM; 8748 } 8749 8750 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new); 8751 return (BCM_E_NONE); 8752 break; 8753 8754 case bcmFieldActionYpIntCosUcastQueueNew: 8755 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8756 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 8757 &cosq_new, NULL); 8758 if (BCM_FAILURE(rv)) { 8759 return BCM_E_PARAM; 8760 } 8761 8762 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new); 8763 return (BCM_E_NONE); 8764 break; 8765 8766 case bcmFieldActionGpIntCosUcastQueueNew: 8767 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 8768 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 8769 &cosq_new, NULL); 8770 if (BCM_FAILURE(rv)) { 8771 return BCM_E_PARAM; 8772 } 8773 8774 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new); 8775 return (BCM_E_NONE); 8776 break; 8777 8778 case bcmFieldActionEtagNew: 8779 PolicyCheck(unit, EGR_L3_NEXT_HOPm, L2_ACTIONS__VNTAGf, fa->param[0]); 8780 return (BCM_E_NONE); 8781 default: 8782 ; 8783 } 8784 } 8785 8786 return (_bcm_field_trx_action_params_check(unit, f_ent, fa)); 8787 } 8788 8789 8790 int 8791 _bcm_field_tr3_group_default_aset_set(int unit, _field_group_t *fg) 8792 { 8793 switch (fg->stage_id) { 8794 case _BCM_FIELD_STAGE_EXTERNAL: 8795 return (BCM_E_NONE); /* Default aset is {} */ 8796 default: 8797 ; 8798 } 8799 8800 /* All other stages get normal (all supported actions) aset */ 8801 8802 return (_bcm_field_group_default_aset_set(unit, fg)); 8803 } 8804 8805 8806 /* Table to map API actions to bit positions in ESM_ACL_ACTION_CONTROL word */ 8807 8808 static const struct _field_tr3_external_actions_to_esm_acl_action_control_mapping { 8809 bcm_field_action_t action; /* API action */ 8810 soc_field_t field; /* Field in ESM_ACL_ACTION_CONTROL word */ 8811 uint8 bit_num; /* Bit number in above field */ 8812 uint8 npaw; /* Width (bits) in NON_PROFILED_ACTIONS field */ 8813 } _field_tr3_external_actions_to_esm_acl_action_control_mapping_tbl[] = { 8814 { bcmFieldActionCnmCancel, MISC1_SET_ENABLEf, 0, 1 }, 8815 { bcmFieldActionDoNotChangeTtl, MISC1_SET_ENABLEf, 1, 1 }, 8816 { bcmFieldActionDoNotCheckUrpf, MISC1_SET_ENABLEf, 2, 1 }, 8817 { bcmFieldActionDynamicHgTrunkCancel, MISC1_SET_ENABLEf, 3, 1 }, 8818 { bcmFieldActionTrunkLoadBalanceCancel, MISC1_SET_ENABLEf, 4, 1 }, 8819 { bcmFieldActionEcmpLoadBalanceCancel, MISC1_SET_ENABLEf, 5, 1 }, 8820 { bcmFieldActionColorIndependent, MISC1_SET_ENABLEf, 6, 1 }, 8821 { bcmFieldActionMirrorOverride, MISC1_SET_ENABLEf, 7, 1 }, 8822 { bcmFieldActionIpFix, MISC2_SET_ENABLEf, 0, 2 }, 8823 { bcmFieldActionIpFixCancel, MISC2_SET_ENABLEf, 0, 2 }, 8824 { bcmFieldActionRpDropPrecedence, MISC2_SET_ENABLEf, 1, 2 }, 8825 { bcmFieldActionYpDropPrecedence, MISC2_SET_ENABLEf, 2, 2 }, 8826 { bcmFieldActionGpDropPrecedence, MISC2_SET_ENABLEf, 3, 2 }, 8827 { bcmFieldActionDropPrecedence, MISC2_SET_ENABLEf, 1, 2 }, 8828 { bcmFieldActionDropPrecedence, MISC2_SET_ENABLEf, 2, 2 }, 8829 { bcmFieldActionDropPrecedence, MISC2_SET_ENABLEf, 3, 2 }, 8830 { bcmFieldActionRpDrop, MISC2_SET_ENABLEf, 4, 2 }, 8831 { bcmFieldActionYpDrop, MISC2_SET_ENABLEf, 5, 2 }, 8832 { bcmFieldActionGpDrop, MISC2_SET_ENABLEf, 6, 2 }, 8833 { bcmFieldActionDrop, MISC2_SET_ENABLEf, 4, 2 }, 8834 { bcmFieldActionDrop, MISC2_SET_ENABLEf, 5, 2 }, 8835 { bcmFieldActionDrop, MISC2_SET_ENABLEf, 6, 2 }, 8836 { bcmFieldActionOffloadRedirect, GOA_SET_ENABLEf, 0, 7 }, 8837 { bcmFieldActionOffloadRedirect, REDIRECT_SET_ENABLEf, 0, 24 }, 8838 { bcmFieldActionCosQCpuNew, CPU_COS_SET_ENABLEf, 0, 8 }, 8839 { bcmFieldActionMirrorEgress, MIRROR_SET_ENABLEf, 0, 12 }, 8840 { bcmFieldActionMirrorIngress, MIRROR_SET_ENABLEf, 0, 12 }, 8841 { bcmFieldActionCopyToCpu, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8842 { bcmFieldActionRpCopyToCpu, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8843 { bcmFieldActionYpCopyToCpu, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8844 { bcmFieldActionGpCopyToCpu, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8845 { bcmFieldActionCopyToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8846 { bcmFieldActionRpCopyToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8847 { bcmFieldActionYpCopyToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8848 { bcmFieldActionGpCopyToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8849 { bcmFieldActionSwitchToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8850 { bcmFieldActionRpSwitchToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8851 { bcmFieldActionYpSwitchToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8852 { bcmFieldActionGpSwitchToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8853 { bcmFieldActionSwitchToCpuReinstate, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8854 { bcmFieldActionRpSwitchToCpuReinstate, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8855 { bcmFieldActionYpSwitchToCpuReinstate, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8856 { bcmFieldActionGpSwitchToCpuReinstate, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8857 { bcmFieldActionTimeStampToCpu, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8858 { bcmFieldActionTimeStampToCpu, MISC2_SET_ENABLEf, 4, 2 }, 8859 { bcmFieldActionTimeStampToCpu, MISC2_SET_ENABLEf, 5, 2 }, 8860 { bcmFieldActionTimeStampToCpu, MISC2_SET_ENABLEf, 6, 2 }, 8861 { bcmFieldActionTimeStampToCpuCancel, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8862 { bcmFieldActionTimeStampToCpuCancel, MISC2_SET_ENABLEf, 4, 2 }, 8863 { bcmFieldActionTimeStampToCpuCancel, MISC2_SET_ENABLEf, 5, 2 }, 8864 { bcmFieldActionTimeStampToCpuCancel, MISC2_SET_ENABLEf, 6, 2 }, 8865 { bcmFieldActionRpTimeStampToCpu, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8866 { bcmFieldActionRpTimeStampToCpu, MISC2_SET_ENABLEf, 4, 2 }, 8867 { bcmFieldActionYpTimeStampToCpu, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8868 { bcmFieldActionYpTimeStampToCpu, MISC2_SET_ENABLEf, 5, 2 }, 8869 { bcmFieldActionGpTimeStampToCpu, COPY_TO_CPU_SET_ENABLEf, 0, 18 }, 8870 { bcmFieldActionGpTimeStampToCpu, MISC2_SET_ENABLEf, 6, 2 }, 8871 /* Pseudo-actions (i.e. included in aset, but never added to entry as actual 8872 actions; to announce intention to use resources by group 8873 */ 8874 { bcmFieldActionPolicerLevel0, METER_SET_ENABLEf, 0, 19 }, 8875 { bcmFieldActionPolicerLevel1, SHARED_METER_SET_ENABLEf, 0, 18 }, 8876 { bcmFieldActionPolicerGroup, SVC_METER_SET_ENABLEf, 0, 19 }, 8877 { bcmFieldActionStatGroup, COUNTER_SET_ENABLEf, 0, 20 } 8878 }; 8879 8880 8881 STATIC int 8882 _field_tr3_external_aset_install(int unit, _field_group_t *fg) 8883 { 8884 const unsigned slice_num = fg->slices->slice_number; 8885 8886 const struct _field_tr3_external_actions_to_esm_acl_action_control_mapping *p; 8887 esm_acl_action_control_entry_t esm_acl_action_control_buf; 8888 unsigned non_profiled_actions_width = 0, n; 8889 soc_mem_t policy_mem; 8890 8891 sal_memset(esm_acl_action_control_buf.entry_data, 0, sizeof(esm_acl_action_control_buf.entry_data)); 8892 8893 #define ACTION_CONTROL_ADD(fld, b, npaw) \ 8894 { \ 8895 uint32 __temp[2]; \ 8896 \ 8897 __temp[0] = soc_mem_field32_get(unit, \ 8898 ESM_ACL_ACTION_CONTROLm, \ 8899 esm_acl_action_control_buf.entry_data, \ 8900 (fld) \ 8901 ); \ 8902 __temp[1] = __temp[0] | BIT(b); \ 8903 if (__temp[1] != __temp[0]) { \ 8904 soc_mem_field32_set(unit, \ 8905 ESM_ACL_ACTION_CONTROLm, \ 8906 esm_acl_action_control_buf.entry_data, \ 8907 (fld), \ 8908 __temp[1] \ 8909 ); \ 8910 non_profiled_actions_width += (npaw); \ 8911 } \ 8912 } 8913 8914 /* Map given actions to bits in ESM_ACL_ACTION_CONTROL */ 8915 8916 for (p = _field_tr3_external_actions_to_esm_acl_action_control_mapping_tbl, 8917 n = COUNTOF(_field_tr3_external_actions_to_esm_acl_action_control_mapping_tbl); 8918 n; 8919 --n, ++p 8920 ) { 8921 if (!SHR_BITGET(fg->aset.w, p->action)) { 8922 continue; 8923 } 8924 8925 ACTION_CONTROL_ADD(p->field, p->bit_num, p->npaw); 8926 } 8927 8928 /* Check that policy table is wide enough to contain all requested actions */ 8929 8930 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_mem(unit, 8931 slice_num, 8932 &policy_mem 8933 ) 8934 ); 8935 8936 if (non_profiled_actions_width 8937 > soc_mem_field_length(unit, 8938 policy_mem, 8939 NON_PROFILED_ACTIONSf 8940 ) 8941 ) { 8942 return (BCM_E_CONFIG); 8943 } 8944 8945 return (soc_mem_write(unit, 8946 ESM_ACL_ACTION_CONTROLm, 8947 MEM_BLOCK_ALL, 8948 slice_num, 8949 esm_acl_action_control_buf.entry_data 8950 ) 8951 ); 8952 8953 #undef ACTION_CONTROL_MOD 8954 } 8955 8956 8957 int 8958 _bcm_field_tr3_aset_install(int unit, _field_group_t *fg) 8959 { 8960 switch (fg->stage_id) { 8961 case _BCM_FIELD_STAGE_EXTERNAL: 8962 return (_field_tr3_external_aset_install(unit, fg)); 8963 default: 8964 ; 8965 } 8966 8967 return (BCM_E_NONE); 8968 } 8969 8970 8971 STATIC int 8972 _field_tr3_egress_key_match_type_set (int unit, _field_entry_t *f_ent) 8973 { 8974 _bcm_field_qual_offset_t q_offset; 8975 const _field_group_t *fg = f_ent->group; 8976 uint32 data, mask; 8977 8978 sal_memset(&q_offset, 0, sizeof(q_offset)); 8979 q_offset.field = KEYf; 8980 q_offset.num_offsets = 1; 8981 q_offset.offset[0] = 231; 8982 q_offset.width[0] = 3; 8983 8984 if (fg->flags & _FP_GROUP_SPAN_SINGLE_SLICE) { 8985 switch (fg->sel_codes[0].fpf3) { 8986 case _BCM_FIELD_EFP_KEY1: 8987 data = _BCM_FIELD_EFP_KEY1_MATCH_TYPE; 8988 break; 8989 case _BCM_FIELD_EFP_KEY2: 8990 data = _BCM_FIELD_EFP_KEY2_MATCH_TYPE; 8991 break; 8992 case _BCM_FIELD_EFP_KEY4: 8993 data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE; 8994 break; 8995 case _BCM_FIELD_EFP_KEY1_NO_V4: 8996 data = _BCM_FIELD_EFP_KEY1_MATCH_TYPE; 8997 break; 8998 default: 8999 return (BCM_E_INTERNAL); 9000 } 9001 } else { 9002 switch (fg->sel_codes[1].fpf3) { 9003 case _BCM_FIELD_EFP_KEY2: 9004 data = _BCM_FIELD_EFP_KEY2_KEY3_MATCH_TYPE; 9005 break; 9006 case _BCM_FIELD_EFP_KEY4: 9007 if ((_BCM_FIELD_EFP_KEY1 == fg->sel_codes[0].fpf3) || 9008 (_BCM_FIELD_EFP_KEY1_NO_V4 == fg->sel_codes[0].fpf3)) { 9009 data = _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE; 9010 } else { 9011 data = _BCM_FIELD_EFP_KEY2_KEY4_MATCH_TYPE; 9012 } 9013 break; 9014 default: 9015 return (BCM_E_INTERNAL); 9016 } 9017 } 9018 9019 mask = 0x7; 9020 9021 /* coverity[callee_ptr_arith : FALSE] */ 9022 return (_bcm_field_qual_value_set(unit, 9023 (_bcm_field_qual_offset_t *) &q_offset, 9024 f_ent, 9025 &data, 9026 &mask 9027 ) 9028 ); 9029 } 9030 9031 9032 STATIC int 9033 _field_tr3_group_install(int unit, _field_group_t *fg) 9034 { 9035 _field_slice_t *fs; /* Slice pointer. */ 9036 uint8 slice_number; /* Slices iterator. */ 9037 int parts_count; /* Number of entry parts. */ 9038 int idx; /* Iteration index. */ 9039 9040 if (NULL == fg) { 9041 return (BCM_E_PARAM); 9042 } 9043 9044 /* Get number of entry parts. */ 9045 BCM_IF_ERROR_RETURN(_bcm_field_entry_tcam_parts_count(unit, 9046 fg->stage_id, 9047 fg->flags, 9048 &parts_count 9049 ) 9050 ); 9051 9052 for (idx = 0; idx < parts_count; ++idx) { 9053 BCM_IF_ERROR_RETURN(_bcm_field_tcam_part_to_slice_number(unit, idx, 9054 fg, 9055 &slice_number 9056 ) 9057 ); 9058 fs = fg->slices + slice_number; 9059 9060 BCM_IF_ERROR_RETURN(_field_tr3_selcodes_install(unit, 9061 fg, 9062 fs->slice_number, 9063 fg->pbmp, 9064 idx 9065 ) 9066 ); 9067 } 9068 9069 return (BCM_E_NONE); 9070 } 9071 9072 9073 int 9074 _bcm_field_tr3_qualify_LoopbackType(bcm_field_LoopbackType_t loopback_type, 9075 uint32 *tcam_data, 9076 uint32 *tcam_mask 9077 ) 9078 { 9079 switch (loopback_type) { 9080 case bcmFieldLoopbackTypeAny: 9081 *tcam_data = 0x10; 9082 *tcam_mask = 0x10; 9083 break; 9084 case bcmFieldLoopbackTypeMim: 9085 *tcam_data = 0x10; 9086 *tcam_mask = 0x1f; 9087 break; 9088 case bcmFieldLoopbackTypeTrillNetwork: 9089 *tcam_data = 0x11; 9090 *tcam_mask = 0x1f; 9091 break; 9092 case bcmFieldLoopbackTypeTrillAccess: 9093 *tcam_data = 0x12; 9094 *tcam_mask = 0x1f; 9095 break; 9096 case bcmFieldLoopbackTypeMirror: 9097 *tcam_data = 0x13; 9098 *tcam_mask = 0x1f; 9099 break; 9100 case bcmFieldLoopbackTypeRedirect: 9101 *tcam_data = 0x14; 9102 *tcam_mask = 0x1f; 9103 break; 9104 case bcmFieldLoopbackTypeRegexMatch: 9105 *tcam_data = 0x15; 9106 *tcam_mask = 0x1f; 9107 break; 9108 case bcmFieldLoopbackTypeMplsP2mp: 9109 *tcam_data = 0x16; 9110 *tcam_mask = 0x1f; 9111 break; 9112 case bcmFieldLoopbackTypeQcn: 9113 *tcam_data = 0x17; 9114 *tcam_mask = 0x1f; 9115 break; 9116 case bcmFieldLoopbackTypeWlanEncap: 9117 *tcam_data = 0x18; 9118 *tcam_mask = 0x1f; 9119 break; 9120 case bcmFieldLoopbackTypeWlanEncapEncrypt: 9121 *tcam_data = 0x19; 9122 *tcam_mask = 0x1f; 9123 break; 9124 case bcmFieldLoopbackTypeWlanDecap: 9125 *tcam_data = 0x1a; 9126 *tcam_mask = 0x1f; 9127 break; 9128 case bcmFieldLoopbackTypePassThru: 9129 *tcam_data = 0x1c; 9130 *tcam_mask = 0x1f; 9131 break; 9132 case bcmFieldLoopbackTypeMplsExtendedLookup: 9133 *tcam_data = 0x1d; 9134 *tcam_mask = 0x1f; 9135 break; 9136 case bcmFieldLoopbackTypeL2Gre: 9137 *tcam_data = 0x1e; 9138 *tcam_mask = 0x1f; 9139 break; 9140 default: 9141 return (BCM_E_PARAM); 9142 } 9143 9144 return (BCM_E_NONE); 9145 } 9146 9147 9148 int 9149 _bcm_field_tr3_qualify_LoopbackType_get(uint8 tcam_data, 9150 uint8 tcam_mask, 9151 bcm_field_LoopbackType_t *loopback_type 9152 ) 9153 { 9154 switch (tcam_data & tcam_mask) { 9155 case 0x10: 9156 if (tcam_mask == 0x10) { 9157 *loopback_type = bcmFieldLoopbackTypeAny; 9158 } else { 9159 *loopback_type = bcmFieldLoopbackTypeMim; 9160 } 9161 break; 9162 case 0x11: 9163 *loopback_type = bcmFieldLoopbackTypeTrillNetwork; 9164 break; 9165 case 0x12: 9166 *loopback_type = bcmFieldLoopbackTypeTrillAccess; 9167 break; 9168 case 0x13: 9169 *loopback_type = bcmFieldLoopbackTypeMirror; 9170 break; 9171 case 0x14: 9172 *loopback_type = bcmFieldLoopbackTypeRedirect; 9173 break; 9174 case 0x15: 9175 *loopback_type = bcmFieldLoopbackTypeRegexMatch; 9176 break; 9177 case 0x16: 9178 *loopback_type = bcmFieldLoopbackTypeMplsP2mp; 9179 break; 9180 case 0x17: 9181 *loopback_type = bcmFieldLoopbackTypeQcn; 9182 break; 9183 case 0x18: 9184 *loopback_type = bcmFieldLoopbackTypeWlanEncap; 9185 break; 9186 case 0x19: 9187 *loopback_type = bcmFieldLoopbackTypeWlanEncapEncrypt; 9188 break; 9189 case 0x1a: 9190 *loopback_type = bcmFieldLoopbackTypeWlanDecap; 9191 break; 9192 case 0x1c: 9193 *loopback_type = bcmFieldLoopbackTypePassThru; 9194 break; 9195 case 0x1d: 9196 *loopback_type = bcmFieldLoopbackTypeMplsExtendedLookup; 9197 break; 9198 case 0x1e: 9199 *loopback_type = bcmFieldLoopbackTypeL2Gre; 9200 break; 9201 default: 9202 return (BCM_E_PARAM); 9203 } 9204 9205 return (BCM_E_NONE); 9206 } 9207 9208 9209 int 9210 _bcm_field_tr3_qualify_TunnelType(bcm_field_TunnelType_t tunnel_type, 9211 uint32 *tcam_data, 9212 uint32 *tcam_mask 9213 ) 9214 { 9215 switch (tunnel_type) { 9216 case bcmFieldTunnelTypeAny: 9217 *tcam_data = 0x0; 9218 *tcam_mask = 0x0; 9219 break; 9220 case bcmFieldTunnelTypeNone: 9221 *tcam_data = 0x0; 9222 *tcam_mask = 0x1f; 9223 break; 9224 case bcmFieldTunnelTypeIp: 9225 *tcam_data = 0x1; 9226 *tcam_mask = 0x1f; 9227 break; 9228 case bcmFieldTunnelTypeMpls: 9229 *tcam_data = 0x2; 9230 *tcam_mask = 0x1f; 9231 break; 9232 case bcmFieldTunnelTypeMim: 9233 *tcam_data = 0x3; 9234 *tcam_mask = 0x1f; 9235 break; 9236 case bcmFieldTunnelTypeWlanWtpToAc: 9237 *tcam_data = 0x4; 9238 *tcam_mask = 0x1f; 9239 break; 9240 case bcmFieldTunnelTypeWlanAcToAc: 9241 *tcam_data = 0x5; 9242 *tcam_mask = 0x1f; 9243 break; 9244 case bcmFieldTunnelTypeAutoMulticast: 9245 *tcam_data = 0x6; 9246 *tcam_mask = 0x1f; 9247 break; 9248 case bcmFieldTunnelTypeTrill: 9249 *tcam_data = 0x7; 9250 *tcam_mask = 0x1f; 9251 break; 9252 case bcmFieldTunnelTypeL2Gre: 9253 *tcam_data = 0x8; 9254 *tcam_mask = 0x1f; 9255 break; 9256 default: 9257 return (BCM_E_PARAM); 9258 } 9259 return (BCM_E_NONE); 9260 } 9261 9262 9263 int 9264 _bcm_field_tr3_qualify_TunnelType_get(uint8 tcam_data, 9265 uint8 tcam_mask, 9266 bcm_field_TunnelType_t *tunnel_type 9267 ) 9268 { 9269 switch (tcam_data & tcam_mask) { 9270 case 0x1: 9271 *tunnel_type = bcmFieldTunnelTypeIp; 9272 break; 9273 case 0x2: 9274 *tunnel_type = bcmFieldTunnelTypeMpls; 9275 break; 9276 case 0x3: 9277 *tunnel_type = bcmFieldTunnelTypeMim; 9278 break; 9279 case 0x4: 9280 *tunnel_type = bcmFieldTunnelTypeWlanWtpToAc; 9281 break; 9282 case 0x5: 9283 *tunnel_type = bcmFieldTunnelTypeWlanAcToAc; 9284 break; 9285 case 0x6: 9286 *tunnel_type = bcmFieldTunnelTypeAutoMulticast; 9287 break; 9288 case 0x7: 9289 *tunnel_type = bcmFieldTunnelTypeTrill; 9290 break; 9291 case 0x8: 9292 *tunnel_type = bcmFieldTunnelTypeL2Gre; 9293 break; 9294 case 0x0: 9295 if(tcam_mask) { 9296 *tunnel_type = bcmFieldTunnelTypeNone; 9297 break; 9298 } 9299 default: 9300 return (BCM_E_INTERNAL); 9301 } 9302 9303 return (BCM_E_NONE); 9304 } 9305 9306 9307 static const struct { 9308 uint8 api, hw_data, hw_mask; 9309 } pkt_res_xlate_tbl[] = { 9310 { BCM_FIELD_PKT_RES_UNKNOWN, 0x00, 0x3f }, 9311 { BCM_FIELD_PKT_RES_CONTROL, 0x01, 0x3f }, 9312 { BCM_FIELD_PKT_RES_BPDU, 0x04, 0x3f }, 9313 { BCM_FIELD_PKT_RES_L2BC, 0x0c, 0x3f }, 9314 { BCM_FIELD_PKT_RES_L2UC, 0x08, 0x3f }, 9315 { BCM_FIELD_PKT_RES_L2UNKNOWN, 0x09, 0x3f }, 9316 { BCM_FIELD_PKT_RES_L3MCUNKNOWN, 0x13, 0x3f }, 9317 { BCM_FIELD_PKT_RES_L3MCKNOWN, 0x12, 0x3f }, 9318 { BCM_FIELD_PKT_RES_L2MCKNOWN, 0x0a, 0x3f }, 9319 { BCM_FIELD_PKT_RES_L2MCUNKNOWN, 0x0b, 0x3f }, 9320 { BCM_FIELD_PKT_RES_L3UCKNOWN, 0x10, 0x3f }, 9321 { BCM_FIELD_PKT_RES_L3UCUNKNOWN, 0x11, 0x3f }, 9322 { BCM_FIELD_PKT_RES_MPLSKNOWN, 0x1c, 0x3f }, 9323 { BCM_FIELD_PKT_RES_MPLSMCKNOWN, 0x1d, 0x3f }, 9324 { BCM_FIELD_PKT_RES_MPLSL3KNOWN, 0x1a, 0x3f }, 9325 { BCM_FIELD_PKT_RES_MPLSL2KNOWN, 0x18, 0x3f }, 9326 { BCM_FIELD_PKT_RES_MPLSUNKNOWN, 0x19, 0x3f }, 9327 { BCM_FIELD_PKT_RES_MIMKNOWN, 0x20, 0x3f }, 9328 { BCM_FIELD_PKT_RES_MIMUNKNOWN, 0x21, 0x3f }, 9329 { BCM_FIELD_PKT_RES_TRILLKNOWN, 0x28, 0x3f }, 9330 { BCM_FIELD_PKT_RES_TRILLUNKNOWN, 0x29, 0x3f }, 9331 { BCM_FIELD_PKT_RES_NIVKNOWN, 0x30, 0x3f }, 9332 { BCM_FIELD_PKT_RES_NIVUNKNOWN, 0x31, 0x3f }, 9333 { BCM_FIELD_PKT_RES_OAM, 0x02, 0x3f }, 9334 { BCM_FIELD_PKT_RES_BFD, 0x03, 0x3f }, 9335 { BCM_FIELD_PKT_RES_ICNM, 0x05, 0x3f }, 9336 { BCM_FIELD_PKT_RES_IEEE1588, 0x06, 0x3f }, 9337 { BCM_FIELD_PKT_RES_L2_ANY, 0x08, 0x38 }, 9338 { BCM_FIELD_PKT_RES_L2MC_ANY, 0x0a, 0x3e }, 9339 { BCM_FIELD_PKT_RES_TRILL_ANY, 0x28, 0x3e }, 9340 { BCM_FIELD_PKT_RES_NIV_ANY, 0x30, 0x3e }, 9341 { BCM_FIELD_PKT_RES_MPLS_ANY, 0x18, 0x38 }, 9342 { BCM_FIELD_PKT_RES_MIM_ANY, 0x20, 0x3e }, 9343 { BCM_FIELD_PKT_RES_L3_ANY, 0x10, 0x3e } 9344 }; 9345 9346 int 9347 _bcm_field_tr3_qualify_PacketRes(int unit, 9348 bcm_field_entry_t entry, 9349 uint32 *data, 9350 uint32 *mask 9351 ) 9352 { 9353 uint32 i; 9354 uint8 mark = 0; 9355 9356 /* Translate data #defines to hardware encodings */ 9357 for (i = 0; i < COUNTOF(pkt_res_xlate_tbl); ++i) { 9358 if (*data == pkt_res_xlate_tbl[i].api) { 9359 *data = pkt_res_xlate_tbl[i].hw_data; 9360 *mask = pkt_res_xlate_tbl[i].hw_mask; 9361 mark = 1; 9362 break; 9363 } 9364 } 9365 if (mark == 1) { 9366 return (BCM_E_NONE); 9367 } else { 9368 return (BCM_E_INTERNAL); 9369 } 9370 } 9371 9372 int 9373 _bcm_field_tr3_qualify_PacketRes_get(int unit, 9374 bcm_field_entry_t entry, 9375 uint32 *data, 9376 uint32 *mask 9377 ) 9378 { 9379 uint32 i; 9380 uint8 mark = 0; 9381 /* Translate data #defines from hardware encodings */ 9382 9383 for (i = 0; i < COUNTOF(pkt_res_xlate_tbl); ++i) { 9384 if (*data == pkt_res_xlate_tbl[i].hw_data ) { 9385 if ( pkt_res_xlate_tbl[i].hw_mask == 0x3f ) { 9386 if ( (*mask == pkt_res_xlate_tbl[i].hw_data) || 9387 (*mask == 0x3f) ) { 9388 *data = pkt_res_xlate_tbl[i].api; 9389 if (*mask == pkt_res_xlate_tbl[i].hw_data) { 9390 *mask = pkt_res_xlate_tbl[i].api; 9391 } else { 9392 *mask = BCM_FIELD_EXACT_MATCH_MASK; 9393 } 9394 mark = 1; 9395 break; 9396 } 9397 } else { 9398 if ( (*mask != pkt_res_xlate_tbl[i].hw_data) && 9399 (*mask != 0x3f) ) { 9400 *data = pkt_res_xlate_tbl[i].api; 9401 *mask = BCM_FIELD_EXACT_MATCH_MASK; 9402 mark = 1; 9403 break; 9404 } 9405 } 9406 } 9407 } 9408 9409 if (mark == 1) { 9410 return (BCM_E_NONE); 9411 } else { 9412 return (BCM_E_INTERNAL); 9413 } 9414 } 9415 9416 int 9417 _bcm_field_tr3_qualify_class(int unit, 9418 bcm_field_entry_t entry, 9419 bcm_field_qualify_t qual, 9420 uint32 *data, 9421 uint32 *mask 9422 ) 9423 { 9424 _field_entry_t *f_ent; 9425 unsigned cl_width, cl_max; 9426 9427 /* Get field entry part that contains the qualifier. */ 9428 BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry, qual, &f_ent)); 9429 9430 switch (f_ent->group->stage_id) { 9431 case _BCM_FIELD_STAGE_INGRESS: 9432 case _BCM_FIELD_STAGE_EXTERNAL: 9433 switch (qual) { 9434 case bcmFieldQualifySrcClassL2: 9435 case bcmFieldQualifySrcClassL3: 9436 case bcmFieldQualifySrcClassField: 9437 case bcmFieldQualifyDstClassL2: 9438 case bcmFieldQualifyDstClassL3: 9439 case bcmFieldQualifyDstClassField: 9440 cl_width = 10; 9441 break; 9442 case bcmFieldQualifyInterfaceClassL2: 9443 case bcmFieldQualifyInterfaceClassL3: 9444 case bcmFieldQualifyInterfaceClassPort: 9445 cl_width = 12; 9446 break; 9447 default: 9448 return (BCM_E_INTERNAL); 9449 } 9450 9451 cl_max = 1 << cl_width; 9452 9453 if (*data >= cl_max || (*mask != BCM_FIELD_EXACT_MATCH_MASK && *mask >= cl_max)) { 9454 return (BCM_E_PARAM); 9455 } 9456 9457 break; 9458 9459 case _BCM_FIELD_STAGE_LOOKUP: 9460 switch (qual) { 9461 case bcmFieldQualifyInterfaceClassPort: 9462 cl_width = 8; 9463 break; 9464 case bcmFieldQualifyInterfaceClassL3: 9465 cl_width = 12; 9466 break; 9467 default: 9468 return (BCM_E_INTERNAL); 9469 } 9470 9471 cl_max = 1 << cl_width; 9472 if (*data >= cl_max || (*mask != BCM_FIELD_EXACT_MATCH_MASK && *mask >= cl_max)) { 9473 return (BCM_E_PARAM); 9474 } 9475 break; 9476 9477 case _BCM_FIELD_STAGE_EGRESS: 9478 { 9479 uint32 ifp_cl_type; 9480 9481 cl_width = 9; 9482 cl_max = 1 << cl_width; 9483 9484 if (*data >= cl_max || (*mask != BCM_FIELD_EXACT_MATCH_MASK && *mask >= cl_max)) { 9485 return (BCM_E_PARAM); 9486 } 9487 9488 /* Need to set IFP_CLASS_TYPE in TCAM (upper 4 bits) */ 9489 9490 switch (qual) { 9491 case bcmFieldQualifySrcClassL2: 9492 ifp_cl_type = 6; 9493 break; 9494 case bcmFieldQualifySrcClassL3: 9495 ifp_cl_type = 8; 9496 break; 9497 case bcmFieldQualifySrcClassField: 9498 ifp_cl_type = 4; 9499 break; 9500 case bcmFieldQualifyDstClassL2: 9501 ifp_cl_type = 7; 9502 break; 9503 case bcmFieldQualifyDstClassL3: 9504 ifp_cl_type = 9; 9505 break; 9506 case bcmFieldQualifyDstClassField: 9507 ifp_cl_type = 5; 9508 break; 9509 case bcmFieldQualifyInterfaceClassL2: 9510 ifp_cl_type = 10; 9511 break; 9512 case bcmFieldQualifyInterfaceClassL3: 9513 ifp_cl_type = 3; 9514 break; 9515 case bcmFieldQualifyIngressClassField: 9516 ifp_cl_type = 15; 9517 break; 9518 case bcmFieldQualifyIngressInterfaceClassPort: 9519 ifp_cl_type = 1; 9520 break; 9521 case bcmFieldQualifyIngressInterfaceClassVPort: 9522 ifp_cl_type = 2; 9523 break; 9524 default: 9525 return (BCM_E_INTERNAL); 9526 } 9527 9528 *data |= ifp_cl_type << cl_width; 9529 *mask |= 0xf << cl_width; 9530 } 9531 break; 9532 9533 default: 9534 return (BCM_E_INTERNAL); 9535 } 9536 9537 return (BCM_E_NONE); 9538 } 9539 9540 9541 int 9542 _bcm_field_tr3_qualify_class_get(int unit, 9543 bcm_field_entry_t entry, 9544 bcm_field_qualify_t qual, 9545 uint32 *data, 9546 uint32 *mask 9547 ) 9548 { 9549 _field_entry_t *f_ent; 9550 9551 /* Get field entry part that contains the qualifier. */ 9552 BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry, qual, &f_ent)); 9553 9554 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) { 9555 /* Mask off IFP_CLASSID_TYPE */ 9556 9557 const uint32 m = (1 << 9) - 1; 9558 9559 *data &= m; 9560 *mask &= m; 9561 } 9562 9563 return (BCM_E_NONE); 9564 } 9565 9566 9567 #define IS_FLOW_MODE(f_pl) \ 9568 ((f_pl)->cfg.mode == bcmPolicerModeCommitted \ 9569 || (f_pl)->cfg.mode == bcmPolicerModePeak \ 9570 ) 9571 #define IS_MOD_TRTCM_MODE(f_pl) \ 9572 ((f_pl)->cfg.mode == bcmPolicerModeTrTcmDs \ 9573 || (f_pl)->cfg.mode == bcmPolicerModeCoupledTrTcmDs \ 9574 ) 9575 9576 STATIC int 9577 _field_tr3_ingress_policers_compat(int unit, 9578 _field_entry_t *f_ent, 9579 unsigned lvl, 9580 _field_policer_t *f_pl 9581 ) 9582 { 9583 const unsigned olvl = 1 - lvl; 9584 _field_policer_t *_f_pl[2] = { 0, 0 }; 9585 9586 _f_pl[lvl] = f_pl; 9587 9588 if (!(f_ent->policer[olvl].flags & _FP_POLICER_VALID)) { 9589 return (BCM_E_NONE); 9590 } 9591 9592 BCM_IF_ERROR_RETURN(_bcm_field_policer_get(unit, 9593 f_ent->policer[olvl].pid, 9594 &_f_pl[olvl] 9595 ) 9596 ); 9597 9598 switch (_f_pl[1]->cfg.flags & BCM_POLICER_COLOR_MERGE_MASK) { 9599 case BCM_POLICER_COLOR_MERGE_AND: 9600 case BCM_POLICER_COLOR_MERGE_OR: 9601 /* Level 1 sharing mode is SINGLE_AND or SINGLE_OR 9602 => level 0 and level 1 must both be in flow or modified 9603 trTCM mode 9604 */ 9605 9606 if ((IS_FLOW_MODE(_f_pl[0]) && IS_FLOW_MODE(_f_pl[1])) 9607 || (IS_MOD_TRTCM_MODE(_f_pl[0]) && IS_MOD_TRTCM_MODE(_f_pl[1])) 9608 ) { 9609 break; 9610 } 9611 return (BCM_E_PARAM); 9612 9613 case BCM_POLICER_COLOR_MERGE_DUAL: 9614 /* Level 1 sharing mode is DUAL 9615 => level 0 must be modified trTCM 9616 */ 9617 9618 if (IS_MOD_TRTCM_MODE(_f_pl[0])) { 9619 break; 9620 } 9621 return (BCM_E_PARAM); 9622 9623 default: 9624 return (BCM_E_PARAM); 9625 } 9626 9627 return (BCM_E_NONE); 9628 } 9629 9630 9631 STATIC int 9632 _field_tr3_ingress_policer_mode_support(int unit, 9633 _field_entry_t *f_ent, 9634 int lvl, 9635 _field_policer_t *f_pl 9636 ) 9637 { 9638 switch (f_pl->cfg.mode) { 9639 case bcmPolicerModeGreen: 9640 case bcmPolicerModePassThrough: 9641 case bcmPolicerModeCommitted: 9642 case bcmPolicerModeTrTcmDs: 9643 case bcmPolicerModeCoupledTrTcmDs: 9644 break; 9645 case bcmPolicerModeSrTcm: 9646 case bcmPolicerModeSrTcmModified: 9647 case bcmPolicerModeTrTcm: 9648 if (lvl == 1) { 9649 return (BCM_E_PARAM); 9650 } 9651 break; 9652 default: 9653 return (BCM_E_PARAM); 9654 } 9655 9656 return (_field_tr3_ingress_policers_compat(unit, f_ent, lvl, f_pl)); 9657 } 9658 9659 9660 int 9661 _bcm_field_tr3_policer_mode_support(int unit, 9662 _field_entry_t *f_ent, 9663 int lvl, 9664 _field_policer_t *f_pl 9665 ) 9666 { 9667 int (*func)(int, _field_entry_t *, int, _field_policer_t *); 9668 9669 switch (f_ent->group->stage_id) { 9670 case _BCM_FIELD_STAGE_INGRESS: 9671 func = _field_tr3_ingress_policer_mode_support; 9672 break; 9673 default: 9674 func = _bcm_field_policer_mode_support; 9675 } 9676 9677 return ((*func)(unit, f_ent, lvl, f_pl)); 9678 } 9679 9680 9681 STATIC int 9682 _field_tr3_ingress_policer_action_set(int unit, 9683 _field_entry_t *f_ent, 9684 uint32 *policy_buf 9685 ) 9686 { 9687 _field_entry_policer_t *f_ent_pl; 9688 unsigned api_mode, api_flags, pool_idx, hw_idx; 9689 uint8 hw_mode, modifier, sh_mode; 9690 _field_policer_t *f_pl = NULL; 9691 9692 /* Level 0 */ 9693 9694 if ((f_ent_pl = &f_ent->policer[0])->flags & _FP_POLICER_INSTALLED) { 9695 BCM_IF_ERROR_RETURN(_bcm_field_policer_get(unit, f_ent_pl->pid, &f_pl)); 9696 api_mode = f_pl->cfg.mode; 9697 api_flags = f_pl->cfg.flags; 9698 pool_idx = f_pl->pool_index; 9699 hw_idx = f_pl->hw_index; 9700 } else { 9701 api_mode = bcmPolicerModePassThrough; 9702 api_flags = pool_idx = hw_idx = 0; 9703 } 9704 9705 switch (api_mode) { 9706 case bcmPolicerModeGreen: 9707 case bcmPolicerModePassThrough: 9708 hw_mode = 0; 9709 modifier = (api_mode == bcmPolicerModePassThrough) ? 1 : 0; 9710 break; 9711 case bcmPolicerModeCommitted: 9712 hw_mode = 1; 9713 modifier = (_FP_POLICER_EXCESS_HW_METER(f_pl)) ? 0 : 1; 9714 break; 9715 case bcmPolicerModeSrTcm: 9716 case bcmPolicerModeSrTcmModified: 9717 hw_mode = (api_flags & BCM_POLICER_COLOR_BLIND) ? 6 : 7; 9718 modifier = (api_mode == bcmPolicerModeSrTcmModified) ? 1 : 0; 9719 break; 9720 case bcmPolicerModeTrTcm: 9721 hw_mode = (api_flags & BCM_POLICER_COLOR_BLIND) ? 2 : 3; 9722 modifier = 0; 9723 break; 9724 case bcmPolicerModeTrTcmDs: 9725 case bcmPolicerModeCoupledTrTcmDs: 9726 hw_mode = (api_flags & BCM_POLICER_COLOR_BLIND) ? 4 : 5; 9727 modifier = 0; 9728 break; 9729 default: 9730 return (BCM_E_INTERNAL); 9731 } 9732 9733 soc_mem_field32_set(unit, 9734 FP_POLICY_TABLEm, 9735 policy_buf, 9736 METER_PAIR_POOL_NUMBERf, 9737 pool_idx 9738 ); 9739 soc_mem_field32_set(unit, 9740 FP_POLICY_TABLEm, 9741 policy_buf, 9742 METER_PAIR_POOL_INDEXf, 9743 hw_idx 9744 ); 9745 soc_mem_field32_set(unit, 9746 FP_POLICY_TABLEm, 9747 policy_buf, 9748 METER_PAIR_MODEf, 9749 hw_mode 9750 ); 9751 soc_mem_field32_set(unit, 9752 FP_POLICY_TABLEm, 9753 policy_buf, 9754 METER_PAIR_MODE_MODIFIERf, 9755 modifier 9756 ); 9757 9758 /* Level 1 */ 9759 9760 if ((f_ent_pl = &f_ent->policer[1])->flags & _FP_POLICER_INSTALLED) { 9761 BCM_IF_ERROR_RETURN(_bcm_field_policer_get(unit, f_ent_pl->pid, &f_pl)); 9762 api_mode = f_pl->cfg.mode; 9763 api_flags = f_pl->cfg.flags; 9764 pool_idx = f_pl->pool_index; 9765 hw_idx = f_pl->hw_index; 9766 } else { 9767 api_mode = bcmPolicerModePassThrough; 9768 api_flags = pool_idx = hw_idx = 0; 9769 } 9770 9771 if (api_mode == bcmPolicerModePassThrough) { 9772 hw_mode = sh_mode = modifier = 0; 9773 } else { 9774 switch (api_mode) { 9775 case bcmPolicerModeCommitted: 9776 hw_mode = 0; 9777 modifier = (_FP_POLICER_EXCESS_HW_METER(f_pl)) ? 0 : 1; 9778 break; 9779 case bcmPolicerModeTrTcmDs: 9780 case bcmPolicerModeCoupledTrTcmDs: 9781 hw_mode = 1; 9782 modifier = (api_flags & BCM_POLICER_COLOR_BLIND) ? 0 : 1; 9783 break; 9784 default: 9785 return (BCM_E_INTERNAL); 9786 } 9787 9788 switch (api_flags & BCM_POLICER_COLOR_MERGE_MASK) { 9789 case BCM_POLICER_COLOR_MERGE_AND: 9790 sh_mode = 2; 9791 break; 9792 case BCM_POLICER_COLOR_MERGE_OR: 9793 sh_mode = 1; 9794 break; 9795 case BCM_POLICER_COLOR_MERGE_DUAL: 9796 sh_mode = 3; 9797 break; 9798 default: 9799 return (BCM_E_INTERNAL); 9800 } 9801 } 9802 9803 soc_mem_field32_set(unit, 9804 FP_POLICY_TABLEm, 9805 policy_buf, 9806 SHARED_METER_PAIR_POOL_NUMBERf, 9807 pool_idx 9808 ); 9809 soc_mem_field32_set(unit, 9810 FP_POLICY_TABLEm, 9811 policy_buf, 9812 SHARED_METER_PAIR_POOL_INDEXf, 9813 hw_idx 9814 ); 9815 soc_mem_field32_set(unit, 9816 FP_POLICY_TABLEm, 9817 policy_buf, 9818 SHARED_METER_PAIR_MODEf, 9819 hw_mode 9820 ); 9821 soc_mem_field32_set(unit, 9822 FP_POLICY_TABLEm, 9823 policy_buf, 9824 METER_SHARING_MODEf, 9825 sh_mode 9826 ); 9827 soc_mem_field32_set(unit, 9828 FP_POLICY_TABLEm, 9829 policy_buf, 9830 METER_SHARING_MODE_MODIFIERf, 9831 modifier 9832 ); 9833 9834 return (BCM_E_NONE); 9835 } 9836 9837 9838 int 9839 _bcm_field_tr3_policer_action_set(int unit, 9840 _field_entry_t *f_ent, 9841 soc_mem_t mem, 9842 uint32 *policy_buf 9843 ) 9844 { 9845 switch (f_ent->group->stage_id) { 9846 case _BCM_FIELD_STAGE_INGRESS: 9847 return (_field_tr3_ingress_policer_action_set(unit, f_ent, policy_buf)); 9848 default: 9849 ; 9850 } 9851 9852 return (_bcm_field_trx_policer_action_set(unit, f_ent, mem, policy_buf)); 9853 } 9854 9855 9856 struct cntr_hw_mode { 9857 uint32 hw_bmap; 9858 uint8 hw_entry_count; 9859 }; 9860 9861 static const struct cntr_hw_mode ingress_cntr_hw_mode_tbl[] = { 9862 /* Hardware mode 0 9863 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 0) 9864 */ 9865 { 0, 0 }, 9866 /* Hardware mode 1 9867 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 1) 9868 */ 9869 { BIT(bcmFieldStatGreenPackets) | BIT(bcmFieldStatGreenBytes), 1 }, 9870 /* Hardware mode 2 9871 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 2) 9872 */ 9873 { 0, 0 }, /* Logically equivalent to mode 1 */ 9874 /* Hardware mode 3 9875 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 3) 9876 */ 9877 { 0, 0 }, /* Logically equivalent to mode 1 */ 9878 /* Hardware mode 4 9879 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 0) 9880 */ 9881 { BIT(bcmFieldStatYellowPackets) | BIT(bcmFieldStatYellowBytes), 1 }, 9882 /* Hardware mode 5 9883 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 1) 9884 */ 9885 { BIT(bcmFieldStatNotRedPackets) | BIT(bcmFieldStatNotRedBytes), 1 }, 9886 /* Hardware mode 6 9887 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 2) 9888 */ 9889 { BIT(bcmFieldStatYellowPackets) | BIT(bcmFieldStatYellowBytes) 9890 | BIT(bcmFieldStatGreenPackets) | BIT(bcmFieldStatGreenBytes) 9891 | BIT(bcmFieldStatNotRedPackets) | BIT(bcmFieldStatNotRedBytes), 9892 2 9893 }, 9894 /* Hardware mode 7 9895 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 3) 9896 */ 9897 { 0, 0 }, /* Logically equivalent to mode 6 */ 9898 /* Hardware mode 8 9899 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 0) 9900 */ 9901 { 0, 0 }, /* Logically equivalent to mode 4 */ 9902 /* Hardware mode 9 9903 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 1) 9904 */ 9905 { 0, 0 }, /* Logically equivalent to mode 6 */ 9906 /* Hardware mode 10 9907 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 2) 9908 */ 9909 { 0, 0 }, /* Logically equivalent to mode 5 */ 9910 /* Hardware mode 11 9911 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 3) 9912 */ 9913 { 0, 0 }, /* Logically equivalent to mode 5 */ 9914 /* Hardware mode 12 9915 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 0) 9916 */ 9917 { 0, 0 }, /* Logically equivalent to mode 4 */ 9918 /* Hardware mode 13 9919 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 1) 9920 */ 9921 { 0, 0 }, /* Logically equivalent to mode 6 */ 9922 /* Hardware mode 14 9923 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 2) 9924 */ 9925 { 0, 0 }, /* Logically equivalent to mode 6 */ 9926 /* Hardware mode 15 9927 (R_COUNTER_OFS = 0, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 3) 9928 */ 9929 { 0, 0 }, /* Logically equivalent to mode 5 */ 9930 /* Hardware mode 16 9931 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 0) 9932 */ 9933 { BIT(bcmFieldStatRedPackets) | BIT(bcmFieldStatRedBytes), 1 }, 9934 /* Hardware mode 17 9935 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 1) 9936 */ 9937 { BIT(bcmFieldStatNotYellowPackets) | BIT(bcmFieldStatNotYellowBytes), 1 }, 9938 /* Hardware mode 18 9939 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 2) 9940 */ 9941 { BIT(bcmFieldStatRedPackets) | BIT(bcmFieldStatRedBytes) 9942 | BIT(bcmFieldStatGreenPackets) | BIT(bcmFieldStatGreenBytes) 9943 | BIT(bcmFieldStatNotYellowPackets) | BIT(bcmFieldStatNotYellowBytes), 9944 2 9945 }, 9946 /* Hardware mode 19 9947 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 3) 9948 */ 9949 { 0, 0 }, /* Logically equivalent to mode 18 */ 9950 /* Hardware mode 20 9951 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 0) 9952 */ 9953 { BIT(bcmFieldStatNotGreenPackets) | BIT(bcmFieldStatNotGreenBytes), 1 }, 9954 /* Hardware mode 21 9955 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 1) 9956 */ 9957 { BIT(bcmFieldStatPackets) | BIT(bcmFieldStatBytes), 1 }, 9958 /* Hardware mode 22 9959 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 2) 9960 */ 9961 { BIT(bcmFieldStatNotGreenPackets) | BIT(bcmFieldStatNotGreenBytes) 9962 | BIT(bcmFieldStatGreenPackets) | BIT(bcmFieldStatGreenBytes) 9963 | BIT(bcmFieldStatPackets) | BIT(bcmFieldStatBytes), 9964 2 9965 }, 9966 /* Hardware mode 23 9967 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 3) 9968 */ 9969 { 0, 0 }, /* Logically equivalent to mode 22 */ 9970 /* Hardware mode 24 9971 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 0) 9972 */ 9973 { BIT(bcmFieldStatRedPackets) | BIT(bcmFieldStatRedBytes) 9974 | BIT(bcmFieldStatYellowPackets) | BIT(bcmFieldStatYellowBytes) 9975 | BIT(bcmFieldStatNotGreenPackets) | BIT(bcmFieldStatNotGreenBytes), 9976 2 9977 }, 9978 /* Hardware mode 25 9979 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 1) 9980 */ 9981 { BIT(bcmFieldStatNotYellowPackets) | BIT(bcmFieldStatNotYellowBytes) 9982 | BIT(bcmFieldStatYellowPackets) | BIT(bcmFieldStatYellowBytes) 9983 | BIT(bcmFieldStatPackets) | BIT(bcmFieldStatBytes), 9984 2 9985 }, 9986 /* Hardware mode 26 9987 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 2) 9988 */ 9989 { BIT(bcmFieldStatRedPackets) | BIT(bcmFieldStatRedBytes) 9990 | BIT(bcmFieldStatNotRedPackets) | BIT(bcmFieldStatNotRedBytes) 9991 | BIT(bcmFieldStatPackets) | BIT(bcmFieldStatBytes), 9992 2 9993 }, 9994 /* Hardware mode 27 9995 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 3) 9996 */ 9997 9998 { BIT(bcmFieldStatRedPackets) | BIT(bcmFieldStatRedBytes) 9999 | BIT(bcmFieldStatYellowPackets) | BIT(bcmFieldStatYellowBytes) 10000 | BIT(bcmFieldStatGreenPackets) | BIT(bcmFieldStatGreenBytes) 10001 | BIT(bcmFieldStatNotRedPackets) | BIT(bcmFieldStatNotRedBytes) 10002 | BIT(bcmFieldStatNotYellowPackets) | BIT(bcmFieldStatNotYellowBytes) 10003 | BIT(bcmFieldStatNotGreenPackets) | BIT(bcmFieldStatNotGreenBytes) 10004 | BIT(bcmFieldStatPackets) | BIT(bcmFieldStatBytes), 10005 3 10006 } 10007 10008 /* Everything higher is logically equivalent to a lower-numbered mode. 10009 Here they are, for completeness: 10010 10011 Hardware mode 28 10012 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 0) 10013 10014 { 0, 0 }, Logically equivalent to mode 24 10015 Hardware mode 29 10016 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 1) 10017 10018 { 0, 0 }, Logically equivalent to mode 25 10019 Hardware mode 30 10020 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 2) 10021 10022 { 0, 0 }, Logically equivalent to mode 27 10023 Hardware mode 31 10024 (R_COUNTER_OFS = 1, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 3) 10025 10026 { 0, 0 }, Logically equivalent to mode 26 10027 Hardware mode 32 10028 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 0) 10029 10030 { 0, 0 }, Logically equivalent to mode 16 10031 Hardware mode 33 10032 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 1) 10033 10034 { 0, 0 }, Logically equivalent to mode 18 10035 Hardware mode 34 10036 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 2) 10037 10038 { 0, 0 }, Logically equivalent to mode 17 10039 Hardware mode 35 10040 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 3) 10041 10042 { 0, 0 }, Logically equivalent to mode 18 10043 Hardware mode 36 10044 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 0) 10045 10046 { 0, 0 }, Logically equivalent to mode 24 10047 Hardware mode 37 10048 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 1) 10049 10050 { 0, 0 }, Logically equivalent to mode 26 10051 Hardware mode 38 10052 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 2) 10053 10054 { 0, 0 }, Logically equivalent to mode 25 10055 Hardware mode 39 10056 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 3) 10057 10058 { 0, 0 }, Logically equivalent to mode 27 10059 Hardware mode 40 10060 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 0) 10061 10062 { 0, 0 }, Logically equivalent to mode 20 10063 Hardware mode 41 10064 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 1) 10065 10066 { 0, 0 }, Logically equivalent to mode 22 10067 Hardware mode 42 10068 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 2) 10069 10070 { 0, 0 }, Logically equivalent to mode 21 10071 Hardware mode 43 10072 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 3) 10073 10074 { 0, 0 }, Logically equivalent to mode 22 10075 Hardware mode 44 10076 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 0) 10077 10078 { 0, 0 }, Logically equivalent to mode 24 10079 Hardware mode 45 10080 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 1) 10081 10082 { 0, 0 }, Logically equivalent to mode 27 10083 Hardware mode 46 10084 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 2) 10085 10086 { 0, 0 }, Logically equivalent to mode 25 10087 Hardware mode 47 10088 (R_COUNTER_OFS = 2, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 3) 10089 10090 { 0, 0 }, Logically equivalent to mode 26 10091 Hardware mode 48 10092 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 0) 10093 10094 { 0, 0 }, Logically equivalent to mode 16 10095 Hardware mode 49 10096 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 1) 10097 10098 { 0, 0 }, Logically equivalent to mode 18 10099 Hardware mode 50 10100 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 2) 10101 10102 { 0, 0 }, Logically equivalent to mode 18 10103 Hardware mode 51 10104 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 0, G_COUNTER_OFS = 3) 10105 10106 { 0, 0 }, Logically equivalent to mode 17 10107 Hardware mode 52 10108 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 0) 10109 10110 { 0, 0 }, Logically equivalent to mode 24 10111 Hardware mode 53 10112 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 1) 10113 10114 { 0, 0 }, Logically equivalent to mode 26 10115 Hardware mode 54 10116 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 2) 10117 10118 { 0, 0 }, Logically equivalent to mode 27 10119 Hardware mode 55 10120 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 1, G_COUNTER_OFS = 3) 10121 10122 { 0, 0 }, Logically equivalent to mode 25 10123 Hardware mode 56 10124 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 0) 10125 10126 { 0, 0 }, Logically equivalent to mode 24 10127 Hardware mode 57 10128 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 1) 10129 10130 { 0, 0 }, Logically equivalent to mode 27 10131 Hardware mode 58 10132 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 2) 10133 10134 { 0, 0 }, Logically equivalent to mode 26 10135 Hardware mode 59 10136 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 2, G_COUNTER_OFS = 3) 10137 10138 { 0, 0 }, Logically equivalent to mode 25 10139 Hardware mode 60 10140 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 0) 10141 10142 { 0, 0 }, Logically equivalent to mode 20 10143 Hardware mode 61 10144 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 1) 10145 10146 { 0, 0 }, Logically equivalent to mode 22 10147 Hardware mode 62 10148 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 2) 10149 10150 { 0, 0 }, Logically equivalent to mode 22 10151 Hardware mode 63 10152 (R_COUNTER_OFS = 3, Y_COUNTER_OFS = 3, G_COUNTER_OFS = 3) 10153 10154 { 0, 0 } Logically equivalent to mode 21 10155 */ 10156 }; 10157 10158 10159 int 10160 _bcm_field_tr3_stat_hw_mode_max(_field_stage_id_t stage_id, 10161 int *hw_mode_max 10162 ) 10163 { 10164 switch (stage_id) { 10165 case _BCM_FIELD_STAGE_INGRESS: 10166 *hw_mode_max = COUNTOF(ingress_cntr_hw_mode_tbl); 10167 break; 10168 default: 10169 *hw_mode_max = _FP_STAT_HW_MODE_MAX; 10170 } 10171 10172 return (BCM_E_NONE); 10173 } 10174 10175 10176 STATIC int 10177 _field_tr3_ingress_stat_hw_mode_to_bmap(int unit, 10178 uint16 mode, 10179 uint32 *hw_bmap, 10180 uint8 *hw_entry_count 10181 ) 10182 { 10183 10184 const struct cntr_hw_mode *p; 10185 10186 if (mode >= COUNTOF(ingress_cntr_hw_mode_tbl)) { 10187 return (BCM_E_INTERNAL); 10188 } 10189 10190 p = &ingress_cntr_hw_mode_tbl[mode]; 10191 *hw_bmap = p->hw_bmap; 10192 *hw_entry_count = p->hw_entry_count; 10193 10194 return (BCM_E_NONE); 10195 } 10196 10197 10198 int 10199 _bcm_field_tr3_stat_hw_mode_to_bmap(int unit, 10200 uint16 mode, 10201 _field_stage_id_t stage_id, 10202 uint32 *hw_bmap, 10203 uint8 *hw_entry_count 10204 ) 10205 { 10206 switch (stage_id) { 10207 case _BCM_FIELD_STAGE_INGRESS: 10208 return (_field_tr3_ingress_stat_hw_mode_to_bmap(unit, 10209 mode, 10210 hw_bmap, 10211 hw_entry_count 10212 ) 10213 ); 10214 default: 10215 ; 10216 } 10217 10218 return (_bcm_field_trx_stat_hw_mode_to_bmap(unit, 10219 mode, 10220 stage_id, 10221 hw_bmap, 10222 hw_entry_count 10223 ) 10224 ); 10225 } 10226 10227 10228 STATIC int 10229 _field_tr3_ingress_counter_hw_alloc(int unit, 10230 _field_entry_t *f_ent, 10231 _field_stat_t *f_st 10232 ) 10233 { 10234 _field_stage_t *stage_fc; 10235 _field_cntr_pool_t *p = NULL; 10236 _field_group_t *fg = NULL; 10237 unsigned n, hw_idx, i; 10238 int idx, free_pool_idx; 10239 uint8 pool_idx=0; 10240 int temp_idx=0; 10241 int found =0; 10242 int temp_hw_idx = 0; 10243 10244 if ((NULL == f_st) || (NULL == f_ent)) { 10245 return BCM_E_INTERNAL; 10246 } 10247 10248 fg = f_ent->group; 10249 10250 BCM_IF_ERROR_RETURN(_field_stage_control_get(unit, 10251 f_ent->group->stage_id, 10252 &stage_fc 10253 )); 10254 10255 /* Find required number of consecutive free counters in a pool */ 10256 free_pool_idx = _FP_INVALID_INDEX; 10257 n = stage_fc->num_cntr_pools; 10258 for (idx = 0; idx < n; ++idx) { 10259 p = stage_fc->cntr_pool[idx]; 10260 if (p == NULL) { 10261 return (BCM_E_INTERNAL); 10262 } 10263 10264 /* If we have a matching pool with free entries - just use it. */ 10265 if ((p->slice_id == fg->slices->slice_number) && 10266 (p->free_cntrs >= f_st->hw_entry_count)) { 10267 found = 0; 10268 temp_idx =0; 10269 for (hw_idx = 0, temp_idx = p->size + 1 - f_st->hw_entry_count; 10270 temp_idx; --temp_idx, ++hw_idx) { 10271 for (i = 0; i < f_st->hw_entry_count && 10272 SHR_BITGET(p->cntr_bmp.w, hw_idx + i) == 0; ++i); 10273 if (i >= f_st->hw_entry_count) { 10274 temp_hw_idx = hw_idx; 10275 found = 1; 10276 break; 10277 } 10278 } 10279 if (found) { 10280 pool_idx = idx; 10281 break; 10282 } 10283 } 10284 10285 /* Preserve first free pool */ 10286 if ((_FP_INVALID_INDEX == free_pool_idx) && 10287 (_FP_INVALID_INDEX == p->slice_id)) { 10288 free_pool_idx = idx; 10289 } 10290 } 10291 10292 if (idx < n) { 10293 p = stage_fc->cntr_pool[pool_idx]; 10294 } else { 10295 if (_FP_INVALID_INDEX == free_pool_idx) { 10296 return (BCM_E_RESOURCE); 10297 } 10298 pool_idx = free_pool_idx; 10299 p = stage_fc->cntr_pool[pool_idx]; 10300 p->slice_id = fg->slices->slice_number; 10301 } 10302 10303 if (p->free_cntrs < f_st->hw_entry_count) { 10304 return (BCM_E_RESOURCE); 10305 } 10306 10307 f_st->pool_index = pool_idx; 10308 f_st->hw_index = temp_hw_idx; 10309 10310 /* Mark counters as in use */ 10311 for (i = 0; i < f_st->hw_entry_count; ++i, ++temp_hw_idx) { 10312 SHR_BITSET(p->cntr_bmp.w, temp_hw_idx); 10313 } 10314 p->free_cntrs -= f_st->hw_entry_count; 10315 10316 /* Increment the group counters count equal to 10317 the hw entries count .*/ 10318 f_ent->group->group_status.counter_count = 10319 f_ent->group->group_status.counter_count + f_st->hw_entry_count; 10320 10321 return (BCM_E_NONE); 10322 } 10323 10324 10325 int 10326 _bcm_field_tr3_counter_hw_alloc(int unit, 10327 _field_entry_t *f_ent 10328 ) 10329 { 10330 _field_stat_t *f_st; 10331 10332 BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, f_ent->statistic.sid, &f_st)); 10333 10334 switch (f_ent->group->stage_id) { 10335 case _BCM_FIELD_STAGE_INGRESS: 10336 return (_field_tr3_ingress_counter_hw_alloc(unit, f_ent, f_st)); 10337 default: 10338 ; 10339 } 10340 10341 return (_bcm_field_counter_hw_alloc(unit, f_ent, f_ent->fs)); 10342 } 10343 10344 10345 STATIC int 10346 _field_tr3_ingress_stat_hw_free(int unit, 10347 _field_entry_t *f_ent, 10348 _field_stat_t *f_st 10349 ) 10350 { 10351 _field_stage_t *stage_fc; 10352 _field_cntr_pool_t *p; 10353 unsigned i, n; 10354 uint64 value; /* 64 bit zero to reset hw value. */ 10355 int idx; /* Statistics iteration index. */ 10356 int rv; /* Operation return status. */ 10357 10358 /* Decrement hw reference count. */ 10359 if (f_st->hw_ref_count > 0) { 10360 f_st->hw_ref_count--; 10361 } 10362 10363 /* Statistics is not used by any other entry. */ 10364 if (f_st->hw_ref_count == 0) { 10365 COMPILER_64_ZERO(value); 10366 /* Read & Reset individual statistics. */ 10367 for (idx = 0; idx < f_st->nstat; idx++) { 10368 rv = _field_stat_value_get(unit, 0, f_st, f_st->stat_arr[idx], 10369 f_st->stat_values + idx); 10370 BCM_IF_ERROR_RETURN(rv); 10371 10372 rv = _field_stat_value_set(unit, f_st, f_st->stat_arr[idx], value); 10373 BCM_IF_ERROR_RETURN(rv); 10374 } 10375 10376 BCM_IF_ERROR_RETURN(_field_stage_control_get(unit, 10377 f_ent->group->stage_id, 10378 &stage_fc 10379 )); 10380 p = stage_fc->cntr_pool[f_st->pool_index]; 10381 10382 for (i = f_st->hw_index, n = f_st->hw_entry_count; n; --n, ++i) { 10383 SHR_BITCLR(p->cntr_bmp.w, i); 10384 } 10385 10386 if ((p->free_cntrs += f_st->hw_entry_count) >= p->size) { 10387 p->slice_id = -1; 10388 } 10389 10390 /* decrement the group's counter count equal to 10391 the hw counters used for this stat */ 10392 f_ent->group->group_status.counter_count = 10393 f_ent->group->group_status.counter_count - f_st->hw_entry_count; 10394 10395 f_st->hw_index = _FP_INVALID_INDEX; 10396 f_st->pool_index = _FP_INVALID_INDEX; 10397 } 10398 10399 /* 10400 * If qualifiers have not been modified for this entry, 10401 * set Action only dirty flag. 10402 */ 10403 if (0 == (f_ent->flags & _FP_ENTRY_DIRTY)) { 10404 f_ent->flags |= _FP_ENTRY_POLICY_TABLE_ONLY_DIRTY; 10405 } 10406 10407 f_ent->statistic.flags &= ~_FP_ENTRY_STAT_INSTALLED; 10408 10409 /* Mark entry for reinstall. */ 10410 f_ent->flags |= _FP_ENTRY_DIRTY; 10411 10412 return (BCM_E_NONE); 10413 } 10414 10415 10416 int 10417 _bcm_field_tr3_stat_hw_free(int unit, _field_entry_t *f_ent) 10418 { 10419 _field_stat_t *f_st; 10420 10421 if (!(f_ent->statistic.flags & _FP_ENTRY_STAT_INSTALLED)) { 10422 return (BCM_E_NONE); 10423 } 10424 10425 BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, f_ent->statistic.sid, &f_st)); 10426 10427 switch (f_ent->group->stage_id) { 10428 case _BCM_FIELD_STAGE_INGRESS: 10429 return (_field_tr3_ingress_stat_hw_free(unit, f_ent, f_st)); 10430 default: 10431 ; 10432 } 10433 10434 return (_bcm_field_stat_hw_free(unit, f_ent)); 10435 } 10436 10437 10438 STATIC int 10439 _field_tr3_ingress_stat_action_set(int unit, 10440 _field_entry_t *f_ent, 10441 uint32 *policy_buf 10442 ) 10443 { 10444 unsigned hw_mode, pool_idx, hw_idx; 10445 10446 if (f_ent->statistic.flags & _FP_ENTRY_STAT_INSTALLED) { 10447 _field_stat_t *f_st; 10448 10449 BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, f_ent->statistic.sid, &f_st)); 10450 hw_mode = f_st->hw_mode; 10451 pool_idx = f_st->pool_index; 10452 hw_idx = f_st->hw_index; 10453 } else { 10454 hw_mode = pool_idx = hw_idx = 0; 10455 } 10456 10457 PolicySet(unit, 10458 FP_POLICY_TABLEm, 10459 policy_buf, 10460 COUNTER_POOL_NUMBERf, 10461 pool_idx 10462 ); 10463 PolicySet(unit, 10464 FP_POLICY_TABLEm, 10465 policy_buf, 10466 COUNTER_POOL_INDEXf, 10467 hw_idx 10468 ); 10469 PolicySet(unit, 10470 FP_POLICY_TABLEm, 10471 policy_buf, 10472 R_COUNTER_OFFSETf, 10473 hw_mode >> 4 10474 ); 10475 PolicySet(unit, 10476 FP_POLICY_TABLEm, 10477 policy_buf, 10478 Y_COUNTER_OFFSETf, 10479 (hw_mode >> 2) & 3 10480 ); 10481 PolicySet(unit, 10482 FP_POLICY_TABLEm, 10483 policy_buf, 10484 G_COUNTER_OFFSETf, 10485 hw_mode & 3 10486 ); 10487 10488 return (BCM_E_NONE); 10489 } 10490 10491 10492 int 10493 _bcm_field_tr3_stat_action_set(int unit, 10494 _field_entry_t *f_ent, 10495 soc_mem_t mem, 10496 int tcam_idx, 10497 uint32 *policy_buf 10498 ) 10499 { 10500 switch (f_ent->group->stage_id) { 10501 case _BCM_FIELD_STAGE_INGRESS: 10502 return (_field_tr3_ingress_stat_action_set(unit, f_ent, policy_buf)); 10503 default: 10504 ; 10505 } 10506 10507 return (_bcm_field_trx_stat_action_set 10508 (unit, f_ent, mem, tcam_idx, policy_buf)); 10509 } 10510 10511 10512 STATIC int 10513 _field_tr3_ingress_stat_index_get(int unit, 10514 _field_stat_t *f_st, 10515 bcm_field_stat_t stat, 10516 int *idx1, 10517 int *idx2, 10518 int *idx3, 10519 uint32 *out_flags 10520 ) 10521 { 10522 const unsigned r_cntr_ofs = f_st->hw_mode >> 4, 10523 y_cntr_ofs = (f_st->hw_mode >> 2) & 3, 10524 g_cntr_ofs = f_st->hw_mode & 3, 10525 r_not_used = (r_cntr_ofs == 0), 10526 r_ne_y = (r_cntr_ofs != y_cntr_ofs), 10527 r_ne_g = (r_cntr_ofs != g_cntr_ofs), 10528 y_not_used = (y_cntr_ofs == 0), 10529 y_ne_g = (y_cntr_ofs != g_cntr_ofs), 10530 g_not_used = (g_cntr_ofs == 0); 10531 10532 int counters_per_pool = 0; 10533 10534 *idx1 = *idx2 = *idx3 = _FP_INVALID_INDEX; 10535 *out_flags = 0; 10536 10537 switch (stat) { 10538 case bcmFieldStatRedBytes: 10539 *out_flags |= _FP_STAT_BYTES; 10540 /* coverity[MISSING_BREAK : FALSE] */ 10541 case bcmFieldStatRedPackets: 10542 if (r_not_used) { 10543 return (BCM_E_INTERNAL); 10544 } 10545 *idx1 = r_cntr_ofs; 10546 break; 10547 10548 case bcmFieldStatYellowBytes: 10549 *out_flags |= _FP_STAT_BYTES; 10550 /* coverity[MISSING_BREAK : FALSE] */ 10551 case bcmFieldStatYellowPackets: 10552 if (y_not_used) { 10553 return (BCM_E_INTERNAL); 10554 } 10555 *idx1 = y_cntr_ofs; 10556 break; 10557 10558 case bcmFieldStatGreenBytes: 10559 *out_flags |= _FP_STAT_BYTES; 10560 /* coverity[MISSING_BREAK : FALSE] */ 10561 case bcmFieldStatGreenPackets: 10562 if (g_not_used) { 10563 return (BCM_E_INTERNAL); 10564 } 10565 *idx1 = g_cntr_ofs; 10566 break; 10567 10568 case bcmFieldStatNotRedBytes: 10569 *out_flags |= _FP_STAT_BYTES; 10570 /* coverity[MISSING_BREAK : FALSE] */ 10571 case bcmFieldStatNotRedPackets: 10572 if (y_not_used || g_not_used) { 10573 return (BCM_E_INTERNAL); 10574 } 10575 *idx1 = y_cntr_ofs; 10576 if (y_ne_g) { 10577 *idx2 = g_cntr_ofs; 10578 } 10579 break; 10580 10581 case bcmFieldStatNotYellowBytes: 10582 *out_flags |= _FP_STAT_BYTES; 10583 /* coverity[MISSING_BREAK : FALSE] */ 10584 case bcmFieldStatNotYellowPackets: 10585 if (r_not_used || g_not_used) { 10586 return (BCM_E_INTERNAL); 10587 } 10588 *idx1 = r_cntr_ofs; 10589 if (r_ne_g) { 10590 *idx2 = g_cntr_ofs; 10591 } 10592 break; 10593 10594 case bcmFieldStatNotGreenBytes: 10595 *out_flags |= _FP_STAT_BYTES; 10596 /* coverity[MISSING_BREAK : FALSE] */ 10597 case bcmFieldStatNotGreenPackets: 10598 if (r_not_used || y_not_used) { 10599 return (BCM_E_INTERNAL); 10600 } 10601 *idx1 = r_cntr_ofs; 10602 if (r_ne_y) { 10603 *idx2 = y_cntr_ofs; 10604 } 10605 break; 10606 10607 case bcmFieldStatBytes: 10608 *out_flags |= _FP_STAT_BYTES; 10609 /* coverity[MISSING_BREAK : FALSE] */ 10610 case bcmFieldStatPackets: 10611 if (r_not_used || y_not_used || g_not_used) { 10612 return (BCM_E_INTERNAL); 10613 } 10614 *idx1 = r_cntr_ofs; 10615 if (r_ne_y) { 10616 *idx2 = y_cntr_ofs; 10617 10618 if (y_ne_g && r_ne_g) { 10619 *idx3 = g_cntr_ofs; 10620 } 10621 } else { 10622 if (r_ne_g) { 10623 *idx2 = g_cntr_ofs; 10624 } 10625 } 10626 break; 10627 10628 default: 10629 return (BCM_E_INTERNAL); 10630 } 10631 10632 /* In Half Slice case, FP still retains the actual hardware index value. 10633 * Hence the counters_per_pool should NOT be modified, else the accessing 10634 * index will be different from the actual Hardware Index. 10635 */ 10636 counters_per_pool = NUM_CNTRS_PER_POOL_IFP; 10637 10638 if (SOC_IS_HELIX4(unit)) { 10639 counters_per_pool >>= 1; 10640 } 10641 10642 if (*idx1 != _FP_INVALID_INDEX) { 10643 *idx1 = f_st->pool_index * counters_per_pool + f_st->hw_index + *idx1 - 1; 10644 } 10645 if (*idx2 != _FP_INVALID_INDEX) { 10646 *idx2 = f_st->pool_index * counters_per_pool + f_st->hw_index + *idx2 - 1; 10647 *out_flags |= _FP_STAT_ADD; 10648 } 10649 if (*idx3 != _FP_INVALID_INDEX) { 10650 *idx3 = f_st->pool_index * counters_per_pool + f_st->hw_index + *idx3 - 1; 10651 *out_flags |= _FP_STAT_ADD; 10652 } 10653 10654 return (BCM_E_NONE); 10655 } 10656 10657 10658 STATIC int 10659 _field_tr3_stat_index_get(int unit, 10660 _field_stat_t *f_st, 10661 bcm_field_stat_t stat, 10662 int *idx1, 10663 int *idx2, 10664 int *idx3, 10665 uint32 *out_flags 10666 ) 10667 { 10668 switch (f_st->stage_id) { 10669 case _BCM_FIELD_STAGE_INGRESS: 10670 return (_field_tr3_ingress_stat_index_get(unit, 10671 f_st, 10672 stat, 10673 idx1, 10674 idx2, 10675 idx3, 10676 out_flags 10677 ) 10678 ); 10679 default: 10680 ; 10681 } 10682 10683 return (_bcm_field_trx_stat_index_get(unit, 10684 f_st, 10685 stat, 10686 idx1, 10687 idx2, 10688 idx3, 10689 out_flags 10690 ) 10691 ); 10692 } 10693 10694 10695 STATIC int 10696 _field_tr3_ingress_qual_tcam_key_mask_get(int unit, 10697 _field_entry_t *f_ent, 10698 _field_tcam_t *tcam 10699 ) 10700 { 10701 int errcode = BCM_E_INTERNAL; 10702 const unsigned fp_tcam_words 10703 = BITS2WORDS(soc_mem_field_length(unit, 10704 FP_TCAMm, 10705 KEYf 10706 ) 10707 ); 10708 10709 tcam->key_size 10710 = WORDS2BYTES(fp_tcam_words 10711 + BITS2WORDS(soc_mem_field_length( 10712 unit, 10713 FP_GLOBAL_MASK_TCAMm, 10714 KEYf 10715 ) 10716 ) 10717 ); 10718 tcam->key = sal_alloc(tcam->key_size, " "); 10719 tcam->mask = sal_alloc(tcam->key_size, " "); 10720 if (tcam->key == 0 || tcam->mask == 0) { 10721 errcode = BCM_E_MEMORY; 10722 goto error; 10723 } 10724 sal_memset(tcam->key, 0, tcam->key_size); 10725 sal_memset(tcam->mask, 0, tcam->key_size); 10726 10727 if (f_ent->flags & _FP_ENTRY_INSTALLED) { 10728 int tcam_idx; 10729 uint32 tcam_entry[SOC_MAX_MEM_FIELD_WORDS]; 10730 10731 errcode = _bcm_field_entry_tcam_idx_get(unit, f_ent, &tcam_idx); 10732 if (BCM_FAILURE(errcode)) { 10733 goto error; 10734 } 10735 10736 errcode = soc_mem_read(unit, 10737 FP_TCAMm, 10738 MEM_BLOCK_ANY, 10739 tcam_idx, 10740 tcam_entry 10741 ); 10742 if (BCM_FAILURE(errcode)) { 10743 goto error; 10744 } 10745 soc_mem_field_get(unit, FP_TCAMm, tcam_entry, KEYf, tcam->key); 10746 soc_mem_field_get(unit, FP_TCAMm, tcam_entry, MASKf, tcam->mask); 10747 10748 errcode = soc_mem_read(unit, 10749 FP_GLOBAL_MASK_TCAMm, 10750 MEM_BLOCK_ANY, 10751 tcam_idx, 10752 tcam_entry 10753 ); 10754 if (BCM_FAILURE(errcode)) { 10755 goto error; 10756 } 10757 soc_mem_field_get(unit, 10758 FP_GLOBAL_MASK_TCAMm, 10759 tcam_entry, 10760 KEYf, 10761 tcam->key + fp_tcam_words 10762 ); 10763 soc_mem_field_get(unit, 10764 FP_GLOBAL_MASK_TCAMm, 10765 tcam_entry, 10766 MASKf, 10767 tcam->mask + fp_tcam_words 10768 ); 10769 } 10770 10771 return (BCM_E_NONE); 10772 10773 error: 10774 if (tcam->key) { 10775 sal_free(tcam->key); 10776 tcam->key = 0; 10777 } 10778 if (tcam->mask) { 10779 sal_free(tcam->mask); 10780 tcam->mask = 0; 10781 } 10782 10783 return (errcode); 10784 } 10785 10786 10787 STATIC int 10788 _field_tr3_external_qual_tcam_key_mask_get(int unit, 10789 _field_entry_t *f_ent, 10790 _field_tcam_t *tcam 10791 ) 10792 { 10793 soc_mem_t tcam_data_mem; 10794 unsigned key_size; /* In bytes */ 10795 10796 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_data_mem( 10797 unit, 10798 f_ent->fs->slice_number, 10799 &tcam_data_mem 10800 ) 10801 ); 10802 10803 key_size = WORDS2BYTES(BITS2WORDS(soc_mem_field_length(unit, 10804 tcam_data_mem, 10805 DATAf 10806 ) 10807 ) 10808 ); 10809 10810 f_ent->tcam.key_size = key_size; 10811 10812 /* Allocate S/W Tcam copy */ 10813 if (NULL == f_ent->tcam.key) { 10814 f_ent->tcam.key = sal_alloc(key_size, "field_entry_tcam_key"); 10815 f_ent->tcam.mask = sal_alloc(key_size, "field_entry_tcam_mask"); 10816 if ((NULL == f_ent->tcam.key) || (NULL == f_ent->tcam.mask)) { 10817 LOG_ERROR(BSL_LS_BCM_FP, 10818 (BSL_META_U(unit, 10819 "FP(unit %d) Error: allocation failure for field_entry tcam\n"), 10820 unit)); 10821 if (f_ent->tcam.key) sal_free(f_ent->tcam.key); 10822 if (f_ent->tcam.mask) sal_free(f_ent->tcam.mask); 10823 return (BCM_E_MEMORY); 10824 } 10825 } 10826 sal_memset(f_ent->tcam.key, 0, key_size); 10827 sal_memset(f_ent->tcam.mask, 0, key_size); 10828 10829 /* 10830 * Allocate H/W replica copy: only happens 1st time 10831 * O/W copy H/W copy to S/W copy 10832 */ 10833 if (f_ent->tcam.key_hw == NULL) { 10834 f_ent->tcam.key_hw = sal_alloc(key_size, "field_entry_tcam_key"); 10835 f_ent->tcam.mask_hw = sal_alloc(key_size, "field_entry_tcam_mask"); 10836 if ((NULL == f_ent->tcam.key_hw) || (NULL == f_ent->tcam.mask_hw)) { 10837 LOG_ERROR(BSL_LS_BCM_FP, 10838 (BSL_META_U(unit, 10839 "FP(unit %d) Error: allocation failure for field_entry tcam\n"), 10840 unit)); 10841 if (f_ent->tcam.key_hw) sal_free(f_ent->tcam.key_hw); 10842 if (f_ent->tcam.mask_hw) sal_free(f_ent->tcam.mask_hw); 10843 return (BCM_E_MEMORY); 10844 } 10845 sal_memset(f_ent->tcam.key_hw, 0, key_size); 10846 sal_memset(f_ent->tcam.mask_hw, 0, key_size); 10847 } else { 10848 sal_memcpy(f_ent->tcam.key, f_ent->tcam.key_hw, key_size); 10849 sal_memcpy(f_ent->tcam.mask, f_ent->tcam.mask_hw, key_size); 10850 } 10851 10852 return (BCM_E_NONE); 10853 } 10854 10855 10856 int 10857 _bcm_field_tr3_qual_tcam_key_mask_get(int unit, 10858 _field_entry_t *f_ent, 10859 _field_tcam_t *tcam 10860 ) 10861 { 10862 switch (f_ent->group->stage_id) { 10863 case _BCM_FIELD_STAGE_INGRESS: 10864 return (_field_tr3_ingress_qual_tcam_key_mask_get(unit, f_ent, tcam)); 10865 case _BCM_FIELD_STAGE_EXTERNAL: 10866 return (_field_tr3_external_qual_tcam_key_mask_get(unit, f_ent, tcam)); 10867 default: 10868 ; 10869 } 10870 10871 return (_field_qual_tcam_key_mask_get(unit, f_ent, tcam, 0)); 10872 } 10873 10874 10875 STATIC int 10876 _field_tr3_ingress_qual_tcam_key_mask_set(int unit, 10877 _field_entry_t *f_ent, 10878 unsigned tcam_idx, 10879 unsigned validf 10880 ) 10881 { 10882 _field_tcam_t * const tcam = &f_ent->tcam; 10883 _field_group_t * const fg = f_ent->group; 10884 const unsigned fp_tcam_words 10885 = BITS2WORDS(soc_mem_field_length(unit, 10886 FP_TCAMm, 10887 KEYf 10888 ) 10889 ); 10890 uint32 tcam_entry[SOC_MAX_MEM_FIELD_WORDS] = {0}; 10891 10892 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 10893 FP_TCAMm, 10894 MEM_BLOCK_ANY, 10895 tcam_idx, 10896 tcam_entry 10897 ) 10898 ); 10899 soc_mem_field_set(unit, FP_TCAMm, tcam_entry, KEYf, tcam->key); 10900 soc_mem_field_set(unit, FP_TCAMm, tcam_entry, MASKf, tcam->mask); 10901 soc_mem_field32_set(unit, 10902 FP_TCAMm, 10903 tcam_entry, 10904 VALIDf, 10905 validf 10906 ? ((fg->flags & _FP_GROUP_LOOKUP_ENABLED) 10907 ? 3 : 2 10908 ) 10909 : 0 10910 ); 10911 BCM_IF_ERROR_RETURN(soc_mem_write(unit, 10912 FP_TCAMm, 10913 MEM_BLOCK_ALL, 10914 tcam_idx, 10915 tcam_entry 10916 ) 10917 ); 10918 10919 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 10920 FP_GLOBAL_MASK_TCAMm, 10921 MEM_BLOCK_ANY, 10922 tcam_idx, 10923 tcam_entry 10924 ) 10925 ); 10926 soc_mem_field_set(unit, 10927 FP_GLOBAL_MASK_TCAMm, 10928 tcam_entry, 10929 KEYf, 10930 tcam->key + fp_tcam_words 10931 ); 10932 soc_mem_field_set(unit, 10933 FP_GLOBAL_MASK_TCAMm, 10934 tcam_entry, 10935 MASKf, 10936 tcam->mask + fp_tcam_words 10937 ); 10938 if (!(f_ent->flags & _FP_ENTRY_SECOND_HALF)) { 10939 soc_mem_field_set(unit, 10940 FP_GLOBAL_MASK_TCAMm, 10941 tcam_entry, 10942 IPBMf, 10943 f_ent->pbmp.data.pbits 10944 ); 10945 soc_mem_field_set(unit, 10946 FP_GLOBAL_MASK_TCAMm, 10947 tcam_entry, 10948 IPBM_MASKf, 10949 f_ent->pbmp.mask.pbits 10950 ); 10951 } 10952 soc_mem_field32_set(unit, 10953 FP_GLOBAL_MASK_TCAMm, 10954 tcam_entry, 10955 VALIDf, 10956 validf ? 1 : 0 10957 ); 10958 BCM_IF_ERROR_RETURN(soc_mem_write(unit, 10959 FP_GLOBAL_MASK_TCAMm, 10960 MEM_BLOCK_ALL, 10961 tcam_idx, 10962 tcam_entry 10963 ) 10964 ); 10965 10966 return (BCM_E_NONE); 10967 } 10968 10969 10970 int 10971 _bcm_field_tr3_qual_tcam_key_mask_set(int unit, 10972 _field_entry_t *f_ent, 10973 unsigned validf 10974 ) 10975 { 10976 int tcam_idx; 10977 soc_mem_t tcam_mem; 10978 10979 BCM_IF_ERROR_RETURN(_bcm_field_entry_tcam_idx_get(unit, 10980 f_ent, 10981 &tcam_idx 10982 ) 10983 ); 10984 10985 switch (f_ent->group->stage_id) { 10986 case _BCM_FIELD_STAGE_LOOKUP: 10987 tcam_mem = VFP_TCAMm; 10988 break; 10989 case _BCM_FIELD_STAGE_INGRESS: 10990 return (_field_tr3_ingress_qual_tcam_key_mask_set(unit, f_ent, tcam_idx, validf)); 10991 case _BCM_FIELD_STAGE_EGRESS: 10992 tcam_mem = EFP_TCAMm; 10993 break; 10994 default: 10995 return (BCM_E_INTERNAL); 10996 } 10997 { 10998 uint32 tcam_entry[SOC_MAX_MEM_FIELD_WORDS] = {0}; 10999 11000 BCM_IF_ERROR_RETURN(_bcm_field_trx_tcam_get(unit, tcam_mem, f_ent, tcam_entry)); 11001 BCM_IF_ERROR_RETURN(soc_mem_write(unit, tcam_mem, MEM_BLOCK_ALL, tcam_idx, tcam_entry)); 11002 } 11003 11004 return (BCM_E_NONE); 11005 } 11006 11007 11008 STATIC int 11009 _field_tr3_ingress_write_slice_map(int unit, _field_stage_t *stage_fc) 11010 { 11011 static const soc_field_t physical_slice[] = { 11012 VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11013 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11014 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11015 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11016 VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11017 VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11018 VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11019 VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11020 VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11021 VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11022 VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11023 VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11024 VIRTUAL_SLICE_12_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11025 VIRTUAL_SLICE_13_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11026 VIRTUAL_SLICE_14_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11027 VIRTUAL_SLICE_15_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 11028 VIRTUAL_SLICE_16_PHYSICAL_SLICE_NUMBER_ENTRY_0f 11029 }, slice_group[] = { 11030 VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11031 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11032 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11033 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11034 VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11035 VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11036 VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11037 VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11038 VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11039 VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11040 VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11041 VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11042 VIRTUAL_SLICE_12_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11043 VIRTUAL_SLICE_13_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11044 VIRTUAL_SLICE_14_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11045 VIRTUAL_SLICE_15_VIRTUAL_SLICE_GROUP_ENTRY_0f, 11046 VIRTUAL_SLICE_16_VIRTUAL_SLICE_GROUP_ENTRY_0f 11047 }; 11048 11049 _field_control_t *fc; 11050 fp_slice_map_entry_t fp_slice_map_buf; 11051 unsigned vmap_size, index; 11052 11053 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 11054 11055 vmap_size = stage_fc->tcam_slices; 11056 if (fc->flags & _FP_EXTERNAL_PRESENT) { 11057 ++vmap_size; 11058 } 11059 11060 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 11061 FP_SLICE_MAPm, 11062 MEM_BLOCK_ANY, 11063 0, 11064 fp_slice_map_buf.entry_data 11065 ) 11066 ); 11067 11068 for (index = 0; index < vmap_size; index++) { 11069 soc_mem_field32_set(unit, 11070 FP_SLICE_MAPm, 11071 fp_slice_map_buf.entry_data, 11072 physical_slice[index], 11073 stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][index].vmap_key 11074 ); 11075 soc_mem_field32_set(unit, 11076 FP_SLICE_MAPm, 11077 fp_slice_map_buf.entry_data, 11078 slice_group[index], 11079 stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][index].virtual_group 11080 ); 11081 } 11082 11083 return (soc_mem_write(unit, 11084 FP_SLICE_MAPm, 11085 MEM_BLOCK_ALL, 11086 0, 11087 fp_slice_map_buf.entry_data 11088 ) 11089 ); 11090 } 11091 11092 11093 int 11094 _bcm_field_tr3_write_slice_map(int unit, _field_stage_t *stage_fc, 11095 _field_group_t *fg) 11096 { 11097 switch (stage_fc->stage_id) { 11098 case _BCM_FIELD_STAGE_LOOKUP: 11099 return (_bcm_field_trx_write_slice_map_vfp(unit, stage_fc)); 11100 11101 case _BCM_FIELD_STAGE_INGRESS: 11102 return (_field_tr3_ingress_write_slice_map(unit, stage_fc)); 11103 11104 case _BCM_FIELD_STAGE_EGRESS: 11105 return (_bcm_field_trx_write_slice_map_egress(unit, stage_fc)); 11106 11107 default: 11108 ; 11109 } 11110 11111 return (BCM_E_INTERNAL); 11112 } 11113 11114 /* 11115 * Function: 11116 * _bcm_field_tr3_cosq_action_param_get 11117 * Purpose: 11118 * Returns CosQ action's param value if action is set for the 11119 * entry. 11120 * Parameters: 11121 * unit - BCM device number 11122 * f_ent - pointer to field entry structure 11123 * action - CosQ action for which param value needs to be retrieved 11124 * cosq - (OUT) CoS value 11125 * Returns: 11126 * BCM_E_XXX 11127 */ 11128 STATIC 11129 int _bcm_field_tr3_cosq_action_param_get(int unit, 11130 _field_entry_t *f_ent, 11131 bcm_field_action_t action, 11132 int *cosq) 11133 { 11134 _field_action_t *fa_iter = NULL; /* Field entry action */ 11135 11136 if (NULL == cosq || NULL == f_ent) { 11137 return (BCM_E_INTERNAL); 11138 } 11139 11140 /* Get the requested action param. */ 11141 fa_iter = f_ent->actions; 11142 while (fa_iter != NULL) { 11143 if (action == fa_iter->action) { 11144 *cosq = fa_iter->param[0]; 11145 return (BCM_E_NONE); 11146 } 11147 fa_iter = fa_iter->next; 11148 } 11149 11150 /* Specified action not found in entry action list. */ 11151 return (BCM_E_NOT_FOUND); 11152 } 11153 11154 /* 11155 * Function: 11156 * _bcm_field_tr3_ucast_mcast_action_set 11157 * Purpose: 11158 * Set Unicast and Multicast CoS action in the entry buffer 11159 * Parameters: 11160 * unit - BCM device number 11161 * mem - Policy table memory 11162 * f_ent - entry structure to get policy info from 11163 * tcam_idx - index into TCAM 11164 * fa - field action 11165 * buf - (OUT) Field Policy table entry 11166 * Returns: 11167 * BCM_E_XXX 11168 */ 11169 STATIC 11170 int _bcm_field_tr3_ucast_mcast_action_set(int unit, 11171 soc_mem_t mem, 11172 _field_entry_t *f_ent, 11173 int tcam_idx, 11174 _field_action_t *fa, 11175 uint32 *buf) 11176 { 11177 int m_cos = BCM_COS_INVALID; 11178 int u_cos = BCM_COS_INVALID; 11179 int cos = BCM_COS_INVALID; 11180 int rv; 11181 11182 11183 if (NULL == f_ent || NULL == fa || NULL == buf) { 11184 return (BCM_E_PARAM); 11185 } 11186 11187 cos = (int) fa->param[0]; 11188 11189 switch (fa->action) { 11190 case bcmFieldActionMcastCosQNew: 11191 m_cos = cos; 11192 rv = _bcm_field_tr3_cosq_action_param_get(unit, 11193 f_ent, bcmFieldActionUcastCosQNew, &u_cos); 11194 if (BCM_SUCCESS(rv)) { 11195 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11196 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11197 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11198 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11199 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11200 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11201 11202 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11203 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11204 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11205 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11206 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11207 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11208 } else { 11209 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11210 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 11211 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11212 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 11213 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11214 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 11215 11216 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11217 _FP_ACTION_MCAST_QUEUE_SET(m_cos)); 11218 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11219 _FP_ACTION_MCAST_QUEUE_SET(m_cos)); 11220 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11221 _FP_ACTION_MCAST_QUEUE_SET(m_cos)); 11222 } 11223 break; 11224 11225 case bcmFieldActionGpMcastCosQNew: 11226 m_cos = cos; 11227 rv = _bcm_field_tr3_cosq_action_param_get(unit, 11228 f_ent, bcmFieldActionGpUcastCosQNew, &u_cos); 11229 if (BCM_SUCCESS(rv)) { 11230 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11231 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11232 11233 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11234 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11235 } else { 11236 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11237 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 11238 11239 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11240 _FP_ACTION_MCAST_QUEUE_SET(m_cos)); 11241 } 11242 break; 11243 11244 case bcmFieldActionYpMcastCosQNew: 11245 m_cos = cos; 11246 rv = _bcm_field_tr3_cosq_action_param_get(unit, 11247 f_ent, bcmFieldActionYpUcastCosQNew, &u_cos); 11248 if (BCM_SUCCESS(rv)) { 11249 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11250 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11251 11252 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11253 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11254 } else { 11255 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11256 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 11257 11258 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11259 _FP_ACTION_MCAST_QUEUE_SET(m_cos)); 11260 } 11261 break; 11262 11263 case bcmFieldActionRpMcastCosQNew: 11264 m_cos = cos; 11265 rv = _bcm_field_tr3_cosq_action_param_get(unit, 11266 f_ent, bcmFieldActionRpUcastCosQNew, &u_cos); 11267 if (BCM_SUCCESS(rv)) { 11268 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11269 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11270 11271 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11272 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11273 } else { 11274 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11275 _FP_ACTION_MCAST_QUEUE_NEW_MODE); 11276 11277 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11278 _FP_ACTION_MCAST_QUEUE_SET(m_cos)); 11279 } 11280 break; 11281 11282 case bcmFieldActionUcastCosQNew: 11283 u_cos = cos; 11284 rv = _bcm_field_tr3_cosq_action_param_get(unit, 11285 f_ent, bcmFieldActionMcastCosQNew, &m_cos); 11286 if (BCM_SUCCESS(rv)) { 11287 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11288 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11289 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11290 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11291 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11292 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11293 11294 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11295 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11296 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11297 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11298 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11299 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11300 } else { 11301 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11302 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 11303 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11304 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 11305 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11306 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 11307 11308 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11309 _FP_ACTION_UCAST_QUEUE_SET(u_cos)); 11310 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11311 _FP_ACTION_UCAST_QUEUE_SET(u_cos)); 11312 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11313 _FP_ACTION_UCAST_QUEUE_SET(u_cos)); 11314 } 11315 break; 11316 11317 case bcmFieldActionGpUcastCosQNew: 11318 u_cos = cos; 11319 rv = _bcm_field_tr3_cosq_action_param_get(unit, 11320 f_ent, bcmFieldActionGpMcastCosQNew, &m_cos); 11321 if (BCM_SUCCESS(rv)) { 11322 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11323 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11324 11325 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11326 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11327 } else { 11328 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11329 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 11330 11331 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11332 _FP_ACTION_UCAST_QUEUE_SET(u_cos)); 11333 } 11334 break; 11335 11336 case bcmFieldActionYpUcastCosQNew: 11337 u_cos = cos; 11338 rv = _bcm_field_tr3_cosq_action_param_get(unit, 11339 f_ent, bcmFieldActionYpMcastCosQNew, &m_cos); 11340 if (BCM_SUCCESS(rv)) { 11341 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11342 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11343 11344 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11345 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11346 } else { 11347 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11348 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 11349 11350 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11351 _FP_ACTION_UCAST_QUEUE_SET(u_cos)); 11352 } 11353 break; 11354 11355 case bcmFieldActionRpUcastCosQNew: 11356 u_cos = cos; 11357 rv = _bcm_field_tr3_cosq_action_param_get(unit, 11358 f_ent, bcmFieldActionRpMcastCosQNew, &m_cos); 11359 if (BCM_SUCCESS(rv)) { 11360 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11361 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11362 11363 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11364 _FP_ACTION_UCAST_MCAST_QUEUE_SET(u_cos, m_cos)); 11365 } else { 11366 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11367 _FP_ACTION_UCAST_QUEUE_NEW_MODE); 11368 11369 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11370 _FP_ACTION_UCAST_QUEUE_SET(u_cos)); 11371 } 11372 break; 11373 11374 default: 11375 return (BCM_E_INTERNAL); 11376 } 11377 11378 return (BCM_E_NONE); 11379 } 11380 11381 /* 11382 * Function: 11383 * _bcm_field_tr3_action_get 11384 * Purpose: 11385 * Get the actions to be written 11386 * Parameters: 11387 * unit - BCM device number 11388 * mem - Policy table memory 11389 * f_ent - entry structure to get policy info from 11390 * tcam_idx - index into TCAM 11391 * fa - field action 11392 * buf - (OUT) Field Policy table entry 11393 * Returns: 11394 * BCM_E_NONE 11395 * BCM_E_PARAM - Action parameter out-of-range or unrecognized action. 11396 * Notes: 11397 * This is a simple read/modify/write pattern. 11398 * FP unit lock should be held by calling function. 11399 */ 11400 int 11401 _bcm_field_tr3_action_get(int unit, 11402 soc_mem_t mem, 11403 _field_entry_t *f_ent, 11404 int tcam_idx, 11405 _field_action_t *fa, 11406 uint32 *buf 11407 ) 11408 { 11409 uint32 arg = fa->param[0]; 11410 bcm_port_t local_port; 11411 int index; 11412 int cosq_new; 11413 int rv = 0; 11414 11415 switch (fa->action) { 11416 case bcmFieldActionNewClassId: 11417 PolicySet(unit, mem, buf, I2E_CLASSIDf, arg); 11418 PolicySet(unit, mem, buf, G_L3SW_CHANGE_L2_FIELDSf, 0x8); 11419 break; 11420 case bcmFieldActionTrunkLoadBalanceCancel: 11421 PolicySet(unit, mem, buf, LAG_DLB_DISABLEf, 1); 11422 PolicySet(unit, mem, buf, HGT_DLB_DISABLEf, 1); 11423 break; 11424 11425 case bcmFieldActionEcmpLoadBalanceCancel: 11426 PolicySet(unit, mem, buf, ECMP_DLB_DISABLEf, 1); 11427 break; 11428 11429 case bcmFieldActionEgressClassSelect: 11430 { 11431 unsigned i2e_cl_sel; 11432 11433 switch (arg) { 11434 case BCM_FIELD_EGRESS_CLASS_SELECT_PORT: 11435 i2e_cl_sel = 0x1; 11436 break; 11437 case BCM_FIELD_EGRESS_CLASS_SELECT_SVP: 11438 i2e_cl_sel = 0x2; 11439 break; 11440 case BCM_FIELD_EGRESS_CLASS_SELECT_L3_IIF: 11441 i2e_cl_sel = 0x3; 11442 break; 11443 case BCM_FIELD_EGRESS_CLASS_SELECT_FIELD_SRC: 11444 i2e_cl_sel = 0x4; /* VFP hi */ 11445 break; 11446 case BCM_FIELD_EGRESS_CLASS_SELECT_FIELD_DST: 11447 i2e_cl_sel = 0x5; /* VFP lo */ 11448 break; 11449 case BCM_FIELD_EGRESS_CLASS_SELECT_L2_SRC: 11450 i2e_cl_sel = 0x6; 11451 break; 11452 case BCM_FIELD_EGRESS_CLASS_SELECT_L2_DST: 11453 i2e_cl_sel = 0x7; 11454 break; 11455 case BCM_FIELD_EGRESS_CLASS_SELECT_L3_SRC: 11456 i2e_cl_sel = 0x8; 11457 break; 11458 case BCM_FIELD_EGRESS_CLASS_SELECT_L3_DST: 11459 i2e_cl_sel = 0x9; 11460 break; 11461 case BCM_FIELD_EGRESS_CLASS_SELECT_VLAN: 11462 i2e_cl_sel = 0xa; 11463 break; 11464 case BCM_FIELD_EGRESS_CLASS_SELECT_VRF: 11465 i2e_cl_sel = 0xb; 11466 break; 11467 case BCM_FIELD_EGRESS_CLASS_SELECT_NEW: 11468 i2e_cl_sel = 0xf; 11469 break; 11470 default: 11471 /* Invalid parameter should have been caught earlier */ 11472 return (BCM_E_INTERNAL); 11473 } 11474 11475 PolicySet(unit, mem, buf, I2E_CLASSID_SELf, i2e_cl_sel); 11476 PolicySet(unit, mem, buf, G_L3SW_CHANGE_L2_FIELDSf, 0x8); 11477 } 11478 break; 11479 11480 case bcmFieldActionHiGigClassSelect: 11481 { 11482 unsigned hg_cl_sel; 11483 11484 switch (arg) { 11485 case BCM_FIELD_HIGIG_CLASS_SELECT_EGRESS: 11486 hg_cl_sel = 1; 11487 break; 11488 case BCM_FIELD_HIGIG_CLASS_SELECT_EGR_DVP: 11489 hg_cl_sel = 4; 11490 break; 11491 case BCM_FIELD_HIGIG_CLASS_SELECT_EGR_L3_INTERFACE: 11492 hg_cl_sel = 3; 11493 break; 11494 case BCM_FIELD_HIGIG_CLASS_SELECT_EGR_NEXT_HOP: 11495 hg_cl_sel = 2; 11496 break; 11497 case BCM_FIELD_HIGIG_CLASS_SELECT_PORT: 11498 hg_cl_sel = 7; 11499 break; 11500 default: 11501 /* Invalid parameter should have been caught earlier */ 11502 return (BCM_E_INTERNAL); 11503 } 11504 11505 PolicySet(unit, mem, buf, HG_CLASSID_SELf, hg_cl_sel); 11506 } 11507 break; 11508 11509 case bcmFieldActionOamDmTimeFormat: 11510 { 11511 unsigned oam_dm_type; 11512 11513 switch (arg) { 11514 case BCM_FIELD_OAM_DM_TIME_FORMAT_IEEE1588: 11515 oam_dm_type = 0; 11516 break; 11517 case BCM_FIELD_OAM_DM_TIME_FORMAT_NTP: 11518 oam_dm_type = 1; 11519 break; 11520 default: 11521 /* Invalid parameter should have been caught earlier */ 11522 return (BCM_E_INTERNAL); 11523 } 11524 11525 PolicySet(unit, mem, buf, OAM_DM_TYPEf, oam_dm_type); 11526 } 11527 break; 11528 11529 case bcmFieldActionOamLmDmSampleEnable: 11530 PolicySet(unit, mem, buf, OAM_ENABLE_LM_DM_SAMPLEf, arg ? 1 : 0); 11531 break; 11532 11533 case bcmFieldActionOamTagStatusCheck: 11534 PolicySet(unit, mem, buf, OAM_TAG_STATUS_CHECK_CONTROLf, arg); 11535 break; 11536 11537 case bcmFieldActionOamTunnelControl: 11538 { 11539 unsigned oam_tnl_cntl; 11540 11541 switch (arg) { 11542 case BCM_FIELD_OAM_TUNNEL_CONTROL_ANY: 11543 oam_tnl_cntl = 0; 11544 break; 11545 case BCM_FIELD_OAM_TUNNEL_CONTROL_NOT_TUNNELDED: 11546 oam_tnl_cntl = 1; 11547 break; 11548 default: 11549 /* Invalid parameter should have been caught earlier */ 11550 return (BCM_E_INTERNAL); 11551 } 11552 11553 PolicySet(unit, mem, buf, OAM_TUNNEL_CONTROLf, oam_tnl_cntl); 11554 } 11555 break; 11556 11557 case bcmFieldActionRegex: 11558 PolicySet(unit, mem, buf, DO_DPIf, 1); 11559 break; 11560 11561 case bcmFieldActionNoRegex: 11562 PolicySet(unit, mem, buf, DO_NOT_DPIf, 1); 11563 break; 11564 11565 case bcmFieldActionRegexActionCancel: 11566 PolicySet(unit, mem, buf, DPI_CNT_ONLYf, 1); 11567 break; 11568 11569 case bcmFieldActionEcnNew: 11570 PolicySet(unit, mem, buf, R_CHANGE_ECNf, 1); 11571 PolicySet(unit, mem, buf, R_NEW_ECNf, arg); 11572 PolicySet(unit, mem, buf, Y_CHANGE_ECNf, 1); 11573 PolicySet(unit, mem, buf, Y_NEW_ECNf, arg); 11574 PolicySet(unit, mem, buf, G_CHANGE_ECNf, 1); 11575 PolicySet(unit, mem, buf, G_NEW_ECNf, arg); 11576 break; 11577 11578 case bcmFieldActionRpEcnNew: 11579 PolicySet(unit, mem, buf, R_CHANGE_ECNf, 1); 11580 PolicySet(unit, mem, buf, R_NEW_ECNf, arg); 11581 break; 11582 11583 case bcmFieldActionYpEcnNew: 11584 PolicySet(unit, mem, buf, Y_CHANGE_ECNf, 1); 11585 PolicySet(unit, mem, buf, Y_NEW_ECNf, arg); 11586 break; 11587 11588 case bcmFieldActionGpEcnNew: 11589 PolicySet(unit, mem, buf, G_CHANGE_ECNf, 1); 11590 PolicySet(unit, mem, buf, G_NEW_ECNf, arg); 11591 break; 11592 11593 case bcmFieldActionCosQNew: 11594 /* Set new CoSQ/hardware queue value. */ 11595 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 11596 BCM_IF_ERROR_RETURN 11597 (_bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11598 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 11599 &local_port, &index, NULL)); 11600 } else { 11601 index = fa->param[0]; 11602 } 11603 11604 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11605 _FP_ACTION_UCAST_MCAST_QUEUE_SET(index,index)); 11606 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11607 _FP_ACTION_UCAST_MCAST_QUEUE_SET(index,index)); 11608 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11609 _FP_ACTION_UCAST_MCAST_QUEUE_SET(index,index)); 11610 11611 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11612 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11613 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11614 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11615 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11616 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11617 break; 11618 11619 case bcmFieldActionGpCosQNew: 11620 /* Apply this action for Gp packets. */ 11621 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 11622 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11623 11624 /* Set new CoSQ/hardware queue value. */ 11625 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 11626 BCM_IF_ERROR_RETURN 11627 (_bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11628 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 11629 &local_port, &index, NULL)); 11630 } else { 11631 index = fa->param[0]; 11632 } 11633 11634 PolicySet(unit, mem, buf, G_COS_INT_PRIf, 11635 _FP_ACTION_UCAST_MCAST_QUEUE_SET(index,index)); 11636 break; 11637 11638 case bcmFieldActionYpCosQNew: 11639 /* Apply this action for Yp packets. */ 11640 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 11641 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11642 11643 /* Set new CoSQ/hardware queue value. */ 11644 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 11645 BCM_IF_ERROR_RETURN 11646 (_bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11647 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 11648 &local_port, &index, NULL)); 11649 } else { 11650 index = fa->param[0]; 11651 } 11652 11653 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, 11654 _FP_ACTION_UCAST_MCAST_QUEUE_SET(index,index)); 11655 break; 11656 11657 case bcmFieldActionRpCosQNew: 11658 /* Apply this action for Rp packets. */ 11659 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 11660 _FP_ACTION_UCAST_MCAST_QUEUE_NEW_MODE); 11661 11662 /* Set new CoSQ/hardware queue value. */ 11663 if (BCM_GPORT_IS_UCAST_QUEUE_GROUP(fa->param[0])) { 11664 BCM_IF_ERROR_RETURN 11665 (_bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11666 _BCM_TR3_COSQ_INDEX_STYLE_UCAST_QUEUE, 11667 &local_port, &index, NULL)); 11668 } else { 11669 index = fa->param[0]; 11670 } 11671 11672 PolicySet(unit, mem, buf, R_COS_INT_PRIf, 11673 _FP_ACTION_UCAST_MCAST_QUEUE_SET(index,index)); 11674 break; 11675 11676 case bcmFieldActionUcastCosQNew: 11677 case bcmFieldActionMcastCosQNew: 11678 case bcmFieldActionGpMcastCosQNew: 11679 case bcmFieldActionYpMcastCosQNew: 11680 case bcmFieldActionRpMcastCosQNew: 11681 case bcmFieldActionGpUcastCosQNew: 11682 case bcmFieldActionYpUcastCosQNew: 11683 case bcmFieldActionRpUcastCosQNew: 11684 BCM_IF_ERROR_RETURN 11685 (_bcm_field_tr3_ucast_mcast_action_set(unit, mem, f_ent, 11686 tcam_idx, fa, buf)); 11687 break; 11688 11689 case bcmFieldActionUcastQueueNew: 11690 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 2); 11691 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 2); 11692 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 2); 11693 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11694 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 11695 &cosq_new, NULL); 11696 if (BCM_FAILURE(rv)) { 11697 return BCM_E_PARAM; 11698 } 11699 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 11700 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 11701 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 11702 break; 11703 11704 case bcmFieldActionRpUcastQueueNew: 11705 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 2); 11706 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11707 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 11708 &cosq_new, NULL); 11709 if (BCM_FAILURE(rv)) { 11710 return BCM_E_PARAM; 11711 } 11712 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 11713 break; 11714 11715 case bcmFieldActionYpUcastQueueNew: 11716 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 2); 11717 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11718 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 11719 &cosq_new, NULL); 11720 if (BCM_FAILURE(rv)) { 11721 return BCM_E_PARAM; 11722 } 11723 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 11724 break; 11725 11726 case bcmFieldActionGpUcastQueueNew: 11727 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 2); 11728 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11729 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 11730 &cosq_new, NULL); 11731 if (BCM_FAILURE(rv)) { 11732 return BCM_E_PARAM; 11733 } 11734 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 11735 break; 11736 11737 case bcmFieldActionIntCosUcastQueueNew: 11738 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 3); 11739 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 3); 11740 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 3); 11741 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11742 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 11743 &cosq_new, NULL); 11744 if (BCM_FAILURE(rv)) { 11745 return BCM_E_PARAM; 11746 } 11747 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 11748 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 11749 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 11750 break; 11751 11752 case bcmFieldActionRpIntCosUcastQueueNew: 11753 PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 3); 11754 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11755 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 11756 &cosq_new, NULL); 11757 if (BCM_FAILURE(rv)) { 11758 return BCM_E_PARAM; 11759 } 11760 PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new); 11761 break; 11762 11763 case bcmFieldActionYpIntCosUcastQueueNew: 11764 PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 3); 11765 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11766 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 11767 &cosq_new, NULL); 11768 if (BCM_FAILURE(rv)) { 11769 return BCM_E_PARAM; 11770 } 11771 PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new); 11772 break; 11773 11774 case bcmFieldActionGpIntCosUcastQueueNew: 11775 PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 3); 11776 rv = _bcm_tr3_cosq_index_resolve(unit, fa->param[0], 0, 11777 _BCM_TR3_COSQ_INDEX_STYLE_BUCKET, NULL, 11778 &cosq_new, NULL); 11779 if (BCM_FAILURE(rv)) { 11780 return BCM_E_PARAM; 11781 } 11782 PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new); 11783 break; 11784 11785 case bcmFieldActionCopyToCpu: 11786 case bcmFieldActionRpCopyToCpu: 11787 case bcmFieldActionYpCopyToCpu: 11788 case bcmFieldActionGpCopyToCpu: 11789 BCM_IF_ERROR_RETURN(_field_trx_action_copy_to_cpu(unit, mem, f_ent, 11790 fa, buf)); 11791 break; 11792 default: 11793 return (BCM_E_UNAVAIL); 11794 } 11795 11796 return (BCM_E_NONE); 11797 } 11798 11799 11800 int 11801 _bcm_field_tr3_counter_mem_get(int unit, 11802 _field_stage_t *stage_fc, 11803 soc_mem_t *cntr_x_mem, 11804 soc_mem_t *cntr_y_mem 11805 ) 11806 { 11807 switch (stage_fc->stage_id) { 11808 case _BCM_FIELD_STAGE_INGRESS: 11809 *cntr_x_mem = FP_COUNTER_TABLEm; 11810 *cntr_y_mem = INVALIDm; 11811 break; 11812 11813 case _BCM_FIELD_STAGE_EXTERNAL: 11814 *cntr_x_mem = *cntr_y_mem = INVALIDm; 11815 break; 11816 11817 default: 11818 return (_bcm_field_counter_mem_get(unit, 11819 stage_fc, 11820 cntr_x_mem, 11821 cntr_y_mem 11822 ) 11823 ); 11824 } 11825 11826 return (BCM_E_NONE); 11827 } 11828 11829 11830 STATIC int 11831 _field_tr3_counter_write(int unit, 11832 soc_mem_t mem, 11833 int idx, 11834 uint32 *buf, 11835 _field_counter32_collect_t *cntrs32_buf, 11836 _field_counter64_collect_t *cntrs64_buf, 11837 uint64 *packet_count, 11838 uint64 *byte_count 11839 ) 11840 { 11841 uint32 hw_val[2]; /* Parsed field counter value.*/ 11842 11843 /* Set byte count in the memory */ 11844 if (NULL != byte_count) { 11845 COMPILER_64_ZERO(cntrs64_buf->accumulated_counter); 11846 COMPILER_64_OR(cntrs64_buf->accumulated_counter, (*byte_count)); 11847 COMPILER_64_SET(cntrs64_buf->last_hw_value, 11848 COMPILER_64_HI(*byte_count) & 0xf, 11849 COMPILER_64_LO(*byte_count)); 11850 hw_val[0] = COMPILER_64_LO(cntrs64_buf->last_hw_value); 11851 hw_val[1] = COMPILER_64_HI(cntrs64_buf->last_hw_value); 11852 soc_mem_field_set(unit, mem, buf, BYTE_COUNTERf, hw_val); 11853 } 11854 11855 /* Set packet count in the memory */ 11856 if (NULL != packet_count) { 11857 COMPILER_64_ZERO(cntrs32_buf->accumulated_counter); 11858 COMPILER_64_OR(cntrs32_buf->accumulated_counter, 11859 (*packet_count)); 11860 cntrs32_buf->last_hw_value = 11861 (COMPILER_64_LO(*packet_count) & 0x1fffffff); 11862 hw_val[0] = cntrs32_buf->last_hw_value; 11863 hw_val[1] = 0; 11864 soc_mem_field_set(unit, mem, buf, PACKET_COUNTERf, hw_val); 11865 } 11866 11867 return soc_mem_write(unit, mem, MEM_BLOCK_ALL, idx, buf); 11868 } 11869 11870 11871 STATIC int 11872 _field_tr3_counter_set(int unit, 11873 _field_stage_t *stage_fc, 11874 soc_mem_t counter_x_mem, 11875 uint32 *mem_x_buf, 11876 soc_mem_t counter_y_mem, 11877 uint32 *mem_y_buf, 11878 int idx, 11879 uint64 *packet_count, 11880 uint64 *byte_count 11881 ) 11882 { 11883 _field_counter32_collect_t *cntrs32_buf; /* Sw packet counter value */ 11884 _field_counter64_collect_t *cntrs64_buf; /* Sw byte counter value */ 11885 11886 /* Input parameters check. */ 11887 if (NULL == stage_fc) { 11888 return BCM_E_PARAM; 11889 } 11890 11891 /* Write X pipeline counter value. */ 11892 if (NULL != mem_x_buf) { 11893 cntrs64_buf = &stage_fc->_field_x64_counters[idx]; 11894 cntrs32_buf = &stage_fc->_field_x32_counters[idx]; 11895 BCM_IF_ERROR_RETURN( 11896 _field_tr3_counter_write(unit, 11897 counter_x_mem, 11898 idx, 11899 mem_x_buf, 11900 cntrs32_buf, 11901 cntrs64_buf, 11902 packet_count, 11903 byte_count 11904 ) 11905 ); 11906 } 11907 11908 return (BCM_E_NONE); 11909 } 11910 11911 11912 STATIC int 11913 _field_tr3_counter_get(int unit, 11914 _field_stage_t *stage_fc, 11915 soc_mem_t counter_x_mem, 11916 uint32 *mem_x_buf, 11917 soc_mem_t counter_y_mem, 11918 uint32 *mem_y_buf, 11919 int idx, 11920 uint64 *packet_count, 11921 uint64 *byte_count 11922 ) 11923 { 11924 _field_counter32_collect_t *cntrs32_buf; /* Sw packet counter value */ 11925 _field_counter64_collect_t *cntrs64_buf; /* Sw byte counter value */ 11926 uint32 hw_val[2]; /* Parsed field counter value.*/ 11927 soc_memacc_t *memacc_pkt, *memacc_byte; /* Memory access cache. */ 11928 11929 /* Input parameters check. */ 11930 if ((NULL == mem_x_buf) || (INVALIDm == counter_x_mem) || \ 11931 (NULL == stage_fc)) { 11932 return (BCM_E_PARAM); 11933 } 11934 11935 /* Byte counter. */ 11936 hw_val[0] = hw_val[1] = 0; 11937 cntrs64_buf = &stage_fc->_field_x64_counters[idx]; 11938 memacc_byte = 11939 &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_BYTE]); 11940 soc_memacc_field_get(memacc_byte, mem_x_buf, hw_val); 11941 _bcm_field_36bit_counter_update(unit, hw_val, cntrs64_buf); 11942 /* Return counter value to caller if (out) pointer was provided. */ 11943 if (NULL != byte_count) { 11944 COMPILER_64_OR((*byte_count), cntrs64_buf->accumulated_counter); 11945 } 11946 11947 /* Packet counter. */ 11948 cntrs32_buf = &stage_fc->_field_x32_counters[idx]; 11949 memacc_pkt = 11950 &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_PACKET]); 11951 soc_memacc_field_get(memacc_pkt, mem_x_buf, hw_val); 11952 _bcm_field_30bit_counter_update(unit, hw_val, cntrs32_buf); 11953 /* Return counter value to caller if (out) pointer was provided. */ 11954 if (NULL != packet_count) { 11955 COMPILER_64_OR((*packet_count), cntrs32_buf->accumulated_counter); 11956 } 11957 return (BCM_E_NONE); 11958 } 11959 11960 11961 STATIC int 11962 _field_tr3_external_tcam_write(int unit, _field_entry_t *f_ent, int index) 11963 { 11964 const unsigned slice_num = f_ent->fs->slice_number; 11965 _field_tcam_t * const tcam = &f_ent->tcam; 11966 11967 soc_mem_t tcam_data_mem, tcam_mask_mem; 11968 uint32 buf[SOC_MAX_MEM_FIELD_WORDS]; 11969 11970 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_data_mem(unit, 11971 slice_num, 11972 &tcam_data_mem 11973 ) 11974 ); 11975 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_mask_mem(unit, 11976 slice_num, 11977 &tcam_mask_mem 11978 ) 11979 ); 11980 11981 if (tcam_mask_mem == INVALIDm) { 11982 sal_memset(buf, 0, sizeof(buf)); 11983 soc_mem_field_set(unit, tcam_data_mem, buf, DATAf, tcam->key_hw); 11984 soc_mem_mask_field_set(unit, tcam_data_mem, buf, MASKf, tcam->mask_hw); 11985 return (soc_mem_write(unit, tcam_data_mem, MEM_BLOCK_ALL, index, buf)); 11986 } 11987 11988 sal_memset(buf, 0, sizeof(buf)); 11989 soc_mem_mask_field_set(unit, tcam_mask_mem, buf, MASKf, tcam->mask_hw); 11990 BCM_IF_ERROR_RETURN(soc_mem_write(unit, 11991 tcam_mask_mem, 11992 MEM_BLOCK_ALL, 11993 0, 11994 buf 11995 ) 11996 ); 11997 11998 sal_memset(buf, 0, sizeof(buf)); 11999 soc_mem_field_set(unit, tcam_data_mem, buf, DATAf, tcam->key_hw); 12000 return (soc_mem_write(unit, tcam_data_mem, MEM_BLOCK_ALL, index, buf)); 12001 } 12002 12003 12004 /* Translate an IFP policy table word into non-profiled fields of EXTFP policy. 12005 N.B. The order of table entries is important; it is the order of bits in 12006 ESM_ACL_ACTION_CONTROL word, from LSB to MSB. 12007 */ 12008 12009 static const struct _field_tr3_external_non_profiled_policy_fld { 12010 soc_field_t esm_acl_action_control_fld; 12011 uint8 bit_num; 12012 soc_mem_t policy_mem; 12013 soc_field_t policy_fld; 12014 uint8 skip_bits; 12015 } _field_tr3_external_non_profiled_policy_fld_tbl[] = { 12016 { MISC1_SET_ENABLEf, 0, FP_POLICY_TABLEm, DO_NOT_GENERATE_CNMf }, 12017 { MISC1_SET_ENABLEf, 1, FP_POLICY_TABLEm, DO_NOT_CHANGE_TTLf }, 12018 { MISC1_SET_ENABLEf, 2, FP_POLICY_TABLEm, DO_NOT_URPFf }, 12019 { MISC1_SET_ENABLEf, 3, FP_POLICY_TABLEm, HGT_DLB_DISABLEf }, 12020 { MISC1_SET_ENABLEf, 4, FP_POLICY_TABLEm, LAG_DLB_DISABLEf }, 12021 { MISC1_SET_ENABLEf, 5, FP_POLICY_TABLEm, ECMP_DLB_DISABLEf }, 12022 { MISC1_SET_ENABLEf, 6, FP_POLICY_TABLEm, GREEN_TO_PIDf }, 12023 { MISC1_SET_ENABLEf, 7, FP_POLICY_TABLEm, MIRROR_OVERRIDEf }, 12024 { MISC2_SET_ENABLEf, 0, FP_POLICY_TABLEm, IPFIX_CONTROLf }, 12025 { MISC2_SET_ENABLEf, 1, FP_POLICY_TABLEm, R_DROP_PRECEDENCEf }, 12026 { MISC2_SET_ENABLEf, 2, FP_POLICY_TABLEm, Y_DROP_PRECEDENCEf }, 12027 { MISC2_SET_ENABLEf, 3, FP_POLICY_TABLEm, G_DROP_PRECEDENCEf }, 12028 { MISC2_SET_ENABLEf, 4, FP_POLICY_TABLEm, R_DROPf }, 12029 { MISC2_SET_ENABLEf, 5, FP_POLICY_TABLEm, Y_DROPf }, 12030 { MISC2_SET_ENABLEf, 6, FP_POLICY_TABLEm, G_DROPf }, 12031 { GOA_SET_ENABLEf, 0, FP_POLICY_TABLEm, HI_PRI_SUPPRESS_VXLTf }, 12032 { GOA_SET_ENABLEf, 0, FP_POLICY_TABLEm, SUPPRESS_SW_ACTIONSf }, 12033 { GOA_SET_ENABLEf, 0, FP_POLICY_TABLEm, DEFER_QOS_MARKINGSf }, 12034 { GOA_SET_ENABLEf, 0, FP_POLICY_TABLEm, SUPPRESS_COLOR_SENSITIVE_ACTIONSf }, 12035 { GOA_SET_ENABLEf, 0, FP_POLICY_TABLEm, SPLIT_DROP_RESOLVEf }, 12036 { GOA_SET_ENABLEf, 0, FP_POLICY_TABLEm, HI_PRI_RESOLVEf }, 12037 { GOA_SET_ENABLEf, 0, FP_POLICY_TABLEm, HI_PRI_ACTION_CONTROLf }, 12038 { CPU_COS_SET_ENABLEf, 0, FP_POLICY_TABLEm, CPU_COSf }, 12039 { CPU_COS_SET_ENABLEf, 0, FP_POLICY_TABLEm, CHANGE_CPU_COSf }, 12040 { MIRROR_SET_ENABLEf, 0, FP_POLICY_TABLEm, MTP_INDEX0f }, 12041 { MIRROR_SET_ENABLEf, 0, FP_POLICY_TABLEm, MTP_INDEX1f }, 12042 { MIRROR_SET_ENABLEf, 0, FP_POLICY_TABLEm, MTP_INDEX2f }, 12043 { MIRROR_SET_ENABLEf, 0, FP_POLICY_TABLEm, MTP_INDEX3f }, 12044 { MIRROR_SET_ENABLEf, 0, FP_POLICY_TABLEm, MIRRORf }, 12045 { COPY_TO_CPU_SET_ENABLEf, 0, FP_POLICY_TABLEm, R_COPY_TO_CPUf }, 12046 { COPY_TO_CPU_SET_ENABLEf, 0, FP_POLICY_TABLEm, Y_COPY_TO_CPUf }, 12047 { COPY_TO_CPU_SET_ENABLEf, 0, FP_POLICY_TABLEm, G_COPY_TO_CPUf }, 12048 { COPY_TO_CPU_SET_ENABLEf, 0, FP_POLICY_TABLEm, MATCHED_RULEf }, 12049 { COPY_TO_CPU_SET_ENABLEf, 0, FP_POLICY_TABLEm, COPY_TO_PASSTHRU_NLFf }, 12050 { SHARED_METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, METER_SHARING_MODE_MODIFIERf }, 12051 { SHARED_METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, METER_SHARING_MODEf }, 12052 { SHARED_METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, SHARED_METER_PAIR_MODEf }, 12053 { SHARED_METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, SHARED_METER_PAIR_POOL_INDEXf, 1 }, 12054 { SHARED_METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, SHARED_METER_PAIR_POOL_NUMBERf, 1 }, 12055 { METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, METER_PAIR_MODE_MODIFIERf }, 12056 { METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, METER_PAIR_MODEf }, 12057 { METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, METER_PAIR_POOL_INDEXf, 1 }, 12058 { METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, METER_PAIR_POOL_NUMBERf, 1 }, 12059 { METER_SET_ENABLEf, 0, FP_POLICY_TABLEm, USE_SVC_METER_COLORf }, 12060 { SVC_METER_SET_ENABLEf, 0, VFP_POLICY_TABLEm, SVC_METER_INDEXf }, 12061 { SVC_METER_SET_ENABLEf, 0, VFP_POLICY_TABLEm, SVC_METER_OFFSET_MODEf }, 12062 { L3SW_L2_FIELDS_SET_ENABLEf, 0, FP_POLICY_TABLEm, ECMP_NH_INFOf }, 12063 { L3SW_L2_FIELDS_SET_ENABLEf, 0, FP_POLICY_TABLEm, G_L3SW_CHANGE_L2_FIELDSf }, 12064 { REDIRECT_SET_ENABLEf, 0, FP_POLICY_TABLEm, G_PACKET_REDIRECTIONf }, 12065 { REDIRECT_SET_ENABLEf, 0, FP_POLICY_TABLEm, REDIRECT_NHIf }, 12066 { REDIRECT_SET_ENABLEf, 0, FP_POLICY_TABLEm, UNICAST_REDIRECT_CONTROLf }, 12067 { COUNTER_SET_ENABLEf, 0, VFP_POLICY_TABLEm, FLEX_CTR_BASE_COUNTER_IDXf }, 12068 { COUNTER_SET_ENABLEf, 0, VFP_POLICY_TABLEm, FLEX_CTR_POOL_NUMBERf }, 12069 { COUNTER_SET_ENABLEf, 0, VFP_POLICY_TABLEm, FLEX_CTR_OFFSET_MODEf, 1 }, 12070 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_TUNNEL_CONTROLf }, 12071 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_TAG_STATUS_CHECK_CONTROLf }, 12072 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_ENABLE_LM_DM_SAMPLEf }, 12073 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_UP_MEPf }, 12074 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_TXf }, 12075 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_LMEP_MDLf }, 12076 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_SERVICE_PRI_MAPPING_PTRf }, 12077 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_LM_BASE_PTRf }, 12078 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_DM_TYPEf }, 12079 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_DM_ENf }, 12080 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_LM_ENf }, 12081 { OAM_SET_ENABLEf, 0, FP_POLICY_TABLEm, OAM_LMEP_ENf } 12082 }; 12083 12084 STATIC int 12085 _field_tr3_exteral_non_profiled_policy( 12086 int unit, 12087 _field_entry_t *f_ent, 12088 uint32 *fp_policy_table_entry_data, 12089 uint32 *vfp_policy_table_entry_data, 12090 ext_fp_policy_6x_entry_t *ext_fp_policy_buf, 12091 soc_mem_t ext_policy_mem 12092 ) 12093 { 12094 const unsigned slice_num = f_ent->fs->slice_number; 12095 12096 esm_acl_action_control_entry_t esm_acl_action_control_buf; 12097 uint32 non_profiled_actions_buf[COUNTOF(ext_fp_policy_buf->entry_data)]; 12098 unsigned ofs, n; 12099 const struct _field_tr3_external_non_profiled_policy_fld *p; 12100 12101 /* Check bits in ESM_ACL_ACTION_CONTROL word, and for each set enabled, copy 12102 the corresponding field(s) from the VFP or IFP policy word into the external 12103 non-profiled actions 12104 */ 12105 12106 sal_memset(non_profiled_actions_buf, 0, sizeof(non_profiled_actions_buf)); 12107 ofs = 0; 12108 12109 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 12110 ESM_ACL_ACTION_CONTROLm, 12111 MEM_BLOCK_ANY, 12112 slice_num, 12113 esm_acl_action_control_buf.entry_data 12114 ) 12115 ); 12116 12117 for (p = _field_tr3_external_non_profiled_policy_fld_tbl, 12118 n = COUNTOF(_field_tr3_external_non_profiled_policy_fld_tbl); 12119 n; 12120 --n, ++p 12121 ) { 12122 if (soc_mem_field32_get(unit, 12123 ESM_ACL_ACTION_CONTROLm, 12124 esm_acl_action_control_buf.entry_data, 12125 p->esm_acl_action_control_fld 12126 ) 12127 & BIT(p->bit_num) 12128 ) { 12129 unsigned w; 12130 SHR_BITDCL val; 12131 12132 w = soc_mem_field_length(unit, 12133 p->policy_mem, 12134 p->policy_fld 12135 ); 12136 val = soc_mem_field32_get(unit, 12137 p->policy_mem, 12138 p->policy_mem == FP_POLICY_TABLEm 12139 ? fp_policy_table_entry_data 12140 : vfp_policy_table_entry_data, 12141 p->policy_fld 12142 ); 12143 12144 SHR_BITCOPY_RANGE(non_profiled_actions_buf, ofs, &val, 0, w); 12145 ofs += w + p->skip_bits; 12146 } 12147 } 12148 12149 soc_mem_field_set(unit, 12150 ext_policy_mem, 12151 ext_fp_policy_buf->entry_data, 12152 NON_PROFILED_ACTIONSf, 12153 non_profiled_actions_buf 12154 ); 12155 12156 return (BCM_E_NONE); 12157 } 12158 12159 12160 /* Translate an IFP policy table word into profiled fields of EXTFP policy. 12161 N.B. The order of fields is important -- it is the order of fields in the 12162 ESM_ACL_PROFILE word, from LSB to MSB. 12163 */ 12164 12165 static const soc_field_t _field_tr3_external_profiled_policy_fld_tbl[] = { 12166 R_NEW_ECNf, 12167 Y_NEW_ECNf, 12168 G_NEW_ECNf, 12169 R_CHANGE_ECNf, 12170 Y_CHANGE_ECNf, 12171 G_CHANGE_ECNf, 12172 R_NEW_PKT_PRIf, 12173 Y_NEW_PKT_PRIf, 12174 G_NEW_PKT_PRIf, 12175 R_CHANGE_PKT_PRIf, 12176 Y_CHANGE_PKT_PRIf, 12177 G_CHANGE_PKT_PRIf, 12178 R_NEW_DSCPf, 12179 Y_NEW_DSCPf, 12180 G_NEW_DSCP_TOSf, 12181 R_CHANGE_DSCPf, 12182 Y_CHANGE_DSCPf, 12183 G_CHANGE_DSCP_TOSf, 12184 R_COS_INT_PRIf, 12185 Y_COS_INT_PRIf, 12186 G_COS_INT_PRIf, 12187 R_CHANGE_COS_OR_INT_PRIf, 12188 Y_CHANGE_COS_OR_INT_PRIf, 12189 G_CHANGE_COS_OR_INT_PRIf 12190 }; 12191 12192 STATIC int 12193 _field_tr3_exteral_profiled_policy( 12194 int unit, 12195 _field_entry_t *f_ent, 12196 fp_policy_table_entry_t *fp_policy_table_buf, 12197 esm_acl_profile_entry_t *esm_acl_profile_buf 12198 ) 12199 { 12200 uint32 profiled_actions_buf[COUNTOF(esm_acl_profile_buf->entry_data)]; 12201 unsigned ofs, n; 12202 const soc_field_t *p; 12203 12204 /* Copy profiled actions from IFP policy word */ 12205 12206 sal_memset(profiled_actions_buf, 0, sizeof(profiled_actions_buf)); 12207 ofs = 0; 12208 12209 for (p = _field_tr3_external_profiled_policy_fld_tbl, 12210 n = COUNTOF(_field_tr3_external_profiled_policy_fld_tbl); 12211 n; 12212 --n, ++p 12213 ) { 12214 unsigned w = soc_mem_field_length(unit, FP_POLICY_TABLEm, *p); 12215 SHR_BITDCL val = soc_mem_field32_get(unit, 12216 FP_POLICY_TABLEm, 12217 fp_policy_table_buf->entry_data, 12218 *p 12219 ); 12220 12221 SHR_BITCOPY_RANGE(profiled_actions_buf, ofs, &val, 0, w); 12222 ofs += w; 12223 } 12224 12225 soc_mem_field_set(unit, 12226 ESM_ACL_PROFILEm, 12227 esm_acl_profile_buf->entry_data, 12228 ACTIONSf, 12229 profiled_actions_buf 12230 ); 12231 12232 return (BCM_E_NONE); 12233 } 12234 12235 /* Set fields that control flex counters in fake VFP policy table entry. 12236 Copied from _field_tcam_policy_install(). 12237 */ 12238 12239 STATIC int 12240 _field_tr3_external_policy_counters(int unit, 12241 _field_entry_t *f_ent, 12242 uint32 *vfp_policy_table_entry_data, 12243 bcm_stat_flex_mode_t *offset_mode, 12244 uint32 *pool_number, 12245 uint32 *base_index 12246 ) 12247 { 12248 bcm_stat_object_t object = bcmStatObjectIngPort; 12249 bcm_stat_group_mode_t group_mode = bcmStatGroupModeSingle; 12250 _field_stat_t *f_st = NULL; 12251 _field_entry_stat_t *f_ent_st = NULL; 12252 12253 f_ent_st = &f_ent->statistic; 12254 if (_bcm_field_stat_get(unit, f_ent_st->sid, &f_st) == BCM_E_NONE 12255 && f_st->flex_mode != 0 12256 ) { 12257 _bcm_esw_stat_get_counter_id_info(unit, f_st->flex_mode, 12258 &group_mode, 12259 &object, 12260 offset_mode, 12261 pool_number, 12262 base_index 12263 ); 12264 BCM_IF_ERROR_RETURN(_bcm_esw_set_flex_counter_fields_values( 12265 unit,0, 12266 VFP_POLICY_TABLEm, 12267 vfp_policy_table_entry_data, 12268 0, 12269 *offset_mode, 12270 *pool_number, 12271 *base_index 12272 ) 12273 ); 12274 } 12275 12276 return (BCM_E_NONE); 12277 } 12278 12279 /* Set fields that control service meters in fake VFP policy table entry. 12280 Copied from _bcm_field_tr_entry_install(). 12281 */ 12282 12283 STATIC int 12284 _field_tr3_external_policy_meters(int unit, 12285 _field_entry_t *f_ent, 12286 uint32 *vfp_policy_table_entry_data 12287 ) 12288 { 12289 int offset_mode = 0; 12290 int index = 0; 12291 12292 if (f_ent->global_meter_policer.pid > 0) { 12293 offset_mode = ((f_ent->global_meter_policer.pid & BCM_POLICER_GLOBAL_METER_MODE_MASK) 12294 >> BCM_POLICER_GLOBAL_METER_MODE_SHIFT 12295 ); 12296 if (offset_mode >= 1) { 12297 offset_mode = offset_mode - 1; 12298 } 12299 soc_mem_field32_set(unit, 12300 VFP_POLICY_TABLEm, 12301 vfp_policy_table_entry_data, 12302 SVC_METER_OFFSET_MODEf, 12303 offset_mode 12304 ); 12305 12306 _bcm_esw_get_policer_table_index(unit, 12307 f_ent->global_meter_policer.pid, 12308 &index 12309 ); 12310 soc_mem_field32_set(unit, 12311 VFP_POLICY_TABLEm, 12312 vfp_policy_table_entry_data, 12313 SVC_METER_INDEXf, 12314 index 12315 ); 12316 } 12317 12318 return (BCM_E_NONE); 12319 } 12320 12321 12322 /* 12323 * Function: 12324 * _bcm_esw_tr3_ext_stat_flex_detach_ingress_table_counters 12325 * Purpose: 12326 * Detach i.e. Update Ingress accounting table's statistics 12327 * Parameters: 12328 * unit - (IN) unit 12329 * f_ent - (IN) Field entry 12330 * Returns: 12331 * BCM_E_NONE - Success 12332 * Notes: 12333 */ 12334 int 12335 _bcm_esw_tr3_ext_stat_flex_detach_ingress_table_counters(int unit, 12336 _field_entry_t *f_ent) 12337 { 12338 bcm_stat_object_t object = bcmStatObjectIngPort; 12339 bcm_stat_group_mode_t group_mode = bcmStatGroupModeSingle; 12340 bcm_stat_flex_mode_t offset_mode; 12341 uint32 pool_number; 12342 uint32 base_index; 12343 int rv = BCM_E_NONE; 12344 _field_stat_t *f_st = NULL; 12345 _field_entry_stat_t *f_ent_st = NULL; 12346 12347 f_ent_st = &f_ent->statistic; 12348 if (_bcm_field_stat_get(unit, f_ent_st->sid, &f_st) == BCM_E_NONE 12349 && f_st->flex_mode != 0 12350 ) { 12351 12352 _bcm_esw_stat_get_counter_id_info(unit, f_st->flex_mode, 12353 &group_mode, 12354 &object, 12355 &offset_mode, 12356 &pool_number, 12357 &base_index 12358 ); 12359 rv = _bcm_esw_stat_flex_detach_ingress_table_counters_update( 12360 unit, pool_number, base_index, offset_mode); 12361 BCM_IF_ERROR_RETURN(rv); 12362 } 12363 return (BCM_E_NONE); 12364 } 12365 12366 /* Policy install for external stage 12367 The general idea is to compose a policy table entry as for another stage 12368 (lookup or ingress), and the translate that into the non-profiled and 12369 profiled portions for the external stage. 12370 (This can be done because the EXTFP policy table is a subset of the VFP [flex 12371 counters and service meters] and IFP policy tables [everything else], with 12372 policy table fields encoded the same way). 12373 */ 12374 12375 STATIC int 12376 _field_tr3_external_policy_install(int unit, 12377 _field_stage_t *stage_fc, 12378 _field_entry_t *f_ent 12379 ) 12380 { 12381 const unsigned slice_num = f_ent->fs->slice_number; 12382 12383 soc_mem_t ext_policy_mem; 12384 fp_policy_table_entry_t fp_policy_table_buf; 12385 vfp_policy_table_entry_t vfp_policy_table_buf; 12386 ext_fp_policy_6x_entry_t ext_fp_policy_buf; 12387 esm_acl_profile_entry_t esm_acl_profile_buf; 12388 uint32 ext_act_profile_index; 12389 _field_action_t *fa; 12390 void *entries[1]; 12391 _field_stat_t *f_st; 12392 bcm_stat_flex_mode_t offset_mode; 12393 uint32 pool_number; 12394 uint32 base_index; 12395 12396 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_mem(unit, 12397 slice_num, 12398 &ext_policy_mem 12399 ) 12400 ); 12401 12402 sal_memset(ext_fp_policy_buf.entry_data, 12403 0, 12404 sizeof(ext_fp_policy_buf.entry_data) 12405 ); 12406 sal_memset(esm_acl_profile_buf.entry_data, 12407 0, 12408 sizeof(esm_acl_profile_buf.entry_data) 12409 ); 12410 12411 /* For all actions, compose the policy entry as for IFP */ 12412 12413 sal_memset(fp_policy_table_buf.entry_data, 12414 0, 12415 sizeof(fp_policy_table_buf.entry_data) 12416 ); 12417 12418 for (fa = f_ent->actions; fa != NULL; fa = fa->next) { 12419 12420 /* skip invalid actions. */ 12421 if (!(_FP_ACTION_VALID & fa->flags)) { 12422 continue; 12423 } 12424 12425 BCM_IF_ERROR_RETURN(_bcm_field_trx_action_get( 12426 unit, 12427 FP_POLICY_TABLEm, 12428 f_ent, 12429 f_ent->slice_idx, 12430 fa, 12431 fp_policy_table_buf.entry_data 12432 ) 12433 ); 12434 } 12435 12436 if (f_ent->flags & _FP_ENTRY_COLOR_INDEPENDENT) { 12437 soc_mem_field32_set(unit, 12438 FP_POLICY_TABLEm, 12439 fp_policy_table_buf.entry_data, 12440 GREEN_TO_PIDf, 12441 1 12442 ); 12443 } 12444 12445 /* Compose a VFP policy table entry for flex counters and service meters */ 12446 12447 sal_memset(vfp_policy_table_buf.entry_data, 12448 0, 12449 sizeof(vfp_policy_table_buf.entry_data) 12450 ); 12451 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_counters( 12452 unit, 12453 f_ent, 12454 vfp_policy_table_buf.entry_data, 12455 &offset_mode, 12456 &pool_number, 12457 &base_index 12458 ) 12459 ); 12460 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_meters( 12461 unit, 12462 f_ent, 12463 vfp_policy_table_buf.entry_data 12464 ) 12465 ); 12466 12467 /* Extract non-profiled external fields from IFP and VFP policy entries */ 12468 12469 BCM_IF_ERROR_RETURN(_field_tr3_exteral_non_profiled_policy( 12470 unit, 12471 f_ent, 12472 fp_policy_table_buf.entry_data, 12473 vfp_policy_table_buf.entry_data, 12474 &ext_fp_policy_buf, 12475 ext_policy_mem)); 12476 12477 if (f_ent->statistic.flags & _FP_ENTRY_STAT_INSTALLED) { 12478 BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, f_ent->statistic.sid, &f_st)); 12479 f_st->hw_index = f_ent->slice_idx; 12480 f_st->pool_index = f_ent->fs->slice_number; 12481 12482 BCM_IF_ERROR_RETURN 12483 (_bcm_esw_stat_flex_attach_ingress_table_counters_update( 12484 unit, pool_number, 0, 12485 base_index, offset_mode)); 12486 } 12487 12488 soc_mem_field32_set(unit, 12489 ext_policy_mem, 12490 ext_fp_policy_buf.entry_data, 12491 POLICY_TABLE_IDf, 12492 slice_num 12493 ); 12494 12495 /* Extract profiled external field from IFP policy */ 12496 12497 BCM_IF_ERROR_RETURN(_field_tr3_exteral_profiled_policy( 12498 unit, 12499 f_ent, 12500 &fp_policy_table_buf, 12501 &esm_acl_profile_buf 12502 ) 12503 ); 12504 entries[0] = esm_acl_profile_buf.entry_data; 12505 BCM_IF_ERROR_RETURN (soc_profile_mem_add(unit, 12506 &stage_fc->ext_act_profile, 12507 entries, 12508 1, 12509 &ext_act_profile_index) 12510 ); 12511 f_ent->ext_act_profile_idx = ext_act_profile_index; 12512 12513 soc_mem_field32_set(unit, 12514 ext_policy_mem, 12515 ext_fp_policy_buf.entry_data, 12516 PROFILE_IDf, 12517 ext_act_profile_index 12518 ); 12519 12520 /* Write into the Table */ 12521 return (soc_mem_write(unit, 12522 ext_policy_mem, 12523 MEM_BLOCK_ALL, 12524 f_ent->slice_idx, 12525 ext_fp_policy_buf.entry_data 12526 ) 12527 ); 12528 } 12529 12530 12531 /* 12532 * Function: 12533 * _bcm_field_tr3_external_hw_entry_clear 12534 * Purpose: 12535 * Clears an ACL h/w entry 12536 * Parameters: 12537 * unit - (IN) unit 12538 * slice - (IN) slice having the index to be cleared 12539 * index - (IN) index to be cleared 12540 * Returns: 12541 * BCM_E_NONE - Success 12542 * BCM_E_XXX 12543 */ 12544 int 12545 _bcm_field_tr3_external_hw_entry_clear(int unit, int slice, int index) 12546 { 12547 soc_mem_t tcam_data_mem, tcam_mask_mem, policy_mem; 12548 uint32 buf[SOC_MAX_MEM_FIELD_WORDS]; 12549 int rv = BCM_E_NONE; 12550 12551 sal_memset(buf, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 12552 12553 /* Get Policy mem, data mem and mask mem */ 12554 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_mem(unit, slice, 12555 &policy_mem)); 12556 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_data_mem(unit, slice, 12557 &tcam_data_mem)); 12558 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_mask_mem(unit, slice, 12559 &tcam_mask_mem)); 12560 12561 rv = soc_mem_write(unit, tcam_data_mem, MEM_BLOCK_ALL, index, buf); 12562 BCM_IF_ERROR_RETURN(rv); 12563 12564 if (tcam_mask_mem != INVALIDm) { 12565 /* For all valid tcam mask mems, only index 0 is valid */ 12566 rv = soc_mem_write(unit, tcam_mask_mem, MEM_BLOCK_ALL, 0, buf); 12567 BCM_IF_ERROR_RETURN(rv); 12568 } 12569 12570 if (policy_mem != INVALIDm) { 12571 rv = soc_mem_write(unit, policy_mem, MEM_BLOCK_ALL, index, buf); 12572 BCM_IF_ERROR_RETURN(rv); 12573 } 12574 12575 return (rv); 12576 } 12577 12578 12579 /* 12580 * Function: 12581 * _bcm_field_tr3_external_entry_move 12582 * Purpose: 12583 * Moves an external entry 12584 * Parameters: 12585 * unit - (IN) unit 12586 * f_ent - (IN) Field entry to be moved 12587 * index1 - (IN) original index 12588 * index2 - (IN) destination index 12589 * Returns: 12590 * BCM_E_NONE - Success 12591 * Notes: 12592 * It is the calling function's responsibility to 12593 * update the prio_mgmt structure. 12594 */ 12595 int 12596 _bcm_field_tr3_external_entry_move(int unit, _field_entry_t *f_ent, 12597 int index1, int index2) 12598 { 12599 _field_stage_t *stage_fc; /* Stage information */ 12600 uint32 policy[SOC_MAX_MEM_FIELD_WORDS]; /* policy info */ 12601 soc_mem_t policy_mem; /* policy table memory */ 12602 int rv; /* Operation return status */ 12603 12604 /* Check if entry move is required. */ 12605 if (index1 == index2) { 12606 return (BCM_E_NONE); 12607 } 12608 12609 if (f_ent == NULL ) { 12610 return (BCM_E_NONE); 12611 } 12612 12613 rv = _field_stage_control_get(unit, f_ent->fs->stage_id, &stage_fc); 12614 BCM_IF_ERROR_RETURN(rv); 12615 12616 /* Clear TCAM at index2 */ 12617 _bcm_field_tr3_external_hw_entry_clear(unit, 12618 f_ent->fs->slice_number, index2); 12619 12620 /* Get Policy mem */ 12621 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_mem(unit, 12622 f_ent->fs->slice_number, &policy_mem)); 12623 12624 /* Read EXT_FP_POLICY from index1 */ 12625 rv = soc_mem_read(unit, policy_mem, MEM_BLOCK_ANY, index1, policy); 12626 BCM_IF_ERROR_RETURN(rv); 12627 12628 /* Write EXT_FP_POLICY to index2 */ 12629 rv = soc_mem_write(unit, policy_mem, MEM_BLOCK_ALL, index2, policy); 12630 BCM_IF_ERROR_RETURN(rv); 12631 12632 rv = _field_tr3_external_tcam_write(unit, f_ent, index2); 12633 BCM_IF_ERROR_RETURN(rv); 12634 12635 /* Clear TCAM at index1 */ 12636 _bcm_field_tr3_external_hw_entry_clear(unit, 12637 f_ent->fs->slice_number, index1); 12638 12639 /* Update the software */ 12640 f_ent->fs->entries[index1] = NULL; 12641 f_ent->slice_idx = index2; 12642 12643 f_ent->fs->entries[index2] = f_ent; 12644 12645 return (rv); 12646 } 12647 12648 12649 STATIC int 12650 _field_tr3_external_entry_clear(int unit, int slice, int index) 12651 { 12652 soc_mem_t ext_tcam_mem; 12653 12654 /* Clear TCAM entry valid bit */ 12655 12656 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_data_mem(unit, slice, &ext_tcam_mem)); 12657 return (soc_tr3_set_vbit(unit, ext_tcam_mem, index, 0)); 12658 } 12659 12660 STATIC int 12661 _field_tr3_external_entry_install(int unit, _field_entry_t *f_ent) 12662 { 12663 _field_stage_t *stage_fc; 12664 uint32 new_location; 12665 12666 BCM_IF_ERROR_RETURN 12667 (_field_stage_control_get(unit, f_ent->fs->stage_id, &stage_fc)); 12668 12669 BCM_IF_ERROR_RETURN(_bcm_field_entry_target_location(unit, 12670 stage_fc, f_ent, f_ent->prio, &new_location)); 12671 12672 f_ent->slice_idx = new_location; 12673 f_ent->fs->entries[new_location] = f_ent; 12674 12675 BCM_IF_ERROR_RETURN 12676 (_bcm_field_entry_prio_mgmt_update(unit, f_ent, 1, 0)); 12677 12678 /* Write EXT_FP_POLICY */ 12679 _field_tr3_external_policy_install(unit, stage_fc, f_ent); 12680 12681 /* Write TCAM */ 12682 _field_tr3_external_tcam_write(unit, f_ent, f_ent->slice_idx); 12683 12684 return (BCM_E_NONE); 12685 } 12686 12687 12688 STATIC int 12689 _field_tr3_external_entry_reinstall(int unit, _field_entry_t *f_ent) 12690 { 12691 soc_profile_mem_t ext_act_profile; 12692 _field_stage_t *stage_fc; 12693 uint32 ext_act_profile_index = 0; 12694 12695 BCM_IF_ERROR_RETURN 12696 (_field_stage_control_get(unit, f_ent->fs->stage_id, &stage_fc)); 12697 12698 /* Store the existing profile index so that it can be cleared later. 12699 When reinstall API is called, it is assumed that the priority is not 12700 changed. When priority is modified, then a separate API is used since 12701 change in priority will affect the ordering in TCAM. This API should 12702 modify only the policy table and not the TCAM table 12703 */ 12704 12705 ext_act_profile = stage_fc->ext_act_profile; 12706 ext_act_profile_index = f_ent->ext_act_profile_idx; 12707 12708 /* Write EXT_FP_POLICY */ 12709 BCM_IF_ERROR_RETURN 12710 (_field_tr3_external_policy_install(unit, stage_fc, f_ent)); 12711 12712 BCM_IF_ERROR_RETURN 12713 (soc_profile_mem_delete(unit, &ext_act_profile, ext_act_profile_index)); 12714 12715 return (BCM_E_NONE); 12716 } 12717 12718 12719 12720 STATIC int 12721 _field_tr3_external_entry_remove(int unit, _field_entry_t *f_ent) 12722 { 12723 _field_stage_t *stage_fc; 12724 soc_mem_t ext_policy_mem; 12725 ext_fp_policy_6x_entry_t ext_fp_policy_buf; 12726 12727 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_mem(unit, 12728 f_ent->fs->slice_number, 12729 &ext_policy_mem 12730 ) 12731 ); 12732 SOC_IF_ERROR_RETURN(soc_mem_read(unit, 12733 ext_policy_mem, 12734 MEM_BLOCK_ANY, 12735 f_ent->slice_idx, 12736 ext_fp_policy_buf.entry_data 12737 ) 12738 ); 12739 12740 /* Release the PROFILE_PTR for EXT_IFP_ACTION_PROFILEm */ 12741 BCM_IF_ERROR_RETURN(_field_stage_control_get(unit, 12742 f_ent->fs->stage_id, 12743 &stage_fc 12744 ) 12745 ); 12746 BCM_IF_ERROR_RETURN(soc_profile_mem_delete( 12747 unit, 12748 &stage_fc->ext_act_profile, 12749 soc_mem_field32_get( 12750 unit, 12751 ext_policy_mem, 12752 ext_fp_policy_buf.entry_data, 12753 PROFILE_IDf 12754 ) 12755 ) 12756 ); 12757 12758 /* Clear the H/W entry */ 12759 _field_tr3_external_entry_clear(unit, 12760 f_ent->fs->slice_number, 12761 f_ent->slice_idx 12762 ); 12763 12764 /* Clear the H/W replica */ 12765 sal_memset(f_ent->tcam.key_hw, 0, f_ent->tcam.key_size); 12766 sal_memset(f_ent->tcam.mask_hw, 0, f_ent->tcam.key_size); 12767 12768 f_ent->fs->entries[f_ent->slice_idx] = NULL; 12769 12770 BCM_IF_ERROR_RETURN 12771 (_bcm_field_entry_prio_mgmt_update(unit, f_ent, -1, f_ent->slice_idx)); 12772 12773 return (BCM_E_NONE); 12774 } 12775 12776 12777 /* 12778 * Function: 12779 * _field_tr3_functions_init 12780 * 12781 * Purpose: 12782 * Set up functions pointers 12783 * 12784 * Parameters: 12785 * stage_fc - (IN/OUT) pointers to stage control block whe the device 12786 * and stage specific functions will be registered. 12787 * 12788 * Returns: 12789 * nothing 12790 * Notes: 12791 */ 12792 STATIC void 12793 _field_tr3_functions_init(_field_funct_t *functions) 12794 { 12795 functions->fp_detach = _bcm_field_tr_detach; 12796 functions->fp_group_install = _field_tr3_group_install; 12797 functions->fp_selcodes_install = _field_tr3_selcodes_install; 12798 functions->fp_slice_clear = _field_tr3_slice_clear; 12799 functions->fp_entry_remove = _bcm_field_fb_entry_remove; 12800 functions->fp_entry_move = _bcm_field_fb_entry_move; 12801 functions->fp_selcode_get = _field_tr3_selcode_get; 12802 functions->fp_selcode_to_qset = _bcm_field_selcode_to_qset; 12803 functions->fp_qual_list_get = _bcm_field_qual_lists_get; 12804 functions->fp_tcam_policy_clear = NULL; 12805 functions->fp_tcam_policy_install = _bcm_field_tr_entry_install; 12806 functions->fp_tcam_policy_reinstall = _bcm_field_tr_entry_reinstall; 12807 functions->fp_policer_install = _bcm_field_trx_policer_install; 12808 functions->fp_write_slice_map = _bcm_field_tr3_write_slice_map; 12809 functions->fp_qualify_ip_type = _bcm_field_trx_qualify_ip_type; 12810 functions->fp_qualify_ip_type_get = _bcm_field_trx_qualify_ip_type_get; 12811 functions->fp_action_support_check = _field_tr3_action_support_check; 12812 functions->fp_action_conflict_check = _bcm_field_trx_action_conflict_check; 12813 functions->fp_counter_get = _field_tr3_counter_get; 12814 functions->fp_counter_set = _field_tr3_counter_set; 12815 functions->fp_stat_index_get = _field_tr3_stat_index_get; 12816 functions->fp_action_params_check = _field_tr3_action_params_check; 12817 functions->fp_action_depends_check = NULL; 12818 functions->fp_egress_key_match_type_set = 12819 _field_tr3_egress_key_match_type_set; 12820 functions->fp_external_entry_install = _field_tr3_external_entry_install; 12821 functions->fp_external_entry_reinstall = _field_tr3_external_entry_reinstall; 12822 functions->fp_external_entry_remove = _field_tr3_external_entry_remove; 12823 functions->fp_external_entry_prio_set = _bcm_field_tr_external_entry_prio_set; 12824 functions->fp_data_qualifier_ethertype_add = 12825 _bcm_field_trx2_data_qualifier_ethertype_add; 12826 functions->fp_data_qualifier_ethertype_delete= 12827 _bcm_field_trx2_data_qualifier_ethertype_delete; 12828 functions->fp_data_qualifier_ip_protocol_add = 12829 _bcm_field_trx2_data_qualifier_ip_protocol_add; 12830 functions->fp_data_qualifier_ip_protocol_delete= 12831 _bcm_field_trx2_data_qualifier_ip_protocol_delete; 12832 functions->fp_data_qualifier_packet_format_add= 12833 _bcm_field_trx2_data_qualifier_packet_format_add; 12834 functions->fp_data_qualifier_packet_format_delete= 12835 _bcm_field_trx2_data_qualifier_packet_format_delete; 12836 functions->fp_stat_value_get = NULL; 12837 functions->fp_stat_value_set = NULL; 12838 functions->fp_control_set = _bcm_field_control_set; 12839 functions->fp_control_get = _bcm_field_control_get; 12840 functions->fp_stat_hw_mode_get = _bcm_field_stat_hw_mode_get; 12841 functions->fp_stat_hw_alloc = _bcm_field_stat_hw_alloc; 12842 functions->fp_stat_hw_free = _bcm_field_stat_hw_free; 12843 functions->fp_group_add = NULL; 12844 functions->fp_qualify_trunk = _bcm_field_qualify_trunk; 12845 functions->fp_qualify_trunk_get = _bcm_field_qualify_trunk_get; 12846 functions->fp_qualify_inports = _bcm_field_qualify_InPorts; 12847 functions->fp_entry_stat_extended_attach = NULL; 12848 functions->fp_entry_stat_extended_get = NULL; 12849 functions->fp_entry_stat_detach = _bcm_field_entry_stat_detach; 12850 functions->fp_class_size_get = NULL; 12851 functions->fp_qualify_packet_res = _bcm_field_tr3_qualify_PacketRes; 12852 functions->fp_qualify_packet_res_get = _bcm_field_tr3_qualify_PacketRes_get; 12853 } 12854 12855 int 12856 _bcm_field_tr3_meter_pool_info(int unit, 12857 _field_stage_t *stage_fc, 12858 int *num_pools, 12859 int *pairs_per_pool, 12860 uint16 *pool_size 12861 ) 12862 { 12863 switch (stage_fc->stage_id) { 12864 case _BCM_FIELD_STAGE_INGRESS: 12865 *num_pools = NUM_METER_POOLS_IFP; 12866 *pairs_per_pool = NUM_METER_PAIRS_PER_POOL_IFP; 12867 *pool_size = NUM_METER_PAIRS_PER_POOL_IFP * 2; 12868 12869 if (soc_feature(unit, soc_feature_field_stage_quarter_slice)) { 12870 *pairs_per_pool = NUM_METER_PAIRS_PER_POOL_IFP / 4; 12871 } else if (soc_feature(unit, soc_feature_field_stage_half_slice)) { 12872 *pairs_per_pool = NUM_METER_PAIRS_PER_POOL_IFP / 2; 12873 } 12874 12875 #if defined(INCLUDE_REGEX) 12876 /* If Regex supported, reserve the last meter pool for its use. */ 12877 if (soc_feature(unit, soc_feature_regex)) { 12878 *num_pools = NUM_METER_POOLS_IFP - 1; 12879 } 12880 #endif 12881 12882 #if defined(BCM_HELIX4_SUPPORT) 12883 if (SOC_IS_HELIX4(unit)) { 12884 *pool_size = (*pool_size) / 2; 12885 *pairs_per_pool = (*pairs_per_pool) / 2; 12886 } 12887 #endif 12888 break; 12889 default: 12890 *num_pools = *pairs_per_pool = 0; 12891 } 12892 12893 return (BCM_E_NONE); 12894 } 12895 12896 12897 /* 12898 * Function: 12899 * _bcm_field_tr3_logical_meter_pool_info 12900 * Purpose: 12901 * Get Logical Meter Pool Info 12902 * Parameters: 12903 * unit - (IN) BCM device number 12904 * stage_fc - (IN) Field Processor stage control structure. 12905 * num_logical_pools - (OUT) Number of logical pools. 12906 * pairs_per_logical_pool - (OUT) Number of meter pairs per logical pool. 12907 * logical_pool_size - (OUT) Logical Pool Size. 12908 * Returns: 12909 * BCM_E_NONE 12910 */ 12911 int 12912 _bcm_field_tr3_logical_meter_pool_info(int unit, 12913 _field_stage_t *stage_fc, 12914 int *num_logical_pools, 12915 int *pairs_per_logical_pool, 12916 uint16 *logical_pool_size 12917 ) 12918 { 12919 switch (stage_fc->stage_id) { 12920 case _BCM_FIELD_STAGE_INGRESS: 12921 *num_logical_pools = NUM_LOGICAL_METER_POOLS_IFP; 12922 *pairs_per_logical_pool = NUM_LOGICAL_METER_PAIRS_PER_POOL_IFP; 12923 *logical_pool_size = NUM_LOGICAL_METER_PAIRS_PER_POOL_IFP * 2; 12924 12925 if (soc_feature(unit, soc_feature_field_stage_quarter_slice)) { 12926 *pairs_per_logical_pool = NUM_LOGICAL_METER_PAIRS_PER_POOL_IFP / 4; 12927 } else if (soc_feature(unit, soc_feature_field_stage_half_slice)) { 12928 *pairs_per_logical_pool = NUM_LOGICAL_METER_PAIRS_PER_POOL_IFP / 2; 12929 } 12930 12931 #if defined(INCLUDE_REGEX) 12932 /* If Regex supported, reserve the last meter pool for its use. */ 12933 if (soc_feature(unit, soc_feature_regex)) { 12934 *num_logical_pools = NUM_LOGICAL_METER_POOLS_IFP - 2; 12935 } 12936 #endif 12937 12938 #if defined(BCM_HELIX4_SUPPORT) 12939 if (SOC_IS_HELIX4(unit)) { 12940 *logical_pool_size = (*logical_pool_size) / 2; 12941 *pairs_per_logical_pool = (*pairs_per_logical_pool) / 2; 12942 } 12943 #endif 12944 break; 12945 default: 12946 *num_logical_pools = *pairs_per_logical_pool = 0; 12947 } 12948 12949 return (BCM_E_NONE); 12950 } 12951 12952 int 12953 _bcm_field_tr3_cntr_pool_info(int unit, 12954 _field_stage_t *stage_fc, 12955 unsigned *num_pools, 12956 unsigned *pairs_per_pool 12957 ) 12958 { 12959 switch (stage_fc->stage_id) { 12960 case _BCM_FIELD_STAGE_INGRESS: 12961 12962 *num_pools = NUM_CNTR_POOLS_IFP; 12963 if (stage_fc->flags & _FP_STAGE_QUARTER_SLICE) { 12964 *pairs_per_pool = (NUM_CNTRS_PER_POOL_IFP >> 2); 12965 } else if (stage_fc->flags & _FP_STAGE_HALF_SLICE) { 12966 *pairs_per_pool = (NUM_CNTRS_PER_POOL_IFP >> 1); 12967 } else { 12968 *pairs_per_pool = NUM_CNTRS_PER_POOL_IFP; 12969 } 12970 #if defined(BCM_HELIX4_SUPPORT) 12971 if (SOC_IS_HELIX4(unit)) { 12972 *pairs_per_pool = (*pairs_per_pool) >> 1; 12973 } 12974 #endif 12975 break; 12976 default: 12977 *num_pools = *pairs_per_pool = 0; 12978 } 12979 12980 return (BCM_E_NONE); 12981 } 12982 12983 12984 /* 12985 * Function: 12986 * _bcm_field_tr3_external_ip_proto_init 12987 * Purpose: 12988 * Initialize the ESM_L3_PROTOCOL_FN table 12989 * Parameters: 12990 * unit - (IN) BCM device number 12991 * Returns: 12992 * BCM_E_XXX 12993 */ 12994 STATIC int 12995 _bcm_field_tr3_external_ip_proto_init(int unit) 12996 { 12997 int index_min, index_max, i, rv = BCM_E_NONE; 12998 esm_l3_protocol_fn_entry_t l3_proto_fn_entry; 12999 enum ip_proto_map_e { 13000 _IpProtoTcp = 1, 13001 _IpProtoUdp, 13002 _IpProtoIcmp, 13003 _IpProtoIgmp, 13004 _IpProtoIpv4, 13005 _IpProtoIpv6, 13006 _IpProtoMpls 13007 }; 13008 13009 if (SOC_WARM_BOOT(unit)) { 13010 return (rv); 13011 } 13012 13013 sal_memset(&l3_proto_fn_entry, 0, sizeof(esm_l3_protocol_fn_entry_t)); 13014 13015 /* IpProtocol used to index ESM_L3_PROTOCOL_FN table is mapped to 13016 ip_proto_map_t values. */ 13017 index_min = soc_mem_index_min(unit, ESM_L3_PROTOCOL_FNm); 13018 index_max = soc_mem_index_max(unit, ESM_L3_PROTOCOL_FNm); 13019 for (i = index_min; i <= index_max; i++) { 13020 switch (i) { 13021 case IP_PROTO_TCP: 13022 soc_mem_field32_set(unit, ESM_L3_PROTOCOL_FNm, 13023 &l3_proto_fn_entry, L3_PROTOCOL_FNf, 13024 _IpProtoTcp); 13025 BCM_IF_ERROR_RETURN(soc_mem_write(unit, ESM_L3_PROTOCOL_FNm, 13026 MEM_BLOCK_ALL, i, &l3_proto_fn_entry)); 13027 break; 13028 case IP_PROTO_UDP: 13029 soc_mem_field32_set(unit, ESM_L3_PROTOCOL_FNm, 13030 &l3_proto_fn_entry, L3_PROTOCOL_FNf, 13031 _IpProtoUdp); 13032 BCM_IF_ERROR_RETURN(soc_mem_write(unit, ESM_L3_PROTOCOL_FNm, 13033 MEM_BLOCK_ALL, i, &l3_proto_fn_entry)); 13034 break; 13035 case IP_PROTO_ICMP: 13036 soc_mem_field32_set(unit, ESM_L3_PROTOCOL_FNm, 13037 &l3_proto_fn_entry, L3_PROTOCOL_FNf, 13038 _IpProtoIcmp); 13039 BCM_IF_ERROR_RETURN(soc_mem_write(unit, ESM_L3_PROTOCOL_FNm, 13040 MEM_BLOCK_ALL, i, &l3_proto_fn_entry)); 13041 break; 13042 case IP_PROTO_IGMP: 13043 soc_mem_field32_set(unit, ESM_L3_PROTOCOL_FNm, 13044 &l3_proto_fn_entry, L3_PROTOCOL_FNf, 13045 _IpProtoIgmp); 13046 BCM_IF_ERROR_RETURN(soc_mem_write(unit, ESM_L3_PROTOCOL_FNm, 13047 MEM_BLOCK_ALL, i, &l3_proto_fn_entry)); 13048 break; 13049 case IP_PROTO_IPv4: 13050 soc_mem_field32_set(unit, ESM_L3_PROTOCOL_FNm, 13051 &l3_proto_fn_entry, L3_PROTOCOL_FNf, 13052 _IpProtoIpv4); 13053 BCM_IF_ERROR_RETURN(soc_mem_write(unit, ESM_L3_PROTOCOL_FNm, 13054 MEM_BLOCK_ALL, i, &l3_proto_fn_entry)); 13055 break; 13056 case IP_PROTO_IPv6: 13057 soc_mem_field32_set(unit, ESM_L3_PROTOCOL_FNm, 13058 &l3_proto_fn_entry, L3_PROTOCOL_FNf, 13059 _IpProtoIpv6); 13060 BCM_IF_ERROR_RETURN(soc_mem_write(unit, ESM_L3_PROTOCOL_FNm, 13061 MEM_BLOCK_ALL, i, &l3_proto_fn_entry)); 13062 break; 13063 case IP_PROTO_MPLS: 13064 soc_mem_field32_set(unit, ESM_L3_PROTOCOL_FNm, 13065 &l3_proto_fn_entry, L3_PROTOCOL_FNf, 13066 _IpProtoMpls); 13067 BCM_IF_ERROR_RETURN(soc_mem_write(unit, ESM_L3_PROTOCOL_FNm, 13068 MEM_BLOCK_ALL, i, &l3_proto_fn_entry)); 13069 break; 13070 default: 13071 soc_mem_field32_set(unit, ESM_L3_PROTOCOL_FNm, 13072 &l3_proto_fn_entry, L3_PROTOCOL_FNf, 0xf); 13073 BCM_IF_ERROR_RETURN(soc_mem_write(unit, ESM_L3_PROTOCOL_FNm, 13074 MEM_BLOCK_ALL, i, &l3_proto_fn_entry)); 13075 break; 13076 } 13077 } 13078 return (rv); 13079 } 13080 13081 13082 /* 13083 * Function: 13084 * _bcm_field_tr3_external_ip_proto_deinit 13085 * Purpose: 13086 * Reset the ESM_L3_PROTOCOL_FN table fields initilized by corresponding 13087 * init function 13088 * Parameters: 13089 * unit - (IN) BCM device number 13090 * Returns: 13091 * BCM_E_XXX 13092 */ 13093 STATIC int 13094 _bcm_field_tr3_external_ip_proto_deinit(int unit) 13095 { 13096 int rv = BCM_E_NONE; 13097 13098 if (SOC_WARM_BOOT(unit)) { 13099 return (rv); 13100 } 13101 13102 rv = soc_mem_clear((unit), ESM_L3_PROTOCOL_FNm, COPYNO_ALL, TRUE); 13103 BCM_IF_ERROR_RETURN(rv); 13104 13105 return (rv); 13106 } 13107 13108 13109 STATIC int 13110 _field_tr3_external_init(int unit, _field_stage_t *stage_fc) 13111 { 13112 int i, size, total_size = 0; 13113 soc_mem_t mem; 13114 int entry_words; 13115 _field_slice_t *fs; 13116 int alloc_size; 13117 int rv; 13118 13119 /* Read the sizes for various external databases */ 13120 for (i = 0; i < stage_fc->tcam_slices; i++) { 13121 /* slice i is valid for a particular pkt_type (L2, IPV4, IPV6) */ 13122 fs = stage_fc->slices[_FP_DEF_INST] + i; 13123 switch (i) { 13124 case _FP_EXT_ACL_144_L2: 13125 case _FP_EXT_ACL_L2: 13126 fs->pkt_type[_FP_EXT_L2] = 1; 13127 fs->pkt_type[_FP_EXT_IP4] = 0; 13128 fs->pkt_type[_FP_EXT_IP6] = 0; 13129 break; 13130 case _FP_EXT_ACL_144_IPV4: 13131 case _FP_EXT_ACL_IPV4: 13132 case _FP_EXT_ACL_L2_IPV4: 13133 fs->pkt_type[_FP_EXT_L2] = 0; 13134 fs->pkt_type[_FP_EXT_IP4] = 1; 13135 fs->pkt_type[_FP_EXT_IP6] = 0; 13136 break; 13137 case _FP_EXT_ACL_144_IPV6: 13138 case _FP_EXT_ACL_IPV6_SHORT: 13139 case _FP_EXT_ACL_IPV6_FULL: 13140 case _FP_EXT_ACL_L2_IPV6: 13141 fs->pkt_type[_FP_EXT_L2] = 0; 13142 fs->pkt_type[_FP_EXT_IP4] = 0; 13143 fs->pkt_type[_FP_EXT_IP6] = 1; 13144 break; 13145 default: 13146 continue; 13147 } 13148 BCM_PBMP_CLEAR(fs->ext_pbmp[_FP_EXT_L2]); 13149 BCM_PBMP_CLEAR(fs->ext_pbmp[_FP_EXT_IP4]); 13150 BCM_PBMP_CLEAR(fs->ext_pbmp[_FP_EXT_IP6]); 13151 13152 /* We use policy_mem as it is in one array as compared to data_mems */ 13153 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_data_mem(unit, 13154 i, 13155 &mem 13156 ) 13157 ); 13158 size = soc_mem_index_count(unit, mem); 13159 fs->entry_count = size; 13160 fs->free_count = size; 13161 13162 #ifdef BCM_WARM_BOOT_SUPPORT 13163 { 13164 int stable_size; 13165 13166 SOC_IF_ERROR_RETURN(soc_stable_size_get(unit, &stable_size)); 13167 13168 if (stable_size > 0 && !SOC_WARM_BOOT_SCACHE_IS_LIMITED(unit)) { 13169 /* Level-2 warm boot supported */ 13170 13171 /* The number of entries need to be adjusted, to allow for space for 13172 storing scache information for FP ESM level-2 warm boot. 13173 We carve off some portion of each paritition for this storage 13174 area. 13175 */ 13176 13177 fs->entry_count -= _bcm_esw_field_tr2_ext_scache_size(unit, i); 13178 fs->free_count = fs->entry_count; 13179 } 13180 } 13181 #endif /* BCM_WARM_BOOT_SUPPORT */ 13182 13183 if (size) { 13184 alloc_size = size * sizeof (_field_entry_t *); 13185 _FP_XGS3_ALLOC(fs->entries, alloc_size, "array of external entry pointers"); 13186 if (NULL == fs->entries) { 13187 _bcm_field_stage_entries_free(unit, stage_fc); 13188 return (BCM_E_MEMORY); 13189 } 13190 total_size += size; 13191 } 13192 } 13193 stage_fc->tcam_sz = total_size; 13194 13195 /* Initialize ESM_L3_PROTOCOL_FN table */ 13196 BCM_IF_ERROR_RETURN(_bcm_field_tr3_external_ip_proto_init(unit)); 13197 13198 /* Initialize the profiles */ 13199 /* 13200 * redirect_profile will be used from IFP; 13201 * both IFP and External TCAM share the same profile 13202 */ 13203 mem = ESM_ACL_PROFILEm; 13204 entry_words = sizeof(esm_acl_profile_entry_t) / sizeof(uint32); 13205 rv = soc_profile_mem_create(unit, &mem, &entry_words, 1, 13206 &stage_fc->ext_act_profile); 13207 if (BCM_FAILURE(rv)) { 13208 _bcm_field_stage_entries_free(unit, stage_fc); 13209 return (rv); 13210 } 13211 13212 /* Set the Seed-ID for range creation */ 13213 stage_fc->range_id = 1; 13214 13215 /* Initialize the prio_mgmt structure */ 13216 rv = _bcm_field_prio_mgmt_init(unit, stage_fc); 13217 if (BCM_FAILURE(rv)) { 13218 _bcm_field_stage_entries_free(unit, stage_fc); 13219 return (rv); 13220 } 13221 13222 return (BCM_E_NONE); 13223 } 13224 13225 #ifdef BCM_HELIX4_SUPPORT 13226 /* 13227 * Function: 13228 * _bcm_field_helix4_stage_init 13229 * Purpose: Initialize device stage wise flags 13230 * Parameters: 13231 * unit - (IN) BCM device number. 13232 * stage_fc - (IN) Field Processor stage control structure. 13233 * Returns: BCM_E_NONE 13234 */ 13235 int 13236 _bcm_field_helix4_stage_init(int unit, _field_stage_t *stage_fc) 13237 { 13238 13239 /* Input parameters check. */ 13240 if (NULL == stage_fc) { 13241 return (BCM_E_PARAM); 13242 } 13243 13244 switch (stage_fc->stage_id) { 13245 case _BCM_FIELD_STAGE_LOOKUP: 13246 /* Flags */ 13247 stage_fc->flags |= (_FP_STAGE_SLICE_ENABLE | _FP_STAGE_AUTO_EXPANSION 13248 | _FP_STAGE_GLOBAL_COUNTERS); 13249 /* Slice geometry */ 13250 stage_fc->tcam_sz = soc_mem_index_count(unit, VFP_TCAMm); 13251 stage_fc->tcam_slices = 4; 13252 13253 if (soc_feature(unit, soc_feature_field_stage_half_slice)) { 13254 stage_fc->flags |= _FP_STAGE_HALF_SLICE; 13255 } 13256 13257 break; 13258 13259 case _BCM_FIELD_STAGE_INGRESS: 13260 /* Flags */ 13261 stage_fc->flags |= _FP_STAGE_SLICE_ENABLE 13262 | _FP_STAGE_GLOBAL_METER_POOLS 13263 | _FP_STAGE_GLOBAL_CNTR_POOLS 13264 | _FP_STAGE_SEPARATE_PACKET_BYTE_COUNTERS 13265 | _FP_STAGE_AUTO_EXPANSION; 13266 /* Slice geometry */ 13267 stage_fc->tcam_sz = soc_mem_index_count(unit, FP_TCAMm); 13268 stage_fc->tcam_slices = 16; 13269 13270 if (soc_feature(unit, soc_feature_field_stage_half_slice)) { 13271 stage_fc->flags |= _FP_STAGE_HALF_SLICE; 13272 } 13273 13274 break; 13275 13276 case _BCM_FIELD_STAGE_EGRESS: 13277 /* Flags */ 13278 stage_fc->flags |= _FP_STAGE_SLICE_ENABLE 13279 | _FP_STAGE_GLOBAL_COUNTERS 13280 | _FP_STAGE_SEPARATE_PACKET_BYTE_COUNTERS 13281 | _FP_STAGE_AUTO_EXPANSION; 13282 /* Slice geometry */ 13283 stage_fc->tcam_sz = soc_mem_index_count(unit, EFP_TCAMm); 13284 stage_fc->tcam_slices = 4; 13285 13286 if (soc_feature(unit, soc_feature_field_stage_half_slice)) { 13287 stage_fc->flags |= _FP_STAGE_HALF_SLICE; 13288 } 13289 13290 break; 13291 13292 default: 13293 return (BCM_E_INTERNAL); 13294 13295 } 13296 13297 return (BCM_E_NONE); 13298 } 13299 #endif /* BCM_HELIX4_SUPPORT */ 13300 13301 int 13302 _bcm_field_tr3_stage_init(int unit, _field_stage_t *stage_fc) 13303 { 13304 /* Input prameters check. */ 13305 if (NULL == stage_fc) { 13306 return (BCM_E_PARAM); 13307 } 13308 13309 switch (stage_fc->stage_id) { 13310 case _BCM_FIELD_STAGE_LOOKUP: 13311 /* Flags */ 13312 stage_fc->flags |= (_FP_STAGE_SLICE_ENABLE | _FP_STAGE_AUTO_EXPANSION 13313 | _FP_STAGE_GLOBAL_COUNTERS); 13314 /* Slice geometry */ 13315 stage_fc->tcam_sz = soc_mem_index_count(unit, VFP_TCAMm); 13316 stage_fc->tcam_slices = 4; 13317 13318 if (soc_feature(unit, soc_feature_field_stage_quarter_slice)) { 13319 stage_fc->flags |= _FP_STAGE_QUARTER_SLICE; 13320 } 13321 13322 break; 13323 case _BCM_FIELD_STAGE_INGRESS: 13324 /* Flags */ 13325 stage_fc->flags 13326 |= _FP_STAGE_SLICE_ENABLE 13327 | _FP_STAGE_GLOBAL_METER_POOLS 13328 | _FP_STAGE_GLOBAL_CNTR_POOLS 13329 | _FP_STAGE_SEPARATE_PACKET_BYTE_COUNTERS 13330 | _FP_STAGE_AUTO_EXPANSION; 13331 /* Slice geometry */ 13332 stage_fc->tcam_sz = soc_mem_index_count(unit, FP_TCAMm); 13333 stage_fc->tcam_slices = 16; 13334 13335 if (soc_feature(unit, soc_feature_field_stage_half_slice)) { 13336 stage_fc->flags |= _FP_STAGE_HALF_SLICE; 13337 } 13338 13339 if (soc_feature(unit, soc_feature_field_stage_quarter_slice)) { 13340 stage_fc->flags &= ~(_FP_STAGE_HALF_SLICE); 13341 stage_fc->flags |= _FP_STAGE_QUARTER_SLICE; 13342 } 13343 13344 13345 break; 13346 case _BCM_FIELD_STAGE_EGRESS: 13347 /* Flags */ 13348 stage_fc->flags |= _FP_STAGE_SLICE_ENABLE 13349 | _FP_STAGE_GLOBAL_COUNTERS 13350 | _FP_STAGE_SEPARATE_PACKET_BYTE_COUNTERS 13351 | _FP_STAGE_AUTO_EXPANSION; 13352 /* Slice geometry */ 13353 stage_fc->tcam_sz = soc_mem_index_count(unit, EFP_TCAMm); 13354 stage_fc->tcam_slices = 4; 13355 13356 /* 13357 * Among the the triumph3 variants,Only Ranger+ has holes in EFP. 13358 * Double check on half slice and quarter slice is to distinguish 13359 * Ranger+ from other variants as Ranger+ is the only 13360 * triumph3 variant having both quarter slice and half slice fatures 13361 * enabled 13362 */ 13363 if (soc_feature(unit, soc_feature_field_stage_quarter_slice)) { 13364 if (soc_feature(unit, soc_feature_field_stage_half_slice)) { 13365 stage_fc->flags |= _FP_STAGE_HALF_SLICE; 13366 } 13367 } 13368 13369 break; 13370 case _BCM_FIELD_STAGE_EXTERNAL: 13371 { 13372 unsigned slice_num, n; 13373 soc_mem_t tcam_data_mem; 13374 13375 stage_fc->tcam_slices = _FP_EXT_NUM_PARTITIONS; 13376 for (stage_fc->tcam_sz = slice_num = 0, n = stage_fc->tcam_slices; 13377 n; 13378 --n, ++slice_num 13379 ) { 13380 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_data_mem( 13381 unit, 13382 slice_num, 13383 &tcam_data_mem 13384 ) 13385 ); 13386 stage_fc->tcam_sz += soc_mem_index_count(unit, tcam_data_mem); 13387 } 13388 } 13389 break; 13390 13391 default: 13392 return (BCM_E_INTERNAL); 13393 } 13394 13395 return (BCM_E_NONE); 13396 } 13397 13398 13399 int 13400 _bcm_field_tr3_hw_clear(int unit, _field_stage_t *stage_fc) 13401 { 13402 int rv = BCM_E_NONE; 13403 13404 if (stage_fc->stage_id == _BCM_FIELD_STAGE_EXTERNAL) { 13405 /* Initialize ESM_L3_PROTOCOL_FN table */ 13406 rv = _bcm_field_tr3_external_ip_proto_deinit(unit); 13407 } else { 13408 rv = _bcm_field_tr_hw_clear(unit, stage_fc); 13409 } 13410 13411 return (rv); 13412 } 13413 13414 /* 13415 * Function: 13416 * _bcm_field_tr3_init 13417 * Purpose: 13418 * Perform initializations that are specific to BCM56640. This 13419 * includes initializing the FP field select bit offset tables for FPF[1-3] 13420 * for every stage. 13421 * Parameters: 13422 * unit - (IN) BCM device number. 13423 * fc - (IN) Field Processor control structure. 13424 * 13425 * Returns: 13426 * BCM_E_NONE 13427 * Notes: 13428 */ 13429 int 13430 _bcm_field_tr3_init(int unit, _field_control_t *fc) 13431 { 13432 _field_stage_t *stage_fc; /* Stages iteration pointer */ 13433 13434 /* Input parameters check. */ 13435 if (NULL == fc) { 13436 return (BCM_E_PARAM); 13437 } 13438 /*Set default logical pool mode */ 13439 fc->ingress_logical_policer_pools_mode = 13440 bcmFieldIngressLogicalPolicerPools8x1024; 13441 13442 /* Check external tcam presence for ingress (default stage) */ 13443 /* Only for EasyRider; Triumph taken care of elsewhere */ 13444 fc->tcam_ext_numb = FP_EXT_TCAM_NONE; 13445 13446 stage_fc = fc->stages; 13447 while (stage_fc) { 13448 /* Clear hardware table */ 13449 BCM_IF_ERROR_RETURN(_bcm_field_tr3_hw_clear(unit, stage_fc)); 13450 13451 /* Initialize qualifiers info. */ 13452 BCM_IF_ERROR_RETURN(_field_tr3_qualifiers_init(unit, stage_fc)); 13453 13454 if (stage_fc->stage_id == _BCM_FIELD_STAGE_EXTERNAL) { 13455 BCM_IF_ERROR_RETURN(_field_tr3_external_init(unit, stage_fc)); 13456 } 13457 13458 /* Goto next stage */ 13459 stage_fc = stage_fc->next; 13460 } 13461 13462 /* Initialize the TOS_FN, TTL_FN, TCP_FN tables */ 13463 BCM_IF_ERROR_RETURN(_bcm_field_trx_tcp_ttl_tos_init(unit)); 13464 13465 if (0 == SOC_WARM_BOOT(unit)) { 13466 /* Enable filter processor */ 13467 BCM_IF_ERROR_RETURN(_field_port_filter_enable_set(unit, fc, TRUE)); 13468 13469 /* Enable meter refresh */ 13470 BCM_IF_ERROR_RETURN(_field_meter_refresh_enable_set(unit, fc, TRUE)); 13471 } 13472 13473 /* Initialize TR3 function pointers */ 13474 _field_tr3_functions_init(&fc->functions); 13475 13476 return (BCM_E_NONE); 13477 } 13478 13479 13480 /* 13481 * Function: 13482 * _field_tr3_logical_meter_pools_init 13483 * Purpose: 13484 * Initialize field meter pools usage bitmap. 13485 * Parameters: 13486 * unit - (IN) BCM device number. 13487 * stage_fc - (IN/OUT) Stage field control structure. 13488 * Returns: 13489 * BCM_E_XXX 13490 */ 13491 int 13492 _field_tr3_logical_meter_pools_init(int unit, _field_stage_t *stage_fc) 13493 { 13494 int logical_meter_pair_num = -1; /* Number of logical meter pairs. */ 13495 int logical_pool_idx; /* Virtual Meter pools iterator. */ 13496 int logical_size; /* Virtual Allocation size. */ 13497 uint16 logical_pool_size = 0; /* Total number of meters 13498 in logical pool. */ 13499 13500 /* Input parameters check. */ 13501 if (NULL == stage_fc) { 13502 return (BCM_E_PARAM); 13503 } 13504 13505 if (0 == (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS)) { 13506 return (BCM_E_PARAM); 13507 } 13508 13509 /* Init Virtual Meter Pools 13510 * Total meters per logical pool = 2 * (No. of logical meter pairs) 13511 */ 13512 13513 BCM_IF_ERROR_RETURN(_bcm_field_tr3_logical_meter_pool_info(unit, 13514 stage_fc, 13515 &stage_fc->num_logical_meter_pools, 13516 &logical_meter_pair_num, 13517 &logical_pool_size 13518 ) 13519 ); 13520 13521 logical_size = SHR_BITALLOCSIZE(logical_meter_pair_num << 1); 13522 13523 for (logical_pool_idx = 0; 13524 logical_pool_idx < stage_fc->num_logical_meter_pools; 13525 logical_pool_idx++) { 13526 /* Allocate pool usage bitmap. */ 13527 stage_fc->logical_meter_pool[logical_pool_idx] = 13528 sal_alloc(sizeof(_field_meter_pool_t), 13529 "fp_logical_meter_pool"); 13530 if (stage_fc->logical_meter_pool[logical_pool_idx] == NULL) { 13531 return (BCM_E_MEMORY); 13532 } 13533 13534 /* Initalize stage meter pool info. */ 13535 stage_fc->logical_meter_pool[logical_pool_idx]->slice_id = -1; 13536 /* Virtual Pool is not in use. */ 13537 stage_fc->logical_meter_pool[logical_pool_idx]->pool_size = 13538 logical_pool_size; 13539 /* Total number of meters in logical pool. */ 13540 stage_fc->logical_meter_pool[logical_pool_idx]->level = -1; 13541 stage_fc->logical_meter_pool[logical_pool_idx]->size = 13542 (logical_meter_pair_num * 2); 13543 /* Number of valid meters in logical pool.*/ 13544 stage_fc->logical_meter_pool[logical_pool_idx]->free_meters = 13545 (logical_meter_pair_num * 2); 13546 stage_fc->logical_meter_pool[logical_pool_idx]->num_meter_pairs = 13547 logical_meter_pair_num; 13548 stage_fc->logical_meter_pool[logical_pool_idx]->meter_bmp.w = 13549 sal_alloc(logical_size, 13550 "fp_logical_meters_map" 13551 ); 13552 if (stage_fc->logical_meter_pool[logical_pool_idx]->meter_bmp.w 13553 == NULL) { 13554 return (BCM_E_MEMORY); 13555 } 13556 13557 /* Reset pool usage bitmap. */ 13558 sal_memset(stage_fc->logical_meter_pool[logical_pool_idx]->meter_bmp.w, 13559 0, logical_size ); 13560 } 13561 13562 return BCM_E_NONE; 13563 } 13564 13565 /* 13566 * Function: 13567 * _field_tr3_logical_meter_pool_free 13568 * 13569 * Purpose: 13570 * Unreserve a logical meter pool. 13571 * 13572 * Parameters: 13573 * unit - (IN) BCM device number. 13574 * stage_fc - (IN) Stage field control structure. 13575 * pool_idx - (IN) Meter pool index. 13576 * Returns: 13577 * BCM_E_XXX 13578 */ 13579 int 13580 _field_tr3_logical_meter_pool_free(int unit, 13581 _field_stage_t *stage_fc, uint8 logical_pool_idx) 13582 { 13583 _field_meter_pool_t *f_logical_mp; /* Meter pool descriptor. */ 13584 13585 /* Input parameters check. */ 13586 if (NULL == stage_fc) { 13587 return (BCM_E_PARAM); 13588 } 13589 13590 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 13591 if (NULL == f_logical_mp) { 13592 return (BCM_E_INTERNAL); 13593 } 13594 13595 /* Make sure pool entries are not in use. */ 13596 if (f_logical_mp->free_meters != f_logical_mp->size) { 13597 return (BCM_E_BUSY); 13598 } 13599 13600 f_logical_mp->slice_id = _FP_INVALID_INDEX; 13601 f_logical_mp->level = -1; 13602 13603 LOG_DEBUG(BSL_LS_BCM_FP, 13604 (BSL_META_U(unit, 13605 "FP(unit %d) vverb: " 13606 "_field_tr3_logical_meter_pool_free()" 13607 " Deallocated logical meter pool %d\n"), 13608 unit, logical_pool_idx)); 13609 return (BCM_E_NONE); 13610 } 13611 13612 13613 /* 13614 * Function: 13615 * _field_tr3_logical_meter_pool_alloc 13616 * 13617 * Purpose: 13618 * Allocate/Find meter pool with free meters 13619 * 13620 * Parameters: 13621 * unit - (IN) BCM device number. 13622 * stage_fc - (IN) Stage field control structure. 13623 * f_pl - (IN) Field policer descriptor 13624 * slice_id - (IN) Slice base index. 13625 * pool_idx - (OUT) Meter pool index. 13626 * logical_pool_idx - (OUT) Logical Meter pool index. 13627 * updateHigherMeter - (OUT) update 0-511 or 512-1023 index. 13628 13629 * Returns: 13630 * BCM_E_XXX 13631 */ 13632 STATIC int 13633 _field_tr3_logical_meter_pool_alloc(int unit, _field_stage_t *stage_fc, 13634 _field_policer_t *f_pl, uint8 slice_id, uint8 *pool_idx, 13635 uint8 *logical_pool_idx, 13636 uint8 *updateHigherMeter) 13637 { 13638 _field_meter_pool_t *f_mp; 13639 /* Meter pool descriptor. */ 13640 _field_meter_pool_t *f_logical_mp; 13641 /* Meter pool descriptor. */ 13642 _field_control_t *fc; /* Field control structure. */ 13643 int idx; /* Pool iteration index. */ 13644 int free_pool; /* Free meter pool. */ 13645 int logical_free_pool; /* Free Virtual Pool */ 13646 uint8 isLogicalPoolModeSplit; 13647 /* Logical Pool Mode */ 13648 13649 13650 /* Input parameters check. */ 13651 if ((NULL == stage_fc) || (NULL == pool_idx)) { 13652 return (BCM_E_PARAM); 13653 } 13654 13655 /* Get field control structure. */ 13656 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 13657 13658 free_pool = _FP_INVALID_INDEX; 13659 logical_free_pool = _FP_INVALID_INDEX; 13660 13661 for (idx = 0 ; idx < stage_fc->num_logical_meter_pools; idx++) { 13662 f_logical_mp = stage_fc->logical_meter_pool[idx]; 13663 if (NULL == f_logical_mp) { 13664 return (BCM_E_INTERNAL); 13665 } 13666 13667 /* In 16x512Split Mode: 13668 * Logical Pools (0,8) (1,9) (2,10) (3,11) 13669 * (4,12) (5,13) (6,14) (7,15) shares same physical Pool 13670 * In 16x512Contiguous Mode: 13671 * Logical Pools (0,1) (2,3) (4,5) (6,7) 13672 * (8,9) (10,11) (12,13) (14,15) share a physical Pool*/ 13673 if (fc->ingress_logical_policer_pools_mode == 13674 bcmFieldIngressLogicalPolicerPools16x512Split) { 13675 f_mp = stage_fc->meter_pool[_FP_DEF_INST][idx % 8]; 13676 isLogicalPoolModeSplit = TRUE; 13677 } else if (fc->ingress_logical_policer_pools_mode == 13678 bcmFieldIngressLogicalPolicerPools16x512Contiguous) { 13679 f_mp = stage_fc->meter_pool[_FP_DEF_INST][idx / 2]; 13680 isLogicalPoolModeSplit = FALSE; 13681 } else { 13682 return (BCM_E_INTERNAL); 13683 } 13684 13685 if (NULL == f_mp) { 13686 return (BCM_E_INTERNAL); 13687 } 13688 13689 /* Allocate next index from an already allocated pool only if 13690 * the following conditions are met: 13691 * 1) slice id of the already existing logical meter pool and 13692 new entry must match. 13693 * 2) level of the already existing logical meter pool and 13694 new entry must match. 13695 * 3) level of the physical meter pool corresponding to the 13696 logical meter pool and new entry must match. 13697 * 13698 * When the above conditions are not met, allocate a new logical pool. 13699 * When new logical pool is allocated, verify if the physical pool 13700 * corresponding to the new logical pool is also newly allocated. 13701 * If the physical pool is already allocated to another logical pool, 13702 * ensure the level of physical meter pool corresponding to new 13703 * logical pool must match the entry's meter pool level or 13704 * Example :- In contiguos mode , 13705 * creating group 0,level 0 implies Meter Pool 0 (0-511) are allocated. 13706 * creating group 1,level 1 shouldn't allocate Meter Pool 0 (512-1024). 13707 * It has to allocate Meter Pool 1 (0-511); 13708 */ 13709 if ((f_logical_mp->slice_id == slice_id) 13710 && (f_logical_mp->level == f_pl->level) 13711 && (f_mp->level == f_pl->level) 13712 && ((_FP_POLICER_IS_FLOW_MODE(f_pl) && f_logical_mp->free_meters > 0) 13713 || (!_FP_POLICER_IS_FLOW_MODE(f_pl) 13714 && f_logical_mp->free_meters >= 2))) { 13715 if (isLogicalPoolModeSplit) { 13716 *pool_idx = idx % 8; 13717 *logical_pool_idx = idx; 13718 if (idx > 7) { 13719 *updateHigherMeter = TRUE; 13720 } else { 13721 *updateHigherMeter = FALSE; 13722 } 13723 } else if (!isLogicalPoolModeSplit) { 13724 *pool_idx = idx/2; 13725 *logical_pool_idx = idx; 13726 if ( idx % 2 == 0 ) { 13727 *updateHigherMeter = FALSE; 13728 } else { 13729 *updateHigherMeter = TRUE; 13730 } 13731 } 13732 f_pl->cfg.pool_id = *logical_pool_idx; 13733 return (BCM_E_NONE); 13734 } else if ((f_mp->level != -1) && (f_mp->level != f_pl->level)) { 13735 continue; 13736 } 13737 13738 /* Preserve first free pool */ 13739 if ((_FP_INVALID_INDEX == free_pool) && 13740 (_FP_INVALID_INDEX == f_logical_mp->slice_id)) { 13741 if (isLogicalPoolModeSplit) { 13742 free_pool = idx % 8; 13743 logical_free_pool = idx; 13744 if (idx > 7) { 13745 *updateHigherMeter = TRUE; 13746 } else { 13747 *updateHigherMeter = FALSE; 13748 } 13749 } else if (!isLogicalPoolModeSplit) { 13750 free_pool = idx / 2; 13751 logical_free_pool = idx; 13752 if ( idx % 2 == 0 ) { 13753 *updateHigherMeter = FALSE; 13754 } else { 13755 *updateHigherMeter = TRUE; 13756 } 13757 } 13758 } 13759 } 13760 /* We have to use free pool at this point. */ 13761 if (_FP_INVALID_INDEX == free_pool) { 13762 return (BCM_E_RESOURCE); 13763 } 13764 13765 f_mp = stage_fc->meter_pool[_FP_DEF_INST][free_pool]; 13766 if (f_mp->slice_id == -1) { 13767 f_mp->slice_id = slice_id; 13768 } 13769 f_mp->level = f_pl->level; 13770 13771 f_logical_mp = stage_fc->logical_meter_pool[logical_free_pool]; 13772 f_logical_mp->slice_id = slice_id; 13773 f_logical_mp->level = f_pl->level; 13774 13775 *pool_idx = free_pool; 13776 *logical_pool_idx = logical_free_pool; 13777 f_pl->cfg.pool_id = *logical_pool_idx; 13778 13779 LOG_DEBUG(BSL_LS_BCM_FP, 13780 (BSL_META_U(unit, 13781 "Unit(%d): %s() : Alloted Physical Pool: %d at " 13782 "level: %d with corresponding Logical Pool : %d\r\n"), 13783 unit, __FUNCTION__, free_pool, f_mp->level, 13784 logical_free_pool)); 13785 return (BCM_E_NONE); 13786 } 13787 13788 /* 13789 * Function: 13790 * _field_tr3_logical_meter_pool_entry_alloc 13791 * 13792 * Purpose: 13793 * Allocate meter pool entry. 13794 * 13795 * Parameters: 13796 * unit - (IN) BCM device number. 13797 * stage_fc - (IN) Stage field control structure. 13798 * pool_slice_id - (IN) Meter pool index. 13799 * f_pl - (IN) Field policer descriptor 13800 * Returns: 13801 * BCM_E_XXX 13802 */ 13803 13804 int 13805 _field_tr3_logical_meter_pool_entry_alloc (int unit, _field_stage_t *stage_fc, 13806 uint8 pool_slice_id, _field_policer_t *f_pl) 13807 { 13808 int idx; /* Pool iteration index. */ 13809 int startIdx; /* Pool iteration index. */ 13810 int endIdx; /* Pool iteration index. */ 13811 int logicalIdx; /* Logical Pool index. */ 13812 uint8 pool_idx; /* Meter pool index. */ 13813 uint8 logical_pool_idx; /* Logical Meter pool index. */ 13814 uint8 updateHigherMeter = 0; 13815 /* update 0-511 or 512-1023. */ 13816 _field_meter_pool_t *f_mp; /* Meter pool descriptor */ 13817 _field_meter_pool_t *f_logical_mp; /* Logical Meter pool descriptor */ 13818 13819 /* Input parameters check. */ 13820 if ((NULL == stage_fc) || (NULL == f_pl)) { 13821 return (BCM_E_PARAM); 13822 } 13823 13824 if (f_pl->level >= _FP_POLICER_LEVEL_COUNT) { 13825 return (BCM_E_PARAM); 13826 } 13827 13828 /* Allocate meter pool with free meters. */ 13829 BCM_IF_ERROR_RETURN(_field_tr3_logical_meter_pool_alloc(unit, 13830 stage_fc, f_pl, 13831 pool_slice_id, 13832 &pool_idx, 13833 &logical_pool_idx, 13834 &updateHigherMeter 13835 )); 13836 f_mp = stage_fc->meter_pool[_FP_DEF_INST][pool_idx]; 13837 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 13838 13839 /* Update either (512-1023) index or (0-511) index 13840 * f_mp->size = 1024 for triumph3. 13841 */ 13842 if (updateHigherMeter) { 13843 startIdx = f_mp->size/2; 13844 endIdx = f_mp->size; 13845 }else { 13846 startIdx = 0; 13847 endIdx = f_mp->size/2; 13848 } 13849 13850 13851 /* Reserve unused meter. */ 13852 logicalIdx = 0; 13853 for (idx = startIdx; idx < endIdx; idx++) { 13854 13855 /* Allocate meter indices for non-flow mode meters. */ 13856 if (!_FP_POLICER_IS_FLOW_MODE(f_pl)) { 13857 13858 if (0 != (idx % 2)) { 13859 /* skip odd meter indices */ 13860 continue; 13861 } 13862 13863 if (0 != (logicalIdx % 2)) { 13864 /* skip odd meter indices */ 13865 logicalIdx++; 13866 } 13867 13868 if ((0 == _FP_METER_BMP_TEST(f_mp->meter_bmp, idx)) 13869 && (0 == _FP_METER_BMP_TEST(f_mp->meter_bmp, idx + 1))) { 13870 _FP_METER_BMP_ADD(f_mp->meter_bmp, idx); 13871 _FP_METER_BMP_ADD(f_mp->meter_bmp, (idx + 1)); 13872 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, logicalIdx); 13873 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, (logicalIdx + 1)); 13874 /* Decrement free meters count in meter pool. */ 13875 f_mp->free_meters -= 2; 13876 f_logical_mp->free_meters -= 2; 13877 f_pl->pool_index = pool_idx ; 13878 f_pl->hw_index = (idx / 2); 13879 13880 f_pl->logical_pool_index = logical_pool_idx; 13881 13882 LOG_DEBUG(BSL_LS_BCM_FP, 13883 (BSL_META_U(unit, 13884 "Unit(%d): Alloted Physical Pool(%d): MeterIndex: %d" 13885 " at level: %d corresponding to Logical Pool(%d):" 13886 " MeterIndex: %d\r\n"), unit, pool_idx, (idx/2), 13887 f_mp->level,logical_pool_idx, logicalIdx)); 13888 return (BCM_E_NONE); 13889 } 13890 } 13891 13892 /* Allocate hardware resources for flow mode meters. */ 13893 if (_FP_POLICER_IS_FLOW_MODE(f_pl) 13894 && (0 == _FP_METER_BMP_TEST(f_mp->meter_bmp, idx))) { 13895 13896 if (f_pl->hw_flags & _FP_POLICER_DIRTY) { 13897 f_pl->hw_flags &= (idx % 2) 13898 ? ~_FP_POLICER_PEAK_DIRTY 13899 : ~_FP_POLICER_COMMITTED_DIRTY; 13900 } else { 13901 LOG_DEBUG(BSL_LS_BCM_FP, 13902 (BSL_META_U(unit, 13903 "FP(unit %d) Error: Meter alloc called with invalid" 13904 " hw_flags=%x\n"), unit, f_pl->hw_flags)); 13905 return (BCM_E_INTERNAL); 13906 } 13907 13908 if (f_pl->hw_flags & _FP_POLICER_PEAK_DIRTY) { 13909 _FP_POLICER_EXCESS_HW_METER_SET(f_pl); 13910 } else { 13911 _FP_POLICER_EXCESS_HW_METER_CLEAR(f_pl); 13912 } 13913 _FP_METER_BMP_ADD(f_mp->meter_bmp, idx); 13914 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, logicalIdx); 13915 13916 13917 /* Decrement free meter count in meter pool. */ 13918 f_mp->free_meters--; 13919 f_logical_mp->free_meters--; 13920 f_pl->pool_index = pool_idx; 13921 f_pl->hw_index = (idx / 2); 13922 f_pl->logical_pool_index = logical_pool_idx; 13923 13924 LOG_DEBUG(BSL_LS_BCM_FP, 13925 (BSL_META_U(unit, 13926 "Unit(%d): Alloted Physical Pool(%d):Index: %d at " 13927 "level: %d corresponding to Logical Pool(%d):" 13928 "Index: %d\r\n"), unit, pool_idx, (idx/2), 13929 f_mp->level,logical_pool_idx, logicalIdx)); 13930 return (BCM_E_NONE); 13931 } 13932 logicalIdx++; 13933 } 13934 13935 /* Never reached - pool alloc makes sure at least one meter is available. */ 13936 if (f_mp->free_meters == f_mp->size) { 13937 BCM_IF_ERROR_RETURN 13938 (_field_meter_pool_free(unit, stage_fc, _FP_DEF_INST, pool_idx)); 13939 } 13940 13941 /* Never reached - pool alloc makes sure at least one meter is available. */ 13942 if (f_logical_mp->free_meters == f_logical_mp->size) { 13943 BCM_IF_ERROR_RETURN(_field_tr3_logical_meter_pool_free(unit, 13944 stage_fc, logical_pool_idx)); 13945 } 13946 return (BCM_E_RESOURCE); 13947 } 13948 13949 /* free the meter pool info of the allocated for the policer 13950 * prior to calling bcm_policer_set API. 13951 */ 13952 int 13953 _field_tr3_logical_meter_pool_entry_free_old (int unit, _field_stage_t *stage_fc, 13954 _field_policer_t *f_pl) 13955 { 13956 _field_control_t *fc; 13957 _field_meter_pool_t *f_mp; /* Meter pool descriptor. */ 13958 _field_meter_pool_t *f_logical_mp; /* Logical Meter pool descriptor. */ 13959 int idx; /* Meter index. */ 13960 int logical_idx; /* Logical Meter index. */ 13961 int logical_pool_idx = -1; /* Logical Meter index. */ 13962 uint8 isLogicalPoolModeSplit = 0; /*Specify split or contiguous 13963 logical pool mode */ 13964 uint8 updateHigherMeter = 0; 13965 13966 /* Input parameters check. */ 13967 if ((NULL == stage_fc) || (NULL == f_pl)) { 13968 return (BCM_E_PARAM); 13969 } 13970 13971 /* Meter pool index sanity check. */ 13972 if (stage_fc->num_meter_pools <= f_pl->old_pool_index) { 13973 return (BCM_E_PARAM); 13974 } 13975 13976 /* In 16x512Split Mode: 13977 * Logical Pools (0,8) (1,9) (2,10) (3,11) 13978 * (4,12) (5,13) (6,14) (7,15) shares same physical Pool 13979 * In 16x512Contiguous Mode: 13980 * Logical Pools (0,1) (2,3) (4,5) (6,7) 13981 * (8,9) (10,11) (12,13) (14,15) share a physical Pool 13982 */ 13983 13984 /* Get field control information. */ 13985 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 13986 13987 if (fc->ingress_logical_policer_pools_mode == 13988 bcmFieldIngressLogicalPolicerPools16x512Split) { 13989 isLogicalPoolModeSplit = TRUE; 13990 } else if (fc->ingress_logical_policer_pools_mode == 13991 bcmFieldIngressLogicalPolicerPools16x512Contiguous) { 13992 isLogicalPoolModeSplit = FALSE; 13993 } else 13994 return (BCM_E_INTERNAL); 13995 13996 f_logical_mp = NULL; 13997 13998 f_mp = stage_fc->meter_pool[_FP_DEF_INST][f_pl->old_pool_index]; 13999 14000 14001 if (f_pl->old_logical_pool_index != _FP_INVALID_INDEX) { 14002 f_logical_mp = stage_fc->logical_meter_pool[f_pl->old_logical_pool_index]; 14003 logical_pool_idx = f_pl->old_logical_pool_index; 14004 } 14005 14006 14007 if (f_logical_mp == NULL) 14008 return (BCM_E_INTERNAL); 14009 14010 if (isLogicalPoolModeSplit) { 14011 if (logical_pool_idx > 7) 14012 updateHigherMeter = TRUE; 14013 else 14014 updateHigherMeter = FALSE; 14015 } else if (!isLogicalPoolModeSplit) { 14016 if ( logical_pool_idx % 2 == 0 ) 14017 updateHigherMeter = FALSE; 14018 else 14019 updateHigherMeter = TRUE; 14020 } 14021 14022 /* Mark meter as free in the slice. */ 14023 idx = f_pl->old_hw_index * 2; 14024 14025 if (updateHigherMeter) 14026 { 14027 logical_idx = idx - (f_mp->size/2); 14028 }else { 14029 logical_idx = idx; 14030 } 14031 14032 /* Meter index in the pool sanity check. */ 14033 if ((f_mp->size <= idx) 14034 || (f_mp->size <= (idx + 1))) { 14035 return (BCM_E_PARAM); 14036 } 14037 14038 /* Logical Meter index in the pool sanity check. */ 14039 if ((f_logical_mp->size <= logical_idx) 14040 || (f_logical_mp->size <= (logical_idx + 1))) { 14041 return (BCM_E_PARAM); 14042 } 14043 14044 14045 if (bcmPolicerModeCommitted != (f_pl)->old_mode) { 14046 _FP_METER_BMP_REMOVE(f_mp->meter_bmp, idx); 14047 _FP_METER_BMP_REMOVE(f_mp->meter_bmp, idx + 1); 14048 f_mp->free_meters += 2; 14049 14050 _FP_METER_BMP_REMOVE(f_logical_mp->meter_bmp, logical_idx); 14051 _FP_METER_BMP_REMOVE(f_logical_mp->meter_bmp, logical_idx + 1); 14052 f_logical_mp->free_meters += 2; 14053 14054 LOG_DEBUG(BSL_LS_BCM_FP, 14055 (BSL_META_U(unit, 14056 "FP(unit %d) vverb: " 14057 "_field_tr3_logical_meter_pool_entry_free()" 14058 " Non Flow Mode: Deallocating physical meter" 14059 "id %d,%d and logical meter %d,%d\n"), unit, 14060 idx, (idx + 1), logical_idx, (logical_idx + 1))); 14061 } else { 14062 if ((bcmPolicerModeCommitted == (f_pl)->old_mode) && 14063 ((f_pl)->old_hw_flags & _FP_POLICER_EXCESS_METER)) { 14064 _FP_METER_BMP_REMOVE(f_mp->meter_bmp, idx); 14065 _FP_METER_BMP_REMOVE(f_logical_mp->meter_bmp, logical_idx); 14066 } else if ((bcmPolicerModeCommitted == (f_pl)->old_mode) && 14067 (!((f_pl)->old_hw_flags & _FP_POLICER_EXCESS_METER))) { 14068 _FP_METER_BMP_REMOVE(f_mp->meter_bmp, idx + 1); 14069 _FP_METER_BMP_REMOVE(f_logical_mp->meter_bmp, logical_idx + 1); 14070 } 14071 f_mp->free_meters++; 14072 f_logical_mp->free_meters++; 14073 14074 LOG_DEBUG(BSL_LS_BCM_FP, 14075 (BSL_META_U(unit, 14076 "FP(unit %d) vverb: " 14077 "_field_tr3_logical_meter_pool_entry_free()" 14078 " Flow Mode: Deallocating physical meter" 14079 "id %d and logical meter %d\n"), unit, 14080 idx, logical_idx)); 14081 } 14082 14083 /* Free logical empty pool. */ 14084 if (f_logical_mp->free_meters == f_logical_mp->size) { 14085 BCM_IF_ERROR_RETURN 14086 (_field_tr3_logical_meter_pool_free(unit, stage_fc, logical_pool_idx)); 14087 } 14088 14089 /* Free empty pool. */ 14090 if (f_mp->free_meters == f_mp->size) { 14091 BCM_IF_ERROR_RETURN 14092 (_field_meter_pool_free(unit, stage_fc, _FP_DEF_INST, 14093 f_pl->old_pool_index)); 14094 } 14095 14096 return (BCM_E_NONE); 14097 } 14098 14099 /* 14100 * Function: 14101 * _field_tr3_logical_meter_pool_entry_free 14102 * 14103 * Purpose: 14104 * Free meter pool entry. 14105 * if necessary free the pool itself. 14106 * 14107 * Parameters: 14108 * unit - (IN) BCM device number. 14109 * stage_fc - (IN) Stage field control structure. 14110 * f_pl - (IN) Policer descriptor. 14111 * Returns: 14112 * BCM_E_XXX 14113 */ 14114 int 14115 _field_tr3_logical_meter_pool_entry_free (int unit, _field_stage_t *stage_fc, 14116 _field_policer_t *f_pl) 14117 { 14118 _field_control_t *fc; 14119 _field_meter_pool_t *f_mp; /* Meter pool descriptor. */ 14120 _field_meter_pool_t *f_logical_mp; /* Logical Meter pool descriptor. */ 14121 int idx; /* Meter index. */ 14122 int logical_idx; /* Logical Meter index. */ 14123 int logical_pool_idx = -1; /* Logical Meter index. */ 14124 uint8 isLogicalPoolModeSplit = 0; /*Specify split or contiguous 14125 logical pool mode */ 14126 uint8 updateHigherMeter = 0; 14127 14128 /* Input parameters check. */ 14129 if ((NULL == stage_fc) || (NULL == f_pl)) { 14130 return (BCM_E_PARAM); 14131 } 14132 14133 /* Meter pool index sanity check. */ 14134 if (stage_fc->num_meter_pools <= f_pl->pool_index) { 14135 return (BCM_E_PARAM); 14136 } 14137 14138 /* In 16x512Split Mode: 14139 * Logical Pools (0,8) (1,9) (2,10) (3,11) 14140 * (4,12) (5,13) (6,14) (7,15) shares same physical Pool 14141 * In 16x512Contiguous Mode: 14142 * Logical Pools (0,1) (2,3) (4,5) (6,7) 14143 * (8,9) (10,11) (12,13) (14,15) share a physical Pool 14144 */ 14145 14146 /* Get field control information. */ 14147 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 14148 14149 if (fc->ingress_logical_policer_pools_mode == 14150 bcmFieldIngressLogicalPolicerPools16x512Split) { 14151 isLogicalPoolModeSplit = TRUE; 14152 } else if (fc->ingress_logical_policer_pools_mode == 14153 bcmFieldIngressLogicalPolicerPools16x512Contiguous) { 14154 isLogicalPoolModeSplit = FALSE; 14155 } else 14156 return (BCM_E_INTERNAL); 14157 14158 f_logical_mp = NULL; 14159 14160 f_mp = stage_fc->meter_pool[_FP_DEF_INST][f_pl->pool_index]; 14161 14162 14163 if (f_pl->logical_pool_index != _FP_INVALID_INDEX) { 14164 f_logical_mp = stage_fc->logical_meter_pool[f_pl->logical_pool_index]; 14165 logical_pool_idx = f_pl->logical_pool_index; 14166 } 14167 14168 14169 if (f_logical_mp == NULL) 14170 return (BCM_E_INTERNAL); 14171 14172 if (isLogicalPoolModeSplit) { 14173 if (logical_pool_idx > 7) 14174 updateHigherMeter = TRUE; 14175 else 14176 updateHigherMeter = FALSE; 14177 } else if (!isLogicalPoolModeSplit) { 14178 if ( logical_pool_idx % 2 == 0 ) 14179 updateHigherMeter = FALSE; 14180 else 14181 updateHigherMeter = TRUE; 14182 } 14183 14184 /* Mark meter as free in the slice. */ 14185 idx = f_pl->hw_index * 2; 14186 14187 if (updateHigherMeter) 14188 { 14189 logical_idx = idx - (f_mp->size/2); 14190 }else { 14191 logical_idx = idx; 14192 } 14193 14194 /* Meter index in the pool sanity check. */ 14195 if ((f_mp->size <= idx) 14196 || (f_mp->size <= (idx + 1))) { 14197 return (BCM_E_PARAM); 14198 } 14199 14200 /* Logical Meter index in the pool sanity check. */ 14201 if ((f_logical_mp->size <= logical_idx) 14202 || (f_logical_mp->size <= (logical_idx + 1))) { 14203 return (BCM_E_PARAM); 14204 } 14205 14206 14207 if (!_FP_POLICER_IS_FLOW_MODE(f_pl)) { 14208 _FP_METER_BMP_REMOVE(f_mp->meter_bmp, idx); 14209 _FP_METER_BMP_REMOVE(f_mp->meter_bmp, idx + 1); 14210 f_mp->free_meters += 2; 14211 14212 _FP_METER_BMP_REMOVE(f_logical_mp->meter_bmp, logical_idx); 14213 _FP_METER_BMP_REMOVE(f_logical_mp->meter_bmp, logical_idx + 1); 14214 f_logical_mp->free_meters += 2; 14215 14216 LOG_DEBUG(BSL_LS_BCM_FP, 14217 (BSL_META_U(unit, 14218 "FP(unit %d) vverb: " 14219 "_field_tr3_logical_meter_pool_entry_free()" 14220 " Non Flow Mode: Deallocating physical meter" 14221 "id %d,%d and logical meter %d,%d\n"), unit, 14222 idx, (idx + 1), logical_idx, (logical_idx + 1))); 14223 } else { 14224 14225 if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 14226 _FP_METER_BMP_REMOVE(f_mp->meter_bmp, idx); 14227 _FP_METER_BMP_REMOVE(f_logical_mp->meter_bmp, logical_idx); 14228 14229 /* Clear excess meter flag bit. */ 14230 _FP_POLICER_EXCESS_HW_METER_CLEAR(f_pl); 14231 } else if (_FP_POLICER_COMMITTED_HW_METER(f_pl)) { 14232 _FP_METER_BMP_REMOVE(f_mp->meter_bmp, idx + 1); 14233 _FP_METER_BMP_REMOVE(f_logical_mp->meter_bmp, logical_idx + 1); 14234 } 14235 f_mp->free_meters++; 14236 f_logical_mp->free_meters++; 14237 14238 LOG_DEBUG(BSL_LS_BCM_FP, 14239 (BSL_META_U(unit, 14240 "FP(unit %d) vverb: " 14241 "_field_tr3_logical_meter_pool_entry_free()" 14242 " Flow Mode: Deallocating physical meter" 14243 "id %d and logical meter %d\n"), unit, 14244 idx, logical_idx)); 14245 } 14246 14247 /* Free logical empty pool. */ 14248 if (f_logical_mp->free_meters == f_logical_mp->size) { 14249 BCM_IF_ERROR_RETURN 14250 (_field_tr3_logical_meter_pool_free(unit, stage_fc, logical_pool_idx)); 14251 } 14252 14253 /* Free empty pool. */ 14254 if (f_mp->free_meters == f_mp->size) { 14255 BCM_IF_ERROR_RETURN 14256 (_field_meter_pool_free(unit, stage_fc, _FP_DEF_INST, 14257 f_pl->pool_index)); 14258 } 14259 14260 /* Reset pool and hw index information in policer structure. */ 14261 f_pl->pool_index = _FP_INVALID_INDEX; 14262 f_pl->logical_pool_index = _FP_INVALID_INDEX; 14263 f_pl->hw_index = _FP_INVALID_INDEX; 14264 14265 return (BCM_E_NONE); 14266 } 14267 14268 14269 /* 14270 * Function: 14271 * _bcm__field_tr3_action_replaceL2Fields 14272 * Purpose: 14273 * fill EGR_IFP_MOD_FIELDS memory to replace L2 fields 14274 * Parameters: 14275 * unit - BCM device number 14276 * fa - (OUT) field action structure 14277 * Returns: 14278 * BCM_E_XXX 14279 * Notes: 14280 * For triumph3 and helix4 devices only. 14281 */ 14282 14283 int _bcm__field_tr3_action_replaceL2Fields(int unit,_field_action_t *fa) 14284 { 14285 uint32 tbl_entry[SOC_MAX_MEM_FIELD_WORDS]; 14286 int rv = BCM_E_NONE; 14287 bcm_mac_t mac_addr; 14288 uint32 priorityVal = 0; 14289 _field_control_t *fc; /* Unit field control information. */ 14290 14291 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 14292 if (NULL == fa || fa->hw_index >= fc->_fp_egr_ifp_mod_fields_size) { 14293 return (BCM_E_PARAM); 14294 } 14295 rv = READ_EGR_IFP_MOD_FIELDSm(unit, MEM_BLOCK_ANY, 14296 fa->hw_index, &tbl_entry); 14297 if(BCM_FAILURE(rv)) { 14298 return BCM_E_UNAVAIL; 14299 } 14300 switch (fa->action) { 14301 case bcmFieldActionReplaceSrcMac: 14302 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14303 &tbl_entry, CHANGE_MAC_SAf,1); 14304 SAL_MAC_ADDR_FROM_UINT32(mac_addr,fa->param); 14305 soc_mem_mac_addr_set(unit, EGR_IFP_MOD_FIELDSm, 14306 &tbl_entry, MAC_SAf, mac_addr); 14307 break; 14308 case bcmFieldActionReplaceDstMac: 14309 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14310 &tbl_entry, CHANGE_MAC_DAf,1); 14311 SAL_MAC_ADDR_FROM_UINT32(mac_addr,fa->param); 14312 soc_mem_mac_addr_set(unit, EGR_IFP_MOD_FIELDSm, 14313 &tbl_entry, MAC_DAf, mac_addr); 14314 break; 14315 case bcmFieldActionReplaceInnerVlan: 14316 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14317 &tbl_entry, CHANGE_INNER_VLANf,1); 14318 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14319 &tbl_entry, INNER_VLANf, fa->param[0]); 14320 break; 14321 case bcmFieldActionReplaceOuterVlan: 14322 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14323 &tbl_entry, CHANGE_OUTER_VLANf,1); 14324 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14325 &tbl_entry, OUTER_VLANf, fa->param[0]); 14326 break; 14327 case bcmFieldActionReplaceInnerVlanPriority: 14328 if(fa->param[0] == BCM_FIELD_REPLACE_VLAN_PRIORITY) { 14329 priorityVal = (fa->param[1]) << 1; 14330 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14331 &tbl_entry, IPRI_ICFI_SELf,1); 14332 } else if (fa->param[0] == 14333 BCM_FIELD_REPLACE_VLAN_PRIORITY_USE_INTERNAL_CFI) { 14334 priorityVal = (fa->param[1]) << 1; 14335 priorityVal = priorityVal | 1; 14336 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14337 &tbl_entry, IPRI_ICFI_SELf,1); 14338 14339 } else { 14340 priorityVal =0; 14341 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14342 &tbl_entry, IPRI_ICFI_SELf,2); 14343 } 14344 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14345 &tbl_entry, NEW_IPRI_ICFIf, priorityVal); 14346 break; 14347 case bcmFieldActionReplaceOuterVlanPriority: 14348 if(fa->param[0] == BCM_FIELD_REPLACE_VLAN_PRIORITY) { 14349 priorityVal = (fa->param[1]) << 1; 14350 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14351 &tbl_entry, OPRI_OCFI_SELf,1); 14352 } else if (fa->param[0] == 14353 BCM_FIELD_REPLACE_VLAN_PRIORITY_USE_INTERNAL_CFI) { 14354 priorityVal = (fa->param[1]) << 1; 14355 priorityVal = priorityVal | 1; 14356 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14357 &tbl_entry, OPRI_OCFI_SELf,1); 14358 } else { 14359 priorityVal =0; 14360 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14361 &tbl_entry, OPRI_OCFI_SELf,2); 14362 } 14363 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14364 &tbl_entry, NEW_OPRI_OCFIf, priorityVal); 14365 break; 14366 default: 14367 return (BCM_E_PARAM); 14368 } /*end of switch */ 14369 rv = WRITE_EGR_IFP_MOD_FIELDSm(unit, MEM_BLOCK_ANY, 14370 fa->hw_index, &tbl_entry); 14371 if(BCM_FAILURE(rv)) { 14372 return BCM_E_UNAVAIL; 14373 } 14374 return BCM_E_NONE; 14375 } 14376 14377 /* 14378 * Function: 14379 * _bcm__field_tr3_action_replaceL2Fields_remove_HWEntries 14380 * Purpose: 14381 * remove entries from EGR_IFP_MOD_FIELDS table 14382 * Parameters: 14383 * unit - BCM device number 14384 * f_ent - Field entry structure 14385 * fa - (OUT) field action structure 14386 * Returns: 14387 * BCM_E_XXX 14388 * Notes: 14389 * For triumph3 and helix4 devices only. 14390 */ 14391 int _bcm__field_tr3_action_replaceL2Fields_remove_HWEntries( int unit, 14392 _field_entry_t *f_ent, 14393 _field_action_t *fa) { 14394 int rv = BCM_E_NONE; 14395 bcm_mac_t mac_addr; 14396 uint32 mac_addr_words[2]; 14397 uint32 tbl_entry[SOC_MAX_MEM_FIELD_WORDS]; 14398 int removeIndex; 14399 _field_action_t *fa_iter; /* Field entry actions iterator.*/ 14400 14401 if (NULL == fa || f_ent == NULL) { 14402 return (BCM_E_PARAM); 14403 } 14404 mac_addr_words[0] = 0; 14405 mac_addr_words[1] = 0; 14406 SAL_MAC_ADDR_FROM_UINT32(mac_addr,mac_addr_words); 14407 rv = READ_EGR_IFP_MOD_FIELDSm(unit, MEM_BLOCK_ANY, 14408 fa->hw_index, &tbl_entry); 14409 if(BCM_FAILURE(rv)) { 14410 return BCM_E_UNAVAIL; 14411 } 14412 switch (fa->action) { 14413 case bcmFieldActionReplaceSrcMac: 14414 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14415 &tbl_entry, CHANGE_MAC_SAf, 0); 14416 14417 soc_mem_mac_addr_set(unit, EGR_IFP_MOD_FIELDSm, 14418 &tbl_entry, MAC_SAf, mac_addr); 14419 break; 14420 case bcmFieldActionReplaceDstMac: 14421 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14422 &tbl_entry, CHANGE_MAC_DAf, 0); 14423 soc_mem_mac_addr_set(unit, EGR_IFP_MOD_FIELDSm, 14424 &tbl_entry, MAC_DAf, mac_addr); 14425 break; 14426 case bcmFieldActionReplaceInnerVlan: 14427 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14428 &tbl_entry, CHANGE_INNER_VLANf, 0); 14429 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14430 &tbl_entry, INNER_VLANf, 0); 14431 break; 14432 case bcmFieldActionReplaceOuterVlan: 14433 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14434 &tbl_entry, CHANGE_OUTER_VLANf,0); 14435 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14436 &tbl_entry, OUTER_VLANf, 0); 14437 break; 14438 case bcmFieldActionReplaceInnerVlanPriority: 14439 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14440 &tbl_entry, IPRI_ICFI_SELf, 0); 14441 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14442 &tbl_entry, NEW_IPRI_ICFIf, 0); 14443 break; 14444 case bcmFieldActionReplaceOuterVlanPriority: 14445 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14446 &tbl_entry, OPRI_OCFI_SELf, 0); 14447 soc_mem_field32_set(unit, EGR_IFP_MOD_FIELDSm, 14448 &tbl_entry, NEW_OPRI_OCFIf, 0); 14449 break; 14450 default: 14451 return (BCM_E_PARAM); 14452 } /*end of switch */ 14453 rv = WRITE_EGR_IFP_MOD_FIELDSm(unit, MEM_BLOCK_ANY, 14454 fa->hw_index, &tbl_entry); 14455 if(BCM_FAILURE(rv)) { 14456 return BCM_E_UNAVAIL; 14457 } 14458 /* clear the bit representing the index of EGR_IFP_MOD_FIELDS */ 14459 fa_iter = f_ent->actions; 14460 removeIndex = 0; 14461 while (fa_iter != NULL) { 14462 if( (fa_iter->flags & _FP_ACTION_VALID) && 14463 (fa_iter->action == bcmFieldActionReplaceSrcMac || 14464 fa_iter->action == bcmFieldActionReplaceDstMac || 14465 fa_iter->action == bcmFieldActionReplaceInnerVlan || 14466 fa_iter->action == bcmFieldActionReplaceOuterVlan || 14467 fa_iter->action == bcmFieldActionReplaceInnerVlanPriority || 14468 fa_iter->action == bcmFieldActionReplaceOuterVlanPriority) ) { 14469 removeIndex++; 14470 } 14471 fa_iter = fa_iter->next; 14472 } 14473 14474 if(removeIndex == 0) { 14475 _field_control_t *fc; /* Unit field control information. */ 14476 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 14477 SHR_BITCLR(fc->field_action_l2mod_index_bmp.w,fa->hw_index); 14478 } 14479 return BCM_E_NONE; 14480 } 14481 14482 #ifdef BCM_WARM_BOOT_SUPPORT 14483 14484 static soc_field_t _tr3_vfp_slice_wide_mode_field[4] = { 14485 SLICE_0_DOUBLE_WIDE_MODEf, 14486 SLICE_1_DOUBLE_WIDE_MODEf, 14487 SLICE_2_DOUBLE_WIDE_MODEf, 14488 SLICE_3_DOUBLE_WIDE_MODEf}; 14489 14490 /* 14491 * Function: 14492 * _bcm_field_tr3_meter_recover 14493 * 14494 * Purpose: 14495 * This routine recovers policer configuration from hardware 14496 * and reconstructs field entry's policer software structure 14497 * parameters 14498 * 14499 * Parameters: 14500 * unit - (IN) BCM device number 14501 * f_ent - (IN) Pointer to a field entry 14502 * part - (IN) Field entry's part number 14503 * pid - (IN) Policer ID 14504 * level - (IN) Policer Level(1-Macro/0-Micro) 14505 * policy_mem - (IN) Policy table memory name 14506 * policy_buf - (IN) Policy table entry buffer pointer 14507 * 14508 * Returns: 14509 * BCM_E_XXX 14510 */ 14511 int 14512 _bcm_field_tr3_meter_recover(int unit, 14513 _field_entry_t *f_ent, 14514 int part, 14515 bcm_policer_t pid, 14516 uint32 level, 14517 soc_mem_t policy_mem, 14518 uint32 *policy_buf, 14519 uint8 *already_recovered 14520 ) 14521 { 14522 _field_group_t *fg; /* Field group information. */ 14523 _field_stage_t *stage_fc; /* Field stage information. */ 14524 _field_control_t *fc; /* Unit field control information. */ 14525 _field_slice_t *fs; /* Field slice information. */ 14526 _field_policer_t *f_pl = NULL; /* Policer descriptor pointer type. */ 14527 _field_entry_policer_t *f_ent_pl; /* Policer attached to entry. */ 14528 int rv, policer_id, meter_hw_idx; /* Meter pair/flow meter hw index. */ 14529 int pool_index = _FP_INVALID_INDEX; /* Meter pool number. */ 14530 int hw_index = _FP_INVALID_INDEX; /* Pool local meter pair index. */ 14531 soc_field_t mpair_idx_f; /* Meter pair index field. */ 14532 soc_field_t modifier_f; /* Meter modifier field. */ 14533 soc_field_t pool_num_f; /* Meter modifier field. */ 14534 uint32 idx, found = 0; /* Policer hash idx; Policer found. */ 14535 uint32 flags = 0; /* Policer flags. */ 14536 uint32 meter_pair_mode = 0; /* Flow/SrTcm/TrTcm meter modes. */ 14537 uint32 modifier_mode = 0; /* Committed - 1/Excess meter - 0. */ 14538 uint32 meter_offset = 0; /* Even or Odd meter index. */ 14539 _field_meter_pool_t *f_mp = NULL; /* Meter pool information. */ 14540 _meter_config_t meter_conf; /* Meter configuration in hardware. */ 14541 soc_mem_t meter_mem = INVALIDm; /* Meter memory name. */ 14542 uint32 meter_sharing_mode = -1; /* Meter BW sharing mode */ 14543 _field_meter_pool_t *f_logical_mp = NULL; 14544 /* Logical Meter pool descriptor */ 14545 int logicalIdx = 0; 14546 uint8 logical_pool_idx = 0; 14547 /* Logical Meter pool index. */ 14548 14549 14550 14551 14552 fg = f_ent->group; 14553 fs = f_ent[part].fs; 14554 14555 sal_memset(&meter_conf, 0, sizeof(_meter_config_t)); 14556 14557 /* Get field control */ 14558 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 14559 14560 /* Get stage control */ 14561 rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc); 14562 BCM_IF_ERROR_RETURN(rv); 14563 14564 /* Retrieve meter config parameters from policy table and meter table. */ 14565 switch (fg->stage_id) { 14566 case _BCM_FIELD_STAGE_INGRESS: 14567 meter_mem = FP_METER_TABLEm; 14568 /* Get - Flow/SrTcm/TrTcm mode. */ 14569 if (level == 1) { 14570 /* meter BW/Sharing mode 0=OFF, 1=MIN, 2=MAX, 3=MIN+MAX */ 14571 if ((meter_sharing_mode = soc_mem_field32_get( 14572 unit, policy_mem, 14573 policy_buf, 14574 METER_SHARING_MODEf)) 14575 == 0) { 14576 return (BCM_E_NONE); 14577 } 14578 if (SOC_MEM_FIELD_VALID(unit, policy_mem, 14579 SHARED_METER_PAIR_MODEf)){ 14580 meter_pair_mode = soc_mem_field32_get 14581 (unit, policy_mem, 14582 policy_buf, SHARED_METER_PAIR_MODEf); 14583 } 14584 14585 /* Mode - Flow/TrTcmDs */ 14586 switch (meter_pair_mode) { 14587 case 0: 14588 meter_pair_mode = BCM_FIELD_METER_MODE_FLOW; 14589 break; 14590 case 1: 14591 meter_pair_mode = 4; 14592 /* no macro created yet */ 14593 break; 14594 default: 14595 return BCM_E_NONE; 14596 } 14597 mpair_idx_f = SHARED_METER_PAIR_POOL_INDEXf; 14598 modifier_f = METER_SHARING_MODE_MODIFIERf; 14599 pool_num_f = SHARED_METER_PAIR_POOL_NUMBERf; 14600 } else { 14601 if ((meter_pair_mode = soc_mem_field32_get 14602 (unit, policy_mem, 14603 policy_buf, METER_PAIR_MODEf)) 14604 == 0) { 14605 return (BCM_E_NONE); 14606 } 14607 mpair_idx_f = METER_PAIR_POOL_INDEXf; 14608 modifier_f = METER_PAIR_MODE_MODIFIERf; 14609 pool_num_f = METER_PAIR_POOL_NUMBERf; 14610 } 14611 14612 /* Get meter pair index value from policy table. */ 14613 hw_index = soc_mem_field32_get(unit, policy_mem, policy_buf, 14614 mpair_idx_f); 14615 14616 /* modifier_mode: 0 = Excess Meter, 1 = Committed Meter. */ 14617 modifier_mode = soc_mem_field32_get(unit, policy_mem, policy_buf, 14618 modifier_f); 14619 14620 /* Get meter pool number from policy table. */ 14621 pool_index = soc_mem_field32_get(unit, policy_mem, policy_buf, 14622 pool_num_f); 14623 14624 /* Determine meter offset value for flow meters. */ 14625 if (BCM_FIELD_METER_MODE_FLOW == meter_pair_mode) { 14626 meter_offset = (0 == modifier_mode) ? 0 : 1; 14627 } 14628 14629 /* Get meter pool info pointer. */ 14630 f_mp = stage_fc->meter_pool[_FP_DEF_INST][pool_index]; 14631 14632 /* Setup meter pool to entry slice mapping. */ 14633 if (_FP_INVALID_INDEX == f_mp->slice_id) { 14634 f_mp->slice_id = fg->slices->slice_number; 14635 f_mp->level = level; 14636 } 14637 break; 14638 14639 case _BCM_FIELD_STAGE_EGRESS: 14640 meter_mem = EFP_METER_TABLEm; 14641 14642 meter_conf.meter_mode = soc_mem_field32_get(unit, policy_mem, 14643 policy_buf, 14644 METER_PAIR_MODEf); 14645 meter_conf.meter_idx = soc_mem_field32_get(unit, policy_mem, 14646 policy_buf, 14647 METER_INDEX_EVENf); 14648 meter_conf.meter_update_odd = soc_mem_field32_get(unit, 14649 policy_mem, policy_buf, 14650 METER_UPDATE_ODDf); 14651 meter_conf.meter_test_odd = soc_mem_field32_get(unit, policy_mem, 14652 policy_buf, 14653 METER_TEST_ODDf); 14654 meter_conf.meter_update_even = soc_mem_field32_get(unit, 14655 policy_mem, policy_buf, 14656 METER_UPDATE_EVENf); 14657 meter_conf.meter_test_even = soc_mem_field32_get(unit, 14658 policy_mem, 14659 policy_buf, 14660 METER_TEST_EVENf); 14661 14662 /* Get - Flow/SrTcm/TrTcm mode. */ 14663 meter_pair_mode = meter_conf.meter_mode; 14664 14665 /* modifier_mode: 0 = Excess Meter, 1 = Committed Meter. */ 14666 if (BCM_FIELD_METER_MODE_FLOW == meter_pair_mode) { 14667 modifier_mode = (meter_conf.meter_update_even 14668 && meter_conf.meter_test_even) ? 0 : 1; 14669 meter_offset = (0 == modifier_mode) ? 0 : 1; 14670 } 14671 14672 /* Slice in which meter config resides. */ 14673 pool_index = fs->slice_number; 14674 14675 /* Slice meter pair index. */ 14676 hw_index = meter_conf.meter_idx; 14677 14678 if ((BCM_FIELD_METER_MODE_DEFAULT == meter_pair_mode) 14679 && (0 == hw_index)) { 14680 /* bcmPolicerModePassThrough */ 14681 return BCM_E_NONE; 14682 } 14683 break; 14684 14685 default: 14686 /* Must be a valid stage. */ 14687 return (BCM_E_INTERNAL); 14688 } 14689 14690 /* Check if meter index is already in use. */ 14691 if (BCM_SUCCESS(_field_trx_meter_index_in_use(unit, stage_fc, fs, 14692 f_mp, meter_pair_mode, meter_offset, hw_index))) { 14693 /* Policer has been detected - increment reference count */ 14694 /* Happens when policer is shared by different entries */ 14695 /* Search the hash to match against the HW index */ 14696 14697 found = 0; 14698 14699 for (idx = 0; idx < _FP_HASH_SZ(fc); idx++) { 14700 f_pl = fc->policer_hash[idx]; 14701 while (f_pl != NULL) { 14702 if ((f_pl->hw_index == hw_index) && 14703 (f_pl->pool_index == pool_index) && 14704 (f_pl->stage_id == fg->stage_id)) { 14705 if (meter_pair_mode == BCM_FIELD_METER_MODE_FLOW) { 14706 if (((modifier_mode == 1) && 14707 (_FP_POLICER_EXCESS_HW_METER(f_pl))) || 14708 ((modifier_mode == 0) && 14709 !(_FP_POLICER_EXCESS_HW_METER(f_pl)))) { 14710 f_pl = f_pl->next; 14711 continue; 14712 } else { 14713 found =1; 14714 break; 14715 } 14716 } else { 14717 found = 1; 14718 break; 14719 } 14720 } 14721 f_pl = f_pl->next; 14722 } 14723 if (found) { 14724 break; 14725 } 14726 } 14727 if (!found) { 14728 return BCM_E_INTERNAL; 14729 } 14730 f_pl->hw_ref_count++; 14731 f_pl->sw_ref_count++; 14732 } else { 14733 /* Policer does not exist => Allocate new policer object */ 14734 if (fc->l2warm) { 14735 policer_id = pid; 14736 } else { 14737 BCM_IF_ERROR_RETURN(_field_policer_id_alloc(unit, &policer_id)); 14738 } 14739 14740 _FP_XGS3_ALLOC(f_pl, sizeof (_field_policer_t), "Field policer entity"); 14741 if (f_pl == NULL) { 14742 return (BCM_E_MEMORY); 14743 } 14744 14745 flags |= _FP_POLICER_INSTALLED; 14746 if ((f_pl->level = level) == 1 && meter_sharing_mode == 1) { 14747 f_pl->cfg.flags |= BCM_POLICER_COLOR_MERGE_OR; 14748 } 14749 f_pl->sw_ref_count = 2; 14750 f_pl->hw_ref_count = 1; 14751 f_pl->pid = policer_id; 14752 f_pl->stage_id = fg->stage_id; 14753 f_pl->pool_index = pool_index; 14754 f_pl->cfg.pool_id = f_pl->pool_index; 14755 f_pl->hw_index = hw_index; 14756 f_pl->logical_pool_index = _FP_INVALID_INDEX; 14757 14758 /* Calculate hardware meter index. */ 14759 if (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) { 14760 /* 14761 * Hw index is: 14762 * ((Pool number * pool_size) + (2 * pair number) 14763 */ 14764 meter_hw_idx = (pool_index * 14765 stage_fc->meter_pool[_FP_DEF_INST][pool_index]->size) 14766 + (2 * hw_index); 14767 } else { 14768 /* 14769 * Hw index is: 14770 * (slice index) + (2 * pair number) 14771 */ 14772 meter_hw_idx = 14773 stage_fc->slices[_FP_DEF_INST][pool_index].start_tcam_idx 14774 + (2 * hw_index); 14775 } 14776 14777 switch (meter_pair_mode) { 14778 case BCM_FIELD_METER_MODE_DEFAULT: /* 0 */ 14779 f_pl->cfg.mode = bcmPolicerModeGreen; 14780 break; 14781 14782 case BCM_FIELD_METER_MODE_FLOW: /* 1 */ 14783 switch (fg->stage_id) { 14784 case _BCM_FIELD_STAGE_INGRESS: 14785 f_pl->cfg.mode = bcmPolicerModeCommitted; 14786 if (1 == modifier_mode) { 14787 /* Flow mode using committed hardware meter. */ 14788 _FP_POLICER_EXCESS_HW_METER_CLEAR(f_pl); 14789 } else if (0 == modifier_mode) { 14790 /* Flow mode using excess hardware meter. */ 14791 _FP_POLICER_EXCESS_HW_METER_SET(f_pl); 14792 } else { 14793 sal_free(f_pl); 14794 return BCM_E_INTERNAL; 14795 } 14796 14797 meter_hw_idx = 14798 (stage_fc->slices[_FP_DEF_INST][pool_index].start_tcam_idx * 2) 14799 + (2 * hw_index); 14800 14801 /* Update with meter_offset for flow mode meters. */ 14802 meter_hw_idx += meter_offset; 14803 14804 /* Get policer rates. */ 14805 _bcm_field_trx_meter_rate_burst_recover(unit, 14806 FP_METER_TABLEm, meter_hw_idx, 14807 &f_pl->cfg.ckbits_sec, 14808 &f_pl->cfg.ckbits_burst, 14809 &f_pl->cfg.flags); 14810 break; 14811 14812 case _BCM_FIELD_STAGE_EGRESS: 14813 if (meter_conf.meter_update_even) { 14814 meter_offset = 0; 14815 /* Flow mode using committed hardware meter. */ 14816 _FP_POLICER_EXCESS_HW_METER_CLEAR(f_pl); 14817 } else if (meter_conf.meter_update_odd) { 14818 meter_offset = 1; 14819 /* Flow mode using excess hardware meter. */ 14820 _FP_POLICER_EXCESS_HW_METER_SET(f_pl); 14821 } else { 14822 sal_free(f_pl); 14823 return BCM_E_INTERNAL; 14824 } 14825 14826 f_pl->cfg.mode = bcmPolicerModeCommitted; 14827 14828 /* Update with meter_offset for flow mode meters. */ 14829 meter_hw_idx += meter_offset; 14830 14831 /* Get policer rates. */ 14832 _bcm_field_trx_meter_rate_burst_recover(unit, 14833 EFP_METER_TABLEm, meter_hw_idx, 14834 &f_pl->cfg.ckbits_sec, 14835 &f_pl->cfg.ckbits_burst, 14836 &f_pl->cfg.flags); 14837 break; 14838 /* 14839 * COVERITY 14840 * 14841 * There are two more cases which needs to be handled. 14842 * It is kept intentionally as a defensive 14843 * default for future development. 14844 */ 14845 /* coverity[dead_error_begin : FALSE] */ 14846 default: 14847 /* Must be a valid pipeline stage. */ 14848 return (BCM_E_INTERNAL); 14849 } 14850 break; 14851 14852 case BCM_FIELD_METER_MODE_trTCM_COLOR_BLIND: /* 2 */ 14853 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 14854 /* Fall through */ 14855 case BCM_FIELD_METER_MODE_trTCM_COLOR_AWARE: /* 3 */ 14856 f_pl->cfg.mode = bcmPolicerModeTrTcm; 14857 14858 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 14859 meter_hw_idx, &f_pl->cfg.pkbits_sec, 14860 &f_pl->cfg.pkbits_burst, 14861 &f_pl->cfg.flags); 14862 14863 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 14864 meter_hw_idx + 1, &f_pl->cfg.ckbits_sec, 14865 &f_pl->cfg.ckbits_burst, 14866 &f_pl->cfg.flags); 14867 break; 14868 14869 case BCM_FIELD_METER_MODE_srTCM_COLOR_BLIND: /* 6 */ 14870 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 14871 /* Fall through */ 14872 case BCM_FIELD_METER_MODE_srTCM_COLOR_AWARE: /* 7 */ 14873 if (fg->stage_id == _BCM_FIELD_STAGE_EGRESS) { 14874 f_pl->cfg.mode = bcmPolicerModeSrTcm; 14875 } else { 14876 f_pl->cfg.mode = modifier_mode 14877 ? bcmPolicerModeSrTcmModified 14878 : bcmPolicerModeSrTcm; 14879 } 14880 14881 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 14882 meter_hw_idx, &f_pl->cfg.pkbits_sec, 14883 &f_pl->cfg.pkbits_burst, 14884 &f_pl->cfg.flags); 14885 14886 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 14887 meter_hw_idx + 1, &f_pl->cfg.ckbits_sec, 14888 &f_pl->cfg.ckbits_burst, 14889 &f_pl->cfg.flags); 14890 break; 14891 case 4: 14892 f_pl->cfg.flags |= BCM_POLICER_COLOR_BLIND; 14893 /* Fall through */ 14894 case 5: 14895 if (fg->stage_id != _BCM_FIELD_STAGE_EGRESS) { 14896 f_pl->cfg.mode = modifier_mode 14897 ? bcmPolicerModeCoupledTrTcmDs 14898 : bcmPolicerModeTrTcmDs; 14899 } else { 14900 f_pl->cfg.mode = bcmPolicerModeTrTcmDs; 14901 } 14902 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 14903 meter_hw_idx, &f_pl->cfg.pkbits_sec, 14904 &f_pl->cfg.pkbits_burst, 14905 &f_pl->cfg.flags); 14906 14907 _bcm_field_trx_meter_rate_burst_recover(unit, meter_mem, 14908 meter_hw_idx + 1, &f_pl->cfg.ckbits_sec, 14909 &f_pl->cfg.ckbits_burst, 14910 &f_pl->cfg.flags); 14911 14912 break; 14913 default: 14914 ; 14915 } 14916 14917 /* Assume policer was created using the policer_create API */ 14918 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 14919 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 14920 if ((part == 2) || (part == 3)) { 14921 f_ent->flags |= _FP_ENTRY_POLICER_IN_SECONDARY_SLICE; 14922 } 14923 } else { 14924 if (part == 1) { 14925 f_ent->flags |= _FP_ENTRY_POLICER_IN_SECONDARY_SLICE; 14926 } 14927 } 14928 } 14929 14930 _FP_HASH_INSERT(fc->policer_hash, f_pl, 14931 (policer_id & _FP_HASH_INDEX_MASK(fc))); 14932 fc->policer_count++; 14933 14934 /* Mark as used in the slice/pool */ 14935 if (fg->stage_id == _BCM_FIELD_STAGE_EGRESS) { 14936 _FP_METER_BMP_ADD(fs->meter_bmp, meter_conf.meter_idx); 14937 } else { 14938 if (!_FP_POLICER_IS_FLOW_MODE(f_pl)) { 14939 _FP_METER_BMP_ADD(f_mp->meter_bmp, (f_pl->hw_index * 2)); 14940 _FP_METER_BMP_ADD(f_mp->meter_bmp, ((f_pl->hw_index * 2) + 1)); 14941 f_mp->free_meters -= 2; 14942 /* For Triumph3 devices f_mp->size = 1024*/ 14943 if (fc->ingress_logical_policer_pools_mode == 14944 bcmFieldIngressLogicalPolicerPools16x512Contiguous) { 14945 14946 if (((2 * f_pl->hw_index) < f_mp->size / 2) && (f_pl->hw_index >= 0)) { 14947 /*index 0~511 in a same logical pool*/ 14948 logical_pool_idx = f_pl->pool_index * 2; 14949 logicalIdx = f_pl->hw_index; 14950 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 14951 } else if (((2 * f_pl->hw_index) >= f_mp->size / 2) 14952 && (f_pl->hw_index < f_mp->size / 2)){ 14953 /*index 512~1023 in a same logical pool */ 14954 logical_pool_idx = f_pl->pool_index * 2 + 1; 14955 logicalIdx = (2 * f_pl->hw_index) % (f_mp->size / 2); 14956 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 14957 } else { 14958 return BCM_E_INTERNAL; 14959 } 14960 14961 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, (logicalIdx * 2)); 14962 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, ((logicalIdx * 2) + 1)); 14963 f_logical_mp->free_meters -= 2; 14964 f_pl->logical_pool_index = logical_pool_idx; 14965 } 14966 if (fc->ingress_logical_policer_pools_mode == 14967 bcmFieldIngressLogicalPolicerPools16x512Split) { 14968 if (((2 * f_pl->hw_index) < f_mp->size / 2) && (f_pl->hw_index >= 0)) { 14969 /*index 0~511 in a same logical pool*/ 14970 logical_pool_idx = f_pl->pool_index; 14971 logicalIdx = f_pl->hw_index; 14972 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 14973 } else if (((2 * f_pl->hw_index) >= f_mp->size / 2) 14974 && (f_pl->hw_index < f_mp->size / 2)){ 14975 /*index 512~1023 in a same logical pool */ 14976 logical_pool_idx = f_pl->pool_index + 8; 14977 logicalIdx = (2 * f_pl->hw_index) % (f_mp->size / 2); 14978 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 14979 } else { 14980 return BCM_E_INTERNAL; 14981 } 14982 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, (logicalIdx * 2)); 14983 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, ((logicalIdx * 2) + 1)); 14984 f_logical_mp->free_meters -= 2; 14985 f_pl->logical_pool_index = logical_pool_idx; 14986 } 14987 14988 } else { 14989 _FP_METER_BMP_ADD(f_mp->meter_bmp, ((f_pl->hw_index * 2) + meter_offset)); 14990 f_mp->free_meters--; 14991 14992 if (fc->ingress_logical_policer_pools_mode == 14993 bcmFieldIngressLogicalPolicerPools16x512Contiguous) { 14994 if (((2 * f_pl->hw_index) < f_mp->size / 2) && (f_pl->hw_index >= 0)) { 14995 /*index 0~511 in a same logical pool*/ 14996 logical_pool_idx = f_pl->pool_index * 2; 14997 logicalIdx = f_pl->hw_index; 14998 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 14999 } else if (((2 * f_pl->hw_index) >= f_mp->size / 2) 15000 && (f_pl->hw_index < f_mp->size / 2)){ 15001 /*index 512~1023 in a same logical pool */ 15002 logical_pool_idx = f_pl->pool_index * 2 + 1; 15003 logicalIdx = (2 * f_pl->hw_index) % (f_mp->size / 2); 15004 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 15005 } else { 15006 return BCM_E_INTERNAL; 15007 } 15008 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, (logicalIdx * 2) + meter_offset); 15009 f_logical_mp->free_meters--; 15010 f_pl->logical_pool_index = logical_pool_idx; 15011 } 15012 if (fc->ingress_logical_policer_pools_mode == 15013 bcmFieldIngressLogicalPolicerPools16x512Split) { 15014 if (((2 * f_pl->hw_index) < f_mp->size / 2) && (f_pl->hw_index >= 0)) { 15015 /*index 0~511 in a same logical pool*/ 15016 logical_pool_idx = f_pl->pool_index; 15017 logicalIdx = f_pl->hw_index; 15018 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 15019 } else if (((2 * f_pl->hw_index) >= f_mp->size / 2) 15020 && (f_pl->hw_index < f_mp->size / 2)){ 15021 /*index 512~1023 in a same logical pool */ 15022 logical_pool_idx = f_pl->pool_index + 8; 15023 logicalIdx = (2 * f_pl->hw_index) % (f_mp->size / 2); 15024 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 15025 } else { 15026 return BCM_E_INTERNAL; 15027 } 15028 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, ((logicalIdx * 2) + meter_offset)); 15029 f_logical_mp->free_meters--; 15030 f_pl->logical_pool_index = logical_pool_idx; 15031 } 15032 15033 } 15034 } 15035 15036 fg->group_status.meter_count++; 15037 } 15038 15039 /* Associate the policer object with the entry */ 15040 f_ent_pl = &f_ent->policer[level]; 15041 f_ent_pl->flags |= (_FP_POLICER_VALID | flags); 15042 f_ent_pl->pid = f_pl->pid; 15043 *already_recovered = 1; 15044 15045 return BCM_E_NONE; 15046 } 15047 15048 /* 15049 * Function: 15050 * _field_tr3_ext_part_mems 15051 * Purpose: 15052 * Get policy mem, data mem and mask mem 15053 * Parameters: 15054 * unit - (IN) BCM device number 15055 * part_idx - (IN) Slice id 15056 * mems - (OUT) mems 15057 * Returns: 15058 * BCM_E_XXX 15059 */ 15060 STATIC int 15061 _field_tr3_ext_part_mems(int unit, unsigned part_idx, soc_mem_t *mems) 15062 { 15063 /* mems[0] = policy mem 15064 mems[1] = data mem or data-and-mask mem 15065 mems[2] = mask mem or INVALIDm 15066 */ 15067 soc_mem_t *policy_mem=&mems[0], *tcam_data_mem=&mems[1], *tcam_mask_mem=&mems[2]; 15068 15069 /* ACL partition range check */ 15070 if (part_idx >= _FP_EXT_NUM_PARTITIONS) { 15071 return (BCM_E_INTERNAL); 15072 } 15073 /* mem validity check */ 15074 if (!mems) { 15075 return (BCM_E_INTERNAL); 15076 } 15077 15078 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_mem(unit, part_idx, policy_mem)); 15079 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_data_mem(unit, part_idx, tcam_data_mem)); 15080 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_mask_mem(unit, part_idx, tcam_mask_mem)); 15081 15082 return(BCM_E_NONE); 15083 } 15084 15085 /* 15086 * Function: 15087 * _bcm_esw_field_tr3_ext_scache_size 15088 * Purpose: 15089 * This function returns the configured internal scache size for a given external 15090 * Slice ID 15091 * Parameters: 15092 * unit - (IN) BCM device number 15093 * part_idx - (IN) Slice id 15094 * Returns: 15095 * Configured scache size 15096 */ 15097 int 15098 _bcm_esw_field_tr3_ext_scache_size(int unit, 15099 unsigned part_idx 15100 ) 15101 { 15102 soc_mem_t mems[3]; 15103 15104 BCM_IF_ERROR_RETURN(_field_tr3_ext_part_mems(unit, part_idx, mems)); 15105 return (_field_trx_ext_scache_size(unit, part_idx, mems)); 15106 } 15107 15108 /* 15109 * Function: 15110 * _field_tr3_ext_scache_sync_chk 15111 * Purpose: 15112 * For each slice check the configured internal scache size, and return TRUE 15113 * if configured and FALSE if not configured 15114 * Parameters: 15115 * unit - (IN) BCM device number 15116 * fc - (IN) Pointer to device field control structure 15117 * stage_fc - (IN) FP stage control info. 15118 * Returns: 15119 * TRUE / FALSE 15120 */ 15121 STATIC int 15122 _field_tr3_ext_scache_sync_chk(int unit, 15123 _field_control_t *fc, 15124 _field_stage_t *stage_fc 15125 ) 15126 { 15127 unsigned slice_idx; 15128 for (slice_idx = 0; slice_idx < _FP_EXT_NUM_PARTITIONS; ++slice_idx) { 15129 if (_bcm_esw_field_tr3_ext_scache_size(unit, slice_idx) != 0) { 15130 return (TRUE); 15131 } 15132 } 15133 return (FALSE); 15134 } 15135 15136 /* 15137 * Function: 15138 * _bcm_field_tr3_scache_sync 15139 * 15140 * Purpose: 15141 * Save field module software state to external cache. 15142 * 15143 * Parameters: 15144 * unit - (IN) BCM device number 15145 * fc - (IN) Pointer to device field control structure 15146 * stage_fc - (IN) FP stage control info. 15147 * 15148 * Returns: 15149 * BCM_E_XXX 15150 */ 15151 int 15152 _bcm_field_tr3_scache_sync(int unit, 15153 _field_control_t *fc, 15154 _field_stage_t *stage_fc 15155 ) 15156 { 15157 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 15158 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 15159 uint32 start_char, end_char; 15160 uint32 val; 15161 uint64 rval; 15162 int slice_idx, range_count = 0; 15163 int rv = BCM_E_NONE; 15164 int efp_slice_mode, paired = 0; 15165 _field_slice_t *fs; 15166 _field_group_t *fg; 15167 _field_data_control_t *data_ctrl; 15168 _field_range_t *fr; 15169 fp_port_field_sel_entry_t pfs; 15170 soc_field_t fld; 15171 int ratio = 0; 15172 int idx; 15173 _field_entry_t *f_ent; 15174 _field_meter_pool_t *f_logical_mp; 15175 15176 soc_field_t _fb2_slice_pairing_field[8] = { 15177 SLICE1_0_PAIRINGf, SLICE3_2_PAIRINGf, 15178 SLICE5_4_PAIRINGf, SLICE7_6_PAIRINGf, 15179 SLICE9_8_PAIRINGf, SLICE11_10_PAIRINGf, 15180 SLICE13_12_PAIRINGf, SLICE15_14_PAIRINGf}; 15181 soc_field_t _efp_slice_mode[] = {SLICE_0_MODEf, SLICE_1_MODEf, 15182 SLICE_2_MODEf, SLICE_3_MODEf}; 15183 15184 switch (stage_fc->stage_id) { 15185 case _BCM_FIELD_STAGE_INGRESS: 15186 start_char = _FIELD_IFP_DATA_START; 15187 end_char = _FIELD_IFP_DATA_END; 15188 break; 15189 case _BCM_FIELD_STAGE_EGRESS: 15190 start_char = _FIELD_EFP_DATA_START; 15191 end_char = _FIELD_EFP_DATA_END; 15192 break; 15193 case _BCM_FIELD_STAGE_LOOKUP: 15194 start_char = _FIELD_VFP_DATA_START; 15195 end_char = _FIELD_VFP_DATA_END; 15196 break; 15197 case _BCM_FIELD_STAGE_EXTERNAL: 15198 if (_field_tr3_ext_scache_sync_chk(unit, fc, stage_fc)) { 15199 LOG_ERROR(BSL_LS_BCM_FP, \ 15200 (BSL_META_U(unit, \ 15201 "Configuration of scache size not supported \ 15202 for external stage\n"))); 15203 return(BCM_E_CONFIG); 15204 } 15205 start_char = _FIELD_EXTFP_DATA_START; 15206 end_char = _FIELD_EXTFP_DATA_END; 15207 break; 15208 default: 15209 return BCM_E_PARAM; 15210 } 15211 15212 LOG_DEBUG(BSL_LS_BCM_FP, 15213 (BSL_META_U(unit, 15214 "FP(unit %d) vverb: _bcm_field_tr3_scache_sync() - Synching scache" 15215 " for FP stage %d...\n"), unit, stage_fc->stage_id)); 15216 15217 _field_scache_stage_hdr_save(fc, start_char); 15218 15219 /* Save the range check IDs */ 15220 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 15221 fr = stage_fc->ranges; 15222 while (fr) { 15223 fr = fr->next; 15224 range_count++; 15225 } 15226 buf[fc->scache_pos] = (uint8)range_count; 15227 fc->scache_pos++; 15228 if (range_count) { 15229 fr = stage_fc->ranges; 15230 while (fr) { 15231 buf[fc->scache_pos] = fr->rid & 0xFF; 15232 fc->scache_pos++; 15233 buf[fc->scache_pos] = (fr->rid >> 8) & 0xFF; 15234 fc->scache_pos++; 15235 buf[fc->scache_pos] = (fr->rid >> 16) & 0xFF; 15236 fc->scache_pos++; 15237 buf[fc->scache_pos] = (fr->rid >> 24) & 0xFF; 15238 fc->scache_pos++; 15239 fr = fr->next; 15240 } 15241 } 15242 /* ingress_logical_policer_pools_mode is synced twice. 15243 * It has to be synced at the beggining of the ingress 15244 * before slice recovery is done. 15245 * Hence syncing it here again. 15246 */ 15247 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_23) { 15248 buf[fc->scache_pos] = fc->ingress_logical_policer_pools_mode; 15249 fc->scache_pos++; 15250 } 15251 } 15252 15253 /* Save data qualifiers */ 15254 if ((stage_fc->stage_id != _BCM_FIELD_STAGE_EXTERNAL) && 15255 ((data_ctrl = stage_fc->data_ctrl) != 0)) { 15256 if (soc_mem_is_valid(unit, FP_UDF_TCAMm)) { 15257 /* Device has UDF TCAM => 15258 Save internal information regarding TCAM entry usage 15259 */ 15260 15261 _field_data_tcam_entry_t *p; 15262 unsigned n; 15263 15264 for (p = data_ctrl->tcam_entry_arr, 15265 n = soc_mem_index_count(unit, FP_UDF_TCAMm); 15266 n; 15267 --n, ++p 15268 ) { 15269 buf[fc->scache_pos] = p->ref_count; 15270 fc->scache_pos++; 15271 } 15272 } 15273 15274 _field_scache_sync_data_quals_write(fc, data_ctrl); 15275 } 15276 15277 _field_slice_map_write(unit, fc, stage_fc); 15278 15279 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 15280 LOG_DEBUG(BSL_LS_BCM_FP, 15281 (BSL_META_U(unit, 15282 "FP(unit %d) vverb: _bcm_field_tr3_scache_sync() - " 15283 "Checking slice %d...\n"), unit, slice_idx)); 15284 /* Skip slices without groups */ 15285 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 15286 fg = fc->groups; 15287 while (fg != NULL) { 15288 if (fg->stage_id != stage_fc->stage_id) { 15289 fg = fg->next; 15290 continue; /* Not in this stage */ 15291 } 15292 if (fg->slices[0].slice_number == slice_idx) { 15293 break; 15294 } 15295 fg = fg->next; 15296 } 15297 15298 if (fg == NULL) { 15299 continue; /* No group found */ 15300 } 15301 15302 /* Also skip expanded slices */ 15303 if ((stage_fc->slices[_FP_DEF_INST] + slice_idx)->prev != NULL) { 15304 continue; 15305 } 15306 15307 paired = 0; 15308 15309 /* Ignore secondary slice in paired mode */ 15310 switch (stage_fc->stage_id) { 15311 case _BCM_FIELD_STAGE_INGRESS: 15312 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 15313 FP_PORT_FIELD_SELm, 15314 MEM_BLOCK_ANY, 15315 0, 15316 &pfs)); 15317 fld = _fb2_slice_pairing_field[slice_idx / 2]; 15318 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit, 15319 &pfs, 15320 fld); 15321 break; 15322 case _BCM_FIELD_STAGE_EGRESS: 15323 BCM_IF_ERROR_RETURN(READ_EFP_SLICE_CONTROLr(unit, &val)); 15324 efp_slice_mode = soc_reg_field_get(unit, 15325 EFP_SLICE_CONTROLr, 15326 val, 15327 _efp_slice_mode[slice_idx]); 15328 if ((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE) 15329 || (efp_slice_mode 15330 == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY) 15331 || (efp_slice_mode 15332 == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6)) { 15333 paired = 1; 15334 } 15335 break; 15336 case _BCM_FIELD_STAGE_LOOKUP: 15337 BCM_IF_ERROR_RETURN(READ_VFP_KEY_CONTROL_1r(unit, &rval)); 15338 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 15339 paired = soc_reg64_field32_get(unit, 15340 VFP_KEY_CONTROL_1r, 15341 rval, 15342 fld); 15343 break; 15344 case _BCM_FIELD_STAGE_EXTERNAL: 15345 paired = 0; 15346 break; 15347 default: 15348 return BCM_E_PARAM; 15349 break; 15350 } 15351 if (paired && (slice_idx % 2)) { 15352 continue; 15353 } 15354 BCM_IF_ERROR_RETURN 15355 (_field_tr2_group_entry_write(unit, _FP_DEF_INST, 15356 slice_idx, fs, fc, stage_fc)); 15357 } 15358 15359 /* Now sync the expanded slices */ 15360 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 15361 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 15362 /* Skip empty slices */ 15363 if (fs->entry_count == fs->free_count) { 15364 LOG_DEBUG(BSL_LS_BCM_FP, 15365 (BSL_META_U(unit, 15366 "FP(unit %d) vverb: _bcm_field_tr3_scache_sync() -" 15367 " Slice is empty.\n"), unit)); 15368 continue; 15369 } 15370 15371 /* Skip master slices */ 15372 if (stage_fc->slices[_FP_DEF_INST][slice_idx].prev == NULL) { 15373 continue; 15374 } 15375 15376 /* 15377 * Skip expanded slices with no entries installed in Hw 15378 * to match recovery logic. 15379 */ 15380 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 15381 ratio = 2; 15382 } else { 15383 ratio = 1; 15384 } 15385 15386 for (idx = 0; idx < fs->entry_count / ratio; idx++) { 15387 /* Find EID that matches this HW index */ 15388 f_ent = fs->entries[idx]; 15389 if (f_ent == NULL) { 15390 continue; 15391 } 15392 if (!(f_ent->flags & _FP_ENTRY_INSTALLED)) { 15393 continue; 15394 } 15395 break; 15396 } 15397 15398 if (idx == (fs->entry_count / ratio)) { 15399 continue; 15400 } 15401 15402 paired = 0; 15403 15404 /* Ignore secondary slice in paired mode */ 15405 switch (stage_fc->stage_id) { 15406 case _BCM_FIELD_STAGE_INGRESS: 15407 BCM_IF_ERROR_RETURN 15408 (soc_mem_read(unit, 15409 FP_PORT_FIELD_SELm, 15410 MEM_BLOCK_ANY, 15411 0, 15412 &pfs)); 15413 fld = _fb2_slice_pairing_field[slice_idx / 2]; 15414 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit, 15415 &pfs, 15416 fld); 15417 break; 15418 case _BCM_FIELD_STAGE_EGRESS: 15419 BCM_IF_ERROR_RETURN(READ_EFP_SLICE_CONTROLr(unit, &val)); 15420 efp_slice_mode = soc_reg_field_get(unit, 15421 EFP_SLICE_CONTROLr, 15422 val, 15423 _efp_slice_mode[slice_idx]); 15424 if ((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE) 15425 || (efp_slice_mode 15426 == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY) 15427 || (efp_slice_mode 15428 == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6)) { 15429 paired = 1; 15430 } 15431 break; 15432 case _BCM_FIELD_STAGE_LOOKUP: 15433 BCM_IF_ERROR_RETURN(READ_VFP_KEY_CONTROL_1r(unit, &rval)); 15434 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 15435 paired = soc_reg64_field32_get(unit, 15436 VFP_KEY_CONTROL_1r, 15437 rval, 15438 fld); 15439 break; 15440 case _BCM_FIELD_STAGE_EXTERNAL: 15441 paired = 0; 15442 break; 15443 default: 15444 return BCM_E_PARAM; 15445 break; 15446 } 15447 if (paired && (slice_idx % 2)) { 15448 continue; 15449 } 15450 BCM_IF_ERROR_RETURN 15451 (_field_tr2_group_entry_write(unit, _FP_DEF_INST, 15452 slice_idx, fs, fc, stage_fc)); 15453 } 15454 15455 /* Bumping up the ingress_logical_policer_pools_mode by 15456 * (stage_fc->tcam_slices * 2) during sync and must be 15457 * subracted during recovery. 15458 * This is done for the following reason :- 15459 * When no groups are installed,the last scache buf[fc->scache_pos] 15460 * value is 0xEF. 15461 * The _field_trx_scache_slice_group_recover function (last recovery 15462 * function) expects the buf[fc->scache_pos] value as 15463 * (slice_number * 2) or 0xEF. 15464 * The valid ingress_logical_policer_pools_mode values are 0,1,2. 15465 * _field_trx_scache_slice_group_recover functions sees this as valid 15466 * group number and tries to recover the group and its entries. This leads 15467 * to undefined behaviour.Hence the values are bumped up by 15468 * (2 * maximum tcam) slices 15469 */ 15470 15471 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 15472 /* Saving the ingress logical policer pool mode*/ 15473 if (((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_4) ) { 15474 LOG_DEBUG(BSL_LS_BCM_FP, 15475 (BSL_META_U(unit, 15476 "FP(unit %d) vverb: _bcm_field_tr3_scache_sync() -" 15477 " Writing Ingress Logical Policer Pool Info at scache" 15478 " position %d\n"), unit, (fc->scache_pos))); 15479 buf[fc->scache_pos] = (stage_fc->tcam_slices * 2) 15480 + fc->ingress_logical_policer_pools_mode; 15481 fc->scache_pos++; 15482 } 15483 15484 15485 15486 /* Saving logical meter pool info */ 15487 15488 for (idx = 0; idx < stage_fc->num_logical_meter_pools; idx++) { 15489 f_logical_mp = stage_fc->logical_meter_pool[idx]; 15490 if (NULL == f_logical_mp) { 15491 return (BCM_E_INTERNAL); 15492 } 15493 15494 if (f_logical_mp->slice_id == _FP_INVALID_INDEX) { 15495 fc->scache_pos++; 15496 continue; 15497 } 15498 15499 buf[fc->scache_pos] = 0x80; 15500 /* Use 6th bit to specify the meter level */ 15501 buf[fc->scache_pos] |= (f_logical_mp->level << 6); 15502 /* Use remaining to store the slice_id*/ 15503 buf[fc->scache_pos] += f_logical_mp->slice_id; 15504 15505 fc->scache_pos++; 15506 } 15507 } 15508 15509 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_15) { 15510 /* Mark end of Slice Info */ 15511 buf[fc->scache_pos] = _FP_WB_END_OF_SLICES; 15512 fc->scache_pos++; 15513 } 15514 15515 /* Sync EgressPortsAdd Workaround Information */ 15516 if (soc_feature(unit, soc_feature_epc_linkflap_recover)) { 15517 BCM_IF_ERROR_RETURN (_field_egr_ports_recovery_scache_sync 15518 (unit, fc, stage_fc, &buf[fc->scache_pos])); 15519 } 15520 15521 if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_15) { 15522 /* Group Slice Selectors */ 15523 BCM_IF_ERROR_RETURN(_field_group_slice_selectors_sync(unit, 15524 &buf[fc->scache_pos], stage_fc->stage_id)); 15525 } 15526 LOG_DEBUG(BSL_LS_BCM_FP, 15527 (BSL_META_U(unit, 15528 "FP(unit %d) vverb: _bcm_field_tr3_scache_sync() -" 15529 " Writing end of section @ byte %d.\n"), unit, fc->scache_pos)); 15530 15531 /* Mark the end of the IFP section */ 15532 buf[fc->scache_pos] = end_char & 0xFF; 15533 fc->scache_pos++; 15534 buf[fc->scache_pos] = (end_char >> 8) & 0xFF; 15535 fc->scache_pos++; 15536 buf[fc->scache_pos] = (end_char >> 16) & 0xFF; 15537 fc->scache_pos++; 15538 buf[fc->scache_pos] = (end_char >> 24) & 0xFF; 15539 fc->scache_pos++; 15540 fc->scache_usage = fc->scache_pos; /* Usage in bytes */ 15541 15542 if(NULL != buf1) { 15543 /* Mark the end of the IFP section */ 15544 buf1[fc->scache_pos1] = end_char & 0xFF; 15545 fc->scache_pos1++; 15546 buf1[fc->scache_pos1] = (end_char >> 8) & 0xFF; 15547 fc->scache_pos1++; 15548 buf1[fc->scache_pos1] = (end_char >> 16) & 0xFF; 15549 fc->scache_pos1++; 15550 buf1[fc->scache_pos1] = (end_char >> 24) & 0xFF; 15551 fc->scache_pos1++; 15552 } 15553 15554 /* Check for overflow */ 15555 if (fc->scache_pos > fc->scache_size[_FIELD_SCACHE_PART_0]) { 15556 LOG_DEBUG(BSL_LS_BCM_FP, 15557 (BSL_META_U(unit, 15558 "FP(unit %d) Error: Current Scache Position[%u] exceeds Scache size[%u]\n"), 15559 unit, fc->scache_pos, fc->scache_size[_FIELD_SCACHE_PART_0])); 15560 return BCM_E_INTERNAL; 15561 } 15562 15563 if (buf1 != NULL) { 15564 if (fc->scache_pos1 > fc->scache_size[_FIELD_SCACHE_PART_1]) { 15565 LOG_DEBUG(BSL_LS_BCM_FP, 15566 (BSL_META_U(unit, 15567 "FP(unit %d) Error: Current Scache Position1[%u] exceeds Scache size[%u]\n"), 15568 unit, fc->scache_pos1, fc->scache_size[_FIELD_SCACHE_PART_1])); 15569 return BCM_E_INTERNAL; 15570 } 15571 } 15572 15573 return rv; 15574 } 15575 15576 /* 15577 * Function: 15578 * _field_tr3_ingress_entity_get 15579 * 15580 * Purpose: 15581 * Reconstruct's slice ingress entity selectors. 15582 * 15583 * Parameters: 15584 * unit - (IN) BCM device number 15585 * slice_idx - (IN) Slice number to enable 15586 * fp_gm_tcam_buf - (IN) TCAM entry 15587 * slice_ent_cnt - (IN) Number of entries in the slice 15588 * stage_fc - (IN) FP stage control info. 15589 * ingress_entity_sel - (OUT) Ingress entity selector value. 15590 * 15591 * Returns: 15592 * Nothing 15593 */ 15594 STATIC void 15595 _field_tr3_ingress_entity_get(int unit, 15596 int slice_idx, 15597 char *fp_gm_tcam_buf, 15598 int slice_ent_cnt, 15599 _field_stage_t *stage_fc, 15600 int8 *ingress_entity_sel) 15601 { 15602 fp_global_mask_tcam_entry_t *gm_tcam_entry; /* Global Mask TCAM entry. */ 15603 uint32 svp_valid = 0; 15604 int idx; 15605 15606 for (idx = 0; idx < slice_ent_cnt; idx++) { 15607 gm_tcam_entry = soc_mem_table_idx_to_pointer(unit, 15608 FP_GLOBAL_MASK_TCAMm, 15609 fp_global_mask_tcam_entry_t *, 15610 fp_gm_tcam_buf, 15611 idx + slice_ent_cnt * slice_idx 15612 ); 15613 if (soc_FP_GLOBAL_MASK_TCAMm_field32_get(unit, 15614 gm_tcam_entry, 15615 VALIDf 15616 ) 15617 != 0) { 15618 /* Get field entry SVP_VALID bit value. */ 15619 _field_extract((uint32 *)gm_tcam_entry, 15620 69, 15621 1, 15622 &svp_valid 15623 ); 15624 if (svp_valid) { 15625 *ingress_entity_sel = _bcmFieldFwdEntityMimGport; 15626 break; 15627 } 15628 } 15629 } 15630 return; 15631 } 15632 15633 /* 15634 * Function: 15635 * _field_tr3_loopback_type_sel_recover 15636 * 15637 * Purpose: 15638 * Retrieve slice TunnelType/LoopbackType settings from installed 15639 * field entry. 15640 * 15641 * Parameters: 15642 * unit - (IN) BCM device number 15643 * slice_idx - (IN) Slice number to enable 15644 * fp_gm_tcam_buf - (IN) TCAM entry 15645 * stage_fc - (IN) FP stage control info. 15646 * intraslice - (IN) Slice in Intra-Slice Double Wide mode. 15647 * tunnel_type_sel - (OUT) Tunnel Type configured in the entry. 15648 * 15649 * Returns: 15650 * Nothing 15651 */ 15652 STATIC int 15653 _field_tr3_loopback_type_sel_recover(int unit, 15654 int slice_idx, 15655 char *fp_gm_tcam_buf, 15656 _field_stage_t *stage_fc, 15657 int intraslice, 15658 int8 *loopback_type_sel) 15659 { 15660 fp_slice_map_entry_t fp_slice_map_buf; /* Slice map table entry. */ 15661 _field_slice_t *fs; /* Pointer to Slice info. */ 15662 _field_control_t *fc; /* Pointer to field control */ 15663 fp_global_mask_tcam_entry_t *gm_tcam_entry; /* Global Mask TCAM entry. */ 15664 uint32 tunnel_loopback_type = 0; /* Selector Hw value. */ 15665 int slice_ent_cnt; /* No. of entries in slice. */ 15666 int idx; /* Slice index. */ 15667 int vmap_size, index; /* Virtual Map entry size. */ 15668 int virtual_group = -1; /* Virtual Group ID. */ 15669 int phy_slice; /* Physical slice value. */ 15670 15671 static const soc_field_t physical_slice[] = { 15672 VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15673 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15674 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15675 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15676 VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15677 VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15678 VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15679 VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15680 VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15681 VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15682 VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15683 VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15684 VIRTUAL_SLICE_12_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15685 VIRTUAL_SLICE_13_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15686 VIRTUAL_SLICE_14_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15687 VIRTUAL_SLICE_15_PHYSICAL_SLICE_NUMBER_ENTRY_0f, 15688 VIRTUAL_SLICE_16_PHYSICAL_SLICE_NUMBER_ENTRY_0f 15689 }, slice_group[] = { 15690 VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15691 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15692 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15693 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15694 VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15695 VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15696 VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15697 VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15698 VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15699 VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15700 VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15701 VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15702 VIRTUAL_SLICE_12_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15703 VIRTUAL_SLICE_13_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15704 VIRTUAL_SLICE_14_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15705 VIRTUAL_SLICE_15_VIRTUAL_SLICE_GROUP_ENTRY_0f, 15706 VIRTUAL_SLICE_16_VIRTUAL_SLICE_GROUP_ENTRY_0f 15707 }; 15708 15709 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 15710 15711 vmap_size = stage_fc->tcam_slices; 15712 if (fc->flags & _FP_EXTERNAL_PRESENT) { 15713 ++vmap_size; 15714 } 15715 15716 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 15717 FP_SLICE_MAPm, 15718 MEM_BLOCK_ANY, 15719 0, 15720 fp_slice_map_buf.entry_data 15721 ) 15722 ); 15723 15724 /* Get the virtual group id for given slice_idx. */ 15725 for (index = 0; index < vmap_size; index++) { 15726 phy_slice = soc_mem_field32_get(unit, 15727 FP_SLICE_MAPm, 15728 fp_slice_map_buf.entry_data, 15729 physical_slice[index]); 15730 if (slice_idx != phy_slice) { 15731 continue; 15732 } 15733 virtual_group = soc_mem_field32_get(unit, 15734 FP_SLICE_MAPm, 15735 fp_slice_map_buf.entry_data, 15736 slice_group[index]); 15737 break; 15738 } 15739 15740 /* Must be a valid virtual_group to proceed further. */ 15741 if (-1 == virtual_group) { 15742 return (BCM_E_INTERNAL); 15743 } 15744 15745 /* 15746 * For expanded group slices, check if any entry in 15747 * this slice has loopback_type_sel selector set. 15748 */ 15749 for (index = 0; index < vmap_size; index++) { 15750 if (virtual_group 15751 != soc_mem_field32_get(unit, 15752 FP_SLICE_MAPm, 15753 fp_slice_map_buf.entry_data, 15754 slice_group[index])) { 15755 continue; 15756 } 15757 15758 phy_slice = soc_mem_field32_get(unit, 15759 FP_SLICE_MAPm, 15760 fp_slice_map_buf.entry_data, 15761 physical_slice[index]); 15762 fs = stage_fc->slices[_FP_DEF_INST] + phy_slice; 15763 slice_ent_cnt = fs->entry_count; 15764 15765 if (intraslice) { 15766 slice_ent_cnt >>= 1; 15767 } 15768 15769 for (idx = 0; idx < slice_ent_cnt; idx++) { 15770 gm_tcam_entry = soc_mem_table_idx_to_pointer 15771 (unit, 15772 FP_GLOBAL_MASK_TCAMm, 15773 fp_global_mask_tcam_entry_t *, 15774 fp_gm_tcam_buf, 15775 idx + slice_ent_cnt * phy_slice 15776 ); 15777 if (soc_FP_GLOBAL_MASK_TCAMm_field32_get(unit, 15778 gm_tcam_entry, 15779 VALIDf 15780 ) != 0) { 15781 /* Extract Tunnel_Loopback_Type Info from gm_tcam_entry */ 15782 _field_extract((uint32 *)gm_tcam_entry, 15783 77, 15784 5, 15785 &tunnel_loopback_type 15786 ); 15787 switch (tunnel_loopback_type) { 15788 case 0x1: /* IP_TUNNEL */ 15789 case 0x2: /* MPLS_TUNNEL */ 15790 case 0x3: /* MIM_TUNNEL */ 15791 case 0x4: /* WLAN_CAPWAP_WTP2AC */ 15792 case 0x5: /* WLAN_CAPWAP_AC2AC */ 15793 case 0x6: /* AMT_TUNNEL */ 15794 case 0x7: /* TRILL_TUNNEL */ 15795 case 0x8: /* L2GRE_TUNNEL */ 15796 *loopback_type_sel = 1; 15797 break; 15798 case 0x10: /* MIM_LOOPBACK */ 15799 case 0x11: /* TRILL_NETWORK_PORT_LOOPBACK */ 15800 case 0x12: /* TRILL_ACCESS_PORT_LOOPBACK */ 15801 case 0x13: /* EP_MIRROR_LOOPBACK */ 15802 case 0x14: /* EP_REDIRECT_LOOPBACK */ 15803 case 0x15: /* DPI_SM_LOOPBACK */ 15804 case 0x16: /* MPLS_P2MP_LOOPBACK */ 15805 case 0x17: /* QCN_LOOPBACK */ 15806 case 0x18: /* WLAN_ENCAP_LOOPBACK */ 15807 case 0x19: /* WLAN_ENCAP_ENCRYPT_LOOPBACK */ 15808 case 0x1a: /* WLAN_DECAP_LOOPBACK */ 15809 case 0x1c: /* IFP_GENERIC */ 15810 case 0x1d: /* MPLS_EXTENDED_LOOKUP */ 15811 case 0x1e: /* L2GRE_LOOPBACK */ 15812 *loopback_type_sel = 0; 15813 break; 15814 default: 15815 ; 15816 } 15817 15818 if (*loopback_type_sel != _FP_SELCODE_DONT_CARE) { 15819 goto done; 15820 } 15821 } 15822 } 15823 } 15824 15825 done: 15826 return (BCM_E_NONE); 15827 } 15828 15829 /* 15830 * Function: 15831 * _bcm_field_tr3_counter_recover 15832 * 15833 * Purpose: 15834 * Reconstruct's an entry's STAT configuration. 15835 * Parameters: 15836 * unit - (IN) BCM device number 15837 * f_ent - (IN) Pointer to a field entry 15838 * policy_entry - (IN) Policy table entry 15839 * part - (IN) Entry part count 15840 * sid - (IN) Field STAT ID 15841 * 15842 * Returns: 15843 * BCM_E_XXX 15844 */ 15845 int 15846 _bcm_field_tr3_counter_recover(int unit, 15847 _field_entry_t *f_ent, 15848 uint32 *policy_entry, 15849 int part, 15850 bcm_field_stat_t sid 15851 ) 15852 { 15853 _field_group_t *fg; 15854 _field_stage_t *stage_fc; 15855 _field_stage_id_t stage_id; 15856 _field_control_t *fc; 15857 _field_stat_t *f_st = NULL; 15858 _field_entry_stat_t *f_ent_st = NULL; 15859 _field_cntr_pool_t *p = NULL; 15860 bcm_field_stat_t stat_arr[_bcmFieldStatCount]; 15861 uint8 nstat = 0; 15862 uint8 hw_entry_count = 0; 15863 uint8 cntr_pool_num; 15864 uint16 cntr_hw_mode; 15865 uint8 in_use = 0; 15866 uint8 bp; 15867 uint8 i; 15868 uint32 hw_bmap = 0; 15869 uint32 hw_idx; 15870 uint32 cntr_pool_idx; 15871 int rv, idx, stat_id, found = 0; 15872 15873 fg = f_ent->group; 15874 15875 /* Get field control and stage control */ 15876 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 15877 stage_id = f_ent->group->stage_id; 15878 15879 BCM_IF_ERROR_RETURN 15880 (_field_stage_control_get(unit, 15881 stage_id, 15882 &stage_fc)); 15883 15884 sal_memset(stat_arr, 0, sizeof(stat_arr)); 15885 15886 cntr_pool_num = soc_mem_field32_get (unit, 15887 FP_POLICY_TABLEm, 15888 policy_entry, 15889 COUNTER_POOL_NUMBERf); 15890 15891 cntr_pool_idx = soc_mem_field32_get(unit, 15892 FP_POLICY_TABLEm, 15893 policy_entry, 15894 COUNTER_POOL_INDEXf); 15895 cntr_hw_mode = (soc_mem_field32_get(unit, 15896 FP_POLICY_TABLEm, 15897 policy_entry, 15898 G_COUNTER_OFFSETf) 15899 | (soc_mem_field32_get(unit, 15900 FP_POLICY_TABLEm, 15901 policy_entry, 15902 Y_COUNTER_OFFSETf) << 2) 15903 | (soc_mem_field32_get(unit, 15904 FP_POLICY_TABLEm, 15905 policy_entry, 15906 R_COUNTER_OFFSETf) << 4)); 15907 15908 15909 _field_tr3_ingress_stat_hw_mode_to_bmap(unit, 15910 cntr_hw_mode, 15911 &hw_bmap, 15912 &hw_entry_count); 15913 /* Get the counter pool pointer for cntr_pool_num. */ 15914 p = stage_fc->cntr_pool[cntr_pool_num]; 15915 if (NULL == p) { 15916 return (BCM_E_INTERNAL); 15917 } 15918 15919 SHR_BITTEST_RANGE(p->cntr_bmp.w, cntr_pool_idx, hw_entry_count, in_use); 15920 15921 if (in_use) { 15922 for (idx = 0; idx < _FP_HASH_SZ(fc); idx++) { 15923 f_st = fc->stat_hash[idx]; 15924 while (f_st != NULL) { 15925 if ((f_st->hw_index == cntr_pool_idx) 15926 && (f_st->pool_index == cntr_pool_num) 15927 && (f_st->hw_mode == cntr_hw_mode) 15928 && (f_st->stage_id == stage_id)) { 15929 found = 1; 15930 break; 15931 } 15932 f_st = f_st->next; 15933 } 15934 if (found) { 15935 break; 15936 } 15937 } 15938 15939 if (!found) { 15940 return (BCM_E_INTERNAL); 15941 } 15942 15943 f_st->hw_ref_count++; 15944 f_st->sw_ref_count++; 15945 f_ent_st = &f_ent->statistic; 15946 } 15947 15948 if (!found) { 15949 /* Allocate new stat object */ 15950 if (fc->l2warm) { 15951 stat_id = sid; 15952 } else { 15953 BCM_IF_ERROR_RETURN(_bcm_field_stat_id_alloc(unit, &stat_id)); 15954 } 15955 _FP_XGS3_ALLOC(f_st, sizeof (_field_stat_t), "Field stat entity"); 15956 if (NULL == f_st) { 15957 return (BCM_E_MEMORY); 15958 } 15959 f_st->sw_ref_count = 2; 15960 f_st->hw_ref_count = 1; 15961 f_st->pool_index = cntr_pool_num; 15962 f_st->hw_index = cntr_pool_idx; 15963 f_st->sid = stat_id; 15964 f_st->stage_id = fg->stage_id; 15965 f_st->gid = fg->gid; 15966 f_st->hw_mode = cntr_hw_mode; 15967 f_ent_st = &f_ent->statistic; 15968 f_st->hw_entry_count = hw_entry_count; 15969 15970 /* 15971 * COVERITY 15972 * 15973 * _bcm_field_stat_e is internal counter type. 15974 * It is kept intentionally for future development. 15975 */ 15976 15977 for (bp = 0; bp < _bcmFieldStatCount; bp++) { 15978 if (hw_bmap & (1 << bp)) { 15979 /* coverity[mixed_enums] */ 15980 stat_arr[nstat] = bp; 15981 nstat++; 15982 } 15983 } 15984 15985 rv = _bcm_field_stat_array_init(unit, fc, f_st, nstat, stat_arr); 15986 if (BCM_FAILURE(rv)) { 15987 sal_free(f_st); 15988 return rv; 15989 } 15990 15991 if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) { 15992 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 15993 if ((part == 2) || (part == 3)) { 15994 f_ent->flags |= _FP_ENTRY_STAT_IN_SECONDARY_SLICE; 15995 } 15996 } else { 15997 if (part == 1) { 15998 f_ent->flags |= _FP_ENTRY_STAT_IN_SECONDARY_SLICE; 15999 } 16000 } 16001 } 16002 16003 _FP_HASH_INSERT(fc->stat_hash, 16004 f_st, 16005 (stat_id & _FP_HASH_INDEX_MASK(fc))); 16006 fc->stat_count++; 16007 16008 /* Mark counters as in use */ 16009 hw_idx = f_st->hw_index; 16010 for (i = 0; i < f_st->hw_entry_count; ++i, ++hw_idx) { 16011 SHR_BITSET(p->cntr_bmp.w, hw_idx); 16012 } 16013 p->free_cntrs -= f_st->hw_entry_count; 16014 16015 if (p->slice_id == _FP_INVALID_INDEX) { 16016 p->slice_id = fg->slices->slice_number; 16017 } 16018 16019 fg->group_status.counter_count++; 16020 } 16021 16022 /* Associate the stat object with the entry */ 16023 f_ent_st->flags |= (_FP_ENTRY_STAT_VALID | _FP_ENTRY_STAT_INSTALLED); 16024 f_ent_st->sid = f_st->sid; 16025 16026 return (BCM_E_NONE); 16027 } 16028 16029 /* 16030 * Function: 16031 * _field_tr3_slice_key_control_entry_recover 16032 * 16033 * Purpose: 16034 * Retrieve slice key control selector values. 16035 * Parameters: 16036 * unit - (IN) BCM device number 16037 * slice_num - (IN) slice number 16038 * sel - (OUT) retrieve slice key selectors 16039 * 16040 * Returns: 16041 * BCM_E_XXX 16042 */ 16043 STATIC int 16044 _field_tr3_slice_key_control_entry_recover(int unit, 16045 unsigned slice_num, 16046 _field_sel_t *sel 16047 ) 16048 { 16049 uint32 rval; 16050 16051 /* 16052 * Recover Src/Dst/Intf slice class selectors 16053 * and Aux_tag_1 and Aux_tag_2 selectors. 16054 */ 16055 BCM_IF_ERROR_RETURN 16056 (_field_tr2_slice_key_control_entry_recover(unit, 16057 slice_num, 16058 sel)); 16059 BCM_IF_ERROR_RETURN 16060 (soc_reg32_get(unit, 16061 IFP_KEY_CLASSID_SELECTr, 16062 REG_PORT_ANY, 16063 0, 16064 &rval 16065 ) 16066 ); 16067 16068 /* Src/Dest ClassID select for F1.0 key. */ 16069 if (0 == sel->fpf1) { 16070 sel->src_dest_class_f1_sel = (soc_reg_field_get(unit, 16071 IFP_KEY_CLASSID_SELECTr, 16072 rval, 16073 F1_0_SLICEf 16074 ) 16075 & (1 << slice_num) 16076 ); 16077 } else { 16078 sel->src_dest_class_f1_sel = _FP_SELCODE_DONT_CARE; 16079 } 16080 16081 /* Src/Dest ClassID select for F3.0 key. */ 16082 if (0 == sel->fpf3) { 16083 sel->src_dest_class_f3_sel = (soc_reg_field_get(unit, 16084 IFP_KEY_CLASSID_SELECTr, 16085 rval, 16086 F3_0_SLICEf 16087 ) 16088 & (1 << slice_num) 16089 ); 16090 } else { 16091 sel->src_dest_class_f3_sel = _FP_SELCODE_DONT_CARE; 16092 } 16093 16094 return (BCM_E_NONE); 16095 } 16096 16097 /* 16098 * Function: 16099 * _field_scache_logical_ingress_meter_pool_recover 16100 * 16101 * Purpose: 16102 * Retrieve Ingress Logical Meter Pool information. 16103 * Parameters: 16104 * unit - (IN) BCM device number 16105 * fc - (IN) Device field control structure pointer. 16106 * stage_fc - (IN) FP stage control info. 16107 * 16108 * Returns: 16109 * BCM_E_XXX 16110 */ 16111 int 16112 _field_scache_logical_ingress_meter_pool_recover (int unit, 16113 _field_control_t *fc, 16114 _field_stage_t *stage_fc) 16115 { 16116 int8 isLogicalPoolModeSplit = -1; 16117 int8 updateHigherMeter = -1; 16118 int logical_pool_idx = 0; 16119 int pool_idx = 0; 16120 int entryIdx = 0; 16121 int startIdx = 0; 16122 int endIdx = 0; 16123 int logicalIdx = 0; 16124 int physicalSliceId = 0; 16125 _field_meter_pool_t *f_mp; 16126 _field_meter_pool_t *f_logical_mp; 16127 16128 if (fc->ingress_logical_policer_pools_mode == 16129 bcmFieldIngressLogicalPolicerPools16x512Split) { 16130 isLogicalPoolModeSplit = TRUE; 16131 } else if (fc->ingress_logical_policer_pools_mode == 16132 bcmFieldIngressLogicalPolicerPools16x512Contiguous) { 16133 isLogicalPoolModeSplit = FALSE; 16134 } else { 16135 return (BCM_E_NONE); 16136 } 16137 16138 for (logical_pool_idx = 0; 16139 logical_pool_idx < stage_fc->num_logical_meter_pools; 16140 logical_pool_idx++) { 16141 f_logical_mp = stage_fc->logical_meter_pool[logical_pool_idx]; 16142 16143 if (f_logical_mp->slice_id == -1) 16144 continue; 16145 16146 if (isLogicalPoolModeSplit) { 16147 if (f_logical_mp->slice_id > 7) { 16148 updateHigherMeter = TRUE; 16149 physicalSliceId = f_logical_mp->slice_id - 8; 16150 } else { 16151 physicalSliceId = f_logical_mp->slice_id; 16152 updateHigherMeter = FALSE; 16153 } 16154 } else if (!isLogicalPoolModeSplit) { 16155 if ( f_logical_mp->slice_id % 2 == 0 ) { 16156 updateHigherMeter = FALSE; 16157 physicalSliceId = f_logical_mp->slice_id; 16158 } else { 16159 physicalSliceId = (f_logical_mp->slice_id) - 1 ; 16160 updateHigherMeter = TRUE; 16161 } 16162 } 16163 16164 for (pool_idx = 0; pool_idx < stage_fc->num_meter_pools; pool_idx++) { 16165 f_mp = stage_fc->meter_pool[_FP_DEF_INST][pool_idx]; 16166 16167 if (f_mp->slice_id == -1) { 16168 continue; 16169 } 16170 16171 if (f_mp->slice_id == physicalSliceId) { 16172 if (updateHigherMeter) { 16173 startIdx = f_mp->size/2; 16174 endIdx = f_mp->size; 16175 }else { 16176 startIdx = 0; 16177 endIdx = f_mp->size/2; 16178 } 16179 logicalIdx = 0; 16180 for (entryIdx = startIdx; entryIdx < endIdx; entryIdx++) { 16181 if (_FP_METER_BMP_TEST(f_mp->meter_bmp, entryIdx)) { 16182 _FP_METER_BMP_ADD(f_logical_mp->meter_bmp, logicalIdx); 16183 f_logical_mp->free_meters -= 1; 16184 } 16185 logicalIdx++; 16186 } 16187 } 16188 } 16189 } 16190 return (BCM_E_NONE); 16191 } 16192 16193 STATIC int 16194 _bcm_field_stage_ingress_tr3_logical_meter_idx_update (int unit, 16195 _field_control_t *fc, 16196 _field_stage_t *stage_fc) 16197 { 16198 int entry = 0; 16199 int level = 0; 16200 int rv = 0; 16201 uint8 logical_pool_idx = 0; 16202 _field_meter_pool_t *f_mp = NULL; 16203 _field_policer_t *f_pl = NULL; 16204 _field_entry_policer_t *f_ent_pl = NULL; 16205 _field_entry_t *f_ent = NULL; 16206 _field_group_t *fg = NULL; 16207 16208 fg = fc->groups; 16209 /* Traverse all groups */ 16210 while (fg != NULL) { 16211 if (_BCM_FIELD_STAGE_INGRESS != fg->stage_id) { 16212 fg = fg->next; 16213 continue; 16214 } 16215 for (entry = 0; entry < fg->group_status.entry_count; entry++){ 16216 f_ent = fg->entry_arr[entry]; 16217 for (level = 0; level < _FP_POLICER_LEVEL_COUNT; level++) { 16218 f_ent_pl = f_ent->policer + level; 16219 /* Read policer configuration.*/ 16220 rv = _bcm_field_policer_get(unit, f_ent_pl->pid, &f_pl); 16221 if (BCM_E_NOT_FOUND == rv) { 16222 continue; 16223 } 16224 f_mp = stage_fc->meter_pool[_FP_DEF_INST][f_pl->pool_index]; 16225 if (!_FP_POLICER_IS_FLOW_MODE(f_pl)) { 16226 /* For Triumph3 devices f_mp->size = 1024*/ 16227 if (fc->ingress_logical_policer_pools_mode == 16228 bcmFieldIngressLogicalPolicerPools16x512Contiguous) { 16229 16230 if (((2 * f_pl->hw_index) < f_mp->size / 2) && (f_pl->hw_index >= 0)) { 16231 /*index 0~511 in a same logical pool*/ 16232 logical_pool_idx = f_pl->pool_index * 2; 16233 } else if (((2 * f_pl->hw_index) >= f_mp->size / 2) 16234 && (f_pl->hw_index < f_mp->size / 2)){ 16235 /*index 512~1023 in a same logical pool */ 16236 logical_pool_idx = f_pl->pool_index * 2 + 1; 16237 } else { 16238 return BCM_E_INTERNAL; 16239 } 16240 16241 } 16242 if (fc->ingress_logical_policer_pools_mode == 16243 bcmFieldIngressLogicalPolicerPools16x512Split) { 16244 if (((2 * f_pl->hw_index) < f_mp->size / 2) && (f_pl->hw_index >= 0)) { 16245 /*index 0~511 in a same logical pool*/ 16246 logical_pool_idx = f_pl->pool_index; 16247 } else if (((2 * f_pl->hw_index) >= f_mp->size / 2) 16248 && (f_pl->hw_index < f_mp->size / 2)){ 16249 /*index 512~1023 in a same logical pool */ 16250 logical_pool_idx = f_pl->pool_index + 8; 16251 } else { 16252 return BCM_E_INTERNAL; 16253 } 16254 } 16255 16256 } else { 16257 if (fc->ingress_logical_policer_pools_mode == 16258 bcmFieldIngressLogicalPolicerPools16x512Contiguous) { 16259 if (((2 * f_pl->hw_index) < f_mp->size / 2) && (f_pl->hw_index >= 0)) { 16260 /*index 0~511 in a same logical pool*/ 16261 logical_pool_idx = f_pl->pool_index * 2; 16262 } else if (((2 * f_pl->hw_index) >= f_mp->size / 2) 16263 && (f_pl->hw_index < f_mp->size / 2)){ 16264 /*index 512~1023 in a same logical pool */ 16265 logical_pool_idx = f_pl->pool_index * 2 + 1; 16266 } else { 16267 return BCM_E_INTERNAL; 16268 } 16269 } 16270 if (fc->ingress_logical_policer_pools_mode == 16271 bcmFieldIngressLogicalPolicerPools16x512Split) { 16272 if (((2 * f_pl->hw_index) < f_mp->size / 2) && (f_pl->hw_index >= 0)) { 16273 /*index 0~511 in a same logical pool*/ 16274 logical_pool_idx = f_pl->pool_index; 16275 } else if (((2 * f_pl->hw_index) >= f_mp->size / 2) 16276 && (f_pl->hw_index < f_mp->size / 2)){ 16277 /*index 512~1023 in a same logical pool */ 16278 logical_pool_idx = f_pl->pool_index + 8; 16279 } else { 16280 return BCM_E_INTERNAL; 16281 } 16282 } 16283 } 16284 f_pl->logical_pool_index = logical_pool_idx; 16285 f_pl->cfg.pool_id = f_pl->logical_pool_index; 16286 } 16287 } 16288 fg = fg->next; 16289 } 16290 return (BCM_E_NONE); 16291 } 16292 16293 /* 16294 * Function: 16295 * _bcm_field_tr3_stage_ingress_reinit 16296 * 16297 * Purpose: 16298 * Reconstruct's IFP/Ingress stage groups and entries. 16299 * 16300 * Parameters: 16301 * unit - (IN) BCM device number. 16302 * fc - (IN) Device field control structure pointer. 16303 * stage_fc - (IN) FP stage control info. 16304 * 16305 * Returns: 16306 * BCM_E_XXX 16307 */ 16308 int 16309 _bcm_field_tr3_stage_ingress_reinit(int unit, 16310 _field_control_t *fc, 16311 _field_stage_t *stage_fc 16312 ) 16313 { 16314 16315 static const soc_field_t ifp_en_flds[] = { 16316 FP_SLICE_ENABLE_SLICE_0f, 16317 FP_SLICE_ENABLE_SLICE_1f, 16318 FP_SLICE_ENABLE_SLICE_2f, 16319 FP_SLICE_ENABLE_SLICE_3f, 16320 FP_SLICE_ENABLE_SLICE_4f, 16321 FP_SLICE_ENABLE_SLICE_5f, 16322 FP_SLICE_ENABLE_SLICE_6f, 16323 FP_SLICE_ENABLE_SLICE_7f, 16324 FP_SLICE_ENABLE_SLICE_8f, 16325 FP_SLICE_ENABLE_SLICE_9f, 16326 FP_SLICE_ENABLE_SLICE_10f, 16327 FP_SLICE_ENABLE_SLICE_11f, 16328 FP_SLICE_ENABLE_SLICE_12f, 16329 FP_SLICE_ENABLE_SLICE_13f, 16330 FP_SLICE_ENABLE_SLICE_14f, 16331 FP_SLICE_ENABLE_SLICE_15f 16332 }; 16333 static const soc_field_t ifp_lk_en_flds[] = { 16334 FP_LOOKUP_ENABLE_SLICE_0f, 16335 FP_LOOKUP_ENABLE_SLICE_1f, 16336 FP_LOOKUP_ENABLE_SLICE_2f, 16337 FP_LOOKUP_ENABLE_SLICE_3f, 16338 FP_LOOKUP_ENABLE_SLICE_4f, 16339 FP_LOOKUP_ENABLE_SLICE_5f, 16340 FP_LOOKUP_ENABLE_SLICE_6f, 16341 FP_LOOKUP_ENABLE_SLICE_7f, 16342 FP_LOOKUP_ENABLE_SLICE_8f, 16343 FP_LOOKUP_ENABLE_SLICE_9f, 16344 FP_LOOKUP_ENABLE_SLICE_10f, 16345 FP_LOOKUP_ENABLE_SLICE_11f, 16346 FP_LOOKUP_ENABLE_SLICE_12f, 16347 FP_LOOKUP_ENABLE_SLICE_13f, 16348 FP_LOOKUP_ENABLE_SLICE_14f, 16349 FP_LOOKUP_ENABLE_SLICE_15f 16350 }; 16351 static const soc_field_t ifp_double_wide_f2_key_sel[] = { 16352 SLICE0_DOUBLE_WIDE_F2_KEY_SELECTf, 16353 SLICE1_DOUBLE_WIDE_F2_KEY_SELECTf, 16354 SLICE2_DOUBLE_WIDE_F2_KEY_SELECTf, 16355 SLICE3_DOUBLE_WIDE_F2_KEY_SELECTf, 16356 SLICE4_DOUBLE_WIDE_F2_KEY_SELECTf, 16357 SLICE5_DOUBLE_WIDE_F2_KEY_SELECTf, 16358 SLICE6_DOUBLE_WIDE_F2_KEY_SELECTf, 16359 SLICE7_DOUBLE_WIDE_F2_KEY_SELECTf, 16360 SLICE8_DOUBLE_WIDE_F2_KEY_SELECTf, 16361 SLICE9_DOUBLE_WIDE_F2_KEY_SELECTf, 16362 SLICE10_DOUBLE_WIDE_F2_KEY_SELECTf, 16363 SLICE11_DOUBLE_WIDE_F2_KEY_SELECTf, 16364 SLICE12_DOUBLE_WIDE_F2_KEY_SELECTf, 16365 SLICE13_DOUBLE_WIDE_F2_KEY_SELECTf, 16366 SLICE14_DOUBLE_WIDE_F2_KEY_SELECTf, 16367 SLICE15_DOUBLE_WIDE_F2_KEY_SELECTf 16368 }; 16369 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 16370 const soc_field_t _bcm_ifp_normalize_fldtbl[][2] = { 16371 { SLICE0_NORMALIZE_IP_ADDRf, SLICE0_NORMALIZE_MAC_ADDRf }, 16372 { SLICE1_NORMALIZE_IP_ADDRf, SLICE1_NORMALIZE_MAC_ADDRf }, 16373 { SLICE2_NORMALIZE_IP_ADDRf, SLICE2_NORMALIZE_MAC_ADDRf }, 16374 { SLICE3_NORMALIZE_IP_ADDRf, SLICE3_NORMALIZE_MAC_ADDRf }, 16375 { SLICE4_NORMALIZE_IP_ADDRf, SLICE4_NORMALIZE_MAC_ADDRf }, 16376 { SLICE5_NORMALIZE_IP_ADDRf, SLICE5_NORMALIZE_MAC_ADDRf }, 16377 { SLICE6_NORMALIZE_IP_ADDRf, SLICE6_NORMALIZE_MAC_ADDRf }, 16378 { SLICE7_NORMALIZE_IP_ADDRf, SLICE7_NORMALIZE_MAC_ADDRf }, 16379 { SLICE8_NORMALIZE_IP_ADDRf, SLICE8_NORMALIZE_MAC_ADDRf }, 16380 { SLICE9_NORMALIZE_IP_ADDRf, SLICE9_NORMALIZE_MAC_ADDRf }, 16381 { SLICE10_NORMALIZE_IP_ADDRf, SLICE10_NORMALIZE_MAC_ADDRf }, 16382 { SLICE11_NORMALIZE_IP_ADDRf, SLICE11_NORMALIZE_MAC_ADDRf }, 16383 { SLICE12_NORMALIZE_IP_ADDRf, SLICE12_NORMALIZE_MAC_ADDRf }, 16384 { SLICE13_NORMALIZE_IP_ADDRf, SLICE13_NORMALIZE_MAC_ADDRf }, 16385 { SLICE14_NORMALIZE_IP_ADDRf, SLICE14_NORMALIZE_MAC_ADDRf }, 16386 { SLICE15_NORMALIZE_IP_ADDRf, SLICE15_NORMALIZE_MAC_ADDRf } 16387 }; 16388 #endif 16389 16390 int phys_tcam_idx; /* Entry Hw index value. */ 16391 int idx, idx1, slice_idx, vslice_idx; /* Physical/Virtual slice index. */ 16392 int index_min, index_max, rv = BCM_E_NONE; 16393 int group_found; /* Existing FP Group status. */ 16394 int parts_count, slice_ent_cnt; /* No. of FP entry parts. */ 16395 int i, pri_tcam_idx; /* Field entry TCAM index. */ 16396 int part_index; /* Field entry part number. */ 16397 int slice_number; /* Slice number. */ 16398 int expanded[16]; /* Slice exanded info. */ 16399 int slice_master_idx[16]; /* Slice exanded info. */ 16400 int prev_prio, multigroup, max, master_slice; 16401 int8 s_field, d_field; /* Src/Dst Field Sec selectors. */ 16402 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; /* Secondary storage 16403 base ptr. */ 16404 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 16405 uint16 recovered_ver_part0 = 0; /* Recoved WB version */ 16406 char *fp_pfs_buf = NULL; /* Buffer to read the 16407 FP_PORT_FIELD_SEL table. */ 16408 char *fp_policy_buf = NULL; /* Buffer to read the FP_POLICY 16409 table. */ 16410 char *fp_global_mask_tcam_buf = NULL; /* Buffer to read the 16411 FP_GLOBAL_MASK_TCAM table. */ 16412 uint32 *fp_tcam_buf = NULL; /* Buffer to read the FP_TCAM 16413 table. */ 16414 uint32 paired, intraslice; 16415 uint32 se_rval; /* Slice enable control value. */ 16416 uint32 le_rval; /* Slice lookup enable control 16417 register value. */ 16418 uint32 temp; /* Store IFP scache END marker. */ 16419 fp_port_field_sel_entry_t *pfs_entry; /* Port field selector entry. */ 16420 fp_tcam_entry_t *tcam_entry; /* FP_TCAM table entry. */ 16421 fp_policy_table_entry_t *policy_entry; /* Policy table entry. */ 16422 fp_global_mask_tcam_entry_t *global_mask_tcam_entry; /* GM TCAM entry. */ 16423 _field_hw_qual_info_t hw_sels; /* Hw Pri/Sec selectors. */ 16424 _field_slice_t *fs; /* Pointer to Slice info. */ 16425 _field_group_t *fg = NULL; /* Pointer to group info. */ 16426 _field_entry_t *f_ent = NULL; /* Field entry pointer. */ 16427 bcm_port_t port; /* Device port number. */ 16428 bcm_pbmp_t entry_pbmp, entry_mask_pbmp, temp_pbmp; /* Global Mask TCAM 16429 IPBM/IPBM_MASK values. */ 16430 soc_field_t fld; /* Store Memory/Register fields. */ 16431 _field_table_pointers_t *fp_table_pointers = NULL; 16432 _field_meter_pool_t *f_logical_mp; /* Meter pool descriptor. */ 16433 _field_entry_oam_wb_t *f_ent_oam_wb = NULL; 16434 _field_entry_policer_wb_t *f_ent_policer_wb = NULL; 16435 uint32 fwd_field_sel; 16436 uint8 old_physical_slice, slice_num; 16437 uint32 entry_flags; 16438 _field_slice_t *fs_temp = NULL; 16439 _field_action_bmp_t action_bmp; 16440 _field_entry_wb_info_t f_ent_wb_info; 16441 _field_group_t *group = NULL; /* Pointer to group info. */ 16442 16443 /* Reset Action bitmap to NULL. */ 16444 action_bmp.w = NULL; 16445 fc->scache_pos = 0; 16446 fc->scache_pos1 = 0; 16447 16448 if (fc->l2warm) { 16449 recovered_ver_part0 = (fc->wb_recovered_version); 16450 if ((fc->wb_recovered_version) > BCM_FIELD_WB_DEFAULT_VERSION) { 16451 /* Notify the application with an event */ 16452 /* The application will then need to reconcile the 16453 version differences using the documented behavioral 16454 differences on per module (handle) basis */ 16455 SOC_IF_ERROR_RETURN 16456 (soc_event_generate(unit, 16457 SOC_SWITCH_EVENT_WARM_BOOT_DOWNGRADE, 16458 BCM_MODULE_FIELD, 16459 (fc->wb_recovered_version), 16460 (fc->wb_current_version) 16461 ) 16462 ); 16463 } 16464 16465 fc->scache_pos += SOC_WB_SCACHE_CONTROL_SIZE; 16466 16467 if(NULL != fc->scache_ptr[_FIELD_SCACHE_PART_1]) { 16468 if ((fc->wb_recovered_version) > BCM_FIELD_WB_DEFAULT_VERSION) { 16469 /* Notify the application with an event */ 16470 /* The application will then need to reconcile the 16471 version differences using the documented behavioral 16472 differences on per module (handle) basis */ 16473 SOC_IF_ERROR_RETURN 16474 (soc_event_generate(unit, 16475 SOC_SWITCH_EVENT_WARM_BOOT_DOWNGRADE, 16476 BCM_MODULE_FIELD, (fc->wb_recovered_version), 16477 (fc->wb_current_version))); 16478 } 16479 16480 fc->scache_pos1 += SOC_WB_SCACHE_CONTROL_SIZE; 16481 } 16482 16483 } 16484 16485 /* Clear entry IPBM KEY and MASK values. */ 16486 BCM_PBMP_CLEAR(entry_pbmp); 16487 BCM_PBMP_CLEAR(entry_mask_pbmp); 16488 16489 /* Clear expanded slice status for all 16 Hw slices on this device. */ 16490 sal_memset(expanded, 0, 16 * sizeof(int)); 16491 sal_memset(slice_master_idx, 0, 16 * sizeof(int)); 16492 16493 /* Check IFP DATA START signature for Level2 recovery. */ 16494 if (fc->l2warm) { 16495 rv = _field_scache_stage_hdr_chk(fc, _FIELD_IFP_DATA_START); 16496 if (BCM_FAILURE(rv)) { 16497 return (rv); 16498 } 16499 } 16500 16501 fp_table_pointers = soc_cm_salloc(unit, sizeof(_field_table_pointers_t), 16502 "FP Table buffer Pointers"); 16503 16504 if (NULL == fp_table_pointers) { 16505 return BCM_E_MEMORY; 16506 } 16507 16508 rv = _field_table_pointers_init(unit, fp_table_pointers); 16509 BCM_IF_ERROR_RETURN(rv); 16510 16511 /* Allocate buffer to read out FP_TCAM table entries. */ 16512 fp_tcam_buf = soc_cm_salloc 16513 (unit, 16514 sizeof(fp_tcam_entry_t) 16515 * soc_mem_index_count(unit, FP_TCAMm), 16516 "FP TCAM buffer" 16517 ); 16518 if (NULL == fp_tcam_buf) { 16519 return BCM_E_MEMORY; 16520 } 16521 16522 sal_memset(fp_tcam_buf, 16523 0, 16524 sizeof(fp_tcam_entry_t) * soc_mem_index_count(unit, FP_TCAMm) 16525 ); 16526 index_min = soc_mem_index_min(unit, FP_TCAMm); 16527 index_max = soc_mem_index_max(unit, FP_TCAMm); 16528 16529 fs = stage_fc->slices[_FP_DEF_INST]; 16530 if (stage_fc->flags & _FP_STAGE_HALF_SLICE) { 16531 slice_ent_cnt = fs->entry_count * 2; 16532 /* DMA in chunks */ 16533 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 16534 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 16535 if ((rv = soc_mem_read_range(unit, 16536 FP_TCAMm, 16537 MEM_BLOCK_ALL, 16538 slice_idx * slice_ent_cnt, 16539 slice_idx * slice_ent_cnt + fs->entry_count / 2 - 1, 16540 fp_tcam_buf + slice_idx * slice_ent_cnt 16541 * soc_mem_entry_words(unit, FP_TCAMm) 16542 ) 16543 ) < 0 ) { 16544 goto cleanup; 16545 } 16546 16547 if ((rv = soc_mem_read_range(unit, 16548 FP_TCAMm, 16549 MEM_BLOCK_ALL, 16550 slice_idx * slice_ent_cnt + fs->entry_count, 16551 slice_idx * slice_ent_cnt + fs->entry_count 16552 + fs->entry_count / 2 - 1, 16553 fp_tcam_buf 16554 + (slice_idx * slice_ent_cnt + fs->entry_count) 16555 * soc_mem_entry_words(unit, FP_TCAMm) 16556 ) 16557 ) < 0 ) { 16558 goto cleanup; 16559 } 16560 } 16561 } else { 16562 /* Readout table entries into allocated buffer. */ 16563 if ((rv = soc_mem_read_range(unit, 16564 FP_TCAMm, 16565 MEM_BLOCK_ALL, 16566 index_min, 16567 index_max, 16568 fp_tcam_buf 16569 ) 16570 ) < 0 ) { 16571 goto cleanup; 16572 } 16573 } 16574 16575 /* FP_PORT_FIELD_SEL table buffer. */ 16576 fp_pfs_buf = soc_cm_salloc(unit, 16577 SOC_MEM_TABLE_BYTES(unit, FP_PORT_FIELD_SELm), 16578 "FP PORT_FIELD_SEL buffer"); 16579 if (NULL == fp_pfs_buf) { 16580 rv = BCM_E_MEMORY; 16581 goto cleanup; 16582 } 16583 index_min = soc_mem_index_min(unit, FP_PORT_FIELD_SELm); 16584 index_max = soc_mem_index_max(unit, FP_PORT_FIELD_SELm); 16585 16586 /* Get table entries into allocated buffer. */ 16587 if ((rv = soc_mem_read_range(unit, 16588 FP_PORT_FIELD_SELm, 16589 MEM_BLOCK_ALL, 16590 index_min, 16591 index_max, 16592 fp_pfs_buf 16593 ) 16594 ) < 0 ) { 16595 goto cleanup; 16596 } 16597 16598 /* FP_POLICY_TABLE buffer. */ 16599 fp_policy_buf = soc_cm_salloc(unit, 16600 SOC_MEM_TABLE_BYTES(unit, FP_POLICY_TABLEm), 16601 "FP POLICY TABLE buffer"); 16602 if (NULL == fp_policy_buf) { 16603 rv = BCM_E_MEMORY; 16604 goto cleanup; 16605 } 16606 16607 /* Readout table entries into allocated buffer. */ 16608 index_min = soc_mem_index_min(unit, FP_POLICY_TABLEm); 16609 index_max = soc_mem_index_max(unit, FP_POLICY_TABLEm); 16610 if ((rv = soc_mem_read_range(unit, 16611 FP_POLICY_TABLEm, 16612 MEM_BLOCK_ALL, 16613 index_min, 16614 index_max, 16615 fp_policy_buf 16616 ) 16617 ) < 0 ) { 16618 goto cleanup; 16619 } 16620 16621 /* 16622 * FP_GLOBAL_MASK_TCAM table buffer. 16623 * Note: 16624 * FIXED_KEY and DOUBLE_WIDE_F0 fields are in this table on TR3. 16625 * TD/TR2 has FIXED_KEY field in FP_TCAM table. 16626 */ 16627 fp_global_mask_tcam_buf = soc_cm_salloc 16628 (unit, 16629 SOC_MEM_TABLE_BYTES 16630 (unit, FP_GLOBAL_MASK_TCAMm), 16631 "FP_GLOBAL_MASK_TCAM buffer" 16632 ); 16633 if (fp_global_mask_tcam_buf == NULL) { 16634 rv = BCM_E_MEMORY; 16635 goto cleanup; 16636 } 16637 16638 /* Read out FP_GLOBAL_MASK_TCAM table entries into allocated buffer. */ 16639 index_min = soc_mem_index_min(unit, FP_GLOBAL_MASK_TCAMm); 16640 index_max = soc_mem_index_max(unit, FP_GLOBAL_MASK_TCAMm); 16641 if ((rv = soc_mem_read_range(unit, 16642 FP_GLOBAL_MASK_TCAMm, 16643 MEM_BLOCK_ALL, 16644 index_min, 16645 index_max, 16646 fp_global_mask_tcam_buf 16647 ) 16648 ) < 0) { 16649 goto cleanup; 16650 } 16651 16652 fp_table_pointers->fp_global_mask_tcam_buf = fp_global_mask_tcam_buf; 16653 16654 /* Recover range checkers */ 16655 rv = _field_range_check_reinit(unit, stage_fc, fc); 16656 if (BCM_FAILURE(rv)) { 16657 goto cleanup; 16658 } 16659 16660 if ((fc->l2warm) && 16661 ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_23)) { 16662 fc->ingress_logical_policer_pools_mode = buf[fc->scache_pos]; 16663 fc->scache_pos++; 16664 } 16665 16666 /* Recover data qualifiers */ 16667 rv = _field_data_qual_recover(unit, fc, stage_fc); 16668 if (BCM_FAILURE(rv)) { 16669 goto cleanup; 16670 } 16671 16672 /* Get slice expansion status and virtual map */ 16673 if ((rv = _field_tr2_ifp_slice_expanded_status_get(unit, 16674 fc, 16675 stage_fc, 16676 expanded, 16677 slice_master_idx) 16678 ) < 0) { 16679 goto cleanup; 16680 } 16681 16682 /* Get slice enable and slice lookup enable control for IFP */ 16683 if ((rv = READ_FP_SLICE_ENABLEr(unit, &se_rval)) < 0) { 16684 goto cleanup; 16685 } 16686 if ((rv = READ_FP_LOOKUP_ENABLEr(unit, &le_rval)) < 0) { 16687 goto cleanup; 16688 } 16689 16690 /* Iterate over the slices */ 16691 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 16692 LOG_DEBUG(BSL_LS_BCM_FP, 16693 (BSL_META_U(unit, 16694 "FP(unit %d) vverb: _bcm_field_tr3_stage_ingress_reinit()- " 16695 "Checking slice %d...\n"), unit, slice_idx)); 16696 /* Ignore disabled slice */ 16697 if ((soc_reg_field_get(unit, 16698 FP_SLICE_ENABLEr, 16699 se_rval, 16700 ifp_en_flds[slice_idx] 16701 ) == 0) 16702 || soc_reg_field_get(unit, 16703 FP_LOOKUP_ENABLEr, 16704 le_rval, 16705 ifp_lk_en_flds[slice_idx] 16706 ) == 0) { 16707 continue; 16708 } 16709 16710 /* Ignore secondary slice in paired mode */ 16711 pfs_entry = soc_mem_table_idx_to_pointer(unit, 16712 FP_PORT_FIELD_SELm, 16713 fp_port_field_sel_entry_t *, 16714 fp_pfs_buf, 16715 0 16716 ); 16717 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 16718 16719 /* Get slice paired mode status. */ 16720 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit, 16721 pfs_entry, 16722 fld); 16723 16724 /* Get double wide mode slice status. */ 16725 intraslice = soc_mem_field32_get_def(unit, 16726 FP_PORT_FIELD_SELm, 16727 pfs_entry, 16728 _bcm_field_trx_slice_wide_mode_field[slice_idx], 16729 FALSE 16730 ); 16731 16732 /* Skip second slice (ODD slice) if paried mode is TRUE. */ 16733 if (paired && (slice_idx % 2)) { 16734 continue; 16735 } 16736 16737 /* Don't need to read selectors for expanded slice */ 16738 if (expanded[slice_idx]) { 16739 continue; 16740 } 16741 16742 /* Skip if slice has no valid groups and entries */ 16743 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 16744 slice_ent_cnt = fs->entry_count; 16745 for (idx = 0; idx < slice_ent_cnt; idx++) { 16746 /* 16747 * Get entry TCAM index, given 16748 * entry Stage, Slice no. and entry offset in slice. 16749 */ 16750 if (_bcm_field_slice_offset_to_tcam_idx 16751 (unit, 16752 stage_fc, 16753 _FP_DEF_INST, 16754 slice_idx, 16755 idx, 16756 &phys_tcam_idx 16757 ) != BCM_E_NONE) { 16758 rv = BCM_E_INTERNAL; 16759 goto cleanup; 16760 } 16761 16762 /* Get field entry at phys_tcam_idx from the buffer. */ 16763 tcam_entry = soc_mem_table_idx_to_pointer(unit, 16764 FP_TCAMm, 16765 fp_tcam_entry_t *, 16766 fp_tcam_buf, 16767 phys_tcam_idx 16768 ); 16769 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) != 0) { 16770 break; 16771 } 16772 } 16773 16774 /* 16775 * No VALID entry found in this slice. 16776 * When in Level1 recovery mode continue searching 16777 * for VALID entries in next slie. 16778 * In Level2 recovery mode, group qualifier information 16779 * is store in scache. So, continue with group recovery. 16780 */ 16781 if ((idx == slice_ent_cnt) && !fc->l2warm) { 16782 continue; 16783 } 16784 16785 /* If Level 2, retrieve the GIDs in this slice */ 16786 if (fc->l2warm) { 16787 rv = _field_trx_scache_slice_group_recover(unit, 16788 fc, _FP_DEF_INST, 16789 slice_idx, 16790 &multigroup, 16791 stage_fc, 16792 0); 16793 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 16794 fc->l2warm = 0; 16795 goto cleanup; 16796 } 16797 if (rv == BCM_E_NOT_FOUND) { 16798 rv = BCM_E_NONE; 16799 continue; 16800 } 16801 } 16802 16803 /* 16804 * Iterate over FP_PORT_FIELD_SEL for all ports and this slice 16805 * to identify bins for selectors (also groups for level 1) 16806 */ 16807 PBMP_ALL_ITER(unit, port) { 16808 if (IS_LB_PORT(unit, port)) { 16809 continue; 16810 } 16811 16812 _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[0]); 16813 hw_sels.pri_slice[0].intraslice 16814 = hw_sels.pri_slice[0].secondary = _FP_SELCODE_DONT_USE; 16815 _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[1]); 16816 hw_sels.pri_slice[1].intraslice 16817 = hw_sels.pri_slice[1].secondary = _FP_SELCODE_DONT_USE; 16818 _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[0]); 16819 hw_sels.sec_slice[0].intraslice 16820 = hw_sels.sec_slice[0].secondary = _FP_SELCODE_DONT_USE; 16821 _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[1]); 16822 hw_sels.sec_slice[1].intraslice 16823 = hw_sels.sec_slice[1].secondary = _FP_SELCODE_DONT_USE; 16824 16825 /* Get the FPF selectors for the port. */ 16826 pfs_entry = soc_mem_table_idx_to_pointer 16827 (unit, 16828 FP_PORT_FIELD_SELm, 16829 fp_port_field_sel_entry_t *, 16830 fp_pfs_buf, 16831 port 16832 ); 16833 16834 /* Get primary slice's selectors */ 16835 hw_sels.pri_slice[0].fpf1 = soc_FP_PORT_FIELD_SELm_field32_get 16836 (unit, 16837 pfs_entry, 16838 _bcm_field_trx_field_sel[slice_idx][0] 16839 ); 16840 hw_sels.pri_slice[0].fpf2 = soc_FP_PORT_FIELD_SELm_field32_get 16841 (unit, 16842 pfs_entry, 16843 _bcm_field_trx_field_sel[slice_idx][1] 16844 ); 16845 hw_sels.pri_slice[0].fpf3 = soc_FP_PORT_FIELD_SELm_field32_get 16846 (unit, 16847 pfs_entry, 16848 _bcm_field_trx_field_sel[slice_idx][2] 16849 ); 16850 16851 /* 16852 * Recover loopback_type_sel secondary selector 16853 * settings. 16854 */ 16855 rv = _field_tr3_loopback_type_sel_recover 16856 (unit, 16857 slice_idx, 16858 fp_global_mask_tcam_buf, 16859 stage_fc, 16860 intraslice, 16861 &(hw_sels.pri_slice[0].loopback_type_sel) 16862 ); 16863 if (BCM_FAILURE(rv)) { 16864 goto cleanup; 16865 } 16866 if (SOC_REG_FIELD_VALID(unit, FP_FORCE_FORWARDING_FIELDr, 16867 _bcm_trx2_vrf_force_forwarding_enable_field[slice_idx])) { 16868 READ_FP_FORCE_FORWARDING_FIELDr(unit, &fwd_field_sel); 16869 16870 if (soc_reg_field_get(unit, 16871 FP_FORCE_FORWARDING_FIELDr, 16872 fwd_field_sel, 16873 _bcm_trx2_vrf_force_forwarding_enable_field[slice_idx] 16874 )) { 16875 hw_sels.pri_slice[0].fwd_field_sel = 1; 16876 } 16877 } 16878 16879 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 16880 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 16881 _bcm_ifp_normalize_fldtbl[slice_idx][0])) { 16882 hw_sels.pri_slice[0].normalize_ip_sel = 0; 16883 if(soc_FP_PORT_FIELD_SELm_field32_get( 16884 unit, 16885 pfs_entry, 16886 _bcm_ifp_normalize_fldtbl[slice_idx][0] 16887 )) { 16888 hw_sels.pri_slice[0].normalize_ip_sel = 1; 16889 } 16890 } 16891 16892 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 16893 _bcm_ifp_normalize_fldtbl[slice_idx][1])) { 16894 hw_sels.pri_slice[0].normalize_mac_sel = 0; 16895 if(soc_FP_PORT_FIELD_SELm_field32_get( 16896 unit, 16897 pfs_entry, 16898 _bcm_ifp_normalize_fldtbl[slice_idx][1] 16899 )) { 16900 hw_sels.pri_slice[0].normalize_mac_sel = 1; 16901 } 16902 } 16903 #endif 16904 16905 s_field = soc_FP_PORT_FIELD_SELm_field32_get 16906 (unit, 16907 pfs_entry, 16908 _bcm_field_trx_s_type_sel[slice_idx] 16909 ); 16910 16911 d_field = soc_FP_PORT_FIELD_SELm_field32_get 16912 (unit, 16913 pfs_entry, 16914 _bcm_field_trx_d_type_sel[slice_idx] 16915 ); 16916 16917 if ((hw_sels.pri_slice[0].fpf1 == 0) || 16918 (hw_sels.pri_slice[0].fpf3 == 0)) { 16919 /* Check for L3_IIF or SVP */ 16920 _field_tr3_ingress_entity_get 16921 (unit, 16922 slice_idx, 16923 fp_global_mask_tcam_buf, 16924 slice_ent_cnt, 16925 stage_fc, 16926 &(hw_sels.pri_slice[0].ingress_entity_sel) 16927 ); 16928 } 16929 16930 switch (s_field) { 16931 case 1: 16932 hw_sels.pri_slice[0].src_entity_sel 16933 = _bcmFieldFwdEntityGlp; 16934 break; 16935 case 2: 16936 hw_sels.pri_slice[0].src_entity_sel 16937 = _bcmFieldFwdEntityModPortGport; 16938 break; 16939 case 3: 16940 /* Need to adjust later based on actual VP */ 16941 hw_sels.pri_slice[0].src_entity_sel 16942 = _bcmFieldFwdEntityMimGport; 16943 break; 16944 default: 16945 hw_sels.pri_slice[0].src_entity_sel 16946 = _bcmFieldFwdEntityAny; 16947 break; 16948 } 16949 16950 switch (d_field) { 16951 case 0: 16952 hw_sels.pri_slice[0].dst_fwd_entity_sel 16953 = _bcmFieldFwdEntityGlp; 16954 break; 16955 case 1: 16956 hw_sels.pri_slice[0].dst_fwd_entity_sel 16957 = _bcmFieldFwdEntityL3Egress; 16958 break; 16959 case 2: 16960 hw_sels.pri_slice[0].dst_fwd_entity_sel 16961 = _bcmFieldFwdEntityMulticastGroup; 16962 break; 16963 case 3: 16964 /* Need to adjust later based on actual VP */ 16965 hw_sels.pri_slice[0].dst_fwd_entity_sel 16966 = _bcmFieldFwdEntityMimGport; 16967 break; 16968 default: 16969 hw_sels.pri_slice[0].dst_fwd_entity_sel 16970 = _bcmFieldFwdEntityAny; 16971 break; 16972 } 16973 16974 rv = _field_tr3_slice_key_control_entry_recover(unit, 16975 slice_idx, 16976 &hw_sels.pri_slice[0] 16977 ); 16978 if (BCM_FAILURE(rv)) { 16979 goto cleanup; 16980 } 16981 16982 /* If intraslice, get double-wide key */ 16983 if (intraslice) { 16984 uint32 dw_key_sel; 16985 16986 hw_sels.pri_slice[1].intraslice = TRUE; 16987 hw_sels.pri_slice[1].fpf2 16988 = soc_mem_field32_get 16989 (unit, 16990 FP_PORT_FIELD_SELm, 16991 pfs_entry, 16992 ifp_double_wide_f2_key_sel[slice_idx] 16993 ); 16994 16995 rv = READ_FP_DOUBLE_WIDE_SELECTr(unit, &dw_key_sel); 16996 if (SOC_FAILURE(rv)) { 16997 goto cleanup; 16998 } 16999 17000 hw_sels.pri_slice[1].fpf4 17001 = soc_reg_field_get 17002 (unit, 17003 FP_DOUBLE_WIDE_SELECTr, 17004 dw_key_sel, 17005 _bcm_field_trx_dw_f4_sel[slice_idx] 17006 ); 17007 17008 hw_sels.pri_slice[1].fpf1 17009 = soc_reg_field_get 17010 (unit, 17011 FP_DOUBLE_WIDE_SELECTr, 17012 dw_key_sel, 17013 _tr3_dw_f1_sel[slice_idx] 17014 ); 17015 17016 if (soc_mem_field_valid 17017 (unit, 17018 FP_PORT_FIELD_SELm, 17019 SLICE0_S_TYPE_SELf)) { 17020 d_field = soc_mem_field32_get 17021 (unit, 17022 FP_PORT_FIELD_SELm, 17023 pfs_entry, 17024 _bcm_field_trx_d_type_sel[slice_idx] 17025 ); 17026 switch (d_field) { 17027 case 1: 17028 hw_sels.pri_slice[1].dst_fwd_entity_sel 17029 = _bcmFieldFwdEntityL3Egress; 17030 break; 17031 case 2: 17032 hw_sels.pri_slice[1].dst_fwd_entity_sel 17033 = _bcmFieldFwdEntityMulticastGroup; 17034 break; 17035 case 3: 17036 /* Need to adjust later based on actual VP */ 17037 hw_sels.pri_slice[1].dst_fwd_entity_sel 17038 = _bcmFieldFwdEntityMimGport; 17039 break; 17040 default: 17041 hw_sels.pri_slice[1].dst_fwd_entity_sel 17042 = _bcmFieldFwdEntityGlp; 17043 break; 17044 } 17045 } 17046 } 17047 17048 /* If paired, get secondary slice's selectors */ 17049 if (paired) { 17050 hw_sels.sec_slice[0].secondary = _FP_SELCODE_DONT_CARE; 17051 17052 hw_sels.sec_slice[0].fpf1 17053 = soc_FP_PORT_FIELD_SELm_field32_get 17054 (unit, 17055 pfs_entry, 17056 _bcm_field_trx_field_sel[slice_idx + 1][0] 17057 ); 17058 hw_sels.sec_slice[0].fpf2 17059 = soc_FP_PORT_FIELD_SELm_field32_get 17060 (unit, 17061 pfs_entry, 17062 _bcm_field_trx_field_sel[slice_idx + 1][1] 17063 ); 17064 hw_sels.sec_slice[0].fpf3 17065 = soc_FP_PORT_FIELD_SELm_field32_get 17066 (unit, 17067 pfs_entry, 17068 _bcm_field_trx_field_sel[slice_idx + 1][2] 17069 ); 17070 17071 if (SOC_REG_FIELD_VALID(unit, FP_FORCE_FORWARDING_FIELDr, 17072 _bcm_trx2_vrf_force_forwarding_enable_field[slice_idx + 1])) { 17073 READ_FP_FORCE_FORWARDING_FIELDr(unit, &fwd_field_sel); 17074 17075 if (soc_reg_field_get(unit, 17076 FP_FORCE_FORWARDING_FIELDr, 17077 fwd_field_sel, 17078 _bcm_trx2_vrf_force_forwarding_enable_field[slice_idx + 1] 17079 )) { 17080 hw_sels.sec_slice[0].fwd_field_sel = 1; 17081 } 17082 } 17083 17084 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 17085 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 17086 _bcm_ifp_normalize_fldtbl[slice_idx + 1][0])) { 17087 hw_sels.sec_slice[0].normalize_ip_sel = 0; 17088 if(soc_FP_PORT_FIELD_SELm_field32_get( 17089 unit, 17090 pfs_entry, 17091 _bcm_ifp_normalize_fldtbl[slice_idx + 1][0] 17092 )) { 17093 hw_sels.sec_slice[0].normalize_ip_sel = 1; 17094 } 17095 } 17096 17097 if (soc_mem_field_valid(unit, FP_PORT_FIELD_SELm, 17098 _bcm_ifp_normalize_fldtbl[slice_idx + 1][1])) { 17099 hw_sels.sec_slice[0].normalize_mac_sel = 0; 17100 if(soc_FP_PORT_FIELD_SELm_field32_get( 17101 unit, 17102 pfs_entry, 17103 _bcm_ifp_normalize_fldtbl[slice_idx + 1][1] 17104 )) { 17105 hw_sels.sec_slice[0].normalize_mac_sel = 1; 17106 } 17107 } 17108 #endif 17109 17110 if (soc_mem_field_valid 17111 (unit, 17112 FP_PORT_FIELD_SELm, 17113 SLICE0_S_TYPE_SELf)) { 17114 s_field = soc_FP_PORT_FIELD_SELm_field32_get 17115 (unit, 17116 pfs_entry, 17117 _bcm_field_trx_s_type_sel[slice_idx + 1] 17118 ); 17119 d_field = soc_FP_PORT_FIELD_SELm_field32_get 17120 (unit, 17121 pfs_entry, 17122 _bcm_field_trx_d_type_sel[slice_idx + 1] 17123 ); 17124 17125 if ((hw_sels.sec_slice[0].fpf1 == 0) 17126 || (hw_sels.sec_slice[0].fpf3 == 0)) { 17127 /* Check for L3_IIF or SVP */ 17128 _field_tr3_ingress_entity_get 17129 (unit, 17130 slice_idx + 1, 17131 fp_global_mask_tcam_buf, 17132 slice_ent_cnt, 17133 stage_fc, 17134 &(hw_sels.sec_slice[0].ingress_entity_sel) 17135 ); 17136 } 17137 } 17138 17139 switch (s_field) { 17140 case 1: 17141 hw_sels.sec_slice[0].src_entity_sel 17142 = _bcmFieldFwdEntityGlp; 17143 break; 17144 case 2: 17145 hw_sels.sec_slice[0].src_entity_sel 17146 = _bcmFieldFwdEntityModPortGport; 17147 break; 17148 case 3: 17149 /* Need to adjust later based on actual VP */ 17150 hw_sels.sec_slice[0].src_entity_sel 17151 = _bcmFieldFwdEntityMimGport; 17152 break; 17153 default: 17154 hw_sels.sec_slice[0].src_entity_sel 17155 = _bcmFieldFwdEntityAny; 17156 break; 17157 } 17158 17159 switch (d_field) { 17160 case 1: 17161 hw_sels.sec_slice[0].dst_fwd_entity_sel 17162 = _bcmFieldFwdEntityL3Egress; 17163 break; 17164 case 2: 17165 hw_sels.sec_slice[0].dst_fwd_entity_sel 17166 = _bcmFieldFwdEntityMulticastGroup; 17167 break; 17168 case 3: 17169 /* Need to adjust later based on actual VP */ 17170 hw_sels.sec_slice[0].dst_fwd_entity_sel 17171 = _bcmFieldFwdEntityMimGport; 17172 break; 17173 default: 17174 hw_sels.sec_slice[0].dst_fwd_entity_sel 17175 = _bcmFieldFwdEntityAny; 17176 break; 17177 } 17178 17179 rv = _field_tr3_slice_key_control_entry_recover 17180 (unit, 17181 slice_idx + 1, 17182 &hw_sels.sec_slice[0] 17183 ); 17184 if (BCM_FAILURE(rv)) { 17185 goto cleanup; 17186 } 17187 17188 if (intraslice) { 17189 uint32 dw_key_sel; 17190 17191 hw_sels.sec_slice[1].intraslice = TRUE; 17192 hw_sels.sec_slice[1].fpf2 17193 = soc_mem_field32_get 17194 (unit, 17195 FP_PORT_FIELD_SELm, 17196 pfs_entry, 17197 ifp_double_wide_f2_key_sel[slice_idx + 1] 17198 ); 17199 17200 rv = READ_FP_DOUBLE_WIDE_SELECTr(unit, &dw_key_sel); 17201 if (SOC_FAILURE(rv)) { 17202 goto cleanup; 17203 } 17204 hw_sels.sec_slice[1].fpf4 17205 = soc_reg_field_get 17206 (unit, 17207 FP_DOUBLE_WIDE_SELECTr, 17208 dw_key_sel, 17209 _bcm_field_trx_dw_f4_sel[slice_idx + 1] 17210 ); 17211 hw_sels.sec_slice[1].fpf1 17212 = soc_reg_field_get 17213 (unit, 17214 FP_DOUBLE_WIDE_SELECTr, 17215 dw_key_sel, 17216 _tr3_dw_f1_sel[slice_idx + 1] 17217 ); 17218 17219 if (soc_mem_field_valid(unit, 17220 FP_PORT_FIELD_SELm, 17221 SLICE0_S_TYPE_SELf)) { 17222 d_field = soc_mem_field32_get 17223 (unit, 17224 FP_PORT_FIELD_SELm, 17225 pfs_entry, 17226 _bcm_field_trx_d_type_sel[slice_idx + 1] 17227 ); 17228 switch (d_field) { 17229 case 1: 17230 hw_sels.sec_slice[1].dst_fwd_entity_sel 17231 = _bcmFieldFwdEntityL3Egress; 17232 break; 17233 case 2: 17234 hw_sels.sec_slice[1].dst_fwd_entity_sel 17235 = _bcmFieldFwdEntityMulticastGroup; 17236 break; 17237 case 3: 17238 /* Need to adjust later based on actual VP */ 17239 hw_sels.sec_slice[1].dst_fwd_entity_sel 17240 = _bcmFieldFwdEntityMimGport; 17241 break; 17242 default: 17243 hw_sels.sec_slice[1].dst_fwd_entity_sel 17244 = _bcmFieldFwdEntityGlp; 17245 break; 17246 } 17247 } 17248 } 17249 } 17250 17251 /* Create a group based on HW qualifiers (or find existing) */ 17252 rv = _field_tr2_group_construct 17253 (unit, _FP_DEF_INST, 17254 &hw_sels, 17255 intraslice, 17256 paired, 17257 fc, 17258 port, 17259 _BCM_FIELD_STAGE_INGRESS, 17260 slice_idx 17261 ); 17262 if (BCM_FAILURE(rv)) { 17263 goto cleanup; 17264 } 17265 } 17266 17267 /* Now go over the entries in this slice */ 17268 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 17269 slice_ent_cnt = fs->entry_count; 17270 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 17271 slice_ent_cnt >>= 1; 17272 fs->free_count >>= 1; 17273 } 17274 prev_prio = -1; 17275 for (idx = 0; idx < slice_ent_cnt; idx++) { 17276 group_found = 0; 17277 if (_bcm_field_slice_offset_to_tcam_idx(unit, 17278 stage_fc, _FP_DEF_INST, slice_idx, idx, 17279 &phys_tcam_idx) != BCM_E_NONE) { 17280 rv = BCM_E_INTERNAL; 17281 goto cleanup; 17282 } 17283 tcam_entry = soc_mem_table_idx_to_pointer 17284 (unit, 17285 FP_TCAMm, 17286 fp_tcam_entry_t *, 17287 fp_tcam_buf, 17288 phys_tcam_idx 17289 ); 17290 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 0) { 17291 continue; 17292 } 17293 17294 /* Check which ports are applicable to this entry */ 17295 global_mask_tcam_entry = soc_mem_table_idx_to_pointer 17296 (unit, 17297 FP_GLOBAL_MASK_TCAMm, 17298 fp_global_mask_tcam_entry_t *, 17299 fp_global_mask_tcam_buf, 17300 phys_tcam_idx 17301 ); 17302 soc_mem_pbmp_field_get(unit, 17303 FP_GLOBAL_MASK_TCAMm, 17304 global_mask_tcam_entry, 17305 IPBMf, 17306 &entry_pbmp 17307 ); 17308 soc_mem_pbmp_field_get(unit, 17309 FP_GLOBAL_MASK_TCAMm, 17310 global_mask_tcam_entry, 17311 IPBM_MASKf, 17312 &entry_mask_pbmp 17313 ); 17314 17315 /* Search groups to find match */ 17316 fg = fc->groups; 17317 while (fg != NULL) { 17318 /* Check if group is in this slice */ 17319 fs = &fg->slices[0]; 17320 if (fs->slice_number != slice_idx) { 17321 fg = fg->next; 17322 continue; 17323 } 17324 17325 /* Check if entry_pbmp is a subset of group pbmp */ 17326 17327 SOC_PBMP_CLEAR(temp_pbmp); 17328 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp); 17329 SOC_PBMP_OR(temp_pbmp, PBMP_LB(unit)); 17330 SOC_PBMP_AND(temp_pbmp, entry_pbmp); 17331 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) { 17332 group_found = 1; 17333 break; 17334 } 17335 17336 fg = fg->next; 17337 } 17338 if (!group_found) { 17339 return BCM_E_INTERNAL; /* Should never happen */ 17340 } 17341 17342 /* Allocate memory for the entry */ 17343 rv = _bcm_field_entry_tcam_parts_count(unit,fg->stage_id, 17344 fg->flags, &parts_count); 17345 if (BCM_FAILURE(rv)) { 17346 goto cleanup; 17347 } 17348 17349 _FP_XGS3_ALLOC(f_ent, 17350 (parts_count * sizeof (_field_entry_t)), 17351 "field entry" 17352 ); 17353 if (f_ent == NULL) { 17354 rv = BCM_E_MEMORY; 17355 goto cleanup; 17356 } 17357 17358 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 17359 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 17360 } 17361 17362 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 17363 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 17364 if (fc->l2warm) { 17365 /* Recover f_ent_oam_wb structure from here */ 17366 /* Allocate f_ent_oam_wb structure and pass it to 17367 * corresponding function */ 17368 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8) { 17369 _FP_XGS3_ALLOC(f_ent_oam_wb, sizeof (_field_entry_oam_wb_t), 17370 "Field Entry Warmboot"); 17371 if (f_ent_oam_wb == NULL) { 17372 sal_free (f_ent); 17373 return BCM_E_MEMORY; 17374 } 17375 } 17376 f_ent_wb_info.f_ent_oam_wb = f_ent_oam_wb; 17377 17378 if ((fc->wb_recovered_version) > BCM_FIELD_WB_VERSION_1_14) { 17379 action_bmp.w = NULL; 17380 _FP_XGS3_ALLOC(action_bmp.w, 17381 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 17382 "Action No Param Bitmap"); 17383 if (action_bmp.w == NULL) { 17384 rv = BCM_E_MEMORY; 17385 sal_free(f_ent); 17386 goto cleanup; 17387 } 17388 } 17389 f_ent_wb_info.action_bmp = &action_bmp; 17390 17391 /* Recover f_ent_policer_wb structure from here */ 17392 /* Allocate f_ent_policer_wb structure and pass it to 17393 * corresponding function */ 17394 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_17) { 17395 _FP_XGS3_ALLOC(f_ent_policer_wb, sizeof (_field_entry_policer_wb_t), 17396 "Field Entry Warmboot"); 17397 if (f_ent_policer_wb == NULL) { 17398 rv = BCM_E_MEMORY; 17399 sal_free (f_ent); 17400 goto cleanup; 17401 } 17402 } 17403 f_ent_wb_info.f_ent_policer_wb = f_ent_policer_wb; 17404 17405 rv = _field_trx_entry_info_retrieve(unit, 17406 fc, 17407 stage_fc, 17408 multigroup, 17409 &prev_prio, 17410 &f_ent_wb_info 17411 ); 17412 if (BCM_FAILURE(rv)) { 17413 sal_free(f_ent); 17414 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17415 goto cleanup; 17416 } 17417 } else { 17418 _bcm_field_last_alloc_eid_incr(unit); 17419 } 17420 pri_tcam_idx = phys_tcam_idx; 17421 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 17422 slice_idx, stage_fc); 17423 if (vslice_idx == -1) { 17424 rv = BCM_E_INTERNAL; 17425 sal_free(f_ent); 17426 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17427 goto cleanup; 17428 } 17429 for (i = 0; i < parts_count; i++) { 17430 if (fc->l2warm) { 17431 /* Use retrieved EID */ 17432 f_ent[i].eid = f_ent_wb_info.eid; 17433 /* Set retrieved dvp_type and svp_type */ 17434 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 17435 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 17436 f_ent[i].prio = f_ent_wb_info.prio; 17437 } else { 17438 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 17439 f_ent[i].prio = (vslice_idx << 10) | (slice_ent_cnt - idx); 17440 } 17441 f_ent[i].group = fg; 17442 if (i == 0) { 17443 BCM_PBMP_ASSIGN(f_ent[i].pbmp.data, entry_pbmp); 17444 BCM_PBMP_ASSIGN(f_ent[i].pbmp.mask, entry_mask_pbmp); 17445 } 17446 17447 rv = _bcm_field_tcam_part_to_entry_flags 17448 (unit, i, 17449 fg, 17450 &f_ent[i].flags 17451 ); 17452 if (BCM_FAILURE(rv)) { 17453 sal_free(f_ent); 17454 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17455 goto cleanup; 17456 } 17457 if (f_ent_wb_info.color_independent) { 17458 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 17459 } 17460 rv = _bcm_field_entry_part_tcam_idx_get 17461 (unit, 17462 f_ent, 17463 pri_tcam_idx, 17464 i, &part_index 17465 ); 17466 if (BCM_FAILURE(rv)) { 17467 sal_free(f_ent); 17468 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17469 goto cleanup; 17470 } 17471 rv = _bcm_field_tcam_idx_to_slice_offset 17472 (unit, 17473 stage_fc, 17474 _FP_DEF_INST, 17475 part_index, 17476 &slice_number, 17477 (int *)&f_ent[i].slice_idx 17478 ); 17479 if (BCM_FAILURE(rv)) { 17480 sal_free(f_ent); 17481 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17482 goto cleanup; 17483 } 17484 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 17485 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp); 17486 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 17487 /* Decrement slice free entry count for primary 17488 entries. */ 17489 f_ent[i].fs->free_count--; 17490 } 17491 /* Assign entry to a slice */ 17492 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 17493 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 17494 17495 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 3) { 17496 f_ent[i].flags |= _FP_ENTRY_ENABLED; 17497 } 17498 17499 /* Get the actions associated with this part of the entry */ 17500 policy_entry = soc_mem_table_idx_to_pointer 17501 (unit, 17502 FP_POLICY_TABLEm, 17503 fp_policy_table_entry_t *, 17504 fp_policy_buf, 17505 part_index 17506 ); 17507 rv = _field_tr2_actions_recover 17508 (unit, 17509 FP_POLICY_TABLEm, 17510 (uint32 *) policy_entry, 17511 f_ent, 17512 i, 17513 &f_ent_wb_info); 17514 if (BCM_FAILURE(rv)) { 17515 sal_free(f_ent); 17516 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17517 goto cleanup; 17518 } 17519 if (action_bmp.w != NULL) { 17520 _FP_ACTION_BMP_FREE(action_bmp); 17521 action_bmp.w = NULL; 17522 } 17523 } 17524 17525 /* Add to the group */ 17526 rv = _field_group_entry_add(unit, fg, f_ent); 17527 if (BCM_FAILURE(rv)) { 17528 sal_free(f_ent); 17529 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17530 goto cleanup; 17531 } 17532 f_ent = NULL; 17533 /* Entry has been added to group, 17534 * so free f_ent_oam_wb structure */ 17535 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17536 if (f_ent_policer_wb != NULL) { 17537 sal_free(f_ent_policer_wb); 17538 f_ent_policer_wb = NULL; 17539 } 17540 } 17541 17542 /* Free up the temporary slice group info */ 17543 if (fc->l2warm) { 17544 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) { 17545 /* update selcode and construct group qual offset */ 17546 rv = _field_tr2_group_construct_quals_with_sel_update(unit, fc, stage_fc); 17547 if (BCM_FAILURE(rv)) { 17548 goto cleanup; 17549 } 17550 } 17551 _field_scache_slice_group_free(unit, 17552 fc, 17553 slice_idx 17554 ); 17555 } 17556 } 17557 17558 /* Now go over the expanded slices */ 17559 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 17560 LOG_DEBUG(BSL_LS_BCM_FP, 17561 (BSL_META_U(unit, 17562 "FP(unit %d) vverb: _bcm_field_tr3_stage_ingress_reinit()- " 17563 "Checking slice %d...\n"), unit, slice_idx)); 17564 if (!expanded[slice_idx]) { 17565 continue; 17566 } 17567 /* Ignore secondary slice in paired mode */ 17568 pfs_entry = soc_mem_table_idx_to_pointer 17569 (unit, 17570 FP_PORT_FIELD_SELm, 17571 fp_port_field_sel_entry_t *, 17572 fp_pfs_buf, 17573 0 17574 ); 17575 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 17576 paired = soc_FP_PORT_FIELD_SELm_field32_get 17577 (unit, 17578 pfs_entry, 17579 fld 17580 ); 17581 if (paired && (slice_idx % 2)) { 17582 continue; 17583 } 17584 /* Skip if slice has no valid entries */ 17585 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 17586 slice_ent_cnt = fs->entry_count; 17587 for (idx = 0; idx < slice_ent_cnt; idx++) { 17588 if (_bcm_field_slice_offset_to_tcam_idx(unit, 17589 stage_fc, 17590 _FP_DEF_INST, 17591 slice_idx, 17592 idx, 17593 &phys_tcam_idx 17594 ) 17595 != BCM_E_NONE 17596 ) { 17597 rv = BCM_E_INTERNAL; 17598 goto cleanup; 17599 } 17600 tcam_entry = soc_mem_table_idx_to_pointer 17601 (unit, 17602 FP_TCAMm, 17603 fp_tcam_entry_t *, 17604 fp_tcam_buf, 17605 phys_tcam_idx 17606 ); 17607 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) != 0) { 17608 break; 17609 } 17610 } 17611 if (idx == slice_ent_cnt) { 17612 continue; 17613 } 17614 /* If Level 2, retrieve the GIDs in this slice */ 17615 if (fc->l2warm) { 17616 rv = _field_trx_scache_slice_group_recover (unit, 17617 fc, _FP_DEF_INST, 17618 slice_idx, 17619 &multigroup, 17620 stage_fc, 17621 0); 17622 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 17623 fc->l2warm = 0; 17624 goto cleanup; 17625 } 17626 if (rv == BCM_E_NOT_FOUND) { 17627 rv = BCM_E_NONE; 17628 continue; 17629 } 17630 } 17631 /* Now find the master slice for this virtual group */ 17632 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 17633 slice_idx, stage_fc); 17634 if (vslice_idx < 0) { 17635 rv = BCM_E_INTERNAL; 17636 17637 goto cleanup; 17638 } 17639 17640 if (fc->l2warm 17641 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8)) { 17642 master_slice = slice_master_idx[slice_idx]; 17643 } else { 17644 max = -1; 17645 for (i = 0; i < stage_fc->tcam_slices; i++) { 17646 if ((stage_fc->vmap[_FP_DEF_INST][0][vslice_idx].virtual_group == 17647 stage_fc->vmap[_FP_DEF_INST][0][i].virtual_group) && (i != vslice_idx)) { 17648 if (i > max) { 17649 max = i; 17650 } 17651 } 17652 } 17653 if (max < 0) { 17654 rv = BCM_E_INTERNAL; 17655 17656 goto cleanup; 17657 } 17658 17659 master_slice = stage_fc->vmap[_FP_DEF_INST][0][max].vmap_key; 17660 } 17661 /* See which group is in this slice - can be only one */ 17662 fg = fc->groups; 17663 while (fg != NULL) { 17664 /* Check if group is in this slice */ 17665 fs = &fg->slices[0]; 17666 if ((fg->stage_id == stage_fc->stage_id) 17667 && (fs->slice_number == master_slice)) { 17668 break; 17669 } 17670 fg = fg->next; 17671 } 17672 if (fg == NULL) { 17673 rv = BCM_E_INTERNAL; 17674 17675 goto cleanup; 17676 } 17677 17678 17679 /* Append slice to group's doubly-linked list of slices */ 17680 /* Get number of entry parts for the group. */ 17681 rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id, 17682 fg->flags, &parts_count); 17683 BCM_IF_ERROR_RETURN(rv); 17684 17685 old_physical_slice = fs->slice_number; 17686 17687 /* Set up the new physical slice parameters in Software */ 17688 for(part_index = parts_count - 1; part_index >= 0; part_index--) { 17689 /* Get entry flags. */ 17690 rv = _bcm_field_tcam_part_to_entry_flags(unit, part_index, fg, &entry_flags); 17691 BCM_IF_ERROR_RETURN(rv); 17692 17693 /* Get slice id for entry part */ 17694 rv = _bcm_field_tcam_part_to_slice_number(unit, part_index, 17695 fg, &slice_num); 17696 BCM_IF_ERROR_RETURN(rv); 17697 17698 /* Get slice pointer. */ 17699 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx 17700 + slice_num; 17701 17702 if (0 == (entry_flags & _FP_ENTRY_SECOND_HALF)) { 17703 /* Set per slice configuration & number of free entries in the slice.*/ 17704 fs->free_count = fs->entry_count; 17705 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 17706 fs->free_count >>= 1; 17707 } 17708 /* Set group flags in in slice.*/ 17709 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 17710 17711 /* Add slice to slices linked list . */ 17712 fs_temp = stage_fc->slices[_FP_DEF_INST] + old_physical_slice + slice_num; 17713 /* To handle more than one auto expanded slice in a group */ 17714 while (fs_temp->next != NULL) { 17715 fs_temp = fs_temp->next; 17716 } 17717 fs_temp->next = fs; 17718 fs->prev = fs_temp; 17719 } 17720 } 17721 17722 /* Now go over the entries in this slice */ 17723 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 17724 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 17725 17726 slice_ent_cnt = fs->entry_count; 17727 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 17728 slice_ent_cnt >>= 1; 17729 } 17730 prev_prio = -1; 17731 for (idx = 0; idx < slice_ent_cnt; idx++) { 17732 group_found = 0; 17733 if (_bcm_field_slice_offset_to_tcam_idx(unit, 17734 stage_fc, 17735 _FP_DEF_INST, 17736 slice_idx, 17737 idx, 17738 &phys_tcam_idx 17739 ) 17740 != BCM_E_NONE 17741 ) { 17742 rv = BCM_E_INTERNAL; 17743 goto cleanup; 17744 } 17745 tcam_entry = soc_mem_table_idx_to_pointer 17746 (unit, 17747 FP_TCAMm, 17748 fp_tcam_entry_t *, 17749 fp_tcam_buf, 17750 phys_tcam_idx 17751 ); 17752 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 0) { 17753 continue; 17754 } 17755 17756 /* Check which ports are applicable to this entry */ 17757 global_mask_tcam_entry = soc_mem_table_idx_to_pointer 17758 (unit, 17759 FP_GLOBAL_MASK_TCAMm, 17760 fp_global_mask_tcam_entry_t *, 17761 fp_global_mask_tcam_buf, 17762 phys_tcam_idx 17763 ); 17764 soc_mem_pbmp_field_get(unit, 17765 FP_GLOBAL_MASK_TCAMm, 17766 global_mask_tcam_entry, 17767 IPBMf, 17768 &entry_pbmp 17769 ); 17770 17771 soc_mem_pbmp_field_get(unit, 17772 FP_GLOBAL_MASK_TCAMm, 17773 global_mask_tcam_entry, 17774 IPBM_MASKf, 17775 &entry_mask_pbmp 17776 ); 17777 17778 /* Search groups to find match */ 17779 fg = fc->groups; 17780 while (fg != NULL) { 17781 /* Check if group is in this slice */ 17782 fs = &fg->slices[0]; 17783 if ((fg->stage_id != stage_fc->stage_id) 17784 || (fs->slice_number != master_slice)) { 17785 fg = fg->next; 17786 continue; 17787 } 17788 17789 /* Check if entry_pbmp is a subset of group pbmp */ 17790 17791 SOC_PBMP_CLEAR(temp_pbmp); 17792 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp); 17793 SOC_PBMP_OR(temp_pbmp, PBMP_LB(unit)); 17794 SOC_PBMP_AND(temp_pbmp, entry_pbmp); 17795 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) { 17796 group_found = 1; 17797 break; 17798 } 17799 17800 fg = fg->next; 17801 } 17802 if (!group_found) { 17803 return BCM_E_INTERNAL; /* Should never happen */ 17804 } 17805 17806 /* Allocate memory for the entry */ 17807 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 17808 fg->flags, &parts_count); 17809 if (BCM_FAILURE(rv)) { 17810 goto cleanup; 17811 } 17812 17813 _FP_XGS3_ALLOC(f_ent, 17814 (parts_count * sizeof (_field_entry_t)), 17815 "field entry" 17816 ); 17817 if (f_ent == NULL) { 17818 rv = BCM_E_MEMORY; 17819 goto cleanup; 17820 } 17821 17822 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 17823 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 17824 } 17825 17826 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 17827 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 17828 if (fc->l2warm) { 17829 /* Recover f_ent_oam_wb structure from here */ 17830 /* Allocate f_ent_oam_wb structure and pass it to 17831 * corresponding function */ 17832 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8) { 17833 _FP_XGS3_ALLOC(f_ent_oam_wb, sizeof (_field_entry_oam_wb_t), 17834 "Field Entry Warmboot"); 17835 if (f_ent_oam_wb == NULL) { 17836 sal_free (f_ent); 17837 return BCM_E_MEMORY; 17838 } 17839 } 17840 f_ent_wb_info.f_ent_oam_wb = f_ent_oam_wb; 17841 17842 if ((fc->wb_recovered_version) > BCM_FIELD_WB_VERSION_1_14) { 17843 action_bmp.w = NULL; 17844 _FP_XGS3_ALLOC(action_bmp.w, 17845 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 17846 "Action No Param Bitmap"); 17847 if (action_bmp.w == NULL) { 17848 rv = BCM_E_MEMORY; 17849 sal_free(f_ent); 17850 goto cleanup; 17851 } 17852 } 17853 f_ent_wb_info.action_bmp = &action_bmp; 17854 17855 /* Recover f_ent_policer_wb structure from here */ 17856 /* Allocate f_ent_policer_wb structure and pass it to 17857 * corresponding function */ 17858 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_17) { 17859 _FP_XGS3_ALLOC(f_ent_policer_wb, sizeof (_field_entry_policer_wb_t), 17860 "Field Entry Warmboot"); 17861 if (f_ent_policer_wb == NULL) { 17862 rv = BCM_E_MEMORY; 17863 sal_free (f_ent); 17864 goto cleanup; 17865 } 17866 } 17867 f_ent_wb_info.f_ent_policer_wb = f_ent_policer_wb; 17868 17869 rv = _field_trx_entry_info_retrieve 17870 (unit, 17871 fc, 17872 stage_fc, 17873 multigroup, 17874 &prev_prio, 17875 &f_ent_wb_info 17876 ); 17877 if (BCM_FAILURE(rv)) { 17878 sal_free(f_ent); 17879 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17880 goto cleanup; 17881 } 17882 } else { 17883 _bcm_field_last_alloc_eid_incr(unit); 17884 } 17885 pri_tcam_idx = phys_tcam_idx; 17886 for (i = 0; i < parts_count; i++) { 17887 if (fc->l2warm) { 17888 /* Use retrieved EID */ 17889 f_ent[i].eid = f_ent_wb_info.eid; 17890 /* Set retrieved dvp_type and svp_type */ 17891 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 17892 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 17893 f_ent[i].prio = f_ent_wb_info.prio; 17894 } else { 17895 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 17896 f_ent[i].prio = (vslice_idx << 10) | (slice_ent_cnt - idx); 17897 } 17898 f_ent[i].group = fg; 17899 if (i == 0) { 17900 BCM_PBMP_ASSIGN(f_ent[i].pbmp.data, entry_pbmp); 17901 BCM_PBMP_ASSIGN(f_ent[i].pbmp.mask, entry_mask_pbmp); 17902 } 17903 17904 rv = _bcm_field_tcam_part_to_entry_flags 17905 (unit, i, 17906 fg, 17907 &f_ent[i].flags 17908 ); 17909 if (BCM_FAILURE(rv)) { 17910 sal_free(f_ent); 17911 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17912 goto cleanup; 17913 } 17914 if (f_ent_wb_info.color_independent) { 17915 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 17916 } 17917 rv = _bcm_field_entry_part_tcam_idx_get 17918 (unit, 17919 f_ent, 17920 pri_tcam_idx, 17921 i, 17922 &part_index 17923 ); 17924 if (BCM_FAILURE(rv)) { 17925 sal_free(f_ent); 17926 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17927 goto cleanup; 17928 } 17929 rv = _bcm_field_tcam_idx_to_slice_offset 17930 (unit, 17931 stage_fc, 17932 _FP_DEF_INST, 17933 part_index, 17934 &slice_number, 17935 (int *)&f_ent[i].slice_idx 17936 ); 17937 if (BCM_FAILURE(rv)) { 17938 sal_free(f_ent); 17939 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17940 goto cleanup; 17941 } 17942 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 17943 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp); 17944 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 17945 /* Decrement slice free entry count for primary 17946 entries. */ 17947 f_ent[i].fs->free_count--; 17948 } 17949 17950 /* Assign entry to a slice */ 17951 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 17952 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 17953 17954 if (soc_FP_TCAMm_field32_get(unit, tcam_entry, VALIDf) == 3) { 17955 f_ent[i].flags |= _FP_ENTRY_ENABLED; 17956 } 17957 17958 /* Get the actions associated with this part of the entry */ 17959 policy_entry = soc_mem_table_idx_to_pointer 17960 (unit, 17961 FP_POLICY_TABLEm, 17962 fp_policy_table_entry_t *, 17963 fp_policy_buf, 17964 part_index 17965 ); 17966 rv = _field_tr2_actions_recover 17967 (unit, 17968 FP_POLICY_TABLEm, 17969 (uint32 *) policy_entry, 17970 f_ent, 17971 i, 17972 &f_ent_wb_info); 17973 if (BCM_FAILURE(rv)) { 17974 sal_free(f_ent); 17975 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17976 goto cleanup; 17977 } 17978 if (action_bmp.w != NULL) { 17979 _FP_ACTION_BMP_FREE(action_bmp); 17980 action_bmp.w = NULL; 17981 } 17982 } 17983 /* Add to the group */ 17984 rv = _field_group_entry_add(unit, fg, f_ent); 17985 if (BCM_FAILURE(rv)) { 17986 sal_free(f_ent); 17987 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17988 goto cleanup; 17989 } 17990 f_ent = NULL; 17991 /* Entry has been added to group, 17992 * so free f_ent_oam_wb structure */ 17993 _field_entry_oam_wb_free (unit, &f_ent_oam_wb); 17994 if (f_ent_policer_wb != NULL) { 17995 sal_free(f_ent_policer_wb); 17996 f_ent_policer_wb = NULL; 17997 } 17998 } 17999 /* Free up the temporary slice group info */ 18000 if (fc->l2warm) { 18001 _field_scache_slice_group_free(unit, 18002 fc, 18003 slice_idx 18004 ); 18005 } 18006 } 18007 18008 if (fc->l2warm) { 18009 /* Check to skip the recovery when not sync'd in warmboot upgrade case*/ 18010 if (recovered_ver_part0 >= BCM_FIELD_WB_VERSION_1_4) { 18011 LOG_DEBUG(BSL_LS_BCM_FP, 18012 (BSL_META_U(unit, 18013 "FP(unit %d) vverb: () Recovering Ingress Logical " 18014 " Policer Pool Info from scache position %d \n"), unit, 18015 fc->scache_pos)); 18016 fc->ingress_logical_policer_pools_mode = 18017 buf[fc->scache_pos] - (stage_fc->tcam_slices * 2); 18018 fc->scache_pos++; 18019 if (recovered_ver_part0 < BCM_FIELD_WB_VERSION_1_23) { 18020 /* ingress_logical_policer_pools_mode is synced twice. 18021 * WB support for it is enabled in version 1_4 and the location. 18022 * of sync is changed in version 1_23. Hence, the below code is 18023 * required to properly update meter indexes for the wb versions 18024 * between 1_4 and 1_23. 18025 */ 18026 if (fc->ingress_logical_policer_pools_mode != 18027 bcmFieldIngressLogicalPolicerPools8x1024) { 18028 LOG_DEBUG(BSL_LS_BCM_FP, 18029 (BSL_META_U(unit, 18030 "FP(unit %d) Policer Pools is in non default mode." 18031 "Updating Logical Meter indixes \r\n"), unit)); 18032 rv = _bcm_field_stage_ingress_tr3_logical_meter_idx_update(unit, fc, stage_fc); 18033 if (BCM_FAILURE(rv)) { 18034 goto cleanup; 18035 } 18036 } 18037 } 18038 18039 for (idx = 0; idx < stage_fc->num_logical_meter_pools; idx++) { 18040 f_logical_mp = stage_fc->logical_meter_pool[idx]; 18041 if (NULL == f_logical_mp) { 18042 return (BCM_E_INTERNAL); 18043 } 18044 18045 /* Check if entry is valid using 7th bit */ 18046 if ((buf[fc->scache_pos] & 0x80) == 0) { 18047 fc->scache_pos++; 18048 continue; 18049 } 18050 18051 /* Retrieve meter level from 6th bit */ 18052 if (buf[fc->scache_pos] & (1 << 6)) 18053 f_logical_mp->level = 1; 18054 else 18055 f_logical_mp->level = 0; 18056 18057 /* Use remaining to retrieve the slice_id*/ 18058 f_logical_mp->slice_id = (buf[fc->scache_pos] & 0x0F); 18059 18060 fc->scache_pos++; 18061 } 18062 18063 rv = _field_scache_logical_ingress_meter_pool_recover 18064 (unit, fc, stage_fc); 18065 if (BCM_FAILURE(rv)) { 18066 goto cleanup; 18067 } 18068 } 18069 } 18070 18071 if (fc->l2warm) { 18072 /* Mark end of Slice Info */ 18073 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 18074 fc->scache_pos++; 18075 } 18076 } 18077 18078 18079 /* To set per port flags */ 18080 group = fc->groups; 18081 while (group != NULL) { 18082 if (group->stage_id == _BCM_FIELD_STAGE_INGRESS) { 18083 if (!BCM_PBMP_EQ(PBMP_ALL(unit), group->pbmp)) { 18084 /* Update Group Flags to denote Port based Group */ 18085 group->flags |= _FP_GROUP_PER_PORT_OR_PBMP; 18086 } 18087 } 18088 group = group->next; 18089 } 18090 18091 /* Recover EgressPortsAdd Workaround Information */ 18092 if (soc_feature(unit, soc_feature_epc_linkflap_recover)) { 18093 if (recovered_ver_part0 >= BCM_FIELD_WB_VERSION_1_6) { 18094 BCM_IF_ERROR_RETURN (_field_egr_ports_recovery_scache_recover 18095 (unit,fc, stage_fc, &buf[fc->scache_pos])); 18096 } else { 18097 BCM_IF_ERROR_RETURN (_field_egr_ports_recovery_wb_upgrade_add 18098 (unit, fg)); 18099 } 18100 } 18101 18102 if (fc->l2warm) { 18103 /* Group Slice Selectors */ 18104 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 18105 rv = (_field_group_slice_selectors_recover(unit, 18106 &buf[fc->scache_pos], stage_fc->stage_id)); 18107 if (BCM_FAILURE(rv)) { 18108 goto cleanup; 18109 } 18110 } 18111 18112 temp = 0; 18113 temp |= buf[fc->scache_pos]; 18114 fc->scache_pos++; 18115 temp |= buf[fc->scache_pos] << 8; 18116 fc->scache_pos++; 18117 temp |= buf[fc->scache_pos] << 16; 18118 fc->scache_pos++; 18119 temp |= buf[fc->scache_pos] << 24; 18120 fc->scache_pos++; 18121 if (temp != _FIELD_IFP_DATA_END) { 18122 fc->l2warm = 0; 18123 rv = BCM_E_INTERNAL; 18124 } 18125 18126 if (NULL != buf1) { 18127 temp = 0; 18128 temp |= buf1[fc->scache_pos1]; 18129 fc->scache_pos1++; 18130 temp |= buf1[fc->scache_pos1] << 8; 18131 fc->scache_pos1++; 18132 temp |= buf1[fc->scache_pos1] << 16; 18133 fc->scache_pos1++; 18134 temp |= buf1[fc->scache_pos1] << 24; 18135 fc->scache_pos1++; 18136 if (temp != _FIELD_IFP_DATA_END) { 18137 fc->l2warm = 0; 18138 rv = BCM_E_INTERNAL; 18139 } 18140 } 18141 18142 } 18143 18144 if (BCM_SUCCESS(rv)) { 18145 _field_group_slice_vmap_recovery(unit, fc, stage_fc); 18146 } 18147 18148 _field_tr2_stage_reinit_all_groups_cleanup 18149 (unit, 18150 fc, 18151 _BCM_FIELD_STAGE_INGRESS, 18152 fp_table_pointers 18153 ); 18154 18155 cleanup: 18156 if (fp_global_mask_tcam_buf) { 18157 soc_cm_sfree(unit, fp_global_mask_tcam_buf); 18158 } 18159 18160 if (fp_tcam_buf) { 18161 soc_cm_sfree(unit, fp_tcam_buf); 18162 } 18163 if (fp_pfs_buf) { 18164 soc_cm_sfree(unit, fp_pfs_buf); 18165 } 18166 if (fp_policy_buf) { 18167 soc_cm_sfree(unit, fp_policy_buf); 18168 } 18169 if (fp_table_pointers) { 18170 soc_cm_sfree(unit, fp_table_pointers); 18171 } 18172 if (action_bmp.w != NULL) { 18173 _FP_ACTION_BMP_FREE(action_bmp); 18174 action_bmp.w = NULL; 18175 } 18176 if (f_ent_policer_wb != NULL) { 18177 sal_free(f_ent_policer_wb); 18178 f_ent_policer_wb = NULL; 18179 } 18180 return rv; 18181 } 18182 18183 /* 18184 * Function: 18185 * _bcm_field_tr3_stage_lookup_reinit 18186 * 18187 * Purpose: 18188 * Reconstruct's VFP/Lookup stage groups and entries. 18189 * 18190 * Parameters: 18191 * unit - (IN) BCM device number. 18192 * fc - (IN) Device field control structure pointer. 18193 * stage_fc - (IN) FP stage control info. 18194 * 18195 * Returns: 18196 * BCM_E_XXX 18197 */ 18198 int 18199 _bcm_field_tr3_stage_lookup_reinit(int unit, 18200 _field_control_t *fc, 18201 _field_stage_t *stage_fc) 18202 { 18203 int vslice_idx, max, master_slice; 18204 int idx, idx1, slice_idx, index_min, index_max, ratio, rv = BCM_E_NONE; 18205 int group_found, mem_sz, parts_count, slice_ent_cnt, expanded[4], slice_master_idx[4]; 18206 int i, pri_tcam_idx, part_index, slice_number, prev_prio; 18207 int paired, intraslice; 18208 char *vfp_policy_buf = NULL; /* Buffer to read the VFP_POLICY table */ 18209 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 18210 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 18211 uint32 rval, dbl_wide_key, dbl_wide_key_sec; 18212 uint32 *vfp_tcam_buf = NULL; /* Buffer to read the VFP_TCAM table */ 18213 uint32 vfp_key2, temp; 18214 uint64 vfp_key_1; 18215 soc_field_t fld; 18216 vfp_tcam_entry_t *vfp_tcam_entry; 18217 vfp_policy_table_entry_t *vfp_policy_entry; 18218 _field_hw_qual_info_t hw_sels; 18219 _field_slice_t *fs; 18220 _field_group_t *fg; 18221 _field_entry_t *f_ent = NULL; 18222 bcm_pbmp_t entry_pbmp, temp_pbmp; 18223 int offset_mode = 0, policer_index = 0; 18224 uint8 old_physical_slice, slice_num; 18225 uint32 entry_flags; 18226 _field_slice_t *fs_temp = NULL; 18227 soc_field_t vfp_en_flds[4] = {SLICE_ENABLE_SLICE_0f, 18228 SLICE_ENABLE_SLICE_1f, 18229 SLICE_ENABLE_SLICE_2f, 18230 SLICE_ENABLE_SLICE_3f}; 18231 18232 soc_field_t vfp_lk_en_flds[4] = {LOOKUP_ENABLE_SLICE_0f, 18233 LOOKUP_ENABLE_SLICE_1f, 18234 LOOKUP_ENABLE_SLICE_2f, 18235 LOOKUP_ENABLE_SLICE_3f}; 18236 uint64 regval; 18237 _field_action_bmp_t action_bmp; 18238 _field_entry_wb_info_t f_ent_wb_info; 18239 18240 /* Reset Action bitmap to NULL. */ 18241 action_bmp.w = NULL; 18242 18243 SOC_PBMP_CLEAR(entry_pbmp); 18244 sal_memset(expanded, 0, 4 * sizeof(int)); 18245 sal_memset(slice_master_idx, 0, 4 * sizeof(int)); 18246 18247 if (fc->l2warm) { 18248 rv = _field_scache_stage_hdr_chk(fc, _FIELD_VFP_DATA_START); 18249 if (BCM_FAILURE(rv)) { 18250 return (rv); 18251 } 18252 } 18253 18254 /* DMA various tables */ 18255 vfp_tcam_buf = soc_cm_salloc(unit, 18256 sizeof(vfp_tcam_entry_t) * 18257 soc_mem_index_count(unit, VFP_TCAMm), 18258 "VFP TCAM buffer"); 18259 if (NULL == vfp_tcam_buf) { 18260 return BCM_E_MEMORY; 18261 } 18262 18263 sal_memset(vfp_tcam_buf, 18264 0, 18265 sizeof(vfp_tcam_entry_t) * 18266 soc_mem_index_count(unit, VFP_TCAMm) 18267 ); 18268 index_min = soc_mem_index_min(unit, VFP_TCAMm); 18269 index_max = soc_mem_index_max(unit, VFP_TCAMm); 18270 18271 fs = stage_fc->slices[_FP_DEF_INST]; 18272 18273 if (stage_fc->flags & _FP_STAGE_HALF_SLICE) { 18274 slice_ent_cnt = fs->entry_count * 2; 18275 /* DMA in chunks */ 18276 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 18277 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 18278 if ((rv = soc_mem_read_range 18279 (unit, 18280 VFP_TCAMm, MEM_BLOCK_ALL, 18281 slice_idx * slice_ent_cnt, 18282 slice_idx * slice_ent_cnt + fs->entry_count / 2 - 1, 18283 vfp_tcam_buf + slice_idx * slice_ent_cnt 18284 * soc_mem_entry_words(unit, VFP_TCAMm)) 18285 ) < 0) { 18286 goto cleanup; 18287 } 18288 18289 if ((rv = soc_mem_read_range(unit, 18290 VFP_TCAMm, MEM_BLOCK_ALL, 18291 slice_idx * slice_ent_cnt + fs->entry_count, 18292 slice_idx * slice_ent_cnt 18293 + fs->entry_count + fs->entry_count / 2 - 1, 18294 vfp_tcam_buf + (slice_idx 18295 * slice_ent_cnt + fs->entry_count) 18296 * soc_mem_entry_words(unit, VFP_TCAMm)) 18297 ) < 0 ) { 18298 goto cleanup; 18299 } 18300 } 18301 } else { 18302 slice_ent_cnt = fs->entry_count; 18303 if ((rv = soc_mem_read_range(unit, 18304 VFP_TCAMm, 18305 MEM_BLOCK_ALL, 18306 index_min, 18307 index_max, 18308 vfp_tcam_buf) 18309 ) < 0 ) { 18310 goto cleanup; 18311 } 18312 } 18313 18314 vfp_policy_buf = soc_cm_salloc(unit, 18315 SOC_MEM_TABLE_BYTES(unit, VFP_POLICY_TABLEm), 18316 "VFP POLICY TABLE buffer" 18317 ); 18318 if (NULL == vfp_policy_buf) { 18319 return BCM_E_MEMORY; 18320 } 18321 index_min = soc_mem_index_min(unit, VFP_POLICY_TABLEm); 18322 index_max = soc_mem_index_max(unit, VFP_POLICY_TABLEm); 18323 if ((rv = soc_mem_read_range(unit, 18324 VFP_POLICY_TABLEm, 18325 MEM_BLOCK_ALL, 18326 index_min, 18327 index_max, 18328 vfp_policy_buf) 18329 ) < 0 ) { 18330 goto cleanup; 18331 } 18332 18333 /* Get slice expansion status and virtual map */ 18334 if ((rv = _field_slice_expanded_status_get 18335 (unit, 18336 fc, 18337 stage_fc, 18338 expanded, 18339 slice_master_idx) 18340 ) < 0) { 18341 goto cleanup; 18342 } 18343 18344 /* Iterate over the slices */ 18345 if ((rv = READ_VFP_SLICE_CONTROLr(unit, &rval)) < 0) { 18346 goto cleanup; 18347 } 18348 18349 if ((rv = READ_VFP_KEY_CONTROL_1r(unit, &vfp_key_1)) < 0) { 18350 goto cleanup; 18351 } 18352 18353 if ((rv = READ_VFP_KEY_CONTROL_2r(unit, &vfp_key2)) < 0) { 18354 goto cleanup; 18355 } 18356 18357 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 18358 18359 /* Ignore disabled slice */ 18360 if ((soc_reg_field_get 18361 (unit, 18362 VFP_SLICE_CONTROLr, 18363 rval, 18364 vfp_en_flds[slice_idx] 18365 ) == 0) 18366 || (soc_reg_field_get 18367 (unit, 18368 VFP_SLICE_CONTROLr, 18369 rval, vfp_lk_en_flds[slice_idx] 18370 ) == 0)) { 18371 continue; 18372 } 18373 18374 /* Ignore secondary slice in paired mode */ 18375 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 18376 paired = soc_reg64_field32_get 18377 (unit, 18378 VFP_KEY_CONTROL_1r, 18379 vfp_key_1, 18380 fld 18381 ); 18382 18383 fld = _tr3_vfp_slice_wide_mode_field[slice_idx]; 18384 intraslice = soc_reg64_field32_get 18385 (unit, 18386 VFP_KEY_CONTROL_1r, 18387 vfp_key_1, 18388 fld 18389 ); 18390 if (paired && (slice_idx % 2)) { 18391 continue; 18392 } 18393 18394 /* Don't need to read selectors for expanded slice */ 18395 if (expanded[slice_idx]) { 18396 continue; 18397 } 18398 18399 /* Skip if slice has no valid groups and entries */ 18400 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 18401 for (idx = 0; idx < slice_ent_cnt; idx++) { 18402 vfp_tcam_entry = soc_mem_table_idx_to_pointer 18403 (unit, 18404 VFP_TCAMm, 18405 vfp_tcam_entry_t *, 18406 vfp_tcam_buf, idx + slice_ent_cnt 18407 * slice_idx 18408 ); 18409 if (soc_VFP_TCAMm_field32_get(unit, 18410 vfp_tcam_entry, 18411 VALIDf) != 0) { 18412 break; 18413 } 18414 } 18415 if (idx == slice_ent_cnt && !fc->l2warm) { 18416 continue; 18417 } 18418 /* If Level 2, retrieve the GIDs in this slice */ 18419 if (fc->l2warm) { 18420 rv = _field_trx_scache_slice_group_recover(unit, 18421 fc, _FP_DEF_INST, 18422 slice_idx, 18423 NULL, 18424 stage_fc, 18425 0); 18426 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 18427 fc->l2warm = 0; 18428 goto cleanup; 18429 } 18430 if (rv == BCM_E_NOT_FOUND) { 18431 rv = BCM_E_NONE; 18432 continue; 18433 } 18434 } 18435 18436 /* Construct the group based on HW selector values */ 18437 _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[0]); 18438 hw_sels.pri_slice[0].intraslice = _FP_SELCODE_DONT_USE; 18439 _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[1]); 18440 hw_sels.pri_slice[1].intraslice = _FP_SELCODE_DONT_USE; 18441 _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[0]); 18442 hw_sels.sec_slice[0].intraslice = _FP_SELCODE_DONT_USE; 18443 _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[1]); 18444 hw_sels.sec_slice[1].intraslice = _FP_SELCODE_DONT_USE; 18445 18446 /* Get primary slice's selectors */ 18447 hw_sels.pri_slice[0].fpf1 = 0; 18448 hw_sels.pri_slice[0].fpf2 18449 = soc_reg64_field32_get 18450 (unit, 18451 VFP_KEY_CONTROL_1r, 18452 vfp_key_1, 18453 _bcm_field_trx_vfp_field_sel[slice_idx][0] 18454 ); 18455 hw_sels.pri_slice[0].fpf3 18456 = soc_reg64_field32_get 18457 (unit, 18458 VFP_KEY_CONTROL_1r, 18459 vfp_key_1, 18460 _bcm_field_trx_vfp_field_sel[slice_idx][1] 18461 ); 18462 18463 hw_sels.pri_slice[0].ip_header_sel 18464 = soc_reg_field_get 18465 (unit, 18466 VFP_KEY_CONTROL_2r, 18467 vfp_key2, 18468 _bcm_field_trx_vfp_ip_header_sel[slice_idx] 18469 ); 18470 18471 BCM_IF_ERROR_RETURN(soc_reg64_get(unit, 18472 VFP_KEY_CONTROL_1r, 18473 REG_PORT_ANY, 18474 0, 18475 ®val 18476 ) 18477 ); 18478 hw_sels.pri_slice[0].src_entity_sel = soc_reg64_field_get(unit, 18479 VFP_KEY_CONTROL_1r, 18480 regval, 18481 s_type_fld_tbl[slice_idx] 18482 ); 18483 if (0 == hw_sels.pri_slice[0].src_entity_sel) { 18484 hw_sels.pri_slice[0].src_entity_sel = _FP_SELCODE_DONT_CARE; 18485 } 18486 18487 /* If intraslice, get double-wide key - only 2 options */ 18488 if (intraslice) { 18489 dbl_wide_key = soc_reg64_field32_get 18490 (unit, 18491 VFP_KEY_CONTROL_1r, 18492 vfp_key_1, 18493 _bcm_field_trx_vfp_double_wide_sel[slice_idx] 18494 ); 18495 hw_sels.pri_slice[1].intraslice = TRUE; 18496 hw_sels.pri_slice[1].fpf2 = dbl_wide_key; 18497 hw_sels.pri_slice[1].fpf3 = 0; 18498 hw_sels.pri_slice[1].ip_header_sel 18499 = soc_reg_field_get 18500 (unit, 18501 VFP_KEY_CONTROL_2r, 18502 vfp_key2, 18503 _bcm_field_trx_vfp_ip_header_sel[slice_idx] 18504 ); 18505 18506 } 18507 18508 /* If paired, get secondary slice's selectors */ 18509 if (paired) { 18510 hw_sels.sec_slice[0].fpf1 = 0; 18511 hw_sels.sec_slice[0].fpf2 18512 = soc_reg64_field32_get 18513 (unit, 18514 VFP_KEY_CONTROL_1r, 18515 vfp_key_1, 18516 _bcm_field_trx_vfp_field_sel[slice_idx + 1][0] 18517 ); 18518 hw_sels.sec_slice[0].fpf3 18519 = soc_reg64_field32_get 18520 (unit, 18521 VFP_KEY_CONTROL_1r, 18522 vfp_key_1, 18523 _bcm_field_trx_vfp_field_sel[slice_idx + 1][1] 18524 ); 18525 hw_sels.sec_slice[0].ip_header_sel 18526 = soc_reg_field_get 18527 (unit, 18528 VFP_KEY_CONTROL_2r, vfp_key2, 18529 _bcm_field_trx_vfp_ip_header_sel[slice_idx + 1] 18530 ); 18531 18532 /* If in intraslie double wide mode, get DW keysel value. */ 18533 if (intraslice) { 18534 dbl_wide_key_sec 18535 = soc_reg64_field32_get 18536 (unit, 18537 VFP_KEY_CONTROL_1r, 18538 vfp_key_1, 18539 _bcm_field_trx_vfp_double_wide_sel[slice_idx + 1] 18540 ); 18541 hw_sels.sec_slice[1].intraslice = TRUE; 18542 hw_sels.sec_slice[1].fpf2 = dbl_wide_key_sec; 18543 hw_sels.sec_slice[1].fpf3 = 0; 18544 hw_sels.sec_slice[1].ip_header_sel 18545 = soc_reg_field_get 18546 (unit, 18547 VFP_KEY_CONTROL_2r, 18548 vfp_key2, 18549 _bcm_field_trx_vfp_ip_header_sel[slice_idx + 1] 18550 ); 18551 } 18552 } 18553 18554 /* Create a group based on HW qualifiers (or find existing) */ 18555 rv = _field_tr2_group_construct 18556 (unit, _FP_DEF_INST, &hw_sels, intraslice, 18557 paired, fc, -1, 18558 _BCM_FIELD_STAGE_LOOKUP, 18559 slice_idx 18560 ); 18561 if (BCM_FAILURE(rv)) { 18562 goto cleanup; 18563 } 18564 /* Now go over the entries */ 18565 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 18566 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 18567 fs->free_count >>= 1; 18568 ratio = 2; 18569 } else { 18570 ratio = 1; 18571 } 18572 prev_prio = -1; 18573 for (idx = 0; idx < slice_ent_cnt / ratio; idx++) { 18574 group_found = 0; 18575 vfp_tcam_entry = soc_mem_table_idx_to_pointer 18576 (unit, 18577 VFP_TCAMm, 18578 vfp_tcam_entry_t *, vfp_tcam_buf, 18579 idx + slice_ent_cnt * slice_idx 18580 ); 18581 if (soc_VFP_TCAMm_field32_get 18582 (unit, 18583 vfp_tcam_entry, 18584 VALIDf 18585 ) == 0) { 18586 continue; 18587 } 18588 18589 /* All ports are applicable to this entry */ 18590 SOC_PBMP_ASSIGN(entry_pbmp, PBMP_PORT_ALL(unit)); 18591 SOC_PBMP_OR(entry_pbmp, PBMP_CMIC(unit)); 18592 18593 /* Search groups to find match */ 18594 fg = fc->groups; 18595 while (fg != NULL) { 18596 18597 /* Check if group is in this slice */ 18598 fs = &fg->slices[0]; 18599 if (fs->slice_number != slice_idx) { 18600 fg = fg->next; 18601 continue; 18602 } 18603 18604 /* Check if entry_pbmp is a subset of group pbmp */ 18605 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp); 18606 SOC_PBMP_AND(temp_pbmp, entry_pbmp); 18607 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) { 18608 group_found = 1; 18609 break; 18610 } 18611 fg = fg->next; 18612 } 18613 18614 if (!group_found) { 18615 return BCM_E_INTERNAL; /* Should never happen */ 18616 } 18617 18618 /* Allocate memory for the entry */ 18619 rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id, 18620 fg->flags, &parts_count); 18621 if (BCM_FAILURE(rv)) { 18622 goto cleanup; 18623 } 18624 18625 mem_sz = parts_count * sizeof (_field_entry_t); 18626 _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry"); 18627 if (f_ent == NULL) { 18628 rv = BCM_E_MEMORY; 18629 goto cleanup; 18630 } 18631 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 18632 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 18633 } 18634 18635 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 18636 f_ent_wb_info.action_bmp = &action_bmp; 18637 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 18638 if (fc->l2warm) { 18639 if ((fc->wb_recovered_version) > BCM_FIELD_WB_VERSION_1_14) { 18640 action_bmp.w = NULL; 18641 _FP_XGS3_ALLOC(action_bmp.w, 18642 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 18643 "Action No Param Bitmap"); 18644 if (action_bmp.w == NULL) { 18645 rv = BCM_E_MEMORY; 18646 sal_free(f_ent); 18647 goto cleanup; 18648 } 18649 } 18650 18651 rv = _field_trx_entry_info_retrieve(unit, 18652 fc, 18653 stage_fc, 18654 0, 18655 &prev_prio, 18656 &f_ent_wb_info 18657 ); 18658 if (BCM_FAILURE(rv)) { 18659 sal_free(f_ent); 18660 goto cleanup; 18661 } 18662 } else { 18663 _bcm_field_last_alloc_eid_incr(unit); 18664 } 18665 18666 pri_tcam_idx = idx + slice_ent_cnt * slice_idx; 18667 for (i = 0; i < parts_count; i++) { 18668 if (fc->l2warm) { 18669 /* Use retrieved EID */ 18670 f_ent[i].eid = f_ent_wb_info.eid; 18671 /* Set retrieved dvp_type and svp_type */ 18672 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 18673 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 18674 f_ent[i].prio = f_ent_wb_info.prio; 18675 } else { 18676 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 18677 f_ent[i].prio = (slice_idx << 10) | (slice_ent_cnt - idx); 18678 } 18679 f_ent[i].group = fg; 18680 rv = _bcm_field_tcam_part_to_entry_flags 18681 (unit, i, 18682 fg, 18683 &f_ent[i].flags 18684 ); 18685 if (BCM_FAILURE(rv)) { 18686 sal_free(f_ent); 18687 goto cleanup; 18688 } 18689 if (f_ent_wb_info.color_independent) { 18690 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 18691 } 18692 rv = _bcm_field_entry_part_tcam_idx_get 18693 (unit, 18694 f_ent, 18695 pri_tcam_idx, 18696 i, 18697 &part_index 18698 ); 18699 if (BCM_FAILURE(rv)) { 18700 sal_free(f_ent); 18701 goto cleanup; 18702 } 18703 rv = _bcm_field_tcam_idx_to_slice_offset 18704 (unit, 18705 stage_fc, 18706 _FP_DEF_INST, 18707 part_index, 18708 &slice_number, 18709 (int *)&f_ent[i].slice_idx 18710 ); 18711 if (BCM_FAILURE(rv)) { 18712 sal_free(f_ent); 18713 goto cleanup; 18714 } 18715 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 18716 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 18717 /* Decrement slice free entry count for primary 18718 entries. */ 18719 f_ent[i].fs->free_count--; 18720 } 18721 /* Assign entry to a slice */ 18722 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 18723 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp); 18724 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 18725 18726 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, VALIDf) == 3) { 18727 f_ent[i].flags |= _FP_ENTRY_ENABLED; 18728 } 18729 18730 /* Get the actions associated with this part of the entry */ 18731 vfp_policy_entry = soc_mem_table_idx_to_pointer 18732 (unit, 18733 VFP_POLICY_TABLEm, 18734 vfp_policy_table_entry_t *, 18735 vfp_policy_buf, 18736 part_index 18737 ); 18738 rv = _field_tr2_actions_recover 18739 (unit, 18740 VFP_POLICY_TABLEm, 18741 (uint32 *) vfp_policy_entry, 18742 f_ent, 18743 i, 18744 &f_ent_wb_info); 18745 if (BCM_FAILURE(rv)) { 18746 sal_free(f_ent); 18747 goto cleanup; 18748 } 18749 if (action_bmp.w != NULL) { 18750 _FP_ACTION_BMP_FREE(action_bmp); 18751 action_bmp.w = NULL; 18752 } 18753 policer_index = PolicyGet(unit, 18754 VFP_POLICY_TABLEm, 18755 vfp_policy_entry, 18756 SVC_METER_INDEXf); 18757 offset_mode = PolicyGet(unit, 18758 VFP_POLICY_TABLEm, 18759 vfp_policy_entry, 18760 SVC_METER_OFFSET_MODEf); 18761 rv = _bcm_esw_get_policer_id_from_index_offset(unit, 18762 policer_index, offset_mode, 18763 &(f_ent->global_meter_policer.pid)); 18764 if (BCM_FAILURE(rv)) { 18765 sal_free(f_ent); 18766 goto cleanup; 18767 } 18768 f_ent->global_meter_policer.flags = PolicyGet(unit, 18769 VFP_POLICY_TABLEm, 18770 vfp_policy_entry, 18771 SVC_METER_INDEX_PRIORITYf); 18772 18773 if (soc_feature(unit, soc_feature_advanced_flex_counter)) { 18774 _field_adv_flex_stat_info_retrieve(unit, f_ent->statistic.sid); 18775 } 18776 } 18777 /* Add to the group */ 18778 rv = _field_group_entry_add(unit, fg, f_ent); 18779 if (BCM_FAILURE(rv)) { 18780 sal_free(f_ent); 18781 goto cleanup; 18782 } 18783 f_ent = NULL; 18784 } 18785 /* Free up the temporary slice group info */ 18786 if (fc->l2warm) { 18787 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) { 18788 /* update selcode and construct group qual offset */ 18789 rv = _field_tr2_group_construct_quals_with_sel_update(unit, fc, stage_fc); 18790 if (BCM_FAILURE(rv)) { 18791 goto cleanup; 18792 } 18793 } 18794 _field_scache_slice_group_free(unit, 18795 fc, 18796 slice_idx 18797 ); 18798 } 18799 } 18800 18801 /* Now go over the expanded slices */ 18802 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) { 18803 if (!expanded[slice_idx]) { 18804 continue; 18805 } 18806 /* Ignore secondary slice in paired mode */ 18807 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2]; 18808 paired = soc_reg64_field32_get 18809 (unit, 18810 VFP_KEY_CONTROL_1r, 18811 vfp_key_1, 18812 fld 18813 ); 18814 if (paired && (slice_idx % 2)) { 18815 continue; 18816 } 18817 /* Skip if slice has no valid groups and entries */ 18818 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 18819 for (idx = 0; idx < slice_ent_cnt; idx++) { 18820 vfp_tcam_entry = soc_mem_table_idx_to_pointer 18821 (unit, 18822 VFP_TCAMm, 18823 vfp_tcam_entry_t *, 18824 vfp_tcam_buf, 18825 idx + slice_ent_cnt * slice_idx 18826 ); 18827 if (soc_VFP_TCAMm_field32_get 18828 (unit, 18829 vfp_tcam_entry, 18830 VALIDf) != 0) { 18831 break; 18832 } 18833 } 18834 18835 if (idx == slice_ent_cnt) { 18836 continue; 18837 } 18838 18839 /* If Level 2, retrieve the GIDs in this slice */ 18840 if (fc->l2warm) { 18841 rv = _field_trx_scache_slice_group_recover 18842 (unit, 18843 fc, _FP_DEF_INST, 18844 slice_idx, 18845 NULL, 18846 stage_fc, 18847 0); 18848 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 18849 fc->l2warm = 0; 18850 goto cleanup; 18851 } 18852 if (rv == BCM_E_NOT_FOUND) { 18853 rv = BCM_E_NONE; 18854 continue; 18855 } 18856 } 18857 18858 /* Now find the master slice for this virtual group */ 18859 vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST, 18860 slice_idx, stage_fc); 18861 if (vslice_idx < 0) { 18862 rv = BCM_E_INTERNAL; 18863 goto cleanup; 18864 } 18865 18866 if (fc->l2warm 18867 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8)) { 18868 master_slice = slice_master_idx[slice_idx]; 18869 } else { 18870 max = -1; 18871 for (i = 0; i < stage_fc->tcam_slices; i++) { 18872 if ((stage_fc->vmap[_FP_DEF_INST][0][vslice_idx].virtual_group == 18873 stage_fc->vmap[_FP_DEF_INST][0][i].virtual_group) && (i != vslice_idx)) { 18874 if (i > max) { 18875 max = i; 18876 } 18877 } 18878 } 18879 if (max < 0) { 18880 rv = BCM_E_INTERNAL; 18881 goto cleanup; 18882 } 18883 18884 master_slice = stage_fc->vmap[_FP_DEF_INST][0][max].vmap_key; 18885 } 18886 /* See which group is in this slice - can be only one */ 18887 fg = fc->groups; 18888 while (fg != NULL) { 18889 /* Check if group is in this slice */ 18890 fs = &fg->slices[0]; 18891 if ((fg->stage_id == stage_fc->stage_id) 18892 && (fs->slice_number == master_slice)) { 18893 break; 18894 } 18895 fg = fg->next; 18896 } 18897 if (fg == NULL) { 18898 rv = BCM_E_INTERNAL; 18899 goto cleanup; 18900 } 18901 18902 /* Append slice to group's doubly-linked list of slices */ 18903 /* Get number of entry parts for the group. */ 18904 rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id, 18905 fg->flags, &parts_count); 18906 BCM_IF_ERROR_RETURN(rv); 18907 18908 old_physical_slice = fs->slice_number; 18909 18910 /* Set up the new physical slice parameters in Software */ 18911 for(part_index = parts_count - 1; part_index >= 0; part_index--) { 18912 /* Get entry flags. */ 18913 rv = _bcm_field_tcam_part_to_entry_flags(unit, part_index, fg, &entry_flags); 18914 BCM_IF_ERROR_RETURN(rv); 18915 18916 /* Get slice id for entry part */ 18917 rv = _bcm_field_tcam_part_to_slice_number(unit, part_index, 18918 fg, &slice_num); 18919 BCM_IF_ERROR_RETURN(rv); 18920 18921 /* Get slice pointer. */ 18922 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx 18923 + slice_num; 18924 18925 if (0 == (entry_flags & _FP_ENTRY_SECOND_HALF)) { 18926 /* Set per slice configuration & number of free entries in the slice.*/ 18927 fs->free_count = fs->entry_count; 18928 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 18929 fs->free_count >>= 1; 18930 } 18931 /* Set group flags in in slice.*/ 18932 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 18933 18934 /* Add slice to slices linked list . */ 18935 fs_temp = stage_fc->slices[_FP_DEF_INST] + old_physical_slice + slice_num; 18936 /* To handle more than one auto expanded slice in a group */ 18937 while (fs_temp->next != NULL) { 18938 fs_temp = fs_temp->next; 18939 } 18940 fs_temp->next = fs; 18941 fs->prev = fs_temp; 18942 } 18943 } 18944 18945 /* Now go over the entries */ 18946 fs = stage_fc->slices[_FP_DEF_INST] + slice_idx; 18947 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK; 18948 if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) { 18949 ratio = 2; 18950 } else { 18951 ratio = 1; 18952 } 18953 18954 prev_prio = -1; 18955 for (idx = 0; idx < slice_ent_cnt / ratio; idx++) { 18956 group_found = 0; 18957 vfp_tcam_entry = soc_mem_table_idx_to_pointer 18958 (unit, 18959 VFP_TCAMm, 18960 vfp_tcam_entry_t *, 18961 vfp_tcam_buf, 18962 idx + slice_ent_cnt * slice_idx 18963 ); 18964 if (soc_VFP_TCAMm_field32_get 18965 (unit, 18966 vfp_tcam_entry, 18967 VALIDf 18968 ) == 0) { 18969 continue; 18970 } 18971 18972 /* All ports are applicable to this entry */ 18973 SOC_PBMP_ASSIGN(entry_pbmp, PBMP_PORT_ALL(unit)); 18974 SOC_PBMP_OR(entry_pbmp, PBMP_CMIC(unit)); 18975 18976 /* Search groups to find match */ 18977 fg = fc->groups; 18978 while (fg != NULL) { 18979 18980 /* Check if group is in this slice */ 18981 fs = &fg->slices[0]; 18982 if ((fg->stage_id != stage_fc->stage_id) 18983 || (fs->slice_number != master_slice)) { 18984 fg = fg->next; 18985 continue; 18986 } 18987 18988 /* Check if entry_pbmp is a subset of group pbmp */ 18989 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp); 18990 SOC_PBMP_AND(temp_pbmp, entry_pbmp); 18991 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) { 18992 group_found = 1; 18993 break; 18994 } 18995 fg = fg->next; 18996 } 18997 18998 if (!group_found) { 18999 return BCM_E_INTERNAL; /* Should never happen */ 19000 } 19001 19002 /* Allocate memory for the entry */ 19003 rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 19004 fg->flags, &parts_count); 19005 if (BCM_FAILURE(rv)) { 19006 goto cleanup; 19007 } 19008 mem_sz = parts_count * sizeof (_field_entry_t); 19009 _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry"); 19010 if (f_ent == NULL) { 19011 rv = BCM_E_MEMORY; 19012 goto cleanup; 19013 } 19014 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 19015 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 19016 } 19017 19018 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 19019 f_ent_wb_info.action_bmp = &action_bmp; 19020 f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1; 19021 if (fc->l2warm) { 19022 if ((fc->wb_recovered_version) > BCM_FIELD_WB_VERSION_1_14) { 19023 action_bmp.w = NULL; 19024 _FP_XGS3_ALLOC(action_bmp.w, 19025 SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount), 19026 "Action No Param Bitmap"); 19027 if (action_bmp.w == NULL) { 19028 rv = BCM_E_MEMORY; 19029 sal_free(f_ent); 19030 goto cleanup; 19031 } 19032 } 19033 19034 rv = _field_trx_entry_info_retrieve 19035 (unit, 19036 fc, 19037 stage_fc, 19038 0, 19039 &prev_prio, 19040 &f_ent_wb_info 19041 ); 19042 if (BCM_FAILURE(rv)) { 19043 sal_free(f_ent); 19044 goto cleanup; 19045 } 19046 } else { 19047 _bcm_field_last_alloc_eid_incr(unit); 19048 } 19049 pri_tcam_idx = idx + slice_ent_cnt * slice_idx; 19050 for (i = 0; i < parts_count; i++) { 19051 if (fc->l2warm) { 19052 /* Use retrieved EID */ 19053 f_ent[i].eid = f_ent_wb_info.eid; 19054 /* Set retrieved dvp_type and svp_type */ 19055 f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i]; 19056 f_ent[i].svp_type = f_ent_wb_info.svp_type[i]; 19057 f_ent[i].prio = f_ent_wb_info.prio; 19058 } else { 19059 f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit); 19060 f_ent[i].prio = (slice_idx << 10) | (slice_ent_cnt - idx); 19061 } 19062 f_ent[i].group = fg; 19063 rv = _bcm_field_tcam_part_to_entry_flags 19064 (unit, i, 19065 fg, 19066 &f_ent[i].flags 19067 ); 19068 if (BCM_FAILURE(rv)) { 19069 sal_free(f_ent); 19070 goto cleanup; 19071 } 19072 if (f_ent_wb_info.color_independent) { 19073 f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT; 19074 } 19075 rv = _bcm_field_entry_part_tcam_idx_get 19076 (unit, 19077 f_ent, 19078 pri_tcam_idx, 19079 i, 19080 &part_index 19081 ); 19082 if (BCM_FAILURE(rv)) { 19083 sal_free(f_ent); 19084 goto cleanup; 19085 } 19086 rv = _bcm_field_tcam_idx_to_slice_offset 19087 (unit, 19088 stage_fc, 19089 _FP_DEF_INST, 19090 part_index, 19091 &slice_number, 19092 (int *)&f_ent[i].slice_idx 19093 ); 19094 if (BCM_FAILURE(rv)) { 19095 sal_free(f_ent); 19096 goto cleanup; 19097 } 19098 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number; 19099 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) { 19100 /* Decrement slice free entry count for primary 19101 entries. */ 19102 f_ent[i].fs->free_count--; 19103 } 19104 /* Assign entry to a slice */ 19105 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i; 19106 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp); 19107 f_ent[i].flags |= _FP_ENTRY_INSTALLED; 19108 19109 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, VALIDf) == 3) { 19110 f_ent[i].flags |= _FP_ENTRY_ENABLED; 19111 } 19112 19113 /* Get the actions associated with this part of the entry */ 19114 vfp_policy_entry = soc_mem_table_idx_to_pointer 19115 (unit, 19116 VFP_POLICY_TABLEm, 19117 vfp_policy_table_entry_t *, 19118 vfp_policy_buf, 19119 part_index 19120 ); 19121 rv = _field_tr2_actions_recover 19122 (unit, 19123 VFP_POLICY_TABLEm, 19124 (uint32 *) vfp_policy_entry, 19125 f_ent, 19126 i, 19127 &f_ent_wb_info); 19128 if (BCM_FAILURE(rv)) { 19129 sal_free(f_ent); 19130 goto cleanup; 19131 } 19132 if (action_bmp.w != NULL) { 19133 _FP_ACTION_BMP_FREE(action_bmp); 19134 action_bmp.w = NULL; 19135 } 19136 policer_index = PolicyGet(unit, 19137 VFP_POLICY_TABLEm, 19138 vfp_policy_entry, 19139 SVC_METER_INDEXf); 19140 offset_mode = PolicyGet(unit, 19141 VFP_POLICY_TABLEm, 19142 vfp_policy_entry, 19143 SVC_METER_OFFSET_MODEf); 19144 rv = _bcm_esw_get_policer_id_from_index_offset(unit, 19145 policer_index, offset_mode, 19146 &(f_ent->global_meter_policer.pid)); 19147 if (BCM_FAILURE(rv)) { 19148 sal_free(f_ent); 19149 goto cleanup; 19150 } 19151 f_ent->global_meter_policer.flags = PolicyGet(unit, 19152 VFP_POLICY_TABLEm, 19153 vfp_policy_entry, 19154 SVC_METER_INDEX_PRIORITYf); 19155 if (soc_feature(unit, soc_feature_advanced_flex_counter)) { 19156 _field_adv_flex_stat_info_retrieve(unit, f_ent->statistic.sid); 19157 } 19158 } 19159 /* Add to the group */ 19160 rv = _field_group_entry_add(unit, fg, f_ent); 19161 if (BCM_FAILURE(rv)) { 19162 sal_free(f_ent); 19163 goto cleanup; 19164 } 19165 f_ent = NULL; 19166 } 19167 /* Free up the temporary slice group info */ 19168 if (fc->l2warm) { 19169 _field_scache_slice_group_free(unit, 19170 fc, 19171 slice_idx 19172 ); 19173 } 19174 } 19175 19176 if (fc->l2warm) { 19177 /* Mark end of Slice Info */ 19178 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 19179 fc->scache_pos++; 19180 } 19181 19182 /* Group Slice Selectors */ 19183 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 19184 rv = (_field_group_slice_selectors_recover(unit, 19185 &buf[fc->scache_pos], stage_fc->stage_id)); 19186 if (BCM_FAILURE(rv)) { 19187 goto cleanup; 19188 } 19189 } 19190 19191 temp = 0; 19192 temp |= buf[fc->scache_pos]; 19193 fc->scache_pos++; 19194 temp |= buf[fc->scache_pos] << 8; 19195 fc->scache_pos++; 19196 temp |= buf[fc->scache_pos] << 16; 19197 fc->scache_pos++; 19198 temp |= buf[fc->scache_pos] << 24; 19199 fc->scache_pos++; 19200 if (temp != _FIELD_VFP_DATA_END) { 19201 fc->l2warm = 0; 19202 rv = BCM_E_INTERNAL; 19203 } 19204 19205 if (NULL != buf1) { 19206 temp = 0; 19207 temp |= buf1[fc->scache_pos1]; 19208 fc->scache_pos1++; 19209 temp |= buf1[fc->scache_pos1] << 8; 19210 fc->scache_pos1++; 19211 temp |= buf1[fc->scache_pos1] << 16; 19212 fc->scache_pos1++; 19213 temp |= buf1[fc->scache_pos1] << 24; 19214 fc->scache_pos1++; 19215 if (temp != _FIELD_VFP_DATA_END) { 19216 fc->l2warm = 0; 19217 rv = BCM_E_INTERNAL; 19218 } 19219 } 19220 } 19221 19222 if (BCM_SUCCESS(rv)) { 19223 _field_group_slice_vmap_recovery(unit, fc, stage_fc); 19224 } 19225 19226 _field_tr2_stage_reinit_all_groups_cleanup 19227 (unit, 19228 fc, 19229 _BCM_FIELD_STAGE_LOOKUP, 19230 NULL 19231 ); 19232 19233 cleanup: 19234 if (vfp_tcam_buf) { 19235 soc_cm_sfree(unit, vfp_tcam_buf); 19236 } 19237 if (vfp_policy_buf) { 19238 soc_cm_sfree(unit, vfp_policy_buf); 19239 } 19240 if (action_bmp.w != NULL) { 19241 _FP_ACTION_BMP_FREE(action_bmp); 19242 action_bmp.w = NULL; 19243 } 19244 return rv; 19245 } 19246 19247 /* 19248 * Function: 19249 * _bcm_field_tr3_stage_egress_reinit 19250 * 19251 * Purpose: 19252 * Reconstruct EFP/Egress stage groups and entries. 19253 * 19254 * Parameters: 19255 * unit - (IN) BCM device number. 19256 * fc - (IN) Device field control structure pointer. 19257 * stage_fc - (IN) FP stage control info. 19258 * 19259 * Returns: 19260 * BCM_E_XXX 19261 */ 19262 int 19263 _bcm_field_tr3_stage_egress_reinit(int unit, 19264 _field_control_t *fc, 19265 _field_stage_t *stage_fc) 19266 { 19267 return (BCM_E_NONE); 19268 } 19269 19270 /* 19271 * Function: 19272 * _field_tr3_profiled_actions_recover 19273 * Purpose: 19274 * Recovering profiled actions for external stage 19275 * during level 2 warm boot 19276 * Parameters: 19277 * unit - (IN) BCM device number 19278 * policy_mem - (IN) Policy mem 19279 * entry_idx - (IN) Entry Id 19280 * stage_fc - (IN) Stage field control structure 19281 * f_ent - (IN/OUT) Field entry structure 19282 * Returns: 19283 * BCM_E_XXX 19284 */ 19285 int 19286 _field_tr3_profiled_actions_recover(int unit, 19287 soc_mem_t policy_mem, 19288 unsigned entry_idx, 19289 _field_stage_t *stage_fc, 19290 _field_entry_t *f_ent 19291 ) 19292 { 19293 int part_index, table_index = 0, rv = BCM_E_NONE; 19294 const soc_field_t *p; 19295 unsigned ofs = 0, n; 19296 19297 bcm_field_action_t action = -1; 19298 19299 /* fp policy entry with maximum width is used as it can also be used for 19300 fp policy entries with lesser width (1x/2x/3x/4x) */ 19301 ext_fp_policy_6x_entry_t ext_fp_policy_buf; 19302 19303 esm_acl_profile_entry_t esm_acl_profile_buf; 19304 uint32 append = 0, action_val = 0, param0 = 0, param1 = 0, param2 = 0; 19305 uint32 profiled_actions_buf[COUNTOF(esm_acl_profile_buf.entry_data)]; 19306 19307 soc_profile_mem_t *profile = &stage_fc->ext_act_profile; 19308 soc_profile_mem_table_t *table; 19309 19310 /* Buffer initialization */ 19311 sal_memset(ext_fp_policy_buf.entry_data, 19312 0, 19313 sizeof(ext_fp_policy_buf.entry_data) 19314 ); 19315 19316 sal_memset(esm_acl_profile_buf.entry_data, 19317 0, 19318 sizeof(esm_acl_profile_buf.entry_data) 19319 ); 19320 19321 sal_memset(profiled_actions_buf, 0, sizeof(profiled_actions_buf)); 19322 19323 rv = soc_mem_read(unit, policy_mem, MEM_BLOCK_ANY, entry_idx, 19324 ext_fp_policy_buf.entry_data); 19325 if (BCM_FAILURE(rv)) { 19326 LOG_ERROR(BSL_LS_BCM_FP, 19327 (BSL_META_U(unit, 19328 "Error while reading policy entry\n"))); 19329 return(rv); 19330 } 19331 19332 part_index = soc_mem_field32_get(unit, 19333 policy_mem, 19334 ext_fp_policy_buf.entry_data, 19335 PROFILE_IDf 19336 ); 19337 19338 /* Update the reference count */ 19339 profile = &stage_fc->ext_act_profile; 19340 table = &profile->tables[table_index]; 19341 table->entries[part_index].ref_count++; 19342 table->entries[part_index].entries_per_set = 1; 19343 19344 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 19345 ESM_ACL_PROFILEm, 19346 MEM_BLOCK_ANY, 19347 part_index, 19348 esm_acl_profile_buf.entry_data 19349 ) 19350 ); 19351 soc_mem_field_get(unit, 19352 ESM_ACL_PROFILEm, 19353 esm_acl_profile_buf.entry_data, 19354 ACTIONSf, 19355 profiled_actions_buf 19356 ); 19357 19358 /* Identify profiled actions from profiled_actions_buf using width 19359 and offset */ 19360 for (p = _field_tr3_external_profiled_policy_fld_tbl, 19361 n = COUNTOF(_field_tr3_external_profiled_policy_fld_tbl); 19362 n; 19363 --n, ++p 19364 ) { 19365 unsigned w = soc_mem_field_length(unit, FP_POLICY_TABLEm, *p); 19366 SHR_BITDCL val = 0; 19367 19368 SHR_BITCOPY_RANGE(&val, 0, profiled_actions_buf, ofs, w); 19369 19370 if (!val) { 19371 ofs += w; 19372 continue; 19373 } 19374 19375 switch (*p) { 19376 case R_NEW_ECNf: 19377 param0 = val; 19378 break; 19379 case Y_NEW_ECNf: 19380 param1 = val; 19381 break; 19382 case G_NEW_ECNf: 19383 param2 = val; 19384 break; 19385 case R_CHANGE_ECNf: 19386 if ((param0) && !((param0 == param1) && (param1 == param2))) { 19387 action = bcmFieldActionRpEcnNew; 19388 append = 1; 19389 } else { 19390 action_val = val; 19391 } 19392 break; 19393 case Y_CHANGE_ECNf: 19394 if ((param1) && !((param0 == param1) && (param1 == param2))) { 19395 action = bcmFieldActionYpEcnNew; 19396 param0 = param1; 19397 append = 1; 19398 } else { 19399 action_val |= val << 1; 19400 } 19401 break; 19402 case G_CHANGE_ECNf: 19403 if ((param2) && !((param0 == param1) && (param1 == param2))) { 19404 action = bcmFieldActionGpEcnNew; 19405 param0 = param2; 19406 append = 1; 19407 break; 19408 } else { 19409 action_val |= val << 1; 19410 } 19411 if (action_val) { 19412 action = bcmFieldActionEcnNew; 19413 append = 1; 19414 } 19415 action_val = 0; 19416 break; 19417 case R_NEW_PKT_PRIf: 19418 param0 = val; 19419 break; 19420 case Y_NEW_PKT_PRIf: 19421 param1 = val; 19422 break; 19423 case G_NEW_PKT_PRIf: 19424 param2 = val; 19425 break; 19426 case R_CHANGE_PKT_PRIf: 19427 switch (val) { 19428 case 4: 19429 action = bcmFieldActionRpPrioPktCopy; 19430 append = 1; 19431 break; 19432 case 5: 19433 if (!((param0 == param1) && (param1 == param2))) { 19434 action = bcmFieldActionRpPrioPktNew; 19435 append = 1; 19436 } else { 19437 action_val = val; 19438 } 19439 break; 19440 case 6: 19441 action = bcmFieldActionRpPrioPktTos; 19442 append = 1; 19443 break; 19444 case 7: 19445 action = bcmFieldActionRpPrioPktCancel; 19446 append = 1; 19447 break; 19448 default: 19449 break; 19450 } 19451 break; 19452 case Y_CHANGE_PKT_PRIf: 19453 switch (val) { 19454 case 4: 19455 action = bcmFieldActionYpPrioPktCopy; 19456 append = 1; 19457 break; 19458 case 5: 19459 if (!((param0 == param1) && (param1 == param2))) { 19460 action = bcmFieldActionYpPrioPktNew; 19461 param0 = param1; 19462 append = 1; 19463 } else { 19464 action_val |= val << 3; 19465 } 19466 break; 19467 case 6: 19468 action = bcmFieldActionYpPrioPktTos; 19469 append = 1; 19470 break; 19471 case 7: 19472 action = bcmFieldActionYpPrioPktCancel; 19473 append = 1; 19474 break; 19475 default: 19476 break; 19477 } 19478 break; 19479 case G_CHANGE_PKT_PRIf: 19480 switch (val) { 19481 case 4: 19482 action = bcmFieldActionGpPrioPktCopy; 19483 append = 1; 19484 break; 19485 case 5: 19486 if (!((param0 == param1) && (param1 == param2))) { 19487 action = bcmFieldActionGpPrioPktNew; 19488 param0 = param2; 19489 append = 1; 19490 } else { 19491 action_val |= val << 6; 19492 } 19493 if (action_val & 0x16d) { 19494 action = bcmFieldActionPrioPktNew; 19495 append = 1; 19496 } 19497 action_val = 0; 19498 break; 19499 case 6: 19500 action = bcmFieldActionGpPrioPktTos; 19501 append = 1; 19502 break; 19503 case 7: 19504 action = bcmFieldActionGpPrioPktCancel; 19505 append = 1; 19506 break; 19507 default: 19508 break; 19509 } 19510 break; 19511 case R_NEW_DSCPf: 19512 param0 = val; 19513 break; 19514 case Y_NEW_DSCPf: 19515 param1 = val; 19516 break; 19517 case G_NEW_DSCP_TOSf: 19518 param2 = val; 19519 break; 19520 case R_CHANGE_DSCPf: 19521 switch (val) { 19522 case 1: 19523 if (!((param0 == param1) && (param1 == param2))) { 19524 action = bcmFieldActionRpDscpNew; 19525 append = 1; 19526 } else { 19527 action_val = val; 19528 } 19529 break; 19530 case 2: 19531 action = bcmFieldActionRpDscpCancel; 19532 append = 1; 19533 break; 19534 } 19535 break; 19536 case Y_CHANGE_DSCPf: 19537 switch (val) { 19538 case 1: 19539 if (!((param0 == param1) && (param1 == param2))) { 19540 action = bcmFieldActionYpDscpNew; 19541 param0 = param1; 19542 append = 1; 19543 } else { 19544 action_val |= val << 2; 19545 } 19546 break; 19547 case 2: 19548 action = bcmFieldActionYpDscpCancel; 19549 append = 1; 19550 break; 19551 } 19552 break; 19553 case G_CHANGE_DSCP_TOSf: 19554 switch (val) { 19555 case 1: 19556 action = bcmFieldActionGpTosPrecedenceNew; 19557 param0 = param2; 19558 break; 19559 case 2: 19560 action = bcmFieldActionGpTosPrecedenceCopy; 19561 append = 1; 19562 break; 19563 case 3: 19564 if (!((param0 == param1) && (param1 == param2))) { 19565 action = bcmFieldActionGpDscpNew; 19566 append = 1; 19567 } else { 19568 action_val |= val << 4; 19569 } 19570 if (action_val == 0x35) { 19571 action = bcmFieldActionDscpNew; 19572 append = 1; 19573 } 19574 action_val = 0; 19575 break; 19576 case 4: 19577 action = bcmFieldActionGpDscpCancel; 19578 append = 1; 19579 break; 19580 } 19581 break; 19582 case R_COS_INT_PRIf: 19583 param0 = val; 19584 break; 19585 case Y_COS_INT_PRIf: 19586 param1 = val; 19587 break; 19588 case G_COS_INT_PRIf: 19589 param2 = val; 19590 break; 19591 case R_CHANGE_COS_OR_INT_PRIf: 19592 switch (val) { 19593 case 2: 19594 if (!((param0 == param1) && (param1 == param2))) { 19595 action = bcmFieldActionRpVlanCosQNew; 19596 param0 -= 8; 19597 append = 1; 19598 } else { 19599 action_val = val; 19600 } 19601 break; 19602 case 4: 19603 action = bcmFieldActionRpPrioIntCopy; 19604 append = 1; 19605 break; 19606 case 5: 19607 if (!((param0 == param1) && (param1 == param2))) { 19608 action = bcmFieldActionRpPrioIntNew; 19609 append = 1; 19610 } else { 19611 action_val = val; 19612 } 19613 break; 19614 case 6: 19615 action = bcmFieldActionRpPrioIntTos; 19616 append = 1; 19617 break; 19618 case 7: 19619 action = bcmFieldActionRpPrioIntCancel; 19620 append = 1; 19621 break; 19622 case 8: 19623 if (!((param0 == param1) && (param1 == param2))) { 19624 action = bcmFieldActionRpCosQNew; 19625 append = 1; 19626 } else { 19627 action_val = val; 19628 } 19629 break; 19630 default: 19631 break; 19632 } 19633 break; 19634 case Y_CHANGE_COS_OR_INT_PRIf: 19635 switch (val) { 19636 case 2: 19637 if (!((param0 == param1) && (param1 == param2))) { 19638 action = bcmFieldActionYpVlanCosQNew; 19639 param0 = param1 - 8; 19640 append = 1; 19641 } else { 19642 action_val |= val << 4; 19643 } 19644 break; 19645 case 4: 19646 action = bcmFieldActionYpPrioIntCopy; 19647 append = 1; 19648 break; 19649 case 5: 19650 if (!((param0 == param1) && (param1 == param2))) { 19651 action = bcmFieldActionYpPrioIntNew; 19652 param0 = param1; 19653 append = 1; 19654 } else { 19655 action_val |= val << 4; 19656 } 19657 break; 19658 case 6: 19659 action = bcmFieldActionYpPrioIntTos; 19660 append = 1; 19661 break; 19662 case 7: 19663 action = bcmFieldActionYpPrioIntCancel; 19664 append = 1; 19665 break; 19666 case 8: 19667 if (!((param0 == param1) && (param1 == param2))) { 19668 action = bcmFieldActionYpCosQNew; 19669 param0 = param1; 19670 append = 1; 19671 } else { 19672 action_val |= val << 4; 19673 } 19674 break; 19675 default: 19676 break; 19677 } 19678 break; 19679 case G_CHANGE_COS_OR_INT_PRIf: 19680 switch (val) { 19681 case 2: 19682 if (!((param0 == param1) && (param1 == param2))) { 19683 action = bcmFieldActionGpVlanCosQNew; 19684 param0 = param2 - 8;; 19685 append = 1; 19686 } else { 19687 action_val |= val << 8; 19688 } 19689 if (action_val == 0x222) { 19690 action = bcmFieldActionVlanCosQNew; 19691 append = 1; 19692 } 19693 action_val = 0; 19694 break; 19695 case 4: 19696 action = bcmFieldActionGpPrioIntCopy; 19697 append = 1; 19698 break; 19699 case 5: 19700 if (!((param0 == param1) && (param1 == param2))) { 19701 action = bcmFieldActionGpPrioIntNew; 19702 param0 = param2; 19703 append = 1; 19704 } else { 19705 action_val |= val << 8; 19706 } 19707 if (action_val == 0x555) { 19708 action = bcmFieldActionPrioIntNew; 19709 append = 1; 19710 } 19711 action_val = 0; 19712 break; 19713 case 6: 19714 action = bcmFieldActionGpPrioIntTos; 19715 append = 1; 19716 break; 19717 case 7: 19718 action = bcmFieldActionYpPrioIntCancel; 19719 append = 1; 19720 break; 19721 case 8: 19722 if (!((param0 == param1) && (param1 == param2))) { 19723 action = bcmFieldActionGpCosQNew; 19724 param0 = param2; 19725 append = 1; 19726 } else { 19727 action_val |= val << 8; 19728 } 19729 if (action_val == 0x888) { 19730 action = bcmFieldActionCosQNew; 19731 append = 1; 19732 } 19733 action_val = 0; 19734 break; 19735 default: 19736 break; 19737 } 19738 break; 19739 default: 19740 break; 19741 } 19742 19743 /* Update the field entry with action information */ 19744 if (append) { 19745 rv = _field_trx_actions_recover_action_add(unit, 19746 f_ent, 19747 action, 19748 param0, 19749 0, 19750 0, 19751 0, 19752 0, 19753 0, 19754 0 19755 ); 19756 if (BCM_FAILURE(rv)) { 19757 return rv; 19758 } 19759 append = param0 = 0; 19760 } 19761 ofs += w; 19762 } 19763 return(rv); 19764 } 19765 19766 /* 19767 * Function: 19768 * _field_tr3_non_profiled_actions_recover 19769 * Purpose: 19770 * Recovering non profiled actions for external stage 19771 * during level 1 and level 2 warm boot 19772 * Parameters: 19773 * unit - (IN) BCM device number 19774 * policy_mem - (IN) Policy mem 19775 * entry_idx - (IN) Entry Id 19776 * sid - (IN) Stat Id 19777 * _field_entry_t - (OUT) Field entry structure 19778 * Returns: 19779 * BCM_E_XXX 19780 */ 19781 int 19782 _field_tr3_non_profiled_actions_recover(int unit, 19783 soc_mem_t policy_mem, 19784 unsigned entry_idx, 19785 int sid, 19786 _field_entry_t *f_ent 19787 ) 19788 { 19789 int part_index, drop_action_pending = 0, rv = BCM_E_NONE; 19790 unsigned ofs, n; 19791 ext_fp_policy_6x_entry_t ext_fp_policy_buf; 19792 19793 esm_acl_action_control_entry_t esm_acl_action_control_buf; 19794 19795 uint32 non_profiled_actions_buf[COUNTOF(ext_fp_policy_buf.entry_data)]; 19796 uint32 append=0, action_val=0, param0=0, param1=0; 19797 bcm_field_action_t action = -1; 19798 const struct _field_tr3_external_non_profiled_policy_fld *p; 19799 _field_control_t *fc=NULL; 19800 19801 /* Buffer initialization */ 19802 sal_memset(ext_fp_policy_buf.entry_data, 19803 0, 19804 sizeof(ext_fp_policy_buf.entry_data) 19805 ); 19806 sal_memset(esm_acl_action_control_buf.entry_data, 19807 0, 19808 sizeof(esm_acl_action_control_buf.entry_data) 19809 ); 19810 sal_memset(non_profiled_actions_buf, 0, sizeof(non_profiled_actions_buf)); 19811 ofs = 0; 19812 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 19813 /* Read policy mem and get index to the ESM_ACL_ACTION_CONTROL */ 19814 rv = soc_mem_read(unit, policy_mem, MEM_BLOCK_ANY, entry_idx, 19815 ext_fp_policy_buf.entry_data); 19816 if (BCM_FAILURE(rv)) { 19817 LOG_ERROR(BSL_LS_BCM_FP, 19818 (BSL_META_U(unit, 19819 "Error while reading policy entry\n"))); 19820 return(rv); 19821 } 19822 part_index = soc_mem_field32_get(unit, 19823 policy_mem, 19824 ext_fp_policy_buf.entry_data, 19825 POLICY_TABLE_IDf 19826 ); 19827 19828 soc_mem_field_get(unit, 19829 policy_mem, 19830 ext_fp_policy_buf.entry_data, 19831 NON_PROFILED_ACTIONSf, 19832 non_profiled_actions_buf 19833 ); 19834 19835 BCM_IF_ERROR_RETURN(soc_mem_read(unit, 19836 ESM_ACL_ACTION_CONTROLm, 19837 MEM_BLOCK_ANY, 19838 part_index, 19839 esm_acl_action_control_buf.entry_data 19840 ) 19841 ); 19842 19843 /* Based on the action control bit set in ESM_ACL_ACTION_CONTROL table, 19844 extract the non profiled actions by getting width and offset */ 19845 for (p = _field_tr3_external_non_profiled_policy_fld_tbl, 19846 n = COUNTOF(_field_tr3_external_non_profiled_policy_fld_tbl); 19847 n; 19848 --n, ++p) { 19849 if (soc_mem_field32_get(unit, 19850 ESM_ACL_ACTION_CONTROLm, 19851 esm_acl_action_control_buf.entry_data, 19852 p->esm_acl_action_control_fld 19853 ) 19854 & BIT(p->bit_num)) { 19855 /* Action bit is set in ESM_ACL_ACTION_CONTROL */ 19856 unsigned w; 19857 SHR_BITDCL val=0; 19858 19859 w = soc_mem_field_length(unit, 19860 p->policy_mem, 19861 p->policy_fld 19862 ); 19863 19864 SHR_BITCOPY_RANGE(&val, 0, non_profiled_actions_buf, ofs, w); 19865 19866 append = 0; 19867 /* Based on the non-profile action value, identify the action */ 19868 switch(p->esm_acl_action_control_fld) { 19869 case MISC1_SET_ENABLEf: 19870 switch(p->policy_fld) { 19871 case DO_NOT_GENERATE_CNMf: 19872 if (val) { 19873 action = bcmFieldActionCnmCancel; 19874 append = 1; 19875 } 19876 break; 19877 case DO_NOT_CHANGE_TTLf: 19878 if (val) { 19879 action = bcmFieldActionDoNotChangeTtl; 19880 append = 1; 19881 } 19882 break; 19883 case DO_NOT_URPFf: 19884 if (val) { 19885 action = bcmFieldActionDoNotCheckUrpf; 19886 append = 1; 19887 } 19888 break; 19889 case HGT_DLB_DISABLEf: 19890 /* Not supported for external stage */ 19891 /* action = bcmFieldActionDynamicHgTrunkCancel */ 19892 break; 19893 case LAG_DLB_DISABLEf: 19894 /* Not supported for external stage */ 19895 /* action = bcmFieldActionTrunkLoadBalanceCancel */ 19896 break; 19897 case ECMP_DLB_DISABLEf: 19898 /* Not supported for external stage */ 19899 /* action = bcmFieldActionEcmpLoadBalanceCancel */ 19900 break; 19901 case GREEN_TO_PIDf: 19902 if (val) { 19903 f_ent->flags |= _FP_ENTRY_COLOR_INDEPENDENT; 19904 } 19905 break; 19906 case MIRROR_OVERRIDEf: 19907 if (val) { 19908 action = bcmFieldActionMirrorOverride; 19909 append = 1; 19910 } 19911 break; 19912 default: 19913 break; 19914 } 19915 break; 19916 19917 case MISC2_SET_ENABLEf: 19918 switch(p->policy_fld) { 19919 case IPFIX_CONTROLf: 19920 if (val == 1) { 19921 action = bcmFieldActionIpFix; 19922 append = 1; 19923 } else if (val == 2) { 19924 action = bcmFieldActionIpFixCancel; 19925 append = 1; 19926 } 19927 break; 19928 /* For R_DROP_PRECEDENCE, Y_DROP_PRECEDENCE, G_DROP_PRECEDENCE: 19929 if param0=0 (preserve), the action is not recovered as 19930 NON_PROFILED_ACTIONS=0 in policy table */ 19931 case R_DROP_PRECEDENCEf: 19932 if (val) { 19933 action = bcmFieldActionRpDropPrecedence; 19934 param0 = val; 19935 append = 1; 19936 } 19937 break; 19938 case Y_DROP_PRECEDENCEf: 19939 if (val) { 19940 action = bcmFieldActionYpDropPrecedence; 19941 param0 = val; 19942 append = 1; 19943 } 19944 break; 19945 case G_DROP_PRECEDENCEf: 19946 if (val) { 19947 action = bcmFieldActionGpDropPrecedence; 19948 param0 = val; 19949 append = 1; 19950 } 19951 break; 19952 /* Keep the drop actions pending until we process copy to cpu 19953 action */ 19954 case R_DROPf: 19955 drop_action_pending = val; 19956 break; 19957 case Y_DROPf: 19958 drop_action_pending |= val << 2; 19959 break; 19960 case G_DROPf: 19961 drop_action_pending |= val << 4; 19962 break; 19963 default: 19964 break; 19965 } 19966 break; 19967 19968 case GOA_SET_ENABLEf: 19969 switch(p->policy_fld) { 19970 case HI_PRI_SUPPRESS_VXLTf: 19971 case SUPPRESS_SW_ACTIONSf: 19972 case DEFER_QOS_MARKINGSf: 19973 case SUPPRESS_COLOR_SENSITIVE_ACTIONSf: 19974 case SPLIT_DROP_RESOLVEf: 19975 case HI_PRI_RESOLVEf: 19976 case HI_PRI_ACTION_CONTROLf: 19977 /* Not supported for external stage */ 19978 /* action = bcmFieldActionOffloadRedirect */ 19979 break; 19980 default: 19981 break; 19982 } 19983 break; 19984 19985 case CPU_COS_SET_ENABLEf: 19986 switch(p->policy_fld) { 19987 case CPU_COSf: 19988 param0 = val; 19989 break; 19990 case CHANGE_CPU_COSf: 19991 if (val == 1) { 19992 action = bcmFieldActionCosQCpuNew; 19993 append = 1; 19994 } 19995 default: 19996 break; 19997 } 19998 break; 19999 20000 case MIRROR_SET_ENABLEf: 20001 switch(p->policy_fld) { 20002 case MTP_INDEX0f: 20003 case MTP_INDEX1f: 20004 case MTP_INDEX2f: 20005 case MTP_INDEX3f: 20006 break; 20007 case MIRRORf: 20008 { 20009 static const unsigned mtp_index_field[] = { 20010 MTP_INDEX0f, MTP_INDEX1f, MTP_INDEX2f, MTP_INDEX3f 20011 }; 20012 20013 uint32 ms_reg, mtp_type; 20014 unsigned b, idx; 20015 bcm_module_t modid; 20016 bcm_gport_t port; 20017 20018 /* Get the mirroring direction control setting */ 20019 BCM_IF_ERROR_RETURN(READ_MIRROR_SELECTr(unit, &ms_reg)); 20020 mtp_type = soc_reg_field_get(unit, MIRROR_SELECTr, 20021 ms_reg, MTP_TYPEf); 20022 20023 /* For each mirroring slot in the policy entry, ... */ 20024 for (b = 1, idx = 0; idx < COUNTOF(mtp_index_field); 20025 ++idx, b <<= 1) { 20026 if (!(val & b)) { 20027 /* Slot not in use => Skip */ 20028 continue; 20029 } 20030 20031 _bcm_esw_mirror_mtp_to_modport(unit, 20032 idx, 20033 FALSE, 20034 mtp_type & b 20035 ? BCM_MIRROR_PORT_EGRESS 20036 : BCM_MIRROR_PORT_INGRESS, 20037 &modid, 20038 &port 20039 ); 20040 20041 rv = _field_trx_actions_recover_action_add( 20042 unit, 20043 f_ent, 20044 mtp_type & b 20045 ? bcmFieldActionMirrorEgress 20046 : bcmFieldActionMirrorIngress, 20047 modid, 20048 port, 20049 0, 20050 0, 20051 0, 20052 0, 20053 0 20054 ); 20055 if (BCM_FAILURE(rv)) { 20056 return rv; 20057 } 20058 } 20059 } 20060 break; 20061 default: 20062 break; 20063 } 20064 break; 20065 20066 case COPY_TO_CPU_SET_ENABLEf: 20067 switch(p->policy_fld) { 20068 case R_COPY_TO_CPUf: 20069 if ((val != 5) && ((drop_action_pending & 3) == 1)) { 20070 action = bcmFieldActionRpDrop; 20071 append = 1; 20072 } else if ((val != 2) && 20073 ((drop_action_pending & 3) == 2)) { 20074 action = bcmFieldActionRpDropCancel; 20075 append = 1; 20076 } 20077 20078 if (append) { 20079 rv = _field_trx_actions_recover_action_add(unit, 20080 f_ent, 20081 action, 20082 param0, 20083 param1, 20084 0, 20085 0, 20086 0, 20087 0, 20088 0 20089 ); 20090 if (BCM_FAILURE(rv)) { 20091 return rv; 20092 } 20093 append = 0; 20094 } 20095 20096 switch (val) { 20097 case 1: 20098 action_val = val; 20099 break; 20100 case 2: 20101 if ((drop_action_pending & 3) == 2) { 20102 action = bcmFieldActionRpTimeStampToCpuCancel; 20103 } else { 20104 action = bcmFieldActionRpCopyToCpuCancel; 20105 } 20106 append = 1; 20107 break; 20108 case 3: 20109 action = bcmFieldActionRpSwitchToCpuCancel; 20110 append = 1; 20111 break; 20112 case 4: 20113 action = bcmFieldActionRpSwitchToCpuReinstate; 20114 append = 1; 20115 break; 20116 case 5: 20117 action_val = val; 20118 break; 20119 default: 20120 break; 20121 } 20122 break; 20123 case Y_COPY_TO_CPUf: 20124 if ((val != 5) && ((drop_action_pending >> 2) & 3) == 1) { 20125 action = bcmFieldActionYpDrop; 20126 append = 1; 20127 } else if ((val != 2) && 20128 ((drop_action_pending >> 2) & 3) == 2) { 20129 action = bcmFieldActionYpDropCancel; 20130 append = 1; 20131 } 20132 if (append) { 20133 rv = _field_trx_actions_recover_action_add(unit, 20134 f_ent, 20135 action, 20136 param0, 20137 param1, 20138 0, 20139 0, 20140 0, 20141 0, 20142 0 20143 ); 20144 if (BCM_FAILURE(rv)) { 20145 return rv; 20146 } 20147 append = 0; 20148 } 20149 20150 switch (val) { 20151 case 1: 20152 action_val |= val << 3; 20153 break; 20154 case 2: 20155 if (((drop_action_pending >> 2) & 3) == 2) { 20156 action = bcmFieldActionYpTimeStampToCpuCancel; 20157 } else { 20158 action = bcmFieldActionYpCopyToCpuCancel; 20159 } 20160 append = 1; 20161 break; 20162 case 3: 20163 action = bcmFieldActionYpSwitchToCpuCancel; 20164 append = 1; 20165 break; 20166 case 4: 20167 action = bcmFieldActionYpSwitchToCpuReinstate; 20168 append = 1; 20169 break; 20170 case 5: 20171 action_val |= val << 3; 20172 break; 20173 default: 20174 break; 20175 } 20176 break; 20177 20178 case G_COPY_TO_CPUf: 20179 if ((val != 5) && ((drop_action_pending >> 4) & 3) == 1) { 20180 action = bcmFieldActionGpDrop; 20181 append = 1; 20182 } else if ((val != 2) && 20183 ((drop_action_pending >> 4) & 3) == 2) { 20184 action = bcmFieldActionGpDropCancel; 20185 append = 1; 20186 } 20187 if (append) { 20188 rv = _field_trx_actions_recover_action_add(unit, 20189 f_ent, 20190 action, 20191 param0, 20192 param1, 20193 0, 20194 0, 20195 0, 20196 0, 20197 0 20198 ); 20199 if (BCM_FAILURE(rv)) { 20200 return rv; 20201 } 20202 append = 0; 20203 } 20204 20205 switch (val) { 20206 case 1: 20207 action_val |= val << 6; 20208 break; 20209 case 2: 20210 if (((drop_action_pending >> 4) & 3) == 2) { 20211 action = bcmFieldActionGpTimeStampToCpuCancel; 20212 } else { 20213 action = bcmFieldActionGpCopyToCpuCancel; 20214 } 20215 append = 1; 20216 break; 20217 case 3: 20218 action = bcmFieldActionGpSwitchToCpuCancel; 20219 append = 1; 20220 break; 20221 case 4: 20222 action = bcmFieldActionGpSwitchToCpuReinstate; 20223 append = 1; 20224 break; 20225 case 5: 20226 action_val |= val << 6; 20227 break; 20228 default: 20229 break; 20230 } 20231 break; 20232 case MATCHED_RULEf: 20233 if (val) { 20234 param0 = 1; 20235 param1 = val; 20236 } 20237 20238 /* Drop action is already set */ 20239 drop_action_pending = 0; 20240 20241 if (action_val == 0x49) { 20242 action = bcmFieldActionCopyToCpu; 20243 append = 1; 20244 break; 20245 } 20246 if (action_val == 0x16d) { 20247 action = bcmFieldActionTimeStampToCpu; 20248 append = 1; 20249 break; 20250 } 20251 /* CopyToCpu action */ 20252 if ((action_val & 7) == 1) { 20253 action = bcmFieldActionRpCopyToCpu; 20254 rv = _field_trx_actions_recover_action_add(unit, 20255 f_ent, 20256 action, 20257 param0, 20258 param1, 20259 0, 20260 0, 20261 0, 20262 0, 20263 0 20264 ); 20265 if (BCM_FAILURE(rv)) { 20266 return rv; 20267 } 20268 } 20269 if (((action_val >> 3) & 7) == 1) { 20270 action = bcmFieldActionYpCopyToCpu; 20271 rv = _field_trx_actions_recover_action_add(unit, 20272 f_ent, 20273 action, 20274 param0, 20275 param1, 20276 0, 20277 0, 20278 0, 20279 0, 20280 0 20281 ); 20282 if (BCM_FAILURE(rv)) { 20283 return rv; 20284 } 20285 } 20286 if (((action_val >> 6) & 7) == 1) { 20287 action = bcmFieldActionGpCopyToCpu; 20288 rv = _field_trx_actions_recover_action_add(unit, 20289 f_ent, 20290 action, 20291 param0, 20292 param1, 20293 0, 20294 0, 20295 0, 20296 0, 20297 0 20298 ); 20299 if (BCM_FAILURE(rv)) { 20300 return rv; 20301 } 20302 } 20303 /* TimeStampToCpu action */ 20304 if ((action_val & 7) == 5) { 20305 action = bcmFieldActionRpTimeStampToCpu; 20306 rv = _field_trx_actions_recover_action_add(unit, 20307 f_ent, 20308 action, 20309 param0, 20310 param1, 20311 0, 20312 0, 20313 0, 20314 0, 20315 0 20316 ); 20317 if (BCM_FAILURE(rv)) { 20318 return rv; 20319 } 20320 } 20321 if (((action_val >> 3) & 7) == 5) { 20322 action = bcmFieldActionYpTimeStampToCpu; 20323 rv = _field_trx_actions_recover_action_add(unit, 20324 f_ent, 20325 action, 20326 param0, 20327 param1, 20328 0, 20329 0, 20330 0, 20331 0, 20332 0 20333 ); 20334 if (BCM_FAILURE(rv)) { 20335 return rv; 20336 } 20337 } 20338 if (((action_val >> 6) & 7) == 5) { 20339 action = bcmFieldActionGpTimeStampToCpu; 20340 rv = _field_trx_actions_recover_action_add(unit, 20341 f_ent, 20342 action, 20343 param0, 20344 param1, 20345 0, 20346 0, 20347 0, 20348 0, 20349 0 20350 ); 20351 if (BCM_FAILURE(rv)) { 20352 return rv; 20353 } 20354 } 20355 action_val = 0; 20356 break; 20357 case COPY_TO_PASSTHRU_NLFf: 20358 /* TO DO */ 20359 break; 20360 default: 20361 break; 20362 } 20363 break; 20364 case SHARED_METER_SET_ENABLEf: 20365 case METER_SET_ENABLEf: 20366 case SVC_METER_SET_ENABLEf: 20367 /* TO DO: Service Meters */ 20368 break; 20369 case L3SW_L2_FIELDS_SET_ENABLEf: 20370 /* Not supported for external stage 20371 DstMacNew/ SrcMacNew/ OuterVlanNew/ VnTagNew/ VnTagDelete 20372 And for AddClassTag action, this bit is not set */ 20373 break; 20374 case REDIRECT_SET_ENABLEf: 20375 /* OffloadRedirect action is currently not supported for 20376 external stage */ 20377 break; 20378 case COUNTER_SET_ENABLEf: 20379 if ((p->policy_fld == FLEX_CTR_BASE_COUNTER_IDXf) && 20380 ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_14)) { 20381 if (val) { 20382 BCM_IF_ERROR_RETURN( 20383 _field_flex_counter_recover(unit, f_ent, 0, sid)); 20384 } 20385 } 20386 break; 20387 case OAM_SET_ENABLEf: 20388 /* This action is not recovered as OAM_SET_ENABLE field 20389 is not set after field action add */ 20390 switch(p->policy_fld) { 20391 case OAM_UP_MEPf: 20392 action = bcmFieldActionOamUpMep; 20393 append = 1; 20394 break; 20395 case OAM_TXf: 20396 action = bcmFieldActionOamTx; 20397 append = 1; 20398 break; 20399 case OAM_LMEP_MDLf: 20400 action = bcmFieldActionOamLmepMdl; 20401 append = 1; 20402 break; 20403 case OAM_SERVICE_PRI_MAPPING_PTRf: 20404 action = bcmFieldActionOamServicePriMappingPtr; 20405 append = 1; 20406 break; 20407 case OAM_LM_BASE_PTRf: 20408 action = bcmFieldActionOamLmBasePtr; 20409 append = 1; 20410 break; 20411 case OAM_DM_ENf: 20412 action = bcmFieldActionOamDmEnable; 20413 append = 1; 20414 break; 20415 case OAM_LM_ENf: 20416 action = bcmFieldActionOamLmEnable; 20417 append = 1; 20418 break; 20419 case OAM_LMEP_ENf: 20420 action = bcmFieldActionOamLmepEnable; 20421 append = 1; 20422 break; 20423 default: 20424 break; 20425 } 20426 break; 20427 default: 20428 /* Do nothing */ 20429 break; 20430 } 20431 20432 if (append) { 20433 rv = _field_trx_actions_recover_action_add(unit, 20434 f_ent, 20435 action, 20436 param0, 20437 param1, 20438 0, 20439 0, 20440 0, 20441 0, 20442 0 20443 ); 20444 if (BCM_FAILURE(rv)) { 20445 return rv; 20446 } 20447 append = param0 = param1 = 0; 20448 } 20449 20450 ofs += w + p->skip_bits; 20451 } 20452 } 20453 /* Drop action could be pending if COPY_TO_CPU_ENABLE is not set */ 20454 if (drop_action_pending) { 20455 if (drop_action_pending == 0x15) { 20456 action = bcmFieldActionDrop; 20457 append = 1; 20458 } else if ((drop_action_pending & 3) == 1) { 20459 action = bcmFieldActionRpDrop; 20460 append = 1; 20461 } else if ((drop_action_pending & 3) == 2) { 20462 action = bcmFieldActionRpDropCancel; 20463 append = 1; 20464 } else if (((drop_action_pending >> 2) & 3) == 1) { 20465 action = bcmFieldActionYpDrop; 20466 append = 1; 20467 } else if (((drop_action_pending >> 2) & 3) == 2) { 20468 action = bcmFieldActionYpDropCancel; 20469 append = 1; 20470 } else if (((drop_action_pending >> 4) & 3) == 1) { 20471 action = bcmFieldActionGpDrop; 20472 append = 1; 20473 } else if (((drop_action_pending >> 4) & 3) == 2) { 20474 action = bcmFieldActionGpDropCancel; 20475 append = 1; 20476 } 20477 20478 if (append) { 20479 rv = _field_trx_actions_recover_action_add(unit, 20480 f_ent, 20481 action, 20482 param0, 20483 param1, 20484 0, 20485 0, 20486 0, 20487 0, 20488 0 20489 ); 20490 if (BCM_FAILURE(rv)) { 20491 return rv; 20492 } 20493 } 20494 } 20495 return(rv); 20496 } 20497 20498 20499 /* 20500 * Function: 20501 * _field_tr3_ext_slice_to_pkt_type 20502 * Purpose: 20503 * Mapping slice to packet type for external stage 20504 * Parameters: 20505 * slice_idx - (IN) slice id 20506 * fs - (OUT) Device field slice structure pointer 20507 * pkt_type - (OUT) packet type 20508 */ 20509 STATIC int 20510 _field_tr3_ext_slice_to_pkt_type(int unit, 20511 unsigned slice_idx, 20512 _field_slice_t *fs, 20513 unsigned *pkt_type) 20514 { 20515 /* slice idx is valid for a particular pkt_type (L2, IPV4, IPV6) */ 20516 switch (slice_idx) { 20517 case _FP_EXT_ACL_144_L2: 20518 case _FP_EXT_ACL_L2: 20519 fs->pkt_type[_FP_EXT_L2] = 1; 20520 fs->pkt_type[_FP_EXT_IP4] = 0; 20521 fs->pkt_type[_FP_EXT_IP6] = 0; 20522 *pkt_type = _FP_EXT_L2; 20523 break; 20524 case _FP_EXT_ACL_144_IPV4: 20525 case _FP_EXT_ACL_IPV4: 20526 case _FP_EXT_ACL_L2_IPV4: 20527 fs->pkt_type[_FP_EXT_L2] = 0; 20528 fs->pkt_type[_FP_EXT_IP4] = 1; 20529 fs->pkt_type[_FP_EXT_IP6] = 0; 20530 *pkt_type = _FP_EXT_IP4; 20531 break; 20532 case _FP_EXT_ACL_144_IPV6: 20533 case _FP_EXT_ACL_IPV6_SHORT: 20534 case _FP_EXT_ACL_IPV6_FULL: 20535 case _FP_EXT_ACL_L2_IPV6: 20536 fs->pkt_type[_FP_EXT_L2] = 0; 20537 fs->pkt_type[_FP_EXT_IP4] = 0; 20538 fs->pkt_type[_FP_EXT_IP6] = 1; 20539 *pkt_type = _FP_EXT_IP6; 20540 break; 20541 default: 20542 return (BCM_E_INTERNAL); 20543 } 20544 return (BCM_E_NONE); 20545 } 20546 20547 STATIC uint32 20548 _field_tr3_ext_acl_table_size_prop_get(int unit, unsigned part_idx) 20549 { 20550 static const char * const ext_acl_table_size_props[] = { 20551 spn_EXT_L2C_ACL_TABLE_SIZE, 20552 spn_EXT_L2_ACL_TABLE_SIZE, 20553 spn_EXT_IP4C_ACL_TABLE_SIZE, 20554 spn_EXT_IP4_ACL_TABLE_SIZE, 20555 spn_EXT_L2IP4_ACL_TABLE_SIZE, 20556 spn_EXT_IP6C_ACL_TABLE_SIZE, 20557 spn_EXT_IP6S_ACL_TABLE_SIZE, 20558 spn_EXT_IP6F_ACL_TABLE_SIZE, 20559 spn_EXT_L2IP6_ACL_TABLE_SIZE 20560 }; 20561 return (soc_property_get(unit, ext_acl_table_size_props[part_idx], 20562 0xffffffff)); 20563 } 20564 20565 /* 20566 * Function: 20567 * _field_tr3_stage_external_reinit 20568 * Purpose: 20569 * Reconstruct ESM ACL/External stage groups and entries, reading 20570 * data from hardware tables and external scache for warm boot 20571 * level 1 and level 2 recovery 20572 * Parameters: 20573 * unit - (IN) BCM device number 20574 * fc - (IN) Device field control structure pointer. 20575 * stage_fc - (IN) FP stage control info. 20576 * Returns: 20577 * BCM_E_XXX 20578 */ 20579 STATIC int 20580 _field_tr3_stage_external_reinit(int unit, 20581 _field_control_t *fc, 20582 _field_stage_t *stage_fc 20583 ) 20584 { 20585 int rv = BCM_E_NONE, wb_mode = 0, i, j; 20586 int group_flags = 0; 20587 unsigned slice_idx; 20588 unsigned cum_slice_entry_cnt[TCAM_PARTITION_ACL_L2IP6 + 1 - 20589 TCAM_PARTITION_ACL_L2]; 20590 _field_group_t *fg = 0; 20591 _field_entry_t *f_ent = 0; 20592 uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0]; 20593 uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1]; 20594 uint8 val; 20595 uint32 result = 0; 20596 uint32 db_y[24], db_x[24], sz; 20597 int action_res_id, idx, idx1; 20598 bcm_pbmp_t group_pbmp; 20599 _field_stat_t *f_st; 20600 _field_entry_wb_info_t f_ent_wb_info; 20601 20602 static int part_order[] = { 20603 TCAM_PARTITION_ACL_L2C, 20604 TCAM_PARTITION_ACL_L2, 20605 TCAM_PARTITION_ACL_IP4C, 20606 TCAM_PARTITION_ACL_IP4, 20607 TCAM_PARTITION_ACL_L2IP4, 20608 TCAM_PARTITION_ACL_IP6C, 20609 TCAM_PARTITION_ACL_IP6S, 20610 TCAM_PARTITION_ACL_IP6F, 20611 TCAM_PARTITION_ACL_L2IP6 20612 }; 20613 20614 if (fc->l2warm) { 20615 /* Recovering start sequence */ 20616 for (i = 0; i < 4; i++) { 20617 val = buf[fc->scache_pos]; 20618 ++fc->scache_pos; 20619 result |= val << (i * 8); 20620 } 20621 if (result != _FIELD_EXTFP_DATA_START) { 20622 /* Start sequence not found */ 20623 LOG_ERROR(BSL_LS_BCM_FP, 20624 (BSL_META_U(unit, 20625 "0:Start sequence NOT found in scache\n"))); 20626 rv = BCM_E_INTERNAL; 20627 fc->l2warm = 0; 20628 goto cleanup; 20629 } 20630 result = 0; 20631 if(NULL != buf1) { 20632 for (i = 0; i < 4; i++) { 20633 val = buf1[fc->scache_pos1]; 20634 ++fc->scache_pos1; 20635 result |= val << (i * 8); 20636 } 20637 if (result != _FIELD_EXTFP_DATA_START) { 20638 /* Start sequence not found */ 20639 LOG_ERROR(BSL_LS_BCM_FP, 20640 (BSL_META_U(unit, 20641 "1:Start sequence NOT found in scache\n"))); 20642 rv = BCM_E_INTERNAL; 20643 fc->l2warm = 0; 20644 goto cleanup; 20645 } 20646 20647 } 20648 /* Recovering long-id setting */ 20649 val = buf[fc->scache_pos]; 20650 ++fc->scache_pos; 20651 fc->flags = val; 20652 20653 } 20654 20655 for (j = 0, i = stage_fc->tcam_slices - 1; i >= 0; --i) { 20656 cum_slice_entry_cnt[i] = j 20657 + stage_fc->slices[_FP_DEF_INST][i].entry_count; 20658 j = cum_slice_entry_cnt[i]; 20659 } 20660 20661 /* For each slice, find the valid entries and recover group and entry 20662 information */ 20663 for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; ++slice_idx) { 20664 _field_slice_t *fs = &stage_fc->slices[_FP_DEF_INST][slice_idx]; 20665 int port; 20666 unsigned pkt_type = 0, entry_idx, entry_cnt; 20667 soc_mem_t policy_mem, tcam_data_mem, tcam_mask_mem; 20668 20669 /* Check for the configured external acl table size and if not 20670 configured skip the slice */ 20671 if ((sz = _field_tr3_ext_acl_table_size_prop_get(unit, slice_idx)) 20672 == 0xffffffff) { 20673 continue; 20674 } 20675 20676 /* Get Policy mem, data mem and mask mem */ 20677 BCM_IF_ERROR_RETURN(_field_tr3_external_policy_mem(unit, slice_idx, 20678 &policy_mem)); 20679 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_data_mem(unit, slice_idx, 20680 &tcam_data_mem)); 20681 BCM_IF_ERROR_RETURN(_field_tr3_external_tcam_mask_mem(unit, slice_idx, 20682 &tcam_mask_mem)); 20683 20684 /* Update the packet type based on the slice id */ 20685 _field_tr3_ext_slice_to_pkt_type(unit, slice_idx, fs, &pkt_type); 20686 20687 /* Find all valid entries in slice's TCAM */ 20688 for (entry_cnt = entry_idx = 0; 20689 entry_idx < fs->entry_count; 20690 ++entry_idx 20691 ) { 20692 int valid_ent; 20693 ext_fp_policy_entry_t policy_buf; 20694 int multigroup=0; 20695 int prev_prio; 20696 unsigned qual_idx; 20697 _bcm_field_qual_info_t *f_qual_arr; 20698 ext_acl432_tcam_data_entry_t tcam_buf; 20699 ext_acl432_tcam_mask_entry_t tcam_mask; 20700 20701 /* First level check for valid entries using policy table. If valid 20702 entry found, go ahead with group and entry recovery process */ 20703 valid_ent = 0; 20704 rv = soc_mem_read(unit, policy_mem, MEM_BLOCK_ANY, entry_idx, 20705 policy_buf.entry_data); 20706 if (BCM_FAILURE(rv)) { 20707 goto cleanup; 20708 } 20709 20710 if (soc_mem_field32_get(unit, policy_mem, policy_buf.entry_data, 20711 NON_PROFILED_ACTIONSf) != 0) { 20712 valid_ent = 1; 20713 } 20714 20715 /* Second level check for valid entries using Vbit that reads the 20716 entry directly from tcam. As it is raw access to tcam which 20717 writes to registers, need to do warm boot done temporarily */ 20718 if (!valid_ent) { 20719 if (!wb_mode) { 20720 SOC_WARM_BOOT_DONE(unit); 20721 wb_mode = 1; 20722 } 20723 rv = soc_tr3_tcam_read_entry(unit, part_order[slice_idx], 20724 entry_idx, db_y, db_x, &valid_ent); 20725 if (BCM_FAILURE(rv)) { 20726 if (wb_mode) { 20727 SOC_WARM_BOOT_START(unit); 20728 wb_mode = 0; 20729 } 20730 goto cleanup; 20731 } 20732 20733 if (!valid_ent) { 20734 /* if the valid entry is not found, continue in non-warmboot state, 20735 to check for the next valid entry */ 20736 continue; 20737 } 20738 /* If the valid entry is found, rest of the processing is done 20739 in warm boot */ 20740 if (wb_mode) { 20741 SOC_WARM_BOOT_START(unit); 20742 wb_mode = 0; 20743 } 20744 } 20745 20746 /* TCAM entry in use */ 20747 if (entry_cnt == 0) { 20748 /* First in-use entry found => Create group */ 20749 int multigroup = FALSE; /* Will always be FALSE for external */ 20750 bcm_field_group_t gid; 20751 int priority; 20752 bcm_field_qset_t qset; 20753 prev_prio = -1; 20754 20755 /* If Level 2, retrieve the GIDs in this slice and for 20756 external stage it will be exactly 1 group */ 20757 if (fc->l2warm) { 20758 /* Recover group info */ 20759 rv = _field_trx_scache_slice_group_recover(unit, 20760 fc, _FP_DEF_INST, 20761 slice_idx, 20762 &multigroup, 20763 stage_fc, 20764 0); 20765 if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) { 20766 LOG_ERROR(BSL_LS_BCM_FP, \ 20767 (BSL_META_U(unit, \ 20768 "Group recovery failed during \ 20769 level 2 warmboot\n"))); 20770 fc->l2warm = 0; 20771 goto cleanup; 20772 } 20773 if (rv == BCM_E_NOT_FOUND) { 20774 rv = BCM_E_NONE; 20775 continue; 20776 } 20777 } 20778 20779 _FP_XGS3_ALLOC(fg, sizeof(*fg), "field group"); 20780 if (fg == NULL) { 20781 LOG_ERROR(BSL_LS_BCM_FP, \ 20782 (BSL_META_U(unit, \ 20783 "Error while allocating memory for \ 20784 field group\n"))); 20785 return BCM_E_MEMORY; 20786 } 20787 20788 /* Initialize action res id and VMAP group to default */ 20789 action_res_id = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 20790 for (idx = 0; idx < _FP_PAIR_MAX; idx++) { 20791 fg->vmap_group[idx] = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT; 20792 } 20793 20794 group_flags = 0; 20795 if (fc->l2warm) { 20796 /* Get stored group ID and QSET for Level 2 */ 20797 rv = _field_group_info_retrieve(unit, 20798 0 /* port */, _FP_DEF_INST, 20799 &gid, 20800 &priority, 20801 &action_res_id, 20802 &group_pbmp, 20803 NULL, 20804 &group_flags, 20805 &qset, 20806 fc 20807 ); 20808 if (gid != -1) { 20809 sal_memcpy(&fg->qset, &qset, sizeof(fg->qset)); 20810 } else { 20811 rv = BCM_E_INTERNAL; 20812 } 20813 } else { 20814 /* Generate group ID for Level 1 */ 20815 if ((rv = _bcm_field_group_id_generate(unit, &gid)) 20816 == BCM_E_NONE) { 20817 unsigned vmap, vslice; 20818 20819 for (priority = -1, vmap = 0; 20820 priority == -1 && vmap < _FP_VMAP_CNT; 20821 ++vmap) { 20822 for (vslice = 0; 20823 vslice < COUNTOF(stage_fc->vmap[_FP_DEF_INST][0]); 20824 ++vslice) { 20825 if (stage_fc->vmap[_FP_DEF_INST][vmap][vslice].vmap_key 20826 == slice_idx) { 20827 priority = 20828 stage_fc->vmap[_FP_DEF_INST][vmap][vslice].priority; 20829 20830 break; 20831 } 20832 } 20833 } 20834 20835 if (priority == -1) { 20836 rv = BCM_E_INTERNAL; 20837 } 20838 } 20839 20840 /* Recover group's qset */ 20841 BCM_FIELD_QSET_INIT(fg->qset); 20842 BCM_FIELD_QSET_ADD(fg->qset, bcmFieldQualifyStage); 20843 BCM_FIELD_QSET_ADD(fg->qset, bcmFieldQualifyStageExternal); 20844 20845 for (qual_idx = 0; qual_idx < _bcmFieldQualifyCount; 20846 ++qual_idx) { 20847 f_qual_arr = stage_fc->f_qual_arr[qual_idx]; 20848 20849 if (f_qual_arr == NULL) { 20850 /* Qualifier does not exist in this stage */ 20851 continue; 20852 } 20853 20854 for (i = 0; i < f_qual_arr->conf_sz; ++i) { 20855 if (f_qual_arr->conf_arr[i].selector.pri_sel_val 20856 == slice_idx) { 20857 BCM_FIELD_QSET_ADD(fg->qset, qual_idx); 20858 20859 break; 20860 } 20861 } 20862 } 20863 } 20864 20865 if (BCM_FAILURE(rv)) { 20866 goto cleanup; 20867 } 20868 /* Recover group's qual_arr */ 20869 for (fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].size = qual_idx = 0; 20870 qual_idx < _bcmFieldQualifyCount; ++qual_idx) { 20871 if (BCM_FIELD_QSET_TEST(fg->qset, qual_idx)) { 20872 ++fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].size; 20873 } 20874 } 20875 20876 _FP_XGS3_ALLOC(fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].qid_arr, 20877 fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].size * sizeof(fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].qid_arr[0]), 20878 "Group qual id" 20879 ); 20880 _FP_XGS3_ALLOC(fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].offset_arr, 20881 fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].size * sizeof(fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].offset_arr[0]), 20882 "Group qual offset" 20883 ); 20884 20885 for (j = qual_idx = 0; qual_idx < _bcmFieldQualifyCount; 20886 ++qual_idx) { 20887 if (!BCM_FIELD_QSET_TEST(fg->qset, qual_idx)) { 20888 continue; 20889 } 20890 20891 fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].qid_arr[j] = qual_idx; 20892 f_qual_arr = stage_fc->f_qual_arr[qual_idx]; 20893 20894 for (i = 0; i < f_qual_arr->conf_sz; ++i) { 20895 if (f_qual_arr->conf_arr[i].selector.pri_sel_val 20896 == slice_idx) { 20897 fg->qual_arr[_FP_ENTRY_TYPE_DEFAULT][0].offset_arr[j] = 20898 f_qual_arr->conf_arr[i].offset; 20899 break; 20900 } 20901 } 20902 20903 ++j; 20904 } 20905 fg->gid = gid; 20906 fg->priority = priority; 20907 fg->action_res_id = action_res_id; 20908 fg->stage_id = stage_fc->stage_id; 20909 fg->sel_codes[0].extn = slice_idx; 20910 fg->slices = fs; 20911 fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE; 20912 if (fc->l2warm 20913 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15)) { 20914 if (group_flags & _FP_GROUP_LOOKUP_ENABLED) { 20915 fg->flags = fg->flags | _FP_GROUP_LOOKUP_ENABLED; 20916 } 20917 if (group_flags & _FP_GROUP_WLAN) { 20918 fg->flags = fg->flags | _FP_GROUP_WLAN; 20919 } 20920 } else { 20921 fg->flags |= _FP_GROUP_LOOKUP_ENABLED; 20922 } 20923 20924 /* Recover ports for group */ 20925 BCM_PBMP_CLEAR(fg->pbmp); 20926 PBMP_PORT_ITER(unit, port) { 20927 BCM_PBMP_PORT_ADD(fg->pbmp, port); 20928 } 20929 BCM_PBMP_PORT_ADD(fg->pbmp, 0); 20930 fs->pbmp = fg->pbmp; 20931 20932 /* Hook new group into stage */ 20933 fg->next = fc->groups; 20934 fc->groups = fg; 20935 20936 } /* entry_cnt == 0 */ 20937 20938 /* Add entry to group */ 20939 _FP_XGS3_ALLOC(f_ent, sizeof(*f_ent), "field entry"); 20940 if (f_ent == NULL) { 20941 LOG_ERROR(BSL_LS_BCM_FP, \ 20942 (BSL_META_U(unit, \ 20943 "Error while allocating memory for \ 20944 field entry\n"))); 20945 rv = BCM_E_MEMORY; 20946 goto cleanup; 20947 } 20948 20949 for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) { 20950 f_ent->policer[idx1].pid = _FP_INVALID_INDEX; 20951 } 20952 20953 sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t)); 20954 f_ent_wb_info.sid = -1; 20955 f_ent_wb_info.pid = -1; 20956 f_ent_wb_info.pid1 = -1; 20957 20958 if (fc->l2warm) { 20959 /* Retrieve entry info */ 20960 rv = _field_trx_entry_info_retrieve(unit, 20961 fc, 20962 stage_fc, 20963 multigroup, 20964 &prev_prio, 20965 &f_ent_wb_info 20966 ); 20967 if (BCM_FAILURE(rv)) { 20968 fc->l2warm = 0; 20969 goto cleanup; 20970 } 20971 } else { 20972 _bcm_field_last_alloc_eid_incr(unit); 20973 } 20974 20975 if (fc->l2warm) { 20976 /* Use retrieved EID */ 20977 f_ent->eid = f_ent_wb_info.eid; 20978 /* Set retrieved dvp_type and svp_type */ 20979 f_ent->dvp_type = f_ent_wb_info.dvp_type[0]; 20980 f_ent->svp_type = f_ent_wb_info.svp_type[0]; 20981 } else { 20982 f_ent->eid = _bcm_field_last_alloc_eid_get(unit); 20983 } 20984 f_ent->group = fg; 20985 20986 f_ent->flags = _FP_ENTRY_PRIMARY; 20987 f_ent->slice_idx = entry_idx; 20988 f_ent->fs = fs; 20989 20990 if (f_ent_wb_info.color_independent) { 20991 f_ent->flags |= _FP_ENTRY_COLOR_INDEPENDENT; 20992 } 20993 20994 f_ent->tcam.key_size = ((soc_mem_field_length(unit, 20995 tcam_data_mem, DATAf) + 31) & ~31) >> (5 - 2); 20996 20997 f_ent->tcam.key_hw=sal_alloc(f_ent->tcam.key_size,"TCAM data buf"); 20998 f_ent->tcam.mask_hw=sal_alloc(f_ent->tcam.key_size,"TCAM mask buf"); 20999 21000 rv = soc_mem_read(unit, tcam_data_mem, MEM_BLOCK_ANY, 21001 entry_idx, tcam_buf.entry_data); 21002 if (BCM_FAILURE(rv)) { 21003 LOG_ERROR(BSL_LS_BCM_FP, 21004 (BSL_META_U(unit, 21005 "Error while reading tcam data entry\n"))); 21006 goto cleanup; 21007 } 21008 soc_mem_field_get(unit, tcam_data_mem, tcam_buf.entry_data, 21009 DATAf, f_ent->tcam.key_hw); 21010 21011 if (tcam_mask_mem != INVALIDm) { 21012 rv = soc_mem_read(unit, tcam_mask_mem, MEM_BLOCK_ANY, 0, 21013 tcam_mask.entry_data); 21014 if (BCM_FAILURE(rv)) { 21015 LOG_ERROR(BSL_LS_BCM_FP, \ 21016 (BSL_META_U(unit, \ 21017 "Error while reading \ 21018 tcam mask entry\n"))); 21019 goto cleanup; 21020 } 21021 soc_mem_field_get(unit, tcam_mask_mem, tcam_mask.entry_data, 21022 MASKf, f_ent->tcam.mask_hw); 21023 } else { 21024 soc_mem_field_get(unit, tcam_data_mem, tcam_buf.entry_data, 21025 MASKf, f_ent->tcam.mask_hw); 21026 } 21027 21028 for (i=0; i < (f_ent->tcam.key_size/4); i++) { 21029 f_ent->tcam.mask_hw[i] = ~(f_ent->tcam.mask_hw[i]); 21030 } 21031 21032 /* Assign entry to a slice */ 21033 fs->entries[entry_idx] = f_ent; 21034 f_ent->flags |= _FP_ENTRY_INSTALLED; 21035 --fs->free_count; 21036 21037 /* Assign entry to group */ 21038 f_ent->group = fg; 21039 21040 /* Recover non-profiled actions */ 21041 rv = _field_tr3_non_profiled_actions_recover(unit, policy_mem, 21042 entry_idx, f_ent_wb_info.sid, f_ent); 21043 if (BCM_FAILURE(rv)) { 21044 goto cleanup; 21045 } 21046 if (soc_feature(unit, soc_feature_advanced_flex_counter) && 21047 ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_14)) { 21048 _field_adv_flex_stat_info_retrieve(unit, f_ent->statistic.sid); 21049 rv = _bcm_field_stat_get(unit, f_ent->statistic.sid, &f_st); 21050 if (BCM_SUCCESS(rv)) { 21051 f_st->hw_index = f_ent->slice_idx; 21052 f_st->pool_index = f_ent->fs->slice_number; 21053 } 21054 } 21055 21056 /* Recover profiled actions */ 21057 rv = _field_tr3_profiled_actions_recover(unit, policy_mem, 21058 entry_idx, stage_fc, f_ent); 21059 if (BCM_FAILURE(rv)) { 21060 goto cleanup; 21061 } 21062 21063 /* Add to the group */ 21064 if (fc->l2warm) { 21065 f_ent->prio = f_ent_wb_info.prio; 21066 } else { 21067 f_ent->prio = cum_slice_entry_cnt[slice_idx] - entry_idx; 21068 } 21069 21070 rv = _field_group_entry_add(unit, fg, f_ent); 21071 if (BCM_FAILURE(rv)) { 21072 goto cleanup; 21073 } 21074 21075 f_ent = 0; 21076 21077 ++entry_cnt; 21078 21079 } /* For loop -- entry */ 21080 21081 if (wb_mode) { 21082 SOC_WARM_BOOT_START(unit); 21083 wb_mode = 0; 21084 } 21085 21086 /* Free up the temporary slice group info */ 21087 if (fc->l2warm) { 21088 _field_scache_slice_group_free(unit, 21089 fc, 21090 slice_idx 21091 ); 21092 } 21093 BCM_IF_ERROR_RETURN 21094 (_bcm_field_prio_mgmt_slice_reinit(unit, stage_fc, fs)); 21095 21096 fg = 0; 21097 } /* For loop -- slice */ 21098 21099 if (fc->l2warm) { 21100 /* Mark end of Slice Info */ 21101 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 21102 fc->scache_pos++; 21103 } 21104 21105 /* Group Slice Selectors */ 21106 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) { 21107 rv = (_field_group_slice_selectors_recover(unit, 21108 &buf[fc->scache_pos], stage_fc->stage_id)); 21109 if (BCM_FAILURE(rv)) { 21110 goto cleanup; 21111 } 21112 } 21113 21114 /* Recovering end sequence */ 21115 result = 0; 21116 for (i = 0; i < 4; i++) { 21117 val = buf[fc->scache_pos]; 21118 ++fc->scache_pos; 21119 result |= val << (i * 8); 21120 } 21121 if (result != _FIELD_EXTFP_DATA_END) { 21122 /* End sequence not found */ 21123 LOG_ERROR(BSL_LS_BCM_FP, 21124 (BSL_META_U(unit, 21125 "0:End sequence NOT found in scache\n"))); 21126 rv = BCM_E_INTERNAL; 21127 fc->l2warm = 0; 21128 goto cleanup; 21129 } 21130 if(NULL != buf1) { 21131 result = 0; 21132 for (i = 0; i < 4; i++) { 21133 val = buf1[fc->scache_pos1]; 21134 ++fc->scache_pos1; 21135 result |= val << (i * 8); 21136 } 21137 if (result != _FIELD_EXTFP_DATA_END) { 21138 /* End sequence not found */ 21139 LOG_ERROR(BSL_LS_BCM_FP, 21140 (BSL_META_U(unit, 21141 "1:End sequence NOT found in scache\n"))); 21142 rv = BCM_E_INTERNAL; 21143 fc->l2warm = 0; 21144 goto cleanup; 21145 } 21146 21147 } 21148 } 21149 21150 if (BCM_SUCCESS(rv)) { 21151 _field_group_slice_vmap_recovery(unit, fc, stage_fc); 21152 } 21153 21154 cleanup: 21155 if (wb_mode) { 21156 SOC_WARM_BOOT_START(unit); 21157 wb_mode = 0; 21158 } 21159 if (f_ent) { 21160 sal_free(f_ent); 21161 } 21162 if (fg) { 21163 sal_free(fg); 21164 } 21165 return (rv); 21166 } 21167 21168 /* 21169 * Function: 21170 * _bcm_field_tr3_stage_external_reinit 21171 * Purpose: 21172 * Reconstruct ESM ACL/External stage groups and entries. 21173 * Parameters: 21174 * unit - (IN) BCM device number. 21175 * fc - (IN) Device field control structure pointer. 21176 * stage_fc - (IN) FP stage control info. 21177 * Returns: 21178 * BCM_E_XXX 21179 */ 21180 int 21181 _bcm_field_tr3_stage_external_reinit(int unit, 21182 _field_control_t *fc, 21183 _field_stage_t *stage_fc) 21184 { 21185 if ((!fc) || (!stage_fc)) { 21186 return(BCM_E_INTERNAL); 21187 } 21188 if (!_field_tr3_ext_scache_sync_chk(unit, fc, stage_fc)) { 21189 return (_field_tr3_stage_external_reinit(unit, fc, stage_fc)); 21190 } 21191 return (BCM_E_NONE); 21192 } 21193 21194 21195 /* 21196 * Function: 21197 * _field_tr3_actions_recover_replaceL2Fields 21198 * Purpose: 21199 * recover the fields actions depending on EGR_IFP_MOD_FIELDS table 21200 * Parameters: 21201 * unit - BCM device number 21202 * index - the hardware index assigned to the action 21203 * f_ent - Field entry structure 21204 * Returns: 21205 * BCM_E_XXX 21206 * Notes: 21207 * For triumph3 and helix4 devices only. 21208 */ 21209 21210 int _field_tr3_actions_recover_replaceL2Fields(int unit, 21211 int index, 21212 _field_entry_t *f_ent 21213 ) 21214 { 21215 int isSet = 0; 21216 uint32 fieldVal; 21217 uint32 cfiVal; 21218 uint32 tbl_entry[SOC_MAX_MEM_FIELD_WORDS]; 21219 int rv = BCM_E_NONE; 21220 _field_control_t *fc; /* Unit field control information. */ 21221 sal_mac_addr_t mac_addr; /* MAC address info */ 21222 uint32 mac_addr_words[2]; /* MAC address info for Param[0], 21223 * Param[1] */ 21224 BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc)); 21225 if (index > fc->_fp_egr_ifp_mod_fields_size) { 21226 return (BCM_E_PARAM); 21227 } 21228 21229 /*set the index in the bitmap*/ 21230 SHR_BITSET(fc->field_action_l2mod_index_bmp.w, index); 21231 rv = READ_EGR_IFP_MOD_FIELDSm(unit, MEM_BLOCK_ANY, index, &tbl_entry); 21232 if(BCM_FAILURE(rv)) { 21233 return BCM_E_UNAVAIL; 21234 } 21235 /*if inner vlan is set */ 21236 isSet = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21237 &tbl_entry, CHANGE_INNER_VLANf); 21238 if(isSet) { 21239 fieldVal = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21240 &tbl_entry, INNER_VLANf); 21241 21242 rv = _field_trx_actions_recover_action_add(unit, 21243 f_ent, 21244 bcmFieldActionReplaceInnerVlan, 21245 fieldVal, 21246 0, 0, 0, 0, 0, 21247 index 21248 ); 21249 if (BCM_FAILURE(rv)) { 21250 return rv; 21251 } 21252 } 21253 /* if outer vlan is set*/ 21254 isSet = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21255 &tbl_entry, CHANGE_OUTER_VLANf); 21256 if(isSet) { 21257 fieldVal = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21258 &tbl_entry, OUTER_VLANf); 21259 21260 rv = _field_trx_actions_recover_action_add(unit, 21261 f_ent, 21262 bcmFieldActionReplaceOuterVlan, 21263 fieldVal, 21264 0, 0, 0, 0, 0, 21265 index 21266 ); 21267 if (BCM_FAILURE(rv)) { 21268 return rv; 21269 } 21270 } 21271 /* if srcMac is set */ 21272 isSet = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21273 &tbl_entry, CHANGE_MAC_SAf); 21274 if(isSet) { 21275 soc_mem_mac_addr_get(unit, EGR_IFP_MOD_FIELDSm, 21276 &tbl_entry, MAC_SAf, mac_addr); 21277 SAL_MAC_ADDR_TO_UINT32(mac_addr, mac_addr_words); 21278 21279 /* Re-Create bcmFieldActionReplaceSrcMac action for the 21280 * FP entry */ 21281 rv = _field_trx_actions_recover_action_add(unit, 21282 f_ent, 21283 bcmFieldActionReplaceSrcMac, 21284 mac_addr_words[0], 21285 mac_addr_words[1], 0, 0, 0, 0, 21286 index 21287 ); 21288 if (BCM_FAILURE(rv)) { 21289 return rv; 21290 } 21291 } 21292 21293 /* if dstMac is set */ 21294 isSet = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21295 &tbl_entry, CHANGE_MAC_DAf); 21296 if(isSet) { 21297 21298 soc_mem_mac_addr_get(unit, EGR_IFP_MOD_FIELDSm, 21299 &tbl_entry, MAC_DAf, mac_addr); 21300 SAL_MAC_ADDR_TO_UINT32(mac_addr, mac_addr_words); 21301 21302 /* Re-Create bcmFieldActionReplaceDstMac action for the 21303 * FP entry */ 21304 rv = _field_trx_actions_recover_action_add(unit, 21305 f_ent, 21306 bcmFieldActionReplaceDstMac, 21307 mac_addr_words[0], 21308 mac_addr_words[1], 0, 0, 0, 0, 21309 index 21310 ); 21311 if (BCM_FAILURE(rv)) { 21312 return rv; 21313 } 21314 } 21315 21316 /* if innerpriority is set */ 21317 isSet = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21318 &tbl_entry, IPRI_ICFI_SELf); 21319 if(isSet == 1) { 21320 fieldVal = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21321 &tbl_entry, NEW_IPRI_ICFIf); 21322 cfiVal = fieldVal & 1; 21323 fieldVal = fieldVal >> 1; 21324 if(cfiVal == 0) { 21325 rv = _field_trx_actions_recover_action_add(unit, 21326 f_ent, 21327 bcmFieldActionReplaceInnerVlanPriority, 21328 BCM_FIELD_REPLACE_VLAN_PRIORITY, 21329 fieldVal, 21330 0, 0, 0, 0, 21331 index); 21332 } else { 21333 rv = _field_trx_actions_recover_action_add(unit, 21334 f_ent, 21335 bcmFieldActionReplaceInnerVlanPriority, 21336 BCM_FIELD_REPLACE_VLAN_PRIORITY_USE_INTERNAL_CFI, 21337 fieldVal, 21338 0, 0, 0, 0, 21339 index); 21340 } 21341 21342 } else if(isSet == 2) { 21343 rv = _field_trx_actions_recover_action_add(unit, 21344 f_ent, 21345 bcmFieldActionReplaceInnerVlanPriority, 21346 BCM_FIELD_REPLACE_VLAN_PRIORITY_FROM_INT_PRIO_AND_CNG, 21347 0, 0, 0, 0, 0, 21348 index); 21349 } 21350 if (isSet && BCM_FAILURE(rv)) { 21351 return rv; 21352 } 21353 21354 /* if outerpriority set */ 21355 isSet = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21356 &tbl_entry, OPRI_OCFI_SELf); 21357 if(isSet == 1) { 21358 fieldVal = soc_mem_field32_get(unit, EGR_IFP_MOD_FIELDSm, 21359 &tbl_entry, NEW_OPRI_OCFIf); 21360 cfiVal = fieldVal & 1; 21361 fieldVal = fieldVal >> 1; 21362 if(cfiVal == 0) { 21363 rv = _field_trx_actions_recover_action_add(unit, 21364 f_ent, 21365 bcmFieldActionReplaceOuterVlanPriority, 21366 BCM_FIELD_REPLACE_VLAN_PRIORITY, 21367 fieldVal, 21368 0, 0, 0, 0, 21369 index); 21370 } else { 21371 rv = _field_trx_actions_recover_action_add(unit, 21372 f_ent, 21373 bcmFieldActionReplaceOuterVlanPriority, 21374 BCM_FIELD_REPLACE_VLAN_PRIORITY_USE_INTERNAL_CFI, 21375 fieldVal, 21376 0, 0, 0, 0, 21377 index); 21378 21379 } 21380 } else if(isSet == 2) { 21381 rv = _field_trx_actions_recover_action_add(unit, 21382 f_ent, 21383 bcmFieldActionReplaceOuterVlanPriority, 21384 BCM_FIELD_REPLACE_VLAN_PRIORITY_FROM_INT_PRIO_AND_CNG, 21385 0, 0, 0, 0, 0, 21386 index); 21387 } 21388 if (isSet && BCM_FAILURE(rv)) { 21389 return rv; 21390 } 21391 return BCM_E_NONE; 21392 } 21393 21394 #endif 21395 #else /* BCM_TRIUMPH3_SUPPORT && BCM_FIELD_SUPPORT */ 21396 int _tr3_field_not_empty; 21397 #endif /* BCM_TRIUMPH3_SUPPORT && BCM_FIELD_SUPPORT */