[dpdk-dev] KNI interface is not coming up

2015-04-30 Thread Venkat Thummala
Hi Robert,

Thanks a lot, it fixed the issue.

Regards
Venkat

On 30 April 2015 at 20:11, Sanford, Robert  wrote:

> Hi Venkat,
>
> Perhaps your DPDK application needs to slow-poll KNI devices via
> rte_kni_handle_request( ).
>
> http://dpdk.org/doc/api/rte__kni_8h.html
>
> --
> Regards,
> Robert
>
>
> >Hi,
> >
> >I am testing DPDK 2.0 release.
> >I am not able to bring the KNI interface up.
> >It always gives the following error.
> >
> >SIOCSIFFLAGS: Timer expired
> >
> >This is on Ubuntu,
> >
> >Linux vthummala-PowerEdge-R720 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10
> >19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
> >
> >Please let me know, how we could resolve this issue.
> >
> >Regards
> >Venkat
>
>


[dpdk-dev] Beyond DPDK 2.0

2015-04-30 Thread Wiles, Keith
Darn forgot the site link, below.

On 4/30/15, 4:31 PM, "Wiles, Keith"  wrote:

>
>(I snipped out the content here only because it had been snipped a lot
>already)
>
>Sorry, if I am highjacking the thread.
>
>I believe the DPDK community would benefit from moving to GitHub as the
>primary DPDK site. http://github.com
>
>I believe the DPDK community can benefit from being at a very well know
>world wide site. GitHub seems to have the most eyes of any of the open
>source Git repos today and it appears they have more then twice as many
>developers. GitHub has a number of features I see as some good additions
>to
>our community using the GitHub organization account type.
>
>The cost for an organization account is $0 as long as we do not need more
>then 5 private repos. 10 private repos is $25/month and has other plans
>for more. I do not see us needing more then 5 private repos today and the
>only reason I can see having a private repo is to do some prep work on the
>repo before making public. Every contributor would need to create a GitHub
>personal account, which is at no cost unless you need more then 5 private
>repos. In both accounts you can have unlimited public repos.
>
>https://help.github.com/articles/where-can-i-find-open-source-projects-to-
>w
>ork-on/
>
>http://www.sitepoint.com/using-git-open-source-projects/
>
>- Adding more committers can lead to a security problems for 6Wind (I
>assume).
>- 6Wind appearing to own DPDK.org is not a good message to the community.
>  - Not assuming 6Wind?s dpdk.org site will disappear only where the
>community stores the master repos and how the community interacts with the
>master.
>- Permission and access levels in dpdk.org is only one level and we can
>benefit from having 4 levels and teams as well.
>- The patch process today suffers from timely reviews, which will not be
>fixed by moving.
>  - GitHub has a per pull request discussions area, which gives a clean
>way to
>review all discussions on a specific change.
>- The current patch model is clone dpdk.org/modify/commit/send patch
>set
>- The model with GitHub is fork on GitHub/modify/commit/send pull
>request
>- The patchwork web site is reasonable, but has some draw backs in
>maintaining the site.
>  - GitHub manages the patches via pull requests and can be easily seen
>via a web browser.
>  - The down side is you do have to use a web browser to do some work, but
>the everyday work would be done as it is today.
>- I think we all have a web browser now :-)
>- GitHub has team support and gives a group better control plus
>collaboration is much easier as we have a external location to work.
>  - Most companies have some pretty high security level and being to
>collaborate between two or more companies is very difficult if one company
>is hosting the repo behind a firewall.
>  - Using GitHub and teams would make collaboration a lot easier or
>collaboration between two or more user accounts as well.
>- GitHub has a Web Page system, which can be customized for the community
>needs via a public or private repo.
>- We still need a dpdk.org email list I believe as I did not find one at
>GitHub.
>  - We can also forward GitHub emails to the list.
>  - I believe you can reply to an email from GitHub and the email will get
>appended to the discussion thread.
>
>As most do not like to read long emails :-) I will stop here and add one
>more thing.
>
>I have create a sandbox on GitHub for anyone to play with using GitHub.
>You will need to create a GitHub account and an email me your account name
>to add you to the organization site as a contributor.
>
>The GitHub site is not a fork of dpdk.org only a sandbox to play with how
>GitHub can help the community to gain more developers in a clean manner.

https://github.com/dpdk-org


>Regards
>++Keith
>
> 
>
>
>



[dpdk-dev] Beyond DPDK 2.0

2015-04-30 Thread Wiles, Keith

(I snipped out the content here only because it had been snipped a lot
already)

Sorry, if I am highjacking the thread.

I believe the DPDK community would benefit from moving to GitHub as the
primary DPDK site. http://github.com

I believe the DPDK community can benefit from being at a very well know
world wide site. GitHub seems to have the most eyes of any of the open
source Git repos today and it appears they have more then twice as many
developers. GitHub has a number of features I see as some good additions to
our community using the GitHub organization account type.

The cost for an organization account is $0 as long as we do not need more
then 5 private repos. 10 private repos is $25/month and had other plans
for more. I do not see us needing more then 5 private repos today and the
only reason I can see having a private repo is to do some prep work on the
repo before making public. Every contributor would need to create a GitHub
personal account, which is at no cost unless you need more then 5 private
repos. In both accounts you can have unlimited public repos.

https://help.github.com/articles/where-can-i-find-open-source-projects-to-w
ork-on/

http://www.sitepoint.com/using-git-open-source-projects/

- Adding more committers can lead to a security problems for 6Wind (I
assume).
- 6Wind appearing to own DPDK.org is not a good message to the community.
  - Not assuming 6Wind?s dpdk.org site will disappear only where the
community stores the master repos and how the community interacts with the
master.
- Permission and access levels in dpdk.org is only one level and we can
benefit from having 4 levels and teams as well.
- The patch process today suffers from timely reviews, which will not be
fixed by moving.
  - GitHub has a per pull request discussions area, which gives a clean
way to
review all discussions on a specific change.
- The current patch model is clone dpdk.org/modify/commit/send patch
set
- The model with GitHub is fork on GitHub/modify/commit/send pull
request
- The patchwork web site is reasonable, but has some draw backs in
maintaining the site.
  - GitHub manages the patches via pull requests and can be easily seen
via a web browser.
  - The down side is you do have to use a web browser to do some work, but
the everyday work would be done as it is today.
- I think we all have a web browser now :-)
- GitHub has team support and gives a group better control plus
collaboration is much easier as we have a external location to work.
  - Most companies have some pretty high security level and being to
collaborate between two or more companies is very difficult if one company
is hosting the repo behind a firewall.
  - Using GitHub and teams would make collaboration a lot easier or
collaboration between two or more user accounts as well.
- GitHub has a Web Page system, which can be customized for the community
needs via a public or private repo.
- We still need a dpdk.org email list I believe as I did not find one at
GitHub.
  - We can also forward GitHub emails to the list.
  - I believe you can reply to an email from GitHub and the email will get
appended to the discussion thread.

As most do not like to read long emails :-) I will stop here and add one
more thing.

I have create a sandbox on GitHub for anyone to play with using GitHub.
You will need to create a GitHub account and an email me your account name
to add you to the organization site as a contributor.

The GitHub site is not a fork of dpdk.org only a sandbox to play with how
GitHub can help the community to gain more developers in a clean manner.

Regards
++Keith







[dpdk-dev] KNI interface is not coming up

2015-04-30 Thread Venkat Thummala
Hi,

I am testing DPDK 2.0 release.
I am not able to bring the KNI interface up.
It always gives the following error.

SIOCSIFFLAGS: Timer expired

This is on Ubuntu,

Linux vthummala-PowerEdge-R720 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10
19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Please let me know, how we could resolve this issue.

Regards
Venkat


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

2015-04-30 Thread Olivier MATZ
Hi,

On 04/30/2015 04:31 PM, Wiles, Keith wrote:
>
>
> On 4/30/15, 8:38 AM, "Olivier MATZ"  wrote:
>
>> Hi Keith,
>>
>> On 04/30/2015 03:24 PM, Wiles, Keith wrote:
>>>
>>>
>>> On 4/30/15, 4:45 AM, "Olivier MATZ"  wrote:
>>>
 Hi Keith,

 Thank you for submitting a clean-up. Please see some comments below.

 On 04/29/2015 05:25 PM, 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.

 If I understand well, the goal of this patch is only a cleanup in
 rte.app.mk, but at the end, it changes the makefile user "API",
 which could probably be a problem for applications using the
 dpdk makefile framework.

 Why not just having an temporary internal variable (let's say
 _LDLIBS-y) that would allow to do the clean-up without modifying
 the user interface?

 Also, with your patch, the approach for EXTRA_LDLIBS would be
 different than CFLAGS or LDFLAGS:
 - CFLAGS/LDFLAGS are in Makefiles only
 - EXTRA_CFLAGS/EXTRA_LDFLAGS are prefered in command line
 to add flags to the default ones

 I'm not opposed to add EXTRA_LDLIBS in addition to LDLIBS,
 keeping a compatibility with existing application Makefiles.
>>>
>>> The docs for DPDK 28.3.6 states they can be used for both command line
>>> and
>>> Makefile, so I think I like the current solution unless everyone wants
>>> it
>>> as you suggested.
>>>
>>>
>>> http://dpdk.readthedocs.org/en/v2.0.0/prog_guide/dev_kit_build_system.htm
>>> l
>>
>>  From the link you have sent:
>>
>> - About CFLAGS:
>>
>> "28.3.4. Variables that Can be Set/Overridden in a Makefile Only
>> [...]
>> CFLAGS: Flags to use for C compilation. The user should use += to append
>> data in this variable."
>>
>> nothing in 28.3.6
>>
>>
>> - About EXTRA_CFLAGS:
>>
>> nothing in 28.3.4
>>
>> "28.3.6. Variables that Can be Set/Overridden by the User in a Makefile
>> or Command Line
>> [...]
>> EXTRA_CFLAGS: The content of this variable is appended after CFLAGS when
>> compiling."
>
> The point was that EXTRA_XXX can be used for command line and Makefile as
> it was pointed out in a previous email the assumption was EXTRA_XXX was
> only for the command line. (Just to make sure we understood EXTRA_XXX was
> not just for command line options.) This was the reason I sent the link an
> to point out using EXTRA_XXX is a much cleaner method then allowing
> someone to modify what I believe is an internal variable.

Although it is allowed, using EXTRA_xxx in a Makefile does not look to
be a good idea in my opinion.

For instance, EXTRA_CFLAGS can be used to append something to the
CFLAGS variable. If we also use EXTRA_CFLAGS in the Makefile,
specifying it on the command line would override its value.

So, CFLAGS and LDLIBS are not internal variables. The DPDK build
framework is designed to make use of these variables provided by
the application Makefile.


>> It seems it's the description I have made above.
>>
>> Also, you don't answer to the Makefile API issue. From what I
>> understand, your patch would break external Makefiles using
>> LDLIBS just for doing an internal clean-up.
>
> I believe using these variables CFLAGS, LDLIBS, ? Are really internal
> variables and EXTRA_XXX should have been used instead. I would like to fix
> that issue and I do not feel the impact is that big as it is a simple
> search replace problem. But it looks like we want to keep the old way just
> for a very minor change IMHO.
>
> I will send out a new patch using _LDLIBS-y as the internal variable and
> then set LDLIBS at the correct location towards the end of the file.
>
> Does that work for you?

Yes, I think it's better. Not breaking the API for external Makefile
is important fir users.

Regards,
Olivier



>
> Regards,
> ++Keith
>>
>>
>> Regards,
>> Olivier
>>
>>
>>>
>>>

 What do you think?

 Regards,
 Olivier



>
> 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) \
> 

[dpdk-dev] [PATCH 1/3] uio: fix irq handling with igb_uio

2015-04-30 Thread Bruce Richardson
On Tue, Apr 28, 2015 at 09:36:38AM -0700, Stephen Hemminger wrote:
> The introduction of uio_pci_generic broke interrupt handling with
> igb_uio. The igb_uio device uses the kernel read/write method to
> enable disable IRQ's; the uio_pci_generic has to use PCI intx
> config read/write to enable disable interrupts.
> 
> Since igb_uio uses MSI-X the PCI intx config read/write won't
> work.
> 
> Signed-off-by: Stephen Hemminger 

Acked-by: Bruce Richardson 

> ---
>  lib/librte_eal/linuxapp/eal/eal_interrupts.c   | 40 
> --
>  lib/librte_eal/linuxapp/eal/eal_pci_uio.c  | 15 +---
>  .../linuxapp/eal/include/exec-env/rte_interrupts.h |  3 +-
>  3 files changed, 50 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c 
> b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> index 66deda2..3a84b3c 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> @@ -361,7 +361,7 @@ vfio_disable_msix(struct rte_intr_handle *intr_handle) {
>  #endif
>  
>  static int
> -uio_intr_disable(struct rte_intr_handle *intr_handle)
> +uio_intx_intr_disable(struct rte_intr_handle *intr_handle)
>  {
>   unsigned char command_high;
>  
> @@ -385,7 +385,7 @@ uio_intr_disable(struct rte_intr_handle *intr_handle)
>  }
>  
>  static int
> -uio_intr_enable(struct rte_intr_handle *intr_handle)
> +uio_intx_intr_enable(struct rte_intr_handle *intr_handle)
>  {
>   unsigned char command_high;
>  
> @@ -408,6 +408,34 @@ uio_intr_enable(struct rte_intr_handle *intr_handle)
>   return 0;
>  }
>  
> +static int
> +uio_intr_disable(struct rte_intr_handle *intr_handle)
> +{
> + const int value = 0;
> +
> + if (write(intr_handle->fd, , sizeof(value)) < 0) {
> + RTE_LOG(ERR, EAL,
> + "Error disabling interrupts for fd %d (%s)\n",
> + intr_handle->fd, strerror(errno));
> + return -1;
> + }
> + return 0;
> +}
> +
> +static int
> +uio_intr_enable(struct rte_intr_handle *intr_handle)
> +{
> + const int value = 1;
> +
> + if (write(intr_handle->fd, , sizeof(value)) < 0) {
> + RTE_LOG(ERR, EAL,
> + "Error enabling interrupts for fd %d (%s)\n",
> + intr_handle->fd, strerror(errno));
> + return -1;
> + }
> + return 0;
> +}
> +
>  int
>  rte_intr_callback_register(struct rte_intr_handle *intr_handle,
>   rte_intr_callback_fn cb, void *cb_arg)
> @@ -556,6 +584,10 @@ rte_intr_enable(struct rte_intr_handle *intr_handle)
>   if (uio_intr_enable(intr_handle))
>   return -1;
>   break;
> + case RTE_INTR_HANDLE_UIO_INTX:
> + if (uio_intx_intr_enable(intr_handle))
> + return -1;
> + break;
>   /* not used at this moment */
>   case RTE_INTR_HANDLE_ALARM:
>   return -1;
> @@ -596,6 +628,10 @@ rte_intr_disable(struct rte_intr_handle *intr_handle)
>   if (uio_intr_disable(intr_handle))
>   return -1;
>   break;
> + case RTE_INTR_HANDLE_UIO_INTX:
> + if (uio_intx_intr_disable(intr_handle))
> + return -1;
> + break;
>   /* not used at this moment */
>   case RTE_INTR_HANDLE_ALARM:
>   return -1;
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c 
> b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
> index 2d1c69b..b5116a7 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
> @@ -299,7 +299,6 @@ pci_uio_map_resource(struct rte_pci_device *dev)
>   devname, strerror(errno));
>   return -1;
>   }
> - dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
>  
>   snprintf(cfgname, sizeof(cfgname),
>   "/sys/class/uio/uio%u/device/config", uio_num);
> @@ -310,10 +309,16 @@ pci_uio_map_resource(struct rte_pci_device *dev)
>   return -1;
>   }
>  
> - /* set bus master that is not done by uio_pci_generic */
> - if (pci_uio_set_bus_master(dev->intr_handle.uio_cfg_fd)) {
> - RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
> - return -1;
> + if (dev->kdrv == RTE_KDRV_IGB_UIO)
> + dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
> + else {
> + dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;
> +
> + /* set bus master that is not done by uio_pci_generic */
> + if (pci_uio_set_bus_master(dev->intr_handle.uio_cfg_fd)) {
> + RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
> + return -1;
> + }
>   }
>  
>   /* allocate the mapping details for secondary processes*/
> diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h 
> 

[dpdk-dev] NO_AUTOLIB is this variable really needed?

2015-04-30 Thread Bruce Richardson
On Thu, Apr 30, 2015 at 02:55:47PM +, Wiles, Keith wrote:
> What is the NO_AUTOLIB variable used for anyway, the doc states this:
> 
> 
> * NO_AUTOLIBS: If set, the libraries provided by the framework will not be
> included in the LDLIBS variable automatically.
> 
> Why was this variable created, do we have really good reason? It seems
> like the variable removes almost all of the standard libs.
> 
> 
> Regards,
> ++Keith
> 
I think that is a hang-over from the baremetal days, and can probably go away
now. [It was probably used for the loader app or something]

/Bruce


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

2015-04-30 Thread Bruce Richardson
On Thu, Apr 30, 2015 at 02:31:13PM +, Wiles, Keith wrote:
> 
> 
> On 4/30/15, 8:38 AM, "Olivier MATZ"  wrote:
> 
> >Hi Keith,
> >
> >On 04/30/2015 03:24 PM, Wiles, Keith wrote:
> >>
> >>
> >> On 4/30/15, 4:45 AM, "Olivier MATZ"  wrote:
> >>
> >>> Hi Keith,
> >>>
> >>> Thank you for submitting a clean-up. Please see some comments below.
> >>>
> >>> On 04/29/2015 05:25 PM, 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.
> >>>
> >>> If I understand well, the goal of this patch is only a cleanup in
> >>> rte.app.mk, but at the end, it changes the makefile user "API",
> >>> which could probably be a problem for applications using the
> >>> dpdk makefile framework.
> >>>
> >>> Why not just having an temporary internal variable (let's say
> >>> _LDLIBS-y) that would allow to do the clean-up without modifying
> >>> the user interface?
> >>>
> >>> Also, with your patch, the approach for EXTRA_LDLIBS would be
> >>> different than CFLAGS or LDFLAGS:
> >>> - CFLAGS/LDFLAGS are in Makefiles only
> >>> - EXTRA_CFLAGS/EXTRA_LDFLAGS are prefered in command line
> >>>to add flags to the default ones
> >>>
> >>> I'm not opposed to add EXTRA_LDLIBS in addition to LDLIBS,
> >>> keeping a compatibility with existing application Makefiles.
> >>
> >> The docs for DPDK 28.3.6 states they can be used for both command line
> >>and
> >> Makefile, so I think I like the current solution unless everyone wants
> >>it
> >> as you suggested.
> >>
> >> 
> >>http://dpdk.readthedocs.org/en/v2.0.0/prog_guide/dev_kit_build_system.htm
> >>l
> >
> > From the link you have sent:
> >
> >- About CFLAGS:
> >
> >"28.3.4. Variables that Can be Set/Overridden in a Makefile Only
> >[...]
> >CFLAGS: Flags to use for C compilation. The user should use += to append
> >data in this variable."
> >
> >nothing in 28.3.6
> >
> >
> >- About EXTRA_CFLAGS:
> >
> >nothing in 28.3.4
> >
> >"28.3.6. Variables that Can be Set/Overridden by the User in a Makefile
> >or Command Line
> >[...]
> >EXTRA_CFLAGS: The content of this variable is appended after CFLAGS when
> >compiling."
> 
> The point was that EXTRA_XXX can be used for command line and Makefile as
> it was pointed out in a previous email the assumption was EXTRA_XXX was
> only for the command line. (Just to make sure we understood EXTRA_XXX was
> not just for command line options.) This was the reason I sent the link an
> to point out using EXTRA_XXX is a much cleaner method then allowing
> someone to modify what I believe is an internal variable.

Just beware that setting EXTRA_* flags on the commandline can override their
values in the makefiles, and cause unexpected compilation problems. Therefore,
it tends to be best to avoid using the EXTRA_* variables for variables essential
to compile. For example: putting "-g -O3" in EXTRA_CFLAGS is ok, as the if the
useroverrides those with something else things should still work, but putting
"-I/path/to/include" would not be.

/Bruce




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

2015-04-30 Thread Ravi Kerur
On Thu, Apr 30, 2015 at 9:00 AM, Neil Horman  wrote:

> On Wed, Apr 29, 2015 at 10:47:04AM -0700, Ravi Kerur wrote:
> > > > 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
> Ah, bsd mktemp doesn't support the -p option.  I'll see if I can fix that.
>

I think there are couple of other issues I found

freeBSD sed is different from Linux (GNU sed) and I get following errors
with the script

"sed 1 command c expects \ followed by text".

I have to use gsed (GNU sed) in freeBSD to get rid of that error and
similarly freeBSD uses gmake instead of make.  I have made those minor
changes and sending them with this email as an attachment.


> > 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
> >
>
> Whats the path for abi-compliance checker there?  It would seem that the
> binary
> isn't in your path, as which isn't locating it.
>

I am using regular freeBSD port install which doesn't install in any
/usr/bin or /usr/local/bin. I finally decided to install both abi-dumper
and abi-compliance-checker from source, compile and install it in correct
directory. Above error is fixed after that, however, abi utilities use
"eu-readelf" and I can't find that utility to install in freeBSD. I get
following errors

ERROR: can't find "eu-readelf" command

freeBSD has only readelf. Please let me know if there is a way to get rid
of this error.

Thanks,
Ravi

>
> > >
> > > Neil
> > >
> > >
>


[dpdk-dev] [RFC PATCH 4/4] librte_pmd_i40e: call _clear_cmd() when error occurs

2015-04-30 Thread Bernard Iremonger
_clear_cmd() was not being called in failure situations,
resulting in the next command also failing.

Signed-off-by: Bernard Iremonger 
---
 lib/librte_pmd_i40e/i40e_ethdev_vf.c |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c 
b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index af45064..e31f582 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -361,6 +361,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct 
vf_cmd_info *args)
 args->in_args, args->in_args_size, NULL);
if (err) {
PMD_DRV_LOG(ERR, "fail to send cmd %d", args->ops);
+   _clear_cmd(vf);
return err;
}

@@ -368,8 +369,10 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct 
vf_cmd_info *args)
/* read message and it's expected one */
if (!err && args->ops == info.ops)
_clear_cmd(vf);
-   else if (err)
+   else if (err) {
PMD_DRV_LOG(ERR, "Failed to read message from AdminQ");
+   _clear_cmd(vf);
+   }
else if (args->ops != info.ops)
PMD_DRV_LOG(ERR, "command mismatch, expect %u, get %u",
args->ops, info.ops);
@@ -794,7 +797,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev)
/* Stop TX queues first */
for (i = 0; i < dev->data->nb_tx_queues; i++) {
if (i40evf_dev_tx_queue_stop(dev, i) != 0) {
-   PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+   PMD_DRV_LOG(ERR, "Fail to stop queue %u", i);
return -1;
}
}
@@ -802,7 +805,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev)
/* Then stop RX queues */
for (i = 0; i < dev->data->nb_rx_queues; i++) {
if (i40evf_dev_rx_queue_stop(dev, i) != 0) {
-   PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+   PMD_DRV_LOG(ERR, "Fail to stop queue %u", i);
return -1;
}
}
@@ -1432,7 +1435,7 @@ i40evf_dev_tx_queue_stop(struct rte_eth_dev *dev, 
uint16_t tx_queue_id)
err = i40evf_switch_queue(dev, FALSE, tx_queue_id, FALSE);

if (err) {
-   PMD_DRV_LOG(ERR, "Failed to switch TX queue %u of",
+   PMD_DRV_LOG(ERR, "Failed to switch TX queue %u off",
tx_queue_id);
return err;
}
-- 
1.7.4.1



[dpdk-dev] [RFC PATCH 3/4] librte_pmd_i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done()

2015-04-30 Thread Bernard Iremonger
Increase delay to avoid i40evf_read_pfmsg() failures.

Signed-off-by: Bernard Iremonger 
---
 lib/librte_pmd_i40e/i40e_ethdev_vf.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c 
b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index 7c5b3f5..af45064 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -299,7 +299,7 @@ i40evf_wait_cmd_done(struct rte_eth_dev *dev,
enum i40evf_aq_result ret;

 #define MAX_TRY_TIMES 10
-#define ASQ_DELAY_MS  50
+#define ASQ_DELAY_MS  100
do {
/* Delay some time first */
rte_delay_ms(ASQ_DELAY_MS);
-- 
1.7.4.1



[dpdk-dev] [RFC PATCH 2/4] librte_pmd_i40e: release vmdq vsi's in dev_close

2015-04-30 Thread Bernard Iremonger
Signed-off-by: Bernard Iremonger 
---
 lib/librte_pmd_i40e/i40e_ethdev.c |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index e21ebed..5cff6df 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -623,7 +623,8 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
memset(, 0, sizeof(settings));
ret = i40e_set_filter_control(hw, );
if (ret)
-   PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d", 
ret);
+   PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d",
+   ret);

/* Disable flow control */
hw->fc.requested_mode = I40E_FC_NONE;
@@ -1021,6 +1022,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t reg;
+   int i;

PMD_INIT_FUNC_TRACE();

@@ -1038,6 +1040,12 @@ i40e_dev_close(struct rte_eth_dev *dev)
i40e_fdir_teardown(pf);
i40e_vsi_release(pf->main_vsi);

+   for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++)
+   i40e_vsi_release(pf->vmdq[i].vsi);
+
+   rte_free(pf->vmdq);
+   pf->vmdq = NULL;
+
/* shutdown the adminq */
i40e_aq_queue_shutdown(hw, true);
i40e_shutdown_adminq(hw);
-- 
1.7.4.1



[dpdk-dev] [RFC PATCH 1/4] librte_pmd_i40e: changes to support PCI Port Hotplug

2015-04-30 Thread Bernard Iremonger
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_i40e_pmd and
rte_i40evf_pmd.

Signed-off-by: Bernard Iremonger 
---
 lib/librte_pmd_i40e/i40e_ethdev.c|   69 +-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c |   48 ++-
 lib/librte_pmd_i40e/i40e_pf.c|   36 +-
 lib/librte_pmd_i40e/i40e_pf.h|3 +-
 4 files changed, 150 insertions(+), 6 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index 43762f2..e21ebed 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -107,6 +107,7 @@
(1UL << RTE_ETH_FLOW_L2_PAYLOAD))

 static int eth_i40e_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev);
 static int i40e_dev_configure(struct rte_eth_dev *dev);
 static int i40e_dev_start(struct rte_eth_dev *dev);
 static void i40e_dev_stop(struct rte_eth_dev *dev);
@@ -268,9 +269,11 @@ static struct eth_driver rte_i40e_pmd = {
{
.name = "rte_i40e_pmd",
.id_table = pci_id_i40e_map,
-   .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+   .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+   RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_i40e_dev_init,
+   .eth_dev_uninit = eth_i40e_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
 };

@@ -405,6 +408,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
hw->bus.device = pci_dev->addr.devid;
hw->bus.func = pci_dev->addr.function;
+   hw->adapter_stopped = FALSE;

/* Make sure all is clean before doing PF reset */
i40e_clear_hw(hw);
@@ -584,6 +588,64 @@ err_get_capabilities:
 }

 static int
+eth_i40e_dev_uninit(struct rte_eth_dev *dev)
+{
+   struct rte_pci_device *pci_dev;
+   struct i40e_hw *hw;
+   struct i40e_filter_control_settings settings;
+   int ret;
+   uint8_t aq_fail = 0;
+
+   PMD_INIT_FUNC_TRACE();
+
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+   return 0;
+
+   hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   pci_dev = dev->pci_dev;
+
+   if (hw->adapter_stopped == FALSE)
+   i40e_dev_close(dev);
+
+   dev->dev_ops = NULL;
+   dev->rx_pkt_burst = NULL;
+   dev->tx_pkt_burst = NULL;
+
+   /* Disable LLDP */
+   ret = i40e_aq_stop_lldp(hw, true, NULL);
+   if (ret != I40E_SUCCESS) /* Its failure can be ignored */
+   PMD_INIT_LOG(INFO, "Failed to stop lldp");
+
+   /* Clear PXE mode */
+   i40e_clear_pxe_mode(hw);
+
+   /* Unconfigure filter control */
+   memset(, 0, sizeof(settings));
+   ret = i40e_set_filter_control(hw, );
+   if (ret)
+   PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d", 
ret);
+
+   /* Disable flow control */
+   hw->fc.requested_mode = I40E_FC_NONE;
+   i40e_set_fc(hw, _fail, TRUE);
+
+   /* uninitialize pf host driver */
+   i40e_pf_host_uninit(dev);
+
+   rte_free(dev->data->mac_addrs);
+   dev->data->mac_addrs = NULL;
+
+   /* disable uio intr before callback unregister */
+   rte_intr_disable(&(pci_dev->intr_handle));
+
+   /* register callback func to eal lib */
+   rte_intr_callback_unregister(&(pci_dev->intr_handle),
+   i40e_dev_interrupt_handler, (void *)dev);
+
+   return 0;
+}
+
+static int
 i40e_dev_configure(struct rte_eth_dev *dev)
 {
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -854,6 +916,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
struct i40e_vsi *main_vsi = pf->main_vsi;
int ret, i;

+   hw->adapter_stopped = FALSE;
+
if ((dev->data->dev_conf.link_duplex != ETH_LINK_AUTONEG_DUPLEX) &&
(dev->data->dev_conf.link_duplex != ETH_LINK_FULL_DUPLEX)) {
PMD_INIT_LOG(ERR, "Invalid link_duplex (%hu) for port %hhu",
@@ -961,6 +1025,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();

i40e_dev_stop(dev);
+   hw->adapter_stopped = TRUE;

/* Disable interrupt */
i40e_pf_disable_irq0(hw);
diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c 
b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index a0d808f..7c5b3f5 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All 

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

2015-04-30 Thread Wiles, Keith


On 4/30/15, 11:22 AM, "Richardson, Bruce" 
wrote:

>On Thu, Apr 30, 2015 at 02:31:13PM +, Wiles, Keith wrote:
>> 
>> 
>> On 4/30/15, 8:38 AM, "Olivier MATZ"  wrote:
>> 
>> >Hi Keith,
>> >
>> >On 04/30/2015 03:24 PM, Wiles, Keith wrote:
>> >>
>> >>
>> >> On 4/30/15, 4:45 AM, "Olivier MATZ"  wrote:
>> >>
>> >>> Hi Keith,
>> >>>
>> >>> Thank you for submitting a clean-up. Please see some comments below.
>> >>>
>> >>> On 04/29/2015 05:25 PM, 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.
>> >>>
>> >>> If I understand well, the goal of this patch is only a cleanup in
>> >>> rte.app.mk, but at the end, it changes the makefile user "API",
>> >>> which could probably be a problem for applications using the
>> >>> dpdk makefile framework.
>> >>>
>> >>> Why not just having an temporary internal variable (let's say
>> >>> _LDLIBS-y) that would allow to do the clean-up without modifying
>> >>> the user interface?
>> >>>
>> >>> Also, with your patch, the approach for EXTRA_LDLIBS would be
>> >>> different than CFLAGS or LDFLAGS:
>> >>> - CFLAGS/LDFLAGS are in Makefiles only
>> >>> - EXTRA_CFLAGS/EXTRA_LDFLAGS are prefered in command line
>> >>>to add flags to the default ones
>> >>>
>> >>> I'm not opposed to add EXTRA_LDLIBS in addition to LDLIBS,
>> >>> keeping a compatibility with existing application Makefiles.
>> >>
>> >> The docs for DPDK 28.3.6 states they can be used for both command
>>line
>> >>and
>> >> Makefile, so I think I like the current solution unless everyone
>>wants
>> >>it
>> >> as you suggested.
>> >>
>> >> 
>> 
http://dpdk.readthedocs.org/en/v2.0.0/prog_guide/dev_kit_build_system.h
tm
>> >>l
>> >
>> > From the link you have sent:
>> >
>> >- About CFLAGS:
>> >
>> >"28.3.4. Variables that Can be Set/Overridden in a Makefile Only
>> >[...]
>> >CFLAGS: Flags to use for C compilation. The user should use += to
>>append
>> >data in this variable."
>> >
>> >nothing in 28.3.6
>> >
>> >
>> >- About EXTRA_CFLAGS:
>> >
>> >nothing in 28.3.4
>> >
>> >"28.3.6. Variables that Can be Set/Overridden by the User in a Makefile
>> >or Command Line
>> >[...]
>> >EXTRA_CFLAGS: The content of this variable is appended after CFLAGS
>>when
>> >compiling."
>> 
>> The point was that EXTRA_XXX can be used for command line and Makefile
>>as
>> it was pointed out in a previous email the assumption was EXTRA_XXX was
>> only for the command line. (Just to make sure we understood EXTRA_XXX
>>was
>> not just for command line options.) This was the reason I sent the link
>>an
>> to point out using EXTRA_XXX is a much cleaner method then allowing
>> someone to modify what I believe is an internal variable.
>
>Just beware that setting EXTRA_* flags on the commandline can override
>their
>values in the makefiles, and cause unexpected compilation problems.
>Therefore,
>it tends to be best to avoid using the EXTRA_* variables for variables
>essential
>to compile. For example: putting "-g -O3" in EXTRA_CFLAGS is ok, as the
>if the
>useroverrides those with something else things should still work, but
>putting
>"-I/path/to/include" would not be.

On the command line and makefile you should be using += and not just = or
you run into this problem.
>
>/Bruce
>
> 



[dpdk-dev] NO_AUTOLIB is this variable really needed?

2015-04-30 Thread Wiles, Keith


On 4/30/15, 11:24 AM, "Richardson, Bruce" 
wrote:

>On Thu, Apr 30, 2015 at 02:55:47PM +, Wiles, Keith wrote:
>> What is the NO_AUTOLIB variable used for anyway, the doc states this:
>> 
>> 
>> * NO_AUTOLIBS: If set, the libraries provided by the framework will not
>>be
>> included in the LDLIBS variable automatically.
>> 
>> Why was this variable created, do we have really good reason? It seems
>> like the variable removes almost all of the standard libs.
>> 
>> 
>> Regards,
>> ++Keith
>> 
>I think that is a hang-over from the baremetal days, and can probably go
>away
>now. [It was probably used for the loader app or something]

Do we want me to submit a patch to remove it? A new patch set :-)
>
>/Bruce



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

2015-04-30 Thread Olivier MATZ
Hi Keith,

On 04/30/2015 03:24 PM, Wiles, Keith wrote:
>
>
> On 4/30/15, 4:45 AM, "Olivier MATZ"  wrote:
>
>> Hi Keith,
>>
>> Thank you for submitting a clean-up. Please see some comments below.
>>
>> On 04/29/2015 05:25 PM, 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.
>>
>> If I understand well, the goal of this patch is only a cleanup in
>> rte.app.mk, but at the end, it changes the makefile user "API",
>> which could probably be a problem for applications using the
>> dpdk makefile framework.
>>
>> Why not just having an temporary internal variable (let's say
>> _LDLIBS-y) that would allow to do the clean-up without modifying
>> the user interface?
>>
>> Also, with your patch, the approach for EXTRA_LDLIBS would be
>> different than CFLAGS or LDFLAGS:
>> - CFLAGS/LDFLAGS are in Makefiles only
>> - EXTRA_CFLAGS/EXTRA_LDFLAGS are prefered in command line
>>to add flags to the default ones
>>
>> I'm not opposed to add EXTRA_LDLIBS in addition to LDLIBS,
>> keeping a compatibility with existing application Makefiles.
>
> The docs for DPDK 28.3.6 states they can be used for both command line and
> Makefile, so I think I like the current solution unless everyone wants it
> as you suggested.
>
> http://dpdk.readthedocs.org/en/v2.0.0/prog_guide/dev_kit_build_system.html

 From the link you have sent:

- About CFLAGS:

"28.3.4. Variables that Can be Set/Overridden in a Makefile Only
[...]
CFLAGS: Flags to use for C compilation. The user should use += to append 
data in this variable."

nothing in 28.3.6


- About EXTRA_CFLAGS:

nothing in 28.3.4

"28.3.6. Variables that Can be Set/Overridden by the User in a Makefile 
or Command Line
[...]
EXTRA_CFLAGS: The content of this variable is appended after CFLAGS when 
compiling."


It seems it's the description I have made above.

Also, you don't answer to the Makefile API issue. From what I
understand, your patch would break external Makefiles using
LDLIBS just for doing an internal clean-up.


Regards,
Olivier


>
>
>>
>> What do you think?
>>
>> Regards,
>> Olivier
>>
>>
>>
>>>
>>> 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 

[dpdk-dev] KNI interface is not coming up

2015-04-30 Thread Sanford, Robert
Hi Venkat,

Perhaps your DPDK application needs to slow-poll KNI devices via
rte_kni_handle_request( ).

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

--
Regards,
Robert


>Hi,
>
>I am testing DPDK 2.0 release.
>I am not able to bring the KNI interface up.
>It always gives the following error.
>
>SIOCSIFFLAGS: Timer expired
>
>This is on Ubuntu,
>
>Linux vthummala-PowerEdge-R720 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10
>19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>
>Please let me know, how we could resolve this issue.
>
>Regards
>Venkat



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

2015-04-30 Thread Wiles, Keith


On 4/30/15, 8:38 AM, "Olivier MATZ"  wrote:

>Hi Keith,
>
>On 04/30/2015 03:24 PM, Wiles, Keith wrote:
>>
>>
>> On 4/30/15, 4:45 AM, "Olivier MATZ"  wrote:
>>
>>> Hi Keith,
>>>
>>> Thank you for submitting a clean-up. Please see some comments below.
>>>
>>> On 04/29/2015 05:25 PM, 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.
>>>
>>> If I understand well, the goal of this patch is only a cleanup in
>>> rte.app.mk, but at the end, it changes the makefile user "API",
>>> which could probably be a problem for applications using the
>>> dpdk makefile framework.
>>>
>>> Why not just having an temporary internal variable (let's say
>>> _LDLIBS-y) that would allow to do the clean-up without modifying
>>> the user interface?
>>>
>>> Also, with your patch, the approach for EXTRA_LDLIBS would be
>>> different than CFLAGS or LDFLAGS:
>>> - CFLAGS/LDFLAGS are in Makefiles only
>>> - EXTRA_CFLAGS/EXTRA_LDFLAGS are prefered in command line
>>>to add flags to the default ones
>>>
>>> I'm not opposed to add EXTRA_LDLIBS in addition to LDLIBS,
>>> keeping a compatibility with existing application Makefiles.
>>
>> The docs for DPDK 28.3.6 states they can be used for both command line
>>and
>> Makefile, so I think I like the current solution unless everyone wants
>>it
>> as you suggested.
>>
>> 
>>http://dpdk.readthedocs.org/en/v2.0.0/prog_guide/dev_kit_build_system.htm
>>l
>
> From the link you have sent:
>
>- About CFLAGS:
>
>"28.3.4. Variables that Can be Set/Overridden in a Makefile Only
>[...]
>CFLAGS: Flags to use for C compilation. The user should use += to append
>data in this variable."
>
>nothing in 28.3.6
>
>
>- About EXTRA_CFLAGS:
>
>nothing in 28.3.4
>
>"28.3.6. Variables that Can be Set/Overridden by the User in a Makefile
>or Command Line
>[...]
>EXTRA_CFLAGS: The content of this variable is appended after CFLAGS when
>compiling."

The point was that EXTRA_XXX can be used for command line and Makefile as
it was pointed out in a previous email the assumption was EXTRA_XXX was
only for the command line. (Just to make sure we understood EXTRA_XXX was
not just for command line options.) This was the reason I sent the link an
to point out using EXTRA_XXX is a much cleaner method then allowing
someone to modify what I believe is an internal variable.
>
>
>It seems it's the description I have made above.
>
>Also, you don't answer to the Makefile API issue. From what I
>understand, your patch would break external Makefiles using
>LDLIBS just for doing an internal clean-up.

I believe using these variables CFLAGS, LDLIBS, ? Are really internal
variables and EXTRA_XXX should have been used instead. I would like to fix
that issue and I do not feel the impact is that big as it is a simple
search replace problem. But it looks like we want to keep the old way just
for a very minor change IMHO.

I will send out a new patch using _LDLIBS-y as the internal variable and
then set LDLIBS at the correct location towards the end of the file.

Does that work for you?

Regards,
++Keith
>
>
>Regards,
>Olivier
>
>
>>
>>
>>>
>>> What do you think?
>>>
>>> Regards,
>>> Olivier
>>>
>>>
>>>

 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 

[dpdk-dev] [RFC PATCH 1/1] librte_pmd_ring: changes to support PCI Port Hotplug

2015-04-30 Thread Bernard Iremonger
This patch depends on the Port Hotplug Framework.
It implements the rte_dev_uninit_t() function for the ring pmd.


Signed-off-by: Bernard Iremonger 
---
 lib/librte_pmd_ring/rte_eth_ring.c |   93 
 1 files changed, 72 insertions(+), 21 deletions(-)

diff --git a/lib/librte_pmd_ring/rte_eth_ring.c 
b/lib/librte_pmd_ring/rte_eth_ring.c
index 6832f01..0d643ae 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -252,6 +252,15 @@ static const struct eth_dev_ops ops = {
.mac_addr_add = eth_mac_addr_add,
 };

+static struct eth_driver rte_ring_pmd = {
+   .pci_drv = {
+   .name = "rte_ring_pmd",
+   .drv_flags = RTE_PCI_DRV_DETACHABLE,
+   },
+};
+
+static struct rte_pci_id id_table;
+
 int
 rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
const unsigned nb_rx_queues,
@@ -263,8 +272,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const 
rx_queues[],
struct rte_pci_device *pci_dev = NULL;
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
-   struct eth_driver *eth_drv = NULL;
-   struct rte_pci_id *id_table = NULL;

unsigned i;

@@ -288,10 +295,6 @@ rte_eth_from_rings(const char *name, struct rte_ring 
*const rx_queues[],
if (pci_dev == NULL)
goto error;

-   id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, numa_node);
-   if (id_table == NULL)
-   goto error;
-
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
if (internals == NULL)
goto error;
@@ -301,9 +304,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const 
rx_queues[],
if (eth_dev == NULL)
goto error;

-   eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, numa_node);
-   if (eth_drv == NULL)
-   goto error;

/* now put it all together
 * - store queue data in internals,
@@ -323,21 +323,22 @@ rte_eth_from_rings(const char *name, struct rte_ring 
*const rx_queues[],
internals->tx_ring_queues[i].rng = tx_queues[i];
}

-   eth_drv->pci_drv.name = ring_ethdev_driver_name;
-   eth_drv->pci_drv.id_table = id_table;
+   rte_ring_pmd.pci_drv.name = ring_ethdev_driver_name;
+   rte_ring_pmd.pci_drv.id_table = _table;

pci_dev->numa_node = numa_node;
-   pci_dev->driver = _drv->pci_drv;
+   pci_dev->driver = _ring_pmd.pci_drv;

data->dev_private = internals;
data->port_id = eth_dev->data->port_id;
+   memmove(data->name, eth_dev->data->name, sizeof(data->name));
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 = >address;

eth_dev->data = data;
-   eth_dev->driver = eth_drv;
+   eth_dev->driver = _ring_pmd;
eth_dev->dev_ops = 
eth_dev->pci_dev = pci_dev;
TAILQ_INIT(&(eth_dev->link_intr_cbs));
@@ -531,20 +532,34 @@ rte_pmd_ring_devinit(const char *name, const char *params)

RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);

-   if (params == NULL || params[0] == '\0')
-   eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+   if (params == NULL || params[0] == '\0') {
+   ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+   if (ret == -1) {
+   RTE_LOG(INFO, PMD, "Attach to pmd_ring for %s\n", name);
+   ret = eth_dev_ring_create(name, rte_socket_id(),
+   DEV_ATTACH);
+   }
+   }
else {
kvlist = rte_kvargs_parse(params, valid_arguments);

if (!kvlist) {
RTE_LOG(INFO, PMD, "Ignoring unsupported parameters 
when creating"
" rings-backed ethernet device\n");
-   eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
-   return 0;
+   ret = eth_dev_ring_create(name, rte_socket_id(),
+   DEV_CREATE);
+   if (ret == -1) {
+   RTE_LOG(INFO, PMD, "Attach to pmd_ring for 
%s\n",
+   name);
+   ret = eth_dev_ring_create(name, rte_socket_id(),
+   DEV_ATTACH);
+   }
+   return ret;
 

[dpdk-dev] [PATCH v2] pipeline: add statistics for librte_pipeline ports and tables

2015-04-30 Thread Michal Jastrzebski
From: Pawel Wodkowski 

This patch adds statistics collection for librte_pipeline.
Those statistics ale disabled by default during build time.

Signed-off-by: Pawel Wodkowski 
---
 config/common_bsdapp   |1 +
 config/common_linuxapp |1 +
 lib/librte_pipeline/rte_pipeline.c |  185 +---
 lib/librte_pipeline/rte_pipeline.h |   99 +++
 4 files changed, 275 insertions(+), 11 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 1d0f5b2..e4f0bf5 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -414,6 +414,7 @@ CONFIG_RTE_TABLE_LPM_STATS_COLLECT=n
 # Compile librte_pipeline
 #
 CONFIG_RTE_LIBRTE_PIPELINE=y
+CONFIG_RTE_PIPELINE_STATS_COLLECT=n

 #
 # Compile librte_kni
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 8b01ca9..05553d9 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -421,6 +421,7 @@ CONFIG_RTE_TABLE_LPM_STATS_COLLECT=n
 # Compile librte_pipeline
 #
 CONFIG_RTE_LIBRTE_PIPELINE=y
+CONFIG_RTE_PIPELINE_STATS_COLLECT=n

 #
 # Compile librte_kni
diff --git a/lib/librte_pipeline/rte_pipeline.c 
b/lib/librte_pipeline/rte_pipeline.c
index 36d92c9..69bf003 100644
--- a/lib/librte_pipeline/rte_pipeline.c
+++ b/lib/librte_pipeline/rte_pipeline.c
@@ -48,6 +48,17 @@

 #define RTE_TABLE_INVALID UINT32_MAX

+#ifdef RTE_PIPELINE_STATS_COLLECT
+#define RTE_PIPELINE_STATS_ADD(counter, val) \
+   ({ (counter) += (val); })
+
+#define RTE_PIPELINE_STATS_ADD_M(counter, mask) \
+   ({ (counter) += __builtin_popcountll(mask); })
+#else
+#define RTE_PIPELINE_STATS_ADD(counter, val)
+#define RTE_PIPELINE_STATS_ADD_M(counter, mask)
+#endif
+
 struct rte_port_in {
/* Input parameters */
struct rte_port_in_ops ops;
@@ -63,6 +74,8 @@ struct rte_port_in {

/* List of enabled ports */
struct rte_port_in *next;
+
+   uint64_t n_pkts_dropped_by_ah;
 };

 struct rte_port_out {
@@ -74,6 +87,8 @@ struct rte_port_out {

/* Handle to low-level port */
void *h_port;
+
+   uint64_t n_pkts_dropped_by_ah;
 };

 struct rte_table {
@@ -90,6 +105,12 @@ struct rte_table {

/* Handle to the low-level table object */
void *h_table;
+
+   /* Stats for this table. */
+   uint64_t n_pkts_dropped_by_lkp_hit_ah;
+   uint64_t n_pkts_dropped_by_lkp_miss_ah;
+   uint64_t n_pkts_dropped_lkp_hit;
+   uint64_t n_pkts_dropped_lkp_miss;
 };

 #define RTE_PIPELINE_MAX_NAME_SZ   124
@@ -1040,6 +1061,8 @@ rte_pipeline_action_handler_port_bulk(struct rte_pipeline 
*p,

port_out->f_action_bulk(p->pkts, _mask, port_out->arg_ah);
p->action_mask0[RTE_PIPELINE_ACTION_DROP] |= pkts_mask ^  mask;
+   RTE_PIPELINE_STATS_ADD_M(port_out->n_pkts_dropped_by_ah,
+   pkts_mask ^  mask);
}

/* Output port TX */
@@ -1071,6 +1094,9 @@ rte_pipeline_action_handler_port(struct rte_pipeline *p, 
uint64_t pkts_mask)
p->action_mask0[RTE_PIPELINE_ACTION_DROP] |=
(pkt_mask ^ 1LLU) << i;

+   
RTE_PIPELINE_STATS_ADD(port_out->n_pkts_dropped_by_ah,
+   pkt_mask ^ 1LLU);
+
/* Output port TX */
if (pkt_mask != 0)
port_out->ops.f_tx(port_out->h_port,
@@ -1104,6 +1130,9 @@ rte_pipeline_action_handler_port(struct rte_pipeline *p, 
uint64_t pkts_mask)
p->action_mask0[RTE_PIPELINE_ACTION_DROP] |=
(pkt_mask ^ 1LLU) << i;

+   
RTE_PIPELINE_STATS_ADD(port_out->n_pkts_dropped_by_ah,
+   pkt_mask ^ 1LLU);
+
/* Output port TX */
if (pkt_mask != 0)
port_out->ops.f_tx(port_out->h_port,
@@ -1140,6 +1169,9 @@ rte_pipeline_action_handler_port_meta(struct rte_pipeline 
*p,
p->action_mask0[RTE_PIPELINE_ACTION_DROP] |=
(pkt_mask ^ 1LLU) << i;

+   
RTE_PIPELINE_STATS_ADD(port_out->n_pkts_dropped_by_ah,
+   pkt_mask ^ 1ULL);
+
/* Output port TX */
if (pkt_mask != 0)
port_out->ops.f_tx(port_out->h_port,
@@ -1174,6 +1206,9 @@ rte_pipeline_action_handler_port_meta(struct rte_pipeline 
*p,
p->action_mask0[RTE_PIPELINE_ACTION_DROP] |=
(pkt_mask ^ 1LLU) << i;

+   

[dpdk-dev] [PATCH v2 10/10] table: added lpm table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added lpm table statistics.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp |1 +
 config/common_linuxapp   |1 +
 lib/librte_table/rte_table_lpm.c |   34 ++
 3 files changed, 36 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index acd4866..1d0f5b2 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -408,6 +408,7 @@ CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
 CONFIG_RTE_TABLE_LPM_IPV6_STATS_COLLECT=n
+CONFIG_RTE_TABLE_LPM_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 740d769..8b01ca9 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -415,6 +415,7 @@ CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
 CONFIG_RTE_TABLE_LPM_IPV6_STATS_COLLECT=n
+CONFIG_RTE_TABLE_LPM_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
index 64c684d..7d8f670 100644
--- a/lib/librte_table/rte_table_lpm.c
+++ b/lib/librte_table/rte_table_lpm.c
@@ -46,7 +46,23 @@

 #define RTE_TABLE_LPM_MAX_NEXT_HOPS256

+#ifdef RTE_TABLE_LPM_STATS_COLLECT
+
+#define RTE_TABLE_LPM_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_LPM_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_LPM_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_LPM_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct rte_table_lpm {
+   struct rte_table_stats stats;
+
/* Input parameters */
uint32_t entry_size;
uint32_t entry_unique_size;
@@ -313,6 +329,9 @@ rte_table_lpm_lookup(
uint64_t pkts_out_mask = 0;
uint32_t i;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_LPM_STATS_PKTS_IN_ADD(lpm, n_pkts_in);
+
pkts_out_mask = 0;
for (i = 0; i < (uint32_t)(RTE_PORT_IN_BURST_SIZE_MAX -
__builtin_clzll(pkts_mask)); i++) {
@@ -335,6 +354,20 @@ rte_table_lpm_lookup(
}

*lookup_hit_mask = pkts_out_mask;
+   RTE_TABLE_LPM_STATS_PKTS_LOOKUP_MISS(lpm, n_pkts_in - 
__builtin_popcountll(pkts_out_mask));
+   return 0;
+}
+
+static int
+rte_table_lpm_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+   struct rte_table_lpm *t = (struct rte_table_lpm *) table;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(t->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(t->stats));

return 0;
 }
@@ -345,4 +378,5 @@ struct rte_table_ops rte_table_lpm_ops = {
.f_add = rte_table_lpm_entry_add,
.f_delete = rte_table_lpm_entry_delete,
.f_lookup = rte_table_lpm_lookup,
+   .f_stats = rte_table_lpm_stats_read,
 };
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 09/10] table: added lpm_ipv6 table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added lpm ipv6 table statistics.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp  |1 +
 config/common_linuxapp|1 +
 lib/librte_table/rte_table_lpm_ipv6.c |   34 +
 3 files changed, 36 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 505eb51..acd4866 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -407,6 +407,7 @@ CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
+CONFIG_RTE_TABLE_LPM_IPV6_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 7201858..740d769 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -414,6 +414,7 @@ CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
+CONFIG_RTE_TABLE_LPM_IPV6_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_lpm_ipv6.c 
b/lib/librte_table/rte_table_lpm_ipv6.c
index ce4ddc0..11534a9 100644
--- a/lib/librte_table/rte_table_lpm_ipv6.c
+++ b/lib/librte_table/rte_table_lpm_ipv6.c
@@ -46,7 +46,23 @@

 #define RTE_TABLE_LPM_MAX_NEXT_HOPS256

+#ifdef RTE_TABLE_LPM_IPV6_STATS_COLLECT
+
+#define RTE_TABLE_LPM_IPV6_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_LPM_IPV6_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_LPM_IPV6_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_LPM_IPV6_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct rte_table_lpm_ipv6 {
+   struct rte_table_stats stats;
+
/* Input parameters */
uint32_t entry_size;
uint32_t entry_unique_size;
@@ -327,6 +343,9 @@ rte_table_lpm_ipv6_lookup(
uint64_t pkts_out_mask = 0;
uint32_t i;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_LPM_IPV6_STATS_PKTS_IN_ADD(lpm, n_pkts_in);
+
pkts_out_mask = 0;
for (i = 0; i < (uint32_t)(RTE_PORT_IN_BURST_SIZE_MAX -
__builtin_clzll(pkts_mask)); i++) {
@@ -349,6 +368,20 @@ rte_table_lpm_ipv6_lookup(
}

*lookup_hit_mask = pkts_out_mask;
+   RTE_TABLE_LPM_IPV6_STATS_PKTS_LOOKUP_MISS(lpm, n_pkts_in - 
__builtin_popcountll(pkts_out_mask));
+   return 0;
+}
+
+static int
+rte_table_lpm_ipv6_stats_read(void *table, struct rte_table_stats *stats, int 
clear)
+{
+   struct rte_table_lpm_ipv6 *t = (struct rte_table_lpm_ipv6 *) table;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(t->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(t->stats));

return 0;
 }
@@ -359,4 +392,5 @@ struct rte_table_ops rte_table_lpm_ipv6_ops = {
.f_add = rte_table_lpm_ipv6_entry_add,
.f_delete = rte_table_lpm_ipv6_entry_delete,
.f_lookup = rte_table_lpm_ipv6_lookup,
+   .f_stats = rte_table_lpm_ipv6_stats_read,
 };
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 08/10] table: added hash_lru table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for hash_lru table.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp  |1 +
 config/common_linuxapp|1 +
 lib/librte_table/rte_table_hash_lru.c |   44 +
 3 files changed, 46 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index bb1bbd1..505eb51 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -406,6 +406,7 @@ CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 38b799d..7201858 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -413,6 +413,7 @@ CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_lru.c 
b/lib/librte_table/rte_table_hash_lru.c
index c9a8afd..2f2156c 100644
--- a/lib/librte_table/rte_table_hash_lru.c
+++ b/lib/librte_table/rte_table_hash_lru.c
@@ -45,6 +45,20 @@

 #define KEYS_PER_BUCKET4

+#ifdef RTE_TABLE_HASH_LRU_STATS_COLLECT
+
+#define RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct bucket {
union {
struct bucket *next;
@@ -63,6 +77,8 @@ struct grinder {
 };

 struct rte_table_hash {
+   struct rte_table_stats stats;
+
/* Input parameters */
uint32_t key_size;
uint32_t entry_size;
@@ -368,6 +384,9 @@ static int rte_table_hash_lru_lookup_unoptimized(
struct rte_table_hash *t = (struct rte_table_hash *) table;
uint64_t pkts_mask_out = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
for ( ; pkts_mask; ) {
struct bucket *bkt;
struct rte_mbuf *pkt;
@@ -412,6 +431,7 @@ static int rte_table_hash_lru_lookup_unoptimized(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 }

@@ -804,6 +824,9 @@ static int rte_table_hash_lru_lookup(
uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
int status = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
/* Cannot run the pipeline with less than 7 packets */
if (__builtin_popcountll(pkts_mask) < 7)
return rte_table_hash_lru_lookup_unoptimized(table, pkts,
@@ -916,6 +939,7 @@ static int rte_table_hash_lru_lookup(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return status;
 }

@@ -933,6 +957,9 @@ static int rte_table_hash_lru_lookup_dosig(
uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
int status = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
/* Cannot run the pipeline with less than 7 packets */
if (__builtin_popcountll(pkts_mask) < 7)
return rte_table_hash_lru_lookup_unoptimized(table, pkts,
@@ -1045,15 +1072,31 @@ static int rte_table_hash_lru_lookup_dosig(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return status;
 }

+static int
+rte_table_hash_lru_stats_read(void *table, struct rte_table_stats *stats, int 
clear)
+{
+   struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(t->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(t->stats));
+
+   return 0;
+}
+
 struct rte_table_ops rte_table_hash_lru_ops = {
.f_create = rte_table_hash_lru_create,
.f_free = rte_table_hash_lru_free,
.f_add = rte_table_hash_lru_entry_add,
.f_delete = rte_table_hash_lru_entry_delete,
.f_lookup = rte_table_hash_lru_lookup,
+   .f_stats = rte_table_hash_lru_stats_read,
 };

 struct rte_table_ops rte_table_hash_lru_dosig_ops = {
@@ -1062,4 +1105,5 @@ struct rte_table_ops 

[dpdk-dev] [PATCH v2 07/10] table: added hash_key8 table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for hash key8 table.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp   |1 +
 config/common_linuxapp |1 +
 lib/librte_table/rte_table_hash_key8.c |   52 
 3 files changed, 54 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 23f8d15..bb1bbd1 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -405,6 +405,7 @@ CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index e4bd7bc..38b799d 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -412,6 +412,7 @@ CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_key8.c 
b/lib/librte_table/rte_table_hash_key8.c
index 6803eb2..aac22b1 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -44,6 +44,20 @@

 #define RTE_TABLE_HASH_KEY_SIZE
8

+#ifdef RTE_TABLE_HASH_KEY8_STATS_COLLECT
+
+#define RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct rte_bucket_4_8 {
/* Cache line 0 */
uint64_t signature;
@@ -58,6 +72,8 @@ struct rte_bucket_4_8 {
 };

 struct rte_table_hash {
+   struct rte_table_stats stats;
+
/* Input parameters */
uint32_t n_buckets;
uint32_t n_entries_per_bucket;
@@ -846,6 +862,9 @@ rte_table_hash_lookup_key8_lru(
pkt11_index, pkt20_index, pkt21_index;
uint64_t pkts_mask_out = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -860,6 +879,7 @@ rte_table_hash_lookup_key8_lru(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
}

@@ -949,6 +969,7 @@ rte_table_hash_lookup_key8_lru(
bucket20, bucket21, pkts_mask_out, entries, f);

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 } /* rte_table_hash_lookup_key8_lru() */

@@ -967,6 +988,9 @@ rte_table_hash_lookup_key8_lru_dosig(
uint32_t pkt11_index, pkt20_index, pkt21_index;
uint64_t pkts_mask_out = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -981,6 +1005,7 @@ rte_table_hash_lookup_key8_lru_dosig(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
}

@@ -1070,6 +1095,7 @@ rte_table_hash_lookup_key8_lru_dosig(
bucket20, bucket21, pkts_mask_out, entries, f);

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 } /* rte_table_hash_lookup_key8_lru_dosig() */

@@ -1090,6 +1116,9 @@ rte_table_hash_lookup_key8_ext(
struct rte_bucket_4_8 *buckets[RTE_PORT_IN_BURST_SIZE_MAX];
uint64_t *keys[RTE_PORT_IN_BURST_SIZE_MAX];

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -1216,6 +1245,7 @@ grind_next_buckets:
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 } /* rte_table_hash_lookup_key8_ext() 

[dpdk-dev] [PATCH v2 06/10] table: added hash_key32 table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for hash key32 table.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp|1 +
 config/common_linuxapp  |1 +
 lib/librte_table/rte_table_hash_key32.c |   41 +++
 3 files changed, 43 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 6ce6057..23f8d15 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -404,6 +404,7 @@ CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
 CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 9c3868a..e4bd7bc 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -411,6 +411,7 @@ CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
 CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_key32.c 
b/lib/librte_table/rte_table_hash_key32.c
index 6790594..2a8781a 100644
--- a/lib/librte_table/rte_table_hash_key32.c
+++ b/lib/librte_table/rte_table_hash_key32.c
@@ -46,6 +46,20 @@

 #define RTE_BUCKET_ENTRY_VALID 0x1LLU

+#ifdef RTE_TABLE_HASH_KEY32_STATS_COLLECT
+
+#define RTE_TABLE_HASH_KEY32_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_KEY32_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct rte_bucket_4_32 {
/* Cache line 0 */
uint64_t signature[4 + 1];
@@ -61,6 +75,8 @@ struct rte_bucket_4_32 {
 };

 struct rte_table_hash {
+   struct rte_table_stats stats;
+
/* Input parameters */
uint32_t n_buckets;
uint32_t n_entries_per_bucket;
@@ -850,6 +866,9 @@ rte_table_hash_lookup_key32_lru(
uint32_t pkt11_index, pkt20_index, pkt21_index;
uint64_t pkts_mask_out = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_KEY32_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -864,6 +883,7 @@ rte_table_hash_lookup_key32_lru(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
}

@@ -954,6 +974,7 @@ rte_table_hash_lookup_key32_lru(
mbuf20, mbuf21, bucket20, bucket21, pkts_mask_out, entries, f);

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 } /* rte_table_hash_lookup_key32_lru() */

@@ -974,6 +995,9 @@ rte_table_hash_lookup_key32_ext(
struct rte_bucket_4_32 *buckets[RTE_PORT_IN_BURST_SIZE_MAX];
uint64_t *keys[RTE_PORT_IN_BURST_SIZE_MAX];

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_KEY32_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -1100,15 +1124,31 @@ grind_next_buckets:
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 } /* rte_table_hash_lookup_key32_ext() */

+static int
+rte_table_hash_key32_stats_read(void *table, struct rte_table_stats *stats, 
int clear)
+{
+   struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(t->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(t->stats));
+
+   return 0;
+}
+
 struct rte_table_ops rte_table_hash_key32_lru_ops = {
.f_create = rte_table_hash_create_key32_lru,
.f_free = rte_table_hash_free_key32_lru,
.f_add = rte_table_hash_entry_add_key32_lru,
.f_delete = rte_table_hash_entry_delete_key32_lru,
.f_lookup = rte_table_hash_lookup_key32_lru,
+   .f_stats = rte_table_hash_key32_stats_read,
 };

 struct rte_table_ops rte_table_hash_key32_ext_ops = {
@@ -1117,4 +1157,5 @@ struct rte_table_ops rte_table_hash_key32_ext_ops = {
.f_add = rte_table_hash_entry_add_key32_ext,
.f_delete = rte_table_hash_entry_delete_key32_ext,
.f_lookup = 

[dpdk-dev] [PATCH v2 05/10] table: added hash_key16 table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for hash key16 table.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp|1 +
 config/common_linuxapp  |1 +
 lib/librte_table/rte_table_hash_key16.c |   41 +++
 3 files changed, 43 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index ba8598f..6ce6057 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -403,6 +403,7 @@ CONFIG_RTE_LIBRTE_TABLE=y
 CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
 CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 4a41a24..9c3868a 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -410,6 +410,7 @@ CONFIG_RTE_LIBRTE_TABLE=y
 CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
 CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
 CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_key16.c 
b/lib/librte_table/rte_table_hash_key16.c
index f87ea0e..37dde0b 100644
--- a/lib/librte_table/rte_table_hash_key16.c
+++ b/lib/librte_table/rte_table_hash_key16.c
@@ -46,6 +46,20 @@

 #define RTE_BUCKET_ENTRY_VALID 0x1LLU

+#ifdef RTE_TABLE_HASH_KEY16_STATS_COLLECT
+
+#define RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct rte_bucket_4_16 {
/* Cache line 0 */
uint64_t signature[4 + 1];
@@ -61,6 +75,8 @@ struct rte_bucket_4_16 {
 };

 struct rte_table_hash {
+   struct rte_table_stats stats;
+
/* Input parameters */
uint32_t n_buckets;
uint32_t n_entries_per_bucket;
@@ -831,6 +847,9 @@ rte_table_hash_lookup_key16_lru(
uint32_t pkt11_index, pkt20_index, pkt21_index;
uint64_t pkts_mask_out = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -845,6 +864,7 @@ rte_table_hash_lookup_key16_lru(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
}

@@ -934,6 +954,7 @@ rte_table_hash_lookup_key16_lru(
bucket20, bucket21, pkts_mask_out, entries, f);

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 } /* rte_table_hash_lookup_key16_lru() */

@@ -954,6 +975,9 @@ rte_table_hash_lookup_key16_ext(
struct rte_bucket_4_16 *buckets[RTE_PORT_IN_BURST_SIZE_MAX];
uint64_t *keys[RTE_PORT_IN_BURST_SIZE_MAX];

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -1080,15 +1104,31 @@ grind_next_buckets:
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 } /* rte_table_hash_lookup_key16_ext() */

+static int
+rte_table_hash_key16_stats_read(void *table, struct rte_table_stats *stats, 
int clear)
+{
+   struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(t->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(t->stats));
+
+   return 0;
+}
+
 struct rte_table_ops rte_table_hash_key16_lru_ops = {
.f_create = rte_table_hash_create_key16_lru,
.f_free = rte_table_hash_free_key16_lru,
.f_add = rte_table_hash_entry_add_key16_lru,
.f_delete = rte_table_hash_entry_delete_key16_lru,
.f_lookup = rte_table_hash_lookup_key16_lru,
+   .f_stats = rte_table_hash_key16_stats_read,
 };

 struct rte_table_ops rte_table_hash_key16_ext_ops = {
@@ -1097,4 +1137,5 @@ struct rte_table_ops rte_table_hash_key16_ext_ops = {
.f_add = rte_table_hash_entry_add_key16_ext,
.f_delete = rte_table_hash_entry_delete_key16_ext,
.f_lookup = rte_table_hash_lookup_key16_ext,
+   .f_stats = 

[dpdk-dev] [PATCH v2 04/10] table: added hash_ext table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for hash ext table.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp  |1 +
 config/common_linuxapp|1 +
 lib/librte_table/rte_table_hash_ext.c |   44 +
 3 files changed, 46 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index e31fba7..ba8598f 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -402,6 +402,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
 CONFIG_RTE_LIBRTE_TABLE=y
 CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
 CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 6a6e33e..4a41a24 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -409,6 +409,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
 CONFIG_RTE_LIBRTE_TABLE=y
 CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
 CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_ext.c 
b/lib/librte_table/rte_table_hash_ext.c
index 66e416b..d9ff97b 100644
--- a/lib/librte_table/rte_table_hash_ext.c
+++ b/lib/librte_table/rte_table_hash_ext.c
@@ -74,6 +74,20 @@ do   
\
(bucket)->next = (bucket2)->next;   \
 while (0)

+#ifdef RTE_TABLE_HASH_EXT_STATS_COLLECT
+
+#define RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct grinder {
struct bucket *bkt;
uint64_t sig;
@@ -82,6 +96,8 @@ struct grinder {
 };

 struct rte_table_hash {
+   struct rte_table_stats stats;
+
/* Input parameters */
uint32_t key_size;
uint32_t entry_size;
@@ -440,6 +456,9 @@ static int rte_table_hash_ext_lookup_unoptimized(
struct rte_table_hash *t = (struct rte_table_hash *) table;
uint64_t pkts_mask_out = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
for ( ; pkts_mask; ) {
struct bucket *bkt0, *bkt;
struct rte_mbuf *pkt;
@@ -484,6 +503,7 @@ static int rte_table_hash_ext_lookup_unoptimized(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return 0;
 }

@@ -861,6 +881,9 @@ static int rte_table_hash_ext_lookup(
uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
int status = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
/* Cannot run the pipeline with less than 7 packets */
if (__builtin_popcountll(pkts_mask) < 7)
return rte_table_hash_ext_lookup_unoptimized(table, pkts,
@@ -973,6 +996,7 @@ static int rte_table_hash_ext_lookup(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return status;
 }

@@ -990,6 +1014,9 @@ static int rte_table_hash_ext_lookup_dosig(
uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
int status = 0;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
/* Cannot run the pipeline with less than 7 packets */
if (__builtin_popcountll(pkts_mask) < 7)
return rte_table_hash_ext_lookup_unoptimized(table, pkts,
@@ -1102,15 +1129,31 @@ static int rte_table_hash_ext_lookup_dosig(
}

*lookup_hit_mask = pkts_mask_out;
+   RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - 
__builtin_popcountll(pkts_mask_out));
return status;
 }

+static int
+rte_table_hash_ext_stats_read(void *table, struct rte_table_stats *stats, int 
clear)
+{
+   struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(t->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(t->stats));
+
+   return 0;
+}
+
 struct rte_table_ops rte_table_hash_ext_ops = {
.f_create = rte_table_hash_ext_create,
.f_free = rte_table_hash_ext_free,
.f_add = rte_table_hash_ext_entry_add,
.f_delete = rte_table_hash_ext_entry_delete,
.f_lookup = rte_table_hash_ext_lookup,
+   .f_stats = rte_table_hash_ext_stats_read,
 };

 struct rte_table_ops 

[dpdk-dev] [PATCH v2 03/10] table: added array table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for array table.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp   |1 +
 config/common_linuxapp |1 +
 lib/librte_table/rte_table_array.c |   34 +-
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 096e09c..e31fba7 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -401,6 +401,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
 #
 CONFIG_RTE_LIBRTE_TABLE=y
 CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
+CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index d930808..6a6e33e 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -408,6 +408,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
 #
 CONFIG_RTE_LIBRTE_TABLE=y
 CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
+CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_array.c 
b/lib/librte_table/rte_table_array.c
index c031070..3f25fa6 100644
--- a/lib/librte_table/rte_table_array.c
+++ b/lib/librte_table/rte_table_array.c
@@ -42,7 +42,23 @@

 #include "rte_table_array.h"

+#ifdef RTE_TABLE_ARRAY_STATS_COLLECT
+
+#define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_ARRAY_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_ARRAY_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct rte_table_array {
+   struct rte_table_stats stats;
+
/* Input parameters */
uint32_t entry_size;
uint32_t n_entries;
@@ -164,7 +180,8 @@ rte_table_array_lookup(
void **entries)
 {
struct rte_table_array *t = (struct rte_table_array *) table;
-
+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(t, n_pkts_in);
*lookup_hit_mask = pkts_mask;

if ((pkts_mask & (pkts_mask + 1)) == 0) {
@@ -196,10 +213,25 @@ rte_table_array_lookup(
return 0;
 }

+static int
+rte_table_array_stats_read(void *table, struct rte_table_stats *stats, int 
clear)
+{
+   struct rte_table_array *array = (struct rte_table_array *) table;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(array->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(array->stats));
+
+   return 0;
+}
+
 struct rte_table_ops rte_table_array_ops = {
.f_create = rte_table_array_create,
.f_free = rte_table_array_free,
.f_add = rte_table_array_entry_add,
.f_delete = NULL,
.f_lookup = rte_table_array_lookup,
+   .f_stats = rte_table_array_stats_read,
 };
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 02/10] table: added acl table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for ACL table.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp |1 +
 config/common_linuxapp   |1 +
 lib/librte_table/rte_table_acl.c |   35 +++
 3 files changed, 37 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 238d178..096e09c 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -400,6 +400,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
 # Compile librte_table
 #
 CONFIG_RTE_LIBRTE_TABLE=y
+CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 36a623d..d930808 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -407,6 +407,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
 # Compile librte_table
 #
 CONFIG_RTE_LIBRTE_TABLE=y
+CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n

 #
 # Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c
index 4416311..194316d 100644
--- a/lib/librte_table/rte_table_acl.c
+++ b/lib/librte_table/rte_table_acl.c
@@ -43,7 +43,23 @@
 #include "rte_table_acl.h"
 #include 

+#ifdef RTE_TABLE_ACL_STATS_COLLECT
+
+#define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val) \
+   table->stats.n_pkts_in += val
+#define RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(table, val) \
+   table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
 struct rte_table_acl {
+   struct rte_table_stats stats;
+
/* Low-level ACL table */
char name[2][RTE_ACL_NAMESIZE];
struct rte_acl_param acl_params; /* for creating low level acl table */
@@ -441,6 +457,9 @@ rte_table_acl_lookup(
uint64_t pkts_out_mask;
uint32_t n_pkts, i, j;

+   __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+   RTE_TABLE_ACL_STATS_PKTS_IN_ADD(acl, n_pkts_in);
+
/* Input conversion */
for (i = 0, j = 0; i < (uint32_t)(RTE_PORT_IN_BURST_SIZE_MAX -
__builtin_clzll(pkts_mask)); i++) {
@@ -478,6 +497,21 @@ rte_table_acl_lookup(
}

*lookup_hit_mask = pkts_out_mask;
+   RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(acl, n_pkts_in - 
__builtin_popcountll(pkts_out_mask));
+
+   return 0;
+}
+
+static int
+rte_table_acl_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+   struct rte_table_acl *acl = (struct rte_table_acl *) table;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(acl->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(acl->stats));

return 0;
 }
@@ -488,4 +522,5 @@ struct rte_table_ops rte_table_acl_ops = {
.f_add = rte_table_acl_entry_add,
.f_delete = rte_table_acl_entry_delete,
.f_lookup = rte_table_acl_lookup,
+   .f_stats = rte_table_acl_stats_read,
 };
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 01/10] table: added structure for storing table stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added common structure for table statistics.

Signed-off-by: Maciej Gajdzica 
---
 lib/librte_table/rte_table.h |   25 +
 1 file changed, 25 insertions(+)

diff --git a/lib/librte_table/rte_table.h b/lib/librte_table/rte_table.h
index d57bc33..9860b7b 100644
--- a/lib/librte_table/rte_table.h
+++ b/lib/librte_table/rte_table.h
@@ -58,6 +58,12 @@ extern "C" {
 #include 
 #include 

+/** Lookup table statistics */
+struct rte_table_stats {
+   uint64_t n_pkts_in;
+   uint64_t n_pkts_lookup_miss;
+};
+
 /**
  * Lookup table create
  *
@@ -186,6 +192,24 @@ typedef int (*rte_table_op_lookup)(
uint64_t *lookup_hit_mask,
void **entries);

+/**
+ * Lookup table stats read
+ *
+ * @param port
+ *   Handle to lookup table instance
+ * @param stats
+ *   Handle to table stats struct to copy data
+ * @param clear
+ *   Flag indicating that stats should be cleared after read
+ *
+ * @return
+ *   Error code or 0 on success.
+ */
+typedef int (*rte_table_op_stats_read)(
+   void *table,
+   struct rte_table_stats *stats,
+   int clear);
+
 /** Lookup table interface defining the lookup table operation */
 struct rte_table_ops {
rte_table_op_create f_create;   /**< Create */
@@ -193,6 +217,7 @@ struct rte_table_ops {
rte_table_op_entry_add f_add;   /**< Entry add */
rte_table_op_entry_delete f_delete; /**< Entry delete */
rte_table_op_lookup f_lookup;   /**< Lookup */
+   rte_table_op_stats_read f_stats;/**< Stats */
 };

 #ifdef __cplusplus
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 00/10] table: added table statistics

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for every type of table. By default all table statistics
are disabled, user must activate them in config file.

Maciej Gajdzica (10):
  table: added structure for storing table stats
  table: added acl table stats
  table: added array table stats
  table: added hash_ext table stats
  table: added hash_key16 table stats
  table: added hash_key32 table stats
  table: added hash_key8 table stats
  table: added hash_lru table stats
  table: added lpm_ipv6 table stats
  table: added lpm table stats

 config/common_bsdapp|9 ++
 config/common_linuxapp  |9 ++
 lib/librte_table/rte_table.h|   25 +++
 lib/librte_table/rte_table_acl.c|   35 +
 lib/librte_table/rte_table_array.c  |   34 +++-
 lib/librte_table/rte_table_hash_ext.c   |   44 ++
 lib/librte_table/rte_table_hash_key16.c |   41 
 lib/librte_table/rte_table_hash_key32.c |   41 
 lib/librte_table/rte_table_hash_key8.c  |   52 +++
 lib/librte_table/rte_table_hash_lru.c   |   44 ++
 lib/librte_table/rte_table_lpm.c|   34 
 lib/librte_table/rte_table_lpm_ipv6.c   |   34 
 12 files changed, 401 insertions(+), 1 deletion(-)

-- 
1.7.9.5



[dpdk-dev] [PATCH v2 13/13] port: added port_sink stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for sink port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp   |1 +
 config/common_linuxapp |1 +
 lib/librte_port/rte_port_source_sink.c |   63 ++--
 3 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 7f2554c..238d178 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -394,6 +394,7 @@ CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_SOURCE_STATS_COLLECT=n
+CONFIG_RTE_PORT_SINK_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index f2d58b3..36a623d 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -401,6 +401,7 @@ CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_SOURCE_STATS_COLLECT=n
+CONFIG_RTE_PORT_SINK_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_source_sink.c 
b/lib/librte_port/rte_port_source_sink.c
index 4f51ec7..508fcf6 100644
--- a/lib/librte_port/rte_port_source_sink.c
+++ b/lib/librte_port/rte_port_source_sink.c
@@ -133,28 +133,64 @@ rte_port_source_stats_read(void *port,
 /*
  * Port SINK
  */
+#ifdef RTE_PORT_SINK_STATS_COLLECT
+
+#define RTE_PORT_SINK_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_SINK_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_SINK_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_SINK_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
+struct rte_port_sink {
+   struct rte_port_out_stats stats;
+};
+
 static void *
-rte_port_sink_create(__rte_unused void *params, __rte_unused int socket_id)
+rte_port_sink_create(__rte_unused void *params, int socket_id)
 {
-   return (void *) 1;
+   struct rte_port_sink *port;
+
+   /* Memory allocation */
+   port = rte_zmalloc_socket("PORT", sizeof(*port),
+   RTE_CACHE_LINE_SIZE, socket_id);
+   if (port == NULL) {
+   RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
+   return NULL;
+   }
+
+   return port;
 }

 static int
-rte_port_sink_tx(__rte_unused void *port, struct rte_mbuf *pkt)
+rte_port_sink_tx(void *port, struct rte_mbuf *pkt)
 {
+   __rte_unused struct rte_port_sink *p = (struct rte_port_sink *) port;
+
+   RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, 1);
rte_pktmbuf_free(pkt);
+   RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, 1);

return 0;
 }

 static int
-rte_port_sink_tx_bulk(__rte_unused void *port, struct rte_mbuf **pkts,
+rte_port_sink_tx_bulk(void *port, struct rte_mbuf **pkts,
uint64_t pkts_mask)
 {
+   __rte_unused struct rte_port_sink *p = (struct rte_port_sink *) port;
+
if ((pkts_mask & (pkts_mask + 1)) == 0) {
uint64_t n_pkts = __builtin_popcountll(pkts_mask);
uint32_t i;

+   RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, n_pkts);
+   RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, n_pkts);
for (i = 0; i < n_pkts; i++) {
struct rte_mbuf *pkt = pkts[i];

@@ -166,6 +202,8 @@ rte_port_sink_tx_bulk(__rte_unused void *port, struct 
rte_mbuf **pkts,
uint64_t pkt_mask = 1LLU << pkt_index;
struct rte_mbuf *pkt = pkts[pkt_index];

+   RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, 1);
+   RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, 1);
rte_pktmbuf_free(pkt);
pkts_mask &= ~pkt_mask;
}
@@ -174,6 +212,22 @@ rte_port_sink_tx_bulk(__rte_unused void *port, struct 
rte_mbuf **pkts,
return 0;
 }

+static int
+rte_port_sink_stats_read(void *port, struct rte_port_out_stats *stats,
+   int clear)
+{
+   struct rte_port_sink *p =
+   (struct rte_port_sink *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Summary of port operations
  */
@@ -190,4 +244,5 @@ struct rte_port_out_ops rte_port_sink_ops = {
.f_tx = rte_port_sink_tx,
.f_tx_bulk = rte_port_sink_tx_bulk,
.f_flush = NULL,
+   .f_stats = rte_port_sink_stats_read,
 };
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 12/13] port: added port_source stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for source port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp   |1 +
 config/common_linuxapp |1 +
 lib/librte_port/rte_port_source_sink.c |   35 
 3 files changed, 37 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 06c788c..7f2554c 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -393,6 +393,7 @@ CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n
+CONFIG_RTE_PORT_SOURCE_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 819edea..f2d58b3 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -400,6 +400,7 @@ CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n
+CONFIG_RTE_PORT_SOURCE_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_source_sink.c 
b/lib/librte_port/rte_port_source_sink.c
index b9a25bb..4f51ec7 100644
--- a/lib/librte_port/rte_port_source_sink.c
+++ b/lib/librte_port/rte_port_source_sink.c
@@ -42,7 +42,23 @@
 /*
  * Port SOURCE
  */
+#ifdef RTE_PORT_SOURCE_STATS_COLLECT
+
+#define RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_SOURCE_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_SOURCE_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_source {
+   struct rte_port_in_stats stats;
+
struct rte_mempool *mempool;
 };

@@ -93,9 +109,27 @@ rte_port_source_rx(void *port, struct rte_mbuf **pkts, 
uint32_t n_pkts)
if (rte_mempool_get_bulk(p->mempool, (void **) pkts, n_pkts) != 0)
return 0;

+   RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(p, n_pkts);
+
return n_pkts;
 }

+static int
+rte_port_source_stats_read(void *port,
+   struct rte_port_in_stats *stats, int clear)
+{
+   struct rte_port_source *p =
+   (struct rte_port_source *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Port SINK
  */
@@ -147,6 +181,7 @@ struct rte_port_in_ops rte_port_source_ops = {
.f_create = rte_port_source_create,
.f_free = rte_port_source_free,
.f_rx = rte_port_source_rx,
+   .f_stats = rte_port_source_stats_read,
 };

 struct rte_port_out_ops rte_port_sink_ops = {
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 11/13] port: added port_sched_writer stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for sched writer port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp |1 +
 config/common_linuxapp   |1 +
 lib/librte_port/rte_port_sched.c |   57 ++
 3 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index eb2d479..06c788c 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -392,6 +392,7 @@ CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n
+CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index abeb703..819edea 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -399,6 +399,7 @@ CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n
+CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_sched.c b/lib/librte_port/rte_port_sched.c
index f1cb435..93d7930 100644
--- a/lib/librte_port/rte_port_sched.c
+++ b/lib/librte_port/rte_port_sched.c
@@ -132,7 +132,23 @@ rte_port_sched_reader_stats_read(void *port,
 /*
  * Writer
  */
+#ifdef RTE_PORT_SCHED_WRITER_STATS_COLLECT
+
+#define RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_sched_writer {
+   struct rte_port_out_stats stats;
+
struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
struct rte_sched_port *sched;
uint32_t tx_burst_sz;
@@ -180,8 +196,12 @@ rte_port_sched_writer_tx(void *port, struct rte_mbuf *pkt)
struct rte_port_sched_writer *p = (struct rte_port_sched_writer *) port;

p->tx_buf[p->tx_buf_count++] = pkt;
+   RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(p, 1);
if (p->tx_buf_count >= p->tx_burst_sz) {
-   rte_sched_port_enqueue(p->sched, p->tx_buf, p->tx_buf_count);
+   __rte_unused uint32_t nb_tx;
+
+   nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf, 
p->tx_buf_count);
+   RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - 
nb_tx);
p->tx_buf_count = 0;
}

@@ -200,15 +220,18 @@ rte_port_sched_writer_tx_bulk(void *port,
((pkts_mask & bsz_mask) ^ bsz_mask);

if (expr == 0) {
+   __rte_unused uint32_t nb_tx;
uint64_t n_pkts = __builtin_popcountll(pkts_mask);

if (tx_buf_count) {
-   rte_sched_port_enqueue(p->sched, p->tx_buf,
+   nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf,
tx_buf_count);
+   RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, 
tx_buf_count - nb_tx);
p->tx_buf_count = 0;
}

-   rte_sched_port_enqueue(p->sched, pkts, n_pkts);
+   nb_tx = rte_sched_port_enqueue(p->sched, pkts, n_pkts);
+   RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - nb_tx);
} else {
for ( ; pkts_mask; ) {
uint32_t pkt_index = __builtin_ctzll(pkts_mask);
@@ -216,13 +239,17 @@ rte_port_sched_writer_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[tx_buf_count++] = pkt;
+   RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(p, 1);
pkts_mask &= ~pkt_mask;
}
p->tx_buf_count = tx_buf_count;

if (tx_buf_count >= p->tx_burst_sz) {
-   rte_sched_port_enqueue(p->sched, p->tx_buf,
+   __rte_unused uint32_t nb_tx;
+
+   nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf,
tx_buf_count);
+   RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, 
tx_buf_count - nb_tx);
p->tx_buf_count = 0;
}
}
@@ -236,7 +263,10 @@ rte_port_sched_writer_flush(void *port)
struct rte_port_sched_writer *p = (struct rte_port_sched_writer *) port;

if (p->tx_buf_count) {
-   rte_sched_port_enqueue(p->sched, p->tx_buf, p->tx_buf_count);
+   __rte_unused uint32_t nb_tx;
+
+   nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf, 
p->tx_buf_count);
+   

[dpdk-dev] [PATCH v2 09/13] port: added port_ring_writer_nodrop stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for ring writer nodrop port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp|1 +
 config/common_linuxapp  |1 +
 lib/librte_port/rte_port_ring.c |   39 +++
 3 files changed, 41 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 3d250ae..8ddd84a 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -390,6 +390,7 @@ CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 770a1f0..593fe79 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -397,6 +397,7 @@ CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c
index 6d03093..b263662 100644
--- a/lib/librte_port/rte_port_ring.c
+++ b/lib/librte_port/rte_port_ring.c
@@ -359,7 +359,23 @@ rte_port_ring_writer_stats_read(void *port,
  */
 #define RTE_PORT_RING_WRITER_NODROP_APPROACH  1

+#ifdef RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT
+
+#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_ring_writer_nodrop {
+   struct rte_port_out_stats stats;
+
struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX];
struct rte_ring *ring;
uint32_t tx_burst_sz;
@@ -429,6 +445,7 @@ send_burst_nodrop(struct rte_port_ring_writer_nodrop *p)
}

/* We didn't send the packets in maximum allowed attempts */
+   RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - 
nb_tx);
for ( ; nb_tx < p->tx_buf_count; nb_tx++)
rte_pktmbuf_free(p->tx_buf[nb_tx]);

@@ -442,6 +459,7 @@ rte_port_ring_writer_nodrop_tx(void *port, struct rte_mbuf 
*pkt)
(struct rte_port_ring_writer_nodrop *) port;

p->tx_buf[p->tx_buf_count++] = pkt;
+   RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst_nodrop(p);

@@ -462,6 +480,7 @@ rte_port_ring_writer_nodrop_tx_bulk(void *port,
uint64_t n_pkts = __builtin_popcountll(pkts_mask);
uint32_t i;

+   RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
for (i = 0; i < n_pkts; i++) {
struct rte_mbuf *pkt = pkts[i];

@@ -476,6 +495,7 @@ rte_port_ring_writer_nodrop_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[p->tx_buf_count++] = pkt;
+   RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst_nodrop(p);
pkts_mask &= ~pkt_mask;
@@ -507,6 +527,7 @@ rte_port_ring_writer_nodrop_tx_bulk(void *port,
if (tx_buf_count)
send_burst_nodrop(p);

+   RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
n_pkts_ok = rte_ring_sp_enqueue_burst(p->ring, (void **)pkts, 
n_pkts);

if (n_pkts_ok >= n_pkts)
@@ -528,6 +549,7 @@ rte_port_ring_writer_nodrop_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[tx_buf_count++] = pkt;
+   RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
pkts_mask &= ~pkt_mask;
}

@@ -571,6 +593,22 @@ rte_port_ring_writer_nodrop_free(void *port)
return 0;
 }

+static int
+rte_port_ring_writer_nodrop_stats_read(void *port,
+   struct rte_port_out_stats *stats, int clear)
+{
+   struct rte_port_ring_writer_nodrop *p =
+   (struct rte_port_ring_writer_nodrop *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Summary of port operations
  */
@@ -596,4 +634,5 @@ struct rte_port_out_ops rte_port_ring_writer_nodrop_ops = {
.f_tx = rte_port_ring_writer_nodrop_tx,

[dpdk-dev] [PATCH v2 08/13] port: added port_ring_writer stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for port writer port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp|1 +
 config/common_linuxapp  |1 +
 lib/librte_port/rte_port_ring.c |   40 +++
 3 files changed, 42 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 47165f9..3d250ae 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -389,6 +389,7 @@ CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index a6da86c..770a1f0 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -396,6 +396,7 @@ CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c
index 6c5b514..6d03093 100644
--- a/lib/librte_port/rte_port_ring.c
+++ b/lib/librte_port/rte_port_ring.c
@@ -135,7 +135,23 @@ rte_port_ring_reader_stats_read(void *port,
  */
 #define RTE_PORT_RING_WRITER_APPROACH  1

+#ifdef RTE_PORT_RING_WRITER_STATS_COLLECT
+
+#define RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_ring_writer {
+   struct rte_port_out_stats stats;
+
struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX];
struct rte_ring *ring;
uint32_t tx_burst_sz;
@@ -183,6 +199,7 @@ send_burst(struct rte_port_ring_writer *p)
nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf,
p->tx_buf_count);

+   RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
for ( ; nb_tx < p->tx_buf_count; nb_tx++)
rte_pktmbuf_free(p->tx_buf[nb_tx]);

@@ -195,6 +212,7 @@ rte_port_ring_writer_tx(void *port, struct rte_mbuf *pkt)
struct rte_port_ring_writer *p = (struct rte_port_ring_writer *) port;

p->tx_buf[p->tx_buf_count++] = pkt;
+   RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst(p);

@@ -214,6 +232,7 @@ rte_port_ring_writer_tx_bulk(void *port,
uint64_t n_pkts = __builtin_popcountll(pkts_mask);
uint32_t i;

+   RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
for (i = 0; i < n_pkts; i++) {
struct rte_mbuf *pkt = pkts[i];

@@ -228,6 +247,7 @@ rte_port_ring_writer_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[p->tx_buf_count++] = pkt;
+   RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst(p);
pkts_mask &= ~pkt_mask;
@@ -259,8 +279,10 @@ rte_port_ring_writer_tx_bulk(void *port,
if (tx_buf_count)
send_burst(p);

+   RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
n_pkts_ok = rte_ring_sp_enqueue_burst(p->ring, (void **)pkts, 
n_pkts);

+   RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - n_pkts_ok);
for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) {
struct rte_mbuf *pkt = pkts[n_pkts_ok];

@@ -273,6 +295,7 @@ rte_port_ring_writer_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[tx_buf_count++] = pkt;
+   RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1);
pkts_mask &= ~pkt_mask;
}

@@ -315,6 +338,22 @@ rte_port_ring_writer_free(void *port)
return 0;
 }

+static int
+rte_port_ring_writer_stats_read(void *port,
+   struct rte_port_out_stats *stats, int clear)
+{
+   struct rte_port_ring_writer *p =
+   (struct rte_port_ring_writer *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Port RING Writer Nodrop
  */
@@ -548,6 +587,7 @@ struct rte_port_out_ops rte_port_ring_writer_ops = {
.f_tx = rte_port_ring_writer_tx,

[dpdk-dev] [PATCH v2 07/13] port: added port_ring_reader stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for ring reader port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp|1 +
 config/common_linuxapp  |1 +
 lib/librte_port/rte_port_ring.c |   39 ++-
 3 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index e7a19d4..47165f9 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -388,6 +388,7 @@ CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index ff9898f..a6da86c 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -395,6 +395,7 @@ CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c
index 371bb1e..6c5b514 100644
--- a/lib/librte_port/rte_port_ring.c
+++ b/lib/librte_port/rte_port_ring.c
@@ -42,7 +42,23 @@
 /*
  * Port RING Reader
  */
+#ifdef RTE_PORT_RING_READER_STATS_COLLECT
+
+#define RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_RING_READER_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_RING_READER_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_ring_reader {
+   struct rte_port_in_stats stats;
+
struct rte_ring *ring;
 };

@@ -77,8 +93,12 @@ static int
 rte_port_ring_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 {
struct rte_port_ring_reader *p = (struct rte_port_ring_reader *) port;
+   uint32_t nb_rx;
+
+   nb_rx = rte_ring_sc_dequeue_burst(p->ring, (void **) pkts, n_pkts);
+   RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(p, nb_rx);

-   return rte_ring_sc_dequeue_burst(p->ring, (void **) pkts, n_pkts);
+   return nb_rx;
 }

 static int
@@ -94,6 +114,22 @@ rte_port_ring_reader_free(void *port)
return 0;
 }

+static int
+rte_port_ring_reader_stats_read(void *port,
+   struct rte_port_in_stats *stats, int clear)
+{
+   struct rte_port_ring_reader *p =
+   (struct rte_port_ring_reader *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Port RING Writer
  */
@@ -503,6 +539,7 @@ struct rte_port_in_ops rte_port_ring_reader_ops = {
.f_create = rte_port_ring_reader_create,
.f_free = rte_port_ring_reader_free,
.f_rx = rte_port_ring_reader_rx,
+   .f_stats = rte_port_ring_reader_stats_read,
 };

 struct rte_port_out_ops rte_port_ring_writer_ops = {
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 06/13] port: added port_ras stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for IPv4 and IPv6 reassembly ports.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp   |1 +
 config/common_linuxapp |1 +
 lib/librte_port/rte_port_ras.c |   38 ++
 3 files changed, 40 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index f3b8459..e7a19d4 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -387,6 +387,7 @@ CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 3ac2e66..ff9898f 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -394,6 +394,7 @@ CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n
 CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c
index 5eb627a..d7aaf6c 100644
--- a/lib/librte_port/rte_port_ras.c
+++ b/lib/librte_port/rte_port_ras.c
@@ -51,6 +51,20 @@
 #define RTE_PORT_RAS_N_ENTRIES (RTE_PORT_RAS_N_BUCKETS * 
RTE_PORT_RAS_N_ENTRIES_PER_BUCKET)
 #endif

+#ifdef RTE_PORT_RING_WRITER_RAS_STATS_COLLECT
+
+#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_ring_writer_ras;

 typedef void (*ras_op)(
@@ -63,6 +77,8 @@ static void
 process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt);

 struct rte_port_ring_writer_ras {
+   struct rte_port_out_stats stats;
+
struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX];
struct rte_ring *ring;
uint32_t tx_burst_sz;
@@ -153,6 +169,7 @@ send_burst(struct rte_port_ring_writer_ras *p)
nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf,
p->tx_buf_count);

+   RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - 
nb_tx);
for ( ; nb_tx < p->tx_buf_count; nb_tx++)
rte_pktmbuf_free(p->tx_buf[nb_tx]);

@@ -225,6 +242,7 @@ rte_port_ring_writer_ras_tx(void *port, struct rte_mbuf 
*pkt)
struct rte_port_ring_writer_ras *p =
(struct rte_port_ring_writer_ras *) port;

+   RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1);
p->f_ras(p, pkt);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst(p);
@@ -247,6 +265,7 @@ rte_port_ring_writer_ras_tx_bulk(void *port,
for (i = 0; i < n_pkts; i++) {
struct rte_mbuf *pkt = pkts[i];

+   RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1);
p->f_ras(p, pkt);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst(p);
@@ -257,6 +276,7 @@ rte_port_ring_writer_ras_tx_bulk(void *port,
uint64_t pkt_mask = 1LLU << pkt_index;
struct rte_mbuf *pkt = pkts[pkt_index];

+   RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1);
p->f_ras(p, pkt);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst(p);
@@ -298,6 +318,22 @@ rte_port_ring_writer_ras_free(void *port)
return 0;
 }

+static int
+rte_port_ras_writer_stats_read(void *port,
+   struct rte_port_out_stats *stats, int clear)
+{
+   struct rte_port_ring_writer_ras *p =
+   (struct rte_port_ring_writer_ras *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Summary of port operations
  */
@@ -307,6 +343,7 @@ struct rte_port_out_ops rte_port_ring_writer_ipv4_ras_ops = 
{
.f_tx = rte_port_ring_writer_ras_tx,
.f_tx_bulk = rte_port_ring_writer_ras_tx_bulk,
.f_flush = rte_port_ring_writer_ras_flush,
+   .f_stats = rte_port_ras_writer_stats_read,
 };

 struct rte_port_out_ops rte_port_ring_writer_ipv6_ras_ops = {
@@ -315,4 +352,5 @@ struct rte_port_out_ops rte_port_ring_writer_ipv6_ras_ops = 
{
.f_tx = rte_port_ring_writer_ras_tx,
.f_tx_bulk = rte_port_ring_writer_ras_tx_bulk,
.f_flush = rte_port_ring_writer_ras_flush,
+   .f_stats = 

[dpdk-dev] [PATCH v2 05/13] port: added port_frag stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for IPv4 and IPv6 fragmentation ports.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp|1 +
 config/common_linuxapp  |1 +
 lib/librte_port/rte_port_frag.c |   36 
 3 files changed, 38 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 89da648..f3b8459 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -386,6 +386,7 @@ CONFIG_RTE_LIBRTE_PORT=y
 CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 630d163..3ac2e66 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -393,6 +393,7 @@ CONFIG_RTE_LIBRTE_PORT=y
 CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n
+CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c
index c4c05dc..c42b182 100644
--- a/lib/librte_port/rte_port_frag.c
+++ b/lib/librte_port/rte_port_frag.c
@@ -41,6 +41,20 @@
 /* Max number of fragments per packet allowed */
 #defineRTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80

+#ifdef RTE_PORT_RING_READER_FRAG_STATS_COLLECT
+
+#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 typedef int32_t
(*frag_op)(struct rte_mbuf *pkt_in,
struct rte_mbuf **pkts_out,
@@ -50,6 +64,8 @@ typedef int32_t
struct rte_mempool *pool_indirect);

 struct rte_port_ring_reader_frag {
+   struct rte_port_in_stats stats;
+
/* Input parameters */
struct rte_ring *ring;
uint32_t mtu;
@@ -171,6 +187,7 @@ rte_port_ring_reader_frag_rx(void *port,
if (p->n_pkts == 0) {
p->n_pkts = rte_ring_sc_dequeue_burst(p->ring,
(void **) p->pkts, RTE_PORT_IN_BURST_SIZE_MAX);
+   RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(p, 
p->n_pkts);
if (p->n_pkts == 0)
return n_pkts_out;
p->pos_pkts = 0;
@@ -203,6 +220,7 @@ rte_port_ring_reader_frag_rx(void *port,

if (status < 0) {
rte_pktmbuf_free(pkt);
+   RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(p, 1);
continue;
}

@@ -252,6 +270,22 @@ rte_port_ring_reader_frag_free(void *port)
return 0;
 }

+static int
+rte_port_frag_reader_stats_read(void *port,
+   struct rte_port_in_stats *stats, int clear)
+{
+   struct rte_port_ring_reader_frag *p =
+   (struct rte_port_ring_reader_frag *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Summary of port operations
  */
@@ -259,10 +293,12 @@ struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops 
= {
.f_create = rte_port_ring_reader_ipv4_frag_create,
.f_free = rte_port_ring_reader_frag_free,
.f_rx = rte_port_ring_reader_frag_rx,
+   .f_stats = rte_port_frag_reader_stats_read,
 };

 struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops = {
.f_create = rte_port_ring_reader_ipv6_frag_create,
.f_free = rte_port_ring_reader_frag_free,
.f_rx = rte_port_ring_reader_frag_rx,
+   .f_stats = rte_port_frag_reader_stats_read,
 };
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 04/13] port: added port_ethdev_writer_nodrop stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for ethdev writer nodrop port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp  |1 +
 config/common_linuxapp|1 +
 lib/librte_port/rte_port_ethdev.c |   38 +
 3 files changed, 40 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 337ce31..89da648 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -385,6 +385,7 @@ CONFIG_RTE_LIBRTE_REORDER=y
 CONFIG_RTE_LIBRTE_PORT=y
 CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n
+CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2e0856f..630d163 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -392,6 +392,7 @@ CONFIG_RTE_LIBRTE_REORDER=y
 CONFIG_RTE_LIBRTE_PORT=y
 CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n
 CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n
+CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_ethdev.c 
b/lib/librte_port/rte_port_ethdev.c
index e9e549a..7a0c14e 100644
--- a/lib/librte_port/rte_port_ethdev.c
+++ b/lib/librte_port/rte_port_ethdev.c
@@ -364,7 +364,23 @@ static int rte_port_ethdev_writer_stats_read(void *port,
  */
 #define RTE_PORT_ETHDEV_WRITER_NODROP_APPROACH  1

+#ifdef RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT
+
+#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_ethdev_writer_nodrop {
+   struct rte_port_out_stats stats;
+
struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
uint32_t tx_burst_sz;
uint16_t tx_buf_count;
@@ -437,6 +453,7 @@ send_burst_nodrop(struct rte_port_ethdev_writer_nodrop *p)
}

/* We didn't send the packets in maximum allowed attempts */
+   RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - 
nb_tx);
for ( ; nb_tx < p->tx_buf_count; nb_tx++)
rte_pktmbuf_free(p->tx_buf[nb_tx]);

@@ -450,6 +467,7 @@ rte_port_ethdev_writer_nodrop_tx(void *port, struct 
rte_mbuf *pkt)
(struct rte_port_ethdev_writer_nodrop *) port;

p->tx_buf[p->tx_buf_count++] = pkt;
+   RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst_nodrop(p);

@@ -470,6 +488,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port,
uint64_t n_pkts = __builtin_popcountll(pkts_mask);
uint32_t i;

+   RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
for (i = 0; i < n_pkts; i++) {
struct rte_mbuf *pkt = pkts[i];

@@ -484,6 +503,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[p->tx_buf_count++] = pkt;
+   RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst_nodrop(p);
pkts_mask &= ~pkt_mask;
@@ -515,6 +535,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port,
if (tx_buf_count)
send_burst_nodrop(p);

+   RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
n_pkts_ok = rte_eth_tx_burst(p->port_id, p->queue_id, pkts,
n_pkts);

@@ -537,6 +558,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[tx_buf_count++] = pkt;
+   RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
pkts_mask &= ~pkt_mask;
}

@@ -580,6 +602,21 @@ rte_port_ethdev_writer_nodrop_free(void *port)
return 0;
 }

+static int rte_port_ethdev_writer_nodrop_stats_read(void *port,
+   struct rte_port_out_stats *stats, int clear)
+{
+   struct rte_port_ethdev_writer_nodrop *p =
+   (struct rte_port_ethdev_writer_nodrop *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Summary of port operations
  */
@@ -605,4 +642,5 @@ struct rte_port_out_ops rte_port_ethdev_writer_nodrop_ops = 
{
.f_tx = rte_port_ethdev_writer_nodrop_tx,
.f_tx_bulk = 

[dpdk-dev] [PATCH v2 03/13] port: added port_ethdev_writer stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for ethdev writer port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp  |1 +
 config/common_linuxapp|1 +
 lib/librte_port/rte_port_ethdev.c |   38 +
 3 files changed, 40 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index db73c9c..337ce31 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -384,6 +384,7 @@ CONFIG_RTE_LIBRTE_REORDER=y
 #
 CONFIG_RTE_LIBRTE_PORT=y
 CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n
+CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index a8719a6..2e0856f 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -391,6 +391,7 @@ CONFIG_RTE_LIBRTE_REORDER=y
 #
 CONFIG_RTE_LIBRTE_PORT=y
 CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n
+CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_ethdev.c 
b/lib/librte_port/rte_port_ethdev.c
index 05bc077..e9e549a 100644
--- a/lib/librte_port/rte_port_ethdev.c
+++ b/lib/librte_port/rte_port_ethdev.c
@@ -136,7 +136,23 @@ static int rte_port_ethdev_reader_stats_read(void *port,
  */
 #define RTE_PORT_ETHDEV_WRITER_APPROACH  1

+#ifdef RTE_PORT_ETHDEV_WRITER_STATS_COLLECT
+
+#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_ethdev_writer {
+   struct rte_port_out_stats stats;
+
struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
uint32_t tx_burst_sz;
uint16_t tx_buf_count;
@@ -187,6 +203,7 @@ send_burst(struct rte_port_ethdev_writer *p)
nb_tx = rte_eth_tx_burst(p->port_id, p->queue_id,
 p->tx_buf, p->tx_buf_count);

+   RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
for ( ; nb_tx < p->tx_buf_count; nb_tx++)
rte_pktmbuf_free(p->tx_buf[nb_tx]);

@@ -220,6 +237,7 @@ rte_port_ethdev_writer_tx_bulk(void *port,
uint64_t n_pkts = __builtin_popcountll(pkts_mask);
uint32_t i;

+   RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
for (i = 0; i < n_pkts; i++) {
struct rte_mbuf *pkt = pkts[i];

@@ -234,6 +252,7 @@ rte_port_ethdev_writer_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[p->tx_buf_count++] = pkt;
+   RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, 1);
if (p->tx_buf_count >= p->tx_burst_sz)
send_burst(p);
pkts_mask &= ~pkt_mask;
@@ -264,9 +283,11 @@ rte_port_ethdev_writer_tx_bulk(void *port,
if (tx_buf_count)
send_burst(p);

+   RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
n_pkts_ok = rte_eth_tx_burst(p->port_id, p->queue_id, pkts,
n_pkts);

+   RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - 
n_pkts_ok);
for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) {
struct rte_mbuf *pkt = pkts[n_pkts_ok];

@@ -279,6 +300,7 @@ rte_port_ethdev_writer_tx_bulk(void *port,
struct rte_mbuf *pkt = pkts[pkt_index];

p->tx_buf[tx_buf_count++] = pkt;
+   RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, 1);
pkts_mask &= ~pkt_mask;
}

@@ -322,6 +344,21 @@ rte_port_ethdev_writer_free(void *port)
return 0;
 }

+static int rte_port_ethdev_writer_stats_read(void *port,
+   struct rte_port_out_stats *stats, int clear)
+{
+   struct rte_port_ethdev_writer *p =
+   (struct rte_port_ethdev_writer *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Port ETHDEV Writer Nodrop
  */
@@ -559,6 +596,7 @@ struct rte_port_out_ops rte_port_ethdev_writer_ops = {
.f_tx = rte_port_ethdev_writer_tx,
.f_tx_bulk = rte_port_ethdev_writer_tx_bulk,
.f_flush = rte_port_ethdev_writer_flush,
+   .f_stats = rte_port_ethdev_writer_stats_read,
 };

 struct rte_port_out_ops rte_port_ethdev_writer_nodrop_ops = {
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 02/13] port: added port_ethdev_reader stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for ethdev reader port.

Signed-off-by: Maciej Gajdzica 
---
 config/common_bsdapp  |1 +
 config/common_linuxapp|1 +
 lib/librte_port/rte_port_ethdev.c |   37 -
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index c2374c0..db73c9c 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -383,6 +383,7 @@ CONFIG_RTE_LIBRTE_REORDER=y
 # Compile librte_port
 #
 CONFIG_RTE_LIBRTE_PORT=y
+CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 0078dc9..a8719a6 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -390,6 +390,7 @@ CONFIG_RTE_LIBRTE_REORDER=y
 # Compile librte_port
 #
 CONFIG_RTE_LIBRTE_PORT=y
+CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n

 #
 # Compile librte_table
diff --git a/lib/librte_port/rte_port_ethdev.c 
b/lib/librte_port/rte_port_ethdev.c
index 1f77cb5..05bc077 100644
--- a/lib/librte_port/rte_port_ethdev.c
+++ b/lib/librte_port/rte_port_ethdev.c
@@ -42,7 +42,23 @@
 /*
  * Port ETHDEV Reader
  */
+#ifdef RTE_PORT_ETHDEV_READER_STATS_COLLECT
+
+#define RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(port, val) \
+   port->stats.n_pkts_in += val
+#define RTE_PORT_ETHDEV_READER_STATS_PKTS_DROP_ADD(port, val) \
+   port->stats.n_pkts_drop += val
+
+#else
+
+#define RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(port, val)
+#define RTE_PORT_ETHDEV_READER_STATS_PKTS_DROP_ADD(port, val)
+
+#endif
+
 struct rte_port_ethdev_reader {
+   struct rte_port_in_stats stats;
+
uint16_t queue_id;
uint8_t port_id;
 };
@@ -80,8 +96,11 @@ rte_port_ethdev_reader_rx(void *port, struct rte_mbuf 
**pkts, uint32_t n_pkts)
 {
struct rte_port_ethdev_reader *p =
(struct rte_port_ethdev_reader *) port;
+   uint16_t rx_pkt_cnt;

-   return rte_eth_rx_burst(p->port_id, p->queue_id, pkts, n_pkts);
+   rx_pkt_cnt = rte_eth_rx_burst(p->port_id, p->queue_id, pkts, n_pkts);
+   RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(p, rx_pkt_cnt);
+   return rx_pkt_cnt;
 }

 static int
@@ -97,6 +116,21 @@ rte_port_ethdev_reader_free(void *port)
return 0;
 }

+static int rte_port_ethdev_reader_stats_read(void *port,
+   struct rte_port_in_stats * stats, int clear)
+{
+   struct rte_port_ethdev_reader *p =
+   (struct rte_port_ethdev_reader *) port;
+
+   if (stats != NULL)
+   memcpy(stats, >stats, sizeof(p->stats));
+
+   if (clear)
+   memset(>stats, 0, sizeof(p->stats));
+
+   return 0;
+}
+
 /*
  * Port ETHDEV Writer
  */
@@ -516,6 +550,7 @@ struct rte_port_in_ops rte_port_ethdev_reader_ops = {
.f_create = rte_port_ethdev_reader_create,
.f_free = rte_port_ethdev_reader_free,
.f_rx = rte_port_ethdev_reader_rx,
+   .f_stats = rte_port_ethdev_reader_stats_read,
 };

 struct rte_port_out_ops rte_port_ethdev_writer_ops = {
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 01/13] port: added structures for port stats

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added common data structures for port statistics.

Signed-off-by: Maciej Gajdzica 
---
 lib/librte_port/rte_port.h |   60 
 1 file changed, 55 insertions(+), 5 deletions(-)

diff --git a/lib/librte_port/rte_port.h b/lib/librte_port/rte_port.h
index d84e5a1..ab433e5 100644
--- a/lib/librte_port/rte_port.h
+++ b/lib/librte_port/rte_port.h
@@ -81,6 +81,12 @@ extern "C" {
 Cannot be changed. */
 #define RTE_PORT_IN_BURST_SIZE_MAX 64

+/** Input port statistics */
+struct rte_port_in_stats {
+   uint64_t n_pkts_in;
+   uint64_t n_pkts_drop;
+};
+
 /**
  * Input port create
  *
@@ -120,17 +126,42 @@ typedef int (*rte_port_in_op_rx)(
struct rte_mbuf **pkts,
uint32_t n_pkts);

+/**
+ * Input port stats get
+ *
+ * @param port
+ *   Handle to output port instance
+ * @param stats
+ *   Handle to port_in stats struct to copy data
+ * @param clear
+ *   Flag indicating that stats should be cleared after read
+ *
+ * @return
+ *   Error code or 0 on success.
+ */
+typedef int (*rte_port_in_op_stats_read)(
+   void *port,
+   struct rte_port_in_stats *stats,
+   int clear);
+
 /** Input port interface defining the input port operation */
 struct rte_port_in_ops {
rte_port_in_op_create f_create; /**< Create */
rte_port_in_op_free f_free; /**< Free */
rte_port_in_op_rx f_rx; /**< Packet RX (packet burst) */
+   rte_port_in_op_stats_read f_stats;  /**< Stats */
 };

 /*
  * Port OUT
  *
  */
+/** Output port statistics */
+struct rte_port_out_stats {
+   uint64_t n_pkts_in;
+   uint64_t n_pkts_drop;
+};
+
 /**
  * Output port create
  *
@@ -197,13 +228,32 @@ typedef int (*rte_port_out_op_tx_bulk)(
  */
 typedef int (*rte_port_out_op_flush)(void *port);

+/**
+ * Output port stats read
+ *
+ * @param port
+ *   Handle to output port instance
+ * @param stats
+ *   Handle to port_out stats struct to copy data
+ * @param clear
+ *   Flag indicating that stats should be cleared after read
+ *
+ * @return
+ *   Error code or 0 on success.
+ */
+typedef int (*rte_port_out_op_stats_read)(
+   void *port,
+   struct rte_port_out_stats *stats,
+   int clear);
+
 /** Output port interface defining the output port operation */
 struct rte_port_out_ops {
-   rte_port_out_op_create f_create;   /**< Create */
-   rte_port_out_op_free f_free;   /**< Free */
-   rte_port_out_op_tx f_tx;   /**< Packet TX (single packet) */
-   rte_port_out_op_tx_bulk f_tx_bulk; /**< Packet TX (packet burst) */
-   rte_port_out_op_flush f_flush; /**< Flush */
+   rte_port_out_op_create f_create;/**< Create */
+   rte_port_out_op_free f_free;/**< Free */
+   rte_port_out_op_tx f_tx;/**< Packet TX 
(single packet) */
+   rte_port_out_op_tx_bulk f_tx_bulk;  /**< Packet TX (packet 
burst) */
+   rte_port_out_op_flush f_flush;  /**< Flush */
+   rte_port_out_op_stats_read f_stats; /**< Stats */
 };

 #ifdef __cplusplus
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 00/13] port: added port statistics

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added statistics for every type of port. By default all port statistics
are disabled, user must activate them in config file.

Maciej Gajdzica (13):
  port: added structures for port stats
  port: added port_ethdev_reader stats
  port: added port_ethdev_writer stats
  port: added port_ethdev_writer_nodrop stats
  port: added port_frag stats
  port: added port_ras stats
  port: added port_ring_reader stats
  port: added port_ring_writer stats
  port: added port_ring_writer_nodrop stats
  port: added port_sched_reader stats
  port: added port_sched_writer stats
  port: added port_source stats
  port: added port_sink stats

 config/common_bsdapp   |   12 
 config/common_linuxapp |   12 
 lib/librte_port/rte_port.h |   60 ++--
 lib/librte_port/rte_port_ethdev.c  |  113 +-
 lib/librte_port/rte_port_frag.c|   36 ++
 lib/librte_port/rte_port_ras.c |   38 ++
 lib/librte_port/rte_port_ring.c|  118 +++-
 lib/librte_port/rte_port_sched.c   |   96 --
 lib/librte_port/rte_port_source_sink.c |   98 --
 9 files changed, 566 insertions(+), 17 deletions(-)

-- 
1.7.9.5



[dpdk-dev] [PATCH v2 3/3] port: added ipv6 reassembly port

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added new port type - IPv6 reassembly port.

Signed-off-by: Maciej Gajdzica 
---
 lib/librte_port/rte_port_ras.c |  142 +---
 lib/librte_port/rte_port_ras.h |9 ++-
 2 files changed, 112 insertions(+), 39 deletions(-)

diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c
index b6ab67a..5eb627a 100644
--- a/lib/librte_port/rte_port_ras.c
+++ b/lib/librte_port/rte_port_ras.c
@@ -39,33 +39,46 @@

 #include "rte_port_ras.h"

-#ifndef IPV4_RAS_N_BUCKETS
-#define IPV4_RAS_N_BUCKETS 4094
+#ifndef RTE_PORT_RAS_N_BUCKETS
+#define RTE_PORT_RAS_N_BUCKETS 4094
 #endif

-#ifndef IPV4_RAS_N_ENTRIES_PER_BUCKET
-#define IPV4_RAS_N_ENTRIES_PER_BUCKET  8
+#ifndef RTE_PORT_RAS_N_ENTRIES_PER_BUCKET
+#define RTE_PORT_RAS_N_ENTRIES_PER_BUCKET  8
 #endif

-#ifndef IPV4_RAS_N_ENTRIES
-#define IPV4_RAS_N_ENTRIES (IPV4_RAS_N_BUCKETS * IPV4_RAS_N_ENTRIES_PER_BUCKET)
+#ifndef RTE_PORT_RAS_N_ENTRIES
+#define RTE_PORT_RAS_N_ENTRIES (RTE_PORT_RAS_N_BUCKETS * 
RTE_PORT_RAS_N_ENTRIES_PER_BUCKET)
 #endif

-struct rte_port_ring_writer_ipv4_ras {
+struct rte_port_ring_writer_ras;
+
+typedef void (*ras_op)(
+   struct rte_port_ring_writer_ras *p,
+   struct rte_mbuf *pkt);
+
+static void
+process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt);
+static void
+process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt);
+
+struct rte_port_ring_writer_ras {
struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX];
struct rte_ring *ring;
uint32_t tx_burst_sz;
uint32_t tx_buf_count;
struct rte_ip_frag_tbl *frag_tbl;
struct rte_ip_frag_death_row death_row;
+
+   ras_op f_ras;
 };

 static void *
-rte_port_ring_writer_ipv4_ras_create(void *params, int socket_id)
+rte_port_ring_writer_ras_create(void *params, int socket_id, int is_ipv4)
 {
-   struct rte_port_ring_writer_ipv4_ras_params *conf =
-   (struct rte_port_ring_writer_ipv4_ras_params *) params;
-   struct rte_port_ring_writer_ipv4_ras *port;
+   struct rte_port_ring_writer_ras_params *conf =
+   (struct rte_port_ring_writer_ras_params *) params;
+   struct rte_port_ring_writer_ras *port;
uint64_t frag_cycles;

/* Check input parameters */
@@ -97,9 +110,9 @@ rte_port_ring_writer_ipv4_ras_create(void *params, int 
socket_id)
frag_cycles *= 100;

port->frag_tbl = rte_ip_frag_table_create(
-   IPV4_RAS_N_BUCKETS,
-   IPV4_RAS_N_ENTRIES_PER_BUCKET,
-   IPV4_RAS_N_ENTRIES,
+   RTE_PORT_RAS_N_BUCKETS,
+   RTE_PORT_RAS_N_ENTRIES_PER_BUCKET,
+   RTE_PORT_RAS_N_ENTRIES,
frag_cycles,
socket_id);

@@ -115,11 +128,25 @@ rte_port_ring_writer_ipv4_ras_create(void *params, int 
socket_id)
port->tx_burst_sz = conf->tx_burst_sz;
port->tx_buf_count = 0;

+   port->f_ras = (is_ipv4 == 0) ? process_ipv4 : process_ipv6;
+
return port;
 }

+static void *
+rte_port_ring_writer_ipv4_ras_create(void *params, int socket_id)
+{
+   return rte_port_ring_writer_ras_create(params, socket_id, 1);
+}
+
+static void *
+rte_port_ring_writer_ipv6_ras_create(void *params, int socket_id)
+{
+   return rte_port_ring_writer_ras_create(params, socket_id, 0);
+}
+
 static inline void
-send_burst(struct rte_port_ring_writer_ipv4_ras *p)
+send_burst(struct rte_port_ring_writer_ras *p)
 {
uint32_t nb_tx;

@@ -132,8 +159,8 @@ send_burst(struct rte_port_ring_writer_ipv4_ras *p)
p->tx_buf_count = 0;
 }

-static inline void
-process_one(struct rte_port_ring_writer_ipv4_ras *p, struct rte_mbuf *pkt)
+static void
+process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt)
 {
/* Assume there is no ethernet header */
struct ipv4_hdr *pkt_hdr = (struct ipv4_hdr *)
@@ -153,7 +180,38 @@ process_one(struct rte_port_ring_writer_ipv4_ras *p, 
struct rte_mbuf *pkt)
struct rte_ip_frag_death_row *dr = >death_row;

/* Process this fragment */
-   mo = rte_ipv4_frag_reassemble_packet(tbl, dr, pkt, rte_rdtsc(), 
pkt_hdr);
+   mo = rte_ipv4_frag_reassemble_packet(tbl, dr, pkt, rte_rdtsc(),
+   pkt_hdr);
+   if (mo != NULL)
+   p->tx_buf[p->tx_buf_count++] = mo;
+
+   rte_ip_frag_free_death_row(>death_row, 3);
+   }
+}
+
+static void
+process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt)
+{
+   /* Assume there is no ethernet header */
+   struct ipv6_hdr *pkt_hdr = (struct ipv6_hdr *)
+   (rte_pktmbuf_mtod(pkt, unsigned char *));
+
+   struct ipv6_extension_fragment *frag_hdr;
+   frag_hdr = 

[dpdk-dev] [PATCH v2 2/3] port: added ipv6 fragmentation port

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added new port type - IPv6 Fragmentation port

Signed-off-by: Maciej Gajdzica 
---
 lib/librte_port/rte_port_frag.c |   61 +--
 lib/librte_port/rte_port_frag.h |9 +-
 2 files changed, 54 insertions(+), 16 deletions(-)

diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c
index dce33d5..c4c05dc 100644
--- a/lib/librte_port/rte_port_frag.c
+++ b/lib/librte_port/rte_port_frag.c
@@ -39,9 +39,17 @@
 #include "rte_port_frag.h"

 /* Max number of fragments per packet allowed */
-#defineIPV4_MAX_FRAGS_PER_PACKET 0x80
+#defineRTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80

-struct rte_port_ring_reader_ipv4_frag {
+typedef int32_t
+   (*frag_op)(struct rte_mbuf *pkt_in,
+   struct rte_mbuf **pkts_out,
+   uint16_t nb_pkts_out,
+   uint16_t mtu_size,
+   struct rte_mempool *pool_direct,
+   struct rte_mempool *pool_indirect);
+
+struct rte_port_ring_reader_frag {
/* Input parameters */
struct rte_ring *ring;
uint32_t mtu;
@@ -51,19 +59,21 @@ struct rte_port_ring_reader_ipv4_frag {

/* Internal buffers */
struct rte_mbuf *pkts[RTE_PORT_IN_BURST_SIZE_MAX];
-   struct rte_mbuf *frags[IPV4_MAX_FRAGS_PER_PACKET];
+   struct rte_mbuf *frags[RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET];
uint32_t n_pkts;
uint32_t pos_pkts;
uint32_t n_frags;
uint32_t pos_frags;
+
+   frag_op f_frag;
 } __rte_cache_aligned;

 static void *
-rte_port_ring_reader_ipv4_frag_create(void *params, int socket_id)
+rte_port_ring_reader_frag_create(void *params, int socket_id, int is_ipv4)
 {
-   struct rte_port_ring_reader_ipv4_frag_params *conf =
-   (struct rte_port_ring_reader_ipv4_frag_params *) params;
-   struct rte_port_ring_reader_ipv4_frag *port;
+   struct rte_port_ring_reader_frag_params *conf =
+   (struct rte_port_ring_reader_frag_params *) params;
+   struct rte_port_ring_reader_frag *port;

/* Check input parameters */
if (conf == NULL) {
@@ -109,16 +119,31 @@ rte_port_ring_reader_ipv4_frag_create(void *params, int 
socket_id)
port->n_frags = 0;
port->pos_frags = 0;

+   port->f_frag = (is_ipv4) ?
+   rte_ipv4_fragment_packet : rte_ipv6_fragment_packet;
+
return port;
 }

+static void *
+rte_port_ring_reader_ipv4_frag_create(void *params, int socket_id)
+{
+   return rte_port_ring_reader_frag_create(params, socket_id, 1);
+}
+
+static void *
+rte_port_ring_reader_ipv6_frag_create(void *params, int socket_id)
+{
+   return rte_port_ring_reader_frag_create(params, socket_id, 0);
+}
+
 static int
-rte_port_ring_reader_ipv4_frag_rx(void *port,
+rte_port_ring_reader_frag_rx(void *port,
struct rte_mbuf **pkts,
uint32_t n_pkts)
 {
-   struct rte_port_ring_reader_ipv4_frag *p =
-   (struct rte_port_ring_reader_ipv4_frag *) port;
+   struct rte_port_ring_reader_frag *p =
+   (struct rte_port_ring_reader_frag *) port;
uint32_t n_pkts_out;

n_pkts_out = 0;
@@ -167,10 +192,10 @@ rte_port_ring_reader_ipv4_frag_rx(void *port,
}

/* Fragment current packet into the "frags" buffer */
-   status = rte_ipv4_fragment_packet(
+   status = p->f_frag(
pkt,
p->frags,
-   IPV4_MAX_FRAGS_PER_PACKET,
+   RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET,
p->mtu,
p->pool_direct,
p->pool_indirect
@@ -215,7 +240,7 @@ rte_port_ring_reader_ipv4_frag_rx(void *port,
 }

 static int
-rte_port_ring_reader_ipv4_frag_free(void *port)
+rte_port_ring_reader_frag_free(void *port)
 {
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Parameter port is NULL\n", __func__);
@@ -232,6 +257,12 @@ rte_port_ring_reader_ipv4_frag_free(void *port)
  */
 struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops = {
.f_create = rte_port_ring_reader_ipv4_frag_create,
-   .f_free = rte_port_ring_reader_ipv4_frag_free,
-   .f_rx = rte_port_ring_reader_ipv4_frag_rx,
+   .f_free = rte_port_ring_reader_frag_free,
+   .f_rx = rte_port_ring_reader_frag_rx,
+};
+
+struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops = {
+   .f_create = rte_port_ring_reader_ipv6_frag_create,
+   .f_free = rte_port_ring_reader_frag_free,
+   .f_rx = rte_port_ring_reader_frag_rx,
 };
diff --git a/lib/librte_port/rte_port_frag.h b/lib/librte_port/rte_port_frag.h
index dfd70c0..0085ff7 100644
--- a/lib/librte_port/rte_port_frag.h
+++ b/lib/librte_port/rte_port_frag.h
@@ -63,7 +63,7 @@ extern "C" {
 #include "rte_port.h"

 /** 

[dpdk-dev] [PATCH v2 1/3] port: removed IPV4_MTU_DEFAULT define

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

p->mtu field should be used instead.

Signed-off-by: Maciej Gajdzica 
---
 lib/librte_port/rte_port_frag.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c
index ff0ab9b..dce33d5 100644
--- a/lib/librte_port/rte_port_frag.c
+++ b/lib/librte_port/rte_port_frag.c
@@ -38,10 +38,6 @@

 #include "rte_port_frag.h"

-/* Default byte size for the IPv4 Maximum Transfer Unit (MTU).
- * This value includes the size of IPv4 header. */
-#defineIPV4_MTU_DEFAULT ETHER_MTU
-
 /* Max number of fragments per packet allowed */
 #defineIPV4_MAX_FRAGS_PER_PACKET 0x80

@@ -160,7 +156,7 @@ rte_port_ring_reader_ipv4_frag_rx(void *port,
p->n_pkts--;

/* If not jumbo, pass current packet to output */
-   if (pkt->pkt_len <= IPV4_MTU_DEFAULT) {
+   if (pkt->pkt_len <= p->mtu) {
pkts[n_pkts_out++] = pkt;

n_pkts_to_provide = n_pkts - n_pkts_out;
-- 
1.7.9.5



[dpdk-dev] [PATCH v2 0/3] port: added frag_ipv6 and ras_ipv6 ports

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

Added ipv6 versions of ip fragmentation and ip reassembly ports.

Maciej Gajdzica (3):
  port: removed IPV4_MTU_DEFAULT define
  port: added ipv6 fragmentation port
  port: added ipv6 reassembly port

 lib/librte_port/rte_port_frag.c |   67 --
 lib/librte_port/rte_port_frag.h |9 ++-
 lib/librte_port/rte_port_ras.c  |  142 ---
 lib/librte_port/rte_port_ras.h  |9 ++-
 4 files changed, 167 insertions(+), 60 deletions(-)

-- 
1.7.9.5



[dpdk-dev] [PATCH v2 3/3] port: added ring_writer_nodrop port

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

When ethdev_writer_nodrop port fails to send data, it tries to resend.
Operation
is aborted when maximum number of retries is reached.

Signed-off-by: Maciej Gajdzica 
---
 lib/librte_port/rte_port_ring.c |  226 +++
 lib/librte_port/rte_port_ring.h |   16 +++
 2 files changed, 242 insertions(+)

diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c
index ba2eeb3..371bb1e 100644
--- a/lib/librte_port/rte_port_ring.c
+++ b/lib/librte_port/rte_port_ring.c
@@ -31,6 +31,7 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
+#include 

 #include 
 #include 
@@ -279,6 +280,223 @@ rte_port_ring_writer_free(void *port)
 }

 /*
+ * Port RING Writer Nodrop
+ */
+#define RTE_PORT_RING_WRITER_NODROP_APPROACH  1
+
+struct rte_port_ring_writer_nodrop {
+   struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX];
+   struct rte_ring *ring;
+   uint32_t tx_burst_sz;
+   uint32_t tx_buf_count;
+   uint64_t bsz_mask;
+   uint64_t n_retries;
+};
+
+static void *
+rte_port_ring_writer_nodrop_create(void *params, int socket_id)
+{
+   struct rte_port_ring_writer_nodrop_params *conf =
+   (struct rte_port_ring_writer_nodrop_params *) params;
+   struct rte_port_ring_writer_nodrop *port;
+
+   /* Check input parameters */
+   if ((conf == NULL) ||
+   (conf->ring == NULL) ||
+   (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX)) {
+   RTE_LOG(ERR, PORT, "%s: Invalid Parameters\n", __func__);
+   return NULL;
+   }
+
+   /* Memory allocation */
+   port = rte_zmalloc_socket("PORT", sizeof(*port),
+   RTE_CACHE_LINE_SIZE, socket_id);
+   if (port == NULL) {
+   RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
+   return NULL;
+   }
+
+   /* Initialization */
+   port->ring = conf->ring;
+   port->tx_burst_sz = conf->tx_burst_sz;
+   port->tx_buf_count = 0;
+   port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1);
+
+   /*
+* When n_retries is 0 it means that we should wait for every packet to
+* send no matter how many retries should it take. To limit number of
+* branches in fast path, we use UINT64_MAX instead of branching.
+*/
+   port->n_retries = (conf->n_retries == 0) ? UINT64_MAX : conf->n_retries;
+
+   return port;
+}
+
+static inline void
+send_burst_nodrop(struct rte_port_ring_writer_nodrop *p)
+{
+   uint32_t nb_tx = 0, i;
+
+   nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf,
+   p->tx_buf_count);
+
+   /* We sent all the packets in a first try */
+   if (nb_tx >= p->tx_buf_count)
+   return;
+
+   for (i = 0; i < p->n_retries; i++) {
+   nb_tx += rte_ring_sp_enqueue_burst(p->ring,
+   (void **) (p->tx_buf + nb_tx), p->tx_buf_count 
- nb_tx);
+
+   /* We sent all the packets in more than one try */
+   if (nb_tx >= p->tx_buf_count)
+   return;
+   }
+
+   /* We didn't send the packets in maximum allowed attempts */
+   for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+   rte_pktmbuf_free(p->tx_buf[nb_tx]);
+
+   p->tx_buf_count = 0;
+}
+
+static int
+rte_port_ring_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
+{
+   struct rte_port_ring_writer_nodrop *p =
+   (struct rte_port_ring_writer_nodrop *) port;
+
+   p->tx_buf[p->tx_buf_count++] = pkt;
+   if (p->tx_buf_count >= p->tx_burst_sz)
+   send_burst_nodrop(p);
+
+   return 0;
+}
+
+#if RTE_PORT_RING_WRITER_NODROP_APPROACH == 0
+
+static int
+rte_port_ring_writer_nodrop_tx_bulk(void *port,
+   struct rte_mbuf **pkts,
+   uint64_t pkts_mask)
+{
+   struct rte_port_ring_writer_nodrop *p =
+   (struct rte_port_ring_writer_nodrop *) port;
+
+   if ((pkts_mask & (pkts_mask + 1)) == 0) {
+   uint64_t n_pkts = __builtin_popcountll(pkts_mask);
+   uint32_t i;
+
+   for (i = 0; i < n_pkts; i++) {
+   struct rte_mbuf *pkt = pkts[i];
+
+   p->tx_buf[p->tx_buf_count++] = pkt;
+   if (p->tx_buf_count >= p->tx_burst_sz)
+   send_burst_nodrop(p);
+   }
+   } else {
+   for ( ; pkts_mask; ) {
+   uint32_t pkt_index = __builtin_ctzll(pkts_mask);
+   uint64_t pkt_mask = 1LLU << pkt_index;
+   struct rte_mbuf *pkt = pkts[pkt_index];
+
+   p->tx_buf[p->tx_buf_count++] = pkt;
+   if (p->tx_buf_count >= p->tx_burst_sz)
+   

[dpdk-dev] [PATCH v2 0/3] port: added ethdev_writer_nodrop and ring_writer_nodrop ports

2015-04-30 Thread Michal Jastrzebski
From: Maciej Gajdzica 

When nodrop writer port fails to send data, it retries until reach maximum
number of retries. Also added new tx_bulk implementation for ring writer port.

Maciej Gajdzica (3):
  port: added WRITER_APPROACH == 1 implementation to ring port
  port: added ethdev_writer_nodrop port
  port: added ring_writer_nodrop port

 lib/librte_port/rte_port_ethdev.c |  230 ++
 lib/librte_port/rte_port_ethdev.h |   19 +++
 lib/librte_port/rte_port_ring.c   |  285 +
 lib/librte_port/rte_port_ring.h   |   16 +++
 4 files changed, 550 insertions(+)

-- 
1.7.9.5



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

2015-04-30 Thread Mcnamara, John


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Wednesday, April 29, 2015 5:13 PM
> To: Mcnamara, John
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 0/2] doc: refactored fig and table nums
> into references
> 
> 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.

Hi Thomas,

Yes. That is probably right.


> 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?

It would be possible but a full implementation probably wouldn't be worth it. 
We could add a workaround like the following to conf.py that would just render 
the figure/table ref numbers as the target name as a fallback. That would allow 
people to generate the docs with older versions of sphinx:

$ git diff doc/guides/conf.py
diff --git a/doc/guides/conf.py b/doc/guides/conf.py
index 1bc031f..bbf40f1 100644
--- a/doc/guides/conf.py
+++ b/doc/guides/conf.py
@@ -82,3 +82,16 @@ class CustomLatexFormatter(LatexFormatter):

 # Replace the default latex formatter.
 PygmentsBridge.latex_formatter = CustomLatexFormatter
+
+from docutils import nodes
+from distutils.version import LooseVersion
+from sphinx import __version__ as sphinx_version
+
+# Workaround to ignore :numref: in older versions of Sphinx.
+def setup(app):
+
+if LooseVersion(sphinx_version) < LooseVersion('1.3.1'):
+print('[dpdk docs] Upgrade sphinx to version >= 1.3.1 for '
+  'improved Figure/Table number handling.')
+app.add_generic_role('numref', nodes.emphasis)
+


That is just a workaround though, and maybe not worth it either.

P.S. Also note, Sphinx 1.3.1 has a nice but very different default Html style. 

John












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

2015-04-30 Thread Wiles, Keith


On 4/30/15, 4:45 AM, "Olivier MATZ"  wrote:

>Hi Keith,
>
>Thank you for submitting a clean-up. Please see some comments below.
>
>On 04/29/2015 05:25 PM, 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.
>
>If I understand well, the goal of this patch is only a cleanup in
>rte.app.mk, but at the end, it changes the makefile user "API",
>which could probably be a problem for applications using the
>dpdk makefile framework.
>
>Why not just having an temporary internal variable (let's say
>_LDLIBS-y) that would allow to do the clean-up without modifying
>the user interface?
>
>Also, with your patch, the approach for EXTRA_LDLIBS would be
>different than CFLAGS or LDFLAGS:
>- CFLAGS/LDFLAGS are in Makefiles only
>- EXTRA_CFLAGS/EXTRA_LDFLAGS are prefered in command line
>   to add flags to the default ones
>
>I'm not opposed to add EXTRA_LDLIBS in addition to LDLIBS,
>keeping a compatibility with existing application Makefiles.

The docs for DPDK 28.3.6 states they can be used for both command line and
Makefile, so I think I like the current solution unless everyone wants it
as you suggested.

http://dpdk.readthedocs.org/en/v2.0.0/prog_guide/dev_kit_build_system.html


>
>What do you think?
>
>Regards,
>Olivier
>
>
>
>>
>> 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
>> 

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

2015-04-30 Thread Neil Horman
On Wed, Apr 29, 2015 at 10:47:04AM -0700, Ravi Kerur wrote:
> > > 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
Ah, bsd mktemp doesn't support the -p option.  I'll see if I can fix that.

> 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
> 

Whats the path for abi-compliance checker there?  It would seem that the binary
isn't in your path, as which isn't locating it.
Neil

> 
> >
> > Neil
> >
> >


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

2015-04-30 Thread Olivier MATZ
Hi Keith,

Thank you for submitting a clean-up. Please see some comments below.

On 04/29/2015 05:25 PM, 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.

If I understand well, the goal of this patch is only a cleanup in
rte.app.mk, but at the end, it changes the makefile user "API",
which could probably be a problem for applications using the
dpdk makefile framework.

Why not just having an temporary internal variable (let's say
_LDLIBS-y) that would allow to do the clean-up without modifying
the user interface?

Also, with your patch, the approach for EXTRA_LDLIBS would be
different than CFLAGS or LDFLAGS:
- CFLAGS/LDFLAGS are in Makefiles only
- EXTRA_CFLAGS/EXTRA_LDFLAGS are prefered in command line
   to add flags to the default ones

I'm not opposed to add EXTRA_LDLIBS in addition to LDLIBS,
keeping a compatibility with existing application Makefiles.

What do you think?

Regards,
Olivier



>
> 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 += 

[dpdk-dev] [PATCHv2] app/ and examples/ fix default mbuf size

2015-04-30 Thread Olivier MATZ
Hi Konstantin,

On 04/30/2015 01:31 AM, Konstantin Ananyev wrote:
> v2 changes:
> - add a new macro into rte_mbuf.h
> - make samples to use that new macro
>
>
> Fixes: dfb03bbe2b ("app/testpmd: use standard functions to initialize
> mbufs and mbuf pool").
> Latest mbuf changes (priv_size addition and related fixes)
> exposed small problem with testpmd and few other sample apps:
> when mbuf size is exaclty 2KB or less, that causes
> ixgbe PMD to select scattered RX even for configs with 'normal'
> max packet length (max_rx_pkt_len == ETHER_MAX_LEN).
> To overcome that problem and unify the code, new macro was created
> to represent recommended minimal buffer length for mbuf.
> When appropriate, samples are updated to use that macro.
>
> Signed-off-by: Konstantin Ananyev 

Acked-by: Olivier Matz 

Thanks



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

2015-04-30 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 v5 1/2] Simplify the ifdefs in rte.app.mk.

2015-04-30 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. The new internal variable _LDLIBS
should not be used outside of the rte.app.mk file. The makefiles
can still use LDLIBS, but I would suggest using EXTRA_LDLIBS instead.

Signed-off-by: Keith Wiles 
---
 examples/dpdk_qat/Makefile |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk  | 242 +
 3 files changed, 63 insertions(+), 185 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..b8030d2 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) 2014-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 # ! 

[dpdk-dev] [PATCH 0/3] port: added ethdev_writer_nodrop and ring_writer_nodrop ports

2015-04-30 Thread Gajdzica, MaciejX T
Forgot v2 prefix, will resend

> -Original Message-
> From: Maciej Gajdzica [mailto:mtgajdzx at stargo]
> Sent: Thursday, April 30, 2015 11:23 AM
> To: dev at dpdk.org
> Cc: Gajdzica, MaciejX T
> Subject: [PATCH 0/3] port: added ethdev_writer_nodrop and ring_writer_nodrop
> ports
> 
> When nodrop writer port fails to send data, it retries until reach maximum
> number of retries. Also added new tx_bulk implementation for ring writer port.
> 
> Maciej Gajdzica (3):
>   port: added WRITER_APPROACH == 1 implementation to ring port
>   port: added ethdev_writer_nodrop port
>   port: added ring_writer_nodrop port
> 
>  lib/librte_port/rte_port_ethdev.c |  230 ++
>  lib/librte_port/rte_port_ethdev.h |   19 +++
>  lib/librte_port/rte_port_ring.c   |  285
> +
>  lib/librte_port/rte_port_ring.h   |   16 +++
>  4 files changed, 550 insertions(+)
> 
> --
> 1.7.9.5



[dpdk-dev] [PATCH v2 02/10] table: added acl table stats

2015-04-30 Thread Stephen Hemminger
On Thu, 30 Apr 2015 14:14:30 +0200
Michal Jastrzebski  wrote:

> From: Maciej Gajdzica 
> 
> Added statistics for ACL table.
> 
> Signed-off-by: Maciej Gajdzica 
> ---
>  config/common_bsdapp |1 +
>  config/common_linuxapp   |1 +
>  lib/librte_table/rte_table_acl.c |   35 +++
>  3 files changed, 37 insertions(+)
> 
> diff --git a/config/common_bsdapp b/config/common_bsdapp
> index 238d178..096e09c 100644
> --- a/config/common_bsdapp
> +++ b/config/common_bsdapp
> @@ -400,6 +400,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
>  # Compile librte_table
>  #
>  CONFIG_RTE_LIBRTE_TABLE=y
> +CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n

Sigh. More config options does not make DPDK better.
It makes more unsupportable for distros


[dpdk-dev] [PATCHv2] app/ and examples/ fix default mbuf size

2015-04-30 Thread Konstantin Ananyev
v2 changes:
- add a new macro into rte_mbuf.h
- make samples to use that new macro


Fixes: dfb03bbe2b ("app/testpmd: use standard functions to initialize
mbufs and mbuf pool").
Latest mbuf changes (priv_size addition and related fixes)
exposed small problem with testpmd and few other sample apps:
when mbuf size is exaclty 2KB or less, that causes
ixgbe PMD to select scattered RX even for configs with 'normal'
max packet length (max_rx_pkt_len == ETHER_MAX_LEN).
To overcome that problem and unify the code, new macro was created
to represent recommended minimal buffer length for mbuf.
When appropriate, samples are updated to use that macro.

Signed-off-by: Konstantin Ananyev 
---
 app/test-pmd/testpmd.h   |  3 ++-
 app/test/test_distributor.c  |  4 +---
 app/test/test_distributor_perf.c |  4 +---
 app/test/test_link_bonding.c |  6 ++
 app/test/test_link_bonding_mode4.c   |  6 ++
 app/test/test_pmd_perf.c |  5 ++---
 app/test/test_pmd_ring.c |  3 +--
 app/test/test_reorder.c  |  4 ++--
 app/test/test_table.h|  2 +-
 examples/bond/main.c |  3 +--
 examples/distributor/main.c  |  5 ++---
 examples/dpdk_qat/main.c |  3 +--
 examples/ip_fragmentation/main.c |  4 +---
 examples/ip_pipeline/init.c  |  2 +-
 examples/ip_reassembly/main.c|  2 +-
 examples/ipv4_multicast/main.c   |  2 +-
 examples/l2fwd-ivshmem/host/host.c   |  3 +--
 examples/l2fwd-jobstats/main.c   |  3 +--
 examples/l2fwd/main.c|  3 +--
 examples/l3fwd-acl/main.c|  5 ++---
 examples/l3fwd-power/main.c  |  5 ++---
 examples/l3fwd-vf/main.c |  6 ++
 examples/l3fwd/main.c|  6 ++
 examples/link_status_interrupt/main.c|  3 +--
 examples/load_balancer/main.h|  2 +-
 examples/multi_process/client_server_mp/mp_server/init.c |  3 +--
 examples/multi_process/l2fwd_fork/main.c |  3 ++-
 examples/multi_process/symmetric_mp/main.c   |  3 +--
 examples/netmap_compat/bridge/bridge.c   |  2 +-
 examples/packet_ordering/main.c  |  3 +--
 examples/qos_meter/main.c|  3 +--
 examples/qos_sched/init.c|  3 ++-
 examples/qos_sched/main.h|  1 -
 examples/quota_watermark/include/conf.h  |  2 +-
 examples/rxtx_callbacks/main.c   |  5 ++---
 examples/skeleton/basicfwd.c |  3 +--
 examples/vhost/main.c|  8 
 examples/vhost_xen/main.c|  3 +--
 examples/vmdq/main.c |  3 +--
 examples/vmdq_dcb/main.c |  3 +--
 lib/librte_mbuf/rte_mbuf.h   | 10 ++
 41 files changed, 65 insertions(+), 87 deletions(-)

diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 389fc24..c3b6700 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 RTE_MBUF_DEFAULT_BUF_SIZE
+/**< Default size of mbuf data buffer. */

 /*
  * The maximum number of segments per packet is used when creating
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index ad46987..b334392 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -500,8 +500,6 @@ quit_workers(struct rte_distributor *d, struct rte_mempool 
*p)
worker_idx = 0;
 }

-#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
-
 static int
 test_distributor(void)
 {
@@ -529,7 +527,7 @@ test_distributor(void)
(BIG_BATCH * 2) - 1 : (511 * rte_lcore_count());
if (p == NULL) {
p = rte_pktmbuf_pool_create("DT_MBUF_POOL", nb_bufs, BURST,
-   0, MBUF_DATA_SIZE, rte_socket_id());
+   0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (p == NULL) {
printf("Error creating mempool\n");
return -1;
diff --git a/app/test/test_distributor_perf.c