From 708575bb1e20891b5fece206f4b0890fe73e6068 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sun, 27 Jan 2013 21:49:51 +0800 Subject: [PATCH] igb: Make tx_intr_nsegs and tx_wreg_nsegs nodes aware of multiple TX queues --- sys/dev/netif/igb/if_igb.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/sys/dev/netif/igb/if_igb.c b/sys/dev/netif/igb/if_igb.c index 874993c41c..84e3ad5f14 100644 --- a/sys/dev/netif/igb/if_igb.c +++ b/sys/dev/netif/igb/if_igb.c @@ -142,6 +142,7 @@ static void igb_add_sysctl(struct igb_softc *); static int igb_sysctl_intr_rate(SYSCTL_HANDLER_ARGS); static int igb_sysctl_msix_rate(SYSCTL_HANDLER_ARGS); static int igb_sysctl_tx_intr_nsegs(SYSCTL_HANDLER_ARGS); +static int igb_sysctl_tx_wreg_nsegs(SYSCTL_HANDLER_ARGS); static int igb_sysctl_rx_wreg_nsegs(SYSCTL_HANDLER_ARGS); static void igb_set_ring_inuse(struct igb_softc *, boolean_t); static int igb_get_rxring_inuse(const struct igb_softc *, boolean_t); @@ -1567,9 +1568,9 @@ igb_add_sysctl(struct igb_softc *sc) sc, 0, igb_sysctl_tx_intr_nsegs, "I", "# of segments per TX interrupt"); - SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "tx_wreg_nsegs", CTLFLAG_RW, - &sc->tx_rings[0].wreg_nsegs, 0, + SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), + OID_AUTO, "tx_wreg_nsegs", CTLTYPE_INT | CTLFLAG_RW, + sc, 0, igb_sysctl_tx_wreg_nsegs, "I", "# of segments sent before write to hardware register"); SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), @@ -3555,8 +3556,11 @@ igb_sysctl_tx_intr_nsegs(SYSCTL_HANDLER_ARGS) nsegs >= txr->oact_hi_desc - IGB_MAX_SCATTER) { error = EINVAL; } else { + int i; + error = 0; - txr->intr_nsegs = nsegs; + for (i = 0; i < sc->tx_ring_cnt; ++i) + sc->tx_rings[i].intr_nsegs = nsegs; } ifnet_deserialize_all(ifp); @@ -3584,6 +3588,26 @@ igb_sysctl_rx_wreg_nsegs(SYSCTL_HANDLER_ARGS) return 0; } +static int +igb_sysctl_tx_wreg_nsegs(SYSCTL_HANDLER_ARGS) +{ + struct igb_softc *sc = (void *)arg1; + struct ifnet *ifp = &sc->arpcom.ac_if; + int error, nsegs, i; + + nsegs = sc->tx_rings[0].wreg_nsegs; + error = sysctl_handle_int(oidp, &nsegs, 0, req); + if (error || req->newptr == NULL) + return error; + + ifnet_serialize_all(ifp); + for (i = 0; i < sc->tx_ring_cnt; ++i) + sc->tx_rings[i].wreg_nsegs =nsegs; + ifnet_deserialize_all(ifp); + + return 0; +} + #ifdef IFPOLL_ENABLE static int -- 2.41.0