summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver/rtl8139.c
diff options
context:
space:
mode:
authordzwdz2024-07-14 19:19:35 +0200
committerdzwdz2024-07-14 19:19:35 +0200
commit6fe8073de975ad7722043f9173fec068178e2eac (patch)
tree9427bb0368e25609eea66fa52567b57522b0e0aa /src/kernel/arch/amd64/driver/rtl8139.c
parentb3a86647b644db30f5fd70bd651c44f681962a9b (diff)
kernel: rework postqueue
Keeping its old name for now to make things easier for myself. This might just be replaced by sys/queue.h soon.
Diffstat (limited to 'src/kernel/arch/amd64/driver/rtl8139.c')
-rw-r--r--src/kernel/arch/amd64/driver/rtl8139.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c
index a005df5..bce1071 100644
--- a/src/kernel/arch/amd64/driver/rtl8139.c
+++ b/src/kernel/arch/amd64/driver/rtl8139.c
@@ -13,7 +13,7 @@
static void accept(VfsReq *req);
static void rtl8139_irq(void);
-static VfsReq *blocked_on = NULL;
+static ReqQueue blocked_on;
enum {
@@ -86,6 +86,8 @@ void rtl8139_init(uint32_t bdf) {
mac[i] = port_in8(iobase + Mac + i);
}
+ postqueue_init(&blocked_on);
+
vfs_root_register("/dev/eth/", accept);
}
@@ -100,7 +102,10 @@ static void rtl8139_irq(void) {
/* bit 0 of cmd - Rx Buffer Empty
* not a do while() because sometimes the bit is empty on IRQ. no clue why. */
while (!(port_in8(iobase + Cmd) & 1)) {
- if (!postqueue_pop(&blocked_on, accept)) {
+ VfsReq *req = postqueue_pop(&blocked_on);
+ if (req) {
+ accept(req);
+ } else {
rx_irq_enable(false);
break;
}