field.c (116148B)
1 /* 2 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 * 4 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 5 * 6 * File: field.c 7 * Purpose: BCM56624 Field Processor installation functions. 8 */ 9 10 #include <soc/defs.h> 11 #if defined(BCM_SCORPION_SUPPORT) && defined(BCM_FIELD_SUPPORT) 12 13 #include <soc/mem.h> 14 #include <soc/drv.h> 15 16 #include <bcm/error.h> 17 #include <bcm/l3.h> 18 #include <bcm/field.h> 19 #include <bcm/tunnel.h> 20 21 #include <bcm_int/esw/field.h> 22 #include <bcm_int/esw/l3.h> 23 #include <bcm_int/esw/firebolt.h> 24 #include <bcm_int/esw/trx.h> 25 #include <bcm_int/esw/scorpion.h> 26 27 28 29 /* local/static function prototypes */ 30 STATIC void _field_sc_functions_init(_field_funct_t *functions) ; 31 STATIC int _field_sc_detach(int unit, _field_control_t *fc); 32 STATIC int _field_sc_hw_clear(int unit, _field_stage_t *stage_fc); 33 /* 34 * Function: 35 * _field_sc_ingress_qualifiers_init 36 * Purpose: 37 * Initialize device stage ingress qaualifiers 38 * select codes & offsets 39 * Parameters: 40 * unit - (IN) BCM device number. 41 * stage_fc - (IN) Field Processor stage control structure. 42 * 43 * Returns: 44 * BCM_E_NONE 45 */ 46 STATIC int 47 _field_sc_ingress_qualifiers_init(int unit, _field_stage_t *stage_fc) 48 { 49 _FP_QUAL_DECL; 50 51 /* Input parameters check. */ 52 if (NULL == stage_fc) { 53 return (BCM_E_PARAM); 54 } 55 56 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage, 57 _bcmFieldSliceSelDisable, 0, 0, 0); 58 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageIngress, 59 _bcmFieldSliceSelDisable, 0, 0, 0); 60 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 61 _bcmFieldSliceSelDisable, 0, 0, 0); 62 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 63 _bcmFieldSliceSelDisable, 0, 0, 0); 64 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 65 _bcmFieldSliceSelDisable, 0, 0, 0); 66 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts, 67 _bcmFieldSliceSelDisable, 0, 0, 0); 68 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts, 69 _bcmFieldSliceSelDisable, 0, 0, 0); 70 71 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 72 _bcmFieldSliceSelDisable, 0, 6, 1); 73 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 74 _bcmFieldSliceSelDisable, 0, 7, 4); 75 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 76 _bcmFieldSliceSelDisable, 0, 11, 1); 77 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 78 _bcmFieldSliceSelDisable, 0, 12, 1); 79 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 80 _bcmFieldSliceSelDisable, 0, 13, 1); 81 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 82 _bcmFieldSliceSelDisable, 0, 14, 1); 83 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 84 _bcmFieldSliceSelDisable, 0, 15, 1); 85 86 /* FPF3 primary slice single wide. */ 87 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 88 _bcmFieldSliceSelFpf3, 0, 89 _bcmFieldSliceDstClassSelect, 0, 18, 6); 90 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 91 _bcmFieldSliceSelFpf3, 0, 92 _bcmFieldSliceDstClassSelect, 1, 18, 6); 93 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 94 _bcmFieldSliceSelFpf3, 0, 95 _bcmFieldSliceDstClassSelect, 2, 18, 6); 96 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 97 _bcmFieldSliceSelFpf3, 0, 98 _bcmFieldSliceSrcClassSelect, 2, 24, 6); 99 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 100 _bcmFieldSliceSelFpf3, 0, 101 _bcmFieldSliceSrcClassSelect, 0, 24, 6); 102 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 103 _bcmFieldSliceSelFpf3, 0, 104 _bcmFieldSliceSrcClassSelect, 1, 24, 6); 105 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 106 _bcmFieldSliceSelFpf3, 0, 107 _bcmFieldSliceSrcClassSelect, 3, 24, 6); 108 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 109 _bcmFieldSliceSelFpf3, 0, 110 _bcmFieldSliceDstClassSelect, 3, 18, 6); 111 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 112 _bcmFieldSliceSelFpf3, 0, 30, 8); 113 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 114 _bcmFieldSliceSelFpf3, 1, 115 _bcmFieldSliceDstClassSelect, 0, 18, 6); 116 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 117 _bcmFieldSliceSelFpf3, 1, 118 _bcmFieldSliceDstClassSelect, 1, 18, 6); 119 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 120 _bcmFieldSliceSelFpf3, 1, 121 _bcmFieldSliceDstClassSelect, 2, 18, 6); 122 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 123 _bcmFieldSliceSelFpf3, 1, 124 _bcmFieldSliceSrcClassSelect, 2, 24, 6); 125 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 126 _bcmFieldSliceSelFpf3, 1, 127 _bcmFieldSliceSrcClassSelect, 0, 24, 6); 128 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 129 _bcmFieldSliceSelFpf3, 1, 130 _bcmFieldSliceSrcClassSelect, 1, 24, 6); 131 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 132 _bcmFieldSliceSelFpf3, 1, 133 _bcmFieldSliceSrcClassSelect, 3, 24, 6); 134 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 135 _bcmFieldSliceSelFpf3, 1, 136 _bcmFieldSliceDstClassSelect, 3, 18, 6); 137 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 138 _bcmFieldSliceSelFpf3, 1, 30, 8); 139 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 140 _bcmFieldSliceSelFpf3, 1, 38, 12); 141 142 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 143 _bcmFieldSliceSelFpf3, 2, 18, 15); 144 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 145 _bcmFieldSliceSelFpf3, 2, 18, 15); 146 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 147 _bcmFieldSliceSelFpf3, 2, 33, 15); 148 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 149 _bcmFieldSliceSelFpf3, 2, 33, 15); 150 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 151 _bcmFieldSliceSelFpf3, 2, 48, 3); 152 153 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 154 _bcmFieldSliceSelFpf3, 3, 18, 16); 155 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 156 _bcmFieldSliceSelFpf3, 3, 18, 12); 157 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 158 _bcmFieldSliceSelFpf3, 3, 30, 1); 159 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 160 _bcmFieldSliceSelFpf3, 3, 31, 3); 161 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 162 _bcmFieldSliceSelFpf3, 3, 34, 2); 163 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 164 _bcmFieldSliceSelFpf3, 3, 34, 2); 165 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 166 _bcmFieldSliceSelFpf3, 3, 36, 2); 167 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 168 _bcmFieldSliceSelFpf3, 3, 38, 3); 169 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 170 _bcmFieldSliceSelFpf3, 3, 41, 4); 171 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo, 172 _bcmFieldSliceSelFpf3, 3, 45, 3); 173 174 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 175 _bcmFieldSliceSelFpf3, 4, 18, 16); 176 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 177 _bcmFieldSliceSelFpf3, 4, 18, 12); 178 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 179 _bcmFieldSliceSelFpf3, 4, 30, 1); 180 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 181 _bcmFieldSliceSelFpf3, 4, 31, 3); 182 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 183 _bcmFieldSliceSelFpf3, 4, 34, 16); 184 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 185 _bcmFieldSliceSelFpf3, 4, 34, 12); 186 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 187 _bcmFieldSliceSelFpf3, 4, 46, 1); 188 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 189 _bcmFieldSliceSelFpf3, 4, 47, 3); 190 191 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 192 _bcmFieldSliceSelFpf3, 5, 18, 16); 193 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 194 _bcmFieldSliceSelFpf3, 5, 18, 12); 195 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 196 _bcmFieldSliceSelFpf3, 5, 30, 1); 197 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 198 _bcmFieldSliceSelFpf3, 5, 31, 3); 199 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 200 _bcmFieldSliceSelFpf3, 5, 34, 16); 201 202 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 203 _bcmFieldSliceSelFpf3, 6, 19, 1); 204 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 205 _bcmFieldSliceSelFpf3, 6, 20, 1); 206 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 207 _bcmFieldSliceSelFpf3, 6, 21, 2); 208 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 209 _bcmFieldSliceSelFpf3, 6, 23, 1); 210 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 211 _bcmFieldSliceSelFpf3, 6, 24, 1); 212 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 213 _bcmFieldSliceSelFpf3, 6, 25, 1); 214 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 215 _bcmFieldSliceSelFpf3, 6, 27, 1); 216 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 217 _bcmFieldSliceSelFpf3, 6, 28, 1); 218 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 219 _bcmFieldSliceSelFpf3, 6, 29, 1); 220 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 221 _bcmFieldSliceSelFpf3, 6, 30, 1); 222 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 223 _bcmFieldSliceSelFpf3, 6, 31, 1); 224 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 225 _bcmFieldSliceSelFpf3, 6, 32, 1); 226 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 227 _bcmFieldSliceSelFpf3, 6, 33, 1); 228 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 229 _bcmFieldSliceSelFpf3, 6, 34, 16); 230 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 231 _bcmFieldSliceSelFpf3, 6, 34, 12); 232 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 233 _bcmFieldSliceSelFpf3, 6, 46, 1); 234 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 235 _bcmFieldSliceSelFpf3, 6, 47, 3); 236 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 237 _bcmFieldSliceSelFpf3, 7, 18, 24); 238 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31, 239 _bcmFieldSliceSelFpf3, 7, 240 _bcmFieldSliceIntfClassSelect, 3, 42, 8); 241 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 242 _bcmFieldSliceSelFpf3, 7, 243 _bcmFieldSliceIntfClassSelect, 0, 42, 8); 244 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 245 _bcmFieldSliceSelFpf3, 7, 246 _bcmFieldSliceIntfClassSelect, 1, 42, 8); 247 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 248 _bcmFieldSliceSelFpf3, 7, 249 _bcmFieldSliceIntfClassSelect, 2, 42, 8); 250 251 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel, 252 _bcmFieldSliceSelFpf3, 8, 18, 20); 253 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 254 _bcmFieldSliceSelFpf3, 8, 38, 2); 255 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 256 _bcmFieldSliceSelFpf3, 8, 38, 2); 257 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 258 _bcmFieldSliceSelFpf3, 8, 40, 2); 259 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid, 260 _bcmFieldSliceSelFpf3, 8, 42, 2); 261 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid, 262 _bcmFieldSliceSelFpf3, 8, 44, 2); 263 264 /* FPF2 */ 265 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 266 _bcmFieldSliceSelFpf2, 0, 267 _bcmFieldSliceTtlClassSelect, 0, 268 51, 8); 269 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 270 _bcmFieldSliceSelFpf2, 0, 271 _bcmFieldSliceTtlClassSelect, 0, 272 51, 8); 273 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 274 _bcmFieldSliceSelFpf2, 0, 275 _bcmFieldSliceTtlClassSelect, 1, 276 51, 8); 277 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 278 _bcmFieldSliceSelFpf2, 0, 279 _bcmFieldSliceTcpClassSelect, 0, 280 59, 6); 281 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero, 282 _bcmFieldSliceSelFpf2, 0, 283 _bcmFieldSliceTcpClassSelect, 0, 284 59, 6); 285 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne, 286 _bcmFieldSliceSelFpf2, 0, 287 _bcmFieldSliceTcpClassSelect, 1, 288 59, 6); 289 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFlags, 290 _bcmFieldSliceSelFpf2, 0, 65, 2); 291 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 292 _bcmFieldSliceSelFpf2, 0, 293 _bcmFieldSliceTosClassSelect, 0, 294 67, 8); 295 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 296 _bcmFieldSliceSelFpf2, 0, 297 _bcmFieldSliceTosClassSelect, 0, 298 67, 8); 299 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 300 _bcmFieldSliceSelFpf2, 0, 301 _bcmFieldSliceTosClassSelect, 1, 302 67, 8); 303 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 304 _bcmFieldSliceSelFpf2, 0, 75, 16); 305 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 306 _bcmFieldSliceSelFpf2, 0, 91, 16); 307 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 308 _bcmFieldSliceSelFpf2, 0, 107, 8); 309 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 310 _bcmFieldSliceSelFpf2, 0, 115, 32); 311 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 312 _bcmFieldSliceSelFpf2, 0, 147, 32); 313 314 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 315 _bcmFieldSliceSelFpf2, 1, 316 _bcmFieldSliceTtlClassSelect, 0, 317 51, 8); 318 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 319 _bcmFieldSliceSelFpf2, 1, 320 _bcmFieldSliceTtlClassSelect, 0, 321 51, 8); 322 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 323 _bcmFieldSliceSelFpf2, 1, 324 _bcmFieldSliceTtlClassSelect, 1, 325 51, 8); 326 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 327 _bcmFieldSliceSelFpf2, 1, 328 _bcmFieldSliceTcpClassSelect, 0, 329 59, 6); 330 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero, 331 _bcmFieldSliceSelFpf2, 1, 332 _bcmFieldSliceTcpClassSelect, 0, 333 59, 6); 334 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne, 335 _bcmFieldSliceSelFpf2, 1, 336 _bcmFieldSliceTcpClassSelect, 1, 337 59, 6); 338 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 339 _bcmFieldSliceSelFpf2, 1, 65, 2); 340 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 341 _bcmFieldSliceSelFpf2, 1, 342 _bcmFieldSliceTosClassSelect, 0, 343 67, 8); 344 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 345 _bcmFieldSliceSelFpf2, 1, 346 _bcmFieldSliceTosClassSelect, 0, 347 67, 8); 348 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 349 _bcmFieldSliceSelFpf2, 1, 350 _bcmFieldSliceTosClassSelect, 1, 351 67, 8); 352 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 353 _bcmFieldSliceSelFpf2, 1, 75, 16); 354 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 355 _bcmFieldSliceSelFpf2, 1, 91, 16); 356 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 357 _bcmFieldSliceSelFpf2, 1, 107, 8); 358 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 359 _bcmFieldSliceSelFpf2, 1, 115, 32); 360 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 361 _bcmFieldSliceSelFpf2, 1, 147, 32); 362 363 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 364 _bcmFieldSliceSelFpf2, 2, 51, 128); 365 366 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 367 _bcmFieldSliceSelFpf2, 3, 51, 128); 368 369 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 370 _bcmFieldSliceSelFpf2, 4, 371 _bcmFieldSliceTtlClassSelect, 0, 372 51, 8); 373 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 374 _bcmFieldSliceSelFpf2, 4, 375 _bcmFieldSliceTtlClassSelect, 0, 376 51, 8); 377 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 378 _bcmFieldSliceSelFpf2, 4, 379 _bcmFieldSliceTtlClassSelect, 1, 380 51, 8); 381 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 382 _bcmFieldSliceSelFpf2, 4, 383 _bcmFieldSliceTcpClassSelect, 0, 384 59, 6); 385 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero, 386 _bcmFieldSliceSelFpf2, 4, 387 _bcmFieldSliceTcpClassSelect, 0, 388 59, 6); 389 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne, 390 _bcmFieldSliceSelFpf2, 4, 391 _bcmFieldSliceTcpClassSelect, 1, 392 59, 6); 393 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel, 394 _bcmFieldSliceSelFpf2, 4, 65, 20); 395 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 396 _bcmFieldSliceSelFpf2, 4, 397 _bcmFieldSliceTosClassSelect, 0, 398 85, 8); 399 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 400 _bcmFieldSliceSelFpf2, 4, 401 _bcmFieldSliceTosClassSelect, 0, 402 85, 8); 403 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 404 _bcmFieldSliceSelFpf2, 4, 405 _bcmFieldSliceTosClassSelect, 1, 406 85, 8); 407 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 408 _bcmFieldSliceSelFpf2, 4, 93, 8); 409 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 410 _bcmFieldSliceSelFpf2, 4, 101, 64); 411 412 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 413 _bcmFieldSliceSelFpf2, 5, 51, 16); 414 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 415 _bcmFieldSliceSelFpf2, 5, 51, 12); 416 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 417 _bcmFieldSliceSelFpf2, 5, 63, 1); 418 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 419 _bcmFieldSliceSelFpf2, 5, 64, 3); 420 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 421 _bcmFieldSliceSelFpf2, 5, 67, 16); 422 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 423 _bcmFieldSliceSelFpf2, 5, 83, 48); 424 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 425 _bcmFieldSliceSelFpf2, 5, 131, 48); 426 427 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 428 _bcmFieldSliceSelFpf2, 6, 51, 16); 429 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 430 _bcmFieldSliceSelFpf2, 6, 51, 12); 431 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 432 _bcmFieldSliceSelFpf2, 6, 63, 1); 433 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 434 _bcmFieldSliceSelFpf2, 6, 64, 3); 435 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 436 _bcmFieldSliceSelFpf2, 6, 67, 16); 437 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 438 _bcmFieldSliceSelFpf2, 6, 83, 32); 439 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 440 _bcmFieldSliceSelFpf2, 6, 115, 48); 441 442 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 443 _bcmFieldSliceSelFpf2, 7, 51, 16); 444 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 445 _bcmFieldSliceSelFpf2, 7, 51, 12); 446 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 447 _bcmFieldSliceSelFpf2, 7, 63, 1); 448 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 449 _bcmFieldSliceSelFpf2, 7, 64, 3); 450 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 451 _bcmFieldSliceSelFpf2, 7, 67, 16); 452 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 453 _bcmFieldSliceSelFpf2, 7, 83, 32); 454 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 455 _bcmFieldSliceSelFpf2, 7, 115, 48); 456 457 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0, 458 _bcmFieldSliceSelFpf2, 8, 51, 128); 459 460 _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1, 461 _bcmFieldSliceSelFpf2, 9, 51, 128); 462 463 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High, 464 _bcmFieldSliceSelFpf2, 10, 51, 64); 465 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 466 _bcmFieldSliceSelFpf2, 10, 115, 64); 467 468 469 /* FPF1 */ 470 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 471 _bcmFieldSliceSelFpf1, 0, 472 _bcmFieldSliceDstClassSelect, 0, 179, 6); 473 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 474 _bcmFieldSliceSelFpf1, 0, 475 _bcmFieldSliceDstClassSelect, 1, 179, 6); 476 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 477 _bcmFieldSliceSelFpf1, 0, 478 _bcmFieldSliceDstClassSelect, 2, 179, 6); 479 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 480 _bcmFieldSliceSelFpf1, 0, 481 _bcmFieldSliceSrcClassSelect, 2, 185, 6); 482 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 483 _bcmFieldSliceSelFpf1, 0, 484 _bcmFieldSliceSrcClassSelect, 0, 185, 6); 485 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 486 _bcmFieldSliceSelFpf1, 0, 487 _bcmFieldSliceSrcClassSelect, 1, 185, 6); 488 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 489 _bcmFieldSliceSelFpf1, 0, 490 _bcmFieldSliceSrcClassSelect, 3, 185, 6); 491 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 492 _bcmFieldSliceSelFpf1, 0, 493 _bcmFieldSliceDstClassSelect, 3, 179, 6); 494 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 495 _bcmFieldSliceSelFpf1, 0, 191, 10); 496 497 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 498 _bcmFieldSliceSelFpf1, 1, 179, 15); 499 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 500 _bcmFieldSliceSelFpf1, 1, 179, 15); 501 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort, 502 _bcmFieldSliceSelFpf1, 1, 194, 15); 503 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk, 504 _bcmFieldSliceSelFpf1, 1, 194, 15); 505 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 506 _bcmFieldSliceSelFpf1, 1, 209, 3); 507 508 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort, 509 _bcmFieldSliceSelFpf1, 2, 179, 15); 510 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk, 511 _bcmFieldSliceSelFpf1, 2, 179, 15); 512 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 513 _bcmFieldSliceSelFpf1, 2, 194, 3); 514 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2, 515 _bcmFieldSliceSelFpf1, 2, 516 _bcmFieldSliceDstClassSelect, 0, 197, 6); 517 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3, 518 _bcmFieldSliceSelFpf1, 2, 519 _bcmFieldSliceDstClassSelect, 1, 197, 6); 520 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 521 _bcmFieldSliceSelFpf1, 2, 522 _bcmFieldSliceDstClassSelect, 2, 197, 6); 523 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 524 _bcmFieldSliceSelFpf1, 2, 525 _bcmFieldSliceSrcClassSelect, 2, 203, 6); 526 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 527 _bcmFieldSliceSelFpf1, 2, 528 _bcmFieldSliceSrcClassSelect, 0, 203, 6); 529 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 530 _bcmFieldSliceSelFpf1, 2, 531 _bcmFieldSliceSrcClassSelect, 1, 203, 6); 532 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 533 _bcmFieldSliceSelFpf1, 2, 534 _bcmFieldSliceSrcClassSelect, 3, 203, 6); 535 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 536 _bcmFieldSliceSelFpf1, 2, 537 _bcmFieldSliceDstClassSelect, 3, 197, 6); 538 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 539 _bcmFieldSliceSelFpf1, 3, 179, 16); 540 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 541 _bcmFieldSliceSelFpf1, 3, 179, 12); 542 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 543 _bcmFieldSliceSelFpf1, 3, 191, 1); 544 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 545 _bcmFieldSliceSelFpf1, 3, 192, 3); 546 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 547 _bcmFieldSliceSelFpf1, 3, 195, 16); 548 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 549 _bcmFieldSliceSelFpf1, 3, 195, 12); 550 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 551 _bcmFieldSliceSelFpf1, 3, 207, 1); 552 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 553 _bcmFieldSliceSelFpf1, 3, 208, 3); 554 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid, 555 _bcmFieldSliceSelFpf1, 3, 211, 2); 556 557 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 558 _bcmFieldSliceSelFpf1, 4, 179, 16); 559 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 560 _bcmFieldSliceSelFpf1, 4, 179, 12); 561 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 562 _bcmFieldSliceSelFpf1, 4, 191, 1); 563 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 564 _bcmFieldSliceSelFpf1, 4, 192, 3); 565 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 566 _bcmFieldSliceSelFpf1, 4, 195, 16); 567 568 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 569 _bcmFieldSliceSelFpf1, 5, 180, 1); 570 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 571 _bcmFieldSliceSelFpf1, 5, 181, 1); 572 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 573 _bcmFieldSliceSelFpf1, 5, 182, 2); 574 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 575 _bcmFieldSliceSelFpf1, 5, 184, 1); 576 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 577 _bcmFieldSliceSelFpf1, 5, 185, 1); 578 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 579 _bcmFieldSliceSelFpf1, 5, 186, 1); 580 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 581 _bcmFieldSliceSelFpf1, 5, 188, 1); 582 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 583 _bcmFieldSliceSelFpf1, 5, 189, 1); 584 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 585 _bcmFieldSliceSelFpf1, 5, 190, 1); 586 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 587 _bcmFieldSliceSelFpf1, 5, 191, 1); 588 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 589 _bcmFieldSliceSelFpf1, 5, 192, 1); 590 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 591 _bcmFieldSliceSelFpf1, 5, 193, 1); 592 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 593 _bcmFieldSliceSelFpf1, 5, 194, 1); 594 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 595 _bcmFieldSliceSelFpf1, 5, 195, 16); 596 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 597 _bcmFieldSliceSelFpf1, 5, 195, 12); 598 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 599 _bcmFieldSliceSelFpf1, 5, 207, 1); 600 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 601 _bcmFieldSliceSelFpf1, 5, 208, 3); 602 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid, 603 _bcmFieldSliceSelFpf1, 5, 211, 2); 604 605 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 606 _bcmFieldSliceSelFpf1, 6, 179, 16); 607 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 608 _bcmFieldSliceSelFpf1, 6, 179, 12); 609 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 610 _bcmFieldSliceSelFpf1, 6, 191, 1); 611 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 612 _bcmFieldSliceSelFpf1, 6, 192, 3); 613 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 614 _bcmFieldSliceSelFpf1, 6, 195, 2); 615 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat, 616 _bcmFieldSliceSelFpf1, 6, 195, 2); 617 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 618 _bcmFieldSliceSelFpf1, 6, 197, 2); 619 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode, 620 _bcmFieldSliceSelFpf1, 6, 201, 3); 621 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes, 622 _bcmFieldSliceSelFpf1, 6, 204, 4); 623 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo, 624 _bcmFieldSliceSelFpf1, 6, 208, 3); 625 626 627 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 628 _bcmFieldSliceSelFpf1, 7, 179, 16); 629 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 630 _bcmFieldSliceSelFpf1, 7, 179, 12); 631 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 632 _bcmFieldSliceSelFpf1, 7, 191, 1); 633 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 634 _bcmFieldSliceSelFpf1, 7, 192, 3); 635 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 636 _bcmFieldSliceSelFpf1, 7, 637 _bcmFieldSliceSrcClassSelect, 0, 195, 6); 638 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 639 _bcmFieldSliceSelFpf1, 7, 640 _bcmFieldSliceSrcClassSelect, 1, 195, 6); 641 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 642 _bcmFieldSliceSelFpf1, 7, 643 _bcmFieldSliceSrcClassSelect, 3, 195, 6); 644 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 645 _bcmFieldSliceSelFpf1, 7, 646 _bcmFieldSliceSrcClassSelect, 2, 195, 6); 647 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 648 _bcmFieldSliceSelFpf1, 7, 201, 11); 649 650 651 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 652 _bcmFieldSliceSelFpf1, 8, 179, 8); 653 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 654 _bcmFieldSliceSelFpf1, 8, 655 _bcmFieldSliceTosClassSelect, 0, 656 187, 8); 657 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 658 _bcmFieldSliceSelFpf1, 8, 659 _bcmFieldSliceTosClassSelect, 0, 660 187, 8); 661 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 662 _bcmFieldSliceSelFpf1, 8, 663 _bcmFieldSliceTosClassSelect, 1, 664 187, 8); 665 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2, 666 _bcmFieldSliceSelFpf1, 8, 667 _bcmFieldSliceSrcClassSelect, 0, 195, 6); 668 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3, 669 _bcmFieldSliceSelFpf1, 8, 670 _bcmFieldSliceSrcClassSelect, 1, 195, 6); 671 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField, 672 _bcmFieldSliceSelFpf1, 8, 673 _bcmFieldSliceSrcClassSelect, 3, 195, 6); 674 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField, 675 _bcmFieldSliceSelFpf1, 8, 676 _bcmFieldSliceSrcClassSelect, 2, 195, 6); 677 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf, 678 _bcmFieldSliceSelFpf1, 8, 201, 11); 679 680 681 /* DWF4 */ 682 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 683 _bcmFieldSliceSelFpf4, 1, 684 _bcmFieldSliceTcpClassSelect, 0, 0, 6); 685 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero, 686 _bcmFieldSliceSelFpf4, 1, 687 _bcmFieldSliceTcpClassSelect, 0, 0, 6); 688 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne, 689 _bcmFieldSliceSelFpf4, 1, 690 _bcmFieldSliceTcpClassSelect, 1, 0, 6); 691 692 /* DWF3 */ 693 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos, 694 _bcmFieldSliceSelDisable, 0, 695 _bcmFieldSliceTosClassSelect, 0, 6, 8); 696 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero, 697 _bcmFieldSliceSelDisable, 0, 698 _bcmFieldSliceTosClassSelect, 0, 6, 8); 699 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne, 700 _bcmFieldSliceSelDisable, 0, 701 _bcmFieldSliceTosClassSelect, 1, 6, 8); 702 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 703 _bcmFieldSliceSelDisable, 0, 704 _bcmFieldSliceSelDisable, 0, 14, 8); 705 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, 706 bcmFieldQualifyExtensionHeaderSubCode, 707 _bcmFieldSliceSelDisable, 0, 708 _bcmFieldSliceSelDisable, 0, 22, 8); 709 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 710 _bcmFieldSliceSelDisable, 0, 711 _bcmFieldSliceSelDisable, 0, 30, 8); 712 713 /* DWF2 */ 714 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 715 _bcmFieldSliceSelFpf2, 0, 716 _bcmFieldSliceSelDisable, 0, 54, 1); 717 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 718 _bcmFieldSliceSelFpf2, 0, 719 _bcmFieldSliceSelDisable, 0, 55, 1); 720 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid, 721 _bcmFieldSliceSelFpf2, 0, 722 _bcmFieldSliceSelDisable, 0, 56, 1); 723 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState, 724 _bcmFieldSliceSelFpf2, 0, 725 _bcmFieldSliceSelDisable, 0, 57, 2); 726 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit, 727 _bcmFieldSliceSelFpf2, 0, 728 _bcmFieldSliceSelDisable, 0, 59, 1); 729 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic, 730 _bcmFieldSliceSelFpf2, 0, 731 _bcmFieldSliceSelDisable, 0, 60, 1); 732 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit, 733 _bcmFieldSliceSelFpf2, 0, 734 _bcmFieldSliceSelDisable, 0, 61, 1); 735 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit, 736 _bcmFieldSliceSelFpf2, 0, 737 _bcmFieldSliceSelDisable, 0, 63, 1); 738 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit, 739 _bcmFieldSliceSelFpf2, 0, 740 _bcmFieldSliceSelDisable, 0, 64, 1); 741 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit, 742 _bcmFieldSliceSelFpf2, 0, 743 _bcmFieldSliceSelDisable, 0, 65, 1); 744 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit, 745 _bcmFieldSliceSelFpf2, 0, 746 _bcmFieldSliceSelDisable, 0, 66, 1); 747 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit, 748 _bcmFieldSliceSelFpf2, 0, 749 _bcmFieldSliceSelDisable, 0, 67, 1); 750 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove, 751 _bcmFieldSliceSelFpf2, 0, 752 _bcmFieldSliceSelDisable, 0, 68, 1); 753 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDosAttack, 754 _bcmFieldSliceSelFpf2, 0, 755 _bcmFieldSliceSelDisable, 0, 69, 1); 756 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck, 757 _bcmFieldSliceSelFpf2, 0, 758 _bcmFieldSliceSelDisable, 0, 70, 24); 759 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31, 760 _bcmFieldSliceSelFpf2, 0, 761 _bcmFieldSliceIntfClassSelect, 3, 94, 8); 762 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 763 _bcmFieldSliceSelFpf2, 0, 764 _bcmFieldSliceIntfClassSelect, 0, 94, 8); 765 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 766 _bcmFieldSliceSelFpf2, 0, 767 _bcmFieldSliceIntfClassSelect, 1, 94, 8); 768 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2, 769 _bcmFieldSliceSelFpf2, 0, 770 _bcmFieldSliceIntfClassSelect, 2, 94, 8); 771 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 772 _bcmFieldSliceSelFpf2, 0, 773 _bcmFieldSliceSelDisable, 0, 102, 32); 774 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 775 _bcmFieldSliceSelFpf2, 0, 776 _bcmFieldSliceSelDisable, 0, 134, 32); 777 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 778 _bcmFieldSliceSelFpf2, 1, 779 _bcmFieldSliceSelDisable, 0, 38, 128); 780 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1, 781 _bcmFieldSliceSelFpf2, 2, 782 _bcmFieldSliceSelDisable, 0, 38, 128); 783 /* DWF1 */ 784 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl, 785 _bcmFieldSliceSelDisable, 0, 786 _bcmFieldSliceTtlClassSelect, 0, 166, 7); 787 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero, 788 _bcmFieldSliceSelDisable, 0, 789 _bcmFieldSliceTtlClassSelect, 0, 166, 7); 790 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne, 791 _bcmFieldSliceSelDisable, 0, 792 _bcmFieldSliceTtlClassSelect, 1, 166, 7); 793 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 794 _bcmFieldSliceSelDisable, 0, 795 _bcmFieldSliceSelDisable, 0, 173, 2); 796 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 797 _bcmFieldSliceSelDisable, 0, 798 _bcmFieldSliceSelDisable, 0, 175, 16); 799 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 800 _bcmFieldSliceSelDisable, 0, 801 _bcmFieldSliceSelDisable, 0, 191, 16); 802 /* DONE DWF */ 803 return (BCM_E_NONE); 804 } 805 806 807 /* 808 * Function: 809 * _field_sc_lookup_qualifiers_init 810 * Purpose: 811 * Initialize device stage lookup qaualifiers 812 * select codes & offsets 813 * Parameters: 814 * unit - (IN) BCM device number. 815 * stage_fc - (IN) Field Processor stage control structure. 816 * 817 * Returns: 818 * BCM_E_NONE 819 */ 820 STATIC int 821 _field_sc_lookup_qualifiers_init(int unit, _field_stage_t *stage_fc) 822 { 823 _FP_QUAL_DECL; 824 825 /* Input parameters check. */ 826 if (NULL == stage_fc) { 827 return (BCM_E_PARAM); 828 } 829 830 /* Enable the overlay of Sender Ethernet Address onto MACSA 831 * on ARP/RARP packets. 832 */ 833 BCM_IF_ERROR_RETURN 834 (soc_reg_field32_modify(unit, ING_CONFIG_64r, REG_PORT_ANY, 835 ARP_VALIDATION_ENf, 1)); 836 837 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageLookup, 838 _bcmFieldSliceSelDisable, 0, 0, 0); 839 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 840 _bcmFieldSliceSelDisable, 0, 0, 0); 841 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 842 _bcmFieldSliceSelDisable, 0, 0, 0); 843 844 /* FPF3 */ 845 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 846 _bcmFieldSliceSelFpf3, 0, 0, 16); 847 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 848 _bcmFieldSliceSelFpf3, 0, 0, 12); 849 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 850 _bcmFieldSliceSelFpf3, 0, 12, 1); 851 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 852 _bcmFieldSliceSelFpf3, 0, 13, 3); 853 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 854 _bcmFieldSliceSelFpf3, 0, 16, 16); 855 856 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort, 857 _bcmFieldSliceSelFpf3, 1, 858 _bcmFieldSliceIpHeaderSelect, 1, 0, 16); 859 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 860 _bcmFieldSliceSelFpf3, 1, 861 _bcmFieldSliceIpHeaderSelect, 0, 0, 16); 862 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort, 863 _bcmFieldSliceSelFpf3, 1, 864 _bcmFieldSliceIpHeaderSelect, 1, 16, 16); 865 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 866 _bcmFieldSliceSelFpf3, 1, 867 _bcmFieldSliceIpHeaderSelect, 0, 16, 16); 868 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 869 bcmFieldQualifyInnerTos, 870 _bcmFieldSliceSelFpf3, 2, 871 _bcmFieldSliceIpHeaderSelect, 1, 0, 8); 872 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 873 _bcmFieldSliceSelFpf3, 2, 874 _bcmFieldSliceIpHeaderSelect, 0, 0, 8); 875 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 876 bcmFieldQualifyInnerIpProtocol, 877 _bcmFieldSliceSelFpf3, 2, 878 _bcmFieldSliceIpHeaderSelect, 1, 8, 8); 879 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 880 _bcmFieldSliceSelFpf3, 2, 881 _bcmFieldSliceIpHeaderSelect, 0, 8, 8); 882 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIp6NextHeader, 883 _bcmFieldSliceSelFpf3, 2, 884 _bcmFieldSliceIpHeaderSelect, 0, 8, 8); 885 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 886 _bcmFieldSliceSelFpf3, 2, 16, 8); 887 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 888 _bcmFieldSliceSelFpf3, 2, 24, 8); 889 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 890 _bcmFieldSliceSelFpf3, 3, 0, 8); 891 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan, 892 _bcmFieldSliceSelFpf3, 3, 8, 16); 893 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 894 _bcmFieldSliceSelFpf3, 3, 8, 12); 895 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 896 _bcmFieldSliceSelFpf3, 3, 20, 1); 897 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 898 _bcmFieldSliceSelFpf3, 3, 21, 3); 899 900 /* FPF2 */ 901 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 902 bcmFieldQualifyInnerTtl, 903 _bcmFieldSliceSelFpf2, 0, 904 _bcmFieldSliceIpHeaderSelect, 1, 32, 8); 905 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 906 _bcmFieldSliceSelFpf2, 0, 907 _bcmFieldSliceIpHeaderSelect, 0, 32, 8); 908 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 909 _bcmFieldSliceSelFpf2, 0, 40, 6); 910 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 911 bcmFieldQualifyInnerIpFrag, 912 _bcmFieldSliceSelFpf2, 0, 913 _bcmFieldSliceIpHeaderSelect, 1, 46, 2); 914 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 915 _bcmFieldSliceSelFpf2, 0, 916 _bcmFieldSliceIpHeaderSelect, 0, 46, 2); 917 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 918 bcmFieldQualifyInnerTos, 919 _bcmFieldSliceSelFpf2, 0, 920 _bcmFieldSliceIpHeaderSelect, 1, 48, 8); 921 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 922 _bcmFieldSliceSelFpf2, 0, 923 _bcmFieldSliceIpHeaderSelect, 0, 48, 8); 924 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort, 925 _bcmFieldSliceSelFpf2, 0, 926 _bcmFieldSliceIpHeaderSelect, 1, 56, 16); 927 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 928 _bcmFieldSliceSelFpf2, 0, 929 _bcmFieldSliceIpHeaderSelect, 0, 56, 16); 930 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort, 931 _bcmFieldSliceSelFpf2, 0, 932 _bcmFieldSliceIpHeaderSelect, 1, 72, 16); 933 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 934 _bcmFieldSliceSelFpf2, 0, 935 _bcmFieldSliceIpHeaderSelect, 0, 72, 16); 936 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 937 bcmFieldQualifyInnerIpProtocol, 938 _bcmFieldSliceSelFpf2, 0, 939 _bcmFieldSliceIpHeaderSelect, 1, 88, 8); 940 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 941 _bcmFieldSliceSelFpf2, 0, 942 _bcmFieldSliceIpHeaderSelect, 0, 88, 8); 943 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 944 bcmFieldQualifyInnerDstIp, 945 _bcmFieldSliceSelFpf2, 0, 946 _bcmFieldSliceIpHeaderSelect, 1, 96, 32); 947 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 948 _bcmFieldSliceSelFpf2, 0, 949 _bcmFieldSliceIpHeaderSelect, 0, 96, 32); 950 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 951 bcmFieldQualifyInnerSrcIp, 952 _bcmFieldSliceSelFpf2, 0, 953 _bcmFieldSliceIpHeaderSelect, 1, 128, 32); 954 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 955 _bcmFieldSliceSelFpf2, 0, 956 _bcmFieldSliceIpHeaderSelect, 0, 128, 32); 957 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 958 bcmFieldQualifyInnerSrcIp6, 959 _bcmFieldSliceSelFpf2, 1, 960 _bcmFieldSliceIpHeaderSelect, 1, 32, 128); 961 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 962 _bcmFieldSliceSelFpf2, 1, 963 _bcmFieldSliceIpHeaderSelect, 0, 32, 128); 964 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 965 bcmFieldQualifyInnerDstIp6, 966 _bcmFieldSliceSelFpf2, 2, 967 _bcmFieldSliceIpHeaderSelect, 1, 32, 128); 968 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 969 _bcmFieldSliceSelFpf2, 2, 970 _bcmFieldSliceIpHeaderSelect, 0, 32, 128); 971 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 972 _bcmFieldSliceSelFpf2, 3, 48, 16); 973 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 974 _bcmFieldSliceSelFpf2, 3, 64, 48); 975 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 976 _bcmFieldSliceSelFpf2, 3, 112, 48); 977 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 978 bcmFieldQualifyInnerTos, 979 _bcmFieldSliceSelFpf2, 4, 980 _bcmFieldSliceIpHeaderSelect, 1, 32, 8); 981 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 982 _bcmFieldSliceSelFpf2, 4, 983 _bcmFieldSliceIpHeaderSelect, 0, 32, 8); 984 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 985 bcmFieldQualifyInnerIpProtocol, 986 _bcmFieldSliceSelFpf2, 4, 987 _bcmFieldSliceIpHeaderSelect, 1, 40, 8); 988 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 989 _bcmFieldSliceSelFpf2, 4, 990 _bcmFieldSliceIpHeaderSelect, 0, 40, 8); 991 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 992 bcmFieldQualifyInnerDstIp, 993 _bcmFieldSliceSelFpf2, 4, 994 _bcmFieldSliceIpHeaderSelect, 1, 48, 32); 995 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 996 _bcmFieldSliceSelFpf2, 4, 997 _bcmFieldSliceIpHeaderSelect, 0, 48, 32); 998 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 999 bcmFieldQualifyInnerSrcIp, 1000 _bcmFieldSliceSelFpf2, 4, 1001 _bcmFieldSliceIpHeaderSelect, 1, 80, 32); 1002 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 1003 _bcmFieldSliceSelFpf2, 4, 1004 _bcmFieldSliceIpHeaderSelect, 0, 80, 32); 1005 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 1006 _bcmFieldSliceSelFpf2, 4, 112, 48); 1007 1008 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 1009 bcmFieldQualifyInnerTos, 1010 _bcmFieldSliceSelFpf2, 5, 1011 _bcmFieldSliceIpHeaderSelect, 1, 32, 8); 1012 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos, 1013 _bcmFieldSliceSelFpf2, 5, 1014 _bcmFieldSliceIpHeaderSelect, 0, 32, 8); 1015 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 1016 bcmFieldQualifyInnerIpProtocol, 1017 _bcmFieldSliceSelFpf2, 5, 1018 _bcmFieldSliceIpHeaderSelect, 1, 40, 8); 1019 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1020 _bcmFieldSliceSelFpf2, 5, 1021 _bcmFieldSliceIpHeaderSelect, 0, 40, 8); 1022 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 1023 bcmFieldQualifyInnerDstIp, 1024 _bcmFieldSliceSelFpf2, 5, 1025 _bcmFieldSliceIpHeaderSelect, 1, 48, 32); 1026 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 1027 _bcmFieldSliceSelFpf2, 5, 1028 _bcmFieldSliceIpHeaderSelect, 0, 48, 32); 1029 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 1030 bcmFieldQualifyInnerSrcIp, 1031 _bcmFieldSliceSelFpf2, 5, 1032 _bcmFieldSliceIpHeaderSelect, 1, 80, 32); 1033 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 1034 _bcmFieldSliceSelFpf2, 5, 1035 _bcmFieldSliceIpHeaderSelect, 0, 80, 32); 1036 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 1037 _bcmFieldSliceSelFpf2, 5, 112, 48); 1038 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 1039 bcmFieldQualifyInnerSrcIp6High, 1040 _bcmFieldSliceSelFpf2, 6, 1041 _bcmFieldSliceIpHeaderSelect, 1, 32, 64); 1042 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High, 1043 _bcmFieldSliceSelFpf2, 6, 1044 _bcmFieldSliceIpHeaderSelect, 0, 32, 64); 1045 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 1046 bcmFieldQualifyInnerDstIp6High, 1047 _bcmFieldSliceSelFpf2, 6, 1048 _bcmFieldSliceIpHeaderSelect, 1, 96, 64); 1049 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High, 1050 _bcmFieldSliceSelFpf2, 6, 1051 _bcmFieldSliceIpHeaderSelect, 0, 96, 64); 1052 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySnap, 1053 _bcmFieldSliceSelFpf2, 7, 96, 40); 1054 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyLlc, 1055 _bcmFieldSliceSelFpf2, 7, 136, 24); 1056 1057 /* FPF1 */ 1058 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 1059 bcmFieldQualifyInnerIpProtocolCommon, 1060 _bcmFieldSliceSelFpf1, 0, 1061 _bcmFieldSliceIpHeaderSelect, 1, 160, 3); 1062 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocolCommon, 1063 _bcmFieldSliceSelFpf1, 0, 1064 _bcmFieldSliceIpHeaderSelect, 0, 160, 3); 1065 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated, 1066 _bcmFieldSliceSelFpf1, 0, 163, 1); 1067 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid, 1068 _bcmFieldSliceSelFpf1, 0, 165, 2); 1069 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid, 1070 _bcmFieldSliceSelFpf1, 0, 167, 2); 1071 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 1072 _bcmFieldSliceSelFpf1, 0, 169, 2); 1073 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 1074 _bcmFieldSliceSelFpf1, 0, 171, 1); 1075 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 1076 _bcmFieldSliceSelFpf1, 0, 172, 1); 1077 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1078 _bcmFieldSliceSelFpf1, 0, 173, 16); 1079 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1080 _bcmFieldSliceSelFpf1, 0, 173, 12); 1081 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1082 _bcmFieldSliceSelFpf1, 0, 185, 1); 1083 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1084 _bcmFieldSliceSelFpf1, 0, 186, 3); 1085 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 1086 _bcmFieldSliceSelFpf1, 0, 189, 2); 1087 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 1088 _bcmFieldSliceSelFpf1, 0, 191, 6); 1089 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 1090 _bcmFieldSliceSelFpf1, 0, 197, 8); 1091 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 1092 bcmFieldQualifyInnerIpType, 1093 _bcmFieldSliceSelFpf1, 0, 1094 _bcmFieldSliceIpHeaderSelect, 1, 205, 4); 1095 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 1096 _bcmFieldSliceSelFpf1, 0, 1097 _bcmFieldSliceIpHeaderSelect, 0, 205, 4); 1098 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 1099 _bcmFieldSliceSelFpf1, 0, 209, 1); 1100 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo, 1101 _bcmFieldSliceSelFpf1, 0, 4, 1); 1102 1103 /* DWF3 */ 1104 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos, 1105 _bcmFieldSliceSelFpf3, 0, 1106 _bcmFieldSliceIpHeaderSelect, 1, 0, 8); 1107 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos, 1108 _bcmFieldSliceSelFpf3, 0, 1109 _bcmFieldSliceIpHeaderSelect, 0, 0, 8); 1110 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl, 1111 _bcmFieldSliceSelFpf3, 0, 1112 _bcmFieldSliceIpHeaderSelect, 1, 8, 8); 1113 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1114 _bcmFieldSliceSelFpf3, 0, 1115 _bcmFieldSliceIpHeaderSelect, 0, 8, 8); 1116 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 1117 _bcmFieldSliceSelFpf3, 0, 1118 _bcmFieldSliceIpHeaderSelect, 0, 16, 6); 1119 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag, 1120 _bcmFieldSliceSelFpf3, 0, 1121 _bcmFieldSliceIpHeaderSelect, 1, 22, 2); 1122 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 1123 _bcmFieldSliceSelFpf3, 0, 1124 _bcmFieldSliceIpHeaderSelect, 0, 22, 2); 1125 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1126 _bcmFieldSliceSelFpf3, 0, 1127 _bcmFieldSliceIpHeaderSelect, 0, 24, 8); 1128 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol, 1129 _bcmFieldSliceSelFpf3, 0, 1130 _bcmFieldSliceIpHeaderSelect, 1, 24, 8); 1131 /* DWF2 */ 1132 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl, 1133 _bcmFieldSliceSelFpf2, 0, 1134 _bcmFieldSliceIpHeaderSelect, 1, 32, 8); 1135 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1136 _bcmFieldSliceSelFpf2, 0, 1137 _bcmFieldSliceIpHeaderSelect, 0, 32, 8); 1138 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 1139 _bcmFieldSliceSelFpf2, 0, 1140 _bcmFieldSliceIpHeaderSelect, 0, 40, 6); 1141 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag, 1142 _bcmFieldSliceSelFpf2, 0, 1143 _bcmFieldSliceIpHeaderSelect, 1, 46, 2); 1144 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 1145 _bcmFieldSliceSelFpf2, 0, 1146 _bcmFieldSliceIpHeaderSelect, 0, 46, 2); 1147 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos, 1148 _bcmFieldSliceSelFpf2, 0, 1149 _bcmFieldSliceIpHeaderSelect, 1, 48, 8); 1150 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos, 1151 _bcmFieldSliceSelFpf2, 0, 1152 _bcmFieldSliceIpHeaderSelect, 0, 48, 8); 1153 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort, 1154 _bcmFieldSliceSelFpf2, 0, 1155 _bcmFieldSliceIpHeaderSelect, 1, 56, 16); 1156 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 1157 _bcmFieldSliceSelFpf2, 0, 1158 _bcmFieldSliceIpHeaderSelect, 0, 56, 16); 1159 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort, 1160 _bcmFieldSliceSelFpf2, 0, 1161 _bcmFieldSliceIpHeaderSelect, 1, 72, 16); 1162 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 1163 _bcmFieldSliceSelFpf2, 0, 1164 _bcmFieldSliceIpHeaderSelect, 0, 72, 16); 1165 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol, 1166 _bcmFieldSliceSelFpf2, 0, 1167 _bcmFieldSliceIpHeaderSelect, 1, 88, 8); 1168 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1169 _bcmFieldSliceSelFpf2, 0, 1170 _bcmFieldSliceIpHeaderSelect, 0, 88, 8); 1171 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp, 1172 _bcmFieldSliceSelFpf2, 0, 1173 _bcmFieldSliceIpHeaderSelect, 1, 96, 32); 1174 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 1175 _bcmFieldSliceSelFpf2, 0, 1176 _bcmFieldSliceIpHeaderSelect, 0, 96, 32); 1177 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp, 1178 _bcmFieldSliceSelFpf2, 0, 1179 _bcmFieldSliceIpHeaderSelect, 1, 128, 32); 1180 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 1181 _bcmFieldSliceSelFpf2, 0, 1182 _bcmFieldSliceIpHeaderSelect, 0, 128, 32); 1183 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6, 1184 _bcmFieldSliceSelFpf2, 1, 1185 _bcmFieldSliceIpHeaderSelect, 1, 32, 128); 1186 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 1187 _bcmFieldSliceSelFpf2, 1, 1188 _bcmFieldSliceIpHeaderSelect, 0, 32, 128); 1189 1190 /* FPF1 */ 1191 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 1192 _bcmFieldSliceSelFpf1, 0, 1193 _bcmFieldSliceIpHeaderSelect, 0, 160, 8); 1194 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 1195 _bcmFieldSliceSelFpf1, 0, 1196 _bcmFieldSliceIpHeaderSelect, 0, 168, 8); 1197 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3, 1198 _bcmFieldSliceSelFpf1, 0, 1199 _bcmFieldSliceIpHeaderSelect, 0, 176, 8); 1200 _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 1201 _bcmFieldSliceSelFpf1, 0, 1202 _bcmFieldSliceIpHeaderSelect, 0, 184, 16); 1203 return (BCM_E_NONE); 1204 } 1205 1206 1207 STATIC int 1208 _field_sc_egress_qualifiers_init(int unit, _field_stage_t *stage_fc) 1209 { 1210 _FP_QUAL_DECL; 1211 _key_fld_ = KEYf; 1212 1213 /* Input parameters check. */ 1214 if (NULL == stage_fc) { 1215 return (BCM_E_PARAM); 1216 } 1217 1218 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageEgress, 1219 _bcmFieldSliceSelDisable, 0, 0, 0); 1220 1221 1222 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 1223 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 0, 1); 1224 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format, 1225 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 21, 2); 1226 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType, 1227 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 23, 16); 1228 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac, 1229 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 39, 48); 1230 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac, 1231 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 87, 48); 1232 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit, 1233 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 141, 1); 1234 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 1235 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 142, 1); 1236 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 1237 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 143, 1); 1238 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi, 1239 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 144, 1); 1240 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri, 1241 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 145, 3); 1242 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 1243 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 148, 12); 1244 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 1245 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 161, 6); 1246 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 1247 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 167, 1); 1248 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 1249 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 168, 1); 1250 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1251 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 169, 16); 1252 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1253 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 169, 12); 1254 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1255 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 181, 1); 1256 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1257 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 182, 3); 1258 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 1259 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 185, 2); 1260 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig, 1261 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 187, 1); 1262 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 1263 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 188, 8); 1264 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort, 1265 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 196, 6); 1266 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 1267 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 202, 4); 1268 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 1269 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 206, 1); 1270 1271 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 1272 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 1); 1273 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 1274 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 10, 2); 1275 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 1276 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 12, 6); 1277 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 1278 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 18, 16); 1279 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 1280 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 34, 16); 1281 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1282 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 50, 8); 1283 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1284 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 58, 8); 1285 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp, 1286 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 66, 32); 1287 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp, 1288 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 98, 32); 1289 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 1290 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 130, 8); 1291 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 1292 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 138, 1); 1293 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 1294 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 139, 1); 1295 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 1296 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 148, 12); 1297 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 1298 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 161, 6); 1299 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 1300 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 167, 1); 1301 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 1302 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 168, 1); 1303 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1304 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 169, 16); 1305 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1306 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 169, 12); 1307 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1308 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 181, 1); 1309 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1310 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 182, 3); 1311 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 1312 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 185, 2); 1313 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig, 1314 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 187, 1); 1315 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 1316 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 188, 8); 1317 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort, 1318 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 196, 6); 1319 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 1320 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 202, 4); 1321 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 1322 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 206, 1); 1323 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4, 1324 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 0); 1325 1326 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 1327 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 0, 1); 1328 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 1329 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 12, 6); 1330 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 1331 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 18, 16); 1332 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 1333 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 34, 16); 1334 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1335 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 50, 8); 1336 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1337 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 58, 8); 1338 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 1339 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 130, 8); 1340 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 1341 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 138, 1); 1342 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 1343 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 139, 1); 1344 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 1345 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 148, 12); 1346 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 1347 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 161, 6); 1348 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 1349 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 167, 1); 1350 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 1351 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 168, 1); 1352 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1353 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 169, 16); 1354 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1355 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 169, 12); 1356 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1357 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 181, 1); 1358 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1359 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 182, 3); 1360 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 1361 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 185, 2); 1362 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig, 1363 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 187, 1); 1364 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 1365 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 188, 8); 1366 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort, 1367 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 196, 6); 1368 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 1369 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 202, 4); 1370 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 1371 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 206, 1); 1372 1373 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 1374 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 1); 1375 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol, 1376 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 2, 8); 1377 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6, 1378 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 1379 _bcmFieldSliceIp6AddrSelect, 1380 _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP6, 1381 10, 128); 1382 _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 1383 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 1384 _bcmFieldSliceIp6AddrSelect, 1385 _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_DIP6, 1386 10, 128); 1387 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos, 1388 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 138, 8); 1389 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy, 1390 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 146, 1); 1391 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig, 1392 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 147, 1); 1393 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId, 1394 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 148, 12); 1395 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort, 1396 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 161, 6); 1397 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable, 1398 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 167, 1); 1399 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy, 1400 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 168, 1); 1401 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan, 1402 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 169, 16); 1403 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId, 1404 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 169, 12); 1405 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi, 1406 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 181, 1); 1407 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri, 1408 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 182, 3); 1409 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat, 1410 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 185, 2); 1411 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig, 1412 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 187, 1); 1413 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort, 1414 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 188, 8); 1415 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort, 1416 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 196, 6); 1417 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 1418 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 202, 4); 1419 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 1420 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 206, 1); 1421 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 1422 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 0); 1423 1424 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 1425 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 1); 1426 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag, 1427 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 10, 2); 1428 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl, 1429 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 12, 6); 1430 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort, 1431 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 18, 16); 1432 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort, 1433 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 34, 16); 1434 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl, 1435 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 50, 8); 1436 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6, 1437 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 58, 128); 1438 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode, 1439 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 186, 8); 1440 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType, 1441 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 194, 8); 1442 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType, 1443 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 202, 4); 1444 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop, 1445 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 206, 1); 1446 _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6, 1447 _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 0); 1448 1449 return (BCM_E_NONE); 1450 } 1451 1452 /* 1453 * Function: 1454 * _field_sc_qualifiers_init 1455 * Purpose: 1456 * Initialize device qaualifiers select codes & offsets 1457 * Parameters: 1458 * unit - (IN) BCM device number. 1459 * stage_fc - (IN) Field Processor stage control structure. 1460 * 1461 * Returns: 1462 * BCM_E_NONE 1463 * Notes: 1464 */ 1465 STATIC int 1466 _field_sc_qualifiers_init(int unit, _field_stage_t *stage_fc) 1467 { 1468 int rv; /* Operation return status. */ 1469 1470 /* Input parameters check. */ 1471 if (NULL == stage_fc) { 1472 return (BCM_E_PARAM); 1473 } 1474 1475 /* Allocated stage qualifiers configuration array. */ 1476 _FP_XGS3_ALLOC(stage_fc->f_qual_arr, 1477 (_bcmFieldQualifyCount * sizeof(_bcm_field_qual_info_t *)), 1478 "Field qualifiers"); 1479 if (NULL == stage_fc->f_qual_arr) { 1480 return (BCM_E_MEMORY); 1481 } 1482 1483 switch (stage_fc->stage_id) { 1484 case _BCM_FIELD_STAGE_INGRESS: 1485 rv = _field_sc_ingress_qualifiers_init(unit, stage_fc); 1486 break; 1487 case _BCM_FIELD_STAGE_LOOKUP: 1488 rv = _field_sc_lookup_qualifiers_init(unit, stage_fc); 1489 break; 1490 case _BCM_FIELD_STAGE_EGRESS: 1491 rv = _field_sc_egress_qualifiers_init(unit, stage_fc); 1492 break; 1493 default: 1494 sal_free(stage_fc->f_qual_arr); 1495 return (BCM_E_PARAM); 1496 } 1497 return (rv); 1498 } 1499 1500 /* 1501 * Function: 1502 * _bcm_field_sc_init 1503 * Purpose: 1504 * Perform initializations that are specific to BCM5682x. This 1505 * includes initializing the FP field select bit offset tables for FPF[1-3] 1506 * for every stage. 1507 * Parameters: 1508 * unit - (IN) BCM device number. 1509 * fc - (IN) Field Processor control structure. 1510 * 1511 * Returns: 1512 * BCM_E_NONE 1513 * Notes: 1514 */ 1515 int 1516 _bcm_field_sc_init(int unit, _field_control_t *fc) 1517 { 1518 _field_stage_t *stage_p; /* Stages iteration pointer */ 1519 1520 /* Input parameters check. */ 1521 if (NULL == fc) { 1522 return (BCM_E_PARAM); 1523 } 1524 1525 stage_p = fc->stages; 1526 while (stage_p) { 1527 /* Clear hardware table */ 1528 BCM_IF_ERROR_RETURN(_field_sc_hw_clear(unit, stage_p)); 1529 1530 /* Initialize qualifiers info. */ 1531 BCM_IF_ERROR_RETURN(_field_sc_qualifiers_init(unit, stage_p)); 1532 1533 /* Goto next stage */ 1534 stage_p = stage_p->next; 1535 } 1536 1537 /* Initialize the TOS_FN, TTL_FN, TCP_FN tables */ 1538 BCM_IF_ERROR_RETURN(_bcm_field_trx_tcp_ttl_tos_init(unit)); 1539 1540 if (!SOC_WARM_BOOT(unit)) { 1541 /* Enable filter processor */ 1542 BCM_IF_ERROR_RETURN(_field_port_filter_enable_set(unit, fc, TRUE)); 1543 1544 /* Enable meter refresh */ 1545 BCM_IF_ERROR_RETURN(_field_meter_refresh_enable_set(unit, fc, TRUE)); 1546 } 1547 1548 /* Initialize the function pointers */ 1549 _field_sc_functions_init(&fc->functions); 1550 1551 return (BCM_E_NONE); 1552 } 1553 1554 /* 1555 * Function: 1556 * _field_sc_hw_clear 1557 * Purpose: 1558 * Clear hardware memory of requested stage. 1559 * Parameters: 1560 * unit - (IN) BCM device number. 1561 * stage_fc - (IN) Field Processor stage control structure. 1562 * 1563 * Returns: 1564 * BCM_E_NONE 1565 * Notes: 1566 */ 1567 STATIC int 1568 _field_sc_hw_clear(int unit, _field_stage_t *stage_fc) 1569 { 1570 if (SOC_WARM_BOOT(unit)) { 1571 return (BCM_E_NONE); 1572 } 1573 1574 switch (stage_fc->stage_id) { 1575 case _BCM_FIELD_STAGE_INGRESS: 1576 BCM_IF_ERROR_RETURN 1577 (soc_mem_clear(unit, FP_TCAM_Xm, COPYNO_ALL, TRUE)); 1578 BCM_IF_ERROR_RETURN 1579 (soc_mem_clear(unit, FP_TCAM_Ym, COPYNO_ALL, TRUE)); 1580 BCM_IF_ERROR_RETURN 1581 (soc_mem_clear(unit, FP_RANGE_CHECKm, COPYNO_ALL, TRUE)); 1582 BCM_IF_ERROR_RETURN 1583 (soc_mem_clear(unit, FP_PORT_FIELD_SELm, COPYNO_ALL, TRUE)); 1584 BCM_IF_ERROR_RETURN 1585 (soc_mem_clear(unit, FP_POLICY_TABLEm, COPYNO_ALL, TRUE)); 1586 BCM_IF_ERROR_RETURN 1587 (soc_mem_clear(unit, FP_SLICE_MAPm, COPYNO_ALL, TRUE)); 1588 BCM_IF_ERROR_RETURN 1589 (soc_mem_clear(unit, FP_METER_TABLEm, COPYNO_ALL, TRUE)); 1590 BCM_IF_ERROR_RETURN 1591 (soc_mem_clear(unit, FP_COUNTER_TABLE_Xm, COPYNO_ALL, TRUE)); 1592 BCM_IF_ERROR_RETURN 1593 (soc_mem_clear(unit, FP_COUNTER_TABLE_Ym, COPYNO_ALL, TRUE)); 1594 BCM_IF_ERROR_RETURN 1595 (soc_mem_clear(unit, FP_UDF_OFFSETm, COPYNO_ALL, TRUE)); 1596 BCM_IF_ERROR_RETURN 1597 (soc_mem_clear(unit, FP_SLICE_KEY_CONTROLm, COPYNO_ALL, TRUE)); 1598 break; 1599 1600 case _BCM_FIELD_STAGE_LOOKUP: 1601 BCM_IF_ERROR_RETURN 1602 (soc_mem_clear((unit), VFP_TCAMm, COPYNO_ALL, TRUE)); 1603 BCM_IF_ERROR_RETURN 1604 (soc_mem_clear((unit), VFP_POLICY_TABLEm, COPYNO_ALL, TRUE)); 1605 break; 1606 1607 case _BCM_FIELD_STAGE_EGRESS: 1608 BCM_IF_ERROR_RETURN 1609 (soc_mem_clear((unit), EFP_TCAMm, COPYNO_ALL, TRUE)); 1610 BCM_IF_ERROR_RETURN 1611 (soc_mem_clear((unit), EFP_POLICY_TABLEm, COPYNO_ALL, TRUE)); 1612 BCM_IF_ERROR_RETURN 1613 (soc_mem_clear((unit), EFP_METER_TABLEm, COPYNO_ALL, TRUE)); 1614 BCM_IF_ERROR_RETURN 1615 (soc_mem_clear((unit), EFP_COUNTER_TABLEm, COPYNO_ALL, TRUE)); 1616 break; 1617 default: 1618 return (BCM_E_PARAM); 1619 1620 } /* end switch */ 1621 1622 return (BCM_E_NONE); 1623 } 1624 1625 /* 1626 * Function: 1627 * _field_sc_detach 1628 * 1629 * Purpose: 1630 * Deallocates BCM56624 field tables. 1631 * 1632 * Parameters: 1633 * unit - BCM device number 1634 * 1635 * Returns: 1636 * BCM_E_NONE 1637 */ 1638 STATIC int 1639 _field_sc_detach(int unit, _field_control_t *fc) 1640 { 1641 _field_stage_t *stage_p; /* Stage iteration pointer. */ 1642 1643 stage_p = fc->stages; 1644 1645 while (stage_p) { 1646 /* Clear the hardware tables */ 1647 BCM_IF_ERROR_RETURN(_field_sc_hw_clear(unit, stage_p)); 1648 1649 /* Goto next stage */ 1650 stage_p = stage_p->next; 1651 } 1652 1653 /* Clear udf match criteria registers. */ 1654 BCM_IF_ERROR_RETURN(_bcm_field_fb_udf_ipprotocol_delete_all(unit)); 1655 BCM_IF_ERROR_RETURN(_bcm_field_fb_udf_ethertype_delete_all(unit)); 1656 1657 /* Don't disable port controls during Warmboot or Reloading state */ 1658 if (0 == SOC_HW_ACCESS_DISABLE(unit)) { 1659 /* Clear the Filter Enable flags in the port table */ 1660 BCM_IF_ERROR_RETURN (_field_port_filter_enable_set(unit, fc, FALSE)); 1661 } 1662 1663 BCM_IF_ERROR_RETURN (_field_meter_refresh_enable_set(unit, fc, FALSE)); 1664 1665 return (BCM_E_NONE); 1666 } 1667 1668 /* 1669 * Function: 1670 * _field_sc_write_slice_map_ingress 1671 * 1672 * Purpose: 1673 * Write the FP_SLICE_MAP (INGRESS) 1674 * 1675 * Parameters: 1676 * unit 1677 * stage_fc - pointer to stage control block 1678 * 1679 * Returns: 1680 * nothing 1681 * 1682 * Notes: 1683 */ 1684 STATIC int 1685 _field_sc_write_slice_map_ingress(int unit, _field_stage_t *stage_fc) 1686 { 1687 fp_slice_map_entry_t map_entry; /* HW entry buffer. */ 1688 soc_field_t field; /* HW entry fields. */ 1689 int vmap_size; /* Virtual map index count. */ 1690 uint32 value; /* Field entry value. */ 1691 int idx; /* Map fields iterator. */ 1692 int rv; /* Operation return status. */ 1693 1694 uint32 virtual_to_physical_map_sc[] = { 1695 VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBERf, 1696 VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBERf, 1697 VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBERf, 1698 VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBERf, 1699 VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBERf, 1700 VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBERf, 1701 VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBERf, 1702 VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBERf, 1703 VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBERf, 1704 VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBERf, 1705 VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBERf, 1706 VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBERf 1707 }; 1708 uint32 virtual_to_group_map_sc[] = { 1709 VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUPf, 1710 VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUPf, 1711 VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUPf, 1712 VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUPf, 1713 VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUPf, 1714 VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUPf, 1715 VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUPf, 1716 VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUPf, 1717 VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUPf, 1718 VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUPf, 1719 VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUPf, 1720 VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUPf 1721 }; 1722 1723 /* Calculate virtual map size. */ 1724 rv = _bcm_field_virtual_map_size_get(unit, stage_fc, &vmap_size); 1725 BCM_IF_ERROR_RETURN(rv); 1726 1727 rv = READ_FP_SLICE_MAPm(unit, MEM_BLOCK_ANY, 0, &map_entry); 1728 BCM_IF_ERROR_RETURN(rv); 1729 1730 for (idx = 0; idx < vmap_size; idx++) { 1731 value = stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][idx].vmap_key; 1732 field = virtual_to_physical_map_sc[idx]; 1733 soc_FP_SLICE_MAPm_field32_set(unit, &map_entry, field, value); 1734 1735 value = stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][idx].virtual_group; 1736 field = virtual_to_group_map_sc[idx]; 1737 soc_FP_SLICE_MAPm_field32_set(unit, &map_entry, field, value); 1738 } 1739 rv = WRITE_FP_SLICE_MAPm(unit, MEM_BLOCK_ALL, 0, &map_entry); 1740 return (rv); 1741 } 1742 1743 1744 /* 1745 * Function: 1746 * _field_sc_write_slice_map 1747 * 1748 * Purpose: 1749 * Write the FP_SLICE_MAP 1750 * 1751 * Parameters: 1752 * unit 1753 * stage_fc - pointer to stage control block 1754 * fg - reference to field group structure. 1755 * 1756 * Returns: 1757 * nothing 1758 * 1759 * Notes: 1760 */ 1761 STATIC int 1762 _field_sc_write_slice_map(int unit, _field_stage_t *stage_fc, 1763 _field_group_t *fg) 1764 { 1765 int rv = BCM_E_PARAM; /* Operation return status. */ 1766 1767 if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) { 1768 rv = _field_sc_write_slice_map_ingress(unit, stage_fc); 1769 } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) { 1770 rv = _bcm_field_trx_write_slice_map_egress(unit, stage_fc); 1771 } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP) { 1772 rv = _bcm_field_trx_write_slice_map_vfp(unit, stage_fc); 1773 } 1774 return (rv); 1775 } 1776 1777 /* 1778 * Function: 1779 * _field_sc_default_policer_set 1780 * 1781 * Purpose: 1782 * Set metering portion of Policy Table. 1783 * 1784 * Parameters: 1785 * unit - (IN)BCM device number. 1786 * stage_fc - (IN)Stage control structure. 1787 * level - (IN)Policer level. 1788 * mem - (IN)Policy table memory. 1789 * buf - (IN/OUT)Hardware policy entry 1790 * 1791 * Returns: 1792 * BCM_E_NONE - Success 1793 */ 1794 STATIC int 1795 _field_sc_default_policer_set(int unit, _field_stage_t *stage_fc, 1796 soc_mem_t mem, uint32 *buf) 1797 { 1798 /* Input parameter check. */ 1799 if ((NULL == stage_fc) || (NULL == buf)) { 1800 return (BCM_E_PARAM); 1801 } 1802 1803 if (_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id) { 1804 /* Set the meter mode to default. */ 1805 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODEf, 0); 1806 /* Preserve packet color. */ 1807 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODE_MODIFIERf, 1); 1808 } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) { 1809 /* Set the meter mode to default. */ 1810 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODEf, 0); 1811 /* Preserve packet color. */ 1812 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 1); 1813 } else { 1814 return BCM_E_PARAM; 1815 } 1816 return (BCM_E_NONE); 1817 } 1818 1819 /* 1820 * Function: 1821 * _bcm_field_sc_policer_action_set 1822 * 1823 * Purpose: 1824 * Get metering portion of Policy Table. 1825 * 1826 * Parameters: 1827 * unit - (IN)BCM device number. 1828 * f_ent - (IN)Software entry structure to get tcam info from. 1829 * mem - (IN)Policy table memory. 1830 * buf - (IN/OUT)Hardware policy entry 1831 * 1832 * Returns: 1833 * BCM_E_NONE - Success 1834 */ 1835 STATIC int 1836 _field_sc_policer_action_set(int unit, _field_entry_t *f_ent, 1837 soc_mem_t mem, uint32 *buf) 1838 { 1839 _field_entry_policer_t *f_ent_pl; /* Field entry policer descriptor.*/ 1840 _field_stage_t *stage_fc; /* Stage field control structure. */ 1841 bcm_field_stage_t stage_id; /* Stage that contains meter. */ 1842 _field_policer_t *f_pl; /* Field policer descriptor. */ 1843 uint32 meter_pair_mode;/* Hw meter usage bits. */ 1844 int meter_pair_idx; /* Meter pair index. */ 1845 int rv; /* Operation return status. */ 1846 1847 1848 /* Input parameter check. */ 1849 if ((NULL == f_ent) || (NULL == buf)) { 1850 return (BCM_E_PARAM); 1851 } 1852 if (NULL == f_ent->group) { 1853 return (BCM_E_PARAM); 1854 } 1855 1856 stage_id = f_ent->group->stage_id; 1857 meter_pair_idx = 0; 1858 1859 /* No policers at lookup stage. */ 1860 if (_BCM_FIELD_STAGE_LOOKUP == stage_id) { 1861 return (BCM_E_NONE); 1862 } 1863 1864 /* Get stage control structure. */ 1865 rv = _field_stage_control_get(unit, stage_id, &stage_fc); 1866 BCM_IF_ERROR_RETURN(rv); 1867 1868 f_ent_pl = f_ent->policer; 1869 1870 if (0 == (f_ent_pl->flags & _FP_POLICER_INSTALLED)) { 1871 /* Install preserve the color policer. */ 1872 rv = _field_sc_default_policer_set(unit, stage_fc, mem, buf); 1873 return (rv); 1874 } 1875 1876 /* Get policer config. */ 1877 rv = _bcm_field_policer_get(unit, f_ent_pl->pid, &f_pl); 1878 BCM_IF_ERROR_RETURN(rv); 1879 1880 /* Get hw encoding for meter mode. */ 1881 rv = _bcm_field_meter_pair_mode_get(unit, f_pl, &meter_pair_mode); 1882 BCM_IF_ERROR_RETURN(rv); 1883 1884 /* Get meter hw table index. */ 1885 if (_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id) { 1886 /* Pair index is (Pool number * Pairs in Pool + Pair number) */ 1887 meter_pair_idx = (f_pl->pool_index * 1888 stage_fc->meter_pool[_FP_DEF_INST][f_pl->pool_index]->num_meter_pairs) 1889 + f_pl->hw_index; 1890 } else if (_BCM_FIELD_STAGE_EGRESS == stage_fc->stage_id) { 1891 meter_pair_idx = f_pl->hw_index; 1892 } 1893 1894 /* Get the even and odd indexes from the entry. The even and odd 1895 * meter indices are the same. 1896 */ 1897 soc_mem_field32_set(unit, mem, buf, METER_INDEX_EVENf, meter_pair_idx); 1898 soc_mem_field32_set(unit, mem, buf, METER_INDEX_ODDf, meter_pair_idx); 1899 1900 /* Get the meter mode */ 1901 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODEf, meter_pair_mode); 1902 1903 /* 1904 * Flow mode is the only one that cares about the test and update bits. 1905 * Even = BCM_FIELD_METER_PEAK 1906 * Odd = BCM_FIELD_METER_COMMITTED 1907 */ 1908 if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 1909 soc_mem_field32_set(unit, mem, buf, METER_TEST_ODDf, 0); 1910 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 1); 1911 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_ODDf, 0); 1912 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_EVENf, 1); 1913 } else if (_FP_POLICER_COMMITTED_HW_METER(f_pl)) { 1914 soc_mem_field32_set(unit, mem, buf, METER_TEST_ODDf, 1); 1915 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 0); 1916 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_ODDf, 1); 1917 soc_mem_field32_set(unit, mem, buf, METER_UPDATE_EVENf, 0); 1918 } 1919 1920 if (_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id) { 1921 if (_FP_POLICER_COMMITTED_HW_METER(f_pl) 1922 || (f_pl->cfg.mode == bcmPolicerModePassThrough)) { 1923 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODE_MODIFIERf, 1); 1924 } else if (_FP_POLICER_EXCESS_HW_METER(f_pl)) { 1925 soc_mem_field32_set(unit, mem, buf, METER_PAIR_MODE_MODIFIERf, 0); 1926 } 1927 } else if ((_BCM_FIELD_STAGE_EGRESS == stage_fc->stage_id) 1928 && (f_pl->cfg.mode == bcmPolicerModePassThrough)) { 1929 soc_mem_field32_set(unit, mem, buf, METER_TEST_EVENf, 1); 1930 } 1931 1932 return (BCM_E_NONE); 1933 } 1934 1935 /* 1936 * Function: 1937 * _field_sc_entry_reinstall 1938 * Purpose: 1939 * Write policy table entry information into the chip's memory. 1940 * Parameters: 1941 * unit - BCM Unit 1942 * f_ent - Physical entry structure to be installed 1943 * tcam_idx - common index of various tables 1944 * Returns: 1945 * BCM_E_XXX On TCAM read/write errors 1946 * BCM_E_NONE 1947 * Note: 1948 * Unit lock should be held by calling function. 1949 */ 1950 STATIC int 1951 _field_sc_entry_reinstall(int unit, _field_entry_t *f_ent, int tcam_idx) 1952 { 1953 uint32 e[SOC_MAX_MEM_FIELD_WORDS]; /* Buffer to fill Policy & TCAM entry.*/ 1954 soc_mem_t tcam_mem; /* TCAM memory id. */ 1955 soc_mem_t policy_mem; /* Policy table memory id . */ 1956 _field_action_t *fa = NULL; 1957 1958 /* Input parameters check. */ 1959 if (NULL == f_ent) { 1960 return (BCM_E_PARAM); 1961 } 1962 1963 if (NULL == f_ent->fs) { 1964 return (BCM_E_PARAM); 1965 } 1966 1967 BCM_IF_ERROR_RETURN 1968 (_field_fb_tcam_policy_mem_get(unit, f_ent->fs->stage_id, 1969 &tcam_mem, &policy_mem)); 1970 1971 if ((tcam_idx < soc_mem_index_min(unit, tcam_mem)) || 1972 (tcam_idx > soc_mem_index_max(unit, tcam_mem))) { 1973 return (BCM_E_PARAM); 1974 } 1975 1976 /* Handle the actions (policy) */ 1977 /* Start with an empty POLICY entry */ 1978 sal_memset(e, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 1979 /* Extract the policy info from the entry structure. */ 1980 for (fa = f_ent->actions; ((fa != NULL) && (_FP_ACTION_VALID & fa->flags)); fa = fa->next) { 1981 BCM_IF_ERROR_RETURN( 1982 _bcm_field_trx_action_get(unit, policy_mem, f_ent, 1983 tcam_idx, fa, e)); 1984 } 1985 1986 /* Handle color dependence/independence */ 1987 if (soc_mem_field_valid(unit, policy_mem, GREEN_TO_PIDf)) { 1988 soc_mem_field32_set(unit, policy_mem, e, GREEN_TO_PIDf, 1989 (f_ent->flags & _FP_ENTRY_COLOR_INDEPENDENT) ? 1 : 0); 1990 } 1991 1992 /* Extract meter related policy fields */ 1993 BCM_IF_ERROR_RETURN(_field_sc_policer_action_set(unit, f_ent, 1994 policy_mem, e)); 1995 1996 /* Extract counter related policy fields */ 1997 BCM_IF_ERROR_RETURN(_bcm_field_trx_stat_action_set(unit, f_ent, 1998 policy_mem, 1999 tcam_idx, e)); 2000 2001 /* Write the POLICY Table */ 2002 SOC_IF_ERROR_RETURN(soc_mem_write(unit, policy_mem, 2003 MEM_BLOCK_ALL, tcam_idx, e)); 2004 return BCM_E_NONE; 2005 } 2006 2007 /* 2008 * Function: 2009 * _field_sc_entry_install 2010 * Purpose: 2011 * Write entry into the chip's memory. 2012 * Parameters: 2013 * unit - BCM Unit 2014 * f_ent - Physical entry structure to be installed 2015 * tcam_idx - common index of various tables 2016 * Returns: 2017 * BCM_E_XXX On TCAM read/write errors 2018 * BCM_E_NONE 2019 * Note: 2020 * Unit lock should be held by calling function. 2021 */ 2022 STATIC int 2023 _field_sc_entry_install(int unit, _field_entry_t *f_ent, int tcam_idx) 2024 { 2025 uint32 e[SOC_MAX_MEM_FIELD_WORDS]; /* Buffer to fill Policy & TCAM entry.*/ 2026 soc_mem_t tcam_mem; /* TCAM memory id. */ 2027 soc_mem_t policy_mem; /* Policy table memory id . */ 2028 _field_action_t *fa = NULL; 2029 2030 /* Input parameters check. */ 2031 if (NULL == f_ent) { 2032 return (BCM_E_PARAM); 2033 } 2034 2035 if (NULL == f_ent->fs) { 2036 return (BCM_E_PARAM); 2037 } 2038 2039 BCM_IF_ERROR_RETURN 2040 (_field_fb_tcam_policy_mem_get(unit, f_ent->fs->stage_id, 2041 &tcam_mem, &policy_mem)); 2042 2043 if ((tcam_idx < soc_mem_index_min(unit, tcam_mem)) || 2044 (tcam_idx > soc_mem_index_max(unit, tcam_mem))) { 2045 return (BCM_E_PARAM); 2046 } 2047 2048 /* First Erase the TCAM: Valid bits = b00 */ 2049 sal_memset(e, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 2050 SOC_IF_ERROR_RETURN 2051 (soc_mem_write(unit, tcam_mem, MEM_BLOCK_ALL, tcam_idx, e)); 2052 2053 /* Handle the actions (policy) */ 2054 /* Start with an empty POLICY entry */ 2055 sal_memset(e, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 2056 /* Extract the policy info from the entry structure. */ 2057 for (fa = f_ent->actions; ((fa != NULL) && (_FP_ACTION_VALID & fa->flags)); fa = fa->next) { 2058 BCM_IF_ERROR_RETURN( 2059 _bcm_field_trx_action_get(unit, policy_mem, f_ent, 2060 tcam_idx, fa, e)); 2061 } 2062 2063 /* Handle color dependence/independence */ 2064 if (soc_mem_field_valid(unit, policy_mem, GREEN_TO_PIDf)) { 2065 soc_mem_field32_set(unit, policy_mem, e, GREEN_TO_PIDf, 2066 (f_ent->flags & _FP_ENTRY_COLOR_INDEPENDENT) ? 1 : 0); 2067 } 2068 2069 /* Extract meter related policy fields */ 2070 BCM_IF_ERROR_RETURN(_field_sc_policer_action_set(unit, f_ent, 2071 policy_mem, e)); 2072 2073 /* Extract counter related policy fields */ 2074 BCM_IF_ERROR_RETURN(_bcm_field_trx_stat_action_set(unit, f_ent, 2075 policy_mem, 2076 tcam_idx, e)); 2077 2078 /* Write the POLICY Table */ 2079 SOC_IF_ERROR_RETURN(soc_mem_write(unit, policy_mem, 2080 MEM_BLOCK_ALL, tcam_idx, e)); 2081 2082 /* Handle the rules (TCAM) */ 2083 /* Start with an empty TCAM entry */ 2084 sal_memset(e, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32)); 2085 /* Extract the qualifier info from the entry structure. */ 2086 BCM_IF_ERROR_RETURN(_bcm_field_trx_tcam_get(unit, tcam_mem, f_ent, e)); 2087 2088 /* 2089 * Write the IPBM table if necessary 2090 * For wide/paired mode entries, f_ent->pbmp will be valid ONLY 2091 * for one of the entries. For others it will be zero. f_ent->pbmp.mask 2092 * will take care of this. 2093 */ 2094 if ((f_ent->fs->stage_id == _BCM_FIELD_STAGE_INGRESS) && 2095 ((BCM_FIELD_QSET_TEST(f_ent->group->qset, bcmFieldQualifyInPort)) || 2096 (BCM_FIELD_QSET_TEST(f_ent->group->qset, bcmFieldQualifyInPorts)))) { 2097 soc_mem_field_set(unit, FP_TCAMm, e, IPBMf, 2098 (uint32 *)&(f_ent->pbmp.data)); 2099 soc_mem_field_width_fit_set(unit, FP_TCAMm, e, 2100 IPBM_MASKf, (uint32 *)&(f_ent->pbmp.mask)); 2101 } 2102 /* Write the TCAM Table */ 2103 SOC_IF_ERROR_RETURN 2104 (soc_mem_write(unit, tcam_mem, MEM_BLOCK_ALL, tcam_idx, e)); 2105 2106 if (f_ent->fs->stage_id == _BCM_FIELD_STAGE_INGRESS) { 2107 SOC_IF_ERROR_RETURN 2108 (soc_mem_write(unit, FP_TCAM_Ym, MEM_BLOCK_ALL, tcam_idx, e)); 2109 } 2110 return BCM_E_NONE; 2111 } 2112 2113 /* 2114 * Function: 2115 * _field_sc_counter_write 2116 * Purpose: 2117 * Write accumulated sw & hw counters 2118 * Parameters: 2119 * unit - (IN) BCM device number. 2120 * stage_fc - (IN) Stage field control. 2121 * counter_x_mem - (IN) HW memory name. 2122 * mem_x_buf - (IN) Memory table entry. 2123 * counter_y_mem - (IN) HW memory name. 2124 * mem_y_buf - (IN) Memory table entry. 2125 * idx - (IN) Counter index. 2126 * packet_count - (OUT) Packet Counter value 2127 * byte_count - (OUT) Byte Counter value 2128 * Returns: 2129 * BCM_E_XXX 2130 */ 2131 int 2132 _field_sc_counter_write(int unit, soc_mem_t mem, int idx, uint32 *buf, 2133 _field_counter32_collect_t *cntrs32_buf, 2134 _field_counter64_collect_t *cntrs64_buf, 2135 uint64 *packet_count, uint64 *byte_count) 2136 { 2137 uint32 hw_val[2]; /* Parsed field counter value.*/ 2138 2139 /* Set byte count in the memory */ 2140 if (NULL != byte_count) { 2141 COMPILER_64_ZERO(cntrs64_buf->accumulated_counter); 2142 COMPILER_64_OR(cntrs64_buf->accumulated_counter, (*byte_count)); 2143 COMPILER_64_SET(cntrs64_buf->last_hw_value, 2144 COMPILER_64_HI(*byte_count) & 0x7, 2145 COMPILER_64_LO(*byte_count)); 2146 hw_val[0] = COMPILER_64_LO(cntrs64_buf->last_hw_value); 2147 hw_val[1] = COMPILER_64_HI(cntrs64_buf->last_hw_value); 2148 soc_mem_field_set(unit, mem, buf, BYTE_COUNTERf, hw_val); 2149 } 2150 2151 /* Set packet count in the memory */ 2152 if (NULL != packet_count) { 2153 COMPILER_64_ZERO(cntrs32_buf->accumulated_counter); 2154 COMPILER_64_OR(cntrs32_buf->accumulated_counter, 2155 (*packet_count)); 2156 cntrs32_buf->last_hw_value = 2157 (COMPILER_64_LO(*packet_count) & 0x1fffffff); 2158 hw_val[0] = cntrs32_buf->last_hw_value; 2159 hw_val[1] = 0; 2160 soc_mem_field_set(unit, mem, buf, PACKET_COUNTERf, hw_val); 2161 } 2162 return soc_mem_write(unit, mem, MEM_BLOCK_ALL, idx, buf); 2163 } 2164 2165 /* 2166 * Function: 2167 * _field_sc_counter_set 2168 * Purpose: 2169 * Write accumulated sw and hw counters 2170 * Parameters: 2171 * unit - (IN) BCM device number. 2172 * stage_fc - (IN) Stage field control. 2173 * counter_x_mem - (IN) HW memory name. 2174 * mem_x_buf - (IN) Memory table entry. 2175 * counter_y_mem - (IN) HW memory name. 2176 * mem_y_buf - (IN) Memory table entry. 2177 * idx - (IN) Counter index. 2178 * packet_count - (OUT) Packet Counter value 2179 * byte_count - (OUT) Byte Counter value 2180 * Returns: 2181 * BCM_E_XXX 2182 */ 2183 STATIC int 2184 _field_sc_counter_set(int unit, _field_stage_t *stage_fc, 2185 soc_mem_t counter_x_mem, uint32 *mem_x_buf, 2186 soc_mem_t counter_y_mem, uint32 *mem_y_buf, 2187 int idx, uint64 *packet_count, uint64 *byte_count) 2188 { 2189 _field_counter32_collect_t *cntrs32_buf; /* Sw packet counter value */ 2190 _field_counter64_collect_t *cntrs64_buf; /* Sw byte counter value */ 2191 int rv; /* Operation return status. */ 2192 2193 /* Input parameters check. */ 2194 if (NULL == stage_fc) { 2195 return (BCM_E_PARAM); 2196 } 2197 2198 /* Write X pipeline counter value. */ 2199 if (NULL != mem_x_buf) { 2200 cntrs64_buf = &stage_fc->_field_x64_counters[idx]; 2201 cntrs32_buf = &stage_fc->_field_x32_counters[idx]; 2202 rv = _field_sc_counter_write(unit, counter_x_mem, idx, mem_x_buf, 2203 cntrs32_buf, cntrs64_buf, packet_count, 2204 byte_count); 2205 BCM_IF_ERROR_RETURN(rv); 2206 } 2207 2208 /* Write 0 to Y pipeline counter value. */ 2209 if (NULL != packet_count) { 2210 COMPILER_64_ZERO(*packet_count); 2211 } 2212 2213 if (NULL != byte_count) { 2214 COMPILER_64_ZERO(*byte_count); 2215 } 2216 2217 if (NULL != mem_y_buf) { 2218 cntrs64_buf = &stage_fc->_field_y64_counters[idx]; 2219 cntrs32_buf = &stage_fc->_field_y32_counters[idx]; 2220 rv = _field_sc_counter_write(unit, counter_y_mem, idx, mem_y_buf, 2221 cntrs32_buf, cntrs64_buf, 2222 packet_count, byte_count); 2223 BCM_IF_ERROR_RETURN(rv); 2224 } 2225 return (BCM_E_NONE); 2226 } 2227 2228 2229 /* 2230 * Function: 2231 * _field_sc_counter_read 2232 * Purpose: 2233 * Update accumulated sw counter and return current counter value. 2234 * Parameters: 2235 * unit - (IN) BCM device number. 2236 * stage_fc - (IN) Stage field control. 2237 * counter_x_mem - (IN) HW memory name. 2238 * mem_x_buf - (IN) Memory table entry. 2239 * counter_y_mem - (IN) HW memory name. 2240 * mem_y_buf - (IN) Memory table entry. 2241 * idx - (IN) Counter index. 2242 * packet_count - (OUT) Packet Counter value 2243 * byte_count - (OUT) Byte Counter value 2244 * Returns: 2245 * BCM_E_XXX 2246 */ 2247 int 2248 _field_sc_counter_read(int unit, soc_memacc_t *memacc_byte, 2249 soc_memacc_t *memacc_pkt, uint32 *buf, 2250 _field_counter32_collect_t *cntrs32_buf, 2251 _field_counter64_collect_t *cntrs64_buf, 2252 uint64 *packet_count, uint64 *byte_count) 2253 { 2254 uint32 hw_val[2]; /* Parsed field counter value.*/ 2255 2256 /* Byte counter. */ 2257 hw_val[0] = hw_val[1] = 0; 2258 soc_memacc_field_get(memacc_byte, buf, hw_val); 2259 _bcm_field_35bit_counter_update(unit, hw_val, cntrs64_buf); 2260 if (NULL != byte_count) { 2261 COMPILER_64_ADD_64(*byte_count, cntrs64_buf->accumulated_counter); 2262 } 2263 2264 /* Packet counter. */ 2265 hw_val[0] = hw_val[1] = 0; 2266 soc_memacc_field_get(memacc_pkt, buf, hw_val); 2267 _bcm_field_29bit_counter_update(unit, hw_val, cntrs32_buf); 2268 if (NULL != packet_count) { 2269 COMPILER_64_ADD_64(*packet_count, cntrs32_buf->accumulated_counter); 2270 } 2271 return (BCM_E_NONE); 2272 } 2273 2274 2275 /* 2276 * Function: 2277 * _field_sc_counter_get 2278 * Purpose: 2279 * Update accumulated sw counter and return current counter value. 2280 * Parameters: 2281 * unit - (IN) BCM device number. 2282 * stage_fc - (IN) Stage field control. 2283 * counter_x_mem - (IN) HW memory name. 2284 * mem_x_buf - (IN) Memory table entry. 2285 * counter_y_mem - (IN) HW memory name. 2286 * mem_y_buf - (IN) Memory table entry. 2287 * idx - (IN) Counter index. 2288 * packet_count - (OUT) Packet Counter value 2289 * byte_count - (OUT) Byte Counter value 2290 * Returns: 2291 * BCM_E_XXX 2292 */ 2293 STATIC int 2294 _field_sc_counter_get(int unit, _field_stage_t *stage_fc, 2295 soc_mem_t counter_x_mem, uint32 *mem_x_buf, 2296 soc_mem_t counter_y_mem, uint32 *mem_y_buf, 2297 int idx, uint64 *packet_count, uint64 *byte_count) 2298 { 2299 _field_counter32_collect_t *cntrs32_buf; /* Sw packet counter value */ 2300 _field_counter64_collect_t *cntrs64_buf; /* Sw byte counter value */ 2301 soc_memacc_t *memacc_pkt_x, *memacc_byte_x; /* Memory access cache. */ 2302 soc_memacc_t *memacc_pkt_y, *memacc_byte_y; /* Memory access cache. */ 2303 2304 /* Input parameters check. */ 2305 if (NULL == stage_fc) { 2306 return (BCM_E_PARAM); 2307 } 2308 2309 /* Extract X pipeline counter value. */ 2310 if (NULL != mem_x_buf) { 2311 cntrs64_buf = &stage_fc->_field_x64_counters[idx]; 2312 cntrs32_buf = &stage_fc->_field_x32_counters[idx]; 2313 memacc_byte_x = 2314 &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_BYTE]); 2315 memacc_pkt_x = 2316 &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_PACKET]); 2317 SOC_IF_ERROR_RETURN 2318 (_field_sc_counter_read(unit, memacc_byte_x, memacc_pkt_x, 2319 mem_x_buf, 2320 cntrs32_buf, cntrs64_buf, 2321 packet_count, byte_count)); 2322 } 2323 2324 /* Extract Y pipeline counter value. */ 2325 if (NULL != mem_y_buf) { 2326 cntrs64_buf = &stage_fc->_field_y64_counters[idx]; 2327 cntrs32_buf = &stage_fc->_field_y32_counters[idx]; 2328 memacc_byte_y = 2329 &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_BYTE_Y]); 2330 memacc_pkt_y = 2331 &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_PACKET_Y]); 2332 SOC_IF_ERROR_RETURN 2333 (_field_sc_counter_read(unit, memacc_byte_y, memacc_pkt_y, 2334 mem_y_buf, 2335 cntrs32_buf, cntrs64_buf, 2336 packet_count, byte_count)); 2337 } 2338 return (BCM_E_NONE); 2339 } 2340 2341 /* 2342 * Function: 2343 * _field_sc_selcode_get 2344 * Purpose: 2345 * Finds a 4-tuple of select encodings that will satisfy the 2346 * requested qualifier set (Qset). 2347 * Parameters: 2348 * unit - (IN) BCM unit number. 2349 * stage_fc - (IN) Stage Field control structure. 2350 * qset_req - (IN) Client qualifier set. 2351 * fg - (IN/OUT)Select code information filled into the group. 2352 * 2353 * Returns: 2354 * BCM_E_XXX 2355 */ 2356 STATIC int 2357 _field_sc_selcode_get(int unit, _field_stage_t *stage_fc, 2358 bcm_field_qset_t *qset_req, 2359 _field_group_t *fg) 2360 { 2361 int rv; /* Operation return status. */ 2362 2363 /* Input parameters check. */ 2364 if ((NULL == fg) || (NULL == qset_req) || (NULL == stage_fc)) { 2365 return (BCM_E_PARAM); 2366 } 2367 2368 /* Egress qualifiers are selected based on Key. */ 2369 switch (stage_fc->stage_id) { 2370 case _BCM_FIELD_STAGE_EGRESS: 2371 rv = _bcm_field_trx_egress_selcode_get(unit, stage_fc, qset_req, fg); 2372 break; 2373 default: 2374 rv = _bcm_field_selcode_get(unit, stage_fc, qset_req, fg); 2375 } 2376 return (rv); 2377 } 2378 2379 2380 2381 /* 2382 * Function: 2383 * _field_sc_functions_init 2384 * 2385 * Purpose: 2386 * Set up functions pointers 2387 * 2388 * Parameters: 2389 * stage_fc - (IN/OUT) pointers to stage control block whe the device 2390 * and stage specific functions will be registered. 2391 * 2392 * Returns: 2393 * nothing 2394 * Notes: 2395 */ 2396 STATIC void 2397 _field_sc_functions_init(_field_funct_t *functions) 2398 { 2399 functions->fp_detach = _field_sc_detach; 2400 functions->fp_group_install = _bcm_field_fb_group_install; 2401 functions->fp_selcodes_install = _bcm_field_trx_selcodes_install; 2402 functions->fp_slice_clear = _bcm_field_trx_slice_clear; 2403 functions->fp_entry_remove = _bcm_field_fb_entry_remove; 2404 functions->fp_entry_move = _bcm_field_fb_entry_move; 2405 functions->fp_selcode_get = _field_sc_selcode_get; 2406 functions->fp_selcode_to_qset = _bcm_field_selcode_to_qset; 2407 functions->fp_qual_list_get = _bcm_field_qual_lists_get; 2408 functions->fp_tcam_policy_install = _field_sc_entry_install; 2409 functions->fp_tcam_policy_reinstall = _field_sc_entry_reinstall; 2410 functions->fp_policer_install = _bcm_field_trx_policer_install; 2411 functions->fp_qualify_ip_type = _bcm_field_trx_qualify_ip_type; 2412 functions->fp_qualify_ip_type_get = _bcm_field_trx_qualify_ip_type_get; 2413 functions->fp_counter_get = _field_sc_counter_get; 2414 functions->fp_counter_set = _field_sc_counter_set; 2415 functions->fp_stat_index_get = _bcm_field_trx_stat_index_get; 2416 functions->fp_egress_key_match_type_set = 2417 _bcm_field_trx_egress_key_match_type_set; 2418 functions->fp_tcam_policy_clear = NULL; 2419 functions->fp_action_support_check = _bcm_field_trx_action_support_check; 2420 functions->fp_action_conflict_check = _bcm_field_trx_action_conflict_check; 2421 functions->fp_write_slice_map = _field_sc_write_slice_map; 2422 functions->fp_external_entry_install = NULL; 2423 functions->fp_external_entry_reinstall = NULL; 2424 functions->fp_external_entry_remove = NULL; 2425 functions->fp_external_entry_prio_set = NULL; 2426 functions->fp_action_params_check = _bcm_field_trx_action_params_check; 2427 functions->fp_data_qualifier_ethertype_add = 2428 _bcm_field_fb_data_qualifier_ethertype_add; 2429 functions->fp_data_qualifier_ethertype_delete= 2430 _bcm_field_fb_data_qualifier_ethertype_delete; 2431 functions->fp_data_qualifier_ip_protocol_add = 2432 _bcm_field_fb_data_qualifier_ip_protocol_add; 2433 functions->fp_data_qualifier_ip_protocol_delete= 2434 _bcm_field_fb_data_qualifier_ip_protocol_delete; 2435 functions->fp_data_qualifier_packet_format_add= 2436 _bcm_field_fb_data_qualifier_packet_format_add; 2437 functions->fp_data_qualifier_packet_format_delete= 2438 _bcm_field_fb_data_qualifier_packet_format_delete; 2439 functions->fp_stat_value_get = NULL; 2440 functions->fp_stat_value_set = NULL; 2441 functions->fp_control_set = _bcm_field_control_set; 2442 functions->fp_control_get = _bcm_field_control_get; 2443 functions->fp_stat_hw_mode_get = _bcm_field_stat_hw_mode_get; 2444 functions->fp_stat_hw_alloc = _bcm_field_stat_hw_alloc; 2445 functions->fp_stat_hw_free = _bcm_field_stat_hw_free; 2446 functions->fp_group_add = NULL; 2447 functions->fp_qualify_trunk = _bcm_field_qualify_trunk; 2448 functions->fp_qualify_trunk_get = _bcm_field_qualify_trunk_get; 2449 functions->fp_qualify_inports = _bcm_field_qualify_InPorts; 2450 functions->fp_entry_stat_extended_attach = NULL; 2451 functions->fp_entry_stat_extended_get = NULL; 2452 functions->fp_entry_stat_detach = _bcm_field_entry_stat_detach; 2453 functions->fp_class_size_get = NULL; 2454 functions->fp_qualify_packet_res = _field_qualify_PacketRes; 2455 functions->fp_qualify_packet_res_get = _field_qualify_PacketRes_get; 2456 } 2457 #else /* BCM_SCORPION_SUPPORT && BCM_FIELD_SUPPORT */ 2458 int _scorpion_field_not_empty; 2459 #endif /* BCM_SCORPION_SUPPORT && BCM_FIELD_SUPPORT */