pon.h (5368B)
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-2020 Broadcom Inc. All rights reserved. 6 * 7 * File: pon.h 8 * Purpose: PON internal definitions to the BCM library. 9 */ 10 11 #ifndef _BCM_INT_DPP_PON_H_ 12 #define _BCM_INT_DPP_PON_H_ 13 14 #include <soc/dpp/PPD/ppd_api_general.h> 15 #include <soc/dpp/drv.h> 16 17 18 /* 19 * MACROs for PON 20 */ 21 /* given gport ID is it working port*/ 22 #define _BCM_PPD_GPORT_IS_WORKING_PORT_ID(gport) (((gport)%2) == 0) 23 24 /* number of PON ports 25 * For Jericho device & custom_feature_pon_pp_port_mapping_bypass == 1: support 64 PON ports 26 * For Jericho device & custom_feature_pon_pp_port_mapping_bypass == 0: support 16 PON ports 27 * For Jericho below device: support 8 PON ports 28 */ 29 #define _BCM_PPD_NOF_PON_PHY_PORT(unit) (_BCM_PPD_PON_PP_PORT_MAPPING_BY_PASS_IN_JER(unit) ? 64 : (SOC_IS_JERICHO(unit) ? 16 : 8)) 30 31 32 /* default number of PON channel profiles */ 33 #define _BCM_PPD_DEFAULT_NOF_PON_CHANNEL_PROFILE(unit) (_BCM_PPD_NOF_PON_PP_PORT(unit)/_BCM_PPD_NOF_PON_PHY_PORT(unit)) 34 35 /* number of PON PP ports 36 * In case PP PP port mapping is bypass, PON port is equel to PON PP port. 37 */ 38 #define _BCM_PPD_NOF_PON_PP_PORT(unit) (_BCM_PPD_PON_PP_PORT_MAPPING_BY_PASS_IN_JER(unit) ? _BCM_PPD_NOF_PON_PHY_PORT(unit) : 128) 39 40 #define _BCM_PPD_IS_PON_PP_PORT(pon_pp_port, unit) (((pon_pp_port) >= 0) && ((pon_pp_port) < _BCM_PPD_NOF_PON_PP_PORT(unit))) 41 42 /* PON channel default profile */ 43 #define _BCM_PPD_PON_CHANNEL_DEFAULT_PROFILE (0) 44 45 /* number of PON channel profiles when PON port is channelized */ 46 #define _BCM_PPD_NOF_PON_CHANNEL_PROFILE(unit, nof_channels) (_BCM_PPD_DEFAULT_NOF_PON_CHANNEL_PROFILE(unit)/(1<<((nof_channels)-1))) 47 48 /* Default offset of PON channel profiles */ 49 #define _BCM_PPD_GPORT_PON_PP_PORT_CHANNEL_PROFILE_DEFAULT_OFFSET(unit) (SOC_IS_JERICHO(unit) ? 4 : 3) 50 51 /* offset of PON channel profiles */ 52 #define _BCM_PPD_GPORT_PON_PP_PORT_CHANNEL_PROFILE_OFFSET(unit, nof_channels) (_BCM_PPD_GPORT_PON_PP_PORT_CHANNEL_PROFILE_DEFAULT_OFFSET(unit)+((nof_channels)-1)) 53 54 /* given PON PP port returns physical port */ 55 #define _BCM_PPD_GPORT_PON_TO_PHY_PORT(unit, pon_pp_port) ((pon_pp_port)&(_BCM_PPD_NOF_PON_PHY_PORT(unit)-1)) 56 57 /* given PON PP port returns local port */ 58 #define _BCM_PPD_GPORT_PON_TO_LOCAL_PORT(pon_pp_port, offset) ((pon_pp_port)&((1<<(offset))-1)) 59 60 /* given PON PP port returns PON channel profile */ 61 #define _BCM_PPD_GPORT_PON_PP_PORT_TO_CHANNEL_PROFILE(unit, pon_pp_port, offset) (((pon_pp_port)>>(offset))&(_BCM_PPD_DEFAULT_NOF_PON_CHANNEL_PROFILE(unit)-1)) 62 63 /* given PON port and PON channel profile returns PON PP port */ 64 #define _BCM_PPD_GPORT_PON_CHANNEL_PROFILE_TO_PON_PP_PORT(pon_port, pon_channel_profile, offset) (((pon_channel_profile)<<(offset))|(pon_port)) 65 66 67 /* 68 * Function: 69 * _bcm_dpp_pon_port_is_pon_port 70 * Purpose: 71 * Check if the port is PON port 72 * Parameters: 73 * unit - (IN) Device Number 74 * port - (IN) Device PP port Number 75 * is_pon_port - (OUT) TRUE/FALSE 76 * Returns: 77 * BCM_E_XXX 78 */ 79 int _bcm_dpp_pon_port_is_pon_port(int unit, bcm_port_t port, int *is_pon_port); 80 81 /* 82 * Function: 83 * _bcm_dpp_pon_lif_is_3_tags_data 84 * Purpose: 85 * Check if the given lif index is 3 TAGs manipulation. 86 * Parameters: 87 * unit - (IN) Device Number 88 * out_lif_id - (IN) out lif index 89 * is_3_tags_data - (OUT) TRUE/FALSE 90 * Returns: 91 * BCM_E_XXX 92 */ 93 int _bcm_dpp_pon_lif_is_3_tags_data(int unit, int out_lif_id, int *is_3_tags_data); 94 95 /* 96 * Function: 97 * _bcm_dpp_pon_encap_data_enty_add 98 * Purpose: 99 * Add an EEDB entry with PON Tunnel info 100 * Parameters: 101 * unit - (IN) Device Number 102 * entry_index - (IN) Data entry index 103 * tpid - (IN) Tpid for out Tunnel Tag 104 * tunnel_id - (IN) Tunnel_id for out Tunnel Tag 105 * out_ac_id - (IN) Out AC index 106 * Returns: 107 * BCM_E_XXX 108 */ 109 int _bcm_dpp_pon_encap_data_enty_add(int unit, uint32 entry_index, uint16 tpid, 110 bcm_tunnel_id_t tunnel_id, uint32 out_ac_id); 111 112 /* 113 * Function: 114 * _bcm_dpp_pon_encap_data_enty_get 115 * Purpose: 116 * Get PON Tunnel info of an EEDB entry 117 * Parameters: 118 * unit - (IN) Device Number 119 * entry_index - (IN) Data entry index 120 * tpid - (OUT) Tpid for out Tunnel Tag 121 * pcp - (OUT) Pcp for out Tunnel Tag 122 * tunnel_id - (OUT) Tunnel_id for out Tunnel Tag 123 * out_ac_id - (OUT) Out AC index 124 * Returns: 125 * BCM_E_XXX 126 */ 127 int _bcm_dpp_pon_encap_data_enty_get(int unit, uint32 entry_index, uint16 *tpid, 128 int *pcp, bcm_tunnel_id_t *tunnel_id, int *out_ac_id); 129 130 /* 131 * Function: 132 * _bcm_dpp_gport_delete_global_and_local_lif 133 * Purpose: 134 * Given global and local lif, removes them. If remove_glem_entry is set, removes the glem entry according to global lif as well. 135 * Parameters: 136 * unit - (IN) Device Number 137 * global_lif - (IN) Global lif to be deallocated. 138 * local_inlif_id - (IN) Local inlif to be deallocated. 139 * local_outlif_id - (IN) Local outlif to be deallocated. 140 * remove_glem_entry - (IN) True will remove Glem entry from HW, false will not. 141 * 142 * Returns: 143 * BCM_E_XXX 144 */ 145 146 #endif /* _BCM_INT_DPP_PON_H_ */