On 11/18/25 12:49 PM, Michael S. Tsirkin wrote:
> On Tue, Nov 18, 2025 at 08:39:02AM -0600, Daniel Jurgens wrote:
>> +static int
>> +virtnet_ethtool_get_all_flows(struct virtnet_ff *ff,
>> + struct ethtool_rxnfc *info, u32 *rule_locs)
>> +{
>> + struct virtnet_ethtool_rule *eth_rule;
>> + unsigned long i = 0;
>> + int idx = 0;
>> +
>> + if (!ff->ff_supported)
>> + return -EOPNOTSUPP;
>> +
>> + xa_for_each(&ff->ethtool.rules, i, eth_rule)
>> + rule_locs[idx++] = i;
>> +
>> + info->data = le32_to_cpu(ff->ff_caps->rules_limit);
>> +
>> + return 0;
>> +}
>
> So I see
>
>
> * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
> * user buffer for @rule_locs on entry. On return, @data is the size
> * of the rule table, @rule_cnt is the number of defined rules, and
> * @rule_locs contains the locations of the defined rules. Drivers
> * must use the second parameter to get_rxnfc() instead of @rule_locs.
> *
>
>
> Should this set @rule_cnt?
>
Some drivers do, and others don't. I'll take the most conservative
approach and use it a limit, then set it at the end.
Also left rc uninitialized at the start of virtnet_get_rxnfc per the
comment in a separate email.