Subject: Re: [PATCH net v3] virtio_net: Do not send RSS key if it is not supported

From: Breno Leitao <[email-masked]>
Date: Wed, 3 Apr 2024 05:53:12 -0700

On Sun, Mar 31, 2024 at 04:20:30PM -0400, Michael S. Tsirkin wrote:
> On Fri, Mar 29, 2024 at 10:16:41AM -0700, Breno Leitao wrote:
> > @@ -3814,13 +3815,24 @@ static int virtnet_set_rxfh(struct net_device *dev,
> >  		return -EOPNOTSUPP;
> >  
> >  	if (rxfh->indir) {
> > +		if (!vi->has_rss)
> > +			return -EOPNOTSUPP;
> > +
> >  		for (i = 0; i < vi->rss_indir_table_size; ++i)
> >  			vi->ctrl->rss.indirection_table[i] = rxfh->indir[i];
> > +		update = true;
> >  	}
> > -	if (rxfh->key)
> > +
> > +	if (rxfh->key) {
> > +		if (!vi->has_rss && !vi->has_rss_hash_report)
> > +			return -EOPNOTSUPP;
> 
> 
> What's the logic here? Is it || or &&? A comment can't hurt.

If txfh carries a key, then the device needs to has either has_rss or
has_rss_hash_report "features".

These are basically virtio features VIRTIO_NET_F_HASH_REPORT and
VIRTIO_NET_F_RSS that are set at virtio_probe.

I will add the comment and respin the series.