Add support for sysctl knobs to live tune the per interrupt rx/tx packet

processing limits in ixgbe(4)

Differential Revision:	https://reviews.freebsd.org/D3719
Submitted by:	jason wolfe (j-nitrology.com)
MFC after:	2 weeks
This commit is contained in:
Sean Bruno 2015-10-13 17:34:18 +00:00
parent 150be74358
commit b0c041f887
4 changed files with 47 additions and 17 deletions

View File

@ -170,6 +170,8 @@ static void ixgbe_add_device_sysctls(struct adapter *);
static void ixgbe_add_hw_stats(struct adapter *);
/* Sysctl handlers */
static void ixgbe_set_sysctl_value(struct adapter *, const char *,
const char *, int *, int);
static int ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS);
static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS);
static int ixgbe_sysctl_thermal_test(SYSCTL_HANDLER_ARGS);
@ -461,6 +463,15 @@ ixgbe_attach(device_t dev)
goto err_out;
}
/* Sysctls for limiting the amount of work done in the taskqueues */
ixgbe_set_sysctl_value(adapter, "rx_processing_limit",
"max number of rx packets to process",
&adapter->rx_process_limit, ixgbe_rx_process_limit);
ixgbe_set_sysctl_value(adapter, "tx_processing_limit",
"max number of tx packets to process",
&adapter->tx_process_limit, ixgbe_tx_process_limit);
/* Do descriptor calc and sanity checks */
if (((ixgbe_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) {
@ -2877,9 +2888,6 @@ ixgbe_initialize_transmit_units(struct adapter *adapter)
/* Cache the tail address */
txr->tail = IXGBE_TDT(j);
/* Set the processing limit */
txr->process_limit = ixgbe_tx_process_limit;
/* Disable Head Writeback */
switch (hw->mac.type) {
case ixgbe_mac_82598EB:
@ -3136,9 +3144,6 @@ ixgbe_initialize_receive_units(struct adapter *adapter)
IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0);
IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0);
/* Set the processing limit */
rxr->process_limit = ixgbe_rx_process_limit;
/* Set the driver rx tail address */
rxr->tail = IXGBE_RDT(rxr->me);
}
@ -4458,6 +4463,16 @@ ixgbe_add_hw_stats(struct adapter *adapter)
"1024-1522 byte frames transmitted");
}
static void
ixgbe_set_sysctl_value(struct adapter *adapter, const char *name,
const char *description, int *limit, int value)
{
*limit = value;
SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)),
OID_AUTO, name, CTLFLAG_RW, limit, value, description);
}
/*
** Set flow control using sysctl:
** Flow control values:

View File

@ -115,6 +115,8 @@ static void ixv_save_stats(struct adapter *);
static void ixv_init_stats(struct adapter *);
static void ixv_update_stats(struct adapter *);
static void ixv_add_stats_sysctls(struct adapter *);
static void ixv_set_sysctl_value(struct adapter *, const char *,
const char *, int *, int);
/* The MSI/X Interrupt handlers */
static void ixv_msix_que(void *);
@ -325,6 +327,15 @@ ixv_attach(device_t dev)
goto err_out;
}
/* Sysctls for limiting the amount of work done in the taskqueues */
ixv_set_sysctl_value(adapter, "rx_processing_limit",
"max number of rx packets to process",
&adapter->rx_process_limit, ixv_rx_process_limit);
ixv_set_sysctl_value(adapter, "tx_processing_limit",
"max number of tx packets to process",
&adapter->tx_process_limit, ixv_tx_process_limit);
/* Do descriptor calc and sanity checks */
if (((ixv_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) {
@ -1600,9 +1611,6 @@ ixv_initialize_transmit_units(struct adapter *adapter)
/* Set Tx Tail register */
txr->tail = IXGBE_VFTDT(i);
/* Set the processing limit */
txr->process_limit = ixv_tx_process_limit;
/* Set Ring parameters */
IXGBE_WRITE_REG(hw, IXGBE_VFTDBAL(i),
(tdba & 0x00000000ffffffffULL));
@ -1691,9 +1699,6 @@ ixv_initialize_receive_units(struct adapter *adapter)
reg |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(i), reg);
/* Set the processing limit */
rxr->process_limit = ixv_rx_process_limit;
/* Capture Rx Tail index */
rxr->tail = IXGBE_VFRDT(rxr->me);
@ -2122,6 +2127,16 @@ ixv_add_stats_sysctls(struct adapter *adapter)
"# of times not enough descriptors were available during TX");
}
static void
ixv_set_sysctl_value(struct adapter *adapter, const char *name,
const char *description, int *limit, int value)
{
*limit = value;
SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)),
OID_AUTO, name, CTLFLAG_RW, limit, value, description);
}
/**********************************************************************
*
* This routine is called only when em_display_debug_stats is enabled.

View File

@ -986,12 +986,12 @@ ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp,
void
ixgbe_txeof(struct tx_ring *txr)
{
#ifdef DEV_NETMAP
struct adapter *adapter = txr->adapter;
#ifdef DEV_NETMAP
struct ifnet *ifp = adapter->ifp;
#endif
u32 work, processed = 0;
u16 limit = txr->process_limit;
u32 limit = adapter->tx_process_limit;
struct ixgbe_tx_buf *buf;
union ixgbe_adv_tx_desc *txd;
@ -1747,7 +1747,7 @@ ixgbe_rxeof(struct ix_queue *que)
struct lro_entry *queued;
int i, nextp, processed = 0;
u32 staterr = 0;
u16 count = rxr->process_limit;
u32 count = adapter->rx_process_limit;
union ixgbe_adv_rx_desc *cur;
struct ixgbe_rx_buf *rbuf, *nbuf;
u16 pkt_info;

View File

@ -365,7 +365,6 @@ struct tx_ring {
volatile u16 tx_avail;
u16 next_avail_desc;
u16 next_to_clean;
u16 process_limit;
u16 num_desc;
u32 txd_cmd;
bus_dma_tag_t txtag;
@ -407,7 +406,6 @@ struct rx_ring {
u16 next_to_check;
u16 num_desc;
u16 mbuf_sz;
u16 process_limit;
char mtx_name[16];
struct ixgbe_rx_buf *rx_buffers;
bus_dma_tag_t ptag;
@ -539,6 +537,7 @@ struct adapter {
*/
struct tx_ring *tx_rings;
u32 num_tx_desc;
u32 tx_process_limit;
/*
* Receive rings:
@ -547,6 +546,7 @@ struct adapter {
struct rx_ring *rx_rings;
u64 active_queues;
u32 num_rx_desc;
u32 rx_process_limit;
/* Multicast array memory */
struct ixgbe_mc_addr *mta;