Lines Matching +full:entry +full:- +full:address

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
29 * @addr: address in the FD
32 * @format_offset: format, offset, and short-length fields
35 * @flc: flow context address
99 * dpaa2_fd_get_addr() - get the addr field of frame descriptor
102 * Return the address in the 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
112 * @addr: the address needs to be set in 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
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
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
284 * @addr: address of the sg entry
285 * @len: length in this sg entry
302 /* Accessors for SG entry fields */
305 * dpaa2_sg_get_addr() - Get the address from SG entry
306 * @sg: the given scatter-gathering object
308 * Return the address.
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
318 * @addr: the address to be set
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
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.
450 * @addr: address in the FLE
453 * @format_offset: format, offset, and short-length fields
456 * @flc: flow context address
475 * dpaa2_fl_get_addr() - get the addr field of FLE
476 * @fle: the given frame list entry
478 * Return the address in the frame list entry.
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
487 * @fle: the given frame list entry
488 * @addr: the address needs to be set in frame list entry
493 fle->addr = cpu_to_le64(addr); in dpaa2_fl_set_addr()
497 * dpaa2_fl_get_frc() - Get the frame context in the FLE
498 * @fle: the given frame list entry
500 * Return the frame context field in the frame lsit entry.
504 return le32_to_cpu(fle->frc); in dpaa2_fl_get_frc()
508 * dpaa2_fl_set_frc() - Set the frame context in the FLE
509 * @fle: the given frame list entry
510 * @frc: the frame context needs to be set in frame list entry
514 fle->frc = cpu_to_le32(frc); in dpaa2_fl_set_frc()
518 * dpaa2_fl_get_ctrl() - Get the control bits in the FLE
519 * @fle: the given frame list entry
521 * Return the control bits field in the frame list entry.
525 return le32_to_cpu(fle->ctrl); in dpaa2_fl_get_ctrl()
529 * dpaa2_fl_set_ctrl() - Set the control bits in the FLE
530 * @fle: the given frame list entry
531 * @ctrl: the control bits to be set in the frame list entry
535 fle->ctrl = cpu_to_le32(ctrl); in dpaa2_fl_set_ctrl()
539 * dpaa2_fl_get_flc() - Get the flow context in the FLE
540 * @fle: the given frame list entry
542 * Return the flow context in the frame list entry.
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
551 * @fle: the given frame list entry
552 * @flc_addr: the flow context needs to be set in frame list entry
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
568 * @fle: the given frame list entry
570 * Return the length field in the frame list entry.
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
582 * @fle: the given frame list entry
583 * @len: the length needs to be set in frame list entry
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
592 * @fle: the given 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
603 * @fle: the given frame list entry
604 * @offset: the offset needs to be set in frame list entry
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
614 * @fle: the given frame list entry
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
626 * @fle: the given frame list entry
627 * @format: the format needs to be set in frame list entry
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
638 * @fle: the given frame list entry
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
649 * @fle: the given frame list entry
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
660 * @fle: the given frame list entry
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
671 * @fle: the given frame list entry
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()