tdm_th2_shim.c (2767B)
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 * $All Rights Reserved.$ 7 * 8 * TDM chip to core API shim layer 9 */ 10 #ifdef _TDM_STANDALONE 11 #include <tdm_top.h> 12 #else 13 #include <soc/tdm/core/tdm_top.h> 14 #endif 15 16 17 /** 18 @name: tdm_chip_th2_shim__check_ethernet 19 @param: 20 21 Upward abstraction layer between TDM.4 and TDM.5 API 22 */ 23 tdm_mod_t* 24 tdm_chip_th2_shim__check_ethernet_d( int port, enum port_speed_e speed[TH2_NUM_EXT_PORTS], enum port_state_e state[TH2_NUM_EXT_PORTS], int **tsc, int traffic[TH2_NUM_PM_MOD] ) 25 { 26 int idx1, idx2; 27 tdm_mod_t *_tdm_s; 28 29 _tdm_s = TDM_ALLOC(sizeof(tdm_mod_t),"TDM shim allocation"); 30 if (!_tdm_s) { 31 return NULL; 32 } 33 34 _tdm_s->_chip_data.soc_pkg.speed=TDM_ALLOC(TH2_NUM_EXT_PORTS*sizeof(int *), "port speed list"); 35 for (idx1=0; idx1<TH2_NUM_EXT_PORTS; idx1++) { 36 _tdm_s->_chip_data.soc_pkg.speed[idx1] = speed[idx1]; 37 } 38 _tdm_s->_chip_data.soc_pkg.state=TDM_ALLOC(TH2_NUM_EXT_PORTS*sizeof(int *), "port state list"); 39 for (idx1=0; idx1<TH2_NUM_EXT_PORTS; idx1++) { 40 _tdm_s->_chip_data.soc_pkg.state[idx1] = state[idx1]; 41 } 42 _tdm_s->_chip_data.soc_pkg.pmap_num_modules = TH2_NUM_PHY_PM; 43 _tdm_s->_chip_data.soc_pkg.pmap_num_lanes = TH2_NUM_PM_LNS; 44 _tdm_s->_chip_data.soc_pkg.pmap=(int **) TDM_ALLOC((_tdm_s->_chip_data.soc_pkg.pmap_num_modules)*sizeof(int *), "portmod_map_l1"); 45 for (idx1=0; idx1<(_tdm_s->_chip_data.soc_pkg.pmap_num_modules); idx1++) { 46 _tdm_s->_chip_data.soc_pkg.pmap[idx1]=(int *) TDM_ALLOC((_tdm_s->_chip_data.soc_pkg.pmap_num_lanes)*sizeof(int), "portmod_map_l2"); 47 TDM_MSET(_tdm_s->_chip_data.soc_pkg.pmap[idx1],(_tdm_s->_chip_data.soc_pkg.num_ext_ports),_tdm_s->_chip_data.soc_pkg.pmap_num_lanes); 48 } 49 for (idx1=0; idx1<TH2_NUM_PHY_PM; idx1++) { 50 for (idx2=0; idx2<TH2_NUM_PM_LNS; idx2++) { 51 _tdm_s->_chip_data.soc_pkg.pmap[idx1][idx2] = tsc[idx1][idx2]; 52 } 53 } 54 /* _tdm_s->_chip_data.soc_pkg.soc_vars.th2.pm_encap_type=sal_alloc(TH2_NUM_PM_MOD*sizeof(int *), "traffic encap"); */ 55 for (idx1=0; idx1<TH2_NUM_PM_MOD; idx1++) { 56 _tdm_s->_chip_data.soc_pkg.soc_vars.th2.pm_encap_type[idx1] = traffic[idx1]; 57 } 58 59 _tdm_s->_core_data.vars_pkg.port = port; 60 return _tdm_s; 61 62 } 63 64 65 /** 66 @name: tdm_chip_th2_shim__core_vbs_scheduler_ovs 67 @param: 68 69 Passthru function for oversub scheduling request from TD2/TD2+ 70 */ 71 int 72 tdm_chip_th2_shim__core_vbs_scheduler_ovs( tdm_mod_t *_tdm ) 73 { 74 75 if (_tdm->_chip_data.soc_pkg.flex_port_en) { 76 /* Used for FlexPort */ 77 /*return tdm_th2_vbs_scheduler_ovs_flex_port(_tdm);*/ 78 return tdm_th2_vbs_scheduler_ovs_flex_port_delta(_tdm); 79 } else { 80 /* Used for initial config */ 81 return tdm_th2_vbs_scheduler_ovs(_tdm); 82 } 83 }