Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4593410rdb; Fri, 15 Sep 2023 07:00:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFmB+nEkDVH8aqsHc4pmMuWz0sk3h3XNQSSpmFsKzscXe/OpQj1oYjSSsNTjza+WThPdDH X-Received: by 2002:a17:902:a40b:b0:1c3:9a8f:d335 with SMTP id p11-20020a170902a40b00b001c39a8fd335mr1563609plq.57.1694786448759; Fri, 15 Sep 2023 07:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694786448; cv=none; d=google.com; s=arc-20160816; b=xFaFz2/FPzuXb9GUHvRQojJHdMmTL9i5i1VNgzpMnDfuoAWcI812WhC3xYLZ0CrNiA YGwt8Pp7zLKRF5iUYOaAeBzI1eYUaeIQsbTnTQb7A4KQ06/AhQFxj/P2Gpv12cGmCdaF v68LaTiBaCSLw5ELAbIaCn58NBY2We5fHarWMJoANXvuMHk3A7pXm37syWyAFayeMNp+ uD7Xg5beo8Ectdf0V1fs/7VxvTFnLXgRqkfVzhRee+91tLyAx1pQB9gGAnx5SZGjh8qV 3xEnPMJ+jF4/cYUwIWfWkrYsiFFrr8lXoEdadeQJ1G9YkWpTSMRbtOU7ik8R5LXKHdN8 WaCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NXhJ8yKhruL1mdg8B32A2EIUL6xUgzcb27HFvPJPekc=; fh=iirzLoWJAOwPJS/1lQH2xIo9YnUkSd2SurOPc047UYw=; b=m+VQmbAhgofksQe6kqfbb2ErvmX7oieAhoWDHhf6x4hHIIYiD+hELzqVyIrko9/eTE UJ4fLYk3nt30Iqw89/RtcZVuY+mK43uaqhLGlgzITwtFft85nIJQb7tWSPNDAKxk9gaI 9O9XKkIwjmu2Ie6vtJcE6s+rFrlWw5qecVw4PSFc4uU/td3CRv/EBhCYNe16wxbumUga FPZ8R/NVnIN6+T33MGyWsuP979bp6GF7p8dmNS2pmpXK+rfux502tyoLP0BpSuDNvEIV rna5ZMdUSMeF5coviJvMkel2gTUghUPLAMd2MvzJE7wV+lwG9PbFfNx3OBS8UrmKmR5H LPIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gI3engqu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id jf1-20020a170903268100b001c3e9b0bae1si141317plb.443.2023.09.15.07.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:00:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gI3engqu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 126708050900; Fri, 15 Sep 2023 03:05:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234150AbjIOKFZ (ORCPT + 99 others); Fri, 15 Sep 2023 06:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234129AbjIOKFT (ORCPT ); Fri, 15 Sep 2023 06:05:19 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81BB4268A; Fri, 15 Sep 2023 03:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694772178; x=1726308178; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dlwnheLHWrheCZf+0lnqyF5y1gAk0XJDuzApxL+C0IU=; b=gI3engqurk/g/497fI/CT66pBwFbuwP1ckNDl9K2h2Uy2QkoNG0CwqNJ dYUpHTZbDlP4VueUD0xrGldn52YsMKtzD2NyJAY3FwL/TCI2y4qwMath2 CNDkw8G/Grkp0XCDg4cPL4W9RKYojpbup0TNYvjZypnYax3JpJ4yNmOeB EN1iNesEl3AT/9Ann9Dkgj4uEJm8cWVHyyRAEZmLSzFRQh0EXyLz/ryA9 Z7xhOW36Fw2rgkt4UL7MgGM5NWDIP/T+zAsRH19yXFqDm7FQc7tTce9Ee 0i8KvbKa3a5vzIklEItn0c570dG4m/e62VxuTooHwnM+SUZzEongmdns1 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="381938741" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="381938741" 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 15 Sep 2023 03:05:37 -0700 (PDT) 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; -- 2.25.1