]> git.droids-corp.org - dpdk.git/commitdiff
event/octeontx: fix SSO fast path
authorHarman Kalra <hkalra@marvell.com>
Tue, 24 May 2022 08:42:25 +0000 (14:12 +0530)
committerJerin Jacob <jerinj@marvell.com>
Thu, 9 Jun 2022 15:49:55 +0000 (17:49 +0200)
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>
drivers/event/octeontx/ssovf_worker.h

index e6ee2926881a0dd4ba237d39ccb9b542cdcb41c1..57be476394e5258e71e79d5d72debfc516a230b4 100644 (file)
@@ -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;