hi Sorin,
Thanks for the change. Looks good mostly. I had a couple of minor comments that 
are inlined.

> On Sep 11, 2015, at 4:09 AM, Sorin Vinturis 
> <svintu...@cloudbasesolutions.com> wrote:
> 
> The internal/external vports will have the actual OS-based names, which
> represent the NIC interface alias that is displayed by running
> 'Get-NetAdapter' Hyper-V PS command.
> 
> Signed-off-by: Sorin Vinturis <svintu...@cloudbasesolutions.com>

> static VOID
> AssignNicNameSpecial(POVS_VPORT_ENTRY vport)
> {
> -    size_t len;
> +    NTSTATUS status = STATUS_SUCCESS;
> +    WCHAR interfaceName[IF_MAX_STRING_SIZE] = { 0 };
> +    NET_LUID interfaceLuid = { 0 };
> +    size_t len = 0;
> 
> +    ASSERT(vport->portType == NdisSwitchPortTypeExternal || 
> +           vport->portType == NdisSwitchPortTypeInternal);
> +
> +    status = ConvertInterfaceGuidToLuid(&vport->netCfgInstanceId,
> +                                        &interfaceLuid);
> +    if (status == STATUS_SUCCESS) {
> +        status = ConvertInterfaceLuidToAlias(&interfaceLuid, interfaceName,
> +                                             IF_MAX_STRING_SIZE + 1);
> +    }

Can you pls. log an error if either of the functions fail along with the 
‘status’ value? Also, if the functions do fail, do you want to bail out 
processing?

> +
> +    if (status == STATUS_SUCCESS) {
> +        if (vport->portType == NdisSwitchPortTypeExternal &&
> +            vport->nicIndex == 0) {
> +            RtlStringCbPrintfW(vport->portFriendlyName.String, 
> IF_MAX_STRING_SIZE,
> +                               L"%s.virtualAdapter", interfaceName);
>         } else {
>             RtlStringCbPrintfW(vport->portFriendlyName.String,
> +                               IF_MAX_STRING_SIZE, L"%s", interfaceName);
>         }
> 
> +        RtlStringCbLengthW(vport->portFriendlyName.String, 
> IF_MAX_STRING_SIZE,
> +                           &len);
> +        vport->portFriendlyName.Length = (USHORT)len;
> +    }
> }
> 
> 
> @@ -1399,6 +1409,8 @@ OvsInitConfiguredSwitchNics(POVS_SWITCH_CONTEXT 
> switchContext)
>         }
>         OvsInitVportWithNicParam(switchContext, vport, nicParam);
>         if (nicParam->NicType == NdisSwitchNicTypeInternal) {
> +            /* Overwrite the 'portFriendlyName' of the internal vport. */
> +            AssignNicNameSpecial(vport);
>             OvsInternalAdapterUp(vport->portNo, &nicParam->NetCfgInstanceId);

There’s already a call to AssignNicNameSpecial() from InitHvVportCommon(). Do 
we need another call?
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to