[infiniband] Implement SMA as an instance of a GMA

The GMA code was based upon the SMA code.  We can save space by making
the SMA simply an instance of the GMA.
This commit is contained in:
Michael Brown
2009-07-07 18:30:15 +01:00
parent 8a852280eb
commit 165074c188
8 changed files with 194 additions and 364 deletions

View File

@@ -23,6 +23,8 @@ struct ib_gma;
struct ib_gma_handler {
/** Management class */
uint8_t mgmt_class;
/** Management class don't-care bits */
uint8_t mgmt_class_ignore;
/** Class version */
uint8_t class_version;
/** Method */

View File

@@ -30,6 +30,9 @@ struct ib_smp_hdr {
uint8_t reserved[28];
} __attribute__ (( packed ));
/** Bits to ignore in the management class for subnet management MADs */
#define IB_SMP_CLASS_IGNORE 0x80
/** Subnet management class version */
#define IB_SMP_CLASS_VERSION 1

View File

@@ -10,50 +10,15 @@
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/infiniband.h>
/** Infiniband Subnet Management Agent operations */
struct ib_sma_operations {
/** Set port information
*
* @v ibdev Infiniband device
* @v port_info New port information
*/
int ( * set_port_info ) ( struct ib_device *ibdev,
const struct ib_port_info *port_info );
};
#include <gpxe/ib_gma.h>
/** An Infiniband Subnet Management Agent */
struct ib_sma {
/** Infiniband device */
struct ib_device *ibdev;
/** SMA operations */
struct ib_sma_operations *op;
/** SMA completion queue */
struct ib_completion_queue *cq;
/** SMA queue pair */
struct ib_queue_pair *qp;
/** General management agent */
struct ib_gma gma;
};
/** SMA number of send WQEs
*
* This is a policy decision.
*/
#define IB_SMA_NUM_SEND_WQES 4
/** SMA number of receive WQEs
*
* This is a policy decision.
*/
#define IB_SMA_NUM_RECV_WQES 2
/** SMA number of completion queue entries
*
* This is a policy decision
*/
#define IB_SMA_NUM_CQES 8
extern int ib_create_sma ( struct ib_sma *sma, struct ib_device *ibdev,
struct ib_sma_operations *op );
extern int ib_create_sma ( struct ib_sma *sma, struct ib_device *ibdev );
extern void ib_destroy_sma ( struct ib_sma *sma );
#endif /* _GPXE_IB_SMA_H */

View File

@@ -327,6 +327,16 @@ struct ib_device_operations {
void ( * mcast_detach ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_gid *gid );
/** Set port information
*
* @v ibdev Infiniband device
* @v port_info New port information
*
* This method is required only by adapters that do not have
* an embedded SMA.
*/
int ( * set_port_info ) ( struct ib_device *ibdev,
const struct ib_port_info *port_info );
};
/** An Infiniband device */
@@ -420,6 +430,8 @@ extern void ib_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_gid *gid );
extern int ib_get_hca_info ( struct ib_device *ibdev,
struct ib_gid_half *hca_guid );
extern int ib_set_port_info ( struct ib_device *ibdev,
const struct ib_port_info *port_info );
extern struct ib_device * alloc_ibdev ( size_t priv_size );
extern int register_ibdev ( struct ib_device *ibdev );
extern void unregister_ibdev ( struct ib_device *ibdev );