linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH v2 3/4] nvme: Implement resume_from_suspend and sed block ioctl
Date: Wed, 30 Nov 2016 19:50:41 -0500	[thread overview]
Message-ID: <20161201005040.GF21081@localhost.localdomain> (raw)
In-Reply-To: <1480456322-27339-4-git-send-email-scott.bauer@intel.com>

On Tue, Nov 29, 2016@02:52:01PM -0700, Scott Bauer wrote:
> +static int nvme_sec_submit(void *data, u16 spsp, u8 secp, void *buffer,
> +			   size_t len, bool send)
> +{
> +	struct request_queue *q;
> +	struct request *req;
> +	struct nvme_ns *ns;
> +	struct nvme_command cmd = { 0 };
> +	int ret;
> +
> +	ns = data;
> +
> +	if (send)
> +		cmd.common.opcode = (u8)nvme_admin_security_send;
> +	else
> +		cmd.common.opcode = (u8)nvme_admin_security_recv;
> +
> +	cmd.common.nsid = ns->ns_id;
> +	cmd.common.cdw10[0] = cpu_to_le32(((u32)secp) << 24 | ((u32)spsp) << 8);
> +	cmd.common.cdw10[1] = cpu_to_le32(len);
> +
> +	q = ns->ctrl->admin_q;
> +
> +	req = nvme_alloc_request(q, &cmd, 0, NVME_QID_ANY);
> +	if (IS_ERR(req)) {
> +		ret = PTR_ERR(req);
> +		return ret;
> +	}
> +
> +	req->timeout = ADMIN_TIMEOUT;
> +	req->special = NULL;
> +
> +	if (buffer && len) {
> +		ret = blk_rq_map_kern(q, req, buffer, len, GFP_KERNEL);
> +		if (ret)
> +			goto out;
> +	}
> +
> +	ret = blk_execute_rq(req->q, ns->disk, req, 1);

I think you want to use the __nvme_submit_sync_command API instead of
duplicating some of the things it does for you.

  reply	other threads:[~2016-12-01  0:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 21:51 [PATCH v2 0/4] SED OPAL Library Scott Bauer
2016-11-29 21:51 ` [PATCH v2 1/4] include: Add definitions for sed Scott Bauer
2016-11-29 21:52 ` [PATCH v2 2/4] block: Add Sed-opal library Scott Bauer
2016-11-30 18:13   ` Keith Busch
2016-11-30 18:09     ` Scott Bauer
2016-12-01  0:50   ` Keith Busch
2016-12-01 10:04     ` Christoph Hellwig
2016-12-01 17:53       ` Scott Bauer
2016-12-01 18:22         ` Keith Busch
2016-12-09 17:45           ` Scott Bauer
2016-12-09 18:30             ` Christoph Hellwig
2016-12-09 18:50               ` Scott Bauer
2016-11-29 21:52 ` [PATCH v2 3/4] nvme: Implement resume_from_suspend and sed block ioctl Scott Bauer
2016-12-01  0:50   ` Keith Busch [this message]
2016-11-29 21:52 ` [PATCH v2 4/4] Maintainers: Add Information for SED Opal library Scott Bauer
2017-02-10 16:46   ` Elliott, Robert (Persistent Memory)
2017-02-10 16:44     ` Scott Bauer
2017-02-11  2:24       ` Elliott, Robert (Persistent Memory)
2017-02-13  8:04       ` hch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161201005040.GF21081@localhost.localdomain \
    --to=keith.busch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).