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

l3.c (3938B)


      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:        l3.c
      8  * Purpose:     Scorpion L3 functions implementations
      9  */
     10 
     11 
     12 #include <soc/defs.h>
     13 
     14 #include <assert.h>
     15 
     16 #include <sal/core/libc.h>
     17 #if defined(BCM_SCORPION_SUPPORT) && defined(INCLUDE_L3)
     18 
     19 #include <shared/util.h>
     20 #include <soc/mem.h>
     21 #include <soc/cm.h>
     22 #include <soc/drv.h>
     23 #include <soc/register.h>
     24 #include <soc/memory.h>
     25 #include <soc/l3x.h>
     26 #include <soc/lpm.h>
     27 #include <soc/tnl_term.h>
     28 
     29 #include <bcm/l3.h>
     30 #include <bcm/tunnel.h>
     31 #include <bcm/debug.h>
     32 #include <bcm/error.h>
     33 #include <bcm/stack.h>
     34 
     35 #include <bcm_int/esw/mbcm.h>
     36 #include <bcm_int/esw/firebolt.h>
     37 #include <bcm_int/esw/trx.h>
     38 #include <bcm_int/esw/scorpion.h>
     39 #include <bcm_int/esw/l3.h>
     40 #include <bcm_int/esw/xgs3.h>
     41 #include <bcm_int/esw_dispatch.h>
     42 
     43 /*                                                                                                
     44  * Function:                                                                                      
     45  *      _bcm_sc_defip_init                                                                  
     46  * Purpose:                                                                                       
     47  *      Initialize L3 DEFIP table for scorpion devices.                                                
     48  * Parameters:                                                                                    
     49  *      unit    - (IN)  SOC unit number.                                                          
     50  * Returns:                                                                                       
     51  *      BCM_E_XXX
     52  */                                                                                               
     53 int                                                                                               
     54 _bcm_sc_defip_init(int unit)
     55 {
     56      /* Initialize  prefixes offsets, hash/avl  */
     57      /*   - lookup engine.                      */
     58      BCM_IF_ERROR_RETURN(soc_fb_lpm_init(unit));
     59 
     60      /* Initialize IPv6 greater than 64 bit prefixes offsets */
     61      /* hash lookup engine.                                  */
     62      BCM_IF_ERROR_RETURN(_bcm_trx_defip_128_init(unit));
     63     
     64      return (BCM_E_NONE);
     65 }                                         
     66 
     67 /*                                                                                                
     68  * Function:                                                                                      
     69  *      _bcm_sc_defip_deinit 
     70  * Purpose:                                                                                       
     71  *      De-initialize L3 DEFIP table for scorpion devices.                                                
     72  * Parameters:                                                                                    
     73  *      unit    - (IN)  SOC unit number.                                                          
     74  * Returns:                                                                                       
     75  *      BCM_E_XXX
     76  */                                                                                               
     77 int                                                                                               
     78 _bcm_sc_defip_deinit(int unit)
     79 {
     80      /* De-initialize  prefixes offsets, hash/avl  */
     81      /*   - lookup engine.                      */
     82      BCM_IF_ERROR_RETURN(soc_fb_lpm_deinit(unit));
     83 
     84      /* De-initialize IPv6 greater than 64 bit prefixes offsets */
     85      /* hash lookup engine.                                  */
     86      BCM_IF_ERROR_RETURN(_bcm_trx_defip_128_deinit(unit));
     87     
     88      return (BCM_E_NONE);
     89 }                                         
     90 #else /* BCM_SCORPION_SUPPORT && INCLUDE_L3 */
     91 int bcm_esw_scorpion_l3_not_empty;
     92 #endif /* BCM_SCORPION_SUPPORT && INCLUDE_L3 */