From patchwork Wed Nov 16 07:06:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 9430977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B1EE6047D for ; Wed, 16 Nov 2016 07:07:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B3C028E1D for ; Wed, 16 Nov 2016 07:07:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FC6C28E1F; Wed, 16 Nov 2016 07:07:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E83B928E1D for ; Wed, 16 Nov 2016 07:07:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752430AbcKPHHA (ORCPT ); Wed, 16 Nov 2016 02:07:00 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:35583 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbcKPHG7 (ORCPT ); Wed, 16 Nov 2016 02:06:59 -0500 Received: by mail-qk0-f194.google.com with SMTP id n204so20013656qke.2 for ; Tue, 15 Nov 2016 23:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc; bh=5mVZluCfvK6t5XbMz80wWKIhVrolxiQTEa9GWGQ4ZzU=; b=oi1DTgYzUAiakA/AdCN5yb9q76lS7/kUPkWNtJpuyoXbcHo3QmydHUb/MnZSBudXwC nRLwtPWWUpPPexCA2TvPLLErKJn41oW8caqE4ZSF3Js1LJ0ZLQc3kKPSIfHk0xjUqKa9 s38wOvc3kVLdXTqdlBImTC64GvXvxE8WgZx2DdX69cTfAUrA3n6yF4Tzd237UtjmbUy5 P/26RUHvTpbTm3s6UGSGy9uC5QljLjBMNuT71SVPkipAnn/0KqCuyEzsa4SS2Ur2QZTz kMg7/X/gxqjnRUCbi+hz4lcag350WN92IWfTmgzbM14qnmWzs62hzUVAhPE2AKcoZHKk E28A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=5mVZluCfvK6t5XbMz80wWKIhVrolxiQTEa9GWGQ4ZzU=; b=CYcs9BkWwfH6ujO9UYMEm520gcibTdVTv6spEdXcT6NlJGEDYSgNqdpWuFLMfuAP9c 4dpnSWVoUhWDrmt+hfrPiXrUlGGgA583+5g4OOr5+1hqfxBS9o9QTRsg3XHPKQkpJb29 vj/3xk/SKQ72el1uD14F0rU+QH/kZHfGBXcJMmIMa5gK9nICWC+SoEtv5ezMghjqKt6y tnpauTGbN92+77B09LNAMIUaz0jfOo1Jq/RYGpdRgrwDoJvMa29MvIydV5fD0y/y1dE+ eeM13a2iQ/qI34kL0ZvnSgM6+AU575/ChIICkAQZPeE6X+/WFX9BTG7YF/vHTMqaOOnM 5a+Q== X-Gm-Message-State: AKaTC0160Jf5EyxaP0wL2InzLmNjyF4Nf85L4pqoRtwUELfpGuFOXg5HUYrqwp8c8CQ8/9d1R2imuoFmukhJwg== X-Received: by 10.55.108.193 with SMTP id h184mr1584299qkc.155.1479280018832; Tue, 15 Nov 2016 23:06:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.55.158.143 with HTTP; Tue, 15 Nov 2016 23:06:58 -0800 (PST) From: chaitany kulkarni Date: Tue, 15 Nov 2016 23:06:58 -0800 Message-ID: Subject: [PATCH 3/5] nvme.h: add Write Zeroes definitions To: axboe@fb.com Cc: martin.petersen@oracle.com, keith.busch@intel.com, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the command structure, optional command set support (ONCS) bit and a new error code for the Write Zeroes command. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Sagi Grimberg Reviewed-by: Christoph Hellwig --- include/linux/nvme.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 9f3b488..5bf1d2d 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -242,6 +242,7 @@ enum { NVME_CTRL_ONCS_COMPARE = 1 << 0, NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1, NVME_CTRL_ONCS_DSM = 1 << 2, + NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3, NVME_CTRL_VWC_PRESENT = 1 << 0, }; @@ -558,6 +559,23 @@ struct nvme_dsm_range { __le64 slba; }; +struct nvme_write_zeroes_cmd { + __u8 opcode; + __u8 flags; + __u16 command_id; + __le32 nsid; + __u64 rsvd2; + __le64 metadata; + union nvme_data_ptr dptr; + __le64 slba; + __le16 length; + __le16 control; + __le32 dsmgmt; + __le32 reftag; + __le16 apptag; + __le16 appmask; +}; + /* Admin commands */ enum nvme_admin_opcode { @@ -857,6 +875,7 @@ struct nvme_command { struct nvme_download_firmware dlfw; struct nvme_format_cmd format; struct nvme_dsm_cmd dsm; + struct nvme_write_zeroes_cmd write_zeroes; struct nvme_abort_cmd abort; struct nvme_get_log_page_command get_log_page; struct nvmf_common_command fabrics; @@ -947,6 +966,7 @@ enum { NVME_SC_BAD_ATTRIBUTES = 0x180, NVME_SC_INVALID_PI = 0x181, NVME_SC_READ_ONLY = 0x182, + NVME_SC_ONCS_NOT_SUPPORTED = 0x183, /* * I/O Command Set Specific - Fabrics commands: