Change the Interrupt Moderation flag from global variable to per device.

This commit is contained in:
msaitoh 2017-02-10 08:41:13 +00:00
parent 21c0544e4a
commit 2e1b30ad96
2 changed files with 13 additions and 16 deletions

View File

@ -59,7 +59,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/ /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/
/*$NetBSD: ixgbe.c,v 1.72 2017/02/10 06:35:22 msaitoh Exp $*/ /*$NetBSD: ixgbe.c,v 1.73 2017/02/10 08:41:13 msaitoh Exp $*/
#include "opt_inet.h" #include "opt_inet.h"
#include "opt_inet6.h" #include "opt_inet6.h"
@ -282,7 +282,7 @@ MODULE_DEPEND(ix, ether, 1, 1, 1);
** is varied over time based on the ** is varied over time based on the
** traffic for that interrupt vector ** traffic for that interrupt vector
*/ */
static int ixgbe_enable_aim = TRUE; static bool ixgbe_enable_aim = true;
#define SYSCTL_INT(_a1, _a2, _a3, _a4, _a5, _a6, _a7) #define SYSCTL_INT(_a1, _a2, _a3, _a4, _a5, _a6, _a7)
SYSCTL_INT(_hw_ix, OID_AUTO, enable_aim, CTLFLAG_RWTUN, &ixgbe_enable_aim, 0, SYSCTL_INT(_hw_ix, OID_AUTO, enable_aim, CTLFLAG_RWTUN, &ixgbe_enable_aim, 0,
"Enable adaptive interrupt moderation"); "Enable adaptive interrupt moderation");
@ -1708,7 +1708,7 @@ ixgbe_msix_que(void *arg)
/* Do AIM now? */ /* Do AIM now? */
if (adapter->enable_aim == FALSE) if (adapter->enable_aim == false)
goto no_calc; goto no_calc;
/* /*
** Do Adaptive Interrupt Moderation: ** Do Adaptive Interrupt Moderation:
@ -4521,13 +4521,10 @@ ixgbe_add_device_sysctls(struct adapter *adapter)
ixgbe_sysctl_flowcntl, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) ixgbe_sysctl_flowcntl, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
aprint_error_dev(dev, "could not create sysctl\n"); aprint_error_dev(dev, "could not create sysctl\n");
/* XXX This is an *instance* sysctl controlling a *global* variable.
* XXX It's that way in the FreeBSD driver that this derives from.
*/
if (sysctl_createv(log, 0, &rnode, &cnode, if (sysctl_createv(log, 0, &rnode, &cnode,
CTLFLAG_READWRITE, CTLTYPE_INT, CTLFLAG_READWRITE, CTLTYPE_BOOL,
"enable_aim", SYSCTL_DESCR("Interrupt Moderation"), "enable_aim", SYSCTL_DESCR("Interrupt Moderation"),
NULL, 0, &ixgbe_enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)
aprint_error_dev(dev, "could not create sysctl\n"); aprint_error_dev(dev, "could not create sysctl\n");
if (sysctl_createv(log, 0, &rnode, &cnode, if (sysctl_createv(log, 0, &rnode, &cnode,

View File

@ -31,7 +31,7 @@
******************************************************************************/ ******************************************************************************/
/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 302384 2016-07-07 03:39:18Z sbruno $*/ /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 302384 2016-07-07 03:39:18Z sbruno $*/
/*$NetBSD: ixv.c,v 1.49 2017/02/10 06:35:22 msaitoh Exp $*/ /*$NetBSD: ixv.c,v 1.50 2017/02/10 08:41:13 msaitoh Exp $*/
#include "opt_inet.h" #include "opt_inet.h"
#include "opt_inet6.h" #include "opt_inet6.h"
@ -197,7 +197,7 @@ TUNABLE_INT("hw.ixv.num_queues", &ixv_num_queues);
** is varied over time based on the ** is varied over time based on the
** traffic for that interrupt vector ** traffic for that interrupt vector
*/ */
static int ixv_enable_aim = FALSE; static bool ixv_enable_aim = false;
TUNABLE_INT("hw.ixv.enable_aim", &ixv_enable_aim); TUNABLE_INT("hw.ixv.enable_aim", &ixv_enable_aim);
/* How many packets rxeof tries to clean at a time */ /* How many packets rxeof tries to clean at a time */
@ -425,6 +425,9 @@ ixv_attach(device_t parent, device_t dev, void *aux)
bcopy(addr, hw->mac.addr, sizeof(addr)); bcopy(addr, hw->mac.addr, sizeof(addr));
} }
/* hw.ix defaults init */
adapter->enable_aim = ixv_enable_aim;
/* Setup OS specific network interface */ /* Setup OS specific network interface */
ixv_setup_interface(dev, adapter); ixv_setup_interface(dev, adapter);
@ -943,7 +946,7 @@ ixv_msix_que(void *arg)
/* Do AIM now? */ /* Do AIM now? */
if (ixv_enable_aim == FALSE) if (adapter->enable_aim == false)
goto no_calc; goto no_calc;
/* /*
** Do Adaptive Interrupt Moderation: ** Do Adaptive Interrupt Moderation:
@ -2323,13 +2326,10 @@ ixv_add_device_sysctls(struct adapter *adapter)
ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
aprint_error_dev(dev, "could not create sysctl\n"); aprint_error_dev(dev, "could not create sysctl\n");
/* XXX This is an *instance* sysctl controlling a *global* variable.
* XXX It's that way in the FreeBSD driver that this derives from.
*/
if (sysctl_createv(log, 0, &rnode, &cnode, if (sysctl_createv(log, 0, &rnode, &cnode,
CTLFLAG_READWRITE, CTLTYPE_INT, CTLFLAG_READWRITE, CTLTYPE_BOOL,
"enable_aim", SYSCTL_DESCR("Interrupt Moderation"), "enable_aim", SYSCTL_DESCR("Interrupt Moderation"),
NULL, 0, &ixv_enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)
aprint_error_dev(dev, "could not create sysctl\n"); aprint_error_dev(dev, "could not create sysctl\n");
} }