ib_service.c File Reference

Infiniband service records. More...

#include <string.h>
#include <stdio.h>
#include <byteswap.h>
#include <ipxe/infiniband.h>
#include <ipxe/ib_mi.h>
#include <ipxe/ib_service.h>

Go to the source code of this file.


struct ib_mad_transactionib_create_service_madx (struct ib_device *ibdev, struct ib_mad_interface *mi, const char *name, struct ib_mad_transaction_operations *op)
 Create service record management transaction.

Detailed Description

Infiniband service records.

Definition in file ib_service.c.

Function Documentation

struct ib_mad_transaction* ib_create_service_madx ( struct ib_device ibdev,
struct ib_mad_interface mi,
const char *  name,
struct ib_mad_transaction_operations op 
) [read]

Create service record management transaction.

ibdevInfiniband device
miManagement interface
nameService name
opManagement transaction operations
Return values:
madxManagement transaction, or NULL on error

Definition at line 49 of file ib_service.c.

References ib_mad_hdr::attr_id, ib_mad_hdr::class_version, ib_sa_hdr::comp_mask, htonl, htons, ib_create_madx(), IB_MGMT_CLASS_SUBN_ADM, IB_MGMT_METHOD_GET, IB_SA_ATTR_SERVICE_REC, IB_SA_CLASS_VERSION, IB_SA_SERVICE_REC_NAME, ib_mad_sa::mad_hdr, memset(), ib_mad_hdr::method, ib_mad_hdr::mgmt_class, ib_service_record::name, NULL, sa, ib_mad::sa, ib_mad_sa::sa_data, ib_mad_sa::sa_hdr, ib_sa_data::service_record, and snprintf().

Referenced by xsigo_discover().

        union ib_mad mad;
        struct ib_mad_sa *sa = &mad.sa;
        struct ib_service_record *svc = &sa->sa_data.service_record;

        /* Construct service record request */
        memset ( sa, 0, sizeof ( *sa ) );
        sa->mad_hdr.mgmt_class = IB_MGMT_CLASS_SUBN_ADM;
        sa->mad_hdr.class_version = IB_SA_CLASS_VERSION;
        sa->mad_hdr.method = IB_MGMT_METHOD_GET;
        sa->mad_hdr.attr_id = htons ( IB_SA_ATTR_SERVICE_REC );
        sa->sa_hdr.comp_mask[1] = htonl ( IB_SA_SERVICE_REC_NAME );
        snprintf ( svc->name, sizeof ( svc->name ), "%s", name );

        /* Create management transaction */
        return ib_create_madx ( ibdev, mi, &mad, NULL, op );