From: Intel <intel.com>
Date: Tue, 12 Mar 2013 11:03:00 +0000 (+0100)
Subject: kni: various changes
X-Git-Tag: spdx-start~11283
X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d55d942fa9ed42c3843f9108d46b757630b82957;p=dpdk.git

kni: various changes

Signed-off-by: Intel
---

diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index bb87451603..f0728bb2ef 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -9146,15 +9146,6 @@ err_alloc_etherdev:
 
 void igb_kni_remove(struct pci_dev *pdev)
 {
-	struct net_device *netdev = pci_get_drvdata(pdev);
-	struct igb_adapter *adapter = netdev_priv(netdev);
-	struct e1000_hw *hw = &adapter->hw;
-
-	iounmap(hw->hw_addr);
-
-	if (hw->flash_address)
-		iounmap(hw->flash_address);
-
 	pci_disable_device(pdev);
 }
 
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
index 80d65a6177..11472bd33b 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
@@ -2664,6 +2664,7 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
 
 	spin_unlock(&adapter->fdir_perfect_lock);
 
+	kfree(input);
 	return err;
 err_out_w_lock:
 	spin_unlock(&adapter->fdir_perfect_lock);
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
index 7d6cd1db73..85de8179f4 100755
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
@@ -2939,10 +2939,6 @@ err_alloc_etherdev:
  **/
 void ixgbe_kni_remove(struct pci_dev *pdev)
 {
-	struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
-
-	iounmap(adapter->hw.hw_addr);
-
 	pci_disable_device(pdev);
 }
 
diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index f37202c02e..acd0e8275f 100755
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -76,18 +76,6 @@ static struct miscdevice kni_misc = {
 	.fops = &kni_fops,
 };
 
-/* Array of the kni supported PCI device ids */
-static struct pci_device_id kni_pci_ids[] = {
-	/* EM and IGB to be supported in future */
-	//#define RTE_PCI_DEV_ID_DECL_EM(vend, dev) {PCI_DEVICE(vend, dev)},
-	#define RTE_PCI_DEV_ID_DECL_IGB(vend, dev) {PCI_DEVICE(vend, dev)},
-	#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {PCI_DEVICE(vend, dev)},
-	#include <rte_pci_dev_ids.h>
-	{ 0, },
-};
-
-MODULE_DEVICE_TABLE(pci, kni_pci_ids);
-
 /* loopback mode */
 static char *lo_mode = NULL;
 
@@ -219,25 +207,6 @@ kni_thread(void *unused)
 	return 0;
 }
 
-static int
-kni_check_pci_device_id(uint16_t vendor_id, uint16_t device_id)
-{
-	int i, total = sizeof(kni_pci_ids)/sizeof(struct pci_device_id);
-	struct pci_device_id *p;
-
-	/* Check if the vendor id/device id are supported */
-	for (i = 0; i < total; i++) {
-		p = &kni_pci_ids[i];
-		if (p->vendor != vendor_id && p->vendor != PCI_ANY_ID)
-			continue;
-		if (p->device != device_id && p->device != PCI_ANY_ID)
-			continue;
-		return 0;
-	}
-
-	return -1;
-}
-
 static int
 kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param)
 {
@@ -264,14 +233,6 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param)
 		return -EIO;
 	}
 
-	/* Check if the PCI id is supported by KNI */
-	ret = kni_check_pci_device_id(dev_info.vendor_id, dev_info.device_id);
-	if (ret < 0) {
-		KNI_ERR("Invalid vendor_id: %x or device_id: %x\n",
-				dev_info.vendor_id, dev_info.device_id);
-		return -EINVAL;
-	}
-
 	net_dev = alloc_netdev(sizeof(struct kni_dev), dev_info.name,
 							kni_net_init);
 	if (net_dev == NULL) {