Commit Graph

40 Commits

Author SHA1 Message Date
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
Ferruh Yigit
70815c9eca ethdev: add new offload flag to keep CRC
DEV_RX_OFFLOAD_KEEP_CRC offload flag is added. PMDs that support
keeping CRC should advertise this offload capability.

DEV_RX_OFFLOAD_CRC_STRIP flag will remain one more release
default behavior in PMDs are to keep the CRC until this flag removed

Until DEV_RX_OFFLOAD_CRC_STRIP flag is removed:
- Setting both KEEP_CRC & CRC_STRIP is INVALID
- Setting only CRC_STRIP PMD should strip the CRC
- Setting only KEEP_CRC PMD should keep the CRC
- Not setting both PMD should keep the CRC

A helper function rte_eth_dev_is_keep_crc() has been added to be able to
change the no flag behavior with minimal changes in PMDs.

The PMDs that doesn't report the DEV_RX_OFFLOAD_KEEP_CRC offload can
remove rte_eth_dev_is_keep_crc() checks next release, related code
commented to help the maintenance task.

And DEV_RX_OFFLOAD_CRC_STRIP has been added to virtual drivers since
they don't use CRC at all, when an application requires this offload
virtual PMDs should not return error.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-07-03 01:35:58 +02:00
Bruce Richardson
ed71204dd0 net/avp: add to meson build
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
2018-06-14 19:27:50 +02:00
Thomas Monjalon
01a98fdd08 drivers/net: use higher level of probing helper for PCI
The drivers avp, bnx2x and liquidio were using the helper function
rte_eth_dev_pci_allocate() and can be replaced by
rte_eth_dev_pci_generic_probe() which calls the former.

Fixes: dcd5c8112b ("ethdev: add PCI driver helpers")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
2018-05-14 22:31:53 +01:00
Ferruh Yigit
cd8c7c7ce2 ethdev: replace bus specific struct with generic dev
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
although it is common for all ethdev in all buses.

Replacing pci specific struct with generic device struct and updating
places that are using pci device in a way to get this information from
generic device.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-04-14 00:41:44 +02:00
Allain Legacy
50da8b0de8 net/avp: convert to SPDX license tags
As per the following commit the AVP files maintained by Wind River are
converted to use the SPDX license tag format.

    commit a4862c9e1a ("license: introduce SPDX identifiers")

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-03-30 14:08:44 +02:00
Allain Legacy
462b66d89a net/avp: conform to new ethdev offload API
This change updates the AVP driver to conform with the new ethdev
offload API.  As per these commits:

    commit cba7f53b71 ("ethdev: introduce Tx queue offloads API")'
    commit ce17eddefc ("ethdev: introduce Rx queue offloads API")'

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
2018-03-30 14:08:44 +02:00
Harry van Haaren
bd34cd80b1 net/avp: align dynamic log names with standard
This commit aligns the names for dynamic logging with
the newly defined logging format.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-01-31 09:28:06 +01:00
Ferruh Yigit
ffc905f3b8 ethdev: separate driver APIs
Create a rte_ethdev_driver.h file and move PMD specific APIs here.
Drivers updated to include this new header file.

There is no update in header content and since ethdev.h included by
ethdev_driver.h, nothing changed from driver point of view, only
logically grouping of APIs. From applications point of view they can't
access to driver specific APIs anymore and they shouldn't.

More PMD specific data structures still remain in ethdev.h because of
inline functions in header use them. Those will be handled separately.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-01-22 01:26:49 +01:00
Adrien Mazarguil
0d440d081c lib: fix missing includes in exported headers
Many exported headers rely on definitions found in rte_config.h without
including it, as shown by the following command:

 grep -L '^#include <rte_config.h>' -- \
  $(grep -Rl \
    $(sed -n '/^#define \([^ ]\+\).*$/{s//\1/;H;};${x;s/\n//;s/\n/\\|/g;p;}' \
      build/include/rte_config.h) \
    -- build/include/)

We cannot assume external applications will include rte_config.h on their
own, neither directly nor through a -include parameter like DPDK does
internally.

This not only causes obvious compilation failures that can be reproduced
with check-includes.sh such as:

 [...]/rte_memory.h:88:43: error: ‘RTE_CACHE_LINE_SIZE’ was not declared in
     this scope
  #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
                                            ^

It also results in less visible issues, for instance rte_hash_crc.h relying
on RTE_ARCH_X86_64's presence to provide dedicated inline functions.

This patch partially reverts the commit below and adds missing include
lines to the remaining files.

Fixes: f1a7a5c5f4 ("remove include of generated config header")
Cc: stable@dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-01-17 00:31:05 +01:00
Stephen Hemminger
e6b790c065 net/avp: implement dynamic logging
All PMD should be using dynamic log levels.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-01-16 18:47:49 +01:00
Santosh Shukla
df6e0a06a3 drivers/net: rename physical address type to IOVA
Renamed data type from phys_addr_t to rte_iova_t.

Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2017-11-06 22:44:26 +01:00
Thomas Monjalon
4c00cfdc0e remove useless memzone includes
The memzone header is often included without good reason.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-11-06 22:12:08 +01:00
Gaetan Rivet
c752998b5e pci: introduce library and driver
The PCI lib defines the types and methods allowing to use PCI elements.

The PCI bus implements a bus driver for PCI devices by constructing
rte_bus elements using the PCI lib.

Move the relevant code out of the EAL to its expected place.

Libraries, drivers, unit tests and applications are updated to use the
new rte_bus_pci.h header when necessary.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2017-10-26 23:17:31 +02:00
David Harton
289ba0c0f5 ethdev: allow returning error on VLAN offload ops
Some devices may not support or fail setting VLAN offload
configuration based on dynamic circumstances so the
vlan_offload_set_t vector is modified to return an int so
the caller can determine success or not.

rte_eth_dev_set_vlan_offload is updated to return the
value provided by the vector when called along with restoring
the original offload configs on failure.

Existing vlan_offload_set_t vectors are modified to return
an int.  Majority of cases return 0 but a few that actually
can fail now return their failure codes.

Finally, a vlan_offload_set_t vector is added to virtio
to facilitate dynamically turning VLAN strip on or off.

Signed-off-by: David Harton <dharton@cisco.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-10-26 02:33:01 +02:00
Olivier Matz
380a7aab1a mbuf: rename deprecated VLAN flags
PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated for a while.
As explained in [1], these flags were kept to let the applications and
PMDs move to the new flag. There is also a need to support Rx vlan
offload without vlan strip (at least for the ixgbe driver).

This patch renames the old flags for this feature, knowing that some
PMDs were using PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT to indicate that
the vlan tci has been saved in the mbuf structure.

It is likely that some PMDs do not set the proper flags when doing vlan
offload, and it would be worth making a pass on all of them.

Link: [1] http://dpdk.org/ml/archives/dev/2017-June/067712.html

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-10-26 02:33:01 +02:00
Gaetan Rivet
00a3d8104a ethdev: remove detachable device flag
This flag is not necessary at the ether layer anymore.
Buses are able to advertise their hotplug support. The ether layer can
rely upon this capability instead of a special flag.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2017-10-26 02:33:01 +02:00
Olivier Matz
cbc12b0a96 mk: do not generate LDLIBS from directory dependencies
The list of libraries in LDLIBS was generated from the DEPDIRS-xyz
variable. This is valid when the subdirectory name match the library
name, but it's not always the case, especially for PMDs.

The patches removes this feature and explicitly adds the proper
libraries in LDLIBS.

Some DEPDIRS-xyz variables become useless, remove them.

Reported-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Gage Eads <gage.eads@intel.com>
2017-10-24 02:14:57 +02:00
Matan Azrad
d5b0924ba6 ethdev: add return value to stats get dev op
The stats_get dev op API doesn't include return value, so PMD cannot
return an error in case of failure at stats getting process time.

Since PCI devices can be removed and there is a time between the
physical removal to the RMV interrupt, the user may get invalid stats
without any indication.

This patch changes the stats_get API return value to be int instead of
void.

All the net PMDs stats_get dev ops are adjusted by this patch.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-10-12 01:52:49 +01:00
Zhiyong Yang
f8244c6399 ethdev: increase port id range
Extend port_id definition from uint8_t to uint16_t in lib and drivers
data structures, specifically rte_eth_dev_data. Modify the APIs,
drivers and app using port_id at the same time.

Fix some checkpatch issues from the original code and remove some
unnecessary cast operations.

release_17_11 and deprecation docs have been updated in this patch.

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-10-06 18:23:25 +02:00
Ferruh Yigit
0362b7294d net/avp: remove redundant assignment
dev_info->driver_name is assigned by rte_eth_dev_info_get()
and existing value overwritten, removing assignment.

Fixes: 1a85922369 ("net/avp: add device configuration")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
2017-06-12 10:41:26 +01:00
Ferruh Yigit
c0802544d9 drivers/net: add generic ethdev macro to get PCI device
Instead of many PMD define their own macro, define a generic one in
ethdev and use that in PMDs.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2017-06-12 10:41:25 +01:00
Ferruh Yigit
dd2c630a5f drivers/net: remove unnecessary macro for unused variables
remove __rte_unused instances that are not required.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
2017-06-12 10:41:25 +01:00
Ferruh Yigit
f353fbc596 net/avp: fix interrupt migration check
Bitwise OR within if statement is always true, fix bitwise operator.

Coverity issue: 1423906
Fixes: 82e140b849 ("net/avp: handle interrupt migration")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
2017-04-28 14:46:19 +02:00
Adrien Mazarguil
80fcb5cad4 net/avp: fix exported headers
This commit addresses several errors related to missing includes such as:

 In file included from /tmp/check-includes.sh.15315.c:1:0:
 build/include/rte_avp_fifo.h:77:22: error: 'struct rte_avp_fifo' declared
    inside parameter list [-Werror]
 [...]
 build/include/rte_avp_fifo.h: In function 'avp_fifo_init':
 build/include/rte_avp_fifo.h:81:3: error: implicit declaration of function
    'rte_panic' [-Werror=implicit-function-declaration]
 [...]
 build/include/rte_avp_fifo.h:83:6: error: dereferencing pointer to
    incomplete type
 [...]
 build/include/rte_avp_fifo.h:109:2: error: implicit declaration of
    function 'rte_wmb' [-Werror=implicit-function-declaration]
 [...]
 In file included from /tmp/check-includes.sh.15315.c:1:0:
 build/include/rte_avp_common.h:104:2: error: unknown type name 'uint64_t'
 [...]
 build/include/rte_avp_common.h:386:15: error: 'ETHER_ADDR_LEN' undeclared
    here (not in a function)
 [...]

It addresses errors with strict compilation flags:

 In file included from /tmp/check-includes.sh.15315.c:1:0:
 build/include/rte_avp_common.h:122:3: error: ISO C99 doesn't support
    unnamed structs/unions [-Werror=pedantic]
 [...]
 build/include/rte_avp_common.h:136:17: error: ISO C forbids zero-size
    array 'buffer' [-Werror=pedantic]
 [...]

And also adds C++ awareness to both header files.

Fixes: 8e680655e2 ("net/avp: add public header files")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
2017-05-01 00:13:15 +02:00
Jan Blunck
fdf91e0f2f drivers/net: do not use ethdev driver
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-18 19:05:46 +02:00
Qi Zhang
c23a1a3000 eal: clean up interrupt handle
The patch change the prototype of callback function
(rte_intr_callback_fn) by removing the unnecessary parameter.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
2017-04-06 21:15:55 +02:00
Allain Legacy
82e140b849 net/avp: handle interrupt migration
This commit introduces changes required to support VM live-migration.  This
is done by registering and responding to interrupts coming from the host to
signal that the memory is about to be made invalid and replaced with a new
memory zone on the destination compute node.

Enabling and disabling of the interrupts are maintained outside of the
start/stop functions because they must be enabled for the lifetime of the
device.  This is so that host interrupts are serviced and acked even in
cases where the app may have stopped the device.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:19 +02:00
Allain Legacy
ea37523dbc net/avp: add device start and stop operations
Adds support for device start and stop functions.  This allows an
application to control the administrative state of an AVP device.  Stopping
the device will notify the host application to stop sending packets on that
device's receive queues.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:19 +02:00
Allain Legacy
8129545e31 net/avp: add device promiscuous functions
Adds support for setting and clearing promiscuous mode on an AVP device.
When enabled the _mac_filter function will allow packets destined to any
MAC address to be processed by the receive functions.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:19 +02:00
Allain Legacy
5a5abe2de9 net/avp: add device statistics operations
Adds device functions to query and reset statistics.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
295abce2d2 net/avp: add packet transmit functions
Adds support for packet transmit functions so that an application can send
packets to the host application via an AVP device queue.  Both the simple
and scattered functions are supported.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
50db69fdea net/avp: add packet receive functions
Adds function required for receiving packets from the host application via
AVP device queues.  Both the simple and scattered functions are supported.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
cce4367fb4 net/avp: add queue setup and release
Adds queue management operations so that an application can setup and
release the transmit and receive queues.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
1a85922369 net/avp: add device configuration
Adds support for "dev_configure" operations to allow an application to
configure the device.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
c0ad584222 net/avp: add device initialization
Adds support for initialization newly probed AVP PCI devices.  Initial
queue translations are setup in preparation for device configuration.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
908072e9d0 net/avp: support driver registration
Adds the initial framework for registering the driver against the support
PCI device identifiers.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
8c7bb9c991 net/avp: add debug log macros
Adds a header file with log macros for the AVP PMD

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
8e680655e2 net/avp: add public header files
Adds public/exported header files for the AVP PMD.  The AVP device is a
shared memory based device.  The structures and constants that define the
method of operation of the device must be visible by both the PMD and the
host DPDK application.  They must not change without proper version
controls and updates to both the hypervisor DPDK application and the PMD.

The hypervisor DPDK application is a Wind River Systems proprietary
virtual switch.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:18 +02:00
Allain Legacy
9201ec9bd0 net/avp: add base files
This commit introduces the AVP PMD file structure without adding any actual
driver functionality.  Functional blocks will be added in later patches.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-04-04 19:02:07 +02:00