staticinlinevoid hton24(u8 *p, u32 v)
{
p[0] = (v >> 16) & 0xff;
p[1] = (v >> 8) & 0xff;
p[2] = v & 0xff;
}
/* * The fc_frame interface is used to pass frame data between functions. * The frame includes the data buffer, length, and SOF / EOF delimiter types. * A pointer to the port structure of the receiving port is also includeded.
*/
#define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */ #define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */
/* Max number of skb frags allowed, reserving one for fcoe_crc_eof page */ #define FC_FRAME_SG_LEN (MAX_SKB_FRAGS - 1)
struct fcoe_rcv_info { struct fc_lport *fr_dev; /* transport layer private pointer */ struct fc_seq *fr_seq; /* for use with exchange manager */ struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */
u32 fr_crc;
u16 fr_max_payload; /* max FC payload */
u8 fr_sof; /* start of frame delimiter */
u8 fr_eof; /* end of frame delimiter */
u8 fr_flags; /* flags - see below */
u8 fr_encaps; /* LLD encapsulation info (e.g. FIP) */
u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */
};
/* * Get fc_frame pointer for an skb that's already been imported.
*/ staticinlinestruct fcoe_rcv_info *fcoe_dev_from_skb(conststruct sk_buff *skb)
{
BUILD_BUG_ON(sizeof(struct fcoe_rcv_info) > sizeof(skb->cb)); return (struct fcoe_rcv_info *) skb->cb;
}
/* * fr_flags.
*/ #define FCPHF_CRC_UNCHECKED 0x01 /* CRC not computed, still appended */
/* * Initialize a frame. * We don't do a complete memset here for performance reasons. * The caller must set fr_free, fr_hdr, fr_len, fr_sof, and fr_eof eventually.
*/ staticinlinevoid fc_frame_init(struct fc_frame *fp)
{
fr_dev(fp) = NULL;
fr_seq(fp) = NULL;
fr_flags(fp) = 0;
fr_encaps(fp) = 0;
}
/* * Allocate fc_frame structure and buffer. Set the initial length to * payload_size + sizeof (struct fc_frame_header).
*/ staticinlinestruct fc_frame *fc_frame_alloc(struct fc_lport *dev, size_t len)
{ struct fc_frame *fp;
/* * Note: Since len will often be a constant multiple of 4, * this check will usually be evaluated and eliminated at compile time.
*/ if (len && len % 4)
fp = fc_frame_alloc_fill(dev, len); else
fp = _fc_frame_alloc(len); return fp;
}
/* * Free the fc_frame structure and buffer.
*/ staticinlinevoid fc_frame_free(struct fc_frame *fp)
{
kfree_skb(fp_skb(fp));
}
/* * Get frame header from message in fc_frame structure. * This version doesn't do a length check.
*/ staticinline struct fc_frame_header *__fc_frame_header_get(conststruct fc_frame *fp)
{ return (struct fc_frame_header *)fr_hdr(fp);
}
/* * Get frame header from message in fc_frame structure. * This hides a cast and provides a place to add some checking.
*/ staticinline struct fc_frame_header *fc_frame_header_get(conststruct fc_frame *fp)
{
WARN_ON(fr_len(fp) < sizeof(struct fc_frame_header)); return __fc_frame_header_get(fp);
}
/* * Get source FC_ID (S_ID) from frame header in message.
*/ staticinline u32 fc_frame_sid(conststruct fc_frame *fp)
{ return ntoh24(__fc_frame_header_get(fp)->fh_s_id);
}
/* * Get destination FC_ID (D_ID) from frame header in message.
*/ staticinline u32 fc_frame_did(conststruct fc_frame *fp)
{ return ntoh24(__fc_frame_header_get(fp)->fh_d_id);
}
/* * Get frame payload from message in fc_frame structure. * This hides a cast and provides a place to add some checking. * The len parameter is the minimum length for the payload portion. * Returns NULL if the frame is too short. * * This assumes the interesting part of the payload is in the first part * of the buffer for received data. This may not be appropriate to use for * buffers being transmitted.
*/ staticinlinevoid *fc_frame_payload_get(conststruct fc_frame *fp,
size_t len)
{ void *pp = NULL;
/* * Get frame payload opcode (first byte) from message in fc_frame structure. * This hides a cast and provides a place to add some checking. Return 0 * if the frame has no payload.
*/ staticinline u8 fc_frame_payload_op(conststruct fc_frame *fp)
{
u8 *cp;
cp = fc_frame_payload_get(fp, sizeof(u8)); if (!cp) return 0; return *cp;
}
/* * Get FC class from frame.
*/ staticinlineenum fc_class fc_frame_class(conststruct fc_frame *fp)
{ return fc_sof_class(fr_sof(fp));
}
/* * Check the CRC in a frame. * The CRC immediately follows the last data item *AFTER* the length. * The return value is zero if the CRC matches.
*/
u32 fc_frame_crc_check(struct fc_frame *);
/* * Check for leaks. * Print the frame header of any currently allocated frame, assuming there * should be none at this point.
*/ void fc_frame_leak_check(void);
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.