Dinghai driver init

This commit is contained in:
hcf 2024-08-28 16:09:42 +08:00
parent 62f664d74f
commit 73a362a8c6
3 changed files with 110 additions and 7 deletions

View File

@ -1,7 +1,11 @@
# kmod-dinghai
#### 介绍
dinghai kernel driver
E310/E312 是中兴生产的标卡 采用PCIE5×16接口 支持 SRIOV 虚拟化技术 支持网络功能卸载包括 checksum 卸载、vlan 卸载 及 RDMA 功能。
I510/I511/I512 是中兴生产的智能网卡 采用PCIE5×16接口 支持 SRIOV 虚拟化技术 支持 网络卸载加速 包括virtio-net vSwitch 等。安全加速包括IPSEC卸载 TLS 等功能。 网络功能支持 200G 吞吐量 、DPDK 100Mpps转发 安全功能支持 IPSEC 200G 吞吐量、TLS 200G 、国密SM 200G。
X510/X512 是中兴生产的一款DPU 采用PCIE5×16接口 支持 SRIOV 虚拟化技术 支持RDMA 卸载、安全加速、 存储加速包括virtio-blk 、NVMe 等。
#### 软件架构
软件架构说明
@ -9,15 +13,9 @@ dinghai kernel driver
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献

105
kmod-dinghai.spec Normal file
View File

@ -0,0 +1,105 @@
%global pkg dinghai
%define pkg_version 2.24.20.02
%define release 1
%global debug_package %{nil}
Name: kmod-%{pkg}
Version: %{pkg_version}
Release: %{release}%{?dist}
Summary: ZTE SmartNIC and DPU driver
License: GPLv2
URL: https://gitee.com/anolis/kmod-dinghai
Source0: kmod-%{pkg}.tar.gz
Epoch: 1
# 安装依赖, 和内核版本对应
Requires(posttrans): %{_sbindir}/depmod
Requires(postun): %{_sbindir}/depmod
Requires(posttrans): %{_sbindir}/weak-modules
Requires(postun): %{_sbindir}/weak-modules
Requires(posttrans): %{_bindir}/sort
Requires(postun): %{_bindir}/sort
# 构建依赖, 和内核版本对应
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
BuildRequires: kmod
BuildRequires: make
BuildRequires: system-rpm-config
BuildRequires: perl-Data-Dumper
BuildRequires: kernel
BuildRequires: kernel-headers
BuildRequires: kernel-devel
%define kernel_version %(rpm -q kernel-devel | sed 's/kernel-devel-//')
%define kernel_source /usr/src/kernels/%{kernel_version}
%description
RPM Package for ZXDH Driver
%prep
%setup -q -n kmod-%{pkg}
%build
echo "kernel_version:%{kernel_version}"
pushd crypto/zsda
%{__make} %{?_smp_mflags} -C %{kernel_source} M=$PWD modules CONFIG_ACC_ZSDA_COMMON=m CONFIG_ACC_ZSDA_PF=m CONFIG_ACC_ZSDA_VF=m
popd
%install
mkdir -p %{buildroot}/lib/modules/%{kernel_version}/extra/drivers/dinghai/crypto/zsda/
for ko in $(find crypto/zsda/accdevice/ -name '*.ko'); do
if [[ $ko == crypto/zsda/accdevice/* ]]; then
target_dir=%{buildroot}/lib/modules/%{kernel_version}/extra/drivers/dinghai/crypto/zsda/
fi
%{__install} -D -t $target_dir $ko
done
ls -l /lib/modules/%{kernel_version}
# Make .ko objects temporarily executable for automatic stripping
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
# Generate depmod.conf
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}/extra -type f -name \*.ko -printf "%%P\n" | sort)
do
echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
echo "override $(basename $kmod .ko) * extra/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
done
%clean
%{__rm} -rf %{buildroot}
%post
depmod -a > /dev/null 2>&1
%preun
list_file="/var/run/rpm-%{pkg}-modules.list"
mkdir -p /var/run
for ko in $(find %{buildroot}/lib/modules/%{kernel_version}/extra/drivers/dinghai/crypto/zsda/ -name '*.ko'); do
echo "${ko#%{buildroot}}" >> $list_file
done
%postun
depmod -a > /dev/null 2>&1
if [ -x "/usr/sbin/weak-modules" ]; then
modules=( $(cat /var/run/rpm-%{pkg}-modules.list) )
printf '%s\n' "${modules[@]}" | /usr/sbin/weak-modules --no-initramfs --remove-modules
fi
rm /var/run/rpm-%{pkg}-modules.list
%files
%defattr(644,root,root,755)
/lib/modules/%{kernel_version}
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
%changelog
* Wed Aug 28 2024 hcf <han.chengfei@zte.com.cn> - 1:2.24.20.02-1
- Dinghai driver init

BIN
kmod-dinghai.tar.gz Normal file

Binary file not shown.