~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/soc/fsl/dpaa2-fd.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/soc/fsl/dpaa2-fd.h (Architecture mips) and /include/soc/fsl/dpaa2-fd.h (Architecture i386)


  1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3      1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
  2 /*                                                  2 /*
  3  * Copyright 2014-2016 Freescale Semiconductor      3  * Copyright 2014-2016 Freescale Semiconductor Inc.
  4  * Copyright 2016 NXP                               4  * Copyright 2016 NXP
  5  *                                                  5  *
  6  */                                                 6  */
  7 #ifndef __FSL_DPAA2_FD_H                            7 #ifndef __FSL_DPAA2_FD_H
  8 #define __FSL_DPAA2_FD_H                            8 #define __FSL_DPAA2_FD_H
  9                                                     9 
 10 #include <linux/byteorder/generic.h>               10 #include <linux/byteorder/generic.h>
 11 #include <linux/types.h>                           11 #include <linux/types.h>
 12                                                    12 
 13 /**                                                13 /**
 14  * DOC: DPAA2 FD - Frame Descriptor APIs for D     14  * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
 15  *                                                 15  *
 16  * Frame Descriptors (FDs) are used to describ     16  * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
 17  * Frames can be enqueued and dequeued to Fram     17  * Frames can be enqueued and dequeued to Frame Queues (FQs) which are consumed
 18  * by the various DPAA accelerators (WRIOP, SE     18  * by the various DPAA accelerators (WRIOP, SEC, PME, DCE)
 19  *                                                 19  *
 20  * There are three types of frames: single, sc     20  * There are three types of frames: single, scatter gather, and frame lists.
 21  *                                                 21  *
 22  * The set of APIs in this file must be used t     22  * The set of APIs in this file must be used to create, manipulate and
 23  * query Frame Descriptors.                        23  * query Frame Descriptors.
 24  */                                                24  */
 25                                                    25 
 26 /**                                                26 /**
 27  * struct dpaa2_fd - Struct describing FDs         27  * struct dpaa2_fd - Struct describing FDs
 28  * @words:         for easier/faster copying t     28  * @words:         for easier/faster copying the whole FD structure
 29  * @addr:          address in the FD               29  * @addr:          address in the FD
 30  * @len:           length in the FD                30  * @len:           length in the FD
 31  * @bpid:          buffer pool ID                  31  * @bpid:          buffer pool ID
 32  * @format_offset: format, offset, and short-l     32  * @format_offset: format, offset, and short-length fields
 33  * @frc:           frame context                   33  * @frc:           frame context
 34  * @ctrl:          control bits...including dd     34  * @ctrl:          control bits...including dd, sc, va, err, etc
 35  * @flc:           flow context address            35  * @flc:           flow context address
 36  *                                                 36  *
 37  * This structure represents the basic Frame D     37  * This structure represents the basic Frame Descriptor used in the system.
 38  */                                                38  */
 39 struct dpaa2_fd {                                  39 struct dpaa2_fd {
 40         union {                                    40         union {
 41                 u32 words[8];                      41                 u32 words[8];
 42                 struct dpaa2_fd_simple {           42                 struct dpaa2_fd_simple {
 43                         __le64 addr;               43                         __le64 addr;
 44                         __le32 len;                44                         __le32 len;
 45                         __le16 bpid;               45                         __le16 bpid;
 46                         __le16 format_offset;      46                         __le16 format_offset;
 47                         __le32 frc;                47                         __le32 frc;
 48                         __le32 ctrl;               48                         __le32 ctrl;
 49                         __le64 flc;                49                         __le64 flc;
 50                 } simple;                          50                 } simple;
 51         };                                         51         };
 52 };                                                 52 };
 53                                                    53 
 54 #define FD_SHORT_LEN_FLAG_MASK  0x1                54 #define FD_SHORT_LEN_FLAG_MASK  0x1
 55 #define FD_SHORT_LEN_FLAG_SHIFT 14                 55 #define FD_SHORT_LEN_FLAG_SHIFT 14
 56 #define FD_SHORT_LEN_MASK       0x3FFFF            56 #define FD_SHORT_LEN_MASK       0x3FFFF
 57 #define FD_OFFSET_MASK          0x0FFF             57 #define FD_OFFSET_MASK          0x0FFF
 58 #define FD_FORMAT_MASK          0x3                58 #define FD_FORMAT_MASK          0x3
 59 #define FD_FORMAT_SHIFT         12                 59 #define FD_FORMAT_SHIFT         12
 60 #define FD_BPID_MASK            0x3FFF             60 #define FD_BPID_MASK            0x3FFF
 61 #define SG_SHORT_LEN_FLAG_MASK  0x1                61 #define SG_SHORT_LEN_FLAG_MASK  0x1
 62 #define SG_SHORT_LEN_FLAG_SHIFT 14                 62 #define SG_SHORT_LEN_FLAG_SHIFT 14
 63 #define SG_SHORT_LEN_MASK       0x1FFFF            63 #define SG_SHORT_LEN_MASK       0x1FFFF
 64 #define SG_OFFSET_MASK          0x0FFF             64 #define SG_OFFSET_MASK          0x0FFF
 65 #define SG_FORMAT_MASK          0x3                65 #define SG_FORMAT_MASK          0x3
 66 #define SG_FORMAT_SHIFT         12                 66 #define SG_FORMAT_SHIFT         12
 67 #define SG_BPID_MASK            0x3FFF             67 #define SG_BPID_MASK            0x3FFF
 68 #define SG_FINAL_FLAG_MASK      0x1                68 #define SG_FINAL_FLAG_MASK      0x1
 69 #define SG_FINAL_FLAG_SHIFT     15                 69 #define SG_FINAL_FLAG_SHIFT     15
 70 #define FL_SHORT_LEN_FLAG_MASK  0x1                70 #define FL_SHORT_LEN_FLAG_MASK  0x1
 71 #define FL_SHORT_LEN_FLAG_SHIFT 14                 71 #define FL_SHORT_LEN_FLAG_SHIFT 14
 72 #define FL_SHORT_LEN_MASK       0x3FFFF            72 #define FL_SHORT_LEN_MASK       0x3FFFF
 73 #define FL_OFFSET_MASK          0x0FFF             73 #define FL_OFFSET_MASK          0x0FFF
 74 #define FL_FORMAT_MASK          0x3                74 #define FL_FORMAT_MASK          0x3
 75 #define FL_FORMAT_SHIFT         12                 75 #define FL_FORMAT_SHIFT         12
 76 #define FL_BPID_MASK            0x3FFF             76 #define FL_BPID_MASK            0x3FFF
 77 #define FL_FINAL_FLAG_MASK      0x1                77 #define FL_FINAL_FLAG_MASK      0x1
 78 #define FL_FINAL_FLAG_SHIFT     15                 78 #define FL_FINAL_FLAG_SHIFT     15
 79                                                    79 
 80 /* Error bits in FD CTRL */                        80 /* Error bits in FD CTRL */
 81 #define FD_CTRL_ERR_MASK        0x000000FF         81 #define FD_CTRL_ERR_MASK        0x000000FF
 82 #define FD_CTRL_UFD             0x00000004         82 #define FD_CTRL_UFD             0x00000004
 83 #define FD_CTRL_SBE             0x00000008         83 #define FD_CTRL_SBE             0x00000008
 84 #define FD_CTRL_FLC             0x00000010         84 #define FD_CTRL_FLC             0x00000010
 85 #define FD_CTRL_FSE             0x00000020         85 #define FD_CTRL_FSE             0x00000020
 86 #define FD_CTRL_FAERR           0x00000040         86 #define FD_CTRL_FAERR           0x00000040
 87                                                    87 
 88 /* Annotation bits in FD CTRL */                   88 /* Annotation bits in FD CTRL */
 89 #define FD_CTRL_PTA             0x00800000         89 #define FD_CTRL_PTA             0x00800000
 90 #define FD_CTRL_PTV1            0x00400000         90 #define FD_CTRL_PTV1            0x00400000
 91                                                    91 
 92 enum dpaa2_fd_format {                             92 enum dpaa2_fd_format {
 93         dpaa2_fd_single = 0,                       93         dpaa2_fd_single = 0,
 94         dpaa2_fd_list,                             94         dpaa2_fd_list,
 95         dpaa2_fd_sg                                95         dpaa2_fd_sg
 96 };                                                 96 };
 97                                                    97 
 98 /**                                                98 /**
 99  * dpaa2_fd_get_addr() - get the addr field of     99  * dpaa2_fd_get_addr() - get the addr field of frame descriptor
100  * @fd: the given frame descriptor                100  * @fd: the given frame descriptor
101  *                                                101  *
102  * Return the address in the frame descriptor.    102  * Return the address in the frame descriptor.
103  */                                               103  */
104 static inline dma_addr_t dpaa2_fd_get_addr(con    104 static inline dma_addr_t dpaa2_fd_get_addr(const struct dpaa2_fd *fd)
105 {                                                 105 {
106         return (dma_addr_t)le64_to_cpu(fd->sim    106         return (dma_addr_t)le64_to_cpu(fd->simple.addr);
107 }                                                 107 }
108                                                   108 
109 /**                                               109 /**
110  * dpaa2_fd_set_addr() - Set the addr field of    110  * dpaa2_fd_set_addr() - Set the addr field of frame descriptor
111  * @fd: the given frame descriptor                111  * @fd: the given frame descriptor
112  * @addr: the address needs to be set in frame    112  * @addr: the address needs to be set in frame descriptor
113  */                                               113  */
114 static inline void dpaa2_fd_set_addr(struct dp    114 static inline void dpaa2_fd_set_addr(struct dpaa2_fd *fd, dma_addr_t addr)
115 {                                                 115 {
116         fd->simple.addr = cpu_to_le64(addr);      116         fd->simple.addr = cpu_to_le64(addr);
117 }                                                 117 }
118                                                   118 
119 /**                                               119 /**
120  * dpaa2_fd_get_frc() - Get the frame context     120  * dpaa2_fd_get_frc() - Get the frame context in the frame descriptor
121  * @fd: the given frame descriptor                121  * @fd: the given frame descriptor
122  *                                                122  *
123  * Return the frame context field in the frame    123  * Return the frame context field in the frame descriptor.
124  */                                               124  */
125 static inline u32 dpaa2_fd_get_frc(const struc    125 static inline u32 dpaa2_fd_get_frc(const struct dpaa2_fd *fd)
126 {                                                 126 {
127         return le32_to_cpu(fd->simple.frc);       127         return le32_to_cpu(fd->simple.frc);
128 }                                                 128 }
129                                                   129 
130 /**                                               130 /**
131  * dpaa2_fd_set_frc() - Set the frame context     131  * dpaa2_fd_set_frc() - Set the frame context in the frame descriptor
132  * @fd: the given frame descriptor                132  * @fd: the given frame descriptor
133  * @frc: the frame context needs to be set in     133  * @frc: the frame context needs to be set in frame descriptor
134  */                                               134  */
135 static inline void dpaa2_fd_set_frc(struct dpa    135 static inline void dpaa2_fd_set_frc(struct dpaa2_fd *fd, u32 frc)
136 {                                                 136 {
137         fd->simple.frc = cpu_to_le32(frc);        137         fd->simple.frc = cpu_to_le32(frc);
138 }                                                 138 }
139                                                   139 
140 /**                                               140 /**
141  * dpaa2_fd_get_ctrl() - Get the control bits     141  * dpaa2_fd_get_ctrl() - Get the control bits in the frame descriptor
142  * @fd: the given frame descriptor                142  * @fd: the given frame descriptor
143  *                                                143  *
144  * Return the control bits field in the frame     144  * Return the control bits field in the frame descriptor.
145  */                                               145  */
146 static inline u32 dpaa2_fd_get_ctrl(const stru    146 static inline u32 dpaa2_fd_get_ctrl(const struct dpaa2_fd *fd)
147 {                                                 147 {
148         return le32_to_cpu(fd->simple.ctrl);      148         return le32_to_cpu(fd->simple.ctrl);
149 }                                                 149 }
150                                                   150 
151 /**                                               151 /**
152  * dpaa2_fd_set_ctrl() - Set the control bits     152  * dpaa2_fd_set_ctrl() - Set the control bits in the frame descriptor
153  * @fd: the given frame descriptor                153  * @fd: the given frame descriptor
154  * @ctrl: the control bits to be set in the fr    154  * @ctrl: the control bits to be set in the frame descriptor
155  */                                               155  */
156 static inline void dpaa2_fd_set_ctrl(struct dp    156 static inline void dpaa2_fd_set_ctrl(struct dpaa2_fd *fd, u32 ctrl)
157 {                                                 157 {
158         fd->simple.ctrl = cpu_to_le32(ctrl);      158         fd->simple.ctrl = cpu_to_le32(ctrl);
159 }                                                 159 }
160                                                   160 
161 /**                                               161 /**
162  * dpaa2_fd_get_flc() - Get the flow context i    162  * dpaa2_fd_get_flc() - Get the flow context in the frame descriptor
163  * @fd: the given frame descriptor                163  * @fd: the given frame descriptor
164  *                                                164  *
165  * Return the flow context in the frame descri    165  * Return the flow context in the frame descriptor.
166  */                                               166  */
167 static inline dma_addr_t dpaa2_fd_get_flc(cons    167 static inline dma_addr_t dpaa2_fd_get_flc(const struct dpaa2_fd *fd)
168 {                                                 168 {
169         return (dma_addr_t)le64_to_cpu(fd->sim    169         return (dma_addr_t)le64_to_cpu(fd->simple.flc);
170 }                                                 170 }
171                                                   171 
172 /**                                               172 /**
173  * dpaa2_fd_set_flc() - Set the flow context f    173  * dpaa2_fd_set_flc() - Set the flow context field of frame descriptor
174  * @fd: the given frame descriptor                174  * @fd: the given frame descriptor
175  * @flc_addr: the flow context needs to be set    175  * @flc_addr: the flow context needs to be set in frame descriptor
176  */                                               176  */
177 static inline void dpaa2_fd_set_flc(struct dpa    177 static inline void dpaa2_fd_set_flc(struct dpaa2_fd *fd,  dma_addr_t flc_addr)
178 {                                                 178 {
179         fd->simple.flc = cpu_to_le64(flc_addr)    179         fd->simple.flc = cpu_to_le64(flc_addr);
180 }                                                 180 }
181                                                   181 
182 static inline bool dpaa2_fd_short_len(const st    182 static inline bool dpaa2_fd_short_len(const struct dpaa2_fd *fd)
183 {                                                 183 {
184         return !!((le16_to_cpu(fd->simple.form    184         return !!((le16_to_cpu(fd->simple.format_offset) >>
185                   FD_SHORT_LEN_FLAG_SHIFT) & F    185                   FD_SHORT_LEN_FLAG_SHIFT) & FD_SHORT_LEN_FLAG_MASK);
186 }                                                 186 }
187                                                   187 
188 /**                                               188 /**
189  * dpaa2_fd_get_len() - Get the length in the     189  * dpaa2_fd_get_len() - Get the length in the frame descriptor
190  * @fd: the given frame descriptor                190  * @fd: the given frame descriptor
191  *                                                191  *
192  * Return the length field in the frame descri    192  * Return the length field in the frame descriptor.
193  */                                               193  */
194 static inline u32 dpaa2_fd_get_len(const struc    194 static inline u32 dpaa2_fd_get_len(const struct dpaa2_fd *fd)
195 {                                                 195 {
196         if (dpaa2_fd_short_len(fd))               196         if (dpaa2_fd_short_len(fd))
197                 return le32_to_cpu(fd->simple.    197                 return le32_to_cpu(fd->simple.len) & FD_SHORT_LEN_MASK;
198                                                   198 
199         return le32_to_cpu(fd->simple.len);       199         return le32_to_cpu(fd->simple.len);
200 }                                                 200 }
201                                                   201 
202 /**                                               202 /**
203  * dpaa2_fd_set_len() - Set the length field o    203  * dpaa2_fd_set_len() - Set the length field of frame descriptor
204  * @fd: the given frame descriptor                204  * @fd: the given frame descriptor
205  * @len: the length needs to be set in frame d    205  * @len: the length needs to be set in frame descriptor
206  */                                               206  */
207 static inline void dpaa2_fd_set_len(struct dpa    207 static inline void dpaa2_fd_set_len(struct dpaa2_fd *fd, u32 len)
208 {                                                 208 {
209         fd->simple.len = cpu_to_le32(len);        209         fd->simple.len = cpu_to_le32(len);
210 }                                                 210 }
211                                                   211 
212 /**                                               212 /**
213  * dpaa2_fd_get_offset() - Get the offset fiel    213  * dpaa2_fd_get_offset() - Get the offset field in the frame descriptor
214  * @fd: the given frame descriptor                214  * @fd: the given frame descriptor
215  *                                                215  *
216  * Return the offset.                             216  * Return the offset.
217  */                                               217  */
218 static inline uint16_t dpaa2_fd_get_offset(con    218 static inline uint16_t dpaa2_fd_get_offset(const struct dpaa2_fd *fd)
219 {                                                 219 {
220         return le16_to_cpu(fd->simple.format_o    220         return le16_to_cpu(fd->simple.format_offset) & FD_OFFSET_MASK;
221 }                                                 221 }
222                                                   222 
223 /**                                               223 /**
224  * dpaa2_fd_set_offset() - Set the offset fiel    224  * dpaa2_fd_set_offset() - Set the offset field of frame descriptor
225  * @fd: the given frame descriptor                225  * @fd: the given frame descriptor
226  * @offset: the offset needs to be set in fram    226  * @offset: the offset needs to be set in frame descriptor
227  */                                               227  */
228 static inline void dpaa2_fd_set_offset(struct     228 static inline void dpaa2_fd_set_offset(struct dpaa2_fd *fd, uint16_t offset)
229 {                                                 229 {
230         fd->simple.format_offset &= cpu_to_le1    230         fd->simple.format_offset &= cpu_to_le16(~FD_OFFSET_MASK);
231         fd->simple.format_offset |= cpu_to_le1    231         fd->simple.format_offset |= cpu_to_le16(offset);
232 }                                                 232 }
233                                                   233 
234 /**                                               234 /**
235  * dpaa2_fd_get_format() - Get the format fiel    235  * dpaa2_fd_get_format() - Get the format field in the frame descriptor
236  * @fd: the given frame descriptor                236  * @fd: the given frame descriptor
237  *                                                237  *
238  * Return the format.                             238  * Return the format.
239  */                                               239  */
240 static inline enum dpaa2_fd_format dpaa2_fd_ge    240 static inline enum dpaa2_fd_format dpaa2_fd_get_format(
241                                                   241                                                 const struct dpaa2_fd *fd)
242 {                                                 242 {
243         return (enum dpaa2_fd_format)((le16_to    243         return (enum dpaa2_fd_format)((le16_to_cpu(fd->simple.format_offset)
244                                       >> FD_FO    244                                       >> FD_FORMAT_SHIFT) & FD_FORMAT_MASK);
245 }                                                 245 }
246                                                   246 
247 /**                                               247 /**
248  * dpaa2_fd_set_format() - Set the format fiel    248  * dpaa2_fd_set_format() - Set the format field of frame descriptor
249  * @fd: the given frame descriptor                249  * @fd: the given frame descriptor
250  * @format: the format needs to be set in fram    250  * @format: the format needs to be set in frame descriptor
251  */                                               251  */
252 static inline void dpaa2_fd_set_format(struct     252 static inline void dpaa2_fd_set_format(struct dpaa2_fd *fd,
253                                        enum dp    253                                        enum dpaa2_fd_format format)
254 {                                                 254 {
255         fd->simple.format_offset &=               255         fd->simple.format_offset &=
256                 cpu_to_le16(~(FD_FORMAT_MASK <    256                 cpu_to_le16(~(FD_FORMAT_MASK << FD_FORMAT_SHIFT));
257         fd->simple.format_offset |= cpu_to_le1    257         fd->simple.format_offset |= cpu_to_le16(format << FD_FORMAT_SHIFT);
258 }                                                 258 }
259                                                   259 
260 /**                                               260 /**
261  * dpaa2_fd_get_bpid() - Get the bpid field in    261  * dpaa2_fd_get_bpid() - Get the bpid field in the frame descriptor
262  * @fd: the given frame descriptor                262  * @fd: the given frame descriptor
263  *                                                263  *
264  * Return the buffer pool id.                     264  * Return the buffer pool id.
265  */                                               265  */
266 static inline uint16_t dpaa2_fd_get_bpid(const    266 static inline uint16_t dpaa2_fd_get_bpid(const struct dpaa2_fd *fd)
267 {                                                 267 {
268         return le16_to_cpu(fd->simple.bpid) &     268         return le16_to_cpu(fd->simple.bpid) & FD_BPID_MASK;
269 }                                                 269 }
270                                                   270 
271 /**                                               271 /**
272  * dpaa2_fd_set_bpid() - Set the bpid field of    272  * dpaa2_fd_set_bpid() - Set the bpid field of frame descriptor
273  * @fd: the given frame descriptor                273  * @fd: the given frame descriptor
274  * @bpid: buffer pool id to be set                274  * @bpid: buffer pool id to be set
275  */                                               275  */
276 static inline void dpaa2_fd_set_bpid(struct dp    276 static inline void dpaa2_fd_set_bpid(struct dpaa2_fd *fd, uint16_t bpid)
277 {                                                 277 {
278         fd->simple.bpid &= cpu_to_le16(~(FD_BP    278         fd->simple.bpid &= cpu_to_le16(~(FD_BPID_MASK));
279         fd->simple.bpid |= cpu_to_le16(bpid);     279         fd->simple.bpid |= cpu_to_le16(bpid);
280 }                                                 280 }
281                                                   281 
282 /**                                               282 /**
283  * struct dpaa2_sg_entry - the scatter-gatheri    283  * struct dpaa2_sg_entry - the scatter-gathering structure
284  * @addr: address of the sg entry                 284  * @addr: address of the sg entry
285  * @len: length in this sg entry                  285  * @len: length in this sg entry
286  * @bpid: buffer pool id                          286  * @bpid: buffer pool id
287  * @format_offset: format and offset fields       287  * @format_offset: format and offset fields
288  */                                               288  */
289 struct dpaa2_sg_entry {                           289 struct dpaa2_sg_entry {
290         __le64 addr;                              290         __le64 addr;
291         __le32 len;                               291         __le32 len;
292         __le16 bpid;                              292         __le16 bpid;
293         __le16 format_offset;                     293         __le16 format_offset;
294 };                                                294 };
295                                                   295 
296 enum dpaa2_sg_format {                            296 enum dpaa2_sg_format {
297         dpaa2_sg_single = 0,                      297         dpaa2_sg_single = 0,
298         dpaa2_sg_frame_data,                      298         dpaa2_sg_frame_data,
299         dpaa2_sg_sgt_ext                          299         dpaa2_sg_sgt_ext
300 };                                                300 };
301                                                   301 
302 /* Accessors for SG entry fields */               302 /* Accessors for SG entry fields */
303                                                   303 
304 /**                                               304 /**
305  * dpaa2_sg_get_addr() - Get the address from     305  * dpaa2_sg_get_addr() - Get the address from SG entry
306  * @sg: the given scatter-gathering object        306  * @sg: the given scatter-gathering object
307  *                                                307  *
308  * Return the address.                            308  * Return the address.
309  */                                               309  */
310 static inline dma_addr_t dpaa2_sg_get_addr(con    310 static inline dma_addr_t dpaa2_sg_get_addr(const struct dpaa2_sg_entry *sg)
311 {                                                 311 {
312         return (dma_addr_t)le64_to_cpu(sg->add    312         return (dma_addr_t)le64_to_cpu(sg->addr);
313 }                                                 313 }
314                                                   314 
315 /**                                               315 /**
316  * dpaa2_sg_set_addr() - Set the address in SG    316  * dpaa2_sg_set_addr() - Set the address in SG entry
317  * @sg: the given scatter-gathering object        317  * @sg: the given scatter-gathering object
318  * @addr: the address to be set                   318  * @addr: the address to be set
319  */                                               319  */
320 static inline void dpaa2_sg_set_addr(struct dp    320 static inline void dpaa2_sg_set_addr(struct dpaa2_sg_entry *sg, dma_addr_t addr)
321 {                                                 321 {
322         sg->addr = cpu_to_le64(addr);             322         sg->addr = cpu_to_le64(addr);
323 }                                                 323 }
324                                                   324 
325 static inline bool dpaa2_sg_short_len(const st    325 static inline bool dpaa2_sg_short_len(const struct dpaa2_sg_entry *sg)
326 {                                                 326 {
327         return !!((le16_to_cpu(sg->format_offs    327         return !!((le16_to_cpu(sg->format_offset) >> SG_SHORT_LEN_FLAG_SHIFT)
328                 & SG_SHORT_LEN_FLAG_MASK);        328                 & SG_SHORT_LEN_FLAG_MASK);
329 }                                                 329 }
330                                                   330 
331 /**                                               331 /**
332  * dpaa2_sg_get_len() - Get the length in SG e    332  * dpaa2_sg_get_len() - Get the length in SG entry
333  * @sg: the given scatter-gathering object        333  * @sg: the given scatter-gathering object
334  *                                                334  *
335  * Return the length.                             335  * Return the length.
336  */                                               336  */
337 static inline u32 dpaa2_sg_get_len(const struc    337 static inline u32 dpaa2_sg_get_len(const struct dpaa2_sg_entry *sg)
338 {                                                 338 {
339         if (dpaa2_sg_short_len(sg))               339         if (dpaa2_sg_short_len(sg))
340                 return le32_to_cpu(sg->len) &     340                 return le32_to_cpu(sg->len) & SG_SHORT_LEN_MASK;
341                                                   341 
342         return le32_to_cpu(sg->len);              342         return le32_to_cpu(sg->len);
343 }                                                 343 }
344                                                   344 
345 /**                                               345 /**
346  * dpaa2_sg_set_len() - Set the length in SG e    346  * dpaa2_sg_set_len() - Set the length in SG entry
347  * @sg: the given scatter-gathering object        347  * @sg: the given scatter-gathering object
348  * @len: the length to be set                     348  * @len: the length to be set
349  */                                               349  */
350 static inline void dpaa2_sg_set_len(struct dpa    350 static inline void dpaa2_sg_set_len(struct dpaa2_sg_entry *sg, u32 len)
351 {                                                 351 {
352         sg->len = cpu_to_le32(len);               352         sg->len = cpu_to_le32(len);
353 }                                                 353 }
354                                                   354 
355 /**                                               355 /**
356  * dpaa2_sg_get_offset() - Get the offset in S    356  * dpaa2_sg_get_offset() - Get the offset in SG entry
357  * @sg: the given scatter-gathering object        357  * @sg: the given scatter-gathering object
358  *                                                358  *
359  * Return the offset.                             359  * Return the offset.
360  */                                               360  */
361 static inline u16 dpaa2_sg_get_offset(const st    361 static inline u16 dpaa2_sg_get_offset(const struct dpaa2_sg_entry *sg)
362 {                                                 362 {
363         return le16_to_cpu(sg->format_offset)     363         return le16_to_cpu(sg->format_offset) & SG_OFFSET_MASK;
364 }                                                 364 }
365                                                   365 
366 /**                                               366 /**
367  * dpaa2_sg_set_offset() - Set the offset in S    367  * dpaa2_sg_set_offset() - Set the offset in SG entry
368  * @sg: the given scatter-gathering object        368  * @sg: the given scatter-gathering object
369  * @offset: the offset to be set                  369  * @offset: the offset to be set
370  */                                               370  */
371 static inline void dpaa2_sg_set_offset(struct     371 static inline void dpaa2_sg_set_offset(struct dpaa2_sg_entry *sg,
372                                        u16 off    372                                        u16 offset)
373 {                                                 373 {
374         sg->format_offset &= cpu_to_le16(~SG_O    374         sg->format_offset &= cpu_to_le16(~SG_OFFSET_MASK);
375         sg->format_offset |= cpu_to_le16(offse    375         sg->format_offset |= cpu_to_le16(offset);
376 }                                                 376 }
377                                                   377 
378 /**                                               378 /**
379  * dpaa2_sg_get_format() - Get the SG format i    379  * dpaa2_sg_get_format() - Get the SG format in SG entry
380  * @sg: the given scatter-gathering object        380  * @sg: the given scatter-gathering object
381  *                                                381  *
382  * Return the format.                             382  * Return the format.
383  */                                               383  */
384 static inline enum dpaa2_sg_format                384 static inline enum dpaa2_sg_format
385         dpaa2_sg_get_format(const struct dpaa2    385         dpaa2_sg_get_format(const struct dpaa2_sg_entry *sg)
386 {                                                 386 {
387         return (enum dpaa2_sg_format)((le16_to    387         return (enum dpaa2_sg_format)((le16_to_cpu(sg->format_offset)
388                                        >> SG_F    388                                        >> SG_FORMAT_SHIFT) & SG_FORMAT_MASK);
389 }                                                 389 }
390                                                   390 
391 /**                                               391 /**
392  * dpaa2_sg_set_format() - Set the SG format i    392  * dpaa2_sg_set_format() - Set the SG format in SG entry
393  * @sg: the given scatter-gathering object        393  * @sg: the given scatter-gathering object
394  * @format: the format to be set                  394  * @format: the format to be set
395  */                                               395  */
396 static inline void dpaa2_sg_set_format(struct     396 static inline void dpaa2_sg_set_format(struct dpaa2_sg_entry *sg,
397                                        enum dp    397                                        enum dpaa2_sg_format format)
398 {                                                 398 {
399         sg->format_offset &= cpu_to_le16(~(SG_    399         sg->format_offset &= cpu_to_le16(~(SG_FORMAT_MASK << SG_FORMAT_SHIFT));
400         sg->format_offset |= cpu_to_le16(forma    400         sg->format_offset |= cpu_to_le16(format << SG_FORMAT_SHIFT);
401 }                                                 401 }
402                                                   402 
403 /**                                               403 /**
404  * dpaa2_sg_get_bpid() - Get the buffer pool i    404  * dpaa2_sg_get_bpid() - Get the buffer pool id in SG entry
405  * @sg: the given scatter-gathering object        405  * @sg: the given scatter-gathering object
406  *                                                406  *
407  * Return the bpid.                               407  * Return the bpid.
408  */                                               408  */
409 static inline u16 dpaa2_sg_get_bpid(const stru    409 static inline u16 dpaa2_sg_get_bpid(const struct dpaa2_sg_entry *sg)
410 {                                                 410 {
411         return le16_to_cpu(sg->bpid) & SG_BPID    411         return le16_to_cpu(sg->bpid) & SG_BPID_MASK;
412 }                                                 412 }
413                                                   413 
414 /**                                               414 /**
415  * dpaa2_sg_set_bpid() - Set the buffer pool i    415  * dpaa2_sg_set_bpid() - Set the buffer pool id in SG entry
416  * @sg: the given scatter-gathering object        416  * @sg: the given scatter-gathering object
417  * @bpid: the bpid to be set                      417  * @bpid: the bpid to be set
418  */                                               418  */
419 static inline void dpaa2_sg_set_bpid(struct dp    419 static inline void dpaa2_sg_set_bpid(struct dpaa2_sg_entry *sg, u16 bpid)
420 {                                                 420 {
421         sg->bpid &= cpu_to_le16(~(SG_BPID_MASK    421         sg->bpid &= cpu_to_le16(~(SG_BPID_MASK));
422         sg->bpid |= cpu_to_le16(bpid);            422         sg->bpid |= cpu_to_le16(bpid);
423 }                                                 423 }
424                                                   424 
425 /**                                               425 /**
426  * dpaa2_sg_is_final() - Check final bit in SG    426  * dpaa2_sg_is_final() - Check final bit in SG entry
427  * @sg: the given scatter-gathering object        427  * @sg: the given scatter-gathering object
428  *                                                428  *
429  * Return bool.                                   429  * Return bool.
430  */                                               430  */
431 static inline bool dpaa2_sg_is_final(const str    431 static inline bool dpaa2_sg_is_final(const struct dpaa2_sg_entry *sg)
432 {                                                 432 {
433         return !!(le16_to_cpu(sg->format_offse    433         return !!(le16_to_cpu(sg->format_offset) >> SG_FINAL_FLAG_SHIFT);
434 }                                                 434 }
435                                                   435 
436 /**                                               436 /**
437  * dpaa2_sg_set_final() - Set the final bit in    437  * dpaa2_sg_set_final() - Set the final bit in SG entry
438  * @sg: the given scatter-gathering object        438  * @sg: the given scatter-gathering object
439  * @final: the final boolean to be set            439  * @final: the final boolean to be set
440  */                                               440  */
441 static inline void dpaa2_sg_set_final(struct d    441 static inline void dpaa2_sg_set_final(struct dpaa2_sg_entry *sg, bool final)
442 {                                                 442 {
443         sg->format_offset &= cpu_to_le16((~(SG    443         sg->format_offset &= cpu_to_le16((~(SG_FINAL_FLAG_MASK
444                                          << SG    444                                          << SG_FINAL_FLAG_SHIFT)) & 0xFFFF);
445         sg->format_offset |= cpu_to_le16(final    445         sg->format_offset |= cpu_to_le16(final << SG_FINAL_FLAG_SHIFT);
446 }                                                 446 }
447                                                   447 
448 /**                                               448 /**
449  * struct dpaa2_fl_entry - structure for frame    449  * struct dpaa2_fl_entry - structure for frame list entry.
450  * @addr:          address in the FLE             450  * @addr:          address in the FLE
451  * @len:           length in the FLE              451  * @len:           length in the FLE
452  * @bpid:          buffer pool ID                 452  * @bpid:          buffer pool ID
453  * @format_offset: format, offset, and short-l    453  * @format_offset: format, offset, and short-length fields
454  * @frc:           frame context                  454  * @frc:           frame context
455  * @ctrl:          control bits...including pt    455  * @ctrl:          control bits...including pta, pvt1, pvt2, err, etc
456  * @flc:           flow context address           456  * @flc:           flow context address
457  */                                               457  */
458 struct dpaa2_fl_entry {                           458 struct dpaa2_fl_entry {
459         __le64 addr;                              459         __le64 addr;
460         __le32 len;                               460         __le32 len;
461         __le16 bpid;                              461         __le16 bpid;
462         __le16 format_offset;                     462         __le16 format_offset;
463         __le32 frc;                               463         __le32 frc;
464         __le32 ctrl;                              464         __le32 ctrl;
465         __le64 flc;                               465         __le64 flc;
466 };                                                466 };
467                                                   467 
468 enum dpaa2_fl_format {                            468 enum dpaa2_fl_format {
469         dpaa2_fl_single = 0,                      469         dpaa2_fl_single = 0,
470         dpaa2_fl_res,                             470         dpaa2_fl_res,
471         dpaa2_fl_sg                               471         dpaa2_fl_sg
472 };                                                472 };
473                                                   473 
474 /**                                               474 /**
475  * dpaa2_fl_get_addr() - get the addr field of    475  * dpaa2_fl_get_addr() - get the addr field of FLE
476  * @fle: the given frame list entry               476  * @fle: the given frame list entry
477  *                                                477  *
478  * Return the address in the frame list entry.    478  * Return the address in the frame list entry.
479  */                                               479  */
480 static inline dma_addr_t dpaa2_fl_get_addr(con    480 static inline dma_addr_t dpaa2_fl_get_addr(const struct dpaa2_fl_entry *fle)
481 {                                                 481 {
482         return (dma_addr_t)le64_to_cpu(fle->ad    482         return (dma_addr_t)le64_to_cpu(fle->addr);
483 }                                                 483 }
484                                                   484 
485 /**                                               485 /**
486  * dpaa2_fl_set_addr() - Set the addr field of    486  * dpaa2_fl_set_addr() - Set the addr field of FLE
487  * @fle: the given frame list entry               487  * @fle: the given frame list entry
488  * @addr: the address needs to be set in frame    488  * @addr: the address needs to be set in frame list entry
489  */                                               489  */
490 static inline void dpaa2_fl_set_addr(struct dp    490 static inline void dpaa2_fl_set_addr(struct dpaa2_fl_entry *fle,
491                                      dma_addr_    491                                      dma_addr_t addr)
492 {                                                 492 {
493         fle->addr = cpu_to_le64(addr);            493         fle->addr = cpu_to_le64(addr);
494 }                                                 494 }
495                                                   495 
496 /**                                               496 /**
497  * dpaa2_fl_get_frc() - Get the frame context     497  * dpaa2_fl_get_frc() - Get the frame context in the FLE
498  * @fle: the given frame list entry               498  * @fle: the given frame list entry
499  *                                                499  *
500  * Return the frame context field in the frame    500  * Return the frame context field in the frame lsit entry.
501  */                                               501  */
502 static inline u32 dpaa2_fl_get_frc(const struc    502 static inline u32 dpaa2_fl_get_frc(const struct dpaa2_fl_entry *fle)
503 {                                                 503 {
504         return le32_to_cpu(fle->frc);             504         return le32_to_cpu(fle->frc);
505 }                                                 505 }
506                                                   506 
507 /**                                               507 /**
508  * dpaa2_fl_set_frc() - Set the frame context     508  * dpaa2_fl_set_frc() - Set the frame context in the FLE
509  * @fle: the given frame list entry               509  * @fle: the given frame list entry
510  * @frc: the frame context needs to be set in     510  * @frc: the frame context needs to be set in frame list entry
511  */                                               511  */
512 static inline void dpaa2_fl_set_frc(struct dpa    512 static inline void dpaa2_fl_set_frc(struct dpaa2_fl_entry *fle, u32 frc)
513 {                                                 513 {
514         fle->frc = cpu_to_le32(frc);              514         fle->frc = cpu_to_le32(frc);
515 }                                                 515 }
516                                                   516 
517 /**                                               517 /**
518  * dpaa2_fl_get_ctrl() - Get the control bits     518  * dpaa2_fl_get_ctrl() - Get the control bits in the FLE
519  * @fle: the given frame list entry               519  * @fle: the given frame list entry
520  *                                                520  *
521  * Return the control bits field in the frame     521  * Return the control bits field in the frame list entry.
522  */                                               522  */
523 static inline u32 dpaa2_fl_get_ctrl(const stru    523 static inline u32 dpaa2_fl_get_ctrl(const struct dpaa2_fl_entry *fle)
524 {                                                 524 {
525         return le32_to_cpu(fle->ctrl);            525         return le32_to_cpu(fle->ctrl);
526 }                                                 526 }
527                                                   527 
528 /**                                               528 /**
529  * dpaa2_fl_set_ctrl() - Set the control bits     529  * dpaa2_fl_set_ctrl() - Set the control bits in the FLE
530  * @fle: the given frame list entry               530  * @fle: the given frame list entry
531  * @ctrl: the control bits to be set in the fr    531  * @ctrl: the control bits to be set in the frame list entry
532  */                                               532  */
533 static inline void dpaa2_fl_set_ctrl(struct dp    533 static inline void dpaa2_fl_set_ctrl(struct dpaa2_fl_entry *fle, u32 ctrl)
534 {                                                 534 {
535         fle->ctrl = cpu_to_le32(ctrl);            535         fle->ctrl = cpu_to_le32(ctrl);
536 }                                                 536 }
537                                                   537 
538 /**                                               538 /**
539  * dpaa2_fl_get_flc() - Get the flow context i    539  * dpaa2_fl_get_flc() - Get the flow context in the FLE
540  * @fle: the given frame list entry               540  * @fle: the given frame list entry
541  *                                                541  *
542  * Return the flow context in the frame list e    542  * Return the flow context in the frame list entry.
543  */                                               543  */
544 static inline dma_addr_t dpaa2_fl_get_flc(cons    544 static inline dma_addr_t dpaa2_fl_get_flc(const struct dpaa2_fl_entry *fle)
545 {                                                 545 {
546         return (dma_addr_t)le64_to_cpu(fle->fl    546         return (dma_addr_t)le64_to_cpu(fle->flc);
547 }                                                 547 }
548                                                   548 
549 /**                                               549 /**
550  * dpaa2_fl_set_flc() - Set the flow context f    550  * dpaa2_fl_set_flc() - Set the flow context field of FLE
551  * @fle: the given frame list entry               551  * @fle: the given frame list entry
552  * @flc_addr: the flow context needs to be set    552  * @flc_addr: the flow context needs to be set in frame list entry
553  */                                               553  */
554 static inline void dpaa2_fl_set_flc(struct dpa    554 static inline void dpaa2_fl_set_flc(struct dpaa2_fl_entry *fle,
555                                     dma_addr_t    555                                     dma_addr_t flc_addr)
556 {                                                 556 {
557         fle->flc = cpu_to_le64(flc_addr);         557         fle->flc = cpu_to_le64(flc_addr);
558 }                                                 558 }
559                                                   559 
560 static inline bool dpaa2_fl_short_len(const st    560 static inline bool dpaa2_fl_short_len(const struct dpaa2_fl_entry *fle)
561 {                                                 561 {
562         return !!((le16_to_cpu(fle->format_off    562         return !!((le16_to_cpu(fle->format_offset) >>
563                   FL_SHORT_LEN_FLAG_SHIFT) & F    563                   FL_SHORT_LEN_FLAG_SHIFT) & FL_SHORT_LEN_FLAG_MASK);
564 }                                                 564 }
565                                                   565 
566 /**                                               566 /**
567  * dpaa2_fl_get_len() - Get the length in the     567  * dpaa2_fl_get_len() - Get the length in the FLE
568  * @fle: the given frame list entry               568  * @fle: the given frame list entry
569  *                                                569  *
570  * Return the length field in the frame list e    570  * Return the length field in the frame list entry.
571  */                                               571  */
572 static inline u32 dpaa2_fl_get_len(const struc    572 static inline u32 dpaa2_fl_get_len(const struct dpaa2_fl_entry *fle)
573 {                                                 573 {
574         if (dpaa2_fl_short_len(fle))              574         if (dpaa2_fl_short_len(fle))
575                 return le32_to_cpu(fle->len) &    575                 return le32_to_cpu(fle->len) & FL_SHORT_LEN_MASK;
576                                                   576 
577         return le32_to_cpu(fle->len);             577         return le32_to_cpu(fle->len);
578 }                                                 578 }
579                                                   579 
580 /**                                               580 /**
581  * dpaa2_fl_set_len() - Set the length field o    581  * dpaa2_fl_set_len() - Set the length field of FLE
582  * @fle: the given frame list entry               582  * @fle: the given frame list entry
583  * @len: the length needs to be set in frame l    583  * @len: the length needs to be set in frame list entry
584  */                                               584  */
585 static inline void dpaa2_fl_set_len(struct dpa    585 static inline void dpaa2_fl_set_len(struct dpaa2_fl_entry *fle, u32 len)
586 {                                                 586 {
587         fle->len = cpu_to_le32(len);              587         fle->len = cpu_to_le32(len);
588 }                                                 588 }
589                                                   589 
590 /**                                               590 /**
591  * dpaa2_fl_get_offset() - Get the offset fiel    591  * dpaa2_fl_get_offset() - Get the offset field in the frame list entry
592  * @fle: the given frame list entry               592  * @fle: the given frame list entry
593  *                                                593  *
594  * Return the offset.                             594  * Return the offset.
595  */                                               595  */
596 static inline u16 dpaa2_fl_get_offset(const st    596 static inline u16 dpaa2_fl_get_offset(const struct dpaa2_fl_entry *fle)
597 {                                                 597 {
598         return le16_to_cpu(fle->format_offset)    598         return le16_to_cpu(fle->format_offset) & FL_OFFSET_MASK;
599 }                                                 599 }
600                                                   600 
601 /**                                               601 /**
602  * dpaa2_fl_set_offset() - Set the offset fiel    602  * dpaa2_fl_set_offset() - Set the offset field of FLE
603  * @fle: the given frame list entry               603  * @fle: the given frame list entry
604  * @offset: the offset needs to be set in fram    604  * @offset: the offset needs to be set in frame list entry
605  */                                               605  */
606 static inline void dpaa2_fl_set_offset(struct     606 static inline void dpaa2_fl_set_offset(struct dpaa2_fl_entry *fle, u16 offset)
607 {                                                 607 {
608         fle->format_offset &= cpu_to_le16(~FL_    608         fle->format_offset &= cpu_to_le16(~FL_OFFSET_MASK);
609         fle->format_offset |= cpu_to_le16(offs    609         fle->format_offset |= cpu_to_le16(offset);
610 }                                                 610 }
611                                                   611 
612 /**                                               612 /**
613  * dpaa2_fl_get_format() - Get the format fiel    613  * dpaa2_fl_get_format() - Get the format field in the FLE
614  * @fle: the given frame list entry               614  * @fle: the given frame list entry
615  *                                                615  *
616  * Return the format.                             616  * Return the format.
617  */                                               617  */
618 static inline enum dpaa2_fl_format dpaa2_fl_ge    618 static inline enum dpaa2_fl_format dpaa2_fl_get_format(const struct dpaa2_fl_entry *fle)
619 {                                                 619 {
620         return (enum dpaa2_fl_format)((le16_to    620         return (enum dpaa2_fl_format)((le16_to_cpu(fle->format_offset) >>
621                                        FL_FORM    621                                        FL_FORMAT_SHIFT) & FL_FORMAT_MASK);
622 }                                                 622 }
623                                                   623 
624 /**                                               624 /**
625  * dpaa2_fl_set_format() - Set the format fiel    625  * dpaa2_fl_set_format() - Set the format field of FLE
626  * @fle: the given frame list entry               626  * @fle: the given frame list entry
627  * @format: the format needs to be set in fram    627  * @format: the format needs to be set in frame list entry
628  */                                               628  */
629 static inline void dpaa2_fl_set_format(struct     629 static inline void dpaa2_fl_set_format(struct dpaa2_fl_entry *fle,
630                                        enum dp    630                                        enum dpaa2_fl_format format)
631 {                                                 631 {
632         fle->format_offset &= cpu_to_le16(~(FL    632         fle->format_offset &= cpu_to_le16(~(FL_FORMAT_MASK << FL_FORMAT_SHIFT));
633         fle->format_offset |= cpu_to_le16(form    633         fle->format_offset |= cpu_to_le16(format << FL_FORMAT_SHIFT);
634 }                                                 634 }
635                                                   635 
636 /**                                               636 /**
637  * dpaa2_fl_get_bpid() - Get the bpid field in    637  * dpaa2_fl_get_bpid() - Get the bpid field in the FLE
638  * @fle: the given frame list entry               638  * @fle: the given frame list entry
639  *                                                639  *
640  * Return the buffer pool id.                     640  * Return the buffer pool id.
641  */                                               641  */
642 static inline u16 dpaa2_fl_get_bpid(const stru    642 static inline u16 dpaa2_fl_get_bpid(const struct dpaa2_fl_entry *fle)
643 {                                                 643 {
644         return le16_to_cpu(fle->bpid) & FL_BPI    644         return le16_to_cpu(fle->bpid) & FL_BPID_MASK;
645 }                                                 645 }
646                                                   646 
647 /**                                               647 /**
648  * dpaa2_fl_set_bpid() - Set the bpid field of    648  * dpaa2_fl_set_bpid() - Set the bpid field of FLE
649  * @fle: the given frame list entry               649  * @fle: the given frame list entry
650  * @bpid: buffer pool id to be set                650  * @bpid: buffer pool id to be set
651  */                                               651  */
652 static inline void dpaa2_fl_set_bpid(struct dp    652 static inline void dpaa2_fl_set_bpid(struct dpaa2_fl_entry *fle, u16 bpid)
653 {                                                 653 {
654         fle->bpid &= cpu_to_le16(~(FL_BPID_MAS    654         fle->bpid &= cpu_to_le16(~(FL_BPID_MASK));
655         fle->bpid |= cpu_to_le16(bpid);           655         fle->bpid |= cpu_to_le16(bpid);
656 }                                                 656 }
657                                                   657 
658 /**                                               658 /**
659  * dpaa2_fl_is_final() - Check final bit in FL    659  * dpaa2_fl_is_final() - Check final bit in FLE
660  * @fle: the given frame list entry               660  * @fle: the given frame list entry
661  *                                                661  *
662  * Return bool.                                   662  * Return bool.
663  */                                               663  */
664 static inline bool dpaa2_fl_is_final(const str    664 static inline bool dpaa2_fl_is_final(const struct dpaa2_fl_entry *fle)
665 {                                                 665 {
666         return !!(le16_to_cpu(fle->format_offs    666         return !!(le16_to_cpu(fle->format_offset) >> FL_FINAL_FLAG_SHIFT);
667 }                                                 667 }
668                                                   668 
669 /**                                               669 /**
670  * dpaa2_fl_set_final() - Set the final bit in    670  * dpaa2_fl_set_final() - Set the final bit in FLE
671  * @fle: the given frame list entry               671  * @fle: the given frame list entry
672  * @final: the final boolean to be set            672  * @final: the final boolean to be set
673  */                                               673  */
674 static inline void dpaa2_fl_set_final(struct d    674 static inline void dpaa2_fl_set_final(struct dpaa2_fl_entry *fle, bool final)
675 {                                                 675 {
676         fle->format_offset &= cpu_to_le16((~(F    676         fle->format_offset &= cpu_to_le16((~(FL_FINAL_FLAG_MASK <<
677                                              F    677                                              FL_FINAL_FLAG_SHIFT)) & 0xFFFF);
678         fle->format_offset |= cpu_to_le16(fina    678         fle->format_offset |= cpu_to_le16(final << FL_FINAL_FLAG_SHIFT);
679 }                                                 679 }
680                                                   680 
681 #endif /* __FSL_DPAA2_FD_H */                     681 #endif /* __FSL_DPAA2_FD_H */
682                                                   682 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php