From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f51.google.com (mail-pg0-f51.google.com [74.125.83.51]) by dpdk.org (Postfix) with ESMTP id 61C217CA3 for ; Thu, 22 Jun 2017 17:56:53 +0200 (CEST) Received: by mail-pg0-f51.google.com with SMTP id e187so9522932pgc.1 for ; Thu, 22 Jun 2017 08:56:53 -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=GxvzZRhi/K2OGyDLnkyfeuFuTLE+o20anBFXH48DItE=; b=c+w6ezvPPg0ptSzSjRVrF5el65xqonDGwq5PP/8n7KQPevuv0trX/vcZRnLy/HqtLg vViDsOnplhiDTdA4Gda35MVDu6zXZbsD3zqP8xps08QUWETkpar0FIfIQGmMofkDkDa/ wUQXieDpMrJGpc26uQcARK1T+QEzd8m90ThRtbLomCkLbKSanGlvXIWVc1QXD4Gl0U6B LT7oSd4DCMAkVbNs3ioyVo7ya6LCrEBz3UVw6Y1qBPwfwiPrarmJXHTyPduWGCUVbnMp TIk8TsRzrC03PxFEkitwqOI+488dxWGeTtvqi1RHltvar7MJfTi1JDXmtH6w/QHQqWPY v+tg== 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=GxvzZRhi/K2OGyDLnkyfeuFuTLE+o20anBFXH48DItE=; b=pehTW+uUXV0NmEpDdcb1Um6gf4WnH/IU1yf7/smoOgCEQ98KQXSBW54VAORfeG4jwj 51UzY6PaeWA3aLrHPO+kiuy8ZwOnObNCN3oumI4tgiiwosEdnbkryUraot/ToZhSGIjo wyyvrMYN/ClAbXES/NykbDUlYv6x8CK/+YaElxk/iN9+zFYH78MDk9EWUjc5Ue1r3p38 Us5Bn+GhG3rGQIQjvQJVSjtHgAVZqeo8dM8bJsK2JJ3ZfbbEdsBXoLto9B6767Zl+YSV 0gZShTU3nGj7mgfmHI/8yAnhaOlgxyZBSTIJ62Af1cugUSos9TFP4mMueTjyzC/h8FOw Xg5w== X-Gm-Message-State: AKS2vOz4hg0P71IMWgVze6mhxB/aDIYmdiPqE8XmZ82diGiUO5BsnKjy PEgtGpw7dyBlEp5uhYNjTQ== X-Received: by 10.84.232.197 with SMTP id x5mr3673043plm.159.1498147012248; Thu, 22 Jun 2017 08:56:52 -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 y28sm4678939pfd.32.2017.06.22.08.56.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jun 2017 08:56:50 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Thu, 22 Jun 2017 08:56:40 -0700 Message-Id: <20170622155641.25916-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170622155641.25916-1-stephen@networkplumber.org> References: <20170622155641.25916-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 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: Thu, 22 Jun 2017 15:56:53 -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. Signed-off-by: Stephen Hemminger --- v2 -- need to expand string size and shifts in compare function 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