[dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS

2014-12-25 Thread Vlad Zolotarov

On 12/25/14 04:43, Ouyang, Changchun wrote:
> Hi,
> Sorry miss some comments, so continue my response below,
>
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Wednesday, December 24, 2014 6:40 PM
>> To: Ouyang, Changchun; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS
>>
>>
>> On 12/24/14 07:23, Ouyang Changchun wrote:
>>> It needs config RSS and IXGBE_MRQC and IXGBE_VFPSRTYPE to enable VF
>> RSS.
>>> The psrtype will determine how many queues the received packets will
>>> distribute to, and the value of psrtype should depends on both facet:
>>> max VF rxq number which has been negotiated with PF, and the number of
>> rxq specified in config on guest.
>>> Signed-off-by: Changchun Ouyang 
>>> ---
>>>lib/librte_pmd_ixgbe/ixgbe_pf.c   | 15 +++
>>>lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 92
>> ++-
>>>2 files changed, 97 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> b/lib/librte_pmd_ixgbe/ixgbe_pf.c index cbb0145..9c9dad8 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> @@ -187,6 +187,21 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
>> *eth_dev)
>>> IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(hw-
>>> mac.num_rar_entries), 0);
>>> IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(hw-
>>> mac.num_rar_entries), 0);
>>>
>>> +   /*
>>> +* VF RSS can support at most 4 queues for each VF, even if
>>> +* 8 queues are available for each VF, it need refine to 4
>>> +* queues here due to this limitation, otherwise no queue
>>> +* will receive any packet even RSS is enabled.
>> According to Table 7-3 in the 82599 spec RSS is not available when port is
>> configured to have 8 queues per pool. This means that if u see this
>> configuration u may immediately disable RSS flow in your code.
>>
>>> +*/
>>> +   if (eth_dev->data->dev_conf.rxmode.mq_mode ==
>> ETH_MQ_RX_VMDQ_RSS) {
>>> +   if (RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool == 8) {
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).active =
>> ETH_32_POOLS;
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 4;
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =
>>> +   dev_num_vf(eth_dev) * 4;
>> According to 82599 spec u can't do that since RSS is not allowed when port is
>> configured to have 8 function per-VF. Have u verified that this works? If 
>> yes,
>> then spec should be updated.
>>
>>> +   }
>>> +   }
>>> +
>>> /* set VMDq map to default PF pool */
>>> hw->mac.ops.set_vmdq(hw, 0,
>>> RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
>>>
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> index f69abda..a7c17a4 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> @@ -3327,6 +3327,39 @@ ixgbe_alloc_rx_queue_mbufs(struct
>> igb_rx_queue *rxq)
>>>}
>>>
>>>static int
>>> +ixgbe_config_vf_rss(struct rte_eth_dev *dev) {
>>> +   struct ixgbe_hw *hw;
>>> +   uint32_t mrqc;
>>> +
>>> +   ixgbe_rss_configure(dev);
>>> +
>>> +   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>>> +
>>> +   /* MRQC: enable VF RSS */
>>> +   mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC);
>>> +   mrqc &= ~IXGBE_MRQC_MRQE_MASK;
>>> +   switch (RTE_ETH_DEV_SRIOV(dev).active) {
>>> +   case ETH_64_POOLS:
>>> +   mrqc |= IXGBE_MRQC_VMDQRSS64EN;
>>> +   break;
>>> +
>>> +   case ETH_32_POOLS:
>>> +   case ETH_16_POOLS:
>>> +   mrqc |= IXGBE_MRQC_VMDQRSS32EN;
>> Again, this contradicts with the spec.
> Yes, the spec say the hw can't support vf rss at all, but experiment find 
> that could be done.

I have just realized something - why did u have to experiment at all? U 
work at Intel, don't u? Can't u just ask a HW engineer that have 
designed this NIC? What do u mean by an "experiment" here?
 From my experience u can't just write some random values in the 
registers and conclude that if it worked for like 5 minutes it will 
continue to work for the next minute... There is always a clear 
procedure of how HW should be initialized and used and that's the only 
way it may be used since this was the way the HW has been tested. U 
can't assume anything in regards to reliability if u don't follow specs 
and programmer manuals of HW provider.

Could u clarify, please?

> We can focus on discussing the implementation firstly.
>   
>>> +   break;
>>> +
>>> +   default:
>>> +   PMD_INIT_LOG(ERR, "Invalid pool number in IOV mode");
>>> +   return -EINVAL;
>>> +   }
>>> +
>>> +   IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
>>> +
>>> +   return 0;
>>> +}
>>> +
>>> +static int
>>>ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
>>>{
>>> struct ixgbe_hw *hw =
>>> @@ -3358,24 +3391,38 @@ ixgbe_dev_mq_rx_configure(struct
>> rte_eth_dev *dev)
>>> 

[dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS

2014-12-25 Thread Vlad Zolotarov

On 12/25/14 04:43, Ouyang, Changchun wrote:
> Hi,
> Sorry miss some comments, so continue my response below,
>
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Wednesday, December 24, 2014 6:40 PM
>> To: Ouyang, Changchun; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS
>>
>>
>> On 12/24/14 07:23, Ouyang Changchun wrote:
>>> It needs config RSS and IXGBE_MRQC and IXGBE_VFPSRTYPE to enable VF
>> RSS.
>>> The psrtype will determine how many queues the received packets will
>>> distribute to, and the value of psrtype should depends on both facet:
>>> max VF rxq number which has been negotiated with PF, and the number of
>> rxq specified in config on guest.
>>> Signed-off-by: Changchun Ouyang 
>>> ---
>>>lib/librte_pmd_ixgbe/ixgbe_pf.c   | 15 +++
>>>lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 92
>> ++-
>>>2 files changed, 97 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> b/lib/librte_pmd_ixgbe/ixgbe_pf.c index cbb0145..9c9dad8 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> @@ -187,6 +187,21 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
>> *eth_dev)
>>> IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(hw-
>>> mac.num_rar_entries), 0);
>>> IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(hw-
>>> mac.num_rar_entries), 0);
>>>
>>> +   /*
>>> +* VF RSS can support at most 4 queues for each VF, even if
>>> +* 8 queues are available for each VF, it need refine to 4
>>> +* queues here due to this limitation, otherwise no queue
>>> +* will receive any packet even RSS is enabled.
>> According to Table 7-3 in the 82599 spec RSS is not available when port is
>> configured to have 8 queues per pool. This means that if u see this
>> configuration u may immediately disable RSS flow in your code.
>>
>>> +*/
>>> +   if (eth_dev->data->dev_conf.rxmode.mq_mode ==
>> ETH_MQ_RX_VMDQ_RSS) {
>>> +   if (RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool == 8) {
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).active =
>> ETH_32_POOLS;
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 4;
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =
>>> +   dev_num_vf(eth_dev) * 4;
>> According to 82599 spec u can't do that since RSS is not allowed when port is
>> configured to have 8 function per-VF. Have u verified that this works? If 
>> yes,
>> then spec should be updated.
>>
>>> +   }
>>> +   }
>>> +
>>> /* set VMDq map to default PF pool */
>>> hw->mac.ops.set_vmdq(hw, 0,
>>> RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
>>>
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> index f69abda..a7c17a4 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> @@ -3327,6 +3327,39 @@ ixgbe_alloc_rx_queue_mbufs(struct
>> igb_rx_queue *rxq)
>>>}
>>>
>>>static int
>>> +ixgbe_config_vf_rss(struct rte_eth_dev *dev) {
>>> +   struct ixgbe_hw *hw;
>>> +   uint32_t mrqc;
>>> +
>>> +   ixgbe_rss_configure(dev);
>>> +
>>> +   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>>> +
>>> +   /* MRQC: enable VF RSS */
>>> +   mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC);
>>> +   mrqc &= ~IXGBE_MRQC_MRQE_MASK;
>>> +   switch (RTE_ETH_DEV_SRIOV(dev).active) {
>>> +   case ETH_64_POOLS:
>>> +   mrqc |= IXGBE_MRQC_VMDQRSS64EN;
>>> +   break;
>>> +
>>> +   case ETH_32_POOLS:
>>> +   case ETH_16_POOLS:
>>> +   mrqc |= IXGBE_MRQC_VMDQRSS32EN;
>> Again, this contradicts with the spec.
> Yes, the spec say the hw can't support vf rss at all, but experiment find 
> that could be done.

The spec explicitly say that VF RSS *is* supported in particular in the 
table mentioned above.
What your code is doing is that in case of 16 VFs u setup a 32 pools 
configuration and use only 16 out of them.

> We can focus on discussing the implementation firstly.

>   
>>> +   break;
>>> +
>>> +   default:
>>> +   PMD_INIT_LOG(ERR, "Invalid pool number in IOV mode");
>>> +   return -EINVAL;
>>> +   }
>>> +
>>> +   IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
>>> +
>>> +   return 0;
>>> +}
>>> +
>>> +static int
>>>ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
>>>{
>>> struct ixgbe_hw *hw =
>>> @@ -3358,24 +3391,38 @@ ixgbe_dev_mq_rx_configure(struct
>> rte_eth_dev *dev)
>>> default: ixgbe_rss_disable(dev);
>>> }
>>> } else {
>>> -   switch (RTE_ETH_DEV_SRIOV(dev).active) {
>>> /*
>>>  * SRIOV active scheme
>>>  * FIXME if support DCB/RSS together with VMDq & SRIOV
>>>  */
>>> -   case ETH_64_POOLS:
>>> -   IXGBE_WRITE_REG(hw, IXGBE_MRQC,
>> IXGBE_MRQC_VMDQEN);
>>> +   switch (dev->data->dev_conf.rxmode.mq_mode) {
>>> +   

[dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS

2014-12-25 Thread Vlad Zolotarov

On 12/25/14 04:14, Ouyang, Changchun wrote:
> Hi,
>
>> -Original Message-
>> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
>> Sent: Wednesday, December 24, 2014 6:40 PM
>> To: Ouyang, Changchun; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS
>>
>>
>> On 12/24/14 07:23, Ouyang Changchun wrote:
>>> It needs config RSS and IXGBE_MRQC and IXGBE_VFPSRTYPE to enable VF
>> RSS.
>>> The psrtype will determine how many queues the received packets will
>>> distribute to, and the value of psrtype should depends on both facet:
>>> max VF rxq number which has been negotiated with PF, and the number of
>> rxq specified in config on guest.
>>> Signed-off-by: Changchun Ouyang 
>>> ---
>>>lib/librte_pmd_ixgbe/ixgbe_pf.c   | 15 +++
>>>lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 92
>> ++-
>>>2 files changed, 97 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> b/lib/librte_pmd_ixgbe/ixgbe_pf.c index cbb0145..9c9dad8 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
>>> @@ -187,6 +187,21 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
>> *eth_dev)
>>> IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(hw-
>>> mac.num_rar_entries), 0);
>>> IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(hw-
>>> mac.num_rar_entries), 0);
>>>
>>> +   /*
>>> +* VF RSS can support at most 4 queues for each VF, even if
>>> +* 8 queues are available for each VF, it need refine to 4
>>> +* queues here due to this limitation, otherwise no queue
>>> +* will receive any packet even RSS is enabled.
>> According to Table 7-3 in the 82599 spec RSS is not available when port is
>> configured to have 8 queues per pool. This means that if u see this
>> configuration u may immediately disable RSS flow in your code.
>>
> 8 queues here means the available number queue per vf, it is calculated 
> according to max vfs,
> e.g. if max vfs is 16(or less than), then each vf 'COULD' have 8 queues 
> evenly, pf early init stage estimate this value,
> but that is not precise, so need refine this.
> User don't know this estimated value, it is internal value, not come from 
> user's input/configure.
> Hope it is clear to you.
>>> +*/
>>> +   if (eth_dev->data->dev_conf.rxmode.mq_mode ==
>> ETH_MQ_RX_VMDQ_RSS) {
>>> +   if (RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool == 8) {
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).active =
>> ETH_32_POOLS;
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 4;
>>> +   RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =
>>> +   dev_num_vf(eth_dev) * 4;
>> According to 82599 spec u can't do that since RSS is not allowed when port is
>> configured to have 8 function per-VF. Have u verified that this works? If 
>> yes,
>> then spec should be updated.
>>
> Response as above,
> Of course I have validated this. It works well.
>
>>> +   }
>>> +   }
>>> +
>>> /* set VMDq map to default PF pool */
>>> hw->mac.ops.set_vmdq(hw, 0,
>>> RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
>>>
>>> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> index f69abda..a7c17a4 100644
>>> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
>>> @@ -3327,6 +3327,39 @@ ixgbe_alloc_rx_queue_mbufs(struct
>> igb_rx_queue *rxq)
>>>}
>>>
>>>static int
>>> +ixgbe_config_vf_rss(struct rte_eth_dev *dev) {
>>> +   struct ixgbe_hw *hw;
>>> +   uint32_t mrqc;
>>> +
>>> +   ixgbe_rss_configure(dev);
>>> +
>>> +   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>>> +
>>> +   /* MRQC: enable VF RSS */
>>> +   mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC);
>>> +   mrqc &= ~IXGBE_MRQC_MRQE_MASK;
>>> +   switch (RTE_ETH_DEV_SRIOV(dev).active) {
>>> +   case ETH_64_POOLS:
>>> +   mrqc |= IXGBE_MRQC_VMDQRSS64EN;
>>> +   break;
>>> +
>>> +   case ETH_32_POOLS:
>>> +   case ETH_16_POOLS:
>>> +   mrqc |= IXGBE_MRQC_VMDQRSS32EN;
>> Again, this contradicts with the spec.
>>
>>> +   break;
>>> +
>>> +   default:
>>> +   PMD_INIT_LOG(ERR, "Invalid pool number in IOV mode");
>>> +   return -EINVAL;
>>> +   }
>>> +
>>> +   IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
>>> +
>>> +   return 0;
>>> +}
>>> +
>>> +static int
>>>ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
>>>{
>>> struct ixgbe_hw *hw =
>>> @@ -3358,24 +3391,38 @@ ixgbe_dev_mq_rx_configure(struct
>> rte_eth_dev *dev)
>>> default: ixgbe_rss_disable(dev);
>>> }
>>> } else {
>>> -   switch (RTE_ETH_DEV_SRIOV(dev).active) {
>>> /*
>>>  * SRIOV active scheme
>>>  * FIXME if support DCB/RSS together with VMDq & SRIOV
>>>  */
>>> -   case ETH_64_POOLS:
>>> -   IXGBE_WRITE_REG(hw, IXGBE_MRQC,
>> IXGBE_MRQC_VMDQEN);
>>> +   switch 

[dpdk-dev] Query on the modified rte_mbuf structure

2014-12-25 Thread Shankari Vaidyalingam
Hi,


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

Regards
Shankari


[dpdk-dev] [PATCH 4/7] Move EAL common functions

2014-12-25 Thread Neil Horman
On Thu, Dec 25, 2014 at 10:33:14AM -0500, Ravi Kerur wrote:
> Move common functions in eal.c to librte_eal/common directory.
> Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
> common functions.
> Makefile changes to reflect new file.
> Fix checkpatch warnings and errors.
> 
> Signed-off-by: Ravi Kerur 
> ---
>  lib/librte_eal/bsdapp/eal/Makefile|   1 +
>  lib/librte_eal/bsdapp/eal/eal.c   | 233 +---
>  lib/librte_eal/common/eal_common.c| 328 
> ++
>  lib/librte_eal/common/eal_externs.h   |  42 +
>  lib/librte_eal/common/eal_hugepages.h |   1 +
>  lib/librte_eal/common/eal_private.h   |  47 +
>  lib/librte_eal/linuxapp/eal/Makefile  |   1 +
>  lib/librte_eal/linuxapp/eal/eal.c | 246 ++---
>  8 files changed, 439 insertions(+), 460 deletions(-)
>  create mode 100644 lib/librte_eal/common/eal_common.c
>  create mode 100644 lib/librte_eal/common/eal_externs.h
> 
> diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
> b/lib/librte_eal/bsdapp/eal/Makefile
> index 92dd9a6..050d70b 100644
> --- a/lib/librte_eal/bsdapp/eal/Makefile
> +++ b/lib/librte_eal/bsdapp/eal/Makefile
> @@ -58,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
>  SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c
>  
>  # from common dir
> +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common.c
>  SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_memzone.c
>  SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_log.c
>  SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_launch.c
> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
> index 69f3c03..f925da7 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -80,30 +80,10 @@
>  #include "eal_filesystem.h"
>  #include "eal_hugepages.h"
>  #include "eal_options.h"
> +#include "eal_externs.h"
>  
>  #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
>  
> -/* Allow the application to print its usage message too if set */
> -static rte_usage_hook_t  rte_application_usage_hook = NULL;
> -/* early configuration structure, when memory config is not mmapped */
> -static struct rte_mem_config early_mem_config;
> -
> -/* define fd variable here, because file needs to be kept open for the
> - * duration of the program, as we hold a write lock on it in the primary 
> proc */
> -static int mem_cfg_fd = -1;
> -
> -static struct flock wr_lock = {
> - .l_type = F_WRLCK,
> - .l_whence = SEEK_SET,
> - .l_start = offsetof(struct rte_mem_config, memseg),
> - .l_len = sizeof(early_mem_config.memseg),
> -};
> -
> -/* Address of global and public configuration */
> -static struct rte_config rte_config = {
> - .mem_config = _mem_config,
> -};
> -
>  /* internal configuration (per-core) */
>  struct lcore_config lcore_config[RTE_MAX_LCORE];
>  
> @@ -113,93 +93,14 @@ struct internal_config internal_config;
>  /* used by rte_rdtsc() */
>  int rte_cycles_vmware_tsc_map;
>  
> -/* Return a pointer to the configuration structure */
> -struct rte_config *
> -rte_eal_get_configuration(void)
> +inline void *
> +rte_eal_get_mem_cfg_addr(void)
>  {
> - return _config;
> -}
> -
> -/* parse a sysfs (or other) file containing one integer value */
> -int
> -eal_parse_sysfs_value(const char *filename, unsigned long *val)
> -{
> - FILE *f;
> - char buf[BUFSIZ];
> - char *end = NULL;
> -
> - if ((f = fopen(filename, "r")) == NULL) {
> - RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
> - __func__, filename);
> - return -1;
> - }
> -
> - if (fgets(buf, sizeof(buf), f) == NULL) {
> - RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
> - __func__, filename);
> - fclose(f);
> - return -1;
> - }
> - *val = strtoul(buf, , 0);
> - if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
> - RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs value %s\n",
> - __func__, filename);
> - fclose(f);
> - return -1;
> - }
> - fclose(f);
> - return 0;
> -}
> -
> -
> -/* create memory configuration in shared/mmap memory. Take out
> - * a write lock on the memsegs, so we can auto-detect primary/secondary.
> - * This means we never close the file while running (auto-close on exit).
> - * We also don't lock the whole file, so that in future we can use read-locks
> - * on other parts, e.g. memzones, to detect if there are running secondary
> - * processes. */
> -static void
> -rte_eal_config_create(void)
> -{
> - void *rte_mem_cfg_addr;
> - int retval;
> -
> - const char *pathname = eal_runtime_config_path();
> -
> - if (internal_config.no_shconf)
> - return;
> -
> - if (mem_cfg_fd < 0){
> - mem_cfg_fd = open(pathname, O_RDWR | 

[dpdk-dev] [PATCH 1/7] Fix rte_is_power_of_2

2014-12-25 Thread Neil Horman
On Thu, Dec 25, 2014 at 10:33:11AM -0500, Ravi Kerur wrote:
> rte_is_power_of_2 returns true for 0 and 0 is not power_of_2. Fix
> by checking for n.
> 
> Signed-off-by: Ravi Kerur 
> ---
>  lib/librte_eal/common/include/rte_common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_common.h 
> b/lib/librte_eal/common/include/rte_common.h
> index 921b91f..8ac940c 100644
> --- a/lib/librte_eal/common/include/rte_common.h
> +++ b/lib/librte_eal/common/include/rte_common.h
> @@ -203,7 +203,7 @@ extern int RTE_BUILD_BUG_ON_detected_error;
>  static inline int
>  rte_is_power_of_2(uint32_t n)
>  {
> - return ((n-1) & n) == 0;
> + return n && !(n & (n - 1));
>  }
>  
>  /**
> -- 
> 1.9.1
> 
> 

This is the third time you've tried to slip this change in with some larger
changeset.  I'm in favor of it, but please, stop trying to bury stuff in other,
larger changesets.  Its a legitimate bug, you can just post this on its own.

Neil



[dpdk-dev] No probed ethernet devices /DPDP 1.7.1 in Fedora 21

2014-12-25 Thread Neil Horman
On Thu, Dec 25, 2014 at 10:11:51AM +0100, sothy shan wrote:
> On Wed, Dec 24, 2014 at 4:04 PM, Neil Horman  wrote:
> 
> > On Wed, Dec 24, 2014 at 02:26:21PM +0100, sothy shan wrote:
> > > Hello!
> > >
> > > I am playing with DPDK 1.7.1 in Fedora.
> > >
> > > When I do like this:
> > >
> > > export RTE_SDK=$(pwd)export RTE_TARGET="x86_64-ivshmem-linuxapp-gcc"
> > > make install T="$RTE_TARGET"
> > >
> > > It worked. Means Testpmd is running.
> > >
> > > When I run as mentioned below:
> > >
> > > make CONFIG_RTE_BUILD_SHARED_LIB=y  install T="$RTE_TARGET"
> > >
> > > Build is sucess. But Testpmd gives error.
> > >
> > > Error is :
> > >
> > The dpdk ivshmem build assumes the presence of ivshmem devices as plumbed
> > by
> > qemu virtual guests.  If you don't have a qemu guest running dpdk won't
> > find any
> > shared memory devices, which is exactly what you are seeing.  That said,
> > even if
> > you are running qemu guests, IIRC Fedora doesn't enable ivshmem because
> > the code
> > has some security and behavioral issues still I think.  You'll need to
> > rebuild
> > qemu to add support for it.
> >
> 
> My understanding is that It is problem of enabling
> CONFIG_RTE_BUILD_SHARED_LIB=y in make command, I am able to build target of
> x86_64-ivshmem-linuxapp-gcc alone without shared_lib flag. I suspect an
> error because of shared lib flag.
> 
What exactly do you think that problem is?  You just said in your
origional note that you are able to build the sdk and test apps without issue
(with or without building them as DSO's).  The problem comes in when you run
the app, and I expect you get the same error with both static and dynamic
builds.

The problem seems obvious to me.  DPDK cannot find any ivshmem devices on your
system when it loads (look at the code in rte_eal_ivshmem_init).  The error
message you see gets output if you don't generate an ivshmem_config, which
happens (among a few other reasons), if you don't have any ivshmem devices
created on your system

Neil



[dpdk-dev] [PATCH 2/7] Move EAL common functions

2014-12-25 Thread Ravi Kerur
Thanks Neil for reviews. Inline 

On Thu, Dec 25, 2014 at 9:30 AM, Neil Horman  wrote:

> On Thu, Dec 25, 2014 at 10:33:12AM -0500, Ravi Kerur wrote:
> > eal_debug.c has no difference between Linux and BSD, move
> > into common directory.
> > Rename eal_debug.c to eal_common_debug.c
> > Makefile changes to reflect file move and name change.
> > Fix checkpatch warnings.
> >
> > Signed-off-by: Ravi Kerur 
> > +
> > +/* not implemented in this environment */
> > +void rte_dump_registers(void)
> > +{
> > +}
> Clearly this function has no use, instead of keeping it around, can you
> please
> remove it until someone works up the gumption to make it do something.
> We're
> just wasting an extra call instruction here so someone doesn't have to
> write a
> prototype in the future.  I don't see the value.
>

 This is existing code, I just removed "return" statement as per
checkpatch. Should I make it "inline" and add a comment indicating to
revisit whether to make it inline/no inline when the function is
implemented?

>
> > +/*
> > + * Like rte_panic this terminates the application. However, no
> traceback is
> > + * provided and no core-dump is generated.
> > + */
> > +void
> > +rte_exit(int exit_code, const char *format, ...)
> > +{
> > + va_list ap;
> > +
> > + /* disable history */
> > + rte_log_set_history(0);
> > +
> > + if (exit_code != 0)
> > + RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
> > + "  Cause: ", exit_code);
> > +
> > + va_start(ap, format);
> > + rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
> > + va_end(ap);
> > +
> > +#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
> > + exit(exit_code);
> > +#else
> > + rte_dump_stack();
> > + rte_dump_registers();
> > + abort();
> > +#endif
> This doesn't match with the commentary above.  If rte_exit isn't meant to
> provide a traceback, it shouldn't do so.  If an application wants that to
> happen, then they need to use rte_panic.
>
>  This is again existing code. I can change the comment which matches
the function, will it work?


[dpdk-dev] [PATCH 4/7] Move EAL common functions

2014-12-25 Thread Ravi Kerur
Inline 

On Thu, Dec 25, 2014 at 9:44 AM, Neil Horman  wrote:

> On Thu, Dec 25, 2014 at 10:33:14AM -0500, Ravi Kerur wrote:
> > Move common functions in eal.c to librte_eal/common directory.
> > Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
> > common functions.
> > Makefile changes to reflect new file.
> > Fix checkpatch warnings and errors.
> >
> > Signed-off-by: Ravi Kerur 
> > ---
> >  lib/librte_eal/bsdapp/eal/Makefile|   1 +
> >  lib/librte_eal/bsdapp/eal/eal.c   | 233 +---
> >  lib/librte_eal/common/eal_common.c| 328
> ++
> >  lib/librte_eal/common/eal_externs.h   |  42 +
> >  lib/librte_eal/common/eal_hugepages.h |   1 +
> >  lib/librte_eal/common/eal_private.h   |  47 +
> >  lib/librte_eal/linuxapp/eal/Makefile  |   1 +
> >  lib/librte_eal/linuxapp/eal/eal.c | 246 ++---
> >  8 files changed, 439 insertions(+), 460 deletions(-)
> >  create mode 100644 lib/librte_eal/common/eal_common.c
> >  create mode 100644 lib/librte_eal/common/eal_externs.h
> >
> > diff --git a/lib/librte_eal/bsdapp/eal/Makefile
> b/lib/librte_eal/bsdapp/eal/Makefile
> > index 92dd9a6..050d70b 100644
> > --- a/lib/librte_eal/bsdapp/eal/Makefile
> > +++ b/lib/librte_eal/bsdapp/eal/Makefile
> > @@ -58,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=
> eal_interrupts.c
> >  SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c
> >
> >  # from common dir
> > +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common.c
> >  SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_memzone.c
> >  SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_log.c
> >  SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_launch.c
> > diff --git a/lib/librte_eal/bsdapp/eal/eal.c
> b/lib/librte_eal/bsdapp/eal/eal.c
> > index 69f3c03..f925da7 100644
> > --- a/lib/librte_eal/bsdapp/eal/eal.c
> > +++ b/lib/librte_eal/bsdapp/eal/eal.c
> > @@ -80,30 +80,10 @@
> >  #include "eal_filesystem.h"
> >  #include "eal_hugepages.h"
> >  #include "eal_options.h"
> > +#include "eal_externs.h"
> >
> >  #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
> >
> > -/* Allow the application to print its usage message too if set */
> > -static rte_usage_hook_t  rte_application_usage_hook = NULL;
> > -/* early configuration structure, when memory config is not mmapped */
> > -static struct rte_mem_config early_mem_config;
> > -
> > -/* define fd variable here, because file needs to be kept open for the
> > - * duration of the program, as we hold a write lock on it in the
> primary proc */
> > -static int mem_cfg_fd = -1;
> > -
> > -static struct flock wr_lock = {
> > - .l_type = F_WRLCK,
> > - .l_whence = SEEK_SET,
> > - .l_start = offsetof(struct rte_mem_config, memseg),
> > - .l_len = sizeof(early_mem_config.memseg),
> > -};
> > -
> > -/* Address of global and public configuration */
> > -static struct rte_config rte_config = {
> > - .mem_config = _mem_config,
> > -};
> > -
> >  /* internal configuration (per-core) */
> >  struct lcore_config lcore_config[RTE_MAX_LCORE];
> >
> > @@ -113,93 +93,14 @@ struct internal_config internal_config;
> >  /* used by rte_rdtsc() */
> >  int rte_cycles_vmware_tsc_map;
> >
> > -/* Return a pointer to the configuration structure */
> > -struct rte_config *
> > -rte_eal_get_configuration(void)
> > +inline void *
> > +rte_eal_get_mem_cfg_addr(void)
> >  {
> > - return _config;
> > -}
> > -
> > -/* parse a sysfs (or other) file containing one integer value */
> > -int
> > -eal_parse_sysfs_value(const char *filename, unsigned long *val)
> > -{
> > - FILE *f;
> > - char buf[BUFSIZ];
> > - char *end = NULL;
> > -
> > - if ((f = fopen(filename, "r")) == NULL) {
> > - RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
> > - __func__, filename);
> > - return -1;
> > - }
> > -
> > - if (fgets(buf, sizeof(buf), f) == NULL) {
> > - RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
> > - __func__, filename);
> > - fclose(f);
> > - return -1;
> > - }
> > - *val = strtoul(buf, , 0);
> > - if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
> > - RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs value %s\n",
> > - __func__, filename);
> > - fclose(f);
> > - return -1;
> > - }
> > - fclose(f);
> > - return 0;
> > -}
> > -
> > -
> > -/* create memory configuration in shared/mmap memory. Take out
> > - * a write lock on the memsegs, so we can auto-detect primary/secondary.
> > - * This means we never close the file while running (auto-close on
> exit).
> > - * We also don't lock the whole file, so that in future we can use
> read-locks
> > - * on other parts, e.g. memzones, to detect if there are running
> secondary
> > - * processes. */
> > -static void
> > 

[dpdk-dev] [PATCH 4/4] ethdev: remove old APIs and structures of ethertype filter

2014-12-25 Thread Jingjing Wu
Struct rte_ethertype_filter is removed.
Following APIs are removed:
  - rte_eth_dev_add_ethertype_filter
  - rte_eth_dev_remove_ethertype_filter
  - rte_eth_dev_get_ethertype_filter

Signed-off-by: Jingjing Wu 
---
 lib/librte_ether/rte_ethdev.c | 57 
 lib/librte_ether/rte_ethdev.h | 88 ---
 2 files changed, 145 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 95f2ceb..b55fab2 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3015,63 +3015,6 @@ rte_eth_dev_get_syn_filter(uint8_t port_id,
 }

 int
-rte_eth_dev_add_ethertype_filter(uint8_t port_id, uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t rx_queue)
-{
-   struct rte_eth_dev *dev;
-
-   if (port_id >= nb_ports) {
-   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-   return -ENODEV;
-   }
-   if (filter->ethertype == ETHER_TYPE_IPv4 ||
-   filter->ethertype == ETHER_TYPE_IPv6){
-   PMD_DEBUG_TRACE("IP and IPv6 are not supported"
-   " in ethertype filter\n");
-   return -EINVAL;
-   }
-   dev = _eth_devices[port_id];
-   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->add_ethertype_filter, -ENOTSUP);
-   return (*dev->dev_ops->add_ethertype_filter)(dev, index,
-   filter, rx_queue);
-}
-
-int
-rte_eth_dev_remove_ethertype_filter(uint8_t port_id,  uint16_t index)
-{
-   struct rte_eth_dev *dev;
-
-   if (port_id >= nb_ports) {
-   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-   return -ENODEV;
-   }
-
-   dev = _eth_devices[port_id];
-   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->remove_ethertype_filter, -ENOTSUP);
-   return (*dev->dev_ops->remove_ethertype_filter)(dev, index);
-}
-
-int
-rte_eth_dev_get_ethertype_filter(uint8_t port_id, uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t *rx_queue)
-{
-   struct rte_eth_dev *dev;
-
-   if (filter == NULL || rx_queue == NULL)
-   return -EINVAL;
-
-   if (port_id >= nb_ports) {
-   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-   return -ENODEV;
-   }
-
-   dev = _eth_devices[port_id];
-   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_ethertype_filter, -ENOTSUP);
-   return (*dev->dev_ops->get_ethertype_filter)(dev, index,
-   filter, rx_queue);
-}
-
-int
 rte_eth_dev_add_2tuple_filter(uint8_t port_id, uint16_t index,
struct rte_2tuple_filter *filter, uint16_t rx_queue)
 {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ce0528f..1200c1c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -972,15 +972,6 @@ TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
 #define TCP_FLAG_ALL 0x3F

 /**
- *  A structure used to define an ethertype filter.
- */
-struct rte_ethertype_filter {
-   uint16_t ethertype;  /**< little endian. */
-   uint8_t priority_en; /**< compare priority enable. */
-   uint8_t priority;
-};
-
-/**
  *  A structure used to define an syn filter.
  */
 struct rte_syn_filter {
@@ -1372,20 +1363,6 @@ typedef int (*eth_get_syn_filter_t)(struct rte_eth_dev 
*dev,
struct rte_syn_filter *filter, uint16_t *rx_queue);
 /**< @internal Get syn filter rule on an Ethernet device */

-typedef int (*eth_add_ethertype_filter_t)(struct rte_eth_dev *dev,
-   uint16_t index, struct rte_ethertype_filter *filter,
-   uint16_t rx_queue);
-/**< @internal Setup a new ethertype filter rule on an Ethernet device */
-
-typedef int (*eth_remove_ethertype_filter_t)(struct rte_eth_dev *dev,
-   uint16_t index);
-/**< @internal Remove an ethertype filter rule on an Ethernet device */
-
-typedef int (*eth_get_ethertype_filter_t)(struct rte_eth_dev *dev,
-   uint16_t index, struct rte_ethertype_filter *filter,
-   uint16_t *rx_queue);
-/**< @internal Get an ethertype filter rule on an Ethernet device */
-
 typedef int (*eth_add_2tuple_filter_t)(struct rte_eth_dev *dev,
uint16_t index, struct rte_2tuple_filter *filter,
uint16_t rx_queue);
@@ -1532,9 +1509,6 @@ struct eth_dev_ops {
eth_add_syn_filter_t   add_syn_filter;   /**< add syn 
filter. */
eth_remove_syn_filter_tremove_syn_filter;/**< remove syn 
filter. */
eth_get_syn_filter_t   get_syn_filter;   /**< get syn 
filter. */
-   eth_add_ethertype_filter_t add_ethertype_filter;/**< add 
ethertype filter. */
-   eth_remove_ethertype_filter_t  remove_ethertype_filter; /**< remove 
ethertype filter. */
-   

[dpdk-dev] [PATCH 2/4] e1000: new functions replace old ones for ethertype filters

2014-12-25 Thread Jingjing Wu
This patch removes old functions which deal with ethertype filters in ixgbe 
driver.
It also defines eth_igb_filter_ctrl which is binding to filter_ctrl API,
and ethertype filter can be dealt with through this new entrance. 

Signed-off-by: Jingjing Wu 
---
 lib/librte_pmd_e1000/e1000_ethdev.h |  13 ++
 lib/librte_pmd_e1000/igb_ethdev.c   | 332 +++-
 2 files changed, 228 insertions(+), 117 deletions(-)

diff --git a/lib/librte_pmd_e1000/e1000_ethdev.h 
b/lib/librte_pmd_e1000/e1000_ethdev.h
index 71eb5fb..d155e77 100644
--- a/lib/librte_pmd_e1000/e1000_ethdev.h
+++ b/lib/librte_pmd_e1000/e1000_ethdev.h
@@ -132,6 +132,15 @@ struct e1000_vf_info {
 };

 /*
+ * Structure to store filters' info.
+ */
+struct e1000_filter_info {
+   uint8_t ethertype_mask; /* Bit mask for every used ethertype filter */
+   /* store used ethertype filters*/
+   uint16_t ethertype_filters[E1000_MAX_ETQF_FILTERS];
+};
+
+/*
  * Structure to store private data for each driver instance (for each port).
  */
 struct e1000_adapter {
@@ -140,6 +149,7 @@ struct e1000_adapter {
struct e1000_interrupt  intr;
struct e1000_vfta   shadow_vfta;
struct e1000_vf_info*vfdata;
+   struct e1000_filter_info filter;
 };

 #define E1000_DEV_PRIVATE_TO_HW(adapter) \
@@ -157,6 +167,9 @@ struct e1000_adapter {
 #define E1000_DEV_PRIVATE_TO_P_VFDATA(adapter) \
 (&((struct e1000_adapter *)adapter)->vfdata)

+#define E1000_DEV_PRIVATE_TO_FILTER_INFO(adapter) \
+   (&((struct e1000_adapter *)adapter)->filter)
+
 /*
  * RX/TX IGB function prototypes
  */
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c 
b/lib/librte_pmd_e1000/igb_ethdev.c
index 873d65e..3c549aa 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -154,14 +154,6 @@ static int eth_igb_add_syn_filter(struct rte_eth_dev *dev,
 static int eth_igb_remove_syn_filter(struct rte_eth_dev *dev);
 static int eth_igb_get_syn_filter(struct rte_eth_dev *dev,
struct rte_syn_filter *filter, uint16_t *rx_queue);
-static int eth_igb_add_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t rx_queue);
-static int eth_igb_remove_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index);
-static int eth_igb_get_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t 
*rx_queue);
 static int eth_igb_add_2tuple_filter(struct rte_eth_dev *dev,
uint16_t index,
struct rte_2tuple_filter *filter, uint16_t rx_queue);
@@ -186,6 +178,18 @@ static int eth_igb_remove_5tuple_filter(struct rte_eth_dev 
*dev,
 static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev,
uint16_t index,
struct rte_5tuple_filter *filter, uint16_t *rx_queue);
+static int igb_add_del_ethertype_filter(struct rte_eth_dev *dev,
+   struct rte_eth_ethertype_filter *filter,
+   bool add);
+static int igb_ethertype_filter_handle(struct rte_eth_dev *dev,
+   enum rte_filter_op filter_op,
+   void *arg);
+static int igb_get_ethertype_filter(struct rte_eth_dev *dev,
+   struct rte_eth_ethertype_filter *filter);
+static int eth_igb_filter_ctrl(struct rte_eth_dev *dev,
+enum rte_filter_type filter_type,
+enum rte_filter_op filter_op,
+void *arg);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -264,9 +268,6 @@ static struct eth_dev_ops eth_igb_ops = {
.add_syn_filter  = eth_igb_add_syn_filter,
.remove_syn_filter   = eth_igb_remove_syn_filter,
.get_syn_filter  = eth_igb_get_syn_filter,
-   .add_ethertype_filter= eth_igb_add_ethertype_filter,
-   .remove_ethertype_filter = eth_igb_remove_ethertype_filter,
-   .get_ethertype_filter= eth_igb_get_ethertype_filter,
.add_2tuple_filter   = eth_igb_add_2tuple_filter,
.remove_2tuple_filter= eth_igb_remove_2tuple_filter,
.get_2tuple_filter   = eth_igb_get_2tuple_filter,
@@ -276,6 +277,7 @@ static struct eth_dev_ops eth_igb_ops = {
.add_5tuple_filter   = eth_igb_add_5tuple_filter,
.remove_5tuple_filter= eth_igb_remove_5tuple_filter,
.get_5tuple_filter   = eth_igb_get_5tuple_filter,
+   .filter_ctrl = eth_igb_filter_ctrl,
 };

 /*
@@ -2388,7 +2390,7 @@ eth_igb_rss_reta_query(struct rte_eth_dev *dev,
 #define MAC_TYPE_FILTER_SUP(type)do {\
if ((type) != e1000_82580 && (type) != e1000_i350 &&\
(type) != e1000_82576)\
-   return -ENOSYS;\
+   return -ENOTSUP;\
 } while (0)

 

[dpdk-dev] [PATCH 1/4] ixgbe: new functions replace old ones for ethertype filter

2014-12-25 Thread Jingjing Wu
This patch removes old functions which deal with ethertype filter in ixgbe 
driver.
It also defines ixgbe_dev_filter_ctrl which is binding to filter_ctrl API,
and ethertype filter can be dealt with through this new entrance.

Signed-off-by: Jingjing Wu 
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 354 +++-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  13 ++
 2 files changed, 239 insertions(+), 128 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 3fc3738..99cbbfb 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -231,12 +231,6 @@ static int ixgbe_add_syn_filter(struct rte_eth_dev *dev,
 static int ixgbe_remove_syn_filter(struct rte_eth_dev *dev);
 static int ixgbe_get_syn_filter(struct rte_eth_dev *dev,
struct rte_syn_filter *filter, uint16_t *rx_queue);
-static int ixgbe_add_ethertype_filter(struct rte_eth_dev *dev, uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t rx_queue);
-static int ixgbe_remove_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index);
-static int ixgbe_get_ethertype_filter(struct rte_eth_dev *dev, uint16_t index,
-   struct rte_ethertype_filter *filter, uint16_t 
*rx_queue);
 static int ixgbe_add_5tuple_filter(struct rte_eth_dev *dev, uint16_t index,
struct rte_5tuple_filter *filter, uint16_t rx_queue);
 static int ixgbe_remove_5tuple_filter(struct rte_eth_dev *dev,
@@ -245,6 +239,18 @@ static int ixgbe_get_5tuple_filter(struct rte_eth_dev 
*dev, uint16_t index,
struct rte_5tuple_filter *filter, uint16_t *rx_queue);

 static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
+static int ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev,
+   struct rte_eth_ethertype_filter *filter,
+   bool add);
+static int ixgbe_ethertype_filter_handle(struct rte_eth_dev *dev,
+   enum rte_filter_op filter_op,
+   void *arg);
+static int ixgbe_get_ethertype_filter(struct rte_eth_dev *dev,
+   struct rte_eth_ethertype_filter *filter);
+static int ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev,
+enum rte_filter_type filter_type,
+enum rte_filter_op filter_op,
+void *arg);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -380,12 +386,10 @@ static struct eth_dev_ops ixgbe_eth_dev_ops = {
.add_syn_filter  = ixgbe_add_syn_filter,
.remove_syn_filter   = ixgbe_remove_syn_filter,
.get_syn_filter  = ixgbe_get_syn_filter,
-   .add_ethertype_filter= ixgbe_add_ethertype_filter,
-   .remove_ethertype_filter = ixgbe_remove_ethertype_filter,
-   .get_ethertype_filter= ixgbe_get_ethertype_filter,
.add_5tuple_filter   = ixgbe_add_5tuple_filter,
.remove_5tuple_filter= ixgbe_remove_5tuple_filter,
.get_5tuple_filter   = ixgbe_get_5tuple_filter,
+   .filter_ctrl = ixgbe_dev_filter_ctrl,
 };

 /*
@@ -3774,125 +3778,6 @@ ixgbe_get_syn_filter(struct rte_eth_dev *dev,
return -ENOENT;
 }

-/*
- * add an ethertype filter
- *
- * @param
- * dev: Pointer to struct rte_eth_dev.
- * index: the index the filter allocates.
- * filter: ponter to the filter that will be added.
- * rx_queue: the queue id the filter assigned to.
- *
- * @return
- *- On success, zero.
- *- On failure, a negative value.
- */
-static int
-ixgbe_add_ethertype_filter(struct rte_eth_dev *dev,
-   uint16_t index, struct rte_ethertype_filter *filter,
-   uint16_t rx_queue)
-{
-   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-   uint32_t etqf, etqs = 0;
-
-   if (hw->mac.type != ixgbe_mac_82599EB)
-   return -ENOSYS;
-
-   if (index >= IXGBE_MAX_ETQF_FILTERS ||
-   rx_queue >= IXGBE_MAX_RX_QUEUE_NUM)
-   return -EINVAL;
-
-   etqf = IXGBE_READ_REG(hw, IXGBE_ETQF(index));
-   if (etqf & IXGBE_ETQF_FILTER_EN)
-   return -EINVAL;  /* filter index is in use. */
-
-   etqf = 0;
-   etqf |= IXGBE_ETQF_FILTER_EN;
-   etqf |= (uint32_t)filter->ethertype;
-
-   if (filter->priority_en) {
-   if (filter->priority > IXGBE_ETQF_MAX_PRI)
-   return -EINVAL;
-   etqf |= (uint32_t)((filter->priority << IXGBE_ETQF_SHIFT) & 
IXGBE_ETQF_UP);
-   etqf |= IXGBE_ETQF_UP_EN;
-   }
-   etqs |= (uint32_t)((rx_queue << IXGBE_ETQS_RX_QUEUE_SHIFT) & 
IXGBE_ETQS_RX_QUEUE);
-   etqs |= IXGBE_ETQS_QUEUE_EN;
-
-   IXGBE_WRITE_REG(hw, IXGBE_ETQF(index), etqf);
-   IXGBE_WRITE_REG(hw, IXGBE_ETQS(index), etqs);
-   return 0;
-}
-
-/*
- * remove an 

[dpdk-dev] [PATCH 0/4] Integrate ethertype filter in igb/ixgbe driver to new API

2014-12-25 Thread Jingjing Wu
The patch set uses new filter_ctrl API to replace old ethertype filter APIs.
It uses new functions and structure to replace old ones in igb/ixgbe driver,
new commands to replace old ones in testpmd, and removes the old APIs. 

Jingjing Wu (4):
  ixgbe: new functions replaces old ones for ethertype filters
  e1000: new functions replaces old ones for ethertype filters
  testpmd: new commands for ethertype filter
  ethdev: remove old APIs and structures of ethertype filters

 app/test-pmd/cmdline.c  | 253 --
 app/test-pmd/config.c   |  27 ---
 lib/librte_ether/rte_ethdev.c   |  57 --
 lib/librte_ether/rte_ethdev.h   |  88 -
 lib/librte_pmd_e1000/e1000_ethdev.h |  13 ++
 lib/librte_pmd_e1000/igb_ethdev.c   | 332 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 354 +++-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  13 ++
 8 files changed, 579 insertions(+), 558 deletions(-)

-- 
1.9.3



[dpdk-dev] [PATCH 1/7] Fix rte_is_power_of_2

2014-12-25 Thread Ravi Kerur
Sure, will post it separately.

Thanks.

On Thu, Dec 25, 2014 at 9:21 AM, Neil Horman  wrote:

> On Thu, Dec 25, 2014 at 10:33:11AM -0500, Ravi Kerur wrote:
> > rte_is_power_of_2 returns true for 0 and 0 is not power_of_2. Fix
> > by checking for n.
> >
> > Signed-off-by: Ravi Kerur 
> > ---
> >  lib/librte_eal/common/include/rte_common.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/common/include/rte_common.h
> b/lib/librte_eal/common/include/rte_common.h
> > index 921b91f..8ac940c 100644
> > --- a/lib/librte_eal/common/include/rte_common.h
> > +++ b/lib/librte_eal/common/include/rte_common.h
> > @@ -203,7 +203,7 @@ extern int RTE_BUILD_BUG_ON_detected_error;
> >  static inline int
> >  rte_is_power_of_2(uint32_t n)
> >  {
> > - return ((n-1) & n) == 0;
> > + return n && !(n & (n - 1));
> >  }
> >
> >  /**
> > --
> > 1.9.1
> >
> >
>
> This is the third time you've tried to slip this change in with some larger
> changeset.  I'm in favor of it, but please, stop trying to bury stuff in
> other,
> larger changesets.  Its a legitimate bug, you can just post this on its
> own.
>
> Neil
>
>


[dpdk-dev] [PATCH 7/7] Move EAL common functions

2014-12-25 Thread Ravi Kerur
Move common functions in eal_memory.c to librte_eal/common
directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
common functions.
Fix checkpatch warnings and errors.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/eal_memory.c| 36 ++
 lib/librte_eal/common/eal_common_memory.c | 43 +--
 lib/librte_eal/common/eal_private.h   | 28 
 lib/librte_eal/linuxapp/eal/eal_memory.c  | 36 ++
 4 files changed, 73 insertions(+), 70 deletions(-)

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

-static int
+int
 rte_eal_contigmem_init(void)
 {
struct rte_mem_config *mcfg;
@@ -130,7 +130,7 @@ rte_eal_contigmem_init(void)
return 0;
 }

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

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

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

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

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

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

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

@@ -119,3 +120,41 @@ unsigned rte_memory_get_nrank(void)
 {
return rte_eal_get_configuration()->mem_config->nrank;
 }
+
+static int
+rte_eal_memdevice_init(void)
+{
+   struct rte_config *config;
+
+   if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+   return 0;
+
+   config = rte_eal_get_configuration();
+   config->mem_config->nchannel = internal_config.force_nchannel;
+   config->mem_config->nrank = internal_config.force_nrank;
+
+   return 0;
+}
+
+/* init memory subsystem */
+int
+rte_eal_memory_init(void)
+{
+   RTE_LOG(INFO, EAL, "Setting up physically contiguous memory...\n");
+   const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
+#ifdef RTE_EXEC_ENV_BSDAPP
+   rte_eal_contigmem_init() :
+   rte_eal_contigmem_attach();
+#else /* RTE_EXEC_ENV_BSDAPP */
+   rte_eal_hugepage_init() :
+   rte_eal_hugepage_attach();
+#endif /* RTE_EXEC_ENV_BSDAPP */
+
+   if (retval < 0)
+   return -1;
+
+   if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
+   return -1;
+
+   return 0;
+}
diff --git a/lib/librte_eal/common/eal_private.h 
b/lib/librte_eal/common/eal_private.h
index 19af23d..16338a2 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -286,6 +286,20 @@ int get_ncpus(void);
  */
 int set_tsc_freq_from_sysctl(void);

+/**
+ * This function prepares physical memory mapping
+ *
+ * This function is private to the EAL.
+ */
+int rte_eal_contigmem_init(void);
+
+/**
+ * This function creates memory mapping in secondary
+ *
+ * This function is private to the EAL.
+ */
+int rte_eal_contigmem_attach(void);
+
 #else /* RTE_EXEC_ENV_BSDAPP */
 /**
  * This function check if cpu is present
@@ -301,6 +315,20 @@ int cpu_detected(unsigned 

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

2014-12-25 Thread Ravi Kerur
Move common functions in eal_timer.c to librte_eal/common
directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
common functions.
Makefile changes to reflect new file.
Fix checkpatch warnings and errors.

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

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

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

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

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

 enum timer_source eal_timer_source = EAL_TIMER_TSC;

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

-static void
-set_tsc_freq_fallback(void)
-{
-   RTE_LOG(WARNING, EAL, "WARNING: clock_gettime cannot use "
-   "CLOCK_MONOTONIC_RAW and HPET is not available"
-   " - clock timings may be less accurate.\n");
-   /* assume that the sleep(1) will sleep for 1 second */
-   uint64_t start = rte_rdtsc();
-   sleep(1);
-   eal_tsc_resolution_hz = rte_rdtsc() - start;
-}
-
-/*
- * This function measures the TSC frequency. It uses a variety of approaches.
- *
- * 1. Read the TSC frequency value provided by the kernel
- * 2. If above does not work, just sleep for 1 second and tune off that,
- *printing a warning about inaccuracy of timing
- */
-static void
-set_tsc_freq(void)
-{
-   if (set_tsc_freq_from_sysctl() < 0)
-   set_tsc_freq_fallback();
-
-   RTE_LOG(INFO, EAL, "TSC frequency is ~%"PRIu64" KHz\n",
-   eal_tsc_resolution_hz/1000);
-}
-
 int
 rte_eal_timer_init(void)
 {
diff --git a/lib/librte_eal/common/eal_common_timer.c 
b/lib/librte_eal/common/eal_common_timer.c
new file mode 100644
index 000..15f9ee7
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_timer.c
@@ -0,0 +1,99 @@
+/*-
+ *   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 

[dpdk-dev] [PATCH 5/7] Move EAL common functions

2014-12-25 Thread Ravi Kerur
Move common functions in eal_lcore.c to librte_eal/common
directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
common functions.
Makefile changes to reflect new file.
Fix checkpatch warnings and errors.

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

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

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

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

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

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

[dpdk-dev] [PATCH 4/7] Move EAL common functions

2014-12-25 Thread Ravi Kerur
Move common functions in eal.c to librte_eal/common directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in
common functions.
Makefile changes to reflect new file.
Fix checkpatch warnings and errors.

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

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

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

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

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

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

-/* Return a pointer to the configuration structure */
-struct rte_config *
-rte_eal_get_configuration(void)
+inline void *
+rte_eal_get_mem_cfg_addr(void)
 {
-   return _config;
-}
-
-/* parse a sysfs (or other) file containing one integer value */
-int
-eal_parse_sysfs_value(const char *filename, unsigned long *val)
-{
-   FILE *f;
-   char buf[BUFSIZ];
-   char *end = NULL;
-
-   if ((f = fopen(filename, "r")) == NULL) {
-   RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
-   __func__, filename);
-   return -1;
-   }
-
-   if (fgets(buf, sizeof(buf), f) == NULL) {
-   RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
-   __func__, filename);
-   fclose(f);
-   return -1;
-   }
-   *val = strtoul(buf, , 0);
-   if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
-   RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs value %s\n",
-   __func__, filename);
-   fclose(f);
-   return -1;
-   }
-   fclose(f);
-   return 0;
-}
-
-
-/* create memory configuration in shared/mmap memory. Take out
- * a write lock on the memsegs, so we can auto-detect primary/secondary.
- * This means we never close the file while running (auto-close on exit).
- * We also don't lock the whole file, so that in future we can use read-locks
- * on other parts, e.g. memzones, to detect if there are running secondary
- * processes. */
-static void
-rte_eal_config_create(void)
-{
-   void *rte_mem_cfg_addr;
-   int retval;
-
-   const char *pathname = eal_runtime_config_path();
-
-   if (internal_config.no_shconf)
-   return;
-
-   if (mem_cfg_fd < 0){
-   mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);
-   if (mem_cfg_fd < 0)
-   rte_panic("Cannot open '%s' for rte_mem_config\n", 
pathname);
-   }
-
-   retval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));
-   if (retval < 0){
-   

[dpdk-dev] [PATCH 3/7] Move EAL common functions

2014-12-25 Thread Ravi Kerur
eal_thread.c has minor difference between Linux and BSD, move
into common directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate minor difference.
Rename eal_thread.c to eal_common_thread.c
Makefile changes to reflect file move and name change.
Fix checkpatch warnings.

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

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

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

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

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

[dpdk-dev] [PATCH 2/7] Move EAL common functions

2014-12-25 Thread Ravi Kerur
eal_debug.c has no difference between Linux and BSD, move
into common directory.
Rename eal_debug.c to eal_common_debug.c
Makefile changes to reflect file move and name change.
Fix checkpatch warnings.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/bsdapp/eal/Makefile   |   2 +-
 lib/librte_eal/bsdapp/eal/eal_debug.c| 113 ---
 lib/librte_eal/common/eal_common_debug.c | 112 ++
 lib/librte_eal/linuxapp/eal/Makefile |   2 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c  | 113 ---
 5 files changed, 114 insertions(+), 228 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index d434882..9b83e11 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -53,7 +53,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
@@ -73,6 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c

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

[dpdk-dev] [PATCH 1/7] Fix rte_is_power_of_2

2014-12-25 Thread Ravi Kerur
rte_is_power_of_2 returns true for 0 and 0 is not power_of_2. Fix
by checking for n.

Signed-off-by: Ravi Kerur 
---
 lib/librte_eal/common/include/rte_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/include/rte_common.h 
b/lib/librte_eal/common/include/rte_common.h
index 921b91f..8ac940c 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -203,7 +203,7 @@ extern int RTE_BUILD_BUG_ON_detected_error;
 static inline int
 rte_is_power_of_2(uint32_t n)
 {
-   return ((n-1) & n) == 0;
+   return n && !(n & (n - 1));
 }

 /**
-- 
1.9.1



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

2014-12-25 Thread Ravi Kerur
Common functions in linuxapp and bsdapp are moved into
librte_eal/common directory.
New files added follow _common_ naming conventions.
Tested against ubuntu and FreeBSD.

*** BLURB HERE ***

Ravi Kerur (7):
  Fix rte_is_power_of_2
  Move EAL common functions
  Move EAL common functions
  Move EAL common functions
  Move EAL common functions
  Move EAL common functions
  Move EAL common functions

 lib/librte_eal/bsdapp/eal/Makefile |  11 +-
 lib/librte_eal/bsdapp/eal/eal.c| 233 +---
 lib/librte_eal/bsdapp/eal/eal_debug.c  | 113 --
 lib/librte_eal/bsdapp/eal/eal_lcore.c  |  62 ++
 lib/librte_eal/bsdapp/eal/eal_memory.c |  36 +---
 lib/librte_eal/bsdapp/eal/eal_thread.c | 233 
 lib/librte_eal/bsdapp/eal/eal_timer.c  |  50 +
 lib/librte_eal/common/eal_common.c | 328 +
 lib/librte_eal/common/eal_common_debug.c   | 112 ++
 lib/librte_eal/common/eal_common_lcore.c   | 106 ++
 lib/librte_eal/common/eal_common_memory.c  |  43 +++-
 lib/librte_eal/common/eal_common_thread.c  | 248 ++
 lib/librte_eal/common/eal_common_timer.c   |  99 +
 lib/librte_eal/common/eal_externs.h|  45 
 lib/librte_eal/common/eal_hugepages.h  |   1 +
 lib/librte_eal/common/eal_private.h| 128 +++
 lib/librte_eal/common/include/rte_common.h |   2 +-
 lib/librte_eal/linuxapp/eal/Makefile   |  11 +-
 lib/librte_eal/linuxapp/eal/eal.c  | 246 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c| 113 --
 lib/librte_eal/linuxapp/eal/eal_lcore.c|  55 +
 lib/librte_eal/linuxapp/eal/eal_memory.c   |  36 +---
 lib/librte_eal/linuxapp/eal/eal_thread.c   | 233 
 lib/librte_eal/linuxapp/eal/eal_timer.c|  52 +
 24 files changed, 1165 insertions(+), 1431 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/common/eal_common.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_lcore.c
 create mode 100644 lib/librte_eal/common/eal_common_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_timer.c
 create mode 100644 lib/librte_eal/common/eal_externs.h
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c

-- 
1.9.1



[dpdk-dev] [PATCH 1/2] Fix checkpatch errors in librte_acl

2014-12-25 Thread Ravi Kerur
Fix checkpatch warnings and errors in lib/librte_acl. checkpatch
is run as follows

scripts/checkpatch.pl --no-tree --file 

Following warnings are treated as false-positive

1. WARNING: quoted string split across lines
2. WARNING: do not add new typedefs
3. WARNING: __aligned(size) is preferred over __attribute__((aligned(size)))

Signed-off-by: Ravi Kerur 
---
 lib/librte_acl/acl_bld.c | 192 +++
 lib/librte_acl/rte_acl.c |   3 +-
 lib/librte_acl/rte_acl_osdep_alone.h |   3 +-
 lib/librte_acl/tb_mem.c  |   5 +-
 4 files changed, 109 insertions(+), 94 deletions(-)

diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index d6e0c45..1f60411 100644
--- a/lib/librte_acl/acl_bld.c
+++ b/lib/librte_acl/acl_bld.c
@@ -773,11 +773,13 @@ acl_merge(struct acl_build_context *context,
for (n = 0; n < ptrs_a; n++) {
for (m = 0; m < ptrs_b; m++) {

+   uint32_t acl_intsct_type, num_cats;
+
if (node_a->ptrs[n].ptr == NULL ||
-   node_b->ptrs[m].ptr == NULL ||
-   node_a->ptrs[n].ptr ==
-   node_b->ptrs[m].ptr)
-   continue;
+   node_b->ptrs[m].ptr == NULL ||
+   node_a->ptrs[n].ptr ==
+   node_b->ptrs[m].ptr)
+   continue;

intersect_type = acl_intersect_type(
_a->ptrs[n].values,
@@ -785,35 +787,38 @@ acl_merge(struct acl_build_context *context,
_ptr);

/* If this node is not a 'match' node */
-   if ((intersect_type & ACL_INTERSECT) &&
-   (context->cfg.num_categories != 1 ||
-   !(node_a->ptrs[n].ptr->match_flag))) {
-
-   /*
-* next merge is a 'move' pointer,
-* if this one is and B is a
-* subset of the intersection.
-*/
-   next_move = move &&
-   (intersect_type &
-   ACL_INTERSECT_B) == 0;
-
-   if (a_subset && b_full) {
-   rc = acl_merge(context,
-   node_a->ptrs[n].ptr,
-   node_b->ptrs[m].ptr,
-   next_move,
-   1, level + 1);
-   if (rc != 0)
-   return rc;
-   } else {
-   rc = acl_merge_intersect(
-   context, node_a, n,
-   node_b, m, next_move,
-   level, _ptr);
-   if (rc != 0)
-   return rc;
-   }
+   acl_intsct_type =
+   intersect_type & ACL_INTERSECT;
+   num_cats = (context->cfg.num_categories != 1 ||
+   !(node_a->ptrs[n].ptr->match_flag));
+
+   if (!(acl_intsct_type && num_cats))
+   continue;
+
+   /*
+* next merge is a 'move' pointer,
+* if this one is and B is a
+* subset of the intersection.
+*/
+   next_move = move &&
+   (intersect_type &
+   ACL_INTERSECT_B) == 0;
+
+   if (a_subset && b_full) {
+   rc = acl_merge(context,
+   node_a->ptrs[n].ptr,
+   node_b->ptrs[m].ptr,
+   next_move,
+   1, level + 1);
+

[dpdk-dev] [PATCH 0/2] Fix checkpatch errors

2014-12-25 Thread Ravi Kerur
checkpatch script is run against files in librte_acl and
librte_mempool files. No functionality change.
Changes are tested in Ubuntu and FreeBSD. 

Ravi Kerur (2):
  Fix checkpatch errors in librte_acl
  Fix checkpatch errors in librte_mempool

 lib/librte_acl/acl_bld.c  | 192 ++
 lib/librte_acl/rte_acl.c  |   3 +-
 lib/librte_acl/rte_acl_osdep_alone.h  |   3 +-
 lib/librte_acl/tb_mem.c   |   5 +-
 lib/librte_mempool/rte_dom0_mempool.c |  41 
 lib/librte_mempool/rte_mempool.c  |  64 +++-
 lib/librte_mempool/rte_mempool.h  |  58 ++
 7 files changed, 203 insertions(+), 163 deletions(-)

-- 
1.9.1



[dpdk-dev] No probed ethernet devices /DPDP 1.7.1 in Fedora 21

2014-12-25 Thread sothy shan
On Wed, Dec 24, 2014 at 4:04 PM, Neil Horman  wrote:

> On Wed, Dec 24, 2014 at 02:26:21PM +0100, sothy shan wrote:
> > Hello!
> >
> > I am playing with DPDK 1.7.1 in Fedora.
> >
> > When I do like this:
> >
> > export RTE_SDK=$(pwd)export RTE_TARGET="x86_64-ivshmem-linuxapp-gcc"
> > make install T="$RTE_TARGET"
> >
> > It worked. Means Testpmd is running.
> >
> > When I run as mentioned below:
> >
> > make CONFIG_RTE_BUILD_SHARED_LIB=y  install T="$RTE_TARGET"
> >
> > Build is sucess. But Testpmd gives error.
> >
> > Error is :
> >
> The dpdk ivshmem build assumes the presence of ivshmem devices as plumbed
> by
> qemu virtual guests.  If you don't have a qemu guest running dpdk won't
> find any
> shared memory devices, which is exactly what you are seeing.  That said,
> even if
> you are running qemu guests, IIRC Fedora doesn't enable ivshmem because
> the code
> has some security and behavioral issues still I think.  You'll need to
> rebuild
> qemu to add support for it.
>

My understanding is that It is problem of enabling
CONFIG_RTE_BUILD_SHARED_LIB=y in make command, I am able to build target of
x86_64-ivshmem-linuxapp-gcc alone without shared_lib flag. I suspect an
error because of shared lib flag.

Sothy

>
> Neil
>
>


[dpdk-dev] [PATCH 0/4] Integrate ethertype filter in igb/ixgbe driver to new API

2014-12-25 Thread Qiu, Michael
On 12/25/2014 11:39 AM, Wu, Jingjing wrote:
> Hi, Michael
>
> It's a long discuss in community.
>
> Due to in the development in i40e driver, we defined a new common API used 
> for kinds of filters. In R1.8, because of time limit and compatibility, we 
> just used the new API for i40e driver. While other driver still use old ones.
> We have planned to integrate filter to this new API to make the APIs generic 
> for different types of NICs.

OK, got it, sorry for missing the old thread :)

If you will have new version patch, I would like you add the statement
to the commit log, it could be better for other to understand why :)

Thanks,
Michael
> Jingjing
>
>
>> -Original Message-
>> From: Qiu, Michael
>> Sent: Thursday, December 25, 2014 11:27 AM
>> To: Wu, Jingjing; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH 0/4] Integrate ethertype filter in igb/ixgbe
>> driver to new API
>>
>> Hi Jingjing,
>>
>> Would you mind to tell me why need new APIs? Any functional or
>> performance increase?
>> Better to state in commit log.
>>
>> You know it should be careful to change APIs, especially for user interface.
>>
>> Thanks,
>> Michael
>> On 12/25/2014 11:14 AM, Jingjing Wu wrote:
>>> The patch set uses new filter_ctrl API to replace old ethertype filter APIs.
>>> It uses new functions and structure to replace old ones in igb/ixgbe
>>> driver, new commands to replace old ones in testpmd, and removes the
>> old APIs.
>>> Jingjing Wu (4):
>>>   ixgbe: new functions replaces old ones for ethertype filters
>>>   e1000: new functions replaces old ones for ethertype filters
>>>   testpmd: new commands for ethertype filter
>>>   ethdev: remove old APIs and structures of ethertype filters
>>>
>>>  app/test-pmd/cmdline.c  | 253 --
>>>  app/test-pmd/config.c   |  27 ---
>>>  lib/librte_ether/rte_ethdev.c   |  57 --
>>>  lib/librte_ether/rte_ethdev.h   |  88 -
>>>  lib/librte_pmd_e1000/e1000_ethdev.h |  13 ++
>>>  lib/librte_pmd_e1000/igb_ethdev.c   | 332 +-
>> ---
>>>  lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 354
>>> +++-
>>>  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  13 ++
>>>  8 files changed, 579 insertions(+), 558 deletions(-)
>>>
>



[dpdk-dev] [PATCH 0/4] Integrate ethertype filter in igb/ixgbe driver to new API

2014-12-25 Thread Wu, Jingjing
Hi, Michael

It's a long discuss in community.

Due to in the development in i40e driver, we defined a new common API used for 
kinds of filters. In R1.8, because of time limit and compatibility, we just 
used the new API for i40e driver. While other driver still use old ones.
We have planned to integrate filter to this new API to make the APIs generic 
for different types of NICs.

Jingjing


> -Original Message-
> From: Qiu, Michael
> Sent: Thursday, December 25, 2014 11:27 AM
> To: Wu, Jingjing; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 0/4] Integrate ethertype filter in igb/ixgbe
> driver to new API
> 
> Hi Jingjing,
> 
> Would you mind to tell me why need new APIs? Any functional or
> performance increase?
> Better to state in commit log.
> 
> You know it should be careful to change APIs, especially for user interface.
> 
> Thanks,
> Michael
> On 12/25/2014 11:14 AM, Jingjing Wu wrote:
> > The patch set uses new filter_ctrl API to replace old ethertype filter APIs.
> > It uses new functions and structure to replace old ones in igb/ixgbe
> > driver, new commands to replace old ones in testpmd, and removes the
> old APIs.
> >
> > Jingjing Wu (4):
> >   ixgbe: new functions replaces old ones for ethertype filters
> >   e1000: new functions replaces old ones for ethertype filters
> >   testpmd: new commands for ethertype filter
> >   ethdev: remove old APIs and structures of ethertype filters
> >
> >  app/test-pmd/cmdline.c  | 253 --
> >  app/test-pmd/config.c   |  27 ---
> >  lib/librte_ether/rte_ethdev.c   |  57 --
> >  lib/librte_ether/rte_ethdev.h   |  88 -
> >  lib/librte_pmd_e1000/e1000_ethdev.h |  13 ++
> >  lib/librte_pmd_e1000/igb_ethdev.c   | 332 +-
> ---
> >  lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 354
> > +++-
> >  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  13 ++
> >  8 files changed, 579 insertions(+), 558 deletions(-)
> >



[dpdk-dev] [PATCH 0/4] Integrate ethertype filter in igb/ixgbe driver to new API

2014-12-25 Thread Qiu, Michael
Hi Jingjing,

Would you mind to tell me why need new APIs? Any functional or
performance increase?
Better to state in commit log.

You know it should be careful to change APIs, especially for user
interface. 

Thanks,
Michael
On 12/25/2014 11:14 AM, Jingjing Wu wrote:
> The patch set uses new filter_ctrl API to replace old ethertype filter APIs.
> It uses new functions and structure to replace old ones in igb/ixgbe driver,
> new commands to replace old ones in testpmd, and removes the old APIs. 
>
> Jingjing Wu (4):
>   ixgbe: new functions replaces old ones for ethertype filters
>   e1000: new functions replaces old ones for ethertype filters
>   testpmd: new commands for ethertype filter
>   ethdev: remove old APIs and structures of ethertype filters
>
>  app/test-pmd/cmdline.c  | 253 --
>  app/test-pmd/config.c   |  27 ---
>  lib/librte_ether/rte_ethdev.c   |  57 --
>  lib/librte_ether/rte_ethdev.h   |  88 -
>  lib/librte_pmd_e1000/e1000_ethdev.h |  13 ++
>  lib/librte_pmd_e1000/igb_ethdev.c   | 332 +
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 354 
> +++-
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  13 ++
>  8 files changed, 579 insertions(+), 558 deletions(-)
>



[dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS

2014-12-25 Thread Ouyang, Changchun
Hi,
Sorry miss some comments, so continue my response below,

> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Wednesday, December 24, 2014 6:40 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS
> 
> 
> On 12/24/14 07:23, Ouyang Changchun wrote:
> > It needs config RSS and IXGBE_MRQC and IXGBE_VFPSRTYPE to enable VF
> RSS.
> >
> > The psrtype will determine how many queues the received packets will
> > distribute to, and the value of psrtype should depends on both facet:
> > max VF rxq number which has been negotiated with PF, and the number of
> rxq specified in config on guest.
> >
> > Signed-off-by: Changchun Ouyang 
> > ---
> >   lib/librte_pmd_ixgbe/ixgbe_pf.c   | 15 +++
> >   lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 92
> ++-
> >   2 files changed, 97 insertions(+), 10 deletions(-)
> >
> > diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> > b/lib/librte_pmd_ixgbe/ixgbe_pf.c index cbb0145..9c9dad8 100644
> > --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> > +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
> > @@ -187,6 +187,21 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
> *eth_dev)
> > IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(hw-
> >mac.num_rar_entries), 0);
> > IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(hw-
> >mac.num_rar_entries), 0);
> >
> > +   /*
> > +* VF RSS can support at most 4 queues for each VF, even if
> > +* 8 queues are available for each VF, it need refine to 4
> > +* queues here due to this limitation, otherwise no queue
> > +* will receive any packet even RSS is enabled.
> 
> According to Table 7-3 in the 82599 spec RSS is not available when port is
> configured to have 8 queues per pool. This means that if u see this
> configuration u may immediately disable RSS flow in your code.
> 
> > +*/
> > +   if (eth_dev->data->dev_conf.rxmode.mq_mode ==
> ETH_MQ_RX_VMDQ_RSS) {
> > +   if (RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool == 8) {
> > +   RTE_ETH_DEV_SRIOV(eth_dev).active =
> ETH_32_POOLS;
> > +   RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 4;
> > +   RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =
> > +   dev_num_vf(eth_dev) * 4;
> 
> According to 82599 spec u can't do that since RSS is not allowed when port is
> configured to have 8 function per-VF. Have u verified that this works? If yes,
> then spec should be updated.
> 
> > +   }
> > +   }
> > +
> > /* set VMDq map to default PF pool */
> > hw->mac.ops.set_vmdq(hw, 0,
> > RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
> >
> > diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> > b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> > index f69abda..a7c17a4 100644
> > --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> > +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> > @@ -3327,6 +3327,39 @@ ixgbe_alloc_rx_queue_mbufs(struct
> igb_rx_queue *rxq)
> >   }
> >
> >   static int
> > +ixgbe_config_vf_rss(struct rte_eth_dev *dev) {
> > +   struct ixgbe_hw *hw;
> > +   uint32_t mrqc;
> > +
> > +   ixgbe_rss_configure(dev);
> > +
> > +   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +
> > +   /* MRQC: enable VF RSS */
> > +   mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC);
> > +   mrqc &= ~IXGBE_MRQC_MRQE_MASK;
> > +   switch (RTE_ETH_DEV_SRIOV(dev).active) {
> > +   case ETH_64_POOLS:
> > +   mrqc |= IXGBE_MRQC_VMDQRSS64EN;
> > +   break;
> > +
> > +   case ETH_32_POOLS:
> > +   case ETH_16_POOLS:
> > +   mrqc |= IXGBE_MRQC_VMDQRSS32EN;
> 
> Again, this contradicts with the spec.
Yes, the spec say the hw can't support vf rss at all, but experiment find that 
could be done.
We can focus on discussing the implementation firstly.

> > +   break;
> > +
> > +   default:
> > +   PMD_INIT_LOG(ERR, "Invalid pool number in IOV mode");
> > +   return -EINVAL;
> > +   }
> > +
> > +   IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
> > +
> > +   return 0;
> > +}
> > +
> > +static int
> >   ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
> >   {
> > struct ixgbe_hw *hw =
> > @@ -3358,24 +3391,38 @@ ixgbe_dev_mq_rx_configure(struct
> rte_eth_dev *dev)
> > default: ixgbe_rss_disable(dev);
> > }
> > } else {
> > -   switch (RTE_ETH_DEV_SRIOV(dev).active) {
> > /*
> >  * SRIOV active scheme
> >  * FIXME if support DCB/RSS together with VMDq & SRIOV
> >  */
> > -   case ETH_64_POOLS:
> > -   IXGBE_WRITE_REG(hw, IXGBE_MRQC,
> IXGBE_MRQC_VMDQEN);
> > +   switch (dev->data->dev_conf.rxmode.mq_mode) {
> > +   case ETH_MQ_RX_RSS:
> > +   case ETH_MQ_RX_VMDQ_RSS:
> > +   ixgbe_config_vf_rss(dev);
> > break;
> >
> > -   case ETH_32_POOLS:
> > -   IXGBE_WRITE_REG(hw, IXGBE_MRQC,
> IXGBE_MRQC_VMDQRT4TCEN);
> > -   

[dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic

2014-12-25 Thread Ouyang, Changchun
Hi,

> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Wednesday, December 24, 2014 6:49 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
> 
> 
> On 12/24/14 07:22, Ouyang Changchun wrote:
> > This patch enables VF RSS for Niantic, which allow each VF having at most 4
> queues.
> > The actual queue number per VF depends on the total number of pool,
> > which is determined by the total number of VF at PF initialization
> > stage and the number of queue specified in config:
> > 1) If the number of VF is in the range from 1 to 32 and the number of
> > rxq is 4('--rxq 4' in testpmd), then there is totally 32
> > pools(ETH_32_POOLS), and each VF have 4 queues;
> >
> > 2)If the number of VF is in the range from 33 to 64 and the number of
> > rxq is 2('--rxq 2' in testpmd), then there is totally 64
> > pools(ETH_64_POOLS), and each VF have 2 queues;
> >
> > On host, to enable VF RSS functionality, rx mq mode should be set as
> > ETH_MQ_RX_VMDQ_RSS or ETH_MQ_RX_RSS mode, and SRIOV mode
> should be activated(max_vfs >= 1).
> > It also needs config VF RSS information like hash function, RSS key, RSS key
> length.
> >
> > The limitation for Niantic VF RSS is:
> > the hash and key are shared among PF and all VF, the RETA table with
> > 128 entries are also shared among PF and all VF. So it is not good
> > idea to query the hash and reta content per VF on guest, instead, it makes
> sense to query them on host(PF).
> >
> > v3 change:
> >- More cleanup;
> 
> This series is still missing the appropriate patches in the
> rte_eth_dev_info_get() flow to return a reta_size for a VF device; and to
> rte_eth_dev_rss_reta_query() in the context of a VF device (I haven't
> noticed the initialization of a
> dev->dev_ops->reta_query for the VF device in this series).
> 
> Without these code bits it's impossible to work with the VF devices in the RSS
> context the same way we work with the PF devices. It means that we'll have
> to do some special branching to handle the VF device and this voids the
> whole meaning of the framework which in turn is very unfortunate.
> 
Again pls try to query reta content on pf/host, this is due to hw limitation,
It don't affect any functionality, just the querying is special.
Before this patch, customer often was notified Niantic can't support vf rss,
But with lots of experiments and find that it still has limited vf rss 
functionality.
Even on that, linux ixgbe driver has at most 2 queues per vf,
But the dpdk could enable 4 queues per vf.
In summary, dpdk could support vf rss on Niantic with at most 4 queues per vf,
but the querying of reta is very limited due to the HW limitation.  
Hope you are on the same page now.

Thanks
Changchun



[dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS

2014-12-25 Thread Ouyang, Changchun
Hi,

> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Wednesday, December 24, 2014 6:40 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 5/6] ixgbe: Config VF RSS
> 
> 
> On 12/24/14 07:23, Ouyang Changchun wrote:
> > It needs config RSS and IXGBE_MRQC and IXGBE_VFPSRTYPE to enable VF
> RSS.
> >
> > The psrtype will determine how many queues the received packets will
> > distribute to, and the value of psrtype should depends on both facet:
> > max VF rxq number which has been negotiated with PF, and the number of
> rxq specified in config on guest.
> >
> > Signed-off-by: Changchun Ouyang 
> > ---
> >   lib/librte_pmd_ixgbe/ixgbe_pf.c   | 15 +++
> >   lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 92
> ++-
> >   2 files changed, 97 insertions(+), 10 deletions(-)
> >
> > diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> > b/lib/librte_pmd_ixgbe/ixgbe_pf.c index cbb0145..9c9dad8 100644
> > --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> > +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
> > @@ -187,6 +187,21 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
> *eth_dev)
> > IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(hw-
> >mac.num_rar_entries), 0);
> > IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(hw-
> >mac.num_rar_entries), 0);
> >
> > +   /*
> > +* VF RSS can support at most 4 queues for each VF, even if
> > +* 8 queues are available for each VF, it need refine to 4
> > +* queues here due to this limitation, otherwise no queue
> > +* will receive any packet even RSS is enabled.
> 
> According to Table 7-3 in the 82599 spec RSS is not available when port is
> configured to have 8 queues per pool. This means that if u see this
> configuration u may immediately disable RSS flow in your code.
> 
8 queues here means the available number queue per vf, it is calculated 
according to max vfs,
e.g. if max vfs is 16(or less than), then each vf 'COULD' have 8 queues evenly, 
pf early init stage estimate this value,
but that is not precise, so need refine this.
User don't know this estimated value, it is internal value, not come from 
user's input/configure.
Hope it is clear to you.
> > +*/
> > +   if (eth_dev->data->dev_conf.rxmode.mq_mode ==
> ETH_MQ_RX_VMDQ_RSS) {
> > +   if (RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool == 8) {
> > +   RTE_ETH_DEV_SRIOV(eth_dev).active =
> ETH_32_POOLS;
> > +   RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 4;
> > +   RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =
> > +   dev_num_vf(eth_dev) * 4;
> 
> According to 82599 spec u can't do that since RSS is not allowed when port is
> configured to have 8 function per-VF. Have u verified that this works? If yes,
> then spec should be updated.
>
Response as above,
Of course I have validated this. It works well.

> > +   }
> > +   }
> > +
> > /* set VMDq map to default PF pool */
> > hw->mac.ops.set_vmdq(hw, 0,
> > RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
> >
> > diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> > b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> > index f69abda..a7c17a4 100644
> > --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> > +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> > @@ -3327,6 +3327,39 @@ ixgbe_alloc_rx_queue_mbufs(struct
> igb_rx_queue *rxq)
> >   }
> >
> >   static int
> > +ixgbe_config_vf_rss(struct rte_eth_dev *dev) {
> > +   struct ixgbe_hw *hw;
> > +   uint32_t mrqc;
> > +
> > +   ixgbe_rss_configure(dev);
> > +
> > +   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +
> > +   /* MRQC: enable VF RSS */
> > +   mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC);
> > +   mrqc &= ~IXGBE_MRQC_MRQE_MASK;
> > +   switch (RTE_ETH_DEV_SRIOV(dev).active) {
> > +   case ETH_64_POOLS:
> > +   mrqc |= IXGBE_MRQC_VMDQRSS64EN;
> > +   break;
> > +
> > +   case ETH_32_POOLS:
> > +   case ETH_16_POOLS:
> > +   mrqc |= IXGBE_MRQC_VMDQRSS32EN;
> 
> Again, this contradicts with the spec.
> 
> > +   break;
> > +
> > +   default:
> > +   PMD_INIT_LOG(ERR, "Invalid pool number in IOV mode");
> > +   return -EINVAL;
> > +   }
> > +
> > +   IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
> > +
> > +   return 0;
> > +}
> > +
> > +static int
> >   ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
> >   {
> > struct ixgbe_hw *hw =
> > @@ -3358,24 +3391,38 @@ ixgbe_dev_mq_rx_configure(struct
> rte_eth_dev *dev)
> > default: ixgbe_rss_disable(dev);
> > }
> > } else {
> > -   switch (RTE_ETH_DEV_SRIOV(dev).active) {
> > /*
> >  * SRIOV active scheme
> >  * FIXME if support DCB/RSS together with VMDq & SRIOV
> >  */
> > -   case ETH_64_POOLS:
> > -   IXGBE_WRITE_REG(hw, IXGBE_MRQC,
> IXGBE_MRQC_VMDQEN);
> > +   switch (dev->data->dev_conf.rxmode.mq_mode) {
> > +   case ETH_MQ_RX_RSS:
> > +   case 

[dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic

2014-12-25 Thread Ouyang, Changchun
Hi,

> -Original Message-
> From: Vlad Zolotarov [mailto:vladz at cloudius-systems.com]
> Sent: Wednesday, December 24, 2014 5:59 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Enable VF RSS for Niantic
> 
> 
> On 12/24/14 07:22, Ouyang Changchun wrote:
> > This patch enables VF RSS for Niantic, which allow each VF having at most 4
> queues.
> > The actual queue number per VF depends on the total number of pool,
> > which is determined by the total number of VF at PF initialization
> > stage and the number of queue specified in config:
> > 1) If the number of VF is in the range from 1 to 32 and the number of
> > rxq is 4('--rxq 4' in testpmd), then there is totally 32
> > pools(ETH_32_POOLS), and each VF have 4 queues;
> >
> > 2)If the number of VF is in the range from 33 to 64 and the number of
> > rxq is 2('--rxq 2' in testpmd), then there is totally 64
> > pools(ETH_64_POOLS), and each VF have 2 queues;
> >
> > On host, to enable VF RSS functionality, rx mq mode should be set as
> > ETH_MQ_RX_VMDQ_RSS or ETH_MQ_RX_RSS mode, and SRIOV mode
> should be activated(max_vfs >= 1).
> > It also needs config VF RSS information like hash function, RSS key, RSS key
> length.
> >
> > The limitation for Niantic VF RSS is:
> > the hash and key are shared among PF and all VF
> 
> Hmmm... This kinda contradicts the previous sentence where u say that VF
> on the host should configure hash and RSS key. If PF and VF share the same
> hash and key what's the use of configuring it in VF? Could u clarify, please?

What make you think of any "contradicts"? To be more clear, would you pls copy 
and paste which 2 sentences you think of "contradicts",
I can correct it if they are, but currently I don't find them. 
Share means vf doesn't has its own hash function, hash key, and reta table.

> > , the RETA table with 128 entries are
> > also shared among PF and all VF. So it is not good idea to query the
> > hash and reta content per VF on guest, instead, it makes sense to query
> them on host(PF).
> 
> On the contrary - it's a very good idea! We use DPDK on Amazon's guests
> with enhanced networking and we have no access to the PF. We still need to
> know the RSS redirection rules for our VF pool. From the 82599 spec, chapter
> 4.6.10.1.1: "redirection table is common to all the pools and only indicates 
> the
> queue inside the pool to use once the pool is chosen". In that case we need
> to get the whole 128 entries of the RETA. Is there a reason why we can't have
> it?
>
Due to hardware limitation, VF could not query its own reta table, because 
there is not its own reta,
The reta table shared by pf and all vfs.
If you need know it, query them on pf is feasible way to do it.

> >
> > v3 change:
> >- More cleanup;
> >
> > v2 change:
> >- Update the description;
> >- Use receiving queue number('--rxq ') specified in config to
> determine the number of pool and
> >  the number of queue per VF;
> >
> > v1 change:
> >- Config VF RSS;
> >
> > Changchun Ouyang (6):
> >ixgbe: Code cleanup
> >ixgbe: Negotiate VF API version
> >ixgbe: Get VF queue number
> >ether: Check VMDq RSS mode
> >ixgbe: Config VF RSS
> >testpmd: Set Rx VMDq RSS mode
> >
> >   app/test-pmd/testpmd.c  |  10 +++
> >   lib/librte_ether/rte_ethdev.c   |  39 +--
> >   lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   1 +
> >   lib/librte_pmd_ixgbe/ixgbe_pf.c |  75 -
> >   lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 127
> 
> >   5 files changed, 219 insertions(+), 33 deletions(-)
> >



[dpdk-dev] [PATCH] i40e: workaround for XL710 performance

2014-12-25 Thread Zhang, Helin
Hi Neil

> -Original Message-
> From: Neil Horman [mailto:nhorman at tuxdriver.com]
> Sent: Wednesday, December 24, 2014 10:55 PM
> To: Zhang, Helin
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] i40e: workaround for XL710 performance
> 
> On Wed, Dec 24, 2014 at 03:14:08PM +0800, Helin Zhang wrote:
> > on XL710, performance number is far from the expectation on recent
> > firmware versions, if promiscuous mode is disabled, or promiscuous
> > mode is enabled and port MAC address is equal to the packet
> > destination MAC address. The fix for this issue may not be integrated
> > in the following firmware version. So the workaround in software
> > driver is needed. It needs to modify the initial values of 2 internal
> > only registers which is the same 2 of 3 registers of it did for X710.
> > Note that the workaround can be removed when it is fixed in firmware
> > in the future.
> >
> > Signed-off-by: Helin Zhang 
> > ---
> >  lib/librte_pmd_i40e/i40e_ethdev.c | 35
> > ++-
> >  1 file changed, 22 insertions(+), 13 deletions(-)
> >
> > diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> > b/lib/librte_pmd_i40e/i40e_ethdev.c
> > index b47a3d2..3bb75d8 100644
> > --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> > +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> > @@ -5327,21 +5327,30 @@ i40e_debug_read_register(struct i40e_hw *hw,
> > uint32_t addr, uint64_t *val)
> >
> >  /*
> >   * On X710, performance number is far from the expectation on recent
> > firmware
> > - * versions. The fix for this issue may not be integrated in the
> > following
> > + * versions; on XL710, performance number is also far from the
> > + expectation on
> > + * recent firmware versions, if promiscuous mode is disabled, or
> > + promiscuous
> > + * mode is enabled and port MAC address is equal to the packet
> > + destination MAC
> > + * address. The fix for this issue may not be integrated in the
> > + following
> >   * firmware version. So the workaround in software driver is needed.
> > It needs
> > - * to modify the initial values of 3 internal only registers. Note
> > that the
> > - * workaround can be removed when it is fixed in firmware in the future.
> > + * to modify the initial values of 3 internal only registers for
> > + X710, and the
> > + * same 2 internal registers for XL710. Note that the workaround can
> > + be removed
> > + * when it is fixed in firmware in the future.
> 
> Wouldn't it be preferable to add a firmware version check to this code so 
> that a
> single driver can handle both cards with old and 'fixed' firmware?  That way
> nothing needs to be removed and all i40e cards will have a consistent behavior
> Neil
Yes, good idea!
The problem is that no firmware contains this fix till now, firmware guys even
cannot tell me which version will have this fix at this moment.
As it reads the registers first, and compares if it is what we wanted, and then
decides if a write is needed or not. With this, removing this piece of code is 
not
actually needed even a fix occur in the future, though the code will be 
redundant.

Thank you for the comments!

Regards,
Helin

> 
> >   */
> > -static void
> > -i40e_configure_registers(struct i40e_hw *hw) -{
> > -#define I40E_GL_SWR_PRI_JOIN_MAP_0   0x26CE00
> > -#define I40E_GL_SWR_PRI_JOIN_MAP_2   0x26CE08
> > -#define I40E_GL_SWR_PM_UP_THR0x269FBC
> > +
> > +/* For both X710 and XL710 */
> >  #define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x1200
> > +#define I40E_GL_SWR_PRI_JOIN_MAP_0   0x26CE00
> > +
> >  #define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
> > +#define I40E_GL_SWR_PRI_JOIN_MAP_2   0x26CE08
> > +
> > +/* For X710 only */
> >  #define I40E_GL_SWR_PM_UP_THR_VALUE  0x03030303
> > +#define I40E_GL_SWR_PM_UP_THR0x269FBC
> >
> > +static void
> > +i40e_configure_registers(struct i40e_hw *hw) {
> > static const struct {
> > uint32_t addr;
> > uint64_t val;
> > @@ -5354,11 +5363,11 @@ i40e_configure_registers(struct i40e_hw *hw)
> > uint32_t i;
> > int ret;
> >
> > -   /* Below fix is for X710 only */
> > -   if (i40e_is_40G_device(hw->device_id))
> > -   return;
> > -
> > for (i = 0; i < RTE_DIM(reg_table); i++) {
> > +   if ((i40e_is_40G_device(hw->device_id)) &&
> > +   (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR))
> > +   continue;
> > +
> > ret = i40e_debug_read_register(hw, reg_table[i].addr, );
> > if (ret < 0) {
> > PMD_DRV_LOG(ERR, "Failed to read from 0x%"PRIx32,
> > --
> > 1.9.3
> >
> >


[dpdk-dev] No probed ethernet devices /DPDP 1.7.1 in Fedora 21

2014-12-25 Thread Masaru Oki
Hi,

> EAL: Searching for IVSHMEM devices...
> EAL: No IVSHMEM configuration found!

ivshmem is used with QEMU virtual machine.
see http://dpdk.org/doc/guides/prog_guide/ivshmem_lib.html

Try RTE_TARGET="x86_64-native-linuxapp-gcc".


2014-12-24 22:26 GMT+09:00 sothy shan :
> Hello!
>
> I am playing with DPDK 1.7.1 in Fedora.
>
> When I do like this:
>
> export RTE_SDK=$(pwd)export RTE_TARGET="x86_64-ivshmem-linuxapp-gcc"
> make install T="$RTE_TARGET"
>
> It worked. Means Testpmd is running.
>
> When I run as mentioned below:
>
> make CONFIG_RTE_BUILD_SHARED_LIB=y  install T="$RTE_TARGET"
>
> Build is sucess. But Testpmd gives error.
>
> Error is :
>
> sudo ./x86_64-ivshmem-linuxapp-gcc/app/testpmd -c7 -n3 -- -i
> --nb-cores=2 --nb-ports=2
> EAL: Detected lcore 0 as core 0 on socket 0
> EAL: Detected lcore 1 as core 1 on socket 0
> EAL: Detected lcore 2 as core 2 on socket 0
> EAL: Detected lcore 3 as core 3 on socket 0
> EAL: Detected lcore 4 as core 0 on socket 0
> EAL: Detected lcore 5 as core 1 on socket 0
> EAL: Detected lcore 6 as core 2 on socket 0
> EAL: Detected lcore 7 as core 3 on socket 0
> EAL: Support maximum 64 logical core(s) by configuration.
> EAL: Detected 8 lcore(s)
> EAL: Searching for IVSHMEM devices...
> EAL: No IVSHMEM configuration found!
> EAL: Setting up memory...
> EAL: Ask a virtual area of 0x1c0 bytes
> EAL: Virtual area found at 0x7f432900 (size = 0x1c0)
> EAL: Ask a virtual area of 0x5c0 bytes
> EAL: Virtual area found at 0x7f432320 (size = 0x5c0)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7f432b60 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7f432b20 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7f432ae0 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7f4322e0 (size = 0x20)
> EAL: Requesting 64 pages of size 2MB from socket 0
> EAL: TSC frequency is ~3691107 KHz
> EAL: Master core 0 is ready (tid=5053c840)
> EAL: Core 2 is ready (tid=21dfd700)
> EAL: Core 1 is ready (tid=225fe700)
> EAL: Error - exiting with code: 1
>   Cause: No probed ethernet devices - check that
> CONFIG_RTE_LIBRTE_IGB_PMD=y and that CONFIG_RTE_LIBRTE_EM_PMD=y and
> that CONFIG_RTE_LIBRTE_IXGBE_PMD=y in your configuration file
>
>
> Any idea where is wrong? Thank for ur reply.
>
> Best regards
> Sothy