/
vr_bridge.h
50 lines (38 loc) · 1.5 KB
/
vr_bridge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef __VR_BRIDGE_H__
#define __VR_BRIDGE_H__
#include "vr_defs.h"
#include "vrouter.h"
#define VR_DEF_BRIDGE_ENTRIES (256 * 1024)
#define VR_MAC_COPY(dst, src) { \
((uint16_t *)(dst))[0] = ((uint16_t *)(src))[0]; \
((uint16_t *)(dst))[1] = ((uint16_t *)(src))[1]; \
((uint16_t *)(dst))[2] = ((uint16_t *)(src))[2]; \
}
#define VR_ETH_COPY(dst, src) { \
VR_MAC_COPY((unsigned char *)(dst), (unsigned char *)(src)); \
VR_MAC_COPY(((unsigned char *)(dst) + 6), ((unsigned char *)(src) + 6)); \
((uint16_t *)(dst))[6] = ((uint16_t *)(src))[6]; \
}
#define VR_MAC_CMP(dst, src) \
((((uint16_t *)dst)[0] == ((uint16_t *)src)[0]) && \
(((uint16_t *)dst)[1] == ((uint16_t *)src)[1]) && \
(((uint16_t *)dst)[2] == ((uint16_t *)src)[2])) \
#define IS_MAC_ZERO(dst) \
((((uint16_t *)dst)[0] == 0) && \
(((uint16_t *)dst)[1] == 0) && \
(((uint16_t *)dst)[2] == 0)) \
#define IS_MAC_BCAST(dst) \
((((uint16_t *)dst)[0] == 0xffff) && \
(((uint16_t *)dst)[1] == 0xffff) && \
(((uint16_t *)dst)[2] == 0xffff)) \
#define IS_MAC_BMCAST(dst) \
(((uint8_t *)dst)[0]& 0x1)
#define VR_BE_INVALID_INDEX ((unsigned int)-1)
extern char vr_bcast_mac[];
unsigned int vr_bridge_table_used_oflow_entries(struct vrouter *);
unsigned int vr_bridge_table_used_total_entries(struct vrouter *);
struct vr_nexthop * __vrouter_bridge_lookup(unsigned int, unsigned char *);
#endif