From nobody Thu Jun 23 18:16:01 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 CCD238765B6; Thu, 23 Jun 2022 18:16:01 +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 4LTT2n3PNMz3P2n; Thu, 23 Jun 2022 18:16:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656008161; 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=tjB8Qq4ASqEv/sPF+hoIhd2cByUxIvfEZWfsc5bYpp0=; b=eITMYAykfjX5R66tg9Qol8IKNZ8ZmK+NDIm3IqRm0jsXvkmjE8aAZPdT7sfeyEGEzSL3/u sbYvgTK4qF/lDgwrG/W8AlKLANeQGDpvMjjCNrbFEF1ZU41Walb+r58ZnRc6VDUCE1hFpp /e96HqcUJnu2sjBbEpEUZPdxbRZ+my6G2tcT/BoCyP/5WFF8672P4/PCQwpgkxKrl3NVgI mH+hIULNU1eWPwhOyuO12GeG4HP8Riw+R1upHpHGOhpAGybrbKds7GaVWzRzZEKGp+ks/O iut+WKzTU6swFXVWw734RUTUH+B5ZjdIN2zRRvCW24KWFHcnWa+tNq6lSUJ5DQ== 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 2D79520276; Thu, 23 Jun 2022 18:16:01 +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 25NIG1Wp014776; Thu, 23 Jun 2022 18:16:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25NIG19f014775; Thu, 23 Jun 2022 18:16:01 GMT (envelope-from git) Date: Thu, 23 Jun 2022 18:16:01 GMT Message-Id: <202206231816.25NIG19f014775@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: 35c9edab4169 - main - if_dwc: enable RX checksum offload feature 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: 35c9edab4169f99de7e8fcada6d9b499c8405f87 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656008161; 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=tjB8Qq4ASqEv/sPF+hoIhd2cByUxIvfEZWfsc5bYpp0=; b=pNkqkQCaQiN1/Ln99vK2O4yanyEhvKNQT4Wc683T4BYaRXhAnN0dgRySTMQcE75sOGZPNJ 5zlPxw7wkwRKbaEF9I4Z4mM5DA2nmxnKR3y7PLZyQ0Ap8+VqbGBI3L2HOHOB/ziIPbYOeY yJV3rsEOzZ2E98YVyNYiZkbq+hy7QvNjaH4H7WpdvGyBritEcRPDr0dIzSMek6KbRMEOfU mCggw1vvkFgd/luQCfOEtREHcPgIke0MW1iJ3dvXxL73uVQ7s5lB071xk7tE5MLXOgcD27 r+nJkYJKwb875NxRrVLTornrFJhWN/mzWVYZch3Bo7t/GQCflv6FBzYTGTclxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656008161; a=rsa-sha256; cv=none; b=h76GmuaU+QYcIHWUCvmkWVt+70KYrHHYq2UprUIaoySCNxga/tLExQxR8FSVNKWzz1bf55 oiXABiXb1I5XVbPWezbDdQ8zCQ9HAkW49cj+xBGnTvn8dnpb5yk+7sBYL6takIn3WxTuV9 9xKYPnrn9xeSIACbCCAxIMYQ1YlasdBsfW8tB7e/jLi7yMWUEfLrmNV0vkI5/OM2nT9TSC fD18jY4ZG0ID/v476SRHqUOit4iUE5EKyPE6iacBKS7ot2scSWikOccR22vcNMDJ+RP2ms M1B7cezSVYabGuLvSs+iSKkQ6KiTh0gDnzVLSiTCdFSgQDSVkA2MyVX7AyP5CQ== 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=35c9edab4169f99de7e8fcada6d9b499c8405f87 commit 35c9edab4169f99de7e8fcada6d9b499c8405f87 Author: Jiahao Li AuthorDate: 2022-06-21 13:23:43 +0000 Commit: Mitchell Horne CommitDate: 2022-06-23 18:15:10 +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 --- 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 531a83d1a41b..1685866ad9ad 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) { @@ -1163,6 +1177,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); @@ -1261,6 +1276,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)