Skip to content

Commit e407fce

Browse files
committed
eth: fbnic: remove the debugging trick of super high page bias
Alex added page bias of LONG_MAX, which is admittedly quite a clever way of catching overflows of the pp ref count. The page pool code was "optimized" to leave the ref at 1 for freed pages so it can't catch basic bugs by itself any more. (Something we should probably address under DEBUG_NET...) Unfortunately for fbnic since commit f7dc324 ("skbuff: Optimization of SKB coalescing for page pool") core _may_ actually take two extra pp refcounts, if one of them is returned before driver gives up the bias the ret < 0 check in page_pool_unref_netmem() will trigger. While at it add a FBNIC_ to the name of the driver constant. Fixes: 0cb4c0a ("eth: fbnic: Implement Rx queue alloc/start/stop/free") Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e88fbc3 commit e407fce

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

drivers/net/ethernet/meta/fbnic/fbnic_txrx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ static void fbnic_page_pool_init(struct fbnic_ring *ring, unsigned int idx,
661661
{
662662
struct fbnic_rx_buf *rx_buf = &ring->rx_buf[idx];
663663

664-
page_pool_fragment_page(page, PAGECNT_BIAS_MAX);
665-
rx_buf->pagecnt_bias = PAGECNT_BIAS_MAX;
664+
page_pool_fragment_page(page, FBNIC_PAGECNT_BIAS_MAX);
665+
rx_buf->pagecnt_bias = FBNIC_PAGECNT_BIAS_MAX;
666666
rx_buf->page = page;
667667
}
668668

drivers/net/ethernet/meta/fbnic/fbnic_txrx.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,8 @@ struct fbnic_queue_stats {
9191
struct u64_stats_sync syncp;
9292
};
9393

94-
/* Pagecnt bias is long max to reserve the last bit to catch overflow
95-
* cases where if we overcharge the bias it will flip over to be negative.
96-
*/
97-
#define PAGECNT_BIAS_MAX LONG_MAX
94+
#define FBNIC_PAGECNT_BIAS_MAX PAGE_SIZE
95+
9896
struct fbnic_rx_buf {
9997
struct page *page;
10098
long pagecnt_bias;

0 commit comments

Comments
 (0)