1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (c) 2023 Corigine, Inc. 3 * All rights reserved. 4 */ 5 6 #ifndef __NFP_COMMON_PCI_H__ 7 #define __NFP_COMMON_PCI_H__ 8 9 #include <bus_pci_driver.h> 10 11 /* Initialization function for the driver called during device probing. */ 12 typedef int (nfp_class_driver_probe_t)(struct rte_pci_device *dev); 13 14 /* Uninitialization function for the driver called during hot-unplugging. */ 15 typedef int (nfp_class_driver_remove_t)(struct rte_pci_device *dev); 16 17 enum nfp_class { 18 NFP_CLASS_ETH, 19 NFP_CLASS_VDPA, 20 NFP_CLASS_INVALID, 21 }; 22 23 /* Describing a nfp common class driver. */ 24 struct nfp_class_driver { 25 TAILQ_ENTRY(nfp_class_driver) next; 26 enum nfp_class drv_class; /**< Class of this driver. */ 27 const char *name; /**< Driver name. */ 28 const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */ 29 uint32_t drv_flags; /**< Flags RTE_PCI_DRV_*. */ 30 nfp_class_driver_probe_t *probe; /**< Device probe function. */ 31 nfp_class_driver_remove_t *remove; /**< Device remove function. */ 32 }; 33 34 /** 35 * Register a nfp device driver. 36 * 37 * @param driver 38 * A pointer to a nfp_driver structure describing the driver 39 * to be registered. 40 */ 41 __rte_internal 42 void 43 nfp_class_driver_register(struct nfp_class_driver *driver); 44 45 #endif /* __NFP_COMMON_PCI_H__ */ 46