net: add rte prefix to ether defines
[dpdk.git] / drivers / net / mvneta / mvneta_ethdev.c
index 2d76664..9657444 100644 (file)
@@ -4,6 +4,7 @@
  * All rights reserved.
  */
 
+#include <rte_string_fns.h>
 #include <rte_ethdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_bus_vdev.h>
@@ -260,7 +261,7 @@ mvneta_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
                        mbuf_data_size, mtu, mru);
        }
 
-       if (mtu < ETHER_MIN_MTU || mru > MVNETA_PKT_SIZE_MAX) {
+       if (mtu < RTE_ETHER_MIN_MTU || mru > MVNETA_PKT_SIZE_MAX) {
                MVNETA_LOG(ERR, "Invalid MTU [%u] or MRU [%u]", mtu, mru);
                return -EINVAL;
        }
@@ -347,7 +348,7 @@ mvneta_dev_start(struct rte_eth_dev *dev)
        if (priv->ppio)
                return mvneta_dev_set_link_up(dev);
 
-       snprintf(match, sizeof(match), "%s", dev->data->name);
+       strlcpy(match, dev->data->name, sizeof(match));
        priv->ppio_params.match = match;
        priv->ppio_params.inqs_params.mtu = dev->data->mtu;
 
@@ -585,7 +586,7 @@ static void
 mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 {
        struct mvneta_priv *priv = dev->data->dev_private;
-       char buf[ETHER_ADDR_FMT_SIZE];
+       char buf[RTE_ETHER_ADDR_FMT_SIZE];
        int ret;
 
        if (!priv->ppio)
@@ -594,7 +595,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
        ret = neta_ppio_remove_mac_addr(priv->ppio,
                                       dev->data->mac_addrs[index].addr_bytes);
        if (ret) {
-               ether_format_addr(buf, sizeof(buf),
+               rte_ether_format_addr(buf, sizeof(buf),
                                  &dev->data->mac_addrs[index]);
                MVNETA_LOG(ERR, "Failed to remove mac %s", buf);
        }
@@ -616,11 +617,11 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
  *   0 on success, negative error value otherwise.
  */
 static int
-mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
+mvneta_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
                  uint32_t index, uint32_t vmdq __rte_unused)
 {
        struct mvneta_priv *priv = dev->data->dev_private;
-       char buf[ETHER_ADDR_FMT_SIZE];
+       char buf[RTE_ETHER_ADDR_FMT_SIZE];
        int ret;
 
        if (index == 0)
@@ -632,7 +633,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
 
        ret = neta_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes);
        if (ret) {
-               ether_format_addr(buf, sizeof(buf), mac_addr);
+               rte_ether_format_addr(buf, sizeof(buf), mac_addr);
                MVNETA_LOG(ERR, "Failed to add mac %s", buf);
                return -1;
        }
@@ -649,7 +650,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
  *   MAC address to register.
  */
 static int
-mvneta_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
+mvneta_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
 {
        struct mvneta_priv *priv = dev->data->dev_private;
        int ret;
@@ -659,8 +660,8 @@ mvneta_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
 
        ret = neta_ppio_set_mac_addr(priv->ppio, mac_addr->addr_bytes);
        if (ret) {
-               char buf[ETHER_ADDR_FMT_SIZE];
-               ether_format_addr(buf, sizeof(buf), mac_addr);
+               char buf[RTE_ETHER_ADDR_FMT_SIZE];
+               rte_ether_format_addr(buf, sizeof(buf), mac_addr);
                MVNETA_LOG(ERR, "Failed to set mac to %s", buf);
        }
        return 0;
@@ -793,7 +794,7 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
 
        eth_dev->data->mac_addrs =
                rte_zmalloc("mac_addrs",
-                           ETHER_ADDR_LEN * MVNETA_MAC_ADDRS_MAX, 0);
+                           RTE_ETHER_ADDR_LEN * MVNETA_MAC_ADDRS_MAX, 0);
        if (!eth_dev->data->mac_addrs) {
                MVNETA_LOG(ERR, "Failed to allocate space for eth addrs");
                ret = -ENOMEM;
@@ -807,7 +808,7 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
                goto out_free;
 
        memcpy(eth_dev->data->mac_addrs[0].addr_bytes,
-              req.ifr_addr.sa_data, ETHER_ADDR_LEN);
+              req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN);
 
        eth_dev->data->kdrv = RTE_KDRV_NONE;
        eth_dev->device = &vdev->device;