[ovs-dev] [PATCH] datapath-windows: Add support for handling DEI bit of VLAN header

Alin Gabriel Serdean aserdean at ovn.org
Wed Jun 6 17:32:49 UTC 2018



> On 16 May 2018, at 02:38, Anand Kumar <kumaranand at vmware.com> wrote:
> 
> The Drop eligible indicator(DEI) is 1 bit wide and it is part of
> Tag control information (TCI) in VLAN header, which indicates that
> the frame can be dropped during congestion.
> 
> Signed-off-by: Anand Kumar <kumaranand at vmware.com>
> ---
> datapath-windows/ovsext/Actions.c |  1 +
> datapath-windows/ovsext/User.c    | 19 +++++++++++++------
> 2 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
> index 9bbc787..6922f05 100644
> --- a/datapath-windows/ovsext/Actions.c
> +++ b/datapath-windows/ovsext/Actions.c
> @@ -2023,6 +2023,7 @@ OvsDoExecuteActions(POVS_SWITCH_CONTEXT switchContext,
>                  vlan = (struct ovs_action_push_vlan *)NlAttrGet((const PNL_ATTR)a);
>                  vlanTag->TagHeader.VlanId = ntohs(vlan->vlan_tci) & 0xfff;
>                  vlanTag->TagHeader.UserPriority = ntohs(vlan->vlan_tci) >> 13;
> +                 vlanTag->TagHeader.CanonicalFormatId = (ntohs(vlan->vlan_tci) >> 12) & 0x1;
> 
>                  NET_BUFFER_LIST_INFO(ovsFwdCtx.curNbl,
>                                       Ieee8021QNetBufferListInfo) = vlanTagValue;
> diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c
> index 4693a8b..509472f 100644
> --- a/datapath-windows/ovsext/User.c
> +++ b/datapath-windows/ovsext/User.c
> @@ -1000,11 +1000,12 @@ OvsCreateQueueNlPacket(PVOID userData,
>                        POVS_PACKET_HDR_INFO hdrInfo)
> {
> #define VLAN_TAG_SIZE 4
> -    UINT32 allocLen, dataLen, extraLen;
> +    UINT32 allocLen, dataLen, extraLen = 0;
>     POVS_PACKET_QUEUE_ELEM elem;
>     UINT8 *src, *dst;
>     NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO csumInfo;
> -    NDIS_NET_BUFFER_LIST_8021Q_INFO vlanInfo;
> +    PNDIS_NET_BUFFER_LIST_8021Q_INFO vlanInfo = NULL;
> +    PVOID vlanTag;
>     OvsIPv4TunnelKey *tunnelKey = (OvsIPv4TunnelKey *)&key->tunKey;
>     UINT32 pid;
>     UINT32 nlMsgSize;
> @@ -1037,8 +1038,13 @@ OvsCreateQueueNlPacket(PVOID userData,
>         return NULL;
>     }
> 
> -    vlanInfo.Value = NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo);
> -    extraLen = vlanInfo.TagHeader.VlanId ? VLAN_TAG_SIZE : 0;
> +    vlanTag = NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo);
> +    if (vlanTag) {
> +        vlanInfo = (PNDIS_NET_BUFFER_LIST_8021Q_INFO)(PVOID *)&vlanTag;
> +        if (vlanInfo->Value) {
> +            extraLen = VLAN_TAG_SIZE;
> +        }
> +    }
> 
>     dataLen = NET_BUFFER_DATA_LENGTH(nb);
> 
> @@ -1148,8 +1154,9 @@ OvsCreateQueueNlPacket(PVOID userData,
>         ((UINT32 *)dst)[2] = ((UINT32 *)src)[2];
>         dst += 12;
>         ((UINT16 *)dst)[0] = htons(0x8100);
> -        ((UINT16 *)dst)[1] = htons(vlanInfo.TagHeader.VlanId |
> -            (vlanInfo.TagHeader.UserPriority << 13));
> +        ((UINT16 *)dst)[1] = htons(vlanInfo->TagHeader.VlanId |
> +            (vlanInfo->TagHeader.CanonicalFormatId << 12) |
> +            (vlanInfo->TagHeader.UserPriority << 13));
>         elem->hdrInfo.l3Offset += VLAN_TAG_SIZE;
>         elem->hdrInfo.l4Offset += VLAN_TAG_SIZE;
>         ovsUserStats.vlanInsert++;
> -- 
> 2.9.3.windows.1
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Acked-by: Alin Gabriel Serdean <aserdean at ovn.org>



More information about the dev mailing list