All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Blunck <jblunck@infradead.org>
To: dev@dpdk.org
Subject: [PATCH 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate()
Date: Thu, 17 Nov 2016 15:24:45 +0100	[thread overview]
Message-ID: <1479392685-19608-2-git-send-email-jblunck@infradead.org> (raw)
In-Reply-To: <1479392685-19608-1-git-send-email-jblunck@infradead.org>

This moves the non-PCI related initialization of the link state interrupt
callback list and the setting of the default MTU to rte_eth_dev_allocate()
so that drivers only need to set non-default values.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
 drivers/net/bonding/rte_eth_bond_api.c |  2 --
 drivers/net/cxgbe/cxgbe_main.c         |  2 --
 drivers/net/mlx4/mlx4.c                |  2 --
 drivers/net/mlx5/mlx5.c                |  3 ---
 drivers/net/null/rte_eth_null.c        |  2 --
 drivers/net/ring/rte_eth_ring.c        |  2 --
 drivers/net/vhost/rte_eth_vhost.c      |  2 --
 lib/librte_ether/rte_ethdev.c          | 12 ++++--------
 8 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 2a3893a..18237a3 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -200,8 +200,6 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
 	eth_dev->data->nb_rx_queues = (uint16_t)1;
 	eth_dev->data->nb_tx_queues = (uint16_t)1;
 
-	TAILQ_INIT(&(eth_dev->link_intr_cbs));
-
 	eth_dev->data->dev_link.link_status = ETH_LINK_DOWN;
 
 	eth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 922155b..9e8402b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1172,8 +1172,6 @@ int cxgbe_probe(struct adapter *adapter)
 
 		rte_eth_copy_pci_info(pi->eth_dev, pi->eth_dev->pci_dev);
 
-		TAILQ_INIT(&pi->eth_dev->link_intr_cbs);
-
 		pi->eth_dev->data->mac_addrs = rte_zmalloc(name,
 							   ETHER_ADDR_LEN, 0);
 		if (!pi->eth_dev->data->mac_addrs) {
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 9264242..d815a52 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5834,7 +5834,6 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 			eth_dev->rx_pkt_burst = mlx4_rx_burst_secondary_setup;
 		} else {
 			eth_dev->data->dev_private = priv;
-			eth_dev->data->mtu = ETHER_MTU;
 			eth_dev->data->mac_addrs = priv->mac;
 		}
 		eth_dev->pci_dev = pci_dev;
@@ -5845,7 +5844,6 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 
 		priv->dev = eth_dev;
 		eth_dev->dev_ops = &mlx4_dev_ops;
-		TAILQ_INIT(&eth_dev->link_intr_cbs);
 
 		/* Bring Ethernet device up. */
 		DEBUG("forcing Ethernet interface up");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b57cad1..0e91f02 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -652,7 +652,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 			eth_dev->rx_pkt_burst = mlx5_rx_burst_secondary_setup;
 		} else {
 			eth_dev->data->dev_private = priv;
-			eth_dev->data->mtu = ETHER_MTU;
 			eth_dev->data->mac_addrs = priv->mac;
 		}
 
@@ -662,8 +661,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		priv->dev = eth_dev;
 		eth_dev->dev_ops = &mlx5_dev_ops;
 
-		TAILQ_INIT(&eth_dev->link_intr_cbs);
-
 		/* Bring Ethernet device up. */
 		DEBUG("forcing Ethernet interface up");
 		priv_set_flags(priv, ~IFF_UP, IFF_UP);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 836d982..f09caf1 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -550,8 +550,6 @@ eth_dev_null_create(const char *name,
 	eth_dev->data = data;
 	eth_dev->dev_ops = &ops;
 
-	TAILQ_INIT(&eth_dev->link_intr_cbs);
-
 	eth_dev->driver = NULL;
 	data->dev_flags = RTE_ETH_DEV_DETACHABLE;
 	data->kdrv = RTE_KDRV_NONE;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index c1767c4..c7726f4 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -346,8 +346,6 @@ do_eth_dev_ring_create(const char *name,
 	data->drv_name = drivername;
 	data->numa_node = numa_node;
 
-	TAILQ_INIT(&(eth_dev->link_intr_cbs));
-
 	/* finally assign rx and tx ops */
 	eth_dev->rx_pkt_burst = eth_ring_rx;
 	eth_dev->tx_pkt_burst = eth_ring_tx;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 766d4ef..1912346 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -1032,8 +1032,6 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
 	if (vring_state == NULL)
 		goto error;
 
-	TAILQ_INIT(&eth_dev->link_intr_cbs);
-
 	/* now put it all together
 	 * - store queue data in internal,
 	 * - store numa_node info in ethdev data
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 12af4b1..f58a995 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -215,6 +215,10 @@ rte_eth_dev_allocate(const char *name)
 	memset(eth_dev->data, 0, sizeof(*eth_dev->data));
 	snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
 	eth_dev->data->port_id = port_id;
+	eth_dev->data->rx_mbuf_alloc_failed = 0;
+	eth_dev->data->mtu = ETHER_MTU;
+	TAILQ_INIT(&(eth_dev->link_intr_cbs));
+
 	eth_dev->attached = DEV_ATTACHED;
 	eth_dev_last_created_port = port_id;
 	nb_ports++;
@@ -261,14 +265,6 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
 	eth_dev->pci_dev = pci_dev;
 	eth_dev->driver = eth_drv;
 
-	/* init user callbacks */
-	TAILQ_INIT(&(eth_dev->link_intr_cbs));
-
-	/*
-	 * Set the default MTU.
-	 */
-	eth_dev->data->mtu = ETHER_MTU;
-
 	/* Invoke PMD device initialization function */
 	diag = (*eth_drv->eth_dev_init)(eth_dev);
 	if (diag == 0)
-- 
2.7.4

  reply	other threads:[~2016-11-17 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 14:24 [PATCH 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Jan Blunck
2016-11-17 14:24 ` Jan Blunck [this message]
2016-11-17 15:46   ` [PATCH 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Ferruh Yigit
2016-11-17 16:47     ` Jan Blunck
2016-11-17 16:05 ` [PATCH 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479392685-19608-2-git-send-email-jblunck@infradead.org \
    --to=jblunck@infradead.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.