[ECOS] several question in ecos network stack

张 亮 johnsonest@hotmail.com
Tue Jan 7 03:12:00 GMT 2003


Dear Gary Thomas and others! 

    I have several questions in ecos network stack: 
1   as we know,ecos modified struct ifnet in BSD: 
considering device driver and logical interface as a whole interface,I 
think it's a good idea.but when init a interface,ecos let (*if_reset) and 
(*if_watchdog)=NULL,will it involve problems? 
2      ecos use only one spl_mutex to prevent many resource,it will add 
overhead and destroy priority partially,for example,one thread access 
resource A,at the monmoment,another higher thread need to access resource 
B,latter must wait to former,although it has a higher priority. how does 
designer think? 
3    (re)write cyg_wakeup() and cyg_tsleep() for what? could you give me 
some explanation?
thank you! 








>From: Gary Thomas <gary@mlbassoc.com>
>To: ��<johnsonest@hotmail.com>
>CC: eCos Discussion <ecos-discuss@sources.redhat.com>
>Subject: Re: [ECOS] m_clalloc(ncl, nowait),whether ncl will be  too large 
toalloc?
>Date: 01 Jan 2003 08:40:50 -0700
>
>On Tue, 2002-12-31 at 20:24, ��wrote:
> >
> > m_clalloc(ncl, nowait),whether ncl will be  too large to alloc?
> > when this occur,
> >
> >
> > m_clalloc(ncl, nowait)
> > 	register int ncl;
> > 	int nowait;
> > {
> > #ifdef __ECOS
> > 	caddr_t p;
> > 	int i;
> >
> >         if (ncl != 1) {
> >             panic("Allocate multiple clusters!");
> >         }
> >         p = (caddr_t)cyg_net_cluster_alloc();
> > 	if (p == NULL) {
> > 		m_reclaim();
> > 		return (mclfree != NULL);
> > 	}
> > 	for (i = 0; i < ncl; i++) {//DANGER!
> > 		((union mcluster *)p)->mcl_next = mclfree;
> > 		mclfree = (union mcluster *)p;
> > 		p += MCLBYTES;
> > 		mbstat.m_clfree++;
> > 	}
> > 	mbstat.m_clusters += ncl;
> > 	return (1);
> >
> >
> >
> > p += MCLBYTES maybe overflowed!
> > right?
>
>No, because ncl == 1.
>
>--
>------------------------------------------------------------
>Gary Thomas                 |
>MLB Associates              |  Consulting for the
>+1 (970) 229-1963           |    Embedded world
>http://www.mlbassoc.com/    |
>email: <gary@mlbassoc.com>  |
>gpg: http://www.chez-thomas.org/gary/gpg_key.asc
>------------------------------------------------------------


_________________________________________________________________
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list