summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-06-26 11:24:01 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2023-06-27 10:54:04 +0000
commit8f402c2ba47ed3ccbf94f9f037ec6e18d6b975ea (patch)
tree7c375531f875abbea9236e8f1bc2d29f4da93eb6 /python
parent3f197566f957cb0e354a474bccee0aefd62b33be (diff)
downloadvyos-1x-8f402c2ba47ed3ccbf94f9f037ec6e18d6b975ea.tar.gz
vyos-1x-8f402c2ba47ed3ccbf94f9f037ec6e18d6b975ea.zip
T1797: Add initial vpp configuration
Add initial configuration mode for VPP (PoC) set vpp cpu corelist-workers '2' set vpp cpu main-core '1' set vpp interface eth1 num-rx-desc '256' set vpp interface eth1 num-rx-queues '512' set vpp interface eth1 num-tx-desc '256' set vpp interface eth1 num-tx-queues '512' set vpp interface eth1 pci '0000:02:00.0' set vpp interface eth1 rx-mode 'polling' set vpp interface eth2 pci '0000:08:00.0' Limitation: - 'set vpp interface ethX pci auto' works only per first commit, then interface detached from default stack and creates tun interface 'ethX' to communicate with default stack. In this case we can't get PCI address via ethtool for 'tun' interfaces. But we can set pci address manualy. - Interface sync between default stack and VPP-DPDK stack After vpp change it doesn't trigger iproute2 for changes (should be written later) I.e. if we change something in vpp per each commit it restarts vpp.service it gets empty interface config as we don't configure vpp directly and it should be configured via iproute2 But then if we do any change on interface (for example description) it gets IP address, MTU, state, etc.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ethtool.py3
-rw-r--r--python/vyos/vpp.py28
2 files changed, 30 insertions, 1 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 68234089c..9b7da89fa 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -21,7 +21,8 @@ from vyos.util import popen
# These drivers do not support using ethtool to change the speed, duplex, or
# flow control settings
_drivers_without_speed_duplex_flow = ['vmxnet3', 'virtio_net', 'xen_netfront',
- 'iavf', 'ice', 'i40e', 'hv_netvsc', 'veth', 'ixgbevf']
+ 'iavf', 'ice', 'i40e', 'hv_netvsc', 'veth', 'ixgbevf',
+ 'tun']
class Ethtool:
"""
diff --git a/python/vyos/vpp.py b/python/vyos/vpp.py
new file mode 100644
index 000000000..decc6c087
--- /dev/null
+++ b/python/vyos/vpp.py
@@ -0,0 +1,28 @@
+# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+from vyos.util import call
+
+
+def lcp_create_host_interface(ifname):
+ """LCP reprepsents a connection point between VPP dataplane
+ and the host stack
+ """
+ return call(f'vppctl lcp create {ifname} host-if {ifname}')
+
+
+def set_interface_rx_mode(ifname, mode):
+ """Rx mode"""
+ return call(f'sudo vppctl set interface rx-mode {ifname} {mode}')