From: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
To: "Venkatesan,
Venky" <venky.venkatesan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org,
Stephen Hemminger
<shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH 2/6] qos: use rte_zmalloc instead of memzone for allocation
Date: Fri, 07 Mar 2014 10:13:37 -0800 [thread overview]
Message-ID: <20140307181423.371047493@vyatta.com> (raw)
In-Reply-To: 20140307181335.024904493@vyatta.com
[-- Attachment #1: sched-rte-malloc.patch --]
[-- Type: text/plain, Size: 1875 bytes --]
Memory zone's are inflexible and can not be destroyed.
The size is fixed when initially created therefor QoS parameters
could not be modified at run time, because table size for a subport
might change.
Signed-off-by: Stephen Hemminger <shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
--- a/lib/librte_sched/rte_sched.c 2013-08-02 03:41:05.000000000 -0700
+++ b/lib/librte_sched/rte_sched.c 2014-03-06 15:18:37.094154057 -0800
@@ -37,7 +37,7 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_memory.h>
-#include <rte_memzone.h>
+#include <rte_malloc.h>
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_branch_prediction.h>
@@ -613,7 +613,6 @@ struct rte_sched_port *
rte_sched_port_config(struct rte_sched_port_params *params)
{
struct rte_sched_port *port = NULL;
- const struct rte_memzone *mz = NULL;
uint32_t mem_size, bmp_mem_size, n_queues_per_port, i;
/* Check user parameters. Determine the amount of memory to allocate */
@@ -623,21 +622,10 @@ rte_sched_port_config(struct rte_sched_p
}
/* Allocate memory to store the data structures */
- mz = rte_memzone_lookup(params->name);
- if (mz) {
- /* Use existing memzone, provided that its size is big enough */
- if (mz->len < mem_size) {
- return NULL;
- }
- } else {
- /* Create new memzone */
- mz = rte_memzone_reserve(params->name, mem_size, params->socket, 0);
- if (mz == NULL) {
- return NULL;
- }
+ port = rte_zmalloc("qos_params", mem_size, CACHE_LINE_SIZE);
+ if (port == NULL) {
+ return NULL;
}
- memset(mz->addr, 0, mem_size);
- port = (struct rte_sched_port *) mz->addr;
/* User parameters */
port->n_subports_per_port = params->n_subports_per_port;
@@ -716,9 +704,9 @@ rte_sched_port_free(struct rte_sched_por
if (port == NULL){
return;
}
+
rte_bitmap_free(port->bmp);
-
- return;
+ rte_free(port);
}
static void
next prev parent reply other threads:[~2014-03-07 18:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 18:13 [PATCH 0/6] DPDK 1.6.1 fixes Stephen Hemminger
2014-03-07 18:13 ` [PATCH 1/6] rte_mbuf: copy offload flags when doing attach/clone of mbuf Stephen Hemminger
[not found] ` <20140307181421.045171437-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2014-03-24 18:21 ` Thomas Monjalon
2014-03-07 18:13 ` Stephen Hemminger [this message]
[not found] ` <20140307181423.371047493-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2014-03-24 18:30 ` [PATCH 2/6] qos: use rte_zmalloc instead of memzone for allocation Thomas Monjalon
2014-03-07 18:13 ` [PATCH 3/6] rte_jhash: make arg to rte_jhash2 const Stephen Hemminger
[not found] ` <20140307181425.176731410-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2014-03-24 18:22 ` Thomas Monjalon
2014-03-07 18:13 ` [PATCH 4/6] mempool: use GCC push/pop Stephen Hemminger
[not found] ` <20140307181427.254643901-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2014-03-24 18:23 ` Thomas Monjalon
2014-03-07 18:13 ` [PATCH 5/6] xen: dont create dependency on cmdline library Stephen Hemminger
[not found] ` <20140307181430.240987691-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2014-03-24 21:01 ` Thomas Monjalon
2014-03-07 18:13 ` [PATCH 6/6] ivshmem: fix errors identified by hardening Stephen Hemminger
[not found] ` <20140307181432.206702017-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2014-04-17 13:51 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140307181423.371047493@vyatta.com \
--to=stephen-otpzqlsittunbdjkjebofr2eb7je58tq@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.org \
--cc=shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org \
--cc=venky.venkatesan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).