From owner-svn-src-stable@freebsd.org Tue Jun 9 02:00:36 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 998CB34351E; Tue, 9 Jun 2020 02:00:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gtch3bX1z4C9m; Tue, 9 Jun 2020 02:00:36 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7687EE1B2; Tue, 9 Jun 2020 02:00:36 +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 05920aXS056078; Tue, 9 Jun 2020 02:00:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05920ahS056077; Tue, 9 Jun 2020 02:00:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202006090200.05920ahS056077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 9 Jun 2020 02:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r361950 - stable/12/sys/cam/ctl X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/ctl X-SVN-Commit-Revision: 361950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2020 02:00:36 -0000 Author: mav Date: Tue Jun 9 02:00:36 2020 New Revision: 361950 URL: https://svnweb.freebsd.org/changeset/base/361950 Log: MFC r361609: Remove PDU_TOTAL_TRANSFER_LEN() macro. I don't see a point to copy io->scsiio.kern_total_len into the request PDU private field. The io is going to stay with us till the end, and kern_total_len field is not changed after being first initialized. Modified: stable/12/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/12/sys/cam/ctl/ctl_frontend_iscsi.c Tue Jun 9 01:06:45 2020 (r361949) +++ stable/12/sys/cam/ctl/ctl_frontend_iscsi.c Tue Jun 9 02:00:36 2020 (r361950) @@ -144,7 +144,6 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxtags, CTL #define CONN_SESSION(X) ((struct cfiscsi_session *)(X)->ic_prv0) #define PDU_SESSION(X) CONN_SESSION((X)->ip_conn) #define PDU_EXPDATASN(X) (X)->ip_prv0 -#define PDU_TOTAL_TRANSFER_LEN(X) (X)->ip_prv1 #define PDU_R2TSN(X) (X)->ip_prv2 static int cfiscsi_init(void); @@ -2446,13 +2445,6 @@ cfiscsi_datamove_in(union ctl_io *io) } /* - * This is the total amount of data to be transferred within the current - * SCSI command. We need to record it so that we can properly report - * underflow/underflow. - */ - PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; - - /* * This is the offset within the current SCSI command; for the first * call to cfiscsi_datamove() it will be 0, and for subsequent ones * it will be the sum of lengths of previous ones. @@ -2611,17 +2603,17 @@ cfiscsi_datamove_in(union ctl_io *io) bhsdi->bhsdi_flags |= BHSDI_FLAGS_F; if (io->io_hdr.status == CTL_SUCCESS) { bhsdi->bhsdi_flags |= BHSDI_FLAGS_S; - if (PDU_TOTAL_TRANSFER_LEN(request) < + if (io->scsiio.kern_total_len < ntohl(bhssc->bhssc_expected_data_transfer_length)) { bhsdi->bhsdi_flags |= BHSSR_FLAGS_RESIDUAL_UNDERFLOW; bhsdi->bhsdi_residual_count = htonl(ntohl(bhssc->bhssc_expected_data_transfer_length) - - PDU_TOTAL_TRANSFER_LEN(request)); - } else if (PDU_TOTAL_TRANSFER_LEN(request) > + io->scsiio.kern_total_len); + } else if (io->scsiio.kern_total_len > ntohl(bhssc->bhssc_expected_data_transfer_length)) { bhsdi->bhsdi_flags |= BHSSR_FLAGS_RESIDUAL_OVERFLOW; bhsdi->bhsdi_residual_count = - htonl(PDU_TOTAL_TRANSFER_LEN(request) - + htonl(io->scsiio.kern_total_len - ntohl(bhssc->bhssc_expected_data_transfer_length)); } bhsdi->bhsdi_status = io->scsiio.scsi_status; @@ -2657,12 +2649,6 @@ cfiscsi_datamove_out(union ctl_io *io) ("bhssc->bhssc_opcode != ISCSI_BHS_OPCODE_SCSI_COMMAND")); /* - * We need to record it so that we can properly report - * underflow/underflow. - */ - PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; - - /* * Complete write underflow. Not a single byte to read. Return. */ expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); @@ -2851,19 +2837,18 @@ cfiscsi_scsi_command_done(union ctl_io *io) * XXX: We don't deal with bidirectional under/overflows; * does anything actually support those? */ - if (PDU_TOTAL_TRANSFER_LEN(request) < + if (io->scsiio.kern_total_len < ntohl(bhssc->bhssc_expected_data_transfer_length)) { bhssr->bhssr_flags |= BHSSR_FLAGS_RESIDUAL_UNDERFLOW; bhssr->bhssr_residual_count = htonl(ntohl(bhssc->bhssc_expected_data_transfer_length) - - PDU_TOTAL_TRANSFER_LEN(request)); + io->scsiio.kern_total_len); //CFISCSI_SESSION_DEBUG(cs, "underflow; residual count %d", // ntohl(bhssr->bhssr_residual_count)); - } else if (PDU_TOTAL_TRANSFER_LEN(request) > + } else if (io->scsiio.kern_total_len > ntohl(bhssc->bhssc_expected_data_transfer_length)) { bhssr->bhssr_flags |= BHSSR_FLAGS_RESIDUAL_OVERFLOW; - bhssr->bhssr_residual_count = - htonl(PDU_TOTAL_TRANSFER_LEN(request) - + bhssr->bhssr_residual_count = htonl(io->scsiio.kern_total_len - ntohl(bhssc->bhssc_expected_data_transfer_length)); //CFISCSI_SESSION_DEBUG(cs, "overflow; residual count %d", // ntohl(bhssr->bhssr_residual_count));