From owner-svn-src-all@freebsd.org Thu Apr 30 00:43:03 2020 Return-Path: Delivered-To: svn-src-all@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 A68B12C81AA; Thu, 30 Apr 2020 00:43:03 +0000 (UTC) (envelope-from imp@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) server-signature RSA-PSS (4096 bits) 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 49CGng3zf6z42Z1; Thu, 30 Apr 2020 00:43:03 +0000 (UTC) (envelope-from imp@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 83F0CE728; Thu, 30 Apr 2020 00:43:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03U0h3Bm032725; Thu, 30 Apr 2020 00:43:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03U0h3OB032723; Thu, 30 Apr 2020 00:43:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004300043.03U0h3OB032723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 00:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360483 - in head/sys: cam dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam dev/nvme X-SVN-Commit-Revision: 360483 X-SVN-Commit-Repository: base 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.29 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: Thu, 30 Apr 2020 00:43:03 -0000 Author: imp Date: Thu Apr 30 00:43:02 2020 New Revision: 360483 URL: https://svnweb.freebsd.org/changeset/base/360483 Log: Return the nvmeX device associated with the ndaX device. Add the nvmeX device to the XPT_PATH_INQ nvme specific information. while one could figure this out by looking up the domain:bus:slot:function, it's a lot easier to have the SIM set it directly since the sim knows this. Modified: head/sys/cam/cam_ccb.h head/sys/dev/nvme/nvme_sim.c Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Thu Apr 30 00:27:19 2020 (r360482) +++ head/sys/cam/cam_ccb.h Thu Apr 30 00:43:02 2020 (r360483) @@ -630,6 +630,7 @@ struct ccb_pathinq_settings_sas { u_int32_t bitrate; /* Mbps */ }; +#define NVME_DEV_NAME_LEN 52 struct ccb_pathinq_settings_nvme { uint32_t nsid; /* Namespace ID for this path */ uint32_t domain; @@ -637,7 +638,10 @@ struct ccb_pathinq_settings_nvme { uint8_t slot; uint8_t function; uint8_t extra; + char dev_name[NVME_DEV_NAME_LEN]; /* nvme controller dev name for this device */ }; +_Static_assert(sizeof(struct ccb_pathinq_settings_nvme) == 64, + "ccb_pathinq_settings_nvme too big"); #define PATHINQ_SETTINGS_SIZE 128 @@ -1030,6 +1034,7 @@ struct ccb_trans_settings_nvme uint8_t speed; /* PCIe generation for each lane */ uint8_t max_lanes; /* Number of PCIe lanes */ uint8_t max_speed; /* PCIe generation for each lane */ + }; #include Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Thu Apr 30 00:27:19 2020 (r360482) +++ head/sys/dev/nvme/nvme_sim.c Thu Apr 30 00:43:02 2020 (r360483) @@ -203,6 +203,8 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.nvme.slot = pci_get_slot(dev); cpi->xport_specific.nvme.function = pci_get_function(dev); cpi->xport_specific.nvme.extra = 0; + strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(ctrlr->dev), + sizeof(cpi->xport_specific.nvme.dev_name)); cpi->ccb_h.status = CAM_REQ_CMP; break; }