[SDFAB-595] Add queues configuration

Change-Id: I0f8e0fdd058c41da8262690142051723601006e4
diff --git a/advanced/qos.rst b/advanced/qos.rst
index 4310e8e..27a7aeb 100644
--- a/advanced/qos.rst
+++ b/advanced/qos.rst
@@ -1,2 +1,129 @@
 QoS and Slicing
 ===============
+
+.. _qos_configuration:
+
+Configuration
+-------------
+.. note:: QoS and slicing configuration is currently statically configured at switch startup.
+   Dynamic configuration will be supported in a next SD-Fabric release.
+
+QoS and Slicing is configured via the ``vendor_config`` portion of the Stratum Chassis Config (see :ref:`stratum_chassis_config`),
+where the queues and schedulers can be configured.
+We provide a convenient `script <https://github.com/stratum/fabric-tna/blob/main/util/gen-stratum-qos-config.py>`_
+to generate the configuration starting from a higher-level description provided via a YAML file.
+This file allows to configure the parameters for the traffic classes listed in the previous sections.
+
+Here's a list of parameters that you can configure via the YAML QoS configuration file:
+
+* ``max_cells``: Maximum number of buffer cells, depends on the ASIC SKU/revision.
+
+* ``pool_allocations``: Percentage of buffer cells allocated to each traffic class.
+  The sum should be 100. Usually, we leave a portion of the buffer ``unassigned``
+  for queues that do not have a pool (yet).
+  Example of such queues are those for the recirculation port, CPU port, etc.
+
+  .. code-block:: yaml
+
+    pool_allocations:
+      control: 1
+      realtime: 9
+      elastic: 80
+      besteffort: 9
+      unassigned: 1
+
+* **Control** Traffic Class: The available bandwidth dedicated to Control traffic is divided in *slots*.
+  Each slot has a maximum rate and burst (in packets of the given MTU).
+  A slice can use one or more slots by appropriately configuring meters in the fabric ingress pipeline.
+
+  * ``control_slot_count``: Number of slots.
+  * ``control_slot_rate_pps``: Packet per second rate of each slot.
+  * ``control_slot_burst_pkts``: Number of packets per burst of each slot.
+  * ``control_mtu_bytes``: MTU of packets for the PPS and burst values.
+
+  .. code-block:: yaml
+
+    control_slot_count: 50
+    control_slot_rate_pps: 100
+    control_slot_burst_pkts: 10
+    control_mtu_bytes: 1500
+
+* **Real-Time** Traffic Class Configuration:
+
+  * ``realtime_max_rates_bps``: List of maximum shaping rates for Real-Time queues,
+    one per slice requesting such service.
+
+  * ``realtime_max_burst_s``: Maximum amount of time that a Real-Time queue can
+    burst at the port speed. This parameter is used to limit delay for Elastic
+    queues.
+
+  .. code-block:: yaml
+
+    realtime_max_rates_bps:
+      - 45000000 # 45 Mbps
+      - 30000000 # 30 Mbps
+      - 25000000 # 25 Mbps
+    realtime_max_burst_s: 0.005 # 5 ms
+
+* **Elastic** Traffic Class Configuration:
+
+  * ``elastic_min_rates_bps``: List of minimum guaranteed rates for Elastic queues,
+    one per slice requesting such service.
+
+  .. code-block:: yaml
+
+    elastic_min_rates_bps:
+      - 100000000 # 100 Mbps
+      - 200000000 # 200 Mbps
+
+* ``port_templates`` section: List of switch port for which we want to configure
+  queues.
+
+  Every ``port_templates`` element contains:
+
+    * ``descr``: Description of the port purpose.
+
+    * ``rate_bps``: Port speed in bit per second.
+
+    * ``is_shaping_enabled``: ``true`` if the rate is enforced using shaping,
+      ``false`` if the rate is the channel speed.
+
+    * ``shaping_burst_bytes``: Burst size in bytes, meaningful only if port speed
+      is shaped (when ``is_shaping_enabled: true``).
+
+    * ``queue_count``: Number of queues assigned to the port.
+
+    * ``port_ids``: List of Stratum port IDs (:ref:`singleton_port` from Stratum Chassis Config),
+      using this port template. Used for port that corresponds to switch front-panel ports.
+
+      Mutually exclusive with ``sdk_port_ids`` field.
+
+    * ``sdk_port_ids``: List of SDK port numbers (i.e., Tofino DP_ID) using this port template.
+      Used for internal ports (e.g., recirculation ports).
+
+      Mutually exclusive with ``port_ids`` field.
+
+  .. code-block:: yaml
+
+    port_templates:
+      - descr: "Base station"
+        rate_bps: 1000000000 # 1 Gbps
+        is_shaping_enabled: true
+        shaping_burst_bytes: 18000 # 2x jumbo frames
+        queue_count: 16
+        port_ids:
+          - 100
+      - descr: "Servers"
+        port_ids:
+          - 200
+        rate_bps: 40000000000 # 40 Gbps
+        is_shaping_enabled: false
+        queue_count: 16
+      - descr: "Recirculation"
+        sdk_port_ids:
+          - 68
+        rate_bps: 100000000000 # 100 Gbps
+        is_shaping_enabled: false
+        queue_count: 16
+
+An example of a complete QoS and Slicing configuration can be found `here <https://github.com/stratum/fabric-tna/blob/main/util/sample-qos-config.yaml>`_.