aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2006-04-06 22:13:36 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-04-14 15:03:41 -0400
commitfd7255f51a13ea915099c7e488001dfbbeb05104 (patch)
tree964624f68f000848dae1a9f4c396502849707826 /drivers/scsi/iscsi_tcp.c
parentb5c7a12dc29ae0990d9e867749bdd717a3160325 (diff)
[SCSI] iscsi: add sysfs attrs for uspace sync up
For iscsi boot when going from initramfs to the real root we need to stop the userpsace iscsi daemon. To later restart it iscsid needs to be able to rebuild itself and part of that process is matching a session running the kernel with the iscsid representation. To do this the attached patch adds several required iscsi values. If the LLD does not provide them becuase, login is done in userspace, then the transport class and userspace set ths up for the LLD. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r--drivers/scsi/iscsi_tcp.c68
1 files changed, 66 insertions, 2 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 6ecb4baa37e..6e510f3cfbf 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -3536,7 +3536,7 @@ iscsi_session_get_param(struct iscsi_cls_session *cls_session,
3536 *value = session->ofmarker_en; 3536 *value = session->ofmarker_en;
3537 break; 3537 break;
3538 default: 3538 default:
3539 return ISCSI_ERR_PARAM_NOT_FOUND; 3539 return -EINVAL;
3540 } 3540 }
3541 3541
3542 return 0; 3542 return 0;
@@ -3547,6 +3547,7 @@ iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
3547 enum iscsi_param param, uint32_t *value) 3547 enum iscsi_param param, uint32_t *value)
3548{ 3548{
3549 struct iscsi_conn *conn = cls_conn->dd_data; 3549 struct iscsi_conn *conn = cls_conn->dd_data;
3550 struct inet_sock *inet;
3550 3551
3551 switch(param) { 3552 switch(param) {
3552 case ISCSI_PARAM_MAX_RECV_DLENGTH: 3553 case ISCSI_PARAM_MAX_RECV_DLENGTH:
@@ -3561,13 +3562,61 @@ iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
3561 case ISCSI_PARAM_DATADGST_EN: 3562 case ISCSI_PARAM_DATADGST_EN:
3562 *value = conn->datadgst_en; 3563 *value = conn->datadgst_en;
3563 break; 3564 break;
3565 case ISCSI_PARAM_CONN_PORT:
3566 mutex_lock(&conn->xmitmutex);
3567 if (!conn->sock) {
3568 mutex_unlock(&conn->xmitmutex);
3569 return -EINVAL;
3570 }
3571
3572 inet = inet_sk(conn->sock->sk);
3573 *value = be16_to_cpu(inet->dport);
3574 mutex_unlock(&conn->xmitmutex);
3564 default: 3575 default:
3565 return ISCSI_ERR_PARAM_NOT_FOUND; 3576 return -EINVAL;
3566 } 3577 }
3567 3578
3568 return 0; 3579 return 0;
3569} 3580}
3570 3581
3582static int
3583iscsi_conn_get_str_param(struct iscsi_cls_conn *cls_conn,
3584 enum iscsi_param param, char *buf)
3585{
3586 struct iscsi_conn *conn = cls_conn->dd_data;
3587 struct sock *sk;
3588 struct inet_sock *inet;
3589 struct ipv6_pinfo *np;
3590 int len = 0;
3591
3592 switch (param) {
3593 case ISCSI_PARAM_CONN_ADDRESS:
3594 mutex_lock(&conn->xmitmutex);
3595 if (!conn->sock) {
3596 mutex_unlock(&conn->xmitmutex);
3597 return -EINVAL;
3598 }
3599
3600 sk = conn->sock->sk;
3601 if (sk->sk_family == PF_INET) {
3602 inet = inet_sk(sk);
3603 len = sprintf(buf, "%u.%u.%u.%u\n",
3604 NIPQUAD(inet->daddr));
3605 } else {
3606 np = inet6_sk(sk);
3607 len = sprintf(buf,
3608 "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
3609 NIP6(np->daddr));
3610 }
3611 mutex_unlock(&conn->xmitmutex);
3612 break;
3613 default:
3614 return -EINVAL;
3615 }
3616
3617 return len;
3618}
3619
3571static void 3620static void
3572iscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats) 3621iscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats)
3573{ 3622{
@@ -3610,6 +3659,20 @@ static struct iscsi_transport iscsi_tcp_transport = {
3610 .name = "tcp", 3659 .name = "tcp",
3611 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST 3660 .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST
3612 | CAP_DATADGST, 3661 | CAP_DATADGST,
3662 .param_mask = ISCSI_MAX_RECV_DLENGTH |
3663 ISCSI_MAX_XMIT_DLENGTH |
3664 ISCSI_HDRDGST_EN |
3665 ISCSI_DATADGST_EN |
3666 ISCSI_INITIAL_R2T_EN |
3667 ISCSI_MAX_R2T |
3668 ISCSI_IMM_DATA_EN |
3669 ISCSI_FIRST_BURST |
3670 ISCSI_MAX_BURST |
3671 ISCSI_PDU_INORDER_EN |
3672 ISCSI_DATASEQ_INORDER_EN |
3673 ISCSI_ERL |
3674 ISCSI_CONN_PORT |
3675 ISCSI_CONN_ADDRESS,
3613 .host_template = &iscsi_sht, 3676 .host_template = &iscsi_sht,
3614 .hostdata_size = sizeof(struct iscsi_session), 3677 .hostdata_size = sizeof(struct iscsi_session),
3615 .conndata_size = sizeof(struct iscsi_conn), 3678 .conndata_size = sizeof(struct iscsi_conn),
@@ -3622,6 +3685,7 @@ static struct iscsi_transport iscsi_tcp_transport = {
3622 .destroy_conn = iscsi_conn_destroy, 3685 .destroy_conn = iscsi_conn_destroy,
3623 .set_param = iscsi_conn_set_param, 3686 .set_param = iscsi_conn_set_param,
3624 .get_conn_param = iscsi_conn_get_param, 3687 .get_conn_param = iscsi_conn_get_param,
3688 .get_conn_str_param = iscsi_conn_get_str_param,
3625 .get_session_param = iscsi_session_get_param, 3689 .get_session_param = iscsi_session_get_param,
3626 .start_conn = iscsi_conn_start, 3690 .start_conn = iscsi_conn_start,
3627 .stop_conn = iscsi_conn_stop, 3691 .stop_conn = iscsi_conn_stop,