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

cmicx_hdr.c (9012B)


      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  * Purpose:     CMICX driver for EP_2_CPU_HDR
      8  */
      9 
     10 #include <sal/core/boot.h>
     11 #include <sal/core/libc.h>
     12 #include <shared/alloc.h>
     13 #include <shared/bsl.h>
     14 
     15 #include <soc/debug.h>
     16 #include <soc/dma.h>
     17 #include <soc/drv.h>
     18 #include <soc/dcb.h>
     19 #include <soc/dcbformats.h>
     20 
     21 #ifdef BCM_CMICX_SUPPORT
     22 
     23 #if defined(BCM_TRIDENT3_SUPPORT)
     24 static void
     25 soc_dma_ep_2_cpu_hdr36_decoded_dump(int unit, char *prefix, void *addr, int skip_mhdr, int hdr_size)
     26 {
     27     uint8       *c;
     28     ep_to_cpu_hdr36_t *h = (ep_to_cpu_hdr36_t *)addr;
     29 
     30 #if defined(LE_HOST)
     31     int         word;
     32     uint32 *hdr_data = (uint32 *)addr;
     33     for (word = 0; word < BYTES2WORDS(hdr_size); word++) {
     34         hdr_data[word] = _shr_swap32(hdr_data[word]);
     35     }
     36 #endif
     37     c = (uint8 *)addr;
     38 
     39     if (!skip_mhdr) {
     40         soc_dma_higig_dump(unit, prefix, c, 0, 0, NULL);
     41     }
     42 
     43     LOG_CLI((BSL_META_U(unit,
     44                         "%s\t%schg_tos %schg_ecn\n"),
     45              prefix,
     46              h->chg_tos ? "" : "!",
     47              h->word8.overlay1.chg_ecn ? "" : "!"));
     48 
     49     LOG_CLI((BSL_META_U(unit,
     50                         "%s\t%sservice_tag %sswitch_pkt %suc_switch_drop %ssrc_hg\n"),
     51              prefix,
     52              h->service_tag ? "" : "!",
     53              h->switch_pkt ? "" : "!",
     54              h->uc_switch_drop ? "" : "!",
     55              h->src_hg ? "" : "!"));
     56 
     57     LOG_CLI((BSL_META_U(unit,
     58                         "%s\t%sl3only %sreplicated %sdo_not_change_ttl "
     59              "%sbpdu\n"),
     60              prefix,
     61              h->l3only ? "" : "!",
     62              h->replicated ? "" : "!",
     63              h->do_not_change_ttl ? "" : "!",
     64              h->bpdu ? "" : "!"));
     65 
     66     switch (h->word16.overlay1.eh_type) {
     67         case 0:
     68             LOG_CLI((BSL_META_U(unit,
     69                                 "%s\tHigig2 Extension type 0: queue_tag=0x%04x "
     70                      "tag_type=%d seg_sel=%d\n"),
     71                      prefix,
     72                      h->word16.overlay1.eh_queue_tag,
     73                      h->word16.overlay1.eh_tag_type,
     74                      h->word16.overlay1.eh_seg_sel));
     75             break;
     76         case 1:
     77             LOG_CLI((BSL_META_U(unit,
     78                                 "%s\tHigig2 Extension type 1: classid=%d l3_iif=%d "
     79                      "classid_type=%d\n"),
     80                      prefix,
     81                      h->word16.overlay2.classid,
     82                      h->word16.overlay2.l3_iif,
     83                      h->word16.overlay2.classid_type));
     84             break;
     85         case 2:
     86             LOG_CLI((BSL_META_U(unit,
     87                                 "%s\tHigig2 Extension type 2: queue_tag=0x%04x classid=%d "
     88                      "classid_type=%d\n"),
     89                      prefix,
     90                      h->word16.overlay3.eh_queue_tag,
     91                      h->word16.overlay3.classid,
     92                      h->word16.overlay3.classid_type));
     93             break;
     94         default:
     95             break;
     96     }
     97 
     98     LOG_CLI((BSL_META_U(unit,
     99                         "%s\treason=%08x_%08x\n"),
    100              prefix,
    101              h->reason_hi,
    102              h->reason));
    103 
    104     LOG_CLI((BSL_META_U(unit,
    105                         "%s\tts_type=%d timestamp=%08x\n"),
    106              prefix,
    107              h->timestamp_type,
    108              h->timestamp));
    109 
    110     LOG_CLI((BSL_META_U(unit,
    111                         "%s\tsrcport=%d cpu_cos=%d pkt_len=%d forwarding_type=%d "
    112              "ucq=%05x\n"),
    113              prefix,
    114              h->word8.overlay1.srcport,
    115              h->word8.overlay1.cpu_cos,
    116              h->word8.overlay1.pkt_len,
    117              h->forwarding_type,
    118              h->ucq));
    119 
    120     LOG_CLI((BSL_META_U(unit,
    121                         "%s\touter_vid=%d outer_cfi=%d outer_pri=%d otag_action=%d "
    122              "vntag_action=%d\n"),
    123              prefix,
    124              h->outer_vid,
    125              h->outer_cfi,
    126              h->word6.overlay1.outer_pri,
    127              h->otag_action,
    128              h->vntag_action));
    129 
    130     LOG_CLI((BSL_META_U(unit,
    131                         "%s\tinner_vid=%d inner_cfi=%d inner_pri=%d "
    132              "decap = %d itag_action=%d\n"),
    133              prefix,
    134              h->inner_vid,
    135              h->word6.overlay1.inner_cfi,
    136              h->word6.overlay1.inner_pri,
    137              h->decap_tunnel_type,
    138              h->itag_action));
    139 
    140     LOG_CLI((BSL_META_U(unit,
    141                         "%s\tdscp=%d ecn=%d decap_tunnel_type=%d match_rule=%d "
    142              "mtp_ind=%d forwarding_zone_id=%d\n"),
    143              prefix,
    144              h->dscp,
    145              h->word8.overlay1.ecn,
    146              h->decap_tunnel_type,
    147              h->match_rule,
    148              h->mtp_index,
    149              h->forwarding_zone_id));
    150 }
    151 #endif
    152 
    153 
    154 #if defined(BCM_TOMAHAWK3_SUPPORT)
    155 static void
    156 soc_dma_ep_2_cpu_hdr38_decoded_dump(int unit, char *prefix, void *addr, int skip_mhdr, int hdr_size)
    157 {
    158     uint8       *c;
    159     ep_to_cpu_hdr38_t *h = (ep_to_cpu_hdr38_t *)addr;
    160 
    161 #if defined(LE_HOST)
    162     int         word;
    163     uint32 *hdr_data = (uint32 *)addr;
    164     for (word = 0; word < BYTES2WORDS(hdr_size); word++) {
    165         hdr_data[word] = _shr_swap32(hdr_data[word]);
    166     }
    167 #endif
    168     c = (uint8 *)addr;
    169 
    170     if (!skip_mhdr) {
    171         soc_dma_higig_dump(unit, prefix, c, 0, 0, NULL);
    172     }
    173 
    174     LOG_CLI((BSL_META_U(unit,
    175                         "%s\treason=%08x_%08x\n"),
    176              prefix,
    177              h->reason_hi,
    178              h->reason));
    179 
    180     LOG_CLI((BSL_META_U(unit,
    181                         "%s\tts_type=%d timestamp_hi=%08x timestamp=%08x\n"),
    182              prefix,
    183              h->timestamp_type,
    184              h->timestamp_hi,
    185              h->timestamp));
    186 
    187     LOG_CLI((BSL_META_U(unit,
    188                         "%s\tdecap_tunnel_type=%d %suc_switch_drop %sucq\n"),
    189              prefix,
    190              h->decap_tunnel_type,
    191              h->uc_switch_drop ? "" : "!",
    192              h->ucq ? "" : "!"));
    193 
    194     LOG_CLI((BSL_META_U(unit,
    195                         "%s\tsrcport=%d %sswitch_pkt %sspecial_pkt_indicator\n"),
    196              prefix,
    197              h->srcport,
    198              h->switch_pkt ? "" : "!",
    199              h->special_pkt_indicator ? "" : "!"));
    200 
    201     LOG_CLI((BSL_META_U(unit,
    202                         "%s\tpkt_len=%d %sregen_crc replication_or_nhi=%d\n"),
    203              prefix,
    204              h->pkt_len,
    205              h->regen_crc ? "" : "!",
    206              h->replication_or_nhi));
    207 
    208     LOG_CLI((BSL_META_U(unit,
    209                         "%s\touter_vid=%d outer_cfi=%d outer_pri=%d mtp_index=%d "
    210              "match_rule=%d loopback_pkt_type=%d\n"),
    211              prefix,
    212              h->outer_vid,
    213              h->outer_cfi,
    214              h->outer_pri,
    215              h->mtp_index,
    216              h->match_rule,
    217              h->loopback_pkt_type));
    218 
    219     LOG_CLI((BSL_META_U(unit,
    220                         "%s\tcpu_opcode_type=%d dscp=%d ecn=%d tag_status=%d "
    221              "%sdo_not_change_ttl\n"),
    222              prefix,
    223              h->word3.overlay1.cpu_opcode_type,
    224              h->word3.overlay1.dscp,
    225              h->word3.overlay1.ecn,
    226              h->word3.overlay1.tag_status,
    227              h->word3.overlay1.do_not_change_ttl ? "" : "!"));
    228 
    229     LOG_CLI((BSL_META_U(unit,
    230                         "%s\ting_l3_intf=%d otag_action=%d %sip_routed %sl3only\n"),
    231              prefix,
    232              h->word3.overlay1.ing_l3_intf,
    233              h->word3.overlay1.otag_action,
    234              h->word3.overlay1.ip_routed ? "" : "!",
    235              h->word3.overlay1.l3only ? "" : "!"));
    236 
    237     LOG_CLI((BSL_META_U(unit,
    238                         "%s\t%sbpdu %schg_dscp %schg_ecn\n"),
    239              prefix,
    240              h->word0.overlay1.bpdu ? "" : "!",
    241              h->word0.overlay1.chg_dscp ? "" : "!",
    242              h->word0.overlay1.chg_ecn ? "" : "!"));
    243 
    244     LOG_CLI((BSL_META_U(unit,
    245                         "%s\trx_bfd_session_index=%d rx_bfd_start_offset_type=%d rx_bfd_start_offset=%d "
    246              "queue_num=%d\n"),
    247              prefix,
    248              h->word0.overlay1.rx_bfd_session_index,
    249              h->word0.overlay1.rx_bfd_start_offset_type,
    250              h->word0.overlay1.rx_bfd_start_offset,
    251              h->word0.overlay1.queue_num));
    252 
    253     LOG_CLI((BSL_META_U(unit,
    254                         "%s\ti2e_classid=%d i2e_classid_type=%d "
    255              "cpu_cos=%d\n"),
    256              prefix,
    257              h->word0.overlay2.i2e_classid,
    258              h->word0.overlay2.i2e_classid_type,
    259              h->word0.overlay2.cpu_cos));
    260 }
    261 #endif
    262 
    263 void soc_dma_ep_to_cpu_hdr_decoded_dump(int unit, char *pfx, void *addr,
    264                                 int skip_mhdr, int hdr_size)
    265 {
    266 #if defined(BCM_TRIDENT3_SUPPORT)
    267     if (SOC_IS_TRIDENT3X(unit)) {
    268         soc_dma_ep_2_cpu_hdr36_decoded_dump(unit, pfx, addr, skip_mhdr, hdr_size);
    269     }
    270 #endif
    271 #if defined(BCM_TOMAHAWK3_SUPPORT)
    272     if (SOC_IS_TOMAHAWK3(unit)) {
    273         soc_dma_ep_2_cpu_hdr38_decoded_dump(unit, pfx, addr, skip_mhdr, hdr_size);
    274     }
    275 #endif
    276 }
    277 
    278 #endif /* BCM_CMICX_SUPPORT */