[dpdk-dev] [PATCH 1/2] net/virtio: do not re-enter clean up routines

Ferruh Yigit ferruh.yigit at intel.com
Fri Nov 2 15:33:13 CET 2018


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 <ciwillia at brocade.com>

<...>

>> @@ -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?


[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;


More information about the dev mailing list