Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1176822pxb; Fri, 20 Nov 2020 03:13:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyh/b6PtPcDbtcd2ije3xadsAntNqlhGaRFPoAFn2aUfxyx98+Bf/cvOWEWRvqp6RdoRDBy X-Received: by 2002:a50:da88:: with SMTP id q8mr7159243edj.174.1605870789381; Fri, 20 Nov 2020 03:13:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605870789; cv=none; d=google.com; s=arc-20160816; b=Y4JR422Q2IxQHra50mCMybGrr+iR+dTwLZUL41mC1pQJt7uXpsLLkitYvDfkSgqXrt ibf5KqWXznHT3ihDAMPq2zGzZMylfRYqp06NxwKCELpdLrS2E1aGU899Q3FIL6gSB1Uz 2BVG2dftmt3OHk+jVsQIE1C8wttQJFMdX//+mrMbFIHQbjyUVofXEfXrrSZjEc6KuupN b+aLO+hme1lvzcFZnJdAvKAOai9LBmMB7Lo2ddUlwEj+WBV+tEzULeuqvC8QixeQ2pQP TZuOUmkmWr+J4h0Tbvs9wb77mk8V2nq46mj+7NeSC4lvV7n+9ExYJ8f5QknbJX+ohEm5 RFMw== 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=bXAC+5+1efnqFBFMfVD0fpGba2JfL8C40CsxhvYW6Lw=; b=NRNFVXk2sS3/fvp+dMmw4QcSBs1vcJdBXOFqNMnSGXFtIcu7TE6oZ91q0c0Ji21uo/ pDHgpGtOMXen677iMcp5FzGEZuTA90DaBXrn2+I7ayK1fRgcXqEhW5MHKTnzrC8FXMLC IbBQ6vuQh22PBZ5aoxcVB9FkNNym7zu0+JGYUl4xaIuKtuCGeGl3CrQzSibYFf8FeGaB wAZ0/Suo5sN6CHg6DiHVrZxIhnEaUlNTTwFlRtib8tvejhm3bc3MVY6DYmAuO+Ha/UjL IKCk8pY1jSX3r6/atnu9gPzUY3k+XculhWwOxYFfQ7ivbzPXIWbTx52arR3M3LdZC+Ko e7Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dMJP2IzJ; 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 o10si1485710ejg.80.2020.11.20.03.12.46; Fri, 20 Nov 2020 03:13:09 -0800 (PST) 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=dMJP2IzJ; 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 S1728186AbgKTLI7 (ORCPT + 99 others); Fri, 20 Nov 2020 06:08:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:55314 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728525AbgKTLHS (ORCPT ); Fri, 20 Nov 2020 06:07:18 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 75B692222F; Fri, 20 Nov 2020 11:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1605870438; bh=AwnE7xEz1lJBYgJlzvghGvyh64+67dao3smLqtQOII8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dMJP2IzJxUiuTOzh0YRcKUSANNmWky2bELm95Ltt5TXlxl/2YnF1Vtfk3hdjg8ErN udRB2KDdHIt4rvZTg2AZKWkfIwuzqT19l32K/D/4NX7+lR1VjjNoGMIcib4RilG79K WwKBkX+UbtzewIPS0YQkVQN97siQ2g0PpYslUBTU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens , "David S. Miller" Subject: [PATCH 5.4 12/17] net: lantiq: Add locking for TX DMA channel Date: Fri, 20 Nov 2020 12:03:39 +0100 Message-Id: <20201120104541.666105796@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201120104541.058449969@linuxfoundation.org> References: <20201120104541.058449969@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: Hauke Mehrtens commit f9317ae5523f99999fb54c513ebabbb2bc887ddf upstream. 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: Greg Kroah-Hartman --- drivers/net/ethernet/lantiq_xrx200.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/lantiq_xrx200.c +++ b/drivers/net/ethernet/lantiq_xrx200.c @@ -245,6 +245,7 @@ static int xrx200_tx_housekeeping(struct 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 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);