From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BA2F9A054F; Mon, 1 Mar 2021 10:24:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 519A84067B; Mon, 1 Mar 2021 10:24:13 +0100 (CET) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id 810CF4014E for ; Mon, 1 Mar 2021 10:24:11 +0100 (CET) Received: by mail-wr1-f45.google.com with SMTP id v15so15319729wrx.4 for ; Mon, 01 Mar 2021 01:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mayadata-io.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=jDmukRP6cQpgVi0dZbwPtIO6H/TkRVg7/BSZazlsgUE=; b=0vNiyJlLg+qC2n/0hKB5P6WD9uTbYjGaXxO0GCHarSbcO3MIXi9yIhbIMdwhz/eUxs uJ87fLNyZbhAPnmJdTi0KMBFVX5fV4j+Y+mu9s6DWX5iSG4X8HMU1fWiD8n8jdSf7o3B S3Ml9W9xPDJmBd5+H5Lqe23AKhmKKNRJKQsjKSPT/9Wwo13pQumR1uR8Mv421gLY7rlv dQhAT5hi7JIJbk9YktHeyZnVLkLV3U2z9BvmL9VgHl4OUOEp58HOuTHe2EvGZCbFgF5K 1KV50xSJj67NR89xyB4tyem/4zPseqs2qgCFdLf5ndfzPcNMkpOUsIyQCrlQgEAPM1Tf wWAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=jDmukRP6cQpgVi0dZbwPtIO6H/TkRVg7/BSZazlsgUE=; b=IiQYi7qXw89d3d9txKF3kvh9fVrBGT2/ZwDlsqTXVsSWHdfXdgMt1xma/4P9MlGadB eNiwjpAIp/uy6uyRD+n3XIdMl8VuVh9gZvXflIQ4c4GEEwM+Q5UDkZHKttu+LILUb4kd owljmWCXoou5a23a6AMUx7LONLmMdsj/FgSSRsUOciRFjHGVJ1X149rekYsweCrJuQ/e fI4g9+PwCjK5e+P0aDdjgaojJm73KEl8eccykMol1R86963OKq/RtgzjmWBY9eZcXnZe clBa0ut68L8NBqOrJJRvoDdc05B48qyZC0BaCeRwM/HpP4z5v5JptqJS37mVpAJ38lwe PmaQ== X-Gm-Message-State: AOAM530oGk4D5sy7EK2kLyqY43ONIDIPB6hD2bWcTOsC5Xg3lWE3Qg4+ mqVOqXbRAg31lOpUEQujhAgl8eNXn0ABzk0s X-Google-Smtp-Source: ABdhPJw18pDOQs/jYL0aLquP7R9HcNYi21ahjKmjyO1Ku1dmC8EdNxgTsJEcOKXZseOl4DEGV0JR2w== X-Received: by 2002:a05:6000:24b:: with SMTP id m11mr7921012wrz.393.1614590650742; Mon, 01 Mar 2021 01:24:10 -0800 (PST) Received: from [192.168.0.33] (cpc98320-croy25-2-0-cust77.19-2.cable.virginm.net. [80.235.134.78]) by smtp.gmail.com with ESMTPSA id s20sm17414395wmj.36.2021.03.01.01.24.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Mar 2021 01:24:10 -0800 (PST) From: Nick Connolly X-Google-Original-From: Nick Connolly To: Dmitry Kozlyuk Cc: talshn@nvidia.com, pallavi.kadam@intel.com, thomas@monjalon.net, dev@dpdk.org References: <20210125170821.11306-1-nick.connolly@mayadata.io> <20210223181857.2516-1-nick.connolly@mayadata.io> <20210228173822.69a09b0f@sovereign> Message-ID: <3b51beb6-65a2-78f9-ce3b-5a36fb3077a0@mayadata.io> Date: Mon, 1 Mar 2021 09:24:08 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210228173822.69a09b0f@sovereign> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [dpdk-dev] [PATCH v6] bus/pci: nvme on Windows requires class id and bus X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Thanks Dmitry - will address and send v7. On 28/02/2021 14:38, Dmitry Kozlyuk wrote: > 2021-02-23 18:18, Nick Connolly: >> Attaching to an NVMe disk on Windows using SPDK requires the >> PCI class ID and device.bus fields. Decode the class ID from the PCI >> device info strings if it is present and set device.bus. >> >> Signed-off-by: Nick Connolly >> Acked-by: Tal Shnaiderman >> --- >> v6: >> * no changes - resending to resolve spurious iol-testing failure >> >> v5: >> * Add missing version history >> >> v4: >> * Use #define to determine length of Class ID >> >> v3: >> * Put version history at top - v2 mistakenly had it after the diffs >> >> v2: >> * If only a 4-digit class ID is available, convert it to 6-digit format >> >> drivers/bus/pci/windows/pci.c | 18 +++++++++++++++++- >> 1 file changed, 17 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c >> index f66258452..dceb0f4b2 100644 >> --- a/drivers/bus/pci/windows/pci.c >> +++ b/drivers/bus/pci/windows/pci.c >> @@ -23,6 +23,9 @@ DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc, >> * the registry hive for PCI devices. >> */ >> >> +/* Class ID consists of hexadecimal digits */ >> +#define RTE_PCI_DRV_CLASSID_DIGIT "0123456789abcdefABCDEF" >> + >> /* The functions below are not implemented on Windows, >> * but need to be defined for compilation purposes >> */ >> @@ -280,17 +283,29 @@ parse_pci_hardware_id(const char *buf, struct rte_pci_id *pci_id) >> { >> int ids = 0; >> uint16_t vendor_id, device_id; >> - uint32_t subvendor_id = 0; >> + uint32_t subvendor_id = 0, class_id = 0; >> + const char *cp; >> >> ids = sscanf_s(buf, "PCI\\VEN_%" PRIx16 "&DEV_%" PRIx16 "&SUBSYS_%" >> PRIx32, &vendor_id, &device_id, &subvendor_id); >> if (ids != 3) >> return -1; >> >> + /* Try and find PCI class ID */ >> + for (cp = buf; !(cp[0] == 0 && cp[1] == 0); cp++) >> + if (*cp == '&' && sscanf_s(cp, >> + "&CC_%" PRIx32, &class_id) == 1) { >> + /* Convert 4-digit class IDs to 6-digit format */ >> + if (strspn(cp + 4, RTE_PCI_DRV_CLASSID_DIGIT) == 4) >> + class_id <<= 8; >> + break; >> + } >> + > Is "4/6-digit format" used commonly for class ID, subclass ID, and optional > programming interface code? If not, I suggest sticking to official > terminology, something like "Assume zero programming interface code if > unspecified". > > In general, a link to format reference would be useful in commit message or > function comment, for readers to understand what's being parsed: > > https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-pci-devices > > With above nits, > Acked-by: Dmitry Kozlyuk