Re: [PATCH net-next v2 07/12] net: remove the xps possible_mask
From: Alexander Duyck <hidden>
Date: 2021-02-08 21:46:17
On Mon, Feb 8, 2021 at 9:19 AM Antoine Tenart [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Remove the xps possible_mask. It was an optimization but we can just loop from 0 to nr_ids now that it is embedded in the xps dev_maps. That simplifies the code a bit. Suggested-by: Alexander Duyck <redacted> Signed-off-by: Antoine Tenart <atenart@kernel.org> --- net/core/dev.c | 43 ++++++++++++++----------------------------- net/core/net-sysfs.c | 4 ++-- 2 files changed, 16 insertions(+), 31 deletions(-)diff --git a/net/core/dev.c b/net/core/dev.c index abbb2ae6b3ed..d0c07ccea2e5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c@@ -2505,33 +2505,27 @@ static void reset_xps_maps(struct net_device *dev, kfree_rcu(dev_maps, rcu); } -static void clean_xps_maps(struct net_device *dev, const unsigned long *mask, +static void clean_xps_maps(struct net_device *dev, struct xps_dev_maps *dev_maps, u16 offset, u16 count, bool is_rxqs_map) { - unsigned int nr_ids = dev_maps->nr_ids; bool active = false; int i, j; - for (j = -1; j = netif_attrmask_next(j, mask, nr_ids), j < nr_ids;) - active |= remove_xps_queue_cpu(dev, dev_maps, j, offset, - count); + for (j = 0; j < dev_maps->nr_ids; j++) + active |= remove_xps_queue_cpu(dev, dev_maps, j, offset, count); if (!active) reset_xps_maps(dev, dev_maps, is_rxqs_map); - if (!is_rxqs_map) { - for (i = offset + (count - 1); count--; i--) { + if (!is_rxqs_map) + for (i = offset + (count - 1); count--; i--) netdev_queue_numa_node_write( - netdev_get_tx_queue(dev, i), - NUMA_NO_NODE); - } - } + netdev_get_tx_queue(dev, i), NUMA_NO_NODE); }
This violates the coding-style guide for the kernel. The if statement should still have braces as the for loop and netdev_queue_numa_node_write are more than a single statement. I'd be curious to see if checkpatch also complains about this because it probably should. For reference see the end of section 3.0 in Documentation/process/coding-style.rst. Other than that the rest of the patch seemed to be fine.