Loading [MathJax]/extensions/tex2jax.js
CS350 COS
COS
All Data Structures Files Functions Variables Typedefs Macros
nic.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <sys/kassert.h>
#include <sys/kdebug.h>
#include <sys/queue.h>
#include <sys/mbuf.h>
#include <sys/nic.h>
#include <sys/spinlock.h>
Include dependency graph for nic.c:

Go to the source code of this file.

Functions

 LIST_HEAD (NICList, NIC)
 
void NIC_RemoveNIC (NIC *nic)
 
NICNIC_GetByID (uint64_t nicNo)
 
void Debug_NICs (int argc, const char *argv[])
 
 REGISTER_DBGCMD (nics, "List NICs", Debug_NICs)
 

Function Documentation

◆ Debug_NICs()

void Debug_NICs ( int  argc,
const char *  argv[] 
)

Definition at line 46 of file nic.c.

47{
48 NIC *n;
49
50 LIST_FOREACH(n, &nicList, entries) {
51 kprintf("nic%lld: %02x:%02x:%02x:%02x:%02x:%02x\n", n->nicNo,
52 n->mac[0], n->mac[1], n->mac[2], n->mac[3], n->mac[4], n->mac[5]);
53 }
54}
int kprintf(const char *fmt,...)
Definition: printf.c:210
#define LIST_FOREACH(var, head, field)
Definition: queue.h:410
Definition: nic.h:11
uint64_t nicNo
Definition: nic.h:13
uint8_t mac[6]
Definition: nic.h:14
Here is the call graph for this function:

◆ LIST_HEAD()

LIST_HEAD ( NICList  ,
NIC   
)

Definition at line 16 of file nic.c.

21{
22 nic->nicNo = nextNICNo++;
23 LIST_INSERT_HEAD(&nicList, nic, entries);
24}
#define LIST_INSERT_HEAD(head, elm, field)
Definition: queue.h:451

◆ NIC_GetByID()

NIC * NIC_GetByID ( uint64_t  nicNo)

Definition at line 33 of file nic.c.

34{
35 NIC *n;
36
37 LIST_FOREACH(n, &nicList, entries) {
38 if (n->nicNo == nicNo)
39 return n;
40 }
41
42 return NULL;
43}
static int nicNo
Definition: ethdump.c:9
#define NULL
Definition: stddef.h:6
Here is the caller graph for this function:

◆ NIC_RemoveNIC()

void NIC_RemoveNIC ( NIC nic)

Definition at line 27 of file nic.c.

28{
29 LIST_REMOVE(nic, entries);
30}
#define LIST_REMOVE(elm, field)
Definition: queue.h:465

◆ REGISTER_DBGCMD()

REGISTER_DBGCMD ( nics  ,
"List NICs"  ,
Debug_NICs   
)