Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Shannon Nelson <shannon.nelson@oracle.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	anders.roxell@linaro.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 net-next 3/4] netdevsim: add ipsec offload testing
Date: Mon, 25 Jun 2018 18:00:02 -0700	[thread overview]
Message-ID: <20180625180002.1e6aff2d@cakuba.netronome.com> (raw)
In-Reply-To: <1529970096-23199-4-git-send-email-shannon.nelson@oracle.com>

On Mon, 25 Jun 2018 16:41:35 -0700, Shannon Nelson wrote:
> Implement the IPsec/XFRM offload API for testing.
> 
> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
> ---
> V2 - addressed formatting comments from Jakub Kicinski

Thanks!  One more comment below, otherwise:

Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>

> +static void nsim_ipsec_del_sa(struct xfrm_state *xs)
> +{
> +	struct net_device *dev = xs->xso.dev;
> +	struct netdevsim *ns = netdev_priv(dev);
> +	struct nsim_ipsec *ipsec = &ns->ipsec;
> +	u16 sa_idx;

I didn't point this out, but above also breaks the reverse xmas tree
rule.  Sorry for not mentioning it, the "please fix everywhere" was
implicit :(

> +	sa_idx = xs->xso.offload_handle & ~NSIM_IPSEC_VALID;
> +	if (!ipsec->sa[sa_idx].used) {
> +		netdev_err(dev, "Invalid SA for delete sa_idx=%d\n", sa_idx);
> +		return;
> +	}
> +
> +	memset(&ipsec->sa[sa_idx], 0, sizeof(struct nsim_sa));
> +	ipsec->count--;
> +}
> +
> +static bool nsim_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
> +{
> +	struct net_device *dev = xs->xso.dev;
> +	struct netdevsim *ns = netdev_priv(dev);

And here, but you don't use the dev here, so you can just inline the
xs->xso.dev into netdev_priv().

> +	struct nsim_ipsec *ipsec = &ns->ipsec;
> +
> +	ipsec->ok++;
> +
> +	return true;
> +}

  reply	other threads:[~2018-06-26  1:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 23:41 [PATCH v2 net-next 0/4] Updates for ipsec selftests Shannon Nelson
2018-06-25 23:41 ` [PATCH v2 net-next 1/4] selftests: rtnetlink: clear the return code at start of ipsec test Shannon Nelson
2018-06-25 23:41 ` [PATCH v2 net-next 2/4] selftests: rtnetlink: use dummydev as a test device Shannon Nelson
2018-06-25 23:41 ` [PATCH v2 net-next 3/4] netdevsim: add ipsec offload testing Shannon Nelson
2018-06-26  1:00   ` Jakub Kicinski [this message]
2018-06-25 23:41 ` [PATCH v2 net-next 4/4] selftests: rtnetlink: add ipsec offload API test Shannon Nelson

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=20180625180002.1e6aff2d@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=anders.roxell@linaro.org \
    --cc=davem@davemloft.net \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shannon.nelson@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox