mirror of
https://github.com/ipxe/ipxe
synced 2026-01-02 09:52:49 +03:00
[infiniband] Add raw packet parser and constructor
This can be used with cards that require the driver to construct and parse packet headers manually. Headers are optionally handled out-of-line from the packet payload, since some such cards will split received headers into a separate ring buffer.
This commit is contained in:
@@ -7,6 +7,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
struct ib_device;
|
||||
struct ib_queue_pair;
|
||||
struct ib_address_vector;
|
||||
struct io_buffer;
|
||||
|
||||
/** Half of an Infiniband Global Identifier */
|
||||
struct ib_gid_half {
|
||||
uint8_t bytes[8];
|
||||
@@ -53,6 +58,9 @@ enum ib_lnh {
|
||||
/** Default Infiniband LID */
|
||||
#define IB_LID_NONE 0xffff
|
||||
|
||||
/** Test for multicast LID */
|
||||
#define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) )
|
||||
|
||||
/** An Infiniband Global Route Header */
|
||||
struct ib_global_route_header {
|
||||
/** IP version, traffic class, and flow label
|
||||
@@ -76,7 +84,6 @@ struct ib_global_route_header {
|
||||
|
||||
#define IB_GRH_IPVER_IPv6 0x06
|
||||
#define IB_GRH_NXTHDR_IBA 0x1b
|
||||
#define IB_GRH_HOPLMT_MAX 0xff
|
||||
|
||||
/** An Infiniband Base Transport Header */
|
||||
struct ib_base_transport_header {
|
||||
@@ -111,4 +118,30 @@ struct ib_datagram_extended_transport_header {
|
||||
uint32_t src_qp;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** All known IB header formats */
|
||||
union ib_headers {
|
||||
struct ib_local_route_header lrh;
|
||||
struct {
|
||||
struct ib_local_route_header lrh;
|
||||
struct ib_global_route_header grh;
|
||||
struct ib_base_transport_header bth;
|
||||
struct ib_datagram_extended_transport_header deth;
|
||||
} __attribute__ (( packed )) lrh__grh__bth__deth;
|
||||
struct {
|
||||
struct ib_local_route_header lrh;
|
||||
struct ib_base_transport_header bth;
|
||||
struct ib_datagram_extended_transport_header deth;
|
||||
} __attribute__ (( packed )) lrh__bth__deth;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** Maximum size required for IB headers */
|
||||
#define IB_MAX_HEADER_SIZE sizeof ( union ib_headers )
|
||||
|
||||
extern int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
||||
struct ib_queue_pair *qp, size_t payload_len,
|
||||
const struct ib_address_vector *av );
|
||||
extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
||||
struct ib_queue_pair **qp, size_t *payload_len,
|
||||
struct ib_address_vector *av );
|
||||
|
||||
#endif /* _GPXE_IB_PACKET_H */
|
||||
|
||||
Reference in New Issue
Block a user