From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6AC00A493 for ; Mon, 22 Jan 2018 11:04:21 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2018 02:04:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,396,1511856000"; d="scan'208";a="195241998" Received: from silpixa00398672.ir.intel.com ([10.237.223.111]) by orsmga005.jf.intel.com with ESMTP; 22 Jan 2018 02:04:18 -0800 From: Harry van Haaren To: dev@dpdk.org Cc: Harry van Haaren , liang.j.ma@intel.com, peter.mccarthy@intel.com Date: Mon, 22 Jan 2018 10:04:10 +0000 Message-Id: <1516615450-57525-1-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] event/opdl: rework loops to comply with dpdk style X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jan 2018 10:04:22 -0000 This commit reworks the loop counter variable declarations to be in line with the DPDK source code. Fixes: 3c7f3dcfb099 ("event/opdl: add PMD main body and helper function") Fixes: 8ca8e3b48eff ("event/opdl: add event queue config get/set") Fixes: d548ef513cd7 ("event/opdl: add unit tests") Cc: liang.j.ma@intel.com Cc: peter.mccarthy@intel.com Signed-off-by: Harry van Haaren --- Compile tested for loop declarations by adding "-std=gnu90" to the OPDL Makefile CFLAGS variable, which now passes here. Note that DPDK as a whole does not compile with gnu90, so don't pass it as EXTRA_CFLAGS --- drivers/event/opdl/Makefile | 2 -- drivers/event/opdl/opdl_evdev.c | 9 +++++---- drivers/event/opdl/opdl_evdev_init.c | 23 ++++++++++++++--------- drivers/event/opdl/opdl_evdev_xstats.c | 9 ++++++--- drivers/event/opdl/opdl_test.c | 6 ++++-- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/drivers/event/opdl/Makefile b/drivers/event/opdl/Makefile index a8aff2c..747ae5b 100644 --- a/drivers/event/opdl/Makefile +++ b/drivers/event/opdl/Makefile @@ -7,8 +7,6 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_pmd_opdl_event.a # build flags -CFLAGS += -std=c99 -CFLAGS += -D_XOPEN_SOURCE=600 CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) # for older GCC versions, allow us to initialize an event using diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c index dcbf404..d5e2b60 100644 --- a/drivers/event/opdl/opdl_evdev.c +++ b/drivers/event/opdl/opdl_evdev.c @@ -288,7 +288,8 @@ opdl_queue_setup(struct rte_eventdev *dev, } } /* Check if queue id has been setup already */ - for (uint32_t i = 0; i < device->nb_q_md; i++) { + uint32_t i; + for (i = 0; i < device->nb_q_md; i++) { if (device->q_md[i].ext_id == queue_id) { PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : " "queue id %u already setup\n", @@ -390,8 +391,8 @@ opdl_dump(struct rte_eventdev *dev, FILE *f) fprintf(f, "\n\n -- RING STATISTICS --\n"); - - for (uint32_t i = 0; i < device->nb_opdls; i++) + uint32_t i; + for (i = 0; i < device->nb_opdls; i++) opdl_ring_dump(device->opdl[i], f); fprintf(f, @@ -400,7 +401,7 @@ opdl_dump(struct rte_eventdev *dev, FILE *f) "Av. Grant Size Av. Cycles PP" " Empty DEQs Non Empty DEQs Pkts Processed\n"); - for (uint32_t i = 0; i < device->max_port_nb; i++) { + for (i = 0; i < device->max_port_nb; i++) { char queue_id[64]; char total_cyc[64]; const char *p_type; diff --git a/drivers/event/opdl/opdl_evdev_init.c b/drivers/event/opdl/opdl_evdev_init.c index c37d8bc..84ab258 100644 --- a/drivers/event/opdl/opdl_evdev_init.c +++ b/drivers/event/opdl/opdl_evdev_init.c @@ -314,8 +314,8 @@ static int opdl_add_deps(struct opdl_evdev *device, "Stages and dependents" " are not for same opdl ring", opdl_pmd_dev_id(device)); - for (uint32_t k = 0; - k < device->nb_opdls; k++) { + uint32_t k; + for (k = 0; k < device->nb_opdls; k++) { opdl_ring_dump(device->opdl[k], stdout); } @@ -505,8 +505,9 @@ void destroy_queues_and_rings(struct rte_eventdev *dev) { struct opdl_evdev *device = opdl_pmd_priv(dev); + uint32_t i; - for (uint32_t i = 0; i < device->nb_opdls; i++) { + for (i = 0; i < device->nb_opdls; i++) { if (device->opdl[i]) opdl_ring_free(device->opdl[i]); } @@ -639,7 +640,8 @@ create_queues_and_rings(struct rte_eventdev *dev) OPDL_Q_POS_START, -1); - for (uint32_t i = 0; i < device->nb_q_md; i++) { + uint32_t i; + for (i = 0; i < device->nb_q_md; i++) { /* Check */ if (!device->q_md[i].setup) { @@ -702,7 +704,8 @@ initialise_all_other_ports(struct rte_eventdev *dev) struct opdl_evdev *device = opdl_pmd_priv(dev); - for (uint32_t i = 0; i < device->nb_ports; i++) { + uint32_t i; + for (i = 0; i < device->nb_ports; i++) { struct opdl_port *port = &device->ports[i]; struct opdl_queue *queue = &device->queue[port->queue_id]; @@ -827,7 +830,7 @@ initialise_all_other_ports(struct rte_eventdev *dev) * setup the last bit of stage md */ if (!err) { - for (uint32_t i = 0; i < device->nb_ports; i++) { + for (i = 0; i < device->nb_ports; i++) { struct opdl_port *port = &device->ports[i]; struct opdl_queue *queue = &device->queue[port->queue_id]; @@ -872,7 +875,8 @@ initialise_queue_zero_ports(struct rte_eventdev *dev) struct opdl_evdev *device = opdl_pmd_priv(dev); /* Assign queue zero and figure out how many Q0 ports we have */ - for (uint32_t i = 0; i < device->nb_ports; i++) { + uint32_t i; + for (i = 0; i < device->nb_ports; i++) { struct opdl_port *port = &device->ports[i]; if (port->queue_id == OPDL_INVALID_QID) { port->queue_id = 0; @@ -889,7 +893,7 @@ initialise_queue_zero_ports(struct rte_eventdev *dev) if (stage_inst) { /* Assign the new created input stage to all relevant ports */ - for (uint32_t i = 0; i < device->nb_ports; i++) { + for (i = 0; i < device->nb_ports; i++) { struct opdl_port *port = &device->ports[i]; if (port->queue_id == 0) { queue = &device->queue[port->queue_id]; @@ -914,8 +918,9 @@ assign_internal_queue_ids(struct rte_eventdev *dev) { int err = 0; struct opdl_evdev *device = opdl_pmd_priv(dev); + uint32_t i; - for (uint32_t i = 0; i < device->nb_ports; i++) { + for (i = 0; i < device->nb_ports; i++) { struct opdl_port *port = &device->ports[i]; if (port->external_qid != OPDL_INVALID_QID) { port->queue_id = diff --git a/drivers/event/opdl/opdl_evdev_xstats.c b/drivers/event/opdl/opdl_evdev_xstats.c index 94dfeee..70b84d9 100644 --- a/drivers/event/opdl/opdl_evdev_xstats.c +++ b/drivers/event/opdl/opdl_evdev_xstats.c @@ -86,7 +86,8 @@ opdl_xstats_get_names(const struct rte_eventdev *dev, uint32_t port_idx = queue_port_id * max_num_port_xstat; - for (uint32_t j = 0; j < max_num_port_xstat; j++) { + uint32_t j; + for (j = 0; j < max_num_port_xstat; j++) { strcpy(xstats_names[j].name, device->port_xstat[j + port_idx].stat.name); @@ -121,7 +122,8 @@ opdl_xstats_get(const struct rte_eventdev *dev, uint32_t p_start = queue_port_id * max_num_port_xstat; uint32_t p_finish = p_start + max_num_port_xstat; - for (uint32_t i = 0; i < n; i++) { + uint32_t i; + for (i = 0; i < n; i++) { if (ids[i] < p_start || ids[i] >= p_finish) return -EINVAL; @@ -142,7 +144,8 @@ opdl_xstats_get_by_name(const struct rte_eventdev *dev, uint32_t max_index = device->max_port_nb * max_num_port_xstat; - for (uint32_t i = 0; i < max_index; i++) { + uint32_t i; + for (i = 0; i < max_index; i++) { if (strncmp(name, device->port_xstat[i].stat.name, diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c index 44a5cc5..13d4f6b 100644 --- a/drivers/event/opdl/opdl_test.c +++ b/drivers/event/opdl/opdl_test.c @@ -433,7 +433,8 @@ atomic_basic(struct test *t) return -1; } - for (int j = 0; j < 3; j++) { + int j; + for (j = 0; j < 3; j++) { deq_ev[j].op = RTE_EVENT_OP_FORWARD; deq_ev[j].queue_id = t->qid[1]; } @@ -495,8 +496,9 @@ static int check_statistics(void) { int num_ports = 3; /* Hard-coded for this app */ + int i; - for (int i = 0; i < num_ports; i++) { + for (i = 0; i < num_ports; i++) { int num_stats, num_stats_returned; num_stats = rte_event_dev_xstats_names_get(0, -- 2.7.4