From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4528A034E for ; Tue, 19 Nov 2019 17:37:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 89AFF2956; Tue, 19 Nov 2019 17:37:12 +0100 (CET) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 0D86E235 for ; Tue, 19 Nov 2019 17:37:08 +0100 (CET) Received: by mail-pf1-f196.google.com with SMTP id c184so12448201pfb.0 for ; Tue, 19 Nov 2019 08:37:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wN+SJReHcQekr6wz/jbzZMimnHrOATT66j2E1Jf/xaw=; b=LKr8YiMIOONtlTkZk92XjkTc+BdDIiOtMKjYZD77M+IUwaOsQAksZsaBghi5e1LVcQ AuRyazMM7F1/b0VcYXdQ7P9DdQK9VujminXYwxwSOU9DYu+CmxxW4cKCKwcz2MhOiCMS 0LRa8QUe6CnfyYR9lN/uSr8ZSQmvn+Eaf0jZFrfLp3BvSz/Ydrr9meQ22iO3xlPGTMAI uFfLCAsBHlOUjvy0QgQYyyZDvCbfehvJKM2iQkMYZlfEdxm6DvOvE326/6uUY0peREOH O54WvkgLfQPflJe9e/hsCu2n+acViDOLEFoCW+Ea0HJ2d1HORhSRLEJ84dad/5acMXKK oE8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wN+SJReHcQekr6wz/jbzZMimnHrOATT66j2E1Jf/xaw=; b=qoAiefwV+SKTfbqN/NkKyGLo72tvnLWC6Mf/zmA2PHkqrKrkH+jpHOqqPCwA0+Kdto qr+loGFs5X1A7feHQFQquu9SwWXjZhJVP4JHxWfsY3jXQi9O4l4lIUY/TJnLkgPVjZuq EPpJw9ysgQwbQxBEqMHFbgPqTnVuEc0wjE00chezRirNjSHcdDJSDkzvFsscNAS3Ohlk cfCZIL6AbiYPkTmq2DyvnXp5GAjmgzMP42+tIl5QxAqBhR/J2pC47j23nC7ei8bogAzf X8crHguVunXwxUtkDgsCqOLyE5GQZSHLgI7Oz01JsrJ0Qc0RwBMD8m+5/FqvPs0flYR4 6bNQ== X-Gm-Message-State: APjAAAX9hi6LSi7exIBfUQcO1t/KeWqMyzKSgkS3bOoUM6hjXZAz2A3g 7A28SnjfdoVB1235D4nxrGc/xA== X-Google-Smtp-Source: APXvYqxnwBXXfQHuhAgJqyL6ZB1oPY0YfNthue1kKsbSCA/MWgMZ3Uj9KzyQw0ewF/ZnlzaXpHINnA== X-Received: by 2002:a62:2f43:: with SMTP id v64mr6608858pfv.13.1574181428088; Tue, 19 Nov 2019 08:37:08 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id w69sm27551290pfc.164.2019.11.19.08.37.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 08:37:07 -0800 (PST) Date: Tue, 19 Nov 2019 08:36:38 -0800 From: Stephen Hemminger To: Tiwei Bie Cc: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com, stable@dpdk.org Message-ID: <20191119083638.37097fa4@hermes.lan> In-Reply-To: <20191119062948.15834-1-tiwei.bie@intel.com> References: <20191119062948.15834-1-tiwei.bie@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [PATCH 20.02] net/virtio-user: do not close tap when disabling queue pairs X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, 19 Nov 2019 14:29:48 +0800 Tiwei Bie 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