Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4630846pxj; Wed, 12 May 2021 09:37:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCLLwZKKqPrYK/4iQjsWBOt+Zd2QXznr3I4v3842ueHBUubWVAe4kl4uuNbsuq3pdumwN7 X-Received: by 2002:a9d:12d2:: with SMTP id g76mr32582159otg.216.1620837436720; Wed, 12 May 2021 09:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837436; cv=none; d=google.com; s=arc-20160816; b=lSlEXx0mpNSeq5Cy/H68av8Agpi48PCDHb1PJrj4n3iaRzw+M2J4XK9JYshWMVAG/k CT9iZvQjbX8PEkr2MGoLwX9ysJScAt6OTvZ4+HBfXGjdlgTGRcflU/um3L3+a7ONc96v +UnkpNabkUvra/ycPO6ZIk+2dj214Z3y9txPhEr/LwzMW6ytd9iQGNedgoI8gyd1sRuC jD8kEDHhjuwAdbZcTud37XA55Nrj7rVLz6sWLBMOcyD9bV73QwxoinrUzWoJvPARuSRH yKt3Q34DOS1MBZTb55omhQce3SenKL40VbvfXZcaXZnNCm6DYZ3tWmMpqPUX1Dq65v8q i1VQ== 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=zdsVjp2v+gjgXrUN7yfbNyGZSKn2/N0SQ1ya+OJroYc=; b=eQHY16DypwxKwzcuOSjDZgUig1I+KcXDtXzYW2UigIQDoaXgsP0mmf+qoMevptfccX mMcN7y6re7g44Ppkq4/QeI9bmKg9YEu0EoOYWA+oQprC1/0X31vANpcsKBF8JlP8ba9I CrVaBTAeH7+VDhXiMn0XyQS8nVXsFix2f2zHUK2HYrlvM618NMvZc6+Nm/80FeoqVKQh w+4YguQmG8W9s7iA5WW4KjueU4oKBrgO8x39RtNDKVhcIG6uz9nzZlj6ZL2rzCQndi6+ CoHXZQFfXHETuYYNJ4h4WiM7DXjHGe3Jwy0Ly6uLiGNg7NkfDLvg91XB1adRI8ejD0l8 bgPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b+35ICPm; 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 13si488941oij.277.2021.05.12.09.37.02; Wed, 12 May 2021 09:37:16 -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=b+35ICPm; 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 S243042AbhELQgc (ORCPT + 99 others); Wed, 12 May 2021 12:36:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:40250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234543AbhELPo2 (ORCPT ); Wed, 12 May 2021 11:44:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5F06E61C93; Wed, 12 May 2021 15:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832971; bh=3RD+TccnU7IjzUSLYPKTCNFGrDt4wNRfh45NuLW48+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b+35ICPmmjiiKy80tCM2JJ8awZOSQW122Z5Ku39ng4A3dR0S/1WQlzw5l7w1fQezC AwGVxUjJVaZeTOAF1irtdPTOvw1a3CaaJYKByYjV+cGFsrx/x/+OtPaGLJPX2GvB4W eeCaKGzxkO4YYiCoaBR0ioXWizDHHpmicSLU8330= 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.10 480/530] net: stmmac: fix TSO and TBS feature enabling during driver open Date: Wed, 12 May 2021 16:49:50 +0200 Message-Id: <20210512144835.532681118@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 6012eadae460..5b9478dffe10 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2727,8 +2727,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 */ @@ -2820,9 +2827,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