DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls
@ 2017-06-22 12:30 John Miller
  2017-06-22 12:30 ` [dpdk-dev] [PATCH 2/2] net/ark: fix bug in stats_reset operation John Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: John Miller @ 2017-06-22 12:30 UTC (permalink / raw)
  To: dev; +Cc: shepard.siegel, ed.czeck, John Miller

Provide unique user data pointer in the extension calls for
each port.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 71 +++++++++++++++++++++++++++++++++-----------
 drivers/net/ark/ark_ext.h    |  4 +++
 drivers/net/ark/ark_global.h |  5 ++--
 3 files changed, 60 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index c061f7b..55e6b24 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -77,6 +77,7 @@ static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
 			       uint32_t pool);
 static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 				   uint32_t index);
+static int  eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
 
 /*
  * The packet generator is a functional block used to generate packet
@@ -179,6 +180,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	.mac_addr_add = eth_ark_macaddr_add,
 	.mac_addr_remove = eth_ark_macaddr_remove,
 	.mac_addr_set = eth_ark_set_default_mac_addr,
+
+	.mtu_set = eth_ark_set_mtu,
 };
 
 static int
@@ -256,6 +259,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(void (*)(struct rte_eth_dev *, struct ether_addr *,
 			  void *))
 		dlsym(ark->d_handle, "mac_addr_set");
+	ark->user_ext.set_mtu =
+		(int (*)(struct rte_eth_dev *, uint16_t,
+			  void *))
+		dlsym(ark->d_handle, "set_mtu");
 
 	return found;
 }
@@ -346,8 +353,9 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	}
 
 	if (ark->user_ext.dev_init) {
-		ark->user_data = ark->user_ext.dev_init(dev, ark->a_bar, 0);
-		if (!ark->user_data) {
+		ark->user_data[dev->data->port_id] =
+			ark->user_ext.dev_init(dev, ark->a_bar, 0);
+		if (!ark->user_data[dev->data->port_id]) {
 			PMD_DRV_LOG(INFO,
 				    "Failed to initialize PMD extension!"
 				    " continuing without it\n");
@@ -369,7 +377,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	 */
 	if (ark->user_ext.dev_get_port_count)
 		port_count =
-			ark->user_ext.dev_get_port_count(dev, ark->user_data);
+			ark->user_ext.dev_get_port_count(dev,
+				 ark->user_data[dev->data->port_id]);
 	ark->num_ports = port_count;
 
 	for (p = 0; p < port_count; p++) {
@@ -410,9 +419,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 			goto error;
 		}
 
-		if (ark->user_ext.dev_init)
-			ark->user_data =
+		if (ark->user_ext.dev_init) {
+			ark->user_data[eth_dev->data->port_id] =
 				ark->user_ext.dev_init(dev, ark->a_bar, p);
+		}
 	}
 
 	return ret;
@@ -508,7 +518,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		return 0;
 
 	if (ark->user_ext.dev_uninit)
-		ark->user_ext.dev_uninit(dev, ark->user_data);
+		ark->user_ext.dev_uninit(dev,
+			 ark->user_data[dev->data->port_id]);
 
 	ark_pktgen_uninit(ark->pg);
 	ark_pktchkr_uninit(ark->pc);
@@ -529,7 +540,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 
 	eth_ark_dev_set_link_up(dev);
 	if (ark->user_ext.dev_configure)
-		return ark->user_ext.dev_configure(dev, ark->user_data);
+		return ark->user_ext.dev_configure(dev,
+			   ark->user_data[dev->data->port_id]);
 	return 0;
 }
 
@@ -592,7 +604,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	}
 
 	if (ark->user_ext.dev_start)
-		ark->user_ext.dev_start(dev, ark->user_data);
+		ark->user_ext.dev_start(dev,
+			ark->user_data[dev->data->port_id]);
 
 	return 0;
 }
@@ -614,7 +627,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 
 	/* Stop the extension first */
 	if (ark->user_ext.dev_stop)
-		ark->user_ext.dev_stop(dev, ark->user_data);
+		ark->user_ext.dev_stop(dev,
+		       ark->user_data[dev->data->port_id]);
 
 	/* Stop the packet generator */
 	if (ark->start_pg)
@@ -697,7 +711,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	uint16_t i;
 
 	if (ark->user_ext.dev_close)
-		ark->user_ext.dev_close(dev, ark->user_data);
+		ark->user_ext.dev_close(dev,
+		 ark->user_data[dev->data->port_id]);
 
 	eth_ark_dev_stop(dev);
 	eth_ark_udm_force_close(dev);
@@ -765,7 +780,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	if (ark->user_ext.link_update) {
 		return ark->user_ext.link_update
 			(dev, wait_to_complete,
-			 ark->user_data);
+			 ark->user_data[dev->data->port_id]);
 	}
 	return 0;
 }
@@ -778,7 +793,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	if (ark->user_ext.dev_set_link_up)
-		return ark->user_ext.dev_set_link_up(dev, ark->user_data);
+		return ark->user_ext.dev_set_link_up(dev,
+			     ark->user_data[dev->data->port_id]);
 	return 0;
 }
 
@@ -790,7 +806,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	if (ark->user_ext.dev_set_link_down)
-		return ark->user_ext.dev_set_link_down(dev, ark->user_data);
+		return ark->user_ext.dev_set_link_down(dev,
+		       ark->user_data[dev->data->port_id]);
 	return 0;
 }
 
@@ -813,7 +830,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		eth_rx_queue_stats_get(dev->data->rx_queues[i], stats);
 	if (ark->user_ext.stats_get)
-		ark->user_ext.stats_get(dev, stats, ark->user_data);
+		ark->user_ext.stats_get(dev, stats,
+			ark->user_data[dev->data->port_id]);
 }
 
 static void
@@ -828,7 +846,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		eth_rx_queue_stats_reset(dev->data->rx_queues[i]);
 	if (ark->user_ext.stats_reset)
-		ark->user_ext.stats_reset(dev, ark->user_data);
+		ark->user_ext.stats_reset(dev,
+			  ark->user_data[dev->data->port_id]);
 }
 
 static int
@@ -845,7 +864,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 					   mac_addr,
 					   index,
 					   pool,
-					   ark->user_data);
+			   ark->user_data[dev->data->port_id]);
 		return 0;
 	}
 	return -ENOTSUP;
@@ -858,7 +877,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	if (ark->user_ext.mac_addr_remove)
-		ark->user_ext.mac_addr_remove(dev, index, ark->user_data);
+		ark->user_ext.mac_addr_remove(dev, index,
+			      ark->user_data[dev->data->port_id]);
 }
 
 static void
@@ -869,7 +889,22 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	if (ark->user_ext.mac_addr_set)
-		ark->user_ext.mac_addr_set(dev, mac_addr, ark->user_data);
+		ark->user_ext.mac_addr_set(dev, mac_addr,
+			   ark->user_data[dev->data->port_id]);
+}
+
+static int
+eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t  size)
+{
+	struct ark_adapter *ark =
+		(struct ark_adapter *)dev->data->dev_private;
+
+	if (ark->user_ext.set_mtu)
+		return ark->user_ext.set_mtu(dev, size,
+			     ark->user_data[dev->data->port_id]);
+
+	return -ENOTSUP;
+
 }
 
 static inline int
diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h
index f805f64..63b7a26 100644
--- a/drivers/net/ark/ark_ext.h
+++ b/drivers/net/ark/ark_ext.h
@@ -112,4 +112,8 @@ void mac_addr_set(struct rte_eth_dev *dev,
 		  struct ether_addr *mac_addr,
 		  void *user_data);
 
+int set_mtu(struct rte_eth_dev *dev,
+	    uint16_t size,
+	    void *user_data);
+
 #endif
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index a2e9e8f..2a6375f 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -64,7 +64,7 @@
 #define ARK_RCPACING_BASE 0xb0000
 #define ARK_EXTERNAL_BASE 0x100000
 #define ARK_MPU_QOFFSET   0x00100
-#define ARK_MAX_PORTS     8
+#define ARK_MAX_PORTS     RTE_MAX_ETHPORTS
 
 #define offset8(n)     n
 #define offset16(n)   ((n) / 2)
@@ -106,11 +106,12 @@ struct ark_user_ext {
 						 void *);
 	void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *);
 	void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *);
+	int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *);
 };
 
 struct ark_adapter {
 	/* User extension private data */
-	void *user_data;
+	void *user_data[ARK_MAX_PORTS];
 
 	/* Pointers to packet generator and checker */
 	int start_pg;
-- 
1.9.1

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

* [dpdk-dev] [PATCH 2/2] net/ark: fix bug in stats_reset operation
  2017-06-22 12:30 [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls John Miller
@ 2017-06-22 12:30 ` John Miller
  2017-06-23  9:21 ` [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls Ferruh Yigit
  2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix John Miller
  2 siblings, 0 replies; 9+ messages in thread
From: John Miller @ 2017-06-22 12:30 UTC (permalink / raw)
  To: dev; +Cc: shepard.siegel, ed.czeck, John Miller

Repairs a bug in the stats_reset where the wrong queue was
being passed into tx reset.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 55e6b24..fff2d8a 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -842,7 +842,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++)
-		eth_tx_queue_stats_reset(dev->data->rx_queues[i]);
+		eth_tx_queue_stats_reset(dev->data->tx_queues[i]);
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		eth_rx_queue_stats_reset(dev->data->rx_queues[i]);
 	if (ark->user_ext.stats_reset)
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls
  2017-06-22 12:30 [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls John Miller
  2017-06-22 12:30 ` [dpdk-dev] [PATCH 2/2] net/ark: fix bug in stats_reset operation John Miller
@ 2017-06-23  9:21 ` Ferruh Yigit
  2017-06-23 10:06   ` Shepard Siegel
  2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix John Miller
  2 siblings, 1 reply; 9+ messages in thread
From: Ferruh Yigit @ 2017-06-23  9:21 UTC (permalink / raw)
  To: John Miller, dev; +Cc: shepard.siegel, ed.czeck

On 6/22/2017 1:30 PM, John Miller wrote:
> Provide unique user data pointer in the extension calls for
> each port.

Hi John,

Can you please give more details about why this is done. I can see in
adapter data user_data pointer kept per port now, but why? What was
observed with previous code? If this is to fix something, what we should
expect to be fixed?

And there is mtu_set implementation, is it related modification? Can be
separated to another patch?

Thanks,
ferruh

> 
> Signed-off-by: John Miller <john.miller@atomicrules.com>

<...>

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

* Re: [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls
  2017-06-23  9:21 ` [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls Ferruh Yigit
@ 2017-06-23 10:06   ` Shepard Siegel
  0 siblings, 0 replies; 9+ messages in thread
From: Shepard Siegel @ 2017-06-23 10:06 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: John Miller, dev, Ed Czeck

Hi Ferruh,

I was absent from the code review John Miller and Ed Czeck held for earlier
this week for this patch set. John and Ed are both on a long weekend this
weekend. If my reply below is correct and sufficient, please ack this patch
set. Otherwise, no reply is needed and please hold this open until next
Monday when John will respond.

The Arkville net/ark PMD has the unique challenge of supporting a plurality
of MACs through singleton ingress and egress AXI interfaces in hardware.
Arkville is in the DPDK business of mbuf structures and data-moving; and
does not itself have a concept of line-rate, MTU, and other MAC-centric
properties. The extension calls, and the unique user data for each port in
the extension calls provide users of Arkville and the net/ark PMD a DPDK
normalized way of accessing their MAC parameters, regardless of how many
MACs they have instanced in their Arkville DPDK device.

-Shep

Shepard Siegel, CTO
atomicrules.com


On Fri, Jun 23, 2017 at 5:21 AM, Ferruh Yigit <ferruh.yigit@intel.com>
wrote:

> On 6/22/2017 1:30 PM, John Miller wrote:
> > Provide unique user data pointer in the extension calls for
> > each port.
>
> Hi John,
>
> Can you please give more details about why this is done. I can see in
> adapter data user_data pointer kept per port now, but why? What was
> observed with previous code? If this is to fix something, what we should
> expect to be fixed?
>
> And there is mtu_set implementation, is it related modification? Can be
> separated to another patch?
>
> Thanks,
> ferruh
>
> >
> > Signed-off-by: John Miller <john.miller@atomicrules.com>
>
> <...>
>
>

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

* [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix
  2017-06-22 12:30 [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls John Miller
  2017-06-22 12:30 ` [dpdk-dev] [PATCH 2/2] net/ark: fix bug in stats_reset operation John Miller
  2017-06-23  9:21 ` [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls Ferruh Yigit
@ 2017-06-28 10:08 ` John Miller
  2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 1/3] net/ark: allow unique user data for each port in extension calls John Miller
                     ` (3 more replies)
  2 siblings, 4 replies; 9+ messages in thread
From: John Miller @ 2017-06-28 10:08 UTC (permalink / raw)
  To: dev; +Cc: shepard.siegel, ed.czeck, John Miller

v2:
* Split the user extension private data per port patch and the
  set_mtu patch into separate patches.
* Add better description to per port private data patch
* stats_reset patch untouched from V1

John Miller (3):
  net/ark: allow unique user data for each port in extension calls
  net/ark: add set_mtu call to user extension API
  net/ark: fix bug in stats_reset operation

 drivers/net/ark/ark_ethdev.c | 72 ++++++++++++++++++++++++++++++++------------
 drivers/net/ark/ark_ext.h    |  4 +++
 drivers/net/ark/ark_global.h |  5 +--
 3 files changed, 60 insertions(+), 21 deletions(-)

-- 
1.9.1

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

* [dpdk-dev] [PATCH v2 1/3] net/ark: allow unique user data for each port in extension calls
  2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix John Miller
@ 2017-06-28 10:08   ` John Miller
  2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 2/3] net/ark: add set_mtu call to user extension API John Miller
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: John Miller @ 2017-06-28 10:08 UTC (permalink / raw)
  To: dev; +Cc: shepard.siegel, ed.czeck, John Miller

This change allows a user extension to provide unique private
callback data for all ports.

Arkville is a single-function multi-port device.  User_data resides
in the singleton Arkville structure.  This structure is shared across
all ports devices (eth_dev) which are created one per port.  For the
command extension callback we provide an opaque user pointer, which is
currently implemented in the singleton Arkville structure.

With this patch, we are providing a unique user pointer for each port
rather than a common pointer across multiple ports.  The pointers are
stored in an array of size RTE_MAX_ETHPORTS in the arkville structure and
are indexed by port_id in the PMD. The motivation for this change is that
users of the arkville PMD extension have a unique pointer per port rather
then one per function.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 51 ++++++++++++++++++++++++++++----------------
 drivers/net/ark/ark_global.h |  4 ++--
 2 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index c061f7b..e5a8ff7 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -179,6 +179,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	.mac_addr_add = eth_ark_macaddr_add,
 	.mac_addr_remove = eth_ark_macaddr_remove,
 	.mac_addr_set = eth_ark_set_default_mac_addr,
+
 };
 
 static int
@@ -346,8 +347,9 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	}
 
 	if (ark->user_ext.dev_init) {
-		ark->user_data = ark->user_ext.dev_init(dev, ark->a_bar, 0);
-		if (!ark->user_data) {
+		ark->user_data[dev->data->port_id] =
+			ark->user_ext.dev_init(dev, ark->a_bar, 0);
+		if (!ark->user_data[dev->data->port_id]) {
 			PMD_DRV_LOG(INFO,
 				    "Failed to initialize PMD extension!"
 				    " continuing without it\n");
@@ -369,7 +371,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	 */
 	if (ark->user_ext.dev_get_port_count)
 		port_count =
-			ark->user_ext.dev_get_port_count(dev, ark->user_data);
+			ark->user_ext.dev_get_port_count(dev,
+				 ark->user_data[dev->data->port_id]);
 	ark->num_ports = port_count;
 
 	for (p = 0; p < port_count; p++) {
@@ -410,9 +413,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 			goto error;
 		}
 
-		if (ark->user_ext.dev_init)
-			ark->user_data =
+		if (ark->user_ext.dev_init) {
+			ark->user_data[eth_dev->data->port_id] =
 				ark->user_ext.dev_init(dev, ark->a_bar, p);
+		}
 	}
 
 	return ret;
@@ -508,7 +512,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		return 0;
 
 	if (ark->user_ext.dev_uninit)
-		ark->user_ext.dev_uninit(dev, ark->user_data);
+		ark->user_ext.dev_uninit(dev,
+			 ark->user_data[dev->data->port_id]);
 
 	ark_pktgen_uninit(ark->pg);
 	ark_pktchkr_uninit(ark->pc);
@@ -529,7 +534,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 
 	eth_ark_dev_set_link_up(dev);
 	if (ark->user_ext.dev_configure)
-		return ark->user_ext.dev_configure(dev, ark->user_data);
+		return ark->user_ext.dev_configure(dev,
+			   ark->user_data[dev->data->port_id]);
 	return 0;
 }
 
@@ -592,7 +598,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	}
 
 	if (ark->user_ext.dev_start)
-		ark->user_ext.dev_start(dev, ark->user_data);
+		ark->user_ext.dev_start(dev,
+			ark->user_data[dev->data->port_id]);
 
 	return 0;
 }
@@ -614,7 +621,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 
 	/* Stop the extension first */
 	if (ark->user_ext.dev_stop)
-		ark->user_ext.dev_stop(dev, ark->user_data);
+		ark->user_ext.dev_stop(dev,
+		       ark->user_data[dev->data->port_id]);
 
 	/* Stop the packet generator */
 	if (ark->start_pg)
@@ -697,7 +705,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	uint16_t i;
 
 	if (ark->user_ext.dev_close)
-		ark->user_ext.dev_close(dev, ark->user_data);
+		ark->user_ext.dev_close(dev,
+		 ark->user_data[dev->data->port_id]);
 
 	eth_ark_dev_stop(dev);
 	eth_ark_udm_force_close(dev);
@@ -765,7 +774,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	if (ark->user_ext.link_update) {
 		return ark->user_ext.link_update
 			(dev, wait_to_complete,
-			 ark->user_data);
+			 ark->user_data[dev->data->port_id]);
 	}
 	return 0;
 }
@@ -778,7 +787,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	if (ark->user_ext.dev_set_link_up)
-		return ark->user_ext.dev_set_link_up(dev, ark->user_data);
+		return ark->user_ext.dev_set_link_up(dev,
+			     ark->user_data[dev->data->port_id]);
 	return 0;
 }
 
@@ -790,7 +800,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	if (ark->user_ext.dev_set_link_down)
-		return ark->user_ext.dev_set_link_down(dev, ark->user_data);
+		return ark->user_ext.dev_set_link_down(dev,
+		       ark->user_data[dev->data->port_id]);
 	return 0;
 }
 
@@ -813,7 +824,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		eth_rx_queue_stats_get(dev->data->rx_queues[i], stats);
 	if (ark->user_ext.stats_get)
-		ark->user_ext.stats_get(dev, stats, ark->user_data);
+		ark->user_ext.stats_get(dev, stats,
+			ark->user_data[dev->data->port_id]);
 }
 
 static void
@@ -828,7 +840,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		eth_rx_queue_stats_reset(dev->data->rx_queues[i]);
 	if (ark->user_ext.stats_reset)
-		ark->user_ext.stats_reset(dev, ark->user_data);
+		ark->user_ext.stats_reset(dev,
+			  ark->user_data[dev->data->port_id]);
 }
 
 static int
@@ -845,7 +858,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 					   mac_addr,
 					   index,
 					   pool,
-					   ark->user_data);
+			   ark->user_data[dev->data->port_id]);
 		return 0;
 	}
 	return -ENOTSUP;
@@ -858,7 +871,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	if (ark->user_ext.mac_addr_remove)
-		ark->user_ext.mac_addr_remove(dev, index, ark->user_data);
+		ark->user_ext.mac_addr_remove(dev, index,
+			      ark->user_data[dev->data->port_id]);
 }
 
 static void
@@ -869,7 +883,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	if (ark->user_ext.mac_addr_set)
-		ark->user_ext.mac_addr_set(dev, mac_addr, ark->user_data);
+		ark->user_ext.mac_addr_set(dev, mac_addr,
+			   ark->user_data[dev->data->port_id]);
 }
 
 static inline int
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index a2e9e8f..58af8db 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -64,7 +64,7 @@
 #define ARK_RCPACING_BASE 0xb0000
 #define ARK_EXTERNAL_BASE 0x100000
 #define ARK_MPU_QOFFSET   0x00100
-#define ARK_MAX_PORTS     8
+#define ARK_MAX_PORTS     RTE_MAX_ETHPORTS
 
 #define offset8(n)     n
 #define offset16(n)   ((n) / 2)
@@ -110,7 +110,7 @@ struct ark_user_ext {
 
 struct ark_adapter {
 	/* User extension private data */
-	void *user_data;
+	void *user_data[ARK_MAX_PORTS];
 
 	/* Pointers to packet generator and checker */
 	int start_pg;
-- 
1.9.1

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

* [dpdk-dev] [PATCH v2 2/3] net/ark: add set_mtu call to user extension API
  2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix John Miller
  2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 1/3] net/ark: allow unique user data for each port in extension calls John Miller
@ 2017-06-28 10:08   ` John Miller
  2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 3/3] net/ark: fix bug in stats_reset operation John Miller
  2017-06-28 12:39   ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix Ferruh Yigit
  3 siblings, 0 replies; 9+ messages in thread
From: John Miller @ 2017-06-28 10:08 UTC (permalink / raw)
  To: dev; +Cc: shepard.siegel, ed.czeck, John Miller

Allows a user extension to set a callback for the set_mtu
operation.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 19 +++++++++++++++++++
 drivers/net/ark/ark_ext.h    |  4 ++++
 drivers/net/ark/ark_global.h |  1 +
 3 files changed, 24 insertions(+)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index e5a8ff7..5733ba3 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -77,6 +77,7 @@ static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
 			       uint32_t pool);
 static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 				   uint32_t index);
+static int  eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
 
 /*
  * The packet generator is a functional block used to generate packet
@@ -180,6 +181,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 	.mac_addr_remove = eth_ark_macaddr_remove,
 	.mac_addr_set = eth_ark_set_default_mac_addr,
 
+	.mtu_set = eth_ark_set_mtu,
 };
 
 static int
@@ -257,6 +259,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(void (*)(struct rte_eth_dev *, struct ether_addr *,
 			  void *))
 		dlsym(ark->d_handle, "mac_addr_set");
+	ark->user_ext.set_mtu =
+		(int (*)(struct rte_eth_dev *, uint16_t,
+			  void *))
+		dlsym(ark->d_handle, "set_mtu");
 
 	return found;
 }
@@ -887,6 +893,19 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 			   ark->user_data[dev->data->port_id]);
 }
 
+static int
+eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t  size)
+{
+	struct ark_adapter *ark =
+		(struct ark_adapter *)dev->data->dev_private;
+
+	if (ark->user_ext.set_mtu)
+		return ark->user_ext.set_mtu(dev, size,
+			     ark->user_data[dev->data->port_id]);
+
+	return -ENOTSUP;
+}
+
 static inline int
 process_pktdir_arg(const char *key, const char *value,
 		   void *extra_args)
diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h
index f805f64..63b7a26 100644
--- a/drivers/net/ark/ark_ext.h
+++ b/drivers/net/ark/ark_ext.h
@@ -112,4 +112,8 @@ void mac_addr_set(struct rte_eth_dev *dev,
 		  struct ether_addr *mac_addr,
 		  void *user_data);
 
+int set_mtu(struct rte_eth_dev *dev,
+	    uint16_t size,
+	    void *user_data);
+
 #endif
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 58af8db..2a6375f 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -106,6 +106,7 @@ struct ark_user_ext {
 						 void *);
 	void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *);
 	void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *);
+	int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *);
 };
 
 struct ark_adapter {
-- 
1.9.1

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

* [dpdk-dev] [PATCH v2 3/3] net/ark: fix bug in stats_reset operation
  2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix John Miller
  2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 1/3] net/ark: allow unique user data for each port in extension calls John Miller
  2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 2/3] net/ark: add set_mtu call to user extension API John Miller
@ 2017-06-28 10:08   ` John Miller
  2017-06-28 12:39   ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix Ferruh Yigit
  3 siblings, 0 replies; 9+ messages in thread
From: John Miller @ 2017-06-28 10:08 UTC (permalink / raw)
  To: dev; +Cc: shepard.siegel, ed.czeck, John Miller

Repairs a bug in the stats_reset where the wrong queue was
being passed into tx reset.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 5733ba3..6db362b 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -842,7 +842,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 		(struct ark_adapter *)dev->data->dev_private;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++)
-		eth_tx_queue_stats_reset(dev->data->rx_queues[i]);
+		eth_tx_queue_stats_reset(dev->data->tx_queues[i]);
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		eth_rx_queue_stats_reset(dev->data->rx_queues[i]);
 	if (ark->user_ext.stats_reset)
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix
  2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix John Miller
                     ` (2 preceding siblings ...)
  2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 3/3] net/ark: fix bug in stats_reset operation John Miller
@ 2017-06-28 12:39   ` Ferruh Yigit
  3 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2017-06-28 12:39 UTC (permalink / raw)
  To: John Miller, dev; +Cc: shepard.siegel, ed.czeck

On 6/28/2017 11:08 AM, John Miller wrote:
> v2:
> * Split the user extension private data per port patch and the
>   set_mtu patch into separate patches.
> * Add better description to per port private data patch
> * stats_reset patch untouched from V1
> 
> John Miller (3):
>   net/ark: allow unique user data for each port in extension calls
>   net/ark: add set_mtu call to user extension API
>   net/ark: fix bug in stats_reset operation

Series applied to dpdk-next-net/master, thanks.

(some patch titles updated)

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

end of thread, other threads:[~2017-06-28 12:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22 12:30 [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls John Miller
2017-06-22 12:30 ` [dpdk-dev] [PATCH 2/2] net/ark: fix bug in stats_reset operation John Miller
2017-06-23  9:21 ` [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls Ferruh Yigit
2017-06-23 10:06   ` Shepard Siegel
2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix John Miller
2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 1/3] net/ark: allow unique user data for each port in extension calls John Miller
2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 2/3] net/ark: add set_mtu call to user extension API John Miller
2017-06-28 10:08   ` [dpdk-dev] [PATCH v2 3/3] net/ark: fix bug in stats_reset operation John Miller
2017-06-28 12:39   ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix Ferruh Yigit

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).