lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170627231306.2804cdef@cakuba.netronome.com>
Date:   Tue, 27 Jun 2017 23:13:06 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Simon Horman <simon.horman@...ronome.com>
Cc:     David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
        oss-drivers@...ronome.com,
        Pieter Jansen van Vuuren 
        <pieter.jansenvanvuuren@...ronome.com>
Subject: Re: [PATCH/RFC net-next 3/9] nfp: provide infrastructure for
 offloading flower based TC filters

On Wed, 28 Jun 2017 01:21:43 +0200, Simon Horman wrote:
> From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@...ronome.com>
> 
> Adds a flower based TC offload handler for representor devices, this
> is in addition to the bpf based offload handler. The changes in this
> patch will be used in a follow-up patch to add tc flower offload to
> the NFP.
> 
> The flower app enables tc offloads on representors by default.
> 
> Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@...ronome.com>
> Signed-off-by: Simon Horman <simon.horman@...ronome.com>

> diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c
> index ab68a8f58862..7b27871f489c 100644
> --- a/drivers/net/ethernet/netronome/nfp/flower/main.c
> +++ b/drivers/net/ethernet/netronome/nfp/flower/main.c
> @@ -37,6 +37,7 @@
>  #include <net/devlink.h>
>  #include <net/dst_metadata.h>
>  
> +#include "main.h"
>  #include "../nfpcore/nfp_cpp.h"
>  #include "../nfpcore/nfp_nsp.h"
>  #include "../nfp_app.h"
> @@ -303,8 +304,14 @@ static int nfp_flower_vnic_init(struct nfp_app *app, struct nfp_net *nn,
>  	eth_hw_addr_random(nn->dp.netdev);
>  	netif_keep_dst(nn->dp.netdev);
>  
> +	if (nfp_flower_repr_init(app))
> +		goto err_free_priv;

Please make the contents of nfp_flower_repr_init() part of app's .init
callback.

>  	return 0;
>  
> +err_free_priv:
> +	kfree(app->priv);
> +	app->priv = NULL;

This doesn't belong here after my recent series.  priv init was moved
to app's init callback.

>  err_invalid_port:
>  	nn->port = nfp_port_alloc(app, NFP_PORT_INVALID, nn->dp.netdev);
>  	return PTR_ERR_OR_ZERO(nn->port);

> +int nfp_flower_repr_init(struct nfp_app *app)
> +{
> +	u64 version;
> +	int err;
> +
> +	version = nfp_rtsym_read_le(app->pf->rtbl, "hw_flower_version", &err);
> +	if (err)
> +		return -EINVAL;

Nit: this could return err directly.  Also I think it's worth printing
an error message.

> +	/* We need to ensure hardware has enough flower capabilities. */
> +	if (version != NFP_FLOWER_ALLOWED_VER)
> +		return -EINVAL;

Here we should definitely tell the user what went wrong.

> +	return 0;
> +}

> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
> index bc9108071e5b..a73b311c1f75 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
> @@ -250,6 +250,18 @@ static int nfp_repr_open(struct net_device *netdev)
>  	return nfp_app_repr_open(repr->app, repr);
>  }
>  
> +static int
> +nfp_repr_setup_tc(struct net_device *netdev, u32 handle, u32 chain_index,
> +		  __be16 proto, struct tc_to_netdev *tc)
> +{
> +	struct nfp_repr *repr = netdev_priv(netdev);
> +
> +	if (chain_index)
> +		return -EOPNOTSUPP;
> +
> +	return nfp_app_setup_tc(repr->app, netdev, handle, proto, tc);
> +}

Just a reminder that this could be a nfp_port function.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ