Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4750922pxj; Wed, 12 May 2021 12:23:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+Nj/wR17FvXHdOC9ECk2OzK1oCJxO70mEin25ZDCgYGixnfWvYDjBb5lD01U6c17rk8+l X-Received: by 2002:a17:907:a076:: with SMTP id ia22mr39030954ejc.233.1620847387446; Wed, 12 May 2021 12:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620847387; cv=none; d=google.com; s=arc-20160816; b=0ivKLv76XlWb/2Y+VUtdv7Ch8I3UNURZ7PnUO+DbdW522HYkqtnHaBaVXAlieZMkaJ ABmyceal4hlZgRFxDxeFYip1Ji72FHeu94b/hjNr0uzVR4cjQS7zF9wrbZjLSGoC4m6K 8bhTfMDaMbEspWotUiu/u6mQ04gRPGkfYxFY9HbuTwFiH22PHIQCBwCCUuVXd8I+gEYT P0BMDtj0xZZlLrmLGW0xytciaxoFe5843bJaF0MMMB/iTcRemdXax5RC59OOt9TPMrrg rIZWXpvjlPbmAK6mpfSuWk/pADhjMiCrsOp8OhSGiev1rvz7dN2lC5fF6EYwKm5S8/Ny DSDg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lExZpim8rzRwA5tz0n044kuebybw3rBCOJ+mqIn7Xvc=; b=dDZnvihlAeObjzFvxgFFksT1EQ+C2UL0vEiZiPnZqVQpotFDVs5r09ZTq4vsc0dQi0 untn+p+HQHrn4w957AqlOwDYk+4T/TJoJHSRTYQ1BoN+ajH6WrZPmTPMNFpE44+OyoBY wyC/ut2EEY8/wuJobuW5snBEF/946/oUzR9ir5MFfeoxGQ0puLDHYG2DqD3f5DuuoBNu ok0Kq4xft1x3Vrfirnisvmax69+YT7+g4+kiub2lUdMKRkWFHr9KEoSFCH+Ff+v/DPgU 4dEgeu2Z7cX0pkrlWxDVQkdlw9OYmWBI1l5R/IjhZAh1sLeFXJuX69hexPZm9fyAMyvd TYPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hp1eddF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp12si703776ejc.245.2021.05.12.12.22.42; Wed, 12 May 2021 12:23:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hp1eddF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378527AbhELTRI (ORCPT + 99 others); Wed, 12 May 2021 15:17:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:37580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233461AbhELQrO (ORCPT ); Wed, 12 May 2021 12:47:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0ECD161E7F; Wed, 12 May 2021 16:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620836118; bh=YZ4EGNozTOU8hGUZKKI0E3g1TalZVevFRK9ARMR80T8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hp1eddF5mWeZ1ioYcx1+Fdu0hGpYwlOWADJvy2xerjVCb975cw05quGOv6ulD8/Jp scsZEgwW8jEXfKYL3Z17/nc7n1uIl20Jq5izJeslhMsB75BL9j49J30D2lClGMOqrQ Duf/ql6h/1Ks5SCBJNUadLBTU1MYCr/gkTtQb6Fo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ong Boon Leong , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 618/677] net: stmmac: fix TSO and TBS feature enabling during driver open Date: Wed, 12 May 2021 16:51:04 +0200 Message-Id: <20210512144857.902673946@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ong Boon Leong [ Upstream commit 5e6038b88a5718910dd74b949946d9d9cee9a041 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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); -- 2.30.2