Date: Tue, 30 Oct 2012 03:00:01 GMT From: "Steven Hartland" <killing@multiplay.co.uk> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/173201: Missing / broken ixgbe sysctl' s and tunables (patch included) Message-ID: <201210300300.q9U301P8021960@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/173201; it has been noted by GNATS. From: "Steven Hartland" <killing@multiplay.co.uk> To: <bug-followup@freebsd.org> Cc: Subject: Re: kern/173201: Missing / broken ixgbe sysctl's and tunables (patch included) Date: Tue, 30 Oct 2012 02:55:48 -0000 This is a multi-part message in MIME format. ------=_NextPart_000_0A1A_01CDB64A.10BBCA30 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit Here's the patch ================================================ This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337 or return the E.mail to postmaster@multiplay.co.uk. ------=_NextPart_000_0A1A_01CDB64A.10BBCA30 Content-Type: text/plain; format=flowed; name="ixgbe-sysctl.txt"; reply-type=original Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ixgbe-sysctl.txt" Added sysctl's for ixgbe all tunables=0A= =0A= Wired up hw.ixgbe.flow_control (was never used)=0A= =0A= Added hw.ixgbe.advertise_speed which allows /boot/loader.conf to = configure=0A= advertised speed as sysctl.conf is too late for driver changes.=0A= =0A= Made enable_aim device independent based on hw.ixgbe.enable_aim default.=0A= --- sys/dev/ixgbe/ixgbe.h.orig 2012-10-30 00:58:21.000000000 +0000=0A= +++ sys/dev/ixgbe/ixgbe.h 2012-10-30 01:00:52.000000000 +0000=0A= @@ -392,6 +392,7 @@=0A= u32 optics;=0A= u32 fc; /* local flow ctrl setting */=0A= int advertise; /* link speeds */=0A= + bool enable_aim; /* adaptive interrupt moderation */=0A= bool link_active;=0A= u16 max_frame_size;=0A= u16 num_segs;=0A= --- sys/dev/ixgbe/ixgbe.c.orig 2012-10-30 00:22:47.000000000 +0000=0A= +++ sys/dev/ixgbe/ixgbe.c 2012-10-30 02:15:48.097287073 +0000=0A= @@ -153,8 +153,10 @@=0A= static void ixgbe_update_link_status(struct adapter *);=0A= static void ixgbe_refresh_mbufs(struct rx_ring *, int);=0A= static int ixgbe_xmit(struct tx_ring *, struct mbuf **);=0A= -static int ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS);=0A= -static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS);=0A= +static int ixgbe_set_flowcntl_sysctl(SYSCTL_HANDLER_ARGS);=0A= +static int ixgbe_set_flowcntl(struct adapter *);=0A= +static int ixgbe_set_advertise_sysctl(SYSCTL_HANDLER_ARGS);=0A= +static int ixgbe_set_advertise(struct adapter *);=0A= static int ixgbe_set_thermal_test(SYSCTL_HANDLER_ARGS);=0A= static int ixgbe_dma_malloc(struct adapter *, bus_size_t,=0A= struct ixgbe_dma_alloc *, int);=0A= @@ -223,28 +225,45 @@=0A= MODULE_DEPEND(ixgbe, ether, 1, 1, 1);=0A= =0A= /*=0A= -** TUNEABLE PARAMETERS:=0A= -*/=0A= + * TUNEABLE PARAMETERS:=0A= + */=0A= +static SYSCTL_NODE(_hw, OID_AUTO, ixgbe, CTLFLAG_RD, 0, "IXGBE driver = parameters");=0A= =0A= /*=0A= -** AIM: Adaptive Interrupt Moderation=0A= -** which means that the interrupt rate=0A= -** is varied over time based on the=0A= -** traffic for that interrupt vector=0A= -*/=0A= + * AIM: Adaptive Interrupt Moderation=0A= + * which means that the interrupt rate=0A= + * is varied over time based on the=0A= + * traffic for that interrupt vector=0A= + */=0A= static int ixgbe_enable_aim =3D TRUE;=0A= TUNABLE_INT("hw.ixgbe.enable_aim", &ixgbe_enable_aim);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, enable_aim, CTLFLAG_RDTUN,=0A= + &ixgbe_enable_aim, 0, "Enable adaptive interrupt moderation");=0A= =0A= static int ixgbe_max_interrupt_rate =3D (8000000 / IXGBE_LOW_LATENCY);=0A= TUNABLE_INT("hw.ixgbe.max_interrupt_rate", &ixgbe_max_interrupt_rate);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, max_interrupt_rate, CTLFLAG_RDTUN,=0A= + &ixgbe_max_interrupt_rate, 0, "Maximum interrupt rate used in AIM");=0A= +=0A= =0A= /* How many packets rxeof tries to clean at a time */=0A= static int ixgbe_rx_process_limit =3D 128;=0A= TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN,=0A= + &ixgbe_rx_process_limit, 0, "Maximum number of received packets to = process"=0A= + " at a time, -1 means unlimited");=0A= =0A= /* Flow control setting, default to full */=0A= static int ixgbe_flow_control =3D ixgbe_fc_full;=0A= TUNABLE_INT("hw.ixgbe.flow_control", &ixgbe_flow_control);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, flow_control, CTLFLAG_RDTUN,=0A= + &ixgbe_flow_control, 0, "Default flow control used for all = adapters");=0A= +=0A= +/* Advertise Speed, default to 0 (10G) */=0A= +static int ixgbe_advertise_speed =3D 0;=0A= +TUNABLE_INT("hw.ixgbe.advertise_speed", &ixgbe_advertise_speed);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, advertise_speed, CTLFLAG_RDTUN,=0A= + &ixgbe_advertise_speed, 0, "Default advertised speed for all = adapters");=0A= =0A= /*=0A= ** Smart speed setting, default to on=0A= @@ -261,6 +280,8 @@=0A= */=0A= static int ixgbe_enable_msix =3D 1;=0A= TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, enable_msix, CTLFLAG_RDTUN, = &ixgbe_enable_msix,=0A= + 0, "Enable/disble MSIX for ixgbe adapters");=0A= =0A= /*=0A= * Header split: this causes the hardware to DMA=0A= @@ -270,6 +291,8 @@=0A= */=0A= static int ixgbe_header_split =3D FALSE;=0A= TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe_header_split);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, hdr_split, CTLFLAG_RDTUN, = &ixgbe_header_split,=0A= + 0, "Enable receive mbuf header split");=0A= =0A= /*=0A= * Number of Queues, can be set to 0,=0A= @@ -279,6 +302,8 @@=0A= */=0A= static int ixgbe_num_queues =3D 0;=0A= TUNABLE_INT("hw.ixgbe.num_queues", &ixgbe_num_queues);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, num_queues, CTLFLAG_RDTUN, = &ixgbe_num_queues, 0,=0A= + "Number of queues to configure, 0 indicates autoconfigure");=0A= =0A= /*=0A= ** Number of TX descriptors per ring,=0A= @@ -287,10 +312,14 @@=0A= */=0A= static int ixgbe_txd =3D PERFORM_TXD;=0A= TUNABLE_INT("hw.ixgbe.txd", &ixgbe_txd);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, txd, CTLFLAG_RDTUN, &ixgbe_txd, 0,=0A= + "Number of receive descriptors per queue");=0A= =0A= /* Number of RX descriptors per ring */=0A= static int ixgbe_rxd =3D PERFORM_RXD;=0A= TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd);=0A= +SYSCTL_INT(_hw_ixgbe, OID_AUTO, rxd, CTLFLAG_RDTUN, &ixgbe_rxd, 0,=0A= + "Number of transmit descriptors per queue");=0A= =0A= /* Keep running tab on them for sanity check */=0A= static int ixgbe_total_ports;=0A= @@ -402,22 +431,29 @@=0A= /* Core Lock Init*/=0A= IXGBE_CORE_LOCK_INIT(adapter, device_get_nameunit(dev));=0A= =0A= + /* hw.ixgbe defaults init */=0A= + adapter->advertise =3D ixgbe_advertise_speed;=0A= + adapter->fc =3D ixgbe_flow_control;=0A= + adapter->enable_aim =3D ixgbe_enable_aim;=0A= + ixgbe_set_advertise(adapter);=0A= + ixgbe_set_flowcntl(adapter);=0A= +=0A= /* SYSCTL APIs */=0A= =0A= SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),=0A= SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),=0A= OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW,=0A= - adapter, 0, ixgbe_set_flowcntl, "I", "Flow Control");=0A= + adapter, 0, ixgbe_set_flowcntl_sysctl, "I", "Flow Control");=0A= =0A= SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),=0A= SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),=0A= OID_AUTO, "advertise_gig", CTLTYPE_INT | CTLFLAG_RW,=0A= - adapter, 0, ixgbe_set_advertise, "I", "1G Link");=0A= + adapter, 0, ixgbe_set_advertise_sysctl, "I", "1G Link");=0A= =0A= SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),=0A= SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),=0A= OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW,=0A= - &ixgbe_enable_aim, 1, "Interrupt Moderation");=0A= + &adapter->enable_aim, 1, "Interrupt Moderation");=0A= =0A= /*=0A= ** Allow a kind of speed control by forcing the autoneg=0A= @@ -427,7 +463,7 @@=0A= SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),=0A= SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),=0A= OID_AUTO, "advertise_speed", CTLTYPE_INT | CTLFLAG_RW,=0A= - adapter, 0, ixgbe_set_advertise, "I", "Link Speed");=0A= + adapter, 0, ixgbe_set_advertise_sysctl, "I", "Link Speed");=0A= =0A= SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),=0A= SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),=0A= @@ -1426,7 +1462,7 @@=0A= =0A= /* Do AIM now? */=0A= =0A= - if (ixgbe_enable_aim =3D=3D FALSE)=0A= + if (adapter->enable_aim =3D=3D FALSE)=0A= goto no_calc;=0A= /*=0A= ** Do Adaptive Interrupt Moderation:=0A= @@ -5409,7 +5445,7 @@=0A= ** 3 - full=0A= */=0A= static int=0A= -ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS)=0A= +ixgbe_set_flowcntl_sysctl(SYSCTL_HANDLER_ARGS)=0A= {=0A= int error, last;=0A= struct adapter *adapter =3D (struct adapter *) arg1;=0A= @@ -5423,6 +5459,13 @@=0A= if (adapter->fc =3D=3D last)=0A= return (0);=0A= =0A= + return ixgbe_set_flowcntl(adapter);=0A= +}=0A= +=0A= +static int=0A= +ixgbe_set_flowcntl(struct adapter *adapter)=0A= +{=0A= +=0A= switch (adapter->fc) {=0A= case ixgbe_fc_rx_pause:=0A= case ixgbe_fc_tx_pause:=0A= @@ -5435,7 +5478,7 @@=0A= }=0A= =0A= ixgbe_fc_enable(&adapter->hw, 0);=0A= - return error;=0A= + return 0;=0A= }=0A= =0A= static void=0A= @@ -5455,24 +5498,32 @@=0A= ** 2 - advertise 100Mb=0A= */=0A= static int=0A= -ixgbe_set_advertise(SYSCTL_HANDLER_ARGS)=0A= +ixgbe_set_advertise_sysctl(SYSCTL_HANDLER_ARGS)=0A= {=0A= int error =3D 0;=0A= struct adapter *adapter;=0A= - device_t dev;=0A= - struct ixgbe_hw *hw;=0A= - ixgbe_link_speed speed, last;=0A= =0A= adapter =3D (struct adapter *) arg1;=0A= - dev =3D adapter->dev;=0A= - hw =3D &adapter->hw;=0A= - last =3D hw->phy.autoneg_advertised;=0A= =0A= error =3D sysctl_handle_int(oidp, &adapter->advertise, 0, req);=0A= -=0A= if ((error) || (adapter->advertise =3D=3D -1))=0A= return (error);=0A= =0A= + return ixgbe_set_advertise(adapter);=0A= +}=0A= +=0A= +static int=0A= +ixgbe_set_advertise(struct adapter *adapter)=0A= +{=0A= + int error =3D 0;=0A= + device_t dev;=0A= + struct ixgbe_hw *hw;=0A= + ixgbe_link_speed speed, last;=0A= +=0A= + hw =3D &adapter->hw;=0A= + dev =3D adapter->dev;=0A= + last =3D hw->phy.autoneg_advertised;=0A= +=0A= if (!((hw->phy.media_type =3D=3D ixgbe_media_type_copper) ||=0A= (hw->phy.multispeed_fiber)))=0A= return (error);=0A= ------=_NextPart_000_0A1A_01CDB64A.10BBCA30--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210300300.q9U301P8021960>