[ovs-dev] [PATCH v18 2/8] ovs-kmod-ctl: Load kernel module psample

Chris Mi cmi at nvidia.com
Mon Nov 15 02:53:06 UTC 2021


Load kernel module psample to receive sampled packets from TC.
Before removing kernel module psample, remove act_sample first.

Signed-off-by: Chris Mi <cmi at nvidia.com>
Reviewed-by: Eli Britstein <elibr at nvidia.com>
Acked-by: Eelco Chaudron <echaudro at redhat.com>
---
 utilities/ovs-kmod-ctl.in | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/utilities/ovs-kmod-ctl.in b/utilities/ovs-kmod-ctl.in
index 19f100964..6fa945a83 100644
--- a/utilities/ovs-kmod-ctl.in
+++ b/utilities/ovs-kmod-ctl.in
@@ -28,6 +28,14 @@ for dir in "$sbindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do
 done
 
 insert_mods () {
+    # Try loading psample kernel module.
+    modinfo psample > /dev/null 2>&1
+    if test $? = 0; then
+        action "Inserting psample module" modprobe psample
+    else
+        log_warning_msg "No psample module, can't offload sFlow action"
+    fi
+
     # Try loading openvswitch kernel module.
     action "Inserting openvswitch module" modprobe openvswitch
 }
@@ -95,6 +103,12 @@ remove_kmods() {
     if test -e /sys/module/vxlan; then
         action "Forcing removal of vxlan module" rmmod vxlan
     fi
+    if test -e /sys/module/act_sample; then
+        action "Forcing removal of act_sample module" rmmod act_sample
+    fi
+    if test -e /sys/module/psample; then
+        action "Forcing removal of psample module" rmmod psample
+    fi
 }
 
 usage () {
-- 
2.30.2



More information about the dev mailing list