[dpdk-dev] [RFC PATCH DRAFT 1/2] ethdev: add buffered single pkt TX function to API

2014-06-25 Thread Richardson, Bruce
> -Original Message-
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Tuesday, June 24, 2014 4:07 PM
> To: Richardson, Bruce
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH DRAFT 1/2] ethdev: add buffered single pkt
> TX function to API
> 
> On Tue, 24 Jun 2014 23:32:15 +0100
> Bruce Richardson  wrote:
> 
> > Many sample apps include internal buffering for single-packet-at-a-time
> > operation. Since this is such a common paradigm, this functionality is
> > better suited to being inside the core ethdev API.
> > The new APIs include three functions:
> > * rte_eth_tx_buffer - buffer up a single packet for future transmission
> > * rte_eth_tx_buffer_flush - flush any unsent buffered packets
> > * rte_eth_tx_buffer_set_err_callback - set up a callback to be called in
> >   case transmitting a buffered burst fails. By default, we just free the
> >   unsent packets
> 
> This must be per-queue to be MP safe.
> 
> Internally, we do something similar but it proved to be fastest to
> user per-cpu data in some cases.

The implementation is per-queue. If you look at the changes to the tx queue 
setup function, we set up a buffer space for each TX queue inside the 
eth_dev_data structure that is then used for buffering that queue. The fact 
that it's handled per-queue inside the eth_dev means that it's as thread-safe 
as the existing tx_burst function, and also is completely driver agnostic.



[dpdk-dev] [RFC PATCH DRAFT 1/2] ethdev: add buffered single pkt TX function to API

2014-06-25 Thread Richardson, Bruce
> -Original Message-
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Tuesday, June 24, 2014 4:06 PM
> To: Richardson, Bruce
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH DRAFT 1/2] ethdev: add buffered single pkt
> TX function to API
> 
> On Tue, 24 Jun 2014 23:32:15 +0100
> Bruce Richardson  wrote:
> 
> >
> > +static void
> > +free_unsent_pkts(struct rte_mbuf **pkts, uint16_t unsent,
> > +   void *userdata __rte_unused)
> > +{
> > +   unsigned i;
> > +   for (i = 0; i < unsent; i++)
> > +   rte_pktmbuf_free(pkts[i]);
> > +}
> > +
> 
> This should be moved into mbuf layer, and there it could be
> optimized to do a rte_mempool_mp_put_bulk. This would speed
> up operations becuase it would mean a single ring operation
> per set rather per mbuf segment.
> 
> Of course, the optimization would have to handle the refcnt
> issues.

I'm not sure how we can improve this by bringing it into the mbuf layer. As 
well as handling of refcounts, we also have no guarantee than each mbuf queued 
up for a particular port comes from the same mempool.
Can you please clarify how you think this might be better done?


[dpdk-dev] [PATCH] i40e: fix shared code compile warning

2014-06-25 Thread Chen, Jing D
Hi Thomas,

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Tuesday, June 24, 2014 6:06 PM
> To: Chen, Jing D
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] i40e: fix shared code compile warning
> 
> 2014-06-24 09:47, Chen, Jing D:
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > > 2014-06-24 13:22, Chen Jing D:
> > > > +CFLAGS_i40e_lan_hmc.o += -Wno-error
> > >
> > > I know we shouldn't modify base drivers. But this one seems to be an
> > > important error. In such case, we already modified base driver. Recently:
> > > http://dpdk.org/ml/archives/dev/2014-June/003498.html
> >
> > I think it's different. The logic is right after adding the patch.
> > Below is my finding.
> 
> > In this case, it met the error when compile on 32-bits OS. The message is :
> >
> >
> /jenkins/workspace/DPDK_AUTO_IDT_VM_RHEL65_32_BUILD/DPDK/lib/libr
> te_pm
> > d_i40e
> > /i40e/i40e_lan_hmc.c: In function ?i40e_write_qword?:
> >
> /jenkins/workspace/DPDK_AUTO_IDT_VM_RHEL65_32_BUILD/DPDK/lib/libr
> te_pm
> > d_i40
> > e/i40e/i40e_lan_hmc.c:917: error: integer constant is too large for ?long?
> > type
> >
> /jenkins/workspace/DPDK_AUTO_IDT_VM_RHEL65_32_BUILD/DPDK/lib/libr
> te_pm
> > d_i40
> > e/i40e/i40e_lan_hmc.c: In function ?i40e_read_qword?:
> >
> /jenkins/workspace/DPDK_AUTO_IDT_VM_RHEL65_32_BUILD/DPDK/lib/libr
> te_pm
> > d_i40
> > e/i40e/i40e_lan_hmc.c:1097: error: integer constant is too large for ?long?
> > type
> > I found the code that cause errors. 'mask' is 'uint64_t' type and is
> > assigned to value 0X___. Compiler assumes the constant
> > is 'int' type by default. If changed it to ox___ULL,
> > the warning will be gone.
> 
> > if (ce_info->width < 64)
> > mask = ((u64)1 << ce_info->width) - 1;
> > else
> > mask = 0x;
> >
> > besides that, I dis-assembler the code with the patch and get below
> segment.
> > It seems right.
> 
> > if (ce_info->width < 64)
> > 1946:   8b 45 0cmov0xc(%ebp),%eax
> > 1949:   0f b7 40 04 movzwl 0x4(%eax),%eax
> > 194d:   66 83 f8 3f cmp$0x3f,%ax
> > 1951:   77 30   ja 1983 
> > mask = ((u64)1 << ce_info->width) - 1;
> > 1953:   8b 45 0cmov0xc(%ebp),%eax
> > 1956:   0f b7 40 04 movzwl 0x4(%eax),%eax
> > 195a:   0f b7 c8movzwl %ax,%ecx
> > 195d:   b8 01 00 00 00  mov$0x1,%eax
> > 1962:   ba 00 00 00 00  mov$0x0,%edx
> > 1967:   0f a5 c2shld   %cl,%eax,%edx
> > 196a:   d3 e0   shl%cl,%eax
> > 196c:   f6 c1 20test   $0x20,%cl
> > 196f:   74 04   je 1975 
> > 1971:   89 c2   mov%eax,%edx
> > 1973:   31 c0   xor%eax,%eax
> > 1975:   83 c0 ffadd$0x,%eax
> > 1978:   83 d2 ffadc$0x,%edx
> > 197b:   89 45 e0mov%eax,-0x20(%ebp)
> > 197e:   89 55 e4mov%edx,-0x1c(%ebp)
> > 1981:   eb 0e   jmp1991 
> > else
> > mask = 0x;
> > 1983:   c7 45 e0 ff ff ff ffmovl   $0x,-0x20(%ebp)
> > 198a:   c7 45 e4 ff ff ff ffmovl   $0x,-0x1c(%ebp)
> 
> Maybe I don't understand. You are saying you can fix the compiler warning
> by adding ULL to the constant. This is a simple patch and is a lot nicer than
>   CFLAGS_i40e_lan_hmc.o += -Wno-error
> Even if the asm code seems right, it would be more secure to remove this
> warning.
> 
> PS: please try to configure your mailer to add citation marks.
> 
> --
> Thomas
[Chen, Jing D] 

Generally speaking, I can fix the compile error by 2 ways.
1. change shared code with "ULL" suffix, which means that we had to maintain 
it. In any time shared code updates, 
we needs to find out what change we've made in history and compare with new 
shared code.  
I don?t know who should be responsible for that and how we record the 
changes. If you have good idea,
please share with me. 
2. my committed patch to ignore the warning on that file and continue the 
compile .  By doing so, the logic is right and 
   didn't change code's behavior.  We also needn't maintain it.  Even in bad 
case we find bugs hidden behind the 
'--CFLAGS_i40e_lan_hmc.0' warning in future, we can fix it after bug 
occurred. That's simple. 


[dpdk-dev] [PATCH] mempool: don't leak ring on failure

2014-06-25 Thread Olivier MATZ
Hello Stephen,

On 06/24/2014 05:49 PM, Stephen Hemminger wrote:
> If mempool can not be created because of insufficient memory
> it returns an error but has already created a ring (and leaves it
> behind). This prevents code from trying one mempool size and then
> retrying with a smaller size if the bigger size fails.
>
> Reordering to do ring creation after getting memory fixes
> the problem.

Your patch moves the creation of the ring after the call to
rte_memzone_reserve(), so now it tries to create the memory
for the object pool before the ring. The problem disappears
because the object pool is usually much bigger than the ring,
so once the first allocation is done, the second is unlikely
to fail.

I think this explanation could be added in the commit log.

Acked-by: Olivier Matz 



[dpdk-dev] [PATCH 1/3] stringfns: remove rte_snprintf

2014-06-25 Thread Olivier MATZ
Hi Bruce,

On 06/24/2014 08:00 PM, Richardson, Bruce wrote:
>> I want to get it out now rather than some 2 year life cycle.
>> The issue was discussed and marking it as deprecated breaks the build.
>> Alternate is removing all instances and adding:
>>
>> #define rte_snprintf snprintf
>>
>> in header file for user compatiablity.
>
> We can remove it from all our apps and then mark as deprecated and all our 
> code would still build.
> An interesting point I'd never thought of is, is it right for us to force 
> user apps to treat all warnings as errors? Perhaps we should also consider 
> removing -Werror from the CFLAGS when using rte.extapp.mk.

I don't understand why removing a function like rte_snprintf()
in a new version of DPDK would be a problem. Yes, it would break
the build of external applications, but that's the best way to fix
the problem in the external code. Adding a compatibility layer
just delays the issue. Maybe having a line about this in a "release
note" or a "porting guide" would be enough? It could even references
the commit id, showing how to solve the issue.

About the -Werror flag, I would say that removing it is not a good
idea. From my experience, many issues are pointed out by warnings,
and forcing the compiler to stop on warning helps to have better
code quality.

Regards,
Olivier



[dpdk-dev] [PATCH] mempool: don't leak ring on failure

2014-06-25 Thread Olivier MATZ
On 06/25/2014 09:46 AM, Olivier MATZ wrote:
> Your patch moves the creation of the ring after the call to
> rte_memzone_reserve(), so now it tries to create the memory
> for the object pool before the ring. The problem disappears
> because the object pool is usually much bigger than the ring,
> so once the first allocation is done, the second is unlikely
> to fail.
>
> I think this explanation could be added in the commit log.
>
> Acked-by: Olivier Matz 

Sorry, I didn't see that Konstantin and Bruce already answered to
this.




[dpdk-dev] [PATCH 1/3] stringfns: remove rte_snprintf

2014-06-25 Thread Thomas Monjalon
2014-06-24 17:39, Richardson, Bruce:
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen Hemminger
> > The function rte_snprintf serves no useful purpose. It is the
> > same as snprintf() for all valid inputs. Just remove it and
> > replace all uses in current code.
> 
> NAK to this as is.
> Approve of replacing all instance of the rte_snprintf function with the
> standard version in all our code and libraries. However, rather than just
> removing the function completely, I think we should just flag the function
> as deprecated initially, and then later on look to remove it completely.

I agree we should try to use the "deprecated" attribute when possible.
So application porting effort will be smoother.

But in this case, there is something different: as Stephen wrote, rte_snprintf 
is useless. It's useless inside the DPDK so it's even more useless for user 
applications.
As it's really useless, it has no sense to keep it as deprecated.
Please, let's simply remove it.

-- 
Thomas


[dpdk-dev] [PATCH v2] rte_ethdev: add link support flag

2014-06-25 Thread Thomas Monjalon
Hi Stephen,

I had no answer to this comment.
Please check.

2014-06-20 15:06, Thomas Monjalon:
> 2014-06-19 15:12, Stephen Hemminger:
> > Only some devices support the link state interrupt configuration option.
> > Link state control does not work in virtual drivers
> > (virtio, vmxnet3, igbvf, and ixgbevf). Instead of having the application
> > try and guess whether it will work or not provide a driver flag that
> > can be checked instead.
> > 
> > Note: if device driver doesn't support link state control, what
> > would happen previously is that the code would never detect link
> > transitions. This prevents that.
> 
> [...]
> 
> > @@ -197,6 +197,8 @@ struct rte_pci_driver {
> > 
> >  #define RTE_PCI_DRV_MULTIPLE 0x0002
> >  /** Device needs to be unbound even if no module is provided */
> >  #define RTE_PCI_DRV_FORCE_UNBIND 0x0004
> > 
> > +/** Device driver supports link state interrupt */
> > +#define RTE_PCI_DRV_LSC0x0008
> 
> I feel RTE_PCI_DRV_INTR_LSC would be easier to understand.
> Do you agree?
> 
> Note that related event is RTE_ETH_EVENT_INTR_LSC
> and configuration is intr_conf.lsc.
> 
> Title should be "ethdev: add link state interrupt flag".

A v3 would be nice.

Thanks
-- 
Thomas


[dpdk-dev] [PATCH] rte_memory.h: include stdio.h for FILE

2014-06-25 Thread Thomas Monjalon
Hi Huawei,

2014-06-17 03:48, Xie, Huawei:
> At least rte_tailq.h, rte_mbuf.h should also include stdio.h.

It has been fixed in this commit:
http://dpdk.org/browse/dpdk/commit/?id=86d5de5c46fc0
But rte_memory.h was forgotten.
rte_mbuf.h has no problem because it includes rte_mempool.h which includes 
stdio.h.

-- 
Thomas


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Hiroshi Shimamoto
> Sent: Thursday, June 12, 2014 4:11 PM
> To: dev at dpdk.org
> Cc: Hayato Momma
> Subject: [dpdk-dev] [PATCH] rte_memory.h: include stdio.h for FILE
> 
> From: Hiroshi Shimamoto 
> 
> The below commit requires stdio FILE structure.
> 
> commit 591a9d7985c1230652d9f7ea1f9221e8c66ec188
> Author: Stephen Hemminger 
> Date:   Fri May 2 16:42:56 2014 -0700
> 
> add FILE argument to debug functions
> 
> Application which includes rte_memory.h without stdio.h will be hit
> compilation failure.
> 
> /path/to/include/rte_memory.h:146:30: error: unknown type name 'FILE'
>  void rte_dump_physmem_layout(FILE *f);
> 
> Signed-off-by: Hiroshi Shimamoto 
> Reviewed-by: Hayato Momma 
> ---
>  lib/librte_eal/common/include/rte_memory.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_eal/common/include/rte_memory.h
> b/lib/librte_eal/common/include/rte_memory.h index 7f21244..4cf8ea9 100644
> --- a/lib/librte_eal/common/include/rte_memory.h
> +++ b/lib/librte_eal/common/include/rte_memory.h
> @@ -42,6 +42,7 @@
> 
>  #include 
>  #include 
> +#include 
> 
>  #ifdef RTE_EXEC_ENV_LINUXAPP
>  #include 
> --
> 1.9.1



[dpdk-dev] multi segment TX/RX for vmxnet3

2014-06-25 Thread Thomas Monjalon
Hi,

2014-06-12 11:07, Hyunseok:
> Do you guys plan to include this feature in the upcoming DPDK release?

AFAIK, it's implemented in this PMD:
http://dpdk.org/browse/vmxnet3-usermap/tree/pmd
http://dpdk.org/doc/vmxnet3-usermap

There are currently many vmxnet3 PMD implementations flying around.
Feel free to test them and give feedbacks.

Thanks
-- 
Thomas


[dpdk-dev] [PATCH] kni: compatibility with RHEL 7

2014-06-25 Thread Thomas Monjalon
Hi Waterman,

2014-06-12 09:35, Hiroshi Shimamoto:
> 2014-06-12 09:18, Cao, Waterman:
> >   Can you give details about Linux Kernel version and complier version?
> >   Because we tried to build code in the Redhat 7.0 before, but we don't
> >   meet this issue. Please see information as the following:
> >   Linux kernel 3.10.0-54.0.1.el7.x86_64
> >   RHEL70BETA_64 GCC 4.8.2  ICC: 14.0.0
> 
> Yes,
> 
> Linux REHEL7RC-1 3.10.0-121.el7.x86_64 #1 SMP Tue Apr 8 10:48:19 EDT 2014
> x86_64 x86_64 x86_64 GNU/Linux gcc version 4.8.2 20140120 (Red Hat
> 4.8.2-16) (GCC)
> 
> I got the below error;
> /path/to/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3851:1: error:
> conflicting types for ?skb_set_hash? skb_set_hash(struct sk_buff *skb,
> __u32 hash, __always_unused int type)
> 
> /usr/src/kernels/3.10.0-121.el7.x86_64/include/linux/skbuff.h:762:1: note:
> previous definition of ?skb_set_hash? was here skb_set_hash(struct sk_buff
> *skb, __u32 hash, enum pkt_hash_types type)

Could you confirm this fix is needed and acknowledge it?
Thanks


> > -Original Message-
> > 
> > >From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Hiroshi Shimamoto
> > >Sent: Thursday, June 12, 2014 4:10 PM
> > >To: dev at dpdk.org
> > >Cc: Hayato Momma
> > >Subject: [dpdk-dev] [PATCH] kni: compatibility with RHEL 7
> > >
> > >From: Hiroshi Shimamoto 
> > >
> > >Compilation in RHEL7 is failed. This fixes the build issue.
> > >
> > >RHEL7 has skb_set_hash, the kernel version is 3.10 though.
> > >Don't define skb_set_hash for RHEL7.
> > >
> > >Signed-off-by: Hiroshi Shimamoto 
> > >Reviewed-by: Hayato Momma 
> > >---
> > >
> > > lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 5 +
> > > 1 file changed, 5 insertions(+)
> > >
> > >diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> > >b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h index
> > >4c27d5d..b4de6e2 100644
> > >--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> > >+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> > >@@ -3843,6 +3843,9 @@ static inline struct sk_buff
> > >*__kc__vlan_hwaccel_put_tag(struct sk_buff *skb,  #endif /* >= 3.10.0> 
> > */
> > 
> > > #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) )
> > >
> > >+
> > >+#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >=
> > >+RHEL_RELEASE_VERSION(7,0)))
> > >+
> > >
> > > #ifdef NETIF_F_RXHASH
> > > #define PKT_HASH_TYPE_L3 0
> > > static inline void
> > >
> > >@@ -3851,6 +3854,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash,
> > >__always_unused int type)> >
> > >   skb->rxhash = hash;
> > > 
> > > }
> > > #endif /* NETIF_F_RXHASH */
> > >
> > >+#endif /* < RHEL7 */
> > >+
> > >
> > > #endif /* < 3.14.0 */
> > > 
> > > #endif /* _KCOMPAT_H_ */
> > >
> > >--
> > >1.9.1


-- 
Thomas


[dpdk-dev] [PATCH] ethdev: read link state interrupt without link_update service

2014-06-25 Thread Olivier MATZ
On 06/20/2014 03:13 PM, Thomas Monjalon wrote:
> It is now possible to read link status updated by interrupt without
> having manual link_update() service provided by the PMD.
> Indeed link_update() is useless in interrupt case.
>
> Signed-off-by: Thomas Monjalon 

Acked-by: Olivier Matz 



[dpdk-dev] [PATCH 0/3] previous patches about "shared code"/"base drivers"

2014-06-25 Thread Thomas Monjalon
There were discussions about how to fix/workaround bugs in Intel code which
we don't want to modify. And it raised wording issue to clarify things.
I modify my patch and accept others. So I resend them in order to have a
final acknowledgement.

Please comment and/or acknowledge.
Thanks

Thomas Monjalon (1):
  i40e: explicit shared code naming as base driver
Chen Jing D(Mark) (1):
  i40e/base: ignore warning
Pablo de Lara (1):
  ixgbe: rework fix of media type for bypass device

 lib/librte_pmd_i40e/Makefile  | 34 +++
 lib/librte_pmd_i40e/i40e_ethdev.c | 12 +--
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c  |  3 ---
 lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c | 34 +++
 4 files changed, 44 insertions(+), 39 deletions(-)

-- 
2.0.0



[dpdk-dev] [PATCH 1/3] i40e: explicit shared code naming as base driver

2014-06-25 Thread Thomas Monjalon
The PMD is built on top of the base driver which is provided by Intel
and shouldn't be modified to allow easy batch upgrade from Intel.

The base driver is a "shared code" between many projects. But in DPDK,
the "base driver" naming makes more sense.

Signed-off-by: Thomas Monjalon 
---
 lib/librte_pmd_i40e/Makefile  | 33 -
 lib/librte_pmd_i40e/i40e_ethdev.c | 12 ++--
 2 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/lib/librte_pmd_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
index 09f2087..77d08fb 100644
--- a/lib/librte_pmd_i40e/Makefile
+++ b/lib/librte_pmd_i40e/Makefile
@@ -39,26 +39,25 @@ LIB = librte_pmd_i40e.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)

-ifeq ($(CC), icc)
-CFLAGS_SHARED_DRIVERS = -wd593
-else
-CFLAGS_SHARED_DRIVERS =  -Wno-unused-but-set-variable
-CFLAGS_SHARED_DRIVERS += -Wno-sign-compare
-CFLAGS_SHARED_DRIVERS += -Wno-unused-value
-CFLAGS_SHARED_DRIVERS += -Wno-unused-parameter
-CFLAGS_SHARED_DRIVERS += -Wno-strict-aliasing
-CFLAGS_SHARED_DRIVERS += -Wno-format
-CFLAGS_SHARED_DRIVERS += -Wno-missing-field-initializers
-CFLAGS_SHARED_DRIVERS += -Wno-pointer-to-int-cast
-CFLAGS_SHARED_DRIVERS += -Wno-format-nonliteral
-CFLAGS_SHARED_DRIVERS += -Wno-format-security
-endif
-
 #
 # Add extra flags for ND source files to disable warnings
 #
-SHARED_DRIVERS_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard 
$(RTE_SDK)/lib/librte_pmd_i40e/i40e/*.c)))
-$(foreach obj, $(SHARED_DRIVERS_OBJS), $(eval 
CFLAGS_$(obj)+=$(CFLAGS_SHARED_DRIVERS)))
+ifeq ($(CC), icc)
+CFLAGS_BASE_DRIVER = -wd593
+else
+CFLAGS_BASE_DRIVER  = -Wno-unused-but-set-variable
+CFLAGS_BASE_DRIVER += -Wno-sign-compare
+CFLAGS_BASE_DRIVER += -Wno-unused-value
+CFLAGS_BASE_DRIVER += -Wno-unused-parameter
+CFLAGS_BASE_DRIVER += -Wno-strict-aliasing
+CFLAGS_BASE_DRIVER += -Wno-format
+CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
+CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast
+CFLAGS_BASE_DRIVER += -Wno-format-nonliteral
+CFLAGS_BASE_DRIVER += -Wno-format-security
+endif
+OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard 
$(RTE_SDK)/lib/librte_pmd_i40e/i40e/*.c)))
+$(foreach obj, $(OBJS_BASE_DRIVER), $(eval 
CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))

 VPATH += $(RTE_SDK)/lib/librte_pmd_i40e/i40e

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index 3311d73..6bc3998 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -387,10 +387,10 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
return ret;
}

-   /* Initialize the shared code */
+   /* Initialize the shared code (base driver) */
ret = i40e_init_shared_code(hw);
if (ret) {
-   PMD_INIT_LOG(ERR, "Failed to init shared code: %d", ret);
+   PMD_INIT_LOG(ERR, "Failed to init shared code (base driver): 
%d", ret);
return ret;
}

@@ -1497,7 +1497,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev *dev,
 }

 /**
- * i40e_allocate_dma_mem_d - specific memory alloc for shared code
+ * i40e_allocate_dma_mem_d - specific memory alloc for shared code (base 
driver)
  * @hw:   pointer to the HW structure
  * @mem:  pointer to mem struct to fill out
  * @size: size of memory requested
@@ -1531,7 +1531,7 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
 }

 /**
- * i40e_free_dma_mem_d - specific memory free for shared code
+ * i40e_free_dma_mem_d - specific memory free for shared code (base driver)
  * @hw:   pointer to the HW structure
  * @mem:  ptr to mem struct to free
  **/
@@ -1549,7 +1549,7 @@ i40e_free_dma_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
 }

 /**
- * i40e_allocate_virt_mem_d - specific memory alloc for shared code
+ * i40e_allocate_virt_mem_d - specific memory alloc for shared code (base 
driver)
  * @hw:   pointer to the HW structure
  * @mem:  pointer to mem struct to fill out
  * @size: size of memory requested
@@ -1572,7 +1572,7 @@ i40e_allocate_virt_mem_d(__attribute__((unused)) struct 
i40e_hw *hw,
 }

 /**
- * i40e_free_virt_mem_d - specific memory free for shared code
+ * i40e_free_virt_mem_d - specific memory free for shared code (base driver)
  * @hw:   pointer to the HW structure
  * @mem:  pointer to mem struct to free
  **/
-- 
2.0.0



[dpdk-dev] [PATCH 2/3] i40e/base: ignore warning

2014-06-25 Thread Thomas Monjalon
From: "Chen Jing D(Mark)" 

There is a warning in base driver (shared code) on 32-bits RHEL6.3/6.5:
lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c:917:
error: integer constant is too large for ?long? type

As we don't modify base driver, this warning must be ignored.

Signed-off-by: Chen Jing D(Mark) 
Acked-by: Konstantin Ananyev 
Acked-by: Helin Zhang 
---
 lib/librte_pmd_i40e/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_pmd_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
index 77d08fb..9dbf69b 100644
--- a/lib/librte_pmd_i40e/Makefile
+++ b/lib/librte_pmd_i40e/Makefile
@@ -55,6 +55,7 @@ CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
 CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast
 CFLAGS_BASE_DRIVER += -Wno-format-nonliteral
 CFLAGS_BASE_DRIVER += -Wno-format-security
+CFLAGS_i40e_lan_hmc.o += -Wno-error
 endif
 OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard 
$(RTE_SDK)/lib/librte_pmd_i40e/i40e/*.c)))
 $(foreach obj, $(OBJS_BASE_DRIVER), $(eval 
CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
-- 
2.0.0



[dpdk-dev] [PATCH 3/3] ixgbe: rework fix of media type for bypass device

2014-06-25 Thread Thomas Monjalon
From: Pablo de Lara 

This was previously solved in commit 60a70d4e042350ca
(fix link status interrupt of bypass device),
but this alternative fix reverts the previous one and solves the
same issue without modifying the base driver (also named "shared code").

Signed-off-by: Pablo de Lara 
Acked-by: Konstantin Ananyev 
---
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c  |  3 ---
 lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c | 34 +++
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c 
b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c
index 93c4e35..ed97ad9 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c
@@ -537,9 +537,6 @@ enum ixgbe_media_type ixgbe_get_media_type_82599(struct 
ixgbe_hw *hw)
case IXGBE_DEV_ID_82599_SFP_SF2:
case IXGBE_DEV_ID_82599_SFP_SF_QP:
case IXGBE_DEV_ID_82599EN_SFP:
-#ifdef RTE_NIC_BYPASS 
-   case IXGBE_DEV_ID_82599_BYPASS:
-#endif
media_type = ixgbe_media_type_fiber;
break;
case IXGBE_DEV_ID_82599_CX4:
diff --git a/lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c 
b/lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c
index 27a5f70..0fc 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c
@@ -256,19 +256,6 @@ out:
return status;
 }

-/*
- * Wrapper around ND functions to support BYPASS nic.
- */
-s32
-ixgbe_bypass_init_shared_code(struct ixgbe_hw *hw)
-{
-   if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
-   hw->mac.type = ixgbe_mac_82599EB;
-   }
-
-   return (ixgbe_init_shared_code(hw));
-}
-
 static enum ixgbe_media_type
 ixgbe_bypass_get_media_type(struct ixgbe_hw *hw)
 {
@@ -284,6 +271,27 @@ ixgbe_bypass_get_media_type(struct ixgbe_hw *hw)
return (media_type);
 }

+/*
+ * Wrapper around shared code (base driver) to support BYPASS nic.
+ */
+s32
+ixgbe_bypass_init_shared_code(struct ixgbe_hw *hw)
+{
+   s32 ret_val;
+
+   if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
+   hw->mac.type = ixgbe_mac_82599EB;
+   }
+
+   ret_val = ixgbe_init_shared_code(hw);
+   if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
+   hw->mac.ops.get_media_type = &ixgbe_bypass_get_media_type;
+   ixgbe_init_mac_link_ops_82599(hw);
+   }
+
+   return ret_val;
+}
+
 s32
 ixgbe_bypass_init_hw(struct ixgbe_hw *hw)
 {
-- 
2.0.0



[dpdk-dev] [PATCH] kni: compatibility with RHEL 7

2014-06-25 Thread Cao, Waterman
Hi Thomas,

OK, we will verify this patch tomorrow.

Waterman 
>
>-Original Message-
>From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] 
>Sent: Wednesday, June 25, 2014 6:05 PM
>To: Cao, Waterman
>Cc: dev at dpdk.org; Hiroshi Shimamoto; Hayato Momma
>Subject: Re: [dpdk-dev] [PATCH] kni: compatibility with RHEL 7
>
>Hi Waterman,
>
>2014-06-12 09:35, Hiroshi Shimamoto:
>> 2014-06-12 09:18, Cao, Waterman:
>> >   Can you give details about Linux Kernel version and complier version?
>> >   Because we tried to build code in the Redhat 7.0 before, but we don't
>> >   meet this issue. Please see information as the following:
>> >   Linux kernel 3.10.0-54.0.1.el7.x86_64
>> >   RHEL70BETA_64GCC 4.8.2  ICC: 14.0.0
>> 
>> Yes,
>> 
>> Linux REHEL7RC-1 3.10.0-121.el7.x86_64 #1 SMP Tue Apr 8 10:48:19 EDT 
>> 2014
>> x86_64 x86_64 x86_64 GNU/Linux gcc version 4.8.2 20140120 (Red Hat
>> 4.8.2-16) (GCC)
>> 
>> I got the below error;
>> /path/to/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3851:1: error:
>> conflicting types for ?skb_set_hash? skb_set_hash(struct sk_buff *skb,
>> __u32 hash, __always_unused int type)
>> 
>> /usr/src/kernels/3.10.0-121.el7.x86_64/include/linux/skbuff.h:762:1: note:
>> previous definition of ?skb_set_hash? was here skb_set_hash(struct 
>> sk_buff *skb, __u32 hash, enum pkt_hash_types type)
>
>Could you confirm this fix is needed and acknowledge it?
>Thanks
>
>
>> > -Original Message-
>> > 
>> > >From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Hiroshi 
>> > >Shimamoto
>> > >Sent: Thursday, June 12, 2014 4:10 PM
>> > >To: dev at dpdk.org
>> > >Cc: Hayato Momma
>> > >Subject: [dpdk-dev] [PATCH] kni: compatibility with RHEL 7
>> > >
>> > >From: Hiroshi Shimamoto 
>> > >
>> > >Compilation in RHEL7 is failed. This fixes the build issue.
>> > >
>> > >RHEL7 has skb_set_hash, the kernel version is 3.10 though.
>> > >Don't define skb_set_hash for RHEL7.
>> > >
>> > >Signed-off-by: Hiroshi Shimamoto 
>> > >Reviewed-by: Hayato Momma 
>> > >---
>> > >
>> > > lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 5 +
>> > > 1 file changed, 5 insertions(+)
>> > >
>> > >diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>> > >b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h index
>> > >4c27d5d..b4de6e2 100644
>> > >--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>> > >+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>> > >@@ -3843,6 +3843,9 @@ static inline struct sk_buff 
>> > >*__kc__vlan_hwaccel_put_tag(struct sk_buff *skb,  #endif /* >= 
>> > >3.10.0>
>> > */
>> > 
>> > > #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) )
>> > >
>> > >+
>> > >+#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >=
>> > >+RHEL_RELEASE_VERSION(7,0)))
>> > >+
>> > >
>> > > #ifdef NETIF_F_RXHASH
>> > > #define PKT_HASH_TYPE_L3 0
>> > > static inline void
>> > >
>> > >@@ -3851,6 +3854,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, 
>> > >__always_unused int type)> >
>> > >  skb->rxhash = hash;
>> > > 
>> > > }
>> > > #endif /* NETIF_F_RXHASH */
>> > >
>> > >+#endif /* < RHEL7 */
>> > >+
>> > >
>> > > #endif /* < 3.14.0 */
>> > > 
>> > > #endif /* _KCOMPAT_H_ */
>> > >
>> > >--
>> > >1.9.1
>
>
>--
>Thomas
>


[dpdk-dev] [PATCH v7 6/6] Link Bonding Library doxygen additions

2014-06-25 Thread Thomas Monjalon
Hi Declan,

Since bonding library is a PMD, there should have no need of integrate it
in the API documentation.
I hadn't time to review it yet, so I would miss something.
Do you mean it can be used directly by the application with a specific API?
In this case, you could explain it in the commit log.

2014-06-24 17:03, Declan Doherty:
> --- a/doc/doxy-api-index.md
> +++ b/doc/doxy-api-index.md
> @@ -36,6 +36,7 @@ API {#index}
>  There are many libraries, so their headers may be grouped by topics:
> 
>  - **device**:
> +  [bond]   (@ref rte_eth_bond.h),
>[ethdev] (@ref rte_ethdev.h),
>[devargs](@ref rte_devargs.h),
>[KNI](@ref rte_kni.h),

ethdev should be first in this list.

> --- a/doc/doxy-api.conf
> +++ b/doc/doxy-api.conf
> @@ -30,6 +30,7 @@
> 
>  PROJECT_NAME= DPDK
>  INPUT   = doc/doxy-api-index.md \
> +  lib/librte_pmd_bond \
>lib/librte_eal/common/include \
>lib/librte_acl \
>lib/librte_distributor \

Libraries should be in alphabetical order here.

Thanks
-- 
Thomas


[dpdk-dev] [PATCH v7 3/6] EAL support for link bonding device initialization

2014-06-25 Thread Thomas Monjalon
Hi Declan,

2014-06-24 17:03, Declan Doherty:
> Updating functionality in EAL to support adding link bonding
> devices via ?vdev option. Link bonding devices will be
> initialized after all physical devices have been probed and
> initialized.
[...]
> --- a/lib/librte_eal/common/eal_common_dev.c
> +++ b/lib/librte_eal/common/eal_common_dev.c
> @@ -62,7 +62,7 @@ rte_eal_driver_unregister(struct rte_driver *driver)
>  }
> 
>  int
> -rte_eal_dev_init(void)
> +rte_eal_dev_init(uint8_t init_pri)
>  {
>   struct rte_devargs *devargs;
>   struct rte_driver *driver;
> @@ -80,30 +80,52 @@ rte_eal_dev_init(void)
>   continue;
> 
>   TAILQ_FOREACH(driver, &dev_driver_list, next) {
> - if (driver->type != PMD_VDEV)
> - continue;
> + /* RTE_DEVTYPE_VIRTUAL can only be a virtual or bonded 
> device,
> +  * virtual devices are initialized pre PCI probing and 
> bonded
> +  * device are post pci probing */
> + if ((driver->type == PMD_VDEV && init_pri ==
> + PMD_INIT_PRE_PCI_PROBE) ||
> + (driver->type == PMD_BDEV && init_pri ==
> + PMD_INIT_POST_PCI_PROBE)) {
> 
> - /* search a driver prefix in virtual device name */
> - if (!strncmp(driver->name, devargs->virtual.drv_name,
> - strlen(driver->name))) {
> - driver->init(devargs->virtual.drv_name,
> - devargs->args);
> - break;
> + /* search a driver prefix in virtual device 
> name */
> + if (!strncmp(driver->name, 
> devargs->virtual.drv_name,
> + strlen(driver->name))) {
> + printf("init (%u) %s\n", init_pri, 
> devargs-
>virtual.drv_name);
> + driver->init(devargs->virtual.drv_name,
> + devargs->args);
> + break;
> + }
>   }
>   }
> 
> - if (driver == NULL) {
> - rte_panic("no driver found for %s\n",
> -   devargs->virtual.drv_name);
> + /* If initializing pre PCI probe, then we don't expect a bonded 
driver
> +  * to be found */
> + if (init_pri == PMD_INIT_PRE_PCI_PROBE &&
> + strncmp(RTE_PMD_BOND, devargs->virtual.drv_name,
> + strlen(RTE_PMD_BOND)) != 0) {
> + if (driver == NULL) {
> + rte_panic("no driver found for virtual device 
> %s\n",
> + devargs->virtual.drv_name);
> + }
> + } else if (init_pri == PMD_INIT_POST_PCI_PROBE &&
> + strncmp(RTE_PMD_BOND, devargs->virtual.drv_name,
> + strlen(RTE_PMD_BOND)) == 0) {
> + if (driver == NULL) {
> + rte_panic("no driver found for bonded device 
> %s\n",
> + devargs->virtual.drv_name);
> + }
>   }
>   }
> 
> - /* Once the vdevs are initalized, start calling all the pdev drivers */
> - TAILQ_FOREACH(driver, &dev_driver_list, next) {
> - if (driver->type != PMD_PDEV)
> - continue;
> - /* PDEV drivers don't get passed any parameters */
> - driver->init(NULL, NULL);
> + /* Once the vdevs are initialized, start calling all the pdev drivers */
> + if (init_pri == PMD_INIT_PRE_PCI_PROBE) {
> + TAILQ_FOREACH(driver, &dev_driver_list, next) {
> + if (driver->type != PMD_PDEV)
> + continue;
> + /* PDEV drivers don't get passed any parameters */
> + driver->init(NULL, NULL);
> + }
>   }
>   return 0;
>  }

[...]

> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -75,6 +75,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include "eal_private.h"
>  #include "eal_thread.h"
> @@ -1097,7 +1098,7 @@ rte_eal_init(int argc, char **argv)
>   RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n",
>   rte_config.master_lcore, (int)thread_id);
> 
> - if (rte_eal_dev_init() < 0)
> + if (rte_eal_dev_init(PMD_INIT_PRE_PCI_PROBE) < 0)
>   rte_panic("Cannot init pmd devices\n");
> 
>   RTE_LCORE_FOREACH_SLAVE(i) {
> @@ -1127,6 +1128,14 @@ rte_eal_init(int argc, char **argv

[dpdk-dev] [PATCH v7 6/6] Link Bonding Library doxygen additions

2014-06-25 Thread Doherty, Declan
> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Wednesday, June 25, 2014 2:44 PM
> To: Doherty, Declan
> Cc: dev at dpdk.org
> Subject: Re: [PATCH v7 6/6] Link Bonding Library doxygen additions
> 
> Hi Declan,
> 
> Since bonding library is a PMD, there should have no need of integrate it
> in the API documentation.
> I hadn't time to review it yet, so I would miss something.
> Do you mean it can be used directly by the application with a specific API?
> In this case, you could explain it in the commit log.
> 

Hi Thomas, the bonding library has a  API which supports creation and 
management of bonded devices directly from within applications, but more 
importantly provides the APIs required to dynamically add and remove slaves 
from a bonded device, this functionality will be required to support live 
migration of VMs using bonded ports in a future releases.


[dpdk-dev] [PATCH v7 6/6] Link Bonding Library doxygen additions

2014-06-25 Thread Thomas Monjalon
2014-06-25 14:19, Doherty, Declan:
> > -Original Message-
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > Sent: Wednesday, June 25, 2014 2:44 PM
> > To: Doherty, Declan
> > Cc: dev at dpdk.org
> > Subject: Re: [PATCH v7 6/6] Link Bonding Library doxygen additions
> > 
> > Hi Declan,
> > 
> > Since bonding library is a PMD, there should have no need of integrate it
> > in the API documentation.
> > I hadn't time to review it yet, so I would miss something.
> > Do you mean it can be used directly by the application with a specific
> > API?
> > In this case, you could explain it in the commit log.
> 
> Hi Thomas, the bonding library has a  API which supports creation and
> management of bonded devices directly from within applications, but more
> importantly provides the APIs required to dynamically add and remove slaves
> from a bonded device, this functionality will be required to support live
> migration of VMs using bonded ports in a future releases.

OK. Could I suggest to split rte_eth_bond.c in 2 files?
1 file for the library matching the API and 1 file for the PMD layer?
I feel it would be easier to read and maintain.

Thanks
-- 
Thomas


[dpdk-dev] [PATCH v7 3/6] EAL support for link bonding device initialization

2014-06-25 Thread Doherty, Declan


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Wednesday, June 25, 2014 2:55 PM
> To: Doherty, Declan
> Cc: dev at dpdk.org
> Subject: Re: [PATCH v7 3/6] EAL support for link bonding device initialization
> 
> Hi Declan,
> 
> 2014-06-24 17:03, Declan Doherty:
> > Updating functionality in EAL to support adding link bonding
> > devices via ?vdev option. Link bonding devices will be
> > initialized after all physical devices have been probed and
> > initialized.
> [...]
> 
> 
> Not sure to understand why you need to split rte_eal_dev_init() in 2 steps.
> Should it be possible to keep existing rte_eal_dev_init() behaviour and makes
> further initialization when calling rte_eth_dev_configure()?
> I've seen it's empty for bonding device:
> 

> Thanks
> --
> Thomas

Hi Thomas, that need to split rte_eal_dev_init into 2 steps doesn't come
explicitly from the bonded device itself, as a bonded device could be created at
any time during initialization, the issue arises from the fact that none of 
physical 
devices are allocated/initialized until after pci_probe_all_drivers() is 
called, this
puts an explicit constraint on when it is possible to create a bonded device 
which
has physical devices as slaves, as the phyiscal devices don't exist at the 
initial call to 
rte_eal_dev_init() and therefore can't be added as slaves to the bonded device.

It isn't possible to keep the rte_eal_dev_init() behavior and use
rte_eth_dev_configure() to complete initialization without radically changing 
the
behavior of the bonding library,  and the current functionality of
 rte_eth_bond_slave_add(), as this would need to no longer actually add a 
slave, 
but to save the name of a slave to be retrieved at some point in the future to 
be added as a slave to the bonded device. 

Declan






[dpdk-dev] [PATCH 1/3] i40e: explicit shared code naming as base driver

2014-06-25 Thread Chen, Jing D
Hi Thomas,

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Wednesday, June 25, 2014 8:22 PM
> To: dev at dpdk.org
> Cc: Chen, Jing D; Zhang, Helin; Ananyev, Konstantin; De Lara Guarch, Pablo
> Subject: [PATCH 1/3] i40e: explicit shared code naming as base driver
> 
> The PMD is built on top of the base driver which is provided by Intel and
> shouldn't be modified to allow easy batch upgrade from Intel.
> 
> The base driver is a "shared code" between many projects. But in DPDK, the
> "base driver" naming makes more sense.
> 
> Signed-off-by: Thomas Monjalon 
> ---
>  lib/librte_pmd_i40e/Makefile  | 33 -
>  lib/librte_pmd_i40e/i40e_ethdev.c | 12 ++--
>  2 files changed, 22 insertions(+), 23 deletions(-)
> 
> diff --git a/lib/librte_pmd_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
> index 09f2087..77d08fb 100644
> --- a/lib/librte_pmd_i40e/Makefile
> +++ b/lib/librte_pmd_i40e/Makefile
> @@ -39,26 +39,25 @@ LIB = librte_pmd_i40e.a  CFLAGS += -O3  CFLAGS
> += $(WERROR_FLAGS)
> 
> -ifeq ($(CC), icc)
> -CFLAGS_SHARED_DRIVERS = -wd593
> -else
> -CFLAGS_SHARED_DRIVERS =  -Wno-unused-but-set-variable
> -CFLAGS_SHARED_DRIVERS += -Wno-sign-compare
> -CFLAGS_SHARED_DRIVERS += -Wno-unused-value
> -CFLAGS_SHARED_DRIVERS += -Wno-unused-parameter
> -CFLAGS_SHARED_DRIVERS += -Wno-strict-aliasing
> -CFLAGS_SHARED_DRIVERS += -Wno-format -CFLAGS_SHARED_DRIVERS +=
> -Wno-missing-field-initializers -CFLAGS_SHARED_DRIVERS +=
> -Wno-pointer-to-int-cast -CFLAGS_SHARED_DRIVERS +=
> -Wno-format-nonliteral -CFLAGS_SHARED_DRIVERS +=
> -Wno-format-security -endif
> -
>  #
>  # Add extra flags for ND source files to disable warnings  #
> -SHARED_DRIVERS_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard
> $(RTE_SDK)/lib/librte_pmd_i40e/i40e/*.c)))
> -$(foreach obj, $(SHARED_DRIVERS_OBJS), $(eval
> CFLAGS_$(obj)+=$(CFLAGS_SHARED_DRIVERS)))
> +ifeq ($(CC), icc)
> +CFLAGS_BASE_DRIVER = -wd593
> +else
> +CFLAGS_BASE_DRIVER  = -Wno-unused-but-set-variable
> CFLAGS_BASE_DRIVER
> ++= -Wno-sign-compare CFLAGS_BASE_DRIVER += -Wno-unused-value
> +CFLAGS_BASE_DRIVER += -Wno-unused-parameter CFLAGS_BASE_DRIVER
> +=
> +-Wno-strict-aliasing CFLAGS_BASE_DRIVER += -Wno-format
> +CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
> +CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast CFLAGS_BASE_DRIVER
> +=
> +-Wno-format-nonliteral CFLAGS_BASE_DRIVER += -Wno-format-security
> endif
> +OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard
> +$(RTE_SDK)/lib/librte_pmd_i40e/i40e/*.c)))
> +$(foreach obj, $(OBJS_BASE_DRIVER), $(eval
> +CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
> 
>  VPATH += $(RTE_SDK)/lib/librte_pmd_i40e/i40e
> 
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> b/lib/librte_pmd_i40e/i40e_ethdev.c
> index 3311d73..6bc3998 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -387,10 +387,10 @@ eth_i40e_dev_init(__rte_unused struct eth_driver
> *eth_drv,
>   return ret;
>   }
> 
> - /* Initialize the shared code */
> + /* Initialize the shared code (base driver) */
>   ret = i40e_init_shared_code(hw);
>   if (ret) {
> - PMD_INIT_LOG(ERR, "Failed to init shared code: %d", ret);
> + PMD_INIT_LOG(ERR, "Failed to init shared code (base driver): 
> %d",
> +ret);
>   return ret;
>   }
> 
> @@ -1497,7 +1497,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev
> *dev,  }
> 
>  /**
> - * i40e_allocate_dma_mem_d - specific memory alloc for shared code
> + * i40e_allocate_dma_mem_d - specific memory alloc for shared code
> + (base driver)
>   * @hw:   pointer to the HW structure
>   * @mem:  pointer to mem struct to fill out
>   * @size: size of memory requested
> @@ -1531,7 +1531,7 @@
> i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,  }
> 
>  /**
> - * i40e_free_dma_mem_d - specific memory free for shared code
> + * i40e_free_dma_mem_d - specific memory free for shared code (base
> + driver)
>   * @hw:   pointer to the HW structure
>   * @mem:  ptr to mem struct to free
>   **/
> @@ -1549,7 +1549,7 @@ i40e_free_dma_mem_d(__attribute__((unused))
> struct i40e_hw *hw,  }
> 
>  /**
> - * i40e_allocate_virt_mem_d - specific memory alloc for shared code
> + * i40e_allocate_virt_mem_d - specific memory alloc for shared code
> + (base driver)
>   * @hw:   pointer to the HW structure
>   * @mem:  pointer to mem struct to fill out
>   * @size: size of memory requested
> @@ -1572,7 +1572,7 @@
> i40e_allocate_virt_mem_d(__attribute__((unused)) struct i40e_hw *hw,  }
> 
>  /**
> - * i40e_free_virt_mem_d - specific memory free for shared code
> + * i40e_free_virt_mem_d - specific memory free for shared code (base
> + driver)
>   * @hw:   pointer to the HW structure
>   * @mem:  pointer to mem struct to free
>   **/
> --
> 2.0.0


I don't object the name change. But I don't see anything good. As some of the 
API indicates (i40e_init_shared_code), we can 

[dpdk-dev] [PATCH 1/3] i40e: explicit shared code naming as base driver

2014-06-25 Thread Chen, Jing D
My bad. Please ignore " BTW, won't this patch overwrite previous one that fix 
GCC 32bits warning?"

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Chen, Jing D
> Sent: Wednesday, June 25, 2014 10:44 PM
> To: Thomas Monjalon; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/3] i40e: explicit shared code naming as
> base driver
> 
> Hi Thomas,
> 
> > -Original Message-
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > Sent: Wednesday, June 25, 2014 8:22 PM
> > To: dev at dpdk.org
> > Cc: Chen, Jing D; Zhang, Helin; Ananyev, Konstantin; De Lara Guarch,
> > Pablo
> > Subject: [PATCH 1/3] i40e: explicit shared code naming as base driver
> >
> > The PMD is built on top of the base driver which is provided by Intel
> > and shouldn't be modified to allow easy batch upgrade from Intel.
> >
> > The base driver is a "shared code" between many projects. But in DPDK,
> > the "base driver" naming makes more sense.
> >
> > Signed-off-by: Thomas Monjalon 
> > ---
> >  lib/librte_pmd_i40e/Makefile  | 33
> -
> >  lib/librte_pmd_i40e/i40e_ethdev.c | 12 ++--
> >  2 files changed, 22 insertions(+), 23 deletions(-)
> >
> > diff --git a/lib/librte_pmd_i40e/Makefile
> > b/lib/librte_pmd_i40e/Makefile index 09f2087..77d08fb 100644
> > --- a/lib/librte_pmd_i40e/Makefile
> > +++ b/lib/librte_pmd_i40e/Makefile
> > @@ -39,26 +39,25 @@ LIB = librte_pmd_i40e.a  CFLAGS += -O3
> CFLAGS
> > += $(WERROR_FLAGS)
> >
> > -ifeq ($(CC), icc)
> > -CFLAGS_SHARED_DRIVERS = -wd593
> > -else
> > -CFLAGS_SHARED_DRIVERS =  -Wno-unused-but-set-variable
> > -CFLAGS_SHARED_DRIVERS += -Wno-sign-compare
> -CFLAGS_SHARED_DRIVERS +=
> > -Wno-unused-value -CFLAGS_SHARED_DRIVERS +=
> -Wno-unused-parameter
> > -CFLAGS_SHARED_DRIVERS += -Wno-strict-aliasing
> -CFLAGS_SHARED_DRIVERS
> > += -Wno-format -CFLAGS_SHARED_DRIVERS +=
> > -Wno-missing-field-initializers -CFLAGS_SHARED_DRIVERS +=
> > -Wno-pointer-to-int-cast -CFLAGS_SHARED_DRIVERS +=
> > -Wno-format-nonliteral -CFLAGS_SHARED_DRIVERS +=
> -Wno-format-security
> > -endif
> > -
> >  #
> >  # Add extra flags for ND source files to disable warnings  #
> > -SHARED_DRIVERS_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard
> > $(RTE_SDK)/lib/librte_pmd_i40e/i40e/*.c)))
> > -$(foreach obj, $(SHARED_DRIVERS_OBJS), $(eval
> > CFLAGS_$(obj)+=$(CFLAGS_SHARED_DRIVERS)))
> > +ifeq ($(CC), icc)
> > +CFLAGS_BASE_DRIVER = -wd593
> > +else
> > +CFLAGS_BASE_DRIVER  = -Wno-unused-but-set-variable
> > CFLAGS_BASE_DRIVER
> > ++= -Wno-sign-compare CFLAGS_BASE_DRIVER += -Wno-unused-value
> > +CFLAGS_BASE_DRIVER += -Wno-unused-parameter
> CFLAGS_BASE_DRIVER =
> > +-Wno-strict-aliasing CFLAGS_BASE_DRIVER += -Wno-format
> > +CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
> > +CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast
> CFLAGS_BASE_DRIVER =
> > +-Wno-format-nonliteral CFLAGS_BASE_DRIVER += -Wno-format-security
> > endif
> > +OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard
> > +$(RTE_SDK)/lib/librte_pmd_i40e/i40e/*.c)))
> > +$(foreach obj, $(OBJS_BASE_DRIVER), $(eval
> > +CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
> >
> >  VPATH += $(RTE_SDK)/lib/librte_pmd_i40e/i40e
> >
> > diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> > b/lib/librte_pmd_i40e/i40e_ethdev.c
> > index 3311d73..6bc3998 100644
> > --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> > +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> > @@ -387,10 +387,10 @@ eth_i40e_dev_init(__rte_unused struct
> eth_driver
> > *eth_drv,
> > return ret;
> > }
> >
> > -   /* Initialize the shared code */
> > +   /* Initialize the shared code (base driver) */
> > ret = i40e_init_shared_code(hw);
> > if (ret) {
> > -   PMD_INIT_LOG(ERR, "Failed to init shared code: %d", ret);
> > +   PMD_INIT_LOG(ERR, "Failed to init shared code (base driver): 
> > %d",
> > +ret);
> > return ret;
> > }
> >
> > @@ -1497,7 +1497,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev
> *dev,
> > }
> >
> >  /**
> > - * i40e_allocate_dma_mem_d - specific memory alloc for shared code
> > + * i40e_allocate_dma_mem_d - specific memory alloc for shared code
> > + (base driver)
> >   * @hw:   pointer to the HW structure
> >   * @mem:  pointer to mem struct to fill out
> >   * @size: size of memory requested
> > @@ -1531,7 +1531,7 @@
> > i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw
> *hw,  }
> >
> >  /**
> > - * i40e_free_dma_mem_d - specific memory free for shared code
> > + * i40e_free_dma_mem_d - specific memory free for shared code (base
> > + driver)
> >   * @hw:   pointer to the HW structure
> >   * @mem:  ptr to mem struct to free
> >   **/
> > @@ -1549,7 +1549,7 @@ i40e_free_dma_mem_d(__attribute__((unused))
> > struct i40e_hw *hw,  }
> >
> >  /**
> > - * i40e_allocate_virt_mem_d - specific memory alloc for shared code
> > + * i40e_allocate_virt_mem_d - specific memory alloc for shared code
> > + (base driver)
> >   * @hw:   pointer to the 

[dpdk-dev] [PATCH v7 3/6] EAL support for link bonding device initialization

2014-06-25 Thread Thomas Monjalon
2014-06-25 14:41, Doherty, Declan:
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > Not sure to understand why you need to split rte_eal_dev_init() in 2
> > steps.
> > Should it be possible to keep existing rte_eal_dev_init()
> > behaviour and makes further initialization when calling
> > rte_eth_dev_configure()?
> > I've seen it's empty for bonding device:
> 
> Hi Thomas, that need to split rte_eal_dev_init into 2 steps doesn't come
> explicitly from the bonded device itself, as a bonded device could be
> created at any time during initialization, the issue arises from the fact
> that none of physical devices are allocated/initialized until after
> pci_probe_all_drivers() is called, this puts an explicit constraint on when
> it is possible to create a bonded device which has physical devices as
> slaves, as the phyiscal devices don't exist at the initial call to
> rte_eal_dev_init() and therefore can't be added as slaves to the bonded
> device. 
> It isn't possible to keep the rte_eal_dev_init() behavior and use
> rte_eth_dev_configure() to complete initialization without radically
> changing the behavior of the bonding library,  and the current
> functionality of rte_eth_bond_slave_add(), as this would need to no longer
> actually add a slave, but to save the name of a slave to be retrieved at
> some point in the future to be added as a slave to the bonded device.

I'm sure it would be much cleaner if you split rte_eth_bond_slave_add() 
instead of splitting rte_eal_dev_init().
If I understand well, you should first save kvargs for slaves and add them at 
configure time.

Then you could remove PMD_BDEV type and use PMD_VDEV.

I know it's an additional work but API cleaning really deserves it.

Thanks
-- 
Thomas


[dpdk-dev] [PATCH 0/3] previous patches about "shared code"/"base drivers"

2014-06-25 Thread Richardson, Bruce
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Wednesday, June 25, 2014 5:22 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 0/3] previous patches about "shared code"/"base
> drivers"
> 
> There were discussions about how to fix/workaround bugs in Intel code which
> we don't want to modify. And it raised wording issue to clarify things.
> I modify my patch and accept others. So I resend them in order to have a
> final acknowledgement.
> 
> Please comment and/or acknowledge.
> Thanks
> 
> Thomas Monjalon (1):
>   i40e: explicit shared code naming as base driver
> Chen Jing D(Mark) (1):
>   i40e/base: ignore warning
> Pablo de Lara (1):
>   ixgbe: rework fix of media type for bypass device
> 
>  lib/librte_pmd_i40e/Makefile  | 34 
> +++
>  lib/librte_pmd_i40e/i40e_ethdev.c | 12 +--
>  lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c  |  3 ---
>  lib/librte_pmd_ixgbe/ixgbe_82599_bypass.c | 34 +++
> 
>  4 files changed, 44 insertions(+), 39 deletions(-)
> 
> --
> 2.0.0

Acked-by: Bruce Richardson 


[dpdk-dev] [PATCH v7 3/6] EAL support for link bonding device initialization

2014-06-25 Thread Richardson, Bruce
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Wednesday, June 25, 2014 9:01 AM
> To: Doherty, Declan
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v7 3/6] EAL support for link bonding device
> initialization
> 
> 2014-06-25 14:41, Doherty, Declan:
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > > Not sure to understand why you need to split rte_eal_dev_init() in 2
> > > steps.
> > > Should it be possible to keep existing rte_eal_dev_init()
> > > behaviour and makes further initialization when calling
> > > rte_eth_dev_configure()?
> > > I've seen it's empty for bonding device:
> >
> > Hi Thomas, that need to split rte_eal_dev_init into 2 steps doesn't come
> > explicitly from the bonded device itself, as a bonded device could be
> > created at any time during initialization, the issue arises from the fact
> > that none of physical devices are allocated/initialized until after
> > pci_probe_all_drivers() is called, this puts an explicit constraint on when
> > it is possible to create a bonded device which has physical devices as
> > slaves, as the phyiscal devices don't exist at the initial call to
> > rte_eal_dev_init() and therefore can't be added as slaves to the bonded
> > device.
> > It isn't possible to keep the rte_eal_dev_init() behavior and use
> > rte_eth_dev_configure() to complete initialization without radically
> > changing the behavior of the bonding library,  and the current
> > functionality of rte_eth_bond_slave_add(), as this would need to no longer
> > actually add a slave, but to save the name of a slave to be retrieved at
> > some point in the future to be added as a slave to the bonded device.
> 
> I'm sure it would be much cleaner if you split rte_eth_bond_slave_add()
> instead of splitting rte_eal_dev_init().
> If I understand well, you should first save kvargs for slaves and add them at
> configure time.
> 
> Then you could remove PMD_BDEV type and use PMD_VDEV.
> 
> I know it's an additional work but API cleaning really deserves it.
> 

Or else we could just go back to the earlier versions of the submission and 
accept the fact that some types of devices are designed to be used from code 
via an API and that we don't need to be able to set up every type of device via 
the application command-line. The code for this feature and rework to EAL has 
just got continually more complicated every time due to the need to continually 
workaround gotchas when trying to enable this for second-level ethdevs.

/Bruce



[dpdk-dev] [PATCH 1/2] mk: overriding CC also overrides HOSTCC

2014-06-25 Thread Richardson, Bruce
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Richardson, Bruce
> Sent: Tuesday, June 24, 2014 10:22 AM
> To: Thomas Monjalon
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/2] mk: overriding CC also overrides HOSTCC
> 
> > -Original Message-
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > Sent: Tuesday, June 24, 2014 2:39 AM
> > To: Richardson, Bruce
> > Cc: dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 1/2] mk: overriding CC also overrides HOSTCC
> >
> > Hi Bruce,
> >
> > 2014-06-24 01:23, Bruce Richardson:
> > > when overriding the CC variable on the commandline, the HOSTCC value
> > > was remaining at "gcc", which caused errors on Free BSD10 when using a gcc
> > > as e.g. gcc48, without a binary just called "gcc". This change overrides
> > > HOSTCC when CC is overridden, which means that setting CC=gcc48, will
> > > now also set HOSTCC=gcc48, allowing the "testhost" app to compile on
> BSD10
> >
> > So you are mixing CC and HOSTCC which would break cross-compilation.
> > Why don't you set HOSTCC on command line?
> >
> 
> Because I shouldn't need to set HOSTCC unless I am cross compiling and need a
> different CC and HOSTCC. If my compiler is called "gcc48", and I tell the 
> build
> system that my compiler is called "gcc48", it should use that value 
> everywhere in
> place of gcc, unless I also tell it that my HOSTCC should be something
> completely different. This patch only affects HOSTCC if you specify CC on the
> command-line to override that value, otherwise things are left as they are.
> If you do want to override CC and do cross compiling with a separate HOSTCC
> that can be done too, by overriding HOSTCC also, i.e. CC=x HOSTCC=y. For those
> not cross compiling, they should never need to know about HOSTCC at all.

Is the above explanation clear enough? Anyone any other comments or care to ack 
the patch. I think this is really needed to make it easy to use v1.7 on BSD 10, 
which has no gcc by default.

/Bruce


[dpdk-dev] [PATCH v8 3/6] EAL support for link bonding device initialization

2014-06-25 Thread Declan Doherty
Updating functionality in EAL to support adding link bonding
devices via ?vdev option. Link bonding devices will be
initialized after all physical devices have been probed and
initialized.

Signed-off-by: Declan Doherty 
---
 lib/librte_eal/bsdapp/eal/eal.c |   10 -
 lib/librte_eal/common/eal_common_dev.c  |   58 ++
 lib/librte_eal/common/eal_common_pci.c  |3 +
 lib/librte_eal/common/include/eal_private.h |7 ---
 lib/librte_eal/common/include/rte_dev.h |   13 +-
 lib/librte_eal/linuxapp/eal/eal.c   |   11 +-
 6 files changed, 73 insertions(+), 29 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index a1f014f..c53f63e 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -874,7 +874,7 @@ rte_eal_init(int argc, char **argv)

rte_eal_mcfg_complete();

-   if (rte_eal_dev_init() < 0)
+   if (rte_eal_dev_init(PMD_INIT_PRE_PCI_PROBE) < 0)
rte_panic("Cannot init pmd devices\n");

RTE_LCORE_FOREACH_SLAVE(i) {
@@ -906,6 +906,14 @@ rte_eal_init(int argc, char **argv)
rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
rte_eal_mp_wait_lcore();

+   /* Probe & Initialize PCI devices */
+   if (rte_eal_pci_probe())
+   rte_panic("Cannot probe PCI\n");
+
+   /* Initialize any outstanding devices */
+   if (rte_eal_dev_init(PMD_INIT_POST_PCI_PROBE) < 0)
+   rte_panic("Cannot init pmd devices\n");
+
return fctret;
 }

diff --git a/lib/librte_eal/common/eal_common_dev.c 
b/lib/librte_eal/common/eal_common_dev.c
index eae5656..8e80093 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -62,7 +62,7 @@ rte_eal_driver_unregister(struct rte_driver *driver)
 }

 int
-rte_eal_dev_init(void)
+rte_eal_dev_init(uint8_t init_pri)
 {
struct rte_devargs *devargs;
struct rte_driver *driver;
@@ -80,30 +80,52 @@ rte_eal_dev_init(void)
continue;

TAILQ_FOREACH(driver, &dev_driver_list, next) {
-   if (driver->type != PMD_VDEV)
-   continue;
+   /* RTE_DEVTYPE_VIRTUAL can only be a virtual or bonded 
device,
+* virtual devices are initialized pre PCI probing and 
bonded
+* device are post pci probing */
+   if ((driver->type == PMD_VDEV && init_pri ==
+   PMD_INIT_PRE_PCI_PROBE) ||
+   (driver->type == PMD_BDEV && init_pri ==
+   PMD_INIT_POST_PCI_PROBE)) {

-   /* search a driver prefix in virtual device name */
-   if (!strncmp(driver->name, devargs->virtual.drv_name,
-   strlen(driver->name))) {
-   driver->init(devargs->virtual.drv_name,
-   devargs->args);
-   break;
+   /* search a driver prefix in virtual device 
name */
+   if (!strncmp(driver->name, 
devargs->virtual.drv_name,
+   strlen(driver->name))) {
+   printf("init (%u) %s\n", init_pri, 
devargs->virtual.drv_name);
+   driver->init(devargs->virtual.drv_name,
+   devargs->args);
+   break;
+   }
}
}

-   if (driver == NULL) {
-   rte_panic("no driver found for %s\n",
- devargs->virtual.drv_name);
+   /* If initializing pre PCI probe, then we don't expect a bonded 
driver
+* to be found */
+   if (init_pri == PMD_INIT_PRE_PCI_PROBE &&
+   strncmp(RTE_PMD_BOND, devargs->virtual.drv_name,
+   strlen(RTE_PMD_BOND)) != 0) {
+   if (driver == NULL) {
+   rte_panic("no driver found for virtual device 
%s\n",
+   devargs->virtual.drv_name);
+   }
+   } else if (init_pri == PMD_INIT_POST_PCI_PROBE &&
+   strncmp(RTE_PMD_BOND, devargs->virtual.drv_name,
+   strlen(RTE_PMD_BOND)) == 0) {
+   if (driver == NULL) {
+   rte_panic("no driver found for bonded device 
%s\n",
+   devargs->virtual.drv_name);
+   }
}
}

-   /* Once the vdevs 

[dpdk-dev] [PATCH v8 6/6] Link Bonding Library doxygen additions

2014-06-25 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 doc/doxy-api-index.md |1 +
 doc/doxy-api.conf |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/doc/doxy-api-index.md b/doc/doxy-api-index.md
index 7b26e98..ee3ad4f 100644
--- a/doc/doxy-api-index.md
+++ b/doc/doxy-api-index.md
@@ -36,6 +36,7 @@ API {#index}
 There are many libraries, so their headers may be grouped by topics:

 - **device**:
+  [bond]   (@ref rte_eth_bond.h),
   [ethdev] (@ref rte_ethdev.h),
   [devargs](@ref rte_devargs.h),
   [KNI](@ref rte_kni.h),
diff --git a/doc/doxy-api.conf b/doc/doxy-api.conf
index f380d9a..b15a340 100644
--- a/doc/doxy-api.conf
+++ b/doc/doxy-api.conf
@@ -30,6 +30,7 @@

 PROJECT_NAME= DPDK
 INPUT   = doc/doxy-api-index.md \
+  lib/librte_pmd_bond \
   lib/librte_eal/common/include \
   lib/librte_acl \
   lib/librte_distributor \
-- 
1.7.0.7



[dpdk-dev] [PATCH v8 1/6] Link Bonding Library (lib/librte_pmd_bond)

2014-06-25 Thread Declan Doherty
Initial release with support for
 Mode 0 - Round Robin
 Mode 1 - Active Backup
 Mode 2 - Balance -> Supports 3 transmit polices (layer 2, layer 2+3, layer 3+4)
 Mode 3 - Broadcast

Signed-off-by: Declan Doherty 
---
 config/common_bsdapp   |5 +
 config/common_linuxapp |5 +
 lib/Makefile   |1 +
 lib/librte_pmd_bond/Makefile   |   34 +
 lib/librte_pmd_bond/rte_eth_bond.h |  255 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c |  670 +++
 lib/librte_pmd_bond/rte_eth_bond_pmd.c | 1228 
 lib/librte_pmd_bond/rte_eth_bond_private.h |  218 +
 lib/librte_pmd_bond/rte_eth_bond_vargs.c   |  255 ++
 mk/rte.app.mk  |5 +
 10 files changed, 2676 insertions(+), 0 deletions(-)
 create mode 100644 lib/librte_pmd_bond/Makefile
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond.h
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_api.c
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_pmd.c
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_private.h
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_vargs.c

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 989e1da..214398b 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -206,6 +206,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=y

 #
+# Compile link bonding pmd library
+#
+CONFIG_RTE_LIBRTE_PMD_BOND=y
+
+#
 # Do prefetch of packet data within PMD driver receive function
 #
 CONFIG_RTE_PMD_PACKET_PREFETCH=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 5b896c3..2bf90df 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -244,6 +244,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=n

 #
+# Compile link bonding pmd library
+#
+CONFIG_RTE_LIBRTE_PMD_BOND=y
+
+#
 # Compile Xen PMD
 #
 CONFIG_RTE_LIBRTE_PMD_XENVIRT=n
diff --git a/lib/Makefile b/lib/Makefile
index c58c0c9..88e875f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -49,6 +49,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond
 DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
 DIRS-$(CONFIG_RTE_LIBRTE_ACL) += librte_acl
diff --git a/lib/librte_pmd_bond/Makefile b/lib/librte_pmd_bond/Makefile
new file mode 100644
index 000..4128f61
--- /dev/null
+++ b/lib/librte_pmd_bond/Makefile
@@ -0,0 +1,34 @@
+# 
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_bond.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_api.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_pmd.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_vargs.c
+
+
+#
+# Export include files
+#
+SYMLINK-y-include += rte_eth_bond.h
+
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_malloc
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_bond/rte_eth_bond.h 
b/lib/librte_pmd_bond/rte_eth_bond.h
new file mode 100644
index 000..7cf9dd8
--- /dev/null
+++ b/lib/librte_pmd_bond/rte_eth_bond.h
@@ -0,0 +1,255 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY

[dpdk-dev] [PATCH v8 2/6] Support for unique interface naming of pmds

2014-06-25 Thread Declan Doherty
Adding support to rte_eth_dev_data structure to support unique
name identifier for ethdevs to support adding slave ethdevs
(specifically virtual devices which have no public unique
identifier) to a link bonding device. This changes the API
rte_eth_dev_allocate() to require a const char *name when
allocating a ethdev, which also verifies that the name is
unique and hasn?t been already used by an existed allocated
rte_eth_dev. Also contains updates to virtual pmd?s to now call
the API with a name parameter.

Signed-off-by: Declan Doherty 
---
 lib/librte_ether/rte_ethdev.c|   32 +++--
 lib/librte_ether/rte_ethdev.h|7 +-
 lib/librte_pmd_pcap/rte_eth_pcap.c   |   22 ++--
 lib/librte_pmd_ring/rte_eth_ring.c   |   32 +++--
 lib/librte_pmd_ring/rte_eth_ring.h   |3 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c |2 +-
 6 files changed, 66 insertions(+), 32 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 7256841..d938603 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -65,6 +65,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "rte_ether.h"
 #include "rte_ethdev.h"
@@ -153,21 +154,40 @@ rte_eth_dev_data_alloc(void)
RTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data));
 }

+static struct rte_eth_dev *
+rte_eth_dev_allocated(const char *name)
+{
+   unsigned i;
+
+   for (i = 0; i < nb_ports; i++) {
+   if (strcmp(rte_eth_devices[i].data->name, name) == 0)
+   return &rte_eth_devices[i];
+   }
+   return NULL;
+}
+
 struct rte_eth_dev *
-rte_eth_dev_allocate(void)
+rte_eth_dev_allocate(const char *name)
 {
struct rte_eth_dev *eth_dev;

if (nb_ports == RTE_MAX_ETHPORTS) {
-   PMD_DEBUG_TRACE("Reached maximum number of ethernet ports\n");
+   PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
return NULL;
}

if (rte_eth_dev_data == NULL)
rte_eth_dev_data_alloc();

+   if (rte_eth_dev_allocated(name) != NULL) {
+   PMD_DEBUG_TRACE("Ethernet Device with name %s already 
allocated!\n");
+   return NULL;
+   }
+
eth_dev = &rte_eth_devices[nb_ports];
eth_dev->data = &rte_eth_dev_data[nb_ports];
+   rte_snprintf(eth_dev->data->name, sizeof(eth_dev->data->name),
+   "%s", name);
eth_dev->data->port_id = nb_ports++;
return eth_dev;
 }
@@ -178,11 +198,17 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
 {
struct eth_driver*eth_drv;
struct rte_eth_dev *eth_dev;
+   char ethdev_name[RTE_ETH_NAME_MAX_LEN];
+
int diag;

eth_drv = (struct eth_driver *)pci_drv;

-   eth_dev = rte_eth_dev_allocate();
+   /* Create unique Ethernet device name using PCI address */
+   rte_snprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, "%d:%d.%d",
+   pci_dev->addr.bus, pci_dev->addr.devid, 
pci_dev->addr.function);
+
+   eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 2406e45..50df654 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1497,6 +1497,8 @@ struct rte_eth_dev_sriov {
 };
 #define RTE_ETH_DEV_SRIOV(dev) ((dev)->data->sriov)

+#define RTE_ETH_NAME_MAX_LEN (32)
+
 /**
  * @internal
  * The data part, with no function pointers, associated with each ethernet 
device.
@@ -1505,6 +1507,8 @@ struct rte_eth_dev_sriov {
  * processes in a multi-process configuration.
  */
 struct rte_eth_dev_data {
+   char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
+
void **rx_queues; /**< Array of pointers to RX queues. */
void **tx_queues; /**< Array of pointers to TX queues. */
uint16_t nb_rx_queues; /**< Number of RX queues. */
@@ -1560,10 +1564,11 @@ extern uint8_t rte_eth_dev_count(void);
  * Allocates a new ethdev slot for an ethernet device and returns the pointer
  * to that slot for the driver to use.
  *
+ * @param  nameUnique identifier name for each Ethernet device
  * @return
  *   - Slot in the rte_dev_devices array for a new device;
  */
-struct rte_eth_dev *rte_eth_dev_allocate(void);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);

 struct eth_driver;
 /**
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c 
b/lib/librte_pmd_pcap/rte_eth_pcap.c
index b3dbbda..12b7e0c 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -534,7 +534,7 @@ open_tx_iface(const char *key __rte_unused, const char 
*value, void *extra_args)


 static int
-rte_pmd_init_internals(const unsigned nb_rx_queues,
+rte_pmd_init_internals(const char *name, const unsigned nb_rx_

[dpdk-dev] [PATCH v8 4/6] Link bonding Unit Tests

2014-06-25 Thread Declan Doherty
Including:
 - code to generate packet bursts for testing rx and tx
   functionality of bonded device
 - virtual/stubbed out ethdev for use as slave ethdev in testing

Signed-off-by: Declan Doherty 
---
 app/test/Makefile |4 +-
 app/test/commands.c   |7 +
 app/test/packet_burst_generator.c |  287 +++
 app/test/packet_burst_generator.h |   78 +
 app/test/test.h   |1 +
 app/test/test_link_bonding.c  | 3958 +
 app/test/virtual_pmd.c|  574 ++
 app/test/virtual_pmd.h|   74 +
 8 files changed, 4982 insertions(+), 1 deletions(-)
 create mode 100644 app/test/packet_burst_generator.c
 create mode 100644 app/test/packet_burst_generator.h
 create mode 100644 app/test/test_link_bonding.c
 create mode 100644 app/test/virtual_pmd.c
 create mode 100644 app/test/virtual_pmd.h

diff --git a/app/test/Makefile b/app/test/Makefile
index 9c52460..643f1b9 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -102,7 +102,9 @@ SRCS-$(CONFIG_RTE_APP_TEST) += test_ivshmem.c
 SRCS-$(CONFIG_RTE_APP_TEST) += test_distributor.c
 SRCS-$(CONFIG_RTE_APP_TEST) += test_distributor_perf.c
 SRCS-$(CONFIG_RTE_APP_TEST) += test_devargs.c
-
+SRCS-$(CONFIG_RTE_APP_TEST) += virtual_pmd.c
+SRCS-$(CONFIG_RTE_APP_TEST) += packet_burst_generator.c
+SRCS-$(CONFIG_RTE_APP_TEST) += test_link_bonding.c
 ifeq ($(CONFIG_RTE_APP_TEST),y)
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_acl.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
diff --git a/app/test/commands.c b/app/test/commands.c
index c9dc085..5f23420 100644
--- a/app/test/commands.c
+++ b/app/test/commands.c
@@ -159,6 +159,10 @@ static void cmd_autotest_parsed(void *parsed_result,
ret = test_timer();
if (!strcmp(res->autotest, "timer_perf_autotest"))
ret = test_timer_perf();
+#ifdef RTE_LIBRTE_PMD_BOND
+   if (!strcmp(res->autotest, "link_bonding_autotest"))
+   ret = test_link_bonding();
+#endif
if (!strcmp(res->autotest, "mempool_autotest"))
ret = test_mempool();
if (!strcmp(res->autotest, "mempool_perf_autotest"))
@@ -227,6 +231,9 @@ cmdline_parse_token_string_t cmd_autotest_autotest =
"alarm_autotest#interrupt_autotest#"
"version_autotest#eal_fs_autotest#"
"cmdline_autotest#func_reentrancy_autotest#"
+#ifdef RTE_LIBRTE_PMD_BOND
+   "link_bonding_autotest#"
+#endif
"mempool_perf_autotest#hash_perf_autotest#"
"memcpy_perf_autotest#ring_perf_autotest#"
"red_autotest#meter_autotest#sched_autotest#"
diff --git a/app/test/packet_burst_generator.c 
b/app/test/packet_burst_generator.c
new file mode 100644
index 000..5d539f1
--- /dev/null
+++ b/app/test/packet_burst_generator.c
@@ -0,0 +1,287 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+
+#include "packet_burst_generator.h"
+
+#define UDP_SRC_PORT 1024
+#define UDP_DST_PORT 1024
+
+
+#define IP_DEFTTL  64   /* from RFC 1340. */
+#define IP_VERSION 0x40
+#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
+#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
+
+static void
+copy_buf_to

[dpdk-dev] [PATCH v8 0/6] Link Bonding Library

2014-06-25 Thread Declan Doherty
This patch contains the initial release of the Link Bonding PMD Library

Supporting bonding modes:
 0 - Round Robin
 1 - Active Backup
 2 - Balance (Supporting 3 transmission polices)
layer 2, layer 2+3, layer 3+4
 3 - Broadcast

Version 8 of patch set:
This version splits the bonding library into 3 C files, containing the
PMD specific code, the argument parsing code, and the public API code


Patch Set Description:
 0001 - librte_pmd_bond + makefile changes
 0002 - librte_ether changes to support unique naming of pmds 
 0003 - librte_eal changes to support bonding device intialization
 0005 - link bonding unti test suite
 0005 - testpmd link bonding support changes
 0006 - doxygen additions

Declan Doherty (6):
  Link Bonding Library (lib/librte_pmd_bond)
  Support for unique interface naming of pmds
  EAL support for link bonding device initialization
  Link bonding Unit Tests
  testpmd link bonding additions
  Link Bonding Library doxygen additions

 app/test-pmd/cmdline.c  |  579 
 app/test-pmd/config.c   |4 +-
 app/test-pmd/parameters.c   |3 +
 app/test-pmd/testpmd.c  |   40 +-
 app/test-pmd/testpmd.h  |2 +
 app/test/Makefile   |4 +-
 app/test/commands.c |7 +
 app/test/packet_burst_generator.c   |  287 ++
 app/test/packet_burst_generator.h   |   78 +
 app/test/test.h |1 +
 app/test/test_link_bonding.c| 3958 +++
 app/test/virtual_pmd.c  |  574 
 app/test/virtual_pmd.h  |   74 +
 config/common_bsdapp|5 +
 config/common_linuxapp  |5 +
 doc/doxy-api-index.md   |1 +
 doc/doxy-api.conf   |1 +
 lib/Makefile|1 +
 lib/librte_eal/bsdapp/eal/eal.c |   10 +-
 lib/librte_eal/common/eal_common_dev.c  |   58 +-
 lib/librte_eal/common/eal_common_pci.c  |3 +
 lib/librte_eal/common/include/eal_private.h |7 -
 lib/librte_eal/common/include/rte_dev.h |   13 +-
 lib/librte_eal/linuxapp/eal/eal.c   |   11 +-
 lib/librte_ether/rte_ethdev.c   |   32 +-
 lib/librte_ether/rte_ethdev.h   |7 +-
 lib/librte_pmd_bond/Makefile|   34 +
 lib/librte_pmd_bond/rte_eth_bond.h  |  255 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c  |  670 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c  | 1228 +
 lib/librte_pmd_bond/rte_eth_bond_private.h  |  218 ++
 lib/librte_pmd_bond/rte_eth_bond_vargs.c|  255 ++
 lib/librte_pmd_pcap/rte_eth_pcap.c  |   22 +-
 lib/librte_pmd_ring/rte_eth_ring.c  |   32 +-
 lib/librte_pmd_ring/rte_eth_ring.h  |3 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c|2 +-
 mk/rte.app.mk   |5 +
 37 files changed, 8418 insertions(+), 71 deletions(-)
 create mode 100644 app/test/packet_burst_generator.c
 create mode 100644 app/test/packet_burst_generator.h
 create mode 100644 app/test/test_link_bonding.c
 create mode 100644 app/test/virtual_pmd.c
 create mode 100644 app/test/virtual_pmd.h
 create mode 100644 lib/librte_pmd_bond/Makefile
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond.h
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_api.c
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_pmd.c
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_private.h
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_vargs.c



[dpdk-dev] [PATCH v8 5/6] testpmd link bonding additions

2014-06-25 Thread Declan Doherty
 - Includes the ability to create new bonded devices.
 - Add /remove bonding slave devices.
 - Interogate bonded device stats/configuration
 - Change bonding modes and select balance transmit polices

Signed-off-by: Declan Doherty 
---
 app/test-pmd/cmdline.c|  579 +
 app/test-pmd/config.c |4 +-
 app/test-pmd/parameters.c |3 +
 app/test-pmd/testpmd.c|   40 +++-
 app/test-pmd/testpmd.h|2 +
 5 files changed, 619 insertions(+), 9 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 3298360..fcc6449 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -84,6 +84,9 @@
 #include 
 #include 
 #include 
+#ifdef RTE_LIBRTE_PMD_BOND
+#include 
+#endif

 #include "testpmd.h"

@@ -404,6 +407,31 @@ static void cmd_help_long_parsed(void *parsed_result,
"   Show the bypass configuration for a bypass enabled 
NIC"
" using the lowest port on the NIC.\n\n"
 #endif
+#ifdef RTE_LIBRTE_PMD_BOND
+   "create bonded device (mode) (socket)\n"
+   "   Create a new bonded device with specific 
bonding mode and socket.\n\n"
+
+   "add bonding slave (slave_id) (port_id)\n"
+   "   Add a slave device to a bonded device.\n\n"
+
+   "remove bonding slave (slave_id) (port_id)\n"
+   "   Remove a slave device from a bonded device.\n\n"
+
+   "set bonding mode (value) (port_id)\n"
+   "   Set the bonding mode on a bonded device.\n\n"
+
+   "set bonding primary (slave_id) (port_id)\n"
+   "   Set the primary slave for a bonded device.\n\n"
+
+   "show bonding config (port_id)\n"
+   "   Show the bonding config for port_id.\n\n"
+
+   "set bonding mac_addr (port_id) (address)\n"
+   "   Set the MAC address of a bonded device.\n\n"
+
+   "set bonding xmit_balance_policy (port_id) 
(l2|l23|l34)\n"
+   "   Set the transmit balance policy for bonded 
device running in balance mode.\n\n"
+#endif

, list_pkt_forwarding_modes()
);
@@ -3031,6 +3059,547 @@ cmdline_parse_inst_t cmd_show_bypass_config = {
 };
 #endif

+#ifdef RTE_LIBRTE_PMD_BOND
+/* *** SET BONDING MODE *** */
+struct cmd_set_bonding_mode_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t bonding;
+   cmdline_fixed_string_t mode;
+   uint8_t value;
+   uint8_t port_id;
+};
+
+static void cmd_set_bonding_mode_parsed(void *parsed_result,
+   __attribute__((unused))  struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_set_bonding_mode_result *res = parsed_result;
+   portid_t port_id = res->port_id;
+
+   /* Set the bonding mode for the relevant port. */
+   if (0 != rte_eth_bond_mode_set(port_id, res->value))
+   printf("\t Failed to set bonding mode for port = %d.\n", 
port_id);
+}
+
+cmdline_parse_token_string_t cmd_setbonding_mode_set =
+TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_mode_result,
+   set, "set");
+cmdline_parse_token_string_t cmd_setbonding_mode_bonding =
+TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_mode_result,
+   bonding, "bonding");
+cmdline_parse_token_string_t cmd_setbonding_mode_mode =
+TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_mode_result,
+   mode, "mode");
+cmdline_parse_token_num_t cmd_setbonding_mode_value =
+TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_mode_result,
+   value, UINT8);
+cmdline_parse_token_num_t cmd_setbonding_mode_port =
+TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_mode_result,
+   port_id, UINT8);
+
+cmdline_parse_inst_t cmd_set_bonding_mode = {
+   .f = cmd_set_bonding_mode_parsed,
+   .help_str = "set bonding mode (mode_value) (port_id): Set the 
bonding mode for port_id",
+   .data = NULL,
+   .tokens = {
+   (void *) &cmd_setbonding_mode_set,
+   (void *) &cmd_setbonding_mode_bonding,
+   (void *) &cmd_setbonding_mode_mode,
+   (void *) &cmd_setbonding_mode_value,
+   (void *) &cmd_setbonding_mode_port,
+   NULL
+   }
+};
+
+/* *** SET BALANCE XMIT POLICY *** */
+struct cmd_set_bonding_balance_xmit_policy_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t bonding;
+   cmdline_fixed_string_t balance_xmit_policy;
+   uint8_t port_id;
+   cmdline_fixed_string_t policy;
+};
+
+static void cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result,
+