File Index
Files and directories
Sign in
FILE

ionic.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/pensando/ionic/ionic.h C
 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
21#define DEVCMD_TIMEOUT			5
22#define IONIC_ADMINQ_TIME_SLICE		msecs_to_jiffies(100)
23
24#define IONIC_PHC_UPDATE_NS	10000000000	    /* 10s in nanoseconds */
25#define NORMAL_PPB		1000000000	    /* one billion parts per billion */
26#define SCALED_PPM		(1000000ull << 16)  /* 2^16 million parts per 2^16 million */
27
28struct ionic_vf {
29	u16	 index;
30	u8	 macaddr[6];
31	__le32	 maxrate;
32	__le16	 vlanid;
33	u8	 spoofchk;
34	u8	 trusted;
35	u8	 linkstate;
36	dma_addr_t       stats_pa;
37	struct ionic_lif_stats stats;
38};
39
40struct ionic {
41	struct pci_dev *pdev;
42	struct device *dev;
43	struct devlink_port dl_port;
44	struct ionic_dev idev;
45	struct mutex dev_cmd_lock;	/* lock for dev_cmd operations */
46	struct dentry *dentry;
47	struct ionic_dev_bar bars[IONIC_BARS_MAX];
48	unsigned int num_bars;
49	struct ionic_identity ident;
50	struct workqueue_struct *wq;
51	struct ionic_lif *lif;
52	unsigned int nnqs_per_lif;
53	unsigned int neqs_per_lif;
54	unsigned int ntxqs_per_lif;
55	unsigned int nrxqs_per_lif;
56	unsigned int nintrs;
57	DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX);
58	cpumask_var_t *affinity_masks;
59	struct delayed_work doorbell_check_dwork;
60	struct notifier_block nb;
61	struct rw_semaphore vf_op_lock;	/* lock for VF operations */
62	struct ionic_vf *vfs;
63	int num_vfs;
64	struct timer_list watchdog_timer;
65	int watchdog_period;
66};
67
68int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
69int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,
70		      const int err, const bool do_msg);
71int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
72void ionic_adminq_netdev_err_print(struct ionic_lif *lif, u8 opcode,
73				   u8 status, int err);
74bool ionic_notifyq_service(struct ionic_cq *cq);
75bool ionic_adminq_service(struct ionic_cq *cq);
76
77int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
78int ionic_dev_cmd_wait_nomsg(struct ionic *ionic, unsigned long max_wait);
79void ionic_dev_cmd_dev_err_print(struct ionic *ionic, u8 opcode, u8 status,
80				 int err);
81int ionic_setup(struct ionic *ionic);
82
83int ionic_identify(struct ionic *ionic);
84int ionic_init(struct ionic *ionic);
85int ionic_reset(struct ionic *ionic);
86
87int ionic_port_identify(struct ionic *ionic);
88int ionic_port_init(struct ionic *ionic);
89int ionic_port_reset(struct ionic *ionic);
90
91bool ionic_doorbell_wa(struct ionic *ionic);
92
93#endif /* _IONIC_H_ */
~/ Read-only file preview.