Patch "igc: don't reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb" has been added to the 5.17-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    igc: don't reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb

to the 5.17-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     igc-don-t-reserve-excessive-xdp_packet_headroom-on-x.patch
and it can be found in the queue-5.17 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3c2b20d95093e1d25654a74cf705d05169c16310
Author: Alexander Lobakin <alexandr.lobakin@xxxxxxxxx>
Date:   Wed Dec 8 15:06:59 2021 +0100

    igc: don't reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
    
    [ Upstream commit f9e61d365bafdee40fe2586fc6be490c3e824dad ]
    
    {__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
    + NET_IP_ALIGN for any skb.
    OTOH, igc_construct_skb_zc() currently allocates and reserves
    additional `xdp->data_meta - xdp->data_hard_start`, which is about
    XDP_PACKET_HEADROOM for XSK frames.
    There's no need for that at all as the frame is post-XDP and will
    go only to the networking stack core.
    Pass the size of the actual data only (+ meta) to
    __napi_alloc_skb() and don't reserve anything. This will give
    enough headroom for stack processing.
    Also, net_prefetch() xdp->data_meta and align the copy size to
    speed-up memcpy() a little and better match igc_construct_skb().
    
    Fixes: fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")
    Signed-off-by: Alexander Lobakin <alexandr.lobakin@xxxxxxxxx>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@xxxxxxxxxxxxxxx>
    Tested-by: Nechama Kraus <nechamax.kraus@xxxxxxxxxxxxxxx>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 2f17f36e94fd..629e4a644a9d 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -2446,19 +2446,20 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget)
 static struct sk_buff *igc_construct_skb_zc(struct igc_ring *ring,
 					    struct xdp_buff *xdp)
 {
+	unsigned int totalsize = xdp->data_end - xdp->data_meta;
 	unsigned int metasize = xdp->data - xdp->data_meta;
-	unsigned int datasize = xdp->data_end - xdp->data;
-	unsigned int totalsize = metasize + datasize;
 	struct sk_buff *skb;
 
-	skb = __napi_alloc_skb(&ring->q_vector->napi,
-			       xdp->data_end - xdp->data_hard_start,
+	net_prefetch(xdp->data_meta);
+
+	skb = __napi_alloc_skb(&ring->q_vector->napi, totalsize,
 			       GFP_ATOMIC | __GFP_NOWARN);
 	if (unlikely(!skb))
 		return NULL;
 
-	skb_reserve(skb, xdp->data_meta - xdp->data_hard_start);
-	memcpy(__skb_put(skb, totalsize), xdp->data_meta, totalsize);
+	memcpy(__skb_put(skb, totalsize), xdp->data_meta,
+	       ALIGN(totalsize, sizeof(long)));
+
 	if (metasize) {
 		skb_metadata_set(skb, metasize);
 		__skb_pull(skb, metasize);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux