2
0

packet-steering.sh 764 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. packet_steering="$(uci -q get network.@globals[0].packet_steering)"
  3. num_cpus="$(grep -c "^processor.*:" /proc/cpuinfo)"
  4. flow_offloading="$(uci -q get firewall.@defaults[0].flow_offloading)"
  5. flow_offloading_hw="$(uci -q get firewall.@defaults[0].flow_offloading_hw)"
  6. rps_eth0=0
  7. rps_br_lan=0
  8. [ "$packet_steering" = 1 ] && {
  9. if [ ${flow_offloading_hw:-0} -gt 0 ]; then
  10. # HW offloading
  11. # Not implemented
  12. :
  13. elif [ ${flow_offloading:-0} -gt 0 ]; then
  14. # SW offloading
  15. # BCM4908 always reaches ~940 Mb/s
  16. :
  17. else
  18. # Default
  19. case "$num_cpus" in
  20. 2) rps_eth0=2; rps_br_lan=2;;
  21. 4) rps_eth0=e; rps_br_lan=e;;
  22. esac
  23. fi
  24. }
  25. echo $rps_eth0 > /sys/class/net/eth0/queues/rx-0/rps_cpus
  26. echo $rps_br_lan > /sys/class/net/br-lan/queues/rx-0/rps_cpus