iPXE
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.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
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

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ ib_create_service_madx()

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 )

Create service record management transaction.

Parameters
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.

51 {
52 union ib_mad mad;
53 struct ib_mad_sa *sa = &mad.sa;
54 struct ib_service_record *svc = &sa->sa_data.service_record;
55
56 /* Construct service record request */
57 memset ( sa, 0, sizeof ( *sa ) );
58 sa->mad_hdr.mgmt_class = IB_MGMT_CLASS_SUBN_ADM;
59 sa->mad_hdr.class_version = IB_SA_CLASS_VERSION;
60 sa->mad_hdr.method = IB_MGMT_METHOD_GET;
61 sa->mad_hdr.attr_id = htons ( IB_SA_ATTR_SERVICE_REC );
62 sa->sa_hdr.comp_mask[1] = htonl ( IB_SA_SERVICE_REC_NAME );
63 snprintf ( svc->name, sizeof ( svc->name ), "%s", name );
64
65 /* Create management transaction */
66 return ib_create_madx ( ibdev, mi, &mad, NULL, op );
67}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
union ib_mad mad
Definition arbel.h:1
const char * name
Definition ath9k_hw.c:1986
#define IB_SA_ATTR_SERVICE_REC
Definition ib_mad.h:223
#define IB_MGMT_METHOD_GET
Definition ib_mad.h:570
#define IB_SA_CLASS_VERSION
Definition ib_mad.h:208
#define IB_SA_SERVICE_REC_NAME
Definition ib_mad.h:241
#define IB_MGMT_CLASS_SUBN_ADM
Definition ib_mad.h:558
struct ib_mad_transaction * ib_create_madx(struct ib_device *ibdev, struct ib_mad_interface *mi, union ib_mad *mad, struct ib_address_vector *av, struct ib_mad_transaction_operations *op)
Create management transaction.
Definition ib_mi.c:287
#define htonl(value)
Definition byteswap.h:134
#define htons(value)
Definition byteswap.h:136
void * memset(void *dest, int character, size_t len) __nonnull
static uint16_t struct vmbus_xfer_pages_operations * op
Definition netvsc.h:327
A subnet administration MAD.
Definition ib_mad.h:597
char name[64]
Definition ib_mad.h:234
struct sockaddr sa
Definition syslog.c:57
A management datagram.
Definition ib_mad.h:611
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition vsprintf.c:383

References 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, mad, memset(), ib_service_record::name, name, NULL, op, sa, and snprintf().

Referenced by xsigo_discover().