Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame^] | 1 | /* QLogic qed NIC Driver |
| 2 | * Copyright (c) 2015 QLogic Corporation |
| 3 | * |
| 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 |
| 6 | * this source tree. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _QED_DCBX_H |
| 10 | #define _QED_DCBX_H |
| 11 | #include <linux/types.h> |
| 12 | #include <linux/slab.h> |
| 13 | #include "qed.h" |
| 14 | #include "qed_hsi.h" |
| 15 | #include "qed_hw.h" |
| 16 | #include "qed_mcp.h" |
| 17 | #include "qed_reg_addr.h" |
| 18 | |
| 19 | #define DCBX_CONFIG_MAX_APP_PROTOCOL 4 |
| 20 | |
| 21 | enum qed_mib_read_type { |
| 22 | QED_DCBX_OPERATIONAL_MIB, |
| 23 | QED_DCBX_REMOTE_MIB, |
| 24 | QED_DCBX_LOCAL_MIB, |
| 25 | QED_DCBX_REMOTE_LLDP_MIB, |
| 26 | QED_DCBX_LOCAL_LLDP_MIB |
| 27 | }; |
| 28 | |
| 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 */ |
| 34 | }; |
| 35 | |
| 36 | struct qed_dcbx_results { |
| 37 | bool dcbx_enabled; |
| 38 | u8 pf_id; |
| 39 | struct qed_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE]; |
| 40 | }; |
| 41 | |
| 42 | struct qed_dcbx_app_metadata { |
| 43 | enum dcbx_protocol_type id; |
| 44 | char *name; |
| 45 | enum qed_pci_personality personality; |
| 46 | }; |
| 47 | |
| 48 | #define QED_MFW_GET_FIELD(name, field) \ |
| 49 | (((name) & (field ## _MASK)) >> (field ## _SHIFT)) |
| 50 | |
| 51 | struct qed_dcbx_info { |
| 52 | struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS]; |
| 53 | struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS]; |
| 54 | struct dcbx_local_params local_admin; |
| 55 | struct qed_dcbx_results results; |
| 56 | struct dcbx_mib operational; |
| 57 | struct dcbx_mib remote; |
| 58 | u8 dcbx_cap; |
| 59 | }; |
| 60 | |
| 61 | struct qed_dcbx_mib_meta_data { |
| 62 | struct lldp_config_params_s *lldp_local; |
| 63 | struct lldp_status_params_s *lldp_remote; |
| 64 | struct dcbx_local_params *local_admin; |
| 65 | struct dcbx_mib *mib; |
| 66 | size_t size; |
| 67 | u32 addr; |
| 68 | }; |
| 69 | |
| 70 | /* QED local interface routines */ |
| 71 | int |
| 72 | qed_dcbx_mib_update_event(struct qed_hwfn *, |
| 73 | struct qed_ptt *, enum qed_mib_read_type); |
| 74 | |
| 75 | int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn); |
| 76 | void qed_dcbx_info_free(struct qed_hwfn *, struct qed_dcbx_info *); |
| 77 | void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src, |
| 78 | struct pf_update_ramrod_data *p_dest); |
| 79 | |
| 80 | #endif |