Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/427/?format=api
https://patches.dpdk.org/api/patches/427/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20140918150312.GF20389@hmsreliant.think-freely.org/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20140918150312.GF20389@hmsreliant.think-freely.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20140918150312.GF20389@hmsreliant.think-freely.org", "date": "2014-09-18T15:03:12", "name": "[dpdk-dev] ixgbe: fix compile error with gcc4.4 (used RHEL 6)", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "7e49f73ba19b9ecd779776da11b86025933fbcce", "submitter": { "id": 32, "url": "https://patches.dpdk.org/api/people/32/?format=api", "name": "Neil Horman", "email": "nhorman@tuxdriver.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20140918150312.GF20389@hmsreliant.think-freely.org/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/427/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/427/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 5DEC7B3A9;\n\tThu, 18 Sep 2014 16:57:39 +0200 (CEST)", "from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58])\n\tby dpdk.org (Postfix) with ESMTP id 560AFB3A3\n\tfor <dev@dpdk.org>; Thu, 18 Sep 2014 16:57:37 +0200 (CEST)", "from hmsreliant.think-freely.org\n\t([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost)\n\tby smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63)\n\t(envelope-from <nhorman@tuxdriver.com>)\n\tid 1XUdEn-0002M3-1W; Thu, 18 Sep 2014 11:03:19 -0400" ], "Date": "Thu, 18 Sep 2014 11:03:12 -0400", "From": "Neil Horman <nhorman@tuxdriver.com>", "To": "\"Richardson, Bruce\" <bruce.richardson@intel.com>", "Message-ID": "<20140918150312.GF20389@hmsreliant.think-freely.org>", "References": "<1411037752-8000-1-git-send-email-bruce.richardson@intel.com>\n\t<5076244.KSjCyF24zI@xps13>\n\t<20140918122527.GE20389@hmsreliant.think-freely.org>\n\t<59AF69C657FD0841A61C55336867B5B0343F3406@IRSMSX103.ger.corp.intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "In-Reply-To": "<59AF69C657FD0841A61C55336867B5B0343F3406@IRSMSX103.ger.corp.intel.com>", "User-Agent": "Mutt/1.5.23 (2014-03-12)", "X-Spam-Score": "-2.9 (--)", "X-Spam-Status": "No", "Cc": "\"dev@dpdk.org\" <dev@dpdk.org>", "Subject": "Re: [dpdk-dev] [PATCH] ixgbe: fix compile error with gcc4.4 (used\n\tRHEL 6)", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "On Thu, Sep 18, 2014 at 12:35:21PM +0000, Richardson, Bruce wrote:\n> > -----Original Message-----\n> > From: Neil Horman [mailto:nhorman@tuxdriver.com]\n> > Sent: Thursday, September 18, 2014 1:25 PM\n> > To: Thomas Monjalon\n> > Cc: Richardson, Bruce; dev@dpdk.org\n> > Subject: Re: [dpdk-dev] [PATCH] ixgbe: fix compile error with gcc4.4 (used RHEL\n> > 6)\n> > \n> > On Thu, Sep 18, 2014 at 01:09:16PM +0200, Thomas Monjalon wrote:\n> > > > The refcnt field is contained within an anonymous union within the mbuf\n> > > > data structure, and gcc 4.4 gives an error about an unknown field unless\n> > > > the initialiser for the field is contained within extra braces.\n> > > >\n> > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>\n> > >\n> > > Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>\n> > >\n> > > Thanks Bruce, it is now applied.\n> > \n> > Hang on here, we use anonymous unions all the time in RHEL6, and make\n> > assignments to them frequently, and the compiler doesn't complain (see the\n> > dropcount variable in sk_buff for an example). Not saying that this is a big\n> > deal, but can you explain a little more about what you're seeing when this error\n> > occurs, before we just paper over it?\n> > \n> \n> Originally reported on RHEL6 as a build failure. When I use gcc4.4 on Fedora 20, I get the following without this change:\n> \n> CC ixgbe_rxtx_vec.o\n> == Build lib/librte_table\n> /home/bruce/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c: In function 'ixgbe_rxq_vec_setup':\n> /home/bruce/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c:726: error: unknown field 'refcnt' specified in initializer\n> compilation terminated due to -Wfatal-errors.\n> make[5]: *** [ixgbe_rxtx_vec.o] Error 1\n> make[4]: *** [librte_pmd_ixgbe] Error 2\n> make[4]: *** Waiting for unfinished jobs....\n> make[3]: *** [lib] Error 2\n> make[2]: *** [all] Error 2\n> make[1]: *** [x86_64-native-linuxapp-gcc_install] Error 2\n> make: *** [install] Error 2\n> \n> Regards,\n> /Bruce\n> \n\n\nThank you, I've reproduced the problem here, and you're right, it is a compiler\nbug, but I really hate the idea of just throwing braces around something to shut\nthe compiler up, especially when the compiler has since been fixed. Looking at\nit a bit more closely it seems like the the thing to do is actually just\nconsistently use rte_mbuf_refcnt_set, since thats what the rte_mbuf header\ndocumentation says to do, and protects you if the internal structure changes, as\nwell as prevents you from having to spread ifdef RTE_MBUF_REFCNT all over the\nplace.\n\nThis patch does a bit more than that too. With a little creative typedef-ing we\ndon't need the anonymous union at all, and lets us just use a single refcnt\nvariable, and I think eliminate that odd refcnt_reserved member of the union,\nthat, as far as I can see, does nothing.\n\nThoughts?", "diff": "diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c\nindex 66bcbc5..5bd634e 100644\n--- a/app/test/test_mbuf.c\n+++ b/app/test/test_mbuf.c\n@@ -760,14 +760,14 @@ test_failing_mbuf_sanity_check(void)\n \n #ifdef RTE_MBUF_REFCNT\n \tbadbuf = *buf;\n-\tbadbuf.refcnt = 0;\n+\trte_mbuf_refcnt_set(&badbuf, 0);\n \tif (verify_mbuf_check_panics(&badbuf)) {\n \t\tprintf(\"Error with bad-refcnt(0) mbuf test\\n\");\n \t\treturn -1;\n \t}\n \n \tbadbuf = *buf;\n-\tbadbuf.refcnt = UINT16_MAX;\n+\trte_mbuf_refcnt_set(&badbuf, UINT16_MAX);\n \tif (verify_mbuf_check_panics(&badbuf)) {\n \t\tprintf(\"Error with bad-refcnt(MAX) mbuf test\\n\");\n \t\treturn -1;\ndiff --git a/config/common_linuxapp b/config/common_linuxapp\nindex 5bee910..a001231 100644\n--- a/config/common_linuxapp\n+++ b/config/common_linuxapp\n@@ -123,7 +123,7 @@ CONFIG_RTE_LOG_HISTORY=256\n CONFIG_RTE_LIBEAL_USE_HPET=n\n CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n\n CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n\n-CONFIG_RTE_EAL_IGB_UIO=y\n+CONFIG_RTE_EAL_IGB_UIO=n\n CONFIG_RTE_EAL_VFIO=y\n \n #\n@@ -381,7 +381,7 @@ CONFIG_RTE_LIBRTE_PIPELINE=y\n #\n # Compile librte_kni\n #\n-CONFIG_RTE_LIBRTE_KNI=y\n+CONFIG_RTE_LIBRTE_KNI=n\n CONFIG_RTE_KNI_KO_DEBUG=n\n CONFIG_RTE_KNI_VHOST=n\n CONFIG_RTE_KNI_VHOST_MAX_CACHE_SIZE=1024\ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\nindex 1c6e115..3fca0fb 100644\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ b/lib/librte_mbuf/rte_mbuf.h\n@@ -120,6 +120,15 @@ extern \"C\" {\n typedef void *MARKER[0]; /**< generic marker for a point in a structure */\n typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes\n * with a single assignment */\n+\n+#ifdef RTE_MBUF_REFCNT\n+#ifdef RTE_MBUF_REFCNT_ATOMIC\n+typedef rte_atomic16_t rte_refcnt;\n+#else\n+typedef uint16_t rte_refcnt;\n+#endif\n+#endif\n+\n /**\n * The generic rte_mbuf, containing a packet mbuf.\n */\n@@ -142,13 +151,9 @@ struct rte_mbuf {\n \t * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC\n \t * config option.\n \t */\n-\tunion {\n #ifdef RTE_MBUF_REFCNT\n-\t\trte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */\n-\t\tuint16_t refcnt; /**< Non-atomically accessed refcnt */\n+\trte_refcnt refcnt;\n #endif\n-\t\tuint16_t refcnt_reserved; /**< Do not use this field */\n-\t};\n \tuint8_t nb_segs; /**< Number of segments. */\n \tuint8_t port; /**< Input port. */\n \n@@ -250,6 +255,7 @@ if (!(exp)) { \\\n #ifdef RTE_MBUF_REFCNT\n #ifdef RTE_MBUF_REFCNT_ATOMIC\n \n+\n /**\n * Adds given value to an mbuf's refcnt and returns its new value.\n * @param m\n@@ -262,7 +268,7 @@ if (!(exp)) { \\\n static inline uint16_t\n rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)\n {\n-\treturn (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value));\n+\treturn (uint16_t)(rte_atomic16_add_return(&m->refcnt, value));\n }\n \n /**\n@@ -275,7 +281,7 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)\n static inline uint16_t\n rte_mbuf_refcnt_read(const struct rte_mbuf *m)\n {\n-\treturn (uint16_t)(rte_atomic16_read(&m->refcnt_atomic));\n+\treturn (uint16_t)(rte_atomic16_read(&m->refcnt));\n }\n \n /**\n@@ -288,7 +294,7 @@ rte_mbuf_refcnt_read(const struct rte_mbuf *m)\n static inline void\n rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)\n {\n-\trte_atomic16_set(&m->refcnt_atomic, new_value);\n+\trte_atomic16_set(&m->refcnt, new_value);\n }\n \n #else /* ! RTE_MBUF_REFCNT_ATOMIC */\ndiff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\nindex 203ddf7..4a80224 100644\n--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\n+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\n@@ -722,11 +722,9 @@ ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq)\n \tstatic struct rte_mbuf mb_def = {\n \t\t.nb_segs = 1,\n \t\t.data_off = RTE_PKTMBUF_HEADROOM,\n-#ifdef RTE_MBUF_REFCNT\n-\t\t{ .refcnt = 1, }\n-#endif\n \t};\n \n+\trte_mbuf_refcnt_set(&mb_def, 1);\n \tmb_def.buf_len = rxq->mb_pool->elt_size - sizeof(struct rte_mbuf);\n \tmb_def.port = rxq->port_id;\n \trxq->mbuf_initializer = *((uint64_t *)&mb_def.rearm_data);\n", "prefixes": [ "dpdk-dev" ] }{ "id": 427, "url": "