event/octeontx: support VLAN filter offload
authorVamsi Attunuru <vattunuru@marvell.com>
Tue, 28 Apr 2020 12:40:11 +0000 (18:10 +0530)
committerJerin Jacob <jerinj@marvell.com>
Sun, 3 May 2020 10:19:07 +0000 (12:19 +0200)
Adding rx burst function pointer hooks for vlan filter
offload in event PMD.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/event/octeontx/ssovf_worker.c
drivers/event/octeontx/ssovf_worker.h
drivers/net/octeontx/octeontx_rxtx.h

index b5873c3..a276269 100644 (file)
@@ -91,7 +91,7 @@ ssows_release_event(struct ssows *ws)
                ssows_swtag_untag(ws);
 }
 
-#define R(name, f0, flags)                                                  \
+#define R(name, f1, f0, flags)                                              \
 static uint16_t __rte_noinline __rte_hot                                    \
 ssows_deq_ ##name(void *port, struct rte_event *ev, uint64_t timeout_ticks)  \
 {                                                                           \
@@ -347,49 +347,53 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC
        dev->txa_enqueue_same_dest = dev->txa_enqueue;
 
        /* Assigning dequeue func pointers */
-       const event_dequeue_t ssow_deq[2] = {
-#define R(name, f0, flags)                                     \
-       [f0] =  ssows_deq_ ##name,
+       const event_dequeue_t ssow_deq[2][2] = {
+#define R(name, f1, f0, flags)                                 \
+       [f1][f0] =  ssows_deq_ ##name,
 
 SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
 #undef R
        };
 
        dev->dequeue = ssow_deq
+               [!!(edev->rx_offload_flags & OCCTX_RX_VLAN_FLTR_F)]
                [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)];
 
-       const event_dequeue_burst_t ssow_deq_burst[2] = {
-#define R(name, f0, flags)                                             \
-       [f0] =  ssows_deq_burst_ ##name,
+       const event_dequeue_burst_t ssow_deq_burst[2][2] = {
+#define R(name, f1, f0, flags)                                         \
+       [f1][f0] =  ssows_deq_burst_ ##name,
 
 SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
 #undef R
        };
 
        dev->dequeue_burst = ssow_deq_burst
+               [!!(edev->rx_offload_flags & OCCTX_RX_VLAN_FLTR_F)]
                [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)];
 
        if (edev->is_timeout_deq) {
-               const event_dequeue_t ssow_deq_timeout[2] = {
-#define R(name, f0, flags)                                             \
-       [f0] =  ssows_deq_timeout_ ##name,
+               const event_dequeue_t ssow_deq_timeout[2][2] = {
+#define R(name, f1, f0, flags)                                         \
+       [f1][f0] =  ssows_deq_timeout_ ##name,
 
 SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
 #undef R
                };
 
-               dev->dequeue = ssow_deq_timeout
-                       [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)];
+       dev->dequeue = ssow_deq_timeout
+               [!!(edev->rx_offload_flags & OCCTX_RX_VLAN_FLTR_F)]
+               [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)];
 
-       const event_dequeue_burst_t ssow_deq_timeout_burst[2] = {
-#define R(name, f0, flags)                                             \
-       [f0] =  ssows_deq_timeout_burst_ ##name,
+       const event_dequeue_burst_t ssow_deq_timeout_burst[2][2] = {
+#define R(name, f1, f0, flags)                                         \
+       [f1][f0] =  ssows_deq_timeout_burst_ ##name,
 
 SSO_RX_ADPTR_ENQ_FASTPATH_FUNC
 #undef R
                };
 
-               dev->dequeue_burst = ssow_deq_timeout_burst
-                       [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)];
+       dev->dequeue_burst = ssow_deq_timeout_burst
+               [!!(edev->rx_offload_flags & OCCTX_RX_VLAN_FLTR_F)]
+               [!!(edev->rx_offload_flags & OCCTX_RX_MULTI_SEG_F)];
        }
 }
index ccc6fc8..04c8315 100644 (file)
@@ -78,6 +78,15 @@ ssovf_octeontx_wqe_to_pkt(uint64_t work, uint16_t port_info,
                mbuf->data_len = mbuf->pkt_len;
        }
 
+       if (!!(flag & OCCTX_RX_VLAN_FLTR_F)) {
+               if (likely(wqe->s.w2.vv)) {
+                       mbuf->ol_flags |= PKT_RX_VLAN;
+                       mbuf->vlan_tci =
+                               ntohs(*((uint16_t *)((char *)mbuf->buf_addr +
+                                       mbuf->data_off + wqe->s.w4.vlptr + 2)));
+               }
+       }
+
        mbuf->port = rte_octeontx_pchan_map[port_info >> 4][port_info & 0xF];
        rte_mbuf_refcnt_set(mbuf, 1);
 
index 144ae05..3f2147a 100644 (file)
@@ -485,10 +485,13 @@ T(noff_ol3ol4csum_l3l4csum_mseg,  1, 1, 1, 1,     14,                    \
                                        MULT_F)
 
 /* RX offload macros */
+#define VLAN_FLTR_F     OCCTX_RX_VLAN_FLTR_F
 #define MULT_RX_F       OCCTX_RX_MULTI_SEG_F
-/* [MULTI_SEG] */
-#define OCCTX_RX_FASTPATH_MODES                                                \
-R(no_offload,                          0,  OCCTX_RX_OFFLOAD_NONE)      \
-R(mseg,                                        1,  MULT_RX_F)          \
+/* [VLAN_FLTR][MULTI_SEG] */
+#define OCCTX_RX_FASTPATH_MODES                                                       \
+R(no_offload,                          0, 0,  OCCTX_RX_OFFLOAD_NONE)          \
+R(mseg,                                        0, 1,  MULT_RX_F)                      \
+R(vlan,                                        1, 0,  VLAN_FLTR_F)                    \
+R(vlan_mseg,                           1, 1,  VLAN_FLTR_F | MULT_RX_F)
 
  #endif /* __OCTEONTX_RXTX_H__ */