Commit Graph

14 Commits

Author SHA1 Message Date
Bruce Richardson
a951e147ea rawdev: allow devices to skip extra memory allocation
Some device drivers want to allocate their own private memory, and should
be allowed to do so. Therefore skip memory allocation and associated error
checks if zero-length private memory is requested.

While adjusting the code for new indent level, fix incorrect error
message.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-07-04 09:33:59 +02:00
Bruce Richardson
863fd2930b rawdev: pass the device id as parameter to selftest
When running self-tests, the driver needs to know the device on which to
run the tests, so we need to take the device ID as parameter. Only the
skeleton driver is providing this selftest capability right now, so we can
easily update it for this change.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-07-02 17:04:30 +02:00
Bruce Richardson
6723c0fc72 replace snprintf with strlcpy
Do a global replace of snprintf(..."%s",...) with strlcpy, adding in the
rte_string_fns.h header if needed.  The function changes in this patch were
auto-generated via command:

  spatch --sp-file devtools/cocci/strlcpy.cocci --dir . --in-place

and then the files edited using awk to add in the missing header:

  gawk -i inplace '/include <rte_/ && ! seen { \
  	print "#include <rte_string_fns.h>"; seen=1} {print}'

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-04-04 22:46:05 +02:00
Ferruh Yigit
8298310ffa lib: reduce global variable usage
Some global variables can be eliminated, since they are not part of
public interface, it is free to remove them.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-10-29 02:34:27 +01:00
Shreyansh Jain
e728f9d92c rawdev: fix missing queue count API
Rawdev queue count API prototype was declared, but the definition was
missing from the library. This patch implements the function.

This API is used to query the device about the count of queues it has
been configured with.

Fixes: c88b3f2558 ("rawdev: introduce raw device library")
Cc: stable@dpdk.org

Suggested-by: Keith Wiles <keith.wiles@intel.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-08-01 18:25:10 +02:00
Shreyansh Jain
931cc531aa rawdev: remove experimental tag
Besides the librawdev, removing experimental from skeleton_rawdev
dummy driver as well.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-07-26 23:58:08 +02:00
Thomas Monjalon
f8e9989606 remove useless constructor headers
A constructor is usually declared with RTE_INIT* macros.
As it is a static function, no need to declare before its definition.
The macro is used directly in the function definition.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-07-12 00:00:35 +02:00
Shreyansh Jain
7d3c4fb6de rawdev: remove dead code
Coverity issue: 260406
Fixes: c88b3f2558 ("rawdev: introduce raw device library")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-05-14 01:01:11 +02:00
Shreyansh Jain
7ae53626e4 rawdev: add self test
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 15:35:56 +01:00
Shreyansh Jain
ada90a80f5 rawdev: add firmware management
Some generic operations for firmware management can loading, unloading,
starting, stopping and querying firmware of a device.

This patch adds support for such generic operations.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 15:35:49 +01:00
Shreyansh Jain
4d4fdc142b rawdev: add extended stats
Generic rawdev library cannot define a pre-defined set of stats
for devices which are yet to be defined.

This patch introduces the xstats support for rawdev so that any
implementation can create its own statistics.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 15:35:37 +01:00
Shreyansh Jain
eaf12cccca rawdev: add buffer stream IO
Introduce handlers for raw buffer enqueue and dequeue. A raw buffer
is essentially a void object which is transparently passed via the
library onto the driver.

Using a context field as argument, any arbitrary meta information
can be passed by application to the driver/implementation. This can
be any data on which driver needs to define the operation semantics.
For example, passing along a queue identifier can suggest the driver
the queue context to perform I/O on.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 15:35:27 +01:00
Shreyansh Jain
919be8321e rawdev: add attribute get and set
A rawdevice can have various attributes. This patch introduce support
for transparently setting attribute value or getting current attribute
state. This is done by allowing an opaque set of key and value to be
passed through rawdev library.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-01-31 15:35:18 +01:00
Shreyansh Jain
c88b3f2558 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 15:35:01 +01:00