cnic: Improve ->iscsi_nl_msg_send()
1. Change first parameter from cnic_dev to ulp_handle which is the hba pointer. All other similar upcalls are using hba pointer. The callee can then directly reference the hba without conversion. 2. Change return value from void to int so that an error code can be passed back. This allows the operation to be retried. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8adc9240f9
commit
939b82e5bd
3 changed files with 25 additions and 12 deletions
|
@ -279,6 +279,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
|
|||
u32 msg_type = ISCSI_KEVENT_IF_DOWN;
|
||||
struct cnic_ulp_ops *ulp_ops;
|
||||
struct cnic_uio_dev *udev = cp->udev;
|
||||
int rc = 0, retry = 0;
|
||||
|
||||
if (!udev || udev->uio_dev == -1)
|
||||
return -ENODEV;
|
||||
|
@ -303,11 +304,21 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
|
|||
path_req.pmtu = csk->mtu;
|
||||
}
|
||||
|
||||
rcu_read_lock();
|
||||
ulp_ops = rcu_dereference(cnic_ulp_tbl[CNIC_ULP_ISCSI]);
|
||||
if (ulp_ops)
|
||||
ulp_ops->iscsi_nl_send_msg(cp->dev, msg_type, buf, len);
|
||||
rcu_read_unlock();
|
||||
while (retry < 3) {
|
||||
rc = 0;
|
||||
rcu_read_lock();
|
||||
ulp_ops = rcu_dereference(cnic_ulp_tbl[CNIC_ULP_ISCSI]);
|
||||
if (ulp_ops)
|
||||
rc = ulp_ops->iscsi_nl_send_msg(
|
||||
cp->ulp_handle[CNIC_ULP_ISCSI],
|
||||
msg_type, buf, len);
|
||||
rcu_read_unlock();
|
||||
if (rc == 0 || msg_type != ISCSI_KEVENT_PATH_REQ)
|
||||
break;
|
||||
|
||||
msleep(100);
|
||||
retry++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue