Skip to content

Commit 81a8386

Browse files
authored
Disable pfcwd forward action config for cisco-8000. (#1848)
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 [email protected] 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.
1 parent 0b5f90b commit 81a8386

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pfcwd/main.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from tabulate import tabulate
1212
from utilities_common import multi_asic as multi_asic_util
1313
from utilities_common import constants
14-
from sonic_py_common import logger
14+
from sonic_py_common import device_info, logger
1515

1616
SYSLOG_IDENTIFIER = "config"
1717

@@ -59,6 +59,7 @@
5959

6060
CONFIG_DB_PFC_WD_TABLE_NAME = 'PFC_WD'
6161
PORT_QOS_MAP = "PORT_QOS_MAP"
62+
UNSUPPORTED_FORWARD_ACTION_ASICS = ["cisco-8000"]
6263

6364
# Main entrypoint
6465
@click.group()
@@ -117,6 +118,8 @@ def __init__(
117118
)
118119
self.table = []
119120
self.all_ports = []
121+
version_info = device_info.get_sonic_version_info()
122+
self.asic_type = version_info.get('asic_type')
120123

121124
@multi_asic_util.run_on_multi_asic
122125
def collect_stats(self, empty, queues):
@@ -250,7 +253,7 @@ def start(self, action, restoration_time, ports, detection_time):
250253

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

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

280+
if action == 'forward' and self.asic_type in UNSUPPORTED_FORWARD_ACTION_ASICS:
281+
log.log_warning("SKIPPED: PFC WD 'forward' action not supported on asic '{}'".format(self.asic_type), also_print_to_console=True)
282+
return
283+
277284
pfcwd_info = {
278285
'detection_time': detection_time,
279286
}

0 commit comments

Comments
 (0)