DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lukas Bartosik <lbartosik@marvell.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Anoob Joseph <anoobj@marvell.com>
Subject: Re: [dpdk-dev] [PATCH v2] ipsec: include high order bytes of esn in pkt len
Date: Fri, 31 May 2019 16:09:43 +0000	[thread overview]
Message-ID: <39c45544-a46a-9590-3b2c-2b9161b88aae@marvell.com> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB977258016163A722@irsmsx105.ger.corp.intel.com>

Hi Konstantin

On 30.05.2019 18:51, Ananyev, Konstantin wrote:
> Hi Lukasz,
> 
>> diff --git a/lib/librte_ipsec/esp_outb.c b/lib/librte_ipsec/esp_outb.c
>> index c798bc4..ed5974b 100644
>> --- a/lib/librte_ipsec/esp_outb.c
>> +++ b/lib/librte_ipsec/esp_outb.c
>> @@ -126,11 +126,11 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc,
>>
>>  	/* pad length + esp tail */
>>  	pdlen = clen - plen;
>> -	tlen = pdlen + sa->icv_len;
>> +	tlen = pdlen + sa->icv_len + sa->sqh_len;
> 
> We probably don't want to increase pkt_len by  sa->sqh_len for inline case.
> That's why I suggested to pass sqh_len as parameter to that function.
> Then for inline we can just pass 0.
> Do you see any obstacles with that approach?
> Same thought for transport mode.
> Konstantin
> 

I agree this is incorrect. I have missed inline case.
I will send revised patch.

Thanks,
Lukasz

>>
>>  	/* do append and prepend */
>>  	ml = rte_pktmbuf_lastseg(mb);
>> -	if (tlen + sa->sqh_len + sa->aad_len > rte_pktmbuf_tailroom(ml))
>> +	if (tlen + sa->aad_len > rte_pktmbuf_tailroom(ml))
>>  		return -ENOSPC;
>>
>>  	/* prepend header */
>> @@ -152,8 +152,8 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc,
>>  	rte_memcpy(ph, sa->hdr, sa->hdr_len);
>>
>>  	/* update original and new ip header fields */
>> -	update_tun_l3hdr(sa, ph + sa->hdr_l3_off, mb->pkt_len, sa->hdr_l3_off,
>> -			sqn_low16(sqc));
>> +	update_tun_l3hdr(sa, ph + sa->hdr_l3_off, mb->pkt_len - sa->sqh_len,
>> +			sa->hdr_l3_off, sqn_low16(sqc));
>>
>>  	/* update spi, seqn and iv */
>>  	esph = (struct esp_hdr *)(ph + sa->hdr_len);
>> @@ -292,11 +292,11 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc,
>>
>>  	/* pad length + esp tail */
>>  	pdlen = clen - plen;
>> -	tlen = pdlen + sa->icv_len;
>> +	tlen = pdlen + sa->icv_len + sa->sqh_len;
>>
>>  	/* do append and insert */
>>  	ml = rte_pktmbuf_lastseg(mb);
>> -	if (tlen + sa->sqh_len + sa->aad_len > rte_pktmbuf_tailroom(ml))
>> +	if (tlen + sa->aad_len > rte_pktmbuf_tailroom(ml))
>>  		return -ENOSPC;
>>
>>  	/* prepend space for ESP header */
>> @@ -314,8 +314,8 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc,
>>  	insert_esph(ph, ph + hlen, uhlen);
>>
>>  	/* update ip  header fields */
>> -	np = update_trs_l3hdr(sa, ph + l2len, mb->pkt_len, l2len, l3len,
>> -			IPPROTO_ESP);
>> +	np = update_trs_l3hdr(sa, ph + l2len, mb->pkt_len - sa->sqh_len, l2len,
>> +			l3len, IPPROTO_ESP);
>>
>>  	/* update spi, seqn and iv */
>>  	esph = (struct esp_hdr *)(ph + uhlen);
>> @@ -425,6 +425,9 @@ esp_outb_sqh_process(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
>>  	for (i = 0; i != num; i++) {
>>  		if ((mb[i]->ol_flags & PKT_RX_SEC_OFFLOAD_FAILED) == 0) {
>>  			ml = rte_pktmbuf_lastseg(mb[i]);
>> +			/* remove high-order 32 bits of esn from packet len */
>> +			mb[i]->pkt_len -= sa->sqh_len;
>> +			ml->data_len -= sa->sqh_len;
>>  			icv = rte_pktmbuf_mtod_offset(ml, void *,
>>  				ml->data_len - icv_len);
>>  			remove_sqh(icv, icv_len);

  reply	other threads:[~2019-05-31 16:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30 14:55 [dpdk-dev] [PATCH] " Lukasz Bartosik
2019-04-30 14:55 ` Lukasz Bartosik
2019-04-30 15:05 ` Ananyev, Konstantin
2019-04-30 15:05   ` Ananyev, Konstantin
2019-04-30 15:38   ` Lukas Bartosik
2019-04-30 15:38     ` Lukas Bartosik
2019-05-07 14:48     ` [dpdk-dev] [EXT] " Lukas Bartosik
2019-05-07 14:48       ` Lukas Bartosik
2019-05-09 11:59       ` Ananyev, Konstantin
2019-05-09 11:59         ` Ananyev, Konstantin
2019-05-14 13:52       ` Ananyev, Konstantin
2019-05-14 13:52         ` Ananyev, Konstantin
2019-05-14 14:31         ` Lukas Bartosik
2019-05-14 14:31           ` Lukas Bartosik
2019-05-19 14:47 ` [dpdk-dev] " Ananyev, Konstantin
2019-05-20 11:13   ` Lukas Bartosik
2019-05-23 12:11 ` [dpdk-dev] [PATCH v2] " Lukasz Bartosik
2019-05-30 16:51   ` Ananyev, Konstantin
2019-05-31 16:09     ` Lukas Bartosik [this message]
2019-06-05 15:31   ` [dpdk-dev] [PATCH v3] " Lukasz Bartosik
2019-06-06 14:45     ` Ananyev, Konstantin
2019-06-20 13:25       ` Akhil Goyal
2019-06-25 12:49         ` Akhil Goyal

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=39c45544-a46a-9590-3b2c-2b9161b88aae@marvell.com \
    --to=lbartosik@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.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).