From owner-svn-src-head@FreeBSD.ORG Tue Mar 25 19:05:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 962FAE64; Tue, 25 Mar 2014 19:05:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6955983D; Tue, 25 Mar 2014 19:05:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2PJ56Hm043059; Tue, 25 Mar 2014 19:05:06 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2PJ56il043058; Tue, 25 Mar 2014 19:05:06 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201403251905.s2PJ56il043058@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 25 Mar 2014 19:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263741 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Mar 2014 19:05:06 -0000 Author: trasz Date: Tue Mar 25 19:05:05 2014 New Revision: 263741 URL: http://svnweb.freebsd.org/changeset/base/263741 Log: Use newly added extended LUN support in CAM. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Tue Mar 25 18:30:57 2014 (r263740) +++ head/sys/dev/iscsi/iscsi.c Tue Mar 25 19:05:05 2014 (r263741) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1817,40 +1818,6 @@ iscsi_ioctl(struct cdev *dev, u_long cmd } } -static uint64_t -iscsi_encode_lun(uint32_t lun) -{ - uint8_t encoded[8]; - uint64_t result; - - memset(encoded, 0, sizeof(encoded)); - - if (lun < 256) { - /* - * Peripheral device addressing. - */ - encoded[1] = lun; - } else if (lun < 16384) { - /* - * Flat space addressing. - */ - encoded[0] = 0x40; - encoded[0] |= (lun >> 8) & 0x3f; - encoded[1] = lun & 0xff; - } else { - /* - * Extended flat space addressing. - */ - encoded[0] = 0xd2; - encoded[1] = lun >> 16; - encoded[2] = lun >> 8; - encoded[3] = lun; - } - - memcpy(&result, encoded, sizeof(result)); - return (result); -} - static struct iscsi_outstanding * iscsi_outstanding_find(struct iscsi_session *is, uint32_t initiator_task_tag) { @@ -1965,7 +1932,7 @@ iscsi_action_scsiio(struct iscsi_session break; } - bhssc->bhssc_lun = iscsi_encode_lun(csio->ccb_h.target_lun); + bhssc->bhssc_lun = htobe64(CAM_EXTLUN_BYTE_SWIZZLE(ccb->ccb_h.target_lun)); bhssc->bhssc_initiator_task_tag = is->is_initiator_task_tag; is->is_initiator_task_tag++; bhssc->bhssc_expected_data_transfer_length = htonl(csio->dxfer_len); @@ -2037,13 +2004,11 @@ iscsi_action(struct cam_sim *sim, union cpi->version_num = 1; cpi->hba_inquiry = PI_TAG_ABLE; cpi->target_sprt = 0; - //cpi->hba_misc = PIM_NOBUSRESET; - cpi->hba_misc = 0; + cpi->hba_misc = PIM_EXTLUNS; cpi->hba_eng_cnt = 0; cpi->max_target = 0; - cpi->max_lun = 255; - //cpi->initiator_id = 0; /* XXX */ - cpi->initiator_id = 64; /* XXX */ + cpi->max_lun = 0; + cpi->initiator_id = ~0; strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "iSCSI", HBA_IDLEN); strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);