/* * iSER transport for the Open iSCSI Initiator & iSER transport internals * * Copyright (C) 2004 Dmitry Yusupov * Copyright (C) 2004 Alex Aizman * Copyright (C) 2005 Mike Christie * based on code maintained by open-iscsi@googlegroups.com * * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. * Copyright (c) 2013-2014 Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
*/ #ifndef __ISCSI_ISER_H__ #define __ISCSI_ISER_H__
/* the max TX (send) WR supported by the iSER QP is defined by * * max_send_wr = T * (1 + D) + C ; D is how many inflight dataouts we expect * * to have at max for SCSI command. The tx posting & completion handling code * * supports -EAGAIN scheme where tx is suspended till the QP has room for more *
* send WR. D=8 comes from 64K/8K */
/* Max registration work requests per command */ #define ISER_MAX_REG_WR_PER_CMD 5
/* For Signature we don't support DATAOUTs so no need to make room for them */ #define ISER_QP_SIG_MAX_REQ_DTOS (ISER_DEF_XMIT_CMDS_MAX * \
(1 + ISER_MAX_REG_WR_PER_CMD) + \
ISER_MAX_TX_MISC_PDUS + \
ISER_MAX_RX_MISC_PDUS)
/* Length of an object name string */ #define ISER_OBJECT_NAME_SIZE 64
enum iser_conn_state {
ISER_CONN_INIT, /* descriptor allocd, no conn */
ISER_CONN_PENDING, /* in the process of being established */
ISER_CONN_UP, /* up and running */
ISER_CONN_TERMINATING, /* in the process of being terminated */
ISER_CONN_DOWN, /* shut down */
ISER_CONN_STATES_NUM
};
enum iser_data_dir {
ISER_DIR_IN = 0, /* to initiator */
ISER_DIR_OUT, /* from initiator */
ISER_DIRS_NUM
};
/** * struct iser_data_buf - iSER data buffer * * @sg: pointer to the sg list * @size: num entries of this sg * @data_len: total buffer byte len * @dma_nents: returned by dma_map_sg
*/ struct iser_data_buf { struct scatterlist *sg; int size; unsignedlong data_len; int dma_nents;
};
/** * struct iser_device - iSER device handle * * @ib_device: RDMA device * @pd: Protection Domain for this device * @event_handler: IB events handle routine * @ig_list: entry in devices list * @refcount: Reference counter, dominated by open iser connections
*/ struct iser_device { struct ib_device *ib_device; struct ib_pd *pd; struct ib_event_handler event_handler; struct list_head ig_list; int refcount;
};
/** * struct iser_reg_resources - Fast registration resources * * @mr: memory region * @sig_mr: signature memory region
*/ struct iser_reg_resources { struct ib_mr *mr; struct ib_mr *sig_mr;
};
/** * struct iser_fr_desc - Fast registration descriptor * * @list: entry in connection fastreg pool * @rsc: data buffer registration resources * @sig_protected: is region protected indicator * @all_list: first and last list members
*/ struct iser_fr_desc { struct list_head list; struct iser_reg_resources rsc; bool sig_protected; struct list_head all_list;
};
/** * struct iser_fr_pool - connection fast registration pool * * @list: list of fastreg descriptors * @lock: protects fastreg pool * @size: size of the pool * @all_list: first and last list members
*/ struct iser_fr_pool { struct list_head list;
spinlock_t lock; int size; struct list_head all_list;
};
/** * struct ib_conn - Infiniband related objects * * @cma_id: rdma_cm connection maneger handle * @qp: Connection Queue-pair * @cq: Connection completion queue * @cq_size: The number of max outstanding completions * @device: reference to iser device * @fr_pool: connection fast registration pool * @pi_support: Indicate device T10-PI support * @reg_cqe: completion handler
*/ struct ib_conn { struct rdma_cm_id *cma_id; struct ib_qp *qp; struct ib_cq *cq;
u32 cq_size; struct iser_device *device; struct iser_fr_pool fr_pool; bool pi_support; struct ib_cqe reg_cqe;
};
/** * struct iser_conn - iSER connection context * * @ib_conn: connection RDMA resources * @iscsi_conn: link to matching iscsi connection * @ep: transport handle * @state: connection logical state * @qp_max_recv_dtos: maximum number of data outs, corresponds * to max number of post recvs * @max_cmds: maximum cmds allowed for this connection * @name: connection peer portal * @release_work: deferred work for release job * @state_mutex: protects iser onnection state * @stop_completion: conn_stop completion * @ib_completion: RDMA cleanup completion * @up_completion: connection establishment completed * (state is ISER_CONN_UP) * @conn_list: entry in ig conn list * @login_desc: login descriptor * @rx_descs: rx buffers array (cyclic buffer) * @num_rx_descs: number of rx descriptors * @scsi_sg_tablesize: scsi host sg_tablesize * @pages_per_mr: maximum pages available for registration * @snd_w_inv: connection uses remote invalidation
*/ struct iser_conn { struct ib_conn ib_conn; struct iscsi_conn *iscsi_conn; struct iscsi_endpoint *ep; enum iser_conn_state state; unsigned qp_max_recv_dtos;
u16 max_cmds; char name[ISER_OBJECT_NAME_SIZE]; struct work_struct release_work; struct mutex state_mutex; struct completion stop_completion; struct completion ib_completion; struct completion up_completion; struct list_head conn_list; struct iser_login_desc login_desc; struct iser_rx_desc *rx_descs;
u32 num_rx_descs; unsignedshort scsi_sg_tablesize; unsignedshort pages_per_mr; bool snd_w_inv;
};
/** * struct iscsi_iser_task - iser task context * * @desc: TX descriptor * @iser_conn: link to iser connection * @status: current task status * @sc: link to scsi command * @command_sent: indicate if command was sent * @dir: iser data direction * @rdma_reg: task rdma registration desc * @data: iser data buffer desc * @prot: iser protection buffer desc
*/ struct iscsi_iser_task { struct iser_tx_desc desc; struct iser_conn *iser_conn; enum iser_task_status status; struct scsi_cmnd *sc; int command_sent; int dir[ISER_DIRS_NUM]; struct iser_mem_reg rdma_reg[ISER_DIRS_NUM]; struct iser_data_buf data[ISER_DIRS_NUM]; struct iser_data_buf prot[ISER_DIRS_NUM];
};
/** * struct iser_global - iSER global context * * @device_list_mutex: protects device_list * @device_list: iser devices global list * @connlist_mutex: protects connlist * @connlist: iser connections global list * @desc_cache: kmem cache for tx dataout
*/ struct iser_global { struct mutex device_list_mutex; struct list_head device_list; struct mutex connlist_mutex; struct list_head connlist; struct kmem_cache *desc_cache;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.