Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 1 | /* QLogic qed NIC Driver |
Mintz, Yuval | e8f1cb5 | 2017-01-01 13:57:00 +0200 | [diff] [blame] | 2 | * Copyright (c) 2015-2017 QLogic Corporation |
Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 3 | * |
Mintz, Yuval | e8f1cb5 | 2017-01-01 13:57:00 +0200 | [diff] [blame] | 4 | * This software is available to you under a choice of one of two |
| 5 | * licenses. You may choose to be licensed under the terms of the GNU |
| 6 | * General Public License (GPL) Version 2, available from the file |
| 7 | * COPYING in the main directory of this source tree, or the |
| 8 | * OpenIB.org BSD license below: |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or |
| 11 | * without modification, are permitted provided that the following |
| 12 | * conditions are met: |
| 13 | * |
| 14 | * - Redistributions of source code must retain the above |
| 15 | * copyright notice, this list of conditions and the following |
| 16 | * disclaimer. |
| 17 | * |
| 18 | * - Redistributions in binary form must reproduce the above |
| 19 | * copyright notice, this list of conditions and the following |
| 20 | * disclaimer in the documentation and /or other materials |
| 21 | * provided with the distribution. |
| 22 | * |
| 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 30 | * SOFTWARE. |
Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | #ifndef _QED_DCBX_H |
| 34 | #define _QED_DCBX_H |
| 35 | #include <linux/types.h> |
| 36 | #include <linux/slab.h> |
| 37 | #include "qed.h" |
| 38 | #include "qed_hsi.h" |
| 39 | #include "qed_hw.h" |
| 40 | #include "qed_mcp.h" |
| 41 | #include "qed_reg_addr.h" |
| 42 | |
| 43 | #define DCBX_CONFIG_MAX_APP_PROTOCOL 4 |
| 44 | |
| 45 | enum qed_mib_read_type { |
| 46 | QED_DCBX_OPERATIONAL_MIB, |
| 47 | QED_DCBX_REMOTE_MIB, |
| 48 | QED_DCBX_LOCAL_MIB, |
| 49 | QED_DCBX_REMOTE_LLDP_MIB, |
| 50 | QED_DCBX_LOCAL_LLDP_MIB |
| 51 | }; |
| 52 | |
| 53 | struct qed_dcbx_app_data { |
| 54 | bool enable; /* DCB enabled */ |
Sudarsana Reddy Kalluru | dfc268f | 2017-05-29 09:53:06 +0300 | [diff] [blame] | 55 | u8 update; /* Update indication */ |
Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 56 | u8 priority; /* Priority */ |
| 57 | u8 tc; /* Traffic Class */ |
| 58 | }; |
| 59 | |
Sudarsana Reddy Kalluru | 6ad8c63 | 2016-06-08 06:22:10 -0400 | [diff] [blame] | 60 | #define QED_DCBX_VERSION_DISABLED 0 |
| 61 | #define QED_DCBX_VERSION_IEEE 1 |
| 62 | #define QED_DCBX_VERSION_CEE 2 |
| 63 | |
| 64 | struct qed_dcbx_set { |
| 65 | #define QED_DCBX_OVERRIDE_STATE BIT(0) |
| 66 | #define QED_DCBX_OVERRIDE_PFC_CFG BIT(1) |
| 67 | #define QED_DCBX_OVERRIDE_ETS_CFG BIT(2) |
| 68 | #define QED_DCBX_OVERRIDE_APP_CFG BIT(3) |
| 69 | #define QED_DCBX_OVERRIDE_DSCP_CFG BIT(4) |
| 70 | u32 override_flags; |
| 71 | bool enabled; |
| 72 | struct qed_dcbx_admin_params config; |
| 73 | u32 ver_num; |
| 74 | }; |
Sudarsana Reddy Kalluru | 6ad8c63 | 2016-06-08 06:22:10 -0400 | [diff] [blame] | 75 | |
Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 76 | struct qed_dcbx_results { |
| 77 | bool dcbx_enabled; |
| 78 | u8 pf_id; |
| 79 | struct qed_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE]; |
| 80 | }; |
| 81 | |
| 82 | struct qed_dcbx_app_metadata { |
| 83 | enum dcbx_protocol_type id; |
| 84 | char *name; |
| 85 | enum qed_pci_personality personality; |
| 86 | }; |
| 87 | |
Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 88 | struct qed_dcbx_info { |
| 89 | struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS]; |
| 90 | struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS]; |
| 91 | struct dcbx_local_params local_admin; |
| 92 | struct qed_dcbx_results results; |
| 93 | struct dcbx_mib operational; |
| 94 | struct dcbx_mib remote; |
Sudarsana Reddy Kalluru | 6ad8c63 | 2016-06-08 06:22:10 -0400 | [diff] [blame] | 95 | struct qed_dcbx_set set; |
Arun Easi | 1e128c8 | 2017-02-15 06:28:22 -0800 | [diff] [blame] | 96 | struct qed_dcbx_get get; |
Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 97 | u8 dcbx_cap; |
| 98 | }; |
| 99 | |
| 100 | struct qed_dcbx_mib_meta_data { |
| 101 | struct lldp_config_params_s *lldp_local; |
| 102 | struct lldp_status_params_s *lldp_remote; |
| 103 | struct dcbx_local_params *local_admin; |
| 104 | struct dcbx_mib *mib; |
| 105 | size_t size; |
| 106 | u32 addr; |
| 107 | }; |
| 108 | |
Sudarsana Reddy Kalluru | 6ad8c63 | 2016-06-08 06:22:10 -0400 | [diff] [blame] | 109 | #ifdef CONFIG_DCB |
| 110 | int qed_dcbx_get_config_params(struct qed_hwfn *, struct qed_dcbx_set *); |
| 111 | |
| 112 | int qed_dcbx_config_params(struct qed_hwfn *, |
| 113 | struct qed_ptt *, struct qed_dcbx_set *, bool); |
| 114 | #endif |
| 115 | |
Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 116 | /* QED local interface routines */ |
| 117 | int |
| 118 | qed_dcbx_mib_update_event(struct qed_hwfn *, |
| 119 | struct qed_ptt *, enum qed_mib_read_type); |
| 120 | |
| 121 | int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn); |
sudarsana.kalluru@cavium.com | 270837b | 2017-04-20 22:31:16 -0700 | [diff] [blame] | 122 | void qed_dcbx_info_free(struct qed_hwfn *p_hwfn); |
Sudarsana Reddy Kalluru | 39651ab | 2016-05-17 06:44:26 -0400 | [diff] [blame] | 123 | void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src, |
| 124 | struct pf_update_ramrod_data *p_dest); |
| 125 | |
| 126 | #endif |