Lines Matching refs:sg

284  * @addr: address of the sg entry
285 * @len: length in this sg entry
306 * @sg: the given scatter-gathering object
310 static inline dma_addr_t dpaa2_sg_get_addr(const struct dpaa2_sg_entry *sg)
312 return (dma_addr_t)le64_to_cpu(sg->addr);
317 * @sg: the given scatter-gathering object
320 static inline void dpaa2_sg_set_addr(struct dpaa2_sg_entry *sg, dma_addr_t addr)
322 sg->addr = cpu_to_le64(addr);
325 static inline bool dpaa2_sg_short_len(const struct dpaa2_sg_entry *sg)
327 return !!((le16_to_cpu(sg->format_offset) >> SG_SHORT_LEN_FLAG_SHIFT)
333 * @sg: the given scatter-gathering object
337 static inline u32 dpaa2_sg_get_len(const struct dpaa2_sg_entry *sg)
339 if (dpaa2_sg_short_len(sg))
340 return le32_to_cpu(sg->len) & SG_SHORT_LEN_MASK;
342 return le32_to_cpu(sg->len);
347 * @sg: the given scatter-gathering object
350 static inline void dpaa2_sg_set_len(struct dpaa2_sg_entry *sg, u32 len)
352 sg->len = cpu_to_le32(len);
357 * @sg: the given scatter-gathering object
361 static inline u16 dpaa2_sg_get_offset(const struct dpaa2_sg_entry *sg)
363 return le16_to_cpu(sg->format_offset) & SG_OFFSET_MASK;
368 * @sg: the given scatter-gathering object
371 static inline void dpaa2_sg_set_offset(struct dpaa2_sg_entry *sg,
374 sg->format_offset &= cpu_to_le16(~SG_OFFSET_MASK);
375 sg->format_offset |= cpu_to_le16(offset);
380 * @sg: the given scatter-gathering object
385 dpaa2_sg_get_format(const struct dpaa2_sg_entry *sg)
387 return (enum dpaa2_sg_format)((le16_to_cpu(sg->format_offset)
393 * @sg: the given scatter-gathering object
396 static inline void dpaa2_sg_set_format(struct dpaa2_sg_entry *sg,
399 sg->format_offset &= cpu_to_le16(~(SG_FORMAT_MASK << SG_FORMAT_SHIFT));
400 sg->format_offset |= cpu_to_le16(format << SG_FORMAT_SHIFT);
405 * @sg: the given scatter-gathering object
409 static inline u16 dpaa2_sg_get_bpid(const struct dpaa2_sg_entry *sg)
411 return le16_to_cpu(sg->bpid) & SG_BPID_MASK;
416 * @sg: the given scatter-gathering object
419 static inline void dpaa2_sg_set_bpid(struct dpaa2_sg_entry *sg, u16 bpid)
421 sg->bpid &= cpu_to_le16(~(SG_BPID_MASK));
422 sg->bpid |= cpu_to_le16(bpid);
427 * @sg: the given scatter-gathering object
431 static inline bool dpaa2_sg_is_final(const struct dpaa2_sg_entry *sg)
433 return !!(le16_to_cpu(sg->format_offset) >> SG_FINAL_FLAG_SHIFT);
438 * @sg: the given scatter-gathering object
441 static inline void dpaa2_sg_set_final(struct dpaa2_sg_entry *sg, bool final)
443 sg->format_offset &= cpu_to_le16((~(SG_FINAL_FLAG_MASK
445 sg->format_offset |= cpu_to_le16(final << SG_FINAL_FLAG_SHIFT);