This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pbuf_alloc in the eth_drc.c returns Zero


Hi Guys

I am using the Lwip Stack with ecos and get following problem when i make a
Broadcast storm on my device.

In the eth_drv.c the eth_drv_recv() function it is not possible to allocate
any pbuf anymore and my ethernet device does not react anymore.

I see that i get receive interrupts but can't process it because the
ownership bits of my buffer queue pointer addresses are not getting reseted
which would be done in the (sc->funs->recv) (sc, sg_list, sg_len); recv()
function of my driver. But due to the failed pbuf_alloc my drivers recv()
function is not called anymore the function returns with nothing.

static void
eth_drv_recv(struct eth_drv_sc *sc, int total_len)
{
  struct eth_drv_sg sg_list[MAX_ETH_DRV_SG];
  struct netif *netif = &sc->sc_arpcom.ac_if;

  struct pbuf *p, *q;

  int sg_len = 0;
  CYGARC_HAL_SAVE_GP();

  if ((total_len > MAX_ETH_MSG) || (total_len < 0)) {
    total_len = MAX_ETH_MSG;
  }

  p = pbuf_alloc(PBUF_RAW, total_len, PBUF_POOL);

  if (p == NULL) {
    LWIP_DEBUGF(0, ("ecosif_input: low_level_input returned NULL\n"));
    return;
  }

  for (q = p; q != NULL; q = q->next) {
    sg_list[sg_len].buf = (CYG_ADDRESS) q->payload;
    sg_list[sg_len++].len = q->len;
  }
  (sc->funs->recv) (sc, sg_list, sg_len);
  ecosif_input(netif, p);
  CYGARC_HAL_RESTORE_GP();
}

How can i handle this problem? I did not found any solution here in the
older topics, where this problem was also mentioned. I can't raise the pbuf
number or size because i don't have enough memory on my device for it. Is
there any way to say to the stack that it should reset the buffers or
something like this?
I have activated the SYS_ARCH_PROTECT defines in the lwip stack for critical
parts so it is thread save.

Regards Fred



--
View this message in context: http://sourceware-org.1504.n7.nabble.com/pbuf-alloc-in-the-eth-drc-c-returns-Zero-tp227390.html
Sent from the Sourceware - ecos-discuss mailing list archive at Nabble.com.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]