1 #ifndef __doxygen_HIDE /* This file is not part of the API */
7 * IXP400 SW Release version 2.0
9 * -- Copyright Notice --
12 * Copyright 2001-2005, Intel Corporation.
13 * All rights reserved.
16 * SPDX-License-Identifier: BSD-3-Clause
18 * -- End of Copyright Notice --
22 * @defgroup IxEthNpe IXP400 Ethernet NPE (IxEthNpe) API
24 * @brief Contains the API for Ethernet NPE.
26 * All messages given to NPE, get back an acknowledgment. The acknowledgment
27 * is identical to the message sent to the NPE (except for NPE_GETSTATUS message).
33 /*--------------------------------------------------------------------------
34 * APB Message IDs - XScale->NPE
35 *------------------------------------------------------------------------*/
38 * @def IX_ETHNPE_NPE_GETSTATUS
40 * @brief Request from the XScale client for the NPE to return the firmware
41 * version of the currently executing image.
43 * Acknowledgment message id is same as the request message id.
44 * NPE returns the firmware version ID to XScale.
46 #define IX_ETHNPE_NPE_GETSTATUS 0x00
49 * @def IX_ETHNPE_EDB_SETPORTADDRESS
51 * @brief Request from the XScale client for the NPE to set the Ethernet
52 * port's port ID and MAC address.
54 #define IX_ETHNPE_EDB_SETPORTADDRESS 0x01
57 * @def IX_ETHNPE_EDB_GETMACADDRESSDATABASE
59 * @brief Request from XScale client to the NPE requesting upload of
60 * Ethernet Filtering Database or Header Conversion Database from NPE's
61 * data memory to XScale accessible SDRAM.
63 #define IX_ETHNPE_EDB_GETMACADDRESSDATABASE 0x02
66 * @def IX_ETHNPE_EDB_SETMACADDRESSSDATABASE
68 * @brief Request from XScale client to the NPE requesting download of
69 * Ethernet Filtering Database or Header Conversion Database from SDRAM
70 * to the NPE's datamemory.
72 #define IX_ETHNPE_EDB_SETMACADDRESSSDATABASE 0x03
75 * @def IX_ETHNPE_GETSTATS
77 * @brief Request from the XScale client for the current MAC port statistics
78 * data to be written to the (empty) statistics structure and the specified
79 * location in externa memory.
81 #define IX_ETHNPE_GETSTATS 0x04
84 * @def IX_ETHNPE_RESETSTATS
86 * @brief Request from the XScale client to the NPE to reset all of its internal
87 * MAC port statistics state variables.
89 * As a side effect, this message entails an implicit request that the NPE
90 * write the current MAC port statistics into the MAC statistics structure
91 * at the specified location in external memory.
93 #define IX_ETHNPE_RESETSTATS 0x05
96 * @def IX_ETHNPE_SETMAXFRAMELENGTHS
98 * @brief Request from the XScale client to the NPE to configure maximum framelengths
99 * and block sizes in receive and transmit direction.
101 #define IX_ETHNPE_SETMAXFRAMELENGTHS 0x06
104 * @def IX_ETHNPE_VLAN_SETRXTAGMODE
106 * @brief Request from the XScale client to the NPE to configure VLAN frame type
107 * filtering and VLAN the tagging mode for the receiver.
109 #define IX_ETHNPE_VLAN_SETRXTAGMODE 0x07
112 * @def IX_ETHNPE_VLAN_SETDEFAULTRXVID
114 * @brief Request from the XScale client to the NPE to set receiver's default
115 * VLAN tag (PVID)and internal traffic class.
117 #define IX_ETHNPE_VLAN_SETDEFAULTRXVID 0x08
120 * @def IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY
122 * @brief Request from the XScale client to the NPE to configure VLAN Port
123 * membership and Tx tagging for 8 consecutive VLANID's.
125 #define IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY 0x09
128 * @def IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE
130 * @brief Request from the XScale client to the NPE to configure VLAN Port
131 * membership and Tx tagging for a range of VLANID's.
133 #define IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE 0x0A
136 * @def IX_ETHNPE_VLAN_SETRXQOSENTRY
138 * @brief Request from the XScale client to the NPE to map a user priority
139 * to QoS class and an AQM queue number.
141 #define IX_ETHNPE_VLAN_SETRXQOSENTRY 0x0B
144 * @def IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE
146 * @brief Request from the XScale client to the NPE to enable or disable
147 * portID extraction from VLAN-tagged frames for the specified port.
149 #define IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE 0x0C
152 * @def IX_ETHNPE_STP_SETBLOCKINGSTATE
154 * @brief Request from the XScale client to the NPE to block or unblock
155 * forwarding for spanning tree BPDUs.
157 #define IX_ETHNPE_STP_SETBLOCKINGSTATE 0x0D
160 * @def IX_ETHNPE_FW_SETFIREWALLMODE
162 * @brief Request from the XScale client to the NPE to configure firewall
163 * services modes of operation and/or download Ethernet Firewall Database from
166 #define IX_ETHNPE_FW_SETFIREWALLMODE 0x0E
169 * @def IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID
171 * @brief Request from the XScale client to the NPE to set global frame control
172 * and duration/ID field for the 802.3 to 802.11 protocol header conversion
175 #define IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID 0x0F
178 * @def IX_ETHNPE_PC_SETBBSID
180 * @brief Request from the XScale client to the NPE to set global BBSID field
181 * value for the 802.3 to 802.11 protocol header conversion service.
183 #define IX_ETHNPE_PC_SETBBSID 0x10
186 * @def IX_ETHNPE_PC_SETAPMACTABLE
188 * @brief Request from the XScale client to the NPE to update a block/section/
189 * range of the AP MAC Address Table.
191 #define IX_ETHNPE_PC_SETAPMACTABLE 0x11
194 * @def IX_ETHNPE_SETLOOPBACK_MODE
196 * @brief Turn on or off the NPE frame loopback.
198 #define IX_ETHNPE_SETLOOPBACK_MODE (0x12)
200 /*--------------------------------------------------------------------------
201 * APB Message IDs - NPE->XScale
202 *------------------------------------------------------------------------*/
205 * @def IX_ETHNPE_NPE_GETSTATUS_ACK
207 * @brief Acknowledgment to IX_ETHNPE_NPE_GETSTATUS message. NPE firmware version
208 * id is returned in the message.
210 #define IX_ETHNPE_NPE_GETSTATUS_ACK 0x00
213 * @def IX_ETHNPE_EDB_SETPORTADDRESS_ACK
215 * @brief Acknowledgment to IX_ETHNPE_EDB_SETPORTADDRESS message.
217 #define IX_ETHNPE_EDB_SETPORTADDRESS_ACK 0x01
220 * @def IX_ETHNPE_EDB_GETMACADDRESSDATABASE_ACK
222 * @brief Acknowledgment to IX_ETHNPE_EDB_GETMACADDRESSDATABASE message
224 #define IX_ETHNPE_EDB_GETMACADDRESSDATABASE_ACK 0x02
227 * @def IX_ETHNPE_EDB_SETMACADDRESSSDATABASE_ACK
229 * @brief Acknowledgment to IX_ETHNPE_EDB_SETMACADDRESSSDATABASE message.
231 #define IX_ETHNPE_EDB_SETMACADDRESSSDATABASE_ACK 0x03
234 * @def IX_ETHNPE_GETSTATS_ACK
236 * @brief Acknowledgment to IX_ETHNPE_GETSTATS message.
238 #define IX_ETHNPE_GETSTATS_ACK 0x04
241 * @def IX_ETHNPE_RESETSTATS_ACK
243 * @brief Acknowledgment to IX_ETHNPE_RESETSTATS message.
245 #define IX_ETHNPE_RESETSTATS_ACK 0x05
248 * @def IX_ETHNPE_SETMAXFRAMELENGTHS_ACK
250 * @brief Acknowledgment to IX_ETHNPE_SETMAXFRAMELENGTHS message.
252 #define IX_ETHNPE_SETMAXFRAMELENGTHS_ACK 0x06
255 * @def IX_ETHNPE_VLAN_SETRXTAGMODE_ACK
257 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETRXTAGMODE message.
259 #define IX_ETHNPE_VLAN_SETRXTAGMODE_ACK 0x07
262 * @def IX_ETHNPE_VLAN_SETDEFAULTRXVID_ACK
264 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETDEFAULTRXVID message.
266 #define IX_ETHNPE_VLAN_SETDEFAULTRXVID_ACK 0x08
269 * @def IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY_ACK
271 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY message.
273 #define IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY_ACK 0x09
276 * @def IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE_ACK
278 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE message.
280 #define IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE_ACK 0x0A
283 * @def IX_ETHNPE_VLAN_SETRXQOSENTRY_ACK
285 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETRXQOSENTRY message.
287 #define IX_ETHNPE_VLAN_SETRXQOSENTRY_ACK 0x0B
290 * @def IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE_ACK
292 * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE message.
294 #define IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE_ACK 0x0C
297 * @def IX_ETHNPE_STP_SETBLOCKINGSTATE_ACK
299 * @brief Acknowledgment to IX_ETHNPE_STP_SETBLOCKINGSTATE message.
301 #define IX_ETHNPE_STP_SETBLOCKINGSTATE_ACK 0x0D
304 * @def IX_ETHNPE_FW_SETFIREWALLMODE_ACK
306 * @brief Acknowledgment to IX_ETHNPE_FW_SETFIREWALLMODE message.
308 #define IX_ETHNPE_FW_SETFIREWALLMODE_ACK 0x0E
311 * @def IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID_ACK
313 * @brief Acknowledgment to IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID message.
315 #define IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID_ACK 0x0F
318 * @def IX_ETHNPE_PC_SETBBSID_ACK
320 * @brief Acknowledgment to IX_ETHNPE_PC_SETBBSID message.
322 #define IX_ETHNPE_PC_SETBBSID_ACK 0x10
325 * @def IX_ETHNPE_PC_SETAPMACTABLE_ACK
327 * @brief Acknowledgment to IX_ETHNPE_PC_SETAPMACTABLE message.
329 #define IX_ETHNPE_PC_SETAPMACTABLE_ACK 0x11
332 * @def IX_ETHNPE_SETLOOPBACK_MODE_ACK
334 * @brief Acknowledgment to IX_ETHNPE_SETLOOPBACK_MODE message.
336 #define IX_ETHNPE_SETLOOPBACK_MODE_ACK (0x12)
338 /*--------------------------------------------------------------------------
339 * Queue Manager Queue entry bit field boundary definitions
340 *------------------------------------------------------------------------*/
345 * @brief Macro for mask
347 #define MASK(hi,lo) (((1 << (1 + ((hi) - (lo)))) - 1) << (lo))
352 * @brief Macro for bits
354 #define BITS(x,hi,lo) (((x) & MASK(hi,lo)) >> (lo))
357 * @def IX_ETHNPE_QM_Q_RXENET_LENGTH_MASK
359 * @brief QMgr Queue LENGTH field mask
361 #define IX_ETHNPE_QM_Q_RXENET_LENGTH_MASK 0x3fff
364 * @def IX_ETHNPE_QM_Q_FIELD_FLAG_R
366 * @brief QMgr Queue FLAG field right boundary
368 #define IX_ETHNPE_QM_Q_FIELD_FLAG_R 20
371 * @def IX_ETHNPE_QM_Q_FIELD_FLAG_MASK
373 * @brief QMgr Queue FLAG field mask
375 * Multicast bit : BIT(4)
376 * Broadcast bit : BIT(5)
377 * IP bit : BIT(6) (linux only)
381 #define IX_ETHNPE_QM_Q_FIELD_FLAG_MASK 0x30
383 #define IX_ETHNPE_QM_Q_FIELD_FLAG_MASK 0x70
388 * @def IX_ETHNPE_QM_Q_FIELD_NPEID_L
390 * @brief QMgr Queue NPE ID field left boundary
392 #define IX_ETHNPE_QM_Q_FIELD_NPEID_L 1
395 * @def IX_ETHNPE_QM_Q_FIELD_NPEID_R
397 * @brief QMgr Queue NPE ID field right boundary
399 #define IX_ETHNPE_QM_Q_FIELD_NPEID_R 0
402 * @def IX_ETHNPE_QM_Q_FIELD_PRIOR_L
404 * @brief QMgr Queue Priority field left boundary
406 #define IX_ETHNPE_QM_Q_FIELD_PRIOR_L 2
409 * @def IX_ETHNPE_QM_Q_FIELD_PRIOR_R
411 * @brief QMgr Queue Priority field right boundary
413 #define IX_ETHNPE_QM_Q_FIELD_PRIOR_R 0
416 * @def IX_ETHNPE_QM_Q_FIELD_ADDR_L
418 * @brief QMgr Queue Address field left boundary
420 #define IX_ETHNPE_QM_Q_FIELD_ADDR_L 31
423 * @def IX_ETHNPE_QM_Q_FIELD_ADDR_R
425 * @brief QMgr Queue Address field right boundary
427 #define IX_ETHNPE_QM_Q_FIELD_ADDR_R 5
429 /*--------------------------------------------------------------------------
430 * Queue Manager Queue entry bit field masks
431 *------------------------------------------------------------------------*/
434 * @def IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK
436 * @brief Macro to mask the Address field of the FreeEnet Queue Manager Entry
438 #define IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK \
439 MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
440 IX_ETHNPE_QM_Q_FIELD_ADDR_R)
443 * @def IX_ETHNPE_QM_Q_RXENET_NPEID_MASK
445 * @brief Macro to mask the NPE ID field of the RxEnet Queue Manager Entry
447 #define IX_ETHNPE_QM_Q_RXENET_NPEID_MASK \
448 MASK (IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
449 IX_ETHNPE_QM_Q_FIELD_NPEID_R)
452 * @def IX_ETHNPE_QM_Q_RXENET_ADDR_MASK
454 * @brief Macro to mask the Mbuf Address field of the RxEnet Queue Manager Entry
456 #define IX_ETHNPE_QM_Q_RXENET_ADDR_MASK \
457 MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
458 IX_ETHNPE_QM_Q_FIELD_ADDR_R)
461 * @def IX_ETHNPE_QM_Q_TXENET_PRIOR_MASK
463 * @brief Macro to mask the Priority field of the TxEnet Queue Manager Entry
465 #define IX_ETHNPE_QM_Q_TXENET_PRIOR_MASK \
466 MASK (IX_ETHNPE_QM_Q_FIELD_PRIOR_L, \
467 IX_ETHNPE_QM_Q_FIELD_PRIOR_R)
470 * @def IX_ETHNPE_QM_Q_TXENET_ADDR_MASK
472 * @brief Macro to mask the Mbuf Address field of the TxEnet Queue Manager Entry
474 #define IX_ETHNPE_QM_Q_TXENET_ADDR_MASK \
475 MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
476 IX_ETHNPE_QM_Q_FIELD_ADDR_R)
479 * @def IX_ETHNPE_QM_Q_TXENETDONE_NPEID_MASK
481 * @brief Macro to mask the NPE ID field of the TxEnetDone Queue Manager Entry
483 #define IX_ETHNPE_QM_Q_TXENETDONE_NPEID_MASK \
484 MASK (IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
485 IX_ETHNPE_QM_Q_FIELD_NPEID_R)
488 * @def IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK
490 * @brief Macro to mask the Mbuf Address field of the TxEnetDone Queue Manager
493 #define IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK \
494 MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
495 IX_ETHNPE_QM_Q_FIELD_ADDR_R)
497 /*--------------------------------------------------------------------------
498 * Queue Manager Queue entry bit field value extraction macros
499 *------------------------------------------------------------------------*/
502 * @def IX_ETHNPE_QM_Q_FREEENET_ADDR_VAL(x)
504 * @brief Extraction macro for Address field of FreeNet Queue Manager Entry
506 * Pointer to an mbuf buffer descriptor
508 #define IX_ETHNPE_QM_Q_FREEENET_ADDR_VAL(x) \
509 ((x) & IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK)
512 * @def IX_ETHNPE_QM_Q_RXENET_NPEID_VAL(x)
514 * @brief Extraction macro for NPE ID field of RxEnet Queue Manager Entry
516 * Set to 0 for entries originating from the Eth0 NPE;
517 * Set to 1 for entries originating from the Eth1 NPE.
519 #define IX_ETHNPE_QM_Q_RXENET_NPEID_VAL(x) \
520 BITS (x, IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
521 IX_ETHNPE_QM_Q_FIELD_NPEID_R)
524 * @def IX_ETHNPE_QM_Q_RXENET_PORTID_VAL(x)
526 * @brief Extraction macro for Port ID field of RxEnet Queue Manager Entry
528 * 0-5: Assignable (by the XScale client) to any of the physical ports.
530 * 7: Indication that the NPE did not find the associated frame's destination MAC address within
531 * its internal filtering database.
533 #define IX_ETHNPE_QM_Q_RXENET_PORTID_VAL(x) \
534 BITS (x, IX_ETHNPE_QM_Q_FIELD_PORTID_L, \
535 IX_ETHNPE_QM_Q_Field_PortID_R)
538 * @def IX_ETHNPE_QM_Q_RXENET_ADDR_VAL(x)
540 * @brief Extraction macro for Address field of RxEnet Queue Manager Entry
542 * Pointer to an mbuf buffer descriptor
544 #define IX_ETHNPE_QM_Q_RXENET_ADDR_VAL(x) \
545 ((x) & IX_ETHNPE_QM_Q_RXENET_ADDR_MASK)
548 * @def IX_ETHNPE_QM_Q_TXENET_PRIOR_VAL(x)
550 * @brief Extraction macro for Priority field of TxEnet Queue Manager Entry
552 * Priority of the packet (as described in IEEE 802.1D). This field is
553 * cleared upon return from the Ethernet NPE to the TxEnetDone queue.
555 #define IX_ETHNPE_QM_Q_TXENET_PRIOR_VAL(x) \
556 BITS (x, IX_ETHNPE_QM_Q_FIELD_PRIOR_L, \
557 IX_ETHNPE_QM_Q_FIELD_PRIOR_R)
560 * @def IX_ETHNPE_QM_Q_TXENET_ADDR_VAL(x)
562 * @brief Extraction macro for Address field of Queue Manager TxEnet Queue
565 * Pointer to an mbuf buffer descriptor
567 #define IX_ETHNPE_QM_Q_TXENET_ADDR_VAL(x) \
568 ((x) & IX_ETHNPE_QM_Q_TXENET_ADDR_MASK)
571 * @def IX_ETHNPE_QM_Q_TXENETDONE_NPEID_VAL(x)
573 * @brief Extraction macro for NPE ID field of TxEnetDone Queue Manager Entry
575 * Set to 0 for entries originating from the Eth0 NPE; set to 1 for en-tries
576 * originating from the Eth1 NPE.
578 #define IX_ETHNPE_QM_Q_TXENETDONE_NPEID_VAL(x) \
579 BITS (x, IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
580 IX_ETHNPE_QM_Q_FIELD_NPEID_R)
583 * @def IX_ETHNPE_QM_Q_TXENETDONE_ADDR_VAL(x)
585 * @brief Extraction macro for Address field of TxEnetDone Queue Manager Entry
587 * Pointer to an mbuf buffer descriptor
589 #define IX_ETHNPE_QM_Q_TXENETDONE_ADDR_VAL(x) \
590 ((x) & IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK)
593 /*--------------------------------------------------------------------------
595 *------------------------------------------------------------------------*/
598 * @def IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN
600 * @brief Macro to check the minimum length of a rx free buffer
602 #define IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN (64)
605 * @def IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK
607 * @brief Mask to apply to the mbuf length before submitting it to the NPE
608 * (the NPE handles only rx free mbufs which are multiple of 64)
610 * @sa IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK
612 #define IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK (~63)
615 * @def IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_UP(size)
617 * @brief Round up to get the size necessary to receive without chaining
618 * the frames which are (size) bytes (the NPE operates by multiple of 64)
619 * e.g. To receive 1514 bytes frames, the size of the buffers in replenish
620 * has to be at least (1514+63)&(~63) = 1536 bytes.
623 #define IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_UP(size) (((size) + 63) & ~63)
626 * @def IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_DOWN(size)
628 * @brief Round down to apply to the mbuf length before submitting
629 * it to the NPE. (the NPE operates by multiple of 64)
632 #define IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_DOWN(size) ((size) & ~63)
635 * @def IX_ETHNPE_ACC_FRAME_LENGTH_MAX
637 * @brief maximum mbuf length supported by the NPE
639 * @sa IX_ETHNPE_ACC_FRAME_LENGTH_MAX
641 #define IX_ETHNPE_ACC_FRAME_LENGTH_MAX (16320)
644 * @def IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT
646 * @brief default mbuf length supported by the NPE
648 * @sa IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT
650 #define IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT (1522)
653 * @def IX_ETHNPE_ACC_LENGTH_OFFSET
655 * @brief Offset of the cluster length field in the word shared with the NPEs
657 #define IX_ETHNPE_ACC_LENGTH_OFFSET 16
660 * @def IX_ETHNPE_ACC_PKTLENGTH_MASK
662 * @brief Mask of the cluster length field in the word shared with the NPEs
664 #define IX_ETHNPE_ACC_PKTLENGTH_MASK 0x3fff
671 #endif /* __doxygen_HIDE */