Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
mad.c File Reference
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <rdma/ib_cache.h>
#include "mad_priv.h"
#include "mad_rmpp.h"
#include "smi.h"
#include "agent.h"

Go to the source code of this file.

Functions

 MODULE_LICENSE ("Dual BSD/GPL")
 
 MODULE_DESCRIPTION ("kernel IB MAD API")
 
 MODULE_AUTHOR ("Hal Rosenstock")
 
 MODULE_AUTHOR ("Sean Hefty")
 
 module_param_named (send_queue_size, mad_sendq_size, int, 0444)
 
 MODULE_PARM_DESC (send_queue_size,"Size of send queue in number of work requests")
 
 module_param_named (recv_queue_size, mad_recvq_size, int, 0444)
 
 MODULE_PARM_DESC (recv_queue_size,"Size of receive queue in number of work requests")
 
int ib_response_mad (struct ib_mad *mad)
 
 EXPORT_SYMBOL (ib_response_mad)
 
struct ib_mad_agentib_register_mad_agent (struct ib_device *device, u8 port_num, enum ib_qp_type qp_type, struct ib_mad_reg_req *mad_reg_req, u8 rmpp_version, ib_mad_send_handler send_handler, ib_mad_recv_handler recv_handler, void *context)
 
 EXPORT_SYMBOL (ib_register_mad_agent)
 
struct ib_mad_agentib_register_mad_snoop (struct ib_device *device, u8 port_num, enum ib_qp_type qp_type, int mad_snoop_flags, ib_mad_snoop_handler snoop_handler, ib_mad_recv_handler recv_handler, void *context)
 
 EXPORT_SYMBOL (ib_register_mad_snoop)
 
int ib_unregister_mad_agent (struct ib_mad_agent *mad_agent)
 
 EXPORT_SYMBOL (ib_unregister_mad_agent)
 
struct ib_mad_send_bufib_create_send_mad (struct ib_mad_agent *mad_agent, u32 remote_qpn, u16 pkey_index, int rmpp_active, int hdr_len, int data_len, gfp_t gfp_mask)
 
 EXPORT_SYMBOL (ib_create_send_mad)
 
int ib_get_mad_data_offset (u8 mgmt_class)
 
 EXPORT_SYMBOL (ib_get_mad_data_offset)
 
int ib_is_mad_class_rmpp (u8 mgmt_class)
 
 EXPORT_SYMBOL (ib_is_mad_class_rmpp)
 
voidib_get_rmpp_segment (struct ib_mad_send_buf *send_buf, int seg_num)
 
 EXPORT_SYMBOL (ib_get_rmpp_segment)
 
void ib_free_send_mad (struct ib_mad_send_buf *send_buf)
 
 EXPORT_SYMBOL (ib_free_send_mad)
 
int ib_send_mad (struct ib_mad_send_wr_private *mad_send_wr)
 
int ib_post_send_mad (struct ib_mad_send_buf *send_buf, struct ib_mad_send_buf **bad_send_buf)
 
 EXPORT_SYMBOL (ib_post_send_mad)
 
void ib_free_recv_mad (struct ib_mad_recv_wc *mad_recv_wc)
 
 EXPORT_SYMBOL (ib_free_recv_mad)
 
struct ib_mad_agentib_redirect_mad_qp (struct ib_qp *qp, u8 rmpp_version, ib_mad_send_handler send_handler, ib_mad_recv_handler recv_handler, void *context)
 
 EXPORT_SYMBOL (ib_redirect_mad_qp)
 
int ib_process_mad_wc (struct ib_mad_agent *mad_agent, struct ib_wc *wc)
 
 EXPORT_SYMBOL (ib_process_mad_wc)
 
struct ib_mad_send_wr_privateib_find_send_mad (struct ib_mad_agent_private *mad_agent_priv, struct ib_mad_recv_wc *wc)
 
void ib_mark_mad_done (struct ib_mad_send_wr_private *mad_send_wr)
 
void ib_reset_mad_timeout (struct ib_mad_send_wr_private *mad_send_wr, int timeout_ms)
 
void ib_mad_complete_send_wr (struct ib_mad_send_wr_private *mad_send_wr, struct ib_mad_send_wc *mad_send_wc)
 
int ib_modify_mad (struct ib_mad_agent *mad_agent, struct ib_mad_send_buf *send_buf, u32 timeout_ms)
 
 EXPORT_SYMBOL (ib_modify_mad)
 
void ib_cancel_mad (struct ib_mad_agent *mad_agent, struct ib_mad_send_buf *send_buf)
 
 EXPORT_SYMBOL (ib_cancel_mad)
 
 module_init (ib_mad_init_module)
 
 module_exit (ib_mad_cleanup_module)
 

Function Documentation

EXPORT_SYMBOL ( ib_response_mad  )
EXPORT_SYMBOL ( ib_register_mad_agent  )
EXPORT_SYMBOL ( ib_register_mad_snoop  )
EXPORT_SYMBOL ( ib_unregister_mad_agent  )
EXPORT_SYMBOL ( ib_create_send_mad  )
EXPORT_SYMBOL ( ib_get_mad_data_offset  )
EXPORT_SYMBOL ( ib_is_mad_class_rmpp  )
EXPORT_SYMBOL ( ib_get_rmpp_segment  )
EXPORT_SYMBOL ( ib_free_send_mad  )
EXPORT_SYMBOL ( ib_post_send_mad  )
EXPORT_SYMBOL ( ib_free_recv_mad  )
EXPORT_SYMBOL ( ib_redirect_mad_qp  )
EXPORT_SYMBOL ( ib_process_mad_wc  )
EXPORT_SYMBOL ( ib_modify_mad  )
EXPORT_SYMBOL ( ib_cancel_mad  )
void ib_cancel_mad ( struct ib_mad_agent mad_agent,
struct ib_mad_send_buf send_buf 
)

ib_cancel_mad - Cancels an outstanding send MAD operation. : Specifies the registration associated with sent MAD. : Indicates the MAD to cancel.

MADs will be returned to the user through the corresponding ib_mad_send_handler.

Definition at line 2371 of file mad.c.

struct ib_mad_send_buf* ib_create_send_mad ( struct ib_mad_agent mad_agent,
u32  remote_qpn,
u16  pkey_index,
int  rmpp_active,
int  hdr_len,
int  data_len,
gfp_t  gfp_mask 
)
read

ib_create_send_mad - Allocate and initialize a data buffer and work request for sending a MAD. : Specifies the registered MAD service to associate with the MAD. : Specifies the QPN of the receiving node. : Specifies which PKey the MAD will be sent using. This field is valid only if the remote_qpn is QP 1. : Indicates if the send will enable RMPP. : Indicates the size of the data header of the MAD. This length should include the common MAD header, RMPP header, plus any class specific header. : Indicates the size of any user-transferred data. The call will automatically adjust the allocated buffer size to account for any additional padding that may be necessary. : GFP mask used for the memory allocation.

This routine allocates a MAD for sending. The returned MAD send buffer will reference a data buffer usable for sending a MAD, along with an initialized work request structure. Users may modify the returned MAD data buffer before posting the send.

The returned MAD header, class specific headers, and any padding will be cleared. Users are responsible for initializing the common MAD header, any class specific header, and MAD data area. If is set, the RMPP header will be initialized for sending.

Definition at line 865 of file mad.c.

struct ib_mad_send_wr_private* ib_find_send_mad ( struct ib_mad_agent_private mad_agent_priv,
struct ib_mad_recv_wc wc 
)
read

Definition at line 1748 of file mad.c.

void ib_free_recv_mad ( struct ib_mad_recv_wc mad_recv_wc)

ib_free_recv_mad - Returns data buffers used to receive a MAD. : Work completion information for a received MAD.

Clients receiving MADs through their ib_mad_recv_handler must call this routine to return the work completion buffers to the access layer.

Definition at line 1156 of file mad.c.

void ib_free_send_mad ( struct ib_mad_send_buf send_buf)

ib_free_send_mad - Returns data buffers used to send a MAD. : Previously allocated send data buffer.

Definition at line 988 of file mad.c.

int ib_get_mad_data_offset ( u8  mgmt_class)

ib_get_mad_data_offset - returns the data offset for a given management class. : management class

This routine returns the data offset in the MAD for the management class requested.

Definition at line 927 of file mad.c.

void* ib_get_rmpp_segment ( struct ib_mad_send_buf send_buf,
int  seg_num 
)

ib_get_rmpp_segment - returns the data buffer for a given RMPP segment. : Previously allocated send data buffer. : number of segment to return

This routine returns a pointer to the data buffer of an RMPP MAD. Users must provide synchronization to around this call.

Definition at line 956 of file mad.c.

int ib_is_mad_class_rmpp ( u8  mgmt_class)

ib_is_mad_class_rmpp - returns whether given management class supports RMPP. : management class

This routine returns whether the management class supports RMPP.

Definition at line 943 of file mad.c.

void ib_mad_complete_send_wr ( struct ib_mad_send_wr_private mad_send_wr,
struct ib_mad_send_wc mad_send_wc 
)

Definition at line 2068 of file mad.c.

void ib_mark_mad_done ( struct ib_mad_send_wr_private mad_send_wr)

Definition at line 1789 of file mad.c.

int ib_modify_mad ( struct ib_mad_agent mad_agent,
struct ib_mad_send_buf send_buf,
u32  timeout_ms 
)

ib_modify_mad - Modifies an outstanding send MAD operation. : Specifies the registration associated with sent MAD. : Indicates the MAD to modify. : New timeout value for sent MAD.

This call will reset the timeout value for a sent MAD to the specified value.

Definition at line 2337 of file mad.c.

int ib_post_send_mad ( struct ib_mad_send_buf send_buf,
struct ib_mad_send_buf **  bad_send_buf 
)

ib_post_send_mad - Posts MAD(s) to the send queue of the QP associated with the registered client. : Specifies the information needed to send the MAD(s). : Specifies the MAD on which an error was encountered. This parameter is optional if only a single MAD is posted.

Sent MADs are not guaranteed to complete in the order that they were posted.

If the MAD requires RMPP, the data buffer should contain a single copy of the common MAD, RMPP, and class specific headers, followed by the class defined data. If the class defined data would not divide evenly into RMPP segments, then space must be allocated at the end of the referenced buffer for any required padding. To indicate the amount of class defined data being transferred, the paylen_newwin field in the RMPP header should be set to the size of the class specific header plus the amount of class defined data being transferred. The paylen_newwin field should be specified in network-byte order.

Definition at line 1063 of file mad.c.

int ib_process_mad_wc ( struct ib_mad_agent mad_agent,
struct ib_wc wc 
)

ib_process_mad_wc - Processes a work completion associated with a MAD sent or received on a redirected QP. : Specifies the registered MAD service using the redirected QP. : References a work completion associated with a sent or received MAD segment.

This routine is used to complete or continue processing on a MAD request. If the work completion is associated with a send operation, calling this routine is required to continue an RMPP transfer or to wait for a corresponding response, if it is a request. If the work completion is associated with a receive operation, calling this routine is required to process an inbound or outbound RMPP transfer, or to match a response MAD with its corresponding request.

Definition at line 1190 of file mad.c.

struct ib_mad_agent* ib_redirect_mad_qp ( struct ib_qp qp,
u8  rmpp_version,
ib_mad_send_handler  send_handler,
ib_mad_recv_handler  recv_handler,
void context 
)
read

ib_redirect_mad_qp - Registers a QP for MAD services. : Reference to a QP that requires MAD services. : If set, indicates that the client will send and receive MADs that contain the RMPP header for the given version. If set to 0, indicates that RMPP is not used by this client. : The completion callback routine invoked after a send request has completed. : The completion callback routine invoked for a received MAD. : User specified context associated with the registration.

Use of this call allows clients to use MAD services, such as RMPP, on user-owned QPs. After calling this routine, users may send MADs on the specified QP by calling ib_mad_post_send.

Definition at line 1180 of file mad.c.

struct ib_mad_agent* ib_register_mad_agent ( struct ib_device device,
u8  port_num,
enum ib_qp_type  qp_type,
struct ib_mad_reg_req mad_reg_req,
u8  rmpp_version,
ib_mad_send_handler  send_handler,
ib_mad_recv_handler  recv_handler,
void context 
)
read

ib_register_mad_agent - Register to send/receive MADs. : The device to register with. : The port on the specified device to use. : Specifies which QP to access. Must be either IB_QPT_SMI or IB_QPT_GSI. : Specifies which unsolicited MADs should be received by the caller. This parameter may be NULL if the caller only wishes to receive solicited responses. : If set, indicates that the client will send and receive MADs that contain the RMPP header for the given version. If set to 0, indicates that RMPP is not used by this client. : The completion callback routine invoked after a send request has completed. : The completion callback routine invoked for a received MAD. : User specified context associated with the registration.

Definition at line 191 of file mad.c.

struct ib_mad_agent* ib_register_mad_snoop ( struct ib_device device,
u8  port_num,
enum ib_qp_type  qp_type,
int  mad_snoop_flags,
ib_mad_snoop_handler  snoop_handler,
ib_mad_recv_handler  recv_handler,
void context 
)
read

ib_register_mad_snoop - Register to snoop sent and received MADs. : The device to register with. : The port on the specified device to use. : Specifies which QP traffic to snoop. Must be either IB_QPT_SMI or IB_QPT_GSI. : Specifies information where snooping occurs. : The callback routine invoked for a snooped send. : The callback routine invoked for a snooped receive. : User specified context associated with the registration.

Definition at line 442 of file mad.c.

void ib_reset_mad_timeout ( struct ib_mad_send_wr_private mad_send_wr,
int  timeout_ms 
)

Definition at line 2058 of file mad.c.

int ib_response_mad ( struct ib_mad mad)

ib_response_mad - Returns if the specified MAD has been generated in response to a sent request or trap.

Definition at line 179 of file mad.c.

int ib_send_mad ( struct ib_mad_send_wr_private mad_send_wr)

Definition at line 1004 of file mad.c.

int ib_unregister_mad_agent ( struct ib_mad_agent mad_agent)

ib_unregister_mad_agent - Unregisters a client from using MAD services. : Corresponding MAD registration request to deregister.

After invoking this routine, MAD services are no longer usable by the client on the associated QP.

Definition at line 569 of file mad.c.

MODULE_AUTHOR ( "Hal Rosenstock"  )
MODULE_AUTHOR ( "Sean Hefty"  )
MODULE_DESCRIPTION ( "kernel IB MAD API"  )
module_exit ( ib_mad_cleanup_module  )
module_init ( ib_mad_init_module  )
MODULE_LICENSE ( "Dual BSD/GPL"  )
module_param_named ( send_queue_size  ,
mad_sendq_size  ,
int  ,
0444   
)
module_param_named ( recv_queue_size  ,
mad_recvq_size  ,
int  ,
0444   
)
MODULE_PARM_DESC ( send_queue_size  ,
"Size of send queue in number of work requests"   
)
MODULE_PARM_DESC ( recv_queue_size  ,
"Size of receive queue in number of work requests"   
)