DPDK patches and discussions
 help / color / 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
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 index

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 publically 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

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox