You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.5 KiB

  1. #!/bin/sh
  2. ################################################################################
  3. # test_triple_isolated_llt_cake.qos
  4. # One bin cake shaper for ethernet gateways
  5. # using cake qdisc with triple-isolate and diffserv-llt (Latency-Loss-Tradeoff)
  6. #
  7. ################################################################################
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License version 2 as
  11. # published by the Free Software Foundation.
  12. #
  13. # Copyright (C) 2012-2016
  14. # Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
  15. #
  16. ################################################################################
  17. . ${SQM_LIB_DIR}/defaults.sh
  18. ################################################################################
  19. # this will only work with cake as qdisc...
  20. QDISC=cake
  21. # to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh
  22. INGRESS_CAKE_OPTS="diffserv-llt triple-isolate"
  23. EGRESS_CAKE_OPTS="diffserv-llt triple-isolate"
  24. egress() {
  25. sqm_debug "egress"
  26. $TC qdisc del dev $IFACE root 2>/dev/null
  27. $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS}
  28. }
  29. ingress() {
  30. sqm_debug "ingress"
  31. $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null
  32. $TC qdisc add dev $IFACE handle ffff: ingress
  33. $TC qdisc del dev $DEV root 2>/dev/null
  34. $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS}
  35. $IP link set dev $DEV up
  36. # redirect all IP packets arriving in $IFACE to ifb0
  37. $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \
  38. match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV
  39. }
  40. sqm_start() {
  41. [ -n "$IFACE" ] || return 1
  42. do_modules
  43. verify_qdisc $QDISC "cake" || return 1
  44. sqm_debug "Starting ${SCRIPT}"
  45. [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} )
  46. if [ "${UPLINK}" -ne 0 ];
  47. then
  48. egress
  49. sqm_debug "egress shaping activated"
  50. else
  51. sqm_debug "egress shaping deactivated"
  52. $TC qdisc del dev ${IFACE} root 2> /dev/null
  53. fi
  54. if [ "${DOWNLINK}" -ne 0 ];
  55. then
  56. verify_qdisc ingress "ingress" || return 1
  57. ingress
  58. sqm_debug "ingress shaping activated"
  59. else
  60. sqm_debug "ingress shaping deactivated"
  61. $TC qdisc del dev ${DEV} root 2> /dev/null
  62. $TC qdisc del dev ${IFACE} ingress 2> /dev/null
  63. fi
  64. return 0
  65. }