Subject: Re: [PATCH net-next] rfs: added /proc/sys/net/core/rps_allow_ooo flag to tweak flow alg

From: Stephen Hemminger <[email-masked]>
Date: Fri, 24 Jun 2022 10:05:36 -0700

On Fri, 24 Jun 2022 10:54:47 -0600
James Yonan <[email-masked]> wrote:

> @@ -4494,6 +4496,7 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
>  		 * If the desired CPU (where last recvmsg was done) is
>  		 * different from current CPU (one in the rx-queue flow
>  		 * table entry), switch if one of the following holds:
> +		 *   - rps_allow_ooo_sysctl is enabled.
>  		 *   - Current CPU is unset (>= nr_cpu_ids).
>  		 *   - Current CPU is offline.
>  		 *   - The current CPU's queue tail has advanced beyond the
> @@ -4502,7 +4505,7 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
>  		 *     have been dequeued, thus preserving in order delivery.
>  		 */
>  		if (unlikely(tcpu != next_cpu) &&
> -		    (tcpu >= nr_cpu_ids || !cpu_online(tcpu) ||
> +		    (rps_allow_ooo_sysctl || tcpu >= nr_cpu_ids || !cpu_online(tcpu) ||
>  		     ((int)(per_cpu(softnet_data, tcpu).input_queue_head -
>  		      rflow->last_qtail)) >= 0)) {

This conditional is getting complex, maybe an inline helper function would
be clearer for developers that decide to add more in future.