From: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH] ixgbe: fix compile error with gcc4.4 (used RHEL 6)
Date: Thu, 18 Sep 2014 17:38:58 +0200 [thread overview]
Message-ID: <2042613.z76ONrFlF0@xps13> (raw)
In-Reply-To: <20140918150312.GF20389-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
Hi Neil,
2014-09-18 11:03, Neil Horman:
> Thank you, I've reproduced the problem here, and you're right, it is a
> compiler bug, but I really hate the idea of just throwing braces around
> something to shut the compiler up, especially when the compiler has since
> been fixed. Looking at it a bit more closely it seems like the the thing
> to do is actually just consistently use rte_mbuf_refcnt_set, since thats
> what the rte_mbuf header documentation says to do, and protects you if the
> internal structure changes, as well as prevents you from having to spread
> ifdef RTE_MBUF_REFCNT all over the place.
>
> This patch does a bit more than that too. With a little creative
> typedef-ing we don't need the anonymous union at all, and lets us just use
> a single refcnt variable, and I think eliminate that odd refcnt_reserved
> member of the union, that, as far as I can see, does nothing.
> --- a/config/common_linuxapp
> +++ b/config/common_linuxapp
> @@ -123,7 +123,7 @@ CONFIG_RTE_LOG_HISTORY=256
> CONFIG_RTE_LIBEAL_USE_HPET=n
> CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
> CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
> -CONFIG_RTE_EAL_IGB_UIO=y
> +CONFIG_RTE_EAL_IGB_UIO=n
> CONFIG_RTE_EAL_VFIO=y
Hum, indeed this patch does a bit more ;)
[...]
> -CONFIG_RTE_LIBRTE_KNI=y
> +CONFIG_RTE_LIBRTE_KNI=n
> CONFIG_RTE_KNI_KO_DEBUG=n
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -120,6 +120,15 @@ extern "C" {
> typedef void *MARKER[0]; /**< generic marker for a point in a
> structure */ typedef uint64_t MARKER64[0]; /**< marker that allows us to
> overwrite 8 bytes * with a single assignment */
> +
> +#ifdef RTE_MBUF_REFCNT
> +#ifdef RTE_MBUF_REFCNT_ATOMIC
> +typedef rte_atomic16_t rte_refcnt;
> +#else
> +typedef uint16_t rte_refcnt;
> +#endif
> +#endif
> +
> /**
> * The generic rte_mbuf, containing a packet mbuf.
> */
> @@ -142,13 +151,9 @@ struct rte_mbuf {
> * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
> * config option.
> */
> - union {
> #ifdef RTE_MBUF_REFCNT
> - rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */
> - uint16_t refcnt; /**< Non-atomically accessed refcnt */
> + rte_refcnt refcnt;
> #endif
> - uint16_t refcnt_reserved; /**< Do not use this field */
> - };
You are changing the mbuf alignment if MBUF_REFCNT is disabled.
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
> @@ -722,11 +722,9 @@ ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq)
> static struct rte_mbuf mb_def = {
> .nb_segs = 1,
> .data_off = RTE_PKTMBUF_HEADROOM,
> -#ifdef RTE_MBUF_REFCNT
> - { .refcnt = 1, }
> -#endif
> };
>
> + rte_mbuf_refcnt_set(&mb_def, 1);
Performance impact must be checked here.
--
Thomas
next prev parent reply other threads:[~2014-09-18 15:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 10:55 [PATCH] ixgbe: fix compile error with gcc4.4 (used RHEL 6) Bruce Richardson
[not found] ` <1411037752-8000-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-18 11:09 ` Thomas Monjalon
2014-09-18 12:25 ` Neil Horman
[not found] ` <20140918122527.GE20389-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-09-18 12:35 ` Richardson, Bruce
[not found] ` <59AF69C657FD0841A61C55336867B5B0343F3406-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-09-18 15:03 ` Neil Horman
[not found] ` <20140918150312.GF20389-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-09-18 15:16 ` Bruce Richardson
2014-09-18 15:46 ` Neil Horman
2014-09-18 15:38 ` Thomas Monjalon [this message]
2014-09-18 15:50 ` Neil Horman
[not found] ` <20140918155044.GI20389-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-09-18 16:01 ` Richardson, Bruce
[not found] ` <59AF69C657FD0841A61C55336867B5B0343F358D-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-09-18 18:12 ` Neil Horman
2014-09-25 2:13 ` Tang, HaifengX
[not found] ` <DF029FFF923C334FAA58CEEB2979DCA6014651D9-0J0gbvR4kTggGBtAFL8yw7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-09-25 7:02 ` Thomas Monjalon
2014-09-25 13:07 ` Cao, Waterman
[not found] ` <AA3F441F262C58498CD6D0C1801DE7EB0AB7DCC9-0J0gbvR4kTggGBtAFL8yw7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-09-25 15:05 ` patches validation Thomas Monjalon
2014-09-25 23:29 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB9772582137AB66-kPTMFJFq+rGvNW/NfzhIbrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-09-26 9:23 ` Thomas Monjalon
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=2042613.z76ONrFlF0@xps13 \
--to=thomas.monjalon-pdr9zngts4eavxtiumwx3w@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.org \
--cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.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).