From nobody Fri Sep 16 17:40:45 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 4MThDs42rKz4cfyk; Fri, 16 Sep 2022 17:40:45 +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 4MThDs3PF2z3y9c; Fri, 16 Sep 2022 17:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663350045; 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=w6mJ1tdO6NJD2RkbXVEyG/Q1L1Zye4A+810dVJephvM=; b=dNipqHt1wzMiMu2b4HQxowrdfHSq21Hr9bN+E41qAmG67TxVWqnIzbgL3Y/1p0qREbLim7 Zm307XQcWYsUqFCBDjP3NiFnVqTo6wqt1c4YwK/g02c1rXza7/JuezD3acXQIg9ycSQav/ BGcokypnuPYx9jkRmfNSggfq85bdAaJvLo5PTolty8Qbizu8HmWmMR4KryJbwokYgj+gre w7/6I+rnyHv/HO3b3A0/yrp01Q4WnxS+YBcBtud4f0GMeOBZADEHgfBWnxfRpYqRbb/dcc Z+D5zojcxgzqdNBPL1xPD76fe77Y6xRUr3nidK49n9xTRq3QGIO2OtiOZ1ju+w== 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 4MThDs2CMBzRG9; Fri, 16 Sep 2022 17:40:45 +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 28GHej02022099; Fri, 16 Sep 2022 17:40:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28GHejjj022098; Fri, 16 Sep 2022 17:40:45 GMT (envelope-from git) Date: Fri, 16 Sep 2022 17:40:45 GMT Message-Id: <202209161740.28GHejjj022098@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: 9465af5ee2de - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 9465af5ee2de0374b143802ea32823c45f3d73be Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663350045; 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=w6mJ1tdO6NJD2RkbXVEyG/Q1L1Zye4A+810dVJephvM=; b=snmWu+fFbC++ttPJY5TsSJsFz7y9sDrlyPX+Z5x8t/mNpSUYM5xda6ayLL9FOq7GPhNa1N cG9gs1J9UYqwa1P+N6fP7euEmYvY59+FW2w5KU9vw00nRUyqjWwvS8uLVg+M6Pu83o0p4O d4HNHYQUMgy1VQH+FCbQ1IuuZTLXwkHOeFvlvVycurz23nW+ivrSCk6yEsdxSp0JLccCL8 PbpxkXSE+C80ss/GI8FEl4rw3XMp14lhs5+uV3Qa5r10RUji5+b2f6g54HACGmlsoE2jed 1J7wVpGf39eIxYzWZpt+dnF9XR9e1N7APIg3RF9OV5B9TuxUFcPES3VOxyYa2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663350045; a=rsa-sha256; cv=none; b=GnDgOaCNekw/0CPcBHp2TWdSiM+GhA45FZn+4rTyTEtk60+KUtpDcvtBguBG2yy+fkqddU RCgccseT5eslnzwNlS+DZUZ/isLTDWohfc6M/RjTUi3+O0tjA1VPUWmsDDT7osRp5g+AIs LhhTruRtVyDSaS/rZ0s8kvRGGtahVqzAeBgFT+eLexZgFdGw7hoE/dqVvI/GT7pkUXJD+8 WlMGT3T0EgEHCAMt2lJ8HdLacV0Tb08xjXmYBEkGlCS7gTAh+kDQO0PqedSWxfCt1agvyt zdbYQ4RpENG6kC410hJSfz6geTIAzoiviDkVhM7L05iWwFwT2eOJy3bjM8yGgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=9465af5ee2de0374b143802ea32823c45f3d73be commit 9465af5ee2de0374b143802ea32823c45f3d73be Author: Jiahao LI AuthorDate: 2022-09-08 15:50:37 +0000 Commit: Mitchell Horne CommitDate: 2022-09-16 17:34:48 +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 761f4a33ab43..8865c79ccc0c 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -1166,6 +1166,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); @@ -1174,11 +1180,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); }