model to an instance-based model. Each ethernet driver instance is now responsible for exactly one network interface card. The port field in /etc/inet.conf now acts as an instance field instead. This patch also updates the data link protocol. This update: - eliminates the concept of ports entirely; - eliminates DL_GETNAME entirely; - standardizes on using m_source for IPC and DL_ENDPT for safecopies; - removes error codes from TASK/STAT replies, as they were unused; - removes a number of other old or unused fields; - names and renames a few other fields. All ethernet drivers have been changed to: - conform to the new protocol, and exactly that; - take on an instance number based on a given "instance" argument; - skip that number of PCI devices in probe iterations; - use config tables and environment variables based on that number; - no longer be limited to a predefined maximum of cards in any way; - get rid of any leftover non-safecopy support and other ancient junk; - have a correct banner protocol figure, or none at all. Other changes: * Inet.conf is now taken to be line-based, and supports #-comments. No existing installations are expected to be affected by this. * A new, select-based asynchio library replaces the old one. Kindly contributed by Kees J. Bot. * Inet now supports use of select() on IP devices. Combined, the last two changes together speed up dhcpd considerably in the presence of multiple interfaces. * A small bug has been fixed in nonamed.
77 lines
1.9 KiB
C
77 lines
1.9 KiB
C
/* This file contains device independent network device driver interface.
|
|
*
|
|
* Changes:
|
|
* Apr 01, 2010 Created (Cristiano Giuffrida)
|
|
*
|
|
* The file contains the following entry points:
|
|
*
|
|
* netdriver_announce: called by a network driver to announce it is up
|
|
* netdriver_receive: receive() interface for network drivers
|
|
*/
|
|
|
|
#include <minix/drivers.h>
|
|
#include <minix/endpoint.h>
|
|
#include <minix/netdriver.h>
|
|
#include <minix/ds.h>
|
|
|
|
PRIVATE int conf_expected = TRUE;
|
|
|
|
/*===========================================================================*
|
|
* netdriver_announce *
|
|
*===========================================================================*/
|
|
PUBLIC void netdriver_announce()
|
|
{
|
|
/* Announce we are up after a fresh start or restart. */
|
|
int r;
|
|
char key[DS_MAX_KEYLEN];
|
|
char label[DS_MAX_KEYLEN];
|
|
char *driver_prefix = "drv.net.";
|
|
|
|
/* Publish a driver up event. */
|
|
r = ds_retrieve_label_name(label, getprocnr());
|
|
if (r != OK) {
|
|
panic("driver_announce: unable to get own label: %d\n", r);
|
|
}
|
|
snprintf(key, DS_MAX_KEYLEN, "%s%s", driver_prefix, label);
|
|
r = ds_publish_u32(key, DS_DRIVER_UP, DSF_OVERWRITE);
|
|
if (r != OK) {
|
|
panic("driver_announce: unable to publish driver up event: %d\n", r);
|
|
}
|
|
|
|
conf_expected = TRUE;
|
|
}
|
|
|
|
/*===========================================================================*
|
|
* netdriver_receive *
|
|
*===========================================================================*/
|
|
PUBLIC int netdriver_receive(src, m_ptr, status_ptr)
|
|
endpoint_t src;
|
|
message *m_ptr;
|
|
int *status_ptr;
|
|
{
|
|
/* receive() interface for drivers. */
|
|
int r;
|
|
|
|
while (TRUE) {
|
|
/* Wait for a request. */
|
|
r = sef_receive_status(src, m_ptr, status_ptr);
|
|
if (r != OK) {
|
|
return r;
|
|
}
|
|
|
|
/* See if only DL_CONF is to be expected. */
|
|
if(conf_expected) {
|
|
if(m_ptr->m_type == DL_CONF) {
|
|
conf_expected = FALSE;
|
|
}
|
|
else {
|
|
continue;
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
return OK;
|
|
}
|
|
|