dpdk.git
6 years agonet/enic: use contiguous allocation for DMA memory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:54 +0000 (13:29 +0100)]
net/enic: use contiguous allocation for DMA memory

All hardware drivers should allocate IOVA-contiguous
memzones for their hardware resources.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: John Daley <johndale@cisco.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agonet/ena: use contiguous allocation for DMA memory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:53 +0000 (13:29 +0100)]
net/ena: use contiguous allocation for DMA memory

All hardware drivers should allocate IOVA-contiguous
memzones for their hardware resources.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agonet/cxgbe: use contiguous allocation for DMA memory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:52 +0000 (13:29 +0100)]
net/cxgbe: use contiguous allocation for DMA memory

All hardware drivers should allocate IOVA-contiguous
memzones for their hardware resources.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agonet/bnxt: use contiguous allocation for DMA memory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:51 +0000 (13:29 +0100)]
net/bnxt: use contiguous allocation for DMA memory

All hardware drivers should allocate IOVA-contiguous
memzones for their hardware resources.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agonet/bnx2x: use contiguous allocation for DMA memory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:50 +0000 (13:29 +0100)]
net/bnx2x: use contiguous allocation for DMA memory

All hardware drivers should allocate IOVA-contiguous
memzones for their hardware resources.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agonet/avf: use contiguous allocation for DMA memory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:49 +0000 (13:29 +0100)]
net/avf: use contiguous allocation for DMA memory

All hardware drivers should allocate IOVA-contiguous
memzones for their hardware resources.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agocrypto/qat: use contiguous allocation for DMA memory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:48 +0000 (13:29 +0100)]
crypto/qat: use contiguous allocation for DMA memory

All hardware drivers should allocate IOVA-contiguous
memzones for their hardware resources.

Also, remove the weird page alignment code.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agoethdev: use contiguous allocation for DMA memory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:47 +0000 (13:29 +0100)]
ethdev: use contiguous allocation for DMA memory

All hardware drivers should allocate IOVA-contiguous
memzones for their hardware resources.

This fixes the following drivers in one go:

grep -Rl rte_eth_dma_zone_reserve drivers/

drivers/net/avf/avf_rxtx.c
drivers/net/thunderx/nicvf_ethdev.c
drivers/net/e1000/igb_rxtx.c
drivers/net/e1000/em_rxtx.c
drivers/net/fm10k/fm10k_ethdev.c
drivers/net/vmxnet3/vmxnet3_rxtx.c
drivers/net/liquidio/lio_rxtx.c
drivers/net/i40e/i40e_rxtx.c
drivers/net/sfc/sfc.c
drivers/net/ixgbe/ixgbe_rxtx.c
drivers/net/nfp/nfp_net.c

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomemzone: enable IOVA-contiguous reserving
Anatoly Burakov [Wed, 11 Apr 2018 12:29:46 +0000 (13:29 +0100)]
memzone: enable IOVA-contiguous reserving

This adds a new flag to request reserved memzone to be IOVA
contiguous. This is useful for allocating hardware resources like
NIC rings/queues etc.For now, hugepage memory is always contiguous,
but we need to prepare the drivers for the switch.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomalloc: support contiguous allocation
Anatoly Burakov [Wed, 11 Apr 2018 12:29:45 +0000 (13:29 +0100)]
malloc: support contiguous allocation

No major changes, just add some checks in a few key places, and
a new parameter to pass around.

Also, add a function to check malloc element for physical
contiguousness. For now, assume hugepage memory is always
contiguous, while non-hugepage memory will be checked.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomalloc: replace panics with error messages
Anatoly Burakov [Wed, 11 Apr 2018 12:29:44 +0000 (13:29 +0100)]
malloc: replace panics with error messages

We shouldn't ever panic in libraries, let alone in EAL, so
replace all panic messages with error messages.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomalloc: make free return resulting element
Anatoly Burakov [Wed, 11 Apr 2018 12:29:43 +0000 (13:29 +0100)]
malloc: make free return resulting element

This will be needed because we need to know how big is the
new empty space, to check whether we can free some pages as
a result.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomalloc: make free list removal function public
Anatoly Burakov [Wed, 11 Apr 2018 12:29:42 +0000 (13:29 +0100)]
malloc: make free list removal function public

We will need to be able to remove entries from free lists from
heaps during certain events, such as rollbacks, or when freeing
memory to the system (where a previously element disappears and
thus can no longer be in the free list).

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomalloc: make join elements function public
Anatoly Burakov [Wed, 11 Apr 2018 12:29:41 +0000 (13:29 +0100)]
malloc: make join elements function public

Down the line, we will need to join free segments to determine
whether the resulting contiguous free space is bigger than a
page size, allowing to free some memory back to the system.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agotest: add command to dump malloc heap contents
Anatoly Burakov [Wed, 11 Apr 2018 12:29:40 +0000 (13:29 +0100)]
test: add command to dump malloc heap contents

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomalloc: add function to dump heap contents
Anatoly Burakov [Wed, 11 Apr 2018 12:29:39 +0000 (13:29 +0100)]
malloc: add function to dump heap contents

Malloc heap is now a doubly linked list, so it's now possible to
iterate over each malloc element regardless of its state.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomalloc: make heap a doubly-linked list
Anatoly Burakov [Wed, 11 Apr 2018 12:29:38 +0000 (13:29 +0100)]
malloc: make heap a doubly-linked list

As we are preparing for dynamic memory allocation, we need to be
able to handle holes in our malloc heap, hence we're switching to
doubly linked list, and prepare infrastructure to support it.

Since our heap is now aware where are our first and last elements,
there is no longer any need to have a dummy element at the end of
each heap, so get rid of that as well. Instead, let insert/remove/
join/split operations handle end-of-list conditions automatically.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomalloc: move all locking to heap
Anatoly Burakov [Wed, 11 Apr 2018 12:29:37 +0000 (13:29 +0100)]
malloc: move all locking to heap

Down the line, we will need to do everything from the heap as any
alloc or free may trigger alloc/free OS memory, which would involve
growing/shrinking heap.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agomem: move virtual area function in common directory
Anatoly Burakov [Wed, 11 Apr 2018 12:29:36 +0000 (13:29 +0100)]
mem: move virtual area function in common directory

Move get_virtual_area out of linuxapp EAL memory and make it
common to EAL, so that other code could reserve virtual areas
as well.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agovfio: do not needlessly check for IOVA mode
Anatoly Burakov [Wed, 4 Apr 2018 14:40:47 +0000 (15:40 +0100)]
vfio: do not needlessly check for IOVA mode

We already set IOVA addresses of memsegs and memzones to VA
address during initialization, so we don't need to check
whether we're in RTE_IOVA_VA mode anywhere else.

Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
6 years agobus/fslmc: do not needlessly check for IOVA mode
Anatoly Burakov [Wed, 4 Apr 2018 14:40:46 +0000 (15:40 +0100)]
bus/fslmc: do not needlessly check for IOVA mode

We already set IOVA addresses of memsegs and memzones to VA
address during initialization, so we don't need to check
whether we're in RTE_IOVA_VA mode anywhere else.

Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
6 years agomem: do not use physical addresses in IOVA as VA mode
Anatoly Burakov [Wed, 4 Apr 2018 14:40:45 +0000 (15:40 +0100)]
mem: do not use physical addresses in IOVA as VA mode

We already use VA addresses for IOVA purposes everywhere if we're in
RTE_IOVA_VA mode:
 1) rte_malloc_virt2phy()/rte_malloc_virt2iova() always return VA addresses
 2) Because of 1), memzone's IOVA is set to VA address on reserve
 3) Because of 2), mempool's IOVA addresses are set to VA addresses

The only place where actual physical addresses are stored is in memsegs at
init time, but we're not using them anywhere, and there is no external API
to get those addresses (aside from manually iterating through memsegs), nor
should anyone care about them in RTE_IOVA_VA mode.

So, fix EAL initialization to allocate VA-contiguous segments at the start
without regard for physical addresses (as if they weren't available), and
use VA to set final IOVA addresses for all pages.

Fixes: 62196f4e0941 ("mem: rename address mapping function to IOVA")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
6 years agoapp/crypto-perf: fix IOVA translation
Anatoly Burakov [Wed, 4 Apr 2018 14:40:44 +0000 (15:40 +0100)]
app/crypto-perf: fix IOVA translation

IOVA addresses should be found by calling rte_virt2iova() as
opposed to rte_virt2phy(), as physical address may not be
equal to IOVA address.

Fixes: 2eb6a1a3e5fc ("app/crypto-perf: fix crypto op init")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
6 years agousertools: change to SPDX license identifier
Hemant Agrawal [Mon, 9 Apr 2018 08:58:37 +0000 (14:28 +0530)]
usertools: change to SPDX license identifier

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agousertools: add missing SPDX identifier
Hemant Agrawal [Mon, 9 Apr 2018 08:58:36 +0000 (14:28 +0530)]
usertools: add missing SPDX identifier

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
6 years agoalign SPDX Mellanox copyrights
Shahaf Shuler [Tue, 20 Mar 2018 19:20:35 +0000 (21:20 +0200)]
align SPDX Mellanox copyrights

Aligning Mellanox SPDX copyrights to a single format.
In addition replace to SPDX licence files which were missed.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agoeal/arm: use SPDX tag for Cavium and RehiveTech copyright file
Jan Viktorin [Mon, 9 Apr 2018 22:15:58 +0000 (00:15 +0200)]
eal/arm: use SPDX tag for Cavium and RehiveTech copyright file

Replace the BSD license header with the SPDX tag for files
with a RehiveTech and Cavium copyright on them.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agouse SPDX tag for RehiveTech copyright files
Jan Viktorin [Mon, 9 Apr 2018 22:15:53 +0000 (00:15 +0200)]
use SPDX tag for RehiveTech copyright files

Replace the BSD license header with the SPDX tag for files
with only an RehiveTech copyright on them.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agomaintainers: call out subtree committers
Pablo de Lara [Wed, 28 Mar 2018 19:30:40 +0000 (20:30 +0100)]
maintainers: call out subtree committers

The MAINTAINERS file contains information of the maintainers
of the different components on DPDK.
However, it does not give any information on who maintains the
different subtrees which accept new commits for these components.

This commit adds a list of the subtree committers.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomaintainers: maintain avf PMD in next-net-intel
Ferruh Yigit [Wed, 4 Apr 2018 15:13:03 +0000 (16:13 +0100)]
maintainers: maintain avf PMD in next-net-intel

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomaintainers: claim responsibility for vmxnet3
Yong Wang [Fri, 30 Mar 2018 21:57:02 +0000 (14:57 -0700)]
maintainers: claim responsibility for vmxnet3

Signed-off-by: Yong Wang <yongwang@vmware.com>
6 years agohash: fix missing spinlock unlock in add key
Pavan Nikhilesh [Sun, 4 Mar 2018 14:58:31 +0000 (20:28 +0530)]
hash: fix missing spinlock unlock in add key

Fix missing spinlock unlock during add key when key is already present.

Fixes: be856325cba3 ("hash: add scalable multi-writer insertion with Intel TSX")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agoexamples/ip_pipeline: skip in FreeBSD build
Jasvinder Singh [Tue, 10 Apr 2018 09:51:32 +0000 (10:51 +0100)]
examples/ip_pipeline: skip in FreeBSD build

IP_Pipeline app is not supported in FreeBSD environment. Therefore,
skip it while building the sample apps on FreeBSD.

Fixes: 4bbf8e30aa5e ("examples/ip_pipeline: add CLI interface")
Fixes: 2f74ae28e23f ("examples/ip_pipeline: add tap object")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agodoc: add meter API change to release notes
Jasvinder Singh [Thu, 5 Apr 2018 11:49:59 +0000 (12:49 +0100)]
doc: add meter API change to release notes

Update the release notes with meter api change to support configuration
profiles.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agoexamples/ip_pipeline: add ECMP route example
Jasvinder Singh [Fri, 30 Mar 2018 14:31:08 +0000 (15:31 +0100)]
examples/ip_pipeline: add ECMP route example

Add example to build pipeline to demonstrate equal-cost multi-path
routing example.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: fix load balance table action
Jasvinder Singh [Fri, 30 Mar 2018 14:31:07 +0000 (15:31 +0100)]
examples/ip_pipeline: fix load balance table action

Fix bug in load balance action for pipeline table.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add flow classification example
Jasvinder Singh [Thu, 29 Mar 2018 18:32:08 +0000 (19:32 +0100)]
examples/ip_pipeline: add flow classification example

Add example to build pipeline with hash table to classify the
ingress traffic.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agoexamples/ip_pipeline: add firewall example
Jasvinder Singh [Thu, 29 Mar 2018 18:32:07 +0000 (19:32 +0100)]
examples/ip_pipeline: add firewall example

Add example to built pipeline with ACL table to demonstrate
the firewall operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add route example
Jasvinder Singh [Thu, 29 Mar 2018 18:32:06 +0000 (19:32 +0100)]
examples/ip_pipeline: add route example

Add example to built pipeline with LPM table to demonstrate layer 3
routing.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agoexamples/ip_pipeline: add TAP port example
Jasvinder Singh [Thu, 29 Mar 2018 18:32:05 +0000 (19:32 +0100)]
examples/ip_pipeline: add TAP port example

Add example to illustrate the pipeline functioning with TAP
interface.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoexamples/ip_pipeline: add KNI port example
Jasvinder Singh [Thu, 29 Mar 2018 18:32:04 +0000 (19:32 +0100)]
examples/ip_pipeline: add KNI port example

Add example to illustrate the pipeline functioning with KNI
interface.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoexamples/ip_pipeline: add l2fwd example
Jasvinder Singh [Thu, 29 Mar 2018 18:32:03 +0000 (19:32 +0100)]
examples/ip_pipeline: add l2fwd example

This patch add the configuration file for l2fwd example. It
includes commands to build the packet processing stage (pipeline),
defining action, add rules to its table, etc.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoexamples/ip_pipeline: add load balance action command
Jasvinder Singh [Thu, 29 Mar 2018 18:32:02 +0000 (19:32 +0100)]
examples/ip_pipeline: add load balance action command

Add command for load balance action.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add TTL stats command
Jasvinder Singh [Thu, 29 Mar 2018 18:32:01 +0000 (19:32 +0100)]
examples/ip_pipeline: add TTL stats command

Add command to read the ttl stats.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add DSCP table update command
Jasvinder Singh [Thu, 29 Mar 2018 18:32:00 +0000 (19:32 +0100)]
examples/ip_pipeline: add DSCP table update command

Add command to update the dscp table for traffic meter and traffic
manager.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add meter stats command
Jasvinder Singh [Thu, 29 Mar 2018 18:31:59 +0000 (19:31 +0100)]
examples/ip_pipeline: add meter stats command

Add command to read traffic meter stats.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add meter profile commands
Jasvinder Singh [Thu, 29 Mar 2018 18:31:58 +0000 (19:31 +0100)]
examples/ip_pipeline: add meter profile commands

Add commands to configure the traffic meter profile.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add table entry stats command
Jasvinder Singh [Thu, 29 Mar 2018 18:31:57 +0000 (19:31 +0100)]
examples/ip_pipeline: add table entry stats command

Add command to read the pipeline table entry stats.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agoexamples/ip_pipeline: add table bulk add command
Jasvinder Singh [Thu, 29 Mar 2018 18:31:56 +0000 (19:31 +0100)]
examples/ip_pipeline: add table bulk add command

Add cli for adding bulk entries to pipeline table.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoexamples/ip_pipeline: add table entry delete command
Jasvinder Singh [Thu, 29 Mar 2018 18:31:55 +0000 (19:31 +0100)]
examples/ip_pipeline: add table entry delete command

Add command to delete the pipeline table entry.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add table entry commands
Jasvinder Singh [Thu, 29 Mar 2018 18:31:54 +0000 (19:31 +0100)]
examples/ip_pipeline: add table entry commands

Add commands to add pipeline table entries which contains match and
action part.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoexamples/ip_pipeline: add stats read commands
Jasvinder Singh [Thu, 29 Mar 2018 18:31:53 +0000 (19:31 +0100)]
examples/ip_pipeline: add stats read commands

Add commands to read the pipeline  port in, port out
and table stats.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agoexamples/ip_pipeline: add port enable and disable commands
Jasvinder Singh [Thu, 29 Mar 2018 18:31:52 +0000 (19:31 +0100)]
examples/ip_pipeline: add port enable and disable commands

Add commands to enable and disable the pipeline ports.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agoexamples/ip_pipeline: add enable and disable commands
Jasvinder Singh [Thu, 29 Mar 2018 18:31:51 +0000 (19:31 +0100)]
examples/ip_pipeline: add enable and disable commands

Add commands to enable and disable the pipeline on the thread.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agoexamples/ip_pipeline: add thread runtime
Jasvinder Singh [Thu, 29 Mar 2018 18:31:50 +0000 (19:31 +0100)]
examples/ip_pipeline: add thread runtime

Add runtime thread functions for the pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add threads
Jasvinder Singh [Thu, 29 Mar 2018 18:31:49 +0000 (19:31 +0100)]
examples/ip_pipeline: add threads

Add threads data structure and initialisation functions to run
the pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add pipeline object
Jasvinder Singh [Thu, 29 Mar 2018 18:31:48 +0000 (19:31 +0100)]
examples/ip_pipeline: add pipeline object

Add pipeline object implementation to the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add action profile objects
Jasvinder Singh [Thu, 29 Mar 2018 18:31:47 +0000 (19:31 +0100)]
examples/ip_pipeline: add action profile objects

Add action profile object implementation to the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agoexamples/ip_pipeline: add KNI object
Jasvinder Singh [Thu, 29 Mar 2018 18:31:46 +0000 (19:31 +0100)]
examples/ip_pipeline: add KNI object

Add kni object implementation to the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoexamples/ip_pipeline: add tap object
Jasvinder Singh [Thu, 29 Mar 2018 18:31:45 +0000 (19:31 +0100)]
examples/ip_pipeline: add tap object

Add tap object implementation to the application

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoexamples/ip_pipeline: add traffic manager object
Jasvinder Singh [Thu, 29 Mar 2018 18:31:44 +0000 (19:31 +0100)]
examples/ip_pipeline: add traffic manager object

Add traffic manager object implementation to the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: add sw queue object
Jasvinder Singh [Thu, 29 Mar 2018 18:31:43 +0000 (19:31 +0100)]
examples/ip_pipeline: add sw queue object

Add swq object implementation to the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoexamples/ip_pipeline: add link object
Jasvinder Singh [Thu, 29 Mar 2018 18:31:42 +0000 (19:31 +0100)]
examples/ip_pipeline: add link object

Add link object implementation to the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agoexamples/ip_pipeline: add mempool object
Jasvinder Singh [Thu, 29 Mar 2018 18:31:41 +0000 (19:31 +0100)]
examples/ip_pipeline: add mempool object

Add mempool object implementation to the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agoexamples/ip_pipeline: add CLI interface
Jasvinder Singh [Thu, 29 Mar 2018 18:31:40 +0000 (19:31 +0100)]
examples/ip_pipeline: add CLI interface

CLI interface allowing connectivity with external agent (e.g. telnet,
netcat, Python script, etc) is added to the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: remove infra code
Jasvinder Singh [Thu, 29 Mar 2018 18:31:39 +0000 (19:31 +0100)]
examples/ip_pipeline: remove infra code

All the actions associated with application pipelines
tables and ports are now implemented using the new action
APIs. Therefore, thousands of lines of code are eliminated
from the application. The reduced code size is easier to
maintain and extend.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: remove config
Jasvinder Singh [Thu, 29 Mar 2018 18:31:38 +0000 (19:31 +0100)]
examples/ip_pipeline: remove config

Remove application configuration and script files.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: remove master pipeline
Jasvinder Singh [Thu, 29 Mar 2018 18:31:37 +0000 (19:31 +0100)]
examples/ip_pipeline: remove master pipeline

remove master pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: remove firewall pipeline
Jasvinder Singh [Thu, 29 Mar 2018 18:31:36 +0000 (19:31 +0100)]
examples/ip_pipeline: remove firewall pipeline

Remove firewall pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: remove flow actions pipeline
Jasvinder Singh [Thu, 29 Mar 2018 18:31:35 +0000 (19:31 +0100)]
examples/ip_pipeline: remove flow actions pipeline

Remove flow actions pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: remove flow classification pipeline
Jasvinder Singh [Thu, 29 Mar 2018 18:31:34 +0000 (19:31 +0100)]
examples/ip_pipeline: remove flow classification pipeline

Remove flow classification pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: remove routing pipeline
Jasvinder Singh [Thu, 29 Mar 2018 18:31:33 +0000 (19:31 +0100)]
examples/ip_pipeline: remove routing pipeline

Remove routing pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: remove passthrough pipeline
Jasvinder Singh [Thu, 29 Mar 2018 18:31:32 +0000 (19:31 +0100)]
examples/ip_pipeline: remove passthrough pipeline

remove passthrough pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agotable: remove incorrect check for ACL
Jasvinder Singh [Thu, 29 Mar 2018 18:31:31 +0000 (19:31 +0100)]
table: remove incorrect check for ACL

Remove wrong check for table entry pointer.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agopipeline: add port in action APIs
Jasvinder Singh [Thu, 29 Mar 2018 18:31:30 +0000 (19:31 +0100)]
pipeline: add port in action APIs

This API provides a common set of actions for pipeline input ports to speed
up application development.

Each pipeline input port can be assigned an action handler to be executed
on every input packet during the pipeline execution.

The pipeline library allows the user to define his own input port actions
by providing customized input port action handler. While the user can
still follow this process, this API is intended to provide a quicker
development alternative for a set of predefined actions.

The typical steps to use this API are:
* Define an input port action profile.
* Instantiate the input port action profile to create input port action
  objects.
* Use the input port action to generate the input port action handler
  invoked by the pipeline.
* Use the input port action object to generate the internal data structures
  used by the input port action handler based on given action parameters.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add load balance action
Jasvinder Singh [Thu, 29 Mar 2018 18:31:29 +0000 (19:31 +0100)]
pipeline: add load balance action

Add implementation of the load balance action.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add timestamp action
Jasvinder Singh [Thu, 29 Mar 2018 18:31:28 +0000 (19:31 +0100)]
pipeline: add timestamp action

Add implementation of timestamp action.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add statistics read action
Jasvinder Singh [Thu, 29 Mar 2018 18:31:27 +0000 (19:31 +0100)]
pipeline: add statistics read action

Add implementation of stats read action

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add TTL update action
Jasvinder Singh [Thu, 29 Mar 2018 18:31:26 +0000 (19:31 +0100)]
pipeline: add TTL update action

Add implementation of ttl update action.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add NAT action
Jasvinder Singh [Thu, 29 Mar 2018 18:31:25 +0000 (19:31 +0100)]
pipeline: add NAT action

Add implementation of Network Address Translation(NAT) action.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add packet encapsulation action
Jasvinder Singh [Thu, 29 Mar 2018 18:31:24 +0000 (19:31 +0100)]
pipeline: add packet encapsulation action

Add implementation of different type of packet encap
such as vlan, qinq, mpls, pppoe, etc.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add traffic manager action
Jasvinder Singh [Thu, 29 Mar 2018 18:31:23 +0000 (19:31 +0100)]
pipeline: add traffic manager action

Add implementation of traffic manager action.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add traffic metering action
Jasvinder Singh [Thu, 29 Mar 2018 18:31:22 +0000 (19:31 +0100)]
pipeline: add traffic metering action

Add traffic metering action implementation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: get table action params
Jasvinder Singh [Thu, 29 Mar 2018 18:31:21 +0000 (19:31 +0100)]
pipeline: get table action params

Add API to specify action related parameters such as action
handler, table entry data size, etc. for the pipeline table.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: add table action APIs
Jasvinder Singh [Thu, 29 Mar 2018 18:31:20 +0000 (19:31 +0100)]
pipeline: add table action APIs

This API provides a common set of actions for pipeline tables to speed up
application development.

Each match-action rule added to a pipeline table has associated data
that stores the action context. This data is input to the table
action handler called for every input packet that hits the rule as
part of the table lookup during the pipeline execution.

The pipeline library allows the user to define his own table
actions by providing customized table action handlers (table
lookup) and complete freedom of setting the rules and their data
(table rule add/delete). While the user can still follow this
process, this API is intended to provide a quicker development
alternative for a set of predefined actions.

The typical steps to use this API are:
* Define a table action profile.
* Instantiate the table action profile to create table action objects.
* Use the table action object to generate the pipeline table action
  handlers (invoked by the pipeline table lookup operation).
* Use the table action object to generate the rule data (for the
  pipeline table rule add operation) based on given action parameters.
* Use the table action object to read action data (e.g. stats counters)
  for any given rule.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agobus/fslmc: fix find device start condition
Gaetan Rivet [Thu, 22 Mar 2018 10:28:44 +0000 (11:28 +0100)]
bus/fslmc: fix find device start condition

If start is set and a device before it matches the data,
this device is returned.

Fixes: c7fe1eea8a74 ("bus: simplify finding starting point")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoeal: provide API for querying valid socket ids
Anatoly Burakov [Sat, 31 Mar 2018 17:08:13 +0000 (18:08 +0100)]
eal: provide API for querying valid socket ids

During lcore scan, find all socket ID's and store them, and
provide public API to query valid socket id's. This will break
the ABI, so bump ABI version.

Also, remove deprecation notice corresponding to this change.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
6 years agoeal: add IPC asynchronous request
Anatoly Burakov [Sat, 31 Mar 2018 17:06:16 +0000 (18:06 +0100)]
eal: add IPC asynchronous request

This API is similar to the blocking API that is already present,
but reply will be received in a separate callback by the caller
(callback specified at the time of request, rather than registering
for it in advance).

Under the hood, we create a separate thread to deal with replies to
asynchronous requests, that will just wait to be notified by the
main thread, or woken up on a timer.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
6 years agoeal: rename IPC request as synchronous one
Anatoly Burakov [Sat, 31 Mar 2018 17:06:15 +0000 (18:06 +0100)]
eal: rename IPC request as synchronous one

Rename rte_mp_request to rte_mp_request_sync to indicate
that this request will be done synchronously (as opposed to
asynchronous request, which comes in next patch).

Also, fix alphabetical ordering for .map file.

Suggested-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
6 years agoeal: rename IPC sync request to pending request
Anatoly Burakov [Sat, 31 Mar 2018 17:06:14 +0000 (18:06 +0100)]
eal: rename IPC sync request to pending request

Originally, there was only one type of request which was used
for multiprocess synchronization (hence the name - sync request).

However, now that we are going to have two types of requests,
synchronous and asynchronous, having it named "sync request" is
very confusing, so we will rename it to "pending request". This
is internal-only, so no externally visible API changes.

Suggested-by: Jianfeng Tan <jianfeng.tan@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
6 years agocommon/octeontx: move mbox to common folder
Pavan Nikhilesh [Wed, 4 Apr 2018 14:30:25 +0000 (20:00 +0530)]
common/octeontx: move mbox to common folder

Move commonly used functions across mempool, event and net devices to a
common folder in drivers.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
6 years agodrivers: add common folder
Pavan Nikhilesh [Wed, 4 Apr 2018 14:30:24 +0000 (20:00 +0530)]
drivers: add common folder

Add driver/common folder and skeleton makefile for adding commonly used
functions across mempool, event and net devices.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
6 years agombuf: fix truncated strncpy
Stephen Hemminger [Thu, 29 Mar 2018 17:05:30 +0000 (10:05 -0700)]
mbuf: fix truncated strncpy

Gcc-8 discovers issue with platform_mempool_ops.
rte_mbuf_pool_ops.c:26:3: error: ‘strncpy’ output truncated before
  terminating nul copying as many bytes from a string as its length
  [-Werror=stringop-truncation]
  strncpy(mz->addr, ops_name,  strlen(ops_name));

Since the ops_name is already checked for size, using strncpy
here is unnecessary; just use strcpy.

Fixes: a3acc3144a76 ("mbuf: add pool ops selection functions")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agometrics: fix potential missing string termination
Remy Horton [Tue, 20 Feb 2018 16:05:59 +0000 (16:05 +0000)]
metrics: fix potential missing string termination

Fixes a potential memory overrun detected by Coverity.
This overrun cannot currently happen in practice because
rte_metrics_reg_names() explicitly forces the last name
character to be a NULL terminator.

This patches uses strlcpy instead of strncpy to copy name strings.

Coverity issue: 143434
Fixes: 349950ddb9c5 ("metrics: add information metrics library")
Fixes: 710cab6f675a ("metrics: fix out of bound access")

Signed-off-by: Remy Horton <remy.horton@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoconvert snprintf to strlcpy
Bruce Richardson [Mon, 12 Mar 2018 11:33:00 +0000 (11:33 +0000)]
convert snprintf to strlcpy

Since we have support for the strlcpy function in DPDK, replace all
instances where a string is copied using snprintf.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoeal: support strlcpy function
Bruce Richardson [Mon, 12 Mar 2018 11:32:59 +0000 (11:32 +0000)]
eal: support strlcpy function

The strncpy function is error prone for doing "safe" string copies, so
we generally try to use "snprintf" instead in the code. The function
"strlcpy" is a better alternative, since it better conveys the
intention of the programmer, and doesn't suffer from the non-null
terminating behaviour of it's n'ed brethern.

The downside of this function is that it is not available by default
on linux, though standard in the BSD's. It is available on most
distros by installing "libbsd" package.

This patch therefore provides the following in rte_string_fns.h to ensure
that strlcpy is available there:
* for BSD, include string.h as normal
* if RTE_USE_LIBBSD is set, include <bsd/string.h>
* if not set, fallback to snprintf for strlcpy

Using make build system, the RTE_USE_LIBBSD is a hard-coded value to "n",
but when using meson, it's automatically set based on what is available
on the platform.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoeal: add functions for previous power of 2 alignment
Pavan Nikhilesh [Wed, 4 Apr 2018 13:20:16 +0000 (18:50 +0530)]
eal: add functions for previous power of 2 alignment

Add 32b and 64b API's to align the given integer to the previous power
of 2. Update common auto test to include test for previous power of 2 for
both 32 and 64bit integers.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoeal: add macros to align value to multiple
Pavan Nikhilesh [Tue, 20 Mar 2018 13:24:34 +0000 (18:54 +0530)]
eal: add macros to align value to multiple

Add macros to align given value to the multiple of the supplied
integer.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agomem: use z specifier to format size_t
Stephen Hemminger [Thu, 15 Feb 2018 22:25:50 +0000 (14:25 -0800)]
mem: use z specifier to format size_t

The recommended way to format size_t in printf is to use the
z modifier which handles the case where size_t maybe 32 or 64 bits.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agopci: use z specifier to format size_t
Stephen Hemminger [Thu, 15 Feb 2018 22:25:49 +0000 (14:25 -0800)]
pci: use z specifier to format size_t

This addresses potential issues where size_t and off_t can vary
on some platforms.  For size_t the best way to format the value
is to use the z modifier to printf. For off_t need to cast to
long long to handle 64 bit offset on 32 bit platforms.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>