From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3chas3@gmail.com> Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by dpdk.org (Postfix) with ESMTP id 6D8AEDED for ; Fri, 2 Nov 2018 16:19:51 +0100 (CET) Received: by mail-qk1-f194.google.com with SMTP id 189so3565915qkj.8 for ; Fri, 02 Nov 2018 08:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=/uhHQyYAzoFM8XdMdpGVjepGH2SUrUfMHUnns0sQTAQ=; b=JfkQ96nvVPgCA6XQnr8dbmLKErcI48Va5vixqTMb6AOWoMpS3XKSWavvg3vWWZWF2p 1eAdY/te03ph6MQL8uIHccorDILgmPsqc6miP8lU8BoMMEMrCEI1CxN29wC6s+mlS2Zi aF6riVHhzvzUXoSb6rb/NVmjTtlblYETje/6RyjNQ9OKE+EdLc+9JVmFPsp+1MsdDMRa oUkbEuM4uQvzrr/YS32dharKHewhyADG/3eWAboIy2wph9xzVYIX+8IJGnCXKUGAeJ6J x3P7gYzCmang5FfyUzryWhKV3JXe7WzbgkE39Kr2f+Bgsifh6A5k4uM1xtcIrgB9ZFDP KzVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/uhHQyYAzoFM8XdMdpGVjepGH2SUrUfMHUnns0sQTAQ=; b=RMsETqFmviRPgAtcrhk9Fn2RFngKUOqsF66RQ4e5hY5nv5UrYBSD8Wsws/Tj5EqsSw SuL3o50YvaBaVrBXq9HONpvzTm7HSNCqHMHJXK3XDAZnU00oSkalU+bTDERNs9BwWBCZ LuixNQCHokzzblfPFTipo4sUmyvtZAdrOvuU7/YtExl2NzO+TT1Xk1xAtUMjVaJypHHl Lue6tzc2PAlBe3vdiGokOZmGTVbZrtSVf6mDc6coStbMUPKpCBA4bme3QNQWuKU+/xSY BOOUdSLY9XVkzURqR+K9WDi1q37d4x10hJkfZvyWg1OPuaFAdcx/J6fQ9JYwqyXmzQEH 5h7w== X-Gm-Message-State: AGRZ1gK0FTel9gnRooQyx+HXNlRgp9goQdDzgmwlhdkHGp3EBsQzlpxN lkXpmUsTIDMHZSDOyg+IGZQpXFHC X-Google-Smtp-Source: AJdET5e/jfwuP4ilYLz2DlBl9mH17ecmwfuT484Ct8/y2i21LIuROx4zPGjzkUUezuTzId7fq7tfBQ== X-Received: by 2002:ac8:2bb9:: with SMTP id m54-v6mr11293212qtm.36.1541171990640; Fri, 02 Nov 2018 08:19:50 -0700 (PDT) Received: from [192.168.1.10] (pool-96-255-82-34.washdc.fios.verizon.net. [96.255.82.34]) by smtp.gmail.com with ESMTPSA id 40-v6sm6955474qtq.41.2018.11.02.08.19.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Nov 2018 08:19:49 -0700 (PDT) To: Ferruh Yigit , Luca Boccassi , maxime.coquelin@redhat.com, dev@dpdk.org References: <1500332723-10812-1-git-send-email-ciwillia@brocade.com> <1500332723-10812-2-git-send-email-ciwillia@brocade.com> <1541083532.4849.8.camel@debian.org> From: Chas Williams <3chas3@gmail.com> Message-ID: Date: Fri, 2 Nov 2018 11:19:49 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/2] net/virtio: do not re-enter clean up routines X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 15:19:51 -0000 On 11/02/2018 10:33 AM, Ferruh Yigit wrote: > On 11/1/2018 2:45 PM, Luca Boccassi wrote: >> On Mon, 2017-07-17 at 19:05 -0400, Charles (Chas) Williams wrote: >>> .dev_uninit calls .dev_stop and .dev_close. The work that is done in >>> those routines doesn't need repeated. Use started and opened to >>> track >>> the adapter's status. >>> >>> Signed-off-by: Chas Williams > > <...> > >>> @@ -253,7 +254,7 @@ struct virtio_hw { >>> uint64_t req_guest_features; >>> uint64_t guest_features; >>> uint32_t max_queue_pairs; >>> - uint16_t started; >>> + bool started; >>> uint16_t max_mtu; >>> uint16_t vtnet_hdr_size; >>> uint8_t vlan_strip; >>> @@ -268,6 +269,7 @@ struct virtio_hw { >>> struct virtio_pci_common_cfg *common_cfg; >>> struct virtio_net_config *dev_cfg; >>> void *virtio_user_dev; >>> + bool opened; > > This is already merged into next-net-virtio, but I would like to hightlight the > checkpatch warning about `bool` usage in struct [1]. > Briefly it suggests preferring primitive data types against `bool` in structures > because its size is not clear. > > What do you think about it, do you have strong opinion to have them as bool? Yes, I suppose I do. bool is the "proper" representation for yes/no. The arguments cited aren't convincing. The size of bool is the size of bool. The compiler gets to make that decision. I don't get to decide the size of int either. The size and alignemnt of bool should be optimal because your compiler probably knows more about the target than you do. If your compiler can't figure out alignment in a structure, please fix the compiler. bool is a primitive data type per the C99 standard. > [1] > CHECK:BOOL_MEMBER: Avoid using bool structure members because of possible > alignment issues - see: https://lkml.org/lkml/2017/11/21/384 > #85: FILE: drivers/net/virtio/virtio_pci.h:234: > + bool started; > > CHECK:BOOL_MEMBER: Avoid using bool structure members because of possible > alignment issues - see: https://lkml.org/lkml/2017/11/21/384 > #93: FILE: drivers/net/virtio/virtio_pci.h:260: > + bool opened; >