From bf2556cfad12b040393aa6a33ea80a5adb0b51d6 Mon Sep 17 00:00:00 2001 From: luigi Date: Fri, 14 Dec 2001 05:56:35 +0000 Subject: Remove printf's on mbuf/cluster allocation failures. There are now equivalent and less dangerous (rate limited) messages in the mbuf allocation code. MFC after: 3 days --- sys/dev/sf/if_sf.c | 7 +------ sys/dev/sk/if_sk.c | 5 +---- sys/dev/ti/if_ti.c | 7 +------ sys/dev/vr/if_vr.c | 7 +------ sys/pci/if_pcn.c | 7 +------ sys/pci/if_rl.c | 6 +----- sys/pci/if_sf.c | 7 +------ sys/pci/if_sk.c | 5 +---- sys/pci/if_ste.c | 7 +------ sys/pci/if_ti.c | 7 +------ sys/pci/if_tl.c | 7 +------ sys/pci/if_vr.c | 7 +------ sys/pci/if_wb.c | 11 ++--------- sys/pci/if_xl.c | 7 +------ 14 files changed, 15 insertions(+), 82 deletions(-) diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index 487b48f..8ebc2f5b 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -908,16 +908,11 @@ static int sf_newbuf(sc, c, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("sf%d: no memory for rx list -- " - "packet dropped!\n", sc->sf_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("sf%d: no memory for rx list -- " - "packet dropped!\n", sc->sf_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 8604209..5ba23f5 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -672,11 +672,8 @@ static int sk_newbuf(sc_if, c, m) caddr_t *buf = NULL; MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("sk%d: no memory for rx list -- " - "packet dropped!\n", sc_if->sk_unit); + if (m_new == NULL) return(ENOBUFS); - } /* Allocate the jumbo buffer */ buf = sk_jalloc(sc_if); diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 98b9b64..106f065 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -700,16 +700,11 @@ static int ti_newbuf_std(sc, i, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("ti%d: mbuf allocation failed " - "-- packet dropped!\n", sc->ti_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("ti%d: cluster allocation failed " - "-- packet dropped!\n", sc->ti_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index f037294..0956396 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -924,16 +924,11 @@ static int vr_newbuf(sc, c, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("vr%d: no memory for rx list " - "-- packet dropped!\n", sc->vr_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("vr%d: no memory for rx list " - "-- packet dropped!\n", sc->vr_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c index 580f5e9..6a177c6 100644 --- a/sys/pci/if_pcn.c +++ b/sys/pci/if_pcn.c @@ -757,16 +757,11 @@ static int pcn_newbuf(sc, idx, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("pcn%d: no memory for rx list " - "-- packet dropped!\n", sc->pcn_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("pcn%d: no memory for rx list " - "-- packet dropped!\n", sc->pcn_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index bc92a00..980404f 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -1413,16 +1413,12 @@ static int rl_encap(sc, m_head) */ MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("rl%d: no memory for tx list", sc->rl_unit); + if (m_new == NULL) return(1); - } if (m_head->m_pkthdr.len > MHLEN) { MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); - printf("rl%d: no memory for tx list", - sc->rl_unit); return(1); } } diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c index 487b48f..8ebc2f5b 100644 --- a/sys/pci/if_sf.c +++ b/sys/pci/if_sf.c @@ -908,16 +908,11 @@ static int sf_newbuf(sc, c, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("sf%d: no memory for rx list -- " - "packet dropped!\n", sc->sf_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("sf%d: no memory for rx list -- " - "packet dropped!\n", sc->sf_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index 8604209..5ba23f5 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -672,11 +672,8 @@ static int sk_newbuf(sc_if, c, m) caddr_t *buf = NULL; MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("sk%d: no memory for rx list -- " - "packet dropped!\n", sc_if->sk_unit); + if (m_new == NULL) return(ENOBUFS); - } /* Allocate the jumbo buffer */ buf = sk_jalloc(sc_if); diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c index 554b070..4088a60 100644 --- a/sys/pci/if_ste.c +++ b/sys/pci/if_ste.c @@ -1117,15 +1117,10 @@ static int ste_newbuf(sc, c, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("ste%d: no memory for rx list -- " - "packet dropped\n", sc->ste_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("ste%d: no memory for rx list -- " - "packet dropped\n", sc->ste_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 98b9b64..106f065 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -700,16 +700,11 @@ static int ti_newbuf_std(sc, i, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("ti%d: mbuf allocation failed " - "-- packet dropped!\n", sc->ti_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("ti%d: cluster allocation failed " - "-- packet dropped!\n", sc->ti_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c index de4f822..8bc0827 100644 --- a/sys/pci/if_tl.c +++ b/sys/pci/if_tl.c @@ -1439,16 +1439,11 @@ static int tl_newbuf(sc, c) struct mbuf *m_new = NULL; MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("tl%d: no memory for rx list -- packet dropped!\n", - sc->tl_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("tl%d: no memory for rx list -- packet dropped!\n", - sc->tl_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c index f037294..0956396 100644 --- a/sys/pci/if_vr.c +++ b/sys/pci/if_vr.c @@ -924,16 +924,11 @@ static int vr_newbuf(sc, c, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("vr%d: no memory for rx list " - "-- packet dropped!\n", sc->vr_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("vr%d: no memory for rx list " - "-- packet dropped!\n", sc->vr_unit); m_freem(m_new); return(ENOBUFS); } diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c index be60876..cd1d43f 100644 --- a/sys/pci/if_wb.c +++ b/sys/pci/if_wb.c @@ -1092,11 +1092,8 @@ static int wb_newbuf(sc, c, m) if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("wb%d: no memory for rx " - "list -- packet dropped!\n", sc->wb_unit); + if (m_new == NULL) return(ENOBUFS); - } m_new->m_data = c->wb_buf; m_new->m_pkthdr.len = m_new->m_len = WB_BUFBYTES; MEXTADD(m_new, c->wb_buf, WB_BUFBYTES, wb_bfree, NULL, 0, @@ -1448,16 +1445,12 @@ static int wb_encap(sc, c, m_head) struct mbuf *m_new = NULL; MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("wb%d: no memory for tx list", sc->wb_unit); + if (m_new == NULL) return(1); - } if (m_head->m_pkthdr.len > MHLEN) { MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); - printf("wb%d: no memory for tx list", - sc->wb_unit); return(1); } } diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index 7378d83..aa7f4fc 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -1780,16 +1780,11 @@ static int xl_newbuf(sc, c) struct mbuf *m_new = NULL; MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("xl%d: no memory for rx list -- " - "packet dropped!\n", sc->xl_unit); + if (m_new == NULL) return(ENOBUFS); - } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - printf("xl%d: no memory for rx list -- " - "packet dropped!\n", sc->xl_unit); m_freem(m_new); return(ENOBUFS); } -- cgit v1.1