patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1
@ 2017-02-15  6:26 Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: fix dead loop in enqueue path' " Yuanhan Liu
                   ` (38 more replies)
  0 siblings, 39 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Emmanuel Roullit; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 636b0b46e2c77f3738affa647c5e8e6eed20f74f Mon Sep 17 00:00:00 2001
From: Emmanuel Roullit <emmanuel.roullit@gmail.com>
Date: Tue, 24 Jan 2017 21:26:56 +0100
Subject: [PATCH] devargs: reset driver name pointer on parsing failure

[ upstream commit 3cdfdf2a3303bb50d98c4f1689fc4b3745ea1e4f ]

The pointer set by strdup() needs to be cleared on failure to avoid a
potential double-free from the caller.

Found with clang static analysis:
lib/librte_eal/common/eal_common_devargs.c:123:2:
warning: Attempt to free released memory
        free(buf);
        ^~~~~~~~~

Fixes: 0fe11ec592b2 ("eal: add vdev init and uninit")

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
---
 lib/librte_eal/common/eal_common_devargs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
index e403717..ffa8ad9 100644
--- a/lib/librte_eal/common/eal_common_devargs.c
+++ b/lib/librte_eal/common/eal_common_devargs.c
@@ -72,6 +72,7 @@ rte_eal_parse_devargs_str(const char *devargs_str,
 
 	if (*drvargs == NULL) {
 		free(*drvname);
+		*drvname = NULL;
 		return -1;
 	}
 	return 0;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'vhost: fix dead loop in enqueue path' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: fix long stall of negotiation' " Yuanhan Liu
                   ` (37 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Xieming Katty, Maxime Coquelin, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 9e9efea9b6ab8abf73c5d1560f7ed500d27a4146 Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Sun, 22 Jan 2017 16:46:58 +0800
Subject: [PATCH] vhost: fix dead loop in enqueue path

[ upstream commit cc7301908c031a288eeb6c12db21b938755b67ee ]

If a malicious guest forges a dead loop desc chain (let desc->next point
to itself) and desc->len is zero, this could lead to a dead loop in
copy_mbuf_to_desc(following is a simplified code to show this issue
clearly):

    while (mbuf_is_not_totally_consumed) {
        if (desc_avail == 0) {
            desc = &descs[desc->next];
            desc_avail = desc->len;
        }

        COPY(desc, mbuf, desc_avail);
    }

I have actually fixed a same issue before: commit a436f53ebfeb ("vhost:
avoid dead loop chain"); it fixes the dequeue path though, leaving the
enqueue path still vulnerable.

The fix is the same. Add a var nr_desc to avoid the dead loop.

Fixes: f1a519ad981c ("vhost: fix enqueue/dequeue to handle chained vring descriptors")

Reported-by: Xieming Katty <katty.xieming@huawei.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/virtio_net.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 595f67c..143c0fa 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -195,6 +195,8 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vring_desc *descs,
 	struct vring_desc *desc;
 	uint64_t desc_addr;
 	struct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0, 0, 0, 0, 0, 0}, 0};
+	/* A counter to avoid desc dead loop chain */
+	uint16_t nr_desc = 1;
 
 	desc = &descs[desc_idx];
 	desc_addr = gpa_to_vva(dev, desc->addr);
@@ -233,7 +235,7 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vring_desc *descs,
 				/* Room in vring buffer is not enough */
 				return -1;
 			}
-			if (unlikely(desc->next >= size))
+			if (unlikely(desc->next >= size || ++nr_desc > size))
 				return -1;
 
 			desc = &descs[desc->next];
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'vhost: fix long stall of negotiation' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: fix dead loop in enqueue path' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: do not GSO when no header is present' " Yuanhan Liu
                   ` (36 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Maxime Coquelin, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From a65fa5bd927ce2a496b04241bca29c94c3fbfe7e Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Sun, 22 Jan 2017 16:46:59 +0800
Subject: [PATCH] vhost: fix long stall of negotiation

[ upstream commit b8b992e93f387b0d0dda00b9feb6adb05ffe081c ]

Setting up the mapping from GPA (guest physical address) to HPA (guest
physical address) could be very time consuming when the guest memory is
backened with small pages (4K). The bigger the guest memory, the longer
it takes. This could lead a very long vhost-user negotiation.

Since the mapping is only needed in zero copy mode so far, we could
avoid such time consuming settup when zero copy is turned off (which is
the default case).

It's actually a workaround, a right fix might be to start a new thread,
and hide the big latency there.

Fixes: e246896178e6 ("vhost: get guest/host physical address mappings")

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost_user.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 50cb6d1..0cb1c67 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -567,7 +567,8 @@ vhost_user_set_mem_table(struct virtio_net *dev, struct VhostUserMsg *pmsg)
 		reg->host_user_addr = (uint64_t)(uintptr_t)mmap_addr +
 				      mmap_offset;
 
-		add_guest_pages(dev, reg, alignment);
+		if (dev->dequeue_zero_copy)
+			add_guest_pages(dev, reg, alignment);
 
 		RTE_LOG(INFO, VHOST_CONFIG,
 			"guest memory region %u, size: 0x%" PRIx64 "\n"
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'vhost: do not GSO when no header is present' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: fix dead loop in enqueue path' " Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: fix long stall of negotiation' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix performance regression due to TSO' " Yuanhan Liu
                   ` (35 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Emmanuel Roullit; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 0d4245a18aab183a2b6996120ffb1a1443634d9f Mon Sep 17 00:00:00 2001
From: Emmanuel Roullit <emmanuel.roullit@gmail.com>
Date: Tue, 24 Jan 2017 21:36:03 +0100
Subject: [PATCH] vhost: do not GSO when no header is present

[ upstream commit 5c1f70daafbca24fe10dc21afe44320e323d2f8f ]

Found with clang static analysis:
lib/librte_vhost/virtio_net.c:723:17: warning:
Access to field 'data_off' results in a dereference of a null pointer
(loaded from variable 'tcp_hdr')
        m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
                     ^~~~~~~~~~~~~~~~~

Fixes: d0cf91303d73 ("vhost: add Tx offload capabilities")

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 lib/librte_vhost/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 143c0fa..337470d 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -679,6 +679,7 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr)
 	default:
 		m->l3_len = 0;
 		*l4_proto = 0;
+		*l4_hdr = NULL;
 		break;
 	}
 }
@@ -715,7 +716,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m)
 		}
 	}
 
-	if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
+	if (l4_hdr && hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
 		switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
 		case VIRTIO_NET_HDR_GSO_TCPV4:
 		case VIRTIO_NET_HDR_GSO_TCPV6:
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/virtio: fix performance regression due to TSO' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (2 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: do not GSO when no header is present' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: optimize header reset on any layout' " Yuanhan Liu
                   ` (34 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu
  Cc: Olivier Matz, Maxime Coquelin, Michael S. Tsirkin, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 43ce94d1a20a60e7a0406bc6586379b23bf5bd18 Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Wed, 11 Jan 2017 12:27:11 +0800
Subject: [PATCH] net/virtio: fix performance regression due to TSO

[ upstream commit c9ea670c1dc7e3f111d8139f915082b60c9c1ffe ]

TSO is now enabled, but it's not actually being used by default in a
simple L2 forward mode. In such case, we have to zero the virtio net
headers, to inform the vhost backend that no offload is being used:

    hdr->csum_start = 0;
    hdr->csum_offset = 0;
    hdr->flags = 0;

    hdr->gso_type = 0;
    hdr->gso_size = 0;
    hdr->hdr_len = 0;

Such writes could be very costly; it introduces severe cache issues:
The above operations introduce cache write for each packet, which
stalls the read operation from the vhost backend.

The fact that virtio net header is initiated to zero in PMD driver
init stage means that these costly writes are unnecessary and could
be avoided:

    if (hdr->csum_start != 0)
        hdr->csum_start = 0;

And that's what the macro ASSIGN_UNLESS_EQUAL does. With this, the
performance drop introduced by TSO enabling is recovered: it could
be up to 20% in micro benchmarking.

Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload")
Fixes: 696573046e9e ("net/virtio: support TSO")

Cc: Olivier Matz <olivier.matz@6wind.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
---
 drivers/net/virtio/virtio_rxtx.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 22d97a4..edbd3cd 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -258,6 +258,12 @@ tx_offload_enabled(struct virtio_hw *hw)
 		vtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO6);
 }
 
+/* avoid write operation when necessary, to lessen cache issues */
+#define ASSIGN_UNLESS_EQUAL(var, val) do {	\
+	if ((var) != (val))			\
+		(var) = (val);			\
+} while (0)
+
 static inline void
 virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
 		       uint16_t needed, int use_indirect, int can_push)
@@ -337,9 +343,9 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
 			break;
 
 		default:
-			hdr->csum_start = 0;
-			hdr->csum_offset = 0;
-			hdr->flags = 0;
+			ASSIGN_UNLESS_EQUAL(hdr->csum_start, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->flags, 0);
 			break;
 		}
 
@@ -355,9 +361,9 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
 				cookie->l3_len +
 				cookie->l4_len;
 		} else {
-			hdr->gso_type = 0;
-			hdr->gso_size = 0;
-			hdr->hdr_len = 0;
+			ASSIGN_UNLESS_EQUAL(hdr->gso_type, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->gso_size, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->hdr_len, 0);
 		}
 	}
 
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/virtio: optimize header reset on any layout' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (3 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix performance regression due to TSO' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix Rx checksum flag' " Yuanhan Liu
                   ` (33 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Maxime Coquelin, Michael S. Tsirkin, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From a60c9fe6a40e162fd25faaebd3eee950a3591306 Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Wed, 11 Jan 2017 12:27:12 +0800
Subject: [PATCH] net/virtio: optimize header reset on any layout

[ upstream commit 16994abee215e55dcccf19114b324d5c407b3f56 ]

When any layout is used, the header is stored in the head room of mbuf.
mbuf is allocated and filled by user, means there is no gurateen the
header is all zero for non TSO case. Therefore, we have to do the reset
by ourself:

    memest(hdr, 0, head_size);

The memset has two impacts on performance:

- memset could not be inlined, which is a bit costly.
- more importantly, it touches the mbuf, which could introduce severe
  cache issues as described by former patch.

Similiary, we could do the same trick: reset just when necessary, when
the corresponding field is already 0, which is likely true for a simple
l2 forward case. It could boost the performance up to 20+% in micro
benchmarking.

Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_rxtx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index edbd3cd..a33ef1a 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -292,8 +292,14 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
 		hdr = (struct virtio_net_hdr *)
 			rte_pktmbuf_prepend(cookie, head_size);
 		/* if offload disabled, it is not zeroed below, do it now */
-		if (offload == 0)
-			memset(hdr, 0, head_size);
+		if (offload == 0) {
+			ASSIGN_UNLESS_EQUAL(hdr->csum_start, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->flags, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->gso_type, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->gso_size, 0);
+			ASSIGN_UNLESS_EQUAL(hdr->hdr_len, 0);
+		}
 	} else if (use_indirect) {
 		/* setup tx ring slot to point to indirect
 		 * descriptor list stored in reserved region.
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix Rx checksum flag' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (4 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: optimize header reset on any layout' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/mlx5: fix memory leak when parsing device params' " Yuanhan Liu
                   ` (32 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Xiao Wang; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 9d101072d784962fd8d4d73971d93ad02ff63d26 Mon Sep 17 00:00:00 2001
From: Xiao Wang <xiao.w.wang@intel.com>
Date: Wed, 18 Jan 2017 21:39:23 -0800
Subject: [PATCH] net/i40e: fix Rx checksum flag

[ upstream commit 65a35ca820f4ed4d55d22a32bf6cadc9d12c95af ]

When no error reported in Rx descriptor, we should set CKSUM_GOOD flag
before return.

Fixes: b704f9071b09 ("net/i40e: implement new Rx checksum flag")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/i40e/i40e_rxtx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index d359dae..1b25b2f 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -138,8 +138,11 @@ i40e_rxd_error_to_pkt_flags(uint64_t qword)
 	uint64_t error_bits = (qword >> I40E_RXD_QW1_ERROR_SHIFT);
 
 #define I40E_RX_ERR_BITS 0x3f
-	if (likely((error_bits & I40E_RX_ERR_BITS) == 0))
+	if (likely((error_bits & I40E_RX_ERR_BITS) == 0)) {
+		flags |= (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD);
 		return flags;
+	}
+
 	if (unlikely(error_bits & (1 << I40E_RX_DESC_ERROR_IPE_SHIFT)))
 		flags |= PKT_RX_IP_CKSUM_BAD;
 	else
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/mlx5: fix memory leak when parsing device params' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (5 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix Rx checksum flag' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/qede/base: fix FreeBSD build' " Yuanhan Liu
                   ` (31 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 584171a8b87d3a3ec889581f2c1ba035c054a2ce Mon Sep 17 00:00:00 2001
From: Shahaf Shuler <shahafs@mellanox.com>
Date: Sun, 22 Jan 2017 10:24:47 +0200
Subject: [PATCH] net/mlx5: fix memory leak when parsing device params

[ upstream commit a67323e49c47380604c0dece509ffd9b7e58cfc3 ]

in case of an error argument list is not freed.

Fixes: e72dd09b614e ("net/mlx5: add support for configuration through kvargs")

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 90cc35e..cb45fd0 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -330,8 +330,10 @@ mlx5_args(struct priv *priv, struct rte_devargs *devargs)
 		if (rte_kvargs_count(kvlist, params[i])) {
 			ret = rte_kvargs_process(kvlist, params[i],
 						 mlx5_args_check, priv);
-			if (ret != 0)
+			if (ret != 0) {
+				rte_kvargs_free(kvlist);
 				return ret;
+			}
 		}
 	}
 	rte_kvargs_free(kvlist);
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/qede/base: fix FreeBSD build' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (6 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/mlx5: fix memory leak when parsing device params' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix deletion of all macvlan filters' " Yuanhan Liu
                   ` (30 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Rasesh Mody; +Cc: Yuanhan Liu, Andrew Rybchenko, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From e53c54bf98515395611203ea6fecb6d775ea89ae Mon Sep 17 00:00:00 2001
From: Rasesh Mody <rasesh.mody@cavium.com>
Date: Sun, 22 Jan 2017 21:02:38 -0800
Subject: [PATCH] net/qede/base: fix FreeBSD build

[ upstream commit 679fe2e4262add3e92a043b7fe6e738c7339394b ]

This patch addresses compilation errors on FreeBSD with clang 3.8.0.

drivers/net/qede/base/ecore_cxt.c:1257:2: error:
     shifting a negative signed value is undefined
          SET_FIELD(cdu_params, CDUC_NCIB, elems_per_page);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/qede/base/ecore.h:82:27: note: expanded from macro 'SET_FIELD'
          (value) &= ~(name##_MASK << name##_SHIFT);
                    ~~~~~~~~~~~ ^

Fixes: ec94dbc57362 ("qede: add base driver")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
Tested-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/qede/base/ecore_init_fw_funcs.c | 2 +-
 drivers/net/qede/base/reg_addr.h            | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/qede/base/ecore_init_fw_funcs.c b/drivers/net/qede/base/ecore_init_fw_funcs.c
index e83eeb8..de08650 100644
--- a/drivers/net/qede/base/ecore_init_fw_funcs.c
+++ b/drivers/net/qede/base/ecore_init_fw_funcs.c
@@ -89,7 +89,7 @@ voq * (PBF_REG_YCMD_QS_NUM_LINES_VOQ1_RT_OFFSET \
 #define QM_STOP_CMD_STRUCT_SIZE			2
 #define QM_STOP_CMD_PAUSE_MASK_OFFSET	0
 #define QM_STOP_CMD_PAUSE_MASK_SHIFT	0
-#define QM_STOP_CMD_PAUSE_MASK_MASK		-1
+#define QM_STOP_CMD_PAUSE_MASK_MASK		0xffffffff /* @DPDK */
 #define QM_STOP_CMD_GROUP_ID_OFFSET		1
 #define QM_STOP_CMD_GROUP_ID_SHIFT		16
 #define QM_STOP_CMD_GROUP_ID_MASK		15
diff --git a/drivers/net/qede/base/reg_addr.h b/drivers/net/qede/base/reg_addr.h
index ab88671..3c369aa 100644
--- a/drivers/net/qede/base/reg_addr.h
+++ b/drivers/net/qede/base/reg_addr.h
@@ -30,7 +30,7 @@
 	24
 
 #define  CDU_REG_CID_ADDR_PARAMS_NCIB			( \
-		0xff << 24)
+		0xffUL << 24) /* @DPDK */
 
 #define  XSDM_REG_OPERATION_GEN \
 	0xf80408UL
@@ -436,11 +436,11 @@
 #define NIG_REG_LLH_FUNC_FILTER_VALUE 0x501a00UL
 #define XMAC_REG_CTRL_TX_EN (0x1 << 0)
 #define XMAC_REG_CTRL_RX_EN (0x1 << 1)
-#define CDU_REG_SEGMENT0_PARAMS_T0_TID_SIZE (0xff << 24)
+#define CDU_REG_SEGMENT0_PARAMS_T0_TID_SIZE (0xffUL << 24) /* @DPDK */
 #define CDU_REG_SEGMENT0_PARAMS_T0_TID_BLOCK_WASTE (0xff << 16)
 #define CDU_REG_SEGMENT0_PARAMS_T0_TID_BLOCK_WASTE_SHIFT 16
 #define CDU_REG_SEGMENT1_PARAMS_T1_TID_BLOCK_WASTE (0xff << 16)
-#define CDU_REG_SEGMENT1_PARAMS_T1_TID_SIZE (0xff << 24)
+#define CDU_REG_SEGMENT1_PARAMS_T1_TID_SIZE (0xffUL << 24) /* @DPDK */
 #define CDU_REG_SEGMENT1_PARAMS_T1_NUM_TIDS_IN_BLOCK (0xfff << 0)
 #define CDU_REG_SEGMENT1_PARAMS_T1_NUM_TIDS_IN_BLOCK_SHIFT 0
 #define CDU_REG_SEGMENT0_PARAMS_T0_NUM_TIDS_IN_BLOCK (0xfff << 0)
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix deletion of all macvlan filters' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (7 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/qede/base: fix FreeBSD build' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/bnx2x: fix Rx mode configuration' " Yuanhan Liu
                   ` (29 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From b7b1ed17642def56dea40e65b8e20df984c0071e Mon Sep 17 00:00:00 2001
From: Jingjing Wu <jingjing.wu@intel.com>
Date: Mon, 23 Jan 2017 17:42:45 +0800
Subject: [PATCH] net/i40e: fix deletion of all macvlan filters

[ upstream commit b82226bff72f324ceee6104dfd53a254cdeae25e ]

filter_type is not set when removing all macvlan filters. It will
cause error when send AQ command to HW.
This patch fixes this issue.

Fixes: 4861cde46116 ("i40e: new poll mode driver")

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a4d1cfc..b6e4d24 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5848,7 +5848,7 @@ i40e_find_all_mac_for_vlan(struct i40e_vsi *vsi,
 static int
 i40e_vsi_remove_all_macvlan_filter(struct i40e_vsi *vsi)
 {
-	int i, num;
+	int i, j, num;
 	struct i40e_mac_filter *f;
 	struct i40e_macvlan_filter *mv_f;
 	int ret = I40E_SUCCESS;
@@ -5873,6 +5873,7 @@ i40e_vsi_remove_all_macvlan_filter(struct i40e_vsi *vsi)
 		TAILQ_FOREACH(f, &vsi->mac_list, next) {
 			(void)rte_memcpy(&mv_f[i].macaddr,
 				&f->mac_info.mac_addr, ETH_ADDR_LEN);
+			mv_f[i].filter_type = f->mac_info.filter_type;
 			mv_f[i].vlan_id = 0;
 			i++;
 		}
@@ -5882,6 +5883,8 @@ i40e_vsi_remove_all_macvlan_filter(struct i40e_vsi *vsi)
 					vsi->vlan_num, &f->mac_info.mac_addr);
 			if (ret != I40E_SUCCESS)
 				goto DONE;
+			for (j = i; j < i + vsi->vlan_num; j++)
+				mv_f[j].filter_type = f->mac_info.filter_type;
 			i += vsi->vlan_num;
 		}
 	}
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/bnx2x: fix Rx mode configuration' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (8 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix deletion of all macvlan filters' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/cxgbe/base: initialize variable before reading EEPROM' " Yuanhan Liu
                   ` (28 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Rasesh Mody; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From e9129f3089c7b0bf35b4ce8f181e4f311528b3a1 Mon Sep 17 00:00:00 2001
From: Rasesh Mody <rasesh.mody@cavium.com>
Date: Mon, 23 Jan 2017 21:38:33 -0800
Subject: [PATCH] net/bnx2x: fix Rx mode configuration

[ upstream commit 25ffc78946d2101ded5220d6496610e9b3babb48 ]

Check if promisc mode was set when setting allmulti mode and vice-versa.
Introduced BNX2X_RX_MODE_ALLMULTI_PROMISC for the same. If check is
absent the filter configuration gets over written.

Fixes: 540a211084a7 ("bnx2x: driver core")
Fixes: 5dbc53d7e5a2 ("net/bnx2x: restrict Rx mask flags sent to the PF")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/bnx2x/bnx2x.c        |  1 +
 drivers/net/bnx2x/bnx2x.h        | 11 ++++++-----
 drivers/net/bnx2x/bnx2x_ethdev.c |  8 ++++++++
 drivers/net/bnx2x/bnx2x_vfpf.c   |  1 +
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 2856630..0d16a73 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1438,6 +1438,7 @@ bnx2x_fill_accept_flags(struct bnx2x_softc *sc, uint32_t rx_mode,
 
 		break;
 
+	case BNX2X_RX_MODE_ALLMULTI_PROMISC:
 	case BNX2X_RX_MODE_PROMISC:
 		/*
 		 * According to deffinition of SI mode, iface in promisc mode
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 5cefea4..5709305 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -1146,11 +1146,12 @@ struct bnx2x_softc {
 #define BNX2X_RECOVERY_NIC_LOADING 5
 
 	uint32_t rx_mode;
-#define BNX2X_RX_MODE_NONE     0
-#define BNX2X_RX_MODE_NORMAL   1
-#define BNX2X_RX_MODE_ALLMULTI 2
-#define BNX2X_RX_MODE_PROMISC  3
-#define BNX2X_MAX_MULTICAST    64
+#define BNX2X_RX_MODE_NONE             0
+#define BNX2X_RX_MODE_NORMAL           1
+#define BNX2X_RX_MODE_ALLMULTI         2
+#define BNX2X_RX_MODE_ALLMULTI_PROMISC 3
+#define BNX2X_RX_MODE_PROMISC          4
+#define BNX2X_MAX_MULTICAST            64
 
 	struct bnx2x_port port;
 
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 94bbd66..a8aebbe 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -256,6 +256,8 @@ bnx2x_promisc_enable(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 	sc->rx_mode = BNX2X_RX_MODE_PROMISC;
+	if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
+		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI_PROMISC;
 	bnx2x_set_rx_mode(sc);
 }
 
@@ -266,6 +268,8 @@ bnx2x_promisc_disable(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 	sc->rx_mode = BNX2X_RX_MODE_NORMAL;
+	if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
+		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI;
 	bnx2x_set_rx_mode(sc);
 }
 
@@ -276,6 +280,8 @@ bnx2x_dev_allmulticast_enable(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 	sc->rx_mode = BNX2X_RX_MODE_ALLMULTI;
+	if (rte_eth_promiscuous_get(dev->data->port_id) == 1)
+		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI_PROMISC;
 	bnx2x_set_rx_mode(sc);
 }
 
@@ -286,6 +292,8 @@ bnx2x_dev_allmulticast_disable(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 	sc->rx_mode = BNX2X_RX_MODE_NORMAL;
+	if (rte_eth_promiscuous_get(dev->data->port_id) == 1)
+		sc->rx_mode = BNX2X_RX_MODE_PROMISC;
 	bnx2x_set_rx_mode(sc);
 }
 
diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c
index c47beb0..0ca0df8 100644
--- a/drivers/net/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/bnx2x/bnx2x_vfpf.c
@@ -648,6 +648,7 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc)
 		query->rx_mask |= VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST;
 		query->rx_mask |= VFPF_RX_MASK_ACCEPT_BROADCAST;
 		break;
+	case BNX2X_RX_MODE_ALLMULTI_PROMISC:
 	case BNX2X_RX_MODE_PROMISC:
 		query->rx_mask = VFPF_RX_MASK_ACCEPT_ALL_UNICAST;
 		query->rx_mask |= VFPF_RX_MASK_ACCEPT_ALL_MULTICAST;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/cxgbe/base: initialize variable before reading EEPROM' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (9 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/bnx2x: fix Rx mode configuration' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix checksum flag in x86 vector Rx' " Yuanhan Liu
                   ` (27 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Emmanuel Roullit; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From fe835334ae7fef278b1574fa50e1b458754404bb Mon Sep 17 00:00:00 2001
From: Emmanuel Roullit <emmanuel.roullit@gmail.com>
Date: Tue, 24 Jan 2017 21:48:57 +0100
Subject: [PATCH] net/cxgbe/base: initialize variable before reading EEPROM

[ upstream commit dd995b23dfc22a28edc565ce6163a5c98068d302 ]

data value could have been garbage if VPD access timed out for VPD read
request could not been issued.

Found with clang static analysis:
drivers/net/cxgbe/base/t4_hw.c:1577:22:
warning: The left operand of '&' is a garbage value
        } while ((stats_reg & 0x1) && --max_poll);
                  ~~~~~~~~~ ^

Fixes: fe0bd9ee5da3 ("net/cxgbe: support EEPROM access")

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
---
 drivers/net/cxgbe/base/t4_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 7e79adf..c089b06 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -1532,7 +1532,7 @@ int t4_seeprom_write(struct adapter *adapter, u32 addr, u32 data)
 {
 	unsigned int base = adapter->params.pci.vpd_cap_addr;
 	int ret;
-	u32 stats_reg;
+	u32 stats_reg = 0;
 	int max_poll;
 
 	/* VPD Accesses must alway be 4-byte aligned!
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix checksum flag in x86 vector Rx' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (10 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/cxgbe/base: initialize variable before reading EEPROM' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix crash in close' " Yuanhan Liu
                   ` (26 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Qi Zhang; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From b642e4f4fc40b064a69aa8be259a28b6d1902852 Mon Sep 17 00:00:00 2001
From: Qi Zhang <qi.z.zhang@intel.com>
Date: Tue, 24 Jan 2017 14:06:59 -0500
Subject: [PATCH] net/i40e: fix checksum flag in x86 vector Rx

[ upstream commit f3a85f4ce04d9fb55ebdb392563f7c1711f3d943 ]

When no error reported in Rx descriptor, we should set
CKSUM_GOOD flag before return.

Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_rxtx_vec_sse.c | 37 ++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 7c84a41..b95cc8e 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -148,6 +148,20 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 	const __m128i rss_vlan_msk = _mm_set_epi32(
 			0x1c03804, 0x1c03804, 0x1c03804, 0x1c03804);
 
+	const __m128i cksum_mask = _mm_set_epi32(
+			PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+			PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+			PKT_RX_EIP_CKSUM_BAD,
+			PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+			PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+			PKT_RX_EIP_CKSUM_BAD,
+			PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+			PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+			PKT_RX_EIP_CKSUM_BAD,
+			PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+			PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+			PKT_RX_EIP_CKSUM_BAD);
+
 	/* map rss and vlan type to rss hash and vlan flag */
 	const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0,
 			0, 0, 0, 0,
@@ -160,14 +174,17 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 			0, 0, PKT_RX_FDIR, 0);
 
 	const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
-			PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
-			PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
-			PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
-			PKT_RX_EIP_CKSUM_BAD,
-			PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
-			PKT_RX_L4_CKSUM_BAD,
-			PKT_RX_IP_CKSUM_BAD,
-			0);
+			/* shift right 1 bit to make sure it not exceed 255 */
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+			 PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD |
+			 PKT_RX_L4_CKSUM_BAD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
+			(PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
+			PKT_RX_IP_CKSUM_BAD >> 1,
+			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1);
 
 	vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);
 	vlan1 = _mm_unpackhi_epi32(descs[2], descs[3]);
@@ -181,6 +198,10 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 
 	l3_l4e = _mm_srli_epi32(vlan1, 22);
 	l3_l4e = _mm_shuffle_epi8(l3_l4e_flags, l3_l4e);
+	/* then we shift left 1 bit */
+	l3_l4e = _mm_slli_epi32(l3_l4e, 1);
+	/* we need to mask out the reduntant bits */
+	l3_l4e = _mm_and_si128(l3_l4e, cksum_mask);
 
 	vlan0 = _mm_or_si128(vlan0, rss);
 	vlan0 = _mm_or_si128(vlan0, l3_l4e);
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix crash in close' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (11 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix checksum flag in x86 vector Rx' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'vfio: fix file descriptor leak in multi-process' " Yuanhan Liu
                   ` (25 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Bernard Iremonger; +Cc: Yuanhan Liu, Jingjing Wu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 96a7b3a7364a92f72f741f691545697750e4b120 Mon Sep 17 00:00:00 2001
From: Bernard Iremonger <bernard.iremonger@intel.com>
Date: Fri, 27 Jan 2017 10:22:47 +0000
Subject: [PATCH] net/i40e: fix crash in close

[ upstream commit 7041dc95c08516a7839b3237522360e92a0fce55 ]

Change the order of releasing the VSI's.
Release the VMDq VSI's first, then release the main VSI.

Fixes: 3cb446b4aeb2 ("i40e: free vmdq vsi when closing")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b6e4d24..968956f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -1876,18 +1876,17 @@ i40e_dev_close(struct rte_eth_dev *dev)
 	/* shutdown and destroy the HMC */
 	i40e_shutdown_lan_hmc(hw);
 
-	/* release all the existing VSIs and VEBs */
-	i40e_fdir_teardown(pf);
-	i40e_vsi_release(pf->main_vsi);
-
 	for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
 		i40e_vsi_release(pf->vmdq[i].vsi);
 		pf->vmdq[i].vsi = NULL;
 	}
-
 	rte_free(pf->vmdq);
 	pf->vmdq = NULL;
 
+	/* release all the existing VSIs and VEBs */
+	i40e_fdir_teardown(pf);
+	i40e_vsi_release(pf->main_vsi);
+
 	/* shutdown the adminq */
 	i40e_aq_queue_shutdown(hw, true);
 	i40e_shutdown_adminq(hw);
@@ -4140,6 +4139,9 @@ i40e_vsi_release(struct i40e_vsi *vsi)
 	if (!vsi)
 		return I40E_SUCCESS;
 
+	if (!vsi->adapter)
+		return -EFAULT;
+
 	user_param = vsi->user_param;
 
 	pf = I40E_VSI_TO_PF(vsi);
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'vfio: fix file descriptor leak in multi-process' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (12 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix crash in close' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'sched: fix crash when freeing port' " Yuanhan Liu
                   ` (24 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Patrick MacArthur; +Cc: Yuanhan Liu, Anatoly Burakov, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 884ba36ce34940bacfc11a9cce254791ea15ecba Mon Sep 17 00:00:00 2001
From: Patrick MacArthur <patrick@patrickmacarthur.net>
Date: Thu, 26 Jan 2017 18:05:21 -0500
Subject: [PATCH] vfio: fix file descriptor leak in multi-process

[ upstream commit 811b6b25060f8b0ba32fd35af7c5f0354bd57a14 ]

When a secondary process wants access to the VFIO container file
descriptor, the primary process calls vfio_get_container_fd() which
always opens an entirely new file descriptor on /dev/vfio/vfio.
However, once the file descriptor has been passed to the subprocess, it
is effectively duplicated, meaning that the copy of the file descriptor
in the primary process is no longer needed.  However, the primary
process does not close the duplicate fd, which results in a resource
leak.

This can be reproduced by starting a primary process with a small
RLIMIT_NOFILE limit configured to use VFIO for at least one device, and
repeatedly launching secondary processes until the file descriptor limit
is exceeded.

Fix the resource leak by closing the local vfio container file
descriptor after passing it to the secondary process.

Fixes: 2f4adfad0a69 ("vfio: add multiprocess support")

Signed-off-by: Patrick MacArthur <patrick@patrickmacarthur.net>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
index 00cf919..fb4a2f8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
@@ -301,6 +301,7 @@ vfio_mp_sync_thread(void __rte_unused * arg)
 				vfio_mp_sync_send_request(conn_sock, SOCKET_ERR);
 			else
 				vfio_mp_sync_send_fd(conn_sock, fd);
+			close(fd);
 			break;
 		case SOCKET_REQ_GROUP:
 			/* wait for group number */
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'sched: fix crash when freeing port' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (13 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'vfio: fix file descriptor leak in multi-process' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/enic: fix memory leak with oversized Tx packets' " Yuanhan Liu
                   ` (23 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Alan Dewar; +Cc: Yuanhan Liu, Jan Blunck, Cristian Dumitrescu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From bfc65d9c21c61be041dc4704759fa29c4bc68594 Mon Sep 17 00:00:00 2001
From: Alan Dewar <adewar@brocade.com>
Date: Mon, 6 Feb 2017 18:32:42 +0100
Subject: [PATCH] sched: fix crash when freeing port

[ upstream commit 3b780b9e9e9221725abbad9820704d05d7d2805e ]

Prevent a segmentation fault in rte_sched_port_free by only accessing
the port structure after the NULL pointer check has been made.

Fixes: 7b3c4f35 ("sched: fix releasing enqueued packets")

Signed-off-by: Alan Dewar <adewar@brocade.com>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_sched/rte_sched.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index e6dace2..614705d 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -735,12 +735,14 @@ void
 rte_sched_port_free(struct rte_sched_port *port)
 {
 	uint32_t qindex;
-	uint32_t n_queues_per_port = rte_sched_port_queues_per_port(port);
+	uint32_t n_queues_per_port;
 
 	/* Check user parameters */
 	if (port == NULL)
 		return;
 
+	n_queues_per_port = rte_sched_port_queues_per_port(port);
+
 	/* Free enqueued mbufs */
 	for (qindex = 0; qindex < n_queues_per_port; qindex++) {
 		struct rte_mbuf **mbufs = rte_sched_port_qbase(port, qindex);
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/enic: fix memory leak with oversized Tx packets' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (14 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'sched: fix crash when freeing port' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/ena: fix setting host attributes' " Yuanhan Liu
                   ` (22 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: John Daley; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From dd70a1425260e832ba3d02046178a1cd0b9103d9 Mon Sep 17 00:00:00 2001
From: John Daley <johndale@cisco.com>
Date: Thu, 2 Feb 2017 17:18:40 -0800
Subject: [PATCH] net/enic: fix memory leak with oversized Tx packets

[ upstream commit ed6e564c214e9852ff7f3d8f676a892dda905651 ]

If a packet send is attempted with a packet larger than the NIC
is capable of processing (9208) it will be dropped with no
completion descriptor returned or completion index update, which
will lead to an mbuf leak and eventual hang.

Drop and count oversized Tx packets in the Tx burst function and
dereference/free the mbuf without sending it to the NIC.

Since the maximum Rx and Tx packet sizes are different on enic
and are now both being used, make the define ENIC_DEFAULT_MAX_PKT_SIZE
be 2 defines, one for Rx and one for Tx.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic.h      |  1 +
 drivers/net/enic/enic_main.c |  5 ++++-
 drivers/net/enic/enic_res.c  |  5 +++--
 drivers/net/enic/enic_res.h  |  5 ++++-
 drivers/net/enic/enic_rxtx.c | 13 ++++++++++---
 5 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 7ff994b..a3d2a0f 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -102,6 +102,7 @@ struct enic_fdir {
 struct enic_soft_stats {
 	rte_atomic64_t rx_nombuf;
 	rte_atomic64_t rx_packet_errors;
+	rte_atomic64_t tx_oversized;
 };
 
 struct enic_memzone_entry {
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index f0b15ac..1861a32 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -137,6 +137,7 @@ static void enic_clear_soft_stats(struct enic *enic)
 	struct enic_soft_stats *soft_stats = &enic->soft_stats;
 	rte_atomic64_clear(&soft_stats->rx_nombuf);
 	rte_atomic64_clear(&soft_stats->rx_packet_errors);
+	rte_atomic64_clear(&soft_stats->tx_oversized);
 }
 
 static void enic_init_soft_stats(struct enic *enic)
@@ -144,6 +145,7 @@ static void enic_init_soft_stats(struct enic *enic)
 	struct enic_soft_stats *soft_stats = &enic->soft_stats;
 	rte_atomic64_init(&soft_stats->rx_nombuf);
 	rte_atomic64_init(&soft_stats->rx_packet_errors);
+	rte_atomic64_init(&soft_stats->tx_oversized);
 	enic_clear_soft_stats(enic);
 }
 
@@ -183,7 +185,8 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)
 	r_stats->obytes = stats->tx.tx_bytes_ok;
 
 	r_stats->ierrors = stats->rx.rx_errors + stats->rx.rx_drop;
-	r_stats->oerrors = stats->tx.tx_errors;
+	r_stats->oerrors = stats->tx.tx_errors
+			   + rte_atomic64_read(&soft_stats->tx_oversized);
 
 	r_stats->imissed = stats->rx.rx_no_bufs + rx_truncated;
 
diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c
index 8a230a1..867bd25 100644
--- a/drivers/net/enic/enic_res.c
+++ b/drivers/net/enic/enic_res.c
@@ -89,10 +89,11 @@ int enic_get_vnic_config(struct enic *enic)
 	/* max packet size is only defined in newer VIC firmware
 	 * and will be 0 for legacy firmware and VICs
 	 */
-	if (c->max_pkt_size > ENIC_DEFAULT_MAX_PKT_SIZE)
+	if (c->max_pkt_size > ENIC_DEFAULT_RX_MAX_PKT_SIZE)
 		enic->max_mtu = c->max_pkt_size - (ETHER_HDR_LEN + 4);
 	else
-		enic->max_mtu = ENIC_DEFAULT_MAX_PKT_SIZE - (ETHER_HDR_LEN + 4);
+		enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE
+				- (ETHER_HDR_LEN + 4);
 	if (c->mtu == 0)
 		c->mtu = 1500;
 
diff --git a/drivers/net/enic/enic_res.h b/drivers/net/enic/enic_res.h
index 303530e..1135d2e 100644
--- a/drivers/net/enic/enic_res.h
+++ b/drivers/net/enic/enic_res.h
@@ -48,7 +48,10 @@
 #define ENIC_MIN_MTU			68
 
 /* Does not include (possible) inserted VLAN tag and FCS */
-#define ENIC_DEFAULT_MAX_PKT_SIZE	9022
+#define ENIC_DEFAULT_RX_MAX_PKT_SIZE	9022
+
+/* Does not include (possible) inserted VLAN tag and FCS */
+#define ENIC_TX_MAX_PKT_SIZE		9208
 
 #define ENIC_MULTICAST_PERFECT_FILTERS	32
 #define ENIC_UNICAST_PERFECT_FILTERS	32
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index f762a26..912ea15 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -477,16 +477,23 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	for (index = 0; index < nb_pkts; index++) {
 		tx_pkt = *tx_pkts++;
+		pkt_len = tx_pkt->pkt_len;
+		data_len = tx_pkt->data_len;
+		ol_flags = tx_pkt->ol_flags;
 		nb_segs = tx_pkt->nb_segs;
+
+		if (pkt_len > ENIC_TX_MAX_PKT_SIZE) {
+			rte_pktmbuf_free(tx_pkt);
+			rte_atomic64_inc(&enic->soft_stats.tx_oversized);
+			continue;
+		}
+
 		if (nb_segs > wq_desc_avail) {
 			if (index > 0)
 				goto post;
 			goto done;
 		}
 
-		pkt_len = tx_pkt->pkt_len;
-		data_len = tx_pkt->data_len;
-		ol_flags = tx_pkt->ol_flags;
 		mss = 0;
 		vlan_id = 0;
 		vlan_tag_insert = 0;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/ena: fix setting host attributes' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (15 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/enic: fix memory leak with oversized Tx packets' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix ethertype filter on X722' " Yuanhan Liu
                   ` (21 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Jakub Palider; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From f0f828063a84625961d74d5e4884fa7f9489cd7d Mon Sep 17 00:00:00 2001
From: Jakub Palider <jpa@semihalf.com>
Date: Mon, 6 Feb 2017 12:56:56 +0100
Subject: [PATCH] net/ena: fix setting host attributes

[ upstream commit 201ff2e57a47205b439e421e2ca907e9ce61bb26 ]

The hardware may reject adding host_info in case support for
host_info is missing in the list of supported features. On the
other hand the list of supported features may contain support
for the host_info - typical bootstrap problem.

This patch solves it by removing check against support for
host_info attribute and improves error handling by reacting
only to host attribute write failure to the hardware.

Fixes: 99ecfbf845b3 ("ena: import communication layer")

Signed-off-by: Jakub Palider <jpa@semihalf.com>
---
 drivers/net/ena/base/ena_com.c | 16 ++++------------
 drivers/net/ena/ena_ethdev.c   | 21 ++++++++-------------
 2 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c
index 88053e3..bd6f3c6 100644
--- a/drivers/net/ena/base/ena_com.c
+++ b/drivers/net/ena/base/ena_com.c
@@ -2590,19 +2590,11 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
 	struct ena_com_admin_queue *admin_queue;
 	struct ena_admin_set_feat_cmd cmd;
 	struct ena_admin_set_feat_resp resp;
+	int ret;
 
-	int ret = 0;
-
-	if (unlikely(!ena_dev)) {
-		ena_trc_err("%s : ena_dev is NULL\n", __func__);
-		return ENA_COM_NO_DEVICE;
-	}
-
-	if (!ena_com_check_supported_feature_id(ena_dev,
-						ENA_ADMIN_HOST_ATTR_CONFIG)) {
-		ena_trc_warn("Set host attribute isn't supported\n");
-		return ENA_COM_PERMISSION;
-	}
+	/* Host attribute config is called before ena_com_get_dev_attr_feat
+	 * so ena_com can't check if the feature is supported.
+	 */
 
 	memset(&cmd, 0x0, sizeof(cmd));
 	admin_queue = &ena_dev->admin_queue;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ab9a178..c1fd7bb 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -357,12 +357,9 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev)
 
 	rc = ena_com_set_host_attributes(ena_dev);
 	if (rc) {
-		if (rc == -EPERM)
-			RTE_LOG(ERR, PMD, "Cannot set host attributes\n");
-		else
-			RTE_LOG(ERR, PMD, "Cannot set host attributes\n");
-
-		goto err;
+		RTE_LOG(ERR, PMD, "Cannot set host attributes\n");
+		if (rc != -EPERM)
+			goto err;
 	}
 
 	return;
@@ -413,11 +410,9 @@ static void ena_config_debug_area(struct ena_adapter *adapter)
 
 	rc = ena_com_set_host_attributes(&adapter->ena_dev);
 	if (rc) {
-		if (rc == -EPERM)
-			RTE_LOG(WARNING, PMD, "Cannot set host attributes\n");
-		else
-			RTE_LOG(ERR, PMD, "Cannot set host attributes\n");
-		goto err;
+		RTE_LOG(WARNING, PMD, "Cannot set host attributes\n");
+		if (rc != -EPERM)
+			goto err;
 	}
 
 	return;
@@ -1228,14 +1223,14 @@ static int ena_device_init(struct ena_com_dev *ena_dev,
 		goto err_mmio_read_less;
 	}
 
-	ena_config_host_info(ena_dev);
-
 	/* To enable the msix interrupts the driver needs to know the number
 	 * of queues. So the driver uses polling mode to retrieve this
 	 * information.
 	 */
 	ena_com_set_admin_polling_mode(ena_dev, true);
 
+	ena_config_host_info(ena_dev);
+
 	/* Get Device Attributes and features */
 	rc = ena_com_get_dev_attr_feat(ena_dev, get_feat_ctx);
 	if (rc) {
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix ethertype filter on X722' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (16 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/ena: fix setting host attributes' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40evf: fix reporting of imissed packets' " Yuanhan Liu
                   ` (20 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Jeff Guo; +Cc: Yuanhan Liu, Jingjing Wu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 2ab977942908e2f348c7733b6ca523a54eb756c8 Mon Sep 17 00:00:00 2001
From: Jeff Guo <jia.guo@intel.com>
Date: Tue, 7 Feb 2017 11:52:19 +0800
Subject: [PATCH] net/i40e: fix ethertype filter on X722

[ upstream commit e06bad05dc125f3fd610e3ee09d03c844edc92cf ]

The GL_SWR_PRI_JOIN_MAP registers are effective on filters, changing
the register's default value will fail the ethertype filter.

The GL_SWR_PRI_JOIN_MAP values are different for each NIC, and current
X722 register values are wrong.

Fix X722 ethertype filter by setting registers to X722 default NVM
values.

Fixes: 92fbf2cbdff4 ("i40e: support X722 and its A0 hardware")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 968956f..b14f18d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -8284,6 +8284,10 @@ i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype)
 #define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
 #define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
 
+/* For X722 */
+#define I40E_X722_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x20000200
+#define I40E_X722_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x013F0200
+
 /* For X710 */
 #define I40E_GL_SWR_PM_UP_THR_EF_VALUE   0x03030303
 /* For XL710 */
@@ -8306,7 +8310,6 @@ i40e_dev_sync_phy_type(struct i40e_hw *hw)
 	return 0;
 }
 
-
 static void
 i40e_configure_registers(struct i40e_hw *hw)
 {
@@ -8314,8 +8317,8 @@ i40e_configure_registers(struct i40e_hw *hw)
 		uint32_t addr;
 		uint64_t val;
 	} reg_table[] = {
-		{I40E_GL_SWR_PRI_JOIN_MAP_0, I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},
-		{I40E_GL_SWR_PRI_JOIN_MAP_2, I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},
+		{I40E_GL_SWR_PRI_JOIN_MAP_0, 0},
+		{I40E_GL_SWR_PRI_JOIN_MAP_2, 0},
 		{I40E_GL_SWR_PM_UP_THR, 0}, /* Compute value dynamically */
 	};
 	uint64_t reg;
@@ -8323,6 +8326,24 @@ i40e_configure_registers(struct i40e_hw *hw)
 	int ret;
 
 	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		if (reg_table[i].addr == I40E_GL_SWR_PRI_JOIN_MAP_0) {
+			if (hw->mac.type == I40E_MAC_X722) /* For X722 */
+				reg_table[i].val =
+					I40E_X722_GL_SWR_PRI_JOIN_MAP_0_VALUE;
+			else /* For X710/XL710/XXV710 */
+				reg_table[i].val =
+					I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE;
+		}
+
+		if (reg_table[i].addr == I40E_GL_SWR_PRI_JOIN_MAP_2) {
+			if (hw->mac.type == I40E_MAC_X722) /* For X722 */
+				reg_table[i].val =
+					I40E_X722_GL_SWR_PRI_JOIN_MAP_2_VALUE;
+			else /* For X710/XL710/XXV710 */
+				reg_table[i].val =
+					I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE;
+		}
+
 		if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) {
 			if (I40E_PHY_TYPE_SUPPORT_40G(hw->phy.phy_types) || /* For XL710 */
 			    I40E_PHY_TYPE_SUPPORT_25G(hw->phy.phy_types)) /* For XXV710 */
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/i40evf: fix reporting of imissed packets' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (17 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix ethertype filter on X722' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix link update delay' " Yuanhan Liu
                   ` (19 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Tom Crugnale; +Cc: Yuanhan Liu, Jingjing Wu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 38931e61d9a4442358529edb1a4a1e131e55ee84 Mon Sep 17 00:00:00 2001
From: Tom Crugnale <tcrugnale@sandvine.com>
Date: Tue, 6 Dec 2016 15:16:21 -0500
Subject: [PATCH] net/i40evf: fix reporting of imissed packets

[ upstream commit bbb2b5d9fe772c43faa5bf73d64f1c8208fa8752 ]

Missed packets on RX were erroneously being assigned to the ierrors
struct member. Change it to be assigned to imissed.

Fixes: 4861cde46116 ("i40e: new poll mode driver")

Signed-off-by: Tom Crugnale <tcrugnale@sandvine.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 5d86c7b..640d316 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -966,7 +966,7 @@ i40evf_get_statics(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 						pstats->rx_broadcast;
 	stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
 						pstats->tx_unicast;
-	stats->ierrors = pstats->rx_discards;
+	stats->imissed = pstats->rx_discards;
 	stats->oerrors = pstats->tx_errors + pstats->tx_discards;
 	stats->ibytes = pstats->rx_bytes;
 	stats->obytes = pstats->tx_bytes;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix link update delay' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (18 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40evf: fix reporting of imissed packets' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/enic: fix hardcoding of some flow director masks' " Yuanhan Liu
                   ` (18 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Qiming Yang; +Cc: Yuanhan Liu, Ferruh Yigit, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 635ccf20065f89c6710ae6bbc7d90f4ca09a41d0 Mon Sep 17 00:00:00 2001
From: Qiming Yang <qiming.yang@intel.com>
Date: Wed, 8 Feb 2017 17:14:24 +0800
Subject: [PATCH] net/i40e: fix link update delay

[ upstream commit 0046ba5c27bd50edc695a6760355915b89bc60e0 ]

Fix the redundant delay in function link update. There is no need to
call rte_delay_ms and hold CPU for 100ms when link status is up.

Fixes: 263333bbb7a9 ("i40e: fix link status timeout")

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b14f18d..bf7e5a0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2024,11 +2024,11 @@ i40e_dev_link_update(struct rte_eth_dev *dev,
 		}
 
 		link.link_status = link_status.link_info & I40E_AQ_LINK_UP;
-		if (!wait_to_complete)
+		if (!wait_to_complete || link.link_status)
 			break;
 
 		rte_delay_ms(CHECK_INTERVAL);
-	} while (!link.link_status && rep_cnt--);
+	} while (--rep_cnt);
 
 	if (!link.link_status)
 		goto out;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/enic: fix hardcoding of some flow director masks' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (19 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix link update delay' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbe: fix received packets number for ARM' " Yuanhan Liu
                   ` (17 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: John Daley; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 12e71bb545f361162cbd1625f5d92d462cbc18ed Mon Sep 17 00:00:00 2001
From: John Daley <johndale@cisco.com>
Date: Wed, 8 Feb 2017 16:40:09 -0800
Subject: [PATCH] net/enic: fix hardcoding of some flow director masks

[ upstream commit 9e226650fdc5657b5c94c7d59d515c789010f7b9 ]

Hard coded mask values were being used for several of the IPv4 and IPv6
fields. Use the values in the rte_eth_fdir_masks structure provided by the
caller.

Fixes: dfbd6a9cb504 ("net/enic: extend flow director support for 1300 series")

Signed-off-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic_clsf.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c
index bcf479a..487f804 100644
--- a/drivers/net/enic/enic_clsf.c
+++ b/drivers/net/enic/enic_clsf.c
@@ -211,15 +211,15 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input,
 		memset(&ip4_val, 0, sizeof(struct ipv4_hdr));
 
 		if (input->flow.ip4_flow.tos) {
-			ip4_mask.type_of_service = 0xff;
+			ip4_mask.type_of_service = masks->ipv4_mask.tos;
 			ip4_val.type_of_service = input->flow.ip4_flow.tos;
 		}
 		if (input->flow.ip4_flow.ttl) {
-			ip4_mask.time_to_live = 0xff;
+			ip4_mask.time_to_live = masks->ipv4_mask.ttl;
 			ip4_val.time_to_live = input->flow.ip4_flow.ttl;
 		}
 		if (input->flow.ip4_flow.proto) {
-			ip4_mask.next_proto_id = 0xff;
+			ip4_mask.next_proto_id = masks->ipv4_mask.proto;
 			ip4_val.next_proto_id = input->flow.ip4_flow.proto;
 		}
 		if (input->flow.ip4_flow.src_ip) {
@@ -299,7 +299,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input,
 		memset(&ipv6_val, 0, sizeof(struct ipv6_hdr));
 
 		if (input->flow.ipv6_flow.proto) {
-			ipv6_mask.proto = 0xff;
+			ipv6_mask.proto = masks->ipv6_mask.proto;
 			ipv6_val.proto = input->flow.ipv6_flow.proto;
 		}
 		for (i = 0; i < 4; i++) {
@@ -315,11 +315,11 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input,
 					input->flow.ipv6_flow.dst_ip[i];
 		}
 		if (input->flow.ipv6_flow.tc) {
-			ipv6_mask.vtc_flow = 0x00ff0000;
-			ipv6_val.vtc_flow = input->flow.ipv6_flow.tc << 16;
+			ipv6_mask.vtc_flow = masks->ipv6_mask.tc << 12;
+			ipv6_val.vtc_flow = input->flow.ipv6_flow.tc << 12;
 		}
 		if (input->flow.ipv6_flow.hop_limits) {
-			ipv6_mask.hop_limits = 0xff;
+			ipv6_mask.hop_limits = masks->ipv6_mask.hop_limits;
 			ipv6_val.hop_limits = input->flow.ipv6_flow.hop_limits;
 		}
 
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/ixgbe: fix received packets number for ARM' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (20 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/enic: fix hardcoding of some flow director masks' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbe: fix received packets number for ARM NEON' " Yuanhan Liu
                   ` (16 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Jianbo Liu; +Cc: Yuanhan Liu, Konstantin Ananyev, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 2e162cbaa88615ec67763a9558cf72e65fd54414 Mon Sep 17 00:00:00 2001
From: Jianbo Liu <jianbo.liu@linaro.org>
Date: Thu, 9 Feb 2017 12:05:25 +0800
Subject: [PATCH] net/ixgbe: fix received packets number for ARM

[ upstream commit a98212de4ac958f5919a96771287a9617a4e5848 ]

To get better performance, Rx bulk alloc recv function will scan 8 descs
in one time, but the statuses are not consistent on ARM platform because
the memory allocated for Rx descriptors is cacheable hugepages.
This patch is to calculate the number of received packets by scan DD bit
sequentially, and stops when meeting the first packet with DD bit unset.

Fixes: 7431041062b9 ("ixgbe: allow rx bulk alloc")

Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/ixgbe/ixgbe_rxtx.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index b2d9f45..c61ce47 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1402,17 +1402,19 @@ ixgbe_rx_scan_hw_ring(struct ixgbe_rx_queue *rxq)
 	for (i = 0; i < RTE_PMD_IXGBE_RX_MAX_BURST;
 	     i += LOOK_AHEAD, rxdp += LOOK_AHEAD, rxep += LOOK_AHEAD) {
 		/* Read desc statuses backwards to avoid race condition */
-		for (j = LOOK_AHEAD-1; j >= 0; --j)
+		for (j = 0; j < LOOK_AHEAD; j++)
 			s[j] = rte_le_to_cpu_32(rxdp[j].wb.upper.status_error);
 
-		for (j = LOOK_AHEAD - 1; j >= 0; --j)
-			pkt_info[j] = rte_le_to_cpu_32(rxdp[j].wb.lower.
-						       lo_dword.data);
+		rte_smp_rmb();
 
 		/* Compute how many status bits were set */
-		nb_dd = 0;
-		for (j = 0; j < LOOK_AHEAD; ++j)
-			nb_dd += s[j] & IXGBE_RXDADV_STAT_DD;
+		for (nb_dd = 0; nb_dd < LOOK_AHEAD &&
+				(s[nb_dd] & IXGBE_RXDADV_STAT_DD); nb_dd++)
+			;
+
+		for (j = 0; j < nb_dd; j++)
+			pkt_info[j] = rte_le_to_cpu_32(rxdp[j].wb.lower.
+						       lo_dword.data);
 
 		nb_rx += nb_dd;
 
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/ixgbe: fix received packets number for ARM NEON' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (21 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbe: fix received packets number for ARM' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix TC bandwidth definition' " Yuanhan Liu
                   ` (15 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Jianbo Liu; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 42a925b5d92d12611dd38edbabfe86b2d584f764 Mon Sep 17 00:00:00 2001
From: Jianbo Liu <jianbo.liu@linaro.org>
Date: Thu, 9 Feb 2017 12:05:26 +0800
Subject: [PATCH] net/ixgbe: fix received packets number for ARM NEON

[ upstream commit 989a84050542ba1eca247ec4bf4b98a1173f6aef ]

Vector PMD will check 4 descs in one time, but the statuses are not
consistent because the memory allocated for RX descriptors is cacheable
huagepage.
This patch is to calculate the number of received packets by scann DD bit
sequentially, and stops when meeting the first packet with DD bit unset.

Fixes: b20971b6cca0 ("net/ixgbe: implement vector driver for ARM")

Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index f96cc85..e2715cb 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -196,7 +196,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 	struct ixgbe_rx_entry *sw_ring;
 	uint16_t nb_pkts_recd;
 	int pos;
-	uint64_t var;
 	uint8x16_t shuf_msk = {
 		0xFF, 0xFF,
 		0xFF, 0xFF,  /* skip 32 bits pkt_type */
@@ -255,26 +254,24 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 		uint64x2_t mbp1, mbp2;
 		uint8x16_t staterr;
 		uint16x8_t tmp;
+		uint32_t var = 0;
 		uint32_t stat;
 
 		/* B.1 load 1 mbuf point */
 		mbp1 = vld1q_u64((uint64_t *)&sw_ring[pos]);
 
-		/* Read desc statuses backwards to avoid race condition */
-		/* A.1 load 4 pkts desc */
-		descs[3] =  vld1q_u64((uint64_t *)(rxdp + 3));
-		rte_rmb();
-
 		/* B.2 copy 2 mbuf point into rx_pkts  */
 		vst1q_u64((uint64_t *)&rx_pkts[pos], mbp1);
 
 		/* B.1 load 1 mbuf point */
 		mbp2 = vld1q_u64((uint64_t *)&sw_ring[pos + 2]);
 
-		descs[2] =  vld1q_u64((uint64_t *)(rxdp + 2));
-		/* B.1 load 2 mbuf point */
-		descs[1] =  vld1q_u64((uint64_t *)(rxdp + 1));
+		/* A. load 4 pkts descs */
 		descs[0] =  vld1q_u64((uint64_t *)(rxdp));
+		descs[1] =  vld1q_u64((uint64_t *)(rxdp + 1));
+		descs[2] =  vld1q_u64((uint64_t *)(rxdp + 2));
+		descs[3] =  vld1q_u64((uint64_t *)(rxdp + 3));
+		rte_smp_rmb();
 
 		/* B.2 copy 2 mbuf point into rx_pkts  */
 		vst1q_u64((uint64_t *)&rx_pkts[pos + 2], mbp2);
@@ -349,11 +346,19 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 		vst1q_u8((uint8_t *)&rx_pkts[pos]->rx_descriptor_fields1,
 			 pkt_mb1);
 
+		stat &= IXGBE_VPMD_DESC_DD_MASK;
+
 		/* C.4 calc avaialbe number of desc */
-		var =  __builtin_popcount(stat & IXGBE_VPMD_DESC_DD_MASK);
-		nb_pkts_recd += var;
-		if (likely(var != RTE_IXGBE_DESCS_PER_LOOP))
+		if (likely(stat != IXGBE_VPMD_DESC_DD_MASK)) {
+			while (stat & 0x01) {
+				++var;
+				stat = stat >> 8;
+			}
+			nb_pkts_recd += var;
 			break;
+		} else {
+			nb_pkts_recd += RTE_IXGBE_DESCS_PER_LOOP;
+		}
 	}
 
 	/* Update our internal tail pointer */
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix TC bandwidth definition' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (22 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbe: fix received packets number for ARM NEON' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'drivers/crypto: fix different auth/cipher keys' " Yuanhan Liu
                   ` (14 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From d00ead5f9a5c0175db11b6829b2b70cf4b0e25f2 Mon Sep 17 00:00:00 2001
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
Date: Fri, 10 Feb 2017 13:25:53 +0800
Subject: [PATCH] net/i40e: fix TC bandwidth definition

[ upstream commit e8a165d588c3d3caead156493b085ff45b20d120 ]

The range of TC bandwidth is 0 ~ 800, it's 16bits not 8bits.

Fixes: c8b9a3e3fe1b ("i40e: support DCB mode")

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 28111a7..5f3ecd9 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -227,7 +227,7 @@ struct i40e_bw_info {
 	/* Relative credits within same TC with respect to other VSIs or Comps */
 	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
 	/* Bandwidth limit per TC */
-	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
+	uint16_t bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
 	/* Max bandwidth limit per TC */
 	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
 };
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'drivers/crypto: fix different auth/cipher keys' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (23 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix TC bandwidth definition' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix overflow' " Yuanhan Liu
                   ` (13 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: Yuanhan Liu, Deepak Kumar Jain, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 5220ac71381e1a4c13bc09188fe5c5d7d89921d8 Mon Sep 17 00:00:00 2001
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Date: Tue, 7 Feb 2017 22:49:58 +0000
Subject: [PATCH] drivers/crypto: fix different auth/cipher keys

[ upstream commit 67072263688e789bfeff68e19784b50498e8a17f ]

When ciphering and authenticating in the same operation
(cipher-then-auth or auth-then-cipher),
the cipher key and authentication key were set with the same
key, in SNOW3G, KASUMI and ZUC PMDs.
They were using the key of the first transform structure,
instead of using the keys of the two different transform
structures.

This is not a big issue, since usually, the same key is
used for ciphering and authentication, but keys may be different.

Fixes: 3aafc423cf4d ("snow3g: add driver for SNOW 3G library")
Fixes: 2773c86d061a ("crypto/kasumi: add driver for KASUMI library")
Fixes: cf7685d68f00 ("crypto/zuc: add driver for ZUC library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
---
 drivers/crypto/kasumi/rte_kasumi_pmd.c | 4 ++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c | 4 ++--
 drivers/crypto/zuc/rte_zuc_pmd.c       | 6 ++++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index b119da2..c22128d 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -137,7 +137,7 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
 		if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_KASUMI_F8)
 			return -EINVAL;
 		/* Initialize key */
-		sso_kasumi_init_f8_key_sched(xform->cipher.key.data,
+		sso_kasumi_init_f8_key_sched(cipher_xform->cipher.key.data,
 				&sess->pKeySched_cipher);
 	}
 
@@ -147,7 +147,7 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
 			return -EINVAL;
 		sess->auth_op = auth_xform->auth.op;
 		/* Initialize key */
-		sso_kasumi_init_f9_key_sched(xform->auth.key.data,
+		sso_kasumi_init_f9_key_sched(auth_xform->auth.key.data,
 				&sess->pKeySched_hash);
 	}
 
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 3b4292a..0081fec 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -137,7 +137,7 @@ snow3g_set_session_parameters(struct snow3g_session *sess,
 		if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_SNOW3G_UEA2)
 			return -EINVAL;
 		/* Initialize key */
-		sso_snow3g_init_key_sched(xform->cipher.key.data,
+		sso_snow3g_init_key_sched(cipher_xform->cipher.key.data,
 				&sess->pKeySched_cipher);
 	}
 
@@ -147,7 +147,7 @@ snow3g_set_session_parameters(struct snow3g_session *sess,
 			return -EINVAL;
 		sess->auth_op = auth_xform->auth.op;
 		/* Initialize key */
-		sso_snow3g_init_key_sched(xform->auth.key.data,
+		sso_snow3g_init_key_sched(auth_xform->auth.key.data,
 				&sess->pKeySched_hash);
 	}
 
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 3849119..7057fca 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -136,7 +136,8 @@ zuc_set_session_parameters(struct zuc_session *sess,
 		if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_ZUC_EEA3)
 			return -EINVAL;
 		/* Copy the key */
-		memcpy(sess->pKey_cipher, xform->cipher.key.data, ZUC_IV_KEY_LENGTH);
+		memcpy(sess->pKey_cipher, cipher_xform->cipher.key.data,
+				ZUC_IV_KEY_LENGTH);
 	}
 
 	if (auth_xform) {
@@ -145,7 +146,8 @@ zuc_set_session_parameters(struct zuc_session *sess,
 			return -EINVAL;
 		sess->auth_op = auth_xform->auth.op;
 		/* Copy the key */
-		memcpy(sess->pKey_hash, xform->auth.key.data, ZUC_IV_KEY_LENGTH);
+		memcpy(sess->pKey_hash, auth_xform->auth.key.data,
+				ZUC_IV_KEY_LENGTH);
 	}
 
 
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'examples/l2fwd-crypto: fix overflow' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (24 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'drivers/crypto: fix different auth/cipher keys' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding' " Yuanhan Liu
                   ` (12 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: Yuanhan Liu, Fan Zhang, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 70ef6876bb4d0338d1bdd20a756e520818ed1d61 Mon Sep 17 00:00:00 2001
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Date: Tue, 7 Feb 2017 14:17:25 +0000
Subject: [PATCH] examples/l2fwd-crypto: fix overflow

[ upstream commit ad476dd3ac60b010f8247141f802c80361cdc293 ]

This commit fixes an array overflow when number of crypto devices
is higher than 32.

Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 examples/l2fwd-crypto/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 43fef59..bc88be5 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -200,7 +200,7 @@ struct lcore_queue_conf {
 	unsigned nb_crypto_devs;
 	unsigned cryptodev_list[MAX_RX_QUEUE_PER_LCORE];
 
-	struct op_buffer op_buf[RTE_MAX_ETHPORTS];
+	struct op_buffer op_buf[RTE_CRYPTO_MAX_DEVS];
 	struct pkt_buffer pkt_buf[RTE_MAX_ETHPORTS];
 } __rte_cache_aligned;
 
@@ -299,7 +299,7 @@ print_stats(void)
 
 	for (cdevid = 0; cdevid < RTE_CRYPTO_MAX_DEVS; cdevid++) {
 		/* skip disabled ports */
-		if ((l2fwd_enabled_crypto_mask & (1lu << cdevid)) == 0)
+		if ((l2fwd_enabled_crypto_mask & (((uint64_t)1) << cdevid)) == 0)
 			continue;
 		printf("\nStatistics for cryptodev %"PRIu64
 				" -------------------------"
@@ -1808,7 +1808,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 			return -1;
 		}
 
-		l2fwd_enabled_crypto_mask |= (1 << cdev_id);
+		l2fwd_enabled_crypto_mask |= (((uint64_t)1) << cdev_id);
 
 		enabled_cdevs[cdev_id] = 1;
 		enabled_cdev_count++;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (25 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix overflow' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-16  8:01   ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: allow many vhost-user ports' " Yuanhan Liu
                   ` (11 subsequent siblings)
  38 siblings, 1 reply; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: Yuanhan Liu, Fan Zhang, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From b672755e7af6f234c40e761335ebee2a2d78d1d2 Mon Sep 17 00:00:00 2001
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Date: Thu, 9 Feb 2017 12:27:45 +0000
Subject: [PATCH] examples/l2fwd-crypto: fix padding

[ upstream commit 5839fd20e7323850f3a411d9b5642d914fa2d3f0 ]

L2fwd-crypto app was padding an incoming buffer,
to be aligned with the algorithm block size, in all cases.
This was not the right approach, as padding is only necessary
when using block cipher algorithms, such as AES-CBC.
In case of using a stream cipher algorithm, such as SNOW3G UEA2,
there is no need to include padding and increase the buffer size.

Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 examples/l2fwd-crypto/main.c | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index bc88be5..62ee933 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -432,7 +432,8 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
 	struct ether_hdr *eth_hdr;
 	struct ipv4_hdr *ip_hdr;
 
-	unsigned ipdata_offset, pad_len, data_len;
+	uint32_t ipdata_offset, data_len;
+	uint32_t pad_len = 0;
 	char *padding;
 
 	eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
@@ -455,16 +456,33 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
 	if (cparams->do_hash && cparams->hash_verify)
 		data_len -= cparams->digest_length;
 
-	pad_len = data_len % cparams->block_size ? cparams->block_size -
-			(data_len % cparams->block_size) : 0;
+	if (cparams->do_cipher) {
+		/*
+		 * Following algorithms are block cipher algorithms,
+		 * and might need padding
+		 */
+		switch (cparams->cipher_algo) {
+		case RTE_CRYPTO_CIPHER_AES_CBC:
+		case RTE_CRYPTO_CIPHER_AES_ECB:
+		case RTE_CRYPTO_CIPHER_DES_CBC:
+		case RTE_CRYPTO_CIPHER_3DES_CBC:
+		case RTE_CRYPTO_CIPHER_3DES_ECB:
+			if (data_len % cparams->block_size)
+				pad_len = cparams->block_size -
+					(data_len % cparams->block_size);
+			break;
+		default:
+			pad_len = 0;
+		}
 
-	if (pad_len) {
-		padding = rte_pktmbuf_append(m, pad_len);
-		if (unlikely(!padding))
-			return -1;
+		if (pad_len) {
+			padding = rte_pktmbuf_append(m, pad_len);
+			if (unlikely(!padding))
+				return -1;
 
-		data_len += pad_len;
-		memset(padding, 0, pad_len);
+			data_len += pad_len;
+			memset(padding, 0, pad_len);
+		}
 	}
 
 	/* Set crypto operation data parameters */
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'vhost: allow many vhost-user ports' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (26 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'mempool: fix stack handler dequeue' " Yuanhan Liu
                   ` (10 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Jan Wickbom; +Cc: Yuanhan Liu, Patrik Andersson, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 376fd1d17d2d7f0745f8985fa93364defaa86654 Mon Sep 17 00:00:00 2001
From: Jan Wickbom <jan.wickbom@ericsson.com>
Date: Wed, 21 Dec 2016 17:45:13 +0800
Subject: [PATCH] vhost: allow many vhost-user ports

[ upstream commit 59317cef249c0b23098543df527b3e360ce9764f ]

Currently select() is used to monitor file descriptors for vhostuser
ports. This limits the number of ports possible to create since the
fd number is used as index in the fd_set and we have seen fds > 1023.
This patch changes select() to poll(). This way we can keep an
packed (pollfd) array for the fds, e.g. as many fds as the size of
the array.

Also see:
http://dpdk.org/ml/archives/dev/2016-April/037024.html

Reported-by: Patrik Andersson <patrik.r.andersson@ericsson.com>
Signed-off-by: Jan Wickbom <jan.wickbom@ericsson.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 lib/librte_vhost/fd_man.c | 200 ++++++++++++++++++++++------------------------
 lib/librte_vhost/fd_man.h |   2 +
 2 files changed, 97 insertions(+), 105 deletions(-)

diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c
index 2d3eeb7..8a075da 100644
--- a/lib/librte_vhost/fd_man.c
+++ b/lib/librte_vhost/fd_man.c
@@ -35,93 +35,91 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/socket.h>
-#include <sys/select.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <string.h>
 
 #include <rte_common.h>
 #include <rte_log.h>
 
 #include "fd_man.h"
 
-/**
- * Returns the index in the fdset for a given fd.
- * If fd is -1, it means to search for a free entry.
- * @return
- *   index for the fd, or -1 if fd isn't in the fdset.
- */
+#define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
+
 static int
-fdset_find_fd(struct fdset *pfdset, int fd)
+get_last_valid_idx(struct fdset *pfdset, int last_valid_idx)
 {
 	int i;
 
-	if (pfdset == NULL)
-		return -1;
-
-	for (i = 0; i < MAX_FDS && pfdset->fd[i].fd != fd; i++)
+	for (i = last_valid_idx; i >= 0 && pfdset->fd[i].fd == -1; i--)
 		;
 
-	return i ==  MAX_FDS ? -1 : i;
+	return i;
 }
 
-static int
-fdset_find_free_slot(struct fdset *pfdset)
+static void
+fdset_move(struct fdset *pfdset, int dst, int src)
 {
-	return fdset_find_fd(pfdset, -1);
+	pfdset->fd[dst]    = pfdset->fd[src];
+	pfdset->rwfds[dst] = pfdset->rwfds[src];
 }
 
-static int
-fdset_add_fd(struct fdset  *pfdset, int idx, int fd,
-	fd_cb rcb, fd_cb wcb, void *dat)
+/*
+ * Find deleted fd entries and remove them
+ */
+static void
+fdset_shrink(struct fdset *pfdset)
 {
-	struct fdentry *pfdentry;
+	int i;
+	int last_valid_idx = get_last_valid_idx(pfdset, pfdset->num - 1);
 
-	if (pfdset == NULL || idx >= MAX_FDS || fd >= FD_SETSIZE)
-		return -1;
+	pthread_mutex_lock(&pfdset->fd_mutex);
 
-	pfdentry = &pfdset->fd[idx];
-	pfdentry->fd = fd;
-	pfdentry->rcb = rcb;
-	pfdentry->wcb = wcb;
-	pfdentry->dat = dat;
+	for (i = 0; i < last_valid_idx; i++) {
+		if (pfdset->fd[i].fd != -1)
+			continue;
 
-	return 0;
+		fdset_move(pfdset, i, last_valid_idx);
+		last_valid_idx = get_last_valid_idx(pfdset, last_valid_idx - 1);
+	}
+	pfdset->num = last_valid_idx + 1;
+
+	pthread_mutex_unlock(&pfdset->fd_mutex);
 }
 
 /**
- * Fill the read/write fd_set with the fds in the fdset.
+ * Returns the index in the fdset for a given fd.
  * @return
- *  the maximum fds filled in the read/write fd_set.
+ *   index for the fd, or -1 if fd isn't in the fdset.
  */
 static int
-fdset_fill(fd_set *rfset, fd_set *wfset, struct fdset *pfdset)
+fdset_find_fd(struct fdset *pfdset, int fd)
 {
-	struct fdentry *pfdentry;
-	int i, maxfds = -1;
-	int num = MAX_FDS;
+	int i;
 
-	if (pfdset == NULL)
-		return -1;
+	for (i = 0; i < pfdset->num && pfdset->fd[i].fd != fd; i++)
+		;
 
-	for (i = 0; i < num; i++) {
-		pfdentry = &pfdset->fd[i];
-		if (pfdentry->fd != -1) {
-			int added = 0;
-			if (pfdentry->rcb && rfset) {
-				FD_SET(pfdentry->fd, rfset);
-				added = 1;
-			}
-			if (pfdentry->wcb && wfset) {
-				FD_SET(pfdentry->fd, wfset);
-				added = 1;
-			}
-			if (added)
-				maxfds = pfdentry->fd < maxfds ?
-					maxfds : pfdentry->fd;
-		}
-	}
-	return maxfds;
+	return i == pfdset->num ? -1 : i;
+}
+
+static void
+fdset_add_fd(struct fdset *pfdset, int idx, int fd,
+	fd_cb rcb, fd_cb wcb, void *dat)
+{
+	struct fdentry *pfdentry = &pfdset->fd[idx];
+	struct pollfd *pfd = &pfdset->rwfds[idx];
+
+	pfdentry->fd  = fd;
+	pfdentry->rcb = rcb;
+	pfdentry->wcb = wcb;
+	pfdentry->dat = dat;
+
+	pfd->fd = fd;
+	pfd->events  = rcb ? POLLIN : 0;
+	pfd->events |= wcb ? POLLOUT : 0;
+	pfd->revents = 0;
 }
 
 void
@@ -151,16 +149,13 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat)
 		return -1;
 
 	pthread_mutex_lock(&pfdset->fd_mutex);
-
-	/* Find a free slot in the list. */
-	i = fdset_find_free_slot(pfdset);
-	if (i == -1 || fdset_add_fd(pfdset, i, fd, rcb, wcb, dat) < 0) {
+	i = pfdset->num < MAX_FDS ? pfdset->num++ : -1;
+	if (i == -1) {
 		pthread_mutex_unlock(&pfdset->fd_mutex);
 		return -2;
 	}
 
-	pfdset->num++;
-
+	fdset_add_fd(pfdset, i, fd, rcb, wcb, dat);
 	pthread_mutex_unlock(&pfdset->fd_mutex);
 
 	return 0;
@@ -189,7 +184,6 @@ fdset_del(struct fdset *pfdset, int fd)
 			pfdset->fd[i].fd = -1;
 			pfdset->fd[i].rcb = pfdset->fd[i].wcb = NULL;
 			pfdset->fd[i].dat = NULL;
-			pfdset->num--;
 			i = -1;
 		}
 		pthread_mutex_unlock(&pfdset->fd_mutex);
@@ -198,24 +192,6 @@ fdset_del(struct fdset *pfdset, int fd)
 	return dat;
 }
 
-/**
- *  Unregister the fd at the specified slot from the fdset.
- */
-static void
-fdset_del_slot(struct fdset *pfdset, int index)
-{
-	if (pfdset == NULL || index < 0 || index >= MAX_FDS)
-		return;
-
-	pthread_mutex_lock(&pfdset->fd_mutex);
-
-	pfdset->fd[index].fd = -1;
-	pfdset->fd[index].rcb = pfdset->fd[index].wcb = NULL;
-	pfdset->fd[index].dat = NULL;
-	pfdset->num--;
-
-	pthread_mutex_unlock(&pfdset->fd_mutex);
-}
 
 /**
  * This functions runs in infinite blocking loop until there is no fd in
@@ -229,55 +205,64 @@ fdset_del_slot(struct fdset *pfdset, int index)
 void
 fdset_event_dispatch(struct fdset *pfdset)
 {
-	fd_set rfds, wfds;
-	int i, maxfds;
+	int i;
+	struct pollfd *pfd;
 	struct fdentry *pfdentry;
-	int num = MAX_FDS;
 	fd_cb rcb, wcb;
 	void *dat;
-	int fd;
+	int fd, numfds;
 	int remove1, remove2;
-	int ret;
+	int need_shrink;
 
 	if (pfdset == NULL)
 		return;
 
 	while (1) {
-		struct timeval tv;
-		tv.tv_sec = 1;
-		tv.tv_usec = 0;
-		FD_ZERO(&rfds);
-		FD_ZERO(&wfds);
-		pthread_mutex_lock(&pfdset->fd_mutex);
-
-		maxfds = fdset_fill(&rfds, &wfds, pfdset);
-
-		pthread_mutex_unlock(&pfdset->fd_mutex);
 
 		/*
-		 * When select is blocked, other threads might unregister
+		 * When poll is blocked, other threads might unregister
 		 * listenfds from and register new listenfds into fdset.
-		 * When select returns, the entries for listenfds in the fdset
+		 * When poll returns, the entries for listenfds in the fdset
 		 * might have been updated. It is ok if there is unwanted call
 		 * for new listenfds.
 		 */
-		ret = select(maxfds + 1, &rfds, &wfds, NULL, &tv);
-		if (ret <= 0)
-			continue;
+		pthread_mutex_lock(&pfdset->fd_mutex);
+		numfds = pfdset->num;
+		pthread_mutex_unlock(&pfdset->fd_mutex);
 
-		for (i = 0; i < num; i++) {
-			remove1 = remove2 = 0;
+		poll(pfdset->rwfds, numfds, 1000 /* millisecs */);
+
+		need_shrink = 0;
+		for (i = 0; i < numfds; i++) {
 			pthread_mutex_lock(&pfdset->fd_mutex);
+
 			pfdentry = &pfdset->fd[i];
 			fd = pfdentry->fd;
+			pfd = &pfdset->rwfds[i];
+
+			if (fd < 0) {
+				need_shrink = 1;
+				pthread_mutex_unlock(&pfdset->fd_mutex);
+				continue;
+			}
+
+			if (!pfd->revents) {
+				pthread_mutex_unlock(&pfdset->fd_mutex);
+				continue;
+			}
+
+			remove1 = remove2 = 0;
+
 			rcb = pfdentry->rcb;
 			wcb = pfdentry->wcb;
 			dat = pfdentry->dat;
 			pfdentry->busy = 1;
+
 			pthread_mutex_unlock(&pfdset->fd_mutex);
-			if (fd >= 0 && FD_ISSET(fd, &rfds) && rcb)
+
+			if (rcb && pfd->revents & (POLLIN | FDPOLLERR))
 				rcb(fd, dat, &remove1);
-			if (fd >= 0 && FD_ISSET(fd, &wfds) && wcb)
+			if (wcb && pfd->revents & (POLLOUT | FDPOLLERR))
 				wcb(fd, dat, &remove2);
 			pfdentry->busy = 0;
 			/*
@@ -292,8 +277,13 @@ fdset_event_dispatch(struct fdset *pfdset)
 			 * listen fd in another thread, we couldn't call
 			 * fd_set_del.
 			 */
-			if (remove1 || remove2)
-				fdset_del_slot(pfdset, i);
+			if (remove1 || remove2) {
+				pfdentry->fd = -1;
+				need_shrink = 1;
+			}
 		}
+
+		if (need_shrink)
+			fdset_shrink(pfdset);
 	}
 }
diff --git a/lib/librte_vhost/fd_man.h b/lib/librte_vhost/fd_man.h
index bd66ed1..d319cac 100644
--- a/lib/librte_vhost/fd_man.h
+++ b/lib/librte_vhost/fd_man.h
@@ -35,6 +35,7 @@
 #define _FD_MAN_H_
 #include <stdint.h>
 #include <pthread.h>
+#include <poll.h>
 
 #define MAX_FDS 1024
 
@@ -49,6 +50,7 @@ struct fdentry {
 };
 
 struct fdset {
+	struct pollfd rwfds[MAX_FDS];
 	struct fdentry fd[MAX_FDS];
 	pthread_mutex_t fd_mutex;
 	int num;	/* current fd number of this fdset */
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'mempool: fix stack handler dequeue' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (27 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: allow many vhost-user ports' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'ethdev: fix port data mismatched in multiple process model' " Yuanhan Liu
                   ` (9 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 99cf175ab607413ec52bb913ff1eb1b92008be98 Mon Sep 17 00:00:00 2001
From: Olivier Matz <olivier.matz@6wind.com>
Date: Mon, 23 Jan 2017 18:11:03 +0100
Subject: [PATCH] mempool: fix stack handler dequeue

[ upstream commit e09ff22d538e13ead91a5caa2d136e8e065e5ed1 ]

The return value of the stack handler is wrong: it should be 0 on
success, not the number of objects dequeued.

This could lead to memory leaks depending on how the caller checks the
return value (ret < 0 or ret != 0). This was also breaking autotests
with debug enabled, because the debug cookies are only updated when the
function returns 0, so the cookies were not updated, leading to
an abort().

Fixes: 295a530b0844 ("mempool: add stack mempool handler")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_mempool/rte_mempool_stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_mempool/rte_mempool_stack.c b/lib/librte_mempool/rte_mempool_stack.c
index 5fd8af2..817f77e 100644
--- a/lib/librte_mempool/rte_mempool_stack.c
+++ b/lib/librte_mempool/rte_mempool_stack.c
@@ -118,7 +118,7 @@ stack_dequeue(struct rte_mempool *mp, void **obj_table,
 
 	s->len -= n;
 	rte_spinlock_unlock(&s->sl);
-	return n;
+	return 0;
 }
 
 static unsigned
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'ethdev: fix port data mismatched in multiple process model' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (28 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'mempool: fix stack handler dequeue' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix wrong Rx/Tx method for secondary process' " Yuanhan Liu
                   ` (8 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Thomas Monjalon, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 74becaeac5d79358219c398a20e35ac821e542ee Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Mon, 9 Jan 2017 15:50:59 +0800
Subject: [PATCH] ethdev: fix port data mismatched in multiple process model

[ backported from upstream commit d948f596fee245823afb2b555a3164a53a6d91fd ]

Assume we have two virtio ports, 00:03.0 and 00:04.0. The first one is
managed by the kernel driver, while the later one is managed by DPDK.

Now we start the primary process. 00:03.0 will be skipped by DPDK virtio
PMD driver (since it's being used by the kernel). 00:04.0 would be
successfully initiated by DPDK virtio PMD (if nothing abnormal happens).
After that, we would get a port id 0, and all the related info needed
by virtio (virtio_hw) is stored at rte_eth_dev_data[0].

Then we start the secondary process. As usual, 00:03.0 will be firstly
probed. It firstly tries to get a local eth_dev structure for it (by
rte_eth_dev_allocate):

        port_id = rte_eth_dev_find_free_port();
        ...

        eth_dev = &rte_eth_devices[port_id];
        eth_dev->data = &rte_eth_dev_data[port_id];
        ...

        return eth_dev;

Since it's a first PCI device, port_id will be 0. eth_dev->data would
then point to rte_eth_dev_data[0]. And here things start going wrong,
as rte_eth_dev_data[0] actually stores the virtio_hw for 00:04.0.

That said, in the secondary process, DPDK will continue to drive PCI
device 00.03.0 (despite the fact it's been managed by kernel), with
the info from PCI device 00:04.0. Which is wrong.

The fix is to attach the port already registered by the primary process.
That is, iterate the rte_eth_dev_data[], and get the port id who's PCI
ID matches the current PCI device.

This would let us maintain same port ID for the same PCI device, keeping
the chance of referencing to wrong data minimal.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_ether/rte_ethdev.c | 72 +++++++++++++++++++++++++++++++++++++------
 1 file changed, 63 insertions(+), 9 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 45d8286..5a31759 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -189,6 +189,20 @@ rte_eth_dev_find_free_port(void)
 	return RTE_MAX_ETHPORTS;
 }
 
+static struct rte_eth_dev *
+eth_dev_get(uint8_t port_id)
+{
+	struct rte_eth_dev *eth_dev = &rte_eth_devices[port_id];
+
+	eth_dev->data = &rte_eth_dev_data[port_id];
+	eth_dev->attached = DEV_ATTACHED;
+
+	eth_dev_last_created_port = port_id;
+	nb_ports++;
+
+	return eth_dev;
+}
+
 struct rte_eth_dev *
 rte_eth_dev_allocate(const char *name)
 {
@@ -210,13 +224,41 @@ rte_eth_dev_allocate(const char *name)
 		return NULL;
 	}
 
-	eth_dev = &rte_eth_devices[port_id];
-	eth_dev->data = &rte_eth_dev_data[port_id];
+	eth_dev = eth_dev_get(port_id);
 	snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
 	eth_dev->data->port_id = port_id;
-	eth_dev->attached = DEV_ATTACHED;
-	eth_dev_last_created_port = port_id;
-	nb_ports++;
+
+	return eth_dev;
+}
+
+/*
+ * Attach to a port already registered by the primary process, which
+ * makes sure that the same device would have the same port id both
+ * in the primary and secondary process.
+ */
+static struct rte_eth_dev *
+eth_dev_attach_secondary(const char *name)
+{
+	uint8_t i;
+	struct rte_eth_dev *eth_dev;
+
+	if (rte_eth_dev_data == NULL)
+		rte_eth_dev_data_alloc();
+
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+		if (strcmp(rte_eth_dev_data[i].name, name) == 0)
+			break;
+	}
+	if (i == RTE_MAX_ETHPORTS) {
+		RTE_PMD_DEBUG_TRACE(
+			"device %s is not driven by the primary process\n",
+			name);
+		return NULL;
+	}
+
+	eth_dev = eth_dev_get(i);
+	RTE_ASSERT(eth_dev->data->port_id == i);
+
 	return eth_dev;
 }
 
@@ -246,16 +288,28 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
 	rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
 			sizeof(ethdev_name));
 
-	eth_dev = rte_eth_dev_allocate(ethdev_name);
-	if (eth_dev == NULL)
-		return -ENOMEM;
-
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		eth_dev = rte_eth_dev_allocate(ethdev_name);
+		if (eth_dev == NULL)
+			return -ENOMEM;
+
 		eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
 				  eth_drv->dev_private_size,
 				  RTE_CACHE_LINE_SIZE);
 		if (eth_dev->data->dev_private == NULL)
 			rte_panic("Cannot allocate memzone for private port data\n");
+	} else {
+		eth_dev = eth_dev_attach_secondary(ethdev_name);
+		if (eth_dev == NULL) {
+			/*
+			 * if we failed to attach a device, it means the
+			 * device is skipped in primary process, due to
+			 * some errors. If so, we return a positive value,
+			 * to let EAL skip it for the secondary process
+			 * as well.
+			 */
+			return 1;
+		}
 	}
 	eth_dev->pci_dev = pci_dev;
 	eth_dev->driver = eth_drv;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/virtio: fix wrong Rx/Tx method for secondary process' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (29 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'ethdev: fix port data mismatched in multiple process model' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: store PCI operators pointer locally' " Yuanhan Liu
                   ` (7 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 5ddf76c864fa577d394067e85e493126a8a0ca1e Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Fri, 6 Jan 2017 18:16:16 +0800
Subject: [PATCH] net/virtio: fix wrong Rx/Tx method for secondary process

[ upstream commit d4be35a91340b8474bd5f8b6bcaa26084bb30c9f ]

If the primary enables the vector Rx/Tx path, the current code would
let the secondary always choose the non vector Rx/Tx path. This results
to a Rx/Tx method mismatch between primary and secondary process. Werid
errors then may happen, something like:

    PMD: virtio_xmit_pkts() tx: virtqueue_enqueue error: -14

Fix it by choosing the correct Rx/Tx callbacks for the secondary process.
That is, use vector path if it's given.

Fixes: 8d8393fb1861 ("virtio: pick simple Rx/Tx")

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 85ae147..4047da5 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1306,7 +1306,12 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_burst = &virtio_xmit_pkts;
 
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
-		rx_func_get(eth_dev);
+		if (hw->use_simple_rxtx) {
+			eth_dev->tx_pkt_burst = virtio_xmit_pkts_simple;
+			eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;
+		} else {
+			rx_func_get(eth_dev);
+		}
 		return 0;
 	}
 
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/virtio: store PCI operators pointer locally' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (30 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix wrong Rx/Tx method for secondary process' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: store IO port info " Yuanhan Liu
                   ` (6 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From d6e433c489dfde08a718200885845aaaa310d1bd Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Fri, 6 Jan 2017 18:16:17 +0800
Subject: [PATCH] net/virtio: store PCI operators pointer locally

[ upstream commit 553f45932fb797e9fbd6342016e0dd53e1f61fc7 ]

We used to store the vtpci_ops at virtio_hw structure. The struct,
however, is stored in shared memory. That means only one value is
allowed. For the multiple process model, however, the address of
vtpci_ops should be different among different processes.

Take virtio PMD as example, the vtpci_ops is set by the primary
process, based on its own process space. If we access that address
from the secondary process, that would be an illegal memory access,
A crash then might happen.

To make the multiple process model work, we need store the vtpci_ops
in local memory but not in a shared memory. This is what the patch
does: a local virtio_hw_internal array of size RTE_MAX_ETHPORTS is
allocated. This new structure is used to store all these kind of
info in a non-shared memory. Current, we have:

- vtpci_ops

- rte_pci_ioport

- virtio pci mapped memory, such as common_cfg.

The later two will be done in coming patches. Later patches would also
set them correctly for secondary process, so that the multiple process
model could work.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/net/virtio/virtio_ethdev.c      |  9 ++++++---
 drivers/net/virtio/virtio_pci.c         | 26 +++++++++++++-------------
 drivers/net/virtio/virtio_pci.h         | 17 ++++++++++++++++-
 drivers/net/virtio/virtio_user_ethdev.c |  3 ++-
 drivers/net/virtio/virtqueue.h          |  2 +-
 5 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4047da5..fd0ffc2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -152,6 +152,8 @@ static const struct rte_virtio_xstats_name_off rte_virtio_txq_stat_strings[] = {
 #define VIRTIO_NB_TXQ_XSTATS (sizeof(rte_virtio_txq_stat_strings) / \
 			    sizeof(rte_virtio_txq_stat_strings[0]))
 
+struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS];
+
 static int
 virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,
 		int *dlen, int pkt_num)
@@ -360,7 +362,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
 	 * Read the virtqueue size from the Queue Size field
 	 * Always power of 2 and if 0 virtqueue does not exist
 	 */
-	vq_size = hw->vtpci_ops->get_queue_num(hw, vtpci_queue_idx);
+	vq_size = VTPCI_OPS(hw)->get_queue_num(hw, vtpci_queue_idx);
 	PMD_INIT_LOG(DEBUG, "vq_size: %u", vq_size);
 	if (vq_size == 0) {
 		PMD_INIT_LOG(ERR, "virtqueue does not exist");
@@ -519,7 +521,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
 		}
 	}
 
-	if (hw->vtpci_ops->setup_queue(hw, vq) < 0) {
+	if (VTPCI_OPS(hw)->setup_queue(hw, vq) < 0) {
 		PMD_INIT_LOG(ERR, "setup_queue failed");
 		return -EINVAL;
 	}
@@ -1116,7 +1118,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)
 		req_features);
 
 	/* Read device(host) feature bits */
-	host_features = hw->vtpci_ops->get_features(hw);
+	host_features = VTPCI_OPS(hw)->get_features(hw);
 	PMD_INIT_LOG(DEBUG, "host_features before negotiate = %" PRIx64,
 		host_features);
 
@@ -1332,6 +1334,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 			return ret;
 	}
 
+	hw->port_id = eth_dev->data->port_id;
 	eth_dev->data->dev_flags = dev_flags;
 
 	/* reset device and negotiate default features */
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 9b47165..b1f2e18 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -537,14 +537,14 @@ void
 vtpci_read_dev_config(struct virtio_hw *hw, size_t offset,
 		      void *dst, int length)
 {
-	hw->vtpci_ops->read_dev_cfg(hw, offset, dst, length);
+	VTPCI_OPS(hw)->read_dev_cfg(hw, offset, dst, length);
 }
 
 void
 vtpci_write_dev_config(struct virtio_hw *hw, size_t offset,
 		       const void *src, int length)
 {
-	hw->vtpci_ops->write_dev_cfg(hw, offset, src, length);
+	VTPCI_OPS(hw)->write_dev_cfg(hw, offset, src, length);
 }
 
 uint64_t
@@ -557,7 +557,7 @@ vtpci_negotiate_features(struct virtio_hw *hw, uint64_t host_features)
 	 * host all support.
 	 */
 	features = host_features & hw->guest_features;
-	hw->vtpci_ops->set_features(hw, features);
+	VTPCI_OPS(hw)->set_features(hw, features);
 
 	return features;
 }
@@ -565,9 +565,9 @@ vtpci_negotiate_features(struct virtio_hw *hw, uint64_t host_features)
 void
 vtpci_reset(struct virtio_hw *hw)
 {
-	hw->vtpci_ops->set_status(hw, VIRTIO_CONFIG_STATUS_RESET);
+	VTPCI_OPS(hw)->set_status(hw, VIRTIO_CONFIG_STATUS_RESET);
 	/* flush status write */
-	hw->vtpci_ops->get_status(hw);
+	VTPCI_OPS(hw)->get_status(hw);
 }
 
 void
@@ -580,21 +580,21 @@ void
 vtpci_set_status(struct virtio_hw *hw, uint8_t status)
 {
 	if (status != VIRTIO_CONFIG_STATUS_RESET)
-		status |= hw->vtpci_ops->get_status(hw);
+		status |= VTPCI_OPS(hw)->get_status(hw);
 
-	hw->vtpci_ops->set_status(hw, status);
+	VTPCI_OPS(hw)->set_status(hw, status);
 }
 
 uint8_t
 vtpci_get_status(struct virtio_hw *hw)
 {
-	return hw->vtpci_ops->get_status(hw);
+	return VTPCI_OPS(hw)->get_status(hw);
 }
 
 uint8_t
 vtpci_isr(struct virtio_hw *hw)
 {
-	return hw->vtpci_ops->get_isr(hw);
+	return VTPCI_OPS(hw)->get_isr(hw);
 }
 
 
@@ -602,7 +602,7 @@ vtpci_isr(struct virtio_hw *hw)
 uint16_t
 vtpci_irq_config(struct virtio_hw *hw, uint16_t vec)
 {
-	return hw->vtpci_ops->set_config_irq(hw, vec);
+	return VTPCI_OPS(hw)->set_config_irq(hw, vec);
 }
 
 static void *
@@ -736,8 +736,8 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
 	 */
 	if (virtio_read_caps(dev, hw) == 0) {
 		PMD_INIT_LOG(INFO, "modern virtio pci detected.");
-		hw->vtpci_ops = &modern_ops;
-		hw->modern    = 1;
+		virtio_hw_internal[hw->port_id].vtpci_ops = &modern_ops;
+		hw->modern = 1;
 		*dev_flags |= RTE_ETH_DEV_INTR_LSC;
 		return 0;
 	}
@@ -755,7 +755,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
 		return -1;
 	}
 
-	hw->vtpci_ops = &legacy_ops;
+	virtio_hw_internal[hw->port_id].vtpci_ops = &legacy_ops;
 	hw->use_msix = legacy_virtio_has_msix(&dev->addr);
 	hw->modern   = 0;
 
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index de271bf..268bb82 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -254,6 +254,7 @@ struct virtio_hw {
 	uint8_t	    use_msix;
 	uint8_t     modern;
 	uint8_t     use_simple_rxtx;
+	uint8_t     port_id;
 	uint8_t     mac_addr[ETHER_ADDR_LEN];
 	uint32_t    notify_off_multiplier;
 	uint8_t     *isr;
@@ -261,12 +262,26 @@ struct virtio_hw {
 	struct rte_pci_device *dev;
 	struct virtio_pci_common_cfg *common_cfg;
 	struct virtio_net_config *dev_cfg;
-	const struct virtio_pci_ops *vtpci_ops;
 	void	    *virtio_user_dev;
 
 	struct virtqueue **vqs;
 };
 
+
+/*
+ * While virtio_hw is stored in shared memory, this structure stores
+ * some infos that may vary in the multiple process model locally.
+ * For example, the vtpci_ops pointer.
+ */
+struct virtio_hw_internal {
+	const struct virtio_pci_ops *vtpci_ops;
+};
+
+#define VTPCI_OPS(hw)	(virtio_hw_internal[(hw)->port_id].vtpci_ops)
+
+extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS];
+
+
 /*
  * This structure is just a reference to read
  * net device specific config space; it just a chodu structure
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 6ca757b..d69d8fa 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -305,7 +305,8 @@ virtio_user_eth_dev_alloc(const char *name)
 		return NULL;
 	}
 
-	hw->vtpci_ops = &virtio_user_ops;
+	hw->port_id = data->port_id;
+	virtio_hw_internal[hw->port_id].vtpci_ops = &virtio_user_ops;
 	hw->use_msix = 0;
 	hw->modern   = 0;
 	hw->use_simple_rxtx = 0;
diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index f0bb089..b1070e0 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -330,7 +330,7 @@ virtqueue_notify(struct virtqueue *vq)
 	 * For virtio on IA, the notificaiton is through io port operation
 	 * which is a serialization instruction itself.
 	 */
-	vq->hw->vtpci_ops->notify_queue(vq->hw, vq);
+	VTPCI_OPS(vq->hw)->notify_queue(vq->hw, vq);
 }
 
 #ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/virtio: store IO port info locally' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (31 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: store PCI operators pointer locally' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix multiple process support' " Yuanhan Liu
                   ` (5 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 8c3541722a674e5e2e9ae3a99ecb8d7870904a3b Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Fri, 6 Jan 2017 18:16:18 +0800
Subject: [PATCH] net/virtio: store IO port info locally

[ upstream commit 1ca893f11d1d47c13535805c3ec7ca11e26cbe03 ]

Like vtpci_ops, the rte_pci_ioport has to store in local memory. This
is basically for the rte_pci_device field is allocated from process
local memory, but not from shared memory.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/net/virtio/virtio_pci.c | 50 ++++++++++++++++++++++-------------------
 drivers/net/virtio/virtio_pci.h |  3 ++-
 2 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index b1f2e18..7903e29 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -92,17 +92,17 @@ legacy_read_dev_config(struct virtio_hw *hw, size_t offset,
 	while (length > 0) {
 		if (length >= 4) {
 			size = 4;
-			rte_eal_pci_ioport_read(&hw->io, dst, size,
+			rte_eal_pci_ioport_read(VTPCI_IO(hw), dst, size,
 				VIRTIO_PCI_CONFIG(hw) + offset);
 			*(uint32_t *)dst = rte_be_to_cpu_32(*(uint32_t *)dst);
 		} else if (length >= 2) {
 			size = 2;
-			rte_eal_pci_ioport_read(&hw->io, dst, size,
+			rte_eal_pci_ioport_read(VTPCI_IO(hw), dst, size,
 				VIRTIO_PCI_CONFIG(hw) + offset);
 			*(uint16_t *)dst = rte_be_to_cpu_16(*(uint16_t *)dst);
 		} else {
 			size = 1;
-			rte_eal_pci_ioport_read(&hw->io, dst, size,
+			rte_eal_pci_ioport_read(VTPCI_IO(hw), dst, size,
 				VIRTIO_PCI_CONFIG(hw) + offset);
 		}
 
@@ -111,7 +111,7 @@ legacy_read_dev_config(struct virtio_hw *hw, size_t offset,
 		length -= size;
 	}
 #else
-	rte_eal_pci_ioport_read(&hw->io, dst, length,
+	rte_eal_pci_ioport_read(VTPCI_IO(hw), dst, length,
 				VIRTIO_PCI_CONFIG(hw) + offset);
 #endif
 }
@@ -131,16 +131,16 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,
 		if (length >= 4) {
 			size = 4;
 			tmp.u32 = rte_cpu_to_be_32(*(const uint32_t *)src);
-			rte_eal_pci_ioport_write(&hw->io, &tmp.u32, size,
+			rte_eal_pci_ioport_write(VTPCI_IO(hw), &tmp.u32, size,
 				VIRTIO_PCI_CONFIG(hw) + offset);
 		} else if (length >= 2) {
 			size = 2;
 			tmp.u16 = rte_cpu_to_be_16(*(const uint16_t *)src);
-			rte_eal_pci_ioport_write(&hw->io, &tmp.u16, size,
+			rte_eal_pci_ioport_write(VTPCI_IO(hw), &tmp.u16, size,
 				VIRTIO_PCI_CONFIG(hw) + offset);
 		} else {
 			size = 1;
-			rte_eal_pci_ioport_write(&hw->io, src, size,
+			rte_eal_pci_ioport_write(VTPCI_IO(hw), src, size,
 				VIRTIO_PCI_CONFIG(hw) + offset);
 		}
 
@@ -149,7 +149,7 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,
 		length -= size;
 	}
 #else
-	rte_eal_pci_ioport_write(&hw->io, src, length,
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), src, length,
 				 VIRTIO_PCI_CONFIG(hw) + offset);
 #endif
 }
@@ -159,7 +159,8 @@ legacy_get_features(struct virtio_hw *hw)
 {
 	uint32_t dst;
 
-	rte_eal_pci_ioport_read(&hw->io, &dst, 4, VIRTIO_PCI_HOST_FEATURES);
+	rte_eal_pci_ioport_read(VTPCI_IO(hw), &dst, 4,
+				VIRTIO_PCI_HOST_FEATURES);
 	return dst;
 }
 
@@ -171,7 +172,7 @@ legacy_set_features(struct virtio_hw *hw, uint64_t features)
 			"only 32 bit features are allowed for legacy virtio!");
 		return;
 	}
-	rte_eal_pci_ioport_write(&hw->io, &features, 4,
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &features, 4,
 				 VIRTIO_PCI_GUEST_FEATURES);
 }
 
@@ -180,14 +181,14 @@ legacy_get_status(struct virtio_hw *hw)
 {
 	uint8_t dst;
 
-	rte_eal_pci_ioport_read(&hw->io, &dst, 1, VIRTIO_PCI_STATUS);
+	rte_eal_pci_ioport_read(VTPCI_IO(hw), &dst, 1, VIRTIO_PCI_STATUS);
 	return dst;
 }
 
 static void
 legacy_set_status(struct virtio_hw *hw, uint8_t status)
 {
-	rte_eal_pci_ioport_write(&hw->io, &status, 1, VIRTIO_PCI_STATUS);
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &status, 1, VIRTIO_PCI_STATUS);
 }
 
 static void
@@ -201,7 +202,7 @@ legacy_get_isr(struct virtio_hw *hw)
 {
 	uint8_t dst;
 
-	rte_eal_pci_ioport_read(&hw->io, &dst, 1, VIRTIO_PCI_ISR);
+	rte_eal_pci_ioport_read(VTPCI_IO(hw), &dst, 1, VIRTIO_PCI_ISR);
 	return dst;
 }
 
@@ -211,8 +212,10 @@ legacy_set_config_irq(struct virtio_hw *hw, uint16_t vec)
 {
 	uint16_t dst;
 
-	rte_eal_pci_ioport_write(&hw->io, &vec, 2, VIRTIO_MSI_CONFIG_VECTOR);
-	rte_eal_pci_ioport_read(&hw->io, &dst, 2, VIRTIO_MSI_CONFIG_VECTOR);
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &vec, 2,
+				 VIRTIO_MSI_CONFIG_VECTOR);
+	rte_eal_pci_ioport_read(VTPCI_IO(hw), &dst, 2,
+				VIRTIO_MSI_CONFIG_VECTOR);
 	return dst;
 }
 
@@ -221,8 +224,9 @@ legacy_get_queue_num(struct virtio_hw *hw, uint16_t queue_id)
 {
 	uint16_t dst;
 
-	rte_eal_pci_ioport_write(&hw->io, &queue_id, 2, VIRTIO_PCI_QUEUE_SEL);
-	rte_eal_pci_ioport_read(&hw->io, &dst, 2, VIRTIO_PCI_QUEUE_NUM);
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &queue_id, 2,
+				 VIRTIO_PCI_QUEUE_SEL);
+	rte_eal_pci_ioport_read(VTPCI_IO(hw), &dst, 2, VIRTIO_PCI_QUEUE_NUM);
 	return dst;
 }
 
@@ -234,10 +238,10 @@ legacy_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)
 	if (!check_vq_phys_addr_ok(vq))
 		return -1;
 
-	rte_eal_pci_ioport_write(&hw->io, &vq->vq_queue_index, 2,
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
 			 VIRTIO_PCI_QUEUE_SEL);
 	src = vq->vq_ring_mem >> VIRTIO_PCI_QUEUE_ADDR_SHIFT;
-	rte_eal_pci_ioport_write(&hw->io, &src, 4, VIRTIO_PCI_QUEUE_PFN);
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &src, 4, VIRTIO_PCI_QUEUE_PFN);
 
 	return 0;
 }
@@ -247,15 +251,15 @@ legacy_del_queue(struct virtio_hw *hw, struct virtqueue *vq)
 {
 	uint32_t src = 0;
 
-	rte_eal_pci_ioport_write(&hw->io, &vq->vq_queue_index, 2,
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
 			 VIRTIO_PCI_QUEUE_SEL);
-	rte_eal_pci_ioport_write(&hw->io, &src, 4, VIRTIO_PCI_QUEUE_PFN);
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &src, 4, VIRTIO_PCI_QUEUE_PFN);
 }
 
 static void
 legacy_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
 {
-	rte_eal_pci_ioport_write(&hw->io, &vq->vq_queue_index, 2,
+	rte_eal_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
 			 VIRTIO_PCI_QUEUE_NOTIFY);
 }
 
@@ -289,7 +293,7 @@ static int
 legacy_virtio_resource_init(struct rte_pci_device *pci_dev,
 			    struct virtio_hw *hw, uint32_t *dev_flags)
 {
-	if (rte_eal_pci_ioport_map(pci_dev, 0, &hw->io) < 0)
+	if (rte_eal_pci_ioport_map(pci_dev, 0, VTPCI_IO(hw)) < 0)
 		return -1;
 
 	if (pci_dev->intr_handle.type != RTE_INTR_HANDLE_UNKNOWN)
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 268bb82..6b9aecf 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -245,7 +245,6 @@ struct virtio_net_config;
 
 struct virtio_hw {
 	struct virtnet_ctl *cvq;
-	struct rte_pci_ioport io;
 	uint64_t    req_guest_features;
 	uint64_t    guest_features;
 	uint32_t    max_queue_pairs;
@@ -275,9 +274,11 @@ struct virtio_hw {
  */
 struct virtio_hw_internal {
 	const struct virtio_pci_ops *vtpci_ops;
+	struct rte_pci_ioport io;
 };
 
 #define VTPCI_OPS(hw)	(virtio_hw_internal[(hw)->port_id].vtpci_ops)
+#define VTPCI_IO(hw)	(&virtio_hw_internal[(hw)->port_id].io)
 
 extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS];
 
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/virtio: fix multiple process support' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (32 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: store IO port info " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix build without virtio-user' " Yuanhan Liu
                   ` (4 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Juho Snellman, Yaron Illouz, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From f936571d05c297167ee29cf2f34e14668cbced89 Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Fri, 6 Jan 2017 18:16:19 +0800
Subject: [PATCH] net/virtio: fix multiple process support

[ backported from upstream commit 6d890f8ab51295045a53f41c4d2654bb1f01cf38 ]

The introduce of virtio 1.0 support brings yet another set of ops, badly,
it's not handled correctly, that it breaks the multiple process support.

The issue is the data/function pointer may vary from different processes,
and the old used to do one time set (for primary process only). That
said, the function pointer the secondary process saw is actually from the
primary process space. Accessing it could likely result to a crash.

Kudos to the last patches, we now be able to maintain those info that may
vary among different process locally, meaning every process could have its
own copy for each of them, with the correct value set. And this is what
this patch does:

- remap the PCI (IO port for legacy device and memory map for modern
  device)

- set vtpci_ops correctly

After that, multiple process would work like a charm. (At least, it
passed my fuzzy test)

Fixes: b8f04520ad71 ("virtio: use PCI ioport API")
Fixes: d5bbeefca826 ("virtio: introduce PCI implementation structure")
Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")

Reported-by: Juho Snellman <jsnell@iki.fi>
Reported-by: Yaron Illouz <yaroni@radcom.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 doc/guides/nics/features/virtio.ini     |  1 +
 drivers/net/virtio/virtio_ethdev.c      | 50 +++++++++++++++++++++++++++++++++
 drivers/net/virtio/virtio_pci.c         |  4 +--
 drivers/net/virtio/virtio_pci.h         |  4 +++
 drivers/net/virtio/virtio_user_ethdev.c |  2 +-
 5 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/doc/guides/nics/features/virtio.ini b/doc/guides/nics/features/virtio.ini
index 41830c1..1d996c6 100644
--- a/doc/guides/nics/features/virtio.ini
+++ b/doc/guides/nics/features/virtio.ini
@@ -14,6 +14,7 @@ Multicast MAC filter = Y
 VLAN filter          = Y
 Basic stats          = Y
 Stats per queue      = Y
+Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
 Linux VFIO           = Y
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index fd0ffc2..6e5c5d6 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1291,6 +1291,49 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 }
 
 /*
+ * Remap the PCI device again (IO port map for legacy device and
+ * memory map for modern device), so that the secondary process
+ * could have the PCI initiated correctly.
+ */
+static int
+virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_hw *hw)
+{
+	if (hw->modern) {
+		/*
+		 * We don't have to re-parse the PCI config space, since
+		 * rte_eal_pci_map_device() makes sure the mapped address
+		 * in secondary process would equal to the one mapped in
+		 * the primary process: error will be returned if that
+		 * requirement is not met.
+		 *
+		 * That said, we could simply reuse all cap pointers
+		 * (such as dev_cfg, common_cfg, etc.) parsed from the
+		 * primary process, which is stored in shared memory.
+		 */
+		if (rte_eal_pci_map_device(pci_dev)) {
+			PMD_INIT_LOG(DEBUG, "failed to map pci device!");
+			return -1;
+		}
+	} else {
+		if (rte_eal_pci_ioport_map(pci_dev, 0, VTPCI_IO(hw)) < 0)
+			return -1;
+	}
+
+	return 0;
+}
+
+static void
+virtio_set_vtpci_ops(struct virtio_hw *hw)
+{
+	if (hw->virtio_user_dev)
+		VTPCI_OPS(hw) = &virtio_user_ops;
+	else if (hw->modern)
+		VTPCI_OPS(hw) = &modern_ops;
+	else
+		VTPCI_OPS(hw) = &legacy_ops;
+}
+
+/*
  * This function is based on probe() function in virtio_pci.c
  * It returns 0 on success.
  */
@@ -1308,6 +1351,13 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_burst = &virtio_xmit_pkts;
 
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		if (!hw->virtio_user_dev) {
+			ret = virtio_remap_pci(eth_dev->pci_dev, hw);
+			if (ret)
+				return ret;
+		}
+
+		virtio_set_vtpci_ops(hw);
 		if (hw->use_simple_rxtx) {
 			eth_dev->tx_pkt_burst = virtio_xmit_pkts_simple;
 			eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 7903e29..8d5355c 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -304,7 +304,7 @@ legacy_virtio_resource_init(struct rte_pci_device *pci_dev,
 	return 0;
 }
 
-static const struct virtio_pci_ops legacy_ops = {
+const struct virtio_pci_ops legacy_ops = {
 	.read_dev_cfg	= legacy_read_dev_config,
 	.write_dev_cfg	= legacy_write_dev_config,
 	.reset		= legacy_reset,
@@ -520,7 +520,7 @@ modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq)
 	io_write16(1, vq->notify_addr);
 }
 
-static const struct virtio_pci_ops modern_ops = {
+const struct virtio_pci_ops modern_ops = {
 	.read_dev_cfg	= modern_read_dev_config,
 	.write_dev_cfg	= modern_write_dev_config,
 	.reset		= modern_reset,
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 6b9aecf..511a1c8 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -333,4 +333,8 @@ uint8_t vtpci_isr(struct virtio_hw *);
 
 uint16_t vtpci_irq_config(struct virtio_hw *, uint16_t);
 
+extern const struct virtio_pci_ops legacy_ops;
+extern const struct virtio_pci_ops modern_ops;
+extern const struct virtio_pci_ops virtio_user_ops;
+
 #endif /* _VIRTIO_PCI_H_ */
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index d69d8fa..013600e 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -216,7 +216,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
 			    strerror(errno));
 }
 
-static const struct virtio_pci_ops virtio_user_ops = {
+const struct virtio_pci_ops virtio_user_ops = {
 	.read_dev_cfg	= virtio_user_read_dev_config,
 	.write_dev_cfg	= virtio_user_write_dev_config,
 	.reset		= virtio_user_reset,
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/virtio: fix build without virtio-user' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (33 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix multiple process support' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix crash when number of virtio devices > 1' " Yuanhan Liu
                   ` (3 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Yuanhan Liu, Andrew Rybchenko, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From c3a08e3bece4decbebc93b8a8dc39b7d5262959e Mon Sep 17 00:00:00 2001
From: Thomas Monjalon <thomas.monjalon@6wind.com>
Date: Tue, 17 Jan 2017 23:13:00 +0100
Subject: [PATCH] net/virtio: fix build without virtio-user

[ upstream commit e754c959fca3f15263920789cf69148b9edd646e ]

When CONFIG_RTE_VIRTIO_USER is disabled (default on FreeBSD),
the virtio driver cannot be compiled:

librte_pmd_virtio.a(virtio_ethdev.o): In function `eth_virtio_dev_init':
(.text+0x1eba): undefined reference to `virtio_user_ops'

Reported-by: Andrew Rybchenko <arybchenko@solarflare.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 drivers/net/virtio/virtio_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 6e5c5d6..4b6e0a1 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1325,9 +1325,12 @@ virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_hw *hw)
 static void
 virtio_set_vtpci_ops(struct virtio_hw *hw)
 {
+#ifdef RTE_VIRTIO_USER
 	if (hw->virtio_user_dev)
 		VTPCI_OPS(hw) = &virtio_user_ops;
-	else if (hw->modern)
+	else
+#endif
+	if (hw->modern)
 		VTPCI_OPS(hw) = &modern_ops;
 	else
 		VTPCI_OPS(hw) = &legacy_ops;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/virtio: fix crash when number of virtio devices > 1' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (34 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix build without virtio-user' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'usertools: fix active interface detection when binding' " Yuanhan Liu
                   ` (2 subsequent siblings)
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Lei Yao, Maxime Coquelin, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 7c0ce1bc56d91301bc9fd58c8b022d0ade17f1ca Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Sun, 22 Jan 2017 16:47:00 +0800
Subject: [PATCH] net/virtio: fix crash when number of virtio devices > 1

[ backported from upstream commit 7687312571c90c3e5f93a4eb29c7a45c828d1f79 ]

The vtpci_ops assignment needs the 'hw->port_id' as an input parameter.
That said, we should set 'hw->port_id' firstly, then do the vtpci_ops
assignment, while the code does reversely. That would result to a crash
when more than one virtio devices are used, because we keep assigning
proper vtpci_ops to virtio_hw_internal[0]->vtpci_ops, leaving the pointer
for other ports being NULL.

Reverse the order fixes this issue.

Fixes: 9470427c88e1 ("net/virtio: do not store PCI device pointer at shared memory")

Reported-by: Lei Yao <lei.a.yao@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4b6e0a1..f5961ab 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1380,6 +1380,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 	}
 
 	pci_dev = eth_dev->pci_dev;
+	hw->port_id = eth_dev->data->port_id;
 
 	if (pci_dev) {
 		ret = vtpci_init(pci_dev, hw, &dev_flags);
@@ -1387,7 +1388,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 			return ret;
 	}
 
-	hw->port_id = eth_dev->data->port_id;
 	eth_dev->data->dev_flags = dev_flags;
 
 	/* reset device and negotiate default features */
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'usertools: fix active interface detection when binding' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (35 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix crash when number of virtio devices > 1' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/vhost: fix unix socket not removed as closing' " Yuanhan Liu
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbevf: fix max packet length' " Yuanhan Liu
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yoni Gilad; +Cc: Yuanhan Liu, Pablo de Lara, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 2aca8654b0a35536078c5cb34bd3e2ceea2d3748 Mon Sep 17 00:00:00 2001
From: Yoni Gilad <yonig@radcom.com>
Date: Tue, 10 Jan 2017 17:14:21 +0000
Subject: [PATCH] usertools: fix active interface detection when binding

[ backported from upstream commit 617d90527f8a72e9a1a258f2e6885b46ffb6fa46 ]

When adding crypto devices, the "Active" and "Ssh_if" attributes of
existing network devices were reset. This causes the following issues:

- Network interfaces aren't marked as "*Active*" in the --status output.
- Active network interfaces can be unbound without the --force option,
  causing loss of network connection.

The reset was caused by the call to devices[d].update in
get_crypto_details.

This patch prevents the update on non-crypto devices.

Fixes: cb4a1d14bf3e ("tools: bind crypto devices")

Signed-off-by: Yoni Gilad <yonig@radcom.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 tools/dpdk-devbind.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/dpdk-devbind.py b/tools/dpdk-devbind.py
index f1d374d..fef59c4 100755
--- a/tools/dpdk-devbind.py
+++ b/tools/dpdk-devbind.py
@@ -328,6 +328,9 @@ def get_crypto_details():
 
     # based on the basic info, get extended text details
     for d in devices.keys():
+        if devices[d]["Class"][0:2] != CRYPTO_BASE_CLASS:
+            continue
+
         # get additional info and add it to existing data
         devices[d] = devices[d].copy()
         devices[d].update(get_pci_device_details(d).items())
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/vhost: fix unix socket not removed as closing' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (36 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'usertools: fix active interface detection when binding' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  2017-02-15  7:22   ` Tan, Jianfeng
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbevf: fix max packet length' " Yuanhan Liu
  38 siblings, 1 reply; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Jianfeng Tan; +Cc: Yuanhan Liu, Lei Yao, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 67c33ab2c2798925c8e96f29434011d9a8ea25bc Mon Sep 17 00:00:00 2001
From: Jianfeng Tan <jianfeng.tan@intel.com>
Date: Tue, 24 Jan 2017 08:37:38 +0000
Subject: [PATCH] net/vhost: fix unix socket not removed as closing

[ upstream commit 954820dc7d9eeef76274adcc55d5b9ca4f425ec2 ]

The commit aed0b12930b3 ("net/vhost: fix socket file deleted on stop")
moves rte_vhost_driver_register and rte_vhost_driver_unregister from
dev_start() and dev_stop() into driver's probe() and remove().

Apps, like testpmd, using vhost pmd in server mode, usually calls
dev_stop() and dev_close() as quitting, instead of driver-specific
remove(). Then those unix socket files have no chance to get removed.

Semantically, device-specific things should be put into device-specific
APIs. Fix this issue by moving rte_vhost_driver_unregister, plus other
structure free into dev_close().

Fixes: aed0b12930b3 ("net/vhost: fix socket file deleted on stop")

Reported-by: Lei Yao <lei.a.yao@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 48 +++++++++++++++++++++++----------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index e715c31..328dde0 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -783,6 +783,32 @@ eth_dev_stop(struct rte_eth_dev *dev __rte_unused)
 {
 }
 
+static void
+eth_dev_close(struct rte_eth_dev *dev)
+{
+	struct pmd_internal *internal;
+	struct internal_list *list;
+
+	internal = dev->data->dev_private;
+	if (!internal)
+		return;
+
+	rte_vhost_driver_unregister(internal->iface_name);
+
+	list = find_internal_resource(internal->iface_name);
+	if (!list)
+		return;
+
+	pthread_mutex_lock(&internal_list_lock);
+	TAILQ_REMOVE(&internal_list, list, next);
+	pthread_mutex_unlock(&internal_list_lock);
+	rte_free(list);
+
+	free(internal->dev_name);
+	free(internal->iface_name);
+	rte_free(internal);
+}
+
 static int
 eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 		   uint16_t nb_rx_desc __rte_unused,
@@ -951,6 +977,7 @@ rte_eth_vhost_feature_get(void)
 static const struct eth_dev_ops ops = {
 	.dev_start = eth_dev_start,
 	.dev_stop = eth_dev_stop,
+	.dev_close = eth_dev_close,
 	.dev_configure = eth_dev_configure,
 	.dev_infos_get = eth_dev_info,
 	.rx_queue_setup = eth_rx_queue_setup,
@@ -1178,8 +1205,6 @@ static int
 rte_pmd_vhost_remove(const char *name)
 {
 	struct rte_eth_dev *eth_dev = NULL;
-	struct pmd_internal *internal;
-	struct internal_list *list;
 	unsigned int i;
 
 	RTE_LOG(INFO, PMD, "Un-Initializing pmd_vhost for %s\n", name);
@@ -1189,22 +1214,9 @@ rte_pmd_vhost_remove(const char *name)
 	if (eth_dev == NULL)
 		return -ENODEV;
 
-	internal = eth_dev->data->dev_private;
-	if (internal == NULL)
-		return -ENODEV;
-
-	list = find_internal_resource(internal->iface_name);
-	if (list == NULL)
-		return -ENODEV;
-
-	pthread_mutex_lock(&internal_list_lock);
-	TAILQ_REMOVE(&internal_list, list, next);
-	pthread_mutex_unlock(&internal_list_lock);
-	rte_free(list);
-
 	eth_dev_stop(eth_dev);
 
-	rte_vhost_driver_unregister(internal->iface_name);
+	eth_dev_close(eth_dev);
 
 	if (rte_atomic16_sub_return(&nb_started_ports, 1) == 0)
 		vhost_driver_session_stop();
@@ -1212,9 +1224,6 @@ rte_pmd_vhost_remove(const char *name)
 	rte_free(vring_states[eth_dev->data->port_id]);
 	vring_states[eth_dev->data->port_id] = NULL;
 
-	free(internal->dev_name);
-	free(internal->iface_name);
-
 	for (i = 0; i < eth_dev->data->nb_rx_queues; i++)
 		rte_free(eth_dev->data->rx_queues[i]);
 	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
@@ -1222,7 +1231,6 @@ rte_pmd_vhost_remove(const char *name)
 
 	rte_free(eth_dev->data->mac_addrs);
 	rte_free(eth_dev->data);
-	rte_free(internal);
 
 	rte_eth_dev_release_port(eth_dev);
 
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [dpdk-stable] patch 'net/ixgbevf: fix max packet length' has been queued to stable release 16.11.1
  2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
                   ` (37 preceding siblings ...)
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/vhost: fix unix socket not removed as closing' " Yuanhan Liu
@ 2017-02-15  6:26 ` Yuanhan Liu
  38 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  6:26 UTC (permalink / raw)
  To: Yi Zhang; +Cc: Yuanhan Liu, Wei Dai, dpdk stable

Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 02/18/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 974790fcd1f71f5bb7b5bfbdd077d9312ec394ab Mon Sep 17 00:00:00 2001
From: Yi Zhang <zhang.yi75@zte.com.cn>
Date: Thu, 15 Dec 2016 02:50:19 +0800
Subject: [PATCH] net/ixgbevf: fix max packet length

[ upstream commit 3556f251833bd273b2ebd55380324298f672c00c ]

Current ixgbevf driver get max_rx_pktlen = 15872, but in fact PF
supports 15872-byte jumbo frame and VF only supports 9728-byte jumbo
frame. If VF is running DPDK driver and set frame_size > 9728 ,PF
running kernel ixgbe driver will report an error and set VF failed.
This patch fixs DPDK ixgbevf driver to get correct jumbo frame size
of VF.

More datasheet references from Wei Dai:

In 82599 datasheet, there is an annotation in the chapter 1.3 Features
Summary (page 29)
 The 82599 supports full-size 15.5 KB (15872-byte) jumbo packets while
 in a basic mode of operation. When DCB mode is enabled,
 or security engines enabled or virtualization is enabled, the 82599
 supports 9.5 KB (9728-byte) jumbo packets.

In x540 datasheet, there is also an annotation in the chapter 1.3
Features Summary (page 13)
 The X540 and 82599 support full-size 15.5 KB jumbo packets while in a
 basic mode of operation. When DCB mode is enabled,
 or security engines enabled, or virtualization is enabled, or OS2BMC is
 enabled, then the X540 supports 9.5 KB jumbo packets.
 Packets to/from MC longer than 2KB are filtered out.

In x550 datasheet, there is still also an annotation in the chapter 1.4
Feature Summary (page 23)
 All the products support full-size 15.5 KB jumbo packets while in a
 basic mode of operation. When DCB mode is enabled, or security
 engines enabled, or virtualization is enabled, or OS2BMC is enabled,
 then only 9.5 KB jumbo packets are supported. Packets to/
 from the MC longer than 2 KB are filtered out.

Fixes: 2144f6630fca ("ixgbe: add redirection table size in device info")

Signed-off-by: Yi Zhang <zhang.yi75@zte.com.cn>
Acked-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fe98b96..dbfb0c0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3171,7 +3171,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
 	dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
 	dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues;
 	dev_info->min_rx_bufsize = 1024; /* cf BSIZEPACKET in SRRCTL reg */
-	dev_info->max_rx_pktlen = 15872; /* includes CRC, cf MAXFRS reg */
+	dev_info->max_rx_pktlen = 9728; /* includes CRC, cf MAXFRS reg */
 	dev_info->max_mac_addrs = hw->mac.num_rar_entries;
 	dev_info->max_hash_mac_addrs = IXGBE_VMDQ_NUM_UC_MAC;
 	dev_info->max_vfs = dev->pci_dev->max_vfs;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [dpdk-stable] patch 'net/vhost: fix unix socket not removed as closing' has been queued to stable release 16.11.1
  2017-02-15  6:26 ` [dpdk-stable] patch 'net/vhost: fix unix socket not removed as closing' " Yuanhan Liu
@ 2017-02-15  7:22   ` Tan, Jianfeng
  2017-02-15  7:28     ` Yuanhan Liu
  0 siblings, 1 reply; 45+ messages in thread
From: Tan, Jianfeng @ 2017-02-15  7:22 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Yao, Lei A, dpdk stable

Will below commit be back ported?
aed0b12930b3 ("net/vhost: fix socket file deleted on stop")

If yes, I agree.

Thanks,
Jianfeng

> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Wednesday, February 15, 2017 2:27 PM
> To: Tan, Jianfeng
> Cc: Yuanhan Liu; Yao, Lei A; dpdk stable
> Subject: patch 'net/vhost: fix unix socket not removed as closing' has been
> queued to stable release 16.11.1
> 
> Hi,
> 
> FYI, your patch has been queued to stable release 16.11.1
> 
> Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
> yet. It will be pushed if I get no objections before 02/18/17.
> So please shout if anyone has objections.
> 
> Thanks.
> 
> 	--yliu
> 
> ---
> From 67c33ab2c2798925c8e96f29434011d9a8ea25bc Mon Sep 17 00:00:00
> 2001
> From: Jianfeng Tan <jianfeng.tan@intel.com>
> Date: Tue, 24 Jan 2017 08:37:38 +0000
> Subject: [PATCH] net/vhost: fix unix socket not removed as closing
> 
> [ upstream commit 954820dc7d9eeef76274adcc55d5b9ca4f425ec2 ]
> 
> The commit aed0b12930b3 ("net/vhost: fix socket file deleted on stop")
> moves rte_vhost_driver_register and rte_vhost_driver_unregister from
> dev_start() and dev_stop() into driver's probe() and remove().
> 
> Apps, like testpmd, using vhost pmd in server mode, usually calls
> dev_stop() and dev_close() as quitting, instead of driver-specific
> remove(). Then those unix socket files have no chance to get removed.
> 
> Semantically, device-specific things should be put into device-specific
> APIs. Fix this issue by moving rte_vhost_driver_unregister, plus other
> structure free into dev_close().
> 
> Fixes: aed0b12930b3 ("net/vhost: fix socket file deleted on stop")
> 
> Reported-by: Lei Yao <lei.a.yao@intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 48 +++++++++++++++++++++++-------
> ---------
>  1 file changed, 28 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c
> b/drivers/net/vhost/rte_eth_vhost.c
> index e715c31..328dde0 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -783,6 +783,32 @@ eth_dev_stop(struct rte_eth_dev *dev
> __rte_unused)
>  {
>  }
> 
> +static void
> +eth_dev_close(struct rte_eth_dev *dev)
> +{
> +	struct pmd_internal *internal;
> +	struct internal_list *list;
> +
> +	internal = dev->data->dev_private;
> +	if (!internal)
> +		return;
> +
> +	rte_vhost_driver_unregister(internal->iface_name);
> +
> +	list = find_internal_resource(internal->iface_name);
> +	if (!list)
> +		return;
> +
> +	pthread_mutex_lock(&internal_list_lock);
> +	TAILQ_REMOVE(&internal_list, list, next);
> +	pthread_mutex_unlock(&internal_list_lock);
> +	rte_free(list);
> +
> +	free(internal->dev_name);
> +	free(internal->iface_name);
> +	rte_free(internal);
> +}
> +
>  static int
>  eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
>  		   uint16_t nb_rx_desc __rte_unused,
> @@ -951,6 +977,7 @@ rte_eth_vhost_feature_get(void)
>  static const struct eth_dev_ops ops = {
>  	.dev_start = eth_dev_start,
>  	.dev_stop = eth_dev_stop,
> +	.dev_close = eth_dev_close,
>  	.dev_configure = eth_dev_configure,
>  	.dev_infos_get = eth_dev_info,
>  	.rx_queue_setup = eth_rx_queue_setup,
> @@ -1178,8 +1205,6 @@ static int
>  rte_pmd_vhost_remove(const char *name)
>  {
>  	struct rte_eth_dev *eth_dev = NULL;
> -	struct pmd_internal *internal;
> -	struct internal_list *list;
>  	unsigned int i;
> 
>  	RTE_LOG(INFO, PMD, "Un-Initializing pmd_vhost for %s\n", name);
> @@ -1189,22 +1214,9 @@ rte_pmd_vhost_remove(const char *name)
>  	if (eth_dev == NULL)
>  		return -ENODEV;
> 
> -	internal = eth_dev->data->dev_private;
> -	if (internal == NULL)
> -		return -ENODEV;
> -
> -	list = find_internal_resource(internal->iface_name);
> -	if (list == NULL)
> -		return -ENODEV;
> -
> -	pthread_mutex_lock(&internal_list_lock);
> -	TAILQ_REMOVE(&internal_list, list, next);
> -	pthread_mutex_unlock(&internal_list_lock);
> -	rte_free(list);
> -
>  	eth_dev_stop(eth_dev);
> 
> -	rte_vhost_driver_unregister(internal->iface_name);
> +	eth_dev_close(eth_dev);
> 
>  	if (rte_atomic16_sub_return(&nb_started_ports, 1) == 0)
>  		vhost_driver_session_stop();
> @@ -1212,9 +1224,6 @@ rte_pmd_vhost_remove(const char *name)
>  	rte_free(vring_states[eth_dev->data->port_id]);
>  	vring_states[eth_dev->data->port_id] = NULL;
> 
> -	free(internal->dev_name);
> -	free(internal->iface_name);
> -
>  	for (i = 0; i < eth_dev->data->nb_rx_queues; i++)
>  		rte_free(eth_dev->data->rx_queues[i]);
>  	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
> @@ -1222,7 +1231,6 @@ rte_pmd_vhost_remove(const char *name)
> 
>  	rte_free(eth_dev->data->mac_addrs);
>  	rte_free(eth_dev->data);
> -	rte_free(internal);
> 
>  	rte_eth_dev_release_port(eth_dev);
> 
> --
> 1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [dpdk-stable] patch 'net/vhost: fix unix socket not removed as closing' has been queued to stable release 16.11.1
  2017-02-15  7:22   ` Tan, Jianfeng
@ 2017-02-15  7:28     ` Yuanhan Liu
  0 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-15  7:28 UTC (permalink / raw)
  To: Tan, Jianfeng; +Cc: Yao, Lei A, dpdk stable

On Wed, Feb 15, 2017 at 07:22:27AM +0000, Tan, Jianfeng wrote:
> Will below commit be back ported?
> aed0b12930b3 ("net/vhost: fix socket file deleted on stop")

It was already on the 16.11 branch in the last pick stage.

	--yliu
> 
> If yes, I agree.
> 
> Thanks,
> Jianfeng
> 
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> > Sent: Wednesday, February 15, 2017 2:27 PM
> > To: Tan, Jianfeng
> > Cc: Yuanhan Liu; Yao, Lei A; dpdk stable
> > Subject: patch 'net/vhost: fix unix socket not removed as closing' has been
> > queued to stable release 16.11.1
> > 
> > Hi,
> > 
> > FYI, your patch has been queued to stable release 16.11.1
> > 
> > Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
> > yet. It will be pushed if I get no objections before 02/18/17.
> > So please shout if anyone has objections.
> > 
> > Thanks.
> > 
> > 	--yliu
> > 
> > ---
> > From 67c33ab2c2798925c8e96f29434011d9a8ea25bc Mon Sep 17 00:00:00
> > 2001
> > From: Jianfeng Tan <jianfeng.tan@intel.com>
> > Date: Tue, 24 Jan 2017 08:37:38 +0000
> > Subject: [PATCH] net/vhost: fix unix socket not removed as closing
> > 
> > [ upstream commit 954820dc7d9eeef76274adcc55d5b9ca4f425ec2 ]
> > 
> > The commit aed0b12930b3 ("net/vhost: fix socket file deleted on stop")
> > moves rte_vhost_driver_register and rte_vhost_driver_unregister from
> > dev_start() and dev_stop() into driver's probe() and remove().
> > 
> > Apps, like testpmd, using vhost pmd in server mode, usually calls
> > dev_stop() and dev_close() as quitting, instead of driver-specific
> > remove(). Then those unix socket files have no chance to get removed.
> > 
> > Semantically, device-specific things should be put into device-specific
> > APIs. Fix this issue by moving rte_vhost_driver_unregister, plus other
> > structure free into dev_close().
> > 
> > Fixes: aed0b12930b3 ("net/vhost: fix socket file deleted on stop")
> > 
> > Reported-by: Lei Yao <lei.a.yao@intel.com>
> > Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> > Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> > ---
> >  drivers/net/vhost/rte_eth_vhost.c | 48 +++++++++++++++++++++++-------
> > ---------
> >  1 file changed, 28 insertions(+), 20 deletions(-)
> > 
> > diff --git a/drivers/net/vhost/rte_eth_vhost.c
> > b/drivers/net/vhost/rte_eth_vhost.c
> > index e715c31..328dde0 100644
> > --- a/drivers/net/vhost/rte_eth_vhost.c
> > +++ b/drivers/net/vhost/rte_eth_vhost.c
> > @@ -783,6 +783,32 @@ eth_dev_stop(struct rte_eth_dev *dev
> > __rte_unused)
> >  {
> >  }
> > 
> > +static void
> > +eth_dev_close(struct rte_eth_dev *dev)
> > +{
> > +	struct pmd_internal *internal;
> > +	struct internal_list *list;
> > +
> > +	internal = dev->data->dev_private;
> > +	if (!internal)
> > +		return;
> > +
> > +	rte_vhost_driver_unregister(internal->iface_name);
> > +
> > +	list = find_internal_resource(internal->iface_name);
> > +	if (!list)
> > +		return;
> > +
> > +	pthread_mutex_lock(&internal_list_lock);
> > +	TAILQ_REMOVE(&internal_list, list, next);
> > +	pthread_mutex_unlock(&internal_list_lock);
> > +	rte_free(list);
> > +
> > +	free(internal->dev_name);
> > +	free(internal->iface_name);
> > +	rte_free(internal);
> > +}
> > +
> >  static int
> >  eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
> >  		   uint16_t nb_rx_desc __rte_unused,
> > @@ -951,6 +977,7 @@ rte_eth_vhost_feature_get(void)
> >  static const struct eth_dev_ops ops = {
> >  	.dev_start = eth_dev_start,
> >  	.dev_stop = eth_dev_stop,
> > +	.dev_close = eth_dev_close,
> >  	.dev_configure = eth_dev_configure,
> >  	.dev_infos_get = eth_dev_info,
> >  	.rx_queue_setup = eth_rx_queue_setup,
> > @@ -1178,8 +1205,6 @@ static int
> >  rte_pmd_vhost_remove(const char *name)
> >  {
> >  	struct rte_eth_dev *eth_dev = NULL;
> > -	struct pmd_internal *internal;
> > -	struct internal_list *list;
> >  	unsigned int i;
> > 
> >  	RTE_LOG(INFO, PMD, "Un-Initializing pmd_vhost for %s\n", name);
> > @@ -1189,22 +1214,9 @@ rte_pmd_vhost_remove(const char *name)
> >  	if (eth_dev == NULL)
> >  		return -ENODEV;
> > 
> > -	internal = eth_dev->data->dev_private;
> > -	if (internal == NULL)
> > -		return -ENODEV;
> > -
> > -	list = find_internal_resource(internal->iface_name);
> > -	if (list == NULL)
> > -		return -ENODEV;
> > -
> > -	pthread_mutex_lock(&internal_list_lock);
> > -	TAILQ_REMOVE(&internal_list, list, next);
> > -	pthread_mutex_unlock(&internal_list_lock);
> > -	rte_free(list);
> > -
> >  	eth_dev_stop(eth_dev);
> > 
> > -	rte_vhost_driver_unregister(internal->iface_name);
> > +	eth_dev_close(eth_dev);
> > 
> >  	if (rte_atomic16_sub_return(&nb_started_ports, 1) == 0)
> >  		vhost_driver_session_stop();
> > @@ -1212,9 +1224,6 @@ rte_pmd_vhost_remove(const char *name)
> >  	rte_free(vring_states[eth_dev->data->port_id]);
> >  	vring_states[eth_dev->data->port_id] = NULL;
> > 
> > -	free(internal->dev_name);
> > -	free(internal->iface_name);
> > -
> >  	for (i = 0; i < eth_dev->data->nb_rx_queues; i++)
> >  		rte_free(eth_dev->data->rx_queues[i]);
> >  	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
> > @@ -1222,7 +1231,6 @@ rte_pmd_vhost_remove(const char *name)
> > 
> >  	rte_free(eth_dev->data->mac_addrs);
> >  	rte_free(eth_dev->data);
> > -	rte_free(internal);
> > 
> >  	rte_eth_dev_release_port(eth_dev);
> > 
> > --
> > 1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding' has been queued to stable release 16.11.1
  2017-02-15  6:26 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding' " Yuanhan Liu
@ 2017-02-16  8:01   ` Yuanhan Liu
  2017-02-16  9:10     ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-16  8:01 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: Fan Zhang, dpdk stable

It introduced a build error. I will drop it. If you think this patch
is still needed, please do the backport.

    examples/l2fwd-crypto/main.c: In function ‘l2fwd_simple_crypto_enqueue’:
    examples/l2fwd-crypto/main.c:467:8: error: ‘RTE_CRYPTO_CIPHER_DES_CBC’ undeclared (first use in this function)
       case RTE_CRYPTO_CIPHER_DES_CBC:
                ^
    compilation terminated due to -Wfatal-errors.

Thanks!

	--yliu

On Wed, Feb 15, 2017 at 02:26:40PM +0800, Yuanhan Liu wrote:
> Hi,
> 
> FYI, your patch has been queued to stable release 16.11.1
> 
> Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
> yet. It will be pushed if I get no objections before 02/18/17.
> So please shout if anyone has objections.
> 
> Thanks.
> 
> 	--yliu
> 
> ---
> >From b672755e7af6f234c40e761335ebee2a2d78d1d2 Mon Sep 17 00:00:00 2001
> From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Date: Thu, 9 Feb 2017 12:27:45 +0000
> Subject: [PATCH] examples/l2fwd-crypto: fix padding
> 
> [ upstream commit 5839fd20e7323850f3a411d9b5642d914fa2d3f0 ]
> 
> L2fwd-crypto app was padding an incoming buffer,
> to be aligned with the algorithm block size, in all cases.
> This was not the right approach, as padding is only necessary
> when using block cipher algorithms, such as AES-CBC.
> In case of using a stream cipher algorithm, such as SNOW3G UEA2,
> there is no need to include padding and increase the buffer size.
> 
> Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  examples/l2fwd-crypto/main.c | 36 +++++++++++++++++++++++++++---------
>  1 file changed, 27 insertions(+), 9 deletions(-)
> 
> diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
> index bc88be5..62ee933 100644
> --- a/examples/l2fwd-crypto/main.c
> +++ b/examples/l2fwd-crypto/main.c
> @@ -432,7 +432,8 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
>  	struct ether_hdr *eth_hdr;
>  	struct ipv4_hdr *ip_hdr;
>  
> -	unsigned ipdata_offset, pad_len, data_len;
> +	uint32_t ipdata_offset, data_len;
> +	uint32_t pad_len = 0;
>  	char *padding;
>  
>  	eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
> @@ -455,16 +456,33 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
>  	if (cparams->do_hash && cparams->hash_verify)
>  		data_len -= cparams->digest_length;
>  
> -	pad_len = data_len % cparams->block_size ? cparams->block_size -
> -			(data_len % cparams->block_size) : 0;
> +	if (cparams->do_cipher) {
> +		/*
> +		 * Following algorithms are block cipher algorithms,
> +		 * and might need padding
> +		 */
> +		switch (cparams->cipher_algo) {
> +		case RTE_CRYPTO_CIPHER_AES_CBC:
> +		case RTE_CRYPTO_CIPHER_AES_ECB:
> +		case RTE_CRYPTO_CIPHER_DES_CBC:
> +		case RTE_CRYPTO_CIPHER_3DES_CBC:
> +		case RTE_CRYPTO_CIPHER_3DES_ECB:
> +			if (data_len % cparams->block_size)
> +				pad_len = cparams->block_size -
> +					(data_len % cparams->block_size);
> +			break;
> +		default:
> +			pad_len = 0;
> +		}
>  
> -	if (pad_len) {
> -		padding = rte_pktmbuf_append(m, pad_len);
> -		if (unlikely(!padding))
> -			return -1;
> +		if (pad_len) {
> +			padding = rte_pktmbuf_append(m, pad_len);
> +			if (unlikely(!padding))
> +				return -1;
>  
> -		data_len += pad_len;
> -		memset(padding, 0, pad_len);
> +			data_len += pad_len;
> +			memset(padding, 0, pad_len);
> +		}
>  	}
>  
>  	/* Set crypto operation data parameters */
> -- 
> 1.9.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding' has been queued to stable release 16.11.1
  2017-02-16  8:01   ` Yuanhan Liu
@ 2017-02-16  9:10     ` De Lara Guarch, Pablo
  2017-02-17  7:44       ` Yuanhan Liu
  0 siblings, 1 reply; 45+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-16  9:10 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Zhang, Roy Fan, dpdk stable

Hi Yuanhan,


> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Thursday, February 16, 2017 8:02 AM
> To: De Lara Guarch, Pablo
> Cc: Zhang, Roy Fan; dpdk stable
> Subject: Re: patch 'examples/l2fwd-crypto: fix padding' has been queued to
> stable release 16.11.1
> 
> It introduced a build error. I will drop it. If you think this patch
> is still needed, please do the backport.
> 
>     examples/l2fwd-crypto/main.c: In function
> ‘l2fwd_simple_crypto_enqueue’:
>     examples/l2fwd-crypto/main.c:467:8: error:
> ‘RTE_CRYPTO_CIPHER_DES_CBC’ undeclared (first use in this function)
>        case RTE_CRYPTO_CIPHER_DES_CBC:
>                 ^
>     compilation terminated due to -Wfatal-errors.

This is why I didn't push it to the stable branch.
I thought that fixes to sample apps were not needed.
DES-CBC was introduced in 17.02, that's why there is a compilation issue.

So, if this kind of fix can be pushed to the stable branch,
I will do the backport (all that is required is removing that line).

Thanks,
Pablo

> 
> Thanks!
> 
> 	--yliu
> 
> On Wed, Feb 15, 2017 at 02:26:40PM +0800, Yuanhan Liu wrote:
> > Hi,
> >
> > FYI, your patch has been queued to stable release 16.11.1
> >
> > Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
> > yet. It will be pushed if I get no objections before 02/18/17.
> > So please shout if anyone has objections.
> >
> > Thanks.
> >
> > 	--yliu
> >
> > ---


^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding' has been queued to stable release 16.11.1
  2017-02-16  9:10     ` De Lara Guarch, Pablo
@ 2017-02-17  7:44       ` Yuanhan Liu
  0 siblings, 0 replies; 45+ messages in thread
From: Yuanhan Liu @ 2017-02-17  7:44 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: Zhang, Roy Fan, dpdk stable, Thomas Monjalon

On Thu, Feb 16, 2017 at 09:10:16AM +0000, De Lara Guarch, Pablo wrote:
> Hi Yuanhan,
> 
> 
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> > Sent: Thursday, February 16, 2017 8:02 AM
> > To: De Lara Guarch, Pablo
> > Cc: Zhang, Roy Fan; dpdk stable
> > Subject: Re: patch 'examples/l2fwd-crypto: fix padding' has been queued to
> > stable release 16.11.1
> > 
> > It introduced a build error. I will drop it. If you think this patch
> > is still needed, please do the backport.
> > 
> >     examples/l2fwd-crypto/main.c: In function
> > ‘l2fwd_simple_crypto_enqueue’:
> >     examples/l2fwd-crypto/main.c:467:8: error:
> > ‘RTE_CRYPTO_CIPHER_DES_CBC’ undeclared (first use in this function)
> >        case RTE_CRYPTO_CIPHER_DES_CBC:
> >                 ^
> >     compilation terminated due to -Wfatal-errors.
> 
> This is why I didn't push it to the stable branch.

I see.

> I thought that fixes to sample apps were not needed.

I and Thomas had a such converstion before, and seems we both agree
that it's necessary to backport fixes for samples, for the reason
the user may still try with them.

> DES-CBC was introduced in 17.02, that's why there is a compilation issue.
> 
> So, if this kind of fix can be pushed to the stable branch,
> I will do the backport (all that is required is removing that line).

If you, as the crypto maintainer, think it's needed, then I think you
could go for the backport :)

	--yliu

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2017-02-17  7:41 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15  6:26 [dpdk-stable] patch 'devargs: reset driver name pointer on parsing failure' has been queued to stable release 16.11.1 Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: fix dead loop in enqueue path' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: fix long stall of negotiation' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: do not GSO when no header is present' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix performance regression due to TSO' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: optimize header reset on any layout' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix Rx checksum flag' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/mlx5: fix memory leak when parsing device params' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/qede/base: fix FreeBSD build' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix deletion of all macvlan filters' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/bnx2x: fix Rx mode configuration' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/cxgbe/base: initialize variable before reading EEPROM' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix checksum flag in x86 vector Rx' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix crash in close' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'vfio: fix file descriptor leak in multi-process' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'sched: fix crash when freeing port' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/enic: fix memory leak with oversized Tx packets' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/ena: fix setting host attributes' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix ethertype filter on X722' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40evf: fix reporting of imissed packets' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix link update delay' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/enic: fix hardcoding of some flow director masks' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbe: fix received packets number for ARM' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbe: fix received packets number for ARM NEON' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/i40e: fix TC bandwidth definition' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'drivers/crypto: fix different auth/cipher keys' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix overflow' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding' " Yuanhan Liu
2017-02-16  8:01   ` Yuanhan Liu
2017-02-16  9:10     ` De Lara Guarch, Pablo
2017-02-17  7:44       ` Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'vhost: allow many vhost-user ports' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'mempool: fix stack handler dequeue' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'ethdev: fix port data mismatched in multiple process model' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix wrong Rx/Tx method for secondary process' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: store PCI operators pointer locally' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: store IO port info " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix multiple process support' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix build without virtio-user' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/virtio: fix crash when number of virtio devices > 1' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'usertools: fix active interface detection when binding' " Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/vhost: fix unix socket not removed as closing' " Yuanhan Liu
2017-02-15  7:22   ` Tan, Jianfeng
2017-02-15  7:28     ` Yuanhan Liu
2017-02-15  6:26 ` [dpdk-stable] patch 'net/ixgbevf: fix max packet length' " Yuanhan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).