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

port.c (2841B)


      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:        port.c
      8  * Purpose:     Hercules port function implementations
      9  */
     10 
     11 #include <soc/defs.h>
     12 
     13 #if defined(BCM_HERCULES_SUPPORT) || defined(BCM_HUMV_SUPPORT)|| \
     14         defined(BCM_CONQUEROR_SUPPORT) || defined(BCM_TRIDENT_SUPPORT)
     15 
     16 #include <soc/ptable.h>
     17 
     18 #include <bcm/port.h>
     19 #include <bcm/error.h>
     20 
     21 #include <bcm_int/esw/mbcm.h>
     22 #include <bcm_int/esw/hercules.h>
     23 
     24 int
     25 bcm_hercules_port_cfg_get(int unit, bcm_port_t port, bcm_port_cfg_t *cfg)
     26 {
     27     sal_memset(cfg, 0, sizeof(*cfg));
     28     cfg->pc_cml = PVP_CML_SWITCH;
     29     cfg->pc_stp_state = PVP_STP_FORWARDING;
     30     cfg->pc_vlan = 1;
     31     SOC_PBMP_ASSIGN(cfg->pc_pbm, PBMP_PORT_ALL(unit));
     32 
     33     /*
     34      * Interpret spanning tree state;  From Daniel Tai:
     35      *
     36      * TX_EN in MAC_TXCTRL
     37      * RX_EN in MAC_RXCTRL
     38      *
     39      * Ports may be enabled/disabled by programming the BigMAC.
     40      *
     41      * DISABLED  = both TX/RX disabled on MAC
     42      * BLOCKING  = RX enabled, TX disabled, all tables programmed to
     43      *             drop execept for CPU packets
     44      * LISTENING = RX enabled, TX enabled, all tables programmed to
     45      *             drop execept for CPU packets
     46      * LEARNING  = N/A
     47      * FORWARDING = both TX/RX enabled, all tables programmed
     48      *              normally
     49      */
     50 
     51     return BCM_E_NONE;
     52 }
     53 
     54 int
     55 bcm_hercules_port_cfg_set(int unit, bcm_port_t port, bcm_port_cfg_t *cfg)
     56 {
     57 #if defined(HERCULES_DEBUG_CHECKING)
     58     /*
     59      * Check the following are 0:
     60      *    pc_mirror_ing, pc_vlan, pc_pbm, pc_ut_pbm, pc_l3_enable,
     61      *    pc_new_pri, pc_remap_pri_en, pc_dse_mode, pc_dscp,
     62      *    pc_frame_type, pc_ether_type,
     63      *
     64      * Issues:
     65      *    pc_cml, pc_cpu, pc_disc, pc_bpdu_disable, pc_trunk, pc_tgid,
     66      */
     67 #endif
     68     /*
     69      * Settable parameters include:
     70      *     pc_stp_state:  Get rx/tx enable state from mac registers
     71      */
     72 
     73     return BCM_E_NONE;
     74 }
     75 
     76 /*
     77  * Function:
     78  *	bcm_hercules_port_cfg_init
     79  * Purpose:
     80  *	Initialize the port tables according to Initial System
     81  *	Configuration (see init.c)
     82  * Parameters:
     83  *	unit - StrataSwitch unit number.
     84  *	port - Port number
     85  *	vd - Initial VLAN data information
     86  */
     87 
     88 int
     89 bcm_hercules_port_cfg_init(int unit, bcm_port_t port, bcm_vlan_data_t *vd)
     90 {
     91     return BCM_E_NONE;
     92 }
     93 
     94 /* Placeholder routines for unsupported functionality */
     95 
     96 int
     97 bcm_hercules_port_rate_egress_set(int unit, int port,
     98 				  uint32 kbits_sec,
     99 				  uint32 kbits_burst, uint32 mode)
    100 {
    101     return BCM_E_UNAVAIL;
    102 }
    103 
    104 int
    105 bcm_hercules_port_rate_egress_get(int unit, int port,
    106 				  uint32 *kbits_sec,
    107 				  uint32 *kbits_burst, uint32 *mode)
    108 {
    109     return BCM_E_UNAVAIL;
    110 }
    111 
    112 
    113 #endif	/* BCM_HERCULES_SUPPORT */