[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e32671f6-287e-69aa-6146-d5ddac239313@kernel.org>
Date: Mon, 14 Mar 2022 10:00:05 -0600
From: David Ahern <dsahern@...nel.org>
To: Eli Cohen <elic@...dia.com>,
"stephen@...workplumber.org" <stephen@...workplumber.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"si-wei.liu@...cle.com" <si-wei.liu@...cle.com>
Cc: "mst@...hat.com" <mst@...hat.com>,
"lulu@...hat.com" <lulu@...hat.com>,
Parav Pandit <parav@...dia.com>
Subject: Re: [PATCH v7 2/4] vdpa: Allow for printing negotiated features of a
device
On 3/14/22 9:34 AM, Eli Cohen wrote:
>> @@ -403,9 +403,9 @@ static const char *parse_class(int num)
>> }
>>
>> static const char * const net_feature_strs[64] = {
>> - [VIRTIO_NET_F_CSUM] = "CSUM",
>> - [VIRTIO_NET_F_GUEST_CSUM] = "GUEST_CSUM",
>> - [VIRTIO_NET_F_CTRL_GUEST_OFFLOADS] = "CTRL_GUEST_OFFLOADS",
>> + [VIRTIO_NET_F_CSUM] = "CSUM",
>> + [VIRTIO_NET_F_GUEST_CSUM] = "GUEST_CSUM",
>> + [VIRTIO_NET_F_CTRL_GUEST_OFFLOADS] = "CTRL_GUEST_OFFLOADS",
>> ...
>>
>>
>>> +};
>>> +
>>> +#define VIRTIO_F_IN_ORDER 35
>>> +#define VIRTIO_F_NOTIFICATION_DATA 38
>>> +#define VDPA_EXT_FEATURES_SZ (VIRTIO_TRANSPORT_F_END - \
>>> + VIRTIO_TRANSPORT_F_START + 1)
>>> +
>>> +static const char * const ext_feature_strs[VDPA_EXT_FEATURES_SZ] = {
>>> + [VIRTIO_RING_F_INDIRECT_DESC - VIRTIO_TRANSPORT_F_START] = "RING_INDIRECT_DESC",
>>> + [VIRTIO_RING_F_EVENT_IDX - VIRTIO_TRANSPORT_F_START] = "RING_EVENT_IDX",
>>> + [VIRTIO_F_VERSION_1 - VIRTIO_TRANSPORT_F_START] = "VERSION_1",
>>> + [VIRTIO_F_ACCESS_PLATFORM - VIRTIO_TRANSPORT_F_START] = "ACCESS_PLATFORM",
>>> + [VIRTIO_F_RING_PACKED - VIRTIO_TRANSPORT_F_START] = "RING_PACKED",
>>> + [VIRTIO_F_IN_ORDER - VIRTIO_TRANSPORT_F_START] = "IN_ORDER",
>>> + [VIRTIO_F_ORDER_PLATFORM - VIRTIO_TRANSPORT_F_START] = "ORDER_PLATFORM",
>>> + [VIRTIO_F_SR_IOV - VIRTIO_TRANSPORT_F_START] = "SR_IOV",
>>> + [VIRTIO_F_NOTIFICATION_DATA - VIRTIO_TRANSPORT_F_START] = "NOTIFICATION_DATA",
>>
>> and the entries here should be a macro to handle the
>> VIRTIO_TRANSPORT_F_START offset with column aligned strings.
>>
> Do you mean define a new macro for each line above?
> I could align them nicely without new macros while being confined to column 88.
>
VIRTIO_TRANSPORT_F_START is redundant on each line; a macro can be used
to hide that and simplifies each line.
Powered by blists - more mailing lists