Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/40302/?format=api
https://patches.dpdk.org/api/patches/40302/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/152695228241.111551.3452110086254916700.stgit@localhost.localdomain/", "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": "<152695228241.111551.3452110086254916700.stgit@localhost.localdomain>", "list_archive_url": "https://inbox.dpdk.org/dev/152695228241.111551.3452110086254916700.stgit@localhost.localdomain", "date": "2018-05-22T01:24:42", "name": "[dpdk-dev,v7,7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "08f4ee35e137d9a5cfb45028f6b54ea8d21b135e", "submitter": { "id": 1029, "url": "https://patches.dpdk.org/api/people/1029/?format=api", "name": "Andy Green", "email": "andy@warmcat.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/152695228241.111551.3452110086254916700.stgit@localhost.localdomain/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/40302/comments/", "check": "warning", "checks": "https://patches.dpdk.org/api/patches/40302/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id AAC202F7D;\n\tTue, 22 May 2018 03:24:48 +0200 (CEST)", "from mail.warmcat.com (mail.warmcat.com [163.172.24.82])\n\tby dpdk.org (Postfix) with ESMTP id 5516F2BAA\n\tfor <dev@dpdk.org>; Tue, 22 May 2018 03:24:46 +0200 (CEST)" ], "From": "Andy Green <andy@warmcat.com>", "To": "dev@dpdk.org", "Cc": "thomas@monjalon.net", "Date": "Tue, 22 May 2018 09:24:42 +0800", "Message-ID": "<152695228241.111551.3452110086254916700.stgit@localhost.localdomain>", "In-Reply-To": "<152695215195.111551.10652921922687464367.stgit@localhost.localdomain>", "References": "<152695215195.111551.10652921922687464367.stgit@localhost.localdomain>", "User-Agent": "StGit/unknown-version", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Subject": "[dpdk-dev] [PATCH v7 7/8] rte_mbuf.h: add and subtract explicitly\n\tto avoid promotion", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://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": "<https://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": "/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:\n In function 'rte_pktmbuf_prepend':\n /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:\n 1908:17: warning: conversion from 'int' to 'uint16_t'\n {aka 'short unsigned int'} may change value [-Wconversion]\n m->data_off -= len;\n ^~~\n m->data_off is a uint16_t\n\n uint16_t data_off;\n\n len (a uint16_t) is promoted to an int using -=. Do the\n subtraction explicitly and cast the result to uint16_t.\n\n - m->data_off -= len;\n + m->data_off = (uint16_t)(m->data_off - len);\n\n The below += or -= changes are solving the same thing.\n\n /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:\n In function 'rte_pktmbuf_adj':\n /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:\n 1969:17: warning: conversion from 'int' to 'uint16_t'\n {aka 'short unsigned int'} may change value [-Wconversion]\n m->data_off += len;\n ^~~\n /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:\n In function 'rte_pktmbuf_chain':\n /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:\n 2082:19: warning: conversion from 'int' to 'uint16_t'\n {aka 'short unsigned int'} may change value [-Wconversion]\n head->nb_segs += tail->nb_segs;\n ^~~~\n Also uint16_t\n\n uint16_t nb_segs; /**< Number of segments. */\n\nFixes: 08b563ffb1 (\"mbuf: replace data pointer by an offset\")\nSigned-off-by: Andy Green <andy@warmcat.com>\nAcked-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/librte_mbuf/rte_mbuf.h | 17 +++++++++++++----\n 1 file changed, 13 insertions(+), 4 deletions(-)", "diff": "diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\nindex 0e89a6927..e136d12b7 100644\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ b/lib/librte_mbuf/rte_mbuf.h\n@@ -1908,7 +1908,10 @@ static inline char *rte_pktmbuf_prepend(struct rte_mbuf *m,\n \tif (unlikely(len > rte_pktmbuf_headroom(m)))\n \t\treturn NULL;\n \n-\tm->data_off -= len;\n+\t/* NB: elaborating the subtraction like this instead of using\n+\t * -= allows us to ensure the result type is uint16_t\n+\t * avoiding compiler warnings on gcc 8.1 at least */\n+\tm->data_off = (uint16_t)(m->data_off - len);\n \tm->data_len = (uint16_t)(m->data_len + len);\n \tm->pkt_len = (m->pkt_len + len);\n \n@@ -1968,8 +1971,11 @@ static inline char *rte_pktmbuf_adj(struct rte_mbuf *m, uint16_t len)\n \tif (unlikely(len > m->data_len))\n \t\treturn NULL;\n \n+\t/* NB: elaborating the addition like this instead of using\n+\t * += allows us to ensure the result type is uint16_t\n+\t * avoiding compiler warnings on gcc 8.1 at least */\n \tm->data_len = (uint16_t)(m->data_len - len);\n-\tm->data_off += len;\n+\tm->data_off = (uint16_t)(m->data_off + len);\n \tm->pkt_len = (m->pkt_len - len);\n \treturn (char *)m->buf_addr + m->data_off;\n }\n@@ -2081,8 +2087,11 @@ static inline int rte_pktmbuf_chain(struct rte_mbuf *head, struct rte_mbuf *tail\n \tcur_tail = rte_pktmbuf_lastseg(head);\n \tcur_tail->next = tail;\n \n-\t/* accumulate number of segments and total length. */\n-\thead->nb_segs += tail->nb_segs;\n+\t/* accumulate number of segments and total length.\n+\t * NB: elaborating the addition like this instead of using\n+\t * -= allows us to ensure the result type is uint16_t\n+\t * avoiding compiler warnings on gcc 8.1 at least */\n+\thead->nb_segs = (uint16_t)(head->nb_segs + tail->nb_segs);\n \thead->pkt_len += tail->pkt_len;\n \n \t/* pkt_len is only set in the head */\n", "prefixes": [ "dpdk-dev", "v7", "7/8" ] }{ "id": 40302, "url": "