From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2C01B1B23D for ; Thu, 19 Oct 2017 17:21:51 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Oct 2017 08:21:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,402,1503385200"; d="scan'208";a="1207651945" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by fmsmga001.fm.intel.com with ESMTP; 19 Oct 2017 08:21:49 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.180]) by irsmsx110.ger.corp.intel.com ([163.33.3.25]) with mapi id 14.03.0319.002; Thu, 19 Oct 2017 16:21:48 +0100 From: "Van Haaren, Harry" To: Xueming Li , "Wu, Jingjing" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [RFC PATCH 0/2] using scapy to generate packet templates Thread-Index: AQHTSOOtYE9MwXJgaUOZ1bK3KOVzxKLrRwpw Date: Thu, 19 Oct 2017 15:21:47 +0000 Message-ID: References: <20171019140649.26668-1-xuemingl@mellanox.com> In-Reply-To: <20171019140649.26668-1-xuemingl@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTkxMzQzNzgtOWVkOC00MTdmLTkwMjUtM2Q0MjExMmJmZjE0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImdRM1A2bU9QWFhtYWJiXC9nN3hSZEhWNStrd3Bzd0swVUVnd0xGZytXenBVPSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [RFC PATCH 0/2] using scapy to generate packet templates X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Oct 2017 15:21:52 -0000 > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xueming Li > Sent: Thursday, October 19, 2017 3:07 PM > To: Wu, Jingjing > Cc: Xueming Li ; dev@dpdk.org > Subject: [dpdk-dev] [RFC PATCH 0/2] using scapy to generate packet templa= tes Hi, First off - cool to make DPDK more dynamic with Scapy, and I see value in "somehow" enabling DPDK with Scapy. > The target is to make testpmd flexible to generate all kinds of packet > in just one line. Examples: >=20 > # send UDP packet to port 0 queue 0 > testpmd> scapy 0 Ether()/IP()/UDP()/"hello_world" >=20 > # send 4 L3 VXLAN packets with inner UDP dport 1-4 to port 1 queue 1-4, o= ne > packet per queue > testpmd> scapy 1 Ether()/IP()/UDP()/VXLAN()/IPv6()/UDP(dport=3D(1,4))/"co= ol" >=20 > # Random > testpmd> scapy 2 > Ether(src=3DRandMAC())/IP(dst=3DRandIP())/TCP(sport=3DRandShort(),dport= =3D0x1234) >=20 > This patch introduce scapy - a python tool to generate static packet > templates. > Txonly forwarding mode is modified to support template if available. Testpmd is a good use-case, but perhaps we're limiting the scope of DPDK/Sc= apy if we only integrate with Testpmd. What if I wanted to easily generate some= traffic from a sample app? As a suggestion, what about building a library that provides Scapy function= ality, allowing any application to easily generate mbufs using the rte_scapy* func= tions: /* demo usage */ rte_scapy *scapy =3D rte_scapy_init(); rte_mbuf *m =3D rte_scapy_mbuf_from_str(scapy, "Ether()/IP()/UDP()"); Testpmd could then use the rte_scapy library, passing in any parameters after testpmd> scapy command as a string? Had you already considered this library type design? > Two new configuration: > CONFIG_RTE_TEST_PMD_SCAPY=3Dy > CONFIG_RTE_PYTHON=3Dpython2.7 >=20 > Scapy quick demo: http://www.secdev.org/projects/scapy/demo.html >=20 > There are 2 other potential solution to support more fancy sending in the > future: > 1. Invoke scapy and expose mbuf hugepage pointers to python > This should allow more flexible and dynamic processing > 2. Scapy uses wrapped DPDK port as regular port > Make scapy capable to send high speed streams. Not a strong opinion, but a gut feeling; I see more value in generating packets with Python and using them from C than giving Python full access to DPDK internals and hugepages. Regards, -Harry > Xueming Li (2): > app/testpmd: add packet template > app/testpmd: add scapy command as pkt template >=20 > app/test-pmd/Makefile | 5 +++ > app/test-pmd/cmdline.c | 99 > +++++++++++++++++++++++++++++++++++++++++++++++++- > app/test-pmd/testpmd.c | 3 ++ > app/test-pmd/testpmd.h | 1 + > app/test-pmd/txonly.c | 42 +++++++++++++-------- > config/common_base | 2 + > 6 files changed, 135 insertions(+), 17 deletions(-) >=20 > -- > 2.13.3