From patchwork Mon Sep 18 09:31:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 28832 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 649AF1B1F4; Mon, 18 Sep 2017 11:32:31 +0200 (CEST) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id DB87A1B1A3 for ; Mon, 18 Sep 2017 11:32:17 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id r68so862261wmg.3 for ; Mon, 18 Sep 2017 02:32:17 -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=/FwczxRZ92KmGxJ4tJsK2lHPmdwnWOmTRg7RLu0HCIQ=; b=Atpy1LVSIThu2ck4/4FSRQEcGa0XewyX+tyq+A0lSV7dZTcxopWTabc4jmQ4BZLeXS i1w5c0mQNCnvLc/RA4uvoxaAdt9x+asIbHwyaKc9HXmWnr7evlWY3cU+TMtTuhTCkJb0 8tHTqa7x9I5Cd1lJRsa1vjulytve+tzT6kwn2EO4vqkyUV9l/A4l6njlXWLvWpWPNHHl /mkCq1r/eR4Uf8AtoRfSicyl54un7Ax8CHOgHSLdl/MZJjrxIpbcEbMQc9ZyjZ1DsGVh gJvUtPM/yeUPmiE7OasaSTF0Lp5pQ7mxXYYlQ0FzAStRsOxXFrvEQXR6+uZ70vyQXqhy B7sQ== 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=/FwczxRZ92KmGxJ4tJsK2lHPmdwnWOmTRg7RLu0HCIQ=; b=bx0797TvnKnv/fuRrazAgJoMN4GNAz1+AWYOaecK1yUa6A/AcTmsjpuV6GOdI9GDqe Y1w7uaY5Sirzmdwh6LnN6q4f52Gf3M/AmuKO46SKkvgkaPrf7eyIn+Uenmxos47hGtxl /E71+PDMxUV8punlhSRIgRpvZHQ/HY0Rqn8HZQJHXxpl3Q7dWdX/tmn9gORz3mmWlKqm 1d7Q4Y/jGbR6ziJL+N/aMs7bggAjedyiBd8ytfJ6N8tAWSe853ejNBL7sAaGBGTiPX+v DOyRMrhmSWLoUGCRQ1GgMo8YLEF3NqJ8QQRUPEYEbHUVsCkcrtFm6SX6CVegYiMp2Am2 iL8Q== X-Gm-Message-State: AHPjjUgXGvdRSvSLARZy19sa+bSiRxTpJm/ueneohdpPq3Opy6au3baf UQNFhC8CRb9S7WMzi3Y= X-Google-Smtp-Source: AOwi7QCXmhFoG8QIo6o2gC/mzh+5WJforO6evu/oMQcnoUGLhST2IVxmhtkezKtzu/r2MsaEntBPEg== X-Received: by 10.28.109.78 with SMTP id i75mr8573944wmc.117.1505727137044; Mon, 18 Sep 2017 02:32:17 -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 f89sm6416859wmh.18.2017.09.18.02.32.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 02:32:16 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Mon, 18 Sep 2017 11:31:47 +0200 Message-Id: <6ffe5618ac590924c65cbf57d6e255846e85cc22.1505726803.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 v2 13/14] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 3362f33..1828e57 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -120,3 +120,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 09a609a..224cea0 100644 --- a/lib/librte_pci/include/rte_pci.h +++ b/lib/librte_pci/include/rte_pci.h @@ -127,6 +127,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) @@ -143,6 +144,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_parse_BDF(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. * @@ -156,6 +173,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_parse_DomBDF(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. @@ -171,6 +203,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 @@ -186,6 +234,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..54ce10d 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_parse_BDF(input, dev_addr); +} + +int +pci_parse_BDF(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_parse_DomBDF(input, dev_addr); +} + +int +pci_parse_DomBDF(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..541769f 100644 --- a/lib/librte_pci/rte_pci_version.map +++ b/lib/librte_pci/rte_pci_version.map @@ -3,7 +3,11 @@ DPDK_17.11 { eal_parse_pci_BDF; eal_parse_pci_DomBDF; + pci_addr_cmp; + pci_device_name; pci_map_resource; + pci_parse_BDF; + pci_parse_DomBDF; pci_unmap_resource; rte_eal_compare_pci_addr; rte_pci_device_name;