Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp482606lqb; Wed, 17 Apr 2024 02:08:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX0KOV6rYwmc9z8ki24WJTTPRN2IZf9VExfflavmXF5kGVbLrZie1Vx1qZk9G1gI+iUOw7bFl8XaCQSEnLumvHJMmf/dqFB9QB9hs1UJg== X-Google-Smtp-Source: AGHT+IEpF613mm3O9I6Bmox4jQE6jqGrEFPBlHlwRkwVKp/fNXHRM5+n17pgPmuxi2891MxfS2+z X-Received: by 2002:a17:907:2da8:b0:a51:895c:6820 with SMTP id gt40-20020a1709072da800b00a51895c6820mr10965766ejc.44.1713344936516; Wed, 17 Apr 2024 02:08:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713344936; cv=pass; d=google.com; s=arc-20160816; b=OB+WuiNz6qFLnXNKypXCImeaEGT2HEM+lFqKXyvWBu5YjAYxfVmaAPnJnoxPEd+W9H /tUNUI5Enxwu6vQXNOF1AAEbmQUm8qwCaKvm5l86Y9PIGdjcTGMv11qovQiiM4wZ4yne u9fckcJIcTZj7FDqR/SmTJ8ZQ2WlGGm+6e4IRXfSKPHROsN2co6l0St42vl0ZX/tRZns Rhw1Z68JUdiuH2in/e5PQwNO1u8m/mSAWttsA9B0fORxfV67EDQ2hV9o0q2mfZEoi9UC +8GUzb3l8MkOc11P7BVN3nm3TpHEMJQt9Yv0W1ddZdvntuRShvFn/Z8BE1bXX6i1xIJA /6hg== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=pQ0sSQeAADn6AXaSn6AcvMvh/Ro6ED1iNBV8xbxjGO0=; fh=f5Vnk53/NZ0UgQJCtEPK4GyUNmPXYlSmp2p83BAiFRM=; b=H6n0CqB113L8xHtnUD2so8DIJtdrBHxtC86XTD/qXuj0SjRR+dn2SYSCjJIhFCB0XM LUqmjbZSMUhCgCQBKCM/IXfBveyjBIuZhHQ+9fbW7mDoVQiLAnWbmBJiWnaJGzDgzJHS ArVlEw2urBh4HfhJE3MIcpgzTauqVKadgICysGJEq4zkCuzSwguqzTVf1ZyKqNrwI3/9 biik4zEwIuLmYzC4r3itdFc8VOJVewdRpWqlKst7jdeY3umIzbxvaWRmNWYRQ6YT45EX wAsacmvsocUT1GRwMYIc6prPbOBPFG0cm5IJW2zf3ZNWchdnToxmJx6V94WMHzQU2nEQ TTsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RlDwOV5Q; 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-148193-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148193-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id sa41-20020a1709076d2900b00a51dec152b0si6820936ejc.355.2024.04.17.02.08.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 02:08:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148193-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RlDwOV5Q; 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-148193-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148193-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 05CFE1F25A0B for ; Wed, 17 Apr 2024 08:59:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D06A13D507; Wed, 17 Apr 2024 08:55:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RlDwOV5Q" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 69F8212C490 for ; Wed, 17 Apr 2024 08:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713344147; cv=none; b=WG+jb2AYcc0WKMihpm19k6IGBVJYESxZA1/OkQAGjrxBd9YPItG66X148uFjLKjVd8VzClZiyDDCgylWGUdFswsvBwczg6HfFu3iCsiBYqkCqbiziJ4HgtktUBjMJcfvPrnIyYoHNyRV1fKHLE/EjnmxuPGHUhwtdgK965fBijc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713344147; c=relaxed/simple; bh=3KtL8v+/z1deeegmlCslJhNyGqs44qnUNBL+H3cQXis=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QkT+0+0ejjUoeUDcBIVSD2UhYIgAX39xhQhNA+Ht7+9TK1efBH9xvnMvdJzMlaPO4kfh5kdJXFlrQOSL0dwgUuY6QrjVHrNFYc0J0ICjp5to02Pf4zd/wVBbWpTP40QtYp5JKSCPIGRIvAzxS35SEYTqSatwc9sE6ES3nfPLP3g= 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=RlDwOV5Q; arc=none smtp.client-ip=170.10.133.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=1713344144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=pQ0sSQeAADn6AXaSn6AcvMvh/Ro6ED1iNBV8xbxjGO0=; b=RlDwOV5Q0pikQTd5DbFPSfL3mHtefBxDkFqfKiwtowtcnU8oQ0NppDpI48SShwcHABsXkr M3jVXZstG7NNASdvPEBU+Fy0HQvEoQhNE1fRX2xWGQDP+XllzalZAfgM0MQZ0ZmT6T/lpW rXGWel4L4c1SALE6CkOuCFWq02WE1SU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-512-VBJASLQmOlWdBbek0Y9VbQ-1; Wed, 17 Apr 2024 04:55:39 -0400 X-MC-Unique: VBJASLQmOlWdBbek0Y9VbQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id ABD9C1C4C394; Wed, 17 Apr 2024 08:55:38 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.193.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F55A492BC7; Wed, 17 Apr 2024 08:55:36 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jose Ignacio Tornos Martinez , stable@vger.kernel.org, Jarkko Palviainen Subject: [PATCH v2] net: usb: ax88179_178a: avoid writing the mac address before first reading Date: Wed, 17 Apr 2024 10:55:13 +0200 Message-ID: <20240417085524.219532-1-jtornosm@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 After the commit d2689b6a86b9 ("net: usb: ax88179_178a: avoid two consecutive device resets"), reset operation, in which the default mac address from the device is read, is not executed from bind operation and the random address, that is pregenerated just in case, is direclty written the first time in the device, so the default one from the device is not even read. This writing is not dangerous because is volatile and the default mac address is not missed. In order to avoid this and keep the simplification to have only one reset and reduce the delays, restore the reset from bind operation and remove the reset that is commanded from open operation. The behavior is the same but everything is ready for usbnet_probe. Tested with ASIX AX88179 USB Gigabit Ethernet devices. Restore the old behavior for the rest of possible devices because I don't have the hardware to test. cc: stable@vger.kernel.org # 6.6+ Fixes: d2689b6a86b9 ("net: usb: ax88179_178a: avoid two consecutive device resets") Reported-by: Jarkko Palviainen Signed-off-by: Jose Ignacio Tornos Martinez --- v2: - Restore reset from bind operation to avoid problems with usbnet_probe. v1: https://lore.kernel.org/netdev/20240410095603.502566-1-jtornosm@redhat.com/ drivers/net/usb/ax88179_178a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 69169842fa2f..a493fde1af3f 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1316,6 +1316,8 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) netif_set_tso_max_size(dev->net, 16384); + ax88179_reset(dev); + return 0; } @@ -1694,7 +1696,6 @@ static const struct driver_info ax88179_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1707,7 +1708,6 @@ static const struct driver_info ax88178a_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, -- 2.44.0