Message ID | 20221122152630.76190-1-akihiko.odaki@daynix.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2282728wrr; Tue, 22 Nov 2022 07:37:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf65p7xW+BuesOo6rcuZuCyRcNz5JgeBahY02JQoZ0gxTGwzF8WFwl/fgd3ey+DD1OK306Uc X-Received: by 2002:a05:6402:5007:b0:44e:baab:54e7 with SMTP id p7-20020a056402500700b0044ebaab54e7mr4676724eda.265.1669131471896; Tue, 22 Nov 2022 07:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669131471; cv=none; d=google.com; s=arc-20160816; b=TH9pM/FbXO1NRW5zdM6IZkcQFeuNyxVxrGa8GlpQKs5njPcEHvKpSuVozadAIi9fXz VHO4YreZpAQ0o/jt1hdHYZyyrwYlAvQAtcKuBBDRUg4kZUAtk+9VP+OMeBqzhc0T0VH7 ZjCaUFMgaV2pd3FgBquDvXapIj6tIZDf4coLkTqNbutYN+qewGYy8ra7ivS/J6DDapdE vfVLWbPdSZgLocQ6xdFiKtC9zpzls22DVHL+IL4M1+3lpPhf8vl9tA4QnIpoXVBY6ljq ixWOLj0ua8vL4HO14RRPoGWR7i9iqws+2LnxaPPyTuUIS+WFcRT1nw6oc4LpEj3dCaux VNQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=3eN8PG1tu0zv6ECYGZ0bUFaylUuOM6J9ZGH6Fn6kJHo=; b=qHnAgPO1NNV8MyQVZbbSDnbgMr10oy5wYcp5Eb8LLCRvqe88eWns4FEcH8r2YFnOTE TWNBOHjOeAupz+1Exac4Fh8giAs9dYAClID/tLQqY/1DpKD/DGnkXKxZ/Cl6h9Qr9qrg OF4L6GXJpE6/RSSjNMqmkKjF2hIAGbCGtdk45dyLnn6aX8Uhlnw69+L4/ILghSrvvGOj D8jWw7cQLheZ+voizOCrS1z3UqhHRZC8yc/2iB1PHXqXxb1ZR+w7cCzBPTbjgS8sybeN fkVGVLORktTZR3L1KKd1s5LRoWuLu3tIMpyuXyFMaXnzUGDYwHPd0zEDAO03kL8MResi rPnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=MF2ry8jC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020a056402195500b00461cdda451dsi11237826edz.435.2022.11.22.07.37.21; Tue, 22 Nov 2022 07:37:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=MF2ry8jC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233252AbiKVP1J (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Tue, 22 Nov 2022 10:27:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233996AbiKVP1B (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 22 Nov 2022 10:27:01 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6BB160E90 for <linux-kernel@vger.kernel.org>; Tue, 22 Nov 2022 07:27:00 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id b29so14650108pfp.13 for <linux-kernel@vger.kernel.org>; Tue, 22 Nov 2022 07:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3eN8PG1tu0zv6ECYGZ0bUFaylUuOM6J9ZGH6Fn6kJHo=; b=MF2ry8jCjEfJSczD2TlSQRhxgxw/769GkaMOON9oAkxuEIN97YK7PZjef+RkvUqmn6 c7AjFerXB1PJT2u2UzDPulK7aXgB17t38IkHEMHHKIogmM4cbG1WwJK6iglP6/5mXOrt JmUu/ADf6amE5NTKz6Npi0hz37SGswSnxd+WcFtY0rB4YMUuwQ2w+DwouTzl4kNxpGZr CrgSBr2d6j1OSLNtjFltNveJZwLExs/unNW9lRX31lK/abl95eV/kH0TDAvbWCtkhje9 EkbTVXMgxMLewSuaN4hKU4P4MDuGb074N7xhcU37E00p2MKSPiBCSK+7zoaWT6ce5axZ o2ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3eN8PG1tu0zv6ECYGZ0bUFaylUuOM6J9ZGH6Fn6kJHo=; b=7DNRiFcKn62eVJU/zYUJOP/LtFv+l03SGnFvSITL0Ar6810JPcBAvQ7Yty4swvxQ7R 11v1E8t7MzR8hcxGd45KxHDf0P7XiJUwv55xX1+Q9Z4S45hLcgt1KgkOBG0wQ30xGhQu 1EQoa2jDVDjhbXwZNN+GlocMQAyDoQQUSLetyOQeeOkJD+sXL1fgBlITs4e1UXx+fhiJ Unk6KV1N6AyfRc5VJwH6XEtwzcDK9n+DTnB+8uPIfjJWVelKX1Usts489CNY/DEAT3Dz 8JVqOEmwEOSvYfj0Q5ULLbDRI32cY3V3oxQbWfgiB2AfQMpL5IW1ndgI6ldQkq6Dbbu1 wNsw== X-Gm-Message-State: ANoB5pkATP4yAY3rq+M6zYmnJKzn3LTyg1rBUsP3ccoLSyNzurBG/d9C bfrcX5LMD03MOwo+yngLP7ibabxkaMx9qg== X-Received: by 2002:a62:5e41:0:b0:56b:db09:a235 with SMTP id s62-20020a625e41000000b0056bdb09a235mr6211427pfb.20.1669130820272; Tue, 22 Nov 2022 07:27:00 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m9-20020a170902f64900b00176d218889esm12161633plg.228.2022.11.22.07.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 07:26:59 -0800 (PST) From: Akihiko Odaki <akihiko.odaki@daynix.com> Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Yan Vugenfirer <yan@daynix.com>, Yuri Benditovich <yuri.benditovich@daynix.com>, Akihiko Odaki <akihiko.odaki@daynix.com> Subject: [PATCH v2] igbvf: Regard vf reset nack as success Date: Wed, 23 Nov 2022 00:26:30 +0900 Message-Id: <20221122152630.76190-1-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750211202455659884?= X-GMAIL-MSGID: =?utf-8?q?1750211202455659884?= |
Series |
[v2] igbvf: Regard vf reset nack as success
|
|
Commit Message
Akihiko Odaki
Nov. 22, 2022, 3:26 p.m. UTC
vf reset nack actually represents the reset operation itself is
performed but no address is assigned. Therefore, e1000_reset_hw_vf
should fill the "perm_addr" with the zero address and return success on
such an occasion. This prevents its callers in netdev.c from saying PF
still resetting, and instead allows them to correctly report that no
address is assigned.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
drivers/net/ethernet/intel/igbvf/vf.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
Comments
On Wed, Nov 23, 2022 at 12:26:30AM +0900, Akihiko Odaki wrote: > vf reset nack actually represents the reset operation itself is > performed but no address is assigned. Therefore, e1000_reset_hw_vf > should fill the "perm_addr" with the zero address and return success on > such an occasion. This prevents its callers in netdev.c from saying PF > still resetting, and instead allows them to correctly report that no > address is assigned. What's the v1->v2 diff? Probably route to net and add fixes tag? > > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> > --- > drivers/net/ethernet/intel/igbvf/vf.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/intel/igbvf/vf.c b/drivers/net/ethernet/intel/igbvf/vf.c > index b8ba3f94c363..2691ae2a8002 100644 > --- a/drivers/net/ethernet/intel/igbvf/vf.c > +++ b/drivers/net/ethernet/intel/igbvf/vf.c > @@ -1,6 +1,8 @@ > // SPDX-License-Identifier: GPL-2.0 > /* Copyright(c) 2009 - 2018 Intel Corporation. */ > > +#include <linux/etherdevice.h> > + > #include "vf.h" > > static s32 e1000_check_for_link_vf(struct e1000_hw *hw); > @@ -131,11 +133,18 @@ static s32 e1000_reset_hw_vf(struct e1000_hw *hw) > /* set our "perm_addr" based on info provided by PF */ > ret_val = mbx->ops.read_posted(hw, msgbuf, 3); > if (!ret_val) { > - if (msgbuf[0] == (E1000_VF_RESET | > - E1000_VT_MSGTYPE_ACK)) > + switch (msgbuf[0]) { > + case E1000_VF_RESET | E1000_VT_MSGTYPE_ACK: > memcpy(hw->mac.perm_addr, addr, ETH_ALEN); > - else > + break; > + > + case E1000_VF_RESET | E1000_VT_MSGTYPE_NACK: > + eth_zero_addr(hw->mac.perm_addr); > + break; > + > + default: > ret_val = -E1000_ERR_MAC_INIT; > + } > } > } > > -- > 2.38.1 >
Hi, On 2022/11/23 1:22, Maciej Fijalkowski wrote: > On Wed, Nov 23, 2022 at 12:26:30AM +0900, Akihiko Odaki wrote: >> vf reset nack actually represents the reset operation itself is >> performed but no address is assigned. Therefore, e1000_reset_hw_vf >> should fill the "perm_addr" with the zero address and return success on >> such an occasion. This prevents its callers in netdev.c from saying PF >> still resetting, and instead allows them to correctly report that no >> address is assigned. > > What's the v1->v2 diff? Sorry, I mistakenly added you to CC (and didn't tell you the context). The diff is only in the message. For details, please look at: https://patchew.org/linux/20221122092707.30981-1-akihiko.odaki@daynix.com/#647a4053-bae0-6c06-3049-274d389c2bdd@daynix.com > Probably route to net and add fixes tag? It is hard to determine the cause of the bug because it is about undocumented ABI. Linux introduced E1000_VF_RESET | E1000_VT_MSGTYPE_NACK response with commit 6ddbc4cf1f4d ("igb: Indicate failure on vf reset for empty mac address") so one can say it is the cause of the bug. However, the PF may be driven by someone else Linux (Windows in particular), and if such system have already had E1000_VF_RESET | E1000_VT_MSGTYPE_NACK response defined, it can be said the bug existed even before Linux changes how the PF responds to E1000_VF_RESET request. Regards, Akihiko Odaki > >> >> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> >> --- >> drivers/net/ethernet/intel/igbvf/vf.c | 15 ++++++++++++--- >> 1 file changed, 12 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/ethernet/intel/igbvf/vf.c b/drivers/net/ethernet/intel/igbvf/vf.c >> index b8ba3f94c363..2691ae2a8002 100644 >> --- a/drivers/net/ethernet/intel/igbvf/vf.c >> +++ b/drivers/net/ethernet/intel/igbvf/vf.c >> @@ -1,6 +1,8 @@ >> // SPDX-License-Identifier: GPL-2.0 >> /* Copyright(c) 2009 - 2018 Intel Corporation. */ >> >> +#include <linux/etherdevice.h> >> + >> #include "vf.h" >> >> static s32 e1000_check_for_link_vf(struct e1000_hw *hw); >> @@ -131,11 +133,18 @@ static s32 e1000_reset_hw_vf(struct e1000_hw *hw) >> /* set our "perm_addr" based on info provided by PF */ >> ret_val = mbx->ops.read_posted(hw, msgbuf, 3); >> if (!ret_val) { >> - if (msgbuf[0] == (E1000_VF_RESET | >> - E1000_VT_MSGTYPE_ACK)) >> + switch (msgbuf[0]) { >> + case E1000_VF_RESET | E1000_VT_MSGTYPE_ACK: >> memcpy(hw->mac.perm_addr, addr, ETH_ALEN); >> - else >> + break; >> + >> + case E1000_VF_RESET | E1000_VT_MSGTYPE_NACK: >> + eth_zero_addr(hw->mac.perm_addr); >> + break; >> + >> + default: >> ret_val = -E1000_ERR_MAC_INIT; >> + } >> } >> } >> >> -- >> 2.38.1 >>
On 11/22/2022 5:04 PM, Akihiko Odaki wrote: > Hi, > > On 2022/11/23 1:22, Maciej Fijalkowski wrote: >> On Wed, Nov 23, 2022 at 12:26:30AM +0900, Akihiko Odaki wrote: >>> vf reset nack actually represents the reset operation itself is >>> performed but no address is assigned. Therefore, e1000_reset_hw_vf >>> should fill the "perm_addr" with the zero address and return success on >>> such an occasion. This prevents its callers in netdev.c from saying PF >>> still resetting, and instead allows them to correctly report that no >>> address is assigned. >> >> What's the v1->v2 diff? > > Sorry, I mistakenly added you to CC (and didn't tell you the context). > The diff is only in the message. For details, please look at: > https://patchew.org/linux/20221122092707.30981-1-akihiko.odaki@daynix.com/#647a4053-bae0-6c06-3049-274d389c2bdd@daynix.com > >> Probably route to net and add fixes tag? > It is hard to determine the cause of the bug because it is about > undocumented ABI. Linux introduced E1000_VF_RESET | > E1000_VT_MSGTYPE_NACK response with commit 6ddbc4cf1f4d ("igb: Indicate > failure on vf reset for empty mac address") so one can say it is the > cause of the bug. > > However, the PF may be driven by someone else Linux (Windows in > particular), and if such system have already had E1000_VF_RESET | > E1000_VT_MSGTYPE_NACK response defined, it can be said the bug existed > even before Linux changes how the PF responds to E1000_VF_RESET request. As best as you can find is ok; the one you point to seems reasonable. We can only control this OS so we should point to the responsible patch within the kernel. It's better to go with a best-effort Fixes and get applied to some stable kernels then go without one and not (and would require later effort). Thanks, Tony
diff --git a/drivers/net/ethernet/intel/igbvf/vf.c b/drivers/net/ethernet/intel/igbvf/vf.c index b8ba3f94c363..2691ae2a8002 100644 --- a/drivers/net/ethernet/intel/igbvf/vf.c +++ b/drivers/net/ethernet/intel/igbvf/vf.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2009 - 2018 Intel Corporation. */ +#include <linux/etherdevice.h> + #include "vf.h" static s32 e1000_check_for_link_vf(struct e1000_hw *hw); @@ -131,11 +133,18 @@ static s32 e1000_reset_hw_vf(struct e1000_hw *hw) /* set our "perm_addr" based on info provided by PF */ ret_val = mbx->ops.read_posted(hw, msgbuf, 3); if (!ret_val) { - if (msgbuf[0] == (E1000_VF_RESET | - E1000_VT_MSGTYPE_ACK)) + switch (msgbuf[0]) { + case E1000_VF_RESET | E1000_VT_MSGTYPE_ACK: memcpy(hw->mac.perm_addr, addr, ETH_ALEN); - else + break; + + case E1000_VF_RESET | E1000_VT_MSGTYPE_NACK: + eth_zero_addr(hw->mac.perm_addr); + break; + + default: ret_val = -E1000_ERR_MAC_INIT; + } } }