From owner-freebsd-ppc@FreeBSD.ORG Wed Jun 17 16:45:02 2009 Return-Path: Delivered-To: ppc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CC87106564A for ; Wed, 17 Jun 2009 16:45:02 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id 0BDB08FC14 for ; Wed, 17 Jun 2009 16:45:01 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from [10.0.0.34] (cardhu.semihalf.com [213.17.239.108]) by smtp.semihalf.com (Postfix) with ESMTPSA id 4D3F1C3A96; Wed, 17 Jun 2009 18:26:24 +0200 (CEST) Message-Id: <3B1C809E-B2FA-40D7-8202-22CDD389D9BA@semihalf.com> From: Rafal Jaworowski To: Marcel Moolenaar In-Reply-To: <0B237AD8-FC97-4264-9A39-E4C266633E7F@mac.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Wed, 17 Jun 2009 18:28:02 +0200 References: <0B237AD8-FC97-4264-9A39-E4C266633E7F@mac.com> X-Mailer: Apple Mail (2.935.3) Cc: ppc@FreeBSD.org Subject: Re: MPC8555CDS: U-Boot vs loader compatibility X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 16:45:02 -0000 On 2009-05-30, at 21:37, Marcel Moolenaar wrote: > On May 28, 2009, at 7:48 AM, Rafal Jaworowski wrote: > >> >> On 2009-05-26, at 21:15, Rafal Jaworowski wrote: >> >>> On 2009-05-26, at 18:50, Marcel Moolenaar wrote: >>> >>>> I think I recently updated the FreeBSD loader on my CDS >>>> that has U-Boot version 1.3.2-rc1 on it (yes, that sounds >>>> rather fuzzy :-) In any case, the latest PowerPC U-Boot >>>> loader is having a problem with netbooting. I see packets >>>> being transmitted (BOOTP), but none of the responses seem >>>> to arrive at the loader. Then the ARP resolution is >>>> attempted, which fails as well. >>> >>> I'll try the latest loader tomorrow and let you know how this work >>> here. >> >> I checked a freshly built loader from HEAD and it works fine with U- >> Boot 2008.10-rc2-00091-g2f4342b. > > Ok, the problem is this: when packets arrive on the interface that > are larger than the buffer being passed to U-Boot from the loader, > then the eth_receive returns -1 and leaves the packet saved. The > next call to eth_receive(0 will find that same packet and can fail > for the exact same reason. A typical scenario is the loader doing > ARP with a buffer of 66 bytes. The end result is that the ARP > will fail and the loader panics. > > This obviously depends on the amount and kind of traffic on the > LAN in question... > > The following U-Boot patch fixes the problem (against 1.3.4): > > diff -u u-boot-1.3.4-orig/net/eth.c u-boot-1.3.4-local/net/eth.c > --- u-boot-1.3.4-orig/net/eth.c 2008-08-12 07:08:38.000000000 -0700 > +++ u-boot-1.3.4-local/net/eth.c 2009-05-30 12:19:20.000000000 -0700 > @@ -526,10 +526,7 @@ > return -1; > } > > - if (length < eth_rcv_bufs[eth_rcv_current].length) > - return -1; > - > - length = eth_rcv_bufs[eth_rcv_current].length; > + length = min(length, eth_rcv_bufs[eth_rcv_current].length); > > for (i = 0; i < length; i++) > p[i] = eth_rcv_bufs[eth_rcv_current].data[i]; > > FYI, So this seems like a bug in generic networking U-Boot code. Are you willing to push this fix to the U-Boot main line? Rafal