dpdk.git
8 years agolog: deprecate history dump
Thomas Monjalon [Thu, 9 Jun 2016 13:49:48 +0000 (15:49 +0200)]
log: deprecate history dump

The log history uses rte_mempool. In order to remove the mempool
dependency in EAL (and improve the build), this feature is deprecated.
The ABI is kept but the behaviour is now voided because it seems this
function was not used. The history can be read from syslog.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agomk: generate internal library dependencies
Panu Matilainen [Tue, 7 Jun 2016 10:01:54 +0000 (13:01 +0300)]
mk: generate internal library dependencies

Up to now dependencies between DPDK internal libraries have been
untracked at shared library level, requiring applications to know
about library internal dependencies and often consequently overlinking.

Since the dependencies are already recorded for build ordering in the
makefiles with DEPDIRS-y we can use that information to generate LDLIBS
entries for internal libraries automatically.

Also revert commit 8180554d82b3 ("vhost: fix linkage of driver with
library") which is made redundant by this change.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
8 years agodoc: fix code section in versioning guide
John McNamara [Fri, 20 May 2016 14:08:39 +0000 (15:08 +0100)]
doc: fix code section in versioning guide

Fix broken console directive in the ABI validator section of the
ABI versioning docs.

Fixes: f1ef9794f9bd ("doc: add ABI guidelines")

Signed-off-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: fix testpmd commands for flow director
Mauricio Vasquez B [Tue, 7 Jun 2016 08:48:53 +0000 (10:48 +0200)]
doc: fix testpmd commands for flow director

A previous patch modified the CLIs witout updating the examples.

Fixes: 53b2bb9b7ea7 ("app/testpmd: new flow director commands")

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agodoc: clarify port hotplug in testpmd
Pablo de Lara [Wed, 8 Jun 2016 15:40:17 +0000 (16:40 +0100)]
doc: clarify port hotplug in testpmd

Port needs to be stopped and then closed before it can be detached,
but the documentation was only saying to close the port.

Also, both sections for port detaching and attaching has been reformatted
slightly, to show clearly how to use the commands.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoapp/testpmd: fix typo when closing port
Pablo de Lara [Wed, 8 Jun 2016 15:20:31 +0000 (16:20 +0100)]
app/testpmd: fix typo when closing port

Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: prefetch data in the forwarding loop
Jerin Jacob [Tue, 3 May 2016 14:07:45 +0000 (19:37 +0530)]
app/testpmd: prefetch data in the forwarding loop

prefetch the next packet data address in advance in forwarding loop
for performance improvement.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: log mbuf pool creation
Olivier Matz [Mon, 30 May 2016 12:04:17 +0000 (14:04 +0200)]
app/testpmd: log mbuf pool creation

Enhance the logs related to mbuf pool creation. Display an info level
log when creating the mbuf, and display the error as a string on failure.

After the patch, we have:

  [...]
  EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
  USER1: create a new mbuf pool <mbuf_pool_socket_0>: n=331456, \
      size=2176, socket=0
  EAL: Error - exiting with code: 1
    Cause: Creation of mbuf pool for socket 0 failed: Cannot allocate \
      memory

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: add Tx flags in config command
Maciej Czekaj [Fri, 22 Apr 2016 14:51:20 +0000 (16:51 +0200)]
app/testpmd: add Tx flags in config command

"port config all txqflags <value>" allows for
specifying txq_flags value in command line.

Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: add scatter enabling in config command
Maciej Czekaj [Fri, 22 Apr 2016 14:51:19 +0000 (16:51 +0200)]
app/testpmd: add scatter enabling in config command

"port config all scatter on|off" allows for
controlling rxmode.enable_scatter in command line.

Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: add scatter enabling option
Maciej Czekaj [Fri, 22 Apr 2016 14:51:18 +0000 (16:51 +0200)]
app/testpmd: add scatter enabling option

This parameter allows for controlling rxmode.enable_scatter
which in turn allow for multi-segment packet receive tests.

Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/quota_watermark: fix memory overflow
Piotr Azarewicz [Mon, 23 May 2016 12:19:56 +0000 (14:19 +0200)]
examples/quota_watermark: fix memory overflow

qw app at its init stage reserve 2*sizeof(int) memory space for quota
and low_watermark shared variables, but both apps (qw and qwctl) assign
wrong address for low_watermark pointer (out of reserved memzone space)
due to wrong pointer arithmetic.

CID 30709 : Extra sizeof expression (SIZEOF_MISMATCH)
suspicious_pointer_arithmetic: Adding 4UL /* sizeof (int) */ to pointer
(unsigned int *)(*qw_memzone).addr of type unsigned int * is suspicious
because adding an integral value to this pointer automatically scales
that value by the size, 4 bytes, of the pointed-to type, unsigned int.
Most likely, sizeof (int) is extraneous and should be replaced with 1.

Coverity issue: 30709
Fixes: 1d6c3ee3321a ("examples/quota_watermark: initial import")

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
8 years agoexamples/performance-thread: fix size of destination port ids
Tomasz Kulasek [Fri, 29 Apr 2016 16:30:24 +0000 (18:30 +0200)]
examples/performance-thread: fix size of destination port ids

After extending IPv4 next hop in lpm library, size of dst_port array was
changed from 16 to 32 bits in l3fwd-thread example, without modification
of the rest of path written for 16 bit value.

This patch uses similar approach for fix, like in commit 8353a36a9b4b
("examples/l3fwd: fix size of destination port ids"), restoring 16 bit size
for destination port ids and doing necessary conversion from 32 to 16 bit
after lpm_lookupx4.

Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
8 years agoexamples/performance-thread: fix destination port
Tomasz Kulasek [Fri, 29 Apr 2016 16:30:56 +0000 (18:30 +0200)]
examples/performance-thread: fix destination port

This fixes wrong logic in get_dst_port() on lpm path causing unpredictable
return value when ipv4/ipv6 lookup success (return with no value).

Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
8 years agoexamples/l3fwd: report error when no vector engine available
Jan Viktorin [Tue, 26 Apr 2016 11:30:59 +0000 (13:30 +0200)]
examples/l3fwd: report error when no vector engine available

If no SSE nor NEON are available the l3fwd should complain loudly
to quickly find out the reason.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agoexamples/l2fwd-jobstats: fix a typo
Rami Rosen [Thu, 21 Apr 2016 18:16:47 +0000 (21:16 +0300)]
examples/l2fwd-jobstats: fix a typo

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
8 years agoexamples/l2fwd: increase mempool cache size for performance
Jerin Jacob [Tue, 19 Apr 2016 09:35:28 +0000 (15:05 +0530)]
examples/l2fwd: increase mempool cache size for performance

l3fwd sets the mempool cache size to 256, selected the same value for l2fwd

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
8 years agoexamples/l2fwd: remove hardcoded cycles per second
Jerin Jacob [Tue, 19 Apr 2016 09:35:27 +0000 (15:05 +0530)]
examples/l2fwd: remove hardcoded cycles per second

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
8 years agoexamples/ip_pipeline: add sample configs for various layers
Jasvinder Singh [Wed, 1 Jun 2016 14:01:02 +0000 (15:01 +0100)]
examples/ip_pipeline: add sample configs for various layers

The sample configuration file demonstrates that network layer components such
as TCP, UDP, ICMP etc, can be easily integrated into ip pipeline infrastructure.
Similarily, various other functionalities such as IP Reassembly for input
traffic with local destination and IP Fragmentation to enforce the MTU for
the routed output traffic, can be added using SWQs enabled with
reassembly and fragmentation features.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: update routes when ports state change
Jasvinder Singh [Wed, 1 Jun 2016 14:01:01 +0000 (15:01 +0100)]
examples/ip_pipeline: update routes when ports state change

The routing pipeline registers a callback function with the nic ports and
this function is invoked for updating the routing entries (corresponding to
local host and directly attached network) tables whenever the nic ports
change their states (up/down).

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: assign MAC address to routing ports
Jasvinder Singh [Wed, 1 Jun 2016 14:01:00 +0000 (15:01 +0100)]
examples/ip_pipeline: assign MAC address to routing ports

As a result of tracking, output ports of routing pipelines are linked with
physical nic ports (potentially through other pipeline instances).
Thus, the mac addresses of the NIC ports are assigned to routing pipeline
out ports which are connected to them and are further used in routing table
entries instead of hardcoded default values.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: link routing output ports to devices
Jasvinder Singh [Wed, 1 Jun 2016 14:00:59 +0000 (15:00 +0100)]
examples/ip_pipeline: link routing output ports to devices

This commit implements tracking mechanism for linking routing pipeline
output ports to physical NIC ports.

Once all the pipelines of the application are initialised, mechanism is
invoked during post initialisation phase for relating routing pipeline
output with NIC ports by navigating through the intermediate pipelines,
if present.

The tracking functions of the pipelines which help in navigating through
the intermediate pipelines are moved from pipeline_<pipeline_name>_be.c
to pipeline_<pipeline_name>.c. All pipelines except passthrough pipelines
use default tracking function (pipeline/pipeline_common_fe.c).

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: increase constants
Jasvinder Singh [Wed, 1 Jun 2016 14:00:58 +0000 (15:00 +0100)]
examples/ip_pipeline: increase constants

To allow more queues, pipeline types, threads, source/sink ports,etc., in
the ip pipeline application, larger values of macros are set.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: support RSS
Jasvinder Singh [Mon, 30 May 2016 17:14:49 +0000 (18:14 +0100)]
examples/ip_pipeline: support RSS

This patch enables rss (receive side scaling) per network interface
through the configuration file. The user can specify following
parameters in LINK section for enabling the rss feature - rss_qs,
rss_proto_ipv4, rss_proto_ipv6 and ip_proto_l2.

The "rss_qs" is mandatory parameter which indicates the queues to be
used for rss, while rest of the parameters are optional. When optional
parameters are not provided in the configuration file, default setting
(ETH_RSS_IPV4 | ETH_RSS_IPV6) is assumed for "rss_hf" field of the
rss_conf structure.

For example, following configuration can be applied for using the rss
on port 0 of the network interface;

[PIPELINE0]
type = MASTER
core = 0

[LINK0]
rss_qs = 0 1

[PIPELINE1]
type = PASS-THROUGH
core = 1
pktq_in = RXQ0.0 RXQ0.1 RXQ1.0
pktq_out = TXQ0.0 TXQ1.0 TXQ0.1

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: clean up configuration parser
Jasvinder Singh [Wed, 8 Jun 2016 16:30:56 +0000 (17:30 +0100)]
examples/ip_pipeline: clean up configuration parser

This commit adds following changes to configuration file parsing of
the ip pipeline application;

1. Parsing routines related to packet queues (pktq_in/out fields in the
PIPELINE section) and message queues (msgq_in/out fields of in the MSGQ
Section) are updated.

In the parsing routines, function "strtok_r()" is used for parsing the
string instead of manually checking the string termination, white
spaces, tabs etc., between the string tokens. Each call to strtok_r()
returns a pointer to a null-terminated string containing the next token.
If no more tokens are found, strtok_r() returns NULL. As a result of
using strtok_r(), the code size of the parsing routines is reduced
significantly.

2. Replace PARSER_PARAM_ADD_CHECK macro by more specific macros such as
PARSE_CHECK_DUPLICATE_SECTION, PARSE_CHECK_DUPLICATE_SECTION_EAL to detect
duplicate entries in the various sections of the configuration file

3. Add new macros PARSER_ERROR_NO_ELEMENTS and PARSE_ERROR_TOO_MANY_ELEMENTS
for detecting no element and more elements than allowed situations
respectively, in the section entry.

4. Add new macros APP_PARAM_ADD_LINK_FOR_RXQ, APP_PARAM_ADD_LINK_FOR_TXQ
and APP_PARAM_ADD_LINK_FOR_TM which add corresponding nic ports entry to
the application param structure while parsing rx/tx queues, TM (Traffic
Manager) port sections and pktq_in/out entries of pipeline sections

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: update edge router use case
Piotr Azarewicz [Wed, 8 Jun 2016 10:35:25 +0000 (12:35 +0200)]
examples/ip_pipeline: update edge router use case

Update edge router usecase config files to use bulk commands.

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: rework routing CLI
Piotr Azarewicz [Wed, 8 Jun 2016 10:35:24 +0000 (12:35 +0200)]
examples/ip_pipeline: rework routing CLI

Several routing commands are merged into two commands:
route and arp - these two commands are handled by cli library.
Rest of the commands are handled internaly by the pipeline code.

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: rework flow action CLI
Piotr Azarewicz [Wed, 8 Jun 2016 10:35:23 +0000 (12:35 +0200)]
examples/ip_pipeline: rework flow action CLI

All commands merged into one: cmd_action_parsed.

modified bulk command:
action flow bulk
File line format:
flow <flow ID>
meter 0 <cir> <pir> <cbs> <pbs> meter 1 <cir> <pir> <cbs> <pbs> meter 2
<cir> <pir> <cbs> <pbs> meter 3 <cir> <pir> <cbs> <pbs>
policer 0 <action> <action> <action> policer 1 <action> <action>
<action> policer 2 <action> <action> <action> policer 3 <action>
<action> <action>
port <port ID>

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: rework flow classification CLI
Tomasz Kulasek [Wed, 8 Jun 2016 10:35:22 +0000 (12:35 +0200)]
examples/ip_pipeline: rework flow classification CLI

This patch modifies flow classifications pipeline command line
interface. All commands are merged into one cmd_fc_parsed.
Additionally a classification for ipv6, ipv4 and qinq can be added from
configuration file.

1. flow add qinq bulk
File line format:
qinq <svlan> <cvlan> port <port ID> id <flow ID>
File line example:
qinq 1 2 port 3 id 0

2. flow add ipv4 bulk
File line format:
ipv4 <sipaddr> <dipaddr> <sport> <dport> <proto> port <port ID> id
<flowID>
File line example:
ipv4 1.2.3.4 10.20.30.40 63 127 6 port 2 id 999

3. flow add ipv6 bulk
File line format:
ipv6 <sipaddr> <dipaddr> <sport> <dport> <proto> port <port ID> id
<flowID>

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: rework firewall CLI
Daniel Mrzyglod [Wed, 8 Jun 2016 10:35:21 +0000 (12:35 +0200)]
examples/ip_pipeline: rework firewall CLI

Each command are merged into one: cmd_firewall_parsed.
ADD command format is changed:
p <pipeline ID> firewall add priority <priority> ipv4 <sipaddr>
<sipdepth> <dipaddr> <dipdepth> <sport0> <sport1> <dport0> <dport1>
<proto> <protomask> port <port ID>

and bulk command was modified:
1. firewall add bulk
File line format:
priority <priority> ipv4 <sipaddr> <sipdepth> <dipaddr> <dipdepth>
<sport0> <sport1> <dport0> <dport1> <proto> <protomask> port <port ID>
(protomask is a hex value)
File line example:
priority 0 ipv4 1.2.3.0 24 10.20.30.40 32 0 63 64 127 6 0xF port 3

2. firewall del bulk
File line format:
ipv4 <sipaddr> <sipdepth> <dipaddr> <dipdepth> <sport0> <sport1>
<dport0> <dport1> <proto> <protomask>
File line example:
ipv4 1.2.3.0 24 10.20.30.40 32 0 63 64 127 6 0xF

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: rework common CLI
Tomasz Kulasek [Wed, 8 Jun 2016 10:35:20 +0000 (12:35 +0200)]
examples/ip_pipeline: rework common CLI

All link commands are merged into one command:
cmd_link_parsed.
Improve run command to allow run periodically.
Adding static keyword to a lot of token declarations.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: add string parsing helpers
Piotr Azarewicz [Wed, 8 Jun 2016 10:35:19 +0000 (12:35 +0200)]
examples/ip_pipeline: add string parsing helpers

Add a couple of additional functions that will allow to parse many types
of input parameters, i.e.: bool, 16, 32, 64 bits, hex, etc.

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: fix null packet in source port
Fan Zhang [Tue, 17 May 2016 16:02:10 +0000 (17:02 +0100)]
examples/ip_pipeline: fix null packet in source port

This patch fixes the NULL packet processing problem. Originally,
pipeline's write attempt to NULL packets generated by source
port may crash the application.

This patch fixes the problem by enforcing each source port
defined in cfg file containing a user specified or default pcap
file path.

Fixes: 0e1e7d53 ("examples/ip_pipeline: add pcap file source")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agotable: remove unnecessary acl dump
Jasvinder Singh [Thu, 19 May 2016 14:35:08 +0000 (15:35 +0100)]
table: remove unnecessary acl dump

Removes rte_acl_dump() call from rte_table_acl_build () as it invokes
number of printf messages.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/l2fwd-crypto: fix supported key size check
Pablo de Lara [Tue, 12 Apr 2016 10:04:03 +0000 (11:04 +0100)]
examples/l2fwd-crypto: fix supported key size check

When initializing crypto devices within the app,
the provided key sizes are checked against the supported
sizes from the crypto device capabilities.

When the supported sizes are not a range, but a single value,
the check may become an infinite loop (when size is not supported).

Fixes: a061e50a0d97 ("examples/l2fwd-crypto: fix ambiguous input key size")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: Min Cao <min.cao@intel.com>
8 years agodoc: fix l2fwd-crypto sample command
Fan Zhang [Wed, 25 May 2016 09:00:15 +0000 (10:00 +0100)]
doc: fix l2fwd-crypto sample command

Corrected a typo in application name.

Corrected authentication algorithm to fit the sample 16-byte
authentication key.

Fixes: ba7b86b1 ("doc: add l2fwd-crypto sample app guide")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
8 years agoexamples/l2fwd-crypto: enable AES-XCBC-MAC authentication algo
Fan Zhang [Wed, 25 May 2016 09:00:45 +0000 (10:00 +0100)]
examples/l2fwd-crypto: enable AES-XCBC-MAC authentication algo

This patch enables AES-XCBC-MAC authentication algorithm support to
l2fwd-crypto sample application.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
8 years agoexamples/l2fwd-crypto: enable AES-CTR cipher algorithm
Fan Zhang [Fri, 3 Jun 2016 10:11:59 +0000 (11:11 +0100)]
examples/l2fwd-crypto: enable AES-CTR cipher algorithm

This patch enables AES counter mode algorithm support to l2fwd-crypto
sample application.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoaesni_mb: add AES-CTR
Fan Zhang [Fri, 3 Jun 2016 10:11:57 +0000 (11:11 +0100)]
aesni_mb: add AES-CTR

This patch provides counter mode support to AES-NI multi-buffer library.

The following cipher algorithm is enabled:
- RTE_CRYPTO_CIPHER_AES_CTR

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: add AES-CTR
Arek Kusztal [Fri, 6 May 2016 10:22:16 +0000 (11:22 +0100)]
app/test: add AES-CTR

Added tests cases for AES working in counter mode.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoqat: add AES-CTR capability
Arek Kusztal [Fri, 6 May 2016 10:22:15 +0000 (11:22 +0100)]
qat: add AES-CTR capability

Added possibility for AES to work in counter mode

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoqat: set default optimization level
Arek Kusztal [Tue, 7 Jun 2016 16:58:14 +0000 (17:58 +0100)]
qat: set default optimization level

Changed to -O3 optimization flag in Intel QuickAssist Technology Makefile.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoqat: avoid strict-aliasing break
Arek Kusztal [Tue, 7 Jun 2016 16:58:13 +0000 (17:58 +0100)]
qat: avoid strict-aliasing break

To avoid GCC warning about "dereferencing type-punned pointer will break
strict-aliasing rules" aad_len pointer is dereferenced instead of direct
dereferencing of uint32_t* cast of the middle of an array.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoqat: fix physical address of content descriptor
Arek Kusztal [Wed, 1 Jun 2016 10:52:00 +0000 (11:52 +0100)]
qat: fix physical address of content descriptor

Fix an error with computation of physical address of
content descriptor in the symmetric operations session

Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoqat: fix null pointer dereferencing
Deepak Kumar Jain [Wed, 18 May 2016 16:12:38 +0000 (17:12 +0100)]
qat: fix null pointer dereferencing

Fix null pointer dereferencing while clearing session

Coverity issue: 126586
Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoaesni_mb: fix null pointer dereferencing
Deepak Kumar Jain [Tue, 7 Jun 2016 09:36:11 +0000 (10:36 +0100)]
aesni_mb: fix null pointer dereferencing

Fix null pointer dereferencing by reporting if null and
exiting the function.

Coverity issue: 126584
Fixes: c0f87eb5252b ("cryptodev: change burst API to be crypto op oriented")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoaesni_mb: fix an indent
Deepak Kumar Jain [Tue, 7 Jun 2016 09:34:44 +0000 (10:34 +0100)]
aesni_mb: fix an indent

Fix wrong indentation for return value

Coverity issue: 126585
Fixes: 924e84f87306 ("aesni_mb: add driver for multi buffer based crypto")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agodoc: fix supported AES-CBC key lengths
Pablo de Lara [Thu, 5 May 2016 10:00:45 +0000 (11:00 +0100)]
doc: fix supported AES-CBC key lengths

AES-NI MB PMD supports 128, 192 and 256-bit keys,
not 128, 256 and 512-bit keys.

Fixes: 924e84f87306 ("aesni_mb: add driver for multi buffer based crypto")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoivshmem: add all memzones of mempool to metadata
Ferruh Yigit [Fri, 3 Jun 2016 16:38:38 +0000 (17:38 +0100)]
ivshmem: add all memzones of mempool to metadata

Mempool consist of multiple memzones, at least from two of them.
ivshmem assumes mempool and elements are all in same memzone.

Updating code to add all memzones when a mempool added.

Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoivshmem: document a potential crash in rte_ring
Anatoly Burakov [Wed, 1 Jun 2016 14:51:57 +0000 (15:51 +0100)]
ivshmem: document a potential crash in rte_ring

Commit 4768c475 added a pointer to the memzone in rte_ring. However,
all memzones are residing in local mem_config, therefore accessing
the memzone pointer inside the guest in an IVSHMEM-shared rte_ring
will cause segmentation fault. This issue is unlikely to ever get
fixed, as this would require lots of changes for very little benefit,
therefore we're documenting this limitation instead.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
8 years agoivshmem: fix overlap detection
Anatoly Burakov [Tue, 24 May 2016 12:50:05 +0000 (13:50 +0100)]
ivshmem: fix overlap detection

Partial revert of an earlier ill-conceived "fix".
Adjacent segments can never be considered overlapping because we
are not comparing ends to starts, but rather starts to starts.
Therefore the earlier fix was wrong (plus it also had a typo).

Fixes: d6cf31419e51 ("ivshmem: avoid infinite loop when concatenating segments")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: move more kernel version check to compat header
Ferruh Yigit [Mon, 30 May 2016 11:22:34 +0000 (12:22 +0100)]
kni: move more kernel version check to compat header

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: fix spacing in compat header
Ferruh Yigit [Mon, 30 May 2016 11:22:33 +0000 (12:22 +0100)]
kni: fix spacing in compat header

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: fix build with kernel 4.7
Ferruh Yigit [Mon, 30 May 2016 11:22:32 +0000 (12:22 +0100)]
kni: fix build with kernel 4.7

Fix compile error because of Linux API change, 'trans_start' field
removed from 'struct net_device'.

Linux: 9b36627acecd ("net: remove dev->trans_start")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: fix build clean on Ubuntu
Olivier Matz [Mon, 30 May 2016 11:56:46 +0000 (13:56 +0200)]
kni: fix build clean on Ubuntu

The $(comma) variable is not defined in this Makefile, nor in
any included Makefile. Seen while doing a "make clean" on ubuntu:

  $ make clean
  == Clean lib
  == Clean lib/librte_compat
  == Clean lib/librte_eal
  == Clean lib/librte_eal/common
  == Clean lib/librte_eal/linuxapp
  == Clean lib/librte_eal/linuxapp/eal
  == Clean lib/librte_eal/linuxapp/igb_uio
  == Clean lib/librte_eal/linuxapp/kni
  tr: missing operand after â€˜.-’
  Two strings must be given when translating.
  Try 'tr --help' for more information.

This commit replaces $(comma) by a ',' character, it's not a problem in
that case since we are inside antiquotes.

Fixes: a09b359daca3 ("kni: fix build on Ubuntu 14.04")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by Ferruh Yigit <ferruh.yigit@intel.com>

8 years agomk: fix cross-compilation
Jerin Jacob [Thu, 26 May 2016 11:20:14 +0000 (16:50 +0530)]
mk: fix cross-compilation

Removed comparison against $CC in Makefiles as
in cross-compiling mode CC can be a different string
instead of string "gcc"

Suggested-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agodoc: fix typo in FreeBSD guide
Pablo de Lara [Thu, 19 May 2016 14:39:20 +0000 (15:39 +0100)]
doc: fix typo in FreeBSD guide

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agodoc: add pep8 as the python code style guidelines
John McNamara [Fri, 27 May 2016 14:57:15 +0000 (15:57 +0100)]
doc: add pep8 as the python code style guidelines

Added PEP8 to the DPDK Coding Style guidelines to cover Python
contributions to DPDK.

Signed-off-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoscripts: check commits with checkpatch
Thomas Monjalon [Thu, 2 Jun 2016 09:13:15 +0000 (11:13 +0200)]
scripts: check commits with checkpatch

The new option -n allows to give a number of commits to check
from the git HEAD.
If neither -n nor patch files are given, the commits after
origin/master are checked.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoeal/x86: fix clang build with -O0
Damjan Marion [Fri, 3 Jun 2016 08:15:23 +0000 (10:15 +0200)]
eal/x86: fix clang build with -O0

Clang seems to have a bug with asm inside inline function rte_xabort():

rte_rtm.h:56:15: error: invalid operand for inline asm constraint 'i'
        asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory");
                     ^

It is seen only when building with EXTRA_CFLAGS=-O0.

The workaround is to replace the inline function by a macro.

Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")

Signed-off-by: Damjan Marion <damarion@cisco.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/test: fix buffer overflow
Jan Viktorin [Tue, 3 May 2016 19:15:27 +0000 (21:15 +0200)]
app/test: fix buffer overflow

A bug has been detected by valgrind:

Invalid write of size 1
   by 0x86ECC76: sprintf (in /usr/lib/libc-2.23.so)
   by 0x430B0A: commands_init (in build/app/test)
   by 0x42F215: main (in build/app/test)
 Address 0x9d72ff2 is 0 bytes after a block of size 1,346 alloc'd
   at 0x78C1BD0: malloc (in vgpreload_memcheck-amd64-linux.so)
   by 0x430AE4: commands_init (in build/app/test)
   by 0x42F215: main (in build/app/test)

The commands buffer is exactly 1346 B long so there is an access just
after the buffer. The sprintf always writes '\0' at the end of the string.
The '#' separator adds 1 B more to each string. This is correct until the
last string is sprinted there. The last one is 1 B longer then expected,
i.e.:
      strlen(t->command) + strlen("#") + ONE_FOR_ZERO

Fixes: 727909c59231 ("app/test: introduce dynamic commands list")

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoapp/test: move cycles autotest to first group
Thomas Monjalon [Wed, 11 May 2016 12:52:16 +0000 (14:52 +0200)]
app/test: move cycles autotest to first group

The cycles test was wrongly in the group of mempool perf test.
It is moved in parallel test group 1 with timer test.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: remove unused constants
Thomas Monjalon [Wed, 11 May 2016 06:39:09 +0000 (08:39 +0200)]
app/test: remove unused constants

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: reduce memory needs
Thomas Monjalon [Thu, 5 May 2016 06:49:49 +0000 (08:49 +0200)]
app/test: reduce memory needs

Adjust memory parameter (--socket-mem) of the autotests
to be able to make fast_test in a constrained environment (e.g. a VM).

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: shorten execution time
Thomas Monjalon [Wed, 4 May 2016 15:15:05 +0000 (17:15 +0200)]
app/test: shorten execution time

The autotests are too long to be run often.
This patch reduces the needed time of some tests in fast_test.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: isolate lpm performance cases
Thomas Monjalon [Thu, 5 May 2016 07:08:13 +0000 (09:08 +0200)]
app/test: isolate lpm performance cases

The LPM performance tests should not be mixed with
functional tests: they are long and show some statistics.

LPM6 functional tests are added to parallel tests.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: fix log check when default level is high
Thomas Monjalon [Wed, 4 May 2016 13:18:29 +0000 (15:18 +0200)]
app/test: fix log check when default level is high

The log unit test was checking display of low priority messages.
It was not working if RTE_LOG_LEVEL is not RTE_LOG_DEBUG.
It is even easier to see since the default level is INFO (9b9d7ca).

Now the test use ERR and CRIT levels which should be always enabled
while not trigerring syslog output on the console.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomk: fix autotest lists
Thomas Monjalon [Wed, 11 May 2016 09:09:15 +0000 (11:09 +0200)]
mk: fix autotest lists

The perf test lists were not consistent.
Add timer perf test to the list.
Add LPM6 test to fast tests.
And fix the phony target.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomk: remove useless test targets
Thomas Monjalon [Wed, 11 May 2016 09:23:05 +0000 (11:23 +0200)]
mk: remove useless test targets

We can define any custom whitelist of tests to run:
make test WHITELIST=ring
The predefined lists for ring and mempool tests are not quite useful.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: highlight bad patterns in commit check
Yuanhan Liu [Wed, 11 May 2016 04:09:01 +0000 (21:09 -0700)]
scripts: highlight bad patterns in commit check

I got a report like following:

    Wrong headline lowercase:
            xxx: move vhost device ctx to cuse

It takes a bit while (by checking the code) that it's "ctx" triggers
the warning. It could be spotted very quickly if "tx" is highlighted.
This patch adds such support.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoscripts: fix false positive in commit check
Yuanhan Liu [Wed, 11 May 2016 04:09:00 +0000 (21:09 -0700)]
scripts: fix false positive in commit check

It reports an false positive warning when the commit subject includes
the word "ctx", as it matches following regexp:

     -e 'rx\|tx\|RX\|TX'

Fixes: edbeb7d962e9 ("scripts: check commit formatting")

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoscripts: ignore bit macro in checkpatch
Thomas Monjalon [Tue, 19 Apr 2016 13:13:23 +0000 (15:13 +0200)]
scripts: ignore bit macro in checkpatch

It was suggesting to use a Linux macro:
CHECK:BIT_MACRO: Prefer using the BIT macro

It is ignored because it is a false positive in DPDK case.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: remove unused map files merger
Thomas Monjalon [Thu, 19 May 2016 18:00:04 +0000 (20:00 +0200)]
scripts: remove unused map files merger

This script was forgotten when dropping the combined library.

Fixes: 948fd64befc3 ("mk: replace the combined library with a linker script")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
8 years agoqede: add missing external dependency and disable by default
Panu Matilainen [Tue, 24 May 2016 10:28:31 +0000 (13:28 +0300)]
qede: add missing external dependency and disable by default

The qede driver depends on libz but the LDLIBS entry in makefile
was missing. Also because of the external dependency, make it
disabled in default config as per common DPDK policy on external deps.

Fixes: ec94dbc57362 ("qede: add base driver")

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoqede: fix 32-bit build with debug enabled
Thomas Monjalon [Thu, 19 May 2016 17:29:56 +0000 (19:29 +0200)]
qede: fix 32-bit build with debug enabled

Some 64-bit variables are printed for debug.
%PRIx64 qualifier must be used because %lx is not long enough
on 32-bit systems

Fixes: ec94dbc57362 ("qede: add base driver")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Harish Patil <harish.patil@qlogic.com>
8 years agoethdev: use dedicated macro to check port id
Mauricio Vasquez B [Wed, 18 May 2016 19:15:11 +0000 (21:15 +0200)]
ethdev: use dedicated macro to check port id

The RTE_ETH_VALID_PORTID_OR_ERR_RET macro is used in some places
to check if a port id is valid or not. This commit makes use of it in
some new parts of the code.

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agombuf: add prefetch helpers
Olivier Matz [Wed, 18 May 2016 16:02:08 +0000 (18:02 +0200)]
mbuf: add prefetch helpers

Some architectures (ex: Power8) have a cache line size of 128 bytes,
so the drivers should not expect that prefetching the second part of
the mbuf with rte_prefetch0(&m->cacheline1) is valid.

This commit add helpers that can be used by drivers to prefetch the
rx or tx part of the mbuf, whatever the cache line size.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
8 years agomempool: avoid division by zero
Slawomir Mrozowicz [Thu, 19 May 2016 12:36:35 +0000 (14:36 +0200)]
mempool: avoid division by zero

In function call rte_mempool_xmem_size, division by expression total_size
which may be zero has undefined behavior.

Coverity issue: 13243
Fixes: 148f963fb532 ("xen: core library changes")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agodoc: update release notes about mempool allocation
Olivier Matz [Wed, 18 May 2016 11:04:56 +0000 (13:04 +0200)]
doc: update release notes about mempool allocation

Remove the deprecation notice and add an entry in the release note
for the changes in mempool allocation.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/test: rework mempool test
Olivier Matz [Wed, 18 May 2016 11:04:55 +0000 (13:04 +0200)]
app/test: rework mempool test

Rework the mempool test to better indicate where it failed,
and, now that this feature is available, add the freeing of the
mempool after the test is done.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: add flag for removing phys contiguous constraint
Olivier Matz [Wed, 18 May 2016 11:04:54 +0000 (13:04 +0200)]
mempool: add flag for removing phys contiguous constraint

Add a new flag to remove the constraint of having physically contiguous
objects inside a mempool.

Add this flag to the log history mempool to start, but we could add
it in most cases where objects are not mbufs.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomem: avoid memzone/mempool/ring name truncation
Olivier Matz [Wed, 18 May 2016 11:04:53 +0000 (13:04 +0200)]
mem: avoid memzone/mempool/ring name truncation

Check the return value of snprintf to ensure that the name of
the object is not truncated.

By the way, update the test to avoid to trigger an error in
that case.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/testpmd: remove anonymous mempool code
Olivier Matz [Wed, 18 May 2016 11:04:52 +0000 (13:04 +0200)]
app/testpmd: remove anonymous mempool code

Now that mempool library provide functions to populate with anonymous
mmap'd memory, we can remove this specific code from test-pmd.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: make mempool populate and free api public
Olivier Matz [Wed, 18 May 2016 11:04:51 +0000 (13:04 +0200)]
mempool: make mempool populate and free api public

Add the following functions to the public mempool API:

- rte_mempool_create_empty()
- rte_mempool_populate_phys()
- rte_mempool_populate_phys_tab()
- rte_mempool_populate_virt()
- rte_mempool_populate_default()
- rte_mempool_populate_anon()
- rte_mempool_free()

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: populate with anonymous memory
Olivier Matz [Wed, 18 May 2016 11:04:50 +0000 (13:04 +0200)]
mempool: populate with anonymous memory

Now that we can populate a mempool with any virtual memory,
it is easier to introduce a function to populate a mempool
with memory coming from an anonymous mapping, as it's done
in test-pmd.

The next commit will replace test-pmd anonymous mapping by
this function.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: create the internal ring when populating
Olivier Matz [Wed, 18 May 2016 11:04:49 +0000 (13:04 +0200)]
mempool: create the internal ring when populating

Instead of creating the internal ring at mempool creation, do
it when populating the mempool with the first memory chunk. The
objective here is to simplify the change of external handler
when it will be introduced.

For instance, this will be possible:

  mp = rte_mempool_create_empty(...)
  rte_mempool_set_ext_handler(mp, my_handler)
  rte_mempool_populate_default()

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: rework support of Xen dom0
Olivier Matz [Wed, 18 May 2016 11:04:48 +0000 (13:04 +0200)]
mempool: rework support of Xen dom0

Avoid to have a specific file for that, and remove #ifdefs.
Now that we have introduced a function to populate a mempool
with a virtual area, the support of xen dom0 is much easier.

The only thing we need to do is to convert the guest physical
address into the machine physical address using rte_mem_phy2mch().
This function does nothing when not running xen.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoxen: return machine address without knowing memseg id
Olivier Matz [Wed, 18 May 2016 11:04:47 +0000 (13:04 +0200)]
xen: return machine address without knowing memseg id

The conversion from guest physical address to machine physical address
is fast when the caller knows the memseg corresponding to the gpa.

But in case the user does not know this information, just find it
by browsing the segments. This feature will be used by next commit.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: introduce a function to create an empty pool
Olivier Matz [Wed, 18 May 2016 11:04:46 +0000 (13:04 +0200)]
mempool: introduce a function to create an empty pool

Introduce a new function rte_mempool_create_empty()
that allocates a mempool that is not populated.

The functions rte_mempool_create() and rte_mempool_xmem_create()
now make use of it, making their code much easier to read.
Currently, they are the only users of rte_mempool_create_empty()
but the function will be made public in next commits.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: introduce a function to free a pool
Olivier Matz [Wed, 18 May 2016 11:04:45 +0000 (13:04 +0200)]
mempool: introduce a function to free a pool

Introduce rte_mempool_free() that:

- unlink the mempool from the global list if it is found
- free all the memory chunks using their free callbacks
- free the internal ring
- free the memzone containing the mempool

Currently this function is only used in error cases when
creating a new mempool, but it will be made public later
in the patch series.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: replace physical address by a memzone pointer
Olivier Matz [Wed, 18 May 2016 11:04:44 +0000 (13:04 +0200)]
mempool: replace physical address by a memzone pointer

Storing the pointer to the memzone instead of the physical address
provides more information than just the physical address: for instance,
the memzone flags.

Moreover, keeping the memzone pointer will allow us to free the mempool
(this is done later in the series).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: support no hugepage mode
Olivier Matz [Wed, 18 May 2016 11:04:43 +0000 (13:04 +0200)]
mempool: support no hugepage mode

Introduce a new function rte_mempool_populate_virt() that is now called
by default when hugepages are not supported. This function populate the
mempool with several physically contiguous chunks whose minimum size is
the page size of the system.

Thanks to this, rte_mempool_create() will work properly in without
hugepages (if the object size is smaller than a page size), and 2
specific workarouds can be removed:

- trailer_size was artificially extended to a page size
- rte_mempool_virt2phy() did not rely on object physical address

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomem: lock pages when not using hugepages
Olivier Matz [Wed, 18 May 2016 11:04:42 +0000 (13:04 +0200)]
mem: lock pages when not using hugepages

Although the physical address won't be correct in memory segment,
this allows at least to retrieve the physical address using
rte_mem_virt2phy(). Indeed, if the page is not locked, the page
may not be present in physical memory.

With next commit, it allows a mempool to have properly filled physical
addresses when using --no-huge option.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: allocate in several memory chunks by default
Olivier Matz [Wed, 18 May 2016 11:04:41 +0000 (13:04 +0200)]
mempool: allocate in several memory chunks by default

Introduce rte_mempool_populate_default() which allocates
mempool objects in several memzones.

The mempool header is now always allocated in a specific memzone
(not with its objects). Thanks to this modification, we can remove
many specific behavior that was required when hugepages are not
enabled in case we are using rte_mempool_xmem_create().

This change requires to update how kni and mellanox drivers lookup for
mbuf memory. For now, this will only work if there is only one memory
chunk (like today), but we could make use of rte_mempool_mem_iter() to
support more memory chunks.

We can also remove RTE_MEMPOOL_OBJ_NAME that is not required anymore for
the lookup, as memory chunks are referenced by the mempool.

Note that rte_mempool_create() is still broken (it was the case before)
when there is no hugepages support (rte_mempool_create_xmem() has to be
used). This is fixed in next commit.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: get memory size with unspecified page size
Olivier Matz [Wed, 18 May 2016 11:04:40 +0000 (13:04 +0200)]
mempool: get memory size with unspecified page size

Update rte_mempool_xmem_size() so that when the page_shift argument is
set to 0, assume that memory is physically contiguous, allowing to
ignore page boundaries. This will be used in the next commits.

By the way, rename the variable 'n' as 'obj_per_page' and avoid the
affectation inside the if().

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: introduce a free callback for memory chunks
Olivier Matz [Wed, 18 May 2016 11:04:39 +0000 (13:04 +0200)]
mempool: introduce a free callback for memory chunks

Introduce a free callback that is passed to the populate* functions,
which is used when freeing a mempool. This is unused now, but as next
commits will populate the mempool with several chunks of memory, we
need a way to free them properly on error.

Later in the series, we will also introduce a public rte_mempool_free()
and the ability for the user to populate a mempool with its own memory.
For that, we also need a free callback.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: simplify memory usage calculation
Olivier Matz [Wed, 18 May 2016 11:04:38 +0000 (13:04 +0200)]
mempool: simplify memory usage calculation

This commit simplifies rte_mempool_xmem_usage().

Since previous commit, the function rte_mempool_xmem_usage() is
now the last user of rte_mempool_obj_mem_iter(). This complex
code can now be moved inside the function. We can get rid of the
callback and do some simplification to make the code more readable.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: add function to iterate the memory chunks
Olivier Matz [Wed, 18 May 2016 11:04:37 +0000 (13:04 +0200)]
mempool: add function to iterate the memory chunks

In the same model than rte_mempool_obj_iter(), introduce
rte_mempool_mem_iter() to iterate the memory chunks attached
to the mempool.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: store memory chunks in a list
Olivier Matz [Wed, 18 May 2016 11:04:36 +0000 (13:04 +0200)]
mempool: store memory chunks in a list

Do not use paddr table to store the mempool memory chunks.
This will allow to have several chunks with different virtual addresses.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: remove macro to check if contiguous
Olivier Matz [Wed, 18 May 2016 11:04:35 +0000 (13:04 +0200)]
mempool: remove macro to check if contiguous

This commit removes MEMPOOL_IS_CONTIG().

The next commits will change the behavior of the mempool library so that
the objects will never be allocated in the same memzone than the mempool
header. Therefore, there is no reason to keep this macro that would
always return 0.

This macro was only used in app/test.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>