From 4983761dc4f145a4bfa68ddd0b69177bff7ddb6d Mon Sep 17 00:00:00 2001 From: yogananth subramanian Date: Fri, 7 May 2021 19:44:29 +0530 Subject: [PATCH] Add support for pmd auto balance parameters in open_vswitch This patch enables the end user to customize PMD load threshold (pmd-auto-lb-load-threshold), variance improvement threshold (pmd-auto-lb-improvement-threshold), minimum time between 2 consecutive PMD auto load balancing iterations(pmd-auto-lb-rebal-interval) rather than using the default values. Signed-off-by: yogananth subramanian Change-Id: Ibb8fce149f2cf9201fc3fd2ff0fb5e1ccd1c0716 --- doc/source/roles/role-tripleo-ovs-dpdk.rst | 28 ++++++++++ .../roles/tripleo_ovs_dpdk/defaults/main.yml | 3 ++ .../molecule/default/tests/test_default.py | 15 ++++++ .../molecule/positive/converge.yml | 3 ++ .../molecule/positive/tests/test_positive.py | 18 +++++++ .../roles/tripleo_ovs_dpdk/tasks/config.yml | 54 +++++++++++++++++++ 6 files changed, 121 insertions(+) diff --git a/doc/source/roles/role-tripleo-ovs-dpdk.rst b/doc/source/roles/role-tripleo-ovs-dpdk.rst index 033143b14..5e506c1c3 100644 --- a/doc/source/roles/role-tripleo-ovs-dpdk.rst +++ b/doc/source/roles/role-tripleo-ovs-dpdk.rst @@ -95,6 +95,34 @@ Role Defaults - **Default**: ``false`` - **Examples**: ``true`` +- ``tripleo_ovs_dpdk_pmd_load_threshold`` + + - **Description**: (*Optional*) Minimum PMD thread load threshold, in range + 0 to 100. Its a string with a number, specifies the minimum + PMD thread load threshold (% of used cycles) of any non-isolated PMD threads + when a PMD Auto Load Balance may be triggered. + - **Default**: ``''`` + - **Examples**: ``'50'`` + +- ``tripleo_ovs_dpdk_pmd_improvement_threshold`` + + - **Description**: (*Optional*) PMD load variance improvement threshold, in range + 0 to 100. Its a string with a number, specifies the minimum evaluated % improvement + in load distribution across the non-isolated PMD threads that will allow + a PMD Auto Load Balance to occur. + Note, setting this parameter to 0 will always allow an auto load balance to occur + regardless of estimated improvement or not. + - **Default**: ``''`` + - **Examples**: ``'10'`` + +- ``tripleo_ovs_dpdk_pmd_rebal_interval`` + + - **Description**: (*Optional*) PMD auto load balancing interval, in range + 0 to 20,000. Its a string with a number, specifies the minimum time (in minutes) + between 2 consecutive PMD Auto Load Balancing iterations. The defaul value is 1 min. + - **Default**: ``''`` + - **Examples**: ``'5'`` + Modules ------- diff --git a/tripleo_ansible/roles/tripleo_ovs_dpdk/defaults/main.yml b/tripleo_ansible/roles/tripleo_ovs_dpdk/defaults/main.yml index b50121d45..d69a75504 100644 --- a/tripleo_ansible/roles/tripleo_ovs_dpdk/defaults/main.yml +++ b/tripleo_ansible/roles/tripleo_ovs_dpdk/defaults/main.yml @@ -29,3 +29,6 @@ tripleo_ovs_dpdk_handler_cores: "" tripleo_ovs_dpdk_emc_insertion_probablity: "" tripleo_ovs_dpdk_enable_tso: false tripleo_ovs_dpdk_pmd_auto_lb: false +tripleo_ovs_dpdk_pmd_load_threshold: "" +tripleo_ovs_dpdk_pmd_improvement_threshold: "" +tripleo_ovs_dpdk_pmd_rebal_interval: "" diff --git a/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/default/tests/test_default.py b/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/default/tests/test_default.py index 8b5459493..518bfa48b 100644 --- a/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/default/tests/test_default.py +++ b/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/default/tests/test_default.py @@ -75,3 +75,18 @@ def test_positive_emc_prob(host): def test_positive_enable_tso(host): other_config = get_config(host) assert 'userspace-tso-enable' not in other_config + + +def test_positive_pmd_load_threshold(host): + other_config = get_config(host) + assert 'pmd-auto-lb-load-threshold' not in other_config + + +def test_positive_pmd_improvement_threshold(host): + other_config = get_config(host) + assert 'pmd-auto-lb-improvement-threshold' not in other_config + + +def test_positive_pmd_rebal_interval(host): + other_config = get_config(host) + assert 'pmd-auto-lb-rebal-interval' not in other_config diff --git a/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/positive/converge.yml b/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/positive/converge.yml index d1f6f2360..90b4ebcbb 100644 --- a/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/positive/converge.yml +++ b/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/positive/converge.yml @@ -31,3 +31,6 @@ tripleo_ovs_dpdk_handler_cores: 2 tripleo_ovs_dpdk_emc_insertion_probablity: 0 tripleo_ovs_dpdk_enable_tso: true + tripleo_ovs_dpdk_pmd_load_threshold: 50 + tripleo_ovs_dpdk_pmd_improvement_threshold: 10 + tripleo_ovs_dpdk_pmd_rebal_interval: 5 diff --git a/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/positive/tests/test_positive.py b/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/positive/tests/test_positive.py index 0194f0982..678b250df 100644 --- a/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/positive/tests/test_positive.py +++ b/tripleo_ansible/roles/tripleo_ovs_dpdk/molecule/positive/tests/test_positive.py @@ -80,3 +80,21 @@ def test_positive_enable_tso(host): other_config = get_config(host) tso_enabled = other_config['userspace-tso-enable'].replace('"', '') assert tso_enabled == "true" + + +def test_positive_pmd_load_threshold(host): + other_config = get_config(host) + pmd_load_threshold = other_config['pmd-auto-lb-load-threshold'].replace('"', '') + assert pmd_load_threshold == "50" + + +def test_positive_pmd_improvement_threshold(host): + other_config = get_config(host) + pmd_improvement_threshold = other_config['pmd-auto-lb-improvement-threshold'].replace('"', '') + assert pmd_improvement_threshold == "10" + + +def test_positive_pmd_rebal_interval(host): + other_config = get_config(host) + pmd_rebal_interval = other_config['pmd-auto-lb-rebal-interval'].replace('"', '') + assert pmd_rebal_interval == "5" diff --git a/tripleo_ansible/roles/tripleo_ovs_dpdk/tasks/config.yml b/tripleo_ansible/roles/tripleo_ovs_dpdk/tasks/config.yml index ff57502ad..7b593620b 100644 --- a/tripleo_ansible/roles/tripleo_ovs_dpdk/tasks/config.yml +++ b/tripleo_ansible/roles/tripleo_ovs_dpdk/tasks/config.yml @@ -161,3 +161,57 @@ col: other_config key: pmd-auto-lb when: not tripleo_ovs_dpdk_pmd_auto_lb|bool + +- name: Set minimum PMD thread load threshold + openvswitch_db: + table: open_vswitch + record: . + col: other_config + key: pmd-auto-lb-load-threshold + value: "{{ tripleo_ovs_dpdk_pmd_load_threshold }}" + when: tripleo_ovs_dpdk_pmd_load_threshold|string + +- name: Remove minimum PMD thread load threshold + openvswitch_db: + state: absent + table: open_vswitch + record: . + col: other_config + key: pmd-auto-lb-load-threshold + when: not tripleo_ovs_dpdk_pmd_load_threshold|string + +- name: Set PMD load variance improvement threshold + openvswitch_db: + table: open_vswitch + record: . + col: other_config + key: pmd-auto-lb-improvement-threshold + value: "{{ tripleo_ovs_dpdk_pmd_improvement_threshold }}" + when: tripleo_ovs_dpdk_pmd_improvement_threshold|string + +- name: Remove PMD load variance improvement threshold + openvswitch_db: + state: absent + table: open_vswitch + record: . + col: other_config + key: pmd-auto-lb-improvement-threshold + when: not tripleo_ovs_dpdk_pmd_improvement_threshold|string + +- name: Set PMD auto load balancing interval + openvswitch_db: + table: open_vswitch + record: . + col: other_config + key: pmd-auto-lb-rebal-interval + value: "{{ tripleo_ovs_dpdk_pmd_rebal_interval }}" + when: tripleo_ovs_dpdk_pmd_rebal_interval|string + +- name: Remove PMD auto load balancing interval + openvswitch_db: + state: absent + table: open_vswitch + record: . + col: other_config + key: pmd-auto-lb-rebal-interval + when: not tripleo_ovs_dpdk_pmd_rebal_interval|string