Skip to content

Commit

Permalink
datapath-windows: Extract flow metadata in execute cmd handler.
Browse files Browse the repository at this point in the history
Signed-off-by: Sorin Vinturis <[email protected]>
Acked-by: Sairam Venugopal <[email protected]>
Acked-by: Nithin Raju <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
svinturis authored and blp committed Mar 25, 2016
1 parent 245eede commit 877a19b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions datapath-windows/ovsext/DpInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ typedef struct OvsPacketExecute {
uint32_t actionsLen;
PCHAR packetBuf;
PNL_ATTR actions;
PNL_ATTR *keyAttrs;
} OvsPacketExecute;


Expand Down
19 changes: 19 additions & 0 deletions datapath-windows/ovsext/Flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,25 @@ DeleteAllFlows(OVS_DATAPATH *datapath)
}
}

NDIS_STATUS
OvsGetFlowMetadata(OvsFlowKey *key,
PNL_ATTR *keyAttrs)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;

if (keyAttrs[OVS_KEY_ATTR_RECIRC_ID]) {
key->recircId = NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_RECIRC_ID]);
key->l2.keyLen += sizeof(key->recircId);
}

if (keyAttrs[OVS_KEY_ATTR_DP_HASH]) {
key->dpHash = NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_DP_HASH]);
key->l2.keyLen += sizeof(key->dpHash);
}

return status;
}

/*
*----------------------------------------------------------------------------
* Initializes 'flow' members from 'packet', 'skb_priority', 'tun_id', and
Expand Down
2 changes: 2 additions & 0 deletions datapath-windows/ovsext/Flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ NDIS_STATUS OvsDeleteFlowTable(OVS_DATAPATH *datapath);
NDIS_STATUS OvsAllocateFlowTable(OVS_DATAPATH *datapath,
POVS_SWITCH_CONTEXT switchContext);

NDIS_STATUS OvsGetFlowMetadata(OvsFlowKey *key,
PNL_ATTR *keyAttrs);
NDIS_STATUS OvsExtractFlow(const NET_BUFFER_LIST *pkt, UINT32 inPort,
OvsFlowKey *flow, POVS_PACKET_HDR_INFO layers,
OvsIPv4TunnelKey *tunKey);
Expand Down
7 changes: 7 additions & 0 deletions datapath-windows/ovsext/User.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ _MapNlAttrToOvsPktExec(PNL_ATTR *nlAttrs, PNL_ATTR *keyAttrs,
execute->actionsLen = NlAttrGetSize(nlAttrs[OVS_PACKET_ATTR_ACTIONS]);

execute->inPort = NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_IN_PORT]);
execute->keyAttrs = keyAttrs;
}

NTSTATUS
Expand Down Expand Up @@ -429,6 +430,11 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute)
}
// XXX: Figure out if any of the other members of fwdDetail need to be set.

status = OvsGetFlowMetadata(&key, execute->keyAttrs);
if (status != STATUS_SUCCESS) {
goto dropit;
}

ndisStatus = OvsExtractFlow(pNbl, fwdDetail->SourcePortId, &key, &layers,
NULL);
if (ndisStatus == NDIS_STATUS_SUCCESS) {
Expand All @@ -450,6 +456,7 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute)
}
}

dropit:
if (pNbl) {
OvsCompleteNBL(gOvsSwitchContext, pNbl, TRUE);
}
Expand Down

0 comments on commit 877a19b

Please sign in to comment.