On 9/26/25 11:01 AM, Simon Horman wrote:
> On Tue, Sep 23, 2025 at 09:19:13AM -0500, Daniel Jurgens wrote:
>> When probing a virtnet device, attempt to read the flow filter
>> capabilities. In order to use the feature the caps must also
>> be set. For now setting what was read is sufficient.
>>
>> Signed-off-by: Daniel Jurgens <[email protected]>
>> Reviewed-by: Parav Pandit <[email protected]>
>> Reviewed-by: Shahar Shitrit <[email protected]>
> 
> ...
> 
>> diff --git a/include/uapi/linux/virtio_net_ff.h 
>> b/include/uapi/linux/virtio_net_ff.h
>> new file mode 100644
>> index 000000000000..a35533bf8377
>> --- /dev/null
>> +++ b/include/uapi/linux/virtio_net_ff.h
>> @@ -0,0 +1,55 @@
>> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
>> + *
>> + * Header file for virtio_net flow filters
>> + */
>> +#ifndef _LINUX_VIRTIO_NET_FF_H
>> +#define _LINUX_VIRTIO_NET_FF_H
>> +
>> +#include <linux/types.h>
>> +#include <linux/kernel.h>
>> +
>> +#define VIRTIO_NET_FF_RESOURCE_CAP 0x800
>> +#define VIRTIO_NET_FF_SELECTOR_CAP 0x801
>> +#define VIRTIO_NET_FF_ACTION_CAP 0x802
>> +
>> +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;
>> +};
>> +
>> +struct virtio_net_ff_selector {
>> +    __u8 type;
>> +    __u8 flags;
>> +    __u8 reserved[2];
>> +    __u8 length;
>> +    __u8 reserved1[3];
>> +    __u8 mask[];
>> +};
>> +
>> +#define VIRTIO_NET_FF_MASK_TYPE_ETH  1
>> +#define VIRTIO_NET_FF_MASK_TYPE_IPV4 2
>> +#define VIRTIO_NET_FF_MASK_TYPE_IPV6 3
>> +#define VIRTIO_NET_FF_MASK_TYPE_TCP  4
>> +#define VIRTIO_NET_FF_MASK_TYPE_UDP  5
>> +#define VIRTIO_NET_FF_MASK_TYPE_MAX  VIRTIO_NET_FF_MASK_TYPE_UDP
>> +
>> +struct virtio_net_ff_cap_mask_data {
>> +    __u8 count;
>> +    __u8 reserved[7];
>> +    struct virtio_net_ff_selector selectors[];
> 
> Hi Daniel,
> 
> Sparse warns that the line above is an array of flexible structures.
> I wonder if that can be addressed somehow.

Right now it's aligned with the VirtIO spec. Changing the type to bytes
would satisfy the tool, but that's all.

> 
>> +};
>> +#define VIRTIO_NET_FF_MASK_F_PARTIAL_MASK (1 << 0)
>> +
>> +#define VIRTIO_NET_FF_ACTION_DROP 1
>> +#define VIRTIO_NET_FF_ACTION_RX_VQ 2
>> +#define VIRTIO_NET_FF_ACTION_MAX  VIRTIO_NET_FF_ACTION_RX_VQ
>> +struct virtio_net_ff_actions {
>> +    __u8 count;
>> +    __u8 reserved[7];
>> +    __u8 actions[];
>> +};
>> +#endif
>> -- 
>> 2.45.0
>>
>>


Reply via email to