[v3,01/11] event/octeontx: fix SSO fastpath

Message ID 20220524084235.17796-1-hkalra@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v3,01/11] event/octeontx: fix SSO fastpath |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Harman Kalra May 24, 2022, 8:42 a.m. UTC
  Segmentation fault is observed as soon as any dpdk application
with ethdev event is launched. Handling the event types
appropriately.

Also fixing sub event type violation as in OCTEONTX event device we
use sub_event_type to store the ethernet port identifier when we receive
work from OCTEONTX ethernet device. This violates the event device spec
as sub_event_type should be 0 in the initial receive stage.
Set sub_event_type to 0 after copying the port id in single workslot
mode.

Fixes: 8dc6c2f12ecf ("crypto/octeontx: add crypto adapter data path")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
V3:
 * fixing sub event type violation
V2:
 * Seperated out a generic patch from the series
 
 drivers/event/octeontx/ssovf_worker.h | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
  

Comments

Jerin Jacob June 9, 2022, 3:53 p.m. UTC | #1
On Tue, May 24, 2022 at 2:13 PM Harman Kalra <hkalra@marvell.com> wrote:
>
> Segmentation fault is observed as soon as any dpdk application
> with ethdev event is launched. Handling the event types
> appropriately.
>
> Also fixing sub event type violation as in OCTEONTX event device we
> use sub_event_type to store the ethernet port identifier when we receive
> work from OCTEONTX ethernet device. This violates the event device spec
> as sub_event_type should be 0 in the initial receive stage.
> Set sub_event_type to 0 after copying the port id in single workslot
> mode.
>
> Fixes: 8dc6c2f12ecf ("crypto/octeontx: add crypto adapter data path")


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

    event/octeontx: fix SSO fastpath

    Segmentation fault is observed as soon as any  application
    with ethdev event is launched as ev->mbuf was not set properly.

    Fixing sub event type violation as in OCTEONTX event device
    sub_event_type is used to store the ethernet port identifier
    when work is received from OCTEONTX ethernet device. This violates
    the event device spec as sub_event_type should be 0 in the initial
    receive stage. Setting sub_event_type to 0 after copying the port id
    in single workslot mode.

    Fixes: 44a2cebbd489 ("crypto/octeontx: add crypto adapter data path")
    Cc: stable@dpdk.org

    Signed-off-by: Harman Kalra <hkalra@marvell.com>
    Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>


>
> Signed-off-by: Harman Kalra <hkalra@marvell.com>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
> V3:
>  * fixing sub event type violation
> V2:
>  * Seperated out a generic patch from the series
>
>  drivers/event/octeontx/ssovf_worker.h | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h
> index e6ee292688..57be476394 100644
> --- a/drivers/event/octeontx/ssovf_worker.h
> +++ b/drivers/event/octeontx/ssovf_worker.h
> @@ -179,16 +179,22 @@ ssows_get_work(struct ssows *ws, struct rte_event *ev, const uint16_t flag)
>         ev->event = sched_type_queue | (get_work0 & 0xffffffff);
>
>         if (get_work1) {
> -               if (ev->event_type == RTE_EVENT_TYPE_ETHDEV)
> -                       get_work1 = (uintptr_t)ssovf_octeontx_wqe_to_pkt(
> -                               get_work1, (ev->event >> 20) & 0x7F, flag,
> -                               ws->lookup_mem);
> -               else if (ev->event_type == RTE_EVENT_TYPE_CRYPTODEV)
> +               if (ev->event_type == RTE_EVENT_TYPE_ETHDEV) {
> +                       uint16_t port = (ev->event >> 20) & 0x7F;
> +
> +                       ev->sub_event_type = 0;
> +                       ev->mbuf = ssovf_octeontx_wqe_to_pkt(
> +                               get_work1, port, flag, ws->lookup_mem);
> +               } else if (ev->event_type == RTE_EVENT_TYPE_CRYPTODEV) {
>                         get_work1 = otx_crypto_adapter_dequeue(get_work1);
> -               ev->u64 = get_work1;
> -       } else if (unlikely((get_work0 & 0xFFFFFFFF) == 0xFFFFFFFF)) {
> -               ssovf_octeontx_wqe_free(get_work1);
> -               return 0;
> +                       ev->u64 = get_work1;
> +               } else {
> +                       if (unlikely((get_work0 & 0xFFFFFFFF) == 0xFFFFFFFF)) {
> +                               ssovf_octeontx_wqe_free(get_work1);
> +                               return 0;
> +                       }
> +                       ev->u64 = get_work1;
> +               }
>         }
>
>         return !!get_work1;
> --
> 2.18.0
>
  

Patch

diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h
index e6ee292688..57be476394 100644
--- a/drivers/event/octeontx/ssovf_worker.h
+++ b/drivers/event/octeontx/ssovf_worker.h
@@ -179,16 +179,22 @@  ssows_get_work(struct ssows *ws, struct rte_event *ev, const uint16_t flag)
 	ev->event = sched_type_queue | (get_work0 & 0xffffffff);
 
 	if (get_work1) {
-		if (ev->event_type == RTE_EVENT_TYPE_ETHDEV)
-			get_work1 = (uintptr_t)ssovf_octeontx_wqe_to_pkt(
-				get_work1, (ev->event >> 20) & 0x7F, flag,
-				ws->lookup_mem);
-		else if (ev->event_type == RTE_EVENT_TYPE_CRYPTODEV)
+		if (ev->event_type == RTE_EVENT_TYPE_ETHDEV) {
+			uint16_t port = (ev->event >> 20) & 0x7F;
+
+			ev->sub_event_type = 0;
+			ev->mbuf = ssovf_octeontx_wqe_to_pkt(
+				get_work1, port, flag, ws->lookup_mem);
+		} else if (ev->event_type == RTE_EVENT_TYPE_CRYPTODEV) {
 			get_work1 = otx_crypto_adapter_dequeue(get_work1);
-		ev->u64 = get_work1;
-	} else if (unlikely((get_work0 & 0xFFFFFFFF) == 0xFFFFFFFF)) {
-		ssovf_octeontx_wqe_free(get_work1);
-		return 0;
+			ev->u64 = get_work1;
+		} else {
+			if (unlikely((get_work0 & 0xFFFFFFFF) == 0xFFFFFFFF)) {
+				ssovf_octeontx_wqe_free(get_work1);
+				return 0;
+			}
+			ev->u64 = get_work1;
+		}
 	}
 
 	return !!get_work1;