All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] virtio_net: reject XDP programs using header adjustment
@ 2016-12-19 15:05 Jakub Kicinski
  2016-12-19 15:23 ` Mintz, Yuval
  2016-12-19 17:50 ` John Fastabend
  0 siblings, 2 replies; 7+ messages in thread
From: Jakub Kicinski @ 2016-12-19 15:05 UTC (permalink / raw)
  To: netdev
  Cc: john.fastabend, kafai, daniel, alexei.starovoitov, mst, Jakub Kicinski

commit 17bedab27231 ("bpf: xdp: Allow head adjustment in XDP prog")
added a new XDP helper to prepend and remove data from a frame.
Make virtio_net reject programs making use of this helper until
proper support is added.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 drivers/net/virtio_net.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 08327e005ccc..db761f37783e 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1677,6 +1677,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog)
 	u16 xdp_qp = 0, curr_qp;
 	int i, err;
 
+	if (prog && prog->xdp_adjust_head) {
+		netdev_warn(dev, "Does not support bpf_xdp_adjust_head()\n");
+		return -EOPNOTSUPP;
+	}
+
 	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||
 	    virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) {
 		netdev_warn(dev, "can't set XDP while host is implementing LRO, disable LRO first\n");
-- 
2.11.0

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

* RE: [PATCH net] virtio_net: reject XDP programs using header adjustment
  2016-12-19 15:05 [PATCH net] virtio_net: reject XDP programs using header adjustment Jakub Kicinski
@ 2016-12-19 15:23 ` Mintz, Yuval
  2016-12-19 15:42   ` Jakub Kicinski
  2016-12-19 17:50 ` John Fastabend
  1 sibling, 1 reply; 7+ messages in thread
From: Mintz, Yuval @ 2016-12-19 15:23 UTC (permalink / raw)
  To: Jakub Kicinski, netdev
  Cc: john.fastabend, kafai, daniel, alexei.starovoitov, mst

> commit 17bedab27231 ("bpf: xdp: Allow head adjustment in XDP prog")
> added a new XDP helper to prepend and remove data from a frame.
> Make virtio_net reject programs making use of this helper until proper
> support is added.
> 
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Is that how it goes until we'll add the proper infrastructure?
Am I expected to provide the same for qede?

I was under the impression that so long as this is being [early] developed
and there's no way to communicate what is and isn't supported by
a given implementation, it would simply be the user's responsibility
to make sure what he's trying is supported.

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

* Re: [PATCH net] virtio_net: reject XDP programs using header adjustment
  2016-12-19 15:23 ` Mintz, Yuval
@ 2016-12-19 15:42   ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2016-12-19 15:42 UTC (permalink / raw)
  To: Mintz, Yuval
  Cc: netdev, john.fastabend, kafai, daniel, alexei.starovoitov, mst

On Mon, Dec 19, 2016 at 3:23 PM, Mintz, Yuval <Yuval.Mintz@cavium.com> wrote:
>> commit 17bedab27231 ("bpf: xdp: Allow head adjustment in XDP prog")
>> added a new XDP helper to prepend and remove data from a frame.
>> Make virtio_net reject programs making use of this helper until proper
>> support is added.
>>
>> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>
> Is that how it goes until we'll add the proper infrastructure?
> Am I expected to provide the same for qede?

I asked Martin to fix the existing drivers like qede but virtio's XDP
was not merged at that point.

> I was under the impression that so long as this is being [early] developed
> and there's no way to communicate what is and isn't supported by
> a given implementation, it would simply be the user's responsibility
> to make sure what he's trying is supported.

IMHO the less user has to guess the better if we're hoping for wide adoption.

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

* Re: [PATCH net] virtio_net: reject XDP programs using header adjustment
  2016-12-19 15:05 [PATCH net] virtio_net: reject XDP programs using header adjustment Jakub Kicinski
  2016-12-19 15:23 ` Mintz, Yuval
@ 2016-12-19 17:50 ` John Fastabend
  2016-12-19 20:08   ` David Miller
  2016-12-20 12:30   ` Jakub Kicinski
  1 sibling, 2 replies; 7+ messages in thread
From: John Fastabend @ 2016-12-19 17:50 UTC (permalink / raw)
  To: Jakub Kicinski, netdev; +Cc: kafai, daniel, alexei.starovoitov, mst

On 16-12-19 07:05 AM, Jakub Kicinski wrote:
> commit 17bedab27231 ("bpf: xdp: Allow head adjustment in XDP prog")
> added a new XDP helper to prepend and remove data from a frame.
> Make virtio_net reject programs making use of this helper until
> proper support is added.
> 
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> ---
>  drivers/net/virtio_net.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 08327e005ccc..db761f37783e 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1677,6 +1677,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog)
>  	u16 xdp_qp = 0, curr_qp;
>  	int i, err;
>  
> +	if (prog && prog->xdp_adjust_head) {
> +		netdev_warn(dev, "Does not support bpf_xdp_adjust_head()\n");
> +		return -EOPNOTSUPP;
> +	}
> +
>  	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||
>  	    virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) {
>  		netdev_warn(dev, "can't set XDP while host is implementing LRO, disable LRO first\n");
> 

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

Thanks patch looks good. Alternatively we could push a "bug fix" to
support the adjust header feature depending on how DaveM and MST feel
about that. I don't have a strong opinion but I have the patch on my
queue it just needs some more testing. The adjust header bits were
merged in between some of the later versions of the patch which is how
this check got missed.

Thanks,
John

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

* Re: [PATCH net] virtio_net: reject XDP programs using header adjustment
  2016-12-19 17:50 ` John Fastabend
@ 2016-12-19 20:08   ` David Miller
  2016-12-20 12:30   ` Jakub Kicinski
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2016-12-19 20:08 UTC (permalink / raw)
  To: john.fastabend
  Cc: jakub.kicinski, netdev, kafai, daniel, alexei.starovoitov, mst

From: John Fastabend <john.fastabend@gmail.com>
Date: Mon, 19 Dec 2016 09:50:57 -0800

> On 16-12-19 07:05 AM, Jakub Kicinski wrote:
>> commit 17bedab27231 ("bpf: xdp: Allow head adjustment in XDP prog")
>> added a new XDP helper to prepend and remove data from a frame.
>> Make virtio_net reject programs making use of this helper until
>> proper support is added.
>> 
>> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>> ---
>>  drivers/net/virtio_net.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>> 
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index 08327e005ccc..db761f37783e 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -1677,6 +1677,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog)
>>  	u16 xdp_qp = 0, curr_qp;
>>  	int i, err;
>>  
>> +	if (prog && prog->xdp_adjust_head) {
>> +		netdev_warn(dev, "Does not support bpf_xdp_adjust_head()\n");
>> +		return -EOPNOTSUPP;
>> +	}
>> +
>>  	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||
>>  	    virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) {
>>  		netdev_warn(dev, "can't set XDP while host is implementing LRO, disable LRO first\n");
>> 
> 
> Acked-by: John Fastabend <john.r.fastabend@intel.com>
> 
> Thanks patch looks good. Alternatively we could push a "bug fix" to
> support the adjust header feature depending on how DaveM and MST feel
> about that. I don't have a strong opinion but I have the patch on my
> queue it just needs some more testing. The adjust header bits were
> merged in between some of the later versions of the patch which is how
> this check got missed.

I would like to avoid inconsistent XDP feature support amongst drivers
as much as possible.

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

* Re: [PATCH net] virtio_net: reject XDP programs using header adjustment
  2016-12-19 17:50 ` John Fastabend
  2016-12-19 20:08   ` David Miller
@ 2016-12-20 12:30   ` Jakub Kicinski
  2016-12-23 18:44     ` John Fastabend
  1 sibling, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2016-12-20 12:30 UTC (permalink / raw)
  To: John Fastabend; +Cc: netdev, kafai, Daniel Borkmann, alexei.starovoitov, mst

On Mon, Dec 19, 2016 at 5:50 PM, John Fastabend
<john.fastabend@gmail.com> wrote:
> On 16-12-19 07:05 AM, Jakub Kicinski wrote:
>> commit 17bedab27231 ("bpf: xdp: Allow head adjustment in XDP prog")
>> added a new XDP helper to prepend and remove data from a frame.
>> Make virtio_net reject programs making use of this helper until
>> proper support is added.
>>
>> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>> ---
>>  drivers/net/virtio_net.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index 08327e005ccc..db761f37783e 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -1677,6 +1677,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog)
>>       u16 xdp_qp = 0, curr_qp;
>>       int i, err;
>>
>> +     if (prog && prog->xdp_adjust_head) {
>> +             netdev_warn(dev, "Does not support bpf_xdp_adjust_head()\n");
>> +             return -EOPNOTSUPP;
>> +     }
>> +
>>       if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||
>>           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) {
>>               netdev_warn(dev, "can't set XDP while host is implementing LRO, disable LRO first\n");
>>
>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>
>
> Thanks patch looks good. Alternatively we could push a "bug fix" to
> support the adjust header feature depending on how DaveM and MST feel
> about that. I don't have a strong opinion but I have the patch on my
> queue it just needs some more testing.

Cool!  I thought to ask you what your plans are but then this patch is so
trivial I decided to just post it :) I'm perfectly happy with dropping it
for now and reposting after ~rc5 if needed.

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

* Re: [PATCH net] virtio_net: reject XDP programs using header adjustment
  2016-12-20 12:30   ` Jakub Kicinski
@ 2016-12-23 18:44     ` John Fastabend
  0 siblings, 0 replies; 7+ messages in thread
From: John Fastabend @ 2016-12-23 18:44 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, kafai, Daniel Borkmann, alexei.starovoitov, mst

On 16-12-20 04:30 AM, Jakub Kicinski wrote:
> On Mon, Dec 19, 2016 at 5:50 PM, John Fastabend
> <john.fastabend@gmail.com> wrote:
>> On 16-12-19 07:05 AM, Jakub Kicinski wrote:
>>> commit 17bedab27231 ("bpf: xdp: Allow head adjustment in XDP prog")
>>> added a new XDP helper to prepend and remove data from a frame.
>>> Make virtio_net reject programs making use of this helper until
>>> proper support is added.
>>>
>>> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>>> ---
>>>  drivers/net/virtio_net.c | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>>> index 08327e005ccc..db761f37783e 100644
>>> --- a/drivers/net/virtio_net.c
>>> +++ b/drivers/net/virtio_net.c
>>> @@ -1677,6 +1677,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog)
>>>       u16 xdp_qp = 0, curr_qp;
>>>       int i, err;
>>>
>>> +     if (prog && prog->xdp_adjust_head) {
>>> +             netdev_warn(dev, "Does not support bpf_xdp_adjust_head()\n");
>>> +             return -EOPNOTSUPP;
>>> +     }
>>> +
>>>       if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||
>>>           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) {
>>>               netdev_warn(dev, "can't set XDP while host is implementing LRO, disable LRO first\n");
>>>
>>
>> Acked-by: John Fastabend <john.r.fastabend@intel.com>
>>
>> Thanks patch looks good. Alternatively we could push a "bug fix" to
>> support the adjust header feature depending on how DaveM and MST feel
>> about that. I don't have a strong opinion but I have the patch on my
>> queue it just needs some more testing.
> 
> Cool!  I thought to ask you what your plans are but then this patch is so
> trivial I decided to just post it :) I'm perfectly happy with dropping it
> for now and reposting after ~rc5 if needed.
> 

Hi Jakub,

I just posted a RFC take a look if you get a chance. Notice though Jason
fixed up my linearize path a bunch so it will need to be pushed on top
of that series.

Thanks,
John

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

end of thread, other threads:[~2016-12-23 18:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 15:05 [PATCH net] virtio_net: reject XDP programs using header adjustment Jakub Kicinski
2016-12-19 15:23 ` Mintz, Yuval
2016-12-19 15:42   ` Jakub Kicinski
2016-12-19 17:50 ` John Fastabend
2016-12-19 20:08   ` David Miller
2016-12-20 12:30   ` Jakub Kicinski
2016-12-23 18:44     ` John Fastabend

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.