Patch to auto-load MSFT PV NIC driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am attaching a patch to auto-load hv_netvsc.

Regards,

K. Y



From: K. Y. Srinivasan <ksrinivasan@xxxxxxxxxx>
Subject: Auto-load the hyperV PV net driver. 
References: None
Patch-mainline:

Signed-off-by: K. Y. Srinivasan <ksrinivasan@xxxxxxxxxx>

Index: linux/drivers/staging/hv/netvsc_drv.c
===================================================================
--- linux.orig/drivers/staging/hv/netvsc_drv.c	2010-05-07 15:29:32.000000000 -0600
+++ linux/drivers/staging/hv/netvsc_drv.c	2010-05-07 15:30:00.000000000 -0600
@@ -29,6 +29,8 @@
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/in.h>
+#include <linux/dmi.h>
+#include <linux/pci.h>
 #include <net/arp.h>
 #include <net/route.h>
 #include <net/sock.h>
@@ -592,6 +594,20 @@ static int netvsc_drv_init(int (*drv_ini
 	return ret;
 }
 
+static const struct dmi_system_id __initconst
+hv_netvsc_dmi_table[] __maybe_unused  = {
+	{
+		.ident = "Hyper-V",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
+			DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
+		},
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(dmi, hv_netvsc_dmi_table);
+
 static int __init netvsc_init(void)
 {
 	int ret;
@@ -599,6 +615,9 @@ static int __init netvsc_init(void)
 	DPRINT_ENTER(NETVSC_DRV);
 	DPRINT_INFO(NETVSC_DRV, "Netvsc initializing....");
 
+	if (!dmi_check_system(hv_netvsc_dmi_table))
+		return -ENODEV;
+
 	ret = netvsc_drv_init(NetVscInitialize);
 
 	DPRINT_EXIT(NETVSC_DRV);
@@ -613,6 +632,13 @@ static void __exit netvsc_exit(void)
 	DPRINT_EXIT(NETVSC_DRV);
 }
 
+static const struct pci_device_id __initconst
+hv_netvsc_pci_table[] __maybe_unused = {
+	{ PCI_DEVICE(0x1414, 0x5353) }, /* VGA compatible controller */
+	{ 0 }
+};
+MODULE_DEVICE_TABLE(pci, hv_netvsc_pci_table);
+
 module_param(netvsc_ringbuffer_size, int, S_IRUGO);
 
 module_init(netvsc_init);
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux