]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
igb: Only DMA sync frame length
authorAndrew Lunn <andrew@lunn.ch>
Fri, 3 Jun 2016 21:03:25 +0000 (23:03 +0200)
committerKirtikar Kashyap <kirtikar.kashyap@oracle.com>
Thu, 22 Jun 2017 21:28:31 +0000 (14:28 -0700)
On some platforms, syncing a buffer for DMA is expensive. Rather than
sync the whole 2K receive buffer, only synchronise the length of the
frame, which will typically be the MTU, or a much smaller TCP ACK.

For an IMX6Q, this gives around 6% increased TCP receive performance,
which is cache operations bound and reduces CPU load for TCP transmit.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 64f2525ca4e76b1704b867458808ed6ffc58b803)

Orabug: 26325580

Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
drivers/net/ethernet/intel/igb/igb_main.c

index 34d7a654353703246149e17083d52763995015f8..aca530e3168917eb08cfab869f793e249c8c037d 100644 (file)
@@ -6794,12 +6794,12 @@ static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer,
  **/
 static bool igb_add_rx_frag(struct igb_ring *rx_ring,
                            struct igb_rx_buffer *rx_buffer,
+                           unsigned int size,
                            union e1000_adv_rx_desc *rx_desc,
                            struct sk_buff *skb)
 {
        struct page *page = rx_buffer->page;
        unsigned char *va = page_address(page) + rx_buffer->page_offset;
-       unsigned int size = le16_to_cpu(rx_desc->wb.upper.length);
 #if (PAGE_SIZE < 8192)
        unsigned int truesize = IGB_RX_BUFSZ;
 #else
@@ -6851,6 +6851,7 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring,
                                           union e1000_adv_rx_desc *rx_desc,
                                           struct sk_buff *skb)
 {
+       unsigned int size = le16_to_cpu(rx_desc->wb.upper.length);
        struct igb_rx_buffer *rx_buffer;
        struct page *page;
 
@@ -6886,11 +6887,11 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring,
        dma_sync_single_range_for_cpu(rx_ring->dev,
                                      rx_buffer->dma,
                                      rx_buffer->page_offset,
-                                     IGB_RX_BUFSZ,
+                                     size,
                                      DMA_FROM_DEVICE);
 
        /* pull page into skb */
-       if (igb_add_rx_frag(rx_ring, rx_buffer, rx_desc, skb)) {
+       if (igb_add_rx_frag(rx_ring, rx_buffer, size, rx_desc, skb)) {
                /* hand second half of page back to the ring */
                igb_reuse_rx_page(rx_ring, rx_buffer);
        } else {