All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Eads, Gage" <gage.eads@intel.com>
To: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>,
	"jerin.jacob@caviumnetworks.com" <jerin.jacob@caviumnetworks.com>,
	"Richardson, Bruce" <bruce.richardson@intel.com>,
	"Van Haaren, Harry" <harry.van.haaren@intel.com>,
	"hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
	"nipun.gupta@nxp.com" <nipun.gupta@nxp.com>,
	"Rao, Nikhil" <nikhil.rao@intel.com>,
	"santosh.shukla@caviumnetworks.com"
	<santosh.shukla@caviumnetworks.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH v2] eventdev: use links map to unlink queues
Date: Tue, 12 Dec 2017 16:08:12 +0000	[thread overview]
Message-ID: <9184057F7FC11744A2107296B6B8EB1E2BB16F75@FMSMSX108.amr.corp.intel.com> (raw)
In-Reply-To: <20171212093331.20216-1-pbhagavatula@caviumnetworks.com>



> -----Original Message-----
> From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> Sent: Tuesday, December 12, 2017 3:34 AM
> To: jerin.jacob@caviumnetworks.com; Richardson, Bruce
> <bruce.richardson@intel.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>;
> hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Rao, Nikhil
> <nikhil.rao@intel.com>; santosh.shukla@caviumnetworks.com
> Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v2] eventdev: use links map to unlink queues
> 
> The octeontx event device doesn't store the queues to port mapping as a result
> it cannot return the exact number of queues unlinked from a port when
> application wants to unlink all the queues mapped (supplies queues param as
> NULL).
> 
> Using links_map we can determine the exact queues mapped to a specific port
> and unlink them.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  lib/librte_eventdev/rte_eventdev.c | 33 ++++++++++++++++++++++++++-------
>  1 file changed, 26 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev.c
> b/lib/librte_eventdev/rte_eventdev.c
> index e0c2a78..b43ffbf 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -888,7 +888,8 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,  {
>  	struct rte_eventdev *dev;
>  	uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> -	int i, diag;
> +	uint8_t linked_queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
> +	int i, diag, j;
>  	uint16_t *links_map;
> 
>  	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0);
> @@ -906,13 +907,34 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t
> port_id,
>  		return 0;
>  	}
> 
> +	links_map = dev->data->links_map;
> +	/* Point links_map to this port specific area */
> +	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
> +
>  	if (queues == NULL) {
> -		for (i = 0; i < dev->data->nb_queues; i++)
> -			all_queues[i] = i;
> +		j = 0;
> +		for (i = 0; i < dev->data->nb_queues; i++) {
> +			if (links_map[i] !=
> +
> 	EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
> +				all_queues[j] = i;
> +				j++;
> +			}
> +		}
>  		queues = all_queues;
> -		nb_unlinks = dev->data->nb_queues;
> +	} else {
> +		j = 0;
> +		for (i = 0; i < nb_unlinks; i++) {
> +			if (links_map[queues[i]] ==
> +
> 	EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
> +				break;
> +
> +			linked_queues[j] = queues[i];
> +			j++;
> +		}
> +		queues = linked_queues;
>  	}
> 

Looks good. If you want, you can simplify the else case like so:

+	} else {
+		for (j = 0; j < nb_unlinks; j++)
+			if (links_map[queues[j]] ==
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID)
+				break;
+	}

Up to you. Either way:
Acked-by: Gage Eads <gage.eads@intel.com>

  reply	other threads:[~2017-12-12 16:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 15:05 [PATCH] eventdev: use links_map to unlink queues Pavan Nikhilesh
2017-12-11 17:24 ` Eads, Gage
2017-12-12  7:23   ` Pavan Nikhilesh Bhagavatula
2017-12-12  9:33 ` [PATCH v2] eventdev: use links map " Pavan Nikhilesh
2017-12-12 16:08   ` Eads, Gage [this message]
2017-12-12 17:22     ` Pavan Nikhilesh Bhagavatula
2017-12-12 18:58 ` [PATCH v3] " Pavan Nikhilesh
2017-12-16  9:16   ` Jerin Jacob

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=9184057F7FC11744A2107296B6B8EB1E2BB16F75@FMSMSX108.amr.corp.intel.com \
    --to=gage.eads@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=nikhil.rao@intel.com \
    --cc=nipun.gupta@nxp.com \
    --cc=pbhagavatula@caviumnetworks.com \
    --cc=santosh.shukla@caviumnetworks.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.