Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9930723ybi; Wed, 24 Jul 2019 12:32:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyE5wSanZx7y9TvcOBn2LGCjwlLt8dGb4zRWRBOE6rJBz/SJpJMQXVOOsMevuyhkpk4n5ES X-Received: by 2002:a17:90a:ac11:: with SMTP id o17mr90333407pjq.134.1563996730823; Wed, 24 Jul 2019 12:32:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563996730; cv=none; d=google.com; s=arc-20160816; b=tUyW0iwA/313ovKQMznwVoDGcg2Fp8fJTtl9DYMW2mg5+CfSU7Q2KcLQGVQ4GRcTu/ XZtiKrjT0hWfhkAY9DH2n7zxHkWR/GIW6uLoAStyd7XPwXcvgYm9xaNZrK5B/tIGZaZC UsOYx7fciBnainQmvni/ugXqzVVgnipXg+2vZcvup/sSnOgUZ2uK66BWhdC6V3CVyTDT C1DId+AY1Ogs8U3EnbE3m3XHNr3DHCGGGcN6o7KWt+1iExvmMBbW34yLamhZ70V/vFVi KxvKl60ogtVPCTztA2j0uzKeM5p193V9Gv+nmcjOrrW6FOY6SA+ympeVIRt/9jzAInw6 MtXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hMR4Ls/ypLk/g342QiHk1w4cPkMvEa/SUGm1qonNdcY=; b=DC+hUWZayjcXlglD7TqbQV2PEJrPkmkaBEO4DAsHFzCNJE9uqzWNDz2A+nZpnA/yK8 3sUv7dgRciLLt4fVAgV8lgSbzCGDaXqmvmNKOMqfulGgbP4l3a4/tTUIhuJlx/EPSugT G21rAKtxJJD9iZXKLiWUmd+AKzMwxD/W7uAlTF44k94RCaOWtzoPdkTn8sHFCOfXRnI/ kJ+hSHxUb9PRAymTS2ZsufPo7HbatQ90+J5FRgDm13Uf79f9zG0jii0eqK5iRAznAo7W Djisnjp12mp5dASFYBCwj1kwaVGZMlFzrizDLdIopBu36NjB+YR7pdiJLC149I1WN92K Or2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aYo5m6hw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si17808519pfh.6.2019.07.24.12.31.56; Wed, 24 Jul 2019 12:32:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aYo5m6hw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388395AbfGXTak (ORCPT + 99 others); Wed, 24 Jul 2019 15:30:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:50790 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388383AbfGXTah (ORCPT ); Wed, 24 Jul 2019 15:30:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 44A45229F3; Wed, 24 Jul 2019 19:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996635; bh=eCYjIyDM/jcflqiRqencvb4jCEnsdmoqDhxKfRDM8Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aYo5m6hw93R4e2X8S3RH3YpjYnueSvxAXcQNMG8KYwzAmaOaI0wV36U/wk2gTNL8Y ag1xkb26mxUa1ebo2IFeP5CL1adzh3vwW0KAL1bILBg3Nw/ALn4hEJ17+6GU8SHlaS zYuL1WvzFy2FTIWnYo/jWV8J+hs0J3KY4tfdJkpg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilias Apalodimas , Ard Biesheuvel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.2 124/413] net: netsec: initialize tx ring on ndo_open Date: Wed, 24 Jul 2019 21:16:55 +0200 Message-Id: <20190724191744.034549270@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 39e3622edeffa63c2871153d8743c5825b139968 ] Since we changed the Tx ring handling and now depends on bit31 to figure out the owner of the descriptor, we should initialize this every time the device goes down-up instead of doing it once on driver init. If the value is not correctly initialized the device won't have any available descriptors Changes since v1: - Typo fixes Fixes: 35e07d234739 ("net: socionext: remove mmio reads on Tx") Signed-off-by: Ilias Apalodimas Acked-by: Ard Biesheuvel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/socionext/netsec.c | 32 ++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index cba5881b2746..a10ef700f16d 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -1029,7 +1029,6 @@ static void netsec_free_dring(struct netsec_priv *priv, int id) static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id) { struct netsec_desc_ring *dring = &priv->desc_ring[id]; - int i; dring->vaddr = dma_alloc_coherent(priv->dev, DESC_SZ * DESC_NUM, &dring->desc_dma, GFP_KERNEL); @@ -1040,19 +1039,6 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id) if (!dring->desc) goto err; - if (id == NETSEC_RING_TX) { - for (i = 0; i < DESC_NUM; i++) { - struct netsec_de *de; - - de = dring->vaddr + (DESC_SZ * i); - /* de->attr is not going to be accessed by the NIC - * until netsec_set_tx_de() is called. - * No need for a dma_wmb() here - */ - de->attr = 1U << NETSEC_TX_SHIFT_OWN_FIELD; - } - } - return 0; err: netsec_free_dring(priv, id); @@ -1060,6 +1046,23 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id) return -ENOMEM; } +static void netsec_setup_tx_dring(struct netsec_priv *priv) +{ + struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_TX]; + int i; + + for (i = 0; i < DESC_NUM; i++) { + struct netsec_de *de; + + de = dring->vaddr + (DESC_SZ * i); + /* de->attr is not going to be accessed by the NIC + * until netsec_set_tx_de() is called. + * No need for a dma_wmb() here + */ + de->attr = 1U << NETSEC_TX_SHIFT_OWN_FIELD; + } +} + static int netsec_setup_rx_dring(struct netsec_priv *priv) { struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_RX]; @@ -1361,6 +1364,7 @@ static int netsec_netdev_open(struct net_device *ndev) pm_runtime_get_sync(priv->dev); + netsec_setup_tx_dring(priv); ret = netsec_setup_rx_dring(priv); if (ret) { netif_err(priv, probe, priv->ndev, -- 2.20.1