[dpdk-dev] [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 platform

2015-03-05 Thread Yerden Zhumabekov
Acked-by: Yerden Zhumabekov 

05.03.2015 22:55, Michael Qiu ?:
> CC rte_hash.o
> Error: unsupported instruction `crc32'
>
> The root cause is that i686 platform does not support 'crc32q'
> Need make it only available in x86_64 platform
>
> Signed-off-by: Michael Qiu 
> ---
> v2 --> v1:
>  Make crc32 instruction only works in X86 platform
>  lib/librte_hash/rte_hash_crc.h | 12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
> index d28bb2a..c0a789e 100644
> --- a/lib/librte_hash/rte_hash_crc.h
> +++ b/lib/librte_hash/rte_hash_crc.h
> @@ -364,6 +364,7 @@ crc32c_2words(uint64_t data, uint32_t init_val)
>   return crc;
>  }
>  
> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>  static inline uint32_t
>  crc32c_sse42_u32(uint32_t data, uint32_t init_val)
>  {
> @@ -373,7 +374,9 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)
>   : [data] "rm" (data));
>   return init_val;
>  }
> +#endif
>  
> +#ifdef RTE_ARCH_X86_64
>  static inline uint32_t
>  crc32c_sse42_u64(uint64_t data, uint64_t init_val)
>  {
> @@ -383,7 +386,9 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
>   : [data] "rm" (data));
>   return init_val;
>  }
> +#endif
>  
> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>  static inline uint32_t
>  crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
>  {
> @@ -397,6 +402,7 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
>   init_val = crc32c_sse42_u32(d.u32[1], init_val);
>   return init_val;
>  }
> +#endif
>  
>  #define CRC32_SW(1U << 0)
>  #define CRC32_SSE42 (1U << 1)
> @@ -455,8 +461,10 @@ rte_hash_crc_init_alg(void)
>  static inline uint32_t
>  rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>  {
> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>   if (likely(crc32_alg & CRC32_SSE42))
>   return crc32c_sse42_u32(data, init_val);
> +#endif
>  
>   return crc32c_1word(data, init_val);
>  }
> @@ -476,11 +484,15 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>  static inline uint32_t
>  rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
>  {
> +#ifdef RTE_ARCH_X86_64
>   if (likely(crc32_alg == CRC32_SSE42_x64))
>   return crc32c_sse42_u64(data, init_val);
> +#endif
>  
> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>   if (likely(crc32_alg & CRC32_SSE42))
>   return crc32c_sse42_u64_mimic(data, init_val);
> +#endif
>  
>   return crc32c_2words(data, init_val);
>  }

-- 
Sincerely,

Yerden Zhumabekov
State Technical Service
Astana, KZ



[dpdk-dev] [PATCH v2 5/6] common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option

2015-03-05 Thread Vladislav Zolotarov
On Mar 5, 2015 9:14 PM, "Thomas Monjalon"  wrote:
>
> 2015-03-05 16:18, Vlad Zolotarov:
> >
> > On 03/05/15 16:01, Thomas Monjalon wrote:
> > > 2015-03-05 15:39, Vlad Zolotarov:
> > >> On 03/05/15 15:19, Thomas Monjalon wrote:
> > >>> 2015-03-05 13:28, Vlad Zolotarov:
> >  Enables LRO support in PMDs.
> > 
> >  Signed-off-by: Vlad Zolotarov 
> >  ---
> > config/common_linuxapp | 1 +
> > 1 file changed, 1 insertion(+)
> > 
> >  diff --git a/config/common_linuxapp b/config/common_linuxapp
> >  index 97f1c9e..5b98595 100644
> >  --- a/config/common_linuxapp
> >  +++ b/config/common_linuxapp
> >  @@ -137,6 +137,7 @@ CONFIG_RTE_MAX_ETHPORTS=32
> > CONFIG_RTE_LIBRTE_IEEE1588=n
> > CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
> > CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
> >  +CONFIG_RTE_ETHDEV_LRO_SUPPORT=y
> > >>> Sorry I don't really follow this ixgbe discussion but I wonder why
you
> > >>> would add a compile time option for this feature.
> > >> The only reason is to be able to detect that the feature is present
in
> > >> the DPDK version u r compiling against because of the API change.
> > >> Currently, this can't be done using the DPDK version thus we may
either
> > > Why you cannot use version? In development phase?
> > > When released, you'll be able to test >= 2.1.
> >
> > Of course! When the version bumps, the #ifdef I've mentioned above may
> > be replaced with the version check.
> >
> > >
> > >> do a try-compilation and if it fails define some application-level
macro
> > >> disabling
> > >> the feature usage or we may define a macro in the library level
> > >> (together with tons of other such macros like those in the patch
snippet
> > >> above).
> > > I'd prefer a request rte_eth_dev_info_get() to advertise that the
feature
> > > is available with the device and driver.
> > > Please let's try to remove config options and #ifdefs.
> >
> > This is exactly what my patch does. But that's not ending there - there
> > is a new feature bit added in rte_eth_rxmode (enable_lro) and in order
> > to compile the application has to know somehow if this bit is present or
> > not. How do u propose to do this now?
>
> I think it would be better to define something like RTE_HAS_LRO in
rte_ethdev.h.

Ok. So i'll change it in v4.

>
> > Of course, I can put such macro in my own tree but then I'll have to
> > rebase all the time and inform other developers that will have to work
> > against my tree (and not upstream as it's supposed to be) - to update.
> > This sounds like a hassle thus I added this macro to resolve this issue
> > until the version is bumped.
> >
> > >
> > >>> What is the benefit of disabling it?
> > >> No benefit whatsoever.
>
>


[dpdk-dev] [PATCH 1/3] librte_hash: Fix unsupported instruction `crc32' in i686 platform

2015-03-05 Thread Yerden Zhumabekov
Hi Michael,

Thanks for this patch, in fact I didn't try to compile it on i686 when
developing original software fallback for CRC32.

I think if we want to make code compilable as wide as possible, we
should compile out all SSE4.2 instructions. As to the patch, we may
compile out 'crc32l' instruction emitting code if the arch is not x86.
This concerns two functions: crc32c_sse42_u32() and
crc32c_sse42_u64_mimic().

The compile check might be something like this:

#if defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_64)
#endif

Otherwise, the patch looks good.

05.03.2015 19:15, Michael Qiu ?:
> CC rte_hash.o
> Error: unsupported instruction `crc32'
>
> The root cause is that i686 platform does not support 'crc32q'
> Need make it only available in x86_64 platform
>
> Signed-off-by: Michael Qiu 
> ---
>  lib/librte_hash/rte_hash_crc.h | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
> index d28bb2a..4e9546f 100644
> --- a/lib/librte_hash/rte_hash_crc.h
> +++ b/lib/librte_hash/rte_hash_crc.h
> @@ -374,6 +374,7 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)
>   return init_val;
>  }
>  
> +#ifdef RTE_ARCH_X86_64
>  static inline uint32_t
>  crc32c_sse42_u64(uint64_t data, uint64_t init_val)
>  {
> @@ -383,6 +384,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
>   : [data] "rm" (data));
>   return init_val;
>  }
> +#endif
>  
>  static inline uint32_t
>  crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
> @@ -476,8 +478,10 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>  static inline uint32_t
>  rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
>  {
> +#ifdef RTE_ARCH_X86_64
>   if (likely(crc32_alg == CRC32_SSE42_x64))
>   return crc32c_sse42_u64(data, init_val);
> +#endif
>  
>   if (likely(crc32_alg & CRC32_SSE42))
>   return crc32c_sse42_u64_mimic(data, init_val);

-- 
Sincerely,

Yerden Zhumabekov
State Technical Service
Astana, KZ




[dpdk-dev] [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message

2015-03-05 Thread Thomas Monjalon
> > This patch fixes the segfault issue in the case vhost receives new
> > VHOST_SET_MEM_TABLE message without VHOST_VRING_GET_VRING_BASE(which
> > we uses as the stop message).
> > 
> > Signed-off-by: Huawei Xie 
> 
> Acked-by: Tommy Long  

Applied, thanks


[dpdk-dev] [PATCH 2/3 v2] app/test: Fix size_t printf format issue

2015-03-05 Thread Michael Qiu
test_hash.c: In function ?test_crc32_hash_alg_equiv?:
error: format ?%lu? expects argument of type ?long unsigned int?,
but argument 2 has type ?size_t? [-Werror=format]

According to C99, for size_t type should use format "%zu"

Signed-off-by: Michael Qiu 
---
v2 --> v1:
typo fix of "format" in commit log and title

 app/test/test_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index 653dd86..c489b8b 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -226,7 +226,7 @@ test_crc32_hash_alg_equiv(void)
if (i == CRC32_ITERATIONS)
return 0;

-   printf("Failed test data (hex, %lu bytes total):\n", data_len);
+   printf("Failed test data (hex, %zu bytes total):\n", data_len);
for (j = 0; j < data_len; j++)
printf("%02X%c", ((uint8_t *)data64)[j],
((j+1) % 16 == 0 || j == data_len - 1) ? '\n' : 
' ');
-- 
1.9.3



[dpdk-dev] [PATCH 3/3 v3] =?UTF-8?q?librte=5Feal/common:=20Fix=20redeclaration=20of?= =?UTF-8?q?=20enumerator=20=E2=80=98REG=5FEAX=E2=80=99?=

2015-03-05 Thread Michael Qiu
include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ?REG_EAX?
In file included from /usr/include/signal.h:358:0,
 from /usr/include/sys/wait.h:30,
 from /root/dpdk/app/test/test_mp_secondary.c:50:
/usr/include/sys/ucontext.h:180:3: note: previous definition of ?REG_EAX? was 
here

In i686, from REG_EAX to REG_EDX are all defined in
/usr/include/sys/ucontext.h

Rename to CPU_REG_EAX to avoid this issue.

Signed-off-by: Michael Qiu 
---
v3 --> v2:
Fix signed-off-by field
v2 --> v1:
rename CPU_REG_EAX to RTE_REG_EAX

 .../common/include/arch/x86/rte_cpuflags.h | 210 ++---
 1 file changed, 105 insertions(+), 105 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h 
b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
index a58dd7b..dd56553 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
@@ -151,104 +151,104 @@ enum rte_cpu_flag_t {
 };

 enum cpu_register_t {
-   REG_EAX = 0,
-   REG_EBX,
-   REG_ECX,
-   REG_EDX,
+   RTE_REG_EAX = 0,
+   RTE_REG_EBX,
+   RTE_REG_ECX,
+   RTE_REG_EDX,
 };

 static const struct feature_entry cpu_feature_table[] = {
-   FEAT_DEF(SSE3, 0x0001, 0, REG_ECX,  0)
-   FEAT_DEF(PCLMULQDQ, 0x0001, 0, REG_ECX,  1)
-   FEAT_DEF(DTES64, 0x0001, 0, REG_ECX,  2)
-   FEAT_DEF(MONITOR, 0x0001, 0, REG_ECX,  3)
-   FEAT_DEF(DS_CPL, 0x0001, 0, REG_ECX,  4)
-   FEAT_DEF(VMX, 0x0001, 0, REG_ECX,  5)
-   FEAT_DEF(SMX, 0x0001, 0, REG_ECX,  6)
-   FEAT_DEF(EIST, 0x0001, 0, REG_ECX,  7)
-   FEAT_DEF(TM2, 0x0001, 0, REG_ECX,  8)
-   FEAT_DEF(SSSE3, 0x0001, 0, REG_ECX,  9)
-   FEAT_DEF(CNXT_ID, 0x0001, 0, REG_ECX, 10)
-   FEAT_DEF(FMA, 0x0001, 0, REG_ECX, 12)
-   FEAT_DEF(CMPXCHG16B, 0x0001, 0, REG_ECX, 13)
-   FEAT_DEF(XTPR, 0x0001, 0, REG_ECX, 14)
-   FEAT_DEF(PDCM, 0x0001, 0, REG_ECX, 15)
-   FEAT_DEF(PCID, 0x0001, 0, REG_ECX, 17)
-   FEAT_DEF(DCA, 0x0001, 0, REG_ECX, 18)
-   FEAT_DEF(SSE4_1, 0x0001, 0, REG_ECX, 19)
-   FEAT_DEF(SSE4_2, 0x0001, 0, REG_ECX, 20)
-   FEAT_DEF(X2APIC, 0x0001, 0, REG_ECX, 21)
-   FEAT_DEF(MOVBE, 0x0001, 0, REG_ECX, 22)
-   FEAT_DEF(POPCNT, 0x0001, 0, REG_ECX, 23)
-   FEAT_DEF(TSC_DEADLINE, 0x0001, 0, REG_ECX, 24)
-   FEAT_DEF(AES, 0x0001, 0, REG_ECX, 25)
-   FEAT_DEF(XSAVE, 0x0001, 0, REG_ECX, 26)
-   FEAT_DEF(OSXSAVE, 0x0001, 0, REG_ECX, 27)
-   FEAT_DEF(AVX, 0x0001, 0, REG_ECX, 28)
-   FEAT_DEF(F16C, 0x0001, 0, REG_ECX, 29)
-   FEAT_DEF(RDRAND, 0x0001, 0, REG_ECX, 30)
-
-   FEAT_DEF(FPU, 0x0001, 0, REG_EDX,  0)
-   FEAT_DEF(VME, 0x0001, 0, REG_EDX,  1)
-   FEAT_DEF(DE, 0x0001, 0, REG_EDX,  2)
-   FEAT_DEF(PSE, 0x0001, 0, REG_EDX,  3)
-   FEAT_DEF(TSC, 0x0001, 0, REG_EDX,  4)
-   FEAT_DEF(MSR, 0x0001, 0, REG_EDX,  5)
-   FEAT_DEF(PAE, 0x0001, 0, REG_EDX,  6)
-   FEAT_DEF(MCE, 0x0001, 0, REG_EDX,  7)
-   FEAT_DEF(CX8, 0x0001, 0, REG_EDX,  8)
-   FEAT_DEF(APIC, 0x0001, 0, REG_EDX,  9)
-   FEAT_DEF(SEP, 0x0001, 0, REG_EDX, 11)
-   FEAT_DEF(MTRR, 0x0001, 0, REG_EDX, 12)
-   FEAT_DEF(PGE, 0x0001, 0, REG_EDX, 13)
-   FEAT_DEF(MCA, 0x0001, 0, REG_EDX, 14)
-   FEAT_DEF(CMOV, 0x0001, 0, REG_EDX, 15)
-   FEAT_DEF(PAT, 0x0001, 0, REG_EDX, 16)
-   FEAT_DEF(PSE36, 0x0001, 0, REG_EDX, 17)
-   FEAT_DEF(PSN, 0x0001, 0, REG_EDX, 18)
-   FEAT_DEF(CLFSH, 0x0001, 0, REG_EDX, 19)
-   FEAT_DEF(DS, 0x0001, 0, REG_EDX, 21)
-   FEAT_DEF(ACPI, 0x0001, 0, REG_EDX, 22)
-   FEAT_DEF(MMX, 0x0001, 0, REG_EDX, 23)
-   FEAT_DEF(FXSR, 0x0001, 0, REG_EDX, 24)
-   FEAT_DEF(SSE, 0x0001, 0, REG_EDX, 25)
-   FEAT_DEF(SSE2, 0x0001, 0, REG_EDX, 26)
-   FEAT_DEF(SS, 0x0001, 0, REG_EDX, 27)
-   FEAT_DEF(HTT, 0x0001, 0, REG_EDX, 28)
-   FEAT_DEF(TM, 0x0001, 0, REG_EDX, 29)
-   FEAT_DEF(PBE, 0x0001, 0, REG_EDX, 31)
-
-   FEAT_DEF(DIGTEMP, 0x0006, 0, REG_EAX,  0)
-   FEAT_DEF(TRBOBST, 0x0006, 0, REG_EAX,  1)
-   FEAT_DEF(ARAT, 0x0006, 0, REG_EAX,  2)
-   FEAT_DEF(PLN, 0x0006, 0, REG_EAX,  4)
-   FEAT_DEF(ECMD, 0x0006, 0, REG_EAX,  5)
-   FEAT_DEF(PTM, 0x0006, 0, REG_EAX,  6)
-
-   FEAT_DEF(MPERF_APERF_MSR, 0x0006, 0, REG_ECX,  0)
-   FEAT_DEF(ACNT2, 0x0006, 0, REG_ECX,  1)
-   FEAT_DEF(ENERGY_EFF, 0x0006, 0, REG_ECX,  3)
-
-   FEAT_DEF(FSGSBASE, 0x0007, 0, REG_EBX,  0)
-   FEAT_DEF(BMI1, 0x0007, 0, REG_EBX,  2)
-   FEAT_DEF(HLE, 0x0007, 0, REG_EBX,  4)
-   FEAT_DEF(AVX2, 0x0007, 0, REG_EBX,  5)
-   FEAT_DEF(SMEP, 0x0007, 

[dpdk-dev] [PATCH] ethdev: add missing symbol export for rte_eth_dev_release_port

2015-03-05 Thread Thomas Monjalon
2015-03-04 08:12, Panu Matilainen:
> Fixes: 36ec8585b298 ("ethdev: release port")
> 
> Signed-off-by: Panu Matilainen 

Acked-by: Thomas Monjalon 

Applied, thanks


[dpdk-dev] [PATCH 3/3 v2] =?UTF-8?q?librte=5Feal/common:=20Fix=20redeclaration=20of?= =?UTF-8?q?=20enumerator=20=E2=80=98REG=5FEAX=E2=80=99?=

2015-03-05 Thread Michael Qiu
include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ?REG_EAX?
In file included from /usr/include/signal.h:358:0,
 from /usr/include/sys/wait.h:30,
 from /root/dpdk/app/test/test_mp_secondary.c:50:
/usr/include/sys/ucontext.h:180:3: note: previous definition of ?REG_EAX? was 
here

In i686, from REG_EAX to REG_EDX are all defined in
/usr/include/sys/ucontext.h

Rename to CPU_REG_EAX to avoid this issue.

Signed-off-by: Michael Qou 
---
v2 --> v1:
rename CPU_REG_EAX to RTE_REG_EAX

 .../common/include/arch/x86/rte_cpuflags.h | 210 ++---
 1 file changed, 105 insertions(+), 105 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h 
b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
index a58dd7b..dd56553 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
@@ -151,104 +151,104 @@ enum rte_cpu_flag_t {
 };

 enum cpu_register_t {
-   REG_EAX = 0,
-   REG_EBX,
-   REG_ECX,
-   REG_EDX,
+   RTE_REG_EAX = 0,
+   RTE_REG_EBX,
+   RTE_REG_ECX,
+   RTE_REG_EDX,
 };

 static const struct feature_entry cpu_feature_table[] = {
-   FEAT_DEF(SSE3, 0x0001, 0, REG_ECX,  0)
-   FEAT_DEF(PCLMULQDQ, 0x0001, 0, REG_ECX,  1)
-   FEAT_DEF(DTES64, 0x0001, 0, REG_ECX,  2)
-   FEAT_DEF(MONITOR, 0x0001, 0, REG_ECX,  3)
-   FEAT_DEF(DS_CPL, 0x0001, 0, REG_ECX,  4)
-   FEAT_DEF(VMX, 0x0001, 0, REG_ECX,  5)
-   FEAT_DEF(SMX, 0x0001, 0, REG_ECX,  6)
-   FEAT_DEF(EIST, 0x0001, 0, REG_ECX,  7)
-   FEAT_DEF(TM2, 0x0001, 0, REG_ECX,  8)
-   FEAT_DEF(SSSE3, 0x0001, 0, REG_ECX,  9)
-   FEAT_DEF(CNXT_ID, 0x0001, 0, REG_ECX, 10)
-   FEAT_DEF(FMA, 0x0001, 0, REG_ECX, 12)
-   FEAT_DEF(CMPXCHG16B, 0x0001, 0, REG_ECX, 13)
-   FEAT_DEF(XTPR, 0x0001, 0, REG_ECX, 14)
-   FEAT_DEF(PDCM, 0x0001, 0, REG_ECX, 15)
-   FEAT_DEF(PCID, 0x0001, 0, REG_ECX, 17)
-   FEAT_DEF(DCA, 0x0001, 0, REG_ECX, 18)
-   FEAT_DEF(SSE4_1, 0x0001, 0, REG_ECX, 19)
-   FEAT_DEF(SSE4_2, 0x0001, 0, REG_ECX, 20)
-   FEAT_DEF(X2APIC, 0x0001, 0, REG_ECX, 21)
-   FEAT_DEF(MOVBE, 0x0001, 0, REG_ECX, 22)
-   FEAT_DEF(POPCNT, 0x0001, 0, REG_ECX, 23)
-   FEAT_DEF(TSC_DEADLINE, 0x0001, 0, REG_ECX, 24)
-   FEAT_DEF(AES, 0x0001, 0, REG_ECX, 25)
-   FEAT_DEF(XSAVE, 0x0001, 0, REG_ECX, 26)
-   FEAT_DEF(OSXSAVE, 0x0001, 0, REG_ECX, 27)
-   FEAT_DEF(AVX, 0x0001, 0, REG_ECX, 28)
-   FEAT_DEF(F16C, 0x0001, 0, REG_ECX, 29)
-   FEAT_DEF(RDRAND, 0x0001, 0, REG_ECX, 30)
-
-   FEAT_DEF(FPU, 0x0001, 0, REG_EDX,  0)
-   FEAT_DEF(VME, 0x0001, 0, REG_EDX,  1)
-   FEAT_DEF(DE, 0x0001, 0, REG_EDX,  2)
-   FEAT_DEF(PSE, 0x0001, 0, REG_EDX,  3)
-   FEAT_DEF(TSC, 0x0001, 0, REG_EDX,  4)
-   FEAT_DEF(MSR, 0x0001, 0, REG_EDX,  5)
-   FEAT_DEF(PAE, 0x0001, 0, REG_EDX,  6)
-   FEAT_DEF(MCE, 0x0001, 0, REG_EDX,  7)
-   FEAT_DEF(CX8, 0x0001, 0, REG_EDX,  8)
-   FEAT_DEF(APIC, 0x0001, 0, REG_EDX,  9)
-   FEAT_DEF(SEP, 0x0001, 0, REG_EDX, 11)
-   FEAT_DEF(MTRR, 0x0001, 0, REG_EDX, 12)
-   FEAT_DEF(PGE, 0x0001, 0, REG_EDX, 13)
-   FEAT_DEF(MCA, 0x0001, 0, REG_EDX, 14)
-   FEAT_DEF(CMOV, 0x0001, 0, REG_EDX, 15)
-   FEAT_DEF(PAT, 0x0001, 0, REG_EDX, 16)
-   FEAT_DEF(PSE36, 0x0001, 0, REG_EDX, 17)
-   FEAT_DEF(PSN, 0x0001, 0, REG_EDX, 18)
-   FEAT_DEF(CLFSH, 0x0001, 0, REG_EDX, 19)
-   FEAT_DEF(DS, 0x0001, 0, REG_EDX, 21)
-   FEAT_DEF(ACPI, 0x0001, 0, REG_EDX, 22)
-   FEAT_DEF(MMX, 0x0001, 0, REG_EDX, 23)
-   FEAT_DEF(FXSR, 0x0001, 0, REG_EDX, 24)
-   FEAT_DEF(SSE, 0x0001, 0, REG_EDX, 25)
-   FEAT_DEF(SSE2, 0x0001, 0, REG_EDX, 26)
-   FEAT_DEF(SS, 0x0001, 0, REG_EDX, 27)
-   FEAT_DEF(HTT, 0x0001, 0, REG_EDX, 28)
-   FEAT_DEF(TM, 0x0001, 0, REG_EDX, 29)
-   FEAT_DEF(PBE, 0x0001, 0, REG_EDX, 31)
-
-   FEAT_DEF(DIGTEMP, 0x0006, 0, REG_EAX,  0)
-   FEAT_DEF(TRBOBST, 0x0006, 0, REG_EAX,  1)
-   FEAT_DEF(ARAT, 0x0006, 0, REG_EAX,  2)
-   FEAT_DEF(PLN, 0x0006, 0, REG_EAX,  4)
-   FEAT_DEF(ECMD, 0x0006, 0, REG_EAX,  5)
-   FEAT_DEF(PTM, 0x0006, 0, REG_EAX,  6)
-
-   FEAT_DEF(MPERF_APERF_MSR, 0x0006, 0, REG_ECX,  0)
-   FEAT_DEF(ACNT2, 0x0006, 0, REG_ECX,  1)
-   FEAT_DEF(ENERGY_EFF, 0x0006, 0, REG_ECX,  3)
-
-   FEAT_DEF(FSGSBASE, 0x0007, 0, REG_EBX,  0)
-   FEAT_DEF(BMI1, 0x0007, 0, REG_EBX,  2)
-   FEAT_DEF(HLE, 0x0007, 0, REG_EBX,  4)
-   FEAT_DEF(AVX2, 0x0007, 0, REG_EBX,  5)
-   FEAT_DEF(SMEP, 0x0007, 0, REG_EBX,  6)
-   FEAT_DEF(BMI2, 

[dpdk-dev] [PATCH v2] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue

2015-03-05 Thread Thomas Monjalon
> > The dpdk_nic_bind script will not allow ports to be bound or unbound if 
> > none of the
> > kernel modules supported by DPDK is loaded. This patch relaxes this 
> > restriction by
> > checking if a DPDK module is actually requested. The example below 
> > illustrates this
> > problem:
> >
> > In virtio test, on the guest
> > 1. Bind virtio port to igb_uio driver;
> > 2. Remove igb_uio module;
> > 3. Bind virtio port to virtio-pci driver, it fails and reports:
> >"Error - no supported modules are loaded"
> >
> > The script should check the to-be-bound driver flag, if it is dpdk 
> > driver(igb_uio, vfio etc),
> > and the corresponding module is not loaded, then exit, otherwise, just 
> > report a warning,
> > and continue to bind the non-dpdk driver(like virtio-pci) to dev.
> >
> > Signed-off-by: Changchun Ouyang 
> Acked-by: Michael Qiu 

Applied, thanks



[dpdk-dev] [PATCH 3/3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Michael Qiu
include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ?REG_EAX?
In file included from /usr/include/signal.h:358:0,
 from /usr/include/sys/wait.h:30,
 from /root/dpdk/app/test/test_mp_secondary.c:50:
/usr/include/sys/ucontext.h:180:3: note: previous definition of ?REG_EAX? was 
here

In i686, from REG_EAX to REG_EDX are all defined in
/usr/include/sys/ucontext.h

Rename to CPU_REG_EAX to avoid this issue.

Signed-off-by: Michael Qou 
---
 .../common/include/arch/x86/rte_cpuflags.h | 210 ++---
 1 file changed, 105 insertions(+), 105 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h 
b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
index a58dd7b..f367b91 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
@@ -151,104 +151,104 @@ enum rte_cpu_flag_t {
 };

 enum cpu_register_t {
-   REG_EAX = 0,
-   REG_EBX,
-   REG_ECX,
-   REG_EDX,
+   CPU_REG_EAX = 0,
+   CPU_REG_EBX,
+   CPU_REG_ECX,
+   CPU_REG_EDX,
 };

 static const struct feature_entry cpu_feature_table[] = {
-   FEAT_DEF(SSE3, 0x0001, 0, REG_ECX,  0)
-   FEAT_DEF(PCLMULQDQ, 0x0001, 0, REG_ECX,  1)
-   FEAT_DEF(DTES64, 0x0001, 0, REG_ECX,  2)
-   FEAT_DEF(MONITOR, 0x0001, 0, REG_ECX,  3)
-   FEAT_DEF(DS_CPL, 0x0001, 0, REG_ECX,  4)
-   FEAT_DEF(VMX, 0x0001, 0, REG_ECX,  5)
-   FEAT_DEF(SMX, 0x0001, 0, REG_ECX,  6)
-   FEAT_DEF(EIST, 0x0001, 0, REG_ECX,  7)
-   FEAT_DEF(TM2, 0x0001, 0, REG_ECX,  8)
-   FEAT_DEF(SSSE3, 0x0001, 0, REG_ECX,  9)
-   FEAT_DEF(CNXT_ID, 0x0001, 0, REG_ECX, 10)
-   FEAT_DEF(FMA, 0x0001, 0, REG_ECX, 12)
-   FEAT_DEF(CMPXCHG16B, 0x0001, 0, REG_ECX, 13)
-   FEAT_DEF(XTPR, 0x0001, 0, REG_ECX, 14)
-   FEAT_DEF(PDCM, 0x0001, 0, REG_ECX, 15)
-   FEAT_DEF(PCID, 0x0001, 0, REG_ECX, 17)
-   FEAT_DEF(DCA, 0x0001, 0, REG_ECX, 18)
-   FEAT_DEF(SSE4_1, 0x0001, 0, REG_ECX, 19)
-   FEAT_DEF(SSE4_2, 0x0001, 0, REG_ECX, 20)
-   FEAT_DEF(X2APIC, 0x0001, 0, REG_ECX, 21)
-   FEAT_DEF(MOVBE, 0x0001, 0, REG_ECX, 22)
-   FEAT_DEF(POPCNT, 0x0001, 0, REG_ECX, 23)
-   FEAT_DEF(TSC_DEADLINE, 0x0001, 0, REG_ECX, 24)
-   FEAT_DEF(AES, 0x0001, 0, REG_ECX, 25)
-   FEAT_DEF(XSAVE, 0x0001, 0, REG_ECX, 26)
-   FEAT_DEF(OSXSAVE, 0x0001, 0, REG_ECX, 27)
-   FEAT_DEF(AVX, 0x0001, 0, REG_ECX, 28)
-   FEAT_DEF(F16C, 0x0001, 0, REG_ECX, 29)
-   FEAT_DEF(RDRAND, 0x0001, 0, REG_ECX, 30)
-
-   FEAT_DEF(FPU, 0x0001, 0, REG_EDX,  0)
-   FEAT_DEF(VME, 0x0001, 0, REG_EDX,  1)
-   FEAT_DEF(DE, 0x0001, 0, REG_EDX,  2)
-   FEAT_DEF(PSE, 0x0001, 0, REG_EDX,  3)
-   FEAT_DEF(TSC, 0x0001, 0, REG_EDX,  4)
-   FEAT_DEF(MSR, 0x0001, 0, REG_EDX,  5)
-   FEAT_DEF(PAE, 0x0001, 0, REG_EDX,  6)
-   FEAT_DEF(MCE, 0x0001, 0, REG_EDX,  7)
-   FEAT_DEF(CX8, 0x0001, 0, REG_EDX,  8)
-   FEAT_DEF(APIC, 0x0001, 0, REG_EDX,  9)
-   FEAT_DEF(SEP, 0x0001, 0, REG_EDX, 11)
-   FEAT_DEF(MTRR, 0x0001, 0, REG_EDX, 12)
-   FEAT_DEF(PGE, 0x0001, 0, REG_EDX, 13)
-   FEAT_DEF(MCA, 0x0001, 0, REG_EDX, 14)
-   FEAT_DEF(CMOV, 0x0001, 0, REG_EDX, 15)
-   FEAT_DEF(PAT, 0x0001, 0, REG_EDX, 16)
-   FEAT_DEF(PSE36, 0x0001, 0, REG_EDX, 17)
-   FEAT_DEF(PSN, 0x0001, 0, REG_EDX, 18)
-   FEAT_DEF(CLFSH, 0x0001, 0, REG_EDX, 19)
-   FEAT_DEF(DS, 0x0001, 0, REG_EDX, 21)
-   FEAT_DEF(ACPI, 0x0001, 0, REG_EDX, 22)
-   FEAT_DEF(MMX, 0x0001, 0, REG_EDX, 23)
-   FEAT_DEF(FXSR, 0x0001, 0, REG_EDX, 24)
-   FEAT_DEF(SSE, 0x0001, 0, REG_EDX, 25)
-   FEAT_DEF(SSE2, 0x0001, 0, REG_EDX, 26)
-   FEAT_DEF(SS, 0x0001, 0, REG_EDX, 27)
-   FEAT_DEF(HTT, 0x0001, 0, REG_EDX, 28)
-   FEAT_DEF(TM, 0x0001, 0, REG_EDX, 29)
-   FEAT_DEF(PBE, 0x0001, 0, REG_EDX, 31)
-
-   FEAT_DEF(DIGTEMP, 0x0006, 0, REG_EAX,  0)
-   FEAT_DEF(TRBOBST, 0x0006, 0, REG_EAX,  1)
-   FEAT_DEF(ARAT, 0x0006, 0, REG_EAX,  2)
-   FEAT_DEF(PLN, 0x0006, 0, REG_EAX,  4)
-   FEAT_DEF(ECMD, 0x0006, 0, REG_EAX,  5)
-   FEAT_DEF(PTM, 0x0006, 0, REG_EAX,  6)
-
-   FEAT_DEF(MPERF_APERF_MSR, 0x0006, 0, REG_ECX,  0)
-   FEAT_DEF(ACNT2, 0x0006, 0, REG_ECX,  1)
-   FEAT_DEF(ENERGY_EFF, 0x0006, 0, REG_ECX,  3)
-
-   FEAT_DEF(FSGSBASE, 0x0007, 0, REG_EBX,  0)
-   FEAT_DEF(BMI1, 0x0007, 0, REG_EBX,  2)
-   FEAT_DEF(HLE, 0x0007, 0, REG_EBX,  4)
-   FEAT_DEF(AVX2, 0x0007, 0, REG_EBX,  5)
-   FEAT_DEF(SMEP, 0x0007, 0, REG_EBX,  6)
-   FEAT_DEF(BMI2, 0x0007, 0, REG_EBX,  7)
-   FEAT_DEF(ERMS, 

[dpdk-dev] [PATCH 2/3] app/test: Fix size_t printf formart issue

2015-03-05 Thread Michael Qiu
test_hash.c: In function ?test_crc32_hash_alg_equiv?:
error: format ?%lu? expects argument of type ?long unsigned int?,
but argument 2 has type ?size_t? [-Werror=format]

According to C99, for size_t type should use formart "%zu"

Signed-off-by: Michael Qiu 
---
 app/test/test_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index 653dd86..c489b8b 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -226,7 +226,7 @@ test_crc32_hash_alg_equiv(void)
if (i == CRC32_ITERATIONS)
return 0;

-   printf("Failed test data (hex, %lu bytes total):\n", data_len);
+   printf("Failed test data (hex, %zu bytes total):\n", data_len);
for (j = 0; j < data_len; j++)
printf("%02X%c", ((uint8_t *)data64)[j],
((j+1) % 16 == 0 || j == data_len - 1) ? '\n' : 
' ');
-- 
1.9.3



[dpdk-dev] [PATCH 1/3] librte_hash: Fix unsupported instruction `crc32' in i686 platform

2015-03-05 Thread Michael Qiu
CC rte_hash.o
Error: unsupported instruction `crc32'

The root cause is that i686 platform does not support 'crc32q'
Need make it only available in x86_64 platform

Signed-off-by: Michael Qiu 
---
 lib/librte_hash/rte_hash_crc.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index d28bb2a..4e9546f 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -374,6 +374,7 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)
return init_val;
 }

+#ifdef RTE_ARCH_X86_64
 static inline uint32_t
 crc32c_sse42_u64(uint64_t data, uint64_t init_val)
 {
@@ -383,6 +384,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
: [data] "rm" (data));
return init_val;
 }
+#endif

 static inline uint32_t
 crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
@@ -476,8 +478,10 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
+#ifdef RTE_ARCH_X86_64
if (likely(crc32_alg == CRC32_SSE42_x64))
return crc32c_sse42_u64(data, init_val);
+#endif

if (likely(crc32_alg & CRC32_SSE42))
return crc32c_sse42_u64_mimic(data, init_val);
-- 
1.9.3



[dpdk-dev] [PATCH 0/3] dpdk2.0-rc1 build error fix

2015-03-05 Thread Michael Qiu
This patch set is to fix dpdk2.0-rc1 compile error.

Michael Qiu (3):
  librte_hash: Fix unsupported instruction `crc32' in i686 platform
  app/test: Fix size_t printf formart issue
  librte_eal/common: Fix redeclaration of enumerator ?REG_EAX?

 app/test/test_hash.c   |   2 +-
 .../common/include/arch/x86/rte_cpuflags.h | 210 ++---
 lib/librte_hash/rte_hash_crc.h |   4 +
 3 files changed, 110 insertions(+), 106 deletions(-)

-- 
1.9.3



[dpdk-dev] [PATCH] Missing use of macro rte_eth_dev_is_valid_port()

2015-03-05 Thread Thomas Monjalon
> > Signed-off-by: Keith Wiles 
> 
> Acked-by: John McNamara 

Some checks with rte_eth_dev_is_valid_port() were missed when merging
hotplug and callbacks features.

Fixes: c282abd2a6cd ("ethdev: remove assumption that port will not be detached")

Applied, thanks


[dpdk-dev] [PATCH v2 5/6] common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option

2015-03-05 Thread Thomas Monjalon
2015-03-05 16:18, Vlad Zolotarov:
> 
> On 03/05/15 16:01, Thomas Monjalon wrote:
> > 2015-03-05 15:39, Vlad Zolotarov:
> >> On 03/05/15 15:19, Thomas Monjalon wrote:
> >>> 2015-03-05 13:28, Vlad Zolotarov:
>  Enables LRO support in PMDs.
> 
>  Signed-off-by: Vlad Zolotarov 
>  ---
> config/common_linuxapp | 1 +
> 1 file changed, 1 insertion(+)
> 
>  diff --git a/config/common_linuxapp b/config/common_linuxapp
>  index 97f1c9e..5b98595 100644
>  --- a/config/common_linuxapp
>  +++ b/config/common_linuxapp
>  @@ -137,6 +137,7 @@ CONFIG_RTE_MAX_ETHPORTS=32
> CONFIG_RTE_LIBRTE_IEEE1588=n
> CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
> CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
>  +CONFIG_RTE_ETHDEV_LRO_SUPPORT=y
> >>> Sorry I don't really follow this ixgbe discussion but I wonder why you
> >>> would add a compile time option for this feature.
> >> The only reason is to be able to detect that the feature is present in
> >> the DPDK version u r compiling against because of the API change.
> >> Currently, this can't be done using the DPDK version thus we may either
> > Why you cannot use version? In development phase?
> > When released, you'll be able to test >= 2.1.
> 
> Of course! When the version bumps, the #ifdef I've mentioned above may 
> be replaced with the version check.
> 
> >
> >> do a try-compilation and if it fails define some application-level macro
> >> disabling
> >> the feature usage or we may define a macro in the library level
> >> (together with tons of other such macros like those in the patch snippet
> >> above).
> > I'd prefer a request rte_eth_dev_info_get() to advertise that the feature
> > is available with the device and driver.
> > Please let's try to remove config options and #ifdefs.
> 
> This is exactly what my patch does. But that's not ending there - there 
> is a new feature bit added in rte_eth_rxmode (enable_lro) and in order 
> to compile the application has to know somehow if this bit is present or 
> not. How do u propose to do this now?

I think it would be better to define something like RTE_HAS_LRO in rte_ethdev.h.

> Of course, I can put such macro in my own tree but then I'll have to 
> rebase all the time and inform other developers that will have to work 
> against my tree (and not upstream as it's supposed to be) - to update. 
> This sounds like a hassle thus I added this macro to resolve this issue 
> until the version is bumped.
> 
> >
> >>> What is the benefit of disabling it?
> >> No benefit whatsoever.




[dpdk-dev] ixgbe vector mode not working.

2015-03-05 Thread Thomas Monjalon
2015-02-28 03:33, Liang, Cunming:
> Hi Stephen,
> 
> The root cause is about the rx descriptor number.
> As we use below code to quick process the rx_tail wrap, it require rxd value 
> is a 2^n.
> "rxq->rx_tail = (uint16_t)(rxq->rx_tail & (rxq->nb_rx_desc - 1));"
> We should add more checking on the input rxd, if checking fail, then tend to 
> use scalar pmd.
> Thanks for the report, I'll send fix patch soon.

Fixed in http://dpdk.org/browse/dpdk/commit/?id=352078e8e196
Thanks

> > -Original Message-
> > From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> > Sent: Thursday, February 26, 2015 9:07 AM
> > To: Liang, Cunming
> > Cc: Nemeth, Balazs; Richardson, Bruce; Neil Horman; dev at dpdk.org
> > Subject: Re: ixgbe vector mode not working.
> > 
> > On Wed, 25 Feb 2015 08:49:48 +
> > "Liang, Cunming"  wrote:
> > 
> > > Hi Stephen,
> > >
> > > Thanks for the info, with rxd=4000, I can reproduce it.
> > > On that time, it runs out of mbuf.
> > > I'll follow up this issue.
> > 
> > The first time I ran it, the code was configure rx/tx conf
> > which was leftover from older versions.
> > 
> > Second time I ran it and the same hang happened.
> > Looking at mbuf pool statistics I see that it gets exhausted,
> > even when extra mbuf's are added to the pool.
> > 
> > Looks like a memory leak.




[dpdk-dev] Build failure on FreeBSD-10.1-RELEASE

2015-03-05 Thread Thomas Monjalon
2015-03-05 16:08, Tetsuya Mukawa:
> On 2015/03/04 19:15, Bruce Richardson wrote:
> > On Wed, Mar 04, 2015 at 10:33:14AM +0100, Olivier MATZ wrote:
> >> Hi Tetsuya, Hi Bruce,
> >>
> >> On 03/04/2015 04:34 AM, Tetsuya Mukawa wrote:
> >>> On 2015/03/02 19:22, Bruce Richardson wrote:
>  On Mon, Mar 02, 2015 at 12:47:42PM +0900, Tetsuya Mukawa wrote:
> > Hi,
> >
> > I got a error while building master branch on FreeBSD.
> > Here is a log.
> >
> > $ gmake T=x86_64-native-bsdapp-clang config
> > cc: error: unknown argument: '-fdirectives-only'
> > cp: /usr/home/mukawa/work/dpdk/build/.config_tmp: No such file or 
> > directory
> > cp: /usr/home/mukawa/work/dpdk/build/.config_tmp: No such file or 
> > directory
> > gmake[3]: Nothing to be done for 'depdirs'.
> > Configuration done
> >
> >
> > Here is log came from 'uname'
> >
> > $ uname -a
> > FreeBSD eris.hq.igel.co.jp 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401:
> > Tue Nov 11 21:02:49 UTC 2014
> >
> >
> > I've tried to remove '-fdirectives-only' from mk/rte.sdkconfig.mk like
> > below.
> > With the fixing,  It seems I can compile and run testpmd.
> > (Obviously, we should not merge below patch, but I've done just for 
> > testing)
> >
> > diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
> > index d43c430..f8d95b1 100644
> > --- a/mk/rte.sdkconfig.mk
> > +++ b/mk/rte.sdkconfig.mk
> > @@ -75,7 +75,7 @@ else
> >  $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
> > $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f
> > "$(RTE_CONFIG_TEMPLATE)" ]; then \
> > $(CPP) -undef -P -x assembler-with-cpp \
> > -   -fdirectives-only -ffreestanding \
> > +   -ffreestanding \
> > -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
> > if ! cmp -s $(RTE_OUTPUT)/.config_tmp
> > $(RTE_OUTPUT)/.config; then \
> > cp $(RTE_OUTPUT)/.config_tmp
> > $(RTE_OUTPUT)/.config ; \
> >
> >
> > Also, I've checked /usr/ports/net/dpdk, and found below line.
> > (It seems above ports dpdk package is based on DPDK-1.8.)
> >
> >
> > $(CPP) -undef -P -x assembler-with-cpp \
> >  -ffreestanding \
> >-o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
> >
> > So, I guess we should not add '-fdirectives-only' for flags of $(CPP)
> > for BSD system like dpdk package of ports.
> >
> > Thanks,
> > Tetsuya
> >
>  Yes, that is correct. In most cases I have tested, the extra flag only 
>  gives a
>  warning but it appears its now an error. We should conditionally include 
>  or
>  omit the flag for BSD vs Linux, I think.
> 
>  /Bruce
> >>> Hi Bruce,
> >>>
> >>> It seems we cannot use CONFIG_RTE_EXEC_ENV_LINUXAPP/BSDAPP definition 
> >>> here.
> >>> Now I am looking for other way to check target OS.
> >>> Is it not so good to use $(T) definition value here?
> >> Indeed, it seems that the -fdirectives-only option does not exist in
> >> freebsd. This is probably because the default cpp is not GNU cpp:
> >>
> >> On my version, I have:
> >>  FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
> >>  Target: x86_64-unknown-freebsd10.0
> >>  Thread model: posix
> >>
> >> To decide whether using the option, we could check the return value of
> >> cpp -fdirectives-only /dev/null > /dev/null 2>/dev/null
> 
> It?s a great idea.
> 
> >> But I don't really think it's an issue to remove the option for all
> >> OSes. In my opinion, expanding macros when parsing the config files
> >> won't add any issue, and it's probably better to have no differences
> >> between FreeBSD and Linux.
> >>
> >> Regards,
> >> Olivier
> >>
> > +1 
> > I was just going to suggest that this morning! :-)
> 
> Thanks for suggestions.
> I will send a patch that just removes '-fdirectives-only'.

Fixed in http://dpdk.org/browse/dpdk/commit/?id=64702e5f6ff68bff
Thanks



[dpdk-dev] [PATCH v1] ixgbe/vector: add rxd 2^n check to avoid mbuf leak

2015-03-05 Thread Thomas Monjalon
> > The mbuf leak happens when the assigned number of rx descriptor is not 
> > power of 2.
> > As it's presumed on vpmd rx(for rx_tail wrap), adding condition check to 
> > prevent it.
> > The root cause reference code in *_recv_raw_pkts_vec* as below.
> > "rxq->rx_tail = (uint16_t)(rxq->rx_tail & (rxq->nb_rx_desc - 1));".
> > 
> > Reported-by: Stephen Hemminger 
> > Signed-off-by: Cunming Liang 
> Acked-by: Bruce Richardson 

Applied, thanks



[dpdk-dev] [PATCH] mk: Remove '-fdirectives-only' flag from mk/rte.sdkconfig.mk

2015-03-05 Thread Thomas Monjalon
> > The '-fdirectives-only' flag doesn't exist in cpp of FreeBSD.
> > To remove expanding macros when parsing the config files won't
> > add any issue.
> > 
> > Signed-off-by: Tetsuya Mukawa 
> Acked-by: Bruce Richardson 

Applied, thanks


[dpdk-dev] [PATCH 3/7] vmxnet3: cleanup txq stats

2015-03-05 Thread Yong Wang
On 2/25/15, 6:31 PM, "Stephen Hemminger" 
wrote:

>There are several stats here which are never set, and have no way
>to be displayed.  Assume in future xstats could be used.
>
>Signed-off-by: Stephen Hemminger 

Acked-by: Yong Wang 

>---
> lib/librte_pmd_vmxnet3/vmxnet3_ring.h | 16 ++--
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>index c5abdb6..ebe6268 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>@@ -121,16 +121,12 @@ vmxnet3_comp_ring_adv_next2proc(struct
>vmxnet3_comp_ring *ring)
> }
> 
> struct vmxnet3_txq_stats {
>-  uint64_t   drop_total; /* # of pkts dropped by the driver,
>the
>- * 
>counters below track droppings due to
>- * 
>different reasons
>- */
>-  uint64_t   drop_oversized;
>-  uint64_t   drop_hdr_inspect_err;
>-  uint64_t   drop_tso;
>-  uint64_t   deferred;
>-  uint64_t   tx_ring_full;
>-  uint64_t   linearized;  /* # of pkts linearized */
>+  uint64_tdrop_total; /* # of pkts dropped by the driver,
>+   * the counters below track droppings due to
>+   * different reasons
>+   */
>+  uint64_tdrop_tso;
>+  uint64_ttx_ring_full;
> };
> 
> typedef struct vmxnet3_tx_ctx {
>-- 
>2.1.4
>



[dpdk-dev] [PATCH] ethdev: remove useless parameter in init functions

2015-03-05 Thread Thomas Monjalon
The pointer to struct eth_driver is not used and is already set
in struct rte_eth_dev.

It's a small cleanup in PMD API which probably needs more
attention to make clear what is a driver, a PCI driver, an
ethernet driver, etc.

Signed-off-by: Thomas Monjalon 
---
 lib/librte_ether/rte_ethdev.c   |  4 ++--
 lib/librte_ether/rte_ethdev.h   | 14 --
 lib/librte_pmd_e1000/em_ethdev.c|  3 +--
 lib/librte_pmd_e1000/igb_ethdev.c   |  6 ++
 lib/librte_pmd_enic/enic_ethdev.c   |  4 +---
 lib/librte_pmd_fm10k/fm10k_ethdev.c |  3 +--
 lib/librte_pmd_i40e/i40e_ethdev.c   |  7 ++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c|  3 +--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 12 
 lib/librte_pmd_virtio/virtio_ethdev.c   |  6 ++
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c |  6 ++
 11 files changed, 22 insertions(+), 46 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6ea7a17..c5e1dec 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -324,7 +324,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
eth_dev->data->mtu = ETHER_MTU;

/* Invoke PMD device initialization function */
-   diag = (*eth_drv->eth_dev_init)(eth_drv, eth_dev);
+   diag = (*eth_drv->eth_dev_init)(eth_dev);
if (diag == 0)
return (0);

@@ -362,7 +362,7 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)

/* Invoke PMD device uninit function */
if (*eth_drv->eth_dev_uninit) {
-   ret = (*eth_drv->eth_dev_uninit)(eth_drv, eth_dev);
+   ret = (*eth_drv->eth_dev_uninit)(eth_dev);
if (ret)
return ret;
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8db3127..21aa359 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1609,9 +1609,6 @@ struct eth_driver;
  * Initialization function of an Ethernet driver invoked for each matching
  * Ethernet PCI device detected during the PCI probing phase.
  *
- * @param eth_drv
- *   The pointer to the [matching] Ethernet driver structure supplied by
- *   the PMD when it registered itself.
  * @param eth_dev
  *   The *eth_dev* pointer is the address of the *rte_eth_dev* structure
  *   associated with the matching device and which have been [automatically]
@@ -1622,6 +1619,8 @@ struct eth_driver;
  *   - *pci_dev*: Holds the pointers to the *rte_pci_device* structure which
  * contains the generic PCI information of the matching device.
  *
+ *   - *driver*: Holds the pointer to the *eth_driver* structure.
+ *
  *   - *dev_private*: Holds a pointer to the device private data structure.
  *
  *   - *mtu*: Contains the default Ethernet maximum frame length (1500).
@@ -1635,17 +1634,13 @@ struct eth_driver;
  *of the *eth_dev* structure.
  *   - <0: Error code of the device initialization failure.
  */
-typedef int (*eth_dev_init_t)(struct eth_driver  *eth_drv,
- struct rte_eth_dev *eth_dev);
+typedef int (*eth_dev_init_t)(struct rte_eth_dev *eth_dev);

 /**
  * @internal
  * Finalization function of an Ethernet driver invoked for each matching
  * Ethernet PCI device detected during the PCI closing phase.
  *
- * @param eth_drv
- *   The pointer to the [matching] Ethernet driver structure supplied by
- *   the PMD when it registered itself.
  * @param eth_dev
  *   The *eth_dev* pointer is the address of the *rte_eth_dev* structure
  *   associated with the matching device and which have been [automatically]
@@ -1656,8 +1651,7 @@ typedef int (*eth_dev_init_t)(struct eth_driver  *eth_drv,
  *of the *eth_dev* structure.
  *   - <0: Error code of the device initialization failure.
  */
-typedef int (*eth_dev_uninit_t)(const struct eth_driver  *eth_drv,
- struct rte_eth_dev *eth_dev);
+typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev);

 /**
  * @internal
diff --git a/lib/librte_pmd_e1000/em_ethdev.c b/lib/librte_pmd_e1000/em_ethdev.c
index 3f2897e..332c2e9 100644
--- a/lib/librte_pmd_e1000/em_ethdev.c
+++ b/lib/librte_pmd_e1000/em_ethdev.c
@@ -217,8 +217,7 @@ rte_em_dev_atomic_write_link_status(struct rte_eth_dev *dev,
 }

 static int
-eth_em_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
-   struct rte_eth_dev *eth_dev)
+eth_em_dev_init(struct rte_eth_dev *eth_dev)
 {
struct rte_pci_device *pci_dev;
struct e1000_hw *hw =
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c 
b/lib/librte_pmd_e1000/igb_ethdev.c
index 504ae74..4aaa6ec 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -453,8 +453,7 @@ igb_reset_swfw_lock(struct e1000_hw *hw)
 }

 static int
-eth_igb_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
-  struct rte_eth_dev *eth_dev)
+eth_igb_dev_init(struct rte_eth_dev 

[dpdk-dev] [PATCH 4/7] vmxnet3: add support for multi-segment transmit

2015-03-05 Thread Yong Wang
A quick glance over v2 shows that it only made the change for max segment
check.  I am not sure if all the  other comments on v1 of this patch are
missed or ignored?  If it?s the latter, can you explain your reasoning why
they are not addressed?

On 2/25/15, 6:31 PM, "Stephen Hemminger" 
wrote:

>Change sending loop to support multi-segment mbufs.
>The VMXNET3 api has start-of-packet and end-packet flags, so it
>is not hard to send multi-segment mbuf's.
>
>Also, update descriptor in 32 bit value rather than toggling
>bitfields which is slower and error prone.
>Based on code in earlier driver, and the Linux kernel driver.
>
>Add a compiler barrier to make sure that update of earlier descriptor
>are completed prior to update of generation bit on start of packet.
>
>Signed-off-by: Stephen Hemminger 
>---
>v2 -- incorporate # of segments check
>
> lib/librte_pmd_vmxnet3/vmxnet3_ring.h |   1 +
> lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 137
>--
> 2 files changed, 65 insertions(+), 73 deletions(-)
>
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>index ebe6268..612487e 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>@@ -125,6 +125,7 @@ struct vmxnet3_txq_stats {
>* the counters below track droppings due to
>* different reasons
>*/
>+  uint64_tdrop_too_many_segs;
>   uint64_tdrop_tso;
>   uint64_ttx_ring_full;
> };
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>index 38ac811..884b57f 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>@@ -312,20 +312,22 @@ vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
>   VMXNET3_ASSERT(txq->cmd_ring.base[tcd->txdIdx].txd.eop == 1);
> #endif
>   mbuf = txq->cmd_ring.buf_info[tcd->txdIdx].m;
>-  if (unlikely(mbuf == NULL))
>-  rte_panic("EOP desc does not point to a valid mbuf");
>-  else
>-  rte_pktmbuf_free(mbuf);
>+  rte_pktmbuf_free_seg(mbuf);
>+  txq->cmd_ring.buf_info[tcd->txdIdx].m = NULL;
> 
>+  while (txq->cmd_ring.next2comp != tcd->txdIdx) {
>+  mbuf = 
>txq->cmd_ring.buf_info[txq->cmd_ring.next2comp].m;
>+  txq->cmd_ring.buf_info[txq->cmd_ring.next2comp].m = 
>NULL;
>+  rte_pktmbuf_free_seg(mbuf);
> 
>-  txq->cmd_ring.buf_info[tcd->txdIdx].m = NULL;
>-  /* Mark the txd for which tcd was generated as completed */
>-  vmxnet3_cmd_ring_adv_next2comp(>cmd_ring);
>+  /* Mark the txd for which tcd was generated as 
>completed */
>+  vmxnet3_cmd_ring_adv_next2comp(>cmd_ring);
>+  completed++;
>+  }
> 
>   vmxnet3_comp_ring_adv_next2proc(comp_ring);
>   tcd = (struct Vmxnet3_TxCompDesc *)(comp_ring->base +
>   comp_ring->next2proc);
>-  completed++;
>   }
> 
>   PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.", completed);
>@@ -336,13 +338,8 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf
>**tx_pkts,
> uint16_t nb_pkts)
> {
>   uint16_t nb_tx;
>-  Vmxnet3_TxDesc *txd = NULL;
>-  vmxnet3_buf_info_t *tbi = NULL;
>-  struct vmxnet3_hw *hw;
>-  struct rte_mbuf *txm;
>   vmxnet3_tx_queue_t *txq = tx_queue;
>-
>-  hw = txq->hw;
>+  struct vmxnet3_hw *hw = txq->hw;
> 
>   if (unlikely(txq->stopped)) {
>   PMD_TX_LOG(DEBUG, "Tx queue is stopped.");
>@@ -354,75 +351,69 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf
>**tx_pkts,
> 
>   nb_tx = 0;
>   while (nb_tx < nb_pkts) {
>+  Vmxnet3_GenericDesc *gdesc;
>+  vmxnet3_buf_info_t *tbi;
>+  uint32_t first2fill, avail, dw2;
>+  struct rte_mbuf *txm = tx_pkts[nb_tx];
>+  struct rte_mbuf *m_seg = txm;
>+
>+  /* Is this packet execessively fragmented, then drop */
>+  if (unlikely(txm->nb_segs > VMXNET3_MAX_TXD_PER_PKT)) {
>+  ++txq->stats.drop_too_many_segs;
>+  ++txq->stats.drop_total;
>+  rte_pktmbuf_free(txm);
>+  ++nb_tx;
>+  continue;
>+  }
> 
>-  if (vmxnet3_cmd_ring_desc_avail(>cmd_ring)) {
>-  int copy_size = 0;
>-
>-  txm = tx_pkts[nb_tx];
>-  /* Don't support scatter packets yet, free them if met 
>*/
>-  if (txm->nb_segs != 1) {
>-  PMD_TX_LOG(DEBUG, "Don't support scatter 
>packets yet, 

[dpdk-dev] [PATCH 6/7] vmxnet3: support RSS and refactor offload

2015-03-05 Thread Yong Wang
I believe I have ACKed v1 of this commit but I didn't see ACKed-by in v2.
Or is there any changes from v1?  If that?s the case, can you explain the
changes in the changelog?


On 2/25/15, 6:32 PM, "Stephen Hemminger" 
wrote:

>Refactor the logic to compute receive offload flags to a simpler
>function. And add support for putting RSS flow hash into packet.
>
>Signed-off-by: Stephen Hemminger 
>Signed-off-by: Bill Hong 
>---
> lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 69
>---
> 1 file changed, 40 insertions(+), 29 deletions(-)
>
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>index 884b57f..82bcae6 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>@@ -505,6 +505,43 @@ vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq,
>uint8_t ring_id)
>   return i;
> }
> 
>+
>+/* Receive side checksum and other offloads */
>+static void
>+vmxnet3_rx_offload(const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm)
>+{
>+  /* Check for hardware stripped VLAN tag */
>+  if (rcd->ts) {
>+  rxm->ol_flags |= PKT_RX_VLAN_PKT;
>+  rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
>+  }
>+
>+  /* Check for RSS */
>+  if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE) {
>+  rxm->ol_flags |= PKT_RX_RSS_HASH;
>+  rxm->hash.rss = rcd->rssHash;
>+  }
>+
>+  /* Check packet type, checksum errors, etc. Only support IPv4 for now.
>*/
>+  if (rcd->v4) {
>+  struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct ether_hdr 
>*);
>+  struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);
>+
>+  if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct 
>ipv4_hdr))
>+  rxm->ol_flags |= PKT_RX_IPV4_HDR_EXT;
>+  else
>+  rxm->ol_flags |= PKT_RX_IPV4_HDR;
>+
>+  if (!rcd->cnc) {
>+  if (!rcd->ipc)
>+  rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD;
>+
>+  if ((rcd->tcp || rcd->udp) && !rcd->tuc)
>+  rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD;
>+  }
>+  }
>+}
>+
> /*
>  * Process the Rx Completion Ring of given vmxnet3_rx_queue
>  * for nb_pkts burst and return the number of packets received
>@@ -605,17 +642,6 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf
>**rx_pkts, uint16_t nb_pkts)
>   goto rcd_done;
>   }
> 
>-  /* Check for hardware stripped VLAN tag */
>-  if (rcd->ts) {
>-  PMD_RX_LOG(DEBUG, "Received packet with vlan ID: %d.",
>- rcd->tci);
>-  rxm->ol_flags = PKT_RX_VLAN_PKT;
>-  /* Copy vlan tag in packet buffer */
>-  rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
>-  } else {
>-  rxm->ol_flags = 0;
>-  rxm->vlan_tci = 0;
>-  }
> 
>   /* Initialize newly received packet buffer */
>   rxm->port = rxq->port_id;
>@@ -624,25 +650,10 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf
>**rx_pkts, uint16_t nb_pkts)
>   rxm->pkt_len = (uint16_t)rcd->len;
>   rxm->data_len = (uint16_t)rcd->len;
>   rxm->data_off = RTE_PKTMBUF_HEADROOM;
>+  rxm->ol_flags = 0;
>+  rxm->vlan_tci = 0;
> 
>-  /* Check packet type, checksum errors, etc. Only support IPv4 
>for now.
>*/
>-  if (rcd->v4) {
>-  struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct 
>ether_hdr *);
>-  struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);
>-
>-  if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct 
>ipv4_hdr))
>-  rxm->ol_flags |= PKT_RX_IPV4_HDR_EXT;
>-  else
>-  rxm->ol_flags |= PKT_RX_IPV4_HDR;
>-
>-  if (!rcd->cnc) {
>-  if (!rcd->ipc)
>-  rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD;
>-
>-  if ((rcd->tcp || rcd->udp) && !rcd->tuc)
>-  rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD;
>-  }
>-  }
>+  vmxnet3_rx_offload(rcd, rxm);
> 
>   rx_pkts[nb_rx++] = rxm;
> rcd_done:
>-- 
>2.1.4
>



[dpdk-dev] [PATCH 00/10] eal: rte_tailq api cleanup

2015-03-05 Thread Neil Horman
On Wed, Mar 04, 2015 at 10:50:00PM +0100, David Marchand wrote:
> This is a first cleanup at trying to remove references to other dpdk libraries
> from eal.
> 
> This cleanup is focused on rte_tailq api which has been marked as "for 
> internal
> use" for quite some time now.
> Rather than have a static list in eal for all users of rte_tailq, a new 
> register
> system is introduced.
> This register system uses constructors which have no access to dpdk shared
> memory, so a two step registration is done: first step inserts the requested
> tailq in a local list ("local" in multi process context), then in second step,
> eal init allocates/looks up for a real tailq from shared memory for all 
> elements
> of this local list.
> 
> I have tried to think of different cases (libraries loaded before/after eal
> init...). The unit tests have been updated accordingly.
> 
> 
> -- 
> David Marchand
> 
> David Marchand (10):
>   eal: remove yet another remaining reference to pm
>   pci: use lookup tailq api
>   tailq: remove unneeded inclusion of rte_tailq.h
>   tailq: use a single cast macro
>   tailq: get rid of broken "reserve" api
>   tailq: remove unused RTE_EAL_TAILQ_* macros
>   tailq: introduce dynamic register system
>   tailq: move to dynamic tailq
>   tailq: remove static slots
>   eal: no need for E_RTE_NO_TAILQ anymore
> 
>  app/test-pipeline/config.c |1 -
>  app/test-pipeline/init.c   |1 -
>  app/test-pipeline/main.c   |1 -
>  app/test-pipeline/runtime.c|1 -
>  app/test-pmd/cmdline.c |1 -
>  app/test-pmd/config.c  |1 -
>  app/test-pmd/csumonly.c|1 -
>  app/test-pmd/flowgen.c |1 -
>  app/test-pmd/ieee1588fwd.c |1 -
>  app/test-pmd/iofwd.c   |1 -
>  app/test-pmd/macfwd-retry.c|1 -
>  app/test-pmd/macfwd.c  |1 -
>  app/test-pmd/macswap.c |1 -
>  app/test-pmd/parameters.c  |1 -
>  app/test-pmd/rxonly.c  |1 -
>  app/test-pmd/testpmd.c |1 -
>  app/test-pmd/txonly.c  |1 -
>  app/test/commands.c|1 -
>  app/test/test.c|1 -
>  app/test/test_atomic.c |1 -
>  app/test/test_errno.c  |2 +-
>  app/test/test_func_reentrancy.c|1 -
>  app/test/test_hash.c   |1 -
>  app/test/test_hash_perf.c  |1 -
>  app/test/test_logs.c   |1 -
>  app/test/test_malloc.c |1 -
>  app/test/test_mbuf.c   |1 -
>  app/test/test_mempool.c|1 -
>  app/test/test_mempool_perf.c   |1 -
>  app/test/test_memzone.c|1 -
>  app/test/test_mp_secondary.c   |1 -
>  app/test/test_per_lcore.c  |1 -
>  app/test/test_ring.c   |1 -
>  app/test/test_rwlock.c |1 -
>  app/test/test_spinlock.c   |1 -
>  app/test/test_tailq.c  |  125 
>  app/test/test_timer.c  |1 -
>  examples/bond/main.c   |1 -
>  examples/cmdline/main.c|1 -
>  examples/dpdk_qat/crypto.c |1 -
>  examples/dpdk_qat/main.c   |1 -
>  examples/exception_path/main.c |1 -
>  examples/helloworld/main.c |1 -
>  examples/ip_fragmentation/main.c   |1 -
>  examples/ip_pipeline/config.c  |1 -
>  examples/ip_pipeline/init.c|1 -
>  examples/ip_pipeline/main.c|1 -
>  examples/ip_reassembly/main.c  |1 -
>  examples/ipv4_multicast/main.c |1 -
>  examples/kni/main.c|1 -
>  examples/l2fwd-ivshmem/guest/guest.c   |1 -
>  examples/l2fwd-jobstats/main.c |1 -
>  examples/l2fwd/main.c  |1 -
>  examples/l3fwd-acl/main.c  |1 -
>  examples/l3fwd-power/main.c|1 -
>  examples/l3fwd-vf/main.c   |1 -
>  examples/l3fwd/main.c  |1 -
>  examples/link_status_interrupt/main.c

[dpdk-dev] [PATCH 3/3 v2] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Thomas Monjalon
2015-03-05 16:31, Qiu, Michael:
> On 2015/3/5 22:39, Thomas Monjalon wrote:
> > 2015-03-05 14:03, Qiu, Michael:
> >> On 3/5/2015 9:54 PM, David Marchand wrote:
> >>> On Thu, Mar 5, 2015 at 2:50 PM, Michael Qiu  >>> > wrote:
> >>>
> >>> include/rte_cpuflags.h:154:2: error: redeclaration of enumerator
> >>> ?REG_EAX?
> >>> In file included from /usr/include/signal.h:358:0,
> >>>  from /usr/include/sys/wait.h:30,
> >>>  from /root/dpdk/app/test/test_mp_secondary.c:50:
> >>> /usr/include/sys/ucontext.h:180:3: note: previous definition of
> >>> ?REG_EAX? was here
> >>>
> >>> In i686, from REG_EAX to REG_EDX are all defined in
> >>> /usr/include/sys/ucontext.h
> >>>
> >>> Rename to CPU_REG_EAX to avoid this issue.
> >>>
> >>> Signed-off-by: Michael Qou  >>> >
> >>>
> >>>
> >>> NAK.
> >>>
> >> I have answered in you last thread, please check the mail.
> >>
> >> Yes, but for some reason, it was not include, see /usr/include/signal.h:358
> >>
> >> # include 
> >> # if defined __USE_XOPEN || defined __USE_XOPEN2K8
> >> /* This will define `ucontext_t' and `mcontext_t'.  */
> >> #  include 
> >> # endif
> >>
> >> So only if __USE_XOPEN or __USE_XOPEN2K8 been defined will include 
> >> 
> > So try to define USE_XOPEN.
> >
> >> Why NAK?
> > Because it seems you didn't really try to include system headers.
> 
> See below(ucontext.h:25):
> #ifdef __x86_64__
> ...
> #ifdef __USE_GNU
> enmu{
> ...
>   REG_RBX,
> # define REG_RBXREG_RBX
>   REG_RDX,
> # define REG_RDXREG_RDX
>   REG_RAX,
> # define REG_RAXREG_RAX
>   REG_RCX,
> # define REG_RCXREG_RCX
> ...
> };
> #endif
> ...
> #else /* !__x86_64__ */
> ...
> #ifdef __USE_GNU
> enmu{
> ...
>   REG_EBX,
> # define REG_EBXREG_EBX
>   REG_EDX,
> # define REG_EDXREG_EDX
>   REG_ECX,
> # define REG_ECXREG_ECX
>   REG_EAX,
> # define REG_EAXREG_EAX
> ...
> };
> #endif
> ...
> #endif /* !__x86_64__ */
> 
> 
> For none x86_64 platform will be defined as REG_E*X, but x86_64 will be
> REG_R*X.
> 
> This is why only happens in i686 platform.
> 
> Does this clear?

OK thanks.
So it is not possible to use this system header.
It seems your patch is a good approach.



[dpdk-dev] [PATCH] A fix to work around strict-aliasing rules breaking

2015-03-05 Thread Thomas Monjalon
2015-03-02 17:03, zhihong.wang at intel.com:
> Fixed strict-aliasing rules breaking errors for some GCC version.
> 
> Signed-off-by: Zhihong Wang 
> ---
>  .../common/include/arch/x86/rte_memcpy.h   | 44 
> --
>  1 file changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h 
> b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
> index 69a5c6f..f412099 100644
> --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
> +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
> @@ -195,6 +195,8 @@ rte_mov256blocks(uint8_t *dst, const uint8_t *src, size_t 
> n)
>  static inline void *
>  rte_memcpy(void *dst, const void *src, size_t n)
>  {
> + uintptr_t dstu = (uintptr_t)dst;
> + uintptr_t srcu = (uintptr_t)src;
>   void *ret = dst;
>   int dstofss;
>   int bits;
> @@ -204,22 +206,22 @@ rte_memcpy(void *dst, const void *src, size_t n)
>*/
>   if (n < 16) {
>   if (n & 0x01) {
> - *(uint8_t *)dst = *(const uint8_t *)src;
> - src = (const uint8_t *)src + 1;
> - dst = (uint8_t *)dst + 1;
> + *(uint8_t *)dstu = *(const uint8_t *)srcu;
> + srcu = (uintptr_t)((const uint8_t *)srcu + 1);
> + dstu = (uintptr_t)((uint8_t *)dstu + 1);
[...]

Is there another solution?
Are we going to acknowledge this fix?



[dpdk-dev] [PATCH 2/3 v2] app/test: Fix size_t printf format issue

2015-03-05 Thread Thomas Monjalon
2015-03-05 22:00, Michael Qiu:
> test_hash.c: In function ?test_crc32_hash_alg_equiv?:
> error: format ?%lu? expects argument of type ?long unsigned int?,
> but argument 2 has type ?size_t? [-Werror=format]
> 
> According to C99, for size_t type should use format "%zu"
> 
> Signed-off-by: Michael Qiu 

You forgot to add the previous acknowledgement from Bruce.



[dpdk-dev] [PATCH v4] pci: save list of detached devices, and re-probe during driver unload

2015-03-05 Thread Raz Amir
Added code that saves the pointers to the detached devices, during
driver loading, and during driver unloading, go over the list,
and re-attach them by calling device_probe_and_attach
on each device.

Signed-off-by: Raz Amir 
---
 lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 34 -
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c 
b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
index 5ae8560..7a4ed5d 100644
--- a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
+++ b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
@@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$");

 #define MAX_BARS (PCIR_MAX_BAR_0 + 1)

+#define MAX_DETACHED_DEVICES   128
+static device_t detached_devices[MAX_DETACHED_DEVICES] = {};
+static int num_detached = 0;

 struct nic_uio_softc {
device_tdev_t;
@@ -288,17 +291,38 @@ nic_uio_load(void)
function = strtol(token, NULL, 10);

dev = pci_find_bsf(bus, device, function);
-   if (dev != NULL)
-   for (i = 0; i < NUM_DEVICES; i++)
-   if (pci_get_vendor(dev) == devices[i].vend &&
-   pci_get_device(dev) == 
devices[i].dev)
-   device_detach(dev);
+   if (dev == NULL)
+   continue;
+   
+   for (i = 0; i < NUM_DEVICES; i++)
+   if (pci_get_vendor(dev) == devices[i].vend &&
+   pci_get_device(dev) == devices[i].dev) {
+   if (num_detached < 
MAX_DETACHED_DEVICES) {
+   printf("nic_uio_load: 
detaching and storing dev=%p\n", dev);
+   
detached_devices[num_detached++] = dev;
+   }
+   else
+   printf("nic_uio_load: 
reached MAX_DETACHED_DEVICES=%d. dev=%p won't be reattached\n",
+   
MAX_DETACHED_DEVICES, dev);
+   device_detach(dev);
+   }
}
 }

 static void
 nic_uio_unload(void)
 {
+   int i;
+   printf("nic_uio_unload: entered ... \n");
+
+   for (i = 0; i < num_detached; i++) {
+   printf("nic_uio_unload: calling to device_probe_and_attach for 
dev=%p...\n",
+   detached_devices[i]);
+   device_probe_and_attach(detached_devices[i]);
+   printf("nic_uio_unload: done.\n");
+   }
+
+   printf("nic_uio_unload: leaving ... \n");
 }

 static int
-- 
2.1.2



[dpdk-dev] [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 platform

2015-03-05 Thread Thomas Monjalon
2015-03-06 00:55, Michael Qiu:
> CC rte_hash.o
> Error: unsupported instruction `crc32'
> 
> The root cause is that i686 platform does not support 'crc32q'
> Need make it only available in x86_64 platform
> 
> Signed-off-by: Michael Qiu 
> ---
> v2 --> v1:
>  Make crc32 instruction only works in X86 platform
>  lib/librte_hash/rte_hash_crc.h | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
> index d28bb2a..c0a789e 100644
> --- a/lib/librte_hash/rte_hash_crc.h
> +++ b/lib/librte_hash/rte_hash_crc.h
> @@ -364,6 +364,7 @@ crc32c_2words(uint64_t data, uint32_t init_val)
>   return crc;
>  }
>  
> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>  static inline uint32_t
>  crc32c_sse42_u32(uint32_t data, uint32_t init_val)
>  {
> @@ -373,7 +374,9 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)
>   : [data] "rm" (data));
>   return init_val;
>  }
> +#endif

Wouldn't it be more elegant to define a stub which returns 0 in #else
in order to remove #ifdef below?
Not sure, matter of taste.

[...]
> @@ -455,8 +461,10 @@ rte_hash_crc_init_alg(void)
>  static inline uint32_t
>  rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>  {
> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>   if (likely(crc32_alg & CRC32_SSE42))
>   return crc32c_sse42_u32(data, init_val);
> +#endif
>  
>   return crc32c_1word(data, init_val);
>  }
> @@ -476,11 +484,15 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>  static inline uint32_t
>  rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
>  {
> +#ifdef RTE_ARCH_X86_64
>   if (likely(crc32_alg == CRC32_SSE42_x64))
>   return crc32c_sse42_u64(data, init_val);
> +#endif
>  
> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>   if (likely(crc32_alg & CRC32_SSE42))
>   return crc32c_sse42_u64_mimic(data, init_val);
> +#endif
>  
>   return crc32c_2words(data, init_val);
>  }
> 




[dpdk-dev] [PATCH] Missing use of macro rte_eth_dev_is_valid_port()

2015-03-05 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Keith Wiles
> Sent: Thursday, February 26, 2015 2:01 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] Missing use of macro rte_eth_dev_is_valid_port()
> 
> Signed-off-by: Keith Wiles 

Acked-by: John McNamara 

-- 



[dpdk-dev] [PATCH v3 6/6] ixgbe: Add LRO support

2015-03-05 Thread Vlad Zolotarov
- Only x540 and 82599 devices support LRO.
- Add the appropriate HW configuration.
- Add RSC aware rx_pkt_burst() handlers:
   - Implemented bulk allocation and non-bulk allocation versions.
   - Add LRO-specific fields to rte_eth_rxmode, to rte_eth_dev_data
 and to igb_rx_queue.
   - Use the appropriate handler when LRO is requested.

Signed-off-by: Vlad Zolotarov 
---
New in v2:
   - Removed rte_eth_dev_data.lro_bulk_alloc.
   - Fixed a few styling and spelling issues.
---
 lib/librte_ether/rte_ethdev.h   |   6 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   8 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 562 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   6 +
 5 files changed, 580 insertions(+), 7 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8db3127..9e7160a 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -320,14 +320,15 @@ struct rte_eth_rxmode {
enum rte_eth_rx_mq_mode mq_mode;
uint32_t max_rx_pkt_len;  /**< Only used if jumbo_frame enabled. */
uint16_t split_hdr_size;  /**< hdr buf size (header_split enabled).*/
-   uint8_t header_split : 1, /**< Header Split enable. */
+   uint16_t header_split : 1, /**< Header Split enable. */
hw_ip_checksum   : 1, /**< IP/UDP/TCP checksum offload enable. 
*/
hw_vlan_filter   : 1, /**< VLAN filter enable. */
hw_vlan_strip: 1, /**< VLAN strip enable. */
hw_vlan_extend   : 1, /**< Extended VLAN enable. */
jumbo_frame  : 1, /**< Jumbo Frame Receipt enable. */
hw_strip_crc : 1, /**< Enable CRC stripping by hardware. */
-   enable_scatter   : 1; /**< Enable scatter packets rx handler */
+   enable_scatter   : 1, /**< Enable scatter packets rx handler */
+   enable_lro   : 1; /**< Enable LRO */
 };

 /**
@@ -1515,6 +1516,7 @@ struct rte_eth_dev_data {
uint8_t port_id;   /**< Device [external] port identifier. */
uint8_t promiscuous   : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
scattered_rx : 1,  /**< RX of scattered packets is ON(1) / 
OFF(0) */
+   lro  : 1,  /**< RX LRO is ON(1) / OFF(0) */
all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
dev_started : 1;   /**< Device state: STARTED(1) / STOPPED(0). 
*/
 };
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index f93dcfc..a943e0b 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -1650,6 +1650,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)

/* Clear stored conf */
dev->data->scattered_rx = 0;
+   dev->data->lro = 0;
hw->rx_bulk_alloc_allowed = false;

/* Clear recorded link status */
@@ -2019,6 +2020,13 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
DEV_RX_OFFLOAD_IPV4_CKSUM |
DEV_RX_OFFLOAD_UDP_CKSUM  |
DEV_RX_OFFLOAD_TCP_CKSUM;
+
+#ifdef RTE_ETHDEV_LRO_SUPPORT
+   if (hw->mac.type == ixgbe_mac_82599EB ||
+   hw->mac.type == ixgbe_mac_X540)
+   dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO;
+#endif
+
dev_info->tx_offload_capa =
DEV_TX_OFFLOAD_VLAN_INSERT |
DEV_TX_OFFLOAD_IPV4_CKSUM  |
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index a549f5c..e206584 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -349,6 +349,11 @@ uint16_t ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct 
rte_mbuf **rx_pkts,
 uint16_t ixgbe_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);

+uint16_t ixgbe_recv_pkts_lro(void *rx_queue,
+   struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
+   struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+
 uint16_t ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index d912fa8..1a146bb 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1366,6 +1366,15 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts,
 }

 /**
+ * Detect an RSC descriptor.
+ */
+static inline uint32_t ixgbe_rsc_count(union ixgbe_adv_rx_desc *rx)
+{
+   return (rte_le_to_cpu_32(rx->wb.lower.lo_dword.data) &
+   IXGBE_RXDADV_RSCCNT_MASK) >> IXGBE_RXDADV_RSCCNT_SHIFT;
+}
+
+/**
  * Initialize the first mbuf of the returned packet:
  *- RX port identifier,
  *- hardware offload data, if any:
@@ -1410,6 

[dpdk-dev] [PATCH v3 5/6] common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option

2015-03-05 Thread Vlad Zolotarov
Enables LRO support in PMDs.

Signed-off-by: Vlad Zolotarov 
---
 config/common_linuxapp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config/common_linuxapp b/config/common_linuxapp
index 97f1c9e..5b98595 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -137,6 +137,7 @@ CONFIG_RTE_MAX_ETHPORTS=32
 CONFIG_RTE_LIBRTE_IEEE1588=n
 CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
+CONFIG_RTE_ETHDEV_LRO_SUPPORT=y

 #
 # Support NIC bypass logic
-- 
2.1.0



[dpdk-dev] [PATCH v3 4/6] ixgbe: Unify the rx_pkt_bulk callback initialization

2015-03-05 Thread Vlad Zolotarov
   - Set the callback in a single function that is called from
 ixgbe_dev_rx_init() for a primary process and from eth_ixgbe_dev_init()
 for a secondary processes. This is instead of multiple, hard to track 
places.
   - Removed rte_eth_dev_data.lro_bulk_alloc and added 
ixgbe_hw.rx_bulk_alloc_allowed
 instead.
   - Bug fix: vector scattered packets callback was called regardless the 
appropriate
  preconditions.

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |   1 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  14 ++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 158 
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |  20 +++-
 4 files changed, 128 insertions(+), 65 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h 
b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
index c67d462..c60081c 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
@@ -3657,6 +3657,7 @@ struct ixgbe_hw {
bool force_full_reset;
bool allow_unsupported_sfp;
bool wol_enabled;
+   bool rx_bulk_alloc_allowed;
 };

 #define ixgbe_call_func(hw, func, params, error) \
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 9bdc046..f93dcfc 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -760,8 +760,8 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct 
eth_driver *eth_drv,
   "Using default TX function.");
}

-   if (eth_dev->data->scattered_rx)
-   eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+   set_rx_function(eth_dev);
+
return 0;
}
pci_dev = eth_dev->pci_dev;
@@ -771,6 +771,15 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct 
eth_driver *eth_drv,
hw->vendor_id = pci_dev->id.vendor_id;
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
hw->allow_unsupported_sfp = 1;
+#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
+   /*
+* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
+* allocation preconditions we will reset it.
+*/
+   hw->rx_bulk_alloc_allowed = true;
+#else
+   hw->rx_bulk_alloc_allowed = false;
+#endif /* RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC */

/* Initialize the shared code (base driver) */
 #ifdef RTE_NIC_BYPASS
@@ -1641,6 +1650,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)

/* Clear stored conf */
dev->data->scattered_rx = 0;
+   hw->rx_bulk_alloc_allowed = false;

/* Clear recorded link status */
memset(, 0, sizeof(link));
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index c1a2823..d912fa8 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -2096,12 +2096,12 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused 
struct igb_rx_queue *rxq)

 /* Reset dynamic igb_rx_queue fields back to defaults */
 static void
-ixgbe_reset_rx_queue(struct igb_rx_queue *rxq)
+ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct igb_rx_queue *rxq)
 {
static const union ixgbe_adv_rx_desc zeroed_desc = { .read = {
.pkt_addr = 0}};
unsigned i;
-   uint16_t len;
+   uint16_t len = rxq->nb_rx_desc;

/*
 * By default, the Rx queue setup function allocates enough memory for
@@ -2113,14 +2113,9 @@ ixgbe_reset_rx_queue(struct igb_rx_queue *rxq)
 * constraints here to see if we need to zero out memory after the end
 * of the H/W descriptor ring.
 */
-#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
-   if (check_rx_burst_bulk_alloc_preconditions(rxq) == 0)
+   if (hw->rx_bulk_alloc_allowed)
/* zero out extra memory */
-   len = (uint16_t)(rxq->nb_rx_desc + RTE_PMD_IXGBE_RX_MAX_BURST);
-   else
-#endif
-   /* do not zero out extra memory */
-   len = rxq->nb_rx_desc;
+   len += RTE_PMD_IXGBE_RX_MAX_BURST;

/*
 * Zero out HW ring memory. Zero out extra memory at the end of
@@ -2162,7 +2157,6 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
const struct rte_memzone *rz;
struct igb_rx_queue *rxq;
struct ixgbe_hw *hw;
-   int use_def_burst_func = 1;
uint16_t len;

PMD_INIT_FUNC_TRACE();
@@ -2247,11 +2241,10 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 * S/W ring to make sure look-ahead logic in bulk alloc Rx burst
 * function does not access an invalid memory region.
 */
-#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
-   len = (uint16_t)(nb_desc + RTE_PMD_IXGBE_RX_MAX_BURST);
-#else
len = nb_desc;
-#endif
+   if (hw->rx_bulk_alloc_allowed)
+   len += RTE_PMD_IXGBE_RX_MAX_BURST;
+
rxq->sw_ring = 

[dpdk-dev] [PATCH v3 3/6] ixgbe: Code refactoring

2015-03-05 Thread Vlad Zolotarov
- ixgbe_rx_alloc_bufs():
   - Reset the rte_mbuf fields only when requested.
   - Take the RDT update out of the function.
   - Add the stub when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is not defined.
- ixgbe_recv_scattered_pkts():
   - Take the code that updates the fields of the cluster's HEAD buffer into
 the inline function.

Signed-off-by: Vlad Zolotarov 
---
New in v3:
   - ixgbe_rx_alloc_bufs(): Always reset refcnt of the buffers to 1.
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 114 +++---
 1 file changed, 69 insertions(+), 45 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 35a88d8..c1a2823 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1022,7 +1022,7 @@ ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
 }

 static inline int
-ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
+ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq, bool reset_mbuf)
 {
volatile union ixgbe_adv_rx_desc *rxdp;
struct igb_rx_entry *rxep;
@@ -1043,11 +1043,14 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
for (i = 0; i < rxq->rx_free_thresh; ++i) {
/* populate the static rte mbuf fields */
mb = rxep[i].mbuf;
+   if (reset_mbuf) {
+   mb->next = NULL;
+   mb->nb_segs = 1;
+   mb->port = rxq->port_id;
+   }
+
rte_mbuf_refcnt_set(mb, 1);
-   mb->next = NULL;
mb->data_off = RTE_PKTMBUF_HEADROOM;
-   mb->nb_segs = 1;
-   mb->port = rxq->port_id;

/* populate the descriptors */
dma_addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb));
@@ -1055,10 +1058,6 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
rxdp[i].read.pkt_addr = dma_addr;
}

-   /* update tail pointer */
-   rte_wmb();
-   IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rxq->rx_free_trigger);
-
/* update state of internal queue structure */
rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
@@ -1110,7 +1109,9 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,

/* if required, allocate new buffers to replenish descriptors */
if (rxq->rx_tail > rxq->rx_free_trigger) {
-   if (ixgbe_rx_alloc_bufs(rxq) != 0) {
+   uint16_t cur_free_trigger = rxq->rx_free_trigger;
+
+   if (ixgbe_rx_alloc_bufs(rxq, true) != 0) {
int i, j;
PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
   "queue_id=%u", (unsigned) rxq->port_id,
@@ -1130,6 +1131,10 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,

return 0;
}
+
+   /* update tail pointer */
+   rte_wmb();
+   IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, cur_free_trigger);
}

if (rxq->rx_tail >= rxq->nb_rx_desc)
@@ -1169,6 +1174,13 @@ ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct 
rte_mbuf **rx_pkts,

return nb_rx;
 }
+#else
+static inline int
+ixgbe_rx_alloc_bufs(__rte_unused struct igb_rx_queue *rxq,
+   __rte_unused bool reset_mbuf)
+{
+   return -ENOMEM;
+}
 #endif /* RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC */

 uint16_t
@@ -1353,6 +1365,51 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts,
return (nb_rx);
 }

+/**
+ * Initialize the first mbuf of the returned packet:
+ *- RX port identifier,
+ *- hardware offload data, if any:
+ *  - RSS flag & hash,
+ *  - IP checksum flag,
+ *  - VLAN TCI, if any,
+ *  - error flags.
+ * @head HEAD of the packet cluster
+ * @desc HW descriptor to get data from
+ * @port_id Port ID of the Rx queue
+ */
+static inline void ixgbe_fill_cluster_head_buf(
+   struct rte_mbuf *head,
+   union ixgbe_adv_rx_desc *desc,
+   uint8_t port_id,
+   uint32_t staterr)
+{
+   uint32_t hlen_type_rss;
+   uint64_t pkt_flags;
+
+   head->port = port_id;
+
+   /*
+* The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
+* set in the pkt_flags field.
+*/
+   head->vlan_tci = rte_le_to_cpu_16(desc->wb.upper.vlan);
+   hlen_type_rss = rte_le_to_cpu_32(desc->wb.lower.lo_dword.data);
+   pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
+   pkt_flags |= rx_desc_status_to_pkt_flags(staterr);
+   pkt_flags |= rx_desc_error_to_pkt_flags(staterr);
+   head->ol_flags = pkt_flags;
+
+   if (likely(pkt_flags & PKT_RX_RSS_HASH))
+   head->hash.rss = rte_le_to_cpu_32(desc->wb.lower.hi_dword.rss);
+   else if (pkt_flags & PKT_RX_FDIR) {
+   head->hash.fdir.hash =
+   

[dpdk-dev] [PATCH v3 2/6] ixgbe: Bug fix: Properly configure Rx CRC stripping for x540 devices

2015-03-05 Thread Vlad Zolotarov
According to x540 spec chapter 8.2.4.8.9 CRCSTRIP field of RDRXCTL should
be configured to the same value as HLREG0.RXCRCSTRP.

Clearing the RDRXCTL.RSCFRSTSIZE field for x540 is not required by the spec
but seems harmless.

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 6c0e466..35a88d8 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3687,7 +3687,8 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)

IXGBE_WRITE_REG(hw, IXGBE_RXCSUM, rxcsum);

-   if (hw->mac.type == ixgbe_mac_82599EB) {
+   if (hw->mac.type == ixgbe_mac_82599EB ||
+   hw->mac.type == ixgbe_mac_X540) {
rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
if (rx_conf->hw_strip_crc)
rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
-- 
2.1.0



[dpdk-dev] [PATCH v3 1/6] ixgbe: Cleanups

2015-03-05 Thread Vlad Zolotarov
   - Removed the not needed casting.
   - Use the rte_le_to_cpu_xx()/rte_cpu_to_le_xx() when reading/setting HW
 ring descriptor fields. There were a few places where fields were 
accessed/written
 directly, which would break on big endian platforms like Power PC.
   - ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable 
to access
  >data->dev_conf.rxmode.

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 52 +--
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 3059375..6c0e466 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1028,12 +1028,11 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
struct igb_rx_entry *rxep;
struct rte_mbuf *mb;
uint16_t alloc_idx;
-   uint64_t dma_addr;
+   __le64 dma_addr;
int diag, i;

/* allocate buffers in bulk directly into the S/W ring */
-   alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-   (rxq->rx_free_thresh - 1));
+   alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);
rxep = >sw_ring[alloc_idx];
diag = rte_mempool_get_bulk(rxq->mb_pool, (void *)rxep,
rxq->rx_free_thresh);
@@ -1051,7 +1050,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
mb->port = rxq->port_id;

/* populate the descriptors */
-   dma_addr = (uint64_t)mb->buf_physaddr + RTE_PKTMBUF_HEADROOM;
+   dma_addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb));
rxdp[i].read.hdr_addr = dma_addr;
rxdp[i].read.pkt_addr = dma_addr;
}
@@ -1061,10 +1060,9 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rxq->rx_free_trigger);

/* update state of internal queue structure */
-   rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_trigger +
-   rxq->rx_free_thresh);
+   rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
-   rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
+   rxq->rx_free_trigger = rxq->rx_free_thresh - 1;

/* no errors */
return 0;
@@ -1559,13 +1557,14 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct 
rte_mbuf **rx_pkts,
first_seg->ol_flags = pkt_flags;

if (likely(pkt_flags & PKT_RX_RSS_HASH))
-   first_seg->hash.rss = rxd.wb.lower.hi_dword.rss;
+   first_seg->hash.rss =
+   rte_le_to_cpu_32(rxd.wb.lower.hi_dword.rss);
else if (pkt_flags & PKT_RX_FDIR) {
first_seg->hash.fdir.hash =
-   (uint16_t)((rxd.wb.lower.hi_dword.csum_ip.csum)
-  & IXGBE_ATR_HASH_MASK);
+   rte_le_to_cpu_16(rxd.wb.lower.hi_dword.csum_ip.csum)
+  & IXGBE_ATR_HASH_MASK;
first_seg->hash.fdir.id =
-   rxd.wb.lower.hi_dword.csum_ip.ip_id;
+ rte_le_to_cpu_16(rxd.wb.lower.hi_dword.csum_ip.ip_id);
}

/* Prefetch data of first segment, if configured to do so. */
@@ -2248,6 +2247,12 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 #ifdef RTE_IXGBE_INC_VECTOR
ixgbe_rxq_vec_setup(rxq);
 #endif
+   /*
+* TODO: This must be moved to ixgbe_dev_rx_init() since rx_pkt_burst
+* is a global per-device callback thus bulk allocation may be used
+* only if all queues meet the above preconditions.
+*/
+
/* Check if pre-conditions are satisfied, and no Scattered Rx */
if (!use_def_burst_func && !dev->data->scattered_rx) {
 #ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
@@ -3523,6 +3528,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
uint32_t rxcsum;
uint16_t buf_size;
uint16_t i;
+   struct rte_eth_rxmode *rx_conf = >data->dev_conf.rxmode;

PMD_INIT_FUNC_TRACE();
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3545,7 +3551,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 * Configure CRC stripping, if any.
 */
hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-   if (dev->data->dev_conf.rxmode.hw_strip_crc)
+   if (rx_conf->hw_strip_crc)
hlreg0 |= IXGBE_HLREG0_RXCRCSTRP;
else
hlreg0 &= ~IXGBE_HLREG0_RXCRCSTRP;
@@ -3553,11 +3559,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
/*
 * Configure jumbo frame support, if any.
 */
-   if 

[dpdk-dev] [PATCH v3 0/6]: Add LRO support to ixgbe PMD

2015-03-05 Thread Vlad Zolotarov
This series adds the missing flow for enabling the LRO in the ethdev and
adds a support for this feature in the ixgbe PMD. There is a big hope that this
initiative is going to be picked up by some Intel developer that would add the 
LRO support
to other Intel PMDs. ;)

The series starts with some cleanup work in the code the final patch (the 
actual adding of
the LRO support) is going to touch/use/change. There are still quite a few 
issues in the ixgbe
PMD code left but they have to be a matter of a different series and I've left 
a few "TODO"
remarks in the code.

The LRO ("RSC" in Intel's context) PMD completion handling code follows the 
same design as the
corresponding Linux and FreeBSD implementation: pass the aggregation's cluster 
HEAD buffer to
the NEXTP entry of the software ring till EOP is met.

HW configuration follows the corresponding specs: this feature is supported 
only by x540 and
82599 PF devices.

The feature has been tested with seastar TCP stack with the following 
configuration on Tx side:
   - MTU: 400B
   - 100 concurrent TCP connections.

The results were:
   - Without LRO: total throughput: 0.12Gbps, coefficient of variance: 1.41%
   - With LRO:total throughput: 8.21Gbps, coefficient of variance: 0.59%

This is an almost factor 80 improvement.

New in v3:
   - ixgbe_rx_alloc_bufs(): Always reset refcnt of the buffers to 1. Otherwise 
rte_pktmbuf_free()
 won't free them.

New in v2:
   - Removed rte_eth_dev_data.lro_bulk_alloc and added 
ixgbe_hw.rx_bulk_alloc_allowed
 instead.
   - Unified the rx_pkt_bulk callback setting (a separate new patch).
   - Fixed a few styling and spelling issues.


Vlad Zolotarov (6):
  ixgbe: Cleanups
  ixgbe: Bug fix: Properly configure Rx CRC stripping for x540 devices
  ixgbe: Code refactoring
  ixgbe: Unify the rx_pkt_bulk callback initialization
  common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option
  ixgbe: Add LRO support

 config/common_linuxapp  |   1 +
 lib/librte_ether/rte_ethdev.h   |   6 +-
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |   1 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  22 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 867 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |  26 +-
 7 files changed, 797 insertions(+), 131 deletions(-)

-- 
2.1.0



[dpdk-dev] [PATCH v4] pci: save list of detached devices, and re-probe during driver unload

2015-03-05 Thread Raz Amir
Added code that saves the pointers to the detached devices, during
driver loading, and during driver unloading, go over the list,
and re-attach them by calling device_probe_and_attach
on each device.

Signed-off-by: Raz Amir 
---
 lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 34 -
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c 
b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
index 5ae8560..7a4ed5d 100644
--- a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
+++ b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
@@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$");

 #define MAX_BARS (PCIR_MAX_BAR_0 + 1)

+#define MAX_DETACHED_DEVICES   128
+static device_t detached_devices[MAX_DETACHED_DEVICES] = {};
+static int num_detached = 0;

 struct nic_uio_softc {
device_tdev_t;
@@ -288,17 +291,38 @@ nic_uio_load(void)
function = strtol(token, NULL, 10);

dev = pci_find_bsf(bus, device, function);
-   if (dev != NULL)
-   for (i = 0; i < NUM_DEVICES; i++)
-   if (pci_get_vendor(dev) == devices[i].vend &&
-   pci_get_device(dev) == 
devices[i].dev)
-   device_detach(dev);
+   if (dev == NULL)
+   continue;
+   
+   for (i = 0; i < NUM_DEVICES; i++)
+   if (pci_get_vendor(dev) == devices[i].vend &&
+   pci_get_device(dev) == devices[i].dev) {
+   if (num_detached < 
MAX_DETACHED_DEVICES) {
+   printf("nic_uio_load: 
detaching and storing dev=%p\n", dev);
+   
detached_devices[num_detached++] = dev;
+   }
+   else
+   printf("nic_uio_load: 
reached MAX_DETACHED_DEVICES=%d. dev=%p won't be reattached\n",
+   
MAX_DETACHED_DEVICES, dev);
+   device_detach(dev);
+   }
}
 }

 static void
 nic_uio_unload(void)
 {
+   int i;
+   printf("nic_uio_unload: entered ... \n");
+
+   for (i = 0; i < num_detached; i++) {
+   printf("nic_uio_unload: calling to device_probe_and_attach for 
dev=%p...\n",
+   detached_devices[i]);
+   device_probe_and_attach(detached_devices[i]);
+   printf("nic_uio_unload: done.\n");
+   }
+
+   printf("nic_uio_unload: leaving ... \n");
 }

 static int
-- 
2.1.2



[dpdk-dev] [PATCH 2/2] virtio: allow running w/o vlan filtering

2015-03-05 Thread Stephen Hemminger
Vlan filtering is an option, and not a requirement.
If host does not support filtering then it can be done in software.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_virtio/virtio_ethdev.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c 
b/lib/librte_pmd_virtio/virtio_ethdev.c
index e2600de..5e43411 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -1288,7 +1288,6 @@ virtio_dev_configure(struct rte_eth_dev *dev)
&& !vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {
PMD_DRV_LOG(NOTICE,
"vlan filtering not available on this host");
-   return -ENOTSUP;
}

if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
-- 
2.1.4



[dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized

2015-03-05 Thread Stephen Hemminger
The virtio driver needs to use in/out instructions therefore it
must initialize using iopl(2) system call. The problem is that
virtio initialization happens very early, and any application
that uses daemon() or calls eal_init later in another context
will fail.

The fix is to move the iopl into rte_eal_init.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_eal/linuxapp/eal/eal.c | 5 +
 lib/librte_pmd_virtio/virtio_ethdev.c | 5 -
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index 16f9e7c..76481f7 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -764,6 +764,11 @@ rte_eal_init(int argc, char **argv)
rte_panic("Cannot init IVSHMEM\n");
 #endif

+#ifdef RTE_LIBRTE_VIRTIO_PMD
+   if (rte_eal_iopl_init() != 0)
+   rte_panic("IOPL call failed - cannot use virtio PMD");
+#endif
+
if (rte_eal_memory_init() < 0)
rte_panic("Cannot init memory\n");

diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c 
b/lib/librte_pmd_virtio/virtio_ethdev.c
index d239083..e2600de 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -1247,11 +1247,6 @@ static int
 rte_virtio_pmd_init(const char *name __rte_unused,
const char *param __rte_unused)
 {
-   if (rte_eal_iopl_init() != 0) {
-   PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
-   return -1;
-   }
-
rte_eth_driver_register(_virtio_pmd);
return 0;
 }
-- 
2.1.4



[dpdk-dev] [PATCH 0/2] virtio: bugfixes

2015-03-05 Thread Stephen Hemminger
These are patches we are using in latest release to make
our application work with virtio.

Stephen Hemminger (2):
  virtio: initialize iopl when device is initialized
  virtio: allow running w/o vlan filtering

 lib/librte_eal/linuxapp/eal/eal.c | 5 +
 lib/librte_pmd_virtio/virtio_ethdev.c | 6 --
 2 files changed, 5 insertions(+), 6 deletions(-)

-- 
2.1.4



[dpdk-dev] [PATCH 1/3] librte_hash: Fix unsupported instruction `crc32' in i686 platform

2015-03-05 Thread Qiu, Michael
On 2015/3/6 0:12, Yerden Zhumabekov wrote:
> Hi Michael,
>
> Thanks for this patch, in fact I didn't try to compile it on i686 when
> developing original software fallback for CRC32.
>
> I think if we want to make code compilable as wide as possible, we
> should compile out all SSE4.2 instructions. As to the patch, we may
> compile out 'crc32l' instruction emitting code if the arch is not x86.
> This concerns two functions: crc32c_sse42_u32() and
> crc32c_sse42_u64_mimic().

OK, I will add the check for crc32l, make it only works for x86

Thanks,
Michael
> The compile check might be something like this:
>
> #if defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_64)
> #endif
>
> Otherwise, the patch looks good.
>
> 05.03.2015 19:15, Michael Qiu ?:
>> CC rte_hash.o
>> Error: unsupported instruction `crc32'
>>
>> The root cause is that i686 platform does not support 'crc32q'
>> Need make it only available in x86_64 platform
>>
>> Signed-off-by: Michael Qiu 
>> ---
>>  lib/librte_hash/rte_hash_crc.h | 4 
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
>> index d28bb2a..4e9546f 100644
>> --- a/lib/librte_hash/rte_hash_crc.h
>> +++ b/lib/librte_hash/rte_hash_crc.h
>> @@ -374,6 +374,7 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)
>>  return init_val;
>>  }
>>  
>> +#ifdef RTE_ARCH_X86_64
>>  static inline uint32_t
>>  crc32c_sse42_u64(uint64_t data, uint64_t init_val)
>>  {
>> @@ -383,6 +384,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
>>  : [data] "rm" (data));
>>  return init_val;
>>  }
>> +#endif
>>  
>>  static inline uint32_t
>>  crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
>> @@ -476,8 +478,10 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>>  static inline uint32_t
>>  rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
>>  {
>> +#ifdef RTE_ARCH_X86_64
>>  if (likely(crc32_alg == CRC32_SSE42_x64))
>>  return crc32c_sse42_u64(data, init_val);
>> +#endif
>>  
>>  if (likely(crc32_alg & CRC32_SSE42))
>>  return crc32c_sse42_u64_mimic(data, init_val);



[dpdk-dev] [PATCH 3/3 v2] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Qiu, Michael
On 2015/3/5 22:39, Thomas Monjalon wrote:
> 2015-03-05 14:03, Qiu, Michael:
>> On 3/5/2015 9:54 PM, David Marchand wrote:
>>> On Thu, Mar 5, 2015 at 2:50 PM, Michael Qiu >> > wrote:
>>>
>>> include/rte_cpuflags.h:154:2: error: redeclaration of enumerator
>>> ?REG_EAX?
>>> In file included from /usr/include/signal.h:358:0,
>>>  from /usr/include/sys/wait.h:30,
>>>  from /root/dpdk/app/test/test_mp_secondary.c:50:
>>> /usr/include/sys/ucontext.h:180:3: note: previous definition of
>>> ?REG_EAX? was here
>>>
>>> In i686, from REG_EAX to REG_EDX are all defined in
>>> /usr/include/sys/ucontext.h
>>>
>>> Rename to CPU_REG_EAX to avoid this issue.
>>>
>>> Signed-off-by: Michael Qou >> >
>>>
>>>
>>> NAK.
>>>
>> I have answered in you last thread, please check the mail.
>>
>> Yes, but for some reason, it was not include, see /usr/include/signal.h:358
>>
>> # include 
>> # if defined __USE_XOPEN || defined __USE_XOPEN2K8
>> /* This will define `ucontext_t' and `mcontext_t'.  */
>> #  include 
>> # endif
>>
>> So only if __USE_XOPEN or __USE_XOPEN2K8 been defined will include 
>> 
> So try to define USE_XOPEN.
>
>> Why NAK?
> Because it seems you didn't really try to include system headers.

See below(ucontext.h:25):
#ifdef __x86_64__
...
#ifdef __USE_GNU
enmu{
...
  REG_RBX,
# define REG_RBXREG_RBX
  REG_RDX,
# define REG_RDXREG_RDX
  REG_RAX,
# define REG_RAXREG_RAX
  REG_RCX,
# define REG_RCXREG_RCX
...
};
#endif
...
#else /* !__x86_64__ */
...
#ifdef __USE_GNU
enmu{
...
  REG_EBX,
# define REG_EBXREG_EBX
  REG_EDX,
# define REG_EDXREG_EDX
  REG_ECX,
# define REG_ECXREG_ECX
  REG_EAX,
# define REG_EAXREG_EAX
...
};
#endif
...
#endif /* !__x86_64__ */


For none x86_64 platform will be defined as REG_E*X, but x86_64 will be
REG_R*X.

This is why only happens in i686 platform.

Does this clear?

Thanks,
Michael
> We must avoid redefine existing symbols. That's why this bug happens.
> Michael, thanks for trying to fix this issue. It's appreciated even if
> the first solution is refused.
>
>



[dpdk-dev] [PATCH] mk: Remove '-fdirectives-only' flag from mk/rte.sdkconfig.mk

2015-03-05 Thread Tetsuya Mukawa
The '-fdirectives-only' flag doesn't exist in cpp of FreeBSD.
To remove expanding macros when parsing the config files won't
add any issue.

Signed-off-by: Tetsuya Mukawa 
---
 mk/rte.sdkconfig.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index d43c430..f8d95b1 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -75,7 +75,7 @@ else
 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
$(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" 
]; then \
$(CPP) -undef -P -x assembler-with-cpp \
-   -fdirectives-only -ffreestanding \
+   -ffreestanding \
-o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; 
then \
cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \
-- 
1.9.1



[dpdk-dev] [PATCH] testpmd: Fix port validation code of "port stop all" command

2015-03-05 Thread Tetsuya Mukawa
When "port stop all" is executed, the command doesn't work as it should
because of wrong port validation. The patch fixes this issue.

Reported-by: Pablo de Lara 
Signed-off-by: Tetsuya Mukawa 
---
 app/test-pmd/testpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 61291be..bb65342 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1484,7 +1484,7 @@ stop_port(portid_t pid)
printf("Stopping ports...\n");

FOREACH_PORT(pi, ports) {
-   if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
+   if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;

port = [pi];
-- 
1.9.1



[dpdk-dev] [PATCH v2 5/6] common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option

2015-03-05 Thread Vlad Zolotarov


On 03/05/15 16:01, Thomas Monjalon wrote:
> 2015-03-05 15:39, Vlad Zolotarov:
>> On 03/05/15 15:19, Thomas Monjalon wrote:
>>> 2015-03-05 13:28, Vlad Zolotarov:
 Enables LRO support in PMDs.

 Signed-off-by: Vlad Zolotarov 
 ---
config/common_linuxapp | 1 +
1 file changed, 1 insertion(+)

 diff --git a/config/common_linuxapp b/config/common_linuxapp
 index 97f1c9e..5b98595 100644
 --- a/config/common_linuxapp
 +++ b/config/common_linuxapp
 @@ -137,6 +137,7 @@ CONFIG_RTE_MAX_ETHPORTS=32
CONFIG_RTE_LIBRTE_IEEE1588=n
CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
 +CONFIG_RTE_ETHDEV_LRO_SUPPORT=y
>>> Sorry I don't really follow this ixgbe discussion but I wonder why you
>>> would add a compile time option for this feature.
>> The only reason is to be able to detect that the feature is present in
>> the DPDK version u r compiling against because of the API change.
>> Currently, this can't be done using the DPDK version thus we may either
> Why you cannot use version? In development phase?
> When released, you'll be able to test >= 2.1.

Of course! When the version bumps, the #ifdef I've mentioned above may 
be replaced with the version check.

>
>> do a try-compilation and if it fails define some application-level macro
>> disabling
>> the feature usage or we may define a macro in the library level
>> (together with tons of other such macros like those in the patch snippet
>> above).
> I'd prefer a request rte_eth_dev_info_get() to advertise that the feature
> is available with the device and driver.
> Please let's try to remove config options and #ifdefs.

This is exactly what my patch does. But that's not ending there - there 
is a new feature bit added in rte_eth_rxmode (enable_lro) and in order 
to compile the application has to know somehow if this bit is present or 
not. How do u propose to do this now?
Of course, I can put such macro in my own tree but then I'll have to 
rebase all the time and inform other developers that will have to work 
against my tree (and not upstream as it's supposed to be) - to update. 
This sounds like a hassle thus I added this macro to resolve this issue 
until the version is bumped.

>
>>> What is the benefit of disabling it?
>> No benefit whatsoever.
>>
>>> And if really needed, this patch would make more sense merged with the
>>> code under ifdef.
>> I strongly disagree - the amount of #ifdefs in the DPDK source is
>> absolutely enormous. It makes reading and  understanding the code really
>> hard.
> I agree. You misunderstand me.
> I was just saying that this patch should be merged.
>
>> Therefore, I tried to reduce the amount of time the already existing
>> macros have to be queried (see PATCH4). And of course I don't see any
>> sense of adding new ones more than really needed. And in LRO case - it's
>> a single time, where the feature is manifested by the HW.



[dpdk-dev] [PATCH v3 10/10] vmxnet3: remove excess inlining

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

No reason to inline large functions. Compiler will decide already
based on optimization level.

Also register array should be const.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index f6c3452..cabb505 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -84,10 +84,8 @@
 #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \
(uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)

-static uint32_t rxprod_reg[2] = {VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2};
+static const uint32_t rxprod_reg[2] = {VMXNET3_REG_RXPROD, 
VMXNET3_REG_RXPROD2};

-static inline int vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t* , uint8_t);
-static inline void vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *);
 #ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER_NOT_USED
 static void vmxnet3_rxq_dump(struct vmxnet3_rx_queue *);
 static void vmxnet3_txq_dump(struct vmxnet3_tx_queue *);
@@ -157,7 +155,7 @@ vmxnet3_txq_dump(struct vmxnet3_tx_queue *txq)
 }
 #endif

-static inline void
+static void
 vmxnet3_cmd_ring_release_mbufs(vmxnet3_cmd_ring_t *ring)
 {
while (ring->next2comp != ring->next2fill) {
@@ -296,7 +294,7 @@ vmxnet3_dev_clear_queues(struct rte_eth_dev *dev)
}
 }

-static inline void
+static void
 vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
 {
int completed = 0;
@@ -472,7 +470,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
  *  only for LRO.
  *
  */
-static inline int
+static int
 vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t ring_id)
 {
int err = 0;
-- 
2.1.4



[dpdk-dev] [PATCH v3 09/10] vmxnet3: add check for jumbo segment

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

It is possible that some rogue application might pass a segment
larger than 16K to the vmxnet3 transmit routine. In which case
just drop it and increment counter.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_vmxnet3/vmxnet3_ring.h |  1 +
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 18 ++
 2 files changed, 19 insertions(+)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h 
b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
index 55ceadf..5cdcb23 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
@@ -126,6 +126,7 @@ struct vmxnet3_txq_stats {
 * different reasons
 */
uint64_tdrop_too_many_segs;
+   uint64_tdrop_too_big;
uint64_tdrop_tso;
uint64_ttx_ring_full;
 };
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index 3bd13ef..f6c3452 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -327,6 +327,17 @@ vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.", completed);
 }

+static inline int
+vmxnet3_seg_too_big(const struct rte_mbuf *m)
+{
+   do {
+   if (m->data_len > VMXNET3_MAX_TX_BUF_SIZE)
+   return 1;
+   } while  ((m = m->next) != NULL);
+
+   return 0;
+}
+
 uint16_t
 vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
  uint16_t nb_pkts)
@@ -353,6 +364,13 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf 
**tx_pkts,
/* Is this packet execessively fragmented, then drop */
if (unlikely(txm->nb_segs > VMXNET3_MAX_TXD_PER_PKT)) {
++txq->stats.drop_too_many_segs;
+   goto drop;
+   }
+
+   /* Check for case of monster segment */
+   if (unlikely(vmxnet3_seg_too_big(txm))) {
+   ++txq->stats.drop_too_big;
+   drop:
++txq->stats.drop_total;
rte_pktmbuf_free(txm);
++nb_tx;
-- 
2.1.4



[dpdk-dev] [PATCH v3 08/10] vmxnet3: get rid of DEBUG ifdefs

2015-03-05 Thread Stephen Hemminger
By defining macro as a stub it is possible to get rid of #ifdef's
in the actual code. Always evaluate the argument (even in the stub)
so that there are no extra unused variable errors.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h |  6 --
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   | 13 ++---
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h 
b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
index 83182e2..1c0d95f 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
@@ -35,9 +35,11 @@
 #define _VMXNET3_ETHDEV_H_

 #ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
-#define VMXNET3_ASSERT(x) do { \
-   if (!(x)) rte_panic("VMXNET3: x"); \
+#define VMXNET3_ASSERT(x) do { \
+   if (unlikely(!(x))) rte_panic("VMXNET3: %s\n", #x); \
 } while(0)
+#else
+#define VMXNET3_ASSERT(x) do { (void)(x); } while (0)
 #endif

 #define VMXNET3_MAX_MAC_ADDRS 1
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index 5cf187a..3bd13ef 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -307,9 +307,7 @@ vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)

while (tcd->gen == comp_ring->gen) {
/* Release cmd_ring descriptor and free mbuf */
-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
VMXNET3_ASSERT(txq->cmd_ring.base[tcd->txdIdx].txd.eop == 1);
-#endif

while (txq->cmd_ring.next2comp != tcd->txdIdx) {
mbuf = 
txq->cmd_ring.buf_info[txq->cmd_ring.next2comp].m;
@@ -570,6 +568,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
uint8_t ring_idx;
vmxnet3_rx_queue_t *rxq;
Vmxnet3_RxCompDesc *rcd;
+   Vmxnet3_RxDesc *rxd;
vmxnet3_buf_info_t *rbi;
struct rte_mbuf *rxm = NULL;
struct vmxnet3_hw *hw;
@@ -596,16 +595,12 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
idx = rcd->rxdIdx;
ring_idx = (uint8_t)((rcd->rqID == rxq->qid1) ? 0 : 1);
rbi = rxq->cmd_ring[ring_idx].buf_info + idx;
-
+   rxd = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx;

PMD_RX_LOG(DEBUG, "rxd idx: %d ring idx: %d.", idx, ring_idx);

-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
-   Vmxnet3_RxDesc *rxd
-   = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx;
VMXNET3_ASSERT(rcd->len <= rxd->len);
VMXNET3_ASSERT(rbi->m);
-#endif

/* Get the packet buffer pointer from buf_info */
rxm = rbi->m;
@@ -652,10 +647,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
 * the last mbuf of the current packet.
 */
if (rcd->sop) {
-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
VMXNET3_ASSERT(!rxq->start_seg);
VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_HEAD);
-#endif

if (unlikely(rcd->len == 0)) {
PMD_RX_LOG(DEBUG,
@@ -670,10 +663,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
} else {
struct rte_mbuf *start = rxq->start_seg;

-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY);
VMXNET3_ASSERT(start != NULL);
-#endif

start->pkt_len += rxm->data_len;
start->nb_segs++;
-- 
2.1.4



[dpdk-dev] [PATCH v3 07/10] vmxnet3: support jumbo frames

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

Add support for linking multi-segment buffers together to
handle Jumbo packets.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c |  3 +-
 lib/librte_pmd_vmxnet3/vmxnet3_ring.h   |  2 +
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   | 76 -
 3 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
index 35bb561..4f1bc4f 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
@@ -401,6 +401,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 {
struct rte_eth_conf port_conf = dev->data->dev_conf;
struct vmxnet3_hw *hw = dev->data->dev_private;
+   uint32_t mtu = dev->data->mtu;
Vmxnet3_DriverShared *shared = hw->shared;
Vmxnet3_DSDevRead *devRead = >devRead;
uint32_t *mac_ptr;
@@ -418,7 +419,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
devRead->misc.driverInfo.vmxnet3RevSpt = 1;
devRead->misc.driverInfo.uptVerSpt = 1;

-   devRead->misc.mtu = rte_le_to_cpu_32(dev->data->mtu);
+   devRead->misc.mtu = rte_le_to_cpu_32(mtu);
devRead->misc.queueDescPA  = hw->queueDescPA;
devRead->misc.queueDescLen = hw->queue_desc_len;
devRead->misc.numTxQueues  = hw->num_tx_queues;
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h 
b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
index 612487e..55ceadf 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
@@ -171,6 +171,8 @@ typedef struct vmxnet3_rx_queue {
uint32_tqid1;
uint32_tqid2;
Vmxnet3_RxQueueDesc *shared;
+   struct rte_mbuf *start_seg;
+   struct rte_mbuf *last_seg;
struct vmxnet3_rxq_statsstats;
boolstopped;
uint16_tqueue_id;  /**< Device RX queue index. 
*/
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index ba48a12..5cf187a 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -571,7 +571,6 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
vmxnet3_rx_queue_t *rxq;
Vmxnet3_RxCompDesc *rcd;
vmxnet3_buf_info_t *rbi;
-   Vmxnet3_RxDesc *rxd;
struct rte_mbuf *rxm = NULL;
struct vmxnet3_hw *hw;

@@ -596,42 +595,18 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)

idx = rcd->rxdIdx;
ring_idx = (uint8_t)((rcd->rqID == rxq->qid1) ? 0 : 1);
-   rxd = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx;
rbi = rxq->cmd_ring[ring_idx].buf_info + idx;

-   if (unlikely(rcd->sop != 1 || rcd->eop != 1)) {
-   rte_pktmbuf_free_seg(rbi->m);
-   PMD_RX_LOG(DEBUG, "Packet spread across multiple 
buffers\n)");
-   goto rcd_done;
-   }

PMD_RX_LOG(DEBUG, "rxd idx: %d ring idx: %d.", idx, ring_idx);

 #ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
+   Vmxnet3_RxDesc *rxd
+   = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx;
VMXNET3_ASSERT(rcd->len <= rxd->len);
VMXNET3_ASSERT(rbi->m);
 #endif
-   if (unlikely(rcd->len == 0)) {
-   PMD_RX_LOG(DEBUG, "Rx buf was skipped. 
rxring[%d][%d]\n)",
-  ring_idx, idx);
-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
-   VMXNET3_ASSERT(rcd->sop && rcd->eop);
-#endif
-   rte_pktmbuf_free_seg(rbi->m);
-   goto rcd_done;
-   }

-   /* Assuming a packet is coming in a single packet buffer */
-   if (unlikely(rxd->btype != VMXNET3_RXD_BTYPE_HEAD)) {
-   PMD_RX_LOG(DEBUG,
-  "Alert : Misbehaving device, incorrect "
-  " buffer type used. iPacket dropped.");
-   rte_pktmbuf_free_seg(rbi->m);
-   goto rcd_done;
-   }
-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
-   VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_HEAD);
-#endif
/* Get the packet buffer pointer from buf_info */
rxm = rbi->m;

@@ -643,7 +618,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
rxq->cmd_ring[ring_idx].next2comp = idx;

/* For RCD with EOP set, check if there is frame error */
-   if (unlikely(rcd->err)) {
+   if (unlikely(rcd->eop && rcd->err)) {
rxq->stats.drop_total++;
  

[dpdk-dev] [PATCH v3 06/10] vmxnet3: support RSS and refactor offload

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

Refactor the logic to compute receive offload flags to a simpler
function. Andd add support for putting RSS flow hash into packet.

Signed-off-by: Stephen Hemminger 
Signed-off-by: Bill Hong 
Acked-by: Yong Wang 
---
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 69 ---
 1 file changed, 40 insertions(+), 29 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index 5d0f227..ba48a12 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -521,6 +521,43 @@ vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t 
ring_id)
return i;
 }

+
+/* Receive side checksum and other offloads */
+static void
+vmxnet3_rx_offload(const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm)
+{
+   /* Check for hardware stripped VLAN tag */
+   if (rcd->ts) {
+   rxm->ol_flags |= PKT_RX_VLAN_PKT;
+   rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
+   }
+
+   /* Check for RSS */
+   if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE) {
+   rxm->ol_flags |= PKT_RX_RSS_HASH;
+   rxm->hash.rss = rcd->rssHash;
+   }
+
+   /* Check packet type, checksum errors, etc. Only support IPv4 for now. 
*/
+   if (rcd->v4) {
+   struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct ether_hdr 
*);
+   struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);
+
+   if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct 
ipv4_hdr))
+   rxm->ol_flags |= PKT_RX_IPV4_HDR_EXT;
+   else
+   rxm->ol_flags |= PKT_RX_IPV4_HDR;
+
+   if (!rcd->cnc) {
+   if (!rcd->ipc)
+   rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD;
+
+   if ((rcd->tcp || rcd->udp) && !rcd->tuc)
+   rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD;
+   }
+   }
+}
+
 /*
  * Process the Rx Completion Ring of given vmxnet3_rx_queue
  * for nb_pkts burst and return the number of packets received
@@ -621,17 +658,6 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
goto rcd_done;
}

-   /* Check for hardware stripped VLAN tag */
-   if (rcd->ts) {
-   PMD_RX_LOG(DEBUG, "Received packet with vlan ID: %d.",
-  rcd->tci);
-   rxm->ol_flags = PKT_RX_VLAN_PKT;
-   /* Copy vlan tag in packet buffer */
-   rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
-   } else {
-   rxm->ol_flags = 0;
-   rxm->vlan_tci = 0;
-   }

/* Initialize newly received packet buffer */
rxm->port = rxq->port_id;
@@ -640,25 +666,10 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
rxm->pkt_len = (uint16_t)rcd->len;
rxm->data_len = (uint16_t)rcd->len;
rxm->data_off = RTE_PKTMBUF_HEADROOM;
+   rxm->ol_flags = 0;
+   rxm->vlan_tci = 0;

-   /* Check packet type, checksum errors, etc. Only support IPv4 
for now. */
-   if (rcd->v4) {
-   struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct 
ether_hdr *);
-   struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);
-
-   if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct 
ipv4_hdr))
-   rxm->ol_flags |= PKT_RX_IPV4_HDR_EXT;
-   else
-   rxm->ol_flags |= PKT_RX_IPV4_HDR;
-
-   if (!rcd->cnc) {
-   if (!rcd->ipc)
-   rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD;
-
-   if ((rcd->tcp || rcd->udp) && !rcd->tuc)
-   rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD;
-   }
-   }
+   vmxnet3_rx_offload(rcd, rxm);

rx_pkts[nb_rx++] = rxm;
 rcd_done:
-- 
2.1.4



[dpdk-dev] [PATCH v3 05/10] vmxnet3: add support for multi-segment transmit

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

Change sending loop to support multi-segment mbufs.
The VMXNET3 api has start-of-packet and end-packet flags, so it
is not hard to send multi-segment mbuf's.

Also, update descriptor in 32 bit value rather than toggling
bitfields which is slower and error prone.
Based on code in earlier driver, and the Linux kernel driver.

Add a compiler barrier to make sure that update of earlier descriptor
are completed prior to update of generation bit on start of packet.

Signed-off-by: Stephen Hemminger 

---
v3 -- add back in small packet optimization

 lib/librte_pmd_vmxnet3/vmxnet3_ring.h |   1 +
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 155 +-
 2 files changed, 79 insertions(+), 77 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h 
b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
index ebe6268..612487e 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
@@ -125,6 +125,7 @@ struct vmxnet3_txq_stats {
 * the counters below track droppings due to
 * different reasons
 */
+   uint64_tdrop_too_many_segs;
uint64_tdrop_tso;
uint64_ttx_ring_full;
 };
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index 38ac811..5d0f227 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -306,26 +306,24 @@ vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
(comp_ring->base + comp_ring->next2proc);

while (tcd->gen == comp_ring->gen) {
-
/* Release cmd_ring descriptor and free mbuf */
 #ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
VMXNET3_ASSERT(txq->cmd_ring.base[tcd->txdIdx].txd.eop == 1);
 #endif
-   mbuf = txq->cmd_ring.buf_info[tcd->txdIdx].m;
-   if (unlikely(mbuf == NULL))
-   rte_panic("EOP desc does not point to a valid mbuf");
-   else
-   rte_pktmbuf_free(mbuf);

+   while (txq->cmd_ring.next2comp != tcd->txdIdx) {
+   mbuf = 
txq->cmd_ring.buf_info[txq->cmd_ring.next2comp].m;
+   rte_pktmbuf_free_seg(mbuf);
+   txq->cmd_ring.buf_info[txq->cmd_ring.next2comp].m = 
NULL;

-   txq->cmd_ring.buf_info[tcd->txdIdx].m = NULL;
-   /* Mark the txd for which tcd was generated as completed */
-   vmxnet3_cmd_ring_adv_next2comp(>cmd_ring);
+   /* Mark the txd for which tcd was generated as 
completed */
+   vmxnet3_cmd_ring_adv_next2comp(>cmd_ring);
+   completed++;
+   }

vmxnet3_comp_ring_adv_next2proc(comp_ring);
tcd = (struct Vmxnet3_TxCompDesc *)(comp_ring->base +
comp_ring->next2proc);
-   completed++;
}

PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.", completed);
@@ -336,13 +334,8 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf 
**tx_pkts,
  uint16_t nb_pkts)
 {
uint16_t nb_tx;
-   Vmxnet3_TxDesc *txd = NULL;
-   vmxnet3_buf_info_t *tbi = NULL;
-   struct vmxnet3_hw *hw;
-   struct rte_mbuf *txm;
vmxnet3_tx_queue_t *txq = tx_queue;
-
-   hw = txq->hw;
+   struct vmxnet3_hw *hw = txq->hw;

if (unlikely(txq->stopped)) {
PMD_TX_LOG(DEBUG, "Tx queue is stopped.");
@@ -354,75 +347,89 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf 
**tx_pkts,

nb_tx = 0;
while (nb_tx < nb_pkts) {
+   Vmxnet3_GenericDesc *gdesc;
+   vmxnet3_buf_info_t *tbi;
+   uint32_t first2fill, avail, dw2;
+   struct rte_mbuf *txm = tx_pkts[nb_tx];
+
+   /* Is this packet execessively fragmented, then drop */
+   if (unlikely(txm->nb_segs > VMXNET3_MAX_TXD_PER_PKT)) {
+   ++txq->stats.drop_too_many_segs;
+   ++txq->stats.drop_total;
+   rte_pktmbuf_free(txm);
+   ++nb_tx;
+   continue;
+   }

-   if (vmxnet3_cmd_ring_desc_avail(>cmd_ring)) {
-   int copy_size = 0;
+   /* Is command ring full? */
+   avail = vmxnet3_cmd_ring_desc_avail(>cmd_ring);
+   if (txm->nb_segs > avail) {
+   ++txq->stats.tx_ring_full;
+   break;
+   }

-   txm = tx_pkts[nb_tx];
-   /* Don't support scatter packets yet, free them if met 
*/
-   if (txm->nb_segs != 1) {
-   PMD_TX_LOG(DEBUG, "Don't support scatter 
packets 

[dpdk-dev] [PATCH v3 04/10] vmxnet3: cleanup txq stats

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

There are several stats here which are never set, and have no way
to be displayed.  Assume in future xstats could be used.

Signed-off-by: Stephen Hemminger 
Acked-by: Yong Wang 
---
 lib/librte_pmd_vmxnet3/vmxnet3_ring.h | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h 
b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
index c5abdb6..ebe6268 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
@@ -121,16 +121,12 @@ vmxnet3_comp_ring_adv_next2proc(struct vmxnet3_comp_ring 
*ring)
 }

 struct vmxnet3_txq_stats {
-   uint64_t   drop_total; /* # of pkts dropped by the driver, 
the
-  * 
counters below track droppings due to
-  * 
different reasons
-  */
-   uint64_t   drop_oversized;
-   uint64_t   drop_hdr_inspect_err;
-   uint64_t   drop_tso;
-   uint64_t   deferred;
-   uint64_t   tx_ring_full;
-   uint64_t   linearized;  /* # of pkts linearized */
+   uint64_tdrop_total; /* # of pkts dropped by the driver,
+* the counters below track droppings due to
+* different reasons
+*/
+   uint64_tdrop_tso;
+   uint64_ttx_ring_full;
 };

 typedef struct vmxnet3_tx_ctx {
-- 
2.1.4



[dpdk-dev] [PATCH v3 03/10] vmxnet3: remove mtu check

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

Remove check for packets greater than MTU. No other driver does
this, it should be handled at higher layer

Signed-off-by: Stephen Hemminger 
Acked-by: Yong Wang 
---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c |  2 --
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h |  1 -
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   | 10 --
 3 files changed, 13 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
index f4c2f12..35bb561 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
@@ -246,7 +246,6 @@ eth_vmxnet3_dev_init(__attribute__((unused)) struct 
eth_driver *eth_drv,

hw->num_rx_queues = 1;
hw->num_tx_queues = 1;
-   hw->cur_mtu = ETHER_MTU;
hw->bufs_per_pkt = 1;

/* Check h/w version compatibility with driver. */
@@ -422,7 +421,6 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
devRead->misc.mtu = rte_le_to_cpu_32(dev->data->mtu);
devRead->misc.queueDescPA  = hw->queueDescPA;
devRead->misc.queueDescLen = hw->queue_desc_len;
-   devRead->misc.mtu  = hw->cur_mtu;
devRead->misc.numTxQueues  = hw->num_tx_queues;
devRead->misc.numRxQueues  = hw->num_rx_queues;

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h 
b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
index e9d67a7..83182e2 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
@@ -107,7 +107,6 @@ struct vmxnet3_hw {
uint8_t num_tx_queues;
uint8_t num_rx_queues;
uint8_t bufs_per_pkt;
-   uint16_t cur_mtu;

Vmxnet3_TxQueueDesc   *tqd_start;   /* start address of all tx 
queue desc */
Vmxnet3_RxQueueDesc   *rqd_start;   /* start address of all rx 
queue desc */
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index 5fe3de5..38ac811 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -369,16 +369,6 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf 
**tx_pkts,
continue;
}

-   /* Needs to minus ether header len */
-   if (txm->data_len > (hw->cur_mtu + ETHER_HDR_LEN)) {
-   PMD_TX_LOG(DEBUG, "Packet data_len higher than 
MTU");
-   rte_pktmbuf_free(tx_pkts[nb_tx]);
-   txq->stats.drop_total++;
-
-   nb_tx++;
-   continue;
-   }
-
txd = (Vmxnet3_TxDesc *)(txq->cmd_ring.base + 
txq->cmd_ring.next2fill);
if (rte_pktmbuf_pkt_len(txm) <= VMXNET3_HDR_COPY_SIZE) {
struct Vmxnet3_TxDataDesc *tdd;
-- 
2.1.4



[dpdk-dev] [PATCH v3 02/10] vmxnet3: enable VLAN filtering

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

Support the VLAN filter functionality of the VMXNET3 interface.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 105 +---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h |   4 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   |  31 +-
 3 files changed, 102 insertions(+), 38 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
index 4c882ee..f4c2f12 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
@@ -87,6 +87,12 @@ static void vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
 static void vmxnet3_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
+static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev,
+  uint16_t vid, int on);
+static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static void vmxnet3_dev_vlan_offload_set_clear(struct rte_eth_dev *dev,
+   int mask, int clear);
+
 #if PROCESS_SYS_EVENTS == 1
 static void vmxnet3_process_events(struct vmxnet3_hw *);
 #endif
@@ -113,6 +119,8 @@ static struct eth_dev_ops vmxnet3_eth_dev_ops = {
.link_update  = vmxnet3_dev_link_update,
.stats_get= vmxnet3_dev_stats_get,
.dev_infos_get= vmxnet3_dev_info_get,
+   .vlan_filter_set  = vmxnet3_dev_vlan_filter_set,
+   .vlan_offload_set = vmxnet3_dev_vlan_offload_set,
.rx_queue_setup   = vmxnet3_dev_rx_queue_setup,
.rx_queue_release = vmxnet3_dev_rx_queue_release,
.tx_queue_setup   = vmxnet3_dev_tx_queue_setup,
@@ -398,7 +406,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
Vmxnet3_DSDevRead *devRead = >devRead;
uint32_t *mac_ptr;
uint32_t val, i;
-   int ret;
+   int ret, mask;

shared->magic = VMXNET3_REV1_MAGIC;
devRead->misc.driverInfo.version = VMXNET3_DRIVER_VERSION_NUM;
@@ -470,9 +478,6 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
if (dev->data->dev_conf.rxmode.hw_ip_checksum)
devRead->misc.uptFeatures |= VMXNET3_F_RXCSUM;

-   if (dev->data->dev_conf.rxmode.hw_vlan_strip)
-   devRead->misc.uptFeatures |= VMXNET3_F_RXVLAN;
-
if (port_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) {
ret = vmxnet3_rss_configure(dev);
if (ret != VMXNET3_SUCCESS)
@@ -484,11 +489,14 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
devRead->rssConfDesc.confPA  = hw->rss_confPA;
}

-   if (dev->data->dev_conf.rxmode.hw_vlan_filter) {
-   ret = vmxnet3_vlan_configure(dev);
-   if (ret != VMXNET3_SUCCESS)
-   return ret;
-   }
+   mask = 0;
+   if (dev->data->dev_conf.rxmode.hw_vlan_strip)
+   mask |= ETH_VLAN_STRIP_MASK;
+
+   if (dev->data->dev_conf.rxmode.hw_vlan_filter)
+   mask |= ETH_VLAN_FILTER_MASK;
+
+   vmxnet3_dev_vlan_offload_set_clear(dev, mask, 1);

PMD_INIT_LOG(DEBUG,
 "Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x",
@@ -720,8 +728,13 @@ static void
 vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
struct vmxnet3_hw *hw = dev->data->dev_private;
+   uint32_t *vf_table = hw->shared->devRead.rxFilterConf.vfTable;

+   memset(vf_table, 0, VMXNET3_VFT_TABLE_SIZE);
vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 1);
+
+   VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
+  VMXNET3_CMD_UPDATE_VLAN_FILTERS);
 }

 /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in 
adapter */
@@ -729,8 +742,12 @@ static void
 vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
struct vmxnet3_hw *hw = dev->data->dev_private;
+   uint32_t *vf_table = hw->shared->devRead.rxFilterConf.vfTable;

+   memcpy(vf_table, hw->shadow_vfta, VMXNET3_VFT_TABLE_SIZE);
vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0);
+   VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
+  VMXNET3_CMD_UPDATE_VLAN_FILTERS);
 }

 /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in 
adapter */
@@ -751,6 +768,76 @@ vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev)
vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 0);
 }

+/* Enable/disable filter on vlan */
+static int
+vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on)
+{
+   struct vmxnet3_hw *hw = dev->data->dev_private;
+   struct Vmxnet3_RxFilterConf *rxConf = >shared->devRead.rxFilterConf;
+   uint32_t *vf_table = rxConf->vfTable;
+
+   /* save state for restore */
+   if (on)
+   

[dpdk-dev] [PATCH v3 01/10] vmxnet3: fix link state handling

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

The Intel version of VMXNET3 driver does not handle link state properly.
The VMXNET3 API returns 1 if connected and 0 if disconnected.
Also need to return correct value to indicate state change.

Signed-off-by: Stephen Hemminger 
Acked-by: Yong Wang 
---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 54 -
 1 file changed, 39 insertions(+), 15 deletions(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 
b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
index 6068c60..4c882ee 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
@@ -149,9 +149,36 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size,
  *   - On success, zero.
  *   - On failure, negative value.
  */
-static inline int
-rte_vmxnet3_dev_atomic_write_link_status(struct rte_eth_dev *dev,
-   struct rte_eth_link *link)
+
+static int
+vmxnet3_dev_atomic_read_link_status(struct rte_eth_dev *dev,
+   struct rte_eth_link *link)
+{
+   struct rte_eth_link *dst = link;
+   struct rte_eth_link *src = &(dev->data->dev_link);
+
+   if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+   *(uint64_t *)src) == 0)
+   return -1;
+
+   return 0;
+}
+
+/**
+ * Atomically writes the link status information into global
+ * structure rte_eth_dev.
+ *
+ * @param dev
+ *   - Pointer to the structure rte_eth_dev to write to.
+ *   - Pointer to the buffer to be saved with the link status.
+ *
+ * @return
+ *   - On success, zero.
+ *   - On failure, negative value.
+ */
+static int
+vmxnet3_dev_atomic_write_link_status(struct rte_eth_dev *dev,
+struct rte_eth_link *link)
 {
struct rte_eth_link *dst = &(dev->data->dev_link);
struct rte_eth_link *src = link;
@@ -384,6 +411,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
devRead->misc.driverInfo.vmxnet3RevSpt = 1;
devRead->misc.driverInfo.uptVerSpt = 1;

+   devRead->misc.mtu = rte_le_to_cpu_32(dev->data->mtu);
devRead->misc.queueDescPA  = hw->queueDescPA;
devRead->misc.queueDescLen = hw->queue_desc_len;
devRead->misc.mtu  = hw->cur_mtu;
@@ -570,7 +598,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev)

/* Clear recorded link status */
memset(, 0, sizeof(link));
-   rte_vmxnet3_dev_atomic_write_link_status(dev, );
+   vmxnet3_dev_atomic_write_link_status(dev, );
 }

 /*
@@ -653,28 +681,24 @@ static int
 vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int 
wait_to_complete)
 {
struct vmxnet3_hw *hw = dev->data->dev_private;
-   struct rte_eth_link link;
+   struct rte_eth_link old, link;
uint32_t ret;

+   memset(, 0, sizeof(link));
+   vmxnet3_dev_atomic_read_link_status(dev, );
+
VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK);
ret = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);

-   if (!ret) {
-   PMD_INIT_LOG(ERR, "Link Status Negative : %s()", __func__);
-   return -1;
-   }
-
if (ret & 0x1) {
link.link_status = 1;
link.link_duplex = ETH_LINK_FULL_DUPLEX;
link.link_speed = ETH_LINK_SPEED_1;
-
-   rte_vmxnet3_dev_atomic_write_link_status(dev, );
-
-   return 0;
}

-   return -1;
+   vmxnet3_dev_atomic_write_link_status(dev, );
+
+   return (old.link_status == link.link_status) ? -1 : 0;
 }

 /* Updating rxmode through Vmxnet3_DriverShared structure in adapter */
-- 
2.1.4



[dpdk-dev] [PATCH v3 00/10] vmxnet3: multisegment and bugfixes

2015-03-05 Thread Stephen Hemminger
From: Stephen Hemminger 

Revised version of earlier patches.
Incorporate the small packet optimization
Add more cleanups

Stephen Hemminger (10):
  vmxnet3: fix link state handling
  vmxnet3: enable VLAN filtering
  vmxnet3: remove mtu check
  vmxnet3: cleanup txq stats
  vmxnet3: add support for multi-segment transmit
  vmxnet3: support RSS and refactor offload
  vmxnet3: support jumbo frames
  vmxnet3: get rid of DEBUG ifdefs
  vmxnet3: add check for jumbo segment
  vmxnet3: remove excess inlining

 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 162 +++---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h |  11 +-
 lib/librte_pmd_vmxnet3/vmxnet3_ring.h   |  20 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   | 360 
 4 files changed, 333 insertions(+), 220 deletions(-)

-- 
2.1.4



[dpdk-dev] Build failure on FreeBSD-10.1-RELEASE

2015-03-05 Thread Tetsuya Mukawa
On 2015/03/04 19:15, Bruce Richardson wrote:
> On Wed, Mar 04, 2015 at 10:33:14AM +0100, Olivier MATZ wrote:
>> Hi Tetsuya, Hi Bruce,
>>
>> On 03/04/2015 04:34 AM, Tetsuya Mukawa wrote:
>>> On 2015/03/02 19:22, Bruce Richardson wrote:
 On Mon, Mar 02, 2015 at 12:47:42PM +0900, Tetsuya Mukawa wrote:
> Hi,
>
> I got a error while building master branch on FreeBSD.
> Here is a log.
>
> $ gmake T=x86_64-native-bsdapp-clang config
> cc: error: unknown argument: '-fdirectives-only'
> cp: /usr/home/mukawa/work/dpdk/build/.config_tmp: No such file or 
> directory
> cp: /usr/home/mukawa/work/dpdk/build/.config_tmp: No such file or 
> directory
> gmake[3]: Nothing to be done for 'depdirs'.
> Configuration done
>
>
> Here is log came from 'uname'
>
> $ uname -a
> FreeBSD eris.hq.igel.co.jp 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401:
> Tue Nov 11 21:02:49 UTC 2014
>
>
> I've tried to remove '-fdirectives-only' from mk/rte.sdkconfig.mk like
> below.
> With the fixing,  It seems I can compile and run testpmd.
> (Obviously, we should not merge below patch, but I've done just for 
> testing)
>
> diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
> index d43c430..f8d95b1 100644
> --- a/mk/rte.sdkconfig.mk
> +++ b/mk/rte.sdkconfig.mk
> @@ -75,7 +75,7 @@ else
>  $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
> $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f
> "$(RTE_CONFIG_TEMPLATE)" ]; then \
> $(CPP) -undef -P -x assembler-with-cpp \
> -   -fdirectives-only -ffreestanding \
> +   -ffreestanding \
> -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
> if ! cmp -s $(RTE_OUTPUT)/.config_tmp
> $(RTE_OUTPUT)/.config; then \
> cp $(RTE_OUTPUT)/.config_tmp
> $(RTE_OUTPUT)/.config ; \
>
>
> Also, I've checked /usr/ports/net/dpdk, and found below line.
> (It seems above ports dpdk package is based on DPDK-1.8.)
>
>
> $(CPP) -undef -P -x assembler-with-cpp \
>  -ffreestanding \
>-o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
>
> So, I guess we should not add '-fdirectives-only' for flags of $(CPP)
> for BSD system like dpdk package of ports.
>
> Thanks,
> Tetsuya
>
 Yes, that is correct. In most cases I have tested, the extra flag only 
 gives a
 warning but it appears its now an error. We should conditionally include or
 omit the flag for BSD vs Linux, I think.

 /Bruce
>>> Hi Bruce,
>>>
>>> It seems we cannot use CONFIG_RTE_EXEC_ENV_LINUXAPP/BSDAPP definition here.
>>> Now I am looking for other way to check target OS.
>>> Is it not so good to use $(T) definition value here?
>> Indeed, it seems that the -fdirectives-only option does not exist in
>> freebsd. This is probably because the default cpp is not GNU cpp:
>>
>> On my version, I have:
>>  FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
>>  Target: x86_64-unknown-freebsd10.0
>>  Thread model: posix
>>
>> To decide whether using the option, we could check the return value of
>> cpp -fdirectives-only /dev/null > /dev/null 2>/dev/null

It?s a great idea.

>> But I don't really think it's an issue to remove the option for all
>> OSes. In my opinion, expanding macros when parsing the config files
>> won't add any issue, and it's probably better to have no differences
>> between FreeBSD and Linux.
>>
>> Regards,
>> Olivier
>>
> +1 
> I was just going to suggest that this morning! :-)

Thanks for suggestions.
I will send a patch that just removes '-fdirectives-only'.

Thanks,
Tetsuya



[dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to integer of different size

2015-03-05 Thread Michael Qiu
./i686-native-linuxapp-gcc/include/rte_memcpy.h:592:23: error:
cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]

  dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16;

Type 'long long' is 64-bit in i686 platform while 'void *'
is 32-bit.

Signed-off-by: Michael Qiu 
---
v3 --> v2:
make dstofss and srcofs to be type size_t
casting type use uintptr_t

v2 --> v1:
Remove unnecessary casting (void *)
 lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h 
b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
index 7b2d382..aa433e4 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -493,8 +493,8 @@ rte_memcpy(void *dst, const void *src, size_t n)
 {
__m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
void *ret = dst;
-   int dstofss;
-   int srcofs;
+   size_t dstofss;
+   size_t srcofs;

/**
 * Copy less than 16 bytes
@@ -589,12 +589,12 @@ COPY_BLOCK_64_BACK15:
 * unaligned copy functions require up to 15 bytes
 * backwards access.
 */
-   dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16;
+   dstofss = 16 - ((uintptr_t)dst & 0x0F) + 16;
n -= dstofss;
rte_mov32((uint8_t *)dst, (const uint8_t *)src);
src = (const uint8_t *)src + dstofss;
dst = (uint8_t *)dst + dstofss;
-   srcofs = (int)((long long)(const void *)src & 0x0F);
+   srcofs = (uintptr_t)src & 0x0F;

/**
 * For aligned copy
-- 
1.9.3



[dpdk-dev] [PATCH v2 5/6] common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option

2015-03-05 Thread Vlad Zolotarov


On 03/05/15 15:19, Thomas Monjalon wrote:
> 2015-03-05 13:28, Vlad Zolotarov:
>> Enables LRO support in PMDs.
>>
>> Signed-off-by: Vlad Zolotarov 
>> ---
>>   config/common_linuxapp | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/config/common_linuxapp b/config/common_linuxapp
>> index 97f1c9e..5b98595 100644
>> --- a/config/common_linuxapp
>> +++ b/config/common_linuxapp
>> @@ -137,6 +137,7 @@ CONFIG_RTE_MAX_ETHPORTS=32
>>   CONFIG_RTE_LIBRTE_IEEE1588=n
>>   CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
>>   CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
>> +CONFIG_RTE_ETHDEV_LRO_SUPPORT=y
> Sorry I don't really follow this ixgbe discussion but I wonder why you
> would add a compile time option for this feature.

The only reason is to be able to detect that the feature is present in 
the DPDK version u r compiling against because of the API change.
Currently, this can't be done using the DPDK version thus we may either 
do a try-compilation and if it fails define some application-level macro 
disabling
the feature usage or we may define a macro in the library level 
(together with tons of other such macros like those in the patch snippet 
above).


> What is the benefit of disabling it?

No benefit whatsoever.

> And if really needed, this patch would make more sense merged with the
> code under ifdef.

I strongly disagree - the amount of #ifdefs in the DPDK source is 
absolutely enormous. It makes reading and  understanding the code really 
hard.
Therefore, I tried to reduce the amount of time the already existing 
macros have to be queried (see PATCH4). And of course I don't see any 
sense of adding new ones more than really needed. And in LRO case - it's 
a single time, where the feature is manifested by the HW.


>



[dpdk-dev] [PATCH 3/3 v2] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Thomas Monjalon
2015-03-05 14:03, Qiu, Michael:
> On 3/5/2015 9:54 PM, David Marchand wrote:
> > On Thu, Mar 5, 2015 at 2:50 PM, Michael Qiu  > > wrote:
> >
> > include/rte_cpuflags.h:154:2: error: redeclaration of enumerator
> > ?REG_EAX?
> > In file included from /usr/include/signal.h:358:0,
> >  from /usr/include/sys/wait.h:30,
> >  from /root/dpdk/app/test/test_mp_secondary.c:50:
> > /usr/include/sys/ucontext.h:180:3: note: previous definition of
> > ?REG_EAX? was here
> >
> > In i686, from REG_EAX to REG_EDX are all defined in
> > /usr/include/sys/ucontext.h
> >
> > Rename to CPU_REG_EAX to avoid this issue.
> >
> > Signed-off-by: Michael Qou  > >
> >
> >
> > NAK.
> >
> 
> I have answered in you last thread, please check the mail.
> 
> Yes, but for some reason, it was not include, see /usr/include/signal.h:358
> 
> # include 
> # if defined __USE_XOPEN || defined __USE_XOPEN2K8
> /* This will define `ucontext_t' and `mcontext_t'.  */
> #  include 
> # endif
> 
> So only if __USE_XOPEN or __USE_XOPEN2K8 been defined will include 
> 

So try to define USE_XOPEN.

> Why NAK?

Because it seems you didn't really try to include system headers.
We must avoid redefine existing symbols. That's why this bug happens.
Michael, thanks for trying to fix this issue. It's appreciated even if
the first solution is refused.



[dpdk-dev] [PATCH v15] testpmd: Add port hotplug support

2015-03-05 Thread Tetsuya Mukawa
On 2015/03/04 0:54, De Lara Guarch, Pablo wrote:
> Hi Tetsuya,
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Tetsuya Mukawa
>> Sent: Wednesday, February 25, 2015 7:32 PM
>> To: dev at dpdk.org
>> Subject: [dpdk-dev] [PATCH v15] testpmd: Add port hotplug support
>>
>> The patch introduces following commands.
>> - port attach [ident]
>> - port detach [port_id]
>>  - attach: attaching a port
>>  - detach: detaching a port
>>  - ident: pci address of physical device.
>>   Or device name and parameters of virtual device.
>>  (ex. :02:00.0, eth_pcap0,iface=eth0)
>>  - port_id: port identifier
>>
>> v15:
>> - Replace rte_eal_dev_attach() by rte_eth_dev_attach()
>> - Replace rte_eal_dev_detach() by rte_eth_dev_detach()
>>
>> v7:
>> - Fix doc.
>>   (Thanks to Iremonger, Bernard)
>> - Fix port checking implementation of star_port();
>>   (Thanks to Qiu, Michael)
>> v5:
>> - Add testpmd documentation.
>>   (Thanks to Iremonger, Bernard)
>> v4:
>>  - Fix strings of command help.
>>
>> Signed-off-by: Tetsuya Mukawa 
>> ---
>>  app/test-pmd/cmdline.c  | 137 +++
>>  app/test-pmd/config.c   | 102 --
>>  app/test-pmd/parameters.c   |  22 ++-
>>  app/test-pmd/testpmd.c  | 199 
>> +---
>>  app/test-pmd/testpmd.h  |  18 ++-
>>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  57 
> [...]
>
>> @@ -1446,8 +1497,8 @@ stop_port(portid_t pid)
>>  }
>>  printf("Stopping ports...\n");
>>
>> -for (pi = 0; pi < nb_ports; pi++) {
>> -if (pid < nb_ports && pid != pi)
>> +FOREACH_PORT(pi, ports) {
>> +if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> If using "port stop all", this function does not work as it should.
> Problem is that pid = RTE_PORT_ALL = 255, and then ports[255].enabled is 
> undefined, 
> as ports array is allocated only for RTE_MAX_ETHPORTS (32 by default).
>
> So, the solution could be either increasing the ports array to 256 items,
> or check if we are passing RTE_PORT_ALL in pid.
>
> What do you think?

Hi Pablo,

Thanks for reporting.
Yes, it should be fixed. Could you please check a patch I will send later?
I'll fix it same as start_port().

Thanks,
Tetsuya

>
> Thanks,
> Pablo
>
>>  continue;
>>
>>  port = [pi];
>> @@ -1463,7 +1514,7 @@ stop_port(portid_t pid)
>>  need_check_link_status = 1;
>>  }
>>  if (need_check_link_status && !no_link_check)
>> -check_all_ports_link_status(nb_ports, RTE_PORT_ALL);
>> +check_all_ports_link_status(RTE_PORT_ALL);
>>
>>  printf("Done\n");
>>  }



[dpdk-dev] [PATCH 3/3 v2] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread David Marchand
On Thu, Mar 5, 2015 at 2:50 PM, Michael Qiu  wrote:

> include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ?REG_EAX?
> In file included from /usr/include/signal.h:358:0,
>  from /usr/include/sys/wait.h:30,
>  from /root/dpdk/app/test/test_mp_secondary.c:50:
> /usr/include/sys/ucontext.h:180:3: note: previous definition of ?REG_EAX?
> was here
>
> In i686, from REG_EAX to REG_EDX are all defined in
> /usr/include/sys/ucontext.h
>
> Rename to CPU_REG_EAX to avoid this issue.
>
> Signed-off-by: Michael Qou 
>

NAK.

You did not answer my question.
This mail title is broken anyway.


-- 
David Marchand


[dpdk-dev] [PATCH 3/3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread David Marchand
On Thu, Mar 5, 2015 at 2:23 PM, Bruce Richardson  wrote:

> On Thu, Mar 05, 2015 at 09:15:39PM +0800, Michael Qiu wrote:
> > include/rte_cpuflags.h:154:2: error: redeclaration of enumerator
> ?REG_EAX?
> > In file included from /usr/include/signal.h:358:0,
> >  from /usr/include/sys/wait.h:30,
> >  from /root/dpdk/app/test/test_mp_secondary.c:50:
> > /usr/include/sys/ucontext.h:180:3: note: previous definition of
> ?REG_EAX? was here
> >
> > In i686, from REG_EAX to REG_EDX are all defined in
> >   /usr/include/sys/ucontext.h
>

Well, this is the same for x86_64.

$ grep -rl '\' /usr/include/
/usr/include/x86_64-linux-gnu/sys/ucontext.h

$ ls -l /usr/include/sys/ucontext.h
lrwxrwxrwx 1 root root 34 Feb 22 12:45 /usr/include/sys/ucontext.h ->
../x86_64-linux-gnu/sys/ucontext.h

So I am not sure I understand why we redefine stuff already available from
the toolchain.
Rather than prefixing, I think we should get rid of this and include the
right header.


-- 
David Marchand


[dpdk-dev] [PATCH v2 5/6] common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option

2015-03-05 Thread Thomas Monjalon
2015-03-05 13:28, Vlad Zolotarov:
> Enables LRO support in PMDs.
> 
> Signed-off-by: Vlad Zolotarov 
> ---
>  config/common_linuxapp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/config/common_linuxapp b/config/common_linuxapp
> index 97f1c9e..5b98595 100644
> --- a/config/common_linuxapp
> +++ b/config/common_linuxapp
> @@ -137,6 +137,7 @@ CONFIG_RTE_MAX_ETHPORTS=32
>  CONFIG_RTE_LIBRTE_IEEE1588=n
>  CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
>  CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
> +CONFIG_RTE_ETHDEV_LRO_SUPPORT=y

Sorry I don't really follow this ixgbe discussion but I wonder why you
would add a compile time option for this feature.
What is the benefit of disabling it?
And if really needed, this patch would make more sense merged with the
code under ifdef.



[dpdk-dev] rte_prefetch0() performance info

2015-03-05 Thread Parikshith Chowdaiah
Hi all,
I have a question related to usage of rte_prefetch0() function,In one of
the sample files, we have implementation like:

/* Prefetch first packets */

for (j = 0; j < PREFETCH_OFFSET && j < nb_rx; j++) {

rte_prefetch0(rte_pktmbuf_mtod(

pkts_burst[j], void *));

}



/* Prefetch and forward already prefetched packets */

for (j = 0; j < (nb_rx - PREFETCH_OFFSET); j++) {

rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[

j + PREFETCH_OFFSET], void *));

l3fwd_simple_forward(pkts_burst[j], portid,

qconf);

}



/* Forward remaining prefetched packets */

for (; j < nb_rx; j++) {

l3fwd_simple_forward(pkts_burst[j], portid,

qconf);

}


where the prefetch0() is carried out in multiple split iterations, would
like to have an insight on whether it makes performance improvement to
likes of:



   for (j = 0; j  < nb_rx; j++) {

rte_prefetch0(rte_pktmbuf_mtod(

pkts_burst[j], void *));

}


and how frequent rte_prefetch() needs to called for the same packet. and
any mechanisms to call in bulk for 64 packets at once ?


thanks

Parikshith


[dpdk-dev] [PATCH 3/3 v2] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Qiu, Michael
On 3/5/2015 9:54 PM, David Marchand wrote:
> On Thu, Mar 5, 2015 at 2:50 PM, Michael Qiu  > wrote:
>
> include/rte_cpuflags.h:154:2: error: redeclaration of enumerator
> ?REG_EAX?
> In file included from /usr/include/signal.h:358:0,
>  from /usr/include/sys/wait.h:30,
>  from /root/dpdk/app/test/test_mp_secondary.c:50:
> /usr/include/sys/ucontext.h:180:3: note: previous definition of
> ?REG_EAX? was here
>
> In i686, from REG_EAX to REG_EDX are all defined in
> /usr/include/sys/ucontext.h
>
> Rename to CPU_REG_EAX to avoid this issue.
>
> Signed-off-by: Michael Qou  >
>
>
> NAK.
>

I have answered in you last thread, please check the mail.

Yes, but for some reason, it was not include, see /usr/include/signal.h:358

# include 
# if defined __USE_XOPEN || defined __USE_XOPEN2K8
/* This will define `ucontext_t' and `mcontext_t'.  */
#  include 
# endif

So only if __USE_XOPEN or __USE_XOPEN2K8 been defined will include 



Why NAK?

Thanks,
Michael
> You did not answer my question.
> This mail title is broken anyway.
>
>
> -- 
> David Marchand



[dpdk-dev] [PATCH 3/3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Qiu, Michael
On 3/5/2015 9:36 PM, David Marchand wrote:
> On Thu, Mar 5, 2015 at 2:23 PM, Bruce Richardson
> mailto:bruce.richardson at intel.com>> wrote:
>
> On Thu, Mar 05, 2015 at 09:15:39PM +0800, Michael Qiu wrote:
> > include/rte_cpuflags.h:154:2: error: redeclaration of enumerator
> ?REG_EAX?
> > In file included from /usr/include/signal.h:358:0,
> >  from /usr/include/sys/wait.h:30,
> >  from /root/dpdk/app/test/test_mp_secondary.c:50:
> > /usr/include/sys/ucontext.h:180:3: note: previous definition of
> ?REG_EAX? was here
> >
> > In i686, from REG_EAX to REG_EDX are all defined in
> >   /usr/include/sys/ucontext.h
>
>
> Well, this is the same for x86_64.

Yes, but for some reason, it was not include, see /usr/include/signal.h:358

# include 
# if defined __USE_XOPEN || defined __USE_XOPEN2K8
/* This will define `ucontext_t' and `mcontext_t'.  */
#  include 
# endif

So only if __USE_XOPEN or __USE_XOPEN2K8 been defined will include 


Thanks,
Michael
>
> $ grep -rl '\' /usr/include/
> /usr/include/x86_64-linux-gnu/sys/ucontext.h
>
> $ ls -l /usr/include/sys/ucontext.h 
> lrwxrwxrwx 1 root root 34 Feb 22 12:45 /usr/include/sys/ucontext.h ->
> ../x86_64-linux-gnu/sys/ucontext.h
>
> So I am not sure I understand why we redefine stuff already available
> from the toolchain.
> Rather than prefixing, I think we should get rid of this and include
> the right header.
>
>
> -- 
> David Marchand 



[dpdk-dev] [PATCH 3/3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Qiu, Michael
On 3/5/2015 9:24 PM, Richardson, Bruce wrote:
> On Thu, Mar 05, 2015 at 09:15:39PM +0800, Michael Qiu wrote:
>> include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ?REG_EAX?
>> In file included from /usr/include/signal.h:358:0,
>>  from /usr/include/sys/wait.h:30,
>>  from /root/dpdk/app/test/test_mp_secondary.c:50:
>> /usr/include/sys/ucontext.h:180:3: note: previous definition of ?REG_EAX? 
>> was here
>>
>> In i686, from REG_EAX to REG_EDX are all defined in
>>  /usr/include/sys/ucontext.h
>>
>> Rename to CPU_REG_EAX to avoid this issue.
> RTE_ prefix for consistency with other public DPDK symbols perhaps?

Hi, Bruce

Yes, agree.

I will send out v2 now.

Thanks,
Michael
> /Bruce
>
>> Signed-off-by: Michael Qou 
>> ---
>>  .../common/include/arch/x86/rte_cpuflags.h | 210 
>> ++---
>>  1 file changed, 105 insertions(+), 105 deletions(-)
>>
>> diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h 
>> b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
>> index a58dd7b..f367b91 100644
>> --- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
>> +++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
>> @@ -151,104 +151,104 @@ enum rte_cpu_flag_t {
>>  };
>>  
>>  enum cpu_register_t {
>> -REG_EAX = 0,
>> -REG_EBX,
>> -REG_ECX,
>> -REG_EDX,
>> +CPU_REG_EAX = 0,
>> +CPU_REG_EBX,
>> +CPU_REG_ECX,
>> +CPU_REG_EDX,
>>  };
>>  
>>  static const struct feature_entry cpu_feature_table[] = {
>> -FEAT_DEF(SSE3, 0x0001, 0, REG_ECX,  0)
>> -FEAT_DEF(PCLMULQDQ, 0x0001, 0, REG_ECX,  1)
>> -FEAT_DEF(DTES64, 0x0001, 0, REG_ECX,  2)
>> -FEAT_DEF(MONITOR, 0x0001, 0, REG_ECX,  3)
>> -FEAT_DEF(DS_CPL, 0x0001, 0, REG_ECX,  4)
>> -FEAT_DEF(VMX, 0x0001, 0, REG_ECX,  5)
>> -FEAT_DEF(SMX, 0x0001, 0, REG_ECX,  6)
>> -FEAT_DEF(EIST, 0x0001, 0, REG_ECX,  7)
>> -FEAT_DEF(TM2, 0x0001, 0, REG_ECX,  8)
>> -FEAT_DEF(SSSE3, 0x0001, 0, REG_ECX,  9)
>> -FEAT_DEF(CNXT_ID, 0x0001, 0, REG_ECX, 10)
>> -FEAT_DEF(FMA, 0x0001, 0, REG_ECX, 12)
>> -FEAT_DEF(CMPXCHG16B, 0x0001, 0, REG_ECX, 13)
>> -FEAT_DEF(XTPR, 0x0001, 0, REG_ECX, 14)
>> -FEAT_DEF(PDCM, 0x0001, 0, REG_ECX, 15)
>> -FEAT_DEF(PCID, 0x0001, 0, REG_ECX, 17)
>> -FEAT_DEF(DCA, 0x0001, 0, REG_ECX, 18)
>> -FEAT_DEF(SSE4_1, 0x0001, 0, REG_ECX, 19)
>> -FEAT_DEF(SSE4_2, 0x0001, 0, REG_ECX, 20)
>> -FEAT_DEF(X2APIC, 0x0001, 0, REG_ECX, 21)
>> -FEAT_DEF(MOVBE, 0x0001, 0, REG_ECX, 22)
>> -FEAT_DEF(POPCNT, 0x0001, 0, REG_ECX, 23)
>> -FEAT_DEF(TSC_DEADLINE, 0x0001, 0, REG_ECX, 24)
>> -FEAT_DEF(AES, 0x0001, 0, REG_ECX, 25)
>> -FEAT_DEF(XSAVE, 0x0001, 0, REG_ECX, 26)
>> -FEAT_DEF(OSXSAVE, 0x0001, 0, REG_ECX, 27)
>> -FEAT_DEF(AVX, 0x0001, 0, REG_ECX, 28)
>> -FEAT_DEF(F16C, 0x0001, 0, REG_ECX, 29)
>> -FEAT_DEF(RDRAND, 0x0001, 0, REG_ECX, 30)
>> -
>> -FEAT_DEF(FPU, 0x0001, 0, REG_EDX,  0)
>> -FEAT_DEF(VME, 0x0001, 0, REG_EDX,  1)
>> -FEAT_DEF(DE, 0x0001, 0, REG_EDX,  2)
>> -FEAT_DEF(PSE, 0x0001, 0, REG_EDX,  3)
>> -FEAT_DEF(TSC, 0x0001, 0, REG_EDX,  4)
>> -FEAT_DEF(MSR, 0x0001, 0, REG_EDX,  5)
>> -FEAT_DEF(PAE, 0x0001, 0, REG_EDX,  6)
>> -FEAT_DEF(MCE, 0x0001, 0, REG_EDX,  7)
>> -FEAT_DEF(CX8, 0x0001, 0, REG_EDX,  8)
>> -FEAT_DEF(APIC, 0x0001, 0, REG_EDX,  9)
>> -FEAT_DEF(SEP, 0x0001, 0, REG_EDX, 11)
>> -FEAT_DEF(MTRR, 0x0001, 0, REG_EDX, 12)
>> -FEAT_DEF(PGE, 0x0001, 0, REG_EDX, 13)
>> -FEAT_DEF(MCA, 0x0001, 0, REG_EDX, 14)
>> -FEAT_DEF(CMOV, 0x0001, 0, REG_EDX, 15)
>> -FEAT_DEF(PAT, 0x0001, 0, REG_EDX, 16)
>> -FEAT_DEF(PSE36, 0x0001, 0, REG_EDX, 17)
>> -FEAT_DEF(PSN, 0x0001, 0, REG_EDX, 18)
>> -FEAT_DEF(CLFSH, 0x0001, 0, REG_EDX, 19)
>> -FEAT_DEF(DS, 0x0001, 0, REG_EDX, 21)
>> -FEAT_DEF(ACPI, 0x0001, 0, REG_EDX, 22)
>> -FEAT_DEF(MMX, 0x0001, 0, REG_EDX, 23)
>> -FEAT_DEF(FXSR, 0x0001, 0, REG_EDX, 24)
>> -FEAT_DEF(SSE, 0x0001, 0, REG_EDX, 25)
>> -FEAT_DEF(SSE2, 0x0001, 0, REG_EDX, 26)
>> -FEAT_DEF(SS, 0x0001, 0, REG_EDX, 27)
>> -FEAT_DEF(HTT, 0x0001, 0, REG_EDX, 28)
>> -FEAT_DEF(TM, 0x0001, 0, REG_EDX, 29)
>> -FEAT_DEF(PBE, 0x0001, 0, REG_EDX, 31)
>> -
>> -FEAT_DEF(DIGTEMP, 0x0006, 0, REG_EAX,  0)
>> -FEAT_DEF(TRBOBST, 0x0006, 0, REG_EAX,  1)
>> -FEAT_DEF(ARAT, 0x0006, 0, REG_EAX,  2)
>> -FEAT_DEF(PLN, 0x0006, 0, REG_EAX,  4)
>> -FEAT_DEF(ECMD, 0x0006, 0, REG_EAX,  5)
>> -FEAT_DEF(PTM, 0x0006, 0, REG_EAX,  6)
>> -
>> -FEAT_DEF(MPERF_APERF_MSR, 0x0006, 0, REG_ECX,  0)
>> -FEAT_DEF(ACNT2, 0x0006, 0, REG_ECX,  1)
>> -FEAT_DEF(ENERGY_EFF, 0x0006, 0, 

[dpdk-dev] [PATCH] testpmd: Fix port validation code of "port stop all" command

2015-03-05 Thread Qiu, Michael
On 3/5/2015 9:33 PM, Qiu, Michael wrote:
> Hi, Tetsuya and Pablo
> This is not a full fix, I have generate the full fix patch two days ago,
> See below:
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 49be819..ec53923 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -384,6 +384,9 @@ port_infos_display(portid_t port_id)
>  int
>  port_id_is_invalid(portid_t port_id, enum print_warning warning)
>  {
> +   if (port_id == (portid_t)RTE_PORT_ALL)
> +   return 0;
> +
> if (ports[port_id].enabled)
> return 0;
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index e556b4c..1c4c651 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1326,6 +1326,9 @@ start_port(portid_t pid)
> return -1;
> }
>
> +   if (port_id_is_invalid(pid, ENABLED_WARN))
> +   return 0;
> +
> if (init_fwd_streams() < 0) {
> printf("Fail from init_fwd_streams()\n");
> return -1;
> @@ -1482,10 +1485,14 @@ stop_port(portid_t pid)
> dcb_test = 0;
> dcb_config = 0;
> }
> +
> +   if (port_id_is_invalid(pid, ENABLED_WARN))
> +   return;
> +
> printf("Stopping ports...\n");
>
> FOREACH_PORT(pi, ports) {
> -   if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> +   if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
> continue;
>
> port = [pi];
> @@ -1517,10 +1524,13 @@ close_port(portid_t pid)
> return;
> }
>
> +   if (port_id_is_invalid(pid, ENABLED_WARN))
> +return;
> +
> printf("Closing ports...\n");
>
> FOREACH_PORT(pi, ports) {
> -   if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> +   if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
> continue;
>
> port = [pi];

This diff is based on:

[PATCH] app/test-pmd: Fix log issue without nic binded

Thanks,
Michael


[dpdk-dev] [PATCH] testpmd: Fix port validation code of "port stop all" command

2015-03-05 Thread Qiu, Michael
Hi, Tetsuya and Pablo
This is not a full fix, I have generate the full fix patch two days ago,
See below:

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 49be819..ec53923 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -384,6 +384,9 @@ port_infos_display(portid_t port_id)
 int
 port_id_is_invalid(portid_t port_id, enum print_warning warning)
 {
+   if (port_id == (portid_t)RTE_PORT_ALL)
+   return 0;
+
if (ports[port_id].enabled)
return 0;

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e556b4c..1c4c651 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1326,6 +1326,9 @@ start_port(portid_t pid)
return -1;
}

+   if (port_id_is_invalid(pid, ENABLED_WARN))
+   return 0;
+
if (init_fwd_streams() < 0) {
printf("Fail from init_fwd_streams()\n");
return -1;
@@ -1482,10 +1485,14 @@ stop_port(portid_t pid)
dcb_test = 0;
dcb_config = 0;
}
+
+   if (port_id_is_invalid(pid, ENABLED_WARN))
+   return;
+
printf("Stopping ports...\n");

FOREACH_PORT(pi, ports) {
-   if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
+   if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;

port = [pi];
@@ -1517,10 +1524,13 @@ close_port(portid_t pid)
return;
}

+   if (port_id_is_invalid(pid, ENABLED_WARN))
+return;
+
printf("Closing ports...\n");

FOREACH_PORT(pi, ports) {
-   if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
+   if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;

port = [pi];
-- 
1.9.3

Thanks,
Michael

On 3/5/2015 3:31 PM, Tetsuya Mukawa wrote:
> When "port stop all" is executed, the command doesn't work as it should
> because of wrong port validation. The patch fixes this issue.
>
> Reported-by: Pablo de Lara 
> Signed-off-by: Tetsuya Mukawa 
> ---
>  app/test-pmd/testpmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 61291be..bb65342 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1484,7 +1484,7 @@ stop_port(portid_t pid)
>   printf("Stopping ports...\n");
>  
>   FOREACH_PORT(pi, ports) {
> - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> + if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
>   continue;
>  
>   port = [pi];



[dpdk-dev] [PATCH v2 6/6] ixgbe: Add LRO support

2015-03-05 Thread Vlad Zolotarov
- Only x540 and 82599 devices support LRO.
- Add the appropriate HW configuration.
- Add RSC aware rx_pkt_burst() handlers:
   - Implemented bulk allocation and non-bulk allocation versions.
   - Add LRO-specific fields to rte_eth_rxmode, to rte_eth_dev_data
 and to igb_rx_queue.
   - Use the appropriate handler when LRO is requested.

Signed-off-by: Vlad Zolotarov 
---
New in v2:
   - Removed rte_eth_dev_data.lro_bulk_alloc.
   - Fixed a few styling and spelling issues.
---
 lib/librte_ether/rte_ethdev.h   |   6 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   8 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 562 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   6 +
 5 files changed, 580 insertions(+), 7 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8db3127..9e7160a 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -320,14 +320,15 @@ struct rte_eth_rxmode {
enum rte_eth_rx_mq_mode mq_mode;
uint32_t max_rx_pkt_len;  /**< Only used if jumbo_frame enabled. */
uint16_t split_hdr_size;  /**< hdr buf size (header_split enabled).*/
-   uint8_t header_split : 1, /**< Header Split enable. */
+   uint16_t header_split : 1, /**< Header Split enable. */
hw_ip_checksum   : 1, /**< IP/UDP/TCP checksum offload enable. 
*/
hw_vlan_filter   : 1, /**< VLAN filter enable. */
hw_vlan_strip: 1, /**< VLAN strip enable. */
hw_vlan_extend   : 1, /**< Extended VLAN enable. */
jumbo_frame  : 1, /**< Jumbo Frame Receipt enable. */
hw_strip_crc : 1, /**< Enable CRC stripping by hardware. */
-   enable_scatter   : 1; /**< Enable scatter packets rx handler */
+   enable_scatter   : 1, /**< Enable scatter packets rx handler */
+   enable_lro   : 1; /**< Enable LRO */
 };

 /**
@@ -1515,6 +1516,7 @@ struct rte_eth_dev_data {
uint8_t port_id;   /**< Device [external] port identifier. */
uint8_t promiscuous   : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
scattered_rx : 1,  /**< RX of scattered packets is ON(1) / 
OFF(0) */
+   lro  : 1,  /**< RX LRO is ON(1) / OFF(0) */
all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
dev_started : 1;   /**< Device state: STARTED(1) / STOPPED(0). 
*/
 };
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index f93dcfc..a943e0b 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -1650,6 +1650,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)

/* Clear stored conf */
dev->data->scattered_rx = 0;
+   dev->data->lro = 0;
hw->rx_bulk_alloc_allowed = false;

/* Clear recorded link status */
@@ -2019,6 +2020,13 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
DEV_RX_OFFLOAD_IPV4_CKSUM |
DEV_RX_OFFLOAD_UDP_CKSUM  |
DEV_RX_OFFLOAD_TCP_CKSUM;
+
+#ifdef RTE_ETHDEV_LRO_SUPPORT
+   if (hw->mac.type == ixgbe_mac_82599EB ||
+   hw->mac.type == ixgbe_mac_X540)
+   dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO;
+#endif
+
dev_info->tx_offload_capa =
DEV_TX_OFFLOAD_VLAN_INSERT |
DEV_TX_OFFLOAD_IPV4_CKSUM  |
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index a549f5c..e206584 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -349,6 +349,11 @@ uint16_t ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct 
rte_mbuf **rx_pkts,
 uint16_t ixgbe_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);

+uint16_t ixgbe_recv_pkts_lro(void *rx_queue,
+   struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
+   struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+
 uint16_t ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index bdac885..f5525e5 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1366,6 +1366,15 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts,
 }

 /**
+ * Detect an RSC descriptor.
+ */
+static inline uint32_t ixgbe_rsc_count(union ixgbe_adv_rx_desc *rx)
+{
+   return (rte_le_to_cpu_32(rx->wb.lower.lo_dword.data) &
+   IXGBE_RXDADV_RSCCNT_MASK) >> IXGBE_RXDADV_RSCCNT_SHIFT;
+}
+
+/**
  * Initialize the first mbuf of the returned packet:
  *- RX port identifier,
  *- hardware offload data, if any:
@@ -1410,6 

[dpdk-dev] [PATCH v2 5/6] common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option

2015-03-05 Thread Vlad Zolotarov
Enables LRO support in PMDs.

Signed-off-by: Vlad Zolotarov 
---
 config/common_linuxapp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config/common_linuxapp b/config/common_linuxapp
index 97f1c9e..5b98595 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -137,6 +137,7 @@ CONFIG_RTE_MAX_ETHPORTS=32
 CONFIG_RTE_LIBRTE_IEEE1588=n
 CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
+CONFIG_RTE_ETHDEV_LRO_SUPPORT=y

 #
 # Support NIC bypass logic
-- 
2.1.0



[dpdk-dev] [PATCH v2 4/6] ixgbe: Unify the rx_pkt_bulk callback initialization

2015-03-05 Thread Vlad Zolotarov
   - Set the callback in a single function (set_rx_function()) that is called 
from
 ixgbe_dev_rx_init() for a primary process and from eth_ixgbe_dev_init()
 for a secondary processes. This is instead of multiple, hard to track 
places.
   - Bug fix: rx_pkt_bulk callback setting was done based on the last queue 
configuration,
  while callback is per-port thus all queues configuration should 
be taken
  into an account. Therefore added ixgbe_hw.rx_bulk_alloc_allowed 
to hold
  the appropriate state that is then considered in 
set_rx_function().
   - Bug fix: vector scattered packets callback was called regardless the 
appropriate
  preconditions.

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |   1 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  14 ++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 158 
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |  20 +++-
 4 files changed, 128 insertions(+), 65 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h 
b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
index c67d462..c60081c 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
@@ -3657,6 +3657,7 @@ struct ixgbe_hw {
bool force_full_reset;
bool allow_unsupported_sfp;
bool wol_enabled;
+   bool rx_bulk_alloc_allowed;
 };

 #define ixgbe_call_func(hw, func, params, error) \
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 9bdc046..f93dcfc 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -760,8 +760,8 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct 
eth_driver *eth_drv,
   "Using default TX function.");
}

-   if (eth_dev->data->scattered_rx)
-   eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+   set_rx_function(eth_dev);
+
return 0;
}
pci_dev = eth_dev->pci_dev;
@@ -771,6 +771,15 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct 
eth_driver *eth_drv,
hw->vendor_id = pci_dev->id.vendor_id;
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
hw->allow_unsupported_sfp = 1;
+#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
+   /*
+* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
+* allocation preconditions we will reset it.
+*/
+   hw->rx_bulk_alloc_allowed = true;
+#else
+   hw->rx_bulk_alloc_allowed = false;
+#endif /* RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC */

/* Initialize the shared code (base driver) */
 #ifdef RTE_NIC_BYPASS
@@ -1641,6 +1650,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)

/* Clear stored conf */
dev->data->scattered_rx = 0;
+   hw->rx_bulk_alloc_allowed = false;

/* Clear recorded link status */
memset(, 0, sizeof(link));
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 4c67a9e..bdac885 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -2096,12 +2096,12 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused 
struct igb_rx_queue *rxq)

 /* Reset dynamic igb_rx_queue fields back to defaults */
 static void
-ixgbe_reset_rx_queue(struct igb_rx_queue *rxq)
+ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct igb_rx_queue *rxq)
 {
static const union ixgbe_adv_rx_desc zeroed_desc = { .read = {
.pkt_addr = 0}};
unsigned i;
-   uint16_t len;
+   uint16_t len = rxq->nb_rx_desc;

/*
 * By default, the Rx queue setup function allocates enough memory for
@@ -2113,14 +2113,9 @@ ixgbe_reset_rx_queue(struct igb_rx_queue *rxq)
 * constraints here to see if we need to zero out memory after the end
 * of the H/W descriptor ring.
 */
-#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
-   if (check_rx_burst_bulk_alloc_preconditions(rxq) == 0)
+   if (hw->rx_bulk_alloc_allowed)
/* zero out extra memory */
-   len = (uint16_t)(rxq->nb_rx_desc + RTE_PMD_IXGBE_RX_MAX_BURST);
-   else
-#endif
-   /* do not zero out extra memory */
-   len = rxq->nb_rx_desc;
+   len += RTE_PMD_IXGBE_RX_MAX_BURST;

/*
 * Zero out HW ring memory. Zero out extra memory at the end of
@@ -2162,7 +2157,6 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
const struct rte_memzone *rz;
struct igb_rx_queue *rxq;
struct ixgbe_hw *hw;
-   int use_def_burst_func = 1;
uint16_t len;

PMD_INIT_FUNC_TRACE();
@@ -2247,11 +2241,10 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 * S/W ring to make sure look-ahead logic in bulk alloc Rx burst
 * function does not access an invalid memory region.
 */

[dpdk-dev] [PATCH v2 3/6] ixgbe: Code refactoring

2015-03-05 Thread Vlad Zolotarov
- ixgbe_rx_alloc_bufs():
   - Reset the rte_mbuf fields only when requested.
   - Take the RDT update out of the function.
   - Add the stub when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is not defined.
- ixgbe_recv_scattered_pkts():
   - Take the code that updates the fields of the cluster's HEAD buffer into
 the inline function.

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 116 +++---
 1 file changed, 70 insertions(+), 46 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 35a88d8..4c67a9e 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1022,7 +1022,7 @@ ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
 }

 static inline int
-ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
+ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq, bool reset_mbuf)
 {
volatile union ixgbe_adv_rx_desc *rxdp;
struct igb_rx_entry *rxep;
@@ -1043,11 +1043,14 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
for (i = 0; i < rxq->rx_free_thresh; ++i) {
/* populate the static rte mbuf fields */
mb = rxep[i].mbuf;
-   rte_mbuf_refcnt_set(mb, 1);
-   mb->next = NULL;
+   if (reset_mbuf) {
+   rte_mbuf_refcnt_set(mb, 1);
+   mb->next = NULL;
+   mb->nb_segs = 1;
+   mb->port = rxq->port_id;
+   }
+
mb->data_off = RTE_PKTMBUF_HEADROOM;
-   mb->nb_segs = 1;
-   mb->port = rxq->port_id;

/* populate the descriptors */
dma_addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb));
@@ -1055,10 +1058,6 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
rxdp[i].read.pkt_addr = dma_addr;
}

-   /* update tail pointer */
-   rte_wmb();
-   IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rxq->rx_free_trigger);
-
/* update state of internal queue structure */
rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
@@ -1110,7 +1109,9 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,

/* if required, allocate new buffers to replenish descriptors */
if (rxq->rx_tail > rxq->rx_free_trigger) {
-   if (ixgbe_rx_alloc_bufs(rxq) != 0) {
+   uint16_t cur_free_trigger = rxq->rx_free_trigger;
+
+   if (ixgbe_rx_alloc_bufs(rxq, true) != 0) {
int i, j;
PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
   "queue_id=%u", (unsigned) rxq->port_id,
@@ -1130,6 +1131,10 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,

return 0;
}
+
+   /* update tail pointer */
+   rte_wmb();
+   IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, cur_free_trigger);
}

if (rxq->rx_tail >= rxq->nb_rx_desc)
@@ -1169,6 +1174,13 @@ ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct 
rte_mbuf **rx_pkts,

return nb_rx;
 }
+#else
+static inline int
+ixgbe_rx_alloc_bufs(__rte_unused struct igb_rx_queue *rxq,
+   __rte_unused bool reset_mbuf)
+{
+   return -ENOMEM;
+}
 #endif /* RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC */

 uint16_t
@@ -1353,6 +1365,51 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts,
return (nb_rx);
 }

+/**
+ * Initialize the first mbuf of the returned packet:
+ *- RX port identifier,
+ *- hardware offload data, if any:
+ *  - RSS flag & hash,
+ *  - IP checksum flag,
+ *  - VLAN TCI, if any,
+ *  - error flags.
+ * @head HEAD of the packet cluster
+ * @desc HW descriptor to get data from
+ * @port_id Port ID of the Rx queue
+ */
+static inline void ixgbe_fill_cluster_head_buf(
+   struct rte_mbuf *head,
+   union ixgbe_adv_rx_desc *desc,
+   uint8_t port_id,
+   uint32_t staterr)
+{
+   uint32_t hlen_type_rss;
+   uint64_t pkt_flags;
+
+   head->port = port_id;
+
+   /*
+* The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
+* set in the pkt_flags field.
+*/
+   head->vlan_tci = rte_le_to_cpu_16(desc->wb.upper.vlan);
+   hlen_type_rss = rte_le_to_cpu_32(desc->wb.lower.lo_dword.data);
+   pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
+   pkt_flags |= rx_desc_status_to_pkt_flags(staterr);
+   pkt_flags |= rx_desc_error_to_pkt_flags(staterr);
+   head->ol_flags = pkt_flags;
+
+   if (likely(pkt_flags & PKT_RX_RSS_HASH))
+   head->hash.rss = rte_le_to_cpu_32(desc->wb.lower.hi_dword.rss);
+   else if (pkt_flags & PKT_RX_FDIR) {
+   head->hash.fdir.hash =
+   

[dpdk-dev] [PATCH v2 2/6] ixgbe: Bug fix: Properly configure Rx CRC stripping for x540 devices

2015-03-05 Thread Vlad Zolotarov
According to x540 spec chapter 8.2.4.8.9 CRCSTRIP field of RDRXCTL should
be configured to the same value as HLREG0.RXCRCSTRP.

Clearing the RDRXCTL.RSCFRSTSIZE field for x540 is not required by the spec
but seems harmless.

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 6c0e466..35a88d8 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3687,7 +3687,8 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)

IXGBE_WRITE_REG(hw, IXGBE_RXCSUM, rxcsum);

-   if (hw->mac.type == ixgbe_mac_82599EB) {
+   if (hw->mac.type == ixgbe_mac_82599EB ||
+   hw->mac.type == ixgbe_mac_X540) {
rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
if (rx_conf->hw_strip_crc)
rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
-- 
2.1.0



[dpdk-dev] [PATCH v2 1/6] ixgbe: Cleanups

2015-03-05 Thread Vlad Zolotarov
   - Removed the not needed casting.
   - Use the rte_le_to_cpu_xx()/rte_cpu_to_le_xx() when reading/setting HW
 ring descriptor fields. There were a few places where fields were 
accessed/written
 directly, which would break on big endian platforms like Power PC.
   - ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable 
to access
  >data->dev_conf.rxmode.

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 52 +--
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 3059375..6c0e466 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1028,12 +1028,11 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
struct igb_rx_entry *rxep;
struct rte_mbuf *mb;
uint16_t alloc_idx;
-   uint64_t dma_addr;
+   __le64 dma_addr;
int diag, i;

/* allocate buffers in bulk directly into the S/W ring */
-   alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-   (rxq->rx_free_thresh - 1));
+   alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);
rxep = >sw_ring[alloc_idx];
diag = rte_mempool_get_bulk(rxq->mb_pool, (void *)rxep,
rxq->rx_free_thresh);
@@ -1051,7 +1050,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
mb->port = rxq->port_id;

/* populate the descriptors */
-   dma_addr = (uint64_t)mb->buf_physaddr + RTE_PKTMBUF_HEADROOM;
+   dma_addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb));
rxdp[i].read.hdr_addr = dma_addr;
rxdp[i].read.pkt_addr = dma_addr;
}
@@ -1061,10 +1060,9 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rxq->rx_free_trigger);

/* update state of internal queue structure */
-   rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_trigger +
-   rxq->rx_free_thresh);
+   rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
-   rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
+   rxq->rx_free_trigger = rxq->rx_free_thresh - 1;

/* no errors */
return 0;
@@ -1559,13 +1557,14 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct 
rte_mbuf **rx_pkts,
first_seg->ol_flags = pkt_flags;

if (likely(pkt_flags & PKT_RX_RSS_HASH))
-   first_seg->hash.rss = rxd.wb.lower.hi_dword.rss;
+   first_seg->hash.rss =
+   rte_le_to_cpu_32(rxd.wb.lower.hi_dword.rss);
else if (pkt_flags & PKT_RX_FDIR) {
first_seg->hash.fdir.hash =
-   (uint16_t)((rxd.wb.lower.hi_dword.csum_ip.csum)
-  & IXGBE_ATR_HASH_MASK);
+   rte_le_to_cpu_16(rxd.wb.lower.hi_dword.csum_ip.csum)
+  & IXGBE_ATR_HASH_MASK;
first_seg->hash.fdir.id =
-   rxd.wb.lower.hi_dword.csum_ip.ip_id;
+ rte_le_to_cpu_16(rxd.wb.lower.hi_dword.csum_ip.ip_id);
}

/* Prefetch data of first segment, if configured to do so. */
@@ -2248,6 +2247,12 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 #ifdef RTE_IXGBE_INC_VECTOR
ixgbe_rxq_vec_setup(rxq);
 #endif
+   /*
+* TODO: This must be moved to ixgbe_dev_rx_init() since rx_pkt_burst
+* is a global per-device callback thus bulk allocation may be used
+* only if all queues meet the above preconditions.
+*/
+
/* Check if pre-conditions are satisfied, and no Scattered Rx */
if (!use_def_burst_func && !dev->data->scattered_rx) {
 #ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
@@ -3523,6 +3528,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
uint32_t rxcsum;
uint16_t buf_size;
uint16_t i;
+   struct rte_eth_rxmode *rx_conf = >data->dev_conf.rxmode;

PMD_INIT_FUNC_TRACE();
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3545,7 +3551,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 * Configure CRC stripping, if any.
 */
hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-   if (dev->data->dev_conf.rxmode.hw_strip_crc)
+   if (rx_conf->hw_strip_crc)
hlreg0 |= IXGBE_HLREG0_RXCRCSTRP;
else
hlreg0 &= ~IXGBE_HLREG0_RXCRCSTRP;
@@ -3553,11 +3559,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
/*
 * Configure jumbo frame support, if any.
 */
-   if 

[dpdk-dev] [PATCH v2 0/6]: Add LRO support to ixgbe PMD

2015-03-05 Thread Vlad Zolotarov
This series adds the missing flow for enabling the LRO in the ethdev and
adds a support for this feature in the ixgbe PMD. There is a big hope that this
initiative is going to be picked up by some Intel developer that would add the 
LRO support
to other Intel PMDs. ;)

The series starts with some cleanup work in the code the final patch (the 
actual adding of
the LRO support) is going to touch/use/change. There are still quite a few 
issues in the ixgbe
PMD code left but they have to be a matter of a different series and I've left 
a few "TODO"
remarks in the code.

The LRO ("RSC" in Intel's context) PMD completion handling code follows the 
same design as the
corresponding Linux and FreeBSD implementation: pass the aggregation's cluster 
HEAD buffer to
the NEXTP entry of the software ring till EOP is met.

HW configuration follows the corresponding specs: this feature is supported 
only by x540 and
82599 PF devices.

The feature has been tested with seastar TCP stack with the following 
configuration on Tx side:
   - MTU: 400B
   - 100 concurrent TCP connections.

The results were:
   - Without LRO: total throughput: 0.12Gbps, coefficient of variance: 1.41%
   - With LRO:total throughput: 8.21Gbps, coefficient of variance: 0.59%

This is an almost factor 80 improvement.

New in v2:
   - Removed rte_eth_dev_data.lro_bulk_alloc and added 
ixgbe_hw.rx_bulk_alloc_allowed
 instead.
   - Unified the rx_pkt_bulk callback setting (a separate new patch).
   - Fixed a few styling and spelling issues.

Vlad Zolotarov (6):
  ixgbe: Cleanups
  ixgbe: Bug fix: Properly configure Rx CRC stripping for x540 devices
  ixgbe: Code refactoring
  ixgbe: Unify the rx_pkt_bulk callback initialization
  common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option
  ixgbe: Add LRO support

 config/common_linuxapp  |   1 +
 lib/librte_ether/rte_ethdev.h   |   6 +-
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |   1 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  22 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 869 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |  26 +-
 7 files changed, 798 insertions(+), 132 deletions(-)

-- 
2.1.0



[dpdk-dev] [PATCH 3/3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Qiu, Michael
On 3/5/2015 9:16 PM, Qiu, Michael wrote:
> include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ?REG_EAX?
> In file included from /usr/include/signal.h:358:0,
>  from /usr/include/sys/wait.h:30,
>  from /root/dpdk/app/test/test_mp_secondary.c:50:
> /usr/include/sys/ucontext.h:180:3: note: previous definition of ?REG_EAX? was 
> here
>
> In i686, from REG_EAX to REG_EDX are all defined in
>   /usr/include/sys/ucontext.h
>
> Rename to CPU_REG_EAX to avoid this issue.
>
> Signed-off-by: Michael Qou 

Sorry, Michael Qou--> Michael Qiu

Thanks,
Michael
> ---
>  .../common/include/arch/x86/rte_cpuflags.h | 210 
> ++---
>  1 file changed, 105 insertions(+), 105 deletions(-)
>
> diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h 
> b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> index a58dd7b..f367b91 100644
> --- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> +++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> @@ -151,104 +151,104 @@ enum rte_cpu_flag_t {
>  };
>  
>  enum cpu_register_t {
> - REG_EAX = 0,
> - REG_EBX,
> - REG_ECX,
> - REG_EDX,
> + CPU_REG_EAX = 0,
> + CPU_REG_EBX,
> + CPU_REG_ECX,
> + CPU_REG_EDX,
>  };
>  
>  static const struct feature_entry cpu_feature_table[] = {
> - FEAT_DEF(SSE3, 0x0001, 0, REG_ECX,  0)
> - FEAT_DEF(PCLMULQDQ, 0x0001, 0, REG_ECX,  1)
> - FEAT_DEF(DTES64, 0x0001, 0, REG_ECX,  2)
> - FEAT_DEF(MONITOR, 0x0001, 0, REG_ECX,  3)
> - FEAT_DEF(DS_CPL, 0x0001, 0, REG_ECX,  4)
> - FEAT_DEF(VMX, 0x0001, 0, REG_ECX,  5)
> - FEAT_DEF(SMX, 0x0001, 0, REG_ECX,  6)
> - FEAT_DEF(EIST, 0x0001, 0, REG_ECX,  7)
> - FEAT_DEF(TM2, 0x0001, 0, REG_ECX,  8)
> - FEAT_DEF(SSSE3, 0x0001, 0, REG_ECX,  9)
> - FEAT_DEF(CNXT_ID, 0x0001, 0, REG_ECX, 10)
> - FEAT_DEF(FMA, 0x0001, 0, REG_ECX, 12)
> - FEAT_DEF(CMPXCHG16B, 0x0001, 0, REG_ECX, 13)
> - FEAT_DEF(XTPR, 0x0001, 0, REG_ECX, 14)
> - FEAT_DEF(PDCM, 0x0001, 0, REG_ECX, 15)
> - FEAT_DEF(PCID, 0x0001, 0, REG_ECX, 17)
> - FEAT_DEF(DCA, 0x0001, 0, REG_ECX, 18)
> - FEAT_DEF(SSE4_1, 0x0001, 0, REG_ECX, 19)
> - FEAT_DEF(SSE4_2, 0x0001, 0, REG_ECX, 20)
> - FEAT_DEF(X2APIC, 0x0001, 0, REG_ECX, 21)
> - FEAT_DEF(MOVBE, 0x0001, 0, REG_ECX, 22)
> - FEAT_DEF(POPCNT, 0x0001, 0, REG_ECX, 23)
> - FEAT_DEF(TSC_DEADLINE, 0x0001, 0, REG_ECX, 24)
> - FEAT_DEF(AES, 0x0001, 0, REG_ECX, 25)
> - FEAT_DEF(XSAVE, 0x0001, 0, REG_ECX, 26)
> - FEAT_DEF(OSXSAVE, 0x0001, 0, REG_ECX, 27)
> - FEAT_DEF(AVX, 0x0001, 0, REG_ECX, 28)
> - FEAT_DEF(F16C, 0x0001, 0, REG_ECX, 29)
> - FEAT_DEF(RDRAND, 0x0001, 0, REG_ECX, 30)
> -
> - FEAT_DEF(FPU, 0x0001, 0, REG_EDX,  0)
> - FEAT_DEF(VME, 0x0001, 0, REG_EDX,  1)
> - FEAT_DEF(DE, 0x0001, 0, REG_EDX,  2)
> - FEAT_DEF(PSE, 0x0001, 0, REG_EDX,  3)
> - FEAT_DEF(TSC, 0x0001, 0, REG_EDX,  4)
> - FEAT_DEF(MSR, 0x0001, 0, REG_EDX,  5)
> - FEAT_DEF(PAE, 0x0001, 0, REG_EDX,  6)
> - FEAT_DEF(MCE, 0x0001, 0, REG_EDX,  7)
> - FEAT_DEF(CX8, 0x0001, 0, REG_EDX,  8)
> - FEAT_DEF(APIC, 0x0001, 0, REG_EDX,  9)
> - FEAT_DEF(SEP, 0x0001, 0, REG_EDX, 11)
> - FEAT_DEF(MTRR, 0x0001, 0, REG_EDX, 12)
> - FEAT_DEF(PGE, 0x0001, 0, REG_EDX, 13)
> - FEAT_DEF(MCA, 0x0001, 0, REG_EDX, 14)
> - FEAT_DEF(CMOV, 0x0001, 0, REG_EDX, 15)
> - FEAT_DEF(PAT, 0x0001, 0, REG_EDX, 16)
> - FEAT_DEF(PSE36, 0x0001, 0, REG_EDX, 17)
> - FEAT_DEF(PSN, 0x0001, 0, REG_EDX, 18)
> - FEAT_DEF(CLFSH, 0x0001, 0, REG_EDX, 19)
> - FEAT_DEF(DS, 0x0001, 0, REG_EDX, 21)
> - FEAT_DEF(ACPI, 0x0001, 0, REG_EDX, 22)
> - FEAT_DEF(MMX, 0x0001, 0, REG_EDX, 23)
> - FEAT_DEF(FXSR, 0x0001, 0, REG_EDX, 24)
> - FEAT_DEF(SSE, 0x0001, 0, REG_EDX, 25)
> - FEAT_DEF(SSE2, 0x0001, 0, REG_EDX, 26)
> - FEAT_DEF(SS, 0x0001, 0, REG_EDX, 27)
> - FEAT_DEF(HTT, 0x0001, 0, REG_EDX, 28)
> - FEAT_DEF(TM, 0x0001, 0, REG_EDX, 29)
> - FEAT_DEF(PBE, 0x0001, 0, REG_EDX, 31)
> -
> - FEAT_DEF(DIGTEMP, 0x0006, 0, REG_EAX,  0)
> - FEAT_DEF(TRBOBST, 0x0006, 0, REG_EAX,  1)
> - FEAT_DEF(ARAT, 0x0006, 0, REG_EAX,  2)
> - FEAT_DEF(PLN, 0x0006, 0, REG_EAX,  4)
> - FEAT_DEF(ECMD, 0x0006, 0, REG_EAX,  5)
> - FEAT_DEF(PTM, 0x0006, 0, REG_EAX,  6)
> -
> - FEAT_DEF(MPERF_APERF_MSR, 0x0006, 0, REG_ECX,  0)
> - FEAT_DEF(ACNT2, 0x0006, 0, REG_ECX,  1)
> - FEAT_DEF(ENERGY_EFF, 0x0006, 0, REG_ECX,  3)
> -
> - FEAT_DEF(FSGSBASE, 0x0007, 0, REG_EBX,  0)
> - FEAT_DEF(BMI1, 0x0007, 0, REG_EBX,  2)
> - FEAT_DEF(HLE, 0x0007, 0, REG_EBX,  4)
> - FEAT_DEF(AVX2, 

[dpdk-dev] [PATCH 3/3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-05 Thread Bruce Richardson
On Thu, Mar 05, 2015 at 09:15:39PM +0800, Michael Qiu wrote:
> include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ?REG_EAX?
> In file included from /usr/include/signal.h:358:0,
>  from /usr/include/sys/wait.h:30,
>  from /root/dpdk/app/test/test_mp_secondary.c:50:
> /usr/include/sys/ucontext.h:180:3: note: previous definition of ?REG_EAX? was 
> here
> 
> In i686, from REG_EAX to REG_EDX are all defined in
>   /usr/include/sys/ucontext.h
> 
> Rename to CPU_REG_EAX to avoid this issue.
RTE_ prefix for consistency with other public DPDK symbols perhaps?

/Bruce

> 
> Signed-off-by: Michael Qou 
> ---
>  .../common/include/arch/x86/rte_cpuflags.h | 210 
> ++---
>  1 file changed, 105 insertions(+), 105 deletions(-)
> 
> diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h 
> b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> index a58dd7b..f367b91 100644
> --- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> +++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> @@ -151,104 +151,104 @@ enum rte_cpu_flag_t {
>  };
>  
>  enum cpu_register_t {
> - REG_EAX = 0,
> - REG_EBX,
> - REG_ECX,
> - REG_EDX,
> + CPU_REG_EAX = 0,
> + CPU_REG_EBX,
> + CPU_REG_ECX,
> + CPU_REG_EDX,
>  };
>  
>  static const struct feature_entry cpu_feature_table[] = {
> - FEAT_DEF(SSE3, 0x0001, 0, REG_ECX,  0)
> - FEAT_DEF(PCLMULQDQ, 0x0001, 0, REG_ECX,  1)
> - FEAT_DEF(DTES64, 0x0001, 0, REG_ECX,  2)
> - FEAT_DEF(MONITOR, 0x0001, 0, REG_ECX,  3)
> - FEAT_DEF(DS_CPL, 0x0001, 0, REG_ECX,  4)
> - FEAT_DEF(VMX, 0x0001, 0, REG_ECX,  5)
> - FEAT_DEF(SMX, 0x0001, 0, REG_ECX,  6)
> - FEAT_DEF(EIST, 0x0001, 0, REG_ECX,  7)
> - FEAT_DEF(TM2, 0x0001, 0, REG_ECX,  8)
> - FEAT_DEF(SSSE3, 0x0001, 0, REG_ECX,  9)
> - FEAT_DEF(CNXT_ID, 0x0001, 0, REG_ECX, 10)
> - FEAT_DEF(FMA, 0x0001, 0, REG_ECX, 12)
> - FEAT_DEF(CMPXCHG16B, 0x0001, 0, REG_ECX, 13)
> - FEAT_DEF(XTPR, 0x0001, 0, REG_ECX, 14)
> - FEAT_DEF(PDCM, 0x0001, 0, REG_ECX, 15)
> - FEAT_DEF(PCID, 0x0001, 0, REG_ECX, 17)
> - FEAT_DEF(DCA, 0x0001, 0, REG_ECX, 18)
> - FEAT_DEF(SSE4_1, 0x0001, 0, REG_ECX, 19)
> - FEAT_DEF(SSE4_2, 0x0001, 0, REG_ECX, 20)
> - FEAT_DEF(X2APIC, 0x0001, 0, REG_ECX, 21)
> - FEAT_DEF(MOVBE, 0x0001, 0, REG_ECX, 22)
> - FEAT_DEF(POPCNT, 0x0001, 0, REG_ECX, 23)
> - FEAT_DEF(TSC_DEADLINE, 0x0001, 0, REG_ECX, 24)
> - FEAT_DEF(AES, 0x0001, 0, REG_ECX, 25)
> - FEAT_DEF(XSAVE, 0x0001, 0, REG_ECX, 26)
> - FEAT_DEF(OSXSAVE, 0x0001, 0, REG_ECX, 27)
> - FEAT_DEF(AVX, 0x0001, 0, REG_ECX, 28)
> - FEAT_DEF(F16C, 0x0001, 0, REG_ECX, 29)
> - FEAT_DEF(RDRAND, 0x0001, 0, REG_ECX, 30)
> -
> - FEAT_DEF(FPU, 0x0001, 0, REG_EDX,  0)
> - FEAT_DEF(VME, 0x0001, 0, REG_EDX,  1)
> - FEAT_DEF(DE, 0x0001, 0, REG_EDX,  2)
> - FEAT_DEF(PSE, 0x0001, 0, REG_EDX,  3)
> - FEAT_DEF(TSC, 0x0001, 0, REG_EDX,  4)
> - FEAT_DEF(MSR, 0x0001, 0, REG_EDX,  5)
> - FEAT_DEF(PAE, 0x0001, 0, REG_EDX,  6)
> - FEAT_DEF(MCE, 0x0001, 0, REG_EDX,  7)
> - FEAT_DEF(CX8, 0x0001, 0, REG_EDX,  8)
> - FEAT_DEF(APIC, 0x0001, 0, REG_EDX,  9)
> - FEAT_DEF(SEP, 0x0001, 0, REG_EDX, 11)
> - FEAT_DEF(MTRR, 0x0001, 0, REG_EDX, 12)
> - FEAT_DEF(PGE, 0x0001, 0, REG_EDX, 13)
> - FEAT_DEF(MCA, 0x0001, 0, REG_EDX, 14)
> - FEAT_DEF(CMOV, 0x0001, 0, REG_EDX, 15)
> - FEAT_DEF(PAT, 0x0001, 0, REG_EDX, 16)
> - FEAT_DEF(PSE36, 0x0001, 0, REG_EDX, 17)
> - FEAT_DEF(PSN, 0x0001, 0, REG_EDX, 18)
> - FEAT_DEF(CLFSH, 0x0001, 0, REG_EDX, 19)
> - FEAT_DEF(DS, 0x0001, 0, REG_EDX, 21)
> - FEAT_DEF(ACPI, 0x0001, 0, REG_EDX, 22)
> - FEAT_DEF(MMX, 0x0001, 0, REG_EDX, 23)
> - FEAT_DEF(FXSR, 0x0001, 0, REG_EDX, 24)
> - FEAT_DEF(SSE, 0x0001, 0, REG_EDX, 25)
> - FEAT_DEF(SSE2, 0x0001, 0, REG_EDX, 26)
> - FEAT_DEF(SS, 0x0001, 0, REG_EDX, 27)
> - FEAT_DEF(HTT, 0x0001, 0, REG_EDX, 28)
> - FEAT_DEF(TM, 0x0001, 0, REG_EDX, 29)
> - FEAT_DEF(PBE, 0x0001, 0, REG_EDX, 31)
> -
> - FEAT_DEF(DIGTEMP, 0x0006, 0, REG_EAX,  0)
> - FEAT_DEF(TRBOBST, 0x0006, 0, REG_EAX,  1)
> - FEAT_DEF(ARAT, 0x0006, 0, REG_EAX,  2)
> - FEAT_DEF(PLN, 0x0006, 0, REG_EAX,  4)
> - FEAT_DEF(ECMD, 0x0006, 0, REG_EAX,  5)
> - FEAT_DEF(PTM, 0x0006, 0, REG_EAX,  6)
> -
> - FEAT_DEF(MPERF_APERF_MSR, 0x0006, 0, REG_ECX,  0)
> - FEAT_DEF(ACNT2, 0x0006, 0, REG_ECX,  1)
> - FEAT_DEF(ENERGY_EFF, 0x0006, 0, REG_ECX,  3)
> -
> - FEAT_DEF(FSGSBASE, 0x0007, 0, REG_EBX,  0)
> - FEAT_DEF(BMI1, 0x0007, 0, REG_EBX,  2)
> - FEAT_DEF(HLE, 

[dpdk-dev] [PATCH 2/3] app/test: Fix size_t printf formart issue

2015-03-05 Thread Bruce Richardson
On Thu, Mar 05, 2015 at 09:15:38PM +0800, Michael Qiu wrote:
> test_hash.c: In function ?test_crc32_hash_alg_equiv?:
> error: format ?%lu? expects argument of type ?long unsigned int?,
> but argument 2 has type ?size_t? [-Werror=format]
> 
> According to C99, for size_t type should use formart "%zu"
> 
> Signed-off-by: Michael Qiu 

Typo in title. Otherwise
Acked-by: Bruce Richardson 
> ---
>  app/test/test_hash.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test/test_hash.c b/app/test/test_hash.c
> index 653dd86..c489b8b 100644
> --- a/app/test/test_hash.c
> +++ b/app/test/test_hash.c
> @@ -226,7 +226,7 @@ test_crc32_hash_alg_equiv(void)
>   if (i == CRC32_ITERATIONS)
>   return 0;
>  
> - printf("Failed test data (hex, %lu bytes total):\n", data_len);
> + printf("Failed test data (hex, %zu bytes total):\n", data_len);
>   for (j = 0; j < data_len; j++)
>   printf("%02X%c", ((uint8_t *)data64)[j],
>   ((j+1) % 16 == 0 || j == data_len - 1) ? '\n' : 
> ' ');
> -- 
> 1.9.3
> 


[dpdk-dev] Not getting statistics for all queues.

2015-03-05 Thread Alexandra Sava
ping  :-) ? Any thoughts about this ?


Thanks,
Alexandra

On 2 March 2015 at 17:00, Alexandra Sava  wrote:

> Hi,
>
> lspci command shows the following:
>
> *04:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit
> SFI/SFP+ Network Connection (rev 01)Subsystem: Hewlett-Packard Company
> Ethernet 10Gb 2-port 560SFP+ Adapter*
>
>
> Thanks,
> Alexandra
>
> On 2 March 2015 at 11:15, Gonzalez Monroy, Sergio <
> sergio.gonzalez.monroy at intel.com> wrote:
>
>> Hi Alexandra,
>>
>>
>> On 02/03/2015 08:50, Alexandra Sava wrote:
>>
>>> Hi guys,
>>>
>>> Did you have a chance to look over my question?
>>>
>>>
>>>
>>> Thanks,
>>> Alexandra
>>>
>>>
>>> On 24 February 2015 at 13:14, Alexandra Sava 
>>> wrote:
>>>
 Hi guys,

 I'm trying to get statistics per queue (on rx side), therefore I'm
 using rte_eth_dev_set_rx_queue_stats_mapping
 function in order to map a particular queue to a stat index (Note: I
 have 4 rx queues with the following mapping: queue 0 -> stat_idx 0;
 queue 1 -> stat_idx 1 , etc).
 The problem is that I only get statistics for the first queue (in this
 case, queue 0), the rest of them are 0. Also, the statistics for the
 first
 queue are equal to the total statistics, so
 rte_eth_stats.ipackets
 is equal to rte_eth_stats.q_ipackets[0] and rte_eth_stats.ibytes is
 equal to rte_eth_stats.q_ibytes[0].

 I'm using dpdk-1.8.0, Ubuntu 12.04, Intel x86_64 architecture.

 Any idea about this issue ?

>>> What NIC are you using?
>>
>> Sergio
>>
>>>

 Thanks,
 Alexandra

>>>
>


[dpdk-dev] [PATCH v3] ABI: Add abi checking utility

2015-03-05 Thread Neil Horman
On Wed, Mar 04, 2015 at 05:49:50PM +0100, Thomas Monjalon wrote:
> 2015-03-04 11:26, Neil Horman:
> > +#trap on ctrl-c to clean up
> > +trap cleanup_and_exit SIGINT
> 
> I think INT is preffered over SIGINT.
> You may also add QUIT and TERM.
> With QUIT, you can replace cleanup_and_exit calls by a simple exit.
> 
> > +   CURRENT_BRANCH=`git log --pretty=format:%H HEAD~1..HEAD`
> 
> May be simpler "git log -1 --format=%H"
> 
It might be, but the above is equivalent, and --format is a more recent git-log
feature.  Older versions still require --pretty=format

> > +log "INFO" "We're going to check and make sure that applications built"
> > +log "INFO" "against DPDK DSOs from tag $TAG1 will still run when executed"
> > +log "INFO" "against DPDK DSOs built from tag $TAG2."
> 
> I think it may be removed as no app is run.
> 
The above doesn't indicate that an application will be run, only that the
purpose of this script is to ensure that older applications will still run,
which I think is appropriate.

> > +# Make sure we configure SHARED libraries
> > +# Also turn off IGB and KNI as those require kernel headers to build
> > +sed -i -e"$ a\CONFIG_RTE_BUILD_SHARED_LIB=y" config/defconfig_$TARGET
> > +sed -i -e"$ a\CONFIG_RTE_EAL_IGB_UIO=n" config/defconfig_$TARGET
> > +sed -i -e"$ a\CONFIG_RTE_LIBRTE_KNI=n" config/defconfig_$TARGET
> 
> So you prefer modifying defconfig instead of .config, right?
> (you sent it while I was answering on v2)
> 
Yes, correct.

> > +# Checking abi compliance relies on using the dwarf information in
> > +# The shared objects.  Thats only included in the DSO's if we build
> > +# with -g
> > +export EXTRA_CFLAGS=-g
> > +export EXTRA_LDFLAGS=-g
> [...]
> > +export EXTRA_CFLAGS=-g
> > +export EXTRA_LDFLAGS=-g
> 
> Already exported.
> 
Yeah, I'll clean that up later.

> > +   OLDNAME=`basename $i | sed -e"s/1.dump/0.dump/"`
> 
> Could be OLDNAME=$(basename $i 1.dump)0.dump
> 
> > +   LIBNAME=`basename $i | sed -e"s/-ABI-1.dump//"`
> 
> Could be LIBNAME=$(basename $i -ABI-1.dump)
> 
It could be, but I prefer the clarity of the sed replacement.

Neil

> Thanks
> 
> 


[dpdk-dev] [PATCH] testpmd: HW vlan command

2015-03-05 Thread Thomas Monjalon
2015-03-03 23:52, De Lara Guarch, Pablo:
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ouyang Changchun
> > Sent: Friday, February 13, 2015 12:04 PM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCH] testpmd: HW vlan command
> > 
> > This patch enables testpmd user can config port hw_vlan with more fine
> > granularity:
> > hw vlan filter, hw vlan strip, and hw vlan extend.
> > 
> > Don't remove the original command(hw-vlan) considering that some user still
> > want to use
> > only one command to switch on/off all 3 options.
> > 
> > Signed-off-by: Changchun Ouyang 
> 
> Acked-by: Pablo de Lara 

Changchun, Pablo, now the rule should be to take care of documentation
and submit the according update in the same patch (if small) or the
same patchset.
Could you make a v2 please?

Thanks


[dpdk-dev] [PATCH v1] ixgbe/vector: add rxd 2^n check to avoid mbuf leak

2015-03-05 Thread Bruce Richardson
On Mon, Mar 02, 2015 at 09:28:24PM +0800, Cunming Liang wrote:
> The mbuf leak happens when the assigned number of rx descriptor is not power 
> of 2.
> As it's presumed on vpmd rx(for rx_tail wrap), adding condition check to 
> prevent it.
> The root cause reference code in *_recv_raw_pkts_vec* as below.
> "rxq->rx_tail = (uint16_t)(rxq->rx_tail & (rxq->nb_rx_desc - 1));".
> 
> Reported-by: Stephen Hemminger 
> Signed-off-by: Cunming Liang 
Acked-by: Bruce Richardson 
> ---
>  The issue was reported in 
> http://www.dpdk.org/ml/archives/dev/2015-February/014127.html
> 
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 51 
> ++-
>  1 file changed, 18 insertions(+), 33 deletions(-)
> 
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> index 3059375..9ecf3e5 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> @@ -2257,7 +2257,8 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
>rxq->port_id, rxq->queue_id);
>   dev->rx_pkt_burst = ixgbe_recv_pkts_bulk_alloc;
>  #ifdef RTE_IXGBE_INC_VECTOR
> - if (!ixgbe_rx_vec_condition_check(dev)) {
> + if (!ixgbe_rx_vec_condition_check(dev) &&
> + (rte_is_power_of_2(nb_desc))) {
>   PMD_INIT_LOG(INFO, "Vector rx enabled, please make "
>"sure RX burst size no less than 32.");
>   dev->rx_pkt_burst = ixgbe_recv_pkts_vec;
> @@ -3639,31 +3640,23 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
>   buf_size = (uint16_t) ((srrctl & IXGBE_SRRCTL_BSIZEPKT_MASK) <<
>  IXGBE_SRRCTL_BSIZEPKT_SHIFT);
>  
> - /* It adds dual VLAN length for supporting dual VLAN */
> - if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +
> + if (dev->data->dev_conf.rxmode.enable_scatter ||
> + /* It adds dual VLAN length for supporting dual VLAN */
> + (dev->data->dev_conf.rxmode.max_rx_pkt_len +
>   2 * IXGBE_VLAN_TAG_SIZE) > buf_size){
>   if (!dev->data->scattered_rx)
>   PMD_INIT_LOG(DEBUG, "forcing scatter mode");
>   dev->data->scattered_rx = 1;
>  #ifdef RTE_IXGBE_INC_VECTOR
> - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec;
> -#else
> - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
> + if (rte_is_power_of_2(rxq->nb_rx_desc))
> + dev->rx_pkt_burst =
> + ixgbe_recv_scattered_pkts_vec;
> + else
>  #endif
> + dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
>   }
>   }
>  
> - if (dev->data->dev_conf.rxmode.enable_scatter) {
> - if (!dev->data->scattered_rx)
> - PMD_INIT_LOG(DEBUG, "forcing scatter mode");
> -#ifdef RTE_IXGBE_INC_VECTOR
> - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec;
> -#else
> - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
> -#endif
> - dev->data->scattered_rx = 1;
> - }
> -
>   /*
>* Device configured with multiple RX queues.
>*/
> @@ -4156,17 +4149,20 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
>   buf_size = (uint16_t) ((srrctl & IXGBE_SRRCTL_BSIZEPKT_MASK) <<
>  IXGBE_SRRCTL_BSIZEPKT_SHIFT);
>  
> - /* It adds dual VLAN length for supporting dual VLAN */
> - if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +
> + if (dev->data->dev_conf.rxmode.enable_scatter ||
> + /* It adds dual VLAN length for supporting dual VLAN */
> + (dev->data->dev_conf.rxmode.max_rx_pkt_len +
>   2 * IXGBE_VLAN_TAG_SIZE) > buf_size) {
>   if (!dev->data->scattered_rx)
>   PMD_INIT_LOG(DEBUG, "forcing scatter mode");
>   dev->data->scattered_rx = 1;
>  #ifdef RTE_IXGBE_INC_VECTOR
> - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec;
> -#else
> - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
> + if (rte_is_power_of_2(rxq->nb_rx_desc))
> + dev->rx_pkt_burst =
> + ixgbe_recv_scattered_pkts_vec;
> + else
>  #endif
> + dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
>   }
>   }
>  
> @@ -4184,17 +4180,6 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
>   IXGBE_PSRTYPE_RQPL_SHIFT;
>   IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, psrtype);
>  
> - if (dev->data->dev_conf.rxmode.enable_scatter) {
> - if (!dev->data->scattered_rx)
> -  

[dpdk-dev] [PATCH v1 5/5] ixgbe: Add LRO support

2015-03-05 Thread Vlad Zolotarov


On 03/04/15 20:54, Stephen Hemminger wrote:
> On Wed, 04 Mar 2015 09:57:24 +0200
> Vlad Zolotarov  wrote:
>
>>
>> On 03/04/15 02:33, Stephen Hemminger wrote:
>>> On Tue,  3 Mar 2015 21:48:43 +0200
>>> Vlad Zolotarov  wrote:
>>>
 +  next_desc:
 +  /*
 +   * The code in this whole file uses the volatile pointer to
 +   * ensure the read ordering of the status and the rest of the
 +   * descriptor fields (on the compiler level only!!!). This is so
 +   * UGLY - why not to just use the compiler barrier instead? DPDK
 +   * even has the rte_compiler_barrier() for that.
 +   *
 +   * But most importantly this is just wrong because this doesn't
 +   * ensure memory ordering in a general case at all. For
 +   * instance, DPDK is supposed to work on Power CPUs where
 +   * compiler barrier may just not be enough!
 +   *
 +   * I tried to write only this function properly to have a
 +   * starting point (as a part of an LRO/RSC series) but the
 +   * compiler cursed at me when I tried to cast away the
 +   * "volatile" from rx_ring (yes, it's volatile too!!!). So, I'm
 +   * keeping it the way it is for now.
 +   *
 +   * The code in this file is broken in so many other places and
 +   * will just not work on a big endian CPU anyway therefore the
 +   * lines below will have to be revisited together with the rest
 +   * of the ixgbe PMD.
 +   *
 +   * TODO:
 +   *- Get rid of "volatile" crap and let the compiler do its
 +   *  job.
 +   *- Use the proper memory barrier (rte_rmb()) to ensure the
 +   *  memory ordering below.
>>> This comment screams "this is broken".
>>> Why not get proper architecture independent barriers in DPDK first.
>> This series is orthogonal to the issue above. I just couldn't stand to
>> mention this ugliness when I noticed it on the way.
>> Note that although this is obviously not the right way to write this
>> kind of code it is still not a bug and most likely the performance
>> implications are minimal here.
>> The only overhead is that there may be read "too much" data from the
>> descriptor that we may not actually need. The descriptor is 16 bytes so
>> this doesn't seem to be a critical issue.
>>
>> So, fixing the above issue may wait, especially since the same s..t may
>> be found in other Intel PMDs (see i40e for example). Fixing this issue
>> should be a matter of a massive cleanup series that cover all the
>> relevant PMDs. Of course we may start with ixgbe but even in this single
>> PMD there are at least 3 non-LRO related functions that have to be
>> fixed, so IMHO even fixing ONLY ixgbe should be a matter of a separate
>> series.
> In userspace-rcu and kernel there is a simple macro that would make this
> kind of code more sane.
>
> What about adding:
>
> #define rte_access_once(x)  (*(volatile typeof(x) *)&(x))
>
> Then doing
>  rxdp = rte_access_once(rx_ring + idx);

This workaround doesn't address the described above issue - it just 
hides it inside a macro, which is even uglier.
The main reason I haven't fixed this issue in (at least) a function I've 
added is that the hw->rx_ring (HW ring) is defined as volatile and this 
fact is used all over the file in different places and all such places 
have to be fixed if I drop the "volatile" qualifier which should be the 
first thing to do.

>
>
>
>



[dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to integer of different size

2015-03-05 Thread Thomas Monjalon
2015-03-05 09:21, Tang, HaifengX:
> Hi Thomas  and all :
[...]
>   CC rte_hash.o
> /jenkins/workspace/DPDK_AUTO_IDT_VM_FC18_32_BUILD2/DPDK/lib/librte_hash/rte_hash_crc.h:
>  Assembler messages:
> /jenkins/workspace/DPDK_AUTO_IDT_VM_FC18_32_BUILD2/DPDK/lib/librte_hash/rte_hash_crc.h:380:
>  Error: unsupported instruction `crc32'
> /jenkins/workspace/DPDK_AUTO_IDT_VM_FC18_32_BUILD2/DPDK/lib/librte_hash/rte_hash_crc.h:380:
>  Error: unsupported instruction `crc32'
[...]
>   CC rte_hash.o
> /tmp/iccOsnsZzas_.s: Assembler messages:
> /tmp/iccOsnsZzas_.s:49: Error: unsupported instruction `crc32'
> /tmp/iccOsnsZzas_.s:133: Error: unsupported instruction `crc32'
[...]
> Can anyone can help to check the assemble code .

These errors are related to
"[PATCH v6 2/7] hash: add assembly implementation of CRC32 intrinsics"

Please ask in the right thread.
Yerden should know how to properly fix this problem.

Thanks


[dpdk-dev] [PATCH] eal/linux: fix build

2015-03-05 Thread Thomas Monjalon
Hi Michael,

2015-03-05 09:13, Qiu, Michael:
> On 3/4/2015 6:24 AM, Thomas Monjalon wrote:
> >>> Compilation fails in some distributions because of missing unistd.h
> >>> needed for pread/pwrite (seen with Suse):
> >>> lib/librte_eal/linuxapp/eal/eal_pci_uio.c:62:2:
> >>> error: implicit declaration of function ?pread?
> >>>
> >>> Fixes: 4a499c649590 ("eal/linux: enable uio_pci_generic support")
> >>>
> >>> Signed-off-by: Thomas Monjalon 
> >> Acked-by: David Marchand 
> > Applied
> 
> Hi, Thomas
> 
> This patch may be need to be reverted, as the error still exists.

No I don't think it should be reverted. It must be completed.

[...]
> NAME
>pread, pwrite - read from or write to a file descriptor at a
> given offset
> 
> SYNOPSIS
>#define _XOPEN_SOURCE 500
> 
>#include 
[...]
> While I try to add marco #define _XOPEN_SOURCE 500

I think that the good thing to do.

> Other errors show up

Are they hard to fix?

> Who knows how to solve this issue?



[dpdk-dev] [PATCH] mk: Remove '-fdirectives-only' flag from mk/rte.sdkconfig.mk

2015-03-05 Thread Bruce Richardson
On Thu, Mar 05, 2015 at 04:31:01PM +0900, Tetsuya Mukawa wrote:
> The '-fdirectives-only' flag doesn't exist in cpp of FreeBSD.
> To remove expanding macros when parsing the config files won't
> add any issue.
> 
> Signed-off-by: Tetsuya Mukawa 
Acked-by: Bruce Richardson 

> ---
>  mk/rte.sdkconfig.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
> index d43c430..f8d95b1 100644
> --- a/mk/rte.sdkconfig.mk
> +++ b/mk/rte.sdkconfig.mk
> @@ -75,7 +75,7 @@ else
>  $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
>   $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" 
> ]; then \
>   $(CPP) -undef -P -x assembler-with-cpp \
> - -fdirectives-only -ffreestanding \
> + -ffreestanding \
>   -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
>   if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; 
> then \
>   cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \
> -- 
> 1.9.1
> 


[dpdk-dev] [PATCH] eal/linux: fix build

2015-03-05 Thread Ananyev, Konstantin


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Qiu, Michael
> Sent: Thursday, March 05, 2015 9:13 AM
> To: Thomas Monjalon; David Marchand
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] eal/linux: fix build
> 
> On 3/4/2015 6:24 AM, Thomas Monjalon wrote:
> >>> Compilation fails in some distributions because of missing unistd.h
> >>> needed for pread/pwrite (seen with Suse):
> >>> lib/librte_eal/linuxapp/eal/eal_pci_uio.c:62:2:
> >>> error: implicit declaration of function 'pread'
> >>>
> >>> Fixes: 4a499c649590 ("eal/linux: enable uio_pci_generic support")
> >>>
> >>> Signed-off-by: Thomas Monjalon 
> >> Acked-by: David Marchand 
> > Applied
> 
> Hi, Thomas
> 
> This patch may be need to be reverted, as the error still exists.
> 
> suse-11-sp3-32:~/dpdk # uname -a
> Linux suse-11-sp3-32 3.0.76-0.11-pae #1 SMP Fri Jun 14 08:21:43 UTC 2013
> (ccab990) i686 i686 i386 GNU/Linux
> 
> suse-11-sp3-32:~/dpdk # gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.5.1/lto-wrapper
> Target: i686-pc-linux-gnu
> Configured with: ./configure
> Thread model: posix
> gcc version 4.5.1 (GCC)
> 
> As I try to check the manual of pread, find that it has two:
> --
> Man: find all matching manual pages
>  * pread (2)
>pread (3p)
> Man: What manual page do you want?
> Man:
> -
> PREAD(2) Linux
> Programmer's
> ManualPREAD(2)
> 
> 
> 
> NAME
>pread, pwrite - read from or write to a file descriptor at a
> given offset
> 
> SYNOPSIS
>#define _XOPEN_SOURCE 500
> 
>#include 
> 
>ssize_t pread(int fd, void *buf, size_t count, off_t offset);
> 
>ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
> 
> 
> 
> READ(3P) POSIX
> Programmer's
> ManualREAD(3P)
> 
> 
> 
> PROLOG
>This  manual page is part of the POSIX Programmer's Manual.  The
> Linux implementation of this interface may differ (consult the
> corresponding Linux
>manual page for details of Linux behavior), or the interface may
> not be implemented on Linux.
> 
> NAME
>pread, read - read from a file
> 
> SYNOPSIS
>#include 
> 
> 
> 
>ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
>ssize_t read(int fildes, void *buf, size_t nbyte);
> 
> 
> DESCRIPTION
> 
> --
> 
> While I try to add marco #define _XOPEN_SOURCE 500
> 
> Other errors show up
> 
> Who knows how to solve this issue?
> 
> Thanks,
> Michael
> 
> >

Can you try to add:
CFLAGS_.o := -D_GNU_SOURCE

to your Makefile?

Konstantin


[dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to integer of different size

2015-03-05 Thread Tang, HaifengX

Hi Thomas  and all :

  I686   gcc and icc targets both have the below build issue:

For GCC(after apply the patch :[dpdk-dev] [PATCH v3] librte_eal/common: Fix 
cast from pointer to integer of different size)

== Build lib/librte_hash
  CC rte_hash.o
/jenkins/workspace/DPDK_AUTO_IDT_VM_FC18_32_BUILD2/DPDK/lib/librte_hash/rte_hash_crc.h:
 Assembler messages:
/jenkins/workspace/DPDK_AUTO_IDT_VM_FC18_32_BUILD2/DPDK/lib/librte_hash/rte_hash_crc.h:380:
 Error: unsupported instruction `crc32'
/jenkins/workspace/DPDK_AUTO_IDT_VM_FC18_32_BUILD2/DPDK/lib/librte_hash/rte_hash_crc.h:380:
 Error: unsupported instruction `crc32'
gmake[5]: *** [rte_hash.o] Error 1
gmake[4]: *** [librte_hash] Error 2
gmake[3]: *** [lib] Error 2
gmake[2]: *** [all] Error 2
gmake[1]: *** [i686-native-linuxapp-gcc_install] Error 2
gmake: *** [install] Error 2

For ICC :
== Build lib/librte_hash
  CC rte_hash.o
/tmp/iccOsnsZzas_.s: Assembler messages:
/tmp/iccOsnsZzas_.s:49: Error: unsupported instruction `crc32'
/tmp/iccOsnsZzas_.s:133: Error: unsupported instruction `crc32'
make[5]: *** [rte_hash.o] Error 1
make[4]: *** [librte_hash] Error 2
make[3]: *** [lib] Error 2
make[2]: *** [all] Error 2
make[1]: *** [i686-native-linuxapp-icc_install] Error 2
make: *** [install] Error 2

Can anyone can help to check the assemble code .

thanks


-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Michael Qiu
Sent: Thursday, March 05, 2015 3:47 PM
To: dev at dpdk.org
Subject: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to 
integer of different size

./i686-native-linuxapp-gcc/include/rte_memcpy.h:592:23: error:
cast from pointer to integer of different size [-Werror=pointer-to-int-cast]

  dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16;

Type 'long long' is 64-bit in i686 platform while 'void *'
is 32-bit.

Signed-off-by: Michael Qiu 
---
v3 --> v2:
make dstofss and srcofs to be type size_t
casting type use uintptr_t

v2 --> v1:
Remove unnecessary casting (void *)
 lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h 
b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
index 7b2d382..aa433e4 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -493,8 +493,8 @@ rte_memcpy(void *dst, const void *src, size_t n)  {
__m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
void *ret = dst;
-   int dstofss;
-   int srcofs;
+   size_t dstofss;
+   size_t srcofs;

/**
 * Copy less than 16 bytes
@@ -589,12 +589,12 @@ COPY_BLOCK_64_BACK15:
 * unaligned copy functions require up to 15 bytes
 * backwards access.
 */
-   dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16;
+   dstofss = 16 - ((uintptr_t)dst & 0x0F) + 16;
n -= dstofss;
rte_mov32((uint8_t *)dst, (const uint8_t *)src);
src = (const uint8_t *)src + dstofss;
dst = (uint8_t *)dst + dstofss;
-   srcofs = (int)((long long)(const void *)src & 0x0F);
+   srcofs = (uintptr_t)src & 0x0F;

/**
 * For aligned copy
--
1.9.3



[dpdk-dev] [PATCH] eal/linux: fix build

2015-03-05 Thread Qiu, Michael
On 3/4/2015 6:24 AM, Thomas Monjalon wrote:
>>> Compilation fails in some distributions because of missing unistd.h
>>> needed for pread/pwrite (seen with Suse):
>>> lib/librte_eal/linuxapp/eal/eal_pci_uio.c:62:2:
>>> error: implicit declaration of function ?pread?
>>>
>>> Fixes: 4a499c649590 ("eal/linux: enable uio_pci_generic support")
>>>
>>> Signed-off-by: Thomas Monjalon 
>> Acked-by: David Marchand 
> Applied

Hi, Thomas

This patch may be need to be reverted, as the error still exists.

suse-11-sp3-32:~/dpdk # uname -a
Linux suse-11-sp3-32 3.0.76-0.11-pae #1 SMP Fri Jun 14 08:21:43 UTC 2013
(ccab990) i686 i686 i386 GNU/Linux

suse-11-sp3-32:~/dpdk # gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.5.1/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure
Thread model: posix
gcc version 4.5.1 (GCC)

As I try to check the manual of pread, find that it has two:
--
Man: find all matching manual pages
 * pread (2)
   pread (3p)
Man: What manual page do you want?
Man:
-
PREAD(2) Linux
Programmer's
ManualPREAD(2)



NAME
   pread, pwrite - read from or write to a file descriptor at a
given offset

SYNOPSIS
   #define _XOPEN_SOURCE 500

   #include 

   ssize_t pread(int fd, void *buf, size_t count, off_t offset);

   ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);



READ(3P) POSIX
Programmer's
ManualREAD(3P)



PROLOG
   This  manual page is part of the POSIX Programmer's Manual.  The
Linux implementation of this interface may differ (consult the
corresponding Linux
   manual page for details of Linux behavior), or the interface may
not be implemented on Linux.

NAME
   pread, read - read from a file

SYNOPSIS
   #include 



   ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
   ssize_t read(int fildes, void *buf, size_t nbyte);


DESCRIPTION

--

While I try to add marco #define _XOPEN_SOURCE 500

Other errors show up

Who knows how to solve this issue?

Thanks,
Michael

>



[dpdk-dev] i40e and RSS woes

2015-03-05 Thread Gleb Natapov
On Thu, Mar 05, 2015 at 05:56:27AM +, Zhang, Helin wrote:
> Hi Gleb
> 
> Sorry for late! I am struggling on my tasks for the following DPDK release 
> these days.
> 
> > -Original Message-
> > From: Gleb Natapov [mailto:gleb at cloudius-systems.com]
> > Sent: Monday, March 2, 2015 8:56 PM
> > To: dev at dpdk.org
> > Cc: Zhang, Helin
> > Subject: Re: i40e and RSS woes
> > 
> > Ping.
> > 
> > On Thu, Feb 19, 2015 at 04:50:10PM +0200, Gleb Natapov wrote:
> > > CCing i40e driver author in a hope to get an answer.
> > >
> > > On Mon, Feb 16, 2015 at 03:36:54PM +0200, Gleb Natapov wrote:
> > > > I have an application that works reasonably well with ixgbe driver,
> > > > but when I try to use it with i40e I encounter various RSS related 
> > > > issues.
> > > >
> > > > First one is that for some reason i40e, when it builds default reta
> > > > table, round down number of queues to power of two. Why is this? If
> It seems because of i40e queue configuration. We will check it more and see
> if it can be changed or improved later.
> 
Thanks, as I said below when I configure reta by myself everything work
as expected - traffic is received on all queues, so I am curious if in some
scenarios my code can break.

> > > > I configure reta by my own using all of the queues everything seams
> > > > to be working. To add insult to injury I do not get any errors
> > > > during configuration some queues just do not receive any traffic.
> > > >
> > > > The second problem is that for some reason i40e does not use 40 byte
> > > > toeplitz hash key like any other driver, but it expects the key to
> > > > be 52 bytes. And it would have being fine (if we ignore the fact
> > > > that it contradicts MS spec), but how my high level code suppose to know
> > that?
> Actually a rss_key_len was introduced in struct rte_eth_rss_conf recently. So 
> the
> length should be indicated clearly. But I found the annotations of that 
> structure
> should have been reworked. I will try to rework it with clear descriptions.
> 
I saw rss_key_len of course, my question is how my code suppose to know
what value to set it to? Why required key length is not part of a device
capability query (or is it and I missed it)? The only way I found to get
key length is to quire device for a key, and check rss_key_len. If it
is zero then key is 40 bytes, otherwise whatever rss_key_len says. This
method is more of a hack then proper way to do it.

> > > > And again, device configuration does not fail when wrong key length
> > > > is provided, it just uses some other key. Guys this kind of error
> > > > handling is completely unacceptable.
> If less length of key is provided, it will not be used at all, the default 
> key will be used.
> So there is no issue as you said. But we need to add more clear description 
> for the
> structure of rte_eth_rss_conf.
> 
What you've said above is exactly the issue! My code does not work if
a key used by HW is not the same as was set by application, but since
I get no error when my setting is ignored the is not way for me to know
that my application will not work (short of querying key back and comparing
which is again a hack). Device configuration should fail if it cannot
apply my settings.

--
Gleb.


[dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to integer of different size

2015-03-05 Thread Tang, HaifengX
Tested-by: haifeng.tang 
Patch name: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to 
integer of different size

Test Env :
Fedora 18 , 3.6.10-4 ,4.7.2 ,14.0.0

Fedora20 ,3.11.0,4.8.2,14.0.0

Fedora21,3.17.4-302,4.9.2,15.0.0

Ubuntu 14.04, 3.13.0-30, 4.8.2, 14.0.0

Test Result:
error: cast from pointer to integer of different size 
[-Werror=pointer-to-int-cast] problem fixed now

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Michael Qiu
Sent: Thursday, March 05, 2015 3:47 PM
To: dev at dpdk.org
Subject: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to 
integer of different size

./i686-native-linuxapp-gcc/include/rte_memcpy.h:592:23: error:
cast from pointer to integer of different size [-Werror=pointer-to-int-cast]

  dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16;

Type 'long long' is 64-bit in i686 platform while 'void *'
is 32-bit.

Signed-off-by: Michael Qiu 
---
v3 --> v2:
make dstofss and srcofs to be type size_t
casting type use uintptr_t

v2 --> v1:
Remove unnecessary casting (void *)
 lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h 
b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
index 7b2d382..aa433e4 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -493,8 +493,8 @@ rte_memcpy(void *dst, const void *src, size_t n)  {
__m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
void *ret = dst;
-   int dstofss;
-   int srcofs;
+   size_t dstofss;
+   size_t srcofs;

/**
 * Copy less than 16 bytes
@@ -589,12 +589,12 @@ COPY_BLOCK_64_BACK15:
 * unaligned copy functions require up to 15 bytes
 * backwards access.
 */
-   dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16;
+   dstofss = 16 - ((uintptr_t)dst & 0x0F) + 16;
n -= dstofss;
rte_mov32((uint8_t *)dst, (const uint8_t *)src);
src = (const uint8_t *)src + dstofss;
dst = (uint8_t *)dst + dstofss;
-   srcofs = (int)((long long)(const void *)src & 0x0F);
+   srcofs = (uintptr_t)src & 0x0F;

/**
 * For aligned copy
--
1.9.3



[dpdk-dev] proposal: remove separate doc tree

2015-03-05 Thread Butler, Siobhan A
Thank you Thomas 

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Wednesday, March 4, 2015 9:07 PM
> To: Butler, Siobhan A
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] proposal: remove separate doc tree
> 
> 2015-02-11 14:28, Butler, Siobhan A:
> > Hi all,
> >
> > In creating documentation for DPDK 1.8.0 dpdk.org used a separate
> repository 'dpdk-doc' to work on the conversion of old documentation from
> PDF to .rst with sphinx for maintainability and usability purposes.
> > Now that the conversion has been complete and patches to the
> documentation can be made, I propose that we no longer need the
> additional repo and it should be removed.
> >
> > Many Thanks,
> > Siobhan Butler
> 
> OK, it's now removed.
> Thanks


[dpdk-dev] i40e and RSS woes

2015-03-05 Thread Zhang, Helin


> -Original Message-
> From: Gleb Natapov [mailto:gleb at cloudius-systems.com]
> Sent: Thursday, March 5, 2015 2:39 PM
> To: Zhang, Helin
> Cc: dev at dpdk.org
> Subject: Re: i40e and RSS woes
> 
> On Thu, Mar 05, 2015 at 05:56:27AM +, Zhang, Helin wrote:
> > Hi Gleb
> >
> > Sorry for late! I am struggling on my tasks for the following DPDK release
> these days.
> >
> > > -Original Message-
> > > From: Gleb Natapov [mailto:gleb at cloudius-systems.com]
> > > Sent: Monday, March 2, 2015 8:56 PM
> > > To: dev at dpdk.org
> > > Cc: Zhang, Helin
> > > Subject: Re: i40e and RSS woes
> > >
> > > Ping.
> > >
> > > On Thu, Feb 19, 2015 at 04:50:10PM +0200, Gleb Natapov wrote:
> > > > CCing i40e driver author in a hope to get an answer.
> > > >
> > > > On Mon, Feb 16, 2015 at 03:36:54PM +0200, Gleb Natapov wrote:
> > > > > I have an application that works reasonably well with ixgbe
> > > > > driver, but when I try to use it with i40e I encounter various RSS 
> > > > > related
> issues.
> > > > >
> > > > > First one is that for some reason i40e, when it builds default
> > > > > reta table, round down number of queues to power of two. Why is
> > > > > this? If
> > It seems because of i40e queue configuration. We will check it more
> > and see if it can be changed or improved later.
> >
> Thanks, as I said below when I configure reta by myself everything work as
> expected - traffic is received on all queues, so I am curious if in some 
> scenarios
> my code can break.
> 
> > > > > I configure reta by my own using all of the queues everything
> > > > > seams to be working. To add insult to injury I do not get any
> > > > > errors during configuration some queues just do not receive any 
> > > > > traffic.
> > > > >
> > > > > The second problem is that for some reason i40e does not use 40
> > > > > byte toeplitz hash key like any other driver, but it expects the
> > > > > key to be 52 bytes. And it would have being fine (if we ignore
> > > > > the fact that it contradicts MS spec), but how my high level
> > > > > code suppose to know
> > > that?
> > Actually a rss_key_len was introduced in struct rte_eth_rss_conf
> > recently. So the length should be indicated clearly. But I found the
> > annotations of that structure should have been reworked. I will try to 
> > rework
> it with clear descriptions.
> >
> I saw rss_key_len of course, my question is how my code suppose to know
> what value to set it to? Why required key length is not part of a device
> capability query (or is it and I missed it)? The only way I found to get key 
> length
> is to quire device for a key, and check rss_key_len. If it is zero then key 
> is 40
> bytes, otherwise whatever rss_key_len says. This method is more of a hack
> then proper way to do it.
I think it was missed. I will add it soon later.

> 
> > > > > And again, device configuration does not fail when wrong key
> > > > > length is provided, it just uses some other key. Guys this kind
> > > > > of error handling is completely unacceptable.
> > If less length of key is provided, it will not be used at all, the default 
> > key will be
> used.
> > So there is no issue as you said. But we need to add more clear
> > description for the structure of rte_eth_rss_conf.
> >
> What you've said above is exactly the issue! My code does not work if a key
> used by HW is not the same as was set by application, but since I get no error
> when my setting is ignored the is not way for me to know that my application
> will not work (short of querying key back and comparing which is again a 
> hack).
> Device configuration should fail if it cannot apply my settings.
After I checked the code, different PMD may have different implementation.
Returning with an error might be the best way for all PMDs. I will unify it 
later.

Really good findings and suggestions from you! Thank you very much!

Regards,
Helin

> 
> --
>   Gleb.


[dpdk-dev] [PATCH v2 5/6] common_linuxapp: Added CONFIG_RTE_ETHDEV_LRO_SUPPORT option

2015-03-05 Thread Thomas Monjalon
2015-03-05 15:39, Vlad Zolotarov:
> 
> On 03/05/15 15:19, Thomas Monjalon wrote:
> > 2015-03-05 13:28, Vlad Zolotarov:
> >> Enables LRO support in PMDs.
> >>
> >> Signed-off-by: Vlad Zolotarov 
> >> ---
> >>   config/common_linuxapp | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/config/common_linuxapp b/config/common_linuxapp
> >> index 97f1c9e..5b98595 100644
> >> --- a/config/common_linuxapp
> >> +++ b/config/common_linuxapp
> >> @@ -137,6 +137,7 @@ CONFIG_RTE_MAX_ETHPORTS=32
> >>   CONFIG_RTE_LIBRTE_IEEE1588=n
> >>   CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
> >>   CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
> >> +CONFIG_RTE_ETHDEV_LRO_SUPPORT=y
> > 
> > Sorry I don't really follow this ixgbe discussion but I wonder why you
> > would add a compile time option for this feature.
> 
> The only reason is to be able to detect that the feature is present in 
> the DPDK version u r compiling against because of the API change.
> Currently, this can't be done using the DPDK version thus we may either 

Why you cannot use version? In development phase?
When released, you'll be able to test >= 2.1.

> do a try-compilation and if it fails define some application-level macro 
> disabling
> the feature usage or we may define a macro in the library level 
> (together with tons of other such macros like those in the patch snippet 
> above).

I'd prefer a request rte_eth_dev_info_get() to advertise that the feature
is available with the device and driver.
Please let's try to remove config options and #ifdefs.

> > What is the benefit of disabling it?
> 
> No benefit whatsoever.
> 
> > And if really needed, this patch would make more sense merged with the
> > code under ifdef.
> 
> I strongly disagree - the amount of #ifdefs in the DPDK source is 
> absolutely enormous. It makes reading and  understanding the code really 
> hard.

I agree. You misunderstand me.
I was just saying that this patch should be merged.

> Therefore, I tried to reduce the amount of time the already existing 
> macros have to be queried (see PATCH4). And of course I don't see any 
> sense of adding new ones more than really needed. And in LRO case - it's 
> a single time, where the feature is manifested by the HW.



[dpdk-dev] i40e and RSS woes

2015-03-05 Thread Zhang, Helin
Hi Gleb

Sorry for late! I am struggling on my tasks for the following DPDK release 
these days.

> -Original Message-
> From: Gleb Natapov [mailto:gleb at cloudius-systems.com]
> Sent: Monday, March 2, 2015 8:56 PM
> To: dev at dpdk.org
> Cc: Zhang, Helin
> Subject: Re: i40e and RSS woes
> 
> Ping.
> 
> On Thu, Feb 19, 2015 at 04:50:10PM +0200, Gleb Natapov wrote:
> > CCing i40e driver author in a hope to get an answer.
> >
> > On Mon, Feb 16, 2015 at 03:36:54PM +0200, Gleb Natapov wrote:
> > > I have an application that works reasonably well with ixgbe driver,
> > > but when I try to use it with i40e I encounter various RSS related issues.
> > >
> > > First one is that for some reason i40e, when it builds default reta
> > > table, round down number of queues to power of two. Why is this? If
It seems because of i40e queue configuration. We will check it more and see
if it can be changed or improved later.

> > > I configure reta by my own using all of the queues everything seams
> > > to be working. To add insult to injury I do not get any errors
> > > during configuration some queues just do not receive any traffic.
> > >
> > > The second problem is that for some reason i40e does not use 40 byte
> > > toeplitz hash key like any other driver, but it expects the key to
> > > be 52 bytes. And it would have being fine (if we ignore the fact
> > > that it contradicts MS spec), but how my high level code suppose to know
> that?
Actually a rss_key_len was introduced in struct rte_eth_rss_conf recently. So 
the
length should be indicated clearly. But I found the annotations of that 
structure
should have been reworked. I will try to rework it with clear descriptions.

> > > And again, device configuration does not fail when wrong key length
> > > is provided, it just uses some other key. Guys this kind of error
> > > handling is completely unacceptable.
If less length of key is provided, it will not be used at all, the default key 
will be used.
So there is no issue as you said. But we need to add more clear description for 
the
structure of rte_eth_rss_conf.

Thank you very much for the good comments!

Regards,
Helin

> > >
> > > The last one is more of a question. Why interface to change RSS hash
> > > function (XOR or toeplitz) is part of a filter configuration and not
> > > rss config?
> > >
> > > --
> > >   Gleb.
> >
> > --
> > Gleb.
> 
> --
>   Gleb.


[dpdk-dev] KNI with multiple kthreads per port

2015-03-05 Thread Zhang, Helin


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of JP M.
> Sent: Sunday, March 1, 2015 6:40 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] KNI with multiple kthreads per port
> 
> Howdy! First time posting; please be gentle. :-)
> 
> Environment:
>  * DPDK 1.8.0 release
>  * Linux kernel 3.0.3x-ish
>  * 32-bit (yes, KNI works fine, after a few tweaks hugepage init strategy)
Interesting! How did you get it works?

> 
> I'm trying to use the KNI example app with a configuration where multiple
> kthreads are created for a physical port. Per the user guide and code, the 
> first
> such kthread is the "master", any the only one configurable; I'll refer to the
> additional kthread(s) as "slaves", although their relationship to the master
> kthread isn't discussed anywhere that I've looked thus far.
> 
> # insmod rte_kni.ko kthread_mode=multiple # kni [] --config="(0,0,1,2,3)"
> # ifconfig vEth0_0 10.0.0.1 netmask 255.255.255.0
> 
> From the above: PMD-bound physical port0. Rx/Tx on cores 0 and 1,
> respectively. Master thread on core 2, one slave kthread on core 3.  Upon
> startup, KNI devices vEth0_0 (master) and vEth0_1 (slave) are created.
> After ifconfig, vEth0_0 works fine; by design, vEth0_1 cannot be configured.
What do you mean "vEth0_1 cannot be configured"?

> 
> The problem I'm encountering is that the subset of packets hitting vEth0_1 are
> being dropped... somewhere.  They're definitely getting as far as the call to
> netif_rx(skb).  I'll try on a newer system for comparison.  But before I go 
> too
> much further, I'd like to establish the correct set-up and expectations.
So you can check the receiving side in KNI kernel function.

> 
> Should I be bonding vEth0_0 and vEth0_1?  Because I tried doing so (via 
> sysfs);
> however, attempts to add either as slaves to bond0 were ignored.
What do you mean bonding here? Basically KNI has no relationship to bonding.

> 
> Any ideas appreciated. (Though it may end up being a moot point, with the
> other work this past week on KNI performance.)


[dpdk-dev] rte_prefetch0() performance info

2015-03-05 Thread Anuj Kalia
Hi Parikshith.

A CPU core can have a limited number of prefetches in flight (around 10).
So if you issue 64 (or nb_rx > 10) prefetches in quick succession, you'll
stall on memory access. The main idea here is to overlap prefetches of some
packets with computation from other packets.

This paper explains it in the context of hash tables, but the idea is
similar: https://www.cs.cmu.edu/~binfan/papers/conext13_cuckooswitch.pdf

--Anuj

On Thu, Mar 5, 2015 at 3:46 AM, Parikshith Chowdaiah 
wrote:

> Hi all,
> I have a question related to usage of rte_prefetch0() function,In one of
> the sample files, we have implementation like:
>
> /* Prefetch first packets */
>
> for (j = 0; j < PREFETCH_OFFSET && j < nb_rx; j++) {
>
> rte_prefetch0(rte_pktmbuf_mtod(
>
> pkts_burst[j], void *));
>
> }
>
>
>
> /* Prefetch and forward already prefetched packets */
>
> for (j = 0; j < (nb_rx - PREFETCH_OFFSET); j++) {
>
> rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[
>
> j + PREFETCH_OFFSET], void *));
>
> l3fwd_simple_forward(pkts_burst[j], portid,
>
> qconf);
>
> }
>
>
>
> /* Forward remaining prefetched packets */
>
> for (; j < nb_rx; j++) {
>
> l3fwd_simple_forward(pkts_burst[j], portid,
>
> qconf);
>
> }
>
>
> where the prefetch0() is carried out in multiple split iterations, would
> like to have an insight on whether it makes performance improvement to
> likes of:
>
>
>
>for (j = 0; j  < nb_rx; j++) {
>
> rte_prefetch0(rte_pktmbuf_mtod(
>
> pkts_burst[j], void *));
>
> }
>
>
> and how frequent rte_prefetch() needs to called for the same packet. and
> any mechanisms to call in bulk for 64 packets at once ?
>
>
> thanks
>
> Parikshith
>


  1   2   >