实现功能:

使用自己已经分配的内存让skb->data指向,而不是使用alloc_malloc()。

部分代码如下:

             /*
* build a new sk_buff
*/
//struct sk_buff *send_skb = kmem_cache_alloc_node(skbuff_head_cache, GFP_ATOMIC & ~__GFP_DMA, NUMA_NO_NODE);
struct sk_buff *send_skb = kmem_cache_alloc(skbuff_head_cache, GFP_ATOMIC & ~__GFP_DMA); if (!send_skb) {
//spin_unlock(&lock);
return NF_DROP;
} //printk("what2\n");
memset(send_skb, , offsetof(struct sk_buff, tail));
atomic_set(&send_skb->users, );
send_skb->cloned = ; send_skb->head = mmap_buf + ;
send_skb->data = mmap_buf + ;

第18行,mmap_buf是提前分配的内存。

在/var/log/messages中网卡驱动会输出错误信息:

 ep  :: 10g-host2 kernel: ixgbe ::00.0: eth2: Detected Tx Unit Hang
Sep :: 10g-host2 kernel: Tx Queue <>
Sep :: 10g-host2 kernel: TDH, TDT <>, <1ea>
Sep :: 10g-host2 kernel: next_to_use <1ea>
Sep :: 10g-host2 kernel: next_to_clean <>
Sep :: 10g-host2 kernel: ixgbe ::00.0: eth2: Detected Tx Unit Hang
Sep :: 10g-host2 kernel: Tx Queue <>
Sep :: 10g-host2 kernel: TDH, TDT <>, <1eb>
Sep :: 10g-host2 kernel: next_to_use <1eb>
Sep :: 10g-host2 kernel: next_to_clean <>
Sep :: 10g-host2 kernel: ixgbe ::00.0: eth2: Detected Tx Unit Hang
Sep :: 10g-host2 kernel: Tx Queue <>
Sep :: 10g-host2 kernel: TDH, TDT <>, <1ea>
Sep :: 10g-host2 kernel: next_to_use <1ea>
Sep :: 10g-host2 kernel: next_to_clean <>
Sep :: 10g-host2 kernel: ixgbe ::00.0: eth2: Detected Tx Unit Hang
Sep :: 10g-host2 kernel: Tx Queue <>
Sep :: 10g-host2 kernel: TDH, TDT <>, <1ea>
Sep :: 10g-host2 kernel: next_to_use <1ea>
Sep :: 10g-host2 kernel: next_to_clean <>
Sep :: 10g-host2 kernel: ixgbe ::00.0: eth2: Detected Tx Unit Hang
Sep :: 10g-host2 kernel: Tx Queue <>
Sep :: 10g-host2 kernel: TDH, TDT <>, <1ef>
Sep :: 10g-host2 kernel: next_to_use <1ef>
Sep :: 10g-host2 kernel: next_to_clean <>
Sep :: 10g-host2 kernel: ixgbe ::00.0: eth2: Detected Tx Unit Hang
Sep :: 10g-host2 kernel: Tx Queue <>
Sep :: 10g-host2 kernel: TDH, TDT <>, <1ec>
Sep :: 10g-host2 kernel: next_to_use <1ec>
Sep :: 10g-host2 kernel: next_to_clean <>
Sep :: 10g-host2 kernel: ixgbe ::00.0: eth2: Detected Tx Unit Hang

在排除各种原因后,定位为分配的mmap_buf存在问题。使用vmalloc()分配不正确,改为kmalloc()后正常。

《Linux内核设计与实现》第12.5节有解释,应该是:网卡设备要求分配的物理地址连续,而vmalloc()只是虚拟地址连续

排查 “Detected Tx Unit Hang”问题的更多相关文章

  1. Intel 82599网卡异常挂死原因

    前提背景: 生产环境上,服务器网络突然断链,ssh连接失败. 问题初步定位: 查找内核日志,得到网卡异常信息 Jan 24 11:52:43 localhost kernel: ixgbe 0000: ...

  2. intel的网卡故障

    现象: 机器键盘接入,敲入无反应:机器无法ping通,整台机器假死状态. 查看message的日志,日志为如下内容: Aug :: TSMIS-CF kernel: ::19.0: eth0: Det ...

  3. 无线电源传输 Wireless Power Consortium (WPC) Communication

    Universally Compatible Wireless Power Using the Qi Protocol Wireless charging of portable electronic ...

  4. Class loading in JBoss AS 7--官方文档

    Class loading in AS7 is considerably different to previous versions of JBoss AS. Class loading is ba ...

  5. linux内存管理之DMA

    说起DMA我们并不陌生,但是实际编程中去用的人不多吧,最多就是网卡驱动里的环形buffer,再有就是设备的dma,下面我们就分析分析.   DMA用来在设备内存和内存之间直接数据交互.而无需cpu干预 ...

  6. 教你如何用AST语法树对代码“动手脚”

    个推安卓工程师,负责公司移动端项目的架构和开发,主导移动端日志管理平台系统架构和开发工作,熟悉前后端的技术线,参与个推SDK主要业务研发工作,善于解决项目中遇到的痛点问题. 作为程序猿,每天都在写代码 ...

  7. appium日志

    2020-10-02 00:44:10:672 [Appium] Welcome to Appium v1.16.0 2020-10-02 00:44:10:673 [Appium] Non-defa ...

  8. 内核futex的BUG导致程序hang死问题排查

    https://mp.weixin.qq.com/s/sGS-Kw18sDnGEMfQrbPbVw 内核futex的BUG导致程序hang死问题排查 原创: 王领先 58架构师 今天   近日,Had ...

  9. Java SDK夯住(Hang)问题排查

    夯住(Hang)是指程序仍在运行,卡在某个方法调用上,没有返回也没有异常抛出:卡住时间从几秒到几小时不等. Java程序发生Hang时,应该首先使用 jstack 把java进程的堆栈信息保存下来 , ...

随机推荐

  1. tips 前端 背景与元素的透明和模糊

    碰到好几次这样的情况了: 一个带点儿文艺效果 背景图片模糊 而一行别致的文字清晰的悬浮在背景上(口胡,加点美好的想象,生活会更美好) 第一反应是 this is easy. cause i know ...

  2. Js String 属性扩展

    String.prototype.startsWith = function (startStr) {  var d = startStr.length;  return (d >= 0 &am ...

  3. "贪心"的考试

    先来落实比较简单的T3,T4 T3  团结的队伍 team 题目描述 众所周知,长郡信息组是一个团结友爱的优秀团队.为了弘扬团队精神,践行社会主义核心价值观,秉承朴实沉毅的校训,信息组决定外出游玩(. ...

  4. NOIP2012提高组

    D1T1.Vigenère密码 模拟 #include<iostream> #include<cstdio> using namespace std; int main() { ...

  5. springMVC多图片压缩上传的实现

    首先需要在配置文件中添加配置: <!--配置文件的视图解析器,用于文件上传,其中ID是固定的:multipartResolver--> <bean id="multipar ...

  6. 【bugfree】安装

    我用的是WIN8系统 首先要安装XAMPP,开始里面的Apache和MySQL服务. 在运行Apache服务时报错: ----------------------------------------- ...

  7. Codeforces Round #444 (Div. 2)A. Div. 64【进制思维】

    A. Div. 64 time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  8. Mediocre String Problem (2018南京M,回文+LCP 3×3=9种做法 %%%千年好题 感谢"Grunt"大佬的细心讲解)

    layout: post title: Mediocre String Problem (2018南京M,回文+LCP 3×3=9种做法 %%%千年好题 感谢"Grunt"大佬的细 ...

  9. 洛谷——P1403 [AHOI2005]约数研究

    P1403 [AHOI2005]约数研究 题目描述 科学家们在Samuel星球上的探险得到了丰富的能源储备,这使得空间站中大型计算机“Samuel II”的长时间运算成为了可能.由于在去年一年的辛苦工 ...

  10. luogu P2828 Switching on the Lights(开关灯)

    题目背景 来源:usaco-2015-dec Farm John 最近新建了一批巨大的牛棚.这些牛棚构成了一个N*N的矩形网络.(1<n<100) 然而bessie十分怕黑,他想计算可以把 ...