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.
18 #define __OVS_FLOW_H_ 1
21 #include "OvsSwitch.h"
23 #include "OvsNetProto.h"
25 typedef struct _OvsFlow {
26 LIST_ENTRY ListEntry; // In Datapath's flowTable.
34 UINT32 userActionsLen; // used for flow query
35 UINT32 actionBufferLen; // used for flow reuse
36 struct nlattr actions[1];
40 typedef struct _OvsLayers {
41 UINT32 l3Ofs; // IPv4, IPv6, ARP, or other L3 header.
42 UINT32 l4Ofs; // TCP, UDP, ICMP, ICMPv6, or other L4 header.
43 UINT32 l7Ofs; // L4 protocol's payload.
46 extern UINT64 ovsUserTimestampDelta;
47 extern UINT64 ovsTimeIncrementPerTick;
49 NDIS_STATUS OvsDeleteFlowTable(OVS_DATAPATH *datapath);
50 NDIS_STATUS OvsAllocateFlowTable(OVS_DATAPATH *datapath,
51 POVS_SWITCH_CONTEXT switchContext);
53 NDIS_STATUS OvsExtractFlow(const NET_BUFFER_LIST *pkt, UINT32 inPort,
54 OvsFlowKey *flow, POVS_PACKET_HDR_INFO layers,
55 OvsIPv4TunnelKey *tunKey);
56 OvsFlow *OvsLookupFlow(OVS_DATAPATH *datapath, const OvsFlowKey *key,
57 UINT64 *hash, BOOLEAN hashValid);
58 UINT64 OvsHashFlow(const OvsFlowKey *key);
59 VOID OvsFlowUsed(OvsFlow *flow, const NET_BUFFER_LIST *pkt,
60 const POVS_PACKET_HDR_INFO layers);
62 NTSTATUS OvsDumpFlowIoctl(PVOID inputBuffer, UINT32 inputLength,
63 PVOID outputBuffer, UINT32 outputLength,
65 NTSTATUS OvsPutFlowIoctl(PVOID inputBuffer, UINT32 inputLength,
66 PVOID outputBuffer, UINT32 outputLength,
68 NTSTATUS OvsGetFlowIoctl(PVOID inputBuffer, UINT32 inputLength,
69 PVOID outputBuffer, UINT32 outputLength,
71 NTSTATUS OvsFlushFlowIoctl(PVOID inputBuffer, UINT32 inputLength);
73 /* Flags for tunneling */
74 #define OVS_TNL_F_DONT_FRAGMENT (1 << 0)
75 #define OVS_TNL_F_CSUM (1 << 1)
76 #define OVS_TNL_F_KEY (1 << 2)
78 #endif /* __OVS_FLOW_H_ */