* [PATCH] net/ring: add umonitor callback
@ 2022-08-03 14:28 Herakliusz Lipiec
2022-09-01 14:43 ` Bruce Richardson
2022-09-02 17:25 ` [PATCH v2] net/ring: add monitor callback Herakliusz Lipiec
0 siblings, 2 replies; 4+ messages in thread
From: Herakliusz Lipiec @ 2022-08-03 14:28 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, reshma.pattan, bruce.richardson, Herakliusz Lipiec
Currently ring pmd does not support ``rte_power_monitor`` api.
This patch adds support by adding umonitor callback that is called
whenever we enter sleep state and need to check if it is time to wake
up.
Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
---
drivers/net/ring/rte_eth_ring.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cfb81da5fe..1bb6b196cb 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -284,6 +284,28 @@ eth_dev_close(struct rte_eth_dev *dev)
return ret;
}
+static int ring_monitor_callback(const uint64_t value,
+ const uint64_t arg[RTE_POWER_MONITOR_OPAQUE_SZ])
+{
+ /* Check if the head pointer has changed */
+ return value != arg[0];
+}
+
+static int
+eth_get_monitor_addr(void* rx_queue, struct rte_power_monitor_cond *pmc)
+{
+ struct rte_ring *rng = ((struct ring_queue*) rx_queue)->rng;
+
+ /* Monitor ring head since if head moves
+ * there are packets to transmit
+ * */
+ pmc->addr = &rng->prod.head;
+ pmc->size = sizeof(rng->prod.head);
+ pmc->opaque[0] = rng->prod.head;
+ pmc->fn = ring_monitor_callback;
+ return 0;
+}
+
static const struct eth_dev_ops ops = {
.dev_close = eth_dev_close,
.dev_start = eth_dev_start,
@@ -303,6 +325,7 @@ static const struct eth_dev_ops ops = {
.promiscuous_disable = eth_promiscuous_disable,
.allmulticast_enable = eth_allmulticast_enable,
.allmulticast_disable = eth_allmulticast_disable,
+ .get_monitor_addr = eth_get_monitor_addr,
};
static int
--
2.36.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/ring: add umonitor callback
2022-08-03 14:28 [PATCH] net/ring: add umonitor callback Herakliusz Lipiec
@ 2022-09-01 14:43 ` Bruce Richardson
2022-09-02 17:25 ` [PATCH v2] net/ring: add monitor callback Herakliusz Lipiec
1 sibling, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2022-09-01 14:43 UTC (permalink / raw)
To: Herakliusz Lipiec; +Cc: dev, anatoly.burakov, reshma.pattan
On Wed, Aug 03, 2022 at 03:28:45PM +0100, Herakliusz Lipiec wrote:
> Currently ring pmd does not support ``rte_power_monitor`` api.
> This patch adds support by adding umonitor callback that is called
> whenever we enter sleep state and need to check if it is time to wake
> up.
>
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> ---
Code looks ok to me, but I think the commit log and title needs to remove
references to umonitor. The generic API in DPDK is just called "monitor".
With such rewording.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> drivers/net/ring/rte_eth_ring.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
> index cfb81da5fe..1bb6b196cb 100644
> --- a/drivers/net/ring/rte_eth_ring.c
> +++ b/drivers/net/ring/rte_eth_ring.c
> @@ -284,6 +284,28 @@ eth_dev_close(struct rte_eth_dev *dev)
> return ret;
> }
>
> +static int ring_monitor_callback(const uint64_t value,
> + const uint64_t arg[RTE_POWER_MONITOR_OPAQUE_SZ])
> +{
> + /* Check if the head pointer has changed */
> + return value != arg[0];
> +}
> +
> +static int
> +eth_get_monitor_addr(void* rx_queue, struct rte_power_monitor_cond *pmc)
> +{
> + struct rte_ring *rng = ((struct ring_queue*) rx_queue)->rng;
> +
> + /* Monitor ring head since if head moves
> + * there are packets to transmit
> + * */
> + pmc->addr = &rng->prod.head;
> + pmc->size = sizeof(rng->prod.head);
> + pmc->opaque[0] = rng->prod.head;
> + pmc->fn = ring_monitor_callback;
> + return 0;
> +}
> +
> static const struct eth_dev_ops ops = {
> .dev_close = eth_dev_close,
> .dev_start = eth_dev_start,
> @@ -303,6 +325,7 @@ static const struct eth_dev_ops ops = {
> .promiscuous_disable = eth_promiscuous_disable,
> .allmulticast_enable = eth_allmulticast_enable,
> .allmulticast_disable = eth_allmulticast_disable,
> + .get_monitor_addr = eth_get_monitor_addr,
> };
>
> static int
> --
> 2.36.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] net/ring: add monitor callback
2022-08-03 14:28 [PATCH] net/ring: add umonitor callback Herakliusz Lipiec
2022-09-01 14:43 ` Bruce Richardson
@ 2022-09-02 17:25 ` Herakliusz Lipiec
2022-10-04 15:12 ` Andrew Rybchenko
1 sibling, 1 reply; 4+ messages in thread
From: Herakliusz Lipiec @ 2022-09-02 17:25 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, reshma.pattan, bruce.richardson, Herakliusz Lipiec
Currently ring pmd does not support ``rte_power_monitor`` api.
This patch adds support by adding monitor callback that is called
whenever we enter sleep state and need to check if it is time to wake
up.
Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2:
- changed umonitor references to monitor as this is how it appears in
dpdk api
- fixed coding style issues
---
drivers/net/ring/rte_eth_ring.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cfb81da5fe..1050c22777 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -284,6 +284,29 @@ eth_dev_close(struct rte_eth_dev *dev)
return ret;
}
+static int ring_monitor_callback(const uint64_t value,
+ const uint64_t arg[RTE_POWER_MONITOR_OPAQUE_SZ])
+{
+ /* Check if the head pointer has changed */
+ return value != arg[0];
+}
+
+static int
+eth_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc)
+{
+ struct rte_ring *rng = ((struct ring_queue *)rx_queue)->rng;
+
+ /*
+ * Monitor ring head since if head moves
+ * there are packets to transmit
+ */
+ pmc->addr = &rng->prod.head;
+ pmc->size = sizeof(rng->prod.head);
+ pmc->opaque[0] = rng->prod.head;
+ pmc->fn = ring_monitor_callback;
+ return 0;
+}
+
static const struct eth_dev_ops ops = {
.dev_close = eth_dev_close,
.dev_start = eth_dev_start,
@@ -303,6 +326,7 @@ static const struct eth_dev_ops ops = {
.promiscuous_disable = eth_promiscuous_disable,
.allmulticast_enable = eth_allmulticast_enable,
.allmulticast_disable = eth_allmulticast_disable,
+ .get_monitor_addr = eth_get_monitor_addr,
};
static int
--
2.36.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] net/ring: add monitor callback
2022-09-02 17:25 ` [PATCH v2] net/ring: add monitor callback Herakliusz Lipiec
@ 2022-10-04 15:12 ` Andrew Rybchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Rybchenko @ 2022-10-04 15:12 UTC (permalink / raw)
To: Herakliusz Lipiec, dev; +Cc: anatoly.burakov, reshma.pattan, bruce.richardson
On 9/2/22 20:25, Herakliusz Lipiec wrote:
> Currently ring pmd does not support ``rte_power_monitor`` api.
> This patch adds support by adding monitor callback that is called
> whenever we enter sleep state and need to check if it is time to wake
> up.
>
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-04 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 14:28 [PATCH] net/ring: add umonitor callback Herakliusz Lipiec
2022-09-01 14:43 ` Bruce Richardson
2022-09-02 17:25 ` [PATCH v2] net/ring: add monitor callback Herakliusz Lipiec
2022-10-04 15:12 ` Andrew Rybchenko
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).