1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /* Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved */
3 
4 #ifndef _MLXSW_CORE_H
5 #define _MLXSW_CORE_H
6 
7 #include <linux/module.h>
8 #include <linux/device.h>
9 #include <linux/slab.h>
10 #include <linux/gfp.h>
11 #include <linux/types.h>
12 #include <linux/skbuff.h>
13 #include <linux/workqueue.h>
14 #include <linux/net_namespace.h>
15 #include <net/devlink.h>
16 
17 #include "trap.h"
18 #include "reg.h"
19 #include "cmd.h"
20 #include "resources.h"
21 
22 struct mlxsw_core;
23 struct mlxsw_core_port;
24 struct mlxsw_driver;
25 struct mlxsw_bus;
26 struct mlxsw_bus_info;
27 struct mlxsw_fw_rev;
28 
29 unsigned int mlxsw_core_max_ports(const struct mlxsw_core *mlxsw_core);
30 
31 void *mlxsw_core_driver_priv(struct mlxsw_core *mlxsw_core);
32 
33 bool mlxsw_core_res_query_enabled(const struct mlxsw_core *mlxsw_core);
34 
35 bool mlxsw_core_temp_warn_enabled(const struct mlxsw_core *mlxsw_core);
36 
37 bool
38 mlxsw_core_fw_rev_minor_subminor_validate(const struct mlxsw_fw_rev *rev,
39 					  const struct mlxsw_fw_rev *req_rev);
40 
41 int mlxsw_core_driver_register(struct mlxsw_driver *mlxsw_driver);
42 void mlxsw_core_driver_unregister(struct mlxsw_driver *mlxsw_driver);
43 
44 int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
45 				   const struct mlxsw_bus *mlxsw_bus,
46 				   void *bus_priv, bool reload,
47 				   struct devlink *devlink,
48 				   struct netlink_ext_ack *extack);
49 void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core, bool reload);
50 
51 struct mlxsw_tx_info {
52 	u8 local_port;
53 	bool is_emad;
54 };
55 
56 bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
57 				  const struct mlxsw_tx_info *tx_info);
58 int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
59 			    const struct mlxsw_tx_info *tx_info);
60 void mlxsw_core_ptp_transmitted(struct mlxsw_core *mlxsw_core,
61 				struct sk_buff *skb, u8 local_port);
62 
63 struct mlxsw_rx_listener {
64 	void (*func)(struct sk_buff *skb, u8 local_port, void *priv);
65 	u8 local_port;
66 	u8 mirror_reason;
67 	u16 trap_id;
68 };
69 
70 struct mlxsw_event_listener {
71 	void (*func)(const struct mlxsw_reg_info *reg,
72 		     char *payload, void *priv);
73 	enum mlxsw_event_trap_id trap_id;
74 };
75 
76 struct mlxsw_listener {
77 	u16 trap_id;
78 	union {
79 		struct mlxsw_rx_listener rx_listener;
80 		struct mlxsw_event_listener event_listener;
81 	};
82 	enum mlxsw_reg_hpkt_action en_action; /* Action when enabled */
83 	enum mlxsw_reg_hpkt_action dis_action; /* Action when disabled */
84 	u8 en_trap_group; /* Trap group when enabled */
85 	u8 dis_trap_group; /* Trap group when disabled */
86 	u8 is_ctrl:1, /* should go via control buffer or not */
87 	   is_event:1,
88 	   enabled_on_register:1; /* Trap should be enabled when listener
89 				   * is registered.
90 				   */
91 };
92 
93 #define __MLXSW_RXL(_func, _trap_id, _en_action, _is_ctrl, _en_trap_group,	\
94 		    _dis_action, _enabled_on_register, _dis_trap_group,		\
95 		    _mirror_reason)						\
96 	{									\
97 		.trap_id = MLXSW_TRAP_ID_##_trap_id,				\
98 		.rx_listener =							\
99 		{								\
100 			.func = _func,						\
101 			.local_port = MLXSW_PORT_DONT_CARE,			\
102 			.mirror_reason = _mirror_reason,			\
103 			.trap_id = MLXSW_TRAP_ID_##_trap_id,			\
104 		},								\
105 		.en_action = MLXSW_REG_HPKT_ACTION_##_en_action,		\
106 		.dis_action = MLXSW_REG_HPKT_ACTION_##_dis_action,		\
107 		.en_trap_group = MLXSW_REG_HTGT_TRAP_GROUP_##_en_trap_group,	\
108 		.dis_trap_group = MLXSW_REG_HTGT_TRAP_GROUP_##_dis_trap_group,	\
109 		.is_ctrl = _is_ctrl,						\
110 		.enabled_on_register = _enabled_on_register,			\
111 	}
112 
113 #define MLXSW_RXL(_func, _trap_id, _en_action, _is_ctrl, _trap_group,		\
114 		  _dis_action)							\
115 	__MLXSW_RXL(_func, _trap_id, _en_action, _is_ctrl, _trap_group,		\
116 		    _dis_action, true, _trap_group, 0)
117 
118 #define MLXSW_RXL_DIS(_func, _trap_id, _en_action, _is_ctrl, _en_trap_group,	\
119 		      _dis_action, _dis_trap_group)				\
120 	__MLXSW_RXL(_func, _trap_id, _en_action, _is_ctrl, _en_trap_group,	\
121 		    _dis_action, false, _dis_trap_group, 0)
122 
123 #define MLXSW_RXL_MIRROR(_func, _session_id, _trap_group, _mirror_reason)	\
124 	__MLXSW_RXL(_func, MIRROR_SESSION##_session_id,	TRAP_TO_CPU, false,	\
125 		    _trap_group, TRAP_TO_CPU, true, _trap_group,		\
126 		    _mirror_reason)
127 
128 #define MLXSW_EVENTL(_func, _trap_id, _trap_group)				\
129 	{									\
130 		.trap_id = MLXSW_TRAP_ID_##_trap_id,				\
131 		.event_listener =						\
132 		{								\
133 			.func = _func,						\
134 			.trap_id = MLXSW_TRAP_ID_##_trap_id,			\
135 		},								\
136 		.en_action = MLXSW_REG_HPKT_ACTION_TRAP_TO_CPU,			\
137 		.en_trap_group = MLXSW_REG_HTGT_TRAP_GROUP_##_trap_group,	\
138 		.is_event = true,						\
139 		.enabled_on_register = true,					\
140 	}
141 
142 int mlxsw_core_rx_listener_register(struct mlxsw_core *mlxsw_core,
143 				    const struct mlxsw_rx_listener *rxl,
144 				    void *priv, bool enabled);
145 void mlxsw_core_rx_listener_unregister(struct mlxsw_core *mlxsw_core,
146 				       const struct mlxsw_rx_listener *rxl);
147 
148 int mlxsw_core_event_listener_register(struct mlxsw_core *mlxsw_core,
149 				       const struct mlxsw_event_listener *el,
150 				       void *priv);
151 void mlxsw_core_event_listener_unregister(struct mlxsw_core *mlxsw_core,
152 					  const struct mlxsw_event_listener *el);
153 
154 int mlxsw_core_trap_register(struct mlxsw_core *mlxsw_core,
155 			     const struct mlxsw_listener *listener,
156 			     void *priv);
157 void mlxsw_core_trap_unregister(struct mlxsw_core *mlxsw_core,
158 				const struct mlxsw_listener *listener,
159 				void *priv);
160 int mlxsw_core_trap_state_set(struct mlxsw_core *mlxsw_core,
161 			      const struct mlxsw_listener *listener,
162 			      bool enabled);
163 
164 typedef void mlxsw_reg_trans_cb_t(struct mlxsw_core *mlxsw_core, char *payload,
165 				  size_t payload_len, unsigned long cb_priv);
166 
167 int mlxsw_reg_trans_query(struct mlxsw_core *mlxsw_core,
168 			  const struct mlxsw_reg_info *reg, char *payload,
169 			  struct list_head *bulk_list,
170 			  mlxsw_reg_trans_cb_t *cb, unsigned long cb_priv);
171 int mlxsw_reg_trans_write(struct mlxsw_core *mlxsw_core,
172 			  const struct mlxsw_reg_info *reg, char *payload,
173 			  struct list_head *bulk_list,
174 			  mlxsw_reg_trans_cb_t *cb, unsigned long cb_priv);
175 int mlxsw_reg_trans_bulk_wait(struct list_head *bulk_list);
176 
177 int mlxsw_reg_query(struct mlxsw_core *mlxsw_core,
178 		    const struct mlxsw_reg_info *reg, char *payload);
179 int mlxsw_reg_write(struct mlxsw_core *mlxsw_core,
180 		    const struct mlxsw_reg_info *reg, char *payload);
181 
182 struct mlxsw_rx_info {
183 	bool is_lag;
184 	union {
185 		u16 sys_port;
186 		u16 lag_id;
187 	} u;
188 	u8 lag_port_index;
189 	u8 mirror_reason;
190 	int trap_id;
191 };
192 
193 void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
194 			    struct mlxsw_rx_info *rx_info);
195 
196 void mlxsw_core_lag_mapping_set(struct mlxsw_core *mlxsw_core,
197 				u16 lag_id, u8 port_index, u8 local_port);
198 u8 mlxsw_core_lag_mapping_get(struct mlxsw_core *mlxsw_core,
199 			      u16 lag_id, u8 port_index);
200 void mlxsw_core_lag_mapping_clear(struct mlxsw_core *mlxsw_core,
201 				  u16 lag_id, u8 local_port);
202 
203 void *mlxsw_core_port_driver_priv(struct mlxsw_core_port *mlxsw_core_port);
204 int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port,
205 			 u32 port_number, bool split, u32 split_port_subnumber,
206 			 bool splittable, u32 lanes,
207 			 const unsigned char *switch_id,
208 			 unsigned char switch_id_len);
209 void mlxsw_core_port_fini(struct mlxsw_core *mlxsw_core, u8 local_port);
210 int mlxsw_core_cpu_port_init(struct mlxsw_core *mlxsw_core,
211 			     void *port_driver_priv,
212 			     const unsigned char *switch_id,
213 			     unsigned char switch_id_len);
214 void mlxsw_core_cpu_port_fini(struct mlxsw_core *mlxsw_core);
215 void mlxsw_core_port_eth_set(struct mlxsw_core *mlxsw_core, u8 local_port,
216 			     void *port_driver_priv, struct net_device *dev);
217 void mlxsw_core_port_ib_set(struct mlxsw_core *mlxsw_core, u8 local_port,
218 			    void *port_driver_priv);
219 void mlxsw_core_port_clear(struct mlxsw_core *mlxsw_core, u8 local_port,
220 			   void *port_driver_priv);
221 enum devlink_port_type mlxsw_core_port_type_get(struct mlxsw_core *mlxsw_core,
222 						u8 local_port);
223 struct devlink_port *
224 mlxsw_core_port_devlink_port_get(struct mlxsw_core *mlxsw_core,
225 				 u8 local_port);
226 bool mlxsw_core_port_is_xm(const struct mlxsw_core *mlxsw_core, u8 local_port);
227 struct mlxsw_env *mlxsw_core_env(const struct mlxsw_core *mlxsw_core);
228 bool mlxsw_core_is_initialized(const struct mlxsw_core *mlxsw_core);
229 int mlxsw_core_module_max_width(struct mlxsw_core *mlxsw_core, u8 module);
230 
231 int mlxsw_core_schedule_dw(struct delayed_work *dwork, unsigned long delay);
232 bool mlxsw_core_schedule_work(struct work_struct *work);
233 void mlxsw_core_flush_owq(void);
234 int mlxsw_core_resources_query(struct mlxsw_core *mlxsw_core, char *mbox,
235 			       struct mlxsw_res *res);
236 
237 #define MLXSW_CONFIG_PROFILE_SWID_COUNT 8
238 
239 struct mlxsw_swid_config {
240 	u8	used_type:1,
241 		used_properties:1;
242 	u8	type;
243 	u8	properties;
244 };
245 
246 struct mlxsw_config_profile {
247 	u16	used_max_vepa_channels:1,
248 		used_max_mid:1,
249 		used_max_pgt:1,
250 		used_max_system_port:1,
251 		used_max_vlan_groups:1,
252 		used_max_regions:1,
253 		used_flood_tables:1,
254 		used_flood_mode:1,
255 		used_max_ib_mc:1,
256 		used_max_pkey:1,
257 		used_ar_sec:1,
258 		used_adaptive_routing_group_cap:1,
259 		used_kvd_sizes:1,
260 		used_kvh_xlt_cache_mode:1;
261 	u8	max_vepa_channels;
262 	u16	max_mid;
263 	u16	max_pgt;
264 	u16	max_system_port;
265 	u16	max_vlan_groups;
266 	u16	max_regions;
267 	u8	max_flood_tables;
268 	u8	max_vid_flood_tables;
269 	u8	flood_mode;
270 	u8	max_fid_offset_flood_tables;
271 	u16	fid_offset_flood_table_size;
272 	u8	max_fid_flood_tables;
273 	u16	fid_flood_table_size;
274 	u16	max_ib_mc;
275 	u16	max_pkey;
276 	u8	ar_sec;
277 	u16	adaptive_routing_group_cap;
278 	u8	arn;
279 	u32	kvd_linear_size;
280 	u8	kvd_hash_single_parts;
281 	u8	kvd_hash_double_parts;
282 	u8	kvh_xlt_cache_mode;
283 	struct mlxsw_swid_config swid_config[MLXSW_CONFIG_PROFILE_SWID_COUNT];
284 };
285 
286 struct mlxsw_driver {
287 	struct list_head list;
288 	const char *kind;
289 	size_t priv_size;
290 	const struct mlxsw_fw_rev *fw_req_rev;
291 	const char *fw_filename;
292 	int (*init)(struct mlxsw_core *mlxsw_core,
293 		    const struct mlxsw_bus_info *mlxsw_bus_info,
294 		    struct netlink_ext_ack *extack);
295 	void (*fini)(struct mlxsw_core *mlxsw_core);
296 	int (*basic_trap_groups_set)(struct mlxsw_core *mlxsw_core);
297 	int (*port_type_set)(struct mlxsw_core *mlxsw_core, u8 local_port,
298 			     enum devlink_port_type new_type);
299 	int (*port_split)(struct mlxsw_core *mlxsw_core, u8 local_port,
300 			  unsigned int count, struct netlink_ext_ack *extack);
301 	int (*port_unsplit)(struct mlxsw_core *mlxsw_core, u8 local_port,
302 			    struct netlink_ext_ack *extack);
303 	int (*sb_pool_get)(struct mlxsw_core *mlxsw_core,
304 			   unsigned int sb_index, u16 pool_index,
305 			   struct devlink_sb_pool_info *pool_info);
306 	int (*sb_pool_set)(struct mlxsw_core *mlxsw_core,
307 			   unsigned int sb_index, u16 pool_index, u32 size,
308 			   enum devlink_sb_threshold_type threshold_type,
309 			   struct netlink_ext_ack *extack);
310 	int (*sb_port_pool_get)(struct mlxsw_core_port *mlxsw_core_port,
311 				unsigned int sb_index, u16 pool_index,
312 				u32 *p_threshold);
313 	int (*sb_port_pool_set)(struct mlxsw_core_port *mlxsw_core_port,
314 				unsigned int sb_index, u16 pool_index,
315 				u32 threshold, struct netlink_ext_ack *extack);
316 	int (*sb_tc_pool_bind_get)(struct mlxsw_core_port *mlxsw_core_port,
317 				   unsigned int sb_index, u16 tc_index,
318 				   enum devlink_sb_pool_type pool_type,
319 				   u16 *p_pool_index, u32 *p_threshold);
320 	int (*sb_tc_pool_bind_set)(struct mlxsw_core_port *mlxsw_core_port,
321 				   unsigned int sb_index, u16 tc_index,
322 				   enum devlink_sb_pool_type pool_type,
323 				   u16 pool_index, u32 threshold,
324 				   struct netlink_ext_ack *extack);
325 	int (*sb_occ_snapshot)(struct mlxsw_core *mlxsw_core,
326 			       unsigned int sb_index);
327 	int (*sb_occ_max_clear)(struct mlxsw_core *mlxsw_core,
328 				unsigned int sb_index);
329 	int (*sb_occ_port_pool_get)(struct mlxsw_core_port *mlxsw_core_port,
330 				    unsigned int sb_index, u16 pool_index,
331 				    u32 *p_cur, u32 *p_max);
332 	int (*sb_occ_tc_port_bind_get)(struct mlxsw_core_port *mlxsw_core_port,
333 				       unsigned int sb_index, u16 tc_index,
334 				       enum devlink_sb_pool_type pool_type,
335 				       u32 *p_cur, u32 *p_max);
336 	int (*trap_init)(struct mlxsw_core *mlxsw_core,
337 			 const struct devlink_trap *trap, void *trap_ctx);
338 	void (*trap_fini)(struct mlxsw_core *mlxsw_core,
339 			  const struct devlink_trap *trap, void *trap_ctx);
340 	int (*trap_action_set)(struct mlxsw_core *mlxsw_core,
341 			       const struct devlink_trap *trap,
342 			       enum devlink_trap_action action,
343 			       struct netlink_ext_ack *extack);
344 	int (*trap_group_init)(struct mlxsw_core *mlxsw_core,
345 			       const struct devlink_trap_group *group);
346 	int (*trap_group_set)(struct mlxsw_core *mlxsw_core,
347 			      const struct devlink_trap_group *group,
348 			      const struct devlink_trap_policer *policer,
349 			      struct netlink_ext_ack *extack);
350 	int (*trap_policer_init)(struct mlxsw_core *mlxsw_core,
351 				 const struct devlink_trap_policer *policer);
352 	void (*trap_policer_fini)(struct mlxsw_core *mlxsw_core,
353 				  const struct devlink_trap_policer *policer);
354 	int (*trap_policer_set)(struct mlxsw_core *mlxsw_core,
355 				const struct devlink_trap_policer *policer,
356 				u64 rate, u64 burst,
357 				struct netlink_ext_ack *extack);
358 	int (*trap_policer_counter_get)(struct mlxsw_core *mlxsw_core,
359 					const struct devlink_trap_policer *policer,
360 					u64 *p_drops);
361 	void (*txhdr_construct)(struct sk_buff *skb,
362 				const struct mlxsw_tx_info *tx_info);
363 	int (*resources_register)(struct mlxsw_core *mlxsw_core);
364 	int (*kvd_sizes_get)(struct mlxsw_core *mlxsw_core,
365 			     const struct mlxsw_config_profile *profile,
366 			     u64 *p_single_size, u64 *p_double_size,
367 			     u64 *p_linear_size);
368 	int (*params_register)(struct mlxsw_core *mlxsw_core);
369 	void (*params_unregister)(struct mlxsw_core *mlxsw_core);
370 
371 	/* Notify a driver that a timestamped packet was transmitted. Driver
372 	 * is responsible for freeing the passed-in SKB.
373 	 */
374 	void (*ptp_transmitted)(struct mlxsw_core *mlxsw_core,
375 				struct sk_buff *skb, u8 local_port);
376 
377 	u8 txhdr_len;
378 	const struct mlxsw_config_profile *profile;
379 	bool res_query_enabled;
380 	bool fw_fatal_enabled;
381 	bool temp_warn_enabled;
382 };
383 
384 int mlxsw_core_kvd_sizes_get(struct mlxsw_core *mlxsw_core,
385 			     const struct mlxsw_config_profile *profile,
386 			     u64 *p_single_size, u64 *p_double_size,
387 			     u64 *p_linear_size);
388 
389 u32 mlxsw_core_read_frc_h(struct mlxsw_core *mlxsw_core);
390 u32 mlxsw_core_read_frc_l(struct mlxsw_core *mlxsw_core);
391 
392 void mlxsw_core_emad_string_tlv_enable(struct mlxsw_core *mlxsw_core);
393 
394 bool mlxsw_core_res_valid(struct mlxsw_core *mlxsw_core,
395 			  enum mlxsw_res_id res_id);
396 
397 #define MLXSW_CORE_RES_VALID(mlxsw_core, short_res_id)			\
398 	mlxsw_core_res_valid(mlxsw_core, MLXSW_RES_ID_##short_res_id)
399 
400 u64 mlxsw_core_res_get(struct mlxsw_core *mlxsw_core,
401 		       enum mlxsw_res_id res_id);
402 
403 #define MLXSW_CORE_RES_GET(mlxsw_core, short_res_id)			\
404 	mlxsw_core_res_get(mlxsw_core, MLXSW_RES_ID_##short_res_id)
405 
406 static inline struct net *mlxsw_core_net(struct mlxsw_core *mlxsw_core)
407 {
408 	return devlink_net(priv_to_devlink(mlxsw_core));
409 }
410 
411 #define MLXSW_BUS_F_TXRX	BIT(0)
412 #define MLXSW_BUS_F_RESET	BIT(1)
413 
414 struct mlxsw_bus {
415 	const char *kind;
416 	int (*init)(void *bus_priv, struct mlxsw_core *mlxsw_core,
417 		    const struct mlxsw_config_profile *profile,
418 		    struct mlxsw_res *res);
419 	void (*fini)(void *bus_priv);
420 	bool (*skb_transmit_busy)(void *bus_priv,
421 				  const struct mlxsw_tx_info *tx_info);
422 	int (*skb_transmit)(void *bus_priv, struct sk_buff *skb,
423 			    const struct mlxsw_tx_info *tx_info);
424 	int (*cmd_exec)(void *bus_priv, u16 opcode, u8 opcode_mod,
425 			u32 in_mod, bool out_mbox_direct,
426 			char *in_mbox, size_t in_mbox_size,
427 			char *out_mbox, size_t out_mbox_size,
428 			u8 *p_status);
429 	u32 (*read_frc_h)(void *bus_priv);
430 	u32 (*read_frc_l)(void *bus_priv);
431 	u8 features;
432 };
433 
434 struct mlxsw_fw_rev {
435 	u16 major;
436 	u16 minor;
437 	u16 subminor;
438 	u16 can_reset_minor;
439 };
440 
441 #define MLXSW_BUS_INFO_XM_LOCAL_PORTS_MAX 4
442 
443 struct mlxsw_bus_info {
444 	const char *device_kind;
445 	const char *device_name;
446 	struct device *dev;
447 	struct mlxsw_fw_rev fw_rev;
448 	u8 vsd[MLXSW_CMD_BOARDINFO_VSD_LEN];
449 	u8 psid[MLXSW_CMD_BOARDINFO_PSID_LEN];
450 	u8 low_frequency:1,
451 	   read_frc_capable:1,
452 	   xm_exists:1;
453 	u8 xm_local_ports_count;
454 	u8 xm_local_ports[MLXSW_BUS_INFO_XM_LOCAL_PORTS_MAX];
455 };
456 
457 struct mlxsw_hwmon;
458 
459 #ifdef CONFIG_MLXSW_CORE_HWMON
460 
461 int mlxsw_hwmon_init(struct mlxsw_core *mlxsw_core,
462 		     const struct mlxsw_bus_info *mlxsw_bus_info,
463 		     struct mlxsw_hwmon **p_hwmon);
464 void mlxsw_hwmon_fini(struct mlxsw_hwmon *mlxsw_hwmon);
465 
466 #else
467 
468 static inline int mlxsw_hwmon_init(struct mlxsw_core *mlxsw_core,
469 				   const struct mlxsw_bus_info *mlxsw_bus_info,
470 				   struct mlxsw_hwmon **p_hwmon)
471 {
472 	return 0;
473 }
474 
475 static inline void mlxsw_hwmon_fini(struct mlxsw_hwmon *mlxsw_hwmon)
476 {
477 }
478 
479 #endif
480 
481 struct mlxsw_thermal;
482 
483 #ifdef CONFIG_MLXSW_CORE_THERMAL
484 
485 int mlxsw_thermal_init(struct mlxsw_core *mlxsw_core,
486 		       const struct mlxsw_bus_info *mlxsw_bus_info,
487 		       struct mlxsw_thermal **p_thermal);
488 void mlxsw_thermal_fini(struct mlxsw_thermal *thermal);
489 
490 #else
491 
492 static inline int mlxsw_thermal_init(struct mlxsw_core *mlxsw_core,
493 				     const struct mlxsw_bus_info *mlxsw_bus_info,
494 				     struct mlxsw_thermal **p_thermal)
495 {
496 	return 0;
497 }
498 
499 static inline void mlxsw_thermal_fini(struct mlxsw_thermal *thermal)
500 {
501 }
502 
503 #endif
504 
505 enum mlxsw_devlink_param_id {
506 	MLXSW_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
507 	MLXSW_DEVLINK_PARAM_ID_ACL_REGION_REHASH_INTERVAL,
508 };
509 
510 struct mlxsw_skb_cb {
511 	union {
512 		struct mlxsw_tx_info tx_info;
513 		u32 cookie_index; /* Only used during receive */
514 	};
515 };
516 
517 static inline struct mlxsw_skb_cb *mlxsw_skb_cb(struct sk_buff *skb)
518 {
519 	BUILD_BUG_ON(sizeof(mlxsw_skb_cb) > sizeof(skb->cb));
520 	return (struct mlxsw_skb_cb *) skb->cb;
521 }
522 
523 #endif
524