Date: Thu, 21 Jul 2011 14:18:35 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 196502 for review Message-ID: <201107211418.p6LEIZWa088277@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@196502?ac=10 Change 196502 by mjacob@mjacob-sandbox on 2011/07/21 14:17:50 Updates from Alacritech tree. Affected files ... .. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2cam.c#4 edit .. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.c#6 edit .. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.h#7 edit Differences ... ==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2cam.c#4 (text+ko) ==== @@ -435,7 +435,8 @@ return; } - if ((req = mpt2sas_get_request(mpt)) == NULL) { + MPT2SAS_GET_REQUEST(mpt, req); + if (req == NULL) { if (mpt->outofbeer == 0) { mpt->outofbeer = 1; xpt_freeze_simq(mpt->sim, 1); @@ -865,7 +866,7 @@ request_t *req; int error; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { return (ENOMEM); } @@ -908,7 +909,7 @@ request_t *req; int error; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { return (ENOMEM); } ==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.c#6 (text+ko) ==== @@ -502,7 +502,8 @@ mpt2sas_ack_event(mpt2sas_t *mpt, MPI2_EVENT_NOTIFICATION_REPLY *reply) { MPI2_EVENT_ACK_REQUEST *rqs; - request_t *req = mpt2sas_get_request(mpt); + request_t *req; + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { mpt2sas_prt(mpt, MP2PRT_ERR, "%s: Unable to allocate request for Event=%x EventContext=%x\n", __func__, reply->Event, reply->EventContext); mpt->acks_needed = 1; @@ -1077,7 +1078,7 @@ mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: internal task management busy for handle 0x%x- retrying\n", __func__, hdl); return (EBUSY); } - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { mpt2sas_prt(mpt, MP2PRT_ERR, "%s: cannot allocate request\n", __func__); return (ENOBUFS); @@ -1129,7 +1130,7 @@ mpt = dp->mpt; mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: destroy DeviceHandle %x Phy %x active %u\n", __func__, dp->AttachedDevHandle, dp->PhyNum, dp->active); dp->destroy_needed = 0; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { mpt2sas_prt(mpt, MP2PRT_ERR, "%s: cannot allocate request\n", __func__); callout_reset(&dp->actions, 5, mpt2sas_destroy_dev_cb, dp); @@ -1195,7 +1196,7 @@ request_t *req; int error; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { return (ENOMEM); } @@ -1233,7 +1234,7 @@ mpt2sas_free_cfgbuf(mpt, off); return (error); } - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { mpt2sas_free_cfgbuf(mpt, off); return (ENOMEM); @@ -1275,7 +1276,7 @@ mpt2sas_free_cfgbuf(mpt, off); return (error); } - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { mpt2sas_free_cfgbuf(mpt, off); return (ENOMEM); @@ -1305,7 +1306,7 @@ } ptr->ReportDeviceMissingDelay = 3; ptr->IODeviceMissingDelay = 3; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { mpt2sas_free_cfgbuf(mpt, off); return (ENOMEM); @@ -1342,7 +1343,7 @@ if (error) { return (error); } - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { return (ENOMEM); } @@ -1383,7 +1384,7 @@ U8 fis[20]; uint32_t flags; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { return (ENOMEM); } @@ -1588,6 +1589,17 @@ mpt->nreq_allocated--; } +char * +mpt2sas_decode_request(mpt2sas_t *mpt, request_t *req, char *buf, size_t len) +{ + MPI2_REQUEST_HEADER *rqs = MPT2_REQ2RQS(mpt, req); + if (req->func) + snprintf(buf, len, "%p:%u opcode 0x%02x from %s:%u", req, req->serno, rqs->Function, req->func, req->lineno); + else + snprintf(buf, len, "%p:%u opcode 0x%02x", req, req->serno, rqs->Function); + return (buf); +} + request_t * mpt2sas_get_request(mpt2sas_t *mpt) { @@ -1597,6 +1609,7 @@ req->state = REQ_STATE_ALLOCATED; mpt2sas_assign_serno(mpt, req); mpt->nreq_allocated++; + req->func = NULL; } return (req); } @@ -1740,7 +1753,7 @@ request_t *req; int error; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { mpt2sas_prt(mpt, MP2PRT_ERR, "%s: unable to get request\n", __func__); return; @@ -1768,7 +1781,7 @@ MPI2_EVENT_NOTIFICATION_REQUEST *rqs; request_t *req; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { return (ENOMEM); } @@ -2108,7 +2121,7 @@ request_t *req; int error; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { return (ENOMEM); } @@ -2135,7 +2148,7 @@ request_t *req; int error; - req = mpt2sas_get_request(mpt); + MPT2SAS_GET_REQUEST(mpt, req); if (req == NULL) { return (ENOMEM); } @@ -2169,6 +2182,7 @@ uint32_t mselapsed; struct timeval now, save; request_t *req; + char buf[64]; struct topochg *tp; int r; @@ -2189,7 +2203,7 @@ } req->timeout = 0; req->state |= REQ_STATE_TIMEDOUT; - mpt2sas_prt(mpt, MP2PRT_ERR, "request %p:%u timed out\n", req, req->serno); + mpt2sas_prt(mpt, MP2PRT_ERR, "request %s timed out\n", mpt2sas_decode_request(mpt, req, buf, sizeof (buf))); if ((req->state & (REQ_STATE_NEED_CALLBACK|REQ_STATE_NEED_WAKEUP)) == 0 && req->ccb) { mpt2sas_scsi_abort(mpt, req); } ==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.h#7 (text+ko) ==== @@ -215,6 +215,7 @@ #define MPT2_APT_DLMASK 0x00ffff00 /* data length mask */ #define MPT2_APT_DLSHFT 8 /* shift */ +/* other definitions */ #define MPT2SAS_SYNC_ERR(m, e) \ if (e == ETIMEDOUT) { \ mpt2sas_prt(m, MP2PRT_ERR, "%s: request timed out (@line %d)\n", __func__, __LINE__); \ @@ -233,6 +234,13 @@ } \ do { ; } while (0) +#define MPT2SAS_GET_REQUEST(m, r) \ + if ((r = mpt2sas_get_request(m)) != NULL) { \ + r->func = __func__; \ + r->lineno = __LINE__ - 3; \ + } \ + do { ; } while (0) + /****************************** Global Data References ******************************/ extern struct mtx mpt2sas_global_lock; @@ -334,6 +342,8 @@ mpt2sas_dma_chunk_t * chain; /* dma chains */ bus_dmamap_t dmap; /* DMA map for data buffers */ uint32_t timeout; /* timeout in seconds */ + const char * func; + uint32_t lineno; }; /******************* SAS support structures ***********************************/ @@ -701,6 +711,7 @@ void mpt2sas_disable_ints(mpt2sas_t *); int mpt2sas_shutdown(mpt2sas_t *); int mpt2sas_handshake_cmd(mpt2sas_t *, size_t, void *, size_t, void *); +char * mpt2sas_decode_request(mpt2sas_t *, request_t *, char *, size_t); request_t * mpt2sas_get_request(mpt2sas_t *); void mpt2sas_free_request(mpt2sas_t *, request_t *); void mpt2sas_intr(void *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107211418.p6LEIZWa088277>