From nobody Sat Sep 09 14:06:02 2023 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 4RjZWt2jq5z4skLd; Sat, 9 Sep 2023 14:06:02 +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 4RjZWt2GQjz3LWS; Sat, 9 Sep 2023 14:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694268362; 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=gfkz2gCPpK2reuqYuEaex8BzYPDSX6Qacdkk+fSzSsg=; b=tD3g9yLnRWiX5dDYgjjRu/eMp9h9lCtZUqWn5e/cy6eXjv89z7myu5dfIXTg7rBioM5Kae K8MnEGZxjm/2LuQAHnqACNByWwy1nrFSVoSH7Ulkyz3YChDsoGsdX+YcuIYPbR4qUASLyg /czr8kZOXAhpdkI6M4O9fs9FTByl/dkvAKPxxAIX+4GwIqcPEj4gELpwOYVe8DqVZSfZko xNGeaQlCEGs9OcY2hd73MEC5q98v/xrAChZHlg6m3tpKdl/OIFhNlrTdRkI9cwa9+TK7oi /DsZyhhyXRNmRiTtV9yGxtaGNZLBoT+GcbyB+sdQ3XNt0YRT6pBoX1h96y1Beg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694268362; a=rsa-sha256; cv=none; b=F1+jvWdqRkzjN0qKXAAqx1p0ncANoFVJzXfPwr69FXVA1tg+vDd9qyJ/jJNyfmrV/wnGUi apG3s1iRZAN0F5NlzOmcnFdhoB5hDpqykX0BcdiTqQB04JlIJuNfwuhMbOV46QCCZKD0WJ 6WyBzHklEnp5315ljn38f5CH2y5Ouc+qOAQ16VdIvQvPnTzcWyWrYePA5oePOaMAZcZfeY 78MCcvtUZJlIEM9JFpfhLsbyHKW1AsPOkUOQA8b0Ui0rOmbEaOizgIq14n1th4Aq7J7VCT UdhLJ32WLmQLrzy+uo//ivDwdLupX3JnpoCkHJWzEwLH3GfNAa/ykKSsCEOIOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694268362; 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=gfkz2gCPpK2reuqYuEaex8BzYPDSX6Qacdkk+fSzSsg=; b=HWngJprdnb9Ytl6GNS9Ez5j1+IFaN8LlL1PS2L7//LD7c5u5d6jiuqjqdyfvTW5KenE1AM cgisaDdBHw/UcpEWxkmfmP82RrUZka7srbneDcaKwb2fmjaKgm04X762xcuaGJcBDgEwVi ieiSZkUzbqu6oME+PMFEAqDnJ5uzvQkPE1x4roYE6EttLLqI4RlBLUsswdskdGHekMqXi3 CRSGzfnQa+cbX1kIbXPw+r6FJRaH0+l7Em0NRaZi5MZxlQCDxk3WIlv135s8xbPWCOrkgS 1hheBPhvDY95ZcotRw/xrDNHeHFg8MlUvco1w1JabwxAm4vOlpq7yVh+Zl8wQA== 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 4RjZWt16BXzCSS; Sat, 9 Sep 2023 14:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 389E62Sp017649; Sat, 9 Sep 2023 14:06:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 389E62tJ017646; Sat, 9 Sep 2023 14:06:02 GMT (envelope-from git) Date: Sat, 9 Sep 2023 14:06:02 GMT Message-Id: <202309091406.389E62tJ017646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 4b22565f8598 - stable/14 - mana: fix tso parameters and set hwassist bits 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: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4b22565f8598f2890d41e179fd36a0845f781262 Auto-Submitted: auto-generated The branch stable/14 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=4b22565f8598f2890d41e179fd36a0845f781262 commit 4b22565f8598f2890d41e179fd36a0845f781262 Author: Wei Hu AuthorDate: 2023-09-04 14:53:10 +0000 Commit: Wei Hu CommitDate: 2023-09-09 13:57:50 +0000 mana: fix tso parameters and set hwassist bits The parameters for tso on mana were not set correctly. Also the hwassist bits were not set. These two cause tso on mana not work. Fixed the issues and make tso working on mana. Tested by: whu MFC after: 3 days Sponsored by: Microsoft (cherry picked from commit 643fd7b4bc57de87ddfeb75a8f0bdb27dbb8c3ce) --- sys/dev/mana/mana.h | 1 + sys/dev/mana/mana_en.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/dev/mana/mana.h b/sys/dev/mana/mana.h index df527df10296..9a22ea87baa3 100644 --- a/sys/dev/mana/mana.h +++ b/sys/dev/mana/mana.h @@ -186,6 +186,7 @@ struct mana_txq { */ #define MAX_MBUF_FRAGS 30 #define MANA_TSO_MAXSEG_SZ PAGE_SIZE +#define MANA_TSO_MAX_SZ IP_MAXPACKET /* mbuf data and frags dma mappings */ struct mana_mbuf_head { diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index fa49e06e4862..56fa4e51ba26 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -798,8 +798,7 @@ mana_init_port_context(struct mana_port_context *apc) uint32_t tso_maxsize; int err; - tso_maxsize = MAX_MBUF_FRAGS * MANA_TSO_MAXSEG_SZ - - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + tso_maxsize = MANA_TSO_MAX_SZ; /* Create DMA tag for tx bufs */ err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ @@ -2712,6 +2711,7 @@ mana_probe_port(struct mana_context *ac, int port_idx, { struct gdma_context *gc = ac->gdma_dev->gdma_context; struct mana_port_context *apc; + uint32_t hwassist; if_t ndev; int err; @@ -2774,11 +2774,21 @@ mana_probe_port(struct mana_context *ac, int port_idx, if_setcapenable(ndev, if_getcapabilities(ndev)); /* TSO parameters */ - if_sethwtsomax(ndev, MAX_MBUF_FRAGS * MANA_TSO_MAXSEG_SZ - + if_sethwtsomax(ndev, MANA_TSO_MAX_SZ - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)); if_sethwtsomaxsegcount(ndev, MAX_MBUF_FRAGS); if_sethwtsomaxsegsize(ndev, PAGE_SIZE); + hwassist = 0; + if (if_getcapenable(ndev) & (IFCAP_TSO4 | IFCAP_TSO6)) + hwassist |= CSUM_TSO; + if (if_getcapenable(ndev) & IFCAP_TXCSUM) + hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP); + if (if_getcapenable(ndev) & IFCAP_TXCSUM_IPV6) + hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + mana_dbg(NULL, "set hwassist 0x%x\n", hwassist); + if_sethwassist(ndev, hwassist); + ifmedia_init(&apc->media, IFM_IMASK, mana_ifmedia_change, mana_ifmedia_status); ifmedia_add(&apc->media, IFM_ETHER | IFM_AUTO, 0, NULL);