From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10068.outbound.protection.outlook.com [40.107.1.68]) by dpdk.org (Postfix) with ESMTP id 7782B1B7DC for ; Thu, 12 Apr 2018 13:49:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wmv9hzlwy+A25jwq1SjAAPXxMQhtvmoAOrGMEqAgwEs=; b=tMQO95PQVFn47qf15/z3FXzjLwQJeNdsGpKP7NQHob522D51gEwMqinZtOacZr70cIrGLWscKvVxKBaCYsZlQqQlROEJ68/ZsfsgrYa52/dHXt7H8hqASzVZPaF0k9Is8mfPRHTfOrGEqzQLJIxTiq0OoH5ylIayGf8w/6YT5BY= Received: from HE1PR0501MB2314.eurprd05.prod.outlook.com (10.168.34.19) by HE1PR0501MB2508.eurprd05.prod.outlook.com (10.168.126.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Thu, 12 Apr 2018 11:49:08 +0000 Received: from HE1PR0501MB2314.eurprd05.prod.outlook.com ([fe80::d405:aec8:cd2f:85cc]) by HE1PR0501MB2314.eurprd05.prod.outlook.com ([fe80::d405:aec8:cd2f:85cc%18]) with mapi id 15.20.0653.018; Thu, 12 Apr 2018 11:49:08 +0000 From: Ophir Munk To: Vipin Varghese , "dev@dpdk.org" , "pascal.mazon@6wind.com" , "ferruh.yigit@intel.com" , Thomas Monjalon , Olga Shern , Shahaf Shuler Thread-Topic: [dpdk-dev] [PATCH 1/2] net/tap: add tun support Thread-Index: AQHTypscfcCG5aLvi02SSrXdyDUkCaP9DN/A Date: Thu, 12 Apr 2018 11:49:08 +0000 Message-ID: References: <1519625719-10443-1-git-send-email-vipin.varghese@intel.com> <1522705068-18198-1-git-send-email-vipin.varghese@intel.com> In-Reply-To: <1522705068-18198-1-git-send-email-vipin.varghese@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0501MB2508; 7:Sgz/0e7ik1mlcg55UMhWYtUcsibzyYxUHiO1pW+7A24fMvmlafF7GnKW/09p8zz66ET8NuxZAG0ZkPx/Nb3DpvDCCYJ63V5rWcZISmUt9IyWeKyRDkm1Hi7BC93FXQC1egMUPxofrsSt3fsq6VfF/qqY8Odp26UWmQ6Uk8F5DeIVk1/p3ekgQMyNHzmDzYdszRy0WOQm2I7yGBmZTjYL4+UMW/k0jUxMelE9KiR0XiIUFsoNZcnNc6mVbeyjZyDd x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2508; x-ms-traffictypediagnostic: HE1PR0501MB2508: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:HE1PR0501MB2508; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2508; x-forefront-prvs: 06400060E1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(39380400002)(376002)(396003)(366004)(189003)(199004)(13464003)(81166006)(2906002)(102836004)(81156014)(53546011)(3846002)(6506007)(76176011)(66066001)(7736002)(5660300001)(6116002)(59450400001)(3280700002)(186003)(14454004)(7696005)(229853002)(6636002)(74316002)(316002)(3660700001)(68736007)(2201001)(110136005)(53936002)(33656002)(305945005)(476003)(106356001)(99286004)(25786009)(2501003)(8936002)(6246003)(446003)(97736004)(2900100001)(9686003)(478600001)(55016002)(5250100002)(486006)(105586002)(11346002)(8676002)(6436002)(86362001)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2508; H:HE1PR0501MB2314.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: gkY6zExL+BUjqXBxPo9vsZ/GsyK6V7XCi6+vQRiOdJwyihvWhNFgtV0KoFOXlC+EYImBM88gzQoj32p9ZYwCVfj3iCKir8PjWxPDodcTAQs6lDEkofj8WRzMWzsNbsyZD6i0L3cOLKzxApFlKohHl3u09/uBuyL1nRZWiF0eZ1Yx8C82BQrP9yFuHLbDnMdi spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9cc2fde5-fb90-41e8-7514-08d5a06b66c5 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cc2fde5-fb90-41e8-7514-08d5a06b66c5 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2018 11:49:08.7704 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2508 Subject: Re: [dpdk-dev] [PATCH 1/2] net/tap: add tun support 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, 12 Apr 2018 11:49:10 -0000 Hi Vipin, This patch (adding TUN to TAP) has been Acked and accepted in next-net bran= ch. I have some questions regarding the implementation (please find below). > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Vipin Varghese > Sent: Tuesday, April 03, 2018 12:38 AM > To: dev@dpdk.org; pascal.mazon@6wind.com; ferruh.yigit@intel.com > Cc: Vipin Varghese > Subject: [dpdk-dev] [PATCH 1/2] net/tap: add tun support >=20 > The change adds functional TUN PMD logic to the existing TAP PMD. > TUN PMD can be initialized with 'net_tunX' where 'X' represents unique id= . > PMD supports argument interface, while MAC address and remote are not > supported. >=20 [...] >=20 > + /* > + * TUN and TAP are created with IFF_NO_PI disabled. > + * For TUN PMD this mandatory as fields are used by > + * Kernel tun.c to determine whether its IP or non IP > + * packets. > + * > + * The logic fetches the first byte of data from mbuf. > + * compares whether its v4 or v6. If none matches default > + * value 0x00 is taken for protocol field. > + */ > + char *buff_data =3D rte_pktmbuf_mtod(seg, void *); > + j =3D (*buff_data & 0xf0); > + if (j & (0x40 | 0x60)) > + pi.proto =3D (j =3D=3D 0x40) ? 0x0008 : 0xdd86; > + 1. Accessing the first byte here assumes it is the first IP header byte (la= yer 3) which is correct for TUN. For TAP however the first byte belongs to Ethernet destination address (lay= er 2).=20 Please explain how this logic will work for TAP. 2. If the first TUN byte contains 0x2X (which is neither IPv4 nor IPv6) it = will end up by setting ip.proto as 0xdd86.=20 Please explain how this logic will work for non-IP packets in TUN