From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.toke.dk (mail.toke.dk [IPv6:2001:470:dc45:1000::1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 3B3C83B2A4 for ; Tue, 22 May 2018 18:06:49 -0400 (EDT) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1527026804; bh=vXtzM3NQW4FbviHMTH/UzBAhIxU4O3YuPTdhwWfXIww=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=czHYXOdXahW6MoBu4xPh3YHtn6G6SVrVdlQQpf9KULqH2RJdlU9VYigt6BX+WJYnf 7KMxSDqm75BDKppMHkBDBvZLCeuQnqxsHfOKxSLG9CCFaWswycCqIoru9FTz4hAD/o Lcu2jIIZ6dNacZX1AujhqoI/ihqUZYT4hK/JuitsQMdzOvzsT2rrqDTKyVawjQCK19 bfshzAc/a1BkJo4+ivHu+C0RWwkDHQ3LiuLloxmbZeebhbsHIJiy+YkIiV9rqsu5h+ 20yT93MTYIc1wOBFZdi1wC0ADaMM+fVO1Yjb28tdLXliVbwO/3RRgcpqY0pq/icw1U i3uGGU9VtDp2w== To: Marcelo Ricardo Leitner Cc: netdev@vger.kernel.org, cake@lists.bufferbloat.net In-Reply-To: <20180522202241.GJ5488@localhost.localdomain> References: <152693459693.32668.4272129427997495747.stgit@alrua-kau> <152693495874.32668.11244869690098290078.stgit@alrua-kau> <20180521234513.GH26212@localhost.localdomain> <52F9132E-4FDC-495A-A020-BCD963B3E3CF@toke.dk> <20180522202241.GJ5488@localhost.localdomain> Date: Wed, 23 May 2018 00:06:42 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87lgcbxs3x.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Cake] [PATCH net-next v14 6/7] sch_cake: Add overhead compensation support to the rate shaper X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 22:06:49 -0000 Marcelo Ricardo Leitner writes: > On Tue, May 22, 2018 at 10:44:53AM +0200, Toke H=C3=B8iland-J=C3=B8rgense= n wrote: >>=20 >>=20 >> On 22 May 2018 01:45:13 CEST, Marcelo Ricardo Leitner wrote: >> >On Mon, May 21, 2018 at 10:35:58PM +0200, Toke H=C3=B8iland-J=C3=B8rgen= sen wrote: >> >> +static u32 cake_overhead(struct cake_sched_data *q, const struct >> >sk_buff *skb) >> >> +{ >> >> + const struct skb_shared_info *shinfo =3D skb_shinfo(skb); >> >> + unsigned int hdr_len, last_len =3D 0; >> >> + u32 off =3D skb_network_offset(skb); >> >> + u32 len =3D qdisc_pkt_len(skb); >> >> + u16 segs =3D 1; >> >> + >> >> + q->avg_netoff =3D cake_ewma(q->avg_netoff, off << 16, 8); >> >> + >> >> + if (!shinfo->gso_size) >> >> + return cake_calc_overhead(q, len, off); >> >> + >> >> + /* borrowed from qdisc_pkt_len_init() */ >> >> + hdr_len =3D skb_transport_header(skb) - skb_mac_header(skb); >> >> + >> >> + /* + transport layer */ >> >> + if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | >> >> + SKB_GSO_TCPV6))) { >> >> + const struct tcphdr *th; >> >> + struct tcphdr _tcphdr; >> >> + >> >> + th =3D skb_header_pointer(skb, skb_transport_offset(skb), >> >> + sizeof(_tcphdr), &_tcphdr); >> >> + if (likely(th)) >> >> + hdr_len +=3D __tcp_hdrlen(th); >> >> + } else { >> > >> >I didn't see some code limiting GSO packets to just TCP or UDP. Is it >> >safe to assume that this packet is an UDP one, and not SCTP or ESP, >> >for example? >>=20 >> As the comment says, I nicked this from the qdisc init code. >> So I assume it's safe? :) > > As long as it doesn't go further than this, it is. As in, it is just > validating if it can contain an UDP header, and if so, account for its > size, without actually reading the header. > > Considering everything !TCP as UDP work as an approximation, which is > quite accurate. SCTP header is just 4 bytes bigger than UDP header and > is equal to ESP header size. Yup, that seems close enough for our purposes. Thanks for explaining. Didn't actually know that GSO handles other protocols as well :) -Toke