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 (5405B)


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