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

tdm_hx5_scan.c (2242B)


      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 data structure scanning functions
      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_hx5_scan_port_pm_old
     19 @param:
     20 
     21 Returns the PM number to which the input port belongs according to pmap
     22  */
     23 int
     24 tdm_hx5_scan_port_pm_old(tdm_mod_t *_tdm_s)
     25 {
     26     HX5_TOKEN_CHECK(_tdm_s->_core_data.vars_pkg.port) {
     27         return tdm_find_pm( _tdm_s );
     28     }
     29 
     30     return HX5_NUM_EXT_PORTS;
     31 }
     32 
     33 
     34 /**
     35 @name: tdm_hx5_scan_port_pm
     36 @param:
     37 
     38 Returns the PM number to which the input port belongs according to formula
     39  */
     40 int
     41 tdm_hx5_scan_port_pm(tdm_mod_t *_tdm)
     42 {
     43     int port_phy, port_pm;
     44     int param_phy_lo, param_phy_hi, param_pm_lanes;
     45 
     46     param_phy_lo   = _tdm->_chip_data.soc_pkg.soc_vars.fp_port_lo;
     47     param_phy_hi   = _tdm->_chip_data.soc_pkg.soc_vars.fp_port_hi;
     48     param_pm_lanes = _tdm->_chip_data.soc_pkg.pmap_num_lanes;
     49     
     50     port_pm   = _tdm->_chip_data.soc_pkg.num_ext_ports;
     51     port_phy = _tdm->_core_data.vars_pkg.port;
     52     
     53     if (port_phy>=param_phy_lo && port_phy<=param_phy_hi && param_pm_lanes>0) {
     54         port_pm = (port_phy-1)/param_pm_lanes;
     55     }
     56 
     57     return port_pm;
     58 }
     59 
     60 
     61 /**
     62 @name: tdm_hx5_scan_pipe_ethernet
     63 @param:
     64 
     65 Returns BOOL_TRUE if pipe of the given port has traffic entirely Ethernet,
     66 otherwise returns BOOL_FALSE.
     67  */
     68 int
     69 tdm_hx5_scan_pipe_ethernet(tdm_mod_t *_tdm)
     70 {
     71     int i, idx_s=0, idx_e=0, port, port_speed, port_state, result=BOOL_TRUE;
     72 
     73     port = _tdm->_core_data.vars_pkg.port;
     74 
     75     if (port<=64) {
     76         idx_s = 1;
     77         idx_e = 64;
     78     } else if (port<=128){
     79         idx_s = 65;
     80         idx_e = 128;
     81     }
     82 
     83     for (i=idx_s; i<idx_e; i++) {
     84         port_state = _tdm->_chip_data.soc_pkg.state[i-1];
     85         port_speed = _tdm->_chip_data.soc_pkg.speed[i];
     86         if ( (port_speed>SPEED_0) && 
     87              (port_state==PORT_STATE__LINERATE_HG ||
     88               port_state==PORT_STATE__OVERSUB_HG   ) ){
     89             result = BOOL_FALSE;
     90             break;
     91         }
     92     }
     93 
     94     return result;
     95 }