Skip to content

Commit 50b2143

Browse files
mfijalkoanguy11
authored andcommitted
ice: fix page reuse when PAGE_SIZE is over 8k
Architectures that have PAGE_SIZE >= 8192 such as arm64 should act the same as x86 currently, meaning reuse of a page should only take place when no one else is busy with it. Do two things independently of underlying PAGE_SIZE: - store the page count under ice_rx_buf::pgcnt - then act upon its value vs ice_rx_buf::pagecnt_bias when making the decision regarding page reuse Fixes: 2b245cb ("ice: Implement transmit and NAPI support") Signed-off-by: Maciej Fijalkowski <[email protected]> Tested-by: Chandan Kumar Rout <[email protected]> (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 7565c39 commit 50b2143

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/net/ethernet/intel/ice/ice_txrx.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -837,16 +837,15 @@ ice_can_reuse_rx_page(struct ice_rx_buf *rx_buf)
837837
if (!dev_page_is_reusable(page))
838838
return false;
839839

840-
#if (PAGE_SIZE < 8192)
841840
/* if we are only owner of page we can reuse it */
842841
if (unlikely(rx_buf->pgcnt - pagecnt_bias > 1))
843842
return false;
844-
#else
843+
#if (PAGE_SIZE >= 8192)
845844
#define ICE_LAST_OFFSET \
846845
(SKB_WITH_OVERHEAD(PAGE_SIZE) - ICE_RXBUF_2048)
847846
if (rx_buf->page_offset > ICE_LAST_OFFSET)
848847
return false;
849-
#endif /* PAGE_SIZE < 8192) */
848+
#endif /* PAGE_SIZE >= 8192) */
850849

851850
/* If we have drained the page fragment pool we need to update
852851
* the pagecnt_bias and page count so that we fully restock the
@@ -949,12 +948,7 @@ ice_get_rx_buf(struct ice_rx_ring *rx_ring, const unsigned int size,
949948
struct ice_rx_buf *rx_buf;
950949

951950
rx_buf = &rx_ring->rx_buf[ntc];
952-
rx_buf->pgcnt =
953-
#if (PAGE_SIZE < 8192)
954-
page_count(rx_buf->page);
955-
#else
956-
0;
957-
#endif
951+
rx_buf->pgcnt = page_count(rx_buf->page);
958952
prefetchw(rx_buf->page);
959953

960954
if (!size)

0 commit comments

Comments
 (0)