From nobody Fri May 3 17:45:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1492723589576107.23218898644393; Thu, 20 Apr 2017 14:26:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FAD96196F; Thu, 20 Apr 2017 21:26:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DFAD77D51; Thu, 20 Apr 2017 21:26:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7B6334EBD7; Thu, 20 Apr 2017 21:26:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3KLQH1h024002 for ; Thu, 20 Apr 2017 17:26:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id E6AE9173A6; Thu, 20 Apr 2017 21:26:17 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-148.phx2.redhat.com [10.3.116.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id A502D173A9 for ; Thu, 20 Apr 2017 21:26:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9FAD96196F Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=laine.org Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9FAD96196F From: Laine Stump To: libvir-list@redhat.com Date: Thu, 20 Apr 2017 17:26:11 -0400 Message-Id: <20170420212611.12918-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] util: allow ignoring SIOCSIFHWADDR when errno is EPERM X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 20 Apr 2017 21:26:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Laine Stump Commit f4ef3a71 made a variation of virNetDevSetMAC that would return without logging an error message if errno was set to EADDRNOTAVAIL. This errno is set by some SRIOV VF drivers (in particular igbvf) when they fail to set the device's MAC address due to the PF driver refusing the request. This is useful if we want to try a different method of setting the VF MAC address before giving up (Commit 86556e16 actually does this, setting the desired MAC address to the "admin MAC in the PF, then detaching and reattaching the VF netdev driver to force a reinit of the MAC address). During testing of Bug 1442040 t was discovered that the ixgbe driver returns EPERM in this situation, so this patch changes the exception case for silent+non-terminal failure to account for this difference. Completes resolution to: https://bugzilla.redhat.com/1415609 (RHEL 7.4) https://bugzilla.redhat.com/1442040 (RHEL 7.3.z) --- src/util/virnetdev.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 170e348..9aa9c9f 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -226,7 +226,8 @@ int virNetDevExists(const char *ifname) * virNetDevSetMACInternal: * @ifname: interface name to set MTU for * @macaddr: MAC address - * @quiet: true if a failure to set MAC address with errno =3D=3D EADDRNOT= AVAIL + * @quiet: true if a failure to set MAC address with + * errno =3D=3D EADDRNOTAVAIL || errno =3D=3D EPERM * should be silent (still returns error, but without log) * * This function sets the @macaddr for a given interface @ifname. @@ -258,7 +259,8 @@ virNetDevSetMACInternal(const char *ifname, =20 if (ioctl(fd, SIOCSIFHWADDR, &ifr) < 0) { =20 - if (quiet && errno =3D=3D EADDRNOTAVAIL) + if (quiet && + (errno =3D=3D EADDRNOTAVAIL || errno =3D=3D EPERM)) goto cleanup; =20 virReportSystemError(errno, @@ -305,7 +307,8 @@ virNetDevSetMACInternal(const char *ifname, ifr.ifr_addr.sa_len =3D VIR_MAC_BUFLEN; =20 if (ioctl(s, SIOCSIFLLADDR, &ifr) < 0) { - if (quiet && errno =3D=3D EADDRNOTAVAIL) + if (quiet && + (errno =3D=3D EADDRNOTAVAIL || errno =3D=3D EPERM)) goto cleanup; =20 virReportSystemError(errno, @@ -2229,11 +2232,12 @@ virNetDevSetNetConfig(const char *linkdev, int vf, int retries =3D 100; =20 /* if pfDevOrig =3D=3D NULL, this isn't a VF, so we've failed = */ - if (!pfDevOrig || errno !=3D EADDRNOTAVAIL) + if (!pfDevOrig || + (errno !=3D EADDRNOTAVAIL && errno !=3D EPERM)) goto cleanup; =20 /* Otherwise this is a VF, and virNetDevSetMAC failed with - * EADDRNOTAVAIL, which could be due to the + * EADDRNOTAVAIL/EPERM, which could be due to the * "administratively set" flag being set in the PF for * this VF. When this happens, we can attempt to use an * alternate method to set the VF MAC: first set it into --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list