Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4200088pxu; Mon, 12 Oct 2020 12:04:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0hSxPqKRapNvNYxicFvf1SyXB82ivWODUTme1lRLL1zmz8vhaPfttiGc4YHxzB1L3eehv X-Received: by 2002:a17:907:429f:: with SMTP id ny23mr28674055ejb.150.1602529462045; Mon, 12 Oct 2020 12:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602529462; cv=none; d=google.com; s=arc-20160816; b=0KrkNRDJ01buhPwvdQfzwgRcMnDktUM4KW74x6tjFv1jsfBHB1anCi3wJ835Mjp9gP Ga2nLCzCfHXnxoCnHcY6GB2CiWFUyJ5XIju6yhOIZdBGhZEAyIL2h7mMdtU2pOU9QoVw d85Ji4RFbbTlwQzECsK7tkKPZdGMrOhlIxvebE4vVNoPXt+Eiu6q0PO+WunknDsjYP+F JNiB56aCXJ780N9jNF6m7r2kLY3RkKfEusvEwFzaAfd83BQ8zD9LAZETpsqNL9gPabxB 3qRIgPLMASNR0zXybx6uA2Dyk8AZ5/GWBMThjk8ds4EQiq+FeSuhtZKUA8Ds6iTB11jy doRw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=N90eSiQZQ9Rw6rv+oGOPQSdJWrYcFrdTKUp7wCg7vz0=; b=hyHF9VjdNgPQJ+aaxwqrAdLRCx3IY1ajCGOP7lMWMYWN3BmTQ/CUWt7uq59fx5TamK PWMcNKT8rUnr6UYXEPkUclaFxc00f/dRS7545iyJTzU3hGunqRrhmf5RLVvETBzYPZ/7 C++60dRnLxVUk1GwWzl6u8mcmfT7KdImqfYSS9asnGFc6W2q5IjSJJTclhZg+Af6PS7T MPNb5jybFOxprcvQbNaPsAu32WHzriljPjOdejSYKfGshmmpB+7e/TFCK/FupwysXy1N +7IeqahEn1ljY7qSZH4sbtWRndNVBjBiYDpqV7JgMZx9VeQjTuG8hwNhF+Td7LVXNuyR n7Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="l0LX/RQX"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m20si12794424edq.33.2020.10.12.12.03.46; Mon, 12 Oct 2020 12:04:22 -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=@kernel.org header.s=default header.b="l0LX/RQX"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730804AbgJLTCm (ORCPT + 99 others); Mon, 12 Oct 2020 15:02:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:51990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727320AbgJLTCm (ORCPT ); Mon, 12 Oct 2020 15:02:42 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 459772067C; Mon, 12 Oct 2020 19:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602529362; bh=6yTxjcYLL3KprZZN6IEMWOR5I1ln8xYAUZsUeCw9yWE=; h=From:To:Cc:Subject:Date:From; b=l0LX/RQXhyddGTmyEmIEHwgzE98t6LOeDYu9AziudKj7ANDN8f8jSc/y/ArNarZwu Leu+9Lhpo4zJeuwqg+IKMfr8F6wRGzDcI+XlDu9yJI0TKH8KFVvVskX1hzDYP326NE 6BXrUZCGoXJSTkpASpzX1+FbLhZ/xRTWLoQqqRlo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hauke Mehrtens , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Date: Mon, 12 Oct 2020 15:02:16 -0400 Message-Id: <20201012190239.3279198-1-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hauke Mehrtens [ Upstream commit f9317ae5523f99999fb54c513ebabbb2bc887ddf ] The TX DMA channel data is accessed by the xrx200_start_xmit() and the xrx200_tx_housekeeping() function from different threads. Make sure the accesses are synchronized by acquiring the netif_tx_lock() in the xrx200_tx_housekeeping() function too. This lock is acquired by the kernel before calling xrx200_start_xmit(). Signed-off-by: Hauke Mehrtens Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/lantiq_xrx200.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c index 635ff3a5dcfb3..51ed8a54d3801 100644 --- a/drivers/net/ethernet/lantiq_xrx200.c +++ b/drivers/net/ethernet/lantiq_xrx200.c @@ -245,6 +245,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget) int pkts = 0; int bytes = 0; + netif_tx_lock(net_dev); while (pkts < budget) { struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->tx_free]; @@ -268,6 +269,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget) net_dev->stats.tx_bytes += bytes; netdev_completed_queue(ch->priv->net_dev, pkts, bytes); + netif_tx_unlock(net_dev); if (netif_queue_stopped(net_dev)) netif_wake_queue(net_dev); -- 2.25.1