How to port DPDK based application to Netmap? - c

I have a DPDK based network application for linux based systems. I want to port it to netmap to overcome my restriction of using Intel based NICs. In my DPDK based application I'm using some libraries (like rte_ring, rte_mempool, rte_hash, etc.) provided by DPDK. Is there any way I can still use them or do I have to replace them with non DPDK libraries. What will be quickest and best way to port the application to Netmap?

The easiest way is to leave your application as is, but instead use a DPDK's paravirtualized driver (i.e. virtio-net or vmxnet3) or one of DPDK's pure software PMDs (i.e. af_packet, tap or pcap).
Here is the link to the DPDK NIC Driver documentation for more information:
http://dpdk.org/doc/guides/nics/index.html

There are 2 parts to your question
netmap to overcome my restriction of using Intel-based NIC
DPDK based application I'm using some libraries (like rte_ring, rte_mempool, rte_hash, etc.) provided by DPDK
[Answer-1] List of NIC supported in most of the kernel under netmap are i40e, e1000, igb, ixgbe, ixgbevf, e1000e, veth, virtio_net, vmxnet3, forcedeth, r816. link to github netmap. Hence officially non intel NIC is mxl5.
[Answer-2] with regards to port, I highly recommend check sample netmap in DPDK 16.05. This will give clues how to replace RX-TX burst with netmap while using DPDK libraries. If DPDK libraries are to be fully removed, please try to use uapi supported linked list, hash tables etc.

Related

Socketcan Driver implementation

I am new to creating a driver implementing.
My Application is using socketcan interface and apparently socketcan is not supported by the SOC.
I am planning to write my own driver. The issue I know how simple module for kernel I am not pretty sure where to start for socketcan driver .
If someone can please tell me where can I take reference for building the CAN driver or some git repo where can I use it and any specifics while writing the driver
SocketCan is the name of a Linux subsystem. It can be enabled in the kernel config via CONFIG_CAN. In turn, this subsystem will make use of platform-specific drivers to control the SOC's CAN adapters (if any).
If Linux's CAN subsystem is not enabled, make sure to enable CONFIG_CAN. If it is enabled, and no "can" device show up, the best would likely be to contact the SOC vendor for further guidance / drivers / devicetree / ... In any case, writing a custom driver is probably not necessary here.

Using N3000 Intel FPGA as smart NIC

Is it possible to use N3000 Intel FPGA Network accelerator card as Smart NIC ?
if yes can somebody share the details ?
We would want to use it as Smart NIC using dpdk based poll mode driver
Please check Programming FPGA with DPDK. Hence the right way is to check with Intel network builder for sample code for RTL images for N3000 having ACL, Tunnel termination and others.

how to send QMI api request to the device (like Sierra Wireless Card) by C

I am reading the QMI software API now since we will use QMI instead of AT commands. Based on the api, I know QMI imports C library to talk with device. My question is that how does it talk with device exactly?
Before I was using AT commands, I can use serialPort to send AT commands string to the device and get the response. But for now I will move into C library, like
ULONG QCWWAN2KConnect(CHAR * pDeviceID, CHAR * pDeviceKey);
How does this prototye work and how can I send this to the device? Using serialPort as well?
I really need some experts to give me an simple example for it. Thanks
It really depends on whether you're using the GobiNet kernel driver (i.e. the 'official' out-of-tree driver given by manufacturers) or the qmi_wwan kernel driver (i.e. the 'unofficial in-tree' driver). If you're targeting to use the GobiAPI library (or a vendor specific one, like the Sierra SDK) then you're likely going to use GobiNet. See this blogpost for more information about the differences.
GobiNet doesn't use serial ports; instead it will use either:
A non-serial character device exposed, named something like /dev/qcqmi0
shared memory to talk betwen kernel and userspace (e.g. in newer Android devices).
In your case, you'll likely see the qcqmi device, so the GobiAPI/SDK will use that character device to send QMI commands to the device.
If you instead want to use the upstream qmi_wwan driver, you can use it with the libqmi library and its helper qmicli tool.

Communicate between two systems using only MAC address

I want to know how to communicate between two systems using only MAC address using C program (without using IP address). I think this is raw ethernet communication. My requirement is to send data from client to server only by using the MAC address. May be this can be done by creating our own raw ethernet frame.
Please help me regarding this. If anybody has written code in C, please share.
This link may help you, http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html
The libpcap library allows you to assemble raw Ethernet packets and send them directly to an adapter: the hardest part being the discovery of the correct adapter. This is designed for C/C++ usage on most platforms (Win PCAP etc.).
Be sure this is what you want though: I have seen several projects where raw Ethernet packet interfaces have been used, only for more and more protocol to be put in place for re-transmission and windowing etc. until you end up with your own version of TCP/IP (only one that hasn't been tested by millions of people using Windows/Linux or whatever your platform is). Most Ethernet chips have functions to accelerate TCP/IP stacks these days too: so you will be missing out on that too.
Here are examples for C#, maybe you can leverage this. The right code depends on OS and even from the used chips when programming for microcontrollers.

Does lwIP support Zeroconf?

I see that lwIP has some AutoIP (aka IPv4LL, aka RFC 3927) code, but I can't tell if it does anything higher up in the Zeroconf stack, namely mDNS and DNS-SD (with RFC 2782).
So, does lwIP support DNS-SD service discovery? If not, would it be easy to port code from a project like Avahi that does (assuming licensing allows it)?
No, lwIP does not support any part of Zeroconf except AutoIP.
I've not looked at Avahi but porting Apples mDNSResponder to lwIP
is quite straightforward. There is one bit of nastiness where you
have to pull back the pbuf headers to access the IP header to get the
sender IP (I think a "proper" method for this is in the works
for lwIP but AFAIK it's not in a release yet).
With mDNSResponder you get both service advertisment and discovery.
I can't comment on the LWIP part of your question (the last time I used LWIP it didn't even have IPv4LL support), but you might be interested to know that Apple have open-sourced their mDNSResponder code, available from here:
http://developer.apple.com/networking/bonjour
The interesting thing about this implementation is that they provide a VxWorks platform layer which may well be a better match for porting to your embedded target than the Avahi library.
The lwIP web site has a task tracker with the following three items (it looks as though they were added around 2010, around the time this question was originally asked):
Add "One shot" Multicast DNS Queries (.local) to dns.c
Marked done, Dec 2016. It provides a subset of ZeroConf functionality. It is not a complete solution, but could be a good basis to build upon.
Create "mDNSQuerier" module to support multiple response and continuous Multicast DNS queries
Create multicast DNS Responder module enabling LwIP applications to support multicast DNS host name resoltuion
On 28 August 2015, these latter two tickets were marked "Cancelled" with the note "Cancelled since noone seems to want to work on this."
Here is a very small mDNS responder which can be ported rather easily to lwIP:
https://bitbucket.org/geekman/tinysvcmdns
Apples mDNSResponder is still rather heavyweight for very small systems (in terms of RAM usage), so if only basic functionality is required this one may be preferred.

Resources