[dpdk-dev] Issues of MSIx interrupt enable with user space driver

2015-04-29 Thread Zhou, Danny
DPDK is aimed to drive PCIe NIC device for high performance packet processing 
only. While we do have a Waikiki Beach project that
integrates user space DPDK PMD and NVMe poll mode iSCSI target and NVMe backend 
together to improve performance of storage.

> -Original Message-
> From: James (Fei) Liu-SSI [mailto:james.liu at ssi.samsung.com]
> Sent: Thursday, April 30, 2015 2:26 AM
> To: Zhou, Danny; dev at dpdk.org
> Cc: Liang, Cunming
> Subject: RE: [dpdk-dev] Issues of MSIx interrupt enable with user space driver
> 
> Hi Danny,
> 
>   Thanks  a lot for your promptly answer. I am going to check your patch 
> soon. In the mean time, Have you guys ever try DPDK
> with PCIe storage device?
> 
>  Regards,
>  James
> 
> -Original Message-
> From: Zhou, Danny [mailto:danny.zhou at intel.com]
> Sent: Tuesday, April 28, 2015 4:19 PM
> To: James (Fei) Liu-SSI; dev at dpdk.org
> Cc: Liang, Cunming
> Subject: RE: [dpdk-dev] Issues of MSIx interrupt enable with user space driver
> 
> The V6 "Interrupt PMD" patch has been sent out to DPDK.org 2 months ago, and 
> V7 is under development with changes to
> include more generic APIs that could support all kinds of interrupts (e.g. HW 
> Rx interrupt and SW ring interrupt).
> 
> Stay tuned.
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of James (Fei)
> > Liu-SSI
> > Sent: Wednesday, April 29, 2015 5:58 AM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] Issues of MSIx interrupt enable with user space
> > driver
> >
> > Hi All,
> > We are porting driver from kernel into user space driver with DPDK
> > for one of our devices. Polling thread works fine without any issue.
> > However, we want to switch from polling to interrupt based handler. While 
> > we enable interrupt with VFIO MSIx, we always get
> below errors after issuing one command:
> >
> > [  465.464186] dmar: DRHD: handling fault status reg 2 [  465.464194]
> > dmar: INTR-REMAP: Request device [[02:00.0] fault index 27 [
> > 465.464194] INTR-REMAP:[fault reason 34] Present field in the IRTE
> > entry is clear
> >
> > Here are steps we follow to enable interrupt:
> > 1. --vfio-intr msix   was passed in as parameter for rte_eal_init
> > 2. rte_intr_enable was called during the drive probe stage.
> > 3. rte_intr_callback_register was called after interrupt was enabled
> >
> >
> >
> > Is there anyone in the forum who worked on the interrupt handler to
> > share with us about your comments? thanks for your help in advance.
> >
> > Regards,
> > James
> >


[dpdk-dev] [PATCH] vhost: make vhost lockless enqueue configurable

2015-04-29 Thread Huawei Xie
vhost enabled vSwitch could have their own thread-safe vring enqueue policy.
Add the RTE_LIBRTE_VHOST_LOCKLESS_ENQ macro for vhost lockless enqueue.
Turn it off by default.

Signed-off-by: Huawei Xie 
---
 config/common_linuxapp|  1 +
 lib/librte_vhost/vhost_rxtx.c | 24 +++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/config/common_linuxapp b/config/common_linuxapp
index 0078dc9..7f59499 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -421,6 +421,7 @@ CONFIG_RTE_KNI_VHOST_DEBUG_TX=n
 #
 CONFIG_RTE_LIBRTE_VHOST=n
 CONFIG_RTE_LIBRTE_VHOST_USER=y
+CONFIG_RTE_LIBRTE_VHOST_LOCKLESS_ENQ=n
 CONFIG_RTE_LIBRTE_VHOST_DEBUG=n

 #
diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index 510ffe8..475be6e 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -80,7 +80,11 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
 * they need to be reserved.
 */
do {
+#ifdef RTE_LIBRTE_VHOST_LOCKESS_ENQ
res_base_idx = vq->last_used_idx_res;
+#else
+   res_base_idx = vq->last_used_idx;
+#endif
avail_idx = *((volatile uint16_t *)&vq->avail->idx);

free_entries = (avail_idx - res_base_idx);
@@ -92,10 +96,15 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
return 0;

res_end_idx = res_base_idx + count;
+
+#ifdef RTE_LIBRTE_VHOST_LOCKLESS_ENQ
/* vq->last_used_idx_res is atomically updated. */
-   /* TODO: Allow to disable cmpset if no concurrency in 
application. */
success = rte_atomic16_cmpset(&vq->last_used_idx_res,
res_base_idx, res_end_idx);
+#else
+   /* last_used_idx_res isn't used. */
+   success = 1;
+#endif
} while (unlikely(success == 0));
res_cur_idx = res_base_idx;
LOG_DEBUG(VHOST_DATA, "(%"PRIu64") Current Index %d| End Index %d\n",
@@ -171,9 +180,11 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,

rte_compiler_barrier();

+#ifdef RTE_LIBRTE_VHOST_LOCKLESS_ENQ
/* Wait until it's our turn to add our buffer to the used ring. */
while (unlikely(vq->last_used_idx != res_base_idx))
rte_pause();
+#endif

*(volatile uint16_t *)&vq->used->idx += count;
vq->last_used_idx = res_end_idx;
@@ -422,11 +433,15 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t 
queue_id,
uint16_t i, id;

do {
+#ifdef RTE_LIBRTE_VHOST_LOCKLESS_ENQ
/*
 * As many data cores may want access to available
 * buffers, they need to be reserved.
 */
res_base_idx = vq->last_used_idx_res;
+#else
+   res_base_idx = vq->last_used_idx;
+#endif
res_cur_idx = res_base_idx;

do {
@@ -459,10 +474,15 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t 
queue_id,
}
} while (pkt_len > secure_len);

+#ifdef RTE_LIBRTE_VHOST_LOCKLESS_ENQ
/* vq->last_used_idx_res is atomically updated. */
success = rte_atomic16_cmpset(&vq->last_used_idx_res,
res_base_idx,
res_cur_idx);
+#else
+   /* last_used_idx_res isn't used. */
+   success = 1;
+#endif
} while (success == 0);

id = res_base_idx;
@@ -495,12 +515,14 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t 
queue_id,

rte_compiler_barrier();

+#ifdef RTE_LIBRTE_VHOST_LOCKLESS_ENQ
/*
 * Wait until it's our turn to add our buffer
 * to the used ring.
 */
while (unlikely(vq->last_used_idx != res_base_idx))
rte_pause();
+#endif

*(volatile uint16_t *)&vq->used->idx += entry_success;
vq->last_used_idx = res_end_idx;
-- 
1.8.1.4



[dpdk-dev] [PATCH v4 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Thomas Monjalon
2015-04-29 10:25, Keith Wiles:
> -#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> -#   Copyright(c) 2014 6WIND S.A.
> +#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> +#   Copyright(c) 2015 6WIND S.A.

A correct update of copyright dates should be
- 2014
+ 2014-2015

Please do not send a new version only for this change.
4 versions of the same patch in 1 day should be enough :)
Let's wait for more feedback on the idea of your patch, especially from
the maintainer (Olivier).


[dpdk-dev] [PATCH v2] vhost: flush used->idx update before reading avail->flags

2015-04-29 Thread Huawei Xie
update of used->idx and read of avail->flags could be reordered.
memory fence should be used to ensure the order, otherwise guest could see a 
stale used->idx value after it toggles the interrupt suppression flag.
After guest sets the interrupt suppression flag, it will check if there is more 
buffer to process through used->idx. If it sees a stale value, it will exit the 
processing while host willn't send interrupt to guest.

Signed-off-by: Huawei Xie 
---
 lib/librte_vhost/vhost_rxtx.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index 510ffe8..4809d32 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -178,6 +178,9 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
*(volatile uint16_t *)&vq->used->idx += count;
vq->last_used_idx = res_end_idx;

+   /* flush used->idx update before we read avail->flags. */
+   rte_mb();
+
/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
eventfd_write((int)vq->callfd, 1);
@@ -505,6 +508,9 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t 
queue_id,
*(volatile uint16_t *)&vq->used->idx += entry_success;
vq->last_used_idx = res_end_idx;

+   /* flush used->idx update before we read avail->flags. */
+   rte_mb();
+
/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
eventfd_write((int)vq->callfd, 1);
-- 
1.8.1.4



[dpdk-dev] [PATCH] doc: disable doxygen member sorting

2015-04-29 Thread Thomas Monjalon
> > > Disabled the doxygen option to sort member data so that functions and
> > > struct memebers are listed in order of definition in the brief and
> > > main sections.
> > 
> > See for example:
> > 
> > http://dpdk.org/doc/api/structlcore__config.html
> > 
> > The first listed member is "unsigned detected" but the first documented
> > member is "void* volatile arg".
> > 
> > John.
> 
> Thanks for making this change John - it helps with readability
> Siobhan 
> 
> Acked-by Siobhan Butler 

Applied, thanks


[dpdk-dev] [PATCH] doc: fixed spellings and typos

2015-04-29 Thread Thomas Monjalon
> Fixed several typos and spelling errors in guide docs.
> 
> Signed-off-by: John McNamara 

Applied, thanks


[dpdk-dev] [PATCH] doc: link doxygen docs to source code

2015-04-29 Thread Thomas Monjalon
> > Enabled Doxygen option to add links to the source code in documented
> > entities.
> > 
> > Signed-off-by: John McNamara 
> 
> Thanks John, I think this will help.
> Acked-by: Siobhan Butler 

Applied, thanks


[dpdk-dev] Issues of MSIx interrupt enable with user space driver

2015-04-29 Thread James (Fei) Liu-SSI
Hi Danny,

  Thanks  a lot for your promptly answer. I am going to check your patch soon. 
In the mean time, Have you guys ever try DPDK with PCIe storage device?

 Regards,
 James

-Original Message-
From: Zhou, Danny [mailto:danny.z...@intel.com] 
Sent: Tuesday, April 28, 2015 4:19 PM
To: James (Fei) Liu-SSI; dev at dpdk.org
Cc: Liang, Cunming
Subject: RE: [dpdk-dev] Issues of MSIx interrupt enable with user space driver

The V6 "Interrupt PMD" patch has been sent out to DPDK.org 2 months ago, and V7 
is under development with changes to include more generic APIs that could 
support all kinds of interrupts (e.g. HW Rx interrupt and SW ring interrupt). 

Stay tuned. 

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of James (Fei) 
> Liu-SSI
> Sent: Wednesday, April 29, 2015 5:58 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] Issues of MSIx interrupt enable with user space 
> driver
> 
> Hi All,
> We are porting driver from kernel into user space driver with DPDK 
> for one of our devices. Polling thread works fine without any issue. 
> However, we want to switch from polling to interrupt based handler. While we 
> enable interrupt with VFIO MSIx, we always get below errors after issuing one 
> command:
> 
> [  465.464186] dmar: DRHD: handling fault status reg 2 [  465.464194] 
> dmar: INTR-REMAP: Request device [[02:00.0] fault index 27 [  
> 465.464194] INTR-REMAP:[fault reason 34] Present field in the IRTE 
> entry is clear
> 
> Here are steps we follow to enable interrupt:
> 1. --vfio-intr msix   was passed in as parameter for rte_eal_init
> 2. rte_intr_enable was called during the drive probe stage.
> 3. rte_intr_callback_register was called after interrupt was enabled
> 
> 
> 
> Is there anyone in the forum who worked on the interrupt handler to 
> share with us about your comments? thanks for your help in advance.
> 
> Regards,
> James
> 


[dpdk-dev] Issues of MSIx interrupt enable with user space driver

2015-04-29 Thread James (Fei) Liu-SSI
Do you have kernel version in your build environment that has  ?
[James] The kernel version is 3.17.2

Do you have iommu enabled on your target machine?
[James] Yes

Did you program the MSI-X correctly?
[James] We can issues several admin commands successfully with interrupt 
enabled , however. It is going to fail during IO traffic. By the way, we are 
using DPDK for PCIe storage driver development. Have you guys ever use dpdk for 
PCIe storage device?

Thanks so much.

Regards,
James

-Original Message-
From: Stephen Hemminger [mailto:step...@networkplumber.org]
Sent: Tuesday, April 28, 2015 4:43 PM
To: James (Fei) Liu-SSI
Cc: dev at dpdk.org
Subject: Re: [dpdk-dev] Issues of MSIx interrupt enable with user space driver

On Tue, 28 Apr 2015 21:57:31 +
"James (Fei) Liu-SSI" mailto:james.liu at 
ssi.samsung.com>> wrote:

> Hi All,
> We are porting driver from kernel into user space driver with DPDK for 
> one of our devices. Polling thread works fine without any issue. However, we 
> want to switch from polling to interrupt based handler. While we enable 
> interrupt with VFIO MSIx, we always get below errors after issuing one 
> command:
>
> [  465.464186] dmar: DRHD: handling fault status reg 2 [  465.464194]
> dmar: INTR-REMAP: Request device [[02:00.0] fault index 27 [
> 465.464194] INTR-REMAP:[fault reason 34] Present field in the IRTE
> entry is clear
>
> Here are steps we follow to enable interrupt:
> 1. --vfio-intr msix   was passed in as parameter for rte_eal_init
> 2. rte_intr_enable was called during the drive probe stage.
> 3. rte_intr_callback_register was called after interrupt was enabled
>
>
>
> Is there anyone in the forum who worked on the interrupt handler to share 
> with us about your comments? thanks for your help in advance.

Do you have kernel version in your build environment that has  ?

Do you have iommu enabled on your target machine?

Did you program the MSI-X correctly?



[dpdk-dev] [PATCH 0/2] doc: refactored fig and table nums into references

2015-04-29 Thread Thomas Monjalon
Hi John,

2015-04-24 14:11, John McNamara:
> This patch adds automatic figure and table references to the docs. The
> figure and table numbers in the generated Html and PDF docs can now be
> automatically numbered based on section.
> 
> Requires Sphinx >= 1.3.
> 
> Advantages:
> 
> * Figues/tables are numbered automatically and adding/removing items
>   no longer requires manual fixing.
> 
> Disadvantages:
> 
> * Requires Sphinx >= 1.3.
> 
> * Table captions are above tables while figure captions are below. This is
>   a current Sphinx/DocUtils limitation.
> 
> * Both the :numref: and :ref: directives are required to link to a figure
>   or table number and caption.

This is really a great work but I think it's not reasonnable to require
sphinx 1.3. As almost nobody is using this version, it would be equivalent
to prevent users and developers to generate the doc by themselves.

It produces this error:
ERROR: Unknown interpreted text role "numref".

Do you think it's possible to implement a fallback in our conf.py in order
to ignore this new role if not supported?


[dpdk-dev] [PATCH v4 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Wiles, Keith


On 4/29/15, 12:17 PM, "Thomas Monjalon"  wrote:

>2015-04-29 10:25, Keith Wiles:
>> -#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
>> -#   Copyright(c) 2014 6WIND S.A.
>> +#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
>> +#   Copyright(c) 2015 6WIND S.A.
>
>A correct update of copyright dates should be
>- 2014
>+ 2014-2015

If I have to send a new patch for other stuff I will update the copyright,
if not does that mean I have send a patch at some point or can it be
handled.
>
>Please do not send a new version only for this change.
>4 versions of the same patch in 1 day should be enough :)

Multiple versions in one day I was trying to get the record for the most
updates in one day. :-)
>Let's wait for more feedback on the idea of your patch, especially from
>the maintainer (Olivier).



[dpdk-dev] [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Gonzalez Monroy, Sergio
On 29/04/2015 16:16, Wiles, Keith wrote:
>
> On 4/29/15, 10:04 AM, "Gonzalez Monroy, Sergio"
>  wrote:
>
>> On 29/04/2015 16:00, Wiles, Keith wrote:
>>> On 4/29/15, 9:55 AM, "Gonzalez Monroy, Sergio"
>>>  wrote:
>>>
 On 29/04/2015 15:37, Keith Wiles wrote:
> Signed-off-by: Keith Wiles 
> ---
> doc/build-sdk-quick.txt  | 1 +
> doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
> doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
> 3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
> index 041a40e..26d5442 100644
> --- a/doc/build-sdk-quick.txt
> +++ b/doc/build-sdk-quick.txt
> @@ -13,6 +13,7 @@ Build variables
>   EXTRA_CPPFLAGS   preprocessor options
>   EXTRA_CFLAGS compiler options
>   EXTRA_LDFLAGSlinker options
> + EXTRA_LDLIBS linker libary options
>   RTE_KERNELDIRlinux headers path
>   CROSS toolchain prefix
>   V verbose
> diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst
> b/doc/guides/prog_guide/dev_kit_build_system.rst
> index cf5c96f..b8ef167 100644
> --- a/doc/guides/prog_guide/dev_kit_build_system.rst
> +++ b/doc/guides/prog_guide/dev_kit_build_system.rst
> @@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User
> in
> a Makefile or Command Line
> 
> *   EXTRA_LDFLAGS: The content of this variable is appended after
> LDFLAGS when linking.
> 
> +*   EXTRA_LDLIBS: The content of this variable is appended after
> LDLIBS when linking.
> +
> *   EXTRA_ASFLAGS: The content of this variable is appended after
> ASFLAGS when assembling.
> 
> *   EXTRA_CPPFLAGS: The content of this variable is appended after
> CPPFLAGS when using a C preprocessor on assembly files.
> diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst
> b/doc/guides/prog_guide/dev_kit_root_make_help.rst
> index 4f30192..fdc5fea 100644
> --- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
> +++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
> @@ -205,7 +205,7 @@ The following variables can be specified on the
> command line:
> 
> Enable dependency debugging. This provides some useful
> information about why a target is built or not.
> 
> -*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
> +*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,
> EXTRA_CPPFLAGS=
> 
> Append specific compilation, link or asm flags.
> 
 Do we need to remove LDLIBS from section 28.3.4?
>>> Missed it, but it should be LDLIBS-y now
>> It would still be lost cause you are resetting LDLIBS-y value at the
>> start of rte.app.mk, right?
> Yes, LDLIBS-y is reset at the top, just as LDLIBS was reset in the
> original rte.app.mk file. I would assume this is the correct design and we
> should reset LDLIBS-y at the top of the file, right?
But LDLIBS was not reset pre-patch, was it?

  # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib


Sergio
>> The only way to add to LDLIBS-y would be using EXTRA_LDLIBS.
>>
>> Sergio
 With the current patch the value of LDLIBS in the app makefile is lost.

 Sergio



[dpdk-dev] [PATCH] vfio: eventfd should be non-block and not inherited

2015-04-29 Thread Burakov, Anatoly
> Set internal event file descriptor to be non-block and not inherited across
> exec.  This prevents accidental hangs and passing in anothr thread.
> 
> Signed-off-by: Stephen Hemminger 
> ---
>  lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> index aea1fb1..426953a 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> @@ -294,7 +294,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device
> *dev, int vfio_dev_fd)
>   }
> 
>   /* set up an eventfd for interrupts */
> - fd = eventfd(0, 0);
> + fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
>   if (fd < 0) {
>   RTE_LOG(ERR, EAL, "  cannot set up eventfd, "
>   "error %i (%s)\n", errno,
> strerror(errno));
> --
> 2.1.4

Acked-by: Anatoly  Burakov 


[dpdk-dev] [PATCH v2 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Bruce Richardson
On Wed, Apr 29, 2015 at 09:37:42AM -0500, Keith Wiles wrote:
> Trying to simplify the ifdefs in rte.app.mk to make the code
> more readable and maintainable by moving LDLIBS variable to use
> the same style as LDLIBS-y being used in the rest of the code.
> 
> Added a new variable called EXTRA_LDLIBS to be used by example apps
> instead of using LDLIBS directly.
> 
> Signed-off-by: Keith Wiles 

Since EXTRA_* flags are designed that they can be overridden on the makefile,
what happens if someone does a compile via: "EXTRA_LDLIBS=X make"? Does the 
compile/link still work?

/Bruce


> ---
>  examples/dpdk_qat/Makefile |   4 +-
>  examples/vm_power_manager/Makefile |   2 +-
>  mk/rte.app.mk  | 254 
> ++---
>  mk/rte.hostapp.mk  |   4 +-
>  mk/rte.shared.mk   |  12 +-
>  5 files changed, 77 insertions(+), 199 deletions(-)
> 
> diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
> index f1e06a1..90ca1d3 100644
> --- a/examples/dpdk_qat/Makefile
> +++ b/examples/dpdk_qat/Makefile
> @@ -77,8 +77,8 @@ else
>  ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
>  endif
>  
> -LDLIBS += -L$(ICP_ROOT)/build
> -LDLIBS += $(ICP_LIBRARY_PATH) \
> +EXTRA_LDLIBS += -L$(ICP_ROOT)/build
> +EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
>  -lz \
>  -losal \
>  -ladf_proxy \
> diff --git a/examples/vm_power_manager/Makefile 
> b/examples/vm_power_manager/Makefile
> index 113dbc4..8fb78d4 100644
> --- a/examples/vm_power_manager/Makefile
> +++ b/examples/vm_power_manager/Makefile
> @@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
>  CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
>  CFLAGS += $(WERROR_FLAGS)
>  
> -LDLIBS += -lvirt
> +EXTRA_LDLIBS += -lvirt
>  
>  # workaround for a gcc bug with noreturn attribute
>  # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
> index 62a76ae..ed471ad 100644
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -1,7 +1,7 @@
>  #   BSD LICENSE
>  #
> -#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> -#   Copyright(c) 2014 6WIND S.A.
> +#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> +#   Copyright(c) 2015 6WIND S.A.
>  #   All rights reserved.
>  #
>  #   Redistribution and use in source and binary forms, with or without
> @@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
>  endif
>  
>  # default path for libs
> -LDLIBS += -L$(RTE_SDK_BIN)/lib
> +LDLIBS-y = -L$(RTE_SDK_BIN)/lib
>  
>  #
>  # Include libraries depending on config if NO_AUTOLIBS is not set
> @@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
>  #
>  ifeq ($(NO_AUTOLIBS),)
>  
> -LDLIBS += --whole-archive
> +LDLIBS-y += --whole-archive
>  
> -ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
> -LDLIBS += -l$(RTE_LIBNAME)
> -endif
> +LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)
>  
>  ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
>  
> -ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
> -LDLIBS += -lrte_distributor
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
> -LDLIBS += -lrte_reorder
> -endif
> +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
> +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
>  
> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
>  ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
> -LDLIBS += -lrte_kni
> -endif
> +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
> +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem
>  endif
>  
> -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
> -LDLIBS += -lrte_ivshmem
> -endif
> -endif
> +LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
> +LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
> +LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
> +LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
> +LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
> +LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
> +LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
> +LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
> +LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
> +LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter
>  
> -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
> -LDLIBS += -lrte_pipeline
> -endif
> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt
>  
> -ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
> -LDLIBS += -lrte_table
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
> -LDLIBS += -lrte_port
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
> -LDLIBS += -lrte_timer
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
> -LDLIBS += -lrte_hash
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
> -LDLIBS += -lrte_jobstats
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
> -LDLIBS += -lrte_lp

[dpdk-dev] [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Gonzalez Monroy, Sergio
On 29/04/2015 16:00, Wiles, Keith wrote:
>
> On 4/29/15, 9:55 AM, "Gonzalez Monroy, Sergio"
>  wrote:
>
>> On 29/04/2015 15:37, Keith Wiles wrote:
>>> Signed-off-by: Keith Wiles 
>>> ---
>>>doc/build-sdk-quick.txt  | 1 +
>>>doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
>>>doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
>>>3 files changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
>>> index 041a40e..26d5442 100644
>>> --- a/doc/build-sdk-quick.txt
>>> +++ b/doc/build-sdk-quick.txt
>>> @@ -13,6 +13,7 @@ Build variables
>>> EXTRA_CPPFLAGS   preprocessor options
>>> EXTRA_CFLAGS compiler options
>>> EXTRA_LDFLAGSlinker options
>>> +   EXTRA_LDLIBS linker libary options
>>> RTE_KERNELDIRlinux headers path
>>> CROSS toolchain prefix
>>> V verbose
>>> diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst
>>> b/doc/guides/prog_guide/dev_kit_build_system.rst
>>> index cf5c96f..b8ef167 100644
>>> --- a/doc/guides/prog_guide/dev_kit_build_system.rst
>>> +++ b/doc/guides/prog_guide/dev_kit_build_system.rst
>>> @@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in
>>> a Makefile or Command Line
>>>
>>>*   EXTRA_LDFLAGS: The content of this variable is appended after
>>> LDFLAGS when linking.
>>>
>>> +*   EXTRA_LDLIBS: The content of this variable is appended after
>>> LDLIBS when linking.
>>> +
>>>*   EXTRA_ASFLAGS: The content of this variable is appended after
>>> ASFLAGS when assembling.
>>>
>>>*   EXTRA_CPPFLAGS: The content of this variable is appended after
>>> CPPFLAGS when using a C preprocessor on assembly files.
>>> diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst
>>> b/doc/guides/prog_guide/dev_kit_root_make_help.rst
>>> index 4f30192..fdc5fea 100644
>>> --- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
>>> +++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
>>> @@ -205,7 +205,7 @@ The following variables can be specified on the
>>> command line:
>>>
>>>Enable dependency debugging. This provides some useful
>>> information about why a target is built or not.
>>>
>>> -*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
>>> +*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,
>>> EXTRA_CPPFLAGS=
>>>
>>>Append specific compilation, link or asm flags.
>>>
>> Do we need to remove LDLIBS from section 28.3.4?
> Missed it, but it should be LDLIBS-y now
It would still be lost cause you are resetting LDLIBS-y value at the 
start of rte.app.mk, right?
The only way to add to LDLIBS-y would be using EXTRA_LDLIBS.

Sergio
>> With the current patch the value of LDLIBS in the app makefile is lost.
>>
>> Sergio



[dpdk-dev] [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Gonzalez Monroy, Sergio
On 29/04/2015 15:37, Keith Wiles wrote:
> Signed-off-by: Keith Wiles 
> ---
>   doc/build-sdk-quick.txt  | 1 +
>   doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
>   doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
>   3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
> index 041a40e..26d5442 100644
> --- a/doc/build-sdk-quick.txt
> +++ b/doc/build-sdk-quick.txt
> @@ -13,6 +13,7 @@ Build variables
>   EXTRA_CPPFLAGS   preprocessor options
>   EXTRA_CFLAGS compiler options
>   EXTRA_LDFLAGSlinker options
> + EXTRA_LDLIBS linker libary options
>   RTE_KERNELDIRlinux headers path
>   CROSS toolchain prefix
>   V verbose
> diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
> b/doc/guides/prog_guide/dev_kit_build_system.rst
> index cf5c96f..b8ef167 100644
> --- a/doc/guides/prog_guide/dev_kit_build_system.rst
> +++ b/doc/guides/prog_guide/dev_kit_build_system.rst
> @@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
> Makefile or Command Line
>   
>   *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS 
> when linking.
>   
> +*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
> linking.
> +
>   *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS 
> when assembling.
>   
>   *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
> when using a C preprocessor on assembly files.
> diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
> b/doc/guides/prog_guide/dev_kit_root_make_help.rst
> index 4f30192..fdc5fea 100644
> --- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
> +++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
> @@ -205,7 +205,7 @@ The following variables can be specified on the command 
> line:
>   
>   Enable dependency debugging. This provides some useful information 
> about why a target is built or not.
>   
> -*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
> +*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
> EXTRA_CPPFLAGS=
>   
>   Append specific compilation, link or asm flags.
>   
Do we need to remove LDLIBS from section 28.3.4?

With the current patch the value of LDLIBS in the app makefile is lost.

Sergio


[dpdk-dev] [PATCH] doc: disable doxygen member sorting

2015-04-29 Thread Jayakumar, Muthurajan
Thanks for making this.
Acked 

Thanks 
M Jay
http://dpdk.readthedocs.org/en/latest/

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Butler, Siobhan A
Sent: Wednesday, April 29, 2015 6:56 AM
To: Mcnamara, John; dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH] doc: disable doxygen member sorting

Thanks for making this change John - it helps with readability Siobhan 

Acked-by Siobhan Butler 

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mcnamara, John
> Sent: Wednesday, April 29, 2015 11:52 AM
> To: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] doc: disable doxygen member sorting
> 
> > -Original Message-
> > From: Mcnamara, John
> > Sent: Wednesday, April 29, 2015 11:48 AM
> > To: dev at dpdk.org
> > Cc: Mcnamara, John
> > Subject: [PATCH] doc: disable doxygen member sorting
> >
> > Disabled the doxygen option to sort member data so that functions 
> > and struct memebers are listed in order of definition in the brief 
> > and main sections.
> 
> 
> 
> See for example:
> 
> http://dpdk.org/doc/api/structlcore__config.html
> 
> The first listed member is "unsigned detected" but the first 
> documented member is "void* volatile arg".
> 
> John.
> --
> 
> 
> 



[dpdk-dev] [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Wiles, Keith


On 4/29/15, 10:19 AM, "Gonzalez Monroy, Sergio"
 wrote:

>On 29/04/2015 16:16, Wiles, Keith wrote:
>>
>> On 4/29/15, 10:04 AM, "Gonzalez Monroy, Sergio"
>>  wrote:
>>
>>> On 29/04/2015 16:00, Wiles, Keith wrote:
 On 4/29/15, 9:55 AM, "Gonzalez Monroy, Sergio"
  wrote:

> On 29/04/2015 15:37, Keith Wiles wrote:
>> Signed-off-by: Keith Wiles 
>> ---
>> doc/build-sdk-quick.txt  | 1 +
>> doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
>> doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
>> 3 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
>> index 041a40e..26d5442 100644
>> --- a/doc/build-sdk-quick.txt
>> +++ b/doc/build-sdk-quick.txt
>> @@ -13,6 +13,7 @@ Build variables
>>  EXTRA_CPPFLAGS   preprocessor options
>>  EXTRA_CFLAGS compiler options
>>  EXTRA_LDFLAGSlinker options
>> +EXTRA_LDLIBS linker libary options
>>  RTE_KERNELDIRlinux headers path
>>  CROSS toolchain prefix
>>  V verbose
>> diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst
>> b/doc/guides/prog_guide/dev_kit_build_system.rst
>> index cf5c96f..b8ef167 100644
>> --- a/doc/guides/prog_guide/dev_kit_build_system.rst
>> +++ b/doc/guides/prog_guide/dev_kit_build_system.rst
>> @@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User
>> in
>> a Makefile or Command Line
>> 
>> *   EXTRA_LDFLAGS: The content of this variable is appended
>>after
>> LDFLAGS when linking.
>> 
>> +*   EXTRA_LDLIBS: The content of this variable is appended after
>> LDLIBS when linking.
>> +
>> *   EXTRA_ASFLAGS: The content of this variable is appended
>>after
>> ASFLAGS when assembling.
>> 
>> *   EXTRA_CPPFLAGS: The content of this variable is appended
>>after
>> CPPFLAGS when using a C preprocessor on assembly files.
>> diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst
>> b/doc/guides/prog_guide/dev_kit_root_make_help.rst
>> index 4f30192..fdc5fea 100644
>> --- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
>> +++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
>> @@ -205,7 +205,7 @@ The following variables can be specified on the
>> command line:
>> 
>> Enable dependency debugging. This provides some useful
>> information about why a target is built or not.
>> 
>> -*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
>> +*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,
>> EXTRA_CPPFLAGS=
>> 
>> Append specific compilation, link or asm flags.
>> 
> Do we need to remove LDLIBS from section 28.3.4?
 Missed it, but it should be LDLIBS-y now
>>> It would still be lost cause you are resetting LDLIBS-y value at the
>>> start of rte.app.mk, right?
>> Yes, LDLIBS-y is reset at the top, just as LDLIBS was reset in the
>> original rte.app.mk file. I would assume this is the correct design and
>>we
>> should reset LDLIBS-y at the top of the file, right?
>But LDLIBS was not reset pre-patch, was it?
>
>  # default path for libs
>-LDLIBS += -L$(RTE_SDK_BIN)/lib
>+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

OK, version 4 :-( doing to many things this morning.
>  
>
>Sergio
>>> The only way to add to LDLIBS-y would be using EXTRA_LDLIBS.
>>>
>>> Sergio
> With the current patch the value of LDLIBS in the app makefile is
>lost.
>
> Sergio
>



[dpdk-dev] [PATCH] kni: fix compilation issue on kernel 4.0.0

2015-04-29 Thread Thomas Monjalon
2015-04-28 18:37, Pablo de Lara:
> Due to API changes in function pointer ndo_bridge_setlink
> (commit ad41faa8) and the rename of functions vlan_tx_*
> (commit df8a39de) in kernel 4.0, DPDK would not build.
> 
> This patch adds the properly checks to fix the compilation.
> 
> Reported-by: Stephen Hemminger 
> Signed-off-by: Pablo de Lara 

Pablo, I have another error with Linux 3.19 when KNI vhost is enabled:

lib/librte_eal/linuxapp/kni/kni_vhost.c:365:35: error:
?struct msghdr? has no member named ?msg_iov?


[dpdk-dev] Issues with rte_hash_crc.h when compiling with C++

2015-04-29 Thread Pavel Odintsov
Hello!

I have C++ application compiles and works nice. But when I include
rte_hash_crc.h header everything goes away.

  CC main.o
In file included from
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h:46:0,
 from
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_hash_crc.h:48,
 from /root/interceptor/main.cpp:25:
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:50:6:
error: use of enum ?rte_cpu_flag_t? without previous declaration
 enum rte_cpu_flag_t;
  ^
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:55:6:
error: use of enum ?cpu_register_t? without previous declaration
 enum cpu_register_t;
  ^
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:79:35:
error: uninitialized const ?cpu_feature_table? [-fpermissive]
 static const struct feature_entry cpu_feature_table[];
   ^
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:64:8:
note: ?const struct feature_entry? has no user-provided default
constructor
 struct feature_entry {
^
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:65:11:
note: and the implicitly-defined constructor does not initialize
?uint32_t feature_entry::leaf?
  uint32_t leaf;/**< cpuid leaf */
   ^
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:79:53:
error: storage size of ?cpu_feature_table? isn?t known
 static const struct feature_entry cpu_feature_table[];
 ^
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:101:31:
error: use of enum ?rte_cpu_flag_t? without previous declaration
 rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
   ^
In file included from
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_hash_crc.h:48:0,
 from /root/interceptor/main.cpp:25:
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h:
In function ?int rte_cpu_get_flag_enabled(rte_cpu_flag_t)?:
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h:278:53:
error: conflicting declaration of C function ?int
rte_cpu_get_flag_enabled(rte_cpu_flag_t)?
 rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
 ^
In file included from
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h:46:0,
 from
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_hash_crc.h:48,
 from /root/interceptor/main.cpp:25:
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:101:1:
note: previous declaration ?int rte_cpu_get_flag_enabled(int)?
 rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
 ^
/usr/src/dpdk-2.0.0/mk/internal/rte.compile-pre.mk:145: recipe for
target 'main.o' failed
make[1]: *** [main.o] Error 1
/usr/src/dpdk-2.0.0/mk/rte.extapp.mk:42: recipe for target 'all' failed
make: *** [all] Error 2

I prepared my environment with this manual:
http://www.stableit.ru/2015/04/how-to-code-for-dpdk-with-c.html

Could anybody help me with this header file and C++?

-- 
Sincerely yours, Pavel Odintsov


[dpdk-dev] [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Wiles, Keith


On 4/29/15, 10:04 AM, "Gonzalez Monroy, Sergio"
 wrote:

>On 29/04/2015 16:00, Wiles, Keith wrote:
>>
>> On 4/29/15, 9:55 AM, "Gonzalez Monroy, Sergio"
>>  wrote:
>>
>>> On 29/04/2015 15:37, Keith Wiles wrote:
 Signed-off-by: Keith Wiles 
 ---
doc/build-sdk-quick.txt  | 1 +
doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)

 diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
 index 041a40e..26d5442 100644
 --- a/doc/build-sdk-quick.txt
 +++ b/doc/build-sdk-quick.txt
 @@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
 +  EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
 diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst
 b/doc/guides/prog_guide/dev_kit_build_system.rst
 index cf5c96f..b8ef167 100644
 --- a/doc/guides/prog_guide/dev_kit_build_system.rst
 +++ b/doc/guides/prog_guide/dev_kit_build_system.rst
 @@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User
in
 a Makefile or Command Line

*   EXTRA_LDFLAGS: The content of this variable is appended after
 LDFLAGS when linking.

 +*   EXTRA_LDLIBS: The content of this variable is appended after
 LDLIBS when linking.
 +
*   EXTRA_ASFLAGS: The content of this variable is appended after
 ASFLAGS when assembling.

*   EXTRA_CPPFLAGS: The content of this variable is appended after
 CPPFLAGS when using a C preprocessor on assembly files.
 diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst
 b/doc/guides/prog_guide/dev_kit_root_make_help.rst
 index 4f30192..fdc5fea 100644
 --- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
 +++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
 @@ -205,7 +205,7 @@ The following variables can be specified on the
 command line:

Enable dependency debugging. This provides some useful
 information about why a target is built or not.

 -*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
 +*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,
 EXTRA_CPPFLAGS=

Append specific compilation, link or asm flags.

>>> Do we need to remove LDLIBS from section 28.3.4?
>> Missed it, but it should be LDLIBS-y now
>It would still be lost cause you are resetting LDLIBS-y value at the
>start of rte.app.mk, right?

Yes, LDLIBS-y is reset at the top, just as LDLIBS was reset in the
original rte.app.mk file. I would assume this is the correct design and we
should reset LDLIBS-y at the top of the file, right?

>The only way to add to LDLIBS-y would be using EXTRA_LDLIBS.
>
>Sergio
>>> With the current patch the value of LDLIBS in the app makefile is lost.
>>>
>>> Sergio
>



[dpdk-dev] [PATCH v2 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Wiles, Keith


On 4/29/15, 10:11 AM, "Richardson, Bruce" 
wrote:

>On Wed, Apr 29, 2015 at 09:37:42AM -0500, Keith Wiles wrote:
>> Trying to simplify the ifdefs in rte.app.mk to make the code
>> more readable and maintainable by moving LDLIBS variable to use
>> the same style as LDLIBS-y being used in the rest of the code.
>> 
>> Added a new variable called EXTRA_LDLIBS to be used by example apps
>> instead of using LDLIBS directly.
>> 
>> Signed-off-by: Keith Wiles 
>
>Since EXTRA_* flags are designed that they can be overridden on the
>makefile,
>what happens if someone does a compile via: "EXTRA_LDLIBS=X make"? Does
>the 
>compile/link still work?

The code in rte.app.mk adds the EXTRA_LDLIBS to the end of LDLIBS-y
>
>/Bruce
>
>
>> ---
>>  examples/dpdk_qat/Makefile |   4 +-
>>  examples/vm_power_manager/Makefile |   2 +-
>>  mk/rte.app.mk  | 254
>>++---
>>  mk/rte.hostapp.mk  |   4 +-
>>  mk/rte.shared.mk   |  12 +-
>>  5 files changed, 77 insertions(+), 199 deletions(-)
>> 
>> diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
>> index f1e06a1..90ca1d3 100644
>> --- a/examples/dpdk_qat/Makefile
>> +++ b/examples/dpdk_qat/Makefile
>> @@ -77,8 +77,8 @@ else
>>  ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
>>  endif
>>  
>> -LDLIBS += -L$(ICP_ROOT)/build
>> -LDLIBS += $(ICP_LIBRARY_PATH) \
>> +EXTRA_LDLIBS += -L$(ICP_ROOT)/build
>> +EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
>>  -lz \
>>  -losal \
>>  -ladf_proxy \
>> diff --git a/examples/vm_power_manager/Makefile
>>b/examples/vm_power_manager/Makefile
>> index 113dbc4..8fb78d4 100644
>> --- a/examples/vm_power_manager/Makefile
>> +++ b/examples/vm_power_manager/Makefile
>> @@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
>>  CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
>>  CFLAGS += $(WERROR_FLAGS)
>>  
>> -LDLIBS += -lvirt
>> +EXTRA_LDLIBS += -lvirt
>>  
>>  # workaround for a gcc bug with noreturn attribute
>>  # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
>> index 62a76ae..ed471ad 100644
>> --- a/mk/rte.app.mk
>> +++ b/mk/rte.app.mk
>> @@ -1,7 +1,7 @@
>>  #   BSD LICENSE
>>  #
>> -#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
>> -#   Copyright(c) 2014 6WIND S.A.
>> +#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
>> +#   Copyright(c) 2015 6WIND S.A.
>>  #   All rights reserved.
>>  #
>>  #   Redistribution and use in source and binary forms, with or without
>> @@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
>>  endif
>>  
>>  # default path for libs
>> -LDLIBS += -L$(RTE_SDK_BIN)/lib
>> +LDLIBS-y = -L$(RTE_SDK_BIN)/lib
>>  
>>  #
>>  # Include libraries depending on config if NO_AUTOLIBS is not set
>> @@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
>>  #
>>  ifeq ($(NO_AUTOLIBS),)
>>  
>> -LDLIBS += --whole-archive
>> +LDLIBS-y += --whole-archive
>>  
>> -ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
>> -LDLIBS += -l$(RTE_LIBNAME)
>> -endif
>> +LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)
>>  
>>  ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
>>  
>> -ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
>> -LDLIBS += -lrte_distributor
>> -endif
>> -
>> -ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
>> -LDLIBS += -lrte_reorder
>> -endif
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
>>  
>> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
>>  ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
>> -LDLIBS += -lrte_kni
>> -endif
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem
>>  endif
>>  
>> -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
>> -LDLIBS += -lrte_ivshmem
>> -endif
>> -endif
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter
>>  
>> -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
>> -LDLIBS += -lrte_pipeline
>> -endif
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt
>>  
>> -ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
>> -LDLIBS += -lrte_table
>> -endif
>> -
>> -ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
>> -LDLIBS += -lrte_port
>> -endif
>> -
>> -ifeq ($(CONFIG_RTE_LIBRTE_TI

[dpdk-dev] [PATCH] vhost: make vhost lockless enqueue configurable

2015-04-29 Thread Flavio Leitner
On Wed, 29 Apr 2015 13:56:58 +0200
Thomas Monjalon  wrote:

> 2015-04-29 13:38 GMT+02:00 Panu Matilainen :
> > On 04/29/2015 02:29 PM, Huawei Xie wrote:
> >>
> >> vhost enabled vSwitch could have their own thread-safe vring
> >> enqueue policy.
> >> Add the RTE_LIBRTE_VHOST_LOCKLESS_ENQ macro for vhost lockless
> >> enqueue. Turn it off by default.
> >>
> >> Signed-off-by: Huawei Xie 
> >> ---
> >>   config/common_linuxapp|  1 +
> >>   lib/librte_vhost/vhost_rxtx.c | 24 +++-
> >>   2 files changed, 24 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/config/common_linuxapp b/config/common_linuxapp
> >> index 0078dc9..7f59499 100644
> >> --- a/config/common_linuxapp
> >> +++ b/config/common_linuxapp
> >> @@ -421,6 +421,7 @@ CONFIG_RTE_KNI_VHOST_DEBUG_TX=n
> >>   #
> >>   CONFIG_RTE_LIBRTE_VHOST=n
> >>   CONFIG_RTE_LIBRTE_VHOST_USER=y
> >> +CONFIG_RTE_LIBRTE_VHOST_LOCKLESS_ENQ=n
> >>   CONFIG_RTE_LIBRTE_VHOST_DEBUG=n
> [...]
> >
> > These things should be runtime configurable, not build options.
> > Please do not assume everybody builds DPDK separately for each and
> > every application that might ever be.
> 
> +1
> Adding new build options must be exceptions and very well justified.

+1, that's specially hard when dpdk is packaged and distributed on
distros like Fedora/RHEL.

fbl




[dpdk-dev] [PATCH] kni: fix compilation issue on kernel 4.0.0

2015-04-29 Thread De Lara Guarch, Pablo
Hi Thomas,

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Wednesday, April 29, 2015 2:20 PM
> To: De Lara Guarch, Pablo
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 4.0.0
> 
> 2015-04-28 18:37, Pablo de Lara:
> > Due to API changes in function pointer ndo_bridge_setlink
> > (commit ad41faa8) and the rename of functions vlan_tx_*
> > (commit df8a39de) in kernel 4.0, DPDK would not build.
> >
> > This patch adds the properly checks to fix the compilation.
> >
> > Reported-by: Stephen Hemminger 
> > Signed-off-by: Pablo de Lara 
> 
> Pablo, I have another error with Linux 3.19 when KNI vhost is enabled:
> 
> lib/librte_eal/linuxapp/kni/kni_vhost.c:365:35: error:
> ?struct msghdr? has no member named ?msg_iov?

Thanks for reporting, I didn't see that. I will send a patch for that as soon 
as I can.

Pablo



[dpdk-dev] [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Wiles, Keith


On 4/29/15, 9:55 AM, "Gonzalez Monroy, Sergio"
 wrote:

>On 29/04/2015 15:37, Keith Wiles wrote:
>> Signed-off-by: Keith Wiles 
>> ---
>>   doc/build-sdk-quick.txt  | 1 +
>>   doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
>>   doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
>>   3 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
>> index 041a40e..26d5442 100644
>> --- a/doc/build-sdk-quick.txt
>> +++ b/doc/build-sdk-quick.txt
>> @@ -13,6 +13,7 @@ Build variables
>>  EXTRA_CPPFLAGS   preprocessor options
>>  EXTRA_CFLAGS compiler options
>>  EXTRA_LDFLAGSlinker options
>> +EXTRA_LDLIBS linker libary options
>>  RTE_KERNELDIRlinux headers path
>>  CROSS toolchain prefix
>>  V verbose
>> diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst
>>b/doc/guides/prog_guide/dev_kit_build_system.rst
>> index cf5c96f..b8ef167 100644
>> --- a/doc/guides/prog_guide/dev_kit_build_system.rst
>> +++ b/doc/guides/prog_guide/dev_kit_build_system.rst
>> @@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in
>>a Makefile or Command Line
>>   
>>   *   EXTRA_LDFLAGS: The content of this variable is appended after
>>LDFLAGS when linking.
>>   
>> +*   EXTRA_LDLIBS: The content of this variable is appended after
>>LDLIBS when linking.
>> +
>>   *   EXTRA_ASFLAGS: The content of this variable is appended after
>>ASFLAGS when assembling.
>>   
>>   *   EXTRA_CPPFLAGS: The content of this variable is appended after
>>CPPFLAGS when using a C preprocessor on assembly files.
>> diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst
>>b/doc/guides/prog_guide/dev_kit_root_make_help.rst
>> index 4f30192..fdc5fea 100644
>> --- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
>> +++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
>> @@ -205,7 +205,7 @@ The following variables can be specified on the
>>command line:
>>   
>>   Enable dependency debugging. This provides some useful
>>information about why a target is built or not.
>>   
>> -*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
>> +*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,
>>EXTRA_CPPFLAGS=
>>   
>>   Append specific compilation, link or asm flags.
>>   
>Do we need to remove LDLIBS from section 28.3.4?

Missed it, but it should be LDLIBS-y now
>
>With the current patch the value of LDLIBS in the app makefile is lost.
>
>Sergio



[dpdk-dev] [PATCH] vhost: make vhost lockless enqueue configurable

2015-04-29 Thread Panu Matilainen
On 04/29/2015 02:29 PM, Huawei Xie wrote:
> vhost enabled vSwitch could have their own thread-safe vring enqueue policy.
> Add the RTE_LIBRTE_VHOST_LOCKLESS_ENQ macro for vhost lockless enqueue.
> Turn it off by default.
>
> Signed-off-by: Huawei Xie 
> ---
>   config/common_linuxapp|  1 +
>   lib/librte_vhost/vhost_rxtx.c | 24 +++-
>   2 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/config/common_linuxapp b/config/common_linuxapp
> index 0078dc9..7f59499 100644
> --- a/config/common_linuxapp
> +++ b/config/common_linuxapp
> @@ -421,6 +421,7 @@ CONFIG_RTE_KNI_VHOST_DEBUG_TX=n
>   #
>   CONFIG_RTE_LIBRTE_VHOST=n
>   CONFIG_RTE_LIBRTE_VHOST_USER=y
> +CONFIG_RTE_LIBRTE_VHOST_LOCKLESS_ENQ=n
>   CONFIG_RTE_LIBRTE_VHOST_DEBUG=n
>
>   #
> diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
> index 510ffe8..475be6e 100644
> --- a/lib/librte_vhost/vhost_rxtx.c
> +++ b/lib/librte_vhost/vhost_rxtx.c
> @@ -80,7 +80,11 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
>* they need to be reserved.
>*/
>   do {
> +#ifdef RTE_LIBRTE_VHOST_LOCKESS_ENQ
>   res_base_idx = vq->last_used_idx_res;
> +#else
> + res_base_idx = vq->last_used_idx;
> +#endif

These things should be runtime configurable, not build options. Please 
do not assume everybody builds DPDK separately for each and every 
application that might ever be.

- Panu -


[dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Wiles, Keith


On 4/29/15, 9:09 AM, "Wiles, Keith"  wrote:

>
>
>On 4/29/15, 3:04 AM, "Gonzalez Monroy, Sergio"
> wrote:
>
>>On 28/04/2015 17:50, Wiles, Keith wrote:
>>> Hi Sergio
>>>
>>> On 4/28/15, 11:25 AM, "Gonzalez Monroy, Sergio"
>>>  wrote:
>>>
 On 28/04/2015 16:21, Keith Wiles wrote:
> Trying to simplify the ifdefs in rte.app.mk to make the code
> more readable and maintainable by moving LDLIBS variable to use
> the same style as LDLIBS-y being used in the rest of the code.
>
> Signed-off-by: Keith Wiles 
> ---
 +1

 Patch looks good, just a few nits:
>mk/rte.app.mk | 253
> ++
>mk/rte.hostapp.mk |   4 +-
>mk/rte.shared.mk  |  12 +--
>3 files changed, 74 insertions(+), 195 deletions(-)
>
> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
> index 62a76ae..af38975 100644
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -1,7 +1,7 @@
>#   BSD LICENSE
>#
> -#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> -#   Copyright(c) 2014 6WIND S.A.
> +#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> +#   Copyright(c) 2015 6WIND S.A.
>#   All rights reserved.
>#
>#   Redistribution and use in source and binary forms, with or
>without
> @@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
>endif
>
># default path for libs
> -LDLIBS += -L$(RTE_SDK_BIN)/lib
> +LDLIBS-y = -L$(RTE_SDK_BIN)/lib
>
 I think we should keep the current value of LDLIBS.
 Some apps (ie. examples/dpdk_qat ) preset LDLIBS before including
 rte.app.mk.
>>> I just modified the example apps to use a new VARIABLE called
>>>EXTRA_LDLIBS
>>> instead and added it towards the bottom of rte.app.mk. I think adding
>>>the
>>> EXTRA_LDLIBS is the right solution instead of using LDLIBS IMO.
>>Fair enough :)
>>
>>I suppose is semantics, and I may be wrong here, but my understanding
>>was that EXTRA_ vars were to be used from the command line to pass
>>additional flags and/or override certain default flags, and that
>>CFLAGS/LDFLAGS/LDLIBS were used from each app/example makefile to
>>specify their own flags.
>>
>>IMO we could achieve the correct order (ie. example/app
>>CFLAGS/LDFLAGS/LDLIBS being added at the end to override default flags)
>>without using EXTRA_ vars from makefiles. Regarding this patch it
>>would be pretty simple by just adding LDLIBS at the end of LDLIBS-y.
>
>Does anyone else have an opinion about EXTRA_XXX?
>
>I just did not realize the EXTRA_XXX was only for command line, personally
>I would have preferred keeping .mk internal variables internal and have
>external variables to augment the internal variables instead of using the
>internal ones in the Makefiles. Someone could abuse the internal
>variables.
>
>Using the EXTRA_XXX with a ?+=? should be reasonable, correct?
>
>Let me know which way I need to update the patch.

Bruce just pointed to the following
http://dpdk.org/doc/guides/prog_guide/dev_kit_build_system.html session
28.3.6

It states the EXTRA_XXX can be used on command line or Makefiles.

Then I just need to send my patch with the corrected version number,
correct?
>
>Regards,
>++Keith
>>
>>Sergio
>#
># Include libraries depending on config if NO_AUTOLIBS is not set
> @@ -59,215 +59,94 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
>#
>ifeq ($(NO_AUTOLIBS),)
>
> -LDLIBS += --whole-archive
> +LDLIBS-y += --whole-archive
>
> -ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
> -LDLIBS += -l$(RTE_LIBNAME)
> -endif
> +LDLIBS-CONFIG_RTE_BUILD_COMBINE_LIBS)+= -l$(RTE_LIBNAME)
>
 I think here is missing $( before CONFIG.
>>> Ooops :-)
>ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
>
> -ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
> -LDLIBS += -lrte_distributor
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
> -LDLIBS += -lrte_reorder
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
> -LDLIBS += -lrte_kni
> -endif
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
> -LDLIBS += -lrte_ivshmem
> -endif
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
> -LDLIBS += -lrte_pipeline
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
> -LDLIBS += -lrte_table
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
> -LDLIBS += -lrte_port
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
> -LDLIBS += -lrte_timer
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
> -LDLIBS += -lrte_hash
> -endif
> -
> -ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
> -LDLIBS += -lrte_jobstats
> -endif
> -
> -ifeq ($(C

[dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Wiles, Keith


On 4/29/15, 3:04 AM, "Gonzalez Monroy, Sergio"
 wrote:

>On 28/04/2015 17:50, Wiles, Keith wrote:
>> Hi Sergio
>>
>> On 4/28/15, 11:25 AM, "Gonzalez Monroy, Sergio"
>>  wrote:
>>
>>> On 28/04/2015 16:21, Keith Wiles wrote:
 Trying to simplify the ifdefs in rte.app.mk to make the code
 more readable and maintainable by moving LDLIBS variable to use
 the same style as LDLIBS-y being used in the rest of the code.

 Signed-off-by: Keith Wiles 
 ---
>>> +1
>>>
>>> Patch looks good, just a few nits:
mk/rte.app.mk | 253
 ++
mk/rte.hostapp.mk |   4 +-
mk/rte.shared.mk  |  12 +--
3 files changed, 74 insertions(+), 195 deletions(-)

 diff --git a/mk/rte.app.mk b/mk/rte.app.mk
 index 62a76ae..af38975 100644
 --- a/mk/rte.app.mk
 +++ b/mk/rte.app.mk
 @@ -1,7 +1,7 @@
#   BSD LICENSE
#
 -#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
 -#   Copyright(c) 2014 6WIND S.A.
 +#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 +#   Copyright(c) 2015 6WIND S.A.
#   All rights reserved.
#
#   Redistribution and use in source and binary forms, with or
without
 @@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
endif

# default path for libs
 -LDLIBS += -L$(RTE_SDK_BIN)/lib
 +LDLIBS-y = -L$(RTE_SDK_BIN)/lib

>>> I think we should keep the current value of LDLIBS.
>>> Some apps (ie. examples/dpdk_qat ) preset LDLIBS before including
>>> rte.app.mk.
>> I just modified the example apps to use a new VARIABLE called
>>EXTRA_LDLIBS
>> instead and added it towards the bottom of rte.app.mk. I think adding
>>the
>> EXTRA_LDLIBS is the right solution instead of using LDLIBS IMO.
>Fair enough :)
>
>I suppose is semantics, and I may be wrong here, but my understanding
>was that EXTRA_ vars were to be used from the command line to pass
>additional flags and/or override certain default flags, and that
>CFLAGS/LDFLAGS/LDLIBS were used from each app/example makefile to
>specify their own flags.
>
>IMO we could achieve the correct order (ie. example/app
>CFLAGS/LDFLAGS/LDLIBS being added at the end to override default flags)
>without using EXTRA_ vars from makefiles. Regarding this patch it
>would be pretty simple by just adding LDLIBS at the end of LDLIBS-y.

Does anyone else have an opinion about EXTRA_XXX?

I just did not realize the EXTRA_XXX was only for command line, personally
I would have preferred keeping .mk internal variables internal and have
external variables to augment the internal variables instead of using the
internal ones in the Makefiles. Someone could abuse the internal variables.

Using the EXTRA_XXX with a ?+=? should be reasonable, correct?

Let me know which way I need to update the patch.

Regards,
++Keith
>
>Sergio
#
# Include libraries depending on config if NO_AUTOLIBS is not set
 @@ -59,215 +59,94 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
#
ifeq ($(NO_AUTOLIBS),)

 -LDLIBS += --whole-archive
 +LDLIBS-y += --whole-archive

 -ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
 -LDLIBS += -l$(RTE_LIBNAME)
 -endif
 +LDLIBS-CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)

>>> I think here is missing $( before CONFIG.
>> Ooops :-)
ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

 -ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
 -LDLIBS += -lrte_distributor
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
 -LDLIBS += -lrte_reorder
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 -LDLIBS += -lrte_kni
 -endif
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
 -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 -LDLIBS += -lrte_ivshmem
 -endif
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
 -LDLIBS += -lrte_pipeline
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
 -LDLIBS += -lrte_table
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
 -LDLIBS += -lrte_port
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
 -LDLIBS += -lrte_timer
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
 -LDLIBS += -lrte_hash
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
 -LDLIBS += -lrte_jobstats
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
 -LDLIBS += -lrte_lpm
 -endif
 -
 -ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
 -LDLIBS += -lrte_power
 -endif
 +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)   += -lrte_distributor
 +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)   += -lrte_reorder

 -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
 -LDLIBS += -lrte_acl
 +ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 +LDLIBS-$(CONFIG_RT

[dpdk-dev] [PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Wiles, Keith


On 4/29/15, 6:51 AM, "Thomas Monjalon"  wrote:

>2015-04-29 13:08 GMT+02:00 Gonzalez Monroy, Sergio
>:
>> On 29/04/2015 11:12, Thomas Monjalon wrote:
>>> It seems this is the second version of your patch.
>>> Please add v2 prefix and a changelog to ease review and
>>> patch management.
>>> As you probably know, it is explained here:
>>>  http://dpdk.org/dev#send
>>
>> Hi Thomas,
>>
>> Just to clarify as I tend to use RFC PATCH as well, do we still mark it
>>as
>> v2 even though the first patch was an RFC PATCH?
>
>Yes it's clearer to include RFC PATCH in versioning.
>RFC is only a keyword to highlight the desire of debating and/or
>improving with review comments.
>So I think RFC patch should be considered as the number one. Adding v1
>is possible.

OK, will send a new patch with the correct version.
>



[dpdk-dev] [PATCH] vhost: make vhost lockless enqueue configurable

2015-04-29 Thread Thomas Monjalon
2015-04-29 13:38 GMT+02:00 Panu Matilainen :
> On 04/29/2015 02:29 PM, Huawei Xie wrote:
>>
>> vhost enabled vSwitch could have their own thread-safe vring enqueue
>> policy.
>> Add the RTE_LIBRTE_VHOST_LOCKLESS_ENQ macro for vhost lockless enqueue.
>> Turn it off by default.
>>
>> Signed-off-by: Huawei Xie 
>> ---
>>   config/common_linuxapp|  1 +
>>   lib/librte_vhost/vhost_rxtx.c | 24 +++-
>>   2 files changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git a/config/common_linuxapp b/config/common_linuxapp
>> index 0078dc9..7f59499 100644
>> --- a/config/common_linuxapp
>> +++ b/config/common_linuxapp
>> @@ -421,6 +421,7 @@ CONFIG_RTE_KNI_VHOST_DEBUG_TX=n
>>   #
>>   CONFIG_RTE_LIBRTE_VHOST=n
>>   CONFIG_RTE_LIBRTE_VHOST_USER=y
>> +CONFIG_RTE_LIBRTE_VHOST_LOCKLESS_ENQ=n
>>   CONFIG_RTE_LIBRTE_VHOST_DEBUG=n
[...]
>
> These things should be runtime configurable, not build options. Please do
> not assume everybody builds DPDK separately for each and every application
> that might ever be.

+1
Adding new build options must be exceptions and very well justified.


[dpdk-dev] [PATCH] doc: disable doxygen member sorting

2015-04-29 Thread Butler, Siobhan A
Thanks for making this change John - it helps with readability
Siobhan 

Acked-by Siobhan Butler 

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mcnamara, John
> Sent: Wednesday, April 29, 2015 11:52 AM
> To: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] doc: disable doxygen member sorting
> 
> > -Original Message-
> > From: Mcnamara, John
> > Sent: Wednesday, April 29, 2015 11:48 AM
> > To: dev at dpdk.org
> > Cc: Mcnamara, John
> > Subject: [PATCH] doc: disable doxygen member sorting
> >
> > Disabled the doxygen option to sort member data so that functions and
> > struct memebers are listed in order of definition in the brief and
> > main sections.
> 
> 
> 
> See for example:
> 
> http://dpdk.org/doc/api/structlcore__config.html
> 
> The first listed member is "unsigned detected" but the first documented
> member is "void* volatile arg".
> 
> John.
> --
> 
> 
> 



[dpdk-dev] [PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Thomas Monjalon
2015-04-29 13:08 GMT+02:00 Gonzalez Monroy, Sergio
:
> On 29/04/2015 11:12, Thomas Monjalon wrote:
>> It seems this is the second version of your patch.
>> Please add v2 prefix and a changelog to ease review and
>> patch management.
>> As you probably know, it is explained here:
>>  http://dpdk.org/dev#send
>
> Hi Thomas,
>
> Just to clarify as I tend to use RFC PATCH as well, do we still mark it as
> v2 even though the first patch was an RFC PATCH?

Yes it's clearer to include RFC PATCH in versioning.
RFC is only a keyword to highlight the desire of debating and/or
improving with review comments.
So I think RFC patch should be considered as the number one. Adding v1
is possible.


[dpdk-dev] [PATCH] test-pmd fix default mbuf size

2015-04-29 Thread Olivier MATZ
Hi Konstantin,

On 04/29/2015 12:39 PM, Ananyev, Konstantin wrote:
> Hi Olivier,
>
>> -Original Message-
>> From: Olivier MATZ [mailto:olivier.matz at 6wind.com]
>> Sent: Wednesday, April 29, 2015 10:55 AM
>> To: Ananyev, Konstantin; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] test-pmd fix default mbuf size
>>
>> Hi Konstantin,
>>
>> On 04/28/2015 03:02 PM, Konstantin Ananyev wrote:
>>> Latest mbuf changes (priv_size addition and related fixes)
>>> exposed small problem with testpmd default config:
>>> testpmd default mbuf size is exaclty 2KB, that causes
>>> ixgbe PMD to select scattered RX even for configs with 'normal'
>>> max packet length (max_rx_pkt_len == ETHER_MAX_LEN).
>>>
>>> Signed-off-by: Konstantin Ananyev 
>>> ---
>>>app/test-pmd/testpmd.h | 3 ++-
>>>1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>>> index 389fc24..037e7ec 100644
>>> --- a/app/test-pmd/testpmd.h
>>> +++ b/app/test-pmd/testpmd.h
>>> @@ -48,7 +48,8 @@
>>> * Default size of the mbuf data buffer to receive standard 1518-byte
>>> * Ethernet frames in a mono-segment memory buffer.
>>> */
>>> -#define DEFAULT_MBUF_DATA_SIZE 2048 /**< Default size of mbuf data buffer. 
>>> */
>>> +#define DEFAULT_MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
>>> +/**< Default size of mbuf data buffer. */
>>>
>>>/*
>>> * The maximum number of segments per packet is used when creating
>>>
>>
>> Indeed, this regression is introduced by one of my recent
>> patch:
>> http://dpdk.org/browse/dpdk/commit/?id=dfb03bbe2b39156f0e42e7f29e09c1e6b6def265
>>
>> Before, m->buf_len was initialized to RTE_PKTMBUF_HEADROOM + 2048.
>> Now it is set to 2048.
>>
>> Maybe a line like this should be added in the commit log:
>> Fixes: dfb03bbe2b ("app/testpmd: use standard functions to initialize
>> mbufs and mbuf pool")
>>
>> Just one question Konstantin: could you just confirm that the
>> reason of the bug? From what I understand:
>> - buf_len is 2048
>> - the rx data size when receiving a packet is 2048 - hdroom = 1920
>> - at init, the ixgbe driver configures the hw to set the max rx
>> data size, but it has to be a power of 2, so 1024 is chosen
>
> At ixgbe_dev_rx_init(), we need to setup  SRRCTL[rqx_id]. BSIZEPACKET value:
>
> "BSIZEPACKET 4:0 0x2 Receive Buffer Size for Packet Buffer.
> The value is in 1 KB resolution. Value can be from 1 KB to 16 KB. Default 
> buffer size is
> 2 KB. This field should not be set to 0x0. This field should be greater or 
> equal to 0x2
> in queues where RSC is enabled."
>
> As it is it in 1KB units, our 1920 B are rounded down to 1K, and we have to 
> enable scatter RX mode.
>
> As I understand, same story for igb devices.
> I40e seems doesn't have such limitation.
>
>> - then the initialization code check if a packet of ETHER_MAX_LEN
>> fits in max rx size, and if not, it selects the scatter mode.
>>
>> It makes me wondering 2 things:
>> - should we add a comment in the test-pmd to explain that? (maybe
>> not, as it is driver-specific, and it is just an optimization)
>
> Might be, or probably somewhere to the docs?
>
>> - should we check the other examples to see if the same problem
>> exists?
>
> Good point.
> I did a quick check, and yes it seems few other sample apps are also affected:
>
> examples/qos_sched/main.h:#define MBUF_DATA_SIZE (1528 + RTE_PKTMBUF_HEADROOM)
> examples/skeleton/basicfwd.c:#define MBUF_DATA_SIZE (1600 + 
> RTE_PKTMBUF_HEADROOM)
> examples/packet_ordering/main.c:#define MBUF_DATA_SIZE (1600 + 
> RTE_PKTMBUF_HEADROOM)
> examples/rxtx_callbacks/main.c:#define MBUF_DATA_SIZE (1600 + 
> RTE_PKTMBUF_HEADROOM)
>
> I suppose, have to make v2 to include all of the above...
> What probably is more beneficial  - inside rte_mbuf.h:
>
> #define RTE_MBUF_DEFAULT_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
>
> With some good comments for it, and make all appropriate examples to use it.
> Again, then it would appear in the API reference automatically.
> Konstantin

Yes, good idea, it would solve the doc issue and it factorizes the
default mbuf data size somewhere.

Regards,
Olivier





>
>>
>> If my understanding is correct,
>> Acked-by: Olivier Matz 
>>
>> Regards,
>> Olivier
>



[dpdk-dev] [PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Thomas Monjalon
Hi Keith,

Thanks for trying to improve maintainability.

It seems this is the second version of your patch.
Please add v2 prefix and a changelog to ease review and
patch management.
As you probably know, it is explained here:
http://dpdk.org/dev#send

2015-04-28 19:03 GMT+02:00 Keith Wiles :
> Trying to simplify the ifdefs in rte.app.mk to make the code
> more readable and maintainable by moving LDLIBS variable to use
> the same style as LDLIBS-y being used in the rest of the code.
>
> Added a new variable called EXTRA_LDLIBS to be used by example apps
> instead of using LDLIBS directly.
>
> Signed-off-by: Keith Wiles 


[dpdk-dev] [PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Gonzalez Monroy, Sergio
On 29/04/2015 11:12, Thomas Monjalon wrote:
> Hi Keith,
>
> Thanks for trying to improve maintainability.
>
> It seems this is the second version of your patch.
> Please add v2 prefix and a changelog to ease review and
> patch management.
> As you probably know, it is explained here:
>  http://dpdk.org/dev#send
Hi Thomas,

Just to clarify as I tend to use RFC PATCH as well, do we still mark it 
as v2 even though the first patch was an RFC PATCH?

Sergio
> 2015-04-28 19:03 GMT+02:00 Keith Wiles :
>> Trying to simplify the ifdefs in rte.app.mk to make the code
>> more readable and maintainable by moving LDLIBS variable to use
>> the same style as LDLIBS-y being used in the rest of the code.
>>
>> Added a new variable called EXTRA_LDLIBS to be used by example apps
>> instead of using LDLIBS directly.
>>
>> Signed-off-by: Keith Wiles 



[dpdk-dev] [PATCH] test-pmd fix default mbuf size

2015-04-29 Thread Olivier MATZ
Hi Konstantin,

On 04/28/2015 03:02 PM, Konstantin Ananyev wrote:
> Latest mbuf changes (priv_size addition and related fixes)
> exposed small problem with testpmd default config:
> testpmd default mbuf size is exaclty 2KB, that causes
> ixgbe PMD to select scattered RX even for configs with 'normal'
> max packet length (max_rx_pkt_len == ETHER_MAX_LEN).
>
> Signed-off-by: Konstantin Ananyev 
> ---
>   app/test-pmd/testpmd.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 389fc24..037e7ec 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -48,7 +48,8 @@
>* Default size of the mbuf data buffer to receive standard 1518-byte
>* Ethernet frames in a mono-segment memory buffer.
>*/
> -#define DEFAULT_MBUF_DATA_SIZE 2048 /**< Default size of mbuf data buffer. */
> +#define DEFAULT_MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
> +/**< Default size of mbuf data buffer. */
>
>   /*
>* The maximum number of segments per packet is used when creating
>

Indeed, this regression is introduced by one of my recent
patch: 
http://dpdk.org/browse/dpdk/commit/?id=dfb03bbe2b39156f0e42e7f29e09c1e6b6def265

Before, m->buf_len was initialized to RTE_PKTMBUF_HEADROOM + 2048.
Now it is set to 2048.

Maybe a line like this should be added in the commit log:
Fixes: dfb03bbe2b ("app/testpmd: use standard functions to initialize 
mbufs and mbuf pool")

Just one question Konstantin: could you just confirm that the
reason of the bug? From what I understand:
- buf_len is 2048
- the rx data size when receiving a packet is 2048 - hdroom = 1920
- at init, the ixgbe driver configures the hw to set the max rx
   data size, but it has to be a power of 2, so 1024 is chosen
- then the initialization code check if a packet of ETHER_MAX_LEN
   fits in max rx size, and if not, it selects the scatter mode.

It makes me wondering 2 things:
- should we add a comment in the test-pmd to explain that? (maybe
   not, as it is driver-specific, and it is just an optimization)
- should we check the other examples to see if the same problem
   exists?

If my understanding is correct,
Acked-by: Olivier Matz 

Regards,
Olivier



[dpdk-dev] [PATCH] doc: disable doxygen member sorting

2015-04-29 Thread John McNamara
Disabled the doxygen option to sort member data so that functions
and struct memebers are listed in order of definition in the
brief and main sections.

Previously they were sorted in the brief section and were in
definition order in the main section.

Signed-off-by: John McNamara 
---
 doc/api/doxy-api.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf
index da03e9b..50d2c15 100644
--- a/doc/api/doxy-api.conf
+++ b/doc/api/doxy-api.conf
@@ -77,3 +77,4 @@ ALPHABETICAL_INDEX  = NO
 HTML_TIMESTAMP  = NO
 HTML_DYNAMIC_SECTIONS   = YES
 SEARCHENGINE= NO
+SORT_MEMBER_DOCS= NO
-- 
1.8.1.4



[dpdk-dev] [PATCH v2 5/5] ixgbe: Add support for scattered Rx with bulk allocation.

2015-04-29 Thread Vlad Zolotarov
Simply initialze rx_pkt_burst callback to ixgbe_recv_pkts_lro_bulk_alloc() if
the conditions are right.

This is possible because work against HW in LRO and scattered cases is exactly 
the same
and LRO callback already supports the bulk allocation.

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

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 1766c1a..63284c9 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3780,6 +3780,11 @@ void ixgbe_set_rx_function(struct rte_eth_dev *dev)
 dev->data->port_id);

dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec;
+   } else if (adapter->rx_bulk_alloc_allowed) {
+   PMD_INIT_LOG(INFO, "Using a Scattered with bulk "
+  "allocation callback (port=%d).",
+dev->data->port_id);
+   dev->rx_pkt_burst = ixgbe_recv_pkts_lro_bulk_alloc;
} else {
PMD_INIT_LOG(DEBUG, "Using Regualr (non-vector, "
"single allocation) "
-- 
2.1.0



[dpdk-dev] [PATCH v2 4/5] ixgbe: Kill ixgbe_recv_scattered_pkts()

2015-04-29 Thread Vlad Zolotarov
Kill ixgbe_recv_scattered_pkts() - use ixgbe_recv_pkts_lro_single_alloc()
instead.

Work against HW queues in LRO and scattered Rx cases is exactly the same.
Therefore we may drop the inferior callback.

This patch also changes the sw_rsc_ring allocation in the 
ixgbe_dev_rx_queue_setup() to
always allocate sw_rsc_ring instead of explicitly allocating it in all possible 
cases
when it may be needed: LRO and/or scattered Rx.

This will only impose sizeof(void*) * IXGBE_MAX_RING_DESC = 32KB overhead
per Rx queue as a price for a much simpler code, which seems reasonable.

Signed-off-by: Vlad Zolotarov 
---
New in v2:
   - Always allocate sw_sc_ring.
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   2 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   3 -
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 276 +++-
 3 files changed, 22 insertions(+), 259 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index aec1de9..5f9a1cf 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -986,7 +986,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 * RX function */
if (rte_eal_process_type() != RTE_PROC_PRIMARY){
if (eth_dev->data->scattered_rx)
-   eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+   eth_dev->rx_pkt_burst = 
ixgbe_recv_pkts_lro_single_alloc;
return 0;
}

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index 5b90115..419ea5d 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -352,9 +352,6 @@ void ixgbevf_dev_rxtx_start(struct rte_eth_dev *dev);
 uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_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_single_alloc(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
 uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index b335a57..1766c1a 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1722,239 +1722,6 @@ ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue, struct 
rte_mbuf **rx_pkts,
return ixgbe_recv_pkts_lro(rx_queue, rx_pkts, nb_pkts, true);
 }

-uint16_t
-ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
-{
-   struct ixgbe_rx_queue *rxq;
-   volatile union ixgbe_adv_rx_desc *rx_ring;
-   volatile union ixgbe_adv_rx_desc *rxdp;
-   struct ixgbe_rx_entry *sw_ring;
-   struct ixgbe_rx_entry *rxe;
-   struct rte_mbuf *first_seg;
-   struct rte_mbuf *last_seg;
-   struct rte_mbuf *rxm;
-   struct rte_mbuf *nmb;
-   union ixgbe_adv_rx_desc rxd;
-   uint64_t dma; /* Physical address of mbuf data buffer */
-   uint32_t staterr;
-   uint16_t rx_id;
-   uint16_t nb_rx;
-   uint16_t nb_hold;
-   uint16_t data_len;
-
-   nb_rx = 0;
-   nb_hold = 0;
-   rxq = rx_queue;
-   rx_id = rxq->rx_tail;
-   rx_ring = rxq->rx_ring;
-   sw_ring = rxq->sw_ring;
-
-   /*
-* Retrieve RX context of current packet, if any.
-*/
-   first_seg = rxq->pkt_first_seg;
-   last_seg = rxq->pkt_last_seg;
-
-   while (nb_rx < nb_pkts) {
-   next_desc:
-   /*
-* The order of operations here is important as the DD status
-* bit must not be read after any other descriptor fields.
-* rx_ring and rxdp are pointing to volatile data so the order
-* of accesses cannot be reordered by the compiler. If they were
-* not volatile, they could be reordered which could lead to
-* using invalid descriptor fields when read from rxd.
-*/
-   rxdp = &rx_ring[rx_id];
-   staterr = rxdp->wb.upper.status_error;
-   if (! (staterr & rte_cpu_to_le_32(IXGBE_RXDADV_STAT_DD)))
-   break;
-   rxd = *rxdp;
-
-   /*
-* Descriptor done.
-*
-* Allocate a new mbuf to replenish the RX ring descriptor.
-* If the allocation fails:
-*- arrange for that RX descriptor to be the first one
-*  being parsed the next time the receive function is
-*  invoked [on the same queue].
-*
-*- Stop parsing the RX ring and return immediately.
-*
-* This policy does not drop the packet received in the RX
-* descriptor for which the allocation of a new mbuf failed.
-   

[dpdk-dev] [PATCH v2 3/5] ixgbe: Rename yy_rsc_xx -> yy_sc/scattered_rx_xx

2015-04-29 Thread Vlad Zolotarov
   - ixgbe_rsc_entry -> ixgbe_scattered_rx_entry
   - sw_rsc_ring -> sw_sc_ring
   - ixgbe_free_rsc_cluster() -> ixgbe_free_sc_cluster()
   - In local variables: xx_rsc_yy -> xx_sc_yy

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 48 +++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h |  4 ++--
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index a45f51e..b335a57 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1466,7 +1466,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts,
struct ixgbe_rx_queue *rxq = rx_queue;
volatile union ixgbe_adv_rx_desc *rx_ring = rxq->rx_ring;
struct ixgbe_rx_entry *sw_ring = rxq->sw_ring;
-   struct ixgbe_rsc_entry *sw_rsc_ring = rxq->sw_rsc_ring;
+   struct ixgbe_scattered_rx_entry *sw_sc_ring = rxq->sw_sc_ring;
uint16_t rx_id = rxq->rx_tail;
uint16_t nb_rx = 0;
uint16_t nb_hold = rxq->nb_rx_hold;
@@ -1475,8 +1475,8 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts,
while (nb_rx < nb_pkts) {
bool eop;
struct ixgbe_rx_entry *rxe;
-   struct ixgbe_rsc_entry *rsc_entry;
-   struct ixgbe_rsc_entry *next_rsc_entry;
+   struct ixgbe_scattered_rx_entry *sc_entry;
+   struct ixgbe_scattered_rx_entry *next_sc_entry;
struct ixgbe_rx_entry *next_rxe;
struct rte_mbuf *first_seg;
struct rte_mbuf *rxm;
@@ -1619,14 +1619,14 @@ next_desc:
else
nextp_id = next_id;

-   next_rsc_entry = &sw_rsc_ring[nextp_id];
+   next_sc_entry = &sw_sc_ring[nextp_id];
next_rxe = &sw_ring[nextp_id];
rte_ixgbe_prefetch(next_rxe);
}

-   rsc_entry = &sw_rsc_ring[rx_id];
-   first_seg = rsc_entry->fbuf;
-   rsc_entry->fbuf = NULL;
+   sc_entry = &sw_sc_ring[rx_id];
+   first_seg = sc_entry->fbuf;
+   sc_entry->fbuf = NULL;

/*
 * If this is the first buffer of the received packet,
@@ -1651,11 +1651,11 @@ next_desc:
/*
 * If this is not the last buffer of the received packet, update
 * the pointer to the first mbuf at the NEXTP entry in the
-* sw_rsc_ring and continue to parse the RX ring.
+* sw_sc_ring and continue to parse the RX ring.
 */
if (!eop) {
rxm->next = next_rxe->mbuf;
-   next_rsc_entry->fbuf = first_seg;
+   next_sc_entry->fbuf = first_seg;
goto next_desc;
}

@@ -2305,7 +2305,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 }

 /**
- * ixgbe_free_rsc_cluster - free the not-yet-completed RSC cluster
+ * ixgbe_free_sc_cluster - free the not-yet-completed scattered cluster
  *
  * The "next" pointer of the last segment of (not-yet-completed) RSC clusters
  * in the sw_rsc_ring is not set to NULL but rather points to the next
@@ -2314,10 +2314,10 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
  * will just free first "nb_segs" segments of the cluster explicitly by calling
  * an rte_pktmbuf_free_seg().
  *
- * @m RSC cluster head
+ * @m scattered cluster head
  */
 static void
-ixgbe_free_rsc_cluster(struct rte_mbuf *m)
+ixgbe_free_sc_cluster(struct rte_mbuf *m)
 {
uint8_t i, nb_segs = m->nb_segs;
struct rte_mbuf *next_seg;
@@ -2353,11 +2353,11 @@ ixgbe_rx_queue_release_mbufs(struct ixgbe_rx_queue *rxq)
 #endif
}

-   if (rxq->sw_rsc_ring)
+   if (rxq->sw_sc_ring)
for (i = 0; i < rxq->nb_rx_desc; i++)
-   if (rxq->sw_rsc_ring[i].fbuf) {
-   
ixgbe_free_rsc_cluster(rxq->sw_rsc_ring[i].fbuf);
-   rxq->sw_rsc_ring[i].fbuf = NULL;
+   if (rxq->sw_sc_ring[i].fbuf) {
+   ixgbe_free_sc_cluster(rxq->sw_sc_ring[i].fbuf);
+   rxq->sw_sc_ring[i].fbuf = NULL;
}
 }

@@ -2367,7 +2367,7 @@ ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq)
if (rxq != NULL) {
ixgbe_rx_queue_release_mbufs(rxq);
rte_free(rxq->sw_ring);
-   rte_free(rxq->sw_rsc_ring);
+   rte_free(rxq->sw_sc_ring);
rte_free(rxq);
}
 }
@@ -2624,20 +2624,20 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
}

if (rsc_requested) {
-   rxq->sw_rsc_ring =
-   rte_zmalloc_socket("rxq->sw_rsc

[dpdk-dev] [PATCH v2 2/5] ixgbe: ixgbe_rx_queue: remove unused rsc_en field

2015-04-29 Thread Vlad Zolotarov
Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 3 ---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 60344a9..a45f51e 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -2489,7 +2489,6 @@ ixgbe_reset_rx_queue(struct ixgbe_adapter *adapter, 
struct ixgbe_rx_queue *rxq)
rxq->nb_rx_hold = 0;
rxq->pkt_first_seg = NULL;
rxq->pkt_last_seg = NULL;
-   rxq->rsc_en = 0;
 }

 int
@@ -4188,8 +4187,6 @@ ixgbe_set_rsc(struct rte_eth_dev *dev)
 * interrupt vector.
 */
ixgbe_set_ivar(dev, rxq->reg_idx, i, 0);
-
-   rxq->rsc_en = 1;
}

dev->data->lro = 1;
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
index 4d77042..a1bcbe8 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
@@ -131,7 +131,6 @@ struct ixgbe_rx_queue {
uint8_t port_id;  /**< Device port identifier. */
uint8_t crc_len;  /**< 0 if CRC stripped, 4 otherwise. */
uint8_t drop_en;  /**< If not 0, set SRRCTL.Drop_En. */
-   uint8_t rsc_en;   /**< If not 0, RSC is enabled. */
uint8_t rx_deferred_start; /**< not in global dev start. */
 #ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
/** need to alloc dummy mbuf, for wraparound when scanning hw ring */
-- 
2.1.0



[dpdk-dev] [PATCH v2 1/5] ixgbe: move rx_bulk_alloc_allowed and rx_vec_allowed to ixgbe_adapter

2015-04-29 Thread Vlad Zolotarov
Move the above fields from ixgbe_hw to ixgbe_adapter.

Signed-off-by: Vlad Zolotarov 
---
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |  2 --
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  8 +++
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  3 +++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 38 +++--
 4 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h 
b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
index 9a66370..c67d462 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
@@ -3657,8 +3657,6 @@ struct ixgbe_hw {
bool force_full_reset;
bool allow_unsupported_sfp;
bool wol_enabled;
-   bool rx_bulk_alloc_allowed;
-   bool rx_vec_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 366aa45..aec1de9 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -1428,8 +1428,8 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
 {
struct ixgbe_interrupt *intr =
IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
-   struct ixgbe_hw *hw =
-   IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct ixgbe_adapter *adapter =
+   (struct ixgbe_adapter *)dev->data->dev_private;

PMD_INIT_FUNC_TRACE();

@@ -1440,8 +1440,8 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
 * Initialize to TRUE. If any of Rx queues doesn't meet the bulk
 * allocation or vector Rx preconditions we will reset it.
 */
-   hw->rx_bulk_alloc_allowed = true;
-   hw->rx_vec_allowed = true;
+   adapter->rx_bulk_alloc_allowed = true;
+   adapter->rx_vec_allowed = true;

return 0;
 }
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index e45e727..5b90115 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -265,6 +265,9 @@ struct ixgbe_adapter {
struct ixgbe_bypass_infobps;
 #endif /* RTE_NIC_BYPASS */
struct ixgbe_filter_infofilter;
+
+   bool rx_bulk_alloc_allowed;
+   bool rx_vec_allowed;
 };

 #define IXGBE_DEV_PRIVATE_TO_HW(adapter)\
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 3c61d1c..60344a9 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -2442,7 +2442,7 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused 
struct ixgbe_rx_queue *rxq)

 /* Reset dynamic ixgbe_rx_queue fields back to defaults */
 static void
-ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct ixgbe_rx_queue *rxq)
+ixgbe_reset_rx_queue(struct ixgbe_adapter *adapter, struct ixgbe_rx_queue *rxq)
 {
static const union ixgbe_adv_rx_desc zeroed_desc = {{0}};
unsigned i;
@@ -2458,7 +2458,7 @@ ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct 
ixgbe_rx_queue *rxq)
 * constraints here to see if we need to zero out memory after the end
 * of the H/W descriptor ring.
 */
-   if (hw->rx_bulk_alloc_allowed)
+   if (adapter->rx_bulk_alloc_allowed)
/* zero out extra memory */
len += RTE_PMD_IXGBE_RX_MAX_BURST;

@@ -2504,6 +2504,8 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
struct ixgbe_rx_queue *rxq;
struct ixgbe_hw *hw;
uint16_t len;
+   struct ixgbe_adapter *adapter =
+   (struct ixgbe_adapter *)dev->data->dev_private;
struct rte_eth_dev_info dev_info = { 0 };
struct rte_eth_rxmode *dev_rx_mode = &dev->data->dev_conf.rxmode;
bool rsc_requested = false;
@@ -2602,7 +2604,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
"preconditions - canceling the feature for "
"the whole port[%d]",
 rxq->queue_id, rxq->port_id);
-   hw->rx_bulk_alloc_allowed = false;
+   adapter->rx_bulk_alloc_allowed = false;
}

/*
@@ -2611,7 +2613,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 * function does not access an invalid memory region.
 */
len = nb_desc;
-   if (hw->rx_bulk_alloc_allowed)
+   if (adapter->rx_bulk_alloc_allowed)
len += RTE_PMD_IXGBE_RX_MAX_BURST;

rxq->sw_ring = rte_zmalloc_socket("rxq->sw_ring",
@@ -2644,13 +2646,13 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
"preconditions - canceling the feature for "
"the whole port[%d]",
 rxq->queue_id, rxq->port_id);
-   hw->rx_vec_allowed = false;
+   adapter->rx_vec_allowed = false;
} else
ixgbe_rxq_vec_setup(rxq);

dev->data->rx_queues[queue_

[dpdk-dev] [PATCH v2 0/5]: Cleanups in the ixgbe PMD

2015-04-29 Thread Vlad Zolotarov
This series includes:
   - Fix the "issue" introduced in 01fa1d6215fa7cd6b5303ac9296381b75b9226de:
 files in librte_pmd_ixgbe/ixgbe/ are shared with FreeBSD and AFAIU should 
not
 be changed unless the change is pushed into the FreeBSD tree first.
   - Remove unused rsc_en field in ixgbe_rx_queue struct.
 Thanks to Shiweixian  for pointing this out.
   - Kill the non-vector scattered Rx callback and use an appropriate LRO 
callback
 instead. This is possible because work against HW in both LRO and 
scattered RX
 cases is the same. Note that this patch touches the ixgbevf PMD as well.
   - Use LRO bulk callback when scattered (non-LRO) Rx is requested and 
parameters
 allow bulk allocation.

Note that this series is meant to cleanup the PF PMD and is a follow up series 
for my
previous patches. Although VF PMD is slightly modified here too this series 
doesn't mean
to fix/add new functionality to it. VF PMD should be patched in the similar way 
I've
patched PF PMD in my previous series in order to fix the same issues that were 
fixed in
the PF PMD and in order to enable LRO and scattered Rx with bulk allocations.

New in v2:
   - Rename RSC-specific structures to "Scattered Rx" derivatives.
   - Always allocate Scattered Rx ring.

Vlad Zolotarov (5):
  ixgbe: move rx_bulk_alloc_allowed and rx_vec_allowed to ixgbe_adapter
  ixgbe: ixgbe_rx_queue: remove unused rsc_en field
  ixgbe: Rename yy_rsc_xx -> yy_sc/scattered_rx_xx
  ixgbe: Kill ixgbe_recv_scattered_pkts()
  ixgbe: Add support for scattered Rx with bulk allocation.

 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |   2 -
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  10 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   6 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 360 ++--
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   5 +-
 5 files changed, 77 insertions(+), 306 deletions(-)

-- 
2.1.0



[dpdk-dev] [PATCH v2 0/5]: Cleanups in the ixgbe PMD

2015-04-29 Thread Ananyev, Konstantin
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Vlad Zolotarov
> Sent: Wednesday, April 29, 2015 9:38 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v2 0/5]: Cleanups in the ixgbe PMD
> 
> This series includes:
>- Fix the "issue" introduced in 01fa1d6215fa7cd6b5303ac9296381b75b9226de:
>  files in librte_pmd_ixgbe/ixgbe/ are shared with FreeBSD and AFAIU 
> should not
>  be changed unless the change is pushed into the FreeBSD tree first.
>- Remove unused rsc_en field in ixgbe_rx_queue struct.
>  Thanks to Shiweixian  for pointing this out.
>- Kill the non-vector scattered Rx callback and use an appropriate LRO 
> callback
>  instead. This is possible because work against HW in both LRO and 
> scattered RX
>  cases is the same. Note that this patch touches the ixgbevf PMD as well.
>- Use LRO bulk callback when scattered (non-LRO) Rx is requested and 
> parameters
>  allow bulk allocation.
> 
> Note that this series is meant to cleanup the PF PMD and is a follow up 
> series for my
> previous patches. Although VF PMD is slightly modified here too this series 
> doesn't mean
> to fix/add new functionality to it. VF PMD should be patched in the similar 
> way I've
> patched PF PMD in my previous series in order to fix the same issues that 
> were fixed in
> the PF PMD and in order to enable LRO and scattered Rx with bulk allocations.
> 
> New in v2:
>- Rename RSC-specific structures to "Scattered Rx" derivatives.
>- Always allocate Scattered Rx ring.
> 
> Vlad Zolotarov (5):
>   ixgbe: move rx_bulk_alloc_allowed and rx_vec_allowed to ixgbe_adapter
>   ixgbe: ixgbe_rx_queue: remove unused rsc_en field
>   ixgbe: Rename yy_rsc_xx -> yy_sc/scattered_rx_xx
>   ixgbe: Kill ixgbe_recv_scattered_pkts()
>   ixgbe: Add support for scattered Rx with bulk allocation.
> 
>  lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |   2 -
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  10 +-
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   6 +-
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 360 
> ++--
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   5 +-
>  5 files changed, 77 insertions(+), 306 deletions(-)
> 

Acked-by: Konstantin Ananyev 
Thanks a lot for doing it.

> --
> 2.1.0



[dpdk-dev] gmake test on freeBSD

2015-04-29 Thread Ravi Kerur
On Wed, Apr 29, 2015 at 1:29 AM, Bruce Richardson <
bruce.richardson at intel.com> wrote:

> On Tue, Apr 28, 2015 at 06:15:53PM -0700, Ravi Kerur wrote:
> > DPDK team,
> >
> > Is there a automated tests to run on freeBSD similar to Linux (make
> test).
> >
> > I ran "gmake test T=x86_64-native-bsdapp-clang CC=clang" I get following
> > output
> >
> > /usr/home/rkerur/dpdk-validate-abi-1/dpdk/build/app/test -c f -n 4
> >
> > Test name  Test result  Test
> > Total
> >
> 
> > Start group_1: Fail [Can't run]  [00m 00s]
> > Timer autotest:Fail [Can't run]  [00m 00s]
> > Debug autotest:Fail [Can't run]  [00m 00s]
> > Errno autotest:Fail [Can't run]  [00m 00s]
> > Meter autotest:Fail [Can't run]  [00m 00s]
> > Common autotest:   Fail [Can't run]  [00m 00s]
> > Dump log history:  Fail [Can't run]  [00m 00s]
> > ...
> > Start memcpy_perf: Fail [No prompt]  [00m 00s]
> > Memcpy performance autotest:   Fail [No prompt]  [00m 00s]
> [00m
> > 01s]
> > Start hash_perf:   Fail [No prompt]  [00m 00s]
> > Hash performance autotest: Fail [No prompt]  [00m 00s]
> [00m
> > 01s]
> > Start power:   Fail [No prompt]  [00m 00s]
> > Power autotest:Fail [No prompt]  [00m 00s]
> [00m
> > 01s]
> > ...
> >
> > I have contigmem and nic_uio installed. I know some applications are
> > linuxapp specific but wanted to know if there is a similar automated test
> > tool like Linux?
> >
> > Thanks,
> > Ravi
>
> There is no separate test tool for FreeBSD. Unfortunately there are a
> number of little
> things that don't really work on FreeBSD - and this looks to be one of
> them. We
> probably need to look to fix this.
>
> Thanks Bruce. Is it due to missing infra for BSD or some minor fixes in
app/test?

> /Bruce
>


[dpdk-dev] [PATCH] doc: disable doxygen member sorting

2015-04-29 Thread Mcnamara, John
> -Original Message-
> From: Mcnamara, John
> Sent: Wednesday, April 29, 2015 11:48 AM
> To: dev at dpdk.org
> Cc: Mcnamara, John
> Subject: [PATCH] doc: disable doxygen member sorting
> 
> Disabled the doxygen option to sort member data so that functions and
> struct memebers are listed in order of definition in the brief and main
> sections.



See for example:

http://dpdk.org/doc/api/structlcore__config.html

The first listed member is "unsigned detected" but the first documented member 
is "void* volatile arg".

John.
-- 






[dpdk-dev] NMI Watchdog warning

2015-04-29 Thread 陳政柏
Hi,all

When I enabled nmi_watchdog, and I get following warning messages. How
can I resolve it?
Kernel version is 3.10.52


[  940.093592] [ cut here ]
[  940.098218] WARNING: at kernel/watchdog.c:245
watchdog_overflow_callback+0x94/0xc0()
[  940.105960] Watchdog detected hard LOCKUP on cpu 3
[  940.110583] Modules linked in: nf_conntrack_netlink udptap(O)
nf_conntrack_ipv6 xt_socket nf_defrag_ipv6 xt_mac ip6table_mangle
nf_nat_proto_udplite nf_conntrack_proto_udplite nf_nat_proto_sctp
nf_conntrack_proto_sctp nf_nat_tftp nf_conntrack_tftp nf_conntrack_h323
nf_nat_pptp nf_nat_proto_gre nf_conntrack_pptp nf_conntrack_proto_gre
xt_hashlimit xt_mconnlimit xt_CT xt_TCPMSS ipt_REJECT ipt_MASQUERADE
xt_REDIRECT xt_multiport ipt_ULOG xt_NFLOG nfnetlink_log ip6table_filter
xt_set(O) xt_mark xt_connmark xt_conntrack xt_ifgroup iptable_raw ip_gre
ip_tunnel gre ip_set_hash_ip(O) ip_set_hash_netiface(O) ip_set_hash_net(O)
ip_set(O) nfnetlink nf_nat_ftp nf_conntrack_ftp xt_recent iptable_nat
nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack
iptable_mangle iptable_filter coretemp bridge dummy rte_kni(O) igb_uio(O)
uio_pci_generic uio ixgbe(O) igb(O) e1000e(O)
[  940.188695] CPU: 3 PID: 1261 Comm: XXX Tainted: GW  O 3.10.52 #1

[  940.205210]  0009 88087f8c6c78 8148ec62
88087f8c6cb0
[  940.212667]  8103c5dc 88085f834c00 
88087f8c6dd8
[  940.220126]  88087f8c6ef8  88087f8c6d10
8103c647
[  940.227586] Call Trace:
[  940.230032][] dump_stack+0x19/0x1b
[  940.235803]  [] warn_slowpath_common+0x5c/0x80
[  940.241811]  [] warn_slowpath_fmt+0x47/0x50
[  940.247555]  [] watchdog_overflow_callback+0x94/0xc0
[  940.254088]  [] __perf_event_overflow+0x8d/0x2b0
[  940.260271]  [] ? perf_event_update_userpage+0x19/0x100
[  940.267061]  [] perf_event_overflow+0x14/0x20
[  940.272988]  [] intel_pmu_handle_irq+0x1de/0x370
[  940.279172]  [] perf_event_nmi_handler+0x2b/0x50
[  940.285352]  [] do_nmi+0x118/0x420
[  940.290315]  [] end_repeat_nmi+0x1e/0x2e
[  940.295804]  <>
[  940.297902] ---[ end trace 3ff3d9e5ad439b5f ]---




-- 
Sincerely yours,
threesmaller


[dpdk-dev] [PATCH v7 1/6] Move common functions in eal_thread.c

2015-04-29 Thread Ravi Kerur
> > I tried to run validate-abi.sh on BSD but ran into errors. If there is a
> > way to check against BSD please let me know.
> >
> The ABI checker should work on BSD as far as I know, since it only relies
> on
> dwarf information in the output binary.  What errors are you seeing?
>

dpdk-bsd:/home/rkerur/dpdk-validate-abi-1/dpdk # sh
./scripts/validate-abi.sh v2.0.0-rc3 v2.0.0-abi x86_64-native-bsdapp-clang
mktemp: illegal option -- p
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
   mktemp [-d] [-q] [-u] -t prefix
Cant find abi-compliance-checker utility

abi-compliance-checker is installed as shown below.

dpdk-bsd:/home/rkerur/dpdk-validate-abi-1/dpdk # pkg install
devel/abi-compliance-checker
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The most recent version of packages are already installed


>
> Neil
>
>


[dpdk-dev] data copy in vhost-user

2015-04-29 Thread Nikita Kalyazin
Zoltan, Huawei,

Thank you for your replies.

-- 

Best regards,

Nikita Kalyazin,
n.kalyazin at samsung.com

CE OS Group
Samsung R&D Institute Russia
Tel: +7 (495) 797-25-00 #3816
Tel: +7 (495) 797-25-03
Office #1501, 12-1, Dvintsev str.,
Moscow, 127018, Russia

On Tue, Apr 28, 2015 at 01:24:25PM +0100, Zoltan Kiss wrote:
> 
> 
> On 28/04/15 02:22, Xie, Huawei wrote:
> >
> >
> >> -Original Message-
> >> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Zoltan Kiss
> >> Sent: Tuesday, April 28, 2015 12:27 AM
> >> To: Nikita Kalyazin; dev at dpdk.org
> >> Subject: Re: [dpdk-dev] data copy in vhost-user
> >>
> >>
> >>
> >> On 27/04/15 12:54, Nikita Kalyazin wrote:
> >>> Hi,
> >>>
> >>>
> >>> As far as I understand, DPDK vhost-user implementation requires data copy
> >> for either RX or TX (rte_vhost_dequeue_burst() and
> >> rte_vhost_enqueue_burst()). It means that two data copies are needed to
> >> transfer a packet from one VM to another.
> >>>
> >>> Why is not it possible to eliminate one of the copies (e.g.,
> >> rte_vhost_enqueue_burst() might set up a reference at vring descriptor to
> >> mbuf's data rather than copying the data)?
> > This had been added to the to-do list. We could delay the copy until the 
> > real copy is needed.
> >>
> >> I'm just guessing, but in case of VM-to-VM traffic the receiving one
> >> could hold onto the buffer indefinitely, preventing the sender to reuse
> >> the buffer. That could lead to a DoS in some cases, and shutting down
> >> the sender would be also tricky. At least in case of Xen
> >> netback/netfront that's the reason. A reasonable solution for this
> >> problem is to make sure the buffer is swapped out with a copy after a
> >> finite time.
> > Do you mean we associate a timeout for the buffer?
> Yes, I think xen-netback had such a version once, but it was removed. As 
> far as I know the overhead and complexity of handling these timeouts 
> were too severe.
> I might be wrong about this, I don't know if this problem applies here 
> as well or not.
> 
> >>
> >> Regards,
> >>
> >> Zoltan


[dpdk-dev] [PATCH] test-pmd fix default mbuf size

2015-04-29 Thread Ananyev, Konstantin
Hi Olivier,

> -Original Message-
> From: Olivier MATZ [mailto:olivier.matz at 6wind.com]
> Sent: Wednesday, April 29, 2015 10:55 AM
> To: Ananyev, Konstantin; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] test-pmd fix default mbuf size
> 
> Hi Konstantin,
> 
> On 04/28/2015 03:02 PM, Konstantin Ananyev wrote:
> > Latest mbuf changes (priv_size addition and related fixes)
> > exposed small problem with testpmd default config:
> > testpmd default mbuf size is exaclty 2KB, that causes
> > ixgbe PMD to select scattered RX even for configs with 'normal'
> > max packet length (max_rx_pkt_len == ETHER_MAX_LEN).
> >
> > Signed-off-by: Konstantin Ananyev 
> > ---
> >   app/test-pmd/testpmd.h | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> > index 389fc24..037e7ec 100644
> > --- a/app/test-pmd/testpmd.h
> > +++ b/app/test-pmd/testpmd.h
> > @@ -48,7 +48,8 @@
> >* Default size of the mbuf data buffer to receive standard 1518-byte
> >* Ethernet frames in a mono-segment memory buffer.
> >*/
> > -#define DEFAULT_MBUF_DATA_SIZE 2048 /**< Default size of mbuf data buffer. 
> > */
> > +#define DEFAULT_MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
> > +/**< Default size of mbuf data buffer. */
> >
> >   /*
> >* The maximum number of segments per packet is used when creating
> >
> 
> Indeed, this regression is introduced by one of my recent
> patch:
> http://dpdk.org/browse/dpdk/commit/?id=dfb03bbe2b39156f0e42e7f29e09c1e6b6def265
> 
> Before, m->buf_len was initialized to RTE_PKTMBUF_HEADROOM + 2048.
> Now it is set to 2048.
> 
> Maybe a line like this should be added in the commit log:
> Fixes: dfb03bbe2b ("app/testpmd: use standard functions to initialize
> mbufs and mbuf pool")
> 
> Just one question Konstantin: could you just confirm that the
> reason of the bug? From what I understand:
> - buf_len is 2048
> - the rx data size when receiving a packet is 2048 - hdroom = 1920
> - at init, the ixgbe driver configures the hw to set the max rx
>data size, but it has to be a power of 2, so 1024 is chosen

At ixgbe_dev_rx_init(), we need to setup  SRRCTL[rqx_id]. BSIZEPACKET value:

"BSIZEPACKET 4:0 0x2 Receive Buffer Size for Packet Buffer.
The value is in 1 KB resolution. Value can be from 1 KB to 16 KB. Default 
buffer size is
2 KB. This field should not be set to 0x0. This field should be greater or 
equal to 0x2
in queues where RSC is enabled."

As it is it in 1KB units, our 1920 B are rounded down to 1K, and we have to 
enable scatter RX mode. 

As I understand, same story for igb devices.
I40e seems doesn't have such limitation.

> - then the initialization code check if a packet of ETHER_MAX_LEN
>fits in max rx size, and if not, it selects the scatter mode.
> 
> It makes me wondering 2 things:
> - should we add a comment in the test-pmd to explain that? (maybe
>not, as it is driver-specific, and it is just an optimization)

Might be, or probably somewhere to the docs?

> - should we check the other examples to see if the same problem
>exists?

Good point.
I did a quick check, and yes it seems few other sample apps are also affected:

examples/qos_sched/main.h:#define MBUF_DATA_SIZE (1528 + RTE_PKTMBUF_HEADROOM)
examples/skeleton/basicfwd.c:#define MBUF_DATA_SIZE (1600 + 
RTE_PKTMBUF_HEADROOM)
examples/packet_ordering/main.c:#define MBUF_DATA_SIZE (1600 + 
RTE_PKTMBUF_HEADROOM)
examples/rxtx_callbacks/main.c:#define MBUF_DATA_SIZE (1600 + 
RTE_PKTMBUF_HEADROOM)

I suppose, have to make v2 to include all of the above...
What probably is more beneficial  - inside rte_mbuf.h:

#define RTE_MBUF_DEFAULT_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)

With some good comments for it, and make all appropriate examples to use it.
Again, then it would appear in the API reference automatically.
Konstantin

> 
> If my understanding is correct,
> Acked-by: Olivier Matz 
> 
> Regards,
> Olivier



[dpdk-dev] [PATCH v4 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/build_app.rst  | 2 +-
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/build_app.rst 
b/doc/guides/prog_guide/build_app.rst
index d4a3261..0680dee 100644
--- a/doc/guides/prog_guide/build_app.rst
+++ b/doc/guides/prog_guide/build_app.rst
@@ -123,6 +123,6 @@ chapter for details.

 *   CPPFLAGS: The flags to use to provide flags to the C preprocessor (only 
useful when assembling .S files)

-*   LDLIBS: A list of libraries to link with (for example, -L /path/to/libfoo 
- lfoo)
+*   LDLIBS-y: A list of libraries to link with (for example, -L 
/path/to/libfoo - lfoo) Use EXTRA_LDLIBS to add more options.

 *   NO_AUTOLIBS: If set, the libraries provided by the framework will not be 
included in the LDLIBS variable automatically.
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index cf5c96f..b8ef167 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 4f30192..fdc5fea 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -205,7 +205,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v4 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 254 ++---
 mk/rte.hostapp.mk  |   4 +-
 mk/rte.shared.mk   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..c41de82 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y += -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder

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

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)   += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

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

[dpdk-dev] [PATCH v3 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/build_app.rst  | 2 +-
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/build_app.rst 
b/doc/guides/prog_guide/build_app.rst
index d4a3261..0680dee 100644
--- a/doc/guides/prog_guide/build_app.rst
+++ b/doc/guides/prog_guide/build_app.rst
@@ -123,6 +123,6 @@ chapter for details.

 *   CPPFLAGS: The flags to use to provide flags to the C preprocessor (only 
useful when assembling .S files)

-*   LDLIBS: A list of libraries to link with (for example, -L /path/to/libfoo 
- lfoo)
+*   LDLIBS-y: A list of libraries to link with (for example, -L 
/path/to/libfoo - lfoo) Use EXTRA_LDLIBS to add more options.

 *   NO_AUTOLIBS: If set, the libraries provided by the framework will not be 
included in the LDLIBS variable automatically.
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index cf5c96f..b8ef167 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 4f30192..fdc5fea 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -205,7 +205,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v3 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 254 ++---
 mk/rte.hostapp.mk  |   4 +-
 mk/rte.shared.mk   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..ed471ad 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder

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

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)   += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

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

[dpdk-dev] [PATCH 6/6] rte_sched: use correct log level

2015-04-29 Thread Stephen Hemminger
The setup messages should be at DEBUG level since they are not
important for normal operation of system. The messages about
problems should be at NOTICE or ERR level.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_sched/rte_sched.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index b8d036a..ec55f67 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -448,7 +448,8 @@ rte_sched_port_get_memory_footprint(struct 
rte_sched_port_params *params)

status = rte_sched_port_check_params(params);
if (status != 0) {
-   RTE_LOG(INFO, SCHED, "Port scheduler params check failed 
(%d)\n", status);
+   RTE_LOG(NOTICE, SCHED,
+   "Port scheduler params check failed (%d)\n", status);

return 0;
}
@@ -494,7 +495,7 @@ rte_sched_port_log_pipe_profile(struct rte_sched_port 
*port, uint32_t i)
 {
struct rte_sched_pipe_profile *p = port->pipe_profiles + i;

-   RTE_LOG(INFO, SCHED, "Low level config for pipe profile %u:\n"
+   RTE_LOG(DEBUG, SCHED, "Low level config for pipe profile %u:\n"
"Token bucket: period = %u, credits per period = %u, size = 
%u\n"
"Traffic classes: period = %u, credits per period = [%u, 
%u, %u, %u]\n"
"Traffic class 3 oversubscription: weight = %hhu\n"
@@ -688,7 +689,7 @@ rte_sched_port_config(struct rte_sched_port_params *params)
bmp_mem_size = rte_bitmap_get_memory_footprint(n_queues_per_port);
port->bmp = rte_bitmap_init(n_queues_per_port, port->bmp_array, 
bmp_mem_size);
if (port->bmp == NULL) {
-   RTE_LOG(INFO, SCHED, "Bitmap init error\n");
+   RTE_LOG(ERR, SCHED, "Bitmap init error\n");
return NULL;
}
for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i ++) {
@@ -715,7 +716,7 @@ rte_sched_port_log_subport_config(struct rte_sched_port 
*port, uint32_t i)
 {
struct rte_sched_subport *s = port->subport + i;

-   RTE_LOG(INFO, SCHED, "Low level config for subport %u:\n"
+   RTE_LOG(DEBUG, SCHED, "Low level config for subport %u:\n"
"Token bucket: period = %u, credits per period = %u, size = 
%u\n"
"Traffic classes: period = %u, credits per period = [%u, 
%u, %u, %u]\n"
"Traffic class 3 oversubscription: wm min = %u, wm max = 
%u\n",
@@ -857,7 +858,8 @@ rte_sched_pipe_config(struct rte_sched_port *port,
s->tc_ov = s->tc_ov_rate > subport_tc3_rate;

if (s->tc_ov != tc3_ov) {
-   RTE_LOG(INFO, SCHED, "Subport %u TC3 oversubscription 
is OFF (%.4lf >= %.4lf)\n",
+   RTE_LOG(DEBUG, SCHED,
+   "Subport %u TC3 oversubscription is OFF (%.4lf 
>= %.4lf)\n",
subport_id, subport_tc3_rate, s->tc_ov_rate);
}
 #endif
@@ -896,7 +898,8 @@ rte_sched_pipe_config(struct rte_sched_port *port,
s->tc_ov = s->tc_ov_rate > subport_tc3_rate;

if (s->tc_ov != tc3_ov) {
-   RTE_LOG(INFO, SCHED, "Subport %u TC3 oversubscription 
is ON (%.4lf < %.4lf)\n",
+   RTE_LOG(DEBUG, SCHED,
+   "Subport %u TC3 oversubscription is ON (%.4lf < 
%.4lf)\n",
subport_id, subport_tc3_rate, s->tc_ov_rate);
}
p->tc_ov_period_id = s->tc_ov_period_id;
-- 
2.1.4



[dpdk-dev] [PATCH 5/6] rte_sched: don't put tabs in log messages

2015-04-29 Thread Stephen Hemminger
From: Stephen Hemminger 

syslog does not like tabs in log messages; tab gets translated to #011

Signed-off-by: Stephen Hemminger 
---
 lib/librte_sched/rte_sched.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 74b3111..b8d036a 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -495,10 +495,10 @@ rte_sched_port_log_pipe_profile(struct rte_sched_port 
*port, uint32_t i)
struct rte_sched_pipe_profile *p = port->pipe_profiles + i;

RTE_LOG(INFO, SCHED, "Low level config for pipe profile %u:\n"
-   "\tToken bucket: period = %u, credits per period = %u, size = 
%u\n"
-   "\tTraffic classes: period = %u, credits per period = [%u, %u, 
%u, %u]\n"
-   "\tTraffic class 3 oversubscription: weight = %hhu\n"
-   "\tWRR cost: [%hhu, %hhu, %hhu, %hhu], [%hhu, %hhu, %hhu, 
%hhu], [%hhu, %hhu, %hhu, %hhu], [%hhu, %hhu, %hhu, %hhu]\n",
+   "Token bucket: period = %u, credits per period = %u, size = 
%u\n"
+   "Traffic classes: period = %u, credits per period = [%u, 
%u, %u, %u]\n"
+   "Traffic class 3 oversubscription: weight = %hhu\n"
+   "WRR cost: [%hhu, %hhu, %hhu, %hhu], [%hhu, %hhu, %hhu, 
%hhu], [%hhu, %hhu, %hhu, %hhu], [%hhu, %hhu, %hhu, %hhu]\n",
i,

/* Token bucket */
@@ -716,9 +716,9 @@ rte_sched_port_log_subport_config(struct rte_sched_port 
*port, uint32_t i)
struct rte_sched_subport *s = port->subport + i;

RTE_LOG(INFO, SCHED, "Low level config for subport %u:\n"
-   "\tToken bucket: period = %u, credits per period = %u, size = 
%u\n"
-   "\tTraffic classes: period = %u, credits per period = [%u, %u, 
%u, %u]\n"
-   "\tTraffic class 3 oversubscription: wm min = %u, wm max = 
%u\n",
+   "Token bucket: period = %u, credits per period = %u, size = 
%u\n"
+   "Traffic classes: period = %u, credits per period = [%u, 
%u, %u, %u]\n"
+   "Traffic class 3 oversubscription: wm min = %u, wm max = 
%u\n",
i,

/* Token bucket */
-- 
2.1.4



[dpdk-dev] [PATCH 4/6] rte_sched: allow reading without clearing

2015-04-29 Thread Stephen Hemminger
The rte_sched statistics API should allow reading statistics without
clearing. Make auto-clear optional.

Signed-off-by: Stephen Hemminger 
---
 app/test/test_sched.c|  4 ++--
 examples/qos_sched/stats.c   | 16 +++-
 lib/librte_sched/rte_sched.c | 44 ++--
 lib/librte_sched/rte_sched.h | 18 ++
 4 files changed, 45 insertions(+), 37 deletions(-)

diff --git a/app/test/test_sched.c b/app/test/test_sched.c
index c7239f8..1526ad7 100644
--- a/app/test/test_sched.c
+++ b/app/test/test_sched.c
@@ -198,13 +198,13 @@ test_sched(void)

struct rte_sched_subport_stats subport_stats;
uint32_t tc_ov;
-   rte_sched_subport_read_stats(port, SUBPORT, &subport_stats, &tc_ov);
+   rte_sched_subport_read_stats(port, SUBPORT, &subport_stats, &tc_ov, 1);
 #if 0
TEST_ASSERT_EQUAL(subport_stats.n_pkts_tc[TC-1], 10, "Wrong subport 
stats\n");
 #endif
struct rte_sched_queue_stats queue_stats;
uint16_t qlen;
-   rte_sched_queue_read_stats(port, QUEUE, &queue_stats, &qlen);
+   rte_sched_queue_read_stats(port, QUEUE, &queue_stats, &qlen, 1);
 #if 0
TEST_ASSERT_EQUAL(queue_stats.n_pkts, 10, "Wrong queue stats\n");
 #endif
diff --git a/examples/qos_sched/stats.c b/examples/qos_sched/stats.c
index b4db7b5..88caa54 100644
--- a/examples/qos_sched/stats.c
+++ b/examples/qos_sched/stats.c
@@ -61,7 +61,7 @@ qavg_q(uint8_t port_id, uint32_t subport_id, uint32_t 
pipe_id, uint8_t tc, uint8
 average = 0;

 for (count = 0; count < qavg_ntimes; count++) {
-rte_sched_queue_read_stats(port, queue_id, &stats, &qlen);
+rte_sched_queue_read_stats(port, queue_id, &stats, &qlen, 1);
 average += qlen;
 usleep(qavg_period);
 }
@@ -99,7 +99,9 @@ qavg_tcpipe(uint8_t port_id, uint32_t subport_id, uint32_t 
pipe_id, uint8_t tc)
 for (count = 0; count < qavg_ntimes; count++) {
 part_average = 0;
 for (i = 0; i < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; i++) {
-rte_sched_queue_read_stats(port, queue_id + (tc * 
RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + i), &stats, &qlen);
+rte_sched_queue_read_stats(port,
+  queue_id + (tc * 
RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + i),
+  &stats, &qlen, 1);
 part_average += qlen;
 }
 average += part_average / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS;
@@ -138,7 +140,8 @@ qavg_pipe(uint8_t port_id, uint32_t subport_id, uint32_t 
pipe_id)
 for (count = 0; count < qavg_ntimes; count++) {
 part_average = 0;
 for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * 
RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; i++) {
-rte_sched_queue_read_stats(port, queue_id + i, &stats, 
&qlen);
+rte_sched_queue_read_stats(port, queue_id + i,
+  &stats, &qlen, 1);
 part_average += qlen;
 }
 average += part_average / (RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE 
* RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
@@ -178,7 +181,9 @@ qavg_tcsubport(uint8_t port_id, uint32_t subport_id, 
uint8_t tc)
 queue_id = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * 
RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS * (subport_id * 
port_params.n_pipes_per_subport + i);

 for (j = 0; j < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; 
j++) {
-rte_sched_queue_read_stats(port, queue_id + 
(tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + j), &stats, &qlen);
+rte_sched_queue_read_stats(port,
+  queue_id + (tc * 
RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + j),
+  &stats, &qlen, 1);
 part_average += qlen;
 }
 }
@@ -220,7 +225,8 @@ qavg_subport(uint8_t port_id, uint32_t subport_id)
 queue_id = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * 
RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS * (subport_id * 
port_params.n_pipes_per_subport + i);

 for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * 
RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; j++) {
-rte_sched_queue_read_stats(port, queue_id + j, 
&stats, &qlen);
+rte_sched_queue_read_stats(port, queue_id + j,
+  &stats, &qlen, 1);
 part_average += qlen;
 }
 }
diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index c044c09..74b3111 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/lib

[dpdk-dev] [PATCH 3/6] rte_sched: keep track of RED drops

2015-04-29 Thread Stephen Hemminger
From: Stephen Hemminger 

Add new statistic to keep track of drops due to RED.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_sched/rte_sched.c | 31 ++-
 lib/librte_sched/rte_sched.h |  6 ++
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 3b5acd1..c044c09 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -1028,7 +1028,9 @@ rte_sched_port_update_subport_stats(struct rte_sched_port 
*port, uint32_t qindex
 }

 static inline void
-rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port, 
uint32_t qindex, struct rte_mbuf *pkt)
+rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port,
+   uint32_t qindex,
+   struct rte_mbuf *pkt, uint32_t red)
 {
struct rte_sched_subport *s = port->subport + (qindex / 
rte_sched_port_queues_per_subport(port));
uint32_t tc_index = (qindex >> 2) & 0x3;
@@ -1036,6 +1038,9 @@ rte_sched_port_update_subport_stats_on_drop(struct 
rte_sched_port *port, uint32_

s->stats.n_pkts_tc_dropped[tc_index] += 1;
s->stats.n_bytes_tc_dropped[tc_index] += pkt_len;
+#ifdef RTE_SCHED_RED
+   s->stats.n_pkts_red_dropped[tc_index] += red;
+#endif
 }

 static inline void
@@ -1049,13 +1054,18 @@ rte_sched_port_update_queue_stats(struct rte_sched_port 
*port, uint32_t qindex,
 }

 static inline void
-rte_sched_port_update_queue_stats_on_drop(struct rte_sched_port *port, 
uint32_t qindex, struct rte_mbuf *pkt)
+rte_sched_port_update_queue_stats_on_drop(struct rte_sched_port *port,
+ uint32_t qindex,
+ struct rte_mbuf *pkt, uint32_t red)
 {
struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
uint32_t pkt_len = pkt->pkt_len;

qe->stats.n_pkts_dropped += 1;
qe->stats.n_bytes_dropped += pkt_len;
+#ifdef RTE_SCHED_RED
+   qe->stats.n_pkts_red_dropped += red;
+#endif
 }

 #endif /* RTE_SCHED_COLLECT_STATS */
@@ -1206,12 +1216,23 @@ rte_sched_port_enqueue_qwa(struct rte_sched_port *port, 
uint32_t qindex, struct
qlen = q->qw - q->qr;

/* Drop the packet (and update drop stats) when queue is full */
-   if (unlikely(rte_sched_port_red_drop(port, pkt, qindex, qlen) || (qlen 
>= qsize))) {
+   if (unlikely(rte_sched_port_red_drop(port, pkt, qindex, qlen))) {
+#ifdef RTE_SCHED_COLLECT_STATS
+   rte_sched_port_update_subport_stats_on_drop(port, qindex,
+   pkt, 1);
+   rte_sched_port_update_queue_stats_on_drop(port, qindex, pkt, 1);
+#endif
rte_pktmbuf_free(pkt);
+   return 0;
+   }
+
+   if (qlen >= qsize) {
 #ifdef RTE_SCHED_COLLECT_STATS
-   rte_sched_port_update_subport_stats_on_drop(port, qindex, pkt);
-   rte_sched_port_update_queue_stats_on_drop(port, qindex, pkt);
+   rte_sched_port_update_subport_stats_on_drop(port, qindex,
+   pkt, 0);
+   rte_sched_port_update_queue_stats_on_drop(port, qindex, pkt, 0);
 #endif
+   rte_pktmbuf_free(pkt);
return 0;
}

diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h
index bf5ef8d..3fd1fe1 100644
--- a/lib/librte_sched/rte_sched.h
+++ b/lib/librte_sched/rte_sched.h
@@ -140,6 +140,9 @@ struct rte_sched_subport_stats {
  subport for each traffic class*/
uint32_t n_bytes_tc_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; /**< 
Number of bytes dropped by the current
   subport for each traffic class due 
to subport queues being full or congested */
+#ifdef RTE_SCHED_RED
+   uint32_t n_pkts_red_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; /**< 
Number of packets dropped by red */
+#endif
 };

 /** Pipe configuration parameters. The period and credits_per_period 
parameters are measured
@@ -168,6 +171,9 @@ struct rte_sched_queue_stats {
/* Packets */
uint32_t n_pkts; /**< Number of packets successfully 
written to current queue */
uint32_t n_pkts_dropped; /**< Number of packets dropped due to 
current queue being full or congested */
+#ifdef RTE_SCHED_RED
+   uint32_t n_pkts_red_dropped;
+#endif

/* Bytes */
uint32_t n_bytes;/**< Number of bytes successfully 
written to current queue */
-- 
2.1.4



[dpdk-dev] [PATCH 2/6] rte_sched: expand scheduler hierarchy for more VLAN's

2015-04-29 Thread Stephen Hemminger
From: Stephen Hemminger 

The QoS subport is limited to 8 bits in original code.
But customers demanded ability to support full number of VLAN's (4096)
therefore use the full part of the tag field of mbuf.

Resize the pipe as well to allow for more pipes in future and
avoid expensive bitfield access.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_mbuf/rte_mbuf.h   |  5 -
 lib/librte_sched/rte_sched.h | 38 --
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 70b0987..3dde695 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -285,7 +285,10 @@ struct rte_mbuf {
/**< First 4 flexible bytes or FD ID, dependent on
 PKT_RX_FDIR_* flag in ol_flags. */
} fdir;   /**< Filter identifier if FDIR enabled */
-   uint32_t sched;   /**< Hierarchical scheduler */
+   struct {
+   uint32_t lo;
+   uint32_t hi;
+   } sched;  /**< Hierarchical scheduler */
uint32_t usr; /**< User defined tags. See 
rte_distributor_process() */
} hash;   /**< hash information */

diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h
index e6bba22..bf5ef8d 100644
--- a/lib/librte_sched/rte_sched.h
+++ b/lib/librte_sched/rte_sched.h
@@ -195,16 +195,20 @@ struct rte_sched_port_params {
 #endif
 };

-/** Path through the scheduler hierarchy used by the scheduler enqueue 
operation to
-identify the destination queue for the current packet. Stored in the field 
hash.sched
-of struct rte_mbuf of each packet, typically written by the classification 
stage and read by
-scheduler enqueue.*/
+/*
+ * Path through the scheduler hierarchy used by the scheduler enqueue
+ * operation to identify the destination queue for the current
+ * packet. Stored in the field pkt.hash.sched of struct rte_mbuf of
+ * each packet, typically written by the classification stage and read
+ * by scheduler enqueue.
+ */
 struct rte_sched_port_hierarchy {
-   uint32_t queue:2;/**< Queue ID (0 .. 3) */
-   uint32_t traffic_class:2;/**< Traffic class ID (0 .. 3)*/
-   uint32_t pipe:20;/**< Pipe ID */
-   uint32_t subport:6;  /**< Subport ID */
-   uint32_t color:2;/**< Color */
+   uint16_t queue:2;/**< Queue ID (0 .. 3) */
+   uint16_t traffic_class:2;/**< Traffic class ID (0 .. 3)*/
+   uint16_t color:2;/**< Color */
+   uint16_t unused:10;
+   uint16_t subport;/**< Subport ID */
+   uint32_t pipe;   /**< Pipe ID */
 };

 /*
@@ -350,12 +354,15 @@ rte_sched_queue_read_stats(struct rte_sched_port *port,
  */
 static inline void
 rte_sched_port_pkt_write(struct rte_mbuf *pkt,
-   uint32_t subport, uint32_t pipe, uint32_t traffic_class, uint32_t 
queue, enum rte_meter_color color)
+uint32_t subport, uint32_t pipe,
+uint32_t traffic_class,
+uint32_t queue, enum rte_meter_color color)
 {
-   struct rte_sched_port_hierarchy *sched = (struct 
rte_sched_port_hierarchy *) &pkt->hash.sched;
+   struct rte_sched_port_hierarchy *sched
+   = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;

-   sched->color = (uint32_t) color;
sched->subport = subport;
+   sched->color = (uint32_t) color;
sched->pipe = pipe;
sched->traffic_class = traffic_class;
sched->queue = queue;
@@ -379,9 +386,12 @@ rte_sched_port_pkt_write(struct rte_mbuf *pkt,
  *
  */
 static inline void
-rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, 
uint32_t *pipe, uint32_t *traffic_class, uint32_t *queue)
+rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport,
+ uint32_t *pipe, uint32_t *traffic_class,
+ uint32_t *queue)
 {
-   struct rte_sched_port_hierarchy *sched = (struct 
rte_sched_port_hierarchy *) &pkt->hash.sched;
+   struct rte_sched_port_hierarchy *sched
+   = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;

*subport = sched->subport;
*pipe = sched->pipe;
-- 
2.1.4



[dpdk-dev] [PATCH 1/6] rte_sched: make RED optional at runtime

2015-04-29 Thread Stephen Hemminger
From: Stephen Hemminger 

Want to be able to build with RTE_SCHED_RED enabled but
allow disabling RED on a per-queue basis at runtime.

RED is disabled unless min/max thresholds set.

Signed-off-by: Stephen Hemmminger 
---
 lib/librte_sched/rte_sched.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 95dee27..3b5acd1 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -636,6 +636,12 @@ rte_sched_port_config(struct rte_sched_port_params *params)
uint32_t j;

for (j = 0; j < e_RTE_METER_COLORS; j++) {
+   /* if min/max are both zero, then RED is disabled */
+   if ((params->red_params[i][j].min_th |
+params->red_params[i][j].max_th) == 0) {
+   continue;
+   }
+
if (rte_red_config_init(&port->red_config[i][j],
params->red_params[i][j].wq_log2,
params->red_params[i][j].min_th,
@@ -1069,6 +1075,9 @@ rte_sched_port_red_drop(struct rte_sched_port *port, 
struct rte_mbuf *pkt, uint3
color = rte_sched_port_pkt_read_color(pkt);
red_cfg = &port->red_config[tc_index][color];

+   if ((red_cfg->min_th | red_cfg->max_th) == 0)
+   return 0;
+
qe = port->queue_extra + qindex;
red = &qe->red;

-- 
2.1.4



[dpdk-dev] [PATCH 0/6] rte_sched: patches against 2.o

2015-04-29 Thread Stephen Hemminger
This is a subset of earlier patches for QoS (rte_sched) subsystem.
Only changes were to fix whitespace and update against DPDK 2.0

Stephen Hemminger (6):
  rte_sched: make RED optional at runtime
  rte_sched: expand scheduler hierarchy for more VLAN's
  rte_sched: keep track of RED drops
  rte_sched: allow reading without clearing
  rte_sched: don't put tabs in log messages
  rte_sched: use correct log level

 app/test/test_sched.c|   4 +-
 examples/qos_sched/stats.c   |  16 --
 lib/librte_mbuf/rte_mbuf.h   |   5 +-
 lib/librte_sched/rte_sched.c | 113 ---
 lib/librte_sched/rte_sched.h |  62 +++-
 5 files changed, 130 insertions(+), 70 deletions(-)

-- 
2.1.4



[dpdk-dev] [PATCH v1 3/4] ixgbe: Kill ixgbe_recv_scattered_pkts()

2015-04-29 Thread Vlad Zolotarov


On 04/29/15 09:47, Vlad Zolotarov wrote:
>
>
> On 04/28/15 20:42, Ananyev, Konstantin wrote:
>> Hi Vlad,
>>
>>> -Original Message-
>>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Vlad Zolotarov
>>> Sent: Sunday, April 26, 2015 3:46 PM
>>> To: dev at dpdk.org
>>> Subject: [dpdk-dev] [PATCH v1 3/4] ixgbe: Kill 
>>> ixgbe_recv_scattered_pkts()
>>>
>>> Kill ixgbe_recv_scattered_pkts() - use 
>>> ixgbe_recv_pkts_lro_single_alloc()
>>> instead.
>>>
>>> Work against HW queues in LRO and scattered Rx cases is exactly the 
>>> same.
>>> Therefore we may drop the inferior callback.
>>>
>>> Signed-off-by: Vlad Zolotarov 
>>> ---
>>>   lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   2 +-
>>>   lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   3 -
>>>   lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 243 
>>> +---
>>>   3 files changed, 7 insertions(+), 241 deletions(-)
>>>
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
>>> b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
>>> index aec1de9..5f9a1cf 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
>>> @@ -986,7 +986,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
>>>* RX function */
>>>   if (rte_eal_process_type() != RTE_PROC_PRIMARY){
>>>   if (eth_dev->data->scattered_rx)
>>> -eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
>>> +eth_dev->rx_pkt_burst = ixgbe_recv_pkts_lro_single_alloc;
>>>   return 0;
>>>   }
>>>
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h 
>>> b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
>>> index 5b90115..419ea5d 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
>>> @@ -352,9 +352,6 @@ void ixgbevf_dev_rxtx_start(struct rte_eth_dev 
>>> *dev);
>>>   uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
>>>   uint16_t nb_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_single_alloc(void *rx_queue,
>>>   struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
>>>   uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
>>> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> index a45f51e..c23e20f 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> @@ -1722,239 +1722,6 @@ ixgbe_recv_pkts_lro_bulk_alloc(void 
>>> *rx_queue, struct rte_mbuf **rx_pkts,
>>>   return ixgbe_recv_pkts_lro(rx_queue, rx_pkts, nb_pkts, true);
>>>   }
>>>
>>> -uint16_t
>>> -ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
>>> -  uint16_t nb_pkts)
>>> -{
>>> -struct ixgbe_rx_queue *rxq;
>>> -volatile union ixgbe_adv_rx_desc *rx_ring;
>>> -volatile union ixgbe_adv_rx_desc *rxdp;
>>> -struct ixgbe_rx_entry *sw_ring;
>>> -struct ixgbe_rx_entry *rxe;
>>> -struct rte_mbuf *first_seg;
>>> -struct rte_mbuf *last_seg;
>>> -struct rte_mbuf *rxm;
>>> -struct rte_mbuf *nmb;
>>> -union ixgbe_adv_rx_desc rxd;
>>> -uint64_t dma; /* Physical address of mbuf data buffer */
>>> -uint32_t staterr;
>>> -uint16_t rx_id;
>>> -uint16_t nb_rx;
>>> -uint16_t nb_hold;
>>> -uint16_t data_len;
>>> -
>>> -nb_rx = 0;
>>> -nb_hold = 0;
>>> -rxq = rx_queue;
>>> -rx_id = rxq->rx_tail;
>>> -rx_ring = rxq->rx_ring;
>>> -sw_ring = rxq->sw_ring;
>>> -
>>> -/*
>>> - * Retrieve RX context of current packet, if any.
>>> - */
>>> -first_seg = rxq->pkt_first_seg;
>>> -last_seg = rxq->pkt_last_seg;
>>> -
>>> -while (nb_rx < nb_pkts) {
>>> -next_desc:
>>> -/*
>>> - * The order of operations here is important as the DD status
>>> - * bit must not be read after any other descriptor fields.
>>> - * rx_ring and rxdp are pointing to volatile data so the order
>>> - * of accesses cannot be reordered by the compiler. If they 
>>> were
>>> - * not volatile, they could be reordered which could lead to
>>> - * using invalid descriptor fields when read from rxd.
>>> - */
>>> -rxdp = &rx_ring[rx_id];
>>> -staterr = rxdp->wb.upper.status_error;
>>> -if (! (staterr & rte_cpu_to_le_32(IXGBE_RXDADV_STAT_DD)))
>>> -break;
>>> -rxd = *rxdp;
>>> -
>>> -/*
>>> - * Descriptor done.
>>> - *
>>> - * Allocate a new mbuf to replenish the RX ring descriptor.
>>> - * If the allocation fails:
>>> - *- arrange for that RX descriptor to be the first one
>>> - *  being parsed the next time the receive function is
>>> - *  invoked [on the same queue].
>>> - *
>>> - *- Stop parsing the RX ring and return immediately.
>>> - *
>>> - * This policy does not drop the packet received in t

[dpdk-dev] [PATCH v1 3/4] ixgbe: Kill ixgbe_recv_scattered_pkts()

2015-04-29 Thread Vlad Zolotarov


On 04/28/15 20:42, Ananyev, Konstantin wrote:
> Hi Vlad,
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Vlad Zolotarov
>> Sent: Sunday, April 26, 2015 3:46 PM
>> To: dev at dpdk.org
>> Subject: [dpdk-dev] [PATCH v1 3/4] ixgbe: Kill ixgbe_recv_scattered_pkts()
>>
>> Kill ixgbe_recv_scattered_pkts() - use ixgbe_recv_pkts_lro_single_alloc()
>> instead.
>>
>> Work against HW queues in LRO and scattered Rx cases is exactly the same.
>> Therefore we may drop the inferior callback.
>>
>> Signed-off-by: Vlad Zolotarov 
>> ---
>>   lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   2 +-
>>   lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   3 -
>>   lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 243 
>> +---
>>   3 files changed, 7 insertions(+), 241 deletions(-)
>>
>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
>> b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
>> index aec1de9..5f9a1cf 100644
>> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
>> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
>> @@ -986,7 +986,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
>>   * RX function */
>>  if (rte_eal_process_type() != RTE_PROC_PRIMARY){
>>  if (eth_dev->data->scattered_rx)
>> -eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
>> +eth_dev->rx_pkt_burst = 
>> ixgbe_recv_pkts_lro_single_alloc;
>>  return 0;
>>  }
>>
>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h 
>> b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
>> index 5b90115..419ea5d 100644
>> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
>> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
>> @@ -352,9 +352,6 @@ void ixgbevf_dev_rxtx_start(struct rte_eth_dev *dev);
>>   uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
>>  uint16_t nb_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_single_alloc(void *rx_queue,
>>  struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
>>   uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
>> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>> index a45f51e..c23e20f 100644
>> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>> @@ -1722,239 +1722,6 @@ ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue, 
>> struct rte_mbuf **rx_pkts,
>>  return ixgbe_recv_pkts_lro(rx_queue, rx_pkts, nb_pkts, true);
>>   }
>>
>> -uint16_t
>> -ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
>> -  uint16_t nb_pkts)
>> -{
>> -struct ixgbe_rx_queue *rxq;
>> -volatile union ixgbe_adv_rx_desc *rx_ring;
>> -volatile union ixgbe_adv_rx_desc *rxdp;
>> -struct ixgbe_rx_entry *sw_ring;
>> -struct ixgbe_rx_entry *rxe;
>> -struct rte_mbuf *first_seg;
>> -struct rte_mbuf *last_seg;
>> -struct rte_mbuf *rxm;
>> -struct rte_mbuf *nmb;
>> -union ixgbe_adv_rx_desc rxd;
>> -uint64_t dma; /* Physical address of mbuf data buffer */
>> -uint32_t staterr;
>> -uint16_t rx_id;
>> -uint16_t nb_rx;
>> -uint16_t nb_hold;
>> -uint16_t data_len;
>> -
>> -nb_rx = 0;
>> -nb_hold = 0;
>> -rxq = rx_queue;
>> -rx_id = rxq->rx_tail;
>> -rx_ring = rxq->rx_ring;
>> -sw_ring = rxq->sw_ring;
>> -
>> -/*
>> - * Retrieve RX context of current packet, if any.
>> - */
>> -first_seg = rxq->pkt_first_seg;
>> -last_seg = rxq->pkt_last_seg;
>> -
>> -while (nb_rx < nb_pkts) {
>> -next_desc:
>> -/*
>> - * The order of operations here is important as the DD status
>> - * bit must not be read after any other descriptor fields.
>> - * rx_ring and rxdp are pointing to volatile data so the order
>> - * of accesses cannot be reordered by the compiler. If they were
>> - * not volatile, they could be reordered which could lead to
>> - * using invalid descriptor fields when read from rxd.
>> - */
>> -rxdp = &rx_ring[rx_id];
>> -staterr = rxdp->wb.upper.status_error;
>> -if (! (staterr & rte_cpu_to_le_32(IXGBE_RXDADV_STAT_DD)))
>> -break;
>> -rxd = *rxdp;
>> -
>> -/*
>> - * Descriptor done.
>> - *
>> - * Allocate a new mbuf to replenish the RX ring descriptor.
>> - * If the allocation fails:
>> - *- arrange for that RX descriptor to be the first one
>> - *  being parsed the next time the receive function is
>> - *  invoked [on the same queue].
>> - *
>> - *- Stop parsing the RX ring and return immediately.
>> - *
>> - * This policy does not drop the packet received in the RX
>> - * descriptor for which the a

[dpdk-dev] [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

2015-04-29 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 doc/build-sdk-quick.txt  | 1 +
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 041a40e..26d5442 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -13,6 +13,7 @@ Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGSlinker options
+   EXTRA_LDLIBS linker libary options
RTE_KERNELDIRlinux headers path
CROSS toolchain prefix
V verbose
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst 
b/doc/guides/prog_guide/dev_kit_build_system.rst
index cf5c96f..b8ef167 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a 
Makefile or Command Line

 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when 
linking.

+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when 
linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when 
assembling.

 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS 
when using a C preprocessor on assembly files.
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst 
b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index 4f30192..fdc5fea 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -205,7 +205,7 @@ The following variables can be specified on the command 
line:

 Enable dependency debugging. This provides some useful information about 
why a target is built or not.

-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, 
EXTRA_CPPFLAGS=

 Append specific compilation, link or asm flags.

-- 
2.3.0



[dpdk-dev] [PATCH v2 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Keith Wiles
Trying to simplify the ifdefs in rte.app.mk to make the code
more readable and maintainable by moving LDLIBS variable to use
the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps
instead of using LDLIBS directly.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 254 ++---
 mk/rte.hostapp.mk  |   4 +-
 mk/rte.shared.mk   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)

diff --git a/examples/dpdk_qat/Makefile b/examples/dpdk_qat/Makefile
index f1e06a1..90ca1d3 100644
--- a/examples/dpdk_qat/Makefile
+++ b/examples/dpdk_qat/Makefile
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif

-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
 -lz \
 -losal \
 -ladf_proxy \
diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..8fb78d4 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)

-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt

 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 62a76ae..ed471ad 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)

-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive

-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS) += -l$(RTE_LIBNAME)

 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder

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

-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)+= -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)   += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)+= -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)   += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)+= -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)+= -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)   += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)   += -lrte_meter

-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)   += -lrt

-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)   += -lrte_vhost

 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS

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

[dpdk-dev] [PATCH 0/3] pcap pmd improvements

2015-04-29 Thread Nicolas Pernas Maradei
Hi,

I had a look to the patch set last night and it looks good to me apart 
from the few comments that I've already shared with Tero.

Nico.

On 28/04/15 13:09, Mcnamara, John wrote:
>> -Original Message-
>> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
>> Sent: Tuesday, April 28, 2015 11:10 AM
>> To: Nicol?s Pernas Maradei; Mcnamara, John
>> Cc: dev at dpdk.org; Tero Aho
>> Subject: Re: [dpdk-dev] [PATCH 0/3] pcap pmd improvements
>>
>> Please Nicolas, John,
>> could we have a review of these patches?
> Will do.
>
> John.



[dpdk-dev] gmake test on freeBSD

2015-04-29 Thread Bruce Richardson
On Tue, Apr 28, 2015 at 06:15:53PM -0700, Ravi Kerur wrote:
> DPDK team,
> 
> Is there a automated tests to run on freeBSD similar to Linux (make test).
> 
> I ran "gmake test T=x86_64-native-bsdapp-clang CC=clang" I get following
> output
> 
> /usr/home/rkerur/dpdk-validate-abi-1/dpdk/build/app/test -c f -n 4
> 
> Test name  Test result  Test
> Total
> 
> Start group_1: Fail [Can't run]  [00m 00s]
> Timer autotest:Fail [Can't run]  [00m 00s]
> Debug autotest:Fail [Can't run]  [00m 00s]
> Errno autotest:Fail [Can't run]  [00m 00s]
> Meter autotest:Fail [Can't run]  [00m 00s]
> Common autotest:   Fail [Can't run]  [00m 00s]
> Dump log history:  Fail [Can't run]  [00m 00s]
> ...
> Start memcpy_perf: Fail [No prompt]  [00m 00s]
> Memcpy performance autotest:   Fail [No prompt]  [00m 00s] [00m
> 01s]
> Start hash_perf:   Fail [No prompt]  [00m 00s]
> Hash performance autotest: Fail [No prompt]  [00m 00s] [00m
> 01s]
> Start power:   Fail [No prompt]  [00m 00s]
> Power autotest:Fail [No prompt]  [00m 00s] [00m
> 01s]
> ...
> 
> I have contigmem and nic_uio installed. I know some applications are
> linuxapp specific but wanted to know if there is a similar automated test
> tool like Linux?
> 
> Thanks,
> Ravi

There is no separate test tool for FreeBSD. Unfortunately there are a number of 
little
things that don't really work on FreeBSD - and this looks to be one of them. We
probably need to look to fix this.

/Bruce


[dpdk-dev] [PATCH v1 3/4] ixgbe: Kill ixgbe_recv_scattered_pkts()

2015-04-29 Thread Ananyev, Konstantin


> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Wednesday, April 29, 2015 7:50 AM
> To: Ananyev, Konstantin; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v1 3/4] ixgbe: Kill ixgbe_recv_scattered_pkts()
> 
> 
> 
> On 04/29/15 09:47, Vlad Zolotarov wrote:
> >
> >
> > On 04/28/15 20:42, Ananyev, Konstantin wrote:
> >> Hi Vlad,
> >>
> >>> -Original Message-
> >>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Vlad Zolotarov
> >>> Sent: Sunday, April 26, 2015 3:46 PM
> >>> To: dev at dpdk.org
> >>> Subject: [dpdk-dev] [PATCH v1 3/4] ixgbe: Kill
> >>> ixgbe_recv_scattered_pkts()
> >>>
> >>> Kill ixgbe_recv_scattered_pkts() - use
> >>> ixgbe_recv_pkts_lro_single_alloc()
> >>> instead.
> >>>
> >>> Work against HW queues in LRO and scattered Rx cases is exactly the
> >>> same.
> >>> Therefore we may drop the inferior callback.
> >>>
> >>> Signed-off-by: Vlad Zolotarov 
> >>> ---
> >>>   lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   2 +-
> >>>   lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   3 -
> >>>   lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 243
> >>> +---
> >>>   3 files changed, 7 insertions(+), 241 deletions(-)
> >>>
> >>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> >>> b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> >>> index aec1de9..5f9a1cf 100644
> >>> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> >>> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> >>> @@ -986,7 +986,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
> >>>* RX function */
> >>>   if (rte_eal_process_type() != RTE_PROC_PRIMARY){
> >>>   if (eth_dev->data->scattered_rx)
> >>> -eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
> >>> +eth_dev->rx_pkt_burst = ixgbe_recv_pkts_lro_single_alloc;
> >>>   return 0;
> >>>   }
> >>>
> >>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> >>> b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> >>> index 5b90115..419ea5d 100644
> >>> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> >>> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> >>> @@ -352,9 +352,6 @@ void ixgbevf_dev_rxtx_start(struct rte_eth_dev
> >>> *dev);
> >>>   uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
> >>>   uint16_t nb_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_single_alloc(void *rx_queue,
> >>>   struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
> >>>   uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
> >>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> >>> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> >>> index a45f51e..c23e20f 100644
> >>> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> >>> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> >>> @@ -1722,239 +1722,6 @@ ixgbe_recv_pkts_lro_bulk_alloc(void
> >>> *rx_queue, struct rte_mbuf **rx_pkts,
> >>>   return ixgbe_recv_pkts_lro(rx_queue, rx_pkts, nb_pkts, true);
> >>>   }
> >>>
> >>> -uint16_t
> >>> -ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
> >>> -  uint16_t nb_pkts)
> >>> -{
> >>> -struct ixgbe_rx_queue *rxq;
> >>> -volatile union ixgbe_adv_rx_desc *rx_ring;
> >>> -volatile union ixgbe_adv_rx_desc *rxdp;
> >>> -struct ixgbe_rx_entry *sw_ring;
> >>> -struct ixgbe_rx_entry *rxe;
> >>> -struct rte_mbuf *first_seg;
> >>> -struct rte_mbuf *last_seg;
> >>> -struct rte_mbuf *rxm;
> >>> -struct rte_mbuf *nmb;
> >>> -union ixgbe_adv_rx_desc rxd;
> >>> -uint64_t dma; /* Physical address of mbuf data buffer */
> >>> -uint32_t staterr;
> >>> -uint16_t rx_id;
> >>> -uint16_t nb_rx;
> >>> -uint16_t nb_hold;
> >>> -uint16_t data_len;
> >>> -
> >>> -nb_rx = 0;
> >>> -nb_hold = 0;
> >>> -rxq = rx_queue;
> >>> -rx_id = rxq->rx_tail;
> >>> -rx_ring = rxq->rx_ring;
> >>> -sw_ring = rxq->sw_ring;
> >>> -
> >>> -/*
> >>> - * Retrieve RX context of current packet, if any.
> >>> - */
> >>> -first_seg = rxq->pkt_first_seg;
> >>> -last_seg = rxq->pkt_last_seg;
> >>> -
> >>> -while (nb_rx < nb_pkts) {
> >>> -next_desc:
> >>> -/*
> >>> - * The order of operations here is important as the DD status
> >>> - * bit must not be read after any other descriptor fields.
> >>> - * rx_ring and rxdp are pointing to volatile data so the order
> >>> - * of accesses cannot be reordered by the compiler. If they
> >>> were
> >>> - * not volatile, they could be reordered which could lead to
> >>> - * using invalid descriptor fields when read from rxd.
> >>> - */
> >>> -rxdp = &rx_ring[rx_id];
> >>> -staterr = rxdp->wb.upper.status_error;
> >>> -if (! (staterr & rte_cpu_to_le_32(IXGBE_RXDADV_STAT_DD)))
> >>> -break;
> >>> -rxd = *rxdp;
> >>> -
> >>> -/*
> >>> - * Descripto

[dpdk-dev] [PATCH 10/10] librte_mbuf: Apply mtod-offset.cocci transform

2015-04-29 Thread Cyril Chemparathy
This patch simply applies the transform previously committed in
scripts/cocci/mtod-offset.cocci.  No other modifications have been made here.

This patch applies on commit 9f0bf3f4a3eabd7ab5af13b4ed793c36e7615b35.  This
patch may need to be regenerated by rerunning scripts/cocci.sh instead of
simply merging in the change.

Signed-off-by: Cyril Chemparathy 
---
 app/test-pmd/ieee1588fwd.c   |  4 +-
 app/test-pmd/rxonly.c| 21 ++
 app/test-pmd/txonly.c|  4 +-
 app/test/packet_burst_generator.c|  5 ++-
 examples/dpdk_qat/crypto.c   |  8 ++--
 examples/dpdk_qat/main.c |  5 ++-
 examples/l3fwd-acl/main.c| 20 -
 examples/l3fwd-power/main.c  |  8 ++--
 examples/l3fwd-vf/main.c |  4 +-
 examples/l3fwd/main.c| 71 ++--
 examples/load_balancer/runtime.c |  4 +-
 examples/vhost_xen/main.c|  4 +-
 lib/librte_ip_frag/rte_ipv4_reassembly.c |  3 +-
 lib/librte_ip_frag/rte_ipv6_reassembly.c |  5 +--
 lib/librte_pmd_mlx4/mlx4.c   |  9 ++--
 lib/librte_port/rte_port_ras.c   |  3 +-
 lib/librte_vhost/vhost_rxtx.c|  4 +-
 17 files changed, 88 insertions(+), 94 deletions(-)

diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
index 84237c1..dfbb185 100644
--- a/app/test-pmd/ieee1588fwd.c
+++ b/app/test-pmd/ieee1588fwd.c
@@ -573,8 +573,8 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 * Check that the received PTP packet is a PTP V2 packet of type
 * PTP_SYNC_MESSAGE.
 */
-   ptp_hdr = (struct ptpv2_msg *) (rte_pktmbuf_mtod(mb, char *) +
-   sizeof(struct ether_hdr));
+   ptp_hdr = rte_pktmbuf_mtod_offset(mb, struct ptpv2_msg *,
+ sizeof(struct ether_hdr));
if (ptp_hdr->version != 0x02) {
printf("Port %u Received PTP V2 Ethernet frame with wrong PTP"
   " protocol version 0x%x (should be 0x02)\n",
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index ac56090..b8e35ab 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -175,22 +175,25 @@ pkt_burst_receive(struct fwd_stream *fs)
 /* Do not support ipv4 option field */
if (ol_flags & PKT_RX_TUNNEL_IPV4_HDR) {
l3_len = sizeof(struct ipv4_hdr);
-   ipv4_hdr = (struct ipv4_hdr *) 
(rte_pktmbuf_mtod(mb,
-   unsigned char *) + l2_len);
+   ipv4_hdr = rte_pktmbuf_mtod_offset(mb,
+  struct 
ipv4_hdr *,
+  l2_len);
l4_proto = ipv4_hdr->next_proto_id;
} else {
l3_len = sizeof(struct ipv6_hdr);
-   ipv6_hdr = (struct ipv6_hdr *) 
(rte_pktmbuf_mtod(mb,
-   unsigned char *) + l2_len);
+   ipv6_hdr = rte_pktmbuf_mtod_offset(mb,
+  struct 
ipv6_hdr *,
+  l2_len);
l4_proto = ipv6_hdr->proto;
}
if (l4_proto == IPPROTO_UDP) {
-   udp_hdr = (struct udp_hdr *) 
(rte_pktmbuf_mtod(mb,
-   unsigned char *) + l2_len + 
l3_len);
+   udp_hdr = rte_pktmbuf_mtod_offset(mb,
+ struct 
udp_hdr *,
+ l2_len + 
l3_len);
l4_len = sizeof(struct udp_hdr);
-   vxlan_hdr = (struct vxlan_hdr *) 
(rte_pktmbuf_mtod(mb,
-   unsigned char *) + l2_len + 
l3_len
-+ l4_len);
+   vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
+   struct 
vxlan_hdr *,
+   l2_len + 
l3_len + l4_len);

printf(" - VXLAN packet: packet type =%d, "
"Destination UDP port =%d, VNI = %d",
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 9e66552..f8027f1 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -110,7 +110,7 @@ copy_buf_to_pkt_segs(void* buf, unsigned len, struct 
rte_mbuf *pkt,
seg 

[dpdk-dev] [PATCH 09/10] librte_mbuf: Add transform for rte_pktmbuf_mtod_offset()

2015-04-29 Thread Cyril Chemparathy
This patch adds a coccinelle (see http://coccinelle.lip6.fr/) transform to use
the newly added rte_pktmbuf_mtod_offset() helper.  In addition, we add a
simple script to apply all available transforms to a codebase.

Signed-off-by: Cyril Chemparathy 
---
 scripts/cocci.sh| 64 ++
 scripts/cocci/mtod-offset.cocci | 76 +
 2 files changed, 140 insertions(+)
 create mode 100755 scripts/cocci.sh
 create mode 100644 scripts/cocci/mtod-offset.cocci

diff --git a/scripts/cocci.sh b/scripts/cocci.sh
new file mode 100755
index 000..3a70223
--- /dev/null
+++ b/scripts/cocci.sh
@@ -0,0 +1,64 @@
+#! /bin/sh
+
+# BSD LICENSE
+#
+# Copyright 2015 EZchip Semiconductor.
+#
+# 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 EZchip Semiconductor 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.
+
+# Apply coccinelle transforms.
+
+SRCTREE=$(readlink -f $(dirname $0)/..)
+COCCI=$SRCTREE/scripts/cocci
+[ -n "$SPATCH" ] || SPATCH=$(which spatch)
+
+PATCH_LIST="$@"
+[ -n "$PATCH_LIST" ] || PATCH_LIST=$(echo $COCCI/*.cocci)
+
+[ -x "$SPATCH" ] || (
+   echo "Coccinelle tools not installed."
+   exit 1
+)
+
+tmp=$(mktemp)
+
+for c in $PATCH_LIST; do
+   while true; do
+   echo -n "Applying $c..."
+   $SPATCH --sp-file $c -c --linux-spacing --very-quiet\
+   --include-headers --preprocess  \
+   --in-place --dir $SRCTREE > $tmp
+   if [ -s $tmp ]; then
+   echo " changes applied, retrying."
+   else
+   echo " no change."
+   break;
+   fi
+   done
+done
+
+rm -f $tmp
diff --git a/scripts/cocci/mtod-offset.cocci b/scripts/cocci/mtod-offset.cocci
new file mode 100644
index 000..13134e9
--- /dev/null
+++ b/scripts/cocci/mtod-offset.cocci
@@ -0,0 +1,76 @@
+//
+// Replace explicit packet offset computations with rte_pktmbuf_mtod_offset().
+//
+ at disable paren@
+typedef uint8_t;
+expression M, O;
+@@
+(
+- rte_pktmbuf_mtod(M, char *) + O
++ rte_pktmbuf_mtod_offset(M, char *, O)
+|
+- rte_pktmbuf_mtod(M, char *) - O
++ rte_pktmbuf_mtod_offset(M, char *, -O)
+|
+- rte_pktmbuf_mtod(M, unsigned char *) + O
++ rte_pktmbuf_mtod_offset(M, unsigned char *, O)
+|
+- rte_pktmbuf_mtod(M, unsigned char *) - O
++ rte_pktmbuf_mtod_offset(M, unsigned char *, -O)
+|
+- rte_pktmbuf_mtod(M, uint8_t *) + O
++ rte_pktmbuf_mtod_offset(M, uint8_t *, O)
+|
+- rte_pktmbuf_mtod(M, uint8_t *) - O
++ rte_pktmbuf_mtod_offset(M, uint8_t *, -O)
+)
+
+
+//
+// Fold subsequent offset terms into pre-existing offset used in
+// rte_pktmbuf_mtod_offset().
+//
+ at disable paren@
+expression M, O1, O2;
+@@
+(
+- rte_pktmbuf_mtod_offset(M, char *, O1) + O2
++ rte_pktmbuf_mtod_offset(M, char *, O1 + O2)
+|
+- rte_pktmbuf_mtod_offset(M, char *, O1) - O2
++ rte_pktmbuf_mtod_offset(M, char *, O1 - O2)
+|
+- rte_pktmbuf_mtod_offset(M, unsigned char *, O1) + O2
++ rte_pktmbuf_mtod_offset(M, unsigned char *, O1 + O2)
+|
+- rte_pktmbuf_mtod_offset(M, unsigned char *, O1) - O2
++ rte_pktmbuf_mtod_offset(M, unsigned char *, O1 - O2)
+|
+- rte_pktmbuf_mtod_offset(M, uint8_t *, O1) + O2
++ rte_pktmbuf_mtod_offset(M, uint8_t *, O1 + O2)
+|
+- rte_pktmbuf_mtod_offset(M, uint8_t *, O1) - O2
++ rte_pktmbuf_mtod_offset(M, uint8_t *, O1 - O2)
+)
+
+
+//
+// Cleanup rules.  Fold in double casts, remove unnecessary paranthesis, etc.
+//
+ at disable paren@
+expression M, O;
+type C, T;
+@@
+(
+- (C)rte_pktmbuf_mtod_offset(M, T, O)

[dpdk-dev] [PATCH 08/10] librte_mbuf: Add rte_pktmbuf_mtod_offset()

2015-04-29 Thread Cyril Chemparathy
There are a number of instances in the code where rte_pktmbuf_mtod() is used
to get the mbuf data pointer, only to add an offset before casting the result
to some other header type.  This patch adds a new rte_pktmbuf_mtod_offset()
macro to eliminate these awful double cast situations.

Signed-off-by: Cyril Chemparathy 
---
 lib/librte_mbuf/rte_mbuf.h | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 5ddd8dd..e8f1bf4 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -54,6 +54,7 @@
  */

 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1071,6 +1072,23 @@ static inline struct rte_mbuf 
*rte_pktmbuf_lastseg(struct rte_mbuf *m)
 }

 /**
+ * A macro that points to an offset into the data in the mbuf.
+ *
+ * The returned pointer is cast to type t. Before using this
+ * function, the user must ensure that m_headlen(m) is large enough to
+ * read its data.
+ *
+ * @param m
+ *   The packet mbuf.
+ * @param o
+ *   The offset into the mbuf data.
+ * @param t
+ *   The type to cast the result into.
+ */
+#define rte_pktmbuf_mtod_offset(m, t, o)   \
+   ((t)((char *)(m)->buf_addr + (m)->data_off + (o)))
+
+/**
  * A macro that points to the start of the data in the mbuf.
  *
  * The returned pointer is cast to type t. Before using this
@@ -1082,7 +1100,7 @@ static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct 
rte_mbuf *m)
  * @param t
  *   The type to cast the result into.
  */
-#define rte_pktmbuf_mtod(m, t) ((t)((char *)(m)->buf_addr + (m)->data_off))
+#define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)

 /**
  * A macro that returns the length of the packet.
-- 
2.1.2



[dpdk-dev] [PATCH 07/10] app/test: use struct ether_addr instead of a byte array cast

2015-04-29 Thread Cyril Chemparathy
This patch instantiates struct ether_addr instead of type casting a uint8_t
pointer to the same structure.  The type cast breaks on machines that enforce
strict alignment.

Signed-off-by: Cyril Chemparathy 
---
 app/test/test_pmd_perf.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index 49a494d..5810e7f 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -229,13 +229,13 @@ init_traffic(struct rte_mempool *mp,
struct ipv4_hdr pkt_ipv4_hdr;
struct udp_hdr pkt_udp_hdr;
uint32_t pktlen;
-   static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF };
-   static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA };
-
+   static struct ether_addr src_mac =
+   { { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF } };
+   static struct ether_addr dst_mac =
+   { { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA } };

initialize_eth_header(&pkt_eth_hdr,
-   (struct ether_addr *)src_mac,
-   (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0);
+   &src_mac, &dst_mac, ETHER_TYPE_IPv4, 0, 0);

pktlen = initialize_ipv4_header(&pkt_ipv4_hdr,
IPV4_ADDR(10, 0, 0, 1),
-- 
2.1.2



[dpdk-dev] [PATCH 06/10] app/test-pmd: pack simple_gre_hdr

2015-04-29 Thread Cyril Chemparathy
Not packing this causes -Wcast-align breakage on machines that are strict on
alignment.  This patch fixes this bug.

Signed-off-by: Cyril Chemparathy 
---
 app/test-pmd/csumonly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index c180ff2..eadfd2b 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -108,7 +108,7 @@ struct testpmd_offload_info {
 struct simple_gre_hdr {
uint16_t flags;
uint16_t proto;
-};
+} __attribute((packed));

 static uint16_t
 get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags)
-- 
2.1.2



[dpdk-dev] [PATCH 05/10] ethdev: silence -Wcast-align on pointer arithmetic

2015-04-29 Thread Cyril Chemparathy
Statistics offsets in the rte_stats_strings[] array are always 64-bit aligned.
However, the compiler is unaware of this fact and complains on -Wcast-align.
This patch modifies the code to use RTE_PTR_ADD(), thereby silencing the
compiler by casting through (void *).

Signed-off-by: Cyril Chemparathy 
---
 lib/librte_ether/rte_ethdev.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 024fe8b..d91068b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1742,8 +1742,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats 
*xstats,
struct rte_eth_stats eth_stats;
struct rte_eth_dev *dev;
unsigned count, i, q;
-   uint64_t val;
-   char *stats_ptr;
+   uint64_t val, *stats_ptr;

if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
@@ -1771,8 +1770,9 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats 
*xstats,

/* global stats */
for (i = 0; i < RTE_NB_STATS; i++) {
-   stats_ptr = (char *)ð_stats + rte_stats_strings[i].offset;
-   val = *(uint64_t *)stats_ptr;
+   stats_ptr = RTE_PTR_ADD(ð_stats,
+   rte_stats_strings[i].offset);
+   val = *stats_ptr;
snprintf(xstats[count].name, sizeof(xstats[count].name),
"%s", rte_stats_strings[i].name);
xstats[count++].value = val;
@@ -1781,10 +1781,10 @@ rte_eth_xstats_get(uint8_t port_id, struct 
rte_eth_xstats *xstats,
/* per-rxq stats */
for (q = 0; q < dev->data->nb_rx_queues; q++) {
for (i = 0; i < RTE_NB_RXQ_STATS; i++) {
-   stats_ptr = (char *)ð_stats;
-   stats_ptr += rte_rxq_stats_strings[i].offset;
-   stats_ptr += q * sizeof(uint64_t);
-   val = *(uint64_t *)stats_ptr;
+   stats_ptr = RTE_PTR_ADD(ð_stats,
+   rte_rxq_stats_strings[i].offset +
+   q * sizeof(uint64_t));
+   val = *stats_ptr;
snprintf(xstats[count].name, sizeof(xstats[count].name),
"rx_queue_%u_%s", q,
rte_rxq_stats_strings[i].name);
@@ -1795,10 +1795,10 @@ rte_eth_xstats_get(uint8_t port_id, struct 
rte_eth_xstats *xstats,
/* per-txq stats */
for (q = 0; q < dev->data->nb_tx_queues; q++) {
for (i = 0; i < RTE_NB_TXQ_STATS; i++) {
-   stats_ptr = (char *)ð_stats;
-   stats_ptr += rte_txq_stats_strings[i].offset;
-   stats_ptr += q * sizeof(uint64_t);
-   val = *(uint64_t *)stats_ptr;
+   stats_ptr = RTE_PTR_ADD(ð_stats,
+   rte_txq_stats_strings[i].offset +
+   q * sizeof(uint64_t));
+   val = *stats_ptr;
snprintf(xstats[count].name, sizeof(xstats[count].name),
"tx_queue_%u_%s", q,
rte_txq_stats_strings[i].name);
-- 
2.1.2



[dpdk-dev] [PATCH 04/10] mbuf: silence -Wcast-align on pointer arithmetic

2015-04-29 Thread Cyril Chemparathy
Translating from an mbuf element to the mbuf pointer does not break alignment
constraints.  However, the compiler is unaware of this fact and complains on
-Wcast-align.  This patch modifies the code to use RTE_PTR_SUB(), thereby
silencing the compiler by casting through (void *).

Signed-off-by: Cyril Chemparathy 
---
 lib/librte_mbuf/rte_mbuf.h | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 70b0987..5ddd8dd 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -337,13 +337,7 @@ static inline uint16_t rte_pktmbuf_priv_size(struct 
rte_mempool *mp);
 static inline struct rte_mbuf *
 rte_mbuf_from_indirect(struct rte_mbuf *mi)
 {
-   struct rte_mbuf *md;
-
-   /* mi->buf_addr and mi->priv_size correspond to buffer and
-* private size of the direct mbuf */
-   md = (struct rte_mbuf *)((char *)mi->buf_addr - sizeof(*mi) -
-   mi->priv_size);
-   return md;
+   return RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) + mi->priv_size);
 }

 /**
-- 
2.1.2



[dpdk-dev] [PATCH 03/10] hash: silence -Wcast-align on pointer arithmetic

2015-04-29 Thread Cyril Chemparathy
Since sig_tbl_bucket_size and key_tbl_key_size are explicitly aligned at
initialization, offset dereferences in the hash table code cannot possibly be
unaligned.  However, the compiler is unaware of this fact and complains on
-Wcast-align.  This patch modifies the code to use RTE_PTR_ADD(), thereby
silencing the compiler by casting through (void *).

Signed-off-by: Cyril Chemparathy 
---
 lib/librte_hash/rte_hash.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_hash/rte_hash.c b/lib/librte_hash/rte_hash.c
index 9245716..67dff5b 100644
--- a/lib/librte_hash/rte_hash.c
+++ b/lib/librte_hash/rte_hash.c
@@ -96,23 +96,23 @@ EAL_REGISTER_TAILQ(rte_hash_tailq)
 static inline hash_sig_t *
 get_sig_tbl_bucket(const struct rte_hash *h, uint32_t bucket_index)
 {
-   return (hash_sig_t *)
-   &(h->sig_tbl[bucket_index * h->sig_tbl_bucket_size]);
+   return RTE_PTR_ADD(h->sig_tbl, (bucket_index *
+   h->sig_tbl_bucket_size));
 }

 /* Returns a pointer to the first key in specified bucket. */
 static inline uint8_t *
 get_key_tbl_bucket(const struct rte_hash *h, uint32_t bucket_index)
 {
-   return (uint8_t *) &(h->key_tbl[bucket_index * h->bucket_entries *
-h->key_tbl_key_size]);
+   return RTE_PTR_ADD(h->key_tbl, (bucket_index * h->bucket_entries *
+   h->key_tbl_key_size));
 }

 /* Returns a pointer to a key at a specific position in a specified bucket. */
 static inline void *
 get_key_from_bucket(const struct rte_hash *h, uint8_t *bkt, uint32_t pos)
 {
-   return (void *) &bkt[pos * h->key_tbl_key_size];
+   return RTE_PTR_ADD(bkt, pos * h->key_tbl_key_size);
 }

 /* Does integer division with rounding-up of result. */
-- 
2.1.2



[dpdk-dev] [PATCH 02/10] mempool: silence -Wcast-align on pointer arithmetic

2015-04-29 Thread Cyril Chemparathy
Translating from a mempool object to the mempool pointer does not break
alignment constraints.  However, the compiler is unaware of this fact and
complains on -Wcast-align.  This patch modifies the code to use RTE_PTR_SUB(),
thereby silencing the compiler by casting through (void *).

Signed-off-by: Cyril Chemparathy 
---
 lib/librte_mempool/rte_mempool.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 9001312..1fb4184 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -236,15 +236,13 @@ struct rte_mempool {
  */
 static inline struct rte_mempool **__mempool_from_obj(void *obj)
 {
-   struct rte_mempool **mpp;
unsigned off;

off = sizeof(struct rte_mempool *);
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
off += sizeof(uint64_t);
 #endif
-   mpp = (struct rte_mempool **)((char *)obj - off);
-   return mpp;
+   return RTE_PTR_SUB(obj, off);
 }

 /**
-- 
2.1.2



[dpdk-dev] [PATCH 01/10] eal: add and use unaligned integer types

2015-04-29 Thread Cyril Chemparathy
On machines that are strict on pointer alignment, current code breaks on GCC's
-Wcast-align checks on casts from narrower to wider types.  This patch
introduces new unaligned_uint(16|32|64)_t types, which correctly retain
alignment in such cases.

This is currently unimplemented on ICC and clang, and equivalents will need to
be plugged in.

Signed-off-by: Cyril Chemparathy 
---
 app/test-pmd/flowgen.c |  4 ++--
 app/test-pmd/txonly.c  |  2 +-
 app/test/packet_burst_generator.c  |  4 ++--
 app/test/test_mbuf.c   | 16 
 lib/librte_eal/common/include/rte_common.h | 10 ++
 lib/librte_ether/rte_ether.h   |  2 +-
 lib/librte_ip_frag/rte_ipv4_reassembly.c   |  4 ++--
 7 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 72016c9..174c003 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -101,7 +101,7 @@ tx_mbuf_alloc(struct rte_mempool *mp)


 static inline uint16_t
-ip_sum(const uint16_t *hdr, int hdr_len)
+ip_sum(const unaligned_uint16_t *hdr, int hdr_len)
 {
uint32_t sum = 0;

@@ -193,7 +193,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
   next_flow);
ip_hdr->total_length= RTE_CPU_TO_BE_16(pkt_size -
   sizeof(*eth_hdr));
-   ip_hdr->hdr_checksum= ip_sum((uint16_t *)ip_hdr,
+   ip_hdr->hdr_checksum= ip_sum((unaligned_uint16_t *)ip_hdr,
 sizeof(*ip_hdr));

/* Initialize UDP header. */
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index ca32c85..9e66552 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -167,7 +167,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr,
/*
 * Compute IP header checksum.
 */
-   ptr16 = (uint16_t*) ip_hdr;
+   ptr16 = (unaligned_uint16_t*) ip_hdr;
ip_cksum = 0;
ip_cksum += ptr16[0]; ip_cksum += ptr16[1];
ip_cksum += ptr16[2]; ip_cksum += ptr16[3];
diff --git a/app/test/packet_burst_generator.c 
b/app/test/packet_burst_generator.c
index b46eed7..06762c6 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -154,7 +154,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t 
src_addr,
uint32_t dst_addr, uint16_t pkt_data_len)
 {
uint16_t pkt_len;
-   uint16_t *ptr16;
+   unaligned_uint16_t *ptr16;
uint32_t ip_cksum;

/*
@@ -175,7 +175,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t 
src_addr,
/*
 * Compute IP header checksum.
 */
-   ptr16 = (uint16_t *)ip_hdr;
+   ptr16 = (unaligned_uint16_t *)ip_hdr;
ip_cksum = 0;
ip_cksum += ptr16[0]; ip_cksum += ptr16[1];
ip_cksum += ptr16[2]; ip_cksum += ptr16[3];
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 5e8a377..d9beb29 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -333,7 +333,7 @@ testclone_testupdate_testdetach(void)
struct rte_mbuf *m = NULL;
struct rte_mbuf *clone = NULL;
struct rte_mbuf *clone2 = NULL;
-   uint32_t *data;
+   unaligned_uint32_t *data;

/* alloc a mbuf */
m = rte_pktmbuf_alloc(pktmbuf_pool);
@@ -344,7 +344,7 @@ testclone_testupdate_testdetach(void)
GOTO_FAIL("Bad length");

rte_pktmbuf_append(m, sizeof(uint32_t));
-   data = rte_pktmbuf_mtod(m, uint32_t *);
+   data = rte_pktmbuf_mtod(m, unaligned_uint32_t *);
*data = MAGIC_DATA;

/* clone the allocated mbuf */
@@ -352,7 +352,7 @@ testclone_testupdate_testdetach(void)
if (clone == NULL)
GOTO_FAIL("cannot clone data\n");

-   data = rte_pktmbuf_mtod(clone, uint32_t *);
+   data = rte_pktmbuf_mtod(clone, unaligned_uint32_t *);
if (*data != MAGIC_DATA)
GOTO_FAIL("invalid data in clone\n");

@@ -369,18 +369,18 @@ testclone_testupdate_testdetach(void)
GOTO_FAIL("Next Pkt Null\n");

rte_pktmbuf_append(m->next, sizeof(uint32_t));
-   data = rte_pktmbuf_mtod(m->next, uint32_t *);
+   data = rte_pktmbuf_mtod(m->next, unaligned_uint32_t *);
*data = MAGIC_DATA;

clone = rte_pktmbuf_clone(m, pktmbuf_pool);
if (clone == NULL)
GOTO_FAIL("cannot clone data\n");

-   data = rte_pktmbuf_mtod(clone, uint32_t *);
+   data = rte_pktmbuf_mtod(clone, unaligned_uint32_t *);
if (*data != MAGIC_DATA)
GOTO_FAIL("invalid data in clone\n");

-   data = rte_pktmbuf_mtod(clone->next, uint32_t *);
+   data = rte_pktmbuf_mtod(clone->next, unaligned_uint32_t *);
if (*data != MAGIC_DATA)
GOTO_FAIL("invalid data in clone->next\n")

[dpdk-dev] [PATCH 00/10] Improve cast alignment for strict aligned machines

2015-04-29 Thread Cyril Chemparathy
This series contains a few improvements that allow the DPDK code base to build
properly on machines that enforce strict pointer cast alignment constraints.

When dealing with packet data which could be arbitrarily aligned, we get the
compiler to do the right thing by (a) making sure that header types are
packed, and (b) introducing and using unaligned_uint(16|32|64)_t types when
upcasting from byte pointers.

In a few other instances, we know apriori that the pointer cast cannot
possibly break alignment.  This applies to the changes in mempool, hash, mbuf,
and the ethdev stats code.  Here, we simply silence the compiler by casting
through (void *) using the RTE_PTR_(ADD|SUB) macros.

Finally, we introduce a new rte_pktmbuf_mtod_offset() helper to return a type
casted pointer to an offset within the packet data.  This replaces the
following commonly used pattern:
(struct foo *)(rte_pktmbuf_mtod(m, char *) + offset)
with:
rte_pktmbuf_mtod_offset(m, struct foo *, offset)
To ensure consistency, the above transform was applied throughout the code
base using the coccinelle semantic patching tool.

Cyril Chemparathy (10):
  eal: add and use unaligned integer types
  mempool: silence -Wcast-align on pointer arithmetic
  hash: silence -Wcast-align on pointer arithmetic
  mbuf: silence -Wcast-align on pointer arithmetic
  ethdev: silence -Wcast-align on pointer arithmetic
  app/test-pmd: pack simple_gre_hdr
  app/test: use struct ether_addr instead of a byte array cast
  librte_mbuf: Add rte_pktmbuf_mtod_offset()
  librte_mbuf: Add transform for rte_pktmbuf_mtod_offset()
  librte_mbuf: Apply mtod-offset.cocci transform

 app/test-pmd/csumonly.c|  2 +-
 app/test-pmd/flowgen.c |  4 +-
 app/test-pmd/ieee1588fwd.c |  4 +-
 app/test-pmd/rxonly.c  | 21 +
 app/test-pmd/txonly.c  |  6 +--
 app/test/packet_burst_generator.c  |  9 ++--
 app/test/test_mbuf.c   | 16 +++
 app/test/test_pmd_perf.c   | 10 ++--
 examples/dpdk_qat/crypto.c |  8 ++--
 examples/dpdk_qat/main.c   |  5 +-
 examples/l3fwd-acl/main.c  | 20 
 examples/l3fwd-power/main.c|  8 ++--
 examples/l3fwd-vf/main.c   |  4 +-
 examples/l3fwd/main.c  | 71 
 examples/load_balancer/runtime.c   |  4 +-
 examples/vhost_xen/main.c  |  4 +-
 lib/librte_eal/common/include/rte_common.h | 10 
 lib/librte_ether/rte_ethdev.c  | 24 +-
 lib/librte_ether/rte_ether.h   |  2 +-
 lib/librte_hash/rte_hash.c | 10 ++--
 lib/librte_ip_frag/rte_ipv4_reassembly.c   |  7 ++-
 lib/librte_ip_frag/rte_ipv6_reassembly.c   |  5 +-
 lib/librte_mbuf/rte_mbuf.h | 28 +++
 lib/librte_mempool/rte_mempool.h   |  4 +-
 lib/librte_pmd_mlx4/mlx4.c |  9 ++--
 lib/librte_port/rte_port_ras.c |  3 +-
 lib/librte_vhost/vhost_rxtx.c  |  4 +-
 scripts/cocci.sh   | 64 +
 scripts/cocci/mtod-offset.cocci| 76 ++
 29 files changed, 298 insertions(+), 144 deletions(-)
 create mode 100755 scripts/cocci.sh
 create mode 100644 scripts/cocci/mtod-offset.cocci

-- 
2.1.2



[dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk.

2015-04-29 Thread Gonzalez Monroy, Sergio
On 28/04/2015 17:50, Wiles, Keith wrote:
> Hi Sergio
>
> On 4/28/15, 11:25 AM, "Gonzalez Monroy, Sergio"
>  wrote:
>
>> On 28/04/2015 16:21, Keith Wiles wrote:
>>> Trying to simplify the ifdefs in rte.app.mk to make the code
>>> more readable and maintainable by moving LDLIBS variable to use
>>> the same style as LDLIBS-y being used in the rest of the code.
>>>
>>> Signed-off-by: Keith Wiles 
>>> ---
>> +1
>>
>> Patch looks good, just a few nits:
>>>mk/rte.app.mk | 253
>>> ++
>>>mk/rte.hostapp.mk |   4 +-
>>>mk/rte.shared.mk  |  12 +--
>>>3 files changed, 74 insertions(+), 195 deletions(-)
>>>
>>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
>>> index 62a76ae..af38975 100644
>>> --- a/mk/rte.app.mk
>>> +++ b/mk/rte.app.mk
>>> @@ -1,7 +1,7 @@
>>>#   BSD LICENSE
>>>#
>>> -#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
>>> -#   Copyright(c) 2014 6WIND S.A.
>>> +#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
>>> +#   Copyright(c) 2015 6WIND S.A.
>>>#   All rights reserved.
>>>#
>>>#   Redistribution and use in source and binary forms, with or without
>>> @@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
>>>endif
>>>
>>># default path for libs
>>> -LDLIBS += -L$(RTE_SDK_BIN)/lib
>>> +LDLIBS-y = -L$(RTE_SDK_BIN)/lib
>>>
>> I think we should keep the current value of LDLIBS.
>> Some apps (ie. examples/dpdk_qat ) preset LDLIBS before including
>> rte.app.mk.
> I just modified the example apps to use a new VARIABLE called EXTRA_LDLIBS
> instead and added it towards the bottom of rte.app.mk. I think adding the
> EXTRA_LDLIBS is the right solution instead of using LDLIBS IMO.
Fair enough :)

I suppose is semantics, and I may be wrong here, but my understanding 
was that EXTRA_ vars were to be used from the command line to pass 
additional flags and/or override certain default flags, and that 
CFLAGS/LDFLAGS/LDLIBS were used from each app/example makefile to 
specify their own flags.

IMO we could achieve the correct order (ie. example/app 
CFLAGS/LDFLAGS/LDLIBS being added at the end to override default flags) 
without using EXTRA_ vars from makefiles. Regarding this patch it 
would be pretty simple by just adding LDLIBS at the end of LDLIBS-y.

Sergio
>>>#
>>># Include libraries depending on config if NO_AUTOLIBS is not set
>>> @@ -59,215 +59,94 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
>>>#
>>>ifeq ($(NO_AUTOLIBS),)
>>>
>>> -LDLIBS += --whole-archive
>>> +LDLIBS-y += --whole-archive
>>>
>>> -ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
>>> -LDLIBS += -l$(RTE_LIBNAME)
>>> -endif
>>> +LDLIBS-CONFIG_RTE_BUILD_COMBINE_LIBS)  += -l$(RTE_LIBNAME)
>>>
>> I think here is missing $( before CONFIG.
> Ooops :-)
>>>ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
>>>
>>> -ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
>>> -LDLIBS += -lrte_distributor
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
>>> -LDLIBS += -lrte_reorder
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
>>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
>>> -LDLIBS += -lrte_kni
>>> -endif
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
>>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
>>> -LDLIBS += -lrte_ivshmem
>>> -endif
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
>>> -LDLIBS += -lrte_pipeline
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
>>> -LDLIBS += -lrte_table
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
>>> -LDLIBS += -lrte_port
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
>>> -LDLIBS += -lrte_timer
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
>>> -LDLIBS += -lrte_hash
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
>>> -LDLIBS += -lrte_jobstats
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
>>> -LDLIBS += -lrte_lpm
>>> -endif
>>> -
>>> -ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
>>> -LDLIBS += -lrte_power
>>> -endif
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)+= -lrte_distributor
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)+= -lrte_reorder
>>>
>>> -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
>>> -LDLIBS += -lrte_acl
>>> +ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)+= -lrte_kni
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)+= -lrte_ivshmem
>>>endif
>>>
>>> -ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
>>> -LDLIBS += -lrte_meter
>>> -endif
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)   += -lrte_pipeline
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)  += -lrte_table
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)   += -lrte_port
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)  += -lrte_timer
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)   += -lrte_hash
>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)   += -lrte_jobstats
>>> +LDLIBS-$(CONFIG_RTE_LIB

[dpdk-dev] [PATCH] vfio: eventfd should be non-block and not inherited

2015-04-29 Thread Stephen Hemminger
Set internal event file descriptor to be non-block and not
inherited across exec.  This prevents accidental hangs and
passing in anothr thread.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
index aea1fb1..426953a 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
@@ -294,7 +294,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int 
vfio_dev_fd)
}

/* set up an eventfd for interrupts */
-   fd = eventfd(0, 0);
+   fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
if (fd < 0) {
RTE_LOG(ERR, EAL, "  cannot set up eventfd, "
"error %i (%s)\n", errno, 
strerror(errno));
-- 
2.1.4



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

2015-04-29 Thread Neil Horman
On Tue, Apr 28, 2015 at 04:46:21PM -0700, Ravi Kerur wrote:
> Changes in v8 includes
> Re-ordering source file compilation to fix ABI warning.
> Ran validate-abi against x86_64-native-linuxapp-gcc,
> x86_64-native-linuxapp-clang and x86_64-ivshmem-linuxapp-gcc
> environments.
> 
> Testing:
> Linux - Ubuntu x86_64 14.04
> Compilation successful (x86_64-native-linuxapp-gcc and
> x86_64-native-linuxapp-clang).
> "make test" results match baseline code.
> testpmd utility on I217/I218 Intel chipset.
> 
> FreeBSD 10.0 x86_64
> Compilation successful (x86_64-native-bsdapp-gcc and
> x86_64-native-bsdapp-clang).
> Tested with helloworld, timer and cmdline examples.
> 
> Ravi Kerur (6):
>   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
>   Move common functions in eal_pci.c
> 
>  lib/librte_eal/bsdapp/eal/Makefile   |   9 +-
>  lib/librte_eal/bsdapp/eal/eal.c  | 271 +++-
>  lib/librte_eal/bsdapp/eal/eal_lcore.c|  72 ++-
>  lib/librte_eal/bsdapp/eal/eal_memory.c   |  47 ++---
>  lib/librte_eal/bsdapp/eal/eal_pci.c  |  72 +--
>  lib/librte_eal/bsdapp/eal/eal_thread.c   | 152 --
>  lib/librte_eal/bsdapp/eal/eal_timer.c|  52 +
>  lib/librte_eal/common/eal_common_app_usage.c |  63 ++
>  lib/librte_eal/common/eal_common_lcore.c | 107 ++
>  lib/librte_eal/common/eal_common_mem_cfg.c   | 224 
>  lib/librte_eal/common/eal_common_memory.c|  38 +++-
>  lib/librte_eal/common/eal_common_pci.c   |  72 +++
>  lib/librte_eal/common/eal_common_proc_type.c |  58 ++
>  lib/librte_eal/common/eal_common_sysfs.c | 148 ++
>  lib/librte_eal/common/eal_common_thread.c| 147 -
>  lib/librte_eal/common/eal_common_timer.c | 102 +
>  lib/librte_eal/common/eal_hugepages.h|   1 +
>  lib/librte_eal/common/eal_private.h  | 171 +++-
>  lib/librte_eal/common/include/rte_eal.h  |   4 +
>  lib/librte_eal/linuxapp/eal/Makefile |  10 +-
>  lib/librte_eal/linuxapp/eal/eal.c| 296 
> ---
>  lib/librte_eal/linuxapp/eal/eal_lcore.c  |  66 +-
>  lib/librte_eal/linuxapp/eal/eal_memory.c |  36 +---
>  lib/librte_eal/linuxapp/eal/eal_pci.c|  75 +--
>  lib/librte_eal/linuxapp/eal/eal_thread.c | 152 +-
>  lib/librte_eal/linuxapp/eal/eal_timer.c  |  55 +
>  26 files changed, 1277 insertions(+), 1223 deletions(-)
>  create mode 100644 lib/librte_eal/common/eal_common_app_usage.c
>  create mode 100644 lib/librte_eal/common/eal_common_lcore.c
>  create mode 100644 lib/librte_eal/common/eal_common_mem_cfg.c
>  create mode 100644 lib/librte_eal/common/eal_common_proc_type.c
>  create mode 100644 lib/librte_eal/common/eal_common_sysfs.c
>  create mode 100644 lib/librte_eal/common/eal_common_timer.c
> 
> -- 
> 1.9.1
> 
> 

Series
Acked-by: Neil Horman 



[dpdk-dev] [PATCH v7 1/6] Move common functions in eal_thread.c

2015-04-29 Thread Neil Horman
On Tue, Apr 28, 2015 at 04:52:37PM -0700, Ravi Kerur wrote:
> On Tue, Apr 28, 2015 at 12:35 PM, Neil Horman  
> wrote:
> 
> > On Mon, Apr 27, 2015 at 03:39:41PM -0700, Ravi Kerur wrote:
> > > On Mon, Apr 27, 2015 at 6:44 AM, Neil Horman 
> > wrote:
> > >
> > > > On Sat, Apr 25, 2015 at 05:09:01PM -0700, Ravi Kerur wrote:
> > > > > On Sat, Apr 25, 2015 at 6:02 AM, Neil Horman  > > > > tuxdriver.com>
> > > > wrote:
> > > > >
> > > > > > On Sat, Apr 25, 2015 at 08:32:42AM -0400, Neil Horman wrote:
> > > > > > > On Fri, Apr 24, 2015 at 06:45:06PM -0700, Ravi Kerur wrote:
> > > > > > > > On Fri, Apr 24, 2015 at 2:24 PM, Ravi Kerur  > > > > > > > gmail.com>
> > > > wrote:
> > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Fri, Apr 24, 2015 at 12:51 PM, Neil Horman <
> > > > nhorman at tuxdriver.com
> > > > > > >
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > >> On Fri, Apr 24, 2015 at 12:21:23PM -0700, Ravi Kerur wrote:
> > > > > > > > >> > On Fri, Apr 24, 2015 at 11:53 AM, Neil Horman <
> > > > > > nhorman at tuxdriver.com>
> > > > > > > > >> wrote:
> > > > > > > > >> >
> > > > > > > > >> > > On Fri, Apr 24, 2015 at 09:45:24AM -0700, Ravi Kerur
> > wrote:
> > > > > > > > >> > > > On Fri, Apr 24, 2015 at 8:22 AM, Neil Horman <
> > > > > > nhorman at tuxdriver.com
> > > > > > > > >> >
> > > > > > > > >> > > wrote:
> > > > > > > > >> > > >
> > > > > > > > >> > > > > On Fri, Apr 24, 2015 at 08:14:04AM -0700, Ravi Kerur
> > > > wrote:
> > > > > > > > >> > > > > > On Fri, Apr 24, 2015 at 6:51 AM, Neil Horman <
> > > > > > > > >> nhorman at tuxdriver.com>
> > > > > > > > >> > > > > wrote:
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > > > > On Thu, Apr 23, 2015 at 02:35:31PM -0700, Ravi
> > Kerur
> > > > > > wrote:
> > > > > > > > >> > > > > > > > Changes in v7
> > > > > > > > >> > > > > > > > Remove _setname_ pthread calls.
> > > > > > > > >> > > > > > > > Use rte_gettid() API in RTE_LOG to print
> > > > thread_id.
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > Changes in v6
> > > > > > > > >> > > > > > > > Remove RTE_EXEC_ENV_BSDAPP from
> > > > eal_common_thread.c
> > > > > > file.
> > > > > > > > >> > > > > > > > Add pthread_setname_np/pthread_set_name_np for
> > > > > > Linux/FreeBSD
> > > > > > > > >> > > > > > > > respectively. Plan to use _getname_ in RTE_LOG
> > > > when
> > > > > > > > >> available.
> > > > > > > > >> > > > > > > > Use existing rte_get_systid() in RTE_LOG to
> > print
> > > > > > thread_id.
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > Changes in v5
> > > > > > > > >> > > > > > > > Rebase to latest code.
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > Changes in v4
> > > > > > > > >> > > > > > > > None
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > Changes in v3
> > > > > > > > >> > > > > > > > Changed subject to be more explicit on file
> > name
> > > > > > inclusion.
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > Changes in v2
> > > > > > > > >> > > > > > > > None
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > Changes in v1
> > > > > > > > >> > > > > > > > eal_thread.c has minor differences between
> > Linux
> > > > and
> > > > > > BSD,
> > > > > > > > >> move
> > > > > > > > >> > > > > > > > entire file into 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|
> >  2
> > > > +-
> > > > > > > > >> > > > > > > >  lib/librte_eal/bsdapp/eal/eal_thread.c|
> > 152
> > > > > > > > >> > > > > > > --
> > > > > > > > >> > > > > > > >  lib/librte_eal/common/eal_common_thread.c |
> > 147
> > > > > > > > >> > > > > > > -
> > > > > > > > >> > > > > > > >  lib/librte_eal/linuxapp/eal/eal_thread.c  |
> > 152
> > > > > > > > >> > > > > > > +-
> > > > > > > > >> > > > > > > >  4 files changed, 148 insertions(+), 305
> > > > deletions(-)
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > diff --git
> > a/lib/librte_eal/bsdapp/eal/Makefile
> > > > > > > > >> > > > > > > b/lib/librte_eal/bsdapp/eal/Makefile
> > > > > > > > >> > > > > > > > index 2357cfa..55971b9 100644
> > > > > > > > >> > > > > > > > --- a/lib/librte_eal/bsdapp/eal/Makefile
> > > > > > > > >> > > > > > > > +++ b/lib/librte_eal/bsdapp/eal/Makefile
> > > > > > > > >> > > > > > > > @@ -87,7 +87,7 @@ CFLAGS_eal_common_log.o :=
> > > > > > -D_GNU_SOURCE
> > > > > > > > >> > > > > >

[dpdk-dev] [PATCH 1/3] pcap: utilize underlying real interface properties

2015-04-29 Thread Nicolás Pernas Maradei
Hi Tero,

Just a few comments on one of your patches - see inline comments below. 
Interesting features btw.

Nico.

--?
Nicol?s Pernas Maradei


On 27 February 2015 at 13:43:14, dev-request at dpdk.org (dev-request at 
dpdk.org) wrote:

Message: 5?
Date: Fri, 27 Feb 2015 15:42:38 +0200?
From: Tero Aho ?
To: ?
Subject: [dpdk-dev] [PATCH 1/3] pcap: utilize underlying real?
interface   properties?
Message-ID: <1425044560-23397-2-git-send-email-tero.aho at coriant.com>?
Content-Type: text/plain?

These changes set pcap interface mac address to the real underlying?
interface address instead of the default one. Also real interface link?
status, speed and duplex are reported when eth_link_update is called?
for the pcap interface.?

Signed-off-by: Tero Aho ?
---?
lib/librte_pmd_pcap/rte_eth_pcap.c | 51 +++---?
1 file changed, 47 insertions(+), 4 deletions(-)?

diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c 
b/lib/librte_pmd_pcap/rte_eth_pcap.c?
index 5e94930..289af28 100644?
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c?
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c?
@@ -43,6 +43,11 @@?
#include ?

#include ?
+#include ?
+#include ?
+#include ?
+#include ?
+#include ?

#include ?

@@ -102,6 +107,8 @@ struct pmd_internals {?
unsigned nb_tx_queues;?
int if_index;?
int single_iface;?
+ const char *if_name;?
+ int if_fd;?
};?

const char *valid_arguments[] = {?
@@ -451,6 +458,26 @@ static int?
eth_link_update(struct rte_eth_dev *dev __rte_unused,?
*dev is being used. Remove __rte_unused


int wait_to_complete __rte_unused)?
{?
+ struct ifreq ifr;?
+ struct ethtool_cmd cmd;?
+ struct pmd_internals *internals = dev->data->dev_private;?
+?
+ if (internals->if_name && (internals->if_fd != -1)) {?
+ /* get link status, speed and duplex from the underlying interface */?
+?
+ strncpy(ifr.ifr_name, internals->if_name, sizeof(ifr.ifr_name)-1);?
+ ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0;?
Use snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), ?%s?, internals->if_name) 
instead. It?s safer and cleaner.


+ if (!ioctl(internals->if_fd, SIOCGIFFLAGS, &ifr))?
+ dev->data->dev_link.link_status = (ifr.ifr_flags & IFF_UP) ? 1 : 0;?
+?
+ cmd.cmd = ETHTOOL_GSET;?
+ ifr.ifr_data = (void *)&cmd;?
+ if (!ioctl(internals->if_fd, SIOCETHTOOL, &ifr)) {?
+ dev->data->dev_link.link_speed = ethtool_cmd_speed(&cmd);?
+ dev->data->dev_link.link_duplex =?
+ cmd.duplex ? ETH_LINK_FULL_DUPLEX : ETH_LINK_HALF_DUPLEX;?
+ }?
+ }?
return 0;?
}?

@@ -736,11 +763,24 @@ rte_pmd_init_internals(const char *name, const unsigned 
nb_rx_queues,?
(*internals)->nb_rx_queues = nb_rx_queues;?
(*internals)->nb_tx_queues = nb_tx_queues;?

- if (pair == NULL)?
+ if (pair == NULL) {?
(*internals)->if_index = 0;?
- else?
+ } else {?
+ /* use real inteface mac addr, save name and fd for eth_link_update */?
(*internals)->if_index = if_nametoindex(pair->value);?
-?
+ (*internals)->if_name = strdup(pair->value);?
+ (*internals)->if_fd = socket(AF_INET, SOCK_DGRAM, 0);?
I see you are using a socket and ioctl calls to get the info you need from the 
interface. I?m not a big fan of opening a socket at this point just to get some 
parameters of the NIC. I?d rather reading those from sysfs. Is there a reason 
why you?d prefer to open a socket?

These would be the files you?d need to open and read to the get the info you 
are looking for.?

# cat /sys/class/net/eth0/address
# cat /sys/class/net/eth0/duplex
# cat /sys/class/net/eth0/speed

In my opinion the code would be cleaner doing it this way. DPDK already 
manipulates?sysfs in other places too.?
What do you think?


+ if ((*internals)->if_fd != -1) {?
+ struct ifreq ifr;?
+ strncpy(ifr.ifr_name, pair->value, sizeof(ifr.ifr_name)-1);?
+ ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0;?
Use snprintf() like before.


+ if (!ioctl((*internals)->if_fd, SIOCGIFHWADDR, &ifr)) {?
+ data->mac_addrs = rte_zmalloc_socket(NULL, ETHER_ADDR_LEN, 0, numa_node);?
+ if (data->mac_addrs)?
+ rte_memcpy(data->mac_addrs, ifr.ifr_addr.sa_data, ETHER_ADDR_LEN);?
+ }?
+ }?
+ }?
pci_dev->numa_node = numa_node;?

data->dev_private = *internals;?
@@ -749,7 +789,8 @@ rte_pmd_init_internals(const char *name, const unsigned 
nb_rx_queues,?
data->nb_rx_queues = (uint16_t)nb_rx_queues;?
data->nb_tx_queues = (uint16_t)nb_tx_queues;?
data->dev_link = pmd_link;?
- data->mac_addrs = ð_addr;?
+ if (data->mac_addrs == NULL)?
+ data->mac_addrs = ð_addr;?
strncpy(data->name,?
(*eth_dev)->data->name, strlen((*eth_dev)->data->name));?

@@ -758,6 +799,8 @@ rte_pmd_init_internals(const char *name, const unsigned 
nb_rx_queues,?
(*eth_dev)->pci_dev = pci_dev;?
(*eth_dev)->driver = &rte_pcap_pmd;?

+ eth_link_update((*eth_dev), 0);?
+?
return 0;?

error: if (data)?
--?
1.9.1?


?
The information contained in this message may be privileged?
and confidential and protected from disclosure. If the reader?
of this message is not the intended recipient, or an employee?
or agent responsible for deliverin