[v2] event/octeontx: fix partial Rx packet handling

Message ID 20191127123647.7596-1-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2] event/octeontx: fix partial Rx packet handling |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Pavan Nikhilesh Bhagavatula Nov. 27, 2019, 12:36 p.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

When net/octeontx is connected to event/octeontx as an event Rx adapter,
PKI aka 'net/octeontx' can forward packets directly to SSO aka
'event/octeontx'.
When pumping traffic to PKI if flow control is disabled internal FIFOs
might be overrun causing partial l2 packets to be enqueued.
SSO receives <31:0> TAG tag calculated by PKI, in normal cases <31:28>
is always 0 which signifies RTE_EVENT_TYPE_ETHDEV. But in case of
partial received packets PKI sets the <31:0> TAG as 0xFFFFFFFF which
is an invalid event type.

Add a check to see if TAG is 0xFFFFFFFF and free the partial receive
packet.

Cc: stable@dpdk.org
Fixes: d0d654986018 ("net/octeontx: support event Rx adapter")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/event/octeontx/ssovf_worker.h | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
  

Comments

Jerin Jacob Nov. 27, 2019, 1:32 p.m. UTC | #1
On Wed, Nov 27, 2019 at 9:36 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> When net/octeontx is connected to event/octeontx as an event Rx adapter,
> PKI aka 'net/octeontx' can forward packets directly to SSO aka
> 'event/octeontx'.
> When pumping traffic to PKI if flow control is disabled internal FIFOs
> might be overrun causing partial l2 packets to be enqueued.
> SSO receives <31:0> TAG tag calculated by PKI, in normal cases <31:28>
> is always 0 which signifies RTE_EVENT_TYPE_ETHDEV. But in case of
> partial received packets PKI sets the <31:0> TAG as 0xFFFFFFFF which
> is an invalid event type.
>
> Add a check to see if TAG is 0xFFFFFFFF and free the partial receive
> packet.
>
> Cc: stable@dpdk.org
> Fixes: d0d654986018 ("net/octeontx: support event Rx adapter")

Corrected the Cc: order.

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

Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-eventdev/master. Thanks.

@Thomas, It is possible to pull this patch from next-eventdev?
  
Thomas Monjalon Nov. 27, 2019, 6:07 p.m. UTC | #2
27/11/2019 14:32, Jerin Jacob:
> On Wed, Nov 27, 2019 at 9:36 PM <pbhagavatula@marvell.com> wrote:
> >
> > From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> >
> > When net/octeontx is connected to event/octeontx as an event Rx adapter,
> > PKI aka 'net/octeontx' can forward packets directly to SSO aka
> > 'event/octeontx'.
> > When pumping traffic to PKI if flow control is disabled internal FIFOs
> > might be overrun causing partial l2 packets to be enqueued.
> > SSO receives <31:0> TAG tag calculated by PKI, in normal cases <31:28>
> > is always 0 which signifies RTE_EVENT_TYPE_ETHDEV. But in case of
> > partial received packets PKI sets the <31:0> TAG as 0xFFFFFFFF which
> > is an invalid event type.
> >
> > Add a check to see if TAG is 0xFFFFFFFF and free the partial receive
> > packet.
> >
> > Cc: stable@dpdk.org
> > Fixes: d0d654986018 ("net/octeontx: support event Rx adapter")
> 
> Corrected the Cc: order.
> 
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> 
> Acked-by: Jerin Jacob <jerinj@marvell.com>
> Applied to dpdk-next-eventdev/master. Thanks.
> 
> @Thomas, It is possible to pull this patch from next-eventdev?

Applied, thanks
  

Patch

diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h
index d1d3a52ae..c4f886d63 100644
--- a/drivers/event/octeontx/ssovf_worker.h
+++ b/drivers/event/octeontx/ssovf_worker.h
@@ -30,8 +30,7 @@  ssovf_octeontx_wqe_to_pkt(uint64_t work, uint16_t port_info)
 	octtx_wqe_t *wqe = (octtx_wqe_t *)(uintptr_t)work;
 
 	/* Get mbuf from wqe */
-	mbuf = (struct rte_mbuf *)((uintptr_t)wqe -
-			OCTTX_PACKET_WQE_SKIP);
+	mbuf = (struct rte_mbuf *)((uintptr_t)wqe - OCTTX_PACKET_WQE_SKIP);
 	rte_prefetch_non_temporal(mbuf);
 	mbuf->packet_type =
 		ptype_table[wqe->s.w2.lcty][wqe->s.w2.lety][wqe->s.w2.lfty];
@@ -46,6 +45,16 @@  ssovf_octeontx_wqe_to_pkt(uint64_t work, uint16_t port_info)
 	return mbuf;
 }
 
+static __rte_always_inline void
+ssovf_octeontx_wqe_free(uint64_t work)
+{
+	octtx_wqe_t *wqe = (octtx_wqe_t *)(uintptr_t)work;
+	struct rte_mbuf *mbuf;
+
+	mbuf = (struct rte_mbuf *)((uintptr_t)wqe - OCTTX_PACKET_WQE_SKIP);
+	rte_pktmbuf_free(mbuf);
+}
+
 static __rte_always_inline uint16_t
 ssows_get_work(struct ssows *ws, struct rte_event *ev)
 {
@@ -59,9 +68,13 @@  ssows_get_work(struct ssows *ws, struct rte_event *ev)
 	ws->cur_grp = sched_type_queue >> 2;
 	sched_type_queue = sched_type_queue << 38;
 	ev->event = sched_type_queue | (get_work0 & 0xffffffff);
+
 	if (get_work1 && ev->event_type == RTE_EVENT_TYPE_ETHDEV) {
 		ev->mbuf = ssovf_octeontx_wqe_to_pkt(get_work1,
 				(ev->event >> 20) & 0x7F);
+	} else if (unlikely((get_work0 & 0xFFFFFFFF) == 0xFFFFFFFF)) {
+		ssovf_octeontx_wqe_free(get_work1);
+		return 0;
 	} else {
 		ev->u64 = get_work1;
 	}