[v2,5/7] kni: remove unused PCI info from test and example

Message ID 20210918022443.12719-6-chenbo.xia@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series Removal of PCI bus ABIs |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chenbo Xia Sept. 18, 2021, 2:24 a.m. UTC
  PCI device id and address in structure rte_kni_conf are never used
in the test, example and kni library. So remove the related code.

Fixes: ea6b39b5b847 ("kni: remove ethtool support")
Cc: stable@dpdk.org

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 app/test/test_kni.c        | 57 --------------------------------------
 examples/ip_pipeline/kni.c | 16 -----------
 2 files changed, 73 deletions(-)
  

Patch

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 96733554b6..aa9a316c50 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -25,7 +25,6 @@  test_kni(void)
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
@@ -424,32 +423,14 @@  test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 	unsigned i;
 	struct rte_kni *kni;
 	struct rte_kni_conf conf;
-	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 
 	if (!mp)
 		return -1;
 
 	memset(&conf, 0, sizeof(conf));
-	memset(&info, 0, sizeof(info));
 	memset(&ops, 0, sizeof(ops));
 
-	ret = rte_eth_dev_info_get(port_id, &info);
-	if (ret != 0) {
-		printf("Error during getting device (port %u) info: %s\n",
-				port_id, strerror(-ret));
-		return -1;
-	}
-
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
 
 	/* core id 1 configured for kernel thread */
@@ -543,10 +524,7 @@  test_kni(void)
 	struct rte_kni *kni;
 	struct rte_mempool *mp;
 	struct rte_kni_conf conf;
-	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
 	FILE *fd;
 	DIR *dir;
 	char buf[16];
@@ -634,26 +612,9 @@  test_kni(void)
 	fclose(fd);
 
 	/* test of allocating KNI with NULL mempool pointer */
-	memset(&info, 0, sizeof(info));
 	memset(&conf, 0, sizeof(conf));
 	memset(&ops, 0, sizeof(ops));
 
-	ret = rte_eth_dev_info_get(port_id, &info);
-	if (ret != 0) {
-		printf("Error during getting device (port %u) info: %s\n",
-				port_id, strerror(-ret));
-		return -1;
-	}
-
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
@@ -678,26 +639,8 @@  test_kni(void)
 
 	/* test of allocating KNI without a name */
 	memset(&conf, 0, sizeof(conf));
-	memset(&info, 0, sizeof(info));
 	memset(&ops, 0, sizeof(ops));
 
-	ret = rte_eth_dev_info_get(port_id, &info);
-	if (ret != 0) {
-		printf("Error during getting device (port %u) info: %s\n",
-				port_id, strerror(-ret));
-		ret = -1;
-		goto fail;
-	}
-
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index a2d3331cb0..fccecc3dc6 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -6,7 +6,6 @@ 
 #include <string.h>
 
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_string_fns.h>
 
 #include "kni.h"
@@ -100,16 +99,12 @@  kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
 struct kni *
 kni_create(const char *name, struct kni_params *params)
 {
-	struct rte_eth_dev_info dev_info;
 	struct rte_kni_conf kni_conf;
 	struct rte_kni_ops kni_ops;
 	struct kni *kni;
 	struct mempool *mempool;
 	struct link *link;
 	struct rte_kni *k;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
-	int ret;
 
 	/* Check input params */
 	if ((name == NULL) ||
@@ -124,23 +119,12 @@  kni_create(const char *name, struct kni_params *params)
 		return NULL;
 
 	/* Resource create */
-	ret = rte_eth_dev_info_get(link->port_id, &dev_info);
-	if (ret != 0)
-		return NULL;
-
 	memset(&kni_conf, 0, sizeof(kni_conf));
 	strlcpy(kni_conf.name, name, RTE_KNI_NAMESIZE);
 	kni_conf.force_bind = params->force_bind;
 	kni_conf.core_id = params->thread_id;
 	kni_conf.group_id = link->port_id;
 	kni_conf.mbuf_size = mempool->buffer_size;
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		kni_conf.addr = pci_dev->addr;
-		kni_conf.id = pci_dev->id;
-	}
 
 	memset(&kni_ops, 0, sizeof(kni_ops));
 	kni_ops.port_id = link->port_id;