0001
0002
0003
0004
0005
0006
0007 #ifndef _QED_DCBX_H
0008 #define _QED_DCBX_H
0009 #include <linux/types.h>
0010 #include <linux/slab.h>
0011 #include "qed.h"
0012 #include "qed_hsi.h"
0013 #include "qed_hw.h"
0014 #include "qed_mcp.h"
0015 #include "qed_reg_addr.h"
0016
0017 #define DCBX_CONFIG_MAX_APP_PROTOCOL 4
0018
0019 enum qed_mib_read_type {
0020 QED_DCBX_OPERATIONAL_MIB,
0021 QED_DCBX_REMOTE_MIB,
0022 QED_DCBX_LOCAL_MIB,
0023 QED_DCBX_REMOTE_LLDP_MIB,
0024 QED_DCBX_LOCAL_LLDP_MIB
0025 };
0026
0027 struct qed_dcbx_app_data {
0028 bool enable;
0029 u8 update;
0030 u8 priority;
0031 u8 tc;
0032 bool dont_add_vlan0;
0033 };
0034
0035 #define QED_DCBX_VERSION_DISABLED 0
0036 #define QED_DCBX_VERSION_IEEE 1
0037 #define QED_DCBX_VERSION_CEE 2
0038
0039 struct qed_dcbx_set {
0040 #define QED_DCBX_OVERRIDE_STATE BIT(0)
0041 #define QED_DCBX_OVERRIDE_PFC_CFG BIT(1)
0042 #define QED_DCBX_OVERRIDE_ETS_CFG BIT(2)
0043 #define QED_DCBX_OVERRIDE_APP_CFG BIT(3)
0044 #define QED_DCBX_OVERRIDE_DSCP_CFG BIT(4)
0045 u32 override_flags;
0046 bool enabled;
0047 struct qed_dcbx_admin_params config;
0048 u32 ver_num;
0049 };
0050
0051 struct qed_dcbx_results {
0052 bool dcbx_enabled;
0053 u8 pf_id;
0054 struct qed_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE];
0055 };
0056
0057 struct qed_dcbx_app_metadata {
0058 enum dcbx_protocol_type id;
0059 char *name;
0060 enum qed_pci_personality personality;
0061 };
0062
0063 struct qed_dcbx_info {
0064 struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS];
0065 struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS];
0066 struct dcbx_local_params local_admin;
0067 struct qed_dcbx_results results;
0068 struct dcbx_mib operational;
0069 struct dcbx_mib remote;
0070 struct qed_dcbx_set set;
0071 struct qed_dcbx_get get;
0072 u8 dcbx_cap;
0073 };
0074
0075 struct qed_dcbx_mib_meta_data {
0076 struct lldp_config_params_s *lldp_local;
0077 struct lldp_status_params_s *lldp_remote;
0078 struct dcbx_local_params *local_admin;
0079 struct dcbx_mib *mib;
0080 size_t size;
0081 u32 addr;
0082 };
0083
0084 extern const struct qed_eth_dcbnl_ops qed_dcbnl_ops_pass;
0085
0086 #ifdef CONFIG_DCB
0087 int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn,
0088 struct qed_dcbx_set *params);
0089
0090 int qed_dcbx_config_params(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
0091 struct qed_dcbx_set *params, bool hw_commit);
0092 #endif
0093
0094
0095 int
0096 qed_dcbx_mib_update_event(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
0097 enum qed_mib_read_type type);
0098
0099 int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn);
0100 void qed_dcbx_info_free(struct qed_hwfn *p_hwfn);
0101 void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
0102 struct pf_update_ramrod_data *p_dest);
0103
0104 #define QED_DCBX_DEFAULT_TC 0
0105
0106 u8 qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri);
0107 #endif