Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises: Lab 4 (Network Packet Filtering)

Similar presentations


Presentation on theme: "Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises: Lab 4 (Network Packet Filtering)"— Presentation transcript:

1 Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises: Lab 4 (Network Packet Filtering)

2 4-2 Lab # 4: Network Packet Filtering An overview

3 4-3 Lab Goals Objective Learning parallel programming using threads Utilizing many core systems efficiently Performance measurement Packet capture / filter / analyze - A case study We will use series of labs to achieve our objectives. Today’s lab is about packet filtering

4 4-4 Prerequisites Sniffing Capturing of network packets arriving or departing from a network interface Mechanism We use raw sockets as follows rawSock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)) This system call picks every packet going out or coming in on an Ethernet interface

5 4-5 Prerequisites Testing You can use loop back device as a network interface Use Netperf or MPAC for traffic generation on the network interface

6 4-6 Lab Setup 0246 1357 0246 1357 SenderReceiver Packet Sniffer 1 GigE Link System 1System 2 Data Packets Core Packet Mapping to Cores

7 4-7 Sniffing Labs Framework Sniffing One thread, called the dispatcher, sniffs the packets from the interface and puts it in one of the workers’ queues Filtering / Analysis Any kind of processing on a packet is the responsibility of the workers Each worker has its own queue or shared queue depending on sniffer application architecture Dispatcher assigns packets to worker queues

8 4-8 Lab 4 – Packet Filtering Objective Use different packet header information to sniff specific type of packets Mechanism Use different sniffer application architectures to compare the performance of these architectures Dispatcher will sniff frames and will put in worker queues in round-robin fashion User will specify source IP, destination IP, source port and destination port for filtering in TCP packets

9 4-9 Lab 4 – Packet Filtering Mechanism Each worker will process packets residing in its queues Observations Observer the throughput performance with increasing number of threads Compare the throughput with lab 3 throughput Use core affinity and observe throughput

10 4-10 Sniffer Application Architecture MPAC packet sniffer version 1 Single queue Dispatcher can access whole queue Each worker thread can access only dedicated locations In-situ sniffing No copying from dispatcher to worker space Each location access is mutually exclusive Controlled by a flag per location No locking overhead Get packet, if flag = 1 (workers) Location Access Function = Put packet, if flag = 0 (Dispatcher)

11 4-11 T1T1 T0T0 T N-1 T1T1 T0T0 T1T1 T0T0 T1T1 T0T0 Dispatcher putting space Dispatcher putting direction Workers getting direction TNTN Worker Threads MPAC Packet Sniffer (Version 1)

12 4-12 Compile and Run $ netserver $ netperf –H -l $ cd / /mpac_1.2/apps/sniffer/sniffer_1Q/ $ make clean $ make $./mpac_sniffer_app – n – d – f – e 4

13 4-13 Throughput Bottlenecks Scanning of whole queue according to the status of flag Large stride size Needed more cache coherency

14 4-14 Sniffer Application Architecture MPAC Sniffer Version 2 Queue size distributed between worker threads Dispatcher can access whole queue Each worker thread can access only dedicated sub-queue In-situ sniffing No copying from dispatcher to worker space Mutually exclusion is assured by get and set indices ( get chases set ) Location access directions No locking overhead Get packet, if get < set (workers) Location Access Function = Put packet, if get ≤ set ( Dispatcher) Wait, otherwise

15 4-15 Dispatcher putting direction Workers getting direction TNTN Worker Threads T N-1 T2T2 T1T1 T0T0 Dispatcher putting space MPAC Packet Sniffer (Version 2 & 3)

16 4-16 Compile and Run $ cd / /mpac_1.2/apps/sniffer/sniffer_MQ/ $ make clean $ make $./mpac_sniffer_app – n – d – f – e 4

17 4-17 Throughput Bottlenecks Sniffing functions try to get a packet (of specific type) on their own Duplicate capturing Sniffing functions have high coupling and low cohesion

18 4-18 Sniffer Application Architecture MPAC Packet Sniffer Version 3 Data structures and algorithm same as that of version 2 Packet sniffing functions are optimized for maximum throughput No duplicate sniffing Packet type (IP, ARP, etc.) identification removed from these functions Conditionally perform computations on available packet Main logic responsible for packet type checking

19 4-19 Compile and Run $ cd / /mpac_1.2/apps/sniffer/sniffer_MQ_optimized/ $ make clean $ make $./mpac_sniffer_app – n – d – f – e 4

20 4-20 Lab 4 – Five Tuple comparison (MPAC sniffer version 3)


Download ppt "Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises: Lab 4 (Network Packet Filtering)"

Similar presentations


Ads by Google