Skip to content

Commit

Permalink
Disable pfcwd forward action config for cisco-8000. (sonic-net#1848)
Browse files Browse the repository at this point in the history
Disable pfcwd forward action config for cisco-8000.
Do not configure pfcwd if pfc is not configured on a port
This PR is in association with: sonic-net/sonic-swss#1748 where PFC-WD forward action is disabled for cisco-8000 platform.

Signed-off-by: Alpesh S Patel alpesh@cisco.com

What I did
There are two changes of interest:
- disables pfcwd forward action configuration from pfcwd command
- in the pfcwd script, adds a check to enable pfcwd configuration on a port only if it has pfc enabled. If config_db.json has an empty entry like: "pfc_enable" : "", and subsequently pfcwd is configured, swss/orchagent throws an error logs

How to verify it
- can be verified on cisco-8000 platform. It is a no-op for other platforms
# pfcwd start -a forward 400 -r 400
SKIPPED: PFC WD 'forward' action not supported on asic 'cisco-8000'

- for a single port, in /etc/sonic/config_db.json, set no pfc enable bits by setting:
"pfc_enable" :  "" for atleast 1 port.
without this change, see the logs in syslog. With this change, there will just be a log on console.
  • Loading branch information
alpeshspatel authored Sep 30, 2021
1 parent 0b5f90b commit 81a8386
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from tabulate import tabulate
from utilities_common import multi_asic as multi_asic_util
from utilities_common import constants
from sonic_py_common import logger
from sonic_py_common import device_info, logger

SYSLOG_IDENTIFIER = "config"

Expand Down Expand Up @@ -59,6 +59,7 @@

CONFIG_DB_PFC_WD_TABLE_NAME = 'PFC_WD'
PORT_QOS_MAP = "PORT_QOS_MAP"
UNSUPPORTED_FORWARD_ACTION_ASICS = ["cisco-8000"]

# Main entrypoint
@click.group()
Expand Down Expand Up @@ -117,6 +118,8 @@ def __init__(
)
self.table = []
self.all_ports = []
version_info = device_info.get_sonic_version_info()
self.asic_type = version_info.get('asic_type')

@multi_asic_util.run_on_multi_asic
def collect_stats(self, empty, queues):
Expand Down Expand Up @@ -250,7 +253,7 @@ def start(self, action, restoration_time, ports, detection_time):

def verify_pfc_enable_status_per_port(self, port, pfcwd_info):
pfc_status = self.config_db.get_entry(PORT_QOS_MAP, port).get('pfc_enable')
if pfc_status is None:
if pfc_status is None or pfc_status == "":
log.log_warning("SKIPPED: PFC is not enabled on port: {}".format(port), also_print_to_console=True)
return

Expand All @@ -274,6 +277,10 @@ def start_cmd(self, action, restoration_time, ports, detection_time):
if len(ports) == 0:
ports = all_ports

if action == 'forward' and self.asic_type in UNSUPPORTED_FORWARD_ACTION_ASICS:
log.log_warning("SKIPPED: PFC WD 'forward' action not supported on asic '{}'".format(self.asic_type), also_print_to_console=True)
return

pfcwd_info = {
'detection_time': detection_time,
}
Expand Down

0 comments on commit 81a8386

Please sign in to comment.