Priority Flow Control – PFC

Priority flow control (PFC) provides an enhancement to the existing pause mechanism in Ethernet. The current Ethernet pause option stops all traffic on a link.
PFC creates eight separate virtual links on the physical link and allows any of these links to be paused and restarted independently, enabling the network to
create a lossless class of service for an individual virtual link.

PFC oversees:

  • Mapping of an incoming packet to a priority according to its DSCP value or IEEE priority.
  • Mapping of the priority to an egress queue.
  • Sending a PFC frame for lossless priority if it runs out of headroom.
  • Ceasing the egress queue on receiving a PFC frame.

These operations depend on the mappings among queue, priorities and DSCP, which are defined below.

CONFIG_DB Tables

PFC uses the following tables in CONFIG_DB:

Table

Description

TC_TO_QUEUE_MAP

In the egress direction, maps the traffic class to an egress queue.

DSCP_TO_TC_MAP

In the ingress direction, maps the DSCP field in an IP packet into a traffic class. By utilizing this table and the TC_TO_QUEUE_MAP table, a packet can be mapped from its DSCP field to the egress queue. In case there is a congestion in the egress queue, the back-pressure mechanism is triggered, and the PFC frame can be sent. The priority in the PFC frame is determined by TC to priority group mapping table.

MAP_PFC_PRIORITY_TO_QUEUE

Maps the priority in the received PFC frames to an egress queue so that the switch knows which egress to resume or pause.

PFC_PRIORITY_TO_PRIORITY_GROUP_MAP

Maps PFC priority to a priority group.

TC_TO_PRIORITY_GROUP_MAP

Maps the PFC priority to a priority group and enables the switch to set the PFC priority in xon/xoff frames in order to resume/pause corresponding egress queue at the link peer.

PORT_QOS_MAP

Defines the mappings adopted by a port, including:
– tc_to_queue_map, default value is TC_TO_QUEUE_MAP/AZURE
– dscp_to_tc_map, default value is DSCP_TO_TC_MAP/AZURE
– pfc_to_queue_map, default value is MAP_PFC_PRIORITY_TO_QUEUE/AZURE
– pfc_to_pg_map, default value is PFC_PRIORITY_TO_PRIORITY_GROUP_MAP/AZURE
– tc_to_pg_map, default value is TC_TO_PRIORITY_GROUP_MAP

Configure PFC

All the mapping tables are simple integer-to-integer mappings.

To update the mappings:

  1. Create a temporary JSON file containing the new port mapping configuration.
    admin@sonic:~$ sudo nano new_pfc.json
    {
      "DSCP_TO_TC_MAP": {
         "AZURE": {
             "0": "1",
             "1": "1",
             "2": "1",
             "3": "3",
             "4": "4",
             "5": "2",
             "6": "1",
             "7": "1",
             "8": "0",
             "9": "1",
             "10": "1",
             "11": "1",
             "12": "1",
             "13": "1",
             "14": "1",
             "15": "1",
             "16": "1",
             "17": "1",
             "18": "1",
             "19": "1",
             "20": "1",
             "21": "1",
             "22": "1",
             "23": "1",
             "24": "1",
             "25": "1",
             "26": "1",
             "27": "1",
             "28": "1",
             "29": "1",
             "30": "1",
             "31": "1",
             "32": "1",
             "33": "1",
             "34": "1",
             "35": "1",
             "36": "1",
             "37": "1",
             "38": "1",
             "39": "1",
             "40": "1",
             "41": "1",
             "42": "1",
             "43": "1",
             "44": "1",
             "45": "1",
             "46": "5",
             "47": "1",
             "48": "6",
             "49": "1",
             "50": "1",
             "51": "1",
             "52": "1",
             "53": "1",
             "54": "1",
             "55": "1",
             "56": "1",
             "57": "1",
             "58": "1",
             "59": "1",
             "60": "1",
             "61": "1",
             "62": "1",
             "63": "1"
         }
       },
    "MAP_PFC_PRIORITY_TO_QUEUE": {
      "AZURE": {
          "0": "0",
          "1": "1",
          "2": "2",
          "3": "3",
          "4": "4",
          "5": "5",
          "6": "6",
          "7": "7"
      }
    },
    "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": {
      "AZURE": {
          "3": "3",
          "4": "4"
      }
    },
    "PORT_QOS_MAP": {
      "Ethernet0": {
          "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
          "pfc_enable": "3,4",
          "pfc_to_pg_map": "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]",
          "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
          "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
          "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]"
      }
    },
    "SCHEDULER": {
      "scheduler.0": {
          "type": "DWRR",
          "weight": "14"
      },
      "scheduler.1": {
          "type": "DWRR",
          "weight": "15"
      }
    },
    "TC_TO_PRIORITY_GROUP_MAP": {
      "AZURE": {
          "0": "0",
          "1": "0",
          "2": "0",
          "3": "3",
          "4": "4",
          "5": "0",
          "6": "0",
          "7": "7"
      }
    },
    "TC_TO_QUEUE_MAP": {
        "AZURE": {
            "0": "0",
            "1": "1",
            "2": "2",
            "3": "3",
            "4": "4",
            "5": "5",
            "6": "6",
            "7": "7"
        }
      }
    }
  2. Deploy the new configuration:
    admin@sonic:~$ sudo sonic-cfggen -j new_pfc.json -w