DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ip_pipeline: fix cpu socket-id error
@ 2016-01-20 11:01 Jasvinder Singh
  2016-01-20 18:32 ` Stephen Hemminger
  2016-01-27 11:47 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
  0 siblings, 2 replies; 4+ messages in thread
From: Jasvinder Singh @ 2016-01-20 11:01 UTC (permalink / raw)
  To: dev

This patch fixes the socket-id error in ip_pipeline sample
application running over uni-processor systems.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 examples/ip_pipeline/init.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 186ca03..86aa378 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -835,6 +835,17 @@ app_init_link_frag_ras(struct app_params *app)
 	}
 }
 
+static inline int
+app_get_cpu_socket_id(uint32_t pmd_id)
+{
+	int status = rte_eth_dev_socket_id(pmd_id);
+
+	if (status == -1)
+		return 0;
+
+	return status;
+}
+
 static void
 app_init_link(struct app_params *app)
 {
@@ -890,7 +901,7 @@ app_init_link(struct app_params *app)
 				p_link->pmd_id,
 				rxq_queue_id,
 				p_rxq->size,
-				rte_eth_dev_socket_id(p_link->pmd_id),
+				app_get_cpu_socket_id(p_link->pmd_id),
 				&p_rxq->conf,
 				app->mempool[p_rxq->mempool_id]);
 			if (status < 0)
@@ -917,7 +928,7 @@ app_init_link(struct app_params *app)
 				p_link->pmd_id,
 				txq_queue_id,
 				p_txq->size,
-				rte_eth_dev_socket_id(p_link->pmd_id),
+				app_get_cpu_socket_id(p_link->pmd_id),
 				&p_txq->conf);
 			if (status < 0)
 				rte_panic("%s (%" PRIu32 "): "
@@ -989,7 +1000,7 @@ app_init_tm(struct app_params *app)
 		/* TM */
 		p_tm->sched_port_params.name = p_tm->name;
 		p_tm->sched_port_params.socket =
-			rte_eth_dev_socket_id(p_link->pmd_id);
+			app_get_cpu_socket_id(p_link->pmd_id);
 		p_tm->sched_port_params.rate =
 			(uint64_t) link_eth_params.link_speed * 1000 * 1000 / 8;
 
-- 
2.5.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] ip_pipeline: fix cpu socket-id error
  2016-01-20 11:01 [dpdk-dev] [PATCH] ip_pipeline: fix cpu socket-id error Jasvinder Singh
@ 2016-01-20 18:32 ` Stephen Hemminger
  2016-01-27 11:47 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2016-01-20 18:32 UTC (permalink / raw)
  To: Jasvinder Singh; +Cc: dev

On Wed, 20 Jan 2016 11:01:17 +0000
Jasvinder Singh <jasvinder.singh@intel.com> wrote:

> +static inline int
> +app_get_cpu_socket_id(uint32_t pmd_id)
> +{
> +	int status = rte_eth_dev_socket_id(pmd_id);
> +
> +	if (status == -1)
> +		return 0;
> +
> +	return status;
> +

Why not:
    return (status != SOCKET_ID_ANY) ? status : 0;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] ip_pipeline: fix cpu socket-id error
  2016-01-20 11:01 [dpdk-dev] [PATCH] ip_pipeline: fix cpu socket-id error Jasvinder Singh
  2016-01-20 18:32 ` Stephen Hemminger
@ 2016-01-27 11:47 ` Jasvinder Singh
  2016-03-07 11:20   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Jasvinder Singh @ 2016-01-27 11:47 UTC (permalink / raw)
  To: dev

This patch fixes the socket-id error in ip_pipeline sample
application running over uni-processor systems.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
v2:
- used SOCKET_ID_ANY instead of -1

 examples/ip_pipeline/init.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 186ca03..c4601c9 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -835,6 +835,14 @@ app_init_link_frag_ras(struct app_params *app)
 	}
 }
 
+static inline int
+app_get_cpu_socket_id(uint32_t pmd_id)
+{
+	int status = rte_eth_dev_socket_id(pmd_id);
+
+	return (status != SOCKET_ID_ANY) ? status : 0;
+}
+
 static void
 app_init_link(struct app_params *app)
 {
@@ -890,7 +898,7 @@ app_init_link(struct app_params *app)
 				p_link->pmd_id,
 				rxq_queue_id,
 				p_rxq->size,
-				rte_eth_dev_socket_id(p_link->pmd_id),
+				app_get_cpu_socket_id(p_link->pmd_id),
 				&p_rxq->conf,
 				app->mempool[p_rxq->mempool_id]);
 			if (status < 0)
@@ -917,7 +925,7 @@ app_init_link(struct app_params *app)
 				p_link->pmd_id,
 				txq_queue_id,
 				p_txq->size,
-				rte_eth_dev_socket_id(p_link->pmd_id),
+				app_get_cpu_socket_id(p_link->pmd_id),
 				&p_txq->conf);
 			if (status < 0)
 				rte_panic("%s (%" PRIu32 "): "
@@ -989,7 +997,7 @@ app_init_tm(struct app_params *app)
 		/* TM */
 		p_tm->sched_port_params.name = p_tm->name;
 		p_tm->sched_port_params.socket =
-			rte_eth_dev_socket_id(p_link->pmd_id);
+			app_get_cpu_socket_id(p_link->pmd_id);
 		p_tm->sched_port_params.rate =
 			(uint64_t) link_eth_params.link_speed * 1000 * 1000 / 8;
 
-- 
2.5.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] ip_pipeline: fix cpu socket-id error
  2016-01-27 11:47 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
@ 2016-03-07 11:20   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-03-07 11:20 UTC (permalink / raw)
  To: Jasvinder Singh; +Cc: dev

2016-01-27 11:47, Jasvinder Singh:
> This patch fixes the socket-id error in ip_pipeline sample
> application running over uni-processor systems.
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> ---
> v2:
> - used SOCKET_ID_ANY instead of -1

Applied, thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-07 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 11:01 [dpdk-dev] [PATCH] ip_pipeline: fix cpu socket-id error Jasvinder Singh
2016-01-20 18:32 ` Stephen Hemminger
2016-01-27 11:47 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
2016-03-07 11:20   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).