From e05938ac4acd42d8acac123a880cae9582a93611 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 17 Aug 2022 16:40:54 +0200 Subject: amd64/rtl8139: tx --- src/user/app/ethdump/ethdump.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/user/app/ethdump') diff --git a/src/user/app/ethdump/ethdump.c b/src/user/app/ethdump/ethdump.c index 50dd1f9..adcb95e 100644 --- a/src/user/app/ethdump/ethdump.c +++ b/src/user/app/ethdump/ethdump.c @@ -123,6 +123,27 @@ static void parse_ethernet(const uint8_t *buf, size_t len) { } } +static void dummy_packet(handle_t h) { + const uint8_t packet[] = { + /* raw dump of a ICMP broadcast ping */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x52, 0x54, + 0x00, 0x12, 0x34, 0x56, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x54, 0x06, 0xa6, 0x40, 0x00, 0x40, 0x01, + 0x73, 0x5a, 0xc0, 0xa8, 0x00, 0x01, 0xff, 0xff, + 0xff, 0xff, 0x08, 0x00, 0x82, 0x62, 0xef, 0x07, + 0x00, 0xcb, 0x3b, 0x83, 0x4a, 0x47, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + /* 0x20, 0xcf, 0x98, 0x7f, */ /* crc */ + }; + _syscall_write(h, packet, sizeof packet, 0, 0); +} + int main(void) { const char *path = "/kdev/eth"; handle_t h = _syscall_open(path, strlen(path), 0); @@ -131,6 +152,10 @@ int main(void) { return 1; } + for (int i = 0; i < 20; i++) + dummy_packet(h); + return 0; + const size_t buflen = 4096; char *buf = malloc(buflen); for (;;) { -- cgit v1.2.3