CNDP  22.08.0
pktdev_driver.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2019-2022 Intel Corporation
3  */
4 
5 #ifndef __PKTDEV_DRIVER_H_
6 #define __PKTDEV_DRIVER_H_
7 
16 #include <sys/queue.h>
17 #include <cne_atomic.h>
18 #include <cne_common.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
25 TAILQ_HEAD(pktdev_driver_list, pktdev_driver);
26 
30 typedef int(pktdev_probe_t)(lport_cfg_t *cfg);
31 
35 typedef int(pktdev_remove_t)(struct cne_pktdev *dev);
36 
40 struct pktdev_driver {
42  const char *name;
44 };
45 
53 void pktdev_register(struct pktdev_driver *driver);
54 
55 #define PMD_REGISTER_DEV(nm, vdrv) \
56  CNE_INIT(vdrvinit_##vdrv) \
57  { \
58  (vdrv).name = CNE_STR(nm); \
59  pktdev_register(&vdrv); \
60  }
61 
71 CNDP_API struct cne_pktdev *pktdev_allocated(const char *name);
72 
85 CNDP_API struct cne_pktdev *pktdev_allocate(const char *name, const char *ifname);
86 
98 CNDP_API void _pktdev_reset(struct cne_pktdev *dev);
99 
106 CNDP_API void pktdev_release_port(struct cne_pktdev *dev);
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif /* __PKTDEV_DRIVER_H_ */
struct lport_cfg lport_cfg_t
int() pktdev_remove_t(struct cne_pktdev *dev)
Definition: pktdev_driver.h:35
TAILQ_HEAD(pktdev_driver_list, pktdev_driver)
int() pktdev_probe_t(lport_cfg_t *cfg)
Definition: pktdev_driver.h:30
CNDP_API void pktdev_release_port(struct cne_pktdev *dev)
void pktdev_register(struct pktdev_driver *driver)
TAILQ_ENTRY(pktdev_driver) next
pktdev_probe_t * probe
Definition: pktdev_driver.h:43
const char * name
Definition: pktdev_driver.h:42