dpdk.git
7 years agotest/eventdev: add octeontx queue based max stage
Jerin Jacob [Fri, 3 Mar 2017 17:28:17 +0000 (22:58 +0530)]
test/eventdev: add octeontx queue based max stage

Add queue based pipeline test with maximum number of stages available
in the device.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx flow based max stage
Jerin Jacob [Fri, 3 Mar 2017 17:28:16 +0000 (22:58 +0530)]
test/eventdev: add octeontx flow based max stage

Add flow based pipeline test with maximum number of stages available
in the device.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx queue based two stage sched
Jerin Jacob [Fri, 3 Mar 2017 17:28:15 +0000 (22:58 +0530)]
test/eventdev: add octeontx queue based two stage sched

Add queue based two stage pipeline test with all combination
of schedule types.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx flow based two stage sched
Jerin Jacob [Fri, 3 Mar 2017 17:28:14 +0000 (22:58 +0530)]
test/eventdev: add octeontx flow based two stage sched

Add flow based two stage pipeline test with all combination
of schedule types.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx multi link establishment
Jerin Jacob [Fri, 3 Mar 2017 17:28:13 +0000 (22:58 +0530)]
test/eventdev: add octeontx multi link establishment

Add unit test case to verify queue to port multi link
establishment operation.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx single link establishment
Jerin Jacob [Fri, 3 Mar 2017 17:28:12 +0000 (22:58 +0530)]
test/eventdev: add octeontx single link establishment

Add test case to verify queue to port single link establishment operation.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx multi queue and multi port
Jerin Jacob [Fri, 3 Mar 2017 17:28:11 +0000 (22:58 +0530)]
test/eventdev: add octeontx multi queue and multi port

Add unit test case to verify multi queue enqueue and multi core/port
dequeue operation.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx priority test
Jerin Jacob [Fri, 3 Mar 2017 17:28:09 +0000 (22:58 +0530)]
test/eventdev: add octeontx priority test

Added unit test case to verify the priority associated with
each event queue available in the device.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx multi queue enq/deq tests
Jerin Jacob [Fri, 3 Mar 2017 17:28:08 +0000 (22:58 +0530)]
test/eventdev: add octeontx multi queue enq/deq tests

Added unit test case to verify enqueue and dequeue operations
with multiple queues and a single port.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx simple enq/deq tests
Jerin Jacob [Tue, 4 Apr 2017 15:12:41 +0000 (20:42 +0530)]
test/eventdev: add octeontx simple enq/deq tests

Added unit test case to verify simple event enqueue and dequeue
operation with different schedule types

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agotest/eventdev: add octeontx unit test infrastructure
Jerin Jacob [Fri, 3 Mar 2017 17:28:04 +0000 (22:58 +0530)]
test/eventdev: add octeontx unit test infrastructure

add test setup and teardown routines.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoevent/octeontx: add stop and close functions
Jerin Jacob [Fri, 3 Mar 2017 17:28:03 +0000 (22:58 +0530)]
event/octeontx: add stop and close functions

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: add start function
Jerin Jacob [Fri, 3 Mar 2017 17:28:02 +0000 (22:58 +0530)]
event/octeontx: add start function

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: support worker dequeue
Jerin Jacob [Fri, 3 Mar 2017 17:28:01 +0000 (22:58 +0530)]
event/octeontx: support worker dequeue

If device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
configuration then use different fast path dequeue handler to wait till
requested amount of nanosecond if the event is not available.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
7 years agoevent/octeontx: support worker enqueue
Jerin Jacob [Fri, 3 Mar 2017 17:28:00 +0000 (22:58 +0530)]
event/octeontx: support worker enqueue

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: add SSO HW device operations
Jerin Jacob [Fri, 3 Mar 2017 17:27:59 +0000 (22:57 +0530)]
event/octeontx: add SSO HW device operations

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: add dump function for easier debugging
Jerin Jacob [Fri, 3 Mar 2017 17:27:58 +0000 (22:57 +0530)]
event/octeontx: add dump function for easier debugging

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: support dequeue timeout tick conversion
Jerin Jacob [Fri, 3 Mar 2017 17:27:57 +0000 (22:57 +0530)]
event/octeontx: support dequeue timeout tick conversion

SSO co-processor runs at a different frequency than core clock.
Request PF to convert the ns to SSO get_work timeout period.
On dequeue, If device is configured with
RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT configuration then
use different fast path dequeue handler to wait till requested
amount of nanosecond if the event is not available.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: support linking queues to ports
Jerin Jacob [Fri, 3 Mar 2017 17:27:56 +0000 (22:57 +0530)]
event/octeontx: support linking queues to ports

queues to port link and unlink establishment is through
setting/resetting the queue/group membership in
SSOW_VHWS_GRPMSK_CHGX

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: support event ports
Jerin Jacob [Fri, 3 Mar 2017 17:27:55 +0000 (22:57 +0530)]
event/octeontx: support event ports

Add in the data-structures for the ports used by workers
to sent events to/from the HW scheduler. Also add a
function to release the resource allocated in setup

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: support event queues
Jerin Jacob [Fri, 3 Mar 2017 17:27:54 +0000 (22:57 +0530)]
event/octeontx: support event queues

Pretty much everything done in HW. Need to configure
the priority associated with event queue aka sso group
through a mailbox request to PF

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: add configure function
Jerin Jacob [Fri, 3 Mar 2017 17:27:53 +0000 (22:57 +0530)]
event/octeontx: add configure function

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: add device capabilities function
Jerin Jacob [Fri, 3 Mar 2017 17:27:52 +0000 (22:57 +0530)]
event/octeontx: add device capabilities function

Add the info_get function to return details on the queues, flow,
prioritization capabilities, etc. which this device has.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: add octeontx eventdev driver
Jerin Jacob [Fri, 3 Mar 2017 17:27:51 +0000 (22:57 +0530)]
event/octeontx: add octeontx eventdev driver

This adds the minimal changes to allow a octeontx eventdev
implementation to be compiled, linked and created at run time.
The eventdev does nothing, but can be created via vdev
on command line, e.g.

sudo ./build/app/test -c 0xff00 --vdev=event_octeontx
...
Initializing event_octeontx domain=4 max_queues=64 max_ports=32
RTE>>

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: add mailbox support
Jerin Jacob [Fri, 3 Mar 2017 17:27:50 +0000 (22:57 +0530)]
event/octeontx: add mailbox support

ssovf VF device has mailbox mechanism to communicate
with PF device. This patch adds support for a mbox API to
send the mailbox request to PF device.
The ssovf VF device will be used as the communication channel
to talk to PF devices of all the network accelerated
co-processors in Octeontx. Exposing as shared function to
use it from pool, crypto, network devices.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
7 years agoevent/octeontx: add vdev interface functions
Jerin Jacob [Fri, 3 Mar 2017 17:27:49 +0000 (22:57 +0530)]
event/octeontx: add vdev interface functions

ssovf and ssowvf PCIe VF devices are shared
between eventdev PMD and ethdev PMD. This patch
expose a set of interface API to get info
about probed ssovf and ssowvf VF resources to use
with eventdev and ethdev vdev devices latter.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: probe ssowvf pcie devices
Jerin Jacob [Fri, 3 Mar 2017 17:27:48 +0000 (22:57 +0530)]
event/octeontx: probe ssowvf pcie devices

An event device consists of event queues and event ports.
On Octeontx HW, each event queues(sso group/ssovf) and
event ports(sso hws/ssowvf) are enumerated as separate
SRIOV VF PCIe device. In order to expose as an event device,
On PCIe probe, the driver stores the information associated
with the PCIe device and later with vdev infrastructure
creates event device with earlier probed PCIe VF devices.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: probe ssovf pcie devices
Jerin Jacob [Fri, 3 Mar 2017 17:27:47 +0000 (22:57 +0530)]
event/octeontx: probe ssovf pcie devices

An event device consists of event queues and event ports.
On Octeontx HW, each event queues(sso group/ssovf) and
event ports(sso hws/ssowvf) are enumerated as separate
SRIOV VF PCIe device. In order to expose as an event device,
On PCIe probe, the driver stores the information associated
with the PCIe device and later with vdev infrastructure
creates event device with earlier probed PCIe VF devices.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agoevent/octeontx: add build and log infrastructure
Jerin Jacob [Fri, 3 Mar 2017 17:27:46 +0000 (22:57 +0530)]
event/octeontx: add build and log infrastructure

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
7 years agomaintainers: add eventdev section and claim SW PMD
Harry van Haaren [Sat, 1 Apr 2017 10:41:16 +0000 (16:11 +0530)]
maintainers: add eventdev section and claim SW PMD

Add a section for the eventdev PMDs, and note the next-tree.
Claim maintainership of the software eventdev PMD.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agodoc: add SW eventdev PMD to release notes
Harry van Haaren [Thu, 30 Mar 2017 19:30:49 +0000 (20:30 +0100)]
doc: add SW eventdev PMD to release notes

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
7 years agodoc: add event device and software eventdev
Harry van Haaren [Thu, 30 Mar 2017 19:30:48 +0000 (20:30 +0100)]
doc: add event device and software eventdev

This commit adds a section to the docs listing the event
device PMDs available.

It then adds the software eventdev PMD to the listed event
devices.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agotest/eventdev: add SW deadlock tests
Harry van Haaren [Thu, 30 Mar 2017 19:30:47 +0000 (20:30 +0100)]
test/eventdev: add SW deadlock tests

This commit adds the worker loopback test to verify
that the deadlock avoidance scheme is functioning, and
a holb (head-of-line-blocking) test to ensure the head
of line blocking avoidance is correct.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agotest/eventdev: add SW xstats tests
Harry van Haaren [Thu, 30 Mar 2017 19:30:46 +0000 (20:30 +0100)]
test/eventdev: add SW xstats tests

This commit introduces xstats tests for statistics
and reset functionality.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agotest/eventdev: add SW tests for load balancing
Harry van Haaren [Thu, 30 Mar 2017 19:30:45 +0000 (20:30 +0100)]
test/eventdev: add SW tests for load balancing

This commit adds various tests for load-balancing and
queue prioritization.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agotest/eventdev: add basic SW tests
Harry van Haaren [Thu, 30 Mar 2017 19:30:44 +0000 (20:30 +0100)]
test/eventdev: add basic SW tests

This commit adds basic enqueue and dequeue unit tests,
some negative invalid tests, and configuration.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agotest/eventdev: add SW test infrastructure
Harry van Haaren [Thu, 30 Mar 2017 19:30:43 +0000 (20:30 +0100)]
test/eventdev: add SW test infrastructure

Add the test infrastructure, create and destroy the test
instance.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agoevent/sw: support xstats
Bruce Richardson [Thu, 30 Mar 2017 19:30:42 +0000 (20:30 +0100)]
event/sw: support xstats

Add support for xstats to report out on the state of the eventdev.
Useful for debugging and for unit tests, as well as observability
at runtime and performance tuning of apps to work well with the
scheduler.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
7 years agoevent/sw: add dump function for easier debugging
Bruce Richardson [Thu, 30 Mar 2017 19:30:41 +0000 (20:30 +0100)]
event/sw: add dump function for easier debugging

Segfault issue resolved when only partially configured and
rte_event_dev_dump() is called before start(),

Reported-by: Vipin Varghese <vipin.varghese@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
7 years agoevent/sw: add start stop and close functions
Bruce Richardson [Thu, 30 Mar 2017 19:30:40 +0000 (20:30 +0100)]
event/sw: add start stop and close functions

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoevent/sw: add scheduling logic
Bruce Richardson [Thu, 30 Mar 2017 19:30:39 +0000 (20:30 +0100)]
event/sw: add scheduling logic

Add in the scheduling function which takes the events from the
producer queues and buffers them before scheduling them to consumer
queues. The scheduling logic includes support for atomic, reordered,
and parallel scheduling of flows.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
7 years agoevent/sw: add worker core functions
Bruce Richardson [Thu, 30 Mar 2017 19:30:38 +0000 (20:30 +0100)]
event/sw: add worker core functions

add the event enqueue, dequeue and release functions to the eventdev.
These also include tracking of stats for observability in the load of
the scheduler.
Internally in the enqueue function, the various types of enqueue
operations, to forward an existing event, to send a new event, to
drop a previous event, are converted to a series of flags which will
be used by the scheduler code to perform the needed actions for that
event.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoevent/sw: support linking queues to ports
Bruce Richardson [Thu, 30 Mar 2017 19:30:37 +0000 (20:30 +0100)]
event/sw: support linking queues to ports

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoevent/sw: support event ports
Bruce Richardson [Thu, 30 Mar 2017 19:30:36 +0000 (20:30 +0100)]
event/sw: support event ports

Add in the data-structures for the ports used by workers to send
packets to/from the scheduler. Also add in the functions to
create/destroy those ports.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoevent/sw: support event queues
Bruce Richardson [Thu, 30 Mar 2017 19:30:35 +0000 (20:30 +0100)]
event/sw: support event queues

Add in the data structures for the event queues, and the eventdev
functions to create and destroy those queues.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoevent/sw: return default port/queue config
Bruce Richardson [Thu, 30 Mar 2017 19:30:34 +0000 (20:30 +0100)]
event/sw: return default port/queue config

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoevent/sw: add configure function
Bruce Richardson [Thu, 30 Mar 2017 19:30:33 +0000 (20:30 +0100)]
event/sw: add configure function

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoevent/sw: add device capabilities function
Bruce Richardson [Thu, 30 Mar 2017 19:30:32 +0000 (20:30 +0100)]
event/sw: add device capabilities function

Add in the info_get function to return details on the queues, flow,
prioritization capabilities, etc. that this device has.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoevent/sw: add new software-only eventdev driver
Bruce Richardson [Thu, 30 Mar 2017 19:30:31 +0000 (20:30 +0100)]
event/sw: add new software-only eventdev driver

This adds the minimal changes to allow a SW eventdev implementation to
be compiled, linked and created at run time. The eventdev does nothing,
but can be created via vdev on commandline, e.g.

  sudo ./x86_64-native-linuxapp-gcc/app/test --vdev=event_sw0
  ...
  PMD: Creating eventdev sw device event_sw0, numa_node=0, sched_quanta=128
  RTE>>

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agotest/eventdev: pass timeout ticks unsupported
Harry van Haaren [Thu, 30 Mar 2017 19:30:30 +0000 (20:30 +0100)]
test/eventdev: pass timeout ticks unsupported

This commit reworks the return value handling of the
timeout ticks test. This feature is not mandatory for
a pmd, the eventdev layer returns -ENOTSUP if the PMD
doesn't implement the function.

The test is modified to check if the return value is
-ENOTSUP, and return -ENOTSUP to the test framework,
which can handle "unsupported" tests since patch[1].

As such, this test will function correctly if the
patchset linked below is applied, it fails if the
patch is not applied and the PMD doesn't the timeout
ticks function.

Note it does not depend (as a compile time dependency)
on the patchset linked below.

[1] http://dpdk.org/dev/patchwork/patch/21979/

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoeventdev: improve docs of start function
Harry van Haaren [Thu, 30 Mar 2017 19:30:29 +0000 (20:30 +0100)]
eventdev: improve docs of start function

This commit documents two error return values for the
rte_event_dev_start() function.

-ESTALE  indicates not all ports are configured
-ENOLINK indicates that not all queues are linked to ports. If an
         application enqueues to such a queue it can lead to deadlock

Suggested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agodoc: add eventdev library to release notes
Jerin Jacob [Fri, 31 Mar 2017 14:20:29 +0000 (19:50 +0530)]
doc: add eventdev library to release notes

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoeventdev: add errno-style return values
Gage Eads [Mon, 3 Apr 2017 12:35:51 +0000 (18:05 +0530)]
eventdev: add errno-style return values

This commit adds rte_errno return values to rte_event_enqueue_burst() and
rte_event_dequeue_burst().

These return values allows user software to differentiate between an
invalid argument (such as an invalid queue_id or sched_type in an enqueued
event) and backpressure from the event device.

The port and device ID checks are placed in RTE_LIBRTE_EVENTDEV_DEBUG
header guards to avoid the performance hit in non-debug execution.

Signed-off-by: Gage Eads <gage.eads@intel.com>
7 years agoeventdev: add extended stats
Bruce Richardson [Fri, 10 Mar 2017 19:43:19 +0000 (19:43 +0000)]
eventdev: add extended stats

Add in APIs for extended stats so that eventdev implementations can report
out information on their internal state. The APIs are based on, but not
identical to, the equivalent ethdev functions.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agotest/eventdev: link all queues before start
Harry van Haaren [Fri, 10 Mar 2017 19:43:17 +0000 (19:43 +0000)]
test/eventdev: link all queues before start

The software eventdev can lock-up if not all queues are
linked to a port. For this reason, the software evendev
fails to start if queues are not linked to anything.

This commit creates dummy links from all queues to port
0 in the eventdev setup function and start/stop test,
which would otherwise fail due to unlinked queues.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoeventdev: remove default queue overriding
Harry van Haaren [Fri, 10 Mar 2017 15:19:15 +0000 (15:19 +0000)]
eventdev: remove default queue overriding

PMDs that only do a specific type of scheduling cannot provide
CFG_ALL_TYPES, so the Eventdev infrastructure should not demand
that every PMD supports CFG_ALL_TYPES.

By not overriding the default configuration of the queue as
suggested by the PMD, the eventdev_common unit tests can pass
on all PMDs, regardless of their capabilities.

RTE_EVENT_QUEUE_CFG_DEFAULT is no longer used by the eventdev layer
it can be removed now. Applications should use CFG_ALL_TYPES
if they require enqueue of all types a queue, or specify which
type of queue they require.

The CFG_DEFAULT value is changed to CFG_ALL_TYPES in event/skeleton,
to not break the compile.

A capability flag is added that indicates if the underlying PMD
supports creating queues of ALL_TYPES.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agotest/eventdev: fix reconfigure values
Jerin Jacob [Fri, 3 Mar 2017 17:27:44 +0000 (22:57 +0530)]
test/eventdev: fix reconfigure values

Minimum value of nb_event_ports and/or nb_event_queues
should be one before reconfiguring the event device.

Fixes: f8f9d233ea0e ("test/eventdev: add unit tests")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoeventdev: return code in dequeue timeout conversion
Jerin Jacob [Fri, 3 Mar 2017 17:27:43 +0000 (22:57 +0530)]
eventdev: return code in dequeue timeout conversion

eventdev driver may return error on dequeue timeout tick conversion.
Change the pmd callback interface to address the same.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoeventdev: fix links map initialization for SW PMD
Gage Eads [Mon, 3 Apr 2017 12:35:50 +0000 (18:05 +0530)]
eventdev: fix links map initialization for SW PMD

This patch initializes the links_map array entries to
EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by
rte_event_port_links_get(). This is necessary for the sw eventdev PMD,
which does not initialize links_map when rte_event_port_setup() calls
rte_event_port_unlink().

Fixes: 4f0804bbdfb9 ("eventdev: implement the northbound APIs")

Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoeventdev: use generic device holder
Nipun Gupta [Fri, 3 Mar 2017 15:33:02 +0000 (21:03 +0530)]
eventdev: use generic device holder

rte_device is a generic device which is available to the applications
and EAL. This patch replaces rte_pci_device in 'struct rte_eventdev'
and in 'struct rte_event_dev_info' with common rte_device.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
7 years agoeventdev: improve API doc for timeout ticks
Harry van Haaren [Wed, 8 Mar 2017 10:35:34 +0000 (10:35 +0000)]
eventdev: improve API doc for timeout ticks

Improve the documentation of the return values of the
rte_event_dequeue_timeout_ticks() function, adding a
-ENOTSUP value for eventdevs that do not support waiting.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoeventdev: increase size of enq/deq conf variables
Harry van Haaren [Fri, 10 Mar 2017 19:43:16 +0000 (19:43 +0000)]
eventdev: increase size of enq/deq conf variables

Large port enqueue sizes were not supported as the value
it was stored in was a uint8_t. Using uint8_ts to save
space in config apis makes no sense - increasing the 3
instances of uint8_t enqueue / dequeue depths to more
appropriate values (based on the context around them).

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoeventdev: amend timeout criteria comment for burst dequeue
Nipun Gupta [Fri, 10 Feb 2017 16:26:50 +0000 (21:56 +0530)]
eventdev: amend timeout criteria comment for burst dequeue

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoeventdev: clarify some parameter descriptions
Gage Eads [Mon, 3 Apr 2017 12:35:49 +0000 (18:05 +0530)]
eventdev: clarify some parameter descriptions

This commit clarifies the usage of nb_links and nb_unlinks when passing
a NULL pointer as the queues argument.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoeventdev: amend comments for events limit and threshold
Nipun Gupta [Tue, 14 Feb 2017 12:42:41 +0000 (18:12 +0530)]
eventdev: amend comments for events limit and threshold

Updated the comments on 'nb_events_limit' of 'struct rte_event_dev_config'
and 'new_event_threshold' of 'struct rte_event_port_conf'.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoeventdev: limit port link operation to configured queues
Jerin Jacob [Mon, 6 Feb 2017 05:29:37 +0000 (10:59 +0530)]
eventdev: limit port link operation to configured queues

On port_setup, the link_map is updated only
for configured number of event queues.
Limit the port_links_get scan only to configured number
of event queues. Also, Limit the port link and unlink queue
validation to configured number of event queues.

Fixes: 4f0804bbdfb9 ("eventdev: implement the northbound APIs")

Reported-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
7 years agoevent/skeleton: support vdev uninit
Jerin Jacob [Mon, 6 Feb 2017 05:23:39 +0000 (10:53 +0530)]
event/skeleton: support vdev uninit

Removed global index based device name
generation as vdev uninit needs the exact driver
name used vdev init.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoeventdev: support vdev uninit
Jerin Jacob [Mon, 6 Feb 2017 05:23:38 +0000 (10:53 +0530)]
eventdev: support vdev uninit

Added eventdev vdev uninit support to release the resources
allocated in eventdev vdev init.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoeventdev: fix event driver name to eventdev lookup
Jerin Jacob [Mon, 6 Feb 2017 05:23:37 +0000 (10:53 +0530)]
eventdev: fix event driver name to eventdev lookup

- Removed uninitialized max_devs value
- Corrected dev assignment

Fixes: 4f0804bbdfb9 ("eventdev: implement the northbound APIs")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
7 years agoeventdev: remove unneeded dependencies
Bruce Richardson [Tue, 31 Jan 2017 16:14:19 +0000 (16:14 +0000)]
eventdev: remove unneeded dependencies

Since eventdev uses event structures rather than working directly on
mbufs, there is no actual dependencies on the mbuf library. The
inclusion of an mbuf pointer element inside the event itself does not
require the inclusion of the mbuf header file. Similarly the pci
header is not needed, but following their removal, rte_memory.h is
needed for the definition of the __rte_cache_aligned macro.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agoeventdev: update event port link and unlink callbacks
Nipun Gupta [Mon, 6 Feb 2017 19:04:37 +0000 (00:34 +0530)]
eventdev: update event port link and unlink callbacks

Added a pointer to the rte_eventdev type in the event port
link and unlink callbacks. This device shall be used by some
of the event drivers to fetch queue related information.

Also, update the skeleton eventdev driver with corresponding changes.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agotest/eventdev: add unit tests
Jerin Jacob [Fri, 18 Nov 2016 05:45:02 +0000 (11:15 +0530)]
test/eventdev: add unit tests

This commit adds basic unit tests for the eventdev API.

commands to run the test app:
./build/app/test -c 2
RTE>>eventdev_common_autotest

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agoevent/skeleton: add skeleton eventdev driver
Jerin Jacob [Fri, 18 Nov 2016 05:45:01 +0000 (11:15 +0530)]
event/skeleton: add skeleton eventdev driver

The skeleton driver facilitates, bootstrapping the new
eventdev driver and creates a platform to verify
the northbound eventdev common code.

The driver supports both VDEV and PCI based eventdev
devices.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agoeventdev: implement PMD registration functions
Jerin Jacob [Tue, 6 Dec 2016 02:24:15 +0000 (07:54 +0530)]
eventdev: implement PMD registration functions

This patch adds infrastructure for registering the vdev or
the PCI based event device.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agoeventdev: implement the northbound APIs
Jerin Jacob [Tue, 6 Dec 2016 01:51:46 +0000 (07:21 +0530)]
eventdev: implement the northbound APIs

This patch implements northbound eventdev API interface using
southbond driver interface

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agoeventdev: define southbound driver interface
Jerin Jacob [Tue, 6 Dec 2016 01:25:30 +0000 (06:55 +0530)]
eventdev: define southbound driver interface

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agoeventdev: introduce event driven programming model
Jerin Jacob [Fri, 18 Nov 2016 02:00:38 +0000 (07:30 +0530)]
eventdev: introduce event driven programming model

In a polling model, lcores poll ethdev ports and associated
rx queues directly to look for packet. In an event driven model,
by contrast, lcores call the scheduler that selects packets for
them based on programmer-specified criteria. Eventdev library
adds support for event driven programming model, which offer
applications automatic multicore scaling, dynamic load balancing,
pipelining, packet ingress order maintenance and
synchronization services to simplify application packet processing.

By introducing event driven programming model, DPDK can support
both polling and event driven programming models for packet processing,
and applications are free to choose whatever model
(or combination of the two) that best suits their needs.

This patch adds the eventdev specification header file.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agoexamples/vhost: demonstrate the new generic APIs
Yuanhan Liu [Sat, 1 Apr 2017 07:23:00 +0000 (15:23 +0800)]
examples/vhost: demonstrate the new generic APIs

Now DPDK vhost lib has been generic enough, that it can be used to
implement any vhost-user drivers.

For example, this patch implements a very simple vhost-user net driver,
mainly for demonstrating how to use those generic vhost APIs.

And when the --builtin-net-driver option is used, the example virtio-net
driver code will be invoked, instead of the one provided from the vhost
library.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
7 years agovhost: do not destroy device on repeat mem table message
Yuanhan Liu [Sat, 1 Apr 2017 07:22:59 +0000 (15:22 +0800)]
vhost: do not destroy device on repeat mem table message

It doesn't make any sense to invoke destroy_device() callback at
while handling SET_MEM_TABLE message.

From the vhost-user spec, it's the GET_VRING_BASE message indicates
the end of a vhost device: the destroy_device() should be invoked
from there (luckily, we already did that).

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: workaround the build dependency on mbuf header
Yuanhan Liu [Sat, 1 Apr 2017 07:22:58 +0000 (15:22 +0800)]
vhost: workaround the build dependency on mbuf header

rte_mbuf struct is something more likely will be used only in vhost-user
net driver, while we have made vhost-user generic enough that it can
be used for implementing other drivers (such as vhost-user SCSI), they
have also include <rte_mbuf.h>. Otherwise, the build will be broken.

We could workaround it by using forward declaration, so that other
non-net drivers won't need include <rte_mbuf.h>.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: rename header file
Yuanhan Liu [Sat, 1 Apr 2017 07:22:57 +0000 (15:22 +0800)]
vhost: rename header file

Rename "rte_virtio_net.h" to "rte_vhost.h", to not let it be virtio
net specific.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: introduce API to start a specific driver
Yuanhan Liu [Sat, 1 Apr 2017 07:22:56 +0000 (15:22 +0800)]
vhost: introduce API to start a specific driver

We used to use rte_vhost_driver_session_start() to trigger the vhost-user
session. It takes no argument, thus it's a global trigger. And it could
be problematic.

The issue is, currently, rte_vhost_driver_register(path, flags) actually
tries to put it into the session loop (by fdset_add). However, it needs
a set of APIs to set a vhost-user driver properly:
  * rte_vhost_driver_register(path, flags);
  * rte_vhost_driver_set_features(path, features);
  * rte_vhost_driver_callback_register(path, vhost_device_ops);

If a new vhost-user driver is registered after the trigger (think OVS-DPDK
that could add a port dynamically from cmdline), the current code will
effectively starts the session for the new driver just after the first
API rte_vhost_driver_register() is invoked, leaving later calls taking
no effect at all.

To handle the case properly, this patch introduce a new API,
rte_vhost_driver_start(path), to trigger a specific vhost-user driver.
To do that, the rte_vhost_driver_register(path, flags) is simplified
to create the socket only and let rte_vhost_driver_start(path) to
actually put it into the session loop.

Meanwhile, the rte_vhost_driver_session_start is removed: we could hide
the session thread internally (create the thread if it has not been
created). This would also simplify the application.

NOTE: the API order in prog guide is slightly adjusted for showing the
correct invoke order.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: export APIs for live migration support
Yuanhan Liu [Sat, 1 Apr 2017 07:22:55 +0000 (15:22 +0800)]
vhost: export APIs for live migration support

Export few APIs for the vhost-user driver to log the guest memory writes,
which is a must for live migration support.

This patch basically moves vhost_log_write() and vhost_log_used_vring()
into vhost.h and then add an wrapper (the public API) to them.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: add features changed callback
Yuanhan Liu [Sat, 1 Apr 2017 07:22:54 +0000 (15:22 +0800)]
vhost: add features changed callback

Features could be changed after the feature negotiation. For example,
VHOST_F_LOG_ALL will be set/cleared at the start/end of live migration,
respecitively. Thus, we need a new callback to inform the application
on such change.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: rename virtio-net to vhost
Yuanhan Liu [Sat, 1 Apr 2017 07:22:53 +0000 (15:22 +0800)]
vhost: rename virtio-net to vhost

Rename "virtio-net" to "vhost" in the API comments and vhost prog guide.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: rename device ops struct
Yuanhan Liu [Sat, 1 Apr 2017 07:22:52 +0000 (15:22 +0800)]
vhost: rename device ops struct

rename "virtio_net_device_ops" to "vhost_device_ops", to not let it
be virtio-net specific.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: do not include net specific headers
Yuanhan Liu [Sat, 1 Apr 2017 07:22:51 +0000 (15:22 +0800)]
vhost: do not include net specific headers

Include it internally, at vhost.h.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: drop the Rx and Tx queue macro
Yuanhan Liu [Sat, 1 Apr 2017 07:22:50 +0000 (15:22 +0800)]
vhost: drop the Rx and Tx queue macro

They are virtio-net specific and should be defined inside the virtio-net
driver.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: move the device ready check at proper place
Yuanhan Liu [Sat, 1 Apr 2017 07:22:49 +0000 (15:22 +0800)]
vhost: move the device ready check at proper place

Currently, we check vq->desc, vq->kickfd and vq->callfd to know whether
a virtio device is ready or not. However, we only do it when handling
SET_VRING_KICK message, which could be wrong if a vhost-user frontend
send SET_VRING_KICK first and SET_VRING_CALL later.

To work for all possible vhost-user frontend implementations, we could
move the ready check at the end of vhost-user message handler.

Meanwhile, since we do the check more often than before, the "virtio
not ready" message is dropped, to not flood the screen.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: export the number of vrings
Yuanhan Liu [Sat, 1 Apr 2017 07:22:48 +0000 (15:22 +0800)]
vhost: export the number of vrings

We used to use rte_vhost_get_queue_num() for telling how many vrings.
However, the return value is the number of "queue pairs", which is
very virtio-net specific. To make it generic, we should return the
number of vrings instead, and let the driver do the proper translation.
Say, virtio-net driver could turn it to the number of queue pairs by
dividing 2.

Meanwhile, mark rte_vhost_get_queue_num as deprecated.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: turn queue pair to vring
Yuanhan Liu [Sat, 1 Apr 2017 07:22:47 +0000 (15:22 +0800)]
vhost: turn queue pair to vring

The queue pair is very virtio-net specific, other devices don't have
such concept. To make it generic, we should log the number of vrings
instead of the number of queue pairs.

This patch just does a simple convert, a later patch would export the
number of vrings to applications.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: export API to translate gpa to vva
Yuanhan Liu [Sat, 1 Apr 2017 07:22:46 +0000 (15:22 +0800)]
vhost: export API to translate gpa to vva

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: export vhost vring info
Yuanhan Liu [Sat, 1 Apr 2017 07:22:45 +0000 (15:22 +0800)]
vhost: export vhost vring info

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: introduce API to fetch negotiated features
Yuanhan Liu [Sat, 1 Apr 2017 07:22:44 +0000 (15:22 +0800)]
vhost: introduce API to fetch negotiated features

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: export guest memory regions
Yuanhan Liu [Sat, 1 Apr 2017 07:22:43 +0000 (15:22 +0800)]
vhost: export guest memory regions

Some vhost-user driver may need this info to setup its own page tables
for GPA (guest physical addr) to HPA (host physical addr) translation.
SPDK (Storage Performance Development Kit) is one example.

Besides, by exporting this memory info, we could also export the
gpa_to_vva() as an inline function, which helps for performance.
Otherwise, it has to be referenced indirectly by a "vid".

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: make notify ops per vhost driver
Yuanhan Liu [Sat, 1 Apr 2017 07:22:42 +0000 (15:22 +0800)]
vhost: make notify ops per vhost driver

Assume there is an application both support vhost-user net and
vhost-user scsi, the callback should be different. Making notify
ops per vhost driver allow application define different set of
callbacks for different driver.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: use new APIs to handle features
Yuanhan Liu [Sat, 1 Apr 2017 07:22:41 +0000 (15:22 +0800)]
vhost: use new APIs to handle features

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agonet/vhost: remove feature related APIs
Yuanhan Liu [Sat, 1 Apr 2017 07:22:40 +0000 (15:22 +0800)]
net/vhost: remove feature related APIs

The rte_eth_vhost_feature_disable/enable/get APIs are just a wrapper of
rte_vhost_feature_disable/enable/get. However, the later are going to
be refactored; it's going to take an extra parameter (socket_file path),
to let it be per-device.

Instead of changing those vhost-pmd APIs to adapt to the new vhost APIs,
we could simply remove them, and let vdev to serve this purpose. After
all, vdev options is better for disabling/enabling some features.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: introduce driver features related APIs
Yuanhan Liu [Sat, 1 Apr 2017 07:22:39 +0000 (15:22 +0800)]
vhost: introduce driver features related APIs

Introduce few APIs to set/get/enable/disable driver features.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: fix fd leaks for vhost-user server mode
Yuanhan Liu [Mon, 27 Mar 2017 08:52:15 +0000 (16:52 +0800)]
vhost: fix fd leaks for vhost-user server mode

A vhost-user server socket could have many connections, thus many connfd.
However, we currently just use one single int var to store it. Meaning,
it will get overwritten every time a new connection is created.

While this will not create fatal issue as it sounds (since the correct
connfd is closured to the event loop thread by fdset_add), it may cause
fd leaks if a user invokes rte_vhost_driver_unregister before shutting
down all connections: it just closes the recent connfd.

A simple example that should be able to reproduce this leaks issues is,
del the ovs vhost-user port while the connected VMs are still alive. (Note
that it's suggested to use one socket for one VM, which makes the issue
not that fatal as it sounds again).

Since we already use a struct "vhost_user_connection" to track all info
about one connection, it's obvious that we should put the connfd there.
Then we could build a connection list inside the vhost_user_socket struct,
to represent all connections belong that socket file.

Fixes: 164fd396788d ("vhost: fix unregistering in client mode")
Cc: stable@dpdk.org
Cc: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>