eth: fbnic: Add ethtool support for IRQ coalescing
Subsystems (3)
PATCH v2 1/1 eth: fbnic: Add ethtool support for IRQ coalescing
Add ethtool support to configure the IRQ coalescing behavior. Support separate timers for Rx and Tx for time based coalescing. For frame based configuration, currently we only support the Rx side.
The hardware allows configuration of descriptor count instead of frame count requiring conversion between the two. We assume 2 descriptors per frame, one for the metadata and one for the data segment.
When rx-frames are not configured, we set the RX descriptor count to half the ring size as a fail safe.
Default configuration:
ethtool -c eth0 | grep -E "rx-usecs:|tx-usecs:|rx-frames:" rx-usecs: 30 rx-frames: 0 tx-usecs: 35
IRQ rate test:
With single iperf flow we monitor IRQ rate while changing the tx-usesc and rx-usecs to high and low values.
ethtool -C eth0 rx-frames 8192 rx-usecs 150 tx-usecs 150
irq/sec 13k irq/sec 14k irq/sec 14k
ethtool -C eth0 rx-frames 8192 rx-usecs 10 tx-usecs 10
irq/sec 27k irq/sec 28k irq/sec 28k
Validating the use of extack:
ethtool -C eth0 rx-frames 16384
netlink error: fbnic: rx_frames is above device max netlink error: Invalid argument
---
V2:
- Update fbnic_set_coalesce() to use extack to highlight incorrect config
- Simplify fbnic_config_rx_frames()
V1: https://lore.kernel.org/netdev/[email protected]
--- drivers/net/ethernet/meta/fbnic/fbnic.h | 3 + .../net/ethernet/meta/fbnic/fbnic_ethtool.c | 59 +++++++++++++++++++ .../net/ethernet/meta/fbnic/fbnic_netdev.c | 4 ++ .../net/ethernet/meta/fbnic/fbnic_netdev.h | 6 ++ drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 53 ++++++++++++++--- drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 3 + 6 files changed, 120 insertions(+), 8 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic.h +3 -0
@@ -180,6 +180,9 @@ void fbnic_dbg_exit(void);void fbnic_csr_get_regs (struct fbnic_dev *fbd,u32 *data,u32 *regs_version);int fbnic_csr_regs_len (struct fbnic_dev *fbd); +void fbnic_config_txrx_usecs (struct fbnic_napi_vector *nv,u32 arm); +void fbnic_config_rx_frames (struct fbnic_napi_vector *nv); +enum fbnic_boards { fbnic_board_asic };
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c +59 -0
74 lines not on this page · raw message
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +4 -0
@@ -618,6 +618,10 @@ struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd) fbn->ppq_size =FBNIC_PPQ_SIZE_DEFAULT ; fbn->rcq_size =FBNIC_RCQ_SIZE_DEFAULT ; + fbn->tx_usecs =FBNIC_TX_USECS_DEFAULT ; + fbn->rx_usecs =FBNIC_RX_USECS_DEFAULT ; + fbn->rx_max_frames =FBNIC_RX_FRAMES_DEFAULT ; + default_queues =netif_get_num_default_rss_queues ();if (default_queues > fbd->max_num_queues) default_queues = fbd->max_num_queues;
drivers/net/ethernet/meta/fbnic/fbnic_netdev.h +6 -0
@@ -12,6 +12,7 @@#include "fbnic_txrx.h" #define FBNIC_MAX_NAPI_VECTORS 128u +#define FBNIC_MIN_RXD_PER_FRAME 2struct fbnic_net {struct fbnic_ring *tx[FBNIC_MAX_TXQS ];
@@ -27,6 +28,11 @@ struct fbnic_net {u32 ppq_size;u32 rcq_size; +u16 rx_usecs; +u16 tx_usecs; + +u32 rx_max_frames; +u16 num_napi;struct phylink *phylink;
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c +45 -8
74 lines not on this page · raw message
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h +3 -0
@@ -31,6 +31,9 @@ struct fbnic_net;#define FBNIC_HPQ_SIZE_DEFAULT 256#define FBNIC_PPQ_SIZE_DEFAULT 256#define FBNIC_RCQ_SIZE_DEFAULT 1024 +#define FBNIC_TX_USECS_DEFAULT 35 +#define FBNIC_RX_USECS_DEFAULT 30 +#define FBNIC_RX_FRAMES_DEFAULT 0#define FBNIC_RX_TROOM \ SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
Signature · 1 line
2.43.5
Quoted 27 lines · Mohsin Bashir
Add ethtool support to configure the IRQ coalescing behavior. Support separate timers for Rx and Tx for time based coalescing. For frame based configuration, currently we only support the Rx side.
The hardware allows configuration of descriptor count instead of frame count requiring conversion between the two. We assume 2 descriptors per frame, one for the metadata and one for the data segment.
When rx-frames are not configured, we set the RX descriptor count to half the ring size as a fail safe.
Default configuration:
ethtool -c eth0 | grep -E "rx-usecs:|tx-usecs:|rx-frames:" rx-usecs: 30 rx-frames: 0 tx-usecs: 35IRQ rate test:
With single iperf flow we monitor IRQ rate while changing the tx-usesc and rx-usecs to high and low values.ethtool -C eth0 rx-frames 8192 rx-usecs 150 tx-usecs 150
irq/sec 13k irq/sec 14k irq/sec 14kethtool -C eth0 rx-frames 8192 rx-usecs 10 tx-usecs 10
Quoted 8 lines
irq/sec 27k irq/sec 28k irq/sec 28kValidating the use of extack:
ethtool -C eth0 rx-frames 16384
netlink error: fbnic:rx_framesis above device max netlink error: Invalid argument
Nice, thanks.
Andrew
Simon Horman
reviewerQuoted 31 lines · Mohsin Bashir
Add ethtool support to configure the IRQ coalescing behavior. Support separate timers for Rx and Tx for time based coalescing. For frame based configuration, currently we only support the Rx side.
The hardware allows configuration of descriptor count instead of frame count requiring conversion between the two. We assume 2 descriptors per frame, one for the metadata and one for the data segment.
When rx-frames are not configured, we set the RX descriptor count to half the ring size as a fail safe.
Default configuration:
ethtool -c eth0 | grep -E "rx-usecs:|tx-usecs:|rx-frames:" rx-usecs: 30 rx-frames: 0 tx-usecs: 35IRQ rate test:
With single iperf flow we monitor IRQ rate while changing the tx-usesc and rx-usecs to high and low values.ethtool -C eth0 rx-frames 8192 rx-usecs 150 tx-usecs 150
irq/sec 13k irq/sec 14k irq/sec 14kethtool -C eth0 rx-frames 8192 rx-usecs 10 tx-usecs 10
irq/sec 27k irq/sec 28k irq/sec 28k
Quoted 6 lines
Validating the use of extack:
ethtool -C eth0 rx-frames 16384
netlink error: fbnic:rx_framesis above device max netlink error: Invalid argumentSigned-off-by Mohsin Bashir <[email protected]>
Hi Moshin,
Unfortunately this does not seem to apply cleanly against current net-next. Could you rebase and repost?
Thanks!
Signature · 1 line
pw-bot: changes-requested
Quoted 45 lines · Mohsin Bashir
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Add ethtool support to configure the IRQ coalescing behavior. Support separate timers for Rx and Tx for time based coalescing. For frame based configuration, currently we only support the Rx side.
The hardware allows configuration of descriptor count instead of frame count requiring conversion between the two. We assume 2 descriptors per frame, one for the metadata and one for the data segment.
When rx-frames are not configured, we set the RX descriptor count to half the ring size as a fail safe.
Default configuration:
ethtool -c eth0 | grep -E "rx-usecs:|tx-usecs:|rx-frames:" rx-usecs: 30 rx-frames: 0 tx-usecs: 35IRQ rate test:
With single iperf flow we monitor IRQ rate while changing the tx-usesc and rx-usecs to high and low values.ethtool -C eth0 rx-frames 8192 rx-usecs 150 tx-usecs 150
irq/sec 13k irq/sec 14k irq/sec 14kethtool -C eth0 rx-frames 8192 rx-usecs 10 tx-usecs 10
irq/sec 27k irq/sec 28k irq/sec 28kValidating the use of extack:
ethtool -C eth0 rx-frames 16384
netlink error: fbnic:rx_framesis above device max netlink error: Invalid argumentSigned-off-by Mohsin Bashir <[email protected]>---
V2:
- Updatefbnic_set_coalesce()to use extack to highlight incorrect config
- Simplifyfbnic_config_rx_frames()
V1: https://lore.kernel.org/netdev/[email protected]
Quoted 9 lines
--- drivers/net/ethernet/meta/fbnic/fbnic.h | 3 + .../net/ethernet/meta/fbnic/fbnic_ethtool.c | 59 +++++++++++++++++++ .../net/ethernet/meta/fbnic/fbnic_netdev.c | 4 ++ .../net/ethernet/meta/fbnic/fbnic_netdev.h | 6 ++ drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 53 ++++++++++++++--- drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 3 + 6 files changed, 120 insertions(+), 8 deletions(-)
LGTM.
<snip>