From b52ac80d8fa06a92dcf5ba389b4c5c02535d7f40 Mon Sep 17 00:00:00 2001 From: abdallahyas Date: Tue, 6 Oct 2020 11:31:53 +0000 Subject: [PATCH] Enable smfs software steering when switchdev is enabled Before this point, when switchdev is enabled, the software steering mode is not taken into consideration. This patch tries to enable the smfs software steering mode when the switchdev mode is enabled, and if it fails, a warning message would be printed indicating the failur of the proccess, and the software steering mode will not change from its current value. Change-Id: I2cee0a5509db7a1c13c9baa056d9d75d16acb0ed (cherry picked from commit c9b8691f05b35e00a9fec9f013ed0db4942a36f4) --- os_net_config/sriov_config.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/os_net_config/sriov_config.py b/os_net_config/sriov_config.py index 11b8f5b7..2f2d97bb 100644 --- a/os_net_config/sriov_config.py +++ b/os_net_config/sriov_config.py @@ -220,6 +220,8 @@ def configure_sriov_pf(execution_from_cli=False, restart_openvswitch=False): trigger_udev_rule = add_udev_rule_for_sriov_pf(item['name'])\ or trigger_udev_rule + configure_smfs_software_steering(item['name']) + configure_switchdev(item['name']) # Adding a udev rule to rename vf-representors @@ -432,6 +434,17 @@ def configure_switchdev(pf_name): raise +def configure_smfs_software_steering(pf_name): + pf_pci = get_pf_pci(pf_name) + try: + processutils.execute('/usr/sbin/devlink', 'dev', 'param', 'set', + 'pci/%s' % pf_pci, 'name', 'flow_steering_mode', + 'value', 'smfs', 'cmode', 'runtime') + logger.info("Device pci/%s is set to smfs steering mode." % pf_pci) + except processutils.ProcessExecutionError: + logger.warning("Could not set pci/%s to smfs steering mode!") + + def run_ip_config_cmd(*cmd, **kwargs): logger.info("Running %s" % ' '.join(cmd)) try: