diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2014-09-20 19:47:13 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-09-23 06:59:14 -0400 |
commit | 6b1f201f1a32cc88af405b07cc2cfd5dcc308df1 (patch) | |
tree | dc571f282fb7c18d56d78b6e299cd57172e3c4d0 /drivers/net/ethernet/intel/fm10k/fm10k_tlv.h | |
parent | 04a5aefbfb0109961e1bc3c84ecee00693f78005 (diff) |
fm10k: Add support for mailbox
This patch adds generic mailbox support. The general idea of the mailboxes
is to use a pair of ring buffers, one for request, one for response to send
data between the local driver and some remote entity be it the PF of the
Switch Manager.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/fm10k/fm10k_tlv.h')
-rw-r--r-- | drivers/net/ethernet/intel/fm10k/fm10k_tlv.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.h b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.h index 6d22db63d048..7e045e8bf1eb 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.h +++ b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.h | |||
@@ -21,6 +21,9 @@ | |||
21 | #ifndef _FM10K_TLV_H_ | 21 | #ifndef _FM10K_TLV_H_ |
22 | #define _FM10K_TLV_H_ | 22 | #define _FM10K_TLV_H_ |
23 | 23 | ||
24 | /* forward declaration */ | ||
25 | struct fm10k_msg_data; | ||
26 | |||
24 | #include "fm10k_type.h" | 27 | #include "fm10k_type.h" |
25 | 28 | ||
26 | /* Message / Argument header format | 29 | /* Message / Argument header format |
@@ -93,6 +96,15 @@ struct fm10k_tlv_attr { | |||
93 | #define FM10K_TLV_ATTR_NESTED(id) { id, FM10K_TLV_NESTED } | 96 | #define FM10K_TLV_ATTR_NESTED(id) { id, FM10K_TLV_NESTED } |
94 | #define FM10K_TLV_ATTR_LAST { FM10K_TLV_ERROR } | 97 | #define FM10K_TLV_ATTR_LAST { FM10K_TLV_ERROR } |
95 | 98 | ||
99 | struct fm10k_msg_data { | ||
100 | unsigned int id; | ||
101 | const struct fm10k_tlv_attr *attr; | ||
102 | s32 (*func)(struct fm10k_hw *, u32 **, | ||
103 | struct fm10k_mbx_info *); | ||
104 | }; | ||
105 | |||
106 | #define FM10K_MSG_HANDLER(id, attr, func) { id, attr, func } | ||
107 | |||
96 | s32 fm10k_tlv_msg_init(u32 *, u16); | 108 | s32 fm10k_tlv_msg_init(u32 *, u16); |
97 | s32 fm10k_tlv_attr_put_null_string(u32 *, u16, const unsigned char *); | 109 | s32 fm10k_tlv_attr_put_null_string(u32 *, u16, const unsigned char *); |
98 | s32 fm10k_tlv_attr_get_null_string(u32 *, unsigned char *); | 110 | s32 fm10k_tlv_attr_get_null_string(u32 *, unsigned char *); |
@@ -138,4 +150,37 @@ s32 fm10k_tlv_attr_get_le_struct(u32 *, void *, u32); | |||
138 | u32 *fm10k_tlv_attr_nest_start(u32 *, u16); | 150 | u32 *fm10k_tlv_attr_nest_start(u32 *, u16); |
139 | s32 fm10k_tlv_attr_nest_stop(u32 *); | 151 | s32 fm10k_tlv_attr_nest_stop(u32 *); |
140 | s32 fm10k_tlv_attr_parse(u32 *, u32 **, const struct fm10k_tlv_attr *); | 152 | s32 fm10k_tlv_attr_parse(u32 *, u32 **, const struct fm10k_tlv_attr *); |
153 | s32 fm10k_tlv_msg_parse(struct fm10k_hw *, u32 *, struct fm10k_mbx_info *, | ||
154 | const struct fm10k_msg_data *); | ||
155 | s32 fm10k_tlv_msg_error(struct fm10k_hw *hw, u32 **results, | ||
156 | struct fm10k_mbx_info *); | ||
157 | |||
158 | #define FM10K_TLV_MSG_ID_TEST 0 | ||
159 | |||
160 | enum fm10k_tlv_test_attr_id { | ||
161 | FM10K_TEST_MSG_UNSET, | ||
162 | FM10K_TEST_MSG_STRING, | ||
163 | FM10K_TEST_MSG_MAC_ADDR, | ||
164 | FM10K_TEST_MSG_U8, | ||
165 | FM10K_TEST_MSG_U16, | ||
166 | FM10K_TEST_MSG_U32, | ||
167 | FM10K_TEST_MSG_U64, | ||
168 | FM10K_TEST_MSG_S8, | ||
169 | FM10K_TEST_MSG_S16, | ||
170 | FM10K_TEST_MSG_S32, | ||
171 | FM10K_TEST_MSG_S64, | ||
172 | FM10K_TEST_MSG_LE_STRUCT, | ||
173 | FM10K_TEST_MSG_NESTED, | ||
174 | FM10K_TEST_MSG_RESULT, | ||
175 | FM10K_TEST_MSG_MAX | ||
176 | }; | ||
177 | |||
178 | extern const struct fm10k_tlv_attr fm10k_tlv_msg_test_attr[]; | ||
179 | void fm10k_tlv_msg_test_create(u32 *, u32); | ||
180 | s32 fm10k_tlv_msg_test(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *); | ||
181 | |||
182 | #define FM10K_TLV_MSG_TEST_HANDLER(func) \ | ||
183 | FM10K_MSG_HANDLER(FM10K_TLV_MSG_ID_TEST, fm10k_tlv_msg_test_attr, func) | ||
184 | #define FM10K_TLV_MSG_ERROR_HANDLER(func) \ | ||
185 | FM10K_MSG_HANDLER(FM10K_TLV_ERROR, NULL, func) | ||
141 | #endif /* _FM10K_MSG_H_ */ | 186 | #endif /* _FM10K_MSG_H_ */ |