// SPDX-License-Identifier: GPL-2.0-only /* * Copyright(c) 2009 Intel Corporation. All rights reserved. * * Maintained at www.Open-FCoE.org */ #include <linux/kernel.h> #include <linux/types.h> #include <linux/scatterlist.h> #include <linux/crc32.h> #include <linux/module.h> #include <scsi/libfc.h> #include "fc_encode.h" #include "fc_libfc.h" MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; unsigned int fc_debug_logging; module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(…) …; DEFINE_MUTEX(…) …; static LIST_HEAD(fc_local_ports); struct blocking_notifier_head fc_lport_notifier_head = …; EXPORT_SYMBOL(…); /* * Providers which primarily send requests and PRLIs. */ struct fc4_prov *fc_active_prov[FC_FC4_PROV_SIZE] = …; /* * Providers which receive requests. */ struct fc4_prov *fc_passive_prov[FC_FC4_PROV_SIZE] = …; /** * libfc_init() - Initialize libfc.ko */ static int __init libfc_init(void) { … } module_init(…) …; /** * libfc_exit() - Tear down libfc.ko */ static void __exit libfc_exit(void) { … } module_exit(libfc_exit); /** * fc_copy_buffer_to_sglist() - This routine copies the data of a buffer * into a scatter-gather list (SG list). * * @buf: pointer to the data buffer. * @len: the byte-length of the data buffer. * @sg: pointer to the pointer of the SG list. * @nents: pointer to the remaining number of entries in the SG list. * @offset: pointer to the current offset in the SG list. * @crc: pointer to the 32-bit crc value. * If crc is NULL, CRC is not calculated. */ u32 fc_copy_buffer_to_sglist(void *buf, size_t len, struct scatterlist *sg, u32 *nents, size_t *offset, u32 *crc) { … } /** * fc_fill_hdr() - fill FC header fields based on request * @fp: reply frame containing header to be filled in * @in_fp: request frame containing header to use in filling in reply * @r_ctl: R_CTL value for header * @f_ctl: F_CTL value for header, with 0 pad * @seq_cnt: sequence count for the header, ignored if frame has a sequence * @parm_offset: parameter / offset value */ void fc_fill_hdr(struct fc_frame *fp, const struct fc_frame *in_fp, enum fc_rctl r_ctl, u32 f_ctl, u16 seq_cnt, u32 parm_offset) { … } EXPORT_SYMBOL(…); /** * fc_fill_reply_hdr() - fill FC reply header fields based on request * @fp: reply frame containing header to be filled in * @in_fp: request frame containing header to use in filling in reply * @r_ctl: R_CTL value for reply * @parm_offset: parameter / offset value */ void fc_fill_reply_hdr(struct fc_frame *fp, const struct fc_frame *in_fp, enum fc_rctl r_ctl, u32 parm_offset) { … } EXPORT_SYMBOL(…); /** * fc_fc4_conf_lport_params() - Modify "service_params" of specified lport * if there is service provider (target provider) registered with libfc * for specified "fc_ft_type" * @lport: Local port which service_params needs to be modified * @type: FC-4 type, such as FC_TYPE_FCP */ void fc_fc4_conf_lport_params(struct fc_lport *lport, enum fc_fh_type type) { … } void fc_lport_iterate(void (*notify)(struct fc_lport *, void *), void *arg) { … } EXPORT_SYMBOL(…); /** * fc_fc4_register_provider() - register FC-4 upper-level provider. * @type: FC-4 type, such as FC_TYPE_FCP * @prov: structure describing provider including ops vector. * * Returns 0 on success, negative error otherwise. */ int fc_fc4_register_provider(enum fc_fh_type type, struct fc4_prov *prov) { … } EXPORT_SYMBOL(…); /** * fc_fc4_deregister_provider() - deregister FC-4 upper-level provider. * @type: FC-4 type, such as FC_TYPE_FCP * @prov: structure describing provider including ops vector. */ void fc_fc4_deregister_provider(enum fc_fh_type type, struct fc4_prov *prov) { … } EXPORT_SYMBOL(…); /** * fc_fc4_add_lport() - add new local port to list and run notifiers. * @lport: The new local port. */ void fc_fc4_add_lport(struct fc_lport *lport) { … } /** * fc_fc4_del_lport() - remove local port from list and run notifiers. * @lport: The new local port. */ void fc_fc4_del_lport(struct fc_lport *lport) { … }