CentOS7启用ena网络增强模块
CentOS7.4.1708及以上版本内核中已经集成了亚马逊的ena驱动程序已被加进内核,参考https://wiki.centos.org/zh/Manuals/ReleaseNotes/CentOS7.1708 官方页面;
如果是7.4以上版本直接使用下面的方法即可加载ena模块:
[root@monitor ~]# yum update -y
[root@monitor ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@monitor ~]# modinfo ena
filename: /lib/modules/3.10.0-957.12.2.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko.xz
version: 1.5.0K
license: GPL
description: Elastic Network Adapter (ENA)
author: Amazon.com, Inc. or its affiliates
retpoline: Y
rhelversion: 7.6
srcversion: 1B9931F07C26733BA8D4F94
alias: pci:v00001D0Fd0000EC21sv*sd*bc*sc*i*
alias: pci:v00001D0Fd0000EC20sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00001EC2sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00000EC2sv*sd*bc*sc*i*
depends:
intree: Y
vermagic: 3.10.0-957.12.2.el7.x86_64 SMP mod_unload modversions
signer: CentOS Linux kernel signing key
sig_key: 8D:E6:4F:B5:96:9B:55:7E:DC:7F:03:2E:EA:BC:BE:4F:37:17:7F:4E
sig_hashalgo: sha256
parm: debug:Debug level (0=none,...,16=all) (int)
查看内核版本:
[root@monitor ~]# uname -r
3.10.0-957.12.2.el7.x86_64
添加模块:
dracut -f --add-drivers nvme /boot/initramfs-$(uname -r).img $(uname -r)
查看内核镜像内容并过滤nvme:
[root@monitor ~]# lsinitrd /boot/initramfs-3.10.0-957.12.2.el7.x86_64.img | grep -i nvme
Arguments: -f --add-drivers 'nvme'
drwxr-xr-x 3 root root 0 Aug 14 19:43 usr/lib/modules/3.10.0-957.12.2.el7.x86_64/kernel/drivers/nvme
drwxr-xr-x 2 root root 0 Aug 14 19:43 usr/lib/modules/3.10.0-957.12.2.el7.x86_64/kernel/drivers/nvme/host
-rw-r--r-- 1 root root 28480 May 15 05:48 usr/lib/modules/3.10.0-957.12.2.el7.x86_64/kernel/drivers/nvme/host/nvme-core.ko.xz
-rw-r--r-- 1 root root 16908 May 15 05:48 usr/lib/modules/3.10.0-957.12.2.el7.x86_64/kernel/drivers/nvme/host/nvme.ko.xz
CentOS7.4以下版本需要重新安装,操作步骤如下:
1、先更新升级Linux内核:
yum --enablerepo=extras install epel-release
yum -y install patch dkms kernel-devel perl
yum update
yum --enablerepo=elrepo-kernel install kernel-lt -y
vi /etc/default/grub
将GRUB_DEFAULT=saved 改成 GRUB_DEFAULT=0
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot 重启后生效
2、安装ena驱动
cd /opt
curl -o ena_linux_2.1.1.tar.gz https://codeload.github.com/amzn/amzn-drivers/tar.gz/ena_linux_2.1.1
tar zxvf ena_linux_2.1.1.tar.gz
mv amzn-drivers-ena_linux_2.1.1 /usr/src/ena-2.1.1
cat <<EOF > /usr/src/ena-2.1.1/dkms.conf
PACKAGE_NAME="ena"
PACKAGE_VERSION="2.1.1"
AUTOINSTALL="yes"
REMAKE_INITRD="yes"
BUILT_MODULE_LOCATION[0]="kernel/linux/ena"
BUILT_MODULE_NAME[0]="ena"
DEST_MODULE_LOCATION[0]="/updates"
DEST_MODULE_NAME[0]="ena"
CLEAN="cd kernel/linux/ena; make clean"
MAKE="cd kernel/linux/ena; make BUILD_KERNEL=\${kernelver}"
EOF
dkms add -m ena -v 2.1.1
dkms build -m ena -v 2.1.1
dkms install -m ena -v 2.1.1
dracut -f --add-drivers ena
安装完毕查看
[root@devops ~]# modinfo ena
filename: /lib/modules/3.10.0-957.27.2.el7.x86_64/extra/ena.ko.xz
version: 2.1.1g
license: GPL
description: Elastic Network Adapter (ENA)
author: Amazon.com, Inc. or its affiliates
retpoline: Y
rhelversion: 7.6
srcversion: F342F1BEE707726508E3DF8
alias: pci:v00001D0Fd0000EC21sv*sd*bc*sc*i*
alias: pci:v00001D0Fd0000EC20sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00001EC2sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00000EC2sv*sd*bc*sc*i*
depends:
vermagic: 3.10.0-957.27.2.el7.x86_64 SMP mod_unload modversions
parm: debug:Debug level (0=none,...,16=all) (int)
parm: rx_queue_size:Rx queue size. The size should be a power of 2. Max value is 8K
(int)
parm: force_large_llq_header:Increases maximum supported header size in LLQ mode to 224 bytes, while reducing the maximum TX queue size by half.
(int)
3、添加驱动
查看内核版本:uname -r
添加模块:dracut -f --add-drivers nvme /boot/initramfs-$(uname -r).img $(uname -r)
查看内核镜像内容并过滤nvme:
lsinitrd /boot/initramfs-3.10.0-957.1.3.el7.x86_64.img | grep -i nvme
4、最后关机,并启用ena模块
aws ec2 modify-instance-attribute --instance-id i-07xxxxxxxxxxxxx --ena-support #使i-07xxxxxxxxxxxxx虚机支持ena
aws ec2 describe-instances --instance-id i-07xxxxxxxxxxxxx --query "Reservations[].Instances[].EnaSupport" #查询是否启用了ena模块
最后启动虚机即可生效,查看ena信息:
[root@monitor ~]# modinfo ena
filename: /lib/modules/3.10.0-957.27.2.el7.x86_64/extra/ena.ko.xz
version: 2.1.1g
license: GPL
description: Elastic Network Adapter (ENA)
author: Amazon.com, Inc. or its affiliates
retpoline: Y
rhelversion: 7.6
srcversion: F342F1BEE707726508E3DF8
alias: pci:v00001D0Fd0000EC21sv*sd*bc*sc*i*
alias: pci:v00001D0Fd0000EC20sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00001EC2sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00000EC2sv*sd*bc*sc*i*
depends:
vermagic: 3.10.0-957.27.2.el7.x86_64 SMP mod_unload modversions
parm: debug:Debug level (0=none,...,16=all) (int)
parm: rx_queue_size:Rx queue size. The size should be a power of 2. Max value is 8K
(int)
parm: force_large_llq_header:Increases maximum supported header size in LLQ mode to 224 bytes, while reducing the maximum TX queue size by half.
(int)
[root@monitor ~]# ethtool -i ens5
driver: ena
version: 2.1.1g
firmware-version:
expansion-rom-version:
bus-info: 0000:00:05.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
via:https://gist.github.com/Ray33/ba189a729d81babc99d7cef0fb6fbcd8
Tag标签:「模块 aws ena 增强」更新时间:「2021-11-04 17:43:36」阅读次数:「1022」