Lines Matching full:struct
64 (cpu_to_le32((1 << 16) | (offsetof(struct nvmf_connect_data, x))))
66 (cpu_to_le32(offsetof(struct nvmf_connect_command, x)))
68 struct nvmet_pr_registrant {
72 struct list_head entry;
73 struct rcu_head rcu;
76 struct nvmet_pr {
80 struct nvmet_pr_registrant __rcu *holder;
89 struct semaphore pr_sem;
90 struct list_head registrant_list;
93 struct nvmet_pr_per_ctrl_ref {
94 struct percpu_ref ref;
95 struct completion free_done;
96 struct completion confirm_done;
100 struct nvmet_ns {
101 struct percpu_ref ref;
102 struct file *bdev_file;
103 struct block_device *bdev;
104 struct file *file;
115 struct nvmet_subsys *subsys;
118 struct config_group device_group;
119 struct config_group group;
121 struct completion disable_done;
124 struct pci_dev *p2p_dev;
129 struct nvmet_pr pr;
130 struct xarray pr_per_ctrl_refs;
133 static inline struct nvmet_ns *to_nvmet_ns(struct config_item *item) in to_nvmet_ns()
135 return container_of(to_config_group(item), struct nvmet_ns, group); in to_nvmet_ns()
138 static inline struct device *nvmet_ns_dev(struct nvmet_ns *ns) in nvmet_ns_dev()
143 struct nvmet_cq {
148 struct nvmet_sq {
149 struct nvmet_ctrl *ctrl;
150 struct percpu_ref ref;
157 struct delayed_work auth_expired_work;
169 struct key *tls_key;
171 struct completion free_done;
172 struct completion confirm_done;
175 struct nvmet_ana_group {
176 struct config_group group;
177 struct nvmet_port *port;
181 static inline struct nvmet_ana_group *to_ana_group(struct config_item *item) in to_ana_group()
183 return container_of(to_config_group(item), struct nvmet_ana_group, in to_ana_group()
188 * struct nvmet_port - Common structure to keep port
196 struct nvmet_port {
197 struct list_head entry;
198 struct nvmf_disc_rsp_page_entry disc_addr;
199 struct config_group group;
200 struct config_group subsys_group;
201 struct list_head subsystems;
202 struct config_group referrals_group;
203 struct list_head referrals;
204 struct list_head global_entry;
205 struct config_group ana_groups_group;
206 struct nvmet_ana_group ana_default_group;
208 struct key *keyring;
213 const struct nvmet_fabrics_ops *tr_ops;
217 static inline struct nvmet_port *to_nvmet_port(struct config_item *item) in to_nvmet_port()
219 return container_of(to_config_group(item), struct nvmet_port, in to_nvmet_port()
223 static inline struct nvmet_port *ana_groups_to_port( in ana_groups_to_port()
224 struct config_item *item) in ana_groups_to_port()
226 return container_of(to_config_group(item), struct nvmet_port, in ana_groups_to_port()
230 static inline u8 nvmet_port_disc_addr_treq_secure_channel(struct nvmet_port *port) in nvmet_port_disc_addr_treq_secure_channel()
235 static inline bool nvmet_port_secure_channel_required(struct nvmet_port *port) in nvmet_port_secure_channel_required()
240 struct nvmet_pr_log_mgr {
241 struct mutex lock;
244 DECLARE_KFIFO(log_queue, struct nvme_pr_log, NVMET_PR_LOG_QUEUE_SIZE);
247 struct nvmet_ctrl {
248 struct nvmet_subsys *subsys;
249 struct nvmet_sq **sqs;
255 struct mutex lock;
264 struct nvmet_port *port;
268 struct nvmet_req *async_event_cmds[NVMET_ASYNC_EVENTS];
270 struct list_head async_events;
271 struct work_struct async_event_work;
273 struct list_head subsys_entry;
274 struct kref ref;
275 struct delayed_work ka_work;
276 struct work_struct fatal_err_work;
278 const struct nvmet_fabrics_ops *ops;
286 struct device *p2p_client;
287 struct radix_tree_root p2p_ns_map;
289 struct dentry *debugfs_dir;
293 struct nvme_error_slot slots[NVMET_ERROR_LOG_SLOTS];
297 struct nvme_dhchap_key *host_key;
298 struct nvme_dhchap_key *ctrl_key;
300 struct crypto_kpp *dh_tfm;
306 struct key *tls_key;
308 struct nvmet_pr_log_mgr pr_log_mgr;
311 struct nvmet_subsys {
314 struct mutex lock;
315 struct kref ref;
317 struct xarray namespaces;
323 struct list_head ctrls;
325 struct list_head hosts;
328 struct dentry *debugfs_dir;
338 struct config_group group;
340 struct config_group namespaces_group;
341 struct config_group allowed_hosts_group;
350 struct nvme_ctrl *passthru_ctrl;
352 struct config_group passthru_group;
363 static inline struct nvmet_subsys *to_subsys(struct config_item *item) in to_subsys()
365 return container_of(to_config_group(item), struct nvmet_subsys, group); in to_subsys()
368 static inline struct nvmet_subsys *namespaces_to_subsys( in namespaces_to_subsys()
369 struct config_item *item) in namespaces_to_subsys()
371 return container_of(to_config_group(item), struct nvmet_subsys, in namespaces_to_subsys()
375 struct nvmet_host {
376 struct config_group group;
385 static inline struct nvmet_host *to_host(struct config_item *item) in to_host()
387 return container_of(to_config_group(item), struct nvmet_host, group); in to_host()
390 static inline char *nvmet_host_name(struct nvmet_host *host) in nvmet_host_name()
395 struct nvmet_host_link {
396 struct list_head entry;
397 struct nvmet_host *host;
400 struct nvmet_subsys_link {
401 struct list_head entry;
402 struct nvmet_subsys *subsys;
405 struct nvmet_req;
406 struct nvmet_fabrics_ops {
407 struct module *owner;
413 void (*queue_response)(struct nvmet_req *req);
414 int (*add_port)(struct nvmet_port *port);
415 void (*remove_port)(struct nvmet_port *port);
416 void (*delete_ctrl)(struct nvmet_ctrl *ctrl);
417 void (*disc_traddr)(struct nvmet_req *req,
418 struct nvmet_port *port, char *traddr);
419 ssize_t (*host_traddr)(struct nvmet_ctrl *ctrl,
421 u16 (*install_queue)(struct nvmet_sq *nvme_sq);
422 void (*discovery_chg)(struct nvmet_port *port);
423 u8 (*get_mdts)(const struct nvmet_ctrl *ctrl);
424 u16 (*get_max_queue_size)(const struct nvmet_ctrl *ctrl);
427 u16 (*create_sq)(struct nvmet_ctrl *ctrl, u16 sqid, u16 flags,
429 u16 (*delete_sq)(struct nvmet_ctrl *ctrl, u16 sqid);
430 u16 (*create_cq)(struct nvmet_ctrl *ctrl, u16 cqid, u16 flags,
432 u16 (*delete_cq)(struct nvmet_ctrl *ctrl, u16 cqid);
433 u16 (*set_feature)(const struct nvmet_ctrl *ctrl, u8 feat,
435 u16 (*get_feature)(const struct nvmet_ctrl *ctrl, u8 feat,
442 struct nvmet_req {
443 struct nvme_command *cmd;
444 struct nvme_completion *cqe;
445 struct nvmet_sq *sq;
446 struct nvmet_cq *cq;
447 struct nvmet_ns *ns;
448 struct scatterlist *sg;
449 struct scatterlist *metadata_sg;
450 struct bio_vec inline_bvec[NVMET_MAX_INLINE_BIOVEC];
452 struct {
453 struct bio inline_bio;
455 struct {
457 struct kiocb iocb;
458 struct bio_vec *bvec;
459 struct work_struct work;
461 struct {
462 struct bio inline_bio;
463 struct request *rq;
464 struct work_struct work;
468 struct {
469 struct bio inline_bio;
470 struct work_struct zmgmt_work;
473 struct {
474 struct work_struct abort_work;
483 struct nvmet_port *port;
485 void (*execute)(struct nvmet_req *req);
486 const struct nvmet_fabrics_ops *ops;
488 struct pci_dev *p2p_dev;
489 struct device *p2p_client;
492 struct nvmet_pr_per_ctrl_ref *pc_ref;
496 extern struct kmem_cache *nvmet_bvec_cache;
497 extern struct workqueue_struct *buffered_io_wq;
498 extern struct workqueue_struct *zbd_wq;
499 extern struct workqueue_struct *nvmet_wq;
501 static inline void nvmet_set_result(struct nvmet_req *req, u32 result) in nvmet_set_result()
510 nvmet_data_dir(struct nvmet_req *req) in nvmet_data_dir()
515 struct nvmet_async_event {
516 struct list_head entry;
522 static inline void nvmet_clear_aen_bit(struct nvmet_req *req, u32 bn) in nvmet_clear_aen_bit()
530 static inline bool nvmet_aen_bit_disabled(struct nvmet_ctrl *ctrl, u32 bn) in nvmet_aen_bit_disabled()
537 void nvmet_get_feat_kato(struct nvmet_req *req);
538 void nvmet_get_feat_async_event(struct nvmet_req *req);
539 u16 nvmet_set_feat_kato(struct nvmet_req *req);
540 u16 nvmet_set_feat_async_event(struct nvmet_req *req, u32 mask);
541 void nvmet_execute_async_event(struct nvmet_req *req);
542 void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl);
543 void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl);
545 u16 nvmet_parse_connect_cmd(struct nvmet_req *req);
546 u32 nvmet_connect_cmd_data_len(struct nvmet_req *req);
547 void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id);
548 u16 nvmet_bdev_parse_io_cmd(struct nvmet_req *req);
549 u16 nvmet_file_parse_io_cmd(struct nvmet_req *req);
550 u16 nvmet_bdev_zns_parse_io_cmd(struct nvmet_req *req);
551 u32 nvmet_admin_cmd_data_len(struct nvmet_req *req);
552 u16 nvmet_parse_admin_cmd(struct nvmet_req *req);
553 u32 nvmet_discovery_cmd_data_len(struct nvmet_req *req);
554 u16 nvmet_parse_discovery_cmd(struct nvmet_req *req);
555 u16 nvmet_parse_fabrics_admin_cmd(struct nvmet_req *req);
556 u32 nvmet_fabrics_admin_cmd_data_len(struct nvmet_req *req);
557 u16 nvmet_parse_fabrics_io_cmd(struct nvmet_req *req);
558 u32 nvmet_fabrics_io_cmd_data_len(struct nvmet_req *req);
560 bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
561 struct nvmet_sq *sq, const struct nvmet_fabrics_ops *ops);
562 void nvmet_req_uninit(struct nvmet_req *req);
563 size_t nvmet_req_transfer_len(struct nvmet_req *req);
564 bool nvmet_check_transfer_len(struct nvmet_req *req, size_t len);
565 bool nvmet_check_data_len_lte(struct nvmet_req *req, size_t data_len);
566 void nvmet_req_complete(struct nvmet_req *req, u16 status);
567 int nvmet_req_alloc_sgls(struct nvmet_req *req);
568 void nvmet_req_free_sgls(struct nvmet_req *req);
570 void nvmet_execute_set_features(struct nvmet_req *req);
571 void nvmet_execute_get_features(struct nvmet_req *req);
572 void nvmet_execute_keep_alive(struct nvmet_req *req);
574 u16 nvmet_check_cqid(struct nvmet_ctrl *ctrl, u16 cqid);
575 void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid,
577 u16 nvmet_cq_create(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid,
579 u16 nvmet_check_sqid(struct nvmet_ctrl *ctrl, u16 sqid, bool create);
580 void nvmet_sq_setup(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, u16 qid,
582 u16 nvmet_sq_create(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, u16 qid,
584 void nvmet_sq_destroy(struct nvmet_sq *sq);
585 int nvmet_sq_init(struct nvmet_sq *sq);
587 void nvmet_ctrl_fatal_error(struct nvmet_ctrl *ctrl);
589 void nvmet_update_cc(struct nvmet_ctrl *ctrl, u32 new);
591 struct nvmet_alloc_ctrl_args {
592 struct nvmet_port *port;
593 struct nvmet_sq *sq;
597 const struct nvmet_fabrics_ops *ops;
598 struct device *p2p_client;
605 struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args);
606 struct nvmet_ctrl *nvmet_ctrl_find_get(const char *subsysnqn,
608 struct nvmet_req *req);
609 void nvmet_ctrl_put(struct nvmet_ctrl *ctrl);
610 u16 nvmet_check_ctrl_status(struct nvmet_req *req);
611 ssize_t nvmet_ctrl_host_traddr(struct nvmet_ctrl *ctrl,
614 struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
616 void nvmet_subsys_put(struct nvmet_subsys *subsys);
617 void nvmet_subsys_del_ctrls(struct nvmet_subsys *subsys);
619 u16 nvmet_req_find_ns(struct nvmet_req *req);
620 void nvmet_put_namespace(struct nvmet_ns *ns);
621 int nvmet_ns_enable(struct nvmet_ns *ns);
622 void nvmet_ns_disable(struct nvmet_ns *ns);
623 struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid);
624 void nvmet_ns_free(struct nvmet_ns *ns);
626 void nvmet_send_ana_event(struct nvmet_subsys *subsys,
627 struct nvmet_port *port);
628 void nvmet_port_send_ana_event(struct nvmet_port *port);
630 int nvmet_register_transport(const struct nvmet_fabrics_ops *ops);
631 void nvmet_unregister_transport(const struct nvmet_fabrics_ops *ops);
633 void nvmet_port_del_ctrls(struct nvmet_port *port,
634 struct nvmet_subsys *subsys);
636 int nvmet_enable_port(struct nvmet_port *port);
637 void nvmet_disable_port(struct nvmet_port *port);
639 void nvmet_referral_enable(struct nvmet_port *parent, struct nvmet_port *port);
640 void nvmet_referral_disable(struct nvmet_port *parent, struct nvmet_port *port);
642 u16 nvmet_copy_to_sgl(struct nvmet_req *req, off_t off, const void *buf,
644 u16 nvmet_copy_from_sgl(struct nvmet_req *req, off_t off, void *buf,
646 u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len);
648 u32 nvmet_get_log_page_len(struct nvme_command *cmd);
649 u64 nvmet_get_log_page_offset(struct nvme_command *cmd);
651 extern struct list_head *nvmet_ports;
652 void nvmet_port_disc_changed(struct nvmet_port *port,
653 struct nvmet_subsys *subsys);
654 void nvmet_subsys_disc_changed(struct nvmet_subsys *subsys,
655 struct nvmet_host *host);
656 void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
688 extern struct nvmet_subsys *nvmet_disc_subsys;
689 extern struct rw_semaphore nvmet_config_sem;
693 extern struct rw_semaphore nvmet_ana_sem;
695 bool nvmet_host_allowed(struct nvmet_subsys *subsys, const char *hostnqn);
697 int nvmet_bdev_ns_enable(struct nvmet_ns *ns);
698 int nvmet_file_ns_enable(struct nvmet_ns *ns);
699 void nvmet_bdev_ns_disable(struct nvmet_ns *ns);
700 void nvmet_file_ns_disable(struct nvmet_ns *ns);
701 u16 nvmet_bdev_flush(struct nvmet_req *req);
702 u16 nvmet_file_flush(struct nvmet_req *req);
703 void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid);
704 void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns);
705 void nvmet_file_ns_revalidate(struct nvmet_ns *ns);
706 bool nvmet_ns_revalidate(struct nvmet_ns *ns);
707 u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts);
709 bool nvmet_bdev_zns_enable(struct nvmet_ns *ns);
710 void nvmet_execute_identify_ctrl_zns(struct nvmet_req *req);
711 void nvmet_execute_identify_ns_zns(struct nvmet_req *req);
712 void nvmet_bdev_execute_zone_mgmt_recv(struct nvmet_req *req);
713 void nvmet_bdev_execute_zone_mgmt_send(struct nvmet_req *req);
714 void nvmet_bdev_execute_zone_append(struct nvmet_req *req);
716 static inline u32 nvmet_rw_data_len(struct nvmet_req *req) in nvmet_rw_data_len()
722 static inline u32 nvmet_rw_metadata_len(struct nvmet_req *req) in nvmet_rw_metadata_len()
730 static inline u32 nvmet_dsm_len(struct nvmet_req *req) in nvmet_dsm_len()
733 sizeof(struct nvme_dsm_range); in nvmet_dsm_len()
736 static inline struct nvmet_subsys *nvmet_req_subsys(struct nvmet_req *req) in nvmet_req_subsys()
741 static inline bool nvmet_is_disc_subsys(struct nvmet_subsys *subsys) in nvmet_is_disc_subsys()
746 static inline bool nvmet_is_pci_ctrl(struct nvmet_ctrl *ctrl) in nvmet_is_pci_ctrl()
752 void nvmet_passthru_subsys_free(struct nvmet_subsys *subsys);
753 int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys);
754 void nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys);
755 u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req);
756 u16 nvmet_parse_passthru_io_cmd(struct nvmet_req *req);
757 static inline bool nvmet_is_passthru_subsys(struct nvmet_subsys *subsys) in nvmet_is_passthru_subsys()
762 static inline void nvmet_passthru_subsys_free(struct nvmet_subsys *subsys) in nvmet_passthru_subsys_free()
765 static inline void nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys) in nvmet_passthru_ctrl_disable()
768 static inline u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req) in nvmet_parse_passthru_admin_cmd()
772 static inline u16 nvmet_parse_passthru_io_cmd(struct nvmet_req *req) in nvmet_parse_passthru_io_cmd()
776 static inline bool nvmet_is_passthru_subsys(struct nvmet_subsys *subsys) in nvmet_is_passthru_subsys()
782 static inline bool nvmet_is_passthru_req(struct nvmet_req *req) in nvmet_is_passthru_req()
787 void nvmet_passthrough_override_cap(struct nvmet_ctrl *ctrl);
789 u16 errno_to_nvme_status(struct nvmet_req *req, int errno);
790 u16 nvmet_report_invalid_opcode(struct nvmet_req *req);
833 static inline bool nvmet_ns_has_pi(struct nvmet_ns *ns) in nvmet_ns_has_pi()
837 return ns->pi_type && ns->metadata_size == sizeof(struct t10_pi_tuple); in nvmet_ns_has_pi()
840 static inline __le64 nvmet_sect_to_lba(struct nvmet_ns *ns, sector_t sect) in nvmet_sect_to_lba()
845 static inline sector_t nvmet_lba_to_sect(struct nvmet_ns *ns, __le64 lba) in nvmet_lba_to_sect()
850 static inline bool nvmet_use_inline_bvec(struct nvmet_req *req) in nvmet_use_inline_bvec()
856 static inline void nvmet_req_bio_put(struct nvmet_req *req, struct bio *bio) in nvmet_req_bio_put()
863 static inline key_serial_t nvmet_queue_tls_keyid(struct nvmet_sq *sq) in nvmet_queue_tls_keyid()
867 static inline void nvmet_sq_put_tls_key(struct nvmet_sq *sq) in nvmet_sq_put_tls_key()
875 static inline key_serial_t nvmet_queue_tls_keyid(struct nvmet_sq *sq) { return 0; } in nvmet_queue_tls_keyid()
876 static inline void nvmet_sq_put_tls_key(struct nvmet_sq *sq) {} in nvmet_sq_put_tls_key()
879 u32 nvmet_auth_send_data_len(struct nvmet_req *req);
880 void nvmet_execute_auth_send(struct nvmet_req *req);
881 u32 nvmet_auth_receive_data_len(struct nvmet_req *req);
882 void nvmet_execute_auth_receive(struct nvmet_req *req);
883 int nvmet_auth_set_key(struct nvmet_host *host, const char *secret,
885 int nvmet_auth_set_host_hash(struct nvmet_host *host, const char *hash);
886 u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq);
887 void nvmet_auth_sq_init(struct nvmet_sq *sq);
888 void nvmet_destroy_auth(struct nvmet_ctrl *ctrl);
889 void nvmet_auth_sq_free(struct nvmet_sq *sq);
890 int nvmet_setup_dhgroup(struct nvmet_ctrl *ctrl, u8 dhgroup_id);
891 bool nvmet_check_auth_status(struct nvmet_req *req);
892 int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
894 int nvmet_auth_ctrl_hash(struct nvmet_req *req, u8 *response,
896 static inline bool nvmet_has_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq) in nvmet_has_auth()
900 int nvmet_auth_ctrl_exponential(struct nvmet_req *req,
902 int nvmet_auth_ctrl_sesskey(struct nvmet_req *req,
904 void nvmet_auth_insert_psk(struct nvmet_sq *sq);
906 static inline u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, in nvmet_setup_auth()
907 struct nvmet_sq *sq) in nvmet_setup_auth()
911 static inline void nvmet_auth_sq_init(struct nvmet_sq *sq) in nvmet_auth_sq_init()
914 static inline void nvmet_destroy_auth(struct nvmet_ctrl *ctrl) {}; in nvmet_destroy_auth()
915 static inline void nvmet_auth_sq_free(struct nvmet_sq *sq) {}; in nvmet_auth_sq_free()
916 static inline bool nvmet_check_auth_status(struct nvmet_req *req) in nvmet_check_auth_status()
920 static inline bool nvmet_has_auth(struct nvmet_ctrl *ctrl, in nvmet_has_auth()
921 struct nvmet_sq *sq) in nvmet_has_auth()
926 static inline void nvmet_auth_insert_psk(struct nvmet_sq *sq) {}; in nvmet_auth_insert_psk()
929 int nvmet_pr_init_ns(struct nvmet_ns *ns);
930 u16 nvmet_parse_pr_cmd(struct nvmet_req *req);
931 u16 nvmet_pr_check_cmd_access(struct nvmet_req *req);
932 int nvmet_ctrl_init_pr(struct nvmet_ctrl *ctrl);
933 void nvmet_ctrl_destroy_pr(struct nvmet_ctrl *ctrl);
934 void nvmet_pr_exit_ns(struct nvmet_ns *ns);
935 void nvmet_execute_get_log_page_resv(struct nvmet_req *req);
936 u16 nvmet_set_feat_resv_notif_mask(struct nvmet_req *req, u32 mask);
937 u16 nvmet_get_feat_resv_notif_mask(struct nvmet_req *req);
938 u16 nvmet_pr_get_ns_pc_ref(struct nvmet_req *req);
939 static inline void nvmet_pr_put_ns_pc_ref(struct nvmet_pr_per_ctrl_ref *pc_ref) in nvmet_pr_put_ns_pc_ref()
948 struct nvmet_feat_irq_coalesce {
953 struct nvmet_feat_irq_config {
958 struct nvmet_feat_arbitration {