svn commit: r298103 - head/sys/dev/isp
Alexander Motin
mav at FreeBSD.org
Sat Apr 16 06:36:57 UTC 2016
Author: mav
Date: Sat Apr 16 06:36:56 2016
New Revision: 298103
URL: https://svnweb.freebsd.org/changeset/base/298103
Log:
Simplify memory allocation for NS requests.
Since we no longer need additional buffers for request and response IOCBs,
we can increase receive space by 192 bytes, that is enough for fetching 48
more ports. The new limit is 1020 fabric ports per virtual port.
MFC after: 1 month
Modified:
head/sys/dev/isp/isp.c
Modified: head/sys/dev/isp/isp.c
==============================================================================
--- head/sys/dev/isp/isp.c Sat Apr 16 06:10:47 2016 (r298102)
+++ head/sys/dev/isp/isp.c Sat Apr 16 06:36:56 2016 (r298103)
@@ -3465,19 +3465,14 @@ abort:
*
* Use the GID_FT command to get all Port IDs for FC4 SCSI devices it knows.
*
- * For 2100-23XX cards, we can use the SNS mailbox command to pass simple
- * name server commands to the switch management server via the QLogic f/w.
+ * For 2100-23XX cards, we use the SNS mailbox command to pass simple name
+ * server commands to the switch management server via the QLogic f/w.
*
- * For the 24XX card, we have to use CT-Pass through run via the Execute IOCB
- * mailbox command.
+ * For the 24XX and above card, we use CT Pass-through IOCB.
*/
-#define GIDLEN (ISP_FC_SCRLEN - (3 * QENTRY_LEN))
+#define GIDLEN ISP_FC_SCRLEN
#define NGENT ((GIDLEN - 16) >> 2)
-#define XTXOFF (ISP_FC_SCRLEN - (3 * QENTRY_LEN)) /* CT request */
-#define CTXOFF (ISP_FC_SCRLEN - (2 * QENTRY_LEN)) /* Request IOCB */
-#define ZTXOFF (ISP_FC_SCRLEN - (1 * QENTRY_LEN)) /* Response IOCB */
-
static int
isp_gid_ft_sns(ispsoftc_t *isp, int chan)
{
@@ -3507,16 +3502,16 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan
rq->snscb_mword_div_2 = NGENT;
rq->snscb_fc4_type = FC4_SCSI;
- isp_put_gid_ft_request(isp, rq, (sns_gid_ft_req_t *)&scp[CTXOFF]);
- MEMORYBARRIER(isp, SYNC_SFORDEV, CTXOFF, SNS_GID_FT_REQ_SIZE, chan);
+ isp_put_gid_ft_request(isp, rq, (sns_gid_ft_req_t *)scp);
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE, chan);
MBSINIT(&mbs, MBOX_SEND_SNS, MBLOGALL, 10000000);
mbs.param[0] = MBOX_SEND_SNS;
mbs.param[1] = SNS_GID_FT_REQ_SIZE >> 1;
- mbs.param[2] = DMA_WD1(fcp->isp_scdma + CTXOFF);
- mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF);
- mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF);
- mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF);
+ mbs.param[2] = DMA_WD1(fcp->isp_scdma);
+ mbs.param[3] = DMA_WD0(fcp->isp_scdma);
+ mbs.param[6] = DMA_WD3(fcp->isp_scdma);
+ mbs.param[7] = DMA_WD2(fcp->isp_scdma);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
if (mbs.param[0] == MBOX_INVALID_COMMAND) {
@@ -3555,8 +3550,8 @@ isp_ct_passthru(ispsoftc_t *isp, int cha
pt.ctp_rsp_cnt = 1;
pt.ctp_rsp_bcnt = rsp_bcnt;
pt.ctp_cmd_bcnt = cmd_bcnt;
- pt.ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF);
- pt.ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF);
+ pt.ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma);
+ pt.ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma);
pt.ctp_dataseg[0].ds_count = cmd_bcnt;
pt.ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma);
pt.ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma);
@@ -3626,12 +3621,12 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp,
ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
ct.ct_cmd_resp = SNS_GID_FT;
ct.ct_bcnt_resid = (GIDLEN - 16) >> 2;
- isp_put_ct_hdr(isp, &ct, (ct_hdr_t *) &scp[XTXOFF]);
- rp = (uint32_t *) &scp[XTXOFF + sizeof(ct)];
+ isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
+ rp = (uint32_t *) &scp[sizeof(ct)];
ISP_IOZPUT_32(isp, FC4_SCSI, rp);
if (isp->isp_dblev & ISP_LOGDEBUG1) {
isp_print_bytes(isp, "CT request",
- sizeof(ct) + sizeof(uint32_t), &scp[XTXOFF]);
+ sizeof(ct) + sizeof(uint32_t), scp);
}
if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) {
@@ -4042,9 +4037,9 @@ isp_register_fc4_type_24xx(ispsoftc_t *i
rp.rftid_portid[1] = fcp->isp_portid >> 8;
rp.rftid_portid[2] = fcp->isp_portid;
rp.rftid_fc4types[FC4_SCSI >> 5] = 1 << (FC4_SCSI & 0x1f);
- isp_put_rft_id(isp, &rp, (rft_id_t *)&scp[XTXOFF]);
+ isp_put_rft_id(isp, &rp, (rft_id_t *)scp);
if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "CT request", sizeof(rft_id_t), &scp[XTXOFF]);
+ isp_print_bytes(isp, "CT request", sizeof(rft_id_t), scp);
if (isp_ct_passthru(isp, chan, sizeof(rft_id_t), sizeof(ct_hdr_t))) {
FC_SCRATCH_RELEASE(isp, chan);
@@ -4097,9 +4092,9 @@ isp_register_fc4_features_24xx(ispsoftc_
if (fcp->role & ISP_ROLE_INITIATOR)
rp.rffid_fc4features |= 2;
rp.rffid_fc4type = FC4_SCSI;
- isp_put_rff_id(isp, &rp, (rff_id_t *)&scp[XTXOFF]);
+ isp_put_rff_id(isp, &rp, (rff_id_t *)scp);
if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "CT request", sizeof(rft_id_t), &scp[XTXOFF]);
+ isp_print_bytes(isp, "CT request", sizeof(rft_id_t), scp);
if (isp_ct_passthru(isp, chan, sizeof(rft_id_t), sizeof(ct_hdr_t))) {
FC_SCRATCH_RELEASE(isp, chan);
@@ -4152,20 +4147,20 @@ isp_register_port_name_24xx(ispsoftc_t *
rp.rspnid_length = 0;
len = offsetof(rspn_id_t, rspnid_name);
mtx_lock(&prison0.pr_mtx);
- rp.rspnid_length += sprintf(&scp[XTXOFF + len + rp.rspnid_length],
+ rp.rspnid_length += sprintf(&scp[len + rp.rspnid_length],
"%s", prison0.pr_hostname[0] ? prison0.pr_hostname : "FreeBSD");
mtx_unlock(&prison0.pr_mtx);
- rp.rspnid_length += sprintf(&scp[XTXOFF + len + rp.rspnid_length],
+ rp.rspnid_length += sprintf(&scp[len + rp.rspnid_length],
":%s", device_get_nameunit(isp->isp_dev));
if (chan != 0) {
- rp.rspnid_length += sprintf(&scp[XTXOFF + len +
- rp.rspnid_length], "/%d", chan);
+ rp.rspnid_length += sprintf(&scp[len + rp.rspnid_length],
+ "/%d", chan);
}
len += rp.rspnid_length;
ct->ct_bcnt_resid = (len - sizeof(ct_hdr_t)) >> 2;
- isp_put_rspn_id(isp, &rp, (rspn_id_t *)&scp[XTXOFF]);
+ isp_put_rspn_id(isp, &rp, (rspn_id_t *)scp);
if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "CT request", len, &scp[XTXOFF]);
+ isp_print_bytes(isp, "CT request", len, scp);
if (isp_ct_passthru(isp, chan, len, sizeof(ct_hdr_t))) {
FC_SCRATCH_RELEASE(isp, chan);
@@ -4216,14 +4211,14 @@ isp_register_node_name_24xx(ispsoftc_t *
rp.rsnnnn_length = 0;
len = offsetof(rsnn_nn_t, rsnnnn_name);
mtx_lock(&prison0.pr_mtx);
- rp.rsnnnn_length += sprintf(&scp[XTXOFF + len + rp.rsnnnn_length],
+ rp.rsnnnn_length += sprintf(&scp[len + rp.rsnnnn_length],
"%s", prison0.pr_hostname[0] ? prison0.pr_hostname : "FreeBSD");
mtx_unlock(&prison0.pr_mtx);
len += rp.rsnnnn_length;
ct->ct_bcnt_resid = (len - sizeof(ct_hdr_t)) >> 2;
- isp_put_rsnn_nn(isp, &rp, (rsnn_nn_t *)&scp[XTXOFF]);
+ isp_put_rsnn_nn(isp, &rp, (rsnn_nn_t *)scp);
if (isp->isp_dblev & ISP_LOGDEBUG1)
- isp_print_bytes(isp, "CT request", len, &scp[XTXOFF]);
+ isp_print_bytes(isp, "CT request", len, scp);
if (isp_ct_passthru(isp, chan, len, sizeof(ct_hdr_t))) {
FC_SCRATCH_RELEASE(isp, chan);
More information about the svn-src-all
mailing list