From owner-p4-projects@FreeBSD.ORG Fri Aug 4 23:22:57 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A840A16A4E6; Fri, 4 Aug 2006 23:22:57 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8513A16A4E2 for ; Fri, 4 Aug 2006 23:22:57 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B32843D45 for ; Fri, 4 Aug 2006 23:22:57 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k74NMv1p069139 for ; Fri, 4 Aug 2006 23:22:57 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k74NMvbV069136 for perforce@freebsd.org; Fri, 4 Aug 2006 23:22:57 GMT (envelope-from imp@freebsd.org) Date: Fri, 4 Aug 2006 23:22:57 GMT Message-Id: <200608042322.k74NMvbV069136@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 103212 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2006 23:22:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=103212 Change 103212 by imp@imp_lighthouse on 2006/08/04 23:22:07 Avoid spurious NAK when we cross a second boundary at the cost of a slightly longer timeout sometimes. Before we'd always send a NAK when we crossed a second boundary, even if we'd just received data. Now we reset the timeout when we get a TFTP packet for us. Not 100% sure this is right, but (a) my gut tells me it is and (b) a quick survey of many reboots suggests this is a lot more reliable. Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#21 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#21 (text+ko) ==== @@ -612,7 +612,7 @@ dlAddress = (char*)address; lastSize = 0; timeout = 10; - thisSeconds = GetSeconds(); + thisSeconds = GetSeconds() + 1; serverPort = SWAP16(69); ++localPort; ackBlock = -1; @@ -622,9 +622,10 @@ if (ackBlock == -2) break; timeout = 10; - } else if (thisSeconds != GetSeconds()) { + thisSeconds = GetSeconds() + 1; + } else if (GetSeconds() > thisSeconds) { --timeout; - thisSeconds = GetSeconds(); + thisSeconds = GetSeconds() + 1; if (!serverMACSet) GetServerAddress(); else if (ackBlock == -1) @@ -633,7 +634,7 @@ // Be sure to send a NAK, which is done by // ACKing the last block we got. TFTP_ACK_Data(0, ackBlock, 512); - printf("\nNAK\r\n"); + printf("\nNAK %u\r\n", ackBlock); } } }