[dpdk-dev] [PATCH v2 1/2] ethdev: add buffered tx api

2016-03-08 Thread Thomas Monjalon
Hi,

It is an overlay on the tx burst API.
Probably it doesn't hurt to add it but we have to be really cautious
with the API definition to try keeping it stable in the future.

2016-02-24 18:08, Tomasz Kulasek:
> +/**
> + * Structure used to buffer packets for future TX
> + * Used by APIs rte_eth_tx_buffer and rte_eth_tx_buffer_flush
> + */
> +struct rte_eth_dev_tx_buffer {
> + unsigned nb_pkts;

What about "length"?
Why is it unsigned and the size is uint16_t?

> + uint64_t errors;
> + /**< Total number of queue packets to sent that are dropped. */

The errors are passed as userdata to the default callback.
If we really want to have this kind of counter, we can define our
own callback. So why defining this field as standard?
I would like to keep it as simple as possible.

> + buffer_tx_error_fn cbfn;

Why not simply "callback" as name?

> + void *userdata;
> + uint16_t size;   /**< Size of buffer for buffered tx */
> + struct rte_mbuf *pkts[];
> +};

What is the benefit of exposing this structure in the API,
except that it is used in some inline functions?

> +static inline uint16_t
> +rte_eth_tx_buffer_flush(uint8_t port_id, uint16_t queue_id,
> + struct rte_eth_dev_tx_buffer *buffer)
> +{
> + uint16_t sent;
> +
> + uint16_t to_send = buffer->nb_pkts;
> +
> + if (to_send == 0)
> + return 0;

Why this check is done in the lib?
What is the performance gain if we are idle?
It can be done outside if needed.

> + sent = rte_eth_tx_burst(port_id, queue_id, buffer->pkts, to_send);
> +
> + buffer->nb_pkts = 0;
> +
> + /* All packets sent, or to be dealt with by callback below */
> + if (unlikely(sent != to_send))
> + buffer->cbfn(>pkts[sent], to_send - sent,
> + buffer->userdata);
> +
> + return sent;
> +}
[...]
> +/**
> + * Callback function for tracking unsent buffered packets.
> + *
> + * This function can be passed to rte_eth_tx_buffer_set_err_callback() to
> + * adjust the default behaviour when buffered packets cannot be sent. This
> + * function drops any unsent packets, but also updates a user-supplied 
> counter
> + * to track the overall number of packets dropped. The counter should be an
> + * uint64_t variable.
> + *
> + * NOTE: this function should not be called directly, instead it should be 
> used
> + *   as a callback for packet buffering.
> + *
> + * NOTE: when configuring this function as a callback with
> + *   rte_eth_tx_buffer_set_err_callback(), the final, userdata parameter
> + *   should point to an uint64_t value.

Please forget this idea of counter in the default callback.

[...]
> +void
> +rte_eth_count_unsent_packet_callback(struct rte_mbuf **pkts, uint16_t unsent,
> + void *userdata);

What about rte_eth_tx_buffer_default_callback as name?



[dpdk-dev] [PATCH v5 6/6] virtio: return 1 to tell the upper layer we don't take over this device

2016-03-08 Thread Huawei Xie
virtio PMD could use IO port to configure the virtio device without
using UIO/VFIO driver in legacy mode.

There are two issues with previous implementation:
1) virtio PMD will take over the virtio device(s) blindly even if not
intended for DPDK.
2) driver conflict between virtio PMD and virtio-net kernel driver.

This patch checks if there is kernel driver other than UIO/VFIO managing
the virtio device before using port IO.

If legacy_virtio_resource_init fails and kernel driver other than
VFIO/UIO is managing the device ,return 1 to tell the upper layer we
don't take over this device.
For all other IO port mapping errors, return -1.

Note than if VFIO/UIO fails, now we don't fall back to port IO.

Fixes: da978dfdc43b ("virtio: use port IO to get PCI resource")

Signed-off-by: Huawei Xie 
Acked-by: Yuanhan Liu 
Acked-by: David Marchand 
---
 drivers/net/virtio/virtio_ethdev.c |  6 --
 drivers/net/virtio/virtio_pci.c| 16 +++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index caa970c..06bddd7 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1015,6 +1015,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
struct virtio_net_config *config;
struct virtio_net_config local_config;
struct rte_pci_device *pci_dev;
+   int ret;

RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr));

@@ -1037,8 +1038,9 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)

pci_dev = eth_dev->pci_dev;

-   if (vtpci_init(pci_dev, hw) < 0)
-   return -1;
+   ret = vtpci_init(pci_dev, hw);
+   if (ret)
+   return ret;

/* Reset the device although not necessary at startup */
vtpci_reset(hw);
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 85fbe88..98fc370 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -622,6 +622,13 @@ next:
return 0;
 }

+/*
+ * Return -1:
+ *   if there is error mapping with VFIO/UIO.
+ *   if port map error when driver type is KDRV_NONE.
+ * Return 1 if kernel driver is managing the device.
+ * Return 0 on success.
+ */
 int
 vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
 {
@@ -641,8 +648,15 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw 
*hw)
}

PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
-   if (legacy_virtio_resource_init(dev, hw) < 0)
+   if (legacy_virtio_resource_init(dev, hw) < 0) {
+   if (dev->kdrv == RTE_KDRV_UNKNOWN &&
+   dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) {
+   PMD_INIT_LOG(INFO,
+   "skip kernel managed virtio device.");
+   return 1;
+   }
return -1;
+   }

hw->vtpci_ops = _ops;
hw->use_msix = legacy_virtio_has_msix(>addr);
-- 
1.8.1.4



[dpdk-dev] [PATCH v5 5/6] eal: map IO port when kernel driver isn't managing the device

2016-03-08 Thread Huawei Xie
call rte_eal_pci_ioport_map (on x86) only if the pci device is not bound
to a kernel driver.

Signed-off-by: Huawei Xie 
Acked-by: Yuanhan Liu 
Acked-by: David Marchand 
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c 
b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 4ede4cb..833529f 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -698,11 +698,13 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int 
bar,
case RTE_KDRV_UIO_GENERIC:
ret = pci_uio_ioport_map(dev, bar, p);
break;
-   default:
+   case RTE_KDRV_NONE:
 #if defined(RTE_ARCH_X86)
ret = pci_ioport_map(dev, bar, p);
 #endif
break;
+   default:
+   break;
}

if (!ret)
-- 
1.8.1.4



[dpdk-dev] [PATCH v5 4/6] eal: simple code rework

2016-03-08 Thread Huawei Xie

Signed-off-by: Huawei Xie 
Acked-by: Yuanhan Liu 
Acked-by: David Marchand 
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c 
b/lib/librte_eal/linuxapp/eal/eal_pci.c
index dc0aa37..4ede4cb 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -685,12 +685,11 @@ int
 rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar,
   struct rte_pci_ioport *p)
 {
-   int ret;
+   int ret = -1;

switch (dev->kdrv) {
 #ifdef VFIO_PRESENT
case RTE_KDRV_VFIO:
-   ret = -1;
if (pci_vfio_is_enabled())
ret = pci_vfio_ioport_map(dev, bar, p);
break;
@@ -701,10 +700,7 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar,
break;
default:
 #if defined(RTE_ARCH_X86)
-   /* special case for x86 ... */
ret = pci_ioport_map(dev, bar, p);
-#else
-   ret = -1;
 #endif
break;
}
-- 
1.8.1.4



[dpdk-dev] [PATCH v5 3/6] eal: use new RTE_ARCH_X86 for x86 arch

2016-03-08 Thread Huawei Xie

Signed-off-by: Huawei Xie 
Acked-by: Yuanhan Liu 
Acked-by: David Marchand 
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c 
b/lib/librte_eal/linuxapp/eal/eal_pci.c
index b44fa32..dc0aa37 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -621,7 +621,7 @@ int rte_eal_pci_write_config(const struct rte_pci_device 
*device,
}
 }

-#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
+#if defined(RTE_ARCH_X86)
 static int
 pci_ioport_map(struct rte_pci_device *dev, int bar __rte_unused,
   struct rte_pci_ioport *p)
@@ -700,7 +700,7 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar,
ret = pci_uio_ioport_map(dev, bar, p);
break;
default:
-#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
+#if defined(RTE_ARCH_X86)
/* special case for x86 ... */
ret = pci_ioport_map(dev, bar, p);
 #else
@@ -730,7 +730,7 @@ rte_eal_pci_ioport_read(struct rte_pci_ioport *p,
pci_uio_ioport_read(p, data, len, offset);
break;
default:
-#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
+#if defined(RTE_ARCH_X86)
/* special case for x86 ... */
pci_uio_ioport_read(p, data, len, offset);
 #endif
@@ -753,7 +753,7 @@ rte_eal_pci_ioport_write(struct rte_pci_ioport *p,
pci_uio_ioport_write(p, data, len, offset);
break;
default:
-#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
+#if defined(RTE_ARCH_X86)
/* special case for x86 ... */
pci_uio_ioport_write(p, data, len, offset);
 #endif
@@ -779,7 +779,7 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
ret = pci_uio_ioport_unmap(p);
break;
default:
-#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
+#if defined(RTE_ARCH_X86)
/* special case for x86 ... nothing to do */
ret = 0;
 #else
-- 
1.8.1.4



[dpdk-dev] [PATCH v5 2/6] eal: RTE_KDRV_NONE means kernel driver isn't managing the device

2016-03-08 Thread Huawei Xie
Use RTE_KDRV_NONE to indicate that kernel driver (other than VFIO/UIO) isn't
managing the device.

Signed-off-by: Huawei Xie 
Acked-by: Yuanhan Liu 
Acked-by: David Marchand 
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c 
b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 4346973..b44fa32 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -362,7 +362,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t 
bus,
else
dev->kdrv = RTE_KDRV_UNKNOWN;
} else
-   dev->kdrv = RTE_KDRV_UNKNOWN;
+   dev->kdrv = RTE_KDRV_NONE;

/* device is valid, add in list (sorted) */
if (TAILQ_EMPTY(_device_list)) {
-- 
1.8.1.4



[dpdk-dev] [PATCH v5 1/6] eal: make the comment more accurate

2016-03-08 Thread Huawei Xie
positive return of devinit of pci driver means the driver doesn't support
this device.

Signed-off-by: Huawei Xie 
Acked-by: Yuanhan Liu 
Acked-by: David Marchand 
---
 lib/librte_eal/common/eal_common_pci.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_pci.c 
b/lib/librte_eal/common/eal_common_pci.c
index 96d5113..797e7e3 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -204,7 +204,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, 
struct rte_pci_device *d
/* call the driver devinit() function */
return dr->devinit(dr, dev);
}
-   /* return positive value if driver is not found */
+   /* return positive value if driver doesn't support this device */
return 1;
 }

@@ -259,7 +259,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
return 0;
}

-   /* return positive value if driver is not found */
+   /* return positive value if driver doesn't support this device */
return 1;
 }

@@ -283,7 +283,7 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
/* negative value is an error */
return -1;
if (rc > 0)
-   /* positive value means driver not found */
+   /* positive value means driver doesn't support it */
continue;
return 0;
}
@@ -310,7 +310,7 @@ pci_detach_all_drivers(struct rte_pci_device *dev)
/* negative value is an error */
return -1;
if (rc > 0)
-   /* positive value means driver not found */
+   /* positive value means driver doesn't support it */
continue;
return 0;
}
-- 
1.8.1.4



[dpdk-dev] [PATCH v5 0/6] fix the issue that DPDK takes over virtio device blindly

2016-03-08 Thread Huawei Xie
v5 changes:
 Split patches
 Remove free of mac addr when vtpci_init fails. Will send the fix in
a seperate patch.
 Fail if the virtio device is whitelisted but bound to kernel driver.

v4 changes:
 Rebase as IO port map is moved to EAL.
 Reword some commit messages.
 Don't fall back to PORT IO if VFIO/UIO fails.

v3 changes:
 Change log message to tell user that the virtio device is skipped
due to it is managed by kernel driver, instead of asking user to unbind
it from kernel driver.

v2 changes:
 Remove unnecessary assignment of NULL to dev->data->mac_addrs
 Ajust one comment's position
 change LOG level from ERR to INFO

Huawei Xie (6):
  eal: make the comment more accurate
  eal: set kdrv to RTE_KDRV_NONE if kernel driver isn't managing the device.
  eal: use new RTE_ARCH_X86 macro for x86 arch
  eal: simple code rework
  eal: map IO port only when kernel driver isn't managing the device
  virtio: return 1 to tell the upper layer we don't take over this device

 drivers/net/virtio/virtio_ethdev.c |  6 --
 drivers/net/virtio/virtio_pci.c| 16 +++-
 lib/librte_eal/common/eal_common_pci.c |  8 
 lib/librte_eal/linuxapp/eal/eal_pci.c  | 22 ++
 4 files changed, 33 insertions(+), 19 deletions(-)

-- 
1.8.1.4



[dpdk-dev] [PATCH 2/2] examples: update to use new rte_lpm_config for ipv4

2016-03-08 Thread Michal Kobylinski
Signed-off-by: Michal Kobylinski 
Acked-by: David Hunt 
---
 examples/ip_fragmentation/main.c|  7 ++-
 examples/ip_reassembly/main.c   |  7 ++-
 examples/l3fwd-power/main.c | 10 --
 examples/l3fwd-vf/main.c| 10 --
 examples/l3fwd/l3fwd_lpm.c  |  9 +++--
 examples/load_balancer/init.c   |  8 ++--
 examples/performance-thread/l3fwd-thread/main.c |  8 ++--
 7 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 0302b2c..8021702 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -721,6 +721,7 @@ init_mem(void)
struct rte_mempool *mp;
struct rte_lpm *lpm;
struct rte_lpm6 *lpm6;
+   struct rte_lpm_config lpm_config;
int socket;
unsigned lcore_id;

@@ -768,7 +769,11 @@ init_mem(void)
RTE_LOG(INFO, IP_FRAG, "Creating LPM table on socket 
%i\n", socket);
snprintf(buf, sizeof(buf), "IP_FRAG_LPM_%i", socket);

-   lpm = rte_lpm_create(buf, socket, LPM_MAX_RULES, 0);
+   lpm_config.max_rules = LPM_MAX_RULES;
+   lpm_config.number_tbl8s = 256;
+   lpm_config.flags = 0;
+
+   lpm = rte_lpm_create(buf, socket, _config);
if (lpm == NULL) {
RTE_LOG(ERR, IP_FRAG, "Cannot create LPM 
table\n");
return -1;
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 6f48748..19ec46c 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -927,6 +927,7 @@ init_mem(void)
char buf[PATH_MAX];
struct rte_lpm *lpm;
struct rte_lpm6 *lpm6;
+   struct rte_lpm_config lpm_config;
int socket;
unsigned lcore_id;

@@ -946,7 +947,11 @@ init_mem(void)
RTE_LOG(INFO, IP_RSMBL, "Creating LPM table on socket 
%i\n", socket);
snprintf(buf, sizeof(buf), "IP_RSMBL_LPM_%i", socket);

-   lpm = rte_lpm_create(buf, socket, LPM_MAX_RULES, 0);
+   lpm_config.max_rules = LPM_MAX_RULES;
+   lpm_config.number_tbl8s = 256;
+   lpm_config.flags = 0;
+
+   lpm = rte_lpm_create(buf, socket, _config);
if (lpm == NULL) {
RTE_LOG(ERR, IP_RSMBL, "Cannot create LPM 
table\n");
return -1;
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index a478583..f8a2f1b 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1430,9 +1430,15 @@ setup_lpm(int socketid)
char s[64];

/* create the LPM table */
+   struct rte_lpm_config lpm_ipv4_config;
+
+   lpm_ipv4_config.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
+   lpm_ipv4_config.number_tbl8s = 256;
+   lpm_ipv4_config.flags = 0;
+
snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid);
-   ipv4_l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid,
-   IPV4_L3FWD_LPM_MAX_RULES, 0);
+   ipv4_l3fwd_lookup_struct[socketid] =
+   rte_lpm_create(s, socketid, _ipv4_config);
if (ipv4_l3fwd_lookup_struct[socketid] == NULL)
rte_exit(EXIT_FAILURE, "Unable to create the l3fwd LPM table"
" on socket %d\n", socketid);
diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c
index 193c3ab..034c22a 100644
--- a/examples/l3fwd-vf/main.c
+++ b/examples/l3fwd-vf/main.c
@@ -869,10 +869,16 @@ setup_lpm(int socketid)
int ret;
char s[64];

+   struct rte_lpm_config lpm_ipv4_config;
+
+   lpm_ipv4_config.max_rules = L3FWD_LPM_MAX_RULES;
+   lpm_ipv4_config.number_tbl8s = 256;
+   lpm_ipv4_config.flags = 0;
+
/* create the LPM table */
snprintf(s, sizeof(s), "L3FWD_LPM_%d", socketid);
-   l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid,
-   L3FWD_LPM_MAX_RULES, 0);
+   l3fwd_lookup_struct[socketid] =
+   rte_lpm_create(s, socketid, _ipv4_config);
if (l3fwd_lookup_struct[socketid] == NULL)
rte_exit(EXIT_FAILURE, "Unable to create the l3fwd LPM table"
" on socket %d\n", socketid);
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index e0ed3c4..a354797 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -98,6 +98,7 @@ static struct ipv6_l3fwd_lpm_route 
ipv6_l3fwd_lpm_route_array[] = {
(sizeof(ipv6_l3fwd_lpm_route_array) / 
sizeof(ipv6_l3fwd_lpm_route_array[0]))

 #define 

[dpdk-dev] [PATCH 1/2] lpm: added a new rte_lpm_config structure for ipv4

2016-03-08 Thread Michal Kobylinski
Signed-off-by: Michal Kobylinski 
Acked-by: David Hunt 
---
 app/test/test_func_reentrancy.c|   9 +-
 app/test/test_lpm.c| 145 +++--
 app/test/test_mp_secondary.c   |   7 +-
 app/test/test_table_combined.c |   2 +
 app/test/test_table_tables.c   |   2 +
 doc/guides/rel_notes/release_16_04.rst |   5 ++
 lib/librte_lpm/rte_lpm.c   |  51 +---
 lib/librte_lpm/rte_lpm.h   |  23 --
 lib/librte_table/rte_table_lpm.c   |  12 ++-
 lib/librte_table/rte_table_lpm.h   |   6 ++
 10 files changed, 215 insertions(+), 47 deletions(-)

diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c
index dbecc52..5d09296 100644
--- a/app/test/test_func_reentrancy.c
+++ b/app/test/test_func_reentrancy.c
@@ -359,6 +359,11 @@ lpm_create_free(__attribute__((unused)) void *arg)
 {
unsigned lcore_self = rte_lcore_id();
struct rte_lpm *lpm;
+   struct rte_lpm_config config;
+
+   config.max_rules = 4;
+   config.number_tbl8s = 256;
+   config.flags = 0;
char lpm_name[MAX_STRING_SIZE];
int i;

@@ -366,7 +371,7 @@ lpm_create_free(__attribute__((unused)) void *arg)

/* create the same lpm simultaneously on all threads */
for (i = 0; i < MAX_ITER_TIMES; i++) {
-   lpm = rte_lpm_create("fr_test_once",  SOCKET_ID_ANY, 4, 0);
+   lpm = rte_lpm_create("fr_test_once",  SOCKET_ID_ANY, );
if ((NULL == lpm) && (rte_lpm_find_existing("fr_test_once") == 
NULL))
return -1;
}
@@ -374,7 +379,7 @@ lpm_create_free(__attribute__((unused)) void *arg)
/* create mutiple fbk tables simultaneously */
for (i = 0; i < MAX_LPM_ITER_TIMES; i++) {
snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", 
lcore_self, i);
-   lpm = rte_lpm_create(lpm_name, SOCKET_ID_ANY, 4, 0);
+   lpm = rte_lpm_create(lpm_name, SOCKET_ID_ANY, );
if (NULL == lpm)
return -1;

diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c
index f367553..aaf95ec 100644
--- a/app/test/test_lpm.c
+++ b/app/test/test_lpm.c
@@ -105,6 +105,7 @@ rte_lpm_test tests[] = {
 #define NUM_LPM_TESTS (sizeof(tests)/sizeof(tests[0]))
 #define MAX_DEPTH 32
 #define MAX_RULES 256
+#define NUMBER_TBL8S 256
 #define PASS 0

 /*
@@ -115,18 +116,25 @@ int32_t
 test0(void)
 {
struct rte_lpm *lpm = NULL;
+   struct rte_lpm_config config;
+
+   config.max_rules = MAX_RULES;
+   config.number_tbl8s = NUMBER_TBL8S;
+   config.flags = 0;

/* rte_lpm_create: lpm name == NULL */
-   lpm = rte_lpm_create(NULL, SOCKET_ID_ANY, MAX_RULES, 0);
+   lpm = rte_lpm_create(NULL, SOCKET_ID_ANY, );
TEST_LPM_ASSERT(lpm == NULL);

/* rte_lpm_create: max_rules = 0 */
/* Note: __func__ inserts the function name, in this case "test0". */
-   lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, 0, 0);
+   config.max_rules = 0;
+   lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, );
TEST_LPM_ASSERT(lpm == NULL);

/* socket_id < -1 is invalid */
-   lpm = rte_lpm_create(__func__, -2, MAX_RULES, 0);
+   config.max_rules = MAX_RULES;
+   lpm = rte_lpm_create(__func__, -2, );
TEST_LPM_ASSERT(lpm == NULL);

return PASS;
@@ -140,11 +148,16 @@ int32_t
 test1(void)
 {
struct rte_lpm *lpm = NULL;
+   struct rte_lpm_config config;
+
+   config.number_tbl8s = NUMBER_TBL8S;
+   config.flags = 0;
int32_t i;

/* rte_lpm_free: Free NULL */
for (i = 0; i < 100; i++) {
-   lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES - i, 0);
+   config.max_rules = MAX_RULES - i;
+   lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, );
TEST_LPM_ASSERT(lpm != NULL);

rte_lpm_free(lpm);
@@ -164,8 +177,13 @@ int32_t
 test2(void)
 {
struct rte_lpm *lpm = NULL;
+   struct rte_lpm_config config;
+
+   config.max_rules = MAX_RULES;
+   config.number_tbl8s = NUMBER_TBL8S;
+   config.flags = 0;

-   lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);
+   lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, );
TEST_LPM_ASSERT(lpm != NULL);

rte_lpm_free(lpm);
@@ -180,6 +198,11 @@ int32_t
 test3(void)
 {
struct rte_lpm *lpm = NULL;
+   struct rte_lpm_config config;
+
+   config.max_rules = MAX_RULES;
+   config.number_tbl8s = NUMBER_TBL8S;
+   config.flags = 0;
uint32_t ip = IPv4(0, 0, 0, 0), next_hop = 100;
uint8_t depth = 24;
int32_t status = 0;
@@ -189,7 +212,7 @@ test3(void)
TEST_LPM_ASSERT(status < 0);

/*Create vaild lpm to use in rest of test. */
-   lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);
+   lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, );
 

[dpdk-dev] [PATCH 0/2] Added a new rte_lpm_config structure for IPv4.

2016-03-08 Thread Michal Kobylinski
A new rte_lpm_config structure is used so LPM library will allocate
exactly the amount of memory which is necessary to hold application?s
rules.

Michal Kobylinski (2):
  lpm: added a new rte_lpm_config structure for ipv4
  examples: update to use new rte_lpm_config structure for ipv4

 app/test/test_func_reentrancy.c |   9 +-
 app/test/test_lpm.c | 145 
 app/test/test_mp_secondary.c|   7 +-
 app/test/test_table_combined.c  |   2 +
 app/test/test_table_tables.c|   2 +
 doc/guides/rel_notes/release_16_04.rst  |   5 +
 examples/ip_fragmentation/main.c|   7 +-
 examples/ip_reassembly/main.c   |   7 +-
 examples/l3fwd-power/main.c |  10 +-
 examples/l3fwd-vf/main.c|  10 +-
 examples/l3fwd/l3fwd_lpm.c  |   9 +-
 examples/load_balancer/init.c   |   8 +-
 examples/performance-thread/l3fwd-thread/main.c |   8 +-
 lib/librte_lpm/rte_lpm.c|  51 ++---
 lib/librte_lpm/rte_lpm.h|  23 +++-
 lib/librte_table/rte_table_lpm.c|  12 +-
 lib/librte_table/rte_table_lpm.h|   6 +
 17 files changed, 262 insertions(+), 59 deletions(-)

-- 
1.9.1



[dpdk-dev] [PATCH 2/2] examples: update to use new lpm lib for ipv4

2016-03-08 Thread Michal Kobylinski
Signed-off-by: Michal Kobylinski 
Acked-by: David Hunt 
---
 examples/ip_fragmentation/main.c| 16 ++--
 examples/ip_reassembly/main.c   | 15 +--
 examples/l3fwd-power/main.c |  2 +-
 examples/l3fwd-vf/main.c|  2 +-
 examples/l3fwd/l3fwd_em_sse.h   |  2 +-
 examples/l3fwd/l3fwd_lpm.h  |  6 ++---
 examples/l3fwd/l3fwd_lpm_sse.h  | 24 ++
 examples/l3fwd/l3fwd_sse.h  |  8 +++---
 examples/load_balancer/runtime.c|  2 +-
 examples/performance-thread/l3fwd-thread/main.c | 33 ++---
 10 files changed, 60 insertions(+), 50 deletions(-)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index fbc0b8d..0302b2c 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -266,8 +266,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct 
lcore_queue_conf *qconf,
uint8_t queueid, uint8_t port_in)
 {
struct rx_queue *rxq;
-   uint32_t i, len;
-   uint8_t next_hop, port_out, ipv6;
+   uint32_t i, len, next_hop_ipv4;
+   uint8_t next_hop_ipv6, port_out, ipv6;
int32_t len2;

ipv6 = 0;
@@ -291,9 +291,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct 
lcore_queue_conf *qconf,
ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr);

/* Find destination port */
-   if (rte_lpm_lookup(rxq->lpm, ip_dst, _hop) == 0 &&
-   (enabled_port_mask & 1 << next_hop) != 0) {
-   port_out = next_hop;
+   if (rte_lpm_lookup(rxq->lpm, ip_dst, _hop_ipv4) == 0 &&
+   (enabled_port_mask & 1 << next_hop_ipv4) != 0) {
+   port_out = next_hop_ipv4;

/* Build transmission burst for new port */
len = qconf->tx_mbufs[port_out].len;
@@ -327,9 +327,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct 
lcore_queue_conf *qconf,
ip_hdr = rte_pktmbuf_mtod(m, struct ipv6_hdr *);

/* Find destination port */
-   if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, _hop) == 
0 &&
-   (enabled_port_mask & 1 << next_hop) != 0) {
-   port_out = next_hop;
+   if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, 
_hop_ipv6) == 0 &&
+   (enabled_port_mask & 1 << next_hop_ipv6) != 0) {
+   port_out = next_hop_ipv6;

/* Build transmission burst for new port */
len = qconf->tx_mbufs[port_out].len;
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 262820e..6f48748 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -347,7 +347,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t 
queue,
struct rte_ip_frag_death_row *dr;
struct rx_queue *rxq;
void *d_addr_bytes;
-   uint8_t next_hop, dst_port;
+   uint32_t next_hop_ipv4;
+   uint8_t next_hop_ipv6, dst_port;

rxq = >rx_queue_list[queue];

@@ -390,9 +391,9 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t 
queue,
ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr);

/* Find destination port */
-   if (rte_lpm_lookup(rxq->lpm, ip_dst, _hop) == 0 &&
-   (enabled_port_mask & 1 << next_hop) != 0) {
-   dst_port = next_hop;
+   if (rte_lpm_lookup(rxq->lpm, ip_dst, _hop_ipv4) == 0 &&
+   (enabled_port_mask & 1 << next_hop_ipv4) != 0) {
+   dst_port = next_hop_ipv4;
}

eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4);
@@ -427,9 +428,9 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t 
queue,
}

/* Find destination port */
-   if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, _hop) == 
0 &&
-   (enabled_port_mask & 1 << next_hop) != 0) {
-   dst_port = next_hop;
+   if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, 
_hop_ipv6) == 0 &&
+   (enabled_port_mask & 1 << next_hop_ipv6) != 0) {
+   dst_port = next_hop_ipv6;
}

eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6);
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 828c18a..a478583 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -631,7 +631,7 @@ static inline uint8_t
 get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint8_t portid,
lookup_struct_t *ipv4_l3fwd_lookup_struct)
 {
-   uint8_t next_hop;
+   uint32_t 

[dpdk-dev] [PATCH v3 1/2] lpm: extended ipv4 next_hop field

2016-03-08 Thread Michal Kobylinski
Signed-off-by: Michal Kobylinski 
Acked-by: David Hunt 
---
 app/test/test_lpm.c|  122 ++--
 doc/guides/rel_notes/release_16_04.rst |5 +-
 lib/librte_lpm/Makefile|2 +-
 lib/librte_lpm/rte_lpm.c   | 1090 +---
 lib/librte_lpm/rte_lpm.h   |  202 --
 lib/librte_lpm/rte_lpm_version.map |   11 +
 lib/librte_table/rte_table_lpm.c   |   15 +-
 7 files changed, 1217 insertions(+), 230 deletions(-)

diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c
index 8b4ded9..f367553 100644
--- a/app/test/test_lpm.c
+++ b/app/test/test_lpm.c
@@ -57,7 +57,7 @@
} \
 } while(0)

-typedef int32_t (* rte_lpm_test)(void);
+typedef int32_t (*rte_lpm_test)(void);

 static int32_t test0(void);
 static int32_t test1(void);
@@ -180,8 +180,8 @@ int32_t
 test3(void)
 {
struct rte_lpm *lpm = NULL;
-   uint32_t ip = IPv4(0, 0, 0, 0);
-   uint8_t depth = 24, next_hop = 100;
+   uint32_t ip = IPv4(0, 0, 0, 0), next_hop = 100;
+   uint8_t depth = 24;
int32_t status = 0;

/* rte_lpm_add: lpm == NULL */
@@ -247,8 +247,7 @@ test5(void)
 {
 #if defined(RTE_LIBRTE_LPM_DEBUG)
struct rte_lpm *lpm = NULL;
-   uint32_t ip = IPv4(0, 0, 0, 0);
-   uint8_t next_hop_return = 0;
+   uint32_t ip = IPv4(0, 0, 0, 0), next_hop_return = 0;
int32_t status = 0;

/* rte_lpm_lookup: lpm == NULL */
@@ -277,8 +276,8 @@ int32_t
 test6(void)
 {
struct rte_lpm *lpm = NULL;
-   uint32_t ip = IPv4(0, 0, 0, 0);
-   uint8_t depth = 24, next_hop_add = 100, next_hop_return = 0;
+   uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0;
+   uint8_t depth = 24;
int32_t status = 0;

lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);
@@ -309,10 +308,10 @@ int32_t
 test7(void)
 {
__m128i ipx4;
-   uint16_t hop[4];
+   uint32_t hop[4];
struct rte_lpm *lpm = NULL;
-   uint32_t ip = IPv4(0, 0, 0, 0);
-   uint8_t depth = 32, next_hop_add = 100, next_hop_return = 0;
+   uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0;
+   uint8_t depth = 32;
int32_t status = 0;

lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);
@@ -325,10 +324,10 @@ test7(void)
TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));

ipx4 = _mm_set_epi32(ip, ip + 0x100, ip - 0x100, ip);
-   rte_lpm_lookupx4(lpm, ipx4, hop, UINT16_MAX);
+   rte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX);
TEST_LPM_ASSERT(hop[0] == next_hop_add);
-   TEST_LPM_ASSERT(hop[1] == UINT16_MAX);
-   TEST_LPM_ASSERT(hop[2] == UINT16_MAX);
+   TEST_LPM_ASSERT(hop[1] == UINT32_MAX);
+   TEST_LPM_ASSERT(hop[2] == UINT32_MAX);
TEST_LPM_ASSERT(hop[3] == next_hop_add);

status = rte_lpm_delete(lpm, ip, depth);
@@ -355,10 +354,11 @@ int32_t
 test8(void)
 {
__m128i ipx4;
-   uint16_t hop[4];
+   uint32_t hop[4];
struct rte_lpm *lpm = NULL;
uint32_t ip1 = IPv4(127, 255, 255, 255), ip2 = IPv4(128, 0, 0, 0);
-   uint8_t depth, next_hop_add, next_hop_return;
+   uint32_t next_hop_add, next_hop_return;
+   uint8_t depth;
int32_t status = 0;

lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);
@@ -381,10 +381,10 @@ test8(void)
(next_hop_return == next_hop_add));

ipx4 = _mm_set_epi32(ip2, ip1, ip2, ip1);
-   rte_lpm_lookupx4(lpm, ipx4, hop, UINT16_MAX);
-   TEST_LPM_ASSERT(hop[0] == UINT16_MAX);
+   rte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX);
+   TEST_LPM_ASSERT(hop[0] == UINT32_MAX);
TEST_LPM_ASSERT(hop[1] == next_hop_add);
-   TEST_LPM_ASSERT(hop[2] == UINT16_MAX);
+   TEST_LPM_ASSERT(hop[2] == UINT32_MAX);
TEST_LPM_ASSERT(hop[3] == next_hop_add);
}

@@ -400,8 +400,7 @@ test8(void)
if (depth != 1) {
TEST_LPM_ASSERT((status == 0) &&
(next_hop_return == next_hop_add));
-   }
-   else {
+   } else {
TEST_LPM_ASSERT(status == -ENOENT);
}

@@ -409,16 +408,16 @@ test8(void)
TEST_LPM_ASSERT(status == -ENOENT);

ipx4 = _mm_set_epi32(ip1, ip1, ip2, ip2);
-   rte_lpm_lookupx4(lpm, ipx4, hop, UINT16_MAX);
+   rte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX);
if (depth != 1) {
TEST_LPM_ASSERT(hop[0] == next_hop_add);
TEST_LPM_ASSERT(hop[1] == next_hop_add);
} else {
-   TEST_LPM_ASSERT(hop[0] == UINT16_MAX);
-   TEST_LPM_ASSERT(hop[1] == UINT16_MAX);

[dpdk-dev] [PATCH v3 0/2] Increased number of next hops for LPM IPv4

2016-03-08 Thread Michal Kobylinski
This patchset extended next_hop field from 8-bits to 24-bits in LPM library for 
IPv4.

Added versioning symbols to functions and updated
library and applications that have a dependency on LPM library.

Michal Kobylinski (2):
  lpm: extend ip4 next_hop and add config structure
  examples: update to use new lpm lib for ipv4

 app/test/test_lpm.c |  122 +--
 doc/guides/rel_notes/release_16_04.rst  |5 +-
 examples/ip_fragmentation/main.c|   16 +-
 examples/ip_reassembly/main.c   |   15 +-
 examples/l3fwd-power/main.c |2 +-
 examples/l3fwd-vf/main.c|2 +-
 examples/l3fwd/l3fwd_em_sse.h   |2 +-
 examples/l3fwd/l3fwd_lpm.h  |6 +-
 examples/l3fwd/l3fwd_lpm_sse.h  |   24 +-
 examples/l3fwd/l3fwd_sse.h  |8 +-
 examples/load_balancer/runtime.c|2 +-
 examples/performance-thread/l3fwd-thread/main.c |   33 +-
 lib/librte_lpm/Makefile |2 +-
 lib/librte_lpm/rte_lpm.c| 1090 ---
 lib/librte_lpm/rte_lpm.h|  202 +++--
 lib/librte_lpm/rte_lpm_version.map  |   11 +
 lib/librte_table/rte_table_lpm.c|   15 +-
 17 files changed, 1277 insertions(+), 280 deletions(-)

-- 
1.9.1



[dpdk-dev] [PATCH v2 0/2] Increase number of next hops for LPM IPv4

2016-03-08 Thread Kobylinski, MichalX


> -Original Message-
> From: Kobylinski, MichalX
> Sent: Tuesday, March 8, 2016 4:54 PM
> To: 'Thomas Monjalon' 
> Cc: dev at dpdk.org; Jerin Jacob 
> Subject: RE: [dpdk-dev] [PATCH v2 0/2] Increase number of next hops for
> LPM IPv4
> 
> 
> 
> > -Original Message-
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > Sent: Tuesday, March 8, 2016 4:13 PM
> > To: Kobylinski, MichalX 
> > Cc: dev at dpdk.org; Jerin Jacob 
> > Subject: Re: [dpdk-dev] [PATCH v2 0/2] Increase number of next hops
> > for LPM IPv4
> > Importance: High
> >
> > 2016-01-29 13:12, Michal Kobylinski:
> > > This patchset extend next_hop field from 8-bits to 24-bits in LPM
> > > library for
> > IPv4.
> >
> > waiting v3, any news please?
> 
> I'm working on v3.
> Today I will post v3 on mailing list.
> > Jerin has to rebase on top of this series.

I posted two patchsets on mailing list:
Increased number of next hops for LPM IPv4 (v3) and Added a new rte_lpm_config 
structure for IPv4.


[dpdk-dev] [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM

2016-03-08 Thread Thomas Monjalon
2016-02-09 23:04, Liming Sun:
> rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
> not able to compile. This commit implements the vector api and
> enable LPM in the tilegx configuration by default.
> 
> Signed-off-by: Liming Sun 
> Acked-by: Zhigang Lu 
[...]
>  # This following libraries are not available on the tile architecture.
>  # So they're turned off.
> -CONFIG_RTE_LIBRTE_LPM=n
> +CONFIG_RTE_LIBRTE_LPM=y

You just have to remove the disabling line.

> +typedef union rte_xmm {
> + __m128i x;
> + uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
> + uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
> +} rte_xmm_t;

Why do you mimic SSE?

> +/* Shifts right the 4 32-bit integers by count bits with zeros. */
> +#define _mm_srli_epi32(v, cnt) ({  \
> + rte_xmm_t m; \
> + m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \
> + m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \
> + (m.x);   \
> +})

Please check the work in progress to have arch-specific implementation
of rte_lpm_lookupx4():
http://dpdk.org/dev/patchwork/patch/10478/


[dpdk-dev] [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

2016-03-08 Thread Thomas Monjalon
Hi,

2016-02-09 21:33, Thomas Monjalon:
> 2016-02-09 18:37, Liming Sun:
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] 
> > A comment about the TILE-Mx would be welcome.
> > Is it supported currently?
> > Isn't it an ARM arch?
> > 
> > [lsun] Yes, it's ARM arch, but with similar mpipe driver.
> > It's not fully supported yet. I'll remove this change and add it in a 
> > different serie when it's ready.
> 
> OK
> So we'll discuss how to integrate it later.
> 
> > > +# Compile combined lib by default.
> > > +CONFIG_RTE_BUILD_COMBINE_LIBS=y
> > 
> > Why forcing this option in the defconfig file?
> > 
> > [lsun] It's just trying to make it handy for other applications like OVS or 
> > ODP on top of DPDK. However we could remove this change if it's not the 
> > recommended way.
> 
> Yes please remove it.
> 
> > >  ARCH  ?= tile
> > > +
> > > +HOST_ARCH := ${shell uname -m}
> > > +ifneq ($(filter tile%,${HOST_ARCH}),) CROSS = else
> > >  CROSS ?= tile-
> > > +endif
> > 
> > I don't think the CROSS variable should have a default value.
> > It really depends on the toolchain.
> > 
> > [lsun] Make sense. The current code (before the change) has default value 
> > 'CROSS ?= tile-' defined, which cause some issue when doing native build. 
> > Another way is to define it as "CROSS ?=" just like other platforms. So 
> > when doing cross-compile, we could pass " CROSS=tile-" .
> 
> No need to keep a "CROSS ?=" line.
> The variables defined in the command line get the priority.

I have not seen patches to address these comments. Anything pending?


> > Talking about the toolchain, is it possible to build DPDK with the provided 
> > binary toolchain http://www.tilera.com/scm/tilegx-x86_64.tar.bz2 ?
> > This is the Tilera Open Source page: http://www.tilera.com/scm/
> > 
> > [lsun] I tried it just now. The gcc appears ok. But this tarball lacks of 
> > some header files and libraries to compile DPDK.
> 
> Yes that's what I've experienced.
> 
> > We're looking into it to see whether it can be easily fixed.
> 
> Please keep us informed when the toolchain is ready. Thanks

Any news about the ready-to-use toolchain?


[dpdk-dev] [PATCH 2/6] mempool: add stack (lifo) based external mempool handler

2016-03-08 Thread Venkatesan, Venky
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Olivier MATZ
> Sent: Friday, February 19, 2016 5:31 AM
> To: Hunt, David ; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/6] mempool: add stack (lifo) based
> external mempool handler
> 
> Hi David,
> 
> On 02/16/2016 03:48 PM, David Hunt wrote:
> > adds a simple stack based mempool handler
> >
> > Signed-off-by: David Hunt 
> > ---
> >  lib/librte_mempool/Makefile|   2 +-
> >  lib/librte_mempool/rte_mempool.c   |   4 +-
> >  lib/librte_mempool/rte_mempool.h   |   1 +
> >  lib/librte_mempool/rte_mempool_stack.c | 164
> > +
> >  4 files changed, 169 insertions(+), 2 deletions(-)  create mode
> > 100644 lib/librte_mempool/rte_mempool_stack.c
> >
> 
> I don't get what is the purpose of this handler. Is it an example or is it
> something that could be useful for dpdk applications?
> 
This is actually something that is useful for pipelining apps, where the 
mempool cache doesn't really work - example, where we have one core doing rx 
(and alloc), and another core doing Tx (and return). In such a case, the 
mempool ring simply cycles through all the mbufs, resulting in a LLC miss on 
every mbuf allocated when the number of mbufs is large. A stack recycles 
buffers more effectively in this case.

> If it's an example, we should find a way to put the code outside the
> librte_mempool library, maybe in the test program. I see there is also a
> "custom handler". Do we really need to have both?
> 
> 
> Regards,
> Olivier
> 



[dpdk-dev] [PATCH v2 2/7] vhost: refactor virtio_dev_rx

2016-03-08 Thread Yuanhan Liu
On Mon, Mar 07, 2016 at 03:34:53AM +, Xie, Huawei wrote:
> On 2/18/2016 9:48 PM, Yuanhan Liu wrote:
> > +   while (1) {
> > +   /* done with current mbuf, fetch next */
> > +   if (mbuf_avail == 0) {
> > +   m = m->next;
> > +   if (m == NULL)
> > +   break;
> > +
> > +   mbuf_offset = 0;
> > +   mbuf_avail  = rte_pktmbuf_data_len(m);
> > +   }
> > +
> 
> You could use while (mbuf_avail || m->next) to align with the style of
> coyp_desc_to_mbuf?

Good suggestion, will do that.

Thanks.

--yliu


[dpdk-dev] [PATCH v2 3/3] vhost: fix vq realloc at numa_realloc

2016-03-08 Thread Yuanhan Liu
On Mon, Mar 07, 2016 at 01:49:26PM +, Loftus, Ciara wrote:
> 
> I encountered the " PANIC in rte_free():" error when using 
> RTE_LIBRTE_VHOST_NUMA too, and applying this series resolved the issue. 
> Thanks for the patches.
> 
> Tested-by: Ciara Loftus 

Thanks for testing. A new version (just about rebase) will hopefully be
sent out in one or two days.

--yliu


[dpdk-dev] [PATCH 0/3] sched: patches for 2.2

2016-03-08 Thread Dumitrescu, Cristian


> -Original Message-
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Tuesday, March 8, 2016 4:33 PM
> To: Dumitrescu, Cristian 
> Cc: Thomas Monjalon ; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 0/3] sched: patches for 2.2
> 
> On Tue, 8 Mar 2016 07:49:20 +
> "Dumitrescu, Cristian"  wrote:
> 
> > Regarding Stephen's patches, I think there is a pending issue regarding the
> legal side of the Copyright, which is attributed to Intel, although Stephen's
> code is relicensed with BSD license by permission from the original code
> author (which also submitted the code to Linux kernel under GPL). This was
> already flagged. This is a legal issue and I do not feel comfortable with 
> ack-ing
> this patch until the legal resolution on this is crystal clear.
> 
> 
> I got explicit permission from the author who holds the copyright to relicense
> it.

Did you get explicit permission from the author who holds the copyright to 
relicense it with BSD license that hands over the copyright to Intel?


[dpdk-dev] [PATCH v3 0/3] enable extended tag for i40e

2016-03-08 Thread Thomas Monjalon
2016-03-08 19:38, Thomas Monjalon:
> It enables 'extended tag' for i40e devices only during its port
> initialization, which is key for 40G performance. It also deprecates
> the similar in igb_uio, and eal lib.
> 
> v3:
>  - fix build with deprecated attribute
>  - keep deprecated attribute
>  - reword release notes a bit
>  - revert doc move from v2
>  - better split the patches

I've forgot the Acked-by: Jingjing Wu 

Helin, if you agree with this new revision, I'll apply it.


[dpdk-dev] [PATCH v3 3/3] igb_uio: deprecate extended tag

2016-03-08 Thread Thomas Monjalon
From: Helin Zhang 

It deprecates sys files of 'extended_tag' and
'max_read_request_size' which was not documented.

Signed-off-by: Helin Zhang 
---
 doc/guides/linux_gsg/enable_func.rst  | 26 ---
 doc/guides/rel_notes/deprecation.rst  |  2 +
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 72 ---
 3 files changed, 18 insertions(+), 82 deletions(-)

diff --git a/doc/guides/linux_gsg/enable_func.rst 
b/doc/guides/linux_gsg/enable_func.rst
index 8cb3d79..076770f 100644
--- a/doc/guides/linux_gsg/enable_func.rst
+++ b/doc/guides/linux_gsg/enable_func.rst
@@ -186,27 +186,17 @@ Check with the local Intel's Network Division application 
engineers for firmware
 The base driver to support firmware version of FVL3E will be integrated in the 
next
 DPDK release, so currently the validated firmware version is 4.2.6.

-Enabling Extended Tag and Setting Max Read Request Size
-~~~
+Enabling Extended Tag
+~

-PCI configurations of ``extended_tag`` and max _read_requ st_size have big 
impacts on performance of small packets on 40G NIC.
-Enabling extended_tag and setting ``max_read_request_size`` to small size such 
as 128 bytes provide great helps to high performance of small packets.
+PCI configuration of ``extended_tag`` has big impact on small packet size
+performance of 40G ports. Enabling ``extended_tag`` can help 40G port to
+achieve the best performance, especially for small packet size.

-*   These can be done in some BIOS implementations.
+* Disabling/enabling ``extended_tag`` can be done in some BIOS implementations.

-*   For other BIOS implementations, PCI configurations can be changed by using 
command of ``setpci``, or special configurations in DPDK config file of 
``common_linux``.
-
-*   Bits 7:5 at address of 0xA8 of each PCI device is used for setting the 
max_read_request_size,
-and bit 8 of 0xA8 of each PCI device is used for enabling/disabling 
the extended_tag.
-lspci and setpci can be used to read the values of 0xA8 and then write 
it back after being changed.
-
-*   In config file of common_linux, below three configurations can be 
changed for the same purpose.
-
-``CONFIG_RTE_PCI_CONFIG``
-
-``CONFIG_RTE_PCI_EXTENDED_TAG``
-
-``CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE``
+* If BIOS does not enable it, and does not support changing it, tools
+  (e.g. ``setpci`` on Linux) can be used to enable or disable ``extended_tag``.

 * From release 16.04, ``extended_tag`` is enabled by default during port
   initialization, users don't need to care about that anymore.
diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 9979982..5287811 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -12,6 +12,8 @@ Deprecation Notices
   and will be removed from 16.07.
   Macros CONFIG_RTE_PCI_CONFIG, CONFIG_RTE_PCI_EXTENDED_TAG and
   CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE will be removed.
+  The /sys entries extended_tag and max_read_request_size created by igb_uio
+  will be removed.

 * The following fields have been deprecated in rte_eth_stats:
   ibadcrc, ibadlen, imcasts, fdirmatch, fdirmiss,
diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c 
b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index a3ad912..72b2692 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -40,15 +40,6 @@

 #include "compat.h"

-#ifdef RTE_PCI_CONFIG
-#define PCI_SYS_FILE_BUF_SIZE  10
-#define PCI_DEV_CAP_REG0xA4
-#define PCI_DEV_CTRL_REG   0xA8
-#define PCI_DEV_CAP_EXT_TAG_MASK   0x20
-#define PCI_DEV_CTRL_EXT_TAG_SHIFT 8
-#define PCI_DEV_CTRL_EXT_TAG_MASK  (1 << PCI_DEV_CTRL_EXT_TAG_SHIFT)
-#endif
-
 /**
  * A structure describing the private information for a uio device.
  */
@@ -94,19 +85,9 @@ store_max_vfs(struct device *dev, struct device_attribute 
*attr,
 static ssize_t
 show_extended_tag(struct device *dev, struct device_attribute *attr, char *buf)
 {
-   struct pci_dev *pci_dev = to_pci_dev(dev);
-   uint32_t val = 0;
+   dev_info(dev, "Deprecated\n");

-   pci_read_config_dword(pci_dev, PCI_DEV_CAP_REG, );
-   if (!(val & PCI_DEV_CAP_EXT_TAG_MASK)) /* Not supported */
-   return snprintf(buf, PCI_SYS_FILE_BUF_SIZE, "%s\n", "invalid");
-
-   val = 0;
-   pci_bus_read_config_dword(pci_dev->bus, pci_dev->devfn,
-   PCI_DEV_CTRL_REG, );
-
-   return snprintf(buf, PCI_SYS_FILE_BUF_SIZE, "%s\n",
-   (val & PCI_DEV_CTRL_EXT_TAG_MASK) ? "on" : "off");
+   return 0;
 }

 static ssize_t
@@ -115,36 +96,9 @@ store_extended_tag(struct device *dev,
   const char *buf,
   size_t count)
 {
-   struct pci_dev *pci_dev = to_pci_dev(dev);
-   uint32_t val = 0, enable;
-
-   

[dpdk-dev] [PATCH v3 2/3] pci: remove config of extended tag

2016-03-08 Thread Thomas Monjalon
From: Helin Zhang 

Remove pci configuration of 'extended tag' and 'max read request
size', as they are not required by all devices and it lets PMD to
configure them if necessary.
In addition, 'pci_config_space_set()' is deprecated.

Signed-off-by: Helin Zhang 
Signed-off-by: Thomas Monjalon 
---
 config/common_base  |  1 +
 doc/guides/rel_notes/deprecation.rst|  5 ++
 lib/librte_eal/common/eal_common_pci.c  |  7 ---
 lib/librte_eal/common/include/rte_pci.h |  5 +-
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 90 +++--
 5 files changed, 16 insertions(+), 92 deletions(-)

diff --git a/config/common_base b/config/common_base
index 1af28c8..c73f71a 100644
--- a/config/common_base
+++ b/config/common_base
@@ -102,6 +102,7 @@ CONFIG_RTE_EAL_PMD_PATH=""

 #
 # Special configurations in PCI Config Space for high performance
+# They are all deprecated, and will be removed later.
 #
 CONFIG_RTE_PCI_CONFIG=n
 CONFIG_RTE_PCI_EXTENDED_TAG=""
diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 9930b5a..9979982 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -8,6 +8,11 @@ API and ABI deprecation notices are to be posted here.
 Deprecation Notices
 ---

+* The EAL function pci_config_space_set is deprecated in release 16.04
+  and will be removed from 16.07.
+  Macros CONFIG_RTE_PCI_CONFIG, CONFIG_RTE_PCI_EXTENDED_TAG and
+  CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE will be removed.
+
 * The following fields have been deprecated in rte_eth_stats:
   ibadcrc, ibadlen, imcasts, fdirmatch, fdirmiss,
   tx_pause_xon, rx_pause_xon, tx_pause_xoff, rx_pause_xoff
diff --git a/lib/librte_eal/common/eal_common_pci.c 
b/lib/librte_eal/common/eal_common_pci.c
index 96d5113..366fb46 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -180,13 +180,6 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, 
struct rte_pci_device *d
}

if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
-#ifdef RTE_PCI_CONFIG
-   /*
-* Set PCIe config space for high performance.
-* Return value can be ignored.
-*/
-   pci_config_space_set(dev);
-#endif
/* map resources for devices that use igb_uio */
ret = rte_eal_pci_map_device(dev);
if (ret != 0)
diff --git a/lib/librte_eal/common/include/rte_pci.h 
b/lib/librte_eal/common/include/rte_pci.h
index 067e084..e692094 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -578,14 +578,17 @@ void rte_eal_pci_ioport_write(struct rte_pci_ioport *p,
  const void *data, size_t len, off_t offset);

 #ifdef RTE_PCI_CONFIG
+#include 
 /**
  * Set special config space registers for performance purpose.
+ * It is deprecated, as all configurations have been moved into
+ * each PMDs respectively.
  *
  * @param dev
  *   A pointer to a rte_pci_device structure describing the device
  *   to use
  */
-void pci_config_space_set(struct rte_pci_device *dev);
+void pci_config_space_set(struct rte_pci_device *dev) __rte_deprecated;
 #endif /* RTE_PCI_CONFIG */

 #ifdef __cplusplus
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c 
b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 4346973..4c45452 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -482,92 +482,14 @@ error:
 }

 #ifdef RTE_PCI_CONFIG
-static int
-pci_config_extended_tag(struct rte_pci_device *dev)
-{
-   struct rte_pci_addr *loc = >addr;
-   char filename[PATH_MAX];
-   char buf[BUFSIZ];
-   FILE *f;
-
-   /* not configured, let it as is */
-   if (strncmp(RTE_PCI_EXTENDED_TAG, "on", 2) != 0 &&
-   strncmp(RTE_PCI_EXTENDED_TAG, "off", 3) != 0)
-   return 0;
-
-   snprintf(filename, sizeof(filename),
-   SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/" "extended_tag",
-   loc->domain, loc->bus, loc->devid, loc->function);
-   f = fopen(filename, "rw+");
-   if (!f)
-   return -1;
-
-   fgets(buf, sizeof(buf), f);
-   if (strncmp(RTE_PCI_EXTENDED_TAG, "on", 2) == 0) {
-   /* enable Extended Tag*/
-   if (strncmp(buf, "on", 2) != 0) {
-   fseek(f, 0, SEEK_SET);
-   fputs("on", f);
-   }
-   } else {
-   /* disable Extended Tag */
-   if (strncmp(buf, "off", 3) != 0) {
-   fseek(f, 0, SEEK_SET);
-   fputs("off", f);
-   }
-   }
-   fclose(f);
-
-   return 0;
-}
-
-static int
-pci_config_max_read_request_size(struct rte_pci_device *dev)
-{
-   struct 

[dpdk-dev] [PATCH v3 1/3] i40e: enable extended tag

2016-03-08 Thread Thomas Monjalon
From: Helin Zhang 

PCIe feature of 'Extended Tag' is important for 40G performance.
It adds its enabling during each port initialization, to ensure
the high performance.

Signed-off-by: Helin Zhang 
---
 doc/guides/linux_gsg/enable_func.rst   |  3 ++
 doc/guides/rel_notes/release_16_04.rst |  6 
 drivers/net/i40e/i40e_ethdev.c | 65 --
 3 files changed, 71 insertions(+), 3 deletions(-)

diff --git a/doc/guides/linux_gsg/enable_func.rst 
b/doc/guides/linux_gsg/enable_func.rst
index c3fa6d3..8cb3d79 100644
--- a/doc/guides/linux_gsg/enable_func.rst
+++ b/doc/guides/linux_gsg/enable_func.rst
@@ -208,6 +208,9 @@ Enabling extended_tag and setting ``max_read_request_size`` 
to small size such a

 ``CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE``

+* From release 16.04, ``extended_tag`` is enabled by default during port
+  initialization, users don't need to care about that anymore.
+
 Use 16 Bytes RX Descriptor Size
 ~~~

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 24f15bf..96f144e 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -57,6 +57,12 @@ This section should contain new features added in this 
release. Sample format:

 * **Added vhost-user live migration support.**

+* **Enabled PCI extended tag for i40e.**
+
+  It enabled extended tag by checking and writing corresponding PCI config
+  space bytes, to boost the performance. In the meanwhile, it deprecated the
+  legacy way via reading/writing sysfile supported by kernel module igb_uio.
+

 Resolved Issues
 ---
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ef24122..7e68c61 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -273,6 +273,17 @@
 #define I40E_INSET_IPV6_TC_MASK   0x0009F00FUL
 #define I40E_INSET_IPV6_NEXT_HDR_MASK 0x000C00FFUL

+/* PCI offset for querying capability */
+#define PCI_DEV_CAP_REG0xA4
+/* PCI offset for enabling/disabling Extended Tag */
+#define PCI_DEV_CTRL_REG   0xA8
+/* Bit mask of Extended Tag capability */
+#define PCI_DEV_CAP_EXT_TAG_MASK   0x20
+/* Bit shift of Extended Tag enable/disable */
+#define PCI_DEV_CTRL_EXT_TAG_SHIFT 8
+/* Bit mask of Extended Tag enable/disable */
+#define PCI_DEV_CTRL_EXT_TAG_MASK  (1 << PCI_DEV_CTRL_EXT_TAG_SHIFT)
+
 static int eth_i40e_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev);
 static int i40e_dev_configure(struct rte_eth_dev *dev);
@@ -386,7 +397,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 static int i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
  struct rte_eth_dcb_info *dcb_info);
 static void i40e_configure_registers(struct i40e_hw *hw);
-static void i40e_hw_init(struct i40e_hw *hw);
+static void i40e_hw_init(struct rte_eth_dev *dev);
 static int i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi);
 static int i40e_mirror_rule_set(struct rte_eth_dev *dev,
struct rte_eth_mirror_conf *mirror_conf,
@@ -765,7 +776,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
i40e_clear_hw(hw);

/* Initialize the hardware */
-   i40e_hw_init(hw);
+   i40e_hw_init(dev);

/* Reset here to make sure all is clean for each PF */
ret = i40e_pf_reset(hw);
@@ -7262,13 +7273,61 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 }

 /*
+ * Check and enable Extended Tag.
+ * Enabling Extended Tag is important for 40G performance.
+ */
+static void
+i40e_enable_extended_tag(struct rte_eth_dev *dev)
+{
+   uint32_t buf = 0;
+   int ret;
+
+   ret = rte_eal_pci_read_config(dev->pci_dev, , sizeof(buf),
+ PCI_DEV_CAP_REG);
+   if (ret < 0) {
+   PMD_DRV_LOG(ERR, "Failed to read PCI offset 0x%x",
+   PCI_DEV_CAP_REG);
+   return;
+   }
+   if (!(buf & PCI_DEV_CAP_EXT_TAG_MASK)) {
+   PMD_DRV_LOG(ERR, "Does not support Extended Tag");
+   return;
+   }
+
+   buf = 0;
+   ret = rte_eal_pci_read_config(dev->pci_dev, , sizeof(buf),
+ PCI_DEV_CTRL_REG);
+   if (ret < 0) {
+   PMD_DRV_LOG(ERR, "Failed to read PCI offset 0x%x",
+   PCI_DEV_CTRL_REG);
+   return;
+   }
+   if (buf & PCI_DEV_CTRL_EXT_TAG_MASK) {
+   PMD_DRV_LOG(DEBUG, "Extended Tag has already been enabled");
+   return;
+   }
+   buf |= PCI_DEV_CTRL_EXT_TAG_MASK;
+   ret = rte_eal_pci_write_config(dev->pci_dev, , sizeof(buf),
+  PCI_DEV_CTRL_REG);
+   if (ret < 0) {
+   PMD_DRV_LOG(ERR, "Failed to write PCI offset 0x%x",
+   

[dpdk-dev] [PATCH v3 0/3] enable extended tag for i40e

2016-03-08 Thread Thomas Monjalon
It enables 'extended tag' for i40e devices only during its port
initialization, which is key for 40G performance. It also deprecates
the similar in igb_uio, and eal lib.

v3:
 - fix build with deprecated attribute
 - keep deprecated attribute
 - reword release notes a bit
 - revert doc move from v2
 - better split the patches

v2:
 - Changed the type of return value of i40e_enable_extended_tag() to 'void'.
 - Fixed the compile warnings.
 - Kept the sys files as they were, and added ABI change announcement for them.
 - Moved high performance part of i40e from 'GSG' to a new for .nics'.

Helin Zhang (3):
  i40e: enable extended tag
  pci: remove config of extended tag
  igb_uio: deprecate extended tag

 config/common_base|  1 +
 doc/guides/linux_gsg/enable_func.rst  | 27 --
 doc/guides/rel_notes/deprecation.rst  |  7 +++
 doc/guides/rel_notes/release_16_04.rst|  6 +++
 drivers/net/i40e/i40e_ethdev.c| 65 --
 lib/librte_eal/common/eal_common_pci.c|  7 ---
 lib/librte_eal/common/include/rte_pci.h   |  5 +-
 lib/librte_eal/linuxapp/eal/eal_pci.c | 90 +++
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 72 +++--
 9 files changed, 104 insertions(+), 176 deletions(-)

-- 
2.7.0



[dpdk-dev] [PATCH v2 3/3] igb_uio: deprecate sys files

2016-03-08 Thread Thomas Monjalon
2016-02-22 11:59, Helin Zhang:
> It deprecated sys files of 'extended_tag' and
> 'max_read_request_size', and announced the planned ABI changes of
> them.
[...]
>  - Moved high performance part of i40e from 'GSG' to a new for .nics'.

This change is not related to extended tag only.
Let's move the docs after Jingjing have created i40e.rst.


[dpdk-dev] [PATCH v2 3/3] igb_uio: deprecate sys files

2016-03-08 Thread Thomas Monjalon
2016-02-22 11:59, Helin Zhang:
> --- /dev/null
> +++ b/doc/guides/nics/i40e.rst

This file is not included in the index.

> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -587,7 +587,7 @@ void rte_eal_pci_ioport_write(struct rte_pci_ioport *p,
>   *   A pointer to a rte_pci_device structure describing the device
>   *   to use
>   */
> -void pci_config_space_set(struct rte_pci_device *dev) __rte_deprecated;
> +void pci_config_space_set(struct rte_pci_device *dev);

Why the deprecated attribute is now removed?


[dpdk-dev] [PATCH] mempool: avoid memory waste with large pagesize

2016-03-08 Thread Stephen Hemminger
If page size is large (like 64K on ARM) and object size is small
then don't waste lots of memory by rounding up to page size.
Instead, round up so that 1 or more objects all fit in a page.

This preserves the requirement that an object must not a page
or virt2phys would break, and makes sure 62K is not wasted per mbuf.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_mempool/rte_mempool.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index f8781e1..8fa855a 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -300,18 +300,24 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t 
flags,
if (! rte_eal_has_hugepages()) {
/*
 * compute trailer size so that pool elements fit exactly in
-* a standard page
+* a standard page. If elements are smaller than a page
+* then allow multiple elements per page
 */
-   int page_size = getpagesize();
-   int new_size = page_size - sz->header_size - sz->elt_size;
-   if (new_size < 0 || (unsigned int)new_size < sz->trailer_size) {
+   unsigned page_size = getpagesize();
+   uint32_t orig_size, new_size;
+
+   orig_size = sz->header_size + sz->elt_size;
+   new_size = rte_align32pow2(orig_size);
+   if (new_size > page_size) {
printf("When hugepages are disabled, pool objects "
   "can't exceed PAGE_SIZE: %d + %d + %d > %d\n",
   sz->header_size, sz->elt_size, sz->trailer_size,
   page_size);
return 0;
}
-   sz->trailer_size = new_size;
+
+   sz->trailer_size = (new_size - orig_size)
+   / (page_size / new_size);
}

/* this is the size of an object, including header and trailer */
-- 
2.1.4



[dpdk-dev] [PATCH v5 2/2] librte_pipeline: add new API functions for pipeline action handlers

2016-03-08 Thread Jasvinder Singh
Two new pipeline API functions have been added to the library. The packet
hijack API function can be called by any input/output port or table action
handler to remove selected packets from the burst of packets read from one
of the pipeline input ports and then either send these packets out through
any pipeline output port or drop them.

Another packet drop API function can be used by the pipeline action
handlers (port in/out, table) to drop the packets selected using packet
mask. This function updates the drop statistics counters correctly.

Signed-off-by: Jasvinder Singh 
Acked-by: Cristian Dumitrescu 
---
 app/test/test_table_pipeline.c |  53 +-
 .../ip_pipeline/pipeline/pipeline_actions_common.h |   8 +-
 lib/librte_pipeline/rte_pipeline.c |  20 
 lib/librte_pipeline/rte_pipeline.h | 107 +
 lib/librte_pipeline/rte_pipeline_version.map   |   8 ++
 5 files changed, 149 insertions(+), 47 deletions(-)

diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
index 4bcce2b..36bfeda 100644
--- a/app/test/test_table_pipeline.c
+++ b/app/test/test_table_pipeline.c
@@ -91,53 +91,59 @@ rte_pipeline_port_out_action_handler 
port_action_stub(struct rte_mbuf **pkts,
 #endif

 rte_pipeline_table_action_handler_hit
-table_action_0x00(struct rte_mbuf **pkts, uint64_t *pkts_mask,
-   struct rte_pipeline_table_entry **actions, uint32_t action_mask);
+table_action_0x00(struct rte_pipeline *p, struct rte_mbuf **pkts,
+   uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);

 rte_pipeline_table_action_handler_hit
-table_action_stub_hit(struct rte_mbuf **pkts, uint64_t *pkts_mask,
-   struct rte_pipeline_table_entry **actions, uint32_t action_mask);
+table_action_stub_hit(struct rte_pipeline *p, struct rte_mbuf **pkts,
+   uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);

 rte_pipeline_table_action_handler_miss
-table_action_stub_miss(struct rte_mbuf **pkts, uint64_t *pkts_mask,
-   struct rte_pipeline_table_entry *action, uint32_t action_mask);
+table_action_stub_miss(struct rte_pipeline *p, struct rte_mbuf **pkts,
+   uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);

 rte_pipeline_table_action_handler_hit
-table_action_0x00(__attribute__((unused)) struct rte_mbuf **pkts,
-   uint64_t *pkts_mask,
-   __attribute__((unused)) struct rte_pipeline_table_entry **actions,
-   __attribute__((unused)) uint32_t action_mask)
+table_action_0x00(__attribute__((unused)) struct rte_pipeline *p,
+   __attribute__((unused)) struct rte_mbuf **pkts,
+   uint64_t pkts_mask,
+   __attribute__((unused)) struct rte_pipeline_table_entry **entry,
+   __attribute__((unused)) void *arg)
 {
printf("Table Action, setting pkts_mask to 0x00\n");
-   *pkts_mask = 0x00;
+   pkts_mask = ~0x00;
+   rte_pipeline_ah_packet_drop(p, pkts_mask);
return 0;
 }

 rte_pipeline_table_action_handler_hit
-table_action_stub_hit(__attribute__((unused)) struct rte_mbuf **pkts,
-   uint64_t *pkts_mask,
-   __attribute__((unused)) struct rte_pipeline_table_entry **actions,
-   __attribute__((unused)) uint32_t action_mask)
+table_action_stub_hit(__attribute__((unused)) struct rte_pipeline *p,
+   __attribute__((unused)) struct rte_mbuf **pkts,
+   uint64_t pkts_mask,
+   __attribute__((unused)) struct rte_pipeline_table_entry **entry,
+   __attribute__((unused)) void *arg)
 {
printf("STUB Table Action Hit - doing nothing\n");
printf("STUB Table Action Hit - setting mask to 0x%"PRIx64"\n",
override_hit_mask);
-   *pkts_mask = override_hit_mask;
+   pkts_mask = (~override_hit_mask) & 0x3;
+   rte_pipeline_ah_packet_drop(p, pkts_mask);
return 0;
 }
+
 rte_pipeline_table_action_handler_miss
-table_action_stub_miss(__attribute__((unused)) struct rte_mbuf **pkts,
-   uint64_t *pkts_mask,
-   __attribute__((unused)) struct rte_pipeline_table_entry *action,
-   __attribute__((unused)) uint32_t action_mask)
+table_action_stub_miss(struct rte_pipeline *p,
+   __attribute__((unused)) struct rte_mbuf **pkts,
+   uint64_t pkts_mask,
+   __attribute__((unused)) struct rte_pipeline_table_entry **entry,
+   __attribute__((unused)) void *arg)
 {
printf("STUB Table Action Miss - setting mask to 0x%"PRIx64"\n",
override_miss_mask);
-   *pkts_mask = override_miss_mask;
+   pkts_mask = (~override_miss_mask) & 0x3;
+   rte_pipeline_ah_packet_drop(p, pkts_mask);
return 0;
 }

-
 enum e_test_type {
e_TEST_STUB = 0,
e_TEST_LPM,
@@ -537,7 +543,6 @@ test_table_pipeline(void)
setup_pipeline(e_TEST_STUB);
if (test_pipeline_single_filter(e_TEST_STUB, 4) < 0)
return -1;
-#if 0

/* TEST - one packet per port */
action_handler_hit = NULL;
@@ 

[dpdk-dev] [PATCH v5 1/2] librte_pipeline: add support for packet redirection at action handlers

2016-03-08 Thread Jasvinder Singh
Currently, there is no mechanism that allows the pipeline ports (in/out)
and table action handlers to override the default forwarding decision
(as previously configured per input port or in the table entry). The port
(in/out) and table action handler prototypes have been changed to allow
pipeline action handlers (port in/out, table) to remove the selected
packets from the further pipeline processing and to take full ownership
for these packets. This feature will be helpful to implement functions
such as exception handling (e.g. TTL =0), load balancing etc.

Signed-off-by: Jasvinder Singh 
Acked-by: Cristian Dumitrescu 
---
v5
* separating patch into two commits.

v4
* merged library and app commits

v3
* improved comments in "rte_pipeline.h"

v2
* rebased on master

 app/test-pipeline/pipeline_acl.c   |   3 +-
 app/test-pipeline/pipeline_hash.c  |   3 +-
 app/test-pipeline/pipeline_lpm.c   |   3 +-
 app/test-pipeline/pipeline_lpm_ipv6.c  |   3 +-
 app/test-pipeline/pipeline_stub.c  |   3 +-
 app/test/test_table_acl.c  |   3 +-
 app/test/test_table_pipeline.c |   9 +-
 doc/guides/rel_notes/deprecation.rst   |   5 -
 doc/guides/rel_notes/release_16_04.rst |   6 +-
 .../ip_pipeline/pipeline/pipeline_actions_common.h |  43 +-
 .../ip_pipeline/pipeline/pipeline_firewall_be.c|   3 +-
 .../pipeline/pipeline_flow_actions_be.c|   3 +-
 .../pipeline/pipeline_flow_classification_be.c |   3 +-
 .../ip_pipeline/pipeline/pipeline_passthrough_be.c |   3 +-
 .../ip_pipeline/pipeline/pipeline_routing_be.c |   3 +-
 lib/librte_pipeline/Makefile   |   4 +-
 lib/librte_pipeline/rte_pipeline.c | 441 ++---
 lib/librte_pipeline/rte_pipeline.h |  67 ++--
 18 files changed, 289 insertions(+), 319 deletions(-)

diff --git a/app/test-pipeline/pipeline_acl.c b/app/test-pipeline/pipeline_acl.c
index f163e55..22d5f36 100644
--- a/app/test-pipeline/pipeline_acl.c
+++ b/app/test-pipeline/pipeline_acl.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -159,7 +159,6 @@ app_main_loop_worker_pipeline_acl(void) {
.ops = _port_ring_writer_ops,
.arg_create = (void *) _ring_params,
.f_action = NULL,
-   .f_action_bulk = NULL,
.arg_ah = NULL,
};

diff --git a/app/test-pipeline/pipeline_hash.c 
b/app/test-pipeline/pipeline_hash.c
index 8b888d7..f8aac0d 100644
--- a/app/test-pipeline/pipeline_hash.c
+++ b/app/test-pipeline/pipeline_hash.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -140,7 +140,6 @@ app_main_loop_worker_pipeline_hash(void) {
.ops = _port_ring_writer_ops,
.arg_create = (void *) _ring_params,
.f_action = NULL,
-   .f_action_bulk = NULL,
.arg_ah = NULL,
};

diff --git a/app/test-pipeline/pipeline_lpm.c b/app/test-pipeline/pipeline_lpm.c
index 2d7bc01..916abd4 100644
--- a/app/test-pipeline/pipeline_lpm.c
+++ b/app/test-pipeline/pipeline_lpm.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -99,7 +99,6 @@ app_main_loop_worker_pipeline_lpm(void) {
.ops = _port_ring_writer_ops,
.arg_create = (void *) _ring_params,
.f_action = NULL,
-   .f_action_bulk = NULL,
.arg_ah = NULL,
};

diff --git a/app/test-pipeline/pipeline_lpm_ipv6.c 
b/app/test-pipeline/pipeline_lpm_ipv6.c
index c895b62..3352e89 100644
--- a/app/test-pipeline/pipeline_lpm_ipv6.c
+++ b/app/test-pipeline/pipeline_lpm_ipv6.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -100,7 +100,6 @@ app_main_loop_worker_pipeline_lpm_ipv6(void) {
.ops = _port_ring_writer_ops,

[dpdk-dev] [PATCH v2 2/3] eal: remove pci config of extended tag

2016-03-08 Thread Thomas Monjalon
2016-02-22 11:59, Helin Zhang:
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -580,12 +580,14 @@ void rte_eal_pci_ioport_write(struct rte_pci_ioport *p,
>  #ifdef RTE_PCI_CONFIG
>  /**
>   * Set special config space registers for performance purpose.
> + * It is deprecated, as all configurations have been moved into
> + * each PMDs respectively.
>   *
>   * @param dev
>   *   A pointer to a rte_pci_device structure describing the device
>   *   to use
>   */
> -void pci_config_space_set(struct rte_pci_device *dev);
> +void pci_config_space_set(struct rte_pci_device *dev) __rte_deprecated;

There is a missing prototype error because
#include  is missing.



[dpdk-dev] [PATCH v9 0/4] ethdev: add speed capabilities and refactor link API

2016-03-08 Thread Nélio Laranjeiro
On Tue, Mar 08, 2016 at 04:00:29PM +0100, Marc Sune wrote:
> 2016-03-01 1:45 GMT+01:00 Marc Sune :
> 
> > The current rte_eth_dev_info abstraction does not provide any mechanism to
> > get the supported speed(s) of an ethdev.
> >
> > For some drivers (e.g. ixgbe), an educated guess could be done based on the
> > driver's name (driver_name in rte_eth_dev_info), see:
> >
> > http://dpdk.org/ml/archives/dev/2013-August/000412.html
> >
> > However, i) doing string comparisons is annoying, and can silently
> > break existing applications if PMDs change their names ii) it does not
> > provide all the supported capabilities of the ethdev iii) for some drivers
> > it
> > is impossible determine correctly the (max) speed by the application
> > (e.g. in i40, distinguish between XL710 and X710).
> >
> > In addition, the link APIs do not allow to define a set of advertised link
> > speeds for autonegociation.
> >
> > This series of patches adds the following capabilities:
> >
> > * speed_capa bitmap in rte_eth_dev_info, which is filled by the PMDs
> >   according to the physical device capabilities.
> > * refactors link API in ethdev to allow the definition of the advertised
> >   link speeds, fix speed (no auto-negociation) or advertise all supported
> >   speeds (default).
> >
> > WARNING: this patch series, specifically 3/4, is NOT tested for most of the
> > PMDs, due to the lack of hardware. Only generic EM is tested (VM).
> > Reviewing
> > and testing required by PMD maintainers.
> >
> > * * * * *
> >
> > v2: rebase, converted speed_capa into 32 bits bitmap, fixed alignment
> > (checkpatch).
> >
> > v3: rebase to v2.1. unified ETH_LINK_SPEED and ETH_SPEED_CAP into
> > ETH_SPEED.
> > Converted field speed in struct rte_eth_conf to speed, to allow a
> > bitmap
> > for defining the announced speeds, as suggested M. Brorup. Fixed
> > spelling
> > issues.
> >
> > v4: fixed errata in the documentation of field speeds of rte_eth_conf, and
> > commit 1/2 message. rebased to v2.1.0. v3 was incorrectly based on
> > ~2.1.0-rc1.
> >
> > v5: revert to v2 speed capabilities patch. Fixed MLX4 speed capabilities
> > (thanks N. Laranjeiro). Refactored link speed API to allow setting
> > advertised speeds (3/4). Added NO_AUTONEG option to explicitely disable
> > auto-negociation. Updated 2.2 rel. notes (4/4). Rebased to current
> > HEAD.
> >
> > v6: Move link_duplex to be part of bitfield. Fixed i40 autoneg flag link
> > update code. Added rte_eth_speed_to_bm_flag() to .map file. Fixed other
> > spelling issues. Rebased to current HEAD.
> >
> > v7: Rebased to current HEAD. Moved documentation to v2.3. Still needs
> > testing
> > from PMD maintainers.
> >
> > v8: Rebased to current HEAD. Modified em driver impl. to not touch base
> > files.
> > Merged patch 5 into 3 (map file). Changed numeric speed to a 64 bit
> > value.
> > Filled-in speed capabilities for drivers bnx2x, cxgbe, mlx5 and nfp in
> > addition to the ones of previous patch sets.
> >
> > v9: rebased to current HEAD. Reverted numeric speed to 32 bit in struct
> > rte_eth_link (no atomic link get > 64bit). Fixed mlx5 driver
> > compilation
> > and link speeds. Moved documentation to release_16_04.rst and fixed
> > several
> > issues. Upgrade NIC notes with speed capabilities.
> >
> 
> Anyone interested in reviewing and _testing_ this series?
> 
> Thank you
> Marc

Hi Marc,

I will take a look tomorrow morning and run test on Mellanox NICs
(ConnectX 3 and 4).

I do not have access to the others NICs, if those who have can do
it, could be really great.

Regards,

-- 
N?lio Laranjeiro
6WIND


[dpdk-dev] [PATCH v3 0/2] i40evf: pf reset event report

2016-03-08 Thread Bruce Richardson
On Fri, Feb 26, 2016 at 02:51:52PM +0800, Jingjing Wu wrote:
> v3 changes:
>  - commit log doc rewording.
>  - rebase on latest dpdk-next-net/rel_16_04 branch.
>  - remove few useless line
>  - adjust interval and increase times for waiting pf msg
> 
> v2 changes:
>  - remove the change on vf reset status checking
>  - add pf event report support in release note
> 
> When Linux PF and DPDK VF are used for i40e PMD, In case of PF reset,
> interrupt request will go via adminq event, VF need be informed, a callback
> mechanism is introduced by VF. This will allow VF to invoke callback when
> reset happens.
> Users can register a callback for this interrupt event like:
> rte_eth_dev_callback_register(portid,
> RTE_ETH_EVENT_INTR_RESET,
> reset_event_callback,
> arg);
> 
> Jingjing Wu (2):
>   i40evf: allocate virtchnl cmd buffer for each vf
>   i40evf: support to report pf reset event
> 
>  doc/guides/rel_notes/release_16_04.rst |   1 +
>  drivers/net/i40e/i40e_ethdev.h |   2 +
>  drivers/net/i40e/i40e_ethdev_vf.c  | 420 
> +++--
>  lib/librte_ether/rte_ethdev.h  |   1 +
>  4 files changed, 301 insertions(+), 123 deletions(-)

Hi Jingjing,

I'm planning on merging this patch set into dpdk-next-net, but it doesn't apply
cleanly. Can you perhaps rebase it on top of dpdk-next-net/rel_16_04 branch, and
do a V4 keeping Helin's ack on each patch.

Thanks,
/Bruce


[dpdk-dev] [PATCH] lpm/lpm6: fix missing free of rules_tbl and lpm

2016-03-08 Thread Christian Ehrhardt
Hi,
Stephen acked the other LPM patch I had last week (thanks).
There was no feedback to this one so far and none of the two patches is
committed yet.

So I wanted to give this another "ping" for feedback or acceptance.

Thanks in advance,
Christian

Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd

On Fri, Mar 4, 2016 at 2:29 PM, Christian Ehrhardt <
christian.ehrhardt at canonical.com> wrote:

> lpm6 autotests failed with the default alloc of 512M Memory.
> While >=2500M was a workaround it became clear while debugging that it
> had a leak.
> One could see a lot of output like:
>   LPM Test tests6[i]: FAIL
>   LPM: LPM memory allocation failed
>
> It turned out that in rte_lpm6_free
> - lpm might not be freed if it didn't find a te (early return)
> - lpm->rules_tbl was not freed ever
>
> The first of the two also applies to lpm.
> ---
>  lib/librte_lpm/rte_lpm.c  | 7 ++-
>  lib/librte_lpm/rte_lpm6.c | 9 -
>  2 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
> index cfdf959..941720d 100644
> --- a/lib/librte_lpm/rte_lpm.c
> +++ b/lib/librte_lpm/rte_lpm.c
> @@ -236,13 +236,10 @@ rte_lpm_free(struct rte_lpm *lpm)
> if (te->data == (void *) lpm)
> break;
> }
> -   if (te == NULL) {
> -   rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
> -   return;
> +   if (te != NULL) {
> +   TAILQ_REMOVE(lpm_list, te, next);
> }
>
> -   TAILQ_REMOVE(lpm_list, te, next);
> -
> rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
>
> rte_free(lpm);
> diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
> index 48931cc..5abfc78 100644
> --- a/lib/librte_lpm/rte_lpm6.c
> +++ b/lib/librte_lpm/rte_lpm6.c
> @@ -278,15 +278,14 @@ rte_lpm6_free(struct rte_lpm6 *lpm)
> if (te->data == (void *) lpm)
> break;
> }
> -   if (te == NULL) {
> -   rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
> -   return;
> -   }
>
> -   TAILQ_REMOVE(lpm_list, te, next);
> +   if (te != NULL) {
> +   TAILQ_REMOVE(lpm_list, te, next);
> +   }
>
> rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
>
> +   rte_free(lpm->rules_tbl);
> rte_free(lpm);
> rte_free(te);
>  }
> --
> 2.7.0
>
>


[dpdk-dev] [PATCH v3] ixgbe: support link speed auto-neg on x550em_x

2016-03-08 Thread Bruce Richardson
On Fri, Feb 26, 2016 at 11:05:29AM +0800, Wenzhuo Lu wrote:
> Normally the auto-negotiation is supported by FW. SW need not care about
> that. But on x550em_x, FW doesn't support auto-neg. As the ports of x550em_x
> are 10G, if we connect the port will a peer which is 1G, the link will always
> be down.
> We need support auto-neg by SW to avoid this link down issue. As we already
> have the code to handle the link speed setting, what we need is a trigger.
> When the advertised link speed changes, a PHY interruption will be triggered.
> So, we should handle this interruption and call ixgbe_handle_lasi to set the
> link speed correctly.
> 
> Please be aware it's working when auto-neg is on. If the auto-neg of the peer
> port is turned off and its speed is indicated manually, we should also set
> the speed of our own port manually.
> 
> V2:
>  *Fix the wrong signoff name.
> 
> V3:
>  *Change the tittle and add the explanation of the implementation in commit 
> log.
> 
> Signed-off-by: Wenzhuo Lu 
> Acked-by: Shaopeng He 
> ---
Applied to dpdk-next-net/rel_16_04

/Bruce



[dpdk-dev] [PATCH v2 0/2] Increase number of next hops for LPM IPv4

2016-03-08 Thread Thomas Monjalon
2016-03-08 15:53, Kobylinski, MichalX:
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > 2016-01-29 13:12, Michal Kobylinski:
> > > This patchset extend next_hop field from 8-bits to 24-bits in LPM library 
> > > for
> > IPv4.
> > 
> > waiting v3, any news please?
> 
> I'm working on v3.
> Today I will post v3 on mailing list.

Great, thanks


[dpdk-dev] [PATCH v3 0/3] extend vmdq_dcb sample for X710 supporting

2016-03-08 Thread Bruce Richardson
On Thu, Feb 25, 2016 at 03:33:32PM +0800, Jingjing Wu wrote:
> Currently, the example vmdq_dcb only works on Intel(R) 82599 NICs.
> This patchset extended this sample to make it works both on Intel(R)
> 82599 and X710/XL710 NICs. This patch set also enabled DCB VMDQ mode
> in i40e driver and added unsupported mode checking in ixgbe driver.
> 
> v2 changes:
>  - commit log doc rewording.
>  - rebase on latest dpdk-next-net/rel_16_04 branch.
>  - code style fix
> 
> v3 changes:
>  - replace I40E_3_BIT_MASK with RTE_LEN2MASK()
> 
> Jingjing Wu (3):
>   i40e: enable DCB in VMDQ VSIs
>   ixgbe: disallow unsupported RX mode
>   examples/vmdq_dcb: extend sample for X710 supporting
> 
>  doc/guides/rel_notes/release_16_04.rst   |   3 +
>  doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 171 ++
>  drivers/net/i40e/i40e_ethdev.c   | 156 +++--
>  drivers/net/i40e/i40e_ethdev.h   |  28 +-
>  drivers/net/ixgbe/ixgbe_ethdev.c |   5 +
>  examples/vmdq_dcb/main.c | 391 
> ++-
>  6 files changed, 589 insertions(+), 165 deletions(-)
> 
> -- 
> 2.4.0
> 
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH v3] docs: add statistics read frequency to fm10k guide

2016-03-08 Thread Harry van Haaren
This patch documents that the statistics of fm10k based NICs must be
read regularly in order to avoid an undetected 32 bit integer-overflow.

Signed-off-by: Harry van Haaren 
Acked-by: John McNamara 
---

v3:
-Removed paragraph from "Known Issues" based on feedback

v2:
-Moved notes to Known Issues section of Release Notes.

 doc/guides/nics/fm10k.rst | 16 
 1 file changed, 16 insertions(+)

diff --git a/doc/guides/nics/fm10k.rst b/doc/guides/nics/fm10k.rst
index 4206b7f..63b495d 100644
--- a/doc/guides/nics/fm10k.rst
+++ b/doc/guides/nics/fm10k.rst
@@ -65,3 +65,19 @@ The FM1 family of NICS support a maximum of a 15K jumbo 
frame. The value
 is fixed and cannot be changed. So, even when the ``rxmode.max_rx_pkt_len``
 member of ``struct rte_eth_conf`` is set to a value lower than 15364, frames
 up to 15364 bytes can still reach the host interface.
+
+Statistic Polling Frequency
+~~~
+
+The FM1 NICs expose a set of statistics via the PCI BARs. These statistics
+are read from the hardware registers when ``rte_eth_stats_get()`` or
+``rte_eth_xstats_get()`` is called. The packet counting registers are 32 bits
+while the byte counting registers are 48 bits. As a result, the statistics must
+be polled regularly in order to ensure the consistency of the returned reads.
+
+Given the PCIe Gen3 x8, about 50Gbps of traffic can occur. With 64 byte packets
+this gives almost 100 million packets/second, causing 32 bit integer overflow
+after approx 40 seconds. To ensure these overflows are detected and accounted
+for in the statistics, it is necessary to read statistic regularly. It is
+suggested to read stats every 20 seconds, which will ensure the statistics
+are accurate.
-- 
2.5.0



[dpdk-dev] [PATCH v4 3/3] ixgbe: fix dev_close to remove VF MAC address.

2016-03-08 Thread Bernard Iremonger
Call the ixgbevf_remove_mac_addr() function in the ixgbevf_dev_close()
function to ensure that the VF traffic goes to the PF after stop,
close and detach of the VF.

Fixes: af75078fece3 ("first public release")
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 759177a..96b42f8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3911,8 +3911,12 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)

ixgbe_dev_free_queues(dev);

-   /* reprogram the RAR[0] in case user changed it. */
-   ixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV);
+   /**
+* Remove the VF MAC address ro ensure
+* that the VF traffic goes to the PF
+* after stop, close and detach of the VF
+**/
+   ixgbevf_remove_mac_addr(dev, 0);
 }

 static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on)
-- 
2.6.3



[dpdk-dev] [PATCH v4 2/3] ixgbe: add more information to the error message

2016-03-08 Thread Bernard Iremonger
Add the nb_rx_q and nb_tx_q values to the error message
to give details about the error.

Fixes: 27b609cbd1c6 ("ethdev: move the multi-queue mode check to specific 
drivers")

Signed-off-by: Bernard Iremonger 
Acked-by: Konstantin Ananyev 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0db7f51..759177a 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1835,7 +1835,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) ||
(nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) {
PMD_INIT_LOG(ERR, "SRIOV is active,"
-   " queue number must less equal to %d.",
+   " nb_rx_q=%d nb_tx_q=%d queue number"
+   " must be less than or equal to %d.",
+   nb_rx_q, nb_tx_q,
RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool);
return -EINVAL;
}
-- 
2.6.3



[dpdk-dev] [PATCH v4 1/3] ixgbe: cleanup eth_ixgbevf_dev_uninit

2016-03-08 Thread Bernard Iremonger
Releasing the rx and tx queues is already done in ixgbe_dev_close()
so it does not need to be done in eth_ixgbevf_dev_uninit().

Fixes: 2866c5f1b87e ("ixgbe: support port hotplug")

Signed-off-by: Bernard Iremonger 
Acked-by: Konstantin Ananyev 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3e6fe86..0db7f51 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -1390,7 +1390,6 @@ static int
 eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
 {
struct ixgbe_hw *hw;
-   unsigned i;

PMD_INIT_FUNC_TRACE();

@@ -1409,18 +1408,6 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
/* Disable the interrupts for VF */
ixgbevf_intr_disable(hw);

-   for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
-   ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
-   eth_dev->data->rx_queues[i] = NULL;
-   }
-   eth_dev->data->nb_rx_queues = 0;
-
-   for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
-   ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
-   eth_dev->data->tx_queues[i] = NULL;
-   }
-   eth_dev->data->nb_tx_queues = 0;
-
rte_free(eth_dev->data->mac_addrs);
eth_dev->data->mac_addrs = NULL;

-- 
2.6.3



[dpdk-dev] [PATCH v4 0/3] ixgbe fixes

2016-03-08 Thread Bernard Iremonger
This patch set implements the following:
Removes code which was duplicated in eth_ixgbevf_dev_init().
Adds more information to the error message in ixgbe_check_mq_mode().
Removes the VF MAC address in ixgbevf_dev_close().

Changes in v4:
rebase
revert changes to ixgbe_pf.c

Changes in v3:
Revised patch 3 to remove the VF MAC address in dev_close().

Changes in v2:
Do not overwrite the VF perm_add with zero.

Bernard Iremonger (3):
  ixgbe: cleanup eth_ixgbevf_dev_uninit
  ixgbe: add more information to the error message
  ixgbe: fix dev_close to remove VF MAC address.

 drivers/net/ixgbe/ixgbe_ethdev.c | 27 ++-
 1 file changed, 10 insertions(+), 17 deletions(-)

-- 
2.6.3



[dpdk-dev] [PATCH v7 2/2] eal: add function to check if primary proc alive

2016-03-08 Thread Harry van Haaren
This patch adds a new function to the EAL API:
int rte_eal_primary_proc_alive(const char *path);

The function indicates if a primary process is alive right now.
This functionality is implemented by testing for a write-
lock on the config file, and the function tests for a lock.

The use case for this functionality is that a secondary
process can wait until a primary process starts by polling
the function and waiting. When the primary is running, the
secondary continues to poll to detect if the primary process
has quit unexpectedly, the secondary process can detect this.

Signed-off-by: Harry van Haaren 
Acked-by: Maryam Tahhan 
---
 doc/guides/rel_notes/release_16_04.rst  |  8 
 lib/librte_eal/bsdapp/eal/Makefile  |  1 +
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 +
 lib/librte_eal/common/include/rte_eal.h | 20 +++-
 lib/librte_eal/linuxapp/eal/Makefile|  3 ++-
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +
 6 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 24f15bf..7d5000f 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -74,6 +74,14 @@ EAL
 ~~~


+* **Added rte_eal_primary_proc_alive() function**
+
+  A new function ``rte_eal_primary_proc_alive()`` has been added
+  to allow the user to detect if a primary process is running.
+  Use cases for this feature include fault detection, and monitoring
+  using secondary processes.
+
+
 Drivers
 ~~~

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 9015516..9ecf429 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -79,6 +79,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_proc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_malloc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_elem.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_heap.c
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 0c24223..58c2951 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -148,5 +148,6 @@ DPDK_16.04 {
rte_eal_pci_ioport_write;
rte_eal_pci_map_device;
rte_eal_pci_unmap_device;
+   rte_eal_primary_proc_alive;

 } DPDK_2.2;
diff --git a/lib/librte_eal/common/include/rte_eal.h 
b/lib/librte_eal/common/include/rte_eal.h
index 0e99c31..a71d6f5 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -156,6 +156,24 @@ int rte_eal_iopl_init(void);
  *   - On failure, a negative error value.
  */
 int rte_eal_init(int argc, char **argv);
+
+/**
+ * Check if a primary process is currently alive
+ *
+ * This function returns true when a primary process is currently
+ * active.
+ *
+ * @param config_file_path
+ *   The config_file_path argument provided should point at the location
+ *   that the primary process will create its config file. If NULL, the default
+ *   config file path is used.
+ *
+ * @return
+ *  - If alive, returns 1.
+ *  - If dead, returns 0.
+ */
+int rte_eal_primary_proc_alive(const char *config_file_path);
+
 /**
  * Usage function typedef used by the application usage function.
  *
diff --git a/lib/librte_eal/linuxapp/eal/Makefile 
b/lib/librte_eal/linuxapp/eal/Makefile
index c5490e4..d72f035 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -89,6 +89,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_proc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_malloc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_elem.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_heap.c
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map 
b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 

[dpdk-dev] [PATCH v7 1/2] eal: fix race-condition in pri/sec proc startup

2016-03-08 Thread Harry van Haaren
This patch fixes a race-condition when a primary and
secondary process simultaneously probe PCI devices.

This is implemented by moving the rte_eal_mcfg_complete()
function call in rte_eal_init() until after rte_eal_pci_probe().

The end result is that the secondary process waits longer,
until the primary has completed its PCI probing, and then
notifies the secondary process.

This race-condition became visible during the development of
a function that allows a secondary process to be polling until
a primary process exists. The secondary would then probe PCI
devices at the same time, causing an error during rte_eal_init()

Linux EAL:
Fixes: 916e4f4f4e45 ("memory: fix for multi process support")

BSD EAL:
Fixes: 764bf26873b9 ("add FreeBSD support")

Signed-off-by: Harry van Haaren 
---
 lib/librte_eal/bsdapp/eal/eal.c   | 6 +++---
 lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index a34e61d..06bfd4e 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright(c) 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -569,8 +569,6 @@ rte_eal_init(int argc, char **argv)

eal_check_mem_on_local_socket();

-   rte_eal_mcfg_complete();
-
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");

@@ -621,6 +619,8 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_pci_probe())
rte_panic("Cannot probe PCI\n");

+   rte_eal_mcfg_complete();
+
return fctret;
 }

diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index ceac435..364f303 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright(c) 2012-2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -821,8 +821,6 @@ rte_eal_init(int argc, char **argv)

eal_check_mem_on_local_socket();

-   rte_eal_mcfg_complete();
-
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");

@@ -880,6 +878,8 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_pci_probe())
rte_panic("Cannot probe PCI\n");

+   rte_eal_mcfg_complete();
+
return fctret;
 }

-- 
2.5.0



[dpdk-dev] [PATCH v7 0/2] eal: add function to check primary alive

2016-03-08 Thread Harry van Haaren
The first patch of this patchset contains a fix for EAL PCI probing,
to avoid a race-condition where a primary and secondary probe PCI
devices at the same time.

The second patch adds a function that can be polled by a process to
detect if a DPDK primary process is alive. This function does not
rely on rte_eal_init(), as this uses the EAL and thus stops a
primary from starting.

The functionality provided by this patch is very useful for providing
additional services to DPDK primary applications such as monitoring
statistics and performing fault detection.

Harry van Haaren (2):
  eal: fix race-condition in pri/sec proc startup
  eal: add function to check if primary proc alive

 doc/guides/rel_notes/release_16_04.rst  |  8 
 lib/librte_eal/bsdapp/eal/Makefile  |  1 +
 lib/librte_eal/bsdapp/eal/eal.c |  6 +++---
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 +
 lib/librte_eal/common/include/rte_eal.h | 20 +++-
 lib/librte_eal/linuxapp/eal/Makefile|  3 ++-
 lib/librte_eal/linuxapp/eal/eal.c   |  6 +++---
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +
 8 files changed, 38 insertions(+), 8 deletions(-)

-- 
2.5.0



[dpdk-dev] [PATCH v2 1/5] mem: add --single-file to create single mem-backed file

2016-03-08 Thread Yuanhan Liu
On Tue, Mar 08, 2016 at 10:49:30AM +0200, Panu Matilainen wrote:
> On 03/07/2016 03:13 PM, Yuanhan Liu wrote:
> >To me, maybe you could base the SINGLE_FILE_SEGMENTS option, and add
> >another option, say --no-sort (I confess this name sucks, but you get
> >my point). With that, we could make sure to create as least huge page
> >files as possible, to fit your case.
> 
> Note that SINGLE_FILE_SEGMENTS is a nasty hack that only the IVSHMEM config
> uses, getting rid of it (by replacing with a runtime switch) would be great.

Can't agree more.

BTW, FYI, Jianfeng and I had a private talk, and we came to agree that
it might be better to handle it outside the normal huge page init stage,
just like this patch does, but adding the support of multiple huge page
sizes. Let's not add more messy code there.

--yliu

> OTOH IVSHMEM itself seems to have fallen out of the fashion since the memnic
> driver is unmaintained and broken since dpdk 2.0... CC'ing the IVSHMEM
> maintainer in case he has thoughts on this.


[dpdk-dev] [PATCH v4 4/4] virtio: return 1 to tell the upper layer we don't take over this device

2016-03-08 Thread Xie, Huawei
On 3/1/2016 6:09 PM, Xie, Huawei wrote:
> On 3/1/2016 5:57 PM, Thomas Monjalon wrote:
>> 2016-03-01 08:39, Xie, Huawei:
>>> On 3/1/2016 4:24 PM, Thomas Monjalon wrote:
 2016-03-01 07:53, Xie, Huawei:
> On 3/1/2016 3:18 PM, Thomas Monjalon wrote:
>> 2016-02-26 09:53, Huawei Xie:
>>> @@ -1037,8 +1039,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
>>>  
>>> pci_dev = eth_dev->pci_dev;
>>>  
>>> -   if (vtpci_init(pci_dev, hw) < 0)
>>> -   return -1;
>>> +   ret = vtpci_init(pci_dev, hw);
>>> +   if (ret) {
>>> +   rte_free(eth_dev->data->mac_addrs);
>> The freeing seems not related to this patch.
> I can send a separate patch, ok within this patchset?
 Yes

>> [...]
>>> PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
>>> -   if (legacy_virtio_resource_init(dev, hw) < 0)
>>> +   if (legacy_virtio_resource_init(dev, hw) < 0) {
>>> +   if (dev->kdrv == RTE_KDRV_UNKNOWN) {
>>> +   PMD_INIT_LOG(INFO,
>>> +   "skip kernel managed virtio device.");
>>> +   return 1;
>>> +   }
>>> return -1;
>>> +   }
>> You cannot skip a device if it was whitelisted.
>> I think you should check RTE_DEVTYPE_WHITELISTED_PCI and throw an error
>> in this case.
> I feel there is a subtle difference on the understanding of -w args. To
> me, without it, probe all devices; with it, only probe whiltelisted API.
> That is all.
 I don't know if it is clearly documented indeed.

> Do you mean that -w implies that devices whitelisted must be probed
> successfully otherwise we throw an error? If i get it right, then what
> about the devices whitelisted but without PMD driver?
 Yes we should probably consider the whitelist as a "forced" init.
 Later, we could introduce some device flags for probing/discovery:
 PROBE_AUTO, PROBE_FORCE, PROBE_IGNORE. It would make white/black list
 more precise.

> I will fix, :).
> if (dev->kdrv == RTE_KDRV_UNKNOWN && dev->devargs->type !=
> RTE_DEVTYPE_WHITELISTED_PCI) {
> 
> return 1;
> }
 You should also consider the blacklist case: if there is a blacklist,
 the not blacklisted devices must be initialised or throw an error.

>>> Don't we already skip probing the blacklisted device in
>>> rte_eal_pci_probe_one_driver?
>> Yes, I'm talking about the devices which are not blacklisted.
>> Having some blacklisted devices imply that others are implicitly whitelisted.
> For blacklist, it only means the blacklisted device should be excluded
> from being probed. It doesn't mean all other devices should be probed
> either successfully or otherwise throw an error which cause DPDK exit.
> Even that, the upper layer should explicitly put the non-blacklisted
> device into whitelist, i mean here we should only deal with whitelist.

Thomas, comments?
Btw, i have reworked the patch, but git am always complains patch format
detection failed. Investigating. Will send it later.

>



[dpdk-dev] [PATCH] doc: add szedata2 features into networking driver matrix

2016-03-08 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 doc/guides/nics/overview.rst | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index d4c6ff4..177393a 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -86,17 +86,17 @@ Most of these differences are summarized below.
 e   e   e   e   e  
 e
 c   c   c   c   c  
 c
 = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-   link status
+   link status  X
link status event
Rx interrupt
-   queue start/stop
+   queue start/stop X
MTU update
jumbo frame
-   scattered Rx
+   scattered Rx X
LRO
TSO
-   promiscuous mode
-   allmulticast mode
+   promiscuous mode X
+   allmulticast modeX
unicast MAC filter
multicast MAC filter
RSS hash
@@ -125,23 +125,23 @@ Most of these differences are summarized below.
inner L4 checksum
packet type parsing
timesync
-   basic stats
+   basic stats  X
extended stats
-   stats per queue
+   stats per queue  X
EEPROM dump
registers dump
multiprocess aware
BSD nic_uio
Linux UIO
Linux VFIO
-   other kdrv
+   other kdrv   X
ARMv7
ARMv8
Power8
TILE-Gx
x86-32
-   x86-64
-   usage doc
+   x86-64   X
+   usage docX
design doc
perf doc
 = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-- 
1.9.1



[dpdk-dev] [PATCH] vhost: fix build error for old kernels

2016-03-08 Thread Yuanhan Liu
VIRTIO_NET_F_GUEST_ANNOUNCE is a new feature introduced since kernel
v3.5. For older kernels (or more precisely, old distributions), we
could simply define it manually, to fix the "macro not defined" error.

Fixes: d293dac8f30e ("vhost: claim support of guest announce")

Signed-off-by: Yuanhan Liu 
---
 lib/librte_vhost/rte_virtio_net.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_vhost/rte_virtio_net.h 
b/lib/librte_vhost/rte_virtio_net.h
index 7d1fde2..443245d 100644
--- a/lib/librte_vhost/rte_virtio_net.h
+++ b/lib/librte_vhost/rte_virtio_net.h
@@ -97,6 +97,11 @@ struct vhost_virtqueue {
struct buf_vector   buf_vec[BUF_VECTOR_MAX];/**< for 
scatter RX. */
 } __rte_cache_aligned;

+/* Old kernels have no such macro defined */
+#ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
+ #define VIRTIO_NET_F_GUEST_ANNOUNCE 21
+#endif
+

 /*
  * Make an extra wrapper for VIRTIO_NET_F_MQ and
-- 
1.9.0



[dpdk-dev] [PATCH v2] ixgbe: fix ixgbevf RX/TX function assignment

2016-03-08 Thread Zhe Tao
For the secondary process of DPDK to initialize ixgbevf, it will always
use the simple RX function or LRO RX function, and this behavior is not
the same RX/TX function selection logic as it is for the primary process,
so use the ixgbe_set_tx_function and ixgbe_set_rx_function to select the
RX/TX function when secondary process call the init function for eth dev.  

Fixes: abf7275bbaa2918 (ixgbe: move to drivers/net/)

V2:add fixes line

Signed-off-by: Zhe Tao 

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3e6fe86..0f9d048 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1278,8 +1278,21 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 * has already done this work. Only check we don't need a different
 * RX function */
if (rte_eal_process_type() != RTE_PROC_PRIMARY){
-   if (eth_dev->data->scattered_rx)
-   eth_dev->rx_pkt_burst = 
ixgbe_recv_pkts_lro_single_alloc;
+   struct ixgbe_tx_queue *txq;
+   /* TX queue function in primary, set by last queue initialized
+* Tx queue may not initialized by primary process
+*/
+   if (eth_dev->data->tx_queues) {
+   txq = 
eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
+   ixgbe_set_tx_function(eth_dev, txq);
+   } else {
+   /* Use default TX function if we get here */
+   PMD_INIT_LOG(NOTICE, "No TX queues configured yet. "
+"Using default TX function.");
+   }
+
+   ixgbe_set_rx_function(eth_dev);
+
return 0;
}

-- 
2.1.4



[dpdk-dev] [PATCH v2] eal: make hugetlb initialization more robust

2016-03-08 Thread Tan, Jianfeng


On 3/8/2016 9:42 AM, Jianfeng Tan wrote:
> This patch adds an option, --huge-trybest, to use a recover mechanism to
> the case that there are not so many hugepages (declared in sysfs), which
> can be used. It relys on a mem access to fault-in hugepages, and if fails
> with SIGBUS, recover to previously saved stack environment with
> siglongjmp().
>
> Test example:
>a. cgcreate -g hugetlb:/test-subgroup
>b. cgset -r hugetlb.1GB.limit_in_bytes=2147483648 test-subgroup
>c. cgexec -g hugetlb:test-subgroup \
> ./examples/helloworld/build/helloworld -c 0x2 -n 4 --huge-trybest
>
> Signed-off-by: Jianfeng Tan 

Sorry, forgot to add ack from Neil.
Acked-by: Neil Horman 

> ---
> v2:
>   - Address the compiling error by move setjmp into a wrap method.
>
>   lib/librte_eal/common/eal_common_options.c |   4 ++
>   lib/librte_eal/common/eal_internal_cfg.h   |   1 +
>   lib/librte_eal/common/eal_options.h|   2 +
>   lib/librte_eal/linuxapp/eal/eal.c  |   1 +
>   lib/librte_eal/linuxapp/eal/eal_memory.c   | 104 
> ++---
>   5 files changed, 104 insertions(+), 8 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_options.c 
> b/lib/librte_eal/common/eal_common_options.c
> index 29942ea..8ff6a2e 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -95,6 +95,7 @@ eal_long_options[] = {
>   {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM},
>   {OPT_VMWARE_TSC_MAP,0, NULL, OPT_VMWARE_TSC_MAP_NUM   },
>   {OPT_XEN_DOM0,  0, NULL, OPT_XEN_DOM0_NUM },
> + {OPT_HUGE_TRYBEST,  0, NULL, OPT_HUGE_TRYBEST_NUM },
>   {0, 0, NULL, 0}
>   };
>   
> @@ -896,6 +897,9 @@ eal_parse_common_option(int opt, const char *optarg,
>   return -1;
>   }
>   break;
> + case OPT_HUGE_TRYBEST_NUM:
> + internal_config.huge_trybest = 1;
> + break;
>   
>   /* don't know what to do, leave this to caller */
>   default:
> diff --git a/lib/librte_eal/common/eal_internal_cfg.h 
> b/lib/librte_eal/common/eal_internal_cfg.h
> index 5f1367e..90a3533 100644
> --- a/lib/librte_eal/common/eal_internal_cfg.h
> +++ b/lib/librte_eal/common/eal_internal_cfg.h
> @@ -64,6 +64,7 @@ struct internal_config {
>   volatile unsigned force_nchannel; /**< force number of channels */
>   volatile unsigned force_nrank;/**< force number of ranks */
>   volatile unsigned no_hugetlbfs;   /**< true to disable hugetlbfs */
> + volatile unsigned huge_trybest;   /**< try best to allocate hugepages */
>   unsigned hugepage_unlink; /**< true to unlink backing files */
>   volatile unsigned xen_dom0_support; /**< support app running on Xen 
> Dom0*/
>   volatile unsigned no_pci; /**< true to disable PCI */
> diff --git a/lib/librte_eal/common/eal_options.h 
> b/lib/librte_eal/common/eal_options.h
> index a881c62..02397c5 100644
> --- a/lib/librte_eal/common/eal_options.h
> +++ b/lib/librte_eal/common/eal_options.h
> @@ -83,6 +83,8 @@ enum {
>   OPT_VMWARE_TSC_MAP_NUM,
>   #define OPT_XEN_DOM0  "xen-dom0"
>   OPT_XEN_DOM0_NUM,
> +#define OPT_HUGE_TRYBEST  "huge-trybest"
> + OPT_HUGE_TRYBEST_NUM,
>   OPT_LONG_MAX_NUM
>   };
>   
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
> b/lib/librte_eal/linuxapp/eal/eal.c
> index ceac435..3e23877 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -343,6 +343,7 @@ eal_usage(const char *prgname)
>  "  --"OPT_CREATE_UIO_DEV"Create /dev/uioX (usually done by 
> hotplug)\n"
>  "  --"OPT_VFIO_INTR" Interrupt mode for VFIO 
> (legacy|msi|msix)\n"
>  "  --"OPT_XEN_DOM0"  Support running on Xen dom0 without 
> hugetlbfs\n"
> +"  --"OPT_HUGE_TRYBEST"  Try best to accommodate hugepages\n"
>  "\n");
>   /* Allow the application to print its usage message too if hook is set 
> */
>   if ( rte_application_usage_hook ) {
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
> b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index 5b9132c..e4e1f3b 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -80,6 +80,8 @@
>   #include 
>   #include 
>   #include 
> +#include 
> +#include 
>   
>   #include 
>   #include 
> @@ -309,6 +311,21 @@ get_virtual_area(size_t *size, size_t hugepage_sz)
>   return addr;
>   }
>   
> +static sigjmp_buf jmpenv;
> +
> +static void sigbus_handler(int signo __rte_unused)
> +{
> + siglongjmp(jmpenv, 1);
> +}
> +
> +/* Put setjmp into a wrap method to avoid compiling error. Any non-volatile,
> + * non-static local variable in the stack frame calling setjmp might be
> + * clobbered by a call to longjmp.
> + */
> +static int wrap_setjmp(void)
> +{
> + 

[dpdk-dev] [PATCH v3 00/18] fm10k: update shared code

2016-03-08 Thread Bruce Richardson
On Mon, Feb 29, 2016 at 02:30:45AM +, Ding, HengX wrote:
> Tested-by: Heng Ding 
> 
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Wang Xiao W
> Sent: Friday, February 19, 2016 7:07 PM
> To: Chen, Jing D
> Cc: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v3 00/18] fm10k: update shared code
> 
> v3:
> * Fixed checkpatch.pl warning about long commit message.
> * Fixed the issue of compile failure about part of patches applied.
> * Split the misc-small-fixes patch into several patches.
> 
> v2:
> * Put the two extra fix patches ahead of the base code patches.
> 
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH 3/3] qat: fixes premature addition of AES_CMAC in session creation

2016-03-08 Thread John Griffin
Remove support for AES CMAC support for which was added to
the code in error.  AES CMAC will be added in a subsequent release
when testing completes.

Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices")

Signed-off-by: John Griffin 
---
 drivers/crypto/qat/qat_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 48e810f..366a064 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -295,7 +295,6 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev 
*dev,
session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC;
break;
case RTE_CRYPTO_AUTH_AES_GCM:
-   case RTE_CRYPTO_AUTH_AES_GMAC:
session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_GALOIS_128;
break;
case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
@@ -312,6 +311,7 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev 
*dev,
case RTE_CRYPTO_AUTH_MD5:
case RTE_CRYPTO_AUTH_MD5_HMAC:
case RTE_CRYPTO_AUTH_AES_CCM:
+   case RTE_CRYPTO_AUTH_AES_GMAC:
case RTE_CRYPTO_AUTH_KASUMI_F9:
case RTE_CRYPTO_AUTH_AES_CMAC:
case RTE_CRYPTO_AUTH_AES_CBC_MAC:
-- 
2.1.0



[dpdk-dev] [PATCH 2/3] app/test: add AES GCM tests for QAT

2016-03-08 Thread John Griffin
Signed-off-by: John Griffin 
---
 app/test/test_cryptodev.c | 34 +-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index d7e80c4..a5d4208 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -3420,6 +3420,39 @@ static struct unit_test_suite cryptodev_qat_testsuite  = 
{
TEST_CASE_ST(ut_setup, ut_teardown,

test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify),
TEST_CASE_ST(ut_setup, ut_teardown, test_stats),
+
+   /** AES GCM Authenticated Encryption */
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_encryption_test_case_1),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_encryption_test_case_2),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_encryption_test_case_3),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_encryption_test_case_4),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_encryption_test_case_5),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_encryption_test_case_6),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_encryption_test_case_7),
+
+   /** AES GCM Authenticated Decryption */
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_decryption_test_case_1),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_decryption_test_case_2),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_decryption_test_case_3),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_decryption_test_case_4),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_decryption_test_case_5),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_decryption_test_case_6),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_mb_AES_GCM_authenticated_decryption_test_case_7),
+
/** Snow3G encrypt only (UEA2) */
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_encryption_test_case_1),
@@ -3432,7 +3465,6 @@ static struct unit_test_suite cryptodev_qat_testsuite  = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_encryption_test_case_5),

-
/** Snow3G decrypt only (UEA2) */
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_decryption_test_case_1),
-- 
2.1.0



[dpdk-dev] [PATCH 1/3] qat: fix AES GCM decryption

2016-03-08 Thread John Griffin
AES GCM on the cryptodev API was giving invalid results
in some cases, due to an incorrect IV setting.

Added AES GCM in the QAT supported algorithms,
as encryption/decryption is fully functional.

Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices")

Signed-off-by: John Griffin 
---
 doc/guides/cryptodevs/qat.rst  |  1 +
 doc/guides/rel_notes/release_16_04.rst |  5 +
 drivers/crypto/qat/qat_crypto.c| 22 +++---
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index af52047..ec4d6c6 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -48,6 +48,7 @@ Cipher algorithms:
 * ``RTE_CRYPTO_SYM_CIPHER_AES192_CBC``
 * ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC``
 * ``RTE_CRYPTO_SYM_CIPHER_SNOW3G_UEA2``
+* ``RTE_CRYPTO_CIPHER_AES_GCM``

 Hash algorithms:

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index d7a264a..ee8d141 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -99,6 +99,11 @@ Drivers
   This made impossible the creation of more than one aesni_mb device
   from command line.

+* **qat: Fixed AES GCM decryption.**
+
+  Allowed AES GCM on the cryptodev API, but in some cases gave invalid results
+  due to incorrect IV setting.
+

 Libraries
 ~
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index cb16aae..48e810f 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -529,11 +529,27 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t 
*out_msg)
auth_param->u1.aad_adr = op->sym->auth.aad.phys_addr;
/* (GCM) aad length(240 max) will be at this location after precompute 
*/
if (ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ||
-   ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_64) {
-   auth_param->u2.aad_sz =
-   ALIGN_POW2_ROUNDUP(ctx->cd.hash.sha.state1[
+   ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_64) {
+   struct icp_qat_hw_auth_algo_blk *hash;
+
+   if (ctx->qat_cmd == ICP_QAT_FW_LA_CMD_HASH_CIPHER)
+   hash = (struct icp_qat_hw_auth_algo_blk *)((char 
*)>cd);
+   else
+   hash = (struct icp_qat_hw_auth_algo_blk *)((char 
*)>cd +
+   sizeof(struct icp_qat_hw_cipher_algo_blk));
+
+   auth_param->u2.aad_sz = ALIGN_POW2_ROUNDUP(hash->sha.state1[
ICP_QAT_HW_GALOIS_128_STATE1_SZ +
ICP_QAT_HW_GALOIS_H_SZ + 3], 16);
+   if (op->sym->cipher.iv.length == 12) {
+   /*
+* For GCM a 12 bit IV is allowed,
+* but we need to inform the f/w
+*/
+   ICP_QAT_FW_LA_GCM_IV_LEN_FLAG_SET(
+   qat_req->comn_hdr.serv_specif_flags,
+   ICP_QAT_FW_LA_GCM_IV_LEN_12_OCTETS);
+   }
}
auth_param->hash_state_sz = (auth_param->u2.aad_sz) >> 3;

-- 
2.1.0



[dpdk-dev] [PATCH 0/3] AES GCM, AES CMAC fixes and addition of GCM tests for QAT.

2016-03-08 Thread John Griffin
This patchset solves an issue in QAT driver, that was giving
invalid AES GCM results, due to incorrect IV setting.

It adds unit tests to validate AES GCM in QAT.

It also fixes the premature addition of AES CMAC support which was added to
the code in error.  AES CMAC will be added in a subsequent release
when testing completes.
AES CMAC was not advertised in the qat documentation.

This patchset depends on patches:
- aesni_gcm: PMD to support AES_GCM crypto operations
  (http://dpdk.org/dev/patchwork/patch/11201/)

John Griffin (3):
  qat: fix AES GCM decryption
  app/test: add AES GCM tests for QAT
  qat: fixes premature addition of AES_CMAC in session

 app/test/test_cryptodev.c  | 34 +-
 doc/guides/cryptodevs/qat.rst  |  1 +
 doc/guides/rel_notes/release_16_04.rst |  5 +
 drivers/crypto/qat/qat_crypto.c| 24 
 4 files changed, 59 insertions(+), 5 deletions(-)

-- 
2.1.0



[dpdk-dev] [PATCH v5 29/29] i40evf: use base driver defined interface

2016-03-08 Thread Helin Zhang
It removes the i40evf_set_mac_type() defined in PMD, and reuses
i40e_set_mac_type() defined in base driver.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/i40e_ethdev_vf.c | 22 +-
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c 
b/drivers/net/i40e/i40e_ethdev_vf.c
index bd5c091..4fdbdf3 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -216,26 +216,6 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
.rss_hash_conf_get= i40evf_dev_rss_hash_conf_get,
 };

-static int
-i40evf_set_mac_type(struct i40e_hw *hw)
-{
-   int status = I40E_ERR_DEVICE_NOT_SUPPORTED;
-
-   if (hw->vendor_id == I40E_INTEL_VENDOR_ID) {
-   switch (hw->device_id) {
-   case I40E_DEV_ID_VF:
-   case I40E_DEV_ID_VF_HV:
-   hw->mac.type = I40E_MAC_VF;
-   status = I40E_SUCCESS;
-   break;
-   default:
-   ;
-   }
-   }
-
-   return status;
-}
-
 /*
  * Parse admin queue message.
  *
@@ -1183,7 +1163,7 @@ i40evf_init_vf(struct rte_eth_dev *dev)

vf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
vf->dev_data = dev->data;
-   err = i40evf_set_mac_type(hw);
+   err = i40e_set_mac_type(hw);
if (err) {
PMD_INIT_LOG(ERR, "set_mac_type failed: %d", err);
goto err;
-- 
2.5.0



[dpdk-dev] [PATCH v5 28/29] i40e: add base driver release info

2016-03-08 Thread Helin Zhang
It adds base driver release information such as release date,
for better tracking in the future.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 033ee4a..6dd6eaa 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -85,6 +85,7 @@ VPATH += $(SRCDIR)/base

 #
 # all source are stored in SRCS-y
+# base driver is based on the package of dpdk-i40e.2016.01.07.14.tar.gz.
 #
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_adminq.c
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_common.c
-- 
2.5.0



[dpdk-dev] [PATCH v5 27/29] i40e: update structure and macro definitions

2016-03-08 Thread Helin Zhang
Several structures and macros are added or updated, such
as 'struct i40e_aqc_get_link_status',
'struct i40e_aqc_run_phy_activity' and
'struct i40e_aqc_lldp_set_local_mib_resp'.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 doc/guides/rel_notes/release_16_04.rst  |  9 +++
 drivers/net/i40e/base/i40e_adminq_cmd.h | 45 ++---
 drivers/net/i40e/base/i40e_type.h   |  5 ++--
 drivers/net/i40e/i40e_ethdev.c  |  2 +-
 4 files changed, 53 insertions(+), 8 deletions(-)

v4:
 - Reworded the commit logs.
 - Moved new feature announcement in release notes to this patch.

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 165533f..8bda16c 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -74,6 +74,15 @@ This section should contain new features added in this 
release. Sample format:

 * **szedata2: Add functions for setting link up/down.**

+* **Updated the i40e base driver.**
+
+  The i40e base driver was updated with changes including the
+  following:
+
+  * Use rx control AQ commands to read/write rx control registers.
+  * Add new X722 device IDs, and removed X710 one was never used.
+  * Expose registers for HASH/FD input set configuring.
+

 Resolved Issues
 ---
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 5236333..fe9d5b5 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
  */

 #define I40E_FW_API_VERSION_MAJOR  0x0001
-#define I40E_FW_API_VERSION_MINOR  0x0004
+#define I40E_FW_API_VERSION_MINOR  0x0005

 struct i40e_aq_desc {
__le16 flags;
@@ -242,6 +242,7 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_get_phy_wol_caps   = 0x0621,
i40e_aqc_opc_set_phy_debug  = 0x0622,
i40e_aqc_opc_upload_ext_phy_fm  = 0x0625,
+   i40e_aqc_opc_run_phy_activity   = 0x0626,

/* NVM commands */
i40e_aqc_opc_nvm_read   = 0x0701,
@@ -915,6 +916,10 @@ struct i40e_aqc_vsi_properties_data {
 I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT)
/* queueing option section */
u8  queueing_opt_flags;
+#ifdef X722_SUPPORT
+#define I40E_AQ_VSI_QUE_OPT_MULTICAST_UDP_ENA  0x04
+#define I40E_AQ_VSI_QUE_OPT_UNICAST_UDP_ENA0x08
+#endif
 #define I40E_AQ_VSI_QUE_OPT_TCP_ENA0x10
 #define I40E_AQ_VSI_QUE_OPT_FCOE_ENA   0x20
 #ifdef X722_SUPPORT
@@ -1349,10 +1354,16 @@ struct i40e_aqc_add_remove_cloud_filters_element_data {

 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT  9
 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK   0x1E00
-#define I40E_AQC_ADD_CLOUD_TNL_TYPE_XVLAN  0
+#define I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN  0
 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC 1
-#define I40E_AQC_ADD_CLOUD_TNL_TYPE_NGE2
+#define I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE 2
 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_IP 3
+#define I40E_AQC_ADD_CLOUD_TNL_TYPE_RESERVED   4
+#define I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN_GPE  5
+
+#define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_OUTER_MAC  0x2000
+#define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_INNER_MAC  0x4000
+#define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_OUTER_IP   0x8000

__le32  tenant_id;
u8  reserved[4];
@@ -1846,7 +1857,12 @@ struct i40e_aqc_get_link_status {
u8  config;
 #define I40E_AQ_CONFIG_CRC_ENA 0x04
 #define I40E_AQ_CONFIG_PACING_MASK 0x78
-   u8  reserved[5];
+   u8  external_power_ability;
+#define I40E_AQ_LINK_POWER_CLASS_1 0x00
+#define I40E_AQ_LINK_POWER_CLASS_2 0x01
+#define I40E_AQ_LINK_POWER_CLASS_3 0x02
+#define I40E_AQ_LINK_POWER_CLASS_4 0x03
+   u8  reserved[4];
 };

 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_link_status);
@@ -1914,6 +1930,18 @@ enum i40e_aq_phy_reg_type {
I40E_AQC_PHY_REG_EXERNAL_MODULE = 0x3
 };

+/* Run PHY Activity (0x0626) */
+struct i40e_aqc_run_phy_activity {
+   __le16  activity_id;
+   u8  flags;
+   u8  reserved1;
+   __le32  control;
+   __le32  data;
+   u8  reserved2[4];
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_run_phy_activity);
+
 /* NVM Read command (indirect 0x0701)
  * NVM Erase commands (direct 0x0702)
  * NVM Update commands (indirect 0x0703)
@@ -2262,6 +2290,14 @@ struct i40e_aqc_lldp_set_local_mib {

 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_set_local_mib);

+struct i40e_aqc_lldp_set_local_mib_resp {
+#define SET_LOCAL_MIB_RESP_EVENT_TRIGGERED_MASK  0x01
+   u8  status;
+   u8  reserved[15];
+};
+
+I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_lldp_set_local_mib_resp);
+
 /* Stop/Start LLDP Agent (direct 0x0A09)
  * Used for stopping/starting specific LLDP agent. e.g. DCBx
  */

[dpdk-dev] [PATCH v5 26/29] i40e/base: add AQ thermal sensor control struct

2016-03-08 Thread Helin Zhang
It adds the new AQ command and struct for managing a
thermal sensor.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 12ebd35..5236333 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -250,6 +250,7 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_nvm_config_read= 0x0704,
i40e_aqc_opc_nvm_config_write   = 0x0705,
i40e_aqc_opc_oem_post_update= 0x0720,
+   i40e_aqc_opc_thermal_sensor = 0x0721,

/* virtualization commands */
i40e_aqc_opc_send_msg_to_pf = 0x0801,
@@ -2001,6 +2002,22 @@ struct i40e_aqc_nvm_oem_post_update_buffer {

 I40E_CHECK_STRUCT_LEN(0x28, i40e_aqc_nvm_oem_post_update_buffer);

+/* Thermal Sensor (indirect 0x0721)
+ * read or set thermal sensor configs and values
+ * takes a sensor and command specific data buffer, not detailed here
+ */
+struct i40e_aqc_thermal_sensor {
+   u8 sensor_action;
+#define I40E_AQ_THERMAL_SENSOR_READ_CONFIG 0
+#define I40E_AQ_THERMAL_SENSOR_SET_CONFIG  1
+#define I40E_AQ_THERMAL_SENSOR_READ_TEMP   2
+   u8 reserved[7];
+   __le32  addr_high;
+   __le32  addr_low;
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_thermal_sensor);
+
 /* Send to PF command (indirect 0x0801) id is only used by PF
  * Send to VF command (indirect 0x0802) id is only used by PF
  * Send to Peer PF command (indirect 0x0803)
-- 
2.5.0



[dpdk-dev] [PATCH v5 25/29] i40e/base: add a new Virtchnl offload

2016-03-08 Thread Helin Zhang
X722 supports Expanded version of TCP, UDP PCTYPES for RSS.
Add a Virtchnl offload to support this.
Without this patch VF drivers will not be able to support
the correct PCTYPES for X722 and UDP flows will not fan out.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_virtchnl.h | 1 +
 1 file changed, 1 insertion(+)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_virtchnl.h 
b/drivers/net/i40e/base/i40e_virtchnl.h
index 8106582..26208f3 100644
--- a/drivers/net/i40e/base/i40e_virtchnl.h
+++ b/drivers/net/i40e/base/i40e_virtchnl.h
@@ -163,6 +163,7 @@ struct i40e_virtchnl_vsi_resource {
 #define I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x0020
 #define I40E_VIRTCHNL_VF_OFFLOAD_VLAN  0x0001
 #define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING0x0002
+#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x0004

 struct i40e_virtchnl_vf_resource {
u16 num_vsis;
-- 
2.5.0



[dpdk-dev] [PATCH v5 24/29] i40e: expose some registers

2016-03-08 Thread Helin Zhang
This patch adds 7 new register definitions for programming the
parser, flow director and RSS blocks in the HW.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_register.h | 48 +++
 drivers/net/i40e/i40e_ethdev.c| 11 ++--
 2 files changed, 50 insertions(+), 9 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_register.h 
b/drivers/net/i40e/base/i40e_register.h
index 6e56620..fd0a723 100644
--- a/drivers/net/i40e/base/i40e_register.h
+++ b/drivers/net/i40e/base/i40e_register.h
@@ -2056,6 +2056,14 @@ POSSIBILITY OF SUCH DAMAGE.
 #define I40E_PRTPM_TLPIC  0x001E43C0 /* Reset: GLOBR */
 #define I40E_PRTPM_TLPIC_ETLPIC_SHIFT 0
 #define I40E_PRTPM_TLPIC_ETLPIC_MASK  I40E_MASK(0x, 
I40E_PRTPM_TLPIC_ETLPIC_SHIFT)
+#define I40E_GL_PRS_FVBM(_i) (0x00269760 + ((_i) * 4)) /* 
_i=0...3 */ /* Reset: CORER */
+#define I40E_GL_PRS_FVBM_MAX_INDEX   3
+#define I40E_GL_PRS_FVBM_FV_BYTE_INDX_SHIFT  0
+#define I40E_GL_PRS_FVBM_FV_BYTE_INDX_MASK   I40E_MASK(0x7F, 
I40E_GL_PRS_FVBM_FV_BYTE_INDX_SHIFT)
+#define I40E_GL_PRS_FVBM_RULE_BUS_INDX_SHIFT 8
+#define I40E_GL_PRS_FVBM_RULE_BUS_INDX_MASK  I40E_MASK(0x3F, 
I40E_GL_PRS_FVBM_RULE_BUS_INDX_SHIFT)
+#define I40E_GL_PRS_FVBM_MSK_ENA_SHIFT   31
+#define I40E_GL_PRS_FVBM_MSK_ENA_MASKI40E_MASK(0x1, 
I40E_GL_PRS_FVBM_MSK_ENA_SHIFT)
 #define I40E_GLRPB_DPSS   0x000AC828 /* Reset: CORER */
 #define I40E_GLRPB_DPSS_DPS_TCN_SHIFT 0
 #define I40E_GLRPB_DPSS_DPS_TCN_MASK  I40E_MASK(0xF, 
I40E_GLRPB_DPSS_DPS_TCN_SHIFT)
@@ -2227,6 +2235,14 @@ POSSIBILITY OF SUCH DAMAGE.
 #define I40E_PRTQF_FD_FLXINSET_MAX_INDEX   63
 #define I40E_PRTQF_FD_FLXINSET_INSET_SHIFT 0
 #define I40E_PRTQF_FD_FLXINSET_INSET_MASK  I40E_MASK(0xFF, 
I40E_PRTQF_FD_FLXINSET_INSET_SHIFT)
+#define I40E_PRTQF_FD_INSET(_i, _j)  (0x0025 + ((_i) * 64 + (_j) * 
32)) /* _i=0...63, _j=0...1 */ /* Reset: CORER */
+#define I40E_PRTQF_FD_INSET_MAX_INDEX   63
+#define I40E_PRTQF_FD_INSET_INSET_SHIFT 0
+#define I40E_PRTQF_FD_INSET_INSET_MASK  I40E_MASK(0x, 
I40E_PRTQF_FD_INSET_INSET_SHIFT)
+#define I40E_PRTQF_FD_INSET(_i, _j)  (0x0025 + ((_i) * 64 + (_j) * 
32)) /* _i=0...63, _j=0...1 */ /* Reset: CORER */
+#define I40E_PRTQF_FD_INSET_MAX_INDEX   63
+#define I40E_PRTQF_FD_INSET_INSET_SHIFT 0
+#define I40E_PRTQF_FD_INSET_INSET_MASK  I40E_MASK(0x, 
I40E_PRTQF_FD_INSET_INSET_SHIFT)
 #define I40E_PRTQF_FD_MSK(_i, _j)   (0x00252000 + ((_i) * 64 + (_j) * 32)) 
/* _i=0...63, _j=0...1 */ /* Reset: CORER */
 #define I40E_PRTQF_FD_MSK_MAX_INDEX63
 #define I40E_PRTQF_FD_MSK_MASK_SHIFT   0
@@ -5169,6 +5185,38 @@ POSSIBILITY OF SUCH DAMAGE.
 #define I40E_GLQF_FD_PCTYPES_MAX_INDEX   63
 #define I40E_GLQF_FD_PCTYPES_FD_PCTYPE_SHIFT 0
 #define I40E_GLQF_FD_PCTYPES_FD_PCTYPE_MASK  I40E_MASK(0x3F, 
I40E_GLQF_FD_PCTYPES_FD_PCTYPE_SHIFT)
+#define I40E_GLQF_FD_MSK(_i, _j)   (0x00267200 + ((_i) * 4 + (_j) * 8)) /* 
_i=0...1, _j=0...63 */ /* Reset: CORER */
+#define I40E_GLQF_FD_MSK_MAX_INDEX1
+#define I40E_GLQF_FD_MSK_MASK_SHIFT   0
+#define I40E_GLQF_FD_MSK_MASK_MASKI40E_MASK(0x, 
I40E_GLQF_FD_MSK_MASK_SHIFT)
+#define I40E_GLQF_FD_MSK_OFFSET_SHIFT 16
+#define I40E_GLQF_FD_MSK_OFFSET_MASK  I40E_MASK(0x3F, 
I40E_GLQF_FD_MSK_OFFSET_SHIFT)
+#define I40E_GLQF_HASH_INSET(_i, _j)  (0x00267600 + ((_i) * 4 + (_j) * 8)) 
/* _i=0...1, _j=0...63 */ /* Reset: CORER */
+#define I40E_GLQF_HASH_INSET_MAX_INDEX   1
+#define I40E_GLQF_HASH_INSET_INSET_SHIFT 0
+#define I40E_GLQF_HASH_INSET_INSET_MASK  I40E_MASK(0x, 
I40E_GLQF_HASH_INSET_INSET_SHIFT)
+#define I40E_GLQF_HASH_MSK(_i, _j)   (0x00267A00 + ((_i) * 4 + (_j) * 8)) 
/* _i=0...1, _j=0...63 */ /* Reset: CORER */
+#define I40E_GLQF_HASH_MSK_MAX_INDEX1
+#define I40E_GLQF_HASH_MSK_MASK_SHIFT   0
+#define I40E_GLQF_HASH_MSK_MASK_MASKI40E_MASK(0x, 
I40E_GLQF_HASH_MSK_MASK_SHIFT)
+#define I40E_GLQF_HASH_MSK_OFFSET_SHIFT 16
+#define I40E_GLQF_HASH_MSK_OFFSET_MASK  I40E_MASK(0x3F, 
I40E_GLQF_HASH_MSK_OFFSET_SHIFT)
+#define I40E_GLQF_ORT(_i)   (0x00268900 + ((_i) * 4)) /* _i=0...63 
*/ /* Reset: CORER */
+#define I40E_GLQF_ORT_MAX_INDEX 63
+#define I40E_GLQF_ORT_PIT_INDX_SHIFT0
+#define I40E_GLQF_ORT_PIT_INDX_MASK I40E_MASK(0x1F, 
I40E_GLQF_ORT_PIT_INDX_SHIFT)
+#define I40E_GLQF_ORT_FIELD_CNT_SHIFT   5
+#define I40E_GLQF_ORT_FIELD_CNT_MASKI40E_MASK(0x3, 
I40E_GLQF_ORT_FIELD_CNT_SHIFT)
+#define I40E_GLQF_ORT_FLX_PAYLOAD_SHIFT 7
+#define I40E_GLQF_ORT_FLX_PAYLOAD_MASK  I40E_MASK(0x1, 
I40E_GLQF_ORT_FLX_PAYLOAD_SHIFT)
+#define I40E_GLQF_PIT(_i)  (0x00268C80 + ((_i) * 4)) /* _i=0...23 
*/ /* Reset: CORER */
+#define I40E_GLQF_PIT_MAX_INDEX23
+#define I40E_GLQF_PIT_SOURCE_OFF_SHIFT 0
+#define I40E_GLQF_PIT_SOURCE_OFF_MASK  I40E_MASK(0x1F, 
I40E_GLQF_PIT_SOURCE_OFF_SHIFT)
+#define I40E_GLQF_PIT_FSIZE_SHIFT  5

[dpdk-dev] [PATCH v5 23/29] i40e: use AQ rx control register read/write

2016-03-08 Thread Helin Zhang
RX control register read/write functions are added, as directly
read/write may fail when under stress small traffic. After the
adminq is ready, all rx control registers should be read/written
by dedicated functions.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 doc/guides/rel_notes/release_16_04.rst  |   6 ++
 drivers/net/i40e/base/i40e_adminq_cmd.h |  16 
 drivers/net/i40e/base/i40e_common.c | 126 +++-
 drivers/net/i40e/base/i40e_osdep.h  |  36 +
 drivers/net/i40e/base/i40e_prototype.h  |   8 ++
 drivers/net/i40e/i40e_ethdev.c  |  66 +
 drivers/net/i40e/i40e_ethdev_vf.c   |  28 +++
 drivers/net/i40e/i40e_fdir.c|  13 ++--
 drivers/net/i40e/i40e_pf.c  |   6 +-
 9 files changed, 248 insertions(+), 57 deletions(-)

v4:
 - Reworded the commit logs.
 - Merged all control register read/write code changes together.
 - Moved the annoucenment of fixes into this patch.

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 73494f9..165533f 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -137,6 +137,12 @@ Drivers

 * **vmxnet3: add TSO support.**

+* **i40e: Fixed failure of reading/writing rx control registers.**
+
+  Fixed i40e issue failing to read/write rx control registers when
+  under stress small traffic, which might result in application launch
+  failure.
+

 Libraries
 ~
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 165df9b..12ebd35 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -165,6 +165,8 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_set_port_parameters= 0x0203,
i40e_aqc_opc_get_switch_resource_alloc  = 0x0204,
i40e_aqc_opc_set_switch_config  = 0x0205,
+   i40e_aqc_opc_rx_ctl_reg_read= 0x0206,
+   i40e_aqc_opc_rx_ctl_reg_write   = 0x0207,

i40e_aqc_opc_add_vsi= 0x0210,
i40e_aqc_opc_update_vsi_parameters  = 0x0211,
@@ -752,6 +754,20 @@ struct i40e_aqc_set_switch_config {

 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_switch_config);

+/* Read Receive control registers  (direct 0x0206)
+ * Write Receive control registers (direct 0x0207)
+ * used for accessing Rx control registers that can be
+ * slow and need special handling when under high Rx load
+ */
+struct i40e_aqc_rx_ctl_reg_read_write {
+   __le32 reserved1;
+   __le32 address;
+   __le32 reserved2;
+   __le32 value;
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_rx_ctl_reg_read_write);
+
 /* Add VSI (indirect 0x0210)
  *this indirect command uses struct i40e_aqc_vsi_properties_data
  *as the indirect buffer (128 bytes)
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index e94f726..ef3425e 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -5356,7 +5356,7 @@ enum i40e_status_code i40e_set_filter_control(struct 
i40e_hw *hw,
return ret;

/* Read the PF Queue Filter control register */
-   val = rd32(hw, I40E_PFQF_CTL_0);
+   val = i40e_read_rx_ctl(hw, I40E_PFQF_CTL_0);

/* Program required PE hash buckets for the PF */
val &= ~I40E_PFQF_CTL_0_PEHSIZE_MASK;
@@ -5393,7 +5393,7 @@ enum i40e_status_code i40e_set_filter_control(struct 
i40e_hw *hw,
if (settings->enable_macvlan)
val |= I40E_PFQF_CTL_0_MACVLAN_ENA_MASK;

-   wr32(hw, I40E_PFQF_CTL_0, val);
+   i40e_write_rx_ctl(hw, I40E_PFQF_CTL_0, val);

return I40E_SUCCESS;
 }
@@ -6317,6 +6317,128 @@ restore_config:
return status;
 }
 #endif /* PF_DRIVER */
+
+/**
+ * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
+ * @hw: pointer to the hw struct
+ * @reg_addr: register address
+ * @reg_val: ptr to register value
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Use the firmware to read the Rx control register,
+ * especially useful if the Rx unit is under heavy pressure
+ **/
+enum i40e_status_code i40e_aq_rx_ctl_read_register(struct i40e_hw *hw,
+   u32 reg_addr, u32 *reg_val,
+   struct i40e_asq_cmd_details *cmd_details)
+{
+   struct i40e_aq_desc desc;
+   struct i40e_aqc_rx_ctl_reg_read_write *cmd_resp =
+   (struct i40e_aqc_rx_ctl_reg_read_write *)
+   enum i40e_status_code status;
+
+   if (reg_val == NULL)
+   return I40E_ERR_PARAM;
+
+   i40e_fill_default_direct_cmd_desc(, i40e_aqc_opc_rx_ctl_reg_read);
+
+   cmd_resp->address = CPU_TO_LE32(reg_addr);
+
+   status = i40e_asq_send_command(hw, , NULL, 0, cmd_details);
+
+   if (status == I40E_SUCCESS)
+   *reg_val = LE32_TO_CPU(cmd_resp->value);
+
+   

[dpdk-dev] [PATCH v5 22/29] i40e/base: coding style fixes

2016-03-08 Thread Helin Zhang
It adds coding style fixes.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_common.c | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 9a0b787..e94f726 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1540,9 +1540,11 @@ u32 i40e_led_get(struct i40e_hw *hw)
if (!gpio_val)
continue;

-   /* ignore gpio LED src mode entries related to the activity 
LEDs */
-   current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) 
>>
-   I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
+   /* ignore gpio LED src mode entries related to the activity
+*  LEDs
+*/
+   current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK)
+   >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
switch (current_mode) {
case I40E_COMBINED_ACTIVITY:
case I40E_FILTER_ACTIVITY:
@@ -1586,9 +1588,11 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool 
blink)
if (!gpio_val)
continue;

-   /* ignore gpio LED src mode entries related to the activity 
LEDs */
-   current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) 
>>
-   I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
+   /* ignore gpio LED src mode entries related to the activity
+* LEDs
+*/
+   current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK)
+   >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
switch (current_mode) {
case I40E_COMBINED_ACTIVITY:
case I40E_FILTER_ACTIVITY:
@@ -2821,6 +2825,7 @@ enum i40e_status_code i40e_aq_get_veb_parameters(struct 
i40e_hw *hw,
*vebs_free = LE16_TO_CPU(cmd_resp->vebs_free);
if (floating) {
u16 flags = LE16_TO_CPU(cmd_resp->veb_flags);
+
if (flags & I40E_AQC_ADD_VEB_FLOATING)
*floating = true;
else
@@ -5471,7 +5476,7 @@ void 
i40e_add_filter_to_drop_tx_flow_control_frames(struct i40e_hw *hw,
u16 ethtype = I40E_FLOW_CONTROL_ETHTYPE;
enum i40e_status_code status;

-   status = i40e_aq_add_rem_control_packet_filter(hw, 0, ethtype, flag,
+   status = i40e_aq_add_rem_control_packet_filter(hw, NULL, ethtype, flag,
   seid, 0, true, NULL,
   NULL);
if (status)
-- 
2.5.0



[dpdk-dev] [PATCH v5 21/29] i40e/base: save off VSI resource count

2016-03-08 Thread Helin Zhang
When updating a VSI, save off the number of allocated and
unallocated VSIs as we do when adding a VSI.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_common.c | 6 ++
 1 file changed, 6 insertions(+)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 925bb1c..9a0b787 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2467,6 +2467,9 @@ enum i40e_status_code i40e_aq_update_vsi_params(struct 
i40e_hw *hw,
struct i40e_aq_desc desc;
struct i40e_aqc_add_get_update_vsi *cmd =
(struct i40e_aqc_add_get_update_vsi *)
+   struct i40e_aqc_add_get_update_vsi_completion *resp =
+   (struct i40e_aqc_add_get_update_vsi_completion *)
+   
enum i40e_status_code status;

i40e_fill_default_direct_cmd_desc(,
@@ -2478,6 +2481,9 @@ enum i40e_status_code i40e_aq_update_vsi_params(struct 
i40e_hw *hw,
status = i40e_asq_send_command(hw, , _ctx->info,
sizeof(vsi_ctx->info), cmd_details);

+   vsi_ctx->vsis_allocated = LE16_TO_CPU(resp->vsi_used);
+   vsi_ctx->vsis_unallocated = LE16_TO_CPU(resp->vsi_free);
+
return status;
 }

-- 
2.5.0



[dpdk-dev] [PATCH v5 20/29] i40e/base: fix driver load failure

2016-03-08 Thread Helin Zhang
It fixes the driver load failure with linking with particular
PHY types, as the amount of time it takes for the
GLGEN_RSTAT_DEVSTATE to be set increases greatly on those PHY
types, which can lead to a timeout.

Fixes: 9aeefed05538 ("i40e/base: support ESS")

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index a4cf5cf..925bb1c 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1316,11 +1316,11 @@ enum i40e_status_code i40e_pf_reset(struct i40e_hw *hw)
grst_del = (rd32(hw, I40E_GLGEN_RSTCTL) &
I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >>
I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT;
-#ifdef I40E_ESS_SUPPORT
+
/* It can take upto 15 secs for GRST steady state */
grst_del = grst_del * 20; /* bump it to 16 secs max to be safe */
-#endif
-   for (cnt = 0; cnt < grst_del + 10; cnt++) {
+
+   for (cnt = 0; cnt < grst_del; cnt++) {
reg = rd32(hw, I40E_GLGEN_RSTAT);
if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK))
break;
-- 
2.5.0



[dpdk-dev] [PATCH v5 19/29] i40e/base: apply promisc mode to Tx Traffic

2016-03-08 Thread Helin Zhang
In Multi-Function Mode (MFP) mode particularly when it sets the PF
VSI in limited promiscuous, the HW switch was still mirroring the
outgoing packets from other VSIs (VF/VMdq) onto the PF VSI.
It sets a new bit to avoid above mirroring, and it is in limited
promiscuous on the PF VSI in MFP which is similar to default port
VSI.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 1 +
 drivers/net/i40e/base/i40e_common.c | 9 -
 2 files changed, 9 insertions(+), 1 deletion(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index c84e0ec..165df9b 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1143,6 +1143,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes {
 #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04
 #define I40E_AQC_SET_VSI_DEFAULT   0x08
 #define I40E_AQC_SET_VSI_PROMISC_VLAN  0x10
+#define I40E_AQC_SET_VSI_PROMISC_TX0x8000
__le16  seid;
 #define I40E_AQC_VSI_PROM_CMD_SEID_MASK0x3FF
__le16  vlan_tag;
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 2383153..a4cf5cf 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2225,12 +2225,19 @@ enum i40e_status_code 
i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
i40e_fill_default_direct_cmd_desc(,
i40e_aqc_opc_set_vsi_promiscuous_modes);

-   if (set)
+   if (set) {
flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
+   if (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
+(hw->aq.api_maj_ver > 1))
+   flags |= I40E_AQC_SET_VSI_PROMISC_TX;
+   }

cmd->promiscuous_flags = CPU_TO_LE16(flags);

cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
+   if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) ||
+(hw->aq.api_maj_ver > 1))
+   cmd->valid_flags |= CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_TX);

cmd->seid = CPU_TO_LE16(seid);
status = i40e_asq_send_command(hw, , NULL, 0, cmd_details);
-- 
2.5.0



[dpdk-dev] [PATCH v5 18/29] i40e/base: add functions to blink led

2016-03-08 Thread Helin Zhang
This patch adds functions to blink led on devices using a new
PHY since MAC registers used in other designs do not work in
this device configuration.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_common.c| 329 +
 drivers/net/i40e/base/i40e_prototype.h |  13 ++
 drivers/net/i40e/base/i40e_type.h  |  16 ++
 3 files changed, 358 insertions(+)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index c800fd8..2383153 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -5969,6 +5969,335 @@ enum i40e_status_code 
i40e_aq_configure_partition_bw(struct i40e_hw *hw,

return status;
 }
+
+/**
+ * i40e_read_phy_register
+ * @hw: pointer to the HW structure
+ * @page: registers page number
+ * @reg: register address in the page
+ * @phy_adr: PHY address on MDIO interface
+ * @value: PHY register value
+ *
+ * Reads specified PHY register value
+ **/
+enum i40e_status_code i40e_read_phy_register(struct i40e_hw *hw,
+u8 page, u16 reg, u8 phy_addr,
+u16 *value)
+{
+   enum i40e_status_code status = I40E_ERR_TIMEOUT;
+   u32 command  = 0;
+   u16 retry = 1000;
+   u8 port_num = (u8)hw->func_caps.mdio_port_num;
+
+   command = (reg << I40E_GLGEN_MSCA_MDIADD_SHIFT) |
+ (page << I40E_GLGEN_MSCA_DEVADD_SHIFT) |
+ (phy_addr << I40E_GLGEN_MSCA_PHYADD_SHIFT) |
+ (I40E_MDIO_OPCODE_ADDRESS) |
+ (I40E_MDIO_STCODE) |
+ (I40E_GLGEN_MSCA_MDICMD_MASK) |
+ (I40E_GLGEN_MSCA_MDIINPROGEN_MASK);
+   wr32(hw, I40E_GLGEN_MSCA(port_num), command);
+   do {
+   command = rd32(hw, I40E_GLGEN_MSCA(port_num));
+   if (!(command & I40E_GLGEN_MSCA_MDICMD_MASK)) {
+   status = I40E_SUCCESS;
+   break;
+   }
+   i40e_usec_delay(10);
+   retry--;
+   } while (retry);
+
+   if (status) {
+   i40e_debug(hw, I40E_DEBUG_PHY,
+  "PHY: Can't write command to external PHY.\n");
+   goto phy_read_end;
+   }
+
+   command = (page << I40E_GLGEN_MSCA_DEVADD_SHIFT) |
+ (phy_addr << I40E_GLGEN_MSCA_PHYADD_SHIFT) |
+ (I40E_MDIO_OPCODE_READ) |
+ (I40E_MDIO_STCODE) |
+ (I40E_GLGEN_MSCA_MDICMD_MASK) |
+ (I40E_GLGEN_MSCA_MDIINPROGEN_MASK);
+   status = I40E_ERR_TIMEOUT;
+   retry = 1000;
+   wr32(hw, I40E_GLGEN_MSCA(port_num), command);
+   do {
+   command = rd32(hw, I40E_GLGEN_MSCA(port_num));
+   if (!(command & I40E_GLGEN_MSCA_MDICMD_MASK)) {
+   status = I40E_SUCCESS;
+   break;
+   }
+   i40e_usec_delay(10);
+   retry--;
+   } while (retry);
+
+   if (!status) {
+   command = rd32(hw, I40E_GLGEN_MSRWD(port_num));
+   *value = (command & I40E_GLGEN_MSRWD_MDIRDDATA_MASK) >>
+I40E_GLGEN_MSRWD_MDIRDDATA_SHIFT;
+   } else {
+   i40e_debug(hw, I40E_DEBUG_PHY,
+  "PHY: Can't read register value from external 
PHY.\n");
+   }
+
+phy_read_end:
+   return status;
+}
+
+/**
+ * i40e_write_phy_register
+ * @hw: pointer to the HW structure
+ * @page: registers page number
+ * @reg: register address in the page
+ * @phy_adr: PHY address on MDIO interface
+ * @value: PHY register value
+ *
+ * Writes value to specified PHY register
+ **/
+enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,
+ u8 page, u16 reg, u8 phy_addr,
+ u16 value)
+{
+   enum i40e_status_code status = I40E_ERR_TIMEOUT;
+   u32 command  = 0;
+   u16 retry = 1000;
+   u8 port_num = (u8)hw->func_caps.mdio_port_num;
+
+   command = (reg << I40E_GLGEN_MSCA_MDIADD_SHIFT) |
+ (page << I40E_GLGEN_MSCA_DEVADD_SHIFT) |
+ (phy_addr << I40E_GLGEN_MSCA_PHYADD_SHIFT) |
+ (I40E_MDIO_OPCODE_ADDRESS) |
+ (I40E_MDIO_STCODE) |
+ (I40E_GLGEN_MSCA_MDICMD_MASK) |
+ (I40E_GLGEN_MSCA_MDIINPROGEN_MASK);
+   wr32(hw, I40E_GLGEN_MSCA(port_num), command);
+   do {
+   command = rd32(hw, I40E_GLGEN_MSCA(port_num));
+   if (!(command & I40E_GLGEN_MSCA_MDICMD_MASK)) {
+   status = I40E_SUCCESS;
+   break;
+   }
+   i40e_usec_delay(10);
+   retry--;
+   } while (retry);
+   if (status) {
+   i40e_debug(hw, I40E_DEBUG_PHY,
+   

[dpdk-dev] [PATCH v5 17/29] i40e/base: implement new API function

2016-03-08 Thread Helin Zhang
Add the support code for calling the AdminQ API call
aq_set_switch_config.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 12 
 drivers/net/i40e/base/i40e_common.c | 28 
 drivers/net/i40e/base/i40e_prototype.h  |  3 +++
 3 files changed, 43 insertions(+)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 6ec29a0..c84e0ec 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -164,6 +164,7 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_remove_statistics  = 0x0202,
i40e_aqc_opc_set_port_parameters= 0x0203,
i40e_aqc_opc_get_switch_resource_alloc  = 0x0204,
+   i40e_aqc_opc_set_switch_config  = 0x0205,

i40e_aqc_opc_add_vsi= 0x0210,
i40e_aqc_opc_update_vsi_parameters  = 0x0211,
@@ -740,6 +741,17 @@ struct i40e_aqc_switch_resource_alloc_element_resp {

 I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_resource_alloc_element_resp);

+/* Set Switch Configuration (direct 0x0205) */
+struct i40e_aqc_set_switch_config {
+   __le16  flags;
+#define I40E_AQ_SET_SWITCH_CFG_PROMISC 0x0001
+#define I40E_AQ_SET_SWITCH_CFG_L2_FILTER   0x0002
+   __le16  valid_flags;
+   u8  reserved[12];
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_set_switch_config);
+
 /* Add VSI (indirect 0x0210)
  *this indirect command uses struct i40e_aqc_vsi_properties_data
  *as the indirect buffer (128 bytes)
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index fdd4de7..c800fd8 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2508,6 +2508,34 @@ enum i40e_status_code i40e_aq_get_switch_config(struct 
i40e_hw *hw,
 }

 /**
+ * i40e_aq_set_switch_config
+ * @hw: pointer to the hardware structure
+ * @flags: bit flag values to set
+ * @valid_flags: which bit flags to set
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Set switch configuration bits
+ **/
+enum i40e_status_code i40e_aq_set_switch_config(struct i40e_hw *hw,
+   u16 flags, u16 valid_flags,
+   struct i40e_asq_cmd_details *cmd_details)
+{
+   struct i40e_aq_desc desc;
+   struct i40e_aqc_set_switch_config *scfg =
+   (struct i40e_aqc_set_switch_config *)
+   enum i40e_status_code status;
+
+   i40e_fill_default_direct_cmd_desc(,
+ i40e_aqc_opc_set_switch_config);
+   scfg->flags = CPU_TO_LE16(flags);
+   scfg->valid_flags = CPU_TO_LE16(valid_flags);
+
+   status = i40e_asq_send_command(hw, , NULL, 0, cmd_details);
+
+   return status;
+}
+
+/**
  * i40e_aq_get_firmware_version
  * @hw: pointer to the hw struct
  * @fw_major_version: firmware major version
diff --git a/drivers/net/i40e/base/i40e_prototype.h 
b/drivers/net/i40e/base/i40e_prototype.h
index 81ccc96..cbe9961 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -215,6 +215,9 @@ enum i40e_status_code i40e_aq_get_switch_config(struct 
i40e_hw *hw,
struct i40e_aqc_get_switch_config_resp *buf,
u16 buf_size, u16 *start_seid,
struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code i40e_aq_set_switch_config(struct i40e_hw *hw,
+   u16 flags, u16 valid_flags,
+   struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_request_resource(struct i40e_hw *hw,
enum i40e_aq_resources_ids resource,
enum i40e_aq_resource_access_type access,
-- 
2.5.0



[dpdk-dev] [PATCH v5 16/29] i40e: add VEB stat control

2016-03-08 Thread Helin Zhang
With the latest firmware, statistics gathering can now be enabled and
disabled in the HW switch, so we need to add a parameter to allow the
driver to set it as desired. At the same time, the L2 cloud filtering
parameter has been removed as it was never used.
Older drivers working with the newer firmware and newer drivers working
with older firmware will not run into problems with these bits as the
defaults are reasonable and there is no overlap in the bit definitions.
Also, newer drivers will be forced to update because of the change in
function call parameters, a reminder that the functionality exists.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  3 ++-
 drivers/net/i40e/base/i40e_common.c | 11 ++-
 drivers/net/i40e/base/i40e_prototype.h  |  4 ++--
 drivers/net/i40e/i40e_ethdev.c  |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index cd55a36..6ec29a0 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -966,7 +966,8 @@ struct i40e_aqc_add_veb {
I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT)
 #define I40E_AQC_ADD_VEB_PORT_TYPE_DEFAULT 0x2
 #define I40E_AQC_ADD_VEB_PORT_TYPE_DATA0x4
-#define I40E_AQC_ADD_VEB_ENABLE_L2_FILTER  0x8
+#define I40E_AQC_ADD_VEB_ENABLE_L2_FILTER  0x8 /* deprecated */
+#define I40E_AQC_ADD_VEB_ENABLE_DISABLE_STATS  0x10
u8  enable_tcs;
u8  reserved[9];
 };
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index b1d063f..fdd4de7 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2682,8 +2682,8 @@ i40e_link_speed_exit:
  * @downlink_seid: the VSI SEID
  * @enabled_tc: bitmap of TCs to be enabled
  * @default_port: true for default port VSI, false for control port
- * @enable_l2_filtering: true to add L2 filter table rules to regular 
forwarding rules for cloud support
  * @veb_seid: pointer to where to put the resulting VEB SEID
+ * @enable_stats: true to turn on VEB stats
  * @cmd_details: pointer to command details structure or NULL
  *
  * This asks the FW to add a VEB between the uplink and downlink
@@ -2691,8 +2691,8 @@ i40e_link_speed_exit:
  **/
 enum i40e_status_code i40e_aq_add_veb(struct i40e_hw *hw, u16 uplink_seid,
u16 downlink_seid, u8 enabled_tc,
-   bool default_port, bool enable_l2_filtering,
-   u16 *veb_seid,
+   bool default_port, u16 *veb_seid,
+   bool enable_stats,
struct i40e_asq_cmd_details *cmd_details)
 {
struct i40e_aq_desc desc;
@@ -2719,8 +2719,9 @@ enum i40e_status_code i40e_aq_add_veb(struct i40e_hw *hw, 
u16 uplink_seid,
else
veb_flags |= I40E_AQC_ADD_VEB_PORT_TYPE_DATA;

-   if (enable_l2_filtering)
-   veb_flags |= I40E_AQC_ADD_VEB_ENABLE_L2_FILTER;
+   /* reverse logic here: set the bitflag to disable the stats */
+   if (!enable_stats)
+   veb_flags |= I40E_AQC_ADD_VEB_ENABLE_DISABLE_STATS;

cmd->veb_flags = CPU_TO_LE16(veb_flags);

diff --git a/drivers/net/i40e/base/i40e_prototype.h 
b/drivers/net/i40e/base/i40e_prototype.h
index b5b8935..81ccc96 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -179,8 +179,8 @@ enum i40e_status_code i40e_aq_update_vsi_params(struct 
i40e_hw *hw,
struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_add_veb(struct i40e_hw *hw, u16 uplink_seid,
u16 downlink_seid, u8 enabled_tc,
-   bool default_port, bool enable_l2_filtering,
-   u16 *pveb_seid,
+   bool default_port, u16 *pveb_seid,
+   bool enable_stats,
struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_veb_parameters(struct i40e_hw *hw,
u16 veb_seid, u16 *switch_id, bool *floating,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index c86febc..00fdc0a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3646,7 +3646,7 @@ i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi *vsi)
veb->uplink_seid = vsi->uplink_seid;

ret = i40e_aq_add_veb(hw, veb->uplink_seid, vsi->seid,
-   I40E_DEFAULT_TCMAP, false, false, >seid, NULL);
+   I40E_DEFAULT_TCMAP, false, >seid, false, NULL);

if (ret != I40E_SUCCESS) {
PMD_DRV_LOG(ERR, "Add veb failed, aq_err: 

[dpdk-dev] [PATCH v5 15/29] i40e/base: support operating port mirroring rules

2016-03-08 Thread Helin Zhang
This patch implements necessary functions related to port
mirroring features such as add/delete mirror rule, function
to set promiscuous VLAN mode for VSI if mirror rule_type is
"VLAN Mirroring".

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_common.c| 162 +
 drivers/net/i40e/base/i40e_prototype.h |  12 +++
 2 files changed, 174 insertions(+)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 44855b3..b1d063f 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2374,6 +2374,37 @@ enum i40e_status_code i40e_aq_set_vsi_broadcast(struct 
i40e_hw *hw,
 }

 /**
+ * i40e_aq_set_vsi_vlan_promisc - control the VLAN promiscuous setting
+ * @hw: pointer to the hw struct
+ * @seid: vsi number
+ * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given 
VLAN
+ * @cmd_details: pointer to command details structure or NULL
+ **/
+enum i40e_status_code i40e_aq_set_vsi_vlan_promisc(struct i40e_hw *hw,
+   u16 seid, bool enable,
+   struct i40e_asq_cmd_details *cmd_details)
+{
+   struct i40e_aq_desc desc;
+   struct i40e_aqc_set_vsi_promiscuous_modes *cmd =
+   (struct i40e_aqc_set_vsi_promiscuous_modes *)
+   enum i40e_status_code status;
+   u16 flags = 0;
+
+   i40e_fill_default_direct_cmd_desc(,
+   i40e_aqc_opc_set_vsi_promiscuous_modes);
+   if (enable)
+   flags |= I40E_AQC_SET_VSI_PROMISC_VLAN;
+
+   cmd->promiscuous_flags = CPU_TO_LE16(flags);
+   cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_VLAN);
+   cmd->seid = CPU_TO_LE16(seid);
+
+   status = i40e_asq_send_command(hw, , NULL, 0, cmd_details);
+
+   return status;
+}
+
+/**
  * i40e_get_vsi_params - get VSI configuration info
  * @hw: pointer to the hw struct
  * @vsi_ctx: pointer to a vsi context struct
@@ -2849,6 +2880,137 @@ enum i40e_status_code i40e_aq_remove_macvlan(struct 
i40e_hw *hw, u16 seid,
 }

 /**
+ * i40e_mirrorrule_op - Internal helper function to add/delete mirror rule
+ * @hw: pointer to the hw struct
+ * @opcode: AQ opcode for add or delete mirror rule
+ * @sw_seid: Switch SEID (to which rule refers)
+ * @rule_type: Rule Type (ingress/egress/VLAN)
+ * @id: Destination VSI SEID or Rule ID
+ * @count: length of the list
+ * @mr_list: list of mirrored VSI SEIDs or VLAN IDs
+ * @cmd_details: pointer to command details structure or NULL
+ * @rule_id: Rule ID returned from FW
+ * @rule_used: Number of rules used in internal switch
+ * @rule_free: Number of rules free in internal switch
+ *
+ * Add/Delete a mirror rule to a specific switch. Mirror rules are supported 
for
+ * VEBs/VEPA elements only
+ **/
+static enum i40e_status_code i40e_mirrorrule_op(struct i40e_hw *hw,
+   u16 opcode, u16 sw_seid, u16 rule_type, u16 id,
+   u16 count, __le16 *mr_list,
+   struct i40e_asq_cmd_details *cmd_details,
+   u16 *rule_id, u16 *rules_used, u16 *rules_free)
+{
+   struct i40e_aq_desc desc;
+   struct i40e_aqc_add_delete_mirror_rule *cmd =
+   (struct i40e_aqc_add_delete_mirror_rule *)
+   struct i40e_aqc_add_delete_mirror_rule_completion *resp =
+   (struct i40e_aqc_add_delete_mirror_rule_completion *)
+   enum i40e_status_code status;
+   u16 buf_size;
+
+   buf_size = count * sizeof(*mr_list);
+
+   /* prep the rest of the request */
+   i40e_fill_default_direct_cmd_desc(, opcode);
+   cmd->seid = CPU_TO_LE16(sw_seid);
+   cmd->rule_type = CPU_TO_LE16(rule_type &
+I40E_AQC_MIRROR_RULE_TYPE_MASK);
+   cmd->num_entries = CPU_TO_LE16(count);
+   /* Dest VSI for add, rule_id for delete */
+   cmd->destination = CPU_TO_LE16(id);
+   if (mr_list) {
+   desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF |
+   I40E_AQ_FLAG_RD));
+   if (buf_size > I40E_AQ_LARGE_BUF)
+   desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
+   }
+
+   status = i40e_asq_send_command(hw, , mr_list, buf_size,
+  cmd_details);
+   if (status == I40E_SUCCESS ||
+   hw->aq.asq_last_status == I40E_AQ_RC_ENOSPC) {
+   if (rule_id)
+   *rule_id = LE16_TO_CPU(resp->rule_id);
+   if (rules_used)
+   *rules_used = LE16_TO_CPU(resp->mirror_rules_used);
+   if (rules_free)
+   *rules_free = LE16_TO_CPU(resp->mirror_rules_free);
+   }
+   return status;
+}
+
+/**
+ * i40e_aq_add_mirrorrule - add a mirror rule
+ * @hw: pointer to the hw struct
+ * @sw_seid: Switch SEID (to which rule refers)
+ * 

[dpdk-dev] [PATCH v5 14/29] i40e/base: set shared bit for multicast filters

2016-03-08 Thread Helin Zhang
It adds the use of the new shared MAC filter bit for multicast
and broadcast filters in order to make better use of the
filters available from the device.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 1 +
 drivers/net/i40e/base/i40e_common.c | 8 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index aa11bcd..cd55a36 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1033,6 +1033,7 @@ struct i40e_aqc_add_macvlan_element_data {
 #define I40E_AQC_MACVLAN_ADD_HASH_MATCH0x0002
 #define I40E_AQC_MACVLAN_ADD_IGNORE_VLAN   0x0004
 #define I40E_AQC_MACVLAN_ADD_TO_QUEUE  0x0008
+#define I40E_AQC_MACVLAN_ADD_USE_SHARED_MAC0x0010
__le16  queue_number;
 #define I40E_AQC_MACVLAN_CMD_QUEUE_SHIFT   0
 #define I40E_AQC_MACVLAN_CMD_QUEUE_MASK(0x7FF << \
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index cc8a63e..44855b3 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2777,6 +2777,7 @@ enum i40e_status_code i40e_aq_add_macvlan(struct i40e_hw 
*hw, u16 seid,
(struct i40e_aqc_macvlan *)
enum i40e_status_code status;
u16 buf_size;
+   int i;

if (count == 0 || !mv_list || !hw)
return I40E_ERR_PARAM;
@@ -2790,12 +2791,17 @@ enum i40e_status_code i40e_aq_add_macvlan(struct 
i40e_hw *hw, u16 seid,
cmd->seid[1] = 0;
cmd->seid[2] = 0;

+   for (i = 0; i < count; i++)
+   if (I40E_IS_MULTICAST(mv_list[i].mac_addr))
+   mv_list[i].flags |=
+   CPU_TO_LE16(I40E_AQC_MACVLAN_ADD_USE_SHARED_MAC);
+
desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
if (buf_size > I40E_AQ_LARGE_BUF)
desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);

status = i40e_asq_send_command(hw, , mv_list, buf_size,
-   cmd_details);
+  cmd_details);

return status;
 }
-- 
2.5.0



[dpdk-dev] [PATCH v5 13/29] i40e/base: fix for PHY NVM interaction problem

2016-03-08 Thread Helin Zhang
This patch fixes a problem where the NVMUpdate Tool, when
using the PHY NVM feature, gets bad data from the PHY because
of contention on the MDIO interface from get phy capability
calls from the driver during regular operations. The problem
is fixed by adding a check if media is available before calling
get phy capability function because that bit is not set when
device is in PHY interaction mode.

Fixes: 842ea1996335 ("i40e/base: save link module type")

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_common.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 8d2f2c7..cc8a63e 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2607,17 +2607,19 @@ enum i40e_status_code i40e_update_link_info(struct 
i40e_hw *hw)
if (status)
return status;

-   status = i40e_aq_get_phy_capabilities(hw, false, false, ,
- NULL);
-   if (status)
-   return status;
-
-   memcpy(hw->phy.link_info.module_type, _type,
-   sizeof(hw->phy.link_info.module_type));
+   if (hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) {
+   status = i40e_aq_get_phy_capabilities(hw, false, false,
+ , NULL);
+   if (status)
+   return status;

+   memcpy(hw->phy.link_info.module_type, _type,
+   sizeof(hw->phy.link_info.module_type));
+   }
return status;
 }

+
 /**
  * i40e_get_link_speed
  * @hw: pointer to the hw struct
-- 
2.5.0



[dpdk-dev] [PATCH v5 12/29] i40e/base: unify the capability function

2016-03-08 Thread Helin Zhang
The device capabilities were defined in two places, and neither had
all the definitions. It really belongs with the AQ API definition,
so this patch removes the other set of definitions and fills out the
missing item.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |   1 +
 drivers/net/i40e/base/i40e_common.c | 191 ++--
 2 files changed, 131 insertions(+), 61 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index ff6449c..aa11bcd 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -444,6 +444,7 @@ struct i40e_aqc_list_capabilities_element_resp {
 #define I40E_AQ_CAP_ID_LED 0x0061
 #define I40E_AQ_CAP_ID_SDP 0x0062
 #define I40E_AQ_CAP_ID_MDIO0x0063
+#define I40E_AQ_CAP_ID_WSR_PROT0x0064
 #define I40E_AQ_CAP_ID_FLEX10  0x00F1
 #define I40E_AQ_CAP_ID_CEM 0x00F2

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index cfe071b..8d2f2c7 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -3342,38 +3342,6 @@ i40e_aq_erase_nvm_exit:
return status;
 }

-#define I40E_DEV_FUNC_CAP_SWITCH_MODE  0x01
-#define I40E_DEV_FUNC_CAP_MGMT_MODE0x02
-#define I40E_DEV_FUNC_CAP_NPAR 0x03
-#define I40E_DEV_FUNC_CAP_OS2BMC   0x04
-#define I40E_DEV_FUNC_CAP_VALID_FUNC   0x05
-#ifdef X722_SUPPORT
-#define I40E_DEV_FUNC_CAP_WOL_PROXY0x08
-#endif
-#define I40E_DEV_FUNC_CAP_SRIOV_1_10x12
-#define I40E_DEV_FUNC_CAP_VF   0x13
-#define I40E_DEV_FUNC_CAP_VMDQ 0x14
-#define I40E_DEV_FUNC_CAP_802_1_QBG0x15
-#define I40E_DEV_FUNC_CAP_802_1_QBH0x16
-#define I40E_DEV_FUNC_CAP_VSI  0x17
-#define I40E_DEV_FUNC_CAP_DCB  0x18
-#define I40E_DEV_FUNC_CAP_FCOE 0x21
-#define I40E_DEV_FUNC_CAP_ISCSI0x22
-#define I40E_DEV_FUNC_CAP_RSS  0x40
-#define I40E_DEV_FUNC_CAP_RX_QUEUES0x41
-#define I40E_DEV_FUNC_CAP_TX_QUEUES0x42
-#define I40E_DEV_FUNC_CAP_MSIX 0x43
-#define I40E_DEV_FUNC_CAP_MSIX_VF  0x44
-#define I40E_DEV_FUNC_CAP_FLOW_DIRECTOR0x45
-#define I40E_DEV_FUNC_CAP_IEEE_15880x46
-#define I40E_DEV_FUNC_CAP_FLEX10   0xF1
-#define I40E_DEV_FUNC_CAP_CEM  0xF2
-#define I40E_DEV_FUNC_CAP_IWARP0x51
-#define I40E_DEV_FUNC_CAP_LED  0x61
-#define I40E_DEV_FUNC_CAP_SDP  0x62
-#define I40E_DEV_FUNC_CAP_MDIO 0x63
-#define I40E_DEV_FUNC_CAP_WR_CSR_PROT  0x64
-
 /**
  * i40e_parse_discover_capabilities
  * @hw: pointer to the hw struct
@@ -3412,79 +3380,146 @@ STATIC void i40e_parse_discover_capabilities(struct 
i40e_hw *hw, void *buff,
major_rev = cap->major_rev;

switch (id) {
-   case I40E_DEV_FUNC_CAP_SWITCH_MODE:
+   case I40E_AQ_CAP_ID_SWITCH_MODE:
p->switch_mode = number;
+   i40e_debug(hw, I40E_DEBUG_INIT,
+  "HW Capability: Switch mode = %d\n",
+  p->switch_mode);
break;
-   case I40E_DEV_FUNC_CAP_MGMT_MODE:
+   case I40E_AQ_CAP_ID_MNG_MODE:
p->management_mode = number;
+   i40e_debug(hw, I40E_DEBUG_INIT,
+  "HW Capability: Management Mode = %d\n",
+  p->management_mode);
break;
-   case I40E_DEV_FUNC_CAP_NPAR:
+   case I40E_AQ_CAP_ID_NPAR_ACTIVE:
p->npar_enable = number;
+   i40e_debug(hw, I40E_DEBUG_INIT,
+  "HW Capability: NPAR enable = %d\n",
+  p->npar_enable);
break;
-   case I40E_DEV_FUNC_CAP_OS2BMC:
+   case I40E_AQ_CAP_ID_OS2BMC_CAP:
p->os2bmc = number;
+   i40e_debug(hw, I40E_DEBUG_INIT,
+  "HW Capability: OS2BMC = %d\n", p->os2bmc);
break;
-   case I40E_DEV_FUNC_CAP_VALID_FUNC:
+   case I40E_AQ_CAP_ID_FUNCTIONS_VALID:
p->valid_functions = number;
+   i40e_debug(hw, I40E_DEBUG_INIT,
+  "HW Capability: Valid Functions = %d\n",
+  p->valid_functions);
break;
-   case I40E_DEV_FUNC_CAP_SRIOV_1_1:
+   case I40E_AQ_CAP_ID_SRIOV:
if (number == 1)
p->sr_iov_1_1 = true;
+   i40e_debug(hw, I40E_DEBUG_INIT,
+   

[dpdk-dev] [PATCH v5 11/29] i40e/base: fix up recent proxy bits for X722_SUPPORT

2016-03-08 Thread Helin Zhang
The recently added proxy opcodes should be available only with
X722_SUPPORT, so move them into the #ifdef, and reorder these
to be in numerical order with the rest of the opcodes. Several
structs that were added are unnecessary, so they are removed
here.

Fixes: 788fc17b2dec ("i40e/base: support proxy config for X722")

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 46 +
 drivers/net/i40e/base/i40e_common.c | 14 +-
 2 files changed, 12 insertions(+), 48 deletions(-)

v4:
 - Reworded the commit logs.
 - Splitted proxy related code changed to a standalone patch.

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index e2e17c5..ff6449c 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -139,6 +139,12 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_list_func_capabilities = 0x000A,
i40e_aqc_opc_list_dev_capabilities  = 0x000B,

+#ifdef X722_SUPPORT
+   /* Proxy commands */
+   i40e_aqc_opc_set_proxy_config   = 0x0104,
+   i40e_aqc_opc_set_ns_proxy_table_entry   = 0x0105,
+
+#endif
/* LAA */
i40e_aqc_opc_mac_address_read   = 0x0107,
i40e_aqc_opc_mac_address_write  = 0x0108,
@@ -278,10 +284,6 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_get_rss_lut= 0x0B05,
 #endif

-   /* Proxy commands */
-   i40e_aqc_opc_set_proxy_config   = 0x0104,
-   i40e_aqc_opc_set_ns_proxy_table_entry   = 0x0105,
-
/* Async Events */
i40e_aqc_opc_event_lan_overflow = 0x1001,

@@ -2466,40 +2468,4 @@ struct i40e_aqc_debug_modify_internals {

 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);

-#ifdef X722_SUPPORT
-struct i40e_aqc_set_proxy_config {
-   u8 reserved_1[4];
-   u8 reserved_2[4];
-   __le32  address_high;
-   __le32  address_low;
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aqc_set_proxy_config);
-
-struct i40e_aqc_set_proxy_config_resp {
-   u8 reserved[8];
-   __le32  address_high;
-   __le32  address_low;
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aqc_set_proxy_config_resp);
-
-struct i40e_aqc_set_ns_proxy_table_entry {
-   u8 reserved_1[4];
-   u8 reserved_2[4];
-   __le32  address_high;
-   __le32  address_low;
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aqc_set_ns_proxy_table_entry);
-
-struct i40e_aqc_set_ns_proxy_table_entry_resp {
-   u8 reserved_1[4];
-   u8 reserved_2[4];
-   __le32  address_high;
-   __le32  address_low;
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aqc_set_ns_proxy_table_entry_resp);
-#endif
 #endif /* _I40E_ADMINQ_CMD_H_ */
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 67a5e21..cfe071b 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -5818,8 +5818,6 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct 
i40e_hw *hw,
struct i40e_asq_cmd_details *cmd_details)
 {
struct i40e_aq_desc desc;
-   struct i40e_aqc_set_proxy_config *cmd =
-   (struct i40e_aqc_set_proxy_config *) 
enum i40e_status_code status;

if (!proxy_config)
@@ -5827,8 +5825,10 @@ enum i40e_status_code 
i40e_aq_set_arp_proxy_config(struct i40e_hw *hw,

i40e_fill_default_direct_cmd_desc(, i40e_aqc_opc_set_proxy_config);

-   cmd->address_high = CPU_TO_LE32(I40E_HI_DWORD((u64)proxy_config));
-   cmd->address_low = CPU_TO_LE32(I40E_LO_DWORD((u64)proxy_config));
+   desc.params.external.addr_high =
+ CPU_TO_LE32(I40E_HI_DWORD((u64)proxy_config));
+   desc.params.external.addr_low =
+ CPU_TO_LE32(I40E_LO_DWORD((u64)proxy_config));

status = i40e_asq_send_command(hw, , proxy_config,
   sizeof(struct i40e_aqc_arp_proxy_data),
@@ -5851,8 +5851,6 @@ enum i40e_status_code 
i40e_aq_set_ns_proxy_table_entry(struct i40e_hw *hw,
struct i40e_asq_cmd_details *cmd_details)
 {
struct i40e_aq_desc desc;
-   struct i40e_aqc_set_ns_proxy_table_entry *cmd =
-   (struct i40e_aqc_set_ns_proxy_table_entry *) 
enum i40e_status_code status;

if (!ns_proxy_table_entry)
@@ -5861,9 +5859,9 @@ enum i40e_status_code 
i40e_aq_set_ns_proxy_table_entry(struct i40e_hw *hw,
i40e_fill_default_direct_cmd_desc(,
i40e_aqc_opc_set_ns_proxy_table_entry);

-   cmd->address_high =
+   desc.params.external.addr_high =
CPU_TO_LE32(I40E_HI_DWORD((u64)ns_proxy_table_entry));
-   cmd->address_low =
+   desc.params.external.addr_low =
CPU_TO_LE32(I40E_LO_DWORD((u64)ns_proxy_table_entry));

status = i40e_asq_send_command(hw, , ns_proxy_table_entry,
-- 
2.5.0



[dpdk-dev] [PATCH v5 10/29] i40e/base: fix up recent wol bits for X722_SUPPORT

2016-03-08 Thread Helin Zhang
The recently added Wakeup On Line (WOL) opcodes should be
available only with X722_SUPPORT, so move them into the #ifdef,
and reorder these to be in numerical order with the rest of the
opcodes. Several structs that were added are unnecessary, so
they are removed here.

Fixes: 3c89193a36fd ("i40e/base: support WOL config for X722")

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 92 -
 1 file changed, 44 insertions(+), 48 deletions(-)

v4:
 - Reworded the commit logs.
 - Splitted WOL fixes into a standalone patch.

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 1874653..e2e17c5 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -146,6 +146,12 @@ enum i40e_admin_queue_opc {
/* PXE */
i40e_aqc_opc_clear_pxe_mode = 0x0110,

+#ifdef X722_SUPPORT
+   /* WoL commands */
+   i40e_aqc_opc_set_wol_filter = 0x0120,
+   i40e_aqc_opc_get_wake_reason= 0x0121,
+
+#endif
/* internal switch commands */
i40e_aqc_opc_get_switch_config  = 0x0200,
i40e_aqc_opc_add_statistics = 0x0201,
@@ -270,10 +276,6 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_set_rss_lut= 0x0B03,
i40e_aqc_opc_get_rss_key= 0x0B04,
i40e_aqc_opc_get_rss_lut= 0x0B05,
-
-   /* WoL commands */
-   i40e_aqc_opc_set_wol_filter = 0x0120,
-   i40e_aqc_opc_get_wake_reason = 0x0121,
 #endif

/* Proxy commands */
@@ -419,6 +421,7 @@ struct i40e_aqc_list_capabilities_element_resp {
 #define I40E_AQ_CAP_ID_OS2BMC_CAP  0x0004
 #define I40E_AQ_CAP_ID_FUNCTIONS_VALID 0x0005
 #define I40E_AQ_CAP_ID_ALTERNATE_RAM   0x0006
+#define I40E_AQ_CAP_ID_WOL_AND_PROXY   0x0008
 #define I40E_AQ_CAP_ID_SRIOV   0x0012
 #define I40E_AQ_CAP_ID_VF  0x0013
 #define I40E_AQ_CAP_ID_VMDQ0x0014
@@ -567,6 +570,43 @@ struct i40e_aqc_clear_pxe {

 I40E_CHECK_CMD_LENGTH(i40e_aqc_clear_pxe);

+#ifdef X722_SUPPORT
+/* Set WoL Filter (0x0120) */
+
+struct i40e_aqc_set_wol_filter {
+   __le16 filter_index;
+#define I40E_AQC_MAX_NUM_WOL_FILTERS   8
+   __le16 cmd_flags;
+#define I40E_AQC_SET_WOL_FILTER0x8000
+#define I40E_AQC_SET_WOL_FILTER_NO_TCO_WOL 0x4000
+   __le16 valid_flags;
+#define I40E_AQC_SET_WOL_FILTER_ACTION_VALID   0x8000
+#define I40E_AQC_SET_WOL_FILTER_NO_TCO_ACTION_VALID0x4000
+   u8 reserved[2];
+   __le32  address_high;
+   __le32  address_low;
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_set_wol_filter);
+
+/* Get Wake Reason (0x0121) */
+
+struct i40e_aqc_get_wake_reason_completion {
+   u8 reserved_1[2];
+   __le16 wake_reason;
+   u8 reserved_2[12];
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aqc_get_wake_reason_completion);
+
+struct i40e_aqc_set_wol_filter_data {
+   u8 filter[128];
+   u8 mask[16];
+};
+
+I40E_CHECK_STRUCT_LEN(0x90, i40e_aqc_set_wol_filter_data);
+
+#endif /* X722_SUPPORT */
 /* Switch configuration commands (0x02xx) */

 /* Used by many indirect commands that only pass an seid and a buffer in the
@@ -2461,49 +2501,5 @@ struct i40e_aqc_set_ns_proxy_table_entry_resp {
 };

 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_ns_proxy_table_entry_resp);
-
-struct i40e_aqc_set_wol_filter {
-   __le16 filter_index;
-#define I40E_AQC_MAX_NUM_WOL_FILTERS   8
-   __le16 cmd_flags;
-#define I40E_AQC_SET_WOL_FILTER0x8000
-#define I40E_AQC_SET_WOL_FILTER_NO_TCO_WOL 0x4000
-   __le16 valid_flags;
-#define I40E_AQC_SET_WOL_FILTER_ACTION_VALID   0x8000
-#define I40E_AQC_SET_WOL_FILTER_NO_TCO_ACTION_VALID0x4000
-   u8 reserved[2];
-   __le32  address_high;
-   __le32  address_low;
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aqc_set_wol_filter);
-
-struct i40e_aqc_set_wol_filter_resp {
-   u8 reserved[8];
-   __le32  address_high;
-   __le32  address_low;
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aqc_set_wol_filter_resp);
-
-struct i40e_aqc_get_wol_wake_reason {
-   u8 reserved[16];
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aqc_get_wol_wake_reason);
-
-struct i40e_aqc_get_wake_reason_completion {
-   u8 reserved_1[2];
-   __le16 wake_reason;
-   u8 reserved_2[12];
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aqc_get_wake_reason_completion);
-
-struct i40e_aqc_set_wol_filter_data {
-   u8 filter[128];
-   u8 mask[16];
-};
-
 #endif
 #endif /* _I40E_ADMINQ_CMD_H_ */
-- 
2.5.0



[dpdk-dev] [PATCH v5 09/29] i40e: update device id

2016-03-08 Thread Helin Zhang
Add new Device ID's for backplane and QSFP+ adapters, and delete
deprecated one for backplane.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_common.c | 12 ++--
 drivers/net/i40e/base/i40e_devids.h | 10 +-
 drivers/net/i40e/i40e_ethdev.h  |  2 +-
 drivers/net/i40e/i40e_rxtx.c|  8 
 lib/librte_eal/common/include/rte_pci_dev_ids.h |  8 ++--
 5 files changed, 30 insertions(+), 10 deletions(-)

v4:
 - Reworded the commit logs.
 - Merged all device IDs related code changes together.

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 5e1b39e..67a5e21 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -58,7 +58,6 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw 
*hw)
switch (hw->device_id) {
case I40E_DEV_ID_SFP_XL710:
case I40E_DEV_ID_QEMU:
-   case I40E_DEV_ID_KX_A:
case I40E_DEV_ID_KX_B:
case I40E_DEV_ID_KX_C:
case I40E_DEV_ID_QSFP_A:
@@ -74,6 +73,8 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw 
*hw)
 #ifdef X722_A0_SUPPORT
case I40E_DEV_ID_X722_A0:
 #endif
+   case I40E_DEV_ID_KX_X722:
+   case I40E_DEV_ID_QSFP_X722:
case I40E_DEV_ID_SFP_X722:
case I40E_DEV_ID_1G_BASE_T_X722:
case I40E_DEV_ID_10G_BASE_T_X722:
@@ -81,15 +82,22 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct 
i40e_hw *hw)
break;
 #endif
 #ifdef X722_SUPPORT
+#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
case I40E_DEV_ID_X722_VF:
case I40E_DEV_ID_X722_VF_HV:
+#ifdef X722_A0_SUPPORT
+   case I40E_DEV_ID_X722_A0_VF:
+#endif
hw->mac.type = I40E_MAC_X722_VF;
break;
-#endif
+#endif /* INTEGRATED_VF || VF_DRIVER */
+#endif /* X722_SUPPORT */
+#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
case I40E_DEV_ID_VF:
case I40E_DEV_ID_VF_HV:
hw->mac.type = I40E_MAC_VF;
break;
+#endif
default:
hw->mac.type = I40E_MAC_GENERIC;
break;
diff --git a/drivers/net/i40e/base/i40e_devids.h 
b/drivers/net/i40e/base/i40e_devids.h
index 26cfd54..f844340 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -40,7 +40,6 @@ POSSIBILITY OF SUCH DAMAGE.
 /* Device IDs */
 #define I40E_DEV_ID_SFP_XL710  0x1572
 #define I40E_DEV_ID_QEMU   0x1574
-#define I40E_DEV_ID_KX_A   0x157F
 #define I40E_DEV_ID_KX_B   0x1580
 #define I40E_DEV_ID_KX_C   0x1581
 #define I40E_DEV_ID_QSFP_A 0x1583
@@ -50,17 +49,26 @@ POSSIBILITY OF SUCH DAMAGE.
 #define I40E_DEV_ID_20G_KR20x1587
 #define I40E_DEV_ID_20G_KR2_A  0x1588
 #define I40E_DEV_ID_10G_BASE_T40x1589
+#if defined(INTEGRATED_VF) || defined(VF_DRIVER) || defined(I40E_NDIS_SUPPORT)
 #define I40E_DEV_ID_VF 0x154C
 #define I40E_DEV_ID_VF_HV  0x1571
+#endif /* VF_DRIVER */
 #ifdef X722_SUPPORT
 #ifdef X722_A0_SUPPORT
 #define I40E_DEV_ID_X722_A00x374C
+#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
+#define I40E_DEV_ID_X722_A0_VF 0x374D
 #endif
+#endif
+#define I40E_DEV_ID_KX_X7220x37CE
+#define I40E_DEV_ID_QSFP_X722  0x37CF
 #define I40E_DEV_ID_SFP_X722   0x37D0
 #define I40E_DEV_ID_1G_BASE_T_X722 0x37D1
 #define I40E_DEV_ID_10G_BASE_T_X7220x37D2
+#if defined(INTEGRATED_VF) || defined(VF_DRIVER) || defined(I40E_NDIS_SUPPORT)
 #define I40E_DEV_ID_X722_VF0x37CD
 #define I40E_DEV_ID_X722_VF_HV 0x37D9
+#endif /* VF_DRIVER */
 #endif /* X722_SUPPORT */

 #define i40e_is_40G_device(d)  ((d) == I40E_DEV_ID_QSFP_A  || \
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index db6173a..947444d 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -600,7 +600,7 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter)
 return NULL;

hw = I40E_DEV_PRIVATE_TO_HW(adapter);
-   if (hw->mac.type == I40E_MAC_VF) {
+   if (hw->mac.type == I40E_MAC_VF || hw->mac.type == I40E_MAC_X722_VF) {
struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(adapter);
return >vsi;
} else {
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index d5c4031..f8efdce 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2113,7 +2113,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,
uint16_t base, bsf, tc_mapping;
int use_def_burst_func = 

[dpdk-dev] [PATCH v5 08/29] i40e/base: fix uncertain event descriptor issue

2016-03-08 Thread Helin Zhang
In one obscure corner case, it was possible to clear the NVM update
wait flag when no update_done message was actually received. This
patch cleans the event descriptor before use, and moves the opcode
check to where it won't get done if there was no event to clean.

Fixes: 8db9e2a1b232 ("i40e: base driver")

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_adminq.c 
b/drivers/net/i40e/base/i40e_adminq.c
index ee563e4..222add4 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -1032,6 +1032,9 @@ enum i40e_status_code i40e_clean_arq_element(struct 
i40e_hw *hw,
u16 flags;
u16 ntu;

+   /* pre-clean the event info */
+   i40e_memset(>desc, 0, sizeof(e->desc), I40E_NONDMA_MEM);
+
/* take the lock before we start messing with the ring */
i40e_acquire_spinlock(>aq.arq_spinlock);

@@ -1116,13 +1119,6 @@ enum i40e_status_code i40e_clean_arq_element(struct 
i40e_hw *hw,
hw->aq.arq.next_to_clean = ntc;
hw->aq.arq.next_to_use = ntu;

-clean_arq_element_out:
-   /* Set pending if needed, unlock and return */
-   if (pending != NULL)
-   *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
-clean_arq_element_err:
-   i40e_release_spinlock(>aq.arq_spinlock);
-
 #ifdef PF_DRIVER
if (i40e_is_nvm_update_op(>desc)) {
if (hw->aq.nvm_release_on_done) {
@@ -1145,6 +1141,13 @@ clean_arq_element_err:
}

 #endif
+clean_arq_element_out:
+   /* Set pending if needed, unlock and return */
+   if (pending != NULL)
+   *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
+clean_arq_element_err:
+   i40e_release_spinlock(>aq.arq_spinlock);
+
return ret_code;
 }

-- 
2.5.0



[dpdk-dev] [PATCH v5 07/29] i40e/base: set aq count after memory allocation

2016-03-08 Thread Helin Zhang
The standard way to check if the AQ is enabled is to look at
the count field. So it should only set this field after it has
successfully allocated memory.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_adminq.c 
b/drivers/net/i40e/base/i40e_adminq.c
index e1a162e..ee563e4 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -431,7 +431,6 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw)

hw->aq.asq.next_to_use = 0;
hw->aq.asq.next_to_clean = 0;
-   hw->aq.asq.count = hw->aq.num_asq_entries;

/* allocate the ring memory */
ret_code = i40e_alloc_adminq_asq_ring(hw);
@@ -449,6 +448,7 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw)
goto init_adminq_free_rings;

/* success! */
+   hw->aq.asq.count = hw->aq.num_asq_entries;
goto init_adminq_exit;

 init_adminq_free_rings:
@@ -490,7 +490,6 @@ enum i40e_status_code i40e_init_arq(struct i40e_hw *hw)

hw->aq.arq.next_to_use = 0;
hw->aq.arq.next_to_clean = 0;
-   hw->aq.arq.count = hw->aq.num_arq_entries;

/* allocate the ring memory */
ret_code = i40e_alloc_adminq_arq_ring(hw);
@@ -508,6 +507,7 @@ enum i40e_status_code i40e_init_arq(struct i40e_hw *hw)
goto init_adminq_free_rings;

/* success! */
+   hw->aq.arq.count = hw->aq.num_arq_entries;
goto init_adminq_exit;

 init_adminq_free_rings:
-- 
2.5.0



[dpdk-dev] [PATCH v5 06/29] i40e/base: fix missing check for stopped admin queue

2016-03-08 Thread Helin Zhang
It's possible that while waiting for the spinlock, another
entity (that owns the spinlock) has shut down the admin queue.
If it then attempts to use the queue, it will panic.
It adds a check for this condition on the receive side. This
matches an existing check on the send queue side.

Fixes: 8db9e2a1b232 ("i40e: base driver")

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_adminq.c | 8 
 1 file changed, 8 insertions(+)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_adminq.c 
b/drivers/net/i40e/base/i40e_adminq.c
index 998582c..e1a162e 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -1035,6 +1035,13 @@ enum i40e_status_code i40e_clean_arq_element(struct 
i40e_hw *hw,
/* take the lock before we start messing with the ring */
i40e_acquire_spinlock(>aq.arq_spinlock);

+   if (hw->aq.arq.count == 0) {
+   i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+  "AQRX: Admin queue not initialized.\n");
+   ret_code = I40E_ERR_QUEUE_EMPTY;
+   goto clean_arq_element_err;
+   }
+
/* set next_to_use to head */
 #ifdef PF_DRIVER
 #ifdef INTEGRATED_VF
@@ -1113,6 +1120,7 @@ clean_arq_element_out:
/* Set pending if needed, unlock and return */
if (pending != NULL)
*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
+clean_arq_element_err:
i40e_release_spinlock(>aq.arq_spinlock);

 #ifdef PF_DRIVER
-- 
2.5.0



[dpdk-dev] [PATCH v5 05/29] i40e/base: limit version check of DCB

2016-03-08 Thread Helin Zhang
XL710/X710 devices requires FW version checks to properly handle
DCB configurations from the FW while other devices (e.g. X722)
do not, so limit these checks to XL710/X710 only.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_dcb.c | 34 +-
 1 file changed, 21 insertions(+), 13 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index d71387f..26c344f 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -387,32 +387,40 @@ static void i40e_parse_cee_app_tlv(struct 
i40e_cee_feat_tlv *tlv,
 {
u16 length, typelength, offset = 0;
struct i40e_cee_app_prio *app;
-   u8 i, up, selector;
+   u8 i;

typelength = I40E_NTOHS(tlv->hdr.typelen);
length = (u16)((typelength & I40E_LLDP_TLV_LEN_MASK) >>
   I40E_LLDP_TLV_LEN_SHIFT);

-   dcbcfg->numapps = length/sizeof(*app);
+   dcbcfg->numapps = length / sizeof(*app);
if (!dcbcfg->numapps)
return;

for (i = 0; i < dcbcfg->numapps; i++) {
+   u8 up, selector;
+
app = (struct i40e_cee_app_prio *)(tlv->tlvinfo + offset);
for (up = 0; up < I40E_MAX_USER_PRIORITY; up++) {
if (app->prio_map & BIT(up))
break;
}
dcbcfg->app[i].priority = up;
+
/* Get Selector from lower 2 bits, and convert to IEEE */
selector = (app->upper_oui_sel & I40E_CEE_APP_SELECTOR_MASK);
-   if (selector == I40E_CEE_APP_SEL_ETHTYPE)
+   switch (selector) {
+   case I40E_CEE_APP_SEL_ETHTYPE:
dcbcfg->app[i].selector = I40E_APP_SEL_ETHTYPE;
-   else if (selector == I40E_CEE_APP_SEL_TCPIP)
+   break;
+   case I40E_CEE_APP_SEL_TCPIP:
dcbcfg->app[i].selector = I40E_APP_SEL_TCPIP;
-   else
+   break;
+   default:
/* Keep selector as it is for unknown types */
dcbcfg->app[i].selector = selector;
+   }
+
dcbcfg->app[i].protocolid = I40E_NTOHS(app->protocol);
/* Move to next app */
offset += sizeof(*app);
@@ -822,13 +830,15 @@ enum i40e_status_code i40e_get_dcb_config(struct i40e_hw 
*hw)
struct i40e_aqc_get_cee_dcb_cfg_resp cee_cfg;
struct i40e_aqc_get_cee_dcb_cfg_v1_resp cee_v1_cfg;

-   /* If Firmware version < v4.33 IEEE only */
-   if (((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver < 33)) ||
-   (hw->aq.fw_maj_ver < 4))
+   /* If Firmware version < v4.33 on X710/XL710, IEEE only */
+   if ((hw->mac.type == I40E_MAC_XL710) &&
+   (((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver < 33)) ||
+ (hw->aq.fw_maj_ver < 4)))
return i40e_get_ieee_dcb_config(hw);

-   /* If Firmware version == v4.33 use old CEE struct */
-   if ((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver == 33)) {
+   /* If Firmware version == v4.33 on X710/XL710, use old CEE struct */
+   if ((hw->mac.type == I40E_MAC_XL710) &&
+   ((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver == 33))) {
ret = i40e_aq_get_cee_dcb_config(hw, _v1_cfg,
 sizeof(cee_v1_cfg), NULL);
if (ret == I40E_SUCCESS) {
@@ -1240,14 +1250,12 @@ enum i40e_status_code i40e_dcb_config_to_lldp(u8 
*lldpmib, u16 *miblen,
u16 length, offset = 0, tlvid = I40E_TLV_ID_START;
enum i40e_status_code ret = I40E_SUCCESS;
struct i40e_lldp_org_tlv *tlv;
-   u16 type, typelength;
+   u16 typelength;

tlv = (struct i40e_lldp_org_tlv *)lldpmib;
while (1) {
i40e_add_dcb_tlv(tlv, dcbcfg, tlvid++);
typelength = I40E_NTOHS(tlv->typelength);
-   type = (u16)((typelength & I40E_LLDP_TLV_TYPE_MASK) >>
-   I40E_LLDP_TLV_TYPE_SHIFT);
length = (u16)((typelength & I40E_LLDP_TLV_LEN_MASK) >>
I40E_LLDP_TLV_LEN_SHIFT);
if (length)
-- 
2.5.0



[dpdk-dev] [PATCH v5 04/29] i40e/base: add X722 support on nvm read

2016-03-08 Thread Helin Zhang
In X722, NVM reads can't be done through SRCTL registers.
And require AQ calls, which require grabbing the NVM lock.
Unfortunately some paths need the lock to be acquired once
and do a whole bunch of stuff and then release it.
This patch creates an unsafe version of the read calls, so
that it can be called from the paths that need the bulk access.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_nvm.c   | 109 ++---
 drivers/net/i40e/base/i40e_prototype.h |   8 ++-
 2 files changed, 92 insertions(+), 25 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index a1b150a..f4e4eaa 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -53,7 +53,7 @@ enum i40e_status_code i40e_read_nvm_aq(struct i40e_hw *hw, u8 
module_pointer,
  * once per NVM initialization, e.g. inside the i40e_init_shared_code().
  * Please notice that the NVM term is used here (& in all methods covered
  * in this file) as an equivalent of the FLASH part mapped into the SR.
- * We are accessing FLASH always thru the Shadow RAM.
+ * We are accessing FLASH always through the Shadow RAM.
  **/
 enum i40e_status_code i40e_init_nvm(struct i40e_hw *hw)
 {
@@ -207,7 +207,7 @@ static enum i40e_status_code 
i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw)
 }

 /**
- * i40e_read_nvm_word - Reads Shadow RAM
+ * i40e_read_nvm_word - Reads nvm word and acquire lock if necessary
  * @hw: pointer to the HW structure
  * @offset: offset of the Shadow RAM word to read (0x00 - 0x001FFF)
  * @data: word read from the Shadow RAM
@@ -236,6 +236,31 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw 
*hw, u16 offset,
 }

 /**
+ * __i40e_read_nvm_word - Reads nvm word, assumes caller does the locking
+ * @hw: pointer to the HW structure
+ * @offset: offset of the Shadow RAM word to read (0x00 - 0x001FFF)
+ * @data: word read from the Shadow RAM
+ *
+ * Reads one 16 bit word from the Shadow RAM using the GLNVM_SRCTL register.
+ **/
+enum i40e_status_code __i40e_read_nvm_word(struct i40e_hw *hw,
+  u16 offset,
+  u16 *data)
+{
+   enum i40e_status_code ret_code = I40E_SUCCESS;
+
+#ifdef X722_SUPPORT
+   if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)
+   ret_code = i40e_read_nvm_word_aq(hw, offset, data);
+   else
+   ret_code = i40e_read_nvm_word_srctl(hw, offset, data);
+#else
+   ret_code = i40e_read_nvm_word_srctl(hw, offset, data);
+#endif
+   return ret_code;
+}
+
+/**
  * i40e_read_nvm_word_srctl - Reads Shadow RAM via SRCTL register
  * @hw: pointer to the HW structure
  * @offset: offset of the Shadow RAM word to read (0x00 - 0x001FFF)
@@ -307,7 +332,35 @@ enum i40e_status_code i40e_read_nvm_word_aq(struct i40e_hw 
*hw, u16 offset,
 }

 /**
- * i40e_read_nvm_buffer - Reads Shadow RAM buffer
+ * __i40e_read_nvm_buffer - Reads nvm buffer, caller must acquire lock
+ * @hw: pointer to the HW structure
+ * @offset: offset of the Shadow RAM word to read (0x00 - 0x001FFF).
+ * @words: (in) number of words to read; (out) number of words actually read
+ * @data: words read from the Shadow RAM
+ *
+ * Reads 16 bit words (data buffer) from the SR using the i40e_read_nvm_srrd()
+ * method. The buffer read is preceded by the NVM ownership take
+ * and followed by the release.
+ **/
+enum i40e_status_code __i40e_read_nvm_buffer(struct i40e_hw *hw,
+u16 offset,
+u16 *words, u16 *data)
+{
+   enum i40e_status_code ret_code = I40E_SUCCESS;
+
+#ifdef X722_SUPPORT
+   if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)
+   ret_code = i40e_read_nvm_buffer_aq(hw, offset, words, data);
+   else
+   ret_code = i40e_read_nvm_buffer_srctl(hw, offset, words, data);
+#else
+   ret_code = i40e_read_nvm_buffer_srctl(hw, offset, words, data);
+#endif
+   return ret_code;
+}
+
+/**
+ * i40e_read_nvm_buffer - Reads Shadow RAM buffer and acuire lock if necessary
  * @hw: pointer to the HW structure
  * @offset: offset of the Shadow RAM word to read (0x00 - 0x001FFF).
  * @words: (in) number of words to read; (out) number of words actually read
@@ -327,7 +380,7 @@ enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw 
*hw, u16 offset,
ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
if (!ret_code) {
ret_code = i40e_read_nvm_buffer_aq(hw, offset, words,
-  data);
+data);
i40e_release_nvm(hw);
}
} else {
@@ -358,7 +411,7 @@ enum i40e_status_code i40e_read_nvm_buffer_srctl(struct 
i40e_hw *hw, u16 offset,


[dpdk-dev] [PATCH v5 03/29] i40e/base: add hw flag for X722 register access

2016-03-08 Thread Helin Zhang
Instead of doing the MAC check, use a flag that gets set per
MAC. This way there are less chances of user error and it
can enable multiple MACs with the capability in a single place
rather than cluttering the code with MAC checks.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_common.c | 5 +
 drivers/net/i40e/base/i40e_nvm.c| 4 ++--
 drivers/net/i40e/base/i40e_type.h   | 3 +++
 3 files changed, 10 insertions(+), 2 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index d7c940d..5e1b39e 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1032,6 +1032,11 @@ enum i40e_status_code i40e_init_shared_code(struct 
i40e_hw *hw)
else
hw->pf_id = (u8)(func_rid & 0x7);

+#ifdef X722_SUPPORT
+   if (hw->mac.type == I40E_MAC_X722)
+   hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE;
+
+#endif
status = i40e_init_nvm(hw);
return status;
 }
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index bfa3315..a1b150a 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -220,7 +220,7 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw 
*hw, u16 offset,
enum i40e_status_code ret_code = I40E_SUCCESS;

 #ifdef X722_SUPPORT
-   if (hw->mac.type == I40E_MAC_X722) {
+   if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) {
ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
if (!ret_code) {
ret_code = i40e_read_nvm_word_aq(hw, offset, data);
@@ -323,7 +323,7 @@ enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw 
*hw, u16 offset,
enum i40e_status_code ret_code = I40E_SUCCESS;

 #ifdef X722_SUPPORT
-   if (hw->mac.type == I40E_MAC_X722) {
+   if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) {
ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
if (!ret_code) {
ret_code = i40e_read_nvm_buffer_aq(hw, offset, words,
diff --git a/drivers/net/i40e/base/i40e_type.h 
b/drivers/net/i40e/base/i40e_type.h
index 9483884..f566e30 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -658,6 +658,9 @@ struct i40e_hw {
u16 wol_proxy_vsi_seid;

 #endif
+#define I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE BIT_ULL(0)
+   u64 flags;
+
/* debug mask */
u32 debug_mask;
 #ifndef I40E_NDIS_SUPPORT
-- 
2.5.0



[dpdk-dev] [PATCH v5 02/29] i40e/base: acquire NVM ownership before reading it

2016-03-08 Thread Helin Zhang
It needs to acquire the NVM ownership before issuing an AQ read
to the X722 NVM otherwise it will get EBUSY from the firmware.
Also it should be released when done.

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_nvm.c | 35 +--
 1 file changed, 29 insertions(+), 6 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index 60f2bb9..bfa3315 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -217,11 +217,22 @@ static enum i40e_status_code 
i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw)
 enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 u16 *data)
 {
+   enum i40e_status_code ret_code = I40E_SUCCESS;
+
 #ifdef X722_SUPPORT
-   if (hw->mac.type == I40E_MAC_X722)
-   return i40e_read_nvm_word_aq(hw, offset, data);
+   if (hw->mac.type == I40E_MAC_X722) {
+   ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
+   if (!ret_code) {
+   ret_code = i40e_read_nvm_word_aq(hw, offset, data);
+   i40e_release_nvm(hw);
+   }
+   } else {
+   ret_code = i40e_read_nvm_word_srctl(hw, offset, data);
+   }
+#else
+   ret_code = i40e_read_nvm_word_srctl(hw, offset, data);
 #endif
-   return i40e_read_nvm_word_srctl(hw, offset, data);
+   return ret_code;
 }

 /**
@@ -309,11 +320,23 @@ enum i40e_status_code i40e_read_nvm_word_aq(struct 
i40e_hw *hw, u16 offset,
 enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
   u16 *words, u16 *data)
 {
+   enum i40e_status_code ret_code = I40E_SUCCESS;
+
 #ifdef X722_SUPPORT
-   if (hw->mac.type == I40E_MAC_X722)
-   return i40e_read_nvm_buffer_aq(hw, offset, words, data);
+   if (hw->mac.type == I40E_MAC_X722) {
+   ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
+   if (!ret_code) {
+   ret_code = i40e_read_nvm_buffer_aq(hw, offset, words,
+  data);
+   i40e_release_nvm(hw);
+   }
+   } else {
+   ret_code = i40e_read_nvm_buffer_srctl(hw, offset, words, data);
+   }
+#else
+   ret_code = i40e_read_nvm_buffer_srctl(hw, offset, words, data);
 #endif
-   return i40e_read_nvm_buffer_srctl(hw, offset, words, data);
+   return ret_code;
 }

 /**
-- 
2.5.0



[dpdk-dev] [PATCH v5 01/29] i40e/base: fix compilation warnings

2016-03-08 Thread Helin Zhang
It fixes compilation warnings.

Fixes: bd6651c2d2d7 ("i40e/base: use bit shift macros")

Signed-off-by: Helin Zhang 
Acked-by: Jingjing Wu 
---
 drivers/net/i40e/base/i40e_lan_hmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

v4:
 - Reworded the commit logs.

diff --git a/drivers/net/i40e/base/i40e_lan_hmc.c 
b/drivers/net/i40e/base/i40e_lan_hmc.c
index 6511767..2260648 100644
--- a/drivers/net/i40e/base/i40e_lan_hmc.c
+++ b/drivers/net/i40e/base/i40e_lan_hmc.c
@@ -769,7 +769,7 @@ static void i40e_write_byte(u8 *hmc_bits,

/* prepare the bits and mask */
shift_width = ce_info->lsb % 8;
-   mask = BIT(ce_info->width) - 1;
+   mask = (u8)(BIT(ce_info->width) - 1);

src_byte = *from;
src_byte &= mask;
@@ -954,7 +954,7 @@ static void i40e_read_byte(u8 *hmc_bits,

/* prepare the bits and mask */
shift_width = ce_info->lsb % 8;
-   mask = BIT(ce_info->width) - 1;
+   mask = (u8)(BIT(ce_info->width) - 1);

/* shift to correct alignment */
mask <<= shift_width;
-- 
2.5.0



[dpdk-dev] [PATCH v5 00/29] i40e base driver update

2016-03-08 Thread Helin Zhang
i40e base driver is updated, to support new X722 device IDs, and
use rx control AQ commands to read/write rx control registers.
Of cause, fixes and enhancements are added as listed as below.

The patch set branches off below commit on branch rel_16_04 of
repo dpdk-next-net.
commit 4ac366ba647909c3b71818f9be9db86ba5e871da
Author: Thomas Monjalon 
Date:   Sat Feb 6 22:51:16 2016 +0100
  nfp: fix non-x86 build

v5:
 - rebased the patch set ontop of maintainer's branch rel_16_04.

v4:
 - Reworded the commit logs.
 - Reorganized patches, in order to put together the code changes
   of the same purpose.
 - Reorganized the release notes changes.

v3:
 - As release_2_3.rst has been renamed to release_16_04.rst, then
   all modifications in release_2_3.rst should be moved into
   release_16_04.rst.

v2:
 - Used i40e_set_mac_type() in base driver to replace the similar
   in PMD source files, in order to support newly added X722 VF
   device IDs.
 - Used small letter in all commit log titles.

Helin Zhang (29):
  i40e/base: fix compilation warnings
  i40e/base: acquire NVM ownership before reading it
  i40e/base: add hw flag for X722 register access
  i40e/base: add X722 support on nvm read
  i40e/base: limit version check of DCB
  i40e/base: fix missing check for stopped admin queue
  i40e/base: set aq count after memory allocation
  i40e/base: fix uncertain event descriptor issue
  i40e: update device id
  i40e/base: fix up recent wol bits for X722_SUPPORT
  i40e/base: fix up recent proxy bits for X722_SUPPORT
  i40e/base: unify the capability function
  i40e/base: fix for PHY NVM interaction problem
  i40e/base: set shared bit for multicast filters
  i40e/base: support operating port mirroring rules
  i40e: add VEB stat control
  i40e/base: implement new API function
  i40e/base: add functions to blink led
  i40e/base: apply promisc mode to Tx Traffic
  i40e/base: fix driver load failure
  i40e/base: save off VSI resource count
  i40e/base: coding style fixes
  i40e: use AQ rx control register read/write
  i40e: expose some registers
  i40e/base: add a new Virtchnl offload
  i40e/base: add AQ thermal sensor control struct
  i40e: update structure and macro definitions
  i40e: add base driver release info
  i40evf: use base driver defined interface

 doc/guides/rel_notes/release_16_04.rst  |  15 +
 drivers/net/i40e/Makefile   |   1 +
 drivers/net/i40e/base/i40e_adminq.c |  27 +-
 drivers/net/i40e/base/i40e_adminq_cmd.h | 234 +++---
 drivers/net/i40e/base/i40e_common.c | 942 +---
 drivers/net/i40e/base/i40e_dcb.c|  34 +-
 drivers/net/i40e/base/i40e_devids.h |  10 +-
 drivers/net/i40e/base/i40e_lan_hmc.c|   4 +-
 drivers/net/i40e/base/i40e_nvm.c| 142 +++-
 drivers/net/i40e/base/i40e_osdep.h  |  36 +
 drivers/net/i40e/base/i40e_prototype.h  |  48 +-
 drivers/net/i40e/base/i40e_register.h   |  48 ++
 drivers/net/i40e/base/i40e_type.h   |  24 +-
 drivers/net/i40e/base/i40e_virtchnl.h   |   1 +
 drivers/net/i40e/i40e_ethdev.c  |  81 +-
 drivers/net/i40e/i40e_ethdev.h  |   2 +-
 drivers/net/i40e/i40e_ethdev_vf.c   |  50 +-
 drivers/net/i40e/i40e_fdir.c|  13 +-
 drivers/net/i40e/i40e_pf.c  |   6 +-
 drivers/net/i40e/i40e_rxtx.c|   8 +-
 lib/librte_eal/common/include/rte_pci_dev_ids.h |   8 +-
 21 files changed, 1391 insertions(+), 343 deletions(-)

-- 
2.5.0



[dpdk-dev] [PATCH v2 0/2] Increase number of next hops for LPM IPv4

2016-03-08 Thread Thomas Monjalon
2016-01-29 13:12, Michal Kobylinski:
> This patchset extend next_hop field from 8-bits to 24-bits in LPM library for 
> IPv4.

waiting v3, any news please?
Jerin has to rebase on top of this series.


[dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread

2016-03-08 Thread Thomas Monjalon
2016-02-28 22:17, Thomas Monjalon:
> 2016-02-13 13:38, Matthew Hall:
> > There is no good way to shut down this thread from an application signal
> > handler. Here we add an rte_eal_intr_exit() function to allow this.
> 
> Please Cunming,
> Would you have time to review this series about interrupt thread?
> Thank you

PING - reviewers wanted


[dpdk-dev] [PATCH v9 0/4] ethdev: add speed capabilities and refactor link API

2016-03-08 Thread Marc Sune
2016-03-01 1:45 GMT+01:00 Marc Sune :

> The current rte_eth_dev_info abstraction does not provide any mechanism to
> get the supported speed(s) of an ethdev.
>
> For some drivers (e.g. ixgbe), an educated guess could be done based on the
> driver's name (driver_name in rte_eth_dev_info), see:
>
> http://dpdk.org/ml/archives/dev/2013-August/000412.html
>
> However, i) doing string comparisons is annoying, and can silently
> break existing applications if PMDs change their names ii) it does not
> provide all the supported capabilities of the ethdev iii) for some drivers
> it
> is impossible determine correctly the (max) speed by the application
> (e.g. in i40, distinguish between XL710 and X710).
>
> In addition, the link APIs do not allow to define a set of advertised link
> speeds for autonegociation.
>
> This series of patches adds the following capabilities:
>
> * speed_capa bitmap in rte_eth_dev_info, which is filled by the PMDs
>   according to the physical device capabilities.
> * refactors link API in ethdev to allow the definition of the advertised
>   link speeds, fix speed (no auto-negociation) or advertise all supported
>   speeds (default).
>
> WARNING: this patch series, specifically 3/4, is NOT tested for most of the
> PMDs, due to the lack of hardware. Only generic EM is tested (VM).
> Reviewing
> and testing required by PMD maintainers.
>
> * * * * *
>
> v2: rebase, converted speed_capa into 32 bits bitmap, fixed alignment
> (checkpatch).
>
> v3: rebase to v2.1. unified ETH_LINK_SPEED and ETH_SPEED_CAP into
> ETH_SPEED.
> Converted field speed in struct rte_eth_conf to speed, to allow a
> bitmap
> for defining the announced speeds, as suggested M. Brorup. Fixed
> spelling
> issues.
>
> v4: fixed errata in the documentation of field speeds of rte_eth_conf, and
> commit 1/2 message. rebased to v2.1.0. v3 was incorrectly based on
> ~2.1.0-rc1.
>
> v5: revert to v2 speed capabilities patch. Fixed MLX4 speed capabilities
> (thanks N. Laranjeiro). Refactored link speed API to allow setting
> advertised speeds (3/4). Added NO_AUTONEG option to explicitely disable
> auto-negociation. Updated 2.2 rel. notes (4/4). Rebased to current
> HEAD.
>
> v6: Move link_duplex to be part of bitfield. Fixed i40 autoneg flag link
> update code. Added rte_eth_speed_to_bm_flag() to .map file. Fixed other
> spelling issues. Rebased to current HEAD.
>
> v7: Rebased to current HEAD. Moved documentation to v2.3. Still needs
> testing
> from PMD maintainers.
>
> v8: Rebased to current HEAD. Modified em driver impl. to not touch base
> files.
> Merged patch 5 into 3 (map file). Changed numeric speed to a 64 bit
> value.
> Filled-in speed capabilities for drivers bnx2x, cxgbe, mlx5 and nfp in
> addition to the ones of previous patch sets.
>
> v9: rebased to current HEAD. Reverted numeric speed to 32 bit in struct
> rte_eth_link (no atomic link get > 64bit). Fixed mlx5 driver
> compilation
> and link speeds. Moved documentation to release_16_04.rst and fixed
> several
> issues. Upgrade NIC notes with speed capabilities.
>

Anyone interested in reviewing and _testing_ this series?

Thank you
Marc


>
> Marc Sune (4):
>   ethdev: Added ETH_SPEED_CAP bitmap for ports
>   ethdev: Fill speed capability bitmaps in the PMDs
>   ethdev: redesign link speed config API
>   doc: update with link changes
>
>  app/test-pipeline/init.c  |   2 +-
>  app/test-pmd/cmdline.c| 124
> +++---
>  app/test-pmd/config.c |   4 +-
>  app/test/virtual_pmd.c|   4 +-
>  doc/guides/nics/overview.rst  |   1 +
>  doc/guides/rel_notes/release_16_04.rst|  27 +++
>  drivers/net/af_packet/rte_eth_af_packet.c |   5 +-
>  drivers/net/bnx2x/bnx2x_ethdev.c  |   7 +-
>  drivers/net/bonding/rte_eth_bond_8023ad.c |  14 ++--
>  drivers/net/cxgbe/base/t4_hw.c|   8 +-
>  drivers/net/cxgbe/cxgbe_ethdev.c  |   1 +
>  drivers/net/e1000/em_ethdev.c | 112
> ++-
>  drivers/net/e1000/igb_ethdev.c| 107 +++---
>  drivers/net/fm10k/fm10k_ethdev.c  |   6 +-
>  drivers/net/i40e/i40e_ethdev.c|  78 +++
>  drivers/net/i40e/i40e_ethdev_vf.c |  11 +--
>  drivers/net/ixgbe/ixgbe_ethdev.c  |  80 +--
>  drivers/net/mlx4/mlx4.c   |   6 ++
>  drivers/net/mlx5/mlx5_ethdev.c|   7 ++
>  drivers/net/mpipe/mpipe_tilegx.c  |   6 +-
>  drivers/net/nfp/nfp_net.c |   4 +-
>  drivers/net/null/rte_eth_null.c   |   5 +-
>  drivers/net/pcap/rte_eth_pcap.c   |   9 ++-
>  drivers/net/ring/rte_eth_ring.c   |   5 +-
>  drivers/net/virtio/virtio_ethdev.c|   2 +-
>  drivers/net/virtio/virtio_ethdev.h|   2 -
>  drivers/net/vmxnet3/vmxnet3_ethdev.c  |   5 +-
>  

[dpdk-dev] [PATCH v2 0/2] Increase number of next hops for LPM IPv4

2016-03-08 Thread Kobylinski, MichalX


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Tuesday, March 8, 2016 4:13 PM
> To: Kobylinski, MichalX 
> Cc: dev at dpdk.org; Jerin Jacob 
> Subject: Re: [dpdk-dev] [PATCH v2 0/2] Increase number of next hops for
> LPM IPv4
> Importance: High
> 
> 2016-01-29 13:12, Michal Kobylinski:
> > This patchset extend next_hop field from 8-bits to 24-bits in LPM library 
> > for
> IPv4.
> 
> waiting v3, any news please?

I'm working on v3.
Today I will post v3 on mailing list.
> Jerin has to rebase on top of this series.


[dpdk-dev] [PATCH v6] eal: add function to check if primary proc alive

2016-03-08 Thread David Marchand
On Tue, Mar 8, 2016 at 2:57 PM, Van Haaren, Harry
 wrote:
>> From: David Marchand [mailto:david.marchand at 6wind.com]
>> >> The issue is that if a secondary process is initialized, it holds a read
>> >> lock on  /var/run/.rte_config  and this prevents a primary from starting.
>> >
>> > The new function is advertised as a monitoring feature.
>> > But it seems to be also a workaround for an ordering issue when starting
>> > primary and secondary processes concurrently, right?
>>
>> +1
>
> You are correct, the function rte_eal_primary_proc_alive() added here is
> for monitoring if there is a primary process alive.
>
> The rte_eal_mcfg_complete() function call in rte_eal_init() is delayed
> to avoid a race-condition between secondary and primary processes.
> This race-condition occurs when two processes probe the PCI devices
> at the same time.
>
> Delaying the rte_eal_mcfg_complete() call until after the primary has
> finished rte_eal_pci_probe() ensures that this race condition is avoided.

Then, those are two different things.
Can you split this into two patches: one for the fix and one for the
new function ?

CCing sergio, who is the multi process maintainer.

Thanks.

-- 
David Marchand


[dpdk-dev] [PATCH v7 2/2] cryptodev: change burst API to be crypto op oriented

2016-03-08 Thread Thomas Monjalon
2016-03-07 11:50, Fiona Trahe:
> This patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts
> rte_crypto_op's rather than the current implementation which operates on
> rte_mbuf bursts, this simplifies the burst processing in the crypto PMDs and 
> the
> use of crypto operations in general.
> 
> The changes also continues the separatation of the symmetric operation 
> parameters
> from the more general operation parameters, this will simplify the 
> integration of
> asymmetric crypto operations in the future.
> 
> As well as the changes to the crypto APIs this patch adds functions for 
> managing
> rte_crypto_op pools to the cryptodev API. It modifies the existing PMDs, unit
> tests and sample application to work with the modified APIs and finally
> removes the now unused rte_mbuf_offload library.

Why not doing several patches?

> -Packet buffer offload - EXPERIMENTAL
> -M: Declan Doherty 
> -F: lib/librte_mbuf_offload/

Removing a library is important. It is not mentioned in the message.
It deserves a separate commit, please.

> @@ -62,8 +61,7 @@ struct crypto_unittest_params {
>  
>   struct rte_cryptodev_sym_session *sess;
>  
> - struct rte_mbuf_offload *ol;
> - struct rte_crypto_sym_op *op;
> + struct rte_crypto_op *op;

Isn't it something which was just renamed in the previous patch?

> -#if HEX_DUMP
> +#ifdef HEX_DUMP
>  static void
>  hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m)

A better clean-up would be to remove this ifdef.
If you need a debug function which is not already in EAL, you can
consider adding it.




[dpdk-dev] [PATCH v7 1/2] cryptodev: API tidy and changes to support future extensions

2016-03-08 Thread Thomas Monjalon
Hi,

2016-03-07 11:50, Fiona Trahe:
> This patch splits symmetric specific definitions and
>  functions away from the common crypto APIs to facilitate the future extension
>  and expansion of the cryptodev framework, in order to allow  asymmetric
>  crypto operations to be introduced at a later date, as well as to clean the
>  logical structure of the public includes. The patch also introduces the _sym
>  prefix to symmetric specific structure and functions to improve clarity in
>  the API.

It seems you need to update the examples in the same patch, they do not compile
anymore after these changes.
Again, it would be easier to review if you had split the changes to several
patches: one for the sym suffix, others for more tidying.


[dpdk-dev] [PATCH v6 5/5] app/testpmd: add CLIs for E-tag operation

2016-03-08 Thread Wenzhuo Lu
Add the CLIs to support the E-tag operation.
1, Offloading of E-tag insertion and stripping.
2, Forwarding the E-tag packets to pools based on the GRP and E-CID_base.

Signed-off-by: Wenzhuo Lu 
---
 app/test-pmd/cmdline.c  | 399 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  26 ++
 2 files changed, 425 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 031db11..74552ca 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -502,6 +502,27 @@ static void cmd_help_long_parsed(void *parsed_result,
"set link-down port (port_id)\n"
"   Set link down for a port.\n\n"

+   "E-tag set insertion on port-tag-id (value)"
+   " port (port_id) vf (vf_id)\n"
+   "Enable E-tag insertion for a VF on a port\n\n"
+
+   "E-tag set insertion off port (port_id) vf (vf_id)\n"
+   "Disable E-tag insertion for a VF on a port\n\n"
+
+   "E-tag set stripping (on|off) port (port_id)\n"
+   "Enable/disable E-tag stripping on a port\n\n"
+
+   "E-tag set forwarding (on|off) port (port_id)\n"
+   "Enable/disable E-tag based forwarding"
+   " on a port\n\n"
+
+   "E-tag set filter add e-tag-id (value) dst-pool"
+   " (pool_id) port (port_id)\n"
+   "Add an E-tag forwarding filter on a port\n\n"
+
+   "E-tag set filter del e-tag-id (value) port (port_id)\n"
+   "Delete an E-tag forwarding filter on a port\n\n"
+
, list_pkt_forwarding_modes()
);
}
@@ -9904,6 +9925,378 @@ cmdline_parse_inst_t 
cmd_config_l2_tunnel_en_dis_specific = {
},
 };

+/* E-tag configuration */
+
+/* Common result structure for all E-tag configuration */
+struct cmd_config_e_tag_result {
+   cmdline_fixed_string_t e_tag;
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t insertion;
+   cmdline_fixed_string_t stripping;
+   cmdline_fixed_string_t forwarding;
+   cmdline_fixed_string_t filter;
+   cmdline_fixed_string_t add;
+   cmdline_fixed_string_t del;
+   cmdline_fixed_string_t on;
+   cmdline_fixed_string_t off;
+   cmdline_fixed_string_t on_off;
+   cmdline_fixed_string_t port_tag_id;
+   uint32_t port_tag_id_val;
+   cmdline_fixed_string_t e_tag_id;
+   uint16_t e_tag_id_val;
+   cmdline_fixed_string_t dst_pool;
+   uint8_t dst_pool_val;
+   cmdline_fixed_string_t port;
+   uint8_t port_id;
+   cmdline_fixed_string_t vf;
+   uint8_t vf_id;
+};
+
+/* Common CLI fields for all E-tag configuration */
+cmdline_parse_token_string_t cmd_config_e_tag_e_tag =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+e_tag, "E-tag");
+cmdline_parse_token_string_t cmd_config_e_tag_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+set, "set");
+cmdline_parse_token_string_t cmd_config_e_tag_insertion =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+insertion, "insertion");
+cmdline_parse_token_string_t cmd_config_e_tag_stripping =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+stripping, "stripping");
+cmdline_parse_token_string_t cmd_config_e_tag_forwarding =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+forwarding, "forwarding");
+cmdline_parse_token_string_t cmd_config_e_tag_filter =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+filter, "filter");
+cmdline_parse_token_string_t cmd_config_e_tag_add =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+add, "add");
+cmdline_parse_token_string_t cmd_config_e_tag_del =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+del, "del");
+cmdline_parse_token_string_t cmd_config_e_tag_on =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+on, "on");
+cmdline_parse_token_string_t cmd_config_e_tag_off =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+off, "off");
+cmdline_parse_token_string_t cmd_config_e_tag_on_off =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+on_off, "on#off");
+cmdline_parse_token_string_t cmd_config_e_tag_port_tag_id =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_e_tag_result,
+port_tag_id, "port-tag-id");

[dpdk-dev] [PATCH v6 4/5] app/testpmd: add CLIs for l2 tunnel config

2016-03-08 Thread Wenzhuo Lu
Add CLIs to config ether type of l2 tunnel, and to enable/disable
a type of l2 tunnel.
Now only e-tag tunnel is supported.

Signed-off-by: Wenzhuo Lu 
---
 app/test-pmd/cmdline.c  | 278 +++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  11 ++
 2 files changed, 288 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 52e9f5f..031db11 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -572,7 +572,15 @@ static void cmd_help_long_parsed(void *parsed_result,

"port (port_id) (rxq|txq) (queue_id) (start|stop)\n"
"Start/stop a rx/tx queue of port X. Only take 
effect"
-   " when port X is started\n"
+   " when port X is started\n\n"
+
+   "port config (port_id|all) l2-tunnel E-tag ether-type"
+   " (value)\n"
+   "Set the value of E-tag ether-type.\n\n"
+
+   "port config (port_id|all) l2-tunnel E-tag"
+   " (enable|disable)\n"
+   "Enable/disable the E-tag support.\n\n"
);
}

@@ -9632,6 +9640,270 @@ cmdline_parse_inst_t cmd_mcast_addr = {
},
 };

+/* l2 tunnel config
+ * only support E-tag now.
+ */
+
+/* Ether type config */
+struct cmd_config_l2_tunnel_eth_type_result {
+   cmdline_fixed_string_t port;
+   cmdline_fixed_string_t config;
+   cmdline_fixed_string_t all;
+   uint8_t id;
+   cmdline_fixed_string_t l2_tunnel;
+   cmdline_fixed_string_t l2_tunnel_type;
+   cmdline_fixed_string_t eth_type;
+   uint16_t eth_type_val;
+};
+
+cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_port =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_l2_tunnel_eth_type_result,
+port, "port");
+cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_config =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_l2_tunnel_eth_type_result,
+config, "config");
+cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_all_str =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_l2_tunnel_eth_type_result,
+all, "all");
+cmdline_parse_token_num_t cmd_config_l2_tunnel_eth_type_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_config_l2_tunnel_eth_type_result,
+id, UINT8);
+cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_l2_tunnel =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_l2_tunnel_eth_type_result,
+l2_tunnel, "l2-tunnel");
+cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_l2_tunnel_type =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_l2_tunnel_eth_type_result,
+l2_tunnel_type, "E-tag");
+cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_eth_type =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_config_l2_tunnel_eth_type_result,
+eth_type, "ether-type");
+cmdline_parse_token_num_t cmd_config_l2_tunnel_eth_type_eth_type_val =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_config_l2_tunnel_eth_type_result,
+eth_type_val, UINT16);
+
+static uint32_t
+str2fdir_l2_tunnel_type(char *string)
+{
+   uint32_t i = 0;
+
+   static const struct {
+   char str[32];
+   uint32_t type;
+   } l2_tunnel_type_str[] = {
+   {"E-tag", RTE_L2_TUNNEL_TYPE_E_TAG},
+   };
+
+   for (i = 0; i < RTE_DIM(l2_tunnel_type_str); i++) {
+   if (!strcmp(l2_tunnel_type_str[i].str, string))
+   return l2_tunnel_type_str[i].type;
+   }
+   return RTE_L2_TUNNEL_TYPE_NONE;
+}
+
+/* ether type config for all ports */
+static void
+cmd_config_l2_tunnel_eth_type_all_parsed
+   (void *parsed_result,
+__attribute__((unused)) struct cmdline *cl,
+__attribute__((unused)) void *data)
+{
+   struct cmd_config_l2_tunnel_eth_type_result *res = parsed_result;
+   struct rte_eth_l2_tunnel entry;
+   portid_t pid;
+
+   entry.l2_tunnel_type = str2fdir_l2_tunnel_type(res->l2_tunnel_type);
+   entry.ether_type = res->eth_type_val;
+
+   FOREACH_PORT(pid, ports) {
+   rte_eth_dev_l2_tunnel_eth_type_conf(pid, );
+   }
+}
+
+cmdline_parse_inst_t cmd_config_l2_tunnel_eth_type_all = {
+   .f = cmd_config_l2_tunnel_eth_type_all_parsed,
+   .data = NULL,
+   .help_str = "port config all l2-tunnel ether-type",
+   .tokens = {
+   (void *)_config_l2_tunnel_eth_type_port,
+   (void *)_config_l2_tunnel_eth_type_config,
+   (void *)_config_l2_tunnel_eth_type_all_str,
+   (void *)_config_l2_tunnel_eth_type_l2_tunnel,
+   (void *)_config_l2_tunnel_eth_type_l2_tunnel_type,
+

[dpdk-dev] [PATCH v6 3/5] ixgbe: support l2 tunnel operations

2016-03-08 Thread Wenzhuo Lu
Add support of l2 tunnel configuration and operations.
1, Support modifying ether type of a type of l2 tunnel.
2, Support enabling and disabling the support of a type of l2 tunnel.
3, Support enabling/disabling l2 tunnel tag insertion/stripping.
4, Support enabling/disabling l2 tunnel packets forwarding.
5, Support adding/deleting forwarding rules for l2 tunnel packets.
Only support E-tag now.

Also update the release note.

Signed-off-by: Wenzhuo Lu 
---
 doc/guides/rel_notes/release_16_04.rst |  21 ++
 drivers/net/ixgbe/ixgbe_ethdev.c   | 538 +
 2 files changed, 559 insertions(+)

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index eb1b3b2..994da33 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -44,6 +44,27 @@ This section should contain new features added in this 
release. Sample format:
   Add the offload and negotiation of checksum and TSO between vhost-user and
   vanilla Linux virtio guest.

+* **Added support for E-tag on X550.**
+
+  E-tag is defined in 802.1br. Please reference
+  http://www.ieee802.org/1/pages/802.1br.html.
+
+  This feature is for VF, but please aware all the setting is on PF. It means
+  the CLIs should be used on PF, but some of their effect will be shown on VF.
+  The forwarding of E-tag packets based on GRP and E-CID_base will have effect
+  on PF. Theoretically the E-tag packets can be forwarded to any pool/queue.
+  But normally we'd like to forward the packets to the pools/queues belonging
+  to the VFs. And E-tag insertion and stripping will have effect on VFs. When
+  VF receives E-tag packets, it should strip the E-tag. When VF transmits
+  packets, it should insert the E-tag. Both can be offloaded.
+
+  When we want to use this E-tag support feature, the forwarding should be
+  enabled to forward the packets received by PF to indicated VFs. And insertion
+  and stripping should be enabled for VFs to offload the effort to HW.
+
+  * Support E-tag offloading of insertion and stripping.
+  * Support Forwarding E-tag packets to pools based on
+GRP and E-CID_base.

 Resolved Issues
 ---
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b99e48e..b3299e6 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -139,6 +139,17 @@
 #define IXGBE_CYCLECOUNTER_MASK   0xULL

 #define IXGBE_VT_CTL_POOLING_MODE_MASK 0x0003
+#define IXGBE_VT_CTL_POOLING_MODE_ETAG 0x0001
+#define DEFAULT_ETAG_ETYPE 0x893f
+#define IXGBE_ETAG_ETYPE   0x5084
+#define IXGBE_ETAG_ETYPE_MASK  0x
+#define IXGBE_ETAG_ETYPE_VALID 0x8000
+#define IXGBE_RAH_ADTYPE   0x4000
+#define IXGBE_RAL_ETAG_FILTER_MASK 0x3fff
+#define IXGBE_VMVIR_TAGA_MASK  0x1800
+#define IXGBE_VMVIR_TAGA_ETAG_INSERT   0x0800
+#define IXGBE_VMTIR(_i) (0x00017000 + ((_i) * 4)) /* 64 of these (0-63) */
+#define IXGBE_QDE_STRIP_TAG0x0004

 static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
@@ -339,6 +350,19 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev 
*dev,
   struct timespec *timestamp);
 static int ixgbe_timesync_write_time(struct rte_eth_dev *dev,
   const struct timespec *timestamp);
+static int ixgbe_dev_l2_tunnel_eth_type_conf
+   (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel *l2_tunnel);
+static int ixgbe_dev_l2_tunnel_offload_set
+   (struct rte_eth_dev *dev,
+struct rte_eth_l2_tunnel *l2_tunnel,
+uint32_t mask,
+uint8_t en);
+static int ixgbe_dev_l2_tunnel_filter_add
+   (struct rte_eth_dev *dev,
+struct rte_eth_l2_tunnel *l2_tunnel);
+static int ixgbe_dev_l2_tunnel_filter_del
+   (struct rte_eth_dev *dev,
+struct rte_eth_l2_tunnel *l2_tunnel);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -497,6 +521,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.timesync_adjust_time = ixgbe_timesync_adjust_time,
.timesync_read_time   = ixgbe_timesync_read_time,
.timesync_write_time  = ixgbe_timesync_write_time,
+   .l2_tunnel_eth_type_conf = ixgbe_dev_l2_tunnel_eth_type_conf,
+   .l2_tunnel_offload_set   = ixgbe_dev_l2_tunnel_offload_set,
+   .l2_tunnel_filter_add= ixgbe_dev_l2_tunnel_filter_add,
+   .l2_tunnel_filter_del= ixgbe_dev_l2_tunnel_filter_del,
 };

 /*
@@ -6201,6 +6229,516 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev,
return 0;
 }

+/* Update e-tag ether type */
+static int
+ixgbe_update_e_tag_eth_type(struct ixgbe_hw *hw,
+   uint16_t ether_type)
+{
+   uint32_t 

[dpdk-dev] [PATCH v6 2/5] lib/librte_ether: support l2 tunnel operations

2016-03-08 Thread Wenzhuo Lu
Add functions to support l2 tunnel configuration and operations.
1, L2 tunnel ether type modification.
   It means modifying the ether type of a specific type of tunnel.
   So the packet with this ether type will be parsed as this type
   of tunnel.
2, Enabling/disabling l2 tunnel support.
   It means enabling/disabling the ability of parsing the specific
   type of tunnel. This ability should be enabled before we enable
   filtering, forwarding, offloading for this specific type of
   tunnel.
3, Insertion and stripping for l2 tunnel tag.
4, Forwarding the packets to a pool based on l2 tunnel tag.

Only support e-tag tunnel now.

Signed-off-by: Wenzhuo Lu 
---
 lib/librte_ether/rte_eth_ctrl.h|   9 +++
 lib/librte_ether/rte_ethdev.c  | 102 +
 lib/librte_ether/rte_ethdev.h  | 131 +
 lib/librte_ether/rte_ether_version.map |   4 +
 4 files changed, 246 insertions(+)

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index ce224ad..09af6fb 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -804,6 +804,15 @@ struct rte_eth_hash_filter_info {
} info;
 };

+/**
+ * l2 tunnel type.
+ */
+enum rte_eth_l2_tunnel_type {
+   RTE_L2_TUNNEL_TYPE_NONE = 0,
+   RTE_L2_TUNNEL_TYPE_E_TAG,
+   RTE_L2_TUNNEL_TYPE_MAX,
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 756b234..729841f 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3237,3 +3237,105 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, 
struct rte_pci_device *pci_de
eth_dev->data->numa_node = pci_dev->numa_node;
eth_dev->data->drv_name = pci_dev->driver->name;
 }
+
+int
+rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
+   struct rte_eth_l2_tunnel *l2_tunnel)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   if (l2_tunnel == NULL) {
+   RTE_PMD_DEBUG_TRACE("Invalid l2_tunnel parameter\n");
+   return -EINVAL;
+   }
+
+   if (l2_tunnel->l2_tunnel_type >= RTE_L2_TUNNEL_TYPE_MAX) {
+   RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n");
+   return -EINVAL;
+   }
+
+   dev = _eth_devices[port_id];
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->l2_tunnel_eth_type_conf,
+   -ENOTSUP);
+   return (*dev->dev_ops->l2_tunnel_eth_type_conf)(dev, l2_tunnel);
+}
+
+int
+rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
+ struct rte_eth_l2_tunnel *l2_tunnel,
+ uint32_t mask,
+ uint8_t en)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   if (l2_tunnel == NULL) {
+   RTE_PMD_DEBUG_TRACE("Invalid l2_tunnel parameter\n");
+   return -EINVAL;
+   }
+
+   if (l2_tunnel->l2_tunnel_type >= RTE_L2_TUNNEL_TYPE_MAX) {
+   RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type.\n");
+   return -EINVAL;
+   }
+
+   if (mask == 0) {
+   RTE_PMD_DEBUG_TRACE("Mask should have a value.\n");
+   return -EINVAL;
+   }
+
+   dev = _eth_devices[port_id];
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->l2_tunnel_offload_set,
+   -ENOTSUP);
+   return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
+}
+
+int
+rte_eth_dev_l2_tunnel_filter_add(uint8_t port_id,
+struct rte_eth_l2_tunnel *l2_tunnel)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   if (l2_tunnel == NULL) {
+   RTE_PMD_DEBUG_TRACE("Invalid l2_tunnel parameter\n");
+   return -EINVAL;
+   }
+
+   if (l2_tunnel->l2_tunnel_type >= RTE_L2_TUNNEL_TYPE_MAX) {
+   RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n");
+   return -EINVAL;
+   }
+
+   dev = _eth_devices[port_id];
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->l2_tunnel_filter_add,
+   -ENOTSUP);
+   return (*dev->dev_ops->l2_tunnel_filter_add)(dev,
+l2_tunnel);
+}
+
+int
+rte_eth_dev_l2_tunnel_filter_del(uint8_t port_id,
+struct rte_eth_l2_tunnel *l2_tunnel)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   if (l2_tunnel == NULL) {
+   RTE_PMD_DEBUG_TRACE("Invalid l2_tunnel parameter\n");
+   return -EINVAL;
+   }
+
+   if (l2_tunnel->l2_tunnel_type >= RTE_L2_TUNNEL_TYPE_MAX) {
+   RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n");
+   return -EINVAL;
+   }
+
+   

[dpdk-dev] [PATCH v3 00/18] fm10k: update shared code

2016-03-08 Thread Bruce Richardson
On Tue, Mar 08, 2016 at 02:25:27PM +, Chen, Jing D wrote:
> Hi, Xiao
> 
> > -Original Message-
> > From: Wang, Xiao W
> > Sent: Tuesday, March 8, 2016 8:15 AM
> > To: Richardson, Bruce ; Chen, Jing D
> > 
> > Cc: Chen, Jing D ; dev at dpdk.org; He, Shaopeng
> > 
> > Subject: RE: [PATCH v3 00/18] fm10k: update shared code
> > 
> > 
> > 
> > > -Original Message-
> > > From: Richardson, Bruce
> > > Sent: Tuesday, March 8, 2016 9:24 PM
> > > To: Wang, Xiao W ; Chen, Jing D
> > > 
> > > Cc: Chen, Jing D ; dev at dpdk.org; He, Shaopeng
> > > 
> > > Subject: Re: [PATCH v3 00/18] fm10k: update shared code
> > >
> > > On Fri, Feb 19, 2016 at 07:06:47PM +0800, Wang Xiao W wrote:
> > > > v3:
> > > > * Fixed checkpatch.pl warning about long commit message.
> > > > * Fixed the issue of compile failure about part of patches applied.
> > > > * Split the misc-small-fixes patch into several patches.
> > > >
> > > > v2:
> > > > * Put the two extra fix patches ahead of the base code patches.
> > > >
> > > > This patch set has passed regression test.
> > > >
> > > > Wang Xiao W (18):
> > > >   fm10k: use default mailbox message handler for PF
> > > >   fm10k/base: correct typecast in fm10k_update_xc_addr_pf
> > > >   fm10k/base: cleanup namespace pollution
> > > >   fm10k/base: use bitshift for itr_scale
> > > >   fm10k/base: reset max_queues on init_hw_vf failure
> > > >   fm10k/base: document ITR scale workaround in VF TDLEN register
> > > >   fm10k/base: cleanup lines over 80 characters
> > > >   fm10k/base: cleanup useless else
> > > >   fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
> > > >   fm10k/base: do not use CamelCase
> > > >   fm10k/base: use memcpy for mac addr copy
> > > >   fm10k/base: allow removal of is_slot_appropriate function
> > > >   fm10k/base: consistently use VLAN ID when referencing vid variables
> > > >   fm10k/base: imporve comment per upstream review changes
> > > >   fm10k/base: fix TLV structures alignment
> > > >   fm10k/base: move constants to the right of binary operators
> > > >   fm10k/base: minor cleanups
> > > >   fm10k/base: remove unused struct element
> > > >
> > > >  drivers/net/fm10k/base/fm10k_api.c   |   2 +
> > > >  drivers/net/fm10k/base/fm10k_api.h   |   2 +
> > > >  drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++-
> > > >  drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
> > > >  drivers/net/fm10k/base/fm10k_osdep.h |  32 ++
> > > >  drivers/net/fm10k/base/fm10k_pf.c|  88 +
> > > >  drivers/net/fm10k/base/fm10k_pf.h|  18 ++--
> > > >  drivers/net/fm10k/base/fm10k_tlv.c   |  40 
> > > >  drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
> > > >  drivers/net/fm10k/base/fm10k_type.h  | 182 +++-
> > ---
> > > >  drivers/net/fm10k/base/fm10k_vf.c|  32 --
> > > >  drivers/net/fm10k/fm10k_ethdev.c |  41 +++-
> > > >  12 files changed, 222 insertions(+), 298 deletions(-)
> > > >
> > > > --
> > > > 1.9.3
> > > >
> > > Hi Mark,
> > >
> > > Can we get fm10k maintainer review and/or ack on this patchset please.
> > >
> > > Thanks,
> > > /Bruce
> > 
> > Hi Bruce,
> > 
> > Mark has reviewed and acked the patch set in v2, and I put the "Acked-by "
> > in the v3 01/18 patch.
> > It's the same for my FTAG patch.
> > 
> 
> It's better to add acked-by in both patch set and cover letter, this may be 
> more
> helpful for maintainers. 
> 
An earlier ack should be reflected by putting the ack on all patches of the set
in later revisions. If it's only on patch 1, that implies that only that one 
patch
has been acked. If the ack is included in the cover letter only, then it's 
likely
to be missed, as a series ack is expected as a reply to the cover letter 
(because
as stated above, subsequent revs should include the ack in each patch itself)

/Bruce


[dpdk-dev] [PATCH v6] enic: receive path performance improvements

2016-03-08 Thread Bruce Richardson
On Fri, Mar 04, 2016 at 01:09:00PM -0800, John Daley wrote:
> This is a wholesale replacement of the Enic PMD receive path in order
> to improve performance and code clarity. The changes are:
> - Simplify and reduce code path length of receive function.
> - Put most of the fast-path receive funtions in one file.
> - Reduce the number of posted_index updates (pay attention to rx_free_thresh)
> - Remove the unneeded container structure around the RQ mbuf ring
> - Prefetch next Mbuf and descriptors while processing the current one
> - Use a lookup table for converting CQ flags to mbuf flags.
> 
> Signed-off-by: John Daley 
> ---
Applied to dpdk-next-net/rel_16_04

/Bruce


  1   2   >