From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gage.eads@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id D99AF36E
 for <dev@dpdk.org>; Mon,  6 Mar 2017 15:38:20 +0100 (CET)
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 06 Mar 2017 06:38:19 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.35,254,1484035200"; d="scan'208";a="56597206"
Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205])
 by orsmga002.jf.intel.com with ESMTP; 06 Mar 2017 06:38:07 -0800
Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.130]) by
 fmsmsx107.amr.corp.intel.com ([169.254.6.78]) with mapi id 14.03.0248.002;
 Mon, 6 Mar 2017 06:38:05 -0800
From: "Eads, Gage" <gage.eads@intel.com>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, "Richardson, Bruce"
 <bruce.richardson@intel.com>, "hemant.agrawal@nxp.com"
 <hemant.agrawal@nxp.com>, "Van Haaren, Harry" <harry.van.haaren@intel.com>,
 "nipun.gupta@nxp.com" <nipun.gupta@nxp.com>
Thread-Topic: [PATCH] eventdev: Fix links_map initialization
Thread-Index: AQHSlnqXRapV0jHbd0WcnRpHtQgpR6GH3KXw
Date: Mon, 6 Mar 2017 14:38:05 +0000
Message-ID: <9184057F7FC11744A2107296B6B8EB1E01E6F9F5@FMSMSX108.amr.corp.intel.com>
References: <1488430056-32055-1-git-send-email-gage.eads@intel.com>
 <20170306130625.GA4250@localhost.localdomain>
In-Reply-To: <20170306130625.GA4250@localhost.localdomain>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGMwNzkyOGItOWRhOC00MDhkLTgxYzktZDcyNDM1MjUzZDg5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNS45LjYuNiIsIlRydXN0ZWRMYWJlbEhhc2giOiJjQ3h0b2ZIVnI3d3ZoUEpmbnBBQXREV2pRVkNmUlVXRUlnbDVZbkVaY2hFPSJ9
x-ctpclassification: CTP_PUBLIC
x-originating-ip: [10.1.200.107]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH] eventdev: Fix links_map initialization
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <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>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 06 Mar 2017 14:38:21 -0000

>  -----Original Message-----
>  From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
>  Sent: Monday, March 6, 2017 7:06 AM
>  To: Eads, Gage <gage.eads@intel.com>
>  Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>;
>  hemant.agrawal@nxp.com; Van Haaren, Harry <harry.van.haaren@intel.com>;
>  nipun.gupta@nxp.com
>  Subject: Re: [PATCH] eventdev: Fix links_map initialization
> =20
>  On Wed, Mar 01, 2017 at 10:47:36PM -0600, Gage Eads wrote:
>  > This patch initializes the links_map array entries to
>  > EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by
>  > rte_event_port_links_get().
>  >
>  > Signed-off-by: Gage Eads <gage.eads@intel.com>
>  > ---
>  >  lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
>  >  1 file changed, 12 insertions(+), 5 deletions(-)
>  >
>  > diff --git a/lib/librte_eventdev/rte_eventdev.c
>  > b/lib/librte_eventdev/rte_eventdev.c
>  > index 68bfc3b..b8cd92b 100644
>  > --- a/lib/librte_eventdev/rte_eventdev.c
>  > +++ b/lib/librte_eventdev/rte_eventdev.c
>  > @@ -190,6 +190,8 @@ rte_event_dev_queue_config(struct rte_eventdev
>  *dev, uint8_t nb_queues)
>  >  	return 0;
>  >  }
>  >
>  > +#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
>  > +
>  >  static inline int
>  >  rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
>  > { @@ -251,6 +253,9 @@ rte_event_dev_port_config(struct rte_eventdev
>  > *dev, uint8_t nb_ports)
>  >  					"nb_ports %u", nb_ports);
>  >  			return -(ENOMEM);
>  >  		}
>  > +		for (i =3D 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
>  i++)
>  > +			dev->data->links_map[i] =3D
>  > +				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
>  >  	} else if (dev->data->ports !=3D NULL && nb_ports !=3D 0) {/* re-con=
fig */
>  >  		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release,
>  -ENOTSUP);
>  >
>  > @@ -305,6 +310,10 @@ rte_event_dev_port_config(struct rte_eventdev
>  > *dev, uint8_t nb_ports)
>  >
>  >  		if (nb_ports > old_nb_ports) {
>  >  			uint8_t new_ps =3D nb_ports - old_nb_ports;
>  > +			unsigned int old_links_map_end =3D
>  > +				old_nb_ports *
>  RTE_EVENT_MAX_QUEUES_PER_DEV;
>  > +			unsigned int links_map_end =3D
>  > +				nb_ports *
>  RTE_EVENT_MAX_QUEUES_PER_DEV;
>  >
>  >  			memset(ports + old_nb_ports, 0,
>  >  				sizeof(ports[0]) * new_ps);
>  > @@ -312,9 +321,9 @@ rte_event_dev_port_config(struct rte_eventdev
>  *dev, uint8_t nb_ports)
>  >  				sizeof(ports_dequeue_depth[0]) * new_ps);
>  >  			memset(ports_enqueue_depth + old_nb_ports, 0,
>  >  				sizeof(ports_enqueue_depth[0]) * new_ps);
>  > -			memset(links_map +
>  > -				(old_nb_ports *
>  RTE_EVENT_MAX_QUEUES_PER_DEV),
>  > -				0, sizeof(ports_enqueue_depth[0]) * new_ps);
>  > +			for (i =3D old_links_map_end; i < links_map_end; i++)
>  > +				links_map[i] =3D
>  > +
>  	EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
> =20
>  rte_event_port_setup() has rte_event_port_unlink() at the end of the fun=
ction.
>  On rte_event_port_unlink, we are doing the same operation(writing
>  EVENT_QUEUE_SERVICE_PRIORITY_INVALID) and
>  rte_event_port_links_get() should be called after rte_event_dev_start(),=
 If so,
>  Do you still think this duplicates writes are required? or Do you have a=
ny other
>  call sequence in mind?

Ah, I didn't realize that was a purpose of calling port_unlink at the end o=
f
port_setup. There is, however, an issue with initializing through the port =
unlink
when called by rte_event_port_setup(). The for-loop in rte_event_port_unlin=
k() to
reset the links_map runs from 0 to diag, and diag is 0 when the port is bei=
ng set up
since it has no queues to unlink at that time. (This is at least true of th=
e sw PMD,
but would be the case for others, I imagine.)

Perhaps a simpler form of this patch is to copy that for-loop, with the bou=
nd being
dev->data->nb_queues, into rte_event_port_setup() after rte_event_port_unli=
nk()
is called (if it is successful). What do you think?