diff mbox series

[bpf-next,v7,11/18] ice: use VLAN proto from ring packet context in skb path

Message ID 20231115175301.534113-12-larysa.zaremba@intel.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series XDP metadata via kfuncs for ice + VLAN hint | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-4 success Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for aarch64-gcc / test (test_verifier, false, 360) / test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-6 success Logs for aarch64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for s390x-gcc / build / build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-14 success Logs for s390x-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-15 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-16 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-17 success Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-18 success Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-22 success Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for x86_64-gcc / veristat / veristat on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for x86_64-llvm-16 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-26 success Logs for x86_64-llvm-16 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-27 success Logs for x86_64-llvm-16 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-28 success Logs for x86_64-llvm-16 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-29 success Logs for x86_64-llvm-16 / veristat
netdev/series_format fail Series longer than 15 patches (and no cover letter)
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1135 this patch: 1135
netdev/cc_maintainers warning 5 maintainers not CCed: anthony.l.nguyen@intel.com jesse.brandeburg@intel.com pabeni@redhat.com edumazet@google.com intel-wired-lan@lists.osuosl.org
netdev/build_clang success Errors and warnings before: 1162 this patch: 1162
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1162 this patch: 1162
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 34 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 1 this patch: 1
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-VM_Test-12 success Logs for s390x-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-0 success Logs for Lint
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Validate matrix.py
bpf/vmtest-bpf-next-VM_Test-5 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-3 success Logs for aarch64-gcc / build / build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for aarch64-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-10 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-11 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-19 success Logs for x86_64-llvm-16 / build / build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-24 success Logs for x86_64-llvm-16 / veristat

Commit Message

Larysa Zaremba Nov. 15, 2023, 5:52 p.m. UTC
VLAN proto, used in ice XDP hints implementation is stored in ring packet
context. Utilize this value in skb VLAN processing too instead of checking
netdev features.

At the same time, use vlan_tci instead of vlan_tag in touched code,
because VLAN tag often refers to VLAN proto and VLAN TCI combined,
while in the code we clearly store only VLAN TCI.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 14 +++++---------
 drivers/net/ethernet/intel/ice/ice_txrx_lib.h |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

Comments

Fijalkowski, Maciej Nov. 17, 2023, 8:10 a.m. UTC | #1
On Wed, Nov 15, 2023 at 06:52:53PM +0100, Larysa Zaremba wrote:
> VLAN proto, used in ice XDP hints implementation is stored in ring packet
> context. Utilize this value in skb VLAN processing too instead of checking
> netdev features.
> 
> At the same time, use vlan_tci instead of vlan_tag in touched code,
> because VLAN tag often refers to VLAN proto and VLAN TCI combined,
> while in the code we clearly store only VLAN TCI.
> 
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 14 +++++---------
>  drivers/net/ethernet/intel/ice/ice_txrx_lib.h |  2 +-
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> index 63bf9f882363..a1f5243299c5 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> @@ -246,21 +246,17 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring,
>   * ice_receive_skb - Send a completed packet up the stack
>   * @rx_ring: Rx ring in play
>   * @skb: packet to send up
> - * @vlan_tag: VLAN tag for packet
> + * @vlan_tci: VLAN TCI for packet
>   *
>   * This function sends the completed packet (via. skb) up the stack using
>   * gro receive functions (with/without VLAN tag)
>   */
>  void
> -ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag)
> +ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tci)
>  {
> -	netdev_features_t features = rx_ring->netdev->features;
> -	bool non_zero_vlan = !!(vlan_tag & VLAN_VID_MASK);
> -
> -	if ((features & NETIF_F_HW_VLAN_CTAG_RX) && non_zero_vlan)
> -		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
> -	else if ((features & NETIF_F_HW_VLAN_STAG_RX) && non_zero_vlan)
> -		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan_tag);
> +	if ((vlan_tci & VLAN_VID_MASK) && rx_ring->vlan_proto)
> +		__vlan_hwaccel_put_tag(skb, rx_ring->vlan_proto,

Umm... pkt_ctx.vlan_proto ?

> +				       vlan_tci);
>  
>  	napi_gro_receive(&rx_ring->q_vector->napi, skb);
>  }
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> index 3893af1c11f3..762047508619 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> @@ -150,7 +150,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring,
>  		       union ice_32b_rx_flex_desc *rx_desc,
>  		       struct sk_buff *skb);
>  void
> -ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag);
> +ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tci);
>  
>  static inline void
>  ice_xdp_meta_set_desc(struct xdp_buff *xdp,
> -- 
> 2.41.0
>
Larysa Zaremba Nov. 17, 2023, 2:07 p.m. UTC | #2
On Fri, Nov 17, 2023 at 09:10:44AM +0100, Maciej Fijalkowski wrote:
> On Wed, Nov 15, 2023 at 06:52:53PM +0100, Larysa Zaremba wrote:
> > VLAN proto, used in ice XDP hints implementation is stored in ring packet
> > context. Utilize this value in skb VLAN processing too instead of checking
> > netdev features.
> > 
> > At the same time, use vlan_tci instead of vlan_tag in touched code,
> > because VLAN tag often refers to VLAN proto and VLAN TCI combined,
> > while in the code we clearly store only VLAN TCI.
> > 
> > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> > ---
> >  drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 14 +++++---------
> >  drivers/net/ethernet/intel/ice/ice_txrx_lib.h |  2 +-
> >  2 files changed, 6 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> > index 63bf9f882363..a1f5243299c5 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> > @@ -246,21 +246,17 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring,
> >   * ice_receive_skb - Send a completed packet up the stack
> >   * @rx_ring: Rx ring in play
> >   * @skb: packet to send up
> > - * @vlan_tag: VLAN tag for packet
> > + * @vlan_tci: VLAN TCI for packet
> >   *
> >   * This function sends the completed packet (via. skb) up the stack using
> >   * gro receive functions (with/without VLAN tag)
> >   */
> >  void
> > -ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag)
> > +ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tci)
> >  {
> > -	netdev_features_t features = rx_ring->netdev->features;
> > -	bool non_zero_vlan = !!(vlan_tag & VLAN_VID_MASK);
> > -
> > -	if ((features & NETIF_F_HW_VLAN_CTAG_RX) && non_zero_vlan)
> > -		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
> > -	else if ((features & NETIF_F_HW_VLAN_STAG_RX) && non_zero_vlan)
> > -		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan_tag);
> > +	if ((vlan_tci & VLAN_VID_MASK) && rx_ring->vlan_proto)
> > +		__vlan_hwaccel_put_tag(skb, rx_ring->vlan_proto,
> 
> Umm... pkt_ctx.vlan_proto ?
> 

This compiles both ways. I have put pkt_ctx into a union.

> > +				       vlan_tci);
> >  
> >  	napi_gro_receive(&rx_ring->q_vector->napi, skb);
> >  }
> > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> > index 3893af1c11f3..762047508619 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> > @@ -150,7 +150,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring,
> >  		       union ice_32b_rx_flex_desc *rx_desc,
> >  		       struct sk_buff *skb);
> >  void
> > -ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag);
> > +ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tci);
> >  
> >  static inline void
> >  ice_xdp_meta_set_desc(struct xdp_buff *xdp,
> > -- 
> > 2.41.0
> >
Fijalkowski, Maciej Nov. 17, 2023, 3:14 p.m. UTC | #3
On Fri, Nov 17, 2023 at 03:07:37PM +0100, Larysa Zaremba wrote:
> On Fri, Nov 17, 2023 at 09:10:44AM +0100, Maciej Fijalkowski wrote:
> > On Wed, Nov 15, 2023 at 06:52:53PM +0100, Larysa Zaremba wrote:
> > > VLAN proto, used in ice XDP hints implementation is stored in ring packet
> > > context. Utilize this value in skb VLAN processing too instead of checking
> > > netdev features.
> > > 
> > > At the same time, use vlan_tci instead of vlan_tag in touched code,
> > > because VLAN tag often refers to VLAN proto and VLAN TCI combined,
> > > while in the code we clearly store only VLAN TCI.
> > > 
> > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> > > ---
> > >  drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 14 +++++---------
> > >  drivers/net/ethernet/intel/ice/ice_txrx_lib.h |  2 +-
> > >  2 files changed, 6 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> > > index 63bf9f882363..a1f5243299c5 100644
> > > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> > > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> > > @@ -246,21 +246,17 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring,
> > >   * ice_receive_skb - Send a completed packet up the stack
> > >   * @rx_ring: Rx ring in play
> > >   * @skb: packet to send up
> > > - * @vlan_tag: VLAN tag for packet
> > > + * @vlan_tci: VLAN TCI for packet
> > >   *
> > >   * This function sends the completed packet (via. skb) up the stack using
> > >   * gro receive functions (with/without VLAN tag)
> > >   */
> > >  void
> > > -ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag)
> > > +ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tci)
> > >  {
> > > -	netdev_features_t features = rx_ring->netdev->features;
> > > -	bool non_zero_vlan = !!(vlan_tag & VLAN_VID_MASK);
> > > -
> > > -	if ((features & NETIF_F_HW_VLAN_CTAG_RX) && non_zero_vlan)
> > > -		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
> > > -	else if ((features & NETIF_F_HW_VLAN_STAG_RX) && non_zero_vlan)
> > > -		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan_tag);
> > > +	if ((vlan_tci & VLAN_VID_MASK) && rx_ring->vlan_proto)
> > > +		__vlan_hwaccel_put_tag(skb, rx_ring->vlan_proto,
> > 
> > Umm... pkt_ctx.vlan_proto ?
> > 
> 
> This compiles both ways. I have put pkt_ctx into a union.

Right, missed that.

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> 
> > > +				       vlan_tci);
> > >  
> > >  	napi_gro_receive(&rx_ring->q_vector->napi, skb);
> > >  }
> > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> > > index 3893af1c11f3..762047508619 100644
> > > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> > > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
> > > @@ -150,7 +150,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring,
> > >  		       union ice_32b_rx_flex_desc *rx_desc,
> > >  		       struct sk_buff *skb);
> > >  void
> > > -ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag);
> > > +ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tci);
> > >  
> > >  static inline void
> > >  ice_xdp_meta_set_desc(struct xdp_buff *xdp,
> > > -- 
> > > 2.41.0
> > >
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
index 63bf9f882363..a1f5243299c5 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
@@ -246,21 +246,17 @@  ice_process_skb_fields(struct ice_rx_ring *rx_ring,
  * ice_receive_skb - Send a completed packet up the stack
  * @rx_ring: Rx ring in play
  * @skb: packet to send up
- * @vlan_tag: VLAN tag for packet
+ * @vlan_tci: VLAN TCI for packet
  *
  * This function sends the completed packet (via. skb) up the stack using
  * gro receive functions (with/without VLAN tag)
  */
 void
-ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag)
+ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tci)
 {
-	netdev_features_t features = rx_ring->netdev->features;
-	bool non_zero_vlan = !!(vlan_tag & VLAN_VID_MASK);
-
-	if ((features & NETIF_F_HW_VLAN_CTAG_RX) && non_zero_vlan)
-		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
-	else if ((features & NETIF_F_HW_VLAN_STAG_RX) && non_zero_vlan)
-		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan_tag);
+	if ((vlan_tci & VLAN_VID_MASK) && rx_ring->vlan_proto)
+		__vlan_hwaccel_put_tag(skb, rx_ring->vlan_proto,
+				       vlan_tci);
 
 	napi_gro_receive(&rx_ring->q_vector->napi, skb);
 }
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
index 3893af1c11f3..762047508619 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
@@ -150,7 +150,7 @@  ice_process_skb_fields(struct ice_rx_ring *rx_ring,
 		       union ice_32b_rx_flex_desc *rx_desc,
 		       struct sk_buff *skb);
 void
-ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag);
+ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tci);
 
 static inline void
 ice_xdp_meta_set_desc(struct xdp_buff *xdp,