[v4] mvneta driver disallow XDP program on hardware buffer management
diff mbox series

Message ID 20200124072628.75245-1-sven.auhagen@voleatech.de
State Changes Requested
Delegated to: David Miller
Headers show
Series
  • [v4] mvneta driver disallow XDP program on hardware buffer management
Related show

Commit Message

Sven Auhagen Jan. 24, 2020, 7:26 a.m. UTC
Recently XDP Support was added to the mvneta driver
for software buffer management only.
It is still possible to attach an XDP program if
hardware buffer management is used.
It is not doing anything at that point.

The patch disallows attaching XDP programs to mvneta
if hardware buffer management is used.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>

Comments

David Miller Jan. 24, 2020, 7:28 a.m. UTC | #1
From: Sven Auhagen <sven.auhagen@voleatech.de>
Date: Fri, 24 Jan 2020 07:26:34 +0000

> Recently XDP Support was added to the mvneta driver
> for software buffer management only.
> It is still possible to attach an XDP program if
> hardware buffer management is used.
> It is not doing anything at that point.
> 
> The patch disallows attaching XDP programs to mvneta
> if hardware buffer management is used.
> 
> Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>

Can you at least say what is changing in each version of the patch
you are posting?

Thank you.
Sven Auhagen Jan. 24, 2020, 11:52 a.m. UTC | #2
On Fri, Jan 24, 2020 at 08:28:52AM +0100, David Miller wrote:
> From: Sven Auhagen <sven.auhagen@voleatech.de>
> Date: Fri, 24 Jan 2020 07:26:34 +0000
> 
> > Recently XDP Support was added to the mvneta driver
> > for software buffer management only.
> > It is still possible to attach an XDP program if
> > hardware buffer management is used.
> > It is not doing anything at that point.
> > 
> > The patch disallows attaching XDP programs to mvneta
> > if hardware buffer management is used.
> > 
> > Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
> 
> Can you at least say what is changing in each version of the patch
> you are posting?
> 
> Thank you.

I am sorry about that. It is my first submission and I am having
some troubles with the format of my emails.

v3 -> v4:
- Please ignore v3 I accidentally submitted
  my other patch with git-send-mail and v4 is correct

v2 -> v3:
- My mailserver corrupted the patch
  resubmission with git-send-email

v1 -> v2:
- Fixing the patches indentation
Florian Fainelli Jan. 24, 2020, 6:03 p.m. UTC | #3
On 1/23/20 11:26 PM, Sven Auhagen wrote:
> Recently XDP Support was added to the mvneta driver
> for software buffer management only.
> It is still possible to attach an XDP program if
> hardware buffer management is used.
> It is not doing anything at that point.
> 
> The patch disallows attaching XDP programs to mvneta
> if hardware buffer management is used.
> 
> Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
> 
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 71a872d46bc4..96593b9fbd9b 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -4225,6 +4225,12 @@ static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
>  		return -EOPNOTSUPP;
>  	}
>  
> +		if (pp->bm_priv) {
> +			NL_SET_ERR_MSG_MOD(extack,
> +					   "Hardware Buffer Management not supported on XDP");
> +			return -EOPNOTSUPP;
> +		}

Your indentation is still a bit off here, looks like you have one too
many tabs. This is what we would expect:

	if (pp->bm_priv) {
	}

> +
>  	need_update = !!pp->xdp_prog != !!prog;
>  	if (running && need_update)
>  		mvneta_stop(dev);
>
Sven Auhagen Jan. 25, 2020, 8:05 a.m. UTC | #4
On Fri, Jan 24, 2020 at 10:03:53AM -0800, Florian Fainelli wrote:
> On 1/23/20 11:26 PM, Sven Auhagen wrote:
> > Recently XDP Support was added to the mvneta driver
> > for software buffer management only.
> > It is still possible to attach an XDP program if
> > hardware buffer management is used.
> > It is not doing anything at that point.
> > 
> > The patch disallows attaching XDP programs to mvneta
> > if hardware buffer management is used.
> > 
> > Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
> > 
> > diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> > index 71a872d46bc4..96593b9fbd9b 100644
> > --- a/drivers/net/ethernet/marvell/mvneta.c
> > +++ b/drivers/net/ethernet/marvell/mvneta.c
> > @@ -4225,6 +4225,12 @@ static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
> >  		return -EOPNOTSUPP;
> >  	}
> >  
> > +		if (pp->bm_priv) {
> > +			NL_SET_ERR_MSG_MOD(extack,
> > +					   "Hardware Buffer Management not supported on XDP");
> > +			return -EOPNOTSUPP;
> > +		}
> 
> Your indentation is still a bit off here, looks like you have one too
> many tabs. This is what we would expect:

Ah sorry I missed it.
I will resubmit with the corrected tab size.

Best
Sven

> 
> 	if (pp->bm_priv) {
> 	}
> 
> > +
> >  	need_update = !!pp->xdp_prog != !!prog;
> >  	if (running && need_update)
> >  		mvneta_stop(dev);
> > 
> 
> 
> -- 
> Florian

Patch
diff mbox series

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 71a872d46bc4..96593b9fbd9b 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4225,6 +4225,12 @@  static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
 		return -EOPNOTSUPP;
 	}
 
+		if (pp->bm_priv) {
+			NL_SET_ERR_MSG_MOD(extack,
+					   "Hardware Buffer Management not supported on XDP");
+			return -EOPNOTSUPP;
+		}
+
 	need_update = !!pp->xdp_prog != !!prog;
 	if (running && need_update)
 		mvneta_stop(dev);