From: John Sager <john@sager.me.uk>
To: cake@lists.bufferbloat.net
Subject: Re: [Cake] act_connmark + dscp
Date: Wed, 6 Mar 2019 16:47:24 +0000 [thread overview]
Message-ID: <2addb109-0cc4-cdb9-886d-d86da9b5bf51@sager.me.uk> (raw)
In-Reply-To: <875zsw110r.fsf@toke.dk>
You should be able to infer get (egress action) and set (ingress action)
from which qdisc it is attached to. Is it possible to do that when the
action function is invoked (from parameters of tcf_connmark_act() or does it
need a static flag set when tc attaches the action?
In act_conntrack.c there is another case further down where ct->mark is
copied to skb->mark so you need to cover both cases (inline function?).
John
On 06/03/2019 15:21, Toke Høiland-Jørgensen wrote:
> Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> writes:
>
>> Before I go too far down this road (and to avoid the horror of
>> actually trying to code it) here’s what I’m trying to achieve.
>>
>>
>> act_connmark + dscp is designed to copy a DSCP code to/from conntrack mark. It uses 8 bits of the mark field, currently the most significant byte.
>>
>> Bits 31-26: DSCP
>> Bit 25: Spare/Future
>> Bit 24: Valid DSCP set
>>
>> The valid bit is set when the ‘getdscp’ function has written a DSCP
>> value into the conntrack (& hence skb) mark. This allows us & other
>> skb->mark/ct->mark applications (eg iptables, cake qdisc) to know that
>> a DSCP value has been placed in the field. We cannot simply use a
>> non-zero DSCP because zero is a valid DSCP.
>
> If someone installs the action, the field is supposedly always copied;
> so why do we need another flag?
>
> Instead, I'd suggest adding user options with mask and shift to make it
> possible to configure where in the mark field the values are stored...
>
>> ’setdscp’ restores the DSCP field from the stored DSCP if valid bit is set.
>>
>>
>> Modes:
>>
>> getdscp - If ct->mark doesn’t contain a valid DSCP, copy the DSCP
>> field from the current skb (if valid for that skb ie. ip4/ip6) and set
>> the valid bit.
>>
>> bleach/aka wash - As part of the getdscp routine, optionally null out
>> the DSCP bits. We need a bleach routine because we need to see the
>> DSCP bits intact so we can copy them to the mark. If cake washes them
>> then we don’t get to see them, defeating the entire point.
>>
>> setdscp - if skb->mark valid bit set, copy the skb->mark stored DSCP
>> to the diffserv bits of the current skb (if appropriate)
>
> TC actions are executed before the qdisc, so I don't think bleach/wash
> is really needed? Also, it can already be achieved with the pedit
> action. So I think 'get' and 'set' are enough.
>
>> I’ve attached a *VERY* rough starting point for how far I’ve got - not
>> even compiled yet… I doubt it does. Not a natural (kernel) programmer
>> so everything is a struggle.
>>
>> Two things I’m falling over:
>>
>> 1) Really not sure how to get parameters in to set the
>> ‘getdscp/setdscp/wash’ options.
>
> You'll need to add new netlink parameter values and parse them like we
> do in cake (after the existing struct-copy-based option passing). I
> think a single option that can be set to *either* "get" *or* "set" will
> be simpler, then you don't have to worry about what happens if someone
> enables both.
>
>> 2) Is it possible to have different tc actions on an interface and a
>> mirred fed ifb interface? That could be a real killer actually. We
>> need to do different things on egress vs ingress.
>
> Yes, you can chain actions, and they are per-interface.
>
>> 3) (Spanish Inquisition moment) The original connmark code goes and
>> does a nf_ct_get_tuplepr if the nf_ct_get fails. Why would the
>> nf_ct_get fail?
>
> Presumably because nf_ct_get just reads a field in the skb; which may
> not have been set yet in some cases, necessitating a full lookup.
>
> -Toke
> _______________________________________________
> Cake mailing list
> Cake@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/cake
>
next prev parent reply other threads:[~2019-03-06 16:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-05 14:35 Kevin Darbyshire-Bryant
2019-03-06 15:21 ` Toke Høiland-Jørgensen
2019-03-06 16:47 ` John Sager [this message]
2019-03-07 9:50 ` Toke Høiland-Jørgensen
2019-03-06 18:40 ` Kevin Darbyshire-Bryant
2019-03-07 10:10 ` Toke Høiland-Jørgensen
2019-03-07 15:56 ` Kevin Darbyshire-Bryant
2019-03-07 17:40 ` Toke Høiland-Jørgensen
2019-03-08 11:13 ` Kevin Darbyshire-Bryant
2019-03-08 11:28 ` Toke Høiland-Jørgensen
2019-03-08 14:03 ` Kevin Darbyshire-Bryant
2019-03-09 14:08 ` Toke Høiland-Jørgensen
2019-03-10 15:21 ` Kevin Darbyshire-Bryant
2019-03-10 23:56 ` Toke Høiland-Jørgensen
2019-03-11 10:51 ` Kevin Darbyshire-Bryant
2019-03-11 13:00 ` Toke Høiland-Jørgensen
2019-03-11 14:11 ` Kevin Darbyshire-Bryant
2019-03-11 14:32 ` Toke Høiland-Jørgensen
2019-03-09 20:21 ` John Sager
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=2addb109-0cc4-cdb9-886d-d86da9b5bf51@sager.me.uk \
--to=john@sager.me.uk \
--cc=cake@lists.bufferbloat.net \
/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