* [PATCH net-next] net:sched: add action inheritdsfield to skbmod
@ 2018-05-17 19:33 Fu, Qiaobin
2018-05-18 13:06 ` Jamal Hadi Salim
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Fu, Qiaobin @ 2018-05-17 19:33 UTC (permalink / raw)
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, jhs@mojatatu.com, Michel Machado
net/sched: add action inheritdsfield to skbmod
The new action inheritdsfield copies the field DS of
IPv4 and IPv6 packets into skb->prioriry. This enables
later classification of packets based on the DS field.
Original idea by Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Qiaobin Fu <qiaobinf@bu.edu>
Reviewed-by: Michel Machado <michel@digirati.com.br>
---
Note that the motivation for this patch is found in the following discussion:
https://www.spinics.net/lists/netdev/msg501061.html
---
diff --git a/include/uapi/linux/tc_act/tc_skbmod.h b/include/uapi/linux/tc_act/tc_skbmod.h
index 38c072f..0718b48 100644
--- a/include/uapi/linux/tc_act/tc_skbmod.h
+++ b/include/uapi/linux/tc_act/tc_skbmod.h
@@ -19,6 +19,7 @@
#define SKBMOD_F_SMAC 0x2
#define SKBMOD_F_ETYPE 0x4
#define SKBMOD_F_SWAPMAC 0x8
+#define SKBMOD_F_INHERITDSFIELD 0x10
struct tc_skbmod {
tc_gen;
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
index ad050d7..21d5bec 100644
--- a/net/sched/act_skbmod.c
+++ b/net/sched/act_skbmod.c
@@ -16,6 +16,9 @@
#include <linux/rtnetlink.h>
#include <net/netlink.h>
#include <net/pkt_sched.h>
+#include <net/ip.h>
+#include <net/ipv6.h>
+#include <net/dsfield.h>
#include <linux/tc_act/tc_skbmod.h>
#include <net/tc_act/tc_skbmod.h>
@@ -72,6 +75,25 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a,
ether_addr_copy(eth_hdr(skb)->h_source, (u8 *)tmpaddr);
}
+ if (flags & SKBMOD_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))
+ return TC_ACT_SHOT;
+ 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))
+ return TC_ACT_SHOT;
+ skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;
+ break;
+ }
+ }
+
return action;
}
@@ -127,6 +149,9 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
if (parm->flags & SKBMOD_F_SWAPMAC)
lflags = SKBMOD_F_SWAPMAC;
+ if (parm->flags & SKBMOD_F_INHERITDSFIELD)
+ lflags |= SKBMOD_F_INHERITDSFIELD;
+
exists = tcf_idr_check(tn, parm->index, a, bind);
if (exists && bind)
return 0;
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH net-next] net:sched: add action inheritdsfield to skbmod 2018-05-17 19:33 [PATCH net-next] net:sched: add action inheritdsfield to skbmod Fu, Qiaobin @ 2018-05-18 13:06 ` Jamal Hadi Salim [not found] ` <DA5C727C-BAE1-4355-B67C-5F9C3769CA30@bu.edu> 2018-05-23 21:06 ` Marcelo Ricardo Leitner 2018-05-23 23:01 ` Cong Wang 2 siblings, 1 reply; 9+ messages in thread From: Jamal Hadi Salim @ 2018-05-18 13:06 UTC (permalink / raw) To: Fu, Qiaobin, davem@davemloft.net; +Cc: netdev@vger.kernel.org, Michel Machado On 17/05/18 03:33 PM, Fu, Qiaobin wrote: > net/sched: add action inheritdsfield to skbmod > > The new action inheritdsfield copies the field DS of > IPv4 and IPv6 packets into skb->prioriry. This enables > later classification of packets based on the DS field. > > Original idea by Jamal Hadi Salim <jhs@mojatatu.com> > > Signed-off-by: Qiaobin Fu <qiaobinf@bu.edu> > Reviewed-by: Michel Machado <michel@digirati.com.br> LGTM. Thanks for putting the effort. As a tradition we also require that you post the iproute2 patch and make sure this works. Can you please do that? Also: If you can add at least a test on tdc it would help immensely. Other than that: Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> cheers, jamal ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <DA5C727C-BAE1-4355-B67C-5F9C3769CA30@bu.edu>]
* Re: [PATCH net-next] net:sched: add action inheritdsfield to skbmod [not found] ` <DA5C727C-BAE1-4355-B67C-5F9C3769CA30@bu.edu> @ 2018-05-21 15:00 ` Jamal Hadi Salim 0 siblings, 0 replies; 9+ messages in thread From: Jamal Hadi Salim @ 2018-05-21 15:00 UTC (permalink / raw) To: Fu, Qiaobin; +Cc: davem@davemloft.net, netdev@vger.kernel.org, Michel Machado On 21/05/18 10:42 AM, Fu, Qiaobin wrote: > Hi Jamal, > > I've tested my patch before publishing it here, and Nishanth is going to test it further with version 2 of the GKprio. I'm going to push a patch to the repository iproute2 to add support for "inheritdsfield”. > Thanks. I already acked the kernel patch. It looks good on its own. Would you consider adding one or more tdc tests as well? cheers, jamal ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net:sched: add action inheritdsfield to skbmod 2018-05-17 19:33 [PATCH net-next] net:sched: add action inheritdsfield to skbmod Fu, Qiaobin 2018-05-18 13:06 ` Jamal Hadi Salim @ 2018-05-23 21:06 ` Marcelo Ricardo Leitner 2018-05-25 5:45 ` Fu, Qiaobin 2018-05-23 23:01 ` Cong Wang 2 siblings, 1 reply; 9+ messages in thread From: Marcelo Ricardo Leitner @ 2018-05-23 21:06 UTC (permalink / raw) To: Fu, Qiaobin Cc: davem@davemloft.net, netdev@vger.kernel.org, jhs@mojatatu.com, Michel Machado Hi, Some style fixes: On Thu, May 17, 2018 at 07:33:08PM +0000, Fu, Qiaobin wrote: > net/sched: add action inheritdsfield to skbmod This extra line above should not be here. > > The new action inheritdsfield copies the field DS of > IPv4 and IPv6 packets into skb->prioriry. This enables typo -----^ > later classification of packets based on the DS field. > > Original idea by Jamal Hadi Salim <jhs@mojatatu.com> > > Signed-off-by: Qiaobin Fu <qiaobinf@bu.edu> > Reviewed-by: Michel Machado <michel@digirati.com.br> > --- > > Note that the motivation for this patch is found in the following discussion: > https://www.spinics.net/lists/netdev/msg501061.html > --- > > diff --git a/include/uapi/linux/tc_act/tc_skbmod.h b/include/uapi/linux/tc_act/tc_skbmod.h > index 38c072f..0718b48 100644 > --- a/include/uapi/linux/tc_act/tc_skbmod.h > +++ b/include/uapi/linux/tc_act/tc_skbmod.h > @@ -19,6 +19,7 @@ > #define SKBMOD_F_SMAC 0x2 > #define SKBMOD_F_ETYPE 0x4 > #define SKBMOD_F_SWAPMAC 0x8 > +#define SKBMOD_F_INHERITDSFIELD 0x10 > > struct tc_skbmod { > tc_gen; > diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c > index ad050d7..21d5bec 100644 > --- a/net/sched/act_skbmod.c > +++ b/net/sched/act_skbmod.c > @@ -16,6 +16,9 @@ > #include <linux/rtnetlink.h> > #include <net/netlink.h> > #include <net/pkt_sched.h> > +#include <net/ip.h> > +#include <net/ipv6.h> > +#include <net/dsfield.h> > > #include <linux/tc_act/tc_skbmod.h> > #include <net/tc_act/tc_skbmod.h> > @@ -72,6 +75,25 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a, > ether_addr_copy(eth_hdr(skb)->h_source, (u8 *)tmpaddr); > } > > + if (flags & SKBMOD_F_INHERITDSFIELD) { > + int wlen = skb_network_offset(skb); You need a blank line here, between var declaration and the rest. > + switch (tc_skb_protocol(skb)) { > + case htons(ETH_P_IP): > + wlen += sizeof(struct iphdr); > + if (!pskb_may_pull(skb, wlen)) > + return TC_ACT_SHOT; > + 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)) > + return TC_ACT_SHOT; > + skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2; > + break; > + } > + } > + > return action; > } > > @@ -127,6 +149,9 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla, > if (parm->flags & SKBMOD_F_SWAPMAC) > lflags = SKBMOD_F_SWAPMAC; > > + if (parm->flags & SKBMOD_F_INHERITDSFIELD) > + lflags |= SKBMOD_F_INHERITDSFIELD; > + > exists = tcf_idr_check(tn, parm->index, a, bind); > if (exists && bind) > return 0; ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net:sched: add action inheritdsfield to skbmod 2018-05-23 21:06 ` Marcelo Ricardo Leitner @ 2018-05-25 5:45 ` Fu, Qiaobin 2018-05-25 14:34 ` Marcelo Ricardo Leitner 2018-05-25 18:47 ` Cong Wang 0 siblings, 2 replies; 9+ messages in thread From: Fu, Qiaobin @ 2018-05-25 5:45 UTC (permalink / raw) To: Marcelo Ricardo Leitner Cc: davem@davemloft.net, netdev@vger.kernel.org, jhs@mojatatu.com, Michel Machado Hi Marcelo, Thanks for pointing out these style issues. Below is the updated version: --- 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 <jhs@mojatatu.com> Signed-off-by: Qiaobin Fu <qiaobinf@bu.edu> Reviewed-by: Michel Machado <michel@digirati.com.br> --- Note that the motivation for this patch is found in the following discussion: https://www.spinics.net/lists/netdev/msg501061.html --- diff --git a/include/uapi/linux/tc_act/tc_skbmod.h b/include/uapi/linux/tc_act/tc_skbmod.h index 38c072f..0718b48 100644 --- a/include/uapi/linux/tc_act/tc_skbmod.h +++ b/include/uapi/linux/tc_act/tc_skbmod.h @@ -19,6 +19,7 @@ #define SKBMOD_F_SMAC 0x2 #define SKBMOD_F_ETYPE 0x4 #define SKBMOD_F_SWAPMAC 0x8 +#define SKBMOD_F_INHERITDSFIELD 0x10 struct tc_skbmod { tc_gen; diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index ad050d7..e2082f6 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c @@ -16,6 +16,9 @@ #include <linux/rtnetlink.h> #include <net/netlink.h> #include <net/pkt_sched.h> +#include <net/ip.h> +#include <net/ipv6.h> +#include <net/dsfield.h> #include <linux/tc_act/tc_skbmod.h> #include <net/tc_act/tc_skbmod.h> @@ -72,6 +75,26 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a, ether_addr_copy(eth_hdr(skb)->h_source, (u8 *)tmpaddr); } + if (flags & SKBMOD_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)) + return TC_ACT_SHOT; + 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)) + return TC_ACT_SHOT; + skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2; + break; + } + } + return action; } @@ -127,6 +150,9 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla, if (parm->flags & SKBMOD_F_SWAPMAC) lflags = SKBMOD_F_SWAPMAC; + if (parm->flags & SKBMOD_F_INHERITDSFIELD) + lflags |= SKBMOD_F_INHERITDSFIELD; + exists = tcf_idr_check(tn, parm->index, a, bind); if (exists && bind) return 0; > On May 23, 2018, at 2:06 PM, Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> wrote: > > Hi, > > Some style fixes: > > On Thu, May 17, 2018 at 07:33:08PM +0000, Fu, Qiaobin wrote: >> net/sched: add action inheritdsfield to skbmod > > This extra line above should not be here. > >> >> The new action inheritdsfield copies the field DS of >> IPv4 and IPv6 packets into skb->prioriry. This enables > typo -----^ > >> later classification of packets based on the DS field. >> >> Original idea by Jamal Hadi Salim <jhs@mojatatu.com> >> >> Signed-off-by: Qiaobin Fu <qiaobinf@bu.edu> >> Reviewed-by: Michel Machado <michel@digirati.com.br> >> --- >> >> Note that the motivation for this patch is found in the following discussion: >> https://www.spinics.net/lists/netdev/msg501061.html >> --- >> >> diff --git a/include/uapi/linux/tc_act/tc_skbmod.h b/include/uapi/linux/tc_act/tc_skbmod.h >> index 38c072f..0718b48 100644 >> --- a/include/uapi/linux/tc_act/tc_skbmod.h >> +++ b/include/uapi/linux/tc_act/tc_skbmod.h >> @@ -19,6 +19,7 @@ >> #define SKBMOD_F_SMAC 0x2 >> #define SKBMOD_F_ETYPE 0x4 >> #define SKBMOD_F_SWAPMAC 0x8 >> +#define SKBMOD_F_INHERITDSFIELD 0x10 >> >> struct tc_skbmod { >> tc_gen; >> diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c >> index ad050d7..21d5bec 100644 >> --- a/net/sched/act_skbmod.c >> +++ b/net/sched/act_skbmod.c >> @@ -16,6 +16,9 @@ >> #include <linux/rtnetlink.h> >> #include <net/netlink.h> >> #include <net/pkt_sched.h> >> +#include <net/ip.h> >> +#include <net/ipv6.h> >> +#include <net/dsfield.h> >> >> #include <linux/tc_act/tc_skbmod.h> >> #include <net/tc_act/tc_skbmod.h> >> @@ -72,6 +75,25 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a, >> ether_addr_copy(eth_hdr(skb)->h_source, (u8 *)tmpaddr); >> } >> >> + if (flags & SKBMOD_F_INHERITDSFIELD) { >> + int wlen = skb_network_offset(skb); > > You need a blank line here, between var declaration and the rest. > >> + switch (tc_skb_protocol(skb)) { >> + case htons(ETH_P_IP): >> + wlen += sizeof(struct iphdr); >> + if (!pskb_may_pull(skb, wlen)) >> + return TC_ACT_SHOT; >> + 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)) >> + return TC_ACT_SHOT; >> + skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2; >> + break; >> + } >> + } >> + >> return action; >> } >> >> @@ -127,6 +149,9 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla, >> if (parm->flags & SKBMOD_F_SWAPMAC) >> lflags = SKBMOD_F_SWAPMAC; >> >> + if (parm->flags & SKBMOD_F_INHERITDSFIELD) >> + lflags |= SKBMOD_F_INHERITDSFIELD; >> + >> exists = tcf_idr_check(tn, parm->index, a, bind); >> if (exists && bind) >> return 0; ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net:sched: add action inheritdsfield to skbmod 2018-05-25 5:45 ` Fu, Qiaobin @ 2018-05-25 14:34 ` Marcelo Ricardo Leitner 2018-05-25 18:47 ` Cong Wang 1 sibling, 0 replies; 9+ messages in thread From: Marcelo Ricardo Leitner @ 2018-05-25 14:34 UTC (permalink / raw) To: Fu, Qiaobin Cc: davem@davemloft.net, netdev@vger.kernel.org, jhs@mojatatu.com, Michel Machado On Fri, May 25, 2018 at 05:45:03AM +0000, Fu, Qiaobin wrote: > Hi Marcelo, > > Thanks for pointing out these style issues. Below is the updated version: Hi Qiaobin, Looks good to me. Now you have to submit it like you submitted the original patch, but add the version tag to the summary. Like '[PATCH v2 net-next] ....' And without the text before the changelog. Thanks. > > --- > 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 <jhs@mojatatu.com> > > Signed-off-by: Qiaobin Fu <qiaobinf@bu.edu> > Reviewed-by: Michel Machado <michel@digirati.com.br> > --- > > Note that the motivation for this patch is found in the following discussion: > https://www.spinics.net/lists/netdev/msg501061.html > --- > > diff --git a/include/uapi/linux/tc_act/tc_skbmod.h b/include/uapi/linux/tc_act/tc_skbmod.h > index 38c072f..0718b48 100644 > --- a/include/uapi/linux/tc_act/tc_skbmod.h > +++ b/include/uapi/linux/tc_act/tc_skbmod.h > @@ -19,6 +19,7 @@ > #define SKBMOD_F_SMAC 0x2 > #define SKBMOD_F_ETYPE 0x4 > #define SKBMOD_F_SWAPMAC 0x8 > +#define SKBMOD_F_INHERITDSFIELD 0x10 > > struct tc_skbmod { > tc_gen; > diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c > index ad050d7..e2082f6 100644 > --- a/net/sched/act_skbmod.c > +++ b/net/sched/act_skbmod.c > @@ -16,6 +16,9 @@ > #include <linux/rtnetlink.h> > #include <net/netlink.h> > #include <net/pkt_sched.h> > +#include <net/ip.h> > +#include <net/ipv6.h> > +#include <net/dsfield.h> > > #include <linux/tc_act/tc_skbmod.h> > #include <net/tc_act/tc_skbmod.h> > @@ -72,6 +75,26 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a, > ether_addr_copy(eth_hdr(skb)->h_source, (u8 *)tmpaddr); > } > > + if (flags & SKBMOD_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)) > + return TC_ACT_SHOT; > + 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)) > + return TC_ACT_SHOT; > + skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2; > + break; > + } > + } > + > return action; > } > > @@ -127,6 +150,9 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla, > if (parm->flags & SKBMOD_F_SWAPMAC) > lflags = SKBMOD_F_SWAPMAC; > > + if (parm->flags & SKBMOD_F_INHERITDSFIELD) > + lflags |= SKBMOD_F_INHERITDSFIELD; > + > exists = tcf_idr_check(tn, parm->index, a, bind); > if (exists && bind) > return 0; > > > On May 23, 2018, at 2:06 PM, Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> wrote: > > > > Hi, > > > > Some style fixes: > > > > On Thu, May 17, 2018 at 07:33:08PM +0000, Fu, Qiaobin wrote: > >> net/sched: add action inheritdsfield to skbmod > > > > This extra line above should not be here. > > > >> > >> The new action inheritdsfield copies the field DS of > >> IPv4 and IPv6 packets into skb->prioriry. This enables > > typo -----^ > > > >> later classification of packets based on the DS field. > >> > >> Original idea by Jamal Hadi Salim <jhs@mojatatu.com> > >> > >> Signed-off-by: Qiaobin Fu <qiaobinf@bu.edu> > >> Reviewed-by: Michel Machado <michel@digirati.com.br> > >> --- > >> > >> Note that the motivation for this patch is found in the following discussion: > >> https://www.spinics.net/lists/netdev/msg501061.html > >> --- > >> > >> diff --git a/include/uapi/linux/tc_act/tc_skbmod.h b/include/uapi/linux/tc_act/tc_skbmod.h > >> index 38c072f..0718b48 100644 > >> --- a/include/uapi/linux/tc_act/tc_skbmod.h > >> +++ b/include/uapi/linux/tc_act/tc_skbmod.h > >> @@ -19,6 +19,7 @@ > >> #define SKBMOD_F_SMAC 0x2 > >> #define SKBMOD_F_ETYPE 0x4 > >> #define SKBMOD_F_SWAPMAC 0x8 > >> +#define SKBMOD_F_INHERITDSFIELD 0x10 > >> > >> struct tc_skbmod { > >> tc_gen; > >> diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c > >> index ad050d7..21d5bec 100644 > >> --- a/net/sched/act_skbmod.c > >> +++ b/net/sched/act_skbmod.c > >> @@ -16,6 +16,9 @@ > >> #include <linux/rtnetlink.h> > >> #include <net/netlink.h> > >> #include <net/pkt_sched.h> > >> +#include <net/ip.h> > >> +#include <net/ipv6.h> > >> +#include <net/dsfield.h> > >> > >> #include <linux/tc_act/tc_skbmod.h> > >> #include <net/tc_act/tc_skbmod.h> > >> @@ -72,6 +75,25 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a, > >> ether_addr_copy(eth_hdr(skb)->h_source, (u8 *)tmpaddr); > >> } > >> > >> + if (flags & SKBMOD_F_INHERITDSFIELD) { > >> + int wlen = skb_network_offset(skb); > > > > You need a blank line here, between var declaration and the rest. > > > >> + switch (tc_skb_protocol(skb)) { > >> + case htons(ETH_P_IP): > >> + wlen += sizeof(struct iphdr); > >> + if (!pskb_may_pull(skb, wlen)) > >> + return TC_ACT_SHOT; > >> + 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)) > >> + return TC_ACT_SHOT; > >> + skb->priority = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2; > >> + break; > >> + } > >> + } > >> + > >> return action; > >> } > >> > >> @@ -127,6 +149,9 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla, > >> if (parm->flags & SKBMOD_F_SWAPMAC) > >> lflags = SKBMOD_F_SWAPMAC; > >> > >> + if (parm->flags & SKBMOD_F_INHERITDSFIELD) > >> + lflags |= SKBMOD_F_INHERITDSFIELD; > >> + > >> exists = tcf_idr_check(tn, parm->index, a, bind); > >> if (exists && bind) > >> return 0; > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net:sched: add action inheritdsfield to skbmod 2018-05-25 5:45 ` Fu, Qiaobin 2018-05-25 14:34 ` Marcelo Ricardo Leitner @ 2018-05-25 18:47 ` Cong Wang 1 sibling, 0 replies; 9+ messages in thread From: Cong Wang @ 2018-05-25 18:47 UTC (permalink / raw) To: Fu, Qiaobin Cc: Marcelo Ricardo Leitner, davem@davemloft.net, netdev@vger.kernel.org, jhs@mojatatu.com, Michel Machado On Thu, May 24, 2018 at 10:45 PM, Fu, Qiaobin <qiaobinf@bu.edu> 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. Please move it to skbedit. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net:sched: add action inheritdsfield to skbmod 2018-05-17 19:33 [PATCH net-next] net:sched: add action inheritdsfield to skbmod Fu, Qiaobin 2018-05-18 13:06 ` Jamal Hadi Salim 2018-05-23 21:06 ` Marcelo Ricardo Leitner @ 2018-05-23 23:01 ` Cong Wang 2018-05-24 12:11 ` Jamal Hadi Salim 2 siblings, 1 reply; 9+ messages in thread From: Cong Wang @ 2018-05-23 23:01 UTC (permalink / raw) To: Fu, Qiaobin Cc: davem@davemloft.net, netdev@vger.kernel.org, jhs@mojatatu.com, Michel Machado On Thu, May 17, 2018 at 12:33 PM, Fu, Qiaobin <qiaobinf@bu.edu> wrote: > net/sched: add action inheritdsfield to skbmod > > The new action inheritdsfield copies the field DS of > IPv4 and IPv6 packets into skb->prioriry. This enables > later classification of packets based on the DS field. > > Original idea by Jamal Hadi Salim <jhs@mojatatu.com> > > Signed-off-by: Qiaobin Fu <qiaobinf@bu.edu> > Reviewed-by: Michel Machado <michel@digirati.com.br> Hmm, but skbedit seems better than skbmod for this job, given: 1) It already modifies skb->priority, although with a given value 2) skbmod doesn't change skb metadata, it only changes payload I am _not_ saying there is strict rule for what skbmod can or can't change, it calls itself "data modifier", so I am saying we probably need to follow this existing practice. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net:sched: add action inheritdsfield to skbmod 2018-05-23 23:01 ` Cong Wang @ 2018-05-24 12:11 ` Jamal Hadi Salim 0 siblings, 0 replies; 9+ messages in thread From: Jamal Hadi Salim @ 2018-05-24 12:11 UTC (permalink / raw) To: Cong Wang, Fu, Qiaobin Cc: davem@davemloft.net, netdev@vger.kernel.org, Michel Machado On 23/05/18 07:01 PM, Cong Wang wrote: > On Thu, May 17, 2018 at 12:33 PM, Fu, Qiaobin <qiaobinf@bu.edu> wrote: > Hmm, but skbedit seems better than skbmod for this job, > given: > > 1) It already modifies skb->priority, although with a given value > > 2) skbmod doesn't change skb metadata, it only changes payload > > I am _not_ saying there is strict rule for what skbmod can or can't > change, it calls itself "data modifier", so I am saying we probably > need to follow this existing practice. > I am indifferent - you can move it to skbedit. Note: I have patches which i will send out at some point when I get the chance on pedit for implementing the concept of "copy data to metadata" and "copy metadata to data" for pedit it made a lot of sense to add the feature there. In this case skbedit makes more sense. cheers, jamal ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-05-25 18:48 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-17 19:33 [PATCH net-next] net:sched: add action inheritdsfield to skbmod Fu, Qiaobin
2018-05-18 13:06 ` Jamal Hadi Salim
[not found] ` <DA5C727C-BAE1-4355-B67C-5F9C3769CA30@bu.edu>
2018-05-21 15:00 ` Jamal Hadi Salim
2018-05-23 21:06 ` Marcelo Ricardo Leitner
2018-05-25 5:45 ` Fu, Qiaobin
2018-05-25 14:34 ` Marcelo Ricardo Leitner
2018-05-25 18:47 ` Cong Wang
2018-05-23 23:01 ` Cong Wang
2018-05-24 12:11 ` Jamal Hadi Salim
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).