[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

double check me on this (fwd)



Jay Kulpinski wrote:

> This seems to work, but the 1 second delay is too much.  I'm changing it
> to this
> which I expect to work, although it'll take the computer longer than
> I'll be here
> tonight to finish rebuilding RTEMS.  I'll verify that it works Monday
> morning.
> I only changed allocation of clusters since mbufs haven't caused a
> problem
> yet, most likely because I run out of clusters first.
> 
> (8)% diff -c rtems-19990426/c/src/lib/libnetworking/sys/mbuf.h{-orig,}
> *** rtems-19990426/c/src/lib/libnetworking/sys/mbuf.h-orig      Fri May
> 21 13:18:43 1999
> --- rtems-19990426/c/src/lib/libnetworking/sys/mbuf.h   Fri May 21
> 15:31:14 1999
> ***************
> *** 238,245 ****
>    */
>   #define       MCLALLOC(_p, _how) \
>         MBUFLOCK( \
> !         if (mclfree == 0) \
> !               (void)m_clalloc(1, (_how)); \
>           if (((_p) = (caddr_t)mclfree) != 0) { \
>                 ++mclrefcnt[mtocl(_p)]; \
>                 mbstat.m_clfree--; \
> --- 238,255 ----
>    */
>   #define       MCLALLOC(_p, _how) \
>         MBUFLOCK( \
> !       { \
> !         extern int rtems_bsdnet_ticks_per_second; \
> !         int retrycount = 0; \
> !         while (mclfree == 0) { \
> !           if (++retrycount > 8 * rtems_bsdnet_ticks_per_second) { \
> !             rtems_panic("no network mbuf clusters available for 8
> seconds"); \
> !           } \
> !           rtems_bsdnet_semaphore_release(); \
> !           rtems_task_wake_after(1); \
> !           rtems_bsdnet_semaphore_obtain(); \
> !         } \
> !       } \
>           if (((_p) = (caddr_t)mclfree) != 0) { \
>                 ++mclrefcnt[mtocl(_p)]; \
>                 mbstat.m_clfree--; \

I don't think this is the best place to make the change since it adds quite a bit of code that gets expanded every place the macro is used.  I think the better approach is to redo m_mballoc and m_clalloc.  I should have this done by early next week.

-- 
Eric Norum                                 eric at cls.usask.ca
Saskatchewan Accelerator Laboratory        Phone: (306) 966-6308
University of Saskatchewan                 FAX:   (306) 966-6058
Saskatoon, Canada.