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