Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[infiniband] Update subnet management agent to use a management inter…
…face
  • Loading branch information
Michael Brown committed Aug 8, 2009
1 parent 0e07516 commit 44251eb
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 313 deletions.
8 changes: 4 additions & 4 deletions src/drivers/infiniband/linda.c
Expand Up @@ -1606,15 +1606,15 @@ static int linda_read_eeprom ( struct linda *linda,

/* Read GUID */
if ( ( rc = i2c->read ( i2c, &linda->eeprom, LINDA_EEPROM_GUID_OFFSET,
guid->bytes, sizeof ( *guid ) ) ) != 0 ) {
guid->u.bytes, sizeof ( *guid ) ) ) != 0 ) {
DBGC ( linda, "Linda %p could not read GUID: %s\n",
linda, strerror ( rc ) );
return rc;
}
DBGC2 ( linda, "Linda %p has GUID %02x:%02x:%02x:%02x:%02x:%02x:"
"%02x:%02x\n", linda, guid->bytes[0], guid->bytes[1],
guid->bytes[2], guid->bytes[3], guid->bytes[4],
guid->bytes[5], guid->bytes[6], guid->bytes[7] );
"%02x:%02x\n", linda, guid->u.bytes[0], guid->u.bytes[1],
guid->u.bytes[2], guid->u.bytes[3], guid->u.bytes[4],
guid->u.bytes[5], guid->u.bytes[6], guid->u.bytes[7] );

/* Read serial number (debug only) */
if ( DBG_LOG ) {
Expand Down
3 changes: 0 additions & 3 deletions src/include/gpxe/ib_mad.h
Expand Up @@ -30,9 +30,6 @@ 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

Expand Down
6 changes: 5 additions & 1 deletion src/include/gpxe/ib_packet.h
Expand Up @@ -16,7 +16,11 @@ struct io_buffer;

/** Half of an Infiniband Global Identifier */
struct ib_gid_half {
uint8_t bytes[8];
union {
uint8_t bytes[8];
uint16_t words[4];
uint32_t dwords[2];
} u;
};

/** An Infiniband Global Identifier */
Expand Down
20 changes: 20 additions & 0 deletions src/include/gpxe/ib_sma.h
@@ -0,0 +1,20 @@
#ifndef _GPXE_IB_SMA_H
#define _GPXE_IB_SMA_H

/** @file
*
* Infiniband subnet management agent
*
*/

FILE_LICENCE ( GPL2_OR_LATER );

struct ib_device;
struct ib_mad_interface;

extern int ib_create_sma ( struct ib_device *ibdev,
struct ib_mad_interface *mi );
extern void ib_destroy_sma ( struct ib_device *ibdev,
struct ib_mad_interface *mi );

#endif /* _GPXE_IB_SMA_H */
5 changes: 3 additions & 2 deletions src/include/gpxe/infiniband.h
Expand Up @@ -45,6 +45,7 @@ struct ib_device;
struct ib_queue_pair;
struct ib_address_vector;
struct ib_completion_queue;
struct ib_mad_interface;
struct ib_gma;

/** Infiniband transmission rates */
Expand Down Expand Up @@ -413,8 +414,8 @@ struct ib_device {
*/
uint32_t rdma_key;

/** Subnet management agent */
struct ib_gma *sma;
/** Subnet management interface */
struct ib_mad_interface *smi;
/** General management agent */
struct ib_gma *gma;

Expand Down
24 changes: 18 additions & 6 deletions src/net/infiniband.c
Expand Up @@ -33,6 +33,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/ipoib.h>
#include <gpxe/process.h>
#include <gpxe/infiniband.h>
#include <gpxe/ib_mi.h>
#include <gpxe/ib_sma.h>
#include <gpxe/ib_gma.h>

/** @file
Expand Down Expand Up @@ -534,11 +536,18 @@ int ib_open ( struct ib_device *ibdev ) {
return 0;
}

/* Create subnet management agent */
ibdev->sma = ib_create_gma ( ibdev, IB_QPT_SMI );
if ( ! ibdev->sma ) {
DBGC ( ibdev, "IBDEV %p could not create SMA\n", ibdev );
/* Create subnet management interface */
ibdev->smi = ib_create_mi ( ibdev, IB_QPT_SMI );
if ( ! ibdev->smi ) {
DBGC ( ibdev, "IBDEV %p could not create SMI\n", ibdev );
rc = -ENOMEM;
goto err_create_smi;
}

/* Create subnet management agent */
if ( ( rc = ib_create_sma ( ibdev, ibdev->smi ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not create SMA: %s\n",
ibdev, strerror ( rc ) );
goto err_create_sma;
}

Expand All @@ -564,8 +573,10 @@ int ib_open ( struct ib_device *ibdev ) {
err_open:
ib_destroy_gma ( ibdev->gma );
err_create_gma:
ib_destroy_gma ( ibdev->sma );
ib_destroy_sma ( ibdev, ibdev->smi );
err_create_sma:
ib_destroy_mi ( ibdev, ibdev->smi );
err_create_smi:
assert ( ibdev->open_count == 1 );
ibdev->open_count = 0;
return rc;
Expand All @@ -584,7 +595,8 @@ void ib_close ( struct ib_device *ibdev ) {
/* Close device if this was the last remaining requested opening */
if ( ibdev->open_count == 0 ) {
ib_destroy_gma ( ibdev->gma );
ib_destroy_gma ( ibdev->sma );
ib_destroy_sma ( ibdev, ibdev->smi );
ib_destroy_mi ( ibdev, ibdev->smi );
ibdev->op->close ( ibdev );
}
}
Expand Down

0 comments on commit 44251eb

Please sign in to comment.