patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel
@ 2019-03-12  7:13 Tiwei Bie
  2019-03-12 12:53 ` Maxime Coquelin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tiwei Bie @ 2019-03-12  7:13 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev; +Cc: stephen, ferruh.yigit, stable

The multiqueue support in virtio-user with vhost kernel backend
is broken when tap name isn't specified by users explicitly,
because the tap name returned by ioctl(TUNSETIFF) isn't saved
properly, and multiple tap interfaces will be created in this
case. Fix this by saving the dynamically allocated tap name
first before reusing the ifr structure. Besides, also make it
possible to support the format string in tap name (e.g. foo%d)
specified by users explicitly.

Fixes: 791b43e08842 ("net/virtio-user: specify MAC of the tap")
Cc: stable@dpdk.org

Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
index a3faf1d0c..fbd9e979d 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -62,6 +62,7 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq,
 			 const char *mac, uint64_t features)
 {
 	unsigned int tap_features;
+	char *tap_name = NULL;
 	int sndbuf = INT_MAX;
 	struct ifreq ifr;
 	int tapfd;
@@ -112,6 +113,12 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq,
 		goto error;
 	}
 
+	tap_name = strdup(ifr.ifr_name);
+	if (!tap_name) {
+		PMD_DRV_LOG(ERR, "strdup ifname failed: %s", strerror(errno));
+		goto error;
+	}
+
 	fcntl(tapfd, F_SETFL, O_NONBLOCK);
 
 	if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) {
@@ -134,11 +141,12 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq,
 		goto error;
 	}
 
-	if (!(*p_ifname))
-		*p_ifname = strdup(ifr.ifr_name);
+	free(*p_ifname);
+	*p_ifname = tap_name;
 
 	return tapfd;
 error:
+	free(tap_name);
 	close(tapfd);
 	return -1;
 }
-- 
2.17.1

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

* Re: [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel
  2019-03-12  7:13 [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel Tiwei Bie
@ 2019-03-12 12:53 ` Maxime Coquelin
  2019-03-12 17:42 ` Stephen Hemminger
  2019-03-20  7:35 ` Maxime Coquelin
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2019-03-12 12:53 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev; +Cc: stephen, ferruh.yigit, stable



On 3/12/19 8:13 AM, Tiwei Bie wrote:
> The multiqueue support in virtio-user with vhost kernel backend
> is broken when tap name isn't specified by users explicitly,
> because the tap name returned by ioctl(TUNSETIFF) isn't saved
> properly, and multiple tap interfaces will be created in this
> case. Fix this by saving the dynamically allocated tap name
> first before reusing the ifr structure. Besides, also make it
> possible to support the format string in tap name (e.g. foo%d)
> specified by users explicitly.
> 
> Fixes: 791b43e08842 ("net/virtio-user: specify MAC of the tap")
> Cc: stable@dpdk.org
> 
> Reported-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 

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

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

* Re: [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel
  2019-03-12  7:13 [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel Tiwei Bie
  2019-03-12 12:53 ` Maxime Coquelin
@ 2019-03-12 17:42 ` Stephen Hemminger
  2019-03-13  6:14   ` Tiwei Bie
  2019-03-20  7:35 ` Maxime Coquelin
  2 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2019-03-12 17:42 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: maxime.coquelin, zhihong.wang, dev, ferruh.yigit, stable

On Tue, 12 Mar 2019 15:13:07 +0800
Tiwei Bie <tiwei.bie@intel.com> wrote:

> The multiqueue support in virtio-user with vhost kernel backend
> is broken when tap name isn't specified by users explicitly,
> because the tap name returned by ioctl(TUNSETIFF) isn't saved
> properly, and multiple tap interfaces will be created in this
> case. Fix this by saving the dynamically allocated tap name
> first before reusing the ifr structure. Besides, also make it
> possible to support the format string in tap name (e.g. foo%d)
> specified by users explicitly.
> 
> Fixes: 791b43e08842 ("net/virtio-user: specify MAC of the tap")
> Cc: stable@dpdk.org
> 
> Reported-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

Does this have any impact on primary/secondary support?

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

* Re: [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel
  2019-03-12 17:42 ` Stephen Hemminger
@ 2019-03-13  6:14   ` Tiwei Bie
  0 siblings, 0 replies; 5+ messages in thread
From: Tiwei Bie @ 2019-03-13  6:14 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: maxime.coquelin, zhihong.wang, dev, ferruh.yigit, stable

On Tue, Mar 12, 2019 at 10:42:39AM -0700, Stephen Hemminger wrote:
> On Tue, 12 Mar 2019 15:13:07 +0800
> Tiwei Bie <tiwei.bie@intel.com> wrote:
> 
> > The multiqueue support in virtio-user with vhost kernel backend
> > is broken when tap name isn't specified by users explicitly,
> > because the tap name returned by ioctl(TUNSETIFF) isn't saved
> > properly, and multiple tap interfaces will be created in this
> > case. Fix this by saving the dynamically allocated tap name
> > first before reusing the ifr structure. Besides, also make it
> > possible to support the format string in tap name (e.g. foo%d)
> > specified by users explicitly.
> > 
> > Fixes: 791b43e08842 ("net/virtio-user: specify MAC of the tap")
> > Cc: stable@dpdk.org
> > 
> > Reported-by: Stephen Hemminger <stephen@networkplumber.org>
> > Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> 
> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> Does this have any impact on primary/secondary support?

No. But I think there are some other issues with virtio-user
on primary/secondary support currently. I plan to send some
fixes for it later.

Thanks,
Tiwei

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

* Re: [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel
  2019-03-12  7:13 [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel Tiwei Bie
  2019-03-12 12:53 ` Maxime Coquelin
  2019-03-12 17:42 ` Stephen Hemminger
@ 2019-03-20  7:35 ` Maxime Coquelin
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2019-03-20  7:35 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev; +Cc: stephen, ferruh.yigit, stable



On 3/12/19 8:13 AM, Tiwei Bie wrote:
> The multiqueue support in virtio-user with vhost kernel backend
> is broken when tap name isn't specified by users explicitly,
> because the tap name returned by ioctl(TUNSETIFF) isn't saved
> properly, and multiple tap interfaces will be created in this
> case. Fix this by saving the dynamically allocated tap name
> first before reusing the ifr structure. Besides, also make it
> possible to support the format string in tap name (e.g. foo%d)
> specified by users explicitly.
> 
> Fixes: 791b43e08842 ("net/virtio-user: specify MAC of the tap")
> Cc: stable@dpdk.org
> 
> Reported-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 

Applied to dpdk-next-virtio/master branch.

Thanks,
Maxime

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

end of thread, other threads:[~2019-03-20  7:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12  7:13 [dpdk-stable] [PATCH] net/virtio-user: fix multiqueue support with vhost kernel Tiwei Bie
2019-03-12 12:53 ` Maxime Coquelin
2019-03-12 17:42 ` Stephen Hemminger
2019-03-13  6:14   ` Tiwei Bie
2019-03-20  7:35 ` 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).