<commit_before>#!/bin/bash

ec2_rps()
{
    local i=0
    local rps_cpus
    local mask
    local rps_queues_count=`ls -1 /sys/class/net/eth0/queues/*/rps_cpus | wc -l`

    for (( i = 1; i < rps_queues_count; i++ ))
    do
        rps_cpus="/sys/class/net/eth0/queues/rx-$i/rps_cpus"
        mask=`printf %x $((1 << i))`
        echo "Setting mask $mask in $rps_cpus"
        echo $mask > $rps_cpus
    done
}

en_rps()
{
    local cpu_num=`cat /proc/cpuinfo | grep processor | wc -l`
    local rps_queues_count=`ls -1 /sys/class/net/eth0/queues/*/rps_cpus | wc -l`

    local cpus_per_q=$((cpu_num / rps_queues_count))
    local mask=$(( (1 << cpus_per_q) - 1 ))
    local rps_cpus
    for (( i = 0; i < rps_queues_count; i++ ))
    do
        rps_cpus="/sys/class/net/eth0/queues/rx-$i/rps_cpus"
        mask_hex=`printf %x $mask`
        echo "Setting mask $mask_hex in $rps_cpus"
        echo $mask_hex > $rps_cpus
        mask=$((mask << cpus_per_q))
    done
}

# bind all NIC IRQs to CPU0
for irq in `cat  /proc/interrupts | grep eth0 | cut -d":" -f1`
do
    echo "Binding IRQ $irq to CPU0"
    echo 1 > /proc/irq/$irq/smp_affinity
done

# Setup RPS

if ethtool -i eth0 | grep ixgbevf > /dev/null; then
    en_rps<commit_msg>scripts: posix_net_conf.sh: Exclude CPU0 in RDS config for EN.<commit_after>#!/bin/bash

ec2_rps()
{
    local i=0
    local rps_cpus
    local mask
    local rps_queues_count=`ls -1 /sys/class/net/eth0/queues/*/rps_cpus | wc -l`

    for (( i = 1; i < rps_queues_count; i++ ))
    do
        rps_cpus="/sys/class/net/eth0/queues/rx-$i/rps_cpus"
        mask=`printf %x $((1 << i))`
        echo "Setting mask $mask in $rps_cpus"
        echo $mask > $rps_cpus
    done
}

en_rps()
{
    local cpu_num=`cat /proc/cpuinfo | grep processor | wc -l`
    local rps_queues_count=`ls -1 /sys/class/net/eth0/queues/*/rps_cpus | wc -l`

    local cpus_per_q=$((cpu_num / rps_queues_count))
    local mask=$(( (1 << cpus_per_q) - 1 ))
    local rps_cpus
    for (( i = 0; i < rps_queues_count; i++ ))
    do
        rps_cpus="/sys/class/net/eth0/queues/rx-$i/rps_cpus"
        mask_hex=`printf %x $(( mask & ~1 ))`
        echo "Setting mask $mask_hex in $rps_cpus"
        echo $mask_hex > $rps_cpus
        mask=$((mask << cpus_per_q))
    done
}

# bind all NIC IRQs to CPU0
for irq in `cat  /proc/interrupts | grep eth0 | cut -d":" -f1`
do
    echo "Binding IRQ $irq to CPU0"
    echo 1 > /proc/irq/$irq/smp_affinity
done

# Setup RPS

if ethtool -i eth0 | grep ixgbevf > /dev/null; then
    en_rps
{'fraction_non_alphanumeric': 0.14647664291369755, 'fraction_numerical': 0.01583531274742676, 'mean_word_length': 2.4855172413793105, 'pattern_counts': {'":': 2, '<': 19, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1328358', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1075, 'n_words': 250}