]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: initialize more fields on allocation
authorJan Blunck <jblunck@infradead.org>
Thu, 17 Nov 2016 17:16:12 +0000 (18:16 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 21 Dec 2016 16:32:17 +0000 (17:32 +0100)
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>
app/test/virtual_pmd.c
drivers/net/bonding/rte_eth_bond_api.c
drivers/net/cxgbe/cxgbe_main.c
drivers/net/mlx4/mlx4.c
drivers/net/mlx5/mlx5.c
drivers/net/null/rte_eth_null.c
drivers/net/ring/rte_eth_ring.c
drivers/net/vhost/rte_eth_vhost.c
lib/librte_ether/rte_ethdev.c

index 65b44c64a3d3f33a63e8cf832a49cc075e24a42e..bd969f9501d049ca507a893b01fedd884f4edcb8 100644 (file)
@@ -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;
index ed75c28c4211d60fe8a01024c9e3b3f839355604..19347d88eeff282ac844c42df7150b0dcd38c50e 100644 (file)
@@ -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) {
index 922155b4fb6e8c756c4969b2fa44f81e3483c268..9e8402b46608f35896d4c5cc88653e4e45deb498 100644 (file)
@@ -1172,8 +1172,6 @@ allocate_mac:
 
                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) {
index d96756584ec8f2c97fea4ee88feb79d3fee51090..82b51a72b16a4b4bf6d6fd0e394f5f6364b6fb3f 100644 (file)
@@ -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");
index 128a761b8bfb310feb4e984bc9425d6e2fdc6dd0..ca123e41f0c8869b03109b510216c9f9f5112db0 100644 (file)
@@ -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);
index 836d982ac473289c5cebe9f5293db78e03abf9dd..f09caf138e3a4f9308b841cb4c6ab701fd91bf76 100644 (file)
@@ -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;
index c1767c489d1cf3565a1c699351078f720ff2077c..c7726f49183667e02dfebd93b514e62ccd60afc7 100644 (file)
@@ -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;
index 766d4ef13e0b6a61b4b71a0f62250feace16ef97..1912346fe54f714e4271a0339bee9be627286f1c 100644 (file)
@@ -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
index 59038ad0bc8aec8acfcff2718120fb0312e35972..a6d82fa91850c171f5c89606bfc73480e2c6f8af 100644 (file)
@@ -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)