summaryrefslogtreecommitdiff
path: root/cpu/ixp/npe/include/IxEthNpe.h
blob: 21bdedc5a76f217d01ab12015293cb3c67f168f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
#ifndef __doxygen_HIDE  /* This file is not part of the API */

/**
 * @file IxEthNpe.h
 * 
 * @par
 * IXP400 SW Release version 2.0
 * 
 * -- Copyright Notice --
 * 
 * @par
 * Copyright 2001-2005, Intel Corporation.
 * All rights reserved.
 * 
 * @par
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Intel Corporation nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 * 
 * @par
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * @par
 * -- End of Copyright Notice --
*/

/**
 * @defgroup IxEthNpe IXP400 Ethernet NPE (IxEthNpe) API
 *
 * @brief Contains the API for Ethernet NPE.
 * 
 * All messages given to NPE, get back an acknowledgment. The acknowledgment 
 * is identical to the message sent to the NPE (except for NPE_GETSTATUS message).
 *
 * @{
 */


/*--------------------------------------------------------------------------
 * APB Message IDs - XScale->NPE
 *------------------------------------------------------------------------*/

/**
 * @def IX_ETHNPE_NPE_GETSTATUS
 *
 * @brief Request from the XScale client for the NPE to return the firmware
 * version of the currently executing image.
 *
 * Acknowledgment message id is same as the request message id. 
 * NPE returns the firmware version ID to XScale.
 */
#define IX_ETHNPE_NPE_GETSTATUS                 0x00

/**
 * @def IX_ETHNPE_EDB_SETPORTADDRESS
 *
 * @brief Request from the XScale client for the NPE to set the Ethernet 
 * port's port ID and MAC address. 
 */
#define IX_ETHNPE_EDB_SETPORTADDRESS            0x01

/**
 * @def IX_ETHNPE_EDB_GETMACADDRESSDATABASE
 *
 * @brief Request from XScale client to the NPE requesting upload of 
 * Ethernet Filtering Database or Header Conversion Database from NPE's 
 * data memory to XScale accessible SDRAM.
 */
#define IX_ETHNPE_EDB_GETMACADDRESSDATABASE     0x02

/**
 * @def IX_ETHNPE_EDB_SETMACADDRESSSDATABASE
 *
 * @brief Request from XScale client to the NPE requesting download of 
 * Ethernet Filtering Database or Header Conversion Database from SDRAM
 * to the NPE's datamemory.
 */
#define IX_ETHNPE_EDB_SETMACADDRESSSDATABASE    0x03

/**
 * @def IX_ETHNPE_GETSTATS
 *
 * @brief Request from the XScale client for the current MAC port statistics 
 * data to be written to the (empty) statistics structure and the specified
 * location in externa memory.
 */
#define IX_ETHNPE_GETSTATS                      0x04

/**
 * @def IX_ETHNPE_RESETSTATS
 *
 * @brief Request from the XScale client to the NPE to reset all of its internal 
 * MAC port statistics state variables. 
 *
 * As a side effect, this message entails an implicit request that the NPE
 *  write the current MAC port statistics into the MAC statistics structure 
 * at the specified location in external memory.
 */
#define IX_ETHNPE_RESETSTATS                    0x05

/**
 * @def IX_ETHNPE_SETMAXFRAMELENGTHS
 *
 * @brief Request from the XScale client to the NPE to configure maximum framelengths
 * and block sizes in receive and transmit direction.
 */
#define IX_ETHNPE_SETMAXFRAMELENGTHS            0x06

/**
 * @def IX_ETHNPE_VLAN_SETRXTAGMODE
 *
 * @brief Request from the XScale client to the NPE to configure VLAN frame type
 * filtering and VLAN the tagging mode for the receiver.
 */
#define IX_ETHNPE_VLAN_SETRXTAGMODE             0x07

/**
 * @def IX_ETHNPE_VLAN_SETDEFAULTRXVID
 *
 * @brief Request from the XScale client to the NPE to set receiver's default 
 * VLAN tag (PVID)and internal traffic class.
 */
#define IX_ETHNPE_VLAN_SETDEFAULTRXVID          0x08

/**
 * @def IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY
 *
 * @brief Request from the XScale client to the NPE to configure VLAN Port 
 * membership and Tx tagging for 8 consecutive VLANID's.
 */
#define IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY    0x09

/**
 * @def IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE
 *
 * @brief Request from the XScale client to the NPE to configure VLAN Port
 * membership and Tx tagging for a range of VLANID's.
 */
#define IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE    0x0A

/**
 * @def IX_ETHNPE_VLAN_SETRXQOSENTRY
 *
 * @brief Request from the XScale client to the NPE to map a user priority
 * to QoS class and an AQM queue number.
 */
#define IX_ETHNPE_VLAN_SETRXQOSENTRY            0x0B

/**
 * @def IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE
 *
 * @brief Request from the XScale client to the NPE to enable or disable
 * portID extraction from VLAN-tagged frames for the specified port.
 */
#define IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE  0x0C

/**
 * @def IX_ETHNPE_STP_SETBLOCKINGSTATE
 *
 * @brief Request from the XScale client to the NPE to block or unblock
 * forwarding for spanning tree BPDUs.
 */
#define IX_ETHNPE_STP_SETBLOCKINGSTATE          0x0D

/**
 * @def IX_ETHNPE_FW_SETFIREWALLMODE
 *
 * @brief Request from the XScale client to the NPE to configure firewall
 * services modes of operation and/or download Ethernet Firewall Database from
 * SDRAM to NPE.
 */
#define IX_ETHNPE_FW_SETFIREWALLMODE            0x0E

/**
 * @def IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID 
 *
 * @brief Request from the XScale client to the NPE to set global frame control
 * and duration/ID field for the 802.3 to 802.11 protocol header conversion
 * service.
 */
#define IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID  0x0F

/**
 * @def IX_ETHNPE_PC_SETBBSID
 *
 * @brief Request from the XScale client to the NPE to set global BBSID field
 * value for the 802.3 to 802.11 protocol header conversion service. 
 */
#define IX_ETHNPE_PC_SETBBSID                   0x10

/**
 * @def IX_ETHNPE_PC_SETAPMACTABLE
 *
 * @brief Request from the XScale client to the NPE to update a block/section/
 * range of the AP MAC Address Table.
 */
#define IX_ETHNPE_PC_SETAPMACTABLE              0x11

/**
 * @def IX_ETHNPE_SETLOOPBACK_MODE
 *
 * @brief Turn on or off the NPE frame loopback.
 */
#define IX_ETHNPE_SETLOOPBACK_MODE              (0x12)

/*--------------------------------------------------------------------------
 * APB Message IDs - NPE->XScale
 *------------------------------------------------------------------------*/

/**
 * @def IX_ETHNPE_NPE_GETSTATUS_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_NPE_GETSTATUS message. NPE firmware version 
 * id is returned in the message.
 */
#define IX_ETHNPE_NPE_GETSTATUS_ACK                 0x00

/**
 * @def IX_ETHNPE_EDB_SETPORTADDRESS_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_EDB_SETPORTADDRESS message.
 */
#define IX_ETHNPE_EDB_SETPORTADDRESS_ACK            0x01

/**
 * @def IX_ETHNPE_EDB_GETMACADDRESSDATABASE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_EDB_GETMACADDRESSDATABASE message
 */
#define IX_ETHNPE_EDB_GETMACADDRESSDATABASE_ACK     0x02

/**
 * @def IX_ETHNPE_EDB_SETMACADDRESSSDATABASE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_EDB_SETMACADDRESSSDATABASE message.
 */
#define IX_ETHNPE_EDB_SETMACADDRESSSDATABASE_ACK    0x03

/**
 * @def IX_ETHNPE_GETSTATS_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_GETSTATS message.
 */
#define IX_ETHNPE_GETSTATS_ACK                      0x04

/**
 * @def IX_ETHNPE_RESETSTATS_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_RESETSTATS message.
 */
#define IX_ETHNPE_RESETSTATS_ACK                    0x05

/**
 * @def IX_ETHNPE_SETMAXFRAMELENGTHS_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_SETMAXFRAMELENGTHS message.
 */
#define IX_ETHNPE_SETMAXFRAMELENGTHS_ACK            0x06

/**
 * @def IX_ETHNPE_VLAN_SETRXTAGMODE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETRXTAGMODE message.
 */
#define IX_ETHNPE_VLAN_SETRXTAGMODE_ACK             0x07

/**
 * @def IX_ETHNPE_VLAN_SETDEFAULTRXVID_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETDEFAULTRXVID  message.
 */
#define IX_ETHNPE_VLAN_SETDEFAULTRXVID_ACK          0x08

/**
 * @def IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY message.
 */
#define IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY_ACK    0x09

/**
 * @def IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE message.
 */
#define IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE_ACK    0x0A

/**
 * @def IX_ETHNPE_VLAN_SETRXQOSENTRY_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETRXQOSENTRY message.
 */
#define IX_ETHNPE_VLAN_SETRXQOSENTRY_ACK            0x0B

/**
 * @def IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE message.
 */
#define IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE_ACK  0x0C

/**
 * @def IX_ETHNPE_STP_SETBLOCKINGSTATE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_STP_SETBLOCKINGSTATE message.
 */
#define IX_ETHNPE_STP_SETBLOCKINGSTATE_ACK          0x0D

/**
 * @def IX_ETHNPE_FW_SETFIREWALLMODE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_FW_SETFIREWALLMODE message. 
 */
#define IX_ETHNPE_FW_SETFIREWALLMODE_ACK            0x0E

/**
 * @def IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID message.
 */
#define IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID_ACK  0x0F

/**
 * @def IX_ETHNPE_PC_SETBBSID_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_PC_SETBBSID message.
 */
#define IX_ETHNPE_PC_SETBBSID_ACK                   0x10

/**
 * @def IX_ETHNPE_PC_SETAPMACTABLE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_PC_SETAPMACTABLE message.
 */
#define IX_ETHNPE_PC_SETAPMACTABLE_ACK              0x11

/**
 * @def IX_ETHNPE_SETLOOPBACK_MODE_ACK
 *
 * @brief Acknowledgment to IX_ETHNPE_SETLOOPBACK_MODE message.
 */
#define IX_ETHNPE_SETLOOPBACK_MODE_ACK              (0x12)

/*--------------------------------------------------------------------------
 * Queue Manager Queue entry bit field boundary definitions
 *------------------------------------------------------------------------*/

/**
 * @def MASK(hi,lo)
 *
 * @brief Macro for mask
 */
#define MASK(hi,lo)                    (((1 << (1 + ((hi) - (lo)))) - 1) << (lo))

/**
 * @def BITS(x,hi,lo)
 *
 * @brief Macro for bits
 */
#define BITS(x,hi,lo)                  (((x) & MASK(hi,lo)) >> (lo))

/**
 * @def IX_ETHNPE_QM_Q_RXENET_LENGTH_MASK
 *
 * @brief QMgr Queue LENGTH field mask
 */
#define IX_ETHNPE_QM_Q_RXENET_LENGTH_MASK   0x3fff

/**
 * @def IX_ETHNPE_QM_Q_FIELD_FLAG_R
 *
 * @brief QMgr Queue FLAG field right boundary
 */
#define IX_ETHNPE_QM_Q_FIELD_FLAG_R             20

/**
 * @def IX_ETHNPE_QM_Q_FIELD_FLAG_MASK
 *
 * @brief QMgr Queue FLAG field mask
 *
 * Multicast bit : BIT(4)
 * Broadcast bit : BIT(5)
 * IP bit        : BIT(6) (linux only)
 *
 */
#ifdef __vxworks
#define IX_ETHNPE_QM_Q_FIELD_FLAG_MASK           0x30
#else
#define IX_ETHNPE_QM_Q_FIELD_FLAG_MASK           0x70
#endif


/**
 * @def IX_ETHNPE_QM_Q_FIELD_NPEID_L
 *
 * @brief QMgr Queue NPE ID field left boundary
 */
#define IX_ETHNPE_QM_Q_FIELD_NPEID_L            1

/**
 * @def IX_ETHNPE_QM_Q_FIELD_NPEID_R
 *
 * @brief QMgr Queue NPE ID field right boundary
 */
#define IX_ETHNPE_QM_Q_FIELD_NPEID_R            0

/**
 * @def IX_ETHNPE_QM_Q_FIELD_PRIOR_L
 *
 * @brief QMgr Queue Priority field left boundary
 */
#define IX_ETHNPE_QM_Q_FIELD_PRIOR_L            2

/**
 * @def IX_ETHNPE_QM_Q_FIELD_PRIOR_R
 *
 * @brief QMgr Queue Priority field right boundary
 */
#define IX_ETHNPE_QM_Q_FIELD_PRIOR_R            0

/**
 * @def IX_ETHNPE_QM_Q_FIELD_ADDR_L 
 *
 * @brief QMgr Queue Address field left boundary
 */
#define IX_ETHNPE_QM_Q_FIELD_ADDR_L             31

/**
 * @def IX_ETHNPE_QM_Q_FIELD_ADDR_R
 *
 * @brief QMgr Queue Address field right boundary
 */
#define IX_ETHNPE_QM_Q_FIELD_ADDR_R              5

/*--------------------------------------------------------------------------
 * Queue Manager Queue entry bit field masks
 *------------------------------------------------------------------------*/

/**
 * @def IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK 
 *
 * @brief Macro to mask the Address field of the FreeEnet Queue Manager Entry
 */
#define IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK \
            MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
                  IX_ETHNPE_QM_Q_FIELD_ADDR_R)

/**
 * @def IX_ETHNPE_QM_Q_RXENET_NPEID_MASK  
 *
 * @brief Macro to mask the NPE ID field of the RxEnet Queue Manager Entry
 */
#define IX_ETHNPE_QM_Q_RXENET_NPEID_MASK \
            MASK (IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
                  IX_ETHNPE_QM_Q_FIELD_NPEID_R)

/**
 * @def IX_ETHNPE_QM_Q_RXENET_ADDR_MASK 
 *
 * @brief Macro to mask the Mbuf Address field of the RxEnet Queue Manager Entry
 */
#define IX_ETHNPE_QM_Q_RXENET_ADDR_MASK \
            MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
                  IX_ETHNPE_QM_Q_FIELD_ADDR_R)

/**
 * @def IX_ETHNPE_QM_Q_TXENET_PRIOR_MASK
 *
 * @brief Macro to mask the Priority field of the TxEnet Queue Manager Entry
 */
#define IX_ETHNPE_QM_Q_TXENET_PRIOR_MASK \
            MASK (IX_ETHNPE_QM_Q_FIELD_PRIOR_L, \
                  IX_ETHNPE_QM_Q_FIELD_PRIOR_R)

/**
 * @def IX_ETHNPE_QM_Q_TXENET_ADDR_MASK 
 *
 * @brief Macro to mask the Mbuf Address field of the TxEnet Queue Manager Entry
 */
#define IX_ETHNPE_QM_Q_TXENET_ADDR_MASK \
            MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
                  IX_ETHNPE_QM_Q_FIELD_ADDR_R)

/**
 * @def IX_ETHNPE_QM_Q_TXENETDONE_NPEID_MASK 
 *
 * @brief Macro to mask the NPE ID field of the TxEnetDone Queue Manager Entry
 */
#define IX_ETHNPE_QM_Q_TXENETDONE_NPEID_MASK \
            MASK (IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
                  IX_ETHNPE_QM_Q_FIELD_NPEID_R)

/**
 * @def IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK 
 * 
 * @brief Macro to mask the Mbuf Address field of the TxEnetDone Queue Manager 
 * Entry
 */
#define IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK \
            MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
                  IX_ETHNPE_QM_Q_FIELD_ADDR_R)

/*--------------------------------------------------------------------------
 * Queue Manager Queue entry bit field value extraction macros
 *------------------------------------------------------------------------*/

/**
 * @def IX_ETHNPE_QM_Q_FREEENET_ADDR_VAL(x)
 *
 * @brief Extraction macro for Address field of FreeNet Queue Manager Entry 
 *
 * Pointer to an mbuf buffer descriptor
 */
#define IX_ETHNPE_QM_Q_FREEENET_ADDR_VAL(x) \
            ((x) & IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK)

/**
 * @def IX_ETHNPE_QM_Q_RXENET_NPEID_VAL(x)
 *
 * @brief Extraction macro for NPE ID field of RxEnet Queue Manager Entry 
 *
 * Set to 0 for entries originating from the Eth0 NPE; 
 * Set to 1 for entries originating from the Eth1 NPE.
 */
#define IX_ETHNPE_QM_Q_RXENET_NPEID_VAL(x) \
            BITS (x, IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
                     IX_ETHNPE_QM_Q_FIELD_NPEID_R)

/**
 * @def IX_ETHNPE_QM_Q_RXENET_PORTID_VAL(x)
 *
 * @brief Extraction macro for Port ID field of RxEnet Queue Manager Entry 
 *
 * 0-5: Assignable (by the XScale client) to any of the physical ports.
 * 6: It is reserved
 * 7: Indication that the NPE did not find the associated frame's destination MAC address within 
 * its internal filtering database.
 */
#define IX_ETHNPE_QM_Q_RXENET_PORTID_VAL(x) \
            BITS (x, IX_ETHNPE_QM_Q_FIELD_PORTID_L, \
                     IX_ETHNPE_QM_Q_Field_PortID_R)

/**
 * @def IX_ETHNPE_QM_Q_RXENET_ADDR_VAL(x)
 *
 * @brief Extraction macro for Address field of RxEnet Queue Manager Entry
 *
 * Pointer to an mbuf buffer descriptor
 */
#define IX_ETHNPE_QM_Q_RXENET_ADDR_VAL(x) \
            ((x) & IX_ETHNPE_QM_Q_RXENET_ADDR_MASK)

/**
 * @def IX_ETHNPE_QM_Q_TXENET_PRIOR_VAL(x)
 *
 * @brief Extraction macro for Priority field of TxEnet Queue Manager Entry
 *
 * Priority of the packet (as described in IEEE 802.1D). This field is
 * cleared upon return from the Ethernet NPE to the TxEnetDone queue.
 */
#define IX_ETHNPE_QM_Q_TXENET_PRIOR_VAL(x) \
            BITS (x, IX_ETHNPE_QM_Q_FIELD_PRIOR_L, \
                     IX_ETHNPE_QM_Q_FIELD_PRIOR_R)

/**
 * @def IX_ETHNPE_QM_Q_TXENET_ADDR_VAL(x)
 *
 * @brief Extraction macro for Address field of Queue Manager TxEnet Queue 
 * Manager Entry
 *
 * Pointer to an mbuf buffer descriptor
 */
#define IX_ETHNPE_QM_Q_TXENET_ADDR_VAL(x) \
            ((x) & IX_ETHNPE_QM_Q_TXENET_ADDR_MASK)

/**
 * @def IX_ETHNPE_QM_Q_TXENETDONE_NPEID_VAL(x)
 *
 * @brief Extraction macro for NPE ID field of TxEnetDone Queue Manager Entry
 *
 * Set to 0 for entries originating from the Eth0 NPE; set to 1 for en-tries 
 * originating from the Eth1 NPE.
 */
#define IX_ETHNPE_QM_Q_TXENETDONE_NPEID_VAL(x) \
            BITS (x, IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
                     IX_ETHNPE_QM_Q_FIELD_NPEID_R)

/**
 * @def IX_ETHNPE_QM_Q_TXENETDONE_ADDR_VAL(x)
 *
 * @brief Extraction macro for Address field of TxEnetDone Queue Manager Entry
 *
 * Pointer to an mbuf buffer descriptor
 */
#define IX_ETHNPE_QM_Q_TXENETDONE_ADDR_VAL(x) \
            ((x) & IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK)


/*--------------------------------------------------------------------------
 * NPE limits
 *------------------------------------------------------------------------*/

/**
 * @def IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN
 * 
 * @brief Macro to check the minimum length of a rx free buffer
 */
#define IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN (64)

/**
 * @def IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK
 * 
 * @brief Mask to apply to the mbuf length before submitting it to the NPE
 * (the NPE handles only rx free mbufs which are multiple of 64)
 * 
 * @sa IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK
 */
#define IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK (~63)

/**
 * @def IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_UP(size)
 * 
 * @brief  Round up to get the size necessary to receive without chaining
 * the frames which are (size) bytes (the NPE operates by multiple of 64)
 * e.g. To receive 1514 bytes frames, the size of the buffers in replenish
 * has to be at least (1514+63)&(~63) = 1536 bytes.
 *
 */
#define IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_UP(size) (((size) + 63) & ~63)

/**
 * @def IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_DOWN(size)
 *
 * @brief Round down to apply to the mbuf length before submitting
 * it to the NPE. (the NPE operates by multiple of 64)
 *
 */
#define IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_DOWN(size) ((size) & ~63)

/**
 * @def IX_ETHNPE_ACC_FRAME_LENGTH_MAX
 * 
 * @brief maximum mbuf length supported by the NPE
 * 
 * @sa IX_ETHNPE_ACC_FRAME_LENGTH_MAX
 */
#define IX_ETHNPE_ACC_FRAME_LENGTH_MAX (16320)

/**
 * @def IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT
 * 
 * @brief default mbuf length supported by the NPE
 * 
 * @sa IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT
 */
#define IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT (1522)

/**
 * @def IX_ETHNPE_ACC_LENGTH_OFFSET
 *
 * @brief Offset of the cluster length field in the word shared with the NPEs
 */
#define IX_ETHNPE_ACC_LENGTH_OFFSET 16

/**
 * @def IX_ETHNPE_ACC_PKTLENGTH_MASK
 *
 * @brief Mask of the cluster length field in the word shared with the NPEs
 */
#define IX_ETHNPE_ACC_PKTLENGTH_MASK 0x3fff


/**
 *@}
 */

#endif /* __doxygen_HIDE */