#include <ethdev_pci.h>
#include <rte_kvargs.h>
-#include "rte_pmd_ark.h"
#include "ark_global.h"
#include "ark_logs.h"
#include "ark_ethdev_tx.h"
#define ARK_TX_MAX_QUEUE (4096 * 4)
#define ARK_TX_MIN_QUEUE (256)
-uint64_t ark_timestamp_rx_dynflag;
-int ark_timestamp_dynfield_offset = -1;
-
-int rte_pmd_ark_rx_userdata_dynfield_offset = -1;
-int rte_pmd_ark_tx_userdata_dynfield_offset = -1;
-
static const char * const valid_arguments[] = {
ARK_PKTGEN_ARG,
ARK_PKTCHKR_ARG,
/* 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;
}
int ret;
int port_count = 1;
int p;
- static const struct rte_mbuf_dynfield ark_tx_userdata_dynfield_desc = {
- .name = RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME,
- .size = sizeof(rte_pmd_ark_tx_userdata_t),
- .align = __alignof__(rte_pmd_ark_tx_userdata_t),
- };
- static const struct rte_mbuf_dynfield ark_rx_userdata_dynfield_desc = {
- .name = RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME,
- .size = sizeof(rte_pmd_ark_rx_userdata_t),
- .align = __alignof__(rte_pmd_ark_rx_userdata_t),
- };
ark->eth_dev = dev;
if (ret)
return ret;
- /* Extra mbuf fields for user data */
- if (RTE_PMD_ARK_TX_USERDATA_ENABLE) {
- rte_pmd_ark_tx_userdata_dynfield_offset =
- rte_mbuf_dynfield_register(&ark_tx_userdata_dynfield_desc);
- if (rte_pmd_ark_tx_userdata_dynfield_offset < 0) {
- ARK_PMD_LOG(ERR,
- "Failed to register mbuf field for tx userdata\n");
- return -rte_errno;
- }
- ARK_PMD_LOG(INFO, "Registered TX-meta dynamic field at %d\n",
- rte_pmd_ark_tx_userdata_dynfield_offset);
- }
- if (RTE_PMD_ARK_RX_USERDATA_ENABLE) {
- rte_pmd_ark_rx_userdata_dynfield_offset =
- rte_mbuf_dynfield_register(&ark_rx_userdata_dynfield_desc);
- if (rte_pmd_ark_rx_userdata_dynfield_offset < 0) {
- ARK_PMD_LOG(ERR,
- "Failed to register mbuf field for rx userdata\n");
- return -rte_errno;
- }
- ARK_PMD_LOG(INFO, "Registered RX-meta dynamic field at %d\n",
- rte_pmd_ark_rx_userdata_dynfield_offset);
- }
-
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;
eth_ark_dev_configure(struct rte_eth_dev *dev)
{
struct ark_adapter *ark = dev->data->dev_private;
- int ret;
-
- if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TIMESTAMP) {
- ret = rte_mbuf_dyn_rx_timestamp_register(
- &ark_timestamp_dynfield_offset,
- &ark_timestamp_rx_dynflag);
- if (ret != 0) {
- ARK_PMD_LOG(ERR,
- "Failed to register Rx timestamp field/flag\n");
- return -rte_errno;
- }
- }
eth_ark_dev_set_link_up(dev);
if (ark->user_ext.dev_configure)
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)
{
/* 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->pg)) {
ARK_PMD_LOG(ERR, "Could not create pktgen "
"starter thread\n");
return -1;
ARK_PKTGEN_ARG "=<filename> "
ARK_PKTCHKR_ARG "=<filename> "
ARK_PKTDIR_ARG "=<bitmap>");
-RTE_LOG_REGISTER(ark_logtype, pmd.net.ark, NOTICE);
+RTE_LOG_REGISTER_DEFAULT(ark_logtype, NOTICE);