Commit 6c8312ad authored by Jay Sternberg's avatar Jay Sternberg Committed by Jens Axboe

nvmet: provide aen bit functions for multiple controller types

Move nvmet_aen_disabled and nvmet_clear_aen in preparation for other types
of controllers to use, initially the discovery controller.
Signed-off-by: default avatarJay Sternberg <jay.e.sternberg@intel.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 50a909db
...@@ -19,19 +19,6 @@ ...@@ -19,19 +19,6 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "nvmet.h" #include "nvmet.h"
/*
* This helper allows us to clear the AEN based on the RAE bit,
* Please use this helper when processing the log pages which are
* associated with the AEN.
*/
static inline void nvmet_clear_aen(struct nvmet_req *req, u32 aen_bit)
{
int rae = le32_to_cpu(req->cmd->common.cdw10[0]) & 1 << 15;
if (!rae)
clear_bit(aen_bit, &req->sq->ctrl->aen_masked);
}
u32 nvmet_get_log_page_len(struct nvme_command *cmd) u32 nvmet_get_log_page_len(struct nvme_command *cmd)
{ {
u32 len = le16_to_cpu(cmd->get_log_page.numdu); u32 len = le16_to_cpu(cmd->get_log_page.numdu);
......
...@@ -150,13 +150,6 @@ static void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type, ...@@ -150,13 +150,6 @@ static void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
schedule_work(&ctrl->async_event_work); schedule_work(&ctrl->async_event_work);
} }
static bool nvmet_aen_disabled(struct nvmet_ctrl *ctrl, u32 aen)
{
if (!(READ_ONCE(ctrl->aen_enabled) & aen))
return true;
return test_and_set_bit(aen, &ctrl->aen_masked);
}
static void nvmet_add_to_changed_ns_log(struct nvmet_ctrl *ctrl, __le32 nsid) static void nvmet_add_to_changed_ns_log(struct nvmet_ctrl *ctrl, __le32 nsid)
{ {
u32 i; u32 i;
......
...@@ -342,6 +342,21 @@ struct nvmet_async_event { ...@@ -342,6 +342,21 @@ struct nvmet_async_event {
u8 log_page; u8 log_page;
}; };
static inline void nvmet_clear_aen(struct nvmet_req *req, u32 aen_bit)
{
int rae = le32_to_cpu(req->cmd->common.cdw10[0]) & 1 << 15;
if (!rae)
clear_bit(aen_bit, &req->sq->ctrl->aen_masked);
}
static inline bool nvmet_aen_disabled(struct nvmet_ctrl *ctrl, u32 aen)
{
if (!(READ_ONCE(ctrl->aen_enabled) & aen))
return true;
return test_and_set_bit(aen, &ctrl->aen_masked);
}
u16 nvmet_parse_connect_cmd(struct nvmet_req *req); u16 nvmet_parse_connect_cmd(struct nvmet_req *req);
u16 nvmet_bdev_parse_io_cmd(struct nvmet_req *req); u16 nvmet_bdev_parse_io_cmd(struct nvmet_req *req);
u16 nvmet_file_parse_io_cmd(struct nvmet_req *req); u16 nvmet_file_parse_io_cmd(struct nvmet_req *req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment