The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
On Mon, May 28, 2018 at 05:40:18AM +0000, Fu, Qiaobin wrote:
quoted hunk
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
I don't think this is doable. It looks like it was prepared for such
change, but it breaks UAPI as it causes tc without the respective
patch to not be able to talk to skbedit anymore:
With this patch:
[root@f28 ~]# tc action add action skbedit priority 1
RTNETLINK answers: Numerical result out of range
We have an error talking to the kernel
[root@f28 ~]#
While without this patch:
[root@f28 ~]# tc action add action skbedit priority 1
[root@f28 ~]#
From: Jamal Hadi Salim <jhs@mojatatu.com> Date: 2018-05-28 16:01:04
On 28/05/18 11:42 AM, Marcelo Ricardo Leitner wrote:
On Mon, May 28, 2018 at 05:40:18AM +0000, Fu, Qiaobin wrote:
quoted
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
I don't think this is doable. It looks like it was prepared for such
change, but it breaks UAPI as it causes tc without the respective
patch to not be able to talk to skbedit anymore:
With this patch:
[root@f28 ~]# tc action add action skbedit priority 1
RTNETLINK answers: Numerical result out of range
We have an error talking to the kernel
[root@f28 ~]#
While without this patch:
[root@f28 ~]# tc action add action skbedit priority 1
[root@f28 ~]#
And the new flags field doesnt even seem to be in use.
Qiaobin, you dont seem to need this.
Also you have added a workaround for default_priority
which I dont think is needed either (sounds like you
want to make sure that SKBEDIT_F_PRIORITY and new
feature are mutually exclusive - which seems unnecessary.
My suggestion is to remove:
+ } else {
+default_priority:
+ if (d->flags & SKBEDIT_F_PRIORITY)
+ skb->priority = d->priority;
+ }
and leave alone:
- if (d->flags & SKBEDIT_F_PRIORITY)
- skb->priority = d->priority;
If someone wants to set both flags, then let them.
cheers,
jamal
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v3:
*Use optional flags, so that it won't break old versions of tc.
*Allow users to set both SKBEDIT_F_PRIORITY and SKBEDIT_F_INHERITDSFIELD flags.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
From: Jamal Hadi Salim <jhs@mojatatu.com> Date: 2018-06-19 12:01:59
Hi Qiaobin,
Per my previous comments, why do we need the
TCA_SKBEDIT_FLAGS TLV? Isnt SKBEDIT_F_INHERITDSFIELD
sufficient? i.e in tcf_skbedit_init() check for
d->flags&SKBEDIT_F_INHERITDSFIELD then set skb->priority
and flags|=SKBEDIT_F_INHERITDSFIELD
Side note:
Infact the whole flags setting in the init function
seems to be a redundant given all the TLVs have
d->flags also set by user space.
But thats a different patch.
cheers,
jamal
On 12/06/18 11:42 AM, Fu, Qiaobin wrote:
quoted hunk
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
From: Michel Machado <hidden> Date: 2018-06-19 13:02:00
On 06/19/2018 08:01 AM, Jamal Hadi Salim wrote:
Per my previous comments, why do we need the
TCA_SKBEDIT_FLAGS TLV? Isnt SKBEDIT_F_INHERITDSFIELD
sufficient? i.e in tcf_skbedit_init() check for
d->flags&SKBEDIT_F_INHERITDSFIELD then set skb->priority
and flags|=SKBEDIT_F_INHERITDSFIELD
Notice that, different from skbmod, there's no field parm->flags in
skbedit. Skbedit infers the flags in d->flags from the presence of the
parameters of each of its actions. But SKBEDIT_F_INHERITDSFIELD has no
parameter and adding field parm->flags breaks backward compatibility
with user space as pointed out by Marcelo Ricardo Leitner. Our solution
was to add TCA_SKBEDIT_FLAGS, so SKBEDIT_F_INHERITDSFIELD and future
flag-only actions can be added.
[ ]'s
Michel Machado
From: Jamal Hadi Salim <jhs@mojatatu.com> Date: 2018-06-20 11:53:22
On 19/06/18 08:39 AM, Michel Machado wrote:
Notice that, different from skbmod, there's no field parm->flags in
skbedit. Skbedit infers the flags in d->flags from the presence of the
parameters of each of its actions. But SKBEDIT_F_INHERITDSFIELD has no
parameter and adding field parm->flags breaks backward compatibility
with user space as pointed out by Marcelo Ricardo Leitner. Our solution
was to add TCA_SKBEDIT_FLAGS, so SKBEDIT_F_INHERITDSFIELD and future
flag-only actions can be added.
Ok, that makes sense - thanks. I am not so sure about using
64 bits (32 bits would have been fine to match the size of
the kernel flags), but other than that LGTM.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
cheers,
jamal
From: Michel Machado <hidden> Date: 2018-06-20 12:42:24
On 06/20/2018 07:53 AM, Jamal Hadi Salim wrote:
On 19/06/18 08:39 AM, Michel Machado wrote:
quoted
Notice that, different from skbmod, there's no field parm->flags in
skbedit. Skbedit infers the flags in d->flags from the presence of the
parameters of each of its actions. But SKBEDIT_F_INHERITDSFIELD has no
parameter and adding field parm->flags breaks backward compatibility
with user space as pointed out by Marcelo Ricardo Leitner. Our
solution was to add TCA_SKBEDIT_FLAGS, so SKBEDIT_F_INHERITDSFIELD and
future flag-only actions can be added.
Ok, that makes sense - thanks. I am not so sure about using
64 bits (32 bits would have been fine to match the size of
the kernel flags), but other than that LGTM.
The choice for the u64 is meant to keep the interface between kernel
and user space the same for hopefully a longer time than it would be
with a u32. Changing from u32 to u64 in the kernel, when the need
arrives, won't impact applications. This interface choice was motivated
by the backward compatibility issue mentioned above.
Thank you for the review, Jamal.
[ ]'s
Michel Machado
On Tue, Jun 12, 2018 at 03:42:55PM +0000, Fu, Qiaobin wrote:
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
On Tue, 2018-06-12 at 15:42 +0000, Fu, Qiaobin wrote:
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
[...]
quoted hunk
@@ -41,6 +44,25 @@ static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a, if (d->flags & SKBEDIT_F_PRIORITY) skb->priority = d->priority;+ if (d->flags & SKBEDIT_F_INHERITDSFIELD) {+ int wlen = skb_network_offset(skb);++ switch (tc_skb_protocol(skb)) {+ case htons(ETH_P_IP):+ wlen += sizeof(struct iphdr);+ if (!pskb_may_pull(skb, wlen))+ goto err;+ skb->priority = ipv4_get_dsfield(ip_hdr(skb)) >> 2;+ break;++ case htons(ETH_P_IPV6):+ wlen += sizeof(struct ipv6hdr);+ if (!pskb_may_pull(skb, wlen))+ goto err;+ skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;+ break;+ }+ } if (d->flags & SKBEDIT_F_QUEUE_MAPPING && skb->dev->real_num_tx_queues > d->queue_mapping) skb_set_queue_mapping(skb, d->queue_mapping);
sorry for asking this when the patch is a v4...
I spotted this, as I'm rebasing a small series that removes the tcf_lock
from the data plane of skbedit to gain some speed, and it converts the
stats to be per-cpu counters.
in the code above, you are catching failures of pskb_may_pull(skb) and
then you return TC_ACT_SHOT. That's OK, but I think you should update the
drop counter, like other TC actions do.
If you (author / reviewers) think this is a minor issue, like I do think,
then I can add the missing update in my series and post it when net-next
reopens.
WDYT?
thank you in advance!
regards,
--
davide
From: Michel Machado <hidden> Date: 2018-06-20 16:47:28
On 06/20/2018 12:08 PM, Davide Caratti wrote:
On Tue, 2018-06-12 at 15:42 +0000, Fu, Qiaobin wrote:
quoted
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
[...]
quoted
@@ -41,6 +44,25 @@ static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a, if (d->flags & SKBEDIT_F_PRIORITY) skb->priority = d->priority;+ if (d->flags & SKBEDIT_F_INHERITDSFIELD) {+ int wlen = skb_network_offset(skb);++ switch (tc_skb_protocol(skb)) {+ case htons(ETH_P_IP):+ wlen += sizeof(struct iphdr);+ if (!pskb_may_pull(skb, wlen))+ goto err;+ skb->priority = ipv4_get_dsfield(ip_hdr(skb)) >> 2;+ break;++ case htons(ETH_P_IPV6):+ wlen += sizeof(struct ipv6hdr);+ if (!pskb_may_pull(skb, wlen))+ goto err;+ skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;+ break;+ }+ } if (d->flags & SKBEDIT_F_QUEUE_MAPPING && skb->dev->real_num_tx_queues > d->queue_mapping) skb_set_queue_mapping(skb, d->queue_mapping);
sorry for asking this when the patch is a v4...
I spotted this, as I'm rebasing a small series that removes the tcf_lock
from the data plane of skbedit to gain some speed, and it converts the
stats to be per-cpu counters.
in the code above, you are catching failures of pskb_may_pull(skb) and
then you return TC_ACT_SHOT. That's OK, but I think you should update the
drop counter, like other TC actions do.
If you (author / reviewers) think this is a minor issue, like I do think,
then I can add the missing update in my series and post it when net-next
reopens.
WDYT?
thank you in advance!
regards,
Hi Davide,
I agree that we should update the drop counter, but given that
you're already converting the stats to be per-cpu counters, whatever we
add now will be just symbolic since you're going to change it anyway. If
reviewers think that Qiaobin's patch must add the update line, could you
provide the exact line and location so we avoid going to v6 of this patch?
[ ]'s
Michel Machado
On Wed, 2018-06-20 at 12:47 -0400, Michel Machado wrote:
On 06/20/2018 12:08 PM, Davide Caratti wrote:
quoted
On Tue, 2018-06-12 at 15:42 +0000, Fu, Qiaobin wrote:
quoted
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
---
[...]
quoted
@@ -41,6 +44,25 @@ static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a, if (d->flags & SKBEDIT_F_PRIORITY) skb->priority = d->priority;+ if (d->flags & SKBEDIT_F_INHERITDSFIELD) {+ int wlen = skb_network_offset(skb);++ switch (tc_skb_protocol(skb)) {+ case htons(ETH_P_IP):+ wlen += sizeof(struct iphdr);+ if (!pskb_may_pull(skb, wlen))+ goto err;+ skb->priority = ipv4_get_dsfield(ip_hdr(skb)) >> 2;+ break;++ case htons(ETH_P_IPV6):+ wlen += sizeof(struct ipv6hdr);+ if (!pskb_may_pull(skb, wlen))+ goto err;+ skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;+ break;+ }+ } if (d->flags & SKBEDIT_F_QUEUE_MAPPING && skb->dev->real_num_tx_queues > d->queue_mapping) skb_set_queue_mapping(skb, d->queue_mapping);
sorry for asking this when the patch is a v4...
I spotted this, as I'm rebasing a small series that removes the tcf_lock
from the data plane of skbedit to gain some speed, and it converts the
stats to be per-cpu counters.
in the code above, you are catching failures of pskb_may_pull(skb) and
then you return TC_ACT_SHOT. That's OK, but I think you should update the
drop counter, like other TC actions do.
If you (author / reviewers) think this is a minor issue, like I do think,
then I can add the missing update in my series and post it when net-next
reopens.
WDYT?
thank you in advance!
regards,
Hi Davide,
I agree that we should update the drop counter, but given that
you're already converting the stats to be per-cpu counters, whatever we
add now will be just symbolic since you're going to change it anyway.
that's ok for me also, as I can use the current v4 code for the rebase
(and not wait for another respin) _ but let's hear what reviewers think.
If
reviewers think that Qiaobin's patch must add the update line, could you
provide the exact line and location so we avoid going to v6 of this patch?
On Wed, Jun 20, 2018 at 07:02:41PM +0200, Davide Caratti wrote:
...
quoted
I agree that we should update the drop counter, but given that
you're already converting the stats to be per-cpu counters, whatever we
add now will be just symbolic since you're going to change it anyway.
It wouldn't be symbolic. One thing is to convert a given increment
into something else, another is to start increasing it for some (new)
reason.
that's ok for me also, as I can use the current v4 code for the rebase
(and not wait for another respin) _ but let's hear what reviewers think.
quoted
If
reviewers think that Qiaobin's patch must add the update line, could you
provide the exact line and location so we avoid going to v6 of this patch?
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v5:
*Update the drop counter for TC_ACT_SHOT.
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
v3:
*Use optional flags, so that it won't break old versions of tc.
*Allow users to set both SKBEDIT_F_PRIORITY and SKBEDIT_F_INHERITDSFIELD flags.
v2:
*Fix the style issue
*Move the code from skbmod to skbedit
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v5:
*Update the drop counter for TC_ACT_SHOT
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
v3:
*Use optional flags, so that it won't break old versions of tc.
*Allow users to set both SKBEDIT_F_PRIORITY and SKBEDIT_F_INHERITDSFIELD flags.
v2:
*Fix the style issue
*Move the code from skbmod to skbedit
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
On Thu, 2018-06-21 at 15:50 +0000, Fu, Qiaobin wrote:
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v5:
*Update the drop counter for TC_ACT_SHOT
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->priority. This enables
later classification of packets based on the DS field.
v5:
*Update the drop counter for TC_ACT_SHOT
v4:
*Not allow setting flags other than the expected ones.
*Allow dumping the pure flags.
v3:
*Use optional flags, so that it won't break old versions of tc.
*Allow users to set both SKBEDIT_F_PRIORITY and SKBEDIT_F_INHERITDSFIELD flags.
v2:
*Fix the style issue
*Move the code from skbmod to skbedit
Original idea by Jamal Hadi Salim [off-list ref]
Signed-off-by: Qiaobin Fu <redacted>
Reviewed-by: Michel Machado <redacted>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Davide Caratti <redacted>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
This patch is heavily corrupted by your email client.
Please fix this, email a test patch to yourself, and do not resubmit
this patch to the list until you can successfully apply the patch
in that test email.