From owner-dev-commits-src-main@freebsd.org Thu Apr 15 19:32:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FBB55D3EFC; Thu, 15 Apr 2021 19:32:30 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FLqHL3S0Dz4llw; Thu, 15 Apr 2021 19:32:30 +0000 (UTC) (envelope-from ronald-lists@klop.ws) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=klop.ws; s=mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version: Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jUadlJe6szdS1uwnLrUDO/IXuzjZaYvk+AxH38dizRk=; b=wspaeQxProhRlvRlLt5wxlVp/O cOSoD3iZYLEwTr2EBIU61EIfp807NO5RH1HIP7fsQ5qDTZ7ytw2iEIAabR+BptCqVTT3McIo2YnSc 6wUxduUHTamHuhfH31K+m6wCU434xK906P5fTQrxBCuncVlWv5YkfSS5V6vnMEGiBT/w=; Subject: Re: git: 68a46f11eada - main - e1000: Restore VF interface random MAC To: Kevin Bowling , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104151848.13FImMA5091035@gitrepo.freebsd.org> From: Ronald Klop Message-ID: <5b50b23a-71cd-5221-c905-ccffe841bc98@klop.ws> Date: Thu, 15 Apr 2021 21:32:27 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <202104151848.13FImMA5091035@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.greenhost.nl X-Spam-Level: --- X-Spam-Score: -3.1 X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A autolearn=disabled version=3.4.2 X-Scan-Signature: 98cd051f671ee36aeaf0d6c34a549736 X-Rspamd-Queue-Id: 4FLqHL3S0Dz4llw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Apr 2021 19:32:30 -0000 On 4/15/21 8:48 PM, Kevin Bowling wrote: > The branch main has been updated by kbowling (ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=68a46f11eadab48a1da9e3d3900569a6a1ce142e > > commit 68a46f11eadab48a1da9e3d3900569a6a1ce142e > Author: Kevin Bowling > AuthorDate: 2021-04-15 18:45:02 +0000 > Commit: Kevin Bowling > CommitDate: 2021-04-15 18:45:02 +0000 > > e1000: Restore VF interface random MAC > > Restore 525e07418c77 after the iflib conversion of igb(4). This > reenables random MAC address generation when attaching to a VF with a > zeroed MAC. > > PR: 253535 > Reported by: Balaev PA > Reviewed by: markj > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D29785 > --- > sys/dev/e1000/if_em.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c > index 6f022c80c01c..79a617b3342f 100644 > --- a/sys/dev/e1000/if_em.c > +++ b/sys/dev/e1000/if_em.c > @@ -1061,9 +1061,17 @@ em_if_attach_pre(if_ctx_t ctx) > } > > if (!em_is_valid_ether_addr(hw->mac.addr)) { > - device_printf(dev, "Invalid MAC address\n"); > - error = EIO; > - goto err_late; > + if (adapter->vf_ifp) { > + u8 addr[ETHER_ADDR_LEN]; > + arc4rand(&addr, sizeof(addr), 0); > + addr[0] &= 0xFE; > + addr[0] |= 0x02; > + bcopy(addr, hw->mac.addr, sizeof(addr)); > + } else { > + device_printf(dev, "Invalid MAC address\n"); > + error = EIO; > + goto err_late; > + } Just curious. Would ether_gen_addr() be useful here? It is implemented in net/if_ethersubr.c. Regards, Ronald. > } > > /* Disable ULP support */ > @@ -1923,6 +1931,13 @@ em_identify_hardware(if_ctx_t ctx) > device_printf(dev, "Setup init failure\n"); > return; > } > + > + /* Are we a VF device? */ > + if ((adapter->hw.mac.type == e1000_vfadapt) || > + (adapter->hw.mac.type == e1000_vfadapt_i350)) > + adapter->vf_ifp = 1; > + else > + adapter->vf_ifp = 0; > } > > static int > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.org" >