1 /* Broadcom NetXtreme-C/E network driver.
2  *
3  * Copyright (c) 2017 Broadcom Limited
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation.
8  */
9 
10 #ifndef BNXT_DEVLINK_H
11 #define BNXT_DEVLINK_H
12 
13 /* Struct to hold housekeeping info needed by devlink interface */
14 struct bnxt_dl {
15 	struct bnxt *bp;	/* back ptr to the controlling dev */
16 };
17 
18 static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)
19 {
20 	return ((struct bnxt_dl *)devlink_priv(dl))->bp;
21 }
22 
23 #define NVM_OFF_MSIX_VEC_PER_PF_MAX	108
24 #define NVM_OFF_MSIX_VEC_PER_PF_MIN	114
25 #define NVM_OFF_IGNORE_ARI		164
26 #define NVM_OFF_DIS_GRE_VER_CHECK	171
27 #define NVM_OFF_ENABLE_SRIOV		401
28 #define NVM_OFF_NVM_CFG_VER		602
29 
30 #define BNXT_NVM_CFG_VER_BITS		8
31 #define BNXT_NVM_CFG_VER_BYTES		1
32 
33 #define BNXT_MSIX_VEC_MAX	512
34 #define BNXT_MSIX_VEC_MIN_MAX	128
35 
36 enum bnxt_nvm_dir_type {
37 	BNXT_NVM_SHARED_CFG = 40,
38 	BNXT_NVM_PORT_CFG,
39 	BNXT_NVM_FUNC_CFG,
40 };
41 
42 struct bnxt_dl_nvm_param {
43 	u16 id;
44 	u16 offset;
45 	u16 dir_type;
46 	u16 nvm_num_bits;
47 	u8 dl_num_bytes;
48 };
49 
50 enum bnxt_dl_version_type {
51 	BNXT_VERSION_FIXED,
52 	BNXT_VERSION_RUNNING,
53 	BNXT_VERSION_STORED,
54 };
55 
56 void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event);
57 void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy);
58 void bnxt_dl_health_recovery_done(struct bnxt *bp);
59 void bnxt_dl_fw_reporters_create(struct bnxt *bp);
60 void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all);
61 int bnxt_dl_register(struct bnxt *bp);
62 void bnxt_dl_unregister(struct bnxt *bp);
63 
64 #endif /* BNXT_DEVLINK_H */
65