Alin,
Thanks for the patch. A general comment I have is that, once you call into 
OvsTunnelPortTx(), the caller has lost ownership of ovsFwdCtx->curNbl. 
ovsFwdCtx->fwdDetail is actual a pointer to the fwdDetail within 
ovsFwdCtx->curNbl. So, using ovsFwdCtx->fwdDetail would not be valid after the 
call to OvsTunnelPortTx().

I think you can move the logic of saving ports to OvsOutputBeforeSetAction(), 
and use it after/during the call to OvsInitForwardingCtx(). Pls. let me know if 
you want to discuss more on this.

thanks,
-- Nithin


> On Jun 18, 2015, at 7:27 PM, Alin Serdean <aserd...@cloudbasesolutions.com> 
> wrote:
> 
> If we have a flow rule in the following form:
> actions=strip_vlan,set_tunnel:0x3e9,15,16,17
> (Where port 15, 16 and 17 are VXLAN tunnels with different tunnelling
> information)
> 
> A packet which will hit that specific flow will only be sent out encapsulated
> with the first tunnelling information.
> 
> This patch saves the initial packet vport, source port and NIC index for
> further use of the currently implemented pipeline and ignores the latter if it
> is the last tunnelling port.
> 
> Signed-off-by: Alin Gabriel Serdean <aserd...@cloudbasesolutions.com>
> ---
> datapath-windows/ovsext/Actions.c | 26 +++++++++++++++++++++-----
> 1 file changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/datapath-windows/ovsext/Actions.c 
> b/datapath-windows/ovsext/Actions.c
> index d75949c..ba6d7c3 100644
> --- a/datapath-windows/ovsext/Actions.c
> +++ b/datapath-windows/ovsext/Actions.c
> @@ -680,7 +680,7 @@ OvsTunnelPortTx(OvsForwardingContext *ovsFwdCtx)
>         ASSERT(ovsFwdCtx->curNbl == NULL);
>     } else {
>         /*
> -        * XXX: Temporary freeing of the packet until we register a
> +         * XXX: Temporary freeing of the packet until we register a
>          * callback to IP helper.
>          */
>         OvsCompleteNBLForwardingCtx(ovsFwdCtx,
> @@ -796,7 +796,7 @@ dropNbl:
>  * --------------------------------------------------------------------------
>  */
> static __inline NDIS_STATUS
> -OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx)
> +OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx, BOOLEAN savePorts)
> {
>     NDIS_STATUS status = STATUS_SUCCESS;
>     POVS_SWITCH_CONTEXT switchContext = ovsFwdCtx->switchContext;
> @@ -865,7 +865,23 @@ OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx)
>     }
> 
>     if (ovsFwdCtx->tunnelTxNic != NULL) {
> +        /*
> +        * Save the source vport number, source port id and source NIC index,
> +        * in the case we need for further usage
> +        */
> +        UINT32 tempVportNo = ovsFwdCtx->srcVportNo;
> +        UINT32 tempSourcePortId = ovsFwdCtx->fwdDetail->SourcePortId;
> +        UINT32 tempNicIndex = ovsFwdCtx->fwdDetail->SourceNicIndex;
> +
>         status = OvsTunnelPortTx(ovsFwdCtx);
> +
> +        if (savePorts) {
> +            /* Write back the initial ports */
> +            ovsFwdCtx->srcVportNo = tempVportNo;
> +            ovsFwdCtx->fwdDetail->SourcePortId = tempSourcePortId;
> +            ovsFwdCtx->fwdDetail->SourceNicIndex = tempNicIndex;
> +        }
> +
>         ASSERT(ovsFwdCtx->tunnelTxNic == NULL);
>         ASSERT(ovsFwdCtx->tunKey.dst == 0);
>     } else if (ovsFwdCtx->tunnelRxNic != NULL) {
> @@ -976,8 +992,8 @@ OvsOutputBeforeSetAction(OvsForwardingContext *ovsFwdCtx)
>     ASSERT(ovsFwdCtx->destPortsSizeOut > 0 ||
>            ovsFwdCtx->tunnelTxNic != NULL || ovsFwdCtx->tunnelRxNic != NULL);
> 
> -    /* Send the original packet out */
> -    status = OvsOutputForwardingCtx(ovsFwdCtx);
> +    /* Send the original packet out and save the ports*/
> +    status = OvsOutputForwardingCtx(ovsFwdCtx, TRUE);
>     ASSERT(ovsFwdCtx->curNbl == NULL);
>     ASSERT(ovsFwdCtx->destPortsSizeOut == 0);
>     ASSERT(ovsFwdCtx->tunnelRxNic == NULL);
> @@ -1580,7 +1596,7 @@ OvsActionsExecute(POVS_SWITCH_CONTEXT switchContext,
> 
>     if (ovsFwdCtx.destPortsSizeOut > 0 || ovsFwdCtx.tunnelTxNic != NULL
>         || ovsFwdCtx.tunnelRxNic != NULL) {
> -        status = OvsOutputForwardingCtx(&ovsFwdCtx);
> +        status = OvsOutputForwardingCtx(&ovsFwdCtx, FALSE);
>         ASSERT(ovsFwdCtx.curNbl == NULL);
>     }
> 
> -- 
> 1.9.5.msysgit.0
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailman_listinfo_dev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=pNHQcdr7B40b4h6Yb7FIedI1dnBsxdDuTLBYD3JqV80&m=uLXL9MOfldjoaVexRLdWc3jEvpwDhM1BQ_HuZqkiABY&s=3RD0qekG5Udmd5lgQWjHwgTTk40zR_uCEyyA5bNSR50&e=
>  

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to