DPDK  19.08.0-rc0
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_pci.h>
21 #include <rte_memory.h>
22 #include <rte_mempool.h>
23 #include <rte_ether.h>
24 
25 #include <rte_kni_common.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 struct rte_kni;
32 struct rte_mbuf;
33 
37 struct rte_kni_ops {
38  uint16_t port_id; /* Port ID */
39 
40  /* Pointer to function of changing MTU */
41  int (*change_mtu)(uint16_t port_id, unsigned int new_mtu);
42 
43  /* Pointer to function of configuring network interface */
44  int (*config_network_if)(uint16_t port_id, uint8_t if_up);
45 
46  /* Pointer to function of configuring mac address */
47  int (*config_mac_address)(uint16_t port_id, uint8_t mac_addr[]);
48 
49  /* Pointer to function of configuring promiscuous mode */
50  int (*config_promiscusity)(uint16_t port_id, uint8_t to_on);
51 };
52 
56 struct rte_kni_conf {
57  /*
58  * KNI name which will be used in relevant network device.
59  * Let the name as short as possible, as it will be part of
60  * memzone name.
61  */
62  char name[RTE_KNI_NAMESIZE];
63  uint32_t core_id; /* Core ID to bind kernel thread on */
64  uint16_t group_id; /* Group ID */
65  unsigned mbuf_size; /* mbuf size */
66  struct rte_pci_addr addr; /* depreciated */
67  struct rte_pci_id id; /* depreciated */
68 
69  __extension__
70  uint8_t force_bind : 1; /* Flag to bind kernel thread */
71  uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* MAC address assigned to KNI */
72  uint16_t mtu;
73 };
74 
89 int rte_kni_init(unsigned int max_kni_ifaces);
90 
91 
115 struct rte_kni *rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
116  const struct rte_kni_conf *conf, struct rte_kni_ops *ops);
117 
132 int rte_kni_release(struct rte_kni *kni);
133 
146 int rte_kni_handle_request(struct rte_kni *kni);
147 
164 unsigned rte_kni_rx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs,
165  unsigned num);
166 
183 unsigned rte_kni_tx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs,
184  unsigned num);
185 
196 struct rte_kni *rte_kni_get(const char *name);
197 
206 const char *rte_kni_get_name(const struct rte_kni *kni);
207 
221 int rte_kni_register_handlers(struct rte_kni *kni, struct rte_kni_ops *ops);
222 
233 int rte_kni_unregister_handlers(struct rte_kni *kni);
234 
252 int __rte_experimental
253 rte_kni_update_link(struct rte_kni *kni, unsigned int linkup);
254 
258 void rte_kni_close(void);
259 
260 #ifdef __cplusplus
261 }
262 #endif
263 
264 #endif /* _RTE_KNI_H_ */
int __rte_experimental rte_kni_update_link(struct rte_kni *kni, unsigned int linkup)
#define RTE_ETHER_ADDR_LEN
Definition: rte_ether.h:26
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)