|
@@ -29,6 +29,7 @@
|
|
|
#include <linux/nls.h>
|
|
|
#include <linux/vmalloc.h>
|
|
|
#include <linux/rtnetlink.h>
|
|
|
+#include <linux/ucs2_string.h>
|
|
|
|
|
|
#include "hyperv_net.h"
|
|
|
#include "netvsc_trace.h"
|
|
@@ -1223,6 +1224,29 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+static void rndis_get_friendly_name(struct net_device *net,
|
|
|
+ struct rndis_device *rndis_device,
|
|
|
+ struct netvsc_device *net_device)
|
|
|
+{
|
|
|
+ ucs2_char_t wname[256];
|
|
|
+ unsigned long len;
|
|
|
+ u8 ifalias[256];
|
|
|
+ u32 size;
|
|
|
+
|
|
|
+ size = sizeof(wname);
|
|
|
+ if (rndis_filter_query_device(rndis_device, net_device,
|
|
|
+ RNDIS_OID_GEN_FRIENDLY_NAME,
|
|
|
+ wname, &size) != 0)
|
|
|
+ return;
|
|
|
+
|
|
|
+ /* Convert Windows Unicode string to UTF-8 */
|
|
|
+ len = ucs2_as_utf8(ifalias, wname, sizeof(ifalias));
|
|
|
+
|
|
|
+ /* ignore the default value from host */
|
|
|
+ if (strcmp(ifalias, "Network Adapter") != 0)
|
|
|
+ dev_set_alias(net, ifalias, len);
|
|
|
+}
|
|
|
+
|
|
|
struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
|
|
|
struct netvsc_device_info *device_info)
|
|
|
{
|
|
@@ -1276,6 +1300,10 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
|
|
|
|
|
|
memcpy(device_info->mac_adr, rndis_device->hw_mac_adr, ETH_ALEN);
|
|
|
|
|
|
+ /* Get friendly name as ifalias*/
|
|
|
+ if (!net->ifalias)
|
|
|
+ rndis_get_friendly_name(net, rndis_device, net_device);
|
|
|
+
|
|
|
/* Query and set hardware capabilities */
|
|
|
ret = rndis_netdev_set_hwcaps(rndis_device, net_device);
|
|
|
if (ret != 0)
|