From patchwork Sat Sep 16 06:33:11 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: 13388136 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 F423ECD37B2 for ; Sat, 16 Sep 2023 06:33:55 +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=uC4ONHytQvgjrCaNfy+mv8HcnCT9tlQtz7zmStq4a+A=; b=VLAkxX5xopWEs3 6pv+QZ0ahd++/7oXZglk+V6lFy4XBqaV5Wzc9edN8dKfCROLpgz0yM7m9sZFVEK8H89/4lbohz+rU jHxHmln75eZapoYkDQJtGpy++tNlt4GDTAHPaJD3uD+ZFyCpsIrZvC7e/JKQwJ399qkqH+GfYWh4a 76TQEvlQtzjHzjE0VnV+Ztajo82C8kGJuNXf6dUWhu/SK3rVuj4KHy7HdgyzZKUObO0Bae5drY3qx BokNSl8Ag3HMIYOP6SIyu5hKIhwbftrpgRqm3MHX3x+seZB18cIB60s9eXo7fA9YWHJsYpbk1rwhH j3Et5Ad1ZOkFBWfsR6HQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qhOs0-00C2JO-0Q; Sat, 16 Sep 2023 06:33:32 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qhOru-00C2Gv-1l for linux-arm-kernel@lists.infradead.org; Sat, 16 Sep 2023 06:33:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694846006; x=1726382006; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=52OjBIdYros6Vg0OVslLmr8CvSafvNPl+icnhq/BIUM=; b=Hz8Z33cxTnU78cyT9Xg/LWY5J/w8FRNV233VPoBk/5NMt4fzpvhdzjql 3wnCRf1hMUo1f3Bv9rH6XPr80yM8XK+ixWx76RvqdHLbkgo4ttVI4BWiQ skP5KsFNFGVHRJfyF+qa0bj6ZnGuBj3Lq7yU06kw0fZTuE95ByrOYmI8q QmyjJI246dUC/CZh21r6jCZORHPWYKliIy6fzJ3lzt7hnVRe7ojSeNi+q b9+1lb8OATGpsvqUP1J2PxwzqZ/ry2+S3BaKGDFlUJhUzT7gpNoo9bj03 6rnFVz8aKLQciDhEI1rkSFJ8G8ZOh10EPuae6SI87Gw+7iQiLR2Qq3Sv+ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="359637800" X-IronPort-AV: E=Sophos;i="6.02,151,1688454000"; d="scan'208";a="359637800" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 23:33:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="780351413" X-IronPort-AV: E=Sophos;i="6.02,151,1688454000"; d="scan'208";a="780351413" Received: from pglc00032.png.intel.com ([10.221.207.52]) by orsmga001.jf.intel.com with ESMTP; 15 Sep 2023 23:33:21 -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 , fancer.lancer@gmail.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rohan G Thomas Subject: [PATCH net-next v7 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported Date: Sat, 16 Sep 2023 14:33:11 +0800 Message-Id: <20230916063312.7011-2-rohan.g.thomas@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916063312.7011-1-rohan.g.thomas@intel.com> References: <20230916063312.7011-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-20230915_233326_597812_E5556CDE X-CRM114-Status: GOOD ( 11.31 ) 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 coe-unsupported property per tx queue. Some DWMAC IPs support tx checksum offloading(coe) only for a few tx queues. DW xGMAC IP can be synthesized such that it can support tx coe only for a few initial tx queues. Also as Serge pointed out, for the DW QoS IP tx coe can be individually configured for each tx queue. This property is added to have sw fallback for checksum calculation if a tx queue doesn't support tx coe. Signed-off-by: Rohan G Thomas Acked-by: Conor Dooley --- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index ddf9522a5dc2..5c2769dc689a 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -394,6 +394,11 @@ properties: When a PFC frame is received with priorities matching the bitmask, the queue is blocked from transmitting for the pause time specified in the PFC frame. + + snps,coe-unsupported: + type: boolean + description: TX checksum offload is unsupported by the TX queue. + allOf: - if: required: From patchwork Sat Sep 16 06:33:12 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: 13388137 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 50FB1CD37B6 for ; Sat, 16 Sep 2023 06:34:00 +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=5Iu6MdAtvMYXzN/6QPL/B1K2qn2oXJyqZ6TGjUHI0b4=; b=dFhVG+/fVPHNrA ANLXEvI1Mbz4V1ZhVgSRSFz4EtGWC/G1NBTbfvyo3kyvwuwdJPjhPHMrykpreIkk93r61kTLXtmM0 QajR3YmLgK1uQplqz/DPJ58TQ2tuaatMRzYeBfdgAOh/DsWIRVbsp02FNynzvD8bHyvYWO5PV1g5F DlNGSoUi5guyln/CQzxTZ6AVMcFIkTIXPUw30XX9ACv4pYdUZ4UtkB6ZNz0TLhpsShlXvSXPNQudE XKJFEI5W9yAeHTAKxi02o8DM/7mmoNcZ8oKuW4ZI+aNm2bv6/zDqBeJ3XvQ3xsAES/cvpxo3LSVqT i4BnnkGGsGTBiCJfSadQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qhOs3-00C2KK-2W; Sat, 16 Sep 2023 06:33:35 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qhOrz-00C2Gv-2h for linux-arm-kernel@lists.infradead.org; Sat, 16 Sep 2023 06:33:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694846011; x=1726382011; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dlwnheLHWrheCZf+0lnqyF5y1gAk0XJDuzApxL+C0IU=; b=buFXf6XO+XGRNS1SGLuxjClGvhDCO8be5fhqZnsgTuTI//MPOZdf8FU0 X5zA71cYwmXWm/AGtW6YDoDCv3O/X1IRXbB4Rs/6c8wRF02SZnaNiKaKs VbwmQ2HTvSFB9L9yc15NcFwRu9bsG3k4prU9htqvQbzQpP/ujde/gHTT4 xAE4DSLwSlxsfyjMSTuthUR7kNeAWo3Hch4+twlxDgM4Y5aQmYoAEFDIV i6T4BjuU7fx/sPLXZ0+/Yg4kmuD2B4exs46sFTgshgEdSXVA3m7ns2pOF KO/wEUzSfvzfYh4L1gQBisG3Eh8vuaSQ2DhRr6mvbmeYKan/8nnfO/nkx g==; X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="359637819" X-IronPort-AV: E=Sophos;i="6.02,151,1688454000"; d="scan'208";a="359637819" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 23:33:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="780351428" X-IronPort-AV: E=Sophos;i="6.02,151,1688454000"; d="scan'208";a="780351428" Received: from pglc00032.png.intel.com ([10.221.207.52]) by orsmga001.jf.intel.com with ESMTP; 15 Sep 2023 23:33:27 -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 , fancer.lancer@gmail.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rohan G Thomas Subject: [PATCH net-next v7 2/2] net: stmmac: Tx coe sw fallback Date: Sat, 16 Sep 2023 14:33:12 +0800 Message-Id: <20230916063312.7011-3-rohan.g.thomas@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916063312.7011-1-rohan.g.thomas@intel.com> References: <20230916063312.7011-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-20230915_233331_891831_FA0678FA X-CRM114-Status: GOOD ( 16.16 ) 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. DW xGMAC IP can be synthesized such that it can support tx checksum offloading only for a few initial tx queues. Also as Serge pointed out, for the DW QoS IP, tx coe can be individually configured for each tx queue. So when tx coe is enabled, for any tx queue that doesn't support tx coe with 'coe-unsupported' flag set will have a sw fallback happen in the driver for tx checksum calculation when any packets to be transmitted on these tx queues. Signed-off-by: Rohan G Thomas --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +++ include/linux/stmmac.h | 1 + 3 files changed, 14 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 2206789802bf..9201ed778ebc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4401,6 +4401,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); + /* DWMAC IPs can be synthesized to support tx coe only for a few tx + * queues. In that case, checksum offloading for those queues that don't + * support tx coe needs to fallback to software checksum calculation. + */ + if (csum_insertion && + priv->plat->tx_queues_cfg[queue].coe_unsupported) { + 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); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 0f28795e581c..a09014c9e7d0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -276,6 +276,9 @@ static int stmmac_mtl_setup(struct platform_device *pdev, plat->tx_queues_cfg[queue].use_prio = true; } + plat->tx_queues_cfg[queue].coe_unsupported = + of_property_read_bool(q_node, "snps,coe-unsupported"); + queue++; } if (queue != plat->tx_queues_to_use) { diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index ce89cc3e4913..c0079a7574ae 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -139,6 +139,7 @@ struct stmmac_rxq_cfg { struct stmmac_txq_cfg { u32 weight; + bool coe_unsupported; u8 mode_to_use; /* Credit Base Shaper parameters */ u32 send_slope;