From patchwork Wed Apr 21 09:11:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ong Boon Leong X-Patchwork-Id: 12215759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EEC8C433B4 for ; Wed, 21 Apr 2021 09:12:57 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0590161430 for ; Wed, 21 Apr 2021 09:12:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0590161430 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=Yfsz6CHD4nhIM+GzysxakC6jliWxZ/pNO8aus7uAtLQ=; b=Nhgfv+S1nUPaeLeYW10bjWpPes RpHAXuMtUw0tVyW+jbdGBKeoM3I1CdT47dkMsHoqCPXFvWdE+niX+d4n3d28aA5g+RKfTsAgx8+Fn mzgOL1+ZzMUbq0wfZ43RXn7e3FdIC57n7EIVFH2EzIhTQYBTC8TzdG2yxq8vGx66M+8BT7GCFyrzv x1nD0hrv8f2FJq88q+sHs8Oa2rI/+MPp+K40vnAG9jZycjCgCq2c7Gcwhnb5UWEVz4vJXlt3h9Uwr 5stMIkd1lCTE/TxQ2Tt6YYNIMfhLITJY70uJ3orz2uLScEXY9nur6Zlvg3jZa8Y0FAxOESW40PPbm oLDFZhEA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZ8sy-00E4ba-V2; Wed, 21 Apr 2021 09:11:05 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZ8r6-00E3lW-Ax for linux-arm-kernel@desiato.infradead.org; Wed, 21 Apr 2021 09:09:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=nm9OAmm27m6JzM1yhOZzQ+CSyyCYozttgB59m39ilsU=; b=y1FlRjTvSnbObSv/tXSP04RlCM OMMPDDvcagXWvkVtdhlGxCJrOWiezfHmPHGpIv7Yl3U1lr9OCe/JjT5NZ+4sK3FQIyA1DVBzmw1ud SuW4/EZMuR27eYOgwP543ruXKkqMEglXPJAMVf0U+hZu/53Yyt9Pqu5NF2+EkeyFni3thkcYi8rnn TfVa3jJwPmLgfykg0lyvBGn7J7Pa4UZ1+MuQjMtgw+pLjhIkr9TCzklQDsZBvWSVkGQxxOHcUsNO/ GGzwuQVSN1Fhtm5OcSfZl0gGSBsZMyhoUFNnq5zjCc3IbB0XAEHPRlvhSBeBhXkf1ezXpzW9PDAZt B+2FBJiA==; Received: from mga17.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZ8qz-00CjtL-DG for linux-arm-kernel@lists.infradead.org; Wed, 21 Apr 2021 09:09:06 +0000 IronPort-SDR: J80LCrO4u6vkgTbm6MJroxj5EOLob7gH8M2Us80XUetewwXVmra79NiPyufovbV7aSPmwddRND ilnNRW+GkLvA== X-IronPort-AV: E=McAfee;i="6200,9189,9960"; a="175773639" X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="175773639" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2021 02:09:00 -0700 IronPort-SDR: DN8SoSXKp7r6nZp8rCRIndx7m90PfocgTMR3O5IwKANU6meiFXTRRMXFLk1N6fR4xx8+8VFK4X JbBc86WAjgKw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="463517768" Received: from glass.png.intel.com ([10.158.65.59]) by orsmga001.jf.intel.com with ESMTP; 21 Apr 2021 02:08:57 -0700 From: Ong Boon Leong To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski Cc: Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ong Boon Leong Subject: [PATCH net 1/1] net: stmmac: fix TSO and TBS feature enabling during driver open Date: Wed, 21 Apr 2021 17:11:49 +0800 Message-Id: <20210421091149.5035-1-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210421_020901_482858_E82575BD X-CRM114-Status: GOOD ( 13.24 ) 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 TSO and TBS cannot co-exist and current implementation requires two fixes: 1) stmmac_open() does not need to call stmmac_enable_tbs() because the MAC is reset in stmmac_init_dma_engine() anyway. 2) Inside stmmac_hw_setup(), we should call stmmac_enable_tso() for TX Q that is _not_ configured for TBS. Fixes: 579a25a854d4 ("net: stmmac: Initial support for TBS") Signed-off-by: Ong Boon Leong --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4749bd0af160..c6f24abf6432 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2757,8 +2757,15 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) /* Enable TSO */ if (priv->tso) { - for (chan = 0; chan < tx_cnt; chan++) + for (chan = 0; chan < tx_cnt; chan++) { + struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan]; + + /* TSO and TBS cannot co-exist */ + if (tx_q->tbs & STMMAC_TBS_AVAIL) + continue; + stmmac_enable_tso(priv, priv->ioaddr, 1, chan); + } } /* Enable Split Header */ @@ -2850,9 +2857,8 @@ static int stmmac_open(struct net_device *dev) struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan]; int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en; + /* Setup per-TXQ tbs flag before TX descriptor alloc */ tx_q->tbs |= tbs_en ? STMMAC_TBS_AVAIL : 0; - if (stmmac_enable_tbs(priv, priv->ioaddr, tbs_en, chan)) - tx_q->tbs &= ~STMMAC_TBS_AVAIL; } ret = alloc_dma_desc_resources(priv);