git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/hns3: fix DCB reconfiguration
[dpdk.git]
/
drivers
/
net
/
ark
/
ark_ethdev.c
diff --git
a/drivers/net/ark/ark_ethdev.c
b/drivers/net/ark/ark_ethdev.c
index
c26f076
..
377299b
100644
(file)
--- a/
drivers/net/ark/ark_ethdev.c
+++ b/
drivers/net/ark/ark_ethdev.c
@@
-7,7
+7,7
@@
#include <dlfcn.h>
#include <rte_bus_pci.h>
#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"
#include <rte_kvargs.h>
#include "ark_global.h"
@@
-29,21
+29,21
@@
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 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
void
eth_ark_dev_info_get(struct rte_eth_dev *dev,
-
struct rte_eth_dev_info *dev_info);
+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,
int wait_to_complete);
static int eth_ark_dev_set_link_up(struct rte_eth_dev *dev);
static int eth_ark_dev_set_link_down(struct rte_eth_dev *dev);
static int eth_ark_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int eth_ark_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
static int eth_ark_dev_set_link_up(struct rte_eth_dev *dev);
static int eth_ark_dev_set_link_down(struct rte_eth_dev *dev);
static int eth_ark_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
-static
void
eth_ark_dev_stats_reset(struct rte_eth_dev *dev);
+static
int
eth_ark_dev_stats_reset(struct rte_eth_dev *dev);
static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
- struct ether_addr *mac_addr);
+ struct
rte_
ether_addr *mac_addr);
static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
- struct ether_addr *mac_addr,
+ struct
rte_
ether_addr *mac_addr,
uint32_t index,
uint32_t pool);
static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
uint32_t index,
uint32_t pool);
static void eth_ark_macaddr_remove(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)},
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 */ },
};
{.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)
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;
}
return ret;
}
@@
-132,7
+137,6
@@
static const struct eth_dev_ops ark_eth_dev_ops = {
.dev_infos_get = eth_ark_dev_info_get,
.rx_queue_setup = eth_ark_dev_rx_queue_setup,
.dev_infos_get = eth_ark_dev_info_get,
.rx_queue_setup = eth_ark_dev_rx_queue_setup,
- .rx_queue_count = eth_ark_dev_rx_queue_count,
.tx_queue_setup = eth_ark_tx_queue_setup,
.link_update = eth_ark_dev_link_update,
.tx_queue_setup = eth_ark_tx_queue_setup,
.link_update = eth_ark_dev_link_update,
@@
-164,76
+168,82
@@
check_for_ext(struct ark_adapter *ark)
const char *dllpath = getenv("ARK_EXT_PATH");
if (dllpath == NULL) {
const char *dllpath = getenv("ARK_EXT_PATH");
if (dllpath == NULL) {
-
PMD_DEBUG_LOG(DEBUG, "ARK
EXT NO dll path specified\n");
+
ARK_PMD_LOG(DEBUG, "
EXT NO dll path specified\n");
return 0;
}
return 0;
}
-
PMD_DRV_LOG(INFO, "ARK
EXT found dll path at %s\n", dllpath);
+
ARK_PMD_LOG(NOTICE, "
EXT found dll path at %s\n", dllpath);
/* Open and load the .so */
ark->d_handle = dlopen(dllpath, RTLD_LOCAL | RTLD_LAZY);
if (ark->d_handle == NULL) {
/* Open and load the .so */
ark->d_handle = dlopen(dllpath, RTLD_LOCAL | RTLD_LAZY);
if (ark->d_handle == NULL) {
-
PMD_DRV
_LOG(ERR, "Could not load user extension %s\n",
+
ARK_PMD
_LOG(ERR, "Could not load user extension %s\n",
dllpath);
return -1;
}
dllpath);
return -1;
}
-
PMD_DRV_LOG(INFO
, "SUCCESS: loaded user extension %s\n",
+
ARK_PMD_LOG(DEBUG
, "SUCCESS: loaded user extension %s\n",
dllpath);
/* Get the entry points */
ark->user_ext.dev_init =
(void *(*)(struct rte_eth_dev *, void *, int))
dllpath);
/* Get the entry points */
ark->user_ext.dev_init =
(void *(*)(struct rte_eth_dev *, void *, int))
- dlsym(ark->d_handle, "dev_init");
-
PMD_DEBUG
_LOG(DEBUG, "device ext init pointer = %p\n",
+ 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 *))
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 *))
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 *))
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 *))
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 *))
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 *))
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 *))
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 *))
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 *))
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 *))
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 *))
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 =
ark->user_ext.mac_addr_add =
- (void (*)(struct rte_eth_dev *, struct
ether_addr *, uint32_t
,
-
uint32_t, void *))
- dlsym(ark->d_handle, "mac_addr_add");
+ (void (*)(struct rte_eth_dev *, struct
rte_ether_addr *
,
+
uint32_t,
uint32_t, void *))
+ dlsym(ark->d_handle, "
rte_pmd_ark_
mac_addr_add");
ark->user_ext.mac_addr_remove =
(void (*)(struct rte_eth_dev *, uint32_t, void *))
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 =
ark->user_ext.mac_addr_set =
- (void (*)(struct rte_eth_dev *, struct ether_addr *,
+ (void (*)(struct rte_eth_dev *, struct
rte_
ether_addr *,
void *))
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 *))
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;
}
return found;
}
@@
-241,8
+251,7
@@
check_for_ext(struct ark_adapter *ark)
static int
eth_ark_dev_init(struct rte_eth_dev *dev)
{
static int
eth_ark_dev_init(struct rte_eth_dev *dev)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
struct rte_pci_device *pci_dev;
int ret;
int port_count = 1;
struct rte_pci_device *pci_dev;
int ret;
int port_count = 1;
@@
-250,14
+259,16
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
ark->eth_dev = dev;
ark->eth_dev = dev;
-
PMD_FUNC
_LOG(DEBUG, "\n");
+
ARK_PMD
_LOG(DEBUG, "\n");
/* Check to see if there is an extension that we need to load */
ret = check_for_ext(ark);
if (ret)
return ret;
/* Check to see if there is an extension that we need to load */
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);
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;
/* Use dummy function until setup */
dev->rx_pkt_burst = ð_ark_recv_pkts_noop;
@@
-280,16
+291,17
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
ark->rqpacing =
(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
ark->started = 0;
ark->rqpacing =
(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
ark->started = 0;
+ ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
-
PMD_DEBUG
_LOG(INFO, "Sys Ctrl Const = 0x%x HW Commit_ID: %08x\n",
+
ARK_PMD
_LOG(INFO, "Sys Ctrl Const = 0x%x HW Commit_ID: %08x\n",
ark->sysctrl.t32[4],
rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4]));
ark->sysctrl.t32[4],
rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4]));
-
PMD_DRV_LOG(INFO
, "Arkville HW Commit_ID: %08x\n",
+
ARK_PMD_LOG(NOTICE
, "Arkville HW Commit_ID: %08x\n",
rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4]));
/* If HW sanity test fails, return an error */
if (ark->sysctrl.t32[4] != 0xcafef00d) {
rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4]));
/* If HW sanity test fails, return an error */
if (ark->sysctrl.t32[4] != 0xcafef00d) {
-
PMD_DRV
_LOG(ERR,
+
ARK_PMD
_LOG(ERR,
"HW Sanity test has failed, expected constant"
" 0x%x, read 0x%x (%s)\n",
0xcafef00d,
"HW Sanity test has failed, expected constant"
" 0x%x, read 0x%x (%s)\n",
0xcafef00d,
@@
-298,15
+310,15
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
}
if (ark->sysctrl.t32[3] != 0) {
if (ark_rqp_lasped(ark->rqpacing)) {
}
if (ark->sysctrl.t32[3] != 0) {
if (ark_rqp_lasped(ark->rqpacing)) {
-
PMD_DRV
_LOG(ERR, "Arkville Evaluation System - "
+
ARK_PMD
_LOG(ERR, "Arkville Evaluation System - "
"Timer has Expired\n");
return -1;
}
"Timer has Expired\n");
return -1;
}
-
PMD_DRV
_LOG(WARNING, "Arkville Evaluation System - "
+
ARK_PMD
_LOG(WARNING, "Arkville Evaluation System - "
"Timer is Running\n");
}
"Timer is Running\n");
}
-
PMD_DRV_LOG(INFO
,
+
ARK_PMD_LOG(DEBUG
,
"HW Sanity test has PASSED, expected constant"
" 0x%x, read 0x%x (%s)\n",
0xcafef00d, ark->sysctrl.t32[4], __func__);
"HW Sanity test has PASSED, expected constant"
" 0x%x, read 0x%x (%s)\n",
0xcafef00d, ark->sysctrl.t32[4], __func__);
@@
-317,10
+329,11
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
return -1;
dev->dev_ops = &ark_eth_dev_ops;
return -1;
dev->dev_ops = &ark_eth_dev_ops;
+ dev->rx_queue_count = eth_ark_dev_rx_queue_count;
- dev->data->mac_addrs = rte_zmalloc("ark", ETHER_ADDR_LEN, 0);
+ dev->data->mac_addrs = rte_zmalloc("ark",
RTE_
ETHER_ADDR_LEN, 0);
if (!dev->data->mac_addrs) {
if (!dev->data->mac_addrs) {
-
PMD_DRV
_LOG(ERR,
+
ARK_PMD
_LOG(ERR,
"Failed to allocated memory for storing mac address"
);
}
"Failed to allocated memory for storing mac address"
);
}
@@
-329,7
+342,7
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
ark->user_data[dev->data->port_id] =
ark->user_ext.dev_init(dev, ark->a_bar, 0);
if (!ark->user_data[dev->data->port_id]) {
ark->user_data[dev->data->port_id] =
ark->user_ext.dev_init(dev, ark->a_bar, 0);
if (!ark->user_data[dev->data->port_id]) {
-
PMD_DRV_LOG(INFO
,
+
ARK_PMD_LOG(WARNING
,
"Failed to initialize PMD extension!"
" continuing without it\n");
memset(&ark->user_ext, 0, sizeof(struct ark_user_ext));
"Failed to initialize PMD extension!"
" continuing without it\n");
memset(&ark->user_ext, 0, sizeof(struct ark_user_ext));
@@
-340,7
+353,7
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
if (pci_dev->device.devargs)
ret = eth_ark_check_args(ark, pci_dev->device.devargs->args);
else
if (pci_dev->device.devargs)
ret = eth_ark_check_args(ark, pci_dev->device.devargs->args);
else
-
PMD_DRV
_LOG(INFO, "No Device args found\n");
+
ARK_PMD
_LOG(INFO, "No Device args found\n");
if (ret)
goto error;
if (ret)
goto error;
@@
-371,7
+384,7
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
/* reserve an ethdev entry */
eth_dev = rte_eth_dev_allocate(name);
if (!eth_dev) {
/* reserve an ethdev entry */
eth_dev = rte_eth_dev_allocate(name);
if (!eth_dev) {
-
PMD_DRV
_LOG(ERR,
+
ARK_PMD
_LOG(ERR,
"Could not allocate eth_dev for port %d\n",
p);
goto error;
"Could not allocate eth_dev for port %d\n",
p);
goto error;
@@
-384,10
+397,12
@@
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->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, ETHER_ADDR_LEN, 0);
+ eth_dev->data->mac_addrs = rte_zmalloc(name,
+ RTE_ETHER_ADDR_LEN, 0);
if (!eth_dev->data->mac_addrs) {
if (!eth_dev->data->mac_addrs) {
-
PMD_DRV
_LOG(ERR,
+
ARK_PMD
_LOG(ERR,
"Memory allocation for MAC failed!"
" Exiting.\n");
goto error;
"Memory allocation for MAC failed!"
" Exiting.\n");
goto error;
@@
-403,9
+418,9
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
return ret;
return ret;
-
error:
- if (dev->data->mac_addrs)
-
rte_free(dev->data->mac_addrs)
;
+error:
+ rte_free(dev->data->mac_addrs);
+
dev->data->mac_addrs = NULL
;
return -1;
}
return -1;
}
@@
-417,8
+432,7
@@
eth_ark_dev_init(struct rte_eth_dev *dev)
static int
ark_config_device(struct rte_eth_dev *dev)
{
static int
ark_config_device(struct rte_eth_dev *dev)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
uint16_t num_q, i;
struct ark_mpu_t *mpu;
uint16_t num_q, i;
struct ark_mpu_t *mpu;
@@
-447,7
+461,7
@@
ark_config_device(struct rte_eth_dev *dev)
/* UDM */
if (ark_udm_reset(ark->udm.v)) {
/* UDM */
if (ark_udm_reset(ark->udm.v)) {
-
PMD_DRV
_LOG(ERR, "Unable to stop and reset UDM\n");
+
ARK_PMD
_LOG(ERR, "Unable to stop and reset UDM\n");
return -1;
}
/* Keep in reset until the MPU are cleared */
return -1;
}
/* Keep in reset until the MPU are cleared */
@@
-471,7
+485,7
@@
ark_config_device(struct rte_eth_dev *dev)
/* TX -- DDM */
if (ark_ddm_stop(ark->ddm.v, 1))
/* TX -- DDM */
if (ark_ddm_stop(ark->ddm.v, 1))
-
PMD_DRV
_LOG(ERR, "Unable to stop DDM\n");
+
ARK_PMD
_LOG(ERR, "Unable to stop DDM\n");
mpu = ark->mputx.v;
num_q = ark_api_num_queues(mpu);
mpu = ark->mputx.v;
num_q = ark_api_num_queues(mpu);
@@
-493,8
+507,7
@@
ark_config_device(struct rte_eth_dev *dev)
static int
eth_ark_dev_uninit(struct rte_eth_dev *dev)
{
static int
eth_ark_dev_uninit(struct rte_eth_dev *dev)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
@@
-506,19
+519,13
@@
eth_ark_dev_uninit(struct rte_eth_dev *dev)
ark_pktgen_uninit(ark->pg);
ark_pktchkr_uninit(ark->pc);
ark_pktgen_uninit(ark->pg);
ark_pktchkr_uninit(ark->pc);
- dev->dev_ops = NULL;
- dev->rx_pkt_burst = NULL;
- dev->tx_pkt_burst = NULL;
- rte_free(dev->data->mac_addrs);
return 0;
}
static int
eth_ark_dev_configure(struct rte_eth_dev *dev)
{
return 0;
}
static int
eth_ark_dev_configure(struct rte_eth_dev *dev)
{
- PMD_FUNC_LOG(DEBUG, "\n");
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
eth_ark_dev_set_link_up(dev);
if (ark->user_ext.dev_configure)
eth_ark_dev_set_link_up(dev);
if (ark->user_ext.dev_configure)
@@
-527,29
+534,12
@@
eth_ark_dev_configure(struct rte_eth_dev *dev)
return 0;
}
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)
{
static int
eth_ark_dev_start(struct rte_eth_dev *dev)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
int i;
int i;
- PMD_FUNC_LOG(DEBUG, "\n");
-
/* RX Side */
/* start UDM */
ark_udm_start(ark->udm.v);
/* RX Side */
/* start UDM */
ark_udm_start(ark->udm.v);
@@
-578,8
+568,9
@@
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
*/
/* 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)) {
- PMD_DRV_LOG(ERR, "Could not create pktgen "
+ 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;
}
"starter thread\n");
return -1;
}
@@
-592,20
+583,18
@@
eth_ark_dev_start(struct rte_eth_dev *dev)
return 0;
}
return 0;
}
-static
void
+static
int
eth_ark_dev_stop(struct rte_eth_dev *dev)
{
uint16_t i;
int status;
eth_ark_dev_stop(struct rte_eth_dev *dev)
{
uint16_t i;
int status;
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
struct ark_mpu_t *mpu;
struct ark_mpu_t *mpu;
- PMD_FUNC_LOG(DEBUG, "\n");
-
if (ark->started == 0)
if (ark->started == 0)
- return;
+ return
0
;
ark->started = 0;
ark->started = 0;
+ dev->data->dev_started = 0;
/* Stop the extension first */
if (ark->user_ext.dev_stop)
/* Stop the extension first */
if (ark->user_ext.dev_stop)
@@
-624,7
+613,7
@@
eth_ark_dev_stop(struct rte_eth_dev *dev)
status = eth_ark_tx_queue_stop(dev, i);
if (status != 0) {
uint16_t port = dev->data->port_id;
status = eth_ark_tx_queue_stop(dev, i);
if (status != 0) {
uint16_t port = dev->data->port_id;
-
PMD_DRV
_LOG(ERR,
+
ARK_PMD
_LOG(ERR,
"tx_queue stop anomaly"
" port %u, queue %u\n",
port, i);
"tx_queue stop anomaly"
" port %u, queue %u\n",
port, i);
@@
-639,7
+628,7
@@
eth_ark_dev_stop(struct rte_eth_dev *dev)
break;
}
if (status || i != 0) {
break;
}
if (status || i != 0) {
-
PMD_DRV
_LOG(ERR, "DDM stop anomaly. status:"
+
ARK_PMD
_LOG(ERR, "DDM stop anomaly. status:"
" %d iter: %u. (%s)\n",
status,
i,
" %d iter: %u. (%s)\n",
status,
i,
@@
-661,7
+650,7
@@
eth_ark_dev_stop(struct rte_eth_dev *dev)
break;
}
if (status || i != 0) {
break;
}
if (status || i != 0) {
-
PMD_DRV
_LOG(ERR, "UDM stop anomaly. status %d iter: %u. (%s)\n",
+
ARK_PMD
_LOG(ERR, "UDM stop anomaly. status %d iter: %u. (%s)\n",
status, i, __func__);
ark_udm_dump(ark->udm.v, "Stop anomaly");
status, i, __func__);
ark_udm_dump(ark->udm.v, "Stop anomaly");
@@
-683,15
+672,19
@@
eth_ark_dev_stop(struct rte_eth_dev *dev)
ark_pktchkr_dump_stats(ark->pc);
ark_pktchkr_stop(ark->pc);
}
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)
{
eth_ark_dev_close(struct rte_eth_dev *dev)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
uint16_t i;
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]);
if (ark->user_ext.dev_close)
ark->user_ext.dev_close(dev,
ark->user_data[dev->data->port_id]);
@@
-713,14
+706,15
@@
eth_ark_dev_close(struct rte_eth_dev *dev)
eth_ark_dev_rx_queue_release(dev->data->rx_queues[i]);
dev->data->rx_queues[i] = 0;
}
eth_ark_dev_rx_queue_release(dev->data->rx_queues[i]);
dev->data->rx_queues[i] = 0;
}
+
+ return 0;
}
}
-static
void
+static
int
eth_ark_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
eth_ark_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
struct ark_mpu_t *tx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_TX_BASE);
struct ark_mpu_t *rx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_RX_BASE);
uint16_t ports = ark->num_ports;
struct ark_mpu_t *tx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_TX_BASE);
struct ark_mpu_t *rx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_RX_BASE);
uint16_t ports = ark->num_ports;
@@
-748,15
+742,18
@@
eth_ark_dev_info_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
+
+ dev_info->rx_offload_capa = DEV_RX_OFFLOAD_TIMESTAMP;
+
+ return 0;
}
static int
eth_ark_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
{
}
static int
eth_ark_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
{
-
PMD_DEBUG
_LOG(DEBUG, "link status = %d\n",
+
ARK_PMD
_LOG(DEBUG, "link status = %d\n",
dev->data->dev_link.link_status);
dev->data->dev_link.link_status);
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
if (ark->user_ext.link_update) {
return ark->user_ext.link_update
if (ark->user_ext.link_update) {
return ark->user_ext.link_update
@@
-770,8
+767,7
@@
static int
eth_ark_dev_set_link_up(struct rte_eth_dev *dev)
{
dev->data->dev_link.link_status = 1;
eth_ark_dev_set_link_up(struct rte_eth_dev *dev)
{
dev->data->dev_link.link_status = 1;
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
if (ark->user_ext.dev_set_link_up)
return ark->user_ext.dev_set_link_up(dev,
if (ark->user_ext.dev_set_link_up)
return ark->user_ext.dev_set_link_up(dev,
@@
-783,8
+779,7
@@
static int
eth_ark_dev_set_link_down(struct rte_eth_dev *dev)
{
dev->data->dev_link.link_status = 0;
eth_ark_dev_set_link_down(struct rte_eth_dev *dev)
{
dev->data->dev_link.link_status = 0;
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
if (ark->user_ext.dev_set_link_down)
return ark->user_ext.dev_set_link_down(dev,
if (ark->user_ext.dev_set_link_down)
return ark->user_ext.dev_set_link_down(dev,
@@
-796,8
+791,7
@@
static int
eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
uint16_t i;
eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
uint16_t i;
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
stats->ipackets = 0;
stats->ibytes = 0;
stats->ipackets = 0;
stats->ibytes = 0;
@@
-816,12
+810,11
@@
eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0;
}
return 0;
}
-static
void
+static
int
eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
{
uint16_t i;
eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
{
uint16_t i;
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
for (i = 0; i < dev->data->nb_tx_queues; i++)
eth_tx_queue_stats_reset(dev->data->tx_queues[i]);
for (i = 0; i < dev->data->nb_tx_queues; i++)
eth_tx_queue_stats_reset(dev->data->tx_queues[i]);
@@
-830,16
+823,17
@@
eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
if (ark->user_ext.stats_reset)
ark->user_ext.stats_reset(dev,
ark->user_data[dev->data->port_id]);
if (ark->user_ext.stats_reset)
ark->user_ext.stats_reset(dev,
ark->user_data[dev->data->port_id]);
+
+ return 0;
}
static int
eth_ark_macaddr_add(struct rte_eth_dev *dev,
}
static int
eth_ark_macaddr_add(struct rte_eth_dev *dev,
- struct ether_addr *mac_addr,
+ struct
rte_
ether_addr *mac_addr,
uint32_t index,
uint32_t pool)
{
uint32_t index,
uint32_t pool)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
if (ark->user_ext.mac_addr_add) {
ark->user_ext.mac_addr_add(dev,
if (ark->user_ext.mac_addr_add) {
ark->user_ext.mac_addr_add(dev,
@@
-855,8
+849,7
@@
eth_ark_macaddr_add(struct rte_eth_dev *dev,
static void
eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)
{
static void
eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
if (ark->user_ext.mac_addr_remove)
ark->user_ext.mac_addr_remove(dev, index,
if (ark->user_ext.mac_addr_remove)
ark->user_ext.mac_addr_remove(dev, index,
@@
-865,10
+858,9
@@
eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)
static int
eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
static int
eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
- struct ether_addr *mac_addr)
+ struct
rte_
ether_addr *mac_addr)
{
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
if (ark->user_ext.mac_addr_set) {
ark->user_ext.mac_addr_set(dev, mac_addr,
if (ark->user_ext.mac_addr_set) {
ark->user_ext.mac_addr_set(dev, mac_addr,
@@
-881,8
+873,7
@@
eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
static int
eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size)
{
static int
eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size)
{
- struct ark_adapter *ark =
- (struct ark_adapter *)dev->data->dev_private;
+ struct ark_adapter *ark = dev->data->dev_private;
if (ark->user_ext.set_mtu)
return ark->user_ext.set_mtu(dev, size,
if (ark->user_ext.set_mtu)
return ark->user_ext.set_mtu(dev, size,
@@
-895,20
+886,20
@@
static inline int
process_pktdir_arg(const char *key, const char *value,
void *extra_args)
{
process_pktdir_arg(const char *key, const char *value,
void *extra_args)
{
-
PMD_FUNC
_LOG(DEBUG, "key = %s, value = %s\n",
+
ARK_PMD
_LOG(DEBUG, "key = %s, value = %s\n",
key, value);
struct ark_adapter *ark =
(struct ark_adapter *)extra_args;
ark->pkt_dir_v = strtol(value, NULL, 16);
key, value);
struct ark_adapter *ark =
(struct ark_adapter *)extra_args;
ark->pkt_dir_v = strtol(value, NULL, 16);
-
PMD_FUNC
_LOG(DEBUG, "pkt_dir_v = 0x%x\n", ark->pkt_dir_v);
+
ARK_PMD
_LOG(DEBUG, "pkt_dir_v = 0x%x\n", ark->pkt_dir_v);
return 0;
}
static inline int
process_file_args(const char *key, const char *value, void *extra_args)
{
return 0;
}
static inline int
process_file_args(const char *key, const char *value, void *extra_args)
{
-
PMD_FUNC
_LOG(DEBUG, "key = %s, value = %s\n",
+
ARK_PMD
_LOG(DEBUG, "key = %s, value = %s\n",
key, value);
char *args = (char *)extra_args;
key, value);
char *args = (char *)extra_args;
@@
-919,7
+910,7
@@
process_file_args(const char *key, const char *value, void *extra_args)
int first = 1;
if (file == NULL) {
int first = 1;
if (file == NULL) {
-
PMD_DRV
_LOG(ERR, "Unable to open "
+
ARK_PMD
_LOG(ERR, "Unable to open "
"config file %s\n", value);
return -1;
}
"config file %s\n", value);
return -1;
}
@@
-927,7
+918,7
@@
process_file_args(const char *key, const char *value, void *extra_args)
while (fgets(line, sizeof(line), file)) {
size += strlen(line);
if (size >= ARK_MAX_ARG_LEN) {
while (fgets(line, sizeof(line), file)) {
size += strlen(line);
if (size >= ARK_MAX_ARG_LEN) {
-
PMD_DRV
_LOG(ERR, "Unable to parse file %s args, "
+
ARK_PMD
_LOG(ERR, "Unable to parse file %s args, "
"parameter list is too long\n", value);
fclose(file);
return -1;
"parameter list is too long\n", value);
fclose(file);
return -1;
@@
-939,7
+930,7
@@
process_file_args(const char *key, const char *value, void *extra_args)
strncat(args, line, ARK_MAX_ARG_LEN);
}
}
strncat(args, line, ARK_MAX_ARG_LEN);
}
}
-
PMD_FUNC
_LOG(DEBUG, "file = %s\n", args);
+
ARK_PMD
_LOG(DEBUG, "file = %s\n", args);
fclose(file);
return 0;
}
fclose(file);
return 0;
}
@@
-961,7
+952,7
@@
eth_ark_check_args(struct ark_adapter *ark, const char *params)
for (k_idx = 0; k_idx < kvlist->count; k_idx++) {
pair = &kvlist->pairs[k_idx];
for (k_idx = 0; k_idx < kvlist->count; k_idx++) {
pair = &kvlist->pairs[k_idx];
-
PMD_FUNC
_LOG(DEBUG, "**** Arg passed to PMD = %s:%s\n",
+
ARK_PMD
_LOG(DEBUG, "**** Arg passed to PMD = %s:%s\n",
pair->key,
pair->value);
}
pair->key,
pair->value);
}
@@
-970,7
+961,7
@@
eth_ark_check_args(struct ark_adapter *ark, const char *params)
ARK_PKTDIR_ARG,
&process_pktdir_arg,
ark) != 0) {
ARK_PKTDIR_ARG,
&process_pktdir_arg,
ark) != 0) {
-
PMD_DRV
_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTDIR_ARG);
+
ARK_PMD
_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTDIR_ARG);
goto free_kvlist;
}
goto free_kvlist;
}
@@
-978,7
+969,7
@@
eth_ark_check_args(struct ark_adapter *ark, const char *params)
ARK_PKTGEN_ARG,
&process_file_args,
ark->pkt_gen_args) != 0) {
ARK_PKTGEN_ARG,
&process_file_args,
ark->pkt_gen_args) != 0) {
-
PMD_DRV
_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTGEN_ARG);
+
ARK_PMD
_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTGEN_ARG);
goto free_kvlist;
}
goto free_kvlist;
}
@@
-986,17
+977,17
@@
eth_ark_check_args(struct ark_adapter *ark, const char *params)
ARK_PKTCHKR_ARG,
&process_file_args,
ark->pkt_chkr_args) != 0) {
ARK_PKTCHKR_ARG,
&process_file_args,
ark->pkt_chkr_args) != 0) {
-
PMD_DRV
_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTCHKR_ARG);
+
ARK_PMD
_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTCHKR_ARG);
goto free_kvlist;
}
goto free_kvlist;
}
-
PMD_DRV
_LOG(INFO, "packet director set to 0x%x\n", ark->pkt_dir_v);
+
ARK_PMD
_LOG(INFO, "packet director set to 0x%x\n", ark->pkt_dir_v);
/* Setup the packet director */
ark_pktdir_setup(ark->pd, ark->pkt_dir_v);
/* Setup the packet generator */
if (ark->pkt_gen_args[0]) {
/* Setup the packet director */
ark_pktdir_setup(ark->pd, ark->pkt_dir_v);
/* Setup the packet generator */
if (ark->pkt_gen_args[0]) {
-
PMD_DRV_LOG(INFO
, "Setting up the packet generator\n");
+
ARK_PMD_LOG(DEBUG
, "Setting up the packet generator\n");
ark_pktgen_parse(ark->pkt_gen_args);
ark_pktgen_reset(ark->pg);
ark_pktgen_setup(ark->pg);
ark_pktgen_parse(ark->pkt_gen_args);
ark_pktgen_reset(ark->pg);
ark_pktgen_setup(ark->pg);
@@
-1024,3
+1015,4
@@
RTE_PMD_REGISTER_PARAM_STRING(net_ark,
ARK_PKTGEN_ARG "=<filename> "
ARK_PKTCHKR_ARG "=<filename> "
ARK_PKTDIR_ARG "=<bitmap>");
ARK_PKTGEN_ARG "=<filename> "
ARK_PKTCHKR_ARG "=<filename> "
ARK_PKTDIR_ARG "=<bitmap>");
+RTE_LOG_REGISTER_DEFAULT(ark_logtype, NOTICE);