[dpdk-dev] [PATCH v3 2/3] port: add kni nodrop writer

2016-06-18 Thread Dumitrescu, Cristian


> -Original Message-
> From: WeiJie Zhuang [mailto:zhuangwj at gmail.com]
> Sent: Thursday, June 16, 2016 12:27 PM
> To: Dumitrescu, Cristian 
> Cc: dev at dpdk.org; Singh, Jasvinder ; Yigit,
> Ferruh ; WeiJie Zhuang 
> Subject: [PATCH v3 2/3] port: add kni nodrop writer
> 
> 1. add no drop writing operations to the kni port
> 2. support dropless kni config in the ip pipeline sample application
> 
> Signed-off-by: WeiJie Zhuang 
> ---
>  examples/ip_pipeline/app.h   |   2 +
>  examples/ip_pipeline/config_parse.c  |  31 -
>  examples/ip_pipeline/init.c  |  26 -
>  examples/ip_pipeline/pipeline_be.h   |   6 +
>  lib/librte_port/rte_port_kni.c   | 220
> +++
>  lib/librte_port/rte_port_kni.h   |  13 +++
>  lib/librte_port/rte_port_version.map |   1 +
>  7 files changed, 292 insertions(+), 7 deletions(-)
> 
> diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h
> index abbd6d4..6a6fdd9 100644
> --- a/examples/ip_pipeline/app.h
> +++ b/examples/ip_pipeline/app.h
> @@ -147,6 +147,8 @@ struct app_pktq_kni_params {
>   uint32_t mempool_id; /* Position in the app->mempool_params */
>   uint32_t burst_read;
>   uint32_t burst_write;
> + uint32_t dropless;
> + uint64_t n_retries;
>  };
> 
>  #ifndef APP_FILE_NAME_SIZE
> diff --git a/examples/ip_pipeline/config_parse.c
> b/examples/ip_pipeline/config_parse.c
> index c55be31..31a50c2 100644
> --- a/examples/ip_pipeline/config_parse.c
> +++ b/examples/ip_pipeline/config_parse.c
> @@ -199,6 +199,8 @@ struct app_pktq_kni_params default_kni_params = {
>   .mempool_id = 0,
>   .burst_read = 32,
>   .burst_write = 32,
> + .dropless = 0,
> + .n_retries = 0,
>  };
> 
>  struct app_pktq_source_params default_source_params = {
> @@ -1927,7 +1929,7 @@ parse_kni(struct app_params *app,
> 
>   if (strcmp(ent->name, "mempool") == 0) {
>   int status = validate_name(ent->value,
> -
> "MEMPOOL", 1);
> + "MEMPOOL", 1);
>   ssize_t idx;
> 
>   PARSE_ERROR((status == 0), section_name,
> @@ -1940,7 +1942,7 @@ parse_kni(struct app_params *app,
> 
>   if (strcmp(ent->name, "burst_read") == 0) {
>   int status = parser_read_uint32(
> >burst_read,
> -
>   ent->value);
> + ent->value);
> 
>   PARSE_ERROR((status == 0), section_name,
>   ent->name);
> @@ -1949,7 +1951,25 @@ parse_kni(struct app_params *app,
> 
>   if (strcmp(ent->name, "burst_write") == 0) {
>   int status = parser_read_uint32(
> >burst_write,
> -
>   ent->value);
> + ent->value);
> +
> + PARSE_ERROR((status == 0), section_name,
> + ent->name);
> + continue;
> + }
> +
> + if (strcmp(ent->name, "dropless") == 0) {
> + int status = parser_read_arg_bool(ent->value);
> +
> + PARSE_ERROR((status != -EINVAL), section_name,
> + ent->name);
> + param->dropless = status;
> + continue;
> + }
> +
> + if (strcmp(ent->name, "n_retries") == 0) {
> + int status = parser_read_uint64(>n_retries,
> + ent->value);
> 
>   PARSE_ERROR((status == 0), section_name,
>   ent->name);
> @@ -2794,6 +2814,11 @@ save_kni_params(struct app_params *app, FILE
> *f)
>   /* burst_write */
>   fprintf(f, "%s = %" PRIu32 "\n", "burst_write", p-
> >burst_write);
> 
> + /* dropless */
> + fprintf(f, "%s = %s\n",
> + "dropless",
> + p->dropless ? "yes" : "no");

Please also do not forget to save the number of retries parameter as well 
(struct app_pktq_kni_params::n_retries):

fprintf(f, "%s = %" PRIu64 "\n", "n_retries", p->n_retries);

I realize that we forgot to save n_retires in function save_txq_params(), can 
you please add it as part of your patch? We have it for save_swq_params().

> +
>   fputc('\n', f);
>   }
>  }
> diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
> index d522de4..af24f52 100644
> --- a/examples/ip_pipeline/init.c
> +++ b/examples/ip_pipeline/init.c
> @@ -1434,10 +1434,28 @@ void app_pipeline_params_get(struct
> app_params *app,
>  #ifdef RTE_LIBRTE_KNI
>   case APP_PKTQ_OUT_KNI:
>   {
> - out->type = PIPELINE_PORT_OUT_KNI_WRITER;
> - out->params.kni.kni = app->kni[in->id];
> - 

[dpdk-dev] [PATCH v3 3/3] mempool: allow for user-owned mempool caches

2016-06-18 Thread Lazaros Koromilas
On Fri, Jun 17, 2016 at 11:37 AM, Olivier Matz  
wrote:
>
>
> On 06/16/2016 01:02 PM, Lazaros Koromilas wrote:
>> The mempool cache is only available to EAL threads as a per-lcore
>> resource. Change this so that the user can create and provide their own
>> cache on mempool get and put operations. This works with non-EAL threads
>> too. This commit introduces the new API calls:
>>
>> rte_mempool_cache_create(size, socket_id)
>> rte_mempool_cache_free(cache)
>> rte_mempool_cache_flush(cache, mp)
>> rte_mempool_default_cache(mp, lcore_id)
>
> These new functions should be added in the .map file, else it will
> break the compilation in with shared_lib=y.

Oops, thanks!

>> Changes the API calls:
>>
>> rte_mempool_generic_put(mp, obj_table, n, cache, flags)
>> rte_mempool_generic_get(mp, obj_table, n, cache, flags)
>>
>> The cache-oblivious API calls use the per-lcore default local cache.
>>
>> Signed-off-by: Lazaros Koromilas 
>> ---
>>  app/test/test_mempool.c  |  94 --
>>  app/test/test_mempool_perf.c |  70 ++---
>>  lib/librte_mempool/rte_mempool.c |  66 +++-
>>  lib/librte_mempool/rte_mempool.h | 163 
>> ---
>>  4 files changed, 310 insertions(+), 83 deletions(-)
>>
>> diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
>> index 10d706f..723cd39 100644
>> --- a/app/test/test_mempool.c
>> +++ b/app/test/test_mempool.c
>> @@ -79,6 +79,9 @@
>>   printf("test failed at %s():%d\n", __func__, __LINE__); \
>>   return -1;  \
>>   } while (0)
>> +#define LOG_ERR() do {  
>>  \
>> + printf("test failed at %s():%d\n", __func__, __LINE__); \
>> + } while (0)
>>
>
> I see that the usage of this macro is always like this:
>
> LOG_ERR();
> ret = -1;
> goto out;
>
> What do you think of having:
>
> #define LOG_ERR() do {  \
> printf("test failed at %s():%d\n", __func__, __LINE__); \
> } while (0)
> #define RET_ERR() do { LOG_ERR(); return -1; } while (0)
> #define GOTO_ERR() do { LOG_ERR(); ret = -1; goto out; } while (0)
>
> Then use GOTO_ERR() when appropriate. It would also factorize
> the printf.

The downside of GOTO_ERR() is that it assumes a variable and a label
name. And you may need to have multiple labels 'out0', 'out1', etc for
the error path. How about:

#define GOTO_ERR(ret, out) do { LOG_ERR(); ret = -1; goto out; } while (0)

Lazaros.


[dpdk-dev] [PATCH v3 1/3] port: add kni interface support

2016-06-18 Thread Dumitrescu, Cristian
Hi Ethan,

Thank you, here are some comments inlined below.

Please reorganize this patch in a slightly different way to look similar to 
other DPDK patch sets and also ease up the integration work for Thomas:
Patch 0: I suggest adding a cover letter;
Patch 1: all librte_port changes (rte_port_kni.h, rte_port_kni.c, 
Makefile, rte_port_version.map), including the "nodrop" KNI port version
Patch 2: all ip_pipeline app changes
Patch 3: ip_pipeline app kni.cfg file
Patch 4: Documentation changes

> -Original Message-
> From: WeiJie Zhuang [mailto:zhuangwj at gmail.com]
> Sent: Thursday, June 16, 2016 12:27 PM
> To: Dumitrescu, Cristian 
> Cc: dev at dpdk.org; Singh, Jasvinder ; Yigit,
> Ferruh ; WeiJie Zhuang 
> Subject: [PATCH v3 1/3] port: add kni interface support
> 
> 1. add KNI port type to the packet framework
> 2. add KNI support to the IP Pipeline sample Application
> 3. some bug fix
> 
> Signed-off-by: WeiJie Zhuang 
> ---
> v2:
> * Fix check patch error.
> v3:
> * Fix code review comments.
> ---
>  doc/api/doxy-api-index.md  |   1 +
>  examples/ip_pipeline/Makefile  |   2 +-
>  examples/ip_pipeline/app.h | 181 +++-
>  examples/ip_pipeline/config/kni.cfg|  67 +
>  examples/ip_pipeline/config_check.c|  26 +-
>  examples/ip_pipeline/config_parse.c| 166 ++-
>  examples/ip_pipeline/init.c| 132 -
>  examples/ip_pipeline/pipeline/pipeline_common_fe.c |  29 ++
>  examples/ip_pipeline/pipeline/pipeline_master_be.c |   6 +
>  examples/ip_pipeline/pipeline_be.h |  27 ++
>  lib/librte_port/Makefile   |   7 +
>  lib/librte_port/rte_port_kni.c | 325 
> +
>  lib/librte_port/rte_port_kni.h |  82 ++
>  lib/librte_port/rte_port_version.map   |   8 +
>  14 files changed, 1047 insertions(+), 12 deletions(-)
>  create mode 100644 examples/ip_pipeline/config/kni.cfg
>  create mode 100644 lib/librte_port/rte_port_kni.c
>  create mode 100644 lib/librte_port/rte_port_kni.h
> 
> diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
> index f626386..5e7f024 100644
> --- a/doc/api/doxy-api-index.md
> +++ b/doc/api/doxy-api-index.md
> @@ -118,6 +118,7 @@ There are many libraries, so their headers may be
> grouped by topics:
>  [frag] (@ref rte_port_frag.h),
>  [reass](@ref rte_port_ras.h),
>  [sched](@ref rte_port_sched.h),
> +[kni]  (@ref rte_port_kni.h),
>  [src/sink] (@ref rte_port_source_sink.h)
>* [table](@ref rte_table.h):
>  [lpm IPv4] (@ref rte_table_lpm.h),
> diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile
> index 5827117..6dc3f52 100644
> --- a/examples/ip_pipeline/Makefile
> +++ b/examples/ip_pipeline/Makefile
> @@ -1,6 +1,6 @@
>  #   BSD LICENSE
>  #
> -#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> +#   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
>  #   All rights reserved.
>  #
>  #   Redistribution and use in source and binary forms, with or without
> diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h
> index 7611341..abbd6d4 100644
> --- a/examples/ip_pipeline/app.h
> +++ b/examples/ip_pipeline/app.h
> @@ -44,6 +44,9 @@
>  #include 
> 
>  #include 
> +#ifdef RTE_LIBRTE_KNI
> +#include 
> +#endif
> 
>  #include "cpu_core_map.h"
>  #include "pipeline.h"
> @@ -132,6 +135,20 @@ struct app_pktq_swq_params {
>   uint32_t mempool_indirect_id;
>  };
> 
> +struct app_pktq_kni_params {
> + char *name;
> + uint32_t parsed;
> +
> + uint32_t socket_id;
> + uint32_t core_id;
> + uint32_t hyper_th_id;
> + uint32_t force_bind;
> +
> + uint32_t mempool_id; /* Position in the app->mempool_params */
> + uint32_t burst_read;
> + uint32_t burst_write;
> +};
> +
>  #ifndef APP_FILE_NAME_SIZE
>  #define APP_FILE_NAME_SIZE   256
>  #endif
> @@ -185,6 +202,7 @@ enum app_pktq_in_type {
>   APP_PKTQ_IN_HWQ,
>   APP_PKTQ_IN_SWQ,
>   APP_PKTQ_IN_TM,
> + APP_PKTQ_IN_KNI,
>   APP_PKTQ_IN_SOURCE,
>  };
> 
> @@ -197,6 +215,7 @@ enum app_pktq_out_type {
>   APP_PKTQ_OUT_HWQ,
>   APP_PKTQ_OUT_SWQ,
>   APP_PKTQ_OUT_TM,
> + APP_PKTQ_OUT_KNI,
>   APP_PKTQ_OUT_SINK,
>  };
> 
> @@ -420,6 +439,8 @@ struct app_eal_params {
> 
>  #define APP_MAX_PKTQ_TM  APP_MAX_LINKS
> 
> +#define APP_MAX_PKTQ_KNI APP_MAX_LINKS
> +
>  #ifndef APP_MAX_PKTQ_SOURCE
>  #define APP_MAX_PKTQ_SOURCE  64
>  #endif
> @@ -471,6 +492,7 @@ struct app_params {
>   struct app_pktq_hwq_out_params
> hwq_out_params[APP_MAX_HWQ_OUT];
>   struct app_pktq_swq_params 

[dpdk-dev] linking error with dpdk

2016-06-18 Thread Raja Jayapal
Hi All,

I am trying to install dpdk with ovs, but am getting the linking errors.
Downloaded and tried with dpdk 2.0/2.2/16.04 and latest ovs.

DPDK :?wget http://dpdk.org/browse/dpdk/snapshot/dpdk-2.0.0.tar.gz and?wget 
http://dpdk.org/browse/dpdk/snapshot/dpdk-2.2.0.tar.gz
OVS : git clone https://github.com/openvswitch/ovs.git

?./configure --with-dpdk=/home/ubuntu/raja2/dpdk-2.2.0
- - - - - - -?
checking target hint for cgcc... x86_64
checking whether make has GNU make $(if) extension... yes
checking whether dpdk datapath is enabled... yes
checking for /home/ubuntu/raja2/dpdk-2.2.0/include/rte_config.h... no
checking for /home/ubuntu/raja2/dpdk-2.2.0/include/dpdk/rte_config.h... no
configure: error: Could not find DPDK libraries in 
/home/ubuntu/raja2/dpdk-2.2.0/lib

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var 
--with-dpdk=/home/ubuntu/raja1/dpdk-2.0.0/x86_64-native-linuxapp-gcc/ 
--enable-ssl
?- - - - - - - - - -?
checking whether gcc -std=gnu99 accepts -Wno-unused-parameter... yes
checking target hint for cgcc... x86_64
checking whether make has GNU make $(if) extension... yes
checking whether dpdk datapath is enabled... yes
checking for 
/home/ubuntu/raja1/dpdk-2.0.0/x86_64-native-linuxapp-gcc//include/rte_config.h...
 yes
configure: error: Could not find DPDK libraries in 
/home/ubuntu/raja1/dpdk-2.0.0/x86_64-native-linuxapp-gcc//lib
ubuntu at 01HW462422:~/raja1/ovs$

Installed dpdk successfully, but when i build ovs with dpdk i am getting the 
linking error in all the three versions of dpdk.
Is there any specific version in which the dpdk-ovs will only work, if so 
please let me know.

Thanks,
Raja
=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




[dpdk-dev] [PATCH] ethdev: fix formatting of doxygen comments

2016-06-18 Thread Hiroyuki Mikita
This commit fixes some functions missing in API documentation.

Signed-off-by: Hiroyuki Mikita 
---
 lib/librte_ether/rte_ethdev.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index bd93bf6..2698c3e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -2009,7 +2009,7 @@ int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t 
tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);

-/*
+/**
  * Return the NUMA socket to which an Ethernet device is connected
  *
  * @param port_id
@@ -2021,7 +2021,7 @@ int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t 
tx_queue_id,
  */
 int rte_eth_dev_socket_id(uint8_t port_id);

-/*
+/**
  * Check if port_id of device is attached
  *
  * @param port_id
@@ -2032,7 +2032,7 @@ int rte_eth_dev_socket_id(uint8_t port_id);
  */
 int rte_eth_dev_is_valid_port(uint8_t port_id);

-/*
+/**
  * Allocate mbuf from mempool, setup the DMA physical address
  * and then start RX for specified queue of a port. It is used
  * when rx_deferred_start flag of the specified queue is true.
@@ -2050,7 +2050,7 @@ int rte_eth_dev_is_valid_port(uint8_t port_id);
  */
 int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);

-/*
+/**
  * Stop specified RX queue of a port
  *
  * @param port_id
@@ -2066,7 +2066,7 @@ int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t 
rx_queue_id);
  */
 int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);

-/*
+/**
  * Start TX for specified queue of a port. It is used when tx_deferred_start
  * flag of the specified queue is true.
  *
@@ -2083,7 +2083,7 @@ int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t 
rx_queue_id);
  */
 int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);

-/*
+/**
  * Stop specified TX queue of a port
  *
  * @param port_id
@@ -4030,7 +4030,7 @@ int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t 
queue_id,
 int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);

-/*
+/**
  * Retrieve number of available registers for access
  *
  * @param port_id
-- 
1.9.1