diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2006-06-28 13:00:25 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-29 11:07:41 -0400 |
commit | 358ff019b89aa530ab6c0dd139d8089c932b103f (patch) | |
tree | ea163e2b5f785fbabd71281cd9fd1683360f909c /drivers/infiniband/ulp/iser | |
parent | a54a52caad4bd6166cb7fa64e4e93031fa2fda5d (diff) |
[SCSI] iscsi: convert iser to new set/get param fns
Convert iser to libiscsi get/set param functions.
Fix bugs in it returning old error return values and
have it expose exp_statsn.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/infiniband/ulp/iser')
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 138 |
1 files changed, 17 insertions, 121 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 4c3f2de2a06e..d277fdff5dc1 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -438,159 +438,50 @@ iscsi_iser_session_create(struct iscsi_transport *iscsit, | |||
438 | } | 438 | } |
439 | 439 | ||
440 | static int | 440 | static int |
441 | iscsi_iser_conn_set_param(struct iscsi_cls_conn *cls_conn, | 441 | iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn, |
442 | enum iscsi_param param, uint32_t value) | 442 | enum iscsi_param param, char *buf, int buflen) |
443 | { | 443 | { |
444 | struct iscsi_conn *conn = cls_conn->dd_data; | 444 | int value; |
445 | struct iscsi_session *session = conn->session; | ||
446 | |||
447 | spin_lock_bh(&session->lock); | ||
448 | if (conn->c_stage != ISCSI_CONN_INITIAL_STAGE && | ||
449 | conn->stop_stage != STOP_CONN_RECOVER) { | ||
450 | printk(KERN_ERR "iscsi_iser: can not change parameter [%d]\n", | ||
451 | param); | ||
452 | spin_unlock_bh(&session->lock); | ||
453 | return 0; | ||
454 | } | ||
455 | spin_unlock_bh(&session->lock); | ||
456 | 445 | ||
457 | switch (param) { | 446 | switch (param) { |
458 | case ISCSI_PARAM_MAX_RECV_DLENGTH: | 447 | case ISCSI_PARAM_MAX_RECV_DLENGTH: |
459 | /* TBD */ | 448 | /* TBD */ |
460 | break; | 449 | break; |
461 | case ISCSI_PARAM_MAX_XMIT_DLENGTH: | ||
462 | conn->max_xmit_dlength = value; | ||
463 | break; | ||
464 | case ISCSI_PARAM_HDRDGST_EN: | 450 | case ISCSI_PARAM_HDRDGST_EN: |
451 | sscanf(buf, "%d", &value); | ||
465 | if (value) { | 452 | if (value) { |
466 | printk(KERN_ERR "DataDigest wasn't negotiated to None"); | 453 | printk(KERN_ERR "DataDigest wasn't negotiated to None"); |
467 | return -EPROTO; | 454 | return -EPROTO; |
468 | } | 455 | } |
469 | break; | 456 | break; |
470 | case ISCSI_PARAM_DATADGST_EN: | 457 | case ISCSI_PARAM_DATADGST_EN: |
458 | sscanf(buf, "%d", &value); | ||
471 | if (value) { | 459 | if (value) { |
472 | printk(KERN_ERR "DataDigest wasn't negotiated to None"); | 460 | printk(KERN_ERR "DataDigest wasn't negotiated to None"); |
473 | return -EPROTO; | 461 | return -EPROTO; |
474 | } | 462 | } |
475 | break; | 463 | break; |
476 | case ISCSI_PARAM_INITIAL_R2T_EN: | ||
477 | session->initial_r2t_en = value; | ||
478 | break; | ||
479 | case ISCSI_PARAM_IMM_DATA_EN: | ||
480 | session->imm_data_en = value; | ||
481 | break; | ||
482 | case ISCSI_PARAM_FIRST_BURST: | ||
483 | session->first_burst = value; | ||
484 | break; | ||
485 | case ISCSI_PARAM_MAX_BURST: | ||
486 | session->max_burst = value; | ||
487 | break; | ||
488 | case ISCSI_PARAM_PDU_INORDER_EN: | ||
489 | session->pdu_inorder_en = value; | ||
490 | break; | ||
491 | case ISCSI_PARAM_DATASEQ_INORDER_EN: | ||
492 | session->dataseq_inorder_en = value; | ||
493 | break; | ||
494 | case ISCSI_PARAM_ERL: | ||
495 | session->erl = value; | ||
496 | break; | ||
497 | case ISCSI_PARAM_IFMARKER_EN: | 464 | case ISCSI_PARAM_IFMARKER_EN: |
465 | sscanf(buf, "%d", &value); | ||
498 | if (value) { | 466 | if (value) { |
499 | printk(KERN_ERR "IFMarker wasn't negotiated to No"); | 467 | printk(KERN_ERR "IFMarker wasn't negotiated to No"); |
500 | return -EPROTO; | 468 | return -EPROTO; |
501 | } | 469 | } |
502 | break; | 470 | break; |
503 | case ISCSI_PARAM_OFMARKER_EN: | 471 | case ISCSI_PARAM_OFMARKER_EN: |
472 | sscanf(buf, "%d", &value); | ||
504 | if (value) { | 473 | if (value) { |
505 | printk(KERN_ERR "OFMarker wasn't negotiated to No"); | 474 | printk(KERN_ERR "OFMarker wasn't negotiated to No"); |
506 | return -EPROTO; | 475 | return -EPROTO; |
507 | } | 476 | } |
508 | break; | 477 | break; |
509 | default: | 478 | default: |
510 | break; | 479 | return iscsi_set_param(cls_conn, param, buf, buflen); |
511 | } | ||
512 | |||
513 | return 0; | ||
514 | } | ||
515 | |||
516 | static int | ||
517 | iscsi_iser_session_get_param(struct iscsi_cls_session *cls_session, | ||
518 | enum iscsi_param param, uint32_t *value) | ||
519 | { | ||
520 | struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); | ||
521 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); | ||
522 | |||
523 | switch (param) { | ||
524 | case ISCSI_PARAM_INITIAL_R2T_EN: | ||
525 | *value = session->initial_r2t_en; | ||
526 | break; | ||
527 | case ISCSI_PARAM_MAX_R2T: | ||
528 | *value = session->max_r2t; | ||
529 | break; | ||
530 | case ISCSI_PARAM_IMM_DATA_EN: | ||
531 | *value = session->imm_data_en; | ||
532 | break; | ||
533 | case ISCSI_PARAM_FIRST_BURST: | ||
534 | *value = session->first_burst; | ||
535 | break; | ||
536 | case ISCSI_PARAM_MAX_BURST: | ||
537 | *value = session->max_burst; | ||
538 | break; | ||
539 | case ISCSI_PARAM_PDU_INORDER_EN: | ||
540 | *value = session->pdu_inorder_en; | ||
541 | break; | ||
542 | case ISCSI_PARAM_DATASEQ_INORDER_EN: | ||
543 | *value = session->dataseq_inorder_en; | ||
544 | break; | ||
545 | case ISCSI_PARAM_ERL: | ||
546 | *value = session->erl; | ||
547 | break; | ||
548 | case ISCSI_PARAM_IFMARKER_EN: | ||
549 | *value = 0; | ||
550 | break; | ||
551 | case ISCSI_PARAM_OFMARKER_EN: | ||
552 | *value = 0; | ||
553 | break; | ||
554 | default: | ||
555 | return ISCSI_ERR_PARAM_NOT_FOUND; | ||
556 | } | ||
557 | |||
558 | return 0; | ||
559 | } | ||
560 | |||
561 | static int | ||
562 | iscsi_iser_conn_get_param(struct iscsi_cls_conn *cls_conn, | ||
563 | enum iscsi_param param, uint32_t *value) | ||
564 | { | ||
565 | struct iscsi_conn *conn = cls_conn->dd_data; | ||
566 | |||
567 | switch(param) { | ||
568 | case ISCSI_PARAM_MAX_RECV_DLENGTH: | ||
569 | *value = conn->max_recv_dlength; | ||
570 | break; | ||
571 | case ISCSI_PARAM_MAX_XMIT_DLENGTH: | ||
572 | *value = conn->max_xmit_dlength; | ||
573 | break; | ||
574 | case ISCSI_PARAM_HDRDGST_EN: | ||
575 | *value = 0; | ||
576 | break; | ||
577 | case ISCSI_PARAM_DATADGST_EN: | ||
578 | *value = 0; | ||
579 | break; | ||
580 | /*case ISCSI_PARAM_TARGET_RECV_DLENGTH: | ||
581 | *value = conn->target_recv_dlength; | ||
582 | break; | ||
583 | case ISCSI_PARAM_INITIATOR_RECV_DLENGTH: | ||
584 | *value = conn->initiator_recv_dlength; | ||
585 | break;*/ | ||
586 | default: | ||
587 | return ISCSI_ERR_PARAM_NOT_FOUND; | ||
588 | } | 480 | } |
589 | 481 | ||
590 | return 0; | 482 | return 0; |
591 | } | 483 | } |
592 | 484 | ||
593 | |||
594 | static void | 485 | static void |
595 | iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats) | 486 | iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats) |
596 | { | 487 | { |
@@ -702,7 +593,12 @@ static struct iscsi_transport iscsi_iser_transport = { | |||
702 | ISCSI_FIRST_BURST | | 593 | ISCSI_FIRST_BURST | |
703 | ISCSI_MAX_BURST | | 594 | ISCSI_MAX_BURST | |
704 | ISCSI_PDU_INORDER_EN | | 595 | ISCSI_PDU_INORDER_EN | |
705 | ISCSI_DATASEQ_INORDER_EN, | 596 | ISCSI_DATASEQ_INORDER_EN | |
597 | ISCSI_EXP_STATSN | | ||
598 | ISCSI_PERSISTENT_PORT | | ||
599 | ISCSI_PERSISTENT_ADDRESS | | ||
600 | ISCSI_TARGET_NAME | | ||
601 | ISCSI_TPGT, | ||
706 | .host_template = &iscsi_iser_sht, | 602 | .host_template = &iscsi_iser_sht, |
707 | .conndata_size = sizeof(struct iscsi_conn), | 603 | .conndata_size = sizeof(struct iscsi_conn), |
708 | .max_lun = ISCSI_ISER_MAX_LUN, | 604 | .max_lun = ISCSI_ISER_MAX_LUN, |
@@ -714,9 +610,9 @@ static struct iscsi_transport iscsi_iser_transport = { | |||
714 | .create_conn = iscsi_iser_conn_create, | 610 | .create_conn = iscsi_iser_conn_create, |
715 | .bind_conn = iscsi_iser_conn_bind, | 611 | .bind_conn = iscsi_iser_conn_bind, |
716 | .destroy_conn = iscsi_iser_conn_destroy, | 612 | .destroy_conn = iscsi_iser_conn_destroy, |
717 | .set_param = iscsi_iser_conn_set_param, | 613 | .set_param = iscsi_iser_set_param, |
718 | .get_conn_param = iscsi_iser_conn_get_param, | 614 | .get_conn_param = iscsi_conn_get_param, |
719 | .get_session_param = iscsi_iser_session_get_param, | 615 | .get_session_param = iscsi_session_get_param, |
720 | .start_conn = iscsi_iser_conn_start, | 616 | .start_conn = iscsi_iser_conn_start, |
721 | .stop_conn = iscsi_conn_stop, | 617 | .stop_conn = iscsi_conn_stop, |
722 | /* these are called as part of conn recovery */ | 618 | /* these are called as part of conn recovery */ |