[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070908084127G.tomof@acm.org>
Date: Sat, 8 Sep 2007 16:41:09 +0900
From: FUJITA Tomonori <tomof@....org>
To: open-iscsi@...glegroups.com
Cc: fujita.tomonori@....ntt.co.jp
Subject: Re: [PATCH v3 2/2][BNX2]: Add iSCSI support to BNX2 devices.
On Fri, 07 Sep 2007 17:36:47 -0500
Mike Christie <michaelc@...wisc.edu> wrote:
> > +/*
> > + * 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);
Can you use scsi_dma_map() here?
> > + 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);
Please use scsi_for_each_sg().
You can't directly access to use_sg, request_buffer, request_bufflen,
and resid in scsi_cmnd structure. Please use the scsi data accessors
in scsi_cmnd.h: scsi_sg_count, scsi_sglist, scsi_bufflen,
scsi_set_resid, and scsi_get_resid.
> 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.
Yeah, iommu code ignores the lld limitations (the problem is that the
lld limitations are in request_queue and iommu code can't access to
request_queue). There is no way to tell iommu code about the lld
limitations.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists