Lines Matching refs:sg

283  * @addr: address of the sg entry
284 * @len: length in this sg entry
305 * @sg: the given scatter-gathering object
309 static inline dma_addr_t dpaa2_sg_get_addr(const struct dpaa2_sg_entry *sg)
311 return (dma_addr_t)le64_to_cpu(sg->addr);
316 * @sg: the given scatter-gathering object
319 static inline void dpaa2_sg_set_addr(struct dpaa2_sg_entry *sg, dma_addr_t addr)
321 sg->addr = cpu_to_le64(addr);
324 static inline bool dpaa2_sg_short_len(const struct dpaa2_sg_entry *sg)
326 return !!((le16_to_cpu(sg->format_offset) >> SG_SHORT_LEN_FLAG_SHIFT)
332 * @sg: the given scatter-gathering object
336 static inline u32 dpaa2_sg_get_len(const struct dpaa2_sg_entry *sg)
338 if (dpaa2_sg_short_len(sg))
339 return le32_to_cpu(sg->len) & SG_SHORT_LEN_MASK;
341 return le32_to_cpu(sg->len);
346 * @sg: the given scatter-gathering object
349 static inline void dpaa2_sg_set_len(struct dpaa2_sg_entry *sg, u32 len)
351 sg->len = cpu_to_le32(len);
356 * @sg: the given scatter-gathering object
360 static inline u16 dpaa2_sg_get_offset(const struct dpaa2_sg_entry *sg)
362 return le16_to_cpu(sg->format_offset) & SG_OFFSET_MASK;
367 * @sg: the given scatter-gathering object
370 static inline void dpaa2_sg_set_offset(struct dpaa2_sg_entry *sg,
373 sg->format_offset &= cpu_to_le16(~SG_OFFSET_MASK);
374 sg->format_offset |= cpu_to_le16(offset);
379 * @sg: the given scatter-gathering object
384 dpaa2_sg_get_format(const struct dpaa2_sg_entry *sg)
386 return (enum dpaa2_sg_format)((le16_to_cpu(sg->format_offset)
392 * @sg: the given scatter-gathering object
395 static inline void dpaa2_sg_set_format(struct dpaa2_sg_entry *sg,
398 sg->format_offset &= cpu_to_le16(~(SG_FORMAT_MASK << SG_FORMAT_SHIFT));
399 sg->format_offset |= cpu_to_le16(format << SG_FORMAT_SHIFT);
404 * @sg: the given scatter-gathering object
408 static inline u16 dpaa2_sg_get_bpid(const struct dpaa2_sg_entry *sg)
410 return le16_to_cpu(sg->bpid) & SG_BPID_MASK;
415 * @sg: the given scatter-gathering object
418 static inline void dpaa2_sg_set_bpid(struct dpaa2_sg_entry *sg, u16 bpid)
420 sg->bpid &= cpu_to_le16(~(SG_BPID_MASK));
421 sg->bpid |= cpu_to_le16(bpid);
426 * @sg: the given scatter-gathering object
430 static inline bool dpaa2_sg_is_final(const struct dpaa2_sg_entry *sg)
432 return !!(le16_to_cpu(sg->format_offset) >> SG_FINAL_FLAG_SHIFT);
437 * @sg: the given scatter-gathering object
440 static inline void dpaa2_sg_set_final(struct dpaa2_sg_entry *sg, bool final)
442 sg->format_offset &= cpu_to_le16((~(SG_FINAL_FLAG_MASK
444 sg->format_offset |= cpu_to_le16(final << SG_FINAL_FLAG_SHIFT);