git: 68b1f5dc5936 - main - igc: Add sysctl for DMA Coalesce
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 14 Oct 2024 12:57:02 UTC
The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=68b1f5dc59368ce5175e3300bf95476ea5a560bc commit 68b1f5dc59368ce5175e3300bf95476ea5a560bc Author: Kevin Bowling <kbowling@FreeBSD.org> AuthorDate: 2024-10-14 12:55:18 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2024-10-14 12:56:39 +0000 igc: Add sysctl for DMA Coalesce This feature can increase efficiency at the expense of latency It does not work well with the default interrupt delay, but expose the otherwise unconnected code in the driver in case people want to experiment. See https://www.intel.com/content/dam/support/us/en/documents/network/adapter/pro100/sb/466827_intel_r__dma_coalescing_white_paper_v003.pdf MFC after: 1 week Sponsored by: BBOX.io --- sys/dev/igc/if_igc.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index d964fbe4cf91..da897d636cfe 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -141,6 +141,7 @@ static int igc_msix_link(void *); static void igc_handle_link(void *context); static int igc_set_flowcntl(SYSCTL_HANDLER_ARGS); +static int igc_sysctl_dmac(SYSCTL_HANDLER_ARGS); static int igc_sysctl_eee(SYSCTL_HANDLER_ARGS); static int igc_get_regs(SYSCTL_HANDLER_ARGS); @@ -490,6 +491,12 @@ igc_if_attach_pre(if_ctx_t ctx) CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0, igc_get_rs, "I", "Dump RS indexes"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "dmac", + CTLTYPE_INT | CTLFLAG_RW, adapter, 0, + igc_sysctl_dmac, "I", "DMA Coalesce"); + /* Determine hardware and mac info */ igc_identify_hardware(ctx); @@ -3030,6 +3037,55 @@ igc_set_flowcntl(SYSCTL_HANDLER_ARGS) return (error); } +/* + * Manage DMA Coalesce: + * Control values: + * 0/1 - off/on + * Legal timer values are: + * 250,500,1000-10000 in thousands + */ +static int +igc_sysctl_dmac(SYSCTL_HANDLER_ARGS) +{ + struct igc_adapter *sc = (struct igc_adapter *) arg1; + int error; + + error = sysctl_handle_int(oidp, &sc->dmac, 0, req); + + if ((error) || (req->newptr == NULL)) + return (error); + + switch (sc->dmac) { + case 0: + /* Disabling */ + break; + case 1: /* Just enable and use default */ + sc->dmac = 1000; + break; + case 250: + case 500: + case 1000: + case 2000: + case 3000: + case 4000: + case 5000: + case 6000: + case 7000: + case 8000: + case 9000: + case 10000: + /* Legal values - allow */ + break; + default: + /* Do nothing, illegal value */ + sc->dmac = 0; + return (EINVAL); + } + /* Reinit the interface */ + igc_if_init(sc->ctx); + return (error); +} + /* * Manage Energy Efficient Ethernet: * Control values: