9ba65d2ea8
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.
94 lines
3 KiB
C
94 lines
3 KiB
C
#include "rtl8139.h"
|
|
|
|
/* State management variables. */
|
|
EXTERN re_t re_state;
|
|
|
|
/* Custom states definition. */
|
|
#define RL_STATE_READ_PROTOCOL_FREE (SEF_LU_STATE_CUSTOM_BASE + 0)
|
|
#define RL_STATE_WRITE_PROTOCOL_FREE (SEF_LU_STATE_CUSTOM_BASE + 1)
|
|
#define RL_STATE_IS_CUSTOM(s) \
|
|
((s) >= RL_STATE_READ_PROTOCOL_FREE && (s) <= RL_STATE_WRITE_PROTOCOL_FREE)
|
|
|
|
/* State management helpers. */
|
|
PRIVATE int is_reading;
|
|
PRIVATE int is_writing;
|
|
|
|
PRIVATE void load_state_info(void)
|
|
{
|
|
re_t *rep;
|
|
|
|
/* Check if we are reading or writing. */
|
|
rep = &re_state;
|
|
|
|
is_reading = !!(rep->re_flags & REF_READING);
|
|
is_writing = !!(rep->re_flags & REF_SEND_AVAIL);
|
|
}
|
|
|
|
/*===========================================================================*
|
|
* sef_cb_lu_prepare *
|
|
*===========================================================================*/
|
|
PUBLIC int sef_cb_lu_prepare(int state)
|
|
{
|
|
int is_ready;
|
|
|
|
/* Load state information. */
|
|
load_state_info();
|
|
|
|
/* Check if we are ready for the target state. */
|
|
is_ready = FALSE;
|
|
switch(state) {
|
|
/* Standard states. */
|
|
case SEF_LU_STATE_REQUEST_FREE:
|
|
is_ready = TRUE;
|
|
break;
|
|
|
|
case SEF_LU_STATE_PROTOCOL_FREE:
|
|
is_ready = (!is_reading && !is_writing);
|
|
break;
|
|
|
|
/* Custom states. */
|
|
case RL_STATE_READ_PROTOCOL_FREE:
|
|
is_ready = (!is_reading);
|
|
break;
|
|
|
|
case RL_STATE_WRITE_PROTOCOL_FREE:
|
|
is_ready = (!is_writing);
|
|
break;
|
|
}
|
|
|
|
/* Tell SEF if we are ready. */
|
|
return is_ready ? OK : ENOTREADY;
|
|
}
|
|
|
|
/*===========================================================================*
|
|
* sef_cb_lu_state_isvalid *
|
|
*===========================================================================*/
|
|
PUBLIC int sef_cb_lu_state_isvalid(int state)
|
|
{
|
|
return SEF_LU_STATE_IS_STANDARD(state) || RL_STATE_IS_CUSTOM(state);
|
|
}
|
|
|
|
/*===========================================================================*
|
|
* sef_cb_lu_state_dump *
|
|
*===========================================================================*/
|
|
PUBLIC void sef_cb_lu_state_dump(int state)
|
|
{
|
|
/* Load state information. */
|
|
load_state_info();
|
|
|
|
sef_lu_dprint("rtl8139: live update state = %d\n", state);
|
|
sef_lu_dprint("rtl8139: is_reading = %d\n", is_reading);
|
|
sef_lu_dprint("rtl8139: is_writing = %d\n", is_writing);
|
|
|
|
sef_lu_dprint("rtl8139: SEF_LU_STATE_WORK_FREE(%d) reached = %d\n",
|
|
SEF_LU_STATE_WORK_FREE, TRUE);
|
|
sef_lu_dprint("rtl8139: SEF_LU_STATE_REQUEST_FREE(%d) reached = %d\n",
|
|
SEF_LU_STATE_REQUEST_FREE, TRUE);
|
|
sef_lu_dprint("rtl8139: SEF_LU_STATE_PROTOCOL_FREE(%d) reached = %d\n",
|
|
SEF_LU_STATE_PROTOCOL_FREE, (!is_reading && !is_writing));
|
|
sef_lu_dprint("rtl8139: RL_STATE_READ_PROTOCOL_FREE(%d) reached = %d\n",
|
|
RL_STATE_READ_PROTOCOL_FREE, (!is_reading));
|
|
sef_lu_dprint("rtl8139: RL_STATE_WRITE_PROTOCOL_FREE(%d) reached = %d\n",
|
|
RL_STATE_WRITE_PROTOCOL_FREE, (!is_writing));
|
|
}
|
|
|