net/ark: set generator delay thread name
[dpdk.git] / drivers / net / ark / ark_ethdev.c
index 1dcc059..6372cf7 100644 (file)
@@ -7,7 +7,7 @@
 #include <dlfcn.h>
 
 #include <rte_bus_pci.h>
-#include <rte_ethdev_pci.h>
+#include <ethdev_pci.h>
 #include <rte_kvargs.h>
 
 #include "ark_global.h"
@@ -88,6 +88,11 @@ static const char * const valid_arguments[] = {
 static const struct rte_pci_id pci_id_ark_map[] = {
        {RTE_PCI_DEVICE(0x1d6c, 0x100d)},
        {RTE_PCI_DEVICE(0x1d6c, 0x100e)},
+       {RTE_PCI_DEVICE(0x1d6c, 0x100f)},
+       {RTE_PCI_DEVICE(0x1d6c, 0x1010)},
+       {RTE_PCI_DEVICE(0x1d6c, 0x1017)},
+       {RTE_PCI_DEVICE(0x1d6c, 0x1018)},
+       {RTE_PCI_DEVICE(0x1d6c, 0x1019)},
        {.vendor_id = 0, /* sentinel */ },
 };
 
@@ -181,58 +186,64 @@ check_for_ext(struct ark_adapter *ark)
        /* Get the entry points */
        ark->user_ext.dev_init =
                (void *(*)(struct rte_eth_dev *, void *, int))
-               dlsym(ark->d_handle, "dev_init");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_init");
        ARK_PMD_LOG(DEBUG, "device ext init pointer = %p\n",
                      ark->user_ext.dev_init);
        ark->user_ext.dev_get_port_count =
                (int (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "dev_get_port_count");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_get_port_count");
        ark->user_ext.dev_uninit =
                (void (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "dev_uninit");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_uninit");
        ark->user_ext.dev_configure =
                (int (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "dev_configure");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_configure");
        ark->user_ext.dev_start =
                (int (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "dev_start");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_start");
        ark->user_ext.dev_stop =
                (void (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "dev_stop");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_stop");
        ark->user_ext.dev_close =
                (void (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "dev_close");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_close");
        ark->user_ext.link_update =
                (int (*)(struct rte_eth_dev *, int, void *))
-               dlsym(ark->d_handle, "link_update");
+               dlsym(ark->d_handle, "rte_pmd_ark_link_update");
        ark->user_ext.dev_set_link_up =
                (int (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "dev_set_link_up");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_set_link_up");
        ark->user_ext.dev_set_link_down =
                (int (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "dev_set_link_down");
+               dlsym(ark->d_handle, "rte_pmd_ark_dev_set_link_down");
        ark->user_ext.stats_get =
                (int (*)(struct rte_eth_dev *, struct rte_eth_stats *,
                          void *))
-               dlsym(ark->d_handle, "stats_get");
+               dlsym(ark->d_handle, "rte_pmd_ark_stats_get");
        ark->user_ext.stats_reset =
                (void (*)(struct rte_eth_dev *, void *))
-               dlsym(ark->d_handle, "stats_reset");
+               dlsym(ark->d_handle, "rte_pmd_ark_stats_reset");
        ark->user_ext.mac_addr_add =
                (void (*)(struct rte_eth_dev *, struct rte_ether_addr *,
                        uint32_t, uint32_t, void *))
-               dlsym(ark->d_handle, "mac_addr_add");
+               dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_add");
        ark->user_ext.mac_addr_remove =
                (void (*)(struct rte_eth_dev *, uint32_t, void *))
-               dlsym(ark->d_handle, "mac_addr_remove");
+               dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_remove");
        ark->user_ext.mac_addr_set =
                (void (*)(struct rte_eth_dev *, struct rte_ether_addr *,
                          void *))
-               dlsym(ark->d_handle, "mac_addr_set");
+               dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_set");
        ark->user_ext.set_mtu =
                (int (*)(struct rte_eth_dev *, uint16_t,
                          void *))
-               dlsym(ark->d_handle, "set_mtu");
+               dlsym(ark->d_handle, "rte_pmd_ark_set_mtu");
+       ark->user_ext.rx_user_meta_hook =
+               (rx_user_meta_hook_fn)dlsym(ark->d_handle,
+                                           "rte_pmd_ark_rx_user_meta_hook");
+       ark->user_ext.tx_user_meta_hook =
+               (tx_user_meta_hook_fn)dlsym(ark->d_handle,
+                                           "rte_pmd_ark_tx_user_meta_hook");
 
        return found;
 }
@@ -254,8 +265,10 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
        ret = check_for_ext(ark);
        if (ret)
                return ret;
+
        pci_dev = RTE_ETH_DEV_TO_PCI(dev);
        rte_eth_copy_pci_info(dev, pci_dev);
+       dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
        /* Use dummy function until setup */
        dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
@@ -278,6 +291,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
        ark->rqpacing =
                (struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
        ark->started = 0;
+       ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
        ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
                      ark->sysctrl.t32[4],
@@ -383,6 +397,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
                eth_dev->rx_pkt_burst = ark->eth_dev->rx_pkt_burst;
 
                rte_eth_copy_pci_info(eth_dev, pci_dev);
+               eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
                eth_dev->data->mac_addrs = rte_zmalloc(name,
                                                RTE_ETHER_ADDR_LEN, 0);
@@ -519,20 +534,6 @@ eth_ark_dev_configure(struct rte_eth_dev *dev)
        return 0;
 }
 
-static void *
-delay_pg_start(void *arg)
-{
-       struct ark_adapter *ark = (struct ark_adapter *)arg;
-
-       /* This function is used exclusively for regression testing, We
-        * perform a blind sleep here to ensure that the external test
-        * application has time to setup the test before we generate packets
-        */
-       usleep(100000);
-       ark_pktgen_run(ark->pg);
-       return NULL;
-}
-
 static int
 eth_ark_dev_start(struct rte_eth_dev *dev)
 {
@@ -567,7 +568,8 @@ eth_ark_dev_start(struct rte_eth_dev *dev)
                /* Delay packet generatpr start allow the hardware to be ready
                 * This is only used for sanity checking with internal generator
                 */
-               if (pthread_create(&thread, NULL, delay_pg_start, ark)) {
+               if (rte_ctrl_thread_create(&thread, "ark-delay-pg", NULL,
+                                          ark_pktgen_delay_start, ark) != 0) {
                        ARK_PMD_LOG(ERR, "Could not create pktgen "
                                    "starter thread\n");
                        return -1;
@@ -741,6 +743,8 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
                                ETH_LINK_SPEED_50G |
                                ETH_LINK_SPEED_100G);
 
+       dev_info->rx_offload_capa = DEV_RX_OFFLOAD_TIMESTAMP;
+
        return 0;
 }