linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] qla1280: user pci_map_single
@ 2005-02-10 16:00 Christoph Hellwig
  2005-02-18  9:48 ` Jes Sorensen
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2005-02-10 16:00 UTC (permalink / raw)
  To: jejb, jes; +Cc: linux-scsi


--- 1.72/drivers/scsi/qla1280.c	2004-10-22 06:20:31 +02:00
+++ edited/drivers/scsi/qla1280.c	2005-02-10 13:42:44 +01:00
@@ -1571,16 +1465,12 @@ qla1280_done(struct scsi_qla_host *ha)
 
 		/* Release memory used for this I/O */
 		if (cmd->use_sg) {
-			dprintk(3, "S/G unmap_sg cmd=%p\n", cmd);
-
 			pci_unmap_sg(ha->pdev, cmd->request_buffer,
-				     cmd->use_sg, cmd->sc_data_direction);
+					cmd->use_sg, cmd->sc_data_direction);
 		} else if (cmd->request_bufflen) {
-			/*dprintk(1, "No S/G unmap_single cmd=%x saved_dma_handle=%lx\n",
-			  cmd, sp->saved_dma_handle); */
-
-			pci_unmap_page(ha->pdev, sp->saved_dma_handle,
-				       cmd->request_bufflen, cmd->sc_data_direction);
+			pci_unmap_single(ha->pdev, sp->saved_dma_handle,
+					cmd->request_bufflen,
+					cmd->sc_data_direction);
 		}
 
 		/* Call the mid-level driver interrupt handler */
@@ -3354,14 +3244,11 @@ qla1280_64bit_start_scsi(struct scsi_qla
 						    REQUEST_ENTRY_SIZE);
 			}
 		} else {	/* No scatter gather data transfer */
-			struct page *page = virt_to_page(cmd->request_buffer);
-			unsigned long off = (unsigned long)cmd->request_buffer & ~PAGE_MASK;
-
-			dma_handle = pci_map_page(ha->pdev, page, off,
-						  cmd->request_bufflen,
-						  cmd->sc_data_direction);
+			dma_handle = pci_map_single(ha->pdev,
+					cmd->request_buffer,
+					cmd->request_bufflen,
+					cmd->sc_data_direction);
 
-			/* save dma_handle for pci_unmap_page */
 			sp->saved_dma_handle = dma_handle;
 #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
 			if (ha->flags.use_pci_vchannel)
@@ -3636,11 +3523,10 @@ qla1280_32bit_start_scsi(struct scsi_qla
 						    REQUEST_ENTRY_SIZE);
 			}
 		} else {	/* No S/G data transfer */
-			struct page *page = virt_to_page(cmd->request_buffer);
-			unsigned long off = (unsigned long)cmd->request_buffer & ~PAGE_MASK;
-			dma_handle = pci_map_page(ha->pdev, page, off,
-						  cmd->request_bufflen,
-						  cmd->sc_data_direction);
+			dma_handle = pci_map_single(ha->pdev,
+					cmd->request_buffer,
+					cmd->request_bufflen,
+					cmd->sc_data_direction);
 			sp->saved_dma_handle = dma_handle;
 
 			*dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_handle));

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/3] qla1280: user pci_map_single
  2005-02-10 16:00 [PATCH 2/3] qla1280: user pci_map_single Christoph Hellwig
@ 2005-02-18  9:48 ` Jes Sorensen
  2005-02-18 10:21   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Jes Sorensen @ 2005-02-18  9:48 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: jejb, linux-scsi

Christoph,

When pci_map_page was originally introduced it was meant to deprecate
pci_map_single, at least thats what my memory tells me.

If pci_map_single is suddenly recommended again we can change it back
to that, but I don't really see the gain.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/3] qla1280: user pci_map_single
  2005-02-18  9:48 ` Jes Sorensen
@ 2005-02-18 10:21   ` Christoph Hellwig
  2005-02-25 13:48     ` Jes Sorensen
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2005-02-18 10:21 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: jejb, linux-scsi

On Fri, Feb 18, 2005 at 04:48:00AM -0500, Jes Sorensen wrote:
> Christoph,
> 
> When pci_map_page was originally introduced it was meant to deprecate
> pci_map_single, at least thats what my memory tells me.

No, it's for rather different uses.  pci_map_page would be nice to get
rid of in favour of pci_map_sg OTOH..

> If pci_map_single is suddenly recommended again we can change it back
> to that, but I don't really see the gain.

it's a micro-speedup by avoiding totally useless address arithmetics.
You first convert a buffer to page + offset and then it needs to be
converted back, e.g. in include/asm-ia64/dma-mapping.h:

#define dma_map_page(dev, pg, off, size, dir)			\
        dma_map_single(dev, page_address(pg) + (off), (size), (dir))

(pci_map_page is mapped to dma_map_page)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/3] qla1280: user pci_map_single
  2005-02-18 10:21   ` Christoph Hellwig
@ 2005-02-25 13:48     ` Jes Sorensen
  0 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2005-02-25 13:48 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: jejb, linux-scsi

>>>>> "Christoph" == Christoph Hellwig <hch@lst.de> writes:

Christoph> On Fri, Feb 18, 2005 at 04:48:00AM -0500, Jes Sorensen
Christoph> wrote:
>> Christoph,
>> 
>> When pci_map_page was originally introduced it was meant to
>> deprecate pci_map_single, at least thats what my memory tells me.

Christoph> No, it's for rather different uses.  pci_map_page would be
Christoph> nice to get rid of in favour of pci_map_sg OTOH..

I guess things have changed a bit since it was introduced. Anyway go
ahead and push the patch.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-25 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-10 16:00 [PATCH 2/3] qla1280: user pci_map_single Christoph Hellwig
2005-02-18  9:48 ` Jes Sorensen
2005-02-18 10:21   ` Christoph Hellwig
2005-02-25 13:48     ` Jes Sorensen

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).