Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91412
b: refs/heads/master
c: 0532193
h: refs/heads/master
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Apr 20, 2008
1 parent 6efe2e0 commit f3d769e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f4e91eb4a81559da87a3843758a641b5cc590b65
refs/heads/master: 05321937469a8592d6a6d35f1d38ca882d243044
49 changes: 26 additions & 23 deletions trunk/drivers/infiniband/ulp/srp/ib_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ static struct srp_iu *srp_alloc_iu(struct srp_host *host, size_t size,
if (!iu->buf)
goto out_free_iu;

iu->dma = ib_dma_map_single(host->dev->dev, iu->buf, size, direction);
if (ib_dma_mapping_error(host->dev->dev, iu->dma))
iu->dma = ib_dma_map_single(host->srp_dev->dev, iu->buf, size,
direction);
if (ib_dma_mapping_error(host->srp_dev->dev, iu->dma))
goto out_free_buf;

iu->size = size;
Expand All @@ -161,7 +162,8 @@ static void srp_free_iu(struct srp_host *host, struct srp_iu *iu)
if (!iu)
return;

ib_dma_unmap_single(host->dev->dev, iu->dma, iu->size, iu->direction);
ib_dma_unmap_single(host->srp_dev->dev, iu->dma, iu->size,
iu->direction);
kfree(iu->buf);
kfree(iu);
}
Expand All @@ -181,7 +183,7 @@ static int srp_init_qp(struct srp_target_port *target,
if (!attr)
return -ENOMEM;

ret = ib_find_cached_pkey(target->srp_host->dev->dev,
ret = ib_find_cached_pkey(target->srp_host->srp_dev->dev,
target->srp_host->port,
be16_to_cpu(target->path.pkey),
&attr->pkey_index);
Expand All @@ -208,7 +210,7 @@ static int srp_new_cm_id(struct srp_target_port *target)
{
struct ib_cm_id *new_cm_id;

new_cm_id = ib_create_cm_id(target->srp_host->dev->dev,
new_cm_id = ib_create_cm_id(target->srp_host->srp_dev->dev,
srp_cm_handler, target);
if (IS_ERR(new_cm_id))
return PTR_ERR(new_cm_id);
Expand All @@ -229,8 +231,8 @@ static int srp_create_target_ib(struct srp_target_port *target)
if (!init_attr)
return -ENOMEM;

target->cq = ib_create_cq(target->srp_host->dev->dev, srp_completion,
NULL, target, SRP_CQ_SIZE, 0);
target->cq = ib_create_cq(target->srp_host->srp_dev->dev,
srp_completion, NULL, target, SRP_CQ_SIZE, 0);
if (IS_ERR(target->cq)) {
ret = PTR_ERR(target->cq);
goto out;
Expand All @@ -248,7 +250,7 @@ static int srp_create_target_ib(struct srp_target_port *target)
init_attr->send_cq = target->cq;
init_attr->recv_cq = target->cq;

target->qp = ib_create_qp(target->srp_host->dev->pd, init_attr);
target->qp = ib_create_qp(target->srp_host->srp_dev->pd, init_attr);
if (IS_ERR(target->qp)) {
ret = PTR_ERR(target->qp);
ib_destroy_cq(target->cq);
Expand Down Expand Up @@ -302,7 +304,7 @@ static int srp_lookup_path(struct srp_target_port *target)
init_completion(&target->done);

target->path_query_id = ib_sa_path_rec_get(&srp_sa_client,
target->srp_host->dev->dev,
target->srp_host->srp_dev->dev,
target->srp_host->port,
&target->path,
IB_SA_PATH_REC_SERVICE_ID |
Expand Down Expand Up @@ -403,7 +405,7 @@ static int srp_send_req(struct srp_target_port *target)
(unsigned long long) be64_to_cpu(target->ioc_guid));
memset(req->priv.initiator_port_id, 0, 8);
memcpy(req->priv.initiator_port_id + 8,
&target->srp_host->dev->dev->node_guid, 8);
&target->srp_host->srp_dev->dev->node_guid, 8);
}

status = ib_send_cm_req(target->cm_id, &req->param);
Expand Down Expand Up @@ -520,7 +522,7 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd,
req->fmr = NULL;
}

ib_dma_unmap_sg(target->srp_host->dev->dev, scsi_sglist(scmnd),
ib_dma_unmap_sg(target->srp_host->srp_dev->dev, scsi_sglist(scmnd),
scsi_sg_count(scmnd), scmnd->sc_data_direction);
}

Expand Down Expand Up @@ -628,7 +630,7 @@ static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat,
int page_cnt;
int i, j;
int ret;
struct srp_device *dev = target->srp_host->dev;
struct srp_device *dev = target->srp_host->srp_dev;
struct ib_device *ibdev = dev->dev;
struct scatterlist *sg;

Expand Down Expand Up @@ -723,7 +725,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
nents = scsi_sg_count(scmnd);
scat = scsi_sglist(scmnd);

dev = target->srp_host->dev;
dev = target->srp_host->srp_dev;
ibdev = dev->dev;

count = ib_dma_map_sg(ibdev, scat, nents, scmnd->sc_data_direction);
Expand Down Expand Up @@ -779,7 +781,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
buf->table_desc.va =
cpu_to_be64(req->cmd->dma + sizeof *cmd + sizeof *buf);
buf->table_desc.key =
cpu_to_be32(target->srp_host->dev->mr->rkey);
cpu_to_be32(target->srp_host->srp_dev->mr->rkey);
buf->table_desc.len =
cpu_to_be32(count * sizeof (struct srp_direct_buf));

Expand Down Expand Up @@ -855,7 +857,7 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)

iu = target->rx_ring[wc->wr_id & ~SRP_OP_RECV];

dev = target->srp_host->dev->dev;
dev = target->srp_host->srp_dev->dev;
ib_dma_sync_single_for_cpu(dev, iu->dma, target->max_ti_iu_len,
DMA_FROM_DEVICE);

Expand Down Expand Up @@ -937,7 +939,7 @@ static int __srp_post_recv(struct srp_target_port *target)

list.addr = iu->dma;
list.length = iu->size;
list.lkey = target->srp_host->dev->mr->lkey;
list.lkey = target->srp_host->srp_dev->mr->lkey;

wr.next = NULL;
wr.sg_list = &list;
Expand Down Expand Up @@ -996,7 +998,7 @@ static int __srp_post_send(struct srp_target_port *target,

list.addr = iu->dma;
list.length = len;
list.lkey = target->srp_host->dev->mr->lkey;
list.lkey = target->srp_host->srp_dev->mr->lkey;

wr.next = NULL;
wr.wr_id = target->tx_head & SRP_SQ_SIZE;
Expand Down Expand Up @@ -1039,7 +1041,7 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
if (!iu)
goto err;

dev = target->srp_host->dev->dev;
dev = target->srp_host->srp_dev->dev;
ib_dma_sync_single_for_cpu(dev, iu->dma, srp_max_iu_len,
DMA_TO_DEVICE);

Expand Down Expand Up @@ -1563,7 +1565,7 @@ static ssize_t show_local_ib_device(struct class_device *cdev, char *buf)
{
struct srp_target_port *target = host_to_target(class_to_shost(cdev));

return sprintf(buf, "%s\n", target->srp_host->dev->dev->name);
return sprintf(buf, "%s\n", target->srp_host->srp_dev->dev->name);
}

static CLASS_DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL);
Expand Down Expand Up @@ -1613,7 +1615,7 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
sprintf(target->target_name, "SRP.T10:%016llX",
(unsigned long long) be64_to_cpu(target->id_ext));

if (scsi_add_host(target->scsi_host, host->dev->dev->dma_device))
if (scsi_add_host(target->scsi_host, host->srp_dev->dev->dma_device))
return -ENODEV;

memcpy(ids.port_id, &target->id_ext, 8);
Expand Down Expand Up @@ -1871,7 +1873,8 @@ static ssize_t srp_create_target(struct class_device *class_dev,
if (ret)
goto err;

ib_get_cached_gid(host->dev->dev, host->port, 0, &target->path.sgid);
ib_get_cached_gid(host->srp_dev->dev, host->port, 0,
&target->path.sgid);

shost_printk(KERN_DEBUG, target->scsi_host, PFX
"new target: id_ext %016llx ioc_guid %016llx pkey %04x "
Expand Down Expand Up @@ -1933,7 +1936,7 @@ static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
struct srp_host *host =
container_of(class_dev, struct srp_host, class_dev);

return sprintf(buf, "%s\n", host->dev->dev->name);
return sprintf(buf, "%s\n", host->srp_dev->dev->name);
}

static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
Expand All @@ -1959,7 +1962,7 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
INIT_LIST_HEAD(&host->target_list);
spin_lock_init(&host->target_lock);
init_completion(&host->released);
host->dev = device;
host->srp_dev = device;
host->port = port;

host->class_dev.class = &srp_class;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/infiniband/ulp/srp/ib_srp.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct srp_device {
};

struct srp_host {
struct srp_device *dev;
struct srp_device *srp_dev;
u8 port;
struct class_device class_dev;
struct list_head target_list;
Expand Down

0 comments on commit f3d769e

Please sign in to comment.