From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <sergio.gonzalez.monroy@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 21D7D1B5E8
 for <dev@dpdk.org>; Mon, 16 Oct 2017 11:39:43 +0200 (CEST)
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 16 Oct 2017 02:39:43 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.43,386,1503385200"; d="scan'208";a="1025602639"
Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.252.25.241])
 ([10.252.25.241])
 by orsmga003.jf.intel.com with ESMTP; 16 Oct 2017 02:39:40 -0700
To: aviadye@dev.mellanox.co.il, dev@dpdk.org, pablo.de.lara.guarch@intel.com, 
 aviadye@mellanox.com
References: <1507987683-12315-1-git-send-email-aviadye@dev.mellanox.co.il>
 <1507987683-12315-7-git-send-email-aviadye@dev.mellanox.co.il>
Cc: borisp@mellanox.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com,
 radu.nicolau@intel.com, declan.doherty@intel.com, liranl@mellanox.com,
 nelio.laranjeiro@6wind.com, thomas@monjalon.net
From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Message-ID: <5bbf76cd-abc9-bb17-0903-1f298dc2a92b@intel.com>
Date: Mon, 16 Oct 2017 10:39:39 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101
 Thunderbird/45.1.1
MIME-Version: 1.0
In-Reply-To: <1507987683-12315-7-git-send-email-aviadye@dev.mellanox.co.il>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH 07/11] examples/ipsec-secgw: Fixed phyiscal
 address of aad
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Oct 2017 09:39:44 -0000

On 14/10/2017 14:27, aviadye@dev.mellanox.co.il wrote:
> From: Aviad Yehezkel <aviadye@mellanox.com>
>
> Signed-off-by: Aviad Yehezkel <aviadye@mellanox.com>
> ---
>   examples/ipsec-secgw/esp.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c
> index 689e917..aa2233d 100644
> --- a/examples/ipsec-secgw/esp.c
> +++ b/examples/ipsec-secgw/esp.c
> @@ -355,8 +355,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
>   		aad = get_aad(m);
>   		memcpy(aad, esp, 8);
>   		sym_cop->aead.aad.data = aad;
> -		sym_cop->aead.aad.phys_addr = rte_pktmbuf_mtophys_offset(m,
> -				aad - rte_pktmbuf_mtod(m, uint8_t *));
> +		sym_cop->aead.aad.phys_addr = rte_mem_virt2phy(aad);
>   

That function is very expensive and should not be used in data path.
You should use the phys_addr in the crypto_op to calculate proper value.

Thanks,
Sergio

>   		sym_cop->aead.digest.data = rte_pktmbuf_mtod_offset(m, uint8_t *,
>   			rte_pktmbuf_pkt_len(m) - sa->digest_len);