From nobody Fri Sep 16 17:43:06 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MThHb1BWGz4cg2w; Fri, 16 Sep 2022 17:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MThHb0ZYnz417w; Fri, 16 Sep 2022 17:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663350187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=akrKKtZyNktnMsadRgpmpeqxjlTEa3y10cZk4iv71pc=; b=JwCOuirWU8xMYof8gVYvVDfm0JLszNhLHV+kHPlszsl+1D3oSTDwZL8ND8gcs2+y00zKgi 9qghXRgnWPrQJRnV2A/SIaAauhvbQDXfzxaW7Z2BWVwzbnz+cqat6D3FH/j7fpnRJ5B2x/ b0P3uknAQO1lGCtXjzRakNjXEmzKTos331A2iPu6xemEzgtwmosZ25jqrOTO48NTTBUXbB YnFC9eG5n4w2/0h4pp4rQgCLYJQNeHX2EAUtZD36pQbKQiA/kFp7xRvUM67ToK3hzZEUJO 7KLhAi4m+zE7AU7ECU+fgBcD3tYRQJ3h1a4GnYcYbYcC3gwoyIDjuOgLUE5JsQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MThHZ6m0vzRDf; Fri, 16 Sep 2022 17:43:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28GHh62h024512; Fri, 16 Sep 2022 17:43:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28GHh6RI024511; Fri, 16 Sep 2022 17:43:06 GMT (envelope-from git) Date: Fri, 16 Sep 2022 17:43:06 GMT Message-Id: <202209161743.28GHh6RI024511@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: c1cec62c0db0 - stable/12 - if_dwc: fix reinitialization with changed MAC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c1cec62c0db0cb15d2d09aa5dfc5bd3727bbf3f6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663350187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=akrKKtZyNktnMsadRgpmpeqxjlTEa3y10cZk4iv71pc=; b=IGDVVFukohwVcy7WVPB6dMN3UDPQq2LOo6BTwdyVbqlf4NXr8FgzZRqHXJ0rqfNvYwyeIQ TI/1lOBFIsqLzfirXkJFBJFSH3mlBWNJX8uxvnGYKsv2d5QDh0Q/Ac22lOhMwtg48JjFVp V3pymmgoVBjTbTn7J9Aia9r0w3GxE34noNZYwGzUHa2vtOyu4Q6l+LLkrpcnlma1+fDmh7 c0eaAGbB/4z7ruv32A9Y86Vz7ec2BXnZfSM2tzXzD9FcYgirfYzMZVlP3OBniE78DmUEzt bRLNlN4YJh33Ay7XeWl7ZodLJLYen1Dt967TRS74J29EAtoodwK5uEzxZB9NqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663350187; a=rsa-sha256; cv=none; b=kCNjgFrcXmw4Q+B0sHSw1PQgyVcvVrere0cB340sSGF++g2ImqS2jl/SkqOpnoQZwzncxQ Kwi47U2i1msZ5GUvw5g+dHQZgt+mwwyTrnvJSBRd9xKlpeBhrh/LAgj7lyLG03x6jYa7qX OAyWFQjhT2uyy/Knh+l+fJK00gA01hror6v4klkvXQPJ5R2rvYKj+NhGd6r1kDTA/+5h+z WgSmOSQ2C3VHYUAtgjk0SDmFUvmV9LnWDsb7EpGmtt6gLK7on2IQWJblEU5jsAXZQtf+Mx 5xZu7hcuqWU98pF2p9vUFDsOAHH2H+QOf16XD9CIBb+bwmOKUexKdLA4jo4Hxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c1cec62c0db0cb15d2d09aa5dfc5bd3727bbf3f6 commit c1cec62c0db0cb15d2d09aa5dfc5bd3727bbf3f6 Author: Jiahao LI AuthorDate: 2022-09-08 15:50:37 +0000 Commit: Mitchell Horne CommitDate: 2022-09-16 17:41:54 +0000 if_dwc: fix reinitialization with changed MAC It was observed that on RockPro64 hardware, the dwc interface is unable to receive packets after being assigned a new MAC address. The fix is simply to call mii_mediachg() before touching any device registers in dwc_init_locked(). This is consistent with what the OpenBSD driver does. PR: 263820 MFC after: 1 week (cherry picked from commit 6501fcdc0a97faa3c59f6ece314bf7754303db6f) --- sys/dev/dwc/if_dwc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 06eb6bb47649..6d280bd3b86c 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -1026,6 +1026,12 @@ dwc_init_locked(struct dwc_softc *sc) if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) return; + /* + * Call mii_mediachg() which will call back into dwc_miibus_statchg() + * to set up the remaining config registers based on current media. + */ + mii_mediachg(sc->mii_softc); + dwc_setup_rxfilter(sc); dwc_setup_core(sc); dwc_enable_mac(sc, true); @@ -1033,11 +1039,6 @@ dwc_init_locked(struct dwc_softc *sc) if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); - /* - * Call mii_mediachg() which will call back into dwc_miibus_statchg() - * to set up the remaining config registers based on current media. - */ - mii_mediachg(sc->mii_softc); callout_reset(&sc->dwc_callout, hz, dwc_tick, sc); }