From patchwork Sat Aug 19 02:31:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan G Thomas X-Patchwork-Id: 13358446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C014EE49A0 for ; Sat, 19 Aug 2023 02:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xdvjLPEEaT5YDc8PMDmBojJVaBH5ydlrWdJP9SrqyDQ=; b=I0MVdKttf2r0bw WRx9a3VcZFcYjWMAkDXlfr1fId4kYgP+GOeU1GodLwONZo7mn1c8nOjneWR+I3IJJH0G+6sHrg9gh qj8nUtNROWLYHZRUSpw8M5oEO+SxCBImaefasE2b9jbyZmiNNH6x+wOdGw7gmyc+CRYbGWf29AP9y Pq87uidBRTJ9jWoF7Lmk+xTLvZ8Vvwq/PU5H7Pg7BvmcTTi1Lw0qqJVCsrcHfr5AoSioyNnJ1FH7C 6Xv58EeUjNOllDcP65SLFUvAv5G/WJoTk/HjGfNlHVSWMVTriYTLDGARpSDO3CLMlhGt+pJB1O+AZ HUx0OjLqtrYgeIgQMsPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXBlA-00AIHf-0o; Sat, 19 Aug 2023 02:32:16 +0000 Received: from mgamail.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXBl2-00AIGP-0R for linux-arm-kernel@lists.infradead.org; Sat, 19 Aug 2023 02:32:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692412328; x=1723948328; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V1ASKrWZR21qiCs/uTkTgFEuUcWckcx/+Gm2AG2f6Q8=; b=OUhi6+vrL7GcucGZ5xfwNbnpBH8VFlVOZhUoLS096RG62Ypuo4j/1yzI 60vxLCEg+gbBLJ8HfQf6sL683LHmTMP81gSbcqAy36Qfd88lbfc93iMj0 /cagO+S17zYyGw9lAKCquYABLfkOHQKzNBqO0j2nUjpmG58+Ct/pUj+2S vZ1g81QcK6Hr+m+rLTnAhEJBi+ihM6f6rfFmvesmUW1hYNech2wGcV2SN GxEEcJ2kTT0Y00KZmBjHN1U/E+Rbr13usn/XZdLeohdiuZugImn6/VVik 0xYQRwEG05COBSmdWMowi1x5uU9kVFpA+a7IBLs74BWiFh24V7ApaYKpC g==; X-IronPort-AV: E=McAfee;i="6600,9927,10806"; a="439629425" X-IronPort-AV: E=Sophos;i="6.01,185,1684825200"; d="scan'208";a="439629425" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2023 19:31:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10806"; a="800660794" X-IronPort-AV: E=Sophos;i="6.01,184,1684825200"; d="scan'208";a="800660794" Received: from pglc00067.png.intel.com ([10.221.207.87]) by fmsmga008.fm.intel.com with ESMTP; 18 Aug 2023 19:31:42 -0700 From: Rohan G Thomas To: "David S . Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Serge Semin Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rohan G Thomas , Conor Dooley Subject: [PATCH net-next v5 1/2] dt-bindings: net: snps,dwmac: Tx queues with coe Date: Sat, 19 Aug 2023 10:31:31 +0800 Message-Id: <20230819023132.23082-2-rohan.g.thomas@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20230819023132.23082-1-rohan.g.thomas@intel.com> References: <20230819023132.23082-1-rohan.g.thomas@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_193208_586991_4CBB73C8 X-CRM114-Status: UNSURE ( 9.20 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add dt-bindings for the number of tx queues with coe support. Some dwmac IPs support tx queues only for a few initial tx queues, starting from tx queue 0. Signed-off-by: Rohan G Thomas Acked-by: Conor Dooley Reviewed-by: Serge Semin --- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index ddf9522a5dc2..0c6431c10cf9 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -313,6 +313,9 @@ properties: snps,tx-queues-to-use: $ref: /schemas/types.yaml#/definitions/uint32 description: number of TX queues to be used in the driver + snps,tx-queues-with-coe: + $ref: /schemas/types.yaml#/definitions/uint32 + description: number of TX queues that support TX checksum offloading snps,tx-sched-wrr: type: boolean description: Weighted Round Robin From patchwork Sat Aug 19 02:31:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan G Thomas X-Patchwork-Id: 13358447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14DFAEE49A0 for ; Sat, 19 Aug 2023 02:32:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fEsuvbTHqOaawTXifd1zisd3rj2iMunS70StHMkwMHc=; b=HToYHMG7yl8cfZ MBjqX7y6tBT+3sBMMgBmHNIPAqzdtgIpBoUS2Xa59GoDnjg2lbIloU5ZwE4vYy69LpeislvxuI3mG Eh8TaUawYlqnd8w5wRHygA5+u4/Aldys2euLcLm3I341CWsK5ElNEyuK0ugPJu0dWte6OT9hCL/rR EDl+d7TMjDv6MYNeq/yv3in+6JtS4AwWi1eDL4y4+WYKJsnz9b9NlmxyOAsZdvAe0ZOS6+u3Ih0N+ T09Qg8QYgnPfQOGtOM9X4LB7HJDA3stVj2itcQdwZt6MX8a6QPA68zJhhQ3p8xmZgWquqt4mx1zw+ 3PKZVTdfMuFpICLyLy5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXBlA-00AIHw-2J; Sat, 19 Aug 2023 02:32:16 +0000 Received: from mgamail.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXBl5-00AIHF-38 for linux-arm-kernel@lists.infradead.org; Sat, 19 Aug 2023 02:32:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692412332; x=1723948332; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LEjADStVhAAijpcwNiIM9Zhi3t+hw0nFfACu76UjFKk=; b=gS/UpdRfouju6DzdH0dssE/JcdnxECG+wheBjTD0W/lRl112yaYoRIx7 a1fBS8lDJzj9Z+84yklIAdQmCEDVgQT/gwRPLtj2Bl5XMu7iWSwXNS3Oa N2O6Nyzb5QnivbX5/qdtT5mG+krXmoLMzHg24G10CO0lWBj2pCZNOslCK G+fHfe7KMf03l4+lRQ2yvexDrnIZyj1Ki9JhgY+7+QkpyG0IoI2HqMpAy wwU9Wgq69eXb7FnnqrAeNQxm9buonQ1REgF45HSVubvDoZUkRi4va5EG2 8PszTd7EBraAk071HwdTgDL5t/2CXDKC6VKQCYgARwho7YwFjZ1bx8O1K g==; X-IronPort-AV: E=McAfee;i="6600,9927,10806"; a="439629477" X-IronPort-AV: E=Sophos;i="6.01,185,1684825200"; d="scan'208";a="439629477" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2023 19:31:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10806"; a="800660811" X-IronPort-AV: E=Sophos;i="6.01,184,1684825200"; d="scan'208";a="800660811" Received: from pglc00067.png.intel.com ([10.221.207.87]) by fmsmga008.fm.intel.com with ESMTP; 18 Aug 2023 19:31:49 -0700 From: Rohan G Thomas To: "David S . Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Serge Semin Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rohan G Thomas Subject: [PATCH net-next v5 2/2] net: stmmac: Tx coe sw fallback Date: Sat, 19 Aug 2023 10:31:32 +0800 Message-Id: <20230819023132.23082-3-rohan.g.thomas@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20230819023132.23082-1-rohan.g.thomas@intel.com> References: <20230819023132.23082-1-rohan.g.thomas@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_193212_123208_D64CE4EC X-CRM114-Status: GOOD ( 15.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add sw fallback of tx checksum calculation for those tx queues that don't support tx checksum offloading. Because, some DWMAC IPs support tx checksum offloading only for a few initial tx queues, starting from tx queue 0. Signed-off-by: Rohan G Thomas Reviewed-by: Serge Semin --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_platform.c | 4 ++++ include/linux/stmmac.h | 1 + 3 files changed, 23 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 733b5e900817..3ffef45a2861 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4409,6 +4409,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) WARN_ON(tx_q->tx_skbuff[first_entry]); csum_insertion = (skb->ip_summed == CHECKSUM_PARTIAL); + /* Some DWMAC IPs support tx coe only for a few initial tx queues, + * starting from tx queue 0. So checksum offloading for those queues + * that don't support tx coe needs to fallback to software checksum + * calculation. + */ + if (csum_insertion && queue >= priv->plat->tx_queues_with_coe) { + if (unlikely(skb_checksum_help(skb))) + goto dma_map_err; + csum_insertion = !csum_insertion; + } if (likely(priv->extend_desc)) desc = (struct dma_desc *)(tx_q->dma_etx + entry); @@ -7401,6 +7411,14 @@ int stmmac_dvr_probe(struct device *device, dev_info(priv->device, "SPH feature enabled\n"); } + if (priv->plat->tx_coe && !priv->plat->tx_queues_with_coe) + priv->plat->tx_queues_with_coe = priv->plat->tx_queues_to_use; + else if (!priv->plat->tx_coe) + priv->plat->tx_queues_with_coe = 0; + else if (priv->plat->tx_queues_with_coe < priv->plat->tx_queues_to_use) + dev_info(priv->device, "TX COE only available for %u queues\n", + priv->plat->tx_queues_with_coe); + /* Ideally our host DMA address width is the same as for the * device. However, it may differ and then we have to use our * host DMA width for allocation and the device DMA width for diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index be8e79c7aa34..0138b7c9c7ab 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -225,6 +225,10 @@ static int stmmac_mtl_setup(struct platform_device *pdev, &plat->tx_queues_to_use)) plat->tx_queues_to_use = 1; + if (of_property_read_u32(tx_node, "snps,tx-queues-with-coe", + &plat->tx_queues_with_coe)) + plat->tx_queues_with_coe = plat->tx_queues_to_use; + if (of_property_read_bool(tx_node, "snps,tx-sched-wrr")) plat->tx_sched_algorithm = MTL_TX_ALGORITHM_WRR; else if (of_property_read_bool(tx_node, "snps,tx-sched-wfq")) diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 784277d666eb..cb508164eaea 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -252,6 +252,7 @@ struct plat_stmmacenet_data { u32 host_dma_width; u32 rx_queues_to_use; u32 tx_queues_to_use; + u32 tx_queues_with_coe; u8 rx_sched_algorithm; u8 tx_sched_algorithm; struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES];