All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: open-iscsi@googlegroups.com
Cc: davem@davemloft.net, mchristi@redhat.com, netdev@vger.kernel.org,
	anilgv@broadcom.com, talm@broadcom.com, lusinsky@broadcom.com,
	uri@broadcom.com
Subject: Re: [PATCH v3 2/2][BNX2]: Add iSCSI support to BNX2 devices.
Date: Fri, 07 Sep 2007 17:36:47 -0500	[thread overview]
Message-ID: <46E1D27F.2040701@cs.wisc.edu> (raw)
In-Reply-To: <1188599815.5176.12.camel@dell>

Some quick comments that got cut out of the original mail.


> +
> +/*
> + * map single buffer
> + */
> +static int bnx2i_map_single_buf(struct bnx2i_hba *hba,
> +				       struct bnx2i_cmd *cmd)
> +{
> +	struct scsi_cmnd *sc = cmd->scsi_cmd;
> +	struct iscsi_bd *bd = cmd->bd_tbl->bd_tbl;
> +	int byte_count;
> +	int bd_count;
> +	u64 addr;
> +
> +	byte_count = sc->request_bufflen;
> +	sc->SCp.dma_handle =
> +		pci_map_single(hba->pci_dev, sc->request_buffer,
> +			       sc->request_bufflen, sc->sc_data_direction);
> +	addr = sc->SCp.dma_handle;
> +
> +	if (byte_count > MAX_BD_LENGTH) {
> +		bd_count = bnx2i_split_bd(cmd, addr, byte_count, 0);
> +	} else {
> +		bd_count = 1;
> +		bd[0].buffer_addr_lo = addr & 0xffffffff;
> +		bd[0].buffer_addr_hi = addr >> 32;
> +		bd[0].buffer_length = sc->request_bufflen;
> +		bd[0].flags = ISCSI_BD_FIRST_IN_BD_CHAIN |
> +			      ISCSI_BD_LAST_IN_BD_CHAIN;
> +	}
> +	bd[bd_count - 1].flags |= ISCSI_BD_LAST_IN_BD_CHAIN;
> +
> +	return bd_count;
> +}

I think you should always be getting use_sg greater than zero now, so 
the map single path is not needed.


> +
> +
> +/*
> + * map SG list
> + */
> +static int bnx2i_map_sg(struct bnx2i_hba *hba, struct bnx2i_cmd *cmd)
> +{
> +	struct scsi_cmnd *sc = cmd->scsi_cmd;
> +	struct iscsi_bd *bd = cmd->bd_tbl->bd_tbl;
> +	struct scatterlist *sg;
> +	int byte_count = 0;
> +	int sg_frags;
> +	int bd_count = 0;
> +	int sg_count;
> +	int sg_len;
> +	u64 addr;
> +	int i;
> +
> +	sg = sc->request_buffer;
> +	sg_count = pci_map_sg(hba->pci_dev, sg, sc->use_sg,
> +			      sc->sc_data_direction);
> +
> +	for (i = 0; i < sg_count; i++) {
> +		sg_len = sg_dma_len(sg);
> +		addr = sg_dma_address(sg);
> +		if (sg_len > MAX_BD_LENGTH)
> +			sg_frags = bnx2i_split_bd(cmd, addr, sg_len,
> +						  bd_count);


If you call blk_queue_max_segment_size() in the slave_configure callout 
you can limit the size of the segments that the block layer builds so 
they are smaller than MAX_BD_LENGTH. However, I am not sure how useful 
that is. I think DMA-API.txt states that the mapping code is ok to 
merged mutliple sglists entries into one so I think that means that we 
can still end up with an entry that is larger than MAX_BD_LENGTH. Not 
sure if there is way to tell the pci/dma map_sg code to limit this too.

  parent reply	other threads:[~2007-09-07 22:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1188599815.5176.12.camel@dell>
2007-09-05 18:34 ` [PATCH v3 2/2][BNX2]: Add iSCSI support to BNX2 devices Mike Christie
2007-09-05 21:27   ` Anil Veerabhadrappa
2007-09-07 22:23     ` Mike Christie
2007-11-21 18:38       ` Anil Veerabhadrappa
2007-11-21 19:17         ` James Smart
     [not found]         ` <1195670296.8767.9.camel-opBMJL+S1+mb6IhXEaeG+wpgy58w7zIFpWgKQ6/u3Fg@public.gmane.org>
2007-11-27  4:15           ` Mike Christie
2007-11-28  0:44             ` Anil Veerabhadrappa
     [not found]               ` <1196210691.5980.20.camel-opBMJL+S1+mb6IhXEaeG+20Cxg0+/0ngpWgKQ6/u3Fg@public.gmane.org>
2007-11-28 20:06                 ` Mike Christie
2007-11-29  0:36                   ` Anil Veerabhadrappa
2007-09-08 11:59     ` Christoph Hellwig
2007-09-08 14:49       ` Michael Chan
2007-09-08 17:57         ` Anil Veerabhadrappa
2007-09-07 22:36 ` Mike Christie [this message]
2007-09-08  7:41   ` FUJITA Tomonori
2007-09-08 11:32     ` Jeff Garzik
2007-09-08 12:00       ` Christoph Hellwig
2007-09-09 15:05         ` FUJITA Tomonori
2007-09-25  8:39           ` Hannes Reinecke
2007-09-26  8:57             ` FUJITA Tomonori
2007-09-27  7:31               ` Jeff Garzik
2007-09-27  7:38                 ` Benjamin Herrenschmidt
2007-09-27  7:49                   ` Jeff Garzik
2007-09-27  8:12                     ` Benjamin Herrenschmidt
2007-09-27  8:22                       ` Jeff Garzik
2007-09-27  8:46                         ` FUJITA Tomonori
2007-09-27  8:06                 ` FUJITA Tomonori
2007-09-27  8:23                   ` Jeff Garzik

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=46E1D27F.2040701@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=anilgv@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=lusinsky@broadcom.com \
    --cc=mchristi@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=open-iscsi@googlegroups.com \
    --cc=talm@broadcom.com \
    --cc=uri@broadcom.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.