NetBSD Problem Report #53317

From www@NetBSD.org  Sat May 26 22:08:24 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 777277A103
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 26 May 2018 22:08:24 +0000 (UTC)
Message-Id: <20180526220823.8E32B7A218@mollari.NetBSD.org>
Date: Sat, 26 May 2018 22:08:23 +0000 (UTC)
From: uwe@NetBSD.org
Reply-To: uwe@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: awge(4) with static address doesn't work
X-Send-Pr-Version: www-1.0

>Number:         53317
>Category:       port-evbarm
>Synopsis:       awge(4) with static address doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 26 22:10:00 +0000 2018
>Last-Modified:  Sun Jun 17 18:00:01 +0000 2018
>Originator:     Valery Ushakov
>Release:        NetBSD 8.99.18
>Organization:
>Environment:
NetBSD xino 8.99.18 NetBSD 8.99.18 (SUNXI.uwe) #2: Sat May 26 00:30:55 MSK 2018  uwe@sampo:/home/uwe/work/netbsd/cvs/src/sys/arch/evbarm/compile/SUNXI.uwe evbarm

>Description:
A20-OLinuXino-MICRO running current.

If I configure the system to use dhcpcd everything is fine.

If I configure static address, then interface doesn't send/receive
packets UNTIL the first time you call ifconfig awge0.  At that point
DAD happens and the interface comes to life.

If you try to send some packets while the interface is in this state,
e.g. ping -n some ip, the machine locks up after about a dozen of
pings.

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: port-evbarm-maintainer@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: port-evbarm/53317: awge(4) with static address doesn't work
Date: Sun, 27 May 2018 11:11:28 +0200

 I assume you do not netboot the kernel?

 Martin

From: Aymeric Vincent <aymericvincent@free.fr>
To: uwe@NetBSD.org
Cc: port-evbarm-maintainer@netbsd.org, gnats-admin@netbsd.org, gnats-bugs@NetBSD.org
Subject: Re: port-evbarm/53317: awge(4) with static address doesn't work
Date: Sun, 27 May 2018 11:30:21 +0200

 Hi,

 > If I configure static address, then interface doesn't send/receive
 > packets UNTIL the first time you call ifconfig awge0.  At that point
 > DAD happens and the interface comes to life.

 I remember needing the following patch to make the awge of the DE0
 nanosoc work. Would it help in your situation?

 diff --git a/sys/dev/ic/dwc_gmac.c b/sys/dev/ic/dwc_gmac.c
 index ce5635db0d3f..aed5844e2f21 100644
 --- a/sys/dev/ic/dwc_gmac.c
 +++ b/sys/dev/ic/dwc_gmac.c
 @@ -999,6 +999,9 @@ dwc_gmac_queue(struct dwc_gmac_softc *sc, struct mbuf *m0)
  	sc->sc_txq.t_desc[first].ddesc_status =
  	    htole32(DDESC_STATUS_OWNEDBYDEV);

 +	bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize,
 +	    BUS_DMASYNC_PREWRITE);
 +
  	return 0;
  }


 Regards,
  Aymeric

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-evbarm/53317: awge(4) with static address doesn't work
Date: Sun, 27 May 2018 12:52:27 +0300

 On Sun, May 27, 2018 at 09:15:00 +0000, Martin Husemann wrote:

 > I assume you do not netboot the kernel?

 Yes, I boot from SD card.

 -uwe

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: Aymeric Vincent <aymericvincent@free.fr>
Subject: Re: port-evbarm/53317: awge(4) with static address doesn't work
Date: Sun, 27 May 2018 14:36:48 +0300

 On Sun, May 27, 2018 at 09:30:02 +0000, Aymeric Vincent wrote:

 >  > If I configure static address, then interface doesn't send/receive
 >  > packets UNTIL the first time you call ifconfig awge0.  At that point
 >  > DAD happens and the interface comes to life.
 >  
 >  I remember needing the following patch to make the awge of the DE0
 >  nanosoc work. Would it help in your situation?
 >  
 >  diff --git a/sys/dev/ic/dwc_gmac.c b/sys/dev/ic/dwc_gmac.c
 >  index ce5635db0d3f..aed5844e2f21 100644
 >  --- a/sys/dev/ic/dwc_gmac.c
 >  +++ b/sys/dev/ic/dwc_gmac.c
 >  @@ -999,6 +999,9 @@ dwc_gmac_queue(struct dwc_gmac_softc *sc, struct mbuf *m0)
 >   	sc->sc_txq.t_desc[first].ddesc_status =
 >   	    htole32(DDESC_STATUS_OWNEDBYDEV);
 >   
 >  +	bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize,
 >  +	    BUS_DMASYNC_PREWRITE);
 >  +
 >   	return 0;
 >   }

 Thanks for the tip, but I don't think so.  Tried it anyway and it in
 fact didn't.

 What happens here I think is that there's a complex interplay between
 generic interface code and the driver code and what happens when -
 start, activate, and whatever else - it's been a while since I looked.
 E.g. our ne(4) driver seems to be now more or less unusable because of
 that.

 My guest would be that most arm gizmos are used in a DHCP environment
 so with the way driver is written the right things happen when you
 bring it up with dhcp.  But when you configure the address statically
 some of those driver methods are not called and some initialization
 doesn't happen.  Calling ifconfig probably just prods that lazy init
 and makes the driver operational.

 -uwe

Responsible-Changed-From-To: port-evbarm-maintainer->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sun, 27 May 2018 11:44:35 +0000
Responsible-Changed-Why:
Take


From: Aymeric Vincent <aymericvincent@free.fr>
To: Valery Ushakov <uwe@stderr.spb.ru>
Cc: gnats-bugs@NetBSD.org
Subject: Re: port-evbarm/53317: awge(4) with static address doesn't work
Date: Sun, 27 May 2018 15:27:24 +0200

 Valery Ushakov <uwe@stderr.spb.ru> writes:

 > Thanks for the tip, but I don't think so.  Tried it anyway and it in
 > fact didn't.

 Hm, sorry. But I have another patch up my sleeve. :-)

 From the datasheet of the Cyclone V (which uses a more recent version of
 the controller), the main mac address is sampled by the ethernet chip
 when writing to the lower bits. I don't know if this applies also to
 "older" revisions of the chip.

 I understand it's not the way you're pursuing the analysis of the
 problem, but FWIW, I use awge on the Cyclone V with a static IP address.

 diff --git a/sys/dev/ic/dwc_gmac.c b/sys/dev/ic/dwc_gmac.c
 index ce5635db0d3f..29de471d6a45 100644
 --- a/sys/dev/ic/dwc_gmac.c
 +++ b/sys/dev/ic/dwc_gmac.c
 @@ -323,8 +323,9 @@ dwc_gmac_write_hwaddr(struct dwc_gmac_softc *sc,
  	lo = enaddr[0] | (enaddr[1] << 8) | (enaddr[2] << 16)
  	    | (enaddr[3] << 24);
  	hi = enaddr[4] | (enaddr[5] << 8);
 -	bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_MAC_ADDR0LO, lo);
  	bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_MAC_ADDR0HI, hi);
 +	delay(1);
 +	bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_MAC_ADDR0LO, lo);
  }

  static int


 Regards,
  Aymeric

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: Aymeric Vincent <aymericvincent@free.fr>
Subject: Re: port-evbarm/53317: awge(4) with static address doesn't work
Date: Sun, 27 May 2018 18:16:50 +0300

 On Sun, May 27, 2018 at 13:30:01 +0000, Aymeric Vincent wrote:

 >  Valery Ushakov <uwe@stderr.spb.ru> writes:
 >  
 >  > Thanks for the tip, but I don't think so.  Tried it anyway and it in
 >  > fact didn't.
 >  
 >  Hm, sorry. But I have another patch up my sleeve. :-)

 Alas, that doesn't help either.  Thanks.

 -uwe

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-evbarm/53317: awge(4) with static address doesn't work
Date: Sun, 17 Jun 2018 19:54:28 +0200

 I can't reproduce this on cubietruck when booting -current from mmc.

 Just doing

 	focnfig awge0 inet $IP up

 is enough to get network working in my setup.

 I have no good idea where to start looking or getting more debug info,
 assuming this still happens for you in -current (Jared fixed some media
 change things recentish).

 Martin

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-evbarm/53317: awge(4) with static address doesn't work
Date: Sun, 17 Jun 2018 19:56:26 +0200

 On Sun, Jun 17, 2018 at 05:55:00PM +0000, Martin Husemann wrote:
 >  Just doing
 >  
 >  	focnfig awge0 inet $IP up

 "ifconfig" of course.

 Martin

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.