Subject: Re: [PATCH net-next v11 05/12] virtio_net: Query and set flow filter caps

From: "Michael S. Tsirkin" <[email-masked]>
Date: Wed, 19 Nov 2025 02:53:36 -0500

On Tue, Nov 18, 2025 at 08:38:55AM -0600, Daniel Jurgens wrote:
> +/**
> + * struct virtio_net_ff_cap_data - Flow filter resource capability limits
> + * @groups_limit: maximum number of flow filter groups supported by the device
> + * @classifiers_limit: maximum number of classifiers supported by the device
> + * @rules_limit: maximum number of rules supported device-wide across all groups
> + * @rules_per_group_limit: maximum number of rules allowed in a single group
> + * @last_rule_priority: priority value associated with the lowest-priority rule
> + * @selectors_per_classifier_limit: maximum selectors allowed in one classifier
> + *
> + * The limits are reported by the device and describe resource capacities for
> + * flow filters.

This sentence adds nothing of substance.
Pls don't add fluff like this in comments.

> Multi-byte fields are little-endian.

You do not really need to say "Multi-byte fields are little-endian."
do you? It says __le explicitly. Same applies to all structures.

> + */
> +struct virtio_net_ff_cap_data {
> +	__le32 groups_limit;
> +	__le32 classifiers_limit;
> +	__le32 rules_limit;
> +	__le32 rules_per_group_limit;
> +	__u8 last_rule_priority;
> +	__u8 selectors_per_classifier_limit;
> +};

so the compiler adds 2 bytes of padding here. The bug is
in the spec.

I think this happens to work for people because controllers
either also added 2 bytes of padding here at the end,
or they report a shorter structure and
the spec says commands can be truncated.
So I think we can just add 2 bytes of padding at the end
and it will be harmless.

It is a spec extension, but a minor one.

-- 
MST