summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2001-11-29 23:47:47 +0000
committerluigi <luigi@FreeBSD.org>2001-11-29 23:47:47 +0000
commitb77de76e8dfae23a836ebb46868c1ff42b3ffa47 (patch)
treeeb10a00b252b07e3e66b908b60899474e4291540 /sys
parent0d492b7392da807d481c89a92c34071fcce33e78 (diff)
downloadFreeBSD-src-b77de76e8dfae23a836ebb46868c1ff42b3ffa47.zip
FreeBSD-src-b77de76e8dfae23a836ebb46868c1ff42b3ffa47.tar.gz
Per jlemon request, reintroduce some printf() when an
mbuf allocation fails, and fix (i hope) a couple of style bugs. I believe these printf() are extremely dangerous because now they can occur on every incoming packet and are not rate limited. They were meant to warn the sysadmin about lack of resources, but now they can become a nice way to panic your system under load. Other drivers (e.g. the fxp driver) have nothing like this. There is a pending discussion on putting this kind of warnings elsewhere, and I hope we can fix this soon.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/dc/if_dc.c11
-rw-r--r--sys/pci/if_dc.c11
-rw-r--r--sys/pci/if_sis.c11
3 files changed, 24 insertions, 9 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index 81cb936..4506fe8 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -2217,7 +2217,7 @@ static int dc_list_tx_init(sc)
cd = &sc->dc_cdata;
ld = sc->dc_ldata;
for (i = 0; i < DC_TX_LIST_CNT; i++) {
- nexti = (i == (DC_TX_LIST_CNT - 1)) ? 0 : i+1 ;
+ nexti = (i == (DC_TX_LIST_CNT - 1)) ? 0 : i+1;
ld->dc_tx_list[i].dc_next = vtophys(&ld->dc_tx_list[nexti]);
cd->dc_tx_chain[i] = NULL;
ld->dc_tx_list[i].dc_data = 0;
@@ -2248,7 +2248,7 @@ static int dc_list_rx_init(sc)
for (i = 0; i < DC_RX_LIST_CNT; i++) {
if (dc_newbuf(sc, i, NULL) == ENOBUFS)
return(ENOBUFS);
- nexti = (i == (DC_RX_LIST_CNT - 1)) ? 0 : i+1 ;
+ nexti = (i == (DC_RX_LIST_CNT - 1)) ? 0 : i+1;
ld->dc_rx_list[i].dc_next = vtophys(&ld->dc_rx_list[nexti]);
}
@@ -2272,11 +2272,16 @@ static int dc_newbuf(sc, i, m)
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL)
+ if (m_new == NULL) {
+ printf("dc%d: no memory for rx list "
+ "-- packet dropped!\n", sc->dc_unit);
return(ENOBUFS);
+ }
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
+ printf("dc%d: no memory for rx list "
+ "-- packet dropped!\n", sc->dc_unit);
m_freem(m_new);
return(ENOBUFS);
}
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c
index 81cb936..4506fe8 100644
--- a/sys/pci/if_dc.c
+++ b/sys/pci/if_dc.c
@@ -2217,7 +2217,7 @@ static int dc_list_tx_init(sc)
cd = &sc->dc_cdata;
ld = sc->dc_ldata;
for (i = 0; i < DC_TX_LIST_CNT; i++) {
- nexti = (i == (DC_TX_LIST_CNT - 1)) ? 0 : i+1 ;
+ nexti = (i == (DC_TX_LIST_CNT - 1)) ? 0 : i+1;
ld->dc_tx_list[i].dc_next = vtophys(&ld->dc_tx_list[nexti]);
cd->dc_tx_chain[i] = NULL;
ld->dc_tx_list[i].dc_data = 0;
@@ -2248,7 +2248,7 @@ static int dc_list_rx_init(sc)
for (i = 0; i < DC_RX_LIST_CNT; i++) {
if (dc_newbuf(sc, i, NULL) == ENOBUFS)
return(ENOBUFS);
- nexti = (i == (DC_RX_LIST_CNT - 1)) ? 0 : i+1 ;
+ nexti = (i == (DC_RX_LIST_CNT - 1)) ? 0 : i+1;
ld->dc_rx_list[i].dc_next = vtophys(&ld->dc_rx_list[nexti]);
}
@@ -2272,11 +2272,16 @@ static int dc_newbuf(sc, i, m)
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL)
+ if (m_new == NULL) {
+ printf("dc%d: no memory for rx list "
+ "-- packet dropped!\n", sc->dc_unit);
return(ENOBUFS);
+ }
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
+ printf("dc%d: no memory for rx list "
+ "-- packet dropped!\n", sc->dc_unit);
m_freem(m_new);
return(ENOBUFS);
}
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index 196e1f9..c4ac140 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -1146,7 +1146,7 @@ static int sis_list_tx_init(sc)
ld = &sc->sis_ldata;
for (i = 0; i < SIS_TX_LIST_CNT; i++) {
- nexti = (i == (SIS_TX_LIST_CNT - 1)) ? 0 : i+1 ;
+ nexti = (i == (SIS_TX_LIST_CNT - 1)) ? 0 : i+1;
ld->sis_tx_list[i].sis_nextdesc =
&ld->sis_tx_list[nexti];
bus_dmamap_load(sc->sis_ldata.sis_tx_tag,
@@ -1184,7 +1184,7 @@ static int sis_list_rx_init(sc)
for (i = 0; i < SIS_RX_LIST_CNT; i++) {
if (sis_newbuf(sc, &ld->sis_rx_list[i], NULL) == ENOBUFS)
return(ENOBUFS);
- nexti = (i == (SIS_RX_LIST_CNT - 1)) ? 0 : i+1 ;
+ nexti = (i == (SIS_RX_LIST_CNT - 1)) ? 0 : i+1;
ld->sis_rx_list[i].sis_nextdesc =
&ld->sis_rx_list[nexti];
bus_dmamap_load(sc->sis_ldata.sis_rx_tag,
@@ -1217,11 +1217,16 @@ static int sis_newbuf(sc, c, m)
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL)
+ if (m_new == NULL) {
+ printf("sis%d: no memory for rx list "
+ "-- packet dropped!\n", sc->sis_unit);
return(ENOBUFS);
+ }
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
+ printf("sis%d: no memory for rx list "
+ "-- packet dropped!\n", sc->sis_unit);
m_freem(m_new);
return(ENOBUFS);
}
OpenPOWER on IntegriCloud