xref: /linux/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h (revision 1a9239bb4253f9076b5b4b2a1a4e8d7defd77a95)
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 	bool remote_reset;
17 };
18 
bnxt_get_bp_from_dl(struct devlink * dl)19 static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)
20 {
21 	return ((struct bnxt_dl *)devlink_priv(dl))->bp;
22 }
23 
bnxt_dl_remote_reload(struct bnxt * bp)24 static inline void bnxt_dl_remote_reload(struct bnxt *bp)
25 {
26 	devlink_remote_reload_actions_performed(bp->dl, 0,
27 						BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
28 						BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE));
29 }
30 
bnxt_dl_get_remote_reset(struct devlink * dl)31 static inline bool bnxt_dl_get_remote_reset(struct devlink *dl)
32 {
33 	return ((struct bnxt_dl *)devlink_priv(dl))->remote_reset;
34 }
35 
bnxt_dl_set_remote_reset(struct devlink * dl,bool value)36 static inline void bnxt_dl_set_remote_reset(struct devlink *dl, bool value)
37 {
38 	((struct bnxt_dl *)devlink_priv(dl))->remote_reset = value;
39 }
40 
41 #define NVM_OFF_MSIX_VEC_PER_PF_MAX	108
42 #define NVM_OFF_MSIX_VEC_PER_PF_MIN	114
43 #define NVM_OFF_IGNORE_ARI		164
44 #define NVM_OFF_RDMA_CAPABLE		161
45 #define NVM_OFF_DIS_GRE_VER_CHECK	171
46 #define NVM_OFF_ENABLE_SRIOV		401
47 #define NVM_OFF_SUPPORT_RDMA		506
48 #define NVM_OFF_NVM_CFG_VER		602
49 
50 #define BNXT_NVM_CFG_VER_BITS		8
51 #define BNXT_NVM_CFG_VER_BYTES		1
52 
53 #define BNXT_MSIX_VEC_MAX	512
54 #define BNXT_MSIX_VEC_MIN_MAX	128
55 
56 enum bnxt_nvm_dir_type {
57 	BNXT_NVM_SHARED_CFG = 40,
58 	BNXT_NVM_PORT_CFG,
59 	BNXT_NVM_FUNC_CFG,
60 };
61 
62 struct bnxt_dl_nvm_param {
63 	u16 id;
64 	u16 offset;
65 	u16 dir_type;
66 	u16 nvm_num_bits;
67 	u8 dl_num_bytes;
68 };
69 
70 enum bnxt_dl_version_type {
71 	BNXT_VERSION_FIXED,
72 	BNXT_VERSION_RUNNING,
73 	BNXT_VERSION_STORED,
74 };
75 
76 void bnxt_devlink_health_fw_report(struct bnxt *bp);
77 void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy);
78 void bnxt_dl_health_fw_recovery_done(struct bnxt *bp);
79 void bnxt_dl_fw_reporters_create(struct bnxt *bp);
80 void bnxt_dl_fw_reporters_destroy(struct bnxt *bp);
81 int bnxt_dl_register(struct bnxt *bp);
82 void bnxt_dl_unregister(struct bnxt *bp);
83 
84 #endif /* BNXT_DEVLINK_H */
85