net: add rte prefix to ether structures
[dpdk.git] / drivers / net / ring / rte_eth_ring.c
index 2e4ca3b..cae63a7 100644 (file)
@@ -51,7 +51,7 @@ struct pmd_internals {
        struct ring_queue rx_ring_queues[RTE_PMD_RING_MAX_RX_RINGS];
        struct ring_queue tx_ring_queues[RTE_PMD_RING_MAX_TX_RINGS];
 
-       struct ether_addr address;
+       struct rte_ether_addr address;
        enum dev_action action;
 };
 
@@ -218,7 +218,7 @@ eth_mac_addr_remove(struct rte_eth_dev *dev __rte_unused,
 
 static int
 eth_mac_addr_add(struct rte_eth_dev *dev __rte_unused,
-       struct ether_addr *mac_addr __rte_unused,
+       struct rte_ether_addr *mac_addr __rte_unused,
        uint32_t index __rte_unused,
        uint32_t vmdq __rte_unused)
 {
@@ -270,15 +270,15 @@ do_eth_dev_ring_create(const char *name,
        PMD_LOG(INFO, "Creating rings-backed ethdev on numa socket %u",
                        numa_node);
 
-       rx_queues_local = rte_zmalloc_socket(name,
-                       sizeof(void *) * nb_rx_queues, 0, numa_node);
+       rx_queues_local = rte_calloc_socket(name, nb_rx_queues,
+                                           sizeof(void *), 0, numa_node);
        if (rx_queues_local == NULL) {
                rte_errno = ENOMEM;
                goto error;
        }
 
-       tx_queues_local = rte_zmalloc_socket(name,
-                       sizeof(void *) * nb_tx_queues, 0, numa_node);
+       tx_queues_local = rte_calloc_socket(name, nb_tx_queues,
+                                           sizeof(void *), 0, numa_node);
        if (tx_queues_local == NULL) {
                rte_errno = ENOMEM;
                goto error;
@@ -383,7 +383,12 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 
        snprintf(args_str, sizeof(args_str), "%s=%p",
                 ETH_RING_INTERNAL_ARG, &args);
-       snprintf(ring_name, sizeof(ring_name), "net_ring_%s", name);
+
+       ret = snprintf(ring_name, sizeof(ring_name), "net_ring_%s", name);
+       if (ret >= (int)sizeof(ring_name)) {
+               rte_errno = ENAMETOOLONG;
+               return -1;
+       }
 
        ret = rte_vdev_init(ring_name, args_str);
        if (ret) {
@@ -391,7 +396,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
                return -1;
        }
 
-       rte_eth_dev_get_port_by_name(ring_name, &port_id);
+       ret = rte_eth_dev_get_port_by_name(ring_name, &port_id);
+       if (ret) {
+               rte_errno = ENODEV;
+               return -1;
+       }
 
        return port_id;
 }
@@ -417,7 +426,15 @@ eth_dev_ring_create(const char *name, const unsigned int numa_node,
                        RTE_PMD_RING_MAX_TX_RINGS);
 
        for (i = 0; i < num_rings; i++) {
-               snprintf(rng_name, sizeof(rng_name), "ETH_RXTX%u_%s", i, name);
+               int cc;
+
+               cc = snprintf(rng_name, sizeof(rng_name),
+                             "ETH_RXTX%u_%s", i, name);
+               if (cc >= (int)sizeof(rng_name)) {
+                       rte_errno = ENAMETOOLONG;
+                       return -1;
+               }
+
                rxtx[i] = (action == DEV_CREATE) ?
                                rte_ring_create(rng_name, 1024, numa_node,
                                                RING_F_SP_ENQ|RING_F_SC_DEQ) :