DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v3] event/dlb2: fix port COS range allocation
@ 2022-10-20 17:31 Abdullah Sevincer
  2022-10-21  8:04 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Abdullah Sevincer @ 2022-10-20 17:31 UTC (permalink / raw)
  To: dev; +Cc: jerinj, shivani.doneria, tirthendu.sarkar, Abdullah Sevincer, stable

This commit fixes allocation of port COS
when application requested port COS exceeds
(e.g. beyond 0-15) the number of LDB ports for
the domain.

We limit application specified ports from a
COS to the max ports allocated for the COS
so that the rest of the of the ports can be
allocated from default(best) COS.

Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS")
Cc: stable@dpdk.org

Signed-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com>
---
 drivers/event/dlb2/dlb2.c      | 9 ++++++---
 drivers/event/dlb2/dlb2_priv.h | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 02f0e57208..60c5cd4804 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -182,8 +182,10 @@ dlb2_init_port_cos(struct dlb2_eventdev *dlb2, int *port_cos)
 
 	for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) {
 		dlb2->ev_ports[q].cos_id = port_cos[q];
-		if (port_cos[q] != DLB2_COS_DEFAULT) {
+		if (port_cos[q] != DLB2_COS_DEFAULT &&
+		    dlb2->cos_ports[port_cos[q]] < DLB2_MAX_NUM_LDB_PORTS_PER_COS) {
 			dlb2->cos_ports[port_cos[q]]++;
+			dlb2->max_cos_port = q;
 		}
 	}
 }
@@ -841,8 +843,9 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2,
 	cos_ports = dlb2->cos_ports[0] + dlb2->cos_ports[1] +
 		    dlb2->cos_ports[2] + dlb2->cos_ports[3];
 
-	if (cos_ports > resources_asked->num_ldb_ports) {
-		DLB2_LOG_ERR("dlb2: num_ldb_ports < nonzero cos_ports\n");
+	if (cos_ports > resources_asked->num_ldb_ports ||
+	    (cos_ports && dlb2->max_cos_port >= resources_asked->num_ldb_ports)) {
+		DLB2_LOG_ERR("dlb2: num_ldb_ports < cos_ports\n");
 		ret = EINVAL;
 		goto error_exit;
 	}
diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
index ac20c5a179..f4b9e7f9ff 100644
--- a/drivers/event/dlb2/dlb2_priv.h
+++ b/drivers/event/dlb2/dlb2_priv.h
@@ -92,6 +92,7 @@
 #define DLB2_NUM_SN_GROUPS 2
 #define DLB2_MAX_LDB_SN_ALLOC 1024
 #define DLB2_MAX_QUEUE_DEPTH_THRESHOLD 8191
+#define DLB2_MAX_NUM_LDB_PORTS_PER_COS (DLB2_MAX_NUM_LDB_PORTS/DLB2_COS_NUM_VALS)
 
 /* 2048 total hist list entries and 64 total ldb ports, which
  * makes for 2048/64 == 32 hist list entries per port. However, CQ
@@ -635,6 +636,7 @@ struct dlb2_eventdev {
 	};
 	uint32_t cos_ports[DLB2_COS_NUM_VALS]; /* total ldb ports in each class */
 	uint32_t cos_bw[DLB2_COS_NUM_VALS]; /* bandwidth per cos domain */
+	uint8_t max_cos_port; /* Max LDB port from any cos */
 };
 
 /* used for collecting and passing around the dev args */
-- 
2.25.1


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

* Re: [PATCH v3] event/dlb2: fix port COS range allocation
  2022-10-20 17:31 [PATCH v3] event/dlb2: fix port COS range allocation Abdullah Sevincer
@ 2022-10-21  8:04 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2022-10-21  8:04 UTC (permalink / raw)
  To: Abdullah Sevincer; +Cc: dev, jerinj, shivani.doneria, tirthendu.sarkar, stable

On Thu, Oct 20, 2022 at 11:01 PM Abdullah Sevincer
<abdullah.sevincer@intel.com> wrote:
>
> This commit fixes allocation of port COS
> when application requested port COS exceeds
> (e.g. beyond 0-15) the number of LDB ports for
> the domain.
>
> We limit application specified ports from a
> COS to the max ports allocated for the COS
> so that the rest of the of the ports can be
> allocated from default(best) COS.
>
> Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS")
> Cc: stable@dpdk.org
>
> Signed-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com>


Updated the git commit as follows and applied to
dpdk-next-net-eventdev/for-main. Thanks

    event/dlb2: fix port COS range allocation

    Fix the allocation of port COS when the application requested port
    COS exceeds (e.g. beyond 0-15) the number of LDB ports for
    the domain.

    Driver limits application specified ports from a COS to the
    max ports allocated for the COS so that the rest of the
    ports can be allocated from default(best) COS.

    Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS")
    Cc: stable@dpdk.org

    Signed-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com

> ---
>  drivers/event/dlb2/dlb2.c      | 9 ++++++---
>  drivers/event/dlb2/dlb2_priv.h | 2 ++
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
> index 02f0e57208..60c5cd4804 100644
> --- a/drivers/event/dlb2/dlb2.c
> +++ b/drivers/event/dlb2/dlb2.c
> @@ -182,8 +182,10 @@ dlb2_init_port_cos(struct dlb2_eventdev *dlb2, int *port_cos)
>
>         for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) {
>                 dlb2->ev_ports[q].cos_id = port_cos[q];
> -               if (port_cos[q] != DLB2_COS_DEFAULT) {
> +               if (port_cos[q] != DLB2_COS_DEFAULT &&
> +                   dlb2->cos_ports[port_cos[q]] < DLB2_MAX_NUM_LDB_PORTS_PER_COS) {
>                         dlb2->cos_ports[port_cos[q]]++;
> +                       dlb2->max_cos_port = q;
>                 }
>         }
>  }
> @@ -841,8 +843,9 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2,
>         cos_ports = dlb2->cos_ports[0] + dlb2->cos_ports[1] +
>                     dlb2->cos_ports[2] + dlb2->cos_ports[3];
>
> -       if (cos_ports > resources_asked->num_ldb_ports) {
> -               DLB2_LOG_ERR("dlb2: num_ldb_ports < nonzero cos_ports\n");
> +       if (cos_ports > resources_asked->num_ldb_ports ||
> +           (cos_ports && dlb2->max_cos_port >= resources_asked->num_ldb_ports)) {
> +               DLB2_LOG_ERR("dlb2: num_ldb_ports < cos_ports\n");
>                 ret = EINVAL;
>                 goto error_exit;
>         }
> diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
> index ac20c5a179..f4b9e7f9ff 100644
> --- a/drivers/event/dlb2/dlb2_priv.h
> +++ b/drivers/event/dlb2/dlb2_priv.h
> @@ -92,6 +92,7 @@
>  #define DLB2_NUM_SN_GROUPS 2
>  #define DLB2_MAX_LDB_SN_ALLOC 1024
>  #define DLB2_MAX_QUEUE_DEPTH_THRESHOLD 8191
> +#define DLB2_MAX_NUM_LDB_PORTS_PER_COS (DLB2_MAX_NUM_LDB_PORTS/DLB2_COS_NUM_VALS)
>
>  /* 2048 total hist list entries and 64 total ldb ports, which
>   * makes for 2048/64 == 32 hist list entries per port. However, CQ
> @@ -635,6 +636,7 @@ struct dlb2_eventdev {
>         };
>         uint32_t cos_ports[DLB2_COS_NUM_VALS]; /* total ldb ports in each class */
>         uint32_t cos_bw[DLB2_COS_NUM_VALS]; /* bandwidth per cos domain */
> +       uint8_t max_cos_port; /* Max LDB port from any cos */
>  };
>
>  /* used for collecting and passing around the dev args */
> --
> 2.25.1
>

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

end of thread, other threads:[~2022-10-21  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 17:31 [PATCH v3] event/dlb2: fix port COS range allocation Abdullah Sevincer
2022-10-21  8:04 ` Jerin Jacob

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