From aa5acc483c0b0938d52f4204f3801db5b80a63f7 Mon Sep 17 00:00:00 2001 From: harti Date: Wed, 29 Oct 2003 15:07:10 +0000 Subject: [PATCH] Make the maximum number of pages for external mbufs configurable in the kernel environment and accessible as a RO sysctl. Explain that the HE155 will not work in 64-bit/66MHz slots, but may work in 64-bit/33MHz slots. --- share/man/man4/hatm.4 | 8 ++++++-- sys/dev/hatm/if_hatm.c | 6 +++++- sys/dev/hatm/if_hatm_intr.c | 2 +- sys/dev/hatm/if_hatmvar.h | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/share/man/man4/hatm.4 b/share/man/man4/hatm.4 index afe1f2a46f4..d9266c28452 100644 --- a/share/man/man4/hatm.4 +++ b/share/man/man4/hatm.4 @@ -201,11 +201,15 @@ Maximum number of active TPDs per connection. This controls the maximum number of outstanding packet chunks per connection and thus the maximum delay packets can have because of queueing on the adapter. If set to 0, a connection can eat up all available TPDs. +.It Cm hw.hatmN.mbuf_max_pages +Maximum number of memory pages allocated to small external mbufs. +This must not be zero and not larger than 65536. .El .Sh CAVEATS When putting a HE155 into a 64-bit 66MHz PCI slot the machine may hang. -This occures very early in the POST so that even the display does not -turn on. HE622 cards work just fine in 64-bit slots. +This occures very early in the POST so that even the display does not turn on. +The HE155 runs only in 33MHz slots (either 32 or 64-bit). +HE622 cards work just fine in 64-bit slots. .Pp The driver may not work with bounce buffer, because of .Fn bus_dma_sync diff --git a/sys/dev/hatm/if_hatm.c b/sys/dev/hatm/if_hatm.c index 24a048831bd..d2c1222e21c 100644 --- a/sys/dev/hatm/if_hatm.c +++ b/sys/dev/hatm/if_hatm.c @@ -329,7 +329,7 @@ static void hatm_init_smbufs(struct hatm_softc *sc) { sc->mbuf_pages = malloc(sizeof(sc->mbuf_pages[0]) * - HE_CONFIG_MAX_MBUF_PAGES, M_DEVBUF, M_WAITOK); + sc->mbuf_max_pages, M_DEVBUF, M_WAITOK); sc->mbuf_npages = 0; } @@ -1388,6 +1388,10 @@ hatm_configure(struct hatm_softc *sc) kenv_getuint(sc, "tpdmax", &sc->max_tpd, HE_CONFIG_TPD_MAXCC, 0); + /* external mbuf pages */ + kenv_getuint(sc, "max_mbuf_pages", &sc->mbuf_max_pages, + HE_CONFIG_MAX_MBUF_PAGES, 0); + return (0); } diff --git a/sys/dev/hatm/if_hatm_intr.c b/sys/dev/hatm/if_hatm_intr.c index b359ecbc3ad..088eef408d0 100644 --- a/sys/dev/hatm/if_hatm_intr.c +++ b/sys/dev/hatm/if_hatm_intr.c @@ -175,7 +175,7 @@ hatm_mbuf_page_alloc(struct hatm_softc *sc, u_int group) int err; u_int i; - if (sc->mbuf_npages == HE_CONFIG_MAX_MBUF_PAGES) + if (sc->mbuf_npages == sc->mbuf_max_pages)) return; if ((pg = malloc(MBUF_ALLOC_SIZE, M_DEVBUF, M_NOWAIT)) == NULL) return; diff --git a/sys/dev/hatm/if_hatmvar.h b/sys/dev/hatm/if_hatmvar.h index 2f4bfc26fbb..ed1566ac3ed 100644 --- a/sys/dev/hatm/if_hatmvar.h +++ b/sys/dev/hatm/if_hatmvar.h @@ -422,6 +422,7 @@ struct hatm_softc { bus_dma_tag_t mbuf_tag; struct mbuf_page **mbuf_pages; u_int mbuf_npages; + u_int mbuf_max_pages; struct mbufx_free *mbuf_list[2]; /* mbuf cluster tracking and mapping for group 0 */ -- 2.45.2