From patchwork Fri Sep 15 09:54:16 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: 13386780 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 7B706EE644D for ; Fri, 15 Sep 2023 09:55:18 +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=sAmI+k6/iPso1xy1y52oB+UNPX3Lq66RZ8xfCwn6XGs=; b=PIQb87sc4W+Cqx m2BQHeho4XqQeZMJ43kcHI+bZr4VUK9iGJEWwYoePSdBU5SxQep60FTeLU/VnY+4g9X74O/mIc9mx GytnYHSiAVX50NsHMsf/D3q1PkTU9DIMF5aCaBf4cuFUXy13VwJpGqalx5tHNrbf6I3G0D69nF/36 SqmSGJgfqpqiyCA9xqeSSD6+xtK+ZyrD7mfnVQ836QSxu/TYM1c1QiTNL5agzFGO2B4hUfA1V3rMb jemqdnNO240E7FtktZbbwms/mFU64XNXc3tDvrmbjqVUzv5f0piJZy0vLkAbe6xsWk0ZkJEfvIasI c8hx0MEDEPrhnftBODwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qh5XA-00AKWJ-1I; Fri, 15 Sep 2023 09:54:44 +0000 Received: from mgamail.intel.com ([134.134.136.24]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qh5X4-00AKSf-0R for linux-arm-kernel@lists.infradead.org; Fri, 15 Sep 2023 09:54:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694771678; x=1726307678; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SNz9ScF+wt804GivI3ixasEzsFqTt1XAXDDCOHpojXU=; b=DtPZdrf9kLifs2EE973F0oFfT7FYv3yReJBofbasS00t1pjGiXQc4eN2 btzF/D/gECrOYh/tobUIIJXB9neNzsz9itPWqmB8a6gocoqq08ZCoeqIh p/uj4mknFkEtAzHE5PuIIv/TnITyzcsEmX0ktsVIlaEZsC3FvixzJJ3fa wSVmbPkv3fX3PRlblm62dkNTpvI+7GjWq0sSkUSrwUcqPsKVEH35mJK3o wzCgpiVie96pcBEzAQTijTrRxMBP5rW2OHnRAIMZLb+toCirhf/J46zyo G3l5F1hSjMRnNWSy0D2znd+tE8rKk6deH6Ck4uN+Z1V+9bFO+y/Y3SP+6 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="381938696" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="381938696" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 02:54:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="744916306" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="744916306" Received: from pglc00032.png.intel.com ([10.221.207.52]) by orsmga002.jf.intel.com with ESMTP; 15 Sep 2023 02:54: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 v6 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported Date: Fri, 15 Sep 2023 17:54:16 +0800 Message-Id: <20230915095417.1949-2-rohan.g.thomas@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915095417.1949-1-rohan.g.thomas@intel.com> References: <20230915095417.1949-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_025438_215181_C8A3AA2C X-CRM114-Status: GOOD ( 10.77 ) 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. Signed-off-by: Rohan G Thomas --- 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..365e6cb73484 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -394,6 +394,9 @@ 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 Fri Sep 15 09:54:17 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: 13386779 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 125D9EE644C for ; Fri, 15 Sep 2023 09:55:10 +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=o3lxwAnY1LBGkd 1cvdHWn8xKYp8Z6Xa1G9OQjLW6peSnEGEGBzYcLb/Ic11saHJRlDa0H1+nOgcA64KxaA4RlI+PYW4 BkMHSV6Dal+HDQqHDDd/f7W+cXNv1Bs+f+uPcjewnmdnckfbigs4Sywuibm9VKBRZlBlM0TIR25d1 kVHnM+kdCGU3H3gasMg2H9nxnkNw1VtToWclGYZuQMiPmuQaeyErO/XPlEtyUQtSKfFjaxzG/d5up IqsU3h+O8cvU9yjx2fiMJIzaK/a1yw7Sm1/wVEX1I3QYgwKjDVt0CK3Uu4JFBSZjJwiIkfihfeQec yC8O5rgQIedVyUphMKzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qh5XA-00AKWk-30; Fri, 15 Sep 2023 09:54:44 +0000 Received: from mgamail.intel.com ([134.134.136.24]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qh5X5-00AKSf-2J for linux-arm-kernel@lists.infradead.org; Fri, 15 Sep 2023 09:54:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694771679; x=1726307679; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dlwnheLHWrheCZf+0lnqyF5y1gAk0XJDuzApxL+C0IU=; b=YNr1AUdTKq3FoD6Ghv50WMRsixBzR0LfUPSgrwUPZNh3nF4kS/nxgguG lTMORBmgxlKraIVQyp2gp2qb137EBZqbYlLxho+Vt7TBcxCkYhtAKB/VT UfFbgks+G17wOWtCvH5iTKAolPWLhLEciAB4pKf/vcun6o0wg66RbwYZ5 IKowQYsOh5doxDtDODg1jPOgIQtnaJm47S83PssTNErPlta0TZ5nbNUlV RXGbC3OVZ/uQ1pi8YoN/OuOewGZe3PQT87FEds3iyROJeoBAfCiWdSefS AxrVoOMY9p5uWlqcFzKi2l9bDBGQtvQoA7LdfFZL78qk5c8bjk7IEZv36 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="381938746" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="381938746" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 02:54:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="744916324" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="744916324" Received: from pglc00032.png.intel.com ([10.221.207.52]) by orsmga002.jf.intel.com with ESMTP; 15 Sep 2023 02:54:33 -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 v6 2/2] net: stmmac: Tx coe sw fallback Date: Fri, 15 Sep 2023 17:54:17 +0800 Message-Id: <20230915095417.1949-3-rohan.g.thomas@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915095417.1949-1-rohan.g.thomas@intel.com> References: <20230915095417.1949-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_025439_827711_9E5DACDD X-CRM114-Status: GOOD ( 17.02 ) 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;