All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Simon Horman <simon.horman@netronome.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, oss-drivers@netronome.com,
	Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Subject: Re: [PATCH/RFC net-next 3/9] nfp: provide infrastructure for offloading flower based TC filters
Date: Tue, 27 Jun 2017 23:13:06 -0700	[thread overview]
Message-ID: <20170627231306.2804cdef@cakuba.netronome.com> (raw)
In-Reply-To: <1498605709-22574-4-git-send-email-simon.horman@netronome.com>

On Wed, 28 Jun 2017 01:21:43 +0200, Simon Horman wrote:
> From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.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@netronome.com>
> Signed-off-by: Simon Horman <simon.horman@netronome.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.

  reply	other threads:[~2017-06-28  6:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 23:21 [PATCH/RFC net-next 0/9] introduce flower offload capabilities Simon Horman
2017-06-27 23:21 ` [PATCH/RFC net-next 1/9] net: switchdev: add SET_SWITCHDEV_OPS helper Simon Horman
2017-06-27 23:21 ` [PATCH/RFC net-next 2/9] nfp: add phys_switch_id support Simon Horman
2017-06-27 23:33   ` Jakub Kicinski
2017-06-27 23:21 ` [PATCH/RFC net-next 3/9] nfp: provide infrastructure for offloading flower based TC filters Simon Horman
2017-06-28  6:13   ` Jakub Kicinski [this message]
2017-06-28  8:12     ` Simon Horman
2017-06-27 23:21 ` [PATCH/RFC net-next 4/9] nfp: extend flower add flow offload Simon Horman
2017-06-28  6:13   ` Jakub Kicinski
2017-06-28  8:13     ` [oss-drivers] " Simon Horman
2017-06-27 23:21 ` [PATCH/RFC net-next 5/9] nfp: extend flower matching capabilities Simon Horman
2017-06-27 23:21 ` [PATCH/RFC net-next 6/9] nfp: add basic action capabilities to flower offloads Simon Horman
2017-06-27 23:21 ` [PATCH/RFC net-next 7/9] nfp: add metadata to each flow offload Simon Horman
2017-06-28  6:15   ` Jakub Kicinski
2017-06-28 10:31     ` [oss-drivers] " Simon Horman
2017-06-27 23:21 ` [PATCH/RFC net-next 8/9] nfp: add a stats handler for flower offloads Simon Horman
2017-06-28  6:17   ` Jakub Kicinski
2017-06-27 23:21 ` [PATCH/RFC net-next 9/9] nfp: add control message passing capabilities to " Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170627231306.2804cdef@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=pieter.jansenvanvuuren@netronome.com \
    --cc=simon.horman@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.