dpdk.git
8 years agonet/virtio: add missing driver name
David Marchand [Fri, 7 Oct 2016 13:03:13 +0000 (15:03 +0200)]
net/virtio: add missing driver name

The driver name has been lost with the eal rework.
Restore it.

Fixes: c830cb295411 ("drivers: use PCI registration macro")

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: set MTU
Souvik Dey [Sun, 9 Oct 2016 03:38:26 +0000 (11:38 +0800)]
net/virtio: set MTU

Virtio interfaces do not currently allow the user to specify a particular
Maximum Transmission Unit (MTU). Consequently, the MTU of Virtio interfaces
is typically set to the Ethernet default value of 1500.
This is problematic in the case of cloud deployments, in which a specific
(and potentially non-standard) MTU needs to be set by a DHCP server, which
needs to be honored by all interfaces across the traffic path.To acheive
this Virtio interfaces should support setting of MTU.
In case when GRE/VXLAN tunneling is used for internal communication, there
will be an overhead added by the infrastructure in the packet over and
above the ETHER MTU of 1518. So to take care of this overhead in these
cases the DHCP server corrects the L3 MTU to 1454. But since virtio
interfaces was not having the MTU set functionality that MTU sent by the
DHCP server was ignored and the instance will still send packets with 1500
MTU which after encapsulation will become more than 1518 and eventually
gets dropped in the infrastructure.
By adding an additional 'set_mtu' function to the Virtio driver, we can
honor the MTU sent by the DHCP server. The dhcp server/controller can
then leverage this 'set_mtu' functionality to resolve the above
mentioned issue of packets getting dropped due to incorrect size.

Signed-off-by: Souvik Dey <sodey@sonusnet.com>
Reviewed-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agodoc: fix typo in pdump guide
Mark Kavanagh [Thu, 6 Oct 2016 10:36:36 +0000 (11:36 +0100)]
doc: fix typo in pdump guide

- Fix copy/paste error in description of how to capture both rx
  & tx traffic in a single pcap file
- Replace duplicate word with what original author presumably
  intended, such that description now makes sense

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: clarify usage of testpmd MAC forward mode
Mark Kavanagh [Fri, 9 Sep 2016 16:15:52 +0000 (17:15 +0100)]
doc: clarify usage of testpmd MAC forward mode

Explain default testpmd behavior in mac fwd mode to remove
amiguity/confusion regarding user's ability to specify Ethernet
addresses.

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: add xstats commands in testpmd guide
Maryam Tahhan [Wed, 7 Sep 2016 10:45:57 +0000 (11:45 +0100)]
doc: add xstats commands in testpmd guide

Update the testpmd user guide with instructions for retrieving extended
NIC statistics.

Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoapp/testpmd: support 25G and 50G speeds
Ajit Khaparde [Wed, 12 Oct 2016 21:26:31 +0000 (16:26 -0500)]
app/testpmd: support 25G and 50G speeds

Support to configure 25G and 50G speeds is missing from testpmd.
This patch also updates the testpmd user guide accordingly.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
8 years agoapp/testpmd: configure flowgen packet size with --txpkts
Maciej Czekaj [Fri, 26 Aug 2016 11:46:42 +0000 (13:46 +0200)]
app/testpmd: configure flowgen packet size with --txpkts

"flowgen" forwarding mode has fixed packet size (300).
Let it re-use --txpkts option for specifying generated packet size.

Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: fix DCB configuration
Wenzhuo Lu [Mon, 26 Sep 2016 01:11:11 +0000 (09:11 +0800)]
app/testpmd: fix DCB configuration

An issue is found that DCB cannot be configured on ixgbe
NICs. It's said the TX queue number is not right.
On ixgbe the max TX queue number is not fixed, it depends
on the multi-queue mode.

This patch adds the device configuration before getting
info in the DCB configuration process. So the right info
can be got depending on the configuration.

Fixes: 1a572499 ("app/testpmd: setup DCB forwarding based on traffic class")

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
8 years agoapp/testpmd: fix RSS hash key size
Mohammad Abdul Awal [Fri, 5 Aug 2016 15:34:51 +0000 (16:34 +0100)]
app/testpmd: fix RSS hash key size

RSS hash-key-size is retrieved from device configuration instead of
using a fixed size of 40 bytes.

Fixes: f79959ea1504 ("app/testpmd: allow to configure RSS hash key")

Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoapp/testpmd: fix TSO with checksum engine
Olivier Matz [Thu, 13 Oct 2016 13:40:30 +0000 (15:40 +0200)]
app/testpmd: fix TSO with checksum engine

The commit that disabled TSO for small packets was broken during the
rebase. The problem is the IP checksum is not calculated in software if:
- TX IP checksum is disabled
- TSO is enabled
- the current packet is smaller than tso segment size

When checking if the PKT_TX_IP_CKSUM flag should be set (in case
of tso), use the local tso_segsz variable, which is set to 0 when the
packet is too small to require tso. Therefore the IP checksum will be
correctly calculated in software.

Moreover, we should not use tunnel segment size for non-tunnel tso, else
TSO will stay disabled for all packets.

Fixes: 97c21329d42b ("app/testpmd: do not use TSO for small packets")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/testpmd: use consistent vdev names
Thomas Monjalon [Thu, 6 Oct 2016 10:34:23 +0000 (12:34 +0200)]
app/testpmd: use consistent vdev names

The vdev eth_bond has been renamed to net_bond.
testpmd is creating a bonding device with the old prefix.
It is changed for consistency.

The script test-null.sh was failing because using the old name
for the null vdev.

Fixes also the bonding and testpmd doc.

Fixes: 2f45703c17ac ("drivers: make driver names consistent")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: fix vdev names
Thomas Monjalon [Thu, 6 Oct 2016 10:34:22 +0000 (12:34 +0200)]
app/test: fix vdev names

The vdev eth_ring has been renamed to net_ring.
Some unit tests are using the old name and fail.

Fixes also the vdev comments in EAL and ethdev.

Fixes: 2f45703c17ac ("drivers: make driver names consistent")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: add mempool walk
Thomas Monjalon [Mon, 3 Oct 2016 20:58:33 +0000 (22:58 +0200)]
app/test: add mempool walk

The mempool function rte_mempool_walk was not tested.
It will print the name of all mempools.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/test: reduce IPv6 LPM data size
Wei Dai [Thu, 29 Sep 2016 18:11:33 +0000 (02:11 +0800)]
app/test: reduce IPv6 LPM data size

copy app/test/test_lpm6_routes.h to app/test/test_lpm6_data.h .
and then delete app/test/test_lpm6_routes.h and clear the
large_ips_table[ ] to make LPM6 test case size much smaller than
before. Also add codes in app/test/test_lpm6_data.h to generate test
data in large_ips_table[ ] at run time.

Signed-off-by: Wei Dai <wei.dai@intel.com>
8 years agoapp/test: remove large IPv4 LPM data file
Wei Dai [Tue, 27 Sep 2016 17:38:27 +0000 (01:38 +0800)]
app/test: remove large IPv4 LPM data file

remove the large file app/test/test_lpm_routes.h and add codes to
auto-generate similar large route rule table which keeps same depth
and IP class distribution as previous one in test_lpm_routes.h .
With the rule table auto-generated at run time, the performance
of looking up keep similar to that from pervious constant table.

Signed-off-by: Wei Dai <wei.dai@intel.com>
8 years agoapp/test: fix hash multiwriter sequence
Pablo de Lara [Thu, 6 Oct 2016 22:34:50 +0000 (23:34 +0100)]
app/test: fix hash multiwriter sequence

Hash multiwriter test consists of two subtests.
If the any of the subtests fails, the overall test should fail,
but the overall test only passed if the second subtest passed,
because the return of the first subtest was being overwritten.

Fixes: be856325cba3 ("hash: add scalable multi-writer insertion with Intel TSX")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/tep_term: fix inner L4 checksum
Jianfeng Tan [Thu, 4 Aug 2016 07:58:49 +0000 (07:58 +0000)]
examples/tep_term: fix inner L4 checksum

When sending packets from virtual machine which in need of TSO
by hardware NIC, the inner L4 checksum is not correct on the
other side of the cable.

It's because get_psd_sum() depends on PKT_TX_TCP_SEG to calculate
pseudo-header checksum, but currently this bit is set after the
function get_psd_sum() is called. The fix is straightforward.
Move the bit setting before get_psd_sum() is called.

Fixes: a50245ede72a ("examples/tep_term: initialize VXLAN sample")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
8 years agoexamples/tep_term: fix offload on VXLAN
Jianfeng Tan [Thu, 4 Aug 2016 07:58:48 +0000 (07:58 +0000)]
examples/tep_term: fix offload on VXLAN

Based on previous fix of offload on VXLAN using i40e, applications
need to set proper tunneling type on ol_flags so that i40e driver
can pass it to NIC.

Fixes: a50245ede72a ("examples/tep_term: initialize VXLAN sample")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
8 years agoexamples/l3fwd: enable 4M hash for all 64-bit archs
Hemant Agrawal [Tue, 23 Aug 2016 14:54:40 +0000 (20:24 +0530)]
examples/l3fwd: enable 4M hash for all 64-bit archs

This patch enables the support for 4 million hash entries
for all 64 bit architectures.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
8 years agoexamples/l2fwd: add option --[no-]mac-updating
Maxime Coquelin [Fri, 23 Sep 2016 13:50:53 +0000 (15:50 +0200)]
examples/l2fwd: add option --[no-]mac-updating

l2fwd could be useful for testing virtual devices without the need
of physical ones.

To achieve this, this patch adds a new option to enable/disable the
MAC addresses updating done at forwarding time: --[no-]mac-updating

It enables the use of l2fwd for basic VM to VM communication.

By default, MAC address updating remains enabled, to keep consistency
with previous usage.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoexamples/qos_sched: fix dequeue from ring
Jasvinder Singh [Thu, 1 Sep 2016 10:11:04 +0000 (11:11 +0100)]
examples/qos_sched: fix dequeue from ring

The app_worker_thread() and app_mixed_thread() use rte_ring_sc_dequeue_bulk
to dequeue packets from the ring and this imposes restriction on number of
packets in software ring to be greater than the specified value to start
actual dequeue operation, thus, adds latency to those packets. Therefore,
rte_ring_sc_dequeue_bulk is replaced with rte_ring_sc_dequeue_burst.

Fixes: de3cfa2c9823 ("sched: initial import")

Suggested-by: Tao Y Yang <tao.y.yang@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
8 years agoexamples/ip_pipeline: add configuration with TAP
Jasvinder Singh [Thu, 13 Oct 2016 09:17:49 +0000 (10:17 +0100)]
examples/ip_pipeline: add configuration with TAP

To illustrate the TAP port usage, the sample configuration file with
passthrough pipeline connected to TAP interface is added.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: add TAP port
Jasvinder Singh [Thu, 13 Oct 2016 09:17:48 +0000 (10:17 +0100)]
examples/ip_pipeline: add TAP port

The TAP port support is added to ip_pipeline app. To parse
configuration file with TAP port entries, parsing function is implemented.
The TAP ports configuration check and initialization routines have been
included in application code.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoport: support file descriptor
Jasvinder Singh [Thu, 13 Oct 2016 09:17:47 +0000 (10:17 +0100)]
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>
8 years agoexamples/ip_pipeline: fix plugin loading
Gowrishankar Muthukrishnan [Tue, 4 Oct 2016 10:43:17 +0000 (16:13 +0530)]
examples/ip_pipeline: fix plugin loading

There is typo in init.c of ip_pipeline example due to which,
invalid file path is added to -d option of EAL i.e path starting
with =.

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: add swap action in configuration
Jasvinder Singh [Fri, 26 Aug 2016 21:21:45 +0000 (22:21 +0100)]
examples/ip_pipeline: add swap action in configuration

The network_layers configuration file (config/network_layers.cfg)
demonstrates the various network layer components such as TCP, UDP,
ICMP etc, which can be easily integrated into ip pipeline
infrastructure.

The loopback function (implemented using passthrough pipeline) is
updated to perform swap operation on the IP source and destination
address, and UDP source and destination ports.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: add swap action in pass-through
Jasvinder Singh [Fri, 26 Aug 2016 21:21:44 +0000 (22:21 +0100)]
examples/ip_pipeline: add swap action in pass-through

Pass-through pipeline is updated with addition of packet fields swap
action. To enable swap action, new entry i.e 'swap' is required in
the passthrough pipeline section of the configuration file, and this
entry contains the offsets (in bytes) of the packet fields to be
swapped.

Each swap entry specifies the pair of packet fields offsets to be
swapped. Therefore, to perform swap action on more than one pair of
packets fields, separate swap entries, each one responsible for unique
pair of packet fields are needed.

Following illustrates the pass-through pipeline configuration that
swaps the source and destination addresses of the mac and tcp
ports of the received packets.

[EAL]
log_level = 0

[PIPELINE0]
type = MASTER
core = 0

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

swap = 256 262; MACDST <-> MACSRC
;swap = 282 286; IPSRC <-> IPDST
swap = 290 292; PORTSRC <-> PORTDST

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: set source port default
Jasvinder Singh [Tue, 9 Aug 2016 16:30:56 +0000 (17:30 +0100)]
examples/ip_pipeline: set source port default

The default value of ``file_name`` parameter of the source port structure is
changed from ``NULL`` to ``./config/packets.pcap``.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoport: modify source and sink port structure
Jasvinder Singh [Tue, 9 Aug 2016 16:30:55 +0000 (17:30 +0100)]
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>
8 years agoapp/test: add cuckoo hash table
Guruprasad Rao [Thu, 22 Sep 2016 10:12:07 +0000 (03:12 -0700)]
app/test: add cuckoo hash table

This patch includes cuckoo hash table for testing all the APIs
The cuckoo hash is added for both test_table_tables and
test_table_combined cases.
The testing is completed and the results are OK.

Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Signed-off-by: Guruprasad Rao <guruprasadx.rao@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoapp/test-pipeline: add cuckoo hash
Guruprasad Rao [Thu, 22 Sep 2016 10:12:06 +0000 (03:12 -0700)]
app/test-pipeline: add cuckoo hash

This patch inclides cuckoo hash table into test-pipeline
This allows to benchmark the performance of the cuckoo hash table
The following key sizes are supported for cuckoo hash table
8, 16, 32, 48, 64, 80, 96, 112 and 128.

The test-pipeline can be run using the following command
say for key size 8
./app/testpipeline -c 0xe -n 4 -- -p 0xf --hash-cuckoo-8

Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Signed-off-by: Guruprasad Rao <guruprasadx.rao@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agotable: add cuckoo hash
Guruprasad Rao [Thu, 22 Sep 2016 10:12:05 +0000 (03:12 -0700)]
table: add cuckoo hash

This patch provides table apis for dosig version of cuckoo hash
via  rte_table_hash_cuckoo_dosig_ops

The following apis are implemented for cuckoo hash
rte_table_hash_cuckoo_create
rte_table_hash_cuckoo_free
rte_table_hash_cuckoo_entry_add
rte_table_hash_cuckoo_entry_delete
rte_table_hash_cuckoo_lookup_dosig
rte_table_hash_cuckoo_stats_read

Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Signed-off-by: Guruprasad Rao <guruprasadx.rao@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agohash: fix bucket size usage
Pablo de Lara [Wed, 12 Oct 2016 01:26:44 +0000 (02:26 +0100)]
hash: fix bucket size usage

Multiwriter insert function was using a fixed value for
the bucket size, instead of using the
RTE_HASH_BUCKET_ENTRIES macro, which value was changed
recently (making it inconsistent in this case).

Fixes: be856325cba3 ("hash: add scalable multi-writer insertion with Intel TSX")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agohash: fix unlimited cuckoo path
Pablo de Lara [Wed, 12 Oct 2016 00:50:13 +0000 (01:50 +0100)]
hash: fix unlimited cuckoo path

When trying to insert a new entry, if its target bucket is full,
the alternative location (bucket) of one of the entries is checked,
to try to find an empty slot, with make_space_bucket.
This function is called every time a new bucket is checked, recursively.
To avoid having a very long insert operation (and to avoid filling up
the stack), a limit in the number of pushes is introduced.

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

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/procinfo: free xstats memory upon failure
Reshma Pattan [Tue, 4 Oct 2016 16:42:22 +0000 (17:42 +0100)]
app/procinfo: free xstats memory upon failure

Some of the failures cases inside the nic_xstats_display()
function doesn't free the allocated memory for the xstats and
their names, memory is freed now.

Fixes: e2aae1c1 ("ethdev: remove name from extended statistic fetch")
Fixes: 22561383 ("app: replace dump_cfg by proc_info")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agopdump: fix created directory permissions
Reshma Pattan [Mon, 10 Oct 2016 14:35:48 +0000 (15:35 +0100)]
pdump: fix created directory permissions

Inside the function pdump_get_socket_path(), pdump socket
directories are created using mkdir() call with permissions 700,
which was assigning wrong permissions to the directories
i.e. "d-w-r-xr-T" instead of drwx---. The reason is mkdir() call
doesn't consider 700 as an octal value until unless 0 is explicitly
added before the value. Because of this, socket creation failure is
observed when DPDK application was ran in non root user mode.
DPDK application running in root user mode never reported the issue.

So 0 is prefixed to the value to create directories with
the correct permissions.

Fixes: e4ffa2d3 ("pdump: fix error handlings")
Fixes: bdd8dcc6 ("pdump: fix default socket path")

Reported-by: Jianfeng Tan <jianfeng.tan@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agomk: use -march option with recent Intel processors names
Reshma Pattan [Mon, 10 Oct 2016 21:33:13 +0000 (22:33 +0100)]
mk: use -march option with recent Intel processors names

The GCC 4.9 -march option supports the intel code names for processors,
for example -march=silvermont, -march=broadwell.
The RTE_MACHINE config flag can be used to pass code name to
the compiler as -march flag.

Release notes is updated.

Linux and FreeBSD getting started guides are updated with recommended
gcc version as 4.9 and above.

Some of the gmake command examples in sample application guide and driver
guides are updated with gcc version as 4.9.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
8 years agoapp/testpmd: hide segment size when not relevant
Olivier Matz [Wed, 12 Oct 2016 15:39:50 +0000 (17:39 +0200)]
app/testpmd: hide segment size when not relevant

When TSO is not asked, hide the segment size.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: do not use TSO for small packets
Olivier Matz [Wed, 12 Oct 2016 15:39:49 +0000 (17:39 +0200)]
app/testpmd: do not use TSO for small packets

Asking for TSO (TCP Segmentation Offload) on packets that are already
smaller than (headers + MSS) does not work, for instance on ixgbe.

Fix the csumonly engine to only set the TSO flag when a segmentation
offload is really required, i.e. when packet is large enough.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: display Rx port in checksum engine
Olivier Matz [Wed, 12 Oct 2016 15:39:48 +0000 (17:39 +0200)]
app/testpmd: display Rx port in checksum engine

This information is useful when debugging, especially with
bidirectional traffic.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: do not change IP addrs in checksum engine
Olivier Matz [Wed, 12 Oct 2016 15:39:47 +0000 (17:39 +0200)]
app/testpmd: do not change IP addrs in checksum engine

The csum forward engine was updated to change the IP addresses in the
packet data in
commit 51f694dd40f5 ("app/testpmd: rework checksum forward engine")

This was done to ensure that the checksum is correctly reprocessed when
using hardware checksum offload. But the functions
process_inner_cksums() and process_outer_cksums() already reset the
checksum field to 0, so this is not necessary.

Moreover, this makes the engine more complex than needed, and prevents
to easily use it to forward traffic (like iperf) as it modifies the
packets.

This patch drops this behavior.

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 option to enable LRO
Olivier Matz [Wed, 12 Oct 2016 15:39:46 +0000 (17:39 +0200)]
app/testpmd: add option to enable LRO

Introduce a new argument '--enable-lro' to ask testpmd to enable the LRO
feature on enabled ports, like it's done for '--enable-rx-cksum' for
instance.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: dump Rx flags in checksum engine
Olivier Matz [Wed, 12 Oct 2016 15:39:45 +0000 (17:39 +0200)]
app/testpmd: dump Rx flags in checksum engine

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: dump offload flags with new functions
Olivier Matz [Wed, 12 Oct 2016 15:39:44 +0000 (17:39 +0200)]
app/testpmd: dump offload flags with new functions

Use the functions introduced in the previous commit to dump the offload
flags.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agombuf: add functions to dump offload flags
Olivier Matz [Wed, 12 Oct 2016 15:39:43 +0000 (17:39 +0200)]
mbuf: add functions to dump offload flags

The functions rte_get_rx_ol_flag_name() and rte_get_tx_ol_flag_name()
can dump one flag, or set of flag that are part of the same mask (ex:
PKT_TX_UDP_CKSUM, part of PKT_TX_L4_MASK). But they are not designed to
dump the list of flags contained in mbuf->ol_flags.

This commit introduce new functions to do that. Similarly to the packet
type dump functions, the goal is to factorize the code that could be
used in several applications and reduce the risk of desynchronization
between the flags and the dump functions.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: display software packet type
Olivier Matz [Mon, 3 Oct 2016 08:38:57 +0000 (10:38 +0200)]
app/testpmd: display software packet type

In addition to the packet type returned by the PMD, also display the
packet type calculated by parsing the packet in software. This is
particularly useful to compare the 2 values.

Note: it does not mean that both hw and sw always have to provide the
same value, since it depends on what hardware supports.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/testpmd: dump packet type with new function
Olivier Matz [Mon, 3 Oct 2016 08:38:56 +0000 (10:38 +0200)]
app/testpmd: dump packet type with new function

Use the function introduced in previous commit to dump the packet type
of the received packet.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agombuf: clarify definition of fragment packet types
Olivier Matz [Mon, 3 Oct 2016 08:38:55 +0000 (10:38 +0200)]
mbuf: clarify definition of fragment packet types

An IPv4 packet is considered as a fragment if:
- MF (more fragment) bit is set
- or Fragment_Offset field is non-zero

Update the API documentation of packet types to reflect this.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agombuf: add functions to dump packet type
Olivier Matz [Mon, 3 Oct 2016 08:38:54 +0000 (10:38 +0200)]
mbuf: add functions to dump packet type

Dumping the packet type is useful for debug purposes. Instead
of having each application providing its function to do that,
introduce functions to do it.

It factorizes the code and reduces the risk of desynchronization between
the new packet types and the dump function.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: get packet type for the first layers only
Olivier Matz [Mon, 3 Oct 2016 08:38:53 +0000 (10:38 +0200)]
net: get packet type for the first layers only

Add a parameter to rte_net_get_ptype() to select which
layers should be parsed. This avoids to parse all layers if
only the first ones are required.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: support NVGRE in software packet type parser
Olivier Matz [Mon, 3 Oct 2016 08:38:52 +0000 (10:38 +0200)]
net: support NVGRE in software packet type parser

Add support of Nvgre tunnels in rte_net_get_ptype(). At the same
time, as Nvgre transports Ethernet, we need to add the support for inner
Vlan, QinQ, and Mpls.

Signed-off-by: Jean Dao <jean.dao@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: support GRE in software packet type parser
Olivier Matz [Mon, 3 Oct 2016 08:38:51 +0000 (10:38 +0200)]
net: support GRE in software packet type parser

Add support of Gre tunnels in rte_net_get_ptype().

Signed-off-by: Jean Dao <jean.dao@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: add GRE header structure
Olivier Matz [Mon, 3 Oct 2016 08:38:50 +0000 (10:38 +0200)]
net: add GRE header structure

Add the Gre header structure in librte_net. It will be used by next
patches that adds the support of Gre tunnels in the software packet type
parser.

The extended headers (checksum, key or sequence number) are not defined.

Signed-off-by: Jean Dao <jean.dao@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: support IP tunnels in software packet type parser
Olivier Matz [Mon, 3 Oct 2016 08:38:49 +0000 (10:38 +0200)]
net: support IP tunnels in software packet type parser

Add support of IP and IP6 tunnels in rte_net_get_ptype().

We need to duplicate some code because the packet types do not have the
same value for a given protocol between inner and outer.

Signed-off-by: Jean Dao <jean.dao@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: support QinQ in software packet type parser
Olivier Matz [Mon, 3 Oct 2016 08:38:48 +0000 (10:38 +0200)]
net: support QinQ in software packet type parser

Add a new RTE_PTYPE_L2_ETHER_QINQ packet type, and its support in
rte_net_get_ptype().

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: support VLAN in software packet type parser
Olivier Matz [Mon, 3 Oct 2016 08:38:47 +0000 (10:38 +0200)]
net: support VLAN in software packet type parser

Add a new RTE_PTYPE_L2_ETHER_VLAN packet type, and its support in
rte_net_get_ptype().

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: add function to get packet type from data
Olivier Matz [Mon, 3 Oct 2016 08:38:46 +0000 (10:38 +0200)]
net: add function to get packet type from data

Introduce the function rte_net_get_ptype() that parses a mbuf and
returns its packet type. For now, the following packet types are parsed:
   L2: Ether
   L3: IPv4, IPv6
   L4: TCP, UDP, SCTP

The goal here is to provide a reference implementation for packet type
parsing. This function will be used by testpmd in next commits, allowing
to compare its result with the value given by the hardware.

This function will also be useful when implementing Rx offload support
in virtio pmd. Indeed, the virtio protocol gives the csum start and
offset, but it does not give the L4 protocol nor it tells if the
checksum is relevant for inner or outer. This information has to be
known to properly set the ol_flags in mbuf.

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Signed-off-by: Jean Dao <jean.dao@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: introduce net library
Olivier Matz [Mon, 3 Oct 2016 08:38:45 +0000 (10:38 +0200)]
net: introduce net library

Previously, librte_net only contained header files. Add a C file
(empty for now) and generate a library. It will contain network helpers
like checksum calculation, software packet type parser, ...

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agombuf: move packet type definitions in a new file
Olivier Matz [Mon, 3 Oct 2016 08:38:44 +0000 (10:38 +0200)]
mbuf: move packet type definitions in a new file

The file rte_mbuf.h starts to be quite big, and next commits
will introduce more functions related to packet types. Let's
move them in a new file.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet: move ethernet definitions to the net library
Olivier Matz [Mon, 3 Oct 2016 08:38:43 +0000 (10:38 +0200)]
net: move ethernet definitions to the net library

The proper place for rte_ether.h is in librte_net because it defines
network headers.

Moving it will also prevent to have circular references in the following
patches that will require the Ethernet header definition in rte_mbuf.c.
By the way, fix minor checkpatch issues.

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agombuf: add function to read packet data
Olivier Matz [Mon, 3 Oct 2016 08:38:42 +0000 (10:38 +0200)]
mbuf: add function to read packet data

Introduce a new function to read the packet data from an mbuf chain. It
linearizes the data if required, and also ensures that the mbuf is large
enough.

This function is used in next commits that add a software parser to
retrieve the packet type.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoethdev: fix vendor id in debug message
David Marchand [Fri, 7 Oct 2016 13:01:16 +0000 (15:01 +0200)]
ethdev: fix vendor id in debug message

Fixes: af75078fece3 ("first public release")

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agoethdev: fix hotplug attach
David Marchand [Fri, 7 Oct 2016 13:01:15 +0000 (15:01 +0200)]
ethdev: fix hotplug attach

If a pci probe operation creates a port but, for any reason, fails to
finish this operation and decides to delete the newly created port, then
the last created port id can not be trusted anymore and any subsequent
attach operations will fail.

This problem was noticed while working on a vm that had a virtio-net
management interface bound to the virtio-net kernel driver and no port
whitelisted in the commandline:

root@ubuntu1404:~/dpdk# ./build/app/testpmd -c 0x6 --
 -i --total-num-mbufs=2049
EAL: Detected 3 lcore(s)
EAL: Probing VFIO support...
EAL: Debug logs available - lower performance
EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using
unreliable clock cycles !
EAL: PCI device 0000:00:03.0 on NUMA socket -1
EAL:   probe driver: 1af4:1000 (null)
rte_eth_dev_pci_probe: driver (null): eth_dev_init(vendor_id=0x6900
device_id=0x1000) failed
EAL: No probed ethernet devices
     ^
     |
     Here, rte_eth_dev_pci_probe() fails since vtpci_init() reports an
     error. This results in a rte_eth_dev_release_port() right after a
     rte_eth_dev_allocate().

Then, if we try to attach a port using rte_eth_dev_attach:

testpmd> port attach net_ring0
Attaching a new port...
PMD: Initializing pmd_ring for net_ring0
PMD: Creating rings-backed ethdev on numa socket 0

Two solutions:
- either update the last created port index to something invalid
  (when freeing a ethdev port),
- or rely on the port count, before and after the eal attach.

The latter solution seems (well not really more robust but at least)
less fragile than the former.
We still have some issues with drivers that create multiple ethdev
ports with a single probe operation, but this was already the case.

Fixes: b0fb26685570 ("ethdev: convert to EAL hotplug")

Reported-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agoapp/testpmd: support tunneled TSO in checksum engine
Jianfeng Tan [Mon, 26 Sep 2016 13:48:34 +0000 (13:48 +0000)]
app/testpmd: support tunneled TSO in checksum engine

Add a new command "tunnel_tso set <tso_segsz> <port>" to enable
segmentation offload and set MSS to tso_segsz. Another command,
"tunnel_tso show <port>" is added to show tunneled packet MSS.
Result 0 means tunnel_tso is disabled.

The original commands, "tso set <tso_segsz> <port>" and "tso show
<port>" are only reponsible for non-tunneled packets. And the new
commands are for tunneled packets.

Below conditions are needed to make it work:
  a. tunnel TSO is supported by the NIC;
  b. "csum parse_tunnel" must be set so that tunneled pkts are
     recognized;
  c. for tunneled pkts with outer L3 is IPv4, "csum set outer-ip"
     must be set to hw, because after tso, total_len of outer IP
     header is changed, and the checksum of outer IP header calculated
     by sw should be wrong; that is not necessary for IPv6 tunneled
     pkts because there's no checksum field to be filled anymore.

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Zhe Tao <zhe.tao@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agonet/i40e: support TSO on tunneling packet
Jianfeng Tan [Mon, 1 Aug 2016 03:56:54 +0000 (03:56 +0000)]
net/i40e: support TSO on tunneling packet

To enable Tx side offload on tunneling packet, driver should set
correct tunneling parameters: (1) EIPT, External IP header type;
(2) EIPLEN, External IP; (3) L4TUNT; (4) L4TUNLEN. This parsing
behavior is based on (ol_flag & PKT_TX_TUNNEL_MASK). And when
it's a tunneling packet, MACLEN defines the outer L2 header.

Also, we define TSO on each kind of tunneling type as a capabilities.
Now only i40e declares to support them.

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agombuf: add Tx side tunneling type
Jianfeng Tan [Mon, 1 Aug 2016 03:56:53 +0000 (03:56 +0000)]
mbuf: add Tx side tunneling type

To support tunneling packet offload capabilities on Tx side, PMDs
(e.g., i40e) need to know what kind of tunneling type of this packet.
Instead of analyzing the packet itself, we depend on applications to
correctly set the tunneling type. These flags are defined inside
rte_mbuf.ol_flags.

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoapp/test: remove crypto queue number hard-coding
Fiona Trahe [Thu, 6 Oct 2016 17:34:29 +0000 (18:34 +0100)]
app/test: remove crypto queue number hard-coding

ts_params->conf.nb_queue_pairs should not be hard coded with device
specific number. It should be retrieved from the device info.
Any test which changes it should restore it to orig value.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
8 years agoapp/test: cleanup unnecessary crypto ring size setup
Fiona Trahe [Thu, 6 Oct 2016 17:34:28 +0000 (18:34 +0100)]
app/test: cleanup unnecessary crypto ring size setup

Removed obsolete comments re inability to free and re-allocate
queue memory and obsolete workaround for it
which used to create maximum size queues first, then later
create smaller queues.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
8 years agoapp/test: remove useless loop for crypto
Fiona Trahe [Thu, 6 Oct 2016 17:34:27 +0000 (18:34 +0100)]
app/test: remove useless loop for crypto

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
8 years agocrypto/aesni_mb: free ring memory on queue release
Fiona Trahe [Thu, 6 Oct 2016 17:34:26 +0000 (18:34 +0100)]
crypto/aesni_mb: free ring memory on queue release

Free ring memory on queue_pair release, else
releasing and setting up queue-pair of a different size fails.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
8 years agodoc: fix typo in SNOW 3G guide
Pablo de Lara [Thu, 6 Oct 2016 20:54:59 +0000 (21:54 +0100)]
doc: fix typo in SNOW 3G guide

Fixes: 1d0c90e6cf0b ("doc: update build instructions for libsso_snow3g")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agocryptodev: fix build on Suse 11 SP2
Pablo de Lara [Wed, 5 Oct 2016 02:45:51 +0000 (03:45 +0100)]
cryptodev: fix build on Suse 11 SP2

This commit fixes following build error, which happens in SUSE 11 SP2,
with gcc 4.5.1:

In file included from lib/librte_cryptodev/rte_cryptodev.c:70:0:
lib/librte_cryptodev/rte_cryptodev.h:772:7:
error: flexible array member in otherwise empty struct

Fixes: 347a1e037fd3 ("lib: use C99 syntax for zero-size arrays")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agoexamples/ipsec-secgw: initialize SA salt
Sergio Gonzalez Monroy [Thu, 29 Sep 2016 15:44:13 +0000 (16:44 +0100)]
examples/ipsec-secgw: initialize SA salt

This patch initializes the salt value used by the following cipher
algorithms:
- CBC: random salt
- GCM/CTR: the key required is 20B, and the last 4B are used as salt.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: add cryptodev queue size constant
Sergio Gonzalez Monroy [Thu, 29 Sep 2016 15:44:12 +0000 (16:44 +0100)]
examples/ipsec-secgw: add cryptodev queue size constant

Introduce a specific cryptodev queue size macro.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: check SP only when setup
Sergio Gonzalez Monroy [Thu, 29 Sep 2016 15:44:11 +0000 (16:44 +0100)]
examples/ipsec-secgw: check SP only when setup

Application will segfault if there is IPv4 or IPv6 and no SP/ACL rules
for IPv4 or IPv6 respectively.

Avoid checking the ACL/SP in such cases.

Fixes: 906257e965b7 ("examples/ipsec-secgw: support IPv6")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: add AES-CTR
Sergio Gonzalez Monroy [Thu, 29 Sep 2016 15:44:10 +0000 (16:44 +0100)]
examples/ipsec-secgw: add AES-CTR

RFC3686: Using AES Counter (CTR) Mode With IPsec ESP.`

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: add AES-GCM
Sergio Gonzalez Monroy [Thu, 29 Sep 2016 15:44:09 +0000 (16:44 +0100)]
examples/ipsec-secgw: add AES-GCM

Add support for AES-GCM (Galois-Counter Mode).

RFC4106: The Use of Galois-Counter Mode (GCM) in IPSec ESP.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: reset crypto operation status
Sergio Gonzalez Monroy [Thu, 29 Sep 2016 15:44:08 +0000 (16:44 +0100)]
examples/ipsec-secgw: reset crypto operation status

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: change CBC IV generation
Sergio Gonzalez Monroy [Thu, 29 Sep 2016 15:44:07 +0000 (16:44 +0100)]
examples/ipsec-secgw: change CBC IV generation

NIST SP800-38A recommends two methods to generate unpredictable IVs
(Initilisation Vector) for CBC mode:
1) Apply the forward function to a nonce (ie. counter)
2) Use a FIPS-approved random number generator

This patch implements the first recommended method by using the forward
function to generate the IV.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/l2fwd-crypto: update for libcrypto
Slawomir Mrozowicz [Tue, 4 Oct 2016 15:11:22 +0000 (17:11 +0200)]
examples/l2fwd-crypto: update for libcrypto

Libcrypto PMD has support for:

Supported cipher algorithms:
RTE_CRYPTO_CIPHER_3DES_CBC
RTE_CRYPTO_CIPHER_AES_CBC
RTE_CRYPTO_CIPHER_AES_CTR
RTE_CRYPTO_CIPHER_3DES_CTR
RTE_CRYPTO_CIPHER_AES_GCM

Supported authentication algorithms:
RTE_CRYPTO_AUTH_AES_GMAC
RTE_CRYPTO_AUTH_MD5
RTE_CRYPTO_AUTH_SHA1
RTE_CRYPTO_AUTH_SHA224
RTE_CRYPTO_AUTH_SHA256
RTE_CRYPTO_AUTH_SHA384
RTE_CRYPTO_AUTH_SHA512
RTE_CRYPTO_AUTH_MD5_HMAC
RTE_CRYPTO_AUTH_SHA1_HMAC
RTE_CRYPTO_AUTH_SHA224_HMAC
RTE_CRYPTO_AUTH_SHA256_HMAC
RTE_CRYPTO_AUTH_SHA384_HMAC
RTE_CRYPTO_AUTH_SHA512_HMAC

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: add libcrypto
Slawomir Mrozowicz [Tue, 4 Oct 2016 15:11:21 +0000 (17:11 +0200)]
app/test: add libcrypto

This patch contains unit tests for libcrypto PMD. User can
use app/test application to check how to use this pmd and to
verify crypto processing.

Test name is cryptodev_libcrypto_autotest.
For performance test cryptodev_libcrypto_perftest can be used.

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: rework AES
Slawomir Mrozowicz [Tue, 4 Oct 2016 15:11:20 +0000 (17:11 +0200)]
app/test: rework AES

This patch rework AES tests .
In general - rename AES-named functions to blockcipher functions pattern.

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agocrypto/libcrypto: add driver for OpenSSL library
Slawomir Mrozowicz [Tue, 4 Oct 2016 15:11:19 +0000 (17:11 +0200)]
crypto/libcrypto: add driver for OpenSSL library

This code provides the initial implementation of the libcrypto
poll mode driver. All cryptography operations are using Openssl
library crypto API. Each algorithm uses EVP_ interface from
openssl API - which is recommended by Openssl maintainers.

This patch adds libcrypto poll mode driver support to librte_cryptodev
library.

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/l2fwd-crypto: enable ZUC EEA3 and EIA3
Pablo de Lara [Thu, 29 Sep 2016 02:59:50 +0000 (03:59 +0100)]
examples/l2fwd-crypto: enable ZUC EEA3 and EIA3

This patch enables ZUC EEA3 cipher algorithm and
ZUC EIA3 authentication algorithm support to
l2fwd-crypto sample application.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: add ZUC
Pablo de Lara [Thu, 29 Sep 2016 02:59:49 +0000 (03:59 +0100)]
app/test: add ZUC

Add cipher and authentication ZUC algorithm tests.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: rename some SNOW 3G functions
Pablo de Lara [Thu, 29 Sep 2016 02:59:48 +0000 (03:59 +0100)]
app/test: rename some SNOW 3G functions

Before adding the new ZUC tests, since they will use
the existing common functions for SNOW3G and KASUMI,
these functions are renamed to *_wireless_algo_*,
instead of *_snow3g_kasumi_*, as they are common
functions for all the three wireless algorithms.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/zuc: add driver for ZUC library
Pablo de Lara [Thu, 29 Sep 2016 02:59:47 +0000 (03:59 +0100)]
crypto/zuc: add driver for ZUC library

Added new SW PMD which makes use of the libsso SW library,
which provides wireless algorithms ZUC EEA3 and EIA3
in software.

This PMD supports cipher-only, hash-only and chained operations
("cipher then hash" and "hash then cipher") of the following
algorithms:
- RTE_CRYPTO_SYM_CIPHER_ZUC_EEA3
- RTE_CRYPTO_SYM_AUTH_ZUC_EIA3

The ZUC hash and cipher algorithms, which are enabled
by this crypto PMD are implemented by Intel's libsso software
library.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: improve error message for disabled crypto
Fiona Trahe [Mon, 26 Sep 2016 12:57:20 +0000 (13:57 +0100)]
app/test: improve error message for disabled crypto

Improve error message if crypto PMD build is not enabled in config file

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: add AES GCM performance test
Arek Kusztal [Wed, 28 Sep 2016 11:54:03 +0000 (12:54 +0100)]
app/test: add AES GCM performance test

This patch adds AES Galois Counter Mode performance test case
for cryptodev QAT and AESNI GCM. Test is performed with different
buffer sizes, burst size of 32 and 128b key. Test vectors
are placed in app/test/test_cryptodev_perf_vectors.h file.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto: fix build with icc
Pablo de Lara [Wed, 28 Sep 2016 00:31:27 +0000 (01:31 +0100)]
crypto: fix build with icc

This commit fixes a compilation error on icc,
due to unallowed conversion from int to enum:

drivers/crypto/snow3g/rte_snow3g_pmd.c(155):
    error #188: enumerated type mixed with another type
        sess->op = mode;
                 ^
drivers/crypto/kasumi/rte_kasumi_pmd.c(155):
    error #188: enumerated type mixed with another type
        sess->op = mode;
                 ^

Fixes: 3aafc423cf4d ("snow3g: add driver for SNOW 3G library")
Fixes: 2773c86d061a ("crypto/kasumi: add driver for KASUMI library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agoapp/test: remove unnecessary conditional for crypto
Pablo de Lara [Mon, 26 Sep 2016 22:13:20 +0000 (23:13 +0100)]
app/test: remove unnecessary conditional for crypto

Regardless the result of the conditional, the true and false
statements were the same, so the conditional can be removed.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
8 years agoexamples/ipsec-secgw: add sample configuration files
Fan Zhang [Wed, 21 Sep 2016 12:05:19 +0000 (13:05 +0100)]
examples/ipsec-secgw: add sample configuration files

This patch adds two sample configuration files to ipsec-secgw sample
application. The sample configuration files show how to setup
back-to-back systems that would forward traffic through an IPsec
tunnel.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agoexamples/ipsec-secgw: support configuration file
Fan Zhang [Wed, 21 Sep 2016 12:05:18 +0000 (13:05 +0100)]
examples/ipsec-secgw: support configuration file

This patch adds the configuration file support to ipsec_secgw
sample application. Instead of hard-coded rules, the users can
specify their own SP, SA, and routing rules in the configuration
file. A command line option "-f" is added to pass the
configuration file location to the application.

Configuration item formats:

SP rule format:
sp <ip_ver> <dir> esp <action> <priority> <src_ip> <dst_ip> \
<proto> <sport> <dport>

SA rule format:
sa <dir> <spi> <cipher_algo> <cipher_key> <auth_algo> <auth_key> \
<mode> <src_ip> <dst_ip>

Routing rule format:
rt <ip_ver> <src_ip> <dst_ip> <port>

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agoapp/test: fix verification of digest for GCM
Arek Kusztal [Thu, 22 Sep 2016 10:45:55 +0000 (11:45 +0100)]
app/test: fix verification of digest for GCM

This patch fixes verification of digest in test_cryptodev.c file
for AES GCM test cases.

Fixes: eec136f3c54f ("aesni_gcm: add driver for AES-GCM crypto operations")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/aesni_gcm: move pre-counter block to driver
Arek Kusztal [Thu, 22 Sep 2016 10:45:53 +0000 (11:45 +0100)]
crypto/aesni_gcm: move pre-counter block to driver

This patch moves computing of pre-counter block into the AESNI-GCM
driver so it can be moved from test files.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/qat: add 3DES cipher algorithm
Fiona Trahe [Fri, 16 Sep 2016 14:19:56 +0000 (15:19 +0100)]
crypto/qat: add 3DES cipher algorithm

3DES support added to QuickAssist PMD with CTR and CBC mode.
Both cipher-only and chained with HMAC_SHAx.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/qat: cleanup code
Fiona Trahe [Fri, 16 Sep 2016 14:19:55 +0000 (15:19 +0100)]
crypto/qat: cleanup code

Cleanup of unused code.
Rename and simplify a badly named struct element, was aes, but
used for all types of ciphers.
Print correct error msg (Unsupported rather than Undefined)
for all ciphers not supported by QAT PMD.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agotools: bind crypto devices
Eoin Breen [Tue, 20 Sep 2016 00:05:01 +0000 (01:05 +0100)]
tools: bind crypto devices

Adding the support to bind/unbind crypto devices with
dpdk-devbind.py script, as now it is not restricted
to network devices anymore.

Signed-off-by: Eoin Breen <eoin.breen@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto: rename all KASUMI references
Pablo de Lara [Wed, 21 Sep 2016 01:45:19 +0000 (02:45 +0100)]
crypto: rename all KASUMI references

KASUMI algorithm has all uppercase letters,
but some references of it had some lowercase letters.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto: rename some SNOW 3G references
Pablo de Lara [Wed, 21 Sep 2016 01:45:18 +0000 (02:45 +0100)]
crypto: rename some SNOW 3G references

SNOW 3G algorithm has all uppercase letters in its name
and a space between SNOW and 3G, but some references of it
had some lowercase letters or no space.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>