X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fark%2Fark_ethdev.c;h=9dea5facb4506b6668fe7a9f5e4dbc8f8791b739;hb=0475c7770502cb4166b2577df3ff446af9d85515;hp=d472ae56431c302389d49bf471a498c880a3c7ef;hpb=cbfc6111b55787356e06fb227959672bf93a16d9;p=dpdk.git diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index d472ae5643..9dea5facb4 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include "ark_global.h" @@ -29,8 +29,8 @@ static int ark_config_device(struct rte_eth_dev *dev); static int eth_ark_dev_uninit(struct rte_eth_dev *eth_dev); static int eth_ark_dev_configure(struct rte_eth_dev *dev); static int eth_ark_dev_start(struct rte_eth_dev *dev); -static void eth_ark_dev_stop(struct rte_eth_dev *dev); -static void eth_ark_dev_close(struct rte_eth_dev *dev); +static int eth_ark_dev_stop(struct rte_eth_dev *dev); +static int eth_ark_dev_close(struct rte_eth_dev *dev); static int eth_ark_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int eth_ark_dev_link_update(struct rte_eth_dev *dev, @@ -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 */ }, }; @@ -105,7 +110,7 @@ eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, ret = eth_ark_dev_init(eth_dev); if (ret) - rte_eth_dev_pci_release(eth_dev); + rte_eth_dev_release_port(eth_dev); return ret; } @@ -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,14 +265,14 @@ 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 = ð_ark_recv_pkts_noop; dev->tx_pkt_burst = ð_ark_xmit_pkts_noop; - /* Let rte_eth_dev_close() release the port resources */ - dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; ark->bar0 = (uint8_t *)pci_dev->mem_resource[0].addr; ark->a_bar = (uint8_t *)pci_dev->mem_resource[2].addr; @@ -280,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], @@ -385,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); @@ -506,9 +519,6 @@ eth_ark_dev_uninit(struct rte_eth_dev *dev) ark_pktgen_uninit(ark->pg); ark_pktchkr_uninit(ark->pc); - dev->dev_ops = NULL; - dev->rx_pkt_burst = NULL; - dev->tx_pkt_burst = NULL; return 0; } @@ -524,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) { @@ -572,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 (pthread_create(&thread, NULL, + ark_pktgen_delay_start, ark->pg)) { ARK_PMD_LOG(ERR, "Could not create pktgen " "starter thread\n"); return -1; @@ -586,7 +583,7 @@ eth_ark_dev_start(struct rte_eth_dev *dev) return 0; } -static void +static int eth_ark_dev_stop(struct rte_eth_dev *dev) { uint16_t i; @@ -595,8 +592,9 @@ eth_ark_dev_stop(struct rte_eth_dev *dev) struct ark_mpu_t *mpu; if (ark->started == 0) - return; + return 0; ark->started = 0; + dev->data->dev_started = 0; /* Stop the extension first */ if (ark->user_ext.dev_stop) @@ -674,14 +672,19 @@ eth_ark_dev_stop(struct rte_eth_dev *dev) ark_pktchkr_dump_stats(ark->pc); ark_pktchkr_stop(ark->pc); } + + return 0; } -static void +static int eth_ark_dev_close(struct rte_eth_dev *dev) { struct ark_adapter *ark = dev->data->dev_private; uint16_t i; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + if (ark->user_ext.dev_close) ark->user_ext.dev_close(dev, ark->user_data[dev->data->port_id]); @@ -704,8 +707,7 @@ eth_ark_dev_close(struct rte_eth_dev *dev) dev->data->rx_queues[i] = 0; } - rte_free(dev->data->mac_addrs); - dev->data->mac_addrs = 0; + return 0; } static int @@ -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; }