netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf: synchronize bpf uapi header with tools
@ 2018-07-19 12:53 Taeung Song
  2018-07-19 14:01 ` Quentin Monnet
  0 siblings, 1 reply; 3+ messages in thread
From: Taeung Song @ 2018-07-19 12:53 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: netdev, linux-kernel, Arnaldo Carvalho de Melo, David Ahern

To pick the change in:

  4c79579b44b1 ("bpf: Change bpf_fib_lookup to return lookup status")

This bpftool build warning occurs:

  Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'

Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/include/uapi/linux/bpf.h | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 59b19b6a40d7..b7db3261c62d 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -1857,7 +1857,8 @@ union bpf_attr {
  *		is resolved), the nexthop address is returned in ipv4_dst
  *		or ipv6_dst based on family, smac is set to mac address of
  *		egress device, dmac is set to nexthop mac address, rt_metric
- *		is set to metric from route (IPv4/IPv6 only).
+ *		is set to metric from route (IPv4/IPv6 only), and ifindex
+ *		is set to the device index of the nexthop from the FIB lookup.
  *
  *             *plen* argument is the size of the passed in struct.
  *             *flags* argument can be a combination of one or more of the
@@ -1873,9 +1874,10 @@ union bpf_attr {
  *             *ctx* is either **struct xdp_md** for XDP programs or
  *             **struct sk_buff** tc cls_act programs.
  *     Return
- *             Egress device index on success, 0 if packet needs to continue
- *             up the stack for further processing or a negative error in case
- *             of failure.
+ *		* < 0 if any input argument is invalid
+ *		*   0 on success (packet is forwarded, nexthop neighbor exists)
+ *		* > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
+ *		*     packet is not forwarded or needs assist from full stack
  *
  * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags)
  *	Description
@@ -2612,6 +2614,18 @@ struct bpf_raw_tracepoint_args {
 #define BPF_FIB_LOOKUP_DIRECT  BIT(0)
 #define BPF_FIB_LOOKUP_OUTPUT  BIT(1)
 
+enum {
+	BPF_FIB_LKUP_RET_SUCCESS,      /* lookup successful */
+	BPF_FIB_LKUP_RET_BLACKHOLE,    /* dest is blackholed; can be dropped */
+	BPF_FIB_LKUP_RET_UNREACHABLE,  /* dest is unreachable; can be dropped */
+	BPF_FIB_LKUP_RET_PROHIBIT,     /* dest not allowed; can be dropped */
+	BPF_FIB_LKUP_RET_NOT_FWDED,    /* packet is not forwarded */
+	BPF_FIB_LKUP_RET_FWD_DISABLED, /* fwding is not enabled on ingress */
+	BPF_FIB_LKUP_RET_UNSUPP_LWT,   /* fwd requires encapsulation */
+	BPF_FIB_LKUP_RET_NO_NEIGH,     /* no neighbor entry for nh */
+	BPF_FIB_LKUP_RET_FRAG_NEEDED,  /* fragmentation required to fwd */
+};
+
 struct bpf_fib_lookup {
 	/* input:  network family for lookup (AF_INET, AF_INET6)
 	 * output: network family of egress nexthop
@@ -2625,7 +2639,11 @@ struct bpf_fib_lookup {
 
 	/* total length of packet from network header - used for MTU check */
 	__u16	tot_len;
-	__u32	ifindex;  /* L3 device index for lookup */
+
+	/* input: L3 device index for lookup
+	 * output: device index from FIB lookup
+	 */
+	__u32	ifindex;
 
 	union {
 		/* inputs to lookup */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: synchronize bpf uapi header with tools
  2018-07-19 12:53 [PATCH] bpf: synchronize bpf uapi header with tools Taeung Song
@ 2018-07-19 14:01 ` Quentin Monnet
  2018-07-19 14:21   ` Taeung Song
  0 siblings, 1 reply; 3+ messages in thread
From: Quentin Monnet @ 2018-07-19 14:01 UTC (permalink / raw)
  To: Taeung Song, Alexei Starovoitov, Daniel Borkmann
  Cc: netdev, linux-kernel, Arnaldo Carvalho de Melo, David Ahern

Hi Taeung,

2018-07-19 21:53 UTC+0900 ~ Taeung Song <treeze.taeung@gmail.com>
> To pick the change in:
> 
>   4c79579b44b1 ("bpf: Change bpf_fib_lookup to return lookup status")
> 
> This bpftool build warning occurs:
> 
>   Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'
> 
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: David Ahern <dsahern@gmail.com>
> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
> ---
>  tools/include/uapi/linux/bpf.h | 28 +++++++++++++++++++++++-----
>  1 file changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index 59b19b6a40d7..b7db3261c62d 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -1857,7 +1857,8 @@ union bpf_attr {
>   *		is resolved), the nexthop address is returned in ipv4_dst
>   *		or ipv6_dst based on family, smac is set to mac address of
>   *		egress device, dmac is set to nexthop mac address, rt_metric
> - *		is set to metric from route (IPv4/IPv6 only).
> + *		is set to metric from route (IPv4/IPv6 only), and ifindex
> + *		is set to the device index of the nexthop from the FIB lookup.
>   *
>   *             *plen* argument is the size of the passed in struct.
>   *             *flags* argument can be a combination of one or more of the
> @@ -1873,9 +1874,10 @@ union bpf_attr {
>   *             *ctx* is either **struct xdp_md** for XDP programs or
>   *             **struct sk_buff** tc cls_act programs.
>   *     Return
> - *             Egress device index on success, 0 if packet needs to continue
> - *             up the stack for further processing or a negative error in case
> - *             of failure.
> + *		* < 0 if any input argument is invalid
> + *		*   0 on success (packet is forwarded, nexthop neighbor exists)
> + *		* > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
> + *		*     packet is not forwarded or needs assist from full stack
>   *
>   * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags)
>   *	Description
> @@ -2612,6 +2614,18 @@ struct bpf_raw_tracepoint_args {
>  #define BPF_FIB_LOOKUP_DIRECT  BIT(0)
>  #define BPF_FIB_LOOKUP_OUTPUT  BIT(1)
>  
> +enum {
> +	BPF_FIB_LKUP_RET_SUCCESS,      /* lookup successful */
> +	BPF_FIB_LKUP_RET_BLACKHOLE,    /* dest is blackholed; can be dropped */
> +	BPF_FIB_LKUP_RET_UNREACHABLE,  /* dest is unreachable; can be dropped */
> +	BPF_FIB_LKUP_RET_PROHIBIT,     /* dest not allowed; can be dropped */
> +	BPF_FIB_LKUP_RET_NOT_FWDED,    /* packet is not forwarded */
> +	BPF_FIB_LKUP_RET_FWD_DISABLED, /* fwding is not enabled on ingress */
> +	BPF_FIB_LKUP_RET_UNSUPP_LWT,   /* fwd requires encapsulation */
> +	BPF_FIB_LKUP_RET_NO_NEIGH,     /* no neighbor entry for nh */
> +	BPF_FIB_LKUP_RET_FRAG_NEEDED,  /* fragmentation required to fwd */
> +};
> +
>  struct bpf_fib_lookup {
>  	/* input:  network family for lookup (AF_INET, AF_INET6)
>  	 * output: network family of egress nexthop
> @@ -2625,7 +2639,11 @@ struct bpf_fib_lookup {
>  
>  	/* total length of packet from network header - used for MTU check */
>  	__u16	tot_len;
> -	__u32	ifindex;  /* L3 device index for lookup */
> +
> +	/* input: L3 device index for lookup
> +	 * output: device index from FIB lookup
> +	 */
> +	__u32	ifindex;
>  
>  	union {
>  		/* inputs to lookup */
> 

This has been updated in the bpf-next tree already, see commit
9b8ca3795199 ("tools: bpf: synchronise BPF UAPI header with tools").

Best regards,
Quentin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: synchronize bpf uapi header with tools
  2018-07-19 14:01 ` Quentin Monnet
@ 2018-07-19 14:21   ` Taeung Song
  0 siblings, 0 replies; 3+ messages in thread
From: Taeung Song @ 2018-07-19 14:21 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Alexei Starovoitov, Daniel Borkmann, netdev, linux-kernel,
	Arnaldo Carvalho de Melo, David Ahern

Hi Quentin,

On 07/19/2018 11:01 PM, Quentin Monnet wrote:
> Hi Taeung,
> 
> 2018-07-19 21:53 UTC+0900 ~ Taeung Song <treeze.taeung@gmail.com>
>> To pick the change in:
>>
>>    4c79579b44b1 ("bpf: Change bpf_fib_lookup to return lookup status")
>>
>> This bpftool build warning occurs:
>>
>>    Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'
>>
>> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
>> Cc: David Ahern <dsahern@gmail.com>
>> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
>> ---
>>   tools/include/uapi/linux/bpf.h | 28 +++++++++++++++++++++++-----
>>   1 file changed, 23 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
>> index 59b19b6a40d7..b7db3261c62d 100644
>> --- a/tools/include/uapi/linux/bpf.h
>> +++ b/tools/include/uapi/linux/bpf.h
>> @@ -1857,7 +1857,8 @@ union bpf_attr {
>>    *		is resolved), the nexthop address is returned in ipv4_dst
>>    *		or ipv6_dst based on family, smac is set to mac address of
>>    *		egress device, dmac is set to nexthop mac address, rt_metric
>> - *		is set to metric from route (IPv4/IPv6 only).
>> + *		is set to metric from route (IPv4/IPv6 only), and ifindex
>> + *		is set to the device index of the nexthop from the FIB lookup.
>>    *
>>    *             *plen* argument is the size of the passed in struct.
>>    *             *flags* argument can be a combination of one or more of the
>> @@ -1873,9 +1874,10 @@ union bpf_attr {
>>    *             *ctx* is either **struct xdp_md** for XDP programs or
>>    *             **struct sk_buff** tc cls_act programs.
>>    *     Return
>> - *             Egress device index on success, 0 if packet needs to continue
>> - *             up the stack for further processing or a negative error in case
>> - *             of failure.
>> + *		* < 0 if any input argument is invalid
>> + *		*   0 on success (packet is forwarded, nexthop neighbor exists)
>> + *		* > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
>> + *		*     packet is not forwarded or needs assist from full stack
>>    *
>>    * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags)
>>    *	Description
>> @@ -2612,6 +2614,18 @@ struct bpf_raw_tracepoint_args {
>>   #define BPF_FIB_LOOKUP_DIRECT  BIT(0)
>>   #define BPF_FIB_LOOKUP_OUTPUT  BIT(1)
>>   
>> +enum {
>> +	BPF_FIB_LKUP_RET_SUCCESS,      /* lookup successful */
>> +	BPF_FIB_LKUP_RET_BLACKHOLE,    /* dest is blackholed; can be dropped */
>> +	BPF_FIB_LKUP_RET_UNREACHABLE,  /* dest is unreachable; can be dropped */
>> +	BPF_FIB_LKUP_RET_PROHIBIT,     /* dest not allowed; can be dropped */
>> +	BPF_FIB_LKUP_RET_NOT_FWDED,    /* packet is not forwarded */
>> +	BPF_FIB_LKUP_RET_FWD_DISABLED, /* fwding is not enabled on ingress */
>> +	BPF_FIB_LKUP_RET_UNSUPP_LWT,   /* fwd requires encapsulation */
>> +	BPF_FIB_LKUP_RET_NO_NEIGH,     /* no neighbor entry for nh */
>> +	BPF_FIB_LKUP_RET_FRAG_NEEDED,  /* fragmentation required to fwd */
>> +};
>> +
>>   struct bpf_fib_lookup {
>>   	/* input:  network family for lookup (AF_INET, AF_INET6)
>>   	 * output: network family of egress nexthop
>> @@ -2625,7 +2639,11 @@ struct bpf_fib_lookup {
>>   
>>   	/* total length of packet from network header - used for MTU check */
>>   	__u16	tot_len;
>> -	__u32	ifindex;  /* L3 device index for lookup */
>> +
>> +	/* input: L3 device index for lookup
>> +	 * output: device index from FIB lookup
>> +	 */
>> +	__u32	ifindex;
>>   
>>   	union {
>>   		/* inputs to lookup */
>>
> 
> This has been updated in the bpf-next tree already, see commit
> 9b8ca3795199 ("tools: bpf: synchronise BPF UAPI header with tools").
> 
> Best regards,
> Quentin
> 

OK ! Thanks.

--
Thanks,
Taeung

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-19 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 12:53 [PATCH] bpf: synchronize bpf uapi header with tools Taeung Song
2018-07-19 14:01 ` Quentin Monnet
2018-07-19 14:21   ` Taeung Song

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).