You are correct. I have enough heap around 8MB so I allow each pbuf for each
frame of 1520 bytes, and
I assumed all the pbufs would come for transmission are at ratio 1 frame : 1
pbuf. So the driver I wrote
did'nt bother checking if tot_len equals to len or if pbuf->next equal to NULL.
So I guess I sent the header without
sending the data. I ll look how I can write a workaround on this tomorrow since
my compiler license is offline at the moment.
Thanks a lot Simon.
> Subject: RE: [lwip-users] udp checksum error> Date: Thu, 17 Jan 2008 13:25:22
> +0100> From: [EMAIL PROTECTED]> To: [email protected]> > > Oh, I assumed
> that the way TCP and UDP handles pbufs are the same. And> since DHCP works
> fine and it didnt > > work with the socket API, your explanation fits in just
> nicely. But> where is this copying supposed to be done ?> > Is it supposed to
> be done in the socket layer, or netconn API layer?> Thanks in advance
> again...> > TCP sockets copy the data to be sent into an internal buffer as
> the data> might have to be sent again (retransmission). Since there is
> already a> pbuf allocated for this, it is just allocated slightly bigger and
> the> headers are included -> you get one continuous buffer for one packet.> >
> UDP sockets don't copy the data: it doesn't have to be kept for>
> retransmission so it is faster to send them without copying. However,> since
> (for socket API) there is no space for the headers in the buffer> pointer you
> give to udp_sendto, a buffer for the headers has to be> allocated in addition
> to this. These two buffers then form a linked list> of pbufs.> > In your
> netif->linkoutput() function, UDP socket pbufs have a next> pointer != NULL:>
> > p->payload will point to the protocol headers> p->next->payload will point
> to the actual data> > -> p->tot_len will be != p->len for such linked lists
> while for TCP> pbufs, p->len will be == p->tot_len.> > Have a look at the
> explanation in pbuf.c: you have to copy all data> until you have copying as
> many bytes as the first p->tot_len says it has> (in other words, the last
> pbuf has p->len == p->tot_len).> > I assume you always copy the first pbuf in
> such a linked list only, but> tell the driver you have copied p->tot_len
> bytes and the driver fills in> the missing bytes with 0x00?> > Simon> > >
> _______________________________________________> lwip-users mailing list>
> [email protected]> http://lists.nongnu.org/mailman/listinfo/lwip-users
_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star
power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users