From owner-freebsd-ppc@FreeBSD.ORG Sat May 30 19:38:12 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 85E111065673 for ; Sat, 30 May 2009 19:38:12 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout018.mac.com (asmtpout018.mac.com [17.148.16.93]) by mx1.freebsd.org (Postfix) with ESMTP id 707A58FC12 for ; Sat, 30 May 2009 19:38:12 +0000 (UTC) (envelope-from xcllnt@mac.com) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from seens-xp.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp018.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KKH00CNI2IRDY70@asmtp018.mac.com> for ppc@FreeBSD.org; Sat, 30 May 2009 12:37:42 -0700 (PDT) Message-id: <0B237AD8-FC97-4264-9A39-E4C266633E7F@mac.com> From: Marcel Moolenaar To: Rafal Jaworowski In-reply-to: Date: Sat, 30 May 2009 12:37:38 -0700 References: 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: Sat, 30 May 2009 19:38:12 -0000 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, -- Marcel Moolenaar xcllnt@mac.com