Re: [PATCH 03/11] usb: make urb scatter-gather support more generic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 21 Aug 2009, David Vrabel wrote:

> The WHCI HCD will also support urbs with scatter-gather lists.  Add a
> usb_bus field to indicated how many sg list elements are supported by
> the HCD.
> 
> Save space in struct urb by adding a URB_HAS_SG flag and reusing
> transfer_buffer to point to a struct sg_table.
> 
> Split usb_sg_init() into usb_sg_init_with_sg() and
> usb_sg_init_without_sg().
> 

> +		/*
> +		 * Some systems need to revert to PIO when DMA is
> +		 * temporarily unavailable.  For their sakes, both
> +		 * transfer_buffer and transfer_dma are set when
> +		 * possible.  However this can only work on systems
> +		 * without:
> +		 *
> +		 *  - HIGHMEM, since DMA buffers located in high memory
> +		 *    are not directly addressable by the CPU for PIO;
> +		 *
> +		 *  - IOMMU, since dma_map_sg() is allowed to use an
> +		 *    IOMMU to make virtually discontiguous buffers be
> +		 *    "dma-contiguous" so that PIO and DMA need diferent
> +		 *    numbers of URBs.
> +		 *
> +		 * So when HIGHMEM or IOMMU are in use, transfer_buffer
> +		 * is NULL to prevent stale pointers and to help spot
> +		 * bugs.
> +		 */
> +		if (dma) {
> +			io->urbs[i]->transfer_dma = sg_dma_address(sg);
> +			len = sg_dma_len(sg);
> +#if defined(CONFIG_HIGHMEM) || defined(CONFIG_GART_IOMMU)
> +			io->urbs[i]->transfer_buffer = NULL;
> +#else
> +			io->urbs[i]->transfer_buffer = sg_virt(sg);
> +#endif
> +		} else {
> +			/* hc may use _only_ transfer_buffer */
> +			io->urbs[i]->transfer_buffer = sg_virt(sg);
> +			len = sg->length;
> +		}

This code has since been changed.  You need to copy the current code.

Have you checked whether these alterations will break usbmon?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux