net: add rte prefix to ether structures
[dpdk.git] / drivers / net / enic / enic_main.c
index b258132..6b76839 100644 (file)
@@ -8,7 +8,6 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <fcntl.h>
-#include <libgen.h>
 
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
@@ -518,7 +517,7 @@ static void enic_prep_wq_for_simple_tx(struct enic *enic, uint16_t queue_idx)
  * The 'strong' version is in enic_rxtx_vec_avx2.c. This weak version is used
  * used when that file is not compiled.
  */
-bool __attribute__((weak))
+__rte_weak bool
 enic_use_vector_rx_handler(__rte_unused struct enic *enic)
 {
        return false;
@@ -1379,12 +1378,10 @@ int enic_get_link_status(struct enic *enic)
 
 static void enic_dev_deinit(struct enic *enic)
 {
-       struct rte_eth_dev *eth_dev = enic->rte_dev;
-
        /* stop link status checking */
        vnic_dev_notify_unset(enic->vdev);
 
-       rte_free(eth_dev->data->mac_addrs);
+       /* mac_addrs is freed by rte_eth_dev_release_port() */
        rte_free(enic->cq);
        rte_free(enic->intr);
        rte_free(enic->rq);
@@ -1669,13 +1666,14 @@ static int enic_dev_init(struct enic *enic)
        /* Get the supported filters */
        enic_fdir_info(enic);
 
-       eth_dev->data->mac_addrs = rte_zmalloc("enic_mac_addr", ETH_ALEN
-                                               * ENIC_MAX_MAC_ADDR, 0);
+       eth_dev->data->mac_addrs = rte_zmalloc("enic_mac_addr",
+                                       sizeof(struct rte_ether_addr) *
+                                       ENIC_UNICAST_PERFECT_FILTERS, 0);
        if (!eth_dev->data->mac_addrs) {
                dev_err(enic, "mac addr storage alloc failed, aborting.\n");
                return -1;
        }
-       ether_addr_copy((struct ether_addr *) enic->mac_addr,
+       ether_addr_copy((struct rte_ether_addr *)enic->mac_addr,
                        eth_dev->data->mac_addrs);
 
        vnic_dev_set_reset_flag(enic->vdev, 0);
@@ -1710,16 +1708,21 @@ static int enic_dev_init(struct enic *enic)
                        DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
                        DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
                        DEV_TX_OFFLOAD_VXLAN_TNL_TSO;
-               /*
-                * Do not add PKT_TX_OUTER_{IPV4,IPV6} as they are not
-                * 'offload' flags (i.e. not part of PKT_TX_OFFLOAD_MASK).
-                */
                enic->tx_offload_mask |=
+                       PKT_TX_OUTER_IPV6 |
+                       PKT_TX_OUTER_IPV4 |
                        PKT_TX_OUTER_IP_CKSUM |
                        PKT_TX_TUNNEL_MASK;
                enic->overlay_offload = true;
-               enic->vxlan_port = ENIC_DEFAULT_VXLAN_PORT;
                dev_info(enic, "Overlay offload is enabled\n");
+       }
+       /*
+        * Reset the vxlan port if HW vxlan parsing is available. It
+        * is always enabled regardless of overlay offload
+        * enable/disable.
+        */
+       if (enic->vxlan) {
+               enic->vxlan_port = ENIC_DEFAULT_VXLAN_PORT;
                /*
                 * Reset the vxlan port to the default, as the NIC firmware
                 * does not reset it automatically and keeps the old setting.