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.
26 typedef struct _OvsFlow {
27 LIST_ENTRY ListEntry; // In Datapath's flowTable.
35 UINT32 userActionsLen; // used for flow query
36 UINT32 actionBufferLen; // used for flow reuse
41 typedef struct _OvsLayers {
42 UINT32 l3Ofs; // IPv4, IPv6, ARP, or other L3 header.
43 UINT32 l4Ofs; // TCP, UDP, SCTP, ICMP, ICMPv6, or other L4 header.
44 UINT32 l7Ofs; // L4 protocol's payload.
47 extern UINT64 ovsUserTimestampDelta;
48 extern UINT64 ovsTimeIncrementPerTick;
50 NDIS_STATUS OvsDeleteFlowTable(OVS_DATAPATH *datapath);
51 NDIS_STATUS OvsAllocateFlowTable(OVS_DATAPATH *datapath,
52 POVS_SWITCH_CONTEXT switchContext);
54 NDIS_STATUS OvsExtractFlow(const NET_BUFFER_LIST *pkt, UINT32 inPort,
55 OvsFlowKey *flow, POVS_PACKET_HDR_INFO layers,
56 OvsIPv4TunnelKey *tunKey);
57 OvsFlow *OvsLookupFlow(OVS_DATAPATH *datapath, const OvsFlowKey *key,
58 UINT64 *hash, BOOLEAN hashValid);
59 UINT64 OvsHashFlow(const OvsFlowKey *key);
60 VOID OvsFlowUsed(OvsFlow *flow, const NET_BUFFER_LIST *pkt,
61 const POVS_PACKET_HDR_INFO layers);
63 NTSTATUS OvsDumpFlowIoctl(PVOID inputBuffer, UINT32 inputLength,
64 PVOID outputBuffer, UINT32 outputLength,
66 NTSTATUS OvsPutFlowIoctl(PVOID inputBuffer, UINT32 inputLength,
67 struct OvsFlowStats *stats);
68 NTSTATUS OvsGetFlowIoctl(PVOID inputBuffer, PVOID outputBuffer);
69 NTSTATUS OvsFlushFlowIoctl(UINT32 dpNo);
71 NTSTATUS OvsFlowNlCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
73 NTSTATUS OvsFlowNlGetCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
75 NTSTATUS MapFlowKeyToNlKey(PNL_BUFFER nlBuf, OvsFlowKey *flowKey,
76 UINT16 keyType, UINT16 tunKeyType);
77 NTSTATUS MapFlowTunKeyToNlKey(PNL_BUFFER nlBuf, OvsIPv4TunnelKey *tunKey,
79 UINT32 OvsFlowKeyAttrSize(void);
80 UINT32 OvsTunKeyAttrSize(void);
82 /* Flags for tunneling */
83 #define OVS_TNL_F_DONT_FRAGMENT (1 << 0)
84 #define OVS_TNL_F_CSUM (1 << 1)
85 #define OVS_TNL_F_KEY (1 << 2)
87 #endif /* __FLOW_H_ */