From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 95606590C for ; Fri, 7 Mar 2014 19:12:56 +0100 (CET) Received: by mail-pa0-f42.google.com with SMTP id fb1so4505833pad.15 for ; Fri, 07 Mar 2014 10:14:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject :references:content-disposition; bh=oPOaGvZQcxgz9xMMR9yVTz2AaPC06iGdtRcbeD80UFs=; b=SW3MNLF071F3Lgi0phbdsRKWfPDl0ZPzXACt1nbeJTLArhCsCRgskXEblaAqSUXSnf BbEDph+d/biwc8FcFRAVtr+G+AAwfXVPxr2nxw6gp2efH/asXyvsWvovXuZtb38ykeeN w1Zclq0qZ95xFt3Yxyt6T09Q7ow2yo7ND2hRUgTgZz2YqSGf7Y15BQlcBqBBHAsJzwrY SgDknT+cUKVHfBmAR5tWh0NjLBOxTu2ilXigPWJsk3s46AP89k66A077MMZZa+/4c3G+ YZFmhtUdGq5fy4/NMHoQlQpzWNxfxixgIctkAM+nFbhEJk9yC3cyhdcn4VIiUfgxgAHS h8/g== X-Gm-Message-State: ALoCoQmNLlOke59MZs/HccNtSy0zYtrrwCgrRTzyUd+B3k+V2QDRQW8DyKFc/mdy7huCtcg0spQI X-Received: by 10.68.136.162 with SMTP id qb2mr23915782pbb.88.1394216065121; Fri, 07 Mar 2014 10:14:25 -0800 (PST) Received: from localhost (static-50-53-83-51.bvtn.or.frontiernet.net. [50.53.83.51]) by mx.google.com with ESMTPSA id ha2sm38951571pbb.8.2014.03.07.10.14.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 07 Mar 2014 10:14:24 -0800 (PST) Message-Id: <20140307181423.371047493@vyatta.com> User-Agent: quilt/0.60-1 Date: Fri, 07 Mar 2014 10:13:37 -0800 From: Stephen Hemminger To: "Venkatesan, Venky" References: <20140307181335.024904493@vyatta.com> Content-Disposition: inline; filename=sched-rte-malloc.patch Cc: dev@dpdk.org, Stephen Hemminger Subject: [dpdk-dev] [PATCH 2/6] qos: use rte_zmalloc instead of memzone for allocation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Mar 2014 18:12:57 -0000 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 --- 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 #include #include -#include +#include #include #include #include @@ -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