/* * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. 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. */ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm.h> #include <linux/scatterlist.h> #include <linux/kfifo.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_host.h> #include "iscsi_iser.h" /* Register user buffer memory and initialize passive rdma * dto descriptor. Data size is stored in * task->data[ISER_DIR_IN].data_len, Protection size * os stored in task->prot[ISER_DIR_IN].data_len */ static int iser_prepare_read_cmd(struct iscsi_task *task) { … } /* Register user buffer memory and initialize passive rdma * dto descriptor. Data size is stored in * task->data[ISER_DIR_OUT].data_len, Protection size * is stored at task->prot[ISER_DIR_OUT].data_len */ static int iser_prepare_write_cmd(struct iscsi_task *task, unsigned int imm_sz, unsigned int unsol_sz, unsigned int edtl) { … } /* creates a new tx descriptor and adds header regd buffer */ static void iser_create_send_desc(struct iser_conn *iser_conn, struct iser_tx_desc *tx_desc, enum iser_desc_type type, void (*done)(struct ib_cq *cq, struct ib_wc *wc)) { … } static void iser_free_login_buf(struct iser_conn *iser_conn) { … } static int iser_alloc_login_buf(struct iser_conn *iser_conn) { … } int iser_alloc_rx_descriptors(struct iser_conn *iser_conn, struct iscsi_session *session) { … } void iser_free_rx_descriptors(struct iser_conn *iser_conn) { … } static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req) { … } /** * iser_send_command - send command PDU * @conn: link to matching iscsi connection * @task: SCSI command task */ int iser_send_command(struct iscsi_conn *conn, struct iscsi_task *task) { … } /** * iser_send_data_out - send data out PDU * @conn: link to matching iscsi connection * @task: SCSI command task * @hdr: pointer to the LLD's iSCSI message header */ int iser_send_data_out(struct iscsi_conn *conn, struct iscsi_task *task, struct iscsi_data *hdr) { … } int iser_send_control(struct iscsi_conn *conn, struct iscsi_task *task) { … } void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc) { … } static inline int iser_inv_desc(struct iser_fr_desc *desc, u32 rkey) { … } static int iser_check_remote_inv(struct iser_conn *iser_conn, struct ib_wc *wc, struct iscsi_hdr *hdr) { … } void iser_task_rsp(struct ib_cq *cq, struct ib_wc *wc) { … } void iser_cmd_comp(struct ib_cq *cq, struct ib_wc *wc) { … } void iser_ctrl_comp(struct ib_cq *cq, struct ib_wc *wc) { … } void iser_dataout_comp(struct ib_cq *cq, struct ib_wc *wc) { … } void iser_task_rdma_init(struct iscsi_iser_task *iser_task) { … } void iser_task_rdma_finalize(struct iscsi_iser_task *iser_task) { … }