1
2
3
4
5
6
7
8
9#ifndef NFP_MAIN_H
10#define NFP_MAIN_H
11
12#include <linux/ethtool.h>
13#include <linux/list.h>
14#include <linux/types.h>
15#include <linux/msi.h>
16#include <linux/mutex.h>
17#include <linux/pci.h>
18#include <linux/workqueue.h>
19#include <net/devlink.h>
20
21struct dentry;
22struct device;
23struct pci_dev;
24
25struct nfp_cpp;
26struct nfp_cpp_area;
27struct nfp_eth_table;
28struct nfp_hwinfo;
29struct nfp_mip;
30struct nfp_net;
31struct nfp_nsp_identify;
32struct nfp_port;
33struct nfp_rtsym;
34struct nfp_rtsym_table;
35struct nfp_shared_buf;
36
37
38
39
40
41
42
43struct nfp_dumpspec {
44 u32 size;
45 u8 data[0];
46};
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88struct nfp_pf {
89 struct pci_dev *pdev;
90
91 struct nfp_cpp *cpp;
92
93 struct nfp_app *app;
94
95 struct nfp_cpp_area *data_vnic_bar;
96 struct nfp_cpp_area *ctrl_vnic_bar;
97 struct nfp_cpp_area *qc_area;
98 struct nfp_cpp_area *mac_stats_bar;
99 u8 __iomem *mac_stats_mem;
100 struct nfp_cpp_area *vf_cfg_bar;
101 u8 __iomem *vf_cfg_mem;
102 struct nfp_cpp_area *vfcfg_tbl2_area;
103 u8 __iomem *vfcfg_tbl2;
104
105 const struct nfp_rtsym *mbox;
106
107 struct msix_entry *irq_entries;
108
109 unsigned int limit_vfs;
110 unsigned int num_vfs;
111
112 bool fw_loaded;
113
114 struct nfp_net *ctrl_vnic;
115
116 const struct nfp_mip *mip;
117 struct nfp_rtsym_table *rtbl;
118 struct nfp_hwinfo *hwinfo;
119 struct nfp_dumpspec *dumpspec;
120 u32 dump_flag;
121 u32 dump_len;
122 struct nfp_eth_table *eth_tbl;
123 struct nfp_nsp_identify *nspi;
124
125 struct device *hwmon_dev;
126
127 struct dentry *ddir;
128
129 unsigned int max_data_vnics;
130 unsigned int num_vnics;
131
132 struct list_head vnics;
133 struct list_head ports;
134
135 struct workqueue_struct *wq;
136 struct work_struct port_refresh_work;
137
138 struct nfp_shared_buf *shared_bufs;
139 unsigned int num_shared_bufs;
140
141 struct mutex lock;
142};
143
144extern struct pci_driver nfp_netvf_pci_driver;
145
146extern const struct devlink_ops nfp_devlink_ops;
147
148int nfp_net_pci_probe(struct nfp_pf *pf);
149void nfp_net_pci_remove(struct nfp_pf *pf);
150
151int nfp_hwmon_register(struct nfp_pf *pf);
152void nfp_hwmon_unregister(struct nfp_pf *pf);
153
154void
155nfp_net_get_mac_addr(struct nfp_pf *pf, struct net_device *netdev,
156 struct nfp_port *port);
157
158bool nfp_ctrl_tx(struct nfp_net *nn, struct sk_buff *skb);
159
160int nfp_pf_rtsym_read_optional(struct nfp_pf *pf, const char *format,
161 unsigned int default_val);
162u8 __iomem *
163nfp_pf_map_rtsym(struct nfp_pf *pf, const char *name, const char *sym_fmt,
164 unsigned int min_size, struct nfp_cpp_area **area);
165int nfp_mbox_cmd(struct nfp_pf *pf, u32 cmd, void *in_data, u64 in_length,
166 void *out_data, u64 out_length);
167int nfp_flash_update_common(struct nfp_pf *pf, const char *path,
168 struct netlink_ext_ack *extack);
169
170enum nfp_dump_diag {
171 NFP_DUMP_NSP_DIAG = 0,
172};
173
174struct nfp_dumpspec *
175nfp_net_dump_load_dumpspec(struct nfp_cpp *cpp, struct nfp_rtsym_table *rtbl);
176s64 nfp_net_dump_calculate_size(struct nfp_pf *pf, struct nfp_dumpspec *spec,
177 u32 flag);
178int nfp_net_dump_populate_buffer(struct nfp_pf *pf, struct nfp_dumpspec *spec,
179 struct ethtool_dump *dump_param, void *dest);
180
181int nfp_shared_buf_register(struct nfp_pf *pf);
182void nfp_shared_buf_unregister(struct nfp_pf *pf);
183int nfp_shared_buf_pool_get(struct nfp_pf *pf, unsigned int sb, u16 pool_index,
184 struct devlink_sb_pool_info *pool_info);
185int nfp_shared_buf_pool_set(struct nfp_pf *pf, unsigned int sb,
186 u16 pool_index, u32 size,
187 enum devlink_sb_threshold_type threshold_type);
188#endif
189