path: root/examples
AgeCommit message (Collapse)Author
2016-04-11examples/vm_power_manager: fix libvirt dependency checkMarvin Liu
vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo to retrieve domU vcpu information. This API is implemented from version 0.9.3. Suse11 SP3 32bit default libvirt version is 0.8.8. examples/vm_power_manager/channel_manager.c: channel_manager.c:117:3: error: implicit declaration of function 'virDomainGetVcpuPinInfo' Check and skip it from examples or raise an error when trying to compile without libvirt or with a too old libvirt. Fixes: e8ae9b662 ("examples/vm_power: channel manager and monitor in host") Signed-off-by: Marvin Liu <> Signed-off-by: Thomas Monjalon <> Acked-by: Bruce Richardson <>
2016-04-10examples/vhost_xen: fix 32-bit buildPablo de Lara
Compilation fails on 32 bits on Vhost_xen sample app, due to wrong casting: examples/vhost_xen/vhost_monitor.c: In function ‘new_device’: examples/vhost_xen/vhost_monitor.c:288:62: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] Fixes: 47bd46112b71 ("xen: import xenvirt pmd and vhost_xen") Signed-off-by: Pablo de Lara <>
2016-04-08examples/performance-thread: restrict to x86_64Pablo de Lara
Performance-thread sample app is only supported for x86_64 targets, so this commit adds a check to avoid compilation on other targets. Signed-off-by: Pablo de Lara <>
2016-04-08examples/ipsec-secgw: fix anonymous union initializationPablo de Lara
In icc 14.0, compilation was broken: examples/ipsec-secgw/sa.c(212): error: a designator for an anonymous union member can only appear within braces corresponding to that anonymous union .cipher = { RTE_CRYPTO_CIPHER_OP_ENCRYPT, RTE_CRYPTO_CIPHER_AES_CBC, ^ The member in anonymous union initialization should be inside '{}', otherwise it will report an error. Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Signed-off-by: Pablo de Lara <>
2016-04-08examples/ip_pipeline: fix 32-bit buildJasvinder Singh
error log: ip_pipeline/pipeline/pipeline_routing_be.c:1537: integer constant is too large for 'long' type Fixes: 0ae7275810f1 ("examples/ip_pipeline: add more functions to routing pipeline") Signed-off-by: Jasvinder Singh <> Acked-by: Pablo de Lara <> Acked-by: John McNamara <>
2016-04-08examples/ip_pipeline: fix size of allocated memoryMarcin Kerlin
CID 120150: Wrong size of the allocated memory. Passing argument as size of pointer (8UL) instead of size of structure app_pipeline_firewall_rule. Fixes: 67ebdbef0c31 ("examples/ip_pipeline: add bulk update of firewall rules") Signed-off-by: Marcin Kerlin <>
2016-04-07examples: fix draining all queues in l3fwd derivativesTomasz Kulasek
In l3fwd-acl and l3fwd-power not all tx ports was included in tx_port_id array, used to periodically drain only available ports. This caused that some packets can remain in buffer when application stops to receiving packets or when size of burst is small. Fixes: e2366e74e029 ("examples: use buffered Tx") Signed-off-by: Tomasz Kulasek <>
2016-04-07examples/l2fwd-crypto: fix string overflowPablo de Lara
When parsing crypto device type, the string was being copied with strcpy(), which could overflow the destination buffer (which is 32 byte long), so snprintf() should be used instead. This fixes coverity issue 124575: /examples/l2fwd-crypto/main.c: 1005 in l2fwd_crypto_parse_args_long_options() >>> CID 124575: (STRING_OVERFLOW) >>> You might overrun the 32 byte fixed-size string "options->string_auth_algo" by copying "optarg" without checking the length. 1005 strcpy(options->string_auth_algo, optarg); Fixes: 49f79e86480d ("examples/l2fwd-crypto: add missing string initialization") Signed-off-by: Pablo de Lara <> Acked-by: Declan Doherty <>
2016-04-06examples/l3fwd: fix crash with gcc 5Tomasz Kulasek
It seems that with gcc >5.x and -O2/-O3 optimization breaks packet grouping algorithm. When last packet pointer "lp" and "pnum->u64" buffer points the same memory buffer, high optimization can cause unpredictable results. It seems that assignment of precalculated group sizes may interfere with initialization of new group size when lp points value inside current group and didn't should be changed. With gcc >5.x and optimization we cannot be sure which assignment will be done first, so the group size can be counted incorrectly. This patch eliminates intersection of assignment of initial group size (lp[0] = 1) and precalculated group sizes when gptbl[v].idx < 4. Fixes: 94c54b4158d5 ("examples/l3fwd: rework exact-match") Signed-off-by: Tomasz Kulasek <> Acked-by: Konstantin Ananyev <>
2016-04-04examples: fix build with icc 15.0.1Daniel Mrzyglod
error: loops in this subroutine are not good vectorization candidates (try compiling with O3 and/or IPO). this error occurs in icc 15.0.1 Solution to disable this diagnostic message Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Fixes: 8cc72f2814dd ("examples/vmdq_dcb: support X710") Signed-off-by: Daniel Mrzyglod <>
2016-04-04examples/l2fwd-crypto: fix build with iccDaniel Mrzyglod
Fix for compilation errors for icc: error #188: enumerated type mixed with another type Fixes: 00c58901f1b3 ("examples/l2fwd-crypto: use key-value list of supported algorithms") Signed-off-by: Daniel Mrzyglod <> Acked-by: Pablo de Lara <>
2016-04-01examples/ip_pipeline: fix pcap file parsingFan Zhang
This patch fixes the pcap file parsing in ip_pipeline. Originally, the parser recognizes the pcap related entries regardless of the RTE_PORT_PCAP macro definition status. Fixes: fe5d04621303 ("examples/ip_pipeline: add pcap file dump") Signed-off-by: Fan Zhang <> Acked-by: Cristian Dumitrescu <>
2016-04-01ethdev: redesign link speed configMarc Sune
This patch redesigns the API to set the link speed/s configuration of an ethernet port. Specifically: - it allows to define a set of advertised speeds for auto-negociation. - it allows to disable link auto-negociation (single fixed speed). - default: auto-negociate all supported speeds. A flag autoneg in struct rte_eth_link indicates if link speed was a result of auto-negociation or was fixed by configuration. Signed-off-by: Marc Sune <> Tested-by: Nelio Laranjeiro <> Signed-off-by: Thomas Monjalon <> Tested-by: Beilei Xing <> Tested-by: Adrien Mazarguil <>
2016-04-01ethdev: use constants for link stateThomas Monjalon
Define and use ETH_LINK_UP and ETH_LINK_DOWN where appropriate. Signed-off-by: Marc Sune <> Signed-off-by: Thomas Monjalon <>
2016-03-31examples/ip_pipeline: fix flow classificationFan Zhang
This patch fixes the initialization error in flow classification pipeline. Originally, when there is no key_mask specified in the CFG file, all '0' mask is utilized. Fixes: 1a33c5ea2f45 ("examples/ip_pipeline: clean config parser") Signed-off-by: Fan Zhang <> Acked-by: Cristian Dumitrescu <>
2016-03-31examples/ip_pipeline: fix SSE4.2 optimization branchThomas Monjalon
The branch was disabled because of a typo in the SSE4.2 flag. Change also the x86_64 flag to use a DPDK one. Fixes: 28377375c6c0 ("examples/ip_pipeline: fix build for x86_64 without SSE4.2") Signed-off-by: Thomas Monjalon <> Acked-by: Cristian Dumitrescu <>
2016-03-31examples/l3fwd: fix size of destination port idsKonstantin Ananyev
Originally l3fwd used 16-bit value to store dest_port value. To accommodate 24-bit nexthop dest_port was increased to 32-bit, though some further packet processing code remained unchanged and still expects dest_port to be 16-bit. That is not correct and can cause l3fwd invalid behaviour or even process crash/hang on some input packet patterns. For the fix, I choose the simplest approach and restored dest_port as 16-bit value, plus necessary conversions from 32 to 16 bit values after lpm_lookupx4. Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field") Signed-off-by: Konstantin Ananyev <>
2016-03-31examples/l3fwd: fix packets lost when stoppingTomasz Kulasek
Not all tx ports was included in tx_port_id array, used to periodically drain only available ports. This caused that some packets remain in buffer when application stops to receiving packets. Fixes: 52c97adc1f0f ("examples/l3fwd: fix exact match performance") Signed-off-by: Tomasz Kulasek <> Acked-by: Konstantin Ananyev <>
2016-03-31examples/ipsec-secgw: fix build on FreeBSDDaniel Mrzyglod
In FreeBSD, sys/types.h and netinet/in.h need to be included before netinet/ip.h There were missed typedef for u_char - <sys/types.h> There were missed network definitions - <netinet/in.h> Failure #13: Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Signed-off-by: Daniel Mrzyglod <> Acked-by: Sergio Gonzalez Monroy <>
2016-03-31examples/l2fwd-crypto: extend crypto informationPablo de Lara
Display extra crypto information (algorithms, keys/IV/AAD used, chain...), so user can know exactly what operations are being carried out. Signed-off-by: Pablo de Lara <> Tested-by: Min Cao <> Acked-by: Declan Doherty <>
2016-03-31examples/l2fwd-crypto: use key-value list of supported algorithmsPablo de Lara
In order to ease the parsing and display of supported algorithms in the application, two new arrays are created, which contains the strings of the different cipher and authentication algorithms, These lists are used to parse the algorithms from the command line, and will be used to display crypto information to the user. Signed-off-by: Pablo de Lara <> Acked-by: Declan Doherty <>
2016-03-31examples/l2fwd-crypto: clarify key parsing in helpPablo de Lara
Cipher/Auth keys, AAD and IV must be passed from command line with ":" between bytes, but help was not clarifying that. Signed-off-by: Pablo de Lara <> Acked-by: Declan Doherty <>
2016-03-31examples/l2fwd-crypto: fix ambiguous input key sizePablo de Lara
Some crypto algorithms support more than one key size (including cipher key, authentication key, IV and AAD), but the app was using always the minimum size. These changes allows the user to use an specific size, either from the string provided with cipher_key, auth_key, iv and ADD parameters, or from the values provided with cipher_key_random_size, auth_key_random_size, iv_random_size and aad_random_size. This also allows the user to specify the digest size. Fixes: 1df9c0109f4c ("examples/l2fwd-crypto: parse key parameters") Signed-off-by: Pablo de Lara <> Tested-by: Min Cao <> Acked-by: Declan Doherty <>
2016-03-31examples/l2fwd-crypto: fix length of random IV/AADPablo de Lara
App was generating a random IV/AAD of only 4 bytes, instead of the actual length, since it was using sizeof(length). Fixes: 27cf2d1b18e1 ("examples/l2fwd-crypto: discover capabilities") Signed-off-by: Pablo de Lara <> Tested-by: Min Cao <> Acked-by: Declan Doherty <>
2016-03-31examples/l2fwd-crypto: add missing string initializationPablo de Lara
When passing the preferred crypto device type in the command line parameters, the string (HW/SW/ANY) was not being saved, which is used for error information to the user. Fixes: 27cf2d1b18e1 ("examples/l2fwd-crypto: discover capabilities") Signed-off-by: Pablo de Lara <> Acked-by: Declan Doherty <>
2016-03-31examples/l2fwd-crypto: rename period parameterPablo de Lara
L2fwd-crypto app is based on L2fwd app and it inherits some of its parameters (such as portmask, queues per core...). The parameter period (period of time between statistic updates) is -T in L2fwd, but was -t in L2fwd-crypto, so for consistency, it is changed back to -T Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application") Signed-off-by: Pablo de Lara <> Acked-by: Declan Doherty <>
2016-03-31examples/l2fwd-crypto: add missing new line in helpPablo de Lara
Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application") Signed-off-by: Pablo de Lara <> Acked-by: Declan Doherty <>
2016-03-31examples/dpdk_qat: fix build error messagePablo de Lara
When compiling dpdk_qat app with an i686 target on a x86_64 OS, an error message was shown, saying that it can only be built on a 32-bit OS, which should be i686 OS, as other 32-bit OS are not supported. Fixes: 3460012bcce6 ("examples/qat: update") Signed-off-by: Pablo de Lara <>
2016-03-25examples/l3fwd: fix using packet type blindlyJianfeng Tan
As a example to use ptype info, l3fwd needs firstly to use rte_eth_dev_get_supported_ptypes() API to check if device and/or its PMD driver will parse and fill the needed packet type; if not, use the newly added option, --parse-ptype, to analyze it in the callback softly. As the mode of EXACT_MATCH uses the 5 tuples to caculate hash, so we narrow down its scope to: a. ip packets with no extensions, and b. L4 payload should be either tcp or udp. Note: this patch does not completely solve the issue, "cannot run l3fwd on virtio or other devices", because hw_ip_checksum may be not supported by the devices. Currently we can: a. remove this requirements, or b. wait for virtio front end (pmd) to support it. Signed-off-by: Jianfeng Tan <> Acked-by: Konstantin Ananyev <>
2016-03-25examples/l3fwd: fix validation for queue id of config tupleReshma Pattan
Added validation for queue id of config parameter tuple. This validation enforces user to enter queue ids of a port from 0 and in sequence. This additional validation on queue ids avoids ixgbe crash caused by null rxq pointer access inside ixgbe_dev_rx_init. Reason for null rxq is, L3fwd application allocates memory only for queues passed by user. But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to nb_rx_queues, which is not true and coredump while accessing the unallocated queue . Fixes: af75078fece3 ("first public release") Signed-off-by: Reshma Pattan <> Acked-by: Pablo de Lara <>
2016-03-25examples/vhost: fix VLAN tagYuanhan Liu
While the last arg of virtio_tx_route() asks a vlan tag, we currently feed it with device_fh, which is wrong. Fix it. Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application") Reported-by: Qian Xu <> Signed-off-by: Yuanhan Liu <>
2016-03-25examples/vhost: fix offload settingsYuanhan Liu
Comments for PKT_TX_TCP_SEG at rte_mbuf says that we should only set PKT_TX_IP_CKSUM and reset ip hdr checksum for IPv4: - if it's IPv4, set the PKT_TX_IP_CKSUM flag and write the IP checksum to 0 in the packet Fixes: 9fd72e3cbd29 ("examples/vhost: add virtio offload") Signed-off-by: Yuanhan Liu <>
2016-03-25examples/vhost: remove unnecessary pseudo checksum calculationYuanhan Liu
For checksum offloading only case, the TCP/IP stack would have calculated the pseudo checksum. Therefore, we don't need to re-calculate it again here; remove it. Signed-off-by: Yuanhan Liu <>
2016-03-24examples/l2fwd-crypto: add NULL algorithmsPablo de Lara
NULL crypto operation is now supported, but l2fwd-crypto was missing an update on the list of supported algorithms that can be passed from command line. Signed-off-by: Pablo de Lara <>
2016-03-24examples/l2fwd-crypto: add AES-GCM algorithmPablo de Lara
AES GCM is an algorithm for both ciphering and authentication, but the authentication algorithm was missing in the list of supported algorithms that can be passed from command line. Signed-off-by: Pablo de Lara <>
2016-03-24examples/l2fwd-crypto: add SNOW 3G algorithmsPablo de Lara
Since SNOW3G UEA2/UIA2 are supported now by both HW and SW, l2fwd-crypto may use them, extending the list of algorithms parsed from command line. Signed-off-by: Pablo de Lara <>
2016-03-24examples/l2fwd-crypto: fix command line helpPablo de Lara
Previous cdev parameter was changed to cdev_type, to select a crypto device type preference (HW/SW/ANY), instead of the device itself (QAT/AESNI...). Also deleted cdev duplicated parameter from the help. Fixes: 27cf2d1b18e1 ("examples/l2fwd-crypto: discover capabilities") Signed-off-by: Pablo de Lara <> Acked-by: Fiona Trahe <>
2016-03-22mk: fix missing librt dependenciesDaniel Mrzyglod
For GLIBC < 2.17 it is necessery to add -lrt for linker from glibc > 2.17 The `clock_*' suite of functions (declared in <time.h>) is now available directly in the main C library. This affect Ubuntu 12.04 in i686 and other older Linux Distros). Fixes: 4758404a3084 ("mk: fix eal shared library dependencies") Signed-off-by: Daniel Mrzyglod <>
2016-03-22examples/l3fwd: remove old SSE4 commentsThomas Monjalon
The flag ENABLE_MULTI_BUFFER_OPTIMIZE has been removed so the related comments are now useless. Fixes: 268888b5b020 ("examples/l3fwd: modularize") Signed-off-by: Thomas Monjalon <>
2016-03-22examples/performance-thread: fix build without SSE4.1Thomas Monjalon
clang reports these errors: error: too many arguments to function call, expected 2, have 3 examples/performance-thread/l3fwd-thread/main.c:1220:1: note: 'l3fwd_simple_forward' declared here examples/l3fwd/main.c:550:1: error: unused function 'send_packetsx4' The function is used only when ENABLE_MULTI_BUFFER_OPTIMIZE is 1. Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app") Signed-off-by: Thomas Monjalon <>
2016-03-22examples/ip_pipeline: fix configuration parserFan Zhang
Fixes: 377cd98e0ab6 ("examples/ip_pipeline: add link identification") Signed-off-by: Fan Zhang <> Acked-by: Cristian Dumitrescu <>
2016-03-21examples/l2fwd-cat: add sample application for PQoS CAT and CDPWojciech Andralojc
This patch implements PQoS as a sample application. PQoS allows management of the CPUs last level cache, which can be useful for DPDK to ensure quality of service. The sample app links against the existing PQoS library ( White paper demonstrating example use case "Increasing Platform Determinism with Platform Quality of Service for the Data Plane Development Kit" ( Signed-off-by: Wojciech Andralojc <> Signed-off-by: Tomasz Kantecki <> Signed-off-by: Marcel D Cornu <>
2016-03-21examples/l3fwd: fix exact match performanceTomasz Kulasek
It seems that for the most use cases, previous hash_multi_lookup provides better performance, and more, sequential lookup can cause significant performance drop. This patch sets previously optional hash_multi_lookup method as default. It also provides some minor optimizations such as queue drain only on used tx ports. Fixes: 94c54b4158d5 ("examples/l3fwd: rework exact-match") Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field") Fixes: 64d3955de1de ("examples/l3fwd: fix ARM build") Reported-by: Qian Xu <> Signed-off-by: Tomasz Kulasek <>
2016-03-21examples/l3fwd: fix build with hash multi-lookupMaciej Czekaj
l3fwd does not compile with HASH_MULTI_LOOKUP. 2 issues: * in 64d395 mask0 changed type from xmm_t to rte_xmm_t -> use x field from rte_xmm_t * in dc81eb dst_port parameter changed to uint32_t -> change uint16_t dst_port to uin32_t dsp_port Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field") Fixes: 64d3955de1de ("examples/l3fwd: fix ARM build") Signed-off-by: Maciej Czekaj <>
2016-03-18lpm: fix pipeline appsMichal Kobylinski
Updated ip_pipeline app is using new changes from LPM library (Increased number of next hops and added new config structure for LPM IPv4). Fixes: f1f7261838b3 ("lpm: add a new config structure for IPv4") Signed-off-by: Michal Kobylinski <> Acked-by: Cristian Dumitrescu <>
2016-03-16examples/l3fwd-power: fix memory leak for non-IP packetsShaopeng He
Previous l3fwd-power only processes IP and IPv6 packets, other packets' mbufs are not freed, and this causes a memory leak. This patch fixes this issue. Fixes: 3c0184cc0c60 ("examples: replace some offload flags with packet type") Signed-off-by: Shaopeng He <> Acked-by: Jing Chen <> Acked-by: Michael Qiu <>
2016-03-16examples/vmdq_dcb: support X710Jingjing Wu
Currently, the example vmdq_dcb only works on Intel(R) 82599 NICs. This patch extends this sample to make it work both on Intel(R) 82599 and X710/XL710 NICs by making the following changes: 1. add VMDQ base queue checking to avoid forwarding on PF queues. 2. assign each VMDQ pool to a MAC address. 3. add more arguments (nb-tcs, enable-rss) to change the default setting 4. extend the max number of queues from 128 to 1024. This patch also reworks the user guide for the vmdq_dcb sample. Signed-off-by: Jingjing Wu <> Acked-by: Helin Zhang <>
2016-03-13examples/ip_pipeline: use unsigned constants for left shift operationsPanu Matilainen
Tell the compiler to use unsigned constants for left shift ops, otherwise building with gcc >= 6.0 fails due to multiple warnings like: warning: left shift of negative value [-Wshift-negative-value] Signed-off-by: Panu Matilainen <> Acked-by: Cristian Dumitrescu <>
2016-03-13examples/ip_pipeline: add load balancing to pass-throughJasvinder Singh
The pass-through pipeline implementation is extended with load balancing function. This function allows uniform distribution of the packets among its output ports. For packets distribution, any application level logic can be applied. For instance, in this implementation, hash value computed over specific header fields of the incoming packets has been used to spread traffic uniformly among the output ports. The following pass-through configuration can be used for implementing load balancing function over ipv4 traffic; [PIPELINE0] type = PASS-THROUGH core = 0 pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0 dma_src_offset = 278; mbuf (128) + headroom (128) + 1st ethertype offset (14) + ttl offset within ip header = 278 (ipv4) dma_dst_offset = 128; mbuf (128) dma_size = 16 dma_src_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF dma_hash_offset = 144; (dma_dst_offset+dma_size) lb = hash Signed-off-by: Jasvinder Singh <> Acked-by: Cristian Dumitrescu <>
2016-03-13examples/ip_pipeline: add pcap file dumpFan Zhang
This patch add packet dumping feature to ip_pipeline. Output port type SINK now supports dumping packets to PCAP file before releasing mbuf back to mempool. This feature can be applied by specifying parameters in configuration file as shown below: [PIPELINE1] type = PASS-THROUGH core = 1 pktq_in = SOURCE0 SOURCE1 pktq_out = SINK0 SINK1 pcap_file_wr = /path/to/eth1.pcap /path/to/eth2.pcap pcap_n_pkt_wr = 80 0 The configuration section "pcap_file_wr" contains full path and name of the PCAP file which the packets will be dumped to. If multiple SINKs exists, each shall have its own PCAP file path listed in this section, separated by spaces. Multiple SINK ports shall NOT share same PCAP file to be dumped. The configuration section "pcap_n_pkt_wr" contains integer value(s) and indicates the maximum number of packets to be dumped to the PCAP file. If this value is "0", the "infinite" dumping mode will be used. If this value is N (N > 0), the dumping will be finished when the number of packets dumped to the file reaches N. To enable PCAP dumping support to IP pipeline, the compiler option CONFIG_RTE_PORT_PCAP must be set to 'y'. It is possible to disable this feature by removing "pcap_file_wr" and "pcap_n_pkt_wr" lines from the configuration file. Signed-off-by: Fan Zhang <> Acked-by: Cristian Dumitrescu <>