From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Herbert Subject: Re: [net-next PATCH v2 2/4] net: Enable Tx queue selection based on Rx queues Date: Mon, 21 May 2018 07:51:27 -0700 Message-ID: References: <152643356116.4991.7215767041139726872.stgit@anamdev.jf.intel.com> <152643400925.4991.5029989601625953592.stgit@anamdev.jf.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Amritha Nambiar , Linux Kernel Network Developers , "David S. Miller" , Alexander Duyck , Sridhar Samudrala , Eric Dumazet , Hannes Frederic Sowa To: Willem de Bruijn Return-path: Received: from mail-qk0-f194.google.com ([209.85.220.194]:42110 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751504AbeEUOv3 (ORCPT ); Mon, 21 May 2018 10:51:29 -0400 Received: by mail-qk0-f194.google.com with SMTP id b22-v6so11972961qkj.9 for ; Mon, 21 May 2018 07:51:29 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Sat, May 19, 2018 at 1:27 PM, Willem de Bruijn wrote: > On Sat, May 19, 2018 at 4:13 PM, Willem de Bruijn > wrote: >> On Fri, May 18, 2018 at 12:03 AM, Tom Herbert wrote: >>> On Tue, May 15, 2018 at 6:26 PM, Amritha Nambiar >>> wrote: >>>> This patch adds support to pick Tx queue based on the Rx queue map >>>> configuration set by the admin through the sysfs attribute >>>> for each Tx queue. If the user configuration for receive >>>> queue map does not apply, then the Tx queue selection falls back >>>> to CPU map based selection and finally to hashing. >>>> >>>> Signed-off-by: Amritha Nambiar >>>> Signed-off-by: Sridhar Samudrala >>>> --- > >>>> +static int get_xps_queue(struct net_device *dev, struct sk_buff *skb) >>>> +{ >>>> +#ifdef CONFIG_XPS >>>> + enum xps_map_type i = XPS_MAP_RXQS; >>>> + struct xps_dev_maps *dev_maps; >>>> + struct sock *sk = skb->sk; >>>> + int queue_index = -1; >>>> + unsigned int tci = 0; >>>> + >>>> + if (sk && sk->sk_rx_queue_mapping <= dev->real_num_rx_queues && >>>> + dev->ifindex == sk->sk_rx_ifindex) >>>> + tci = sk->sk_rx_queue_mapping; >>>> + >>>> + rcu_read_lock(); >>>> + while (queue_index < 0 && i < __XPS_MAP_MAX) { >>>> + if (i == XPS_MAP_CPUS) >>> >>> This while loop typifies exactly why I don't think the XPS maps should >>> be an array. >> >> +1 > > as a matter of fact, as enabling both cpu and rxqueue map at the same > time makes no sense, only one map is needed at any one time. The > only difference is in how it is indexed. It should probably not be possible > to configure both at the same time. Keeping a single map probably also > significantly simplifies patch 1/4. Willem, I think it might makes sense to have them both. Maybe one application is spin polling that needs this, where others might be happy with normal CPU mappings as default. Tom