zfcp_scsi.c (175b79f0632544d62aae72e5496c14e3e3ff2ae7) zfcp_scsi.c (1daa4eb50fa5cd4c8f9c55452606e786fd42053b)
1/*
2 * zfcp device driver
3 *
4 * Interface to Linux SCSI midlayer.
5 *
6 * Copyright IBM Corporation 2002, 2010
7 */
8

--- 130 unchanged lines hidden (view full) ---

139 unsigned long flags;
140 struct zfcp_port *port;
141 struct zfcp_unit *unit = NULL;
142
143 read_lock_irqsave(&adapter->port_list_lock, flags);
144 list_for_each_entry(port, &adapter->port_list, list) {
145 if (!port->rport || (id != port->rport->scsi_target_id))
146 continue;
1/*
2 * zfcp device driver
3 *
4 * Interface to Linux SCSI midlayer.
5 *
6 * Copyright IBM Corporation 2002, 2010
7 */
8

--- 130 unchanged lines hidden (view full) ---

139 unsigned long flags;
140 struct zfcp_port *port;
141 struct zfcp_unit *unit = NULL;
142
143 read_lock_irqsave(&adapter->port_list_lock, flags);
144 list_for_each_entry(port, &adapter->port_list, list) {
145 if (!port->rport || (id != port->rport->scsi_target_id))
146 continue;
147 unit = zfcp_get_unit_by_lun(port, lun);
147 unit = zfcp_unit_find(port, lun);
148 if (unit)
149 break;
150 }
151 read_unlock_irqrestore(&adapter->port_list_lock, flags);
152
153 return unit;
154}
155

--- 373 unchanged lines hidden (view full) ---

529 port = zfcp_get_port_by_wwpn(adapter, rport->port_name);
530
531 if (port) {
532 zfcp_erp_port_forced_reopen(port, 0, "sctrpi1", NULL);
533 put_device(&port->dev);
534 }
535}
536
148 if (unit)
149 break;
150 }
151 read_unlock_irqrestore(&adapter->port_list_lock, flags);
152
153 return unit;
154}
155

--- 373 unchanged lines hidden (view full) ---

529 port = zfcp_get_port_by_wwpn(adapter, rport->port_name);
530
531 if (port) {
532 zfcp_erp_port_forced_reopen(port, 0, "sctrpi1", NULL);
533 put_device(&port->dev);
534 }
535}
536
537static void zfcp_scsi_queue_unit_register(struct zfcp_port *port)
538{
539 struct zfcp_unit *unit;
540
541 read_lock_irq(&port->unit_list_lock);
542 list_for_each_entry(unit, &port->unit_list, list) {
543 get_device(&unit->dev);
544 if (scsi_queue_work(port->adapter->scsi_host,
545 &unit->scsi_work) <= 0)
546 put_device(&unit->dev);
547 }
548 read_unlock_irq(&port->unit_list_lock);
549}
550
551static void zfcp_scsi_rport_register(struct zfcp_port *port)
552{
553 struct fc_rport_identifiers ids;
554 struct fc_rport *rport;
555
556 if (port->rport)
557 return;
558

--- 10 unchanged lines hidden (view full) ---

569 return;
570 }
571
572 rport->maxframe_size = port->maxframe_size;
573 rport->supported_classes = port->supported_classes;
574 port->rport = rport;
575 port->starget_id = rport->scsi_target_id;
576
537static void zfcp_scsi_rport_register(struct zfcp_port *port)
538{
539 struct fc_rport_identifiers ids;
540 struct fc_rport *rport;
541
542 if (port->rport)
543 return;
544

--- 10 unchanged lines hidden (view full) ---

555 return;
556 }
557
558 rport->maxframe_size = port->maxframe_size;
559 rport->supported_classes = port->supported_classes;
560 port->rport = rport;
561 port->starget_id = rport->scsi_target_id;
562
577 zfcp_scsi_queue_unit_register(port);
563 zfcp_unit_queue_scsi_scan(port);
578}
579
580static void zfcp_scsi_rport_block(struct zfcp_port *port)
581{
582 struct fc_rport *rport = port->rport;
583
584 if (rport) {
585 fc_remote_port_delete(rport);

--- 47 unchanged lines hidden (view full) ---

633 zfcp_scsi_rport_block(port);
634 }
635 }
636
637 put_device(&port->dev);
638}
639
640/**
564}
565
566static void zfcp_scsi_rport_block(struct zfcp_port *port)
567{
568 struct fc_rport *rport = port->rport;
569
570 if (rport) {
571 fc_remote_port_delete(rport);

--- 47 unchanged lines hidden (view full) ---

619 zfcp_scsi_rport_block(port);
620 }
621 }
622
623 put_device(&port->dev);
624}
625
626/**
641 * zfcp_scsi_scan - Register LUN with SCSI midlayer
642 * @unit: The LUN/unit to register
643 */
644void zfcp_scsi_scan(struct zfcp_unit *unit)
645{
646 struct fc_rport *rport = unit->port->rport;
647
648 if (rport && rport->port_state == FC_PORTSTATE_ONLINE)
649 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id,
650 scsilun_to_int((struct scsi_lun *)
651 &unit->fcp_lun), 0);
652}
653
654void zfcp_scsi_scan_work(struct work_struct *work)
655{
656 struct zfcp_unit *unit = container_of(work, struct zfcp_unit,
657 scsi_work);
658
659 zfcp_scsi_scan(unit);
660 put_device(&unit->dev);
661}
662
663/**
664 * zfcp_scsi_set_prot - Configure DIF/DIX support in scsi_host
665 * @adapter: The adapter where to configure DIF/DIX for the SCSI host
666 */
667void zfcp_scsi_set_prot(struct zfcp_adapter *adapter)
668{
669 unsigned int mask = 0;
670 unsigned int data_div;
671 struct Scsi_Host *shost = adapter->scsi_host;

--- 4 unchanged lines hidden (view full) ---

676 if (enable_dif &&
677 adapter->adapter_features & FSF_FEATURE_DIF_PROT_TYPE1)
678 mask |= SHOST_DIF_TYPE1_PROTECTION;
679
680 if (enable_dif && data_div &&
681 adapter->adapter_features & FSF_FEATURE_DIX_PROT_TCPIP) {
682 mask |= SHOST_DIX_TYPE1_PROTECTION;
683 scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP);
627 * zfcp_scsi_set_prot - Configure DIF/DIX support in scsi_host
628 * @adapter: The adapter where to configure DIF/DIX for the SCSI host
629 */
630void zfcp_scsi_set_prot(struct zfcp_adapter *adapter)
631{
632 unsigned int mask = 0;
633 unsigned int data_div;
634 struct Scsi_Host *shost = adapter->scsi_host;

--- 4 unchanged lines hidden (view full) ---

639 if (enable_dif &&
640 adapter->adapter_features & FSF_FEATURE_DIF_PROT_TYPE1)
641 mask |= SHOST_DIF_TYPE1_PROTECTION;
642
643 if (enable_dif && data_div &&
644 adapter->adapter_features & FSF_FEATURE_DIX_PROT_TCPIP) {
645 mask |= SHOST_DIX_TYPE1_PROTECTION;
646 scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP);
684 shost->sg_prot_tablesize = ZFCP_QDIO_MAX_SBALES_PER_REQ / 2;
685 shost->sg_tablesize = ZFCP_QDIO_MAX_SBALES_PER_REQ / 2;
686 shost->max_sectors = ZFCP_QDIO_MAX_SBALES_PER_REQ * 8 / 2;
687 }
688
689 scsi_host_set_prot(shost, mask);
690}
691
692/**

--- 74 unchanged lines hidden ---
647 shost->sg_tablesize = ZFCP_QDIO_MAX_SBALES_PER_REQ / 2;
648 shost->max_sectors = ZFCP_QDIO_MAX_SBALES_PER_REQ * 8 / 2;
649 }
650
651 scsi_host_set_prot(shost, mask);
652}
653
654/**

--- 74 unchanged lines hidden ---