Index: sys/dev/ixgbe/if_ix.c =================================================================== --- sys/dev/ixgbe/if_ix.c +++ sys/dev/ixgbe/if_ix.c @@ -170,6 +170,8 @@ 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 @@ 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 @@ /* 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_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 @@ "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: Index: sys/dev/ixgbe/if_ixv.c =================================================================== --- sys/dev/ixgbe/if_ixv.c +++ sys/dev/ixgbe/if_ixv.c @@ -115,6 +115,8 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ "# 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. Index: sys/dev/ixgbe/ix_txrx.c =================================================================== --- sys/dev/ixgbe/ix_txrx.c +++ sys/dev/ixgbe/ix_txrx.c @@ -986,12 +986,12 @@ 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 @@ 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; Index: sys/dev/ixgbe/ixgbe.h =================================================================== --- sys/dev/ixgbe/ixgbe.h +++ sys/dev/ixgbe/ixgbe.h @@ -365,7 +365,6 @@ 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 @@ 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 tx_ring *tx_rings; u32 num_tx_desc; + u32 tx_process_limit; /* * Receive rings: @@ -547,6 +546,7 @@ struct rx_ring *rx_rings; u64 active_queues; u32 num_rx_desc; + u32 rx_process_limit; /* Multicast array memory */ struct ixgbe_mc_addr *mta;