From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/5] ring: add a function to return the ring size
Date: Thu, 23 Feb 2017 16:42:00 +0000 [thread overview]
Message-ID: <1487868123-30262-3-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1487695964-15593-1-git-send-email-bruce.richardson@intel.com>
Applications and other libraries should not be reading inside the
rte_ring structure directly to get the ring size. Instead add a fn
to allow it to be queried.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_ring/rte_ring.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index e359aff..72ccca5 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -1108,6 +1108,20 @@ rte_ring_free_count(const struct rte_ring *r)
}
/**
+ * Return the size of the ring.
+ *
+ * @param r
+ * A pointer to the ring structure.
+ * @return
+ * The number of elements which can be stored in the ring.
+ */
+static inline unsigned int
+rte_ring_get_size(const struct rte_ring *r)
+{
+ return r->prod.size;
+}
+
+/**
* Dump the status of all rings on the console
*
* @param f
--
2.9.3
next prev parent reply other threads:[~2017-02-23 16:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 16:52 [dpdk-dev] [PATCH 0/4] minor fixes and cleanup Bruce Richardson
2017-02-21 16:52 ` [dpdk-dev] [PATCH 1/4] app/pdump: fix duplicate macro definition Bruce Richardson
2017-02-21 16:52 ` [dpdk-dev] [PATCH 2/4] ring: add a function to return the ring size Bruce Richardson
2017-02-21 16:52 ` [dpdk-dev] [PATCH 3/4] crypto/null: use ring size function Bruce Richardson
2017-02-21 16:52 ` [dpdk-dev] [PATCH 4/4] examples/quota_watermark: correct code indentation Bruce Richardson
2017-02-23 16:41 ` [dpdk-dev] [PATCH v2 0/5] minor fixes and cleanup Bruce Richardson
2017-02-23 17:02 ` Bruce Richardson
2017-03-08 15:09 ` Thomas Monjalon
2017-02-23 16:41 ` [dpdk-dev] [PATCH v2 1/5] app/pdump: fix duplicate macro definition Bruce Richardson
2017-02-23 16:42 ` Bruce Richardson [this message]
2017-03-08 10:00 ` [dpdk-dev] [PATCH v2 2/5] ring: add a function to return the ring size Olivier MATZ
2017-02-23 16:42 ` [dpdk-dev] [PATCH v2 3/5] crypto/null: use ring size function Bruce Richardson
2017-02-24 14:20 ` Doherty, Declan
2017-02-23 16:42 ` [dpdk-dev] [PATCH v2 4/5] examples/quota_watermark: correct code indentation Bruce Richardson
2017-02-23 16:42 ` [dpdk-dev] [PATCH v2 5/5] examples/quota_watermark: fix requirement for 2M pages Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1487868123-30262-3-git-send-email-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).