Skip to contentSkip to conversation

redundant rte_vdev_driver declarations

PATCH In review Stephen Hemminger 4 participants 15 messages Jul 11, 2019 – Jul 15, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

cover redundant rte_vdev_driver declarations

Many drivers declare the local rte_vdev_driver structure multiple times. This is unnecessary.

Surprised it is so common, I guess everyone copies the same code.

Stephen Hemminger (9):
net/tap: remove redundant declarations
net/af_packet: remove redundant rte_vdev_driver declaration net/vhost: remove redundant rte_vdev_driver declaration net/null: remove redundant rte_vdev_driver declaration net/pcap: remove redundant rte_vdev_driver declaration net/ring: remove redundant rte_vdev_drive declaration net/virtio_user: remove redundant rte_vdev_driver declaration raw/skeleton_rawdev: remove redundant rte_vdev_driver declaration raw/dpaa2_cmif: remove redundant rte_vdev_driver declaration

 drivers/net/af_packet/rte_eth_af_packet.c     | 2 --
 drivers/net/null/rte_eth_null.c               | 2 --
 drivers/net/pcap/rte_eth_pcap.c               | 2 --
 drivers/net/ring/rte_eth_ring.c               | 2 --
 drivers/net/tap/rte_eth_tap.c                 | 2 --
 drivers/net/vhost/rte_eth_vhost.c             | 2 --
 drivers/net/virtio/virtio_user_ethdev.c       | 2 --
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         | 3 ---
 drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 3 ---
 9 files changed, 20 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/9 net/tap: remove redundant declarations

The rte_vdev_drivers are declared twice.
The first one is not necessary.

---
 drivers/net/tap/rte_eth_tap.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/tap/rte_eth_tap.c +0 -2
index 3841842f01f8..64bd049110e1 100644
@@ -71,8 +71,6 @@
 #define TAP_IOV_DEFAULT_MAX 1024
 
 static int tap_devices_count;
-static struct rte_vdev_driver pmd_tap_drv;
-static struct rte_vdev_driver pmd_tun_drv;
 
 static const char *valid_arguments[] = {
 	ETH_TAP_IFACE_ARG,
Signature · 1 line
2.20.1
Acked-by on v1 1/9
#2 lore raw

Re: [dpdk-dev] [PATCH 1/9] net/tap: remove redundant declarations

Quoted 28 lines · Stephen Hemminger

The rte_vdev_drivers are declared twice.
The first one is not necessary.

---
drivers/net/tap/rte_eth_tap.c | 2 --

1 file changed, 2 deletions(-)
drivers/net/tap/rte_eth_tap.c +0 -2
index 3841842f01f8..64bd049110e1 100644
@@ -71,8 +71,6 @@
 #define TAP_IOV_DEFAULT_MAX 1024
 
 static int tap_devices_count;
-static struct rte_vdev_driver pmd_tap_drv;
-static struct rte_vdev_driver pmd_tun_drv;
 
 static const char *valid_arguments[] = {
 	ETH_TAP_IFACE_ARG,
Signature · 1 line
2.20.1

Regards,
Keith

#3 lore raw

PATCH 2/9 net/af_packet: remove redundant rte_vdev_driver declaration

In reply to Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +0 -2
index db1a751cef5b..d2faefd9d724 100644
@@ -526,8 +526,6 @@ open_packet_iface(const char *key __rte_unused,
 	return 0;
 }
 
-static struct rte_vdev_driver pmd_af_packet_drv;
-
 static int
 rte_pmd_init_internals(struct rte_vdev_device *dev,
                        const int sockfd,
Signature · 1 line
2.20.1
#4 lore raw

PATCH 3/9 net/vhost: remove redundant rte_vdev_driver declaration

In reply to Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/net/vhost/rte_eth_vhost.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/vhost/rte_eth_vhost.c +0 -2
index 0b61e37a1995..57f382c65ff5 100644
@@ -1199,8 +1199,6 @@ static const struct eth_dev_ops ops = {
 	.rx_queue_intr_disable = eth_rxq_intr_disable,
 };
 
-static struct rte_vdev_driver pmd_vhost_drv;
-
 static int
 eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name,
 	int16_t queues, const unsigned int numa_node, uint64_t flags)
Signature · 1 line
2.20.1
#5 lore raw

PATCH 4/9 net/null: remove redundant rte_vdev_driver declaration

In reply to Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/net/null/rte_eth_null.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/null/rte_eth_null.c +0 -2
index f1b521a7564a..31cbb84d031d 100644
@@ -490,8 +490,6 @@ static const struct eth_dev_ops ops = {
 	.rss_hash_conf_get = eth_rss_hash_conf_get
 };
 
-static struct rte_vdev_driver pmd_null_drv;
-
 static int
 eth_dev_null_create(struct rte_vdev_device *dev,
 		unsigned packet_size,
Signature · 1 line
2.20.1
#6 lore raw

PATCH 5/9 net/pcap: remove redundant rte_vdev_driver declaration

In reply to Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/net/pcap/rte_eth_pcap.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/pcap/rte_eth_pcap.c +0 -2
index 26e85183e524..7ff6dc38dc9a 100644
@@ -1085,8 +1085,6 @@ get_infinite_rx_arg(const char *key __rte_unused,
 	return 0;
 }
 
-static struct rte_vdev_driver pmd_pcap_drv;
-
 static int
 pmd_init_internals(struct rte_vdev_device *vdev,
 		const unsigned int nb_rx_queues,
Signature · 1 line
2.20.1
#8 lore raw

PATCH 6/9 net/ring: remove redundant rte_vdev_drive declaration

In reply to Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/net/ring/rte_eth_ring.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ring/rte_eth_ring.c +0 -2
index 65c2813ba1bc..eb347bce61b7 100644
@@ -248,8 +248,6 @@ static const struct eth_dev_ops ops = {
 	.mac_addr_add = eth_mac_addr_add,
 };
 
-static struct rte_vdev_driver pmd_ring_drv;
-
 static int
 do_eth_dev_ring_create(const char *name,
 		struct rte_ring * const rx_queues[],
Signature · 1 line
2.20.1
Acked-by on v1 6/9
#9 lore raw

Re: [dpdk-dev] [PATCH 6/9] net/ring: remove redundant rte_vdev_drive declaration

Quoted 14 lines · Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/net/ring/rte_eth_ring.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ring/rte_eth_ring.c +0 -0
index 65c2813ba1bc..eb347bce61b7 100644

drivers/net/ring/rte_eth_ring.c static const struct eth_dev_ops ops = { · line 253

Quoted 8 lines
drivers/net/ring/rte_eth_ring.c +0 -2
@@ -248,8 +248,6 @@ static const struct eth_dev_ops ops = {
 	.mac_addr_add = eth_mac_addr_add,
 };
 
-static struct rte_vdev_driver pmd_ring_drv;
-
 static int
 do_eth_dev_ring_create(const char *name,
 		struct rte_ring * const rx_queues[],
#10 lore raw

PATCH 7/9 net/virtio_user: remove redundant rte_vdev_driver declaration

In reply to Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/net/virtio/virtio_user_ethdev.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/virtio/virtio_user_ethdev.c +0 -2
index 0a57db730cfd..3fc1725736b5 100644
@@ -441,8 +441,6 @@ get_integer_arg(const char *key __rte_unused,
 	return 0;
 }
 
-static struct rte_vdev_driver virtio_user_driver;
-
 static struct rte_eth_dev *
 virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev)
 {
Signature · 1 line
2.20.1
#11 lore raw

PATCH 8/9 raw/skeleton_rawdev: remove redundant rte_vdev_driver declaration

In reply to Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/raw/skeleton_rawdev/skeleton_rawdev.c +0 -3
index 42471fbd1187..586183a5b857 100644
@@ -37,9 +37,6 @@ static uint16_t skeldev_init_once;
 /**< Rawdev Skeleton dummy driver name */
 #define SKELETON_PMD_RAWDEV_NAME rawdev_skeleton
 
-/**< Skeleton rawdev driver object */
-static struct rte_vdev_driver skeleton_pmd_drv;
-
 struct queue_buffers {
 	void *bufs[SKELETON_QUEUE_MAX_DEPTH];
 };
Signature · 1 line
2.20.1
#12 lore raw

PATCH 9/9 raw/dpaa2_cmif: remove redundant rte_vdev_driver declaration

In reply to Stephen Hemminger

The rte_vdev_driver is declared twice.
The first one is not necessary.

---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +0 -3
index 05960cca95ed..3f42da1fed61 100644
@@ -26,9 +26,6 @@ int dpaa2_cmdif_logtype;
 /* CMDIF driver name */
 #define DPAA2_CMDIF_PMD_NAME dpaa2_dpci
 
-/* CMDIF driver object */
-static struct rte_vdev_driver dpaa2_cmdif_drv;
-
 /*
  * This API provides the DPCI device ID in 'attr_value'.
  * The device ID shall be passed by GPP to the AIOP using CMDIF commands.
Signature · 1 line
2.20.1
Reviewed-by on the v1 series
#13 lore raw
In reply to Stephen Hemminger
Quoted 5 lines · Stephen Hemminger

Many drivers declare the local rte_vdev_driver structure multiple times. This is unnecessary.

Surprised it is so common, I guess everyone copies the same code.

Quoted 10 lines

Stephen Hemminger (9):
net/tap: remove redundant declarations
net/af_packet: remove redundant rte_vdev_driver declaration net/vhost: remove redundant rte_vdev_driver declaration net/null: remove redundant rte_vdev_driver declaration net/pcap: remove redundant rte_vdev_driver declaration net/ring: remove redundant rte_vdev_drive declaration net/virtio_user: remove redundant rte_vdev_driver declaration raw/skeleton_rawdev: remove redundant rte_vdev_driver declaration raw/dpaa2_cmif: remove redundant rte_vdev_driver declaration

For series,

Series applied to dpdk-next-net/master, thanks.

#14 lore raw
Quoted 5 lines · Ferruh Yigit
Quoted 4 lines · Stephen Hemminger

Many drivers declare the local rte_vdev_driver structure multiple times. This is unnecessary.

Surprised it is so common, I guess everyone copies the same code.

It seems it is common because a patchset explicitly added them [1] to set driver name consistently, but later when another patch removed the related code [2] the forward declarations seems forgotten to be removed.

I have updated commits to include the fixes lines so that they can be backported (so that they don't cause additional conflicts for more serious patches in the future.)

[1]: Fixes: 73db5badb042 ("net: align ethdev and eal driver names") [2]: Fixes: 050fe6e9ff97 ("drivers/net: use ethdev allocation helper for vdev")

Quoted 17 lines
Quoted 11 lines

Stephen Hemminger (9):
net/tap: remove redundant declarations
net/af_packet: remove redundant rte_vdev_driver declaration net/vhost: remove redundant rte_vdev_driver declaration net/null: remove redundant rte_vdev_driver declaration net/pcap: remove redundant rte_vdev_driver declaration net/ring: remove redundant rte_vdev_drive declaration net/virtio_user: remove redundant rte_vdev_driver declaration raw/skeleton_rawdev: remove redundant rte_vdev_driver declaration raw/dpaa2_cmif: remove redundant rte_vdev_driver declaration

For series,

Series applied to dpdk-next-net/master, thanks.