Show a patch.

GET /api/patches/360/
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 360,
    "url": "https://patches.dpdk.org/api/patches/360/",
    "web_url": "https://patches.dpdk.org/patch/360/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1410457641-3540-5-git-send-email-balazs.nemeth@intel.com>",
    "date": "2014-09-11T17:47:21",
    "name": "[dpdk-dev,4/4] lib/librte_table: Fix pointer calculations at initialization",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b9798dc336d6232381fbbf64590718e5f4e2d2f8",
    "submitter": {
        "id": 67,
        "url": "https://patches.dpdk.org/api/people/67/",
        "name": "Balazs Nemeth",
        "email": "balazs.nemeth@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/360/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/360/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/360/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Cc": "Balazs Nemeth <balazs.nemeth@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Date": "Thu, 11 Sep 2014 19:47:21 +0200",
        "In-Reply-To": "<1410457641-3540-1-git-send-email-balazs.nemeth@intel.com>",
        "Precedence": "list",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<1410457641-3540-1-git-send-email-balazs.nemeth@intel.com>",
        "X-Mailer": "git-send-email 2.1.0",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "To": "dev@dpdk.org",
        "Errors-To": "dev-bounces@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 34702B3A9;\n\tThu, 11 Sep 2014 19:41:37 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 18B57B398\n\tfor <dev@dpdk.org>; Thu, 11 Sep 2014 19:41:33 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga102.jf.intel.com with ESMTP; 11 Sep 2014 10:40:14 -0700",
            "from bnemeth-mobl.ger.corp.intel.com (HELO localhost.localdomain)\n\t([172.22.195.53])\n\tby orsmga002.jf.intel.com with ESMTP; 11 Sep 2014 10:46:20 -0700"
        ],
        "From": "Balazs Nemeth <balazs.nemeth@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Delivered-To": "patchwork@dpdk.org",
        "Message-Id": "<1410457641-3540-5-git-send-email-balazs.nemeth@intel.com>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH 4/4] lib/librte_table: Fix pointer calculations\n\tat initialization",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,506,1406617200\"; d=\"scan'208\";a=\"601588476\"",
        "X-ExtLoop1": "1",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "During initialization of rte_table_hash_ext and rte_table_hash_lru, a\ncontiguous region of memory is allocated to store meta data, buckets,\nextended buckets, keys, stack of keys, stack of extended buckets and\ndata entries. The size of each region depends on the hash table\nconfiguration.\n\nThe address of each region is calculated using offsets relative to the\nbeginning of the memory region. Without this patch, the offsets\ncontain the size of the table meta data (sizeof(struct\nrte_table_hash)). These addresses are stored in pointers which are\nused when entries are added or deleted and lookups are performed.\n\nInstead of adding these offsets to the address of the beginning of the\nmemory region, they are added to the address of the end of the meta\ndata (= address of the beginning of the memory region + sizeof(struct\nrte_table_hash)). The resulting addresses are off by sizeof(struct\nrte_table_hash) bytes. As a consequence, memory past the allocated\nregion can be accessed by the add, delete and lookup operations.\n\nThis patch corrects the address calculation by not including the size\nof the meta data in the offsets.\n\nSigned-off-by: Balazs Nemeth <balazs.nemeth@intel.com>\n---\n lib/librte_table/rte_table_hash_ext.c | 5 ++---\n lib/librte_table/rte_table_hash_lru.c | 5 ++---\n 2 files changed, 4 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c\nindex fb3e6d2..467f48a 100644\n--- a/lib/librte_table/rte_table_hash_ext.c\n+++ b/lib/librte_table/rte_table_hash_ext.c\n@@ -170,7 +170,7 @@ rte_table_hash_ext_create(void *params, int socket_id, uint32_t entry_size)\n \tstruct rte_table_hash_ext_params *p =\n \t\t(struct rte_table_hash_ext_params *) params;\n \tstruct rte_table_hash *t;\n-\tuint32_t total_size, table_meta_sz, table_meta_offset;\n+\tuint32_t total_size, table_meta_sz;\n \tuint32_t bucket_sz, bucket_ext_sz, key_sz;\n \tuint32_t key_stack_sz, bkt_ext_stack_sz, data_sz;\n \tuint32_t bucket_offset, bucket_ext_offset, key_offset;\n@@ -224,8 +224,7 @@ rte_table_hash_ext_create(void *params, int socket_id, uint32_t entry_size)\n \tt->data_size_shl = __builtin_ctzl(entry_size);\n \n \t/* Tables */\n-\ttable_meta_offset = 0;\n-\tbucket_offset = table_meta_offset + table_meta_sz;\n+\tbucket_offset = 0;\n \tbucket_ext_offset = bucket_offset + bucket_sz;\n \tkey_offset = bucket_ext_offset + bucket_ext_sz;\n \tkey_stack_offset = key_offset + key_sz;\ndiff --git a/lib/librte_table/rte_table_hash_lru.c b/lib/librte_table/rte_table_hash_lru.c\nindex bf92e81..f94c0a2 100644\n--- a/lib/librte_table/rte_table_hash_lru.c\n+++ b/lib/librte_table/rte_table_hash_lru.c\n@@ -147,7 +147,7 @@ rte_table_hash_lru_create(void *params, int socket_id, uint32_t entry_size)\n \tstruct rte_table_hash_lru_params *p =\n \t\t(struct rte_table_hash_lru_params *) params;\n \tstruct rte_table_hash *t;\n-\tuint32_t total_size, table_meta_sz, table_meta_offset;\n+\tuint32_t total_size, table_meta_sz;\n \tuint32_t bucket_sz, key_sz, key_stack_sz, data_sz;\n \tuint32_t bucket_offset, key_offset, key_stack_offset, data_offset;\n \tuint32_t i;\n@@ -195,8 +195,7 @@ rte_table_hash_lru_create(void *params, int socket_id, uint32_t entry_size)\n \tt->data_size_shl = __builtin_ctzl(entry_size);\n \n \t/* Tables */\n-\ttable_meta_offset = 0;\n-\tbucket_offset = table_meta_offset + table_meta_sz;\n+\tbucket_offset = 0;\n \tkey_offset = bucket_offset + bucket_sz;\n \tkey_stack_offset = key_offset + key_sz;\n \tdata_offset = key_stack_offset + key_stack_sz;\n",
    "prefixes": [
        "dpdk-dev",
        "4/4"
    ]
}