From nobody Mon Sep 04 15:06:06 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 4RfX5W0m7Bz4s314; Mon, 4 Sep 2023 15:06:07 +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 4RfX5W0HSsz3LRF; Mon, 4 Sep 2023 15:06:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693839967; 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=Ysi23CWESMaz7Bct3K/3zYlLc0BDR6rgXbw2n5wvbNs=; b=nsHwEVxa7u3QQ8o8cepTuVArKDmy4lDmhJch+Z+ErHx8EYUi9ao7x1Pn4m202vOWVu61WD dckRnkz/rjqRWnRC7rttepbNU+EsCTFZcKZQnfLlSR8vgncOHP24lVcGbT2rIoeKZaxS3V tAQgGJRYNLQ3/amVjRufdnHS6eQBJdfjkTHpsdGYNis3Zz8a9egaJ7MQWiYuLRd4Dk5wni s7Mze0s1k93/H+c7vfRm4TCzMoD3FbxHnv3E4d7XlkF0sCxCR6lbIz7DYZnhJmlxd+DgoR zCnHnyfEJ9i4V1p1MayDP0v7Mf8lWLZ4a03bQdg1sYuZ+5OHX+taSG5yvkGBUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693839967; a=rsa-sha256; cv=none; b=ChuT2ELaapmum4OV1VpPx8JarvA8pmrOpW09QAZObam6qlHYdpeNu+2pueIwLcXXJyFVuX uKyYrVKjfFp5RPZMxwUvBqmrhIW1f4XwV5xEMpjwUrtQ4XM41PuDk06AL2vBJPRk4Vuyjv CdybbycdT5bv6H1Ush51TPI72nLxIU3gMS82O99oBKhLKODjmjK4DfUSu+ceSohF7Hk/Uv yvGZwlfOPsxYsZEyxvy5rVgK7AXVmiwF1PekKW/2x6Ehmyh+2mAQsTa+n/SFEaUuXDZh/H /hF4dsFR9VWgsZqn/cH/BY2uIMGh/gMur/YLx3IirAa4Yrps43/myym9xYbs7w== 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=1693839967; 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=Ysi23CWESMaz7Bct3K/3zYlLc0BDR6rgXbw2n5wvbNs=; b=pKYJw4f0fWHdDs6n7WNe3F/8jZ9DmsIiSg+LRjaTKVwiTSV9QAGn3xu/vgaB0Lu7hVSW1+ fsD4mGFmXyiWH5uiUSEi7lL9VcXPaaxF4FxrdBC9eWysU33bGBAbdYjsGSXa3k1andpLK5 Qkr+VMRESJAZY+AJb4T0n41xni4ZQIh16+eTprsccGLw1dkdv5qBOU2S8Nulu+SKh3fgQy nbO+BsZcDiO2/RSLzxCCeKECmWhSTZkBSnHFc6m4FePvKYtP76du/oktYFXtmkmAOhheb2 n4IGnah9+9HqTlRC4NMyTRuXmeXazD2LaSK/VBhcqXeSFPaNhL0CqNvoSTPk9w== 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 4RfX5V6T8Lz19kD; Mon, 4 Sep 2023 15:06:06 +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 384F66Qg048316; Mon, 4 Sep 2023 15:06:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 384F663e048313; Mon, 4 Sep 2023 15:06:06 GMT (envelope-from git) Date: Mon, 4 Sep 2023 15:06:06 GMT Message-Id: <202309041506.384F663e048313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 643fd7b4bc57 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 643fd7b4bc57de87ddfeb75a8f0bdb27dbb8c3ce Auto-Submitted: auto-generated The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=643fd7b4bc57de87ddfeb75a8f0bdb27dbb8c3ce commit 643fd7b4bc57de87ddfeb75a8f0bdb27dbb8c3ce Author: Wei Hu AuthorDate: 2023-09-04 14:53:10 +0000 Commit: Wei Hu CommitDate: 2023-09-04 15:04:00 +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 --- 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);