40GbE Intel Wired LAN Driver Updates 2022-02-08
Subsystems (3)
Tony Nguyen
maintainerJoe Damato says:
This patch set makes several updates to the i40e driver stats collection and reporting code to help users of i40e get a better sense of how the driver is performing and interacting with the rest of the kernel.
These patches include some new stats (like waived and busy) which were inspired by other drivers that track stats using the same nomenclature.
The new stats and an existing stat, rx_reuse, are now accessible with ethtool to make harvesting this data more convenient for users.
The following are changes since commit c3e676b98326a419f30dd5d956c68fc33323f4fd:
Merge branch 'inet-separate-dscp-from-ecn-bits-using-new-dscp_t-type'
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 40GbE
Joe Damato (5):
i40e: Remove rx page reuse double count
i40e: Aggregate and export RX page reuse stat
i40e: Add a stat tracking new RX page allocations
i40e: Add a stat for tracking pages waived
i40e: Add a stat for tracking busy rx pages
drivers/net/ethernet/intel/i40e/i40e.h | 4 +++ .../net/ethernet/intel/i40e/i40e_ethtool.c | 4 +++ drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 25 +++++++++++++------ drivers/net/ethernet/intel/i40e/i40e_txrx.h | 3 +++ 5 files changed, 42 insertions(+), 8 deletions(-)
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 1/5 i40e: Remove rx page reuse double count
From: Joe Damato <[email protected]>
Page reuse was being tracked from two locations:
- i40e_reuse_rx_page (via 40e_clean_rx_irq), and
- i40e_alloc_mapped_page
Remove the double count and only count reuse from i40e_alloc_mapped_page when the page is about to be reused.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +0 -2
@@ -1382,8 +1382,6 @@ static void i40e_reuse_rx_page(struct i40e_ring *rx_ring, new_buff->page_offset = old_buff->page_offset; new_buff->pagecnt_bias = old_buff->pagecnt_bias; - rx_ring->rx_stats.page_reuse_count++; -/* clear contents of buffer_info */ old_buff->page =NULL ; }
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 2/5 i40e: Aggregate and export RX page reuse stat
In reply to Tony NguyenFrom: Joe Damato <[email protected]>
rx page reuse was already being tracked by the i40e driver per RX ring. Aggregate the counts and make them accessible via ethtool.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -854,6 +854,7 @@ struct i40e_vsi {u64 tx_force_wb;u64 rx_buf_failed;u64 rx_page_failed; +u64 rx_page_reuse;/* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -0
@@ -295,6 +295,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {I40E_VSI_STAT ("tx_busy" , tx_busy),I40E_VSI_STAT ("rx_alloc_fail" , rx_buf_failed),I40E_VSI_STAT ("rx_pg_alloc_fail" , rx_page_failed), + I40E_VSI_STAT("rx_cache_reuse", rx_page_reuse), };/* These PF_STATs might look like duplicates of some NETDEV_STATs,
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -1
@@ -774,13 +774,13 @@ void i40e_update_veb_stats(struct i40e_veb *veb)static void i40e_update_vsi_stats (struct i40e_vsi *vsi) {struct i40e_pf *pf = vsi->back; +u64 rx_page, rx_buf, rx_reuse;struct rtnl_link_stats64 *ons;struct rtnl_link_stats64 *ns;/* netdev stats */ struct i40e_eth_stats *oes;struct i40e_eth_stats *es;/* device's eth stats */ u64 tx_restart, tx_busy;struct i40e_ring *p; -u64 rx_page, rx_buf;u64 bytes, packets;unsigned int start;u64 tx_linearize;
@@ -806,6 +806,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) tx_restart = tx_busy = tx_linearize = tx_force_wb =0 ; rx_page =0 ; rx_buf =0 ; + rx_reuse =0 ;rcu_read_lock ();for (q =0 ; q < vsi->num_queue_pairs; q++) {/* locate Tx ring */
@@ -839,6 +840,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_p += packets; rx_buf += p->rx_stats.alloc_buff_failed; rx_page += p->rx_stats.alloc_page_failed; + rx_reuse += p->rx_stats.page_reuse_count;if (i40e_enabled_xdp_vsi (vsi)) {/* locate XDP ring */
@@ -866,6 +868,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) vsi->tx_force_wb = tx_force_wb; vsi->rx_page_failed = rx_page; vsi->rx_buf_failed = rx_buf; + vsi->rx_page_reuse = rx_reuse; ns->rx_packets = rx_p; ns->rx_bytes = rx_b;
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 3/5 i40e: Add a stat tracking new RX page allocations
In reply to Tony NguyenFrom: Joe Damato <[email protected]>
Add a counter for new page allocations in the i40e RX path. This stat is accessible with ethtool.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 ++ drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + 5 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -855,6 +855,7 @@ struct i40e_vsi {u64 rx_buf_failed;u64 rx_page_failed;u64 rx_page_reuse; +u64 rx_page_alloc;/* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -0
@@ -296,6 +296,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {I40E_VSI_STAT ("rx_alloc_fail" , rx_buf_failed),I40E_VSI_STAT ("rx_pg_alloc_fail" , rx_page_failed),I40E_VSI_STAT ("rx_cache_reuse" , rx_page_reuse), + I40E_VSI_STAT("rx_cache_alloc", rx_page_alloc), };/* These PF_STATs might look like duplicates of some NETDEV_STATs,
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -1
@@ -773,8 +773,8 @@ void i40e_update_veb_stats(struct i40e_veb *veb)**/ static void i40e_update_vsi_stats (struct i40e_vsi *vsi) { +u64 rx_page, rx_buf, rx_reuse, rx_alloc;struct i40e_pf *pf = vsi->back; -u64 rx_page, rx_buf, rx_reuse;struct rtnl_link_stats64 *ons;struct rtnl_link_stats64 *ns;/* netdev stats */ struct i40e_eth_stats *oes;
@@ -807,6 +807,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_page =0 ; rx_buf =0 ; rx_reuse =0 ; + rx_alloc =0 ;rcu_read_lock ();for (q =0 ; q < vsi->num_queue_pairs; q++) {/* locate Tx ring */
@@ -841,6 +842,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_buf += p->rx_stats.alloc_buff_failed; rx_page += p->rx_stats.alloc_page_failed; rx_reuse += p->rx_stats.page_reuse_count; + rx_alloc += p->rx_stats.page_alloc_count;if (i40e_enabled_xdp_vsi (vsi)) {/* locate XDP ring */
@@ -869,6 +871,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) vsi->rx_page_failed = rx_page; vsi->rx_buf_failed = rx_buf; vsi->rx_page_reuse = rx_reuse; + vsi->rx_page_alloc = rx_alloc; ns->rx_packets = rx_p; ns->rx_bytes = rx_b;
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -0
@@ -1673,6 +1673,8 @@ static bool i40e_alloc_mapped_page(struct i40e_ring *rx_ring,return false; } + rx_ring->rx_stats.page_alloc_count++; +/* map page for use */ dma = dma_map_page_attrs(rx_ring->dev, page, 0, i40e_rx_pg_size(rx_ring),
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -0
@@ -298,6 +298,7 @@ struct i40e_rx_queue_stats {u64 alloc_page_failed;u64 alloc_buff_failed;u64 page_reuse_count; +u64 page_alloc_count; };enum i40e_ring_state_t {
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 4/5 i40e: Add a stat for tracking pages waived
In reply to Tony NguyenFrom: Joe Damato <[email protected]>
In some cases, pages can not be reused because they are not associated with the correct NUMA zone. Knowing how often pages are waived helps users to understand the interaction between the driver's memory usage and their system.
Pass rx_stats through to i40e_can_reuse_rx_page to allow tracking when pages are waived.
The page waive count is accessible via ethtool.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 13 ++++++++++--- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + 5 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -856,6 +856,7 @@ struct i40e_vsi {u64 rx_page_failed;u64 rx_page_reuse;u64 rx_page_alloc; +u64 rx_page_waive;/* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -0
@@ -297,6 +297,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {I40E_VSI_STAT ("rx_pg_alloc_fail" , rx_page_failed),I40E_VSI_STAT ("rx_cache_reuse" , rx_page_reuse),I40E_VSI_STAT ("rx_cache_alloc" , rx_page_alloc), + I40E_VSI_STAT("rx_cache_waive", rx_page_waive), };/* These PF_STATs might look like duplicates of some NETDEV_STATs,
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -1
@@ -773,7 +773,7 @@ void i40e_update_veb_stats(struct i40e_veb *veb)**/ static void i40e_update_vsi_stats (struct i40e_vsi *vsi) { -u64 rx_page, rx_buf, rx_reuse, rx_alloc; +u64 rx_page, rx_buf, rx_reuse, rx_alloc, rx_waive;struct i40e_pf *pf = vsi->back;struct rtnl_link_stats64 *ons;struct rtnl_link_stats64 *ns;/* netdev stats */
@@ -808,6 +808,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_buf =0 ; rx_reuse =0 ; rx_alloc =0 ; + rx_waive =0 ;rcu_read_lock ();for (q =0 ; q < vsi->num_queue_pairs; q++) {/* locate Tx ring */
@@ -843,6 +844,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_page += p->rx_stats.alloc_page_failed; rx_reuse += p->rx_stats.page_reuse_count; rx_alloc += p->rx_stats.page_alloc_count; + rx_waive += p->rx_stats.page_waive_count;if (i40e_enabled_xdp_vsi (vsi)) {/* locate XDP ring */
@@ -872,6 +874,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) vsi->rx_buf_failed = rx_buf; vsi->rx_page_reuse = rx_reuse; vsi->rx_page_alloc = rx_alloc; + vsi->rx_page_waive = rx_waive; ns->rx_packets = rx_p; ns->rx_bytes = rx_b;
drivers/net/ethernet/intel/i40e/i40e_txrx.c +10 -3
@@ -1982,22 +1982,29 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb,/** * i40e_can_reuse_rx_page - Determine if page can be reused for another Rx * @rx_buffer: buffer containing the page +* @rx_stats: rx stats structure for the rx ring * @rx_buffer_pgcnt: buffer page refcount pre xdp_do_redirect() call * * If page is reusable, we have a green light for calling i40e_reuse_rx_page, * which will assign the current buffer to the buffer that next_to_alloc is * pointing to; otherwise, the DMA mapping needs to be destroyed and -* page freed +* page freed. +* +* rx_stats will be updated to indicate if the page was waived because it was +* not reusable. */ static bool i40e_can_reuse_rx_page (struct i40e_rx_buffer *rx_buffer, +struct i40e_rx_queue_stats *rx_stats,int rx_buffer_pgcnt) {unsigned int pagecnt_bias = rx_buffer->pagecnt_bias;struct page *page = rx_buffer->page;/* Is any reuse possible? */ -if (!dev_page_is_reusable (page)) +if (!dev_page_is_reusable (page)) { + rx_stats->page_waive_count++;return false; + }#if (PAGE_SIZE <8192 )/* if we are only owner of page we can reuse it */
@@ -2237,7 +2244,7 @@ static void i40e_put_rx_buffer(struct i40e_ring *rx_ring,struct i40e_rx_buffer *rx_buffer, int rx_buffer_pgcnt) { - if (i40e_can_reuse_rx_page(rx_buffer, rx_buffer_pgcnt)) { + if (i40e_can_reuse_rx_page(rx_buffer, &rx_ring->rx_stats, rx_buffer_pgcnt)) {/* hand second half of page back to the ring */ i40e_reuse_rx_page (rx_ring ,rx_buffer ); } else {
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -0
@@ -299,6 +299,7 @@ struct i40e_rx_queue_stats {u64 alloc_buff_failed;u64 page_reuse_count;u64 page_alloc_count; +u64 page_waive_count; };enum i40e_ring_state_t {
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 5/5 i40e: Add a stat for tracking busy rx pages
In reply to Tony NguyenFrom: Joe Damato <[email protected]>
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.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 ++++++++---- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + 5 files changed, 15 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -857,6 +857,7 @@ struct i40e_vsi {u64 rx_page_reuse;u64 rx_page_alloc;u64 rx_page_waive; +u64 rx_page_busy;/* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -0
@@ -298,6 +298,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {I40E_VSI_STAT ("rx_cache_reuse" , rx_page_reuse),I40E_VSI_STAT ("rx_cache_alloc" , rx_page_alloc),I40E_VSI_STAT ("rx_cache_waive" , rx_page_waive), + I40E_VSI_STAT("rx_cache_busy", rx_page_busy), };/* These PF_STATs might look like duplicates of some NETDEV_STATs,
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -1
@@ -773,7 +773,7 @@ void i40e_update_veb_stats(struct i40e_veb *veb)**/ static void i40e_update_vsi_stats (struct i40e_vsi *vsi) { -u64 rx_page, rx_buf, rx_reuse, rx_alloc, rx_waive; +u64 rx_page, rx_buf, rx_reuse, rx_alloc, rx_waive, rx_busy;struct i40e_pf *pf = vsi->back;struct rtnl_link_stats64 *ons;struct rtnl_link_stats64 *ns;/* netdev stats */
@@ -809,6 +809,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_reuse =0 ; rx_alloc =0 ; rx_waive =0 ; + rx_busy =0 ;rcu_read_lock ();for (q =0 ; q < vsi->num_queue_pairs; q++) {/* locate Tx ring */
@@ -845,6 +846,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_reuse += p->rx_stats.page_reuse_count; rx_alloc += p->rx_stats.page_alloc_count; rx_waive += p->rx_stats.page_waive_count; + rx_busy += p->rx_stats.page_busy_count;if (i40e_enabled_xdp_vsi (vsi)) {/* locate XDP ring */
@@ -875,6 +877,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) vsi->rx_page_reuse = rx_reuse; vsi->rx_page_alloc = rx_alloc; vsi->rx_page_waive = rx_waive; + vsi->rx_page_busy = rx_busy; ns->rx_packets = rx_p; ns->rx_bytes = rx_b;
drivers/net/ethernet/intel/i40e/i40e_txrx.c +8 -4
@@ -1990,8 +1990,8 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb,* pointing to; otherwise, the DMA mapping needs to be destroyed and * page freed. * -* rx_stats will be updated to indicate if the page was waived because it was -* not reusable. +* rx_stats will be updated to indicate whether the page was waived +* or busy if it could not be reused. */ static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer, struct i40e_rx_queue_stats *rx_stats,
@@ -2008,13 +2008,17 @@ static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer,#if (PAGE_SIZE <8192 )/* if we are only owner of page we can reuse it */ -if (unlikely ((rx_buffer_pgcnt - pagecnt_bias) >1 )) +if (unlikely ((rx_buffer_pgcnt - pagecnt_bias) >1 )) { + rx_stats->page_busy_count++;return false; + }#else #define I40E_LAST_OFFSET \ (SKB_WITH_OVERHEAD(PAGE_SIZE) - I40E_RXBUFFER_2048) -if (rx_buffer->page_offset >I40E_LAST_OFFSET ) +if (rx_buffer->page_offset >I40E_LAST_OFFSET ) { + rx_stats->page_busy_count++;return false; + }#endif /* If we have drained the page fragment pool we need to update
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -0
@@ -300,6 +300,7 @@ struct i40e_rx_queue_stats {u64 page_reuse_count;u64 page_alloc_count;u64 page_waive_count; +u64 page_busy_count; };enum i40e_ring_state_t {
Signature · 1 line
2.31.1
This series was applied to netdev/net-next.git (master) by Tony Nguyen <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Tony Nguyen <[email protected]>:
Quoted 10 lines · On Tue, 8 Feb 2022 13:51:12 -0800 you wrote:
Joe Damato says:
This patch set makes several updates to the i40e driver stats collection and reporting code to help users of i40e get a better sense of how the driver is performing and interacting with the rest of the kernel.
These patches include some new stats (like waived and busy) which were inspired by other drivers that track stats using the same nomenclature.
[...]
Here is the summary with links:
- [net-next,1/5] i40e: Remove rx page reuse double count
https://git.kernel.org/netdev/net-next/c/89bb09837b97 - [net-next,2/5] i40e: Aggregate and export RX page reuse stat https://git.kernel.org/netdev/net-next/c/b3936d27673c - [net-next,3/5] i40e: Add a stat tracking new RX page allocations https://git.kernel.org/netdev/net-next/c/453f83054838 - [net-next,4/5] i40e: Add a stat for tracking pages waived https://git.kernel.org/netdev/net-next/c/cb963b989755 - [net-next,5/5] i40e: Add a stat for tracking busy rx pages https://git.kernel.org/netdev/net-next/c/b76bc129839d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html