Lines Matching +full:frame +full:- +full:buffer

1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
3 * Copyright 2014-2016 Freescale Semiconductor Inc.
13 * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
15 * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
16 * Frames can be enqueued and dequeued to Frame Queues (FQs) which are consumed
19 * There are three types of frames: single, scatter gather, and frame lists.
22 * query Frame Descriptors.
26 * struct dpaa2_fd - Struct describing FDs
30 * @bpid: buffer pool ID
31 * @format_offset: format, offset, and short-length fields
32 * @frc: frame context
36 * This structure represents the basic Frame Descriptor used in the system.
98 * dpaa2_fd_get_addr() - get the addr field of frame descriptor
99 * @fd: the given frame descriptor
101 * Return the address in the frame descriptor.
105 return (dma_addr_t)le64_to_cpu(fd->simple.addr); in dpaa2_fd_get_addr()
109 * dpaa2_fd_set_addr() - Set the addr field of frame descriptor
110 * @fd: the given frame descriptor
111 * @addr: the address needs to be set in frame descriptor
115 fd->simple.addr = cpu_to_le64(addr); in dpaa2_fd_set_addr()
119 * dpaa2_fd_get_frc() - Get the frame context in the frame descriptor
120 * @fd: the given frame descriptor
122 * Return the frame context field in the frame descriptor.
126 return le32_to_cpu(fd->simple.frc); in dpaa2_fd_get_frc()
130 * dpaa2_fd_set_frc() - Set the frame context in the frame descriptor
131 * @fd: the given frame descriptor
132 * @frc: the frame context needs to be set in frame descriptor
136 fd->simple.frc = cpu_to_le32(frc); in dpaa2_fd_set_frc()
140 * dpaa2_fd_get_ctrl() - Get the control bits in the frame descriptor
141 * @fd: the given frame descriptor
143 * Return the control bits field in the frame descriptor.
147 return le32_to_cpu(fd->simple.ctrl); in dpaa2_fd_get_ctrl()
151 * dpaa2_fd_set_ctrl() - Set the control bits in the frame descriptor
152 * @fd: the given frame descriptor
153 * @ctrl: the control bits to be set in the frame descriptor
157 fd->simple.ctrl = cpu_to_le32(ctrl); in dpaa2_fd_set_ctrl()
161 * dpaa2_fd_get_flc() - Get the flow context in the frame descriptor
162 * @fd: the given frame descriptor
164 * Return the flow context in the frame descriptor.
168 return (dma_addr_t)le64_to_cpu(fd->simple.flc); in dpaa2_fd_get_flc()
172 * dpaa2_fd_set_flc() - Set the flow context field of frame descriptor
173 * @fd: the given frame descriptor
174 * @flc_addr: the flow context needs to be set in frame descriptor
178 fd->simple.flc = cpu_to_le64(flc_addr); in dpaa2_fd_set_flc()
183 return !!((le16_to_cpu(fd->simple.format_offset) >> in dpaa2_fd_short_len()
188 * dpaa2_fd_get_len() - Get the length in the frame descriptor
189 * @fd: the given frame descriptor
191 * Return the length field in the frame descriptor.
196 return le32_to_cpu(fd->simple.len) & FD_SHORT_LEN_MASK; in dpaa2_fd_get_len()
198 return le32_to_cpu(fd->simple.len); in dpaa2_fd_get_len()
202 * dpaa2_fd_set_len() - Set the length field of frame descriptor
203 * @fd: the given frame descriptor
204 * @len: the length needs to be set in frame descriptor
208 fd->simple.len = cpu_to_le32(len); in dpaa2_fd_set_len()
212 * dpaa2_fd_get_offset() - Get the offset field in the frame descriptor
213 * @fd: the given frame descriptor
219 return le16_to_cpu(fd->simple.format_offset) & FD_OFFSET_MASK; in dpaa2_fd_get_offset()
223 * dpaa2_fd_set_offset() - Set the offset field of frame descriptor
224 * @fd: the given frame descriptor
225 * @offset: the offset needs to be set in frame descriptor
229 fd->simple.format_offset &= cpu_to_le16(~FD_OFFSET_MASK); in dpaa2_fd_set_offset()
230 fd->simple.format_offset |= cpu_to_le16(offset); in dpaa2_fd_set_offset()
234 * dpaa2_fd_get_format() - Get the format field in the frame descriptor
235 * @fd: the given frame descriptor
242 return (enum dpaa2_fd_format)((le16_to_cpu(fd->simple.format_offset) in dpaa2_fd_get_format()
247 * dpaa2_fd_set_format() - Set the format field of frame descriptor
248 * @fd: the given frame descriptor
249 * @format: the format needs to be set in frame descriptor
254 fd->simple.format_offset &= in dpaa2_fd_set_format()
256 fd->simple.format_offset |= cpu_to_le16(format << FD_FORMAT_SHIFT); in dpaa2_fd_set_format()
260 * dpaa2_fd_get_bpid() - Get the bpid field in the frame descriptor
261 * @fd: the given frame descriptor
263 * Return the buffer pool id.
267 return le16_to_cpu(fd->simple.bpid) & FD_BPID_MASK; in dpaa2_fd_get_bpid()
271 * dpaa2_fd_set_bpid() - Set the bpid field of frame descriptor
272 * @fd: the given frame descriptor
273 * @bpid: buffer pool id to be set
277 fd->simple.bpid &= cpu_to_le16(~(FD_BPID_MASK)); in dpaa2_fd_set_bpid()
278 fd->simple.bpid |= cpu_to_le16(bpid); in dpaa2_fd_set_bpid()
282 * struct dpaa2_sg_entry - the scatter-gathering structure
285 * @bpid: buffer pool id
304 * dpaa2_sg_get_addr() - Get the address from SG entry
305 * @sg: the given scatter-gathering object
311 return (dma_addr_t)le64_to_cpu(sg->addr); in dpaa2_sg_get_addr()
315 * dpaa2_sg_set_addr() - Set the address in SG entry
316 * @sg: the given scatter-gathering object
321 sg->addr = cpu_to_le64(addr); in dpaa2_sg_set_addr()
326 return !!((le16_to_cpu(sg->format_offset) >> SG_SHORT_LEN_FLAG_SHIFT) in dpaa2_sg_short_len()
331 * dpaa2_sg_get_len() - Get the length in SG entry
332 * @sg: the given scatter-gathering object
339 return le32_to_cpu(sg->len) & SG_SHORT_LEN_MASK; in dpaa2_sg_get_len()
341 return le32_to_cpu(sg->len); in dpaa2_sg_get_len()
345 * dpaa2_sg_set_len() - Set the length in SG entry
346 * @sg: the given scatter-gathering object
351 sg->len = cpu_to_le32(len); in dpaa2_sg_set_len()
355 * dpaa2_sg_get_offset() - Get the offset in SG entry
356 * @sg: the given scatter-gathering object
362 return le16_to_cpu(sg->format_offset) & SG_OFFSET_MASK; in dpaa2_sg_get_offset()
366 * dpaa2_sg_set_offset() - Set the offset in SG entry
367 * @sg: the given scatter-gathering object
373 sg->format_offset &= cpu_to_le16(~SG_OFFSET_MASK); in dpaa2_sg_set_offset()
374 sg->format_offset |= cpu_to_le16(offset); in dpaa2_sg_set_offset()
378 * dpaa2_sg_get_format() - Get the SG format in SG entry
379 * @sg: the given scatter-gathering object
386 return (enum dpaa2_sg_format)((le16_to_cpu(sg->format_offset) in dpaa2_sg_get_format()
391 * dpaa2_sg_set_format() - Set the SG format in SG entry
392 * @sg: the given scatter-gathering object
398 sg->format_offset &= cpu_to_le16(~(SG_FORMAT_MASK << SG_FORMAT_SHIFT)); in dpaa2_sg_set_format()
399 sg->format_offset |= cpu_to_le16(format << SG_FORMAT_SHIFT); in dpaa2_sg_set_format()
403 * dpaa2_sg_get_bpid() - Get the buffer pool id in SG entry
404 * @sg: the given scatter-gathering object
410 return le16_to_cpu(sg->bpid) & SG_BPID_MASK; in dpaa2_sg_get_bpid()
414 * dpaa2_sg_set_bpid() - Set the buffer pool id in SG entry
415 * @sg: the given scatter-gathering object
420 sg->bpid &= cpu_to_le16(~(SG_BPID_MASK)); in dpaa2_sg_set_bpid()
421 sg->bpid |= cpu_to_le16(bpid); in dpaa2_sg_set_bpid()
425 * dpaa2_sg_is_final() - Check final bit in SG entry
426 * @sg: the given scatter-gathering object
432 return !!(le16_to_cpu(sg->format_offset) >> SG_FINAL_FLAG_SHIFT); in dpaa2_sg_is_final()
436 * dpaa2_sg_set_final() - Set the final bit in SG entry
437 * @sg: the given scatter-gathering object
442 sg->format_offset &= cpu_to_le16((~(SG_FINAL_FLAG_MASK in dpaa2_sg_set_final()
444 sg->format_offset |= cpu_to_le16(final << SG_FINAL_FLAG_SHIFT); in dpaa2_sg_set_final()
448 * struct dpaa2_fl_entry - structure for frame list entry.
451 * @bpid: buffer pool ID
452 * @format_offset: format, offset, and short-length fields
453 * @frc: frame context
474 * dpaa2_fl_get_addr() - get the addr field of FLE
475 * @fle: the given frame list entry
477 * Return the address in the frame list entry.
481 return (dma_addr_t)le64_to_cpu(fle->addr); in dpaa2_fl_get_addr()
485 * dpaa2_fl_set_addr() - Set the addr field of FLE
486 * @fle: the given frame list entry
487 * @addr: the address needs to be set in frame list entry
492 fle->addr = cpu_to_le64(addr); in dpaa2_fl_set_addr()
496 * dpaa2_fl_get_frc() - Get the frame context in the FLE
497 * @fle: the given frame list entry
499 * Return the frame context field in the frame lsit entry.
503 return le32_to_cpu(fle->frc); in dpaa2_fl_get_frc()
507 * dpaa2_fl_set_frc() - Set the frame context in the FLE
508 * @fle: the given frame list entry
509 * @frc: the frame context needs to be set in frame list entry
513 fle->frc = cpu_to_le32(frc); in dpaa2_fl_set_frc()
517 * dpaa2_fl_get_ctrl() - Get the control bits in the FLE
518 * @fle: the given frame list entry
520 * Return the control bits field in the frame list entry.
524 return le32_to_cpu(fle->ctrl); in dpaa2_fl_get_ctrl()
528 * dpaa2_fl_set_ctrl() - Set the control bits in the FLE
529 * @fle: the given frame list entry
530 * @ctrl: the control bits to be set in the frame list entry
534 fle->ctrl = cpu_to_le32(ctrl); in dpaa2_fl_set_ctrl()
538 * dpaa2_fl_get_flc() - Get the flow context in the FLE
539 * @fle: the given frame list entry
541 * Return the flow context in the frame list entry.
545 return (dma_addr_t)le64_to_cpu(fle->flc); in dpaa2_fl_get_flc()
549 * dpaa2_fl_set_flc() - Set the flow context field of FLE
550 * @fle: the given frame list entry
551 * @flc_addr: the flow context needs to be set in frame list entry
556 fle->flc = cpu_to_le64(flc_addr); in dpaa2_fl_set_flc()
561 return !!((le16_to_cpu(fle->format_offset) >> in dpaa2_fl_short_len()
566 * dpaa2_fl_get_len() - Get the length in the FLE
567 * @fle: the given frame list entry
569 * Return the length field in the frame list entry.
574 return le32_to_cpu(fle->len) & FL_SHORT_LEN_MASK; in dpaa2_fl_get_len()
576 return le32_to_cpu(fle->len); in dpaa2_fl_get_len()
580 * dpaa2_fl_set_len() - Set the length field of FLE
581 * @fle: the given frame list entry
582 * @len: the length needs to be set in frame list entry
586 fle->len = cpu_to_le32(len); in dpaa2_fl_set_len()
590 * dpaa2_fl_get_offset() - Get the offset field in the frame list entry
591 * @fle: the given frame list entry
597 return le16_to_cpu(fle->format_offset) & FL_OFFSET_MASK; in dpaa2_fl_get_offset()
601 * dpaa2_fl_set_offset() - Set the offset field of FLE
602 * @fle: the given frame list entry
603 * @offset: the offset needs to be set in frame list entry
607 fle->format_offset &= cpu_to_le16(~FL_OFFSET_MASK); in dpaa2_fl_set_offset()
608 fle->format_offset |= cpu_to_le16(offset); in dpaa2_fl_set_offset()
612 * dpaa2_fl_get_format() - Get the format field in the FLE
613 * @fle: the given frame list entry
619 return (enum dpaa2_fl_format)((le16_to_cpu(fle->format_offset) >> in dpaa2_fl_get_format()
624 * dpaa2_fl_set_format() - Set the format field of FLE
625 * @fle: the given frame list entry
626 * @format: the format needs to be set in frame list entry
631 fle->format_offset &= cpu_to_le16(~(FL_FORMAT_MASK << FL_FORMAT_SHIFT)); in dpaa2_fl_set_format()
632 fle->format_offset |= cpu_to_le16(format << FL_FORMAT_SHIFT); in dpaa2_fl_set_format()
636 * dpaa2_fl_get_bpid() - Get the bpid field in the FLE
637 * @fle: the given frame list entry
639 * Return the buffer pool id.
643 return le16_to_cpu(fle->bpid) & FL_BPID_MASK; in dpaa2_fl_get_bpid()
647 * dpaa2_fl_set_bpid() - Set the bpid field of FLE
648 * @fle: the given frame list entry
649 * @bpid: buffer pool id to be set
653 fle->bpid &= cpu_to_le16(~(FL_BPID_MASK)); in dpaa2_fl_set_bpid()
654 fle->bpid |= cpu_to_le16(bpid); in dpaa2_fl_set_bpid()
658 * dpaa2_fl_is_final() - Check final bit in FLE
659 * @fle: the given frame list entry
665 return !!(le16_to_cpu(fle->format_offset) >> FL_FINAL_FLAG_SHIFT); in dpaa2_fl_is_final()
669 * dpaa2_fl_set_final() - Set the final bit in FLE
670 * @fle: the given frame list entry
675 fle->format_offset &= cpu_to_le16((~(FL_FINAL_FLAG_MASK << in dpaa2_fl_set_final()
677 fle->format_offset |= cpu_to_le16(final << FL_FINAL_FLAG_SHIFT); in dpaa2_fl_set_final()