]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: clear data when allocating device
authorJan Blunck <jblunck@infradead.org>
Thu, 17 Nov 2016 17:16:11 +0000 (18:16 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 21 Dec 2016 16:30:27 +0000 (17:30 +0100)
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>
drivers/net/bonding/rte_eth_bond_api.c
drivers/net/mlx4/mlx4.c
drivers/net/mlx5/mlx5.c
drivers/net/mpipe/mpipe_tilegx.c
lib/librte_ether/rte_ethdev.c

index 2a3893a15feda4e99772a7c24641118631e41b53..ed75c28c4211d60fe8a01024c9e3b3f839355604 100644 (file)
@@ -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;
index 90c3c07701288ce817ef85c5ff3b2d3ae58df863..d96756584ec8f2c97fea4ee88feb79d3fee51090 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->rx_mbuf_alloc_failed = 0;
                        eth_dev->data->mtu = ETHER_MTU;
                        eth_dev->data->mac_addrs = priv->mac;
                }
index 206c9f932bbdbc1c2a1de3869a645c59fef2e9e0..128a761b8bfb310feb4e984bc9425d6e2fdc6dd0 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->rx_mbuf_alloc_failed = 0;
                        eth_dev->data->mtu = ETHER_MTU;
                        eth_dev->data->mac_addrs = priv->mac;
                }
index fbbbb00254d6ee30a3dae06c8c8e3895eb3717f7..792ab563d9e5c653a2aae59214586a76d711aea7 100644 (file)
@@ -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;
index 1e0f206101ad476891a12fccb02db3b8000e92bd..59038ad0bc8aec8acfcff2718120fb0312e35972 100644 (file)
@@ -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));