1 /* Broadcom NetXtreme-C/E network driver.
3 * Copyright (c) 2016-2018 Broadcom Limited
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.
13 #define BNXT_ROCE_ULP 0
14 #define BNXT_OTHER_ULP 1
15 #define BNXT_MAX_ULP 2
17 #define BNXT_MIN_ROCE_CP_RINGS 2
18 #define BNXT_MIN_ROCE_STAT_CTXS 1
20 struct hwrm_async_event_cmpl
;
23 struct bnxt_msix_entry
{
30 /* async_notifier() cannot sleep (in BH context) */
31 void (*ulp_async_notifier
)(void *, struct hwrm_async_event_cmpl
*);
32 void (*ulp_stop
)(void *);
33 void (*ulp_start
)(void *);
34 void (*ulp_sriov_config
)(void *, int);
35 void (*ulp_shutdown
)(void *);
36 void (*ulp_irq_stop
)(void *);
37 void (*ulp_irq_restart
)(void *, struct bnxt_msix_entry
*);
50 struct bnxt_ulp_ops __rcu
*ulp_ops
;
51 unsigned long *async_events_bmap
;
52 u16 max_async_event_id
;
59 struct net_device
*net
;
62 #define BNXT_EN_FLAG_ROCEV1_CAP 0x1
63 #define BNXT_EN_FLAG_ROCEV2_CAP 0x2
64 #define BNXT_EN_FLAG_ROCE_CAP (BNXT_EN_FLAG_ROCEV1_CAP | \
65 BNXT_EN_FLAG_ROCEV2_CAP)
66 #define BNXT_EN_FLAG_MSIX_REQUESTED 0x4
67 #define BNXT_EN_FLAG_ULP_STOPPED 0x8
68 const struct bnxt_en_ops
*en_ops
;
69 struct bnxt_ulp ulp_tbl
[BNXT_MAX_ULP
];
73 int (*bnxt_register_device
)(struct bnxt_en_dev
*, int,
74 struct bnxt_ulp_ops
*, void *);
75 int (*bnxt_unregister_device
)(struct bnxt_en_dev
*, int);
76 int (*bnxt_request_msix
)(struct bnxt_en_dev
*, int,
77 struct bnxt_msix_entry
*, int);
78 int (*bnxt_free_msix
)(struct bnxt_en_dev
*, int);
79 int (*bnxt_send_fw_msg
)(struct bnxt_en_dev
*, int,
80 struct bnxt_fw_msg
*);
81 int (*bnxt_register_fw_async_events
)(struct bnxt_en_dev
*, int,
82 unsigned long *, u16
);
85 static inline bool bnxt_ulp_registered(struct bnxt_en_dev
*edev
, int ulp_id
)
87 if (edev
&& rcu_access_pointer(edev
->ulp_tbl
[ulp_id
].ulp_ops
))
92 int bnxt_get_ulp_msix_num(struct bnxt
*bp
);
93 int bnxt_get_ulp_msix_base(struct bnxt
*bp
);
94 int bnxt_get_ulp_stat_ctxs(struct bnxt
*bp
);
95 void bnxt_ulp_stop(struct bnxt
*bp
);
96 void bnxt_ulp_start(struct bnxt
*bp
, int err
);
97 void bnxt_ulp_sriov_cfg(struct bnxt
*bp
, int num_vfs
);
98 void bnxt_ulp_shutdown(struct bnxt
*bp
);
99 void bnxt_ulp_irq_stop(struct bnxt
*bp
);
100 void bnxt_ulp_irq_restart(struct bnxt
*bp
, int err
);
101 void bnxt_ulp_async_events(struct bnxt
*bp
, struct hwrm_async_event_cmpl
*cmpl
);
102 struct bnxt_en_dev
*bnxt_ulp_probe(struct net_device
*dev
);