[dpdk-dev] [PATCH v6 8/8] i40evf: support of updating/querying redirection table

2014-11-24 Thread Thomas Monjalon
Helin,

I fixed these errors before applying:

WARNING:MISSING_SPACE: break quoted strings at a space character
#134: FILE: lib/librte_pmd_i40e/i40e_ethdev_vf.c:1705:
+   "(%d) doesn't match the number of hardware can"
+   "support (%d)\n", reta_size, ETH_RSS_RETA_SIZE_64);

WARNING:MISSING_SPACE: break quoted strings at a space character
#177: FILE: lib/librte_pmd_i40e/i40e_ethdev_vf.c:1748:
+   "(%d) doesn't match the number of hardware can"
+   "support (%d)\n", reta_size, ETH_RSS_RETA_SIZE_64);

You should update your checkpatch, it checks more and more things.
It's really useful ;)

-- 
Thomas


[dpdk-dev] [PATCH] ethdev: fix doxygen comments about RSS

2014-11-24 Thread Thomas Monjalon
The parameters port_id didn't match with comments about port.

Signed-off-by: Thomas Monjalon 
---
 lib/librte_ether/rte_ethdev.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index fec4d4c..78a9d37 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3370,7 +3370,7 @@ int rte_eth_dev_bypass_wd_reset(uint8_t port);
  /**
  * Configuration of Receive Side Scaling hash computation of Ethernet device.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param rss_conf
  *   The new configuration to use for RSS hash computation on the port.
@@ -3387,7 +3387,7 @@ int rte_eth_dev_rss_hash_update(uint8_t port_id,
  * Retrieve current configuration of Receive Side Scaling hash computation
  * of Ethernet device.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param rss_conf
  *   Where to store the current RSS hash configuration of the Ethernet device.
-- 
2.1.3



[dpdk-dev] [PATCH v6 0/8] support of multiple sizes of redirection table

2014-11-24 Thread Thomas Monjalon
> > As e1000, ixgbe and i40e hardware use different sizes of redirection
> > table in PF or VF, ethdev and PMDs need to be reworked to support
> > multiple sizes of that table. In addition, commands in testpmd also
> > need to be reworked to support these changes.
> > 
> > v2 changes:
> > * Reorganized the patches.
> > * Added code style fixes.
> > * Added support of reta updating/querying in i40e VF.
> > 
> > v3 changes:
> > * Reorganized the patch set.
> > * Added returning default RX/TX configurations in VF (igb/ixgbe/i40e),
> >   as the patch set of it for PF has been accepted recently.
> > 
> > v4 changes:
> > * Renamed RTE_BIT_WIDTH_64 to RTE_RETA_GROUP_SIZE.
> > * Added more comments to rte_eth_dev_rss_reta_update() and
> >   rte_eth_dev_rss_reta_query().
> > 
> > v5 changes:
> > * Reworked the annotations of macros of RETA sizes in rte_ethdev.h.
> > 
> > v6 changes:
> > * Checking if the input number of reta size is 64 aligned has been
> >   added in rte_ethdev.c.
> > * Use macros to replace numeric in all igb, ixgbe and i40e PMDs of
> >   updating/querying reta.
> > 
> > Helin Zhang (8):
> >   app/testpmd: code style fix
> >   i40evf: code style fix
> >   i40e: support of setting hash lookup table size
> >   igb: implement ops of 'dev_infos_get' for PF and VF respectively
> >   ixgbe: implement ops of 'dev_infos_get' for PF and VF respectively
> >   i40e: rework of ops of 'dev_infos_get' for both PF and VF
> >   ethdev: support of multiple sizes of redirection table
> >   i40evf: support of updating/querying redirection table
> 
> Acked-by: Konstantin Ananyev 

Applied

Thanks
-- 
Thomas


[dpdk-dev] [PATCH] bond: fix doxygen

2014-11-24 Thread Thomas Monjalon
There is no parameter delay_ms in *_delay_get functions.

Signed-off-by: Thomas Monjalon 
---
 lib/librte_pmd_bond/rte_eth_bond.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/librte_pmd_bond/rte_eth_bond.h 
b/lib/librte_pmd_bond/rte_eth_bond.h
index 2ed4f7c..085500b 100644
--- a/lib/librte_pmd_bond/rte_eth_bond.h
+++ b/lib/librte_pmd_bond/rte_eth_bond.h
@@ -294,7 +294,6 @@ rte_eth_bond_link_down_prop_delay_set(uint8_t 
bonded_port_id, uint32_t delay_ms)
  * link when the link down status has been detected
  *
  * @param bonded_port_id   Port ID of bonded device.
- * @param delay_ms Delay period in milliseconds.
  *
  * @return
  *  Delay period on success, negative value otherwise.
@@ -320,7 +319,6 @@ rte_eth_bond_link_up_prop_delay_set(uint8_t bonded_port_id, 
uint32_t delay_ms);
  * link when the link up status has been detected
  *
  * @param bonded_port_id   Port ID of bonded device.
- * @param delay_ms Delay period in milliseconds.
  *
  * @return
  *  Delay period on success, negative value otherwise.
-- 
2.1.3



[dpdk-dev] [PATCH v8 0/7] link bonding

2014-11-24 Thread Thomas Monjalon
2014-11-24 16:33, Declan Doherty:
> v8:
> - Missing typo fix
> - Missing whitespace
> 
> v7:
> - Fixes for checkpatch issues and typo fixes
> - Removed patch "test app: adding support for generating variable sized" as 
> this
>   was already committed in commit aca4360340f169dcc11b1a9be955b44de8b9f6eb
>   
> v6:
> - Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
> - Added details to testpmd user guide for new command to set link status 
> polling interval.
> 
> v5:
> - Fix uninitialized variable in broadcast_tx_burst function which caused a
>   build error in 32-bit build
> - Address unit test issue which is exposed by new test in mode 4/5 patch sets
>  
> v4:
> - Re-based to account for changes in master.
> - Fix for rte_eth_bond_slaves_get() introduced in v3 patch set
> - Addressed issue around disabling/enabling link status polling around adding/
>   removing slaves devices.
> 
> v3 :
> - Typo fix for the bond free mbufs patch.
> - Re-based to account for changes in the mbuf patches.
> - Add support for slave devices which don't support link status interrupts 
> - Tidy up the link bonding unit test so that all tests use the new test 
> macros.
> 
> v2 :
> Addresses issues with the logic around the handling of fail transmissions.
> In this version all modes behave in a manner similar to a standard PMD,
> returning the number of successfully transmitted mbufs and with the failing
> mbufs at the end of bufs array for freeing / retransmission by the 
> application software
> 
> v1:
>   
> This patch set adds support for link status interrupt in the link bonding
> pmd. It also contains some patches to tidy up the code structure and to
> of the link bonding code and to fix bugs relating to transmission 
> failures in the under lying slave pmd which could lead to leaked mbufs. 
> 
> 
> Declan Doherty (7):
>   bond: link status interrupt support
>   bond: removing switch statement from rx burst method
>   bond: fix naming inconsistency in tx_burst_round_robin
>   bond: free mbufs if transmission fails in bonding tx_burst functions
>   testpmd: adding parameter to reconfig method to set socket_id when
> adding new port to portlist
>   bond: lsc polling support
>   bond: unit test test macro refactor

Applied with some minor fixes.

Thanks
-- 
Thomas


[dpdk-dev] [PATCH v2 1/2] lib/librte_pmd_i40e: set vlan filter fix

2014-11-24 Thread Xie, Huawei


> -Original Message-
> From: Qiu, Michael
> Sent: Monday, November 24, 2014 1:33 AM
> To: Xie, Huawei; Zhang, Helin; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 1/2] lib/librte_pmd_i40e: set vlan filter 
> fix
> 
> On 11/10/2014 2:42 PM, Xie, Huawei wrote:
> >
> >> -Original Message-
> >> From: Zhang, Helin
> >> Sent: Sunday, November 09, 2014 10:09 PM
> >> To: Xie, Huawei; dev at dpdk.org
> >> Subject: RE: [dpdk-dev] [PATCH v2 1/2] lib/librte_pmd_i40e: set vlan 
> >> filter fix
> >>
> >>
> >>
> >>> -Original Message-
> >>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Huawei Xie
> >>> Sent: Monday, November 10, 2014 10:46 AM
> >>> To: dev at dpdk.org
> >>> Subject: [dpdk-dev] [PATCH v2 1/2] lib/librte_pmd_i40e: set vlan filter 
> >>> fix
> >>>
> >>> ">> 5" rather than ">> 4"
> >>>
> >>> Signed-off-by: Huawei Xie 
> >>> ---
> >>>  lib/librte_pmd_i40e/i40e_ethdev.c | 7 ++-
> >>>  1 file changed, 2 insertions(+), 5 deletions(-)
> >>>
> >>> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> >>> b/lib/librte_pmd_i40e/i40e_ethdev.c
> >>> index 5074262..c0cf3cf 100644
> >>> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> >>> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> >>> @@ -4048,14 +4048,11 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi,  {
> >>>   uint32_t vid_idx, vid_bit;
> >>>
> >>> -#define UINT32_BIT_MASK  0x1F
> >>> -#define VALID_VLAN_BIT_MASK  0xFFF
> >>>   /* VFTA is 32-bits size array, each element contains 32 vlan bits, Find 
> >>> the
> >>>*  element first, then find the bits it belongs to
> >>>*/
> >>> - vid_idx = (uint32_t) ((vlan_id & VALID_VLAN_BIT_MASK) >>
> >>> -   sizeof(uint32_t));
> >>> - vid_bit = (uint32_t) (1 << (vlan_id & UINT32_BIT_MASK));
> >>> + vid_idx = (uint32_t) ((vlan_id >> 5 ) & 0x7F);
> 
> 
> 
> 
>No need additional space after '5'
> >>> + vid_bit = (uint32_t) (1 << (vlan_id & 0x1F));
> >> I don't understand why remove macros and use numeric instead?
> > Those macros are wrongly defined. Correct macros are defined in second
> patch.
> 
> Is there any issue to swap your patch order, and use your defined macros
> here? That would be much better if no other issue.

The first patch shows clearly what we fixes.
The second patch use MACROs for better code.
> 
> Thanks,
> Michael
> >>>   if (on)
> >>>   vsi->vfta[vid_idx] |= vid_bit;
> >>> --
> >>> 1.8.1.4
> >> Regards,
> >> Helin



[dpdk-dev] [PATCH v8 0/7] link bonding

2014-11-24 Thread Thomas Monjalon
2014-11-24 19:32, Thomas Monjalon:
> I'm fixing it for you because I'm losing confidence all bonding patches will
> be ready on time.

I've just understood what happened.
I think it's a wrong git manipulation: the fixes were squashed in the last
commit, so the patch 6/7 was still having issues.

-- 
Thomas


[dpdk-dev] [PATCH v8 0/7] link bonding

2014-11-24 Thread Thomas Monjalon
Declan,
There are still some missing spaces:

WARNING:MISSING_SPACE: break quoted strings at a space character
#2002: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1406:
+   "Invalid lsc polling interval value 
specified for bonded"
+   "device %s\n", name);
WARNING:MISSING_SPACE: break quoted strings at a space character
#2016: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1420:
+   "LSC polling interval can be specified only 
once for bonded"
+   "device %s\n", name);
WARNING:MISSING_SPACE: break quoted strings at a space character
#2040: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1444:
+   "Failed to set link up propagation 
delay (%u ms) on bonded"
+   "device %s\n", link_up_delay_ms, name);
WARNING:MISSING_SPACE: break quoted strings at a space character
#2061: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1465:
+   "Invalid link down propagation delay 
value specified for"
+   "bonded device %s\n", name);
WARNING:MISSING_SPACE: break quoted strings at a space character
#3674: FILE: app/test/test_link_bonding.c:3672:
+   "slave port (%d) mac address not set to that of 
new primary"
+   "port", test_params->slave_port_ids[i]);

I'm fixing it for you because I'm losing confidence all bonding patches will
be ready on time.
Some i40e patches won't be applied today because I spend more time on bonding.
For next release cycle, I'll have to be more strict.

Please Declan, could you be the bonding maintainer and ensure other bonding
patches (mode 4, mode 5, fixes) to come are ready and nothing will delay
their integration?
Thanks
-- 
Thomas

2014-11-24 16:33, Declan Doherty:
> v8:
> - Missing typo fix
> - Missing whitespace
> 
> v7:
> - Fixes for checkpatch issues and typo fixes
> - Removed patch "test app: adding support for generating variable sized" as 
> this
>   was already committed in commit aca4360340f169dcc11b1a9be955b44de8b9f6eb

> Declan Doherty (7):
>   bond: link status interrupt support
>   bond: removing switch statement from rx burst method
>   bond: fix naming inconsistency in tx_burst_round_robin
>   bond: free mbufs if transmission fails in bonding tx_burst functions
>   testpmd: adding parameter to reconfig method to set socket_id when
> adding new port to portlist
>   bond: lsc polling support
>   bond: unit test test macro refactor



[dpdk-dev] [PATCH v5 1/2] bond: add mode 4 support

2014-11-24 Thread Thomas Monjalon
2014-11-24 17:13, Michal Jastrzebski:
> From: Pawel Wodkowski 
> 
> Signed-off-by: Pawel Wodkowski 

As I've already requested, we need some explanations.
The minimum is to explain what is mode 4 or give inputs.
It won't be integrated without it. Wednesday is the deadline for this stuff.

> ---
>  lib/librte_ether/rte_ether.h  |1 +
>  lib/librte_pmd_bond/Makefile  |2 +
>  lib/librte_pmd_bond/rte_eth_bond.h|5 +
>  lib/librte_pmd_bond/rte_eth_bond_8023ad.c | 1218 
> +
>  lib/librte_pmd_bond/rte_eth_bond_8023ad.h |  214 
>  lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h |  308 ++
>  lib/librte_pmd_bond/rte_eth_bond_api.c|   91 +-
>  lib/librte_pmd_bond/rte_eth_bond_args.c   |1 +
>  lib/librte_pmd_bond/rte_eth_bond_pmd.c|  262 -
>  lib/librte_pmd_bond/rte_eth_bond_private.h|   31 +-

For a such big development, there are probably some interesting things to
explain about design, performance, etc.
Be proud of your work!

-- 
Thomas


[dpdk-dev] [PATCH v7 0/7] link bonding

2014-11-24 Thread Thomas Monjalon
2014-11-24 16:24, Doherty, Declan:
> Hey, sorry about that, I submitted the patchset without the typo fix. I'll 
> resubmit the patchset now.
> What version of checkpatch are you using, I don't get any warning for the 
> missing spaces for the
> version of the script with kernel 3.15 on Fedora

I use the last one (3.18-rc6).
There is now a check for common typos. It appears to be really convenient.

-- 
Thomas


[dpdk-dev] [PATCH v3] librte_pmd_af_packet: add PMD for AF_PACKET-based virtual devices

2014-11-24 Thread Thomas Monjalon
> This is a Linux-specific virtual PMD driver backed by an AF_PACKET
> socket.  This implementation uses mmap'ed ring buffers to limit copying
> and user/kernel transitions.  The PACKET_FANOUT_HASH behavior of
> AF_PACKET is used for frame reception.  In the current implementation,
> Tx and Rx queues are always paired, and therefore are always equal
> in number -- changing this would be a Simple Matter Of Programming.
> 
> Interfaces of this type are created with a command line option like
> "--vdev=eth_af_packet0,iface=...".  There are a number of options availabe
> as arguments:
> 
>  - Interface is chosen by "iface" (required)
>  - Number of queue pairs set by "qpairs" (optional, default: 1)
>  - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096)
>  - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048)
>  - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512)
> 
> Signed-off-by: John W. Linville 
> ---
> This PMD is intended to provide a means for using DPDK on a broad
> range of hardware without hardware-specific PMDs and (hopefully)
> with better performance than what PCAP offers in Linux.  This might
> be useful as a development platform for DPDK applications when
> DPDK-supported hardware is expensive or unavailable.
> 
> New in v3:
> 
> -- Adopt awkward renaming (pmd_packet -> pmd_af_packet) in hopes of
>getting something merged...

There are some remaining occurences of ETH_PACKET.
% git grep -i eth_packet | wc -l
19
% sed -ri 's,ETH_PACKET,ETH_AF_PACKET,' lib/librte_pmd_af_packet/*
I fixed it. It seems there is a hope of getting it merged :D

> New in v2:
> 
> -- fixup some style issues found by check patch
> -- use if_index as part of fanout group ID
> -- set default number of queue pairs to 1

When building on Debian, I remembered that it cannot be enabled for all kernels.
As a first step, I disabled it in default configuration.
I don't know how we could handle it better. Is it sufficient to test
availability of flags like PACKET_FANOUT_FLAG_ROLLOVER or PACKET_QDISC_BYPASS?

Applied with changes explained above.

Is it possible to improve it in coming weeks?
Thanks
-- 
Thomas


[dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

2014-11-24 Thread David Marchand
Mmm, I am not that familiar with vfio code, but I would say that there is
something buggy in pci_vfio_map_resource() when compared
to pci_uio_map_resource().
Is not there a problem with finding the right index of dev->mem_resource[]
array ?


-- 
David Marchand


On Mon, Nov 24, 2014 at 4:51 PM, Sujith Sankar (ssujith) 
wrote:

>  Hi David,
>
>  During the testing, I saw that the length field was 0.  ENIC PMD
> validates the length of the BAR against a max value.
> In order to get the length in the resource structure, I added this
> statement.
>
>  Thanks,
> -Sujith
>
>   From: David Marchand 
> Date: Monday, 24 November 2014 4:33 pm
> To: "Sujith Sankar (ssujith)" 
> Cc: "dev at dpdk.org" , "Prasad Rao (prrao)"  cisco.com>
> Subject: Re: [dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating
> ENIC PMD
>
>Hello Sujith,
>
>  On Sun, Nov 23, 2014 at 5:08 PM, Sujith Sankar  wrote:
>
>> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> index c776ddc..6bf8f2e 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> @@ -736,6 +736,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
>> maps[i].offset = reg.offset;
>> maps[i].size = reg.size;
>> dev->mem_resource[i].addr = bar_addr;
>> +   dev->mem_resource[i].len = reg.size;
>> }
>>
>> /* if secondary process, do not set up interrupts */
>>
>
>  Not sure I understand why you need to overwrite the length value.
> This is supposed to be initialised before by "generic" code.
> This looks like a hack or a workaround.
>
>  Can you elaborate on this change ?
> Thanks.
>
>
>  --
> David Marchand
>
>


[dpdk-dev] [PATCH v5 2/2] testpmd: add mode 4 support

2014-11-24 Thread Michal Jastrzebski
From: Pawel Wodkowski 

Signed-off-by: Pawel Wodkowski 
---
 app/test-pmd/cmdline.c  |   28 ++--
 app/test-pmd/csumonly.c |9 
 app/test-pmd/icmpecho.c |   21 +-
 app/test-pmd/iofwd.c|9 
 app/test-pmd/macfwd-retry.c |9 
 app/test-pmd/macfwd.c   |9 
 app/test-pmd/macswap.c  |9 
 app/test-pmd/testpmd.c  |   50 +--
 app/test-pmd/testpmd.h  |   11 --
 9 files changed, 144 insertions(+), 11 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee8c121..7e7dd36 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -41,6 +41,8 @@
 #include 
 #include 
 #include 
+
+#include "rte_eth_bond_8023ad.h"
 #ifndef __linux__
 #ifndef __FreeBSD__
 #include 
@@ -86,6 +88,7 @@
 #include 
 #ifdef RTE_LIBRTE_PMD_BOND
 #include 
+#include 
 #endif

 #include "testpmd.h"
@@ -3327,13 +3330,18 @@ static void cmd_show_bonding_config_parsed(void 
*parsed_result,
__attribute__((unused)) void *data)
 {
struct cmd_show_bonding_config_result *res = parsed_result;
+   struct rte_eth_bond_8023ad_slave_info slave_info;
+   static const char * const state_labels[] = {
+   "ACT", "TIMEOUT", "AGG", "SYNC", "COL", "DIST", "DEF", "EXP"
+   };
int bonding_mode;
uint8_t slaves[RTE_MAX_ETHPORTS];
int num_slaves, num_active_slaves;
int primary_id;
-   int i;
+   int i, j;
portid_t port_id = res->port_id;

+
/* Display the bonding mode.*/
bonding_mode = rte_eth_bond_mode_get(port_id);
if (bonding_mode < 0) {
@@ -3342,7 +3350,8 @@ static void cmd_show_bonding_config_parsed(void 
*parsed_result,
} else
printf("\tBonding mode: %d\n", bonding_mode);

-   if (bonding_mode == BONDING_MODE_BALANCE) {
+   if (bonding_mode == BONDING_MODE_BALANCE ||
+   bonding_mode == BONDING_MODE_8023AD) {
int balance_xmit_policy;

balance_xmit_policy = rte_eth_bond_xmit_policy_get(port_id);
@@ -3399,6 +3408,19 @@ static void cmd_show_bonding_config_parsed(void 
*parsed_result,

printf("%d]\n", slaves[num_active_slaves - 1]);

+   if (bonding_mode == BONDING_MODE_8023AD) {
+   for (i = 0; i < num_active_slaves; i++) {
+   rte_eth_bond_8023ad_slave_info(port_id, 
slaves[i], &slave_info);
+
+   printf("\tSlave %u state: ", slaves[i]);
+   for (j = 0; j < 8; j++) {
+   if ((slave_info.actor_state >> j) & 1)
+   printf("%s ", state_labels[j]);
+   }
+   printf("\n");
+   }
+   }
+
} else {
printf("\tActive Slaves: []\n");

@@ -3646,6 +3668,8 @@ static void cmd_create_bonded_device_parsed(void 
*parsed_result,
/* Update number of ports */
nb_ports = rte_eth_dev_count();
reconfig(port_id, res->socket);
+   /* Save bonding mode here as it is constat. */
+   ports[port_id].bond_mode = res->mode;
rte_eth_promiscuous_enable(port_id);
}

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 8d10bfd..c433eea 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -254,8 +254,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 */
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 nb_pkt_per_burst);
+#ifndef RTE_LIBRTE_PMD_BOND
if (unlikely(nb_rx == 0))
return;
+#else
+   if (unlikely(nb_rx == 0 && (fs->forward_timeout == 0 ||
+   fs->next_forward_time > rte_rdtsc(
+   return;
+
+   if (fs->forward_timeout != 0)
+   fs->next_forward_time = rte_rdtsc() + fs->forward_timeout;
+#endif

 #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c
index 7fd4b6d..b7bec9f 100644
--- a/app/test-pmd/icmpecho.c
+++ b/app/test-pmd/icmpecho.c
@@ -305,6 +305,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
uint16_t arp_pro;
uint8_t  i;
int l2_len;
+#ifdef RTE_LIBRTE_PMD_BOND
+   uint8_t force_tx_burst;
+#endif
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
uint64_t start_tsc;
uint64_t end_tsc;
@@ -320,8 +323,20 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 */
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 nb_pkt_per_burst);
+#ifndef RTE_LIBRTE_PMD_BOND
if (unlikely(nb_rx == 0))

[dpdk-dev] [PATCH v5 1/2] bond: add mode 4 support

2014-11-24 Thread Michal Jastrzebski
From: Pawel Wodkowski 

Signed-off-by: Pawel Wodkowski 
---
 lib/librte_ether/rte_ether.h  |1 +
 lib/librte_pmd_bond/Makefile  |2 +
 lib/librte_pmd_bond/rte_eth_bond.h|5 +
 lib/librte_pmd_bond/rte_eth_bond_8023ad.c | 1218 +
 lib/librte_pmd_bond/rte_eth_bond_8023ad.h |  214 
 lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h |  308 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c|   91 +-
 lib/librte_pmd_bond/rte_eth_bond_args.c   |1 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c|  262 -
 lib/librte_pmd_bond/rte_eth_bond_private.h|   31 +-
 10 files changed, 2085 insertions(+), 48 deletions(-)
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad.c
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad.h
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h

diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h
index f173509..d1d2675 100644
--- a/lib/librte_ether/rte_ether.h
+++ b/lib/librte_ether/rte_ether.h
@@ -303,6 +303,7 @@ struct vxlan_hdr {
 #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
 #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
 #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
+#define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */

 #define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr))
 /**< VXLAN tunnel header length. */
diff --git a/lib/librte_pmd_bond/Makefile b/lib/librte_pmd_bond/Makefile
index d4e10bf..cdff126 100644
--- a/lib/librte_pmd_bond/Makefile
+++ b/lib/librte_pmd_bond/Makefile
@@ -45,6 +45,7 @@ CFLAGS += $(WERROR_FLAGS)
 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_args.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_8023ad.c

 ifeq ($(CONFIG_RTE_MBUF_REFCNT),n)
 $(info WARNING: Link Bonding Broadcast mode is disabled because it needs 
MBUF_REFCNT.)
@@ -54,6 +55,7 @@ endif
 # Export include files
 #
 SYMLINK-y-include += rte_eth_bond.h
+SYMLINK-y-include += rte_eth_bond_8023ad.h

 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
diff --git a/lib/librte_pmd_bond/rte_eth_bond.h 
b/lib/librte_pmd_bond/rte_eth_bond.h
index 2ed4f7c..a9f7eea 100644
--- a/lib/librte_pmd_bond/rte_eth_bond.h
+++ b/lib/librte_pmd_bond/rte_eth_bond.h
@@ -77,6 +77,11 @@ extern "C" {
  * In this mode all transmitted packets will be transmitted on all available
  * active slaves of the bonded. */
 #endif
+#define BONDING_MODE_8023AD(4)
+/**< 802.3AD (Mode 4).
+ * In this mode transmission and reception of packets is managed by LACP
+ * protocol specified in 802.3AD documentation. */
+
 /* Balance Mode Transmit Policies */
 #define BALANCE_XMIT_POLICY_LAYER2 (0)
 /**< Layer 2 (Ethernet MAC) */
diff --git a/lib/librte_pmd_bond/rte_eth_bond_8023ad.c 
b/lib/librte_pmd_bond/rte_eth_bond_8023ad.c
new file mode 100644
index 000..14fd698
--- /dev/null
+++ b/lib/librte_pmd_bond/rte_eth_bond_8023ad.c
@@ -0,0 +1,1218 @@
+/*-
+ *   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 

[dpdk-dev] [PATCH v5 0/2] bond: mode 4 support

2014-11-24 Thread Michal Jastrzebski
From: Pawel Wodkowski 

v2 changes:
New version handles race issues with setting/cancelin callbacks,
fixes promiscus mode setting in mode 4 and some other minor errors in mode 4
implementation.

v3 changes:
This is a rework of previous patchset. Basic functionality is the same but
contain following changes:
- use one global array of slaves instead separate instance for every bonded
  device (reduce memory usage). This also allow use of port id instead of
  offsetting to current active slaves.
- make mode 4 immune to partner timings standard violation.
- fix possible buffer overflow in RX function if caller provide buffer
  that is less than received packets (additional slow packets).
- change/fix promiscus mode and MAC management.
- fix compiling issues on gcc version less than 4.5
- bring API for tunig mode 4 parameters and expose mode 4 frames structure.
- prevent console flood with warning messages if mode 4 RX/TX buffers are full.

test-pmd:
- add mode 4 support (force periodic TX if no packets received during 100ms
  period). Some forwardning modes (ex. rx only) does not allow mode 4 usage.
- 'port start X' - check if X is valid value

changes not related to mode 4:
- fix memcpy() usage in bond_ethdev_tx_burst_balance() (OOM/undfined behaviour
  if TX burst fail)

v4 changes:
- fix compilation error when building without mbuf refcnt
- testpmd: add slave state information in "show bonding config X" command
- change patch dependency to Declan Doherty v6

v5 changes
- fix compilation errors when CONFIG_RTE_LIBRTE_PMD_BOND=n

Those patches depend from Declan Doherty v8 patchset and rte alarm patches.




Pawel Wodkowski (2):
  bond: add mode 4 support
  testpmd: add mode 4 support

 app/test-pmd/cmdline.c|   28 +-
 app/test-pmd/csumonly.c   |9 +
 app/test-pmd/icmpecho.c   |   21 +-
 app/test-pmd/iofwd.c  |9 +
 app/test-pmd/macfwd-retry.c   |9 +
 app/test-pmd/macfwd.c |9 +
 app/test-pmd/macswap.c|9 +
 app/test-pmd/testpmd.c|   50 +-
 app/test-pmd/testpmd.h|   11 +-
 lib/librte_ether/rte_ether.h  |1 +
 lib/librte_pmd_bond/Makefile  |2 +
 lib/librte_pmd_bond/rte_eth_bond.h|5 +
 lib/librte_pmd_bond/rte_eth_bond_8023ad.c | 1218 +
 lib/librte_pmd_bond/rte_eth_bond_8023ad.h |  214 
 lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h |  308 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c|   91 +-
 lib/librte_pmd_bond/rte_eth_bond_args.c   |1 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c|  262 -
 lib/librte_pmd_bond/rte_eth_bond_private.h|   31 +-
 19 files changed, 2229 insertions(+), 59 deletions(-)
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad.c
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad.h
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h

-- 
1.7.9.5



[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Burakov, Anatoly
> On Mon, Nov 24, 2014 at 10:12:33AM -0600, Roger Keith Wiles wrote:
> > Burn, it is not like we are going to add a huge number of new options in the
> future and run out of letters.
> >
> No, but what about the application authors that need to accomodate all of
> the dpdk command line options as well?
> Neil

Hi Neil

I don't think that's a problem as all those parameters are separated with a --. 
I.e. ./testpmd -c f -n 2 -- . Is that not the case?

Thanks,
Anatoly


[dpdk-dev] [PATCH] app/testpmd: Added two missing commands in help

2014-11-24 Thread Thomas Monjalon
> set link-up and set link-down were not included
> in the help command.
> 
> Signed-off-by: Pablo de Lara 

Acked-by: Thomas Monjalon 

Applied

Thanks
-- 
Thomas


[dpdk-dev] [PATCH] test: fix misplaced braces in strncmp call

2014-11-24 Thread Thomas Monjalon
> > This patch fixes two occurances where a call to strncmp had the closing
> > brace in the wrong place. Changing this form:
> > if (strncmp(X,Y,sizeof(X) != 0))
> > which does a comparison of length 1, to
> > if (strncmp(X,Y,sizeof(X)) != 0)
> > which does the correct length comparison and then compares the result to
> > zero in the "if" part, as the author presumably originally intended.
> >
> > Reported-by: Larry Wang 
> > Signed-off-by: Bruce Richardson 
> 
> Nice catch!
> 
> Acked-by: Olivier Matz 

Applied

Thanks
-- 
Thomas


[dpdk-dev] [PATCH] app/test: Removed file-prefix option in eal_flags and multiprocess unit tests for FreeBSD

2014-11-24 Thread Thomas Monjalon
> eal_flags and multiprocess unit tests use --file-prefix option
> which is not supported in FreeBSD, so it has been removed
> if compiled for this OS
> 
> Signed-off-by: Pablo de Lara 

Applied

Thanks
-- 
Thomas


[dpdk-dev] [PATCH] cmdline: Fix broken functionality in FreeBSD

2014-11-24 Thread Thomas Monjalon
> > Some features of the cmdline were broken in FreeBSD as a result of
> > termios not being compiled.
> > 
> > Signed-off-by: Sergio Gonzalez Monroy 
> 
> Acked-by: Bruce Richardson 

Applied

Thanks
-- 
Thomas


[dpdk-dev] reg: dpdk on virtual machine

2014-11-24 Thread Anand Angadi
Hi friends,
I wanted to know how to install dpdk on virtual machine and how to get 
virtual intel dpdk NIC card(virthal hardware)
in virtual  machine if anybody know about it please reply me.


Regards...
Anand



[dpdk-dev] [PATCH] examples/dpdk_qat: Fix reference to old mbuf field "data"

2014-11-24 Thread Thomas Monjalon
> DPDK QAT app was using the old "data" field in mbuf,
> so it has been subtituted with rte_pktmbuf_mtod function.
> 
> Signed-off-by: Pablo de Lara 

Acked-by: Thomas Monjalon 

Commit reference 08b563ffb19 ("mbuf: replace data pointer by an offset") added.
Applied

Thanks
-- 
Thomas


[dpdk-dev] [PATCH] xenvirt: fix reference to old mbuf field

2014-11-24 Thread Thomas Monjalon
> data is not an mbuf field anymore.
> 
> Signed-off-by: Sergio Gonzalez Monroy 

Acked-by: Thomas Monjalon 

Note: git history is better with commit references in commit log.
Added "Since commit 08b563ffb19 ("mbuf: replace data pointer by an offset"),"

Applied

Thanks
-- 
Thomas


[dpdk-dev] [PATCH v3] alarms: Change alarm cancel function to be thread-safe

2014-11-24 Thread Thomas Monjalon
2014-10-01 11:12, Neil Horman:
> On Wed, Oct 01, 2014 at 03:20:22PM +0100, Pawel Wodkowski wrote:
> > v3:
> > Set rte_errno inside rte_alarm_cancel() to inform caller about canceling 
> > result.
> > 
> > v2:
> > Eliminate a race between rte_alarm_set() used in context of executing 
> > callback
> > function and other threads that use rte_alarm_cancel().
> > 
> > Signed-off-by: Pawel Wodkowski 
[...]
> Much better, thanks!
> Acked-by: Neil Horman 

Applied

Thanks
-- 
Thomas


[dpdk-dev] [PATCH 0/4] table: fix bugs occuring in corner cases

2014-11-24 Thread Thomas Monjalon
> This set of patches fixes bugs in the packet framework. Some of the
> bugs occur in corner cases (i.e. when a lookup is performed on a few
> packets or when buckets are in extended states) while others can cause
> memory to be accessed beyond what is reserved during initialization
> time.
> 
> Balazs Nemeth (4):
>   table: fix empty bucket removal during entry deletion in
> rte_table_hash_ext
>   table: fix checking extended buckets in unoptimized case
>   table: fix incorrect t->data_size_shl initialization
>   table: fix pointer calculations at initialization

Applied

Thanks
-- 
Thomas


[dpdk-dev] [PATCH v7 0/7] link bonding

2014-11-24 Thread Thomas Monjalon
Hi Declan,

There are still 2 kind of errors reported by checkpatch:
- 14 occurrences of this typo:
WARNING:TYPO_SPELLING: 'interupt' may be misspelled - perhaps 'interrupt'?
- 6 occurences of missing space:
WARNING:MISSING_SPACE: break quoted strings at a space character

Example:
#2016: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1420:
+   "LSC polling interval can be specified only 
once for bonded"
+   "device %s\n", name);
You should put a space between "bonded" and "device".

-- 
Thomas


[dpdk-dev] [PATCH v8 7/7] bond: unit test test macro refactor

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test/test_link_bonding.c   | 2576 +---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |   16 +-
 2 files changed, 1046 insertions(+), 1546 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 2411125..c040be2 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -31,6 +31,7 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+#include "unistd.h"
 #include 
 #include 
 #include 
@@ -265,7 +266,7 @@ static pthread_cond_t cvar = PTHREAD_COND_INITIALIZER;
 static int
 test_setup(void)
 {
-   int i, retval, nb_mbuf_per_pool;
+   int i, nb_mbuf_per_pool;
struct ether_addr *mac_addr = (struct ether_addr *)slave_mac;

/* Allocate ethernet packet header with space for VLAN header */
@@ -273,10 +274,8 @@ test_setup(void)
test_params->pkt_eth_hdr = malloc(sizeof(struct ether_hdr) +
sizeof(struct vlan_hdr));

-   if (test_params->pkt_eth_hdr == NULL) {
-   printf("ethernet header struct allocation failed!\n");
-   return -1;
-   }
+   TEST_ASSERT_NOT_NULL(test_params->pkt_eth_hdr,
+   "Ethernet header struct allocation failed!");
}

nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + DEF_PKT_BURST +
@@ -286,10 +285,8 @@ test_setup(void)
MBUF_SIZE, MBUF_CACHE_SIZE, sizeof(struct 
rte_pktmbuf_pool_private),
rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, 
NULL,
rte_socket_id(), 0);
-   if (test_params->mbuf_pool == NULL) {
-   printf("rte_mempool_create failed\n");
-   return -1;
-   }
+   TEST_ASSERT_NOT_NULL(test_params->mbuf_pool,
+   "rte_mempool_create failed");
}

/* Create / Initialize virtual eth devs */
@@ -303,20 +300,12 @@ test_setup(void)

test_params->slave_port_ids[i] = 
virtual_ethdev_create(pmd_name,
mac_addr, rte_socket_id(), 1);
-   if (test_params->slave_port_ids[i] < 0) {
-   printf("Failed to create virtual virtual ethdev 
%s\n", pmd_name);
-   return -1;
-   }
+   TEST_ASSERT(test_params->slave_port_ids[i] >= 0,
+   "Failed to create virtual virtual 
ethdev %s", pmd_name);

-   printf("Created virtual ethdev %s\n", pmd_name);
-
-   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1, 0);
-   if (retval != 0) {
-   printf("Failed to configure virtual ethdev 
%s\n", pmd_name);
-   return -1;
-   }
-
-   printf("Configured virtual ethdev %s\n", pmd_name);
+   TEST_ASSERT_SUCCESS(configure_ethdev(
+   test_params->slave_port_ids[i], 1, 0),
+   "Failed to configure virtual ethdev 
%s", pmd_name);
}
slaves_initialized = 1;
}
@@ -350,14 +339,14 @@ test_create_bonded_device(void)
current_slave_count = 
rte_eth_bond_slaves_get(test_params->bonded_port_id,
slaves, RTE_MAX_ETHPORTS);

-   TEST_ASSERT(current_slave_count == 0,
+   TEST_ASSERT_EQUAL(current_slave_count, 0,
"Number of slaves %d is great than expected %d.",
current_slave_count, 0);

current_slave_count = rte_eth_bond_active_slaves_get(
test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS);

-   TEST_ASSERT(current_slave_count == 0,
+   TEST_ASSERT_EQUAL(current_slave_count, 0,
"Number of active slaves %d is great than expected %d.",
current_slave_count, 0);

@@ -375,30 +364,21 @@ test_create_bonded_device_with_invalid_params(void)
/* Invalid name */
port_id = rte_eth_bond_create(NULL, test_params->bonding_mode,
rte_socket_id());
-   if (port_id >= 0) {
-   printf("Created bonded device unexpectedly.\n");
-   return -1;
-   }
+   TEST_ASSERT(port_id < 0, "Created bonded device unexpectedly");

test_params->bonding_mode = INVALID_BONDING_MODE;

/* Invalid bonding mode */
port_id = rte_eth_bond_create(BONDED_DEV_NAME, 
test_params->bonding_mode,
rte_socket_id());
-   if (port_id >= 0) {
-   printf("Created bonded device unexpectedly.\n");
-   return -1;
-   }
+ 

[dpdk-dev] [PATCH v8 6/7] bond: lsc polling support

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test-pmd/cmdline.c  |   63 +
 app/test/test.h |7 +-
 app/test/test_link_bonding.c|  265 ---
 app/test/virtual_pmd.c  |   17 +-
 app/test/virtual_pmd.h  |   48 +++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |   19 ++
 lib/librte_pmd_bond/rte_eth_bond.h  |   80 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c  |  315 ++---
 lib/librte_pmd_bond/rte_eth_bond_args.c |   28 ++-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c  |  393 ---
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +++--
 11 files changed, 958 insertions(+), 348 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index be12c13..af8f907 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -462,6 +462,9 @@ static void cmd_help_long_parsed(void *parsed_result,

"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"
+
+   "set bonding mon_period (port_id) (value)\n"
+   "   Set the bonding link status monitoring polling 
period in ms.\n\n"
 #endif

, list_pkt_forwarding_modes()
@@ -3733,6 +3736,65 @@ cmdline_parse_inst_t cmd_set_bond_mac_addr = {
}
 };

+
+/* *** SET LINK STATUS MONITORING POLLING PERIOD ON BONDED DEVICE *** */
+struct cmd_set_bond_mon_period_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t bonding;
+   cmdline_fixed_string_t mon_period;
+   uint8_t port_num;
+   uint32_t period_ms;
+};
+
+static void cmd_set_bond_mon_period_parsed(void *parsed_result,
+   __attribute__((unused))  struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_set_bond_mon_period_result *res = parsed_result;
+   int ret;
+
+   if (res->port_num >= nb_ports) {
+   printf("Port id %d must be less than %d\n", res->port_num, 
nb_ports);
+   return;
+   }
+
+   ret = rte_eth_bond_link_monitoring_set(res->port_num, res->period_ms);
+
+   /* check the return value and print it if is < 0 */
+   if (ret < 0)
+   printf("set_bond_mac_addr error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   set, "set");
+cmdline_parse_token_string_t cmd_set_bond_mon_period_bonding =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   bonding, "bonding");
+cmdline_parse_token_string_t cmd_set_bond_mon_period_mon_period =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   mon_period, "mon_period");
+cmdline_parse_token_num_t cmd_set_bond_mon_period_portnum =
+   TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   port_num, UINT8);
+cmdline_parse_token_num_t cmd_set_bond_mon_period_period_ms =
+   TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   period_ms, UINT32);
+
+cmdline_parse_inst_t cmd_set_bond_mon_period = {
+   .f = cmd_set_bond_mon_period_parsed,
+   .data = (void *) 0,
+   .help_str = "set bonding mon_period (port_id) (period_ms): ",
+   .tokens = {
+   (void *)&cmd_set_bond_mon_period_set,
+   (void *)&cmd_set_bond_mon_period_bonding,
+   (void *)&cmd_set_bond_mon_period_mon_period,
+   (void *)&cmd_set_bond_mon_period_portnum,
+   (void *)&cmd_set_bond_mon_period_period_ms,
+   NULL
+   }
+};
+
 #endif /* RTE_LIBRTE_PMD_BOND */

 /* *** SET FORWARDING MODE *** */
@@ -7787,6 +7849,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *) &cmd_create_bonded_device,
(cmdline_parse_inst_t *) &cmd_set_bond_mac_addr,
(cmdline_parse_inst_t *) &cmd_set_balance_xmit_policy,
+   (cmdline_parse_inst_t *) &cmd_set_bond_mon_period,
 #endif
(cmdline_parse_inst_t *)&cmd_vlan_offload,
(cmdline_parse_inst_t *)&cmd_vlan_tpid,
diff --git a/app/test/test.h b/app/test/test.h
index bd44a7f..d5b6951 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -62,14 +62,15 @@

 #define TEST_ASSERT_SUCCESS(val, msg, ...) do {
\
if (!(val == 0)) {  
\
-   printf("TestCas

[dpdk-dev] [PATCH v8 5/7] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist

2014-11-24 Thread Declan Doherty

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

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4c3fc76..be12c13 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3642,7 +3642,7 @@ static void cmd_create_bonded_device_parsed(void 
*parsed_result,

/* Update number of ports */
nb_ports = rte_eth_dev_count();
-   reconfig(port_id);
+   reconfig(port_id, res->socket);
rte_eth_promiscuous_enable(port_id);
}

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 12adafa..8a4190b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -630,7 +630,7 @@ init_config(void)


 void
-reconfig(portid_t new_port_id)
+reconfig(portid_t new_port_id, unsigned socket_id)
 {
struct rte_port *port;

@@ -649,6 +649,7 @@ reconfig(portid_t new_port_id)
/* set flag to initialize port/queue */
port->need_reconfig = 1;
port->need_reconfig_queues = 1;
+   port->socket_id = socket_id;

init_port_config();
 }
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9cbfeac..5a3423c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -457,7 +457,7 @@ void fwd_config_display(void);
 void rxtx_config_display(void);
 void fwd_config_setup(void);
 void set_def_fwd_config(void);
-void reconfig(portid_t new_port_id);
+void reconfig(portid_t new_port_id, unsigned socket_id);
 int init_fwd_streams(void);

 void port_mtu_set(portid_t port_id, uint16_t mtu);
-- 
1.7.4.1



[dpdk-dev] [PATCH v8 4/7] bond: free mbufs if transmission fails in bonding tx_burst functions

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test/packet_burst_generator.c  |   11 +-
 app/test/packet_burst_generator.h  |   15 +-
 app/test/test_link_bonding.c   |  435 ++--
 app/test/virtual_pmd.c |   78 +--
 app/test/virtual_pmd.h |7 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |   83 +--
 6 files changed, 551 insertions(+), 78 deletions(-)

diff --git a/app/test/packet_burst_generator.c 
b/app/test/packet_burst_generator.c
index 017139b..b2824dc 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -74,8 +74,7 @@ static inline void
 copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset)
 {
if (offset + len <= pkt->data_len) {
-   rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset,
-   buf, (size_t) len);
+   rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset, buf, 
(size_t) len);
return;
}
copy_buf_to_pkt_segs(buf, len, pkt, offset);
@@ -191,12 +190,12 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t 
src_addr,
  */
 #define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned char. */

+
 int
 generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
- struct ether_hdr *eth_hdr, uint8_t vlan_enabled,
- void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr,
- int nb_pkt_per_burst, uint8_t pkt_len,
- uint8_t nb_pkt_segs)
+   struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr,
+   uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst,
+   uint8_t pkt_len, uint8_t nb_pkt_segs)
 {
int i, nb_pkt = 0;
size_t eth_hdr_size;
diff --git a/app/test/packet_burst_generator.h 
b/app/test/packet_burst_generator.h
index fe992ac..f86589e 100644
--- a/app/test/packet_burst_generator.h
+++ b/app/test/packet_burst_generator.h
@@ -47,13 +47,13 @@ extern "C" {
 #define IPV4_ADDR(a, b, c, d)(((a & 0xff) << 24) | ((b & 0xff) << 16) | \
((c & 0xff) << 8) | (d & 0xff))

-#define PACKET_BURST_GEN_PKT_LEN 60
-#define PACKET_BURST_GEN_PKT_LEN_128 128
+#define PACKET_BURST_GEN_PKT_LEN 60
+#define PACKET_BURST_GEN_PKT_LEN_128 128
+

 void
 initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac,
- struct ether_addr *dst_mac, uint8_t vlan_enabled,
- uint16_t van_id);
+   struct ether_addr *dst_mac, uint8_t vlan_enabled, uint16_t 
van_id);

 uint16_t
 initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port,
@@ -70,10 +70,9 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t 
src_addr,

 int
 generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
- struct ether_hdr *eth_hdr, uint8_t vlan_enabled,
- void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr,
- int nb_pkt_per_burst, uint8_t pkt_len,
- uint8_t nb_pkt_segs);
+   struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr,
+   uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst,
+   uint8_t pkt_len, uint8_t nb_pkt_segs);

 #ifdef __cplusplus
 }
diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 7ecb76e..c11a0bc 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -663,6 +663,9 @@ enable_bonded_slaves(void)
int i;

for (i = 0; i < test_params->bonded_slave_count; i++) {
+   
virtual_ethdev_tx_burst_fn_set_success(test_params->slave_port_ids[i],
+   1);
+
virtual_ethdev_simulate_link_status_interrupt(
test_params->slave_port_ids[i], 1);
}
@@ -1336,12 +1339,10 @@ generate_test_burst(struct rte_mbuf **pkts_burst, 
uint16_t burst_size,
}

/* Generate burst of packets to transmit */
-   generated_burst_size =
-   generate_packet_burst(test_params->mbuf_pool,
- pkts_burst, test_params->pkt_eth_hdr,
- vlan, ip_hdr, ipv4,
- test_params->pkt_udp_hdr, burst_size,
- PACKET_BURST_GEN_PKT_LEN_128, 1);
+   generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
+   pkts_burst, test_params->pkt_eth_hdr, vlan, ip_hdr, 
ipv4,
+   test_params->pkt_udp_hdr, burst_size, 
PACKET_BURST_GEN_PKT_LEN_128,
+   1);
if (generated_burst_size != burst_size) {
printf("Failed to generate packet burst");
return -1;
@@ -1419,6 +1420,135 @@ test_roundrobin_tx_burst(void)
 }

 static int
+veri

[dpdk-dev] [PATCH v8 3/7] bond: fix naming inconsistency in tx_burst_round_robin

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c 
b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index f2fe930..6e770af 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -93,7 +93,7 @@ static uint16_t
 bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,
uint16_t nb_pkts)
 {
-   struct bond_dev_private *dev_private;
+   struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;

struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS][nb_pkts];
@@ -108,13 +108,13 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct 
rte_mbuf **bufs,
int i, cs_idx = 0;

bd_tx_q = (struct bond_tx_queue *)queue;
-   dev_private = bd_tx_q->dev_private;
+   internals = bd_tx_q->dev_private;

/* Copy slave list to protect against slave up/down changes during tx
 * bursting */
-   num_of_slaves = dev_private->active_slave_count;
-   memcpy(slaves, dev_private->active_slaves,
-   sizeof(dev_private->active_slaves[0]) * num_of_slaves);
+   num_of_slaves = internals->active_slave_count;
+   memcpy(slaves, internals->active_slaves,
+   sizeof(internals->active_slaves[0]) * num_of_slaves);

if (num_of_slaves < 1)
return num_tx_total;
-- 
1.7.4.1



[dpdk-dev] [PATCH v8 2/7] bond: removing switch statement from rx burst method

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |   65 +--
 1 files changed, 36 insertions(+), 29 deletions(-)

diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c 
b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index de0cd56..f2fe930 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -59,35 +59,38 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)

internals = bd_rx_q->dev_private;

-   switch (internals->mode) {
-   case BONDING_MODE_ROUND_ROBIN:
-#ifdef RTE_MBUF_REFCNT
-   case BONDING_MODE_BROADCAST:
-#endif
-   case BONDING_MODE_BALANCE:
-   for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
-   /* Offset of pointer to *bufs increases as packets are 
received
-* from other slaves */
-   num_rx_slave = 
rte_eth_rx_burst(internals->active_slaves[i],
-   bd_rx_q->queue_id, bufs + num_rx_total, 
nb_pkts);
-   if (num_rx_slave) {
-   num_rx_total += num_rx_slave;
-   nb_pkts -= num_rx_slave;
-   }
+
+   for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
+   /* Offset of pointer to *bufs increases as packets are received
+* from other slaves */
+   num_rx_slave = rte_eth_rx_burst(internals->active_slaves[i],
+   bd_rx_q->queue_id, bufs + num_rx_total, 
nb_pkts);
+   if (num_rx_slave) {
+   num_rx_total += num_rx_slave;
+   nb_pkts -= num_rx_slave;
}
-   break;
-   case BONDING_MODE_ACTIVE_BACKUP:
-   num_rx_slave = rte_eth_rx_burst(internals->current_primary_port,
-   bd_rx_q->queue_id, bufs, nb_pkts);
-   if (num_rx_slave)
-   num_rx_total = num_rx_slave;
-   break;
}
+
return num_rx_total;
 }

 static uint16_t
-bond_ethdev_tx_round_robin(void *queue, struct rte_mbuf **bufs,
+bond_ethdev_rx_burst_active_backup(void *queue, struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   struct bond_dev_private *internals;
+
+   /* Cast to structure, containing bonded device's port id and queue id */
+   struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue;
+
+   internals = bd_rx_q->dev_private;
+
+   return rte_eth_rx_burst(internals->current_primary_port,
+   bd_rx_q->queue_id, bufs, nb_pkts);
+}
+
+static uint16_t
+bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,
uint16_t nb_pkts)
 {
struct bond_dev_private *dev_private;
@@ -136,7 +139,7 @@ bond_ethdev_tx_round_robin(void *queue, struct rte_mbuf 
**bufs,
 }

 static uint16_t
-bond_ethdev_tx_active_backup(void *queue,
+bond_ethdev_tx_burst_active_backup(void *queue,
struct rte_mbuf **bufs, uint16_t nb_pkts)
 {
struct bond_dev_private *internals;
@@ -272,7 +275,8 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t 
slave_count, uint8_t policy)
 }

 static uint16_t
-bond_ethdev_tx_balance(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
+bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
 {
struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;
@@ -486,24 +490,27 @@ bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, int 
mode)

switch (mode) {
case BONDING_MODE_ROUND_ROBIN:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_round_robin;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_round_robin;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
case BONDING_MODE_ACTIVE_BACKUP:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_active_backup;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_active_backup;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst_active_backup;
break;
case BONDING_MODE_BALANCE:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_balance;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_balance;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
 #ifdef RTE_MBUF_REFCNT
case BONDING_MODE_BROADCAST:
eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_broadcast;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
 #endif
default:
return -1;
}

-   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
internals->mode = mode;

return 0;
-- 
1.7.4.1



[dpdk-dev] [PATCH v8 1/7] bond: link status interrupt support

2014-11-24 Thread Declan Doherty
Adding support for lsc interrupt from bonded device to link
bonding library with supporting unit tests in the test application.

Signed-off-by: Declan Doherty 
---
 app/test/test_link_bonding.c   |  213 +++-
 lib/librte_pmd_bond/rte_eth_bond_api.c |4 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |6 +
 3 files changed, 189 insertions(+), 34 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index d407e4f..7ecb76e 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -224,10 +225,15 @@ static struct rte_eth_txconf tx_conf_default = {
 };

 static int
-configure_ethdev(uint8_t port_id, uint8_t start)
+configure_ethdev(uint8_t port_id, uint8_t start, uint8_t en_isr)
 {
int q_id;

+   if (en_isr)
+   default_pmd_conf.intr_conf.lsc = 1;
+   else
+   default_pmd_conf.intr_conf.lsc = 0;
+
if (rte_eth_dev_configure(port_id, test_params->nb_rx_q,
test_params->nb_tx_q, &default_pmd_conf) != 0) {
goto error;
@@ -312,7 +318,7 @@ test_setup(void)

printf("Created virtual ethdev %s\n", pmd_name);

-   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1);
+   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1, 0);
if (retval != 0) {
printf("Failed to configure virtual ethdev 
%s\n", pmd_name);
return -1;
@@ -341,7 +347,7 @@ test_create_bonded_device(void)
TEST_ASSERT(test_params->bonded_port_id >= 0,
"Failed to create bonded ethdev %s", 
BONDED_DEV_NAME);

-   
TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),
+   
TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0, 0),
"Failed to configure bonded ethdev %s", 
BONDED_DEV_NAME);
}

@@ -1081,12 +1087,12 @@ test_set_explicit_bonded_mac(void)


 static int
-initialize_bonded_device_with_slaves(uint8_t bonding_mode,
+initialize_bonded_device_with_slaves(uint8_t bonding_mode, uint8_t bond_en_isr,
uint8_t number_of_slaves, uint8_t enable_slave)
 {
/* configure bonded device */
-   TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),
-   "Failed to configure bonding port (%d) in mode %d "
+   TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0,
+   bond_en_isr), "Failed to configure bonding port (%d) in 
mode %d "
"with (%d) slaves.", test_params->bonded_port_id, 
bonding_mode,
number_of_slaves);

@@ -1119,8 +1125,8 @@ test_adding_slave_after_bonded_device_started(void)
 {
int i;

-   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 
0) !=
-   0)
+   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 
4, 0)
+   != 0)
return -1;

/* Enabled slave devices */
@@ -1144,6 +1150,144 @@ test_adding_slave_after_bonded_device_started(void)
return remove_slaves_and_stop_bonded_device();
 }

+#define TEST_STATUS_INTERRUPT_SLAVE_COUNT  4
+#define TEST_LSC_WAIT_TIMEOUT_MS   500
+
+int test_lsc_interrupt_count;
+
+static pthread_mutex_t mutex;
+static pthread_cond_t cvar;
+
+static void
+test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,
+   enum rte_eth_event_type type  __rte_unused, void *param 
__rte_unused)
+{
+   pthread_mutex_lock(&mutex);
+   test_lsc_interrupt_count++;
+
+   pthread_cond_signal(&cvar);
+   pthread_mutex_unlock(&mutex);
+}
+
+static inline int
+lsc_timeout(int wait_us)
+{
+   int retval = 0;
+
+   struct timespec ts;
+   struct timeval tp;
+
+   gettimeofday(&tp, NULL);
+
+   /* Convert from timeval to timespec */
+   ts.tv_sec  = tp.tv_sec;
+   ts.tv_nsec = tp.tv_usec * 1000;
+   ts.tv_nsec += wait_us * 1000;
+
+   pthread_mutex_lock(&mutex);
+   if (test_lsc_interrupt_count < 1)
+   retval = pthread_cond_timedwait(&cvar, &mutex, &ts);
+
+   pthread_mutex_unlock(&mutex);
+
+   return retval;
+}
+
+static int
+test_status_interrupt(void)
+{
+   int slave_count;
+   uint8_t slaves[RTE_MAX_ETHPORTS];
+
+   pthread_mutex_init(&mutex, NULL);
+   pthread_cond_init(&cvar, NULL);
+
+   /* initialized bonding device with T slaves */
+   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 1,
+   TEST_STATUS_INTERRUPT_SLAVE_COUNT, 1) != 0)
+   return -1;
+
+   test_lsc_interrupt_count = 0;
+
+   /* register link status change interrupt ca

[dpdk-dev] [PATCH v8 0/7] link bonding

2014-11-24 Thread Declan Doherty
v8:
- Missing typo fix
- Missing whitespace

v7:
- Fixes for checkpatch issues and typo fixes
- Removed patch "test app: adding support for generating variable sized" as this
  was already committed in commit aca4360340f169dcc11b1a9be955b44de8b9f6eb

v6:
- Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
- Added details to testpmd user guide for new command to set link status 
polling interval.

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a
  build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Re-based to account for changes in master.
- Fix for rte_eth_bond_slaves_get() introduced in v3 patch set
- Addressed issue around disabling/enabling link status polling around adding/
  removing slaves devices.

v3 :
- Typo fix for the bond free mbufs patch.
- Re-based to account for changes in the mbuf patches.
- Add support for slave devices which don't support link status interrupts 
- Tidy up the link bonding unit test so that all tests use the new test macros.

v2 :
Addresses issues with the logic around the handling of fail transmissions.
In this version all modes behave in a manner similar to a standard PMD,
returning the number of successfully transmitted mbufs and with the failing
mbufs at the end of bufs array for freeing / retransmission by the 
application software

v1:

This patch set adds support for link status interrupt in the link bonding
pmd. It also contains some patches to tidy up the code structure and to
of the link bonding code and to fix bugs relating to transmission 
failures in the under lying slave pmd which could lead to leaked mbufs. 


Declan Doherty (7):
  bond: link status interrupt support
  bond: removing switch statement from rx burst method
  bond: fix naming inconsistency in tx_burst_round_robin
  bond: free mbufs if transmission fails in bonding tx_burst functions
  testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
  bond: lsc polling support
  bond: unit test test macro refactor

 app/test-pmd/cmdline.c  |   65 +-
 app/test-pmd/testpmd.c  |3 +-
 app/test-pmd/testpmd.h  |2 +-
 app/test/packet_burst_generator.c   |   11 +-
 app/test/packet_burst_generator.h   |   15 +-
 app/test/test.h |7 +-
 app/test/test_link_bonding.c| 3371 ++-
 app/test/virtual_pmd.c  |   95 +-
 app/test/virtual_pmd.h  |   53 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |   19 +
 lib/librte_pmd_bond/rte_eth_bond.h  |   80 +
 lib/librte_pmd_bond/rte_eth_bond_api.c  |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c |   28 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c  |  553 --
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
 15 files changed, 2719 insertions(+), 1973 deletions(-)

-- 
1.7.4.1



[dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

2014-11-24 Thread Sujith Sankar (ssujith)
David,

ENIC PMD needs info about BAR0 only, and vfio map routine puts it at index 0.  
So, it didn?t pose trouble.

Regards,
-Sujith

From: David Marchand mailto:david.march...@6wind.com>>
Date: Monday, 24 November 2014 9:45 pm
To: "Sujith Sankar (ssujith)" mailto:ssujith at 
cisco.com>>
Cc: "dev at dpdk.org" mailto:dev at 
dpdk.org>>, "Prasad Rao (prrao)" mailto:prrao at cisco.com>>
Subject: Re: [dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

Mmm, I am not that familiar with vfio code, but I would say that there is 
something buggy in pci_vfio_map_resource() when compared to 
pci_uio_map_resource().
Is not there a problem with finding the right index of dev->mem_resource[] 
array ?


--
David Marchand


On Mon, Nov 24, 2014 at 4:51 PM, Sujith Sankar (ssujith) mailto:ssujith at cisco.com>> wrote:
Hi David,

During the testing, I saw that the length field was 0.  ENIC PMD validates the 
length of the BAR against a max value.
In order to get the length in the resource structure, I added this statement.

Thanks,
-Sujith

From: David Marchand mailto:david.march...@6wind.com>>
Date: Monday, 24 November 2014 4:33 pm
To: "Sujith Sankar (ssujith)" mailto:ssujith at 
cisco.com>>
Cc: "dev at dpdk.org" mailto:dev at 
dpdk.org>>, "Prasad Rao (prrao)" mailto:prrao at cisco.com>>
Subject: Re: [dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

Hello Sujith,

On Sun, Nov 23, 2014 at 5:08 PM, Sujith Sankar mailto:ssujith at cisco.com>> wrote:
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
index c776ddc..6bf8f2e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
@@ -736,6 +736,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
maps[i].offset = reg.offset;
maps[i].size = reg.size;
dev->mem_resource[i].addr = bar_addr;
+   dev->mem_resource[i].len = reg.size;
}

/* if secondary process, do not set up interrupts */

Not sure I understand why you need to overwrite the length value.
This is supposed to be initialised before by "generic" code.
This looks like a hack or a workaround.

Can you elaborate on this change ?
Thanks.


--
David Marchand




[dpdk-dev] [PATCH v4 2/2] testpmd: add mode 4 support

2014-11-24 Thread Michal Jastrzebski
From: Pawel Wodkowski 


Signed-off-by: Pawel Wodkowski 
---
 app/test-pmd/cmdline.c  |   28 +++--
 app/test-pmd/csumonly.c |9 
 app/test-pmd/icmpecho.c |   17 ++-
 app/test-pmd/iofwd.c|9 
 app/test-pmd/macfwd-retry.c |9 
 app/test-pmd/macfwd.c   |9 
 app/test-pmd/macswap.c  |9 
 app/test-pmd/testpmd.c  |   48 +--
 app/test-pmd/testpmd.h  |   11 --
 9 files changed, 138 insertions(+), 11 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee8c121..7e7dd36 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -41,6 +41,8 @@
 #include 
 #include 
 #include 
+
+#include "rte_eth_bond_8023ad.h"
 #ifndef __linux__
 #ifndef __FreeBSD__
 #include 
@@ -86,6 +88,7 @@
 #include 
 #ifdef RTE_LIBRTE_PMD_BOND
 #include 
+#include 
 #endif

 #include "testpmd.h"
@@ -3327,13 +3330,18 @@ static void cmd_show_bonding_config_parsed(void 
*parsed_result,
__attribute__((unused)) void *data)
 {
struct cmd_show_bonding_config_result *res = parsed_result;
+   struct rte_eth_bond_8023ad_slave_info slave_info;
+   static const char * const state_labels[] = {
+   "ACT", "TIMEOUT", "AGG", "SYNC", "COL", "DIST", "DEF", "EXP"
+   };
int bonding_mode;
uint8_t slaves[RTE_MAX_ETHPORTS];
int num_slaves, num_active_slaves;
int primary_id;
-   int i;
+   int i, j;
portid_t port_id = res->port_id;

+
/* Display the bonding mode.*/
bonding_mode = rte_eth_bond_mode_get(port_id);
if (bonding_mode < 0) {
@@ -3342,7 +3350,8 @@ static void cmd_show_bonding_config_parsed(void 
*parsed_result,
} else
printf("\tBonding mode: %d\n", bonding_mode);

-   if (bonding_mode == BONDING_MODE_BALANCE) {
+   if (bonding_mode == BONDING_MODE_BALANCE ||
+   bonding_mode == BONDING_MODE_8023AD) {
int balance_xmit_policy;

balance_xmit_policy = rte_eth_bond_xmit_policy_get(port_id);
@@ -3399,6 +3408,19 @@ static void cmd_show_bonding_config_parsed(void 
*parsed_result,

printf("%d]\n", slaves[num_active_slaves - 1]);

+   if (bonding_mode == BONDING_MODE_8023AD) {
+   for (i = 0; i < num_active_slaves; i++) {
+   rte_eth_bond_8023ad_slave_info(port_id, 
slaves[i], &slave_info);
+
+   printf("\tSlave %u state: ", slaves[i]);
+   for (j = 0; j < 8; j++) {
+   if ((slave_info.actor_state >> j) & 1)
+   printf("%s ", state_labels[j]);
+   }
+   printf("\n");
+   }
+   }
+
} else {
printf("\tActive Slaves: []\n");

@@ -3646,6 +3668,8 @@ static void cmd_create_bonded_device_parsed(void 
*parsed_result,
/* Update number of ports */
nb_ports = rte_eth_dev_count();
reconfig(port_id, res->socket);
+   /* Save bonding mode here as it is constat. */
+   ports[port_id].bond_mode = res->mode;
rte_eth_promiscuous_enable(port_id);
}

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 8d10bfd..c433eea 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -254,8 +254,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 */
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 nb_pkt_per_burst);
+#ifndef RTE_LIBRTE_PMD_BOND
if (unlikely(nb_rx == 0))
return;
+#else
+   if (unlikely(nb_rx == 0 && (fs->forward_timeout == 0 ||
+   fs->next_forward_time > rte_rdtsc(
+   return;
+
+   if (fs->forward_timeout != 0)
+   fs->next_forward_time = rte_rdtsc() + fs->forward_timeout;
+#endif

 #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c
index 7fd4b6d..e954601 100644
--- a/app/test-pmd/icmpecho.c
+++ b/app/test-pmd/icmpecho.c
@@ -305,6 +305,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
uint16_t arp_pro;
uint8_t  i;
int l2_len;
+#if RTE_LIBRTE_PMD_BOND
+   uint8_t force_tx_burst;
+#endif
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
uint64_t start_tsc;
uint64_t end_tsc;
@@ -320,8 +323,20 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 */
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 nb_pkt_per_burst);
+#ifndef RTE_LIBRTE_PMD_BOND
if (unlikely(nb_rx == 0))

[dpdk-dev] [PATCH v4 1/2] bond: add mode 4 support

2014-11-24 Thread Michal Jastrzebski
From: Pawel Wodkowski 


Signed-off-by: Pawel Wodkowski 
---
 lib/librte_ether/rte_ether.h  |1 +
 lib/librte_pmd_bond/Makefile  |2 +
 lib/librte_pmd_bond/rte_eth_bond.h|5 +
 lib/librte_pmd_bond/rte_eth_bond_8023ad.c | 1218 +
 lib/librte_pmd_bond/rte_eth_bond_8023ad.h |  214 
 lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h |  308 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c|   91 +-
 lib/librte_pmd_bond/rte_eth_bond_args.c   |1 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c|  262 -
 lib/librte_pmd_bond/rte_eth_bond_private.h|   31 +-
 10 files changed, 2085 insertions(+), 48 deletions(-)
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad.c
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad.h
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h

diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h
index f173509..d1d2675 100644
--- a/lib/librte_ether/rte_ether.h
+++ b/lib/librte_ether/rte_ether.h
@@ -303,6 +303,7 @@ struct vxlan_hdr {
 #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
 #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
 #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
+#define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */

 #define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr))
 /**< VXLAN tunnel header length. */
diff --git a/lib/librte_pmd_bond/Makefile b/lib/librte_pmd_bond/Makefile
index d4e10bf..cdff126 100644
--- a/lib/librte_pmd_bond/Makefile
+++ b/lib/librte_pmd_bond/Makefile
@@ -45,6 +45,7 @@ CFLAGS += $(WERROR_FLAGS)
 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_args.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_8023ad.c

 ifeq ($(CONFIG_RTE_MBUF_REFCNT),n)
 $(info WARNING: Link Bonding Broadcast mode is disabled because it needs 
MBUF_REFCNT.)
@@ -54,6 +55,7 @@ endif
 # Export include files
 #
 SYMLINK-y-include += rte_eth_bond.h
+SYMLINK-y-include += rte_eth_bond_8023ad.h

 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
diff --git a/lib/librte_pmd_bond/rte_eth_bond.h 
b/lib/librte_pmd_bond/rte_eth_bond.h
index 2ed4f7c..a9f7eea 100644
--- a/lib/librte_pmd_bond/rte_eth_bond.h
+++ b/lib/librte_pmd_bond/rte_eth_bond.h
@@ -77,6 +77,11 @@ extern "C" {
  * In this mode all transmitted packets will be transmitted on all available
  * active slaves of the bonded. */
 #endif
+#define BONDING_MODE_8023AD(4)
+/**< 802.3AD (Mode 4).
+ * In this mode transmission and reception of packets is managed by LACP
+ * protocol specified in 802.3AD documentation. */
+
 /* Balance Mode Transmit Policies */
 #define BALANCE_XMIT_POLICY_LAYER2 (0)
 /**< Layer 2 (Ethernet MAC) */
diff --git a/lib/librte_pmd_bond/rte_eth_bond_8023ad.c 
b/lib/librte_pmd_bond/rte_eth_bond_8023ad.c
new file mode 100644
index 000..14fd698
--- /dev/null
+++ b/lib/librte_pmd_bond/rte_eth_bond_8023ad.c
@@ -0,0 +1,1218 @@
+/*-
+ *   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

[dpdk-dev] [PATCH v5 0/2] bond: mode 4 support

2014-11-24 Thread Michal Jastrzebski
v2 changes:
New version handles race issues with setting/cancelin callbacks,
fixes promiscus mode setting in mode 4 and some other minor errors in mode 4
implementation.

v3 changes:
This is a rework of previous patchset. Basic functionality is the same but
contain following changes:
- use one global array of slaves instead separate instance for every bonded
  device (reduce memory usage). This also allow use of port id instead of
  offsetting to current active slaves.
- make mode 4 immune to partner timings standard violation.
- fix possible buffer overflow in RX function if caller provide buffer
  that is less than received packets (additional slow packets).
- change/fix promiscus mode and MAC management.
- fix compiling issues on gcc version less than 4.5
- bring API for tunig mode 4 parameters and expose mode 4 frames structure.
- prevent console flood with warning messages if mode 4 RX/TX buffers are full.

test-pmd:
- add mode 4 support (force periodic TX if no packets received during 100ms
  period). Some forwardning modes (ex. rx only) does not allow mode 4 usage.
- 'port start X' - check if X is valid value

changes not related to mode 4:
- fix memcpy() usage in bond_ethdev_tx_burst_balance() (OOM/undfined behaviour
  if TX burst fail)

v4 changes:
- fix compilation error when building without mbuf refcnt
- testpmd: add slave state information in "show bonding config X" command
- change patch dependency to Declan Doherty v6

v5 changes
- fix compilation errors when CONFIG_RTE_LIBRTE_PMD_BOND=n

Those patches depend from Declan Doherty v7 patchset and rte alarm patches.




Pawel Wodkowski (2):
  bond: add mode 4 support
  testpmd: add mode 4 support

 app/test-pmd/cmdline.c|   28 +-
 app/test-pmd/csumonly.c   |9 +
 app/test-pmd/icmpecho.c   |   21 +-
 app/test-pmd/iofwd.c  |9 +
 app/test-pmd/macfwd-retry.c   |9 +
 app/test-pmd/macfwd.c |9 +
 app/test-pmd/macswap.c|9 +
 app/test-pmd/testpmd.c|   50 +-
 app/test-pmd/testpmd.h|   11 +-
 lib/librte_ether/rte_ether.h  |1 +
 lib/librte_pmd_bond/Makefile  |2 +
 lib/librte_pmd_bond/rte_eth_bond.h|5 +
 lib/librte_pmd_bond/rte_eth_bond_8023ad.c | 1218 +
 lib/librte_pmd_bond/rte_eth_bond_8023ad.h |  214 
 lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h |  308 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c|   91 +-
 lib/librte_pmd_bond/rte_eth_bond_args.c   |1 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c|  262 -
 lib/librte_pmd_bond/rte_eth_bond_private.h|   31 +-
 19 files changed, 2229 insertions(+), 59 deletions(-)
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad.c
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad.h
 create mode 100644 lib/librte_pmd_bond/rte_eth_bond_8023ad_private.h

-- 
1.7.9.5



[dpdk-dev] [PATCH 0/3] docs: update FreeBSD GSG for 1.8

2014-11-24 Thread Thomas Monjalon
2014-11-24 14:43, Bruce Richardson:
> On Mon, Nov 24, 2014 at 02:23:51PM +, Bruce Richardson wrote:
> > This patch set updates the FreeBSD GSG for 1.8, mainly by
> > reworking the document to have installation via the ports
> > collection as the recommended installation path. Other
> > adjustments in the set involve updating all docs to use
> > an auto-generated, rather than hard-coded date, and to have
> > the FreeBSD GSG use a fairly standard line length accross the
> > board.
> > 
> > Bruce Richardson (3):
> >   docs: change hardcoded date to auto-generated
> >   docs: adjust line lengths in FreeBSD GSG rst files
> >   docs: update FreeBSD GSG to document ports install
> >
> Hi Thomas,
> 
> is there some restriction on character encoding in emails? I see that only the
> first of my three patches made it through, and I suspect that the presence of 
> the
> (R) symbol [as in Intel(R) DPDK] may have prevented the other patches from 
> getting through.

I'm not aware of such restriction and I have no trace of your emails.
Are you sure they are not blocked earlier?

-- 
Thomas


[dpdk-dev] [PATCH v7 0/7] link bonding

2014-11-24 Thread Doherty, Declan
Hey, sorry about that, I submitted the patchset without the typo fix. I'll 
resubmit the patchset now.
What version of checkpatch are you using, I don't get any warning for the 
missing spaces for the
version of the script with kernel 3.15 on Fedora

Thanks
Declan


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Monday, November 24, 2014 3:36 PM
> To: Doherty, Declan
> Cc: dev at dpdk.org
> Subject: Re: [PATCH v7 0/7] link bonding
> 
> Hi Declan,
> 
> There are still 2 kind of errors reported by checkpatch:
> - 14 occurrences of this typo:
> WARNING:TYPO_SPELLING: 'interupt' may be misspelled - perhaps 'interrupt'?
> - 6 occurences of missing space:
> WARNING:MISSING_SPACE: break quoted strings at a space character
> 
> Example:
> #2016: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1420:
> +   "LSC polling interval can be specified only 
> once for bonded"
> +   "device %s\n", name);
> You should put a space between "bonded" and "device".
> 
> --
> Thomas


[dpdk-dev] [PATCH] eal: fix remaining checks for other 64bits architectures

2014-11-24 Thread David Marchand
RTE_ARCH_X86_64 can not be used as a way to determine if we are building for
64bits cpus. Instead, RTE_ARCH_64 should be used.

Signed-off-by: David Marchand 
---
 lib/librte_eal/linuxapp/eal/eal.c   |2 +-
 lib/librte_eal/linuxapp/eal/eal_hugepage_info.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index f9517c7..e321524 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -450,7 +450,7 @@ eal_parse_base_virtaddr(const char *arg)
return -1;

/* make sure we don't exceed 32-bit boundary on 32-bit target */
-#ifndef RTE_ARCH_X86_64
+#ifndef RTE_ARCH_64
if (addr >= UINTPTR_MAX)
return -1;
 #endif
diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c 
b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
index 73d1cdb..590cb56 100644
--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
@@ -324,7 +324,7 @@ eal_hugepage_info_init(void)
 * later they will be sorted */
hpi->num_pages[0] = 
get_num_hugepages(dirent->d_name);

-#ifndef RTE_ARCH_X86_64
+#ifndef RTE_ARCH_64
/* for 32-bit systems, limit number of 
hugepages to 1GB per page size */
hpi->num_pages[0] = RTE_MIN(hpi->num_pages[0],
RTE_PGSIZE_1G / 
hpi->hugepage_sz);
-- 
1.7.10.4



[dpdk-dev] [PATCH v3 12/14] Add eal memory support for IBM Power Architecture

2014-11-24 Thread David Marchand
Chao,

I think there are two remaining issues, in
lib/librte_eal/linuxapp/eal/eal.c
and lib/librte_eal/linuxapp/eal/eal_hugepage_info.c.
I will send a patch in reply to this patch.
I think it can be integrated into your patchset.

Thanks.

-- 
David Marchand

On Mon, Nov 24, 2014 at 2:22 AM, Chao Zhu 
wrote:

> The mmap of hugepage files on IBM Power starts from high address to low
> address. This is different from x86. This patch modified the memory
> segment detection code to get the correct memory segment layout on Power
> architecture. This patch also added a commond ARCH_PPC_64 defination for
> 64 bit systems.
>
> Signed-off-by: Chao Zhu 
> ---
>  config/defconfig_ppc_64-power8-linuxapp-gcc   |1 +
>  config/defconfig_x86_64-native-linuxapp-clang |1 +
>  config/defconfig_x86_64-native-linuxapp-gcc   |1 +
>  config/defconfig_x86_64-native-linuxapp-icc   |1 +
>  lib/librte_eal/linuxapp/eal/eal_memory.c  |   75
> ++---
>  5 files changed, 59 insertions(+), 20 deletions(-)
>
> diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc
> b/config/defconfig_ppc_64-power8-linuxapp-gcc
> index b10f60c..23a5591 100644
> --- a/config/defconfig_ppc_64-power8-linuxapp-gcc
> +++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
> @@ -35,6 +35,7 @@ CONFIG_RTE_MACHINE="power8"
>  CONFIG_RTE_ARCH="ppc_64"
>  CONFIG_RTE_ARCH_PPC_64=y
>  CONFIG_RTE_ARCH_BIG_ENDIAN=y
> +CONFIG_RTE_ARCH_64=y
>
>  CONFIG_RTE_TOOLCHAIN="gcc"
>  CONFIG_RTE_TOOLCHAIN_GCC=y
> diff --git a/config/defconfig_x86_64-native-linuxapp-clang
> b/config/defconfig_x86_64-native-linuxapp-clang
> index bbda080..5f3074e 100644
> --- a/config/defconfig_x86_64-native-linuxapp-clang
> +++ b/config/defconfig_x86_64-native-linuxapp-clang
> @@ -36,6 +36,7 @@ CONFIG_RTE_MACHINE="native"
>
>  CONFIG_RTE_ARCH="x86_64"
>  CONFIG_RTE_ARCH_X86_64=y
> +CONFIG_RTE_ARCH_64=y
>
>  CONFIG_RTE_TOOLCHAIN="clang"
>  CONFIG_RTE_TOOLCHAIN_CLANG=y
> diff --git a/config/defconfig_x86_64-native-linuxapp-gcc
> b/config/defconfig_x86_64-native-linuxapp-gcc
> index 3de818a..60baf5b 100644
> --- a/config/defconfig_x86_64-native-linuxapp-gcc
> +++ b/config/defconfig_x86_64-native-linuxapp-gcc
> @@ -36,6 +36,7 @@ CONFIG_RTE_MACHINE="native"
>
>  CONFIG_RTE_ARCH="x86_64"
>  CONFIG_RTE_ARCH_X86_64=y
> +CONFIG_RTE_ARCH_64=y
>
>  CONFIG_RTE_TOOLCHAIN="gcc"
>  CONFIG_RTE_TOOLCHAIN_GCC=y
> diff --git a/config/defconfig_x86_64-native-linuxapp-icc
> b/config/defconfig_x86_64-native-linuxapp-icc
> index 795333b..71d1e28 100644
> --- a/config/defconfig_x86_64-native-linuxapp-icc
> +++ b/config/defconfig_x86_64-native-linuxapp-icc
> @@ -36,6 +36,7 @@ CONFIG_RTE_MACHINE="native"
>
>  CONFIG_RTE_ARCH="x86_64"
>  CONFIG_RTE_ARCH_X86_64=y
> +CONFIG_RTE_ARCH_64=y
>
>  CONFIG_RTE_TOOLCHAIN="icc"
>  CONFIG_RTE_TOOLCHAIN_ICC=y
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c
> b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index f2454f4..a8e7421 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -316,11 +316,11 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl,
>  #endif
>
> hugepg_tbl[i].filepath[sizeof(hugepg_tbl[i].filepath) - 1] = '\0';
> }
> -#ifndef RTE_ARCH_X86_64
> -   /* for 32-bit systems, don't remap 1G pages, just reuse
> original
> +#ifndef RTE_ARCH_64
> +   /* for 32-bit systems, don't remap 1G and 16G pages, just
> reuse original
>  * map address as final map address.
>  */
> -   else if (hugepage_sz == RTE_PGSIZE_1G){
> +   else if ((hugepage_sz == RTE_PGSIZE_1G) || (hugepage_sz ==
> RTE_PGSIZE_16G)){
> hugepg_tbl[i].final_va = hugepg_tbl[i].orig_va;
> hugepg_tbl[i].orig_va = NULL;
> continue;
> @@ -335,9 +335,16 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl,
>  * physical block: count the number of
>  * contiguous physical pages. */
> for (j = i+1; j < hpi->num_pages[0] ; j++) {
> +#ifdef RTE_ARCH_PPC_64
> +/* The physical addresses are sorted in descending order
> on PPC64 */
> +   if (hugepg_tbl[j].physaddr !=
> +   hugepg_tbl[j-1].physaddr - hugepage_sz)
> +   break;
> +#else
> if (hugepg_tbl[j].physaddr !=
> hugepg_tbl[j-1].physaddr + hugepage_sz)
> break;
> +#endif
> }
> num_pages = j - i;
> vma_len = num_pages * hugepage_sz;
> @@ -412,11 +419,11 @@ remap_all_hugepages(struct hugepage_file
> *hugepg_tbl, struct hugepage_info *hpi)
>
> while (i < hpi->num_pages[0]) {
>
> -#ifndef RTE_ARCH_X86_64
> -   /* for 32-bit systems, don't remap

[dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

2014-11-24 Thread Sujith Sankar (ssujith)


On 24/11/14 5:03 pm, "Neil Horman"  wrote:

>On Mon, Nov 24, 2014 at 05:45:54AM +, Sujith Sankar (ssujith) wrote:
>> 
>> 
>> On 24/11/14 5:47 am, "Neil Horman"  wrote:
>> 
>> >On Sun, Nov 23, 2014 at 09:38:19PM +0530, Sujith Sankar wrote:
>> >> Signed-off-by: Sujith Sankar 
>> >> ---
>> >>  config/common_linuxapp | 5 +
>> >>  lib/Makefile   | 1 +
>> >>  lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 7 +++
>> >>  lib/librte_eal/linuxapp/eal/include/eal_pci_init.h | 1 +
>> >>  mk/rte.app.mk  | 4 
>> >>  5 files changed, 18 insertions(+)
>> >> 
>> >> diff --git a/config/common_linuxapp b/config/common_linuxapp
>> >> index 57b61c9..3c091e7 100644
>> >> --- a/config/common_linuxapp
>> >> +++ b/config/common_linuxapp
>> >> @@ -210,6 +210,11 @@ CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM=4
>> >>  CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
>> >>  
>> >>  #
>> >> +# Compile burst-oriented Cisco ENIC PMD driver
>> >> +#
>> >> +CONFIG_RTE_LIBRTE_ENIC_PMD=y
>> >> +
>> >> +#
>> >>  # Compile burst-oriented VIRTIO PMD driver
>> >>  #
>> >>  CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
>> >> diff --git a/lib/Makefile b/lib/Makefile
>> >> index e3237ff..1911790 100644
>> >> --- a/lib/Makefile
>> >> +++ b/lib/Makefile
>> >> @@ -43,6 +43,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
>> >>  DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
>> >>  DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += librte_pmd_e1000
>> >>  DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_ixgbe
>> >> +DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_enic
>> >>  DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e
>> >>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond
>> >>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring
>> >> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> >>b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> >> index c776ddc..6bf8f2e 100644
>> >> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> >> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> >> @@ -736,6 +736,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
>> >>   maps[i].offset = reg.offset;
>> >>   maps[i].size = reg.size;
>> >>   dev->mem_resource[i].addr = bar_addr;
>> >> + dev->mem_resource[i].len = reg.size;
>> >>   }
>> >>  
>> >>   /* if secondary process, do not set up interrupts */
>> >> @@ -791,4 +792,10 @@ pci_vfio_is_enabled(void)
>> >>  {
>> >>   return vfio_cfg.vfio_enabled;
>> >>  }
>> >> +
>> >> +int
>> >> +pci_vfio_container_fd(void)
>> >> +{
>> >> + return vfio_cfg.vfio_container_fd;
>> >> +}
>> >You should move this function definition to a separate patch and put it
>> >earlier
>> >in the series, as you call this function two patches back.
>> 
>> Thanks for the comment, Neil.  I shall move this to a separate patch and
>> put it earlier in the series.
>> 
>> >
>> >Also, this gives me pause, as it seems like you're working around the
>> >VFIO api.
>> >From what I see, you just use this to get an fd that you can use in an
>> >ioctl to
>> >set some DMA settings.  First off, theres already a function called
>> >pci_vfio_get_container_fd, which does exactly what you are doing here,
>> >with
>> >additional safety checking.
>> >
>> >However, even though there is an existing function to do what you
>>want, I
>> >would
>> >recommend that you not use it for your purposes.  Whenever you expose
>> >something
>> >like a file descriptor, you run the risk of multiple accessors racing
>> >trying to
>> >set/unset features and preform operations.  It would be better if you
>> >could add
>> >apropriate api calls to vfio interface to set what you want.  That way
>>the
>> >library can add appropriate locking if/when needed
>> 
>> 
>> I see that vfio_cfg.vfio_container_fd is obtained and stored in
>> pci_vfio_enable(), and this is not modified later.
>> ENIC PMD needs it to add the IOMMU mapping for buffers used for
>> communicating with adapter firmware.  That?s just adding an entry, and
>> container fd is just passed as an argument.  So the following addition
>>in
>> eal_pci_vfio.c should be sufficient.  Since vfio_cfg is per process, I
>>do
>> not think that any other checking is required.
>> 
>> int
>> pci_vfio_map_dma(struct vfio_iommu_type1_dma_map *dma_map)
>> {
>>  return ioctl(vfio_cfg.vfio_container_fd, VFIO_IOMMU_MAP_DMA, dma_map);
>> }
>> 
>> 
>> 
>> Does this look alright?  Do you think that I?ve missed out anything
>>here?
>> 
>It looks better yes, but I'm still confused as to why its necessecary.
>Looking
>back at your use of the fd, you're adding an iov entry for a buffer
>allocated
>via rte_memzone_reserve, which should come out of the dpdk's configured
>memory.
>In pci_vfio_setup_dma_maps, which is part of the pci probe path in eal
>library,
>all of the DPDK's physically available memory is already mapped into the
>iommu
>in a 1:1 fashion.  So why do you need to do this again?

Yes, ideally 

[dpdk-dev] [PATCH v3 00/14] Patches for DPDK to support Power architecture

2014-11-24 Thread David Marchand
Hello Chao,

On Mon, Nov 24, 2014 at 2:22 AM, Chao Zhu 
wrote:

> The set of patches add IBM Power architecture to the DPDK. It adds the
> required support to the
> EAL library. This set of patches doesn't support full DPDK function on
> Power processors. So a
> separate common configuration file is used for Power to turn off some
> un-migrated functions. To
> compile on PPC64 architecture, GCC version >= 4.8 must be used. This v3
> patch updates eal_memory.c
> to fix the memory zone allocation and also solves the compiling problems
> of test-pmd.
>

Please run a little checkpath on this patchset.
There are some issues.

Thanks.

-- 
David Marchand


[dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

2014-11-24 Thread Sujith Sankar (ssujith)
Hi David,

During the testing, I saw that the length field was 0.  ENIC PMD validates the 
length of the BAR against a max value.
In order to get the length in the resource structure, I added this statement.

Thanks,
-Sujith

From: David Marchand mailto:david.march...@6wind.com>>
Date: Monday, 24 November 2014 4:33 pm
To: "Sujith Sankar (ssujith)" mailto:ssujith at 
cisco.com>>
Cc: "dev at dpdk.org" mailto:dev at 
dpdk.org>>, "Prasad Rao (prrao)" mailto:prrao at cisco.com>>
Subject: Re: [dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

Hello Sujith,

On Sun, Nov 23, 2014 at 5:08 PM, Sujith Sankar mailto:ssujith at cisco.com>> wrote:
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
index c776ddc..6bf8f2e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
@@ -736,6 +736,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
maps[i].offset = reg.offset;
maps[i].size = reg.size;
dev->mem_resource[i].addr = bar_addr;
+   dev->mem_resource[i].len = reg.size;
}

/* if secondary process, do not set up interrupts */

Not sure I understand why you need to overwrite the length value.
This is supposed to be initialised before by "generic" code.
This looks like a hack or a workaround.

Can you elaborate on this change ?
Thanks.


--
David Marchand



[dpdk-dev] [PATCH 3/3] docs: update FreeBSD GSG to document ports install

2014-11-24 Thread Bruce Richardson
Since the DPDK is now part of the BSD ports collection, we should
recommend installing from ports as the best way to get it up and
running.
In order to achieve this, while still keeping the document readable, the
chapter on system requirements has been moved to instead be a section
within the chapter on compiling the DPDK outside of the ports
collection. This move is necessary, since it covered a lot of detail on
installing other ports required to build DPDK. These steps are not
needed when installing DPDK itself from ports.

Signed-off-by: Bruce Richardson 
---
 doc/guides/freebsd_gsg/build_dpdk.rst | 243 +++---
 doc/guides/freebsd_gsg/build_sample_apps.rst  |  24 ++-
 doc/guides/freebsd_gsg/index.rst  |   2 +-
 doc/guides/freebsd_gsg/install_from_ports.rst | 162 +
 doc/guides/freebsd_gsg/intro.rst  |  13 +-
 doc/guides/freebsd_gsg/sys_reqs.rst   | 164 -
 6 files changed, 366 insertions(+), 242 deletions(-)
 create mode 100644 doc/guides/freebsd_gsg/install_from_ports.rst
 delete mode 100644 doc/guides/freebsd_gsg/sys_reqs.rst

diff --git a/doc/guides/freebsd_gsg/build_dpdk.rst 
b/doc/guides/freebsd_gsg/build_dpdk.rst
index 8f72a5e..5fdab44 100644
--- a/doc/guides/freebsd_gsg/build_dpdk.rst
+++ b/doc/guides/freebsd_gsg/build_dpdk.rst
@@ -28,9 +28,92 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+.. _building_from_source:
+
 Compiling the Intel? DPDK Target from Source
 

+.. note::
+
+Testing has been performed using FreeBSD* 10.0-RELEASE (x86_64) and 
requires the
+installation of the kernel sources, which should be included during the
+installation of FreeBSD*.   The Intel? DPDK also requires the use of 
FreeBSD*
+ports to compile and function.
+
+System Requirements
+---
+
+The Intel? DPDK and its applications require the GNU make system (gmake)
+to build on FreeBSD*. Optionally, gcc may also be used in place of clang
+to build the Intel? DPDK, in which case it too must be installed prior to
+compiling the Intel? DPDK. The installation of these tools is covered in this
+section.
+
+Compiling the Intel? DPDK requires the FreeBSD kernel sources, which should be
+included during the installation of FreeBSD* on the development platform.
+The Intel? DPDK also requires the use of FreeBSD* ports to compile and 
function.
+
+To use the FreeBSD* ports system, it is required to update and extract the 
FreeBSD*
+ports tree by issuing the following commands:
+
+.. code-block:: console
+
+root at host:~ # portsnap fetch
+root at host:~ # portsnap extract
+
+If the environment requires proxies for external communication, these can be 
set
+using:
+
+.. code-block:: console
+
+root at host:~ # setenv http_proxy :
+root at host:~ # setenv ftp_proxy :
+
+The FreeBSD* ports below need to be installed prior to building the Intel? 
DPDK.
+In general these can be installed using the following set of commands:
+
+#.  cd /usr/ports/
+
+#.  make config-recursive
+
+#.  make install
+
+#.  make clean
+
+Each port location can be found using:
+
+.. code-block:: console
+
+user at host:~ # whereis 
+
+The ports required and their locations are as follows:
+
+dialog4ports
+   /usr/ports/ports-mgmt/dialog4ports
+
+GNU make(gmake)
+   /usr/ports/devel/gmake
+
+coreutils
+   /usr/ports/sysutils/coreutils
+
+For compiling and using the Intel? DPDK with gcc, it too must be installed
+from the ports collection:
+
+gcc: version 4.8 is recommended
+   /usr/ports/lang/gcc48
+   (Ensure that CPU_OPTS is selected (default is OFF))
+
+When running the make config-recursive command, a dialog may be presented to 
the
+user. For the installation of the Intel? DPDK, the default options were used.
+
+.. note::
+
+To avoid multiple dialogs being presented to the user during make install,
+it is advisable before running the make install command to re-run the
+make config -recursive command until no more dialogs are seen.
+
+
 Install the Intel? DPDK and Browse Sources
 --

@@ -68,7 +151,7 @@ Where:

 *   EXECENV is: bsdapp

-*   TOOLCHAIN is: gcc
+*   TOOLCHAIN is: gcc | clang

 The configuration files for the Intel? DPDK targets can be found in the 
DPDK/config
 directory in the form of:
@@ -85,26 +168,20 @@ directory in the form of:
 on which it is built.  For more information on this setting, and its
 possible values, see the *Intel? DPDK Programmers Guide*.

-To install and make the target, use gmake install T= CC=gcc48.
+To install and make the target, use "gmake install T=".

 For example to compile for FreeBSD* use:

 .. code-block:: console

-gmake install T=x86_64-native-bsdapp-gcc CC=gcc48
-
-To prepare a target without building it, for example, if the configuration
-changes need to be 

[dpdk-dev] [PATCH 2/3] docs: adjust line lengths in FreeBSD GSG rst files

2014-11-24 Thread Bruce Richardson
The FreeBSD GSG rst files had very inconsistent line lengths for text
within paragraph blocks. Sometimes a line would be very short, while often
lines would be quite long.
This patch adjusts the formatting of the rst files so that lines break
at approx the 80-character mark, as is standard in the DPDK source code.

Signed-off-by: Bruce Richardson 
---
 doc/guides/freebsd_gsg/build_dpdk.rst| 110 +++
 doc/guides/freebsd_gsg/build_sample_apps.rst |  80 ++-
 doc/guides/freebsd_gsg/intro.rst |  44 ++-
 doc/guides/freebsd_gsg/sys_reqs.rst  |  47 ++--
 4 files changed, 157 insertions(+), 124 deletions(-)

diff --git a/doc/guides/freebsd_gsg/build_dpdk.rst 
b/doc/guides/freebsd_gsg/build_dpdk.rst
index 9b78840..8f72a5e 100644
--- a/doc/guides/freebsd_gsg/build_dpdk.rst
+++ b/doc/guides/freebsd_gsg/build_dpdk.rst
@@ -70,7 +70,8 @@ Where:

 *   TOOLCHAIN is: gcc

-The configuration files for the Intel? DPDK targets can be found in the 
DPDK/config directory in the form of:
+The configuration files for the Intel? DPDK targets can be found in the 
DPDK/config
+directory in the form of:

 ::

@@ -79,10 +80,10 @@ The configuration files for the Intel? DPDK targets can be 
found in the DPDK/co
 .. note::

 Configuration files are provided with the RTE_MACHINE optimization level 
set.
-Within the configuration files, the RTE_MACHINE configuration value is set 
to native,
-which means that the compiled software is tuned for the platform on which 
it is built.
-For more information on this setting, and its possible values,
-see the *Intel? DPDK Programmers Guide*.
+Within the configuration files, the RTE_MACHINE configuration value is set
+to native, which means that the compiled software is tuned for the platform
+on which it is built.  For more information on this setting, and its
+possible values, see the *Intel? DPDK Programmers Guide*.

 To install and make the target, use gmake install T= CC=gcc48.

@@ -92,9 +93,8 @@ For example to compile for FreeBSD* use:

 gmake install T=x86_64-native-bsdapp-gcc CC=gcc48

-To prepare a target without building it, for example,
-if the configuration changes need to be made before compilation,
-use the gmake config T= command:
+To prepare a target without building it, for example, if the configuration
+changes need to be made before compilation, use the gmake config T= 
command:

 .. code-block:: console

@@ -106,13 +106,14 @@ To build after configuration, change directory to 
./x86_64-native-bsdapp-gcc and

 gmake CC=gcc48

-Browsing the Installed Intel?DPDK Environment Target
-
+Browsing the Installed Intel? DPDK Environment Target
+-

-Once a target is created, it contains all the libraries
-and header files for the Intel? DPDK environment that are required to build 
customer applications.
-In addition, the test and testpmd applications are built under the build/app 
directory, which may be used for testing.
-A kmod directory is also present that contains the kernel modules to install:
+Once a target is created, it contains all the libraries and header files for 
the
+Intel? DPDK environment that are required to build customer applications.
+In addition, the test and testpmd applications are built under the build/app
+directory, which may be used for testing.  A kmod directory is also present 
that
+contains the kernel modules to install:

 .. code-block:: console

@@ -122,17 +123,19 @@ A kmod directory is also present that contains the kernel 
modules to install:
 Loading the Intel? DPDK contigmem Module
 

-To run any Intel? DPDK application, the contigmem module must be loaded into 
the running kernel.
-The module is found in the kmod sub-directory of the Intel? DPDK target 
directory.
-The module can be loaded using kldload (assuming that the current directory is 
the Intel? DPDK target directory):
+To run any Intel? DPDK application, the contigmem module must be loaded into 
the
+running kernel. The module is found in the kmod sub-directory of the Intel? 
DPDK
+target directory. The module can be loaded using kldload (assuming that the
+current directory is the Intel? DPDK target directory):

 .. code-block:: console

 kldload ./kmod/contigmem.ko

-It is advisable to include the loading of the contigmem module during the boot 
process to avoid issues
-with potential memory fragmentation during later system up time.
-This can be achieved by copying the module to the /boot/kernel/ directory and 
placing the following into /boot/loader.conf:
+It is advisable to include the loading of the contigmem module during the boot
+process to avoid issues with potential memory fragmentation during later system
+up time.  This can be achieved by copying the module to the /boot/kernel/
+directory and placing the followin

[dpdk-dev] [PATCH 0/3] docs: update FreeBSD GSG for 1.8

2014-11-24 Thread Bruce Richardson
On Mon, Nov 24, 2014 at 04:25:05PM +0100, Thomas Monjalon wrote:
> 2014-11-24 14:43, Bruce Richardson:
> > On Mon, Nov 24, 2014 at 02:23:51PM +, Bruce Richardson wrote:
> > > This patch set updates the FreeBSD GSG for 1.8, mainly by
> > > reworking the document to have installation via the ports
> > > collection as the recommended installation path. Other
> > > adjustments in the set involve updating all docs to use
> > > an auto-generated, rather than hard-coded date, and to have
> > > the FreeBSD GSG use a fairly standard line length accross the
> > > board.
> > > 
> > > Bruce Richardson (3):
> > >   docs: change hardcoded date to auto-generated
> > >   docs: adjust line lengths in FreeBSD GSG rst files
> > >   docs: update FreeBSD GSG to document ports install
> > >
> > Hi Thomas,
> > 
> > is there some restriction on character encoding in emails? I see that only 
> > the
> > first of my three patches made it through, and I suspect that the presence 
> > of the
> > (R) symbol [as in Intel(R) DPDK] may have prevented the other patches from 
> > getting through.
> 
> I'm not aware of such restriction and I have no trace of your emails.
> Are you sure they are not blocked earlier?
>
They could be, I'll check it out.

/Bruce


[dpdk-dev] [PATCH 0/3] docs: update FreeBSD GSG for 1.8

2014-11-24 Thread Bruce Richardson
On Mon, Nov 24, 2014 at 02:23:51PM +, Bruce Richardson wrote:
> This patch set updates the FreeBSD GSG for 1.8, mainly by
> reworking the document to have installation via the ports
> collection as the recommended installation path. Other
> adjustments in the set involve updating all docs to use
> an auto-generated, rather than hard-coded date, and to have
> the FreeBSD GSG use a fairly standard line length accross the
> board.
> 
> Bruce Richardson (3):
>   docs: change hardcoded date to auto-generated
>   docs: adjust line lengths in FreeBSD GSG rst files
>   docs: update FreeBSD GSG to document ports install
>
Hi Thomas,

is there some restriction on character encoding in emails? I see that only the
first of my three patches made it through, and I suspect that the presence of 
the
(R) symbol [as in Intel(R) DPDK] may have prevented the other patches from 
getting through.

/Bruce


[dpdk-dev] [PATCH 1/3] docs: change hardcoded date to auto-generated

2014-11-24 Thread Bruce Richardson
The index.html file for each of the "guide" docs had a hard-coded
date value in them of June 2014. Rather than update each of these
for each revision, just use the |today| directive to insert the date
at which the document was generated.

Signed-off-by: Bruce Richardson 
---
 doc/guides/freebsd_gsg/index.rst| 2 +-
 doc/guides/linux_gsg/index.rst  | 2 +-
 doc/guides/prog_guide/index.rst | 2 +-
 doc/guides/rel_notes/index.rst  | 2 +-
 doc/guides/sample_app_ug/index.rst  | 2 +-
 doc/guides/testpmd_app_ug/index.rst | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/guides/freebsd_gsg/index.rst b/doc/guides/freebsd_gsg/index.rst
index da5be85..90915a8 100644
--- a/doc/guides/freebsd_gsg/index.rst
+++ b/doc/guides/freebsd_gsg/index.rst
@@ -31,7 +31,7 @@
 Getting Started Guide for FreeBSD
 =

-June 2014
+|today|

 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS.
 NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL 
PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT.
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 11ee387..d4b7c97 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -31,7 +31,7 @@
 Getting Started Guide
 =

-June 2014
+|today|

 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS.
 NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL 
PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT.
diff --git a/doc/guides/prog_guide/index.rst b/doc/guides/prog_guide/index.rst
index e0ac8f4..78016d7 100644
--- a/doc/guides/prog_guide/index.rst
+++ b/doc/guides/prog_guide/index.rst
@@ -31,7 +31,7 @@
 Programmer's Guide
 ==

-June 2014
+|today|


 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO 
LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE,
diff --git a/doc/guides/rel_notes/index.rst b/doc/guides/rel_notes/index.rst
index 347f67b..e9a3d21 100644
--- a/doc/guides/rel_notes/index.rst
+++ b/doc/guides/rel_notes/index.rst
@@ -33,7 +33,7 @@ Release Notes

 Package Version: 1.7

-June 2014
+|today|

 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS.
 NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL 
PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT.
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index ad2ca28..7555bce 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -31,7 +31,7 @@
 Sample Applications User Guide
 ==

-June 2014
+|today|

 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS.
 NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL 
PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT.
diff --git a/doc/guides/testpmd_app_ug/index.rst 
b/doc/guides/testpmd_app_ug/index.rst
index e89fad6..d1ad182 100644
--- a/doc/guides/testpmd_app_ug/index.rst
+++ b/doc/guides/testpmd_app_ug/index.rst
@@ -31,7 +31,7 @@
 Testpmd Application User Guide
 ==

-June 2014
+|today|

 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS.
 NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL 
PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT.
-- 
1.9.3



[dpdk-dev] [PATCH 0/3] docs: update FreeBSD GSG for 1.8

2014-11-24 Thread Bruce Richardson
This patch set updates the FreeBSD GSG for 1.8, mainly by
reworking the document to have installation via the ports
collection as the recommended installation path. Other
adjustments in the set involve updating all docs to use
an auto-generated, rather than hard-coded date, and to have
the FreeBSD GSG use a fairly standard line length accross the
board.

Bruce Richardson (3):
  docs: change hardcoded date to auto-generated
  docs: adjust line lengths in FreeBSD GSG rst files
  docs: update FreeBSD GSG to document ports install

 doc/guides/freebsd_gsg/build_dpdk.rst | 295 ++
 doc/guides/freebsd_gsg/build_sample_apps.rst  |  94 
 doc/guides/freebsd_gsg/index.rst  |   4 +-
 doc/guides/freebsd_gsg/install_from_ports.rst | 162 ++
 doc/guides/freebsd_gsg/intro.rst  |  55 +++--
 doc/guides/freebsd_gsg/sys_reqs.rst   | 163 --
 doc/guides/linux_gsg/index.rst|   2 +-
 doc/guides/prog_guide/index.rst   |   2 +-
 doc/guides/rel_notes/index.rst|   2 +-
 doc/guides/sample_app_ug/index.rst|   2 +-
 doc/guides/testpmd_app_ug/index.rst   |   2 +-
 11 files changed, 470 insertions(+), 313 deletions(-)
 create mode 100644 doc/guides/freebsd_gsg/install_from_ports.rst
 delete mode 100644 doc/guides/freebsd_gsg/sys_reqs.rst

-- 
1.9.3



[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Thomas Monjalon
Hi Bruce and Neil,

2014-11-24 11:28, Bruce Richardson:
> On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
> > On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
> > > From: Didier Pallard 
> > > 
> > > In current version, used cores can only be specified using a bitmask.
> > > It will now be possible to specify cores in 2 different ways:
> > > - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
> > > - Using a list in following format: -l [-c2][,c3[-c4],...]
> > > 
> > > The letter -l can stand for lcore or list.
> > > 
> > > -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
> > 
> > Do you want to burn an option letter on that?  It seems like it might be 
> > better
> > to search the string for 0x and base the selection of bitmap of list parsing
> > based on its presence or absence.

It was the initial proposal (in April):
http://dpdk.org/ml/archives/dev/2014-April/002173.html
And I liked keeping only 1 option;
http://dpdk.org/ml/archives/dev/2014-May/002722.html
But Anatoly raised the compatibility problem:
http://dpdk.org/ml/archives/dev/2014-May/002723.html
Then there was no other comment so Didier and I reworked a separate option. 

> The existing coremask parsing always assumes a hex coremask, so just looking
> for a 0x will not work. I prefer this scheme of using a new flag for this 
> method
> of specifying the cores to use. 
> 
> If you don't want to use up a single-letter option, two alternatives:
> 1) use a long option instead.
> 2) if the -c parameter includes a "-" or a ",", treat it as a new-style 
> option,
> otherwise treat as old. The only abiguity here would be for specifying a 
> single
> core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to run 
> on.
> [0 is obviously a named core as it's an invalid mask, and A-F are obviously
> masks.] If we did want this scheme, I would suggest that we allow trailing
> commas in the list specifier, so we can force users to clear ambiguity by
> either writing "0x6" or "6," i.e. disallow ambiguous values to avoid problems.
> However, this is probably more work that it's worth to avoid using up a letter
> option.
> 
> I'd prefer any of these options to breaking backward compatibility in this 
> case.

We need a consensus here.
Who is supporting a "burn" of an one-letter option with clear usage?
Who is supporting a "re-merge" of the 2 syntaxes with more complicated rules
(list syntax is triggered by presence of "-" or ",")? 

Please vote quickly.
Thanks
-- 
Thomas


[dpdk-dev] bifurcated driver

2014-11-24 Thread Zhou, Danny
Hope summary below could answer your questions.

From: lukego at gmail.com [mailto:luk...@gmail.com] On Behalf Of Luke Gorrie
Sent: Monday, November 24, 2014 7:58 PM
To: Thomas Monjalon
Cc: Zhou, Danny; dev at dpdk.org; Fastabend, John R
Subject: Re: [dpdk-dev] bifurcated driver

On 5 November 2014 at 14:00, Thomas Monjalon mailto:thomas.monjalon at 6wind.com>> wrote:
It seems to be close to the bifurcated driver needs.
Not sure if it can solve the security issues if there is no dedicated MMU
in the NIC.

I feel we should sum up pros and cons of
- igb_uio
- uio_pci_generic
- VFIO
- ibverbs
- bifurcated driver

I am also curious about the pros and cons of the bifurcated driver compared 
with SR-IOV.
DZ: I have a slide to compare all of them except for ibverbs, but system does 
not allows me to paste a captured picture. I can send it to you in a separated 
email.

What are the practical differences between running a bifurcated driver vs. 
running SR-IOV mode where the kernel owns the PF and userspace applications own 
the VFs?
DZ: SRIOV can be treated as a rx/tx queue partition approach following PCIe 
spec, but it diffs from bifurcated driver from as illustrated below:

a)  On ixgbe, each VF can only have at maximum two rx/tx qpairs, while 
bifurcated driver supports allocating multiple rx/tx qpairs per user space 
request.

b)  Each PF/VF has a dedicated MAC address and/or VLAN ID, and L2 switch 
inside a NIC distributes packets to PF/VF based on MAC address or VLAN ID. 
While bifurcated driver

builds on top of in_NIC flow director which allows up-to 8K L3/L4 filters (e.g. 
5-tuple to rx queue), rather than fixed L2 filter, to distribute traffics to 
either kernel or user space.

c)   VF does not have dedicated flow director.

Specifically, could I run the ixgbe driver in the kernel (max_vfs=N), control 
it via ethtool, and then access the queues via userspace VF drivers? If so, how 
would this differ from the bifurcated driver?
DZ: Yes you can do this. But L3/L4 filters you setup to PF (VF does not support 
it) via ethtool to flow director takes no effect if the packet?s DMAC matches a 
VF? MAC, as the packet will be distributed by L2 switch to the VF that rx queue 
belongs to. Ixgbe does not support per-VF flow director that allows you setup 
filters distributing packet to two rx queue inside a VF.

Cheers,
-Luke




[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Burakov, Anatoly
> > > > Do you want to burn an option letter on that?  It seems like it
> > > > might be better to search the string for 0x and base the selection
> > > > of bitmap of list parsing based on its presence or absence.
> >
> > It was the initial proposal (in April):
> > http://dpdk.org/ml/archives/dev/2014-April/002173.html
> > And I liked keeping only 1 option;
> > http://dpdk.org/ml/archives/dev/2014-May/002722.html
> > But Anatoly raised the compatibility problem:
> > http://dpdk.org/ml/archives/dev/2014-May/002723.html
> > Then there was no other comment so Didier and I reworked a separate
> option.
> >
> > > The existing coremask parsing always assumes a hex coremask, so just
> > > looking for a 0x will not work. I prefer this scheme of using a new
> > > flag for this method of specifying the cores to use.
> > >
> > > If you don't want to use up a single-letter option, two alternatives:
> > > 1) use a long option instead.
> > > 2) if the -c parameter includes a "-" or a ",", treat it as a
> > > new-style option, otherwise treat as old. The only abiguity here
> > > would be for specifying a single core value 1-9 e.g. is "-c 6" a mask with
> two bits, or a single-core to run on.
> > > [0 is obviously a named core as it's an invalid mask, and A-F are
> > > obviously masks.] If we did want this scheme, I would suggest that
> > > we allow trailing commas in the list specifier, so we can force
> > > users to clear ambiguity by either writing "0x6" or "6," i.e. disallow
> ambiguous values to avoid problems.
> > > However, this is probably more work that it's worth to avoid using
> > > up a letter option.
> > >
> > > I'd prefer any of these options to breaking backward compatibility in this
> case.
> >
> > We need a consensus here.
> > Who is supporting a "burn" of an one-letter option with clear usage?
> > Who is supporting a "re-merge" of the 2 syntaxes with more complicated
> > rules (list syntax is triggered by presence of "-" or ",")?
> >
> 
> Burn!

I would still prefer a long option (we already have a coremask parameter, so 
another one is kind-of non-essential and IMO shouldn't belong in a scarce 
resource of one-letter parameters), but if everyone else agrees, the "burn" 
option is much more preferable to me than complicating syntax of an already 
existing parameter.

Thanks,
Anatoly


[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Bruce Richardson
On Mon, Nov 24, 2014 at 02:19:16PM +0100, Thomas Monjalon wrote:
> Hi Bruce and Neil,
> 
> 2014-11-24 11:28, Bruce Richardson:
> > On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
> > > On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
> > > > From: Didier Pallard 
> > > > 
> > > > In current version, used cores can only be specified using a bitmask.
> > > > It will now be possible to specify cores in 2 different ways:
> > > > - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
> > > > - Using a list in following format: -l [-c2][,c3[-c4],...]
> > > > 
> > > > The letter -l can stand for lcore or list.
> > > > 
> > > > -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
> > > 
> > > Do you want to burn an option letter on that?  It seems like it might be 
> > > better
> > > to search the string for 0x and base the selection of bitmap of list 
> > > parsing
> > > based on its presence or absence.
> 
> It was the initial proposal (in April):
>   http://dpdk.org/ml/archives/dev/2014-April/002173.html
> And I liked keeping only 1 option;
>   http://dpdk.org/ml/archives/dev/2014-May/002722.html
> But Anatoly raised the compatibility problem:
>   http://dpdk.org/ml/archives/dev/2014-May/002723.html
> Then there was no other comment so Didier and I reworked a separate option. 
> 
> > The existing coremask parsing always assumes a hex coremask, so just looking
> > for a 0x will not work. I prefer this scheme of using a new flag for this 
> > method
> > of specifying the cores to use. 
> > 
> > If you don't want to use up a single-letter option, two alternatives:
> > 1) use a long option instead.
> > 2) if the -c parameter includes a "-" or a ",", treat it as a new-style 
> > option,
> > otherwise treat as old. The only abiguity here would be for specifying a 
> > single
> > core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to run 
> > on.
> > [0 is obviously a named core as it's an invalid mask, and A-F are obviously
> > masks.] If we did want this scheme, I would suggest that we allow trailing
> > commas in the list specifier, so we can force users to clear ambiguity by
> > either writing "0x6" or "6," i.e. disallow ambiguous values to avoid 
> > problems.
> > However, this is probably more work that it's worth to avoid using up a 
> > letter
> > option.
> > 
> > I'd prefer any of these options to breaking backward compatibility in this 
> > case.
> 
> We need a consensus here.
> Who is supporting a "burn" of an one-letter option with clear usage?
> Who is supporting a "re-merge" of the 2 syntaxes with more complicated rules
> (list syntax is triggered by presence of "-" or ",")? 
>

Burn!


[dpdk-dev] bifurcated driver

2014-11-24 Thread Luke Gorrie
On 5 November 2014 at 14:00, Thomas Monjalon 
wrote:

> It seems to be close to the bifurcated driver needs.
> Not sure if it can solve the security issues if there is no dedicated MMU
> in the NIC.
>
> I feel we should sum up pros and cons of
> - igb_uio
> - uio_pci_generic
> - VFIO
> - ibverbs
> - bifurcated driver
>

I am also curious about the pros and cons of the bifurcated driver compared
with SR-IOV.

What are the practical differences between running a bifurcated driver vs.
running SR-IOV mode where the kernel owns the PF and userspace applications
own the VFs?

Specifically, could I run the ixgbe driver in the kernel (max_vfs=N),
control it via ethtool, and then access the queues via userspace VF
drivers? If so, how would this differ from the bifurcated driver?

Cheers,
-Luke


[dpdk-dev] [PATCH v7 7/7] bond: unit test test macro refactor

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test/test_link_bonding.c | 2604 +-
 1 files changed, 1052 insertions(+), 1552 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index f428193..206b10a 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -31,6 +31,7 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+#include "unistd.h"
 #include 
 #include 
 #include 
@@ -265,7 +266,7 @@ static pthread_cond_t cvar = PTHREAD_COND_INITIALIZER;
 static int
 test_setup(void)
 {
-   int i, retval, nb_mbuf_per_pool;
+   int i, nb_mbuf_per_pool;
struct ether_addr *mac_addr = (struct ether_addr *)slave_mac;

/* Allocate ethernet packet header with space for VLAN header */
@@ -273,10 +274,8 @@ test_setup(void)
test_params->pkt_eth_hdr = malloc(sizeof(struct ether_hdr) +
sizeof(struct vlan_hdr));

-   if (test_params->pkt_eth_hdr == NULL) {
-   printf("ethernet header struct allocation failed!\n");
-   return -1;
-   }
+   TEST_ASSERT_NOT_NULL(test_params->pkt_eth_hdr,
+   "Ethernet header struct allocation failed!");
}

nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + DEF_PKT_BURST +
@@ -286,10 +285,8 @@ test_setup(void)
MBUF_SIZE, MBUF_CACHE_SIZE, sizeof(struct 
rte_pktmbuf_pool_private),
rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, 
NULL,
rte_socket_id(), 0);
-   if (test_params->mbuf_pool == NULL) {
-   printf("rte_mempool_create failed\n");
-   return -1;
-   }
+   TEST_ASSERT_NOT_NULL(test_params->mbuf_pool,
+   "rte_mempool_create failed");
}

/* Create / Initialize virtual eth devs */
@@ -303,20 +300,12 @@ test_setup(void)

test_params->slave_port_ids[i] = 
virtual_ethdev_create(pmd_name,
mac_addr, rte_socket_id(), 1);
-   if (test_params->slave_port_ids[i] < 0) {
-   printf("Failed to create virtual virtual ethdev 
%s\n", pmd_name);
-   return -1;
-   }
+   TEST_ASSERT(test_params->slave_port_ids[i] >= 0,
+   "Failed to create virtual virtual 
ethdev %s", pmd_name);

-   printf("Created virtual ethdev %s\n", pmd_name);
-
-   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1, 0);
-   if (retval != 0) {
-   printf("Failed to configure virtual ethdev 
%s\n", pmd_name);
-   return -1;
-   }
-
-   printf("Configured virtual ethdev %s\n", pmd_name);
+   TEST_ASSERT_SUCCESS(configure_ethdev(
+   test_params->slave_port_ids[i], 1, 0),
+   "Failed to configure virtual ethdev 
%s", pmd_name);
}
slaves_initialized = 1;
}
@@ -350,14 +339,14 @@ test_create_bonded_device(void)
current_slave_count = 
rte_eth_bond_slaves_get(test_params->bonded_port_id,
slaves, RTE_MAX_ETHPORTS);

-   TEST_ASSERT(current_slave_count == 0,
+   TEST_ASSERT_EQUAL(current_slave_count, 0,
"Number of slaves %d is great than expected %d.",
current_slave_count, 0);

current_slave_count = rte_eth_bond_active_slaves_get(
test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS);

-   TEST_ASSERT(current_slave_count == 0,
+   TEST_ASSERT_EQUAL(current_slave_count, 0,
"Number of active slaves %d is great than expected %d.",
current_slave_count, 0);

@@ -375,30 +364,21 @@ test_create_bonded_device_with_invalid_params(void)
/* Invalid name */
port_id = rte_eth_bond_create(NULL, test_params->bonding_mode,
rte_socket_id());
-   if (port_id >= 0) {
-   printf("Created bonded device unexpectedly.\n");
-   return -1;
-   }
+   TEST_ASSERT(port_id < 0, "Created bonded device unexpectedly");

test_params->bonding_mode = INVALID_BONDING_MODE;

/* Invalid bonding mode */
port_id = rte_eth_bond_create(BONDED_DEV_NAME, 
test_params->bonding_mode,
rte_socket_id());
-   if (port_id >= 0) {
-   printf("Created bonded device unexpectedly.\n");
-   return -1;
-   }
+   TEST_ASSERT(port_id < 0, "Created bonded device 

[dpdk-dev] [PATCH v7 6/7] bond: lsc polling support

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test-pmd/cmdline.c  |   63 +
 app/test/test.h |7 +-
 app/test/test_link_bonding.c|  265 ---
 app/test/virtual_pmd.c  |   17 +-
 app/test/virtual_pmd.h  |   48 +++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |   19 ++
 lib/librte_pmd_bond/rte_eth_bond.h  |   80 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c  |  315 ++---
 lib/librte_pmd_bond/rte_eth_bond_args.c |   28 ++-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c  |  393 ---
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +++--
 11 files changed, 958 insertions(+), 348 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index be12c13..af8f907 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -462,6 +462,9 @@ static void cmd_help_long_parsed(void *parsed_result,

"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"
+
+   "set bonding mon_period (port_id) (value)\n"
+   "   Set the bonding link status monitoring polling 
period in ms.\n\n"
 #endif

, list_pkt_forwarding_modes()
@@ -3733,6 +3736,65 @@ cmdline_parse_inst_t cmd_set_bond_mac_addr = {
}
 };

+
+/* *** SET LINK STATUS MONITORING POLLING PERIOD ON BONDED DEVICE *** */
+struct cmd_set_bond_mon_period_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t bonding;
+   cmdline_fixed_string_t mon_period;
+   uint8_t port_num;
+   uint32_t period_ms;
+};
+
+static void cmd_set_bond_mon_period_parsed(void *parsed_result,
+   __attribute__((unused))  struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_set_bond_mon_period_result *res = parsed_result;
+   int ret;
+
+   if (res->port_num >= nb_ports) {
+   printf("Port id %d must be less than %d\n", res->port_num, 
nb_ports);
+   return;
+   }
+
+   ret = rte_eth_bond_link_monitoring_set(res->port_num, res->period_ms);
+
+   /* check the return value and print it if is < 0 */
+   if (ret < 0)
+   printf("set_bond_mac_addr error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   set, "set");
+cmdline_parse_token_string_t cmd_set_bond_mon_period_bonding =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   bonding, "bonding");
+cmdline_parse_token_string_t cmd_set_bond_mon_period_mon_period =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   mon_period, "mon_period");
+cmdline_parse_token_num_t cmd_set_bond_mon_period_portnum =
+   TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   port_num, UINT8);
+cmdline_parse_token_num_t cmd_set_bond_mon_period_period_ms =
+   TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   period_ms, UINT32);
+
+cmdline_parse_inst_t cmd_set_bond_mon_period = {
+   .f = cmd_set_bond_mon_period_parsed,
+   .data = (void *) 0,
+   .help_str = "set bonding mon_period (port_id) (period_ms): ",
+   .tokens = {
+   (void *)&cmd_set_bond_mon_period_set,
+   (void *)&cmd_set_bond_mon_period_bonding,
+   (void *)&cmd_set_bond_mon_period_mon_period,
+   (void *)&cmd_set_bond_mon_period_portnum,
+   (void *)&cmd_set_bond_mon_period_period_ms,
+   NULL
+   }
+};
+
 #endif /* RTE_LIBRTE_PMD_BOND */

 /* *** SET FORWARDING MODE *** */
@@ -7787,6 +7849,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *) &cmd_create_bonded_device,
(cmdline_parse_inst_t *) &cmd_set_bond_mac_addr,
(cmdline_parse_inst_t *) &cmd_set_balance_xmit_policy,
+   (cmdline_parse_inst_t *) &cmd_set_bond_mon_period,
 #endif
(cmdline_parse_inst_t *)&cmd_vlan_offload,
(cmdline_parse_inst_t *)&cmd_vlan_tpid,
diff --git a/app/test/test.h b/app/test/test.h
index bd44a7f..d5b6951 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -62,14 +62,15 @@

 #define TEST_ASSERT_SUCCESS(val, msg, ...) do {
\
if (!(val == 0)) {  
\
-   printf("TestCas

[dpdk-dev] [PATCH v7 5/7] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist

2014-11-24 Thread Declan Doherty

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

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4c3fc76..be12c13 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3642,7 +3642,7 @@ static void cmd_create_bonded_device_parsed(void 
*parsed_result,

/* Update number of ports */
nb_ports = rte_eth_dev_count();
-   reconfig(port_id);
+   reconfig(port_id, res->socket);
rte_eth_promiscuous_enable(port_id);
}

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 12adafa..8a4190b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -630,7 +630,7 @@ init_config(void)


 void
-reconfig(portid_t new_port_id)
+reconfig(portid_t new_port_id, unsigned socket_id)
 {
struct rte_port *port;

@@ -649,6 +649,7 @@ reconfig(portid_t new_port_id)
/* set flag to initialize port/queue */
port->need_reconfig = 1;
port->need_reconfig_queues = 1;
+   port->socket_id = socket_id;

init_port_config();
 }
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9cbfeac..5a3423c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -457,7 +457,7 @@ void fwd_config_display(void);
 void rxtx_config_display(void);
 void fwd_config_setup(void);
 void set_def_fwd_config(void);
-void reconfig(portid_t new_port_id);
+void reconfig(portid_t new_port_id, unsigned socket_id);
 int init_fwd_streams(void);

 void port_mtu_set(portid_t port_id, uint16_t mtu);
-- 
1.7.4.1



[dpdk-dev] [PATCH v7 4/7] bond: free mbufs if transmission fails in bonding tx_burst functions

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test/packet_burst_generator.c  |   11 +-
 app/test/packet_burst_generator.h  |   15 +-
 app/test/test_link_bonding.c   |  435 ++--
 app/test/virtual_pmd.c |   78 +--
 app/test/virtual_pmd.h |7 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |   83 +--
 6 files changed, 551 insertions(+), 78 deletions(-)

diff --git a/app/test/packet_burst_generator.c 
b/app/test/packet_burst_generator.c
index 017139b..b2824dc 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -74,8 +74,7 @@ static inline void
 copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset)
 {
if (offset + len <= pkt->data_len) {
-   rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset,
-   buf, (size_t) len);
+   rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset, buf, 
(size_t) len);
return;
}
copy_buf_to_pkt_segs(buf, len, pkt, offset);
@@ -191,12 +190,12 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t 
src_addr,
  */
 #define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned char. */

+
 int
 generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
- struct ether_hdr *eth_hdr, uint8_t vlan_enabled,
- void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr,
- int nb_pkt_per_burst, uint8_t pkt_len,
- uint8_t nb_pkt_segs)
+   struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr,
+   uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst,
+   uint8_t pkt_len, uint8_t nb_pkt_segs)
 {
int i, nb_pkt = 0;
size_t eth_hdr_size;
diff --git a/app/test/packet_burst_generator.h 
b/app/test/packet_burst_generator.h
index fe992ac..f86589e 100644
--- a/app/test/packet_burst_generator.h
+++ b/app/test/packet_burst_generator.h
@@ -47,13 +47,13 @@ extern "C" {
 #define IPV4_ADDR(a, b, c, d)(((a & 0xff) << 24) | ((b & 0xff) << 16) | \
((c & 0xff) << 8) | (d & 0xff))

-#define PACKET_BURST_GEN_PKT_LEN 60
-#define PACKET_BURST_GEN_PKT_LEN_128 128
+#define PACKET_BURST_GEN_PKT_LEN 60
+#define PACKET_BURST_GEN_PKT_LEN_128 128
+

 void
 initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac,
- struct ether_addr *dst_mac, uint8_t vlan_enabled,
- uint16_t van_id);
+   struct ether_addr *dst_mac, uint8_t vlan_enabled, uint16_t 
van_id);

 uint16_t
 initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port,
@@ -70,10 +70,9 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t 
src_addr,

 int
 generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
- struct ether_hdr *eth_hdr, uint8_t vlan_enabled,
- void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr,
- int nb_pkt_per_burst, uint8_t pkt_len,
- uint8_t nb_pkt_segs);
+   struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr,
+   uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst,
+   uint8_t pkt_len, uint8_t nb_pkt_segs);

 #ifdef __cplusplus
 }
diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 1245c49..185ce73 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -663,6 +663,9 @@ enable_bonded_slaves(void)
int i;

for (i = 0; i < test_params->bonded_slave_count; i++) {
+   
virtual_ethdev_tx_burst_fn_set_success(test_params->slave_port_ids[i],
+   1);
+
virtual_ethdev_simulate_link_status_interrupt(
test_params->slave_port_ids[i], 1);
}
@@ -1336,12 +1339,10 @@ generate_test_burst(struct rte_mbuf **pkts_burst, 
uint16_t burst_size,
}

/* Generate burst of packets to transmit */
-   generated_burst_size =
-   generate_packet_burst(test_params->mbuf_pool,
- pkts_burst, test_params->pkt_eth_hdr,
- vlan, ip_hdr, ipv4,
- test_params->pkt_udp_hdr, burst_size,
- PACKET_BURST_GEN_PKT_LEN_128, 1);
+   generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
+   pkts_burst, test_params->pkt_eth_hdr, vlan, ip_hdr, 
ipv4,
+   test_params->pkt_udp_hdr, burst_size, 
PACKET_BURST_GEN_PKT_LEN_128,
+   1);
if (generated_burst_size != burst_size) {
printf("Failed to generate packet burst");
return -1;
@@ -1419,6 +1420,135 @@ test_roundrobin_tx_burst(void)
 }

 static int
+veri

[dpdk-dev] [PATCH v7 3/7] bond: fix naming inconsistency in tx_burst_round_robin

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c 
b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index f2fe930..6e770af 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -93,7 +93,7 @@ static uint16_t
 bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,
uint16_t nb_pkts)
 {
-   struct bond_dev_private *dev_private;
+   struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;

struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS][nb_pkts];
@@ -108,13 +108,13 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct 
rte_mbuf **bufs,
int i, cs_idx = 0;

bd_tx_q = (struct bond_tx_queue *)queue;
-   dev_private = bd_tx_q->dev_private;
+   internals = bd_tx_q->dev_private;

/* Copy slave list to protect against slave up/down changes during tx
 * bursting */
-   num_of_slaves = dev_private->active_slave_count;
-   memcpy(slaves, dev_private->active_slaves,
-   sizeof(dev_private->active_slaves[0]) * num_of_slaves);
+   num_of_slaves = internals->active_slave_count;
+   memcpy(slaves, internals->active_slaves,
+   sizeof(internals->active_slaves[0]) * num_of_slaves);

if (num_of_slaves < 1)
return num_tx_total;
-- 
1.7.4.1



[dpdk-dev] [PATCH v7 2/7] bond: removing switch statement from rx burst method

2014-11-24 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |   65 +--
 1 files changed, 36 insertions(+), 29 deletions(-)

diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c 
b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index de0cd56..f2fe930 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -59,35 +59,38 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)

internals = bd_rx_q->dev_private;

-   switch (internals->mode) {
-   case BONDING_MODE_ROUND_ROBIN:
-#ifdef RTE_MBUF_REFCNT
-   case BONDING_MODE_BROADCAST:
-#endif
-   case BONDING_MODE_BALANCE:
-   for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
-   /* Offset of pointer to *bufs increases as packets are 
received
-* from other slaves */
-   num_rx_slave = 
rte_eth_rx_burst(internals->active_slaves[i],
-   bd_rx_q->queue_id, bufs + num_rx_total, 
nb_pkts);
-   if (num_rx_slave) {
-   num_rx_total += num_rx_slave;
-   nb_pkts -= num_rx_slave;
-   }
+
+   for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
+   /* Offset of pointer to *bufs increases as packets are received
+* from other slaves */
+   num_rx_slave = rte_eth_rx_burst(internals->active_slaves[i],
+   bd_rx_q->queue_id, bufs + num_rx_total, 
nb_pkts);
+   if (num_rx_slave) {
+   num_rx_total += num_rx_slave;
+   nb_pkts -= num_rx_slave;
}
-   break;
-   case BONDING_MODE_ACTIVE_BACKUP:
-   num_rx_slave = rte_eth_rx_burst(internals->current_primary_port,
-   bd_rx_q->queue_id, bufs, nb_pkts);
-   if (num_rx_slave)
-   num_rx_total = num_rx_slave;
-   break;
}
+
return num_rx_total;
 }

 static uint16_t
-bond_ethdev_tx_round_robin(void *queue, struct rte_mbuf **bufs,
+bond_ethdev_rx_burst_active_backup(void *queue, struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   struct bond_dev_private *internals;
+
+   /* Cast to structure, containing bonded device's port id and queue id */
+   struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue;
+
+   internals = bd_rx_q->dev_private;
+
+   return rte_eth_rx_burst(internals->current_primary_port,
+   bd_rx_q->queue_id, bufs, nb_pkts);
+}
+
+static uint16_t
+bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,
uint16_t nb_pkts)
 {
struct bond_dev_private *dev_private;
@@ -136,7 +139,7 @@ bond_ethdev_tx_round_robin(void *queue, struct rte_mbuf 
**bufs,
 }

 static uint16_t
-bond_ethdev_tx_active_backup(void *queue,
+bond_ethdev_tx_burst_active_backup(void *queue,
struct rte_mbuf **bufs, uint16_t nb_pkts)
 {
struct bond_dev_private *internals;
@@ -272,7 +275,8 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t 
slave_count, uint8_t policy)
 }

 static uint16_t
-bond_ethdev_tx_balance(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
+bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
 {
struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;
@@ -486,24 +490,27 @@ bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, int 
mode)

switch (mode) {
case BONDING_MODE_ROUND_ROBIN:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_round_robin;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_round_robin;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
case BONDING_MODE_ACTIVE_BACKUP:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_active_backup;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_active_backup;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst_active_backup;
break;
case BONDING_MODE_BALANCE:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_balance;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_balance;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
 #ifdef RTE_MBUF_REFCNT
case BONDING_MODE_BROADCAST:
eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_broadcast;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
 #endif
default:
return -1;
}

-   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
internals->mode = mode;

return 0;
-- 
1.7.4.1



[dpdk-dev] [PATCH v7 1/7] bond: link status interrupt support

2014-11-24 Thread Declan Doherty
Adding support for lsc interrupt from bonded device to link
bonding library with supporting unit tests in the test application.

Signed-off-by: Declan Doherty 
---
 app/test/test_link_bonding.c   |  213 +++-
 lib/librte_pmd_bond/rte_eth_bond_api.c |4 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |6 +
 3 files changed, 189 insertions(+), 34 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index d407e4f..1245c49 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -224,10 +225,15 @@ static struct rte_eth_txconf tx_conf_default = {
 };

 static int
-configure_ethdev(uint8_t port_id, uint8_t start)
+configure_ethdev(uint8_t port_id, uint8_t start, uint8_t en_isr)
 {
int q_id;

+   if (en_isr)
+   default_pmd_conf.intr_conf.lsc = 1;
+   else
+   default_pmd_conf.intr_conf.lsc = 0;
+
if (rte_eth_dev_configure(port_id, test_params->nb_rx_q,
test_params->nb_tx_q, &default_pmd_conf) != 0) {
goto error;
@@ -312,7 +318,7 @@ test_setup(void)

printf("Created virtual ethdev %s\n", pmd_name);

-   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1);
+   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1, 0);
if (retval != 0) {
printf("Failed to configure virtual ethdev 
%s\n", pmd_name);
return -1;
@@ -341,7 +347,7 @@ test_create_bonded_device(void)
TEST_ASSERT(test_params->bonded_port_id >= 0,
"Failed to create bonded ethdev %s", 
BONDED_DEV_NAME);

-   
TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),
+   
TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0, 0),
"Failed to configure bonded ethdev %s", 
BONDED_DEV_NAME);
}

@@ -1081,12 +1087,12 @@ test_set_explicit_bonded_mac(void)


 static int
-initialize_bonded_device_with_slaves(uint8_t bonding_mode,
+initialize_bonded_device_with_slaves(uint8_t bonding_mode, uint8_t bond_en_isr,
uint8_t number_of_slaves, uint8_t enable_slave)
 {
/* configure bonded device */
-   TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),
-   "Failed to configure bonding port (%d) in mode %d "
+   TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0,
+   bond_en_isr), "Failed to configure bonding port (%d) in 
mode %d "
"with (%d) slaves.", test_params->bonded_port_id, 
bonding_mode,
number_of_slaves);

@@ -1119,8 +1125,8 @@ test_adding_slave_after_bonded_device_started(void)
 {
int i;

-   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 
0) !=
-   0)
+   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 
4, 0)
+   != 0)
return -1;

/* Enabled slave devices */
@@ -1144,6 +1150,144 @@ test_adding_slave_after_bonded_device_started(void)
return remove_slaves_and_stop_bonded_device();
 }

+#define TEST_STATUS_INTERRUPT_SLAVE_COUNT  4
+#define TEST_LSC_WAIT_TIMEOUT_MS   500
+
+int test_lsc_interupt_count;
+
+static pthread_mutex_t mutex;
+static pthread_cond_t cvar;
+
+static void
+test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,
+   enum rte_eth_event_type type  __rte_unused, void *param 
__rte_unused)
+{
+   pthread_mutex_lock(&mutex);
+   test_lsc_interupt_count++;
+
+   pthread_cond_signal(&cvar);
+   pthread_mutex_unlock(&mutex);
+}
+
+static inline int
+lsc_timeout(int wait_us)
+{
+   int retval = 0;
+
+   struct timespec ts;
+   struct timeval tp;
+
+   gettimeofday(&tp, NULL);
+
+   /* Convert from timeval to timespec */
+   ts.tv_sec  = tp.tv_sec;
+   ts.tv_nsec = tp.tv_usec * 1000;
+   ts.tv_nsec += wait_us * 1000;
+
+   pthread_mutex_lock(&mutex);
+   if (test_lsc_interupt_count < 1)
+   retval = pthread_cond_timedwait(&cvar, &mutex, &ts);
+
+   pthread_mutex_unlock(&mutex);
+
+   return retval;
+}
+
+static int
+test_status_interrupt(void)
+{
+   int slave_count;
+   uint8_t slaves[RTE_MAX_ETHPORTS];
+
+   pthread_mutex_init(&mutex, NULL);
+   pthread_cond_init(&cvar, NULL);
+
+   /* initialized bonding device with T slaves */
+   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 1,
+   TEST_STATUS_INTERRUPT_SLAVE_COUNT, 1) != 0)
+   return -1;
+
+   test_lsc_interupt_count = 0;
+
+   /* register link status change interrupt callba

[dpdk-dev] [PATCH v7 0/7] link bonding

2014-11-24 Thread Declan Doherty
v7:
- Fixes for checkpatch issues and typo fixes
- Removed patch "test app: adding support for generating variable sized" as this
  was already committed in commit aca4360340f169dcc11b1a9be955b44de8b9f6eb

v6:
- Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
- Added details to testpmd user guide for new command to set link status 
polling interval.

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a
  build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Re-based to account for changes in master.
- Fix for rte_eth_bond_slaves_get() introduced in v3 patch set
- Addressed issue around disabling/enabling link status polling around adding/
  removing slaves devices.

v3 :
- Typo fix for the bond free mbufs patch.
- Re-based to account for changes in the mbuf patches.
- Add support for slave devices which don't support link status interrupts 
- Tidy up the link bonding unit test so that all tests use the new test macros.

v2 :
Addresses issues with the logic around the handling of fail transmissions.
In this version all modes behave in a manner similar to a standard PMD,
returning the number of successfully transmitted mbufs and with the failing
mbufs at the end of bufs array for freeing / retransmission by the 
application software

v1:

This patch set adds support for link status interrupt in the link bonding
pmd. It also contains some patches to tidy up the code structure and to
of the link bonding code and to fix bugs relating to transmission 
failures in the under lying slave pmd which could lead to leaked mbufs. 


Declan Doherty (7):
  bond: link status interrupt support
  bond: removing switch statement from rx burst method
  bond: fix naming inconsistency in tx_burst_round_robin
  bond: free mbufs if transmission fails in bonding tx_burst functions
  testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
  bond: lsc polling support
  bond: unit test test macro refactor

 app/test-pmd/cmdline.c  |   65 +-
 app/test-pmd/testpmd.c  |3 +-
 app/test-pmd/testpmd.h  |2 +-
 app/test/packet_burst_generator.c   |   11 +-
 app/test/packet_burst_generator.h   |   15 +-
 app/test/test.h |7 +-
 app/test/test_link_bonding.c| 3371 ++-
 app/test/virtual_pmd.c  |   95 +-
 app/test/virtual_pmd.h  |   53 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |   19 +
 lib/librte_pmd_bond/rte_eth_bond.h  |   80 +
 lib/librte_pmd_bond/rte_eth_bond_api.c  |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c |   28 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c  |  553 --
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
 15 files changed, 2719 insertions(+), 1973 deletions(-)

-- 
1.7.4.1



[dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

2014-11-24 Thread Neil Horman
On Mon, Nov 24, 2014 at 04:12:48PM +, Sujith Sankar (ssujith) wrote:
> 
> 
> On 24/11/14 5:03 pm, "Neil Horman"  wrote:
> 
> >On Mon, Nov 24, 2014 at 05:45:54AM +, Sujith Sankar (ssujith) wrote:
> >> 
> >> 
> >> On 24/11/14 5:47 am, "Neil Horman"  wrote:
> >> 
> >> >On Sun, Nov 23, 2014 at 09:38:19PM +0530, Sujith Sankar wrote:
> >> >> Signed-off-by: Sujith Sankar 
> >> >> ---
> >> >>  config/common_linuxapp | 5 +
> >> >>  lib/Makefile   | 1 +
> >> >>  lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 7 +++
> >> >>  lib/librte_eal/linuxapp/eal/include/eal_pci_init.h | 1 +
> >> >>  mk/rte.app.mk  | 4 
> >> >>  5 files changed, 18 insertions(+)
> >> >> 
> >> >> diff --git a/config/common_linuxapp b/config/common_linuxapp
> >> >> index 57b61c9..3c091e7 100644
> >> >> --- a/config/common_linuxapp
> >> >> +++ b/config/common_linuxapp
> >> >> @@ -210,6 +210,11 @@ CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM=4
> >> >>  CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
> >> >>  
> >> >>  #
> >> >> +# Compile burst-oriented Cisco ENIC PMD driver
> >> >> +#
> >> >> +CONFIG_RTE_LIBRTE_ENIC_PMD=y
> >> >> +
> >> >> +#
> >> >>  # Compile burst-oriented VIRTIO PMD driver
> >> >>  #
> >> >>  CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
> >> >> diff --git a/lib/Makefile b/lib/Makefile
> >> >> index e3237ff..1911790 100644
> >> >> --- a/lib/Makefile
> >> >> +++ b/lib/Makefile
> >> >> @@ -43,6 +43,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
> >> >>  DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
> >> >>  DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += librte_pmd_e1000
> >> >>  DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_ixgbe
> >> >> +DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_enic
> >> >>  DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e
> >> >>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond
> >> >>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring
> >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> >> >>b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> >> >> index c776ddc..6bf8f2e 100644
> >> >> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> >> >> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> >> >> @@ -736,6 +736,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
> >> >> maps[i].offset = reg.offset;
> >> >> maps[i].size = reg.size;
> >> >> dev->mem_resource[i].addr = bar_addr;
> >> >> +   dev->mem_resource[i].len = reg.size;
> >> >> }
> >> >>  
> >> >> /* if secondary process, do not set up interrupts */
> >> >> @@ -791,4 +792,10 @@ pci_vfio_is_enabled(void)
> >> >>  {
> >> >> return vfio_cfg.vfio_enabled;
> >> >>  }
> >> >> +
> >> >> +int
> >> >> +pci_vfio_container_fd(void)
> >> >> +{
> >> >> +   return vfio_cfg.vfio_container_fd;
> >> >> +}
> >> >You should move this function definition to a separate patch and put it
> >> >earlier
> >> >in the series, as you call this function two patches back.
> >> 
> >> Thanks for the comment, Neil.  I shall move this to a separate patch and
> >> put it earlier in the series.
> >> 
> >> >
> >> >Also, this gives me pause, as it seems like you're working around the
> >> >VFIO api.
> >> >From what I see, you just use this to get an fd that you can use in an
> >> >ioctl to
> >> >set some DMA settings.  First off, theres already a function called
> >> >pci_vfio_get_container_fd, which does exactly what you are doing here,
> >> >with
> >> >additional safety checking.
> >> >
> >> >However, even though there is an existing function to do what you
> >>want, I
> >> >would
> >> >recommend that you not use it for your purposes.  Whenever you expose
> >> >something
> >> >like a file descriptor, you run the risk of multiple accessors racing
> >> >trying to
> >> >set/unset features and preform operations.  It would be better if you
> >> >could add
> >> >apropriate api calls to vfio interface to set what you want.  That way
> >>the
> >> >library can add appropriate locking if/when needed
> >> 
> >> 
> >> I see that vfio_cfg.vfio_container_fd is obtained and stored in
> >> pci_vfio_enable(), and this is not modified later.
> >> ENIC PMD needs it to add the IOMMU mapping for buffers used for
> >> communicating with adapter firmware.  That?s just adding an entry, and
> >> container fd is just passed as an argument.  So the following addition
> >>in
> >> eal_pci_vfio.c should be sufficient.  Since vfio_cfg is per process, I
> >>do
> >> not think that any other checking is required.
> >> 
> >> int
> >> pci_vfio_map_dma(struct vfio_iommu_type1_dma_map *dma_map)
> >> {
> >>return ioctl(vfio_cfg.vfio_container_fd, VFIO_IOMMU_MAP_DMA, dma_map);
> >> }
> >> 
> >> 
> >> 
> >> Does this look alright?  Do you think that I?ve missed out anything
> >>here?
> >> 
> >It looks better yes, but I'm still confused as to why its necessecary.
> >Looking
> >back at your use of the fd

[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Neil Horman
On Mon, Nov 24, 2014 at 05:11:16PM +, Burakov, Anatoly wrote:
> > On Mon, Nov 24, 2014 at 10:12:33AM -0600, Roger Keith Wiles wrote:
> > > Burn, it is not like we are going to add a huge number of new options in 
> > > the
> > future and run out of letters.
> > >
> > No, but what about the application authors that need to accomodate all of
> > the dpdk command line options as well?
> > Neil
> 
> Hi Neil
> 
> I don't think that's a problem as all those parameters are separated with a 
> --. I.e. ./testpmd -c f -n 2 -- . Is that not the case?
> 
I don't know, I've not tried, though I'm still not a fan of having a command
line that takes the form:

 -c 0x -- -c ...

That just looks confusing to me.
Neil

> Thanks,
> Anatoly
> 


[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Neil Horman
On Mon, Nov 24, 2014 at 10:12:33AM -0600, Roger Keith Wiles wrote:
> Burn, it is not like we are going to add a huge number of new options in the 
> future and run out of letters.
> 
No, but what about the application authors that need to accomodate all of the
dpdk command line options as well?
Neil

> > On Nov 24, 2014, at 8:52 AM, Venkatesan, Venky  > intel.com> wrote:
> > 
> > 
> > On 11/24/2014 5:28 AM, Bruce Richardson wrote:
> >> On Mon, Nov 24, 2014 at 02:19:16PM +0100, Thomas Monjalon wrote:
> >>> Hi Bruce and Neil,
> >>> 
> >>> 2014-11-24 11:28, Bruce Richardson:
>  On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
> > On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
> >> From: Didier Pallard 
> >> 
> >> In current version, used cores can only be specified using a bitmask.
> >> It will now be possible to specify cores in 2 different ways:
> >> - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
> >> - Using a list in following format: -l [-c2][,c3[-c4],...]
> >> 
> >> The letter -l can stand for lcore or list.
> >> 
> >> -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
> > Do you want to burn an option letter on that?  It seems like it might 
> > be better
> > to search the string for 0x and base the selection of bitmap of list 
> > parsing
> > based on its presence or absence.
> >>> It was the initial proposal (in April):
> >>>   http://dpdk.org/ml/archives/dev/2014-April/002173.html
> >>> And I liked keeping only 1 option;
> >>>   http://dpdk.org/ml/archives/dev/2014-May/002722.html
> >>> But Anatoly raised the compatibility problem:
> >>>   http://dpdk.org/ml/archives/dev/2014-May/002723.html
> >>> Then there was no other comment so Didier and I reworked a separate 
> >>> option.
> >>> 
>  The existing coremask parsing always assumes a hex coremask, so just 
>  looking
>  for a 0x will not work. I prefer this scheme of using a new flag for 
>  this method
>  of specifying the cores to use.
>  
>  If you don't want to use up a single-letter option, two alternatives:
>  1) use a long option instead.
>  2) if the -c parameter includes a "-" or a ",", treat it as a new-style 
>  option,
>  otherwise treat as old. The only abiguity here would be for specifying a 
>  single
>  core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to 
>  run on.
>  [0 is obviously a named core as it's an invalid mask, and A-F are 
>  obviously
>  masks.] If we did want this scheme, I would suggest that we allow 
>  trailing
>  commas in the list specifier, so we can force users to clear ambiguity by
>  either writing "0x6" or "6," i.e. disallow ambiguous values to avoid 
>  problems.
>  However, this is probably more work that it's worth to avoid using up a 
>  letter
>  option.
>  
>  I'd prefer any of these options to breaking backward compatibility in 
>  this case.
> >>> We need a consensus here.
> >>> Who is supporting a "burn" of an one-letter option with clear usage?
> >>> Who is supporting a "re-merge" of the 2 syntaxes with more complicated 
> >>> rules
> >>> (list syntax is triggered by presence of "-" or ",")?
> >>> 
> >> Burn!
> > Burn ^ 2 ;)
> 
> 


[dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

2014-11-24 Thread David Marchand
Hello Sujith,

On Sun, Nov 23, 2014 at 5:08 PM, Sujith Sankar  wrote:

> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> index c776ddc..6bf8f2e 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> @@ -736,6 +736,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
> maps[i].offset = reg.offset;
> maps[i].size = reg.size;
> dev->mem_resource[i].addr = bar_addr;
> +   dev->mem_resource[i].len = reg.size;
> }
>
> /* if secondary process, do not set up interrupts */
>

Not sure I understand why you need to overwrite the length value.
This is supposed to be initialised before by "generic" code.
This looks like a hack or a workaround.

Can you elaborate on this change ?
Thanks.


-- 
David Marchand


[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Bruce Richardson
On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
> On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
> > From: Didier Pallard 
> > 
> > In current version, used cores can only be specified using a bitmask.
> > It will now be possible to specify cores in 2 different ways:
> > - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
> > - Using a list in following format: -l [-c2][,c3[-c4],...]
> > 
> > The letter -l can stand for lcore or list.
> > 
> > -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
> > 
> Do you want to burn an option letter on that?  It seems like it might be 
> better
> to search the string for 0x and base the selection of bitmap of list parsing
> based on its presence or absence.
> 
>

The existing coremask parsing always assumes a hex coremask, so just looking
for a 0x will not work. I prefer this scheme of using a new flag for this method
of specifying the cores to use. 

If you don't want to use up a single-letter option, two alternatives:
1) use a long option instead.
2) if the -c parameter includes a "-" or a ",", treat it as a new-style option,
otherwise treat as old. The only abiguity here would be for specifying a single
core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to run on.
[0 is obviously a named core as it's an invalid mask, and A-F are obviously
masks.] If we did want this scheme, I would suggest that we allow trailing
commas in the list specifier, so we can force users to clear ambiguity by
either writing "0x6" or "6," i.e. disallow ambiguous values to avoid problems.
However, this is probably more work that it's worth to avoid using up a letter
option.

I'd prefer any of these options to breaking backward compatibility in this case.

/Bruce


> > Signed-off-by: Didier Pallard 
> > Signed-off-by: Thomas Monjalon 
> > ---
> >  app/test/test_eal_flags.c  | 28 ++-
> >  lib/librte_eal/common/eal_common_options.c | 81 
> > --
> >  2 files changed, 103 insertions(+), 6 deletions(-)
> > 
> > diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
> > index 1f95d7f..5ad89c5 100644
> > --- a/app/test/test_eal_flags.c
> > +++ b/app/test/test_eal_flags.c
> > @@ -484,7 +484,7 @@ test_invalid_r_flag(void)
> >  }
> >  
> >  /*
> > - * Test that the app doesn't run without the coremask flag. In all cases
> > + * Test that the app doesn't run without the coremask/corelist flags. In 
> > all cases
> >   * should give an error and fail to run
> >   */
> >  static int
> > @@ -504,12 +504,22 @@ test_missing_c_flag(void)
> >  
> > /* -c flag but no coremask value */
> > const char *argv1[] = { prgname, prefix, mp_flag, "-n", "3", "-c"};
> > -   /* No -c flag at all */
> > +   /* No -c or -l flag at all */
> > const char *argv2[] = { prgname, prefix, mp_flag, "-n", "3"};
> > /* bad coremask value */
> > const char *argv3[] = { prgname, prefix, mp_flag, "-n", "3", "-c", 
> > "error" };
> > /* sanity check of tests - valid coremask value */
> > const char *argv4[] = { prgname, prefix, mp_flag, "-n", "3", "-c", "1" 
> > };
> > +   /* -l flag but no corelist value */
> > +   const char *argv5[] = { prgname, prefix, mp_flag, "-n", "3", "-l"};
> > +   const char *argv6[] = { prgname, prefix, mp_flag, "-n", "3", "-l", " " 
> > };
> > +   /* bad corelist values */
> > +   const char *argv7[] = { prgname, prefix, mp_flag, "-n", "3", "-l", 
> > "error" };
> > +   const char *argv8[] = { prgname, prefix, mp_flag, "-n", "3", "-l", "1-" 
> > };
> > +   const char *argv9[] = { prgname, prefix, mp_flag, "-n", "3", "-l", "1," 
> > };
> > +   const char *argv10[] = { prgname, prefix, mp_flag, "-n", "3", "-l", 
> > "1#2" };
> > +   /* sanity check test - valid corelist value */
> > +   const char *argv11[] = { prgname, prefix, mp_flag, "-n", "3", "-l", 
> > "1-2,3" };
> >  
> > if (launch_proc(argv1) == 0
> > || launch_proc(argv2) == 0
> > @@ -521,6 +531,20 @@ test_missing_c_flag(void)
> > printf("Error - process did not run ok with valid coremask 
> > value\n");
> > return -1;
> > }
> > +
> > +   if (launch_proc(argv5) == 0
> > +   || launch_proc(argv6) == 0
> > +   || launch_proc(argv7) == 0
> > +   || launch_proc(argv8) == 0
> > +   || launch_proc(argv9) == 0
> > +   || launch_proc(argv10) == 0) {
> > +   printf("Error - process ran without error with invalid -l 
> > flag\n");
> > +   return -1;
> > +   }
> > +   if (launch_proc(argv11) != 0) {
> > +   printf("Error - process did not run ok with valid corelist 
> > value\n");
> > +   return -1;
> > +   }
> > return 0;
> >  }
> >  
> > diff --git a/lib/librte_eal/common/eal_common_options.c 
> > b/lib/librte_eal/common/eal_common_options.c
> > index 63710b0..18d03e3 100644
> > --- a/lib/librte_eal/common/eal_common_options.c
> > +++ b/lib/librte_ea

[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Roger Keith Wiles

> On Nov 24, 2014, at 11:04 AM, Neil Horman  wrote:
> 
> On Mon, Nov 24, 2014 at 10:12:33AM -0600, Roger Keith Wiles wrote:
>> Burn, it is not like we are going to add a huge number of new options in the 
>> future and run out of letters.
>> 
> No, but what about the application authors that need to accomodate all of the
> dpdk command line options as well?

The application authors are not effected. The application authors can use any 
options after the ?--? as DPDK does not define these options correct except in 
the example applications.

> Neil
> 
>>> On Nov 24, 2014, at 8:52 AM, Venkatesan, Venky >> intel.com> wrote:
>>> 
>>> 
>>> On 11/24/2014 5:28 AM, Bruce Richardson wrote:
 On Mon, Nov 24, 2014 at 02:19:16PM +0100, Thomas Monjalon wrote:
> Hi Bruce and Neil,
> 
> 2014-11-24 11:28, Bruce Richardson:
>> On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
>>> On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
 From: Didier Pallard 
 
 In current version, used cores can only be specified using a bitmask.
 It will now be possible to specify cores in 2 different ways:
 - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
 - Using a list in following format: -l [-c2][,c3[-c4],...]
 
 The letter -l can stand for lcore or list.
 
 -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
>>> Do you want to burn an option letter on that?  It seems like it might 
>>> be better
>>> to search the string for 0x and base the selection of bitmap of list 
>>> parsing
>>> based on its presence or absence.
> It was the initial proposal (in April):
>   http://dpdk.org/ml/archives/dev/2014-April/002173.html
> And I liked keeping only 1 option;
>   http://dpdk.org/ml/archives/dev/2014-May/002722.html
> But Anatoly raised the compatibility problem:
>   http://dpdk.org/ml/archives/dev/2014-May/002723.html
> Then there was no other comment so Didier and I reworked a separate 
> option.
> 
>> The existing coremask parsing always assumes a hex coremask, so just 
>> looking
>> for a 0x will not work. I prefer this scheme of using a new flag for 
>> this method
>> of specifying the cores to use.
>> 
>> If you don't want to use up a single-letter option, two alternatives:
>> 1) use a long option instead.
>> 2) if the -c parameter includes a "-" or a ",", treat it as a new-style 
>> option,
>> otherwise treat as old. The only abiguity here would be for specifying a 
>> single
>> core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to 
>> run on.
>> [0 is obviously a named core as it's an invalid mask, and A-F are 
>> obviously
>> masks.] If we did want this scheme, I would suggest that we allow 
>> trailing
>> commas in the list specifier, so we can force users to clear ambiguity by
>> either writing "0x6" or "6," i.e. disallow ambiguous values to avoid 
>> problems.
>> However, this is probably more work that it's worth to avoid using up a 
>> letter
>> option.
>> 
>> I'd prefer any of these options to breaking backward compatibility in 
>> this case.
> We need a consensus here.
> Who is supporting a "burn" of an one-letter option with clear usage?
> Who is supporting a "re-merge" of the 2 syntaxes with more complicated 
> rules
> (list syntax is triggered by presence of "-" or ",")?
> 
 Burn!
>>> Burn ^ 2 ;)
>> 
>> 



[dpdk-dev] [PATCH] eal: fix remaining checks for other 64bits architectures

2014-11-24 Thread chao...@linux.vnet.ibm.com

Quoting David Marchand :

> RTE_ARCH_X86_64 can not be used as a way to determine if we are building for
> 64bits cpus. Instead, RTE_ARCH_64 should be used.
>
> Signed-off-by: David Marchand 
> ---
>  lib/librte_eal/linuxapp/eal/eal.c   |2 +-
>  lib/librte_eal/linuxapp/eal/eal_hugepage_info.c |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c  
> b/lib/librte_eal/linuxapp/eal/eal.c
> index f9517c7..e321524 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -450,7 +450,7 @@ eal_parse_base_virtaddr(const char *arg)
>   return -1;
>
>   /* make sure we don't exceed 32-bit boundary on 32-bit target */
> -#ifndef RTE_ARCH_X86_64
> +#ifndef RTE_ARCH_64
>   if (addr >= UINTPTR_MAX)
>   return -1;
>  #endif
> diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c  
> b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
> index 73d1cdb..590cb56 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
> @@ -324,7 +324,7 @@ eal_hugepage_info_init(void)
>* later they will be sorted */
>   hpi->num_pages[0] = 
> get_num_hugepages(dirent->d_name);
>
> -#ifndef RTE_ARCH_X86_64
> +#ifndef RTE_ARCH_64
>   /* for 32-bit systems, limit number of 
> hugepages to 1GB per page size */
>   hpi->num_pages[0] = RTE_MIN(hpi->num_pages[0],
>   RTE_PGSIZE_1G / 
> hpi->hugepage_sz);
> --
> 1.7.10.4
Acked-by: Chao Zhu 



[dpdk-dev] [PATCH v3 00/14] Patches for DPDK to support Power architecture

2014-11-24 Thread chao...@linux.vnet.ibm.com
David,

My email server just come back. Sorry for the delay.
I'm running the patchcheck and I'll send out the updates later.
Thanks !

Quoting David Marchand :

> Hello Chao,
>
> On Mon, Nov 24, 2014 at 2:22 AM, Chao Zhu 
> wrote:
>
>> The set of patches add IBM Power architecture to the DPDK. It adds the
>> required support to the
>> EAL library. This set of patches doesn't support full DPDK function on
>> Power processors. So a
>> separate common configuration file is used for Power to turn off some
>> un-migrated functions. To
>> compile on PPC64 architecture, GCC version >= 4.8 must be used. This v3
>> patch updates eal_memory.c
>> to fix the memory zone allocation and also solves the compiling problems
>> of test-pmd.
>>
>
> Please run a little checkpath on this patchset.
> There are some issues.
>
> Thanks.
>
> --
> David Marchand




[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Roger Keith Wiles
Burn, it is not like we are going to add a huge number of new options in the 
future and run out of letters.

> On Nov 24, 2014, at 8:52 AM, Venkatesan, Venky  intel.com> wrote:
> 
> 
> On 11/24/2014 5:28 AM, Bruce Richardson wrote:
>> On Mon, Nov 24, 2014 at 02:19:16PM +0100, Thomas Monjalon wrote:
>>> Hi Bruce and Neil,
>>> 
>>> 2014-11-24 11:28, Bruce Richardson:
 On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
> On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
>> From: Didier Pallard 
>> 
>> In current version, used cores can only be specified using a bitmask.
>> It will now be possible to specify cores in 2 different ways:
>> - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
>> - Using a list in following format: -l [-c2][,c3[-c4],...]
>> 
>> The letter -l can stand for lcore or list.
>> 
>> -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
> Do you want to burn an option letter on that?  It seems like it might be 
> better
> to search the string for 0x and base the selection of bitmap of list 
> parsing
> based on its presence or absence.
>>> It was the initial proposal (in April):
>>> http://dpdk.org/ml/archives/dev/2014-April/002173.html
>>> And I liked keeping only 1 option;
>>> http://dpdk.org/ml/archives/dev/2014-May/002722.html
>>> But Anatoly raised the compatibility problem:
>>> http://dpdk.org/ml/archives/dev/2014-May/002723.html
>>> Then there was no other comment so Didier and I reworked a separate option.
>>> 
 The existing coremask parsing always assumes a hex coremask, so just 
 looking
 for a 0x will not work. I prefer this scheme of using a new flag for this 
 method
 of specifying the cores to use.
 
 If you don't want to use up a single-letter option, two alternatives:
 1) use a long option instead.
 2) if the -c parameter includes a "-" or a ",", treat it as a new-style 
 option,
 otherwise treat as old. The only abiguity here would be for specifying a 
 single
 core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to 
 run on.
 [0 is obviously a named core as it's an invalid mask, and A-F are obviously
 masks.] If we did want this scheme, I would suggest that we allow trailing
 commas in the list specifier, so we can force users to clear ambiguity by
 either writing "0x6" or "6," i.e. disallow ambiguous values to avoid 
 problems.
 However, this is probably more work that it's worth to avoid using up a 
 letter
 option.
 
 I'd prefer any of these options to breaking backward compatibility in this 
 case.
>>> We need a consensus here.
>>> Who is supporting a "burn" of an one-letter option with clear usage?
>>> Who is supporting a "re-merge" of the 2 syntaxes with more complicated rules
>>> (list syntax is triggered by presence of "-" or ",")?
>>> 
>> Burn!
> Burn ^ 2 ;)



[dpdk-dev] [PATCH v3 08/14] Add CPU flag checking for IBM Power architecture

2014-11-24 Thread Neil Horman
On Sun, Nov 23, 2014 at 08:22:16PM -0500, Chao Zhu wrote:
> IBM Power processor doesn't have CPU flag hardware registers. This patch
> uses aux vector software register to get CPU flags and add CPU flag
> checking support for IBM Power architecture.
> 
> Signed-off-by: Chao Zhu 
> ---
>  app/test/test_cpuflags.c   |   35 
>  .../common/include/arch/ppc_64/rte_cpuflags.h  |  184 
> 
>  mk/rte.cpuflags.mk |   17 ++
>  3 files changed, 236 insertions(+), 0 deletions(-)
>  create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h
> 
> diff --git a/app/test/test_cpuflags.c b/app/test/test_cpuflags.c
> index 82c0197..5aeba5d 100644
> --- a/app/test/test_cpuflags.c
> +++ b/app/test/test_cpuflags.c
> @@ -80,6 +80,40 @@ test_cpuflags(void)
>   int result;
>   printf("\nChecking for flags from different registers...\n");
>  
> +#ifdef RTE_ARCH_PPC_64
> + printf("Check for PPC64:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_PPC64);
> +
> + printf("Check for PPC32:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_PPC32);
> +
> + printf("Check for VSX:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_VSX);
> +
> + printf("Check for DFP:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_DFP);
> +
> + printf("Check for FPU:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_FPU);
> +
> + printf("Check for SMT:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_SMT);
> +
> + printf("Check for MMU:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_MMU);
> +
> + printf("Check for ALTIVEC:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_ALTIVEC);
> +
> + printf("Check for ARCH_2_06:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_ARCH_2_06);
> +
> + printf("Check for ARCH_2_07:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_ARCH_2_07);
> +
> + printf("Check for ICACHE_SNOOP:\t\t");
> + CHECK_FOR_FLAG(RTE_CPUFLAG_ICACHE_SNOOP);
> +#else
>   printf("Check for SSE:\t\t");
>   CHECK_FOR_FLAG(RTE_CPUFLAG_SSE);
>  
> @@ -117,6 +151,7 @@ test_cpuflags(void)
>   CHECK_FOR_FLAG(RTE_CPUFLAG_INVTSC);
>  
>  
> +#endif
>  
>   /*
>* Check if invalid data is handled properly
> diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h 
> b/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h
> new file mode 100644
> index 000..6b38f1c
> --- /dev/null
> +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h
> @@ -0,0 +1,184 @@
> +/*
> + *   BSD LICENSE
> + *
> + *   Copyright (C) IBM Corporation 2014.
> + *
> + *   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 IBM 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.
> +*/
> +
> +#ifndef _RTE_CPUFLAGS_PPC_64_H_
> +#define _RTE_CPUFLAGS_PPC_64_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "generic/rte_cpuflags.h"
> +
> +/* Symbolic values for the entries in the auxiliary table */
> +#define AT_HWCAP  16
> +#define AT_HWCAP2 26
> +
> +/* software based registers */
> +enum cpu_register_t {
> + REG_HWCAP = 0,
> + REG_HWCAP2,
> +};
> +
> +/**
> + * Enumeration of all CPU features supported
> + */
> +enum rte_cpu_flag_t {
> + RTE_CPUFLAG_PPC_LE = 0,
> + RTE_CPUFLAG_TRUE_LE,
> + RTE_CPUFLAG_PSERIES_PERFMON_COMPAT,
> + RTE_CPUFLAG_VSX,
> + RTE_CPUFLAG_ARCH_2_06,
> + RTE_CPUFLAG_POWER6_EXT,
> + RTE_CPUFLAG_DFP,
> + RTE_CPUFLAG_PA6T,
> +

[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Neil Horman
On Mon, Nov 24, 2014 at 01:37:03PM +, Burakov, Anatoly wrote:
> > > > > Do you want to burn an option letter on that?  It seems like it
> > > > > might be better to search the string for 0x and base the selection
> > > > > of bitmap of list parsing based on its presence or absence.
> > >
> > > It was the initial proposal (in April):
> > >   http://dpdk.org/ml/archives/dev/2014-April/002173.html
> > > And I liked keeping only 1 option;
> > >   http://dpdk.org/ml/archives/dev/2014-May/002722.html
> > > But Anatoly raised the compatibility problem:
> > >   http://dpdk.org/ml/archives/dev/2014-May/002723.html
> > > Then there was no other comment so Didier and I reworked a separate
> > option.
> > >
> > > > The existing coremask parsing always assumes a hex coremask, so just
> > > > looking for a 0x will not work. I prefer this scheme of using a new
> > > > flag for this method of specifying the cores to use.
> > > >
> > > > If you don't want to use up a single-letter option, two alternatives:
> > > > 1) use a long option instead.
> > > > 2) if the -c parameter includes a "-" or a ",", treat it as a
> > > > new-style option, otherwise treat as old. The only abiguity here
> > > > would be for specifying a single core value 1-9 e.g. is "-c 6" a mask 
> > > > with
> > two bits, or a single-core to run on.
> > > > [0 is obviously a named core as it's an invalid mask, and A-F are
> > > > obviously masks.] If we did want this scheme, I would suggest that
> > > > we allow trailing commas in the list specifier, so we can force
> > > > users to clear ambiguity by either writing "0x6" or "6," i.e. disallow
> > ambiguous values to avoid problems.
> > > > However, this is probably more work that it's worth to avoid using
> > > > up a letter option.
> > > >
> > > > I'd prefer any of these options to breaking backward compatibility in 
> > > > this
> > case.
> > >
> > > We need a consensus here.
> > > Who is supporting a "burn" of an one-letter option with clear usage?
> > > Who is supporting a "re-merge" of the 2 syntaxes with more complicated
> > > rules (list syntax is triggered by presence of "-" or ",")?
> > >
> > 
> > Burn!
> 
> I would still prefer a long option (we already have a coremask parameter, so 
> another one is kind-of non-essential and IMO shouldn't belong in a scarce 
> resource of one-letter parameters), but if everyone else agrees, the "burn" 
> option is much more preferable to me than complicating syntax of an already 
> existing parameter.
> 
If we can't support two syntaxes with a single option (which still seems
reasonable to me, but I digress), then I would support the additional long
option.  Short options are not only scarse on their own, but they also have to
potentially comingle with options parsed by an application building on the DPDK.
At least with a long option the chances of a conflict are lessened.
Neil

> Thanks,
> Anatoly
> 


[dpdk-dev] [PATCH v2 1/2] lib/librte_pmd_i40e: set vlan filter fix

2014-11-24 Thread Qiu, Michael
On 11/10/2014 2:42 PM, Xie, Huawei wrote:
>
>> -Original Message-
>> From: Zhang, Helin
>> Sent: Sunday, November 09, 2014 10:09 PM
>> To: Xie, Huawei; dev at dpdk.org
>> Subject: RE: [dpdk-dev] [PATCH v2 1/2] lib/librte_pmd_i40e: set vlan filter 
>> fix
>>
>>
>>
>>> -Original Message-
>>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Huawei Xie
>>> Sent: Monday, November 10, 2014 10:46 AM
>>> To: dev at dpdk.org
>>> Subject: [dpdk-dev] [PATCH v2 1/2] lib/librte_pmd_i40e: set vlan filter fix
>>>
>>> ">> 5" rather than ">> 4"
>>>
>>> Signed-off-by: Huawei Xie 
>>> ---
>>>  lib/librte_pmd_i40e/i40e_ethdev.c | 7 ++-
>>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
>>> b/lib/librte_pmd_i40e/i40e_ethdev.c
>>> index 5074262..c0cf3cf 100644
>>> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
>>> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
>>> @@ -4048,14 +4048,11 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi,  {
>>> uint32_t vid_idx, vid_bit;
>>>
>>> -#define UINT32_BIT_MASK  0x1F
>>> -#define VALID_VLAN_BIT_MASK  0xFFF
>>> /* VFTA is 32-bits size array, each element contains 32 vlan bits, Find 
>>> the
>>>  *  element first, then find the bits it belongs to
>>>  */
>>> -   vid_idx = (uint32_t) ((vlan_id & VALID_VLAN_BIT_MASK) >>
>>> - sizeof(uint32_t));
>>> -   vid_bit = (uint32_t) (1 << (vlan_id & UINT32_BIT_MASK));
>>> +   vid_idx = (uint32_t) ((vlan_id >> 5 ) & 0x7F);




   No need additional space after '5'
>>> +   vid_bit = (uint32_t) (1 << (vlan_id & 0x1F));
>> I don't understand why remove macros and use numeric instead?
> Those macros are wrongly defined. Correct macros are defined in second patch.

Is there any issue to swap your patch order, and use your defined macros
here? That would be much better if no other issue.

Thanks,
Michael
>>> if (on)
>>> vsi->vfta[vid_idx] |= vid_bit;
>>> --
>>> 1.8.1.4
>> Regards,
>> Helin



[dpdk-dev] [PATCH v3 03/14] Add byte order operations for IBM Power architecture

2014-11-24 Thread Qiu, Michael
On 11/23/2014 9:22 PM, Chao Zhu wrote:
> This patch adds architecture specific byte order operations for IBM Power
> architecture. Power architecture support both big endian and little
> endian. This patch also adds a RTE_ARCH_BIG_ENDIAN micro.
>
> Signed-off-by: Chao Zhu 
> ---
>  config/defconfig_ppc_64-power8-linuxapp-gcc|1 +
>  .../common/include/arch/ppc_64/rte_byteorder.h |  150 
> 
>  2 files changed, 151 insertions(+), 0 deletions(-)
>  create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_byteorder.h
>
> diff --git a/config/defconfig_ppc_64-power8-linuxapp-gcc 
> b/config/defconfig_ppc_64-power8-linuxapp-gcc
> index 97d72ff..b10f60c 100644
> --- a/config/defconfig_ppc_64-power8-linuxapp-gcc
> +++ b/config/defconfig_ppc_64-power8-linuxapp-gcc
> @@ -34,6 +34,7 @@ CONFIG_RTE_MACHINE="power8"
>  
>  CONFIG_RTE_ARCH="ppc_64"
>  CONFIG_RTE_ARCH_PPC_64=y
> +CONFIG_RTE_ARCH_BIG_ENDIAN=y

Does this means default is Big Endian,  if I runs it in little endian
mode, I need to change it manually?
>  
>  CONFIG_RTE_TOOLCHAIN="gcc"
>  CONFIG_RTE_TOOLCHAIN_GCC=y
> diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_byteorder.h 
> b/lib/librte_eal/common/include/arch/ppc_64/rte_byteorder.h
> new file mode 100644
> index 000..a593e8a
> --- /dev/null
> +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_byteorder.h
> @@ -0,0 +1,150 @@
> +/*
> + *   BSD LICENSE
> + *
> + *   Copyright (C) IBM Corporation 2014.
> + *
> + *   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 IBM 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.
> +*/
> +
> +/* Inspired from FreeBSD src/sys/powerpc/include/endian.h
> + * Copyright (c) 1987, 1991, 1993
> + * The Regents of the University of California.  All rights reserved.
> +*/
> +
> +#ifndef _RTE_BYTEORDER_PPC_64_H_
> +#define _RTE_BYTEORDER_PPC_64_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "generic/rte_byteorder.h"
> +
> +/*
> + * An architecture-optimized byte swap for a 16-bit value.
> + *
> + * Do not use this function directly. The preferred function is 
> rte_bswap16().
> + */
> +static inline uint16_t rte_arch_bswap16(uint16_t _x)
> +{
> + return ((_x >> 8) | ((_x << 8) & 0xff00));
> +}
> +
> +/*
> + * An architecture-optimized byte swap for a 32-bit value.
> + *
> + * Do not use this function directly. The preferred function is 
> rte_bswap32().
> + */
> +static inline uint32_t rte_arch_bswap32(uint32_t _x)
> +{
> + return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff) |
> + ((_x << 24) & 0xff00));
> +}
> +
> +/*
> + * An architecture-optimized byte swap for a 64-bit value.
> + *
> +  * Do not use this function directly. The preferred function is 
> rte_bswap64().
> + */
> +/* 64-bit mode */
> +static inline uint64_t rte_arch_bswap64(uint64_t _x)
> +{
> + return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff) |
> + ((_x >> 8) & 0xff00) | ((_x << 8) & (0xffULL << 32)) |
> + ((_x << 24) & (0xffULL << 40)) |
> + ((_x << 40) & (0xffULL << 48)) | ((_x << 56)));
> +}
> +
> +#ifndef RTE_FORCE_INTRINSICS
> +#define rte_bswap16(x) ((uint16_t)(__builtin_constant_p(x) ? \
> +rte_constant_bswap16(x) :\
> +rte_arch_bswap16(x)))
> +
> +#define rte_bswap32(x) ((uint32_t)(__builtin_constant_p(x) ? \
> +   

[dpdk-dev] [PATCH 07/10] eal: add core list input format

2014-11-24 Thread Venkatesan, Venky

On 11/24/2014 5:28 AM, Bruce Richardson wrote:
> On Mon, Nov 24, 2014 at 02:19:16PM +0100, Thomas Monjalon wrote:
>> Hi Bruce and Neil,
>>
>> 2014-11-24 11:28, Bruce Richardson:
>>> On Sat, Nov 22, 2014 at 08:35:17PM -0500, Neil Horman wrote:
 On Sat, Nov 22, 2014 at 10:43:39PM +0100, Thomas Monjalon wrote:
> From: Didier Pallard 
>
> In current version, used cores can only be specified using a bitmask.
> It will now be possible to specify cores in 2 different ways:
> - Using a bitmask (-c [0x]nnn): bitmask must be in hex format
> - Using a list in following format: -l [-c2][,c3[-c4],...]
>
> The letter -l can stand for lcore or list.
>
> -l 0-7,16-23,31 being equivalent to -c 0x80FF00FF
 Do you want to burn an option letter on that?  It seems like it might be 
 better
 to search the string for 0x and base the selection of bitmap of list 
 parsing
 based on its presence or absence.
>> It was the initial proposal (in April):
>>  http://dpdk.org/ml/archives/dev/2014-April/002173.html
>> And I liked keeping only 1 option;
>>  http://dpdk.org/ml/archives/dev/2014-May/002722.html
>> But Anatoly raised the compatibility problem:
>>  http://dpdk.org/ml/archives/dev/2014-May/002723.html
>> Then there was no other comment so Didier and I reworked a separate option.
>>
>>> The existing coremask parsing always assumes a hex coremask, so just looking
>>> for a 0x will not work. I prefer this scheme of using a new flag for this 
>>> method
>>> of specifying the cores to use.
>>>
>>> If you don't want to use up a single-letter option, two alternatives:
>>> 1) use a long option instead.
>>> 2) if the -c parameter includes a "-" or a ",", treat it as a new-style 
>>> option,
>>> otherwise treat as old. The only abiguity here would be for specifying a 
>>> single
>>> core value 1-9 e.g. is "-c 6" a mask with two bits, or a single-core to run 
>>> on.
>>> [0 is obviously a named core as it's an invalid mask, and A-F are obviously
>>> masks.] If we did want this scheme, I would suggest that we allow trailing
>>> commas in the list specifier, so we can force users to clear ambiguity by
>>> either writing "0x6" or "6," i.e. disallow ambiguous values to avoid 
>>> problems.
>>> However, this is probably more work that it's worth to avoid using up a 
>>> letter
>>> option.
>>>
>>> I'd prefer any of these options to breaking backward compatibility in this 
>>> case.
>> We need a consensus here.
>> Who is supporting a "burn" of an one-letter option with clear usage?
>> Who is supporting a "re-merge" of the 2 syntaxes with more complicated rules
>> (list syntax is triggered by presence of "-" or ",")?
>>
> Burn!
Burn ^ 2 ;)


[dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

2014-11-24 Thread Neil Horman
On Mon, Nov 24, 2014 at 05:45:54AM +, Sujith Sankar (ssujith) wrote:
> 
> 
> On 24/11/14 5:47 am, "Neil Horman"  wrote:
> 
> >On Sun, Nov 23, 2014 at 09:38:19PM +0530, Sujith Sankar wrote:
> >> Signed-off-by: Sujith Sankar 
> >> ---
> >>  config/common_linuxapp | 5 +
> >>  lib/Makefile   | 1 +
> >>  lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 7 +++
> >>  lib/librte_eal/linuxapp/eal/include/eal_pci_init.h | 1 +
> >>  mk/rte.app.mk  | 4 
> >>  5 files changed, 18 insertions(+)
> >> 
> >> diff --git a/config/common_linuxapp b/config/common_linuxapp
> >> index 57b61c9..3c091e7 100644
> >> --- a/config/common_linuxapp
> >> +++ b/config/common_linuxapp
> >> @@ -210,6 +210,11 @@ CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM=4
> >>  CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
> >>  
> >>  #
> >> +# Compile burst-oriented Cisco ENIC PMD driver
> >> +#
> >> +CONFIG_RTE_LIBRTE_ENIC_PMD=y
> >> +
> >> +#
> >>  # Compile burst-oriented VIRTIO PMD driver
> >>  #
> >>  CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
> >> diff --git a/lib/Makefile b/lib/Makefile
> >> index e3237ff..1911790 100644
> >> --- a/lib/Makefile
> >> +++ b/lib/Makefile
> >> @@ -43,6 +43,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
> >>  DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
> >>  DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += librte_pmd_e1000
> >>  DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_ixgbe
> >> +DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_enic
> >>  DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e
> >>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond
> >>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring
> >> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> >>b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> >> index c776ddc..6bf8f2e 100644
> >> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> >> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> >> @@ -736,6 +736,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
> >>maps[i].offset = reg.offset;
> >>maps[i].size = reg.size;
> >>dev->mem_resource[i].addr = bar_addr;
> >> +  dev->mem_resource[i].len = reg.size;
> >>}
> >>  
> >>/* if secondary process, do not set up interrupts */
> >> @@ -791,4 +792,10 @@ pci_vfio_is_enabled(void)
> >>  {
> >>return vfio_cfg.vfio_enabled;
> >>  }
> >> +
> >> +int
> >> +pci_vfio_container_fd(void)
> >> +{
> >> +  return vfio_cfg.vfio_container_fd;
> >> +}
> >You should move this function definition to a separate patch and put it
> >earlier
> >in the series, as you call this function two patches back.
> 
> Thanks for the comment, Neil.  I shall move this to a separate patch and
> put it earlier in the series.
> 
> >
> >Also, this gives me pause, as it seems like you're working around the
> >VFIO api.
> >From what I see, you just use this to get an fd that you can use in an
> >ioctl to
> >set some DMA settings.  First off, theres already a function called
> >pci_vfio_get_container_fd, which does exactly what you are doing here,
> >with
> >additional safety checking.
> >
> >However, even though there is an existing function to do what you want, I
> >would
> >recommend that you not use it for your purposes.  Whenever you expose
> >something
> >like a file descriptor, you run the risk of multiple accessors racing
> >trying to
> >set/unset features and preform operations.  It would be better if you
> >could add
> >apropriate api calls to vfio interface to set what you want.  That way the
> >library can add appropriate locking if/when needed
> 
> 
> I see that vfio_cfg.vfio_container_fd is obtained and stored in
> pci_vfio_enable(), and this is not modified later.
> ENIC PMD needs it to add the IOMMU mapping for buffers used for
> communicating with adapter firmware.  That?s just adding an entry, and
> container fd is just passed as an argument.  So the following addition in
> eal_pci_vfio.c should be sufficient.  Since vfio_cfg is per process, I do
> not think that any other checking is required.
> 
> int
> pci_vfio_map_dma(struct vfio_iommu_type1_dma_map *dma_map)
> {
>   return ioctl(vfio_cfg.vfio_container_fd, VFIO_IOMMU_MAP_DMA, dma_map);
> }
> 
> 
> 
> Does this look alright?  Do you think that I?ve missed out anything here?
> 
It looks better yes, but I'm still confused as to why its necessecary.  Looking
back at your use of the fd, you're adding an iov entry for a buffer allocated
via rte_memzone_reserve, which should come out of the dpdk's configured memory.
In pci_vfio_setup_dma_maps, which is part of the pci probe path in eal library,
all of the DPDK's physically available memory is already mapped into the iommu
in a 1:1 fashion.  So why do you need to do this again?

Neil



[dpdk-dev] [PATCH v3 6/6] DPDK changes for accommodating ENIC PMD

2014-11-24 Thread Sujith Sankar (ssujith)


On 24/11/14 5:47 am, "Neil Horman"  wrote:

>On Sun, Nov 23, 2014 at 09:38:19PM +0530, Sujith Sankar wrote:
>> Signed-off-by: Sujith Sankar 
>> ---
>>  config/common_linuxapp | 5 +
>>  lib/Makefile   | 1 +
>>  lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 7 +++
>>  lib/librte_eal/linuxapp/eal/include/eal_pci_init.h | 1 +
>>  mk/rte.app.mk  | 4 
>>  5 files changed, 18 insertions(+)
>> 
>> diff --git a/config/common_linuxapp b/config/common_linuxapp
>> index 57b61c9..3c091e7 100644
>> --- a/config/common_linuxapp
>> +++ b/config/common_linuxapp
>> @@ -210,6 +210,11 @@ CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM=4
>>  CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
>>  
>>  #
>> +# Compile burst-oriented Cisco ENIC PMD driver
>> +#
>> +CONFIG_RTE_LIBRTE_ENIC_PMD=y
>> +
>> +#
>>  # Compile burst-oriented VIRTIO PMD driver
>>  #
>>  CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
>> diff --git a/lib/Makefile b/lib/Makefile
>> index e3237ff..1911790 100644
>> --- a/lib/Makefile
>> +++ b/lib/Makefile
>> @@ -43,6 +43,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
>>  DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
>>  DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += librte_pmd_e1000
>>  DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_ixgbe
>> +DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_enic
>>  DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e
>>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond
>>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring
>> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>>b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> index c776ddc..6bf8f2e 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
>> @@ -736,6 +736,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
>>  maps[i].offset = reg.offset;
>>  maps[i].size = reg.size;
>>  dev->mem_resource[i].addr = bar_addr;
>> +dev->mem_resource[i].len = reg.size;
>>  }
>>  
>>  /* if secondary process, do not set up interrupts */
>> @@ -791,4 +792,10 @@ pci_vfio_is_enabled(void)
>>  {
>>  return vfio_cfg.vfio_enabled;
>>  }
>> +
>> +int
>> +pci_vfio_container_fd(void)
>> +{
>> +return vfio_cfg.vfio_container_fd;
>> +}
>You should move this function definition to a separate patch and put it
>earlier
>in the series, as you call this function two patches back.

Thanks for the comment, Neil.  I shall move this to a separate patch and
put it earlier in the series.

>
>Also, this gives me pause, as it seems like you're working around the
>VFIO api.
>From what I see, you just use this to get an fd that you can use in an
>ioctl to
>set some DMA settings.  First off, theres already a function called
>pci_vfio_get_container_fd, which does exactly what you are doing here,
>with
>additional safety checking.
>
>However, even though there is an existing function to do what you want, I
>would
>recommend that you not use it for your purposes.  Whenever you expose
>something
>like a file descriptor, you run the risk of multiple accessors racing
>trying to
>set/unset features and preform operations.  It would be better if you
>could add
>apropriate api calls to vfio interface to set what you want.  That way the
>library can add appropriate locking if/when needed


I see that vfio_cfg.vfio_container_fd is obtained and stored in
pci_vfio_enable(), and this is not modified later.
ENIC PMD needs it to add the IOMMU mapping for buffers used for
communicating with adapter firmware.  That?s just adding an entry, and
container fd is just passed as an argument.  So the following addition in
eal_pci_vfio.c should be sufficient.  Since vfio_cfg is per process, I do
not think that any other checking is required.

int
pci_vfio_map_dma(struct vfio_iommu_type1_dma_map *dma_map)
{
return ioctl(vfio_cfg.vfio_container_fd, VFIO_IOMMU_MAP_DMA, dma_map);
}



Does this look alright?  Do you think that I?ve missed out anything here?

Thanks,
-Sujith


>
>Neil
>
>>  #endif
>> diff --git a/lib/librte_eal/linuxapp/eal/include/eal_pci_init.h
>>b/lib/librte_eal/linuxapp/eal/include/eal_pci_init.h
>> index d758bee..c9e9e40 100644
>> --- a/lib/librte_eal/linuxapp/eal/include/eal_pci_init.h
>> +++ b/lib/librte_eal/linuxapp/eal/include/eal_pci_init.h
>> @@ -71,6 +71,7 @@ int pci_uio_map_resource(struct rte_pci_device *dev);
>>  
>>  int pci_vfio_enable(void);
>>  int pci_vfio_is_enabled(void);
>> +int pci_vfio_container_fd(void);
>>  int pci_vfio_mp_sync_setup(void);
>>  
>>  /* map VFIO resource prototype */
>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
>> index 285b65c..95c652f 100644
>> --- a/mk/rte.app.mk
>> +++ b/mk/rte.app.mk
>> @@ -186,6 +186,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
>>  LDLIBS += -lrte_pmd_vmxnet3_uio
>>  endif
>>  
>> +ifeq ($(CONFIG_RTE_LIBRTE_ENIC_PMD),y)
>> +LDLIBS += -lrte_pmd_enic
>> +endif
>> +
>>  ifeq 

[dpdk-dev] [PATCH v3] i40e: fixed tx packets stats bug

2014-11-24 Thread Zhang, Helin
Hi Zhida

Please rework your patch and send a new version according to the comments from 
Thomas! Commit log was missed in your patch.

Regards,
Helin

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of zhida zang
> Sent: Friday, November 21, 2014 4:07 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v3] i40e: fixed tx packets stats bug
> 
> v3 changes:
> -updated commit log
> -fixed the bug that stats data can't be cleared
> 
> Signed-off-by: Zhida Zang 
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> b/lib/librte_pmd_i40e/i40e_ethdev.c
> index 4b7a827..c1ea37e 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -1102,6 +1102,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct
> rte_eth_stats *stats)
>   struct i40e_hw *hw =
> I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>   struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */
>   struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */
> + struct i40e_eth_stats *ves = &pf->main_vsi->eth_stats; /* vsi stats */
> 
>   /* Get statistics of struct i40e_eth_stats */
>   i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), @@ -1277,15
> +1278,18 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats
> *stats)
>   /* GLPRT_MSPDC not supported */
>   /* GLPRT_XEC not supported */
> 
> - pf->offset_loaded = true;
> -
>   if (pf->main_vsi)
>   i40e_update_vsi_stats(pf->main_vsi);
> 
>   stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
>   ns->eth.rx_broadcast;
> - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
> + if (pf->offset_loaded)
> + stats->opackets = ves->tx_unicast + ves->tx_multicast +
> + ves->tx_broadcast;
> + else
> + stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
>   ns->eth.tx_broadcast;
> + pf->offset_loaded = true;
>   stats->ibytes   = ns->eth.rx_bytes;
>   stats->obytes   = ns->eth.tx_bytes;
>   stats->oerrors  = ns->eth.tx_errors;
> --
> 1.9.3