Show a patch.

Update a patch.

Update a patch.

GET /api/patches/427/?format=api
Content-Type: application/json
Vary: Accept

    "id": 427,
    "url": "",
    "web_url": "",
    "project": {
        "id": 1,
        "url": "",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "",
        "list_email": "",
        "web_url": "",
        "scm_url": "git://",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "{}",
        "commit_url_format": ""
    "msgid": "<>",
    "list_archive_url": "",
    "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": "",
        "name": "Neil Horman",
        "email": ""
    "delegate": null,
    "mbox": "",
    "series": [],
    "comments": "",
    "check": "pending",
    "checks": "",
    "tags": {},
    "related": [],
    "headers": {
        "List-Help": "<>",
        "User-Agent": "Mutt/1.5.23 (2014-03-12)",
        "Received": [
            "from [] (localhost [IPv6:::1])\n\tby (Postfix) with ESMTP id 5DEC7B3A9;\n\tThu, 18 Sep 2014 16:57:39 +0200 (CEST)",
            "from ( [])\n\tby (Postfix) with ESMTP id 560AFB3A3\n\tfor <>; Thu, 18 Sep 2014 16:57:37 +0200 (CEST)",
            "from\n\t([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost)\n\tby with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63)\n\t(envelope-from <>)\n\tid 1XUdEn-0002M3-1W; Thu, 18 Sep 2014 11:03:19 -0400"
        "X-Mailman-Version": "2.1.15",
        "X-Spam-Score": "-2.9 (--)",
        "Return-Path": "<>",
        "List-Subscribe": "<>,\n\t<>",
        "To": "\"Richardson, Bruce\" <>",
        "X-Spam-Status": "No",
        "Delivered-To": "",
        "List-Id": "patches and discussions about DPDK <>",
        "References": "<>\n\t<5076244.KSjCyF24zI@xps13>\n\t<>\n\t<>",
        "List-Unsubscribe": "<>,\n\t<>",
        "List-Post": "<>",
        "X-Original-To": "",
        "Sender": "\"dev\" <>",
        "From": "Neil Horman <>",
        "Content-Disposition": "inline",
        "Precedence": "list",
        "Message-ID": "<>",
        "Subject": "Re: [dpdk-dev] [PATCH] ixgbe: fix compile error with gcc4.4 (used\n\tRHEL 6)",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "In-Reply-To": "<>",
        "X-BeenThere": "",
        "Errors-To": "",
        "List-Archive": "<>",
        "Cc": "\"\" <>",
        "Date": "Thu, 18 Sep 2014 11:03:12 -0400"
    "content": "On Thu, Sep 18, 2014 at 12:35:21PM +0000, Richardson, Bruce wrote:\n> > -----Original Message-----\n> > From: Neil Horman []\n> > Sent: Thursday, September 18, 2014 1:25 PM\n> > To: Thomas Monjalon\n> > Cc: Richardson, Bruce;\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 <>\n> > >\n> > > Acked-by: Thomas Monjalon <>\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/ In function 'ixgbe_rxq_vec_setup':\n> /home/bruce/ 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": [