@@ -427,12 +427,21 @@ net_i8259x_config_next_record:
427427; RDX = Interface ID
428428; RCX = Length of packet
429429; OUT: Nothing
430- ; Note: Transmit Descriptor (TDESC) Layout - Legacy Mode (7.2.3.2.2):
430+ ; Note: This driver uses the "legacy format" so TDESC.CMD.DEXT (5) is cleared to 0 - (7.2.3.2.2):
431+ ; TDESC Descriptor Format:
432+ ; First Qword:
431433; Bits 63:0 - Buffer Address
432- ; Bits 95:64 - CMD (Bits 31:24) / CSO (Bits 23:16) / Length (Bits 15:0)
433- ; Bits 127:96 - VLAN (Bits 63:48) / CSS (Bits 47:40) / Reserved (Bits 39:36) / STA (Bits 35:32)
434+ ; Second Qword:
435+ ; Bits 15:0 - Length
436+ ; Bits 23:16 - CSO - Checksum Offset
437+ ; Bits 31:24 - CMD - Command Byte
438+ ; Bits 35:32 - STA - Status
439+ ; Bits 39:36 - Reserved
440+ ; Bits 47:40 - CSS - Checksum Start
441+ ; Bits 63:48 - VLAN
434442net_i8259x_transmit:
435443 push rdi
444+ push rbx
436445 push rax
437446
438447 mov rdi , [ rdx + nt_tx_desc ] ; Transmit Descriptor Base Address
@@ -450,6 +459,7 @@ net_i8259x_transmit:
450459 bts rax , 24 ; TDESC.CMD.EOP (0) - End Of Packet
451460 bts rax , 25 ; TDESC.CMD.IFCS (1) - Insert FCS (CRC)
452461 bts rax , 27 ; TDESC.CMD.RS (3) - Report Status
462+ mov rbx , rdi ; Save location of Second Qword to RBX
453463 stosq
454464
455465 ; Increment i8259x_tx_lasttail and the Transmit Descriptor Tail
@@ -460,9 +470,14 @@ net_i8259x_transmit:
460470 mov rdi , [ rdx + nt_base ] ; Load the base MMIO of the NIC
461471 mov [ rdi + i8259x_TDT ], eax ; TDL - Transmit Descriptor Tail
462472
463- ; TDESC.STA.DD (bit 32) should be 1 once the hardware has sent the packet
473+ ; Check for TDESC.STA.DD (32) - Descriptor Done
474+ net_i8259x_transmit_wait:
475+ mov rax , [ rbx ]
476+ bt rax , 32
477+ jnc net_i8259x_transmit_wait
464478
465479 pop rax
480+ pop rbx
466481 pop rdi
467482 ret
468483; -----------------------------------------------------------------------------
0 commit comments