From nobody Mon Jul 04 16:40:02 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 403C21894010; Mon, 4 Jul 2022 16:40:03 +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 4LcBNz0Rf6z4SG7; Mon, 4 Jul 2022 16:40:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656952803; 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=CZ8FX5JrLkZcnsX9khB3wyFzshSH/aJa90XzvylNKxg=; b=KDtqg2lV/wCWbySdFf5eH1yYHda7/fWsL1Y4aPFX0l6Y46JIXoHkAjafbckGsBuQzUN8zL 7SM+CND7bYFWpAzHIdZF229hAtFCkn+tmSAVVDHpaR2adRBvlcR/DTMsSRrHc52MZPjQnU fA6Uzsanf01Cf0AdKPwK+CbwtzRte2Cw1kGWqf86drucWEnptfyuag8ixjFznvaFIBXdwx KR0bRAT09ihawhn238+LeEe5KzM0kfMaWVao8OcO2P8m1MoEZLKE7yTRqjscMeiPeNa4rk N/LIHbH0lKZ0Nvn2yQ4iN3SzzLNLUTgJljDwfJY8oK4ecx0QfvDsCYBW3ajHcw== 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 C025314BAE; Mon, 4 Jul 2022 16:40:02 +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 264Ge2VX042876; Mon, 4 Jul 2022 16:40:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 264Ge2fb042873; Mon, 4 Jul 2022 16:40:02 GMT (envelope-from git) Date: Mon, 4 Jul 2022 16:40:02 GMT Message-Id: <202207041640.264Ge2fb042873@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: 164bdd8f9a49 - stable/13 - if_dwc: enable RX checksum offload feature 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: 164bdd8f9a49762742f9d2a466d427dd9c95a674 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656952803; 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=CZ8FX5JrLkZcnsX9khB3wyFzshSH/aJa90XzvylNKxg=; b=iPonZRYFNj+Pcqg3E4pzuoszYa+CdBSkbJZVVLrx0mKP0Yc3ZqDVgUoV97SGe16LNY5U7a wCeSWT3feSAr0aqg9jr70vkq+nAYrHTFDCBQJqhD3GIJkIJNFA6TEUNDqy4a1OBivl007K jU+uWvRTp1R3eHg6vxwRBrM/QJuCgIlr7v3TibxLOFwNAcSrPofFSQzVuO3myr9BI8mDTq R9qggZy1ITUp4ht1YrvgorLijXstbbfoD2E0R4uOuhLg0oAb8btNW28M7yv7sTzOZ45tLg OZG1F/RpIsfO2WaoAaU2ZT8UVGLE6i76OTIJrGTiVl+34G6tg0vTBosqDzJR5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656952803; a=rsa-sha256; cv=none; b=hKP5StGJes3BuRk/IPZrw2CZNSUxRA+WnwtS8FbiY6kS8IsCbBb2RujfE0HgcNCFG99qiS LMrYV2UhR98dE0VVnj+jURmDmeBqtUzszuBtAo3TrUhNAA1VT5xU3j15dn9MNbKbk4x/my P8x/vP4u0In2mOo/WF4g1xZq/NJbXpGRYHRmmOPMALbQKX3oJ5VrgxnueGh8o7Jod4H1ir +BAuDliU0coHQswoU+VddiBFVa+Owwes9fSDM7mmnSHZadXKMVLjFi2EAvnN2w+vSJtEqD f5c4GSwlLakYqEUxTOSc9zNSX35+1BzfQqfX/pMKXRMqsJIuGyYhJgUecPHd+w== 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=164bdd8f9a49762742f9d2a466d427dd9c95a674 commit 164bdd8f9a49762742f9d2a466d427dd9c95a674 Author: Jiahao Li AuthorDate: 2022-06-21 13:23:43 +0000 Commit: Mitchell Horne CommitDate: 2022-07-04 16:34:56 +0000 if_dwc: enable RX checksum offload feature We claim support in ifcaps, but don't actually enable it. PR: 263886 Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35498 (cherry picked from commit 35c9edab4169f99de7e8fcada6d9b499c8405f87) --- sys/dev/dwc/if_dwc.c | 21 +++++++++++++++++++++ sys/dev/dwc/if_dwc.h | 1 + 2 files changed, 22 insertions(+) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 841026100eaf..44b9b0b3179c 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -518,6 +518,20 @@ dwc_enable_mac(struct dwc_softc *sc, bool enable) WRITE4(sc, MAC_CONFIGURATION, reg); } +static void +dwc_enable_csum_offload(struct dwc_softc *sc) +{ + uint32_t reg; + + DWC_ASSERT_LOCKED(sc); + reg = READ4(sc, MAC_CONFIGURATION); + if ((if_getcapenable(sc->ifp) & IFCAP_RXCSUM) != 0) + reg |= CONF_IPC; + else + reg &= ~CONF_IPC; + WRITE4(sc, MAC_CONFIGURATION, reg); +} + static void dwc_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr) { @@ -1121,6 +1135,7 @@ dwc_init_locked(struct dwc_softc *sc) dwc_setup_rxfilter(sc); dwc_setup_core(sc); dwc_enable_mac(sc, true); + dwc_enable_csum_offload(sc); dwc_init_dma(sc); if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); @@ -1219,6 +1234,12 @@ dwc_ioctl(if_t ifp, u_long cmd, caddr_t data) if_sethwassistbits(ifp, CSUM_IP | CSUM_UDP | CSUM_TCP, 0); else if_sethwassistbits(ifp, 0, CSUM_IP | CSUM_UDP | CSUM_TCP); + + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { + DWC_LOCK(sc); + dwc_enable_csum_offload(sc); + DWC_UNLOCK(sc); + } break; default: diff --git a/sys/dev/dwc/if_dwc.h b/sys/dev/dwc/if_dwc.h index d8c10258388a..09455f61cea9 100644 --- a/sys/dev/dwc/if_dwc.h +++ b/sys/dev/dwc/if_dwc.h @@ -48,6 +48,7 @@ #define CONF_PS (1 << 15) /* GMII/MII */ #define CONF_FES (1 << 14) /* MII speed select */ #define CONF_DM (1 << 11) /* Full Duplex Enable */ +#define CONF_IPC (1 << 10) /* IPC checksum offload */ #define CONF_ACS (1 << 7) #define CONF_TE (1 << 3) #define CONF_RE (1 << 2)