Merge branch 'for-3.1-rc1' of git://gitorious.org/linux-omap-dss2/linux
[cascardo/linux.git] / drivers / scsi / bfa / bfad_im.c
index c2b3617..0131238 100644 (file)
@@ -175,21 +175,11 @@ bfad_im_info(struct Scsi_Host *shost)
        struct bfad_im_port_s *im_port =
                        (struct bfad_im_port_s *) shost->hostdata[0];
        struct bfad_s *bfad = im_port->bfad;
-       struct bfa_s *bfa = &bfad->bfa;
-       struct bfa_ioc_s *ioc = &bfa->ioc;
-       char model[BFA_ADAPTER_MODEL_NAME_LEN];
-
-       bfa_get_adapter_model(bfa, model);
 
        memset(bfa_buf, 0, sizeof(bfa_buf));
-       if (ioc->ctdev && !ioc->fcmode)
-               snprintf(bfa_buf, sizeof(bfa_buf),
-               "Brocade FCOE Adapter, " "model: %s hwpath: %s driver: %s",
-                model, bfad->pci_name, BFAD_DRIVER_VERSION);
-       else
-               snprintf(bfa_buf, sizeof(bfa_buf),
-               "Brocade FC Adapter, " "model: %s hwpath: %s driver: %s",
-               model, bfad->pci_name, BFAD_DRIVER_VERSION);
+       snprintf(bfa_buf, sizeof(bfa_buf),
+               "Brocade FC/FCOE Adapter, " "hwpath: %s driver: %s",
+               bfad->pci_name, BFAD_DRIVER_VERSION);
 
        return bfa_buf;
 }
@@ -572,9 +562,6 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
                goto out_fc_rel;
        }
 
-       /* setup host fixed attribute if the lk supports */
-       bfad_fc_host_init(im_port);
-
        return 0;
 
 out_fc_rel:
@@ -669,6 +656,31 @@ bfad_im_port_clean(struct bfad_im_port_s *im_port)
        spin_unlock_irqrestore(&bfad->bfad_lock, flags);
 }
 
+static void bfad_aen_im_notify_handler(struct work_struct *work)
+{
+       struct bfad_im_s *im =
+               container_of(work, struct bfad_im_s, aen_im_notify_work);
+       struct bfa_aen_entry_s *aen_entry;
+       struct bfad_s *bfad = im->bfad;
+       struct Scsi_Host *shost = bfad->pport.im_port->shost;
+       void *event_data;
+       unsigned long flags;
+
+       while (!list_empty(&bfad->active_aen_q)) {
+               spin_lock_irqsave(&bfad->bfad_aen_spinlock, flags);
+               bfa_q_deq(&bfad->active_aen_q, &aen_entry);
+               spin_unlock_irqrestore(&bfad->bfad_aen_spinlock, flags);
+               event_data = (char *)aen_entry + sizeof(struct list_head);
+               fc_host_post_vendor_event(shost, fc_get_event_number(),
+                               sizeof(struct bfa_aen_entry_s) -
+                               sizeof(struct list_head),
+                               (char *)event_data, BFAD_NL_VENDOR_ID);
+               spin_lock_irqsave(&bfad->bfad_aen_spinlock, flags);
+               list_add_tail(&aen_entry->qe, &bfad->free_aen_q);
+               spin_unlock_irqrestore(&bfad->bfad_aen_spinlock, flags);
+       }
+}
+
 bfa_status_t
 bfad_im_probe(struct bfad_s *bfad)
 {
@@ -689,6 +701,7 @@ bfad_im_probe(struct bfad_s *bfad)
                rc = BFA_STATUS_FAILED;
        }
 
+       INIT_WORK(&im->aen_im_notify_work, bfad_aen_im_notify_handler);
 ext:
        return rc;
 }
@@ -713,6 +726,9 @@ bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad)
        else
                sht = &bfad_im_vport_template;
 
+       if (max_xfer_size != BFAD_MAX_SECTORS >> 1)
+               sht->max_sectors = max_xfer_size << 1;
+
        sht->sg_tablesize = bfad->cfg_data.io_max_sge;
 
        return scsi_host_alloc(sht, sizeof(unsigned long));
@@ -790,7 +806,8 @@ struct scsi_host_template bfad_im_scsi_host_template = {
        .cmd_per_lun = 3,
        .use_clustering = ENABLE_CLUSTERING,
        .shost_attrs = bfad_im_host_attrs,
-       .max_sectors = 0xFFFF,
+       .max_sectors = BFAD_MAX_SECTORS,
+       .vendor_id = BFA_PCI_VENDOR_ID_BROCADE,
 };
 
 struct scsi_host_template bfad_im_vport_template = {
@@ -811,7 +828,7 @@ struct scsi_host_template bfad_im_vport_template = {
        .cmd_per_lun = 3,
        .use_clustering = ENABLE_CLUSTERING,
        .shost_attrs = bfad_im_vport_attrs,
-       .max_sectors = 0xFFFF,
+       .max_sectors = BFAD_MAX_SECTORS,
 };
 
 bfa_status_t
@@ -925,7 +942,10 @@ bfad_im_supported_speeds(struct bfa_s *bfa)
                return 0;
 
        bfa_ioc_get_attr(&bfa->ioc, ioc_attr);
-       if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_8GBPS) {
+       if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_16GBPS)
+               supported_speed |=  FC_PORTSPEED_16GBIT | FC_PORTSPEED_8GBIT |
+                               FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT;
+       else if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_8GBPS) {
                if (ioc_attr->adapter_attr.is_mezz) {
                        supported_speed |= FC_PORTSPEED_8GBIT |
                                FC_PORTSPEED_4GBIT |