Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: Dave Taht <dave.taht@gmail.com>
To: Pete Heist <pete@heistp.net>
Cc: "Toke Høiland-Jørgensen" <toke@toke.dk>,
	"Cake List" <cake@lists.bufferbloat.net>
Subject: Re: [Cake] Using cake to shape 1000’s of users.
Date: Sat, 28 Jul 2018 10:52:53 -0700	[thread overview]
Message-ID: <CAA93jw6E-Y03d23CxhDfBkerXPW3mnpoyRrJ73XNTOUMt67A9Q@mail.gmail.com> (raw)
In-Reply-To: <D4436061-6403-45FC-A098-247856D7669A@heistp.net>

[-- Attachment #1: Type: text/plain, Size: 1659 bytes --]

On Sat, Jul 28, 2018 at 10:38 AM Pete Heist <pete@heistp.net> wrote:
>
>
> On Jul 28, 2018, at 10:56 AM, Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>
> Note that with the existing tc classifier stuff we already added to
> Cake, we basically have this already (eBPF can map traffic to tin and
> flow however it pleases).
>
>
> Sorry, this just jostled in my brain now that I may be able to implement member fairness today, based on what you wrote earlier in a thread that I entirely missed: https://lists.bufferbloat.net/pipermail/cake/2018-May/003811.html
>
> George posted an example of assigning packets to a tin: https://lists.bufferbloat.net/pipermail/cake/2018-May/003809.html
>
> How does one send packets to a specific flow / queue?

It's essentially above. I think you can actually do it in pure bpf
without skbedit, I'd written a tc bpf flow classifier for acks quite
some time ago. The not current version is attached. I really need to
finish up some ack related stuff.
Using a bpf map to this then setting the flowid directly?


> This wouldn’t give both per-member and per-flow fairness, but at least per-member fairness might be possible. There are 1024(?) queues available and 800 members, so I’m just speculating that I could map members to a number from 0 to 800 (active member IDs packed and zero-based would work) and assign each member to their own flow. Thanks... :)
>
> _______________________________________________
> Cake mailing list
> Cake@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/cake


--

Dave Täht
CEO, TekLibre, LLC
http://www.teklibre.com
Tel: 1-669-226-2619

[-- Attachment #2: ack_recognise.c --]
[-- Type: application/octet-stream, Size: 2164 bytes --]

/* ack_recogniser: An eBPF program that correctly recognises modern TCP ACKs,
   with tcp option fields.
 */

#include "bpf_api.h"
#include "uapi/linux/if_ether.h"
#include "uapi/linux/ip.h"
#include "uapi/linux/in.h"
// #include "uapi/linux/ipv6.h" // iproute2 doesn't import this header
#include "uapi/linux/tcp.h"

/* Idealized syntax example to move acks into a priority queue:

tc qdisc del dev $IFACE root 2> /dev/null
tc qdisc add dev $IFACE root handle 1: prio bands 3 priomap 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
tc qdisc add dev $IFACE parent 1:1 handle 10:1 fq_codel
tc qdisc add dev $IFACE parent 1:2 handle 20:1 fq_codel
tc qdisc add dev $IFACE parent 1:3 handle 30:1 fq_codel

tc filter add dev $IFACE  prio 1 bpf object-file ack_recognise.o da ack_match flowid 10:1 # 1:1?

*/

/* A pure ack contains the ip header, the tcp header + options, flags with the
 * ack field set, and no additional payload. That last bit is what every prior
 * ack filter gets wrong, they typically assume an obsolete 64 bytes.
 */

__section_cls_entry
int ack_match(struct __sk_buff *skb)
{
	void *data = (void *)(long)skb->data;
	void *data_end = (void *)(long)skb->data_end;
	struct ethhdr *eth = data;
	struct iphdr *iph = data + sizeof(*eth);
	struct tcphdr *tcp;
	int len, isize;

	if (data + sizeof(*eth) + sizeof(*iph) + sizeof(*tcp) > data_end)
		return 0;

	if (eth->h_proto != htons(ETH_P_IP))
		return 0;

	if (iph->version == 4) {
		if(iph->protocol != IPPROTO_TCP)
			return 0;
		len = iph->tot_len; // htons?
		if(iph->ihl > 4) {
			isize = (iph->ihl+1) * 4 - sizeof(*iph);
			tcp = data + sizeof(*eth) + isize;
		} else {
			return 0;
		}
/* grump: iproute2 does not export ip6hdrs
	} else  if (iph->version == 6) {
		struct ipv6hdr iph6 = (struct ipv6hdr *) iph;
// FIXME: walk ip6hdrs appropriately
		if(iph6->nexthdr != IPPROTO_TCP)
			return 0;
		len = iph6->payload_len;
		isize = sizeof(*iph6) + ??;
		tcp = data + sizeof(*eth) + isize;
		*/
	} else
		return 0;

	if (!tcp->ack) return 0;

	if (isize + sizeof(*tcp) + tcp->doff*4 == len)
		return -1; // We matched, return TC_ACT_RECLASSIFY?

	return 0;
}

char __license[] __section("license") = "GPL";

  reply	other threads:[~2018-07-28 17:53 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17  7:24 Felix Resch
2018-07-17 16:59 ` Dave Taht
2018-07-26 15:46   ` Dan Siemon
2018-07-26 15:48     ` Dave Taht
2018-07-26 18:07       ` Dan Siemon
2018-07-28 15:51         ` Dave Taht
2018-07-28 16:11           ` Jonathan Morton
2018-07-28 16:36             ` Dave Taht
2018-07-26 17:42     ` Toke Høiland-Jørgensen
2018-07-26 18:10       ` Dan Siemon
2018-07-26 21:09         ` Toke Høiland-Jørgensen
2018-07-26 21:38           ` Jonathan Morton
2018-07-27  9:25             ` Pete Heist
2018-07-27 14:04             ` Dan Siemon
2018-07-27 18:58               ` Jonathan Morton
2018-07-28  8:56                 ` Toke Høiland-Jørgensen
2018-07-28 15:04                   ` Dave Taht
2018-07-28 16:19                     ` Jonathan Morton
2018-07-28 16:39                       ` Dave Taht
2018-07-28 17:01                     ` Pete Heist
2018-07-28 17:37                   ` Pete Heist
2018-07-28 17:52                     ` Dave Taht [this message]
2018-07-28 17:56                       ` Dave Taht
2018-07-28 18:12                         ` Toke Høiland-Jørgensen
2018-07-29  0:17                           ` Pete Heist
2018-07-29 19:14                             ` Toke Høiland-Jørgensen
2018-07-30  9:14                               ` Pete Heist
2018-07-30 10:09                                 ` Sebastian Moeller
2018-07-30 10:55                                   ` Toke Høiland-Jørgensen
2018-07-30 11:05                                     ` Pete Heist
2018-07-30 11:28                                       ` Toke Høiland-Jørgensen
2018-07-30 22:10                                         ` Pete Heist
2018-07-30 22:17                                           ` Toke Høiland-Jørgensen
2018-07-31  7:31                                             ` Jonathan Morton
2018-07-30 10:55                                   ` Pete Heist
2018-07-30 11:05                                     ` Jonathan Morton
2018-07-28 17:53                     ` Jonathan Morton
2018-07-28 18:07                       ` Dave Taht
2018-07-28 18:17                       ` Toke Høiland-Jørgensen
2018-07-28 19:35                         ` [Cake] 1000s " Dave Taht
2018-07-29 23:24                     ` [Cake] Using cake to shape 1000’s " Dave Taht
2018-08-07  1:46                 ` Dan Siemon
2018-07-28  7:18             ` Pete Heist
2018-07-28  8:06               ` Jonathan Morton
2018-07-28 16:41                 ` Pete Heist
2018-07-28 17:32                   ` [Cake] isp economics Dave Taht
2018-07-28 18:39                     ` Pete Heist
2018-07-28 19:03                       ` Dave Taht
2018-07-28 20:00                         ` Pete Heist
2018-07-29  5:49                         ` Loganaden Velvindron
2018-07-28 19:09                       ` Dave Taht
  -- strict thread matches above, loose matches on Subject: below --
2018-07-16 18:39 [Cake] Using cake to shape 1000’s of users Mike
2018-07-16 19:01 ` Jonathan Morton
2018-07-16 19:13 ` Michel Blais

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA93jw6E-Y03d23CxhDfBkerXPW3mnpoyRrJ73XNTOUMt67A9Q@mail.gmail.com \
    --to=dave.taht@gmail.com \
    --cc=cake@lists.bufferbloat.net \
    --cc=pete@heistp.net \
    --cc=toke@toke.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox