~ubuntu-branches/ubuntu/wily/openvswitch/wily

« back to all changes in this revision

Viewing changes to datapath-windows/ovsext/IpHelper.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-08-10 11:35:15 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20150810113515-575vj06oq29emxsn
Tags: 2.4.0~git20150810.97bab95-0ubuntu1
* New upstream snapshot from 2.4 branch:
  - d/*: Align any relevant packaging changes with upstream.
* d/*: wrap-and-sort.
* d/openvswitch-{common,vswitch}.install: Correct install location for
  bash completion files.
* d/tests/openflow.py: Explicitly use ovs-testcontroller as provided
  by 2.4.0 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2014 VMware, Inc.
 
3
 *
 
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:
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
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.
 
15
 */
 
16
 
 
17
#ifndef __IP_HELPER_H_
 
18
#define __IP_HELPER_H_ 1
 
19
 
 
20
#include <ntddk.h>
 
21
#include <netioapi.h>
 
22
 
 
23
#define OVS_FWD_HASH_TABLE_SIZE ((UINT32)1 << 10)
 
24
#define OVS_FWD_HASH_TABLE_MASK (OVS_FWD_HASH_TABLE_SIZE - 1)
 
25
 
 
26
#define OVS_ROUTE_HASH_TABLE_SIZE ((UINT32)1 << 8)
 
27
#define OVS_ROUTE_HASH_TABLE_MASK (OVS_ROUTE_HASH_TABLE_SIZE - 1)
 
28
 
 
29
#define OVS_NEIGH_HASH_TABLE_SIZE ((UINT32)1 << 8)
 
30
#define OVS_NEIGH_HASH_TABLE_MASK (OVS_NEIGH_HASH_TABLE_SIZE - 1)
 
31
 
 
32
#define OVS_IPNEIGH_TIMEOUT 100000000   // 10 s
 
33
 
 
34
 
 
35
typedef struct _OVS_IPNEIGH_ENTRY {
 
36
    UINT8             macAddr[ETH_ADDR_LEN];
 
37
    UINT16            refCount;
 
38
    UINT32            ipAddr;
 
39
    UINT32            pad;
 
40
    UINT64            timeout;
 
41
    LIST_ENTRY        link;
 
42
    LIST_ENTRY        slink;
 
43
    LIST_ENTRY        fwdList;
 
44
} OVS_IPNEIGH_ENTRY, *POVS_IPNEIGH_ENTRY;
 
45
 
 
46
typedef struct _OVS_IPFORWARD_ENTRY {
 
47
    IP_ADDRESS_PREFIX prefix;
 
48
    UINT32            nextHop;
 
49
    UINT16            refCount;
 
50
    LIST_ENTRY        link;
 
51
    LIST_ENTRY        fwdList;
 
52
} OVS_IPFORWARD_ENTRY, *POVS_IPFORWARD_ENTRY;
 
53
 
 
54
typedef union  _OVS_FWD_INFO {
 
55
    struct {
 
56
        UINT32        dstIpAddr;
 
57
        UINT32        srcIpAddr;
 
58
        UINT8         dstMacAddr[ETH_ADDR_LEN];
 
59
        UINT8         srcMacAddr[ETH_ADDR_LEN];
 
60
        UINT32        srcPortNo;
 
61
    };
 
62
    UINT64            value[3];
 
63
} OVS_FWD_INFO, *POVS_FWD_INFO;
 
64
 
 
65
typedef struct _OVS_FWD_ENTRY {
 
66
    OVS_FWD_INFO      info;
 
67
    POVS_IPFORWARD_ENTRY ipf;
 
68
    POVS_IPNEIGH_ENTRY   ipn;
 
69
    LIST_ENTRY        link;
 
70
    LIST_ENTRY        ipfLink;
 
71
    LIST_ENTRY        ipnLink;
 
72
} OVS_FWD_ENTRY, *POVS_FWD_ENTRY;
 
73
 
 
74
 
 
75
enum {
 
76
    OVS_IP_HELPER_INTERNAL_ADAPTER_UP,
 
77
    OVS_IP_HELPER_FWD_REQUEST,
 
78
};
 
79
 
 
80
typedef VOID (*OvsIPHelperCallback)(PNET_BUFFER_LIST nbl,
 
81
                                    UINT32 inPort,
 
82
                                    PVOID tunnelKey,
 
83
                                    PVOID cbData1,
 
84
                                    PVOID cbData2,
 
85
                                    NTSTATUS status,
 
86
                                    POVS_FWD_INFO fwdInfo);
 
87
 
 
88
typedef struct _OVS_FWD_REQUEST_INFO {
 
89
    PNET_BUFFER_LIST  nbl;
 
90
    UINT32            inPort;
 
91
    OvsIPv4TunnelKey  tunnelKey;
 
92
    OvsIPHelperCallback cb;
 
93
    PVOID             cbData1;
 
94
    PVOID             cbData2;
 
95
} OVS_FWD_REQUEST_INFO, *POVS_FWD_REQUEST_INFO;
 
96
 
 
97
 
 
98
typedef struct _OVS_IP_HELPER_REQUEST {
 
99
    LIST_ENTRY        link;
 
100
    UINT32            command;
 
101
    union {
 
102
        OVS_FWD_REQUEST_INFO    fwdReq;
 
103
        UINT32                  dummy;
 
104
    };
 
105
} OVS_IP_HELPER_REQUEST, *POVS_IP_HELPER_REQUEST;
 
106
 
 
107
 
 
108
typedef struct _OVS_IP_HELPER_THREAD_CONTEXT {
 
109
    KEVENT            event;
 
110
    PVOID             threadObject;
 
111
    UINT32            exit;
 
112
} OVS_IP_HELPER_THREAD_CONTEXT, *POVS_IP_HELPER_THREAD_CONTEXT;
 
113
 
 
114
NTSTATUS OvsInitIpHelper(NDIS_HANDLE ndisFilterHandle);
 
115
VOID OvsCleanupIpHelper(VOID);
 
116
 
 
117
VOID OvsInternalAdapterUp(UINT32 portNo, GUID *netCfgInstanceId);
 
118
VOID OvsInternalAdapterDown(VOID);
 
119
 
 
120
NTSTATUS OvsFwdIPHelperRequest(PNET_BUFFER_LIST nbl, UINT32 inPort,
 
121
                               const PVOID tunnelKey,
 
122
                               OvsIPHelperCallback cb,
 
123
                               PVOID cbData1,
 
124
                               PVOID cbData2);
 
125
NTSTATUS OvsLookupIPFwdInfo(UINT32 dstIp, POVS_FWD_INFO info);
 
126
VOID OvsCancelFwdIpHelperRequest(PNET_BUFFER_LIST nbl);
 
127
 
 
128
#endif /* __IP_HELPER_H_ */