From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) by dpdk.org (Postfix) with ESMTP id CB45AF72 for ; Tue, 22 Dec 2015 00:11:40 +0100 (CET) Received: by mail-pf0-f174.google.com with SMTP id 78so22737347pfw.2 for ; Mon, 21 Dec 2015 15:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=fbVRbVDqyIzHF+028Ubn536lm/UFknWbU/b9DgyDW6Y=; b=I1CEub5SF1x5+SwlG2FKHwmP1T+Fmj3sj7j9D3qhuUez/TjqHMjLEkwLnxlwnAchTe u9rRUmlhXI7wlizCGPjBKf+04sn++ll3v+tpSuioZ0QH+F3VRg04uwx6+5HySzVXoNJS GK//F2XEQb7cEMNEKWi9Kt7k7yitDriLanZQtf5yIfD0GYXhblyZfMeOilJr6xxShMLU mTsKJEATIMi+d51dlzR5h/17qRjX6RYI/CIuJpwh8v8kmHNQI8GYEB4qNu3t/PTRdAN7 2+Ae2uWXfGwezsafoCnjIvYujCyulFS6TuXYO4bHO4C8Bog3uHZ8bgbx+v0zHWs39Lo+ mFaQ== X-Received: by 10.98.15.70 with SMTP id x67mr16858931pfi.149.1450739499910; Mon, 21 Dec 2015 15:11:39 -0800 (PST) Received: from user-PC.hsd1.ca.comcast.net (c-24-130-109-45.hsd1.ca.comcast.net. [24.130.109.45]) by smtp.gmail.com with ESMTPSA id f2sm36852085pfj.30.2015.12.21.15.11.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Dec 2015 15:11:39 -0800 (PST) From: Ravi Kerur To: dev@dpdk.org Date: Mon, 21 Dec 2015 15:11:51 -0800 Message-Id: <1450739511-5868-1-git-send-email-rkerur@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH v1] Modify and modularize l3fwd code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2015 23:11:41 -0000 Many thanks to Intel team (Konstantin, Bruce and Declan) for below proposal to make changes to l3fwd code, their valuable inputs during interal review and help in performance tests. The main problem with l3fwd is that it is too monolithic with everything being in one file, and the various options all controlled by compile time flags. This means that it's hard to read and understand, and when making any changes, you need to go to a lot of work to try and ensure you cover all the code paths, since a compile of the app will not touch large parts of the l3fwd codebase. Following changes were done to fix the issues mentioned above > Split out the various lpm and hash specific functionality into separate files, so that l3fwd code has one file for common code e.g. args processing, mempool creation, and then individual files for the various forwarding approaches. Following are new file lists main.c (Common code for args processing, memppol creation, etc) l3fwd_em.c (Hash/Exact match aka 'EM' functionality) l3fwd_em_sse.h (SSE4_1 buffer optimizated 'EM' code) l3fwd_lpm.c (Longest Prefix Match aka 'LPM' functionality) l3fwd_lpm_sse.h (SSE4_1 buffer optimizated 'LPM' code) l3fwd.h (Common include for 'EM' and 'LPM') > The choosing of the lpm/hash path should be done at runtime, not compile time, via a command-line argument. This will ensure that both code paths get compiled in a single go Following examples show runtime options provided Select 'LPM' or 'EM' based on run time selection f.e. > l3fwd -c 0x1 -n 1 -- -p 0x1 -E ... (EM) > l3fwd -c 0x1 -n 1 -- -p 0x1 -L ... (LPM) Options "E" and "L" are mutualy-exclusive. If none selected, "L" is default. Ravi Kerur (1): Modify and modularize l3fwd code examples/l3fwd/Makefile | 9 +- examples/l3fwd/l3fwd.h | 209 ++++ examples/l3fwd/l3fwd_em.c | 773 ++++++++++++++ examples/l3fwd/l3fwd_em_sse.h | 479 +++++++++ examples/l3fwd/l3fwd_lpm.c | 414 ++++++++ examples/l3fwd/l3fwd_lpm_sse.h | 610 +++++++++++ examples/l3fwd/main.c | 2202 ++++------------------------------------ 7 files changed, 2694 insertions(+), 2002 deletions(-) create mode 100644 examples/l3fwd/l3fwd.h create mode 100644 examples/l3fwd/l3fwd_em.c create mode 100644 examples/l3fwd/l3fwd_em_sse.h create mode 100644 examples/l3fwd/l3fwd_lpm.c create mode 100644 examples/l3fwd/l3fwd_lpm_sse.h -- 1.9.1