All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Roy Vardi <royv@ezchip.com>, qemu-devel@nongnu.org
Cc: armbru@redhat.com, noamc@ezchip.com, stefanha@redhat.com,
	aliguori@amazon.com, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH] net: Add persistent flag to -net tap option
Date: Thu, 22 Jan 2015 08:25:38 -0700	[thread overview]
Message-ID: <54C11672.8080001@redhat.com> (raw)
In-Reply-To: <1419148106-21502-1-git-send-email-royv@ezchip.com>

[-- Attachment #1: Type: text/plain, Size: 3161 bytes --]

On 12/21/2014 12:48 AM, Roy Vardi wrote:
> From: Roy Vardi <royv@ezchip.com>
> 
>     Add 'persistent' boolean flag to -net tap option.
>     When set to off - tap interface will be released on shutdown
>     When set to on\not specified - tap interface will remain
> 
>     Running with -net tap,persistent=off will force the tap interface
>     down when qemu goes down, thus ensuring that there're no zombie tap

s/there're/there are/

>     interfaces left
> 
>     This is achieved using another ioctl
> 
>     Note: This commit includes the above support only for linux systems
> 
> Signed-off-by: Roy Vardi <royv@ezchip.com>
> ---
>  #define PATH_NET_TUN "/dev/net/tun"
>  
>  int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
> -             int vnet_hdr_required, int mq_required)
> +             int vnet_hdr_required, int mq_required, int persistent_required)

Used as a boolean, so s/int/bool/

>  {
>      struct ifreq ifr;
>      int fd, ret;
> @@ -109,6 +110,17 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
>          close(fd);
>          return -1;
>      }
> +
> +    if (!persistent_required) {
> +        ret = ioctl(fd, TUNSETPERSIST, 0);
> +        if (ret != 0) {
> +            error_report("could not configure non-persistent %s (%s): %m",

%m is not portable to non-glibc (then again, this file is Linux-only).


> +++ b/net/tap.c
> @@ -556,7 +556,8 @@ int net_init_bridge(const NetClientOptions *opts, const char *name,
>  
>  static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr,
>                          const char *setup_script, char *ifname,
> -                        size_t ifname_sz, int mq_required)
> +                        size_t ifname_sz, int mq_required,
> +                        int persistent_required)

Again, prefer bool.


> @@ -688,7 +689,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
>                   NetClientState *peer)
>  {
>      const NetdevTapOptions *tap;
> -    int fd, vnet_hdr = 0, i = 0, queues;
> +    int fd, vnet_hdr = 0, i = 0, queues, persistent;

Use bool.

>      /* for the no-fd, no-helper case */
>      const char *script = NULL; /* suppress wrong "uninit'd use" gcc warning */
>      const char *downscript = NULL;
> @@ -699,6 +700,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
>      tap = opts->tap;
>      queues = tap->has_queues ? tap->queues : 1;
>      vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
> +    persistent = tap->has_persistent ? tap->persistent : 1;

s/1/true/


> +++ b/qapi-schema.json
> @@ -2007,6 +2007,8 @@
>  #
>  # @queues: #optional number of queues to be created for multiqueue capable tap
>  #
> +# @persistent: #optional for opening tap in persistent mode (default: on) (Since: 2.3)

Long line; please wrap at 80 columns.  In QMP, the default is 'true',
not 'on' (the command line parser maps multiple strings including 'on'
into the single QMP bool type).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2015-01-22 15:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21  7:48 [Qemu-devel] [PATCH] net: Add persistent flag to -net tap option Roy Vardi
2014-12-22  6:33 ` Jason Wang
2014-12-23  8:44   ` Roy Vardi
     [not found]     ` <AM2PR02MB0532BC1703B005CE79A141FCAA570@AM2PR02MB0532.eurprd02.prod.outlook .com>
2014-12-23  9:13       ` Jason Wang
2014-12-29  7:38         ` Roy Vardi
2015-01-04  7:28           ` Jason Wang
2015-01-18  9:42             ` Roy Vardi
2015-01-22 15:25 ` Eric Blake [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-12-15 12:05 Roy Vardi
2014-12-19 13:13 ` Stefan Hajnoczi
2014-12-19 13:18   ` Daniel P. Berrange
2014-12-21  7:17   ` Roy Vardi
2015-01-06 11:58     ` Stefan Hajnoczi
2014-12-19 15:29 ` Eric Blake

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=54C11672.8080001@redhat.com \
    --to=eblake@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=noamc@ezchip.com \
    --cc=qemu-devel@nongnu.org \
    --cc=royv@ezchip.com \
    --cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.