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