Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3931514imm; Mon, 8 Oct 2018 11:53:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV61WBK4UkpIsumcbkwwlPCetxXuyCTia51BuNmJbMY3idw4Mki4ZLiPrqcb18/oN3VjMx3aC X-Received: by 2002:a62:9316:: with SMTP id b22-v6mr27217063pfe.193.1539024830429; Mon, 08 Oct 2018 11:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024830; cv=none; d=google.com; s=arc-20160816; b=nT0bjGsdpKTC0qCJVl6s5+rf2VFhlm4neiLcO16/61ZcjSp8z9lzF/GDo/M8GcostF IpLdI9vGggh3gSLsR4eyyWqmwPNJtRtyLLxiCgADYwnG3vCsyvBPfwfxdnyWTXyvMgLk sk0RJzZYzlNBUEBHuIn4B7PkpzTJnGlmkfmgdz64WQ2bjQn60C72AbEe2KP2SLz6XkfV Nsw7CKiQqEZt6qnbVhwZbGXHtiqbz+vp4l7VKeRHIb1cYiJp80XjMVBUH9ISqtSbPNVK F5Jq0UlVWJABfTs4AOJZeMp5hVwyChW23DC1ymahmhi7jxZistuxx4Y3ZSAjKuHM0lcz MGKQ== 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=Q+UgLkGO+VwJtgGAcYUS31e10vWB/NTltIZa2Ezm0eE=; b=LpYFw1md/5PunCKRdrXrA/JipHAIajnPPEdqkr5paga4K16iyt9JvGLPvZtq6QxvMl T3lQRASPmwj45YYNS1X9l5VSxrQudqcDGf+PTW70WknXLqVvaxeEsXbORlHmQy6DxShn opqmvMK2a7q87aNjYApo3mDnKOieKlS83VwaH54aa1rzS2DS5+Dmfq7shQhTaYUiOpaD T1+gfe8WLX7v37FncL5qKGXWIWFWShC8hTRwNKJ+eJqkwclzELM+Cu1Tyh94sFCHcVo9 NwVNyQSMmcLarWL3p4XkKbh5jJrnGF5eTatYOEaVio8z8o49IWvagOPEyVtEYbkHstot 4mCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kmoRpXeH; 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 i1-v6si17762921plt.108.2018.10.08.11.53.35; Mon, 08 Oct 2018 11:53:50 -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=kmoRpXeH; 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 S1732485AbeJICFW (ORCPT + 99 others); Mon, 8 Oct 2018 22:05:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:55440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeJICFV (ORCPT ); Mon, 8 Oct 2018 22:05:21 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 D4B9E204FD; Mon, 8 Oct 2018 18:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024733; bh=ZGLeUoSIdlstDFOq913PAqi3s+zKbEGUB30kPmvmCU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kmoRpXeHAsPnINHbAJKawXPNVnbIxV1ZGEVIUpoFYvwxGd4zId6mI4NlOdMLLTEcP T5lckRnB0ibudsSmBXxfdc7OPt6vqiKJJR4rmFek1fio1VdRENNhCUot+GwFk6IXkK A27dEb+abSP9L03P6+SJ0TlFQ1D1yGUCFR1L3i4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Kai-Heng Feng , "David S. Miller" , Sasha Levin Subject: [PATCH 4.18 135/168] r8169: Clear RTL_FLAG_TASK_*_PENDING when clearing RTL_FLAG_TASK_ENABLED Date: Mon, 8 Oct 2018 20:31:55 +0200 Message-Id: <20181008175625.179848954@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kai-Heng Feng [ Upstream commit 6ad569019999300afd8e614d296fdc356550b77f ] After system suspend, sometimes the r8169 doesn't work when ethernet cable gets pluggued. This issue happens because rtl_reset_work() doesn't get called from rtl8169_runtime_resume(), after system suspend. In rtl_task(), RTL_FLAG_TASK_* only gets cleared if this condition is met: if (!netif_running(dev) || !test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags)) ... If RTL_FLAG_TASK_ENABLED was cleared during system suspend while RTL_FLAG_TASK_RESET_PENDING was set, the next rtl_schedule_task() won't schedule task as the flag is still there. So in addition to clearing RTL_FLAG_TASK_ENABLED, also clears other flags. Cc: Heiner Kallweit Signed-off-by: Kai-Heng Feng Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/realtek/r8169.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -730,7 +730,7 @@ struct rtl8169_tc_offsets { }; enum rtl_flag { - RTL_FLAG_TASK_ENABLED, + RTL_FLAG_TASK_ENABLED = 0, RTL_FLAG_TASK_SLOW_PENDING, RTL_FLAG_TASK_RESET_PENDING, RTL_FLAG_TASK_PHY_PENDING, @@ -7125,7 +7125,8 @@ static int rtl8169_close(struct net_devi rtl8169_update_counters(tp); rtl_lock_work(tp); - clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags); + /* Clear all task flags */ + bitmap_zero(tp->wk.flags, RTL_FLAG_MAX); rtl8169_down(dev); rtl_unlock_work(tp); @@ -7301,7 +7302,9 @@ static void rtl8169_net_suspend(struct n rtl_lock_work(tp); napi_disable(&tp->napi); - clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags); + /* Clear all task flags */ + bitmap_zero(tp->wk.flags, RTL_FLAG_MAX); + rtl_unlock_work(tp); rtl_pll_power_down(tp);