Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/12834/?format=api
http://patches.dpdk.org/api/patches/12834/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1463569496-31086-2-git-send-email-olivier.matz@6wind.com/", "project": { "id": 1, "url": "http://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": "<1463569496-31086-2-git-send-email-olivier.matz@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1463569496-31086-2-git-send-email-olivier.matz@6wind.com", "date": "2016-05-18T11:04:22", "name": "[dpdk-dev,v3,01/35] mempool: rework comments and style", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "21a300fe83eafb92209b263c074a1f29176ac46b", "submitter": { "id": 8, "url": "http://patches.dpdk.org/api/people/8/?format=api", "name": "Olivier Matz", "email": "olivier.matz@6wind.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1463569496-31086-2-git-send-email-olivier.matz@6wind.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/12834/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/12834/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 6F5342946;\n\tWed, 18 May 2016 13:05:18 +0200 (CEST)", "from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com\n\t[62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 143748D3D\n\tfor <dev@dpdk.org>; Wed, 18 May 2016 13:05:14 +0200 (CEST)", "from glumotte.dev.6wind.com (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id 05B9129B97;\n\tWed, 18 May 2016 13:03:37 +0200 (CEST)" ], "From": "Olivier Matz <olivier.matz@6wind.com>", "To": "dev@dpdk.org", "Cc": "bruce.richardson@intel.com, stephen@networkplumber.org,\n\tkeith.wiles@intel.com", "Date": "Wed, 18 May 2016 13:04:22 +0200", "Message-Id": "<1463569496-31086-2-git-send-email-olivier.matz@6wind.com>", "X-Mailer": "git-send-email 2.8.0.rc3", "In-Reply-To": "<1463569496-31086-1-git-send-email-olivier.matz@6wind.com>", "References": "<1460629199-32489-1-git-send-email-olivier.matz@6wind.com>\n\t<1463569496-31086-1-git-send-email-olivier.matz@6wind.com>", "Subject": "[dpdk-dev] [PATCH v3 01/35] mempool: rework comments and 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": "No functional change, just fix some comments and styling issues.\nAlso avoid to duplicate comments between rte_mempool_create()\nand rte_mempool_xmem_create().\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\nAcked by: Keith Wiles <keith.wiles@intel.com>\n---\n lib/librte_mempool/rte_mempool.c | 17 ++++++++++--\n lib/librte_mempool/rte_mempool.h | 59 +++++++++-------------------------------\n 2 files changed, 27 insertions(+), 49 deletions(-)", "diff": "diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c\nindex 0724942..daf4d06 100644\n--- a/lib/librte_mempool/rte_mempool.c\n+++ b/lib/librte_mempool/rte_mempool.c\n@@ -152,6 +152,14 @@ mempool_add_elem(struct rte_mempool *mp, void *obj, uint32_t obj_idx,\n \trte_ring_sp_enqueue(mp->ring, obj);\n }\n \n+/* Iterate through objects at the given address\n+ *\n+ * Given the pointer to the memory, and its topology in physical memory\n+ * (the physical addresses table), iterate through the \"elt_num\" objects\n+ * of size \"total_elt_sz\" aligned at \"align\". For each object in this memory\n+ * chunk, invoke a callback. It returns the effective number of objects\n+ * in this memory.\n+ */\n uint32_t\n rte_mempool_obj_iter(void *vaddr, uint32_t elt_num, size_t elt_sz, size_t align,\n \tconst phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift,\n@@ -341,9 +349,8 @@ rte_mempool_xmem_size(uint32_t elt_num, size_t elt_sz, uint32_t pg_shift)\n \treturn sz;\n }\n \n-/*\n- * Calculate how much memory would be actually required with the\n- * given memory footprint to store required number of elements.\n+/* Callback used by rte_mempool_xmem_usage(): it sets the opaque\n+ * argument to the end of the object.\n */\n static void\n mempool_lelem_iter(void *arg, __rte_unused void *start, void *end,\n@@ -352,6 +359,10 @@ mempool_lelem_iter(void *arg, __rte_unused void *start, void *end,\n \t*(uintptr_t *)arg = (uintptr_t)end;\n }\n \n+/*\n+ * Calculate how much memory would be actually required with the\n+ * given memory footprint to store required number of elements.\n+ */\n ssize_t\n 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)\ndiff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h\nindex 0f3ef4a..dd70469 100644\n--- a/lib/librte_mempool/rte_mempool.h\n+++ b/lib/librte_mempool/rte_mempool.h\n@@ -214,7 +214,7 @@ struct rte_mempool {\n \n } __rte_cache_aligned;\n \n-#define MEMPOOL_F_NO_SPREAD 0x0001 /**< Do not spread in memory. */\n+#define MEMPOOL_F_NO_SPREAD 0x0001 /**< Do not spread among memory channels. */\n #define MEMPOOL_F_NO_CACHE_ALIGN 0x0002 /**< Do not align objs on cache lines.*/\n #define MEMPOOL_F_SP_PUT 0x0004 /**< Default put is \"single-producer\".*/\n #define MEMPOOL_F_SC_GET 0x0008 /**< Default get is \"single-consumer\".*/\n@@ -272,7 +272,8 @@ struct rte_mempool {\n /* return the header of a mempool object (internal) */\n static inline struct rte_mempool_objhdr *__mempool_get_header(void *obj)\n {\n-\treturn (struct rte_mempool_objhdr *)RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr));\n+\treturn (struct rte_mempool_objhdr *)RTE_PTR_SUB(obj,\n+\t\tsizeof(struct rte_mempool_objhdr));\n }\n \n /**\n@@ -546,8 +547,9 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,\n /**\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+ * The pool contains n elements of elt_size. Its size is set to n.\n+ * This function uses ``memzone_reserve()`` to allocate the mempool header\n+ * (and the objects if vaddr is NULL).\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@@ -562,18 +564,7 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,\n * @param elt_size\n * The size of each element.\n * @param cache_size\n- * If cache_size is non-zero, the rte_mempool library will try to\n- * limit the accesses to the common lockless pool, by maintaining a\n- * per-lcore object cache. This argument must be lower or equal to\n- * CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE. It is advised to choose\n- * cache_size to have \"n modulo cache_size == 0\": if this is\n- * not the case, some elements will always stay in the pool and will\n- * never be used. The access to the per-lcore table is of course\n- * faster than the multi-producer/consumer pool. The cache can be\n- * disabled if the cache_size argument is set to 0; it can be useful to\n- * avoid losing objects in cache. Note that even if not used, the\n- * memory space for cache is always reserved in a mempool structure,\n- * except if CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE is set to 0.\n+ * Size of the cache. See rte_mempool_create() for details.\n * @param private_data_size\n * The size of the private data appended after the mempool\n * structure. This is useful for storing some private data after the\n@@ -587,35 +578,17 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,\n * An opaque pointer to data that can be used in the mempool\n * constructor function.\n * @param obj_init\n- * A function pointer that is called for each object at\n- * initialization of the pool. The user can set some meta data in\n- * objects if needed. This parameter can be NULL if not needed.\n- * The obj_init() function takes the mempool pointer, the init_arg,\n- * the object pointer and the object number as parameters.\n+ * A function called for each object at initialization of the pool.\n+ * See rte_mempool_create() for details.\n * @param obj_init_arg\n- * An opaque pointer to data that can be used as an argument for\n- * each call to the object constructor function.\n+ * An opaque pointer passed to the object constructor function.\n * @param socket_id\n * The *socket_id* argument is the socket identifier in the case of\n * NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA\n * constraint for the reserved zone.\n * @param flags\n- * The *flags* arguments is an OR of following flags:\n- * - MEMPOOL_F_NO_SPREAD: By default, objects addresses are spread\n- * between channels in RAM: the pool allocator will add padding\n- * between objects depending on the hardware configuration. See\n- * Memory alignment constraints for details. If this flag is set,\n- * the allocator will just align them to a cache line.\n- * - MEMPOOL_F_NO_CACHE_ALIGN: By default, the returned objects are\n- * cache-aligned. This flag removes this constraint, and no\n- * padding will be present between objects. This flag implies\n- * MEMPOOL_F_NO_SPREAD.\n- * - MEMPOOL_F_SP_PUT: If this flag is set, the default behavior\n- * when using rte_mempool_put() or rte_mempool_put_bulk() is\n- * \"single-producer\". Otherwise, it is \"multi-producers\".\n- * - MEMPOOL_F_SC_GET: If this flag is set, the default behavior\n- * when using rte_mempool_get() or rte_mempool_get_bulk() is\n- * \"single-consumer\". Otherwise, it is \"multi-consumers\".\n+ * Flags controlling the behavior of the mempool. See\n+ * rte_mempool_create() for details.\n * @param vaddr\n * Virtual address of the externally allocated memory buffer.\n * Will be used to store mempool objects.\n@@ -628,13 +601,7 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,\n * LOG2 of the physical pages size.\n * @return\n * The pointer to the new allocated mempool, on success. NULL on error\n- * with rte_errno set appropriately. Possible rte_errno values include:\n- * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure\n- * - E_RTE_SECONDARY - function was called from a secondary process instance\n- * - EINVAL - cache size provided is too large\n- * - ENOSPC - the maximum number of memzones has already been allocated\n- * - EEXIST - a memzone with the same name already exists\n- * - ENOMEM - no appropriate memory area found in which to create memzone\n+ * with rte_errno set appropriately. See rte_mempool_create() for details.\n */\n struct rte_mempool *\n rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,\n", "prefixes": [ "dpdk-dev", "v3", "01/35" ] }{ "id": 12834, "url": "