mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-19 09:04:51 +08:00
IB/iser: Align coding style across driver
The following changes were made: 1. Align function signatures to 80 characters per line. 2. Remove tabs for variable assignment and use 1 space instead. 3. Don't compare to NULL in "if" clause. 4. Remove strange indentations. This will ease on the maintenance of the driver for the future. Link: https://lore.kernel.org/r/20211215135721.3662-7-mgurtovoy@nvidia.com Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
48886a84a3
commit
ca2770c65b
@ -135,9 +135,8 @@ static int iscsi_iser_set(const char *val, const struct kernel_param *kp)
|
||||
* Notes: In case of data length errors or iscsi PDU completion failures
|
||||
* this routine will signal iscsi layer of connection failure.
|
||||
*/
|
||||
void
|
||||
iscsi_iser_recv(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
|
||||
char *rx_data, int rx_data_len)
|
||||
void iscsi_iser_recv(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
|
||||
char *rx_data, int rx_data_len)
|
||||
{
|
||||
int rc = 0;
|
||||
int datalen;
|
||||
@ -172,8 +171,7 @@ error:
|
||||
* Netes: This routine can't fail, just assign iscsi task
|
||||
* hdr and max hdr size.
|
||||
*/
|
||||
static int
|
||||
iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
|
||||
static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
|
||||
{
|
||||
struct iscsi_iser_task *iser_task = task->dd_data;
|
||||
|
||||
@ -194,9 +192,8 @@ iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
|
||||
* state mutex to avoid dereferencing the IB device which
|
||||
* may have already been terminated.
|
||||
*/
|
||||
int
|
||||
iser_initialize_task_headers(struct iscsi_task *task,
|
||||
struct iser_tx_desc *tx_desc)
|
||||
int iser_initialize_task_headers(struct iscsi_task *task,
|
||||
struct iser_tx_desc *tx_desc)
|
||||
{
|
||||
struct iser_conn *iser_conn = task->conn->dd_data;
|
||||
struct iser_device *device = iser_conn->ib_conn.device;
|
||||
@ -233,8 +230,7 @@ iser_initialize_task_headers(struct iscsi_task *task,
|
||||
* Return: Returns zero on success or -ENOMEM when failing
|
||||
* to init task headers (dma mapping error).
|
||||
*/
|
||||
static int
|
||||
iscsi_iser_task_init(struct iscsi_task *task)
|
||||
static int iscsi_iser_task_init(struct iscsi_task *task)
|
||||
{
|
||||
struct iscsi_iser_task *iser_task = task->dd_data;
|
||||
int ret;
|
||||
@ -268,8 +264,8 @@ iscsi_iser_task_init(struct iscsi_task *task)
|
||||
* xmit.
|
||||
*
|
||||
**/
|
||||
static int
|
||||
iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task)
|
||||
static int iscsi_iser_mtask_xmit(struct iscsi_conn *conn,
|
||||
struct iscsi_task *task)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
@ -286,9 +282,8 @@ iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task)
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn,
|
||||
struct iscsi_task *task)
|
||||
static int iscsi_iser_task_xmit_unsol_data(struct iscsi_conn *conn,
|
||||
struct iscsi_task *task)
|
||||
{
|
||||
struct iscsi_r2t_info *r2t = &task->unsol_r2t;
|
||||
struct iscsi_data hdr;
|
||||
@ -322,8 +317,7 @@ iscsi_iser_task_xmit_unsol_data_exit:
|
||||
*
|
||||
* Return: zero on success or escalates $error on failure.
|
||||
*/
|
||||
static int
|
||||
iscsi_iser_task_xmit(struct iscsi_task *task)
|
||||
static int iscsi_iser_task_xmit(struct iscsi_task *task)
|
||||
{
|
||||
struct iscsi_conn *conn = task->conn;
|
||||
struct iscsi_iser_task *iser_task = task->dd_data;
|
||||
@ -406,8 +400,7 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task)
|
||||
*
|
||||
* In addition the error sector is marked.
|
||||
*/
|
||||
static u8
|
||||
iscsi_iser_check_protection(struct iscsi_task *task, sector_t *sector)
|
||||
static u8 iscsi_iser_check_protection(struct iscsi_task *task, sector_t *sector)
|
||||
{
|
||||
struct iscsi_iser_task *iser_task = task->dd_data;
|
||||
enum iser_data_dir dir = iser_task->dir[ISER_DIR_IN] ?
|
||||
@ -456,11 +449,9 @@ iscsi_iser_conn_create(struct iscsi_cls_session *cls_session,
|
||||
* -EINVAL in case end-point doesn't exsits anymore or iser connection
|
||||
* state is not UP (teardown already started).
|
||||
*/
|
||||
static int
|
||||
iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,
|
||||
struct iscsi_cls_conn *cls_conn,
|
||||
uint64_t transport_eph,
|
||||
int is_leading)
|
||||
static int iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,
|
||||
struct iscsi_cls_conn *cls_conn,
|
||||
uint64_t transport_eph, int is_leading)
|
||||
{
|
||||
struct iscsi_conn *conn = cls_conn->dd_data;
|
||||
struct iser_conn *iser_conn;
|
||||
@ -515,8 +506,7 @@ out:
|
||||
* from this point iscsi must call conn_stop in session/connection
|
||||
* teardown so iser transport must wait for it.
|
||||
*/
|
||||
static int
|
||||
iscsi_iser_conn_start(struct iscsi_cls_conn *cls_conn)
|
||||
static int iscsi_iser_conn_start(struct iscsi_cls_conn *cls_conn)
|
||||
{
|
||||
struct iscsi_conn *iscsi_conn;
|
||||
struct iser_conn *iser_conn;
|
||||
@ -538,8 +528,7 @@ iscsi_iser_conn_start(struct iscsi_cls_conn *cls_conn)
|
||||
* handle, so we call it under iser the state lock to protect against
|
||||
* this kind of race.
|
||||
*/
|
||||
static void
|
||||
iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
|
||||
static void iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
|
||||
{
|
||||
struct iscsi_conn *conn = cls_conn->dd_data;
|
||||
struct iser_conn *iser_conn = conn->dd_data;
|
||||
@ -574,8 +563,7 @@ iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
|
||||
*
|
||||
* Removes and free iscsi host.
|
||||
*/
|
||||
static void
|
||||
iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)
|
||||
static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)
|
||||
{
|
||||
struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
|
||||
|
||||
@ -584,8 +572,7 @@ iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)
|
||||
iscsi_host_free(shost);
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
iser_dif_prot_caps(int prot_caps)
|
||||
static inline unsigned int iser_dif_prot_caps(int prot_caps)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@ -704,9 +691,8 @@ free_host:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn,
|
||||
enum iscsi_param param, char *buf, int buflen)
|
||||
static int iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn,
|
||||
enum iscsi_param param, char *buf, int buflen)
|
||||
{
|
||||
int value;
|
||||
|
||||
@ -756,8 +742,8 @@ iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn,
|
||||
*
|
||||
* Output connection statistics.
|
||||
*/
|
||||
static void
|
||||
iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats)
|
||||
static void iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn,
|
||||
struct iscsi_stats *stats)
|
||||
{
|
||||
struct iscsi_conn *conn = cls_conn->dd_data;
|
||||
|
||||
@ -808,9 +794,9 @@ static int iscsi_iser_get_ep_param(struct iscsi_endpoint *ep,
|
||||
* Return: iscsi_endpoint created by iscsi layer or ERR_PTR(error)
|
||||
* if fails.
|
||||
*/
|
||||
static struct iscsi_endpoint *
|
||||
iscsi_iser_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
|
||||
int non_blocking)
|
||||
static struct iscsi_endpoint *iscsi_iser_ep_connect(struct Scsi_Host *shost,
|
||||
struct sockaddr *dst_addr,
|
||||
int non_blocking)
|
||||
{
|
||||
int err;
|
||||
struct iser_conn *iser_conn;
|
||||
@ -853,8 +839,7 @@ failure:
|
||||
* or more likely iser connection state transitioned to TEMINATING or
|
||||
* DOWN during the wait period.
|
||||
*/
|
||||
static int
|
||||
iscsi_iser_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
|
||||
static int iscsi_iser_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
|
||||
{
|
||||
struct iser_conn *iser_conn = ep->dd_data;
|
||||
int rc;
|
||||
@ -889,8 +874,7 @@ iscsi_iser_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
|
||||
* and cleanup or actually call it immediately in case we didn't pass
|
||||
* iscsi conn bind/start stage, thus it is safe.
|
||||
*/
|
||||
static void
|
||||
iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep)
|
||||
static void iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep)
|
||||
{
|
||||
struct iser_conn *iser_conn = ep->dd_data;
|
||||
|
||||
|
@ -95,11 +95,8 @@ static int iser_prepare_read_cmd(struct iscsi_task *task)
|
||||
* 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)
|
||||
static int iser_prepare_write_cmd(struct iscsi_task *task, unsigned int imm_sz,
|
||||
unsigned int unsol_sz, unsigned int edtl)
|
||||
{
|
||||
struct iscsi_iser_task *iser_task = task->dd_data;
|
||||
struct iser_mem_reg *mem_reg;
|
||||
@ -160,8 +157,8 @@ iser_prepare_write_cmd(struct iscsi_task *task,
|
||||
}
|
||||
|
||||
/* 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)
|
||||
static void iser_create_send_desc(struct iser_conn *iser_conn,
|
||||
struct iser_tx_desc *tx_desc)
|
||||
{
|
||||
struct iser_device *device = iser_conn->ib_conn.device;
|
||||
|
||||
@ -355,8 +352,7 @@ out:
|
||||
* @conn: link to matching iscsi connection
|
||||
* @task: SCSI command task
|
||||
*/
|
||||
int iser_send_command(struct iscsi_conn *conn,
|
||||
struct iscsi_task *task)
|
||||
int iser_send_command(struct iscsi_conn *conn, struct iscsi_task *task)
|
||||
{
|
||||
struct iser_conn *iser_conn = conn->dd_data;
|
||||
struct iscsi_iser_task *iser_task = task->dd_data;
|
||||
@ -427,8 +423,7 @@ send_command_error:
|
||||
* @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,
|
||||
int iser_send_data_out(struct iscsi_conn *conn, struct iscsi_task *task,
|
||||
struct iscsi_data *hdr)
|
||||
{
|
||||
struct iser_conn *iser_conn = conn->dd_data;
|
||||
@ -490,8 +485,7 @@ send_data_out_error:
|
||||
return err;
|
||||
}
|
||||
|
||||
int iser_send_control(struct iscsi_conn *conn,
|
||||
struct iscsi_task *task)
|
||||
int iser_send_control(struct iscsi_conn *conn, struct iscsi_task *task)
|
||||
{
|
||||
struct iser_conn *iser_conn = conn->dd_data;
|
||||
struct iscsi_iser_task *iser_task = task->dd_data;
|
||||
@ -590,8 +584,7 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc)
|
||||
iser_post_recvm(iser_conn, iser_conn->rx_descs);
|
||||
}
|
||||
|
||||
static inline int
|
||||
iser_inv_desc(struct iser_fr_desc *desc, u32 rkey)
|
||||
static inline int iser_inv_desc(struct iser_fr_desc *desc, u32 rkey)
|
||||
{
|
||||
if (unlikely((!desc->sig_protected && rkey != desc->rsc.mr->rkey) ||
|
||||
(desc->sig_protected && rkey != desc->rsc.sig_mr->rkey))) {
|
||||
@ -604,10 +597,8 @@ iser_inv_desc(struct iser_fr_desc *desc, u32 rkey)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
iser_check_remote_inv(struct iser_conn *iser_conn,
|
||||
struct ib_wc *wc,
|
||||
struct iscsi_hdr *hdr)
|
||||
static int iser_check_remote_inv(struct iser_conn *iser_conn, struct ib_wc *wc,
|
||||
struct iscsi_hdr *hdr)
|
||||
{
|
||||
if (wc->wc_flags & IB_WC_WITH_INVALIDATE) {
|
||||
struct iscsi_task *task;
|
||||
|
@ -44,8 +44,7 @@ void iser_reg_comp(struct ib_cq *cq, struct ib_wc *wc)
|
||||
iser_err_comp(wc, "memreg");
|
||||
}
|
||||
|
||||
static struct iser_fr_desc *
|
||||
iser_reg_desc_get_fr(struct ib_conn *ib_conn)
|
||||
static struct iser_fr_desc *iser_reg_desc_get_fr(struct ib_conn *ib_conn)
|
||||
{
|
||||
struct iser_fr_pool *fr_pool = &ib_conn->fr_pool;
|
||||
struct iser_fr_desc *desc;
|
||||
@ -60,9 +59,8 @@ iser_reg_desc_get_fr(struct ib_conn *ib_conn)
|
||||
return desc;
|
||||
}
|
||||
|
||||
static void
|
||||
iser_reg_desc_put_fr(struct ib_conn *ib_conn,
|
||||
struct iser_fr_desc *desc)
|
||||
static void iser_reg_desc_put_fr(struct ib_conn *ib_conn,
|
||||
struct iser_fr_desc *desc)
|
||||
{
|
||||
struct iser_fr_pool *fr_pool = &ib_conn->fr_pool;
|
||||
unsigned long flags;
|
||||
@ -73,9 +71,9 @@ iser_reg_desc_put_fr(struct ib_conn *ib_conn,
|
||||
}
|
||||
|
||||
int iser_dma_map_task_data(struct iscsi_iser_task *iser_task,
|
||||
struct iser_data_buf *data,
|
||||
enum iser_data_dir iser_dir,
|
||||
enum dma_data_direction dma_dir)
|
||||
struct iser_data_buf *data,
|
||||
enum iser_data_dir iser_dir,
|
||||
enum dma_data_direction dma_dir)
|
||||
{
|
||||
struct ib_device *dev;
|
||||
|
||||
@ -100,9 +98,8 @@ void iser_dma_unmap_task_data(struct iscsi_iser_task *iser_task,
|
||||
ib_dma_unmap_sg(dev, data->sg, data->size, dir);
|
||||
}
|
||||
|
||||
static int
|
||||
iser_reg_dma(struct iser_device *device, struct iser_data_buf *mem,
|
||||
struct iser_mem_reg *reg)
|
||||
static int iser_reg_dma(struct iser_device *device, struct iser_data_buf *mem,
|
||||
struct iser_mem_reg *reg)
|
||||
{
|
||||
struct scatterlist *sg = mem->sg;
|
||||
|
||||
@ -154,8 +151,8 @@ void iser_unreg_mem_fastreg(struct iscsi_iser_task *iser_task,
|
||||
reg->mem_h = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
iser_set_dif_domain(struct scsi_cmnd *sc, struct ib_sig_domain *domain)
|
||||
static void iser_set_dif_domain(struct scsi_cmnd *sc,
|
||||
struct ib_sig_domain *domain)
|
||||
{
|
||||
domain->sig_type = IB_SIG_TYPE_T10_DIF;
|
||||
domain->sig.dif.pi_interval = scsi_prot_interval(sc);
|
||||
@ -171,8 +168,8 @@ iser_set_dif_domain(struct scsi_cmnd *sc, struct ib_sig_domain *domain)
|
||||
domain->sig.dif.ref_remap = true;
|
||||
}
|
||||
|
||||
static int
|
||||
iser_set_sig_attrs(struct scsi_cmnd *sc, struct ib_sig_attrs *sig_attrs)
|
||||
static int iser_set_sig_attrs(struct scsi_cmnd *sc,
|
||||
struct ib_sig_attrs *sig_attrs)
|
||||
{
|
||||
switch (scsi_get_prot_op(sc)) {
|
||||
case SCSI_PROT_WRITE_INSERT:
|
||||
@ -205,8 +202,7 @@ iser_set_sig_attrs(struct scsi_cmnd *sc, struct ib_sig_attrs *sig_attrs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
iser_set_prot_checks(struct scsi_cmnd *sc, u8 *mask)
|
||||
static inline void iser_set_prot_checks(struct scsi_cmnd *sc, u8 *mask)
|
||||
{
|
||||
*mask = 0;
|
||||
if (sc->prot_flags & SCSI_PROT_REF_CHECK)
|
||||
@ -215,11 +211,8 @@ iser_set_prot_checks(struct scsi_cmnd *sc, u8 *mask)
|
||||
*mask |= IB_SIG_CHECK_GUARD;
|
||||
}
|
||||
|
||||
static inline void
|
||||
iser_inv_rkey(struct ib_send_wr *inv_wr,
|
||||
struct ib_mr *mr,
|
||||
struct ib_cqe *cqe,
|
||||
struct ib_send_wr *next_wr)
|
||||
static inline void iser_inv_rkey(struct ib_send_wr *inv_wr, struct ib_mr *mr,
|
||||
struct ib_cqe *cqe, struct ib_send_wr *next_wr)
|
||||
{
|
||||
inv_wr->opcode = IB_WR_LOCAL_INV;
|
||||
inv_wr->wr_cqe = cqe;
|
||||
@ -229,12 +222,11 @@ iser_inv_rkey(struct ib_send_wr *inv_wr,
|
||||
inv_wr->next = next_wr;
|
||||
}
|
||||
|
||||
static int
|
||||
iser_reg_sig_mr(struct iscsi_iser_task *iser_task,
|
||||
struct iser_data_buf *mem,
|
||||
struct iser_data_buf *sig_mem,
|
||||
struct iser_reg_resources *rsc,
|
||||
struct iser_mem_reg *sig_reg)
|
||||
static int iser_reg_sig_mr(struct iscsi_iser_task *iser_task,
|
||||
struct iser_data_buf *mem,
|
||||
struct iser_data_buf *sig_mem,
|
||||
struct iser_reg_resources *rsc,
|
||||
struct iser_mem_reg *sig_reg)
|
||||
{
|
||||
struct iser_tx_desc *tx_desc = &iser_task->desc;
|
||||
struct ib_cqe *cqe = &iser_task->iser_conn->ib_conn.reg_cqe;
|
||||
@ -335,12 +327,10 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
iser_reg_data_sg(struct iscsi_iser_task *task,
|
||||
struct iser_data_buf *mem,
|
||||
struct iser_fr_desc *desc,
|
||||
bool use_dma_key,
|
||||
struct iser_mem_reg *reg)
|
||||
static int iser_reg_data_sg(struct iscsi_iser_task *task,
|
||||
struct iser_data_buf *mem,
|
||||
struct iser_fr_desc *desc, bool use_dma_key,
|
||||
struct iser_mem_reg *reg)
|
||||
{
|
||||
struct iser_device *device = task->iser_conn->ib_conn.device;
|
||||
|
||||
|
@ -265,14 +265,14 @@ static int iser_create_ib_conn_res(struct ib_conn *ib_conn)
|
||||
memset(&init_attr, 0, sizeof(init_attr));
|
||||
|
||||
init_attr.event_handler = iser_qp_event_callback;
|
||||
init_attr.qp_context = (void *)ib_conn;
|
||||
init_attr.send_cq = ib_conn->cq;
|
||||
init_attr.recv_cq = ib_conn->cq;
|
||||
init_attr.cap.max_recv_wr = ISER_QP_MAX_RECV_DTOS;
|
||||
init_attr.qp_context = (void *)ib_conn;
|
||||
init_attr.send_cq = ib_conn->cq;
|
||||
init_attr.recv_cq = ib_conn->cq;
|
||||
init_attr.cap.max_recv_wr = ISER_QP_MAX_RECV_DTOS;
|
||||
init_attr.cap.max_send_sge = 2;
|
||||
init_attr.cap.max_recv_sge = 1;
|
||||
init_attr.sq_sig_type = IB_SIGNAL_REQ_WR;
|
||||
init_attr.qp_type = IB_QPT_RC;
|
||||
init_attr.sq_sig_type = IB_SIGNAL_REQ_WR;
|
||||
init_attr.qp_type = IB_QPT_RC;
|
||||
init_attr.cap.max_send_wr = max_send_wr;
|
||||
if (ib_conn->pi_support)
|
||||
init_attr.create_flags |= IB_QP_CREATE_INTEGRITY_EN;
|
||||
@ -283,9 +283,8 @@ static int iser_create_ib_conn_res(struct ib_conn *ib_conn)
|
||||
goto out_err;
|
||||
|
||||
ib_conn->qp = ib_conn->cma_id->qp;
|
||||
iser_info("setting conn %p cma_id %p qp %p max_send_wr %d\n",
|
||||
ib_conn, ib_conn->cma_id,
|
||||
ib_conn->cma_id->qp, max_send_wr);
|
||||
iser_info("setting conn %p cma_id %p qp %p max_send_wr %d\n", ib_conn,
|
||||
ib_conn->cma_id, ib_conn->cma_id->qp, max_send_wr);
|
||||
return ret;
|
||||
|
||||
out_err:
|
||||
@ -313,7 +312,7 @@ struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
|
||||
goto inc_refcnt;
|
||||
|
||||
device = kzalloc(sizeof *device, GFP_KERNEL);
|
||||
if (device == NULL)
|
||||
if (!device)
|
||||
goto out;
|
||||
|
||||
/* assign this device to the device */
|
||||
@ -392,8 +391,7 @@ void iser_release_work(struct work_struct *work)
|
||||
* so the cm_id removal is out of here. It is Safe to
|
||||
* be invoked multiple times.
|
||||
*/
|
||||
static void iser_free_ib_conn_res(struct iser_conn *iser_conn,
|
||||
bool destroy)
|
||||
static void iser_free_ib_conn_res(struct iser_conn *iser_conn, bool destroy)
|
||||
{
|
||||
struct ib_conn *ib_conn = &iser_conn->ib_conn;
|
||||
struct iser_device *device = ib_conn->device;
|
||||
@ -401,7 +399,7 @@ static void iser_free_ib_conn_res(struct iser_conn *iser_conn,
|
||||
iser_info("freeing conn %p cma_id %p qp %p\n",
|
||||
iser_conn, ib_conn->cma_id, ib_conn->qp);
|
||||
|
||||
if (ib_conn->qp != NULL) {
|
||||
if (ib_conn->qp) {
|
||||
rdma_destroy_qp(ib_conn->cma_id);
|
||||
ib_cq_pool_put(ib_conn->cq, ib_conn->cq_size);
|
||||
ib_conn->qp = NULL;
|
||||
@ -411,7 +409,7 @@ static void iser_free_ib_conn_res(struct iser_conn *iser_conn,
|
||||
if (iser_conn->rx_descs)
|
||||
iser_free_rx_descriptors(iser_conn);
|
||||
|
||||
if (device != NULL) {
|
||||
if (device) {
|
||||
iser_device_try_release(device);
|
||||
ib_conn->device = NULL;
|
||||
}
|
||||
@ -445,7 +443,7 @@ void iser_conn_release(struct iser_conn *iser_conn)
|
||||
iser_free_ib_conn_res(iser_conn, true);
|
||||
mutex_unlock(&iser_conn->state_mutex);
|
||||
|
||||
if (ib_conn->cma_id != NULL) {
|
||||
if (ib_conn->cma_id) {
|
||||
rdma_destroy_id(ib_conn->cma_id);
|
||||
ib_conn->cma_id = NULL;
|
||||
}
|
||||
@ -505,9 +503,8 @@ static void iser_connect_error(struct rdma_cm_id *cma_id)
|
||||
iser_conn->state = ISER_CONN_TERMINATING;
|
||||
}
|
||||
|
||||
static void
|
||||
iser_calc_scsi_params(struct iser_conn *iser_conn,
|
||||
unsigned int max_sectors)
|
||||
static void iser_calc_scsi_params(struct iser_conn *iser_conn,
|
||||
unsigned int max_sectors)
|
||||
{
|
||||
struct iser_device *device = iser_conn->ib_conn.device;
|
||||
struct ib_device_attr *attr = &device->ib_device->attrs;
|
||||
@ -545,8 +542,8 @@ iser_calc_scsi_params(struct iser_conn *iser_conn,
|
||||
static void iser_addr_handler(struct rdma_cm_id *cma_id)
|
||||
{
|
||||
struct iser_device *device;
|
||||
struct iser_conn *iser_conn;
|
||||
struct ib_conn *ib_conn;
|
||||
struct iser_conn *iser_conn;
|
||||
struct ib_conn *ib_conn;
|
||||
int ret;
|
||||
|
||||
iser_conn = cma_id->context;
|
||||
@ -593,7 +590,7 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id)
|
||||
static void iser_route_handler(struct rdma_cm_id *cma_id)
|
||||
{
|
||||
struct rdma_conn_param conn_param;
|
||||
int ret;
|
||||
int ret;
|
||||
struct iser_cm_hdr req_hdr;
|
||||
struct iser_conn *iser_conn = cma_id->context;
|
||||
struct ib_conn *ib_conn = &iser_conn->ib_conn;
|
||||
@ -609,9 +606,9 @@ static void iser_route_handler(struct rdma_cm_id *cma_id)
|
||||
|
||||
memset(&conn_param, 0, sizeof conn_param);
|
||||
conn_param.responder_resources = ib_dev->attrs.max_qp_rd_atom;
|
||||
conn_param.initiator_depth = 1;
|
||||
conn_param.retry_count = 7;
|
||||
conn_param.rnr_retry_count = 6;
|
||||
conn_param.initiator_depth = 1;
|
||||
conn_param.retry_count = 7;
|
||||
conn_param.rnr_retry_count = 6;
|
||||
|
||||
memset(&req_hdr, 0, sizeof(req_hdr));
|
||||
req_hdr.flags = ISER_ZBVA_NOT_SUP;
|
||||
@ -687,7 +684,8 @@ static void iser_cleanup_handler(struct rdma_cm_id *cma_id,
|
||||
complete(&iser_conn->ib_completion);
|
||||
}
|
||||
|
||||
static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
|
||||
static int iser_cma_handler(struct rdma_cm_id *cma_id,
|
||||
struct rdma_cm_event *event)
|
||||
{
|
||||
struct iser_conn *iser_conn;
|
||||
int ret = 0;
|
||||
@ -764,10 +762,8 @@ void iser_conn_init(struct iser_conn *iser_conn)
|
||||
* starts the process of connecting to the target
|
||||
* sleeps until the connection is established or rejected
|
||||
*/
|
||||
int iser_connect(struct iser_conn *iser_conn,
|
||||
struct sockaddr *src_addr,
|
||||
struct sockaddr *dst_addr,
|
||||
int non_blocking)
|
||||
int iser_connect(struct iser_conn *iser_conn, struct sockaddr *src_addr,
|
||||
struct sockaddr *dst_addr, int non_blocking)
|
||||
{
|
||||
struct ib_conn *ib_conn = &iser_conn->ib_conn;
|
||||
int err = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user