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.
This commit is contained in:
parent
5b9f1319fe
commit
aec846d484
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user