summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Actions.c
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2016-12-20 19:42:19 +0000
committerGurucharan Shetty <guru@ovn.org>2016-12-20 12:22:48 -0800
commitcd30b3460ac53719a6b8aaaba89b29c0304ac335 (patch)
treeddf8a6e75efbdf59ef999bba6ded22eff01be3c1 /datapath-windows/ovsext/Actions.c
parentda467899ab6e67b645840195a64600d1484d0dce (diff)
downloadopenvswitch-cd30b3460ac53719a6b8aaaba89b29c0304ac335.tar.gz
datapath-windows: Add multiple switch internal ports
This patch adds multiple internal ports support to the windows datapath. All tunnels types have been updated to accommodate this new functionality. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Co-authored-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Paul Boca <pboca@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Actions.c')
-rw-r--r--datapath-windows/ovsext/Actions.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
index c1e0121cb..2a2441092 100644
--- a/datapath-windows/ovsext/Actions.c
+++ b/datapath-windows/ovsext/Actions.c
@@ -301,7 +301,6 @@ OvsDetectTunnelPkt(OvsForwardingContext *ovsFwdCtx,
return TRUE;
}
} else if (OvsIsTunnelVportType(dstVport->ovsType)) {
- ASSERT(ovsFwdCtx->tunnelTxNic == NULL);
ASSERT(ovsFwdCtx->tunnelRxNic == NULL);
/*
@@ -322,7 +321,7 @@ OvsDetectTunnelPkt(OvsForwardingContext *ovsFwdCtx,
if (!vport ||
(vport->ovsType != OVS_VPORT_TYPE_NETDEV &&
- !OvsIsBridgeInternalVport(vport) &&
+ vport->ovsType != OVS_VPORT_TYPE_INTERNAL &&
!OvsIsTunnelVportType(vport->ovsType))) {
ovsFwdCtx->tunKey.dst = 0;
}
@@ -403,10 +402,6 @@ OvsAddPorts(OvsForwardingContext *ovsFwdCtx,
vport->stats.txBytes +=
NET_BUFFER_DATA_LENGTH(NET_BUFFER_LIST_FIRST_NB(ovsFwdCtx->curNbl));
- if (OvsIsBridgeInternalVport(vport)) {
- return NDIS_STATUS_SUCCESS;
- }
-
if (OvsDetectTunnelPkt(ovsFwdCtx, vport, flowKey)) {
return NDIS_STATUS_SUCCESS;
}
@@ -671,7 +666,7 @@ OvsTunnelPortTx(OvsForwardingContext *ovsFwdCtx)
* Setup the source port to be the internal port to as to facilitate the
* second OvsLookupFlow.
*/
- if (ovsFwdCtx->switchContext->internalVport == NULL ||
+ if (ovsFwdCtx->switchContext->countInternalVports <= 0 ||
ovsFwdCtx->switchContext->virtualExternalVport == NULL) {
OvsClearTunTxCtx(ovsFwdCtx);
OvsCompleteNBLForwardingCtx(ovsFwdCtx,
@@ -679,37 +674,28 @@ OvsTunnelPortTx(OvsForwardingContext *ovsFwdCtx)
return NDIS_STATUS_FAILURE;
}
- /*
- * Save the 'srcVportNo', 'srcPortId', 'srcNicIndex' so that
- * this can be applied to the new NBL later on.
- */
- srcVportNo =
- ((POVS_VPORT_ENTRY)ovsFwdCtx->switchContext->internalVport)->portNo;
- srcPortId = ovsFwdCtx->switchContext->internalPortId;
- srcNicIndex =
- ((POVS_VPORT_ENTRY)ovsFwdCtx->switchContext->internalVport)->nicIndex;
-
- /* Do the encap. Encap function does not consume the NBL. */
+ OVS_FWD_INFO switchFwdInfo = { 0 };
+ /* Apply the encapsulation. The encapsulation will not consume the NBL. */
switch(ovsFwdCtx->tunnelTxNic->ovsType) {
case OVS_VPORT_TYPE_GRE:
status = OvsEncapGre(ovsFwdCtx->tunnelTxNic, ovsFwdCtx->curNbl,
&ovsFwdCtx->tunKey, ovsFwdCtx->switchContext,
- &ovsFwdCtx->layers, &newNbl);
+ &ovsFwdCtx->layers, &newNbl, &switchFwdInfo);
break;
case OVS_VPORT_TYPE_VXLAN:
status = OvsEncapVxlan(ovsFwdCtx->tunnelTxNic, ovsFwdCtx->curNbl,
&ovsFwdCtx->tunKey, ovsFwdCtx->switchContext,
- &ovsFwdCtx->layers, &newNbl);
+ &ovsFwdCtx->layers, &newNbl, &switchFwdInfo);
break;
case OVS_VPORT_TYPE_STT:
status = OvsEncapStt(ovsFwdCtx->tunnelTxNic, ovsFwdCtx->curNbl,
&ovsFwdCtx->tunKey, ovsFwdCtx->switchContext,
- &ovsFwdCtx->layers, &newNbl);
+ &ovsFwdCtx->layers, &newNbl, &switchFwdInfo);
break;
case OVS_VPORT_TYPE_GENEVE:
status = OvsEncapGeneve(ovsFwdCtx->tunnelTxNic, ovsFwdCtx->curNbl,
&ovsFwdCtx->tunKey, ovsFwdCtx->switchContext,
- &ovsFwdCtx->layers, &newNbl);
+ &ovsFwdCtx->layers, &newNbl, &switchFwdInfo);
break;
default:
ASSERT(! "Tx: Unhandled tunnel type");
@@ -718,8 +704,16 @@ OvsTunnelPortTx(OvsForwardingContext *ovsFwdCtx)
/* Reset the tunnel context so that it doesn't get used after this point. */
OvsClearTunTxCtx(ovsFwdCtx);
- if (status == NDIS_STATUS_SUCCESS) {
+ if (status == NDIS_STATUS_SUCCESS && switchFwdInfo.vport != NULL) {
ASSERT(newNbl);
+ /*
+ * Save the 'srcVportNo', 'srcPortId', 'srcNicIndex' so that
+ * this can be applied to the new NBL later on.
+ */
+ srcVportNo = switchFwdInfo.vport->portNo;
+ srcPortId = switchFwdInfo.vport->portId;
+ srcNicIndex = switchFwdInfo.vport->nicIndex;
+
OvsCompleteNBLForwardingCtx(ovsFwdCtx,
L"Complete after cloning NBL for encapsulation");
status = OvsInitForwardingCtx(ovsFwdCtx, ovsFwdCtx->switchContext,
@@ -971,12 +965,11 @@ dropit:
VOID
OvsLookupFlowOutput(POVS_SWITCH_CONTEXT switchContext,
VOID *compList,
- PNET_BUFFER_LIST curNbl)
+ PNET_BUFFER_LIST curNbl,
+ POVS_VPORT_ENTRY internalVport)
{
NDIS_STATUS status;
OvsForwardingContext ovsFwdCtx;
- POVS_VPORT_ENTRY internalVport =
- (POVS_VPORT_ENTRY)switchContext->internalVport;
/* XXX: make sure comp list was not a stack variable previously. */
OvsCompletionList *completionList = (OvsCompletionList *)compList;
@@ -986,7 +979,7 @@ OvsLookupFlowOutput(POVS_SWITCH_CONTEXT switchContext,
* It could, but will we get this callback from IP helper in that case. Need
* to check.
*/
- ASSERT(switchContext->internalVport);
+ ASSERT(switchContext->countInternalVports > 0);
status = OvsInitForwardingCtx(&ovsFwdCtx, switchContext, curNbl,
internalVport->portNo, 0,
NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(curNbl),
@@ -1076,7 +1069,7 @@ OvsOutputBeforeSetAction(OvsForwardingContext *ovsFwdCtx)
* --------------------------------------------------------------------------
* OvsPopFieldInPacketBuf --
* Function to pop a specified field of length 'shiftLength' located at
- * 'shiftOffset' from the ethernet header. The data on the left of the
+ * 'shiftOffset' from the Ethernet header. The data on the left of the
* 'shiftOffset' is right shifted.
*
* Returns a pointer to the new start in 'bufferData'.