Commit Graph

67 Commits

Author SHA1 Message Date
Jerin Jacob
c0583d98a9 eal: introduce macro for always inline
Different drivers use internal macros like force_inline for compiler
always inline feature.
Standardizing it through __rte_always_inline macro.

Verified the change by comparing the output binary file.
No difference found in the output binary file with this change.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-06-06 17:21:55 +02:00
Andriy Berestovskyy
871b8b8c7d port: fix minor typo
Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2017-04-21 02:15:29 +02:00
Andriy Berestovskyy
614fcaca62 port: fix file descriptor reader
The code should return the actual number of packets read.

Fixes: 5a99f208 ("port: support file descriptor")

Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2017-04-21 02:15:26 +02:00
Andriy Berestovskyy
25f2af0884 port: use mbuf alloc bulk instead of mempool
Makes code a bit cleaner and type-aware.

Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2017-04-21 02:15:23 +02:00
Stephen Hemminger
c5ba278876 lib: remove unnecessary void cast
Remove unnecessary casts of void * pointers to a specific type.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-11 18:05:10 +02:00
Bruce Richardson
ecaed092b6 ring: return remaining entry count when dequeuing
Add an extra parameter to the ring dequeue burst/bulk functions so that
those functions can optionally return the amount of remaining objs in the
ring. This information can be used by applications in a number of ways,
for instance, with single-consumer queues, it provides a max
dequeue size which is guaranteed to work.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2017-03-29 22:32:20 +02:00
Bruce Richardson
14fbffb0aa ring: return free space when enqueuing
Add an extra parameter to the ring enqueue burst/bulk functions so that
those functions can optionally return the amount of free space in the
ring. This information can be used by applications in a number of ways,
for instance, with single-producer queues, it provides a max
enqueue size which is guaranteed to work. It can also be used to
implement watermark functionality in apps, replacing the older
functionality with a more flexible version, which enables apps to
implement multiple watermark thresholds, rather than just one.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2017-03-29 22:32:04 +02:00
Bruce Richardson
8526571400 ring: create common structure for prod and cons metadata
create a common structure to hold the metadata for the producer and
the consumer, since both need essentially the same information - the
head and tail values, the ring size and mask.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2017-03-29 22:25:13 +02:00
Olivier Matz
feb9f680cd mk: optimize directory dependencies
Before this patch, the management of dependencies between directories
had several issues:

- the generation of .depdirs, done at configuration is slow: it can take
  more than one minute on some slow targets (usually ~10s on a standard
  PC without -j).

- for instance, it is possible to express a dependency like:
  - app/foo depends on lib/librte_foo
  - and lib/librte_foo depends on app/bar
  But this won't work because the directories are traversed with a
  depth-first algorithm, so we have to choose between doing 'app' before
  or after 'lib'.

- the script depdirs-rule.sh is too complex.

- we cannot use "make -d" for debug, because the output of make is used for
  the generation of .depdirs.

This patch moves the DEPDIRS-* variables in the upper Makefile, making
the dependencies much easier to calculate. A DEPDIRS variable is still
used to process library dependencies in LDLIBS.

After this commit, "make config" is almost immediate.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Robin Jarry <robin.jarry@6wind.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-03-27 23:28:43 +02:00
Jasvinder Singh
5a99f20868 port: support file descriptor
This patch adds File Descriptor(FD) port type (e.g. TAP port) to the
packet framework library that allows interface with the kernel network
stack. The FD port APIs are defined that allow port creation, writing
and reading packet from the kernel interface.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-10-13 11:42:37 +02:00
Jasvinder Singh
3275de7be8 port: modify source and sink port structure
The ``file_name`` data type of ``struct rte_port_source_params`` and
``struct rte_port_sink_params`` is changed from `char *`` to ``const char *``.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-10-12 22:25:24 +02:00
Ferruh Yigit
43ea400494 port: remove duplicated symbols from .map
Fixes: 9d41beed24 ("lib: provide initial versioning")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-06-30 20:02:56 +02:00
Panu Matilainen
05dc7b05da port: fix build without KNI
Commit 9fc37d1c07 is missing a conditional in the dependencies,
causing builds to fail when KNI is not enabled:
    == Build lib/librte_port
      LD librte_port.so.3
    /usr/bin/ld: cannot find -lrte_kni
    collect2: error: ld returned 1 exit status

Fixes: 9fc37d1c07 ("port: support KNI")

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-06-27 12:28:10 +02:00
WeiJie Zhuang
9fc37d1c07 port: support KNI
add KNI port type to the packet framework

Signed-off-by: WeiJie Zhuang <zhuangwj@gmail.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-06-21 18:05:45 +02:00
Christian Ehrhardt
6cbf4f75e0 mk: fix missing internal dependencies
This patch adds missing DEPDIRS to avoid any library referring to
symbols they are not linked against.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2016-06-13 16:17:56 +02:00
Thomas Monjalon
76653f3e11 port: bump ABI for pcap file support
Support of PCAP file has been added to rte_port in release 16.04
as NEXT_ABI. It is in the standard ABI of the release 16.07.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-04-20 11:53:32 +02:00
Jasvinder Singh
356445f97a port: fix ring writer buffer overflow
Fixes the buffer overflow that occurs due to following;

1. When the input packet burst does not meet the conditions: (a) being
contiguous (first n bits set in pkts_mask, all the other bits cleared)
and (b) containing a full burst, i.e. at least tx_burst_sz packets
(n >= tx_burst_size). This is the slow(er) code path taken when local
variable expr != 0.
2. There are some packets already in the buffer.
3. The number of packets in the incoming burst (i.e. popcount(pkts_mask))
plus the number of packets already in the buffer exceeds the buffer size
(RTE_PORT_IN_BURST_SIZE_MAX, i.e. 64).

Fixes: bf6931b242 ("port: ring")
Fixes: 5f4cd47309 ("port: add ring writer nodrop")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-04-11 22:28:58 +02:00
Jasvinder Singh
52f7a5aeb1 port: fix burst size mask type
Fixes the variable bsz_mask type from uint32_t to uint64_t

Fixes: 4d97e8b565 ("port: ethdev")
Fixes: 304c8091e9 ("port: add ethdev writer nodrop")
Fixes: 8dceb6aa6e ("port: hierarchical scheduler")
Fixes: 3e5966837a ("port: new Tx burst implementation of ring writer")
Fixes: 5f4cd47309 ("port: add ring writer nodrop")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-04-11 22:22:08 +02:00
Fan Zhang
063e6273b7 port: clean up
This patch clean-up the code in librte_port.
The clean-up includes the following:

* Clearer error message display.
* Remove unnecessary RTE_NEXT_ABI macro warping.
* Remove __rte_unused attribute

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-04-01 23:08:25 +02:00
Fan Zhang
718a2f0cfb port: fix pcap sink parameter check
This patch fixes sink port parameter checking logic.
Originally, if user set field "file_name" with meaning value
but leave PCAP support feature disabled, the program simply
ignores this field without notifying the user.

Fixes: eb5f4119b2 ("port: add pcap file dump")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-04-01 23:08:25 +02:00
Fan Zhang
e1535fb7b8 port: fix pcap source parameter check
This patch fixes source port parameter checking logic.
Originally, if user set field "file_name" with meaning value
but leave PCAP support feature disabled, the program simply
ignores this field without notifying the user.

Fixes: d4b42133d8 ("port: add pcap file source")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-04-01 23:08:25 +02:00
Fan Zhang
eb5f4119b2 port: add pcap file dump
Originally, sink ports in librte_port releases received mbufs back to
mempool. This patch adds optional packet dumping to PCAP feature in sink
port: the packets will be dumped to user defined PCAP file for storage or
debugging. The user may also choose the sink port's activity: either it
continuously dump the packets to the file, or stops at certain dumping

This feature shares same CONFIG_RTE_PORT_PCAP compiler option as source
port PCAP file support feature. Users can enable or disable this feature
by setting CONFIG_RTE_PORT_PCAP compiler option "y" or "n".

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-03-13 16:04:11 +01:00
Fan Zhang
d4b42133d8 port: add pcap file source
Originally, source ports in librte_port is an input port used as packet
generator. Similar to Linux kernel /dev/zero character device, it
generates null packets. This patch adds optional PCAP file support to
source port: instead of sending NULL packets, the source port generates
packets copied from a PCAP file. To increase the performance, the packets
in the file are loaded to memory initially, and copied to mbufs in circular
manner. Users can enable or disable this feature by setting
CONFIG_RTE_PORT_PCAP compiler option "y" or "n".

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-03-13 16:04:02 +01:00
Jasvinder Singh
fa11a8a725 port: fix crash for ring writer nodrop
Error log:
 [APP] Initializing PIPELINE0 ...
 pipeline> [APP] Initializing PIPELINE1 ...
 [PIPELINE1] Pass-through
 [APP] Initializing PIPELINE2 ...
 [PIPELINE2] Pass-through
 Segmentation fault (core dumped)

Fixes: 5f4cd47309 ("port: add ring writer nodrop")
Fixes: d58f69c541 ("port: add ring multi reader or writer")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
2016-03-07 11:52:39 +01:00
Jasvinder Singh
04f366906a port: fix crash for ethdev writer nodrop
Error log:
 [APP] Initializing PIPELINE0 ...
 pipeline> [APP] Initializing PIPELINE1 ...
 [PIPELINE1] Pass-through
 Segmentation fault (core dumped)

Fixes: 304c8091e9 ("port: add ethdev writer nodrop")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2016-03-07 11:52:14 +01:00
Thomas Monjalon
4b15247150 doc: drop old naming of the project
It was requested by Intel, more than one year ago, to replace the name
"Intel DPDK" by "DPDK".
Some references to the old name were still in some docs and code comments,
leading to confusion.

Fixes: ac8ada004c ("doc: remove Intel references from release notes")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2016-02-10 15:47:51 +01:00
Fan Zhang
472f99696d port: fix sink port statistics
Fixes the sink port statistics incomplete problem.

Fixes: ef3403fb6f ("port: source and sink")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-12-07 01:03:13 +01:00
Fan Zhang
3064c3955b port: fix mbuf allocation in source port
Fixes the mbuf allocation not initialized problem. This problem will cause
the mbufs not be able to freed back to mempool by rte_pktmbuf_free().

Fixes: ef3403fb6f ("port: source and sink")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-12-07 01:03:13 +01:00
Piotr Azarewicz
d2b55249bc port: fix reassembly and fragmentation
Bug fixes for ring ports with IPv4/IPv6 reassembly support.
Previous implementation can't work properly due to incorrect choosing
process function.
Also, assuming that, when processing ip packet, ip header is know we can
set l3_len parameter here.

Fix usage RTE_MBUF_METADATA_* macros due to redefinition the macros.

Fixes: 50f54a84df ("port: add IPv6 reassembly port")
Fixes: ba92d511dd ("port: move metadata offset reference at mbuf head")

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-11-26 00:32:12 +01:00
Piotr Azarewicz
d58f69c541 port: add ring multi reader or writer
ring_multi_reader input port (on top of multi consumer rte_ring)
ring_multi_writer output port (on top of multi producer rte_ring)

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-11-26 00:32:12 +01:00
Fan Zhang
ba92d511dd port: move metadata offset reference at mbuf head
This patch relates to ABI change proposed for librte_port. Macros to
access the packet meta-data stored within the packet buffer has been
adjusted to cover the packet mbuf structure.

The LIBABIVER number is incremented.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-10-19 17:00:36 +02:00
Piotr Azarewicz
4f8e575f89 ip_frag: fix bit-fields in ipv6 fragment extension
Previous implementation won't work on every environment. The order of
allocation of bit-fields within a unit (high-order to low-order or
low-order to high-order) is implementation-defined.
Solution: used bytes instead of bit fields.

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-10-08 13:15:17 +02:00
Sergio Gonzalez Monroy
2f9d47013e 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>
2015-07-16 13:44:48 +02:00
Maciej Gajdzica
7c6e7a0e38 port: fix missing exported symbols
Exported symbols for nodrop, fragmentation, reassembly ports

Fixes: 304c8091e9 ("port: add ethdev writer nodrop")
Fixes: 5f4cd47309 ("port: add ring writer nodrop")
Fixes: bf673b7553 ("port: add IPv6 fragmentation port")
Fixes: 50f54a84df ("port: add IPv6 reassembly port")

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-07-09 17:25:45 +02:00
Cyril Chemparathy
82be8d5442 mbuf: use offset macro
This patch simply applies the transform previously committed in
scripts/cocci/mtod-offset.cocci.  No other modifications have been
made here.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2015-06-24 12:01:14 +02:00
Maciej Gajdzica
4d7eabf9f7 port: add source stats
Added statistics for source port.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-23 23:31:14 +02:00
Maciej Gajdzica
3276f38f3e port: add sched stats
Added statistics for sched reader port.
Added statistics for sched writer port.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-23 23:31:14 +02:00
Maciej Gajdzica
2720714d67 port: add ring stats
Added statistics for ring reader port.
Added statistics for port writer port.
Added statistics for ring writer nodrop port.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-23 23:31:14 +02:00
Maciej Gajdzica
b42ed36368 port: add reassembly stats
Added statistics for IPv4 and IPv6 reassembly ports.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-23 23:31:14 +02:00
Maciej Gajdzica
a2ba0b9fe8 port: add fragmentation stats
Added statistics for IPv4 and IPv6 fragmentation ports.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-23 23:31:07 +02:00
Maciej Gajdzica
839a1ce450 port: add ethdev stats
Added statistics for ethdev reader port.
Added statistics for ethdev writer port.
Added statistics for ethdev writer nodrop port.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-23 23:26:13 +02:00
Maciej Gajdzica
45c24d8320 port: add stats structures and config option
Added common data structures for port statistics.
Added config option to enable stats collecting.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-23 23:15:34 +02:00
Daniel Mrzyglod
1129992baa port: fix unaligned access to metadata
Fix RTE_MBUF_METADATA macros to allow for unaligned accesses to
meta-data fields.
Forcing aligned accesses is not really required, so this is removing an
unneeded constraint.
This issue was met during testing of the new version of the ip_pipeline
application. There is no performance impact.
This change has no ABI impact, as the previous code that uses aligned
accesses continues to run without any issues.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-22 22:10:46 +02:00
Maciej Gajdzica
5f4cd47309 port: add ring writer nodrop
When ring_writer_nodrop port fails to send data, it tries to resend.
Operation is aborted when maximum number of retries is reached.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-18 16:41:13 +02:00
Maciej Gajdzica
304c8091e9 port: add ethdev writer nodrop
When ethdev_writer_nodrop port fails to send data, it tries to resend.
Operation is aborted when maximum number of retries is reached.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-18 16:37:57 +02:00
Maciej Gajdzica
3e5966837a port: new Tx burst implementation of ring writer
New implementation sends burst without copying data to internal buffer
if it is possible. It is similar to tx_bulk function in ethdev_writer
port.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-18 16:35:55 +02:00
Maciej Gajdzica
5f88602e0a port: remove an ethdev writer implementation
There was two implementations of tx_bulk function in ethdev_writer port.
The function to run is chosen with WRITER_APPROACH define. This patch
removes WRITER_APPROACH = 0 implementation, as it seems to be slower.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-06-18 16:34:12 +02:00
Maciej Gajdzica
50f54a84df port: add IPv6 reassembly port
Added new port type - IPv6 reassembly port.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-05-18 12:28:52 +02:00
Maciej Gajdzica
bf673b7553 port: add IPv6 fragmentation port
Added new port type - IPv6 Fragmentation port

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-05-18 12:26:33 +02:00
Maciej Gajdzica
ab6f89f1ca port: remove constant default MTU
p->mtu field should be used instead.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2015-05-17 23:46:56 +02:00