openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

int.c (23092B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * This file contains INT functions.
      8  * INT(Inband Network Telemetry) provides a framework to help detecting 
      9  * and isolating network faults. This is achieved by sending a INT probe packet
     10  * from a source node to the destination node. Along the path, every INT-awared 
     11  * switch device appends the requested data to the probe packet. 
     12  * The requested data includes switch device's real-time states and should be 
     13  * processed in the data plane by hardware.
     14  * This module supports INT probe packet detection and processing configuration 
     15  * in the INT-awared switch device. This basically is done with various  
     16  * switch control types and per-port controls.
     17  */
     18 
     19 #include <shared/bsl.h>
     20 #include <soc/drv.h>
     21 #include <soc/scache.h>
     22 
     23 #include <bcm/error.h>
     24 #include <bcm/types.h>
     25 #include <bcm/switch.h>
     26 #include <bcm_int/esw/switch.h>
     27 
     28 #if defined(INCLUDE_L3)
     29 #include <bcm_int/esw/trx.h>
     30 #endif
     31 
     32 #define LB_PORT_LPORT_IDX   0
     33 #define INT_MAX_LEN_OFFSET_VALUE    32
     34 
     35 #if defined(BCM_TRIDENT3_SUPPORT)
     36  /*
     37   * Function:
     38   *      _bcm_td3_int_loopback_enable
     39   * Purpose:
     40   *      Enable IPv4 L3 attribute of the loopback port for INT reply packet
     41   *   When sending packet to the internal loopback port, the ingress
     42   *   pp_port(packet process port) will be one of the front panel port. 
     43   *   Need to enable L3 on the pp_port. In TD3, it references the 
     44   *   SOURCE_TRUNK_MAP for the port attributes. By default, it uses LPORT 
     45   *   profile 0.
     46   * Parameters:
     47   *   IN : unit
     48   * Returns:
     49   *      BCM_E_XXX
     50   */
     51 
     52 STATIC int
     53 _bcm_td3_int_misc_enable(int unit)
     54 {
     55     soc_field_t reg_fld = HIGIG2_ECN_IN_CC_ENABLEf;
     56     uint32 fld_value    = 1;
     57 
     58     /* enable IPv4 L3 on loopback port  */
     59     SOC_IF_ERROR_RETURN(soc_mem_field32_modify(unit, LPORT_TABm, 0,
     60                                 V4L3_ENABLEf, 1));
     61 
     62     /* populate INT_CN in the egress object bus. Editor uses egress object
     63      * bus to fetch INT_CN from Egress object bus and put into INT metadata.
     64      */
     65     SOC_IF_ERROR_RETURN(soc_reg_fields32_modify(unit, EGR_CONFIG_1_64r, 
     66                REG_PORT_ANY, 1, &reg_fld, &fld_value));
     67   
     68     return SOC_E_NONE;
     69 }
     70 
     71  /*
     72   * Function:
     73   *      _bcm_td3_int_loopback_disable
     74   * Purpose:
     75   *      Disable L3 on pp_port 
     76   * Parameters:
     77   *   IN : unit
     78   * Returns:
     79   *      BCM_E_XXX
     80   */
     81 
     82 STATIC int
     83 _bcm_td3_int_misc_disable(int unit)
     84 {
     85     soc_field_t reg_fld = HIGIG2_ECN_IN_CC_ENABLEf;
     86     uint32 fld_value    = 0;
     87 
     88     SOC_IF_ERROR_RETURN(soc_mem_field32_modify(unit, LPORT_TABm, 0,
     89                                 V4L3_ENABLEf, 0));
     90     SOC_IF_ERROR_RETURN(soc_reg_fields32_modify(unit, EGR_CONFIG_1_64r, 
     91                REG_PORT_ANY, 1, &reg_fld, &fld_value));
     92     return SOC_E_NONE;
     93 }
     94 #endif
     95 
     96 int
     97 _bcm_th3_int_reg64_set(int unit, soc_reg_t reg, soc_field_t field, uint64 arg)
     98 {
     99 #if defined(BCM_TOMAHAWK3_SUPPORT)
    100     uint64 reg_value;
    101     uint64 max_value;
    102     int field_width;
    103     int rv;
    104 
    105     if (SOC_REG_FIELD_VALID(unit, reg, field)) {
    106         /* Check the range of the value to be programmed */
    107         field_width = soc_reg_field_length(unit, reg, field);
    108         if (field_width < 64) {
    109             COMPILER_64_SET(max_value, 0, 1);
    110             COMPILER_64_SHL(max_value, field_width);
    111             COMPILER_64_SUB_32(max_value, 1);
    112         } else {
    113             COMPILER_64_SET(max_value, -1, -1);
    114         }
    115         if (COMPILER_64_GT(arg, max_value)) {
    116             return BCM_E_PARAM;
    117         }
    118 
    119         rv = soc_reg64_get(unit, reg, REG_PORT_ANY, 0, &reg_value);
    120         SOC_IF_ERROR_RETURN(rv);
    121         soc_reg64_field_set(unit, reg, &reg_value, field, arg);
    122         rv = soc_reg64_set(unit, reg, REG_PORT_ANY, 0, reg_value);
    123         SOC_IF_ERROR_RETURN(rv);
    124     }
    125     return SOC_E_NONE;
    126 #else
    127     return SOC_E_NONE;
    128 #endif
    129 }
    130 
    131 int
    132 _bcm_th3_int_reg32_set(int unit, soc_reg_t reg, soc_field_t field, uint32 arg)
    133 {
    134 #if defined(BCM_TOMAHAWK3_SUPPORT)
    135     uint32 reg_value;
    136     uint32 max_value;
    137     int field_width;
    138     int rv;
    139 
    140     if (SOC_REG_FIELD_VALID(unit, reg, field)) {
    141         /* Check the range of the value to be programmed */
    142         field_width = soc_reg_field_length(unit, reg, field);
    143         max_value = (field_width < 32) ? ((1 << field_width) - 1) : -1;
    144         if (arg > max_value) {
    145             return BCM_E_PARAM;
    146         }
    147 
    148         rv = soc_reg32_get(unit, reg, REG_PORT_ANY, 0, &reg_value);
    149         SOC_IF_ERROR_RETURN(rv);
    150         soc_reg_field_set(unit, reg, &reg_value, field, arg);
    151         rv = soc_reg32_set(unit, reg, REG_PORT_ANY, 0, reg_value);
    152         SOC_IF_ERROR_RETURN(rv);
    153     }
    154     return SOC_E_NONE;
    155 #else
    156     return SOC_E_NONE;
    157 #endif
    158 }
    159 
    160 int
    161 _bcm_th3_int_reg64_get(int unit, soc_reg_t reg, soc_field_t field, uint64 *arg)
    162 {
    163 #if defined(BCM_TOMAHAWK3_SUPPORT)
    164     int rv;
    165     uint64 reg_value;
    166 
    167     if (SOC_REG_FIELD_VALID(unit, reg, field)) {
    168         COMPILER_64_ZERO(reg_value);
    169         rv = soc_reg64_get(unit, reg, REG_PORT_ANY, 0, &reg_value);
    170         SOC_IF_ERROR_RETURN(rv);
    171         *arg = soc_reg64_field_get(unit, reg, reg_value, field);
    172     }
    173     return SOC_E_NONE;
    174 #else
    175     return SOC_E_NONE;
    176 #endif
    177 }
    178 
    179 
    180 int
    181 _bcm_th3_int_reg32_get(int unit, soc_reg_t reg, soc_field_t field, uint32 *arg)
    182 {
    183 #if defined(BCM_TOMAHAWK3_SUPPORT)
    184     int rv;
    185     uint32 reg_value;
    186 
    187     if (SOC_REG_FIELD_VALID(unit, reg, field)) {
    188         rv = soc_reg32_get(unit, reg, REG_PORT_ANY, 0, &reg_value);
    189         SOC_IF_ERROR_RETURN(rv);
    190         *arg = soc_reg_field_get(unit, reg, reg_value, field);
    191     }
    192     return SOC_E_NONE;
    193 #else
    194     return SOC_E_NONE;
    195 #endif
    196 }
    197 
    198 
    199 /*
    200  * Function:
    201  *    bcmi_esw_int_switch_control_set
    202  * Purpose:
    203  *    Implement various INT switch control types to perform
    204  *  system wide configuration to enable INT packet detection 
    205  *  and processing.
    206  *
    207  * Parameters:
    208  *      unit - Device unit number
    209  *      type - The desired configuration parameter to modify
    210  *      arg - The value with which to set the parameter
    211  * Returns:
    212  *    BCM_E_XXX
    213  */
    214 
    215 int
    216 bcmi_esw_int_switch_control_set(int unit, 
    217                            bcm_switch_control_t type,
    218                            int arg)
    219 {
    220     int rv = BCM_E_UNAVAIL;
    221 
    222 #if defined(BCM_TRIDENT3_SUPPORT)
    223     if (SOC_IS_TRIDENT3X(unit)) {
    224         uint32 reg_value;
    225         uint64 reg_val64;
    226         soc_field_t field;
    227         soc_field_t field1;
    228 
    229         switch (type) {
    230             case bcmSwitchIntL4DestPort1:
    231             case bcmSwitchIntMaxPayloadLength:
    232                 if (type == bcmSwitchIntL4DestPort1) {
    233                     field = UDP_DEST_PORTf; 
    234                     if (arg) {
    235                         rv = _bcm_td3_int_misc_enable(unit);
    236                     } else {
    237                         rv = _bcm_td3_int_misc_disable(unit);
    238                     }
    239                     SOC_IF_ERROR_RETURN(rv);
    240                 } else {
    241                     field = MAX_PAYLOAD_LENGTHf; 
    242                     if (arg < INT_MAX_LEN_OFFSET_VALUE) {
    243                         return BCM_E_UNAVAIL;
    244                     }
    245                     arg -= INT_MAX_LEN_OFFSET_VALUE;
    246                 }
    247                 /* call cancun cch interface function */
    248                 if (SOC_REG_FIELD_VALID(unit, INT_CONTROLr, field)) {
    249                     rv = soc_reg32_get(unit, INT_CONTROLr, REG_PORT_ANY,0,
    250                                              &reg_value);
    251                     SOC_IF_ERROR_RETURN(rv);
    252                     soc_reg_field_set(unit,INT_CONTROLr,&reg_value,
    253                                field,arg);
    254                     rv = soc_reg32_set(unit, INT_CONTROLr, REG_PORT_ANY, 0, 
    255                                reg_value);
    256                     SOC_IF_ERROR_RETURN(rv);
    257                     return SOC_E_NONE;
    258                 } 
    259                 break;
    260             case bcmSwitchIntProbeMarker1:
    261             case bcmSwitchIntProbeMarker2:
    262                 if (SOC_REG_IS_VALID(unit, INT_CONTROL_1r)) {
    263                     rv = soc_reg64_get(unit, INT_CONTROL_1r, REG_PORT_ANY, 0, 
    264                          &reg_val64);
    265                     SOC_IF_ERROR_RETURN(rv);
    266                     if (type == bcmSwitchIntProbeMarker1) {
    267                         field  = PROBE_MARKER_1_BYTES_1_0f;
    268                         field1 = PROBE_MARKER_1_BYTES_3_2f;
    269                     } else {
    270                         field  = PROBE_MARKER_2_BYTES_1_0f;
    271                         field1 = PROBE_MARKER_2_BYTES_3_2f;
    272                     }
    273                     soc_reg64_field32_set(unit, INT_CONTROL_1r, &reg_val64, 
    274                          field, arg & 0xffff);
    275                     soc_reg64_field32_set(unit, INT_CONTROL_1r, &reg_val64, 
    276                          field1, (arg >> 16) & 0xffff);
    277                     rv = soc_reg64_set(unit, INT_CONTROL_1r, REG_PORT_ANY, 0, 
    278                          reg_val64);
    279                     SOC_IF_ERROR_RETURN(rv);
    280                     return SOC_E_NONE;
    281                 }
    282                 break;
    283 
    284             case bcmSwitchIntL4DestPortEnable:
    285                 if (SOC_REG_IS_VALID(unit, INT_PARSE_CONTROLr)) {
    286                     rv = soc_reg64_get(unit, INT_PARSE_CONTROLr, REG_PORT_ANY, 0,
    287                          &reg_val64);
    288                     SOC_IF_ERROR_RETURN(rv);
    289 
    290                     field  = UDP_BASED_ENABLEf;
    291                     soc_reg64_field32_set(unit, INT_PARSE_CONTROLr, &reg_val64,
    292                          field, arg & 0x1);
    293                     rv = soc_reg64_set(unit, INT_PARSE_CONTROLr, REG_PORT_ANY, 0,
    294                          reg_val64);
    295                     SOC_IF_ERROR_RETURN(rv);
    296                     return SOC_E_NONE;
    297                 }
    298                 break;
    299 
    300             case bcmSwitchIntProbeMarkerEnable:
    301                 if (SOC_REG_IS_VALID(unit, INT_PARSE_CONTROLr)) {
    302                     rv = soc_reg64_get(unit, INT_PARSE_CONTROLr, REG_PORT_ANY, 0,
    303                          &reg_val64);
    304                     SOC_IF_ERROR_RETURN(rv);
    305 
    306                     field  = PROBE_MARKER_BASED_ENABLEf;
    307                     soc_reg64_field32_set(unit, INT_PARSE_CONTROLr, &reg_val64,
    308                          field, arg & 0x1);
    309                     rv = soc_reg64_set(unit, INT_PARSE_CONTROLr, REG_PORT_ANY, 0,
    310                          reg_val64);
    311                     SOC_IF_ERROR_RETURN(rv);
    312                     return SOC_E_NONE;
    313                 }
    314                 break;
    315 
    316             case bcmSwitchIntL4DestPort2:
    317             case bcmSwitchIntVersion:
    318             case bcmSwitchIntRequestVectorValue:
    319             case bcmSwitchIntRequestVectorMask:
    320             case bcmSwitchIntSwitchId:
    321             case bcmSwitchIntEgressTimeDelta:
    322             case bcmSwitchIntHopLimitCpuEnable:
    323             case bcmSwitchIntTurnAroundCpuEnable:
    324             default:
    325                 return BCM_E_UNAVAIL;
    326                 break;
    327         }
    328         return BCM_E_UNAVAIL;
    329     }
    330 #endif  /* defined(BCM_TRIDENT3_SUPPORT) */
    331 
    332 #if defined(BCM_TOMAHAWK3_SUPPORT)
    333     if (SOC_IS_TOMAHAWK3(unit)) {
    334         uint64 arg64;
    335         uint64 enable64;
    336         int field_len;
    337         uint64 max_val;
    338 
    339         if (!soc_feature(unit, soc_feature_inband_network_telemetry)) {
    340             return BCM_E_UNAVAIL;
    341         }
    342         
    343         COMPILER_64_SET(arg64, 0, (uint32)arg);
    344         COMPILER_64_SET(enable64, 0, (uint32)1);
    345 
    346         switch (type) {
    347             /* XXX add code for TH3 handling */
    348             case bcmSwitchIntL4DestPort1:
    349                 field_len = soc_reg_field_length(unit, INT_DETECT_CONFIG_0r, UDP_DST_PORT1f);
    350                 COMPILER_64_SET(max_val, 0, (uint32)((1 << field_len) - 1));
    351                 if (COMPILER_64_GT(arg64, max_val)) {
    352                     rv = BCM_E_PARAM;
    353                 }
    354                 rv =_bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_0r, UDP_DST_PORT1f, arg64);
    355                 if (BCM_SUCCESS(rv)) {
    356                     rv = _bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_0r, UDP_DST_PORT1_ENf, enable64);
    357                 }
    358                 break;
    359             case bcmSwitchIntL4DestPort2:
    360                 field_len = soc_reg_field_length(unit, INT_DETECT_CONFIG_0r, UDP_DST_PORT2f);
    361                 COMPILER_64_SET(max_val, 0, (uint32)((1 << field_len) - 1));
    362                 if (COMPILER_64_GT(arg64, max_val)) {
    363                     rv = BCM_E_PARAM;
    364                 }
    365                 rv = _bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_0r, UDP_DST_PORT2f, arg64);
    366                 if (BCM_SUCCESS(rv)) {
    367                     rv = _bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_0r, UDP_DST_PORT2_ENf, enable64);
    368                 }
    369                 break;
    370             case bcmSwitchIntProbeMarker1:
    371                 field_len = soc_reg_field_length(unit, INT_DETECT_CONFIG_1r, PROBE_MARKER1f);
    372                 COMPILER_64_SET(max_val, 0, (uint32)((1 << field_len) - 1));
    373                 if (COMPILER_64_GT(arg64, max_val)) {
    374                     rv = BCM_E_PARAM;
    375                 }
    376                 rv = _bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_1r, PROBE_MARKER1f, arg64);
    377                 if (BCM_SUCCESS(rv)) {
    378                     rv = _bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_1r, PROBE_MARKER1_ENf, enable64);
    379                 }
    380                 break;
    381             case bcmSwitchIntProbeMarker2:
    382                 field_len = soc_reg_field_length(unit, INT_DETECT_CONFIG_2r, PROBE_MARKER2f);
    383                 COMPILER_64_SET(max_val, 0, (uint32)((1 << field_len) - 1));
    384                 if (COMPILER_64_GT(arg64, max_val)) {
    385                     rv = BCM_E_PARAM;
    386                 }
    387                 rv = _bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_2r, PROBE_MARKER2f, arg64);
    388                 if (BCM_SUCCESS(rv)) {
    389                     rv = _bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_2r, PROBE_MARKER2_ENf, enable64);
    390                 }
    391                 break;
    392             case bcmSwitchIntVersion:
    393                 field_len = soc_reg_field_length(unit, INT_DETECT_CONFIG_0r, VERSIONf);
    394                 COMPILER_64_SET(max_val, 0, (uint32)((1 << field_len) - 1));
    395                 if (COMPILER_64_GT(arg64, max_val)) {
    396                     rv = BCM_E_PARAM;
    397                 }
    398                 rv = _bcm_th3_int_reg64_set(unit, INT_DETECT_CONFIG_0r, VERSIONf, arg64);
    399                 break;
    400             case bcmSwitchIntRequestVectorValue:
    401                 field_len = soc_reg_field_length(unit, INT_REQUEST_VECTOR_CONFIGr, REQUEST_VECTOR_VALUEf);
    402                 COMPILER_64_SET(max_val, 0, (uint32)((1 << field_len) - 1));
    403                 if (COMPILER_64_GT(arg64, max_val)) {
    404                     rv = BCM_E_PARAM;
    405                 }
    406                 rv = _bcm_th3_int_reg64_set(unit, INT_REQUEST_VECTOR_CONFIGr, REQUEST_VECTOR_VALUEf, arg64);
    407                 break;
    408             case bcmSwitchIntRequestVectorMask:
    409                 field_len = soc_reg_field_length(unit, INT_REQUEST_VECTOR_CONFIGr, REQUEST_VECTOR_MASKf);
    410                 COMPILER_64_SET(max_val, 0, (uint32)((1 << field_len) - 1));
    411                 if (COMPILER_64_GT(arg64, max_val)) {
    412                     rv = BCM_E_PARAM;
    413                 }
    414                 rv = _bcm_th3_int_reg64_set(unit, INT_REQUEST_VECTOR_CONFIGr, REQUEST_VECTOR_MASKf, arg64);
    415                 break;
    416             case bcmSwitchIntSwitchId:
    417                 rv = _bcm_th3_int_reg32_set(unit, EGR_INT_SWITCH_IDr, SWITCHIDf, arg);
    418                 break;
    419             case bcmSwitchIntEgressTimeDelta:
    420                 rv = _bcm_th3_int_reg32_set(unit, EGR_INT_EGRESS_TIME_DELTAr, DELTAf, arg);
    421                 break;
    422             case bcmSwitchIntHopLimitCpuEnable:
    423                 rv = _bcm_th3_int_reg32_set(unit, INT_PROCESS_CONFIGr, HOPLIMIT_COPYTO_CPUf, arg);
    424                 break;
    425             case bcmSwitchIntTurnAroundCpuEnable:
    426                 rv = _bcm_th3_int_reg32_set(unit, INT_PROCESS_CONFIGr, TURNAROUND_COPYTO_CPUf, arg);
    427                 break;
    428             default:
    429                 break;
    430         }
    431     }
    432 #endif  /* defined(BCM_TOMAHAWK3_SUPPORT) */
    433 
    434     return rv;
    435 }
    436 
    437 /*
    438  * Function:
    439  *    bcmi_esw_int_control_get
    440  * Purpose:
    441  *    Get the value of various INT switch control types.
    442  *
    443  * Parameters:
    444  *      unit - Device unit number
    445  *      type - The desired configuration parameter to modify
    446  *      arg - The value with which to set the parameter
    447  * Returns:
    448  *    BCM_E_XXX
    449  */
    450 
    451 int
    452 bcmi_esw_int_switch_control_get(int unit, 
    453                            bcm_switch_control_t type,
    454                            int *arg)
    455 {
    456     int rv = BCM_E_UNAVAIL;
    457 #if defined(BCM_TRIDENT3_SUPPORT)
    458     if (SOC_IS_TRIDENT3X(unit)) {
    459         uint32 reg_value;
    460         soc_field_t field;
    461         soc_field_t field1;
    462         uint64 reg_val64;
    463 
    464         switch (type) {
    465             case bcmSwitchIntL4DestPort1:
    466             case bcmSwitchIntMaxPayloadLength:
    467                 /* call cancun cch interface function */
    468                 if (type == bcmSwitchIntL4DestPort1) {
    469                     field = UDP_DEST_PORTf;
    470                 } else {
    471                     field = MAX_PAYLOAD_LENGTHf;
    472                 }
    473                 /* call cancun cch interface function */
    474                 if (SOC_REG_FIELD_VALID(unit, INT_CONTROLr, field)) {
    475                     rv = soc_reg32_get(unit, INT_CONTROLr, REG_PORT_ANY,0,
    476                                              &reg_value);
    477                     SOC_IF_ERROR_RETURN(rv);
    478                     *arg = soc_reg_field_get(unit,INT_CONTROLr,reg_value,
    479                                field);
    480                     if (type == bcmSwitchIntMaxPayloadLength) {
    481                         *arg += INT_MAX_LEN_OFFSET_VALUE;
    482                     }
    483                     return SOC_E_NONE;
    484                 }
    485                 break;
    486 
    487             case bcmSwitchIntProbeMarker1:
    488             case bcmSwitchIntProbeMarker2:
    489                 if (SOC_REG_IS_VALID(unit, INT_CONTROL_1r)) {
    490                     rv = soc_reg64_get(unit, INT_CONTROL_1r, REG_PORT_ANY, 0, 
    491                          &reg_val64);
    492                     SOC_IF_ERROR_RETURN(rv);
    493                     if (type == bcmSwitchIntProbeMarker1) {
    494                         field  = PROBE_MARKER_1_BYTES_1_0f;
    495                         field1 = PROBE_MARKER_1_BYTES_3_2f;
    496                     } else {
    497                         field  = PROBE_MARKER_2_BYTES_1_0f;
    498                         field1 = PROBE_MARKER_2_BYTES_3_2f;
    499                     }
    500                     *arg = soc_reg64_field32_get(unit, INT_CONTROL_1r, 
    501                            reg_val64, field);
    502                     *arg &= 0xffff;
    503 
    504                     reg_value =  soc_reg64_field32_get(unit, INT_CONTROL_1r, 
    505                            reg_val64, field1);
    506                     reg_value <<= 16;
    507                     *arg |= reg_value;
    508                     return SOC_E_NONE;
    509                 }
    510                 break;
    511                 
    512             case bcmSwitchIntL4DestPortEnable:
    513                 if (SOC_REG_IS_VALID(unit, INT_PARSE_CONTROLr)) {
    514                     rv = soc_reg64_get(unit, INT_PARSE_CONTROLr, REG_PORT_ANY, 0,
    515                                        &reg_val64);
    516                     SOC_IF_ERROR_RETURN(rv);
    517 
    518                     field  = UDP_BASED_ENABLEf;
    519                     *arg = soc_reg64_field32_get(unit, INT_PARSE_CONTROLr, reg_val64,
    520                                                  field);
    521                     *arg &= 0x1;
    522                     return SOC_E_NONE;
    523                 }
    524                 break;
    525 
    526             case bcmSwitchIntProbeMarkerEnable:
    527                 if (SOC_REG_IS_VALID(unit, INT_PARSE_CONTROLr)) {
    528                     rv = soc_reg64_get(unit, INT_PARSE_CONTROLr, REG_PORT_ANY, 0,
    529                                        &reg_val64);
    530                     SOC_IF_ERROR_RETURN(rv);
    531 
    532                     field  = PROBE_MARKER_BASED_ENABLEf;
    533                     *arg = soc_reg64_field32_get(unit, INT_PARSE_CONTROLr, reg_val64,
    534                                                  field);
    535                     *arg &= 0x1;
    536                     return SOC_E_NONE;
    537                 }
    538                 break;
    539 
    540             case bcmSwitchIntL4DestPort2:
    541             case bcmSwitchIntVersion:
    542             case bcmSwitchIntRequestVectorValue:
    543             case bcmSwitchIntRequestVectorMask:
    544             case bcmSwitchIntSwitchId:
    545             case bcmSwitchIntEgressTimeDelta:
    546             case bcmSwitchIntHopLimitCpuEnable:
    547             case bcmSwitchIntTurnAroundCpuEnable:
    548             default:
    549                 return BCM_E_UNAVAIL;
    550         }
    551         return BCM_E_UNAVAIL;
    552     }
    553 #endif  /* defined(BCM_TRIDENT3_SUPPORT) */
    554 
    555 #if defined(BCM_TOMAHAWK3_SUPPORT)
    556     if (SOC_IS_TOMAHAWK3(unit) &&
    557         soc_feature(unit, soc_feature_inband_network_telemetry)) {
    558         uint64 arg64;
    559 
    560         COMPILER_64_ZERO(arg64);
    561         switch (type) {
    562             case bcmSwitchIntL4DestPort1:
    563                 rv = _bcm_th3_int_reg64_get(unit, INT_DETECT_CONFIG_0r, UDP_DST_PORT1f, &arg64);
    564                 *arg = (int)COMPILER_64_LO(arg64);
    565                 break;
    566             case bcmSwitchIntL4DestPort2:
    567                 rv = _bcm_th3_int_reg64_get(unit, INT_DETECT_CONFIG_0r, UDP_DST_PORT2f, &arg64);
    568                 *arg = (int)COMPILER_64_LO(arg64);
    569                 break;
    570             case bcmSwitchIntProbeMarker1:
    571                 rv = _bcm_th3_int_reg64_get(unit, INT_DETECT_CONFIG_1r, PROBE_MARKER1f, &arg64);
    572                 *arg = (int)COMPILER_64_LO(arg64);
    573                 break;
    574             case bcmSwitchIntProbeMarker2:
    575                 rv = _bcm_th3_int_reg64_get(unit, INT_DETECT_CONFIG_2r, PROBE_MARKER2f, &arg64);
    576                 *arg = (int)COMPILER_64_LO(arg64);
    577                 break;
    578             case bcmSwitchIntVersion:
    579                 rv = _bcm_th3_int_reg64_get(unit, INT_DETECT_CONFIG_0r, VERSIONf, &arg64);
    580                 *arg = (int)COMPILER_64_LO(arg64);
    581                 break;
    582             case bcmSwitchIntRequestVectorValue:
    583                 rv = _bcm_th3_int_reg64_get(unit, INT_REQUEST_VECTOR_CONFIGr, REQUEST_VECTOR_VALUEf, &arg64);
    584                 *arg = (int)COMPILER_64_LO(arg64);
    585                 break;
    586             case bcmSwitchIntRequestVectorMask:
    587                 rv = _bcm_th3_int_reg64_get(unit, INT_REQUEST_VECTOR_CONFIGr, REQUEST_VECTOR_MASKf, &arg64);
    588                 *arg = (int)COMPILER_64_LO(arg64);
    589                 break;
    590             case bcmSwitchIntSwitchId:
    591                 rv = _bcm_th3_int_reg32_get(unit, EGR_INT_SWITCH_IDr, SWITCHIDf, (uint32 *)arg);
    592                 break;
    593             case bcmSwitchIntEgressTimeDelta:
    594                 rv = _bcm_th3_int_reg32_get(unit, EGR_INT_EGRESS_TIME_DELTAr, DELTAf, (uint32 *)arg);
    595                 break;
    596             case bcmSwitchIntHopLimitCpuEnable:
    597                 rv = _bcm_th3_int_reg32_get(unit, INT_PROCESS_CONFIGr, HOPLIMIT_COPYTO_CPUf, (uint32 *)arg);
    598                 break;
    599             case bcmSwitchIntTurnAroundCpuEnable:
    600                 rv = _bcm_th3_int_reg32_get(unit, INT_PROCESS_CONFIGr, TURNAROUND_COPYTO_CPUf, (uint32 *)arg);
    601                 break;
    602 
    603             default:
    604                 rv = BCM_E_UNAVAIL;
    605                 break;
    606         }
    607     }
    608 #endif  /* defined(BCM_TOMAHAWK3_SUPPORT) */
    609 
    610     return rv;
    611 }