dpdk.git
9 years agoethdev: add ieee1588 timestamping
John McNamara [Thu, 2 Jul 2015 15:16:28 +0000 (16:16 +0100)]
ethdev: add ieee1588 timestamping

Add ethdev API to enable and read IEEE1588/802.1AS PTP timestamps
from devices that support it. The following functions are added:

    rte_eth_timesync_enable()
    rte_eth_timesync_disable()
    rte_eth_timesync_read_rx_timestamp()
    rte_eth_timesync_read_tx_timestamp()

Signed-off-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
[Thomas: merged with new macro VALID_PORTID_OR_ERR_RET]

9 years agovmxnet3: remove unnecessary inlining
Stephen Hemminger [Thu, 9 Jul 2015 18:24:16 +0000 (11:24 -0700)]
vmxnet3: remove unnecessary inlining

No reason to inline large functions. Compiler will decide already
based on optimization level.

Also register array should be const.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yong Wang <yongwang@vmware.com>
9 years agovmxnet3: get rid of debug ifdefs
Stephen Hemminger [Thu, 9 Jul 2015 18:24:15 +0000 (11:24 -0700)]
vmxnet3: get rid of debug ifdefs

By defining macro as a stub it is possible to get rid of #ifdef's
in the actual code. Always evaluate the argument (even in the stub)
so that there are no extra unused variable errors.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yong Wang <yongwang@vmware.com>
9 years agovmxnet3: support RSS and refactor Rx offload
Stephen Hemminger [Thu, 9 Jul 2015 18:24:14 +0000 (11:24 -0700)]
vmxnet3: support RSS and refactor Rx offload

Refactor the logic to compute receive offload flags to a simpler
function. And add support for putting RSS flow hash into packet.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bill Hong <bhong@brocade.com>
Acked-by: Yong Wang <yongwang@vmware.com>
9 years agovmxnet3: fix link state handling
Stephen Hemminger [Thu, 9 Jul 2015 18:24:13 +0000 (11:24 -0700)]
vmxnet3: fix link state handling

The Intel version of VMXNET3 driver does not handle link state properly.
The VMXNET3 API returns 1 if connected and 0 if disconnected.
Also need to return correct value to indicate state change.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yong Wang <yongwang@vmware.com>
9 years agovmxnet3: support multi-segment transmit
Stephen Hemminger [Thu, 9 Jul 2015 18:24:12 +0000 (11:24 -0700)]
vmxnet3: support multi-segment transmit

Change sending loop to support multi-segment mbufs.
The VMXNET3 api has start-of-packet and end-packet flags, so it
is not hard to send multi-segment mbuf's.

Also, update descriptor in 32 bit value rather than toggling
bitfields which is slower and error prone.
Based on code in earlier driver, and the Linux kernel driver.

Add a compiler barrier to make sure that update of earlier descriptor
are completed prior to update of generation bit on start of packet.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yong Wang <yongwang@vmware.com>
9 years agovmxnet3: cleanup Tx stats per queue
Stephen Hemminger [Thu, 9 Jul 2015 18:24:11 +0000 (11:24 -0700)]
vmxnet3: cleanup Tx stats per queue

There are several stats here which are never set, and have no way
to be displayed.  Assume in future xstats could be used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yong Wang <yongwang@vmware.com>
9 years agovmxnet3: remove mtu check
Stephen Hemminger [Thu, 9 Jul 2015 18:24:10 +0000 (11:24 -0700)]
vmxnet3: remove mtu check

Remove check for packets greater than MTU. No other driver does
this, it should be handled at higher layer

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yong Wang <yongwang@vmware.com>
9 years agovmxnet3: enable vlan filtering
Stephen Hemminger [Thu, 9 Jul 2015 18:24:09 +0000 (11:24 -0700)]
vmxnet3: enable vlan filtering

Support the VLAN filter functionality of the VMXNET3 interface.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yong Wang <yongwang@vmware.com>
9 years agoapp/test: decrease size of requested mempool
Olivier Matz [Thu, 9 Jul 2015 09:01:29 +0000 (11:01 +0200)]
app/test: decrease size of requested mempool

In test application, the default size of allocated mempool is calculated
as following:

  (RTE_MAX_LCORE * (RTE_MEMPOOL_CACHE_MAX_SIZE + max_kept_objects)) - 1

The objective is to ensure that all cores can fill their cache and keep
'max_kept_objects' at the same time. As RTE_MAX_LCORE is 128 and
RTE_MEMPOOL_CACHE_MAX_SIZE is 512 in the default configuration, it can
produce very large mempools (170 MB).

We can replace the number of core by a dynamic value, which drastically
reduces the amount of memory needed for this test (5 MB with 4 cores).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoexamples/ip_pipeline: rework flow classification pipeline
Maciej Gajdzica [Tue, 7 Jul 2015 08:09:35 +0000 (10:09 +0200)]
examples/ip_pipeline: rework flow classification pipeline

Flow classification pipeline implementation is split to two files.
pipeline_flow_classification.c file handles front-end functions (cli
commands parsing) pipeline_flow_classification_ops.c contains
implementation of functions done by pipeline (back-end).

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: rework routing pipeline
Maciej Gajdzica [Tue, 7 Jul 2015 08:09:34 +0000 (10:09 +0200)]
examples/ip_pipeline: rework routing pipeline

Routing pipeline implementation is split to two files.
pipeline_routing.c file handles front-end functions (cli commands
parsing) pipeline_routing_ops.c contains implementation of functions
done by pipeline (back-end).

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: rework firewall pipeline
Daniel Mrzyglod [Tue, 7 Jul 2015 08:09:33 +0000 (10:09 +0200)]
examples/ip_pipeline: rework firewall pipeline

Firewall pipeline implementation is split to two files.
pipeline_firewall.c file handles front-end functions (cli commands
parsing) pipeline_firewall_ops.c contains implementation of functions
done by pipeline (back-end).

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: rework passthrough pipeline
Jasvinder Singh [Tue, 7 Jul 2015 08:09:32 +0000 (10:09 +0200)]
examples/ip_pipeline: rework passthrough pipeline

Passthrough pipeline implementation is split to two files.
pipeline_passthrough.c file handles front-end functions (cli commands
parsing) pipeline_passthrough_ops.c contains implementation of functions
done by pipeline (back-end).

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: move config files to separate directory
Maciej Gajdzica [Tue, 7 Jul 2015 08:09:31 +0000 (10:09 +0200)]
examples/ip_pipeline: move config files to separate directory

Created new folder for config(.cfg) and script(.sh) files.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: add application thread
Maciej Gajdzica [Tue, 7 Jul 2015 08:09:30 +0000 (10:09 +0200)]
examples/ip_pipeline: add application thread

Application thread runs pipelines on assigned cores.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: add master pipeline
Jasvinder Singh [Tue, 7 Jul 2015 08:09:29 +0000 (10:09 +0200)]
examples/ip_pipeline: add master pipeline

Master pipeline is responsible for command line handling and
communicationg with all other pipelines via message queues. Removed
cmdline.c file, as its functionality will be split over multiple
pipeline files.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: move pipelines to separate directory
Maciej Gajdzica [Tue, 7 Jul 2015 08:09:28 +0000 (10:09 +0200)]
examples/ip_pipeline: move pipelines to separate directory

Moved pipelines to separate folder, removed not needed pipelines and
modified Makefile to match that change.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: rework initialization parameters
Maciej Gajdzica [Tue, 7 Jul 2015 08:09:27 +0000 (10:09 +0200)]
examples/ip_pipeline: rework initialization parameters

After changes in config parser, app params struct is changed and
requires modifications in initialization procedures.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: add config file checks
Jasvinder Singh [Tue, 7 Jul 2015 08:09:26 +0000 (10:09 +0200)]
examples/ip_pipeline: add config file checks

After loading configuration from a file, data integrity is checked.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/ip_pipeline: rework config file syntax
Pawel Wodkowski [Tue, 7 Jul 2015 08:09:25 +0000 (10:09 +0200)]
examples/ip_pipeline: rework config file syntax

New syntax of config files is needed for ip_pipeline example
enhancements. Some old files are temporarily disabled in the Makefile.
It is part of a bigger change.

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agopipeline: fix missing exported symbols
Maciej Gajdzica [Thu, 9 Jul 2015 08:17:10 +0000 (10:17 +0200)]
pipeline: fix missing exported symbols

Exported symbols for port in, port out and table stats.

Fixes: 6504bb5ec460 ("pipeline: add statistics for ports and tables")

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoport: fix missing exported symbols
Maciej Gajdzica [Thu, 9 Jul 2015 08:17:09 +0000 (10:17 +0200)]
port: fix missing exported symbols

Exported symbols for nodrop, fragmentation, reassembly ports

Fixes: 304c8091e90a ("port: add ethdev writer nodrop")
Fixes: 5f4cd47309d6 ("port: add ring writer nodrop")
Fixes: bf673b7553e1 ("port: add IPv6 fragmentation port")
Fixes: 50f54a84dfb7 ("port: add IPv6 reassembly port")

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoeal/linux: fix out of bound access in hugepage init
David Marchand [Thu, 9 Jul 2015 09:19:26 +0000 (11:19 +0200)]
eal/linux: fix out of bound access in hugepage init

Using IBM advance toolchain on Ubuntu 14.04 (package 8.0-3), gcc is complaining
about out of bound accesses.

  CC eal_hugepage_info.o
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:
In function ‘eal_hugepage_info_init’:
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:350:35:
error: array subscript is above array bounds [-Werror=array-bounds]
      internal_config.hugepage_info[j].hugepage_sz)
                                   ^
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:350:35:
error: array subscript is above array bounds [-Werror=array-bounds]
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:349:37:
error: array subscript is above array bounds [-Werror=array-bounds]
    if (internal_config.hugepage_info[j-1].hugepage_sz <
                                     ^
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:350:35:
error: array subscript is above array bounds [-Werror=array-bounds]
      internal_config.hugepage_info[j].hugepage_sz)

Looking at the code, these warnings are invalid from my pov and they disappeared
when upgrading the toolchain to new version (8.0-4).

However, the code was buggy (sorting code is wrong), so fix this by using qsort
and adding a check on num_sizes to avoid potential out of bound accesses.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agoeal/linux: fix indent of hugepage init
David Marchand [Thu, 9 Jul 2015 09:19:25 +0000 (11:19 +0200)]
eal/linux: fix indent of hugepage init

With this, we should be checkpatch compliant.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agoeal/linux: rework loop in hugepage init
David Marchand [Thu, 9 Jul 2015 09:19:24 +0000 (11:19 +0200)]
eal/linux: rework loop in hugepage init

Replace this while loop with a for loop and simplify error handling.
Indent is broken on purpose, fixed in next commit.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agoeal/linux: improve coding style of hugepage init
David Marchand [Thu, 9 Jul 2015 09:19:23 +0000 (11:19 +0200)]
eal/linux: improve coding style of hugepage init

Prepare for checkpatch compliance.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agoeal/linux: remove useless casts in hugepage init
David Marchand [Thu, 9 Jul 2015 09:19:22 +0000 (11:19 +0200)]
eal/linux: remove useless casts in hugepage init

Rather than cast the huge pages number returned by get_num_hugepages, rework
this function so that it returns 0 when something goes wrong.
And no need for casts in log.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agoeal/linux: remove useless process type check in hugepage init
David Marchand [Thu, 9 Jul 2015 09:19:21 +0000 (11:19 +0200)]
eal/linux: remove useless process type check in hugepage init

The code in eal_hugepage_info.c is not reachable by secondary processes.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agohash: fix build on non-x86 arch
Bruce Liu [Wed, 8 Jul 2015 15:15:47 +0000 (23:15 +0800)]
hash: fix build on non-x86 arch

In the no-x86 branch, a parentheses is missing.
And need to include <limits.h> header to use CHAR_BIT.

Fixes: 49361c3f3cfa ("hash: remove duplicated code")

Signed-off-by: Bruce Liu <2103458176@qq.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoapp/testpmd: show the hash key size
Helin Zhang [Fri, 12 Jun 2015 07:34:01 +0000 (15:34 +0800)]
app/testpmd: show the hash key size

As querying hash key size in byte was supported, it can be shown
in testpmd after getting the device information if not zero.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoethdev: add the hash key size per device
Helin Zhang [Fri, 12 Jun 2015 07:33:56 +0000 (15:33 +0800)]
ethdev: add the hash key size per device

To support querying hash key size per port, an new field of
'hash_key_size' was added in 'struct rte_eth_dev_info' for storing
hash key size in bytes.

The correct hash key size in bytes should be filled into the
'struct rte_eth_dev_info', to support querying it.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agomk: enable next abi preview
Thomas Monjalon [Thu, 2 Jul 2015 21:03:40 +0000 (23:03 +0200)]
mk: enable next abi preview

When a change makes really hard to keep ABI compatibility,
instead of waiting next release to break the ABI, it is smoother
to introduce the new code as a preview and disable it when packaging.
The flag RTE_NEXT_ABI must be used to "ifdef" the new code.
When the release is out, a dynamically linked application can use
the new shared libraries with the old ABI while developpers can prepare
their application for the next ABI by reading the deprecation notice
and easily testing the new code.
When starting the next release cycle, the "ifdefs" will be removed
and the ABI break will be marked by incrementing LIBABIVER. The map
files will also be updated.

The default value is enabled to be developer compliant.
The packagers must disable it as done in pkg/dpdk.spec.
When enabled, all shared library numbers are incremented by appending
a minor .1 to the old ABI number. In the next release, only impacted
libraries will have a major +1 increment.
The impacted libraries must provide an alternative map file to use
with this option.

The ABI policy is updated.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agomk: remove variables identical to config ones
Thomas Monjalon [Wed, 8 Jul 2015 10:34:26 +0000 (12:34 +0200)]
mk: remove variables identical to config ones

CONFIG_RTE_BUILD_SHARED_LIB and CONFIG_RTE_BUILD_COMBINE_LIBS does not
have quotes in their values (only y or n). That's why the variables
RTE_BUILD_SHARED_LIB and RTE_BUILD_COMBINE_LIBS are always identical to
their CONFIG_ counterpart, and are useless.
In order to have consistent naming of config options in the makefiles,
these options are removed and the "CONFIG_ prefixed" variables are used.

Fixes: e25e4d7ef16b ("mk: shared libraries")
Fixes: 4d3d79e7a5c6 ("mk: combined library")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agonic_uio: probe and attach devices after unload
Raz Amir [Thu, 5 Mar 2015 16:24:23 +0000 (18:24 +0200)]
nic_uio: probe and attach devices after unload

Added code that saves the pointers to the detached devices, during
driver loading, and during driver unloading, go over the list,
and re-attach them by calling device_probe_and_attach
on each device.

Signed-off-by: Raz Amir <razamir22@gmail.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoeal: enable port hotplug as default for linux and bsd
Tetsuya Mukawa [Tue, 30 Jun 2015 08:26:51 +0000 (17:26 +0900)]
eal: enable port hotplug as default for linux and bsd

This patch removes CONFIG_RTE_LIBRTE_EAL_HOTPLUG option, and enables it
as default in both Linux and BSD.
Also, to support port hotplug, rte_eal_pci_scan() and below missing
symbols should be exported to ethdev library.
 - rte_eal_parse_devargs_str()
 - rte_eal_pci_close_one()
 - rte_eal_pci_probe_one()
 - rte_eal_pci_scan()
 - rte_eal_vdev_init()
 - rte_eal_vdev_uninit()

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agopci: merge probing and closing functions for linux and bsd
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:53 +0000 (19:34 +0900)]
pci: merge probing and closing functions for linux and bsd

This patch consolidates below functions, and implements these in common
eal code.
 - rte_eal_pci_probe_one_driver()
 - rte_eal_pci_close_one_driver()

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: merge mapping functions for linux and bsd
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:52 +0000 (19:34 +0900)]
pci: merge mapping functions for linux and bsd

The patch consolidates below functions, and implemented in common
eal code.
 - pci_map_device()
 - pci_unmap_device()

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: merge uio functions for linux and bsd
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:51 +0000 (19:34 +0900)]
pci: merge uio functions for linux and bsd

The patch consolidates below functions, and implement these
in eal_common_pci_uio.c.
 - pci_uio_map_secondary()
 - pci_uio_map_resource()
 - pci_uio_unmap()
 - pci_uio_find_resource()
 - pci_uio_unmap_resource()

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: merge resource mapping functions for linux and bsd
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:50 +0000 (19:34 +0900)]
pci: merge resource mapping functions for linux and bsd

The patch consolidates below functions, and implemented in common
eal code.
 - pci_map_resource()
 - pci_unmap_resource()

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: merge mapping structures for linux and bsd
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:49 +0000 (19:34 +0900)]
pci: merge mapping structures for linux and bsd

This patch consolidates below structures, and defines them in common code.
 - struct pci_map
 - struct mapped_pci_resources

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: introduce function to map uio resource by index
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:48 +0000 (19:34 +0900)]
pci: introduce function to map uio resource by index

This patch adds a new function called pci_uio_map_resource_by_index().
The function hides how to map uio resource in linuxapp and bsdapp.
With the function, pci_uio_map_resource() will be more abstracted.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: introduce functions to alloc and free uio resource
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:47 +0000 (19:34 +0900)]
pci: introduce functions to alloc and free uio resource

This patch adds new functions called pci_uio_alloc_resource() and
pci_uio_free_resource().
The functions hides how to prepare or free uio resource in linuxapp
and bsdapp. With the function, pci_uio_map_resource() will be more
abstracted.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: fix uio mapping differences between linux and bsd
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:46 +0000 (19:34 +0900)]
pci: fix uio mapping differences between linux and bsd

This patch fixes below.
- bsdapp
 - Use map_id in pci_uio_map_resource().
 - Fix interface of pci_map_resource().
 - Move path variable of mapped_pci_resource structure to pci_map.
- linuxapp
 - Remove redundant error message of linuxapp.

'pci_uio_map_resource()' is implemented in both linuxapp and bsdapp,
but interface is different. The patch fixes the function of bsdapp
to do same as linuxapp. After applying it, file descriptor should be
opened and closed out of pci_map_resource().

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci/bsd: rename structures
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:45 +0000 (19:34 +0900)]
pci/bsd: rename structures

To merge pci code of linuxapp and bsdapp, this patch changes names
like below.
 - uio_map to pci_map
 - uio_resource to mapped_pci_resource
 - uio_res_list to mapped_pci_res_list

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: fix memory leaks and needless increment of map address
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:44 +0000 (19:34 +0900)]
pci: fix memory leaks and needless increment of map address

This patch fixes following memory leaks.
- When open() is failed, uio_res and fds won't be freed in
  pci_uio_map_resource().
- When pci_map_resource() is failed but path is allocated correctly,
  path and fds won't be freed in pci_uio_map_recource().
  Also, some mapped resources should be freed.
- When pci_uio_unmap() is called, path should be freed.

Also, fixes below.
- When pci_map_resource() is failed, mapaddr will be MAP_FAILED.
  In this case, pci_map_addr should not be incremented in
  pci_uio_map_resource().
- To shrink code, move close().
- Remove fail variable.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: close file descriptor of uio configuration
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:43 +0000 (19:34 +0900)]
pci: close file descriptor of uio configuration

When pci_uio_unmap_resource() is called, a file descriptor that is used
for uio configuration should be closed.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agopci: fix coding style
Tetsuya Mukawa [Wed, 8 Jul 2015 10:34:42 +0000 (19:34 +0900)]
pci: fix coding style

This patch fixes coding style of below files in linuxapp and bsdapp.
 - eal_pci.c
 - eal_pci_uio.c

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agoeal: add const in prefetch functions
Pablo de Lara [Wed, 8 Jul 2015 09:51:33 +0000 (10:51 +0100)]
eal: add const in prefetch functions

rte_prefetchX functions included volatile void *p as parameter,
but the function does not modify it,
so it should include the const keyword.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoi40e: fix build with gcc 4.4
Jingjing Wu [Wed, 8 Jul 2015 06:37:19 +0000 (14:37 +0800)]
i40e: fix build with gcc 4.4

Fix the build warning reported like:
   error: dereferencing pointer 'cmd' does break strict-aliasing rules

Fixes: a4def5edf0fc ("i40e: enable port mirroring")

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoapp/testpmd: add flow director for L2 payload
Jingjing Wu [Tue, 16 Jun 2015 03:43:46 +0000 (11:43 +0800)]
app/testpmd: add flow director for L2 payload

This patch extends flow director commands to support l2_payload flow type.

Test report: http://dpdk.org/ml/archives/dev/2015-June/020238.html

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoi40e: add flow director for L2 payload
Jingjing Wu [Tue, 16 Jun 2015 03:43:45 +0000 (11:43 +0800)]
i40e: add flow director for L2 payload

This patch extends flow director to support l2_payload flow
type in i40e driver.

Test report: http://dpdk.org/ml/archives/dev/2015-June/020238.html

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoethdev: add flow director for L2 payload
Jingjing Wu [Tue, 16 Jun 2015 03:43:44 +0000 (11:43 +0800)]
ethdev: add flow director for L2 payload

This patch adds a new struct rte_eth_l2_flow to support
l2_payload flow type.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoi40e: enable port mirroring
Jingjing Wu [Wed, 10 Jun 2015 06:24:32 +0000 (14:24 +0800)]
i40e: enable port mirroring

enable mirror functionality in i40e driver
.mirror_rule_set
.mirror_rule_reset

Test report: http://dpdk.org/ml/archives/dev/2015-June/019118.html

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoethdev: rename and extend the mirror type
Jingjing Wu [Wed, 10 Jun 2015 06:24:31 +0000 (14:24 +0800)]
ethdev: rename and extend the mirror type

This path renames the mirror type in rte_eth_mirror_conf and macros,
and rework the mirror set in ixgbe drivers by using new definition.
It also fixes some coding style.

Test report: http://dpdk.org/ml/archives/dev/2015-June/019118.html

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoethdev: rename port mirroring structure
Jingjing Wu [Wed, 10 Jun 2015 06:24:30 +0000 (14:24 +0800)]
ethdev: rename port mirroring structure

Rename rte_eth_vmdq_mirror_conf to rte_eth_mirror_conf and move
the maximum rule id check from ethdev level to driver.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoexamples/ipv4_multicast: support double vlan stripping and insertion
Helin Zhang [Thu, 11 Jun 2015 07:03:59 +0000 (15:03 +0800)]
examples/ipv4_multicast: support double vlan stripping and insertion

The outer vlan should be copied from source packet buffer to
support double vlan stripping and insertion, as double vlan can be
stripped or inserted by some of NIC hardware.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
9 years agoapp/testpmd: add qinq stripping and insertion
Helin Zhang [Thu, 11 Jun 2015 07:03:58 +0000 (15:03 +0800)]
app/testpmd: add qinq stripping and insertion

If double vlan is detected, its stripped flag and vlan tags can be
printed on rxonly mode. Test command of 'tx_vlan set' is expanded
to set both single and double vlan tags on TX side for each packets
to be sent out.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
9 years agoi40evf: fix offload capability flags
Helin Zhang [Thu, 11 Jun 2015 07:03:57 +0000 (15:03 +0800)]
i40evf: fix offload capability flags

Add checksum offload capability flags which have already been
supported for a long time.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
9 years agoi40e: support double vlan stripping and insertion
Helin Zhang [Thu, 11 Jun 2015 07:03:56 +0000 (15:03 +0800)]
i40e: support double vlan stripping and insertion

It configures specific registers to enable double vlan stripping
on RX side and insertion on TX side.
The RX descriptors will be parsed, the vlan tags and flags will be
saved to corresponding mbuf fields if vlan tag is detected.
The TX descriptors will be configured according to the
configurations in mbufs, to trigger the hardware insertion of
double vlan tags for each packets sent out.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
9 years agombuf: use reserved space for double vlan
Helin Zhang [Thu, 11 Jun 2015 07:03:55 +0000 (15:03 +0800)]
mbuf: use reserved space for double vlan

Use the reserved 16 bits in rte_mbuf structure for the outer vlan,
also add QinQ offloading flags for both RX and TX sides.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
9 years agoixgbe: remove a discarded source line
Helin Zhang [Thu, 11 Jun 2015 07:03:54 +0000 (15:03 +0800)]
ixgbe: remove a discarded source line

Little endian to CPU order conversion had been added for reading
vlan tag from RX descriptor, while its original source line was
forgotten to delete. That's a discarded source line and should be
deleted.

Fixes: 23fcffe8ffac ("ixgbe: fix id and hash with flow director")

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
9 years agoethdev: fix check of threshold for Tx freeing
Zoltan Kiss [Tue, 23 Jun 2015 18:43:12 +0000 (19:43 +0100)]
ethdev: fix check of threshold for Tx freeing

The parameter tx_free_thresh is not consistent between the drivers:
some use it as rte_eth_tx_burst() requires, some release buffers when
the number of free descriptors drop below this value.
Let's use it as most fast-path code does, which is the latter, and update
comments throughout the code to reflect that.

Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoixgbe: check mbuf refcnt when clearing a ring
Bruce Richardson [Fri, 3 Jul 2015 15:40:06 +0000 (16:40 +0100)]
ixgbe: check mbuf refcnt when clearing a ring

The function to clear the TX ring when a port was being closed, e.g. on
exit in testpmd, was not checking the mbuf refcnt before freeing it.
Since the function in the vector driver to clear the ring after TX does
not set the pointer to NULL post-free, this caused crashes if mbuf
debugging was turned on.

To reproduce the issue, ensure the follow config variables are set:
RTE_IXGBE_INC_VECTOR
RTE_LIBRTE_MBUF_DEBUG
Then compile up and run testpmd using 10G ports with the vector driver.
Start traffic and let some flow through, then type "stop" and "quit" at
the testpmd prompt, and crash will occur. Output below:

testpmd> quit
Stopping port 0...done
Stopping port 1...PANIC in rte_mbuf_sanity_check():
bad ref cnt
[New Thread 0x7fffabfff700 (LWP 145312)]
[New Thread 0x7fffb47fe700 (LWP 145311)]
[New Thread 0x7fffb4fff700 (LWP 145310)]
[New Thread 0x7ffff6cd5700 (LWP 145309)]
18: [/home/bruce/dpdk.org/x86_64-native-linuxapp-gcc/app/testpmd(_start+0x29)
<....snip for brevity...>
Program received signal SIGABRT, Aborted.
0x00007ffff7120a98 in raise () from /lib64/libc.so.6

A similar error occurs when clearing the RX ring, which is also fixed by
this patch.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoixgbe: use cold attribute
Bruce Richardson [Fri, 3 Jul 2015 15:40:05 +0000 (16:40 +0100)]
ixgbe: use cold attribute

As well as the fast-path functions in the rxtx code, there are also
functions which set up and tear down the descriptor rings. Since these
are not performance critical functions, there is no need to have them
extensively optimized, so we add __attribute__((cold)) to their
definitions. This has the side-effect of making debugging them easier as
the compiler does not optimize them as heavily, so more variables are
accessible by default in gdb.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agodoc: fix sphinx build warning
John McNamara [Thu, 2 Jul 2015 14:15:22 +0000 (15:15 +0100)]
doc: fix sphinx build warning

Fix for a minor Sphinx build warning in the ABI guidelines docs:

    versioning.rst:126: WARNING: Bullet list ends without a
                        blank line; unexpected unindent.

Signed-off-by: John McNamara <john.mcnamara@intel.com>
9 years agomk: print target when reporting build complete
Bruce Richardson [Thu, 2 Jul 2015 10:35:37 +0000 (11:35 +0100)]
mk: print target when reporting build complete

When a target is finished building, it reports just "Build complete".
When building multiple targets simultaneously, e.g.
make install T=x86_64-native-linuxapp-*
and one target fails, it's not always obvious which of the builds
failed. To help this, we add the actual target that is completed to the
"Build complete" message.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoethdev: introduce valid port helper
Stephen Hemminger [Sat, 27 Jun 2015 00:01:45 +0000 (17:01 -0700)]
ethdev: introduce valid port helper

The code pattern is repeated so many times, it is a good
idea to introduce template like other code here uses.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: fix code style
Stephen Hemminger [Sat, 27 Jun 2015 00:01:44 +0000 (17:01 -0700)]
ethdev: fix code style

This fixes lots of complaints from checkpatch about whitespace
and other non-material things. Important to fix the old code now
befor more code does copy/paste of same junk.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
9 years agoethdev: fix comment spelling
Stephen Hemminger [Sat, 27 Jun 2015 00:01:43 +0000 (17:01 -0700)]
ethdev: fix comment spelling

Fix trivial spelling errors.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: remove impossible condition
Stephen Hemminger [Sat, 27 Jun 2015 00:01:42 +0000 (17:01 -0700)]
ethdev: remove impossible condition

Since rte_eth_devices is in BSS, the address of rte_eth_devices
plus port_id can not ever be NULL for a valid port_id number.
Remove this unnecessary check and fix the code style.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomaintainers: claim EAL of IBM POWER
Chao Zhu [Mon, 29 Jun 2015 03:08:00 +0000 (11:08 +0800)]
maintainers: claim EAL of IBM POWER

Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agocfgfile: fix unitialised buffer
Daniel Mrzyglod [Mon, 29 Jun 2015 15:06:03 +0000 (17:06 +0200)]
cfgfile: fix unitialised buffer

Nature of the problem was not initialised buffer[256], there were probability
that operation system will provide previously used memory and on special condition
there were probability that string operations will work on random data that
could provide unexpected program behaviour.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agohash: add unit test for thash
Vladimir Medvedkin [Tue, 30 Jun 2015 23:41:13 +0000 (19:41 -0400)]
hash: add unit test for thash

Add unit test for thash library

Signed-off-by: Vladimir Medvedkin <medvedkinv@gmail.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agohash: add toeplitz algorithm used by RSS
Vladimir Medvedkin [Tue, 30 Jun 2015 23:40:20 +0000 (19:40 -0400)]
hash: add toeplitz algorithm used by RSS

Software implementation of the Toeplitz hash function used by RSS.
Can be used either for packet distribution on single queue NIC
or for simulating of RSS computation on specific NIC (for example
after GRE header decapsulating).

Signed-off-by: Vladimir Medvedkin <medvedkinv@gmail.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agohash: add missing symbol in version map
Pablo de Lara [Tue, 30 Jun 2015 18:37:11 +0000 (19:37 +0100)]
hash: add missing symbol in version map

rte_hash_hash is a public function but was not in
rte_hash_version.map

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agocxgbe: fix build with icc
Bruce Richardson [Wed, 1 Jul 2015 15:11:37 +0000 (16:11 +0100)]
cxgbe: fix build with icc

When compiling the cxgbe driver with icc, multiple errors about using
enums as integers appear across a number of files, including in the base
code and in the DPDK-specific driver code.

.../drivers/net/cxgbe/cxgbe_main.c(386): error #188: enumerated type mixed
with another type
                        t4_get_port_type_description(pi->port_type));
                                                     ^
For the errors in the base driver code we use the CFLAGS_BASE_DRIVER
approach used by other drivers to disable warnings.

For errors in the DPDK-specific code, typecasts are used to fix the
errors in the code itself.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agofm10k: support Xen domain0
Shaopeng He [Fri, 15 May 2015 08:56:02 +0000 (16:56 +0800)]
fm10k: support Xen domain0

fm10k was failing to run in XEN domain0, as the physical
memory for DMA should be allocated and translated
in a different way for XEN domain0. So
rte_memzone_reserve_bounded() should be used for DMA
memory allocation, and rte_mem_phy2mch() should be used
for DMA memory address translation to support running
fm10k PMD in XEN domain0.

Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
9 years agomlx4: update documentation for MOFED 3.0
Adrien Mazarguil [Tue, 30 Jun 2015 09:28:09 +0000 (11:28 +0200)]
mlx4: update documentation for MOFED 3.0

- Add RX/TX L3/L4 checksum offloading and validation.
- Update kernel module parameters section.
- Update prerequisites for MOFED and firmware versions.
- Remove optimized external libraries section. MOFED now provides enhanced
  support directly without having to install modified libraries.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: disable multicast echo on PF device
Olga Shern [Tue, 30 Jun 2015 09:28:08 +0000 (11:28 +0200)]
mlx4: disable multicast echo on PF device

Multicast loopback must be disabled on PF devices to prevent the adapter
from sending frames back. Required with MOFED 3.0.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: add resource domain support for better performance
Alex Rosenbaum [Tue, 30 Jun 2015 09:28:07 +0000 (11:28 +0200)]
mlx4: add resource domain support for better performance

RDs are a new feature of MOFED 3.0 that makes Verbs aware of how CQ and QP
resources are being used for internal performance tuning.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: add VXLAN checksum offload
Adrien Mazarguil [Tue, 30 Jun 2015 09:28:06 +0000 (11:28 +0200)]
mlx4: add VXLAN checksum offload

Depending on adapters features and VXLAN support in the kernel, VXLAN frames
can be automatically recognized, in which case checksum validation and
generation occurs on inner and outer L3 and L4.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: add L3/L4 checksum offload
Gilad Berman [Tue, 30 Jun 2015 09:28:05 +0000 (11:28 +0200)]
mlx4: add L3/L4 checksum offload

Mellanox ConnectX-3 adapters can handle L3 (IPv4) and L4 (TCP, UDP, TCP6,
UDP6) RX checksums validation and TX checksums generation, with and without
802.1Q (VLAN) headers.

Signed-off-by: Gilad Berman <giladb@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: prefetch completed Tx mbufs before releasing them
Alex Rosenbaum [Tue, 30 Jun 2015 09:28:04 +0000 (11:28 +0200)]
mlx4: prefetch completed Tx mbufs before releasing them

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: shrink Tx queue elements for better performance
Alex Rosenbaum [Tue, 30 Jun 2015 09:28:03 +0000 (11:28 +0200)]
mlx4: shrink Tx queue elements for better performance

TX queue elements (struct txq_elt) contain WR and SGE structures required by
ibv_post_send(). This commit replaces them with a single pointer to the
related TX mbuf considering that:

- There is no need to keep these structures around forever since the
  hardware doesn't access them after ibv_post_send() and send_pending*()
  have returned.

- The TX queue index stored in the WR ID field is not used for completions
  anymore since they use a separate counter (elts_comp_cd).

- The WR structure itself was only useful for ibv_post_send(), it is
  currently only used to store the mbuf data address and an offset to the
  mbuf structure in the WR ID field. send_pending*() callbacks only require
  SGEs or buffer pointers.

Therefore for single segment mbufs, send_pending() or send_pending_inline()
can be used directly without involving SGEs. For scattered mbufs, SGEs are
allocated on the stack and passed to send_pending_sg_list().

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: move scattered Tx processing to helper function
Adrien Mazarguil [Tue, 30 Jun 2015 09:28:02 +0000 (11:28 +0200)]
mlx4: move scattered Tx processing to helper function

This commit makes scattered TX support entirely optional by moving it to a
separate function that is only available when MLX4_PMD_SGE_WR_N > 1.

Improves performance when scattered support is not needed.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: use MOFED 3.0 fast verbs interface for Tx operations
Adrien Mazarguil [Tue, 30 Jun 2015 09:28:01 +0000 (11:28 +0200)]
mlx4: use MOFED 3.0 fast verbs interface for Tx operations

The "raw" post send interface was experimental and has been deprecated. This
commit replaces it with a new low level interface that dissociates post and
flush (doorbell) operations for improved QP performance.

The CQ polling function is updated as well.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: avoid requesting Tx completion events to improve performance
Alex Rosenbaum [Tue, 30 Jun 2015 09:28:00 +0000 (11:28 +0200)]
mlx4: avoid requesting Tx completion events to improve performance

Instead of requesting a completion event for each TX burst, request it on a
fixed schedule once every MLX4_PMD_TX_PER_COMP_REQ (currently 64) packets to
improve performance.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: use MOFED 3.0 fast verbs interface for Rx operations
Alex Rosenbaum [Tue, 30 Jun 2015 09:27:59 +0000 (11:27 +0200)]
mlx4: use MOFED 3.0 fast verbs interface for Rx operations

This commit replaces the CQ polling and QP posting functions
(mlx4_rx_burst() only) with a new low level interface to improve
performance.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Gilad Berman <giladb@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: query netdevice to get initial MAC address
Or Ami [Tue, 30 Jun 2015 09:27:58 +0000 (11:27 +0200)]
mlx4: query netdevice to get initial MAC address

Querying the netdevice instead of deriving the port's MAC address from its
GID is less prone to errors. There is no guarantee that the GID will always
contain it nor that the algorithm won't change.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: fix support for multiple vlan filters
Olga Shern [Tue, 30 Jun 2015 09:27:57 +0000 (11:27 +0200)]
mlx4: fix support for multiple vlan filters

This commit fixes the "Multiple RX VLAN filters can be configured, but only
the first one works" bug. Since a single flow specification cannot contain
several VLAN definitions, the flows table is extended with MLX4_MAX_VLAN_IDS
possible specifications per configured MAC address.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: remove provision for flow creation failure in DMFS A0 mode
Or Ami [Tue, 30 Jun 2015 09:27:56 +0000 (11:27 +0200)]
mlx4: remove provision for flow creation failure in DMFS A0 mode

Starting from MLNX_OFED 3.0 FW 2.34.5000 when working with optimized
steering mode (-7) QPs can be attached to the port's MAC, therefore no need
for the check.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: fix error message for invalid number of descriptors
Or Ami [Tue, 30 Jun 2015 09:27:55 +0000 (11:27 +0200)]
mlx4: fix error message for invalid number of descriptors

The number of descriptors must be a multiple of MLX4_PMD_SGE_WR_N.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: use MOFED 3.0 extended flow steering API
Alex Rosenbaum [Tue, 30 Jun 2015 09:27:54 +0000 (11:27 +0200)]
mlx4: use MOFED 3.0 extended flow steering API

This commit drops "exp" from related function and type names to stop using
the experimental API.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: improve accuracy of link status information
Olga Shern [Tue, 30 Jun 2015 09:27:53 +0000 (11:27 +0200)]
mlx4: improve accuracy of link status information

Query interface properties using the ethtool API instead of Verbs
through ibv_query_port(). The returned information is more accurate for
Ethernet links since several link speeds cannot be mapped to Verbs
semantics.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: allow application to partially fork
Olga Shern [Tue, 30 Jun 2015 09:27:52 +0000 (11:27 +0200)]
mlx4: allow application to partially fork

Although using the PMD from a forked process is still unsupported, this
commit makes Verbs safe enough for applications to call fork() for other
purposes.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: merge Rx queue setup functions
Alex Rosenbaum [Tue, 30 Jun 2015 09:27:51 +0000 (11:27 +0200)]
mlx4: merge Rx queue setup functions

Make rxq_setup_qp() handle inline support like rxq_setup_qp_rss() instead of
having two separate functions.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: avoid looking up work request id to improve Rx performance
Alex Rosenbaum [Tue, 30 Jun 2015 09:27:50 +0000 (11:27 +0200)]
mlx4: avoid looking up work request id to improve Rx performance

This is done by storing the current index in the RX queue structure.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: make sure experimental device query is implemented
Olga Shern [Tue, 30 Jun 2015 09:27:49 +0000 (11:27 +0200)]
mlx4: make sure experimental device query is implemented

HAVE_EXP_QUERY_DEVICE is used to check whether ibv_exp_query_device() can be
used. RSS and inline receive features depend on it.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: add MOFED 3.0 compatibility to interface name retrieval
Adrien Mazarguil [Tue, 30 Jun 2015 09:27:48 +0000 (11:27 +0200)]
mlx4: add MOFED 3.0 compatibility to interface name retrieval

Since Mellanox OFED 3.0 and Linux 3.15, interface port numbers are stored
in dev_port instead of dev_id sysfs files.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Nitzan Weller <nitzanwe@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>