vswitch.h (5997B)
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_VSWITCH_H__ 14 #define __BCM_VSWITCH_H__ 15 16 #include <bcm/types.h> 17 #include <bcm/policer.h> 18 #include <bcm/port.h> 19 20 #ifndef BCM_HIDE_DISPATCHABLE 21 22 /* Initialize vswitch module */ 23 extern int bcm_vswitch_init( 24 int unit); 25 26 /* Detach vswitch module */ 27 extern int bcm_vswitch_detach( 28 int unit); 29 30 /* Create a Virtual Switching Instance. */ 31 extern int bcm_vswitch_create( 32 int unit, 33 bcm_vlan_t *vsi); 34 35 /* Create a Virtual Switching Instance, with a specified ID. */ 36 extern int bcm_vswitch_create_with_id( 37 int unit, 38 bcm_vlan_t vsi); 39 40 /* Destroy a Virtual Switching Instance. */ 41 extern int bcm_vswitch_destroy( 42 int unit, 43 bcm_vlan_t vsi); 44 45 #endif /* BCM_HIDE_DISPATCHABLE */ 46 47 /* Vswitch callback function prototype */ 48 typedef int (*bcm_vswitch_port_traverse_cb)( 49 int unit, 50 bcm_vlan_t vsi, 51 bcm_gport_t port, 52 void *user_data); 53 54 #ifndef BCM_HIDE_DISPATCHABLE 55 56 /* Traverse existing ports on vswitch */ 57 extern int bcm_vswitch_port_traverse( 58 int unit, 59 bcm_vlan_t vsi, 60 bcm_vswitch_port_traverse_cb cb, 61 void *user_data); 62 63 /* Add a logical port to the specified virtual switching instance. */ 64 extern int bcm_vswitch_port_add( 65 int unit, 66 bcm_vlan_t vsi, 67 bcm_gport_t port); 68 69 /* Remove a logical port from the specified virtual switching instance. */ 70 extern int bcm_vswitch_port_delete( 71 int unit, 72 bcm_vlan_t vsi, 73 bcm_gport_t port); 74 75 /* 76 * Remove all logical port members from the specified virtual switching 77 * instance. 78 */ 79 extern int bcm_vswitch_port_delete_all( 80 int unit, 81 bcm_vlan_t vsi); 82 83 /* 84 * Get the virtual switching instance of which the specified logical port 85 * is a member. 86 */ 87 extern int bcm_vswitch_port_get( 88 int unit, 89 bcm_gport_t port, 90 bcm_vlan_t *vsi); 91 92 #endif /* BCM_HIDE_DISPATCHABLE */ 93 94 /* bcm_vswitch_cross_connect_* flags */ 95 #define BCM_VSWITCH_CROSS_CONNECT_DIRECTIONAL 0x00000001 /* connect gport1 to 96 gport2 */ 97 98 /* L3 tunneling initiator. */ 99 typedef struct bcm_vswitch_cross_connect_s { 100 bcm_gport_t port1; /* First gport in cross connect. */ 101 bcm_gport_t port2; /* Second gport in cross connect. */ 102 int encap1; /* First gport encap id. */ 103 int encap2; /* Second gport encap id. */ 104 uint32 flags; /* BCM_VSWITCH_CROSS_CONNECT_XXX flags. */ 105 } bcm_vswitch_cross_connect_t; 106 107 /* Initialize the bcm_vswitch_cross_connect_t struct. */ 108 extern void bcm_vswitch_cross_connect_t_init( 109 bcm_vswitch_cross_connect_t *cross_connect); 110 111 #ifndef BCM_HIDE_DISPATCHABLE 112 113 /* Attach given 2 ports in P2P service. */ 114 extern int bcm_vswitch_cross_connect_add( 115 int unit, 116 bcm_vswitch_cross_connect_t *gports); 117 118 /* Remove attachment between the ports. */ 119 extern int bcm_vswitch_cross_connect_delete( 120 int unit, 121 bcm_vswitch_cross_connect_t *gports); 122 123 /* Delete all P2P services. */ 124 extern int bcm_vswitch_cross_connect_delete_all( 125 int unit); 126 127 /* 128 * Return peer, if protected return primary port, invalid gport is 129 * populated. 130 */ 131 extern int bcm_vswitch_cross_connect_get( 132 int unit, 133 bcm_vswitch_cross_connect_t *gports); 134 135 #endif /* BCM_HIDE_DISPATCHABLE */ 136 137 /* Vswitch callback function prototype */ 138 typedef int (*bcm_vswitch_cross_connect_traverse_cb)( 139 int unit, 140 bcm_vswitch_cross_connect_t *gports, 141 void *user_data); 142 143 #ifndef BCM_HIDE_DISPATCHABLE 144 145 /* Traverse existing P2P services. */ 146 extern int bcm_vswitch_cross_connect_traverse( 147 int unit, 148 bcm_vswitch_cross_connect_traverse_cb cb, 149 void *user_data); 150 151 /* Destroy a all Virtual Switching Instances */ 152 extern int bcm_vswitch_destroy_all( 153 int unit); 154 155 #endif /* BCM_HIDE_DISPATCHABLE */ 156 157 /* bcm_vswitch_flexible_connect_* flags */ 158 #define BCM_VSWITCH_FLEXIBLE_CONNECT_UPDATE 0x00000001 /* Update existing 159 connection */ 160 161 /* Vswitch flexible cross connect forwarding information. */ 162 typedef struct bcm_vswitch_flexible_connect_fwd_s { 163 bcm_gport_t forward_port; /* gport to be used as forward destination. */ 164 int forward_encap; /* forward encap id */ 165 } bcm_vswitch_flexible_connect_fwd_t; 166 167 /* Initialize the vswitch_flexible_connect_fwd_t struct. */ 168 extern void bcm_vswitch_flexible_connect_fwd_t_init( 169 bcm_vswitch_flexible_connect_fwd_t *vswitch_flexible_connect_fwd); 170 171 /* Vswitch flexible cross connect match information. */ 172 typedef struct bcm_vswitch_flexible_connect_match_s { 173 bcm_port_match_t match; /* Match criteria */ 174 bcm_gport_t match_port; /* Match port */ 175 bcm_vlan_t match_vlan; /* Match vlan */ 176 bcm_vlan_t match_inner_vlan; /* Match inner vlan */ 177 } bcm_vswitch_flexible_connect_match_t; 178 179 /* Initialize the vswitch_flexible_connect_match_t struct. */ 180 extern void bcm_vswitch_flexible_connect_match_t_init( 181 bcm_vswitch_flexible_connect_match_t *flexible_connect_match); 182 183 #ifndef BCM_HIDE_DISPATCHABLE 184 185 /* Attach given match port to forward destination. */ 186 extern int bcm_vswitch_flexible_connect_add( 187 int unit, 188 uint32 flags, 189 bcm_vswitch_flexible_connect_match_t *port_match, 190 bcm_vswitch_flexible_connect_fwd_t *port_fwd); 191 192 /* Remove flexible connection */ 193 extern int bcm_vswitch_flexible_connect_delete( 194 int unit, 195 bcm_vswitch_flexible_connect_match_t *port_match); 196 197 /* Return forwarding information for given match peer. */ 198 extern int bcm_vswitch_flexible_connect_get( 199 int unit, 200 uint32 flags, 201 bcm_vswitch_flexible_connect_match_t *port_match, 202 bcm_vswitch_flexible_connect_fwd_t *port_fwd); 203 204 #endif /* BCM_HIDE_DISPATCHABLE */ 205 206 #endif /* __BCM_VSWITCH_H__ */