DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently
@ 2018-03-29 16:05 Chas Williams
  2018-03-29 16:05 ` [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software Chas Williams
  2018-04-11 14:46 ` [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently Maxime Coquelin
  0 siblings, 2 replies; 7+ messages in thread
From: Chas Williams @ 2018-03-29 16:05 UTC (permalink / raw)
  To: dev
  Cc: mtetsuyah, yliu, maxime.coquelin, Robert Shearman, stable, Chas Williams

From: Robert Shearman <robert.shearman@att.com>

The vid and port of the vq were only set on queues created during initial
device setup.

Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
Cc: stable@dpdk.org

Signed-off-by: Robert Shearman <robert.shearman@att.com>
Signed-off-by: Chas Williams <chas3@att.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 3aae01c39..453d9bee1 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -118,6 +118,7 @@ struct pmd_internal {
 	char *iface_name;
 	uint16_t max_queues;
 	rte_atomic32_t started;
+	int vid;
 };
 
 struct internal_list {
@@ -573,6 +574,7 @@ new_device(int vid)
 
 	eth_dev = list->eth_dev;
 	internal = eth_dev->data->dev_private;
+	internal->vid = vid;
 
 #ifdef RTE_LIBRTE_VHOST_NUMA
 	newnode = rte_vhost_get_numa_node(vid);
@@ -633,6 +635,7 @@ destroy_device(int vid)
 	}
 	eth_dev = list->eth_dev;
 	internal = eth_dev->data->dev_private;
+	internal->vid = -1;
 
 	rte_atomic32_set(&internal->dev_attached, 0);
 	update_queuing_status(eth_dev);
@@ -834,6 +837,9 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 		   struct rte_mempool *mb_pool)
 {
 	struct vhost_queue *vq;
+	struct pmd_internal *internal;
+
+	internal = dev->data->dev_private;
 
 	vq = rte_zmalloc_socket(NULL, sizeof(struct vhost_queue),
 			RTE_CACHE_LINE_SIZE, socket_id);
@@ -844,6 +850,9 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 
 	vq->mb_pool = mb_pool;
 	vq->virtqueue_id = rx_queue_id * VIRTIO_QNUM + VIRTIO_TXQ;
+	vq->internal = internal;
+	vq->vid = internal->vid;
+	vq->port = dev->data->port_id;
 	dev->data->rx_queues[rx_queue_id] = vq;
 
 	return 0;
@@ -856,6 +865,9 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 		   const struct rte_eth_txconf *tx_conf __rte_unused)
 {
 	struct vhost_queue *vq;
+	struct pmd_internal *internal;
+
+	internal = dev->data->dev_private;
 
 	vq = rte_zmalloc_socket(NULL, sizeof(struct vhost_queue),
 			RTE_CACHE_LINE_SIZE, socket_id);
@@ -865,6 +877,9 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 	}
 
 	vq->virtqueue_id = tx_queue_id * VIRTIO_QNUM + VIRTIO_RXQ;
+	vq->internal = internal;
+	vq->vid = internal->vid;
+	vq->port = dev->data->port_id;
 	dev->data->tx_queues[tx_queue_id] = vq;
 
 	return 0;
-- 
2.13.6

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

* [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software
  2018-03-29 16:05 [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently Chas Williams
@ 2018-03-29 16:05 ` Chas Williams
  2018-04-11 14:52   ` Maxime Coquelin
                     ` (2 more replies)
  2018-04-11 14:46 ` [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently Maxime Coquelin
  1 sibling, 3 replies; 7+ messages in thread
From: Chas Williams @ 2018-03-29 16:05 UTC (permalink / raw)
  To: dev; +Cc: mtetsuyah, yliu, maxime.coquelin, Jan Blunck

From: Jan Blunck <jblunck@infradead.org>

This lets the vhost driver handle the VLAN header like the virtio driver
in software.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
 drivers/net/vhost/rte_eth_vhost.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 453d9bee1..0beb28e94 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -119,6 +119,7 @@ struct pmd_internal {
 	uint16_t max_queues;
 	rte_atomic32_t started;
 	int vid;
+	uint8_t vlan_strip;
 };
 
 struct internal_list {
@@ -422,6 +423,12 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 
 	for (i = 0; likely(i < nb_rx); i++) {
 		bufs[i]->port = r->port;
+		bufs[i]->ol_flags = 0;
+		bufs[i]->vlan_tci = 0;
+
+		if (r->internal->vlan_strip)
+			rte_vlan_strip(bufs[i]);
+
 		r->stats.bytes += bufs[i]->pkt_len;
 	}
 
@@ -438,7 +445,7 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 {
 	struct vhost_queue *r = q;
 	uint16_t i, nb_tx = 0;
-	uint16_t nb_send = nb_bufs;
+	uint16_t nb_send = 0;
 
 	if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
 		return 0;
@@ -448,6 +455,22 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 	if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
 		goto out;
 
+	for (i = 0; i < nb_bufs; i++) {
+		struct rte_mbuf *m = bufs[i];
+
+		/* Do VLAN tag insertion */
+		if (m->ol_flags & PKT_TX_VLAN_PKT) {
+			int error = rte_vlan_insert(&m);
+			if (unlikely(error)) {
+				rte_pktmbuf_free(m);
+				continue;
+			}
+		}
+
+		bufs[nb_send] = m;
+		++nb_send;
+	}
+
 	/* Enqueue packets to guest RX queue */
 	while (nb_send) {
 		uint16_t nb_pkts;
@@ -489,6 +512,16 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 static int
 eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
 {
+	struct pmd_internal *internal = dev->data->dev_private;
+	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
+
+	internal->vlan_strip = rxmode->hw_vlan_strip;
+
+	if (rxmode->hw_vlan_filter)
+		RTE_LOG(WARNING, PMD,
+			"vhost(%s): vlan filtering not available\n",
+			internal->dev_name);
+
 	return 0;
 }
 
-- 
2.13.6

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

* Re: [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently
  2018-03-29 16:05 [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently Chas Williams
  2018-03-29 16:05 ` [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software Chas Williams
@ 2018-04-11 14:46 ` Maxime Coquelin
  2018-04-11 15:02   ` Maxime Coquelin
  1 sibling, 1 reply; 7+ messages in thread
From: Maxime Coquelin @ 2018-04-11 14:46 UTC (permalink / raw)
  To: Chas Williams, dev
  Cc: mtetsuyah, yliu, Robert Shearman, stable, Chas Williams



On 03/29/2018 06:05 PM, Chas Williams wrote:
> From: Robert Shearman <robert.shearman@att.com>
> 
> The vid and port of the vq were only set on queues created during initial
> device setup.
> 
> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Robert Shearman <robert.shearman@att.com>
> Signed-off-by: Chas Williams <chas3@att.com>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

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

* Re: [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software
  2018-03-29 16:05 ` [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software Chas Williams
@ 2018-04-11 14:52   ` Maxime Coquelin
  2018-04-12  7:14   ` Maxime Coquelin
  2018-05-08  1:31   ` Yao, Lei A
  2 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2018-04-11 14:52 UTC (permalink / raw)
  To: Chas Williams, dev; +Cc: mtetsuyah, yliu, Jan Blunck



On 03/29/2018 06:05 PM, Chas Williams wrote:
> From: Jan Blunck <jblunck@infradead.org>
> 
> This lets the vhost driver handle the VLAN header like the virtio driver
> in software.
> 
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 35 ++++++++++++++++++++++++++++++++++-
>   1 file changed, 34 insertions(+), 1 deletion(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks!
Maxime

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

* Re: [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently
  2018-04-11 14:46 ` [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently Maxime Coquelin
@ 2018-04-11 15:02   ` Maxime Coquelin
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2018-04-11 15:02 UTC (permalink / raw)
  To: Chas Williams, dev
  Cc: mtetsuyah, yliu, Robert Shearman, stable, Chas Williams



On 04/11/2018 04:46 PM, Maxime Coquelin wrote:
> 
> 
> On 03/29/2018 06:05 PM, Chas Williams wrote:
>> From: Robert Shearman <robert.shearman@att.com>
>>
>> The vid and port of the vq were only set on queues created during initial
>> device setup.
>>
>> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Robert Shearman <robert.shearman@att.com>
>> Signed-off-by: Chas Williams <chas3@att.com>
>> ---
>>   drivers/net/vhost/rte_eth_vhost.c | 15 +++++++++++++++
>>   1 file changed, 15 insertions(+)
>>
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

It does not apply because a patch from Junjie seems to address the same
problem:

net/vhost: fix crash when creating vdev dynamically

Can you check dpdk-next-virtio/master and confirm this patch is no more
required?

Thanks,
Maxime

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

* Re: [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software
  2018-03-29 16:05 ` [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software Chas Williams
  2018-04-11 14:52   ` Maxime Coquelin
@ 2018-04-12  7:14   ` Maxime Coquelin
  2018-05-08  1:31   ` Yao, Lei A
  2 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2018-04-12  7:14 UTC (permalink / raw)
  To: Chas Williams, dev; +Cc: mtetsuyah, yliu, Jan Blunck



On 03/29/2018 06:05 PM, Chas Williams wrote:
> From: Jan Blunck <jblunck@infradead.org>
> 
> This lets the vhost driver handle the VLAN header like the virtio driver
> in software.
> 
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 35 ++++++++++++++++++++++++++++++++++-
>   1 file changed, 34 insertions(+), 1 deletion(-)
Applied to dpdk-next-virtio/master.

Thanks!
Maxime

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

* Re: [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software
  2018-03-29 16:05 ` [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software Chas Williams
  2018-04-11 14:52   ` Maxime Coquelin
  2018-04-12  7:14   ` Maxime Coquelin
@ 2018-05-08  1:31   ` Yao, Lei A
  2 siblings, 0 replies; 7+ messages in thread
From: Yao, Lei A @ 2018-05-08  1:31 UTC (permalink / raw)
  To: Chas Williams, dev, Jan Blunck
  Cc: mtetsuyah, yliu, maxime.coquelin, Bie, Tiwei

Hi, Jan

For this patch, I find it will break the VM2VM Iperf test as it clear
the of_flags. "bufs[i]->ol_flags = 0;"
Could you have a check on this?

The test step to reproduce this issue:
1. Lauch testpmd with two vhost-user port, using IO fwd mode
testpmd -c 0xe -n 4 --socket-mem 1024,1024 \
--legacy-mem --vdev 'eth_vhost0,iface=vhost-net,queues=1'  \
--vdev 'eth_vhost1,iface=vhost-net1,queues=1' --nb-cores=1 \
--tx-offloads=0x802a
2. Lauch 2 vms with virtio deivce
3. In the 2 vms, up the virtio device and run Iperf test between VMs
The test result show that the Iperf traffic is broken but ping test can pass.



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Chas Williams
> Sent: Friday, March 30, 2018 12:05 AM
> To: dev@dpdk.org
> Cc: mtetsuyah@gmail.com; yliu@fridaylinux.org;
> maxime.coquelin@redhat.com; Jan Blunck <jblunck@infradead.org>
> Subject: [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in
> software
> 
> From: Jan Blunck <jblunck@infradead.org>
> 
> This lets the vhost driver handle the VLAN header like the virtio driver
> in software.
> 
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 35
> ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c
> b/drivers/net/vhost/rte_eth_vhost.c
> index 453d9bee1..0beb28e94 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -119,6 +119,7 @@ struct pmd_internal {
>  	uint16_t max_queues;
>  	rte_atomic32_t started;
>  	int vid;
> +	uint8_t vlan_strip;
>  };
> 
>  struct internal_list {
> @@ -422,6 +423,12 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs,
> uint16_t nb_bufs)
> 
>  	for (i = 0; likely(i < nb_rx); i++) {
>  		bufs[i]->port = r->port;
> +		bufs[i]->ol_flags = 0;
> +		bufs[i]->vlan_tci = 0;
> +
> +		if (r->internal->vlan_strip)
> +			rte_vlan_strip(bufs[i]);
> +
>  		r->stats.bytes += bufs[i]->pkt_len;
>  	}
> 
> @@ -438,7 +445,7 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs,
> uint16_t nb_bufs)
>  {
>  	struct vhost_queue *r = q;
>  	uint16_t i, nb_tx = 0;
> -	uint16_t nb_send = nb_bufs;
> +	uint16_t nb_send = 0;
> 
>  	if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
>  		return 0;
> @@ -448,6 +455,22 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs,
> uint16_t nb_bufs)
>  	if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
>  		goto out;
> 
> +	for (i = 0; i < nb_bufs; i++) {
> +		struct rte_mbuf *m = bufs[i];
> +
> +		/* Do VLAN tag insertion */
> +		if (m->ol_flags & PKT_TX_VLAN_PKT) {
> +			int error = rte_vlan_insert(&m);
> +			if (unlikely(error)) {
> +				rte_pktmbuf_free(m);
> +				continue;
> +			}
> +		}
> +
> +		bufs[nb_send] = m;
> +		++nb_send;
> +	}
> +
>  	/* Enqueue packets to guest RX queue */
>  	while (nb_send) {
>  		uint16_t nb_pkts;
> @@ -489,6 +512,16 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs,
> uint16_t nb_bufs)
>  static int
>  eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
>  {
> +	struct pmd_internal *internal = dev->data->dev_private;
> +	const struct rte_eth_rxmode *rxmode = &dev->data-
> >dev_conf.rxmode;
> +
> +	internal->vlan_strip = rxmode->hw_vlan_strip;
> +
> +	if (rxmode->hw_vlan_filter)
> +		RTE_LOG(WARNING, PMD,
> +			"vhost(%s): vlan filtering not available\n",
> +			internal->dev_name);
> +
>  	return 0;
>  }
> 
> --
> 2.13.6

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

end of thread, other threads:[~2018-05-08  1:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29 16:05 [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently Chas Williams
2018-03-29 16:05 ` [dpdk-dev] [PATCH 2/2] net/vhost: insert/strip VLAN header in software Chas Williams
2018-04-11 14:52   ` Maxime Coquelin
2018-04-12  7:14   ` Maxime Coquelin
2018-05-08  1:31   ` Yao, Lei A
2018-04-11 14:46 ` [dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently Maxime Coquelin
2018-04-11 15:02   ` Maxime Coquelin

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).