]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/scripts/posix_net_conf.sh
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / seastar / scripts / posix_net_conf.sh
1 #!/bin/bash
2 # !
3 # ! Usage: posix_net_conf.sh [iface name, eth0 by default] [-mq|-sq] [--cpu-mask] [-h|--help] [--use-cpu-mask <mask>]
4 # !
5 # ! Ban NIC IRQs from being moved by irqbalance.
6 # !
7 # ! -sq - set all IRQs of a given NIC to CPU0 and configure RPS
8 # ! to spreads NAPIs' handling between other CPUs.
9 # !
10 # ! -mq - distribute NIC's IRQs among all CPUs instead of binding
11 # ! them all to CPU0. In this mode RPS is always enabled to
12 # ! spreads NAPIs' handling between all CPUs.
13 # !
14 # ! --options-file <YAML file> - YAML file with perftune.py options
15 # !
16 # ! If there isn't any mode given script will use a default mode:
17 # ! - If number of physical CPU cores per Rx HW queue is greater than 4 - use the '-sq' mode.
18 # ! - Otherwise use the '-mq' mode.
19 # !
20 # ! --use-cpu-mask <mask> - mask of cores to use, by default use all available cores
21 # !
22 # ! --cpu-mask - Print out RPS CPU assignments. On MQ NIC, just print all cpus.
23 # !
24 # ! -h|--help - print this help information
25 # !
26 # ! Enable XPS, increase the default values of somaxconn and tcp_max_syn_backlog.
27 # !
28
29 usage()
30 {
31 cat $0 | grep ^"# !" | cut -d"!" -f2-
32 }
33
34 parse_args()
35 {
36 local i
37 local arg
38
39 until [ -z "$1" ]
40 do
41 arg=$1
42 case "$arg" in
43 "-mq")
44 MQ_MODE="--mode mq"
45 ;;
46 "-sq")
47 MQ_MODE="--mode sq"
48 ;;
49 "--cpu-mask")
50 CPU_MASK="--get-cpu-mask"
51 ;;
52 "--use-cpu-mask")
53 CPU_FILTER_MASK="--cpu-mask $2"
54 shift
55 ;;
56 "--options-file")
57 OPTIONS_FILE="--options-file $2"
58 shift
59 ;;
60 "-h"|"--help")
61 usage
62 exit 0
63 ;;
64 *)
65 IFACE=$arg
66 ;;
67 esac
68 shift
69 done
70 }
71
72 IFACE="eth0"
73 MQ_MODE=""
74 CPU_FILTER_MASK=""
75 CPU_MASK=""
76 MY_DIR=`dirname $0`
77 OPTIONS_FILE=""
78
79 parse_args $@
80
81 $MY_DIR/perftune.py --nic $IFACE $MQ_MODE $CPU_FILTER_MASK $CPU_MASK $OPTIONS_FILE --tune net