linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCH 4/5] nvme-fabrics: Add target FC transport support
Date: Thu, 11 Aug 2016 14:22:38 -0700	[thread overview]
Message-ID: <20160811212238.GG18013@infradead.org> (raw)
In-Reply-To: <5792b91e.51+4Ind0/2MxGqHU%james.smart@broadcom.com>

> +config NVME_TARGET_FC
> +	tristate "NVMe over Fabrics FC target driver"
> +	select NVME_TARGET

this should be a depends, NVME_TARGET is a user visible option.

> +		/* TODO: better to use dma_map_page() ?*/
> +		iod->rspdma = dma_map_single(tgtport->dev, iod->rspbuf,
> +						NVME_FC_MAX_LS_BUFFER_SIZE,
> +						DMA_TO_DEVICE);
> +		if (dma_mapping_error(tgtport->dev, iod->rspdma))
> +			goto out_fail;

Same comment as on the host side.

> +	queue->work_q = alloc_workqueue("ntfc%d.%d.%d", 0, 0,
> +				assoc->tgtport->fc_target_port.port_num,
> +				assoc->a_id, qid);

Do we really need a workqueue per queue?

> +static struct nvmet_fc_tgt_queue *
> +nvmet_fc_find_target_queue(struct nvmet_fc_tgtport *tgtport,
> +				u64 connection_id)
> +{
> +	struct nvmet_fc_tgt_assoc *assoc;
> +	u64 association_id = nvmet_fc_getassociationid(connection_id);
> +	u16 qid = nvmet_fc_getqueueid(connection_id);
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&tgtport->lock, flags);
> +	list_for_each_entry(assoc, &tgtport->assoc_list, a_list) {
> +		if (association_id == assoc->association_id) {
> +			spin_unlock_irqrestore(&tgtport->lock, flags);
> +			return assoc->queues[qid];
> +		}
> +	}
> +	spin_unlock_irqrestore(&tgtport->lock, flags);
> +	return NULL;

No reference counting?

> +static struct nvmet_fc_tgt_assoc *
> +nvmet_fc_find_target_assoc(struct nvmet_fc_tgtport *tgtport,
> +				u64 association_id)
> +{
> +	struct nvmet_fc_tgt_assoc *assoc;
> +	struct nvmet_fc_tgt_assoc *ret = NULL;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&tgtport->lock, flags);
> +	list_for_each_entry(assoc, &tgtport->assoc_list, a_list) {
> +		if (association_id == assoc->association_id) {
> +			ret = assoc;
> +			break;
> +		}
> +	}
> +	spin_unlock_irqrestore(&tgtport->lock, flags);
> +
> +	return ret;

Same here?

  parent reply	other threads:[~2016-08-11 21:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-23  0:23 [PATCH 4/5] nvme-fabrics: Add target FC transport support James Smart
2016-08-02  4:37 ` J Freyensee
2016-08-22 16:56   ` James Smart
2016-08-11 21:22 ` Christoph Hellwig [this message]
2016-08-22 17:28   ` James Smart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160811212238.GG18013@infradead.org \
    --to=hch@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).