Loading...
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 */
14struct bnxt_dl {
15 struct bnxt *bp; /* back ptr to the controlling dev */
16 bool remote_reset;
17};
18
19static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)
20{
21 return ((struct bnxt_dl *)devlink_priv(dl))->bp;
22}
23
24static 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
31static inline bool bnxt_dl_get_remote_reset(struct devlink *dl)
32{
33 return ((struct bnxt_dl *)devlink_priv(dl))->remote_reset;
34}
35
36static 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_DIS_GRE_VER_CHECK 171
45#define NVM_OFF_ENABLE_SRIOV 401
46#define NVM_OFF_NVM_CFG_VER 602
47
48#define BNXT_NVM_CFG_VER_BITS 8
49#define BNXT_NVM_CFG_VER_BYTES 1
50
51#define BNXT_MSIX_VEC_MAX 512
52#define BNXT_MSIX_VEC_MIN_MAX 128
53
54enum bnxt_nvm_dir_type {
55 BNXT_NVM_SHARED_CFG = 40,
56 BNXT_NVM_PORT_CFG,
57 BNXT_NVM_FUNC_CFG,
58};
59
60struct bnxt_dl_nvm_param {
61 u16 id;
62 u16 offset;
63 u16 dir_type;
64 u16 nvm_num_bits;
65 u8 dl_num_bytes;
66};
67
68enum bnxt_dl_version_type {
69 BNXT_VERSION_FIXED,
70 BNXT_VERSION_RUNNING,
71 BNXT_VERSION_STORED,
72};
73
74void bnxt_devlink_health_fw_report(struct bnxt *bp);
75void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy);
76void bnxt_dl_health_fw_recovery_done(struct bnxt *bp);
77void bnxt_dl_fw_reporters_create(struct bnxt *bp);
78void bnxt_dl_fw_reporters_destroy(struct bnxt *bp);
79int bnxt_dl_register(struct bnxt *bp);
80void bnxt_dl_unregister(struct bnxt *bp);
81
82#endif /* BNXT_DEVLINK_H */
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 */
14struct bnxt_dl {
15 struct bnxt *bp; /* back ptr to the controlling dev */
16};
17
18static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)
19{
20 return ((struct bnxt_dl *)devlink_priv(dl))->bp;
21}
22
23/* To clear devlink pointer from bp, pass NULL dl */
24static inline void bnxt_link_bp_to_dl(struct bnxt *bp, struct devlink *dl)
25{
26 bp->dl = dl;
27
28 /* add a back pointer in dl to bp */
29 if (dl) {
30 struct bnxt_dl *bp_dl = devlink_priv(dl);
31
32 bp_dl->bp = bp;
33 }
34}
35
36#define NVM_OFF_MSIX_VEC_PER_PF_MAX 108
37#define NVM_OFF_MSIX_VEC_PER_PF_MIN 114
38#define NVM_OFF_IGNORE_ARI 164
39#define NVM_OFF_DIS_GRE_VER_CHECK 171
40#define NVM_OFF_ENABLE_SRIOV 401
41#define NVM_OFF_NVM_CFG_VER 602
42
43#define BNXT_NVM_CFG_VER_BITS 24
44#define BNXT_NVM_CFG_VER_BYTES 4
45
46#define BNXT_MSIX_VEC_MAX 512
47#define BNXT_MSIX_VEC_MIN_MAX 128
48
49enum bnxt_nvm_dir_type {
50 BNXT_NVM_SHARED_CFG = 40,
51 BNXT_NVM_PORT_CFG,
52 BNXT_NVM_FUNC_CFG,
53};
54
55struct bnxt_dl_nvm_param {
56 u16 id;
57 u16 offset;
58 u16 dir_type;
59 u16 nvm_num_bits;
60 u8 dl_num_bytes;
61};
62
63void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event);
64void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy);
65void bnxt_dl_health_recovery_done(struct bnxt *bp);
66void bnxt_dl_fw_reporters_create(struct bnxt *bp);
67void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all);
68int bnxt_dl_register(struct bnxt *bp);
69void bnxt_dl_unregister(struct bnxt *bp);
70
71#endif /* BNXT_DEVLINK_H */