1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2016-2020 Intel Corporation 3 */ 4 5 #ifndef __DLB_MAIN_H 6 #define __DLB_MAIN_H 7 8 #include <rte_debug.h> 9 #include <rte_log.h> 10 #include <rte_spinlock.h> 11 #include <rte_pci.h> 12 #include <rte_bus_pci.h> 13 14 #ifndef PAGE_SIZE 15 #define PAGE_SIZE (sysconf(_SC_PAGESIZE)) 16 #endif 17 18 #include "base/dlb_hw_types.h" 19 #include "../dlb_user.h" 20 21 #define DLB_DEFAULT_UNREGISTER_TIMEOUT_S 5 22 23 struct dlb_dev { 24 struct rte_pci_device *pdev; 25 struct dlb_hw hw; 26 /* struct list_head list; */ 27 struct device *dlb_device; 28 bool domain_reset_failed; 29 /* The resource mutex serializes access to driver data structures and 30 * hardware registers. 31 */ 32 rte_spinlock_t resource_mutex; 33 rte_spinlock_t measurement_lock; 34 bool worker_launched; 35 u8 revision; 36 }; 37 38 struct dlb_dev *dlb_probe(struct rte_pci_device *pdev); 39 void dlb_reset_done(struct dlb_dev *dlb_dev); 40 41 /* pf_ops */ 42 int dlb_pf_init_driver_state(struct dlb_dev *dev); 43 void dlb_pf_free_driver_state(struct dlb_dev *dev); 44 void dlb_pf_init_hardware(struct dlb_dev *dev); 45 int dlb_pf_reset(struct dlb_dev *dlb_dev); 46 47 #endif /* __DLB_MAIN_H */ 48