Skip to content
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

refactor(net): the big network rebuild #977

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from
Draft

Conversation

Samuka007
Copy link
Member

@Samuka007 Samuka007 commented Oct 14, 2024

  • 重构事件通知链
  • 使网络子系统更易读
  • 引入uevent/netlink socket
  • 使http_server可中断
  • 正确实现unix stream, seqpacket socket框架
  • 解决资源依赖导致的潜在死锁
  • 部分网络调用待完善
  • 未能正常运行test-backlog
  • 未引入路由子系统
  • close 时 解除 Port 占用 feat(net): 实现inet socket端口资源释放 #990
  • 实现shutdown逻辑 feat(net): 实现 socket shutdown 逻辑 #989
  • Address Family在转换到已有地址时,from_u16在2与10(INET6)上会返回None
  • Redis 未能正常使用客户端连接

一次自认为性价比并不十分高的网络子系统重构,但是辛苦 @val213 @smallcjy @1037827920 @Saga1718 的大力支持,愿意在三天两头构建不成功的网络重构分支下协助我一同完成重构。现网络重构分支已准备好合入主线!

Samuka007 and others added 14 commits October 10, 2024 17:53
uevent should be format

Enum of smoltcp socket should be optimized.

need to add interface for routing subsys

actix is still not abled to run.

clean some casual added code to other places
* 新增CommonAttrGroup,基本支持sysfs下各种类型设备的uevent属性文件的读测试

* 修改net设备的uevent内容,使之与Linux语义一致

* 删除无用注释
clean format, enable ctrl-c in accept blocking
feat: merge master and ready for pr in master
@dragonosbot
Copy link

@Samuka007: no appropriate reviewer found, use r? to override

@github-actions github-actions bot added the enhancement New feature or request label Oct 14, 2024
@dragonosbot dragonosbot added A-driver Area: 驱动程序 A-fs Area: 文件系统 O-x86_64 Target: x86_64 S-等待审查 Status: 等待assignee以及相关方的审查。 labels Oct 14, 2024
@Samuka007 Samuka007 added the A-network Area: 网络子系统 label Oct 14, 2024
@Samuka007
Copy link
Member Author

r? @fslongjin @yuyi2439

Copy link
Member

@fslongjin fslongjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要添加文档

user/apps/test-uevent/README.md Outdated Show resolved Hide resolved
@dragonosbot dragonosbot added S-等待作者修改 Status: 这正在等待作者的一些操作(例如代码更改或更多信息)。 and removed S-等待审查 Status: 等待assignee以及相关方的审查。 labels Oct 15, 2024
@Samuka007
Copy link
Member Author

image 这个define文件夹改名types更合乎惯例?没见过rust用define表示“定义公共的结构体”的意思的。

命名为 definition 如何呢?毕竟是一大票定义(

@fslongjin
Copy link
Member

命名为 definition 如何呢?毕竟是一大票定义(

rust仓库里面写的是types
image

然后rust圣经(R门!/滑稽)写的类型本身也是叫做Types
image

之前看过一些库,没见过用define之类的名字的。

@fslongjin
Copy link
Member

命名为 definition 如何呢?毕竟是一大票定义(

然后,那个文件夹里面的类型的命名也是需要修改,如果某个类型是要跟Posix规范定义的值保持一致的(对外接口的),请全部加上Posix前缀。

@smallcjy
Copy link
Contributor

unix socket 似乎不能正常关闭、资源也没正常释放
@smallcjy @Saga1718

@Samuka007
Copy link
Member Author

tcp udp port释放未实现

* 重新组织代码分布

* remove unused imports

* fix it back to old syscall printing style

* regulate naming to posix

* todo: socket close 及 port 接触占用

* fix: format check
@Samuka007 Samuka007 removed the O-x86_64 Target: x86_64 label Oct 17, 2024
kernel/src/driver/block/virtio_blk.rs Outdated Show resolved Hide resolved
kernel/src/driver/net/irq_handle.rs Outdated Show resolved Hide resolved
kernel/src/driver/net/loopback.rs Outdated Show resolved Hide resolved
Comment on lines 509 to 515
//TODO: 现在先不用初始化宏进行注册,使virtonet排在网卡列表头,待网络子系统重构后再使用初始化宏并修复该bug
// #[unified_init(INITCALL_DEVICE)]
pub fn loopback_init() -> Result<(), SystemError> {
loopback_probe();
log::debug!("Successfully init loopback device");
return Ok(());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否应该恢复?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#993
如果恢复就会有这样的bug

kernel/src/driver/net/mod.rs Show resolved Hide resolved
@Chiichen
Copy link
Member

重构的 PR 命名为 refactor 似乎比 feat 更合适?

@fslongjin fslongjin changed the title feat(net): the big network rebuild refactor(net): the big network rebuild Oct 23, 2024
@github-actions github-actions bot removed the enhancement New feature or request label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-driver Area: 驱动程序 A-fs Area: 文件系统 A-network Area: 网络子系统 S-等待作者修改 Status: 这正在等待作者的一些操作(例如代码更改或更多信息)。
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants