From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: Re: [PATCH v2 net-next 3/4] netdevsim: add ipsec offload testing Date: Mon, 25 Jun 2018 18:00:02 -0700 Message-ID: <20180625180002.1e6aff2d@cakuba.netronome.com> References: <1529970096-23199-1-git-send-email-shannon.nelson@oracle.com> <1529970096-23199-4-git-send-email-shannon.nelson@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, netdev@vger.kernel.org, anders.roxell@linaro.org, linux-kselftest@vger.kernel.org To: Shannon Nelson Return-path: Received: from mail-qk0-f193.google.com ([209.85.220.193]:43504 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935001AbeFZBAI (ORCPT ); Mon, 25 Jun 2018 21:00:08 -0400 Received: by mail-qk0-f193.google.com with SMTP id j124-v6so1819384qka.10 for ; Mon, 25 Jun 2018 18:00:07 -0700 (PDT) In-Reply-To: <1529970096-23199-4-git-send-email-shannon.nelson@oracle.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 > --- > V2 - addressed formatting comments from Jakub Kicinski Thanks! One more comment below, otherwise: Reviewed-by: Jakub Kicinski > +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; > +}