Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Linux network driver for QLogic BR-series Converged Network Adapter.
0004  */
0005 /*
0006  * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
0007  * Copyright (c) 2014-2015 QLogic Corporation
0008  * All rights reserved
0009  * www.qlogic.com
0010  */
0011 #ifndef __BFA_DEFS_CNA_H__
0012 #define __BFA_DEFS_CNA_H__
0013 
0014 #include "bfa_defs.h"
0015 
0016 /* FC physical port statistics. */
0017 struct bfa_port_fc_stats {
0018     u64 secs_reset; /*!< Seconds since stats is reset */
0019     u64 tx_frames;  /*!< Tx frames          */
0020     u64 tx_words;   /*!< Tx words           */
0021     u64 tx_lip;     /*!< Tx LIP         */
0022     u64 tx_nos;     /*!< Tx NOS         */
0023     u64 tx_ols;     /*!< Tx OLS         */
0024     u64 tx_lr;      /*!< Tx LR          */
0025     u64 tx_lrr;     /*!< Tx LRR         */
0026     u64 rx_frames;  /*!< Rx frames          */
0027     u64 rx_words;   /*!< Rx words           */
0028     u64 lip_count;  /*!< Rx LIP         */
0029     u64 nos_count;  /*!< Rx NOS         */
0030     u64 ols_count;  /*!< Rx OLS         */
0031     u64 lr_count;   /*!< Rx LR          */
0032     u64 lrr_count;  /*!< Rx LRR         */
0033     u64 invalid_crcs;   /*!< Rx CRC err frames      */
0034     u64 invalid_crc_gd_eof; /*!< Rx CRC err good EOF frames */
0035     u64 undersized_frm; /*!< Rx undersized frames   */
0036     u64 oversized_frm;  /*!< Rx oversized frames    */
0037     u64 bad_eof_frm;    /*!< Rx frames with bad EOF */
0038     u64 error_frames;   /*!< Errored frames     */
0039     u64 dropped_frames; /*!< Dropped frames     */
0040     u64 link_failures;  /*!< Link Failure (LF) count    */
0041     u64 loss_of_syncs;  /*!< Loss of sync count     */
0042     u64 loss_of_signals; /*!< Loss of signal count  */
0043     u64 primseq_errs;   /*!< Primitive sequence protocol err. */
0044     u64 bad_os_count;   /*!< Invalid ordered sets   */
0045     u64 err_enc_out;    /*!< Encoding err nonframe_8b10b */
0046     u64 err_enc;    /*!< Encoding err frame_8b10b   */
0047     u64 bbsc_frames_lost; /*!< Credit Recovery-Frames Lost  */
0048     u64 bbsc_credits_lost; /*!< Credit Recovery-Credits Lost */
0049     u64 bbsc_link_resets; /*!< Credit Recovery-Link Resets   */
0050 };
0051 
0052 /* Eth Physical Port statistics. */
0053 struct bfa_port_eth_stats {
0054     u64 secs_reset; /*!< Seconds since stats is reset */
0055     u64 frame_64;   /*!< Frames 64 bytes        */
0056     u64 frame_65_127;   /*!< Frames 65-127 bytes    */
0057     u64 frame_128_255;  /*!< Frames 128-255 bytes   */
0058     u64 frame_256_511;  /*!< Frames 256-511 bytes   */
0059     u64 frame_512_1023; /*!< Frames 512-1023 bytes  */
0060     u64 frame_1024_1518; /*!< Frames 1024-1518 bytes    */
0061     u64 frame_1519_1522; /*!< Frames 1519-1522 bytes    */
0062     u64 tx_bytes;   /*!< Tx bytes           */
0063     u64 tx_packets;  /*!< Tx packets        */
0064     u64 tx_mcast_packets; /*!< Tx multicast packets */
0065     u64 tx_bcast_packets; /*!< Tx broadcast packets */
0066     u64 tx_control_frame; /*!< Tx control frame     */
0067     u64 tx_drop;    /*!< Tx drops           */
0068     u64 tx_jabber;  /*!< Tx jabber          */
0069     u64 tx_fcs_error;   /*!< Tx FCS errors      */
0070     u64 tx_fragments;   /*!< Tx fragments       */
0071     u64 rx_bytes;   /*!< Rx bytes           */
0072     u64 rx_packets; /*!< Rx packets         */
0073     u64 rx_mcast_packets; /*!< Rx multicast packets */
0074     u64 rx_bcast_packets; /*!< Rx broadcast packets */
0075     u64 rx_control_frames; /*!< Rx control frames   */
0076     u64 rx_unknown_opcode; /*!< Rx unknown opcode   */
0077     u64 rx_drop;    /*!< Rx drops           */
0078     u64 rx_jabber;  /*!< Rx jabber          */
0079     u64 rx_fcs_error;   /*!< Rx FCS errors      */
0080     u64 rx_alignment_error; /*!< Rx alignment errors    */
0081     u64 rx_frame_length_error; /*!< Rx frame len errors */
0082     u64 rx_code_error;  /*!< Rx code errors     */
0083     u64 rx_fragments;   /*!< Rx fragments       */
0084     u64 rx_pause;   /*!< Rx pause           */
0085     u64 rx_zero_pause;  /*!< Rx zero pause      */
0086     u64 tx_pause;   /*!< Tx pause           */
0087     u64 tx_zero_pause;  /*!< Tx zero pause      */
0088     u64 rx_fcoe_pause;  /*!< Rx FCoE pause      */
0089     u64 rx_fcoe_zero_pause; /*!< Rx FCoE zero pause */
0090     u64 tx_fcoe_pause;  /*!< Tx FCoE pause      */
0091     u64 tx_fcoe_zero_pause; /*!< Tx FCoE zero pause */
0092     u64 rx_iscsi_pause; /*!< Rx iSCSI pause     */
0093     u64 rx_iscsi_zero_pause; /*!< Rx iSCSI zero pause   */
0094     u64 tx_iscsi_pause; /*!< Tx iSCSI pause     */
0095     u64 tx_iscsi_zero_pause; /*!< Tx iSCSI zero pause   */
0096 };
0097 
0098 /* Port statistics. */
0099 union bfa_port_stats_u {
0100     struct bfa_port_fc_stats fc;
0101     struct bfa_port_eth_stats eth;
0102 };
0103 
0104 #define BFA_CEE_LLDP_MAX_STRING_LEN (128)
0105 #define BFA_CEE_DCBX_MAX_PRIORITY   (8)
0106 #define BFA_CEE_DCBX_MAX_PGID       (8)
0107 
0108 #define BFA_CEE_LLDP_SYS_CAP_OTHER  0x0001
0109 #define BFA_CEE_LLDP_SYS_CAP_REPEATER   0x0002
0110 #define BFA_CEE_LLDP_SYS_CAP_MAC_BRIDGE 0x0004
0111 #define BFA_CEE_LLDP_SYS_CAP_WLAN_AP    0x0008
0112 #define BFA_CEE_LLDP_SYS_CAP_ROUTER 0x0010
0113 #define BFA_CEE_LLDP_SYS_CAP_TELEPHONE  0x0020
0114 #define BFA_CEE_LLDP_SYS_CAP_DOCSIS_CD  0x0040
0115 #define BFA_CEE_LLDP_SYS_CAP_STATION    0x0080
0116 #define BFA_CEE_LLDP_SYS_CAP_CVLAN  0x0100
0117 #define BFA_CEE_LLDP_SYS_CAP_SVLAN  0x0200
0118 #define BFA_CEE_LLDP_SYS_CAP_TPMR   0x0400
0119 
0120 /* LLDP string type */
0121 struct bfa_cee_lldp_str {
0122     u8 sub_type;
0123     u8 len;
0124     u8 rsvd[2];
0125     u8 value[BFA_CEE_LLDP_MAX_STRING_LEN];
0126 } __packed;
0127 
0128 /* LLDP parameters */
0129 struct bfa_cee_lldp_cfg {
0130     struct bfa_cee_lldp_str chassis_id;
0131     struct bfa_cee_lldp_str port_id;
0132     struct bfa_cee_lldp_str port_desc;
0133     struct bfa_cee_lldp_str sys_name;
0134     struct bfa_cee_lldp_str sys_desc;
0135     struct bfa_cee_lldp_str mgmt_addr;
0136     u16 time_to_live;
0137     u16 enabled_system_cap;
0138 } __packed;
0139 
0140 enum bfa_cee_dcbx_version {
0141     DCBX_PROTOCOL_PRECEE    = 1,
0142     DCBX_PROTOCOL_CEE   = 2,
0143 };
0144 
0145 enum bfa_cee_lls {
0146     /* LLS is down because the TLV not sent by the peer */
0147     CEE_LLS_DOWN_NO_TLV = 0,
0148     /* LLS is down as advertised by the peer */
0149     CEE_LLS_DOWN    = 1,
0150     CEE_LLS_UP  = 2,
0151 };
0152 
0153 /* CEE/DCBX parameters */
0154 struct bfa_cee_dcbx_cfg {
0155     u8 pgid[BFA_CEE_DCBX_MAX_PRIORITY];
0156     u8 pg_percentage[BFA_CEE_DCBX_MAX_PGID];
0157     u8 pfc_primap; /* bitmap of priorties with PFC enabled */
0158     u8 fcoe_primap; /* bitmap of priorities used for FcoE traffic */
0159     u8 iscsi_primap; /* bitmap of priorities used for iSCSI traffic */
0160     u8 dcbx_version; /* operating version:CEE or preCEE */
0161     u8 lls_fcoe; /* FCoE Logical Link Status */
0162     u8 lls_lan; /* LAN Logical Link Status */
0163     u8 rsvd[2];
0164 } __packed;
0165 
0166 /* CEE status */
0167 /* Making this to tri-state for the benefit of port list command */
0168 enum bfa_cee_status {
0169     CEE_UP = 0,
0170     CEE_PHY_UP = 1,
0171     CEE_LOOPBACK = 2,
0172     CEE_PHY_DOWN = 3,
0173 };
0174 
0175 /* CEE Query */
0176 struct bfa_cee_attr {
0177     u8  cee_status;
0178     u8 error_reason;
0179     struct bfa_cee_lldp_cfg lldp_remote;
0180     struct bfa_cee_dcbx_cfg dcbx_remote;
0181     u8 src_mac[ETH_ALEN];
0182     u8 link_speed;
0183     u8 nw_priority;
0184     u8 filler[2];
0185 } __packed;
0186 
0187 /* LLDP/DCBX/CEE Statistics */
0188 struct bfa_cee_stats {
0189     u32 lldp_tx_frames;     /*!< LLDP Tx Frames */
0190     u32 lldp_rx_frames;     /*!< LLDP Rx Frames */
0191     u32 lldp_rx_frames_invalid; /*!< LLDP Rx Frames invalid */
0192     u32 lldp_rx_frames_new; /*!< LLDP Rx Frames new */
0193     u32 lldp_tlvs_unrecognized; /*!< LLDP Rx unrecognized TLVs */
0194     u32 lldp_rx_shutdown_tlvs;  /*!< LLDP Rx shutdown TLVs */
0195     u32 lldp_info_aged_out; /*!< LLDP remote info aged out */
0196     u32 dcbx_phylink_ups;   /*!< DCBX phy link ups */
0197     u32 dcbx_phylink_downs; /*!< DCBX phy link downs */
0198     u32 dcbx_rx_tlvs;       /*!< DCBX Rx TLVs */
0199     u32 dcbx_rx_tlvs_invalid;   /*!< DCBX Rx TLVs invalid */
0200     u32 dcbx_control_tlv_error; /*!< DCBX control TLV errors */
0201     u32 dcbx_feature_tlv_error; /*!< DCBX feature TLV errors */
0202     u32 dcbx_cee_cfg_new;   /*!< DCBX new CEE cfg rcvd */
0203     u32 cee_status_down;    /*!< CEE status down */
0204     u32 cee_status_up;      /*!< CEE status up */
0205     u32 cee_hw_cfg_changed; /*!< CEE hw cfg changed */
0206     u32 cee_rx_invalid_cfg; /*!< CEE invalid cfg */
0207 } __packed;
0208 
0209 #endif  /* __BFA_DEFS_CNA_H__ */