1 /* This file contains device independent network device driver interface.
4 * Apr 01, 2010 Created (Cristiano Giuffrida)
6 * The file contains the following entry points:
8 * netdriver_announce: called by a network driver to announce it is up
9 * netdriver_receive: receive() interface for network drivers
12 #include <minix/drivers.h>
13 #include <minix/endpoint.h>
14 #include <minix/netdriver.h>
17 static int conf_expected
= TRUE
;
19 /*===========================================================================*
20 * netdriver_announce *
21 *===========================================================================*/
22 void netdriver_announce()
24 /* Announce we are up after a fresh start or restart. */
26 char key
[DS_MAX_KEYLEN
];
27 char label
[DS_MAX_KEYLEN
];
28 char *driver_prefix
= "drv.net.";
30 /* Publish a driver up event. */
31 r
= ds_retrieve_label_name(label
, sef_self());
33 panic("driver_announce: unable to get own label: %d\n", r
);
35 snprintf(key
, DS_MAX_KEYLEN
, "%s%s", driver_prefix
, label
);
36 r
= ds_publish_u32(key
, DS_DRIVER_UP
, DSF_OVERWRITE
);
38 panic("driver_announce: unable to publish driver up event: %d\n", r
);
44 /*===========================================================================*
46 *===========================================================================*/
47 int netdriver_receive(src
, m_ptr
, status_ptr
)
52 /* receive() interface for drivers. */
56 /* Wait for a request. */
57 r
= sef_receive_status(src
, m_ptr
, status_ptr
);
62 /* Let non-datalink requests through regardless. */
63 if (!IS_DL_RQ(m_ptr
->m_type
)) {
67 /* See if only DL_CONF is to be expected. */
69 if(m_ptr
->m_type
== DL_CONF
) {
70 conf_expected
= FALSE
;