Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/5604/?format=api
https://patches.dpdk.org/api/patches/5604/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1434730599-24339-4-git-send-email-olivier.matz@6wind.com/", "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": "<1434730599-24339-4-git-send-email-olivier.matz@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1434730599-24339-4-git-send-email-olivier.matz@6wind.com", "date": "2015-06-19T16:16:39", "name": "[dpdk-dev,v2,3/3] mempool: fix typos, indentation, and doxygen style", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "bbadfbecf7568b357fea63ae3258e3c5c623dd7a", "submitter": { "id": 8, "url": "https://patches.dpdk.org/api/people/8/?format=api", "name": "Olivier Matz", "email": "olivier.matz@6wind.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1434730599-24339-4-git-send-email-olivier.matz@6wind.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/5604/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/5604/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 50A97C5A2;\n\tFri, 19 Jun 2015 18:17:03 +0200 (CEST)", "from mail-wg0-f42.google.com (mail-wg0-f42.google.com\n\t[74.125.82.42]) by dpdk.org (Postfix) with ESMTP id B05FFC46C\n\tfor <dev@dpdk.org>; Fri, 19 Jun 2015 18:16:55 +0200 (CEST)", "by wgez8 with SMTP id z8so93696824wge.0\n\tfor <dev@dpdk.org>; Fri, 19 Jun 2015 09:16:55 -0700 (PDT)", "from glumotte.dev.6wind.com (6wind.net2.nerim.net.\n\t[213.41.151.210]) by mx.google.com with ESMTPSA id\n\tef10sm17739604wjd.49.2015.06.19.09.16.54\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 19 Jun 2015 09:16:54 -0700 (PDT)" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=DGetglOhRTIJ2SxC5tPJX0eRg32iMAUYoOQiIax4jaA=;\n\tb=LAGCPa3IR+DhshqCMBKkS797S9mMxkhVrMnyWs7sx8ZJ7rXm0Emduz/luYMxJoxl72\n\taRsGhYv2JRFr0Bfe1wKaWZL8DoXVV1Plu3jD9hO4DNaEMw7ozOf7aCf1jd/1dMJEliFy\n\tkvwdU57rMNK/DgLiwFrRO0buF6UbxhEqhwPsa9Gj45sI4JyGU/9E9ddswOprhIkqq477\n\tQsQDouloxFIcVJtHtNqsG7dN0n/ECRuLbM7493pjMUP2O3bVAuMoXU908uBE1QVaBaz1\n\tdjwJiHeRb479Cs7lWvzt0UyHmXGnUFuqKhTV203y4irdZk15IBLqbyWjNHKjayAU5naQ\n\t9IAA==", "X-Gm-Message-State": "ALoCoQnYSWpat7dekoEeOQ3lXXPOr4paHr6M1yrssfP6dNaPJrjTBdjEIoTerG2lDyDmksoevoT6", "X-Received": "by 10.181.11.165 with SMTP id ej5mr8110478wid.32.1434730615588; \n\tFri, 19 Jun 2015 09:16:55 -0700 (PDT)", "From": "Olivier Matz <olivier.matz@6wind.com>", "To": "dev@dpdk.org", "Date": "Fri, 19 Jun 2015 18:16:39 +0200", "Message-Id": "<1434730599-24339-4-git-send-email-olivier.matz@6wind.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1434730599-24339-1-git-send-email-olivier.matz@6wind.com>", "References": "<1433150143-5842-1-git-send-email-olivier.matz@6wind.com>\n\t<1434730599-24339-1-git-send-email-olivier.matz@6wind.com>", "Subject": "[dpdk-dev] [PATCH v2 3/3] mempool: fix typos, indentation,\n\tand doxygen style", "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": "Do some cosmetic clean-up.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n lib/librte_mempool/rte_dom0_mempool.c | 36 ++++++++--------\n lib/librte_mempool/rte_mempool.c | 10 ++---\n lib/librte_mempool/rte_mempool.h | 80 ++++++++++++++++++++++-------------\n 3 files changed, 73 insertions(+), 53 deletions(-)", "diff": "diff --git a/lib/librte_mempool/rte_dom0_mempool.c b/lib/librte_mempool/rte_dom0_mempool.c\nindex 8900171..a313b3f 100644\n--- a/lib/librte_mempool/rte_dom0_mempool.c\n+++ b/lib/librte_mempool/rte_dom0_mempool.c\n@@ -61,30 +61,30 @@\n \n static void\n get_phys_map(void *va, phys_addr_t pa[], uint32_t pg_num,\n- uint32_t pg_sz, uint32_t memseg_id)\n+\tuint32_t pg_sz, uint32_t memseg_id)\n {\n- uint32_t i;\n- uint64_t virt_addr, mfn_id;\n- struct rte_mem_config *mcfg;\n- uint32_t page_size = getpagesize();\n-\n- /* get pointer to global configuration */\n- mcfg = rte_eal_get_configuration()->mem_config;\n- virt_addr =(uintptr_t) mcfg->memseg[memseg_id].addr;\n-\n- for (i = 0; i != pg_num; i++) {\n- mfn_id = ((uintptr_t)va + i * pg_sz - virt_addr) / RTE_PGSIZE_2M;\n- pa[i] = mcfg->memseg[memseg_id].mfn[mfn_id] * page_size;\n- }\n+\tuint32_t i;\n+\tuint64_t virt_addr, mfn_id;\n+\tstruct rte_mem_config *mcfg;\n+\tuint32_t page_size = getpagesize();\n+\n+\t/* get pointer to global configuration */\n+\tmcfg = rte_eal_get_configuration()->mem_config;\n+\tvirt_addr =(uintptr_t) mcfg->memseg[memseg_id].addr;\n+\n+\tfor (i = 0; i != pg_num; i++) {\n+\t\tmfn_id = ((uintptr_t)va + i * pg_sz - virt_addr) / RTE_PGSIZE_2M;\n+\t\tpa[i] = mcfg->memseg[memseg_id].mfn[mfn_id] * page_size;\n+\t}\n }\n \n /* create the mempool for supporting Dom0 */\n struct rte_mempool *\n rte_dom0_mempool_create(const char *name, unsigned elt_num, unsigned elt_size,\n- unsigned cache_size, unsigned private_data_size,\n- rte_mempool_ctor_t *mp_init, void *mp_init_arg,\n- rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg,\n- int socket_id, unsigned flags)\n+\tunsigned cache_size, unsigned private_data_size,\n+\trte_mempool_ctor_t *mp_init, void *mp_init_arg,\n+\trte_mempool_obj_ctor_t *obj_init, void *obj_init_arg,\n+\tint socket_id, unsigned flags)\n {\n \tstruct rte_mempool *mp = NULL;\n \tphys_addr_t *pa;\ndiff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c\nindex 60369cf..f592dc7 100644\n--- a/lib/librte_mempool/rte_mempool.c\n+++ b/lib/librte_mempool/rte_mempool.c\n@@ -347,9 +347,9 @@ rte_mempool_xmem_size(uint32_t elt_num, size_t elt_sz, uint32_t pg_shift)\n */\n static void\n mempool_lelem_iter(void *arg, __rte_unused void *start, void *end,\n- __rte_unused uint32_t idx)\n+\t__rte_unused uint32_t idx)\n {\n- *(uintptr_t *)arg = (uintptr_t)end;\n+\t*(uintptr_t *)arg = (uintptr_t)end;\n }\n \n ssize_t\n@@ -521,8 +521,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,\n \n \t/*\n \t * If user provided an external memory buffer, then use it to\n-\t * store mempool objects. Otherwise reserve memzone big enough to\n-\t * hold mempool header and metadata plus mempool objects.\n+\t * store mempool objects. Otherwise reserve a memzone that is large\n+\t * enough to hold mempool header and metadata plus mempool objects.\n \t */\n \tmempool_size = MEMPOOL_HEADER_SIZE(mp, pg_num) + private_data_size;\n \tif (vaddr == NULL)\n@@ -543,7 +543,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,\n \n \t/*\n \t * no more memory: in this case we loose previously reserved\n-\t * space for the as we cannot free it\n+\t * space for the ring as we cannot free it\n \t */\n \tif (mz == NULL) {\n \t\trte_free(te);\ndiff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h\nindex ec1bb2e..a8054e1 100644\n--- a/lib/librte_mempool/rte_mempool.h\n+++ b/lib/librte_mempool/rte_mempool.h\n@@ -109,6 +109,9 @@ struct rte_mempool_cache {\n } __rte_cache_aligned;\n #endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */\n \n+/**\n+ * A structure that stores the size of mempool elements.\n+ */\n struct rte_mempool_objsz {\n \tuint32_t elt_size; /**< Size of an element. */\n \tuint32_t header_size; /**< Size of header (before elt). */\n@@ -206,7 +209,7 @@ struct rte_mempool {\n \tuintptr_t elt_va_end;\n \t/**< Virtual address of the <size + 1> mempool object. */\n \tphys_addr_t elt_pa[MEMPOOL_PG_NUM_DEFAULT];\n-\t/**< Array of physical pages addresses for the mempool objects buffer. */\n+\t/**< Array of physical page addresses for the mempool objects buffer. */\n \n } __rte_cache_aligned;\n \n@@ -217,6 +220,7 @@ struct rte_mempool {\n \n /**\n * @internal When debug is enabled, store some statistics.\n+ *\n * @param mp\n * Pointer to the memory pool.\n * @param name\n@@ -237,18 +241,19 @@ struct rte_mempool {\n #endif\n \n /**\n- * Calculates size of the mempool header.\n+ * Calculate the size of the mempool header.\n+ *\n * @param mp\n * Pointer to the memory pool.\n * @param pgn\n- * Number of page used to store mempool objects.\n+ * Number of pages used to store mempool objects.\n */\n #define\tMEMPOOL_HEADER_SIZE(mp, pgn)\t(sizeof(*(mp)) + \\\n \tRTE_ALIGN_CEIL(((pgn) - RTE_DIM((mp)->elt_pa)) * \\\n \tsizeof ((mp)->elt_pa[0]), RTE_CACHE_LINE_SIZE))\n \n /**\n- * Returns TRUE if whole mempool is allocated in one contiguous block of memory.\n+ * Return true if the whole mempool is in contiguous memory.\n */\n #define\tMEMPOOL_IS_CONTIG(mp) \\\n \t((mp)->pg_num == MEMPOOL_PG_NUM_DEFAULT && \\\n@@ -376,21 +381,25 @@ static inline void __mempool_check_cookies(const struct rte_mempool *mp,\n #endif /* RTE_LIBRTE_MEMPOOL_DEBUG */\n \n /**\n- * An mempool's object iterator callback function.\n+ * A mempool object iterator callback function.\n */\n typedef void (*rte_mempool_obj_iter_t)(void * /*obj_iter_arg*/,\n \tvoid * /*obj_start*/,\n \tvoid * /*obj_end*/,\n \tuint32_t /*obj_index */);\n \n-/*\n- * Iterates across objects of the given size and alignment in the\n+/**\n+ * Call a function for each mempool object in a memory chunk\n+ *\n+ * Iterate across objects of the given size and alignment in the\n * provided chunk of memory. The given memory buffer can consist of\n * disjoint physical pages.\n- * For each object calls the provided callback (if any).\n- * Used to populate mempool, walk through all elements of the mempool,\n- * estimate how many elements of the given size could be created in the given\n- * memory buffer.\n+ *\n+ * For each object, calls the provided callback (if any). This function\n+ * is used to populate mempool, walk through all elements of the\n+ * mempool, estimate how many elements of the given size could be\n+ * created in the given memory buffer.\n+ *\n * @param vaddr\n * Virtual address of the memory buffer.\n * @param elt_num\n@@ -398,7 +407,7 @@ typedef void (*rte_mempool_obj_iter_t)(void * /*obj_iter_arg*/,\n * @param elt_sz\n * Size of each object.\n * @param paddr\n- * Array of phyiscall addresses of the pages that comprises given memory\n+ * Array of physical addresses of the pages that comprises given memory\n * buffer.\n * @param pg_num\n * Number of elements in the paddr array.\n@@ -407,7 +416,7 @@ typedef void (*rte_mempool_obj_iter_t)(void * /*obj_iter_arg*/,\n * @param obj_iter\n * Object iterator callback function (could be NULL).\n * @param obj_iter_arg\n- * User defined Prameter for the object iterator callback function.\n+ * User defined parameter for the object iterator callback function.\n *\n * @return\n * Number of objects iterated through.\n@@ -437,7 +446,7 @@ typedef void (rte_mempool_obj_ctor_t)(struct rte_mempool *, void *,\n typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *);\n \n /**\n- * Creates a new mempool named *name* in memory.\n+ * Create a new mempool named *name* in memory.\n *\n * This function uses ``memzone_reserve()`` to allocate memory. The\n * pool contains n elements of elt_size. Its size is set to n.\n@@ -525,14 +534,14 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,\n \t\t int socket_id, unsigned flags);\n \n /**\n- * Creates a new mempool named *name* in memory.\n+ * Create a new mempool named *name* in memory.\n *\n * This function uses ``memzone_reserve()`` to allocate memory. The\n * pool contains n elements of elt_size. Its size is set to n.\n * Depending on the input parameters, mempool elements can be either allocated\n * together with the mempool header, or an externally provided memory buffer\n * could be used to store mempool objects. In later case, that external\n- * memory buffer can consist of set of disjoint phyiscal pages.\n+ * memory buffer can consist of set of disjoint physical pages.\n *\n * @param name\n * The name of the mempool.\n@@ -601,7 +610,7 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,\n * Virtual address of the externally allocated memory buffer.\n * Will be used to store mempool objects.\n * @param paddr\n- * Array of phyiscall addresses of the pages that comprises given memory\n+ * Array of physical addresses of the pages that comprises given memory\n * buffer.\n * @param pg_num\n * Number of elements in the paddr array.\n@@ -627,12 +636,12 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,\n \n #ifdef RTE_LIBRTE_XEN_DOM0\n /**\n- * Creates a new mempool named *name* in memory on Xen Dom0.\n+ * Create a new mempool named *name* in memory on Xen Dom0.\n *\n * This function uses ``rte_mempool_xmem_create()`` to allocate memory. The\n * pool contains n elements of elt_size. Its size is set to n.\n * All elements of the mempool are allocated together with the mempool header,\n- * and memory buffer can consist of set of disjoint phyiscal pages.\n+ * and memory buffer can consist of set of disjoint physical pages.\n *\n * @param name\n * The name of the mempool.\n@@ -1305,8 +1314,11 @@ void rte_mempool_list_dump(FILE *f);\n struct rte_mempool *rte_mempool_lookup(const char *name);\n \n /**\n+ * Get the header, trailer and total size of a mempool element.\n+ *\n * Given a desired size of the mempool element and mempool flags,\n- * caluclates header, trailer, body and total sizes of the mempool object.\n+ * calculates header, trailer, body and total sizes of the mempool object.\n+ *\n * @param elt_size\n * The size of each element.\n * @param flags\n@@ -1322,11 +1334,16 @@ uint32_t rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags,\n \tstruct rte_mempool_objsz *sz);\n \n /**\n- * Calculate maximum amount of memory required to store given number of objects.\n- * Assumes that the memory buffer will be aligned at page boundary.\n- * Note, that if object size is bigger then page size, then it assumes that\n- * we have a subsets of physically continuous pages big enough to store\n- * at least one object.\n+ * Get the size of memory required to store mempool elements.\n+ *\n+ * Calculate the maximum amount of memory required to store given number\n+ * of objects. Assume that the memory buffer will be aligned at page\n+ * boundary.\n+ *\n+ * Note that if object size is bigger then page size, then it assumes\n+ * that pages are grouped in subsets of physically continuous pages big\n+ * enough to store at least one object.\n+ *\n * @param elt_num\n * Number of elements.\n * @param elt_sz\n@@ -1340,8 +1357,11 @@ size_t rte_mempool_xmem_size(uint32_t elt_num, size_t elt_sz,\n \tuint32_t pg_shift);\n \n /**\n+ * Get the size of memory required to store mempool elements.\n+ *\n * Calculate how much memory would be actually required with the given\n * memory footprint to store required number of objects.\n+ *\n * @param vaddr\n * Virtual address of the externally allocated memory buffer.\n * Will be used to store mempool objects.\n@@ -1350,17 +1370,17 @@ size_t rte_mempool_xmem_size(uint32_t elt_num, size_t elt_sz,\n * @param elt_sz\n * The size of each element.\n * @param paddr\n- * Array of phyiscall addresses of the pages that comprises given memory\n+ * Array of physical addresses of the pages that comprises given memory\n * buffer.\n * @param pg_num\n * Number of elements in the paddr array.\n * @param pg_shift\n * LOG2 of the physical pages size.\n * @return\n- * Number of bytes needed to store given number of objects,\n- * aligned to the given page size.\n- * If provided memory buffer is not big enough:\n- * (-1) * actual number of elemnts that can be stored in that buffer.\n+ * On success, the number of bytes needed to store given number of\n+ * objects, aligned to the given page size. If the provided memory\n+ * buffer is too small, return a negative value whose absolute value\n+ * is the actual number of elements that can be stored in that buffer.\n */\n ssize_t rte_mempool_xmem_usage(void *vaddr, uint32_t elt_num, size_t elt_sz,\n \tconst phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift);\n", "prefixes": [ "dpdk-dev", "v2", "3/3" ] }{ "id": 5604, "url": "