140 likes | 232 Vues
Network Adapter Driver. NCTU High Speed Network Lab. System Architecture. BUS. Rx Buffer Ring. 16 byte FIFO. CRC. Addr. Filter. If my addr. DMA. Adapter Rx Process. Coax cable. HOST CPU. NIC Rx Procedure. Media. (3). Interrupt cup (307). Current page register(page1:307).
E N D
Network Adapter Driver NCTU High Speed Network Lab.
System Architecture NCTU High Speed Network Lab
BUS Rx Buffer Ring 16 byte FIFO CRC Addr. Filter If my addr DMA Adapter Rx Process Coax cable NCTU High Speed Network Lab
HOST CPU NIC Rx Procedure Media (3) Interrupt cup (307) Current page register(page1:307) NIC (1) FIFO Romote start address(308,309) Romote byte count (30a,30b) Romote DMA write (300) Data port Data port (310) (2) (5) Local DMA (4) NIC memory Host Memory NCTU High Speed Network Lab
HOST CPU NIC Tx Procedure Media (1) Romote start address(308,309) Romote byte count (30a,30b) NIC (6) Romote DMA write (300) FIFO Data port (310) (4) Remote DMA complete(307) Data port Romote start address(308,309) (5) (2) Local DMA (3) NIC memory Host Memory NCTU High Speed Network Lab
Buffer Ring Control Points Set one times when initial: • Page Start Point (PSTART) : Set when Initial • Page Stop Point (PSTOP) : Set when Initial Update when received packet: • Current Page Point (CURR) : NIC auto update • Boundary Page Point (BNDRY) : manual update • Next Packet Page (next_pkt) : memory variable NCTU High Speed Network Lab
4 3 2 n 1 ReceiveBufferRing Page start address Buffer #1 Buffer #2 Buffer #n Page start address 256 bytes NCTU High Speed Network Lab
Rx Buffer Ring Maintain • When initializing the NIC set : BNDRY = PSTART CURR = PSTART + 1 next_pkt = PSTART + 1 • After a packet is DMAed from Rx Buffer Ring next_pkt = Next Page Pointer BNDRY = Next Page Pointer if BNDRY < PSTART then BNDRY = PSTOP - 1 NCTU High Speed Network Lab
Receive Buffer Ring Current Page Register Packet Ends 4 3 Status next page Length(L) Length(H) 2 n 1 Current Page Register Packet status NCTU High Speed Network Lab
Driver ISR Disable interrupt Save PC Registers Read Interrupt Status Register Packet Reception? Packet Transmission? Reset PTX bit in Interrupt Status Register Reset PRX bit in Interrupt Status Register Driver ISR YES NO YES NO NCTU High Speed Network Lab
Read Transmit Status Register Transmit Next Packet in Queue Update Queue Pointers DMA Packet from Local memory to PC Inform High Level Software Inform High Level Software Enable Interrupt Restore PC Registers Receive Buffer Ring Empty? IRET Send “EOI” to 8259 Empty Transmission Queue? NO YES NCTU High Speed Network Lab
Driver Send NIC Ready to Transmit? DMA Packet from PC to Local Memory Queue Packet in PC Memory Program NIC to Transmit Packet (Command Reg = 26h) RETURN Driver Send NO YES NCTU High Speed Network Lab
Note: Enter ISR Disable PC Interrupt Save PC Registers CLI PUSHA MOV AL,00H WR_NE INTERRUPTMASK Disable Adapter Interrupt MOV DX,20h MOV AL,63h OUT DX,AL Send EOI to 8259 Enable PC Interrupt STI NCTU High Speed Network Lab
Note: Leave ISR Disable PC Interrupt CLI MOV AL,0FFH WR_NE INTERRUPTMASK Enable Adapter Interrupt Restore PC Registers Enable PC Interrupt POPA STI Return to Original Process IRET NCTU High Speed Network Lab