l3_fec.h (4126B)
1 /* 2 * ! \file bcm_int/dnx/l3/l3_fec.h Internal DNX L3 FEC APIs 3 PIs This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 PIs 5 PIs Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 */ 7 8 #ifndef _L3_FEC_API_INCLUDED__ 9 /* 10 * { 11 */ 12 #define _L3_FEC_API_INCLUDED__ 13 14 #ifndef BCM_DNX_SUPPORT 15 #error "This file is for use by DNX (JR2) family only!" 16 #endif 17 18 #include <bcm/l3.h> 19 #include <soc/dnx/mdb.h> 20 #include <bcm_int/dnx/algo/l3/algo_l3.h> 21 /* 22 * DEFINES 23 * { 24 */ 25 26 /* 27 * Each FEC belongs to one of three hierarchies where each hierarchy has its own FEC table (FEC_1/2/3), the following MACRO selects 28 * the correct FEC table according to the hierarchy. 29 */ 30 #define L3_FEC_TABLE_FROM_HIERARCHY_GET(hierarchy) ((hierarchy == DBAL_ENUM_FVAL_HIERARCHY_LEVEL_HIERARCHY_LEVEL_1) ? \ 31 DBAL_TABLE_SUPER_FEC_1ST_HIERARCHY : ((hierarchy == DBAL_ENUM_FVAL_HIERARCHY_LEVEL_HIERARCHY_LEVEL_2) ? \ 32 DBAL_TABLE_SUPER_FEC_2ND_HIERARCHY : DBAL_TABLE_SUPER_FEC_3RD_HIERARCHY)) 33 34 /* 35 * Translating fec_id to the fec_enyry instance in super fec 36 * entry 37 */ 38 #define L3_FEC_ID_TO_FEC_INSTANCE(_fec_id_) (_fec_id_ & 1) 39 40 /** Translate fec_id to odd fec id (bitwise OR with 1) */ 41 #define L3_FEC_ID_TO_ODD_FEC_ID(_fec_id_) (_fec_id_ | 1) 42 43 /** Translate fec_id to even fec id (divide and multiply by 2) */ 44 #define L3_FEC_ID_TO_EVEN_FEC_ID(_fec_id_) ((_fec_id_ / 2) * 2 ) 45 46 /** Return TRUE if fec id is odd */ 47 #define L3_FEC_ID_IS_ODD_FEC_ID(_fec_id_) ((_fec_id_ % 2) == 1) 48 49 /** Return TRUE if fec id is even */ 50 #define L3_FEC_ID_IS_EVEN_FEC_ID(_fec_id_) ((_fec_id_ % 2) == 0) 51 52 /* 53 * } 54 */ 55 56 /* 57 * FUNCTIONS 58 * { 59 */ 60 61 /** 62 * \brief 63 * Creation function for bcm_l3_egress_create with BCM_L3_INGRESS_ONLY flag. 64 * 65 * \param [in] unit - Relevant unit. 66 * \param [in] flags - Similar to bcm_l3_egress_create api input 67 * \param [in] egr - Similar to bcm_l3_egress_create api input 68 * \param [in] if_id - Similar to bcm_l3_egress_create api input 69 * \return 70 * shr_error_e - 71 * Error return value 72 */ 73 shr_error_e dnx_l3_egress_create_fec( 74 int unit, 75 uint32 flags, 76 bcm_l3_egress_t * egr, 77 bcm_if_t * if_id); 78 79 /** 80 * \brief 81 * Retreive a L3 egress object ingress side information 82 * 83 * \param [in] unit - Relevant unit. 84 * \param [in] intf - egress object ID . 85 * \param [in] egr - structure holding the egress object . 86 * [in] egr.flags, bit BCM_L3_HIT_CLEAR - 87 * If set then, when getting the 'hit' bit, it is also cleared. 88 * [out] egr.flags, bit BCM_L3_HIT - 89 * If set then 'hit' bit was found to have been 'set'. 90 * [out] egr.mac_addr - Next hop forwarding destination mac Next hop vlan id 91 * [out] egr.vlan - Next hop vlan id Encapsulation index 92 * [out] egr.encap_id - Encapsulation index 93 * [out] egr.port - Outgoing port id (if !BCM_L3_TGID) 94 * [out] egr.trunk - Outgoing Trunk id (if BCM_L3_TGID) General QOS map id 95 * [out] egr.qos_map_id - General QOS map id 96 * [out] egr.failover_id - Failover Object Index Failover Egress Object index 97 * [out] egr.failover_if_id - Failover Egress Object index 98 * 99 * \return 100 * \retval Zero if no error was detected 101 * \retval Negative if error was detected. See \ref shr_error_e 102 * \remark 103 * * None 104 * \see 105 * * None 106 */ 107 shr_error_e dnx_l3_egress_fec_info_get( 108 int unit, 109 bcm_if_t intf, 110 bcm_l3_egress_t * egr); 111 112 /** 113 * \brief 114 * Delete L3 egress object ingress side information 115 * 116 * \param [in] unit - Relevant unit. 117 * \param [in] intf - egress object ID . 118 * 119 * \return 120 * \retval Zero if no error was detected 121 * \retval Negative if error was detected. See \ref shr_error_e 122 * \remark 123 * * None 124 * \see 125 * * None 126 */ 127 128 shr_error_e dnx_l3_egress_fec_info_delete( 129 int unit, 130 bcm_if_t intf); 131 132 /* L3 CINT exported API - START */ 133 134 shr_error_e dnx_cint_l3_fec_hierarchy_stage_map_set( 135 int unit, 136 int *bank_ids, 137 char *hierarchy_name); 138 139 /* L3 CINT exported API - END */ 140 /* 141 * } 142 */ 143 144 /* 145 * } 146 */ 147 #endif/*_L3_FEC_API_INCLUDED__*/