xref: /dpdk/drivers/net/ionic/ionic.h (revision 23bf4ddb3aff154b44da764d87d224bf0358748f)
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
3  */
4 
5 #ifndef _IONIC_H_
6 #define _IONIC_H_
7 
8 #include <stdint.h>
9 #include <inttypes.h>
10 
11 #include <rte_bus_pci.h>
12 
13 #include "ionic_dev.h"
14 #include "ionic_if.h"
15 #include "ionic_osdep.h"
16 
17 #define IONIC_DRV_NAME			"ionic"
18 #define IONIC_DRV_DESCRIPTION		"Pensando Ethernet NIC Driver"
19 #define IONIC_DRV_VERSION		"0.11.0-49"
20 
21 /* Vendor ID */
22 #define IONIC_PENSANDO_VENDOR_ID	0x1dd8
23 
24 /* Device IDs */
25 #define IONIC_DEV_ID_ETH_PF		0x1002
26 #define IONIC_DEV_ID_ETH_VF		0x1003
27 #define IONIC_DEV_ID_ETH_MGMT		0x1004
28 
29 enum ionic_mac_type {
30 	IONIC_MAC_UNKNOWN = 0,
31 	IONIC_MAC_CAPRI,
32 	IONIC_NUM_MACS
33 };
34 
35 struct ionic_mac_info {
36 	enum ionic_mac_type type;
37 };
38 
39 struct ionic_hw {
40 	struct ionic_mac_info mac;
41 	uint16_t device_id;
42 	uint16_t vendor_id;
43 };
44 
45 /*
46  * Structure to store private data for each driver instance (for each adapter).
47  */
48 struct ionic_adapter {
49 	struct ionic_hw hw;
50 	struct ionic_dev idev;
51 	struct ionic_dev_bar bars[IONIC_BARS_MAX];
52 	struct ionic_identity	ident;
53 	uint32_t num_bars;
54 	bool is_mgmt_nic;
55 	struct rte_pci_device *pci_dev;
56 	LIST_ENTRY(ionic_adapter) pci_adapters;
57 };
58 
59 int ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait);
60 int ionic_setup(struct ionic_adapter *adapter);
61 
62 int ionic_identify(struct ionic_adapter *adapter);
63 int ionic_init(struct ionic_adapter *adapter);
64 int ionic_reset(struct ionic_adapter *adapter);
65 
66 int ionic_port_identify(struct ionic_adapter *adapter);
67 int ionic_port_init(struct ionic_adapter *adapter);
68 int ionic_port_reset(struct ionic_adapter *adapter);
69 
70 #endif /* _IONIC_H_ */
71