Pavel Kotucek | 6899a30 | 2017-06-08 08:46:10 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | #ifndef included_vnet_p2p_ethernet_h |
| 16 | #define included_vnet_p2p_ethernet_h |
| 17 | |
| 18 | #include <vnet/vnet.h> |
| 19 | #include <vnet/ethernet/ethernet.h> |
| 20 | |
Pavel Kotucek | 15ac81c | 2017-06-20 14:00:26 +0200 | [diff] [blame] | 21 | |
| 22 | typedef struct { |
| 23 | /** |
| 24 | * Hash mapping parent sw_if_index and client mac address to p2p_ethernet sub-interface |
| 25 | */ |
| 26 | uword * p2p_ethernet_by_key; |
| 27 | |
| 28 | u32 *p2p_ethernet_by_sw_if_index; |
| 29 | |
| 30 | // Pool of p2p subifs; |
| 31 | subint_config_t *p2p_subif_pool; |
| 32 | |
| 33 | /* convenience */ |
| 34 | vlib_main_t * vlib_main; |
| 35 | vnet_main_t * vnet_main; |
Filip Tehlar | 41ff1eb | 2021-06-21 13:45:44 +0000 | [diff] [blame] | 36 | |
| 37 | u16 msg_id_base; |
Pavel Kotucek | 15ac81c | 2017-06-20 14:00:26 +0200 | [diff] [blame] | 38 | } p2p_ethernet_main_t; |
| 39 | |
| 40 | extern p2p_ethernet_main_t p2p_main; |
| 41 | |
| 42 | typedef struct |
| 43 | { |
| 44 | u32 sw_if_index; |
| 45 | u32 p2pe_sw_if_index; |
| 46 | u8 client_mac[6]; |
| 47 | } p2p_ethernet_trace_t; |
| 48 | |
| 49 | /** |
| 50 | * @brief Key struct for P2P Ethernet |
| 51 | * Key fields: parent sw_if_index and client mac address |
| 52 | * all fields in NET byte order |
| 53 | */ |
| 54 | |
| 55 | typedef struct { |
| 56 | u8 mac[6]; |
| 57 | u16 pad1; // padding for u64 mac address |
| 58 | u32 hw_if_index; |
| 59 | u32 pad2; // padding for u64 |
| 60 | } p2p_key_t; |
| 61 | |
| 62 | u32 p2p_ethernet_lookup (u32 parent_sw_if_index, u8* client_mac); |
| 63 | int p2p_ethernet_add_del (vlib_main_t * vm, u32 parent_if_index, u8 * client_mac, u32 sub_id, int is_add, u32 *p2pe_if_index); |
Pavel Kotucek | 6899a30 | 2017-06-08 08:46:10 +0200 | [diff] [blame] | 64 | |
| 65 | #endif /* included_vnet_p2p_ethernet_h */ |