Skip to contentSkip to conversation

eventdev: Fix links_map initialization

PATCH In review Gage Eads 2 participants 8 messages Mar 2, 2017 – Mar 13, 2017

lore
Share & tools
lore

Gage Eads

author
#0 lore raw

PATCH 1/1 eventdev: Fix links_map initialization

This patch initializes the links_map array entries to EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by rte_event_port_links_get().

---
 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
lib/librte_eventdev/rte_eventdev.c +12 -5
index 68bfc3b..b8cd92b 100644
@@ -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 = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV; i++)
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		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 = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
+			unsigned int links_map_end =
+				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 = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 
 		dev->data->ports = ports;
@@ -815,8 +824,6 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	return diag;
 }
 
-#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
-
 int
 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		      uint8_t queues[], uint16_t nb_unlinks)
Signature · 1 line
2.7.4
#1 lore raw
Quoted 44 lines · Gage Eads

This patch initializes the links_map array entries to EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by rte_event_port_links_get().

---
 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
lib/librte_eventdev/rte_eventdev.c +9 -0
index 68bfc3b..b8cd92b 100644
@@ -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 = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV; i++)
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		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 = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
+			unsigned int links_map_end =
+				nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
 
 			memset(ports + old_nb_ports, 0,
 				sizeof(ports[0]) * new_ps);

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports) · line 326

Quoted 9 lines
lib/librte_eventdev/rte_eventdev.c +3 -3
@@ -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 = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;

rte_event_port_setup() has rte_event_port_unlink() at the end of the function. 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 any other call sequence in mind?

---------------------------- Description from header file----------------- The functions exported by the application Event API to setup a device designated by its device identifier must be invoked in the following order:
- rte_event_dev_configure()
- rte_event_queue_setup()
- rte_event_port_setup()
- rte_event_port_link()
- rte_event_dev_start()

Then, the application can invoke, in any order, the functions exported by the Event API to schedule events, dequeue events, enqueue events, change event queue(s) to event port [un]link establishment and so on.

Application may use rte_event_[queue/port]_default_conf_get() to get the default configuration to set up an event queue or event port by overriding few default values.

If the application wants to change the configuration (i.e. call rte_event_dev_configure(), rte_event_queue_setup(), or rte_event_port_setup()), it must call rte_event_dev_stop() first to stop the device and then do the reconfiguration before calling rte_event_dev_start() again. The schedule, enqueue and dequeue functions should not be invoked when the device is stopped.
-----------------------------------------------------------------------------

Quoted 15 lines
lib/librte_eventdev/rte_eventdev.c +0 -2
 		}
 
 		dev->data->ports = ports;
@@ -815,8 +824,6 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	return diag;
 }
 
-#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
-
 int
 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		      uint8_t queues[], uint16_t nb_unlinks)
Signature · 1 line
2.7.4
author
#2 lore raw
Quoted 74 lines

-----Original Message-----
From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, March 6, 2017 7:06 AM
To: Eads, Gage <[email protected]>
Cc: [email protected]; Richardson, Bruce <[email protected]>; [email protected]; Van Haaren, Harry <[email protected]>; [email protected]
Subject: Re: [PATCH] eventdev: Fix links_map initialization

lib/librte_eventdev/rte_eventdev.c rte_event_dev_queue_config(struct rte_eventdev

Quoted 15 lines · Gage Eads

This patch initializes the links_map array entries to EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by rte_event_port_links_get().

---
 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
lib/librte_eventdev/rte_eventdev.c +0 -0
index 68bfc3b..b8cd92b 100644
@@ -190,6 +190,8 @@ rte_event_dev_queue_config(struct rte_eventdev

*dev, uint8_t nb_queues)

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)

Quoted 13 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
 	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)

lib/librte_eventdev/rte_eventdev.c +1 -0
 					"nb_ports %u", nb_ports);
 			return -(ENOMEM);
 		}
+		for (i = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;

i++)

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)

Quoted 4 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release,

-ENOTSUP);

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev · line 315

Quoted 8 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
@@ -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 = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports *

RTE_EVENT_MAX_QUEUES_PER_DEV;

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev · line 317

Quoted 2 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
+			unsigned int links_map_end =
+				nb_ports *

RTE_EVENT_MAX_QUEUES_PER_DEV;

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev

Quoted 4 lines
lib/librte_eventdev/rte_eventdev.c +0 -0
 			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)

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)

Quoted 5 lines
lib/librte_eventdev/rte_eventdev.c +0 -2
 				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),

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)

Quoted 4 lines
lib/librte_eventdev/rte_eventdev.c +3 -1
-				0, sizeof(ports_enqueue_depth[0]) * new_ps);
+			for (i = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+

EVENT_QUEUE_SERVICE_PRIORITY_INVALID;

Quoted 6 lines

rte_event_port_setup() has rte_event_port_unlink() at the end of the function. 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 any other call sequence in mind?

Ah, I didn't realize that was a purpose of calling port_unlink at the end of 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_unlink() to reset the links_map runs from 0 to diag, and diag is 0 when the port is being set up since it has no queues to unlink at that time. (This is at least true of the 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 bound being dev->data->nb_queues, into rte_event_port_setup() after rte_event_port_unlink() is called (if it is successful). What do you think?

#3 lore raw
Quoted 81 lines · Gage
Quoted 74 lines

-----Original Message-----
From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, March 6, 2017 7:06 AM
To: Eads, Gage <[email protected]>
Cc: [email protected]; Richardson, Bruce <[email protected]>; [email protected]; Van Haaren, Harry <[email protected]>; [email protected]
Subject: Re: [PATCH] eventdev: Fix links_map initialization

lib/librte_eventdev/rte_eventdev.c rte_event_dev_queue_config(struct rte_eventdev

Quoted 15 lines · Gage Eads

This patch initializes the links_map array entries to EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by rte_event_port_links_get().

---
 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
lib/librte_eventdev/rte_eventdev.c +0 -0
index 68bfc3b..b8cd92b 100644
@@ -190,6 +190,8 @@ rte_event_dev_queue_config(struct rte_eventdev

*dev, uint8_t nb_queues)

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)

Quoted 13 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
 	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)

lib/librte_eventdev/rte_eventdev.c +1 -0
 					"nb_ports %u", nb_ports);
 			return -(ENOMEM);
 		}
+		for (i = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;

i++)

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)

Quoted 4 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release,

-ENOTSUP);

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev · line 315

Quoted 8 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
@@ -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 = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports *

RTE_EVENT_MAX_QUEUES_PER_DEV;

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev · line 317

Quoted 2 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
+			unsigned int links_map_end =
+				nb_ports *

RTE_EVENT_MAX_QUEUES_PER_DEV;

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev

Quoted 4 lines
lib/librte_eventdev/rte_eventdev.c +0 -0
 			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)

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)

Quoted 5 lines
lib/librte_eventdev/rte_eventdev.c +0 -2
 				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),

lib/librte_eventdev/rte_eventdev.c rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)

Quoted 4 lines
lib/librte_eventdev/rte_eventdev.c +3 -1
-				0, sizeof(ports_enqueue_depth[0]) * new_ps);
+			for (i = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+

EVENT_QUEUE_SERVICE_PRIORITY_INVALID;

Quoted 6 lines

rte_event_port_setup() has rte_event_port_unlink() at the end of the function. 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 any other call sequence in mind?

Quoted 6 lines

Ah, I didn't realize that was a purpose of calling port_unlink at the end of 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_unlink() to reset the links_map runs from 0 to diag, and diag is 0 when the port is being set up since it has no queues to unlink at that time. (This is at least true of the sw PMD, but would be the case for others, I imagine.)

I see. It was not the case for HW PMD. But if it is helping SW PMD case then we can use your original patch.

Quoted 4 lines

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

I think your original patch is fine. IMO, you can change the commit message to reflect the issue and send v2 based on your existing v1.

author
#4 lore raw

PATCH v2 1/1 eventdev: Fix links_map initialization for sw PMD

In reply to Gage Eads

This patch initializes the links_map array entries to EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by rte_event_port_links_get(). This is necessary for the sw eventdev PMD, which does not initialize links_map when rte_event_port_setup() calls rte_event_port_unlink().

---
v2: Refined commit message's description of patch

 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
lib/librte_eventdev/rte_eventdev.c +12 -5
index 68bfc3b..b8cd92b 100644
@@ -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 = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV; i++)
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		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 = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
+			unsigned int links_map_end =
+				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 = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 
 		dev->data->ports = ports;
@@ -815,8 +824,6 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	return diag;
 }
 
-#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
-
 int
 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		      uint8_t queues[], uint16_t nb_unlinks)
Signature · 1 line
2.7.4
Acked-by on v2 1/1
#5 lore raw

Re: [PATCH v2] eventdev: Fix links_map initialization for sw PMD

On Mon, Mar 06, 2017 at 11:02:48AM -0600, Gage Eads wrote:

Please fix the check-git-log.sh errors with this patch. With that change,

➜ $ ./devtools/check-git-log.sh
Wrong headline format:
eventdev: Fix links_map initialization for sw PMD
Wrong headline uppercase:
eventdev: Fix links_map initialization for sw PMD
Wrong headline lowercase:
eventdev: Fix links_map initialization for sw PMD
Missing 'Fixes' tag:
eventdev: Fix links_map initialization for sw PMD

Quoted 72 lines

This patch initializes the links_map array entries to EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by rte_event_port_links_get(). This is necessary for the sw eventdev PMD, which does not initialize links_map when rte_event_port_setup() calls rte_event_port_unlink().

---
v2: Refined commit message's description of patch

 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
lib/librte_eventdev/rte_eventdev.c +12 -5
index 68bfc3b..b8cd92b 100644
@@ -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 = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV; i++)
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		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 = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
+			unsigned int links_map_end =
+				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 = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 
 		dev->data->ports = ports;
@@ -815,8 +824,6 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	return diag;
 }
 
-#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
-
 int
 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		      uint8_t queues[], uint16_t nb_unlinks)
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH v3 1/1 eventdev: fix links map initialization for SW PMD

In reply to Gage Eads

This patch initializes the links_map array entries to EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by rte_event_port_links_get(). This is necessary for the sw eventdev PMD, which does not initialize links_map when rte_event_port_setup() calls rte_event_port_unlink().

Fixes e36bf651b3ca2 ("eventdev: implement the northbound APIs")
Acked-by Jerin Jacob <jerin.jacob at caviumnetworks.com>

---
v2: Refined commit message's description of patch
v3: Fixed check-git-log.sh errors, added Jerin's Acked-by

 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
lib/librte_eventdev/rte_eventdev.c +12 -5
index 68bfc3b..b8cd92b 100644
@@ -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 = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV; i++)
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		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 = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
+			unsigned int links_map_end =
+				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 = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 
 		dev->data->ports = ports;
@@ -815,8 +824,6 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	return diag;
 }
 
-#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
-
 int
 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		      uint8_t queues[], uint16_t nb_unlinks)
Signature · 1 line
2.7.4
Applied
#7 lore raw

Re: [PATCH v3] eventdev: fix links map initialization for SW PMD

Quoted 10 lines · Gage Eads

This patch initializes the links_map array entries to EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by rte_event_port_links_get(). This is necessary for the sw eventdev PMD, which does not initialize links_map when rte_event_port_setup() calls rte_event_port_unlink().

Fixes e36bf651b3ca2 ("eventdev: implement the northbound APIs")
Acked-by Jerin Jacob <jerin.jacob at caviumnetworks.com>

Applied to dpdk-next-eventdev/master after fixing check-git-log.sh warning
http://dpdk.org/ml/archives/test-report/2017-March/013029.html

Thanks.

Quoted 66 lines

---
v2: Refined commit message's description of patch
v3: Fixed check-git-log.sh errors, added Jerin's Acked-by

 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
lib/librte_eventdev/rte_eventdev.c +12 -5
index 68bfc3b..b8cd92b 100644
@@ -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 = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV; i++)
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		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 = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
+			unsigned int links_map_end =
+				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 = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 
 		dev->data->ports = ports;
@@ -815,8 +824,6 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	return diag;
 }
 
-#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
-
 int
 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		      uint8_t queues[], uint16_t nb_unlinks)
Signature · 1 line
2.7.4