1 /* QLogic qed NIC Driver
2 * Copyright (c) 2015 QLogic Corporation
4 * This software is available under the terms of the GNU General Public License
5 * (GPL) Version 2, available from the file COPYING in the main directory of
11 #include <linux/types.h>
12 #include <linux/slab.h>
17 #include "qed_reg_addr.h"
19 #define DCBX_CONFIG_MAX_APP_PROTOCOL 4
21 enum qed_mib_read_type {
22 QED_DCBX_OPERATIONAL_MIB,
25 QED_DCBX_REMOTE_LLDP_MIB,
26 QED_DCBX_LOCAL_LLDP_MIB
29 struct qed_dcbx_app_data {
30 bool enable; /* DCB enabled */
31 bool update; /* Update indication */
32 u8 priority; /* Priority */
33 u8 tc; /* Traffic Class */
37 #define QED_DCBX_VERSION_DISABLED 0
38 #define QED_DCBX_VERSION_IEEE 1
39 #define QED_DCBX_VERSION_CEE 2
42 #define QED_DCBX_OVERRIDE_STATE BIT(0)
43 #define QED_DCBX_OVERRIDE_PFC_CFG BIT(1)
44 #define QED_DCBX_OVERRIDE_ETS_CFG BIT(2)
45 #define QED_DCBX_OVERRIDE_APP_CFG BIT(3)
46 #define QED_DCBX_OVERRIDE_DSCP_CFG BIT(4)
49 struct qed_dcbx_admin_params config;
54 struct qed_dcbx_results {
57 struct qed_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE];
60 struct qed_dcbx_app_metadata {
61 enum dcbx_protocol_type id;
63 enum qed_pci_personality personality;
66 #define QED_MFW_GET_FIELD(name, field) \
67 (((name) & (field ## _MASK)) >> (field ## _SHIFT))
69 struct qed_dcbx_info {
70 struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS];
71 struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS];
72 struct dcbx_local_params local_admin;
73 struct qed_dcbx_results results;
74 struct dcbx_mib operational;
75 struct dcbx_mib remote;
77 struct qed_dcbx_set set;
82 struct qed_dcbx_mib_meta_data {
83 struct lldp_config_params_s *lldp_local;
84 struct lldp_status_params_s *lldp_remote;
85 struct dcbx_local_params *local_admin;
92 int qed_dcbx_get_config_params(struct qed_hwfn *, struct qed_dcbx_set *);
94 int qed_dcbx_config_params(struct qed_hwfn *,
95 struct qed_ptt *, struct qed_dcbx_set *, bool);
98 /* QED local interface routines */
100 qed_dcbx_mib_update_event(struct qed_hwfn *,
101 struct qed_ptt *, enum qed_mib_read_type);
103 int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn);
104 void qed_dcbx_info_free(struct qed_hwfn *, struct qed_dcbx_info *);
105 void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
106 struct pf_update_ramrod_data *p_dest);