From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 2B6DB1B224 for ; Thu, 12 Oct 2017 12:46:19 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id m72so12009477wmc.1 for ; Thu, 12 Oct 2017 03:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=GwIpwkgQ5AHaRZ9Ks5TNygIge8JasEqo2OTG1ud3DTA=; b=QBsAet1QVWEqZ48PUfnoYafKxYkbvM7ixiM1g/+/2bO9WGBGA9pNpam1LCQFe2gNHU SbQhgSWFIVvQCNID1j09TAJmtbvaEcMwX5Tv/NV44COZMRVaiyN1IS1L1Pl0Hcvr87pT C8v0ZrecxuxeVJ2YPr26jyiW7FsvVnXCYQMInhf72dJiI+vcmQ3J5+xjgoHq/2imJE6Z iMok3eF0c7PRvEx1mzUMSJ4SHPq1oqbO1k0tMNG24tq4GCF2KrDaVQbjI5EB2CCt8MEh oJ5wK9xbxKvjbvWcoZI0ZZRFVbaTNjF9nn1FwjH0yPooBBYFWvOyyibhsyc6LhGueqs0 ZfBQ== 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:in-reply-to:references; bh=GwIpwkgQ5AHaRZ9Ks5TNygIge8JasEqo2OTG1ud3DTA=; b=IDV6o92HAEO++WnWMtYY8IAxKD6QKcVOnYPv1zJlVCr/Q7472W7yU342siCa6UNSD9 /3ANo0gQPXC57ukoY9vrodivQ7xIOtf2TgVNpr3A50dgQII62Uf2AnC/6DYOSU35o0pe V79MiKG/4dQoo2NWagVolUrOjLeW07hRTmwA5jnZexsQH/E/wrkN3KSAwqbujTvrNJ1K Wx2nkfwbQMj4JnjKPjb8rXTNcZMvkK6ULMq6owgF6F0Bc/Lu3cTzaQuMsDgFa0NDsmwa TGsPbh+rfP047yibePry7I3q0mF/KQ/hBaqkPrzAKjsBz2pDmzCQDGNm1Ioc+yQ2i7O3 2DMQ== X-Gm-Message-State: AMCzsaWK1kf0UzxjEH627A6kK7JJluSzEAVW1AWOAc7KLi7VCC7gzrgC CMQsxEiLKC1a7A8gzw2CtI25Iitj X-Google-Smtp-Source: AOwi7QCEAzKDGTqALmH3Da7jSKv+nrdSihOayHhxQbP/FC43XAm3tB0kJo1/l7XCHzo6hefInmRmNg== X-Received: by 10.28.19.73 with SMTP id 70mr1438213wmt.87.1507805178445; Thu, 12 Oct 2017 03:46:18 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id z192sm16481146wmz.28.2017.10.12.03.46.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 03:46:17 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 12 Oct 2017 12:45:39 +0200 Message-Id: <11514b1a8447e2112cd270976e061ef40e8355f9.1507804944.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v5 12/20] pci: deprecate misnamed functions 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, 12 Oct 2017 10:46:21 -0000 Rename misnamed functions and describe the change in a deprecation notice. Signed-off-by: Gaetan Rivet --- doc/guides/rel_notes/deprecation.rst | 10 ++++++ lib/librte_pci/include/rte_pci.h | 63 ++++++++++++++++++++++++++++++++++++ lib/librte_pci/rte_pci.c | 26 +++++++++++++++ lib/librte_pci/rte_pci_version.map | 4 +++ 4 files changed, 103 insertions(+) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 4e4d97b..ef2264f 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -98,3 +98,13 @@ Deprecation Notices The non-"do-sig" versions of the hash tables will be removed (including the ``signature_offset`` parameter) and the "do-sig" versions renamed accordingly. + +* pci: Several exposed functions are misnamed. + The following functions are deprecated starting from v17.11 and are replaced: + + - ``eal_parse_pci_BDF`` replaced by ``pci_parse_BDF`` + - ``eal_parse_pci_DomBDF`` replaced by ``pci_parse_DomBDF`` + - ``rte_eal_compare_pci_addr`` replaced by ``pci_addr_cmp`` + - ``rte_pci_device_name`` replaced by ``pci_device_name`` + + The functions are only renamed. Their behavior is not affected. diff --git a/lib/librte_pci/include/rte_pci.h b/lib/librte_pci/include/rte_pci.h index fe4d411..38cbdb3 100644 --- a/lib/librte_pci/include/rte_pci.h +++ b/lib/librte_pci/include/rte_pci.h @@ -135,6 +135,7 @@ struct mapped_pci_resource { TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource); /** + * @deprecated * Utility function to produce a PCI Bus-Device-Function value * given a string representation. Assumes that the BDF is provided without * a domain prefix (i.e. domain returned is always 0) @@ -151,6 +152,22 @@ int eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr); /** * Utility function to produce a PCI Bus-Device-Function value + * given a string representation. Assumes that the BDF is provided without + * a domain prefix (i.e. domain returned is always 0) + * + * @param input + * The input string to be parsed. Should have the format XX:XX.X + * @param dev_addr + * The PCI Bus-Device-Function address to be returned. + * Domain will always be returned as 0 + * @return + * 0 on success, negative on error. + */ +int pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr); + +/** + * @deprecated + * Utility function to produce a PCI Bus-Device-Function value * given a string representation. Assumes that the BDF is provided including * a domain prefix. * @@ -164,6 +181,21 @@ int eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr); int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr); /** + * Utility function to produce a PCI Bus-Device-Function value + * given a string representation. Assumes that the BDF is provided including + * a domain prefix. + * + * @param input + * The input string to be parsed. Should have the format XXXX:XX:XX.X + * @param dev_addr + * The PCI Bus-Device-Function address to be returned + * @return + * 0 on success, negative on error. + */ +int pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr); + +/** + * @deprecated * Utility function to write a pci device name, this device name can later be * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_* * BDF helpers. @@ -179,6 +211,22 @@ void rte_pci_device_name(const struct rte_pci_addr *addr, char *output, size_t size); /** + * Utility function to write a pci device name, this device name can later be + * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_* + * BDF helpers. + * + * @param addr + * The PCI Bus-Device-Function address + * @param output + * The output buffer string + * @param size + * The output buffer size + */ +void pci_device_name(const struct rte_pci_addr *addr, + char *output, size_t size); + +/** + * @deprecated * Utility function to compare two PCI device addresses. * * @param addr @@ -194,6 +242,21 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, const struct rte_pci_addr *addr2); /** + * Utility function to compare two PCI device addresses. + * + * @param addr + * The PCI Bus-Device-Function address to compare + * @param addr2 + * The PCI Bus-Device-Function address to compare + * @return + * 0 on equal PCI address. + * Positive on addr is greater than addr2. + * Negative on addr is less than addr2, or error. + */ +int pci_addr_cmp(const struct rte_pci_addr *addr, + const struct rte_pci_addr *addr2); + +/** * Map a particular resource from a file. * * @param requested_addr diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c index cbb5359..fc2fc7f 100644 --- a/lib/librte_pci/rte_pci.c +++ b/lib/librte_pci/rte_pci.c @@ -73,6 +73,12 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm) int eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr) { + return pci_bdf_parse(input, dev_addr); +} + +int +pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr) +{ const char *in = input; dev_addr->domain = 0; @@ -91,6 +97,12 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr) int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr) { + return pci_dbdf_parse(input, dev_addr); +} + +int +pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr) +{ const char *in = input; unsigned long val; char *end; @@ -117,6 +129,13 @@ void rte_pci_device_name(const struct rte_pci_addr *addr, char *output, size_t size) { + pci_device_name(addr, output, size); +} + +void +pci_device_name(const struct rte_pci_addr *addr, + char *output, size_t size) +{ RTE_VERIFY(size >= PCI_PRI_STR_SIZE); RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT, addr->domain, addr->bus, @@ -127,6 +146,13 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, const struct rte_pci_addr *addr2) { + return pci_addr_cmp(addr, addr2); +} + +int +pci_addr_cmp(const struct rte_pci_addr *addr, + const struct rte_pci_addr *addr2) +{ uint64_t dev_addr, dev_addr2; if ((addr == NULL) || (addr2 == NULL)) diff --git a/lib/librte_pci/rte_pci_version.map b/lib/librte_pci/rte_pci_version.map index a940259..8d180e3 100644 --- a/lib/librte_pci/rte_pci_version.map +++ b/lib/librte_pci/rte_pci_version.map @@ -3,6 +3,10 @@ DPDK_17.11 { eal_parse_pci_BDF; eal_parse_pci_DomBDF; + pci_addr_cmp; + pci_bdf_parse; + pci_dbdf_parse; + pci_device_name; pci_map_resource; pci_unmap_resource; rte_eal_compare_pci_addr; -- 2.1.4