lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] pbuf len field equal zero


From: EVS Hardware Dpt
Subject: [lwip-users] pbuf len field equal zero
Date: Mon, 12 Dec 2005 18:02:27 +0100

Hello,

I have a problem in my lwip implementation (MPC8347 from freescale).

In my low level output, I receive a pbuf struct. As far as I understand, this pbuf is an ethernet frame. So I only need to send this frame to my interface. The problem is that sometimes in the middle of a pbuf chain, I have a pbuf wich len field is 0. I'm not sure what to do with it.

First I've tried to simply ignore the fact that it's length was 0. As my Ethernet controller is Buffer Descriptor based, I can map each pbuf of the chain to a Buffer Descriptor and simply set a last flag in my Buffer Descriptors as soon as it's the last pbuf in the chain. I simply have a Buffer Descriptor that has a length of zero. The problem is that my interface doesn't like that and it generates FIFO underrun.

My second though was to simply skip it, but then I'm not sure it's a good solution.

My question is : why do I have some pbuf with len field being 0 ? Is it normal, what should I do with them ?
 
Here the code for my second try. Note that if we skip the first test in the loop, then sometimes we program a DMA transfer with data length being 0 wih in turn lead to a Fifo underrun condition.

len = p->tot_len;
q = p;
while(q)
   {
      if(q->len == 0)
      {
         q = q->next;
         continue;
      }

  
      p8347If->NbFreeTxDesc --;
      p8347If->pArrTxBuf[eof] = q;
      p8347If->BDRing.TxBD[eof].DataPointer = q->payload;
      p8347If->BDRing.TxBD[eof].DataLength  = q->len;
     
      len -= q->len;
     
      if(len == 0)
      {
         break;
      }
     
      q = q->next;
      INC_TX_POINTER(eof);
   };

Thanks in advance for your ideas.

Frederic.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]