免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 15255 | 回复: 13
打印 上一主题 下一主题

[网络子系统] netlink_unicast 返回 -11的问题 [复制链接]

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-07-01 18:02 |只看该作者 |倒序浏览
我在一个驱动的write函数中调用netlink_unicast发送数据给应用层程序。
刚开始的时候,是ok的,但过了一会儿之后,netlink_unicast失败,
返回值为  -11。
在include/asm-generic/errno-base.h文件中查到,11表示“try again”
大家有碰到过这个问题么?

论坛徽章:
0
2 [报告]
发表于 2010-07-01 22:04 |只看该作者
你发向用户态的应用程序填写了pid吗?还是直接填0,进行广播

论坛徽章:
0
3 [报告]
发表于 2010-07-01 22:05 |只看该作者
是不是用户太的进程死掉了?

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
4 [报告]
发表于 2010-07-01 22:22 |只看该作者
回复 3# emmoblin


    没有死,刚开始还好好的,其实就是不停得发数据,但是刚开始是ok的,发了一会就发不出去了

论坛徽章:
0
5 [报告]
发表于 2010-07-01 23:32 |只看该作者
看看是不是需要设置socket的buffer大小。是否每次都发送同样多的数据后就不行了呢?

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
6 [报告]
发表于 2010-07-02 09:00 |只看该作者
回复 5# emmoblin


count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
send_to_user: have sent=1040
advtty_write: 1024
count = 2048
send_to_user: have sent=1040
advtty_write: 1024
count = 1024
advtty:can not unicast skb(-11)
count = 2048
advtty:can not unicast skb(-11)
count = 2048
advtty:can not unicast skb(-11)

刚开始发送是ok的,但后来就发不出去了

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
7 [报告]
发表于 2010-07-02 09:06 |只看该作者
我在
http://lists.netfilter.org/piper ... ptember/009317.html
看到以前有个人也碰到了和我一样的问题,但是他没有解决。

I have a problem when using netlink_unicast(...) in
net/netlink/af_netlink.c. When calling netlink_unicast(...) multiple times,
e.g. in a loop, the internal buffer in the socket will get filled up, then
it will refuse to send any more netlink msg and return -EAGAIN.


Is there anyway to force netlink socket to send/flush whatever in the buffer
thus leave more room for the next netlink_unicast call?

Any advice is appreciated. thank you very much.

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
8 [报告]
发表于 2010-07-02 14:17 |只看该作者
问题的原因找到了
其实就是netlink_unicast发送的比接收端快很多,以至于"the internal buffer in the socket will get filled up"。
我尝试在驱动的write函数里在调用netlink_unicast前msleep(100),就正常了。

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
9 [报告]
发表于 2010-07-03 22:54 |只看该作者

论坛徽章:
0
10 [报告]
发表于 2012-09-26 11:22 |只看该作者
回复 8# jinxinxin163


    你前面有提到 netlink 发给用户层的数据非常多
    然后 后面 却又 sleep(100) , 这样会不会延迟、堵塞 ?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP