Lines Matching defs:tgt
117 "Rpt-tgt rspbuf %p: PCI DMA Mapping Failed\n",
166 struct snic_tgt *tgt = container_of(work, struct snic_tgt, scan_work);
167 struct Scsi_Host *shost = dev_to_shost(&tgt->dev);
170 SNIC_HOST_INFO(shost, "Scanning Target id 0x%x\n", tgt->id);
171 scsi_scan_target(&tgt->dev,
172 tgt->channel,
173 tgt->scsi_tgt_id,
178 tgt->flags &= ~SNIC_TGT_SCAN_PENDING;
189 struct snic_tgt *tgt = NULL;
192 tgt = list_entry(cur, struct snic_tgt, list);
193 if (tgt->id == le32_to_cpu(tgtid->tgt_id))
194 return tgt;
195 tgt = NULL;
198 return tgt;
207 struct snic_tgt *tgt = dev_to_tgt(dev);
209 SNIC_HOST_INFO(snic_tgt_to_shost(tgt),
211 tgt->id,
214 SNIC_BUG_ON(!list_empty(&tgt->list));
215 kfree(tgt);
224 struct snic_tgt *tgt = container_of(work, struct snic_tgt, del_work);
225 struct Scsi_Host *shost = snic_tgt_to_shost(tgt);
227 if (tgt->flags & SNIC_TGT_SCAN_PENDING)
231 scsi_target_block(&tgt->dev);
234 snic_tgt_scsi_abort_io(tgt);
237 scsi_target_unblock(&tgt->dev, SDEV_TRANSPORT_OFFLINE);
240 scsi_remove_target(&tgt->dev); /* ?? */
241 device_del(&tgt->dev);
242 put_device(&tgt->dev);
251 struct snic_tgt *tgt = NULL;
255 tgt = snic_tgt_lookup(snic, tgtid);
256 if (tgt) {
258 return tgt;
261 tgt = kzalloc(sizeof(*tgt), GFP_KERNEL);
262 if (!tgt) {
266 return tgt;
269 INIT_LIST_HEAD(&tgt->list);
270 tgt->id = le32_to_cpu(tgtid->tgt_id);
271 tgt->channel = 0;
274 tgt->tdata.typ = le16_to_cpu(tgtid->tgt_type);
279 tgt->tdata.disc_id = 0;
280 tgt->state = SNIC_TGT_STAT_INIT;
281 device_initialize(&tgt->dev);
282 tgt->dev.parent = get_device(&snic->shost->shost_gendev);
283 tgt->dev.release = snic_tgt_dev_release;
284 INIT_WORK(&tgt->scan_work, snic_scsi_scan_tgt);
285 INIT_WORK(&tgt->del_work, snic_tgt_del);
286 switch (tgt->tdata.typ) {
288 dev_set_name(&tgt->dev, "snic_das_tgt:%d:%d-%d",
289 snic->shost->host_no, tgt->channel, tgt->id);
293 dev_set_name(&tgt->dev, "snic_san_tgt:%d:%d-%d",
294 snic->shost->host_no, tgt->channel, tgt->id);
299 dev_set_name(&tgt->dev, "snic_das_tgt:%d:%d-%d",
300 snic->shost->host_no, tgt->channel, tgt->id);
305 list_add_tail(&tgt->list, &snic->disc.tgt_list);
306 tgt->scsi_tgt_id = snic->disc.nxt_tgt_id++;
307 tgt->state = SNIC_TGT_STAT_ONLINE;
312 tgt->id, snic_tgt_type_to_str(tgt->tdata.typ));
314 ret = device_add(&tgt->dev);
322 list_del(&tgt->list);
324 put_device(&tgt->dev);
325 tgt = NULL;
327 return tgt;
330 SNIC_HOST_INFO(snic->shost, "Scanning %s.\n", dev_name(&tgt->dev));
332 scsi_queue_work(snic->shost, &tgt->scan_work);
334 return tgt;
343 struct snic_tgt *tgt = NULL;
377 tgt = snic_tgt_create(snic, &tgtid[i]);
378 if (!tgt) {
381 SNIC_HOST_ERR(snic->shost, "Failed to create tgt.\n");
547 struct snic_tgt *tgt = NULL;
557 tgt = list_entry(cur, struct snic_tgt, list);
558 tgt->state = SNIC_TGT_STAT_DEL;
559 list_del_init(&tgt->list);
560 SNIC_HOST_INFO(snic->shost, "Tgt %d q'ing for del\n", tgt->id);
561 queue_work(snic_glob->event_q, &tgt->del_work);
562 tgt = NULL;