unsignedint fc_debug_logging;
module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
/** * 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)
{
size_t remaining = len;
u32 copy_len = 0;
if (*offset >= sg->length) { /* * Check for end and drop resources * from the last iteration.
*/ if (!(*nents)) break;
--(*nents);
*offset -= sg->length;
sg = sg_next(sg); continue;
}
sg_bytes = min(remaining, sg->length - *offset);
/* * The scatterlist item may be bigger than PAGE_SIZE, * but we are limited to mapping PAGE_SIZE at a time.
*/
off = *offset + sg->offset;
sg_bytes = min(sg_bytes,
(size_t)(PAGE_SIZE - (off & ~PAGE_MASK)));
page_addr = kmap_atomic(sg_page(sg) + (off >> PAGE_SHIFT)); if (crc)
*crc = crc32(*crc, buf, sg_bytes);
memcpy((char *)page_addr + (off & ~PAGE_MASK), buf, sg_bytes);
kunmap_atomic(page_addr);
buf += sg_bytes;
*offset += sg_bytes;
remaining -= sg_bytes;
copy_len += sg_bytes;
} return copy_len;
}
/** * 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, conststruct fc_frame *in_fp, enum fc_rctl r_ctl, u32 f_ctl, u16 seq_cnt, u32 parm_offset)
{ struct fc_frame_header *fh; struct fc_frame_header *in_fh; struct fc_seq *sp;
u32 fill;
if (f_ctl & FC_FC_END_SEQ) {
fill = -fr_len(fp) & 3; if (fill) { /* TODO, this may be a problem with fragmented skb */
skb_put_zero(fp_skb(fp), fill);
f_ctl |= fill;
}
fr_eof(fp) = FC_EOF_T;
} else {
WARN_ON(fr_len(fp) % 4 != 0); /* no pad to non last frame */
fr_eof(fp) = FC_EOF_N;
}
/** * 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, conststruct fc_frame *in_fp, enum fc_rctl r_ctl, u32 parm_offset)
{ struct fc_seq *sp;
/** * 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)
{ struct fc4_prov *prov_entry;
BUG_ON(type >= FC_FC4_PROV_SIZE);
BUG_ON(!lport);
prov_entry = fc_passive_prov[type]; if (type == FC_TYPE_FCP) { if (prov_entry && prov_entry->recv)
lport->service_params |= FCP_SPPF_TARG_FCN;
}
}
/** * 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)
{
mutex_lock(&fc_prov_mutex);
list_add_tail(&lport->lport_list, &fc_local_ports);
blocking_notifier_call_chain(&fc_lport_notifier_head,
FC_LPORT_EV_ADD, lport);
mutex_unlock(&fc_prov_mutex);
}
/** * 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)
{
mutex_lock(&fc_prov_mutex);
list_del(&lport->lport_list);
blocking_notifier_call_chain(&fc_lport_notifier_head,
FC_LPORT_EV_DEL, lport);
mutex_unlock(&fc_prov_mutex);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.