Make lance driver notify inet on startup, and respond to getname

This commit is contained in:
Ben Gras 2005-10-21 18:20:44 +00:00
parent 2b23d38c5b
commit d0806fd1af

View file

@ -166,6 +166,7 @@ _PROTOTYPE( static void put_userdata,
vir_bytes user_addr, vir_bytes count,
void *loc_addr) );
_PROTOTYPE( static void do_stop, (message *mp) );
_PROTOTYPE( static void do_getname, (message *mp) );
_PROTOTYPE( static void lance_dump, (void) );
_PROTOTYPE( static void lance_stop, (void) );
@ -296,6 +297,7 @@ static int rx_slot_nr = 0; /* Rx-slot number */
static int tx_slot_nr = 0; /* Tx-slot number */
static int cur_tx_slot_nr = 0; /* Tx-slot number */
static char isstored[TX_RING_SIZE]; /* Tx-slot in-use */
static char *progname;
/*===========================================================================*
@ -304,10 +306,11 @@ static char isstored[TX_RING_SIZE]; /* Tx-slot in-use */
void main( int argc, char **argv )
{
message m;
int i,irq,r;
int i,irq,r, tasknr;
ether_card_t *ec;
long v;
int fkeys, sfkeys;
(progname=strrchr(argv[0],'/')) ? progname++ : (progname=argv[0]);
env_setargs( argc, argv );
@ -323,6 +326,11 @@ void main( int argc, char **argv )
(void) env_parse("ETH_IGN_PROTO", "x", 0, &v, 0x0000L, 0xFFFFL);
eth_ign_proto= htons((u16_t) v);
/* Try to notify inet that we are present (again) */
r = findproc("inet", &tasknr);
if (r == OK)
notify(tasknr);
while (TRUE)
{
for (i=0;i<EC_PORT_NR_MAX;++i)
@ -353,6 +361,7 @@ void main( int argc, char **argv )
case DL_INIT: do_init(&m); break;
case DL_GETSTAT: do_getstat(&m); break;
case DL_STOP: do_stop(&m); break;
case DL_GETNAME: do_getname(&m); break;
case FKEY_PRESSED: lance_dump(); break;
/*case HARD_STOP: lance_stop(); break;*/
case SYS_SIG:
@ -1686,6 +1695,21 @@ ether_card_t *ec;
return lance_version;
}
/*===========================================================================*
* do_getname *
*===========================================================================*/
static void do_getname(mp)
message *mp;
{
int r;
strncpy(mp->DL_NAME, progname, sizeof(mp->DL_NAME));
mp->DL_NAME[sizeof(mp->DL_NAME)-1]= '\0';
mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp);
if (r != OK)
panic("LANCE", "do_getname: send failed", r);
}
/*===========================================================================*
* lance_init_card *