0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef NFP_MAIN_H
0010 #define NFP_MAIN_H
0011
0012 #include <linux/ethtool.h>
0013 #include <linux/list.h>
0014 #include <linux/types.h>
0015 #include <linux/msi.h>
0016 #include <linux/pci.h>
0017 #include <linux/workqueue.h>
0018 #include <net/devlink.h>
0019
0020 struct dentry;
0021 struct device;
0022 struct pci_dev;
0023
0024 struct nfp_cpp;
0025 struct nfp_cpp_area;
0026 struct nfp_eth_table;
0027 struct nfp_hwinfo;
0028 struct nfp_mip;
0029 struct nfp_net;
0030 struct nfp_nsp_identify;
0031 struct nfp_port;
0032 struct nfp_rtsym;
0033 struct nfp_rtsym_table;
0034 struct nfp_shared_buf;
0035
0036
0037
0038
0039
0040
0041
0042 struct nfp_dumpspec {
0043 u32 size;
0044 u8 data[];
0045 };
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090 struct nfp_pf {
0091 struct pci_dev *pdev;
0092 const struct nfp_dev_info *dev_info;
0093
0094 struct nfp_cpp *cpp;
0095
0096 struct nfp_app *app;
0097
0098 struct nfp_cpp_area *data_vnic_bar;
0099 struct nfp_cpp_area *ctrl_vnic_bar;
0100 struct nfp_cpp_area *qc_area;
0101 struct nfp_cpp_area *mac_stats_bar;
0102 u8 __iomem *mac_stats_mem;
0103 struct nfp_cpp_area *vf_cfg_bar;
0104 u8 __iomem *vf_cfg_mem;
0105 struct nfp_cpp_area *vfcfg_tbl2_area;
0106 u8 __iomem *vfcfg_tbl2;
0107
0108 const struct nfp_rtsym *mbox;
0109
0110 struct msix_entry *irq_entries;
0111
0112 unsigned int limit_vfs;
0113 unsigned int num_vfs;
0114
0115 bool fw_loaded;
0116 bool unload_fw_on_remove;
0117
0118 struct nfp_net *ctrl_vnic;
0119
0120 const struct nfp_mip *mip;
0121 struct nfp_rtsym_table *rtbl;
0122 struct nfp_hwinfo *hwinfo;
0123 struct nfp_dumpspec *dumpspec;
0124 u32 dump_flag;
0125 u32 dump_len;
0126 struct nfp_eth_table *eth_tbl;
0127 struct nfp_nsp_identify *nspi;
0128
0129 struct device *hwmon_dev;
0130
0131 struct dentry *ddir;
0132
0133 unsigned int max_data_vnics;
0134 unsigned int num_vnics;
0135
0136 struct list_head vnics;
0137 struct list_head ports;
0138
0139 struct workqueue_struct *wq;
0140 struct work_struct port_refresh_work;
0141
0142 struct nfp_shared_buf *shared_bufs;
0143 unsigned int num_shared_bufs;
0144 };
0145
0146 extern struct pci_driver nfp_netvf_pci_driver;
0147
0148 extern const struct devlink_ops nfp_devlink_ops;
0149
0150 int nfp_net_pci_probe(struct nfp_pf *pf);
0151 void nfp_net_pci_remove(struct nfp_pf *pf);
0152
0153 int nfp_hwmon_register(struct nfp_pf *pf);
0154 void nfp_hwmon_unregister(struct nfp_pf *pf);
0155
0156 void
0157 nfp_net_get_mac_addr(struct nfp_pf *pf, struct net_device *netdev,
0158 struct nfp_port *port);
0159
0160 bool nfp_ctrl_tx(struct nfp_net *nn, struct sk_buff *skb);
0161
0162 int nfp_pf_rtsym_read_optional(struct nfp_pf *pf, const char *format,
0163 unsigned int default_val);
0164 u8 __iomem *
0165 nfp_pf_map_rtsym(struct nfp_pf *pf, const char *name, const char *sym_fmt,
0166 unsigned int min_size, struct nfp_cpp_area **area);
0167 int nfp_mbox_cmd(struct nfp_pf *pf, u32 cmd, void *in_data, u64 in_length,
0168 void *out_data, u64 out_length);
0169 int nfp_flash_update_common(struct nfp_pf *pf, const struct firmware *fw,
0170 struct netlink_ext_ack *extack);
0171
0172 enum nfp_dump_diag {
0173 NFP_DUMP_NSP_DIAG = 0,
0174 };
0175
0176 struct nfp_dumpspec *
0177 nfp_net_dump_load_dumpspec(struct nfp_cpp *cpp, struct nfp_rtsym_table *rtbl);
0178 s64 nfp_net_dump_calculate_size(struct nfp_pf *pf, struct nfp_dumpspec *spec,
0179 u32 flag);
0180 int nfp_net_dump_populate_buffer(struct nfp_pf *pf, struct nfp_dumpspec *spec,
0181 struct ethtool_dump *dump_param, void *dest);
0182
0183 int nfp_shared_buf_register(struct nfp_pf *pf);
0184 void nfp_shared_buf_unregister(struct nfp_pf *pf);
0185 int nfp_shared_buf_pool_get(struct nfp_pf *pf, unsigned int sb, u16 pool_index,
0186 struct devlink_sb_pool_info *pool_info);
0187 int nfp_shared_buf_pool_set(struct nfp_pf *pf, unsigned int sb,
0188 u16 pool_index, u32 size,
0189 enum devlink_sb_threshold_type threshold_type);
0190
0191 int nfp_devlink_params_register(struct nfp_pf *pf);
0192 void nfp_devlink_params_unregister(struct nfp_pf *pf);
0193 #endif