1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2013 - 2015 Intel Corporation
8 #include "fm10k_type.h"
9 #include "fm10k_common.h"
11 bool fm10k_glort_valid_pf(struct fm10k_hw *hw, u16 glort);
12 u16 fm10k_queues_per_pool(struct fm10k_hw *hw);
13 u16 fm10k_vf_queue_index(struct fm10k_hw *hw, u16 vf_idx);
15 enum fm10k_pf_tlv_msg_id_v1 {
16 FM10K_PF_MSG_ID_TEST = 0x000, /* msg ID reserved */
17 FM10K_PF_MSG_ID_XCAST_MODES = 0x001,
18 FM10K_PF_MSG_ID_UPDATE_MAC_FWD_RULE = 0x002,
19 FM10K_PF_MSG_ID_LPORT_MAP = 0x100,
20 FM10K_PF_MSG_ID_LPORT_CREATE = 0x200,
21 FM10K_PF_MSG_ID_LPORT_DELETE = 0x201,
22 FM10K_PF_MSG_ID_CONFIG = 0x300,
23 FM10K_PF_MSG_ID_UPDATE_PVID = 0x400,
24 FM10K_PF_MSG_ID_CREATE_FLOW_TABLE = 0x501,
25 FM10K_PF_MSG_ID_DELETE_FLOW_TABLE = 0x502,
26 FM10K_PF_MSG_ID_UPDATE_FLOW = 0x503,
27 FM10K_PF_MSG_ID_DELETE_FLOW = 0x504,
28 FM10K_PF_MSG_ID_SET_FLOW_STATE = 0x505,
29 FM10K_PF_MSG_ID_GET_1588_INFO = 0x506,
30 FM10K_PF_MSG_ID_1588_TIMESTAMP = 0x701,
31 FM10K_PF_MSG_ID_1588_CLOCK_OWNER = 0x702,
32 FM10K_PF_MSG_ID_MASTER_CLK_OFFSET = 0x703,
35 enum fm10k_pf_tlv_attr_id_v1 {
36 FM10K_PF_ATTR_ID_ERR = 0x00,
37 FM10K_PF_ATTR_ID_LPORT_MAP = 0x01,
38 FM10K_PF_ATTR_ID_XCAST_MODE = 0x02,
39 FM10K_PF_ATTR_ID_MAC_UPDATE = 0x03,
40 FM10K_PF_ATTR_ID_VLAN_UPDATE = 0x04,
41 FM10K_PF_ATTR_ID_CONFIG = 0x05,
42 FM10K_PF_ATTR_ID_CREATE_FLOW_TABLE = 0x06,
43 FM10K_PF_ATTR_ID_DELETE_FLOW_TABLE = 0x07,
44 FM10K_PF_ATTR_ID_UPDATE_FLOW = 0x08,
45 FM10K_PF_ATTR_ID_FLOW_STATE = 0x09,
46 FM10K_PF_ATTR_ID_FLOW_HANDLE = 0x0A,
47 FM10K_PF_ATTR_ID_DELETE_FLOW = 0x0B,
48 FM10K_PF_ATTR_ID_PORT = 0x0C,
49 FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D,
50 FM10K_PF_ATTR_ID_1588_TIMESTAMP = 0x10,
51 FM10K_PF_ATTR_ID_1588_CLOCK_OWNER = 0x12,
52 FM10K_PF_ATTR_ID_MASTER_CLK_OFFSET = 0x14,
55 #define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0
56 #define FM10K_MSG_LPORT_MAP_GLORT_SIZE 16
57 #define FM10K_MSG_LPORT_MAP_MASK_SHIFT 16
58 #define FM10K_MSG_LPORT_MAP_MASK_SIZE 16
60 #define FM10K_MSG_UPDATE_PVID_GLORT_SHIFT 0
61 #define FM10K_MSG_UPDATE_PVID_GLORT_SIZE 16
62 #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16
63 #define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16
65 #define FM10K_MSG_ERR_PEP_NOT_SCHEDULED 280
67 /* The following data structures are overlayed directly onto TLV mailbox
68 * messages, and must not break 4 byte alignment. Ensure the structures line
69 * up correctly as per their TLV definition.
77 struct fm10k_mac_update {
86 struct fm10k_global_table_data {
91 struct fm10k_swapi_error {
93 struct fm10k_global_table_data mac;
94 struct fm10k_global_table_data nexthop;
95 struct fm10k_global_table_data ffu;
98 struct fm10k_swapi_1588_timestamp {
105 struct fm10k_swapi_1588_clock_owner {
116 s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
117 extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
118 #define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
119 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
120 fm10k_lport_map_msg_attr, func)
121 extern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
122 #define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
123 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
124 fm10k_update_pvid_msg_attr, func)
126 s32 fm10k_msg_err_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
127 extern const struct fm10k_tlv_attr fm10k_err_msg_attr[];
128 #define FM10K_PF_MSG_ERR_HANDLER(msg, func) \
129 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func)
131 extern const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[];
132 #define FM10K_PF_MSG_1588_TIMESTAMP_HANDLER(func) \
133 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_TIMESTAMP, \
134 fm10k_1588_timestamp_msg_attr, func)
136 s32 fm10k_msg_1588_clock_owner_pf(struct fm10k_hw *, u32 **,
137 struct fm10k_mbx_info *);
138 extern const struct fm10k_tlv_attr fm10k_1588_clock_owner_attr[];
139 #define FM10K_PF_MSG_1588_CLOCK_OWNER_HANDLER(func) \
140 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_CLOCK_OWNER, \
141 fm10k_1588_clock_owner_attr, func)
143 extern const struct fm10k_tlv_attr fm10k_master_clk_offset_attr[];
144 #define FM10K_PF_MSG_MASTER_CLK_OFFSET_HANDLER(func) \
145 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_MASTER_CLK_OFFSET, \
146 fm10k_master_clk_offset_attr, func)
148 s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
149 s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
150 struct fm10k_mbx_info *);
151 s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
152 struct fm10k_mbx_info *);
153 #ifndef NO_DEFAULT_SRIOV_MSG_HANDLERS
154 extern const struct fm10k_msg_data fm10k_iov_msg_data_pf[];
157 s32 fm10k_init_ops_pf(struct fm10k_hw *hw);
159 void fm10k_update_hw_stats_pf(struct fm10k_hw *hw,
160 struct fm10k_hw_stats *stats);
162 void fm10k_rebind_hw_stats_pf(struct fm10k_hw *hw,
163 struct fm10k_hw_stats *stats);
164 #endif /* _FM10K_PF_H */