This patch switches the MINIX3 ethernet driver stack from a port-based

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.
This commit is contained in:
David van Moolenbroek
2010-05-17 22:22:53 +00:00
parent f5bce90216
commit 9ba65d2ea8
55 changed files with 1971 additions and 4794 deletions

View File

@@ -262,45 +262,35 @@
#define DL_RS_BASE 0x280
/* Message types for data link layer requests. */
#define DL_WRITE (DL_RQ_BASE + 3)
#define DL_WRITEV (DL_RQ_BASE + 4)
#define DL_READ (DL_RQ_BASE + 5)
#define DL_READV (DL_RQ_BASE + 6)
#define DL_CONF (DL_RQ_BASE + 7)
#define DL_STOP (DL_RQ_BASE + 8)
#define DL_GETSTAT (DL_RQ_BASE + 9)
#define DL_GETNAME (DL_RQ_BASE +10)
#define DL_WRITEV_S (DL_RQ_BASE +11)
#define DL_READV_S (DL_RQ_BASE +12)
#define DL_GETSTAT_S (DL_RQ_BASE +13)
#define DL_CONF (DL_RQ_BASE + 0)
#define DL_GETSTAT_S (DL_RQ_BASE + 1)
#define DL_WRITEV_S (DL_RQ_BASE + 2)
#define DL_READV_S (DL_RQ_BASE + 3)
/* Message type for data link layer replies. */
#define DL_CONF_REPLY (DL_RS_BASE + 20)
#define DL_TASK_REPLY (DL_RS_BASE + 21)
#define DL_NAME_REPLY (DL_RS_BASE + 22)
#define DL_STAT_REPLY (DL_RS_BASE + 23)
#define DL_CONF_REPLY (DL_RS_BASE + 0)
#define DL_STAT_REPLY (DL_RS_BASE + 1)
#define DL_TASK_REPLY (DL_RS_BASE + 2)
/* Field names for data link layer messages. */
#define DL_PORT m2_i1
#define DL_PROC m2_i2 /* endpoint */
#define DL_ENDPT m2_i2
#define DL_COUNT m2_i3
#define DL_MODE m2_l1
#define DL_CLCK m2_l2
#define DL_ADDR m2_p1
#define DL_STAT m2_l1
#define DL_FLAGS m2_l1
#define DL_GRANT m2_l2
#define DL_NAME m3_ca1
#define DL_STAT m3_i1
#define DL_HWADDR m3_ca1
/* Bits in 'DL_STAT' field of DL replies. */
/* Bits in 'DL_FLAGS' field of DL replies. */
# define DL_NOFLAGS 0x00
# define DL_PACK_SEND 0x01
# define DL_PACK_RECV 0x02
# define DL_READ_IP 0x04
/* Bits in 'DL_MODE' field of DL requests. */
# define DL_NOMODE 0x0
# define DL_PROMISC_REQ 0x2
# define DL_MULTI_REQ 0x4
# define DL_BROAD_REQ 0x8
# define DL_PROMISC_REQ 0x1
# define DL_MULTI_REQ 0x2
# define DL_BROAD_REQ 0x4
/*===========================================================================*
* SYSTASK request types and field names *

View File

@@ -1,38 +1,42 @@
/* asynchio.h - Asynchronous I/O Author: Kees J. Bot
* 26 Jan 1995
* This is just a fake async I/O library to be used for programs
* written for Minix-vmd that must also run under standard Minix.
* This limits the number of ugly #ifdefs somewhat. The programs must
* be restricted to performing just one service, of course.
* 7 Jul 1997
* Minix-vmd compatible asynchio(3) using BSD select(2).
*/
#ifndef _SYS__ASYNCHIO_H
#define _SYS__ASYNCHIO_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
#include <sys/select.h> /* for FD_SETSIZE */
#include <sys/time.h>
#define SEL_READ 0 /* Code for a read. */
#define SEL_WRITE 1 /* Code for a write. */
#define SEL_EXCEPT 2 /* Code for some exception. */
#define SEL_NR 3 /* Number of codes. */
struct _asynfd {
int afd_seen; /* Set if we manage this descriptor. */
int afd_flags; /* File flags by fcntl(fd, F_GETFL). */
int afd_state[SEL_NR]; /* Operation state. */
};
typedef struct {
char state;
char op;
char fd;
char req;
void *data;
ssize_t count;
int errno;
int asyn_more; /* Set if more to do before blocking. */
struct _asynfd asyn_afd[FD_SETSIZE];
fd_set asyn_fdset[SEL_NR]; /* Select() fd sets. */
} asynchio_t;
#define ASYN_NONBLOCK 0x01
#define ASYN_INPROGRESS EAGAIN /* Errno code telling "nothing yet." */
#define ASYN_NONBLOCK 0x01 /* If asyn_wait() mustn't block. */
#define ASYN_INPROGRESS EINPROGRESS
struct timeval;
void asyn_init(asynchio_t *_asyn);
ssize_t asyn_read(asynchio_t *_asyn, int _fd, void *_buf, size_t _len);
ssize_t asyn_write(asynchio_t *_asyn, int _fd, const void *_buf, size_t _len);
int asyn_ioctl(asynchio_t *_asyn, int _fd, unsigned long _request, void *_data);
int asyn_special(asynchio_t *_asyn, int _fd, int _op);
int asyn_result(asynchio_t *_asyn, int _fd, int _op, int _result);
int asyn_wait(asynchio_t *_asyn, int _flags, struct timeval *to);
int asyn_cancel(asynchio_t *_asyn, int _fd, int _op);
int asyn_pending(asynchio_t *_asyn, int _fd, int _op);
int asyn_synch(asynchio_t *_asyn, int _fd);
int asyn_close(asynchio_t *_asyn, int _fd);