mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
nvme: Move opcode string helper functions declarations
Move the declaration of all helper functions converting NVMe command opcodes and status codes into strings from drivers/nvme/host/nvme.h into include/linux/nvme.h, together with the commands definitions. This allows NVMe target drivers to call these functions without having to include a host header file. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Tested-by: Rick Wertenbroek <rick.wertenbroek@gmail.com> Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
committed by
Keith Busch
parent
002bb02729
commit
30e77e0fbe
@@ -1182,43 +1182,4 @@ static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
|
||||
return (ctrl->ctrl_config & NVME_CC_CSS_MASK) == NVME_CC_CSS_CSI;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVME_VERBOSE_ERRORS
|
||||
const char *nvme_get_error_status_str(u16 status);
|
||||
const char *nvme_get_opcode_str(u8 opcode);
|
||||
const char *nvme_get_admin_opcode_str(u8 opcode);
|
||||
const char *nvme_get_fabrics_opcode_str(u8 opcode);
|
||||
#else /* CONFIG_NVME_VERBOSE_ERRORS */
|
||||
static inline const char *nvme_get_error_status_str(u16 status)
|
||||
{
|
||||
return "I/O Error";
|
||||
}
|
||||
static inline const char *nvme_get_opcode_str(u8 opcode)
|
||||
{
|
||||
return "I/O Cmd";
|
||||
}
|
||||
static inline const char *nvme_get_admin_opcode_str(u8 opcode)
|
||||
{
|
||||
return "Admin Cmd";
|
||||
}
|
||||
|
||||
static inline const char *nvme_get_fabrics_opcode_str(u8 opcode)
|
||||
{
|
||||
return "Fabrics Cmd";
|
||||
}
|
||||
#endif /* CONFIG_NVME_VERBOSE_ERRORS */
|
||||
|
||||
static inline const char *nvme_opcode_str(int qid, u8 opcode)
|
||||
{
|
||||
return qid ? nvme_get_opcode_str(opcode) :
|
||||
nvme_get_admin_opcode_str(opcode);
|
||||
}
|
||||
|
||||
static inline const char *nvme_fabrics_opcode_str(
|
||||
int qid, const struct nvme_command *cmd)
|
||||
{
|
||||
if (nvme_is_fabrics(cmd))
|
||||
return nvme_get_fabrics_opcode_str(cmd->fabrics.fctype);
|
||||
|
||||
return nvme_opcode_str(qid, cmd->common.opcode);
|
||||
}
|
||||
#endif /* _NVME_H */
|
||||
|
||||
@@ -1896,6 +1896,46 @@ static inline bool nvme_is_fabrics(const struct nvme_command *cmd)
|
||||
return cmd->common.opcode == nvme_fabrics_command;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVME_VERBOSE_ERRORS
|
||||
const char *nvme_get_error_status_str(u16 status);
|
||||
const char *nvme_get_opcode_str(u8 opcode);
|
||||
const char *nvme_get_admin_opcode_str(u8 opcode);
|
||||
const char *nvme_get_fabrics_opcode_str(u8 opcode);
|
||||
#else /* CONFIG_NVME_VERBOSE_ERRORS */
|
||||
static inline const char *nvme_get_error_status_str(u16 status)
|
||||
{
|
||||
return "I/O Error";
|
||||
}
|
||||
static inline const char *nvme_get_opcode_str(u8 opcode)
|
||||
{
|
||||
return "I/O Cmd";
|
||||
}
|
||||
static inline const char *nvme_get_admin_opcode_str(u8 opcode)
|
||||
{
|
||||
return "Admin Cmd";
|
||||
}
|
||||
|
||||
static inline const char *nvme_get_fabrics_opcode_str(u8 opcode)
|
||||
{
|
||||
return "Fabrics Cmd";
|
||||
}
|
||||
#endif /* CONFIG_NVME_VERBOSE_ERRORS */
|
||||
|
||||
static inline const char *nvme_opcode_str(int qid, u8 opcode)
|
||||
{
|
||||
return qid ? nvme_get_opcode_str(opcode) :
|
||||
nvme_get_admin_opcode_str(opcode);
|
||||
}
|
||||
|
||||
static inline const char *nvme_fabrics_opcode_str(
|
||||
int qid, const struct nvme_command *cmd)
|
||||
{
|
||||
if (nvme_is_fabrics(cmd))
|
||||
return nvme_get_fabrics_opcode_str(cmd->fabrics.fctype);
|
||||
|
||||
return nvme_opcode_str(qid, cmd->common.opcode);
|
||||
}
|
||||
|
||||
struct nvme_error_slot {
|
||||
__le64 error_count;
|
||||
__le16 sqid;
|
||||
|
||||
Reference in New Issue
Block a user