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

subport.c (5601B)


      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  * File:       subport.c
      8  * Purpose:    Subport and CoE related functions for Apache.
      9  */
     10 
     11 #include <soc/defs.h>
     12 #include <sal/core/libc.h>
     13 #include <shared/bsl.h>
     14 
     15 #include <soc/drv.h>
     16 #include <soc/mem.h>
     17 #include <soc/util.h>
     18 #include <soc/debug.h>
     19 #include <bcm/error.h>
     20 #include <bcm/subport.h>
     21 
     22 #include <bcm_int/esw/subport.h>
     23 #include <bcm_int/esw_dispatch.h>
     24 #include <bcm_int/esw/triumph.h>
     25 #include <bcm_int/esw/triumph2.h>
     26 #include <bcm_int/esw/xgs5.h>
     27 #include <bcm_int/esw/trident2plus.h>
     28 #include <bcm_int/esw/apache.h>
     29 
     30 /*
     31  * Function Vector
     32  */
     33 static bcm_esw_subport_drv_t bcm_apache_subport_drv = {
     34 
     35 #if defined(BCM_TRIUMPH2_SUPPORT) && defined(INCLUDE_L3)
     36     /* subport_init                */ bcm_tr2_subport_init,
     37     /* subport_group_create        */ bcm_tr2_subport_group_create,
     38     /* subport_group_get           */ bcm_tr2_subport_group_get,
     39     /* subport_group_traverse      */ NULL,
     40     /* subport_group_destroy       */ bcm_tr2_subport_group_destroy,
     41     /* subport_linkphy_config_set  */ NULL,
     42     /* subport_linkphy_config_get  */ NULL,
     43     /* subport_port_add            */ bcm_tr2_subport_port_add,
     44     /* subport_port_get            */ bcm_tr2_subport_port_get,
     45     /* subport_port_traverse       */ bcm_tr2_subport_port_traverse,
     46     /* subport_port_stat_set       */ NULL,
     47     /* subport_port_stat_get       */ NULL,
     48     /* subport_port_delete         */ bcm_tr2_subport_port_delete,
     49     /* subport_cleanup             */ bcm_tr2_subport_cleanup,
     50 #else
     51     NULL, NULL, NULL, NULL, NULL,
     52     NULL, NULL, NULL, NULL, NULL,
     53     NULL, NULL, NULL, NULL,
     54 #endif
     55 
     56     /* coe_init                */ bcm_apache_subport_coe_init,
     57     /* coe_group_create        */ bcmi_xgs5_subport_coe_group_create,
     58     /* coe_group_get           */ bcmi_xgs5_subport_coe_group_get,
     59     /* coe_group_traverse      */ bcmi_xgs5_subport_coe_group_traverse,
     60     /* coe_group_destroy       */ bcmi_xgs5_subport_coe_group_destroy,
     61     /* coe_linkphy_config_set  */ NULL,
     62     /* coe_linkphy_config_get  */ NULL,
     63     /* coe_port_add            */ bcmi_xgs5_subport_coe_port_add,
     64     /* coe_port_get            */ bcmi_xgs5_subport_coe_port_get,
     65     /* coe_port_traverse       */ bcmi_xgs5_subport_coe_port_traverse,
     66     /* coe_port_stat_set       */ NULL,
     67     /* coe_port_stat_get       */ NULL,
     68     /* coe_port_delete         */ bcmi_xgs5_subport_coe_port_delete,
     69     /* coe_cleanup             */ bcmi_xgs5_subport_coe_cleanup,
     70     /* subport_linkphy_rx_error_register */ NULL,
     71     /* subport_linkphy_rx_error_unregister */ NULL,
     72     /* subport_gport_modport_get */ bcmi_xgs5_subport_gport_modport_get
     73 };
     74 
     75 /*
     76  * Device Specific HW Tables
     77  */
     78 
     79 /* ING Port Table */
     80 static bcmi_xgs5_subport_coe_ing_port_table_t bcmi_apache_subport_coe_ing_port_table = {
     81     /* mem */         PORT_TABm,
     82     /* port_type */ PORT_TYPEf
     83 };
     84 
     85 /* EGR Port Table */
     86 static bcmi_xgs5_subport_coe_egr_port_table_t  bcmi_apache_subport_coe_egr_port_table = {
     87     /* mem */         EGR_PORTm,
     88     /* port_type */ PORT_TYPEf
     89 };
     90 
     91 /* Subport Tag SGPP Memory Table */
     92 static bcmi_xgs5_subport_coe_subport_tag_sgpp_table_t bcmi_apache_subport_coe_subport_tag_sgpp_table = {
     93     /* mem */                          SUBPORT_TAG_SGPP_MAPm,
     94     /* valid */                      VALIDf,
     95     /* subport_tag */                SUBPORT_TAGf,
     96     /* subport_tag_mask */             SUBPORT_TAG_MASKf,
     97     /* subport_tag_namespace */         SUBPORT_TAG_NAMESPACEf,
     98     /* subport_tag_namespace_mask */ SUBPORT_TAG_NAMESPACE_MASKf,
     99     /* src_modid */                  SRC_MODIDf,
    100     /* src_port */                     SRC_PORTf,
    101     /* phb_enable */                 PHB_ENABLEf,
    102     /* int_pri */                     INT_PRIf,
    103     /* cng */                         CNGf
    104 };
    105 
    106 /* Modport map subport Memory Table */
    107 bcmi_xgs5_subport_coe_modport_map_subport_table_t bcmi_apache_subport_coe_modport_map_subport_table = {
    108     /* mem */        MODPORT_MAP_SUBPORTm,
    109     /* dest */         DESTf,
    110     /* is_trunk */     ISTRUNKf,
    111     /* enable */     ENABLEf,
    112 };
    113 
    114 /* Egress subport tag dot1p Table */
    115 static bcmi_xgs5_subport_coe_egr_subport_tag_dot1p_table_t bcmi_apache_subport_coe_egr_subport_tag_dot1p_table = {
    116     /* mem */                   EGR_SUBPORT_TAG_DOT1P_MAPm,
    117     /* subport_tag_priority */  SUBPORT_TAG_PRIORITYf,
    118     /* subport_tag_cfi */       SUBPORT_TAG_RSVD_0f,
    119     /* subport_tag_color */     SUBPORT_TAG_COLORf,
    120 };
    121 
    122 /* HW Definitions */
    123 static bcmi_xgs5_subport_coe_hw_defs_t    bcmi_apache_subport_coe_hw_defs;
    124 
    125 int bcm_apache_subport_coe_init(int unit)
    126 {
    127     /* HW Definition Tables */
    128     sal_memset(&bcmi_apache_subport_coe_hw_defs, 0, sizeof(bcmi_apache_subport_coe_hw_defs));
    129 
    130     bcmi_apache_subport_coe_hw_defs.igr_port =
    131         &bcmi_apache_subport_coe_ing_port_table;
    132     bcmi_apache_subport_coe_hw_defs.egr_port =
    133         &bcmi_apache_subport_coe_egr_port_table;
    134     bcmi_apache_subport_coe_hw_defs.subport_tag_sgpp =
    135         &bcmi_apache_subport_coe_subport_tag_sgpp_table;
    136     bcmi_apache_subport_coe_hw_defs.modport_map_subport =
    137         &bcmi_apache_subport_coe_modport_map_subport_table;
    138     bcmi_apache_subport_coe_hw_defs.egr_subport_tag_dot1p =
    139         &bcmi_apache_subport_coe_egr_subport_tag_dot1p_table;
    140 
    141     /* Initialize Common XGS5 CoE module */
    142     BCM_IF_ERROR_RETURN
    143         (bcmi_xgs5_subport_init(unit, &bcm_apache_subport_drv, &bcmi_apache_subport_coe_hw_defs));
    144     return 0;
    145 }