* [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() @ 2016-11-17 17:16 Jan Blunck 2016-11-17 17:16 ` [dpdk-dev] [PATCH v2 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Jan Blunck 2016-11-17 18:23 ` [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Ferruh Yigit 0 siblings, 2 replies; 5+ messages in thread From: Jan Blunck @ 2016-11-17 17:16 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit Lets clear the eth_dev->data when allocating a new rte_eth_dev so that drivers only need to set non-zero values. Signed-off-by: Jan Blunck <jblunck@infradead.org> --- drivers/net/bonding/rte_eth_bond_api.c | 7 ------- drivers/net/mlx4/mlx4.c | 1 - drivers/net/mlx5/mlx5.c | 1 - drivers/net/mpipe/mpipe_tilegx.c | 1 - lib/librte_ether/rte_ethdev.c | 2 +- 5 files changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 2a3893a..ed75c28 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -202,8 +202,6 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) 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, socket_id); if (eth_dev->data->mac_addrs == NULL) { @@ -211,11 +209,6 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) goto err; } - eth_dev->data->dev_started = 0; - eth_dev->data->promiscuous = 0; - eth_dev->data->scattered_rx = 0; - eth_dev->data->all_multicast = 0; - eth_dev->dev_ops = &default_dev_ops; eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC | RTE_ETH_DEV_DETACHABLE; diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index da61a85..9264242 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->rx_mbuf_alloc_failed = 0; eth_dev->data->mtu = ETHER_MTU; eth_dev->data->mac_addrs = priv->mac; } diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 90cc35e..b57cad1 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->rx_mbuf_alloc_failed = 0; eth_dev->data->mtu = ETHER_MTU; eth_dev->data->mac_addrs = priv->mac; } diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index fbbbb00..792ab56 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -1603,7 +1603,6 @@ rte_pmd_mpipe_probe(const char *ifname, eth_dev->data->dev_private = priv; eth_dev->data->mac_addrs = &priv->mac_addr; - eth_dev->data->dev_flags = 0; eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->driver = NULL; eth_dev->data->drv_name = drivername; diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fde8112..12af4b1 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -212,6 +212,7 @@ rte_eth_dev_allocate(const char *name) eth_dev = &rte_eth_devices[port_id]; eth_dev->data = &rte_eth_dev_data[port_id]; + 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->attached = DEV_ATTACHED; @@ -259,7 +260,6 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, } eth_dev->pci_dev = pci_dev; eth_dev->driver = eth_drv; - eth_dev->data->rx_mbuf_alloc_failed = 0; /* init user callbacks */ TAILQ_INIT(&(eth_dev->link_intr_cbs)); -- 2.7.4 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() 2016-11-17 17:16 [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Jan Blunck @ 2016-11-17 17:16 ` Jan Blunck 2016-11-17 18:23 ` Ferruh Yigit 2016-11-17 18:23 ` [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Ferruh Yigit 1 sibling, 1 reply; 5+ messages in thread From: Jan Blunck @ 2016-11-17 17:16 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit 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> --- app/test/virtual_pmd.c | 2 -- 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 | 11 +++-------- 9 files changed, 3 insertions(+), 25 deletions(-) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 65b44c6..bd969f9 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -601,8 +601,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, 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->dev_link.link_speed = ETH_SPEED_NUM_10G; eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index ed75c28..19347d8 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->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0, socket_id); if (eth_dev->data->mac_addrs == NULL) { 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(ð_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(ð_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(ð_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(ð_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..1def33e 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -215,6 +215,9 @@ 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->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 +264,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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() 2016-11-17 17:16 ` [dpdk-dev] [PATCH v2 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Jan Blunck @ 2016-11-17 18:23 ` Ferruh Yigit 0 siblings, 0 replies; 5+ messages in thread From: Ferruh Yigit @ 2016-11-17 18:23 UTC (permalink / raw) To: Jan Blunck, dev On 11/17/2016 5:16 PM, Jan Blunck wrote: > 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> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() 2016-11-17 17:16 [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Jan Blunck 2016-11-17 17:16 ` [dpdk-dev] [PATCH v2 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Jan Blunck @ 2016-11-17 18:23 ` Ferruh Yigit 2016-12-21 16:39 ` Thomas Monjalon 1 sibling, 1 reply; 5+ messages in thread From: Ferruh Yigit @ 2016-11-17 18:23 UTC (permalink / raw) To: Jan Blunck, dev On 11/17/2016 5:16 PM, Jan Blunck wrote: > Lets clear the eth_dev->data when allocating a new rte_eth_dev so that > drivers only need to set non-zero values. > > Signed-off-by: Jan Blunck <jblunck@infradead.org> > --- Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() 2016-11-17 18:23 ` [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Ferruh Yigit @ 2016-12-21 16:39 ` Thomas Monjalon 0 siblings, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2016-12-21 16:39 UTC (permalink / raw) To: Jan Blunck; +Cc: dev, Ferruh Yigit > > Lets clear the eth_dev->data when allocating a new rte_eth_dev so that > > drivers only need to set non-zero values. > > > > Signed-off-by: Jan Blunck <jblunck@infradead.org> > > Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> Both patches applied, thanks ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-21 16:39 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-11-17 17:16 [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Jan Blunck 2016-11-17 17:16 ` [dpdk-dev] [PATCH v2 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Jan Blunck 2016-11-17 18:23 ` Ferruh Yigit 2016-11-17 18:23 ` [dpdk-dev] [PATCH v2 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Ferruh Yigit 2016-12-21 16:39 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).