Initial convertion to asynchronous sends for communicating with ethernet
drivers.
This commit is contained in:
parent
b613f5cb4b
commit
0bd4c5ee7d
@ -100,7 +100,8 @@ PUBLIC void eth_init()
|
|||||||
eth_fd_table[i].ef_flags= EFF_EMPTY;
|
eth_fd_table[i].ef_flags= EFF_EMPTY;
|
||||||
for (i=0; i<eth_conf_nr; i++)
|
for (i=0; i<eth_conf_nr; i++)
|
||||||
{
|
{
|
||||||
eth_port_table[i].etp_flags= EFF_EMPTY;
|
eth_port_table[i].etp_flags= EPF_EMPTY;
|
||||||
|
eth_port_table[i].etp_getstat= NULL;
|
||||||
eth_port_table[i].etp_sendq_head= NULL;
|
eth_port_table[i].etp_sendq_head= NULL;
|
||||||
eth_port_table[i].etp_sendq_tail= NULL;
|
eth_port_table[i].etp_sendq_tail= NULL;
|
||||||
eth_port_table[i].etp_type_any= NULL;
|
eth_port_table[i].etp_type_any= NULL;
|
||||||
@ -346,6 +347,15 @@ ioreq_t req;
|
|||||||
return NW_SUSPEND;
|
return NW_SUSPEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (eth_port->etp_getstat)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"eth_ioctl: pending eth_get_stat request, suspending caller\n");
|
||||||
|
assert(!(eth_fd->ef_flags & EFF_IOCTL_IP));
|
||||||
|
eth_fd->ef_flags |= EFF_IOCTL_IP;
|
||||||
|
return NW_SUSPEND;
|
||||||
|
}
|
||||||
|
|
||||||
acc= bf_memreq(sizeof(nwio_ethstat_t));
|
acc= bf_memreq(sizeof(nwio_ethstat_t));
|
||||||
compare (bf_bufsize(acc), ==, sizeof(*ethstat));
|
compare (bf_bufsize(acc), ==, sizeof(*ethstat));
|
||||||
|
|
||||||
@ -356,6 +366,20 @@ ioreq_t req;
|
|||||||
{
|
{
|
||||||
result= eth_get_stat(eth_port,
|
result= eth_get_stat(eth_port,
|
||||||
ðstat->nwes_stat);
|
ðstat->nwes_stat);
|
||||||
|
if (result == SUSPEND)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"eth_ioctl: eth_get_stat returned SUSPEND\n");
|
||||||
|
eth_fd->ef_ioctl_req= req;
|
||||||
|
assert(!(eth_fd->ef_flags &
|
||||||
|
EFF_IOCTL_IP));
|
||||||
|
eth_fd->ef_flags |= EFF_IOCTL_IP;
|
||||||
|
printf("eth_ioctl: setting etp_getstat in port %d to %p\n",
|
||||||
|
eth_port-eth_port_table, acc);
|
||||||
|
eth_port->etp_getstat= acc;
|
||||||
|
acc= NULL;
|
||||||
|
return NW_SUSPEND;
|
||||||
|
}
|
||||||
if (result != NW_OK)
|
if (result != NW_OK)
|
||||||
{
|
{
|
||||||
bf_afree(acc);
|
bf_afree(acc);
|
||||||
@ -993,8 +1017,18 @@ eth_port_t *vlan_port;
|
|||||||
PUBLIC void eth_restart_ioctl(eth_port)
|
PUBLIC void eth_restart_ioctl(eth_port)
|
||||||
eth_port_t *eth_port;
|
eth_port_t *eth_port;
|
||||||
{
|
{
|
||||||
int i;
|
int i, r;
|
||||||
eth_fd_t *eth_fd;
|
eth_fd_t *eth_fd;
|
||||||
|
acc_t *acc;
|
||||||
|
|
||||||
|
printf("in eth_restart_ioctl\n");
|
||||||
|
|
||||||
|
/* eth_restart_ioctl is called on too occasions: when a device
|
||||||
|
* driver registers with inet and when a eth_get_stat call has
|
||||||
|
* completed. We assume the second option when etp_getstat is
|
||||||
|
* not equal to zero at the start of the call.
|
||||||
|
*/
|
||||||
|
acc= eth_port->etp_getstat;
|
||||||
|
|
||||||
for (i= 0, eth_fd= eth_fd_table; i<ETH_FD_NR; i++, eth_fd++)
|
for (i= 0, eth_fd= eth_fd_table; i<ETH_FD_NR; i++, eth_fd++)
|
||||||
{
|
{
|
||||||
@ -1007,9 +1041,36 @@ eth_port_t *eth_port;
|
|||||||
if (eth_fd->ef_ioctl_req != NWIOGETHSTAT)
|
if (eth_fd->ef_ioctl_req != NWIOGETHSTAT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
printf("eth_restart_ioctl: etp_getstat in port %d is %p\n",
|
||||||
|
eth_port-eth_port_table, acc);
|
||||||
|
|
||||||
|
if (acc != NULL)
|
||||||
|
{
|
||||||
|
printf("eth_restart_ioctl: completed getstat\n");
|
||||||
|
acc->acc_linkC++;
|
||||||
|
r= (*eth_fd->ef_put_userdata)(eth_fd->ef_srfd, 0,
|
||||||
|
acc, TRUE);
|
||||||
|
if (r >= 0)
|
||||||
|
reply_thr_put(eth_fd, NW_OK, TRUE);
|
||||||
|
eth_fd->ef_flags &= ~EFF_IOCTL_IP;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
{ static int count; if (++count > 5) ip_panic(("too many restarts")); }
|
||||||
|
|
||||||
eth_fd->ef_flags &= ~EFF_IOCTL_IP;
|
eth_fd->ef_flags &= ~EFF_IOCTL_IP;
|
||||||
eth_ioctl(i, eth_fd->ef_ioctl_req);
|
eth_ioctl(i, eth_fd->ef_ioctl_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (acc != NULL)
|
||||||
|
{
|
||||||
|
printf("eth_restart_ioctl: clearing etp_getstat in port %d\n",
|
||||||
|
eth_port-eth_port_table);
|
||||||
|
assert(acc == eth_port->etp_getstat);
|
||||||
|
|
||||||
|
bf_afree(acc);
|
||||||
|
eth_port->etp_getstat= NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRIVATE void packet2user (eth_fd, pack, exp_time)
|
PRIVATE void packet2user (eth_fd, pack, exp_time)
|
||||||
|
@ -21,6 +21,7 @@ typedef struct eth_port
|
|||||||
int etp_flags;
|
int etp_flags;
|
||||||
ether_addr_t etp_ethaddr;
|
ether_addr_t etp_ethaddr;
|
||||||
acc_t *etp_wr_pack, *etp_rd_pack;
|
acc_t *etp_wr_pack, *etp_rd_pack;
|
||||||
|
acc_t *etp_getstat;
|
||||||
struct eth_fd *etp_sendq_head;
|
struct eth_fd *etp_sendq_head;
|
||||||
struct eth_fd *etp_sendq_tail;
|
struct eth_fd *etp_sendq_tail;
|
||||||
struct eth_fd *etp_type_any;
|
struct eth_fd *etp_type_any;
|
||||||
|
@ -426,6 +426,15 @@ ioreq_t req;
|
|||||||
return (*ip_fd->if_put_userdata)(ip_fd->if_srfd,
|
return (*ip_fd->if_put_userdata)(ip_fd->if_srfd,
|
||||||
EBADIOCTL, (acc_t *)0, TRUE);
|
EBADIOCTL, (acc_t *)0, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(ip_port->ip_flags & IPF_IPADDRSET))
|
||||||
|
{
|
||||||
|
ip_fd->if_ioctl= req;
|
||||||
|
ip_fd->if_flags |= IFF_IOCTL_IP;
|
||||||
|
printf("ip_ioctl: suspending ARP request\n");
|
||||||
|
return NW_SUSPEND;
|
||||||
|
}
|
||||||
|
|
||||||
result= arp_ioctl(ip_port->ip_dl.dl_eth.de_port,
|
result= arp_ioctl(ip_port->ip_dl.dl_eth.de_port,
|
||||||
ip_fd->if_srfd, req, ip_fd->if_get_userdata,
|
ip_fd->if_srfd, req, ip_fd->if_get_userdata,
|
||||||
ip_fd->if_put_userdata);
|
ip_fd->if_put_userdata);
|
||||||
|
@ -35,7 +35,7 @@ from DL_ETH:
|
|||||||
| m_type | DL_PORT | DL_PROC | DL_COUNT | DL_STAT | DL_TIME |
|
| m_type | DL_PORT | DL_PROC | DL_COUNT | DL_STAT | DL_TIME |
|
||||||
|_______________|___________|_________|__________|____________|_________|
|
|_______________|___________|_________|__________|____________|_________|
|
||||||
| | | | | | |
|
| | | | | | |
|
||||||
| DL_INIT_REPLY | minor dev | proc nr | rd_count | 0 | stat | time |
|
| DL_CONF_REPLY | minor dev | proc nr | rd_count | 0 | stat | time |
|
||||||
|_______________|___________|_________|__________|____________|_________|
|
|_______________|___________|_________|__________|____________|_________|
|
||||||
| | | | | | |
|
| | | | | | |
|
||||||
| DL_TASK_REPLY | minor dev | proc nr | rd_count | err | stat | time |
|
| DL_TASK_REPLY | minor dev | proc nr | rd_count | err | stat | time |
|
||||||
@ -95,7 +95,7 @@ PUBLIC void main()
|
|||||||
{
|
{
|
||||||
mq_t *mq;
|
mq_t *mq;
|
||||||
int r;
|
int r;
|
||||||
int source, timerand, fd;
|
int source, m_type, timerand, fd;
|
||||||
struct fssignon device;
|
struct fssignon device;
|
||||||
#ifdef __minix_vmd
|
#ifdef __minix_vmd
|
||||||
struct systaskinfo info;
|
struct systaskinfo info;
|
||||||
@ -229,6 +229,7 @@ PUBLIC void main()
|
|||||||
}
|
}
|
||||||
reset_time();
|
reset_time();
|
||||||
source= mq->mq_mess.m_source;
|
source= mq->mq_mess.m_source;
|
||||||
|
m_type= mq->mq_mess.m_type;
|
||||||
if (source == FS_PROC_NR)
|
if (source == FS_PROC_NR)
|
||||||
{
|
{
|
||||||
sr_rec(mq);
|
sr_rec(mq);
|
||||||
@ -240,25 +241,26 @@ PUBLIC void main()
|
|||||||
mq_free(mq);
|
mq_free(mq);
|
||||||
}
|
}
|
||||||
#else /* Minix 3 */
|
#else /* Minix 3 */
|
||||||
else if (mq->mq_mess.m_type == SYN_ALARM)
|
else if (m_type == SYN_ALARM)
|
||||||
{
|
{
|
||||||
clck_tick(&mq->mq_mess);
|
clck_tick(&mq->mq_mess);
|
||||||
mq_free(mq);
|
mq_free(mq);
|
||||||
}
|
}
|
||||||
else if (mq->mq_mess.m_type == PROC_EVENT)
|
else if (m_type == PROC_EVENT)
|
||||||
{
|
{
|
||||||
/* signaled */
|
/* signaled */
|
||||||
/* probably SIGTERM */
|
/* probably SIGTERM */
|
||||||
mq_free(mq);
|
mq_free(mq);
|
||||||
}
|
}
|
||||||
else if (mq->mq_mess.m_type & NOTIFY_MESSAGE)
|
else if (m_type & NOTIFY_MESSAGE)
|
||||||
{
|
{
|
||||||
/* A driver is (re)started. */
|
/* A driver is (re)started. */
|
||||||
eth_check_drivers(&mq->mq_mess);
|
eth_check_drivers(&mq->mq_mess);
|
||||||
mq_free(mq);
|
mq_free(mq);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (mq->mq_mess.m_type == DL_TASK_REPLY)
|
else if (m_type == DL_CONF_REPLY || m_type == DL_TASK_REPLY ||
|
||||||
|
m_type == DL_NAME_REPLY || m_type == DL_STAT_REPLY)
|
||||||
{
|
{
|
||||||
eth_rec(&mq->mq_mess);
|
eth_rec(&mq->mq_mess);
|
||||||
mq_free(mq);
|
mq_free(mq);
|
||||||
|
@ -23,6 +23,9 @@ Copyright 1995 Philip Homburg
|
|||||||
#include <minix/sysutil.h>
|
#include <minix/sysutil.h>
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
#include "inet_config.h"
|
#include "inet_config.h"
|
||||||
|
#include "inet.h"
|
||||||
|
|
||||||
|
THIS_FILE
|
||||||
|
|
||||||
struct eth_conf eth_conf[IP_PORT_MAX];
|
struct eth_conf eth_conf[IP_PORT_MAX];
|
||||||
struct psip_conf psip_conf[IP_PORT_MAX];
|
struct psip_conf psip_conf[IP_PORT_MAX];
|
||||||
@ -213,6 +216,13 @@ void read_conf(void)
|
|||||||
struct ip_conf *icp;
|
struct ip_conf *icp;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
{ static int first= 1;
|
||||||
|
if (!first) ip_panic(( "read_conf: called a second time" ));
|
||||||
|
first= 0;
|
||||||
|
*(u8_t *)0 = 0xcc; /* INT 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Open the configuration file. */
|
/* Open the configuration file. */
|
||||||
if ((cfg_fd= open(PATH_INET_CONF, O_RDONLY)) == -1)
|
if ((cfg_fd= open(PATH_INET_CONF, O_RDONLY)) == -1)
|
||||||
fatal(PATH_INET_CONF);
|
fatal(PATH_INET_CONF);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,8 @@ Copyright 1995 Philip Homburg
|
|||||||
|
|
||||||
typedef struct osdep_eth_port
|
typedef struct osdep_eth_port
|
||||||
{
|
{
|
||||||
|
int etp_state;
|
||||||
|
int etp_flags;
|
||||||
int etp_task;
|
int etp_task;
|
||||||
int etp_port;
|
int etp_port;
|
||||||
int etp_recvconf;
|
int etp_recvconf;
|
||||||
@ -27,8 +29,31 @@ typedef struct osdep_eth_port
|
|||||||
event_t etp_recvev;
|
event_t etp_recvev;
|
||||||
message etp_sendrepl;
|
message etp_sendrepl;
|
||||||
message etp_recvrepl;
|
message etp_recvrepl;
|
||||||
|
cp_grant_id_t etp_stat_gid;
|
||||||
|
eth_stat_t *etp_stat_buf;
|
||||||
} osdep_eth_port_t;
|
} osdep_eth_port_t;
|
||||||
|
|
||||||
|
#define OEPS_INIT 0 /* Not initialized */
|
||||||
|
#define OEPS_CONF_SENT 1 /* Conf. request has been sent */
|
||||||
|
#define OEPS_IDLE 2 /* Device is ready to accept requests */
|
||||||
|
#define OEPS_RECV_SENT 3 /* Recv. request has been sent */
|
||||||
|
#define OEPS_SEND_SENT 4 /* Send request has been sent */
|
||||||
|
#define OEPS_GETSTAT_SENT 5 /* GETSTAT request has been sent */
|
||||||
|
|
||||||
|
#define OEPF_EMPTY 0
|
||||||
|
#define OEPF_NEED_RECV 1 /* Issue recv. request when the state becomes
|
||||||
|
* idle
|
||||||
|
*/
|
||||||
|
#define OEPF_NEED_SEND 2 /* Issue send request when the state becomes
|
||||||
|
* idle
|
||||||
|
*/
|
||||||
|
#define OEPF_NEED_CONF 4 /* Issue conf request when the state becomes
|
||||||
|
* idle
|
||||||
|
*/
|
||||||
|
#define OEPF_NEED_STAT 8 /* Issue getstat request when the state becomes
|
||||||
|
* idle
|
||||||
|
*/
|
||||||
|
|
||||||
#endif /* INET__OSDEP_ETH_H */
|
#endif /* INET__OSDEP_ETH_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user