From cac7c352a1ece2744de42128a9c69df16f05d26a Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 26 Sep 2020 16:29:49 +0200 Subject: Very simple icmp ping handling --- kernel/drivers/rtl8139.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kernel/drivers') diff --git a/kernel/drivers/rtl8139.c b/kernel/drivers/rtl8139.c index 6487eca..2fc8f07 100644 --- a/kernel/drivers/rtl8139.c +++ b/kernel/drivers/rtl8139.c @@ -25,6 +25,7 @@ u8 *rtl8139_get_mac() void rtl8139_receive_packet() { + printf("%x\n", current_packet_ptr); u16 *t = (u16 *)(rx_buffer + current_packet_ptr); u16 length = *(t + 1); t += 2; @@ -35,7 +36,7 @@ void rtl8139_receive_packet() current_packet_ptr = (current_packet_ptr + length + 4 + 3) & (~3); - if (current_packet_ptr > RX_BUF_SIZE) + if (current_packet_ptr >= RX_BUF_SIZE) current_packet_ptr -= RX_BUF_SIZE; outw(rtl_iobase + RTL_PORT_RXPTR, current_packet_ptr - 0x10); @@ -46,6 +47,7 @@ static u8 tsd_array[4] = { 0x10, 0x14, 0x18, 0x1C }; static u8 tx_current = 0; void rtl8139_send_packet(void *data, u32 len) { + printf("Sending packet %d\n", len); outl(rtl_iobase + tsad_array[tx_current], (u32)data); outl(rtl_iobase + tsd_array[tx_current++], len); if (tx_current > 3) -- cgit v1.2.3