DPDK  22.11.5
rte_kni.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #ifndef _RTE_KNI_H_
6 #define _RTE_KNI_H_
7 
20 #include <rte_compat.h>
21 #include <rte_pci.h>
22 #include <rte_ether.h>
23 
24 #include <rte_kni_common.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct rte_kni;
31 struct rte_mbuf;
32 
36 struct rte_kni_ops {
37  uint16_t port_id; /* Port ID */
38 
39  /* Pointer to function of changing MTU */
40  int (*change_mtu)(uint16_t port_id, unsigned int new_mtu);
41 
42  /* Pointer to function of configuring network interface */
43  int (*config_network_if)(uint16_t port_id, uint8_t if_up);
44 
45  /* Pointer to function of configuring mac address */
46  int (*config_mac_address)(uint16_t port_id, uint8_t mac_addr[]);
47 
48  /* Pointer to function of configuring promiscuous mode */
49  int (*config_promiscusity)(uint16_t port_id, uint8_t to_on);
50 
51  /* Pointer to function of configuring allmulticast mode */
52  int (*config_allmulticast)(uint16_t port_id, uint8_t to_on);
53 };
54 
58 struct rte_kni_conf {
59  /*
60  * KNI name which will be used in relevant network device.
61  * Let the name as short as possible, as it will be part of
62  * memzone name.
63  */
64  char name[RTE_KNI_NAMESIZE];
65  uint32_t core_id; /* Core ID to bind kernel thread on */
66  uint16_t group_id; /* Group ID */
67  unsigned mbuf_size; /* mbuf size */
68  struct rte_pci_addr addr; /* deprecated */
69  struct rte_pci_id id; /* deprecated */
70 
71  __extension__
72  uint8_t force_bind : 1; /* Flag to bind kernel thread */
73  uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* MAC address assigned to KNI */
74  uint16_t mtu;
75  uint16_t min_mtu;
76  uint16_t max_mtu;
77 };
78 
93 int rte_kni_init(unsigned int max_kni_ifaces);
94 
95 
119 struct rte_kni *rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
120  const struct rte_kni_conf *conf, struct rte_kni_ops *ops);
121 
136 int rte_kni_release(struct rte_kni *kni);
137 
150 int rte_kni_handle_request(struct rte_kni *kni);
151 
168 unsigned rte_kni_rx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs,
169  unsigned num);
170 
187 unsigned rte_kni_tx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs,
188  unsigned num);
189 
200 struct rte_kni *rte_kni_get(const char *name);
201 
210 const char *rte_kni_get_name(const struct rte_kni *kni);
211 
225 int rte_kni_register_handlers(struct rte_kni *kni, struct rte_kni_ops *ops);
226 
237 int rte_kni_unregister_handlers(struct rte_kni *kni);
238 
256 __rte_experimental
257 int
258 rte_kni_update_link(struct rte_kni *kni, unsigned int linkup);
259 
263 void rte_kni_close(void);
264 
265 #ifdef __cplusplus
266 }
267 #endif
268 
269 #endif /* _RTE_KNI_H_ */
__rte_experimental int rte_kni_update_link(struct rte_kni *kni, unsigned int linkup)
#define RTE_ETHER_ADDR_LEN
Definition: rte_ether.h:25
int rte_kni_init(unsigned int max_kni_ifaces)
int rte_kni_unregister_handlers(struct rte_kni *kni)
struct rte_kni * rte_kni_get(const char *name)
int rte_kni_register_handlers(struct rte_kni *kni, struct rte_kni_ops *ops)
unsigned rte_kni_rx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs, unsigned num)
void rte_kni_close(void)
int rte_kni_handle_request(struct rte_kni *kni)
unsigned rte_kni_tx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs, unsigned num)
struct rte_kni * rte_kni_alloc(struct rte_mempool *pktmbuf_pool, const struct rte_kni_conf *conf, struct rte_kni_ops *ops)
const char * rte_kni_get_name(const struct rte_kni *kni)
int rte_kni_release(struct rte_kni *kni)