2
* Copyright (c) 2014 VMware, Inc.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at:
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef __IP_HELPER_H_
18
#define __IP_HELPER_H_ 1
23
#define OVS_FWD_HASH_TABLE_SIZE ((UINT32)1 << 10)
24
#define OVS_FWD_HASH_TABLE_MASK (OVS_FWD_HASH_TABLE_SIZE - 1)
26
#define OVS_ROUTE_HASH_TABLE_SIZE ((UINT32)1 << 8)
27
#define OVS_ROUTE_HASH_TABLE_MASK (OVS_ROUTE_HASH_TABLE_SIZE - 1)
29
#define OVS_NEIGH_HASH_TABLE_SIZE ((UINT32)1 << 8)
30
#define OVS_NEIGH_HASH_TABLE_MASK (OVS_NEIGH_HASH_TABLE_SIZE - 1)
32
#define OVS_IPNEIGH_TIMEOUT 100000000 // 10 s
35
typedef struct _OVS_IPNEIGH_ENTRY {
36
UINT8 macAddr[ETH_ADDR_LEN];
44
} OVS_IPNEIGH_ENTRY, *POVS_IPNEIGH_ENTRY;
46
typedef struct _OVS_IPFORWARD_ENTRY {
47
IP_ADDRESS_PREFIX prefix;
52
} OVS_IPFORWARD_ENTRY, *POVS_IPFORWARD_ENTRY;
54
typedef union _OVS_FWD_INFO {
58
UINT8 dstMacAddr[ETH_ADDR_LEN];
59
UINT8 srcMacAddr[ETH_ADDR_LEN];
63
} OVS_FWD_INFO, *POVS_FWD_INFO;
65
typedef struct _OVS_FWD_ENTRY {
67
POVS_IPFORWARD_ENTRY ipf;
68
POVS_IPNEIGH_ENTRY ipn;
72
} OVS_FWD_ENTRY, *POVS_FWD_ENTRY;
76
OVS_IP_HELPER_INTERNAL_ADAPTER_UP,
77
OVS_IP_HELPER_FWD_REQUEST,
80
typedef VOID (*OvsIPHelperCallback)(PNET_BUFFER_LIST nbl,
86
POVS_FWD_INFO fwdInfo);
88
typedef struct _OVS_FWD_REQUEST_INFO {
91
OvsIPv4TunnelKey tunnelKey;
92
OvsIPHelperCallback cb;
95
} OVS_FWD_REQUEST_INFO, *POVS_FWD_REQUEST_INFO;
98
typedef struct _OVS_IP_HELPER_REQUEST {
102
OVS_FWD_REQUEST_INFO fwdReq;
105
} OVS_IP_HELPER_REQUEST, *POVS_IP_HELPER_REQUEST;
108
typedef struct _OVS_IP_HELPER_THREAD_CONTEXT {
112
} OVS_IP_HELPER_THREAD_CONTEXT, *POVS_IP_HELPER_THREAD_CONTEXT;
114
NTSTATUS OvsInitIpHelper(NDIS_HANDLE ndisFilterHandle);
115
VOID OvsCleanupIpHelper(VOID);
117
VOID OvsInternalAdapterUp(UINT32 portNo, GUID *netCfgInstanceId);
118
VOID OvsInternalAdapterDown(VOID);
120
NTSTATUS OvsFwdIPHelperRequest(PNET_BUFFER_LIST nbl, UINT32 inPort,
121
const PVOID tunnelKey,
122
OvsIPHelperCallback cb,
125
NTSTATUS OvsLookupIPFwdInfo(UINT32 dstIp, POVS_FWD_INFO info);
126
VOID OvsCancelFwdIpHelperRequest(PNET_BUFFER_LIST nbl);
128
#endif /* __IP_HELPER_H_ */