[dpdk-dev] [PATCH v2 17/17] libte_acl: remove unused macros.

2015-01-12 Thread Konstantin Ananyev
Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl.h | 39 ++-
 lib/librte_acl/acl_run.h |  1 -
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 61b849a..e65e079 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -62,13 +62,50 @@ struct rte_acl_bitset {

 #defineRTE_ACL_NODE_DFA(0 << RTE_ACL_TYPE_SHIFT)
 #defineRTE_ACL_NODE_SINGLE (1U << RTE_ACL_TYPE_SHIFT)
-#defineRTE_ACL_NODE_QEXACT (2U << RTE_ACL_TYPE_SHIFT)
 #defineRTE_ACL_NODE_QRANGE (3U << RTE_ACL_TYPE_SHIFT)
 #defineRTE_ACL_NODE_MATCH  (4U << RTE_ACL_TYPE_SHIFT)
 #defineRTE_ACL_NODE_TYPE   (7U << RTE_ACL_TYPE_SHIFT)
 #defineRTE_ACL_NODE_UNDEFINED  UINT32_MAX

 /*
+ * ACL RT structure is a set of multibit tries (with stride == 8)
+ * represented by an array of transitions. The next position is calculated
+ * based on the current position and the input byte.
+ * Each transition is 64 bit value with the following format:
+ * | node_type_specific : 32 | node_type : 3 | node_addr : 29 |
+ * For all node types except RTE_ACL_NODE_MATCH, node_addr is an index
+ * to the start of the node in the transtions array.
+ * Few different node types are used:
+ * RTE_ACL_NODE_MATCH:
+ * node_addr value is and index into an array that contains the return value
+ * and its priority for each category.
+ * Upper 32 bits of the transtion value are not used for that node type.
+ * RTE_ACL_NODE_QRANGE:
+ * that node consist of up to 5 transitions.
+ * Upper 32 bits are interpreted as 4 signed character values which
+ * are ordered from smallest(INT8_MIN) to largest (INT8_MAX).
+ * These values define 5 ranges:
+ * INT8_MIN <= range[0]  <= ((int8_t *))[4]
+ * ((int8_t *))[4] < range[1] <= ((int8_t *))[5]
+ * ((int8_t *))[5] < range[2] <= ((int8_t *))[6]
+ * ((int8_t *))[6] < range[3] <= ((int8_t *))[7]
+ * ((int8_t *))[7] < range[4] <= INT8_MAX
+ * So for input byte value within range[i] i-th transition within that node
+ * will be used.
+ * RTE_ACL_NODE_SINGLE:
+ * always transitions to the same node regardless of the input value.
+ * RTE_ACL_NODE_DFA:
+ * that node consits of up to 256 transitions.
+ * In attempt to conserve space all transitions are divided into 4 consecutive
+ * groups, by 64 transitions per group:
+ * group64[i] contains transitions[i * 64, .. i * 64 + 63].
+ * Upper 32 bits are interpreted as 4 unsigned character values one per group,
+ * which contain index to the start of the given group within the node.
+ * So to calculate transition index within the node for given input byte value:
+ * input_byte - ((uint8_t *))[4 + input_byte / 64].
+ */
+
+/*
  * Structure of a node is a set of ptrs and each ptr has a bit map
  * of values associated with this transition.
  */
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index 850bc81..b2fc42c 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -40,7 +40,6 @@
 #define MAX_SEARCHES_AVX16 16
 #define MAX_SEARCHES_SSE8  8
 #define MAX_SEARCHES_SSE4  4
-#define MAX_SEARCHES_SSE2  2
 #define MAX_SEARCHES_SCALAR2

 #define GET_NEXT_4BYTES(prm, idx)  \
-- 
1.8.5.3



[dpdk-dev] [PATCH v2 16/17] libte_acl: introduce max_size into rte_acl_config.

2015-01-12 Thread Konstantin Ananyev
If at build phase we don't make any trie splitting,
then temporary build structures and resulting RT structure might be
much bigger than current.
>From other side - having just one trie instead of multiple can speedup
search quite significantly.
>From my measurements on rule-sets with ~10K rules:
RT table up to 8 times bigger, classify() up to 80% faster
than current implementation.
To make it possible for the user to decide about performance/space trade-off -
new parameter for build config structure (max_size) is introduced.
Setting it to the value greater than zero, instructs  rte_acl_build() to:
- make sure that size of RT table wouldn't exceed given value.
- attempt to minimise number of tries in the table.
Setting it to zero maintains current behaviour.
That introduces a minor change in the public API, but I think the possible
performance gain is too big to ignore it.

Signed-off-by: Konstantin Ananyev 
---
 app/test-acl/main.c   |  33 
 examples/l3fwd-acl/main.c |   3 +-
 lib/librte_acl/acl.h  |   2 +-
 lib/librte_acl/acl_bld.c  | 134 +-
 lib/librte_acl/acl_gen.c  |  22 +---
 lib/librte_acl/rte_acl.c  |   1 +
 lib/librte_acl/rte_acl.h  |   2 +
 7 files changed, 131 insertions(+), 66 deletions(-)

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index 52f43c6..5e8db04 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -85,6 +85,7 @@
 #defineOPT_SEARCH_ALG  "alg"
 #defineOPT_BLD_CATEGORIES  "bldcat"
 #defineOPT_RUN_CATEGORIES  "runcat"
+#defineOPT_MAX_SIZE"maxsize"
 #defineOPT_ITER_NUM"iter"
 #defineOPT_VERBOSE "verbose"
 #defineOPT_IPV6"ipv6"
@@ -126,6 +127,7 @@ static struct {
const char *prgname;
const char *rule_file;
const char *trace_file;
+   size_t  max_size;
uint32_tbld_categories;
uint32_trun_categories;
uint32_tnb_rules;
@@ -780,6 +782,8 @@ acx_init(void)
FILE *f;
struct rte_acl_config cfg;

+   memset(, 0, sizeof(cfg));
+
/* setup ACL build config. */
if (config.ipv6) {
cfg.num_fields = RTE_DIM(ipv6_defs);
@@ -789,6 +793,7 @@ acx_init(void)
memcpy(, ipv4_defs, sizeof(ipv4_defs));
}
cfg.num_categories = config.bld_categories;
+   cfg.max_size = config.max_size;

/* setup ACL creation parameters. */
prm.rule_size = RTE_ACL_RULE_SZ(cfg.num_fields);
@@ -899,8 +904,8 @@ search_ip5tuples(__attribute__((unused)) void *arg)
return 0;
 }

-static uint32_t
-get_uint32_opt(const char *opt, const char *name, uint32_t min, uint32_t max)
+static unsigned long
+get_ulong_opt(const char *opt, const char *name, size_t min, size_t max)
 {
unsigned long val;
char *end;
@@ -964,6 +969,9 @@ print_usage(const char *prgname)
"= "
"should be either 1 or multiple of %zu, "
"but not greater then %u]\n"
+   "[--" OPT_MAX_SIZE
+   "= "
+   "leave 0 for default behaviour]\n"
"[--" OPT_ITER_NUM "=]\n"
"[--" OPT_VERBOSE "=]\n"
"[--" OPT_SEARCH_ALG "=%s]\n"
@@ -984,6 +992,7 @@ dump_config(FILE *f)
fprintf(f, "%s:%u\n", OPT_TRACE_STEP, config.trace_step);
fprintf(f, "%s:%u\n", OPT_BLD_CATEGORIES, config.bld_categories);
fprintf(f, "%s:%u\n", OPT_RUN_CATEGORIES, config.run_categories);
+   fprintf(f, "%s:%zu\n", OPT_MAX_SIZE, config.max_size);
fprintf(f, "%s:%u\n", OPT_ITER_NUM, config.iter_num);
fprintf(f, "%s:%u\n", OPT_VERBOSE, config.verbose);
fprintf(f, "%s:%u(%s)\n", OPT_SEARCH_ALG, config.alg.alg,
@@ -1010,6 +1019,7 @@ get_input_opts(int argc, char **argv)
{OPT_TRACE_FILE, 1, 0, 0},
{OPT_TRACE_NUM, 1, 0, 0},
{OPT_RULE_NUM, 1, 0, 0},
+   {OPT_MAX_SIZE, 1, 0, 0},
{OPT_TRACE_STEP, 1, 0, 0},
{OPT_BLD_CATEGORIES, 1, 0, 0},
{OPT_RUN_CATEGORIES, 1, 0, 0},
@@ -1034,29 +1044,32 @@ get_input_opts(int argc, char **argv)
} else if (strcmp(lgopts[opt_idx].name, OPT_TRACE_FILE) == 0) {
config.trace_file = optarg;
} else if (strcmp(lgopts[opt_idx].name, OPT_RULE_NUM) == 0) {
-   config.nb_rules = get_uint32_opt(optarg,
+   config.nb_rules = get_ulong_opt(optarg,
lgopts[opt_idx].name, 1, RTE_ACL_MAX_INDEX + 1);
+   } else if (strcmp(lgopts[opt_idx].name, OPT_MAX_SIZE) == 0) {
+   config.max_size = get_ulong_opt(optarg,
+   lgopts[opt_idx].name, 0, SIZE_MAX);

[dpdk-dev] [PATCH v2 15/17] libte_acl: make calc_addr a define to deduplicate the code.

2015-01-12 Thread Konstantin Ananyev
Vector code reorganisation/deduplication:
To avoid maintaining two nearly identical implementations of calc_addr()
(one for SSE, another for AVX2), replace it with  a new macro that suits
both SSE and AVX2 code-paths.
Also remove no needed any more MM_* macros.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl_run_avx2.h   |  87 +---
 lib/librte_acl/acl_run_sse.h| 178 
 lib/librte_acl/acl_vect.h   | 132 --
 lib/librte_eal/common/include/rte_common_vect.h |  12 ++
 4 files changed, 160 insertions(+), 249 deletions(-)

diff --git a/lib/librte_acl/acl_run_avx2.h b/lib/librte_acl/acl_run_avx2.h
index 1688c50..b01a46a 100644
--- a/lib/librte_acl/acl_run_avx2.h
+++ b/lib/librte_acl/acl_run_avx2.h
@@ -73,51 +73,19 @@ static const rte_ymm_t ymm_ones_16 = {
},
 };

-static inline __attribute__((always_inline)) ymm_t
-calc_addr_avx2(ymm_t index_mask, ymm_t next_input, ymm_t shuffle_input,
-   ymm_t ones_16, ymm_t tr_lo, ymm_t tr_hi)
-{
-   ymm_t in, node_type, r, t;
-   ymm_t dfa_msk, dfa_ofs, quad_ofs;
-   ymm_t addr;
-
-   const ymm_t range_base = _mm256_set_epi32(
-   0xff0c, 0xff08, 0xff04, 0xff00,
-   0xff0c, 0xff08, 0xff04, 0xff00);
-
-   t = _mm256_xor_si256(index_mask, index_mask);
-   in = _mm256_shuffle_epi8(next_input, shuffle_input);
-
-   /* Calc node type and node addr */
-   node_type = _mm256_andnot_si256(index_mask, tr_lo);
-   addr = _mm256_and_si256(index_mask, tr_lo);
-
-   /* DFA calculations. */
-
-   dfa_msk = _mm256_cmpeq_epi32(node_type, t);
-
-   r = _mm256_srli_epi32(in, 30);
-   r = _mm256_add_epi8(r, range_base);
-
-   t = _mm256_srli_epi32(in, 24);
-   r = _mm256_shuffle_epi8(tr_hi, r);
-
-   dfa_ofs = _mm256_sub_epi32(t, r);
-
-   /* QUAD/SINGLE caluclations. */
-
-   t = _mm256_cmpgt_epi8(in, tr_hi);
-   t = _mm256_sign_epi8(t, t);
-   t = _mm256_maddubs_epi16(t, t);
-   quad_ofs = _mm256_madd_epi16(t, ones_16);
-
-   /* blend DFA and QUAD/SINGLE. */
-   t = _mm256_blendv_epi8(quad_ofs, dfa_ofs, dfa_msk);
-
-   addr = _mm256_add_epi32(addr, t);
-   return addr;
-}
+static const rte_ymm_t ymm_range_base = {
+   .u32 = {
+   0xff00, 0xff04, 0xff08, 0xff0c,
+   0xff00, 0xff04, 0xff08, 0xff0c,
+   },
+};

+/*
+ * Process 8 transitions in parallel.
+ * tr_lo contains low 32 bits for 8 transition.
+ * tr_hi contains high 32 bits for 8 transition.
+ * next_input contains up to 4 input bytes for 8 flows.
+ */
 static inline __attribute__((always_inline)) ymm_t
 transition8(ymm_t next_input, const uint64_t *trans, ymm_t *tr_lo, ymm_t 
*tr_hi)
 {
@@ -126,8 +94,10 @@ transition8(ymm_t next_input, const uint64_t *trans, ymm_t 
*tr_lo, ymm_t *tr_hi)

tr = (const int32_t *)(uintptr_t)trans;

-   addr = calc_addr_avx2(ymm_index_mask.y, next_input, ymm_shuffle_input.y,
-   ymm_ones_16.y, *tr_lo, *tr_hi);
+   /* Calculate the address (array index) for all 8 transitions. */
+   ACL_TR_CALC_ADDR(mm256, 256, addr, ymm_index_mask.y, next_input,
+   ymm_shuffle_input.y, ymm_ones_16.y, ymm_range_base.y,
+   *tr_lo, *tr_hi);

/* load lower 32 bits of 8 transactions at once. */
*tr_lo = _mm256_i32gather_epi32(tr, addr, sizeof(trans[0]));
@@ -140,6 +110,11 @@ transition8(ymm_t next_input, const uint64_t *trans, ymm_t 
*tr_lo, ymm_t *tr_hi)
return next_input;
 }

+/*
+ * Process matches for  8 flows.
+ * tr_lo contains low 32 bits for 8 transition.
+ * tr_hi contains high 32 bits for 8 transition.
+ */
 static inline void
 acl_process_matches_avx2x8(const struct rte_acl_ctx *ctx,
struct parms *parms, struct acl_flow_data *flows, uint32_t slot,
@@ -155,6 +130,11 @@ acl_process_matches_avx2x8(const struct rte_acl_ctx *ctx,
l0 = _mm256_castsi256_si128(*tr_lo);

for (i = 0; i != RTE_DIM(tr) / 2; i++) {
+
+   /*
+* Extract low 32bits of each transition.
+* That's enough to process the match.
+*/
tr[i] = (uint32_t)_mm_cvtsi128_si32(l0);
tr[i + 4] = (uint32_t)_mm_cvtsi128_si32(l1);

@@ -167,12 +147,14 @@ acl_process_matches_avx2x8(const struct rte_acl_ctx *ctx,
ctx, parms, flows, resolve_priority_sse);
}

+   /* Collect new transitions into 2 YMM registers. */
t0 = _mm256_set_epi64x(tr[5], tr[4], tr[1], tr[0]);
t1 = _mm256_set_epi64x(tr[7], tr[6], tr[3], tr[2]);

-   lo = (ymm_t)_mm256_shuffle_ps((__m256)t0, (__m256)t1, 0x88);
-   hi = (ymm_t)_mm256_shuffle_ps((__m256)t0, (__m256)t1, 0xdd);
+   /* For each transition: put low 32 into tr_lo and high 32 into tr_hi */
+   ACL_TR_HILO(mm256, __m256, t0, t1, lo, hi);

+ 

[dpdk-dev] [PATCH v2 14/17] libter_acl: move lo/hi dwords shuffle out from calc_addr

2015-01-12 Thread Konstantin Ananyev
Reorganise SSE code-path a bit by moving lo/hi dwords shuffle
out from calc_addr().
That allows to make calc_addr() for SSE and AVX2 practically identical
and opens opportunity for further code deduplication.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl_run_sse.h | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/lib/librte_acl/acl_run_sse.h b/lib/librte_acl/acl_run_sse.h
index 1b7870e..4a174e9 100644
--- a/lib/librte_acl/acl_run_sse.h
+++ b/lib/librte_acl/acl_run_sse.h
@@ -172,9 +172,9 @@ acl_match_check_x4(int slot, const struct rte_acl_ctx *ctx, 
struct parms *parms,
  */
 static inline __attribute__((always_inline)) xmm_t
 calc_addr_sse(xmm_t index_mask, xmm_t next_input, xmm_t shuffle_input,
-   xmm_t ones_16, xmm_t indices1, xmm_t indices2)
+   xmm_t ones_16, xmm_t tr_lo, xmm_t tr_hi)
 {
-   xmm_t addr, node_types, range, temp;
+   xmm_t addr, node_types;
xmm_t dfa_msk, dfa_ofs, quad_ofs;
xmm_t in, r, t;

@@ -187,18 +187,14 @@ calc_addr_sse(xmm_t index_mask, xmm_t next_input, xmm_t 
shuffle_input,
 * it reaches a match.
 */

-   /* Shuffle low 32 into temp and high 32 into indices2 */
-   temp = (xmm_t)MM_SHUFFLEPS((__m128)indices1, (__m128)indices2, 0x88);
-   range = (xmm_t)MM_SHUFFLEPS((__m128)indices1, (__m128)indices2, 0xdd);
-
t = MM_XOR(index_mask, index_mask);

/* shuffle input byte to all 4 positions of 32 bit value */
in = MM_SHUFFLE8(next_input, shuffle_input);

/* Calc node type and node addr */
-   node_types = MM_ANDNOT(index_mask, temp);
-   addr = MM_AND(index_mask, temp);
+   node_types = MM_ANDNOT(index_mask, tr_lo);
+   addr = MM_AND(index_mask, tr_lo);

/*
 * Calc addr for DFAs - addr = dfa_index + input_byte
@@ -211,7 +207,7 @@ calc_addr_sse(xmm_t index_mask, xmm_t next_input, xmm_t 
shuffle_input,
r = _mm_add_epi8(r, range_base);

t = _mm_srli_epi32(in, 24);
-   r = _mm_shuffle_epi8(range, r);
+   r = _mm_shuffle_epi8(tr_hi, r);

dfa_ofs = _mm_sub_epi32(t, r);

@@ -224,22 +220,22 @@ calc_addr_sse(xmm_t index_mask, xmm_t next_input, xmm_t 
shuffle_input,
 */

/* check ranges */
-   temp = MM_CMPGT8(in, range);
+   t = MM_CMPGT8(in, tr_hi);

/* convert -1 to 1 (bytes greater than input byte */
-   temp = MM_SIGN8(temp, temp);
+   t = MM_SIGN8(t, t);

/* horizontal add pairs of bytes into words */
-   temp = MM_MADD8(temp, temp);
+   t = MM_MADD8(t, t);

/* horizontal add pairs of words into dwords */
-   quad_ofs = MM_MADD16(temp, ones_16);
+   quad_ofs = MM_MADD16(t, ones_16);

-   /* mask to range type nodes */
-   temp = _mm_blendv_epi8(quad_ofs, dfa_ofs, dfa_msk);
+   /* blend DFA and QUAD/SINGLE. */
+   t = _mm_blendv_epi8(quad_ofs, dfa_ofs, dfa_msk);

/* add index into node position */
-   return MM_ADD32(addr, temp);
+   return MM_ADD32(addr, t);
 }

 /*
@@ -249,13 +245,19 @@ static inline __attribute__((always_inline)) xmm_t
 transition4(xmm_t next_input, const uint64_t *trans,
xmm_t *indices1, xmm_t *indices2)
 {
-   xmm_t addr;
+   xmm_t addr, tr_lo, tr_hi;
uint64_t trans0, trans2;

+   /* Shuffle low 32 into tr_lo and high 32 into tr_hi */
+   tr_lo = (xmm_t)_mm_shuffle_ps((__m128)*indices1, (__m128)*indices2,
+   0x88);
+   tr_hi = (xmm_t)_mm_shuffle_ps((__m128)*indices1, (__m128)*indices2,
+   0xdd);
+
 /* Calculate the address (array index) for all 4 transitions. */

addr = calc_addr_sse(xmm_index_mask.x, next_input, xmm_shuffle_input.x,
-   xmm_ones_16.x, *indices1, *indices2);
+   xmm_ones_16.x, tr_lo, tr_hi);

 /* Gather 64 bit transitions and pack back into 2 registers. */

-- 
1.8.5.3



[dpdk-dev] [PATCH v2 13/17] librte_acl: Remove search_sse_2 and relatives.

2015-01-12 Thread Konstantin Ananyev
Previous improvements made scalar method the fastest one
for tiny bunch of packets (< 4).
That allows us to remove specific vector code-path for small number of packets
(search_sse_2)
and always use scalar method for such cases.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl_run_avx2.c |   2 +-
 lib/librte_acl/acl_run_sse.c  |   3 +-
 lib/librte_acl/acl_run_sse.h  | 110 --
 3 files changed, 3 insertions(+), 112 deletions(-)

diff --git a/lib/librte_acl/acl_run_avx2.c b/lib/librte_acl/acl_run_avx2.c
index 0a42f72..79ebbd6 100644
--- a/lib/librte_acl/acl_run_avx2.c
+++ b/lib/librte_acl/acl_run_avx2.c
@@ -49,6 +49,6 @@ rte_acl_classify_avx2(const struct rte_acl_ctx *ctx, const 
uint8_t **data,
else if (num >= MAX_SEARCHES_SSE4)
return search_sse_4(ctx, data, results, num, categories);
else
-   return search_sse_2(ctx, data, results, num,
+   return rte_acl_classify_scalar(ctx, data, results, num,
categories);
 }
diff --git a/lib/librte_acl/acl_run_sse.c b/lib/librte_acl/acl_run_sse.c
index 77b32b3..a5a7d36 100644
--- a/lib/librte_acl/acl_run_sse.c
+++ b/lib/librte_acl/acl_run_sse.c
@@ -42,5 +42,6 @@ rte_acl_classify_sse(const struct rte_acl_ctx *ctx, const 
uint8_t **data,
else if (num >= MAX_SEARCHES_SSE4)
return search_sse_4(ctx, data, results, num, categories);
else
-   return search_sse_2(ctx, data, results, num, categories);
+   return rte_acl_classify_scalar(ctx, data, results, num,
+   categories);
 }
diff --git a/lib/librte_acl/acl_run_sse.h b/lib/librte_acl/acl_run_sse.h
index e33e16b..1b7870e 100644
--- a/lib/librte_acl/acl_run_sse.h
+++ b/lib/librte_acl/acl_run_sse.h
@@ -45,10 +45,6 @@ static const rte_xmm_t xmm_shuffle_input = {
.u32 = {0x, 0x04040404, 0x08080808, 0x0c0c0c0c},
 };

-static const rte_xmm_t xmm_shuffle_input64 = {
-   .u32 = {0x, 0x04040404, 0x80808080, 0x80808080},
-};
-
 static const rte_xmm_t xmm_ones_16 = {
.u16 = {1, 1, 1, 1, 1, 1, 1, 1},
 };
@@ -62,15 +58,6 @@ static const rte_xmm_t xmm_match_mask = {
},
 };

-static const rte_xmm_t xmm_match_mask64 = {
-   .u32 = {
-   RTE_ACL_NODE_MATCH,
-   0,
-   RTE_ACL_NODE_MATCH,
-   0,
-   },
-};
-
 static const rte_xmm_t xmm_index_mask = {
.u32 = {
RTE_ACL_NODE_INDEX,
@@ -80,16 +67,6 @@ static const rte_xmm_t xmm_index_mask = {
},
 };

-static const rte_xmm_t xmm_index_mask64 = {
-   .u32 = {
-   RTE_ACL_NODE_INDEX,
-   RTE_ACL_NODE_INDEX,
-   0,
-   0,
-   },
-};
-
-
 /*
  * Resolve priority for multiple results (sse version).
  * This consists comparing the priority of the current traversal with the
@@ -161,22 +138,6 @@ acl_process_matches(xmm_t *indices, int slot, const struct 
rte_acl_ctx *ctx,
 }

 /*
- * Check for a match in 2 transitions (contained in SSE register)
- */
-static inline __attribute__((always_inline)) void
-acl_match_check_x2(int slot, const struct rte_acl_ctx *ctx, struct parms 
*parms,
-   struct acl_flow_data *flows, xmm_t *indices, xmm_t match_mask)
-{
-   xmm_t temp;
-
-   temp = MM_AND(match_mask, *indices);
-   while (!MM_TESTZ(temp, temp)) {
-   acl_process_matches(indices, slot, ctx, parms, flows);
-   temp = MM_AND(match_mask, *indices);
-   }
-}
-
-/*
  * Check for any match in 4 transitions (contained in 2 SSE registers)
  */
 static inline __attribute__((always_inline)) void
@@ -460,74 +421,3 @@ search_sse_4(const struct rte_acl_ctx *ctx, const uint8_t 
**data,

return 0;
 }
-
-static inline __attribute__((always_inline)) xmm_t
-transition2(xmm_t next_input, const uint64_t *trans, xmm_t *indices1)
-{
-   uint64_t t;
-   xmm_t addr, indices2;
-
-   indices2 = _mm_setzero_si128();
-
-   addr = calc_addr_sse(xmm_index_mask.x, next_input, xmm_shuffle_input.x,
-   xmm_ones_16.x, *indices1, indices2);
-
-   /* Gather 64 bit transitions and pack 2 per register. */
-
-   t = trans[MM_CVT32(addr)];
-
-   /* get slot 1 */
-   addr = MM_SHUFFLE32(addr, SHUFFLE32_SLOT1);
-   *indices1 = MM_SET64(trans[MM_CVT32(addr)], t);
-
-   return MM_SRL32(next_input, CHAR_BIT);
-}
-
-/*
- * Execute trie traversal with 2 traversals in parallel.
- */
-static inline int
-search_sse_2(const struct rte_acl_ctx *ctx, const uint8_t **data,
-   uint32_t *results, uint32_t total_packets, uint32_t categories)
-{
-   int n;
-   struct acl_flow_data flows;
-   uint64_t index_array[MAX_SEARCHES_SSE2];
-   struct completion cmplt[MAX_SEARCHES_SSE2];
-   struct parms parms[MAX_SEARCHES_SSE2];
-   xmm_t input, indices;
-
-   acl_set_flow(, cmplt, RTE_DIM(cmplt), data, results,
-   total_packets, 

[dpdk-dev] [PATCH v2 12/17] test-acl: add ability to manually select RT method.

2015-01-12 Thread Konstantin Ananyev
In test-acl replace command-line option "--scalar" with new one:
"--alg=scalar|sse|avx2".
Allows user manually select preferred classify() method.

Signed-off-by: Konstantin Ananyev 
---
 app/test-acl/main.c | 93 ++---
 1 file changed, 75 insertions(+), 18 deletions(-)

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index b3d4294..52f43c6 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -82,7 +82,7 @@
 #defineOPT_RULE_NUM"rulenum"
 #defineOPT_TRACE_NUM   "tracenum"
 #defineOPT_TRACE_STEP  "tracestep"
-#defineOPT_SEARCH_SCALAR   "scalar"
+#defineOPT_SEARCH_ALG  "alg"
 #defineOPT_BLD_CATEGORIES  "bldcat"
 #defineOPT_RUN_CATEGORIES  "runcat"
 #defineOPT_ITER_NUM"iter"
@@ -102,6 +102,26 @@ enum {
DUMP_MAX
 };

+struct acl_alg {
+   const char *name;
+   enum rte_acl_classify_alg alg;
+};
+
+static const struct acl_alg acl_alg[] = {
+   {
+   .name = "scalar",
+   .alg = RTE_ACL_CLASSIFY_SCALAR,
+   },
+   {
+   .name = "sse",
+   .alg = RTE_ACL_CLASSIFY_SSE,
+   },
+   {
+   .name = "avx2",
+   .alg = RTE_ACL_CLASSIFY_AVX2,
+   },
+};
+
 static struct {
const char *prgname;
const char *rule_file;
@@ -114,11 +134,11 @@ static struct {
uint32_ttrace_sz;
uint32_titer_num;
uint32_tverbose;
-   uint32_tscalar;
+   uint32_tipv6;
+   struct acl_alg  alg;
uint32_tused_traces;
void   *traces;
struct rte_acl_ctx *acx;
-   uint32_tipv6;
 } config = {
.bld_categories = 3,
.run_categories = 1,
@@ -127,6 +147,10 @@ static struct {
.trace_step = TRACE_STEP_DEF,
.iter_num = 1,
.verbose = DUMP_MAX,
+   .alg = {
+   .name = "default",
+   .alg = RTE_ACL_CLASSIFY_DEFAULT,
+   },
.ipv6 = 0
 };

@@ -774,13 +798,12 @@ acx_init(void)
if (config.acx == NULL)
rte_exit(rte_errno, "failed to create ACL context\n");

-   /* set default classify method to scalar for this context. */
-   if (config.scalar) {
-   ret = rte_acl_set_ctx_classify(config.acx,
-   RTE_ACL_CLASSIFY_SCALAR);
+   /* set default classify method for this context. */
+   if (config.alg.alg != RTE_ACL_CLASSIFY_DEFAULT) {
+   ret = rte_acl_set_ctx_classify(config.acx, config.alg.alg);
if (ret != 0)
-   rte_exit(ret, "failed to setup classify method "
-   "for ACL context\n");
+   rte_exit(ret, "failed to setup %s method "
+   "for ACL context\n", config.alg.name);
}

/* add ACL rules. */
@@ -809,7 +832,7 @@ acx_init(void)
 }

 static uint32_t
-search_ip5tuples_once(uint32_t categories, uint32_t step, int scalar)
+search_ip5tuples_once(uint32_t categories, uint32_t step, const char *alg)
 {
int ret;
uint32_t i, j, k, n, r;
@@ -847,7 +870,7 @@ search_ip5tuples_once(uint32_t categories, uint32_t step, 
int scalar)

dump_verbose(DUMP_SEARCH, stdout,
"%s(%u, %u, %s) returns %u\n", __func__,
-   categories, step, scalar != 0 ? "scalar" : "sse", i);
+   categories, step, alg, i);
return i;
 }

@@ -863,7 +886,7 @@ search_ip5tuples(__attribute__((unused)) void *arg)

for (i = 0; i != config.iter_num; i++) {
pkt += search_ip5tuples_once(config.run_categories,
-   config.trace_step, config.scalar);
+   config.trace_step, config.alg.name);
}

tm = rte_rdtsc() - start;
@@ -891,8 +914,40 @@ get_uint32_opt(const char *opt, const char *name, uint32_t 
min, uint32_t max)
 }

 static void
+get_alg_opt(const char *opt, const char *name)
+{
+   uint32_t i;
+
+   for (i = 0; i != RTE_DIM(acl_alg); i++) {
+   if (strcmp(opt, acl_alg[i].name) == 0) {
+   config.alg = acl_alg[i];
+   return;
+   }
+   }
+
+   rte_exit(-EINVAL, "invalid value: \"%s\" for option: %s\n",
+   opt, name);
+}
+
+static void
 print_usage(const char *prgname)
 {
+   uint32_t i, n, rc;
+   char buf[PATH_MAX];
+
+   n = 0;
+   buf[0] = 0;
+
+   for (i = 0; i < RTE_DIM(acl_alg) - 1; i++) {
+   rc = snprintf(buf + n, sizeof(buf) - n, "%s|",
+   acl_alg[i].name);
+   if (rc > sizeof(buf) - n)
+   break;
+   n += rc;
+   }
+
+   snprintf(buf + n, sizeof(buf) - n, "%s", acl_alg[i].name);
+

[dpdk-dev] [PATCH v2 11/17] librte_acl: add AVX2 as new rte_acl_classify() method

2015-01-12 Thread Konstantin Ananyev
v2 changes:
When build with the compilers that don't support AVX2 instructions,
make rte_acl_classify_avx2() do nothing and return an error.
Remove unneeded 'ifdef __AVX2__' in acl_run_avx2.*.

Introduce new classify() method that uses AVX2 instructions.
>From my measurements:
On HSW boards when processing >= 16 packets per call,
AVX2 method outperforms it's SSE counterpart by 10-25%,
(depending on the ruleset).
At runtime, if librte_acl was build with the compiler that supports AVX2,
this method is selected as default one on HW that supports AVX2.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/Makefile   |  18 ++
 lib/librte_acl/acl.h  |   4 +
 lib/librte_acl/acl_run.h  |   2 +-
 lib/librte_acl/acl_run_avx2.c |  54 +
 lib/librte_acl/acl_run_avx2.h | 301 +++
 lib/librte_acl/acl_run_sse.c  | 537 +-
 lib/librte_acl/acl_run_sse.h  | 533 +
 lib/librte_acl/rte_acl.c  |  27 +++
 lib/librte_acl/rte_acl.h  |   2 +
 9 files changed, 941 insertions(+), 537 deletions(-)
 create mode 100644 lib/librte_acl/acl_run_avx2.c
 create mode 100644 lib/librte_acl/acl_run_avx2.h
 create mode 100644 lib/librte_acl/acl_run_sse.h

diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 65e566d..6b74dc9 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -48,6 +48,24 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c

 CFLAGS_acl_run_sse.o += -msse4.1

+#
+# If the compiler supports AVX2 instructions,
+# then add support for AVX2 classify method.
+#
+
+CC_AVX2_SUPPORT=$(shell $(CC) -march=core-avx2 -dM -E - &1 | \
+grep -q AVX2 && echo 1)
+
+ifeq ($(CC_AVX2_SUPPORT), 1)
+   SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_avx2.c
+   CFLAGS_rte_acl.o += -DCC_AVX2_SUPPORT
+   ifeq ($(CC), icc)
+   CFLAGS_acl_run_avx2.o += -march=core-avx2
+   else
+   CFLAGS_acl_run_avx2.o += -mavx2
+   endif
+endif
+
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include := rte_acl_osdep.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include += rte_acl.h
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 96bb318..d33d7ad 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -196,6 +196,10 @@ int
 rte_acl_classify_sse(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_avx2(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index 4c843c1..850bc81 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -35,9 +35,9 @@
 #define_ACL_RUN_H_

 #include 
-#include "acl_vect.h"
 #include "acl.h"

+#define MAX_SEARCHES_AVX16 16
 #define MAX_SEARCHES_SSE8  8
 #define MAX_SEARCHES_SSE4  4
 #define MAX_SEARCHES_SSE2  2
diff --git a/lib/librte_acl/acl_run_avx2.c b/lib/librte_acl/acl_run_avx2.c
new file mode 100644
index 000..0a42f72
--- /dev/null
+++ b/lib/librte_acl/acl_run_avx2.c
@@ -0,0 +1,54 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "acl_run_avx2.h"
+
+/*
+ * Note, that to be 

[dpdk-dev] [PATCH v2 10/17] EAL: introduce rte_ymm and relatives in rte_common_vect.h.

2015-01-12 Thread Konstantin Ananyev
New data type to manipulate 256 bit AVX values.
Rename field in the rte_xmm to keep common naming accross SSE/AVX fields.

Signed-off-by: Konstantin Ananyev 
---
 examples/l3fwd/main.c   |  2 +-
 lib/librte_acl/acl_run_sse.c| 88 -
 lib/librte_acl/rte_acl_osdep_alone.h| 35 +-
 lib/librte_eal/common/include/rte_common_vect.h | 27 +++-
 lib/librte_lpm/rte_lpm.h|  2 +-
 5 files changed, 104 insertions(+), 50 deletions(-)

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 918f2cb..6f7d7d4 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1170,7 +1170,7 @@ processx4_step2(const struct lcore_conf *qconf, __m128i 
dip, uint32_t flag,
if (likely(flag != 0)) {
rte_lpm_lookupx4(qconf->ipv4_lookup_struct, dip, dprt, portid);
} else {
-   dst.m = dip;
+   dst.x = dip;
dprt[0] = get_dst_port(qconf, pkt[0], dst.u32[0], portid);
dprt[1] = get_dst_port(qconf, pkt[1], dst.u32[1], portid);
dprt[2] = get_dst_port(qconf, pkt[2], dst.u32[2], portid);
diff --git a/lib/librte_acl/acl_run_sse.c b/lib/librte_acl/acl_run_sse.c
index 09e32be..4605b58 100644
--- a/lib/librte_acl/acl_run_sse.c
+++ b/lib/librte_acl/acl_run_sse.c
@@ -359,16 +359,16 @@ search_sse_8(const struct rte_acl_ctx *ctx, const uint8_t 
**data,

 /* Check for any matches. */
acl_match_check_x4(0, ctx, parms, ,
-   , , mm_match_mask.m);
+   , , mm_match_mask.x);
acl_match_check_x4(4, ctx, parms, ,
-   , , mm_match_mask.m);
+   , , mm_match_mask.x);

while (flows.started > 0) {

/* Gather 4 bytes of input data for each stream. */
-   input0 = MM_INSERT32(mm_ones_16.m, GET_NEXT_4BYTES(parms, 0),
+   input0 = MM_INSERT32(mm_ones_16.x, GET_NEXT_4BYTES(parms, 0),
0);
-   input1 = MM_INSERT32(mm_ones_16.m, GET_NEXT_4BYTES(parms, 4),
+   input1 = MM_INSERT32(mm_ones_16.x, GET_NEXT_4BYTES(parms, 4),
0);

input0 = MM_INSERT32(input0, GET_NEXT_4BYTES(parms, 1), 1);
@@ -382,43 +382,43 @@ search_sse_8(const struct rte_acl_ctx *ctx, const uint8_t 
**data,

 /* Process the 4 bytes of input on each stream. */

-   input0 = transition4(mm_index_mask.m, input0,
-   mm_shuffle_input.m, mm_ones_16.m,
+   input0 = transition4(mm_index_mask.x, input0,
+   mm_shuffle_input.x, mm_ones_16.x,
flows.trans, , );

-   input1 = transition4(mm_index_mask.m, input1,
-   mm_shuffle_input.m, mm_ones_16.m,
+   input1 = transition4(mm_index_mask.x, input1,
+   mm_shuffle_input.x, mm_ones_16.x,
flows.trans, , );

-   input0 = transition4(mm_index_mask.m, input0,
-   mm_shuffle_input.m, mm_ones_16.m,
+   input0 = transition4(mm_index_mask.x, input0,
+   mm_shuffle_input.x, mm_ones_16.x,
flows.trans, , );

-   input1 = transition4(mm_index_mask.m, input1,
-   mm_shuffle_input.m, mm_ones_16.m,
+   input1 = transition4(mm_index_mask.x, input1,
+   mm_shuffle_input.x, mm_ones_16.x,
flows.trans, , );

-   input0 = transition4(mm_index_mask.m, input0,
-   mm_shuffle_input.m, mm_ones_16.m,
+   input0 = transition4(mm_index_mask.x, input0,
+   mm_shuffle_input.x, mm_ones_16.x,
flows.trans, , );

-   input1 = transition4(mm_index_mask.m, input1,
-   mm_shuffle_input.m, mm_ones_16.m,
+   input1 = transition4(mm_index_mask.x, input1,
+   mm_shuffle_input.x, mm_ones_16.x,
flows.trans, , );

-   input0 = transition4(mm_index_mask.m, input0,
-   mm_shuffle_input.m, mm_ones_16.m,
+   input0 = transition4(mm_index_mask.x, input0,
+   mm_shuffle_input.x, mm_ones_16.x,
flows.trans, , );

-   input1 = transition4(mm_index_mask.m, input1,
-   mm_shuffle_input.m, mm_ones_16.m,
+   input1 = transition4(mm_index_mask.x, input1,
+   mm_shuffle_input.x, mm_ones_16.x,
flows.trans, , );

 /* Check for any matches. */
acl_match_check_x4(0, ctx, parms, ,
-   , , mm_match_mask.m);
+   , , mm_match_mask.x);
acl_match_check_x4(4, ctx, parms, ,
-   , , mm_match_mask.m);

[dpdk-dev] [PATCH v2 09/17] librte_acl: a bit of RT code deduplication.

2015-01-12 Thread Konstantin Ananyev
Move common check for input parameters up into rte_acl_classify_alg().

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl_run_scalar.c |  4 
 lib/librte_acl/acl_run_sse.c|  4 
 lib/librte_acl/rte_acl.c| 19 ---
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/lib/librte_acl/acl_run_scalar.c b/lib/librte_acl/acl_run_scalar.c
index 9935125..5be216c 100644
--- a/lib/librte_acl/acl_run_scalar.c
+++ b/lib/librte_acl/acl_run_scalar.c
@@ -147,10 +147,6 @@ rte_acl_classify_scalar(const struct rte_acl_ctx *ctx, 
const uint8_t **data,
struct completion cmplt[MAX_SEARCHES_SCALAR];
struct parms parms[MAX_SEARCHES_SCALAR];

-   if (categories != 1 &&
-   ((RTE_ACL_RESULTS_MULTIPLIER - 1) & categories) != 0)
-   return -EINVAL;
-
acl_set_flow(, cmplt, RTE_DIM(cmplt), data, results, num,
categories, ctx->trans_table);

diff --git a/lib/librte_acl/acl_run_sse.c b/lib/librte_acl/acl_run_sse.c
index 576c92b..09e32be 100644
--- a/lib/librte_acl/acl_run_sse.c
+++ b/lib/librte_acl/acl_run_sse.c
@@ -572,10 +572,6 @@ int
 rte_acl_classify_sse(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories)
 {
-   if (categories != 1 &&
-   ((RTE_ACL_RESULTS_MULTIPLIER - 1) & categories) != 0)
-   return -EINVAL;
-
if (likely(num >= MAX_SEARCHES_SSE8))
return search_sse_8(ctx, data, results, num, categories);
else if (num >= MAX_SEARCHES_SSE4)
diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c
index 547e6da..a16c4a4 100644
--- a/lib/librte_acl/rte_acl.c
+++ b/lib/librte_acl/rte_acl.c
@@ -76,20 +76,25 @@ rte_acl_init(void)
 }

 int
-rte_acl_classify(const struct rte_acl_ctx *ctx, const uint8_t **data,
-   uint32_t *results, uint32_t num, uint32_t categories)
-{
-   return classify_fns[ctx->alg](ctx, data, results, num, categories);
-}
-
-int
 rte_acl_classify_alg(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories,
enum rte_acl_classify_alg alg)
 {
+   if (categories != 1 &&
+   ((RTE_ACL_RESULTS_MULTIPLIER - 1) & categories) != 0)
+   return -EINVAL;
+
return classify_fns[alg](ctx, data, results, num, categories);
 }

+int
+rte_acl_classify(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories)
+{
+   return rte_acl_classify_alg(ctx, data, results, num, categories,
+   ctx->alg);
+}
+
 struct rte_acl_ctx *
 rte_acl_find_existing(const char *name)
 {
-- 
1.8.5.3



[dpdk-dev] [PATCH v2 08/17] librte_acl: make scalar RT code to be more similar to vector one.

2015-01-12 Thread Konstantin Ananyev
Make classify_scalar to behave in the same way as it's vector counterpart:
move match check out of the inner loop, etc.
That makes scalar and vector code look more identical.
Plus it improves scalar code performance.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl_run_scalar.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lib/librte_acl/acl_run_scalar.c b/lib/librte_acl/acl_run_scalar.c
index 40691ce..9935125 100644
--- a/lib/librte_acl/acl_run_scalar.c
+++ b/lib/librte_acl/acl_run_scalar.c
@@ -162,31 +162,34 @@ rte_acl_classify_scalar(const struct rte_acl_ctx *ctx, 
const uint8_t **data,
transition0 = index_array[0];
transition1 = index_array[1];

+   while ((transition0 | transition1) & RTE_ACL_NODE_MATCH) {
+   transition0 = acl_match_check(transition0,
+   0, ctx, parms, , resolve_priority_scalar);
+   transition1 = acl_match_check(transition1,
+   1, ctx, parms, , resolve_priority_scalar);
+   }
+
while (flows.started > 0) {

input0 = GET_NEXT_4BYTES(parms, 0);
input1 = GET_NEXT_4BYTES(parms, 1);

for (n = 0; n < 4; n++) {
-   if (likely((transition0 & RTE_ACL_NODE_MATCH) == 0))
-   transition0 = scalar_transition(flows.trans,
-   transition0, (uint8_t)input0);

+   transition0 = scalar_transition(flows.trans,
+   transition0, (uint8_t)input0);
input0 >>= CHAR_BIT;

-   if (likely((transition1 & RTE_ACL_NODE_MATCH) == 0))
-   transition1 = scalar_transition(flows.trans,
-   transition1, (uint8_t)input1);
-
+   transition1 = scalar_transition(flows.trans,
+   transition1, (uint8_t)input1);
input1 >>= CHAR_BIT;
-
}
-   if ((transition0 | transition1) & RTE_ACL_NODE_MATCH) {
+
+   while ((transition0 | transition1) & RTE_ACL_NODE_MATCH) {
transition0 = acl_match_check(transition0,
0, ctx, parms, , resolve_priority_scalar);
transition1 = acl_match_check(transition1,
1, ctx, parms, , resolve_priority_scalar);
-
}
}
return 0;
-- 
1.8.5.3



[dpdk-dev] [PATCH v2 07/17] librte_acl: build/gen phase - simplify the way match nodes are allocated.

2015-01-12 Thread Konstantin Ananyev
Right now we allocate indexes for all types of nodes, except MATCH,
at 'gen final RT table' stage.
For MATCH type nodes we are doing it at building temporary tree stage.
This is totally unnecessary and makes code more complex and error prone.
Rework the code and make MATCH indexes being allocated at the same stage
as all others.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl.h |  3 +--
 lib/librte_acl/acl_bld.c |  4 +--
 lib/librte_acl/acl_gen.c | 69 ++--
 3 files changed, 34 insertions(+), 42 deletions(-)

diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 3f6ac79..96bb318 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -146,7 +146,6 @@ enum {
 struct rte_acl_trie {
uint32_ttype;
uint32_tcount;
-   int32_t smallest;  /* smallest rule in this trie */
uint32_troot_index;
const uint32_t *data_index;
uint32_tnum_data_indexes;
@@ -181,7 +180,7 @@ struct rte_acl_ctx {

 int rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,
struct rte_acl_bld_trie *node_bld_trie, uint32_t num_tries,
-   uint32_t num_categories, uint32_t data_index_sz, int match_num);
+   uint32_t num_categories, uint32_t data_index_sz);

 typedef int (*rte_acl_classify_t)
 (const struct rte_acl_ctx *, const uint8_t **, uint32_t *, uint32_t, uint32_t);
diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index 22f7934..1fd59ee 100644
--- a/lib/librte_acl/acl_bld.c
+++ b/lib/librte_acl/acl_bld.c
@@ -1719,7 +1719,6 @@ acl_build_tries(struct acl_build_context *context,
context->tries[n].type = RTE_ACL_UNUSED_TRIE;
context->bld_tries[n].trie = NULL;
context->tries[n].count = 0;
-   context->tries[n].smallest = INT32_MAX;
}

context->tries[0].type = RTE_ACL_FULL_TRIE;
@@ -1906,8 +1905,7 @@ rte_acl_build(struct rte_acl_ctx *ctx, const struct 
rte_acl_config *cfg)
rc = rte_acl_gen(ctx, bcx.tries, bcx.bld_tries,
bcx.num_tries, bcx.cfg.num_categories,
RTE_ACL_MAX_FIELDS * RTE_DIM(bcx.tries) *
-   sizeof(ctx->data_indexes[0]),
-   bcx.num_build_rules + 1);
+   sizeof(ctx->data_indexes[0]));
if (rc == 0) {

/* set data indexes. */
diff --git a/lib/librte_acl/acl_gen.c b/lib/librte_acl/acl_gen.c
index c9b7839..d3def66 100644
--- a/lib/librte_acl/acl_gen.c
+++ b/lib/librte_acl/acl_gen.c
@@ -50,14 +50,14 @@ struct acl_node_counters {
int32_t quad_vectors;
int32_t dfa;
int32_t dfa_gr64;
-   int32_t smallest_match;
 };

 struct rte_acl_indices {
-   intdfa_index;
-   intquad_index;
-   intsingle_index;
-   intmatch_index;
+   int32_t dfa_index;
+   int32_t quad_index;
+   int32_t single_index;
+   int32_t match_index;
+   int32_t match_start;
 };

 static void
@@ -243,9 +243,9 @@ acl_count_fanout(struct rte_acl_node *node)
 /*
  * Determine the type of nodes and count each type
  */
-static int
+static void
 acl_count_trie_types(struct acl_node_counters *counts,
-   struct rte_acl_node *node, uint64_t no_match, int match, int force_dfa)
+   struct rte_acl_node *node, uint64_t no_match, int force_dfa)
 {
uint32_t n;
int num_ptrs;
@@ -253,16 +253,12 @@ acl_count_trie_types(struct acl_node_counters *counts,

/* skip if this node has been counted */
if (node->node_type != (uint32_t)RTE_ACL_NODE_UNDEFINED)
-   return match;
+   return;

if (node->match_flag != 0 || node->num_ptrs == 0) {
counts->match++;
-   if (node->match_flag == -1)
-   node->match_flag = match++;
node->node_type = RTE_ACL_NODE_MATCH;
-   if (counts->smallest_match > node->match_flag)
-   counts->smallest_match = node->match_flag;
-   return match;
+   return;
}

num_ptrs = acl_count_fanout(node);
@@ -299,11 +295,9 @@ acl_count_trie_types(struct acl_node_counters *counts,
 */
for (n = 0; n < node->num_ptrs; n++) {
if (node->ptrs[n].ptr != NULL)
-   match = acl_count_trie_types(counts, node->ptrs[n].ptr,
-   no_match, match, 0);
+   acl_count_trie_types(counts, node->ptrs[n].ptr,
+   no_match, 0);
}
-
-   return match;
 }

 static void
@@ -400,9 +394,13 @@ acl_gen_node(struct rte_acl_node *node, uint64_t 
*node_array,
break;
case RTE_ACL_NODE_MATCH:
match = ((struct rte_acl_match_results *)
-   

[dpdk-dev] [PATCH v2 06/17] librte_acl: introduce DFA nodes compression (group64) for identical entries.

2015-01-12 Thread Konstantin Ananyev
Introduced division of whole 256 child transition enties
into 4 sub-groups (64 kids per group).
So 2 groups within the same node with identical children,
can use one set of transition entries.
That allows to compact some DFA nodes and get space savings in the RT table,
without any negative performance impact.
>From what I've seen an average space savings: ~20%.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl.h|  12 ++-
 lib/librte_acl/acl_gen.c| 195 
 lib/librte_acl/acl_run_scalar.c |  38 
 lib/librte_acl/acl_run_sse.c|  99 ++--
 4 files changed, 196 insertions(+), 148 deletions(-)

diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index 102fa51..3f6ac79 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -47,6 +47,11 @@ extern"C" {
 #define RTE_ACL_DFA_MAXUINT8_MAX
 #define RTE_ACL_DFA_SIZE   (UINT8_MAX + 1)

+#defineRTE_ACL_DFA_GR64_SIZE   64
+#defineRTE_ACL_DFA_GR64_NUM(RTE_ACL_DFA_SIZE / 
RTE_ACL_DFA_GR64_SIZE)
+#defineRTE_ACL_DFA_GR64_BIT\
+   (CHAR_BIT * sizeof(uint32_t) / RTE_ACL_DFA_GR64_NUM)
+
 typedef int bits_t;

 #defineRTE_ACL_BIT_SET_SIZE((UINT8_MAX + 1) / (sizeof(bits_t) * 
CHAR_BIT))
@@ -100,8 +105,11 @@ struct rte_acl_node {
/* number of ranges (transitions w/ consecutive bits) */
int32_t id;
struct rte_acl_match_results *mrt; /* only valid when match_flag != 0 */
-   char transitions[RTE_ACL_QUAD_SIZE];
-   /* boundaries for ranged node */
+   union {
+   chartransitions[RTE_ACL_QUAD_SIZE];
+   /* boundaries for ranged node */
+   uint8_t dfa_gr64[RTE_ACL_DFA_GR64_NUM];
+   };
struct rte_acl_node *next;
/* free list link or pointer to duplicate node during merge */
struct rte_acl_node *prev;
diff --git a/lib/librte_acl/acl_gen.c b/lib/librte_acl/acl_gen.c
index b1f766b..c9b7839 100644
--- a/lib/librte_acl/acl_gen.c
+++ b/lib/librte_acl/acl_gen.c
@@ -43,13 +43,14 @@
 } while (0)

 struct acl_node_counters {
-   intmatch;
-   intmatch_used;
-   intsingle;
-   intquad;
-   intquad_vectors;
-   intdfa;
-   intsmallest_match;
+   int32_t match;
+   int32_t match_used;
+   int32_t single;
+   int32_t quad;
+   int32_t quad_vectors;
+   int32_t dfa;
+   int32_t dfa_gr64;
+   int32_t smallest_match;
 };

 struct rte_acl_indices {
@@ -61,24 +62,118 @@ struct rte_acl_indices {

 static void
 acl_gen_log_stats(const struct rte_acl_ctx *ctx,
-   const struct acl_node_counters *counts)
+   const struct acl_node_counters *counts,
+   const struct rte_acl_indices *indices)
 {
RTE_LOG(DEBUG, ACL, "Gen phase for ACL \"%s\":\n"
"runtime memory footprint on socket %d:\n"
"single nodes/bytes used: %d/%zu\n"
-   "quad nodes/bytes used: %d/%zu\n"
-   "DFA nodes/bytes used: %d/%zu\n"
+   "quad nodes/vectors/bytes used: %d/%d/%zu\n"
+   "DFA nodes/group64/bytes used: %d/%d/%zu\n"
"match nodes/bytes used: %d/%zu\n"
"total: %zu bytes\n",
ctx->name, ctx->socket_id,
counts->single, counts->single * sizeof(uint64_t),
-   counts->quad, counts->quad_vectors * sizeof(uint64_t),
-   counts->dfa, counts->dfa * RTE_ACL_DFA_SIZE * sizeof(uint64_t),
+   counts->quad, counts->quad_vectors,
+   (indices->quad_index - indices->dfa_index) * sizeof(uint64_t),
+   counts->dfa, counts->dfa_gr64,
+   indices->dfa_index * sizeof(uint64_t),
counts->match,
counts->match * sizeof(struct rte_acl_match_results),
ctx->mem_sz);
 }

+static uint64_t
+acl_dfa_gen_idx(const struct rte_acl_node *node, uint32_t index)
+{
+   uint64_t idx;
+   uint32_t i;
+
+   idx = 0;
+   for (i = 0; i != RTE_DIM(node->dfa_gr64); i++) {
+   RTE_ACL_VERIFY(node->dfa_gr64[i] < RTE_ACL_DFA_GR64_NUM);
+   RTE_ACL_VERIFY(node->dfa_gr64[i] < node->fanout);
+   idx |= (i - node->dfa_gr64[i]) <<
+   (6 + RTE_ACL_DFA_GR64_BIT * i);
+   }
+
+   return idx << (CHAR_BIT * sizeof(index)) | index | node->node_type;
+}
+
+static void
+acl_dfa_fill_gr64(const struct rte_acl_node *node,
+   const uint64_t src[RTE_ACL_DFA_SIZE], uint64_t dst[RTE_ACL_DFA_SIZE])
+{
+   uint32_t i;
+
+   for (i = 0; i != RTE_DIM(node->dfa_gr64); i++) {
+   memcpy(dst + node->dfa_gr64[i] * RTE_ACL_DFA_GR64_SIZE,
+   src + i * RTE_ACL_DFA_GR64_SIZE,
+   

[dpdk-dev] [PATCH v2 05/17] librte_acl: fix a bug at build phase that can cause matches beeing overwirtten.

2015-01-12 Thread Konstantin Ananyev
Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl_bld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index 8bf4a54..22f7934 100644
--- a/lib/librte_acl/acl_bld.c
+++ b/lib/librte_acl/acl_bld.c
@@ -1907,7 +1907,7 @@ rte_acl_build(struct rte_acl_ctx *ctx, const struct 
rte_acl_config *cfg)
bcx.num_tries, bcx.cfg.num_categories,
RTE_ACL_MAX_FIELDS * RTE_DIM(bcx.tries) *
sizeof(ctx->data_indexes[0]),
-   bcx.num_build_rules);
+   bcx.num_build_rules + 1);
if (rc == 0) {

/* set data indexes. */
-- 
1.8.5.3



[dpdk-dev] [PATCH v2 04/17] librte_acl: remove build phase heuristsic with negative perfomance effect.

2015-01-12 Thread Konstantin Ananyev
Current rule-wildness based heuristsics can cause unnecessary splits of
the ruleset.
That might have negative perfomance effect:
more tries to traverse, bigger RT tables.
After removing it, on some test-cases with big rulesets (~10K)
observed ~50% speedup.
No difference for smaller rulesets.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl_bld.c | 277 +--
 1 file changed, 97 insertions(+), 180 deletions(-)

diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index c5a674a..8bf4a54 100644
--- a/lib/librte_acl/acl_bld.c
+++ b/lib/librte_acl/acl_bld.c
@@ -1539,11 +1539,9 @@ acl_calc_wildness(struct rte_acl_build_rule *head,
return 0;
 }

-static int
-acl_rule_stats(struct rte_acl_build_rule *head, struct rte_acl_config *config,
-   uint32_t *wild_limit)
+static void
+acl_rule_stats(struct rte_acl_build_rule *head, struct rte_acl_config *config)
 {
-   int min;
struct rte_acl_build_rule *rule;
uint32_t n, m, fields_deactivated = 0;
uint32_t start = 0, deactivate = 0;
@@ -1604,129 +1602,58 @@ acl_rule_stats(struct rte_acl_build_rule *head, struct 
rte_acl_config *config,

for (k = 0; k < config->num_fields; k++) {
if (tally[k][TALLY_DEACTIVATED] == 0) {
-   memcpy([l][0], [k][0],
+   memmove([l][0], [k][0],
TALLY_NUM * sizeof(tally[0][0]));
-   memcpy(>defs[l++],
+   memmove(>defs[l++],
>defs[k],
sizeof(struct rte_acl_field_def));
}
}
config->num_fields = l;
}
-
-   min = RTE_ACL_SINGLE_TRIE_SIZE;
-   if (config->num_fields == 2)
-   min *= 4;
-   else if (config->num_fields == 3)
-   min *= 3;
-   else if (config->num_fields == 4)
-   min *= 2;
-
-   if (tally[0][TALLY_0] < min)
-   return 0;
-   for (n = 0; n < config->num_fields; n++)
-   wild_limit[n] = 0;
-
-   /*
-* If trailing fields are 100% wild, group those together.
-* This allows the search length of the trie to be shortened.
-*/
-   for (n = 1; n < config->num_fields; n++) {
-
-   double rule_percentage = (double)tally[n][TALLY_DEPTH] /
-   tally[n][0];
-
-   if (rule_percentage > RULE_PERCENTAGE) {
-   /* if it crosses an input boundary then round up */
-   while (config->defs[n - 1].input_index ==
-   config->defs[n].input_index)
-   n++;
-
-   /* set the limit for selecting rules */
-   while (n < config->num_fields)
-   wild_limit[n++] = 100;
-
-   if (wild_limit[n - 1] == 100)
-   return 1;
-   }
-   }
-
-   /* look for the most wild that's 40% or more of the rules */
-   for (n = 1; n < config->num_fields; n++) {
-   for (m = TALLY_100; m > 0; m--) {
-
-   double rule_percentage = (double)tally[n][m] /
-   tally[n][0];
-
-   if (tally[n][TALLY_DEACTIVATED] == 0 &&
-   tally[n][TALLY_0] >
-   RTE_ACL_SINGLE_TRIE_SIZE &&
-   rule_percentage > NODE_PERCENTAGE &&
-   rule_percentage < 0.80) {
-   wild_limit[n] = wild_limits[m];
-   return 1;
-   }
-   }
-   }
-   return 0;
 }

 static int
-order(struct rte_acl_build_rule **insert, struct rte_acl_build_rule *rule)
+rule_cmp_wildness(struct rte_acl_build_rule *r1, struct rte_acl_build_rule *r2)
 {
uint32_t n;
-   struct rte_acl_build_rule *left = *insert;
-
-   if (left == NULL)
-   return 0;

-   for (n = 1; n < left->config->num_fields; n++) {
-   int field_index = left->config->defs[n].field_index;
+   for (n = 1; n < r1->config->num_fields; n++) {
+   int field_index = r1->config->defs[n].field_index;

-   if (left->wildness[field_index] != rule->wildness[field_index])
-   return (left->wildness[field_index] >=
-   rule->wildness[field_index]);
+   if (r1->wildness[field_index] != r2->wildness[field_index])
+   return (r1->wildness[field_index] -
+   r2->wildness[field_index]);
}
return 0;
 }

 static struct rte_acl_build_rule *
-ordered_insert_rule(struct 

[dpdk-dev] [PATCH v2 03/17] librte_acl: make data_indexes long enough to survive idle transitions.

2015-01-12 Thread Konstantin Ananyev
Make data_indexes long enough to survive idle transitions.
That allows to simplify match processing code.
Also fix incorrect size calculations for data indexes.

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/acl_bld.c | 5 +++--
 lib/librte_acl/acl_run.h | 4 
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index d6e0c45..c5a674a 100644
--- a/lib/librte_acl/acl_bld.c
+++ b/lib/librte_acl/acl_bld.c
@@ -1948,7 +1948,7 @@ acl_set_data_indexes(struct rte_acl_ctx *ctx)
memcpy(ctx->data_indexes + ofs, ctx->trie[i].data_index,
n * sizeof(ctx->data_indexes[0]));
ctx->trie[i].data_index = ctx->data_indexes + ofs;
-   ofs += n;
+   ofs += RTE_ACL_MAX_FIELDS;
}
 }

@@ -1988,7 +1988,8 @@ rte_acl_build(struct rte_acl_ctx *ctx, const struct 
rte_acl_config *cfg)
/* allocate and fill run-time  structures. */
rc = rte_acl_gen(ctx, bcx.tries, bcx.bld_tries,
bcx.num_tries, bcx.cfg.num_categories,
-   RTE_ACL_IPV4VLAN_NUM * RTE_DIM(bcx.tries),
+   RTE_ACL_MAX_FIELDS * RTE_DIM(bcx.tries) *
+   sizeof(ctx->data_indexes[0]),
bcx.num_build_rules);
if (rc == 0) {

diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index c191053..4c843c1 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -256,10 +256,6 @@ acl_match_check(uint64_t transition, int slot,

/* Fill the slot with the next trie or idle trie */
transition = acl_start_next_trie(flows, parms, slot, ctx);
-
-   } else if (transition == ctx->idle) {
-   /* reset indirection table for idle slots */
-   parms[slot].data_index = idle;
}

return transition;
-- 
1.8.5.3



[dpdk-dev] [PATCH v2 02/17] app/test: few small fixes fot test_acl.c

2015-01-12 Thread Konstantin Ananyev
Make sure that test_acl would not ignore error conditions.
Run classify() with all possible values.

Signed-off-by: Konstantin Ananyev 
---
 app/test/test_acl.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index 356d620..7119ad3 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -111,7 +111,7 @@ test_classify_run(struct rte_acl_ctx *acx)
 * these will run quite a few times, it's necessary to test code paths
 * from num=0 to num>8
 */
-   for (count = 0; count < RTE_DIM(acl_test_data); count++) {
+   for (count = 0; count <= RTE_DIM(acl_test_data); count++) {
ret = rte_acl_classify(acx, data, results,
count, RTE_ACL_MAX_CATEGORIES);
if (ret != 0) {
@@ -128,6 +128,7 @@ test_classify_run(struct rte_acl_ctx *acx)
"(expected %"PRIu32" got %"PRIu32")!\n",
__LINE__, i, acl_test_data[i].allow,
result);
+   ret = -EINVAL;
goto err;
}
}
@@ -140,6 +141,7 @@ test_classify_run(struct rte_acl_ctx *acx)
"(expected %"PRIu32" got %"PRIu32")!\n",
__LINE__, i, acl_test_data[i].deny,
result);
+   ret = -EINVAL;
goto err;
}
}
@@ -150,7 +152,7 @@ test_classify_run(struct rte_acl_ctx *acx)
RTE_DIM(acl_test_data), RTE_ACL_MAX_CATEGORIES,
RTE_ACL_CLASSIFY_SCALAR);
if (ret != 0) {
-   printf("Line %i: SSE classify failed!\n", __LINE__);
+   printf("Line %i: scalar classify failed!\n", __LINE__);
goto err;
}

@@ -162,6 +164,7 @@ test_classify_run(struct rte_acl_ctx *acx)
"(expected %"PRIu32" got %"PRIu32")!\n",
__LINE__, i, acl_test_data[i].allow,
result);
+   ret = -EINVAL;
goto err;
}
}
@@ -174,6 +177,7 @@ test_classify_run(struct rte_acl_ctx *acx)
"(expected %"PRIu32" got %"PRIu32")!\n",
__LINE__, i, acl_test_data[i].deny,
result);
+   ret = -EINVAL;
goto err;
}
}
-- 
1.8.5.3



[dpdk-dev] [PATCH v2 01/17] fix fix compilation issues with RTE_LIBRTE_ACL_STANDALONE=y

2015-01-12 Thread Konstantin Ananyev
Signed-off-by: Konstantin Ananyev 
---
 lib/librte_acl/rte_acl_osdep_alone.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/lib/librte_acl/rte_acl_osdep_alone.h 
b/lib/librte_acl/rte_acl_osdep_alone.h
index a84b6f9..2a99860 100644
--- a/lib/librte_acl/rte_acl_osdep_alone.h
+++ b/lib/librte_acl/rte_acl_osdep_alone.h
@@ -214,6 +214,13 @@ rte_rdtsc(void)
 /*
  * rte_tailq related.
  */
+
+struct rte_tailq_entry {
+   TAILQ_ENTRY(rte_tailq_entry) next; /**< Pointer entries for a tailq list
+ */
+   void *data; /**< Pointer to the data referenced by this tailq entry */
+};
+
 static inline void *
 rte_dummy_tailq(void)
 {
@@ -248,6 +255,7 @@ rte_zmalloc_socket(__rte_unused const char *type, size_t 
size, unsigned align,
void *ptr;
int rc;

+   align = (align != 0) ? align : RTE_CACHE_LINE_SIZE;
rc = posix_memalign(, align, size);
if (rc != 0) {
rte_errno = rc;
@@ -258,6 +266,8 @@ rte_zmalloc_socket(__rte_unused const char *type, size_t 
size, unsigned align,
return ptr;
 }

+#definerte_zmalloc(type, sz, align)rte_zmalloc_socket(type, sz, 
align, 0)
+
 /*
  * rte_debug related
  */
@@ -271,6 +281,8 @@ rte_zmalloc_socket(__rte_unused const char *type, size_t 
size, unsigned align,
exit(err);   \
 } while (0)

+#definerte_cpu_get_flag_enabled(x) (0)
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.5.3



[dpdk-dev] [PATCH v2 00/17] ACL: New AVX2 classify method and several other enhancements.

2015-01-12 Thread Konstantin Ananyev
v2 changes:
- When build with the compilers that don't support AVX2 instructions,
make rte_acl_classify_avx2() do nothing and return an error.
- Remove unneeded 'ifdef __AVX2__' in acl_run_avx2.*.
- Reorder order of patches in the set, to keep RTE_LIBRTE_ACL_STANDALONE=y
always buildable.

This patch series contain several fixes and enhancements for ACL library.
See complete list below.
Two main changes that are externally visible:
- Introduce new classify method:  RTE_ACL_CLASSIFY_AVX2.
It uses AVX2 instructions and 256 bit wide data types
to perform internal trie traversal.
That helps to increase classify() throughput.
This method is selected as default one on CPUs that supports AVX2.
- Introduce new field in the build config structure: max_size.
It specifies maximum size that internal RT structure for given context
can reach.
The purpose of that is to allow user to decide about space/performance trade-off
(faster classify() vs less space for RT internal structures)
for each given set of rules.

Konstantin Ananyev (17):
  fix fix compilation issues with RTE_LIBRTE_ACL_STANDALONE=y
  app/test: few small fixes fot test_acl.c
  librte_acl: make data_indexes long enough to survive idle transitions.
  librte_acl: remove build phase heuristsic with negative perfomance
effect.
  librte_acl: fix a bug at build phase that can cause matches beeing
overwirtten.
  librte_acl: introduce DFA nodes compression (group64) for identical
entries.
  librte_acl: build/gen phase - simplify the way match nodes are
allocated.
  librte_acl: make scalar RT code to be more similar to vector one.
  librte_acl: a bit of RT code deduplication.
  EAL: introduce rte_ymm and relatives in rte_common_vect.h.
  librte_acl: add AVX2 as new rte_acl_classify() method
  test-acl: add ability to manually select RT method.
  librte_acl: Remove search_sse_2 and relatives.
  libter_acl: move lo/hi dwords shuffle out from calc_addr
  libte_acl: make calc_addr a define to deduplicate the code.
  libte_acl: introduce max_size into rte_acl_config.
  libte_acl: remove unused macros.

 app/test-acl/main.c | 126 +++--
 app/test/test_acl.c |   8 +-
 examples/l3fwd-acl/main.c   |   3 +-
 examples/l3fwd/main.c   |   2 +-
 lib/librte_acl/Makefile |  18 +
 lib/librte_acl/acl.h|  58 ++-
 lib/librte_acl/acl_bld.c| 392 +++-
 lib/librte_acl/acl_gen.c| 268 +++
 lib/librte_acl/acl_run.h|   7 +-
 lib/librte_acl/acl_run_avx2.c   |  54 +++
 lib/librte_acl/acl_run_avx2.h   | 284 
 lib/librte_acl/acl_run_scalar.c |  65 ++-
 lib/librte_acl/acl_run_sse.c| 585 +---
 lib/librte_acl/acl_run_sse.h| 357 +++
 lib/librte_acl/acl_vect.h   | 132 +++---
 lib/librte_acl/rte_acl.c|  47 +-
 lib/librte_acl/rte_acl.h|   4 +
 lib/librte_acl/rte_acl_osdep_alone.h|  47 +-
 lib/librte_eal/common/include/rte_common_vect.h |  39 +-
 lib/librte_lpm/rte_lpm.h|   2 +-
 20 files changed, 1444 insertions(+), 1054 deletions(-)
 create mode 100644 lib/librte_acl/acl_run_avx2.c
 create mode 100644 lib/librte_acl/acl_run_avx2.h
 create mode 100644 lib/librte_acl/acl_run_sse.h

-- 
1.8.5.3



[dpdk-dev] [PATCH RFC 00/13] Update build system

2015-01-12 Thread Thomas Monjalon
Hi Sergio,

2015-01-12 16:33, Sergio Gonzalez Monroy:
> This patch series updates the DPDK build system.

Thanks for proposing such rework.
We need discussions on that topic. So I ask some questions below.

> Following are the goals it tries to accomplish:
>  - Create a library containing core DPDK libraries (librte_eal,
>librte_malloc, librte_mempool, librte_mbuf and librte_ring).
>The idea of core libraries is to group those libraries that are
>always required for any DPDK application.

How is it better? Is it only to reduce dependencies lines?

>  - Remove config option to build a combined library.

Why removing combined library? Is there people finding it helpful?

>  - For shared libraries, explicitly link against dependant
>libraries (adding entries to DT_NEEDED).

OK, good.

>  - Update app linking flags against static/shared DPDK libs.
> 
> Note that this patch turns up being quite big because of moving lib
> directories to a new subdirectory.
> I have ommited the actual diff from the patch doing the move of librte_eal
> as it is quite big (6MB). Probably a different approach is preferred.

Why do you think moving directories is needed?

Thanks
-- 
Thomas


[dpdk-dev] [PATCH RFC 00/13] Update build system

2015-01-12 Thread Gonzalez Monroy, Sergio
Hi Thomas,

> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Monday, January 12, 2015 4:52 PM
> 
> Hi Sergio,
> 
> 2015-01-12 16:33, Sergio Gonzalez Monroy:
> > This patch series updates the DPDK build system.
> 
> Thanks for proposing such rework.
> We need discussions on that topic. So I ask some questions below.
> 
> > Following are the goals it tries to accomplish:
> >  - Create a library containing core DPDK libraries (librte_eal,
> >librte_malloc, librte_mempool, librte_mbuf and librte_ring).
> >The idea of core libraries is to group those libraries that are
> >always required for any DPDK application.
> 
> How is it better? Is it only to reduce dependencies lines?
>
In my opinion I think that there are a set of libraries that are always required
and therefore should be grouped as a single one.
Basically all apps and other DPDK libs would have dependencies to these core 
libraries.

Aside from that, I don't think there is any difference. Note that this affects 
shared libraries,
with no difference for apps linked against static libs. 

> >  - Remove config option to build a combined library.
> 
> Why removing combined library? Is there people finding it helpful?
> 
I don't think it makes sense from a shared library point of view, maybe it does 
for static?
For example, in the case of shared libraries I think we want to try to avoid 
the case where
we have an app linked against librte_dpdk.so, but such library may contain 
different libraries
depending on the options that were enabled when the lib was built.

The core libraries would be that set of libraries that are always required for 
an app, and its content
would be fixed regardless of the option libraries (like acl, hash, distributor, 
etc.)
We could add more libraries as core if we think it is a better solution, but 
the goal should be that
librte_core.so contains the same libraries/API regardless of the system/arch.

> >  - For shared libraries, explicitly link against dependant
> >libraries (adding entries to DT_NEEDED).
> 
> OK, good.
> 
> >  - Update app linking flags against static/shared DPDK libs.
> >
> > Note that this patch turns up being quite big because of moving lib
> > directories to a new subdirectory.
> > I have ommited the actual diff from the patch doing the move of
> > librte_eal as it is quite big (6MB). Probably a different approach is
> preferred.
> 
> Why do you think moving directories is needed?
> 
Actually I am not sure is the best way to do this :) There is no need to move 
them, as the same result
could be achieved without moving directories, but I thought that it would be 
easier for anyone to see which
libraries are 'core' and which are not.

Not moving those directories would definitely simplify this patch series.

> Thanks
> --
> Thomas

Thanks,
Sergio


[dpdk-dev] What is the best way to distribute a DPDK-based app?

2015-01-12 Thread Vlad Zolotarov

On 01/12/15 16:50, Neil Horman wrote:
> On Mon, Jan 12, 2015 at 11:30:26AM +, Bruce Richardson wrote:
>> On Sun, Jan 11, 2015 at 07:10:30PM +0200, Vlad Zolotarov wrote:
>>> Hi,
>>> guys could you share form your experience what is the best way to distribute
>>> the DPDK libraries with the DPDK-based app:
>>>
>>>   * Is there any significant benefit in compiling the libraries on a
>>> target machine?
>>>   * Is there an already existing DPDK-libs packaging: I've noticed there
>>> is some Fedora RPM package with DPDK libs but it's lacking
>>> pmd-driver's libs and they are the main component we are using,
>>> therefore we can't use it.
>>>
>>> Thanks in advance,
>>> vlad
>>>
>> The default in DPDK is to build a statically linked binary, in which case no
>> separate distribution of libraries is necessary. This also gives best 
>> performance.
>>
> That wasn't the question though.  the question was "what is the best way to
> distribute dpdk libraries".  The answer is, it depends on a number of factors,
> including, but not limited to what distribution your are distributing for and
> what your intended audience is.
>
> As you note, Fedora distributes dpdk 1.7 using DSO's.  We do this because 
> Fedora
> strongly tries to avoid shipping static libraries so as to prevent security
> issues living on in applications that link to libraries (i.e. a dpdk security
> fix will update all applications if they use DSO's.
>
> You've also noted that the Fedora DPDK doesn't include PMD's for several bits 
> of
> hardware.  This is done because those PMD's require out of tree kernel 
> modules,
> which Fedora prohibits.  So we currently only ship virtual pmd's.  That will
> change soon though we hope, when some high speed socket API changes get made 
> to
> the kernel.

Neil, Bruce, thanks for your input.

>
>> If you know ahead of time what the minimum cpu hardware of your target is, 
>> it's
>> probably worthwhile doing a compile of your app/libs for that minimum 
>> hardware,
>> especially if you care about getting best performance. If a few percent drop 
>> in
>> performance is not a big issue, then compiling up for the "default" target is
>> the safest path to take.
>> For distributing the libs as shared libs, the same logic applies.
>>
>> /Bruce
>>



[dpdk-dev] [PATCH 2/2] testpmd: fix dcb in vt mode

2015-01-12 Thread Michal Jastrzebski
From: Pawel Wodkowski 

This patch incorporate fixes to support DCB in SRIOV mode for testpmd.
It also clean up some old code that is not needed or wrong.

Signed-off-by: Pawel Wodkowski 
---
 app/test-pmd/cmdline.c |4 ++--
 app/test-pmd/testpmd.c |   39 +--
 app/test-pmd/testpmd.h |   10 --
 3 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 882a5a2..3c60087 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1947,9 +1947,9 @@ cmd_config_dcb_parsed(void *parsed_result,

/* DCB in VT mode */
if (!strncmp(res->vt_en, "on",2))
-   dcb_conf.dcb_mode = DCB_VT_ENABLED;
+   dcb_conf.vt_en = 1;
else
-   dcb_conf.dcb_mode = DCB_ENABLED;
+   dcb_conf.vt_en = 0;

if (!strncmp(res->pfc_en, "on",2)) {
dcb_conf.pfc_en = 1;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 8c69756..6677a5e 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1733,7 +1733,8 @@ const uint16_t vlan_tags[] = {
 };

 static  int
-get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf)
+get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf,
+   uint16_t sriov)
 {
 uint8_t i;

@@ -1741,7 +1742,7 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct 
dcb_config *dcb_conf)
 * Builds up the correct configuration for dcb+vt based on the vlan 
tags array
 * given above, and the number of traffic classes available for use.
 */
-   if (dcb_conf->dcb_mode == DCB_VT_ENABLED) {
+   if (dcb_conf->vt_en == 1) {
struct rte_eth_vmdq_dcb_conf vmdq_rx_conf;
struct rte_eth_vmdq_dcb_tx_conf vmdq_tx_conf;

@@ -1758,9 +1759,17 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct 
dcb_config *dcb_conf)
vmdq_rx_conf.pool_map[i].vlan_id = vlan_tags[ i ];
vmdq_rx_conf.pool_map[i].pools = 1 << (i % 
vmdq_rx_conf.nb_queue_pools);
}
-   for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-   vmdq_rx_conf.dcb_queue[i] = i;
-   vmdq_tx_conf.dcb_queue[i] = i;
+
+   if (sriov == 0) {
+   for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
+   vmdq_rx_conf.dcb_queue[i] = i;
+   vmdq_tx_conf.dcb_queue[i] = i;
+   }
+   } else {
+   for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
+   vmdq_rx_conf.dcb_queue[i] = i % 
dcb_conf->num_tcs;
+   vmdq_tx_conf.dcb_queue[i] = i % 
dcb_conf->num_tcs;
+   }
}

/*set DCB mode of RX and TX of multiple queues*/
@@ -1818,22 +1827,32 @@ init_port_dcb_config(portid_t pid,struct dcb_config 
*dcb_conf)
uint16_t nb_vlan;
uint16_t i;

-   /* rxq and txq configuration in dcb mode */
-   nb_rxq = 128;
-   nb_txq = 128;
rx_free_thresh = 64;

+   rte_port = [pid];
memset(_conf,0,sizeof(struct rte_eth_conf));
/* Enter DCB configuration status */
dcb_config = 1;

nb_vlan = sizeof( vlan_tags )/sizeof( vlan_tags[ 0 ]);
/*set configuration of DCB in vt mode and DCB in non-vt mode*/
-   retval = get_eth_dcb_conf(_conf, dcb_conf);
+   retval = get_eth_dcb_conf(_conf, dcb_conf, 
rte_port->dev_info.max_vfs);
+
+   /* rxq and txq configuration in dcb mode */
+   nb_rxq = rte_port->dev_info.max_rx_queues;
+   nb_txq = rte_port->dev_info.max_tx_queues;
+
+   if (rte_port->dev_info.max_vfs) {
+   if (port_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB)
+   nb_rxq /= 
port_conf.rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;
+
+   if (port_conf.txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)
+   nb_txq /= 
port_conf.tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;
+   }
+
if (retval < 0)
return retval;

-   rte_port = [pid];
memcpy(_port->dev_conf, _conf,sizeof(struct rte_eth_conf));

rte_port->rx_conf.rx_thresh = rx_thresh;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index f8b0740..8976acc 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -227,20 +227,10 @@ struct fwd_config {
portid_t   nb_fwd_ports;/**< Nb. of ports involved. */
 };

-/**
- * DCB mode enable
- */
-enum dcb_mode_enable
-{
-   DCB_VT_ENABLED,
-   DCB_ENABLED
-};
-
 /*
  * DCB general config info
  */
 struct dcb_config {
-   enum dcb_mode_enable dcb_mode;
uint8_t vt_en;
enum rte_eth_nb_tcs num_tcs;
uint8_t pfc_en;
-- 
1.7.9.5



[dpdk-dev] [PATCH 1/2] pmd: add DCB for VF for ixgbe

2015-01-12 Thread Michal Jastrzebski
From: Pawel Wodkowski 

This patch add support for DCB in SRIOV mode. When no PFC
is enabled this feature might be used as multiple queues
(up to 8 or 4) for VF.

It incorporate following modifications:
 - Allow zero rx/tx queues to be passed to rte_eth_dev_configure().
   Rationale:
   in SRIOV mode PF use first free VF to RX/TX. If VF count
   is 16 or 32 all recources are assigned to VFs so PF can
   be used only for configuration.
 - split nb_q_per_pool to nb_rx_q_per_pool and nb_tx_q_per_pool
   Rationale:
   rx and tx number of queue might be different if RX and TX are
   configured in different mode. This allow to inform VF about
   proper number of queues.
 - extern mailbox API for DCB mode

Signed-off-by: Pawel Wodkowski 
---
 lib/librte_ether/rte_ethdev.c   |   84 +-
 lib/librte_ether/rte_ethdev.h   |5 +-
 lib/librte_pmd_e1000/igb_pf.c   |3 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |1 +
 lib/librte_pmd_ixgbe/ixgbe_pf.c |   98 ++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |7 ++-
 7 files changed, 159 insertions(+), 49 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 95f2ceb..4c1a494 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -333,7 +333,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, 
uint16_t nb_queues)
dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
sizeof(dev->data->rx_queues[0]) * nb_queues,
RTE_CACHE_LINE_SIZE);
-   if (dev->data->rx_queues == NULL) {
+   if (dev->data->rx_queues == NULL && nb_queues > 0) {
dev->data->nb_rx_queues = 0;
return -(ENOMEM);
}
@@ -475,7 +475,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, 
uint16_t nb_queues)
dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
sizeof(dev->data->tx_queues[0]) * nb_queues,
RTE_CACHE_LINE_SIZE);
-   if (dev->data->tx_queues == NULL) {
+   if (dev->data->tx_queues == NULL && nb_queues > 0) {
dev->data->nb_tx_queues = 0;
return -(ENOMEM);
}
@@ -507,6 +507,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,
  const struct rte_eth_conf *dev_conf)
 {
struct rte_eth_dev *dev = _eth_devices[port_id];
+   struct rte_eth_dev_info dev_info;

if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
/* check multi-queue mode */
@@ -524,11 +525,33 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,
return (-EINVAL);
}

+   if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) &&
+   (dev_conf->txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)) {
+   enum rte_eth_nb_pools rx_pools =
+   
dev_conf->rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;
+   enum rte_eth_nb_pools tx_pools =
+   
dev_conf->tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;
+
+   if (rx_pools != tx_pools) {
+   /* Only equal number of pools is supported when
+* DCB+VMDq in SRIOV */
+   PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
+   " SRIOV active, DCB+VMDQ mode, "
+   "number of rx and tx pools is 
not eqaul\n",
+   port_id);
+   return (-EINVAL);
+   }
+   }
+
+   uint16_t nb_rx_q_per_pool = 
RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool;
+   uint16_t nb_tx_q_per_pool = 
RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;
+
switch (dev_conf->rxmode.mq_mode) {
-   case ETH_MQ_RX_VMDQ_RSS:
case ETH_MQ_RX_VMDQ_DCB:
+   break;
+   case ETH_MQ_RX_VMDQ_RSS:
case ETH_MQ_RX_VMDQ_DCB_RSS:
-   /* DCB/RSS VMDQ in SRIOV mode, not implement yet */
+   /* RSS, DCB+RSS VMDQ in SRIOV mode, not implement yet */
PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
" SRIOV active, "
"unsupported VMDQ mq_mode rx %u\n",
@@ -537,37 +560,32 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,
default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */
   

[dpdk-dev] [PATCH 0/2] Enable DCB in SRIOV mode for ixgbe driver

2015-01-12 Thread Michal Jastrzebski
From: Pawel Wodkowski 

Hi,
this patchset enables DCB in SRIOV (ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB)
for each VF and PF for ixgbe driver.

As a side effect this allow to use multiple queues for TX in VF (8 if there is
16 or less VFs or 4 if there is 32 or less VFs) when PFC is not enabled.


Pawel Wodkowski (2):
  pmd: add DCB for VF for ixgbe
  testpmd: fix dcb in vt mode

 app/test-pmd/cmdline.c  |4 +-
 app/test-pmd/testpmd.c  |   39 ++
 app/test-pmd/testpmd.h  |   10 
 lib/librte_ether/rte_ethdev.c   |   84 +-
 lib/librte_ether/rte_ethdev.h   |5 +-
 lib/librte_pmd_e1000/igb_pf.c   |3 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |1 +
 lib/librte_pmd_ixgbe/ixgbe_pf.c |   98 ++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |7 ++-
 10 files changed, 190 insertions(+), 71 deletions(-)

-- 
1.7.9.5



[dpdk-dev] [PATCH RFC 13/13] mk: add -lpthread to linuxapp EXECENV_LDLIBS

2015-01-12 Thread Sergio Gonzalez Monroy
We need to add -lpthread to EXECENV_LDLIBS because we are not passing
-pthread flags in EXECENV_CFLAGS to GCC when linking apps/

Signed-off-by: Sergio Gonzalez Monroy 
---
 mk/exec-env/linuxapp/rte.vars.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk
index e5af318..dc01ce9 100644
--- a/mk/exec-env/linuxapp/rte.vars.mk
+++ b/mk/exec-env/linuxapp/rte.vars.mk
@@ -49,6 +49,8 @@ endif
 EXECENV_LDFLAGS = --no-as-needed

 EXECENV_LDLIBS  = -lrt -lm
+EXECENV_LDLIBS  += -lpthread
+
 EXECENV_ASFLAGS =

 ifeq ($(RTE_BUILD_SHARED_LIB),y)
-- 
1.9.3



[dpdk-dev] [PATCH RFC 12/13] mk: update apps build

2015-01-12 Thread Sergio Gonzalez Monroy
This patch does:
 - Update the app building command to link against librte_core.
 - Set --start-group/--end-group and --whole-archive/--no-whole-archive
 flags only when linking against static DPDK libs.
 - Set --as--need/--no-as-needed when linknig against shared DPDK libs.
 - Link against EXECENV_LIBS always with --as-needed flag.

Signed-off-by: Sergio Gonzalez Monroy 
---
 mk/rte.app.mk | 64 ---
 1 file changed, 26 insertions(+), 38 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index becdac5..1fc19e1 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -59,22 +59,27 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
-
-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+LDLIBS += --as-needed
+else
+LDLIBS += --no-as-needed
+LDLIBS += --start-group
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
+LDLIBS += -lrte_core
+
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 LDLIBS += -lrte_kni
 endif
-endif

 ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 LDLIBS += -lrte_ivshmem
 endif
+endif # CONFIG_RTE_EXEC_ENV_LINUXAPP
+
+ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
+LDLIBS += -lrte_distributor
 endif

 ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
@@ -123,16 +128,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
 LDLIBS += -lpcap
 endif

-LDLIBS += --start-group
-
 ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
 LDLIBS += -lrte_kvargs
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
-LDLIBS += -lrte_mbuf
-endif
-
 ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
 LDLIBS += -lrte_ip_frag
 endif
@@ -141,22 +140,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
 LDLIBS += -lethdev
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
 ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
 LDLIBS += -lrte_cmdline
 endif
@@ -165,6 +148,11 @@ ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),y)
 LDLIBS += -lrte_cfgfile
 endif

+ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
+LDLIBS += -lrte_vhost
+LDLIBS += -lfuse
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
 LDLIBS += -lrte_pmd_bond
 endif
@@ -175,7 +163,10 @@ LDLIBS += -lxenstore
 endif

 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+#
 # plugins (link only if static libraries)
+#
+LDLIBS += --whole-archive

 ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
 LDLIBS += -lrte_pmd_vmxnet3_uio
@@ -185,11 +176,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
 LDLIBS += -lrte_pmd_virtio_uio
 endif

-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-LDLIBS += -lfuse
-endif
-
 ifeq ($(CONFIG_RTE_LIBRTE_ENIC_PMD),y)
 LDLIBS += -lrte_pmd_enic
 endif
@@ -218,13 +204,15 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_AF_PACKET),y)
 LDLIBS += -lrte_pmd_af_packet
 endif

-endif # plugins
-
-LDLIBS += $(EXECENV_LDLIBS)
+LDLIBS += --no-whole-archive

 LDLIBS += --end-group

-LDLIBS += --no-whole-archive
+LDLIBS += --as-needed
+
+endif # plugins
+
+LDLIBS += $(EXECENV_LDLIBS)

 endif # ifeq ($(NO_AUTOLIBS),)

-- 
1.9.3



[dpdk-dev] [PATCH RFC 11/13] mk: Use LDLIBS when linking shared libraries

2015-01-12 Thread Sergio Gonzalez Monroy
This patch mainly makes use of the LDLIBS variable when linking shared
libraries, setting proper DT_NEEDED entries.
This patch also fix a few nits like syntax highlighting, the command
string (O_TO_S_STR) used for linking shared libraries and the displayed
of dependencies when debugging is enable (D).

Signed-off-by: Sergio Gonzalez Monroy 
---
 mk/rte.lib.mk | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 7c99fd1..559c76a 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -59,16 +59,19 @@ build: _postbuild

 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1

+_LDLIBS := -z defs --as-needed $(LDLIBS) $(EXECENV_LDLIBS) --no-as-needed
+
 ifeq ($(LINK_USING_CC),1)
 # Override the definition of LD here, since we're linking with CC
 LD := $(CC) $(CPU_CFLAGS)
 _CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS))
+_LDLIBS := $(call linkerprefix,$(_LDLIBS))
 else
 _CPU_LDFLAGS := $(CPU_LDFLAGS)
 endif

 O_TO_A = $(AR) crus $(LIB) $(OBJS-y)
-O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight
+O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #')# fix syntax highlight
 O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)","  AR $(@)")
 O_TO_A_CMD = "cmd_$@ = $(O_TO_A_STR)"
 O_TO_A_DO = @set -e; \
@@ -76,9 +79,11 @@ O_TO_A_DO = @set -e; \
$(O_TO_A) && \
echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))

-O_TO_S = $(LD) $(_CPU_LDFLAGS) -shared $(OBJS-y) -o $(LIB)
-O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
+O_TO_S = $(LD) $(_CPU_LDFLAGS) -L $(RTE_OUTPUT)/lib \
+-shared $(OBJS-y) $(_LDLIBS) -o $(LIB)
+O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #')# fix syntax highlight
 O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)","  LD $(@)")
+O_TO_S_CMD = "cmd_$@ = $(O_TO_S_STR)"
 O_TO_S_DO = @set -e; \
echo $(O_TO_S_DISP); \
$(O_TO_S) && \
@@ -93,7 +98,7 @@ ifeq ($(RTE_BUILD_SHARED_LIB),y)
 $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
$(if $(D),\
-   @echo -n "$< -> $@ " ; \
+   @echo -n "$? -> $@ " ; \
echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
echo -n "cmdline_changed=$(call boolean,$(call 
cmdline_changed,$(O_TO_S_STR))) " ; \
echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; 
\
@@ -108,7 +113,7 @@ else
 $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
$(if $(D),\
-   @echo -n "$< -> $@ " ; \
+   @echo -n "$? -> $@ " ; \
echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
echo -n "cmdline_changed=$(call boolean,$(call 
cmdline_changed,$(O_TO_A_STR))) " ; \
echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \
-- 
1.9.3



[dpdk-dev] [PATCH RFC 10/13] lib: Set LDLIBS for each library

2015-01-12 Thread Sergio Gonzalez Monroy
This patch set LDLIBS for each library.
When creating shared libraries, each library will be linked against
their dependant libraries - LDLIBS.

Signed-off-by: Sergio Gonzalez Monroy 
---
 lib/librte_acl/Makefile   | 1 +
 lib/librte_cfgfile/Makefile   | 1 +
 lib/librte_cmdline/Makefile   | 1 +
 lib/librte_distributor/Makefile   | 1 +
 lib/librte_ether/Makefile | 1 +
 lib/librte_hash/Makefile  | 1 +
 lib/librte_ip_frag/Makefile   | 1 +
 lib/librte_ivshmem/Makefile   | 1 +
 lib/librte_kni/Makefile   | 1 +
 lib/librte_kvargs/Makefile| 1 +
 lib/librte_lpm/Makefile   | 1 +
 lib/librte_meter/Makefile | 2 ++
 lib/librte_pipeline/Makefile  | 2 ++
 lib/librte_pmd_af_packet/Makefile | 2 ++
 lib/librte_pmd_bond/Makefile  | 2 ++
 lib/librte_pmd_e1000/Makefile | 2 ++
 lib/librte_pmd_enic/Makefile  | 2 ++
 lib/librte_pmd_i40e/Makefile  | 2 ++
 lib/librte_pmd_ixgbe/Makefile | 2 ++
 lib/librte_pmd_pcap/Makefile  | 2 ++
 lib/librte_pmd_ring/Makefile  | 2 ++
 lib/librte_pmd_virtio/Makefile| 2 ++
 lib/librte_pmd_vmxnet3/Makefile   | 2 ++
 lib/librte_pmd_xenvirt/Makefile   | 2 ++
 lib/librte_port/Makefile  | 2 ++
 lib/librte_power/Makefile | 2 ++
 lib/librte_sched/Makefile | 2 ++
 lib/librte_table/Makefile | 3 +++
 lib/librte_timer/Makefile | 2 ++
 lib/librte_vhost/Makefile | 2 ++
 30 files changed, 50 insertions(+)

diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index d3636ed..63982e8 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -58,6 +58,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include += 
rte_acl_osdep_alone.h
 else
 # this lib needs
 DEPDIRS-$(CONFIG_RTE_LIBRTE_ACL) += lib/core
+LDLIBS += -lrte_core
 endif

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cfgfile/Makefile b/lib/librte_cfgfile/Makefile
index c959f5b..4fc3cb1 100644
--- a/lib/librte_cfgfile/Makefile
+++ b/lib/librte_cfgfile/Makefile
@@ -49,5 +49,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_CFGFILE)-include += rte_cfgfile.h

 # this lib needs eal
 DEPDIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += lib/core
+LDLIBS += -lrte_core

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index ba5e49f..f75689d 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -59,5 +59,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_CMDLINE)-include := $(INCS)

 # this lib needs
 DEPDIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += lib/core
+LDLIBS += -lrte_core

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index e1ab6ee..2c8bce2 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -45,5 +45,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)-include := 
rte_distributor.h

 # this lib needs eal
 DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/core
+LDLIBS += -lrte_core

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index 647c554..c925ab2 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -50,5 +50,6 @@ SYMLINK-y-include += rte_eth_ctrl.h

 # this lib depends upon:
 DEPDIRS-y += lib/core
+LDLIBS += -lrte_core

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index 220ba5d..d18147f 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -49,5 +49,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_fbk_hash.h

 # this lib needs eal
 DEPDIRS-$(CONFIG_RTE_LIBRTE_HASH) += lib/core
+LDLIBS += -lrte_core

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 9fbff70..078ca9e 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -55,5 +55,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h

 # this library depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/core lib/librte_ether
+LDLIBS += -lrte_core -lethdev

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ivshmem/Makefile b/lib/librte_ivshmem/Makefile
index d873195..c059b3f 100644
--- a/lib/librte_ivshmem/Makefile
+++ b/lib/librte_ivshmem/Makefile
@@ -44,5 +44,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_IVSHMEM)-include := rte_ivshmem.h

 # this lib needs eal
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += lib/core
+LDLIBS += -lrte_core

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
index d2472c2..63fe80d 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -45,5 +45,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_KNI)-include := rte_kni.h
 # this lib needs
 DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/core
 DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_ether
+LDLIBS += -lrte_core -lethedev

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 00564e2..8a015fc 100644
--- 

[dpdk-dev] [PATCH RFC 09/13] mk: new corelib makefile

2015-01-12 Thread Sergio Gonzalez Monroy
This patch creates a new rte.corelib.mk file and updates core libraries
to use it.

Signed-off-by: Sergio Gonzalez Monroy 
---
 lib/core/librte_eal/bsdapp/eal/Makefile   |  2 +-
 lib/core/librte_eal/linuxapp/eal/Makefile |  3 +-
 lib/core/librte_malloc/Makefile   |  2 +-
 lib/core/librte_mbuf/Makefile |  2 +-
 lib/core/librte_mempool/Makefile  |  2 +-
 lib/core/librte_ring/Makefile |  2 +-
 mk/rte.corelib.mk | 81 +++
 7 files changed, 87 insertions(+), 7 deletions(-)
 create mode 100644 mk/rte.corelib.mk

diff --git a/lib/core/librte_eal/bsdapp/eal/Makefile 
b/lib/core/librte_eal/bsdapp/eal/Makefile
index af0338f..afba0c6 100644
--- a/lib/core/librte_eal/bsdapp/eal/Makefile
+++ b/lib/core/librte_eal/bsdapp/eal/Makefile
@@ -93,5 +93,5 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP)-include/exec-env := \

 DEPDIRS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += lib/core/librte_eal/common

-include $(RTE_SDK)/mk/rte.lib.mk
+include $(RTE_SDK)/mk/rte.corelib.mk

diff --git a/lib/core/librte_eal/linuxapp/eal/Makefile 
b/lib/core/librte_eal/linuxapp/eal/Makefile
index 0af2cd6..04165a2 100644
--- a/lib/core/librte_eal/linuxapp/eal/Makefile
+++ b/lib/core/librte_eal/linuxapp/eal/Makefile
@@ -108,5 +108,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP)-include/exec-env 
:= \

 DEPDIRS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += lib/core/librte_eal/common

-include $(RTE_SDK)/mk/rte.lib.mk
-
+include $(RTE_SDK)/mk/rte.corelib.mk
diff --git a/lib/core/librte_malloc/Makefile b/lib/core/librte_malloc/Makefile
index 8ed6e7d..8bc3d06 100644
--- a/lib/core/librte_malloc/Makefile
+++ b/lib/core/librte_malloc/Makefile
@@ -45,4 +45,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_MALLOC)-include := rte_malloc.h
 # this lib needs eal
 DEPDIRS-$(CONFIG_RTE_LIBRTE_MALLOC) += lib/core/librte_eal

-include $(RTE_SDK)/mk/rte.lib.mk
+include $(RTE_SDK)/mk/rte.corelib.mk
diff --git a/lib/core/librte_mbuf/Makefile b/lib/core/librte_mbuf/Makefile
index b916d77..ceb4bd6 100644
--- a/lib/core/librte_mbuf/Makefile
+++ b/lib/core/librte_mbuf/Makefile
@@ -45,4 +45,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h
 # this lib needs eal
 DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF) += lib/core/librte_eal 
lib/core/librte_mempool

-include $(RTE_SDK)/mk/rte.lib.mk
+include $(RTE_SDK)/mk/rte.corelib.mk
diff --git a/lib/core/librte_mempool/Makefile b/lib/core/librte_mempool/Makefile
index 94a7fc1..6e1e7c3 100644
--- a/lib/core/librte_mempool/Makefile
+++ b/lib/core/librte_mempool/Makefile
@@ -48,4 +48,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h
 DEPDIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += lib/core/librte_eal 
lib/core/librte_ring
 DEPDIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += lib/core/librte_malloc

-include $(RTE_SDK)/mk/rte.lib.mk
+include $(RTE_SDK)/mk/rte.corelib.mk
diff --git a/lib/core/librte_ring/Makefile b/lib/core/librte_ring/Makefile
index 0b196e8..5111d34 100644
--- a/lib/core/librte_ring/Makefile
+++ b/lib/core/librte_ring/Makefile
@@ -45,4 +45,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_RING)-include := rte_ring.h
 # this lib needs eal and rte_malloc
 DEPDIRS-$(CONFIG_RTE_LIBRTE_RING) += lib/core/librte_eal lib/core/librte_malloc

-include $(RTE_SDK)/mk/rte.lib.mk
+include $(RTE_SDK)/mk/rte.corelib.mk
diff --git a/mk/rte.corelib.mk b/mk/rte.corelib.mk
new file mode 100644
index 000..0f83021
--- /dev/null
+++ b/mk/rte.corelib.mk
@@ -0,0 +1,81 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE 

[dpdk-dev] [PATCH RFC 08/13] Update path of core libraries

2015-01-12 Thread Sergio Gonzalez Monroy
Update path to libraries inside core subdirectory.

Signed-off-by: Sergio Gonzalez Monroy 
---
 app/test/test_eal_fs.c |  2 +-
 lib/Makefile   |  6 +-
 lib/core/librte_eal/bsdapp/eal/Makefile| 14 +++---
 lib/core/librte_eal/common/Makefile|  2 +-
 lib/core/librte_eal/linuxapp/eal/Makefile  | 14 +++---
 lib/core/librte_eal/linuxapp/kni/Makefile  |  2 +-
 lib/core/librte_eal/linuxapp/xen_dom0/Makefile |  2 +-
 lib/core/librte_malloc/Makefile|  2 +-
 lib/core/librte_mbuf/Makefile  |  2 +-
 lib/core/librte_mempool/Makefile   |  4 ++--
 lib/core/librte_ring/Makefile  |  2 +-
 lib/librte_acl/Makefile|  4 ++--
 lib/librte_cfgfile/Makefile|  2 +-
 lib/librte_cmdline/Makefile|  4 ++--
 lib/librte_distributor/Makefile|  3 +--
 lib/librte_ether/Makefile  |  2 +-
 lib/librte_hash/Makefile   |  2 +-
 lib/librte_ip_frag/Makefile|  4 ++--
 lib/librte_ivshmem/Makefile|  2 +-
 lib/librte_kni/Makefile|  4 ++--
 lib/librte_kvargs/Makefile |  4 ++--
 lib/librte_lpm/Makefile|  4 ++--
 lib/librte_meter/Makefile  |  2 +-
 lib/librte_pipeline/Makefile   |  1 +
 lib/librte_pmd_af_packet/Makefile  |  3 +--
 lib/librte_pmd_bond/Makefile   |  5 ++---
 lib/librte_pmd_e1000/Makefile  |  6 +++---
 lib/librte_pmd_enic/Makefile   |  6 +++---
 lib/librte_pmd_i40e/Makefile   |  6 +++---
 lib/librte_pmd_ixgbe/Makefile  |  6 +++---
 lib/librte_pmd_pcap/Makefile   |  3 +--
 lib/librte_pmd_ring/Makefile   |  4 ++--
 lib/librte_pmd_virtio/Makefile |  6 +++---
 lib/librte_pmd_vmxnet3/Makefile|  6 +++---
 lib/librte_pmd_xenvirt/Makefile|  6 +++---
 lib/librte_port/Makefile   |  6 ++
 lib/librte_power/Makefile  |  2 +-
 lib/librte_sched/Makefile  |  5 +++--
 lib/librte_table/Makefile  |  5 +
 lib/librte_timer/Makefile  |  4 ++--
 lib/librte_vhost/Makefile  |  6 ++
 41 files changed, 81 insertions(+), 94 deletions(-)

diff --git a/app/test/test_eal_fs.c b/app/test/test_eal_fs.c
index 1cbcb9d..f6e81fc 100644
--- a/app/test/test_eal_fs.c
+++ b/app/test/test_eal_fs.c
@@ -38,7 +38,7 @@
 #include 

 /* eal_filesystem.h is not a public header file, so use relative path */
-#include "../../lib/librte_eal/common/eal_filesystem.h"
+#include "../../lib/core/librte_eal/common/eal_filesystem.h"

 static int
 test_parse_sysfs_value(void)
diff --git a/lib/Makefile b/lib/Makefile
index bafc9ae..6de4587 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -31,11 +31,7 @@

 include $(RTE_SDK)/mk/rte.vars.mk

-DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
-DIRS-$(CONFIG_RTE_LIBRTE_MALLOC) += librte_malloc
-DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
-DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool
-DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
+DIRS-y += core
 DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
diff --git a/lib/core/librte_eal/bsdapp/eal/Makefile 
b/lib/core/librte_eal/bsdapp/eal/Makefile
index d434882..af0338f 100644
--- a/lib/core/librte_eal/bsdapp/eal/Makefile
+++ b/lib/core/librte_eal/bsdapp/eal/Makefile
@@ -33,14 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk

 LIB = librte_eal.a

-VPATH += $(RTE_SDK)/lib/librte_eal/common
+VPATH += $(RTE_SDK)/lib/core/librte_eal/common

 CFLAGS += -I$(SRCDIR)/include
-CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
-CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
-CFLAGS += -I$(RTE_SDK)/lib/librte_ring
-CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
-CFLAGS += -I$(RTE_SDK)/lib/librte_malloc
+CFLAGS += -I$(RTE_SDK)/lib/core/librte_eal/common
+CFLAGS += -I$(RTE_SDK)/lib/core/librte_eal/common/include
+CFLAGS += -I$(RTE_SDK)/lib/core/librte_ring
+CFLAGS += -I$(RTE_SDK)/lib/core/librte_mempool
+CFLAGS += -I$(RTE_SDK)/lib/core/librte_malloc
 CFLAGS += -I$(RTE_SDK)/lib/librte_ether
 CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring
 CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_pcap
@@ -91,7 +91,7 @@ INC := rte_interrupts.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP)-include/exec-env := \
$(addprefix include/exec-env/,$(INC))

-DEPDIRS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += lib/librte_eal/common
+DEPDIRS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += lib/core/librte_eal/common

 include $(RTE_SDK)/mk/rte.lib.mk

diff --git a/lib/core/librte_eal/common/Makefile 
b/lib/core/librte_eal/common/Makefile
index 52c1a5f..1533f81 100644

[dpdk-dev] [PATCH RFC 06/13] core: move librte_mbuf to core subdir

2015-01-12 Thread Sergio Gonzalez Monroy
This is equivalent to:

git mv lib/librte_mbuf lib/core

Signed-off-by: Sergio Gonzalez Monroy 
---
 lib/core/librte_mbuf/Makefile   |   48 ++
 lib/core/librte_mbuf/rte_mbuf.c |  252 +
 lib/core/librte_mbuf/rte_mbuf.h | 1133 +++
 lib/librte_mbuf/Makefile|   48 --
 lib/librte_mbuf/rte_mbuf.c  |  252 -
 lib/librte_mbuf/rte_mbuf.h  | 1133 ---
 6 files changed, 1433 insertions(+), 1433 deletions(-)
 create mode 100644 lib/core/librte_mbuf/Makefile
 create mode 100644 lib/core/librte_mbuf/rte_mbuf.c
 create mode 100644 lib/core/librte_mbuf/rte_mbuf.h
 delete mode 100644 lib/librte_mbuf/Makefile
 delete mode 100644 lib/librte_mbuf/rte_mbuf.c
 delete mode 100644 lib/librte_mbuf/rte_mbuf.h

diff --git a/lib/core/librte_mbuf/Makefile b/lib/core/librte_mbuf/Makefile
new file mode 100644
index 000..9b45ba4
--- /dev/null
+++ b/lib/core/librte_mbuf/Makefile
@@ -0,0 +1,48 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_mbuf.a
+
+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+
+# all source are stored in SRCS-y
+SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c
+
+# install includes
+SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h
+
+# this lib needs eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF) += lib/librte_eal lib/librte_mempool
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/core/librte_mbuf/rte_mbuf.c b/lib/core/librte_mbuf/rte_mbuf.c
new file mode 100644
index 000..1b14e02
--- /dev/null
+++ b/lib/core/librte_mbuf/rte_mbuf.c
@@ -0,0 +1,252 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright 2014 6WIND S.A.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE 

[dpdk-dev] [PATCH RFC 05/13] core: move librte_mempool to core subdir

2015-01-12 Thread Sergio Gonzalez Monroy
This is equivalent to:

git mv lib/librte_mempool lib/core

Signed-off-by: Sergio Gonzalez Monroy 
---
 lib/core/librte_mempool/Makefile   |   51 +
 lib/core/librte_mempool/rte_dom0_mempool.c |  134 +++
 lib/core/librte_mempool/rte_mempool.c  |  901 ++
 lib/core/librte_mempool/rte_mempool.h  | 1392 
 lib/librte_mempool/Makefile|   51 -
 lib/librte_mempool/rte_dom0_mempool.c  |  134 ---
 lib/librte_mempool/rte_mempool.c   |  901 --
 lib/librte_mempool/rte_mempool.h   | 1392 
 8 files changed, 2478 insertions(+), 2478 deletions(-)
 create mode 100644 lib/core/librte_mempool/Makefile
 create mode 100644 lib/core/librte_mempool/rte_dom0_mempool.c
 create mode 100644 lib/core/librte_mempool/rte_mempool.c
 create mode 100644 lib/core/librte_mempool/rte_mempool.h
 delete mode 100644 lib/librte_mempool/Makefile
 delete mode 100644 lib/librte_mempool/rte_dom0_mempool.c
 delete mode 100644 lib/librte_mempool/rte_mempool.c
 delete mode 100644 lib/librte_mempool/rte_mempool.h

diff --git a/lib/core/librte_mempool/Makefile b/lib/core/librte_mempool/Makefile
new file mode 100644
index 000..9939e10
--- /dev/null
+++ b/lib/core/librte_mempool/Makefile
@@ -0,0 +1,51 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_mempool.a
+
+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+
+# all source are stored in SRCS-y
+SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool.c
+ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)
+SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_dom0_mempool.c
+endif
+# install includes
+SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h
+
+# this lib needs eal, rte_ring and rte_malloc
+DEPDIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += lib/librte_eal lib/librte_ring
+DEPDIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += lib/librte_malloc
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/core/librte_mempool/rte_dom0_mempool.c 
b/lib/core/librte_mempool/rte_dom0_mempool.c
new file mode 100644
index 000..9ec68fb
--- /dev/null
+++ b/lib/core/librte_mempool/rte_dom0_mempool.c
@@ -0,0 +1,134 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE 

[dpdk-dev] [PATCH RFC 03/13] core: move librte_eal to core subdir

2015-01-12 Thread Sergio Gonzalez Monroy
This is equivalent to:

git mv lib/librte_eal lib/core

Signed-off-by: Sergio Gonzalez Monroy 
---
 lib/core/librte_eal/Makefile   |39 +
 lib/core/librte_eal/bsdapp/Makefile|38 +
 lib/core/librte_eal/bsdapp/contigmem/BSDmakefile   |36 +
 lib/core/librte_eal/bsdapp/contigmem/Makefile  |52 +
 lib/core/librte_eal/bsdapp/contigmem/contigmem.c   |   233 +
 lib/core/librte_eal/bsdapp/eal/Makefile|97 +
 lib/core/librte_eal/bsdapp/eal/eal.c   |   563 +
 lib/core/librte_eal/bsdapp/eal/eal_alarm.c |60 +
 lib/core/librte_eal/bsdapp/eal/eal_debug.c |   113 +
 lib/core/librte_eal/bsdapp/eal/eal_hugepage_info.c |   133 +
 lib/core/librte_eal/bsdapp/eal/eal_interrupts.c|71 +
 lib/core/librte_eal/bsdapp/eal/eal_lcore.c |   107 +
 lib/core/librte_eal/bsdapp/eal/eal_log.c   |57 +
 lib/core/librte_eal/bsdapp/eal/eal_memory.c|   224 +
 lib/core/librte_eal/bsdapp/eal/eal_pci.c   |   510 +
 lib/core/librte_eal/bsdapp/eal/eal_thread.c|   233 +
 lib/core/librte_eal/bsdapp/eal/eal_timer.c |   141 +
 .../bsdapp/eal/include/exec-env/rte_dom0_common.h  |   107 +
 .../bsdapp/eal/include/exec-env/rte_interrupts.h   |54 +
 lib/core/librte_eal/bsdapp/nic_uio/BSDmakefile |36 +
 lib/core/librte_eal/bsdapp/nic_uio/Makefile|52 +
 lib/core/librte_eal/bsdapp/nic_uio/nic_uio.c   |   329 +
 lib/core/librte_eal/common/Makefile|61 +
 lib/core/librte_eal/common/eal_common_cpuflags.c   |85 +
 lib/core/librte_eal/common/eal_common_dev.c|   109 +
 lib/core/librte_eal/common/eal_common_devargs.c|   152 +
 lib/core/librte_eal/common/eal_common_errno.c  |74 +
 lib/core/librte_eal/common/eal_common_hexdump.c|   121 +
 lib/core/librte_eal/common/eal_common_launch.c |   120 +
 lib/core/librte_eal/common/eal_common_log.c|   320 +
 lib/core/librte_eal/common/eal_common_memory.c |   121 +
 lib/core/librte_eal/common/eal_common_memzone.c|   533 +
 lib/core/librte_eal/common/eal_common_options.c|   611 ++
 lib/core/librte_eal/common/eal_common_pci.c|   207 +
 lib/core/librte_eal/common/eal_common_string_fns.c |69 +
 lib/core/librte_eal/common/eal_common_tailqs.c |   146 +
 lib/core/librte_eal/common/eal_filesystem.h|   118 +
 lib/core/librte_eal/common/eal_hugepages.h |67 +
 lib/core/librte_eal/common/eal_internal_cfg.h  |93 +
 lib/core/librte_eal/common/eal_options.h   |93 +
 lib/core/librte_eal/common/eal_private.h   |   206 +
 lib/core/librte_eal/common/eal_thread.h|53 +
 .../common/include/arch/ppc_64/rte_atomic.h|   426 +
 .../common/include/arch/ppc_64/rte_byteorder.h |   149 +
 .../common/include/arch/ppc_64/rte_cpuflags.h  |   187 +
 .../common/include/arch/ppc_64/rte_cycles.h|87 +
 .../common/include/arch/ppc_64/rte_memcpy.h|   225 +
 .../common/include/arch/ppc_64/rte_prefetch.h  |61 +
 .../common/include/arch/ppc_64/rte_spinlock.h  |73 +
 .../common/include/arch/x86/rte_atomic.h   |   216 +
 .../common/include/arch/x86/rte_atomic_32.h|   222 +
 .../common/include/arch/x86/rte_atomic_64.h|   191 +
 .../common/include/arch/x86/rte_byteorder.h|   125 +
 .../common/include/arch/x86/rte_byteorder_32.h |51 +
 .../common/include/arch/x86/rte_byteorder_64.h |52 +
 .../common/include/arch/x86/rte_cpuflags.h |   310 +
 .../common/include/arch/x86/rte_cycles.h   |   121 +
 .../common/include/arch/x86/rte_memcpy.h   |   297 +
 .../common/include/arch/x86/rte_prefetch.h |62 +
 .../common/include/arch/x86/rte_spinlock.h |94 +
 .../librte_eal/common/include/generic/rte_atomic.h |   918 ++
 .../common/include/generic/rte_byteorder.h |   217 +
 .../common/include/generic/rte_cpuflags.h  |   110 +
 .../librte_eal/common/include/generic/rte_cycles.h |   205 +
 .../librte_eal/common/include/generic/rte_memcpy.h |   144 +
 .../common/include/generic/rte_prefetch.h  |71 +
 .../common/include/generic/rte_spinlock.h  |   226 +
 lib/core/librte_eal/common/include/rte_alarm.h |   106 +
 .../common/include/rte_branch_prediction.h |70 +
 lib/core/librte_eal/common/include/rte_common.h|   389 +
 .../librte_eal/common/include/rte_common_vect.h|93 +
 lib/core/librte_eal/common/include/rte_debug.h |   105 +
 lib/core/librte_eal/common/include/rte_dev.h   |   111 +
 lib/core/librte_eal/common/include/rte_devargs.h   |   149 +
 lib/core/librte_eal/common/include/rte_eal.h   |   269 +
 .../librte_eal/common/include/rte_eal_memconfig.h  |   112 +
 lib/core/librte_eal/common/include/rte_errno.h |96 +
 lib/core/librte_eal/common/include/rte_hexdump.h   |89 +
 .../librte_eal/common/include/rte_interrupts.h |   121 +

[dpdk-dev] [PATCH RFC 02/13] lib/core: create new core dir and makefiles

2015-01-12 Thread Sergio Gonzalez Monroy
This patch creates a new subdirectory 'core' which contains DPDK core
libraries.

The goal is to generate a librte_core library that contains all
libraries under the core subdirectory. For that purpose, a synthetic
library librte_core is created.

When building the DPDK, all object files from core libraries would be
moved to the build directory of librte_core. When building librte_core,
the build system will link/archive all objects found in the directory.

Signed-off-by: Sergio Gonzalez Monroy 
---
 lib/core/Makefile | 43 +
 lib/core/librte_core/Makefile | 45 +++
 2 files changed, 88 insertions(+)
 create mode 100644 lib/core/Makefile
 create mode 100644 lib/core/librte_core/Makefile

diff --git a/lib/core/Makefile b/lib/core/Makefile
new file mode 100644
index 000..ad44daa
--- /dev/null
+++ b/lib/core/Makefile
@@ -0,0 +1,43 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+DIRS-y += librte_eal
+DIRS-y += librte_malloc
+DIRS-y += librte_ring
+DIRS-y += librte_mempool
+DIRS-y += librte_mbuf
+
+DIRS-y += librte_core
+export COREDIR=$(CURDIR)/librte_core
+
+include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/core/librte_core/Makefile b/lib/core/librte_core/Makefile
new file mode 100644
index 000..b169134
--- /dev/null
+++ b/lib/core/librte_core/Makefile
@@ -0,0 +1,45 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_core.a
+
+SRCS-y = $(wildcard *.o)
+
+DEPDIRS-y += lib/core/librte_eal
+DEPDIRS-y += lib/core/librte_mempool
+DEPDIRS-y += lib/core/librte_malloc
+DEPDIRS-y += 

[dpdk-dev] [PATCH RFC 01/13] mk: Remove combined library and related options

2015-01-12 Thread Sergio Gonzalez Monroy
Remove CONFIG_RTE_BUILD_COMBINE_LIBS and CONFIG_RTE_LIBNAME.

Signed-off-by: Sergio Gonzalez Monroy 
---
 config/common_bsdapp|   6 --
 config/common_linuxapp  |   6 --
 config/defconfig_ppc_64-power8-linuxapp-gcc |   2 -
 lib/Makefile|   1 -
 mk/rte.app.mk   |  12 
 mk/rte.lib.mk   |  34 --
 mk/rte.sdkbuild.mk  |   3 -
 mk/rte.sharelib.mk  | 101 
 mk/rte.vars.mk  |   9 ---
 9 files changed, 174 deletions(-)
 delete mode 100644 mk/rte.sharelib.mk

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 9177db1..812a6ca 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -79,12 +79,6 @@ CONFIG_RTE_FORCE_INTRINSICS=n
 CONFIG_RTE_BUILD_SHARED_LIB=n

 #
-# Combine to one single library
-#
-CONFIG_RTE_BUILD_COMBINE_LIBS=n
-CONFIG_RTE_LIBNAME=intel_dpdk
-
-#
 # Compile Environment Abstraction Layer
 #
 CONFIG_RTE_LIBRTE_EAL=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2f9643b..e35ad2b 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -79,12 +79,6 @@ CONFIG_RTE_FORCE_INTRINSICS=n
 CONFIG_RTE_BUILD_SHARED_LIB=n

 #
-# Combine to one single library
-#
-CONFIG_RTE_BUILD_COMBINE_LIBS=n
-CONFIG_RTE_LIBNAME="intel_dpdk"
-
-#
 # Compile Environment Abstraction Layer
 #
 CONFIG_RTE_LIBRTE_EAL=y
diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
b/config/defconfig_ppc_64-power8-linuxapp-gcc
index d97a885..f1af518 100644
--- a/config/defconfig_ppc_64-power8-linuxapp-gcc
+++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
@@ -39,8 +39,6 @@ CONFIG_RTE_ARCH_64=y
 CONFIG_RTE_TOOLCHAIN="gcc"
 CONFIG_RTE_TOOLCHAIN_GCC=y

-CONFIG_RTE_LIBNAME="powerpc_dpdk"
-
 # Note: Power doesn't have this support
 CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n

diff --git a/lib/Makefile b/lib/Makefile
index 0ffc982..bafc9ae 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -71,5 +71,4 @@ DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
 DIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += librte_ivshmem
 endif

-include $(RTE_SDK)/mk/rte.sharelib.mk
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index e1a0dbf..becdac5 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -61,8 +61,6 @@ ifeq ($(NO_AUTOLIBS),)

 LDLIBS += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
-
 ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
 LDLIBS += -lrte_distributor
 endif
@@ -121,16 +119,12 @@ LDLIBS += -lm
 LDLIBS += -lrt
 endif

-endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
-
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
 LDLIBS += -lpcap
 endif

 LDLIBS += --start-group

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
-
 ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
 LDLIBS += -lrte_kvargs
 endif
@@ -226,8 +220,6 @@ endif

 endif # plugins

-endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
-
 LDLIBS += $(EXECENV_LDLIBS)

 LDLIBS += --end-group
@@ -251,10 +243,6 @@ build: _postbuild

 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
-
 ifeq ($(LINK_USING_CC),1)
 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
 O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 81bf8e1..7c99fd1 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -84,24 +84,6 @@ O_TO_S_DO = @set -e; \
$(O_TO_S) && \
echo $(O_TO_S_CMD) > $(call exe2cmd,$(@))

-ifeq ($(RTE_BUILD_SHARED_LIB),n)
-O_TO_C = $(AR) crus $(LIB_ONE) $(OBJS-y)
-O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight
-O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)","  AR_C $(@)")
-O_TO_C_DO = @set -e; \
-   $(lib_dir) \
-   $(copy_obj)
-else
-O_TO_C = $(LD) -shared $(OBJS-y) -o $(LIB_ONE)
-O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight
-O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)","  LD_C $(@)")
-O_TO_C_DO = @set -e; \
-   $(lib_dir) \
-   $(copy_obj)
-endif
-
-copy_obj = cp -f $(OBJS-y) $(RTE_OUTPUT)/build/lib;
-lib_dir = [ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib;
 -include .$(LIB).cmd

 #
@@ -122,14 +104,6 @@ $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
$(depfile_missing),\
$(depfile_newer)),\
$(O_TO_S_DO))
-ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
-   $(if $(or \
-$(file_missing),\
-$(call cmdline_changed,$(O_TO_C_STR)),\
-$(depfile_missing),\
-$(depfile_newer)),\
-$(O_TO_C_DO))
-endif
 else
 $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
@@ -145,14 +119,6 @@ $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
$(depfile_missing),\
$(depfile_newer)),\
$(O_TO_A_DO))
-ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
-   $(if $(or \
-$(file_missing),\
-$(call cmdline_changed,$(O_TO_C_STR)),\
-

[dpdk-dev] [PATCH RFC 00/13] Update build system

2015-01-12 Thread Sergio Gonzalez Monroy
This patch series updates the DPDK build system.

Following are the goals it tries to accomplish:
 - Create a library containing core DPDK libraries (librte_eal,
   librte_malloc, librte_mempool, librte_mbuf and librte_ring).
   The idea of core libraries is to group those libraries that are
   always required for any DPDK application.
 - Remove config option to build a combined library.
 - For shared libraries, explicitly link against dependant
   libraries (adding entries to DT_NEEDED).
 - Update app linking flags against static/shared DPDK libs.

Note that this patch turns up being quite big because of moving lib
directories to a new subdirectory.
I have ommited the actual diff from the patch doing the move of librte_eal
as it is quite big (6MB). Probably a different approach is preferred.

Sergio Gonzalez Monroy (13):
  mk: Remove combined library and related options
  lib/core: create new core dir and makefiles
  core: move librte_eal to core subdir
  core: move librte_malloc to core subdir
  core: move librte_mempool to core subdir
  core: move librte_mbuf to core subdir
  core: move librte_ring to core subdir
  Update path of core libraries
  mk: new corelib makefile
  lib: Set LDLIBS for each library
  mk: Use LDLIBS when linking shared libraries
  mk: update apps build
  mk: add -lpthread to linuxapp EXECENV_LDLIBS

 app/test/test_eal_fs.c | 2 +-
 config/common_bsdapp   | 6 -
 config/common_linuxapp | 6 -
 config/defconfig_ppc_64-power8-linuxapp-gcc| 2 -
 lib/Makefile   | 7 +-
 lib/core/Makefile  |43 +
 lib/core/librte_core/Makefile  |45 +
 lib/core/librte_eal/Makefile   |39 +
 lib/core/librte_eal/bsdapp/Makefile|38 +
 lib/core/librte_eal/bsdapp/contigmem/BSDmakefile   |36 +
 lib/core/librte_eal/bsdapp/contigmem/Makefile  |52 +
 lib/core/librte_eal/bsdapp/contigmem/contigmem.c   |   233 +
 lib/core/librte_eal/bsdapp/eal/Makefile|97 +
 lib/core/librte_eal/bsdapp/eal/eal.c   |   563 +
 lib/core/librte_eal/bsdapp/eal/eal_alarm.c |60 +
 lib/core/librte_eal/bsdapp/eal/eal_debug.c |   113 +
 lib/core/librte_eal/bsdapp/eal/eal_hugepage_info.c |   133 +
 lib/core/librte_eal/bsdapp/eal/eal_interrupts.c|71 +
 lib/core/librte_eal/bsdapp/eal/eal_lcore.c |   107 +
 lib/core/librte_eal/bsdapp/eal/eal_log.c   |57 +
 lib/core/librte_eal/bsdapp/eal/eal_memory.c|   224 +
 lib/core/librte_eal/bsdapp/eal/eal_pci.c   |   510 +
 lib/core/librte_eal/bsdapp/eal/eal_thread.c|   233 +
 lib/core/librte_eal/bsdapp/eal/eal_timer.c |   141 +
 .../bsdapp/eal/include/exec-env/rte_dom0_common.h  |   107 +
 .../bsdapp/eal/include/exec-env/rte_interrupts.h   |54 +
 lib/core/librte_eal/bsdapp/nic_uio/BSDmakefile |36 +
 lib/core/librte_eal/bsdapp/nic_uio/Makefile|52 +
 lib/core/librte_eal/bsdapp/nic_uio/nic_uio.c   |   329 +
 lib/core/librte_eal/common/Makefile|61 +
 lib/core/librte_eal/common/eal_common_cpuflags.c   |85 +
 lib/core/librte_eal/common/eal_common_dev.c|   109 +
 lib/core/librte_eal/common/eal_common_devargs.c|   152 +
 lib/core/librte_eal/common/eal_common_errno.c  |74 +
 lib/core/librte_eal/common/eal_common_hexdump.c|   121 +
 lib/core/librte_eal/common/eal_common_launch.c |   120 +
 lib/core/librte_eal/common/eal_common_log.c|   320 +
 lib/core/librte_eal/common/eal_common_memory.c |   121 +
 lib/core/librte_eal/common/eal_common_memzone.c|   533 +
 lib/core/librte_eal/common/eal_common_options.c|   611 ++
 lib/core/librte_eal/common/eal_common_pci.c|   207 +
 lib/core/librte_eal/common/eal_common_string_fns.c |69 +
 lib/core/librte_eal/common/eal_common_tailqs.c |   146 +
 lib/core/librte_eal/common/eal_filesystem.h|   118 +
 lib/core/librte_eal/common/eal_hugepages.h |67 +
 lib/core/librte_eal/common/eal_internal_cfg.h  |93 +
 lib/core/librte_eal/common/eal_options.h   |93 +
 lib/core/librte_eal/common/eal_private.h   |   206 +
 lib/core/librte_eal/common/eal_thread.h|53 +
 .../common/include/arch/ppc_64/rte_atomic.h|   426 +
 .../common/include/arch/ppc_64/rte_byteorder.h |   149 +
 .../common/include/arch/ppc_64/rte_cpuflags.h  |   187 +
 .../common/include/arch/ppc_64/rte_cycles.h|87 +
 .../common/include/arch/ppc_64/rte_memcpy.h|   225 +
 .../common/include/arch/ppc_64/rte_prefetch.h  |61 +
 .../common/include/arch/ppc_64/rte_spinlock.h  |73 +
 .../common/include/arch/x86/rte_atomic.h   |   216 +
 .../common/include/arch/x86/rte_atomic_32.h|   222 +
 .../common/include/arch/x86/rte_atomic_64.h

[dpdk-dev] [PATCH v6 4/6] ether: Check VMDq RSS mode

2015-01-12 Thread Vlad Zolotarov

On 01/12/15 07:59, Ouyang Changchun wrote:
> Check mq mode for VMDq RSS, handle it correctly instead of returning an error;
> Also remove the limitation of per pool queue number has max value of 1, 
> because
> the per pool queue number could be 2 or 4 if it is VMDq RSS mode;
>
> The number of rxq specified in config will determine the mq mode for VMDq RSS.
>
> Signed-off-by: Changchun Ouyang 


Reviewed-by: Vlad Zolotarov 

>
> changes in v6:
>- More clear error message when queue number is invalid.
>
> changes in v5:
>- Fix '<' issue, it should be '<=' to test rxq number;
>- Extract a function to remove the embeded switch-case statement.
>
> ---
>   lib/librte_ether/rte_ethdev.c | 51 
> ++-
>   1 file changed, 46 insertions(+), 5 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 95f2ceb..e9e3368 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -503,6 +503,31 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, 
> uint16_t nb_queues)
>   }
>   
>   static int
> +rte_eth_dev_check_vf_rss_rxq_num(uint8_t port_id, uint16_t nb_rx_q)
> +{
> + struct rte_eth_dev *dev = _eth_devices[port_id];
> + switch (nb_rx_q) {
> + case 1:
> + case 2:
> + RTE_ETH_DEV_SRIOV(dev).active =
> + ETH_64_POOLS;
> + break;
> + case 4:
> + RTE_ETH_DEV_SRIOV(dev).active =
> + ETH_32_POOLS;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = nb_rx_q;
> + RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx =
> + dev->pci_dev->max_vfs * nb_rx_q;
> +
> + return 0;
> +}
> +
> +static int
>   rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t 
> nb_tx_q,
> const struct rte_eth_conf *dev_conf)
>   {
> @@ -510,8 +535,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
> nb_rx_q, uint16_t nb_tx_q,
>   
>   if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
>   /* check multi-queue mode */
> - if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_RSS) ||
> - (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
> + if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
>   (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB_RSS) ||
>   (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB)) {
>   /* SRIOV only works in VMDq enable mode */
> @@ -525,7 +549,6 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
> nb_rx_q, uint16_t nb_tx_q,
>   }
>   
>   switch (dev_conf->rxmode.mq_mode) {
> - case ETH_MQ_RX_VMDQ_RSS:
>   case ETH_MQ_RX_VMDQ_DCB:
>   case ETH_MQ_RX_VMDQ_DCB_RSS:
>   /* DCB/RSS VMDQ in SRIOV mode, not implement yet */
> @@ -534,6 +557,26 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
> nb_rx_q, uint16_t nb_tx_q,
>   "unsupported VMDQ mq_mode rx %u\n",
>   port_id, dev_conf->rxmode.mq_mode);
>   return (-EINVAL);
> + case ETH_MQ_RX_RSS:
> + PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
> + " SRIOV active, "
> + "Rx mq mode is changed from:"
> + "mq_mode %u into VMDQ mq_mode %u\n",
> + port_id,
> + dev_conf->rxmode.mq_mode,
> + dev->data->dev_conf.rxmode.mq_mode);
> + case ETH_MQ_RX_VMDQ_RSS:
> + dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_RSS;
> + if (nb_rx_q <= RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)
> + if (rte_eth_dev_check_vf_rss_rxq_num(port_id, 
> nb_rx_q) != 0) {
> + PMD_DEBUG_TRACE("ethdev port_id=%d"
> + " SRIOV active, invalid queue"
> + " number for VMDQ RSS, allowed"
> + " value are 1, 2 or 4\n",
> + port_id);
> + return -EINVAL;
> + }
> + break;
>   default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */
>   /* if nothing mq mode configure, use default scheme */
>   dev->data->dev_conf.rxmode.mq_mode = 
> ETH_MQ_RX_VMDQ_ONLY;
> @@ -553,8 +596,6 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
> nb_rx_q, uint16_t nb_tx_q,
>   default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
>   /* if nothing mq mode configure, use 

[dpdk-dev] [PATCH v6 6/6] testpmd: Set Rx VMDq RSS mode

2015-01-12 Thread Vlad Zolotarov

On 01/12/15 07:59, Ouyang Changchun wrote:
> Set VMDq RSS mode if it has VF(VF number is more than 1) and has RSS 
> information.
>
> Signed-off-by: Changchun Ouyang 


Reviewed-by: Vlad Zolotarov 

>
> changes in v6
>- Put common statement outside the if branch.
>
> changes in v5
>- Assign txmode.mq_mode with ETH_MQ_TX_NONE explicitly;
>- Remove one line wrong comment.
>
> ---
>   app/test-pmd/testpmd.c | 12 +++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 8c69756..773b8af 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1700,7 +1700,6 @@ init_port_config(void)
>   port->dev_conf.rx_adv_conf.rss_conf.rss_hf = 0;
>   }
>   
> - /* In SR-IOV mode, RSS mode is not available */
>   if (port->dcb_flag == 0 && port->dev_info.max_vfs == 0) {
>   if( port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
>   port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
> @@ -1708,6 +1707,17 @@ init_port_config(void)
>   port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
>   }
>   
> + if (port->dev_info.max_vfs != 0) {
> + if (port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
> + port->dev_conf.rxmode.mq_mode =
> + ETH_MQ_RX_VMDQ_RSS;
> + else
> + port->dev_conf.rxmode.mq_mode =
> + ETH_MQ_RX_NONE;
> +
> + port->dev_conf.txmode.mq_mode = ETH_MQ_TX_NONE;
> + }
> +
>   port->rx_conf.rx_thresh = rx_thresh;
>   port->rx_conf.rx_free_thresh = rx_free_thresh;
>   port->rx_conf.rx_drop_en = rx_drop_en;



[dpdk-dev] [PATCH v6 5/6] ixgbe: Config VF RSS

2015-01-12 Thread Vlad Zolotarov

On 01/12/15 07:59, Ouyang Changchun wrote:
> It needs config RSS and IXGBE_MRQC and IXGBE_VFPSRTYPE to enable VF RSS.
>
> The psrtype will determine how many queues the received packets will 
> distribute to,
> and the value of psrtype should depends on both facet: max VF rxq number which
> has been negotiated with PF, and the number of rxq specified in config on 
> guest.
>
> Signed-off-by: Changchun Ouyang 

Reviewed-by: Vlad Zolotarov 

>
> Changes in v6:
>- Raise an error for the case of ETH_16_POOLS in config vf rss, as the 
> previous
>  logic have changed it into: ETH_32_POOLS.
>
> Changes in v4:
>   - The number of rxq from config should be power of 2 and should not bigger 
> than
>  max VF rxq number(negotiated between guest and host).
>
> ---
>   lib/librte_pmd_ixgbe/ixgbe_pf.c   |  15 ++
>   lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 102 
> +-
>   2 files changed, 105 insertions(+), 12 deletions(-)
>
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c b/lib/librte_pmd_ixgbe/ixgbe_pf.c
> index dbda9b5..93f6e43 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
> @@ -187,6 +187,21 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
>   IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(hw->mac.num_rar_entries), 0);
>   IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(hw->mac.num_rar_entries), 0);
>   
> + /*
> +  * VF RSS can support at most 4 queues for each VF, even if
> +  * 8 queues are available for each VF, it need refine to 4
> +  * queues here due to this limitation, otherwise no queue
> +  * will receive any packet even RSS is enabled.
> +  */
> + if (eth_dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_RSS) {
> + if (RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool == 8) {
> + RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_32_POOLS;
> + RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 4;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =
> + dev_num_vf(eth_dev) * 4;
> + }
> + }
> +
>   /* set VMDq map to default PF pool */
>   hw->mac.ops.set_vmdq(hw, 0, RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
>   
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> index f69abda..20627df 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> @@ -3327,6 +3327,67 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
>   }
>   
>   static int
> +ixgbe_config_vf_rss(struct rte_eth_dev *dev)
> +{
> + struct ixgbe_hw *hw;
> + uint32_t mrqc;
> +
> + ixgbe_rss_configure(dev);
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> + /* MRQC: enable VF RSS */
> + mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC);
> + mrqc &= ~IXGBE_MRQC_MRQE_MASK;
> + switch (RTE_ETH_DEV_SRIOV(dev).active) {
> + case ETH_64_POOLS:
> + mrqc |= IXGBE_MRQC_VMDQRSS64EN;
> + break;
> +
> + case ETH_32_POOLS:
> + mrqc |= IXGBE_MRQC_VMDQRSS32EN;
> + break;
> +
> + default:
> + PMD_INIT_LOG(ERR, "Invalid pool number in IOV mode with VMDQ 
> RSS");
> + return -EINVAL;
> + }
> +
> + IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
> +
> + return 0;
> +}
> +
> +static int
> +ixgbe_config_vf_default(struct rte_eth_dev *dev)
> +{
> + struct ixgbe_hw *hw =
> + IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> + switch (RTE_ETH_DEV_SRIOV(dev).active) {
> + case ETH_64_POOLS:
> + IXGBE_WRITE_REG(hw, IXGBE_MRQC,
> + IXGBE_MRQC_VMDQEN);
> + break;
> +
> + case ETH_32_POOLS:
> + IXGBE_WRITE_REG(hw, IXGBE_MRQC,
> + IXGBE_MRQC_VMDQRT4TCEN);
> + break;
> +
> + case ETH_16_POOLS:
> + IXGBE_WRITE_REG(hw, IXGBE_MRQC,
> + IXGBE_MRQC_VMDQRT8TCEN);
> + break;
> + default:
> + PMD_INIT_LOG(ERR,
> + "invalid pool number in IOV mode");
> + break;
> + }
> + return 0;
> +}
> +
> +static int
>   ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
>   {
>   struct ixgbe_hw *hw =
> @@ -3358,24 +3419,25 @@ ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
>   default: ixgbe_rss_disable(dev);
>   }
>   } else {
> - switch (RTE_ETH_DEV_SRIOV(dev).active) {
>   /*
>* SRIOV active scheme
> -  * FIXME if support DCB/RSS together with VMDq & SRIOV
> +  * Support RSS together with VMDq & SRIOV
>*/
> - case ETH_64_POOLS:
> - IXGBE_WRITE_REG(hw, IXGBE_MRQC, IXGBE_MRQC_VMDQEN);
> - break;
> -
> - case ETH_32_POOLS:
> - IXGBE_WRITE_REG(hw, IXGBE_MRQC, 

[dpdk-dev] [PATCH v5 4/6] ether: Check VMDq RSS mode

2015-01-12 Thread Vlad Zolotarov

On 01/12/15 05:41, Ouyang, Changchun wrote:
>
> *From:*Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> *Sent:* Friday, January 09, 2015 9:50 PM
> *To:* Ouyang, Changchun; dev at dpdk.org
> *Subject:* Re: [dpdk-dev] [PATCH v5 4/6] ether: Check VMDq RSS mode
>
> On 01/09/15 07:54, Ouyang, Changchun wrote:
>
>   
>
>   
>
> -Original Message-
>
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>
> Sent: Friday, January 9, 2015 2:49 AM
>
> To: Ouyang, Changchun;dev at dpdk.org  
>
> Subject: Re: [dpdk-dev] [PATCH v5 4/6] ether: Check VMDq RSS mode
>
>   
>
>   
>
> On 01/08/15 11:19, Vlad Zolotarov wrote:
>
>   
>
> On 01/07/15 08:32, Ouyang Changchun wrote:
>
> Check mq mode for VMDq RSS, handle it correctly instead of 
> returning
>
> an error; Also remove the limitation of per pool queue number 
> has max
>
> value of 1, because the per pool queue number could be 2 or 4 
> if it
>
> is VMDq RSS mode;
>
>   
>
> The number of rxq specified in config will determine the mq 
> mode for
>
> VMDq RSS.
>
>   
>
> Signed-off-by: Changchun Ouyang intel.com>  
>
>   
>
> changes in v5:
>
> - Fix '<' issue, it should be '<=' to test rxq number;
>
> - Extract a function to remove the embeded switch-case 
> statement.
>
>   
>
> ---
>
>lib/librte_ether/rte_ethdev.c | 50
>
> ++-
>
>1 file changed, 45 insertions(+), 5 deletions(-)
>
>   
>
> diff --git a/lib/librte_ether/rte_ethdev.c
>
> b/lib/librte_ether/rte_ethdev.c index 95f2ceb..8363e26 100644
>
> --- a/lib/librte_ether/rte_ethdev.c
>
> +++ b/lib/librte_ether/rte_ethdev.c
>
> @@ -503,6 +503,31 @@ rte_eth_dev_tx_queue_config(struct
>
> rte_eth_dev
>
> *dev, uint16_t nb_queues)
>
>}
>
>  static int
>
> +rte_eth_dev_check_vf_rss_rxq_num(uint8_t port_id, uint16_t 
> nb_rx_q)
>
> +{
>
> +struct rte_eth_dev *dev = _eth_devices[port_id];
>
> +switch (nb_rx_q) {
>
> +case 1:
>
> +case 2:
>
> +RTE_ETH_DEV_SRIOV(dev).active =
>
> +ETH_64_POOLS;
>
> +break;
>
> +case 4:
>
> +RTE_ETH_DEV_SRIOV(dev).active =
>
> +ETH_32_POOLS;
>
> +break;
>
> +default:
>
> +return -EINVAL;
>
> +}
>
> +
>
> +RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = nb_rx_q;
>
> +RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx =
>
> +dev->pci_dev->max_vfs * nb_rx_q;
>
> +
>
> +return 0;
>
> +}
>
> +
>
> +static int
>
>rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
> nb_rx_q,
>
> uint16_t nb_tx_q,
>
>  const struct rte_eth_conf *dev_conf)
>
>{
>
> @@ -510,8 +535,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
>
> uint16_t nb_rx_q, uint16_t nb_tx_q,
>
>  if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
>
>/* check multi-queue mode */
>
> -if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_RSS) ||
>
> -(dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
>
> +if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
>
>(dev_conf->rxmode.mq_mode == 
> ETH_MQ_RX_DCB_RSS) ||
>
>(dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB)) {
>
>/* SRIOV only works in VMDq enable mode */ @@ 
> -525,7
>
> +549,6 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t
>
> nb_rx_q, uint16_t nb_tx_q,
>
>}
>
>  switch (dev_conf->rxmode.mq_mode) {
>
> -case ETH_MQ_RX_VMDQ_RSS:
>
>case ETH_MQ_RX_VMDQ_DCB:
>
>case ETH_MQ_RX_VMDQ_DCB_RSS:
>
>/* DCB/RSS VMDQ in SRIOV mode, not implement 
> yet */ @@
>
> -534,6 +557,25 @@ rte_eth_dev_check_mq_mode(uint8_t 

[dpdk-dev] [PATCH 2/2] testpmd: fix dcb in vt mode

2015-01-12 Thread Jastrzebski, MichalX K
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Michal Jastrzebski
> Sent: Monday, January 12, 2015 3:45 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 2/2] testpmd: fix dcb in vt mode
> 
> Date: Mon, 12 Jan 2015 15:39:41 +0100
> Message-Id: <1421073581-6644-3-git-send-email-
> michalx.k.jastrzebski at intel.com>
> X-Mailer: git-send-email 2.1.1
> In-Reply-To: <1421073581-6644-1-git-send-email-
> michalx.k.jastrzebski at intel.com>
> References: <1421073581-6644-1-git-send-email-
> michalx.k.jastrzebski at intel.com>
> 
> From: Pawel Wodkowski 
> 
> 
> This patch incorporate fixes to support DCB in SRIOV mode for testpmd.
> 
> It also clean up some old code that is not needed or wrong.
> 
> 
> 
> Signed-off-by: Pawel Wodkowski 
> 
> ---
> 
>  app/test-pmd/cmdline.c |4 ++--
> 
>  app/test-pmd/testpmd.c |   39 +--
> 
>  app/test-pmd/testpmd.h |   10 --
> 
>  3 files changed, 31 insertions(+), 22 deletions(-)
> 
> 
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> 
> index 882a5a2..3c60087 100644
> 
> --- a/app/test-pmd/cmdline.c
> 
> +++ b/app/test-pmd/cmdline.c
> 
> @@ -1947,9 +1947,9 @@ cmd_config_dcb_parsed(void *parsed_result,
> 
> 
> 
>   /* DCB in VT mode */
> 
>   if (!strncmp(res->vt_en, "on",2))
> 
> - dcb_conf.dcb_mode = DCB_VT_ENABLED;
> 
> + dcb_conf.vt_en = 1;
> 
>   else
> 
> - dcb_conf.dcb_mode = DCB_ENABLED;
> 
> + dcb_conf.vt_en = 0;
> 
> 
> 
>   if (!strncmp(res->pfc_en, "on",2)) {
> 
>   dcb_conf.pfc_en = 1;
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> 
> index 8c69756..6677a5e 100644
> 
> --- a/app/test-pmd/testpmd.c
> 
> +++ b/app/test-pmd/testpmd.c
> 
> @@ -1733,7 +1733,8 @@ const uint16_t vlan_tags[] = {
> 
>  };
> 
> 
> 
>  static  int
> 
> -get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config
> *dcb_conf)
> 
> +get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config
> *dcb_conf,
> 
> + uint16_t sriov)
> 
>  {
> 
>  uint8_t i;
> 
> 
> 
> @@ -1741,7 +1742,7 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf,
> struct dcb_config *dcb_conf)
> 
>* Builds up the correct configuration for dcb+vt based on the vlan tags
> array
> 
>* given above, and the number of traffic classes available for use.
> 
>*/
> 
> - if (dcb_conf->dcb_mode == DCB_VT_ENABLED) {
> 
> + if (dcb_conf->vt_en == 1) {
> 
>   struct rte_eth_vmdq_dcb_conf vmdq_rx_conf;
> 
>   struct rte_eth_vmdq_dcb_tx_conf vmdq_tx_conf;
> 
> 
> 
> @@ -1758,9 +1759,17 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf,
> struct dcb_config *dcb_conf)
> 
>   vmdq_rx_conf.pool_map[i].vlan_id = vlan_tags[ i ];
> 
>   vmdq_rx_conf.pool_map[i].pools = 1 << (i %
> vmdq_rx_conf.nb_queue_pools);
> 
>   }
> 
> - for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
> 
> - vmdq_rx_conf.dcb_queue[i] = i;
> 
> - vmdq_tx_conf.dcb_queue[i] = i;
> 
> +
> 
> + if (sriov == 0) {
> 
> + for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
> 
> + vmdq_rx_conf.dcb_queue[i] = i;
> 
> + vmdq_tx_conf.dcb_queue[i] = i;
> 
> + }
> 
> + } else {
> 
> + for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
> 
> + vmdq_rx_conf.dcb_queue[i] = i % dcb_conf-
> >num_tcs;
> 
> + vmdq_tx_conf.dcb_queue[i] = i % dcb_conf-
> >num_tcs;
> 
> + }
> 
>   }
> 
> 
> 
>   /*set DCB mode of RX and TX of multiple queues*/
> 
> @@ -1818,22 +1827,32 @@ init_port_dcb_config(portid_t pid,struct
> dcb_config *dcb_conf)
> 
>   uint16_t nb_vlan;
> 
>   uint16_t i;
> 
> 
> 
> - /* rxq and txq configuration in dcb mode */
> 
> - nb_rxq = 128;
> 
> - nb_txq = 128;
> 
>   rx_free_thresh = 64;
> 
> 
> 
> + rte_port = [pid];
> 
>   memset(_conf,0,sizeof(struct rte_eth_conf));
> 
>   /* Enter DCB configuration status */
> 
>   dcb_config = 1;
> 
> 
> 
>   nb_vlan = sizeof( vlan_tags )/sizeof( vlan_tags[ 0 ]);
> 
>   /*set configuration of DCB in vt mode and DCB in non-vt mode*/
> 
> - retval = get_eth_dcb_conf(_conf, dcb_conf);
> 
> + retval = get_eth_dcb_conf(_conf, dcb_conf, rte_port-
> >dev_info.max_vfs);
> 
> +
> 
> + /* rxq and txq configuration in dcb mode */
> 
> + nb_rxq = rte_port->dev_info.max_rx_queues;
> 
> + nb_txq = rte_port->dev_info.max_tx_queues;
> 
> +
> 
> + if (rte_port->dev_info.max_vfs) {
> 
> + if (port_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB)
> 
> + nb_rxq /=
> port_conf.rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;
> 
> +
> 
> + if 

[dpdk-dev] [PATCH 0/2] Enable DCB in SRIOV mode for ixgbe driver

2015-01-12 Thread Jastrzebski, MichalX K
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Michal Jastrzebski
> Sent: Monday, January 12, 2015 3:41 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 0/2] Enable DCB in SRIOV mode for ixgbe driver
> 
> Date: Mon, 12 Jan 2015 15:39:39 +0100
> Message-Id: <1421073581-6644-1-git-send-email-
> michalx.k.jastrzebski at intel.com>
> X-Mailer: git-send-email 2.1.1
> 
> From: Pawel Wodkowski 
> 
> 
> Hi,
> 
> this patchset enables DCB in SRIOV (ETH_MQ_RX_VMDQ_DCB and
> ETH_MQ_TX_VMDQ_DCB)
> 
> for each VF and PF for ixgbe driver.
> 
> 
> 
> As a side effect this allow to use multiple queues for TX in VF (8 if there is
> 
> 16 or less VFs or 4 if there is 32 or less VFs) when PFC is not enabled.
> 
> 
> 
> 
> 
> Pawel Wodkowski (2):
> 
>   pmd: add DCB for VF for ixgbe
> 
>   testpmd: fix dcb in vt mode
> 
> 
> 
>  app/test-pmd/cmdline.c  |4 +-
> 
>  app/test-pmd/testpmd.c  |   39 ++
> 
>  app/test-pmd/testpmd.h  |   10 
> 
>  lib/librte_ether/rte_ethdev.c   |   84 +-
> 
>  lib/librte_ether/rte_ethdev.h   |5 +-
> 
>  lib/librte_pmd_e1000/igb_pf.c   |3 +-
> 
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--
> 
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |1 +
> 
>  lib/librte_pmd_ixgbe/ixgbe_pf.c |   98 ++--
> ---
> 
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |7 ++-
> 
>  10 files changed, 190 insertions(+), 71 deletions(-)
> 
> 
> 
> --
> 
> 1.7.9.5
> 
> 
Self nacked - because of wrong message format.


[dpdk-dev] [PATCH v2 4/4] ethdev: remove old APIs and structures of ethertype filter

2015-01-12 Thread Jingjing Wu
Structure rte_ethertype_filter is removed.
Following APIs are removed:
  - rte_eth_dev_add_ethertype_filter
  - rte_eth_dev_remove_ethertype_filter
  - rte_eth_dev_get_ethertype_filter

Signed-off-by: Jingjing Wu 
---
 lib/librte_ether/rte_ethdev.c | 57 
 lib/librte_ether/rte_ethdev.h | 88 ---
 2 files changed, 145 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 95f2ceb..b55fab2 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3015,63 +3015,6 @@ rte_eth_dev_get_syn_filter(uint8_t port_id,
 }

 int
-rte_eth_dev_add_ethertype_filter(uint8_t port_id, uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t rx_queue)
-{
-   struct rte_eth_dev *dev;
-
-   if (port_id >= nb_ports) {
-   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-   return -ENODEV;
-   }
-   if (filter->ethertype == ETHER_TYPE_IPv4 ||
-   filter->ethertype == ETHER_TYPE_IPv6){
-   PMD_DEBUG_TRACE("IP and IPv6 are not supported"
-   " in ethertype filter\n");
-   return -EINVAL;
-   }
-   dev = _eth_devices[port_id];
-   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->add_ethertype_filter, -ENOTSUP);
-   return (*dev->dev_ops->add_ethertype_filter)(dev, index,
-   filter, rx_queue);
-}
-
-int
-rte_eth_dev_remove_ethertype_filter(uint8_t port_id,  uint16_t index)
-{
-   struct rte_eth_dev *dev;
-
-   if (port_id >= nb_ports) {
-   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-   return -ENODEV;
-   }
-
-   dev = _eth_devices[port_id];
-   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->remove_ethertype_filter, -ENOTSUP);
-   return (*dev->dev_ops->remove_ethertype_filter)(dev, index);
-}
-
-int
-rte_eth_dev_get_ethertype_filter(uint8_t port_id, uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t *rx_queue)
-{
-   struct rte_eth_dev *dev;
-
-   if (filter == NULL || rx_queue == NULL)
-   return -EINVAL;
-
-   if (port_id >= nb_ports) {
-   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-   return -ENODEV;
-   }
-
-   dev = _eth_devices[port_id];
-   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_ethertype_filter, -ENOTSUP);
-   return (*dev->dev_ops->get_ethertype_filter)(dev, index,
-   filter, rx_queue);
-}
-
-int
 rte_eth_dev_add_2tuple_filter(uint8_t port_id, uint16_t index,
struct rte_2tuple_filter *filter, uint16_t rx_queue)
 {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ce0528f..1200c1c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -972,15 +972,6 @@ TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
 #define TCP_FLAG_ALL 0x3F

 /**
- *  A structure used to define an ethertype filter.
- */
-struct rte_ethertype_filter {
-   uint16_t ethertype;  /**< little endian. */
-   uint8_t priority_en; /**< compare priority enable. */
-   uint8_t priority;
-};
-
-/**
  *  A structure used to define an syn filter.
  */
 struct rte_syn_filter {
@@ -1372,20 +1363,6 @@ typedef int (*eth_get_syn_filter_t)(struct rte_eth_dev 
*dev,
struct rte_syn_filter *filter, uint16_t *rx_queue);
 /**< @internal Get syn filter rule on an Ethernet device */

-typedef int (*eth_add_ethertype_filter_t)(struct rte_eth_dev *dev,
-   uint16_t index, struct rte_ethertype_filter *filter,
-   uint16_t rx_queue);
-/**< @internal Setup a new ethertype filter rule on an Ethernet device */
-
-typedef int (*eth_remove_ethertype_filter_t)(struct rte_eth_dev *dev,
-   uint16_t index);
-/**< @internal Remove an ethertype filter rule on an Ethernet device */
-
-typedef int (*eth_get_ethertype_filter_t)(struct rte_eth_dev *dev,
-   uint16_t index, struct rte_ethertype_filter *filter,
-   uint16_t *rx_queue);
-/**< @internal Get an ethertype filter rule on an Ethernet device */
-
 typedef int (*eth_add_2tuple_filter_t)(struct rte_eth_dev *dev,
uint16_t index, struct rte_2tuple_filter *filter,
uint16_t rx_queue);
@@ -1532,9 +1509,6 @@ struct eth_dev_ops {
eth_add_syn_filter_t   add_syn_filter;   /**< add syn 
filter. */
eth_remove_syn_filter_tremove_syn_filter;/**< remove syn 
filter. */
eth_get_syn_filter_t   get_syn_filter;   /**< get syn 
filter. */
-   eth_add_ethertype_filter_t add_ethertype_filter;/**< add 
ethertype filter. */
-   eth_remove_ethertype_filter_t  remove_ethertype_filter; /**< remove 
ethertype filter. */
-   

[dpdk-dev] [PATCH v2 3/4] testpmd: new commands for ethertype filter

2015-01-12 Thread Jingjing Wu
Following commands of ethertype filter are removed:
  - add_ethertype_filter (port_id) ethertype (eth_value)
  - remove_ethertype_filter (port_id) index (idx)
  - get_ethertype_filter (port_id) index (idx)
New command is added for ethertype filter by using filter_ctrl API and new
ethertype filter structure:
  - ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr)
(mac_address) ethertype (ether_type) (drop|fwd) queue (queue_id)

Signed-off-by: Jingjing Wu 
---
 app/test-pmd/cmdline.c | 253 ++---
 app/test-pmd/config.c  |  27 --
 2 files changed, 112 insertions(+), 168 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 882a5a2..f0c7d5f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -654,15 +654,10 @@ static void cmd_help_long_parsed(void *parsed_result,
"filters:\n"
"\n\n"

-   "add_ethertype_filter (port_id) ethertype (eth_value)"
-   " priority (enable|disable)(pri_value) queue (queue_id) 
index (idx)\n"
-   "add an ethertype filter.\n\n"
-
-   "remove_ethertype_filter (port_id) index (idx)\n"
-   "remove an ethertype filter.\n\n"
-
-   "get_ethertype_filter (port_id) index (idx)\n"
-   "get info of a ethertype filter.\n\n"
+   "ethertype_filter (port_id) (add|del)"
+   " (mac_addr|mac_ignr) (mac_address) ethertype"
+   " (ether_type) (drop|fwd) queue (queue_id)\n"
+   "Add/Del an ethertype filter.\n\n"

"add_2tuple_filter (port_id) protocol (pro_value) 
(pro_mask)"
" dst_port (port_value) (port_mask) flags (flg_value) 
priority (prio_value)"
@@ -7264,135 +7259,6 @@ cmdline_parse_inst_t cmd_dump_one = {
},
 };

-/* *** ADD/REMOVE an ethertype FILTER *** */
-struct cmd_ethertype_filter_result {
-   cmdline_fixed_string_t filter;
-   uint8_t port_id;
-   cmdline_fixed_string_t ethertype;
-   uint16_t ethertype_value;
-   cmdline_fixed_string_t priority;
-   cmdline_fixed_string_t priority_en;
-   uint8_t priority_value;
-   cmdline_fixed_string_t queue;
-   uint16_t queue_id;
-   cmdline_fixed_string_t index;
-   uint16_t index_value;
-};
-
-static void
-cmd_ethertype_filter_parsed(void *parsed_result,
-   __attribute__((unused)) struct cmdline *cl,
-   __attribute__((unused)) void *data)
-{
-   int ret = 0;
-   struct cmd_ethertype_filter_result *res = parsed_result;
-   struct rte_ethertype_filter filter;
-
-   memset(, 0, sizeof(struct rte_ethertype_filter));
-   filter.ethertype = rte_cpu_to_le_16(res->ethertype_value);
-   filter.priority = res->priority_value;
-
-   if (!strcmp(res->priority_en, "enable"))
-   filter.priority_en = 1;
-   if (!strcmp(res->filter, "add_ethertype_filter"))
-   ret = rte_eth_dev_add_ethertype_filter(res->port_id,
-   res->index_value,
-   , res->queue_id);
-   else if (!strcmp(res->filter, "remove_ethertype_filter"))
-   ret = rte_eth_dev_remove_ethertype_filter(res->port_id,
-   res->index_value);
-   else if (!strcmp(res->filter, "get_ethertype_filter"))
-   get_ethertype_filter(res->port_id, res->index_value);
-
-   if (ret < 0)
-   printf("ethertype filter setting error: (%s)\n",
-   strerror(-ret));
-}
-
-cmdline_parse_token_num_t cmd_ethertype_filter_port_id =
-   TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,
-   port_id, UINT8);
-cmdline_parse_token_string_t cmd_ethertype_filter_ethertype =
-   TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,
-   ethertype, "ethertype");
-cmdline_parse_token_ipaddr_t cmd_ethertype_filter_ethertype_value =
-   TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,
-   ethertype_value, UINT16);
-cmdline_parse_token_string_t cmd_ethertype_filter_priority =
-   TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,
-   priority, "priority");
-cmdline_parse_token_string_t cmd_ethertype_filter_priority_en =
-   TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,
-   priority_en, "enable#disable");
-cmdline_parse_token_num_t cmd_ethertype_filter_priority_value =
-   TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,
-   priority_value, UINT8);
-cmdline_parse_token_string_t cmd_ethertype_filter_queue =
-   TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,

[dpdk-dev] [PATCH v2 2/4] e1000: new functions replace old ones for ethertype filter

2015-01-12 Thread Jingjing Wu
This patch removes old functions which deal with ethertype filter in igb driver.
It also defines eth_igb_filter_ctrl which is binding to filter_ctrl API,
and ethertype filter can be dealt with through this new entrance.

Signed-off-by: Jingjing Wu 
---
 lib/librte_pmd_e1000/e1000_ethdev.h |  13 ++
 lib/librte_pmd_e1000/igb_ethdev.c   | 332 +++-
 2 files changed, 228 insertions(+), 117 deletions(-)

diff --git a/lib/librte_pmd_e1000/e1000_ethdev.h 
b/lib/librte_pmd_e1000/e1000_ethdev.h
index 71eb5fb..d155e77 100644
--- a/lib/librte_pmd_e1000/e1000_ethdev.h
+++ b/lib/librte_pmd_e1000/e1000_ethdev.h
@@ -132,6 +132,15 @@ struct e1000_vf_info {
 };

 /*
+ * Structure to store filters' info.
+ */
+struct e1000_filter_info {
+   uint8_t ethertype_mask; /* Bit mask for every used ethertype filter */
+   /* store used ethertype filters*/
+   uint16_t ethertype_filters[E1000_MAX_ETQF_FILTERS];
+};
+
+/*
  * Structure to store private data for each driver instance (for each port).
  */
 struct e1000_adapter {
@@ -140,6 +149,7 @@ struct e1000_adapter {
struct e1000_interrupt  intr;
struct e1000_vfta   shadow_vfta;
struct e1000_vf_info*vfdata;
+   struct e1000_filter_info filter;
 };

 #define E1000_DEV_PRIVATE_TO_HW(adapter) \
@@ -157,6 +167,9 @@ struct e1000_adapter {
 #define E1000_DEV_PRIVATE_TO_P_VFDATA(adapter) \
 (&((struct e1000_adapter *)adapter)->vfdata)

+#define E1000_DEV_PRIVATE_TO_FILTER_INFO(adapter) \
+   (&((struct e1000_adapter *)adapter)->filter)
+
 /*
  * RX/TX IGB function prototypes
  */
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c 
b/lib/librte_pmd_e1000/igb_ethdev.c
index 873d65e..81b2ca7 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -154,14 +154,6 @@ static int eth_igb_add_syn_filter(struct rte_eth_dev *dev,
 static int eth_igb_remove_syn_filter(struct rte_eth_dev *dev);
 static int eth_igb_get_syn_filter(struct rte_eth_dev *dev,
struct rte_syn_filter *filter, uint16_t *rx_queue);
-static int eth_igb_add_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t rx_queue);
-static int eth_igb_remove_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index);
-static int eth_igb_get_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t 
*rx_queue);
 static int eth_igb_add_2tuple_filter(struct rte_eth_dev *dev,
uint16_t index,
struct rte_2tuple_filter *filter, uint16_t rx_queue);
@@ -186,6 +178,18 @@ static int eth_igb_remove_5tuple_filter(struct rte_eth_dev 
*dev,
 static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev,
uint16_t index,
struct rte_5tuple_filter *filter, uint16_t *rx_queue);
+static int igb_add_del_ethertype_filter(struct rte_eth_dev *dev,
+   struct rte_eth_ethertype_filter *filter,
+   bool add);
+static int igb_ethertype_filter_handle(struct rte_eth_dev *dev,
+   enum rte_filter_op filter_op,
+   void *arg);
+static int igb_get_ethertype_filter(struct rte_eth_dev *dev,
+   struct rte_eth_ethertype_filter *filter);
+static int eth_igb_filter_ctrl(struct rte_eth_dev *dev,
+enum rte_filter_type filter_type,
+enum rte_filter_op filter_op,
+void *arg);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -264,9 +268,6 @@ static struct eth_dev_ops eth_igb_ops = {
.add_syn_filter  = eth_igb_add_syn_filter,
.remove_syn_filter   = eth_igb_remove_syn_filter,
.get_syn_filter  = eth_igb_get_syn_filter,
-   .add_ethertype_filter= eth_igb_add_ethertype_filter,
-   .remove_ethertype_filter = eth_igb_remove_ethertype_filter,
-   .get_ethertype_filter= eth_igb_get_ethertype_filter,
.add_2tuple_filter   = eth_igb_add_2tuple_filter,
.remove_2tuple_filter= eth_igb_remove_2tuple_filter,
.get_2tuple_filter   = eth_igb_get_2tuple_filter,
@@ -276,6 +277,7 @@ static struct eth_dev_ops eth_igb_ops = {
.add_5tuple_filter   = eth_igb_add_5tuple_filter,
.remove_5tuple_filter= eth_igb_remove_5tuple_filter,
.get_5tuple_filter   = eth_igb_get_5tuple_filter,
+   .filter_ctrl = eth_igb_filter_ctrl,
 };

 /*
@@ -2388,7 +2390,7 @@ eth_igb_rss_reta_query(struct rte_eth_dev *dev,
 #define MAC_TYPE_FILTER_SUP(type)do {\
if ((type) != e1000_82580 && (type) != e1000_i350 &&\
(type) != e1000_82576)\
-   return -ENOSYS;\
+   return -ENOTSUP;\
 } while (0)

 /*

[dpdk-dev] [PATCH v2 1/4] ixgbe: new functions replace old ones for ethertype filter

2015-01-12 Thread Jingjing Wu
This patch removes old functions which deal with ethertype filter in ixgbe 
driver.
It also defines ixgbe_dev_filter_ctrl which is binding to filter_ctrl API,
and ethertype filter can be dealt with through this new entrance.

Signed-off-by: Jingjing Wu 
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 354 +++-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  13 ++
 2 files changed, 239 insertions(+), 128 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 3fc3738..b58ec45 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -231,12 +231,6 @@ static int ixgbe_add_syn_filter(struct rte_eth_dev *dev,
 static int ixgbe_remove_syn_filter(struct rte_eth_dev *dev);
 static int ixgbe_get_syn_filter(struct rte_eth_dev *dev,
struct rte_syn_filter *filter, uint16_t *rx_queue);
-static int ixgbe_add_ethertype_filter(struct rte_eth_dev *dev, uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t rx_queue);
-static int ixgbe_remove_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index);
-static int ixgbe_get_ethertype_filter(struct rte_eth_dev *dev, uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t 
*rx_queue);
 static int ixgbe_add_5tuple_filter(struct rte_eth_dev *dev, uint16_t index,
struct rte_5tuple_filter *filter, uint16_t rx_queue);
 static int ixgbe_remove_5tuple_filter(struct rte_eth_dev *dev,
@@ -245,6 +239,18 @@ static int ixgbe_get_5tuple_filter(struct rte_eth_dev 
*dev, uint16_t index,
struct rte_5tuple_filter *filter, uint16_t *rx_queue);

 static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
+static int ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev,
+   struct rte_eth_ethertype_filter *filter,
+   bool add);
+static int ixgbe_ethertype_filter_handle(struct rte_eth_dev *dev,
+   enum rte_filter_op filter_op,
+   void *arg);
+static int ixgbe_get_ethertype_filter(struct rte_eth_dev *dev,
+   struct rte_eth_ethertype_filter *filter);
+static int ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev,
+enum rte_filter_type filter_type,
+enum rte_filter_op filter_op,
+void *arg);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -380,12 +386,10 @@ static struct eth_dev_ops ixgbe_eth_dev_ops = {
.add_syn_filter  = ixgbe_add_syn_filter,
.remove_syn_filter   = ixgbe_remove_syn_filter,
.get_syn_filter  = ixgbe_get_syn_filter,
-   .add_ethertype_filter= ixgbe_add_ethertype_filter,
-   .remove_ethertype_filter = ixgbe_remove_ethertype_filter,
-   .get_ethertype_filter= ixgbe_get_ethertype_filter,
.add_5tuple_filter   = ixgbe_add_5tuple_filter,
.remove_5tuple_filter= ixgbe_remove_5tuple_filter,
.get_5tuple_filter   = ixgbe_get_5tuple_filter,
+   .filter_ctrl = ixgbe_dev_filter_ctrl,
 };

 /*
@@ -3774,125 +3778,6 @@ ixgbe_get_syn_filter(struct rte_eth_dev *dev,
return -ENOENT;
 }

-/*
- * add an ethertype filter
- *
- * @param
- * dev: Pointer to struct rte_eth_dev.
- * index: the index the filter allocates.
- * filter: ponter to the filter that will be added.
- * rx_queue: the queue id the filter assigned to.
- *
- * @return
- *- On success, zero.
- *- On failure, a negative value.
- */
-static int
-ixgbe_add_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index, struct rte_ethertype_filter *filter,
-   uint16_t rx_queue)
-{
-   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-   uint32_t etqf, etqs = 0;
-
-   if (hw->mac.type != ixgbe_mac_82599EB)
-   return -ENOSYS;
-
-   if (index >= IXGBE_MAX_ETQF_FILTERS ||
-   rx_queue >= IXGBE_MAX_RX_QUEUE_NUM)
-   return -EINVAL;
-
-   etqf = IXGBE_READ_REG(hw, IXGBE_ETQF(index));
-   if (etqf & IXGBE_ETQF_FILTER_EN)
-   return -EINVAL;  /* filter index is in use. */
-
-   etqf = 0;
-   etqf |= IXGBE_ETQF_FILTER_EN;
-   etqf |= (uint32_t)filter->ethertype;
-
-   if (filter->priority_en) {
-   if (filter->priority > IXGBE_ETQF_MAX_PRI)
-   return -EINVAL;
-   etqf |= (uint32_t)((filter->priority << IXGBE_ETQF_SHIFT) & 
IXGBE_ETQF_UP);
-   etqf |= IXGBE_ETQF_UP_EN;
-   }
-   etqs |= (uint32_t)((rx_queue << IXGBE_ETQS_RX_QUEUE_SHIFT) & 
IXGBE_ETQS_RX_QUEUE);
-   etqs |= IXGBE_ETQS_QUEUE_EN;
-
-   IXGBE_WRITE_REG(hw, IXGBE_ETQF(index), etqf);
-   IXGBE_WRITE_REG(hw, IXGBE_ETQS(index), etqs);
-   return 0;
-}
-
-/*
- * remove an 

[dpdk-dev] [PATCH v2 0/4] Integrate ethertype filter in igb/ixgbe driver to new API

2015-01-12 Thread Jingjing Wu
v2 changes:
  change the return value if adding an existing filter from the filter's index 
to negative value.  

The patch set uses new filter_ctrl API to replace old ethertype filter APIs.
It uses new functions and structure to replace old ones in igb/ixgbe driver, 
new commands to replace old ones in testpmd, and removes the old APIs. 

Jingjing Wu (4):
  ixgbe: new functions replace old ones for ethertype filter
  e1000: new functions replace old ones for ethertype filter
  testpmd: new commands for ethertype filter
  ethdev: remove old APIs and structures of ethertype filter

 app/test-pmd/cmdline.c  | 253 --
 app/test-pmd/config.c   |  27 ---
 lib/librte_ether/rte_ethdev.c   |  57 --
 lib/librte_ether/rte_ethdev.h   |  88 -
 lib/librte_pmd_e1000/e1000_ethdev.h |  13 ++
 lib/librte_pmd_e1000/igb_ethdev.c   | 332 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 354 +++-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  13 ++
 8 files changed, 579 insertions(+), 558 deletions(-)

-- 
1.9.3



[dpdk-dev] daemon process problem in DPDK

2015-01-12 Thread Ni, Xun
Hello:

   I have basic questions related to dpdk and trying to find help.

   I am about to create a daemon process, is there a way for other process to 
know whether the daemon is already created? I doesn't mean to get the pid, 
because it changes every time.

   If the daemon is created, how do other process to communicate with this 
daemon? Dpdk seems to have rte ring but it only exists on the Ethernet, while I 
am talking about the process within the same computer, and the way like 
share-memory, but I didn't find examples about the share memory between 
processes.

Thanks,
Xun



[dpdk-dev] [PATCH v6 6/6] testpmd: Set Rx VMDq RSS mode

2015-01-12 Thread Ouyang Changchun
Set VMDq RSS mode if it has VF(VF number is more than 1) and has RSS 
information.

Signed-off-by: Changchun Ouyang 

changes in v6
  - Put common statement outside the if branch.

changes in v5
  - Assign txmode.mq_mode with ETH_MQ_TX_NONE explicitly;
  - Remove one line wrong comment.

---
 app/test-pmd/testpmd.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 8c69756..773b8af 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1700,7 +1700,6 @@ init_port_config(void)
port->dev_conf.rx_adv_conf.rss_conf.rss_hf = 0;
}

-   /* In SR-IOV mode, RSS mode is not available */
if (port->dcb_flag == 0 && port->dev_info.max_vfs == 0) {
if( port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
@@ -1708,6 +1707,17 @@ init_port_config(void)
port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
}

+   if (port->dev_info.max_vfs != 0) {
+   if (port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
+   port->dev_conf.rxmode.mq_mode =
+   ETH_MQ_RX_VMDQ_RSS;
+   else
+   port->dev_conf.rxmode.mq_mode =
+   ETH_MQ_RX_NONE;
+
+   port->dev_conf.txmode.mq_mode = ETH_MQ_TX_NONE;
+   }
+
port->rx_conf.rx_thresh = rx_thresh;
port->rx_conf.rx_free_thresh = rx_free_thresh;
port->rx_conf.rx_drop_en = rx_drop_en;
-- 
1.8.4.2



[dpdk-dev] [PATCH v6 5/6] ixgbe: Config VF RSS

2015-01-12 Thread Ouyang Changchun
It needs config RSS and IXGBE_MRQC and IXGBE_VFPSRTYPE to enable VF RSS.

The psrtype will determine how many queues the received packets will distribute 
to,
and the value of psrtype should depends on both facet: max VF rxq number which
has been negotiated with PF, and the number of rxq specified in config on guest.

Signed-off-by: Changchun Ouyang 

Changes in v6:
  - Raise an error for the case of ETH_16_POOLS in config vf rss, as the 
previous 
logic have changed it into: ETH_32_POOLS.

Changes in v4:
 - The number of rxq from config should be power of 2 and should not bigger than
max VF rxq number(negotiated between guest and host).

---
 lib/librte_pmd_ixgbe/ixgbe_pf.c   |  15 ++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 102 +-
 2 files changed, 105 insertions(+), 12 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c b/lib/librte_pmd_ixgbe/ixgbe_pf.c
index dbda9b5..93f6e43 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
@@ -187,6 +187,21 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(hw->mac.num_rar_entries), 0);
IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(hw->mac.num_rar_entries), 0);

+   /*
+* VF RSS can support at most 4 queues for each VF, even if
+* 8 queues are available for each VF, it need refine to 4
+* queues here due to this limitation, otherwise no queue
+* will receive any packet even RSS is enabled.
+*/
+   if (eth_dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_RSS) {
+   if (RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool == 8) {
+   RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_32_POOLS;
+   RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 4;
+   RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =
+   dev_num_vf(eth_dev) * 4;
+   }
+   }
+
/* set VMDq map to default PF pool */
hw->mac.ops.set_vmdq(hw, 0, RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index f69abda..20627df 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3327,6 +3327,67 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
 }

 static int
+ixgbe_config_vf_rss(struct rte_eth_dev *dev)
+{
+   struct ixgbe_hw *hw;
+   uint32_t mrqc;
+
+   ixgbe_rss_configure(dev);
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   /* MRQC: enable VF RSS */
+   mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC);
+   mrqc &= ~IXGBE_MRQC_MRQE_MASK;
+   switch (RTE_ETH_DEV_SRIOV(dev).active) {
+   case ETH_64_POOLS:
+   mrqc |= IXGBE_MRQC_VMDQRSS64EN;
+   break;
+
+   case ETH_32_POOLS:
+   mrqc |= IXGBE_MRQC_VMDQRSS32EN;
+   break;
+
+   default:
+   PMD_INIT_LOG(ERR, "Invalid pool number in IOV mode with VMDQ 
RSS");
+   return -EINVAL;
+   }
+
+   IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
+
+   return 0;
+}
+
+static int
+ixgbe_config_vf_default(struct rte_eth_dev *dev)
+{
+   struct ixgbe_hw *hw =
+   IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   switch (RTE_ETH_DEV_SRIOV(dev).active) {
+   case ETH_64_POOLS:
+   IXGBE_WRITE_REG(hw, IXGBE_MRQC,
+   IXGBE_MRQC_VMDQEN);
+   break;
+
+   case ETH_32_POOLS:
+   IXGBE_WRITE_REG(hw, IXGBE_MRQC,
+   IXGBE_MRQC_VMDQRT4TCEN);
+   break;
+
+   case ETH_16_POOLS:
+   IXGBE_WRITE_REG(hw, IXGBE_MRQC,
+   IXGBE_MRQC_VMDQRT8TCEN);
+   break;
+   default:
+   PMD_INIT_LOG(ERR,
+   "invalid pool number in IOV mode");
+   break;
+   }
+   return 0;
+}
+
+static int
 ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
 {
struct ixgbe_hw *hw =
@@ -3358,24 +3419,25 @@ ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
default: ixgbe_rss_disable(dev);
}
} else {
-   switch (RTE_ETH_DEV_SRIOV(dev).active) {
/*
 * SRIOV active scheme
-* FIXME if support DCB/RSS together with VMDq & SRIOV
+* Support RSS together with VMDq & SRIOV
 */
-   case ETH_64_POOLS:
-   IXGBE_WRITE_REG(hw, IXGBE_MRQC, IXGBE_MRQC_VMDQEN);
-   break;
-
-   case ETH_32_POOLS:
-   IXGBE_WRITE_REG(hw, IXGBE_MRQC, IXGBE_MRQC_VMDQRT4TCEN);
+   switch (dev->data->dev_conf.rxmode.mq_mode) {
+   case ETH_MQ_RX_RSS:
+   case ETH_MQ_RX_VMDQ_RSS:
+   ixgbe_config_vf_rss(dev);

[dpdk-dev] [PATCH v6 4/6] ether: Check VMDq RSS mode

2015-01-12 Thread Ouyang Changchun
Check mq mode for VMDq RSS, handle it correctly instead of returning an error;
Also remove the limitation of per pool queue number has max value of 1, because
the per pool queue number could be 2 or 4 if it is VMDq RSS mode;

The number of rxq specified in config will determine the mq mode for VMDq RSS.

Signed-off-by: Changchun Ouyang 

changes in v6:
  - More clear error message when queue number is invalid.

changes in v5:
  - Fix '<' issue, it should be '<=' to test rxq number;
  - Extract a function to remove the embeded switch-case statement.

---
 lib/librte_ether/rte_ethdev.c | 51 ++-
 1 file changed, 46 insertions(+), 5 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 95f2ceb..e9e3368 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -503,6 +503,31 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, 
uint16_t nb_queues)
 }

 static int
+rte_eth_dev_check_vf_rss_rxq_num(uint8_t port_id, uint16_t nb_rx_q)
+{
+   struct rte_eth_dev *dev = _eth_devices[port_id];
+   switch (nb_rx_q) {
+   case 1:
+   case 2:
+   RTE_ETH_DEV_SRIOV(dev).active =
+   ETH_64_POOLS;
+   break;
+   case 4:
+   RTE_ETH_DEV_SRIOV(dev).active =
+   ETH_32_POOLS;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = nb_rx_q;
+   RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx =
+   dev->pci_dev->max_vfs * nb_rx_q;
+
+   return 0;
+}
+
+static int
 rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
  const struct rte_eth_conf *dev_conf)
 {
@@ -510,8 +535,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,

if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
/* check multi-queue mode */
-   if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_RSS) ||
-   (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
+   if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
(dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB_RSS) ||
(dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB)) {
/* SRIOV only works in VMDq enable mode */
@@ -525,7 +549,6 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,
}

switch (dev_conf->rxmode.mq_mode) {
-   case ETH_MQ_RX_VMDQ_RSS:
case ETH_MQ_RX_VMDQ_DCB:
case ETH_MQ_RX_VMDQ_DCB_RSS:
/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
@@ -534,6 +557,26 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,
"unsupported VMDQ mq_mode rx %u\n",
port_id, dev_conf->rxmode.mq_mode);
return (-EINVAL);
+   case ETH_MQ_RX_RSS:
+   PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
+   " SRIOV active, "
+   "Rx mq mode is changed from:"
+   "mq_mode %u into VMDQ mq_mode %u\n",
+   port_id,
+   dev_conf->rxmode.mq_mode,
+   dev->data->dev_conf.rxmode.mq_mode);
+   case ETH_MQ_RX_VMDQ_RSS:
+   dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_RSS;
+   if (nb_rx_q <= RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)
+   if (rte_eth_dev_check_vf_rss_rxq_num(port_id, 
nb_rx_q) != 0) {
+   PMD_DEBUG_TRACE("ethdev port_id=%d"
+   " SRIOV active, invalid queue"
+   " number for VMDQ RSS, allowed"
+   " value are 1, 2 or 4\n",
+   port_id);
+   return -EINVAL;
+   }
+   break;
default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */
/* if nothing mq mode configure, use default scheme */
dev->data->dev_conf.rxmode.mq_mode = 
ETH_MQ_RX_VMDQ_ONLY;
@@ -553,8 +596,6 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,
default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
/* if nothing mq mode configure, use default scheme */
dev->data->dev_conf.txmode.mq_mode = 
ETH_MQ_TX_VMDQ_ONLY;
-   if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
-

[dpdk-dev] [PATCH v6 3/6] ixgbe: Get VF queue number

2015-01-12 Thread Ouyang Changchun
Get the available Rx and Tx queue number when receiving IXGBE_VF_GET_QUEUES 
message from VF.

Signed-off-by: Changchun Ouyang 

changes in v5
  - Add some 'FIX ME' comments for IXGBE_VF_TRANS_VLAN.

---
 lib/librte_pmd_ixgbe/ixgbe_pf.c | 40 +++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c b/lib/librte_pmd_ixgbe/ixgbe_pf.c
index 495aff5..dbda9b5 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
@@ -53,6 +53,8 @@
 #include "ixgbe_ethdev.h"

 #define IXGBE_MAX_VFTA (128)
+#define IXGBE_VF_MSG_SIZE_DEFAULT 1
+#define IXGBE_VF_GET_QUEUE_MSG_SIZE 5

 static inline uint16_t
 dev_num_vf(struct rte_eth_dev *eth_dev)
@@ -491,9 +493,41 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t 
vf, uint32_t *msgbuf)
 }

 static int
+ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
+{
+   struct ixgbe_vf_info *vfinfo =
+   *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+   uint32_t default_q = vf * RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+
+   /* Verify if the PF supports the mbox APIs version or not */
+   switch (vfinfo[vf].api_version) {
+   case ixgbe_mbox_api_20:
+   case ixgbe_mbox_api_11:
+   break;
+   default:
+   return -1;
+   }
+
+   /* Notify VF of Rx and Tx queue number */
+   msgbuf[IXGBE_VF_RX_QUEUES] = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+   msgbuf[IXGBE_VF_TX_QUEUES] = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+
+   /* Notify VF of default queue */
+   msgbuf[IXGBE_VF_DEF_QUEUE] = default_q;
+
+   /*
+* FIX ME if it needs fill msgbuf[IXGBE_VF_TRANS_VLAN]
+* for VLAN strip or VMDQ_DCB or VMDQ_DCB_RSS
+*/
+
+   return 0;
+}
+
+static int
 ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 {
uint16_t mbx_size = IXGBE_VFMAILBOX_SIZE;
+   uint16_t msg_size = IXGBE_VF_MSG_SIZE_DEFAULT;
uint32_t msgbuf[IXGBE_VFMAILBOX_SIZE];
int32_t retval;
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -537,6 +571,10 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
case IXGBE_VF_API_NEGOTIATE:
retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
break;
+   case IXGBE_VF_GET_QUEUES:
+   retval = ixgbe_get_vf_queues(dev, vf, msgbuf);
+   msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
+   break;
default:
PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
retval = IXGBE_ERR_MBX;
@@ -551,7 +589,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)

msgbuf[0] |= IXGBE_VT_MSGTYPE_CTS;

-   ixgbe_write_mbx(hw, msgbuf, 1, vf);
+   ixgbe_write_mbx(hw, msgbuf, msg_size, vf);

return retval;
 }
-- 
1.8.4.2



[dpdk-dev] [PATCH v6 2/6] ixgbe: Negotiate VF API version

2015-01-12 Thread Ouyang Changchun
Negotiate API version with VF when receiving the IXGBE_VF_API_NEGOTIATE message.

Signed-off-by: Changchun Ouyang 
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  1 +
 lib/librte_pmd_ixgbe/ixgbe_pf.c | 25 +
 2 files changed, 26 insertions(+)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index ca99170..730098d 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -159,6 +159,7 @@ struct ixgbe_vf_info {
uint16_t tx_rate[IXGBE_MAX_QUEUE_NUM_PER_VF];
uint16_t vlan_count;
uint8_t spoofchk_enabled;
+   uint8_t api_version;
 };

 /*
diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c b/lib/librte_pmd_ixgbe/ixgbe_pf.c
index 51da1fd..495aff5 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
@@ -469,6 +469,28 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused 
uint32_t vf, uint32_t *ms
 }

 static int
+ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
+{
+   uint32_t api_version = msgbuf[1];
+   struct ixgbe_vf_info *vfinfo =
+   *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+
+   switch (api_version) {
+   case ixgbe_mbox_api_10:
+   case ixgbe_mbox_api_11:
+   vfinfo[vf].api_version = (uint8_t)api_version;
+   return 0;
+   default:
+   break;
+   }
+
+   RTE_LOG(ERR, PMD, "Negotiate invalid api version %u from VF %d\n",
+   api_version, vf);
+
+   return -1;
+}
+
+static int
 ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 {
uint16_t mbx_size = IXGBE_VFMAILBOX_SIZE;
@@ -512,6 +534,9 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
case IXGBE_VF_SET_VLAN:
retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
break;
+   case IXGBE_VF_API_NEGOTIATE:
+   retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
+   break;
default:
PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
retval = IXGBE_ERR_MBX;
-- 
1.8.4.2



[dpdk-dev] [PATCH v6 1/6] ixgbe: Code cleanup

2015-01-12 Thread Ouyang Changchun
Put global register configuring out of loop for queue; also fix typo and indent.

Signed-off-by: Changchun Ouyang 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 5c36bff..f69abda 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3548,9 +3548,9 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
IXGBE_WRITE_REG(hw, 
IXGBE_PSRTYPE(rxq->reg_idx), psrtype);
}
srrctl = ((dev->data->dev_conf.rxmode.split_hdr_size <<
-  IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
- IXGBE_SRRCTL_BSIZEHDR_MASK);
-   srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
+   IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
+   IXGBE_SRRCTL_BSIZEHDR_MASK);
+   srrctl |= IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
} else
 #endif
srrctl = IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
@@ -3985,7 +3985,7 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
struct igb_rx_queue *rxq;
struct rte_pktmbuf_pool_private *mbp_priv;
uint64_t bus_addr;
-   uint32_t srrctl;
+   uint32_t srrctl, psrtype = 0;
uint16_t buf_size;
uint16_t i;
int ret;
@@ -4039,20 +4039,10 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
 * Configure Header Split
 */
if (dev->data->dev_conf.rxmode.header_split) {
-
-   /* Must setup the PSRTYPE register */
-   uint32_t psrtype;
-   psrtype = IXGBE_PSRTYPE_TCPHDR |
-   IXGBE_PSRTYPE_UDPHDR   |
-   IXGBE_PSRTYPE_IPV4HDR  |
-   IXGBE_PSRTYPE_IPV6HDR;
-
-   IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE(i), psrtype);
-
srrctl = ((dev->data->dev_conf.rxmode.split_hdr_size <<
-  IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
- IXGBE_SRRCTL_BSIZEHDR_MASK);
-   srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
+   IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
+   IXGBE_SRRCTL_BSIZEHDR_MASK);
+   srrctl |= IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
} else
 #endif
srrctl = IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
@@ -4095,6 +4085,17 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
}
}

+#ifdef RTE_HEADER_SPLIT_ENABLE
+   if (dev->data->dev_conf.rxmode.header_split)
+   /* Must setup the PSRTYPE register */
+   psrtype = IXGBE_PSRTYPE_TCPHDR |
+   IXGBE_PSRTYPE_UDPHDR   |
+   IXGBE_PSRTYPE_IPV4HDR  |
+   IXGBE_PSRTYPE_IPV6HDR;
+#endif
+
+   IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, psrtype);
+
if (dev->data->dev_conf.rxmode.enable_scatter) {
if (!dev->data->scattered_rx)
PMD_INIT_LOG(DEBUG, "forcing scatter mode");
-- 
1.8.4.2



[dpdk-dev] [PATCH v6 0/6] Enable VF RSS for Niantic

2015-01-12 Thread Ouyang Changchun
This patch enables VF RSS for Niantic, which allow each VF having at most 4 
queues.
The actual queue number per VF depends on the total number of pool, which is
determined by the max number of VF at PF initialization stage and the number of
queue specified in config:
1) If the max number of VF is in the range from 1 to 32, and the number of rxq 
is 4
('--rxq 4' in testpmd), then there is totally 32 pools(ETH_32_POOLS), and each 
VF
have 4 queues;

2)If the max number of VF is in the range from 33 to 64, and the number of rxq 
is 2
('--rxq 2' in testpmd), then there is totally 64 pools(ETH_64_POOLS), and each 
VF
have 2 queues;

On host, to enable VF RSS functionality, rx mq mode should be set as 
ETH_MQ_RX_VMDQ_RSS
or ETH_MQ_RX_RSS mode, and SRIOV mode should be activated(max_vfs >= 1).
It also needs config VF RSS information like hash function, RSS key, RSS key 
length.

The limitation for Niantic VF RSS is:
the hash and key are shared among PF and all VF, the RETA table with 128 
entries are
also shared among PF and all VF. So it could not to provide a method to query 
the hash
and reta content per VF on guest, while, if possible, please query them on 
host(PF) for
the shared RETA information.

changes in v6:
  - refine codes and update message according to comments;

changes in v5:
  - Fix minor issue and some comments;

changes in v4:
  - Extract a function to remove embeded switch-case statement;
  - Check whether RX queue number is a valid one, otherwise return error;
  - Update the description a bit;

changes in v3:
  - More cleanup;

changes in v2:
  - Update the description;
  - Use receiving queue number('--rxq ') specified in config to 
determine the
number of pool and the number of queue per VF;

changes in v1:
  - Config VF RSS;

Changchun Ouyang (6):
  ixgbe: Code cleanup
  ixgbe: Negotiate VF API version
  ixgbe: Get VF queue number
  ether: Check VMDq RSS mode
  ixgbe: Config VF RSS
  testpmd: Set Rx VMDq RSS mode

 app/test-pmd/testpmd.c  |  12 +++-
 lib/librte_ether/rte_ethdev.c   |  51 --
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   1 +
 lib/librte_pmd_ixgbe/ixgbe_pf.c |  80 -
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 137 
 5 files changed, 245 insertions(+), 36 deletions(-)

-- 
1.8.4.2



[dpdk-dev] [PATCH RFC 00/13] Update build system

2015-01-12 Thread Neil Horman
On Mon, Jan 12, 2015 at 05:21:48PM +, Gonzalez Monroy, Sergio wrote:
> Hi Thomas,
> 
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > Sent: Monday, January 12, 2015 4:52 PM
> > 
> > Hi Sergio,
> > 
> > 2015-01-12 16:33, Sergio Gonzalez Monroy:
> > > This patch series updates the DPDK build system.
> > 
> > Thanks for proposing such rework.
> > We need discussions on that topic. So I ask some questions below.
> > 
> > > Following are the goals it tries to accomplish:
> > >  - Create a library containing core DPDK libraries (librte_eal,
> > >librte_malloc, librte_mempool, librte_mbuf and librte_ring).
> > >The idea of core libraries is to group those libraries that are
> > >always required for any DPDK application.
> > 
> > How is it better? Is it only to reduce dependencies lines?
> >
> In my opinion I think that there are a set of libraries that are always 
> required
> and therefore should be grouped as a single one.
> Basically all apps and other DPDK libs would have dependencies to these core 
> libraries.
> 
> Aside from that, I don't think there is any difference. Note that this 
> affects shared libraries,
> with no difference for apps linked against static libs. 
> 
> > >  - Remove config option to build a combined library.
> > 
> > Why removing combined library? Is there people finding it helpful?
> > 
> I don't think it makes sense from a shared library point of view, maybe it 
> does for static?
> For example, in the case of shared libraries I think we want to try to avoid 
> the case where
> we have an app linked against librte_dpdk.so, but such library may contain 
> different libraries
> depending on the options that were enabled when the lib was built.
> 
> The core libraries would be that set of libraries that are always required 
> for an app, and its content
> would be fixed regardless of the option libraries (like acl, hash, 
> distributor, etc.)
> We could add more libraries as core if we think it is a better solution, but 
> the goal should be that
> librte_core.so contains the same libraries/API regardless of the system/arch.
> 

FWIW, I think Sergios approach is likely a good balance.  As he notes, mempool,
eal, malloc and mbuf are needed for any dpdk application, and have
interdepedencies, so it makes sense to link them as a single library.
Everything else is optional.  For static libraries, you can just add a few extra
lines to the linker, but for DSO's you might want the option of not linking
against a PMD, option to dynamically load it via the dlopen interface (using the
-d option).  Theres not much sense in adding those PMD DSO's to a single library
just to save a few lines in the makefile there.  This approach strikes a good
balance, combining items that will have to be linked together anyway, and
leaving everying else separate.
Neil



[dpdk-dev] [PATCH v3 0/3] enhance TX checksum command and csum forwarding engine

2015-01-12 Thread Olivier MATZ
Hi Jijiang,

Please find some comments below.

On 01/12/2015 04:41 AM, Liu, Jijiang wrote:
> There are some examples for the different packet types:
> 
> 1. For L2 Packet types:
> MAC, ARP
> MAC, PAY2
> ...
> They are forwarded without beeing modified no matter if these above commands 
> are set.

ok

>  2. For Non Tunneled IPv4/6 packet
> MAC, IPV4, UDP, PAY4
> MAC, IPV6, UDP, PAY4
> ...
> Ipv4:
> tx_checksum set  ip   hw
> tx_checksum set  udp   hw
> 
> IPv6:
> tx_checksum set  udp   hw
> 
> They are forwarded with TX checksum offload if these above commands are set.

Two questions here:

- today, we also have the "sw" argument that allows to calculate the
  checksum in software. Do you plan to keep this behavior?

- today, the csumonly forward engine modifies the IP addresses to
  validate that it is able to recalculate the checksum. Do you plan
  to keep this behavior? I'm not opposed to remove it if it makes
  the code more complex.

> 3. For Tunneled IPv4/6 packet
> 
> See the above test cases:
> Test case A
> test case B.1
> test case B.2
> test case C
> 
> They are forwarded with TX checksum offload if these above commands are set.
> 
>> I think that the test-pmd command API should define a behavior for the csum
>> forward engine for any packet. What do you think?
> 
> Agree.
> 
> Let me explain the checksum offload behavior of different packet type below,
> 
> 1. For L2 Packet types:
> Checksum offload behavior definition:
> tx_checksum set sw-tunnel-mode on :   NONE
> tx_checksum set hw-tunnel-mode on:   NONE
> tx_checksum set  outer-ip|ip|tcp|udp|sctp   hw: NONE
> 
> 2. For Non Tunneled IPv4/6 packet
> 
> Checksum offload behavior definition:
> 
> tx_checksum set sw-tunnel-mode on :NONE
> tx_checksum set hw-tunnel-mode on: NONE  
> tx_checksum set  outer-ip|ip|tcp|udp|sctp   hw: ip|tcp|udp|sctp options   
> are VALID
> 
> 3. For Tunneled IPv4/6 packet
> Checksum offload behavior definition:
> 
> tx_checksum set sw-tunnel-mode on :VALID
> tx_checksum set hw-tunnel-mode on: VALID 
> tx_checksum set  outer-ip|ip|tcp|udp|sctp   hw: VALID
> 
> It is very welcome if you have better solution that is able to cover all the 
> case in the http://dpdk.org/ml/archives/dev/2014-December/009213.html  and 
> all packet types in csum fwd engine.

Thank you for your efforts to explain your proposition. I still have
some difficulties to understand the naming "sw-tunnel" and "hw-tunnel".
>From the user point of view "sw" means "software" and "hw" means
"hardware". I think it's difficult to understand how both can be on
at the same time. Maybe it's just a naming problem?

Also, is it still possible to compute the checksum in software?

And will it be possible to support future hardware that will be able
to compute both outer l3, outer l4, l3 and l4 checksums?


I have another idea, please let me know if you find it clearer or not.
The commands format would be:

tx_checksum  ...

List of commands:

# select behavior for non tunnel packets
tx_checksum ip-udp l3 off|sw|hw l4 off|sw|hw
tx_checksum ip-tcp l3 off|sw|hw l4 off|sw|hw
tx_checksum ip-sctp l3 off|sw|hw l4 off|sw|hw
tx_checksum ip-other l3 off|sw|hw

# select behavior for vxlan packets
tx_checksum vxlan outer-l3 off|sw|hw outer-l4 off|sw|hw
tx_checksum vxlan-ip-udp l3 off|sw|hw l4 off|sw|hw
tx_checksum vxlan-ip-tcp l3 off|sw|hw l4 off|sw|hw
tx_checksum vxlan-ip-sctp l3 off|sw|hw l4 off|sw|hw
tx_checksum vxlan-ip-other l3 off|sw|hw

Examples:

1. calculate l3 and l4 checksum of ip/udp packets in hw, and ip/tcp
   packets in sw. Do nothing for the other packet types

# assume all is off by default
tx_checksum ip-udp l3 hw l4 hw
tx_checksum ip-tcp l3 sw l4 sw

2. calculate outer checksums of tunnel packets (your case A.)

# assume all is off by default
tx_checksum vxlan outer-l3 hw outer-l4 hw

3. calculate inner checksums of tunnel packets (your case B.1)

# assume all is off by default
tx_checksum vxlan-ip-udp l3 hw l4 hw
tx_checksum vxlan-ip-tcp l3 hw l4 hw
tx_checksum vxlan-ip-sctp l3 hw l4 hw

4. calculate all checksums of tunnel packets (your case C)

# assume all is off by default
tx_checksum vxlan outer-l3 hw outer-l4 hw
tx_checksum vxlan-ip-udp l3 hw l4 hw
tx_checksum vxlan-ip-tcp l3 hw l4 hw
tx_checksum vxlan-ip-sctp l3 hw l4 hw


Advantages:

- clearer from use point of view: the user knows what is done for
  each packet type

- software checksum is supported for comparison with hw

- the syntax already supports future hw that can do outer l3, outer l4,
  l3 and l4 at the same time.

- we can add future tunnel packets in the same model:

  tx_checksum gre outer-l3 off|sw|hw
  tx_checksum gre-ip-udp l3 off|sw|hw l4 off|sw|hw

Cons:

- with the definition above, we cannot do B.2. But if we really want
  it, we could change the commands:

  tx_checksum xxx l3 off|sw|hw|outer-hw l4 off|sw|hw|outer-hw

  "outer-hw" means: use the outer mbuf flags to 

[dpdk-dev] What is the best way to distribute a DPDK-based app?

2015-01-12 Thread Bruce Richardson
On Sun, Jan 11, 2015 at 07:10:30PM +0200, Vlad Zolotarov wrote:
> Hi,
> guys could you share form your experience what is the best way to distribute
> the DPDK libraries with the DPDK-based app:
> 
>  * Is there any significant benefit in compiling the libraries on a
>target machine?
>  * Is there an already existing DPDK-libs packaging: I've noticed there
>is some Fedora RPM package with DPDK libs but it's lacking
>pmd-driver's libs and they are the main component we are using,
>therefore we can't use it.
> 
> Thanks in advance,
> vlad
> 
The default in DPDK is to build a statically linked binary, in which case no
separate distribution of libraries is necessary. This also gives best 
performance.

If you know ahead of time what the minimum cpu hardware of your target is, it's
probably worthwhile doing a compile of your app/libs for that minimum hardware,
especially if you care about getting best performance. If a few percent drop in
performance is not a big issue, then compiling up for the "default" target is
the safest path to take.
For distributing the libs as shared libs, the same logic applies.

/Bruce


[dpdk-dev] KNI interface operational state UP issue

2015-01-12 Thread Bruce Richardson
On Fri, Jan 09, 2015 at 05:20:26PM -0800, Aziz Hajee wrote:
> I am using the dpdk1.6.0r1
> The rte_kni.lo is loaded:
> lsmod | grep kni
> rte_kni   279134  1
> 
> however, the ifconfig vEth0, and vEth1 does not show link up ?
> How do i get the operational state up for these interfaces.
> $ sudo tcpdump -i vEth0
> tcpdump: vEth0: That device is not up
> 
> ifconfig vEth0
> vEth0 Link encap:Ethernet  HWaddr 00:00:00:00:00:00
>   BROADCAST MULTICAST  MTU:1500  Metric:1
>   RX packets:12 errors:0 dropped:0 overruns:0 frame:0
>   TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>   collisions:0 txqueuelen:1000
>   RX bytes:3388 (3.3 KB)  TX bytes:0 (0.0 B)
> 
>  ifconfig vEth1
> vEth1 Link encap:Ethernet  HWaddr 00:00:00:00:00:00
>   BROADCAST MULTICAST  MTU:1500  Metric:1
>   RX packets:60 errors:0 dropped:0 overruns:0 frame:0
>   TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>   collisions:0 txqueuelen:1000
>   RX bytes:10252 (10.2 KB)  TX bytes:0 (0.0 B)
> 
> These KNI interfaces are created as per dmeg below from the CREATE IOCTL.
> sudo ifconfig vEth0 192.168.0.11 netmask 255.255.0.0
> SIOCSIFFLAGS: Timer expired
> aziz at 
> fast-1:~/stm15-0108/stm/dpdk/dpdk-1.6.0r1_ss/lib/librte_eal/linuxapp/kni$
> ifconfig vEth0
> vEth0 Link encap:Ethernet  HWaddr 90:e2:ba:5f:1a:64
>   inet addr:192.168.0.11  Bcast:192.168.255.255  Mask:255.255.0.0
>   BROADCAST MULTICAST  MTU:1500  Metric:1
>   RX packets:50 errors:0 dropped:0 overruns:0 frame:0
>   TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>   collisions:0 txqueuelen:1000
>   RX bytes:14488 (14.4 KB)  TX bytes:0 (0.0 B)
> 
> Trying to set the vEth0 up, looks like it is doing the callback in the dpdk
> to the corresponding PMD NIC interface, and not the vEth0 kernel interface.
> 
With KNI, the actual underlying NIC interface is still under the control of the
DPDK application. What happens is that any ethtool requests that go to the 
kernel
driver, get passed into the userspace DPDK application to make the actual 
changes
to the hardware port. Does DPDK itself report the port as being up?

/Bruce


[dpdk-dev] Cross-compilation of bsdapp on Ubuntu

2015-01-12 Thread Bruce Richardson
On Fri, Jan 09, 2015 at 09:14:16AM -0800, Ravi Kerur wrote:
> Hi,
> 
> Has anyone successfully cross compiled bsdapp on Ubuntu or other linux
> flavor? From the Linux documentation I see
> 
> "To compile all 64-bit targets using gcc, use:
> 
> make install T=x86_64*gcc"
> 
> which makes me believe that bsdapp can be cross-compiled.

Actually, I think it's just that that bit got missed in the documentation update
when we added bsd support. :-)
I'm not aware of anyone who has successfully built a bsdapp dpdk application on
linux or vice-version.

/Bruce

> 
> I am trying to understand what GNU libraries and other toolchain
> related installation has to be done on Linux in order to get bsd
> successfully compiled.  Inputs appreciated.
> 
> Thanks,
> 
> Ravi


[dpdk-dev] daemon process problem in DPDK

2015-01-12 Thread Stephen Hemminger
On Mon, 12 Jan 2015 09:52:10 -0500
Neil Horman  wrote:

> On Mon, Jan 12, 2015 at 02:28:20PM +, Ni, Xun wrote:
> > Hello:
> > 
> >I have basic questions related to dpdk and trying to find help.
> > 
> >I am about to create a daemon process, is there a way for other process 
> > to know whether the daemon is already created? I doesn't mean to get the 
> > pid, because it changes every time.
> > 
> >If the daemon is created, how do other process to communicate with this 
> > daemon? Dpdk seems to have rte ring but it only exists on the Ethernet, 
> > while I am talking about the process within the same computer, and the way 
> > like share-memory, but I didn't find examples about the share memory 
> > between processes.
> > 
> > Thanks,
> > Xun
> > 
> > 
> 
> Thats not really a dpdk question, that a generic programming question.  You 
> can
> do this lots of ways.  Open a socket that other process can connect to on an
> agreed port, create a shared memory segment, write a file with connect
> information to a well know location, etc.
> Neil
> 

We did have to make some changes to the basic application model (not in DPDK)
to allow for a daemon.

The normal/correct way to make a daemon is to use the daemon glibc call,
and this closes all file descriptors etc. Therefore the DPDK (eal)
must be initialized after the daemon call.

Also, wanted to make daemon optional for debugging.
This led to change where the main program process application argv first
then passes DPDK args as second group. This is the inverse of the example
applications.


int
main(int argc, char **argv)
{
int ret;
char *progname;

progname = strrchr(argv[0], '/');
progname = strdup(progname ? progname + 1 : argv[0]);

ret = parse_args(argc, argv);
if (ret < 0)
return -1;

argc -= ret;
argv += ret;

if (daemon_mode && daemon(1, 1) < 0)
return -1;

/* workaround fact that EAL expects progname as first argument */
argv[0] = progname;

ret = rte_eal_init(argc, argv);
if (ret < 0)
return -1;


[dpdk-dev] daemon process problem in DPDK

2015-01-12 Thread Neil Horman
On Mon, Jan 12, 2015 at 02:28:20PM +, Ni, Xun wrote:
> Hello:
> 
>I have basic questions related to dpdk and trying to find help.
> 
>I am about to create a daemon process, is there a way for other process to 
> know whether the daemon is already created? I doesn't mean to get the pid, 
> because it changes every time.
> 
>If the daemon is created, how do other process to communicate with this 
> daemon? Dpdk seems to have rte ring but it only exists on the Ethernet, while 
> I am talking about the process within the same computer, and the way like 
> share-memory, but I didn't find examples about the share memory between 
> processes.
> 
> Thanks,
> Xun
> 
> 

Thats not really a dpdk question, that a generic programming question.  You can
do this lots of ways.  Open a socket that other process can connect to on an
agreed port, create a shared memory segment, write a file with connect
information to a well know location, etc.
Neil



[dpdk-dev] What is the best way to distribute a DPDK-based app?

2015-01-12 Thread Neil Horman
On Mon, Jan 12, 2015 at 11:30:26AM +, Bruce Richardson wrote:
> On Sun, Jan 11, 2015 at 07:10:30PM +0200, Vlad Zolotarov wrote:
> > Hi,
> > guys could you share form your experience what is the best way to distribute
> > the DPDK libraries with the DPDK-based app:
> > 
> >  * Is there any significant benefit in compiling the libraries on a
> >target machine?
> >  * Is there an already existing DPDK-libs packaging: I've noticed there
> >is some Fedora RPM package with DPDK libs but it's lacking
> >pmd-driver's libs and they are the main component we are using,
> >therefore we can't use it.
> > 
> > Thanks in advance,
> > vlad
> > 
> The default in DPDK is to build a statically linked binary, in which case no
> separate distribution of libraries is necessary. This also gives best 
> performance.
> 
That wasn't the question though.  the question was "what is the best way to
distribute dpdk libraries".  The answer is, it depends on a number of factors,
including, but not limited to what distribution your are distributing for and
what your intended audience is.  

As you note, Fedora distributes dpdk 1.7 using DSO's.  We do this because Fedora
strongly tries to avoid shipping static libraries so as to prevent security
issues living on in applications that link to libraries (i.e. a dpdk security
fix will update all applications if they use DSO's.

You've also noted that the Fedora DPDK doesn't include PMD's for several bits of
hardware.  This is done because those PMD's require out of tree kernel modules,
which Fedora prohibits.  So we currently only ship virtual pmd's.  That will
change soon though we hope, when some high speed socket API changes get made to
the kernel.

> If you know ahead of time what the minimum cpu hardware of your target is, 
> it's
> probably worthwhile doing a compile of your app/libs for that minimum 
> hardware,
> especially if you care about getting best performance. If a few percent drop 
> in
> performance is not a big issue, then compiling up for the "default" target is
> the safest path to take.
> For distributing the libs as shared libs, the same logic applies.
> 
> /Bruce
> 


[dpdk-dev] Cross-compilation of bsdapp on Ubuntu

2015-01-12 Thread Neil Horman
On Mon, Jan 12, 2015 at 11:21:32AM +, Bruce Richardson wrote:
> On Fri, Jan 09, 2015 at 09:14:16AM -0800, Ravi Kerur wrote:
> > Hi,
> > 
> > Has anyone successfully cross compiled bsdapp on Ubuntu or other linux
> > flavor? From the Linux documentation I see
> > 
> > "To compile all 64-bit targets using gcc, use:
> > 
> > make install T=x86_64*gcc"
> > 
> > which makes me believe that bsdapp can be cross-compiled.
> 
> Actually, I think it's just that that bit got missed in the documentation 
> update
> when we added bsd support. :-)
> I'm not aware of anyone who has successfully built a bsdapp dpdk application 
> on
> linux or vice-version.
> 
You're not going to be able to cross compile bsd on a linux system or vice versa
unless you install system level compat libs to handle all the OS-specific
library calls.  Those exist, but its usually not worth the effort to do so.
Just as easy/easier to install a virt guest with the appropriate operating
system.

Neil

> /Bruce
> 
> > 
> > I am trying to understand what GNU libraries and other toolchain
> > related installation has to be done on Linux in order to get bsd
> > successfully compiled.  Inputs appreciated.
> > 
> > Thanks,
> > 
> > Ravi
> 


[dpdk-dev] [PATCH v2] i40e: workaround for XL710 performance

2015-01-12 Thread Zhang, Helin
Thank you, Jingjing!

Regards,
Helin

> -Original Message-
> From: Wu, Jingjing
> Sent: Monday, January 12, 2015 3:34 PM
> To: Zhang, Helin; dev at dpdk.org
> Cc: nhorman at tuxdriver.com; Xu, Qian Q; Cao, Waterman; Lu, Patrick; Liu,
> Jijiang
> Subject: RE: [PATCH v2] i40e: workaround for XL710 performance
> 
> 
> 
> > -Original Message-
> > From: Zhang, Helin
> > Sent: Monday, December 29, 2014 9:41 AM
> > To: dev at dpdk.org
> > Cc: nhorman at tuxdriver.com; Xu, Qian Q; Cao, Waterman; Lu, Patrick;
> > Liu, Jijiang; Wu, Jingjing; Zhang, Helin
> > Subject: [PATCH v2] i40e: workaround for XL710 performance
> >
> > On XL710, performance number is far from the expectation on recent
> > firmware versions, if promiscuous mode is disabled, or promiscuous
> > mode is enabled and port MAC address is equal to the packet
> > destination MAC address. The fix for this issue may not be integrated
> > in the following firmware version. So the workaround in software
> > driver is needed. For XL710, it needs to modify the initial values of
> > 3 internal only registers, which are the same as X710.
> > Note that the values for X710 and XL710 registers could be different,
> > and the workaround can be removed when it is fixed in firmware in the 
> > future.
> >
> > Signed-off-by: Helin Zhang 
> > ---
> >  lib/librte_pmd_i40e/i40e_ethdev.c | 44 ++---
> > --
> >  1 file changed, 30 insertions(+), 14 deletions(-)
> >
> > v2 changes:
> > * Supported modifying the address of 0x269FBC of XL710 during
> >   initialization, to fix the minor performance gap to expectation.
> >   That means XL710 can meet the performance expectation with this
> >   workaround.
> >
> > diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> > b/lib/librte_pmd_i40e/i40e_ethdev.c
> > index b47a3d2..8982920 100644
> > --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> > +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> > @@ -5327,38 +5327,54 @@ i40e_debug_read_register(struct i40e_hw *hw,
> > uint32_t addr, uint64_t *val)
> >
> >  /*
> >   * On X710, performance number is far from the expectation on recent
> > firmware
> > - * versions. The fix for this issue may not be integrated in the
> > following
> > + * versions; on XL710, performance number is also far from the
> > + expectation on
> > + * recent firmware versions, if promiscuous mode is disabled, or
> > + promiscuous
> > + * mode is enabled and port MAC address is equal to the packet
> > + destination MAC
> > + * address. The fix for this issue may not be integrated in the
> > + following
> >   * firmware version. So the workaround in software driver is needed.
> > It needs
> > - * to modify the initial values of 3 internal only registers. Note
> > that the
> > + * to modify the initial values of 3 internal only registers for both
> > + X710 and
> > + * XL710. Note that the values for X710 or XL710 could be different,
> > + and the
> >   * workaround can be removed when it is fixed in firmware in the future.
> >   */
> > -static void
> > -i40e_configure_registers(struct i40e_hw *hw) -{
> > +
> > +/* For both X710 and XL710 */
> > +#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x1200
> >  #define I40E_GL_SWR_PRI_JOIN_MAP_0   0x26CE00
> > +
> > +#define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
> >  #define I40E_GL_SWR_PRI_JOIN_MAP_2   0x26CE08
> > +
> > +/* For X710 */
> > +#define I40E_GL_SWR_PM_UP_THR_EF_VALUE   0x03030303
> > +/* For XL710 */
> > +#define I40E_GL_SWR_PM_UP_THR_SF_VALUE   0x06060606
> >  #define I40E_GL_SWR_PM_UP_THR0x269FBC
> > -#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x1200 -#define
> > I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
> > -#define I40E_GL_SWR_PM_UP_THR_VALUE  0x03030303
> >
> > -   static const struct {
> > +static void
> > +i40e_configure_registers(struct i40e_hw *hw) {
> > +   static struct {
> > uint32_t addr;
> > uint64_t val;
> > } reg_table[] = {
> > {I40E_GL_SWR_PRI_JOIN_MAP_0,
> > I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},
> > {I40E_GL_SWR_PRI_JOIN_MAP_2,
> > I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},
> > -   {I40E_GL_SWR_PM_UP_THR,
> > I40E_GL_SWR_PM_UP_THR_VALUE},
> > +   {I40E_GL_SWR_PM_UP_THR, 0}, /* Compute value
> > dynamically */
> > };
> > uint64_t reg;
> > uint32_t i;
> > int ret;
> >
> > -   /* Below fix is for X710 only */
> > -   if (i40e_is_40G_device(hw->device_id))
> > -   return;
> > -
> > for (i = 0; i < RTE_DIM(reg_table); i++) {
> > +   if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) {
> > +   if (i40e_is_40G_device(hw->device_id)) /* For XL710
> > */
> > +   reg_table[i].val =
> > +
> > I40E_GL_SWR_PM_UP_THR_SF_VALUE;
> > +   else /* For X710 */
> > +   reg_table[i].val =
> > +
> > I40E_GL_SWR_PM_UP_THR_EF_VALUE;
> > +   }
> > +
> > ret = i40e_debug_read_register(hw, reg_table[i].addr, );
> 

[dpdk-dev] [PATCH v2] i40e: workaround for XL710 performance

2015-01-12 Thread Wu, Jingjing


> -Original Message-
> From: Zhang, Helin
> Sent: Monday, December 29, 2014 9:41 AM
> To: dev at dpdk.org
> Cc: nhorman at tuxdriver.com; Xu, Qian Q; Cao, Waterman; Lu, Patrick; Liu,
> Jijiang; Wu, Jingjing; Zhang, Helin
> Subject: [PATCH v2] i40e: workaround for XL710 performance
> 
> On XL710, performance number is far from the expectation on recent
> firmware versions, if promiscuous mode is disabled, or promiscuous mode is
> enabled and port MAC address is equal to the packet destination MAC
> address. The fix for this issue may not be integrated in the following
> firmware version. So the workaround in software driver is needed. For XL710,
> it needs to modify the initial values of 3 internal only registers, which are 
> the
> same as X710.
> Note that the values for X710 and XL710 registers could be different, and the
> workaround can be removed when it is fixed in firmware in the future.
> 
> Signed-off-by: Helin Zhang 
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 44 ++---
> --
>  1 file changed, 30 insertions(+), 14 deletions(-)
> 
> v2 changes:
> * Supported modifying the address of 0x269FBC of XL710 during
>   initialization, to fix the minor performance gap to expectation.
>   That means XL710 can meet the performance expectation with this
>   workaround.
> 
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> b/lib/librte_pmd_i40e/i40e_ethdev.c
> index b47a3d2..8982920 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -5327,38 +5327,54 @@ i40e_debug_read_register(struct i40e_hw *hw,
> uint32_t addr, uint64_t *val)
> 
>  /*
>   * On X710, performance number is far from the expectation on recent
> firmware
> - * versions. The fix for this issue may not be integrated in the following
> + * versions; on XL710, performance number is also far from the
> + expectation on
> + * recent firmware versions, if promiscuous mode is disabled, or
> + promiscuous
> + * mode is enabled and port MAC address is equal to the packet
> + destination MAC
> + * address. The fix for this issue may not be integrated in the
> + following
>   * firmware version. So the workaround in software driver is needed. It
> needs
> - * to modify the initial values of 3 internal only registers. Note that the
> + * to modify the initial values of 3 internal only registers for both
> + X710 and
> + * XL710. Note that the values for X710 or XL710 could be different,
> + and the
>   * workaround can be removed when it is fixed in firmware in the future.
>   */
> -static void
> -i40e_configure_registers(struct i40e_hw *hw) -{
> +
> +/* For both X710 and XL710 */
> +#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x1200
>  #define I40E_GL_SWR_PRI_JOIN_MAP_0   0x26CE00
> +
> +#define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
>  #define I40E_GL_SWR_PRI_JOIN_MAP_2   0x26CE08
> +
> +/* For X710 */
> +#define I40E_GL_SWR_PM_UP_THR_EF_VALUE   0x03030303
> +/* For XL710 */
> +#define I40E_GL_SWR_PM_UP_THR_SF_VALUE   0x06060606
>  #define I40E_GL_SWR_PM_UP_THR0x269FBC
> -#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x1200 -#define
> I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
> -#define I40E_GL_SWR_PM_UP_THR_VALUE  0x03030303
> 
> - static const struct {
> +static void
> +i40e_configure_registers(struct i40e_hw *hw) {
> + static struct {
>   uint32_t addr;
>   uint64_t val;
>   } reg_table[] = {
>   {I40E_GL_SWR_PRI_JOIN_MAP_0,
> I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},
>   {I40E_GL_SWR_PRI_JOIN_MAP_2,
> I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},
> - {I40E_GL_SWR_PM_UP_THR,
> I40E_GL_SWR_PM_UP_THR_VALUE},
> + {I40E_GL_SWR_PM_UP_THR, 0}, /* Compute value
> dynamically */
>   };
>   uint64_t reg;
>   uint32_t i;
>   int ret;
> 
> - /* Below fix is for X710 only */
> - if (i40e_is_40G_device(hw->device_id))
> - return;
> -
>   for (i = 0; i < RTE_DIM(reg_table); i++) {
> + if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) {
> + if (i40e_is_40G_device(hw->device_id)) /* For XL710
> */
> + reg_table[i].val =
> +
>   I40E_GL_SWR_PM_UP_THR_SF_VALUE;
> + else /* For X710 */
> + reg_table[i].val =
> +
>   I40E_GL_SWR_PM_UP_THR_EF_VALUE;
> + }
> +
>   ret = i40e_debug_read_register(hw, reg_table[i].addr, );
>   if (ret < 0) {
>   PMD_DRV_LOG(ERR, "Failed to read from
> 0x%"PRIx32,
> --
> 1.9.3

Acked-by: Jingjing Wu 



[dpdk-dev] [PATCH 2/2] testpmd: fix dcb in vt mode

2015-01-12 Thread Michal Jastrzebski
Date: Mon, 12 Jan 2015 15:39:41 +0100
Message-Id: <1421073581-6644-3-git-send-email-michalx.k.jastrzebski at 
intel.com>
X-Mailer: git-send-email 2.1.1
In-Reply-To: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski at 
intel.com>
References: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski at 
intel.com>

From: Pawel Wodkowski 


This patch incorporate fixes to support DCB in SRIOV mode for testpmd.

It also clean up some old code that is not needed or wrong.



Signed-off-by: Pawel Wodkowski 

---

 app/test-pmd/cmdline.c |4 ++--

 app/test-pmd/testpmd.c |   39 +--

 app/test-pmd/testpmd.h |   10 --

 3 files changed, 31 insertions(+), 22 deletions(-)



diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c

index 882a5a2..3c60087 100644

--- a/app/test-pmd/cmdline.c

+++ b/app/test-pmd/cmdline.c

@@ -1947,9 +1947,9 @@ cmd_config_dcb_parsed(void *parsed_result,



/* DCB in VT mode */

if (!strncmp(res->vt_en, "on",2))

-   dcb_conf.dcb_mode = DCB_VT_ENABLED;

+   dcb_conf.vt_en = 1;

else

-   dcb_conf.dcb_mode = DCB_ENABLED;

+   dcb_conf.vt_en = 0;



if (!strncmp(res->pfc_en, "on",2)) {

dcb_conf.pfc_en = 1;

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c

index 8c69756..6677a5e 100644

--- a/app/test-pmd/testpmd.c

+++ b/app/test-pmd/testpmd.c

@@ -1733,7 +1733,8 @@ const uint16_t vlan_tags[] = {

 };



 static  int

-get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf)

+get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf,

+   uint16_t sriov)

 {

 uint8_t i;



@@ -1741,7 +1742,7 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct 
dcb_config *dcb_conf)

 * Builds up the correct configuration for dcb+vt based on the vlan 
tags array

 * given above, and the number of traffic classes available for use.

 */

-   if (dcb_conf->dcb_mode == DCB_VT_ENABLED) {

+   if (dcb_conf->vt_en == 1) {

struct rte_eth_vmdq_dcb_conf vmdq_rx_conf;

struct rte_eth_vmdq_dcb_tx_conf vmdq_tx_conf;



@@ -1758,9 +1759,17 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct 
dcb_config *dcb_conf)

vmdq_rx_conf.pool_map[i].vlan_id = vlan_tags[ i ];

vmdq_rx_conf.pool_map[i].pools = 1 << (i % 
vmdq_rx_conf.nb_queue_pools);

}

-   for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {

-   vmdq_rx_conf.dcb_queue[i] = i;

-   vmdq_tx_conf.dcb_queue[i] = i;

+

+   if (sriov == 0) {

+   for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {

+   vmdq_rx_conf.dcb_queue[i] = i;

+   vmdq_tx_conf.dcb_queue[i] = i;

+   }

+   } else {

+   for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {

+   vmdq_rx_conf.dcb_queue[i] = i % 
dcb_conf->num_tcs;

+   vmdq_tx_conf.dcb_queue[i] = i % 
dcb_conf->num_tcs;

+   }

}



/*set DCB mode of RX and TX of multiple queues*/

@@ -1818,22 +1827,32 @@ init_port_dcb_config(portid_t pid,struct dcb_config 
*dcb_conf)

uint16_t nb_vlan;

uint16_t i;



-   /* rxq and txq configuration in dcb mode */

-   nb_rxq = 128;

-   nb_txq = 128;

rx_free_thresh = 64;



+   rte_port = [pid];

memset(_conf,0,sizeof(struct rte_eth_conf));

/* Enter DCB configuration status */

dcb_config = 1;



nb_vlan = sizeof( vlan_tags )/sizeof( vlan_tags[ 0 ]);

/*set configuration of DCB in vt mode and DCB in non-vt mode*/

-   retval = get_eth_dcb_conf(_conf, dcb_conf);

+   retval = get_eth_dcb_conf(_conf, dcb_conf, 
rte_port->dev_info.max_vfs);

+

+   /* rxq and txq configuration in dcb mode */

+   nb_rxq = rte_port->dev_info.max_rx_queues;

+   nb_txq = rte_port->dev_info.max_tx_queues;

+

+   if (rte_port->dev_info.max_vfs) {

+   if (port_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB)

+   nb_rxq /= 
port_conf.rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;

+

+   if (port_conf.txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)

+   nb_txq /= 
port_conf.tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;

+   }

+

if (retval < 0)

return retval;



-   rte_port = [pid];

memcpy(_port->dev_conf, _conf,sizeof(struct rte_eth_conf));



rte_port->rx_conf.rx_thresh = rx_thresh;

diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h

index f8b0740..8976acc 100644

--- a/app/test-pmd/testpmd.h

+++ b/app/test-pmd/testpmd.h

@@ -227,20 

[dpdk-dev] [PATCH 1/2] pmd: add DCB for VF for ixgbe

2015-01-12 Thread Michal Jastrzebski
Date: Mon, 12 Jan 2015 15:39:40 +0100
Message-Id: <1421073581-6644-2-git-send-email-michalx.k.jastrzebski at 
intel.com>
X-Mailer: git-send-email 2.1.1
In-Reply-To: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski at 
intel.com>
References: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski at 
intel.com>

From: Pawel Wodkowski 


This patch add support for DCB in SRIOV mode. When no PFC

is enabled this feature might be used as multiple queues

(up to 8 or 4) for VF.



It incorporate following modifications:

 - Allow zero rx/tx queues to be passed to rte_eth_dev_configure().

   Rationale:

   in SRIOV mode PF use first free VF to RX/TX. If VF count

   is 16 or 32 all recources are assigned to VFs so PF can

   be used only for configuration.

 - split nb_q_per_pool to nb_rx_q_per_pool and nb_tx_q_per_pool

   Rationale:

   rx and tx number of queue might be different if RX and TX are

   configured in different mode. This allow to inform VF about

   proper number of queues.

 - extern mailbox API for DCB mode



Signed-off-by: Pawel Wodkowski 

---

 lib/librte_ether/rte_ethdev.c   |   84 +-

 lib/librte_ether/rte_ethdev.h   |5 +-

 lib/librte_pmd_e1000/igb_pf.c   |3 +-

 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--

 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |1 +

 lib/librte_pmd_ixgbe/ixgbe_pf.c |   98 ++-

 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |7 ++-

 7 files changed, 159 insertions(+), 49 deletions(-)



diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c

index 95f2ceb..4c1a494 100644

--- a/lib/librte_ether/rte_ethdev.c

+++ b/lib/librte_ether/rte_ethdev.c

@@ -333,7 +333,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, 
uint16_t nb_queues)

dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",

sizeof(dev->data->rx_queues[0]) * nb_queues,

RTE_CACHE_LINE_SIZE);

-   if (dev->data->rx_queues == NULL) {

+   if (dev->data->rx_queues == NULL && nb_queues > 0) {

dev->data->nb_rx_queues = 0;

return -(ENOMEM);

}

@@ -475,7 +475,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, 
uint16_t nb_queues)

dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",

sizeof(dev->data->tx_queues[0]) * nb_queues,

RTE_CACHE_LINE_SIZE);

-   if (dev->data->tx_queues == NULL) {

+   if (dev->data->tx_queues == NULL && nb_queues > 0) {

dev->data->nb_tx_queues = 0;

return -(ENOMEM);

}

@@ -507,6 +507,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,

  const struct rte_eth_conf *dev_conf)

 {

struct rte_eth_dev *dev = _eth_devices[port_id];

+   struct rte_eth_dev_info dev_info;



if (RTE_ETH_DEV_SRIOV(dev).active != 0) {

/* check multi-queue mode */

@@ -524,11 +525,33 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,

return (-EINVAL);

}



+   if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) &&

+   (dev_conf->txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)) {

+   enum rte_eth_nb_pools rx_pools =

+   
dev_conf->rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;

+   enum rte_eth_nb_pools tx_pools =

+   
dev_conf->tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;

+

+   if (rx_pools != tx_pools) {

+   /* Only equal number of pools is supported when

+* DCB+VMDq in SRIOV */

+   PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8

+   " SRIOV active, DCB+VMDQ mode, "

+   "number of rx and tx pools is 
not eqaul\n",

+   port_id);

+   return (-EINVAL);

+   }

+   }

+

+   uint16_t nb_rx_q_per_pool = 
RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool;

+   uint16_t nb_tx_q_per_pool = 
RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;

+

switch (dev_conf->rxmode.mq_mode) {

-   case ETH_MQ_RX_VMDQ_RSS:

case ETH_MQ_RX_VMDQ_DCB:

+   break;

+   case ETH_MQ_RX_VMDQ_RSS:

case ETH_MQ_RX_VMDQ_DCB_RSS:

-   /* DCB/RSS VMDQ in SRIOV mode, not implement yet */

+   /* RSS, DCB+RSS VMDQ in 

[dpdk-dev] [PATCH 0/2] Enable DCB in SRIOV mode for ixgbe driver

2015-01-12 Thread Michal Jastrzebski
Date: Mon, 12 Jan 2015 15:39:39 +0100
Message-Id: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski at 
intel.com>
X-Mailer: git-send-email 2.1.1

From: Pawel Wodkowski 


Hi,

this patchset enables DCB in SRIOV (ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB)

for each VF and PF for ixgbe driver.



As a side effect this allow to use multiple queues for TX in VF (8 if there is

16 or less VFs or 4 if there is 32 or less VFs) when PFC is not enabled.





Pawel Wodkowski (2):

  pmd: add DCB for VF for ixgbe

  testpmd: fix dcb in vt mode



 app/test-pmd/cmdline.c  |4 +-

 app/test-pmd/testpmd.c  |   39 ++

 app/test-pmd/testpmd.h  |   10 

 lib/librte_ether/rte_ethdev.c   |   84 +-

 lib/librte_ether/rte_ethdev.h   |5 +-

 lib/librte_pmd_e1000/igb_pf.c   |3 +-

 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--

 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |1 +

 lib/librte_pmd_ixgbe/ixgbe_pf.c |   98 ++-

 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |7 ++-

 10 files changed, 190 insertions(+), 71 deletions(-)



-- 

1.7.9.5





[dpdk-dev] [PATCH RFC 0/7] unification of flow types and RSS offload types

2015-01-12 Thread Zhang, Helin
Hello

Does anybody has any more review comments or ideas for this? I will send out 
the formal patch soon. Thanks a lot!

Regards,
Helin

> -Original Message-
> From: Zhang, Helin
> Sent: Friday, December 19, 2014 3:27 PM
> To: dev at dpdk.org
> Cc: Wu, Jingjing; Liu, Jijiang; Chen, Jing D; Cao, Waterman; Richardson, 
> Bruce;
> Patel, Rashmin N; Zhang, Helin
> Subject: [PATCH RFC 0/7] unification of flow types and RSS offload types
> 
> It unifies the flow types and RSS offload types for all PMDs.
> Previously flow types are defined actually for i40e, and there has different 
> RSS
> offloads tyeps for 1/10G and 40G seperately.
> This is not so convenient for application development, and not good for adding
> new PMDs. In addition, it enables new RSS offloads of 'tcp' and 'all' in 
> testpmd.
> 
> Helin Zhang (7):
>   app/test-pmd: code style fix
>   ethdev: code style fix
>   i40e: code style fix
>   ethdev: fix of calculating the size of flow type mask array
>   ethdev: unification of flow types
>   ethdev: unification of RSS offload types
>   app/testpmd: support new rss offloads
> 
>  app/test-pipeline/init.c|   2 +-
>  app/test-pmd/cmdline.c  | 104 ++
>  app/test-pmd/config.c   | 132
> +++-
>  examples/distributor/main.c |   9 +-
>  examples/ip_pipeline/init.c |   2 +-
>  examples/l3fwd-acl/main.c   |   7 +-
>  lib/librte_ether/rte_eth_ctrl.h |  91 +++-
>  lib/librte_ether/rte_ethdev.h   | 147 
> +---
>  lib/librte_pmd_e1000/e1000_ethdev.h |  11 +++
>  lib/librte_pmd_e1000/igb_ethdev.c   |   1 +
>  lib/librte_pmd_e1000/igb_rxtx.c |  27 ++
>  lib/librte_pmd_i40e/i40e_ethdev.c   | 126 ++-
>  lib/librte_pmd_i40e/i40e_ethdev.h   |  50 +--
>  lib/librte_pmd_i40e/i40e_ethdev_vf.c|   1 +
>  lib/librte_pmd_i40e/i40e_fdir.c |  91 ++--
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   1 +
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  11 +++
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |  27 ++
>  lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c |   1 +
>  lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h |   6 ++
>  lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   |  10 +--
>  21 files changed, 470 insertions(+), 387 deletions(-)
> 
> --
> 1.9.3



[dpdk-dev] [PATCH v5 4/6] ether: Check VMDq RSS mode

2015-01-12 Thread Ouyang, Changchun


From: Vlad Zolotarov [mailto:vl...@cloudius-systems.com]
Sent: Friday, January 09, 2015 9:50 PM
To: Ouyang, Changchun; dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH v5 4/6] ether: Check VMDq RSS mode


On 01/09/15 07:54, Ouyang, Changchun wrote:





-Original Message-

From: Vlad Zolotarov [mailto:vl...@cloudius-systems.com]

Sent: Friday, January 9, 2015 2:49 AM

To: Ouyang, Changchun; dev at dpdk.org

Subject: Re: [dpdk-dev] [PATCH v5 4/6] ether: Check VMDq RSS mode





On 01/08/15 11:19, Vlad Zolotarov wrote:



On 01/07/15 08:32, Ouyang Changchun wrote:

Check mq mode for VMDq RSS, handle it correctly instead of returning

an error; Also remove the limitation of per pool queue number has max

value of 1, because the per pool queue number could be 2 or 4 if it

is VMDq RSS mode;



The number of rxq specified in config will determine the mq mode for

VMDq RSS.



Signed-off-by: Changchun Ouyang 



changes in v5:

   - Fix '<' issue, it should be '<=' to test rxq number;

   - Extract a function to remove the embeded switch-case statement.



---

  lib/librte_ether/rte_ethdev.c | 50

++-

  1 file changed, 45 insertions(+), 5 deletions(-)



diff --git a/lib/librte_ether/rte_ethdev.c

b/lib/librte_ether/rte_ethdev.c index 95f2ceb..8363e26 100644

--- a/lib/librte_ether/rte_ethdev.c

+++ b/lib/librte_ether/rte_ethdev.c

@@ -503,6 +503,31 @@ rte_eth_dev_tx_queue_config(struct

rte_eth_dev

*dev, uint16_t nb_queues)

  }

static int

+rte_eth_dev_check_vf_rss_rxq_num(uint8_t port_id, uint16_t nb_rx_q)

+{

+struct rte_eth_dev *dev = _eth_devices[port_id];

+switch (nb_rx_q) {

+case 1:

+case 2:

+RTE_ETH_DEV_SRIOV(dev).active =

+ETH_64_POOLS;

+break;

+case 4:

+RTE_ETH_DEV_SRIOV(dev).active =

+ETH_32_POOLS;

+break;

+default:

+return -EINVAL;

+}

+

+RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = nb_rx_q;

+RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx =

+dev->pci_dev->max_vfs * nb_rx_q;

+

+return 0;

+}

+

+static int

  rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q,

uint16_t nb_tx_q,

const struct rte_eth_conf *dev_conf)

  {

@@ -510,8 +535,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,

uint16_t nb_rx_q, uint16_t nb_tx_q,

if (RTE_ETH_DEV_SRIOV(dev).active != 0) {

  /* check multi-queue mode */

-if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_RSS) ||

-(dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||

+if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||

  (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB_RSS) ||

  (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB)) {

  /* SRIOV only works in VMDq enable mode */ @@ -525,7

+549,6 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t

nb_rx_q, uint16_t nb_tx_q,

  }

switch (dev_conf->rxmode.mq_mode) {

-case ETH_MQ_RX_VMDQ_RSS:

  case ETH_MQ_RX_VMDQ_DCB:

  case ETH_MQ_RX_VMDQ_DCB_RSS:

  /* DCB/RSS VMDQ in SRIOV mode, not implement yet */ @@

-534,6 +557,25 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,

uint16_t

nb_rx_q, uint16_t nb_tx_q,

  "unsupported VMDQ mq_mode rx %u\n",

  port_id, dev_conf->rxmode.mq_mode);

  return (-EINVAL);

+case ETH_MQ_RX_RSS:

+PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8

+" SRIOV active, "

+"Rx mq mode is changed from:"

+"mq_mode %u into VMDQ mq_mode %u\n",

+port_id,

+dev_conf->rxmode.mq_mode,

+dev->data->dev_conf.rxmode.mq_mode);

+case ETH_MQ_RX_VMDQ_RSS:

+dev->data->dev_conf.rxmode.mq_mode =

ETH_MQ_RX_VMDQ_RSS;

+if (nb_rx_q <= RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)

+if (rte_eth_dev_check_vf_rss_rxq_num(port_id,

nb_rx_q) != 0) {

+PMD_DEBUG_TRACE("ethdev port_id=%d"

+" SRIOV active, invalid queue"

+" number for VMDQ RSS\n",

+port_id);



Some nitpicking here: I'd add the allowed values descriptions to the

error message. Something like: "invalid queue number for VMDQ RSS.

Allowed values are 1, 2 or 4\n".



+return -EINVAL;

+}

+break;

  default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */

  /* if nothing mq mode configure, use default scheme */

  dev->data->dev_conf.rxmode.mq_mode =

ETH_MQ_RX_VMDQ_ONLY; @@ -553,8 +595,6 @@

rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q,

uint16_t nb_tx_q,

  default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */

  /* if nothing mq mode configure, use 

[dpdk-dev] [PATCH v3] i40e: workaround for X710 performance issues

2015-01-12 Thread Wu, Jingjing
Thanks, Thomas.

I supposed to review another patch for XL710 performance. Due to the similar 
patch subject, I reviewed this applied patch.

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Friday, January 09, 2015 11:48 PM
> To: Wu, Jingjing
> Cc: dev at dpdk.org; Zhang, Helin; Rowden, Aaron F
> Subject: Re: [dpdk-dev] [PATCH v3] i40e: workaround for X710 performance
> issues
> 
> 2015-01-09 05:29, Wu, Jingjing:
> > Acked-by: Jingjing Wu 
> 
> Jingjing, this patch is already applied in version 1.8.0:
>   http://dpdk.org/ml/archives/dev/2014-December/010164.html
> 
> --
> Thomas