| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* Copyright (c) 2025 Broadcom */ |
| 3 |
|
| 4 |
#ifndef _BNGE_AUXR_H_ |
| 5 |
#define _BNGE_AUXR_H_ |
| 6 |
|
| 7 |
#include <linux/auxiliary_bus.h> |
| 8 |
|
| 9 |
#define BNGE_MIN_ROCE_CP_RINGS 2 |
| 10 |
#define BNGE_MIN_ROCE_STAT_CTXS 1 |
| 11 |
|
| 12 |
#define BNGE_MAX_ROCE_MSIX 64 |
| 13 |
|
| 14 |
struct hwrm_async_event_cmpl; |
| 15 |
struct bnge; |
| 16 |
|
| 17 |
struct bnge_msix_info { |
| 18 |
u32 vector; |
| 19 |
u32 ring_idx; |
| 20 |
u32 db_offset; |
| 21 |
}; |
| 22 |
|
| 23 |
struct bnge_fw_msg { |
| 24 |
void *msg; |
| 25 |
int msg_len; |
| 26 |
void *resp; |
| 27 |
int resp_max_len; |
| 28 |
int timeout; |
| 29 |
}; |
| 30 |
|
| 31 |
struct bnge_auxr_info { |
| 32 |
void *handle; |
| 33 |
u16 msix_requested; |
| 34 |
}; |
| 35 |
|
| 36 |
enum { |
| 37 |
BNGE_ARDEV_ROCEV1_SUPP = BIT(0), |
| 38 |
BNGE_ARDEV_ROCEV2_SUPP = BIT(1), |
| 39 |
BNGE_ARDEV_MSIX_ALLOC = BIT(2), |
| 40 |
}; |
| 41 |
|
| 42 |
#define BNGE_ARDEV_ROCE_SUPP (BNGE_ARDEV_ROCEV1_SUPP | \ |
| 43 |
BNGE_ARDEV_ROCEV2_SUPP) |
| 44 |
|
| 45 |
struct bnge_auxr_dev { |
| 46 |
struct net_device *net; |
| 47 |
struct pci_dev *pdev; |
| 48 |
void __iomem *bar0; |
| 49 |
|
| 50 |
struct bnge_msix_info msix_info[BNGE_MAX_ROCE_MSIX]; |
| 51 |
|
| 52 |
u32 flags; |
| 53 |
|
| 54 |
struct bnge_auxr_info *auxr_info; |
| 55 |
|
| 56 |
/* Doorbell BAR size in bytes mapped by L2 driver. */ |
| 57 |
int l2_db_size; |
| 58 |
/* Doorbell BAR size in bytes mapped as non-cacheable. */ |
| 59 |
int l2_db_size_nc; |
| 60 |
/* Doorbell offset in bytes within l2_db_size_nc. */ |
| 61 |
int l2_db_offset; |
| 62 |
|
| 63 |
u16 chip_num; |
| 64 |
u16 hw_ring_stats_size; |
| 65 |
u16 pf_port_id; |
| 66 |
unsigned long en_state; |
| 67 |
|
| 68 |
u16 auxr_num_msix_vec; |
| 69 |
u16 auxr_num_ctxs; |
| 70 |
|
| 71 |
/* serialize auxr operations */ |
| 72 |
struct mutex auxr_dev_lock; |
| 73 |
}; |
| 74 |
|
| 75 |
void bnge_rdma_aux_device_uninit(struct bnge_dev *bdev); |
| 76 |
void bnge_rdma_aux_device_del(struct bnge_dev *bdev); |
| 77 |
void bnge_rdma_aux_device_add(struct bnge_dev *bdev); |
| 78 |
void bnge_rdma_aux_device_init(struct bnge_dev *bdev); |
| 79 |
int bnge_register_dev(struct bnge_auxr_dev *adev, |
| 80 |
void *handle); |
| 81 |
void bnge_unregister_dev(struct bnge_auxr_dev *adev); |
| 82 |
int bnge_send_msg(struct bnge_auxr_dev *adev, struct bnge_fw_msg *fw_msg); |
| 83 |
|
| 84 |
#endif /* _BNGE_AUXR_H_ */ |