Overview Shaping is a basic and fundamental function in any network. Shaping means control and management of traffic in a network. In IP network, data and information can be sent from one point of network to another points of network using internet framework, which consists of numerous routers, cables, radio resources and many more resources … Continue reading Shaping function in IP network
Receive side scaling (RSS)
Reference http://galsagie.github.io/2015/02/26/dpdk-tips-1/ https://www.ndsl.kaist.edu/~kyoungsoo/papers/TR-symRSS.pdf What is RSS? Receive side scaling (RSS) is a network driver technology that enables the efficient distribution of network receive processing across multiple CPUs in multiprocessor systems. What it does is issue a hash function with a predefined hash key on every packet coming in. The hash function takes the packet IP … Continue reading Receive side scaling (RSS)
IP Packet dump and related utilities
IP packet dump typedef std::basic_string<uint8_t> Packet; void hexdump(const Packet& pkt) { unsigned j=0; for(Packet::const_iterator i=pkt.begin(); i != pkt.end(); ++i) { printf("%02x ", *i); ++j; if(j==8) { printf(" "); } else if(j==16) { j=0; printf("\n"); } } printf("\n"); } ///////////////Alternate///////////////void hexdump(buf, size){ unsigned i; unsigned j=0; for (i=0; i< size; i++) { printf("%02x ", data_pkt[i]); j++; … Continue reading IP Packet dump and related utilities
Raw packet program
Reference https://stackoverflow.com/questions/21411851/how-to-send-data-over-a-raw-ethernet-socket-using-sendto-without-using-sockaddr Example #include <stdlib.h> #include <ctype.h> #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <linux/if.h> #include <linux/if_packet.h> #include <linux/if_ether.h> #include <stdio.h> #include <arpa/inet.h> int main() { char* ifname = "enp2s0"; unsigned char srcMac[6]; //unsigned char dstMac[6] = {0, 0xDE, 0xAD, 0xBE, 0xEF, 0}; //00:e0:4c:68:3c:3b (enp3s0, 192.168.0.113) unsigned char dstMac[6] = {0, 0xE0, 0x4C, … Continue reading Raw packet program
Ubuntu 20.04 LTS
Check the release cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS" /etc/apt/sources.list deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted deb http://us.archive.ubuntu.com/ubuntu/ focal universe deb http://us.archive.ubuntu.com/ubuntu/ focal-updates universe deb http://us.archive.ubuntu.com/ubuntu/ focal multiverse deb http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse deb http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu focal-security main restricted deb http://security.ubuntu.com/ubuntu focal-security universe deb … Continue reading Ubuntu 20.04 LTS
ASM Code with C
Reference Gcc Gnu Site
Printf 64 bits data-type in C
For int64_t type #include <inttypes.h> int64_t t; printf("%" PRId64 "\n", t); For uint64_t type #include <inttypes.h> uint64_t t; printf("%" PRIu64 "\n", t); Use PRIx64 to print in hexadecimal Refer: http://en.cppreference.com/w/cpp/types/integer Refer: https://stackoverflow.com/questions/9225567/how-to-print-a-int64-t-type-in-c#:~:text=for%20uint64_t%20type%3A,PRIx64%20to%20print%20in%20hexadecimal. Sizeof char c; printf("%zu,%zu\n", sizeof c, sizeof (int));
DPDK-Procinfo and multi-process
Memory sharing between DPDK Multi-process Refer: https://doc.dpdk.org/guides/prog_guide/multi_proc_support.html DPDK-Procinfo as secondary process Default DPDK EAL arguments for dpdk-procinfo are -c1, -n4 & --proc-type=secondary Refer: https://doc.dpdk.org/guides-18.08/tools/proc_info.html Modify dpdk-helloworld to create mempool and rte-ring DPDK helloword application "dpdk-stable-19.11.2/examples/helloworld" is a primary proc type. This is modified to create a rte-mempool, and a rte_ring to use that mempool to enqueue and dequeue message from mempool. … Continue reading DPDK-Procinfo and multi-process
Realtek Ethernet driver r8169
Check the Driver version in Ubuntu $ uname -r 5.4.0-39-generic $ lsmod |grep r8169 r8169 90112 0 $ modinfo r8169 filename: /lib/modules/5.4.0-39-generic/kernel/drivers/net/ethernet/realte k/r8169.ko firmware: rtl_nic/rtl8125a-3.fw firmware: rtl_nic/rtl8107e-2.fw firmware: rtl_nic/rtl8107e-1.fw firmware: rtl_nic/rtl8168h-2.fw firmware: rtl_nic/rtl8168h-1.fw firmware: rtl_nic/rtl8168g-3.fw firmware: rtl_nic/rtl8168g-2.fw firmware: rtl_nic/rtl8106e-2.fw firmware: rtl_nic/rtl8106e-1.fw firmware: rtl_nic/rtl8411-2.fw firmware: rtl_nic/rtl8411-1.fw firmware: rtl_nic/rtl8402-1.fw firmware: rtl_nic/rtl8168f-2.fw firmware: rtl_nic/rtl8168f-1.fw firmware: rtl_nic/rtl8105e-1.fw firmware: rtl_nic/rtl8168e-3.fw … Continue reading Realtek Ethernet driver r8169
DPDK test application and ideas
TestPmd DPDK Tools sudo apt install dpdk dpdk-devbind.py -s Install DPDK LTS http://fast.dpdk.org/rel/dpdk-19.11.2.tar.xz // or any other LTS release (say dpdk-stable-18.11.8) tar xvf dpdk-19.11.2.tar.xz Install make and other package sudo apt install make sudo apt install gcc sudo apt-get install libnuma-dev (numa.h) sudo apt-get install libpcap0.8-dev (pcap.h, useful sometimes) Build TestPmd sudo bash cd <>/dpdk-stable-19.11.2/usertools … Continue reading DPDK test application and ideas