From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91433A04A3; Mon, 4 Nov 2019 06:33:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 82B9758C4; Mon, 4 Nov 2019 06:33:25 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 1F1F03256 for ; Mon, 4 Nov 2019 06:33:22 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2019 21:33:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,266,1569308400"; d="scan'208";a="199917235" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga008.fm.intel.com with ESMTP; 03 Nov 2019 21:33:22 -0800 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 3 Nov 2019 21:33:21 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.225]) with mapi id 14.03.0439.000; Mon, 4 Nov 2019 13:33:20 +0800 From: "Chen, Zhaoyan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Ma, LihongX" , "Chen, Zhaoyan" Thread-Topic: [dts] [PATCH V2 2/3][nsh] framework/packet: add support of nsh and mpls Thread-Index: AQHVgxdmH6BeYi2xGU+oaARTloM7NKd6nINw Date: Mon, 4 Nov 2019 05:33:19 +0000 Message-ID: <9DEEADBC57E43F4DA73B571777FECECA41E0F187@SHSMSX104.ccr.corp.intel.com> References: <1571089742-7077-1-git-send-email-lihongx.ma@intel.com> <1571089742-7077-2-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1571089742-7077-2-git-send-email-lihongx.ma@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWU3MmE1ZTktM2FlNC00N2Y4LTg0OGMtYjA3NjlmMzZhYjI5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRkNXWnZSTnA3eUJhTDhcL2hpOXpvNnlkcmQxbFVKVnBiRThXdmp6cEhSWVVVMG1JVkh1Q0p6MjhzRitDSXZMUDcifQ== dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V2 2/3][nsh] framework/packet: add support of nsh and mpls X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Acked-by: Chen, Zhaoyan Regards, Zhaoyan Chen > -----Original Message----- > From: dts On Behalf Of lihong > Sent: Tuesday, October 15, 2019 5:49 AM > To: dts@dpdk.org > Cc: Ma, LihongX > Subject: [dts] [PATCH V2 2/3][nsh] framework/packet: add support of nsh a= nd > mpls >=20 > Signed-off-by: lihong > --- > framework/packet.py | 32 +++++++++++++++++++++++++++++++- > 1 file changed, 31 insertions(+), 1 deletion(-) >=20 > diff --git a/framework/packet.py b/framework/packet.py index 05b2367..2ce= ed06 > 100755 > --- a/framework/packet.py > +++ b/framework/packet.py > @@ -53,6 +53,8 @@ from vxlan import VXLAN from nvgre import NVGRE, > IPPROTO_NVGRE from lldp import LLDP, LLDPManagementAddress from > Dot1BR import Dot1BR > +from nsh import NSH > +from mpls import MPLS >=20 > from utils import convert_ip2int > from utils import convert_int2ip > @@ -64,7 +66,7 @@ from utils import get_backtrace_object PACKETGEN =3D > "scapy" >=20 > LayersTypes =3D { > - "L2": ['ether', 'vlan', 'etag', '1588', 'arp', 'lldp'], > + "L2": ['ether', 'vlan', 'etag', '1588', 'arp', 'lldp', 'mpls', > + 'nsh'], > # ipv4_ext_unknown, ipv6_ext_unknown > "L3": ['ipv4', 'ipv4ihl', 'ipv6', 'ipv4_ext', 'ipv6_ext', 'ipv6_ext2= ', 'ipv6_frag'], > "L4": ['tcp', 'udp', 'frag', 'sctp', 'icmp', 'nofrag'], @@ -107,6 +1= 09,8 @@ class > scapy(object): > 'gre': GRE(), > 'raw': Raw(), > 'vxlan': VXLAN(), > + 'nsh': NSH(), > + 'mpls': MPLS(), >=20 > 'inner_mac': Ether(), > 'inner_vlan': Dot1Q(), > @@ -321,6 +325,30 @@ class scapy(object): > def vxlan(self, pkt_layer, vni=3D0): > pkt_layer.vni =3D vni >=20 > + def nsh(self, pkt_layer, ver=3D0, oam=3D0, critical=3D0, reserved=3D= 0, len=3D0, mdtype=3D1, > nextproto=3D3, > + nsp=3D0x0, nsi=3D1, npc=3D 0x0, nsc=3D 0x0, spc=3D 0x0, ssc= =3D 0x0): > + pkt_layer.Ver =3D ver > + pkt_layer.OAM =3D oam > + pkt_layer.Critical =3D critical > + pkt_layer.Reserved =3D reserved > + if len !=3D 0: > + pkt_layer.Len =3D len > + pkt_layer.MDType =3D mdtype > + pkt_layer.NextProto =3D nextproto > + pkt_layer.NSP =3D nsp > + pkt_layer.NSI =3D nsi > + if mdtype =3D=3D 1: > + pkt_layer.NPC =3D npc > + pkt_layer.NSC =3D nsc > + pkt_layer.SPC =3D spc > + pkt_layer.SSC =3D ssc > + > + def mpls(self, pkt_layer, label=3D0, cos=3D0, s=3D0, ttl=3D64): > + pkt_layer.label =3D label > + pkt_layer.cos =3D cos > + pkt_layer.s =3D s > + pkt_layer.ttl =3D ttl > + >=20 > class Packet(object): >=20 > @@ -700,6 +728,8 @@ class Packet(object): > 'GRE': 'gre', > 'VXLAN': 'vxlan', > 'PKT': 'raw', > + 'MPLS': 'mpls', > + 'NSH': 'nsh', > } >=20 > layers =3D self.pkt_type.split('_') > -- > 2.7.4