@@ -889,6 +889,20 @@ struct sk_buff *ixgbevf_construct_skb(struct ixgbevf_ring *rx_ring,
889
889
#if L1_CACHE_BYTES < 128
890
890
prefetch (xdp -> data + L1_CACHE_BYTES );
891
891
#endif
892
+ /* Note, we get here by enabling legacy-rx via:
893
+ *
894
+ * ethtool --set-priv-flags <dev> legacy-rx on
895
+ *
896
+ * In this mode, we currently get 0 extra XDP headroom as
897
+ * opposed to having legacy-rx off, where we process XDP
898
+ * packets going to stack via ixgbevf_build_skb().
899
+ *
900
+ * For ixgbevf_construct_skb() mode it means that the
901
+ * xdp->data_meta will always point to xdp->data, since
902
+ * the helper cannot expand the head. Should this ever
903
+ * changed in future for legacy-rx mode on, then lets also
904
+ * add xdp->data_meta handling here.
905
+ */
892
906
893
907
/* allocate a skb to store the frags */
894
908
skb = napi_alloc_skb (& rx_ring -> q_vector -> napi , IXGBEVF_RX_HDR_SIZE );
@@ -936,6 +950,7 @@ static struct sk_buff *ixgbevf_build_skb(struct ixgbevf_ring *rx_ring,
936
950
struct xdp_buff * xdp ,
937
951
union ixgbe_adv_rx_desc * rx_desc )
938
952
{
953
+ unsigned int metasize = xdp -> data - xdp -> data_meta ;
939
954
#if (PAGE_SIZE < 8192 )
940
955
unsigned int truesize = ixgbevf_rx_pg_size (rx_ring ) / 2 ;
941
956
#else
@@ -945,10 +960,14 @@ static struct sk_buff *ixgbevf_build_skb(struct ixgbevf_ring *rx_ring,
945
960
#endif
946
961
struct sk_buff * skb ;
947
962
948
- /* prefetch first cache line of first page */
949
- prefetch (xdp -> data );
963
+ /* Prefetch first cache line of first page. If xdp->data_meta
964
+ * is unused, this points to xdp->data, otherwise, we likely
965
+ * have a consumer accessing first few bytes of meta data,
966
+ * and then actual data.
967
+ */
968
+ prefetch (xdp -> data_meta );
950
969
#if L1_CACHE_BYTES < 128
951
- prefetch (xdp -> data + L1_CACHE_BYTES );
970
+ prefetch (xdp -> data_meta + L1_CACHE_BYTES );
952
971
#endif
953
972
954
973
/* build an skb around the page buffer */
@@ -959,6 +978,8 @@ static struct sk_buff *ixgbevf_build_skb(struct ixgbevf_ring *rx_ring,
959
978
/* update pointers within the skb to store the data */
960
979
skb_reserve (skb , xdp -> data - xdp -> data_hard_start );
961
980
__skb_put (skb , xdp -> data_end - xdp -> data );
981
+ if (metasize )
982
+ skb_metadata_set (skb , metasize );
962
983
963
984
/* update buffer offset */
964
985
#if (PAGE_SIZE < 8192 )
@@ -1126,7 +1147,7 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
1126
1147
if (!skb ) {
1127
1148
xdp .data = page_address (rx_buffer -> page ) +
1128
1149
rx_buffer -> page_offset ;
1129
- xdp_set_data_meta_invalid ( & xdp ) ;
1150
+ xdp . data_meta = xdp . data ;
1130
1151
xdp .data_hard_start = xdp .data -
1131
1152
ixgbevf_rx_offset (rx_ring );
1132
1153
xdp .data_end = xdp .data + size ;
0 commit comments