Rate limit the 'out of chain frame' messages to once per 60 seconds.

Obtained from:	Netflix
MFC after:	3 days
This commit is contained in:
Scott Long 2013-08-09 01:10:33 +00:00
parent d9802deb4e
commit fe8391035a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254117
2 changed files with 8 additions and 2 deletions

View file

@ -123,6 +123,9 @@ typedef union _reply_descriptor {
} u;
}reply_descriptor,address_descriptor;
/* Rate limit chain-fail messages to 1 per minute */
static struct timeval mps_chainfail_interval = { 60, 0 };
/*
* sleep_flag can be either CAN_SLEEP or NO_SLEEP.
* If this function is called from process context, it can sleep
@ -1467,6 +1470,7 @@ mps_attach(struct mps_softc *sc)
mtx_init(&sc->mps_mtx, "MPT2SAS lock", NULL, MTX_DEF);
callout_init_mtx(&sc->periodic, &sc->mps_mtx, 0);
TAILQ_INIT(&sc->event_list);
timevalclear(&sc->lastfail);
if ((error = mps_transition_ready(sc)) != 0) {
mps_printf(sc, "%s failed to transition ready\n", __func__);
@ -2413,8 +2417,9 @@ mps_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
sflags, nsegs - i);
if (error != 0) {
/* Resource shortage, roll back! */
mps_dprint(sc, MPS_INFO, "Out of chain frames, "
"consider increasing hw.mps.max_chains.\n");
if (ratecheck(&sc->lastfail, &mps_chainfail_interval))
mps_dprint(sc, MPS_INFO, "Out of chain frames, "
"consider increasing hw.mps.max_chains.\n");
cm->cm_flags |= MPS_CM_FLAGS_CHAIN_FAILED;
mps_complete_command(sc, cm);
return;

View file

@ -416,6 +416,7 @@ struct mps_softc {
struct mps_column_map DD_column_map[MPS_MAX_DISKS_IN_VOL];
char exclude_ids[80];
struct timeval lastfail;
};
struct mps_config_params {