From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f170.google.com (mail-pf0-f170.google.com [209.85.192.170]) by dpdk.org (Postfix) with ESMTP id B130829CA for ; Thu, 7 Dec 2017 00:15:42 +0100 (CET) Received: by mail-pf0-f170.google.com with SMTP id u19so3181014pfa.12 for ; Wed, 06 Dec 2017 15:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x/klm22kDtgIRSagF1ag5yq4le459u18zgmsMR3a3/s=; b=0O71TfFUDfAdg/br4eQb4z6K5rZFybSmrKoBGQ/9Fw0zEYIlZ5NGjyxPfzm2g+ACxV Fqeh9GAvBkJDbsQP3XiI4bPC8ZtTgItCceRPIxuvB0XioxtNVLQIVQU5vyd6jBfWEBbA 6lN7nzaFXYISWVe/qfkuwUJCR13d8Dd1/xv+aEiOyJ/rzX9PMPMGaVOy/53vWMzd2M4v m8Lt82QqfICjpMtFO5RGsoBFRAkKsT0C1ix6zq7KLLdk8M6jRhtaQdJ1LsBhKvFGWi7e Ry7Pw+QoTkGCFDJlq+S/bijGfJUVFvfZm+uhxC/m2myi7LCOwvZUwdyFVPMirDEfQcHX UbJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x/klm22kDtgIRSagF1ag5yq4le459u18zgmsMR3a3/s=; b=Km11aequFy33nhC5k5Wge93NjlTAgaocPZ0pPnTo+KIjrxGm2SlwTxID/S8M2N5zp0 4YwjCD5zNLgwkkDn60FwDj7y1Ay5etZIBTmbMtGfGQpZ8uACEDIaCpF8FgJyTK/+awNT wxRS3ep0wBPq4VxavJnciGmJ0ieZinPTpq3W7JWpAHMQGYvh1ui2MexaP7NkNswn9+uM W2MTQ/8IfL+2dOCcsVQwX+yXtsCumQaZC0U3yMRZf48zUJe+45tp2mr0iHGiiOXZPMVf R3q2Yfr8OoJN8o4ROiQZqYOnhSiZZjrhpH9/DxvhUan7zzdHpHZ9BjljMnrTqcwqpxcL GWbA== X-Gm-Message-State: AJaThX4HIkDrTem6vcrmSbLIF/q5RAzE0LwlCV1XLk9wRmadA12Yt1FO ZYxXdpVCx+3iKSkwwdxGrIk0aw== X-Google-Smtp-Source: AGs4zMbsov4Aix9FQB/tZkPUHXdJS5FTyRtI5gULxlWCYz1qVbpjKUNGPPlKpRi4ziy7CXnE7VngEg== X-Received: by 10.99.47.134 with SMTP id v128mr23221136pgv.232.1512602141578; Wed, 06 Dec 2017 15:15:41 -0800 (PST) Received: from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id p87sm6709008pfi.95.2017.12.06.15.15.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Dec 2017 15:15:41 -0800 (PST) Date: Wed, 6 Dec 2017 15:15:32 -0800 From: Stephen Hemminger To: Ilya Matveychikov Cc: dev@dpdk.org, jiayu.hu@intel.com Message-ID: <20171206151532.3abaf2fb@xeon-e3> In-Reply-To: <2111ED2C-DB90-4AE3-893E-2406EFE129AD@gmail.com> References: <4F9781B2-338C-4154-BDA1-BC24D1B2B689@gmail.com> <20171206101200.031afa39@shemminger-XPS-13-9360> <2111ED2C-DB90-4AE3-893E-2406EFE129AD@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] A question about GRO neighbor packet matching 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: Wed, 06 Dec 2017 23:15:43 -0000 On Wed, 6 Dec 2017 22:38:12 +0400 Ilya Matveychikov wrote: > > On Dec 6, 2017, at 10:12 PM, Stephen Hemminger wrote: > > > > On Wed, 6 Dec 2017 18:02:21 +0400 > > Ilya Matveychikov wrote: > > > >> Hello all, > >> > >> > >> My question is about neighbor packet matching algorithm for TCP. Is it > >> correct to expect that IP packets should have continuous ID enumeration > >> (i.e. iph-next.id = iph-prev.id + 1)? > > > > > > No. > > > >> ~~~ > >> lib/librte_gro/gro_tcp4.c:check_seq_option() > >> ... > >> /* check if the two packets are neighbors */ > >> tcp_dl0 = pkt0->pkt_len - pkt0->l2_len - pkt0->l3_len - tcp_hl0; > >> if ((sent_seq == (item->sent_seq + tcp_dl0)) && > >> (ip_id == (item->ip_id + 1))) > >> /* append the new packet */ > >> return 1; > >> else if (((sent_seq + tcp_dl) == item->sent_seq) && > >> ((ip_id + item->nb_merged) == item->ip_id)) > >> /* pre-pend the new packet */ > >> return -1; > >> else > >> return 0; > >> ~~~ > >> > >> As per RFC791: > >> > >> Identification: 16 bits > >> > >> An identifying value assigned by the sender to aid in assembling the > >> fragments of a datagram. > > > > The IP header id is meaningless in most TCP sessions. > > Good TCP implementations use PMTU discovery which sets the Don't Fragment bit. > > With DF, the IP id is unused (since no fragmentation). > > Many implementations just send 0 since generating unique IP id requires an > > atomic operation which is potential bottleneck. > > So, is my question correct and the code is wrong? > Yes. This code is wrong on several areas. * The ip_id on TCP flows is irrelevant. * packet should only be merged if TCP flags are the same. The author should look at Linux net/ipv4/tcp_offload.c