-----Original Message----- From: Mike Christie [mailto:michaelc@xxxxxxxxxxx] Sent: Wednesday, February 25, 2009 9:30 AM To: Karen Xie Cc: open-iscsi@xxxxxxxxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx; James.Bottomley@xxxxxxxxxxxxxxxxxxxxx Subject: Re: [PATCH 2/2 2.6.29-rc] cxgb3i - add handling of chip reset Some other comments about the host and snic allocation. Karen Xie wrote: > +/** > + * cxgb3i_adapter_open - initiate or update a s3 adapter structure and > + * any h/w settings > + * @t3dev: t3cdev adapter > + */ > +static inline int adapter_update(struct cxgb3i_adapter *snic) The function name and comment got out of sync. [Karen] Thanks, will fix it. > -void cxgb3i_adapter_remove(struct t3cdev *t3dev) > +void cxgb3i_adapter_open(struct t3cdev *t3dev) > { > - int i; > - struct cxgb3i_adapter *snic; > + struct cxgb3i_adapter *snic = cxgb3i_adapter_find_by_tdev(t3dev); > + int err; > > - /* remove from the list */ > - write_lock(&cxgb3i_snic_rwlock); > - list_for_each_entry(snic, &cxgb3i_snic_list, list_head) { > - if (snic->tdev == t3dev) { > - list_del(&snic->list_head); > - break; > - } > + if (snic) > + err = adapter_update(snic); > + else { > + snic = kzalloc(sizeof(*snic), GFP_KERNEL); > + if (snic) { > + spin_lock_init(&snic->lock); > + snic->tdev = t3dev; > + err = adapter_add(snic); > + } else > + err = -ENOMEM; > Does the snic represent the actual card. So if I had a dual ported card, I would have one snic and then have multple shosts/cxgb3i_hba for each port right? [Karen] Yes. It seemed strange because cxgb3i_hba_host_add sets the shost's parent to the pci device, and we get the pci device from the snic->pdev. And so I thought we see a pci device per port, so we would also should have a snic per port? [Karen] Each port/cxgb3i_hba has a pointer point back to the snic/adapter. So one snic per adapter, each snic contains one or more ports, each port corresponds to one shost. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html