diff mbox

[net-next,RFC,v2,2/6] skbuff: add "missed_flow" flag

Message ID 1395851472-10524-3-git-send-email-jiri@resnulli.us
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Jiri Pirko March 26, 2014, 4:31 p.m. UTC
This flag sets incoming switch device in order to let know that the flow
which the skb is part of is missed. Listener may react to it
appropriately,

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 include/linux/filter.h |  1 +
 include/linux/skbuff.h | 13 +++++++++++++
 net/core/filter.c      |  3 +++
 3 files changed, 17 insertions(+)

Comments

Alexei Starovoitov March 26, 2014, 4:59 p.m. UTC | #1
On Wed, Mar 26, 2014 at 9:31 AM, Jiri Pirko <jiri@resnulli.us> wrote:
> This flag sets incoming switch device in order to let know that the flow
> which the skb is part of is missed. Listener may react to it
> appropriately,
>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
>  include/linux/filter.h |  1 +
>  include/linux/skbuff.h | 13 +++++++++++++
>  net/core/filter.c      |  3 +++
>  3 files changed, 17 insertions(+)
>
> diff --git a/include/linux/filter.h b/include/linux/filter.h
> index e568c8e..38c7c04 100644
> --- a/include/linux/filter.h
> +++ b/include/linux/filter.h
> @@ -154,6 +154,7 @@ enum {
>         BPF_S_ANC_VLAN_TAG,
>         BPF_S_ANC_VLAN_TAG_PRESENT,
>         BPF_S_ANC_PAY_OFFSET,
> +       BPF_S_ANC_MISSED_FLOW,

Interesting use case for bpf...
looks like it's not connected to userspace.
Are you trying to extend ovs with switchdev api and bpf at once?
How do you plan to use this bpf extension?

Thanks
Alexei

>  };
>
>  #endif /* __LINUX_FILTER_H__ */
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 03db95a..0100c2f 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -567,6 +567,7 @@ struct sk_buff {
>          * headers if needed
>          */
>         __u8                    encapsulation:1;
> +       __u8                    missed_flow:1;
>         /* 6/8 bit hole (depending on ndisc_nodetype presence) */
>         kmemcheck_bitfield_end(flags2);
>
> @@ -2993,5 +2994,17 @@ static inline unsigned int skb_gso_network_seglen(const struct sk_buff *skb)
>                                skb_network_header(skb);
>         return hdr_len + skb_gso_transport_seglen(skb);
>  }
> +
> +/**
> + * skb_mark_missed_flow - marks skb as a part of missed flow
> + * @skb: buffer
> + *
> + * Marks skb as a part of missed flow.
> + */
> +static inline void skb_mark_missed_flow(struct sk_buff *skb)
> +{
> +       skb->missed_flow = 1;
> +}
> +
>  #endif /* __KERNEL__ */
>  #endif /* _LINUX_SKBUFF_H */
> diff --git a/net/core/filter.c b/net/core/filter.c
> index ad30d62..048f11a 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -350,6 +350,9 @@ load_b:
>                 case BPF_S_ANC_PAY_OFFSET:
>                         A = __skb_get_poff(skb);
>                         continue;
> +               case BPF_S_ANC_MISSED_FLOW:
> +                       A = !!skb->missed_flow;
> +                       continue;
>                 case BPF_S_ANC_NLATTR: {
>                         struct nlattr *nla;
>
> --
> 1.8.5.3
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko March 26, 2014, 5:25 p.m. UTC | #2
Wed, Mar 26, 2014 at 05:59:12PM CET, alexei.starovoitov@gmail.com wrote:
>On Wed, Mar 26, 2014 at 9:31 AM, Jiri Pirko <jiri@resnulli.us> wrote:
>> This flag sets incoming switch device in order to let know that the flow
>> which the skb is part of is missed. Listener may react to it
>> appropriately,
>>
>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>> ---
>>  include/linux/filter.h |  1 +
>>  include/linux/skbuff.h | 13 +++++++++++++
>>  net/core/filter.c      |  3 +++
>>  3 files changed, 17 insertions(+)
>>
>> diff --git a/include/linux/filter.h b/include/linux/filter.h
>> index e568c8e..38c7c04 100644
>> --- a/include/linux/filter.h
>> +++ b/include/linux/filter.h
>> @@ -154,6 +154,7 @@ enum {
>>         BPF_S_ANC_VLAN_TAG,
>>         BPF_S_ANC_VLAN_TAG_PRESENT,
>>         BPF_S_ANC_PAY_OFFSET,
>> +       BPF_S_ANC_MISSED_FLOW,
>
>Interesting use case for bpf...
>looks like it's not connected to userspace.
>Are you trying to extend ovs with switchdev api and bpf at once?
>How do you plan to use this bpf extension?

The motive fot this is to provides a user (userspace app) possibility to
get all skbs which were "flow-missed". He can adjust the filter so that
only these can get through.



>
>Thanks
>Alexei
>
>>  };
>>
>>  #endif /* __LINUX_FILTER_H__ */
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 03db95a..0100c2f 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -567,6 +567,7 @@ struct sk_buff {
>>          * headers if needed
>>          */
>>         __u8                    encapsulation:1;
>> +       __u8                    missed_flow:1;
>>         /* 6/8 bit hole (depending on ndisc_nodetype presence) */
>>         kmemcheck_bitfield_end(flags2);
>>
>> @@ -2993,5 +2994,17 @@ static inline unsigned int skb_gso_network_seglen(const struct sk_buff *skb)
>>                                skb_network_header(skb);
>>         return hdr_len + skb_gso_transport_seglen(skb);
>>  }
>> +
>> +/**
>> + * skb_mark_missed_flow - marks skb as a part of missed flow
>> + * @skb: buffer
>> + *
>> + * Marks skb as a part of missed flow.
>> + */
>> +static inline void skb_mark_missed_flow(struct sk_buff *skb)
>> +{
>> +       skb->missed_flow = 1;
>> +}
>> +
>>  #endif /* __KERNEL__ */
>>  #endif /* _LINUX_SKBUFF_H */
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index ad30d62..048f11a 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -350,6 +350,9 @@ load_b:
>>                 case BPF_S_ANC_PAY_OFFSET:
>>                         A = __skb_get_poff(skb);
>>                         continue;
>> +               case BPF_S_ANC_MISSED_FLOW:
>> +                       A = !!skb->missed_flow;
>> +                       continue;
>>                 case BPF_S_ANC_NLATTR: {
>>                         struct nlattr *nla;
>>
>> --
>> 1.8.5.3
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Dichtel March 27, 2014, 10:31 a.m. UTC | #3
Le 26/03/2014 17:31, Jiri Pirko a écrit :
> This flag sets incoming switch device in order to let know that the flow
> which the skb is part of is missed. Listener may react to it
> appropriately,
>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
>   include/linux/filter.h |  1 +
>   include/linux/skbuff.h | 13 +++++++++++++
>   net/core/filter.c      |  3 +++
>   3 files changed, 17 insertions(+)
>
> diff --git a/include/linux/filter.h b/include/linux/filter.h
> index e568c8e..38c7c04 100644
> --- a/include/linux/filter.h
> +++ b/include/linux/filter.h
> @@ -154,6 +154,7 @@ enum {
>   	BPF_S_ANC_VLAN_TAG,
>   	BPF_S_ANC_VLAN_TAG_PRESENT,
>   	BPF_S_ANC_PAY_OFFSET,
> +	BPF_S_ANC_MISSED_FLOW,
>   };
>
>   #endif /* __LINUX_FILTER_H__ */
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 03db95a..0100c2f 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -567,6 +567,7 @@ struct sk_buff {
>   	 * headers if needed
>   	 */
>   	__u8			encapsulation:1;
> +	__u8			missed_flow:1;
>   	/* 6/8 bit hole (depending on ndisc_nodetype presence) */
Please fix also the comment.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko March 27, 2014, 10:34 a.m. UTC | #4
Thu, Mar 27, 2014 at 11:31:42AM CET, nicolas.dichtel@6wind.com wrote:
>Le 26/03/2014 17:31, Jiri Pirko a écrit :
>>This flag sets incoming switch device in order to let know that the flow
>>which the skb is part of is missed. Listener may react to it
>>appropriately,
>>
>>Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>>---
>>  include/linux/filter.h |  1 +
>>  include/linux/skbuff.h | 13 +++++++++++++
>>  net/core/filter.c      |  3 +++
>>  3 files changed, 17 insertions(+)
>>
>>diff --git a/include/linux/filter.h b/include/linux/filter.h
>>index e568c8e..38c7c04 100644
>>--- a/include/linux/filter.h
>>+++ b/include/linux/filter.h
>>@@ -154,6 +154,7 @@ enum {
>>  	BPF_S_ANC_VLAN_TAG,
>>  	BPF_S_ANC_VLAN_TAG_PRESENT,
>>  	BPF_S_ANC_PAY_OFFSET,
>>+	BPF_S_ANC_MISSED_FLOW,
>>  };
>>
>>  #endif /* __LINUX_FILTER_H__ */
>>diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>>index 03db95a..0100c2f 100644
>>--- a/include/linux/skbuff.h
>>+++ b/include/linux/skbuff.h
>>@@ -567,6 +567,7 @@ struct sk_buff {
>>  	 * headers if needed
>>  	 */
>>  	__u8			encapsulation:1;
>>+	__u8			missed_flow:1;
>>  	/* 6/8 bit hole (depending on ndisc_nodetype presence) */
>Please fix also the comment.

will do. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/filter.h b/include/linux/filter.h
index e568c8e..38c7c04 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -154,6 +154,7 @@  enum {
 	BPF_S_ANC_VLAN_TAG,
 	BPF_S_ANC_VLAN_TAG_PRESENT,
 	BPF_S_ANC_PAY_OFFSET,
+	BPF_S_ANC_MISSED_FLOW,
 };
 
 #endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 03db95a..0100c2f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -567,6 +567,7 @@  struct sk_buff {
 	 * headers if needed
 	 */
 	__u8			encapsulation:1;
+	__u8			missed_flow:1;
 	/* 6/8 bit hole (depending on ndisc_nodetype presence) */
 	kmemcheck_bitfield_end(flags2);
 
@@ -2993,5 +2994,17 @@  static inline unsigned int skb_gso_network_seglen(const struct sk_buff *skb)
 			       skb_network_header(skb);
 	return hdr_len + skb_gso_transport_seglen(skb);
 }
+
+/**
+ * skb_mark_missed_flow - marks skb as a part of missed flow
+ * @skb: buffer
+ *
+ * Marks skb as a part of missed flow.
+ */
+static inline void skb_mark_missed_flow(struct sk_buff *skb)
+{
+	skb->missed_flow = 1;
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* _LINUX_SKBUFF_H */
diff --git a/net/core/filter.c b/net/core/filter.c
index ad30d62..048f11a 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -350,6 +350,9 @@  load_b:
 		case BPF_S_ANC_PAY_OFFSET:
 			A = __skb_get_poff(skb);
 			continue;
+		case BPF_S_ANC_MISSED_FLOW:
+			A = !!skb->missed_flow;
+			continue;
 		case BPF_S_ANC_NLATTR: {
 			struct nlattr *nla;