Francois Bouchard

About "nbuf.c", Ethernet driver, all MCF

Discussion created by Francois Bouchard on Oct 2, 2009
Latest reply on Oct 3, 2009 by Stan Chernikov

Hi all,


I noticed that nbuf.c/.h is spread amongst user to develop Ethernet driver.  Me too I use this file as my FEC buffer ring module.


I got doubt about the following function code.  When a RxBD (Buffer Descriptor) is already used, it will return NULL, but it does'nt restablish the old interrupt level.  I think it the level should be restablished prior returning NULL.



NBUF * nbuf_rx_allocate (void){ /* This routine alters shared data. Disable interrupts! */ int old_ipl = asm_set_ipl(6); /* Return a pointer to the next empty Rx Buffer Descriptor */ int i = iRxbd;//#if 0 /* Check to see if the ring of BDs is full */ if (RxNBUF[i].status & RX_BD_INUSE)  return NULL; /* Mark the buffer as in use */ RxNBUF[i].status |= RX_BD_INUSE;//#endif  /* increment the circular index */ iRxbd = (uint8)((iRxbd + 1) % NUM_RXBDS); /* Restore previous IPL */ asm_set_ipl((uint32)(old_ipl)); return &RxNBUF[i];}

What do you think,


I'm working with mcf5282, but also mcf52259