From 173466f9fb04ef5bc689b524a88f7d6753150303 Mon Sep 17 00:00:00 2001 From: Youjie Zheng Date: Wed, 7 Aug 2024 14:34:07 +0800 Subject: [PATCH] feat Starry-OS/Starry#24: support for e1000 driver --- Cargo.lock | 16 ++++++++-------- README.md | 5 +++++ scripts/make/qemu.mk | 9 +++++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3b8610..d7b9884 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ [[package]] name = "axdriver" version = "0.1.0" -source = "git+https://github.com/Starry-OS/axdriver.git#a23bd2759c396edd9dbae5c25ff858ec516e3579" +source = "git+https://github.com/Starry-OS/axdriver.git#fdf9d5efb411cfecfe4cc06bc9517a1fc8f3f7d3" dependencies = [ "axalloc", "axconfig", @@ -307,7 +307,7 @@ dependencies = [ [[package]] name = "axfeat" version = "0.1.0" -source = "git+https://github.com/Starry-OS/axfeat.git#d3aa838e286f0e029fcd0aec7bac7bf6932dba8a" +source = "git+https://github.com/Starry-OS/axfeat.git#a0d5a4813397aae6ce84a749a1c16955f4e9a874" dependencies = [ "axalloc", "axdisplay", @@ -489,7 +489,7 @@ dependencies = [ [[package]] name = "axnet" version = "0.1.0" -source = "git+https://github.com/Starry-OS/axnet.git#aef12b88809570901cedca1a996594ab009169da" +source = "git+https://github.com/Starry-OS/axnet.git#48d68eb8c32bfb1bb89977fbe19ca42a0d1fb7a9" dependencies = [ "axdriver", "axerrno", @@ -509,7 +509,7 @@ dependencies = [ [[package]] name = "axprocess" version = "0.1.0" -source = "git+https://github.com/Starry-OS/axprocess.git#8590f91900011f097ee636804166ecba4586ede7" +source = "git+https://github.com/Starry-OS/axprocess.git#6ab9c7a7d41f43ecebcd6ee329bd9fa7edc763b8" dependencies = [ "axalloc", "axconfig", @@ -569,7 +569,7 @@ dependencies = [ [[package]] name = "axstarry" version = "0.1.0" -source = "git+https://github.com/Starry-OS/axstarry.git#7c109e729ceacbc72d456d76b1536751ff806328" +source = "git+https://github.com/Starry-OS/axstarry.git#a60752d10eb805a820436b86c429d621a95384ce" dependencies = [ "arch_boot", "axfeat", @@ -840,7 +840,7 @@ dependencies = [ [[package]] name = "driver_net" version = "0.1.0" -source = "git+https://github.com/Starry-OS/driver_net.git#942a7f6a44420aa01c8bff6e56924949f7acf805" +source = "git+https://github.com/Starry-OS/driver_net.git#5d16bf2fe6eae2aa3b7d4f929162c07d949a6955" dependencies = [ "driver_common", "log", @@ -1135,7 +1135,7 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "linux_syscall_api" version = "0.1.0" -source = "git+https://github.com/Starry-OS/linux_syscall_api.git#98d50d86df87c3d09f4b8115d1ae6c127a1e8701" +source = "git+https://github.com/Starry-OS/linux_syscall_api.git#bc828f3316e6b4560f5e79602b679c7d9d31d5ff" dependencies = [ "axconfig", "axerrno", @@ -1667,7 +1667,7 @@ dependencies = [ [[package]] name = "taskctx" version = "0.1.0" -source = "git+https://github.com/Starry-OS/taskctx.git#86561d9659f294328350d0235e8f5d285fd6e766" +source = "git+https://github.com/Starry-OS/taskctx.git#d7d646ca1f4cc2bd0466563b0563b2c321fb0929" dependencies = [ "aarch64-cpu", "cfg-if", diff --git a/README.md b/README.md index 9a51677..bd98e2d 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,11 @@ $ kbuild patch remove axstarry ``` +## Run with e1000 driver +```sh +$ make A=apps/monolithic_userboot FEATURES=img,sched_rr,e1000_net LOG=off ACCEL=n APP_FEATURES=batch NET=y BLK=y run +``` + ## Notes - Please remove unnecessary dependencies in `Cargo.toml` before your commit. diff --git a/scripts/make/qemu.mk b/scripts/make/qemu.mk index f6aac47..0dbbaf9 100644 --- a/scripts/make/qemu.mk +++ b/scripts/make/qemu.mk @@ -31,8 +31,14 @@ qemu_args-$(BLK) += \ -device virtio-blk-$(vdev-suffix),drive=disk0 \ -drive id=disk0,if=none,format=raw,file=$(DISK_IMG) -qemu_args-$(NET) += \ +# 如果 FEATURES 包括 e1000_net,则添加 -device e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp::5555-:5555,hostfwd=udp::5555-:5555 +ifeq ($(findstring e1000_net,$(FEATURES)),e1000_net) + qemu_args-$(NET) += \ + -device e1000,netdev=net0 -object filter-dump,id=net0,netdev=net0,file=packets.pcap +else + qemu_args-$(NET) += \ -device virtio-net-$(vdev-suffix),netdev=net0 +endif ifeq ($(NET_DEV), user) qemu_args-$(NET) += -netdev user,id=net0,hostfwd=tcp::5555-:5555,hostfwd=udp::5555-:5555 @@ -41,7 +47,6 @@ else ifeq ($(NET_DEV), tap) QEMU := sudo $(QEMU) else ifeq ($(NET_DEV), bridge) qemu_args-$(NET) += -netdev bridge,id=net0,br=virbr0 - QEMU := sudo $(QEMU) else $(error "NET_DEV" must be one of "user", "tap", or "bridge") endif