summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2017-03-29 16:04:02 +0000
committermav <mav@FreeBSD.org>2017-03-29 16:04:02 +0000
commit847594d41f2c8d2658eb329aec10394ca0e55a76 (patch)
tree5ad9ea42fb2784ac8df6dc536a9098ede4926fea
parentbae211cf05d1c9749a17e28075db3a17d2b15c55 (diff)
downloadFreeBSD-src-847594d41f2c8d2658eb329aec10394ca0e55a76.zip
FreeBSD-src-847594d41f2c8d2658eb329aec10394ca0e55a76.tar.gz
MFC r315489: Move RQSTYPE_ABTS_RCVD parsing into generic code.
-rw-r--r--sys/dev/isp/isp_freebsd.c64
-rw-r--r--sys/dev/isp/isp_target.c44
2 files changed, 51 insertions, 57 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 80621e3..38e5a4a 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -2601,18 +2601,19 @@ isp_handle_platform_target_tmf(ispsoftc_t *isp, isp_notify_t *notify)
fcportdb_t *lp;
struct ccb_immediate_notify *inot;
inot_private_data_t *ntp = NULL;
+ atio_private_data_t *atp;
lun_id_t lun;
isp_prt(isp, ISP_LOGTDEBUG0, "%s: code 0x%x sid 0x%x tagval 0x%016llx chan %d lun %jx", __func__, notify->nt_ncode,
notify->nt_sid, (unsigned long long) notify->nt_tagval, notify->nt_channel, notify->nt_lun);
- /*
- * NB: This assignment is necessary because of tricky type conversion.
- * XXX: This is tricky and I need to check this. If the lun isn't known
- * XXX: for the task management function, it does not of necessity follow
- * XXX: that it should go up stream to the wildcard listener.
- */
if (notify->nt_lun == LUN_ANY) {
- lun = CAM_LUN_WILDCARD;
+ if (notify->nt_tagval == TAG_ANY) {
+ lun = CAM_LUN_WILDCARD;
+ } else {
+ atp = isp_find_atpd(isp, notify->nt_channel,
+ notify->nt_tagval & 0xffffffff);
+ lun = atp ? atp->lun : CAM_LUN_WILDCARD;
+ }
} else {
lun = notify->nt_lun;
}
@@ -4175,55 +4176,6 @@ changed:
case RQSTYPE_CTIO:
isp_handle_platform_ctio(isp, hp);
break;
- case RQSTYPE_ABTS_RCVD:
- {
- abts_t *abts = (abts_t *)hp;
- isp_notify_t notify, *nt = &notify;
- atio_private_data_t *atp;
- fcportdb_t *lp;
- uint16_t chan;
- uint32_t sid, did;
-
- did = (abts->abts_did_hi << 16) | abts->abts_did_lo;
- sid = (abts->abts_sid_hi << 16) | abts->abts_sid_lo;
- ISP_MEMZERO(nt, sizeof (isp_notify_t));
-
- nt->nt_hba = isp;
- nt->nt_did = did;
- nt->nt_nphdl = abts->abts_nphdl;
- nt->nt_sid = sid;
- isp_find_chan_by_did(isp, did, &chan);
- if (chan == ISP_NOCHAN) {
- nt->nt_tgt = TGT_ANY;
- } else {
- nt->nt_tgt = FCPARAM(isp, chan)->isp_wwpn;
- if (isp_find_pdb_by_handle(isp, chan, abts->abts_nphdl, &lp)) {
- nt->nt_wwn = lp->port_wwn;
- } else {
- nt->nt_wwn = INI_ANY;
- }
- }
- /*
- * Try hard to find the lun for this command.
- */
- atp = isp_find_atpd(isp, chan, abts->abts_rxid_task);
- nt->nt_lun = atp ? atp->lun : LUN_ANY;
- nt->nt_need_ack = 1;
- nt->nt_tagval = abts->abts_rxid_task;
- nt->nt_tagval |= (((uint64_t) abts->abts_rxid_abts) << 32);
- if (abts->abts_rxid_task == ISP24XX_NO_TASK) {
- isp_prt(isp, ISP_LOGTINFO, "[0x%x] ABTS from N-Port handle 0x%x Port 0x%06x has no task id (rx_id 0x%04x ox_id 0x%04x)",
- abts->abts_rxid_abts, abts->abts_nphdl, sid, abts->abts_rx_id, abts->abts_ox_id);
- } else {
- isp_prt(isp, ISP_LOGTINFO, "[0x%x] ABTS from N-Port handle 0x%x Port 0x%06x for task 0x%x (rx_id 0x%04x ox_id 0x%04x)",
- abts->abts_rxid_abts, abts->abts_nphdl, sid, abts->abts_rxid_task, abts->abts_rx_id, abts->abts_ox_id);
- }
- nt->nt_channel = chan;
- nt->nt_ncode = NT_ABORT_TASK;
- nt->nt_lreserved = hp;
- isp_handle_platform_target_tmf(isp, nt);
- break;
- }
}
break;
}
diff --git a/sys/dev/isp/isp_target.c b/sys/dev/isp/isp_target.c
index e2aa2c3..9d1f14c 100644
--- a/sys/dev/isp/isp_target.c
+++ b/sys/dev/isp/isp_target.c
@@ -58,6 +58,7 @@ static const char rqo[] = "%s: Request Queue Overflow";
static void isp_got_msg_fc(ispsoftc_t *, in_fcentry_t *);
static void isp_got_tmf_24xx(ispsoftc_t *, at7_entry_t *);
+static void isp_handle_abts(ispsoftc_t *, abts_t *);
static void isp_handle_atio2(ispsoftc_t *, at2_entry_t *);
static void isp_handle_ctio2(ispsoftc_t *, ct2_entry_t *);
static void isp_handle_ctio7(ispsoftc_t *, ct7_entry_t *);
@@ -361,7 +362,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
case RQSTYPE_ABTS_RCVD:
isp_get_abts(isp, abts, (abts_t *)local);
- isp_async(isp, ISPASYNC_TARGET_ACTION, &local);
+ isp_handle_abts(isp, (abts_t *)local);
break;
case RQSTYPE_ABTS_RSP:
isp_get_abts_rsp(isp, abts_rsp, (abts_rsp_t *)local);
@@ -979,6 +980,47 @@ isp_acknak_abts(ispsoftc_t *isp, void *arg, int errno)
}
static void
+isp_handle_abts(ispsoftc_t *isp, abts_t *abts)
+{
+ isp_notify_t notify, *nt = &notify;
+ fcportdb_t *lp;
+ uint16_t chan;
+ uint32_t sid, did;
+
+ did = (abts->abts_did_hi << 16) | abts->abts_did_lo;
+ sid = (abts->abts_sid_hi << 16) | abts->abts_sid_lo;
+ ISP_MEMZERO(nt, sizeof (isp_notify_t));
+
+ nt->nt_hba = isp;
+ nt->nt_did = did;
+ nt->nt_nphdl = abts->abts_nphdl;
+ nt->nt_sid = sid;
+ isp_find_chan_by_did(isp, did, &chan);
+ if (chan == ISP_NOCHAN) {
+ nt->nt_tgt = TGT_ANY;
+ } else {
+ nt->nt_tgt = FCPARAM(isp, chan)->isp_wwpn;
+ if (isp_find_pdb_by_handle(isp, chan, abts->abts_nphdl, &lp)) {
+ nt->nt_wwn = lp->port_wwn;
+ } else {
+ nt->nt_wwn = INI_ANY;
+ }
+ }
+ nt->nt_lun = LUN_ANY;
+ nt->nt_need_ack = 1;
+ nt->nt_tagval = abts->abts_rxid_task;
+ nt->nt_tagval |= (((uint64_t) abts->abts_rxid_abts) << 32);
+ isp_prt(isp, ISP_LOGTINFO, "[0x%x] ABTS from N-Port handle 0x%x"
+ " Port 0x%06x for task 0x%x (rx_id 0x%04x ox_id 0x%04x)",
+ abts->abts_rxid_abts, abts->abts_nphdl, sid, abts->abts_rxid_task,
+ abts->abts_rx_id, abts->abts_ox_id);
+ nt->nt_channel = chan;
+ nt->nt_ncode = NT_ABORT_TASK;
+ nt->nt_lreserved = abts;
+ isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
+}
+
+static void
isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep)
{
int lun, iid;
OpenPOWER on IntegriCloud