From nobody Fri Sep 09 15:32:14 2022 X-Original-To: dev-commits-src-main@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 4MPKjp49gkz4bfKf; Fri, 9 Sep 2022 15:32:14 +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 4MPKjp3VPtz3sC4; Fri, 9 Sep 2022 15:32:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662737534; 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=3DMbxghuxk/FFfSGvPyGQnfbaDrCkVF1NZG4wbGRank=; b=P/Xk5mc4l7QtHo4HZ0jk1yuSSr/HkdAvyG6BmGX2skUhsDMxf9wwxnqMtTD5OxKXBMDicg 529uxwvhIpcAcixw9ezYQ2155DvPoBh5N+PHHdp4j1qU7q4qJz7URyTymSERXdu8q4Kz94 fqpK/vufkNGVJ6r9YZ6xV+ZGnUz9NKmUp03zVxJM7FD9CS8RLHk684gp4zwn5yFTh20/+F t9JmLZ2ttIrIQejhv4M5DmpLZqWam/WogRgx8i6CQvxdlYIDH3wbshqVM9clbXye3SmOjE MG6FZnKoOPEvk6udxjQiWc2/MTMeXEN0kXID322H+qJPAXU2DdsXd62EDAEkiw== 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 4MPKjp2Yj5z1Ffk; Fri, 9 Sep 2022 15:32:14 +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 289FWErc019403; Fri, 9 Sep 2022 15:32:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 289FWEjY019402; Fri, 9 Sep 2022 15:32:14 GMT (envelope-from git) Date: Fri, 9 Sep 2022 15:32:14 GMT Message-Id: <202209091532.289FWEjY019402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 6501fcdc0a97 - main - if_dwc: fix reinitialization with changed MAC List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 6501fcdc0a97faa3c59f6ece314bf7754303db6f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662737534; 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=3DMbxghuxk/FFfSGvPyGQnfbaDrCkVF1NZG4wbGRank=; b=p1sCjnFZKhI2PLY5m7dAINOF2S0XjdEi5k22UpaOlMKZdHyA2c8yZwXgNU+Ow2v0Pb4Q23 rc5GgJ1omm/xG0l3mu3OxQFNas+YkEwM/5YehVMiwlyM9Lm4UsL9OXZjaLlUbBriKulysy j8BkvlzwLiu4pAKCTGpPY0XrVTQZA+q+mbpTTRxNccVhQ/fA5sq1RTm+hKf3HcNFzY55Bc hhveboyTVKC+Gcc11zef6rGyEPCNAQOZNVbzIXPaDaiBOnlq5rYZDvunEeHp1k3K8uMjSF 1vRe2Gfa+uF8w6Xra8LLvE57WvA3vdIRhQmzqnkjEtosmJCp00ybkt/dh/MdaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662737534; a=rsa-sha256; cv=none; b=Y6nfOAx4vdpn8xOfq5fLI/BlpStpp0/HQ30TbCTCFgSbH/MlhrjqGhN1u+pSJCkwtwmZ5b jnoy3ewnFHepptj5ejvn5y8zGdasWW8SjT/zEBRSH8xRv9kJV7c4wJUYyzEb8mgSY+L5z3 6EsnB2WhCTeIVxBV5y32FKrH4oFYelVUD6SR8au+7bHd/5qy7Vm2kwldE/iR2zmM1BI7WL zBQFB4ZM1U1Tb7Z+wk7IeiKHQg8KikPKnZXlqhoMFSoJMcb8aIbFJLpZXdqipXOMQ5DXjQ AlZW6YQkIR2DxBSX/Dsuk8rjGOOMK6WToLBv58RG2j46fZOChE8aN06G9wKNKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6501fcdc0a97faa3c59f6ece314bf7754303db6f commit 6501fcdc0a97faa3c59f6ece314bf7754303db6f Author: Jiahao LI AuthorDate: 2022-09-08 15:50:37 +0000 Commit: Mitchell Horne CommitDate: 2022-09-09 15:31:26 +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 --- 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 5ec115f7081b..5fc735fdd5f1 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); }