Signed-off-by: Zheng Zengkai <zhengzengkai(a)huawei.com>
---
hns3_int_coal_params_setting.service | 11 +++++++++++
hns3_int_coal_params_setting.sh | 14 ++++++++++++++
kernel.spec | 25 ++++++++++++++++++++++++-
3 files changed, 49 insertions(+), 1 deletion(-)
create mode 100644 hns3_int_coal_params_setting.service
create mode 100644 hns3_int_coal_params_setting.sh
diff --git a/hns3_int_coal_params_setting.service b/hns3_int_coal_params_setting.service
new file mode 100644
index 0000000..06fe24b
--- /dev/null
+++ b/hns3_int_coal_params_setting.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Interrupt coalesce parameters setting for hns3 nic
+After=network.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/hns3_int_coal_params_setting.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/hns3_int_coal_params_setting.sh b/hns3_int_coal_params_setting.sh
new file mode 100644
index 0000000..de3ae4c
--- /dev/null
+++ b/hns3_int_coal_params_setting.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# setting optimizing interrupt coalesce parameters for hns3 nic
+
+for hns3_devname_path in /sys/bus/pci/drivers/hns3/*/net/*
+do
+ if [ -d "$hns3_devname_path" ]
+ then
+ hns3_devname=${hns3_devname_path##*/}
+ echo "setting $hns3_devname interrupt coalesce parameters"
+ ethtool -C $hns3_devname adaptive-rx off adaptive-tx off
+ ethtool -C $hns3_devname rx-usecs 15 tx-usecs 15
+ fi
+done
diff --git a/kernel.spec b/kernel.spec
index e9a153c..0a7f37b 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -11,7 +11,7 @@
%global upstream_sublevel 0
%global devel_release 210
%global maintenance_release .0.0
-%global pkg_release .110
+%global pkg_release .111
%define with_debuginfo 1
# Do not recompute the build-id of vmlinux in find-debuginfo.sh
@@ -72,6 +72,9 @@ Source200: mkgrub-menu-aarch64.sh
Source2000: cpupower.service
Source2001: cpupower.config
+Source2002: hns3_int_coal_params_setting.service
+Source2003: hns3_int_coal_params_setting.sh
+
%if 0%{?with_patch}
Source9000: apply-patches
Source9001: guards
@@ -738,6 +741,13 @@ install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
make DESTDIR=%{buildroot} install
popd
%endif
+
+# hns3 nic interrupt coalesce parameters setting
+%ifarch aarch64
+install -m644 %{SOURCE2002} %{buildroot}%{_unitdir}/hns3_int_coal_params_setting.service
+install -m755 %{SOURCE2003} %{buildroot}%{_bindir}/hns3_int_coal_params_setting.sh
+%endif
+
# thermal
pushd tools/thermal/tmon
make INSTALL_ROOT=%{buildroot} install
@@ -827,6 +837,10 @@ fi
%systemd_postun cpupower.service
%endif
+%ifarch aarch64
+%systemd_post hns3_int_coal_params_setting.service
+%endif
+
%files
%defattr (-, root, root)
%doc
@@ -901,6 +915,12 @@ fi
%{_bindir}/turbostat
%{_mandir}/man8/turbostat*
%endif
+
+%ifarch aarch64
+%{_unitdir}/hns3_int_coal_params_setting.service
+%{_bindir}/hns3_int_coal_params_setting.sh
+%endif
+
%{_bindir}/tmon
%{_bindir}/iio_event_monitor
%{_bindir}/iio_generic_buffer
@@ -952,6 +972,9 @@ fi
%endif
%changelog
+* Fri Jun 21 2024 Zheng Zengkai <zhengzengkai(a)huawei.com> - 5.10.0-210.0.0.111
+- kernel.spec: Add startup setting for hns3 interrupt coalesce parameters
+
* Fri Jun 21 2024 Jialin Zhang <zhangjialin11(a)huawei.com> - 5.10.0-210.0.0.110
- !9268 net: sched: sch_multiq: fix possible OOB write in multiq_tune()
- !9103 ksmbd: no response from compound read
--
2.33.0