InfiniBand and Remote DMA (RDMA) Interfaces
Introduction and Overview #
TBD
InfiniBand core interfaces #
iwpm_get_nlmsg_request() #
struct iwpm_nlmsg_request * Allocate and initialize netlink message request
Parameters
__u32 nlmsg_seq: Sequence number of the netlink messageu8 nl_client: The index of the netlink clientgfp_t gfp: Indicates how the memory for the request should be allocated
Description
Returns the newly allocated netlink request object if successful, otherwise returns NULL
iwpm_free_nlmsg_request() #
void Deallocate netlink message request
Parameters
struct kref *kref: Holds reference of netlink message request
iwpm_find_nlmsg_request() #
struct iwpm_nlmsg_request * Find netlink message request in the request list
Parameters
__u32 echo_seq: Sequence number of the netlink request to find
Description
Returns the found netlink message request, if not found, returns NULL
iwpm_wait_complete_req() #
int Block while servicing the netlink request
Parameters
struct iwpm_nlmsg_request *nlmsg_request: Netlink message request to service
Description
Wakes up, after the request is completed or expired Returns 0 if the request is complete without error
iwpm_get_nlmsg_seq() #
int Get the sequence number for a netlink message to send to the port mapper
Parameters
void: no arguments
Description
Returns the sequence number for the netlink message.
iwpm_add_remote_info() #
void Add remote address info of the connecting peer to the remote info hash table
Parameters
struct iwpm_remote_info *reminfo: The remote info to be added
iwpm_check_registration() #
u32 Check if the client registration matches the given one
Parameters
u8 nl_client: The index of the netlink clientu32 reg: The given registration type to compare with
Description
Call iwpm_register_pid() to register a client
Returns true if the client registration matches reg,
otherwise returns false
iwpm_set_registration() #
void Set the client registration
Parameters
u8 nl_client: The index of the netlink clientu32 reg: Registration type to set
iwpm_get_registration() #
u32 Get the client registration
Parameters
u8 nl_client: The index of the netlink client
Description
Returns the client registration type
iwpm_send_mapinfo() #
int Send local and mapped IPv4/IPv6 address info of a client to the user space port mapper
Parameters
u8 nl_client: The index of the netlink clientint iwpm_pid: The pid of the user space port mapper
Description
If successful, returns the number of sent mapping info records
iwpm_mapinfo_available() #
int Check if any mapping info records is available in the hash table
Parameters
void: no arguments
Description
Returns 1 if mapping information is available, otherwise returns 0
iwpm_compare_sockaddr() #
int Compare two sockaddr storage structs
Parameters
struct sockaddr_storage *a_sockaddr: first sockaddr to comparestruct sockaddr_storage *b_sockaddr: second sockaddr to compare
Return
0 if they are holding the same ip/tcp address info, otherwise returns 1
iwpm_validate_nlmsg_attr() #
int Check for NULL netlink attributes
Parameters
struct nlattr *nltb[]: Holds address of each netlink message attributesint nla_count: Number of netlink message attributes
Description
Returns error if any of the nla_count attributes is NULL
iwpm_create_nlmsg() #
struct sk_buff * Allocate skb and form a netlink message
Parameters
u32 nl_op: Netlink message opcodestruct nlmsghdr **nlh: Holds address of the netlink message header in skbint nl_client: The index of the netlink client
Description
Returns the newly allcated skb, or NULL if the tailroom of the skb is insufficient to store the message header and payload
iwpm_parse_nlmsg() #
int Validate and parse the received netlink message
Parameters
struct netlink_callback *cb: Netlink callback structureint policy_max: Maximum attribute type to be expectedconst struct nla_policy *nlmsg_policy: Validation policystruct nlattr *nltb[]: Array to store policy_max parsed elementsconst char *msg_type: Type of netlink message
Description
Returns 0 on success or a negative error code
iwpm_print_sockaddr() #
void Print IPv4/IPv6 address and TCP port
Parameters
struct sockaddr_storage *sockaddr: Socket address to printchar *msg: Message to print
iwpm_send_hello() #
int Send hello response to iwpmd
Parameters
u8 nl_client: The index of the netlink clientint iwpm_pid: The pid of the user space port mapperu16 abi_version: The kernel's abi_version
Description
Returns 0 on success or a negative error code
ib_process_cq_direct() #
int process a CQ in caller context
Parameters
struct ib_cq *cq: CQ to processint budget: number of CQEs to poll for
Description
This function is used to process all outstanding CQ entries. It does not offload CQ processing to a different context and does not ask for completion interrupts from the HCA. Using direct processing on CQ with non IB_POLL_DIRECT type may trigger concurrent processing.
Note
do not pass -1 as budget unless it is guaranteed that the number
of completions that will be processed is small.
__ib_alloc_cq() #
struct ib_cq * allocate a completion queue
Parameters
struct ib_device *dev: device to allocate the CQ forvoid *private: driver private data, accessible from cq->cq_contextint nr_cqe: number of CQEs to allocateint comp_vector: HCA completion vectors for this CQenum ib_poll_context poll_ctx: context to poll the CQ from.const char *caller: module owner name.
Description
This is the proper interface to allocate a CQ for in-kernel users. A CQ allocated with this interface will automatically be polled from the specified context. The ULP must use wr->wr_cqe instead of wr->wr_id to use this CQ abstraction.
__ib_alloc_cq_any() #
struct ib_cq * allocate a completion queue
Parameters
struct ib_device *dev: device to allocate the CQ forvoid *private: driver private data, accessible from cq->cq_contextint nr_cqe: number of CQEs to allocateenum ib_poll_context poll_ctx: context to poll the CQ fromconst char *caller: module owner name
Description
Attempt to spread ULP Completion Queues over each device's interrupt vectors. A simple best-effort mechanism is used.
ib_free_cq() #
void free a completion queue
Parameters
struct ib_cq *cq: completion queue to free.
ib_cq_pool_get() #
struct ib_cq * Find the least used completion queue that matches a given cpu hint (or least used for wild card affinity) and fits nr_cqe.
Parameters
struct ib_device *dev: rdma deviceunsigned int nr_cqe: number of needed cqe entriesint comp_vector_hint: completion vector hint (-1) for the driver to assign a comp vector based on internal counterenum ib_poll_context poll_ctx: cq polling context
Description
Finds a cq that satisfies comp_vector_hint and nr_cqe requirements and claim entries in it for us. In case there is no available cq, allocate a new cq with the requirements and add it to the device pool. IB_POLL_DIRECT cannot be used for shared cqs so it is not a valid value for poll_ctx.
ib_cq_pool_put() #
void Return a CQ taken from a shared pool.
Parameters
struct ib_cq *cq: The CQ to return.unsigned int nr_cqe: The max number of cqes that the user had requested.
ib_cm_listen() #
int Initiates listening on the specified service ID for connection and service ID resolution requests.
Parameters
struct ib_cm_id *cm_id: Connection identifier associated with the listen request.__be64 service_id: Service identifier matched against incoming connection and service ID resolution requests. The service ID should be specified network-byte order. If set to IB_CM_ASSIGN_SERVICE_ID, the CM will assign a service ID to the caller.
ib_cm_insert_listen() #
struct ib_cm_id * Create a new listening ib_cm_id and listen on the given service ID.
Parameters
struct ib_device *device: Device associated with the cm_id. All related communication will be associated with the specified device.ib_cm_handler cm_handler: Callback invoked to notify the user of CM events.__be64 service_id: Service identifier matched against incoming connection and service ID resolution requests. The service ID should be specified network-byte order. If set to IB_CM_ASSIGN_SERVICE_ID, the CM will assign a service ID to the caller.
Description
If there's an existing ID listening on that same device and service ID, return it.
Callers should call ib_destroy_cm_id when done with the listener ID.
rdma_rw_ctx_init() #
int initialize a RDMA READ/WRITE context
Parameters
struct rdma_rw_ctx *ctx: context to initializestruct ib_qp *qp: queue pair to operate onu32 port_num: port num to which the connection is boundstruct scatterlist *sg: scatterlist to READ/WRITE from/tou32 sg_cnt: number of entries in sgu32 sg_offset: current byte offset into sgu64 remote_addr: remote address to read/write (relative to rkey)u32 rkey: remote key to operate onenum dma_data_direction dir:DMA_TO_DEVICEfor RDMA WRITE,DMA_FROM_DEVICEfor RDMA READ
Description
Returns the number of WQEs that will be needed on the workqueue if successful, or a negative error code.
rdma_rw_ctx_init_bvec() #
int initialize a RDMA READ/WRITE context from bio_vec
Parameters
struct rdma_rw_ctx *ctx: context to initializestruct ib_qp *qp: queue pair to operate onu32 port_num: port num to which the connection is boundconst struct bio_vec *bvecs: bio_vec array to READ/WRITE from/tou32 nr_bvec: number of entries in bvecsstruct bvec_iter iter: bvec iterator describing offset and lengthu64 remote_addr: remote address to read/write (relative to rkey)u32 rkey: remote key to operate onenum dma_data_direction dir:DMA_TO_DEVICEfor RDMA WRITE,DMA_FROM_DEVICEfor RDMA READ
Description
Maps the bio_vec array directly, avoiding intermediate scatterlist conversion. Supports MR registration for iWARP devices and force_mr mode.
Returns the number of WQEs that will be needed on the workqueue if successful, or a negative error code:
- -EINVAL - nr_bvec is zero or iter.bi_size is zero
- -ENOMEM - DMA mapping or memory allocation failed
rdma_rw_ctx_signature_init() #
int initialize a RW context with signature offload
Parameters
struct rdma_rw_ctx *ctx: context to initializestruct ib_qp *qp: queue pair to operate onu32 port_num: port num to which the connection is boundstruct scatterlist *sg: scatterlist to READ/WRITE from/tou32 sg_cnt: number of entries in sgstruct scatterlist *prot_sg: scatterlist to READ/WRITE protection information from/tou32 prot_sg_cnt: number of entries in prot_sgstruct ib_sig_attrs *sig_attrs: signature offloading algorithmsu64 remote_addr: remote address to read/write (relative to rkey)u32 rkey: remote key to operate onenum dma_data_direction dir:DMA_TO_DEVICEfor RDMA WRITE,DMA_FROM_DEVICEfor RDMA READ
Description
Returns the number of WQEs that will be needed on the workqueue if successful, or a negative error code.
rdma_rw_ctx_wrs() #
struct ib_send_wr * return chain of WRs for a RDMA READ or WRITE operation
Parameters
struct rdma_rw_ctx *ctx: context to operate onstruct ib_qp *qp: queue pair to operate onu32 port_num: port num to which the connection is boundstruct ib_cqe *cqe: completion queue entry for the last WRstruct ib_send_wr *chain_wr: WR to append to the posted chain
Description
Return the WR chain for the set of RDMA READ/WRITE operations described by ctx, as well as any memory registration operations needed. If chain_wr is non-NULL the WR it points to will be appended to the chain of WRs posted. If chain_wr is not set cqe must be set so that the caller gets a completion notification.
rdma_rw_ctx_post() #
int post a RDMA READ or RDMA WRITE operation
Parameters
struct rdma_rw_ctx *ctx: context to operate onstruct ib_qp *qp: queue pair to operate onu32 port_num: port num to which the connection is boundstruct ib_cqe *cqe: completion queue entry for the last WRstruct ib_send_wr *chain_wr: WR to append to the posted chain
Description
Post the set of RDMA READ/WRITE operations described by ctx, as well as any memory registration operations needed. If chain_wr is non-NULL the WR it points to will be appended to the chain of WRs posted. If chain_wr is not set cqe must be set so that the caller gets a completion notification.
rdma_rw_ctx_destroy() #
void release all resources allocated by rdma_rw_ctx_init
Parameters
struct rdma_rw_ctx *ctx: context to releasestruct ib_qp *qp: queue pair to operate onu32 port_num: port num to which the connection is boundstruct scatterlist *sg: scatterlist that was used for the READ/WRITEu32 sg_cnt: number of entries in sgenum dma_data_direction dir:DMA_TO_DEVICEfor RDMA WRITE,DMA_FROM_DEVICEfor RDMA READ
rdma_rw_ctx_destroy_bvec() #
void release resources from rdma_rw_ctx_init_bvec
Parameters
struct rdma_rw_ctx *ctx: context to releasestruct ib_qp *qp: queue pair to operate onu32 __maybe_unused port_num: port num to which the connection is bound (unused)const struct bio_vec __maybe_unused *bvecs: bio_vec array that was used for the READ/WRITE (unused)u32 nr_bvec: number of entries in bvecsenum dma_data_direction dir:DMA_TO_DEVICEfor RDMA WRITE,DMA_FROM_DEVICEfor RDMA READ
Description
Releases all resources allocated by a successful rdma_rw_ctx_init_bvec()
call. Must not be called if rdma_rw_ctx_init_bvec() returned an error.
The port_num and bvecs parameters are unused but present for API
symmetry with rdma_rw_ctx_destroy().
rdma_rw_ctx_destroy_signature() #
void release all resources allocated by rdma_rw_ctx_signature_init
Parameters
struct rdma_rw_ctx *ctx: context to releasestruct ib_qp *qp: queue pair to operate onu32 port_num: port num to which the connection is boundstruct scatterlist *sg: scatterlist that was used for the READ/WRITEu32 sg_cnt: number of entries in sgstruct scatterlist *prot_sg: scatterlist that was used for the READ/WRITE of the PIu32 prot_sg_cnt: number of entries in prot_sgenum dma_data_direction dir:DMA_TO_DEVICEfor RDMA WRITE,DMA_FROM_DEVICEfor RDMA READ
rdma_rw_mr_factor() #
unsigned int return number of MRs required for a payload
Parameters
struct ib_device *device: device handling the connectionu32 port_num: port num to which the connection is boundunsigned int maxpages: maximum payload pages per rdma_rw_ctx
Description
Returns the number of MRs the device requires to move maxpayload bytes. The returned value is used during transport creation to compute max_rdma_ctxts and the size of the transport's Send and Send Completion Queues.
rdma_rw_max_send_wr() #
unsigned int compute max Send WRs needed for RDMA R/W contexts
Parameters
struct ib_device *dev: RDMA deviceu32 port_num: port numberunsigned int max_rdma_ctxs: number of rdma_rw_ctx structuresu32 create_flags: QP create flags (pass IB_QP_CREATE_INTEGRITY_EN if data integrity will be enabled on the QP)
Description
Returns the total number of Send Queue entries needed for max_rdma_ctxs. The result accounts for memory registration and invalidation work requests when the device requires them.
ULPs use this to size Send Queues and Send CQs before creating a Queue Pair.
rdma_dev_access_netns() #
bool Return whether an rdma device can be accessed from a specified net namespace or not.
Parameters
const struct ib_device *dev: Pointer to rdma device which needs to be checkedconst struct net *net: Pointer to net namesapce for which access to be checked
Description
When the rdma device is in shared mode, it ignores the net namespace. When the rdma device is exclusive to a net namespace, rdma device net namespace is checked against the specified one.
rdma_dev_has_raw_cap() #
bool Returns whether a specified rdma device has CAP_NET_RAW capability or not.
Parameters
const struct ib_device *dev: Pointer to rdma device whose capability to be checked
Description
Returns true if a rdma device's owning user namespace has CAP_NET_RAW capability, otherwise false. When rdma subsystem is in legacy shared network, namespace mode, the default net namespace is considered.
ib_device_put() #
void Release IB device reference
Parameters
struct ib_device *device: device whose reference to be released
Description
ib_device_put() releases reference to the IB device to allow it to be
unregistered and eventually free.
_ib_alloc_device() #
struct ib_device * allocate an IB device struct
Parameters
size_t size: size of structure to allocatestruct net *net: network namespace device should be located in, namespace must stay valid untilib_register_device()is completed.
Description
Low-level drivers should use ib_alloc_device() to allocate struct ib_device. size is the size of the structure to be allocated,
including any private data used by the low-level driver.
ib_dealloc_device() must be used to free structures allocated with
ib_alloc_device().
ib_dealloc_device() #
void free an IB device struct
Parameters
struct ib_device *device: structure to free
Description
Free a structure allocated with ib_alloc_device().
ib_port_immutable_read() #
const struct ib_port_immutable* Read rdma port's immutable data
Parameters
struct ib_device *dev: IB deviceunsigned int port: port number whose immutable data to read. It starts with index 1 and valid upto includingrdma_end_port().
ib_register_device() #
int Register an IB device with IB core
Parameters
struct ib_device *device: Device to registerconst char *name: unique string device name. This may include a '%' which will cause a unique index to be added to the passed device name.struct device *dma_device: pointer to a DMA-capable device. IfNULL, then the IB device will be used. In this case the caller should fully setup the ibdev for DMA. This usually means using dma_virt_ops.
Description
Low-level drivers use ib_register_device() to register their
devices with the IB core. All registered clients will receive a
callback for each device that is added. device must be allocated
with ib_alloc_device().
If the driver uses ops.dealloc_driver and calls any ib_unregister_device()
asynchronously then the device pointer may become freed as soon as this
function returns.
ib_unregister_device() #
void Unregister an IB device
Parameters
struct ib_device *ib_dev: The device to unregister
Description
Unregister an IB device. All clients will receive a remove callback.
Callers should call this routine only once, and protect against races with registration. Typically it should only be called as part of a remove callback in an implementation of driver core's struct device_driver and related.
If ops.dealloc_driver is used then ib_dev will be freed upon return from this function.
ib_unregister_device_and_put() #
void Unregister a device while holding a 'get'
Parameters
struct ib_device *ib_dev: The device to unregister
Description
This is the same as ib_unregister_device(), except it includes an internal
ib_device_put() that should match a 'get' obtained by the caller.
It is safe to call this routine concurrently from multiple threads while holding the 'get'. When the function returns the device is fully unregistered.
Drivers using this flow MUST use the driver_unregister callback to clean up their resources associated with the device and dealloc it.
ib_unregister_driver() #
void Unregister all IB devices for a driver
Parameters
enum rdma_driver_id driver_id: The driver to unregister
Description
This implements a fence for device unregistration. It only returns once all devices associated with the driver_id have fully completed their unregistration and returned from ib_unregister_device*().
If device's are not yet unregistered it goes ahead and starts unregistering them.
This does not block creation of new devices with the given driver_id, that is the responsibility of the caller.
ib_unregister_device_queued() #
void Unregister a device using a work queue
Parameters
struct ib_device *ib_dev: The device to unregister
Description
This schedules an asynchronous unregistration using a WQ for the device. A driver should use this to avoid holding locks while doing unregistration, such as holding the RTNL lock.
Drivers using this API must use ib_unregister_driver before module unload to ensure that all scheduled unregistrations have completed.
ib_register_client() #
int Register an IB client
Parameters
struct ib_client *client: Client to register
Description
Upper level users of the IB drivers can use ib_register_client() to
register callbacks for IB device addition and removal. When an IB
device is added, each registered client's add method will be called
(in the order the clients were registered), and when a device is
removed, each client's remove method will be called (in the reverse
order that clients were registered). In addition, when
ib_register_client() is called, the client will receive an add
callback for all devices already registered.
ib_unregister_client() #
void Unregister an IB client
Parameters
struct ib_client *client: Client to unregister
Description
Upper level users use ib_unregister_client() to remove their client
registration. When ib_unregister_client() is called, the client
will receive a remove callback for each IB device still registered.
This is a full fence, once it returns no client callbacks will be called, or are running in another thread.
ib_set_client_data() #
void Set IB client context
Parameters
struct ib_device *device: Device to set context forstruct ib_client *client: Client to set context forvoid *data: Context to set
Description
ib_set_client_data() sets client context data that can be retrieved with
ib_get_client_data(). This can only be called while the client is
registered to the device, once the ib_client remove() callback returns this
cannot be called.
ib_register_event_handler() #
void Register an IB event handler
Parameters
struct ib_event_handler *event_handler: Handler to register
Description
ib_register_event_handler() registers an event handler that will be
called back when asynchronous IB events occur (as defined in
chapter 11 of the InfiniBand Architecture Specification). This
callback occurs in workqueue context.
ib_unregister_event_handler() #
void Unregister an event handler
Parameters
struct ib_event_handler *event_handler: Handler to unregister
Description
Unregister an event handler registered with
ib_register_event_handler().
ib_query_port() #
int Query IB port attributes
Parameters
struct ib_device *device: Device to queryu32 port_num: Port number to querystruct ib_port_attr *port_attr: Port attributes
Description
ib_query_port() returns the attributes of a port through the
port_attr pointer.
ib_device_set_netdev() #
int Associate the ib_dev with an underlying net_device
Parameters
struct ib_device *ib_dev: Device to modifystruct net_device *ndev: net_device to affiliate, may be NULLu32 port: IB port the net_device is connected to
Description
Drivers should use this to link the ib_device to a netdev so the netdev shows up in interfaces like ib_enum_roce_netdev. Only one netdev may be affiliated with any port.
The caller must ensure that the given ndev is not unregistered or
unregistering, and that either the ib_device is unregistered or
ib_device_set_netdev() is called with NULL when the ndev sends a
NETDEV_UNREGISTER event.
ib_query_netdev_port() #
int Query the port number of a net_device associated with an ibdev
Parameters
struct ib_device *ibdev: IB devicestruct net_device *ndev: Network deviceu32 *port: IB port the net_device is connected to
ib_device_get_by_netdev() #
struct ib_device * Find an IB device associated with a netdev
Parameters
struct net_device *ndev: netdev to locateenum rdma_driver_id driver_id: The driver ID that must match (RDMA_DRIVER_UNKNOWN matches all)
Description
Find and hold an ib_device that is associated with a netdev via
ib_device_set_netdev(). The caller must call ib_device_put() on the
returned pointer.
ib_query_pkey() #
int Get P_Key table entry
Parameters
struct ib_device *device: Device to queryu32 port_num: Port number to queryu16 index: P_Key table index to queryu16 *pkey: Returned P_Key
Description
ib_query_pkey() fetches the specified P_Key table entry.
ib_modify_device() #
int Change IB device attributes
Parameters
struct ib_device *device: Device to modifyint device_modify_mask: Mask of attributes to changestruct ib_device_modify *device_modify: New attribute values
Description
ib_modify_device() changes a device's attributes as specified by
the device_modify_mask and device_modify structure.
ib_modify_port() #
int Modifies the attributes for the specified port.
Parameters
struct ib_device *device: The device to modify.u32 port_num: The number of the port to modify.int port_modify_mask: Mask used to specify which attributes of the port to change.struct ib_port_modify *port_modify: New attribute values for the port.
Description
ib_modify_port() changes a port's attributes as specified by the
port_modify_mask and port_modify structure.
ib_find_gid() #
int Returns the port number and GID table index where a specified GID value occurs. Its searches only for IB link layer.
Parameters
struct ib_device *device: The device to query.union ib_gid *gid: The GID value to search for.u32 *port_num: The port number of the device where the GID value was found.u16 *index: The index into the GID table where the GID was found. This parameter may be NULL.
ib_find_pkey() #
int Returns the PKey table index where a specified PKey value occurs.
Parameters
struct ib_device *device: The device to query.u32 port_num: The port number of the device to search for the PKey.u16 pkey: The PKey value to search for.u16 *index: The index into the PKey table where the PKey was found.
ib_get_net_dev_by_params() #
struct net_device * Return the appropriate net_dev for a received CM request
Parameters
struct ib_device *dev: An RDMA device on which the request has been received.u32 port: Port number on the RDMA device.u16 pkey: The Pkey the request came on.const union ib_gid *gid: A GID that the net_dev uses to communicate.const struct sockaddr *addr: Contains the IP address that the request specified as its destination.
__ib_alloc_pd() #
struct ib_pd * Allocates an unused protection domain.
Parameters
struct ib_device *device: The device on which to allocate the protection domain.unsigned int flags: protection domain flagsconst char *caller: caller's build-time module name
Description
A protection domain object provides an association between QPs, shared receive queues, address handles, memory regions, and memory windows.
Every PD has a local_dma_lkey which can be used as the lkey value for local memory operations.
ib_dealloc_pd_user() #
int Deallocates a protection domain.
Parameters
struct ib_pd *pd: The protection domain to deallocate.struct ib_udata *udata: Valid user data or NULL for kernel object
Description
It is an error to call this function while any resources in the pd still exist. The caller is responsible to synchronously destroy them and guarantee no new allocations will happen.
rdma_copy_ah_attr() #
void Copy rdma ah attribute from source to destination.
Parameters
struct rdma_ah_attr *dest: Pointer to destination ah_attr. Contents of the destination pointer is assumed to be invalid and attribute are overwritten.const struct rdma_ah_attr *src: Pointer to source ah_attr.
rdma_replace_ah_attr() #
void Replace valid ah_attr with new one.
Parameters
struct rdma_ah_attr *old: Pointer to existing ah_attr which needs to be replaced. old is assumed to be valid or zero'dconst struct rdma_ah_attr *new: Pointer to the new ah_attr.
Description
rdma_replace_ah_attr() first releases any reference in the old ah_attr if
old the ah_attr is valid; after that it copies the new attribute and holds
the reference to the replaced ah_attr.
rdma_move_ah_attr() #
void Move ah_attr pointed by source to destination.
Parameters
struct rdma_ah_attr *dest: Pointer to destination ah_attr to copy to. dest is assumed to be valid or zero'dstruct rdma_ah_attr *src: Pointer to the new ah_attr.
Description
rdma_move_ah_attr() first releases any reference in the destination ah_attr
if it is valid. This also transfers ownership of internal references from
src to dest, making src invalid in the process. No new reference of the src
ah_attr is taken.
rdma_create_ah() #
struct ib_ah * Creates an address handle for the given address vector.
Parameters
struct ib_pd *pd: The protection domain associated with the address handle.struct rdma_ah_attr *ah_attr: The attributes of the address vector.u32 flags: Create address handle flags (see enum rdma_create_ah_flags).
Description
It returns 0 on success and returns appropriate error code on error. The address handle is used to reference a local or global destination in all UD QP post sends.
rdma_create_user_ah() #
struct ib_ah * Creates an address handle for the given address vector. It resolves destination mac address for ah attribute of RoCE type.
Parameters
struct ib_pd *pd: The protection domain associated with the address handle.struct rdma_ah_attr *ah_attr: The attributes of the address vector.struct ib_udata *udata: pointer to user's input output buffer information need by provider driver.
Description
It returns 0 on success and returns appropriate error code on error. The address handle is used to reference a local or global destination in all UD QP post sends.
rdma_move_grh_sgid_attr() #
void Sets the sgid attribute of GRH, taking ownership of the reference
Parameters
struct rdma_ah_attr *attr: Pointer to AH attribute structureunion ib_gid *dgid: Destination GIDu32 flow_label: Flow labelu8 hop_limit: Hop limitu8 traffic_class: traffic classconst struct ib_gid_attr *sgid_attr: Pointer to SGID attribute
Description
This takes ownership of the sgid_attr reference. The caller must ensure
rdma_destroy_ah_attr() is called before destroying the rdma_ah_attr after
calling this function.
rdma_destroy_ah_attr() #
void Release reference to SGID attribute of ah attribute.
Parameters
struct rdma_ah_attr *ah_attr: Pointer to ah attribute
Description
Release reference to the SGID attribute of the ah attribute if it is non NULL. It is safe to call this multiple times, and safe to call it on a zero initialized ah_attr.
ib_create_srq_user() #
struct ib_srq * Creates a SRQ associated with the specified protection domain.
Parameters
struct ib_pd *pd: The protection domain associated with the SRQ.struct ib_srq_init_attr *srq_init_attr: A list of initial attributes required to create the SRQ. If SRQ creation succeeds, then the attributes are updated to the actual capabilities of the created SRQ.struct ib_usrq_object *uobject: uobject pointer if this is not a kernel SRQstruct ib_udata *udata: udata pointer if this is not a kernel SRQ
Description
srq_attr->max_wr and srq_attr->max_sge are read the determine the
requested size of the SRQ, and set to the actual values allocated
on return. If ib_create_srq() succeeds, then max_wr and max_sge
will always be at least as large as the requested values.
ib_create_qp_user() #
struct ib_qp * Creates a QP associated with the specified protection domain.
Parameters
struct ib_device *dev: IB devicestruct ib_pd *pd: The protection domain associated with the QP.struct ib_qp_init_attr *attr: A list of initial attributes required to create the QP. If QP creation succeeds, then the attributes are updated to the actual capabilities of the created QP.struct ib_udata *udata: User datastruct ib_uqp_object *uobj: uverbs obectconst char *caller: caller's build-time module name
ib_modify_qp_with_udata() #
int Modifies the attributes for the specified QP.
Parameters
struct ib_qp *ib_qp: The QP to modify.struct ib_qp_attr *attr: On input, specifies the QP attributes to modify. On output, the current values of selected QP attributes are returned.int attr_mask: A bit-mask used to specify which attributes of the QP are being modified.struct ib_udata *udata: pointer to user's input output buffer information are being modified. It returns 0 on success and returns appropriate error code on error.
ib_alloc_mr() #
struct ib_mr * Allocates a memory region
Parameters
struct ib_pd *pd: protection domain associated with the regionenum ib_mr_type mr_type: memory region typeu32 max_num_sg: maximum sg entries available for registration.
Notes
Memory registeration page/sg lists must not exceed max_num_sg. For mr_type IB_MR_TYPE_MEM_REG, the total length cannot exceed max_num_sg * used_page_size.
ib_alloc_mr_integrity() #
struct ib_mr * Allocates an integrity memory region
Parameters
struct ib_pd *pd: protection domain associated with the regionu32 max_num_data_sg: maximum data sg entries available for registrationu32 max_num_meta_sg: maximum metadata sg entries available for registration
Notes
Memory registration page/sg lists must not exceed max_num_sg, also the integrity page/sg lists must not exceed max_num_meta_sg.
ib_alloc_xrcd_user() #
struct ib_xrcd * Allocates an XRC domain.
Parameters
struct ib_device *device: The device on which to allocate the XRC domain.struct inode *inode: inode to connect XRCDstruct ib_udata *udata: Valid user data or NULL for kernel object
ib_dealloc_xrcd_user() #
int Deallocates an XRC domain.
Parameters
struct ib_xrcd *xrcd: The XRC domain to deallocate.struct ib_udata *udata: Valid user data or NULL for kernel object
ib_create_wq() #
struct ib_wq * Creates a WQ associated with the specified protection domain.
Parameters
struct ib_pd *pd: The protection domain associated with the WQ.struct ib_wq_init_attr *wq_attr: A list of initial attributes required to create the WQ. If WQ creation succeeds, then the attributes are updated to the actual capabilities of the created WQ.
Description
wq_attr->max_wr and wq_attr->max_sge determine
the requested size of the WQ, and set to the actual values allocated
on return.
If ib_create_wq() succeeds, then max_wr and max_sge will always be
at least as large as the requested values.
ib_destroy_wq_user() #
int Destroys the specified user WQ.
Parameters
struct ib_wq *wq: The WQ to destroy.struct ib_udata *udata: Valid user data
ib_map_mr_sg_pi() #
int Map the dma mapped SG lists for PI (protection information) and set an appropriate memory region for registration.
Parameters
struct ib_mr *mr: memory regionstruct scatterlist *data_sg: dma mapped scatterlist for dataint data_sg_nents: number of entries in data_sgunsigned int *data_sg_offset: offset in bytes into data_sgstruct scatterlist *meta_sg: dma mapped scatterlist for metadataint meta_sg_nents: number of entries in meta_sgunsigned int *meta_sg_offset: offset in bytes into meta_sgunsigned int page_size: page vector desired page size
Description
Constraints:
- The MR must be allocated with type IB_MR_TYPE_INTEGRITY.
After this completes successfully, the memory region is ready for registration.
Return
0 on success.
ib_map_mr_sg() #
int Map the largest prefix of a dma mapped SG list and set it the memory region.
Parameters
struct ib_mr *mr: memory regionstruct scatterlist *sg: dma mapped scatterlistint sg_nents: number of entries in sgunsigned int *sg_offset: offset in bytes into sgunsigned int page_size: page vector desired page size
Description
Constraints:
- The first sg element is allowed to have an offset.
- Each sg element must either be aligned to page_size or virtually contiguous to the previous element. In case an sg element has a non-contiguous offset, the mapping prefix will not include it.
- The last sg element is allowed to have length less than page_size.
- If sg_nents total byte length exceeds the mr max_num_sge * page_size then only max_num_sg entries will be mapped.
- If the MR was allocated with type IB_MR_TYPE_SG_GAPS, none of these constraints holds and the page_size argument is ignored.
Returns the number of sg elements that were mapped to the memory region.
After this completes successfully, the memory region is ready for registration.
ib_sg_to_pages() #
int Convert the largest prefix of a sg list to a page vector
Parameters
-
struct ib_mr *mr: memory region -
struct scatterlist *sgl: dma mapped scatterlist -
int sg_nents: number of entries in sg -
unsigned int *sg_offset_p:==== ======================================================= IN start offset in bytes into sg OUT offset in bytes for element n of the sg of the first byte that has not been processed where n is the return value of this function. ==== ======================================================= -
int (*set_page)(struct ib_mr *, u64): driver page assignment function pointer
Description
Core service helper for drivers to convert the largest prefix of given sg list to a page vector. The sg list prefix converted is the prefix that meet the requirements of ib_map_mr_sg.
Returns the number of sg elements that were assigned to a page vector.
ib_drain_sq() #
void Block until all SQ CQEs have been consumed by the application.
Parameters
struct ib_qp *qp: queue pair to drain
Description
If the device has a provider-specific drain function, then
call that. Otherwise call the generic drain function
__ib_drain_sq().
The caller must:
ensure there is room in the CQ and SQ for the drain work request and completion.
allocate the CQ using ib_alloc_cq().
ensure that there are no other contexts that are posting WRs concurrently. Otherwise the drain is not guaranteed.
ib_drain_rq() #
void Block until all RQ CQEs have been consumed by the application.
Parameters
struct ib_qp *qp: queue pair to drain
Description
If the device has a provider-specific drain function, then
call that. Otherwise call the generic drain function
__ib_drain_rq().
The caller must:
ensure there is room in the CQ and RQ for the drain work request and completion.
allocate the CQ using ib_alloc_cq().
ensure that there are no other contexts that are posting WRs concurrently. Otherwise the drain is not guaranteed.
ib_drain_qp() #
void Block until all CQEs have been consumed by the application on both the RQ and SQ.
Parameters
struct ib_qp *qp: queue pair to drain
Description
The caller must:
ensure there is room in the CQ(s), SQ, and RQ for drain work requests and completions.
allocate the CQs using ib_alloc_cq().
ensure that there are no other contexts that are posting WRs concurrently. Otherwise the drain is not guaranteed.
rdma_alloc_hw_stats_struct() #
struct rdma_hw_stats * Helper function to allocate dynamic struct for the drivers.
Parameters
const struct rdma_stat_desc *descs: array of static descriptorsint num_counters: number of elements in arrayunsigned long lifespan: milliseconds between updates
rdma_free_hw_stats_struct() #
void Helper function to release rdma_hw_stats
Parameters
struct rdma_hw_stats *stats: statistics to release
ib_pack() #
void Pack a structure into a buffer
Parameters
const struct ib_field *desc: Array of structure field descriptionsint desc_len: Number of entries in descvoid *structure: Structure to pack fromvoid *buf: Buffer to pack into
Description
ib_pack() packs a list of structure fields into a buffer,
controlled by the array of fields in desc.
ib_unpack() #
void Unpack a buffer into a structure
Parameters
const struct ib_field *desc: Array of structure field descriptionsint desc_len: Number of entries in descvoid *buf: Buffer to unpack fromvoid *structure: Structure to unpack into
Description
ib_pack() unpacks a list of structure fields from a buffer,
controlled by the array of fields in desc.
ib_sa_cancel_query() #
void try to cancel an SA query
Parameters
int id: ID of query to cancelstruct ib_sa_query *query: query pointer to cancel
Description
Try to cancel an SA query. If the id and query don't match up or the query has already completed, nothing is done. Otherwise the query is canceled and will complete with a status of -EINTR.
ib_init_ah_attr_from_path() #
int Initialize address handle attributes based on an SA path record.
Parameters
struct ib_device *device: Device associated ah attributes initialization.u32 port_num: Port on the specified device.struct sa_path_rec *rec: path record entry to use for ah attributes initialization.struct rdma_ah_attr *ah_attr: address handle attributes to initialization from path record.const struct ib_gid_attr *gid_attr: SGID attribute to consider during initialization.
Description
When ib_init_ah_attr_from_path() returns success,
(a) for IB link layer it optionally contains a reference to SGID attribute
when GRH is present for IB link layer.
(b) for RoCE link layer it contains a reference to SGID attribute.
User must invoke rdma_destroy_ah_attr() to release reference to SGID
attributes which are initialized using ib_init_ah_attr_from_path().
ib_sa_path_rec_get() #
int Start a Path get query
Parameters
struct ib_sa_client *client: SA clientstruct ib_device *device: device to send query onu32 port_num: port number to send query onstruct sa_path_rec *rec: Path Record to send in queryib_sa_comp_mask comp_mask: component mask to send in queryunsigned long timeout_ms: time to wait for responsegfp_t gfp_mask: GFP mask to use for internal allocationsvoid (*callback)(int status, struct sa_path_rec *resp, unsigned int num_paths, void *context): function called when query completes, times out or is canceledvoid *context: opaque user context passed to callbackstruct ib_sa_query **sa_query: query context, used to cancel query
Description
Send a Path Record Get query to the SA to look up a path. The callback function will be called when the query completes (or fails); status is 0 for a successful response, -EINTR if the query is canceled, -ETIMEDOUT is the query timed out, or -EIO if an error occurred sending the query. The resp parameter of the callback is only valid if status is 0.
If the return value of ib_sa_path_rec_get() is negative, it is an
error code. Otherwise it is a query ID that can be used to cancel
the query.
ib_sa_service_rec_get() #
int Start a Service get query
Parameters
struct ib_sa_client *client: SA clientstruct ib_device *device: device to send query onu32 port_num: port number to send query onstruct sa_service_rec *rec: Service Record to send in queryib_sa_comp_mask comp_mask: component mask to send in queryunsigned long timeout_ms: time to wait for responsegfp_t gfp_mask: GFP mask to use for internal allocationsvoid (*callback)(int status, struct sa_service_rec *resp, unsigned int num_services, void *context): function called when query completes, times out or is canceledvoid *context: opaque user context passed to callbackstruct ib_sa_query **sa_query: query context, used to cancel query
Description
Send a Service Record Get query to the SA to look up a path. The callback function will be called when the query completes (or fails); status is 0 for a successful response, -EINTR if the query is canceled, -ETIMEDOUT is the query timed out, or -EIO if an error occurred sending the query. The resp parameter of the callback is only valid if status is 0.
If the return value of ib_sa_service_rec_get() is negative, it is an
error code. Otherwise it is a query ID that can be used to cancel
the query.
ib_ud_header_init() #
int Initialize UD header structure
Parameters
int payload_bytes: Length of packet payloadint lrh_present: specify if LRH is presentint eth_present: specify if Eth header is presentint vlan_present: packet is tagged vlanint grh_present: GRH flag (if non-zero, GRH will be included)int ip_version: if non-zero, IP header, V4 or V6, will be includedint udp_present: if non-zero, UDP header will be includedint immediate_present: specify if immediate data is presentstruct ib_ud_header *header: Structure to initialize
ib_ud_header_pack() #
int Pack UD header struct into wire format
Parameters
struct ib_ud_header *header: UD header structvoid *buf: Buffer to pack into
Description
ib_ud_header_pack() packs the UD header structure header into wire
format in the buffer buf.
ib_umem_find_best_pgsz() #
unsigned long Find best HW page size to use for this MR
Parameters
struct ib_umem *umem: umem structunsigned long pgsz_bitmap: bitmap of HW supported page sizesunsigned long virt: IOVA
Description
This helper is intended for HW that support multiple page sizes but can do only a single page size in an MR.
Returns 0 if the umem requires page sizes not supported by the driver to be mapped. Drivers always supporting PAGE_SIZE or smaller will never see a 0 result.
ib_umem_get() #
struct ib_umem * Pin and DMA map userspace memory.
Parameters
struct ib_device *device: IB device to connect UMEMunsigned long addr: userspace virtual address to start atsize_t size: length of region to pinint access: IB_ACCESS_xxx flags for memory being pinned
ib_umem_release() #
void release memory pinned with ib_umem_get
Parameters
struct ib_umem *umem: umem struct to release
ib_umem_odp_alloc_implicit() #
struct ib_umem_odp * Allocate a parent implicit ODP umem
Parameters
struct ib_device *device: IB device to create UMEMint access: ib_reg_mr access flags
Description
Implicit ODP umems do not have a VA range and do not have any page lists. They exist only to hold the per_mm reference to help the driver create children umems.
ib_umem_odp_alloc_child() #
struct ib_umem_odp * Allocate a child ODP umem under an implicit parent ODP umem
Parameters
struct ib_umem_odp *root: The parent umem enclosing the child. This must be allocated usingib_alloc_implicit_odp_umem()unsigned long addr: The starting userspace VAsize_t size: The length of the userspace VAconst struct mmu_interval_notifier_ops *ops: MMU interval ops, currently only invalidate
ib_umem_odp_get() #
struct ib_umem_odp * Create a umem_odp for a userspace va
Parameters
struct ib_device *device: IB device struct to get UMEMunsigned long addr: userspace virtual address to start atsize_t size: length of region to pinint access: IB_ACCESS_xxx flags for memory being pinnedconst struct mmu_interval_notifier_ops *ops: MMU interval ops, currently only invalidate
Description
The driver should use when the access flags indicate ODP memory. It avoids pinning, instead, stores the mm for future page fault handling in conjunction with MMU notifiers.
ib_umem_odp_map_dma_and_lock() #
int DMA map userspace memory in an ODP MR and lock it.
Parameters
struct ib_umem_odp *umem_odp: the umem to map and pinu64 user_virt: the address from which we need to map.u64 bcnt: the minimal number of bytes to pin and map. The mapping might be bigger due to alignment, and may also be smaller in case of an error pinning or mapping a page. The actual pages mapped is returned in the return value.u64 access_mask: bit mask of the requested access permissions for the given range.bool fault: is faulting required for the given range
Description
Maps the range passed in the argument to DMA addresses. Upon success the ODP MR will be locked to let caller complete its device page table update.
Returns the number of pages mapped in success, negative error code for failure.
RDMA Verbs transport library #
rvt_fast_reg_mr() #
int fast register physical MR
Parameters
struct rvt_qp *qp: the queue pair where the work request comes fromstruct ib_mr *ibmr: the memory region to be registeredu32 key: updated key for this memory regionint access: access flags for this memory region
Description
Returns 0 on success.
rvt_invalidate_rkey() #
int invalidate an MR rkey
Parameters
struct rvt_qp *qp: queue pair associated with the invalidate opu32 rkey: rkey to invalidate
Description
Returns 0 on success.
rvt_lkey_ok() #
int check IB SGE for validity and initialize
Parameters
struct rvt_lkey_table *rkt: table containing lkey to check SGE againststruct rvt_pd *pd: protection domainstruct rvt_sge *isge: outgoing internal SGEstruct rvt_sge *last_sge: last outgoing SGE writtenstruct ib_sge *sge: SGE to checkint acc: access flags
Description
Check the IB SGE for validity and initialize our internal version of it.
Increments the reference count when a new sge is stored.
Return
0 if compressed, 1 if added , otherwise returns -errno.
rvt_rkey_ok() #
int check the IB virtual address, length, and RKEY
Parameters
struct rvt_qp *qp: qp for validationstruct rvt_sge *sge: SGE stateu32 len: length of datau64 vaddr: virtual address to place datau32 rkey: rkey to checkint acc: access flags
Return
1 if successful, otherwise 0.
Description
increments the reference count upon success
rvt_compute_aeth() #
__be32 compute the AETH (syndrome + MSN)
Parameters
struct rvt_qp *qp: the queue pair to compute the AETH for
Description
Returns the AETH.
rvt_get_credit() #
void flush the send work queue of a QP
Parameters
struct rvt_qp *qp: the qp who's send work queue to flushu32 aeth: the Acknowledge Extended Transport Header
Description
The QP s_lock should be held.
rvt_restart_sge() #
u32 rewind the sge state for a wqe
Parameters
struct rvt_sge_state *ss: the sge state pointerstruct rvt_swqe *wqe: the wqe to rewindu32 len: the data length from the start of the wqe in bytes
Description
Returns the remaining data length.
rvt_check_ah() #
int validate the attributes of AH
Parameters
struct ib_device *ibdev: the ib devicestruct rdma_ah_attr *ah_attr: the attributes of the AH
Description
If driver supports a more detailed check_ah function call back to it otherwise just check the basics.
Return
0 on success
rvt_alloc_device() #
struct rvt_dev_info * allocate rdi
Parameters
size_t size: how big of a structure to allocateint nports: number of ports to allocate array slots for
Description
Use IB core device alloc to allocate space for the rdi which is assumed to be inside of the ib_device. Any extra space that drivers require should be included in size.
We also allocate a port array based on the number of ports.
Return
pointer to allocated rdi
rvt_dealloc_device() #
void deallocate rdi
Parameters
struct rvt_dev_info *rdi: structure to free
Description
Free a structure allocated with rvt_alloc_device()
rvt_register_device() #
int register a driver
Parameters
struct rvt_dev_info *rdi: main dev structure for all of rdmavt operations
Description
It is up to drivers to allocate the rdi and fill in the appropriate information.
Return
0 on success otherwise an errno.
rvt_unregister_device() #
void remove a driver
Parameters
struct rvt_dev_info *rdi: rvt dev struct
rvt_init_port() #
int init internal data for driver port
Parameters
struct rvt_dev_info *rdi: rvt_dev_info structstruct rvt_ibport *port: rvt portint port_index: 0 based index of ports, different from IB core port numu16 *pkey_table: pkey_table for port
Description
Keep track of a list of ports. No need to have a detach port. They persist until the driver goes away.
Return
always 0
rvt_cq_enter() #
bool add a new entry to the completion queue
Parameters
struct rvt_cq *cq: completion queuestruct ib_wc *entry: work completion entry to addbool solicited: true if entry is solicited
Description
This may be called with qp->s_lock held.
Return
return true on success, else return false if cq is full.
rvt_error_qp() #
int put a QP into the error state
Parameters
struct rvt_qp *qp: the QP to put into the error stateenum ib_wc_status err: the receive completion error to signal if a RWQE is active
Description
Flushes both send and receive work queues.
Return
true if last WQE event should be generated. The QP r_lock and s_lock should be held and interrupts disabled. If we are already in error state, just return.
rvt_get_rwqe() #
int copy the next RWQE into the QP's RWQE
Parameters
struct rvt_qp *qp: the QPbool wr_id_only: update qp->r_wr_id only, not qp->r_sge
Description
Return -1 if there is a local error, 0 if no RWQE is available, otherwise return 1.
Can be called from interrupt level.
rvt_comm_est() #
void handle trap with QP established
Parameters
struct rvt_qp *qp: the QP
rvt_add_rnr_timer() #
void add/start an rnr timer on the QP
Parameters
struct rvt_qp *qp: the QPu32 aeth: aeth of RNR timeout, simulated aeth for loopback
rvt_stop_rc_timers() #
void stop all timers
Parameters
struct rvt_qp *qp: the QP stop any pending timers
rvt_del_timers_sync() #
void wait for any timeout routines to exit
Parameters
struct rvt_qp *qp: the QP
rvt_qp_iter_init() #
struct rvt_qp_iter * initial for QP iteration
Parameters
struct rvt_dev_info *rdi: rvt devinfou64 v: u64 valuevoid (*cb)(struct rvt_qp *qp, u64 v): user-defined callback
Description
This returns an iterator suitable for iterating QPs in the system.
The cb is a user-defined callback and v is a 64-bit value passed to and relevant for processing in the cb. An example use case would be to alter QP processing based on criteria not part of the rvt_qp.
Use cases that require memory allocation to succeed must preallocate appropriately.
Return
a pointer to an rvt_qp_iter or NULL
rvt_qp_iter_next() #
int return the next QP in iter
Parameters
struct rvt_qp_iter *iter: the iterator
Description
Fine grained QP iterator suitable for use with debugfs seq_file mechanisms.
Updates iter->qp with the current QP when the return value is 0.
Return
0 - iter->qp is valid 1 - no more QPs
rvt_qp_iter() #
void iterate all QPs
Parameters
struct rvt_dev_info *rdi: rvt devinfou64 v: a 64-bit valuevoid (*cb)(struct rvt_qp *qp, u64 v): a callback
Description
This provides a way for iterating all QPs.
The cb is a user-defined callback and v is a 64-bit value passed to and relevant for processing in the cb. An example use case would be to alter QP processing based on criteria not part of the rvt_qp.
The code has an internal iterator to simplify non seq_file use cases.
rvt_copy_sge() #
void copy data to SGE memory
Parameters
struct rvt_qp *qp: associated QPstruct rvt_sge_state *ss: the SGE statevoid *data: the data to copyu32 length: the length of the databool release: boolean to release MRbool copy_last: do a separate copy of the last 8 bytes
rvt_ruc_loopback() #
void handle UC and RC loopback requests
Parameters
struct rvt_qp *sqp: the sending QP
Description
This is called from rvt_do_send() to forward a WQE addressed to the same HFI
Note that although we are single threaded due to the send engine, we still
have to protect against post_send(). We don't have to worry about
receive interrupts since this is a connected protocol and all packets
will pass through here.
rvt_mcast_find() #
struct rvt_mcast * search the global table for the given multicast GID/LID
Parameters
struct rvt_ibport *ibp: the IB port structureunion ib_gid *mgid: the multicast GID to search foru16 lid: the multicast LID portion of the multicast address (host order)
NOTE
It is valid to have 1 MLID with multiple MGIDs. It is not valid to have 1 MGID with multiple MLIDs.
Description
The caller is responsible for decrementing the reference count if found.
Return
NULL if not found.
Upper Layer Protocols #
iSCSI Extensions for RDMA (iSER) #
struct iser_data_buf #
iSER data buffer
Definition
;
Members
sg: pointer to the sg listsize: num entries of this sgdata_len: total buffer byte lendma_nents: returned by dma_map_sg
struct iser_mem_reg #
iSER memory registration info
Definition
;
Members
sge: memory region sg elementrkey: memory region remote keydesc: pointer to fast registration context
struct iser_tx_desc #
iSER TX descriptor
Definition
;
Members
iser_header: iser headeriscsi_header: iscsi headertype: command/control/dataoutdma_addr: header buffer dma_addresstx_sg: sg[0] points to iser/iscsi headers sg[1] optionally points to either of immediate data unsolicited data-out or controlnum_sge: number sges used on this TX taskcqe: completion handlermapped: Is the task header mappedreg_wr: registration WRsend_wr: send WRinv_wr: invalidate WR
struct iser_rx_desc #
iSER RX descriptor
Definition
;
Members
iser_header: iser headeriscsi_header: iscsi headerdata: received data segmentdma_addr: receive buffer dma addressrx_sg: ib_sge of receive buffercqe: completion handlerpad: for sense data TODO: Modify to maximum sense length supported
struct iser_login_desc #
iSER login descriptor
Definition
;
Members
req: pointer to login request bufferrsp: pointer to login response bufferreq_dma: DMA address of login request bufferrsp_dma: DMA address of login response buffersge: IB sge for login post recvcqe: completion handler
struct iser_device #
iSER device handle
Definition
;
Members
ib_device: RDMA devicepd: Protection Domain for this deviceevent_handler: IB events handle routineig_list: entry in devices listrefcount: Reference counter, dominated by open iser connections
struct iser_reg_resources #
Fast registration resources
Definition
;
Members
mr: memory regionsig_mr: signature memory region
struct iser_fr_desc #
Fast registration descriptor
Definition
;
Members
list: entry in connection fastreg poolrsc: data buffer registration resourcessig_protected: is region protected indicatorall_list: first and last list members
struct iser_fr_pool #
connection fast registration pool
Definition
;
Members
list: list of fastreg descriptorslock: protects fastreg poolsize: size of the poolall_list: first and last list members
struct ib_conn #
Infiniband related objects
Definition
;
Members
cma_id: rdma_cm connection maneger handleqp: Connection Queue-paircq: Connection completion queuecq_size: The number of max outstanding completionsdevice: reference to iser devicefr_pool: connection fast registration poolpi_support: Indicate device T10-PI supportreg_cqe: completion handler
struct iser_conn #
iSER connection context
Definition
;
Members
ib_conn: connection RDMA resourcesiscsi_conn: link to matching iscsi connectionep: transport handlestate: connection logical stateqp_max_recv_dtos: maximum number of data outs, corresponds to max number of post recvsmax_cmds: maximum cmds allowed for this connectionname: connection peer portalrelease_work: deferred work for release jobstate_mutex: protects iser onnection statestop_completion: conn_stop completionib_completion: RDMA cleanup completionup_completion: connection establishment completed (state is ISER_CONN_UP)conn_list: entry in ig conn listlogin_desc: login descriptorrx_descs: rx buffers array (cyclic buffer)num_rx_descs: number of rx descriptorsscsi_sg_tablesize: scsi host sg_tablesizepages_per_mr: maximum pages available for registrationsnd_w_inv: connection uses remote invalidation
struct iscsi_iser_task #
iser task context
Definition
;
Members
desc: TX descriptoriser_conn: link to iser connectionstatus: current task statussc: link to scsi commandcommand_sent: indicate if command was sentdir: iser data directionrdma_reg: task rdma registration descdata: iser data buffer descprot: iser protection buffer desc
struct iser_global #
iSER global context
Definition
;
Members
device_list_mutex: protects device_listdevice_list: iser devices global listconnlist_mutex: protects connlistconnlist: iser connections global listdesc_cache: kmem cache for tx dataout
iscsi_iser_pdu_alloc() #
int allocate an iscsi-iser PDU
Parameters
struct iscsi_task *task: iscsi taskuint8_t opcode: iscsi command opcode
Description
-
Netes: This routine can't fail, just assign iscsi task
hdr and max hdr size.
iser_initialize_task_headers() #
int Initialize task headers
Parameters
struct iscsi_task *task: iscsi taskstruct iser_tx_desc *tx_desc: iser tx descriptor
Notes
This routine may race with iser teardown flow for scsi error handling TMFs. So for TMF we should acquire the state mutex to avoid dereferencing the IB device which may have already been terminated.
iscsi_iser_task_init() #
int Initialize iscsi-iser task
Parameters
struct iscsi_task *task: iscsi task
Description
Initialize the task for the scsi command or mgmt command.
Return
Returns zero on success or -ENOMEM when failing to init task headers (dma mapping error).
iscsi_iser_mtask_xmit() #
int xmit management (immediate) task
Parameters
struct iscsi_conn *conn: iscsi connectionstruct iscsi_task *task: task management task
Notes
The function can return -EAGAIN in which case caller must call it again later, or recover. '0' return code means successful xmit.
iscsi_iser_task_xmit() #
int xmit iscsi-iser task
Parameters
struct iscsi_task *task: iscsi task
Return
zero on success or escalates $error on failure.
iscsi_iser_cleanup_task() #
void cleanup an iscsi-iser task
Parameters
struct iscsi_task *task: iscsi task
Notes
-
In case the RDMA device is already NULL (might have
been removed in DEVICE_REMOVAL CM event it will bail-out without doing dma unmapping.
iscsi_iser_check_protection() #
u8 check protection information status of task.
Parameters
struct iscsi_task *task: iscsi tasksector_t *sector: error sector if exsists (output)
Return
zero if no data-integrity errors have occurred 0x1: data-integrity error occurred in the guard-block 0x2: data-integrity error occurred in the reference tag 0x3: data-integrity error occurred in the application tag
Description
In addition the error sector is marked.
iscsi_iser_conn_create() #
struct iscsi_cls_conn * create a new iscsi-iser connection
Parameters
struct iscsi_cls_session *cls_session: iscsi class connectionuint32_t conn_idx: connection index within the session (for MCS)
Return
iscsi_cls_conn when iscsi_conn_setup succeeds or NULL otherwise.
iscsi_iser_conn_bind() #
int bind iscsi and iser connection structures
Parameters
struct iscsi_cls_session *cls_session: iscsi class sessionstruct iscsi_cls_conn *cls_conn: iscsi class connectionuint64_t transport_eph: transport end-point handleint is_leading: indicate if this is the session leading connection (MCS)
Return
zero on success, $error if iscsi_conn_bind fails and -EINVAL in case end-point doesn't exists anymore or iser connection state is not UP (teardown already started).
iscsi_iser_conn_start() #
int start iscsi-iser connection
Parameters
struct iscsi_cls_conn *cls_conn: iscsi class connection
Notes
-
Here iser intialize (or re-initialize) stop_completion as
from this point iscsi must call conn_stop in session/connection teardown so iser transport must wait for it.
iscsi_iser_conn_stop() #
void stop iscsi-iser connection
Parameters
struct iscsi_cls_conn *cls_conn: iscsi class connectionint flag: indicate if recover or terminate (passed as is)
Notes
-
Calling iscsi_conn_stop might theoretically race with
DEVICE_REMOVAL event and dereference a previously freed RDMA device handle, so we call it under iser the state lock to protect against this kind of race.
iscsi_iser_session_destroy() #
void destroy iscsi-iser session
Parameters
struct iscsi_cls_session *cls_session: iscsi class session
Description
Removes and free iscsi host.
iscsi_iser_session_create() #
struct iscsi_cls_session * create an iscsi-iser session
Parameters
struct iscsi_endpoint *ep: iscsi end-point handleuint16_t cmds_max: maximum commands in this sessionuint16_t qdepth: session command queue depthuint32_t initial_cmdsn: initiator command sequnce number
Description
Allocates and adds a scsi host, expose DIF supprot if exists, and sets up an iscsi session.
iscsi_iser_ep_connect() #
struct iscsi_endpoint * Initiate iSER connection establishment
Parameters
struct Scsi_Host *shost: scsi_hoststruct sockaddr *dst_addr: destination addressint non_blocking: indicate if routine can block
Description
Allocate an iscsi endpoint, an iser_conn structure and bind them. After that start RDMA connection establishment via rdma_cm. We don't allocate iser_conn embedded in iscsi_endpoint since in teardown the endpoint will be destroyed at ep_disconnect while iser_conn will cleanup its resources asynchronuously.
Return
iscsi_endpoint created by iscsi layer or ERR_PTR(error) if fails.
iscsi_iser_ep_poll() #
int poll for iser connection establishment to complete
Parameters
struct iscsi_endpoint *ep: iscsi endpoint (created at ep_connect)int timeout_ms: polling timeout allowed in ms.
Description
This routine boils down to waiting for up_completion signaling that cma_id got CONNECTED event.
Return
1 if succeeded in connection establishment, 0 if timeout expired (libiscsi will retry will kick in) or -1 if interrupted by signal or more likely iser connection state transitioned to TEMINATING or DOWN during the wait period.
iscsi_iser_ep_disconnect() #
void Initiate connection teardown process
Parameters
struct iscsi_endpoint *ep: iscsi endpoint handle
Description
This routine is not blocked by iser and RDMA termination process completion as we queue a deffered work for iser/RDMA destruction and cleanup or actually call it immediately in case we didn't pass iscsi conn bind/start stage, thus it is safe.
iser_send_command() #
int send command PDU
Parameters
struct iscsi_conn *conn: link to matching iscsi connectionstruct iscsi_task *task: SCSI command task
iser_send_data_out() #
int send data out PDU
Parameters
struct iscsi_conn *conn: link to matching iscsi connectionstruct iscsi_task *task: SCSI command taskstruct iscsi_data *hdr: pointer to the LLD's iSCSI message header
iser_alloc_fastreg_pool() #
int Creates pool of fast_reg descriptors for fast registration work requests.
Parameters
struct ib_conn *ib_conn: connection RDMA resourcesunsigned cmds_max: max number of SCSI commands for this connectionunsigned int size: max number of pages per map request
Return
0 on success, or errno code on failure
iser_free_fastreg_pool() #
void releases the pool of fast_reg descriptors
Parameters
struct ib_conn *ib_conn: connection RDMA resources
iser_free_ib_conn_res() #
void release IB related resources
Parameters
struct iser_conn *iser_conn: iser connection structbool destroy: indicator if we need to try to release the iser device and memory regoins pool (only iscsi shutdown and DEVICE_REMOVAL will use this).
Description
This routine is called with the iser state mutex held so the cm_id removal is out of here. It is Safe to be invoked multiple times.
iser_conn_release() #
void Frees all conn objects and deallocs conn descriptor
Parameters
struct iser_conn *iser_conn: iSER connection context
iser_conn_terminate() #
int triggers start of the disconnect procedures and waits for them to be done
Parameters
struct iser_conn *iser_conn: iSER connection context
Description
Called with state mutex held
iser_post_send() #
int Initiate a Send DTO operation
Parameters
struct ib_conn *ib_conn: connection RDMA resourcesstruct iser_tx_desc *tx_desc: iSER TX descriptor
Return
0 on success, -1 on failure
Omni-Path (OPA) Virtual NIC support #
struct opa_vnic_ctrl_port #
OPA virtual NIC control port
Definition
;
Members
ibdev: pointer to ib deviceops: opa vnic control operationsnum_ports: number of opa ports
struct opa_vnic_adapter #
OPA VNIC netdev private data structure
Definition
;
Members
netdev: pointer to associated netdevibdev: ib devicecport: pointer to opa vnic control portrn_ops: rdma netdev's net_device_opsport_num: OPA port numbervport_num: vesw port numberlock: adapter lockinfo: virtual ethernet switch port informationvema_mac_addr: mac address configured by vemaumac_hash: unicast maclist hashmmac_hash: multicast maclist hashmactbl: hash table of MAC entriesmactbl_lock: mac table lockstats_lock: statistics lockflow_tbl: flow to default port redirection tabletrap_timeout: trap timeouttrap_count: no. of traps allowed within timeout period
struct opa_vnic_mac_tbl_node #
OPA VNIC mac table node
Definition
;
Members
hlist: hash list handleindex: index of entry in the mac tableentry: entry in the table
struct opa_vesw_info #
OPA vnic switch information
Definition
;
Members
fabric_id: 10-bit fabric idvesw_id: 12-bit virtual ethernet switch idrsvd0: reserved bytesdef_port_mask: bitmask of default portsrsvd1: reserved bytespkey: partition keyrsvd2: reserved bytesu_mcast_dlid: unknown multicast dlidu_ucast_dlid: array of unknown unicast dlidsrc: routing controlrsvd3: reserved byteseth_mtu: Ethernet MTUrsvd4: reserved bytes
struct opa_per_veswport_info #
OPA vnic per port information
Definition
;
Members
port_num: port numbereth_link_status: current ethernet link statersvd0: reserved bytesbase_mac_addr: base mac addressconfig_state: configured port stateoper_state: operational port statemax_mac_tbl_ent: max number of mac table entriesmax_smac_ent: max smac entries in mac tablemac_tbl_digest: mac table digestrsvd1: reserved bytesencap_slid: base slid for the portpcp_to_sc_uc: sc by pcp index for unicast ethernet packetspcp_to_vl_uc: vl by pcp index for unicast ethernet packetspcp_to_sc_mc: sc by pcp index for multicast ethernet packetspcp_to_vl_mc: vl by pcp index for multicast ethernet packetsnon_vlan_sc_uc: sc for non-vlan unicast ethernet packetsnon_vlan_vl_uc: vl for non-vlan unicast ethernet packetsnon_vlan_sc_mc: sc for non-vlan multicast ethernet packetsnon_vlan_vl_mc: vl for non-vlan multicast ethernet packetsrsvd2: reserved bytesuc_macs_gen_count: generation count for unicast macs listmc_macs_gen_count: generation count for multicast macs listrsvd3: reserved bytes
struct opa_veswport_info #
OPA vnic port information
Definition
;
Members
vesw: OPA vnic switch informationvport: OPA vnic per port information
Description
On host, each of the virtual ethernet ports belongs to a different virtual ethernet switches.
struct opa_veswport_mactable_entry #
single entry in the forwarding table
Definition
;
Members
mac_addr: MAC addressmac_addr_mask: MAC address bit maskdlid_sd: Matching DLID and side data
Description
On the host each virtual ethernet port will have a forwarding table. These tables are used to map a MAC to a LID and other data. For more details see struct opa_veswport_mactable_entries. This is the structure of a single mactable entry
struct opa_veswport_mactable #
Forwarding table array
Definition
;
Members
offset: mac table starting offsetnum_entries: Number of entries to get or setmac_tbl_digest: mac table digesttbl_entries: Array of table entries
Description
The EM sends down this structure in a MAD indicating the starting offset in the forwarding table that this entry is to be loaded into and the number of entries that that this MAD instance contains The mac_tbl_digest has been added to this MAD structure. It will be set by the EM and it will be used by the EM to check if there are any discrepancies with this value and the value maintained by the EM in the case of VNIC port being deleted or unloaded A new instantiation of a VNIC will always have a value of zero. This value is stored as part of the vnic adapter structure and will be accessed by the GET and SET routines for both the mactable entries and the veswport info.
struct opa_veswport_summary_counters #
summary counters
Definition
;
Members
vp_instance: vport instance on the OPA portvesw_id: virtual ethernet switch idveswport_num: virtual ethernet switch port numbertx_errors: transmit errorsrx_errors: receive errorstx_packets: transmit packetsrx_packets: receive packetstx_bytes: transmit bytesrx_bytes: receive bytestx_unicast: unicast packets transmittedtx_mcastbcast: multicast/broadcast packets transmittedtx_untagged: non-vlan packets transmittedtx_vlan: vlan packets transmittedtx_64_size: transmit packet length is 64 bytestx_65_127: transmit packet length is >=65 and < 127 bytestx_128_255: transmit packet length is >=128 and < 255 bytestx_256_511: transmit packet length is >=256 and < 511 bytestx_512_1023: transmit packet length is >=512 and < 1023 bytestx_1024_1518: transmit packet length is >=1024 and < 1518 bytestx_1519_max: transmit packet length >= 1519 bytesrx_unicast: unicast packets receivedrx_mcastbcast: multicast/broadcast packets receivedrx_untagged: non-vlan packets receivedrx_vlan: vlan packets receivedrx_64_size: received packet length is 64 bytesrx_65_127: received packet length is >=65 and < 127 bytesrx_128_255: received packet length is >=128 and < 255 bytesrx_256_511: received packet length is >=256 and < 511 bytesrx_512_1023: received packet length is >=512 and < 1023 bytesrx_1024_1518: received packet length is >=1024 and < 1518 bytesrx_1519_max: received packet length >= 1519 bytesreserved: reserved bytes
Description
All the above are counters of corresponding conditions.
struct opa_veswport_error_counters #
error counters
Definition
;
Members
vp_instance: vport instance on the OPA portvesw_id: virtual ethernet switch idveswport_num: virtual ethernet switch port numbertx_errors: transmit errorsrx_errors: receive errorsrsvd0: reserved bytestx_smac_filt: smac filter errorsrsvd1: reserved bytesrsvd2: reserved bytesrsvd3: reserved bytestx_dlid_zero: transmit packets with invalid dlidrsvd4: reserved bytestx_logic: other transmit errorsrsvd5: reserved bytestx_drop_state: packet tansmission in non-forward port staterx_bad_veswid: received packet with invalid vesw idrsvd6: reserved bytesrx_runt: received ethernet packet with length < 64 bytesrx_oversize: received ethernet packet with length > MTU sizersvd7: reserved bytesrx_eth_down: received packets when interface is downrx_drop_state: received packets in non-forwarding port staterx_logic: other receive errorsrsvd8: reserved bytesrsvd9: reserved bytes
Description
All the above are counters of corresponding error conditions.
struct opa_veswport_trap #
Trap message sent to EM by VNIC
Definition
;
Members
fabric_id: 10 bit fabric idveswid: 12 bit virtual ethernet switch idveswportnum: logical port number on the Virtual switchopaportnum: physical port num (redundant on host)veswportindex: switch port index on opa port 0 basedopcode: operationreserved: 32 bit for alignment
Description
The VNIC will send trap messages to the Ethernet manager to inform it about changes to the VNIC config, behaviour etc. This is the format of the trap payload.
struct opa_vnic_iface_mac_entry #
single entry in the mac list
Definition
;
Members
mac_addr: MAC address
struct opa_veswport_iface_macs #
Msg to set globally administered MAC
Definition
;
Members
start_idx: position of first entry (0 based)num_macs_in_msg: number of MACs in this messagetot_macs_in_lst: The total number of MACs the agent hasgen_count: gen_count to indicate changeentry: The mac list entry
Description
Same attribute IDS and attribute modifiers as in locally administered addresses used to set globally administered addresses
struct opa_vnic_vema_mad #
Generic VEMA MAD
Definition
;
Members
mad_hdr: Generic MAD headerrmpp_hdr: RMPP header for vendor specific MADsreserved: reserved bytesoui: Unique org identifierdata: MAD data
struct opa_vnic_notice_attr #
Generic Notice MAD
Definition
;
Members
gen_type: Generic/Specific bit and type of noticeoui_1: Vendor ID byte 1oui_2: Vendor ID byte 2oui_3: Vendor ID byte 3trap_num: Trap numbertoggle_count: Notice toggle bit and count valueissuer_lid: Trap issuer's lidreserved: reserved bytesissuer_gid: Issuer GID (only if Report method)raw_data: Trap message body
struct opa_vnic_vema_mad_trap #
Generic VEMA MAD Trap
Definition
;
Members
mad_hdr: Generic MAD headerrmpp_hdr: RMPP header for vendor specific MADsreserved: reserved bytesoui: Unique org identifiernotice: Notice structure
opa_vnic_vema_report_event() #
void sent trap to report the specified event
Parameters
struct opa_vnic_adapter *adapter: vnic port adapteru8 event: event to be reported
Description
This function calls vema api to sent a trap for the given event.
opa_vnic_get_summary_counters() #
void get summary counters
Parameters
struct opa_vnic_adapter *adapter: vnic port adapterstruct opa_veswport_summary_counters *cntrs: pointer to destination summary counters structure
Description
This function populates the summary counters that is maintained by the given adapter to destination address provided.
opa_vnic_get_error_counters() #
void get error counters
Parameters
struct opa_vnic_adapter *adapter: vnic port adapterstruct opa_veswport_error_counters *cntrs: pointer to destination error counters structure
Description
This function populates the error counters that is maintained by the given adapter to destination address provided.
opa_vnic_get_vesw_info() #
void - Get the vesw information
Parameters
struct opa_vnic_adapter *adapter: vnic port adapterstruct opa_vesw_info *info: pointer to destination vesw info structure
Description
This function copies the vesw info that is maintained by the given adapter to destination address provided.
opa_vnic_set_vesw_info() #
void - Set the vesw information
Parameters
struct opa_vnic_adapter *adapter: vnic port adapterstruct opa_vesw_info *info: pointer to vesw info structure
Description
This function updates the vesw info that is maintained by the given adapter with vesw info provided. Reserved fields are stored and returned back to EM as is.
opa_vnic_get_per_veswport_info() #
void - Get the vesw per port information
Parameters
struct opa_vnic_adapter *adapter: vnic port adapterstruct opa_per_veswport_info *info: pointer to destination vport info structure
Description
This function copies the vesw per port info that is maintained by the given adapter to destination address provided. Note that the read only fields are not copied.
opa_vnic_set_per_veswport_info() #
void - Set vesw per port information
Parameters
struct opa_vnic_adapter *adapter: vnic port adapterstruct opa_per_veswport_info *info: pointer to vport info structure
Description
This function updates the vesw per port info that is maintained by the given adapter with vesw per port info provided. Reserved fields are stored and returned back to EM as is.
opa_vnic_query_mcast_macs() #
void query multicast mac list
Parameters
struct opa_vnic_adapter *adapter: vnic port adapterstruct opa_veswport_iface_macs *macs: pointer mac list
Description
This function populates the provided mac list with the configured multicast addresses in the adapter.
opa_vnic_query_ucast_macs() #
void query unicast mac list
Parameters
struct opa_vnic_adapter *adapter: vnic port adapterstruct opa_veswport_iface_macs *macs: pointer mac list
Description
This function populates the provided mac list with the configured unicast addresses in the adapter.
struct opa_vnic_vema_port #
- VNIC VEMA port details
Definition
;
Members
cport: pointer to portmad_agent: pointer to mad agent for portclass_port_info: Class port info information.tid: Transaction idport_num: OPA port numbervports: vnic portsevent_handler: ib event handlerlock: adapter interface lock
vema_get_vport_num() #
u8 - Get the vnic from the mad
Parameters
struct opa_vnic_vema_mad *recvd_mad: Received mad
Return
returns value of the vnic port number
vema_get_vport_adapter() #
struct opa_vnic_adapter * - Get vnic port adapter from recvd mad
Parameters
struct opa_vnic_vema_mad *recvd_mad: received madstruct opa_vnic_vema_port *port: ptr to port struct on which MAD was recvd
Return
vnic adapter
vema_mac_tbl_req_ok() #
bool - Check if mac request has correct values
Parameters
struct opa_veswport_mactable *mac_tbl: mac table
Description
This function checks for the validity of the offset and number of entries required.
Return
true if offset and num_entries are valid
vema_add_vport() #
struct opa_vnic_adapter * - Add a new vnic port
Parameters
struct opa_vnic_vema_port *port: ptr to opa_vnic_vema_port structu8 vport_num: vnic port number (to be added)
Description
Return a pointer to the vnic adapter structure
vema_get_class_port_info() #
void - Get class info for port
Parameters
struct opa_vnic_vema_port *port: Port on whic MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: pointer to the received madstruct opa_vnic_vema_mad *rsp_mad: pointer to respose mad
Description
This function copies the latest class port info value set for the port and stores it for generating traps
vema_set_class_port_info() #
void - Get class info for port
Parameters
struct opa_vnic_vema_port *port: Port on whic MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: pointer to the received madstruct opa_vnic_vema_mad *rsp_mad: pointer to respose mad
Description
This function updates the port class info for the specific vnic and sets up the response mad data
vema_get_veswport_info() #
void - Get veswport info
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: pointer to the received madstruct opa_vnic_vema_mad *rsp_mad: pointer to respose mad
vema_set_veswport_info() #
void - Set veswport info
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: pointer to the received madstruct opa_vnic_vema_mad *rsp_mad: pointer to respose mad
Description
This function gets the port class infor for vnic
vema_get_mac_entries() #
void - Get MAC entries in VNIC MAC table
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: pointer to the received madstruct opa_vnic_vema_mad *rsp_mad: pointer to respose mad
Description
This function gets the MAC entries that are programmed into the VNIC MAC forwarding table. It checks for the validity of the index into the MAC table and the number of entries that are to be retrieved.
vema_set_mac_entries() #
void - Set MAC entries in VNIC MAC table
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: pointer to the received madstruct opa_vnic_vema_mad *rsp_mad: pointer to respose mad
Description
This function sets the MAC entries in the VNIC forwarding table It checks for the validity of the index and the number of forwarding table entries to be programmed.
vema_set_delete_vesw() #
void - Reset VESW info to POD values
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: pointer to the received madstruct opa_vnic_vema_mad *rsp_mad: pointer to respose mad
Description
This function clears all the fields of veswport info for the requested vesw and sets them back to the power-on default values. It does not delete the vesw.
vema_get_mac_list() #
void - Get the unicast/multicast macs.
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: Received mad contains fields to set vnic parametersstruct opa_vnic_vema_mad *rsp_mad: Response mad to be builtu16 attr_id: Attribute ID indicating multicast or unicast mac list
vema_get_summary_counters() #
void - Gets summary counters.
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: Received mad contains fields to set vnic parametersstruct opa_vnic_vema_mad *rsp_mad: Response mad to be built
vema_get_error_counters() #
void - Gets summary counters.
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: Received mad contains fields to set vnic parametersstruct opa_vnic_vema_mad *rsp_mad: Response mad to be built
vema_get() #
void - Process received get MAD
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: Received madstruct opa_vnic_vema_mad *rsp_mad: Response mad to be built
vema_set() #
void - Process received set MAD
Parameters
struct opa_vnic_vema_port *port: source port on which MAD was receivedstruct opa_vnic_vema_mad *recvd_mad: Received mad contains fields to set vnic parametersstruct opa_vnic_vema_mad *rsp_mad: Response mad to be built
vema_send() #
void - Send handler for VEMA MAD agent
Parameters
struct ib_mad_agent *mad_agent: pointer to the mad agentstruct ib_mad_send_wc *mad_wc: pointer to mad send work completion information
Description
Free all the data structures associated with the sent MAD
vema_recv() #
void - Recv handler for VEMA MAD agent
Parameters
struct ib_mad_agent *mad_agent: pointer to the mad agentstruct ib_mad_send_buf *send_buf: Send buffer if found, else NULLstruct ib_mad_recv_wc *mad_wc: pointer to mad send work completion information
Description
Handle only set and get methods and respond to other methods as unsupported. Allocate response buffer and address handle for the response MAD.
vema_get_port() #
struct opa_vnic_vema_port * - Gets the opa_vnic_vema_port
Parameters
struct opa_vnic_ctrl_port *cport: pointer to control devu8 port_num: Port number
Description
This function loops through the ports and returns the opa_vnic_vema port structure that is associated with the OPA port number
Return
ptr to requested opa_vnic_vema_port strucure if success, NULL if not
opa_vnic_vema_send_trap() #
void - This function sends a trap to the EM
Parameters
struct opa_vnic_adapter *adapter: pointer to vnic adapterstruct __opa_veswport_trap *data: pointer to trap data filled by calling functionu32 lid: issuers lid (encap_slid from vesw_port_info)
Description
This function is called from the VNIC driver to send a trap if there is somethng the EM should be notified about. These events currently are
- UNICAST INTERFACE MACADDRESS changes
- MULTICAST INTERFACE MACADDRESS changes
- ETHERNET LINK STATUS changes While allocating the send mad the remote site qpn used is 1 as this is the well known QP.
vema_unregister() #
void - Unregisters agent
Parameters
struct opa_vnic_ctrl_port *cport: pointer to control port
Description
This deletes the registration by VEMA for MADs
vema_register() #
int - Registers agent
Parameters
struct opa_vnic_ctrl_port *cport: pointer to control port
Description
This function registers the handlers for the VEMA MADs
Return
returns 0 on success. non zero otherwise
opa_vnic_ctrl_config_dev() #
void - This function sends a trap to the EM by way of ib_modify_port to indicate support for ethernet on the fabric.
Parameters
struct opa_vnic_ctrl_port *cport: pointer to control portbool en: enable or disable ethernet on fabric support
opa_vnic_vema_add_one() #
int - Handle new ib device
Parameters
struct ib_device *device: ib device pointer
Description
Allocate the vnic control port and initialize it.
opa_vnic_vema_rem_one() #
void - Handle ib device removal
Parameters
struct ib_device *device: ib device pointervoid *client_data: ib client data
Description
Uninitialize and free the vnic control port.
InfiniBand SCSI RDMA protocol target support #
enum srpt_command_state #
SCSI command state managed by SRPT
Constants
SRPT_STATE_NEW: New command arrived and is being processed.SRPT_STATE_NEED_DATA: Processing a write or bidir command and waiting for data arrival.SRPT_STATE_DATA_IN: Data for the write or bidir command arrived and is being processed.SRPT_STATE_CMD_RSP_SENT: SRP_RSP for SRP_CMD has been sent.SRPT_STATE_MGMT: Processing a SCSI task management command.SRPT_STATE_MGMT_RSP_SENT: SRP_RSP for SRP_TSK_MGMT has been sent.SRPT_STATE_DONE: Command processing finished successfully, command processing has been aborted or command processing failed.
struct srpt_ioctx #
shared SRPT I/O context information
Definition
;
Members
cqe: Completion queue element.buf: Pointer to the buffer.dma: DMA address of the buffer.offset: Offset of the first byte in buf and dma that is actually used.index: Index of the I/O context in its ioctx_ring array.
struct srpt_recv_ioctx #
SRPT receive I/O context
Definition
;
Members
ioctx: See above.wait_list: Node for insertion in srpt_rdma_ch.cmd_wait_list.byte_len: Number of bytes in ioctx.buf.
struct srpt_send_ioctx #
SRPT send I/O context
Definition
;
Members
-
ioctx: See above. -
ch: Channel pointer. -
recv_ioctx: Receive I/O context associated with this send I/O context. Only used for processing immediate data. -
s_rw_ctx:rw_ctxs points here if only a single rw_ctx is needed.
-
rw_ctxs: RDMA read/write contexts. -
imm_sg: Scatterlist for immediate data. -
rdma_cqe: RDMA completion queue element. -
state: I/O context state. -
cmd: Target core command data structure. -
n_rdma: Number of work requests needed to transfer this ioctx. -
n_rw_ctx: Size of rw_ctxs array. -
queue_status_only: Send a SCSI status back to the initiator but no data. -
sense_data: Sense data to be sent to the initiator.
enum rdma_ch_state #
SRP channel state
Constants
CH_CONNECTING: QP is in RTR state; waiting for RTU.CH_LIVE: QP is in RTS state.CH_DISCONNECTING: DREQ has been sent and waiting for DREP or DREQ has been received.CH_DRAINING: DREP has been received or waiting for DREP timed out and last work request has been queued.CH_DISCONNECTED: Last completion has been received.
struct srpt_rdma_ch #
RDMA channel
Definition
;
Members
nexus: I_T nexus this channel is associated with.qp: IB queue pair used for communicating over this channel.{unnamed_union}: anonymousib_cm: See below.ib_cm.cm_id: IB CM ID associated with the channel.rdma_cm: See below.rdma_cm.cm_id: RDMA CM ID associated with the channel.cq: IB completion queue for this channel.cq_size: Number of CQEs in cq.zw_cqe: Zero-length write CQE.rcu: RCU head.kref: kref for this channel.closed: Completion object that will be signaled as soon as a new channel object with the same identity can be created.rq_size: IB receive queue size.max_rsp_size: Maximum size of an RSP response message in bytes.sq_wr_avail: number of work requests available in the send queue.sport: pointer to the information of the HCA port used by this channel.max_ti_iu_len: maximum target-to-initiator information unit length.req_lim: request limit: maximum number of requests that may be sent by the initiator without having received a response.req_lim_delta: Number of credits not yet sent back to the initiator.imm_data_offset: Offset from start of SRP_CMD for immediate data.spinlock: Protects free_list and state.state: channel state. See also enum rdma_ch_state.rsp_buf_cache: kmem_cache for ioctx_ring.ioctx_ring: Send ring.req_buf_cache: kmem_cache for ioctx_recv_ring.ioctx_recv_ring: Receive I/O context ring.list: Node in srpt_nexus.ch_list.cmd_wait_list: List of SCSI commands that arrived before the RTU event. This list contains struct srpt_ioctx elements and is protected against concurrent modification by the cm_id spinlock.pkey: P_Key of the IB partition for this SRP channel.using_rdma_cm: Whether the RDMA/CM or IB/CM is used for this channel.processing_wait_list: Whether or not cmd_wait_list is being processed.sess: Session information associated with this SRP channel.sess_name: Session name.release_work: Allows scheduling ofsrpt_release_channel().
struct srpt_nexus #
I_T nexus
Definition
;
Members
rcu: RCU head for this data structure.entry: srpt_port.nexus_list list node.ch_list: struct srpt_rdma_ch list. Protected by srpt_port.mutex.i_port_id: 128-bit initiator port identifier copied from SRP_LOGIN_REQ.t_port_id: 128-bit target port identifier copied from SRP_LOGIN_REQ.
struct srpt_port_attrib #
attributes for SRPT port
Definition
;
Members
srp_max_rdma_size: Maximum size of SRP RDMA transfers for new connections.srp_max_rsp_size: Maximum size of SRP response messages in bytes.srp_sq_size: Shared receive queue (SRQ) size.use_srq: Whether or not to use SRQ.
struct srpt_tpg #
information about a single "target portal group"
Definition
;
Members
entry: Entry in sport_id->tpg_list.sport_id: Port name this TPG is associated with.tpg: LIO TPG data structure.
Description
Zero or more target portal groups are associated with each port name (srpt_port_id). With each TPG an ACL list is associated.
struct srpt_port_id #
LIO RDMA port information
Definition
;
Members
mutex: Protects tpg_list changes.tpg_list: TPGs associated with the RDMA port name.wwn: WWN associated with the RDMA port name.name: ASCII representation of the port name.
Description
Multiple sysfs directories can be associated with a single RDMA port. This data structure represents a single (port, name) pair.
struct srpt_port #
SRPT RDMA port information
Definition
;
Members
sdev: backpointer to the HCA information.mad_agent: per-port management datagram processing information.enabled: Whether or not this target port is enabled.port: one-based port number.sm_lid: cached value of the port's sm_lid.lid: cached value of the port's lid.gid: cached value of the port's gid.work: work structure for refreshing the aforementioned cached values.guid_name: port name in GUID format.guid_id: LIO target port information for the port name in GUID format.gid_name: port name in GID format.gid_id: LIO target port information for the port name in GID format.port_attrib: Port attributes that can be accessed through configfs.refcount: Number of objects associated with this port.freed_channels: Completion that will be signaled once refcount becomes 0.mutex: Protects nexus_list.nexus_list: Nexus list. See also srpt_nexus.entry.
struct srpt_device #
information associated by SRPT with a single HCA
Definition
;
Members
refcnt: Reference count for this device.device: Backpointer to the struct ib_device managed by the IB core.pd: IB protection domain.lkey: L_Key (local key) with write access to all local memory.srq: Per-HCA SRQ (shared receive queue).cm_id: Connection identifier.srq_size: SRQ size.sdev_mutex: Serializes use_srq changes.use_srq: Whether or not to use SRQ.req_buf_cache: kmem_cache for ioctx_ring buffers.ioctx_ring: Per-HCA SRQ.event_handler: Per-HCA asynchronous IB event handler.list: Node in srpt_dev_list.port: Information about the ports owned by this HCA.
srpt_event_handler() #
void asynchronous IB event callback function
Parameters
struct ib_event_handler *handler: IB event handler registered byib_register_event_handler().struct ib_event *event: Description of the event that occurred.
Description
Callback function called by the InfiniBand core when an asynchronous IB event occurs. This callback may occur in interrupt context. See also section 11.5.2, Set Asynchronous Event Handler in the InfiniBand Architecture Specification.
srpt_srq_event() #
void SRQ event callback function
Parameters
struct ib_event *event: Description of the event that occurred.void *ctx: Context pointer specified at SRQ creation time.
srpt_qp_event() #
void QP event callback function
Parameters
struct ib_event *event: Description of the event that occurred.void *ptr: SRPT RDMA channel.
srpt_set_ioc() #
void initialize a IOUnitInfo structure
Parameters
u8 *c_list: controller list.u32 slot: one-based slot number.u8 value: four-bit value.
Description
Copies the lowest four bits of value in element slot of the array of four bit elements called c_list (controller list). The index slot is one-based.
srpt_get_class_port_info() #
void copy ClassPortInfo to a management datagram
Parameters
struct ib_dm_mad *mad: Datagram that will be sent as response to DM_ATTR_CLASS_PORT_INFO.
Description
See also section 16.3.3.1 ClassPortInfo in the InfiniBand Architecture Specification.
srpt_get_iou() #
void write IOUnitInfo to a management datagram
Parameters
struct ib_dm_mad *mad: Datagram that will be sent as response to DM_ATTR_IOU_INFO.
Description
See also section 16.3.3.3 IOUnitInfo in the InfiniBand Architecture Specification. See also section B.7, table B.6 in the SRP r16a document.
srpt_get_ioc() #
void write IOControllerprofile to a management datagram
Parameters
struct srpt_port *sport: HCA port through which the MAD has been received.u32 slot: Slot number specified in DM_ATTR_IOC_PROFILE query.struct ib_dm_mad *mad: Datagram that will be sent as response to DM_ATTR_IOC_PROFILE.
Description
See also section 16.3.3.4 IOControllerProfile in the InfiniBand Architecture Specification. See also section B.7, table B.7 in the SRP r16a document.
srpt_get_svc_entries() #
void write ServiceEntries to a management datagram
Parameters
u64 ioc_guid: I/O controller GUID to use in reply.u16 slot: I/O controller number.u8 hi: End of the range of service entries to be specified in the reply.u8 lo: Start of the range of service entries to be specified in the reply..struct ib_dm_mad *mad: Datagram that will be sent as response to DM_ATTR_SVC_ENTRIES.
Description
See also section 16.3.3.5 ServiceEntries in the InfiniBand Architecture Specification. See also section B.7, table B.8 in the SRP r16a document.
srpt_mgmt_method_get() #
void process a received management datagram
Parameters
struct srpt_port *sp: HCA port through which the MAD has been received.struct ib_mad *rq_mad: received MAD.struct ib_dm_mad *rsp_mad: response MAD.
srpt_mad_send_handler() #
void MAD send completion callback
Parameters
struct ib_mad_agent *mad_agent: Return value ofib_register_mad_agent().struct ib_mad_send_wc *mad_wc: Work completion reporting that the MAD has been sent.
srpt_mad_recv_handler() #
void MAD reception callback function
Parameters
struct ib_mad_agent *mad_agent: Return value ofib_register_mad_agent().struct ib_mad_send_buf *send_buf: Not used.struct ib_mad_recv_wc *mad_wc: Work completion reporting that a MAD has been received.
srpt_refresh_port() #
int configure a HCA port
Parameters
struct srpt_port *sport: SRPT HCA port.
Description
Enable InfiniBand management datagram processing, update the cached sm_lid, lid and gid values, and register a callback function for processing MADs on the specified port.
Note
It is safe to call this function more than once for the same port.
srpt_unregister_mad_agent() #
void unregister MAD callback functions
Parameters
struct srpt_device *sdev: SRPT HCA pointer.int port_cnt: number of ports with registered MAD
Note
It is safe to call this function more than once for the same device.
srpt_alloc_ioctx() #
struct srpt_ioctx * allocate a SRPT I/O context structure
Parameters
struct srpt_device *sdev: SRPT HCA pointer.int ioctx_size: I/O context size.struct kmem_cache *buf_cache: I/O buffer cache.enum dma_data_direction dir: DMA data direction.
srpt_free_ioctx() #
void free a SRPT I/O context structure
Parameters
struct srpt_device *sdev: SRPT HCA pointer.struct srpt_ioctx *ioctx: I/O context pointer.struct kmem_cache *buf_cache: I/O buffer cache.enum dma_data_direction dir: DMA data direction.
srpt_alloc_ioctx_ring() #
struct srpt_ioctx ** allocate a ring of SRPT I/O context structures
Parameters
struct srpt_device *sdev: Device to allocate the I/O context ring for.int ring_size: Number of elements in the I/O context ring.int ioctx_size: I/O context size.struct kmem_cache *buf_cache: I/O buffer cache.int alignment_offset: Offset in each ring buffer at which the SRP information unit starts.enum dma_data_direction dir: DMA data direction.
srpt_free_ioctx_ring() #
void free the ring of SRPT I/O context structures
Parameters
struct srpt_ioctx **ioctx_ring: I/O context ring to be freed.struct srpt_device *sdev: SRPT HCA pointer.int ring_size: Number of ring elements.struct kmem_cache *buf_cache: I/O buffer cache.enum dma_data_direction dir: DMA data direction.
srpt_set_cmd_state() #
enum srpt_command_state set the state of a SCSI command
Parameters
struct srpt_send_ioctx *ioctx: Send I/O context.enum srpt_command_state new: New I/O context state.
Description
Does not modify the state of aborted commands. Returns the previous command state.
srpt_test_and_set_cmd_state() #
bool test and set the state of a command
Parameters
struct srpt_send_ioctx *ioctx: Send I/O context.enum srpt_command_state old: Current I/O context state.enum srpt_command_state new: New I/O context state.
Description
Returns true if and only if the previous command state was equal to 'old'.
srpt_post_recv() #
int post an IB receive request
Parameters
struct srpt_device *sdev: SRPT HCA pointer.struct srpt_rdma_ch *ch: SRPT RDMA channel.struct srpt_recv_ioctx *ioctx: Receive I/O context pointer.
srpt_zerolength_write() #
int perform a zero-length RDMA write
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.
Description
A quote from the InfiniBand specification: C9-88: For an HCA responder using Reliable Connection service, for each zero-length RDMA READ or WRITE request, the R_Key shall not be validated, even if the request includes Immediate data.
srpt_get_desc_tbl() #
int parse the data descriptors of a SRP_CMD request
Parameters
struct srpt_recv_ioctx *recv_ioctx: I/O context associated with the received command srp_cmd.struct srpt_send_ioctx *ioctx: I/O context that will be used for responding to the initiator.struct srp_cmd *srp_cmd: Pointer to the SRP_CMD request data.enum dma_data_direction *dir: Pointer to the variable to which the transfer direction will be written.struct scatterlist **sg: [out] scatterlist for the parsed SRP_CMD.unsigned int *sg_cnt: [out] length of sg.u64 *data_len: Pointer to the variable to which the total data length of all descriptors in the SRP_CMD request will be written.u16 imm_data_offset: [in] Offset in SRP_CMD requests at which immediate data starts.
Description
This function initializes ioctx->nrbuf and ioctx->r_bufs.
Returns -EINVAL when the SRP_CMD request contains inconsistent descriptors; -ENOMEM when memory allocation fails and zero upon success.
srpt_init_ch_qp() #
int initialize queue pair attributes
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.struct ib_qp *qp: Queue pair pointer.
Description
Initialized the attributes of queue pair 'qp' by allowing local write, remote read and remote write. Also transitions 'qp' to state IB_QPS_INIT.
srpt_ch_qp_rtr() #
int change the state of a channel to 'ready to receive' (RTR)
Parameters
struct srpt_rdma_ch *ch: channel of the queue pair.struct ib_qp *qp: queue pair to change the state of.
Description
Returns zero upon success and a negative value upon failure.
Note
currently a struct ib_qp_attr takes 136 bytes on a 64-bit system. If this structure ever becomes larger, it might be necessary to allocate it dynamically instead of on the stack.
srpt_ch_qp_rts() #
int change the state of a channel to 'ready to send' (RTS)
Parameters
struct srpt_rdma_ch *ch: channel of the queue pair.struct ib_qp *qp: queue pair to change the state of.
Description
Returns zero upon success and a negative value upon failure.
Note
currently a struct ib_qp_attr takes 136 bytes on a 64-bit system. If this structure ever becomes larger, it might be necessary to allocate it dynamically instead of on the stack.
srpt_ch_qp_err() #
int set the channel queue pair state to 'error'
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.
srpt_get_send_ioctx() #
struct srpt_send_ioctx * obtain an I/O context for sending to the initiator
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.
srpt_abort_cmd() #
int abort a SCSI command
Parameters
struct srpt_send_ioctx *ioctx: I/O context associated with the SCSI command.
srpt_rdma_read_done() #
void RDMA read completion callback
Parameters
struct ib_cq *cq: Completion queue.struct ib_wc *wc: Work completion.
Description
XXX: what is now target_execute_cmd used to be asynchronous, and unmapping
the data that has been transferred via IB RDMA had to be postponed until the
check_stop_free() callback. None of this is necessary anymore and needs to
be cleaned up.
srpt_build_cmd_rsp() #
int build a SRP_RSP response
Parameters
struct srpt_rdma_ch *ch: RDMA channel through which the request has been received.struct srpt_send_ioctx *ioctx: I/O context associated with the SRP_CMD request. The response will be built in the buffer ioctx->buf points at and hence this function will overwrite the request data.u64 tag: tag of the request for which this response is being generated.int status: value for the STATUS field of the SRP_RSP information unit.
Description
Returns the size in bytes of the SRP_RSP response.
An SRP_RSP response contains a SCSI status or service response. See also section 6.9 in the SRP r16a document for the format of an SRP_RSP response. See also SPC-2 for more information about sense data.
srpt_build_tskmgmt_rsp() #
int build a task management response
Parameters
struct srpt_rdma_ch *ch: RDMA channel through which the request has been received.struct srpt_send_ioctx *ioctx: I/O context in which the SRP_RSP response will be built.u8 rsp_code: RSP_CODE that will be stored in the response.u64 tag: Tag of the request for which this response is being generated.
Description
Returns the size in bytes of the SRP_RSP response.
An SRP_RSP response contains a SCSI status or service response. See also section 6.9 in the SRP r16a document for the format of an SRP_RSP response.
srpt_handle_cmd() #
void process a SRP_CMD information unit
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.struct srpt_recv_ioctx *recv_ioctx: Receive I/O context.struct srpt_send_ioctx *send_ioctx: Send I/O context.
srpt_handle_tsk_mgmt() #
void process a SRP_TSK_MGMT information unit
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.struct srpt_recv_ioctx *recv_ioctx: Receive I/O context.struct srpt_send_ioctx *send_ioctx: Send I/O context.
Description
Returns 0 if and only if the request will be processed by the target core.
For more information about SRP_TSK_MGMT information units, see also section 6.7 in the SRP r16a document.
srpt_handle_new_iu() #
bool process a newly received information unit
Parameters
struct srpt_rdma_ch *ch: RDMA channel through which the information unit has been received.struct srpt_recv_ioctx *recv_ioctx: Receive I/O context associated with the information unit.
srpt_send_done() #
void send completion callback
Parameters
struct ib_cq *cq: Completion queue.struct ib_wc *wc: Work completion.
Note
Although this has not yet been observed during tests, at least in
theory it is possible that the srpt_get_send_ioctx() call invoked by
srpt_handle_new_iu() fails. This is possible because the req_lim_delta
value in each response is set to one, and it is possible that this response
makes the initiator send a new request before the send completion for that
response has been processed. This could e.g. happen if the call to
srpt_put_send_iotcx() is delayed because of a higher priority interrupt or
if IB retransmission causes generation of the send completion to be
delayed. Incoming information units for which srpt_get_send_ioctx() fails
are queued on cmd_wait_list. The code below processes these delayed
requests one at a time.
srpt_create_ch_ib() #
int create receive and send completion queues
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.
srpt_close_ch() #
bool close a RDMA channel
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.
Description
Make sure all resources associated with the channel will be deallocated at an appropriate time.
Returns true if and only if the channel state has been modified into CH_DRAINING.
srpt_cm_req_recv() #
int process the event IB_CM_REQ_RECEIVED
Parameters
struct srpt_device *const sdev: HCA through which the login request was received.struct ib_cm_id *ib_cm_id: IB/CM connection identifier in case of IB/CM.struct rdma_cm_id *rdma_cm_id: RDMA/CM connection identifier in case of RDMA/CM.u8 port_num: Port through which the REQ message was received.__be16 pkey: P_Key of the incoming connection.const struct srp_login_req *req: SRP login request.const char *src_addr: GID (IB/CM) or IP address (RDMA/CM) of the port that submitted the login request.
Description
Ownership of the cm_id is transferred to the target session if this function returns zero. Otherwise the caller remains the owner of cm_id.
srpt_cm_rtu_recv() #
void process an IB_CM_RTU_RECEIVED or USER_ESTABLISHED event
Parameters
struct srpt_rdma_ch *ch: SRPT RDMA channel.
Description
An RTU (ready to use) message indicates that the connection has been established and that the recipient may begin transmitting.
srpt_cm_handler() #
int IB connection manager callback function
Parameters
struct ib_cm_id *cm_id: IB/CM connection identifier.const struct ib_cm_event *event: IB/CM event.
Description
A non-zero return value will cause the caller destroy the CM ID.
Note
srpt_cm_handler() must only return a non-zero value when transferring
ownership of the cm_id to a channel by srpt_cm_req_recv() failed. Returning
a non-zero value in any other case will trigger a race with the
ib_destroy_cm_id() call in srpt_release_channel().
srpt_queue_response() #
void transmit the response to a SCSI command
Parameters
struct se_cmd *cmd: SCSI target command.
Description
Callback function called by the TCM core. Must not block since it can be invoked on the context of the IB completion handler.
srpt_release_sport() #
int disable login and wait for associated channels
Parameters
struct srpt_port *sport: SRPT HCA port.
srpt_lookup_port() #
struct port_and_port_id Look up an RDMA port by name
Parameters
const char *name: ASCII port name
Description
Increments the RDMA port reference count if an RDMA port pointer is returned.
The caller must drop that reference count by calling srpt_port_put_ref().
srpt_add_one() #
int InfiniBand device addition callback function
Parameters
struct ib_device *device: Describes a HCA.
srpt_remove_one() #
void InfiniBand device removal callback function
Parameters
struct ib_device *device: Describes a HCA.void *client_data: The value passed as the third argument toib_set_client_data().
srpt_close_session() #
void forcibly close a session
Parameters
struct se_session *se_sess: SCSI target session.
Description
Callback function invoked by the TCM core to clean up sessions associated with a node ACL when the user invokes rmdir /sys/kernel/config/target/$driver/$port/$tpg/acls/$i_port_id
srpt_parse_i_port_id() #
int parse an initiator port ID
Parameters
u8 i_port_id[16]: Binary 128-bit port ID.const char *name: ASCII representation of a 128-bit initiator port ID.
srpt_make_tpg() #
struct se_portal_group * configfs callback invoked for mkdir /sys/kernel/config/target/$driver/$port/$tpg
Parameters
struct se_wwn *wwn: Corresponds to $driver/$port.const char *name: $tpg.
srpt_drop_tpg() #
void configfs callback invoked for rmdir /sys/kernel/config/target/$driver/$port/$tpg
Parameters
struct se_portal_group *tpg: Target portal group to deregister.
srpt_make_tport() #
struct se_wwn * configfs callback invoked for mkdir /sys/kernel/config/target/$driver/$port
Parameters
struct target_fabric_configfs *tf: Not used.struct config_group *group: Not used.const char *name: $port.
srpt_drop_tport() #
void configfs callback invoked for rmdir /sys/kernel/config/target/$driver/$port
Parameters
struct se_wwn *wwn: $port.
srpt_init_module() #
int kernel module initialization
Parameters
void: no arguments
Note
Since ib_register_client() registers callback functions, and since at
least one of these callback functions (srpt_add_one()) calls target core
functions, this driver must be registered with the target core before
ib_register_client() is called.
iSCSI Extensions for RDMA (iSER) target support #
isert_conn_terminate() #
void Initiate connection termination
Parameters
struct isert_conn *isert_conn: isert connection struct
Notes
In case the connection state is BOUND, move state to TEMINATING and start teardown sequence (rdma_disconnect). In case the connection state is UP, complete flush as well.
This routine must be called with mutex held. Thus it is safe to call multiple times.
isert_put_unsol_pending_cmds() #
void Drop commands waiting for unsolicitate dataout
Parameters
struct iscsit_conn *conn: iscsi connection
Description
We might still have commands that are waiting for unsolicited dataouts messages. We must put the extra reference on those before blocking on the target_wait_for_session_cmds