blob: bb1e2896bc2b51400b2b098343c6d8e41b3cd620 [file] [log] [blame]
Pavel Kotucek6899a302017-06-08 08:46:10 +02001/*
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 Kotucek15ac81c2017-06-20 14:00:26 +020021
22typedef 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;
36} p2p_ethernet_main_t;
37
38extern p2p_ethernet_main_t p2p_main;
39
40typedef struct
41{
42 u32 sw_if_index;
43 u32 p2pe_sw_if_index;
44 u8 client_mac[6];
45} p2p_ethernet_trace_t;
46
47/**
48 * @brief Key struct for P2P Ethernet
49 * Key fields: parent sw_if_index and client mac address
50 * all fields in NET byte order
51 */
52
53typedef struct {
54 u8 mac[6];
55 u16 pad1; // padding for u64 mac address
56 u32 hw_if_index;
57 u32 pad2; // padding for u64
58} p2p_key_t;
59
60u32 p2p_ethernet_lookup (u32 parent_sw_if_index, u8* client_mac);
61int 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 Kotucek6899a302017-06-08 08:46:10 +020062
63#endif /* included_vnet_p2p_ethernet_h */