From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f52.google.com (mail-pg0-f52.google.com [74.125.83.52]) by dpdk.org (Postfix) with ESMTP id D881158CD for ; Wed, 5 Jul 2017 18:55:44 +0200 (CEST) Received: by mail-pg0-f52.google.com with SMTP id u62so127067455pgb.3 for ; Wed, 05 Jul 2017 09:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QUM7RCNMwcCeL87SjtrDNeT8U85MWyn1Z0XjXZarhTE=; b=HQhjb9uChRAtEk+s2hA8ErK1XWQU6i582z3NcywWKfGFyl5yfLKd7swkn1OdQttSv6 YS0AlwLfhYRVq/qQOeGPwwAUQhK/v4I6U5IDozsKbBwp9lrgERF7TBi0mT1C7Ex8qpn0 5inakPLOsQY9KTSZRF+nl/iFJ3eYHKzkwoHrWE+VpeRhgIZE8juyYwz0aThzFeM4XzsP 8/Jpn+Qi89hW8jxrQmCOzFHAxSIU1iVbsLz/oxHQ+uEfl7E1aHEoiSDIoWRaAx59SAyb vl134l8tiIuWW42rpQNsqu8rIgEukk7f+O+u1uiUIX6TO9HgQEG109/kxQlkMGXA+XaX 8F1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QUM7RCNMwcCeL87SjtrDNeT8U85MWyn1Z0XjXZarhTE=; b=txNx0F6wlExmWxQvEVQwu/NOm43IaT2CweozwUID9ph61+6vEVpPuxrp+e7TrZ4Tow NXbfkr/mXiS8OamA3hXMzFEgLxFVkfTti/GXE9O2HyaoSa3zyiPmFjUrSx0LAWyyJfKM xKx0oy4D9s6hXexyQEsMq8TPLkIeeStJOsr8qum/J0ZJv2l9INYgW0Tq5sS8mRT1Q36/ nhZjeLv3mQNsFIx1xUDHox0k/HWJ5t4cjhYaJf3xGcTnpzcL19NZhjVhNMKAsErNrWAd u9AYaYrl7zow/gfex/cpuj58fo8wtOM+YojbVLw6GD0Ca9H+s4RqxCF/9+XB0CCBO3qn Gq7w== X-Gm-Message-State: AIVw113g+edL2TLiRvn/VaO/DYeRIy+Oq5RT8DP4sOvrvKwWaxz8aAPN GkpjLCpEWiiOSD6PLYS0Vg== X-Received: by 10.99.127.23 with SMTP id a23mr3628856pgd.47.1499273743515; Wed, 05 Jul 2017 09:55:43 -0700 (PDT) Received: from xeon-e3.wavecable.com (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id o1sm47900914pgq.10.2017.07.05.09.55.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jul 2017 09:55:42 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Wed, 5 Jul 2017 09:55:32 -0700 Message-Id: <20170705165533.20581-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170705165533.20581-1-stephen@networkplumber.org> References: <20170705165533.20581-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v3 2/3] eal: PCI domain should be 32 bits X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2017 16:55:45 -0000 In some environments, the PCI domain can be larger than 16 bits. For example, a PCI device passed through in Azure gets a synthetic domain id which is internally generated based on GUID. The PCI standard does not restrict domain to be 16 bits. This change breaks ABI for API's that expose PCI address structure. The printf format for PCI remains unchanged, so that on most systems (with only 16 bit domain) the output format is unchanged and is 4 characters wide. For example: 0000:00:01.0 Only on sysetms with higher bits will the domain take up more space; example: 12000:00:01.0 Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/include/rte_pci.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 0284a6208aa5..e416714b32ff 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -63,7 +63,7 @@ const char *pci_get_sysfs_path(void); /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */ #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 -#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X") +#define PCI_PRI_STR_SIZE sizeof("XXXXXXXX:XX:XX.X") /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */ #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 @@ -112,7 +112,7 @@ struct rte_pci_id { * A structure describing the location of a PCI device. */ struct rte_pci_addr { - uint16_t domain; /**< Device domain */ + uint32_t domain; /**< Device domain */ uint8_t bus; /**< Device bus */ uint8_t devid; /**< Device ID */ uint8_t function; /**< Device function. */ @@ -346,10 +346,10 @@ rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, if ((addr == NULL) || (addr2 == NULL)) return -1; - dev_addr = (addr->domain << 24) | (addr->bus << 16) | - (addr->devid << 8) | addr->function; - dev_addr2 = (addr2->domain << 24) | (addr2->bus << 16) | - (addr2->devid << 8) | addr2->function; + dev_addr = ((uint64_t)addr->domain << 24) | + (addr->bus << 16) | (addr->devid << 8) | addr->function; + dev_addr2 = ((uint64_t)addr2->domain << 24) | + (addr2->bus << 16) | (addr2->devid << 8) | addr2->function; if (dev_addr > dev_addr2) return 1; -- 2.11.0