From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0A8682B82 for ; Mon, 23 Apr 2018 17:42:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2018 08:42:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,318,1520924400"; d="scan'208";a="49208759" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.42]) ([10.237.221.42]) by fmsmga001.fm.intel.com with ESMTP; 23 Apr 2018 08:42:22 -0700 To: "Varghese, Vipin" , Ophir Munk , "dev@dpdk.org" , "pascal.mazon@6wind.com" , Thomas Monjalon , Olga Shern , Shahaf Shuler References: <1519625719-10443-1-git-send-email-vipin.varghese@intel.com> <1522705068-18198-1-git-send-email-vipin.varghese@intel.com> <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D1C8BAB@BGSMSX101.gar.corp.intel.com> <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D1DFD5A@BGSMSX101.gar.corp.intel.com> <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D1E3338@BGSMSX101.gar.corp.intel.com> From: Ferruh Yigit Openpgp: preference=signencrypt Autocrypt: addr=ferruh.yigit@intel.com; prefer-encrypt=mutual; keydata= xsFNBFXZCFABEADCujshBOAaqPZpwShdkzkyGpJ15lmxiSr3jVMqOtQS/sB3FYLT0/d3+bvy qbL9YnlbPyRvZfnP3pXiKwkRoR1RJwEo2BOf6hxdzTmLRtGtwWzI9MwrUPj6n/ldiD58VAGQ +iR1I/z9UBUN/ZMksElA2D7Jgg7vZ78iKwNnd+vLBD6I61kVrZ45Vjo3r+pPOByUBXOUlxp9 GWEKKIrJ4eogqkVNSixN16VYK7xR+5OUkBYUO+sE6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pVCnP9ipLpD0fYz1d/dX0F/VY2ovW6Eba/y/ngOSAR6C+u881m7oH2l0G47MTwkaQCBA bLGXPj4TCdX3lftqt4bcBPBJ+rFAnJmRHtUuyyaewBnZ81ZU2YAptqFM1kTh+aSvMvGhfVsQ qZL2rk2OPN1hg+KXhErlbTZ6oPtLCFhSHQmuxQ4oc4U147wBTUuOdwNjtnNatUhRCp8POc+3 XphVR5G70mnca1E2vzC77z+XSlTyRA== Message-ID: Date: Mon, 23 Apr 2018 16:42:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D1E3338@BGSMSX101.gar.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: Mon, 23 Apr 2018 15:42:26 -0000 On 4/23/2018 1:58 PM, Varghese, Vipin wrote: > Hi Ophir, > > Can you help me with the investigation with the following information? > 1) The kernel or distro in which the TAP proto flag set breaks the logic? Hi Vipin, I guess Ophir's point is not this is broken with some kernels but a valid field set wrong for tap, perhaps someone can be using a custom kernel module to use those fields, we can't know it. Instead of duplicating [rt]x_burst() functions, I suggest creating a variable to set if this is tun or tap and set pi.proto only for tun, this will lead less comparison for tap and correct proto value. > 2) Is the above still valid even after applying the patch ' https://dpdk.org/dev/patchwork/patch/37986/'? I guess his concern is for tap, that some MAC addresses cause wrong pi.proto, not for tun which your patch fixes. > > Note: I am testing with 3.13.0, 4.4.0 and 4.13.0. > > Thanks > Vipin Varghese > >> -----Original Message----- >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Varghese, Vipin >> Sent: Saturday, April 21, 2018 8:40 PM >> To: Ophir Munk ; dev@dpdk.org; >> pascal.mazon@6wind.com; Yigit, Ferruh ; Thomas >> Monjalon ; Olga Shern ; >> Shahaf Shuler >> Subject: Re: [dpdk-dev] [PATCH 1/2] net/tap: add tun support >> >> Hi Ophir, >> >> >> >>> Hi Vipin, >>> I missed your point: >>> You claim that TAP should work regardless of any pi.proto values. >>> Can you confirm that for ALL kernels versions (past and future)? >> >> I have tested with 3.13.0 , 4.4.0 with patch fix. >> >>> >>>> -----Original Message----- >>>> From: Ophir Munk >>>> Sent: Saturday, April 21, 2018 12:49 AM >>>> To: Varghese, Vipin ; dev@dpdk.org; >>>> pascal.mazon@6wind.com; Yigit, Ferruh ; >>>> Thomas Monjalon ; Olga Shern >>>> ; Shahaf Shuler >>>> Subject: RE: [dpdk-dev] [PATCH 1/2] net/tap: add tun support >>>> >>>> Hi Vipin, >>>> >>>> Please find comments inline. >>>> >>>>> -----Original Message----- >>>>> From: Varghese, Vipin [mailto:vipin.varghese@intel.com] >>>>> Sent: Friday, April 13, 2018 6:18 AM >>>>> To: Ophir Munk ; dev@dpdk.org; >>>>> pascal.mazon@6wind.com; Yigit, Ferruh ; >>>>> Thomas Monjalon ; Olga Shern >>>>> ; Shahaf Shuler >>>>> Subject: RE: [dpdk-dev] [PATCH 1/2] net/tap: add tun support >>>>> >> >> >> >>>>>> 1. Accessing the first byte here assumes it is the first IP >>>>>> header byte (layer 3) which is correct for TUN. >>>>>> For TAP however the first byte belongs to Ethernet destination >>>>>> address (layer 2). >>>>>> Please explain how this logic will work for TAP. >>>>> >>>>> Based on linux code base '/driver/net/tap.c' and '/driver/net/tun.c' >>>>> from 3.13. to 4.16, >>>>> >>>>> Please find my observation below >>>>> 1. File: tun.c, function: tun_get_user, check for 'tun->flags & >>>>> TUN_TYPE_MASK' is done and if non ip is taken counter 'rx_dropped' >>>>> is updated. >>>>> 2. File: tap.c, there are no checks for 'tap->flags' for IFF_NO_PI >>>>> in rx data path. Counter 'rx_dropped' is updated in 'tap_handle_frame'. >>>>> >>>> >>>> I understand that in kernel implementation there is no check for >>>> tap->flags in file tap.c, however I think there is a bug in dpdk >>>> tap->rte_eth_tap.c >>> file. >>>> Please find below an example which demonstrates this claim. >>>> >>>>> Please find my reasoning below >>>>> 1. First approach was to have separate function for tap and tun TX and >> RX. >>>>> But this will introduce code duplication, hence reworked the code >>>>> as >>>> above. >>>> >>>> I agree. Avoiding code duplication is a good approach. >>>> >>>>> 2. During my internal testing assigning dummy value for protocol >>>>> field in TAP packets, did not show a difference in behaviour. May >>>>> be there are some specific cases this failing. >>>>> >>>>> If there difference in behaviour, can please share the same? >>>>> >>>> >>>> Please consider the following example: >>>> I am running testpmd with a TAP device, --forward-mode=csum. >>>> I am injecting a TCP packet, which is forwarded back (mac addresses >>>> swapped) to the sender. >>>> Using gdb I set a breakpoint at pmd_tx_burst() in file rte_eth_tap.c >>>> >>>> Looking at the following code inside pmd_tx_burst(): >>>> >>>> 527 char *buff_data = rte_pktmbuf_mtod(seg, void *); >>>> 528 j = (*buff_data & 0xf0); >>>> 529 pi.proto = (j == 0x40) ? 0x0008 : >>>> 530 (j == 0x60) ? 0xdd86 : 0x00; >>>> >>>> I am printing the first 20 bytes of buff_data in line 527: >>>> >>>> (gdb) p/x *(unsigned char *)buff_data@20 >>>> $3 = {0x0, 0x25, 0x88, 0x10, 0x66, 0x2, 0xf4, 0x52, 0x14, 0x7a, >>>> 0x59, 0x81, 0x8, 0x0, 0x45, 0x0, 0x4, 0xdf, 0x0, 0x1} >>>> >>>> The gdb printout refers to: >>>> 6 bytes of destination MAC address: 0x0, 0x25, 0x88, 0x10, 0x66, 0x2 >>>> 6 bytes of source MAC address: 0xf4, 0x52, 0x14, 0x7a, 0x59, 0x81 >>>> 2 bytes of Ethernet type: 0x8, 0x0 - (IPv4) IP header starting with 0x45, ... >>>> which is the byte (0x45) that "j" should have looked at >>>> >>>> In the case of TAP - buff_data starts with the destination MAC >>>> address of the sender (0x0, ...). >>>> The code in line 528 expects that buff_data would start with an IP >>>> header protocol (e.g. 0x45), but it is not the case for TAP. >>>> In my case j=0x0 (line 528) which is harmless (as it ends up with >>>> setting pi.proto=0x00, which is correct for TAP). >>>> However, if the sender had an Intel NIC - the destination MAC >>>> address could have started with: >>>> $3 = {0x40, 0x25, 0xC2, ... >>>> Or- >>>> $3 = {0x64, 0xD4, 0xDA, ... >>>> >>>> as 4025C2 and 64D4DA are reserved prefixes for Intel Ethernet MAC >>>> addresses, see: http://www.coffer.com/mac_find/?string=intel >>>> >>>> In this case pi.proto could end up with 0x0008 or 0xdd86 instead of >>>> 0x0 as expected for TAP. >>>> >>>> I hope that this example clarifies the bug I am referring to. >>>> >> >> Thanks for sharing detailed example overview. But as you mentioned this will >> break ' 4025C2' and ' 64D4DA', This will not solve for the correction patch ' >> https://dpdk.org/dev/patchwork/patch/37986/'. >> >> Only choice left is separate tx_burst for TAP and TUN PMD, as we do not >> want to check PMD type on each call. >> >> Questions: >> 1) Is this ok to split tx_burst and have redundant code? >> 2) Does applications transparently send packets coming from Physical NIC to >> TAP interface? Does not the application Modifies the DEST MAC addr to TAP >> interface? >> >>>>>> >>>>>> 2. If the first TUN byte contains 0x2X (which is neither IPv4 >>>>>> nor >>>>>> IPv6) it will end up by setting ip.proto as 0xdd86. >>>>>> Please explain how this logic will work for non-IP packets in >>>>>> TUN >>>>> >>>>> I see your point. You are correct about this. Thanks for pointing >>>>> out, may I send correction for this as >>>>> >>>>> """ >>>>> - if (j & (0x40 | 0x60)) >>>>> - pi.proto = (j == 0x40) ? 0x0008 : 0xdd86; >>>>> + pi.proto = (j == 0x40) ? 0x0008 : >>>>> + (j == 0x60) ? 0xdd86 : >>>>> + 0x00; >>>>> """