[3/4] event/octeontx: add VLAN filter offload support
diff mbox series

Message ID 1584372553-28710-4-git-send-email-hkalra@marvell.com
State Superseded, archived
Delegated to: Jerin Jacob
Headers show
Series
  • event/octeontx: support new features
Related show

Checks

Context Check Description
ci/Intel-compilation fail apply issues
ci/checkpatch warning coding style issues

Commit Message

Harman Kalra March 16, 2020, 3:29 p.m. UTC
From: Vamsi Attunuru <vattunuru@marvell.com>

Adding rx burst function pointer hooks for vlan filter
offload in event PMD.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
---
 drivers/event/octeontx/ssovf_worker.c | 38 +++++++++++++++------------
 drivers/event/octeontx/ssovf_worker.h |  9 +++++++
 drivers/net/octeontx/octeontx_rxtx.h  | 11 +++++---
 3 files changed, 37 insertions(+), 21 deletions(-)

Comments

Harman Kalra April 6, 2020, 9:53 a.m. UTC | #1
On Mon, Mar 16, 2020 at 08:59:12PM +0530, Harman Kalra wrote:
> From: Vamsi Attunuru <vattunuru@marvell.com>
> 
> Adding rx burst function pointer hooks for vlan filter
> offload in event PMD.
> 
> Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>

Acked-by: Harman Kalra <hkalra@marvell.com>

> ---
>  drivers/event/octeontx/ssovf_worker.c | 38 +++++++++++++++------------
>  drivers/event/octeontx/ssovf_worker.h |  9 +++++++
>  drivers/net/octeontx/octeontx_rxtx.h  | 11 +++++---
>  3 files changed, 37 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c
> index 5d8e213ce..093f6f000 100644
> --- a/drivers/event/octeontx/ssovf_worker.c
> +++ b/drivers/event/octeontx/ssovf_worker.c
> @@ -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	__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)];
>  	}
>  }
> diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h
> index 61332304a..e23bd057e 100644
> --- a/drivers/event/octeontx/ssovf_worker.h
> +++ b/drivers/event/octeontx/ssovf_worker.h
> @@ -84,6 +84,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);
>  
> diff --git a/drivers/net/octeontx/octeontx_rxtx.h b/drivers/net/octeontx/octeontx_rxtx.h
> index e7656f333..515c4699a 100644
> --- a/drivers/net/octeontx/octeontx_rxtx.h
> +++ b/drivers/net/octeontx/octeontx_rxtx.h
> @@ -489,10 +489,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__ */
> -- 
> 2.18.0
>

Patch
diff mbox series

diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c
index 5d8e213ce..093f6f000 100644
--- a/drivers/event/octeontx/ssovf_worker.c
+++ b/drivers/event/octeontx/ssovf_worker.c
@@ -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	__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)];
 	}
 }
diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h
index 61332304a..e23bd057e 100644
--- a/drivers/event/octeontx/ssovf_worker.h
+++ b/drivers/event/octeontx/ssovf_worker.h
@@ -84,6 +84,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);
 
diff --git a/drivers/net/octeontx/octeontx_rxtx.h b/drivers/net/octeontx/octeontx_rxtx.h
index e7656f333..515c4699a 100644
--- a/drivers/net/octeontx/octeontx_rxtx.h
+++ b/drivers/net/octeontx/octeontx_rxtx.h
@@ -489,10 +489,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__ */