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 const char *name; 52 struct ionic_dev_bar bars[IONIC_BARS_MAX]; 53 struct ionic_identity ident; 54 struct ionic_lif *lifs[IONIC_LIFS_MAX]; 55 uint32_t num_bars; 56 uint32_t nlifs; 57 uint32_t max_ntxqs_per_lif; 58 uint32_t max_nrxqs_per_lif; 59 uint32_t max_mac_addrs; 60 uint32_t link_speed; 61 uint32_t nintrs; 62 bool intrs[IONIC_INTR_CTRL_REGS_MAX]; 63 bool link_up; 64 char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN]; 65 struct rte_pci_device *pci_dev; 66 LIST_ENTRY(ionic_adapter) pci_adapters; 67 }; 68 69 int ionic_adminq_check_err(struct ionic_admin_ctx *ctx, bool timeout); 70 int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); 71 int ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait); 72 int ionic_setup(struct ionic_adapter *adapter); 73 74 int ionic_identify(struct ionic_adapter *adapter); 75 int ionic_init(struct ionic_adapter *adapter); 76 int ionic_reset(struct ionic_adapter *adapter); 77 78 int ionic_port_identify(struct ionic_adapter *adapter); 79 int ionic_port_init(struct ionic_adapter *adapter); 80 int ionic_port_reset(struct ionic_adapter *adapter); 81 82 #endif /* _IONIC_H_ */ 83