Lines Matching refs:scatterlist
9 #include <linux/scatterlist.h>
14 * sg_next - return the next scatterlist entry in a list
19 * of a chained scatterlist, it could jump to the start of a new
20 * scatterlist array.
23 struct scatterlist *sg_next(struct scatterlist *sg)
37 * sg_nents - return total count of entries in scatterlist
38 * @sg: The scatterlist
45 int sg_nents(struct scatterlist *sg)
55 * sg_nents_for_len - return total count of entries in scatterlist
57 * @sg: The scatterlist
68 int sg_nents_for_len(struct scatterlist *sg, u64 len)
88 * sg_last - return the last scatterlist entry in a list
89 * @sgl: First entry in the scatterlist
90 * @nents: Number of entries in the scatterlist
101 struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents)
103 struct scatterlist *sg, *ret = NULL;
124 void sg_init_table(struct scatterlist *sgl, unsigned int nents)
138 void sg_init_one(struct scatterlist *sg, const void *buf, unsigned int buflen)
149 static struct scatterlist *sg_kmalloc(unsigned int nents, gfp_t gfp_mask)
165 return kmalloc_array(nents, sizeof(struct scatterlist),
169 static void sg_kfree(struct scatterlist *sg, unsigned int nents)
181 * @max_ents: The maximum number of entries per single scatterlist
183 * scatterlist chunk, 0 means no such preallocated first chunk
195 struct scatterlist *sgl, *next;
251 * scatterlist chunk, 0 means no such preallocated chunk provided by user
257 * defined to return scatterlist chunks of maximum size @max_ents.
267 unsigned int max_ents, struct scatterlist *first_chunk,
271 struct scatterlist *sg, *prv;
368 static struct scatterlist *get_next_sg(struct sg_table *table,
369 struct scatterlist *cur,
373 struct scatterlist *new_sg, *next_sg;
407 * @max_segment: Maximum size of a scatterlist element in bytes
414 * else reuse the scatterlist passed in at @prv.
415 * Contiguous ranges of the pages are squashed into a single scatterlist
428 struct scatterlist *__sg_alloc_table_from_pages(struct sg_table *sgt,
431 struct scatterlist *prv, unsigned int left_pages,
436 struct scatterlist *s = prv;
483 /* merging chunks and putting them into the scatterlist */
537 * ranges of the pages are squashed into a single scatterlist node. A user
557 * sgl_alloc_order - allocate a scatterlist and its pages
558 * @length: Length in bytes of the scatterlist. Must be at least one
560 * @chainable: Whether or not to allocate an extra element in the scatterlist
561 * for scatterlist chaining purposes
563 * @nent_p: [out] Number of entries in the scatterlist that have pages
565 * Returns: A pointer to an initialized scatterlist or %NULL upon failure.
567 struct scatterlist *sgl_alloc_order(unsigned long long length,
571 struct scatterlist *sgl, *sg;
587 sgl = kmalloc_array(nalloc, sizeof(struct scatterlist),
614 * sgl_alloc - allocate a scatterlist and its pages
615 * @length: Length in bytes of the scatterlist
617 * @nent_p: [out] Number of entries in the scatterlist
619 * Returns: A pointer to an initialized scatterlist or %NULL upon failure.
621 struct scatterlist *sgl_alloc(unsigned long long length, gfp_t gfp,
629 * sgl_free_n_order - free a scatterlist and its pages
638 * - All pages in a chained scatterlist can be freed at once by setting @nents
641 void sgl_free_n_order(struct scatterlist *sgl, int nents, int order)
643 struct scatterlist *sg;
659 * sgl_free_order - free a scatterlist and its pages
663 void sgl_free_order(struct scatterlist *sgl, int order)
670 * sgl_free - free a scatterlist and its pages
673 void sgl_free(struct scatterlist *sgl)
682 struct scatterlist *sglist, unsigned int nents,
693 static int sg_page_count(struct scatterlist *sg)
717 static int sg_dma_page_count(struct scatterlist *sg)
755 void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl,
769 struct scatterlist *sg;
921 size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
967 size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents,
984 size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
1002 size_t sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents,
1020 size_t sg_pcopy_to_buffer(struct scatterlist *sgl, unsigned int nents,
1036 size_t sg_zero_buffer(struct scatterlist *sgl, unsigned int nents,