DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com,
	stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 20.02] net/virtio-user: do not close tap when disabling queue pairs
Date: Wed, 20 Nov 2019 10:46:42 +0800	[thread overview]
Message-ID: <20191120024642.GA24170@___> (raw)
In-Reply-To: <20191119083638.37097fa4@hermes.lan>

On Tue, Nov 19, 2019 at 08:36:38AM -0800, Stephen Hemminger wrote:
> On Tue, 19 Nov 2019 14:29:48 +0800
> Tiwei Bie <tiwei.bie@intel.com> wrote:
> 
> > -static int
> > +int
> > +vhost_kernel_tap_attach_queue(int fd)
> > +{
> > +	struct ifreq ifr;
> > +
> > +	memset(&ifr, 0, sizeof(ifr));
> > +	ifr.ifr_flags = IFF_ATTACH_QUEUE;
> > +	return ioctl(fd, TUNSETQUEUE, (void *)&ifr);
> > +}
> > +
> > +int
> > +vhost_kernel_tap_detach_queue(int fd)
> > +{
> > +	struct ifreq ifr;
> > +
> > +	memset(&ifr, 0, sizeof(ifr));
> > +	ifr.ifr_flags = IFF_DETACH_QUEUE;
> > +	return ioctl(fd, TUNSETQUEUE, (void *)&ifr);
> > +}
> > +
> 
> These both could be squashed into one routine.
> 
> int
> vhost_kernel_tap_set_queue(int fd, bool attach)
> {
> 	struct ifreq ifr = {
> 		.ifr_flags = attach ? IFF_ATTACH_QUEUE : IFF_DETACH_QUEUE
> 	};
> 
> 	return ioctl(fd, TUNSETQUEUE, &ifr);
> }
> 
> 1. Use initializer instead of memset
> 2. Cast to void * is unnecessary

Thanks! Will do it in v2.

Regards,
Tiwei

  reply	other threads:[~2019-11-20  2:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19  6:29 Tiwei Bie
2019-11-19 16:36 ` Stephen Hemminger
2019-11-20  2:46   ` Tiwei Bie [this message]
2019-11-25  8:14 ` [dpdk-dev] [PATCH 20.02 v2] " Tiwei Bie
2020-01-14  9:16   ` Maxime Coquelin
2020-01-15 11:18   ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191120024642.GA24170@___ \
    --to=tiwei.bie@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).