Subject: Re: [PATCH v2] net: sort queues in xps maps

From: Jakub Kicinski <[email-masked]>
Date: Thu, 14 Jul 2022 21:57:48 -0700

On Fri, 15 Jul 2022 10:31:58 +0800 Yonglong Li wrote:
> It is more reasonable that pacekts in the same stream be hashed to the same
> tx queue when all tx queue bind with the same CPUs.
> 
> ---
> v1 -> v2:
> Jakub suggestion: factor out the second loop in __netif_set_xps_queue() -
> starting from the "add tx-queue to CPU/rx-queue maps" comment into a helper
> ---

Please put the changelog under the --- after your s-o-b.
git am will cut off the commit message at the first ---
it finds which means right now it'll cut off before the 
changelog, and also discard your s-o-b.

> Signed-off-by: Yonglong Li <[email-masked]>
> ---
>  net/core/dev.c | 49 ++++++++++++++++++++++++++++++++-----------------
>  1 file changed, 32 insertions(+), 17 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 978ed06..b9ae5d5 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -150,6 +150,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/prandom.h>
>  #include <linux/once_lite.h>
> +#include <linux/sort.h>
>  
>  #include "dev.h"
>  #include "net-sysfs.h"
> @@ -199,6 +200,11 @@ static int call_netdevice_notifiers_extack(unsigned long val,
>  
>  static DECLARE_RWSEM(devnet_rename_sem);
>  
> +static int cmp_u16(const void *a, const void *b)
> +{
> +	return *(u16 *)a - *(u16 *)b;
> +}
> +
>  static inline void dev_base_seq_inc(struct net *net)
>  {
>  	while (++net->dev_base_seq == 0)
> @@ -2537,6 +2543,31 @@ static void xps_copy_dev_maps(struct xps_dev_maps *dev_maps,
>  	}
>  }
>  
> +static void update_xps_map(struct xps_map *map, int cpu, u16 index,
> +			   bool *skip_tc, int *numa_node_id,
> +			   enum xps_map_type type)
> +{
> +	int pos = 0;
> +
> +	*skip_tc = true;

Maybe let's keep the skip_tc in the main function, output arguments are
not universally liked in the kernel, and it's just a single line.

Otherwise looks good, thank you!