[dpdk-dev] l3fwd error, port 0 is not present on the board

2014-12-30 Thread Neil Horman
On Tue, Dec 30, 2014 at 12:54:17PM -0600, Lyn M wrote:
> Neil, thank you for your reply.
> 
> I used the DPDK 8.1.0 setup.sh script to clean the system (unbind NICs,
> rmmod igb_uio and uio, remove hugepage mappings), and then re-built for
> x86_64-native-linuxapp-gcc, setup hugepages, insmod the modules, bound the
> NICs, but have the same result when trying to run testpmd:
> EAL: Error - exiting with code: 1
>   Cause: No probed ethernet device
> 
> 
> I then cleaned up again, downloaded DPDK 1.7.1 and ran the setup.sh script
> to build for x86_64-native-linuxapp-gcc.  With 1.7.1, testpmd runs
> successfully, and I am able to run my l3fwd command as well. I also built
> for x86_64-ivshmem-linuxapp-gcc, and testpmd ran successfully (other than
> the warning about no IVSHMEM configuration).
> 
> Thoughts?
> 
Well, the root cause is still the same, DPDK isn't detecting any devices over
which to forward traffic, which means the nb_port count is zero.  That would
suggest that you didn't find any devices during rte_eal_init.  The question is
why. I'd turn on all the pmd init debug macros to see if all the init routines
are getting called.

Two questions: (1) are you doing a static or DSO build, and (2) did you make any
changes to the make flags?

Neil

> On Mon, Dec 29, 2014 at 3:02 PM, Neil Horman  wrote:
> 
> > On Mon, Dec 29, 2014 at 02:18:09PM -0600, Lyn M wrote:
> > > Hello all,
> > >
> > > Rangeley platform (1 CPU with 8 cores, 4x1 GbE, 2x10 GbE, Intel PCIe card
> > > with 2x10 GbE fiber)
> > > FC20 with hugepages enabled
> > > DPDK 1.8.0 built with T=x86_64-ivshmem-linuxapp-gcc
> > >
> > >  */usr/src/dpdk/tools/dpdk_nic_bind.py --status*
> > >
> > >
> > >
> > > Network devices using DPDK-compatible driver
> > >
> > > 
> > >
> > > :09:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' drv=igb_uio
> > > unused=ixgbe
> > >
> > > :09:00.1 '82599ES 10-Gigabit SFI/SFP+ Network Connection' drv=igb_uio
> > > unused=ixgbe
> > >
> > >
> > >
> > > Network devices using kernel driver
> > >
> > > ===
> > >
> > > :00:14.0 'Ethernet Connection I354' if=enp0s20f0 drv=igb
> > unused=igb_uio
> > >
> > > :00:14.1 'Ethernet Connection I354' if=enp0s20f1 drv=igb
> > unused=igb_uio
> > >
> > > :00:14.2 'Ethernet Connection I354' if=enp0s20f2 drv=igb
> > unused=igb_uio
> > >
> > > :00:14.3 'Ethernet Connection I354' if=enp0s20f3 drv=igb
> > unused=igb_uio
> > >
> > > :07:00.0 'Ethernet Controller 10-Gigabit X540-AT2' if=p5p1 drv=ixgbe
> > > unused=igb_uio *Active*
> > >
> > > :07:00.1 'Ethernet Controller 10-Gigabit X540-AT2' if=p5p2 drv=ixgbe
> > > unused=igb_uio
> > >
> > >
> > >
> > > Other network devices
> > >
> > > =
> > >
> > > 
> > >
> > > The DPDK helloworld example seems to run OK, other than the warning about
> > > IVSHMEM configuration not found:
> > > *./helloworld -c 0x3 -n 4*
> > > EAL: Detected lcore 0 as core 0 on socket 0
> > > EAL: Detected lcore 1 as core 1 on socket 0
> > > EAL: Detected lcore 2 as core 2 on socket 0
> > > EAL: Detected lcore 3 as core 3 on socket 0
> > > EAL: Detected lcore 4 as core 4 on socket 0
> > > EAL: Detected lcore 5 as core 5 on socket 0
> > > EAL: Detected lcore 6 as core 6 on socket 0
> > > EAL: Detected lcore 7 as core 7 on socket 0
> > > EAL: Support maximum 128 logical core(s) by configuration.
> > > EAL: Detected 8 lcore(s)
> > > EAL: Searching for IVSHMEM devices...
> > > EAL: No IVSHMEM configuration found!
> > > EAL: Setting up memory...
> > > EAL: Ask a virtual area of 0x20 bytes
> > > EAL: Virtual area found at 0x7fcca2c0 (size = 0x20)
> > > EAL: Ask a virtual area of 0x2940 bytes
> > > EAL: Virtual area found at 0x7fcc7960 (size = 0x2940)
> > > EAL: Ask a virtual area of 0x40 bytes
> > > EAL: Virtual area found at 0x7fcca340 (size = 0x40)
> > > EAL: Ask a virtual area of 0x20 bytes
> > > EAL: Virtual area found at 0x7fcca300 (size = 0x20)
> > > EAL: Ask a virtual area of 0x20 bytes
> > > EAL: Virtual area found at 0x7fcc7920 (size = 0x20)
> > > EAL: Ask a virtual area of 0x14d00 bytes
> > > EAL: Virtual area found at 0x7fcb2c00 (size = 0x14d00)
> > > EAL: Ask a virtual area of 0x20 bytes
> > > EAL: Virtual area found at 0x7fcb2bc0 (size = 0x20)
> > > EAL: Requesting 3000 pages of size 2MB from socket 0
> > > EAL: TSC frequency is ~2393997 KHz
> > > EAL: Master core 0 is ready (tid=a4ca2840)
> > > EAL: Core 1 is ready (tid=2bbff700)
> > > hello from core 1
> > > hello from core 0
> > >
> > >
> > > I want to run the l3fwd example app, per Appendix A.2 (pg 35-36) in the
> > > DPDK 1.2 Release Benchmark Test Report .pdf:
> > > *./build/l3fwd -c 0x6 -n 4 --socket-mem 1024,0 -- -p 0x3
> > > -config="(0,0,1),(1,0,2)"*
> > > where the "-p option is the hexadecimal bit mask of the ports to
> > configure"
> > >
> > > I am running this command:
> > >
> > > *./build/l

[dpdk-dev] [PATCH v3 0/6] Move EAL common functions

2014-12-30 Thread Neil Horman
On Tue, Dec 30, 2014 at 11:36:24AM -0500, Ravi Kerur wrote:
> Changes in v3
> Make subject line explicit on file names.
> Commit log includes function names moved to common directory.
> 
> Changes in v2
> Fix patch review comments from Neil.
> 
> Changes in v1
> Common functions in linuxapp and bsdapp are moved into
> librte_eal/common directory.
> New files added follow _common_ naming conventions.
> 
> Following checkpatch warnings are treated as false-positive.
> WARNING: quoted string split across lines
> 
> Tested against ubuntu and FreeBSD.
> 
> Ravi Kerur (6):
>   Move common functions in eal_debug.c
>   Move common functions in eal_thread.c
>   Move common functions in eal.c
>   Move common functions in eal_lcore.c
>   Move common functions in eal_timer.c
>   Move common functions in eal_memory.c
> 
>  app/test/test_debug.c |   1 -
>  lib/librte_eal/bsdapp/eal/Makefile|  11 +-
>  lib/librte_eal/bsdapp/eal/eal.c   | 233 +
>  lib/librte_eal/bsdapp/eal/eal_debug.c | 113 ---
>  lib/librte_eal/bsdapp/eal/eal_lcore.c |  62 ++
>  lib/librte_eal/bsdapp/eal/eal_memory.c|  40 +---
>  lib/librte_eal/bsdapp/eal/eal_thread.c| 233 -
>  lib/librte_eal/bsdapp/eal/eal_timer.c |  50 +
>  lib/librte_eal/common/eal_common.c| 326 
> ++
>  lib/librte_eal/common/eal_common_debug.c  | 106 ++
>  lib/librte_eal/common/eal_common_lcore.c  | 106 ++
>  lib/librte_eal/common/eal_common_memory.c |  38 +++-
>  lib/librte_eal/common/eal_common_thread.c | 248 +++
>  lib/librte_eal/common/eal_common_timer.c  |  95 +
>  lib/librte_eal/common/eal_externs.h   |  45 +
>  lib/librte_eal/common/eal_hugepages.h |   1 +
>  lib/librte_eal/common/eal_private.h   | 112 ++
>  lib/librte_eal/common/include/rte_debug.h |   7 -
>  lib/librte_eal/linuxapp/eal/Makefile  |  11 +-
>  lib/librte_eal/linuxapp/eal/eal.c | 246 +-
>  lib/librte_eal/linuxapp/eal/eal_debug.c   | 113 ---
>  lib/librte_eal/linuxapp/eal/eal_lcore.c   |  55 +
>  lib/librte_eal/linuxapp/eal/eal_memory.c  |  36 +---
>  lib/librte_eal/linuxapp/eal/eal_thread.c  | 233 -
>  lib/librte_eal/linuxapp/eal/eal_timer.c   |  54 +
>  25 files changed, 1134 insertions(+), 1441 deletions(-)
>  delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
>  delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
>  create mode 100644 lib/librte_eal/common/eal_common.c
>  create mode 100644 lib/librte_eal/common/eal_common_debug.c
>  create mode 100644 lib/librte_eal/common/eal_common_lcore.c
>  create mode 100644 lib/librte_eal/common/eal_common_thread.c
>  create mode 100644 lib/librte_eal/common/eal_common_timer.c
>  create mode 100644 lib/librte_eal/common/eal_externs.h
>  delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
>  delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c
> 
> -- 
> 1.9.1
> 
> 
Thanks
For the series
Acked-by: Neil Horman 



[dpdk-dev] l3fwd error, port 0 is not present on the board

2014-12-30 Thread Lyn M
Neil, thank you for your reply.

I used the DPDK 8.1.0 setup.sh script to clean the system (unbind NICs,
rmmod igb_uio and uio, remove hugepage mappings), and then re-built for
x86_64-native-linuxapp-gcc, setup hugepages, insmod the modules, bound the
NICs, but have the same result when trying to run testpmd:
EAL: Error - exiting with code: 1
  Cause: No probed ethernet device


I then cleaned up again, downloaded DPDK 1.7.1 and ran the setup.sh script
to build for x86_64-native-linuxapp-gcc.  With 1.7.1, testpmd runs
successfully, and I am able to run my l3fwd command as well. I also built
for x86_64-ivshmem-linuxapp-gcc, and testpmd ran successfully (other than
the warning about no IVSHMEM configuration).

Thoughts?

On Mon, Dec 29, 2014 at 3:02 PM, Neil Horman  wrote:

> On Mon, Dec 29, 2014 at 02:18:09PM -0600, Lyn M wrote:
> > Hello all,
> >
> > Rangeley platform (1 CPU with 8 cores, 4x1 GbE, 2x10 GbE, Intel PCIe card
> > with 2x10 GbE fiber)
> > FC20 with hugepages enabled
> > DPDK 1.8.0 built with T=x86_64-ivshmem-linuxapp-gcc
> >
> >  */usr/src/dpdk/tools/dpdk_nic_bind.py --status*
> >
> >
> >
> > Network devices using DPDK-compatible driver
> >
> > 
> >
> > :09:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' drv=igb_uio
> > unused=ixgbe
> >
> > :09:00.1 '82599ES 10-Gigabit SFI/SFP+ Network Connection' drv=igb_uio
> > unused=ixgbe
> >
> >
> >
> > Network devices using kernel driver
> >
> > ===
> >
> > :00:14.0 'Ethernet Connection I354' if=enp0s20f0 drv=igb
> unused=igb_uio
> >
> > :00:14.1 'Ethernet Connection I354' if=enp0s20f1 drv=igb
> unused=igb_uio
> >
> > :00:14.2 'Ethernet Connection I354' if=enp0s20f2 drv=igb
> unused=igb_uio
> >
> > :00:14.3 'Ethernet Connection I354' if=enp0s20f3 drv=igb
> unused=igb_uio
> >
> > :07:00.0 'Ethernet Controller 10-Gigabit X540-AT2' if=p5p1 drv=ixgbe
> > unused=igb_uio *Active*
> >
> > :07:00.1 'Ethernet Controller 10-Gigabit X540-AT2' if=p5p2 drv=ixgbe
> > unused=igb_uio
> >
> >
> >
> > Other network devices
> >
> > =
> >
> > 
> >
> > The DPDK helloworld example seems to run OK, other than the warning about
> > IVSHMEM configuration not found:
> > *./helloworld -c 0x3 -n 4*
> > EAL: Detected lcore 0 as core 0 on socket 0
> > EAL: Detected lcore 1 as core 1 on socket 0
> > EAL: Detected lcore 2 as core 2 on socket 0
> > EAL: Detected lcore 3 as core 3 on socket 0
> > EAL: Detected lcore 4 as core 4 on socket 0
> > EAL: Detected lcore 5 as core 5 on socket 0
> > EAL: Detected lcore 6 as core 6 on socket 0
> > EAL: Detected lcore 7 as core 7 on socket 0
> > EAL: Support maximum 128 logical core(s) by configuration.
> > EAL: Detected 8 lcore(s)
> > EAL: Searching for IVSHMEM devices...
> > EAL: No IVSHMEM configuration found!
> > EAL: Setting up memory...
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fcca2c0 (size = 0x20)
> > EAL: Ask a virtual area of 0x2940 bytes
> > EAL: Virtual area found at 0x7fcc7960 (size = 0x2940)
> > EAL: Ask a virtual area of 0x40 bytes
> > EAL: Virtual area found at 0x7fcca340 (size = 0x40)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fcca300 (size = 0x20)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fcc7920 (size = 0x20)
> > EAL: Ask a virtual area of 0x14d00 bytes
> > EAL: Virtual area found at 0x7fcb2c00 (size = 0x14d00)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fcb2bc0 (size = 0x20)
> > EAL: Requesting 3000 pages of size 2MB from socket 0
> > EAL: TSC frequency is ~2393997 KHz
> > EAL: Master core 0 is ready (tid=a4ca2840)
> > EAL: Core 1 is ready (tid=2bbff700)
> > hello from core 1
> > hello from core 0
> >
> >
> > I want to run the l3fwd example app, per Appendix A.2 (pg 35-36) in the
> > DPDK 1.2 Release Benchmark Test Report .pdf:
> > *./build/l3fwd -c 0x6 -n 4 --socket-mem 1024,0 -- -p 0x3
> > -config="(0,0,1),(1,0,2)"*
> > where the "-p option is the hexadecimal bit mask of the ports to
> configure"
> >
> > I am running this command:
> >
> > *./build/l3fwd -c 0x3 -n 4 --socket-mem 1024,0 -- -p 0x3
> > --config="(0,0,0),(1,0,1)" --no-numa*
> >
> > EAL: Detected lcore 0 as core 0 on socket 0
> >
> > EAL: Detected lcore 1 as core 1 on socket 0
> >
> > EAL: Detected lcore 2 as core 2 on socket 0
> >
> > EAL: Detected lcore 3 as core 3 on socket 0
> >
> > EAL: Detected lcore 4 as core 4 on socket 0
> >
> > EAL: Detected lcore 5 as core 5 on socket 0
> >
> > EAL: Detected lcore 6 as core 6 on socket 0
> >
> > EAL: Detected lcore 7 as core 7 on socket 0
> >
> > EAL: Support maximum 128 logical core(s) by configuration.
> >
> > EAL: Detected 8 lcore(s)
> >
> > EAL: Searching for IVSHMEM devices...
> >
> > EAL: No IVSHMEM configuration found!
> >
> > EAL: Setting up memory...
> >
> > EAL: Ask a

[dpdk-dev] [PATCH v3 6/6] Move common functions in eal_memory.c

2014-12-30 Thread Ravi Kerur
Changes in v3
Changed subject line to explicitly include file name
Commit log includes function names moved to common directory.

Changes in v2
Use common function names rte_eal_hugepage_init and
rte_eal_hugepage_attach for BSD and Linux.
Update comments about its actuality in function declaration.

Changes in v1
Move common functions in eal_memory.c to librte_eal/common/
eal_common_memory.c file.

Following functions are moved to eal_common_memory.c file

static int rte_eal_memdevice_init(void);
int rte_eal_memory_init(void);

Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/eal_memory.c| 40 ---
 lib/librte_eal/common/eal_common_memory.c | 38 +++--
 lib/librte_eal/common/eal_private.h   | 18 ++
 lib/librte_eal/linuxapp/eal/eal_memory.c  | 36 ++--
 4 files changed, 60 insertions(+), 72 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c 
b/lib/librte_eal/bsdapp/eal/eal_memory.c
index 65ee87d..0b62d6d 100644
--- a/lib/librte_eal/bsdapp/eal/eal_memory.c
+++ b/lib/librte_eal/bsdapp/eal/eal_memory.c
@@ -59,8 +59,8 @@ rte_mem_virt2phy(const void *virtaddr)
return RTE_BAD_PHYS_ADDR;
 }

-static int
-rte_eal_contigmem_init(void)
+int
+rte_eal_hugepage_init(void)
 {
struct rte_mem_config *mcfg;
uint64_t total_mem = 0;
@@ -130,8 +130,8 @@ rte_eal_contigmem_init(void)
return 0;
 }

-static int
-rte_eal_contigmem_attach(void)
+int
+rte_eal_hugepage_attach(void)
 {
const struct hugepage_info *hpi;
int fd_hugepage_info, fd_hugepage = -1;
@@ -190,35 +190,3 @@ error:
return -1;
 }

-
-static int
-rte_eal_memdevice_init(void)
-{
-   struct rte_config *config;
-
-   if (rte_eal_process_type() == RTE_PROC_SECONDARY)
-   return 0;
-
-   config = rte_eal_get_configuration();
-   config->mem_config->nchannel = internal_config.force_nchannel;
-   config->mem_config->nrank = internal_config.force_nrank;
-
-   return 0;
-}
-
-/* init memory subsystem */
-int
-rte_eal_memory_init(void)
-{
-   RTE_LOG(INFO, EAL, "Setting up physically contiguous memory...\n");
-   const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
-   rte_eal_contigmem_init() :
-   rte_eal_contigmem_attach();
-   if (retval < 0)
-   return -1;
-
-   if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
-   return -1;
-
-   return 0;
-}
diff --git a/lib/librte_eal/common/eal_common_memory.c 
b/lib/librte_eal/common/eal_common_memory.c
index 77830f8..cb27930 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -46,6 +46,7 @@
 #include 

 #include "eal_private.h"
+#include "eal_internal_cfg.h"

 /*
  * Return a pointer to a read-only table of struct rte_physmem_desc
@@ -70,7 +71,7 @@ rte_eal_get_physmem_size(void)
/* get pointer to global configuration */
mcfg = rte_eal_get_configuration()->mem_config;

-   for (i=0; imemseg[i].addr == NULL)
break;

@@ -90,7 +91,7 @@ rte_dump_physmem_layout(FILE *f)
/* get pointer to global configuration */
mcfg = rte_eal_get_configuration()->mem_config;

-   for (i=0; imemseg[i].addr == NULL)
break;

@@ -119,3 +120,36 @@ unsigned rte_memory_get_nrank(void)
 {
return rte_eal_get_configuration()->mem_config->nrank;
 }
+
+static int
+rte_eal_memdevice_init(void)
+{
+   struct rte_config *config;
+
+   if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+   return 0;
+
+   config = rte_eal_get_configuration();
+   config->mem_config->nchannel = internal_config.force_nchannel;
+   config->mem_config->nrank = internal_config.force_nrank;
+
+   return 0;
+}
+
+/* init memory subsystem */
+int
+rte_eal_memory_init(void)
+{
+   RTE_LOG(INFO, EAL, "Setting up physically contiguous memory...\n");
+   const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
+   rte_eal_hugepage_init() :
+   rte_eal_hugepage_attach();
+
+   if (retval < 0)
+   return -1;
+
+   if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
+   return -1;
+
+   return 0;
+}
diff --git a/lib/librte_eal/common/eal_private.h 
b/lib/librte_eal/common/eal_private.h
index 98a08f0..82a724d 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -279,6 +279,24 @@ void set_tsc_freq(void);
  */
 int set_tsc_freq_from_sysctl(void);

+/**
+ * This function prepares physical memory mapping
+ * i.e. hugepages on Linux and
+ *  contigmem on BSD.
+ *
+ * This function is private to the EAL.
+ */
+int rte_eal_hugepage_init(void);
+
+/**
+ * This function creates memory mapping in secondary
+ * i.e. hugepages on Lin

[dpdk-dev] [PATCH v3 5/6] Move common functions in eal_timer.c

2014-12-30 Thread Ravi Kerur
Changes in v3
Changed subject line to explicitly include file name
Commit log includes function names moved to common directory.

Changes in v2
Use common function name set_tsc_freq_from_sysctl for BSD and Linux.
Update comments about its actuality in function declaration.

Changes in v1
Move common functions in eal_timer.c to librte_eal/common/
eal_common_timer.c file.

Following functions are moved to eal_common_timer.c file

void rte_delay_us(unsigned us);
uint64_t rte_get_tsc_hz(void);
static void set_tsc_freq_fallback(void);
void set_tsc_freq(void);

Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile   |  1 +
 lib/librte_eal/bsdapp/eal/eal_timer.c| 50 +
 lib/librte_eal/common/eal_common_timer.c | 95 
 lib/librte_eal/common/eal_externs.h  |  3 +
 lib/librte_eal/common/eal_private.h  | 15 +
 lib/librte_eal/linuxapp/eal/Makefile |  1 +
 lib/librte_eal/linuxapp/eal/eal_timer.c  | 54 +-
 7 files changed, 120 insertions(+), 99 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_timer.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 560b7a3..fb1faa3 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -75,6 +75,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_timer.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/eal_timer.c 
b/lib/librte_eal/bsdapp/eal/eal_timer.c
index 3163496..4341d3c 100644
--- a/lib/librte_eal/bsdapp/eal/eal_timer.c
+++ b/lib/librte_eal/bsdapp/eal/eal_timer.c
@@ -49,6 +49,7 @@

 #include "eal_private.h"
 #include "eal_internal_cfg.h"
+#include "eal_externs.h"

 #ifdef RTE_LIBEAL_USE_HPET
 #warning HPET is not supported in FreeBSD
@@ -56,25 +57,7 @@

 enum timer_source eal_timer_source = EAL_TIMER_TSC;

-/* The frequency of the RDTSC timer resolution */
-static uint64_t eal_tsc_resolution_hz = 0;
-
-void
-rte_delay_us(unsigned us)
-{
-   const uint64_t start = rte_get_timer_cycles();
-   const uint64_t ticks = (uint64_t)us * rte_get_timer_hz() / 1E6;
-   while ((rte_get_timer_cycles() - start) < ticks)
-   rte_pause();
-}
-
-uint64_t
-rte_get_tsc_hz(void)
-{
-   return eal_tsc_resolution_hz;
-}
-
-static int
+int
 set_tsc_freq_from_sysctl(void)
 {
size_t sz;
@@ -104,35 +87,6 @@ set_tsc_freq_from_sysctl(void)
return 0;
 }

-static void
-set_tsc_freq_fallback(void)
-{
-   RTE_LOG(WARNING, EAL, "WARNING: clock_gettime cannot use "
-   "CLOCK_MONOTONIC_RAW and HPET is not available"
-   " - clock timings may be less accurate.\n");
-   /* assume that the sleep(1) will sleep for 1 second */
-   uint64_t start = rte_rdtsc();
-   sleep(1);
-   eal_tsc_resolution_hz = rte_rdtsc() - start;
-}
-
-/*
- * This function measures the TSC frequency. It uses a variety of approaches.
- *
- * 1. Read the TSC frequency value provided by the kernel
- * 2. If above does not work, just sleep for 1 second and tune off that,
- *printing a warning about inaccuracy of timing
- */
-static void
-set_tsc_freq(void)
-{
-   if (set_tsc_freq_from_sysctl() < 0)
-   set_tsc_freq_fallback();
-
-   RTE_LOG(INFO, EAL, "TSC frequency is ~%"PRIu64" KHz\n",
-   eal_tsc_resolution_hz/1000);
-}
-
 int
 rte_eal_timer_init(void)
 {
diff --git a/lib/librte_eal/common/eal_common_timer.c 
b/lib/librte_eal/common/eal_common_timer.c
new file mode 100644
index 000..cc4515f
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_timer.c
@@ -0,0 +1,95 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTR

[dpdk-dev] [PATCH v3 4/6] Move common functions in eal_lcore.c

2014-12-30 Thread Ravi Kerur
Changes in v3
Changed subject line to explicitly include file name
Commit log includes function names moved to common directory.

Changes in v2
None

Changes in v1
Move common function in eal_lcore.c to librte_eal/common/
eal_common_lcore.c file.

Following function is moved to eal_common_lcore.c file

int rte_eal_cpu_init(void);

Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
common function.
Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile   |   1 +
 lib/librte_eal/bsdapp/eal/eal_lcore.c|  62 --
 lib/librte_eal/common/eal_common_lcore.c | 106 +++
 lib/librte_eal/common/eal_private.h  |  32 ++
 lib/librte_eal/linuxapp/eal/Makefile |   1 +
 lib/librte_eal/linuxapp/eal/eal_lcore.c  |  55 +---
 6 files changed, 155 insertions(+), 102 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_lcore.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 050d70b..560b7a3 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -74,6 +74,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/eal_lcore.c 
b/lib/librte_eal/bsdapp/eal/eal_lcore.c
index 662f024..874fd88 100644
--- a/lib/librte_eal/bsdapp/eal/eal_lcore.c
+++ b/lib/librte_eal/bsdapp/eal/eal_lcore.c
@@ -43,10 +43,19 @@
 #include "eal_private.h"

 /* No topology information available on FreeBSD including NUMA info */
-#define cpu_core_id(X) 0
-#define cpu_socket_id(X) 0
+unsigned
+cpu_core_id(__attribute__((unused)) unsigned lcore_id)
+{
+   return 0;
+}
+
+unsigned
+cpu_socket_id(__attribute__((unused)) unsigned lcore_id)
+{
+   return 0;
+}

-static int
+int
 get_ncpus(void)
 {
int mib[2] = {CTL_HW, HW_NCPU};
@@ -58,50 +67,3 @@ get_ncpus(void)
return ncpu;
 }

-/*
- * fill the cpu_info structure with as much info as we can get.
- * code is similar to linux version, but sadly available info is less.
- */
-int
-rte_eal_cpu_init(void)
-{
-   /* pointer to global configuration */
-   struct rte_config *config = rte_eal_get_configuration();
-   unsigned lcore_id;
-   unsigned count = 0;
-
-   const unsigned ncpus = get_ncpus();
-   /*
-* Parse the maximum set of logical cores, detect the subset of running
-* ones and enable them by default.
-*/
-   for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
-   lcore_config[lcore_id].detected = (lcore_id < ncpus);
-   if (lcore_config[lcore_id].detected == 0) {
-   config->lcore_role[lcore_id] = ROLE_OFF;
-   continue;
-   }
-   /* By default, each detected core is enabled */
-   config->lcore_role[lcore_id] = ROLE_RTE;
-   lcore_config[lcore_id].core_id = cpu_core_id(lcore_id);
-   lcore_config[lcore_id].socket_id = cpu_socket_id(lcore_id);
-   if (lcore_config[lcore_id].socket_id >= RTE_MAX_NUMA_NODES)
-#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID
-   lcore_config[lcore_id].socket_id = 0;
-#else
-   rte_panic("Socket ID (%u) is greater than "
-   "RTE_MAX_NUMA_NODES (%d)\n",
-   lcore_config[lcore_id].socket_id, 
RTE_MAX_NUMA_NODES);
-#endif
-   RTE_LOG(DEBUG, EAL, "Detected lcore %u\n",
-   lcore_id);
-   count++;
-   }
-   /* Set the count of enabled logical cores of the EAL configuration */
-   config->lcore_count = count;
-   RTE_LOG(DEBUG, EAL, "Support maximum %u logical core(s) by 
configuration.\n",
-   RTE_MAX_LCORE);
-   RTE_LOG(DEBUG, EAL, "Detected %u lcore(s)\n", config->lcore_count);
-
-   return 0;
-}
diff --git a/lib/librte_eal/common/eal_common_lcore.c 
b/lib/librte_eal/common/eal_common_lcore.c
new file mode 100644
index 000..af19d00
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_lcore.c
@@ -0,0 +1,106 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary

[dpdk-dev] [PATCH v3 3/6] Move common functions in eal.c

2014-12-30 Thread Ravi Kerur
Changes in v3
Changed subject line to explicitly include file name
Commit log includes function names moved to common directory.

Changes in v2
In function rte_eal_config_create remove #ifdef _BSDAPP_
and initialize mem_cfg_addr unconditionally.

Changes in v1
Move common functions in eal.c to librte_eal/common/eal_common.c.

Following functions are moved to eal_common.c file.

struct rte_config *rte_eal_get_configuration(void);
int eal_parse_sysfs_value(const char *filename, unsigned long *val);
static void rte_eal_config_create(void);
enum rte_proc_type_t eal_proc_type_detect(void);
void rte_eal_config_init(void);
rte_usage_hook_t rte_set_application_usage_hook(rte_usage_hook_t usage_func);
inline size_t eal_get_hugepage_mem_size(void);
void eal_check_mem_on_local_socket(void);
int sync_func(__attribute__((unused)) void *arg);
inline void rte_eal_mcfg_complete(void);
int rte_eal_has_hugepages(void);
enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id);
enum rte_proc_type_t rte_eal_process_type(void);

Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile|   1 +
 lib/librte_eal/bsdapp/eal/eal.c   | 233 +---
 lib/librte_eal/common/eal_common.c| 326 ++
 lib/librte_eal/common/eal_externs.h   |  42 +
 lib/librte_eal/common/eal_hugepages.h |   1 +
 lib/librte_eal/common/eal_private.h   |  47 +
 lib/librte_eal/linuxapp/eal/Makefile  |   1 +
 lib/librte_eal/linuxapp/eal/eal.c | 246 ++---
 8 files changed, 437 insertions(+), 460 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common.c
 create mode 100644 lib/librte_eal/common/eal_externs.h

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 92dd9a6..050d70b 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -58,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c

 # from common dir
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_memzone.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_launch.c
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 69f3c03..f925da7 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -80,30 +80,10 @@
 #include "eal_filesystem.h"
 #include "eal_hugepages.h"
 #include "eal_options.h"
+#include "eal_externs.h"

 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)

-/* Allow the application to print its usage message too if set */
-static rte_usage_hook_trte_application_usage_hook = NULL;
-/* early configuration structure, when memory config is not mmapped */
-static struct rte_mem_config early_mem_config;
-
-/* define fd variable here, because file needs to be kept open for the
- * duration of the program, as we hold a write lock on it in the primary proc 
*/
-static int mem_cfg_fd = -1;
-
-static struct flock wr_lock = {
-   .l_type = F_WRLCK,
-   .l_whence = SEEK_SET,
-   .l_start = offsetof(struct rte_mem_config, memseg),
-   .l_len = sizeof(early_mem_config.memseg),
-};
-
-/* Address of global and public configuration */
-static struct rte_config rte_config = {
-   .mem_config = &early_mem_config,
-};
-
 /* internal configuration (per-core) */
 struct lcore_config lcore_config[RTE_MAX_LCORE];

@@ -113,93 +93,14 @@ struct internal_config internal_config;
 /* used by rte_rdtsc() */
 int rte_cycles_vmware_tsc_map;

-/* Return a pointer to the configuration structure */
-struct rte_config *
-rte_eal_get_configuration(void)
+inline void *
+rte_eal_get_mem_cfg_addr(void)
 {
-   return &rte_config;
-}
-
-/* parse a sysfs (or other) file containing one integer value */
-int
-eal_parse_sysfs_value(const char *filename, unsigned long *val)
-{
-   FILE *f;
-   char buf[BUFSIZ];
-   char *end = NULL;
-
-   if ((f = fopen(filename, "r")) == NULL) {
-   RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
-   __func__, filename);
-   return -1;
-   }
-
-   if (fgets(buf, sizeof(buf), f) == NULL) {
-   RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
-   __func__, filename);
-   fclose(f);
-   return -1;
-   }
-   *val = strtoul(buf, &end, 0);
-   if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
-   RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs value %s\n",
-   __func__, filename);
-   fclose(f);
-   return -1;
-   }
-   fclose(f);
-   return 0;
-}
-
-
-/* create memory configuration in shared/mmap memory. T

[dpdk-dev] [PATCH v3 2/6] Move common functions in eal_thread.c

2014-12-30 Thread Ravi Kerur
Changes in v3
Changed subject line to explicitly include file name

Changes in v2
None

Changes in v1
eal_thread.c has minor differences between Linux and BSD, move
entire file to common directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate on minor differences.
Rename eal_thread.c to eal_common_thread.c
Makefile changes to reflect file move and name change.
Fix checkpatch warnings.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile|   6 +-
 lib/librte_eal/bsdapp/eal/eal_thread.c| 233 
 lib/librte_eal/common/eal_common_thread.c | 248 ++
 lib/librte_eal/linuxapp/eal/Makefile  |   6 +-
 lib/librte_eal/linuxapp/eal/eal_thread.c  | 233 
 5 files changed, 254 insertions(+), 472 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_thread.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 9b83e11..92dd9a6 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -50,7 +50,6 @@ CFLAGS += $(WERROR_FLAGS) -O3
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) := eal.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_memory.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
@@ -73,16 +72,17 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c

 CFLAGS_eal.o := -D_GNU_SOURCE
-#CFLAGS_eal_thread.o := -D_GNU_SOURCE
+#CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
 CFLAGS_eal_log.o := -D_GNU_SOURCE
 CFLAGS_eal_common_log.o := -D_GNU_SOURCE

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-CFLAGS_eal_thread.o += -Wno-return-type
+CFLAGS_eal_common_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif

diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c 
b/lib/librte_eal/bsdapp/eal/eal_thread.c
deleted file mode 100644
index ab05368..000
--- a/lib/librte_eal/bsdapp/eal/eal_thread.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of Intel Corporation nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "eal_private.h"
-#include "eal_thread.h"
-
-RTE_DEFINE_PER_LCORE(unsigned, _lcore_id);
-
-/*
- * Send a message to a slave lcore identified by slave_id to call a
- * function f with argument arg. Once the execution is done, the
- * remote lcore switch in FINISHED state.
- */
-int
-rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)
-{
-   int n;
-   char c = 0;
-   int m2s = lcore_config[sla

[dpdk-dev] [PATCH v3 1/6] Move common functions in eal_debug.c

2014-12-30 Thread Ravi Kerur
Changes in v3
Changed subject line to explicitly include file name

Changes in v2
Remove rte_dump_registers() function since it is not implemented.
Fix comment for _rte_exit()

Changes in v1
eal_debug.c has no difference between Linux and BSD, move
entire file to common directory.
Rename eal_debug.c to eal_common_debug.c
Makefile changes to reflect file move and name change.
Fix checkpatch warnings.

Signed-off-by: Ravi Kerur 
---
 app/test/test_debug.c |   1 -
 lib/librte_eal/bsdapp/eal/Makefile|   2 +-
 lib/librte_eal/bsdapp/eal/eal_debug.c | 113 --
 lib/librte_eal/common/eal_common_debug.c  | 106 
 lib/librte_eal/common/include/rte_debug.h |   7 --
 lib/librte_eal/linuxapp/eal/Makefile  |   2 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c   | 113 --
 7 files changed, 108 insertions(+), 236 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c

diff --git a/app/test/test_debug.c b/app/test/test_debug.c
index 7c3ee92..01d4b76 100644
--- a/app/test/test_debug.c
+++ b/app/test/test_debug.c
@@ -136,7 +136,6 @@ static int
 test_debug(void)
 {
rte_dump_stack();
-   rte_dump_registers();
if (test_panic() < 0)
return -1;
if (test_exit() < 0)
diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index d434882..9b83e11 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -53,7 +53,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
@@ -73,6 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/eal_debug.c 
b/lib/librte_eal/bsdapp/eal/eal_debug.c
deleted file mode 100644
index 44fc4f3..000
--- a/lib/librte_eal/bsdapp/eal/eal_debug.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of Intel Corporation nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-   void *func[BACKTRACE_SIZE];
-   char **symb = NULL;
-   int size;
-
-   size = backtrace(func, BACKTRACE_SIZE);
-   symb = backtrace_symbols(func, size);
-   while (size > 0) {
-   rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
-   "%d: [%s]\n", size, symb[size - 1]);
-   size --;
-   }
-}

[dpdk-dev] [PATCH v3 0/6] Move EAL common functions

2014-12-30 Thread Ravi Kerur
Changes in v3
Make subject line explicit on file names.
Commit log includes function names moved to common directory.

Changes in v2
Fix patch review comments from Neil.

Changes in v1
Common functions in linuxapp and bsdapp are moved into
librte_eal/common directory.
New files added follow _common_ naming conventions.

Following checkpatch warnings are treated as false-positive.
WARNING: quoted string split across lines

Tested against ubuntu and FreeBSD.

Ravi Kerur (6):
  Move common functions in eal_debug.c
  Move common functions in eal_thread.c
  Move common functions in eal.c
  Move common functions in eal_lcore.c
  Move common functions in eal_timer.c
  Move common functions in eal_memory.c

 app/test/test_debug.c |   1 -
 lib/librte_eal/bsdapp/eal/Makefile|  11 +-
 lib/librte_eal/bsdapp/eal/eal.c   | 233 +
 lib/librte_eal/bsdapp/eal/eal_debug.c | 113 ---
 lib/librte_eal/bsdapp/eal/eal_lcore.c |  62 ++
 lib/librte_eal/bsdapp/eal/eal_memory.c|  40 +---
 lib/librte_eal/bsdapp/eal/eal_thread.c| 233 -
 lib/librte_eal/bsdapp/eal/eal_timer.c |  50 +
 lib/librte_eal/common/eal_common.c| 326 ++
 lib/librte_eal/common/eal_common_debug.c  | 106 ++
 lib/librte_eal/common/eal_common_lcore.c  | 106 ++
 lib/librte_eal/common/eal_common_memory.c |  38 +++-
 lib/librte_eal/common/eal_common_thread.c | 248 +++
 lib/librte_eal/common/eal_common_timer.c  |  95 +
 lib/librte_eal/common/eal_externs.h   |  45 +
 lib/librte_eal/common/eal_hugepages.h |   1 +
 lib/librte_eal/common/eal_private.h   | 112 ++
 lib/librte_eal/common/include/rte_debug.h |   7 -
 lib/librte_eal/linuxapp/eal/Makefile  |  11 +-
 lib/librte_eal/linuxapp/eal/eal.c | 246 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c   | 113 ---
 lib/librte_eal/linuxapp/eal/eal_lcore.c   |  55 +
 lib/librte_eal/linuxapp/eal/eal_memory.c  |  36 +---
 lib/librte_eal/linuxapp/eal/eal_thread.c  | 233 -
 lib/librte_eal/linuxapp/eal/eal_timer.c   |  54 +
 25 files changed, 1134 insertions(+), 1441 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/common/eal_common.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_lcore.c
 create mode 100644 lib/librte_eal/common/eal_common_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_timer.c
 create mode 100644 lib/librte_eal/common/eal_externs.h
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c

-- 
1.9.1



[dpdk-dev] Query on the modified rte_mbuf structure

2014-12-30 Thread Tapio Tallgren
Hi,

I am not sure if I understand the question correctly, but there was a
change to the rte_mbuf structure with
patch ea672a8b1655bbb44876d2550ff56f384968a43b. It got rid of the pkt
member in rte_mbuf. Here is an example of how to fix it:

-   eth_hdr = (struct ether_hdr *) mb->pkt.data;
+   eth_hdr = (struct ether_hdr *) mb->data;

Another way of answering your question is that it is "data" in rte_mbuf:

-   struct rte_pktmbuf pkt;
+   /* valid for any segment */
+   struct rte_mbuf *next;  /**< Next segment of scattered packet. */
+   void* data; /**< Start address of data in segment
buffer. */
+   uint16_t data_len;  /**< Amount of data in segment buffer. */




On Thu, Dec 25, 2014 at 11:24 AM, Shankari Vaidyalingam <
shankari.v2k6 at gmail.com> wrote:

> Hi,
>
>
> I can see that in the recent releases of DPDK the rte_mbuf structure has
> undergone some changes.
> Would like to know which field in the rte_mbuf data structure holds the
> exact payload of the received packet in the modified structure.
>
> Regards
> Shankari
>



-- 
-Tapio


[dpdk-dev] [PATCH v6 5/6] enicpmd: DPDK-ENIC PMD interface

2014-12-30 Thread Sujith Sankar (ssujith)


On 29/12/14 1:45 pm, "Wu, Jingjing"  wrote:

>Hi, ssujith
>
>> +.tx_queue_release = enicpmd_dev_tx_queue_release,
>> +.dev_led_on   = NULL,
>> +.dev_led_off  = NULL,
>> +.flow_ctrl_get= NULL,
>> +.flow_ctrl_set= NULL,
>> +.priority_flow_ctrl_set = NULL,
>> +.mac_addr_add = enicpmd_add_mac_addr,
>> +.mac_addr_remove  = enicpmd_remove_mac_addr,
>> +.fdir_add_signature_filter= NULL,
>> +.fdir_update_signature_filter = NULL,
>> +.fdir_remove_signature_filter = NULL,
>> +.fdir_infos_get   = enicpmd_fdir_info_get,
>> +.fdir_add_perfect_filter  = enicpmd_fdir_add_perfect_filter,
>> +.fdir_update_perfect_filter   = enicpmd_fdir_add_perfect_filter,
>> +.fdir_remove_perfect_filter   = enicpmd_fdir_remove_perfect_filter,
>> +.fdir_set_masks   = NULL,
>> +};
>> +
>
>I found that in perfect fdir is also supported in enic driver.
>
>During the R1.8 development, we defined a new dev_ops call filter_ctrl,
>which can be used to control kinds of filters, flow director is included
>too. Which is mentioned in
>http://www.dpdk.org/ml/archives/dev/2014-September/005179.html .
>In R1.8, filter_ctrl is only used by i40e driver. And we also planned use
>it in the existing ixgbe/e1000 driver in the next days. The old APIs such
>as fdir_add_perfect_filter, fdir_remove_perfect_filter can be replaced
>then.


Hi Jingjing,
Thanks for the info and the link.  I shall take a look at it.
It looks like bringing in one interface for all filter related operations.
 I believe ENIC should also move to it.

Thanks,
-Sujith

>
>So, do you have any plan to migrate the fdir in enic to the filter_ctrl
>API?
>
>Jingjing
>
>Thanks!
>
>> +struct enic *enicpmd_list_head = NULL;
>> +/* Initialize the driver
>> + * It returns 0 on success.
>> + */
>> +static int eth_enicpmd_dev_init(
>> +__attribute__((unused))struct eth_driver *eth_drv,
>> +struct rte_eth_dev *eth_dev)
>> +{
>> +struct rte_pci_device *pdev;
>> +struct rte_pci_addr *addr;
>> +struct enic *enic = pmd_priv(eth_dev);
>> +
>> +ENICPMD_FUNC_TRACE();
>> +
>> +enic->rte_dev = eth_dev;
>> +eth_dev->dev_ops = &enicpmd_eth_dev_ops;
>> +eth_dev->rx_pkt_burst = &enicpmd_recv_pkts;
>> +eth_dev->tx_pkt_burst = &enicpmd_xmit_pkts;
>> +
>> +pdev = eth_dev->pci_dev;
>> +enic->pdev = pdev;
>> +addr = &pdev->addr;
>> +
>> +snprintf(enic->bdf_name, ENICPMD_BDF_LENGTH,
>> "%04x:%02x:%02x.%x",
>> +addr->domain, addr->bus, addr->devid, addr->function);
>> +
>> +return enic_probe(enic);
>> +}
>> +
>> +static struct eth_driver rte_enic_pmd = {
>> +{
>> +.name = "rte_enic_pmd",
>> +.id_table = pci_id_enic_map,
>> +.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
>> +},
>> +.eth_dev_init = eth_enicpmd_dev_init,
>> +.dev_private_size = sizeof(struct enic), };
>> +
>> +/* Driver initialization routine.
>> + * Invoked once at EAL init time.
>> + * Register as the [Poll Mode] Driver of Cisco ENIC device.
>> + */
>> +int rte_enic_pmd_init(const char *name __rte_unused,
>> +const char *params __rte_unused)
>> +{
>> +ENICPMD_FUNC_TRACE();
>> +
>> +rte_eth_driver_register(&rte_enic_pmd);
>> +return 0;
>> +}
>> +
>> +static struct rte_driver rte_enic_driver = {
>> +.type = PMD_PDEV,
>> +.init = rte_enic_pmd_init,
>> +};
>> +
>> +PMD_REGISTER_DRIVER(rte_enic_driver);
>> +
>> --
>> 1.9.1
>