From: Leon Romanovsky <leon@kernel.org>
To: Yinjun Zhang <yinjun.zhang@corigine.com>
Cc: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Chengtian Liu <chengtian.liu@corigine.com>,
HuanHuan Wang <huanhuan.wang@corigine.com>,
Louis Peens <louis.peens@corigine.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
oss-drivers <oss-drivers@corigine.com>,
Simon Horman <simon.horman@corigine.com>
Subject: Re: [PATCH net-next v3 3/3] nfp: implement xfrm callbacks and expose ipsec offload feature to upper layer
Date: Mon, 7 Nov 2022 14:40:53 +0200 [thread overview]
Message-ID: <Y2j81dBpMXrNqPER@unreal> (raw)
In-Reply-To: <DM6PR13MB3705DADE119F1895CA27EF9DFC3C9@DM6PR13MB3705.namprd13.prod.outlook.com>
On Mon, Nov 07, 2022 at 09:46:46AM +0000, Yinjun Zhang wrote:
> On Mon, 7 Nov 2022 08:14:12 +0200, Leon Romanovsky wrote:
> <...>
> > > + struct sa_ctrl_word {
> > > + uint32_t hash :4; /* From nfp_ipsec_sa_hash_type */
> > > + uint32_t cimode :4; /* From nfp_ipsec_sa_cipher_mode */
> > > + uint32_t cipher :4; /* From nfp_ipsec_sa_cipher */
> > > + uint32_t mode :2; /* From nfp_ipsec_sa_mode */
> > > + uint32_t proto :2; /* From nfp_ipsec_sa_prot */
> > > + uint32_t dir :1; /* SA direction */
> > > + uint32_t ena_arw:1; /* Anti-Replay Window */
> > > + uint32_t ext_seq:1; /* 64-bit Sequence Num */
> > > + uint32_t ext_arw:1; /* 64b Anti-Replay Window */
> > > + uint32_t spare2 :9; /* Must be set to 0 */
> > > + uint32_t encap_dsbl:1; /* Encap/Decap disable */
> > > + uint32_t gen_seq:1; /* Firmware Generate Seq */
> > > + uint32_t spare8 :1; /* Must be set to 0 */
> > > + } ctrl_word;
> > > + u32 spi; /* SPI Value */
> > > + uint32_t pmtu_limit :16; /* PMTU Limit */
> > > + uint32_t spare3 :1;
> > > + uint32_t frag_check :1; /* Stateful fragment checking flag */
> > > + uint32_t bypass_DSCP:1; /* Bypass DSCP Flag */
> > > + uint32_t df_ctrl :2; /* DF Control bits */
> > > + uint32_t ipv6 :1; /* Outbound IPv6 addr format */
> > > + uint32_t udp_enable :1; /* Add/Remove UDP header for NAT */
> > > + uint32_t tfc_enable :1; /* Traffic Flow Confidentiality */
> > > + uint32_t spare4 :8;
> > > + u32 soft_lifetime_byte_count;
> > > + u32 hard_lifetime_byte_count;
> >
> > These fields are not relevant for IPsec crypto offload. I would be more
> > than happy to see only used fields here.
>
> They are not used currently in kernel indeed. However the HW is not designed for
> crypto-offloading only, not for kernel only, some extensive features are supported.
> So they're reserved here.
So mark them as reserved. If it is not supported by kernel, it shouldn't
be in the kernel.
>
> <...>
> > > +
> > > + /* General */
> > > + switch (x->props.mode) {
> > > + case XFRM_MODE_TUNNEL:
> > > + cfg->ctrl_word.mode = NFP_IPSEC_PROTMODE_TUNNEL;
> > > + break;
> > > + case XFRM_MODE_TRANSPORT:
> > > + cfg->ctrl_word.mode = NFP_IPSEC_PROTMODE_TRANSPORT;
> > > + break;
> >
> > Why is it important for IPsec crypto? The HW logic must be the same for
> > all modes. There are no differences between transport and tunnel.
>
> As I mentioned above, it's differentiated in HW to support more features.
You are adding crypto offload, so please don't try to sneak "more" features.
>
> >
> > > + default:
> > > + nn_err(nn, "Unsupported mode for xfrm offload\n");
> >
> > There are no other modes.
> >
>
> <...>
> >
> > > + err = xa_alloc(&nn->xa_ipsec, &saidx, x,
> > > + XA_LIMIT(0, NFP_NET_IPSEC_MAX_SA_CNT - 1),
> > GFP_KERNEL);
> >
> > Create XArray with XA_FLAGS_ALLOC1, it will cause to xarray skip 0.
> > See DEFINE_XARRAY_ALLOC1() for more info.
>
> Actually 0 is a valid SA id in HW/driver, we don't want to skip 0.
NP, thanks
next prev parent reply other threads:[~2022-11-07 12:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 11:02 [PATCH net-next v3 0/3] nfp: IPsec offload support Simon Horman
2022-11-01 11:02 ` [PATCH net-next v3 1/3] nfp: extend capability and control words Simon Horman
2022-11-06 19:39 ` Leon Romanovsky
2022-11-01 11:02 ` [PATCH net-next v3 2/3] nfp: add framework to support ipsec offloading Simon Horman
2022-11-06 19:39 ` Leon Romanovsky
2022-11-01 11:02 ` [PATCH net-next v3 3/3] nfp: implement xfrm callbacks and expose ipsec offload feature to upper layer Simon Horman
2022-11-06 19:48 ` Leon Romanovsky
2022-11-07 9:50 ` Yinjun Zhang
2022-11-07 6:14 ` Leon Romanovsky
2022-11-07 9:46 ` Yinjun Zhang
2022-11-07 12:40 ` Leon Romanovsky [this message]
2022-11-08 1:28 ` Yinjun Zhang
2022-11-08 18:42 ` Leon Romanovsky
2022-11-09 6:51 ` Yinjun Zhang
2022-11-09 6:58 ` Yinjun Zhang
2022-11-09 8:26 ` Leon Romanovsky
2022-11-09 12:09 ` Yinjun Zhang
2022-11-09 12:24 ` Leon Romanovsky
2022-11-04 3:48 ` [PATCH net-next v3 0/3] nfp: IPsec offload support Jakub Kicinski
2022-11-05 15:27 ` Steffen Klassert
2022-11-05 17:25 ` Leon Romanovsky
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=Y2j81dBpMXrNqPER@unreal \
--to=leon@kernel.org \
--cc=chengtian.liu@corigine.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=huanhuan.wang@corigine.com \
--cc=kuba@kernel.org \
--cc=louis.peens@corigine.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@corigine.com \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.com \
--cc=steffen.klassert@secunet.com \
--cc=yinjun.zhang@corigine.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;
as well as URLs for NNTP newsgroup(s).