mirror of
https://github.com/ipxe/ipxe
synced 2025-12-27 01:52:39 +03:00
IPoIB code separated out to ipoib.c.
This commit is contained in:
@@ -101,6 +101,8 @@
|
||||
#define ERRFILE_via_rhine ( ERRFILE_DRIVER | 0x00440000 )
|
||||
#define ERRFILE_via_velocity ( ERRFILE_DRIVER | 0x00450000 )
|
||||
#define ERRFILE_w89c840 ( ERRFILE_DRIVER | 0x00460000 )
|
||||
#define ERRFILE_ipoib ( ERRFILE_DRIVER | 0x00470000 )
|
||||
#define ERRFILE_mt25218 ( ERRFILE_DRIVER | 0x00480000 )
|
||||
|
||||
#define ERRFILE_scsi ( ERRFILE_DRIVER | 0x00700000 )
|
||||
|
||||
|
||||
@@ -8,7 +8,43 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gpxe/netdevice.h>
|
||||
#include <gpxe/device.h>
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/** Infiniband MAC address length */
|
||||
#define IB_ALEN 20
|
||||
|
||||
/** An Infiniband MAC address */
|
||||
struct ib_mac {
|
||||
/** Queue pair number
|
||||
*
|
||||
* MSB must be zero; QPNs are only 24-bit.
|
||||
*/
|
||||
uint32_t qpn;
|
||||
/** Port GID */
|
||||
struct ib_gid gid;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** Infiniband link-layer header length */
|
||||
#define IB_HLEN 4
|
||||
|
||||
/** An Infiniband link-layer header */
|
||||
struct ibhdr {
|
||||
/** Network-layer protocol */
|
||||
uint16_t proto;
|
||||
/** Reserved, must be zero */
|
||||
uint16_t reserved;
|
||||
} __attribute__ (( packed ));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** An Infiniband Global Identifier */
|
||||
struct ib_gid {
|
||||
@@ -36,33 +72,6 @@ struct ib_global_route_header {
|
||||
struct ib_gid dgid;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** Infiniband MAC address length */
|
||||
#define IB_ALEN 20
|
||||
|
||||
/** An Infiniband MAC address */
|
||||
struct ib_mac {
|
||||
/** Queue pair number
|
||||
*
|
||||
* MSB must be zero; QPNs are only 24-bit.
|
||||
*/
|
||||
uint32_t qpn;
|
||||
/** Port GID */
|
||||
struct ib_gid gid;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** Infiniband link-layer header length */
|
||||
#define IB_HLEN 4
|
||||
|
||||
/** An Infiniband link-layer header */
|
||||
struct ibhdr {
|
||||
/** Network-layer protocol */
|
||||
uint16_t proto;
|
||||
/** Reserved, must be zero */
|
||||
uint16_t reserved;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
|
||||
|
||||
struct ib_device;
|
||||
struct ib_queue_pair;
|
||||
struct ib_completion_queue;
|
||||
@@ -223,8 +232,7 @@ struct ib_device_operations {
|
||||
struct ib_queue_pair *qp,
|
||||
struct ib_address_vector *av,
|
||||
struct io_buffer *iobuf );
|
||||
/**
|
||||
* Post receive work queue entry
|
||||
/** Post receive work queue entry
|
||||
*
|
||||
* @v ibdev Infiniband device
|
||||
* @v qp Queue pair
|
||||
@@ -252,8 +260,7 @@ struct ib_device_operations {
|
||||
struct ib_completion_queue *cq,
|
||||
ib_completer_t complete_send,
|
||||
ib_completer_t complete_recv );
|
||||
/**
|
||||
* Attach to multicast group
|
||||
/** Attach to multicast group
|
||||
*
|
||||
* @v ibdev Infiniband device
|
||||
* @v qp Queue pair
|
||||
@@ -263,8 +270,7 @@ struct ib_device_operations {
|
||||
int ( * mcast_attach ) ( struct ib_device *ibdev,
|
||||
struct ib_queue_pair *qp,
|
||||
struct ib_gid *gid );
|
||||
/**
|
||||
* Detach from multicast group
|
||||
/** Detach from multicast group
|
||||
*
|
||||
* @v ibdev Infiniband device
|
||||
* @v qp Queue pair
|
||||
@@ -276,13 +282,19 @@ struct ib_device_operations {
|
||||
};
|
||||
|
||||
/** An Infiniband device */
|
||||
struct ib_device {
|
||||
struct ib_device {
|
||||
/** Port GID */
|
||||
struct ib_gid port_gid;
|
||||
/** Broadcast GID */
|
||||
struct ib_gid broadcast_gid;
|
||||
/** Underlying device */
|
||||
struct device *dev;
|
||||
/** Infiniband operations */
|
||||
struct ib_device_operations *op;
|
||||
/** Device private data */
|
||||
void *dev_priv;
|
||||
/** Owner private data */
|
||||
void *owner_priv;
|
||||
};
|
||||
|
||||
extern struct ib_completion_queue * ib_create_cq ( struct ib_device *ibdev,
|
||||
@@ -297,6 +309,52 @@ extern void ib_destroy_qp ( struct ib_device *ibdev,
|
||||
struct ib_queue_pair *qp );
|
||||
extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
|
||||
unsigned long qpn, int is_send );
|
||||
extern struct ib_device * alloc_ibdev ( size_t priv_size );
|
||||
extern void free_ibdev ( struct ib_device *ibdev );
|
||||
|
||||
/**
|
||||
* Post send work queue entry
|
||||
*
|
||||
* @v ibdev Infiniband device
|
||||
* @v qp Queue pair
|
||||
* @v av Address vector
|
||||
* @v iobuf I/O buffer
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||
struct ib_address_vector *av, struct io_buffer *iobuf ) {
|
||||
return ibdev->op->post_send ( ibdev, qp, av, iobuf );
|
||||
}
|
||||
|
||||
/**
|
||||
* Post receive work queue entry
|
||||
*
|
||||
* @v ibdev Infiniband device
|
||||
* @v qp Queue pair
|
||||
* @v iobuf I/O buffer
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||
struct io_buffer *iobuf ) {
|
||||
return ibdev->op->post_recv ( ibdev, qp, iobuf );
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll completion queue
|
||||
*
|
||||
* @v ibdev Infiniband device
|
||||
* @v cq Completion queue
|
||||
* @v complete_send Send completion handler
|
||||
* @v complete_recv Receive completion handler
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
ib_poll_cq ( struct ib_device *ibdev, struct ib_completion_queue *cq,
|
||||
ib_completer_t complete_send, ib_completer_t complete_recv ) {
|
||||
ibdev->op->poll_cq ( ibdev, cq, complete_send, complete_recv );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attach to multicast group
|
||||
@@ -325,6 +383,27 @@ ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||
ibdev->op->mcast_detach ( ibdev, qp, gid );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Infiniband owner-private data
|
||||
*
|
||||
* @v pci Infiniband device
|
||||
* @v priv Private data
|
||||
*/
|
||||
static inline void ib_set_ownerdata ( struct ib_device *ibdev,
|
||||
void *owner_priv ) {
|
||||
ibdev->owner_priv = owner_priv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Infiniband owner-private data
|
||||
*
|
||||
* @v pci Infiniband device
|
||||
* @ret priv Private data
|
||||
*/
|
||||
static inline void * ib_get_ownerdata ( struct ib_device *ibdev ) {
|
||||
return ibdev->owner_priv;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Management datagrams
|
||||
@@ -435,9 +514,7 @@ union ib_mad {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
extern struct ll_protocol infiniband_protocol;
|
||||
|
||||
@@ -459,4 +536,6 @@ static inline struct net_device * alloc_ibdev ( size_t priv_size ) {
|
||||
return netdev;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _GPXE_INFINIBAND_H */
|
||||
|
||||
78
src/include/gpxe/ipoib.h
Normal file
78
src/include/gpxe/ipoib.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#ifndef _GPXE_IPOIB_H
|
||||
#define _GPXE_IPOIB_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* IP over Infiniband
|
||||
*/
|
||||
|
||||
#include <gpxe/infiniband.h>
|
||||
|
||||
/** IPoIB MAC address length */
|
||||
#define IPOIB_ALEN 20
|
||||
|
||||
/** An IPoIB MAC address */
|
||||
struct ipoib_mac {
|
||||
/** Queue pair number
|
||||
*
|
||||
* MSB must be zero; QPNs are only 24-bit.
|
||||
*/
|
||||
uint32_t qpn;
|
||||
/** Port GID */
|
||||
struct ib_gid gid;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** IPoIB link-layer header length */
|
||||
#define IPOIB_HLEN 24
|
||||
|
||||
/**
|
||||
* IPoIB link-layer header pseudo portion
|
||||
*
|
||||
* This part doesn't actually exist on the wire, but it provides a
|
||||
* convenient way to fit into the typical network device model.
|
||||
*/
|
||||
struct ipoib_pseudo_hdr {
|
||||
/** Peer address */
|
||||
struct ipoib_mac peer;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** IPoIB link-layer header real portion */
|
||||
struct ipoib_real_hdr {
|
||||
/** Network-layer protocol */
|
||||
uint16_t proto;
|
||||
/** Reserved, must be zero */
|
||||
uint16_t reserved;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/** An IPoIB link-layer header */
|
||||
struct ipoib_hdr {
|
||||
/** Pseudo portion */
|
||||
struct ipoib_pseudo_hdr pseudo;
|
||||
/** Real portion */
|
||||
struct ipoib_real_hdr real;
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
extern struct ll_protocol ipoib_protocol;
|
||||
|
||||
extern const char * ipoib_ntoa ( const void *ll_addr );
|
||||
|
||||
/**
|
||||
* Allocate IPoIB device
|
||||
*
|
||||
* @v priv_size Size of driver private data
|
||||
* @ret netdev Network device, or NULL
|
||||
*/
|
||||
static inline struct net_device * alloc_ipoibdev ( size_t priv_size ) {
|
||||
struct net_device *netdev;
|
||||
|
||||
netdev = alloc_netdev ( priv_size );
|
||||
if ( netdev ) {
|
||||
netdev->ll_protocol = &ipoib_protocol;
|
||||
}
|
||||
return netdev;
|
||||
}
|
||||
|
||||
extern int ipoib_probe ( struct ib_device *ibdev );
|
||||
extern void ipoib_remove ( struct ib_device *ibdev );
|
||||
|
||||
#endif /* _GPXE_IPOIB_H */
|
||||
Reference in New Issue
Block a user