From 3c68c870041d5e4e2be560db5ba9e5be08450df8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 13 Jul 2012 13:53:51 -0700 Subject: Add support for priority-queue policy Bug 3643 Enhancement to expose kernel priority queuing. --- templates/traffic-policy/priority-queue/node.def | 8 ++++++++ .../priority-queue/node.tag/class/node.def | 6 ++++++ .../node.tag/class/node.tag/description/node.def | 2 ++ .../node.tag/class/node.tag/match/node.def | 4 ++++ .../class/node.tag/match/node.tag/description/node.def | 2 ++ .../node.tag/match/node.tag/ether/destination/node.def | 2 ++ .../class/node.tag/match/node.tag/ether/node.def | 1 + .../node.tag/match/node.tag/ether/protocol/node.def | 15 +++++++++++++++ .../node.tag/match/node.tag/ether/source/node.def | 2 ++ .../class/node.tag/match/node.tag/interface/node.def | 7 +++++++ .../match/node.tag/ip/destination/address/node.def | 2 ++ .../node.tag/match/node.tag/ip/destination/node.def | 1 + .../match/node.tag/ip/destination/port/node.def | 5 +++++ .../class/node.tag/match/node.tag/ip/dscp/node.def | 18 ++++++++++++++++++ .../node.tag/class/node.tag/match/node.tag/ip/node.def | 2 ++ .../class/node.tag/match/node.tag/ip/protocol/node.def | 16 ++++++++++++++++ .../node.tag/match/node.tag/ip/source/address/node.def | 2 ++ .../class/node.tag/match/node.tag/ip/source/node.def | 1 + .../node.tag/match/node.tag/ip/source/port/node.def | 6 ++++++ .../match/node.tag/ipv6/destination/address/node.def | 2 ++ .../node.tag/match/node.tag/ipv6/destination/node.def | 1 + .../match/node.tag/ipv6/destination/port/node.def | 5 +++++ .../class/node.tag/match/node.tag/ipv6/dscp/node.def | 18 ++++++++++++++++++ .../class/node.tag/match/node.tag/ipv6/node.def | 1 + .../node.tag/match/node.tag/ipv6/protocol/node.def | 16 ++++++++++++++++ .../match/node.tag/ipv6/source/address/node.def | 2 ++ .../class/node.tag/match/node.tag/ipv6/source/node.def | 1 + .../node.tag/match/node.tag/ipv6/source/port/node.def | 6 ++++++ .../class/node.tag/match/node.tag/mark/node.def | 2 ++ .../class/node.tag/match/node.tag/vif/node.def | 5 +++++ .../node.tag/class/node.tag/priority/node.def | 5 +++++ .../node.tag/class/node.tag/queue-limit/node.def | 4 ++++ .../node.tag/class/node.tag/queue-type/node.def | 11 +++++++++++ .../priority-queue/node.tag/default/node.def | 1 + .../priority-queue/node.tag/default/priority/node.def | 5 +++++ .../node.tag/default/queue-limit/node.def | 4 ++++ .../node.tag/default/queue-type/node.def | 8 ++++++++ .../priority-queue/node.tag/description/node.def | 2 ++ 38 files changed, 201 insertions(+) create mode 100644 templates/traffic-policy/priority-queue/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/description/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/description/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/destination/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/protocol/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/source/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/interface/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/address/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/port/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/dscp/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/protocol/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/address/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/port/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/address/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/port/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/dscp/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/protocol/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/address/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/port/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/mark/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/vif/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/priority/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-limit/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-type/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/default/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/default/priority/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/default/queue-limit/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/default/queue-type/node.def create mode 100644 templates/traffic-policy/priority-queue/node.tag/description/node.def (limited to 'templates') diff --git a/templates/traffic-policy/priority-queue/node.def b/templates/traffic-policy/priority-queue/node.def new file mode 100644 index 0000000..b848108 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.def @@ -0,0 +1,8 @@ +tag: +type: txt +help: Priority queuing based policy +syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" + ; "only alpha-numeric policy name allowed" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.def new file mode 100644 index 0000000..1e9ae0b --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.def @@ -0,0 +1,6 @@ +tag: +type: u32 +help: Class handle +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 4095; \ + "Class identifier must be between 1 and 4095" +val_help: u32:1-4095; Class identifier diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/description/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/description/node.def new file mode 100644 index 0000000..9a24868 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/description/node.def @@ -0,0 +1,2 @@ +type: txt +help: Description for this traffic class diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.def new file mode 100644 index 0000000..cde128f --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.def @@ -0,0 +1,4 @@ +tag: +type: txt +syntax:expression: pattern $VAR(@) "^[^-]" ; "Match queue name cannot start with \"-\"" +help: Class matching rule name diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/description/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/description/node.def new file mode 100644 index 0000000..903f260 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/description/node.def @@ -0,0 +1,2 @@ +type: txt +help: Description for this match diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/destination/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/destination/node.def new file mode 100644 index 0000000..92fb9a9 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/destination/node.def @@ -0,0 +1,2 @@ +type: macaddr +help: Ethernet destination address for this match diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/node.def new file mode 100644 index 0000000..454c1ed --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/node.def @@ -0,0 +1 @@ +help: Ethernet header match diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/protocol/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/protocol/node.def new file mode 100644 index 0000000..9da50a6 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/protocol/node.def @@ -0,0 +1,15 @@ +type: txt +help: Ethernet protocol for this match +allowed: echo \ + all 802.1Q 802_2 802_3 aarp aoe arp atalk \ + dec ip ipv6 ipx lat localtalk rarp snap x25 + +val_help: u32:0-65535; Ethernet protocol number +val_help: txt; Ethernet protocol name +val_help: all; Any protocol +val_help: ip; Internet IP (IPv4) +val_help: _ipv6; Internet IP (IPv6) +val_help: arp; Address Resolution Protocol +val_help: atalk; Appletalk +val_help: ipx; Novell Internet Packet Exchange +val_help: 802.1Q; 802.1Q VLAN tag diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/source/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/source/node.def new file mode 100644 index 0000000..3094167 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/source/node.def @@ -0,0 +1,2 @@ +type: macaddr +help: Ethernet source address for this match diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/interface/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/interface/node.def new file mode 100644 index 0000000..f12c59c --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/interface/node.def @@ -0,0 +1,7 @@ +type: txt +help: Interface name for this match +syntax:expression: exec "[ -f /sys/class/net/$VAR(@)/ifindex ]" ; "Interface must already exist" +allowed: local -a array + array=( /sys/class/net/* ) + echo -n ${array[@]##*/} + diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/address/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/address/node.def new file mode 100644 index 0000000..8d02285 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/address/node.def @@ -0,0 +1,2 @@ +type: ipv4net +help: IP destination address for this match diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/node.def new file mode 100644 index 0000000..54eef5b --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/node.def @@ -0,0 +1 @@ +help: Match on destination port or address diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/port/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/port/node.def new file mode 100644 index 0000000..fc85c5f --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/port/node.def @@ -0,0 +1,5 @@ +type: txt +help: TCP (or UDP) destination port for this match + +val_help: u32:1-65535; Numeric IP port +val_help: txt; Assigned TCP (or UDP) port name diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/dscp/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/dscp/node.def new file mode 100644 index 0000000..224b002 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/dscp/node.def @@ -0,0 +1,18 @@ +type: txt +help: Match on Differentiated Services Codepoint (DSCP) +syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --dscp $VAR(@)" +allowed: awk ' + /^#/ { next } + { printf "%s ", $2 }' = 0 && $VAR(@) <= 4095; \ + "VLAN ID must be between 0 and 4095" +val_help: u32:0-4095; Virtual Local Area Network (VLAN) tag diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/priority/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/priority/node.def new file mode 100644 index 0000000..6cacb22 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/priority/node.def @@ -0,0 +1,5 @@ +type: u32 +help: Priority for usage of excess bandwidth +syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 7 ;\ + "priority must be between 0 than 7" +val_help: u32:0-7; Priority order for bandwidth pool diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-limit/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-limit/node.def new file mode 100644 index 0000000..bf011c2 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-limit/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Maximum queue size (packets) +syntax:expression: $VAR(@) > 0 ; "queue limit must be greater than zero" +val_help: u32:1-4294967295; Queue size in packets diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-type/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-type/node.def new file mode 100644 index 0000000..6b44648 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-type/node.def @@ -0,0 +1,11 @@ +type: txt +default: "fair-queue" +syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail", "random-detect";\ + "Unknown queue-type" +help: Queue type for this class + +val_help: fair-queue; Stochastic Fair Queue (SFQ) +val_help: drop-tail; First-In-First-Out (FIFO) +val_help: priority; Priority queueing based on DSCP +val_help: random-detect; Random Early Detection (RED) + diff --git a/templates/traffic-policy/priority-queue/node.tag/default/node.def b/templates/traffic-policy/priority-queue/node.tag/default/node.def new file mode 100644 index 0000000..142cba3 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/default/node.def @@ -0,0 +1 @@ +help: Default policy diff --git a/templates/traffic-policy/priority-queue/node.tag/default/priority/node.def b/templates/traffic-policy/priority-queue/node.tag/default/priority/node.def new file mode 100644 index 0000000..c46ee3e --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/default/priority/node.def @@ -0,0 +1,5 @@ +type: u32 +help: Priority for this queue +syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 7 ;\ + "priority must be between 0 than 7" +val_help: u32:0-7; Priority diff --git a/templates/traffic-policy/priority-queue/node.tag/default/queue-limit/node.def b/templates/traffic-policy/priority-queue/node.tag/default/queue-limit/node.def new file mode 100644 index 0000000..7b07913 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/default/queue-limit/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Maximum queue size (packets) +syntax:expression: $VAR(@) > 0; "Queue limit must be greater than zero" +val_help: u32:1-4294967295; Queue size in packets diff --git a/templates/traffic-policy/priority-queue/node.tag/default/queue-type/node.def b/templates/traffic-policy/priority-queue/node.tag/default/queue-type/node.def new file mode 100644 index 0000000..e4283ab --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/default/queue-type/node.def @@ -0,0 +1,8 @@ +type: txt +default: "fair-queue" +syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail", "random-detect";\ + "Unknown queue-type" +help: Queue type for default traffic +val_help: fair-queue; Stochastic Fair Queue (SFQ) +val_help: drop-tail; First-In-First-Out (FIFO) +val_help: random-detect; Random Early Detection (RED) diff --git a/templates/traffic-policy/priority-queue/node.tag/description/node.def b/templates/traffic-policy/priority-queue/node.tag/description/node.def new file mode 100644 index 0000000..1da9e34 --- /dev/null +++ b/templates/traffic-policy/priority-queue/node.tag/description/node.def @@ -0,0 +1,2 @@ +type: txt +help: Description for this queuing policy -- cgit v1.2.3