From nobody Tue Jun 06 05:20:33 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QZzMT0NFXz4ZQyK; Tue, 6 Jun 2023 05:20:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QZzMS7140z3lqt; Tue, 6 Jun 2023 05:20:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686028837; 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=mdqVt3cZgrp4G8kfpVnIaaQImDIIeEO7udGlUVrL5/g=; b=HeW9tUBY5fkpiuYjgRNbo6mWQcnLdK3qTQnaYVPlIiHIhOX0ClPWXOmKpHSpaKpPzOVhlt IUoXWFyWwLvJ91AgSb2SttA75mmDfo4XB6yUMaNbfzjlWvB5o6Fn2HPSxsthjcW7divHTQ /SX04M41OdBzuew0p11u1U1Bq6OLHiRDTpOX4NdOZtB1yyDzeNLn8JO/NNFUP/hnoHaalb yLbsDQKeAXLws/ZB2ME2bXmqEFwgLp3KnkMcPhLwsCjsVEK6jpqacGZIaVj7jyC8zB+d3P plKQwA8urAeHKKmAil18N+UERDPrpcA6d8BFcjU7iCMmg/qysS5ABCM6woI+tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686028837; 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=mdqVt3cZgrp4G8kfpVnIaaQImDIIeEO7udGlUVrL5/g=; b=m35Sqoqa/CMGU2PB/e2Xlv0i5T3bbL422ZokCUCbdBdmKwc0ix2Mjig9IHBHB6oQd+DuJA QzbQlXFaUjcjSRJdX9tZpQhwKQ31LKsc74KegCOs5QVIhBpdYAVDM0mxAnIVyllI+GPf2E nSbDQwIDgVi9xC3btQ14kNdcoL7p+nLQc8Y7TFCaKE/qyXcOO3DNybrxmIAC3qAs1PLAHO Q2n28DQB+pT1bTGk61cTMM4v8Fpuy1LdCbJwGwzshO3JyH401MeLk5AI9IpSZjSs7COMI5 v33VMfEkQRa1Mxd+eMQ2/j3xh4lj5eahtzLubx+bT6q9mQNT689/I/Hz7pcGtQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686028837; a=rsa-sha256; cv=none; b=hvSabrXW5ZIPilOUwwS6YCEmFlcaG3XVSS6VVbuRyPJRpiRJqJ/ik7Oxj4hcifztxsFjdf hL/zRmhs7slcAdvaWiS23Sa2Pd9tRybKAFjOA515Aa3VrIELdWbOioGncwFZH7PVW84H2/ 0w+eDjncMiVrtKODfwbg/dT+LuEvBk0Fp4QJFwW9CEgEnzq/3qT5FqKt9fyfHtSonIzUQM ORv2e1QmG6L/AbFKwK9z2EqXXzCUhTrIK5rWOiWUyfzbCWODUTB3uV4/lsmuW8A9ygPcyQ Ufu1qLmWoVM/k0HrGfwCOuyNUDlvHP4SYTss7aho5wG64C+3g0N4PQxgCqxj0w== Received: from odin.corp.delphij.net (c-141-193-140-155.rev.sailinternet.net [141.193.140.155]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: delphij/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4QZzMS1hkkzbCY; Tue, 6 Jun 2023 05:20:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Message-ID: <55c01465-2c16-bc6b-d1fb-4b9f670d4503@FreeBSD.org> Date: Mon, 5 Jun 2023 22:20:33 -0700 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Thunderbird Subject: Re: git: 1bbdfb0b4386 - main - gve: Add PNP info to PCI attachment of gve(4) driver. Content-Language: en-US To: Jessica Clarke , Warner Losh Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202306060406.35646hbA078041@gitrepo.freebsd.org> <6A5F859A-033A-43E1-81CB-B364662DE2F3@freebsd.org> From: Xin Li Organization: The FreeBSD Project In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ThisMailContainsUnwantedMimeParts: N On 2023-06-05 10:04 PM, Jessica Clarke wrote: > On 6 Jun 2023, at 05:31, Warner Losh wrote: >> >> >> >> On Mon, Jun 5, 2023, 10:15 PM Jessica Clarke wrote: >> On 6 Jun 2023, at 05:06, Xin LI wrote: >>> >>> The branch main has been updated by delphij: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=1bbdfb0b438689a839e29094fcb582a104cbabd9 >>> >>> commit 1bbdfb0b438689a839e29094fcb582a104cbabd9 >>> Author: Xin LI >>> AuthorDate: 2023-06-06 00:58:43 +0000 >>> Commit: Xin LI >>> CommitDate: 2023-06-06 04:05:55 +0000 >>> >>> gve: Add PNP info to PCI attachment of gve(4) driver. >>> >>> Reviewed-by: imp >>> Differential Revision: https://reviews.freebsd.org/D40429 >>> --- >>> sys/dev/gve/gve_main.c | 28 ++++++++++++++++++++++++---- >>> 1 file changed, 24 insertions(+), 4 deletions(-) >>> >>> diff --git a/sys/dev/gve/gve_main.c b/sys/dev/gve/gve_main.c >>> index ae45a0cfc24a..383fd326d33a 100644 >>> --- a/sys/dev/gve/gve_main.c >>> +++ b/sys/dev/gve/gve_main.c >>> @@ -38,6 +38,16 @@ >>> >>> #define GVE_DEFAULT_RX_COPYBREAK 256 >>> >>> +/* Devices supported by this driver. */ >>> +static struct gve_dev { >>> + uint16_t vendor_id; >>> + uint16_t device_id; >>> + const char *name; >>> +} gve_devs[] = { >>> + { PCI_VENDOR_ID_GOOGLE, PCI_DEV_ID_GVNIC, "gVNIC" } >>> +}; >>> +#define GVE_DEVS_COUNT nitems(gve_devs) >> >> IMO this obfuscates rather than helps given the loop iterates over >> gve_devs (and the macro references it). >> >>> + >>> struct sx gve_global_lock; >>> >>> static int >>> @@ -701,10 +711,18 @@ gve_service_task(void *arg, int pending) >>> static int >>> gve_probe(device_t dev) >>> { >>> - if (pci_get_vendor(dev) == PCI_VENDOR_ID_GOOGLE && >>> - pci_get_device(dev) == PCI_DEV_ID_GVNIC) { >>> - device_set_desc(dev, "gVNIC"); >>> - return (BUS_PROBE_DEFAULT); >>> + uint16_t deviceid, vendorid; >>> + int i; >>> + >>> + vendorid = pci_get_vendor(dev); >>> + deviceid = pci_get_device(dev); >>> + >>> + for (i = 0; i < GVE_DEVS_COUNT; i++) { >>> + if (vendorid == gve_devs[i].vendor_id && >>> + deviceid == gve_devs[i].device_id) { >>> + device_set_desc(dev, gve_devs[i].name); >>> + return (BUS_PROBE_DEFAULT); >>> + } >>> } >>> return (ENXIO); >>> } >>> @@ -851,3 +869,5 @@ DRIVER_MODULE(gve, pci, gve_driver, gve_devclass, 0, 0); >>> #else >>> DRIVER_MODULE(gve, pci, gve_driver, 0, 0); >>> #endif >>> +MODULE_PNP_INFO("U16:vendor;U16:device", pci, gve, gve_devs, >> >> This is missing ;D:# so it will break as soon as you have a second >> entry in the table. >> >> While the first bit is true, I though we encoded the per entry size so trailing garbage didn't matter.. d# will be more useful in the future maybe. > > Hm indeed you’re right. Might as well include it still though. I've created https://reviews.freebsd.org/D40430 in attempt to address both issues. After the change, the 'gVNIC' would be in linker.hints (but it's not clear to me if the data is really useful for tools today). I can split this into two changes if you like. Cheers,