[dpdk-dev] [PATCH] DPDK fails to build into one single library ("CONFIG_RTE_BUILD_COMBINE_LIBS=y").

2015-07-20 Thread Thomas Monjalon
2015-07-20 18:04, Rauta, Alin:
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -33,7 +33,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
>  
>  DIRS-y += librte_compat
>  DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
> -DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_malloc

I feel it's not the right fix :)

>From now, I'll test combine lib build.
Thanks for reporting


[dpdk-dev] [PATCH v2 0/3] virtio: size bug fixes

2015-07-20 Thread Thomas Monjalon
2015-07-20 10:25, Stephen Hemminger:
> Fix for a fix for a fix...
> This set includes Changchun's patch for vq_size but adds
> follow on fix to make it work with GCE and other environments.
> 
> Ouyang Changchun (1):
>   virtio: fix the vq size issue
> 
> Stephen Hemminger (2):
>   virtio: allow nb_desc < vq_size
>   virtio: small cleanups

Patch 2 partially reverts what patch 1 introduced.
Merging them will make things clearer.


[dpdk-dev] [PATCH] DPDK fails to build into one single library ("CONFIG_RTE_BUILD_COMBINE_LIBS=y").

2015-07-20 Thread Rauta, Alin
Signed-off-by: Alin Rauta 
---
 lib/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/Makefile b/lib/Makefile index 2055539..9727b83 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -33,7 +33,6 @@ include $(RTE_SDK)/mk/rte.vars.mk

 DIRS-y += librte_compat
 DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
-DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_malloc
 DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
--
2.1.0



[dpdk-dev] [PATCH] DPDK fails to build into one single library ("CONFIG_RTE_BUILD_COMBINE_LIBS=y").

2015-07-20 Thread Rauta, Alin
Hi,

I'm trying to build the latest dpdk code into one combine library, but the 
compilation fails like below. The issue seems to be around "librte_malloc".

" make install T=x86_64-native-linuxapp-gcc"

== Build lib/librte_malloc
  AR librte_malloc.a
cp: missing destination file operand after 
?/root/dpdk/x86_64-native-linuxapp-gcc/build/lib?
Try 'cp --help' for more information.
/root/dpdk/mk/rte.lib.mk:145: recipe for target 'librte_malloc.a' failed
make[5]: *** [librte_malloc.a] Error 1
/root/dpdk/mk/rte.subdir.mk:61: recipe for target 'librte_malloc' failed
make[4]: *** [librte_malloc] Error 2
/root/dpdk/mk/rte.sdkbuild.mk:93: recipe for target 'lib' failed
make[3]: *** [lib] Error 2
/root/dpdk/mk/rte.sdkroot.mk:124: recipe for target 'all' failed
make[2]: *** [all] Error 2
/root/dpdk/mk/rte.sdkinstall.mk:58: recipe for target 
'x86_64-native-linuxapp-gcc_install' failed
make[1]: *** [x86_64-native-linuxapp-gcc_install] Error 2
/root/dpdk/mk/rte.sdkroot.mk:102: recipe for target 'install' failed
make: *** [install] Error 2
[root at silpixa00390856 dpdk]#

I'm not sure if this is the fix or the right fix, I'm also not sure on the 
impact the change has, but commenting out
"-DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_malloc" from "lib/Makefile" makes the 
compilation succeed.

Let me know what you think.

Thanks in advance,
Alin Rauta (1):
  DPDK fails to build into one single library
("CONFIG_RTE_BUILD_COMBINE_LIBS=y").

 lib/Makefile | 1 -
 1 file changed, 1 deletion(-)

-- 
2.1.0



[dpdk-dev] [PATCH v2 1/3] nic_uio: Fix to allow any device to be bound to nic_uio

2015-07-20 Thread Rahul Lakkireddy
Hi David,

On Mon, Jul 20, 2015 at 09:43:57 +0200, David Marchand wrote:
>Hum, what bothers me is that you do not rely on the same criteria to
>re-attach the devices to nic_uio.
>See below.
> 
>  ?lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 48
>  +
>  ?1 file changed, 13 insertions(+), 35 deletions(-)
> 
>  diff --git a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
>  b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
>  index 2354e84..f868dc8 100644
>  --- a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
>  +++ b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
>  [snip]
>  @@ -195,11 +177,10 @@ nic_uio_probe (device_t dev)
>  ?{
>  ? ? ? ? int i;
> 
>  -? ? ? ?for (i = 0; i < NUM_DEVICES; i++)
>  -? ? ? ? ? ? ? ?if (pci_get_vendor(dev) == devices[i].vend &&
>  -? ? ? ? ? ? ? ? ? ? ? ?pci_get_device(dev) == devices[i].dev) {
>  -
>  -? ? ? ? ? ? ? ? ? ? ? ?device_set_desc(dev, "Intel(R) DPDK PCI
>  Device");
>  +? ? ? ?for (i = 0; i < num_detached; i++)
>  +? ? ? ? ? ? ? ?if (pci_get_vendor(dev) ==
>  pci_get_vendor(detached_devices[i]) &&
>  +? ? ? ? ? ? ? ? ? ?pci_get_device(dev) ==
>  pci_get_device(detached_devices[i])) {
>  +? ? ? ? ? ? ? ? ? ? ? ?device_set_desc(dev, "DPDK PCI Device");
>  ? ? ? ? ? ? ? ? ? ? ? ? return BUS_PROBE_SPECIFIC;
>  ? ? ? ? ? ? ? ? }
> 
>When going through the probe stuff, the device vendor and type are used as
>the matching criteria.
> 
>  @@ -256,7 +237,6 @@ static void
>  ?nic_uio_load(void)
>  ?{
>  ? ? ? ? uint32_t bus, device, function;
>  -? ? ? ?int i;
>  ? ? ? ? device_t dev;
>  ? ? ? ? char bdf_str[256];
>  ? ? ? ? char *token, *remaining;
>  @@ -295,17 +275,15 @@ nic_uio_load(void)
>  ? ? ? ? ? ? ? ? if (dev == NULL)
>  ? ? ? ? ? ? ? ? ? ? ? ? continue;
> 
>  -? ? ? ? ? ? ? ?for (i = 0; i < NUM_DEVICES; i++)
>  -? ? ? ? ? ? ? ? ? ? ? ?if (pci_get_vendor(dev) == devices[i].vend &&
>  -? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pci_get_device(dev) ==
>  devices[i].dev) {
>  -? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (num_detached <
>  MAX_DETACHED_DEVICES) {
>  -? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
>  ?printf("nic_uio_load: detaching and storing dev=%p\n", dev);
>  -? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
>  ?detached_devices[num_detached++] = dev;
>  -? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} else
>  -? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
>  ?printf("nic_uio_load: reached MAX_DETACHED_DEVICES=%d. dev=%p won't be
>  reattached\n",
>  -? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
>  ?MAX_DETACHED_DEVICES, dev);
>  -? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?device_detach(dev);
>  -? ? ? ? ? ? ? ? ? ? ? ?}
>  +? ? ? ? ? ? ? ?if (num_detached < MAX_DETACHED_DEVICES) {
>  +? ? ? ? ? ? ? ? ? ? ? ?printf("nic_uio_load: detaching and storing
>  dev=%p\n",
>  +? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dev);
>  +? ? ? ? ? ? ? ? ? ? ? ?detached_devices[num_detached++] = dev;
>  +? ? ? ? ? ? ? ?} else {
>  +? ? ? ? ? ? ? ? ? ? ? ?printf("nic_uio_load: reached
>  MAX_DETACHED_DEVICES=%d. dev=%p won't be reattached\n",
>  +? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MAX_DETACHED_DEVICES, dev);
>  +? ? ? ? ? ? ? ?}
>  +? ? ? ? ? ? ? ?device_detach(dev);
>  ? ? ? ? }
>  ?}
> 
>But here at init time, the bdfs informations are used to detach the pci
>devices.
>I would say this is safer we have the same criteria in both cases.
>I think that the pci addresses are the best criteria since this is what
>the user gives.
>Don't we have them in the dev pointer ?

It looks like we can get them via pci_get_bus(), pci_get_slot(), and
pci_get_function().  Will add check for these 3 info instead of vendor
and device in probe to make it consistent.

> 
>Btw, with this change, we would then be limited to MAX_DETACHED_DEVICES
>devices even if 128 pci devices looks quite big enough to me.
>This part could be reworked (later).
>--
>David Marchand

Thanks,
Rahul


[dpdk-dev] [PATCH] doc: announce ABI change for rte_eth_fdir_filter

2015-07-20 Thread Jingjing Wu
To fix the FVL's flow director issue for SCTP flow, rte_eth_fdir_filter
need to be change to support SCTP flow keys extension. Here announce
the ABI deprecation.

Signed-off-by: jingjing.wu 
---
 doc/guides/rel_notes/deprecation.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 5330d3b..63e19c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -35,3 +35,7 @@ Deprecation Notices
 * The following fields have been deprecated in rte_eth_stats:
   imissed, ibadcrc, ibadlen, imcasts, fdirmatch, fdirmiss,
   tx_pause_xon, rx_pause_xon, tx_pause_xoff, rx_pause_xoff
+
+* Significant ABI change is planned for struct rte_eth_fdir_filter to extend
+  the SCTP flow's key input from release 2.1. The change may be enabled in
+  the upcoming release 2.1 with CONFIG_RTE_NEXT_ABI.
-- 
2.4.0



[dpdk-dev] [PATCH v2 1/1] ixgbe: Fix phy errors in stats->ierrors

2015-07-20 Thread Balazs Nemeth
> Fixes: f6bf669b990004dc69231476d9fcf0b80574e568. Bug fix to remove
> (rxnfgpc - hw_stats->gprc) which does not account for phy errors.
> hw_stats->gprc is the Number of good (non-erred) Rx packets (from the
> network) that pass L2 filtering and has a legal length as defined by
> LongPacketEnable. While rxnfgpc is the Number of good (non-erred with
> legal length) Rx packets (from the network) regardless of packet
> filtering and receive enablement. Thus hw_stats->gprc can be > rxnfgpc
> and this calculation should be removed from the calculation of ierrors.
> Validated with testpmd by sending packets to the interface without
> forwarding enabled - packets should be dropped and the error counters
> incremented.

> v2:
>  - specified the commit that this bug fix fixes

Acked-by: Balazs Nemeth 


[dpdk-dev] ACL: Creation of ACL context with multiple tries

2015-07-20 Thread Sugumaran, Varthamanan
Hi All,
Need your inputs on the following queries on ACL contexts.

1. Has anyone tried creating ACL context with multiple tries?
2. The document/code mentioned that we can have the maximum of 8 
tries(RTE_ACL_MAX_TRIES) per ACL context.
 What is the use case for having more than single trie?
3. If we can create ACL context using multiple tries, then is it possible to 
have trie per category in ACL context? 
Meaning I want to create a single ACL context(that had both ipv4 and ipv6 
rules)  which  have 2 tries with one for ipv4 rules and another one for ipv6 
rules. 

Thanks in Advance.

Thanks
Vartha


[dpdk-dev] [PATCH v2 1/1] ixgbe: Fix phy errors in stats->ierrors

2015-07-20 Thread Maryam Tahhan
Fixes: f6bf669b990004dc69231476d9fcf0b80574e568. Bug fix to remove
(rxnfgpc - hw_stats->gprc) which does not account for phy errors.
hw_stats->gprc is the Number of good (non-erred) Rx packets (from the
network) that pass L2 filtering and has a legal length as defined by
LongPacketEnable. While rxnfgpc is the Number of good (non-erred with
legal length) Rx packets (from the network) regardless of packet
filtering and receive enablement. Thus hw_stats->gprc can be > rxnfgpc
and this calculation should be removed from the calculation of ierrors.
Validated with testpmd by sending packets to the interface without
forwarding enabled - packets should be dropped and the error counters
incremented.

v2:
 - specified the commit that this bug fix fixes.

Signed-off-by: Maryam Tahhan 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3a8cff0..09fac25 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2143,8 +2143,7 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
  hw_stats->rfc +
  hw_stats->rjc +
  hw_stats->fccrc +
- hw_stats->fclast +
- (rxnfgpc - hw_stats->gprc); /* PHY Errors*/
+ hw_stats->fclast;

/* Tx Errors */
/*txdgpc: packets that are DMA'ed*/
-- 
2.4.3



[dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX queue information

2015-07-20 Thread Konstantin Ananyev
Signed-off-by: Konstantin Ananyev 
---
 app/test-pmd/cmdline.c | 48 
 app/test-pmd/config.c  | 67 ++
 app/test-pmd/testpmd.h |  2 ++
 3 files changed, 117 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 8ab4687..29180de 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5304,6 +5304,53 @@ cmdline_parse_inst_t cmd_showport = {
},
 };

+/* *** SHOW QUEUE INFO *** */
+struct cmd_showqueue_result {
+   cmdline_fixed_string_t show;
+   cmdline_fixed_string_t type;
+   cmdline_fixed_string_t what;
+   uint8_t portnum;
+   uint16_t queuenum;
+};
+
+static void
+cmd_showqueue_parsed(void *parsed_result,
+   __attribute__((unused)) struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_showqueue_result *res = parsed_result;
+
+   if (!strcmp(res->type, "rxq"))
+   rx_queue_infos_display(res->portnum, res->queuenum);
+   else if (!strcmp(res->type, "txq"))
+   tx_queue_infos_display(res->portnum, res->queuenum);
+}
+
+cmdline_parse_token_string_t cmd_showqueue_show =
+   TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, show, "show");
+cmdline_parse_token_string_t cmd_showqueue_type =
+   TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, type, "rxq#txq");
+cmdline_parse_token_string_t cmd_showqueue_what =
+   TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, what, "info");
+cmdline_parse_token_num_t cmd_showqueue_portnum =
+   TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result, portnum, UINT8);
+cmdline_parse_token_num_t cmd_showqueue_queuenum =
+   TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result, queuenum, UINT16);
+
+cmdline_parse_inst_t cmd_showqueue = {
+   .f = cmd_showqueue_parsed,
+   .data = NULL,
+   .help_str = "show rxq|txq info  ",
+   .tokens = {
+   (void *)_showqueue_show,
+   (void *)_showqueue_type,
+   (void *)_showqueue_what,
+   (void *)_showqueue_portnum,
+   (void *)_showqueue_queuenum,
+   NULL,
+   },
+};
+
 /* *** READ PORT REGISTER *** */
 struct cmd_read_reg_result {
cmdline_fixed_string_t read;
@@ -8913,6 +8960,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)_help_long,
(cmdline_parse_inst_t *)_quit,
(cmdline_parse_inst_t *)_showport,
+   (cmdline_parse_inst_t *)_showqueue,
(cmdline_parse_inst_t *)_showportall,
(cmdline_parse_inst_t *)_showcfg,
(cmdline_parse_inst_t *)_start,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1d29146..f1fd6b1 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -293,6 +293,73 @@ nic_stats_mapping_display(portid_t port_id)
 }

 void
+rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
+{
+   struct rte_eth_rxq_info qinfo;
+   int32_t rc;
+   static const char *info_border = "*";
+
+   rc = rte_eth_rx_queue_info_get(port_id, queue_id, );
+   if (rc != 0) {
+   printf("Failed to retrieve inforamtion for port: %hhu, "
+   "RX queue: %hu\nerror desc: %s(%d)\n",
+   port_id, queue_id, strerror(-rc), rc);
+   return;
+   }
+
+   printf("\n%s Infos for port %-2u, RX queue %-2u %s",
+  info_border, port_id, queue_id, info_border);
+
+   printf("\nMempool: %s", (qinfo.mp == NULL) ? "NULL" : qinfo.mp->name);
+   printf("\nRX prefetch threshold: %hhu", qinfo.conf.rx_thresh.pthresh);
+   printf("\nRX host threshold: %hhu", qinfo.conf.rx_thresh.hthresh);
+   printf("\nRX writeback threshold: %hhu", qinfo.conf.rx_thresh.wthresh);
+   printf("\nRX free threshold: %hu", qinfo.conf.rx_free_thresh);
+   printf("\nRX drop packets: %s",
+   (qinfo.conf.rx_drop_en != 0) ? "on" : "off");
+   printf("\nRX deferred start: %s",
+   (qinfo.conf.rx_deferred_start != 0) ? "on" : "off");
+   printf("\nRX scattered packets: %s",
+   (qinfo.scattered_rx != 0) ? "on" : "off");
+   printf("\nNumber of RXDs: %hu", qinfo.nb_desc);
+   printf("\nMax possible number of RXDs: %hu", qinfo.max_desc);
+   printf("\nMin possible number of RXDs: %hu", qinfo.min_desc);
+   printf("\n");
+}
+
+void
+tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
+{
+   struct rte_eth_txq_info qinfo;
+   int32_t rc;
+   static const char *info_border = "*";
+
+   rc = rte_eth_tx_queue_info_get(port_id, queue_id, );
+   if (rc != 0) {
+   printf("Failed to retrieve inforamtion for port: %hhu, "
+   "TX queue: %hu\nerror desc: %s(%d)\n",
+   port_id, queue_id, strerror(-rc), rc);
+   return;
+   }
+
+   printf("\n%s Infos for port 

[dpdk-dev] [PATCHv3 3/5] ixgbe: add support for eth_(rxq|txq)_info_get

2015-07-20 Thread Konstantin Ananyev
Signed-off-by: Konstantin Ananyev 
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  4 
 drivers/net/ixgbe/ixgbe_ethdev.h |  6 ++
 drivers/net/ixgbe/ixgbe_rxtx.c   | 42 
 3 files changed, 52 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3a8cff0..053279e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -431,6 +431,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.rss_hash_conf_get= ixgbe_dev_rss_hash_conf_get,
.filter_ctrl  = ixgbe_dev_filter_ctrl,
.set_mc_addr_list = ixgbe_dev_set_mc_addr_list,
+   .rxq_info_get = ixgbe_rxq_info_get,
+   .txq_info_get = ixgbe_txq_info_get,
.timesync_enable  = ixgbe_timesync_enable,
.timesync_disable = ixgbe_timesync_disable,
.timesync_read_rx_timestamp = ixgbe_timesync_read_rx_timestamp,
@@ -466,6 +468,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
.mac_addr_add = ixgbevf_add_mac_addr,
.mac_addr_remove  = ixgbevf_remove_mac_addr,
.set_mc_addr_list = ixgbe_dev_set_mc_addr_list,
+   .rxq_info_get = ixgbe_rxq_info_get,
+   .txq_info_get = ixgbe_txq_info_get,
.mac_addr_set = ixgbevf_set_default_mac_addr,
.get_reg_length   = ixgbevf_get_reg_length,
.get_reg  = ixgbevf_get_regs,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c16c11d..190c34a 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -347,6 +347,12 @@ int ixgbe_dev_tx_queue_start(struct rte_eth_dev *dev, 
uint16_t tx_queue_id);

 int ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);

+void ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+   struct rte_eth_rxq_info *qinfo);
+
+void ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+   struct rte_eth_txq_info *qinfo);
+
 int ixgbevf_dev_rx_init(struct rte_eth_dev *dev);

 void ixgbevf_dev_tx_init(struct rte_eth_dev *dev);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 9b2d637..f910fb8 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -4689,6 +4689,48 @@ ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, 
uint16_t tx_queue_id)
return 0;
 }

+void
+ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+   struct rte_eth_rxq_info *qinfo)
+{
+   struct ixgbe_rx_queue *rxq;
+
+   rxq = dev->data->rx_queues[queue_id];
+
+   qinfo->mp = rxq->mb_pool;
+   qinfo->scattered_rx = dev->data->scattered_rx;
+
+   qinfo->nb_desc = rxq->nb_rx_desc;
+   qinfo->max_desc = IXGBE_MAX_RING_DESC;
+   qinfo->min_desc = IXGBE_MIN_RING_DESC;
+
+   qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+   qinfo->conf.rx_drop_en = rxq->drop_en;
+   qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+void
+ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+   struct rte_eth_txq_info *qinfo)
+{
+   struct ixgbe_tx_queue *txq;
+
+   txq = dev->data->tx_queues[queue_id];
+
+   qinfo->nb_desc = txq->nb_tx_desc;
+   qinfo->max_desc = IXGBE_MAX_RING_DESC;
+   qinfo->min_desc = IXGBE_MIN_RING_DESC;
+
+   qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+   qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+   qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+   qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+   qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+   qinfo->conf.txq_flags = txq->txq_flags;
+   qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
+
 /*
  * [VF] Initializes Receive Unit.
  */
-- 
1.8.3.1



[dpdk-dev] [PATCHv3 2/5] i40e: add support for eth_(rxq|txq)_info_get

2015-07-20 Thread Konstantin Ananyev
Signed-off-by: Konstantin Ananyev 
---
 drivers/net/i40e/i40e_ethdev.c |  2 ++
 drivers/net/i40e/i40e_ethdev.h |  5 +
 drivers/net/i40e/i40e_rxtx.c   | 42 ++
 3 files changed, 49 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 40b0526..6815b6c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -283,6 +283,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
.udp_tunnel_add   = i40e_dev_udp_tunnel_add,
.udp_tunnel_del   = i40e_dev_udp_tunnel_del,
.filter_ctrl  = i40e_dev_filter_ctrl,
+   .rxq_info_get = i40e_rxq_info_get,
+   .txq_info_get = i40e_txq_info_get,
.mirror_rule_set  = i40e_mirror_rule_set,
.mirror_rule_reset= i40e_mirror_rule_reset,
.timesync_enable  = i40e_timesync_enable,
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 6185657..4748392 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -502,6 +502,11 @@ int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
  enum rte_filter_op filter_op,
  void *arg);

+void i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+   struct rte_eth_rxq_info *qinfo);
+void i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+   struct rte_eth_txq_info *qinfo);
+
 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
(&((struct i40e_adapter *)adapter)->pf)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 891a221..fadf3e8 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3352,3 +3352,45 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf)

return I40E_SUCCESS;
 }
+
+void
+i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+   struct rte_eth_rxq_info *qinfo)
+{
+   struct i40e_rx_queue *rxq;
+
+   rxq = dev->data->rx_queues[queue_id];
+
+   qinfo->mp = rxq->mp;
+   qinfo->scattered_rx = dev->data->scattered_rx;
+
+   qinfo->nb_desc = rxq->nb_rx_desc;
+   qinfo->max_desc = I40E_MAX_RING_DESC;
+   qinfo->min_desc = I40E_MIN_RING_DESC;
+
+   qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+   qinfo->conf.rx_drop_en = rxq->drop_en;
+   qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+void
+i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+   struct rte_eth_txq_info *qinfo)
+{
+   struct i40e_tx_queue *txq;
+
+   txq = dev->data->tx_queues[queue_id];
+
+   qinfo->nb_desc = txq->nb_tx_desc;
+   qinfo->max_desc = I40E_MAX_RING_DESC;
+   qinfo->min_desc = I40E_MIN_RING_DESC;
+
+   qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+   qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+   qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+   qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+   qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+   qinfo->conf.txq_flags = txq->txq_flags;
+   qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
-- 
1.8.3.1



[dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information

2015-07-20 Thread Konstantin Ananyev
Add the ability for the upper layer to query RX/TX queue information.

Add new structures:
struct rte_eth_rxq_info
struct rte_eth_txq_info

new functions:
rte_eth_rx_queue_info_get
rte_eth_tx_queue_info_get

into rte_etdev API.

Left extra free space in the queue info structures,
so extra fields could be added later without ABI breakage.

v2 changes:
- Add formal check for the qinfo input parameter.
- As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'

v3 changes:
- Updated rte_ether_version.map 
- Merged with latest changes

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_ether/rte_ethdev.c  | 54 +
 lib/librte_ether/rte_ethdev.h  | 87 +++---
 lib/librte_ether/rte_ether_version.map |  2 +
 3 files changed, 137 insertions(+), 6 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 94104ce..a94c119 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3341,6 +3341,60 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t 
queue_id,
 }

 int
+rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+   struct rte_eth_rxq_info *qinfo)
+{
+   struct rte_eth_dev *dev;
+
+   if (qinfo == NULL)
+   return -EINVAL;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+   return -EINVAL;
+   }
+
+   dev = _eth_devices[port_id];
+   if (queue_id >= dev->data->nb_rx_queues) {
+   PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+   return -EINVAL;
+   }
+
+   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+
+   memset(qinfo, 0, sizeof(*qinfo));
+   dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
+   return 0;
+}
+
+int
+rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+   struct rte_eth_txq_info *qinfo)
+{
+   struct rte_eth_dev *dev;
+
+   if (qinfo == NULL)
+   return -EINVAL;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+   return -EINVAL;
+   }
+
+   dev = _eth_devices[port_id];
+   if (queue_id >= dev->data->nb_tx_queues) {
+   PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+   return -EINVAL;
+   }
+
+   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+
+   memset(qinfo, 0, sizeof(*qinfo));
+   dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
+   return 0;
+}
+
+int
 rte_eth_dev_set_mc_addr_list(uint8_t port_id,
 struct ether_addr *mc_addr_set,
 uint32_t nb_mc_addr)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index c901a2c..0c6705e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -960,6 +960,30 @@ struct rte_eth_xstats {
uint64_t value;
 };

+/**
+ * Ethernet device RX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_rxq_info {
+   struct rte_mempool *mp; /**< mempool used by that queue. */
+   struct rte_eth_rxconf conf; /**< queue config parameters. */
+   uint8_t scattered_rx;   /**< scattered packets RX supported. */
+   uint16_t nb_desc;   /**< configured number of RXDs. */
+   uint16_t max_desc;  /**< max allowed number of RXDs. */
+   uint16_t min_desc;  /**< min allowed number of RXDs. */
+} __rte_cache_aligned;
+
+/**
+ * Ethernet device TX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_txq_info {
+   struct rte_eth_txconf conf; /**< queue config parameters. */
+   uint16_t nb_desc;   /**< configured number of TXDs. */
+   uint16_t max_desc;  /**< max allowed number of TXDs. */
+   uint16_t min_desc;  /**< min allowed number of TXDs. */
+} __rte_cache_aligned;
+
 struct rte_eth_dev;

 struct rte_eth_dev_callback;
@@ -1063,6 +1087,12 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct 
rte_eth_dev *dev,
 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
 /**< @internal Check DD bit of specific RX descriptor */

+typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
+   uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
+
+typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
+   uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
+
 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
 /**< @internal Set MTU. */

@@ -1451,9 +1481,13 @@ struct eth_dev_ops {
rss_hash_update_t rss_hash_update;
/** Get current RSS hash configuration. */
rss_hash_conf_get_t rss_hash_conf_get;
-   eth_filter_ctrl_t  filter_ctrl;  /**< common filter 
control*/
+  

[dpdk-dev] [PATCHv3 0/5] ethdev: add new API to retrieve RX/TX queue information

2015-07-20 Thread Konstantin Ananyev
Add the ability for the upper layer to query RX/TX queue information.
Right now supported for:
ixgbe, i40e, e1000 PMDs.

Konstantin Ananyev (5):
  ethdev: add new API to retrieve RX/TX queue information
  i40e: add support for eth_(rxq|txq)_info_get
  ixgbe: add support for eth_(rxq|txq)_info_get
  e1000: add support for eth_(rxq|txq)_info_get
  testpmd: add new command to display RX/TX queue information

 app/test-pmd/cmdline.c | 48 +++
 app/test-pmd/config.c  | 67 ++
 app/test-pmd/testpmd.h |  2 +
 drivers/net/e1000/e1000_ethdev.h   | 12 +
 drivers/net/e1000/em_ethdev.c  |  2 +
 drivers/net/e1000/em_rxtx.c| 38 +++
 drivers/net/e1000/igb_ethdev.c |  4 ++
 drivers/net/e1000/igb_rxtx.c   | 36 ++
 drivers/net/i40e/i40e_ethdev.c |  2 +
 drivers/net/i40e/i40e_ethdev.h |  5 ++
 drivers/net/i40e/i40e_rxtx.c   | 42 
 drivers/net/ixgbe/ixgbe_ethdev.c   |  4 ++
 drivers/net/ixgbe/ixgbe_ethdev.h   |  6 +++
 drivers/net/ixgbe/ixgbe_rxtx.c | 42 
 lib/librte_ether/rte_ethdev.c  | 54 +
 lib/librte_ether/rte_ethdev.h  | 87 +++---
 lib/librte_ether/rte_ether_version.map |  2 +
 17 files changed, 447 insertions(+), 6 deletions(-)

-- 
1.8.3.1



[dpdk-dev] [PATCH v1 1/1] ixgbe: Fix phy errors in stats->ierrors

2015-07-20 Thread Maryam Tahhan
Bug fix to remove (rxnfgpc - hw_stats->gprc) which does not account
for phy errors. hw_stats->gprc is the Number of good (non-erred) Rx
packets (from the network) that pass L2 filtering and has a legal
length as defined by LongPacketEnable. While rxnfgpc is the Number of
good (non-erred with legal length) Rx packets (from the network)
regardless of packet filtering and receive enablement. Thus
hw_stats->gprc can be > rxnfgpc and this calculation should be removed
from the calculation of ierrors. Validated with testpmd by sending
packets to the interface without forwarding enabled - packets should
be dropped and the error counters incremented.

Signed-off-by: Maryam Tahhan 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3a8cff0..09fac25 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2143,8 +2143,7 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
  hw_stats->rfc +
  hw_stats->rjc +
  hw_stats->fccrc +
- hw_stats->fclast +
- (rxnfgpc - hw_stats->gprc); /* PHY Errors*/
+ hw_stats->fclast;

/* Tx Errors */
/*txdgpc: packets that are DMA'ed*/
-- 
2.4.3



[dpdk-dev] [PATCH] virtio: fix the vq size issue

2015-07-20 Thread Thomas Monjalon
2015-07-20 06:18, Ouyang, Changchun:
> Another thing burst into my thought.
> Can we think more about how to setup a mechanism to block those patches which 
> causes critical regression issue?

Yes. Non-regression tests are needed. As it must be done with many hardwares
and many configurations, it must be a shared effort.
As a first step, you can run some automated tests by yourself and *manually*
raise errors on the mailing lists. When it will work well, we could discuss
about gathering test reports in a clean distributed way.
Note that this topic is already a work in progress by few people and a public
proposal should be done in few weeks.

> I did review that patch before, but fail to realize it will break the basic 
> function of virtio PMD, it is my bad. 
> (Can I send the nack to that patch even after it has been merged into 
> dpdk.org?)

After being approved and merged, a nack has no effect.
Having a revert approved is the good way.

> After that, we find that in our testing cycle, we spend time in investigating 
> that and root the cause, and sent out
> the fixing patch on July 1.  Keeping virtio basic functionality broken more 
> than 20 days is bad thing for me.

It wouldn't be so long if these 3 simple things were done:
- use a better title: "virtio: fix Rx from Qemu" instead of a not meaningful 
"fix the vq size issue"
- cc Stephen (I did it later) who did the original patch you wants to revert
- have an acked-by from Huawei Xie who commented the patch

> If we can run a regression automation test with every patch set sent out to 
> dpdk.org, and put those patches breaking any test cases
> Into failing-list and notify author, reviewer and maintainer, all those 
> things should be done before theirs being merged, then it will
> prevent from merging the erroneous patch into mainline, and thus reduce most 
> reverting patch.

As explained above, it is planned and you can start running you own local test
machine. But please do not spam the mailing list with automated mails from
these tests.


[dpdk-dev] [PATCH v2 3/3] doc: Update documentation to reflect FreeBSD support for CXGBE PMD

2015-07-20 Thread Rahul Lakkireddy
Update cxgbe documentation to include support for FreeBSD:
1. Add instructions on how to compile CXGBE PMD in FreeBSD.
2. Add instructions on how to flash firmware image on Chelsio T5 cards in
   FreeBSD.
3. Add sample application usage for FreeBSD.
4. Add an extra step to reload kernel module in Linux in order for the new
   firmware to be loaded.
5. Typo fixes.

Signed-off-by: Rahul Lakkireddy 
Signed-off-by: Kumar Sanghvi 
---
v2:
- No changes.

 doc/guides/nics/cxgbe.rst | 280 +++---
 1 file changed, 267 insertions(+), 13 deletions(-)

diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst
index 7557db0..148cd25 100644
--- a/doc/guides/nics/cxgbe.rst
+++ b/doc/guides/nics/cxgbe.rst
@@ -32,7 +32,8 @@ CXGBE Poll Mode Driver
 ==

 The CXGBE PMD (**librte_pmd_cxgbe**) provides poll mode driver support
-for **Chelsio T5** 10/40 Gbps family of adapters.
+for **Chelsio T5** 10/40 Gbps family of adapters. CXGBE PMD has support
+for the latest Linux and FreeBSD operating systems.

 More information can be found at `Chelsio Communications Official Website
 `_.
@@ -73,10 +74,20 @@ Prerequisites

 - Requires firmware version **1.13.32.0** and higher. Visit
   `Chelsio Download Center `_ to get latest 
firmware
-  bundled with the latest Chelsio Unified Wire package. Installing and loading
-  the latest cxgb4 kernel driver from the Chelsio Unified Wire package should
-  get you the latest firmware. More information can be obtained from the User
-  Guide that is bundled with the Chelsio Unified Wire package.
+  bundled with the latest Chelsio Unified Wire package.
+
+  For Linux, installing and loading the latest cxgb4 kernel driver from the
+  Chelsio Unified Wire package should get you the latest firmware. More
+  information can be obtained from the User Guide that is bundled with the
+  Chelsio Unified Wire package.
+
+  For FreeBSD, the latest firmware obtained from the Chelsio Unified Wire
+  package must be manually flashed via cxgbetool available in FreeBSD source
+  repository.
+
+  Instructions on how to manually flash the firmware are given in section
+  :ref:`linux-installation` for Linux and section :ref:`freebsd-installation`
+  for FreeBSD.

 Pre-Installation Configuration
 --
@@ -111,6 +122,8 @@ enabling debugging options may affect system performance.

   Toggle display of receiving data path run-time check messages.

+.. _driver-compilation:
+
 Driver Compilation
 ~~

@@ -122,11 +135,24 @@ command:
cd 
make config T=x86_64-native-linuxapp-gcc install

-Installation
-
+To compile CXGBE PMD for FreeBSD x86_64 clang target, run the following "gmake"
+command:

-Steps to manually install the latest firmware from the downloaded source files
-are as follows:
+.. code-block:: console
+
+   cd 
+   gmake config T=x86_64-native-bsdapp-clang install
+
+Linux
+-
+
+.. _linux-installation:
+
+Linux Installation
+~~
+
+Steps to manually install the latest firmware from the downloaded Chelsio
+Unified Wire package for Linux operating system are as follows:

 #. Load the kernel module:

@@ -166,6 +192,13 @@ are as follows:

   cxgbtool p1p1 loadfw /src/network/firmware/t5fw-*.bin

+#. Unload and reload the kernel module:
+
+   .. code-block:: console
+
+  modprobe -r cxgb4
+  modprobe cxgb4
+
 #. Verify with ethtool:

.. code-block:: console
@@ -179,10 +212,17 @@ are as follows:
   firmware-version: 1.13.32.0, TP 0.1.4.8

 Sample Application Notes
--
+

 This section demonstrates how to launch **testpmd** with Chelsio T5
-devices managed by librte_pmd_cxgbe.
+devices managed by librte_pmd_cxgbe in Linux operating system.
+
+#. Change to DPDK source directory where the target has been compiled in
+   section :ref:`driver-compilation`:
+
+   .. code-block:: console
+
+  cd 

 #. Load the kernel module:

@@ -253,7 +293,7 @@ devices managed by librte_pmd_cxgbe.

.. note::

-  CXGBE PMD currently only supports the binding of PF4 for Chelsio T5 NICs.
+  Currently, CXGBE PMD only supports the binding of PF4 for Chelsio T5 
NICs.

 #. Start testpmd with basic parameters:

@@ -271,7 +311,221 @@ devices managed by librte_pmd_cxgbe.
   EAL:   PCI memory mapped at 0x7fd7c020
   EAL:   PCI memory mapped at 0x7fd77cdfd000
   EAL:   PCI memory mapped at 0x7fd7c10b7000
-  PMD: rte_cxgbe_pmd: fw: 1.13.33.0, TP: 0.1.4.8
+  PMD: rte_cxgbe_pmd: fw: 1.13.32.0, TP: 0.1.4.8
+  PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
+  Interactive-mode selected
+  Configuring Port 0 (socket 0)
+  Port 0: 00:07:43:2D:EA:C0
+  Configuring Port 1 (socket 0)
+  Port 1: 00:07:43:2D:EA:C8
+  Checking link statuses...
+  PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
+  PMD: 

[dpdk-dev] [PATCH v2 2/3] cxgbe: Enable and fix FreeBSD compilation for CXGBE PMD

2015-07-20 Thread Rahul Lakkireddy
Fix "MACRO redefined" and "function redefined" compilation errors in FreeBSD
by adding CXGBE prefix to them.  Also remove reference to a linux header
linux/if_ether.h and use DPDK macros directly.  Finally, enable CXGBE PMD for
FreeBSD.

Signed-off-by: Rahul Lakkireddy 
Signed-off-by: Kumar Sanghvi 
---
v2:
- No changes.

 config/common_bsdapp |  2 +-
 drivers/net/cxgbe/base/common.h  |  2 +-
 drivers/net/cxgbe/base/t4_hw.c   |  6 +++---
 drivers/net/cxgbe/cxgbe_compat.h | 12 ++--
 drivers/net/cxgbe/cxgbe_main.c   |  4 ++--
 drivers/net/cxgbe/sge.c  | 10 +-
 6 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 4e505bf..e96e4a5 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -217,7 +217,7 @@ CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1
 #
 # Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
 #
-CONFIG_RTE_LIBRTE_CXGBE_PMD=n
+CONFIG_RTE_LIBRTE_CXGBE_PMD=y
 CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n
 CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n
 CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 6ddc7d4..cf2e82d 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -43,7 +43,7 @@
 extern "C" {
 #endif

-#define PAGE_SIZE RTE_PGSIZE_4K
+#define CXGBE_PAGE_SIZE RTE_PGSIZE_4K

 enum {
MAX_NPORTS = 4, /* max # of ports */
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index c57200e..884d2cf 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -127,7 +127,7 @@ void t4_load_mtus(struct adapter *adap, const unsigned 
short *mtus,

for (i = 0; i < NMTUS; ++i) {
unsigned int mtu = mtus[i];
-   unsigned int log2 = fls(mtu);
+   unsigned int log2 = cxgbe_fls(mtu);

if (!(mtu & ((1 << log2) >> 2))) /* round */
log2--;
@@ -1545,11 +1545,11 @@ int t4_fixup_host_params_compat(struct adapter *adap,
unsigned int cache_line_size,
enum chip_type chip_compat)
 {
-   unsigned int page_shift = fls(page_size) - 1;
+   unsigned int page_shift = cxgbe_fls(page_size) - 1;
unsigned int sge_hps = page_shift - 10;
unsigned int stat_len = cache_line_size > 64 ? 128 : 64;
unsigned int fl_align = cache_line_size < 32 ? 32 : cache_line_size;
-   unsigned int fl_align_log = fls(fl_align) - 1;
+   unsigned int fl_align_log = cxgbe_fls(fl_align) - 1;

t4_write_reg(adap, A_SGE_HOST_PAGE_SIZE,
 V_HOSTPAGESIZEPF0(sge_hps) |
diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h
index 3b871ee..e68f8f5 100644
--- a/drivers/net/cxgbe/cxgbe_compat.h
+++ b/drivers/net/cxgbe/cxgbe_compat.h
@@ -119,8 +119,8 @@
 #define L1_CACHE_BYTES  BIT(L1_CACHE_SHIFT)

 #define PAGE_SHIFT  12
-#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
-#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
+#define CXGBE_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#define PTR_ALIGN(p, a) ((typeof(p))CXGBE_ALIGN((unsigned long)(p), (a)))

 #define VLAN_HLEN 4

@@ -178,7 +178,7 @@ typedef uint64_t  dma_addr_t;
 /*
  * round up val _p to a power of 2 size _s
  */
-#define roundup(_p, _s) (((unsigned long)(_p) + (_s - 1)) & ~(_s - 1))
+#define cxgbe_roundup(_p, _s) (((unsigned long)(_p) + (_s - 1)) & ~(_s - 1))

 #undef container_of
 #define container_of(ptr, type, member) ({ \
@@ -214,13 +214,13 @@ static inline uint8_t hweight32(uint32_t word32)
 } /* weight32 */

 /**
- * fls - find last (most-significant) bit set
+ * cxgbe_fls - find last (most-significant) bit set
  * @x: the word to search
  *
  * This is defined the same way as ffs.
- * Note fls(0) = 0, fls(1) = 1, fls(0x8000) = 32.
+ * Note cxgbe_fls(0) = 0, cxgbe_fls(1) = 1, cxgbe_fls(0x8000) = 32.
  */
-static inline int fls(int x)
+static inline int cxgbe_fls(int x)
 {
return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
 }
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index b879820..3755444 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -411,7 +411,7 @@ static int adap_init0_tweaks(struct adapter *adapter)
 * Line Size, etc.  The firmware default is for a 4KB Page Size and
 * 64B Cache Line Size ...
 */
-   t4_fixup_host_params_compat(adapter, PAGE_SIZE, L1_CACHE_BYTES,
+   t4_fixup_host_params_compat(adapter, CXGBE_PAGE_SIZE, L1_CACHE_BYTES,
T5_LAST_REV);

/*
@@ -1100,7 +1100,7 @@ int cxgbe_probe(struct adapter *adapter)
qpp = 1 << ((t4_read_reg(adapter,
A_SGE_EGRESS_QUEUES_PER_PAGE_PF) >> s_qpp)
& M_QUEUESPERPAGEPF0);
-   num_seg = 

[dpdk-dev] [PATCH v2 0/3] cxgbe: Fix compilation and enable FreeBSD support for CXGBE PMD

2015-07-20 Thread Rahul Lakkireddy
This series of patches fix compilation and enable CXGBE poll mode driver for
FreeBSD.  The first patch fixes a limitation of nic_uio that only binds to
devices present in rte_pci_dev_ids.h.  The second patch does the actual
compilation fix and enabling of CXGBE PMD for FreeBSD.  The last patch updates
cxgbe documentation to reflect the FreeBSD support for CXGBE PMD.

v2:
- Replace "Intel(R) DPDK" with just "DPDK" in device description for nic_uio.

Rahul Lakkireddy (3):
  nic_uio: Fix to allow any device to be bound to nic_uio
  cxgbe: Enable and fix FreeBSD compilation for CXGBE PMD
  doc: Update documentation to reflect FreeBSD support for CXGBE PMD

 config/common_bsdapp|   2 +-
 doc/guides/nics/cxgbe.rst   | 280 ++--
 drivers/net/cxgbe/base/common.h |   2 +-
 drivers/net/cxgbe/base/t4_hw.c  |   6 +-
 drivers/net/cxgbe/cxgbe_compat.h|  12 +-
 drivers/net/cxgbe/cxgbe_main.c  |   4 +-
 drivers/net/cxgbe/sge.c |  10 +-
 lib/librte_eal/bsdapp/nic_uio/nic_uio.c |  48 ++
 8 files changed, 298 insertions(+), 66 deletions(-)

-- 
2.4.1



[dpdk-dev] [PATCH v2 2/2] virtio: small cleanups

2015-07-20 Thread Stephen Hemminger
Some minor cleanups.
  * pass constant to virtio_dev_queue_setup
  * fix message on rx_queue_setup
  * get rid of extra double spaces

Signed-off-by: Stephen Hemminger 
---
 drivers/net/virtio/virtio_ethdev.c | 7 +++
 drivers/net/virtio/virtio_ethdev.h | 2 +-
 drivers/net/virtio/virtio_rxtx.c   | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index d460d89..465d3cd 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -254,7 +254,7 @@ virtio_dev_queue_release(struct virtqueue *vq) {
 int virtio_dev_queue_setup(struct rte_eth_dev *dev,
int queue_type,
uint16_t queue_idx,
-   uint16_t  vtpci_queue_idx,
+   uint16_t vtpci_queue_idx,
uint16_t nb_desc,
unsigned int socket_id,
struct virtqueue **pvq)
@@ -264,7 +264,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
uint16_t vq_size;
int size;
struct virtio_hw *hw = dev->data->dev_private;
-   struct virtqueue  *vq = NULL;
+   struct virtqueue *vq = NULL;

/* Write the virtqueue index to the Queue Select Field */
VIRTIO_WRITE_REG_2(hw, VIRTIO_PCI_QUEUE_SEL, vtpci_queue_idx);
@@ -413,13 +413,12 @@ virtio_dev_cq_queue_setup(struct rte_eth_dev *dev, 
uint16_t vtpci_queue_idx,
uint32_t socket_id)
 {
struct virtqueue *vq;
-   uint16_t nb_desc = 0;
int ret;
struct virtio_hw *hw = dev->data->dev_private;

PMD_INIT_FUNC_TRACE();
ret = virtio_dev_queue_setup(dev, VTNET_CQ, VTNET_SQ_CQ_QUEUE_IDX,
-   vtpci_queue_idx, nb_desc, socket_id, );
+   vtpci_queue_idx, 0, socket_id, );
if (ret < 0) {
PMD_INIT_LOG(ERR, "control vq initialization failed");
return ret;
diff --git a/drivers/net/virtio/virtio_ethdev.h 
b/drivers/net/virtio/virtio_ethdev.h
index 3858b00..9026d42 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -79,7 +79,7 @@ void virtio_dev_rxtx_start(struct rte_eth_dev *dev);
 int virtio_dev_queue_setup(struct rte_eth_dev *dev,
int queue_type,
uint16_t queue_idx,
-   uint16_t  vtpci_queue_idx,
+   uint16_t vtpci_queue_idx,
uint16_t nb_desc,
unsigned int socket_id,
struct virtqueue **pvq);
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 5388caa..c5b53bb 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -390,7 +390,7 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,
ret = virtio_dev_queue_setup(dev, VTNET_RQ, queue_idx, vtpci_queue_idx,
nb_desc, socket_id, );
if (ret < 0) {
-   PMD_INIT_LOG(ERR, "tvq initialization failed");
+   PMD_INIT_LOG(ERR, "rvq initialization failed");
return ret;
}

-- 
2.1.4



[dpdk-dev] [PATCH v2 0/3] virtio: size bug fixes

2015-07-20 Thread Stephen Hemminger
On Mon, 20 Jul 2015 19:43:20 +0200
Thomas Monjalon  wrote:

> 2015-07-20 10:25, Stephen Hemminger:
> > Fix for a fix for a fix...
> > This set includes Changchun's patch for vq_size but adds
> > follow on fix to make it work with GCE and other environments.
> > 
> > Ouyang Changchun (1):
> >   virtio: fix the vq size issue
> > 
> > Stephen Hemminger (2):
> >   virtio: allow nb_desc < vq_size
> >   virtio: small cleanups
> 
> Patch 2 partially reverts what patch 1 introduced.
> Merging them will make things clearer.

Ok, but it was easier to review that way.


[dpdk-dev] jumbo frame support for 82583V

2015-07-20 Thread Klaus Degner
Hi Wenzhuo,
> Hi Klaus,
>
>> -Original Message-
>> From: Klaus Degner [mailto:kd at allegro-packets.com]
>> Sent: Friday, July 17, 2015 7:56 PM
>> To: Lu, Wenzhuo
>> Cc: dev at dpdk.org
>> Subject: jumbo frame support for 82583V
>>
>> Hi Wenzhuo,
>>
>> We are testing different Intel NICs for DPDK. We have tested the master 
>> branch
>> with the support for 82583V Intel chip.
>> It works very well except that we can only use up to 1518 bytes for maximum
>> packet capture.
>> We have debugged this and it is restricted in the initialization:
>>
>> http://dpdk.org/browse/dpdk/tree/drivers/net/e1000/em_ethdev.c#n855
>>
>> Without DPDK, the linux driver support and mtu up to 9k and ark.intel reports
>> that this chip is jumbo frame capable:
>>
>> http://ark.intel.com/de/products/41676/Intel-82583V-Gigabit-Ethernet-
>> Controller
>>
>> Is there any specific reason why DPDK cannot use jumbo frames for this NIC ?
>>
>> Thanks for help !
>>
>> Klaus
> Sorry, I'm not sure about the history.
> According to the datasheet's update log, 82583v doesn't support jumbo frame 
> at first.
> I think the reason is the e1000 code is not updated after the datasheet said 
> the jumbo frame is supported.
> As I don?t have the NIC on hand, would you like to change the code and have a 
> try. I mean just let
> " case e1000_82583" return 9K. Thanks.

The DPDK jumbo frame send and receive works for 82583V.
We have tested it with 4x 85283V and the setup:

Linux send --> DPDK receive --> DPDK send --> Linux receive

We could send a 9k packet via this data path and have verified the
content of it.
I can generate a patch for DPDK if this is enough testing for you.

Thanks,

Klaus


[dpdk-dev] [PATCH v15 13/13] l3fwd-power: enable one-shot rx interrupt and polling/interrupt mode switch

2015-07-20 Thread Cunming Liang
The patch demonstrates how to handle per rx queue interrupt in a NAPI-like
implementation in userspace. The working thread mainly runs in polling mode
and switch to interrupt mode only if there is no packet received in recent 
polls.
The working thread returns to polling mode immediately once it receives an
interrupt notification caused by the incoming packets.
The sample keeps running in polling mode if the binding PMD hasn't supported
the rx interrupt yet. Now only ixgbe(pf/vf) and igb support it.

Signed-off-by: Danny Zhou 
Signed-off-by: Cunming Liang 
---
v14 changes
 - per-patch basis ABI compatibility rework
 - reword commit comments

v7 changes
 - using new APIs
 - demo multiple port/queue pair wait on the same epoll instance

v6 changes
 - Split event fd add and wait

v5 changes
 - Change invoked function name and parameter to accomodate EAL change

v3 changes
 - Add spinlock to ensure thread safe when accessing interrupt mask
   register

v2 changes
 - Remove unused function which is for debug purpose

 examples/l3fwd-power/main.c | 205 +++-
 1 file changed, 165 insertions(+), 40 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index b3c5f43..14f6fba 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -74,12 +74,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 

 #define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1

 #define MAX_PKT_BURST 32

-#define MIN_ZERO_POLL_COUNT 5
+#define MIN_ZERO_POLL_COUNT 10

 /* around 100ms at 2 Ghz */
 #define TIMER_RESOLUTION_CYCLES   2ULL
@@ -153,6 +155,9 @@ static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
 /* ethernet addresses of ports */
 static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];

+/* ethernet addresses of ports */
+static rte_spinlock_t locks[RTE_MAX_ETHPORTS];
+
 /* mask of enabled ports */
 static uint32_t enabled_port_mask = 0;
 /* Ports set in promiscuous mode off by default. */
@@ -185,6 +190,9 @@ struct lcore_rx_queue {
 #define MAX_TX_QUEUE_PER_PORT RTE_MAX_ETHPORTS
 #define MAX_RX_QUEUE_PER_PORT 128

+#define MAX_RX_QUEUE_INTERRUPT_PER_PORT 16
+
+
 #define MAX_LCORE_PARAMS 1024
 struct lcore_params {
uint8_t port_id;
@@ -211,7 +219,7 @@ static uint16_t nb_lcore_params = 
sizeof(lcore_params_array_default) /

 static struct rte_eth_conf port_conf = {
.rxmode = {
-   .mq_mode= ETH_MQ_RX_RSS,
+   .mq_mode= ETH_MQ_RX_RSS,
.max_rx_pkt_len = ETHER_MAX_LEN,
.split_hdr_size = 0,
.header_split   = 0, /**< Header Split disabled */
@@ -223,11 +231,17 @@ static struct rte_eth_conf port_conf = {
.rx_adv_conf = {
.rss_conf = {
.rss_key = NULL,
-   .rss_hf = ETH_RSS_IP,
+   .rss_hf = ETH_RSS_UDP,
},
},
.txmode = {
-   .mq_mode = ETH_DCB_NONE,
+   .mq_mode = ETH_MQ_TX_NONE,
+   },
+   .intr_conf = {
+   .lsc = 1,
+#ifdef RTE_NEXT_ABI
+   .rxq = 1,
+#endif
},
 };

@@ -399,19 +413,22 @@ power_timer_cb(__attribute__((unused)) struct rte_timer 
*tim,
/* accumulate total execution time in us when callback is invoked */
sleep_time_ratio = (float)(stats[lcore_id].sleep_time) /
(float)SCALING_PERIOD;
-
/**
 * check whether need to scale down frequency a step if it sleep a lot.
 */
-   if (sleep_time_ratio >= SCALING_DOWN_TIME_RATIO_THRESHOLD)
-   rte_power_freq_down(lcore_id);
+   if (sleep_time_ratio >= SCALING_DOWN_TIME_RATIO_THRESHOLD) {
+   if (rte_power_freq_down)
+   rte_power_freq_down(lcore_id);
+   }
else if ( (unsigned)(stats[lcore_id].nb_rx_processed /
-   stats[lcore_id].nb_iteration_looped) < MAX_PKT_BURST)
+   stats[lcore_id].nb_iteration_looped) < MAX_PKT_BURST) {
/**
 * scale down a step if average packet per iteration less
 * than expectation.
 */
-   rte_power_freq_down(lcore_id);
+   if (rte_power_freq_down)
+   rte_power_freq_down(lcore_id);
+   }

/**
 * initialize another timer according to current frequency to ensure
@@ -712,22 +729,20 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid,

 }

-#define SLEEP_GEAR1_THRESHOLD100
-#define SLEEP_GEAR2_THRESHOLD1000
+#define MINIMUM_SLEEP_TIME 1
+#define SUSPEND_THRESHOLD  300

 static inline uint32_t
 power_idle_heuristic(uint32_t zero_rx_packet_count)
 {
-   /* If zero count is less than 100, use it as the sleep time in us */
-   if (zero_rx_packet_count < SLEEP_GEAR1_THRESHOLD)
-   return zero_rx_packet_count;
-   /* 

[dpdk-dev] [PATCH v15 12/13] igb: enable rx queue interrupts for PF

2015-07-20 Thread Cunming Liang
The patch does below for igb PF:
- Setup NIC to generate MSI-X interrupts
- Set the IVAR register to map interrupt causes to vectors
- Implement interrupt enable/disable functions

Signed-off-by: Danny Zhou 
Signed-off-by: Cunming Liang 
---
v14 changes
 - per-patch basis ABI compatibility rework

v9 changes
 - move queue-vec mapping init from dev_configure to dev_start
 - fix link interrupt not working issue in vfio-msix

v8 changes
 - add vfio-msi/vfio-legacy and uio-legacy support

v7 changes
 - add condition check when intr vector is not enabled

v6 changes
 - fill queue-vector mapping table

v5 changes
 - Rebase the patchset onto the HEAD

v3 changes
 - Remove unnecessary variables in e1000_mac_info
 - Remove spinlok from PMD

v2 changes
 - Consolidate review comments related to coding style

 drivers/net/e1000/igb_ethdev.c | 311 -
 1 file changed, 277 insertions(+), 34 deletions(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index ddc7186..56734a3 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -105,6 +105,9 @@ static int  eth_igb_flow_ctrl_get(struct rte_eth_dev *dev,
 static int  eth_igb_flow_ctrl_set(struct rte_eth_dev *dev,
struct rte_eth_fc_conf *fc_conf);
 static int eth_igb_lsc_interrupt_setup(struct rte_eth_dev *dev);
+#ifdef RTE_NEXT_ABI
+static int eth_igb_rxq_interrupt_setup(struct rte_eth_dev *dev);
+#endif
 static int eth_igb_interrupt_get_status(struct rte_eth_dev *dev);
 static int eth_igb_interrupt_action(struct rte_eth_dev *dev);
 static void eth_igb_interrupt_handler(struct rte_intr_handle *handle,
@@ -218,7 +221,6 @@ static int eth_igb_get_eeprom(struct rte_eth_dev *dev,
struct rte_dev_eeprom_info *eeprom);
 static int eth_igb_set_eeprom(struct rte_eth_dev *dev,
struct rte_dev_eeprom_info *eeprom);
-
 static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev,
struct ether_addr *mc_addr_set,
uint32_t nb_mc_addr);
@@ -229,6 +231,17 @@ static int igb_timesync_read_rx_timestamp(struct 
rte_eth_dev *dev,
  uint32_t flags);
 static int igb_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
  struct timespec *timestamp);
+#ifdef RTE_NEXT_ABI
+static int eth_igb_rx_queue_intr_enable(struct rte_eth_dev *dev,
+   uint16_t queue_id);
+static int eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev,
+uint16_t queue_id);
+static void eth_igb_assign_msix_vector(struct e1000_hw *hw, int8_t direction,
+  uint8_t queue, uint8_t msix_vector);
+static void eth_igb_write_ivar(struct e1000_hw *hw, uint8_t msix_vector,
+  uint8_t index, uint8_t offset);
+#endif
+static void eth_igb_configure_msix_intr(struct rte_eth_dev *dev);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -289,6 +302,10 @@ static const struct eth_dev_ops eth_igb_ops = {
.vlan_tpid_set= eth_igb_vlan_tpid_set,
.vlan_offload_set = eth_igb_vlan_offload_set,
.rx_queue_setup   = eth_igb_rx_queue_setup,
+#ifdef RTE_NEXT_ABI
+   .rx_queue_intr_enable = eth_igb_rx_queue_intr_enable,
+   .rx_queue_intr_disable = eth_igb_rx_queue_intr_disable,
+#endif
.rx_queue_release = eth_igb_rx_queue_release,
.rx_queue_count   = eth_igb_rx_queue_count,
.rx_descriptor_done   = eth_igb_rx_descriptor_done,
@@ -639,12 +656,6 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
 eth_dev->data->port_id, pci_dev->id.vendor_id,
 pci_dev->id.device_id);

-   rte_intr_callback_register(&(pci_dev->intr_handle),
-   eth_igb_interrupt_handler, (void *)eth_dev);
-
-   /* enable uio intr after callback register */
-   rte_intr_enable(&(pci_dev->intr_handle));
-
/* enable support intr */
igb_intr_enable(eth_dev);

@@ -879,7 +890,11 @@ eth_igb_start(struct rte_eth_dev *dev)
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct e1000_adapter *adapter =
E1000_DEV_PRIVATE(dev->data->dev_private);
-   int ret, i, mask;
+   struct rte_intr_handle *intr_handle = >pci_dev->intr_handle;
+   int ret, mask;
+#ifdef RTE_NEXT_ABI
+   uint32_t intr_vector = 0;
+#endif
uint32_t ctrl_ext;

PMD_INIT_FUNC_TRACE();
@@ -920,6 +935,29 @@ eth_igb_start(struct rte_eth_dev *dev)
/* configure PF module if SRIOV enabled */
igb_pf_host_configure(dev);

+#ifdef RTE_NEXT_ABI
+   /* check and configure queue intr-vector mapping */
+   if (dev->data->dev_conf.intr_conf.rxq != 0)
+   intr_vector = dev->data->nb_rx_queues;
+
+   if 

[dpdk-dev] [PATCH v15 11/13] ixgbe: enable rx queue interrupts for both PF and VF

2015-07-20 Thread Cunming Liang
The patch does below things for ixgbe PF and VF:
- Setup NIC to generate MSI-X interrupts
- Set the IVAR register to map interrupt causes to vectors
- Implement interrupt enable/disable functions

Signed-off-by: Danny Zhou 
Signed-off-by: Yong Liu 
Signed-off-by: Cunming Liang 
---
v14 changes
 - per-patch basis ABI compatibility rework

v10 changes
 - return an actual error code rather than -1

v9 changes
 - move queue-vec mapping init from dev_configure to dev_start

v8 changes
 - add vfio-msi/vfio-legacy and uio-legacy support

v7 changes
 - add condition check when intr vector is not enabled

v6 changes
 - fill queue-vector mapping table

v5 changes
 - Rebase the patchset onto the HEAD

v3 changes
 - Remove spinlok from PMD

v2 changes
 - Consolidate review comments related to coding style

 drivers/net/ixgbe/ixgbe_ethdev.c | 527 ++-
 drivers/net/ixgbe/ixgbe_ethdev.h |   4 +
 2 files changed, 518 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3a8cff0..7f43fb6 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -85,6 +85,9 @@
  */
 #define IXGBE_FC_LO0x40

+/* Default minimum inter-interrupt interval for EITR configuration */
+#define IXGBE_MIN_INTER_INTERRUPT_INTERVAL_DEFAULT0x79E
+
 /* Timer value included in XOFF frames. */
 #define IXGBE_FC_PAUSE 0x680

@@ -187,6 +190,9 @@ static int ixgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
uint16_t reta_size);
 static void ixgbe_dev_link_status_print(struct rte_eth_dev *dev);
 static int ixgbe_dev_lsc_interrupt_setup(struct rte_eth_dev *dev);
+#ifdef RTE_NEXT_ABI
+static int ixgbe_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);
+#endif
 static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev);
 static void ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
@@ -202,11 +208,14 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct 
ixgbe_dcb_config *dcb_conf
 /* For Virtual Function support */
 static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
+static int ixgbevf_dev_interrupt_get_status(struct rte_eth_dev *dev);
+static int ixgbevf_dev_interrupt_action(struct rte_eth_dev *dev);
 static int  ixgbevf_dev_configure(struct rte_eth_dev *dev);
 static int  ixgbevf_dev_start(struct rte_eth_dev *dev);
 static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
 static void ixgbevf_dev_close(struct rte_eth_dev *dev);
 static void ixgbevf_intr_disable(struct ixgbe_hw *hw);
+static void ixgbevf_intr_enable(struct ixgbe_hw *hw);
 static void ixgbevf_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
 static void ixgbevf_dev_stats_reset(struct rte_eth_dev *dev);
@@ -216,6 +225,17 @@ static void ixgbevf_vlan_strip_queue_set(struct 
rte_eth_dev *dev,
uint16_t queue, int on);
 static void ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on);
+static void ixgbevf_dev_interrupt_handler(struct rte_intr_handle *handle,
+ void *param);
+#ifdef RTE_NEXT_ABI
+static int ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev,
+   uint16_t queue_id);
+static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
+uint16_t queue_id);
+static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
+uint8_t queue, uint8_t msix_vector);
+#endif
+static void ixgbevf_configure_msix(struct rte_eth_dev *dev);

 /* For Eth VMDQ APIs support */
 static int ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct
@@ -232,6 +252,15 @@ static int ixgbe_mirror_rule_set(struct rte_eth_dev *dev,
uint8_t rule_id, uint8_t on);
 static int ixgbe_mirror_rule_reset(struct rte_eth_dev *dev,
uint8_t rule_id);
+#ifdef RTE_NEXT_ABI
+static int ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev,
+ uint16_t queue_id);
+static int ixgbe_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
+  uint16_t queue_id);
+static void ixgbe_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
+  uint8_t queue, uint8_t msix_vector);
+#endif
+static void ixgbe_configure_msix(struct rte_eth_dev *dev);

 static int ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
uint16_t queue_idx, uint16_t tx_rate);
@@ -308,7 +337,7 @@ static int ixgbe_timesync_read_tx_timestamp(struct 
rte_eth_dev *dev,
  */
 #define UPDATE_VF_STAT(reg, last, cur) \
 {   \
-   u32 

[dpdk-dev] [PATCH v15 10/13] ethdev: add rx intr enable, disable and ctl functions

2015-07-20 Thread Cunming Liang
The patch adds two dev_ops functions to enable and disable rx queue interrupts.
In addtion, it adds rte_eth_dev_rx_intr_ctl/rx_intr_q to support per port or 
per queue rx intr event set.

Signed-off-by: Danny Zhou 
Signed-off-by: Cunming Liang 
---
v15 changes
 - remove ifdef RTE_NEXT_ABI from header file

v14 changes
 - per-patch basis ABI compatibility rework
 - remove unnecessary 'local: *' from version map

v13 changes
 - version map cleanup for v2.1

v9 changes
 - remove unnecessary check after rte_eth_dev_is_valid_port.
   the same as http://www.dpdk.org/dev/patchwork/patch/4784

v8 changes
 - add addtion check for EEXIT

v7 changes
 - remove rx_intr_vec_get
 - add rx_intr_ctl and rx_intr_ctl_q

v6 changes
 - add rx_intr_vec_get to retrieve the vector num of the queue.

v5 changes
 - Rebase the patchset onto the HEAD

v4 changes
 - Export interrupt enable/disable functions for shared libraries
 - Put new functions at the end of eth_dev_ops to avoid breaking ABI

v3 changes
 - Add return value for interrupt enable/disable functions

 lib/librte_ether/rte_ethdev.c  | 147 +
 lib/librte_ether/rte_ethdev.h  | 104 +++
 lib/librte_ether/rte_ether_version.map |   4 +
 3 files changed, 255 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 94104ce..a24c399 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3031,6 +3031,153 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
}
rte_spinlock_unlock(_eth_dev_cb_lock);
 }
+
+#ifdef RTE_NEXT_ABI
+int
+rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
+{
+   uint32_t vec;
+   struct rte_eth_dev *dev;
+   struct rte_intr_handle *intr_handle;
+   uint16_t qid;
+   int rc;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
+   return -ENODEV;
+   }
+
+   dev = _eth_devices[port_id];
+   intr_handle = >pci_dev->intr_handle;
+   if (!intr_handle->intr_vec) {
+   PMD_DEBUG_TRACE("RX Intr vector unset\n");
+   return -EPERM;
+   }
+
+   for (qid = 0; qid < dev->data->nb_rx_queues; qid++) {
+   vec = intr_handle->intr_vec[qid];
+   rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
+   if (rc && rc != -EEXIST) {
+   PMD_DEBUG_TRACE("p %u q %u rx ctl error"
+   " op %d epfd %d vec %u\n",
+   port_id, qid, op, epfd, vec);
+   }
+   }
+
+   return 0;
+}
+
+int
+rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
+ int epfd, int op, void *data)
+{
+   uint32_t vec;
+   struct rte_eth_dev *dev;
+   struct rte_intr_handle *intr_handle;
+   int rc;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
+   return -ENODEV;
+   }
+
+   dev = _eth_devices[port_id];
+   if (queue_id >= dev->data->nb_rx_queues) {
+   PMD_DEBUG_TRACE("Invalid RX queue_id=%u\n", queue_id);
+   return -EINVAL;
+   }
+
+   intr_handle = >pci_dev->intr_handle;
+   if (!intr_handle->intr_vec) {
+   PMD_DEBUG_TRACE("RX Intr vector unset\n");
+   return -EPERM;
+   }
+
+   vec = intr_handle->intr_vec[queue_id];
+   rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
+   if (rc && rc != -EEXIST) {
+   PMD_DEBUG_TRACE("p %u q %u rx ctl error"
+   " op %d epfd %d vec %u\n",
+   port_id, queue_id, op, epfd, vec);
+   return rc;
+   }
+
+   return 0;
+}
+
+int
+rte_eth_dev_rx_intr_enable(uint8_t port_id,
+  uint16_t queue_id)
+{
+   struct rte_eth_dev *dev;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   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->rx_queue_intr_enable, -ENOTSUP);
+   return (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id);
+}
+
+int
+rte_eth_dev_rx_intr_disable(uint8_t port_id,
+   uint16_t queue_id)
+{
+   struct rte_eth_dev *dev;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   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->rx_queue_intr_disable, -ENOTSUP);
+   return (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id);
+}
+#else
+int
+rte_eth_dev_rx_intr_enable(uint8_t port_id, uint16_t queue_id)
+{
+   RTE_SET_USED(port_id);
+   

[dpdk-dev] [PATCH v15 09/13] eal/bsd: fix inappropriate linuxapp referred in bsd

2015-07-20 Thread Cunming Liang

Signed-off-by: Cunming Liang 
---
 lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h 
b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
index 91d1900..2dbb9b0 100644
--- a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
+++ b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
@@ -35,8 +35,8 @@
 #error "don't include this file directly, please include generic 
"
 #endif

-#ifndef _RTE_LINUXAPP_INTERRUPTS_H_
-#define _RTE_LINUXAPP_INTERRUPTS_H_
+#ifndef _RTE_BSDAPP_INTERRUPTS_H_
+#define _RTE_BSDAPP_INTERRUPTS_H_

 enum rte_intr_handle_type {
RTE_INTR_HANDLE_UNKNOWN = 0,
@@ -120,4 +120,4 @@ int rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);
  */
 int rte_intr_allow_others(struct rte_intr_handle *intr_handle);

-#endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */
+#endif /* _RTE_BSDAPP_INTERRUPTS_H_ */
-- 
1.8.1.4



[dpdk-dev] [PATCH v15 08/13] eal/bsd: dummy for new intr definition

2015-07-20 Thread Cunming Liang
To make bsd compiling happy with new intr changes.

Signed-off-by: Cunming Liang 
---
v15 changes
 - remove ifdef RTE_NEXT_ABI from header file

v14 changes
 - per-patch basis ABI compatibility rework

v13 changes
 - version map cleanup for v2.1

v12 changes
 - fix unused variables compiling warning

v8 changes
 - add stub for new function

v7 changes
 - remove stub 'linux only' function from source file

 lib/librte_eal/bsdapp/eal/eal_interrupts.c | 42 +
 .../bsdapp/eal/include/exec-env/rte_interrupts.h   | 68 ++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map  |  5 ++
 3 files changed, 115 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/eal_interrupts.c 
b/lib/librte_eal/bsdapp/eal/eal_interrupts.c
index 26a55c7..51a13fa 100644
--- a/lib/librte_eal/bsdapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/bsdapp/eal/eal_interrupts.c
@@ -68,3 +68,45 @@ rte_eal_intr_init(void)
 {
return 0;
 }
+
+int
+rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,
+   int epfd, int op, unsigned int vec, void *data)
+{
+   RTE_SET_USED(intr_handle);
+   RTE_SET_USED(epfd);
+   RTE_SET_USED(op);
+   RTE_SET_USED(vec);
+   RTE_SET_USED(data);
+
+   return -ENOTSUP;
+}
+
+int
+rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
+{
+   RTE_SET_USED(intr_handle);
+   RTE_SET_USED(nb_efd);
+
+   return 0;
+}
+
+void
+rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
+{
+   RTE_SET_USED(intr_handle);
+}
+
+int
+rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
+{
+   RTE_SET_USED(intr_handle);
+   return 0;
+}
+
+int
+rte_intr_allow_others(struct rte_intr_handle *intr_handle)
+{
+   RTE_SET_USED(intr_handle);
+   return 1;
+}
diff --git a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h 
b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
index d4c388f..91d1900 100644
--- a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
+++ b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
@@ -50,6 +50,74 @@ struct rte_intr_handle {
int fd;  /**< file descriptor */
int uio_cfg_fd;  /**< UIO config file descriptor */
enum rte_intr_handle_type type;  /**< handle type */
+#ifdef RTE_NEXT_ABI
+   int max_intr;/**< max interrupt requested */
+   uint32_t nb_efd; /**< number of available efds */
+   int *intr_vec;   /**< intr vector number array */
+#endif
 };

+/**
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ * @param epfd
+ *   Epoll instance fd which the intr vector associated to.
+ * @param op
+ *   The operation be performed for the vector.
+ *   Operation type of {ADD, DEL}.
+ * @param vec
+ *   RX intr vector number added to the epoll instance wait list.
+ * @param data
+ *   User raw data.
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,
+   int epfd, int op, unsigned int vec, void *data);
+
+/**
+ * It enables the fastpath event fds if it's necessary.
+ * It creates event fds when multi-vectors allowed,
+ * otherwise it multiplexes the single event fds.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ * @param nb_vec
+ *   Number of interrupt vector trying to enable.
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd);
+
+/**
+ * It disable the fastpath event fds.
+ * It deletes registered eventfds and closes the open fds.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ */
+void
+rte_intr_efd_disable(struct rte_intr_handle *intr_handle);
+
+/**
+ * The fastpath interrupt is enabled or not.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ */
+int rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);
+
+/**
+ * The interrupt handle instance allows other cause or not.
+ * Other cause stands for none fastpath interrupt.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ */
+int rte_intr_allow_others(struct rte_intr_handle *intr_handle);
+
 #endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index b2d4441..cfeb0fb 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -116,6 +116,11 @@ DPDK_2.1 {
global:

rte_eal_pci_detach;
+   rte_intr_allow_others;
+   rte_intr_dp_is_en;
+   rte_intr_efd_enable;
+   rte_intr_efd_disable;
+   rte_intr_rx_ctl;
rte_memzone_free;

 } DPDK_2.0;
-- 
1.8.1.4



[dpdk-dev] [PATCH v15 07/13] eal/linux: fix lsc read error in uio_pci_generic

2015-07-20 Thread Cunming Liang
The intr handle type(RTE_INTR_HANDLE_UIO_INTX) was introduced by UIO pci 
generic.
When turning on the lsc interrupt, it complains fd read error.
The patch uses the correct read size in the case of RTE_INTR_HANDLE_UIO_INTX.

Fixes: 3f313bef3467 ("eal/linux: fix irq handling with igb_uio")

Reported-by: Yong Liu 
Signed-off-by: Cunming Liang 
---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c 
b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 1cea4bf..3f87875 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -686,6 +686,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int 
nfds)
/* set the length to be read dor different handle type */
switch (src->intr_handle.type) {
case RTE_INTR_HANDLE_UIO:
+   case RTE_INTR_HANDLE_UIO_INTX:
bytes_read = sizeof(buf.uio_intr_count);
break;
case RTE_INTR_HANDLE_ALARM:
-- 
1.8.1.4



[dpdk-dev] [PATCH v15 06/13] eal/linux: standalone intr event fd create support

2015-07-20 Thread Cunming Liang
The patch exposes intr event fd create and release for PMD.
The device driver can assign the number of event associated with interrupt 
vector.
It also provides misc functions to check 1) allows other slowpath intr(e.g. 
lsc);
2) intr event on fastpath is enabled or not.

Signed-off-by: Cunming Liang 
---
v15 changes
 - remove ifdef RTE_NEXT_ABI from header file

v14 changes
 - per-patch basis ABI compatibility rework
 - minor changes on API decription comments

v13 changes
 - version map cleanup for v2.1

v11 changes
 - typo cleanup

 lib/librte_eal/linuxapp/eal/eal_interrupts.c   | 97 ++
 .../linuxapp/eal/include/exec-env/rte_interrupts.h | 45 ++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map|  4 +
 3 files changed, 146 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c 
b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 12105cc..1cea4bf 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -68,6 +69,7 @@
 #include "eal_vfio.h"

 #define EAL_INTR_EPOLL_WAIT_FOREVER (-1)
+#define NB_OTHER_INTR   1

 static RTE_DEFINE_PER_LCORE(int, _epfd) = -1; /**< epoll fd per thread */

@@ -1123,6 +1125,73 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int 
epfd,

return rc;
 }
+
+int
+rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
+{
+   uint32_t i;
+   int fd;
+   uint32_t n = RTE_MIN(nb_efd, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID);
+
+   if (intr_handle->type == RTE_INTR_HANDLE_VFIO_MSIX) {
+   for (i = 0; i < n; i++) {
+   fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
+   if (fd < 0) {
+   RTE_LOG(ERR, EAL,
+   "can't setup eventfd, error %i (%s)\n",
+   errno, strerror(errno));
+   return -1;
+   }
+   intr_handle->efds[i] = fd;
+   }
+   intr_handle->nb_efd   = n;
+   intr_handle->max_intr = NB_OTHER_INTR + n;
+   } else {
+   intr_handle->efds[0]  = intr_handle->fd;
+   intr_handle->nb_efd   = RTE_MIN(nb_efd, 1U);
+   intr_handle->max_intr = NB_OTHER_INTR;
+   }
+
+   return 0;
+}
+
+void
+rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
+{
+   uint32_t i;
+   struct rte_epoll_event *rev;
+
+   for (i = 0; i < intr_handle->nb_efd; i++) {
+   rev = _handle->elist[i];
+   if (rev->status == RTE_EPOLL_INVALID)
+   continue;
+   if (rte_epoll_ctl(rev->epfd, EPOLL_CTL_DEL, rev->fd, rev)) {
+   /* force free if the entry valid */
+   eal_epoll_data_safe_free(rev);
+   rev->status = RTE_EPOLL_INVALID;
+   }
+   }
+
+   if (intr_handle->max_intr > intr_handle->nb_efd) {
+   for (i = 0; i < intr_handle->nb_efd; i++)
+   close(intr_handle->efds[i]);
+   }
+   intr_handle->nb_efd = 0;
+   intr_handle->max_intr = 0;
+}
+
+int
+rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
+{
+   return !(!intr_handle->nb_efd);
+}
+
+int
+rte_intr_allow_others(struct rte_intr_handle *intr_handle)
+{
+   return !!(intr_handle->max_intr - intr_handle->nb_efd);
+}
+
 #else
 int
 rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,
@@ -1135,4 +1204,32 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,
RTE_SET_USED(data);
return -ENOTSUP;
 }
+
+int
+rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
+{
+   RTE_SET_USED(intr_handle);
+   RTE_SET_USED(nb_efd);
+   return 0;
+}
+
+void
+rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
+{
+   RTE_SET_USED(intr_handle);
+}
+
+int
+rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
+{
+   RTE_SET_USED(intr_handle);
+   return 0;
+}
+
+int
+rte_intr_allow_others(struct rte_intr_handle *intr_handle)
+{
+   RTE_SET_USED(intr_handle);
+   return 1;
+}
 #endif
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h 
b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
index acf4be9..b05f4c8 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
@@ -168,4 +168,49 @@ int
 rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,
int epfd, int op, unsigned int vec, void *data);

+/**
+ * It enables the packet I/O interrupt event if it's necessary.
+ * It creates event fd for each interrupt vector when MSIX is used,
+ * otherwise it multiplexes a single event fd.
+ *
+ * @param intr_handle
+ *   Pointer to the 

[dpdk-dev] [PATCH v15 05/13] eal/linux: map eventfd to VFIO MSI-X intr vector

2015-07-20 Thread Cunming Liang
The patch maps each of the eventfd to the interrupt vector of VFIO MSI-X.

Signed-off-by: Danny Zhou 
Signed-off-by: Cunming Liang 
---
v14 changes
 - per-patch basis ABI compatibility rework
 - reword commit comments

v8 changes
 - move eventfd creation out of the setup_interrupts to a standalone function

v7 changes
 - cleanup unnecessary code change
 - split event and intr operation to other patches

 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 56 ++--
 1 file changed, 20 insertions(+), 36 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c 
b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 5acc3b7..12105cc 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -128,6 +128,9 @@ static pthread_t intr_thread;
 #ifdef VFIO_PRESENT

 #define IRQ_SET_BUF_LEN  (sizeof(struct vfio_irq_set) + sizeof(int))
+/* irq set buffer length for queue interrupts and LSC interrupt */
+#define MSIX_IRQ_SET_BUF_LEN (sizeof(struct vfio_irq_set) + \
+ sizeof(int) * (RTE_MAX_RXTX_INTR_VEC_ID + 1))

 /* enable legacy (INTx) interrupts */
 static int
@@ -245,23 +248,6 @@ vfio_enable_msi(struct rte_intr_handle *intr_handle) {
intr_handle->fd);
return -1;
}
-
-   /* manually trigger interrupt to enable it */
-   memset(irq_set, 0, len);
-   len = sizeof(struct vfio_irq_set);
-   irq_set->argsz = len;
-   irq_set->count = 1;
-   irq_set->flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_TRIGGER;
-   irq_set->index = VFIO_PCI_MSI_IRQ_INDEX;
-   irq_set->start = 0;
-
-   ret = ioctl(intr_handle->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
-
-   if (ret) {
-   RTE_LOG(ERR, EAL, "Error triggering MSI interrupts for fd %d\n",
-   intr_handle->fd);
-   return -1;
-   }
return 0;
 }

@@ -294,7 +280,7 @@ vfio_disable_msi(struct rte_intr_handle *intr_handle) {
 static int
 vfio_enable_msix(struct rte_intr_handle *intr_handle) {
int len, ret;
-   char irq_set_buf[IRQ_SET_BUF_LEN];
+   char irq_set_buf[MSIX_IRQ_SET_BUF_LEN];
struct vfio_irq_set *irq_set;
int *fd_ptr;

@@ -302,12 +288,26 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle) {

irq_set = (struct vfio_irq_set *) irq_set_buf;
irq_set->argsz = len;
+#ifdef RTE_NEXT_ABI
+   if (!intr_handle->max_intr)
+   intr_handle->max_intr = 1;
+   else if (intr_handle->max_intr > RTE_MAX_RXTX_INTR_VEC_ID)
+   intr_handle->max_intr = RTE_MAX_RXTX_INTR_VEC_ID + 1;
+
+   irq_set->count = intr_handle->max_intr;
+#else
irq_set->count = 1;
+#endif
irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | 
VFIO_IRQ_SET_ACTION_TRIGGER;
irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
irq_set->start = 0;
fd_ptr = (int *) _set->data;
-   *fd_ptr = intr_handle->fd;
+#ifdef RTE_NEXT_ABI
+   memcpy(fd_ptr, intr_handle->efds, sizeof(intr_handle->efds));
+   fd_ptr[intr_handle->max_intr - 1] = intr_handle->fd;
+#else
+   fd_ptr[0] = intr_handle->fd;
+#endif

ret = ioctl(intr_handle->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);

@@ -317,22 +317,6 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle) {
return -1;
}

-   /* manually trigger interrupt to enable it */
-   memset(irq_set, 0, len);
-   len = sizeof(struct vfio_irq_set);
-   irq_set->argsz = len;
-   irq_set->count = 1;
-   irq_set->flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_TRIGGER;
-   irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
-   irq_set->start = 0;
-
-   ret = ioctl(intr_handle->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
-
-   if (ret) {
-   RTE_LOG(ERR, EAL, "Error triggering MSI-X interrupts for fd 
%d\n",
-   intr_handle->fd);
-   return -1;
-   }
return 0;
 }

@@ -340,7 +324,7 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle) {
 static int
 vfio_disable_msix(struct rte_intr_handle *intr_handle) {
struct vfio_irq_set *irq_set;
-   char irq_set_buf[IRQ_SET_BUF_LEN];
+   char irq_set_buf[MSIX_IRQ_SET_BUF_LEN];
int len, ret;

len = sizeof(struct vfio_irq_set);
-- 
1.8.1.4



[dpdk-dev] [PATCH v15 04/13] eal/linux: fix comments typo on vfio msi

2015-07-20 Thread Cunming Liang

Signed-off-by: Cunming Liang 
---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c 
b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index ffccb0e..5acc3b7 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -219,7 +219,7 @@ vfio_disable_intx(struct rte_intr_handle *intr_handle) {
return 0;
 }

-/* enable MSI-X interrupts */
+/* enable MSI interrupts */
 static int
 vfio_enable_msi(struct rte_intr_handle *intr_handle) {
int len, ret;
@@ -265,7 +265,7 @@ vfio_enable_msi(struct rte_intr_handle *intr_handle) {
return 0;
 }

-/* disable MSI-X interrupts */
+/* disable MSI interrupts */
 static int
 vfio_disable_msi(struct rte_intr_handle *intr_handle) {
struct vfio_irq_set *irq_set;
-- 
1.8.1.4



[dpdk-dev] [PATCH v15 03/13] eal/linux: add API to set rx interrupt event monitor

2015-07-20 Thread Cunming Liang
The patch adds 'rte_intr_rx_ctl' to add or delete interrupt vector events 
monitor on specified epoll instance.

Signed-off-by: Cunming Liang 
---
v15 changes
 - remove ifdef RTE_NEXT_ABI from header file

v14 changes
 - per-patch basis ABI compatibility rework
 - remove unnecessary 'local: *' from version map

v13 changes
 - version map cleanup for v2.1

v12 changes:
 - fix awkward line split in using RTE_LOG

v10 changes:
 - add RTE_INTR_HANDLE_UIO_INTX for uio_pci_generic

v8 changes
 - fix EWOULDBLOCK and EINTR processing
 - add event status check

v7 changes
 - rename rte_intr_rx_set to rte_intr_rx_ctl.
 - rte_intr_rx_ctl uses rte_epoll_ctl to register epoll event instance.
 - the intr rx event instance includes a intr process callback.

v6 changes
 - split rte_intr_wait_rx_pkt into two function, wait and set.
 - rewrite rte_intr_rx_wait/rte_intr_rx_set to remove queue visibility on eal.
 - rte_intr_rx_wait to support multiplexing.
 - allow epfd as input to support flexible event fd combination.

 lib/librte_eal/linuxapp/eal/eal_interrupts.c   | 117 +
 .../linuxapp/eal/include/exec-env/rte_interrupts.h |  20 
 lib/librte_eal/linuxapp/eal/rte_eal_version.map|   1 +
 3 files changed, 138 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c 
b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 55be263..ffccb0e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -899,6 +899,51 @@ rte_eal_intr_init(void)
return -ret;
 }

+#ifdef RTE_NEXT_ABI
+static void
+eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
+{
+   union rte_intr_read_buffer buf;
+   int bytes_read = 1;
+
+   switch (intr_handle->type) {
+   case RTE_INTR_HANDLE_UIO:
+   case RTE_INTR_HANDLE_UIO_INTX:
+   bytes_read = sizeof(buf.uio_intr_count);
+   break;
+#ifdef VFIO_PRESENT
+   case RTE_INTR_HANDLE_VFIO_MSIX:
+   case RTE_INTR_HANDLE_VFIO_MSI:
+   case RTE_INTR_HANDLE_VFIO_LEGACY:
+   bytes_read = sizeof(buf.vfio_intr_count);
+   break;
+#endif
+   default:
+   bytes_read = 1;
+   RTE_LOG(INFO, EAL, "unexpected intr type\n");
+   break;
+   }
+
+   /**
+* read out to clear the ready-to-be-read flag
+* for epoll_wait.
+*/
+   do {
+   bytes_read = read(fd, , bytes_read);
+   if (bytes_read < 0) {
+   if (errno == EINTR || errno == EWOULDBLOCK ||
+   errno == EAGAIN)
+   continue;
+   RTE_LOG(ERR, EAL,
+   "Error reading from fd %d: %s\n",
+   fd, strerror(errno));
+   } else if (bytes_read == 0)
+   RTE_LOG(ERR, EAL, "Read nothing from fd %d\n", fd);
+   return;
+   } while (1);
+}
+#endif
+
 static int
 eal_epoll_process_event(struct epoll_event *evs, unsigned int n,
struct rte_epoll_event *events)
@@ -1035,3 +1080,75 @@ rte_epoll_ctl(int epfd, int op, int fd,

return 0;
 }
+
+#ifdef RTE_NEXT_ABI
+int
+rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,
+   int op, unsigned int vec, void *data)
+{
+   struct rte_epoll_event *rev;
+   struct rte_epoll_data *epdata;
+   int epfd_op;
+   int rc = 0;
+
+   if (!intr_handle || intr_handle->nb_efd == 0 ||
+   vec >= intr_handle->nb_efd) {
+   RTE_LOG(ERR, EAL, "Wrong intr vector number.\n");
+   return -EPERM;
+   }
+
+   switch (op) {
+   case RTE_INTR_EVENT_ADD:
+   epfd_op = EPOLL_CTL_ADD;
+   rev = _handle->elist[vec];
+   if (rev->status != RTE_EPOLL_INVALID) {
+   RTE_LOG(INFO, EAL, "Event already been added.\n");
+   return -EEXIST;
+   }
+
+   /* attach to intr vector fd */
+   epdata = >epdata;
+   epdata->event  = EPOLLIN | EPOLLPRI | EPOLLET;
+   epdata->data   = data;
+   epdata->cb_fun = (rte_intr_event_cb_t)eal_intr_proc_rxtx_intr;
+   epdata->cb_arg = (void *)intr_handle;
+   rc = rte_epoll_ctl(epfd, epfd_op, intr_handle->efds[vec], rev);
+   if (!rc)
+   RTE_LOG(DEBUG, EAL,
+   "efd %d associated with vec %d added on epfd %d"
+   "\n", rev->fd, vec, epfd);
+   else
+   rc = -EPERM;
+   break;
+   case RTE_INTR_EVENT_DEL:
+   epfd_op = EPOLL_CTL_DEL;
+   rev = _handle->elist[vec];
+   if (rev->status == RTE_EPOLL_INVALID) {
+   RTE_LOG(INFO, EAL, "Event does not exist.\n");
+  

[dpdk-dev] [PATCH v15 02/13] eal/linux: add rte_epoll_wait/ctl support

2015-07-20 Thread Cunming Liang
The patch adds 'rte_epoll_wait' and 'rte_epoll_ctl' for async event wakeup.
It defines 'struct rte_epoll_event' as the event param.
When the event fds add to a specified epoll instance, 'eptrs' will hold the 
rte_epoll_event object pointer.
The 'op' uses the same enum as epoll_wait/ctl does.
The epoll event support to carry a raw user data and to register a callback 
which is executed during wakeup.

Signed-off-by: Cunming Liang 
---
v14 changes
 - per-patch basis ABI compatibility rework
 - remove unnecessary 'local: *' from version map

v13 changes
 - version map cleanup for v2.1

v11 changes
 - cleanup spelling error

v9 changes
 - rework on coding style

v8 changes
 - support delete event in safety during the wakeup execution
 - add EINTR process during epoll_wait

v7 changes
 - split v6[4/8] into two patches, one for epoll event(this one)
   another for rx intr(next patch)
 - introduce rte_epoll_event definition
 - rte_epoll_wait/ctl for more generic RTE epoll API

v6 changes
 - split rte_intr_wait_rx_pkt into two function, wait and set.
 - rewrite rte_intr_rx_wait/rte_intr_rx_set to remove queue visibility on eal.
 - rte_intr_rx_wait to support multiplexing.
 - allow epfd as input to support flexible event fd combination.

 lib/librte_eal/linuxapp/eal/eal_interrupts.c   | 139 +
 .../linuxapp/eal/include/exec-env/rte_interrupts.h |  80 
 lib/librte_eal/linuxapp/eal/rte_eal_version.map|   3 +
 3 files changed, 222 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c 
b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 61e7c85..55be263 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -69,6 +69,8 @@

 #define EAL_INTR_EPOLL_WAIT_FOREVER (-1)

+static RTE_DEFINE_PER_LCORE(int, _epfd) = -1; /**< epoll fd per thread */
+
 /**
  * union for pipe fds.
  */
@@ -896,3 +898,140 @@ rte_eal_intr_init(void)

return -ret;
 }
+
+static int
+eal_epoll_process_event(struct epoll_event *evs, unsigned int n,
+   struct rte_epoll_event *events)
+{
+   unsigned int i, count = 0;
+   struct rte_epoll_event *rev;
+
+   for (i = 0; i < n; i++) {
+   rev = evs[i].data.ptr;
+   if (!rev || !rte_atomic32_cmpset(>status, RTE_EPOLL_VALID,
+RTE_EPOLL_EXEC))
+   continue;
+
+   events[count].status= RTE_EPOLL_VALID;
+   events[count].fd= rev->fd;
+   events[count].epfd  = rev->epfd;
+   events[count].epdata.event  = rev->epdata.event;
+   events[count].epdata.data   = rev->epdata.data;
+   if (rev->epdata.cb_fun)
+   rev->epdata.cb_fun(rev->fd,
+  rev->epdata.cb_arg);
+
+   rte_compiler_barrier();
+   rev->status = RTE_EPOLL_VALID;
+   count++;
+   }
+   return count;
+}
+
+static inline int
+eal_init_tls_epfd(void)
+{
+   int pfd = epoll_create(255);
+
+   if (pfd < 0) {
+   RTE_LOG(ERR, EAL,
+   "Cannot create epoll instance\n");
+   return -1;
+   }
+   return pfd;
+}
+
+int
+rte_intr_tls_epfd(void)
+{
+   if (RTE_PER_LCORE(_epfd) == -1)
+   RTE_PER_LCORE(_epfd) = eal_init_tls_epfd();
+
+   return RTE_PER_LCORE(_epfd);
+}
+
+int
+rte_epoll_wait(int epfd, struct rte_epoll_event *events,
+  int maxevents, int timeout)
+{
+   struct epoll_event evs[maxevents];
+   int rc;
+
+   if (!events) {
+   RTE_LOG(ERR, EAL, "rte_epoll_event can't be NULL\n");
+   return -1;
+   }
+
+   /* using per thread epoll fd */
+   if (epfd == RTE_EPOLL_PER_THREAD)
+   epfd = rte_intr_tls_epfd();
+
+   while (1) {
+   rc = epoll_wait(epfd, evs, maxevents, timeout);
+   if (likely(rc > 0)) {
+   /* epoll_wait has at least one fd ready to read */
+   rc = eal_epoll_process_event(evs, rc, events);
+   break;
+   } else if (rc < 0) {
+   if (errno == EINTR)
+   continue;
+   /* epoll_wait fail */
+   RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n",
+   strerror(errno));
+   rc = -1;
+   break;
+   }
+   }
+
+   return rc;
+}
+
+static inline void
+eal_epoll_data_safe_free(struct rte_epoll_event *ev)
+{
+   while (!rte_atomic32_cmpset(>status, RTE_EPOLL_VALID,
+   RTE_EPOLL_INVALID))
+   while (ev->status != RTE_EPOLL_VALID)
+   rte_pause();
+   memset(>epdata, 0, sizeof(ev->epdata));
+   ev->fd = -1;
+

[dpdk-dev] [PATCH v15 01/13] eal/linux: add interrupt vectors support in intr_handle

2015-07-20 Thread Cunming Liang
The patch adds interrupt vectors support in rte_intr_handle.
'vec_en' is set when interrupt vectors are detected and associated event fds 
are set.
Those event fds are stored in efds[].
'intr_vec' is reserved for device driver to initialize the vector mapping table.

Signed-off-by: Danny Zhou 
Signed-off-by: Cunming Liang 
---
v15 changes
 - remove unnecessary RTE_NEXT_ABI comment

v14 changes
 - per-patch basis ABI compatibility rework

v7 changes:
 - add eptrs[], it's used to store the register rte_epoll_event instances.
 - add vec_en, to log the vector capability status.

v6 changes:
 - add mapping table between irq vector number and queue id.

v5 changes:
 - Create this new patch file for changed struct rte_intr_handle that
   other patches depend on, to avoid breaking git bisect.

 lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h 
b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
index bdeb3fc..ac33eda 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
@@ -38,6 +38,8 @@
 #ifndef _RTE_LINUXAPP_INTERRUPTS_H_
 #define _RTE_LINUXAPP_INTERRUPTS_H_

+#define RTE_MAX_RXTX_INTR_VEC_ID 32
+
 enum rte_intr_handle_type {
RTE_INTR_HANDLE_UNKNOWN = 0,
RTE_INTR_HANDLE_UIO,  /**< uio device handle */
@@ -58,6 +60,12 @@ struct rte_intr_handle {
};
int fd;  /**< interrupt event file descriptor */
enum rte_intr_handle_type type;  /**< handle type */
+#ifdef RTE_NEXT_ABI
+   uint32_t max_intr; /**< max interrupt requested */
+   uint32_t nb_efd;   /**< number of available efd(event fd) */
+   int efds[RTE_MAX_RXTX_INTR_VEC_ID];  /**< intr vectors/efds mapping */
+   int *intr_vec; /**< intr vector number array */
+#endif
 };

 #endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */
-- 
1.8.1.4



[dpdk-dev] [PATCH v15 00/13] Interrupt mode PMD

2015-07-20 Thread Cunming Liang
v15 changes
 - remove unnecessary RTE_NEXT_ABI comment
 - remove ifdef RTE_NEXT_ABI from header file

v14 changes
 - per-patch basis ABI compatibility rework
 - remove unnecessary 'local: *' from version map
 - minor comments rework

v13 changes
 - version map cleanup for v2.1
 - replace RTE_EAL_RX_INTR by RTE_NEXT_ABI for ABI compatibility

Patch series v12
Acked-by: Stephen Hemminger 
Acked-by: Danny Zhou 

v12 changes
 - bsd cleanup for unused variable warning
 - fix awkward line split in debug message

v11 changes
 - typo cleanup and check kernel style

v10 changes
 - code rework to return actual error code
 - bug fix for lsc when using uio_pci_generic

v9 changes
 - code rework to fix open comment
 - bug fix for igb lsc when both lsc and rxq are enabled in vfio-msix
 - new patch to turn off the feature by default so as to avoid v2.1 abi broken

v8 changes
 - remove condition check for only vfio-msix
 - add multiplex intr support when only one intr vector allowed
 - lsc and rxq interrupt runtime enable decision
 - add safe event delete while the event wakeup execution happens

v7 changes
 - decouple epoll event and intr operation
 - add condition check in the case intr vector is disabled
 - renaming some APIs

v6 changes
 - split rte_intr_wait_rx_pkt into two APIs 'wait' and 'set'.
 - rewrite rte_intr_rx_wait/rte_intr_rx_set.
 - using vector number instead of queue_id as interrupt API params.
 - patch reorder and split.

v5 changes
 - Rebase the patchset onto the HEAD
 - Isolate ethdev from EAL for new-added wait-for-rx interrupt function
 - Export wait-for-rx interrupt function for shared libraries
 - Split-off a new patch file for changed struct rte_intr_handle that
   other patches depend on, to avoid breaking git bisect
 - Change sample applicaiton to accomodate EAL function spec change
   accordingly

v4 changes
 - Export interrupt enable/disable functions for shared libraries
 - Adjust position of new-added structure fields and functions to
   avoid breaking ABI

v3 changes
 - Add return value for interrupt enable/disable functions
 - Move spinlok from PMD to L3fwd-power
 - Remove unnecessary variables in e1000_mac_info
 - Fix miscelleous review comments

v2 changes
 - Fix compilation issue in Makefile for missed header file.
 - Consolidate internal and community review comments of v1 patch set.

The patch series introduce low-latency one-shot rx interrupt into DPDK with
polling and interrupt mode switch control example.

DPDK userspace interrupt notification and handling mechanism is based on UIO
with below limitation:
1) It is designed to handle LSC interrupt only with inefficient suspended
   pthread wakeup procedure (e.g. UIO wakes up LSC interrupt handling thread
   which then wakes up DPDK polling thread). In this way, it introduces
   non-deterministic wakeup latency for DPDK polling thread as well as packet
   latency if it is used to handle Rx interrupt.
2) UIO only supports a single interrupt vector which has to been shared by
   LSC interrupt and interrupts assigned to dedicated rx queues.

This patchset includes below features:
1) Enable one-shot rx queue interrupt in ixgbe PMD(PF & VF) and igb PMD(PF only)
. 
2) Build on top of the VFIO mechanism instead of UIO, so it could support
   up to 64 interrupt vectors for rx queue interrupts.
3) Have 1 DPDK polling thread handle per Rx queue interrupt with a dedicated
   VFIO eventfd, which eliminates non-deterministic pthread wakeup latency in
   user space.
4) Demonstrate interrupts control APIs and userspace NAIP-like polling/interrupt
   switch algorithms in L3fwd-power example.

Known limitations:
1) It does not work for UIO due to a single interrupt eventfd shared by LSC
   and rx queue interrupt handlers causes a mess. [FIXED]
2) LSC interrupt is not supported by VF driver, so it is by default disabled
   in L3fwd-power now. Feel free to turn in on if you want to support both LSC
   and rx queue interrupts on a PF.

Cunming Liang (13):
  eal/linux: add interrupt vectors support in intr_handle
  eal/linux: add rte_epoll_wait/ctl support
  eal/linux: add API to set rx interrupt event monitor
  eal/linux: fix comments typo on vfio msi
  eal/linux: map eventfd to VFIO MSI-X intr vector
  eal/linux: standalone intr event fd create support
  eal/linux: fix lsc read error in uio_pci_generic
  eal/bsd: dummy for new intr definition
  eal/bsd: fix inappropriate linuxapp referred in bsd
  ethdev: add rx intr enable, disable and ctl functions
  ixgbe: enable rx queue interrupts for both PF and VF
  igb: enable rx queue interrupts for PF
  l3fwd-power: enable one-shot rx interrupt and polling/interrupt mode
switch

 drivers/net/e1000/igb_ethdev.c | 311 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c   | 527 -
 drivers/net/ixgbe/ixgbe_ethdev.h   |   4 +
 examples/l3fwd-power/main.c| 205 ++--
 lib/librte_eal/bsdapp/eal/eal_interrupts.c | 

[dpdk-dev] [PATCH v2 3/3] virtio: small cleanups

2015-07-20 Thread Stephen Hemminger
Some minor cleanups.
  * pass constant to virtio_dev_queue_setup
  * fix message on rx_queue_setup
  * get rid of extra double spaces

Signed-off-by: Stephen Hemminger 
---
 drivers/net/virtio/virtio_ethdev.c | 7 +++
 drivers/net/virtio/virtio_ethdev.h | 2 +-
 drivers/net/virtio/virtio_rxtx.c   | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index d460d89..465d3cd 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -254,7 +254,7 @@ virtio_dev_queue_release(struct virtqueue *vq) {
 int virtio_dev_queue_setup(struct rte_eth_dev *dev,
int queue_type,
uint16_t queue_idx,
-   uint16_t  vtpci_queue_idx,
+   uint16_t vtpci_queue_idx,
uint16_t nb_desc,
unsigned int socket_id,
struct virtqueue **pvq)
@@ -264,7 +264,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
uint16_t vq_size;
int size;
struct virtio_hw *hw = dev->data->dev_private;
-   struct virtqueue  *vq = NULL;
+   struct virtqueue *vq = NULL;

/* Write the virtqueue index to the Queue Select Field */
VIRTIO_WRITE_REG_2(hw, VIRTIO_PCI_QUEUE_SEL, vtpci_queue_idx);
@@ -413,13 +413,12 @@ virtio_dev_cq_queue_setup(struct rte_eth_dev *dev, 
uint16_t vtpci_queue_idx,
uint32_t socket_id)
 {
struct virtqueue *vq;
-   uint16_t nb_desc = 0;
int ret;
struct virtio_hw *hw = dev->data->dev_private;

PMD_INIT_FUNC_TRACE();
ret = virtio_dev_queue_setup(dev, VTNET_CQ, VTNET_SQ_CQ_QUEUE_IDX,
-   vtpci_queue_idx, nb_desc, socket_id, );
+   vtpci_queue_idx, 0, socket_id, );
if (ret < 0) {
PMD_INIT_LOG(ERR, "control vq initialization failed");
return ret;
diff --git a/drivers/net/virtio/virtio_ethdev.h 
b/drivers/net/virtio/virtio_ethdev.h
index 3858b00..9026d42 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -79,7 +79,7 @@ void virtio_dev_rxtx_start(struct rte_eth_dev *dev);
 int virtio_dev_queue_setup(struct rte_eth_dev *dev,
int queue_type,
uint16_t queue_idx,
-   uint16_t  vtpci_queue_idx,
+   uint16_t vtpci_queue_idx,
uint16_t nb_desc,
unsigned int socket_id,
struct virtqueue **pvq);
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 5388caa..c5b53bb 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -390,7 +390,7 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,
ret = virtio_dev_queue_setup(dev, VTNET_RQ, queue_idx, vtpci_queue_idx,
nb_desc, socket_id, );
if (ret < 0) {
-   PMD_INIT_LOG(ERR, "tvq initialization failed");
+   PMD_INIT_LOG(ERR, "rvq initialization failed");
return ret;
}

-- 
2.1.4



[dpdk-dev] [PATCH v2 2/3] virtio: allow nb_desc < vq_size

2015-07-20 Thread Stephen Hemminger
When running on GCE vq_size is 16K but number of Rx descriptors
desired maybe less than that. Handle the situtaiton by initializing
full ring but only filling the smaller number.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/virtio/virtio_ethdev.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 94b7a81..d460d89 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -286,10 +286,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
return -EINVAL;
}

-   if (nb_desc != vq_size)
-   PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to vq size 
(%d), fall to vq size",
-   nb_desc, vq_size);
-
if (queue_type == VTNET_RQ) {
snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d",
dev->data->port_id, queue_idx);
@@ -317,7 +313,10 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
vq->queue_id = queue_idx;
vq->vq_queue_index = vtpci_queue_idx;
vq->vq_nentries = vq_size;
-   vq->vq_free_cnt = vq_size;
+
+   if (nb_desc == 0 || nb_desc > vq_size)
+   nb_desc = vq_size;
+   vq->vq_free_cnt = nb_desc;

/*
 * Reserve a memzone for vring elements
-- 
2.1.4



[dpdk-dev] [PATCH v2 1/3] virtio: fix the vq size issue

2015-07-20 Thread Stephen Hemminger
From: Ouyang Changchun 

This commit breaks virtio basic packets rx functionality:
  d78deadae4dca240e85054bf2d604a801676becc

The QEMU use 256 as default vring size, also use this default value to
calculate the virtio avail ring base address and used ring base
address, and vhost in the backend use the ring base address to do
packet IO.

Virtio spec also says the queue size in PCI configuration is
read-only, so virtio front end can't change it. just need use the
read-only value to allocate space for vring and calculate the avail
and used ring base address. Otherwise, the avail and used ring base
address will be different between host and guest, accordingly, packet
IO can't work normally.

Signed-off-by: Changchun Ouyang 
Acked-by: Stephen Hemminger 
---
 drivers/net/virtio/virtio_ethdev.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 9ca9bb2..94b7a81 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -276,8 +276,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
 */
vq_size = VIRTIO_READ_REG_2(hw, VIRTIO_PCI_QUEUE_NUM);
PMD_INIT_LOG(DEBUG, "vq_size: %d nb_desc:%d", vq_size, nb_desc);
-   if (nb_desc == 0)
-   nb_desc = vq_size;
if (vq_size == 0) {
PMD_INIT_LOG(ERR, "%s: virtqueue does not exist", __func__);
return -EINVAL;
@@ -288,15 +286,9 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
return -EINVAL;
}

-   if (nb_desc < vq_size) {
-   if (!rte_is_power_of_2(nb_desc)) {
-   PMD_INIT_LOG(ERR,
-"nb_desc(%u) size is not powerof 2",
-nb_desc);
-   return -EINVAL;
-   }
-   vq_size = nb_desc;
-   }
+   if (nb_desc != vq_size)
+   PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to vq size 
(%d), fall to vq size",
+   nb_desc, vq_size);

if (queue_type == VTNET_RQ) {
snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d",
-- 
2.1.4



[dpdk-dev] [PATCH v2 0/3] virtio: size bug fixes

2015-07-20 Thread Stephen Hemminger
Fix for a fix for a fix...
This set includes Changchun's patch for vq_size but adds
follow on fix to make it work with GCE and other environments.

Ouyang Changchun (1):
  virtio: fix the vq size issue

Stephen Hemminger (2):
  virtio: allow nb_desc < vq_size
  virtio: small cleanups

 drivers/net/virtio/virtio_ethdev.c | 24 +++-
 drivers/net/virtio/virtio_ethdev.h |  2 +-
 drivers/net/virtio/virtio_rxtx.c   |  2 +-
 3 files changed, 9 insertions(+), 19 deletions(-)

-- 
2.1.4



[dpdk-dev] [PATCH] examples: new example: l2fwd-ethtool

2015-07-20 Thread Liang-Min Larry Wang
The example includes an ethtool library and two applications:
one application is a non- DPDK process (nic-control)
and the other is a DPDK l2fwd applicaiton (l2fwd-app).
The nic-control process sends ethtool alike device management
requests to l2fwd-app through a named pipe IPC. This example
is designed to show how to build a ethtool shim library and
how to use ethtool apis to manage device parameters.

Signed-off-by: Liang-Min Larry Wang 
---
 examples/Makefile|1 +
 examples/l2fwd-ethtool/Makefile  |   48 +
 examples/l2fwd-ethtool/l2fwd-app/Makefile|   58 ++
 examples/l2fwd-ethtool/l2fwd-app/main.c  | 1025 ++
 examples/l2fwd-ethtool/l2fwd-app/netdev_api.h|  770 
 examples/l2fwd-ethtool/l2fwd-app/shared_fifo.h   |  159 
 examples/l2fwd-ethtool/lib/Makefile  |   57 ++
 examples/l2fwd-ethtool/lib/rte_ethtool.c |  336 +++
 examples/l2fwd-ethtool/lib/rte_ethtool.h |  385 
 examples/l2fwd-ethtool/nic-control/Makefile  |   55 ++
 examples/l2fwd-ethtool/nic-control/nic_control.c |  614 +
 mk/rte.lib.mk|2 +
 12 files changed, 3510 insertions(+)
 create mode 100644 examples/l2fwd-ethtool/Makefile
 create mode 100644 examples/l2fwd-ethtool/l2fwd-app/Makefile
 create mode 100644 examples/l2fwd-ethtool/l2fwd-app/main.c
 create mode 100644 examples/l2fwd-ethtool/l2fwd-app/netdev_api.h
 create mode 100644 examples/l2fwd-ethtool/l2fwd-app/shared_fifo.h
 create mode 100644 examples/l2fwd-ethtool/lib/Makefile
 create mode 100644 examples/l2fwd-ethtool/lib/rte_ethtool.c
 create mode 100644 examples/l2fwd-ethtool/lib/rte_ethtool.h
 create mode 100644 examples/l2fwd-ethtool/nic-control/Makefile
 create mode 100644 examples/l2fwd-ethtool/nic-control/nic_control.c

diff --git a/examples/Makefile b/examples/Makefile
index b4eddbd..3dc049c 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -53,6 +53,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_KNI) += kni
 DIRS-y += l2fwd
 DIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += l2fwd-ivshmem
 DIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += l2fwd-jobstats
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += l2fwd-ethtool
 DIRS-y += l3fwd
 DIRS-$(CONFIG_RTE_LIBRTE_ACL) += l3fwd-acl
 DIRS-$(CONFIG_RTE_LIBRTE_POWER) += l3fwd-power
diff --git a/examples/l2fwd-ethtool/Makefile b/examples/l2fwd-ethtool/Makefile
new file mode 100644
index 000..d9ad439
--- /dev/null
+++ b/examples/l2fwd-ethtool/Makefile
@@ -0,0 +1,48 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2015 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.
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overwritten by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+ifneq ($(CONFIG_RTE_EXEC_ENV),"linuxapp")
+$(error This application can only operate in a linuxapp environment, \
+please change the definition of the RTE_TARGET environment variable)
+endif
+
+DIRS-y += lib nic-control l2fwd-app
+
+include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/l2fwd-ethtool/l2fwd-app/Makefile 
b/examples/l2fwd-ethtool/l2fwd-app/Makefile
new file mode 100644
index 000..69405f2
--- /dev/null
+++ b/examples/l2fwd-ethtool/l2fwd-app/Makefile
@@ -0,0 +1,58 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2015 

[dpdk-dev] [PATCH] User-space Ethool example

2015-07-20 Thread Liang-Min Larry Wang
This implementation is designed to provide an example illlustrating how to 
create a
user-space ethtool library from existing ethdev APIs. This example only 
implements
19 popular used Ethtool and Netdevice ops as described in 
examples/l2fwd-ethtool/lib/rte_ethtool.h

Liang-Min Larry Wang (1):
  examples: new example: l2fwd-ethtool

 examples/Makefile|1 +
 examples/l2fwd-ethtool/Makefile  |   48 +
 examples/l2fwd-ethtool/l2fwd-app/Makefile|   58 ++
 examples/l2fwd-ethtool/l2fwd-app/main.c  | 1025 ++
 examples/l2fwd-ethtool/l2fwd-app/netdev_api.h|  770 
 examples/l2fwd-ethtool/l2fwd-app/shared_fifo.h   |  159 
 examples/l2fwd-ethtool/lib/Makefile  |   57 ++
 examples/l2fwd-ethtool/lib/rte_ethtool.c |  336 +++
 examples/l2fwd-ethtool/lib/rte_ethtool.h |  385 
 examples/l2fwd-ethtool/nic-control/Makefile  |   55 ++
 examples/l2fwd-ethtool/nic-control/nic_control.c |  614 +
 mk/rte.lib.mk|2 +
 12 files changed, 3510 insertions(+)
 create mode 100644 examples/l2fwd-ethtool/Makefile
 create mode 100644 examples/l2fwd-ethtool/l2fwd-app/Makefile
 create mode 100644 examples/l2fwd-ethtool/l2fwd-app/main.c
 create mode 100644 examples/l2fwd-ethtool/l2fwd-app/netdev_api.h
 create mode 100644 examples/l2fwd-ethtool/l2fwd-app/shared_fifo.h
 create mode 100644 examples/l2fwd-ethtool/lib/Makefile
 create mode 100644 examples/l2fwd-ethtool/lib/rte_ethtool.c
 create mode 100644 examples/l2fwd-ethtool/lib/rte_ethtool.h
 create mode 100644 examples/l2fwd-ethtool/nic-control/Makefile
 create mode 100644 examples/l2fwd-ethtool/nic-control/nic_control.c

-- 
2.1.4



[dpdk-dev] [PATCH v14 10/13] ethdev: add rx intr enable, disable and ctl functions

2015-07-20 Thread Liang, Cunming


On 7/18/2015 5:40 AM, Stephen Hemminger wrote:
>> +/**
>>* Turn on the LED on the Ethernet device.
>>* This function turns on the LED on the Ethernet device.
>>*
>> diff --git a/lib/librte_ether/rte_ether_version.map 
>> b/lib/librte_ether/rte_ether_version.map
>> index 39baf11..fa09d75 100644
>> --- a/lib/librte_ether/rte_ether_version.map
>> +++ b/lib/librte_ether/rte_ether_version.map
>> @@ -109,6 +109,10 @@ DPDK_2.0 {
>>   DPDK_2.1 {
>>  global:
>>   
>> +rte_eth_dev_rx_intr_ctl;
>> +rte_eth_dev_rx_intr_ctl_q;
>> +rte_eth_dev_rx_intr_disable;
>> +rte_eth_dev_rx_intr_enable;
>>  rte_eth_dev_set_mc_addr_list;
>>  rte_eth_timesync_disable;
>>  rte_eth_timesync_enable;
> This needs rebase to current master, minor conflict here
Didn't occur the conflict during my rebase. But anyway, will rebase 
again on the next rework. Thanks.


[dpdk-dev] [PATCH v14 06/13] eal/linux: standalone intr event fd create support

2015-07-20 Thread Liang, Cunming


On 7/20/2015 7:39 AM, Thomas Monjalon wrote:
> 2015-07-20 01:35, Thomas Monjalon:
>> 2015-07-17 14:16, Cunming Liang:
>>> +#ifdef RTE_NEXT_ABI
>>> +extern int
>>> +rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd);
>>> +#else
>>> +static inline int
>>> +rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
>>> +{
>>> +   RTE_SET_USED(intr_handle);
>>> +   RTE_SET_USED(nb_efd);
>>> +   return 0;
>>> +}
>>> +#endif
>> [...]
>>> +#ifdef RTE_NEXT_ABI
>>> +extern void
>>> +rte_intr_efd_disable(struct rte_intr_handle *intr_handle);
>>> +#else
>>> +static inline void
>>> +rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
>>> +{
>>> +   RTE_SET_USED(intr_handle);
>>> +}
>>> +#endif
>> [...]
>>> +#ifdef RTE_NEXT_ABI
>>> +static inline int
>>> +rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
>>> +{
>>> +   return !(!intr_handle->nb_efd);
>>> +}
>>> +#else
>>> +static inline int
>>> +rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
>>> +{
>>> +   RTE_SET_USED(intr_handle);
>>> +   return 0;
>>> +}
>>> +#endif
>> [...]
>>> +#ifdef RTE_NEXT_ABI
>>> +static inline int
>>> +rte_intr_allow_others(struct rte_intr_handle *intr_handle)
>>> +{
>>> +   return !!(intr_handle->max_intr - intr_handle->nb_efd);
>>> +}
>>> +#else
>>> +static inline int
>>> +rte_intr_allow_others(struct rte_intr_handle *intr_handle)
>>> +{
>>> +   RTE_SET_USED(intr_handle);
>>> +   return 1;
>>> +}
>>> +#endif
>> Why these #else cases?
> Why not totally removing these ifdef in the header and use them in .c?
That's a good idea, will take it. Thanks.
>
>>> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>>> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>>> @@ -117,6 +117,10 @@ DPDK_2.1 {
>>>   
>>> rte_epoll_ctl;
>>> rte_epoll_wait;
>>> +   rte_intr_allow_others;
>>> +   rte_intr_dp_is_en;
>>> +   rte_intr_efd_enable;
>>> +   rte_intr_efd_disable;
>> If RTE_NEXT_ABI is disabled, these symbols do not exist.
>> An alternate .map would be needed.
You're right, will take your suggestion above.


[dpdk-dev] [PATCH] prefetch second cacheline of mbufs on alloc

2015-07-20 Thread Olivier MATZ
Hi Thomas,


On 07/20/2015 03:00 AM, Thomas Monjalon wrote:
> Please Olivier,
> What is the status of this patch?

>From what I remember, the last mail was a comment from Konstantin
on another thread (but same topic):
http://dpdk.org/ml/archives/dev/2015-May/017633.html


Regards,
Olivier


> 
> 2015-05-12 01:15, Paul Emmerich:
>> this improves the throughput of a simple tx-only application by 11% in
>> the full-featured ixgbe tx path and by 14% in the simple tx path.
>> ---
>>  lib/librte_mbuf/rte_mbuf.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
>> index ab6de67..f6895b4 100644
>> --- a/lib/librte_mbuf/rte_mbuf.h
>> +++ b/lib/librte_mbuf/rte_mbuf.h
>> @@ -538,6 +538,7 @@ static inline struct rte_mbuf 
>> *__rte_mbuf_raw_alloc(struct rte_mempool *mp)
>>  if (rte_mempool_get(mp, ) < 0)
>>  return NULL;
>>  m = (struct rte_mbuf *)mb;
>> +rte_prefetch0(>cacheline1);
>>  RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);
>>  rte_mbuf_refcnt_set(m, 1);
>>  return (m);
>>
> 
> 


[dpdk-dev] [PATCH v14 01/13] eal/linux: add interrupt vectors support in intr_handle

2015-07-20 Thread Liang, Cunming


On 7/20/2015 7:31 AM, Thomas Monjalon wrote:
> 2015-07-17 14:16, Cunming Liang:
>> +#ifdef RTE_NEXT_ABI
>> +/**
>> + * RTE_NEXT_ABI will be removed from v2.2.
>> + * It's only used to avoid ABI(unannounced) broken in v2.1.
>> + * Make sure being aware of the impact before turning on the feature.
>> + */
> We are not going to put this comment each time NEXT_ABI is used with ifdef.
Ok, will remove the comment.


[dpdk-dev] [PATCHv2 1/5] ethdev: add new API to retrieve RX/TX queue information

2015-07-20 Thread Ananyev, Konstantin


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Monday, July 20, 2015 1:13 AM
> To: Ananyev, Konstantin
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCHv2 1/5] ethdev: add new API to retrieve RX/TX 
> queue information
> 
> 2015-06-18 14:18, Konstantin Ananyev:
> > new functions:
> > rte_eth_rx_queue_info_get
> > rte_eth_tx_queue_info_get
> >
> > into rte_etdev API.
> [...]
> >  lib/librte_ether/rte_ethdev.c | 54 ++
> >  lib/librte_ether/rte_ethdev.h | 77 
> > ++-
> >  2 files changed, 130 insertions(+), 1 deletion(-)
> [...]
> >  int
> > +rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +   struct rte_eth_rxq_info *qinfo)
> > +{
> [...]
> > +int
> > +rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +   struct rte_eth_txq_info *qinfo)
> > +{
> 
> These new functions are not declared in the .map file.
> 
> config.o: In function `rx_queue_infos_display':
> config.c:(.text+0x11e): undefined reference to `rte_eth_rx_queue_info_get'
> config.o: In function `tx_queue_infos_display':
> config.c:(.text+0x2be): undefined reference to `rte_eth_tx_queue_info_get'


Ah yes, lost it somewhere between re-versioning.
Will re-send v3.
Thanks
Konstantin




[dpdk-dev] [PATCH 2/2] ixgbe: check mbuf refcnt when clearing RX/TX ring

2015-07-20 Thread Richardson, Bruce


> -Original Message-
> From: Ananyev, Konstantin
> Sent: Monday, July 20, 2015 10:37 AM
> To: Richardson, Bruce; dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH 2/2] ixgbe: check mbuf refcnt when clearing
> RX/TX ring
> 
> Hi Bruce,
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Bruce Richardson
> > Sent: Friday, July 03, 2015 4:40 PM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCH 2/2] ixgbe: check mbuf refcnt when clearing
> > RX/TX ring
> >
> > The function to clear the TX ring when a port was being closed, e.g.
> > on exit in testpmd, was not checking the mbuf refcnt before freeing it.
> > Since the function in the vector driver to clear the ring after TX
> > does not set the pointer to NULL post-free, this caused crashes if
> > mbuf debugging was turned on.
> >
> > To reproduce the issue, ensure the follow config variables are set:
> > RTE_IXGBE_INC_VECTOR
> > RTE_LIBRTE_MBUF_DEBUG
> > Then compile up and run testpmd using 10G ports with the vector driver.
> > Start traffic and let some flow through, then type "stop" and "quit"
> > at the testpmd prompt, and crash will occur. Output below:
> >
> > testpmd> quit
> > Stopping port 0...done
> > Stopping port 1...PANIC in rte_mbuf_sanity_check():
> > bad ref cnt
> > [New Thread 0x7fffabfff700 (LWP 145312)]
> > [New Thread 0x7fffb47fe700 (LWP 145311)]
> > [New Thread 0x7fffb4fff700 (LWP 145310)]
> > [New Thread 0x76cd5700 (LWP 145309)]
> > 18: [/home/bruce/dpdk.org/x86_64-native-linuxapp-
> gcc/app/testpmd(_start+0x29)
> > 
> > Program received signal SIGABRT, Aborted.
> > 0x77120a98 in raise () from /lib64/libc.so.6
> >
> > A similar error occurs when clearing the RX ring, which is also fixed
> > by this patch.
> >
> > Signed-off-by: Bruce Richardson 
> > ---
> >  drivers/net/ixgbe/ixgbe_rxtx.c | 3 ++-
> >  drivers/net/ixgbe/ixgbe_rxtx_vec.c | 8 +++-
> >  2 files changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c
> > b/drivers/net/ixgbe/ixgbe_rxtx.c index 41a062e..12e25b7 100644
> > --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> > @@ -2108,7 +2108,8 @@ ixgbe_rx_queue_release_mbufs(struct
> > ixgbe_rx_queue *rxq)
> >
> > if (rxq->sw_ring != NULL) {
> > for (i = 0; i < rxq->nb_rx_desc; i++) {
> > -   if (rxq->sw_ring[i].mbuf != NULL) {
> > +   if (rxq->sw_ring[i].mbuf != NULL &&
> > +   
> > rte_mbuf_refcnt_read(rxq->sw_ring[i].mbuf))
> {
> > rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf);
> > rxq->sw_ring[i].mbuf = NULL;
> > }
> 
> 
> Sorry for late review, but I am afraid your changes don't fix the problem.
> After sw_ring[].mbuf was freed by RX path, entity that manages that RX
> queue shouldn't touch that mbuf.
> (unless it was allocated  by the same RX queue again).
> As same mbuf could be already allocated by something else.
> As an example by another RX/TX queue and is in active use.
> Same story for TX below.

Good point, I'd forgotten about that scenario.

> 
> As I can see the proper fix could be one of 2:
> 1. Make RX/TX vector functions to reset sw_ring[].mbuf to 0.
> 2. At queue_release_mbufs(), don't go through all sw_ring[] entries, but
> only though ones which might contain valid mbufs.
> For RX: entries between rx_tail and rxrearm_start only (which implies a
> special queue_release_mbufs() for vector rx).
> For TX: from tx_next_dd - (tx_rs_thresh - 1) and no more then nb_tx_desc -
> nb_tx_free

Option 2 seems a better choice for a fix. I'll look at it when I get a chance.

/Bruce

> 
> Konstantin
> 
> > diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec.c
> > b/drivers/net/ixgbe/ixgbe_rxtx_vec.c
> > index 0edac82..7e633d3 100644
> > --- a/drivers/net/ixgbe/ixgbe_rxtx_vec.c
> > +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec.c
> > @@ -665,7 +665,13 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue
> *txq)
> >  nb_free < max_desc && i != txq->tx_tail;
> >  i = (i + 1) & max_desc) {
> > txe = (struct ixgbe_tx_entry_v *)>sw_ring[i];
> > -   if (txe->mbuf != NULL)
> > +   /*
> > +*check for already freed packets.
> > +* Note: ixgbe_tx_free_bufs does not NULL after free,
> > +* so we actually have to check the reference count.
> > +*/
> > +   if (txe->mbuf != NULL &&
> > +   rte_mbuf_refcnt_read(txe->mbuf) != 0)
> > rte_pktmbuf_free_seg(txe->mbuf);
> > }
> > /* reset tx_entry */
> > --
> > 2.4.3



[dpdk-dev] [PATCH 2/2] ixgbe: check mbuf refcnt when clearing RX/TX ring

2015-07-20 Thread Ananyev, Konstantin
Hi Bruce,

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Bruce Richardson
> Sent: Friday, July 03, 2015 4:40 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 2/2] ixgbe: check mbuf refcnt when clearing RX/TX 
> ring
> 
> The function to clear the TX ring when a port was being closed, e.g. on
> exit in testpmd, was not checking the mbuf refcnt before freeing it.
> Since the function in the vector driver to clear the ring after TX does
> not set the pointer to NULL post-free, this caused crashes if mbuf
> debugging was turned on.
> 
> To reproduce the issue, ensure the follow config variables are set:
> RTE_IXGBE_INC_VECTOR
> RTE_LIBRTE_MBUF_DEBUG
> Then compile up and run testpmd using 10G ports with the vector driver.
> Start traffic and let some flow through, then type "stop" and "quit" at
> the testpmd prompt, and crash will occur. Output below:
> 
>   testpmd> quit
>   Stopping port 0...done
>   Stopping port 1...PANIC in rte_mbuf_sanity_check():
>   bad ref cnt
>   [New Thread 0x7fffabfff700 (LWP 145312)]
>   [New Thread 0x7fffb47fe700 (LWP 145311)]
>   [New Thread 0x7fffb4fff700 (LWP 145310)]
>   [New Thread 0x76cd5700 (LWP 145309)]
>   18: 
> [/home/bruce/dpdk.org/x86_64-native-linuxapp-gcc/app/testpmd(_start+0x29)
>   
>   Program received signal SIGABRT, Aborted.
>   0x77120a98 in raise () from /lib64/libc.so.6
> 
> A similar error occurs when clearing the RX ring, which is also fixed by
> this patch.
> 
> Signed-off-by: Bruce Richardson 
> ---
>  drivers/net/ixgbe/ixgbe_rxtx.c | 3 ++-
>  drivers/net/ixgbe/ixgbe_rxtx_vec.c | 8 +++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
> index 41a062e..12e25b7 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -2108,7 +2108,8 @@ ixgbe_rx_queue_release_mbufs(struct ixgbe_rx_queue *rxq)
> 
>   if (rxq->sw_ring != NULL) {
>   for (i = 0; i < rxq->nb_rx_desc; i++) {
> - if (rxq->sw_ring[i].mbuf != NULL) {
> + if (rxq->sw_ring[i].mbuf != NULL &&
> + 
> rte_mbuf_refcnt_read(rxq->sw_ring[i].mbuf)) {
>   rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf);
>   rxq->sw_ring[i].mbuf = NULL;
>   }


Sorry for late review, but I am afraid your changes don't fix the problem.
After sw_ring[].mbuf was freed by RX path, entity that manages that RX queue 
shouldn't touch that mbuf.
(unless it was allocated  by the same RX queue again).
As same mbuf could be already allocated by something else.
As an example by another RX/TX queue and is in active use. 
Same story for TX below.

As I can see the proper fix could be one of 2:
1. Make RX/TX vector functions to reset sw_ring[].mbuf to 0.
2. At queue_release_mbufs(), don't go through all sw_ring[] entries, but only 
though ones
which might contain valid mbufs.
For RX: entries between rx_tail and rxrearm_start only
(which implies a special queue_release_mbufs() for vector rx).
For TX: from tx_next_dd - (tx_rs_thresh - 1) and no more then nb_tx_desc - 
nb_tx_free

Konstantin

> diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec.c 
> b/drivers/net/ixgbe/ixgbe_rxtx_vec.c
> index 0edac82..7e633d3 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx_vec.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec.c
> @@ -665,7 +665,13 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq)
>nb_free < max_desc && i != txq->tx_tail;
>i = (i + 1) & max_desc) {
>   txe = (struct ixgbe_tx_entry_v *)>sw_ring[i];
> - if (txe->mbuf != NULL)
> + /*
> +  *check for already freed packets.
> +  * Note: ixgbe_tx_free_bufs does not NULL after free,
> +  * so we actually have to check the reference count.
> +  */
> + if (txe->mbuf != NULL &&
> + rte_mbuf_refcnt_read(txe->mbuf) != 0)
>   rte_pktmbuf_free_seg(txe->mbuf);
>   }
>   /* reset tx_entry */
> --
> 2.4.3



[dpdk-dev] [PATCH v5 4/4] bnx2x: enable PMD build

2015-07-20 Thread Stephen Hemminger
This is build infrastructure changes for bnx2x driver.
 - enable BNX2X poll mode driver in default config.
 - add it to mk
 - put entry in MAINTAINERS

Note: I intentionally did not list myself as maintainer of this
driver. QLogic has discussed taking over as maintainer.

Signed-off-by: Stephen Hemminger 

---
v4 - Add PCI id's for 57840
---
 MAINTAINERS |  3 ++
 config/common_linuxapp  | 10 
 drivers/net/Makefile|  1 +
 drivers/net/bnx2x/Makefile  | 28 
 lib/librte_eal/common/include/rte_pci_dev_ids.h | 61 +
 mk/rte.app.mk   |  2 +
 6 files changed, 105 insertions(+)
 create mode 100644 drivers/net/bnx2x/Makefile

diff --git a/MAINTAINERS b/MAINTAINERS
index 6531900..b6a82ad 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -277,6 +277,9 @@ M: John McNamara 
 F: drivers/net/pcap/
 F: doc/guides/nics/pcap_ring.rst

+Qlogic/Broadcom bnx2x
+F: drivers/net/bnx2x/
+
 Ring PMD
 M: Bruce Richardson 
 F: drivers/net/ring/
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 579a5d7..a8a392e 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -229,6 +229,16 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=y
 CONFIG_RTE_LIBRTE_ENIC_DEBUG=n

 #
+# Compile burst-oriented Broadcom PMD driver
+#
+CONFIG_RTE_LIBRTE_BNX2X_PMD=y
+CONFIG_RTE_LIBRTE_BNX2X_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_BNX2X_DEBUG=n
+CONFIG_RTE_LIBRTE_BNX2X_MF_SUPPORT=n
+CONFIG_RTE_LIBRTE_BNX2X_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_BNX2X_DEBUG_RX=n
+
+#
 # Compile burst-oriented VIRTIO PMD driver
 #
 CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6171430..6d519b6 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x

 include $(RTE_SDK)/mk/rte.sharelib.mk
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
new file mode 100644
index 000..0de5db9
--- /dev/null
+++ b/drivers/net/bnx2x/Makefile
@@ -0,0 +1,28 @@
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_bnx2x.a
+
+CFLAGS += -O3 -g
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DZLIB_CONST
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_rxtx.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_stats.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += ecore_sp.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += elink.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_vfpf.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_DEBUG) += debug.c
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_eal lib/librte_ether 
lib/librte_hash
+DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_mempool lib/librte_mbuf
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/common/include/rte_pci_dev_ids.h 
b/lib/librte_eal/common/include/rte_pci_dev_ids.h
index 084d182..badb719 100644
--- a/lib/librte_eal/common/include/rte_pci_dev_ids.h
+++ b/lib/librte_eal/common/include/rte_pci_dev_ids.h
@@ -144,6 +144,14 @@
 #define RTE_PCI_DEV_ID_DECL_ENIC(vend, dev)
 #endif

+#ifndef RTE_PCI_DEV_ID_DECL_BNX2X
+#define RTE_PCI_DEV_ID_DECL_BNX2X(vend, dev)
+#endif
+
+#ifndef RTE_PCI_DEV_ID_DECL_BNX2XVF
+#define RTE_PCI_DEV_ID_DECL_BNX2XVF(vend, dev)
+#endif
+
 #ifndef PCI_VENDOR_ID_INTEL
 /** Vendor ID used by Intel devices */
 #define PCI_VENDOR_ID_INTEL 0x8086
@@ -164,6 +172,11 @@
 #define PCI_VENDOR_ID_CISCO 0x1137
 #endif

+#ifndef PCI_VENDOR_ID_BROADCOM
+/** Vendor ID used by Broadcom devices */
+#define PCI_VENDOR_ID_BROADCOM 0x14E4
+#endif
+
 / Physical EM devices from e1000_hw.h /

 #define E1000_DEV_ID_825420x1000
@@ -566,6 +579,52 @@ RTE_PCI_DEV_ID_DECL_FM10KVF(PCI_VENDOR_ID_INTEL, 
FM10K_DEV_ID_VF)
 RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET)
 RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF)

+/** QLogic devices **/
+
+/* Broadcom/QLogic BNX2X */
+#define BNX2X_DEV_ID_57710 0x164e
+#define BNX2X_DEV_ID_57711 0x164f
+#define BNX2X_DEV_ID_57711E0x1650
+#define BNX2X_DEV_ID_57712 0x1662
+#define BNX2X_DEV_ID_57712_MF  0x1663
+#define BNX2X_DEV_ID_57712_VF  0x166f
+#define BNX2X_DEV_ID_57713 0x1651
+#define BNX2X_DEV_ID_57713E0x1652
+#define BNX2X_DEV_ID_57800 0x168a
+#define BNX2X_DEV_ID_57800_MF  0x16a5
+#define BNX2X_DEV_ID_57800_VF  0x16a9
+#define BNX2X_DEV_ID_57810 0x168e
+#define BNX2X_DEV_ID_57810_MF  0x16ae
+#define BNX2X_DEV_ID_57810_VF  

[dpdk-dev] [PATCH v5 3/4] bnx2x: driver support routines

2015-07-20 Thread Stephen Hemminger
More code for the Broadcom/Qlogic NetExtreme II poll mode driver.
Split into pieces for review and not to overwhelm mailers.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/bnx2x/debug.c   |   113 +
 drivers/net/bnx2x/ecore_fw_defs.h   |   422 +
 drivers/net/bnx2x/ecore_hsi.h   |  6348 
 drivers/net/bnx2x/ecore_init.h  |   841 ++
 drivers/net/bnx2x/ecore_init_ops.h  |   886 ++
 drivers/net/bnx2x/ecore_mfw_req.h   |   206 +
 drivers/net/bnx2x/ecore_reg.h   |  3663 +++
 drivers/net/bnx2x/ecore_sp.c|  5455 +++
 drivers/net/bnx2x/ecore_sp.h|  1795 
 drivers/net/bnx2x/elink.c   | 13378 ++
 drivers/net/bnx2x/elink.h   |   609 ++
 drivers/net/bnx2x/rte_pmd_bnx2x_version.map | 4 +
 12 files changed, 33720 insertions(+)
 create mode 100644 drivers/net/bnx2x/debug.c
 create mode 100644 drivers/net/bnx2x/ecore_fw_defs.h
 create mode 100644 drivers/net/bnx2x/ecore_hsi.h
 create mode 100644 drivers/net/bnx2x/ecore_init.h
 create mode 100644 drivers/net/bnx2x/ecore_init_ops.h
 create mode 100644 drivers/net/bnx2x/ecore_mfw_req.h
 create mode 100644 drivers/net/bnx2x/ecore_reg.h
 create mode 100644 drivers/net/bnx2x/ecore_sp.c
 create mode 100644 drivers/net/bnx2x/ecore_sp.h
 create mode 100644 drivers/net/bnx2x/elink.c
 create mode 100644 drivers/net/bnx2x/elink.h
 create mode 100644 drivers/net/bnx2x/rte_pmd_bnx2x_version.map

diff --git a/drivers/net/bnx2x/debug.c b/drivers/net/bnx2x/debug.c
new file mode 100644
index 000..9ab4f1d
--- /dev/null
+++ b/drivers/net/bnx2x/debug.c
@@ -0,0 +1,113 @@
+/*-
+ * Copyright (c) 2007-2013 QLogic Corporation. All rights reserved.
+ *
+ * Eric Davis
+ * David Christensen 
+ * Gary Zambrano 
+ *
+ * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name of Broadcom Corporation nor the name of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written consent.
+ *
+ * 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 "bnx2x.h"
+
+
+/*
+ * Debug versions of the 8/16/32 bit OS register read/write functions to
+ * capture/display values read/written from/to the controller.
+ */
+void
+bnx2x_reg_write8(struct bnx2x_softc *sc, size_t offset, uint8_t val)
+{
+   PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%02x", offset, val);
+   *((volatile uint8_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)) = 
val;
+}
+
+void
+bnx2x_reg_write16(struct bnx2x_softc *sc, size_t offset, uint16_t val)
+{
+   if ((offset % 2) != 0) {
+   PMD_DRV_LOG(DEBUG, "Unaligned 16-bit write to 0x%08lx", offset);
+   }
+
+   PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%04x", offset, val);
+   *((volatile uint16_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)) = 
val;
+}
+
+void
+bnx2x_reg_write32(struct bnx2x_softc *sc, size_t offset, uint32_t val)
+{
+   if ((offset % 4) != 0) {
+   PMD_DRV_LOG(DEBUG, "Unaligned 32-bit write to 0x%08lx", offset);
+   }
+
+   PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%08x", offset, val);
+   *((volatile uint32_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)) = 
val;
+}
+
+uint8_t
+bnx2x_reg_read8(struct bnx2x_softc *sc, size_t offset)
+{
+   uint8_t val;
+
+   val = (uint8_t)(*((volatile uint8_t*)((uint64_t)sc->bar[BAR0].base_addr 
+ offset)));
+   PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%02x", offset, val);
+
+   return (val);
+}
+
+uint16_t
+bnx2x_reg_read16(struct bnx2x_softc *sc, size_t offset)
+{
+   

[dpdk-dev] [PATCH v5 2/4] bnx2x: driver core

2015-07-20 Thread Stephen Hemminger
This is the first of several parts for a new driver supporting
Broadcom/Qlogic NetXtremeII 10 gigabit devices.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/bnx2x/bnx2x.c| 11821 +
 drivers/net/bnx2x/bnx2x.h|  1998 +++
 drivers/net/bnx2x/bnx2x_ethdev.c |   542 ++
 drivers/net/bnx2x/bnx2x_ethdev.h |79 +
 drivers/net/bnx2x/bnx2x_logs.h   |51 +
 drivers/net/bnx2x/bnx2x_rxtx.c   |   487 ++
 drivers/net/bnx2x/bnx2x_rxtx.h   |85 +
 drivers/net/bnx2x/bnx2x_stats.c  |  1619 +
 drivers/net/bnx2x/bnx2x_stats.h  |   632 ++
 drivers/net/bnx2x/bnx2x_vfpf.c   |   597 ++
 drivers/net/bnx2x/bnx2x_vfpf.h   |   315 +
 11 files changed, 18226 insertions(+)
 create mode 100644 drivers/net/bnx2x/bnx2x.c
 create mode 100644 drivers/net/bnx2x/bnx2x.h
 create mode 100644 drivers/net/bnx2x/bnx2x_ethdev.c
 create mode 100644 drivers/net/bnx2x/bnx2x_ethdev.h
 create mode 100644 drivers/net/bnx2x/bnx2x_logs.h
 create mode 100644 drivers/net/bnx2x/bnx2x_rxtx.c
 create mode 100644 drivers/net/bnx2x/bnx2x_rxtx.h
 create mode 100644 drivers/net/bnx2x/bnx2x_stats.c
 create mode 100644 drivers/net/bnx2x/bnx2x_stats.h
 create mode 100644 drivers/net/bnx2x/bnx2x_vfpf.c
 create mode 100644 drivers/net/bnx2x/bnx2x_vfpf.h

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
new file mode 100644
index 000..8aa9dd5
--- /dev/null
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -0,0 +1,11821 @@
+/*-
+ * Copyright (c) 2007-2013 QLogic Corporation. All rights reserved.
+ *
+ * Eric Davis
+ * David Christensen 
+ * Gary Zambrano 
+ *
+ * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name of Broadcom Corporation nor the name of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written consent.
+ *
+ * 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.
+ */
+
+#define BNX2X_DRIVER_VERSION "1.78.18"
+
+#include "bnx2x.h"
+#include "bnx2x_vfpf.h"
+#include "ecore_sp.h"
+#include "ecore_init.h"
+#include "ecore_init_ops.h"
+
+#include "rte_pci_dev_ids.h"
+
+#include 
+#include 
+#include 
+#include 
+
+static z_stream zlib_stream;
+
+#define EVL_VLID_MASK 0x0FFF
+
+#define BNX2X_DEF_SB_ATT_IDX 0x0001
+#define BNX2X_DEF_SB_IDX 0x0002
+
+/*
+ * FLR Support - bnx2x_pf_flr_clnup() is called during nic_load in the per
+ * function HW initialization.
+ */
+#define FLR_WAIT_USEC 1/* 10 msecs */
+#define FLR_WAIT_INTERVAL 50   /* usecs */
+#define FLR_POLL_CNT  (FLR_WAIT_USEC / FLR_WAIT_INTERVAL)  /* 200 */
+
+struct pbf_pN_buf_regs {
+   int pN;
+   uint32_t init_crd;
+   uint32_t crd;
+   uint32_t crd_freed;
+};
+
+struct pbf_pN_cmd_regs {
+   int pN;
+   uint32_t lines_occup;
+   uint32_t lines_freed;
+};
+
+/* resources needed for unloading a previously loaded device */
+
+#define BNX2X_PREV_WAIT_NEEDED 1
+rte_spinlock_t bnx2x_prev_mtx;
+struct bnx2x_prev_list_node {
+   LIST_ENTRY(bnx2x_prev_list_node) node;
+   uint8_t bus;
+   uint8_t slot;
+   uint8_t path;
+   uint8_t aer;
+   uint8_t undi;
+};
+
+static LIST_HEAD(, bnx2x_prev_list_node) bnx2x_prev_list
+   = LIST_HEAD_INITIALIZER(bnx2x_prev_list);
+
+static int load_count[2][3] = { { 0 } };
+   /* per-path: 0-common, 1-port0, 2-port1 */
+
+static void bnx2x_cmng_fns_init(struct bnx2x_softc *sc, uint8_t read_cfg,
+   uint8_t cmng_type);
+static int bnx2x_get_cmng_fns_mode(struct bnx2x_softc *sc);
+static void storm_memset_cmng(struct bnx2x_softc *sc, struct cmng_init *cmng,
+ uint8_t port);

[dpdk-dev] [PATCH v5 1/4] eal: provide functions to access PCI config

2015-07-20 Thread Stephen Hemminger
Some drivers need ability to access PCI config (for example for power
management). This adds an abstraction to do this for both Linux
and BSD.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_eal/bsdapp/eal/eal_pci.c | 83 +
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  3 +-
 lib/librte_eal/common/include/rte_pci.h | 32 ++
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 50 +++
 lib/librte_eal/linuxapp/eal/eal_pci_init.h  | 11 
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c   | 14 +
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c  | 16 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  3 +-
 8 files changed, 210 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
b/lib/librte_eal/bsdapp/eal/eal_pci.c
index ed31222..61ae429 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -397,6 +397,89 @@ error:
return -1;
 }

+/* Read PCI config space. */
+int rte_eal_pci_read_config(const struct rte_pci_device *dev,
+   void *buf, size_t len, off_t offset)
+{
+   int fd = -1;
+   struct pci_io pi = {
+   .pi_sel = {
+   .pc_domain = dev->addr.domain,
+   .pc_bus = dev->addr.bus,
+   .pc_dev = dev->addr.devid,
+   .pc_func = dev->addr.function,
+   },
+   .pi_reg = offset,
+   .pi_width = len,
+   };
+
+   if (len == 3 || len > sizeof(pi.pi_data)) {
+   RTE_LOG(ERR, EAL, "%s(): invalid pci read length\n", __func__);
+   goto error;
+   }
+
+   fd = open("/dev/pci", O_RDONLY);
+   if (fd < 0) {
+   RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+   goto error;
+   }
+
+   if (ioctl(fd, PCIOCREAD, ) < 0)
+   goto error;
+   close(fd);
+
+   memcpy(buf, _data, len);
+   return 0;
+
+ error:
+   if (fd >= 0)
+   close(fd);
+   return -1;
+}
+
+/* Write PCI config space. */
+int rte_eal_pci_write_config(const struct rte_pci_device *dev,
+const void *buf, size_t len, off_t offset)
+{
+   int fd = -1;
+
+   struct pci_io pi = {
+   .pi_sel = {
+   .pc_domain = dev->addr.domain,
+   .pc_bus = dev->addr.bus,
+   .pc_dev = dev->addr.devid,
+   .pc_func = dev->addr.function,
+   },
+   .pi_reg = offset,
+   .pi_data = *(u_int32_t *)buf,
+   .pi_width = len,
+   };
+
+   if (len == 3 || len > sizeof(pi.pi_data)) {
+   RTE_LOG(ERR, EAL, "%s(): invalid pci read length\n", __func__);
+   goto error;
+   }
+
+   memcpy(pi.pi_data, buf, len);
+
+   fd = open("/dev/pci", O_RDONLY);
+   if (fd < 0) {
+   RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+   goto error;
+   }
+
+   if (ioctl(fd, PCIOCWRITE, ) < 0)
+   goto error;
+
+   close(fd);
+   return 0;
+
+ error:
+   if (fd >= 0)
+   close(fd);
+   return -1;
+}
+
 /* Init the PCI EAL subsystem */
 int
 rte_eal_pci_init(void)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index b2d4441..47323ae 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -117,5 +117,6 @@ DPDK_2.1 {

rte_eal_pci_detach;
rte_memzone_free;
-
+   rte_eal_pci_read_config;
+   rte_eal_pci_write_config;
 } DPDK_2.0;
diff --git a/lib/librte_eal/common/include/rte_pci.h 
b/lib/librte_eal/common/include/rte_pci.h
index e3ca3fc..34cafa6 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -455,6 +455,38 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);
  */
 void rte_eal_pci_unregister(struct rte_pci_driver *driver);

+/**
+ * Read PCI config space.
+ *
+ * @param device
+ *   A pointer to a rte_pci_device structure describing the device
+ *   to use
+ * @param buf
+ *   A data buffer where the bytes should be read into
+ * @param len
+ *   The length of the data buffer.
+ * @param offset
+ *   The offset into PCI config space
+ */
+int rte_eal_pci_read_config(const struct rte_pci_device *device,
+   void *buf, size_t len, off_t offset);
+
+/**
+ * Write PCI config space.
+ *
+ * @param device
+ *   A pointer to a rte_pci_device structure describing the device
+ *   to use
+ * @param buf
+ *   A data buffer containing the bytes should be written
+ * @param len
+ *   The length of the data buffer.
+ * @param offset
+ *   The offset into PCI config space
+ */
+int rte_eal_pci_write_config(const struct rte_pci_device *device,
+ 

[dpdk-dev] [PATCH v5 0/4] bnx2x: poll mode driver

2015-07-20 Thread Stephen Hemminger
Changes in this version (v5):
  - rebase to 2.1.0-rc1
  - fix version map for 2.1
  - fix doxygen comments
  - add BCM57410 ids

Stephen Hemminger (4):
  eal: provide functions to access PCI config
  bnx2x: driver core
  bnx2x: driver support routines
  bnx2x: enable PMD build

 MAINTAINERS | 3 +
 config/common_linuxapp  |10 +
 drivers/net/Makefile| 1 +
 drivers/net/bnx2x/Makefile  |28 +
 drivers/net/bnx2x/bnx2x.c   | 11821 +++
 drivers/net/bnx2x/bnx2x.h   |  1998 
 drivers/net/bnx2x/bnx2x_ethdev.c|   542 +
 drivers/net/bnx2x/bnx2x_ethdev.h|79 +
 drivers/net/bnx2x/bnx2x_logs.h  |51 +
 drivers/net/bnx2x/bnx2x_rxtx.c  |   487 +
 drivers/net/bnx2x/bnx2x_rxtx.h  |85 +
 drivers/net/bnx2x/bnx2x_stats.c |  1619 +++
 drivers/net/bnx2x/bnx2x_stats.h |   632 +
 drivers/net/bnx2x/bnx2x_vfpf.c  |   597 +
 drivers/net/bnx2x/bnx2x_vfpf.h  |   315 +
 drivers/net/bnx2x/debug.c   |   113 +
 drivers/net/bnx2x/ecore_fw_defs.h   |   422 +
 drivers/net/bnx2x/ecore_hsi.h   |  6348 ++
 drivers/net/bnx2x/ecore_init.h  |   841 ++
 drivers/net/bnx2x/ecore_init_ops.h  |   886 ++
 drivers/net/bnx2x/ecore_mfw_req.h   |   206 +
 drivers/net/bnx2x/ecore_reg.h   |  3663 ++
 drivers/net/bnx2x/ecore_sp.c|  5455 +
 drivers/net/bnx2x/ecore_sp.h|  1795 +++
 drivers/net/bnx2x/elink.c   | 13378 ++
 drivers/net/bnx2x/elink.h   |   609 +
 drivers/net/bnx2x/rte_pmd_bnx2x_version.map | 4 +
 lib/librte_eal/bsdapp/eal/eal_pci.c |83 +
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 3 +-
 lib/librte_eal/common/include/rte_pci.h |32 +
 lib/librte_eal/common/include/rte_pci_dev_ids.h |61 +
 lib/librte_eal/linuxapp/eal/eal_pci.c   |50 +
 lib/librte_eal/linuxapp/eal/eal_pci_init.h  |11 +
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c   |14 +
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c  |16 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 +-
 mk/rte.app.mk   | 2 +
 37 files changed, 52261 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/bnx2x/Makefile
 create mode 100644 drivers/net/bnx2x/bnx2x.c
 create mode 100644 drivers/net/bnx2x/bnx2x.h
 create mode 100644 drivers/net/bnx2x/bnx2x_ethdev.c
 create mode 100644 drivers/net/bnx2x/bnx2x_ethdev.h
 create mode 100644 drivers/net/bnx2x/bnx2x_logs.h
 create mode 100644 drivers/net/bnx2x/bnx2x_rxtx.c
 create mode 100644 drivers/net/bnx2x/bnx2x_rxtx.h
 create mode 100644 drivers/net/bnx2x/bnx2x_stats.c
 create mode 100644 drivers/net/bnx2x/bnx2x_stats.h
 create mode 100644 drivers/net/bnx2x/bnx2x_vfpf.c
 create mode 100644 drivers/net/bnx2x/bnx2x_vfpf.h
 create mode 100644 drivers/net/bnx2x/debug.c
 create mode 100644 drivers/net/bnx2x/ecore_fw_defs.h
 create mode 100644 drivers/net/bnx2x/ecore_hsi.h
 create mode 100644 drivers/net/bnx2x/ecore_init.h
 create mode 100644 drivers/net/bnx2x/ecore_init_ops.h
 create mode 100644 drivers/net/bnx2x/ecore_mfw_req.h
 create mode 100644 drivers/net/bnx2x/ecore_reg.h
 create mode 100644 drivers/net/bnx2x/ecore_sp.c
 create mode 100644 drivers/net/bnx2x/ecore_sp.h
 create mode 100644 drivers/net/bnx2x/elink.c
 create mode 100644 drivers/net/bnx2x/elink.h
 create mode 100644 drivers/net/bnx2x/rte_pmd_bnx2x_version.map

-- 
2.1.4



[dpdk-dev] [PATCH] doc/testpmd_app_ug:add a comment for outer-ip option in csum

2015-07-20 Thread Liu, Yong
Acked-by: Marvin Liu 

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Jijiang Liu
> Sent: Friday, July 17, 2015 4:13 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] doc/testpmd_app_ug:add a comment for outer-ip
> option in csum
> 
> Add a comment for outer-ip option in csum command.
> 
> Set outer-ip option only when the packet is a IPv4 packet.
> 
> Signed-off-by: Jijiang Liu 
> ---
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 4652962..c8baa76 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -541,7 +541,7 @@ csum set (ip|udp|tcp|sctp|outer-ip) (hw|sw) (port_id)
> 
>  - ip|udp|tcp|sctp always concern the inner layer.
> 
> -- outer-ip concerns the outer IP layer in case the packet is recognized
> +- outer-ip concerns the outer IP layer(only for IPv4) in case the packet
> is recognized
>as a tunnel packet by the forward engine (vxlan, gre and ipip are
>supported). See "csum parse-tunnel" command.
> 
> --
> 1.7.7.6



[dpdk-dev] [PATCH] virtio: fix the vq size issue

2015-07-20 Thread Stephen Hemminger
On Sat, 18 Jul 2015 12:11:11 +
"Ouyang, Changchun"  wrote:

> Hi Stephen,
> 
> > -Original Message-
> > From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> > Sent: Saturday, July 18, 2015 12:28 AM
> > To: Ouyang, Changchun
> > Cc: dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH] virtio: fix the vq size issue
> > 
> > On Wed,  1 Jul 2015 15:48:50 +0800
> > Ouyang Changchun  wrote:
> > 
> > > This commit breaks virtio basic packets rx functionality:
> > >   d78deadae4dca240e85054bf2d604a801676becc
> > >
> > > The QEMU use 256 as default vring size, also use this default value to
> > > calculate the virtio avail ring base address and used ring base
> > > address, and vhost in the backend use the ring base address to do packet
> > IO.
> > >
> > > Virtio spec also says the queue size in PCI configuration is
> > > read-only, so virtio front end can't change it. just need use the
> > > read-only value to allocate space for vring and calculate the avail
> > > and used ring base address. Otherwise, the avail and used ring base
> > address will be different between host and guest, accordingly, packet IO
> > can't work normally.
> > >
> > > Signed-off-by: Changchun Ouyang 
> > > ---
> > >  drivers/net/virtio/virtio_ethdev.c | 14 +++---
> > >  1 file changed, 3 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/drivers/net/virtio/virtio_ethdev.c
> > > b/drivers/net/virtio/virtio_ethdev.c
> > > index fe5f9a1..d84de13 100644
> > > --- a/drivers/net/virtio/virtio_ethdev.c
> > > +++ b/drivers/net/virtio/virtio_ethdev.c
> > > @@ -263,8 +263,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev
> > *dev,
> > >*/
> > >   vq_size = VIRTIO_READ_REG_2(hw, VIRTIO_PCI_QUEUE_NUM);
> > >   PMD_INIT_LOG(DEBUG, "vq_size: %d nb_desc:%d", vq_size,
> > nb_desc);
> > > - if (nb_desc == 0)
> > > - nb_desc = vq_size;
> > 
> > command queue is setup with nb_desc = 0
> 
> nb_desc is not used in the rest of the function, then why we need such an 
> assignment here?
> Why command queues is setup whit nb_desc = 0?
> Even if it is the case, what the code change break? 
> 
> > 
> > >   if (vq_size == 0) {
> > >   PMD_INIT_LOG(ERR, "%s: virtqueue does not exist",
> > __func__);
> > >   return -EINVAL;
> > > @@ -275,15 +273,9 @@ int virtio_dev_queue_setup(struct rte_eth_dev
> > *dev,
> > >   return -EINVAL;
> > >   }
> > >
> > > - if (nb_desc < vq_size) {
> > > - if (!rte_is_power_of_2(nb_desc)) {
> > > - PMD_INIT_LOG(ERR,
> > > -  "nb_desc(%u) size is not powerof 2",
> > > -  nb_desc);
> > > - return -EINVAL;
> > > - }
> > > - vq_size = nb_desc;
> > > - }
> > > + if (nb_desc != vq_size)
> > > + PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to
> > vq size (%d), fall to vq size",
> > > + nb_desc, vq_size);
> > 
> > Nack. This breaks onn Google Compute Engine the vring size is 16K.
> 
> 
> As I mentioned before, the commit d78deadae4dca240e85054bf2d604a801676becc 
> break the basic functionality of virtio pmd,
> I don't think keeping it broken is good way for us.
> We have to revert it firstly to recover its functionality on qemu!
> Why we need break current functionality to just meet a new thing's 
> requirement?
> 
> > 
> > An application that wants to work on both QEMU and GCE will want to pass a
> > reasonable size and have the negotiation resolve to best value.
> 
> Do you have already a patch to revert the mistaken and support both qemu and 
> gce?
> If you have, then pls send out it, and let's review.
> 
> > 
> > For example, vRouter passes 512 as Rx ring size.
> > On QEMU this gets rounded down to 256 and on GCE only 512 elements are
> > used.
> > 
> > This is what the Linux kernel virtio does.

The part in dev_queue_setup is correct, but there is a different problem
if the user has requested smaller number of descriptors. What happens is that
the receive start process runs the mbuf pool out of space getting more packets
than the application expected. Imagine application expects 512 packets in rx 
ring
but full 16K are allocated.

Working on a fix to the rx initialization logic to take that into account.



[dpdk-dev] CloudNetEngine vSwitch technical preview is available!

2015-07-20 Thread Jun Xiao
We?are?very?excited?to?announce?that?CloudNetEngine?vswitch?is?available?for
technical?preview!

CloudNetEngine?vswitch?perfectly?bridges the?gaps?of?performance,?efficiency?and
full?feature?requirements?which?existing?vswitches?simply?cannot?provide.
CloudNetEngine?vswitch?is?based?on?some?great?open?source?projects?OVS,
DPDK,?NPF,?and?more?importantly?with?our?own?very?unique?proprietary?network
stack?to?support?following?important?features:

-??H/W?and?S/W?TSO?and?CSUM?support?for?both?native?and?overlay?networks.

-??Distributed?stateful?firewall?per?virtual?port?with?powerful?BPF?JIT
???engine.?

-??Patent-pending?approach?for?tunneling?acceleration,?which?achieves?the?best
???VXLAN?performance?in?the?industry.

???Network?traffic?shapping?for?virtual?ports.

???Very?efficient?and?user?friendly?userspace?vswitch?traffic?sniffing.

One?quick?reference?on?performance?data,?on?our?setup?(Xeon?E5-2620?v3?2.40GHz
+?Intel?82599?NICs),?if?we?use?VMs??TCP?traffic?to?drive?to?NIC's?line?rate,
CloudNetEngine?vswitch?can?save?more?than?1.5?logical?core?than?native?kernel
OVS?on?*EACH*?hypervisor!?You?can?imagine?how?amazing?saving?it?would?be?for
your?clouds.?
(Note:?the?TCP?test?is?already?the?best?case?for?native?kernel?OVS,?and?the?
difference?is?much?more?significant?for?small/medium?packet?size?traffic.)
?
We?encourage?you?to?try?it?out?in?your?own?setup,?please?send?evaluation
requests?to?info at cloudnetengine.com.?(Note:?we?only?accept?requests?with
corporate?emails?for?now)

Cheers!
Jun?Xiao
www.cloudnetengine.com


[dpdk-dev] [PATCH] virtio: fix the vq size issue

2015-07-20 Thread Stephen Hemminger
On Mon, 20 Jul 2015 06:18:53 +
"Ouyang, Changchun"  wrote:

> Hi Thomas,
> 
> I think we have 3 options for this issue.
> 1) applying this patch;
> 2) reverting Stephen's original patch;
> 3) new patch to make both QEMU and GCE work.

I am working on #3





[dpdk-dev] [PATCH 0/4] ethdev/eal API fixes

2015-07-20 Thread Neil Horman
On Sun, Jul 19, 2015 at 12:52:13PM +0200, Thomas Monjalon wrote:
> The main change of these patches is to improve naming consistency
> across ethdev and EAL.
> It should be applied shortly to be part of rc1. If some comments arise,
> it can be fixed/improved in rc2.
> 
> Thomas Monjalon (4):
>   doc: rename ABI chapter to deprecation
>   pci: fix detach and uninit naming
>   ethdev: refactor port release
>   ethdev: fix doxygen internal comments
> 
>  MAINTAINERS   |  2 +-
>  doc/guides/rel_notes/{abi.rst => deprecation.rst} | 19 ---
>  doc/guides/rel_notes/index.rst|  2 +-
>  lib/librte_eal/bsdapp/eal/rte_eal_version.map |  2 ++
>  lib/librte_eal/common/eal_common_pci.c| 20 
>  lib/librte_eal/common/include/rte_pci.h   |  6 --
>  lib/librte_eal/linuxapp/eal/rte_eal_version.map   |  2 ++
>  lib/librte_ether/rte_ethdev.c | 11 +--
>  lib/librte_ether/rte_ethdev.h |  9 -
>  9 files changed, 39 insertions(+), 34 deletions(-)
>  rename doc/guides/rel_notes/{abi.rst => deprecation.rst} (51%)
> 
> -- 
> 2.4.2
> 
> 

Series
Acked-by: Neil Horman 



[dpdk-dev] [PATCH] virtio: fix the vq size issue

2015-07-20 Thread Ouyang, Changchun
Hi Thomas,

I think we have 3 options for this issue.
1) applying this patch;
2) reverting Stephen's original patch;
3) new patch to make both QEMU and GCE work.

1) and 2) will make the test case recover quickly from fail.
As for 3) I don't know whether Stephen has such a patch which can work on both 
or not.
I don't have GCE environment on hand and I am not an expert on that yet, my 
current focus is virtio on QEMU,
So at present I have no chance to make a new one to make sure both can work,
But I can help on reviewing if Stephen has a new patch to do that. 

Another thing burst into my thought.
Can we think more about how to setup a mechanism to block those patches which 
causes critical regression issue?
e.g. this case we are talking about. 
Commit d78deadae4dca240e85054bf2d604a801676becc breaks basic functionality of 
virtio PMD on QEMU,
It means DPDK sample like vhost, vxlan can't rx any packet and accordingly it 
can't forward any packet with virtio PMD.
Neither does ovs.

I did review that patch before, but fail to realize it will break the basic 
function of virtio PMD, it is my bad. 
(Can I send the nack to that patch even after it has been merged into dpdk.org?)
After that, we find that in our testing cycle, we spend time in investigating 
that and root the cause, and sent out
the fixing patch on July 1.  Keeping virtio basic functionality broken more 
than 20 days is bad thing for me. 

If we can run a regression automation test with every patch set sent out to 
dpdk.org, and put those patches breaking any test cases
Into failing-list and notify author, reviewer and maintainer, all those things 
should be done before theirs being merged, then it will
prevent from merging the erroneous patch into mainline, and thus reduce most 
reverting patch.

Hi Stephen, and guys in Brocade

Since you nack my patch, then would you pls send out a new patch to fix the 
issue which your previous patch broke ASAP?
I am not sure you validate your patches on GCE or not, but I strongly suggest 
you validate each of them on QEMU before
you send out a formal one to dpdk.org.

Hi Qian,
Thanks very much for raising this critical issue in virtio!

thanks,
Changchun


> -Original Message-
> From: Xu, Qian Q
> Sent: Monday, July 20, 2015 11:41 AM
> To: Stephen Hemminger; Ouyang, Changchun; 'Thomas Monjalon'
> Cc: dev at dpdk.org; Xu, Qian Q
> Subject: RE: [dpdk-dev] [PATCH] virtio: fix the vq size issue
> 
> Hi, Thomas and all
> I saw in the latest rc1 package, the patch is not merged, and it's a critical 
> issue
> from validation view. I'm responsible for testing the dpdk vhost/virtio
> features, and I found using the latest code, dpdk-vhost/dpdk-virtio can't
> RX/TX package, then my 50% tests are failed while in DPDK2.0 they can pass.
> As you know, it's the basic functions for dpdk virtio to RX/TX, if it's not 
> fixed, I
> think we can't release the R2.1 package. Please help merge the patch, thx.
> 
> 
> 
> Thanks
> Qian
> 
> 
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Saturday, July 18, 2015 12:28 AM
> To: Ouyang, Changchun
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] virtio: fix the vq size issue
> 
> On Wed,  1 Jul 2015 15:48:50 +0800
> Ouyang Changchun  wrote:
> 
> > This commit breaks virtio basic packets rx functionality:
> >   d78deadae4dca240e85054bf2d604a801676becc
> >
> > The QEMU use 256 as default vring size, also use this default value to
> > calculate the virtio avail ring base address and used ring base
> > address, and vhost in the backend use the ring base address to do packet
> IO.
> >
> > Virtio spec also says the queue size in PCI configuration is
> > read-only, so virtio front end can't change it. just need use the
> > read-only value to allocate space for vring and calculate the avail
> > and used ring base address. Otherwise, the avail and used ring base
> address will be different between host and guest, accordingly, packet IO
> can't work normally.
> >
> > Signed-off-by: Changchun Ouyang 
> > ---
> >  drivers/net/virtio/virtio_ethdev.c | 14 +++---
> >  1 file changed, 3 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/net/virtio/virtio_ethdev.c
> > b/drivers/net/virtio/virtio_ethdev.c
> > index fe5f9a1..d84de13 100644
> > --- a/drivers/net/virtio/virtio_ethdev.c
> > +++ b/drivers/net/virtio/virtio_ethdev.c
> > @@ -263,8 +263,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev
> *dev,
> >  */
> > vq_size = VIRTIO_READ_REG_2(hw, VIRTIO_PCI_QUEUE_NUM);
> > PMD_INIT_LOG(DEBUG, "vq_size: %d nb_desc:%d", vq_size,
> nb_desc);
> > -   if (nb_desc == 0)
> > -   nb_desc = vq_size;
> 
> command queue is setup with nb_desc = 0
> 
> > if (vq_size == 0) {
> > PMD_INIT_LOG(ERR, "%s: virtqueue does not exist",
> __func__);
> > return -EINVAL;
> > @@ -275,15 +273,9 @@ int virtio_dev_queue_setup(struct rte_eth_dev
> *dev,
> > return -EINVAL;
> 

[dpdk-dev] [dpdk-announce] release candidate 2.1.0-rc1

2015-07-20 Thread Thomas Monjalon
A new DPDK release candidate is ready for testing:
http://dpdk.org/browse/dpdk/tag/?id=v2.1.0-rc1

This is the first release candidate for DPDK 2.1.
It means we are entering in the RC testing phase.
Only fixes and cleanups will be accepted.

Changelog (main enhancements since 2.0.0)
* memory size without hugepage
* indirect mbuf cloning
* packet type
* memzone freeing
* IEEE1588 timestamping
* multicast filtering
* flow director extension
* hash key size
* hotplug in BSD
* e1000 hotplug
* igb dump
* ixgbe base update
* ixgbe hotplug
* ixgbe LRO
* ixgbe dump
* i40e base update
* i40e hotplug
* i40e port mirroring
* i40e QinQ
* fm10k hotplug
* fm10k promiscuous
* fm10k mac vlan filtering
* mlx4 update
* cxgbe driver
* vmxnet3 vlan filtering
* virtio hotplug
* vhost migration
* pcap jumbo
* TILE-Gx architecture
* HTM lock elision for x86
* jhash update
* toeplitz hash
* cuckoo hash
* KNI optimization
* KNI multicast
* packet framework enhancements
* cmdline polling mode
* VXLAN example

You are welcome to review pending patches from other developers
in http://dpdk.org/dev/patchwork and send your comments:
http://dpdk.org/dev#review

There were a lot of interesting dicussions during this release cycle which led
to create and improve the guidelines document. The drawback is that several
important design choices were done late. That's why the deadline for feature
acceptance (i.e. rc1) was extended.
The goal is now to make the release 2.1.0 available on August 12, with a new
release candidate each week. Hope the -rc4 will be the last one.

Please test this release candidate with your hardware and your preferred apps.
Thank you everyone for making each version better!


[dpdk-dev] [PATCH] virtio: fix the vq size issue

2015-07-20 Thread Xu, Qian Q
Hi, Thomas and all
I saw in the latest rc1 package, the patch is not merged, and it's a critical 
issue from validation view. I'm responsible for testing the dpdk vhost/virtio 
features, and I found using the latest code, dpdk-vhost/dpdk-virtio can't RX/TX 
package, then my 50% tests are failed while in DPDK2.0 they can pass. As you 
know, it's the basic functions for dpdk virtio to RX/TX, if it's not fixed, I 
think we can't release the R2.1 package. Please help merge the patch, thx. 



Thanks
Qian


-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Stephen Hemminger
Sent: Saturday, July 18, 2015 12:28 AM
To: Ouyang, Changchun
Cc: dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH] virtio: fix the vq size issue

On Wed,  1 Jul 2015 15:48:50 +0800
Ouyang Changchun  wrote:

> This commit breaks virtio basic packets rx functionality:
>   d78deadae4dca240e85054bf2d604a801676becc
> 
> The QEMU use 256 as default vring size, also use this default value to 
> calculate the virtio avail ring base address and used ring base 
> address, and vhost in the backend use the ring base address to do packet IO.
> 
> Virtio spec also says the queue size in PCI configuration is 
> read-only, so virtio front end can't change it. just need use the 
> read-only value to allocate space for vring and calculate the avail 
> and used ring base address. Otherwise, the avail and used ring base address 
> will be different between host and guest, accordingly, packet IO can't work 
> normally.
> 
> Signed-off-by: Changchun Ouyang 
> ---
>  drivers/net/virtio/virtio_ethdev.c | 14 +++---
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c 
> b/drivers/net/virtio/virtio_ethdev.c
> index fe5f9a1..d84de13 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -263,8 +263,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
>*/
>   vq_size = VIRTIO_READ_REG_2(hw, VIRTIO_PCI_QUEUE_NUM);
>   PMD_INIT_LOG(DEBUG, "vq_size: %d nb_desc:%d", vq_size, nb_desc);
> - if (nb_desc == 0)
> - nb_desc = vq_size;

command queue is setup with nb_desc = 0

>   if (vq_size == 0) {
>   PMD_INIT_LOG(ERR, "%s: virtqueue does not exist", __func__);
>   return -EINVAL;
> @@ -275,15 +273,9 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
>   return -EINVAL;
>   }
>  
> - if (nb_desc < vq_size) {
> - if (!rte_is_power_of_2(nb_desc)) {
> - PMD_INIT_LOG(ERR,
> -  "nb_desc(%u) size is not powerof 2",
> -  nb_desc);
> - return -EINVAL;
> - }
> - vq_size = nb_desc;
> - }
> + if (nb_desc != vq_size)
> + PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to vq size 
> (%d), fall to vq size",
> + nb_desc, vq_size);

Nack. This breaks onn Google Compute Engine the vring size is 16K.

An application that wants to work on both QEMU and GCE will want to pass a 
reasonable size and have the negotiation resolve to best value.

For example, vRouter passes 512 as Rx ring size.
On QEMU this gets rounded down to 256 and on GCE only 512 elements are used.

This is what the Linux kernel virtio does.



[dpdk-dev] jumbo frame support for 82583V

2015-07-20 Thread Lu, Wenzhuo
Hi Klaus,

> -Original Message-
> From: Klaus Degner [mailto:kd at allegro-packets.com]
> Sent: Friday, July 17, 2015 7:56 PM
> To: Lu, Wenzhuo
> Cc: dev at dpdk.org
> Subject: jumbo frame support for 82583V
> 
> Hi Wenzhuo,
> 
> We are testing different Intel NICs for DPDK. We have tested the master branch
> with the support for 82583V Intel chip.
> It works very well except that we can only use up to 1518 bytes for maximum
> packet capture.
> We have debugged this and it is restricted in the initialization:
> 
> http://dpdk.org/browse/dpdk/tree/drivers/net/e1000/em_ethdev.c#n855
> 
> Without DPDK, the linux driver support and mtu up to 9k and ark.intel reports
> that this chip is jumbo frame capable:
> 
> http://ark.intel.com/de/products/41676/Intel-82583V-Gigabit-Ethernet-
> Controller
> 
> Is there any specific reason why DPDK cannot use jumbo frames for this NIC ?
> 
> Thanks for help !
> 
> Klaus
Sorry, I'm not sure about the history.
According to the datasheet's update log, 82583v doesn't support jumbo frame at 
first.
I think the reason is the e1000 code is not updated after the datasheet said 
the jumbo frame is supported.
As I don?t have the NIC on hand, would you like to change the code and have a 
try. I mean just let
" case e1000_82583" return 9K. Thanks.


[dpdk-dev] [PATCH] prefetch second cacheline of mbufs on alloc

2015-07-20 Thread Thomas Monjalon
Please Olivier,
What is the status of this patch?

2015-05-12 01:15, Paul Emmerich:
> this improves the throughput of a simple tx-only application by 11% in
> the full-featured ixgbe tx path and by 14% in the simple tx path.
> ---
>  lib/librte_mbuf/rte_mbuf.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index ab6de67..f6895b4 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -538,6 +538,7 @@ static inline struct rte_mbuf 
> *__rte_mbuf_raw_alloc(struct rte_mempool *mp)
>   if (rte_mempool_get(mp, ) < 0)
>   return NULL;
>   m = (struct rte_mbuf *)mb;
> + rte_prefetch0(>cacheline1);
>   RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);
>   rte_mbuf_refcnt_set(m, 1);
>   return (m);
> 




[dpdk-dev] [PATCH] eal devargs: don't call rte_log when not initialized

2015-07-20 Thread Thomas Monjalon
> > This problem was discovered when passing invalid PCI id to the
> > blacklist API in devargs.
> > 
> > Any failures in rte_devargs_add would cause a core dump because
> > it would call rte_log() before the the EAL log environment was
> > initailized.  Rather than try and log just remove the messages
> > and leave it up to the caller to check the return value.
> > 
> > Most of the other failure possibilities are when malloc() fails, and if
> > that happens any logging that used malloc() would also fail.
> > 
> > This failure was not caught by the standalone tests to devargs
> > because the tests are run after calling rte_eal_init (which is not
> > how devargs is intended to be used).
> > 
> > Signed-off-by: Stephen Hemminger 
> 
> Acked-by: Olivier Matz 

Applied, thanks


[dpdk-dev] [PATCH] eal: reduce/change log severity levels

2015-07-20 Thread Thomas Monjalon
> Change the log level of startup messages. Anything that is
> just normal activity (like getting virtual areas) is changed
> to debug level. Anything that is a failure should be NOTICE
> or ERR severity.
> 
> Signed-off-by: Stephen Hemminger 

Applied, thanks


[dpdk-dev] [PATCH 0/2] Trivial bonding patches

2015-07-20 Thread Thomas Monjalon
> These are a couple things found while doing code inspection for
> some other bonding related issues.
> 
> Stephen Hemminger (2):
>   ethdev: make rte_eth_dev_is_valid_port public
>   bonding: fix name and port validation

Applied, thanks


[dpdk-dev] igb PMD should set the default tx wthresh correctly.

2015-07-20 Thread Lu, Wenzhuo
Hi,

> -Original Message-
> From: Wiles, Keith
> Sent: Friday, July 17, 2015 7:06 PM
> To: Thomas Monjalon; Stephen Hemminger; Lu, Wenzhuo
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] igb PMD should set the default tx wthresh correctly.
> 
> 
> 
> On 7/17/15, 9:15 AM, "dev on behalf of Thomas Monjalon"
>  wrote:
> 
> >2015-07-16 19:49, Stephen Hemminger:
> >> On Fri, 17 Jul 2015 00:52:09 +
> >> "Lu, Wenzhuo"  wrote:
> >>
> >> > Hi Stephen,
> >> > I don't think there's a conflict. The message just reminder us that
> >>we can adjust the values to achieve better performance.
> >> > I saw ixgbe and i40e also use 0 as the same default value. To my
> >>opinion, it's good to keep the same behavior.
> >> > Thanks.
> >>
> >> In my opnion, no application should have to make special case setup
> >>for each device type. Having to have a table that lists all the
> >>parameters  for each device name is not supportable or scaleable.
> >>
> >> The DPDK started out as "lets do benchmarks fast" but as a production
> >> toolkit it needs to stop having this kind of thing.
> >>
> >> The message shows up to the end-user, who thinks it is a driver bug.
> >> The "us" is now real customers not DPDK developers.
> >
> >+1 to have better default values and less scary messages.
> +1 I agree we should have default values. The scary message is for
> debugging only in the best of cases and just wrong for the normal case.
After checking the code,  igb and ixgbe/i40e's behavior is different for  
tx_rs_thresh
and tx wthresh, so now I think it's no necessary to let them have the same 
default value.
Agree that we shall remove the message or set an appropriate value for tx 
wthresh.
> >



[dpdk-dev] [PATCHv2 1/5] ethdev: add new API to retrieve RX/TX queue information

2015-07-20 Thread Thomas Monjalon
2015-06-18 14:18, Konstantin Ananyev:
> new functions:
> rte_eth_rx_queue_info_get
> rte_eth_tx_queue_info_get
> 
> into rte_etdev API.
[...]
>  lib/librte_ether/rte_ethdev.c | 54 ++
>  lib/librte_ether/rte_ethdev.h | 77 
> ++-
>  2 files changed, 130 insertions(+), 1 deletion(-)
[...]
>  int
> +rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> + struct rte_eth_rxq_info *qinfo)
> +{
[...]
> +int
> +rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> + struct rte_eth_txq_info *qinfo)
> +{

These new functions are not declared in the .map file.

config.o: In function `rx_queue_infos_display':
config.c:(.text+0x11e): undefined reference to `rte_eth_rx_queue_info_get'
config.o: In function `tx_queue_infos_display':
config.c:(.text+0x2be): undefined reference to `rte_eth_tx_queue_info_get'



[dpdk-dev] [PATCH] eal: handle signal on eventfd

2015-07-20 Thread Thomas Monjalon
2015-07-15 10:16, Stephen Hemminger:
> The read for events in the interrupt thread may get interrupted
> by signals from application. Avoid generating stray log message.
> 
> Signed-off-by: Stephen Hemminger 

Applied, thanks


[dpdk-dev] [PATCH v14 06/13] eal/linux: standalone intr event fd create support

2015-07-20 Thread Thomas Monjalon
2015-07-20 01:35, Thomas Monjalon:
> 2015-07-17 14:16, Cunming Liang:
> > +#ifdef RTE_NEXT_ABI
> > +extern int
> > +rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd);
> > +#else
> > +static inline int
> > +rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
> > +{
> > +   RTE_SET_USED(intr_handle);
> > +   RTE_SET_USED(nb_efd);
> > +   return 0;
> > +}
> > +#endif
> [...]
> > +#ifdef RTE_NEXT_ABI
> > +extern void
> > +rte_intr_efd_disable(struct rte_intr_handle *intr_handle);
> > +#else
> > +static inline void
> > +rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
> > +{
> > +   RTE_SET_USED(intr_handle);
> > +}
> > +#endif
> [...]
> > +#ifdef RTE_NEXT_ABI
> > +static inline int
> > +rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
> > +{
> > +   return !(!intr_handle->nb_efd);
> > +}
> > +#else
> > +static inline int
> > +rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
> > +{
> > +   RTE_SET_USED(intr_handle);
> > +   return 0;
> > +}
> > +#endif
> [...]
> > +#ifdef RTE_NEXT_ABI
> > +static inline int
> > +rte_intr_allow_others(struct rte_intr_handle *intr_handle)
> > +{
> > +   return !!(intr_handle->max_intr - intr_handle->nb_efd);
> > +}
> > +#else
> > +static inline int
> > +rte_intr_allow_others(struct rte_intr_handle *intr_handle)
> > +{
> > +   RTE_SET_USED(intr_handle);
> > +   return 1;
> > +}
> > +#endif
> 
> Why these #else cases?

Why not totally removing these ifdef in the header and use them in .c?

> > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > @@ -117,6 +117,10 @@ DPDK_2.1 {
> >  
> > rte_epoll_ctl;
> > rte_epoll_wait;
> > +   rte_intr_allow_others;
> > +   rte_intr_dp_is_en;
> > +   rte_intr_efd_enable;
> > +   rte_intr_efd_disable;
> 
> If RTE_NEXT_ABI is disabled, these symbols do not exist.
> An alternate .map would be needed.




[dpdk-dev] [PATCH v14 06/13] eal/linux: standalone intr event fd create support

2015-07-20 Thread Thomas Monjalon
2015-07-17 14:16, Cunming Liang:
> +#ifdef RTE_NEXT_ABI
> +extern int
> +rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd);
> +#else
> +static inline int
> +rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
> +{
> + RTE_SET_USED(intr_handle);
> + RTE_SET_USED(nb_efd);
> + return 0;
> +}
> +#endif
[...]
> +#ifdef RTE_NEXT_ABI
> +extern void
> +rte_intr_efd_disable(struct rte_intr_handle *intr_handle);
> +#else
> +static inline void
> +rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
> +{
> + RTE_SET_USED(intr_handle);
> +}
> +#endif
[...]
> +#ifdef RTE_NEXT_ABI
> +static inline int
> +rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
> +{
> + return !(!intr_handle->nb_efd);
> +}
> +#else
> +static inline int
> +rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
> +{
> + RTE_SET_USED(intr_handle);
> + return 0;
> +}
> +#endif
[...]
> +#ifdef RTE_NEXT_ABI
> +static inline int
> +rte_intr_allow_others(struct rte_intr_handle *intr_handle)
> +{
> + return !!(intr_handle->max_intr - intr_handle->nb_efd);
> +}
> +#else
> +static inline int
> +rte_intr_allow_others(struct rte_intr_handle *intr_handle)
> +{
> + RTE_SET_USED(intr_handle);
> + return 1;
> +}
> +#endif

Why these #else cases?

> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -117,6 +117,10 @@ DPDK_2.1 {
>  
>   rte_epoll_ctl;
>   rte_epoll_wait;
> + rte_intr_allow_others;
> + rte_intr_dp_is_en;
> + rte_intr_efd_enable;
> + rte_intr_efd_disable;

If RTE_NEXT_ABI is disabled, these symbols do not exist.
An alternate .map would be needed.


[dpdk-dev] [PATCH v14 01/13] eal/linux: add interrupt vectors support in intr_handle

2015-07-20 Thread Thomas Monjalon
2015-07-17 14:16, Cunming Liang:
> +#ifdef RTE_NEXT_ABI
> + /**
> +  * RTE_NEXT_ABI will be removed from v2.2.
> +  * It's only used to avoid ABI(unannounced) broken in v2.1.
> +  * Make sure being aware of the impact before turning on the feature.
> +  */

We are not going to put this comment each time NEXT_ABI is used with ifdef.


[dpdk-dev] [PATCH 1/3] nic_uio: Fix to allow any device to be bound to nic_uio

2015-07-20 Thread Thomas Monjalon
2015-07-17 23:50, Rahul Lakkireddy:
> nic_uio requires the pci ids to be present in rte_pci_dev_ids.h in order to
> bind the devices to nic_uio.  However, it's better to remove this whitelist of
> pci ids, and instead rely on hw.nic_uio.bdfs kenv parameter to allow binding
> any device to nic_uio.
[...]
> - for (i = 0; i < NUM_DEVICES; i++)
> - if (pci_get_vendor(dev) == devices[i].vend &&
> - pci_get_device(dev) == devices[i].dev) {
> -
> + for (i = 0; i < num_detached; i++)
> + if (pci_get_vendor(dev) == pci_get_vendor(detached_devices[i]) 
> &&
> + pci_get_device(dev) == pci_get_device(detached_devices[i])) 
> {
>   device_set_desc(dev, "Intel(R) DPDK PCI Device");

This is an old name. You can now rename "Intel(R) DPDK" to "DPDK".


[dpdk-dev] [PATCH v3] i40e: Fix the endian issue for the i40e read registers functions

2015-07-20 Thread Thomas Monjalon
There was no explanation.
The changed title should be more explicit:
"i40e: fix registers access from big endian CPU"

> > Signed-off-by: Zhe Tao 
> Acked-by: Chao Zhu 

Applied, thanks


[dpdk-dev] [PATCH] i40e: fix the VF rss issue when nb_rx_queue is less than nb_tx_queue

2015-07-20 Thread Thomas Monjalon
> > I40e VF driver uses the num_queue_pairs in vf structure to construct queue
> > index look up table. When the nb_rx_queue is less than nb_tx_queue,
> > num_queue_pairs is equal to nb_tx_queue. It will make the table use invalid
> > queue index, then application cannot poll packets on these queues.
> > 
> > This patch also moves the inline function i40e_align_floor from 
> > i40e_ethdev.c to
> > i40e_ethdev.h.
> > 
> > Signed-off-by: jingjing.wu 
> Acked-by: Helin Zhang 

Applied, thanks


[dpdk-dev] [PATCH 0/3] fix the issue sctp flow cannot be matched in FVL FDIR

2015-07-20 Thread Thomas Monjalon
> > This patch set fixes the issue SCTP flow cannot be matched by FVL's flow
> > director. The issue's root cause is that due to the NIC's firmware update,
> > the input set of sctp flow are changed to source IP, destination IP,
> > source port, destination port and Verification-Tag, which are source IP,
> > destination IP and Verification-Tag previously.
> > And because this fix will affect the struct rte_eth_fdir_flow, use
> > RTE_NEXT_ABI to avoid ABI breaking.
> > 
> > Jingjing Wu (3):
> >   ethdev: change the input set of sctp flow
> >   i40e: make sport and dport of sctp flow involved in match
> >   testpmd: add sport and dport configuration for sctp flow
> 
> Tested-by: Marvin Liu 

Applied, thanks

An ABI deprecation announce must be sent.


[dpdk-dev] Wireless NICs are supported?

2015-07-20 Thread Matthew Hall
Not sure for Mr. Kim, but for me, performance is actually not my main 
inspiration to use DPDK. I began using it in about 2011 when I got a training 
on it from the 6WIND guys before it became open source. What impressed me most 
was how much simpler it was to troubleshoot, debug, maintain, and add new 
features.

All I am saying is some of us would love to be able to develop 802.11N code 
without all of the s/features/bugs/g of the Linux, BSD, etc. kernels being 
involved... ;)

Just another thought,

Matthew.

On Jul 18, 2015, at 8:03 AM, Choi, Sy Jong  wrote:

> Hi Mr.Kim,
> 
> We don't have wireless nic supported, since DPDK is design for high speed 
> dataplane, at this moment there are not wireless NIC support.
> 
> May I know what is the performance are you looking at to achieve?
> 
> Regards,
> Choi, Sy Jong
> Platform Application Engineer
> 
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Woojoong Kim
> Sent: Saturday, July 18, 2015 11:29 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] Wireless NICs are supported?
> 
> Dear All.
> 
> Few months ago, I found DPDK in order to expand my research and 
> implementation ability.
> 
> However, all of DPDK documents did not mentioned about applications based on 
> wireless NICs.
> 
> Does DPDK supports for wireless NICs?
> 
> If it doesn't, does have any try for wirelss NICs?
> 
> Best Regards,
> Woojoong Kim.
> 
> 
> --
> Ph.D Student Woojoong Kim
> Pohang University of Science and Technology(POSTECH) Department of Computer 
> Science and Engineering Mobile Network(MoNet) Laboratory POSTECH Information 
> Research Laboratories(PIRL) #322.
> Phone : 010-4736-1947(+8210-4736-1947)



[dpdk-dev] [PATCH v3 2/2] librte_ether: release queue array memory in close function

2015-07-20 Thread Thomas Monjalon
2015-07-13 14:04, Bernard Iremonger:
> Signed-off-by: Bernard Iremonger 

Applied without the first patch which seems useless.


[dpdk-dev] [PATCH 0/4] ethdev/eal API fixes

2015-07-20 Thread Thomas Monjalon
2015-07-19 12:52, Thomas Monjalon:
> The main change of these patches is to improve naming consistency
> across ethdev and EAL.
> It should be applied shortly to be part of rc1. If some comments arise,
> it can be fixed/improved in rc2.
> 
> Thomas Monjalon (4):
>   doc: rename ABI chapter to deprecation
>   pci: fix detach and uninit naming
>   ethdev: refactor port release
>   ethdev: fix doxygen internal comments

Applied, do not hesitate to comment if something must be fixed.