diff options
author | Maxim Mikityanskiy <maximmi@nvidia.com> | 2022-01-25 12:52:59 +0200 |
---|---|---|
committer | Saeed Mahameed <saeedm@nvidia.com> | 2022-02-14 22:30:51 -0800 |
commit | 3a9e5fff2ab0d6f4af701757d35b9453dc563b78 (patch) | |
tree | 2fd85358826bf473a5369c4410f9750b596bc842 /net/switchdev/switchdev.c | |
parent | 3c87aedd48997f9ab3afdeb2084f6b6163a21db8 (diff) | |
download | linux-3a9e5fff2ab0d6f4af701757d35b9453dc563b78.tar.gz linux-3a9e5fff2ab0d6f4af701757d35b9453dc563b78.tar.bz2 linux-3a9e5fff2ab0d6f4af701757d35b9453dc563b78.zip |
net/mlx5e: Optimize modulo in mlx5e_select_queue
To improve the performance of the modulo operation (%), it's replaced by
a subtracting the divisor in a loop. The modulo is used to fix up an
out-of-bounds value that might be returned by netdev_pick_tx or to
convert the queue number to the channel number when num_tcs > 1. Both
situations are unlikely, because XPS is configured not to pick higher
queues (qid >= num_channels) by default, so under normal circumstances
the flow won't go inside the loop, and it will be faster than %.
num_tcs == 8 adds at most 7 iterations to the loop. PTP adds at most 1
iteration to the loop. HTB would add at most 256 iterations (when
num_channels == 1), so there is an additional boundary check in the HTB
flow, which falls back to % if more than 7 iterations are expected.
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'net/switchdev/switchdev.c')
0 files changed, 0 insertions, 0 deletions