0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BNXT_ULP_H
0011 #define BNXT_ULP_H
0012
0013 #define BNXT_ROCE_ULP 0
0014 #define BNXT_MAX_ULP 1
0015
0016 #define BNXT_MIN_ROCE_CP_RINGS 2
0017 #define BNXT_MIN_ROCE_STAT_CTXS 1
0018
0019 struct hwrm_async_event_cmpl;
0020 struct bnxt;
0021
0022 struct bnxt_msix_entry {
0023 u32 vector;
0024 u32 ring_idx;
0025 u32 db_offset;
0026 };
0027
0028 struct bnxt_ulp_ops {
0029
0030 void (*ulp_async_notifier)(void *, struct hwrm_async_event_cmpl *);
0031 void (*ulp_stop)(void *);
0032 void (*ulp_start)(void *);
0033 void (*ulp_sriov_config)(void *, int);
0034 void (*ulp_shutdown)(void *);
0035 void (*ulp_irq_stop)(void *);
0036 void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *);
0037 };
0038
0039 struct bnxt_fw_msg {
0040 void *msg;
0041 int msg_len;
0042 void *resp;
0043 int resp_max_len;
0044 int timeout;
0045 };
0046
0047 struct bnxt_ulp {
0048 void *handle;
0049 struct bnxt_ulp_ops __rcu *ulp_ops;
0050 unsigned long *async_events_bmap;
0051 u16 max_async_event_id;
0052 u16 msix_requested;
0053 u16 msix_base;
0054 atomic_t ref_count;
0055 };
0056
0057 struct bnxt_en_dev {
0058 struct net_device *net;
0059 struct pci_dev *pdev;
0060 u32 flags;
0061 #define BNXT_EN_FLAG_ROCEV1_CAP 0x1
0062 #define BNXT_EN_FLAG_ROCEV2_CAP 0x2
0063 #define BNXT_EN_FLAG_ROCE_CAP (BNXT_EN_FLAG_ROCEV1_CAP | \
0064 BNXT_EN_FLAG_ROCEV2_CAP)
0065 #define BNXT_EN_FLAG_MSIX_REQUESTED 0x4
0066 #define BNXT_EN_FLAG_ULP_STOPPED 0x8
0067 const struct bnxt_en_ops *en_ops;
0068 struct bnxt_ulp ulp_tbl[BNXT_MAX_ULP];
0069 int l2_db_size;
0070
0071
0072
0073 int l2_db_size_nc;
0074
0075
0076
0077 };
0078
0079 struct bnxt_en_ops {
0080 int (*bnxt_register_device)(struct bnxt_en_dev *, unsigned int,
0081 struct bnxt_ulp_ops *, void *);
0082 int (*bnxt_unregister_device)(struct bnxt_en_dev *, unsigned int);
0083 int (*bnxt_request_msix)(struct bnxt_en_dev *, unsigned int,
0084 struct bnxt_msix_entry *, int);
0085 int (*bnxt_free_msix)(struct bnxt_en_dev *, unsigned int);
0086 int (*bnxt_send_fw_msg)(struct bnxt_en_dev *, unsigned int,
0087 struct bnxt_fw_msg *);
0088 int (*bnxt_register_fw_async_events)(struct bnxt_en_dev *, unsigned int,
0089 unsigned long *, u16);
0090 };
0091
0092 static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev, int ulp_id)
0093 {
0094 if (edev && rcu_access_pointer(edev->ulp_tbl[ulp_id].ulp_ops))
0095 return true;
0096 return false;
0097 }
0098
0099 int bnxt_get_ulp_msix_num(struct bnxt *bp);
0100 int bnxt_get_ulp_msix_base(struct bnxt *bp);
0101 int bnxt_get_ulp_stat_ctxs(struct bnxt *bp);
0102 void bnxt_ulp_stop(struct bnxt *bp);
0103 void bnxt_ulp_start(struct bnxt *bp, int err);
0104 void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs);
0105 void bnxt_ulp_shutdown(struct bnxt *bp);
0106 void bnxt_ulp_irq_stop(struct bnxt *bp);
0107 void bnxt_ulp_irq_restart(struct bnxt *bp, int err);
0108 void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl);
0109 struct bnxt_en_dev *bnxt_ulp_probe(struct net_device *dev);
0110
0111 #endif