PcapPlusPlus
21.05
|
This file and KniDeviceList.h provide PcapPlusPlus C++ wrapper for DPDK KNI (Kernel Network Interace) library (librte_kni). The main propose of the rte_kni library is to provide a way to forward packets received by DPDK application to Linux kernel (a.e. to processes that have opened some kind of a net socket) for further processing and to obtain packets from Linux kernel. The KNI device is the bridge that accomplish the translation between DPDK packets (mbuf) and Linux kernel/socket packets (skbuf). Currently KNI devices report speeds upto 10 GBit/s.
KNI device is a virtual network interface so it can be created and destroyed programmatically at will. As a real network interface KNI deivice must be managed appropriately like other interfaces. To start operate it MUST be given an IP address for example by the means of ip a command and MUST be put up for example by ip l set [interface] up.
Additionally KNI interfaces support 4 other settings (depends on DPDK version used):
More...
#include <string>
#include "Device.h"
#include "MacAddress.h"
#include "MBufRawPacket.h"
#include "LinuxNicInformationSocket.h"
Go to the source code of this file.
Classes | |
class | pcpp::KniDevice |
struct | pcpp::KniDevice::KniIoctlCallbacks |
New callbacks for KNI device events. This structure MUST be used ONLY when KniDeviceList::callbackVersion returns KniDeviceList::KniCallbackVersion::CALLBACKS_NEW. Or if You are sure that DPDK version used is 17.11 or higher. If some callback is not provided (NULL) the request will always succeeds if other is not specified in callback description. More... | |
struct | pcpp::KniDevice::KniOldIoctlCallbacks |
Old callbacks for KNI device events. This structure MUST be used ONLY when KniDeviceList::callbackVersion returns KniDeviceList::KniCallbackVersion::CALLBACKS_OLD. Or if You are sure that DPDK version used is lower than 17.11. If some callback is not provided (NULL) the request will always succeeds. More... | |
struct | pcpp::KniDevice::KniDeviceConfiguration |
KNI device initialization data. Used to create new KNI device. Usage of callbacks member or oldCallbacks member is defined by result of KniDeviceList::callbackVersion. More... | |
Namespaces | |
pcpp | |
The main namespace for the PcapPlusPlus lib. | |
Typedefs | |
typedef bool(* | pcpp::OnKniPacketArriveCallback) (MBufRawPacket *packets, uint32_t numOfPackets, KniDevice *device, void *userCookie) |
This file and KniDeviceList.h provide PcapPlusPlus C++ wrapper for DPDK KNI (Kernel Network Interace) library (librte_kni). The main propose of the rte_kni library is to provide a way to forward packets received by DPDK application to Linux kernel (a.e. to processes that have opened some kind of a net socket) for further processing and to obtain packets from Linux kernel. The KNI device is the bridge that accomplish the translation between DPDK packets (mbuf) and Linux kernel/socket packets (skbuf). Currently KNI devices report speeds upto 10 GBit/s.
KNI device is a virtual network interface so it can be created and destroyed programmatically at will. As a real network interface KNI deivice must be managed appropriately like other interfaces. To start operate it MUST be given an IP address for example by the means of ip a command and MUST be put up for example by ip l set [interface] up.
Additionally KNI interfaces support 4 other settings (depends on DPDK version used):
Changes of each of this settings generates an event/request that must be handled by an application that have created the KNI device in 3 second period or it will be rejected and Linux kernel will not apply the change. The way that this requests MUST be handeled is defined by DPDK and so for each type of request the application tht creates the KNI device must provide the callback function to call. This callbacks are set in time of KNI device creation via KniIoctlCallbacks or KniOldIoctlCallbacks structures (the structure used is dependent on DPDK version).
There is a way to enable ethtool on KNI devices that include recompilation of DPDK and strict correspondence between KNI port id and DPDK port id, but it is not currently supported by PcapPlusPlus.
Known issues:
Usefull links: