From af5597bfa41521e10f4ef5095f137b2ef5bcd661 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com>
Date: Wed, 20 May 2020 15:05:03 +0200
Subject: [PATCH] [xdp] Add XDP plugin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This adds a plugin for gathering information about the loaded XDP programs
on a system, using the xdp-loader tool in the xdp-tools package. This is
complementary with the existing eBPF plugin, because this plugin supports
getting status for multiple XDP programs on each interface as supported by
libxdp.
For now, this just prints the output of 'xdp-loader status' which will list
any XDP programs attached. We don't currently support structured
output (such as JSON) from xdp-tools, but should we add that in the future
we can of course update this plugin.
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
sos/plugins/xdp.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 sos/plugins/xdp.py
diff --git a/sos/plugins/xdp.py b/sos/plugins/xdp.py
new file mode 100644
index 00000000..2e18048b
--- /dev/null
+++ b/sos/plugins/xdp.py
@@ -0,0 +1,21 @@
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, \
+ UbuntuPlugin
+
+
+class Xdp(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+
+ short_desc = 'XDP program information'
+ plugin_name = 'xdp'
+ profiles = ('system', 'kernel', 'network')
+ packages = ('xdp-tools',)
+
+ def setup(self):
+ self.add_cmd_output('xdp-loader status')
--
diff --git a/sos/plugins/xdp.py b/sos/plugins/xdp.py
--- a/sos/plugins/xdp.py
+++ b/sos/plugins/xdp.py
@@ -11,6 +11,8 @@ from sos.plugins import Plugin, RedHatPl
class Xdp(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+ """XDP program information
+ """
short_desc = 'XDP program information'
plugin_name = 'xdp'
--
2.21.3