All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] bpf, i40e: Report bpf_prog id during XDP_QUERY_PROG
@ 2017-06-21 17:27 Daniel Borkmann
  2017-06-21 17:54 ` John Fastabend
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Borkmann @ 2017-06-21 17:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, Daniel Borkmann, Martin KaFai Lau, Alexander Duyck

Fill the bpf_prog with the id just like we do in other XDP enabled
drivers.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Alexander Duyck <alexander.h.duyck@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2db93d3..6f5adb5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -9589,6 +9589,7 @@ static int i40e_xdp(struct net_device *dev,
 		return i40e_xdp_setup(vsi, xdp->prog);
 	case XDP_QUERY_PROG:
 		xdp->prog_attached = i40e_enabled_xdp_vsi(vsi);
+		xdp->prog_id = xdp->prog_attached ? vsi->xdp_prog->aux->id : 0;
 		return 0;
 	default:
 		return -EINVAL;
-- 
1.9.3

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

* Re: [PATCH net-next] bpf, i40e: Report bpf_prog id during XDP_QUERY_PROG
  2017-06-21 17:27 [PATCH net-next] bpf, i40e: Report bpf_prog id during XDP_QUERY_PROG Daniel Borkmann
@ 2017-06-21 17:54 ` John Fastabend
  2017-06-21 18:23   ` Alexander Duyck
  0 siblings, 1 reply; 4+ messages in thread
From: John Fastabend @ 2017-06-21 17:54 UTC (permalink / raw)
  To: Daniel Borkmann, davem; +Cc: netdev, Martin KaFai Lau, Alexander Duyck

On 06/21/2017 10:27 AM, Daniel Borkmann wrote:
> Fill the bpf_prog with the id just like we do in other XDP enabled
> drivers.
> 
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Martin KaFai Lau <kafai@fb.com>
> Cc: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 2db93d3..6f5adb5 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -9589,6 +9589,7 @@ static int i40e_xdp(struct net_device *dev,
>  		return i40e_xdp_setup(vsi, xdp->prog);
>  	case XDP_QUERY_PROG:
>  		xdp->prog_attached = i40e_enabled_xdp_vsi(vsi);
> +		xdp->prog_id = xdp->prog_attached ? vsi->xdp_prog->aux->id : 0;
>  		return 0;
>  	default:
>  		return -EINVAL;
> 

Looks good to me.

Acked-by: John Fastabend <john.fastabend@gmail.com>

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

* Re: [PATCH net-next] bpf, i40e: Report bpf_prog id during XDP_QUERY_PROG
  2017-06-21 17:54 ` John Fastabend
@ 2017-06-21 18:23   ` Alexander Duyck
  2017-06-21 18:33     ` Daniel Borkmann
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Duyck @ 2017-06-21 18:23 UTC (permalink / raw)
  To: John Fastabend
  Cc: Daniel Borkmann, David Miller, Netdev, Martin KaFai Lau, Alexander Duyck

On Wed, Jun 21, 2017 at 10:54 AM, John Fastabend
<john.fastabend@gmail.com> wrote:
> On 06/21/2017 10:27 AM, Daniel Borkmann wrote:
>> Fill the bpf_prog with the id just like we do in other XDP enabled
>> drivers.
>>
>> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
>> Cc: Martin KaFai Lau <kafai@fb.com>
>> Cc: Alexander Duyck <alexander.h.duyck@intel.com>
>> ---
>>  drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
>> index 2db93d3..6f5adb5 100644
>> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
>> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
>> @@ -9589,6 +9589,7 @@ static int i40e_xdp(struct net_device *dev,
>>               return i40e_xdp_setup(vsi, xdp->prog);
>>       case XDP_QUERY_PROG:
>>               xdp->prog_attached = i40e_enabled_xdp_vsi(vsi);
>> +             xdp->prog_id = xdp->prog_attached ? vsi->xdp_prog->aux->id : 0;
>>               return 0;
>>       default:
>>               return -EINVAL;
>>
>
> Looks good to me.
>
> Acked-by: John Fastabend <john.fastabend@gmail.com>

My preference would be to test for vsi->xdp_prog instead of
xdp->prog_attached since it is more obvious what is going on in that
case. We might even want to look at getting rid of the call to
i40e_enabled_xdp_vsi eventually. But that is probably follow-up work
for later.

This should work assuming the RTNL lock is always held when this call is made.

Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>

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

* Re: [PATCH net-next] bpf, i40e: Report bpf_prog id during XDP_QUERY_PROG
  2017-06-21 18:23   ` Alexander Duyck
@ 2017-06-21 18:33     ` Daniel Borkmann
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2017-06-21 18:33 UTC (permalink / raw)
  To: Alexander Duyck, John Fastabend
  Cc: David Miller, Netdev, Martin KaFai Lau, Alexander Duyck

On 06/21/2017 08:23 PM, Alexander Duyck wrote:
> On Wed, Jun 21, 2017 at 10:54 AM, John Fastabend
> <john.fastabend@gmail.com> wrote:
>> On 06/21/2017 10:27 AM, Daniel Borkmann wrote:
[...]
>>>   drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
>>> index 2db93d3..6f5adb5 100644
>>> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
>>> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
>>> @@ -9589,6 +9589,7 @@ static int i40e_xdp(struct net_device *dev,
>>>                return i40e_xdp_setup(vsi, xdp->prog);
>>>        case XDP_QUERY_PROG:
>>>                xdp->prog_attached = i40e_enabled_xdp_vsi(vsi);
>>> +             xdp->prog_id = xdp->prog_attached ? vsi->xdp_prog->aux->id : 0;
>>>                return 0;
>>>        default:
>>>                return -EINVAL;
>>>
>>
>> Looks good to me.
>>
>> Acked-by: John Fastabend <john.fastabend@gmail.com>
>
> My preference would be to test for vsi->xdp_prog instead of
> xdp->prog_attached since it is more obvious what is going on in that
> case. We might even want to look at getting rid of the call to
> i40e_enabled_xdp_vsi eventually. But that is probably follow-up work
> for later.

Yeah, given i40e_enabled_xdp_vsi() is just returning !!vsi->xdp_prog
anyway.

> This should work assuming the RTNL lock is always held when this call is made.

That is guaranteed from call-sites, it's strictly required.

> Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>

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

end of thread, other threads:[~2017-06-21 18:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 17:27 [PATCH net-next] bpf, i40e: Report bpf_prog id during XDP_QUERY_PROG Daniel Borkmann
2017-06-21 17:54 ` John Fastabend
2017-06-21 18:23   ` Alexander Duyck
2017-06-21 18:33     ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.