Carmelo Cascone | 7623e7c | 2021-10-13 17:45:27 -0700 | [diff] [blame] | 1 | .. _slicing_qos: |
| 2 | |
| 3 | Slicing and QoS |
Charles Chan | caebcf3 | 2021-09-20 22:17:52 -0700 | [diff] [blame] | 4 | =============== |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 5 | |
| 6 | .. _qos_configuration: |
| 7 | |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 8 | Overview |
| 9 | -------- |
| 10 | |
| 11 | Network slicing enables sharing the same physical infrastructure between |
| 12 | independent logical networks, each one targeting different use cases while |
| 13 | providing isolation and security guarantees. Slicing permits the implementation |
| 14 | of tailor-made applications with Quality of Service (QoS) specific to the needs |
| 15 | of each slice, rather than a one-size-fits-all approach. |
| 16 | |
| 17 | SD-Fabric supports slicing and QoS using dedicated hardware resources such as |
| 18 | scheduling queues and meters. Once a packet enters the fabric, it is associated |
| 19 | with a slice ID and traffic Class (TC). Slice ID is an arbitrary identifier, |
| 20 | while TC is used to determine the QoS parameters. The combination of slice ID |
| 21 | and TC is used by SD-Fabric to determine which switch hardware queue to use. |
| 22 | |
| 23 | We provide fabric-wide isolation and QoS guarantees. Packets are classified by |
| 24 | the first leaf switch in the path, we then use a custom DSCP-based marking |
| 25 | scheme to apply the same treatment on all switches. |
| 26 | |
| 27 | Classification can be achieved for both regular traffic via REST APIs, or for |
| 28 | GTP-U traffic terminated by P4-UPF using PFCP integration. |
| 29 | |
| 30 | Traffic Classes |
| 31 | ^^^^^^^^^^^^^^^ |
| 32 | |
| 33 | We supports the following traffic classes that covers the spectrum of |
| 34 | applications from latency-sensitive to throughput-intensive. |
| 35 | |
| 36 | Control |
| 37 | """"""" |
| 38 | For applications demanding ultra-low latency and jitter guarantees, with |
| 39 | non-bursty, low throughput requirements in the order of 100s of packets per |
| 40 | second. Examples of such applications are consensus protocols, industrial |
| 41 | automation, timing, etc. This class uses a queue shared by all slices, serviced |
| 42 | with the highest priority. To enforce isolation between slices, and to avoid |
| 43 | starvation of lower priority classes, each slice is processed through a |
| 44 | single-rate two-color meter. Slices sending at rates higher than the configured |
| 45 | meter rate might observe packet drops. |
| 46 | |
| 47 | Real-Time |
| 48 | """"""""" |
| 49 | For applications that require both low-latency and sustained throughput. |
| 50 | Examples of such applications are video and audio streaming. Each slice gets a |
| 51 | dedicated Real-Time queue serviced in a Round-Robin fashion to guarantee the |
| 52 | lowest latency at all times even with bursty senders. To avoid starvation of |
| 53 | lower priority classes, Real-Time queues are shaped at a maximum rate. Slices |
| 54 | sending at rates higher than the configured one might observe higher latency |
| 55 | because of the shaping. Real-Time queues have priority lower than Control, but |
| 56 | higher than Elastic. |
| 57 | |
| 58 | Elastic |
| 59 | """"""" |
| 60 | For throughput-intensive applications with no latency requirements. This class |
| 61 | is best suited for large file transfers, Intranet/enterprise applications, |
| 62 | prioritized Internet access, etc. Each slice gets a dedicated Elastic queue |
| 63 | serviced in Weighted Round-Robin (WRR) fashion with configurable weights. During |
| 64 | congestion, Elastic queues are guaranteed to receive minimum bandwidth that can |
| 65 | grow up to the link capacity if other queues are empty. |
| 66 | |
| 67 | Best-Effort |
| 68 | """"""""""" |
| 69 | This is the default traffic class, used by packets not classified with any of |
| 70 | the above classes All slices share the same best-effort queue with lowest |
| 71 | priority. |
| 72 | |
| 73 | Classification |
| 74 | ^^^^^^^^^^^^^^^ |
| 75 | |
| 76 | Slice ID and TC classification can be performed in two ways. |
| 77 | |
| 78 | Regular traffic |
| 79 | """"""""""""""" |
| 80 | We provide an ACL-like APIs that supports specifying wildcard match rules on the |
| 81 | IPv4 5-tuple. |
| 82 | |
| 83 | P4-UPF traffic |
| 84 | """""""""""""" |
| 85 | When using the embedded UPF function, for GTP-U mobile traffic terminated by the |
| 86 | fabric, we support integration with PFCP QoS features such as prioritization via |
| 87 | QoS Flow Identifier (QFI), Maximum Bitrate (MBR) limits, and Guaranteed Bitrate |
| 88 | (GBR). |
| 89 | |
| 90 | You can configure a static one-to-one mapping between 3GPP’s QFIs and |
| 91 | SD-Fabric’s TCs using the ONOS netcfg JSON file (work-in-progress), while MBR |
| 92 | and GBR configuration are translated into meter configurations. |
| 93 | |
| 94 | QoS classification uses the same table for GTP-U tunnel termination, for this |
| 95 | reason, to achieve fabric-wide QoS enforcement, we recommend enabling the UPF |
| 96 | function on each leaf switch using the distributed UPF mode, such that packets |
| 97 | are classified as soon as they enter the network. |
| 98 | |
| 99 | Support for slicing of mobile traffic is work-in-progress and will be added in |
| 100 | the next SD-Fabric release. |
| 101 | |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 102 | Configuration |
| 103 | ------------- |
| 104 | .. note:: QoS and slicing configuration is currently statically configured at switch startup. |
| 105 | Dynamic configuration will be supported in a next SD-Fabric release. |
| 106 | |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 107 | QoS and slicing uses switch queue configuration provided via the |
| 108 | ``vendor_config`` portion of the Stratum Chassis Config (see |
| 109 | :ref:`stratum_chassis_config`), where the queues and schedulers can be |
| 110 | configured. For more information on the format of ``vendor_config``, see the |
| 111 | `guide for running Stratum on Tofino-based switches |
| 112 | <https://github.com/stratum/stratum/blob/main/stratum/hal/bin/barefoot/README.run.md>`_ |
| 113 | in the Stratum repository. |
| 114 | |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 115 | We provide a convenient `script <https://github.com/stratum/fabric-tna/blob/main/util/gen-stratum-qos-config.py>`_ |
| 116 | to generate the configuration starting from a higher-level description provided via a YAML file. |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 117 | This file allows to configure the parameters for the traffic classes listed in the above section. |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 118 | |
| 119 | Here's a list of parameters that you can configure via the YAML QoS configuration file: |
| 120 | |
| 121 | * ``max_cells``: Maximum number of buffer cells, depends on the ASIC SKU/revision. |
| 122 | |
| 123 | * ``pool_allocations``: Percentage of buffer cells allocated to each traffic class. |
| 124 | The sum should be 100. Usually, we leave a portion of the buffer ``unassigned`` |
| 125 | for queues that do not have a pool (yet). |
| 126 | Example of such queues are those for the recirculation port, CPU port, etc. |
| 127 | |
| 128 | .. code-block:: yaml |
| 129 | |
| 130 | pool_allocations: |
| 131 | control: 1 |
| 132 | realtime: 9 |
| 133 | elastic: 80 |
| 134 | besteffort: 9 |
| 135 | unassigned: 1 |
| 136 | |
| 137 | * **Control** Traffic Class: The available bandwidth dedicated to Control traffic is divided in *slots*. |
| 138 | Each slot has a maximum rate and burst (in packets of the given MTU). |
| 139 | A slice can use one or more slots by appropriately configuring meters in the fabric ingress pipeline. |
| 140 | |
| 141 | * ``control_slot_count``: Number of slots. |
| 142 | * ``control_slot_rate_pps``: Packet per second rate of each slot. |
| 143 | * ``control_slot_burst_pkts``: Number of packets per burst of each slot. |
| 144 | * ``control_mtu_bytes``: MTU of packets for the PPS and burst values. |
| 145 | |
| 146 | .. code-block:: yaml |
| 147 | |
| 148 | control_slot_count: 50 |
| 149 | control_slot_rate_pps: 100 |
| 150 | control_slot_burst_pkts: 10 |
| 151 | control_mtu_bytes: 1500 |
| 152 | |
| 153 | * **Real-Time** Traffic Class Configuration: |
| 154 | |
| 155 | * ``realtime_max_rates_bps``: List of maximum shaping rates for Real-Time queues, |
| 156 | one per slice requesting such service. |
| 157 | |
| 158 | * ``realtime_max_burst_s``: Maximum amount of time that a Real-Time queue can |
| 159 | burst at the port speed. This parameter is used to limit delay for Elastic |
| 160 | queues. |
| 161 | |
| 162 | .. code-block:: yaml |
| 163 | |
| 164 | realtime_max_rates_bps: |
| 165 | - 45000000 # 45 Mbps |
| 166 | - 30000000 # 30 Mbps |
| 167 | - 25000000 # 25 Mbps |
| 168 | realtime_max_burst_s: 0.005 # 5 ms |
| 169 | |
| 170 | * **Elastic** Traffic Class Configuration: |
| 171 | |
| 172 | * ``elastic_min_rates_bps``: List of minimum guaranteed rates for Elastic queues, |
| 173 | one per slice requesting such service. |
| 174 | |
| 175 | .. code-block:: yaml |
| 176 | |
| 177 | elastic_min_rates_bps: |
| 178 | - 100000000 # 100 Mbps |
| 179 | - 200000000 # 200 Mbps |
| 180 | |
| 181 | * ``port_templates`` section: List of switch port for which we want to configure |
| 182 | queues. |
| 183 | |
| 184 | Every ``port_templates`` element contains: |
| 185 | |
| 186 | * ``descr``: Description of the port purpose. |
| 187 | |
| 188 | * ``rate_bps``: Port speed in bit per second. |
| 189 | |
| 190 | * ``is_shaping_enabled``: ``true`` if the rate is enforced using shaping, |
| 191 | ``false`` if the rate is the channel speed. |
| 192 | |
| 193 | * ``shaping_burst_bytes``: Burst size in bytes, meaningful only if port speed |
| 194 | is shaped (when ``is_shaping_enabled: true``). |
| 195 | |
| 196 | * ``queue_count``: Number of queues assigned to the port. |
| 197 | |
| 198 | * ``port_ids``: List of Stratum port IDs (:ref:`singleton_port` from Stratum Chassis Config), |
| 199 | using this port template. Used for port that corresponds to switch front-panel ports. |
| 200 | |
| 201 | Mutually exclusive with ``sdk_port_ids`` field. |
| 202 | |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 203 | * ``sdk_port_ids``: List of SDK port numbers (i.e., Tofino ``DP_ID``) using this port template. |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 204 | Used for internal ports (e.g., recirculation ports). |
| 205 | |
| 206 | Mutually exclusive with ``port_ids`` field. |
| 207 | |
| 208 | .. code-block:: yaml |
| 209 | |
| 210 | port_templates: |
| 211 | - descr: "Base station" |
| 212 | rate_bps: 1000000000 # 1 Gbps |
| 213 | is_shaping_enabled: true |
| 214 | shaping_burst_bytes: 18000 # 2x jumbo frames |
| 215 | queue_count: 16 |
| 216 | port_ids: |
| 217 | - 100 |
| 218 | - descr: "Servers" |
| 219 | port_ids: |
| 220 | - 200 |
| 221 | rate_bps: 40000000000 # 40 Gbps |
| 222 | is_shaping_enabled: false |
| 223 | queue_count: 16 |
| 224 | - descr: "Recirculation" |
| 225 | sdk_port_ids: |
| 226 | - 68 |
| 227 | rate_bps: 100000000000 # 100 Gbps |
| 228 | is_shaping_enabled: false |
| 229 | queue_count: 16 |
| 230 | |
| 231 | 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>`_. |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 232 | |
| 233 | REST API |
| 234 | -------- |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 235 | We provide REST APIs with support for adding/removing/querying slices and |
| 236 | traffic classes, as well as flow classification. |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 237 | |
| 238 | Slice |
| 239 | ^^^^^ |
| 240 | |
| 241 | Add a slice |
| 242 | """"""""""" |
| 243 | A POST request with Slice ID as path parameter. |
| 244 | ``/slicing/slice/{sliceId}`` |
| 245 | |
| 246 | .. image:: ../images/qos-rest-slice-add.png |
| 247 | :width: 700px |
| 248 | |
| 249 | Remove a slice |
| 250 | """"""""""""""" |
| 251 | A DELETE request with Slice ID as path parameter. |
| 252 | ``/slicing/slice/{sliceId}`` |
| 253 | |
| 254 | .. image:: ../images/qos-rest-slice-remove.png |
| 255 | :width: 700px |
| 256 | |
| 257 | Get all slices |
| 258 | """""""""""""" |
| 259 | A GET request. |
| 260 | Returns a collection of slice id. |
| 261 | /slicing/slice |
| 262 | |
| 263 | .. image:: ../images/qos-rest-slice-get.png |
| 264 | :width: 700px |
| 265 | |
| 266 | Traffic Class |
| 267 | ^^^^^^^^^^^^^ |
| 268 | .. tip:: |
| 269 | Traffic Class has following attributes: ``BEST_EFFORT``, ``CONTROL``, ``REAL_TIME``, ``ELASTIC``. |
| 270 | |
| 271 | Add a traffic class to a slice |
| 272 | """""""""""""""""""""""""""""" |
| 273 | A POST request with Slice ID and Traffic Class as path parameters. |
| 274 | ``/slicing/tc/{sliceId}/{tc}`` |
| 275 | |
| 276 | .. image:: ../images/qos-rest-tc-add.png |
| 277 | :width: 700px |
| 278 | |
| 279 | Remove a traffic class from a slice |
| 280 | """"""""""""""""""""""""""""""""""" |
| 281 | A DELETE request with Slice ID and Traffic Class as path parameters. |
| 282 | ``/slicing/tc/{sliceId}/{tc}`` |
| 283 | |
| 284 | .. image:: ../images/qos-rest-tc-remove.png |
| 285 | :width: 700px |
| 286 | |
| 287 | Get all traffic classes from a slice |
| 288 | """""""""""""""""""""""""""""""""""" |
| 289 | A GET request with Slice ID as path parameters. |
| 290 | Returns a collection of traffic class. |
| 291 | ``/slicing/tc/{sliceId}`` |
| 292 | |
| 293 | .. image:: ../images/qos-rest-tc-get.png |
| 294 | :width: 700px |
| 295 | |
| 296 | Classify Flow |
| 297 | ^^^^^^^^^^^^^ |
| 298 | |
| 299 | A flow can be defined as |
| 300 | |
| 301 | .. code-block:: json |
| 302 | |
| 303 | { |
| 304 | "criteria": [ |
| 305 | { |
| 306 | "type": "IPV4_SRC", |
| 307 | "ip": "10.0.0.1/32" |
| 308 | }, |
| 309 | { |
| 310 | "type": "IPV4_DST", |
| 311 | "ip": "10.0.0.2/32" |
| 312 | }, |
| 313 | { |
| 314 | "type": "IP_PROTO", |
| 315 | "protocol": 6 |
| 316 | }, |
| 317 | { |
| 318 | "type": "TCP_SRC", |
| 319 | "tcpPort": 1000 |
| 320 | }, |
| 321 | { |
| 322 | "type": "TCP_DST", |
| 323 | "tcpPort": 80 |
| 324 | }, |
| 325 | { |
| 326 | "type": "UDP_SRC", |
| 327 | "udpPort": 1000 |
| 328 | }, |
| 329 | { |
| 330 | "type": "UDP_DST", |
| 331 | "udpPort": 1812 |
| 332 | } |
| 333 | ] |
| 334 | } |
| 335 | |
| 336 | - ``IPV4_SRC``: Source IPv4 prefix |
| 337 | |
| 338 | - ``IPV4_DST``: Destination IPv4 prefix |
| 339 | |
| 340 | - ``IP_PROTO``: IP Protocol, accept 6 (TCP) and 17 (UDP) |
| 341 | |
| 342 | - ``TCP_SRC``: Source L4 (TCP) port |
| 343 | |
| 344 | - ``TCP_DST``: Destination L4 (TCP) port |
| 345 | |
| 346 | - ``UDP_SRC``: Source L4 (UDP) port |
| 347 | |
| 348 | - ``UDP_DST``: Destination L4 (UDP) port |
| 349 | |
| 350 | .. note:: |
| 351 | SD-Fabric currently supports 5-tuple only. |
| 352 | |
| 353 | Classify a flow to a slice and traffic class |
| 354 | """""""""""""""""""""""""""""""""""""""""""" |
| 355 | A POST request with Slice ID and Traffic Class as path parameters. |
| 356 | And a Json of a flow as body parameters. |
| 357 | ``/slicing/flow/{sliceId}/{tc}`` |
| 358 | |
| 359 | .. image:: ../images/qos-rest-classifier-add.png |
| 360 | :width: 700px |
| 361 | |
| 362 | Remove a flow from a slice and traffic class |
| 363 | """""""""""""""""""""""""""""""""""""""""""" |
| 364 | A DELETE request with Slice ID and Traffic Class as path parameters. |
| 365 | And a Json of a flow as body parameters. |
| 366 | ``/slicing/flow/{sliceId}/{tc}`` |
| 367 | |
| 368 | .. image:: ../images/qos-rest-classifier-remove.png |
| 369 | :width: 700px |
| 370 | |
| 371 | Get all classified flows from a slice and traffic class |
| 372 | """"""""""""""""""""""""""""""""""""""""""""""""""""""" |
| 373 | A GET request with Slice ID and Traffic Class as path parameters. |
| 374 | Returns a collection of flow. |
| 375 | ``/slicing/flow/{sliceId}`` |
| 376 | |
| 377 | .. image:: ../images/qos-rest-classifier-get.png |
| 378 | :width: 700px |