CNDP 22.08.0
Loading...
Searching...
No Matches
pktdev_core.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_CORE_H_
6#define __PKTDEV_CORE_H_
7
8#include <stdbool.h>
19
20/*
21 * Definitions of all functions exported by an Ethernet driver through the
22 * the generic structure of type *pktdev_ops* supplied in the *cne_pktdev*
23 * structure associated with an Ethernet device.
24 */
25struct cne_pktdev;
26
27typedef int (*pkt_dev_start_t)(struct cne_pktdev *dev);
29
30typedef void (*pkt_dev_stop_t)(struct cne_pktdev *dev);
32
33typedef int (*pkt_dev_admin_st_up_t)(struct cne_pktdev *dev);
35
36typedef int (*pkt_dev_admin_st_down_t)(struct cne_pktdev *dev);
38
39typedef void (*pkt_dev_close_t)(struct cne_pktdev *dev);
41
42typedef int (*pkt_dev_infos_get_t)(struct cne_pktdev *dev, struct pktdev_info *dev_info);
44
45typedef int (*eth_link_update_t)(struct cne_pktdev *dev, int wait_to_complete);
47
48typedef int (*eth_stats_get_t)(struct cne_pktdev *dev, lport_stats_t *igb_stats);
50
70typedef int (*eth_stats_reset_t)(struct cne_pktdev *dev);
71
82typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
83
96typedef uint16_t (*eth_rx_burst_t)(void *rxq, pktmbuf_t **rx_pkts, uint16_t nb_pkts);
97
110typedef uint16_t (*eth_tx_burst_t)(void *txq, pktmbuf_t **tx_pkts, uint16_t nb_pkts);
111
124typedef uint16_t (*eth_tx_prep_t)(void *txq, pktmbuf_t **tx_pkts, uint16_t nb_pkts);
125
136typedef int (*eth_mac_addr_set_t)(struct cne_pktdev *dev, struct ether_addr *mac_addr);
137
150typedef int (*eth_pkt_alloc)(struct cne_pktdev *dev, pktmbuf_t **bufs, uint16_t nb_pkts);
151
156 PKTDEV_UNUSED = 0,
158};
159
163struct pktdev_ops {
164 pkt_dev_admin_st_up_t admin_state_up;
165 pkt_dev_admin_st_down_t admin_state_down;
166 pkt_dev_close_t dev_close;
167 pkt_dev_infos_get_t dev_infos_get;
168 eth_mac_addr_set_t mac_addr_set;
169 eth_link_update_t link_update;
170 eth_stats_get_t stats_get;
171 eth_stats_reset_t stats_reset;
172 eth_tx_done_cleanup_t tx_done_cleanup;
173 eth_pkt_alloc pkt_alloc;
174};
175
186struct cne_pktdev {
187 eth_rx_burst_t rx_pkt_burst;
188 eth_tx_burst_t tx_pkt_burst;
189 eth_tx_prep_t tx_pkt_prepare;
190 struct pktdev_data *data;
191 struct pktdev_driver *drv;
192 void *process_private;
193 const struct pktdev_ops *dev_ops;
194 enum pktdev_state state;
196
197extern struct cne_pktdev pktdev_devices[CNE_MAX_ETHPORTS];
198
199#define PKTDEV_NAME_MAX_LEN 16
207struct pktdev_data {
208 char name[PKTDEV_NAME_MAX_LEN];
209 char ifname[PKTDEV_NAME_MAX_LEN];
210 void *rx_queue;
211 void *tx_queue;
212 bool admin_state;
213 void *dev_private;
214 uint32_t min_rx_buf_size;
215 struct ether_addr *mac_addr;
216 uint16_t lport_id;
217 uint16_t numa_node;
218 struct offloads *offloads;
220
226extern struct cne_pktdev cne_pktdevices[];
227
228#endif /* __PKTDEV_CORE_H_ */
#define __cne_cache_aligned
Definition cne_common.h:379
pktdev_state
@ PKTDEV_ACTIVE