Message ID | 20230824192703.712881-12-larysa.zaremba@intel.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | BPF |
Headers | show |
Series | XDP metadata via kfuncs for ice + mlx5 | expand |
On Thu, Sep 14, 2023 at 06:30:32PM +0200, Alexander Lobakin wrote: > From: Larysa Zaremba <larysa.zaremba@intel.com> > Date: Thu, 24 Aug 2023 21:26:50 +0200 > > > 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 is misleading. > > [...] > > > 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->pkt_ctx.vlan_proto) > > I'd wrap the first expression into ()s to make it more readable (and no > questions like "shouldn't these be three &&?"). > OK > > + __vlan_hwaccel_put_tag(skb, rx_ring->pkt_ctx.vlan_proto, > > + vlan_tci); > > > > napi_gro_receive(&rx_ring->q_vector->napi, skb); > > } > > [...] > > Thanks, > Olek
From: Larysa Zaremba <larysa.zaremba@intel.com> Date: Thu, 24 Aug 2023 21:26:50 +0200 > 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 is misleading. [...] > 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->pkt_ctx.vlan_proto) I'd wrap the first expression into ()s to make it more readable (and no questions like "shouldn't these be three &&?"). > + __vlan_hwaccel_put_tag(skb, rx_ring->pkt_ctx.vlan_proto, > + vlan_tci); > > napi_gro_receive(&rx_ring->q_vector->napi, skb); > } [...] Thanks, Olek
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index 10e7ec51f4ef..6ae57a98a4d8 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -283,21 +283,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->pkt_ctx.vlan_proto) + __vlan_hwaccel_put_tag(skb, rx_ring->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 b7205826fea8..8487884bf5c4 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,
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 is misleading. 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(-)