aboutsummaryrefslogtreecommitdiffstats
path: root/cvmx-higig.h
diff options
context:
space:
mode:
Diffstat (limited to 'cvmx-higig.h')
-rw-r--r--cvmx-higig.h122
1 files changed, 66 insertions, 56 deletions
diff --git a/cvmx-higig.h b/cvmx-higig.h
index 87dd754feedf..426ca26602b5 100644
--- a/cvmx-higig.h
+++ b/cvmx-higig.h
@@ -1,5 +1,5 @@
/***********************license start***************
- * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
+ * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
* reserved.
*
*
@@ -15,7 +15,7 @@
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- * * Neither the name of Cavium Networks nor the names of
+ * * Neither the name of Cavium Inc. nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
@@ -26,7 +26,7 @@
* countries.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
- * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
+ * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
@@ -49,12 +49,14 @@
* Functions and typedefs for using Octeon in HiGig/HiGig+/HiGig2 mode over
* XAUI.
*
- * <hr>$Revision: 49448 $<hr>
+ * <hr>$Revision: 70030 $<hr>
*/
#ifndef __CVMX_HIGIG_H__
#define __CVMX_HIGIG_H__
#include "cvmx-wqe.h"
+#include "cvmx-helper.h"
+#include "cvmx-helper-util.h"
#ifdef __cplusplus
extern "C" {
@@ -68,20 +70,6 @@ typedef struct
struct
{
uint32_t start : 8; /**< 8-bits of Preamble indicating start of frame */
- uint32_t dst_modid_6 : 1; /**< This field is valid only if the HGI field is a b'10' and it represents Bit 6 of
- DST_MODID (bits 4:0 are in Byte 7 and bit 5 is in Byte 9). ). For HGI field
- value of b'01' this field should be b'1'. For all other values of HGI it is don't
- care. */
- uint32_t src_modid_6 : 1; /**< This field is valid only if the HGI field is a b'10' and it represents Bit 6 of
- SRC_MODID (bits 4:0 are in Byte 4 and bit 5 is in Byte 9). For HGI field
- value of b'01' this field should be b'0'. For all other values of HGI it is don't
- care. */
- uint32_t hdr_ext_len : 3; /**< This field is valid only if the HGI field is a b'10' and it indicates the extension
- to the standard 12-bytes of XGS HiGig header. Each unit represents 4
- bytes, giving a total of 16 additional extension bytes. Value of b'101', b'110'
- and b'111' are reserved. For HGI field value of b'01' this field should be
- b'01'. For all other values of HGI it is don't care. */
- uint32_t cng_high : 1; /**< Congestion Bit High flag */
uint32_t hgi : 2; /**< HiGig interface format indicator
00 = Reserved
01 = Pure preamble - IEEE standard framing of 10GE
@@ -89,6 +77,20 @@ typedef struct
format, the default length of the header is 12 bytes and additional
bytes are indicated by the HDR_EXT_LEN field
11 = Reserved */
+ uint32_t cng_high : 1; /**< Congestion Bit High flag */
+ uint32_t hdr_ext_len : 3; /**< This field is valid only if the HGI field is a b'10' and it indicates the extension
+ to the standard 12-bytes of XGS HiGig header. Each unit represents 4
+ bytes, giving a total of 16 additional extension bytes. Value of b'101', b'110'
+ and b'111' are reserved. For HGI field value of b'01' this field should be
+ b'01'. For all other values of HGI it is don't care. */
+ uint32_t src_modid_6 : 1; /**< This field is valid only if the HGI field is a b'10' and it represents Bit 6 of
+ SRC_MODID (bits 4:0 are in Byte 4 and bit 5 is in Byte 9). For HGI field
+ value of b'01' this field should be b'0'. For all other values of HGI it is don't
+ care. */
+ uint32_t dst_modid_6 : 1; /**< This field is valid only if the HGI field is a b'10' and it represents Bit 6 of
+ DST_MODID (bits 4:0 are in Byte 7 and bit 5 is in Byte 9). ). For HGI field
+ value of b'01' this field should be b'1'. For all other values of HGI it is don't
+ care. */
uint32_t vid_high : 8; /**< 8-bits of the VLAN tag information */
uint32_t vid_low : 8; /**< 8 bits LSB of the VLAN tag information */
} s;
@@ -98,6 +100,8 @@ typedef struct
uint32_t u32;
struct
{
+ uint32_t src_modid_low : 5; /**< Bits 4:0 of Module ID of the source module on which the packet ingress (bit
+ 5 is in Byte 9 and bit 6 Is in Byte 1) */
uint32_t opcode : 3; /**< XGS HiGig op-code, indicating the type of packet
000 = Control frames used for CPU to CPU communications
001 = Unicast packet with destination resolved; The packet can be
@@ -112,10 +116,6 @@ typedef struct
101 = Reserved
110 = Reserved
111 = Reserved */
- uint32_t src_modid_low : 5; /**< Bits 4:0 of Module ID of the source module on which the packet ingress (bit
- 5 is in Byte 9 and bit 6 Is in Byte 1) */
- uint32_t src_port_tgid : 6; /**< If the MSB of this field is set, then it indicates the LAG the packet ingressed
- on, else it represents the physical port the packet ingressed on. */
uint32_t pfm : 2; /**< Three Port Filtering Modes (0, 1, 2) used in handling registed/unregistered
multicast (unknown L2 multicast and IPMC) packets. This field is used
when OPCODE is 011 or 100 Semantics of PFM bits are as follows;
@@ -125,22 +125,24 @@ typedef struct
For unregistered L2 multicast packets:
PFM= 0 or 1 Flood to VLAN
PFM= 2 Drop the packet */
+ uint32_t src_port_tgid : 6; /**< If the MSB of this field is set, then it indicates the LAG the packet ingressed
+ on, else it represents the physical port the packet ingressed on. */
+ uint32_t dst_port : 5; /**< Port number of destination port on which the packet needs to egress. */
uint32_t priority : 3; /**< This is the internal priority of the packet. This internal priority will go through
COS_SEL mapping registers to map to the actual MMU queues. */
- uint32_t dst_port : 5; /**< Port number of destination port on which the packet needs to egress. */
- uint32_t dst_modid_low : 5; /**< Bits [4-: 0] of Module ID of the destination port on which the packet needs to egress. */
+ uint32_t header_type : 2; /**< Indicates the format of the next 4 bytes of the XGS HiGig header
+ 00 = Overlay 1 (default)
+ 01 = Overlay 2 (Classification Tag)
+ 10 = Reserved
+ 11 = Reserved */
uint32_t cng_low : 1; /**< Semantics of CNG_HIGH and CNG_LOW are as follows: The following
encodings are to make it backward compatible:
- {CNG_HIGH, CNG_LOW] - COLOR
+ [CNG_HIGH, CNG_LOW] - COLOR
[0, 0] Packet is green
[0, 1] Packet is red
[1, 1] Packet is yellow
[1, 0] Undefined */
- uint32_t header_type : 2; /**< Indicates the format of the next 4 bytes of the XGS HiGig header
- 00 = Overlay 1 (default)
- 01 = Overlay 2 (Classification Tag)
- 10 = Reserved
- 11 = Reserved */
+ uint32_t dst_modid_low : 5; /**< Bits [4-: 0] of Module ID of the destination port on which the packet needs to egress. */
} s;
} dw1;
union
@@ -148,26 +150,27 @@ typedef struct
uint32_t u32;
struct
{
- uint32_t mirror : 1; /**< Mirror: XGS3 mode: a mirror copy packet. XGS1/2 mode: Indicates that the
- packet was switched and only needs to be mirrored. */
- uint32_t mirror_done : 1; /**< Mirroring Done: XGS1/2 mode: Indicates that the packet was mirrored and
- may still need to be switched. */
- uint32_t mirror_only : 1; /**< Mirror Only: XGS 1/2 mode: Indicates that the packet was switched and only
- needs to be mirrored. */
- uint32_t ingress_tagged : 1; /**< Ingress Tagged: Indicates whether the packet was tagged when it originally
- ingressed the system. */
- uint32_t dst_tgid : 3; /**< Destination Trunk Group ID: Trunk group ID of the destination port. The
- DO_NOT_LEARN bit is overlaid on the second bit of this field. */
uint32_t dst_t : 1; /**< Destination Trunk: Indicates that the destination port is a member of a trunk
group. */
- uint32_t vc_label_16_19 : 4; /**< VC Label: Bits 19:16 of VC label: HiGig+ added field */
- uint32_t label_present : 1; /**< Label Present: Indicates that header contains a 20-bit VC label: HiGig+
- added field. */
- uint32_t l3 : 1; /**< L3: Indicates that the packet is L3 switched */
- uint32_t dst_modid_5 : 1; /**< Destination Module ID: Bit 5 of Dst_ModID (bits 4:0 are in byte 7 and bit 6
- is in byte 1) */
+ uint32_t dst_tgid : 3; /**< Destination Trunk Group ID: Trunk group ID of the destination port. The
+ DO_NOT_LEARN bit is overlaid on the second bit of this field. */
+ uint32_t ingress_tagged : 1; /**< Ingress Tagged: Indicates whether the packet was tagged when it originally
+ ingressed the system. */
+ uint32_t mirror_only : 1; /**< Mirror Only: XGS 1/2 mode: Indicates that the packet was switched and only
+ needs to be mirrored. */
+ uint32_t mirror_done : 1; /**< Mirroring Done: XGS1/2 mode: Indicates that the packet was mirrored and
+ may still need to be switched. */
+ uint32_t mirror : 1; /**< Mirror: XGS3 mode: a mirror copy packet. XGS1/2 mode: Indicates that the
+ packet was switched and only needs to be mirrored. */
+
uint32_t src_modid_5 : 1; /**< Source Module ID: Bit 5 of Src_ModID (bits 4:0 are in byte 4 and bit 6 is in
byte 1) */
+ uint32_t dst_modid_5 : 1; /**< Destination Module ID: Bit 5 of Dst_ModID (bits 4:0 are in byte 7 and bit 6
+ is in byte 1) */
+ uint32_t l3 : 1; /**< L3: Indicates that the packet is L3 switched */
+ uint32_t label_present : 1; /**< Label Present: Indicates that header contains a 20-bit VC label: HiGig+
+ added field. */
+ uint32_t vc_label_16_19 : 4; /**< VC Label: Bits 19:16 of VC label: HiGig+ added field */
uint32_t vc_label_0_15 : 16;/**< VC Label: Bits 15:0 of VC label: HiGig+ added field */
} o1;
struct
@@ -324,26 +327,33 @@ static inline int cvmx_higig_initialize(int interface, int enable_higig2)
cvmx_gmxx_tx_ovr_bp_t gmx_tx_ovr_bp;
cvmx_gmxx_rxx_frm_ctl_t gmx_rx_frm_ctl;
cvmx_gmxx_tx_xaui_ctl_t gmx_tx_xaui_ctl;
- int i;
+ int i, pknd;
int header_size = (enable_higig2) ? 16 : 12;
/* Setup PIP to handle HiGig */
- pip_prt_cfg.u64 = cvmx_read_csr(CVMX_PIP_PRT_CFGX(interface*16));
+ if (octeon_has_feature(OCTEON_FEATURE_PKND))
+ pknd = cvmx_helper_get_pknd(interface, 0);
+ else
+ pknd = interface*16;
+ pip_prt_cfg.u64 = cvmx_read_csr(CVMX_PIP_PRT_CFGX(pknd));
pip_prt_cfg.s.dsa_en = 0;
pip_prt_cfg.s.higig_en = 1;
pip_prt_cfg.s.hg_qos = 1;
pip_prt_cfg.s.skip = header_size;
- cvmx_write_csr(CVMX_PIP_PRT_CFGX(interface*16), pip_prt_cfg.u64);
+ cvmx_write_csr(CVMX_PIP_PRT_CFGX(pknd), pip_prt_cfg.u64);
/* Setup some sample QoS defaults. These can be changed later */
- for (i=0; i<64; i++)
+ if (!OCTEON_IS_MODEL(OCTEON_CN68XX))
{
- cvmx_pip_hg_pri_qos_t pip_hg_pri_qos;
- pip_hg_pri_qos.u64 = 0;
- pip_hg_pri_qos.s.up_qos = 1;
- pip_hg_pri_qos.s.pri = i;
- pip_hg_pri_qos.s.qos = i&7;
- cvmx_write_csr(CVMX_PIP_HG_PRI_QOS, pip_hg_pri_qos.u64);
+ for (i=0; i<64; i++)
+ {
+ cvmx_pip_hg_pri_qos_t pip_hg_pri_qos;
+ pip_hg_pri_qos.u64 = 0;
+ pip_hg_pri_qos.s.up_qos = 1;
+ pip_hg_pri_qos.s.pri = i;
+ pip_hg_pri_qos.s.qos = i&7;
+ cvmx_write_csr(CVMX_PIP_HG_PRI_QOS, pip_hg_pri_qos.u64);
+ }
}
/* Setup GMX RX to treat the HiGig header as user data to ignore */