rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright 2017 NXP
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
|
2019-04-03 15:45:05 +01:00
|
|
|
#include <rte_string_fns.h>
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
#include <rte_byteorder.h>
|
|
|
|
#include <rte_log.h>
|
|
|
|
#include <rte_debug.h>
|
|
|
|
#include <rte_dev.h>
|
|
|
|
#include <rte_memory.h>
|
|
|
|
#include <rte_memcpy.h>
|
|
|
|
#include <rte_memzone.h>
|
|
|
|
#include <rte_eal.h>
|
|
|
|
#include <rte_per_lcore.h>
|
|
|
|
#include <rte_lcore.h>
|
|
|
|
#include <rte_atomic.h>
|
|
|
|
#include <rte_branch_prediction.h>
|
|
|
|
#include <rte_common.h>
|
|
|
|
#include <rte_malloc.h>
|
|
|
|
#include <rte_errno.h>
|
rawdev: add telemetry callbacks
The rawdev library now registers commands with telemetry, and
implements the corresponding callback functions. These allow a list of
rawdev devices and xstats for a rawdev port to be queried.
An example usage, with ioat rawdev driver instances, is shown below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 65777, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
"/help", "/info", "/rawdev/list", "/rawdev/xstats"]}
--> /rawdev/list
{"/rawdev/list": [0, 1, 2, 3, 4, 5]}
--> /rawdev/xstats,0
{"/rawdev/xstats": {"failed_enqueues": 0, "successful_enqueues": 0, \
"copies_started": 0, "copies_completed": 0}}
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
2020-04-30 17:01:30 +01:00
|
|
|
#include <rte_telemetry.h>
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
|
|
|
|
#include "rte_rawdev.h"
|
|
|
|
#include "rte_rawdev_pmd.h"
|
|
|
|
|
2018-10-28 23:57:41 +00:00
|
|
|
static struct rte_rawdev rte_rawdevices[RTE_RAWDEV_MAX_DEVS];
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
|
2018-10-28 23:57:41 +00:00
|
|
|
struct rte_rawdev *rte_rawdevs = rte_rawdevices;
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
|
|
|
|
static struct rte_rawdev_global rawdev_globals = {
|
|
|
|
.nb_devs = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Raw device, northbound API implementation */
|
2018-06-14 18:49:00 +05:30
|
|
|
uint8_t
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_count(void)
|
|
|
|
{
|
2018-10-28 23:57:41 +00:00
|
|
|
return rawdev_globals.nb_devs;
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
uint16_t
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_get_dev_id(const char *name)
|
|
|
|
{
|
|
|
|
uint16_t i;
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2018-10-28 23:57:41 +00:00
|
|
|
for (i = 0; i < rawdev_globals.nb_devs; i++)
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
if ((strcmp(rte_rawdevices[i].name, name)
|
|
|
|
== 0) &&
|
|
|
|
(rte_rawdevices[i].attached ==
|
|
|
|
RTE_RAWDEV_ATTACHED))
|
|
|
|
return i;
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_socket_id(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
return dev->socket_id;
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2020-09-10 15:36:03 +01:00
|
|
|
rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info,
|
|
|
|
size_t dev_private_size)
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
{
|
|
|
|
struct rte_rawdev *rawdev;
|
2020-09-10 15:36:04 +01:00
|
|
|
int ret = 0;
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(dev_info, -EINVAL);
|
|
|
|
|
|
|
|
rawdev = &rte_rawdevs[dev_id];
|
|
|
|
|
2020-07-06 11:31:30 +01:00
|
|
|
if (dev_info->dev_private != NULL) {
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*rawdev->dev_ops->dev_info_get, -ENOTSUP);
|
2020-09-10 15:36:04 +01:00
|
|
|
ret = (*rawdev->dev_ops->dev_info_get)(rawdev,
|
|
|
|
dev_info->dev_private,
|
2020-09-10 15:36:03 +01:00
|
|
|
dev_private_size);
|
2020-07-06 11:31:30 +01:00
|
|
|
}
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
|
2020-07-06 11:31:31 +01:00
|
|
|
dev_info->driver_name = rawdev->driver_name;
|
|
|
|
dev_info->device = rawdev->device;
|
|
|
|
dev_info->socket_id = rawdev->socket_id;
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
|
2020-09-10 15:36:04 +01:00
|
|
|
return ret;
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2020-09-10 15:36:05 +01:00
|
|
|
rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf,
|
|
|
|
size_t dev_private_size)
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
int diag;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(dev_conf, -EINVAL);
|
|
|
|
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
|
|
|
|
|
|
|
|
if (dev->started) {
|
|
|
|
RTE_RDEV_ERR(
|
|
|
|
"device %d must be stopped to allow configuration", dev_id);
|
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Configure the device */
|
2020-09-10 15:36:05 +01:00
|
|
|
diag = (*dev->dev_ops->dev_configure)(dev, dev_conf->dev_private,
|
|
|
|
dev_private_size);
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
if (diag != 0)
|
|
|
|
RTE_RDEV_ERR("dev%d dev_configure = %d", dev_id, diag);
|
|
|
|
else
|
|
|
|
dev->attached = 1;
|
|
|
|
|
|
|
|
return diag;
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_queue_conf_get(uint16_t dev_id,
|
|
|
|
uint16_t queue_id,
|
2020-09-10 15:36:06 +01:00
|
|
|
rte_rawdev_obj_t queue_conf,
|
|
|
|
size_t queue_conf_size)
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
|
2020-09-10 15:36:07 +01:00
|
|
|
return (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf,
|
2020-09-10 15:36:06 +01:00
|
|
|
queue_conf_size);
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_queue_setup(uint16_t dev_id,
|
|
|
|
uint16_t queue_id,
|
2020-09-10 15:36:06 +01:00
|
|
|
rte_rawdev_obj_t queue_conf,
|
|
|
|
size_t queue_conf_size)
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
|
2020-09-10 15:36:06 +01:00
|
|
|
return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf,
|
|
|
|
queue_conf_size);
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->queue_release)(dev, queue_id);
|
|
|
|
}
|
|
|
|
|
2018-07-31 16:03:02 +05:30
|
|
|
uint16_t
|
|
|
|
rte_rawdev_queue_count(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_count, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->queue_count)(dev);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:10 +05:30
|
|
|
rte_rawdev_get_attr(uint16_t dev_id,
|
|
|
|
const char *attr_name,
|
|
|
|
uint64_t *attr_value)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_get, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->attr_get)(dev, attr_name, attr_value);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:10 +05:30
|
|
|
rte_rawdev_set_attr(uint16_t dev_id,
|
|
|
|
const char *attr_name,
|
|
|
|
const uint64_t attr_value)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_set, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->attr_set)(dev, attr_name, attr_value);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:11 +05:30
|
|
|
rte_rawdev_enqueue_buffers(uint16_t dev_id,
|
|
|
|
struct rte_rawdev_buf **buffers,
|
|
|
|
unsigned int count,
|
|
|
|
rte_rawdev_obj_t context)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->enqueue_bufs, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->enqueue_bufs)(dev, buffers, count, context);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:11 +05:30
|
|
|
rte_rawdev_dequeue_buffers(uint16_t dev_id,
|
|
|
|
struct rte_rawdev_buf **buffers,
|
|
|
|
unsigned int count,
|
|
|
|
rte_rawdev_obj_t context)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dequeue_bufs, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->dequeue_bufs)(dev, buffers, count, context);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_dump(uint16_t dev_id, FILE *f)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->dump)(dev, f);
|
|
|
|
}
|
|
|
|
|
2018-01-31 14:43:12 +05:30
|
|
|
static int
|
|
|
|
xstats_get_count(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->xstats_get_names)(dev, NULL, 0);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:12 +05:30
|
|
|
rte_rawdev_xstats_names_get(uint16_t dev_id,
|
|
|
|
struct rte_rawdev_xstats_name *xstats_names,
|
|
|
|
unsigned int size)
|
|
|
|
{
|
|
|
|
const struct rte_rawdev *dev;
|
|
|
|
int cnt_expected_entries;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
|
|
|
|
|
|
|
|
cnt_expected_entries = xstats_get_count(dev_id);
|
|
|
|
|
|
|
|
if (xstats_names == NULL || cnt_expected_entries < 0 ||
|
|
|
|
(int)size < cnt_expected_entries || size <= 0)
|
|
|
|
return cnt_expected_entries;
|
|
|
|
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->xstats_get_names)(dev, xstats_names, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* retrieve rawdev extended statistics */
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:12 +05:30
|
|
|
rte_rawdev_xstats_get(uint16_t dev_id,
|
|
|
|
const unsigned int ids[],
|
|
|
|
uint64_t values[],
|
|
|
|
unsigned int n)
|
|
|
|
{
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
|
|
|
|
const struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->xstats_get)(dev, ids, values, n);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
uint64_t
|
2018-01-31 14:43:12 +05:30
|
|
|
rte_rawdev_xstats_by_name_get(uint16_t dev_id,
|
|
|
|
const char *name,
|
|
|
|
unsigned int *id)
|
|
|
|
{
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0);
|
|
|
|
const struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
unsigned int temp = -1;
|
|
|
|
|
|
|
|
if (id != NULL)
|
|
|
|
*id = (unsigned int)-1;
|
|
|
|
else
|
|
|
|
id = &temp; /* driver never gets a NULL value */
|
|
|
|
|
|
|
|
/* implemented by driver */
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_by_name, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->xstats_get_by_name)(dev, name, id);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:12 +05:30
|
|
|
rte_rawdev_xstats_reset(uint16_t dev_id,
|
|
|
|
const uint32_t ids[], uint32_t nb_ids)
|
|
|
|
{
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_reset, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:13 +05:30
|
|
|
rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info)
|
|
|
|
{
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_status_get, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->firmware_status_get)(dev, status_info);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:13 +05:30
|
|
|
rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info)
|
|
|
|
{
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_version_get, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->firmware_version_get)(dev, version_info);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:13 +05:30
|
|
|
rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image)
|
|
|
|
{
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
if (!firmware_image)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->firmware_load)(dev, firmware_image);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:13 +05:30
|
|
|
rte_rawdev_firmware_unload(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
|
|
|
|
return (*dev->dev_ops->firmware_unload)(dev);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
2018-01-31 14:43:14 +05:30
|
|
|
rte_rawdev_selftest(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
|
2019-07-02 10:56:08 +01:00
|
|
|
return (*dev->dev_ops->dev_selftest)(dev_id);
|
2018-01-31 14:43:14 +05:30
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_start(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
int diag;
|
|
|
|
|
|
|
|
RTE_RDEV_DEBUG("Start dev_id=%" PRIu8, dev_id);
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
if (dev->started != 0) {
|
|
|
|
RTE_RDEV_ERR("Device with dev_id=%" PRIu8 "already started",
|
|
|
|
dev_id);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-09-10 15:36:08 +01:00
|
|
|
if (dev->dev_ops->dev_start == NULL)
|
|
|
|
goto mark_started;
|
|
|
|
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
diag = (*dev->dev_ops->dev_start)(dev);
|
2020-09-10 15:36:08 +01:00
|
|
|
if (diag != 0)
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
return diag;
|
|
|
|
|
2020-09-10 15:36:08 +01:00
|
|
|
mark_started:
|
|
|
|
dev->started = 1;
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
void
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_stop(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RDEV_DEBUG("Stop dev_id=%" PRIu8, dev_id);
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_RET(dev_id);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
if (dev->started == 0) {
|
|
|
|
RTE_RDEV_ERR("Device with dev_id=%" PRIu8 "already stopped",
|
|
|
|
dev_id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-10 15:36:08 +01:00
|
|
|
if (dev->dev_ops->dev_stop == NULL)
|
|
|
|
goto mark_stopped;
|
|
|
|
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
(*dev->dev_ops->dev_stop)(dev);
|
2020-09-10 15:36:08 +01:00
|
|
|
|
|
|
|
mark_stopped:
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
dev->started = 0;
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_close(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
|
|
|
|
/* Device must be stopped before it can be closed */
|
|
|
|
if (dev->started == 1) {
|
|
|
|
RTE_RDEV_ERR("Device %u must be stopped before closing",
|
|
|
|
dev_id);
|
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (*dev->dev_ops->dev_close)(dev);
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_reset(uint16_t dev_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *dev;
|
|
|
|
|
|
|
|
RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
|
|
|
|
dev = &rte_rawdevs[dev_id];
|
|
|
|
|
|
|
|
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
|
|
|
|
/* Reset is not dependent on state of the device */
|
|
|
|
return (*dev->dev_ops->dev_reset)(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint8_t
|
|
|
|
rte_rawdev_find_free_device_index(void)
|
|
|
|
{
|
|
|
|
uint16_t dev_id;
|
|
|
|
|
|
|
|
for (dev_id = 0; dev_id < RTE_RAWDEV_MAX_DEVS; dev_id++) {
|
|
|
|
if (rte_rawdevs[dev_id].attached ==
|
|
|
|
RTE_RAWDEV_DETACHED)
|
|
|
|
return dev_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RTE_RAWDEV_MAX_DEVS;
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
struct rte_rawdev *
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_pmd_allocate(const char *name, size_t dev_priv_size, int socket_id)
|
|
|
|
{
|
|
|
|
struct rte_rawdev *rawdev;
|
|
|
|
uint16_t dev_id;
|
|
|
|
|
|
|
|
if (rte_rawdev_pmd_get_named_dev(name) != NULL) {
|
|
|
|
RTE_RDEV_ERR("Event device with name %s already allocated!",
|
|
|
|
name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_id = rte_rawdev_find_free_device_index();
|
|
|
|
if (dev_id == RTE_RAWDEV_MAX_DEVS) {
|
|
|
|
RTE_RDEV_ERR("Reached maximum number of raw devices");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
rawdev = &rte_rawdevs[dev_id];
|
|
|
|
|
2019-07-02 15:12:22 +01:00
|
|
|
if (dev_priv_size > 0) {
|
|
|
|
rawdev->dev_private = rte_zmalloc_socket("rawdev private",
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
dev_priv_size,
|
|
|
|
RTE_CACHE_LINE_SIZE,
|
|
|
|
socket_id);
|
2019-07-02 15:12:22 +01:00
|
|
|
if (!rawdev->dev_private) {
|
|
|
|
RTE_RDEV_ERR("Unable to allocate memory for rawdev");
|
|
|
|
return NULL;
|
|
|
|
}
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
rawdev->dev_id = dev_id;
|
|
|
|
rawdev->socket_id = socket_id;
|
|
|
|
rawdev->started = 0;
|
2019-04-03 15:45:05 +01:00
|
|
|
strlcpy(rawdev->name, name, RTE_RAWDEV_NAME_MAX_LEN);
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
|
|
|
|
rawdev->attached = RTE_RAWDEV_ATTACHED;
|
|
|
|
rawdev_globals.nb_devs++;
|
|
|
|
|
|
|
|
return rawdev;
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:49:00 +05:30
|
|
|
int
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
rte_rawdev_pmd_release(struct rte_rawdev *rawdev)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (rawdev == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
ret = rte_rawdev_close(rawdev->dev_id);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
rawdev->attached = RTE_RAWDEV_DETACHED;
|
|
|
|
rawdev_globals.nb_devs--;
|
|
|
|
|
|
|
|
rawdev->dev_id = 0;
|
|
|
|
rawdev->socket_id = 0;
|
|
|
|
rawdev->dev_ops = NULL;
|
|
|
|
if (rawdev->dev_private) {
|
|
|
|
rte_free(rawdev->dev_private);
|
|
|
|
rawdev->dev_private = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
rawdev: add telemetry callbacks
The rawdev library now registers commands with telemetry, and
implements the corresponding callback functions. These allow a list of
rawdev devices and xstats for a rawdev port to be queried.
An example usage, with ioat rawdev driver instances, is shown below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 65777, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
"/help", "/info", "/rawdev/list", "/rawdev/xstats"]}
--> /rawdev/list
{"/rawdev/list": [0, 1, 2, 3, 4, 5]}
--> /rawdev/xstats,0
{"/rawdev/xstats": {"failed_enqueues": 0, "successful_enqueues": 0, \
"copies_started": 0, "copies_completed": 0}}
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
2020-04-30 17:01:30 +01:00
|
|
|
static int
|
|
|
|
handle_dev_list(const char *cmd __rte_unused,
|
|
|
|
const char *params __rte_unused,
|
|
|
|
struct rte_tel_data *d)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
rte_tel_data_start_array(d, RTE_TEL_INT_VAL);
|
|
|
|
for (i = 0; i < rawdev_globals.nb_devs; i++)
|
|
|
|
if (rte_rawdevices[i].attached == RTE_RAWDEV_ATTACHED)
|
|
|
|
rte_tel_data_add_array_int(d, i);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
handle_dev_xstats(const char *cmd __rte_unused,
|
|
|
|
const char *params,
|
|
|
|
struct rte_tel_data *d)
|
|
|
|
{
|
|
|
|
uint64_t *rawdev_xstats;
|
|
|
|
struct rte_rawdev_xstats_name *xstat_names;
|
|
|
|
int dev_id, num_xstats, i, ret;
|
|
|
|
unsigned int *ids;
|
2020-08-27 09:39:22 +01:00
|
|
|
char *end_param;
|
rawdev: add telemetry callbacks
The rawdev library now registers commands with telemetry, and
implements the corresponding callback functions. These allow a list of
rawdev devices and xstats for a rawdev port to be queried.
An example usage, with ioat rawdev driver instances, is shown below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 65777, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
"/help", "/info", "/rawdev/list", "/rawdev/xstats"]}
--> /rawdev/list
{"/rawdev/list": [0, 1, 2, 3, 4, 5]}
--> /rawdev/xstats,0
{"/rawdev/xstats": {"failed_enqueues": 0, "successful_enqueues": 0, \
"copies_started": 0, "copies_completed": 0}}
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
2020-04-30 17:01:30 +01:00
|
|
|
|
|
|
|
if (params == NULL || strlen(params) == 0 || !isdigit(*params))
|
|
|
|
return -1;
|
|
|
|
|
2020-08-27 09:39:22 +01:00
|
|
|
dev_id = strtoul(params, &end_param, 0);
|
|
|
|
if (*end_param != '\0')
|
|
|
|
RTE_RDEV_LOG(NOTICE,
|
|
|
|
"Extra parameters passed to rawdev telemetry command, ignoring");
|
rawdev: add telemetry callbacks
The rawdev library now registers commands with telemetry, and
implements the corresponding callback functions. These allow a list of
rawdev devices and xstats for a rawdev port to be queried.
An example usage, with ioat rawdev driver instances, is shown below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 65777, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
"/help", "/info", "/rawdev/list", "/rawdev/xstats"]}
--> /rawdev/list
{"/rawdev/list": [0, 1, 2, 3, 4, 5]}
--> /rawdev/xstats,0
{"/rawdev/xstats": {"failed_enqueues": 0, "successful_enqueues": 0, \
"copies_started": 0, "copies_completed": 0}}
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
2020-04-30 17:01:30 +01:00
|
|
|
if (!rte_rawdev_pmd_is_valid_dev(dev_id))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
num_xstats = xstats_get_count(dev_id);
|
|
|
|
if (num_xstats < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
/* use one malloc for names, stats and ids */
|
|
|
|
rawdev_xstats = malloc((sizeof(uint64_t) +
|
|
|
|
sizeof(struct rte_rawdev_xstats_name) +
|
|
|
|
sizeof(unsigned int)) * num_xstats);
|
|
|
|
if (rawdev_xstats == NULL)
|
|
|
|
return -1;
|
|
|
|
xstat_names = (void *)&rawdev_xstats[num_xstats];
|
|
|
|
ids = (void *)&xstat_names[num_xstats];
|
|
|
|
|
|
|
|
ret = rte_rawdev_xstats_names_get(dev_id, xstat_names, num_xstats);
|
|
|
|
if (ret < 0 || ret > num_xstats) {
|
|
|
|
free(rawdev_xstats);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < num_xstats; i++)
|
|
|
|
ids[i] = i;
|
|
|
|
|
|
|
|
ret = rte_rawdev_xstats_get(dev_id, ids, rawdev_xstats, num_xstats);
|
|
|
|
if (ret < 0 || ret > num_xstats) {
|
|
|
|
free(rawdev_xstats);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
rte_tel_data_start_dict(d);
|
|
|
|
for (i = 0; i < num_xstats; i++)
|
|
|
|
rte_tel_data_add_dict_u64(d, xstat_names[i].name,
|
|
|
|
rawdev_xstats[i]);
|
|
|
|
|
|
|
|
free(rawdev_xstats);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
log: register with standardized names
Let's try to enforce the convention where most drivers use a pmd. logtype
with their class reflected in it, and libraries use a lib. logtype.
Introduce two new macros:
- RTE_LOG_REGISTER_DEFAULT can be used when a single logtype is
used in a component. It is associated to the default name provided
by the build system,
- RTE_LOG_REGISTER_SUFFIX can be used when multiple logtypes are used,
and then the passed name is appended to the default name,
RTE_LOG_REGISTER is left untouched for existing external users
and for components that do not comply with the convention.
There is a new Meson variable log_prefix to adapt the default name
for baseband (pmd.bb.), bus (no pmd.) and mempool (no pmd.) classes.
Note: achieved with below commands + reverted change on net/bonding +
edits on crypto/virtio, compress/mlx5, regex/mlx5
$ git grep -l RTE_LOG_REGISTER drivers/ |
while read file; do
pattern=${file##drivers/};
class=${pattern%%/*};
pattern=${pattern#$class/};
drv=${pattern%%/*};
case "$class" in
baseband) pattern=pmd.bb.$drv;;
bus) pattern=bus.$drv;;
mempool) pattern=mempool.$drv;;
*) pattern=pmd.$class.$drv;;
esac
sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file;
sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file;
done
$ git grep -l RTE_LOG_REGISTER lib/ |
while read file; do
pattern=${file##lib/};
pattern=lib.${pattern%%/*};
sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file;
sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file;
done
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-04-26 14:51:08 +02:00
|
|
|
RTE_LOG_REGISTER_DEFAULT(librawdev_logtype, INFO);
|
2020-07-01 18:03:35 +05:30
|
|
|
|
|
|
|
RTE_INIT(librawdev_init_telemetry)
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
{
|
rawdev: add telemetry callbacks
The rawdev library now registers commands with telemetry, and
implements the corresponding callback functions. These allow a list of
rawdev devices and xstats for a rawdev port to be queried.
An example usage, with ioat rawdev driver instances, is shown below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 65777, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
"/help", "/info", "/rawdev/list", "/rawdev/xstats"]}
--> /rawdev/list
{"/rawdev/list": [0, 1, 2, 3, 4, 5]}
--> /rawdev/xstats,0
{"/rawdev/xstats": {"failed_enqueues": 0, "successful_enqueues": 0, \
"copies_started": 0, "copies_completed": 0}}
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
2020-04-30 17:01:30 +01:00
|
|
|
rte_telemetry_register_cmd("/rawdev/list", handle_dev_list,
|
|
|
|
"Returns list of available rawdev ports. Takes no parameters");
|
|
|
|
rte_telemetry_register_cmd("/rawdev/xstats", handle_dev_xstats,
|
|
|
|
"Returns the xstats for a rawdev port. Parameters: int port_id");
|
rawdev: introduce raw device library
Each device in DPDK has a type associated with it - ethernet, crypto,
event etc. This patch introduces 'rawdevice' which is a generic
type of device, not currently handled out-of-the-box by DPDK.
A device which can be scanned on an installed bus (pci, fslmc, ...)
or instantiated through devargs, can be interfaced using
standardized APIs just like other standardized devices.
This library introduces an API set which can be plugged on the
northbound side to the application layer, and on the southbound side
to the driver layer.
The APIs of rawdev library exposes some generic operations which can
enable configuration and I/O with the raw devices. Using opaque
data (pointer) as API arguments, library allows a high flexibility
for application and driver implementation.
This patch introduces basic device operations like start, stop, reset,
queue and info support.
Subsequent patches would introduce other operations like buffer
enqueue/dequeue and firmware support.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 14:43:09 +05:30
|
|
|
}
|