Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp32927lqs; Thu, 13 Jun 2024 02:59:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQ58A3yZpa3QTbfG4QZkyzg34CVBs6I9Ce7ZM+4Z9g22a9H5Ww4CRUSmuXa03DNJrAyhCj5AWIvDB21yXef+tr5G9QHL8v59ng0CNZqA== X-Google-Smtp-Source: AGHT+IGeIa99F6hjGM3OV43Y0pgZJSeFqMqrzyehnymArJuXk8gzig79+Jgvr0BBFVOEK+sdnQck X-Received: by 2002:a05:6214:5b0e:b0:6ab:9619:a806 with SMTP id 6a1803df08f44-6b1a722615fmr54136686d6.62.1718272773870; Thu, 13 Jun 2024 02:59:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718272773; cv=pass; d=google.com; s=arc-20160816; b=krR3JWBx0brAKq9Io0jOOC2WGFhhDYQ3ZXYyBDXGipDRwiWHw8RlVgASPaoZRb39T9 gJx1Yb+/6k7+LL5oZJkE+njN+yr6pBTlFbgGJVCCFfkkd6d4GWCfSiNahLKmzOIhyrYU i1GySGE9wIiY/pSeCwBcvYO4MjLw4L+CulcmiOVb8ff2CyWMVE+PQ8IxvSlqKrs/6p9C FrpiV/G3q+lXUWiwXsGFmV6/Xu2fckYRysRJG4b8vq+mufnf2rSiMQnqu21bx0+iv07Z jI1HrG4OZrKwJ3IyD1rY9gKOdAiJHCPPjT6TIajCvsGBCqLWMLRHO5JrP4+Ut0hgsSmL 5Blw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=V8U7PlezzDV+xaQgoC4Cin990sme5WLS2JK3q11wSEk=; fh=CfYQZuVL2RRqk2o9T4txHnTV7Cqkax2nANmf55Z7WPc=; b=RVRrySviAkqq33rWu5cepSpg+Bo3AA7+Vj2VahgE28TeDpfGHONIpDJkeayFyDztVQ UeLRf93vNWajFiAlnHJgLRNB34cktLir7BCVSq5XHd6edkIEk4h5T6nwzbccUEYzQXVa RmVCxQlkeu3R+7DAZ/teirpVAIc5UFfPbPkCb78aXXBfS1Y0MpykQz1VE1fiHyHdAwXN 586LC8cAGgHuNRyLhHBIrhuJzS/fPmIwPzyK5rrxfF1DlH7m854rL8L7FOcgR0syD92o DMYj8Rr8UE+TZbtoM0bDeuuIl1R7JsGuwZKI/A/8/QVr80GNo2rfdqkdu2RnMuZ61TiM LzqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VDSuFkkB; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-212992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212992-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-441ef3bb15bsi10858641cf.63.2024.06.13.02.59.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 02:59:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VDSuFkkB; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-212992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212992-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7F2631C22AFE for ; Thu, 13 Jun 2024 09:59:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8C831411F6; Thu, 13 Jun 2024 09:59:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VDSuFkkB" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D3301411C0 for ; Thu, 13 Jun 2024 09:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718272760; cv=none; b=L/CRjogGkQ4HQ5ntPRIeirQxPewN058/SkcMIBNqQQ45lOXWxF6xclcAt9A+t6yJzSZluNnGI9u8rzD9TlxLEuVtgLgB3Nw2DMLvp0avRsZznRJ45zOSA5brvLdNzz14RKEVWmlVDklnG1Rae4fNblbHNHpzSU4BqEbgwmgPd0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718272760; c=relaxed/simple; bh=jCiq080FY8/GLZ3f85CnJwt8lnALYICND+Kr+0wWgCE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XeqEWj6eyddZ0r1oSP5HTnpC/QEzsK9BNfPsM92Qq4u+rgQgpzEG4WBEjM8YF1VnWZTRdI53Tuy5nJE8YO3h8jXKxfpeyOd0FUATw/ZsaMP7/YRxbbozzCfUJy6fzrzRwWrVr2Gya1Tlgv5oa6PSgb7HYhZ4yBL2qDIadFTrfLw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VDSuFkkB; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718272757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V8U7PlezzDV+xaQgoC4Cin990sme5WLS2JK3q11wSEk=; b=VDSuFkkBbd5EVen6sP7gfCOBXtuE3sCAaWIEcBaEsdJql7Z6+r5rbadP3KEqQ1shu8PQ28 RYWrBqalsOAsNcow4qjMDCUMgrJCYM3VW+yOU9uqe9t8MJeWkV5jdH50R1z1PkIvHpaHME uQHK6hL6/r+EVsewBuB9sqpI7Lp7Ehw= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-463-0TgEbf4qMsuYAn4dE498RQ-1; Thu, 13 Jun 2024 05:59:11 -0400 X-MC-Unique: 0TgEbf4qMsuYAn4dE498RQ-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5510019560B5; Thu, 13 Jun 2024 09:59:09 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.192.157]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E389A19560AA; Thu, 13 Jun 2024 09:59:02 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: yongqin.liu@linaro.org Cc: amit.pundir@linaro.org, davem@davemloft.net, edumazet@google.com, inventor500@vivaldi.net, jstultz@google.com, jtornosm@redhat.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, stable@vger.kernel.org, sumit.semwal@linaro.org Subject: Re: [PATCH] net: usb: ax88179_178a: fix link status when link is set to down/up Date: Thu, 13 Jun 2024 11:59:00 +0200 Message-ID: <20240613095901.508753-1-jtornosm@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Hello again, There was a problem copying the patch, sorry, here the good one: $ git diff drivers/net/usb/ax88179_178a.c diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 51c295e1e823..60357796be99 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -174,7 +174,6 @@ struct ax88179_data { u32 wol_supported; u32 wolopts; u8 disconnecting; - u8 initialized; }; struct ax88179_int_data { @@ -327,7 +326,8 @@ static void ax88179_status(struct usbnet *dev, struct urb *urb) if (netif_carrier_ok(dev->net) != link) { usbnet_link_change(dev, link, 1); - netdev_info(dev->net, "ax88179 - Link status is: %d\n", link); + if (!link) + netdev_info(dev->net, "ax88179 - Link status is: %d\n", link); } } @@ -1543,6 +1543,7 @@ static int ax88179_link_reset(struct usbnet *dev) GMII_PHY_PHYSR, 2, &tmp16); if (!(tmp16 & GMII_PHY_PHYSR_LINK)) { + netdev_info(dev->net, "ax88179 - Link status is: 0\n"); return 0; } else if (GMII_PHY_PHYSR_GIGA == (tmp16 & GMII_PHY_PHYSR_SMASK)) { mode |= AX_MEDIUM_GIGAMODE | AX_MEDIUM_EN_125MHZ; @@ -1580,6 +1581,8 @@ static int ax88179_link_reset(struct usbnet *dev) netif_carrier_on(dev->net); + netdev_info(dev->net, "ax88179 - Link status is: 1\n"); + return 0; } @@ -1678,12 +1681,21 @@ static int ax88179_reset(struct usbnet *dev) static int ax88179_net_reset(struct usbnet *dev) { - struct ax88179_data *ax179_data = dev->driver_priv; + u16 tmp16; - if (ax179_data->initialized) + ax88179_read_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PHYSR, + 2, &tmp16); + if (tmp16) { + ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, + 2, 2, &tmp16); + if (!(tmp16 & AX_MEDIUM_RECEIVE_EN)) { + tmp16 |= AX_MEDIUM_RECEIVE_EN; + ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, + 2, 2, &tmp16); + } + } else { ax88179_reset(dev); - else - ax179_data->initialized = 1; + } return 0; } Best regards José Ignacio