1 2 #ifndef __SYS_NIC_H__ 3 #define __SYS_NIC_H__ 4 5 #include <sys/queue.h> 6 #include <sys/mbuf.h> 7 8 typedef void (*NICCB)(int, void *); 9 10 typedef struct NIC NIC; 11 typedef struct NIC { 12 void *handle; // Driver handle 13 uint64_t nicNo; // NIC number 14 uint8_t mac[6]; 15 int (*tx)(NIC *, MBuf *, NICCB, void *); // TX 16 int (*rx)(NIC *, MBuf *, NICCB, void *); // RX 17 int (*poll)(); 18 LIST_ENTRY(NIC) entries; 19 } NIC; 20 21 void NIC_AddNIC(NIC *nic); 22 void NIC_RemoveNIC(NIC *nic); 23 NIC *NIC_GetByID(uint64_t nicNo); 24 int NIC_GetMAC(NIC *nic, void *mac); 25 int NIC_TX(NIC *nic, MBuf *mbuf, NICCB cb, void *arg); 26 int NIC_RX(NIC *nic, MBuf *mbuf, NICCB cb, void *arg); 27 int NIC_Poll(); 28 29 #endif /* __SYS_NIC_H__ */ 30 31