dpdk.git
8 years agoapp/testpmd: fix port detaching with virtio
Bernard Iremonger [Wed, 15 Jul 2015 13:51:05 +0000 (14:51 +0100)]
app/testpmd: fix port detaching with virtio

At this point the stop() and close() functions have already been called.
The rte_eth_promiscuous_disable() function does not return on the VM.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
8 years agovirtio: free queue memory when closing
Bernard Iremonger [Wed, 15 Jul 2015 13:51:03 +0000 (14:51 +0100)]
virtio: free queue memory when closing

Add function virtio_free_queues() and call from virtio_dev_close()
Use virtio_dev_rx_queue_release() and virtio_dev_tx_queue_release()

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
8 years agovirtio: add queue release
Bernard Iremonger [Wed, 15 Jul 2015 13:51:02 +0000 (14:51 +0100)]
virtio: add queue release

Add functions virtio_dev_queue_release(), virtio_dev_rx_queue_release() and
virtio_dev_tx_queue_release().

Use queue_release in virtio_dev_uninit().

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
8 years agovirtio: check virtqueue parameter when detaching
Bernard Iremonger [Wed, 15 Jul 2015 13:51:01 +0000 (14:51 +0100)]
virtio: check virtqueue parameter when detaching

If vq is NULL, there is a segmentation fault.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
8 years agovirtio: support port hotplug
Bernard Iremonger [Wed, 15 Jul 2015 13:51:00 +0000 (14:51 +0100)]
virtio: support port hotplug

This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit_t() function for virtio pmd.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
8 years agofm10k: support port hotplug
Michael Qiu [Tue, 14 Jul 2015 12:45:45 +0000 (20:45 +0800)]
fm10k: support port hotplug

Add hotplug support for fm10k.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
8 years agofm10k: free queue memory when closing
Michael Qiu [Tue, 14 Jul 2015 12:45:44 +0000 (20:45 +0800)]
fm10k: free queue memory when closing

When close a port, lots of memory should be released,
such as software rings, queues, etc.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
8 years agoi40e: free queue memory when closing
Bernard Iremonger [Fri, 3 Jul 2015 14:04:00 +0000 (15:04 +0100)]
i40e: free queue memory when closing

Add i40e_dev_free_queues() function and call it from close() functions.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoi40e: check Rx queue parameter when resetting
Bernard Iremonger [Fri, 3 Jul 2015 14:03:59 +0000 (15:03 +0100)]
i40e: check Rx queue parameter when resetting

There is a segmentation fault if rxq is NULL.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoi40evf: clear queues when stopping
Bernard Iremonger [Fri, 3 Jul 2015 14:03:58 +0000 (15:03 +0100)]
i40evf: clear queues when stopping

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoi40evf: clear command when error occurs
Bernard Iremonger [Fri, 3 Jul 2015 14:03:57 +0000 (15:03 +0100)]
i40evf: clear command when error occurs

_clear_cmd() was not being called in failure situations,
resulting in the next command also failing.
Fix several typos.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoi40evf: increase messaging wait time
Bernard Iremonger [Fri, 3 Jul 2015 14:03:56 +0000 (15:03 +0100)]
i40evf: increase messaging wait time

Increase delay from 50 * 10 to 100 * 20 to avoid i40evf_read_pfmsg() failures.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoi40e: free vmdq vsi when closing
Bernard Iremonger [Fri, 3 Jul 2015 14:03:55 +0000 (15:03 +0100)]
i40e: free vmdq vsi when closing

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoi40e: support port hotplug
Bernard Iremonger [Fri, 3 Jul 2015 14:03:54 +0000 (15:03 +0100)]
i40e: support port hotplug

This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_i40e_pmd and
rte_i40evf_pmd.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoixgbe: free queue memory when closing
Bernard Iremonger [Thu, 2 Jul 2015 14:36:51 +0000 (15:36 +0100)]
ixgbe: free queue memory when closing

Add ixgbe_dev_free_queues() function and call it from close() functions.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoixgbe: support port hotplug
Bernard Iremonger [Thu, 2 Jul 2015 14:36:49 +0000 (15:36 +0100)]
ixgbe: support port hotplug

This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
rte_ixgbevf_pmd.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoe1000: free queue memory when closing
Bernard Iremonger [Fri, 3 Jul 2015 14:38:27 +0000 (15:38 +0100)]
e1000: free queue memory when closing

Queues were freed in clear function called in stop function.
Split clearing and freeing in separate functions to
move queue freeing from stop to close function.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoe1000: support port hotplug
Bernard Iremonger [Fri, 3 Jul 2015 14:38:26 +0000 (15:38 +0100)]
e1000: support port hotplug

This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_em_pmd,
rte_igb_pmd and rte_igbvf_pmd.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoethdev: free queue array when closing
Bernard Iremonger [Mon, 13 Jul 2015 13:04:05 +0000 (14:04 +0100)]
ethdev: free queue array when closing

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
8 years agoethdev: fix doxygen internal comments
Thomas Monjalon [Sat, 18 Jul 2015 18:04:13 +0000 (20:04 +0200)]
ethdev: fix doxygen internal comments

The internal functions must be marked with the doxygen command @internal.

The allocate and release_port functions are not restricted only to dummy
drivers.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoethdev: refactor port release
Thomas Monjalon [Sat, 18 Jul 2015 17:46:20 +0000 (19:46 +0200)]
ethdev: refactor port release

Use DEV_DETACHED constant and deduplicate code in init.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agopci: fix detach and uninit naming
Thomas Monjalon [Sat, 18 Jul 2015 18:35:57 +0000 (20:35 +0200)]
pci: fix detach and uninit naming

There are close and detach functions in ethdev.
To keep a consistent naming, PCI functions called by ethdev detach
must be named "detach" instead of "close".
Fix also comments which mix close and uninit names.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agodoc: rename ABI chapter to deprecation
Thomas Monjalon [Sat, 18 Jul 2015 19:08:58 +0000 (21:08 +0200)]
doc: rename ABI chapter to deprecation

This chapter is for ABI and API. That's why a renaming is required.

Remove also the examples which are now in the referenced guidelines.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agohash: fix build for non-x86 arch
Pablo de Lara [Fri, 17 Jul 2015 09:17:58 +0000 (10:17 +0100)]
hash: fix build for non-x86 arch

Hash library uses optimized compare functions that use
x86 intrinsics, therefore non-x86 systems could not build
the library. In that case, the compare function is set
to the generic memcmp.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Reported-by: Zhigang Lu <zlu@ezchip.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Zhigang Lu <zlu@ezchip.com>
8 years agoexamples/vhost: fix driver unregistering
Ouyang Changchun [Mon, 6 Jul 2015 02:26:53 +0000 (10:26 +0800)]
examples/vhost: fix driver unregistering

The following commit broke vhost sample when it runs in second time:
292959c71961acde0cda6e77e737bb0a4df1559c

It should call api to unregister vhost driver when sample exit/quit, then
the socket file will be removed(by calling unlink), and thus make vhost sample
work correctly in the second time startup.

Test report: http://dpdk.org/ml/archives/dev/2015-July/020896.html

Fixes: 292959c71961 ("vhost: cleanup unix socket")

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
8 years agoexamples/vhost: fix comment and log
Ouyang Changchun [Mon, 6 Jul 2015 02:26:52 +0000 (10:26 +0800)]
examples/vhost: fix comment and log

It fixes the wrong log info when failing to unregister vhost driver.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
8 years agovhost: add log on socket bind failure
Ouyang Changchun [Mon, 6 Jul 2015 02:26:51 +0000 (10:26 +0800)]
vhost: add log on socket bind failure

It adds more readable log info if a socket fails to bind to
local socket file name.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
8 years agoapp: replace dump_cfg by proc_info
Maryam Tahhan [Wed, 15 Jul 2015 13:11:32 +0000 (14:11 +0100)]
app: replace dump_cfg by proc_info

proc_info displays statistics information including extended stats for
given DPDK ports and dumps the memory information for DPDK.

Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoixgbe: account more Rx errors
Maryam Tahhan [Wed, 15 Jul 2015 13:11:31 +0000 (14:11 +0100)]
ixgbe: account more Rx errors

ierrors only included a base set of error statistics, this patch adds
additional error registers to ierrors.

Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoixgbe: add specific stats
Maryam Tahhan [Wed, 15 Jul 2015 13:11:30 +0000 (14:11 +0100)]
ixgbe: add specific stats

Add the NIC/HW specific stats that were removed from rte_ethdev.c to
the extended stats in ixgbe.

Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoethdev: remove driver specific stats
Maryam Tahhan [Wed, 15 Jul 2015 13:11:29 +0000 (14:11 +0100)]
ethdev: remove driver specific stats

Remove non generic stats in rte_stats_strings and mark the relevant
fields in struct rte_eth_stats as deprecated.

Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoethdev: expose generic and driver specific stats in xstats
Maryam Tahhan [Wed, 15 Jul 2015 13:11:28 +0000 (14:11 +0100)]
ethdev: expose generic and driver specific stats in xstats

Extend rte_eth_xstats_get to retrieve additional stats from the device
driver as well the ethdev generic stats.

Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoixgbe: add xstats
Maryam Tahhan [Wed, 15 Jul 2015 13:11:27 +0000 (14:11 +0100)]
ixgbe: add xstats

Implement ixgbe_dev_xstats_reset and ixgbe_dev_xstats_get.

Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoixgbe: refactor stats register reads
Maryam Tahhan [Wed, 15 Jul 2015 13:11:26 +0000 (14:11 +0100)]
ixgbe: refactor stats register reads

Move stats register reads to ixgbe_read_stats_registers() as it will be
used by the functions to retrieve stats and extended stats.

Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agosched: hide structure of port hierarchy
Stephen Hemminger [Thu, 16 Jul 2015 21:34:35 +0000 (14:34 -0700)]
sched: hide structure of port hierarchy

Right now the scheduler hierarchy is encoded as a bitfield
that is visible as part of the ABI. This creates an barrier
limiting future expansion of the hierarchy.

As a transistional step. hide the actual layout of the hierarchy
and mark the exposed structure as deprecated. This will allow for
expansion in later release.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agosched: fix level of log messages
Stephen Hemminger [Thu, 16 Jul 2015 21:34:34 +0000 (14:34 -0700)]
sched: fix level of log messages

The setup messages should be at DEBUG level since they are not
important for normal operation of system. The messages about
problems should be at NOTICE or ERR level.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agosched: remove tabs from log messages
Stephen Hemminger [Thu, 16 Jul 2015 21:34:33 +0000 (14:34 -0700)]
sched: remove tabs from log messages

syslog does not like tabs in log messages; tab gets translated to #011

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agosched: make RED optional at runtime
Stephen Hemminger [Thu, 16 Jul 2015 21:34:32 +0000 (14:34 -0700)]
sched: make RED optional at runtime

Want to be able to build with RTE_SCHED_RED enabled but
allow disabling RED on a per-queue basis at runtime.

RED is disabled unless min/max thresholds set.

Signed-off-by: Stephen Hemmminger <stephen@networkplumber.org>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoixgbe: add access to specific device info
Liang-Min Larry Wang [Thu, 16 Jul 2015 13:25:35 +0000 (09:25 -0400)]
ixgbe: add access to specific device info

add function to support ethtool ops:
- get_reg_length
- get_regs
- get_eeprom_length
- get_eeprom
- set_eeprom

Signed-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Acked-by: Andrew Harvey <agh@cisco.com>
Acked-by: David Harton <dharton@cisco.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoigb: add access to specific device info
Liang-Min Larry Wang [Thu, 16 Jul 2015 13:25:36 +0000 (09:25 -0400)]
igb: add access to specific device info

add function to support ethtool ops:
- get_reg_length
- get_regs
- get_eeprom_length
- get_eeprom
- set_eeprom

Signed-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Acked-by: Andrew Harvey <agh@cisco.com>
Acked-by: David Harton <dharton@cisco.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoethdev: add access to specific device info
Liang-Min Larry Wang [Thu, 16 Jul 2015 13:25:34 +0000 (09:25 -0400)]
ethdev: add access to specific device info

add new apis:
- rte_eth_dev_get_reg_length
- rte_eth_dev_get_reg_info
- rte_eth_dev_get_eeprom_length
- rte_eth_dev_get_eeprom
- rte_eth_dev_set_eeprom

to enable reading device parameters (register and
eeprom) based upon ethtool alike data parameter specification.

Signed-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Acked-by: Andrew Harvey <agh@cisco.com>
Acked-by: David Harton <dharton@cisco.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoixgbe: add default mac address modifier
Liang-Min Larry Wang [Thu, 16 Jul 2015 13:25:35 +0000 (09:25 -0400)]
ixgbe: add default mac address modifier

- set_mac_addr

Signed-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Acked-by: Andrew Harvey <agh@cisco.com>
Acked-by: David Harton <dharton@cisco.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoigb: add default mac address modifier
Liang-Min Larry Wang [Thu, 16 Jul 2015 13:25:36 +0000 (09:25 -0400)]
igb: add default mac address modifier

- set_mac_addr

Signed-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Acked-by: Andrew Harvey <agh@cisco.com>
Acked-by: David Harton <dharton@cisco.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoethdev: add default mac address modifier
Liang-Min Larry Wang [Thu, 16 Jul 2015 13:25:33 +0000 (09:25 -0400)]
ethdev: add default mac address modifier

Add new api:
- rte_eth_dev_default_mac_addr_set

The new api, rte_eth_dev_default_mac_addr_set, uses the
existing dev_op, mac_addr_set, to enable setting mac
addr from ethdev level.

Signed-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Acked-by: Andrew Harvey <agh@cisco.com>
Acked-by: David Harton <dharton@cisco.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoethdev: fix error returned for invalid port id
Liang-Min Larry Wang [Wed, 15 Jul 2015 17:22:40 +0000 (13:22 -0400)]
ethdev: fix error returned for invalid port id

Fix return value, using the macro input instead of -EINVAL.

Fixes: 75acd57ad025 ("ethdev: introduce valid port helper")

Signed-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agokni: fix build on SLES 12
Pablo de Lara [Wed, 15 Jul 2015 15:13:07 +0000 (16:13 +0100)]
kni: fix build on SLES 12

SLES 12 has kernel 3.12, which original does not have skb_set_hash,
but SuSE has added that function to the kernel integrated on it.
Therefore, the function is not declared when compiling on this OS.

Reported-by: Sotiris Salloumis <sotiris.salloumis@ericsson.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agohash: fix build without SSE4.1
Pablo de Lara [Thu, 16 Jul 2015 09:00:54 +0000 (10:00 +0100)]
hash: fix build without SSE4.1

_mm_test_all_zeros is not available for CPUs with no SSE4.1,
therefore, DPDK would not build.
This patch adds an alternative for this, using _mm_cmpeq_epi32 and
_mm_movemask_epi8.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agohash: fix build with gcc 4.4 and 4.5
Pablo de Lara [Wed, 15 Jul 2015 12:40:42 +0000 (13:40 +0100)]
hash: fix build with gcc 4.4 and 4.5

gcc 4.4 and 4.5 throws following error:
rte_cuckoo_hash.c:145: error: flexible array member in otherwise empty struct.

This is due to empty length in flexible array, which has been changed to use
size 0 in the declaration of the array.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Reported-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agohash: fix out of bounds array access
Pablo de Lara [Wed, 15 Jul 2015 12:40:41 +0000 (13:40 +0100)]
hash: fix out of bounds array access

When encountering a loop while adding a new entry,
element out of bounds of array was being unnecessarily resetted.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agombuf: clarify comment on adding Tx offload flags
Bruce Richardson [Thu, 9 Jul 2015 13:22:39 +0000 (14:22 +0100)]
mbuf: clarify comment on adding Tx offload flags

The comment for TX offload flags stated that those flags started at bit
55 and then were added to the right of that, leaving 8 bits reserved for
generic mbuf (i.e. non-offload) use. This comment may not have been
clear as 5 of the 8 flags which were reserved have now been used for TX
offloads.
This patch:
* updates the description so that it now reflects reality that
only three flags are available for generic mbuf use
* reserved the final generic flag so that it can't be taken over for TX
offload in future
* clarifies the comment for TX flags to indicate that they should be
counting downwards not upwards.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agodoc: announce deprecation of librte_malloc
Sergio Gonzalez Monroy [Wed, 15 Jul 2015 16:32:27 +0000 (17:32 +0100)]
doc: announce deprecation of librte_malloc

Announce the creation of dummy malloc library for 2.1 and removal of
such library, now integrated in librte_eal, for 2.2 release.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agodoc: update malloc guide
Sergio Gonzalez Monroy [Thu, 16 Jul 2015 07:37:11 +0000 (08:37 +0100)]
doc: update malloc guide

Update malloc documentation to reflect new implementation details.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agomem: introduce memzone freeing
Sergio Gonzalez Monroy [Wed, 15 Jul 2015 16:32:25 +0000 (17:32 +0100)]
mem: introduce memzone freeing

Implement rte_memzone_free which, as its name implies, would free a
memzone.

Currently memzone are tracked in an array and cannot be free.
To be able to reuse the same array to track memzones, we have to
change how we keep track of reserved memzones.

With this patch, any memzone with addr NULL is not used, so we also need
to change how we look for the next memzone entry free.

Add new unit test for rte_memzone_free API.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agoapp/test: update malloc and memzone unit tests
Sergio Gonzalez Monroy [Wed, 15 Jul 2015 16:32:22 +0000 (17:32 +0100)]
app/test: update malloc and memzone unit tests

Some unit test are not relevant anymore. It is the case of those malloc
UTs that checked corner cases when allocating MALLOC_MEMZONE_SIZE
chunks, and the case of those memzone UTs relaying of specific free
memsegs of rhte reserved memzone.

Other UTs just need to be update, for example, to calculate maximum free
block size available.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agomem: rework memzone to be allocated by malloc
Sergio Gonzalez Monroy [Wed, 15 Jul 2015 16:32:21 +0000 (17:32 +0100)]
mem: rework memzone to be allocated by malloc

In the current memory hierarchy, memsegs are groups of physically
contiguous hugepages, memzones are slices of memsegs and malloc further
slices memzones into smaller memory chunks.

This patch modifies malloc so it partitions memsegs instead of memzones.
Thus memzones would call malloc internally for memory allocation while
maintaining its ABI.

During initialization malloc sets all available memory as part of the heaps.
CONFIG_RTE_MALLOC_MEMZONE_SIZE was used to specify the default memory
block size to expand the heap. The option is not used/relevant anymore,
so we remove it.

Remove free_memseg field from internal mem config structure as it is
not used anymore.
Also remove code in ivshmem that was setting up free_memseg on init.

It would be possible to free memzones and therefore any other structure
based on memzones, ie. mempools

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agomem: move librte_malloc to eal/common
Sergio Gonzalez Monroy [Wed, 15 Jul 2015 16:32:20 +0000 (17:32 +0100)]
mem: move librte_malloc to eal/common

Move malloc inside eal and create a new section in MAINTAINERS file for
Memory Allocation in EAL.

Create a dummy malloc library to avoid breaking applications that have
librte_malloc in their DT_NEEDED entries.

This is the first step towards using malloc to allocate memory directly
from memsegs. Thus, memzones would allocate memory through malloc,
allowing to free memzones.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agodoc: announce ABI changes for unified packet type
Helin Zhang [Tue, 7 Jul 2015 17:45:20 +0000 (01:45 +0800)]
doc: announce ABI changes for unified packet type

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
[Thomas: reword with NEXT_ABI option]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agombuf: remove old packet type bit masks
Helin Zhang [Thu, 9 Jul 2015 16:31:41 +0000 (00:31 +0800)]
mbuf: remove old packet type bit masks

As unified packet types are used instead, those old bit masks and
the relevant macros for packet type indication need to be removed.
To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI, which is disabled by default.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoexamples: replace some offload flags with packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:35 +0000 (00:31 +0800)]
examples: replace some offload flags with packet type

To unify packet types among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.
To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoapp: replace some offload flags with packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:32 +0000 (00:31 +0800)]
app: replace some offload flags with packet type

To unify packet types among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.
To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agomlx4: replace some offload flags with packet type
Thomas Monjalon [Wed, 15 Jul 2015 16:05:18 +0000 (18:05 +0200)]
mlx4: replace some offload flags with packet type

The workaround for Tx tunnel offloading can now be replaced with packet
type flag checking.
The ol_flags for IPv4/IPv6 and tunnel Rx offloading are replaced with
packet type flags.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agocxgbe: replace some offload flags with packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:31 +0000 (00:31 +0800)]
cxgbe: replace some offload flags with packet type

To unify packet types among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.

To avoid breaking ABI compatibility, all the changes would be enabled
by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoenic: replace some offload flags with packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:28 +0000 (00:31 +0800)]
enic: replace some offload flags with packet type

To unify packet types among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.

To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agovmxnet3: replace some offload flags with packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:29 +0000 (00:31 +0800)]
vmxnet3: replace some offload flags with packet type

To unify packet types among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.

To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agofm10k: replace some offload flags with packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:30 +0000 (00:31 +0800)]
fm10k: replace some offload flags with packet type

To unify packet types among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.

To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoi40e: replace some offload flags with unified packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:27 +0000 (00:31 +0800)]
i40e: replace some offload flags with unified packet type

To unify packet types among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.

To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoixgbe: replace some offload flags with packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:26 +0000 (00:31 +0800)]
ixgbe: replace some offload flags with packet type

To unify packet type among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.

To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Note that around 2.5% performance drop (64B) was observed of doing
4 ports (1 port per 82599 card) IO forwarding on the same SNB core.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoigb: replace some offload flags with packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:25 +0000 (00:31 +0800)]
igb: replace some offload flags with packet type

To unify packet types among all PMDs, bit masks of packet type for
'ol_flags' are replaced by unified packet type.

To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agombuf: add definitions of unified packet types
Helin Zhang [Thu, 9 Jul 2015 16:31:24 +0000 (00:31 +0800)]
mbuf: add definitions of unified packet types

As there are only 6 bit flags in ol_flags for indicating packet
types, which is not enough to describe all the possible packet
types hardware can recognize. For example, i40e hardware can
recognize more than 150 packet types. Unified packet type is
composed of L2 type, L3 type, L4 type, tunnel type, inner L2 type,
inner L3 type and inner L4 type fields, and can be stored in
'struct rte_mbuf' of 32 bits field 'packet_type'.

To avoid breaking ABI compatibility, all the changes would be
enabled by RTE_NEXT_ABI.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agombuf: redefine packet type
Helin Zhang [Thu, 9 Jul 2015 16:31:23 +0000 (00:31 +0800)]
mbuf: redefine packet type

In order to unify the packet type, the field of 'packet_type' in
'struct rte_mbuf' needs to be extended from 16 to 32 bits.

Accordingly, some fields in 'struct rte_mbuf' are re-organized to support
this change for Vector PMD.
As 'struct rte_kni_mbuf' for KNI should be right mapped to
'struct rte_mbuf', it should be modified accordingly.
In ixgbe PMD driver, corresponding changes are added for the mbuf changes,
especially the bit masks of packet type for 'ol_flags' are replaced by
unified packet type. In addition, more packet types (UDP, TCP and SCTP)
are supported in vectorized ixgbe PMD.

To avoid breaking ABI compatibility, all the changes would be enabled by
RTE_NEXT_ABI.

Note that around 2% performance drop (64B) was observed of doing 4 ports
(1 port per 82599 card) IO forwarding on the same SNB core.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agomem: fix initialization with --no-huge option
Sergio Gonzalez Monroy [Wed, 15 Jul 2015 10:12:00 +0000 (11:12 +0100)]
mem: fix initialization with --no-huge option

After code rework from bellow commit, logic expects hugepage_sz field to
always be set (ie. not zero value).
When using --no-huge, this field was left unset defaulting to zero.

Set hugepage_sz to RTE_PGSIZE_4K when using --no-huge.

Fixes: b3dfffd962ecd ("mem: allow multiple page sizes to be requested")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agoeal/tile: add const in prefetch functions
Zhigang Lu [Wed, 15 Jul 2015 07:26:47 +0000 (15:26 +0800)]
eal/tile: add const in prefetch functions

Commit 7c5d0cc91579 added const in prefetch functions for
X86 and PPC.  This patch does the same for Tile arch.

Signed-off-by: Zhigang Lu <zlu@ezchip.com>
8 years agocxgbe: fix and update doc
Rahul Lakkireddy [Wed, 15 Jul 2015 17:30:05 +0000 (23:00 +0530)]
cxgbe: fix and update doc

Fix spelling and grammar errors.  Re-organize sections for better explanation
in the documentation.  Add a section describing compilation of CXGBE with DPDK.
Add a note describing that CXGBE currently only supports binding to PF4.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
8 years agovfio: fix overflow of BAR region offset and size
Rahul Lakkireddy [Mon, 13 Jul 2015 08:51:45 +0000 (14:21 +0530)]
vfio: fix overflow of BAR region offset and size

When using vfio, the probe fails for BAR > 0 after the
commit-id 90a1633b2 (eal/linux: allow to map BARs with MSI-X tables).

While debugging further, found that the BAR region offset and size read from
vfio are u64, but are assigned to uint32_t variables.  This results in the u64
value getting truncated to 0 and passing wrong offset and size to mmap for
subsequent BAR regions.

The fix is to use unsigned long for the offset and size.

This is based on patch by Alejandro Lucero <alejandro.lucero@netronome.com>
posted at below:
http://dpdk.org/ml/archives/dev/2015-June/020201.html
and updated with diff from below to fix 32-bit compilation:
http://dpdk.org/ml/archives/dev/2015-July/020963.html

Fixes: 90a1633b2347 ("eal/linux: allow to map BARs with MSI-X tables")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
8 years agovfio: fix device initialization
Tetsuya Mukawa [Sat, 11 Jul 2015 06:29:49 +0000 (15:29 +0900)]
vfio: fix device initialization

The patch fixes vfio initialization issue introduced by below patch.

Root cause is that VFIO_PRESENT is inaccessible in eal common level.
To fix it, remove pci_map/unmap_device from common code, then implement
in linux and bsd code.

Fixes: 35b3313e322b ("pci: merge mapping functions for linux and bsd")

Reported-by: Michael Qiu <michael.qiu@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
8 years agopcap: add Rx and Tx byte counters
Klaus Degner [Mon, 13 Jul 2015 14:54:22 +0000 (16:54 +0200)]
pcap: add Rx and Tx byte counters

Added RX and TX bytes counter support to the PCAP statistics.
Added TX counter support for pcap dumper and interface functions.
Renamed RX and TX packet counters for consistency.

Signed-off-by: Klaus Degner <kd@allegro-packets.com>
Tested-by: John McNamara <john.mcnamara@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agohash: rename unused field
Bruce Richardson [Mon, 13 Jul 2015 16:38:45 +0000 (17:38 +0100)]
hash: rename unused field

The cuckoo hash has a fixed number of entries per bucket, so the
configuration parameter for this is unused. We change this field in the
parameters struct to "reserved" to indicate that there is now no such
parameter value, while at the same time keeping ABI consistency.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Suggested-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agompipe: add TILE-Gx mPIPE poll mode driver
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:19 +0000 (16:25 +0800)]
mpipe: add TILE-Gx mPIPE poll mode driver

This commit adds a poll mode driver for the mPIPE hardware present on
TILE-Gx SoCs.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
8 years agoeal/tile: add initial TILE-Gx support
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:18 +0000 (16:25 +0800)]
eal/tile: add initial TILE-Gx support

This commit adds support for the TILE-Gx platform, as well as the TILE
CPU architecture.  This architecture port is fairly simple due to its
reliance on generics for most arch stuff.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
8 years agoeal/tile: add page sizes for TILE-Gx/Mx platforms
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:17 +0000 (16:25 +0800)]
eal/tile: add page sizes for TILE-Gx/Mx platforms

This patch adds a few new page sizes that are supported on the TILE-Gx
and TILE-Mx platforms.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
8 years agomempool: allow config override on element alignment
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:16 +0000 (16:25 +0800)]
mempool: allow config override on element alignment

On TILE-Gx and TILE-Mx platforms, the buffers fed into the hardware
buffer manager require a 128-byte alignment.  With this change, we
allow configuration based override of the element alignment, and
default to RTE_CACHE_LINE_SIZE if left unspecified.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agomem: allow multiple page sizes to be requested
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:15 +0000 (16:25 +0800)]
mem: allow multiple page sizes to be requested

This patch extends the memzone allocator to remove the restriction
that prevented callers from specifying multiple page sizes in the
flags argument.

In doing so, we also sanitize the free segment matching logic to get
rid of architecture specific disjunctions (2MB vs 1GB on x86, and 16MB
vs 16GB on PPC), thereby allowing for a broader range of hugepages on
architectures that support it.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
8 years agomem: refactor memzone reserve functions
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:14 +0000 (16:25 +0800)]
mem: refactor memzone reserve functions

The definitions of rte_memzone_reserve_aligned() and
rte_memzone_reserve_bounded() were identical with the exception of the
bound argument passed into rte_memzone_reserve_thread_safe().

This patch removes this replication of code by unifying it into
rte_memzone_reserve_thread_safe(), which is then called by all three
variants of rte_memzone_reserve().

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
8 years agoconfig: remove combined library name option
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:13 +0000 (16:25 +0800)]
config: remove combined library name option

The library name is now being pinned to "dpdk" instead of intel_dpdk,
powerpc_dpdk, etc.  As a result, we no longer need this config item.
This patch removes it.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoeal: allow empty compile time cpu flags
Zhigang Lu [Thu, 9 Jul 2015 08:25:12 +0000 (16:25 +0800)]
eal: allow empty compile time cpu flags

When RTE_COMPILE_TIME_CPUFLAGS is empty, the rte_cpu_check_supported()
code breaks with a "comparison is always false due to limited range of
data type".  This is because the compile_time_flags[] array is empty.
Assigning the array dimension to a local variable apparently solves this.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agohash: check SSE flags only on x86 builds
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:11 +0000 (16:25 +0800)]
hash: check SSE flags only on x86 builds

This is necessary because the required CPU flags may not be defined on
other architectures.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoapp/test: restrict x86 cpu flags checks to x86 builds
Cyril Chemparathy [Thu, 9 Jul 2015 08:25:10 +0000 (16:25 +0800)]
app/test: restrict x86 cpu flags checks to x86 builds

The original code mistakenly defaulted to X86 when RTE_ARCH_PPC_64 was
left undefined.  This did not accommodate other non-PPC/non-X86
architectures.  This patch fixes this issue.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agomaintainers: claim responsibility for virtio and vhost
Huawei Xie [Mon, 13 Jul 2015 10:22:34 +0000 (18:22 +0800)]
maintainers: claim responsibility for virtio and vhost

As original author of virtio PMD (coauthor with Rashmin) and vhost user,
claim responsibility for virtio PMD, vhost lib and vhost example.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoe1000: add 82583v pci id
James Davidson [Mon, 4 May 2015 15:28:13 +0000 (08:28 -0700)]
e1000: add 82583v pci id

Add support for 82583V (E1000) PCI device id.

Signed-off-by: James Davidson <james.davidson@brocade.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agomaintainers: claim responsibility for e1000 drivers
Wenzhuo Lu [Mon, 13 Jul 2015 02:32:21 +0000 (10:32 +0800)]
maintainers: claim responsibility for e1000 drivers

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomk: fix shared lib build with stable abi
Thomas Monjalon [Mon, 13 Jul 2015 08:51:40 +0000 (10:51 +0200)]
mk: fix shared lib build with stable abi

When next ABI is enabled, the shared lib extension is .so.x.1.
That's why a double basename was introduced.
But the "ifeq NEXT_ABI" was forgotten, removing the .so
extension when NEXT_ABI is disabled.
It was preventing the linker from finding the .so libraries.

Fixes: 506f51cc0da7 ("mk: enable next abi preview")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: update hash guide
Pablo de Lara [Sat, 11 Jul 2015 00:18:56 +0000 (01:18 +0100)]
doc: update hash guide

Updates hash library documentation, reflecting
the new implementation changes.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agodoc: announce deprecation of macros in hash API
Pablo de Lara [Sat, 11 Jul 2015 00:18:55 +0000 (01:18 +0100)]
doc: announce deprecation of macros in hash API

Two of the macros in rte_hash.h are now deprecated, so this patch
adds notice that they will be removed in 2.2.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agomaintainers: claim responsibility for hash library
Pablo de Lara [Sat, 11 Jul 2015 00:18:54 +0000 (01:18 +0100)]
maintainers: claim responsibility for hash library

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agohash: add iterate function
Pablo de Lara [Sat, 11 Jul 2015 00:18:53 +0000 (01:18 +0100)]
hash: add iterate function

Since now rte_hash structure is private, a new function
has been added to let the user iterate through the hash table,
returning next key and data associated on each iteration,
plus the position where they were stored.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agohash: allow to store data in hash table
Pablo de Lara [Sat, 11 Jul 2015 00:18:52 +0000 (01:18 +0100)]
hash: allow to store data in hash table

Usually hash tables not only store keys, but also data associated
to them. In order to maintain the existing API, the old functions
will still return the index where the key was stored.
The new functions will return the data associated to that key.
In the case of the lookup_bulk function, it will return also
the number of entries found and a bitmask of which entries
were found.

Unit tests have been updated to use these new functions.

As a final point, a flag has been added in rte_hash_parameters
to indicate if there are new parameters for future versions,
so there is no need to maintain multiple versions
of the existing functions in the future.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
[Thomas: fix || operator in a precondition check]

8 years agohash: add reset function
Pablo de Lara [Sat, 11 Jul 2015 00:18:51 +0000 (01:18 +0100)]
hash: add reset function

Added reset function to be able to empty the table,
without having to destroy and create it again.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agohash: replace with cuckoo hash implementation
Pablo de Lara [Sat, 11 Jul 2015 00:18:50 +0000 (01:18 +0100)]
hash: replace with cuckoo hash implementation

This patch replaces the existing hash library with another approach,
using the Cuckoo Hash method to resolve collisions (open addressing),
which pushes items from a full bucket when a new entry tries
to be added in it, storing the evicted entry in an alternative location,
using a secondary hash function.

This gives the user the ability to store more entries when a bucket
is full, in comparison with the previous implementation.
Therefore, the unit test has been updated, as some scenarios have changed
(such as the previous removed restriction).

Also note that the API has not been changed, although new fields
have been added in the rte_hash structure (structure is internal now).
The main change when creating a new table is that the number of entries
per bucket is fixed now, so its parameter is ignored now
(still there to maintain the same parameters structure).
The hash unit test has been updated to reflect these changes.

As a last note, the maximum burst size in lookup_burst function
hash been increased to 64, to improve performance.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoethdev: call Rx and Tx callbacks in the order they were added
John McNamara [Fri, 10 Jul 2015 13:08:13 +0000 (14:08 +0100)]
ethdev: call Rx and Tx callbacks in the order they were added

Change the order that user supplied RX and TX callbacks are called
to the order that they were added (fifo).

The previous calling order was the reverse of this (lifo) and was
counter intuitive for users.

Suggested-by: Robert Sanford <rsanford@akamai.com>
Signed-off-by: John McNamara <john.mcnamara@intel.com>
8 years agoethdev: improve API comments of close and detach functions
Tetsuya Mukawa [Thu, 9 Jul 2015 08:19:14 +0000 (17:19 +0900)]
ethdev: improve API comments of close and detach functions

The patch fixes doxygen comments of below functions.
 - rte_eth_dev_close()
   Add description about when the function can be called and also about
   what kind of resources will be freed.
 - rte_eth_dev_detach()
   Add description about when the function can be called.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>