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

ct_tun.h (2787B)


      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-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        ct_tun.h
      8  * Purpose:     
      9  */
     10 
     11 #ifndef   _CPUTRANS_CT_TUN_H_
     12 #define   _CPUTRANS_CT_TUN_H_
     13 
     14 #include <bcm/rx.h>
     15 
     16 #include <appl/cpudb/cpudb.h>
     17 #include <appl/cputrans/atp.h>
     18 
     19 #if defined(BCM_RPC_SUPPORT)
     20 
     21 /*
     22  * Transmit function to call to tunnel data.  REQUIRED.  pkt_data does not
     23  * include any transport header (eg no CPUTRANS_HEADER).  But other
     24  * encapsulation data (source port, original COS, etc) is included.
     25  */
     26 
     27 typedef void (*ct_tunnel_done_cb_f)(uint8 *pkt_data, void *cookie, int rv);
     28 
     29 /*
     30  * Tunnel filter.  Optional.  If present (set), this function is
     31  * called before tunnelling the packet.
     32  */
     33 
     34 typedef bcm_cpu_tunnel_mode_t (*ct_rx_tunnel_filter_f)(int unit,
     35                                                        bcm_pkt_t *pkt);
     36 
     37 extern int ct_rx_tunnel_filter_set(ct_rx_tunnel_filter_f t_cb);
     38 extern int ct_rx_tunnel_filter_get(ct_rx_tunnel_filter_f *t_cb);
     39 
     40 typedef int (*ct_rx_tunnel_direct_f)(int unit, bcm_pkt_t *pkt,
     41                                      cpudb_key_t *cpu);
     42 
     43 extern int ct_rx_tunnel_direct_set(ct_rx_tunnel_direct_f dif_fn);
     44 extern int ct_rx_tunnel_direct_get(ct_rx_tunnel_direct_f *dif_fn);
     45 
     46 extern int ct_rx_tunnel_mode_default_set(int mode);
     47 extern bcm_cpu_tunnel_mode_t ct_rx_tunnel_mode_default_get(void);
     48 extern int ct_rx_tunnel_priority_set(int priority);
     49 extern int ct_rx_tunnel_priority_get(void);
     50 
     51 extern void ct_rx_tunnelled_pkt_handler(cpudb_key_t src_key,
     52                                         uint8 *payload, int len);
     53 
     54 extern bcm_cpu_tunnel_mode_t ct_rx_tunnel_check(int unit, bcm_pkt_t *pkt,
     55                                                 int *no_ack, int *check_cpu,
     56                                                 cpudb_key_t *cpu);
     57 
     58 extern int ct_rx_tunnel_header_bytes_get(void);
     59 extern uint8 *ct_rx_tunnel_pkt_pack(bcm_pkt_t *pkt, uint8 *buf);
     60 extern int ct_rx_tunnel_pkt_unpack(uint8 *pkt_data, int pkt_len,
     61                                    bcm_pkt_t *pkt, uint8 **payload_start,
     62                                    int *payload_len);
     63 
     64 /****************************************************************
     65  *
     66  * Packet TX tunnelling code
     67  */
     68 
     69 extern int ct_tx_tunnel_setup(void);
     70 extern int ct_tx_tunnel_stop(void);
     71 
     72 extern int ct_tx_tunnel(bcm_pkt_t *pkt,
     73                         int dest_unit,   /* BCM unit */
     74                         int remote_port,
     75                         uint32 flags,  /* See include/bcm/pkt.h */
     76                         bcm_cpu_tunnel_mode_t mode);
     77 
     78 extern int ct_tx_tunnel_forward(uint8 *pkt_data, int len);
     79 
     80 #endif /* BCM_RPC_SUPPORT */
     81 
     82 #endif /* !_CPUTRANS_CT_TUN_H_ */