DPDK patches and discussions
 help / color / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Tiwei Bie <tiwei.bie@intel.com>
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: Tue, 19 Nov 2019 08:36:38 -0800
Message-ID: <20191119083638.37097fa4@hermes.lan> (raw)
In-Reply-To: <20191119062948.15834-1-tiwei.bie@intel.com>

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

  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 [this message]
2019-11-20  2:46   ` Tiwei Bie
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=20191119083638.37097fa4@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.com \
    --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