* [dpdk-dev] [PATCH 1/2] Clear eth_dev->data in rte_eth_dev_allocate() @ 2016-11-17 14:24 Jan Blunck 2016-11-17 14:24 ` [dpdk-dev] [PATCH 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Jan Blunck 2016-11-17 16:05 ` [dpdk-dev] [PATCH 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 14:24 UTC (permalink / raw) To: dev 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/mlx4/mlx4.c | 1 - drivers/net/mlx5/mlx5.c | 1 - lib/librte_ether/rte_ethdev.c | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) 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/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 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() 2016-11-17 14:24 [dpdk-dev] [PATCH 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Jan Blunck @ 2016-11-17 14:24 ` Jan Blunck 2016-11-17 15:46 ` Ferruh Yigit 2016-11-17 16:05 ` [dpdk-dev] [PATCH 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 14:24 UTC (permalink / raw) To: dev 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(ð_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..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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() 2016-11-17 14:24 ` [dpdk-dev] [PATCH 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Jan Blunck @ 2016-11-17 15:46 ` Ferruh Yigit 2016-11-17 16:47 ` Jan Blunck 0 siblings, 1 reply; 5+ messages in thread From: Ferruh Yigit @ 2016-11-17 15:46 UTC (permalink / raw) To: Jan Blunck, dev On 11/17/2016 2:24 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> > --- > 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(-) I think following also redundant and can be removed: app/test/virtual_pmd.c: 604: TAILQ_INIT(&(eth_dev->link_intr_cbs)); <...> > 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 What do you think doing same thing for rte_cryptodev.c J > @@ -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; This is no more required, because of memset > + 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) > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() 2016-11-17 15:46 ` Ferruh Yigit @ 2016-11-17 16:47 ` Jan Blunck 0 siblings, 0 replies; 5+ messages in thread From: Jan Blunck @ 2016-11-17 16:47 UTC (permalink / raw) To: Ferruh Yigit; +Cc: dev On Thu, Nov 17, 2016 at 4:46 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote: > On 11/17/2016 2:24 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> >> --- >> 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(-) > > I think following also redundant and can be removed: > app/test/virtual_pmd.c: > 604: TAILQ_INIT(&(eth_dev->link_intr_cbs)); > > <...> > >> 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 > > What do you think doing same thing for rte_cryptodev.c J > Thanks for the review Ferruh. I'll fixup the patches and resend. I'm currently looking in the rte_bus and rte_eth_dev stuff. If nobody volunteers to do the changes for cryptodev I can take a look at some later point. Thanks, Jan >> @@ -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; > > This is no more required, because of memset > >> + 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) >> > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] Clear eth_dev->data in rte_eth_dev_allocate() 2016-11-17 14:24 [dpdk-dev] [PATCH 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Jan Blunck 2016-11-17 14:24 ` [dpdk-dev] [PATCH 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Jan Blunck @ 2016-11-17 16:05 ` Ferruh Yigit 1 sibling, 0 replies; 5+ messages in thread From: Ferruh Yigit @ 2016-11-17 16:05 UTC (permalink / raw) To: Jan Blunck, dev On 11/17/2016 2:24 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> > --- > drivers/net/mlx4/mlx4.c | 1 - > drivers/net/mlx5/mlx5.c | 1 - > lib/librte_ether/rte_ethdev.c | 2 +- + drivers/net/bonding/rte_eth_bond_api.c ? - eth_dev->data->dev_link.link_status = ETH_LINK_DOWN; - ... - eth_dev->data->dev_started = 0; - eth_dev->data->promiscuous = 0; - eth_dev->data->scattered_rx = 0; - eth_dev->data->all_multicast = 0; - + drivers/net/mpipe/mpipe_tilegx.c ? - eth_dev->data->dev_flags = 0; <...> > @@ -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)); > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-17 16:47 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-11-17 14:24 [dpdk-dev] [PATCH 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Jan Blunck 2016-11-17 14:24 ` [dpdk-dev] [PATCH 2/2] Move non-PCI related eth_dev initialization to rte_eth_dev_allocate() Jan Blunck 2016-11-17 15:46 ` Ferruh Yigit 2016-11-17 16:47 ` Jan Blunck 2016-11-17 16:05 ` [dpdk-dev] [PATCH 1/2] Clear eth_dev->data in rte_eth_dev_allocate() Ferruh Yigit
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).