public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] pbuf_alloc in the eth_drc.c returns Zero
@ 2013-04-04 14:59 Fred
  2013-04-06  8:16 ` [ECOS] " Fred
  0 siblings, 1 reply; 2+ messages in thread
From: Fred @ 2013-04-04 14:59 UTC (permalink / raw)
  To: ecos-discuss

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ECOS] Re: pbuf_alloc in the eth_drc.c returns Zero
  2013-04-04 14:59 [ECOS] pbuf_alloc in the eth_drc.c returns Zero Fred
@ 2013-04-06  8:16 ` Fred
  0 siblings, 0 replies; 2+ messages in thread
From: Fred @ 2013-04-06  8:16 UTC (permalink / raw)
  To: ecos-discuss

So i have reached a bit better kind of behaviour.

Now everytime when i can't alloc pbufs anymore, this happends only on
broadcast storms, i call the function pbuf_init() again. 
Seems that then my device can alloc pbufs again but not in a perfect manner. 
This means i can ping the device but can't open a lot of tcp sockets like
before the storm. 

How can i clear the buffers/pbuf of the stack cleanly. I mean a broadcast
storm is a error state i want to clear all the packets that came through. So
something like the pbuf_init() should be done.

Did somebody have the same problem or knows what to do in this specific
problem?

Regards
Fred



--
View this message in context: http://sourceware-org.1504.n7.nabble.com/pbuf-alloc-in-the-eth-drc-c-returns-Zero-tp227390p227535.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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-06  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 14:59 [ECOS] pbuf_alloc in the eth_drc.c returns Zero Fred
2013-04-06  8:16 ` [ECOS] " Fred

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).