Received: by 10.223.176.5 with SMTP id f5csp476615wra; Fri, 2 Feb 2018 00:45:49 -0800 (PST) X-Google-Smtp-Source: AH8x226DpQqGzXQA84S4qqO/Z2NMyunsZz1I8Xn8uFig4pUg89KdEf/AdB6+8hy1O/D+ps7+QfNi X-Received: by 10.98.112.4 with SMTP id l4mr39246836pfc.8.1517561149259; Fri, 02 Feb 2018 00:45:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517561149; cv=none; d=google.com; s=arc-20160816; b=JhOUgKpSD3WFXZIopAFcB4B4M48rffdQ6BR6Ro5hH5ttJZLuNIrOJ30D5QjxTtXs3q d/ABSHF63UrYjlLNvEkcvci6/lAsHZst5P8v+BdFA9AauATUWl2BWA1ZFNIVddogEWtm /HBXSEt+q553ypb/0PXGb84sSDnUufMTT5Gz4l9I9BmK3aRcl5W+qAS0cGuOFIuWOelz Vz5YjkFsvf6+lF8CUE0roBferxuoVLbSTBJiSKCEjwecLa8ZwVHJSU3iZ11fAtcqdX87 ilydH/gycMR0g/RfqVOCHRXdwhMlQLYVGLgeQCLjhoqNRnIk5V2aHYN7WooG8heyxeOJ KHrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by :arc-authentication-results; bh=PE+Ws93hP0vzEc05OBiuhDVbxdfS1UC67BYr7VpLZ0A=; b=L4fiDTqL1k71XI8rGxnPTMs5tVzyOYQizg8NWmh3Jlok41WhOvIi4XBiGzjofEiIe1 tB56vRh2/UbS8u0c/5n2JCDZTMG1z4lw4mSfvtVw9KY6pgiAJy0/vNg884Cfm7dr+vpW i0I2zswbG4t2/O+FZPS6pV2aqMZ1Ja/nZZZuSHe5M1uwNJh2pIITNuIS+YWELh5bNPSh 11e41sRh7CXFA8sDjROF+uTGTl0m7Gca1uymh4npVhKxbF2p2Egfqj+cjx4KWFnoEkay 264DAjjhBh+Q2idCYUbSiBYUcldgel6M/jPSG5rEEfysMGFOo1VSJlvnnKMSA2wDcDUZ Io/A== ARC-Authentication-Results: i=1; mx.google.com; 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 i9si1089415pgq.0.2018.02.02.00.45.34; Fri, 02 Feb 2018 00:45:49 -0800 (PST) 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; 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 S1751984AbeBBIo1 (ORCPT + 99 others); Fri, 2 Feb 2018 03:44:27 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:46693 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751881AbeBBIoG (ORCPT ); Fri, 2 Feb 2018 03:44:06 -0500 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID w128i4F6023494, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw [172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTP id w128i4F6023494; Fri, 2 Feb 2018 16:44:04 +0800 Received: from fc26.localdomain (172.21.177.200) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.294.0; Fri, 2 Feb 2018 16:44:03 +0800 From: Hayes Wang To: CC: , , , Hayes Wang Subject: [PATCH net 2/2] r8152: set rx mode early when linking on Date: Fri, 2 Feb 2018 16:43:36 +0800 Message-ID: <1394712342-15778-285-albertk@realtek.com> X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1394712342-15778-283-albertk@realtek.com> References: <1394712342-15778-283-albertk@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.177.200] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set rx mode before calling netif_wake_queue() when linking on to avoid the device missing the receiving packets. The transmission may start after calling netif_wake_queue(), and the packets of resopnse may reach before calling rtl8152_set_rx_mode() which let the device could receive packets. Then, the packets of response would be missed. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 756de9ea8d2e..958b2e8b90f6 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -3795,11 +3795,12 @@ static void set_carrier(struct r8152 *tp) if (speed & LINK_STATUS) { if (!netif_carrier_ok(netdev)) { tp->rtl_ops.enable(tp); - set_bit(RTL8152_SET_RX_MODE, &tp->flags); netif_stop_queue(netdev); napi_disable(napi); netif_carrier_on(netdev); rtl_start_rx(tp); + clear_bit(RTL8152_SET_RX_MODE, &tp->flags); + _rtl8152_set_rx_mode(netdev); napi_enable(&tp->napi); netif_wake_queue(netdev); netif_info(tp, link, netdev, "carrier on\n"); @@ -4259,7 +4260,7 @@ static int rtl8152_post_reset(struct usb_interface *intf) mutex_lock(&tp->control); tp->rtl_ops.enable(tp); rtl_start_rx(tp); - rtl8152_set_rx_mode(netdev); + _rtl8152_set_rx_mode(netdev); mutex_unlock(&tp->control); } -- 2.13.6