Spdk/scripts/perf/nvmf/set_xps_rxqs
paul luse a6dbe3721e update Intel copyright notices
per Intel policy to include file commit date using git cmd
below.  The policy does not apply to non-Intel (C) notices.

git log --follow -C90% --format=%ad --date default <file> | tail -1

and then pull just the 4 digit year from the result.

Intel copyrights were not added to files where Intel either had
no contribution ot the contribution lacked substance (ie license
header updates, formatting changes, etc).  Contribution date used
"--follow -C95%" to get the most accurate date.

Note that several files in this patch didn't end the license/(c)
block with a blank comment line so these were added as the vast
majority of files do have this last blank line.  Simply there for
consistency.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Id5b7ce4f658fe87132f14139ead58d6e285c04d4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15192
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2022-11-10 08:28:53 +00:00

56 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2021 Intel Corporation.
#
# Script to setup mechanism for Tx queue selection based on Rx queue(s) map.
# This is done by configuring Rx queue(s) map per Tx queue via sysfs. This
# Rx queue(s) map is used during selection of Tx queue in
# data path (net/core/dev.c:get_xps_queue).
#
# typical usage is (as root):
# set_xps_rxqs <ethX>
#
# to get help:
# set_xps_rxqs
iface=$1
if [ -z "$iface" ]; then
echo "Usage: $0 <interface>"
exit 1
fi
CHECK() {
if ! "$@"; then
echo "Error in command ${1}, execution aborted, but some changes may have already been made!" >&2
exit 1
fi
}
CPUMASK() {
cpu=$1
if [ $cpu -ge 32 ]; then
mask_fill=""
mask_zero="00000000"
pow=$((cpu / 32))
for ((i = 1; i <= pow; i++)); do
mask_fill="${mask_fill},${mask_zero}"
done
cpu=$((cpu - 32 * pow))
mask_tmp=$((1 << cpu))
mask=$(printf "%X%s" $mask_tmp $mask_fill)
else
mask_tmp=$((1 << cpu))
mask=$(printf "%X" $mask_tmp)
fi
echo $mask
}
for i in /sys/class/net/"$iface"/queues/tx-*/xps_rxqs; do
j=$(echo $i | cut -d'/' -f7 | cut -d'-' -f2)
mask=$(CPUMASK $j)
echo ${mask} > $i
CHECK echo ${mask} > $i
done