From f9c2d3ad2f3abe948361bf0a79831f38d709c7d3 Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Mon, 16 May 2022 15:59:11 +0200 Subject: [PATCH 1/5] ovs, dpdk: add support to rx-queue parameter ``` --- interfaces: - name: ovs-br0 type: ovs-bridge state: up bridge: options: datapath: netdev port: - name: ovs0 - name: ovs0 type: ovs-interface state: up dpdk: devargs: "000:18:00.2" rx-queue: 10 ``` Integration test case added. Signed-off-by: Fernando Fernandez Mancera --- examples/ovsbridge_dpdk_create.yml | 1 + libnmstate/ifaces/ovs.py | 15 +++++++++++- libnmstate/nm/ovs.py | 2 ++ libnmstate/schema.py | 1 + tests/integration/ovs_test.py | 23 ++++++++++++++++-- tests/lib/ifaces/ovs_iface_test.py | 38 +++++++++++++++++++++++++++++- 6 files changed, 76 insertions(+), 4 deletions(-) diff --git a/examples/ovsbridge_dpdk_create.yml b/examples/ovsbridge_dpdk_create.yml index 8395936e..9acc19cd 100644 --- a/examples/ovsbridge_dpdk_create.yml +++ b/examples/ovsbridge_dpdk_create.yml @@ -13,3 +13,4 @@ interfaces: state: up dpdk: devargs: "000:18:00.2" + rx-queue: 10 diff --git a/libnmstate/ifaces/ovs.py b/libnmstate/ifaces/ovs.py index 411455ba..447b8326 100644 --- a/libnmstate/ifaces/ovs.py +++ b/libnmstate/ifaces/ovs.py @@ -279,6 +279,14 @@ class OvsInternalIface(BaseIface): else None ) + @property + def rx_queue(self): + return ( + self.dpdk_config.get(OVSInterface.Dpdk.RX_QUEUE) + if self.dpdk_config + else None + ) + @property def peer(self): return ( @@ -293,9 +301,14 @@ class OvsInternalIface(BaseIface): OVSInterface.Patch.PEER, ) validate_string( - self.patch_config.get(OVSInterface.Dpdk.DEVARGS), + self.dpdk_config.get(OVSInterface.Dpdk.DEVARGS), OVSInterface.Dpdk.DEVARGS, ) + validate_integer( + self.dpdk_config.get(OVSInterface.Dpdk.RX_QUEUE), + OVSInterface.Dpdk.RX_QUEUE, + minimum=0, + ) super().pre_edit_validation_and_cleanup() self._validate_ovs_mtu_mac_confliction() diff --git a/libnmstate/nm/ovs.py b/libnmstate/nm/ovs.py index 9922ffb2..8ddc42d7 100644 --- a/libnmstate/nm/ovs.py +++ b/libnmstate/nm/ovs.py @@ -149,6 +149,7 @@ def create_patch_setting(patch_state): def create_dpdk_setting(dpdk_state): dpdk_setting = NM.SettingOvsDpdk.new() dpdk_setting.props.devargs = dpdk_state[OVSInterface.Dpdk.DEVARGS] + dpdk_setting.props.n_rxq = dpdk_state[OVSInterface.Dpdk.RX_QUEUE] return dpdk_setting @@ -215,6 +216,7 @@ def get_interface_info(act_con): if dpdk_setting: info[OVSInterface.DPDK_CONFIG_SUBTREE] = { OVSInterface.Dpdk.DEVARGS: dpdk_setting.props.devargs, + OVSInterface.Dpdk.RX_QUEUE: dpdk_setting.props.n_rxq, } return info diff --git a/libnmstate/schema.py b/libnmstate/schema.py index 56a6c187..6bd5d54d 100644 --- a/libnmstate/schema.py +++ b/libnmstate/schema.py @@ -300,6 +300,7 @@ class OVSInterface(OvsDB): class Dpdk: DEVARGS = "devargs" + RX_QUEUE = "rx-queue" class OVSBridge(Bridge, OvsDB): -- 2.35.3