summaryrefslogtreecommitdiff
path: root/lib/librte_mbuf
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-05-17 21:49:32 +0800
committerThomas Monjalon <thomas@monjalon.net>2018-05-21 00:20:48 +0200
commitf6ffdf1c2c1cfbb2a3cbce246b545560609abeb5 (patch)
treefa6ef56feee5c73c2c5a0c0a1990de67e90ab830 /lib/librte_mbuf
parentee07d519ceb05e59dd970c48a42cf2f09b3ac4dc (diff)
downloaddpdk-f6ffdf1c2c1cfbb2a3cbce246b545560609abeb5.zip
dpdk-f6ffdf1c2c1cfbb2a3cbce246b545560609abeb5.tar.gz
dpdk-f6ffdf1c2c1cfbb2a3cbce246b545560609abeb5.tar.xz
mbuf: explicit casts of reference counter
differences to the atomic16 are signed, but the atomic16 itself is unsigned. It needs to be made explicit with casts. Fixes: af75078fece3 ("first public release") Fixes: a53aa2b9f3be ("mbuf: support attaching external buffer") Cc: stable@dpdk.org Signed-off-by: Andy Green <andy@warmcat.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Diffstat (limited to 'lib/librte_mbuf')
-rw-r--r--lib/librte_mbuf/rte_mbuf.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 8a2dae2..b776a6f 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -806,7 +806,7 @@ rte_mbuf_refcnt_read(const struct rte_mbuf *m)
static inline void
rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)
{
- rte_atomic16_set(&m->refcnt_atomic, new_value);
+ rte_atomic16_set(&m->refcnt_atomic, (int16_t)new_value);
}
/* internal */
@@ -837,8 +837,8 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)
*/
if (likely(rte_mbuf_refcnt_read(m) == 1)) {
++value;
- rte_mbuf_refcnt_set(m, value);
- return value;
+ rte_mbuf_refcnt_set(m, (uint16_t)value);
+ return (uint16_t)value;
}
return __rte_mbuf_refcnt_update(m, value);
@@ -909,7 +909,7 @@ static inline void
rte_mbuf_ext_refcnt_set(struct rte_mbuf_ext_shared_info *shinfo,
uint16_t new_value)
{
- rte_atomic16_set(&shinfo->refcnt_atomic, new_value);
+ rte_atomic16_set(&shinfo->refcnt_atomic, (int16_t)new_value);
}
/**
@@ -929,8 +929,8 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo,
{
if (likely(rte_mbuf_ext_refcnt_read(shinfo) == 1)) {
++value;
- rte_mbuf_ext_refcnt_set(shinfo, value);
- return value;
+ rte_mbuf_ext_refcnt_set(shinfo, (uint16_t)value);
+ return (uint16_t)value;
}
return (uint16_t)rte_atomic16_add_return(&shinfo->refcnt_atomic, value);