-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an API to get the netdev list #8860
base: master
Are you sure you want to change the base?
Conversation
if (cur_nd_list == RT_NULL) | ||
return 0; | ||
|
||
level = rt_spin_lock_irqsave(&_spinlock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以想想,怎么来降低spin_lock_irqsave的时间吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果只是计算netdev_list的长度,可以的,只需要定义一个原子类型的变量,在每次注册或者删除netdev的时候进行原子操作+1或者-1就可以了
rt_spin_unlock_irqrestore(&_spinlock, level); | ||
|
||
rt_memcpy(&nd, cur_nd_list, sizeof(struct netdev)); | ||
err = cb(msg, &nd, nd_num, index, ROUTE_IPV4_TRUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没开 NETLINK 的时应该没有这个宏定义,这么处理会编译失败。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数加了宏控,不会编译失败的,并且cb是传过来的回调函数,即使没有宏控,编译也不应该会失败的才对
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是指 ROUTE_IPV4_TRUE
拉取/合并请求描述:(PR description)
为什么提交这份PR (why to submit this PR)
主线代码使用ukernel时编译问题
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up