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

proxy.h (7258B)


      1 /*
      2  * 
      3  * 
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      7  *
      8  */
      9 
     10 #ifndef __BCM_PROXY_H__
     11 #define __BCM_PROXY_H__
     12 
     13 #if defined(INCLUDE_L3)
     14 
     15 #include <bcm/types.h>
     16 #include <bcm/port.h>
     17 #include <bcm/field.h>
     18 
     19 /* Proxy server operational modes. */
     20 typedef enum bcm_proxy_mode_e {
     21     BCM_PROXY_MODE_NONE = 0,        /* Invalid. */
     22     BCM_PROXY_MODE_LOOPBACK = 1, 
     23     BCM_PROXY_MODE_HIGIG = 2, 
     24     BCM_PROXY_MODE_HYBRID = 3, 
     25     BCM_PROXY_MODE_SECOND_PASS = 4 
     26 } bcm_proxy_mode_t;
     27 
     28 /* bcm_proxy_proto_type_s */
     29 typedef enum bcm_proxy_proto_type_e {
     30     BCM_PROXY_PROTO_INVALID = 0, 
     31     BCM_PROXY_PROTO_IP4_ALL = 1, 
     32     BCM_PROXY_PROTO_IP4_UCAST = 2, 
     33     BCM_PROXY_PROTO_IP4_MCAST = 3, 
     34     BCM_PROXY_PROTO_IP6_ALL = 4, 
     35     BCM_PROXY_PROTO_IP6_UCAST = 5, 
     36     BCM_PROXY_PROTO_IP6_MCAST = 6, 
     37     BCM_PROXY_PROTO_MPLS_UCAST = 7, 
     38     BCM_PROXY_PROTO_MPLS_MCAST = 8, 
     39     BCM_PROXY_PROTO_MPLS_ALL = 9, 
     40     BCM_PROXY_PROTO_IP6_IN_IP4 = 10, 
     41     BCM_PROXY_PROTO_IP_IN_IP = 11,      /* IPv4-in-IPv4. */
     42     BCM_PROXY_PROTO_GRE_IN_IP = 12, 
     43     BCM_PROXY_PROTO_UNKNOWN_IP4_UCAST = 13, /* IPv4 table expansion. */
     44     BCM_PROXY_PROTO_UNKNOWN_IP6_UCAST = 14 /* IPv6 table expansion. */
     45 } bcm_proxy_proto_type_t;
     46 
     47 #ifndef BCM_HIDE_DISPATCHABLE
     48 
     49 /* 
     50  * Configure a proxy client for the given unit and port. The server
     51  * module ID and port must be valid.
     52  */
     53 extern int bcm_proxy_client_set(
     54     int unit, 
     55     bcm_port_t client_port, 
     56     bcm_proxy_proto_type_t proto_type, 
     57     bcm_module_t server_modid, 
     58     bcm_port_t server_port, 
     59     int enable);
     60 
     61 /* 
     62  * This API enables various kinds of lookups on StrataXGS III device on
     63  * behalf
     64  * of remote legacy or StrataXGS III devices.
     65  */
     66 extern int bcm_proxy_server_set(
     67     int unit, 
     68     bcm_port_t server_port, 
     69     bcm_proxy_mode_t mode, 
     70     int enable);
     71 
     72 /* 
     73  * Get the lookup status (enabled/disabled) of StrataXGS III Proxy server
     74  * device,
     75  * given the Server mode.
     76  */
     77 extern int bcm_proxy_server_get(
     78     int unit, 
     79     bcm_port_t server_port, 
     80     bcm_proxy_mode_t mode, 
     81     int *enable);
     82 
     83 #endif /* BCM_HIDE_DISPATCHABLE */
     84 
     85 /* Proxy Server Definitions. */
     86 #define BCM_PROXY_SERVER_MASK_PORT      0x0001     /* Wildcard server
     87                                                       destination port match */
     88 #define BCM_PROXY_SERVER_KEEP_PRIORITY  0x0002     /* Keep the original packet
     89                                                       priority */
     90 #define BCM_PROXY_SERVER_KEEP_VID       0x0004     /* Keep the original packet
     91                                                       VID */
     92 #define BCM_PROXY_SERVER_MASK_MODID     0x0008     /* Wildcard server
     93                                                       destination modid match */
     94 
     95 /* The second pass flow types */
     96 typedef enum bcm_proxy_second_pass_flow_type_e {
     97     bcmProxySecondPassFlowTypeNone = 0, 
     98     bcmProxySecondPassFlowTypeL2greTermination = 1, 
     99     bcmProxySecondPassFlowTypeVxlanTermination = 2, 
    100     bcmProxySecondPassFlowTypeMimTermination = 3, 
    101     bcmProxySecondPassFlowTypeTrillInitiation = 4, 
    102     bcmProxySecondPassFlowTypeTrillTermination = 5 
    103 } bcm_proxy_second_pass_flow_type_t;
    104 
    105 /* Proxy server Config Structure. */
    106 typedef struct bcm_proxy_server_s {
    107     uint32 flags;                       /* BCM_PROXY_SERVER_xxx. */
    108     bcm_gport_t server_gport;           /* Proxy GPORT identifier. */
    109     bcm_gport_t server_gport_mask;      /* Proxy GPORT Mask identifier to
    110                                            selectively mask DST_PORT and
    111                                            DST_MODID for signature match. */
    112     bcm_proxy_mode_t mode;              /* Selected proxy server operational
    113                                            mode. */
    114     bcm_proxy_second_pass_flow_type_t flow_type; /* Flow type identifier. */
    115 } bcm_proxy_server_t;
    116 
    117 /* Initialze a bcm_proxy_server_t structure. */
    118 extern void bcm_proxy_server_t_init(
    119     bcm_proxy_server_t *proxy_server);
    120 
    121 #ifndef BCM_HIDE_DISPATCHABLE
    122 
    123 /* Configure per-ingress port proxy server behavior. */
    124 extern int bcm_proxy_server_port_set(
    125     int unit, 
    126     bcm_gport_t local_ingress_port, 
    127     bcm_proxy_server_t *proxy_server, 
    128     int enable);
    129 
    130 /* Retrieve per-ingress port proxy server configuration */
    131 extern int bcm_proxy_server_port_get(
    132     int unit, 
    133     bcm_gport_t local_ingress_port, 
    134     bcm_proxy_server_t *proxy_server, 
    135     int *enable);
    136 
    137 /* Initialize the BCM Proxy subsystem. */
    138 extern int bcm_proxy_init(
    139     int unit);
    140 
    141 /* Detach the Proxy software module. */
    142 extern int bcm_proxy_cleanup(
    143     int unit);
    144 
    145 #endif /* BCM_HIDE_DISPATCHABLE */
    146 
    147 /*  Proxy Egress flags. */
    148 #define BCM_PROXY_WITH_ID       (1 << 0)   /* Create Proxy Entry WITH_ID. */
    149 #define BCM_PROXY_REPLACE       (1 << 1)   /* Replace Existing Proxy Entry */
    150 #define BCM_PROXY_L3_FORCE      (1 << 2)   /* Explicitly Set HiGig L3-bit */
    151 #define BCM_PROXY_LEARN_DISABLE (1 << 3)   /* Explicitly Set HiGig Do-Not-Learn
    152                                               Bit */
    153 #define BCM_PROXY_RSVD_VLAN_ADD (1 << 4)   /* Explicitly Set HiGig System
    154                                               Reserved Vlan */
    155 #define BCM_PROXY_PACKET_MODIFY (1 << 5)   /* Permit packet modification on
    156                                               Stack port */
    157 #define BCM_PROXY_PACKET_DROP   (1 << 6)   /* Drop HiGig Proxy Packet */
    158 
    159 /* Proxy Forwarding destination. */
    160 typedef struct bcm_proxy_egress_s {
    161     uint32 flags;       /* Proxy flags. */
    162     bcm_gport_t gport;  /* Stack port to direct the packet */
    163 } bcm_proxy_egress_t;
    164 
    165 /* bcm_proxy_egress_traverse_cb */
    166 typedef int (*bcm_proxy_egress_traverse_cb)(
    167     int unit, 
    168     bcm_if_t proxy_if_id, 
    169     bcm_proxy_egress_t *info, 
    170     void *user_data);
    171 
    172 /* Initialize a bcm_proxy_egress_t structure. */
    173 extern void bcm_proxy_egress_t_init(
    174     bcm_proxy_egress_t *proxy_egress);
    175 
    176 #ifndef BCM_HIDE_DISPATCHABLE
    177 
    178 /* Create Proxy Egress forwarding object. */
    179 extern int bcm_proxy_egress_create(
    180     int unit, 
    181     uint32 flags, 
    182     bcm_proxy_egress_t *proxy_egress, 
    183     bcm_if_t *proxy_if_id);
    184 
    185 /* Destroy Proxy Egress forwarding object. */
    186 extern int bcm_proxy_egress_destroy(
    187     int unit, 
    188     bcm_if_t proxy_if_id);
    189 
    190 /* Get Proxy Egress forwarding object. */
    191 extern int bcm_proxy_egress_get(
    192     int unit, 
    193     bcm_if_t proxy_if_id, 
    194     bcm_proxy_egress_t *proxy_egress);
    195 
    196 /* 
    197  * Traverse through proxy egress object table and run callback at each
    198  * valid entry.
    199  */
    200 extern int bcm_proxy_egress_traverse(
    201     int unit, 
    202     bcm_proxy_egress_traverse_cb trav_fn, 
    203     void *user_data);
    204 
    205 #endif /* BCM_HIDE_DISPATCHABLE */
    206 
    207 /* 
    208  * Default PROXY_SERVER_GPORT_MASK.Results in utilizing complete dest mod
    209  * and port for signature match.
    210  */
    211 #define BCM_PROXY_SERVER_GPORT_ALL_MASK 0xffffffff /* Default
    212                                                       PROXY_SERVER_GPORT_MASK.Results
    213                                                       in utilizing complete dest
    214                                                       mod and port for signature
    215                                                       match. */
    216 
    217 #endif /* defined(INCLUDE_L3) */
    218 
    219 #endif /* __BCM_PROXY_H__ */