From owner-svn-src-all@freebsd.org Wed Mar 29 15:45:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8BE7D20760; Wed, 29 Mar 2017 15:45:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66FE63A7F; Wed, 29 Mar 2017 15:45:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2TFj4mw046361; Wed, 29 Mar 2017 15:45:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2TFj4Ow046359; Wed, 29 Mar 2017 15:45:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703291545.v2TFj4Ow046359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 29 Mar 2017 15:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r316149 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Mar 2017 15:45:05 -0000 Author: mav Date: Wed Mar 29 15:45:04 2017 New Revision: 316149 URL: https://svnweb.freebsd.org/changeset/base/316149 Log: MFC r315478: Do some notify acks cleanup. ISPASYNC_TARGET_NOTIFY_ACK makes no sense without argument. Modified: stable/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_target.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Wed Mar 29 15:44:22 2017 (r316148) +++ stable/11/sys/dev/isp/isp_freebsd.c Wed Mar 29 15:45:04 2017 (r316149) @@ -2701,7 +2701,7 @@ isp_handle_platform_target_tmf(ispsoftc_ xpt_done((union ccb *)inot); return; bad: - if (notify->nt_need_ack && notify->nt_lreserved) { + if (notify->nt_need_ack) { if (((isphdr_t *)notify->nt_lreserved)->rqs_entry_type == RQSTYPE_ABTS_RCVD) { if (isp_acknak_abts(isp, notify->nt_lreserved, ENOMEM)) { isp_prt(isp, ISP_LOGWARN, "you lose- unable to send an ACKNAK"); @@ -3215,7 +3215,10 @@ isp_abort_inot(ispsoftc_t *isp, union cc /* Search for the INOT among running. */ ntp = isp_find_ntpd(isp, XS_CHANNEL(accb), accb->cin1.tag_id, accb->cin1.seq_id); if (ntp != NULL) { - isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, ntp->data); + if (ntp->nt.nt_need_ack) { + isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, + ntp->nt.nt_lreserved); + } isp_put_ntpd(isp, XS_CHANNEL(accb), ntp); ccb->ccb_h.status = CAM_REQ_CMP; } else { @@ -4143,12 +4146,8 @@ changed: isp_tna_t *tp = malloc(sizeof (*tp), M_DEVBUF, M_NOWAIT); if (tp) { tp->isp = isp; - if (inot) { - memcpy(tp->data, inot, sizeof (tp->data)); - tp->not = tp->data; - } else { - tp->not = NULL; - } + memcpy(tp->data, inot, sizeof (tp->data)); + tp->not = tp->data; callout_init_mtx(&tp->timer, &isp->isp_lock, 0); callout_reset(&tp->timer, 5, isp_refire_notify_ack, tp); Modified: stable/11/sys/dev/isp/isp_target.c ============================================================================== --- stable/11/sys/dev/isp/isp_target.c Wed Mar 29 15:44:22 2017 (r316148) +++ stable/11/sys/dev/isp/isp_target.c Wed Mar 29 15:45:04 2017 (r316149) @@ -689,9 +689,6 @@ isp_target_async(ispsoftc_t *isp, int bu } default: isp_prt(isp, ISP_LOGERR, "%s: unknown event 0x%x", __func__, event); - if (isp->isp_state == ISP_RUNSTATE) { - isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, NULL); - } break; } } @@ -838,7 +835,7 @@ isp_notify_ack(ispsoftc_t *isp, void *ar /* * This is in case a Task Management Function ends up here. */ - if (IS_24XX(isp) && arg != NULL && (((isphdr_t *)arg)->rqs_entry_type == RQSTYPE_ATIO)) { + if (IS_24XX(isp) && ((isphdr_t *)arg)->rqs_entry_type == RQSTYPE_ATIO) { at7_entry_t *aep = arg; return (isp_endcmd(isp, aep, NIL_HANDLE, 0, 0, 0)); } @@ -852,70 +849,68 @@ isp_notify_ack(ispsoftc_t *isp, void *ar ISP_MEMZERO(storage, QENTRY_LEN); if (IS_24XX(isp)) { + in_fcentry_24xx_t *in = arg; na_fcentry_24xx_t *na = (na_fcentry_24xx_t *) storage; + na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; na->na_header.rqs_entry_count = 1; - if (arg) { - in_fcentry_24xx_t *in = arg; - na->na_nphdl = in->in_nphdl; - na->na_flags = in->in_flags; - na->na_status = in->in_status; - na->na_status_subcode = in->in_status_subcode; - na->na_fwhandle = in->in_fwhandle; - na->na_rxid = in->in_rxid; - na->na_oxid = in->in_oxid; - na->na_vpidx = in->in_vpidx; - if (in->in_status == IN24XX_SRR_RCVD) { - na->na_srr_rxid = in->in_srr_rxid; - na->na_srr_reloff_hi = in->in_srr_reloff_hi; - na->na_srr_reloff_lo = in->in_srr_reloff_lo; - na->na_srr_iu = in->in_srr_iu; - /* - * Whether we're accepting the SRR or rejecting - * it is determined by looking at the in_reserved - * field in the original notify structure. - */ - if (in->in_reserved) { - na->na_srr_flags = 1; - na->na_srr_reject_vunique = 0; - na->na_srr_reject_code = 9; /* unable to perform this command at this time */ - na->na_srr_reject_explanation = 0x2a; /* unable to supply the requested data */ - } + na->na_nphdl = in->in_nphdl; + na->na_flags = in->in_flags; + na->na_status = in->in_status; + na->na_status_subcode = in->in_status_subcode; + na->na_fwhandle = in->in_fwhandle; + na->na_rxid = in->in_rxid; + na->na_oxid = in->in_oxid; + na->na_vpidx = in->in_vpidx; + if (in->in_status == IN24XX_SRR_RCVD) { + na->na_srr_rxid = in->in_srr_rxid; + na->na_srr_reloff_hi = in->in_srr_reloff_hi; + na->na_srr_reloff_lo = in->in_srr_reloff_lo; + na->na_srr_iu = in->in_srr_iu; + /* + * Whether we're accepting the SRR or rejecting + * it is determined by looking at the in_reserved + * field in the original notify structure. + */ + if (in->in_reserved) { + na->na_srr_flags = 1; + na->na_srr_reject_vunique = 0; + /* Unable to perform this command at this time. */ + na->na_srr_reject_code = 9; + /* Unable to supply the requested data. */ + na->na_srr_reject_explanation = 0x2a; } } isp_put_notify_24xx_ack(isp, na, (na_fcentry_24xx_t *)outp); } else { + in_fcentry_t *in = arg; na_fcentry_t *na = (na_fcentry_t *) storage; - int iid = 0; + int iid; - if (arg) { - in_fcentry_t *inp = arg; - ISP_MEMCPY(storage, arg, sizeof (isphdr_t)); - if (ISP_CAP_2KLOGIN(isp)) { - ((na_fcentry_e_t *)na)->na_iid = ((in_fcentry_e_t *)inp)->in_iid; - iid = ((na_fcentry_e_t *)na)->na_iid; - } else { - na->na_iid = inp->in_iid; - iid = na->na_iid; - } - na->na_task_flags = inp->in_task_flags & TASK_FLAGS_RESERVED_MASK; - na->na_seqid = inp->in_seqid; - na->na_status = inp->in_status; - na->na_flags = NAFC_RCOUNT; - if (inp->in_status == IN_RESET) { - na->na_flags = NAFC_RST_CLRD; /* We do not modify resource counts for LIP resets */ - } - if (inp->in_status == IN_MSG_RECEIVED) { - na->na_flags |= NAFC_TVALID; - na->na_response = 0; /* XXX SUCCEEDED XXX */ - } + ISP_MEMCPY(storage, arg, sizeof (isphdr_t)); + if (ISP_CAP_2KLOGIN(isp)) { + iid = ((in_fcentry_e_t *)in)->in_iid; + ((na_fcentry_e_t *)na)->na_iid = iid; } else { + iid = in->in_iid; + na->na_iid = iid; + } + na->na_task_flags = in->in_task_flags & TASK_FLAGS_RESERVED_MASK; + na->na_seqid = in->in_seqid; + na->na_status = in->in_status; + na->na_flags = NAFC_RCOUNT; + /* We do not modify resource counts for LIP resets */ + if (in->in_status == IN_RESET) na->na_flags = NAFC_RST_CLRD; + if (in->in_status == IN_MSG_RECEIVED) { + na->na_flags |= NAFC_TVALID; + na->na_response = 0; /* XXX SUCCEEDED XXX */ } na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; na->na_header.rqs_entry_count = 1; if (ISP_CAP_2KLOGIN(isp)) { - isp_put_notify_ack_fc_e(isp, (na_fcentry_e_t *) na, (na_fcentry_e_t *)outp); + isp_put_notify_ack_fc_e(isp, (na_fcentry_e_t *)na, + (na_fcentry_e_t *)outp); } else { isp_put_notify_ack_fc(isp, na, (na_fcentry_t *)outp); } @@ -1415,27 +1410,28 @@ isp_handle_24xx_inotify(ispsoftc_t *isp, hichan = chan + 1; } isp_prt(isp, ISP_LOGTDEBUG1, "%s: Immediate Notify Channels %d..%d status=0x%x seqid=0x%x", __func__, lochan, hichan-1, inot_24xx->in_status, inot_24xx->in_rxid); - for (chan = lochan; chan < hichan; chan++) { - if (FCPARAM(isp, chan)->role == ISP_ROLE_NONE) - continue; - switch (inot_24xx->in_status) { - case IN24XX_LIP_RESET: - case IN24XX_LINK_RESET: - case IN24XX_PORT_LOGOUT: - case IN24XX_PORT_CHANGED: - case IN24XX_LINK_FAILED: - case IN24XX_SRR_RCVD: - case IN24XX_ELS_RCVD: - inot_24xx->in_reserved = 0; /* clear this for later usage */ + switch (inot_24xx->in_status) { + case IN24XX_LIP_RESET: + case IN24XX_LINK_RESET: + case IN24XX_PORT_LOGOUT: + case IN24XX_PORT_CHANGED: + case IN24XX_LINK_FAILED: + case IN24XX_SRR_RCVD: + case IN24XX_ELS_RCVD: + for (chan = lochan; chan < hichan; chan++) { + if (FCPARAM(isp, chan)->role == ISP_ROLE_NONE) + continue; + inot_24xx->in_reserved = 0; /* clear this for later usage */ inot_24xx->in_vpidx = chan; isp_async(isp, ISPASYNC_TARGET_ACTION, inot_24xx); - break; - default: - isp_prt(isp, ISP_LOGINFO, "%s: unhandled status (0x%x) for chan %d", __func__, inot_24xx->in_status, chan); - isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot_24xx); - break; } + inot_24xx->in_vpidx = ochan; + break; + default: + isp_prt(isp, ISP_LOGINFO, "%s: unhandled status (0x%x) for chan %d", + __func__, inot_24xx->in_status, chan); + isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot_24xx); + break; } - inot_24xx->in_vpidx = ochan; } #endif