linux部署_centos_记一次ena网卡驱动替换

蛋蛋 2023年03月09日 35 0

记一次ena网卡驱动替换

系统:CentOS7.6
内核:3.10.0-957.27.2.el7.x86_64
需求:指定内核上,编译替换ena更高版本的ko文件

编译

根据下列文档:
如何在运行 Red Hat 6/7 的 Amazon EC2 实例上安装并激活最新的 ENA 驱动程序,以便获得增强型网络支持?
https://aws.amazon.com/cn/premiumsupport/knowledge-center/install-ena-driver-rhel-ec2/

RHEL 7.4 及更高版本的 AMI 预装了 ENA 增强联网所需的模块。有关详细信息,请参阅在 Linux 实例上启用 Elastic Network Adapter (ENA)

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html

要验证ena模块是否已安装,请使用 modinfo命令,如以下示例所示。

# modinfo ena
filename:       /lib/modules/4.14.33-59.37.amzn2.x86_64/kernel/drivers/amazon/net/ena/ena.ko
version:        1.5.0g
license:        GPL
description:    Elastic Network Adapter (ENA)
author:         Amazon.com, Inc. or its affiliates
srcversion:     692C7C68B8A9001CB3F31D0
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:
retpoline:      Y
intree:         Y
name:           ena

在上面的 Amazon Linux 案例中,ena安装了该模块。
在上面的 Ubuntu 实例中,没有安装该模块,因此您必须先安装它。有关更多信息,请参阅在 Ubuntu 上启用增强网络。

网络接口驱动程序
使用以下命令验证模块是否ena正在特定接口上使用,替换为您要检查的接口名称。如果您使用的是单一界面(默认),则这是 eth0. 如果操作系统支持可预测的网络名称,这可能是一个类似的名称ens5。

在以下示例中,ena未加载模块,因为列出的驱动程序是vif.

# ethtool -i eth0
driver: vif
version:
firmware-version:
bus-info: vif-0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

在此示例中,ena模块已加载并处于推荐的最低版本。此实例已正确配置增强网络。

# ethtool -i eth0
driver: ena
version: 1.5.0g
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

仓库地址:
https://github.com/amzn/amzn-drivers/tree/master/kernel/linux/ena

编译方法:

  1. 连接到您的实例。

  2. ena从 GitHub 克隆实例上模块的源代码,网址为https://github.com/amzn/amzn-drivers. (SUSE Linux Enterprise Server 12 SP2及以后版本默认包含ENA 2.02,所以你不需要下载和编译ENA驱动。对于SUSE Linux Enterprise Server 12 SP2及以后版本,你应该申请添加你想要的驱动程序版本到库存内核)。

# cd /usr/local/src
# git clone https://github.com/amzn/amzn-drivers
# ls -l amzn-drivers
  1. ena在您的实例上编译和安装模块。这些步骤取决于 Linux 发行版。有关在 Red Hat Enterprise Linux 上编译模块的更多信息,请参阅AWS 知识中心文章.
# yum update
# reboot
# yum install kernel-devel-$(uname -r) git

到指定目录下做编译:

# cd /usr/local/src/amzn-drivers/kernel/linux/ena
# make

注:编译这块没有实际操作,我这是找人编译的

# scp /tmp/ena_2.6.0g.ko root@192.168.12.15:/usr/local/src
  1. 替换旧的模块
# cp /lib/modules/3.10.0-957.27.2.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko /lib/modules/3.10.0-957.27.2.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko.bak
# cp /usr/local/src/ena_2.6.0g.ko /lib/modules/3.10.0-957.27.2.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko
# ls -l /lib/modules/3.10.0-957.27.2.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko
-rwxr-xr-x 1 root root 3657096 Mar  9 15:43 /lib/modules/3.10.0-957.27.2.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko
# depmod 3.10.0-957.27.2.el7.x86_64
# dracut -f /boot/initrd-3.10.0-957.27.2.el7.x86_64.img 3.10.0-957.27.2.el7.x86_64
  1. 更新initramfs您的实例以确保在启动时加载新模块。例如,如果您的发行版支持 dracut,您可以使用以下命令。
# dracut -f -v

-f, --force
overwrite existing initramfs file.
-v, --verbose
increase verbosity level (default is info(4))

  1. 重启服务器
# reboot
  1. 重启后查看模块信息
# modinfo ena
filename:       /lib/modules/3.10.0-957.27.2.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko
version:        2.6.0g
license:        GPL
description:    Elastic Network Adapter (ENA)
author:         Amazon.com, Inc. or its affiliates
rhelversion:    7.4
srcversion:     CA4292170F031CA874BD40A
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*
alias:          pci:v00001D0Fd00000051sv*sd*bc*sc*i*
depends:        
vermagic:       3.10.0-957.27.2.el7.x86_64 SMP mod_unload modversions 
parm:           debug:Debug level (-1=default,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)
parm:           num_io_queues:Sets number of RX/TX queues to allocate to device. The maximum value depends on the device and number of online CPUs.
 (int)
parm:           lpc_size:Each local page cache (lpc) holds N * 1024 pages. This parameter sets N which is rounded up to a multiplier of 2. If zero, the page cache is disabled. Max: 32
 (uint)

参考:
ENA故障排除
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-ena.html

linux下安装编译网卡驱动的方法
https://www.douhua.net/wendang/qitafanwen/82518.html

Last Updated: 2023/03/09 16:37:56
[Oracle]在CentOS下安装oracle linux基础_[转]Linux 下 ping 命令参数详细解析