On 11/3/25 10:34 PM, Jason Wang wrote:
> On Tue, Nov 4, 2025 at 6:56 AM Daniel Jurgens <[email protected]> wrote:
>>
>> Filtering a flow requires a classifier to match the packets, and a rule
>> to filter on the matches.
>>
>> A classifier consists of one or more selectors. There is one selector
>> per header type. A selector must only use fields set in the selector
>> capability. If partial matching is supported, the classifier mask for a
>> particular field can be a subset of the mask for that field in the
>> capability.
>>
>> The rule consists of a priority, an action and a key. The key is a byte
>> array containing headers corresponding to the selectors in the
>> classifier.
>>
>> This patch implements ethtool rules for ethernet headers.
>>
>> Example:
>> $ ethtool -U ens9 flow-type ether dst 08:11:22:33:44:54 action 30
>> Added rule with ID 1
>>
>> The rule in the example directs received packets with the specified
>> destination MAC address to rq 30.
>>
>> Signed-off-by: Daniel Jurgens <[email protected]>
>> Reviewed-by: Parav Pandit <[email protected]>
>> Reviewed-by: Shahar Shitrit <[email protected]>
>> Reviewed-by: Xuan Zhuo <[email protected]>
>> ---
>> v4:
>>     - Fixed double free bug in error flows
>>     - Build bug on for classifier struct ordering.
>>     - (u8 *) to (void *) casting.
>>     - Documentation in UAPI
>>     - Answered questions about overflow with no changes.
>> v6:
>>     - Fix sparse warning "array of flexible structures" Jakub K/Simon H
>> v7:
>>     - Move for (int i -> for (i hunk from next patch. Paolo Abeni
>> ---
>>  drivers/net/virtio_net.c           | 462 +++++++++++++++++++++++++++++
>>  include/uapi/linux/virtio_net_ff.h |  50 ++++
>>  2 files changed, 512 insertions(+)
>>
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index 998f2b3080b5..032932e5d616 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -284,6 +284,11 @@ static const struct virtnet_stat_desc 
>> virtnet_stats_tx_speed_desc_qstat[] = {
>>         VIRTNET_STATS_DESC_TX_QSTAT(speed, ratelimit_packets, 
>> hw_drop_ratelimits),
>>  };
>>
>> +struct virtnet_ethtool_ff {
>> +       struct xarray rules;
>> +       int    num_rules;
>> +};
>> +
>>  #define VIRTNET_FF_ETHTOOL_GROUP_PRIORITY 1
>>  #define VIRTNET_FF_MAX_GROUPS 1
>>
>> @@ -293,8 +298,16 @@ struct virtnet_ff {
>>         struct virtio_net_ff_cap_data *ff_caps;
>>         struct virtio_net_ff_cap_mask_data *ff_mask;
>>         struct virtio_net_ff_actions *ff_actions;
>> +       struct xarray classifiers;
>> +       int num_classifiers;
> 
> This is unused.

Removed, thanks.

> 
> Thanks
> 


Reply via email to