From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E26228CF2 for ; Tue, 30 May 2017 16:11:14 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 May 2017 07:11:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,418,1491289200"; d="scan'208";a="93451575" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 30 May 2017 07:11:13 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 30 May 2017 07:11:13 -0700 Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.133]) by FMSMSX119.amr.corp.intel.com ([169.254.14.198]) with mapi id 14.03.0319.002; Tue, 30 May 2017 07:11:12 -0700 From: "Eads, Gage" To: "Van Haaren, Harry" , "dev@dpdk.org" CC: "jerin.jacob@caviumnetworks.com" Thread-Topic: [PATCH] event/sw: fix credit tracking in port dequeue Thread-Index: AQHS2I6VqKx6229Fe062V4sMFg16e6IM6yhw Date: Tue, 30 May 2017 14:11:12 +0000 Message-ID: <9184057F7FC11744A2107296B6B8EB1E01EC4180@FMSMSX108.amr.corp.intel.com> References: <1496071015-24906-1-git-send-email-harry.van.haaren@intel.com> In-Reply-To: <1496071015-24906-1-git-send-email-harry.van.haaren@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.108] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] event/sw: fix credit tracking in port dequeue 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: Tue, 30 May 2017 14:11:15 -0000 A couple nit-picks on the test, but once resolved: Acked-by: Gage Eads > -----Original Message----- > From: Van Haaren, Harry > Sent: Monday, May 29, 2017 10:17 AM > To: dev@dpdk.org > Cc: jerin.jacob@caviumnetworks.com; Eads, Gage ; > Van Haaren, Harry > Subject: [PATCH] event/sw: fix credit tracking in port dequeue > =20 > This patch targets the next-eventdev tree. > =20 > Single-link optimized ports previously did not correctly track credits w= hen > dequeued, and re-enqueued as a FORWARD type. This could "inflate" the > number of credits in the system. > =20 > A unit test is added to reproduce and verify the issue. The fixed implem= entation > counts FORWARD packets and reduces the number of credits the port has if= it is > of single-link type. > =20 > Fixes: 656af9180014 ("event/sw: add worker core functions") > =20 > Signed-off-by: Harry van Haaren > --- > drivers/event/sw/sw_evdev_worker.c | 5 ++++ > test/test/test_eventdev_sw.c | 58 > +++++++++++++++++++++++++++++++++++++- > 2 files changed, 62 insertions(+), 1 deletion(-) > =20 > diff --git a/drivers/event/sw/sw_evdev_worker.c > b/drivers/event/sw/sw_evdev_worker.c > index 9cb6bef..b738506 100644 > --- a/drivers/event/sw/sw_evdev_worker.c > +++ b/drivers/event/sw/sw_evdev_worker.c > @@ -87,6 +87,7 @@ sw_event_enqueue_burst(void *port, const struct > rte_event ev[], uint16_t num) > return 0; > } > =20 > + uint32_t forwards =3D 0; > for (i =3D 0; i < num; i++) { > int op =3D ev[i].op; > int outstanding =3D p->outstanding_releases > 0; @@ -95,6 > +96,7 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], > uint16_t num) > p->inflight_credits -=3D (op =3D=3D RTE_EVENT_OP_NEW); > p->inflight_credits +=3D (op =3D=3D RTE_EVENT_OP_RELEASE) * > outstanding; > + forwards +=3D (op =3D=3D RTE_EVENT_OP_FORWARD); > =20 > new_ops[i] =3D sw_qe_flag_map[op]; > new_ops[i] &=3D ~(invalid_qid << QE_FLAG_VALID_SHIFT); @@ - > 113,6 +115,9 @@ sw_event_enqueue_burst(void *port, const struct rte_even= t > ev[], uint16_t num) > } > } > =20 > + /* handle directed port forward credits */ > + p->inflight_credits -=3D forwards * p->is_directed; > + > /* returns number of events actually enqueued */ > uint32_t enq =3D qe_ring_enqueue_burst_with_ops(p->rx_worker_ring, > ev, i, > new_ops); > diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c= index > b187d02..aaa9729 100644 > --- a/test/test/test_eventdev_sw.c > +++ b/test/test/test_eventdev_sw.c > @@ -548,6 +548,57 @@ test_single_directed_packet(struct test *t) > return 0; > } > =20 > +static int > +test_directed_forward_credits(struct test *t) { > + uint32_t i; > + int32_t err; > + > + if (init(t, 1, 1) < 0 || > + create_ports(t, 1) < 0 || > + create_directed_qids(t, 1, t->port) < 0) > + return -1; > + > + if (rte_event_dev_start(evdev) < 0) { > + printf("%d: Error with start call\n", __LINE__); > + return -1; > + } > + > + struct rte_event ev =3D { > + .op =3D RTE_EVENT_OP_NEW, > + .queue_id =3D 0, > + }; > + > + for (i =3D 0; i < 1000; i++) { > + err =3D rte_event_enqueue_burst(evdev, 0, &ev, 1); > + if (err < 0) { > + printf("%d: error failed to enqueue\n", __LINE__); > + return -1; > + } > + rte_event_schedule(evdev); > + struct test_event_dev_stats stats; > + err =3D test_event_dev_stats_get(evdev, &stats); Does this stats get call serve a purpose? > + if (err) { > + printf("%d: error failed to get stats\n", __LINE__); > + return -1; > + } > + > + uint32_t deq_pkts; > + deq_pkts =3D rte_event_dequeue_burst(evdev, 0, &ev, 1, 0); > + if (deq_pkts !=3D 1) { > + printf("%d: error failed to deq\n", __LINE__); > + return -1; > + } > + > + /* re-write event to be a forward, and continue looping it */ > + ev.op =3D RTE_EVENT_OP_FORWARD; > + } > + > + //rte_event_dev_dump(0, stdout); Comment can be deleted