网卡驱动7-netpoll和ethtool,以及ethtool移植和驱动简单实现

netpoll的目的是让内核在网络和I/O子系统尚不能完整可用时,依然能发送和接收数据包。主要用于网络控制台(net console)和远程内核调试(KGDBoE)中。实现netpoll功能,主要是要实现kernel中的poll_controller函数,该函数定义:void (*poll_controller)(structnet_device *dev)。该函数的作用是在缺少设备中断的情况下,还能对控制器做出响应。几乎所有的poll_controller函数都定义成如下形式:
void my_poll_controller(structnet_device *dev) {
disable_device_interrupt();//
my_interrupt_handler();
enable_device_interrupt();
}


所以,poll_controller只是模拟了来自指定设备的中断。其实只是给netpoll机制提供调用中断函数处理的机会,实际的中断触发当然还是硬件。

下面的链接分析了netpoll

http://blog.csdn.net/lucien_cc/article/details/11731501

 

netconsole在内核/drivers/net下

netconsole.c文件,这个console主要是向远程端发送printk(用户层不行)打印信息。

在arm板上,你的内核要配置选上netpoll,也要加载netconsole.ko

下面看netconsole.ko装载:

http://linux.chinaunix.net/techdoc/system/2005/04/06/921980.shtml

 

在pc机上要配置syslogd可以用接收来自远程主机的消息

下面的链接给了设置方法:

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
goroutine 52 [select]: github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1() D:/Program Files (x86)/Go/bin/pkg/mod/github.com/go-sql-driver/mysql@v1.7.1/connection.go:614 +0xaf created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher D:/Program Files (x86)/Go/bin/pkg/mod/github.com/go-sql-driver/mysql@v1.7.1/connection.go:611 +0x10a goroutine 83 [select]: github.com/go-redis/redis/v8/internal/pool.(*ConnPool).reaper(0x12f262a0, 0xdf8475800) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/go-redis/redis/v8@v8.11.5/internal/pool/pool.go:485 +0xd6 created by github.com/go-redis/redis/v8/internal/pool.NewConnPool D:/Program Files (x86)/Go/bin/pkg/mod/github.com/go-redis/redis/v8@v8.11.5/internal/pool/pool.go:111 +0x242 goroutine 85 [chan receive]: go-study/models.sendProc(0x12e40cf0) D:/go/go-study/models/Message.go:88 +0x48 created by go-study/models.Chat D:/go/go-study/models/Message.go:79 +0x30d goroutine 86 [IO wait]: internal/poll.runtime_pollWait(0x33340b00, 0x72) D:/Program Files (x86)/Go/src/runtime/netpoll.go:305 +0x52 internal/poll.(*pollDesc).wait(0x138f60f4, 0x72, 0x0) D:/Program Files (x86)/Go/src/internal/poll/fd_poll_runtime.go:84 +0x37 internal/poll.execIO(0x138f6014, 0xa365e0) D:/Program Files (x86)/Go/src/internal/poll/fd_windows.go:175 +0xfc internal/poll.(*FD).Read(0x138f6000, {0x12f41000, 0x1000, 0x1000}) D:/Program Files (x86)/Go/src/internal/poll/fd_windows.go:441 +0x13b net.(*netFD).Read(0x138f6000, {0x12f41000, 0x1000, 0x1000}) D:/Program Files (x86)/Go/src/net/fd_posix.go:55 +0x3f net.(*conn).Read(0x12c0aa68, {0x12f41000, 0x1000, 0x1000}) D:/Program Files (x86)/Go/src/net/net.go:183 +0x4f bufio.(*Reader).fill(0x12d1eae0) D:/Program Files (x86)/Go/src/bufio/bufio.go:106 +0xe9 bufio.(*Reader).Peek(0x12d1eae0, 0x2) D:/Program Files (x86)/Go/src/bufio/bufio.go:144 +0x6d github.com/gorilla/websocket.(*Conn).read(0x12f68000, 0x2) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:371 +0x30 github.com/gorilla/websocket.(*Conn).advanceFrame(0x12f68000) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:809 +0xae github.com/gorilla/websocket.(*Conn).NextReader(0x12f68000) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:1009 +0xb5 github.com/gorilla/websocket.(*Conn).ReadMessage(0x12f68000) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:1093 +0x25 go-study/models.recvProc(0x12e40cf0) D:/go/go-study/models/Message.go:100 +0x105 created by go-study/models.Chat D:/go/go-study/models/Message.go:81 +0x352
06-02

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值