Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2176071ybg; Fri, 5 Jun 2020 07:27:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaY5CQraNUMpLqtZ1ywpQzSHokTEWROJJBl5v872mwBEjqoRv8+V4FPtiz7OChR2K7xBP/ X-Received: by 2002:a17:906:1558:: with SMTP id c24mr8857205ejd.48.1591367275011; Fri, 05 Jun 2020 07:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591367275; cv=none; d=google.com; s=arc-20160816; b=SqFk6eO7FTP/lNEOBYGYaVEs7f//9eeaoMFZ0q1RUTHqTNbmuJxMx1t6bPKF7Y1XwM YQN5fjmOWZ0HRr3Xh7wen5MCBJ7UOuZJwXIT1Nbpdp5uIYHNw4zecU971DKSaKVt47m0 hVaMN08Gz9UIIf/ft3S8MNChdvXFV7w6u9KweD+T4ZeUq0qQzWcQCU5zKF7BVbrlFc9w SSPOdCdMfHvl/i1hB508LPb/mSUbipQF/AmJjIJWdBcGyOHO+MclKgXEu0g9kRDwrPI/ YrLjftuK0Pk6YQTHp8SOknXcDz1TWwE7EN/ADyecdoWC+7+aaQdy2WEQYKVLn2XbcDwf 9ETw== 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=1k7yxiGBgEOz7LI0NeMyea8q3/wDJX108sm/NZQrV54=; b=vWJdqG2MdXVlKKKH0iMaxHU+lIJCXM079AQ9vdUNwvTmQvDT9UTX7BPmdeax2S2uH8 Yg+utBUGqbyaEt5dImPBu6WXBUgquSaubJ6TMRryJF5RYsoW5bVqovhTCp/V6xbVgs/D tjoIiNk7hYGY5W5lGrSxvEiV/uTCtnqQzrRWSAKvhjNY9immdNbIL5639FW0S3lmm7PN 1TugcHnwr4TVrGABEDYJuUZ+8IaWhU+Bl/jUJ1wX01OAxoQ9+Z/jiqaQgrmqe64227d3 JCPktThhaIUZfcZq1Km0X1abextozSS9xLOYHbh/Ua2B29TmfhDFIaZLEXPBePg4Roxk T9DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DCqEhtkl; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si2522026edr.463.2020.06.05.07.27.31; Fri, 05 Jun 2020 07:27:54 -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=DCqEhtkl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728765AbgFEOY7 (ORCPT + 99 others); Fri, 5 Jun 2020 10:24:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:46262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728364AbgFEORA (ORCPT ); Fri, 5 Jun 2020 10:17:00 -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 CCF28206A2; Fri, 5 Jun 2020 14:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591366619; bh=K7lgPnmnyd9zaQE8Biv09xlGJPFmPcPUvqaqpNNNsKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCqEhtklUEc7a2CUP9F8iqd21F1eb5dT8K8L0anlZ+Vqh9D9kSubcMWztXm5wiwBu dBf37rrjw8Uq+Ga+h7v3EXHefk4vbOBTPH1uRpm7cTPetbvFhDFU907QkS+b1iH5Bi sbP7j3dqG1J+w6br79T8JxsApVbdBYd6MjYUgFPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Valentin Longchamp , Matteo Ghidoni , "David S. Miller" , Sasha Levin Subject: [PATCH 5.6 26/43] net/ethernet/freescale: rework quiesce/activate for ucc_geth Date: Fri, 5 Jun 2020 16:14:56 +0200 Message-Id: <20200605140153.894270623@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200605140152.493743366@linuxfoundation.org> References: <20200605140152.493743366@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 From: Valentin Longchamp [ Upstream commit 79dde73cf9bcf1dd317a2667f78b758e9fe139ed ] ugeth_quiesce/activate are used to halt the controller when there is a link change that requires to reconfigure the mac. The previous implementation called netif_device_detach(). This however causes the initial activation of the netdevice to fail precisely because it's detached. For details, see [1]. A possible workaround was the revert of commit net: linkwatch: add check for netdevice being present to linkwatch_do_dev However, the check introduced in the above commit is correct and shall be kept. The netif_device_detach() is thus replaced with netif_tx_stop_all_queues() that prevents any tranmission. This allows to perform mac config change required by the link change, without detaching the corresponding netdevice and thus not preventing its initial activation. [1] https://lists.openwall.net/netdev/2020/01/08/201 Signed-off-by: Valentin Longchamp Acked-by: Matteo Ghidoni Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/ucc_geth.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 0d101c00286f..ab1b4a77b4a3 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -42,6 +42,7 @@ #include #include #include +#include #include "ucc_geth.h" @@ -1548,11 +1549,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode) static void ugeth_quiesce(struct ucc_geth_private *ugeth) { - /* Prevent any further xmits, plus detach the device. */ - netif_device_detach(ugeth->ndev); - - /* Wait for any current xmits to finish. */ - netif_tx_disable(ugeth->ndev); + /* Prevent any further xmits */ + netif_tx_stop_all_queues(ugeth->ndev); /* Disable the interrupt to avoid NAPI rescheduling. */ disable_irq(ugeth->ug_info->uf_info.irq); @@ -1565,7 +1563,10 @@ static void ugeth_activate(struct ucc_geth_private *ugeth) { napi_enable(&ugeth->napi); enable_irq(ugeth->ug_info->uf_info.irq); - netif_device_attach(ugeth->ndev); + + /* allow to xmit again */ + netif_tx_wake_all_queues(ugeth->ndev); + __netdev_watchdog_up(ugeth->ndev); } /* Called every time the controller might need to be made -- 2.25.1