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

compat_531.c (2410B)


      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  * RPC Compatibility with sdk-5.3.0 routines
      8  */
      9 
     10 #ifdef	BCM_RPC_SUPPORT
     11 
     12 #include <sal/core/libc.h>
     13 #include <shared/alloc.h>
     14 
     15 #include <bcm/types.h>
     16 #include <bcm/error.h>
     17 #include <bcm/l2.h>
     18 
     19 #include <bcm_int/compat/compat_531.h>
     20 
     21 /* bcm_l2_addr_t conversion functions */
     22 STATIC void
     23 _bcm_compat531in_l2_cache_addr_t(
     24     bcm_compat531_l2_cache_addr_t *from,
     25     bcm_l2_cache_addr_t *to)
     26 {
     27     to->flags = from->flags;
     28     sal_memcpy(to->mac, from->mac, sizeof(bcm_mac_t));
     29     sal_memcpy(to->mac_mask, from->mac_mask, sizeof(bcm_mac_t));
     30     to->vlan = from->vlan;
     31     to->vlan_mask = from->vlan_mask;
     32     to->src_port = from->src_port;
     33     to->src_port_mask = from->src_port_mask;
     34     to->dest_modid = from->dest_modid;
     35     to->dest_port = from->dest_port;
     36     to->dest_trunk = from->dest_trunk;
     37     to->prio = from->prio;
     38     BCM_PBMP_CLEAR(to->dest_ports);
     39 }
     40 
     41 STATIC void
     42 _bcm_compat531out_l2_cache_addr_t(
     43     bcm_l2_cache_addr_t *from,
     44     bcm_compat531_l2_cache_addr_t *to)
     45 {
     46     to->flags = from->flags;
     47     sal_memcpy(to->mac, from->mac, sizeof(bcm_mac_t));
     48     sal_memcpy(to->mac_mask, from->mac_mask, sizeof(bcm_mac_t));
     49     to->vlan = from->vlan;
     50     to->vlan_mask = from->vlan_mask;
     51     to->src_port = from->src_port;
     52     to->src_port_mask = from->src_port_mask;
     53     to->dest_modid = from->dest_modid;
     54     to->dest_port = from->dest_port;
     55     to->dest_trunk = from->dest_trunk;
     56     to->prio = from->prio;
     57     /* ignore from->dest_ports */
     58 }
     59 
     60 int
     61 bcm_compat531_l2_cache_set(
     62     int unit,
     63     int index, 
     64     bcm_compat531_l2_cache_addr_t *addr,
     65     int *index_used)
     66 {
     67     int			rv;
     68     bcm_l2_cache_addr_t	n_addr;
     69 
     70     if (addr == NULL) {
     71         return BCM_E_PARAM;
     72     }
     73     _bcm_compat531in_l2_cache_addr_t(addr, &n_addr);
     74     rv = bcm_l2_cache_set(unit, index, &n_addr, index_used);
     75     return rv;
     76 }
     77 
     78 int
     79 bcm_compat531_l2_cache_get(
     80     int unit,
     81     int index,
     82     bcm_compat531_l2_cache_addr_t *addr)
     83 {
     84     int			rv;
     85     bcm_l2_cache_addr_t	n_addr;
     86 
     87     if (addr == NULL) {
     88         return BCM_E_PARAM;
     89     }
     90     rv = bcm_l2_cache_get(unit, index, &n_addr);
     91     if (rv >= 0) {
     92 	_bcm_compat531out_l2_cache_addr_t(&n_addr, addr);
     93     }
     94     return rv;
     95 }
     96 
     97 #endif	/* BCM_RPC_SUPPORT */