Lines Matching +full:ctrl +full:- +full:len
1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
3 * Copyright 2014-2016 Freescale Semiconductor Inc.
14 * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
27 * struct dpaa2_fd - Struct describing FDs
30 * @len: length in the FD
32 * @format_offset: format, offset, and short-length fields
34 * @ctrl: control bits...including dd, sc, va, err, etc
44 __le32 len; member
48 __le32 ctrl; member
80 /* Error bits in FD CTRL */
88 /* Annotation bits in FD CTRL */
99 * dpaa2_fd_get_addr() - get the addr field of frame descriptor
106 return (dma_addr_t)le64_to_cpu(fd->simple.addr); in dpaa2_fd_get_addr()
110 * dpaa2_fd_set_addr() - Set the addr field of frame descriptor
116 fd->simple.addr = cpu_to_le64(addr); in dpaa2_fd_set_addr()
120 * dpaa2_fd_get_frc() - Get the frame context in the frame descriptor
127 return le32_to_cpu(fd->simple.frc); in dpaa2_fd_get_frc()
131 * dpaa2_fd_set_frc() - Set the frame context in the frame descriptor
137 fd->simple.frc = cpu_to_le32(frc); in dpaa2_fd_set_frc()
141 * dpaa2_fd_get_ctrl() - Get the control bits in the frame descriptor
148 return le32_to_cpu(fd->simple.ctrl); in dpaa2_fd_get_ctrl()
152 * dpaa2_fd_set_ctrl() - Set the control bits in the frame descriptor
154 * @ctrl: the control bits to be set in the frame descriptor
156 static inline void dpaa2_fd_set_ctrl(struct dpaa2_fd *fd, u32 ctrl) in dpaa2_fd_set_ctrl() argument
158 fd->simple.ctrl = cpu_to_le32(ctrl); in dpaa2_fd_set_ctrl()
162 * dpaa2_fd_get_flc() - Get the flow context in the frame descriptor
169 return (dma_addr_t)le64_to_cpu(fd->simple.flc); in dpaa2_fd_get_flc()
173 * dpaa2_fd_set_flc() - Set the flow context field of frame descriptor
179 fd->simple.flc = cpu_to_le64(flc_addr); in dpaa2_fd_set_flc()
184 return !!((le16_to_cpu(fd->simple.format_offset) >> in dpaa2_fd_short_len()
189 * dpaa2_fd_get_len() - Get the length in the frame descriptor
197 return le32_to_cpu(fd->simple.len) & FD_SHORT_LEN_MASK; in dpaa2_fd_get_len()
199 return le32_to_cpu(fd->simple.len); in dpaa2_fd_get_len()
203 * dpaa2_fd_set_len() - Set the length field of frame descriptor
205 * @len: the length needs to be set in frame descriptor
207 static inline void dpaa2_fd_set_len(struct dpaa2_fd *fd, u32 len) in dpaa2_fd_set_len() argument
209 fd->simple.len = cpu_to_le32(len); in dpaa2_fd_set_len()
213 * dpaa2_fd_get_offset() - Get the offset field in the frame descriptor
220 return le16_to_cpu(fd->simple.format_offset) & FD_OFFSET_MASK; in dpaa2_fd_get_offset()
224 * dpaa2_fd_set_offset() - Set the offset field of frame descriptor
230 fd->simple.format_offset &= cpu_to_le16(~FD_OFFSET_MASK); in dpaa2_fd_set_offset()
231 fd->simple.format_offset |= cpu_to_le16(offset); in dpaa2_fd_set_offset()
235 * dpaa2_fd_get_format() - Get the format field in the frame descriptor
243 return (enum dpaa2_fd_format)((le16_to_cpu(fd->simple.format_offset) in dpaa2_fd_get_format()
248 * dpaa2_fd_set_format() - Set the format field of frame descriptor
255 fd->simple.format_offset &= in dpaa2_fd_set_format()
257 fd->simple.format_offset |= cpu_to_le16(format << FD_FORMAT_SHIFT); in dpaa2_fd_set_format()
261 * dpaa2_fd_get_bpid() - Get the bpid field in the frame descriptor
268 return le16_to_cpu(fd->simple.bpid) & FD_BPID_MASK; in dpaa2_fd_get_bpid()
272 * dpaa2_fd_set_bpid() - Set the bpid field of frame descriptor
278 fd->simple.bpid &= cpu_to_le16(~(FD_BPID_MASK)); in dpaa2_fd_set_bpid()
279 fd->simple.bpid |= cpu_to_le16(bpid); in dpaa2_fd_set_bpid()
283 * struct dpaa2_sg_entry - the scatter-gathering structure
285 * @len: length in this sg entry
291 __le32 len; member
305 * dpaa2_sg_get_addr() - Get the address from SG entry
306 * @sg: the given scatter-gathering object
312 return (dma_addr_t)le64_to_cpu(sg->addr); in dpaa2_sg_get_addr()
316 * dpaa2_sg_set_addr() - Set the address in SG entry
317 * @sg: the given scatter-gathering object
322 sg->addr = cpu_to_le64(addr); in dpaa2_sg_set_addr()
327 return !!((le16_to_cpu(sg->format_offset) >> SG_SHORT_LEN_FLAG_SHIFT) in dpaa2_sg_short_len()
332 * dpaa2_sg_get_len() - Get the length in SG entry
333 * @sg: the given scatter-gathering object
340 return le32_to_cpu(sg->len) & SG_SHORT_LEN_MASK; in dpaa2_sg_get_len()
342 return le32_to_cpu(sg->len); in dpaa2_sg_get_len()
346 * dpaa2_sg_set_len() - Set the length in SG entry
347 * @sg: the given scatter-gathering object
348 * @len: the length to be set
350 static inline void dpaa2_sg_set_len(struct dpaa2_sg_entry *sg, u32 len) in dpaa2_sg_set_len() argument
352 sg->len = cpu_to_le32(len); in dpaa2_sg_set_len()
356 * dpaa2_sg_get_offset() - Get the offset in SG entry
357 * @sg: the given scatter-gathering object
363 return le16_to_cpu(sg->format_offset) & SG_OFFSET_MASK; in dpaa2_sg_get_offset()
367 * dpaa2_sg_set_offset() - Set the offset in SG entry
368 * @sg: the given scatter-gathering object
374 sg->format_offset &= cpu_to_le16(~SG_OFFSET_MASK); in dpaa2_sg_set_offset()
375 sg->format_offset |= cpu_to_le16(offset); in dpaa2_sg_set_offset()
379 * dpaa2_sg_get_format() - Get the SG format in SG entry
380 * @sg: the given scatter-gathering object
387 return (enum dpaa2_sg_format)((le16_to_cpu(sg->format_offset) in dpaa2_sg_get_format()
392 * dpaa2_sg_set_format() - Set the SG format in SG entry
393 * @sg: the given scatter-gathering object
399 sg->format_offset &= cpu_to_le16(~(SG_FORMAT_MASK << SG_FORMAT_SHIFT)); in dpaa2_sg_set_format()
400 sg->format_offset |= cpu_to_le16(format << SG_FORMAT_SHIFT); in dpaa2_sg_set_format()
404 * dpaa2_sg_get_bpid() - Get the buffer pool id in SG entry
405 * @sg: the given scatter-gathering object
411 return le16_to_cpu(sg->bpid) & SG_BPID_MASK; in dpaa2_sg_get_bpid()
415 * dpaa2_sg_set_bpid() - Set the buffer pool id in SG entry
416 * @sg: the given scatter-gathering object
421 sg->bpid &= cpu_to_le16(~(SG_BPID_MASK)); in dpaa2_sg_set_bpid()
422 sg->bpid |= cpu_to_le16(bpid); in dpaa2_sg_set_bpid()
426 * dpaa2_sg_is_final() - Check final bit in SG entry
427 * @sg: the given scatter-gathering object
433 return !!(le16_to_cpu(sg->format_offset) >> SG_FINAL_FLAG_SHIFT); in dpaa2_sg_is_final()
437 * dpaa2_sg_set_final() - Set the final bit in SG entry
438 * @sg: the given scatter-gathering object
443 sg->format_offset &= cpu_to_le16((~(SG_FINAL_FLAG_MASK in dpaa2_sg_set_final()
445 sg->format_offset |= cpu_to_le16(final << SG_FINAL_FLAG_SHIFT); in dpaa2_sg_set_final()
449 * struct dpaa2_fl_entry - structure for frame list entry.
451 * @len: length in the FLE
453 * @format_offset: format, offset, and short-length fields
455 * @ctrl: control bits...including pta, pvt1, pvt2, err, etc
460 __le32 len; member
464 __le32 ctrl; member
475 * dpaa2_fl_get_addr() - get the addr field of FLE
482 return (dma_addr_t)le64_to_cpu(fle->addr); in dpaa2_fl_get_addr()
486 * dpaa2_fl_set_addr() - Set the addr field of FLE
493 fle->addr = cpu_to_le64(addr); in dpaa2_fl_set_addr()
497 * dpaa2_fl_get_frc() - Get the frame context in the FLE
504 return le32_to_cpu(fle->frc); in dpaa2_fl_get_frc()
508 * dpaa2_fl_set_frc() - Set the frame context in the FLE
514 fle->frc = cpu_to_le32(frc); in dpaa2_fl_set_frc()
518 * dpaa2_fl_get_ctrl() - Get the control bits in the FLE
525 return le32_to_cpu(fle->ctrl); in dpaa2_fl_get_ctrl()
529 * dpaa2_fl_set_ctrl() - Set the control bits in the FLE
531 * @ctrl: the control bits to be set in the frame list entry
533 static inline void dpaa2_fl_set_ctrl(struct dpaa2_fl_entry *fle, u32 ctrl) in dpaa2_fl_set_ctrl() argument
535 fle->ctrl = cpu_to_le32(ctrl); in dpaa2_fl_set_ctrl()
539 * dpaa2_fl_get_flc() - Get the flow context in the FLE
546 return (dma_addr_t)le64_to_cpu(fle->flc); in dpaa2_fl_get_flc()
550 * dpaa2_fl_set_flc() - Set the flow context field of FLE
557 fle->flc = cpu_to_le64(flc_addr); in dpaa2_fl_set_flc()
562 return !!((le16_to_cpu(fle->format_offset) >> in dpaa2_fl_short_len()
567 * dpaa2_fl_get_len() - Get the length in the FLE
575 return le32_to_cpu(fle->len) & FL_SHORT_LEN_MASK; in dpaa2_fl_get_len()
577 return le32_to_cpu(fle->len); in dpaa2_fl_get_len()
581 * dpaa2_fl_set_len() - Set the length field of FLE
583 * @len: the length needs to be set in frame list entry
585 static inline void dpaa2_fl_set_len(struct dpaa2_fl_entry *fle, u32 len) in dpaa2_fl_set_len() argument
587 fle->len = cpu_to_le32(len); in dpaa2_fl_set_len()
591 * dpaa2_fl_get_offset() - Get the offset field in the frame list entry
598 return le16_to_cpu(fle->format_offset) & FL_OFFSET_MASK; in dpaa2_fl_get_offset()
602 * dpaa2_fl_set_offset() - Set the offset field of FLE
608 fle->format_offset &= cpu_to_le16(~FL_OFFSET_MASK); in dpaa2_fl_set_offset()
609 fle->format_offset |= cpu_to_le16(offset); in dpaa2_fl_set_offset()
613 * dpaa2_fl_get_format() - Get the format field in the FLE
620 return (enum dpaa2_fl_format)((le16_to_cpu(fle->format_offset) >> in dpaa2_fl_get_format()
625 * dpaa2_fl_set_format() - Set the format field of FLE
632 fle->format_offset &= cpu_to_le16(~(FL_FORMAT_MASK << FL_FORMAT_SHIFT)); in dpaa2_fl_set_format()
633 fle->format_offset |= cpu_to_le16(format << FL_FORMAT_SHIFT); in dpaa2_fl_set_format()
637 * dpaa2_fl_get_bpid() - Get the bpid field in the FLE
644 return le16_to_cpu(fle->bpid) & FL_BPID_MASK; in dpaa2_fl_get_bpid()
648 * dpaa2_fl_set_bpid() - Set the bpid field of FLE
654 fle->bpid &= cpu_to_le16(~(FL_BPID_MASK)); in dpaa2_fl_set_bpid()
655 fle->bpid |= cpu_to_le16(bpid); in dpaa2_fl_set_bpid()
659 * dpaa2_fl_is_final() - Check final bit in FLE
666 return !!(le16_to_cpu(fle->format_offset) >> FL_FINAL_FLAG_SHIFT); in dpaa2_fl_is_final()
670 * dpaa2_fl_set_final() - Set the final bit in FLE
676 fle->format_offset &= cpu_to_le16((~(FL_FINAL_FLAG_MASK << in dpaa2_fl_set_final()
678 fle->format_offset |= cpu_to_le16(final << FL_FINAL_FLAG_SHIFT); in dpaa2_fl_set_final()