Skip to content

Commit b76bc12

Browse files
jdamato-fslyanguy11
authored andcommitted
i40e: Add a stat for tracking busy rx pages
In some cases, pages cannot be reused by i40e because the page is busy. Add a counter for this event. Busy page count is accessible via ethtool. Signed-off-by: Joe Damato <[email protected]> Tested-by: Dave Switzer <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent cb963b9 commit b76bc12

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,7 @@ struct i40e_vsi {
857857
u64 rx_page_reuse;
858858
u64 rx_page_alloc;
859859
u64 rx_page_waive;
860+
u64 rx_page_busy;
860861

861862
/* These are containers of ring pointers, allocated at run-time */
862863
struct i40e_ring **rx_rings;

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {
298298
I40E_VSI_STAT("rx_cache_reuse", rx_page_reuse),
299299
I40E_VSI_STAT("rx_cache_alloc", rx_page_alloc),
300300
I40E_VSI_STAT("rx_cache_waive", rx_page_waive),
301+
I40E_VSI_STAT("rx_cache_busy", rx_page_busy),
301302
};
302303

303304
/* These PF_STATs might look like duplicates of some NETDEV_STATs,

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ void i40e_update_veb_stats(struct i40e_veb *veb)
773773
**/
774774
static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
775775
{
776-
u64 rx_page, rx_buf, rx_reuse, rx_alloc, rx_waive;
776+
u64 rx_page, rx_buf, rx_reuse, rx_alloc, rx_waive, rx_busy;
777777
struct i40e_pf *pf = vsi->back;
778778
struct rtnl_link_stats64 *ons;
779779
struct rtnl_link_stats64 *ns; /* netdev stats */
@@ -809,6 +809,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
809809
rx_reuse = 0;
810810
rx_alloc = 0;
811811
rx_waive = 0;
812+
rx_busy = 0;
812813
rcu_read_lock();
813814
for (q = 0; q < vsi->num_queue_pairs; q++) {
814815
/* locate Tx ring */
@@ -845,6 +846,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
845846
rx_reuse += p->rx_stats.page_reuse_count;
846847
rx_alloc += p->rx_stats.page_alloc_count;
847848
rx_waive += p->rx_stats.page_waive_count;
849+
rx_busy += p->rx_stats.page_busy_count;
848850

849851
if (i40e_enabled_xdp_vsi(vsi)) {
850852
/* locate XDP ring */
@@ -875,6 +877,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
875877
vsi->rx_page_reuse = rx_reuse;
876878
vsi->rx_page_alloc = rx_alloc;
877879
vsi->rx_page_waive = rx_waive;
880+
vsi->rx_page_busy = rx_busy;
878881

879882
ns->rx_packets = rx_p;
880883
ns->rx_bytes = rx_b;

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,8 +1990,8 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb,
19901990
* pointing to; otherwise, the DMA mapping needs to be destroyed and
19911991
* page freed.
19921992
*
1993-
* rx_stats will be updated to indicate if the page was waived because it was
1994-
* not reusable.
1993+
* rx_stats will be updated to indicate whether the page was waived
1994+
* or busy if it could not be reused.
19951995
*/
19961996
static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer,
19971997
struct i40e_rx_queue_stats *rx_stats,
@@ -2008,13 +2008,17 @@ static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer,
20082008

20092009
#if (PAGE_SIZE < 8192)
20102010
/* if we are only owner of page we can reuse it */
2011-
if (unlikely((rx_buffer_pgcnt - pagecnt_bias) > 1))
2011+
if (unlikely((rx_buffer_pgcnt - pagecnt_bias) > 1)) {
2012+
rx_stats->page_busy_count++;
20122013
return false;
2014+
}
20132015
#else
20142016
#define I40E_LAST_OFFSET \
20152017
(SKB_WITH_OVERHEAD(PAGE_SIZE) - I40E_RXBUFFER_2048)
2016-
if (rx_buffer->page_offset > I40E_LAST_OFFSET)
2018+
if (rx_buffer->page_offset > I40E_LAST_OFFSET) {
2019+
rx_stats->page_busy_count++;
20172020
return false;
2021+
}
20182022
#endif
20192023

20202024
/* If we have drained the page fragment pool we need to update

drivers/net/ethernet/intel/i40e/i40e_txrx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ struct i40e_rx_queue_stats {
300300
u64 page_reuse_count;
301301
u64 page_alloc_count;
302302
u64 page_waive_count;
303+
u64 page_busy_count;
303304
};
304305

305306
enum i40e_ring_state_t {

0 commit comments

Comments
 (0)