Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3
4#ifndef _IONIC_H_
5#define _IONIC_H_
6
7struct ionic_lif;
8
9#include "ionic_if.h"
10#include "ionic_dev.h"
11#include "ionic_devlink.h"
12
13#define IONIC_DRV_NAME "ionic"
14#define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver"
15
16#define PCI_VENDOR_ID_PENSANDO 0x1dd8
17
18#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002
19#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003
20#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_MGMT 0x1004
21
22#define DEVCMD_TIMEOUT 10
23
24struct ionic_vf {
25 u16 index;
26 u8 macaddr[6];
27 __le32 maxrate;
28 __le16 vlanid;
29 u8 spoofchk;
30 u8 trusted;
31 u8 linkstate;
32 dma_addr_t stats_pa;
33 struct ionic_lif_stats stats;
34};
35
36struct ionic {
37 struct pci_dev *pdev;
38 struct device *dev;
39 struct devlink_port dl_port;
40 struct ionic_dev idev;
41 struct mutex dev_cmd_lock; /* lock for dev_cmd operations */
42 struct dentry *dentry;
43 struct ionic_dev_bar bars[IONIC_BARS_MAX];
44 unsigned int num_bars;
45 bool is_mgmt_nic;
46 struct ionic_identity ident;
47 struct list_head lifs;
48 struct ionic_lif *master_lif;
49 unsigned int nnqs_per_lif;
50 unsigned int neqs_per_lif;
51 unsigned int ntxqs_per_lif;
52 unsigned int nrxqs_per_lif;
53 DECLARE_BITMAP(lifbits, IONIC_LIFS_MAX);
54 unsigned int nintrs;
55 DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX);
56 struct work_struct nb_work;
57 struct notifier_block nb;
58 struct rw_semaphore vf_op_lock; /* lock for VF operations */
59 struct ionic_vf *vfs;
60 int num_vfs;
61 struct timer_list watchdog_timer;
62 int watchdog_period;
63};
64
65struct ionic_admin_ctx {
66 struct completion work;
67 union ionic_adminq_cmd cmd;
68 union ionic_adminq_comp comp;
69};
70
71int ionic_napi(struct napi_struct *napi, int budget, ionic_cq_cb cb,
72 ionic_cq_done_cb done_cb, void *done_arg);
73
74int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
75int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
76int ionic_set_dma_mask(struct ionic *ionic);
77int ionic_setup(struct ionic *ionic);
78
79int ionic_identify(struct ionic *ionic);
80int ionic_init(struct ionic *ionic);
81int ionic_reset(struct ionic *ionic);
82
83int ionic_port_identify(struct ionic *ionic);
84int ionic_port_init(struct ionic *ionic);
85int ionic_port_reset(struct ionic *ionic);
86
87#endif /* _IONIC_H_ */