From patchwork Thu Jun 7 23:54:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Gora X-Patchwork-Id: 40789 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 27C406C93; Fri, 8 Jun 2018 01:55:15 +0200 (CEST) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by dpdk.org (Postfix) with ESMTP id 9CBD169D4 for ; Fri, 8 Jun 2018 01:55:13 +0200 (CEST) Received: by mail-qt0-f196.google.com with SMTP id l10-v6so6584993qtj.0 for ; Thu, 07 Jun 2018 16:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=Bo/o7XfjaNPjsTsdv4cY/8TnyMbElgA297jAz/76bJU=; b=WSviax/s5b0N4eruV6YQyiiOJ1d23TmgyfDDoj+PtiMnzZyHYVCAqnmO5iGehB02Ie bqqviaw5g+w+AukUwdiRCKXwNykQz/EpZLmNdEYobKcvwBjIO3ijMhoVhzr9A2/HNf3w EoReRNJe4x8tguxwAn2g+RMdvbok77zLMyCpubY19LvlEdY50T0n9FxQ1j+MnP8bJb/c YQ9iErAjNWPedPMAfxCS3J2w/wvLrcDmdPJZP1fHVm8rGMHrWjDWE/YYcXVahe/OWAbz 8Riz9UFOKNfu0iQxnuO9zQRds9xQpwY3b54osM+LE08nuaoNqWWtdwhpXCsGsIykK9zg 8Keg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=Bo/o7XfjaNPjsTsdv4cY/8TnyMbElgA297jAz/76bJU=; b=ct7hBla5n5n2FZMUiUzEi4v1QvzhRAD6oCFaXR1Up7xUXbc2rPV9ASZTBOmrIsPzse fFtt5tb8nsQgVINKqoyVMY/3vZZHcOxuHouPB2modS31u/2E4CH4aBZFlBwH0pr6ilN3 pvunlQWjWiOE6EOPw4l/aQvnTeTs0jej0avEPEEaHlRUCUKDrWQvoMi6gpcOQ7LcZXLh DWGWZwXLGvhnIIUBqtwGCLAse8EoATFKvlwL16aQvg8Qz9EXQSjH8AC8v2DbNMHOhfSf NQ8JZRLhlDIHnPiyZiRlCYb1JKWS8pGLzyssHBpe9ZI3Z8akIEWDuDt1wkpx9ZyCn+3f vo3w== X-Gm-Message-State: APt69E3sAsDfplAKgXJDd1pxCdWkBfEZKagIUhEXpfnrDSfeO6OAXtQ8 fI9uojBTcGLpUgxgn2glJTuB/A== X-Google-Smtp-Source: ADUXVKL9xS5uZY2+woIGrRHGHlJAbDAGlOdeyVzumUVTqLJOAC1Hr9352qhi+sulPLKErQJbpEDPzg== X-Received: by 2002:a0c:89dd:: with SMTP id 29-v6mr3548746qvs.233.1528415712555; Thu, 07 Jun 2018 16:55:12 -0700 (PDT) Received: from snappy.local.lan (201-1-204-188.dsl.telesp.net.br. [201.1.204.188]) by smtp.gmail.com with ESMTPSA id v29-v6sm11902268qkv.28.2018.06.07.16.55.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jun 2018 16:55:11 -0700 (PDT) From: Dan Gora To: dev@dpdk.org Cc: Dan Gora , Olivier Matz Date: Thu, 7 Jun 2018 20:54:54 -0300 Message-Id: <20180607235454.27832-1-dg@adax.com> X-Mailer: git-send-email 2.17.0.582.gccdcbd54c4 Subject: [dpdk-dev] [PATCH 1/4] mbuf: add accessor function for private data area X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add an inline accessor function to return the starting address of the private data area in the supplied mbuf. If the user did not allocate space for a private data area in the mbuf's memory pool, then return NULL. This allows applications to easily access the private data area between the struct rte_mbuf and the data buffer in the specified mbuf without creating private macros or accessor functions. Signed-off-by: Dan Gora --- lib/librte_mbuf/rte_mbuf.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 8e6b4d292..0c4f8f698 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -728,6 +728,25 @@ rte_mbuf_to_baddr(struct rte_mbuf *md) return buffer_addr; } +/** + * Return the starting address of the private data area embedded in + * the given mbuf. + * + * @param md + * The pointer to the mbuf. + * @return + * The starting address of the private data area or NULL if there + * is no private data area. + */ +static inline void * +rte_mbuf_to_priv(struct rte_mbuf *md) +{ + if (md->priv_size == 0) + return NULL; + + return RTE_PTR_ADD(md, sizeof(struct rte_mbuf)); +} + /** * Returns TRUE if given mbuf is cloned by mbuf indirection, or FALSE * otherwise. From patchwork Thu Jun 7 23:55:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Gora X-Patchwork-Id: 40790 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B02025F69; Fri, 8 Jun 2018 01:56:15 +0200 (CEST) Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by dpdk.org (Postfix) with ESMTP id E3B765F34 for ; Fri, 8 Jun 2018 01:56:14 +0200 (CEST) Received: by mail-qt0-f195.google.com with SMTP id o9-v6so11778481qtp.3 for ; Thu, 07 Jun 2018 16:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=L/fwsOCLYOj2ivAriDmRqixBAd6flHbut2Kvx7xvMXY=; b=B4yGK1ZtNYtim1dXRNp1TOWJtm1ab/wV90Le7w8XcyCkU6TJBUm8hbt9hVTAVuAZIP d4VAVFwkuYuj8o9KCx7FN9A4FDCNUhNogZWKgJK6P2th9SG7cyxZeNi61zo0N3NObiA1 DbqbPPNh7QJh3ObF5mYtWzaQ2VvxU262XKQJL6Do5XYLsQgoAk7QFkI74r60refIwIiB FAYY/0ns/1y7KMWMZhNULWI5XU45cqymjGZfxrXCBPHopJC9zqZsuEjjODqe6bRHHWMs 8rUAAaVTPN0CYjHaOjg0r6BoDSe0o1n9A2VQ01749j0/zxf6m2XI4O9+tIXgPgp8JujL ICiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=L/fwsOCLYOj2ivAriDmRqixBAd6flHbut2Kvx7xvMXY=; b=e83vMyLQCuFizIzF2a5o752N+Zz7v/6A5fwRwh5pSVJVqKvBHjD26ZSVjZGvervj5o ulCA18MoZ1v8kcn25/T7VmzjrLkD1b5a11nDBeexnXU/Tc0l9C5T5CWI7VQxlnwXEfZv ovE70brtvazYwHw1O0IUthOXrywmZDeyHYSh+NPonnWsOMYTFpcGCiIkAC+OWZEuOSFU gjg657hZKOHW4BjrPvfA0NW0AD2jFVXbBdjxEVtX2npWionm6HN/LVbCGAxMnnLOpGo/ LuXfj8/ds9TgqSDRkNPLKk1Y8Hfpa82aLwT11hj7aBsEbPeA5GAcxG5ePw3xUWmPpUVm MghQ== X-Gm-Message-State: APt69E3MRj1Sx2pVrlEtwLfR6aZ498YwrQaPMOhp+eif1GSKzyPxhugh of6LtQdyfq/dLX5P5HAEbkGZQg== X-Google-Smtp-Source: ADUXVKIhmIA0iIrxaVzQWXFRdgJKpwFA+3Go+E/4jWCqG12YVsq8m1cB8B+OMX3XCxthuak/mqHB5Q== X-Received: by 2002:a0c:e74c:: with SMTP id g12-v6mr3693285qvn.203.1528415774059; Thu, 07 Jun 2018 16:56:14 -0700 (PDT) Received: from snappy.local.lan (201-1-204-188.dsl.telesp.net.br. [201.1.204.188]) by smtp.gmail.com with ESMTPSA id o5-v6sm23573384qtm.60.2018.06.07.16.56.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jun 2018 16:56:13 -0700 (PDT) From: Dan Gora To: dev@dpdk.org Cc: Dan Gora , Remy Horton , Ori Kam , Bruce Richardson , Pablo de Lara , Radu Nicolau , Akhil Goyal , Tomasz Kantecki Date: Thu, 7 Jun 2018 20:55:33 -0300 Message-Id: <20180607235533.27927-1-dg@adax.com> X-Mailer: git-send-email 2.17.0.582.gccdcbd54c4 Subject: [dpdk-dev] [PATCH 2/4] examples/ipsec-secgw: use rte fcn to access private area X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Update get_priv() to use rte_mbuf_to_priv() to access the private area in the mbuf. Signed-off-by: Dan Gora --- examples/ipsec-secgw/ipsec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 9b87278c1..3b5c3ec8c 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -191,7 +191,7 @@ ipsec_metadata_size(void) static inline struct ipsec_mbuf_metadata * get_priv(struct rte_mbuf *m) { - return RTE_PTR_ADD(m, sizeof(struct rte_mbuf)); + return (ipsec_mbuf_metadata *)rte_mbuf_to_priv(m); } static inline void * From patchwork Thu Jun 7 23:56:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Gora X-Patchwork-Id: 40791 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BBC56841; Fri, 8 Jun 2018 01:56:51 +0200 (CEST) Received: from mail-qk0-f196.google.com (mail-qk0-f196.google.com [209.85.220.196]) by dpdk.org (Postfix) with ESMTP id C5A982F7D for ; Fri, 8 Jun 2018 01:56:49 +0200 (CEST) Received: by mail-qk0-f196.google.com with SMTP id d130-v6so7750910qkc.2 for ; Thu, 07 Jun 2018 16:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=WNiQMs63pVHIY8CE/dTw3rPaVCCs4raJc9LUFm9VBA0=; b=KiFmL5AzXDN/B33mDazx1JcR2q6/9V6dpbYhvZOX7/4tDITo6CYAm641zR0BipBGMB A3t73+cEF9enmoHF6PWweCAoovgrgrE7tRN4D1OItGkZL84V9Q5kJloZToypPOBjd278 f9RI0oGSf9UfwXLJkRskEMDgLURD3+SkcUjgiVkqxMXYNeLI72jCzNbWhKU1tH5BrSOR cMGc+SEW6qmlmOsWNtAHPQo/Q4UvbkfreSfbE4lUn+KCQXGzb16T6SGQfPmErW8RpfP5 +heVWobRl7TeGdw0OWb7L4/c7NPsvdwcxibiewXKRRvd1cPAruR9zjLwcJgA3RMGu/JR Cgww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=WNiQMs63pVHIY8CE/dTw3rPaVCCs4raJc9LUFm9VBA0=; b=SNeOMe4+sZL6WLKB1+buA6z9BNgKUkjm5oUt7bBe2V7fuBqNHto13BxOkg7iXyTrMo cryITUIsiqFfhnS7jtYtV71V+oNBdk5ceMD6Rm7DEzQu/Fx7Qc1ueY98PWcr1MZg5/Op 6eLfyUFxMxYHZHIvNTrUdHTscV/TbLCb1CBtnV8QRvPXc0354NDMoNpgSzi4DSFwPqAm igrBsjkLQfr9ULoaFrngzdeqh4bQL/kpzUtIlUCPEO8XZY79wZv8hp6uopJExnZ8Sgdg nZLpO8joJoiY2slw0/Cvv+hyZMnrmif4oD9sPtzSlkkAQsRMy7HqcDkWHMHrJveQ7wjz 1pOg== X-Gm-Message-State: APt69E1UOkjchA8l9zQttb/enLR5mNMKG6om4hAqaE1UfDxnO78HojDj daTxspdPvEclJAe2vqIMU7tPfg== X-Google-Smtp-Source: ADUXVKI5QHwUxVWmMp/JlxA0Zla1if7V76jBrEYLPVVoKDndMkkcalg9HhJaMhkF/lTMMvfdZfBO+g== X-Received: by 2002:a37:38cf:: with SMTP id f198-v6mr3491224qka.168.1528415808924; Thu, 07 Jun 2018 16:56:48 -0700 (PDT) Received: from snappy.local.lan (201-1-204-188.dsl.telesp.net.br. [201.1.204.188]) by smtp.gmail.com with ESMTPSA id u71-v6sm27950482qki.41.2018.06.07.16.56.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jun 2018 16:56:48 -0700 (PDT) From: Dan Gora To: dev@dpdk.org Cc: Dan Gora , Remy Horton , Ori Kam , Bruce Richardson , Pablo de Lara , Radu Nicolau , Akhil Goyal , Tomasz Kantecki Date: Thu, 7 Jun 2018 20:56:34 -0300 Message-Id: <20180607235634.28023-1-dg@adax.com> X-Mailer: git-send-email 2.17.0.582.gccdcbd54c4 Subject: [dpdk-dev] [PATCH 3/4] examples/ipsec-secgw: use ipsec fcn to access private area X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In inbound_sa_check(), use the application's get_priv() function to access the private area in the mbuf. Signed-off-by: Dan Gora --- examples/ipsec-secgw/sa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index d9dcc0e06..4ab8e098a 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -939,7 +939,7 @@ inbound_sa_check(struct sa_ctx *sa_ctx, struct rte_mbuf *m, uint32_t sa_idx) { struct ipsec_mbuf_metadata *priv; - priv = RTE_PTR_ADD(m, sizeof(struct rte_mbuf)); + priv = get_priv(m); return (sa_ctx->sa[sa_idx].spi == priv->sa->spi); } From patchwork Thu Jun 7 23:57:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Gora X-Patchwork-Id: 40792 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CF5BD6833; Fri, 8 Jun 2018 01:57:21 +0200 (CEST) Received: from mail-qk0-f194.google.com (mail-qk0-f194.google.com [209.85.220.194]) by dpdk.org (Postfix) with ESMTP id 852E45F34 for ; Fri, 8 Jun 2018 01:57:20 +0200 (CEST) Received: by mail-qk0-f194.google.com with SMTP id c198-v6so7727966qkg.12 for ; Thu, 07 Jun 2018 16:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=gIPx+u0Qcaiil/UozW2/7kGr1kLHPj8QTr6sASeusd8=; b=ravk11Yql0vzBZnVkCctYj7rsvJp2LH2D0K026Vr5wuhiVhQDmTbcXgE533VdOYKO1 k97CY0M7lnF2JLZIzLqhRlOHjI9hI4LnT2tLSD33AFH36zdLzfzCuYGQdpAobWMfvXwF Dbi9Env2xN/dkLZsEUJVHNsK9CeST3HxKCvu3QlEugjZw1lWJYj9+th5/xOeTAiEHyo2 Q7jLyatd2SYLESbS6DqytnRJnBXx39on3hFod0fqwSyyAjOpDuOXkKhVKa9UE/hJO1BC RmjKKS1oMDS5eOsXgOnP0rEQnVZyfdtileG4F5SgUpKRuRRPgYwBTed5qA8dMIxeCpwo seZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=gIPx+u0Qcaiil/UozW2/7kGr1kLHPj8QTr6sASeusd8=; b=sIXeEMcUDCrSAE2XA6+cnyzBOvYbDjPpCphgd9EGO/Ibw7adA4HzDPqJhI4Mb4gh5Q fw4MQNE1zH8gkc1E3Dk6szyQzjUNmJz9DGMWte4nDeMoirpMI0C8RuZ7nTgA8XAgYIeI 8njD+yFgtBDvDHpts/QV2NWRdkR6GleQcPzQOPd4zspmfzqWF8TZqcPSDU7eGXINiTAc PtKEitOqAuRTRf4SIUZooMEYhcMXxvJdkeT25SnN0qYATQNW/B2u2PoZ5kGJwacgD/lV jIM9BbQeyxziPFZtmYXU7ipkYedVgXj+nabjhpwDpZn6weZlHHcTzVEniAvkM1hjav0w NtcQ== X-Gm-Message-State: APt69E3HOTkpALKZU4s9QXo2IWGwfs3JDQca58khyCACWPRmnhX8gP5K sE4SndnQ+08fFsnOhcPR0VIgiQ== X-Google-Smtp-Source: ADUXVKIaTSsiAsrxytB50m+e+6IFNK0vVVm/HBqFIsyyVRo9IPidELRn49lri4gKkrEXRbb47fZ7uQ== X-Received: by 2002:a37:1aca:: with SMTP id l71-v6mr3493464qkh.355.1528415839707; Thu, 07 Jun 2018 16:57:19 -0700 (PDT) Received: from snappy.local.lan (201-1-204-188.dsl.telesp.net.br. [201.1.204.188]) by smtp.gmail.com with ESMTPSA id z15-v6sm37083716qti.93.2018.06.07.16.57.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jun 2018 16:57:18 -0700 (PDT) From: Dan Gora To: dev@dpdk.org Cc: Dan Gora , Maxime Coquelin Date: Thu, 7 Jun 2018 20:57:09 -0300 Message-Id: <20180607235709.28104-1-dg@adax.com> X-Mailer: git-send-email 2.17.0.582.gccdcbd54c4 Subject: [dpdk-dev] [PATCH 4/4] vhost/crypto: use rte fcn to access private area X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use rte_mbuf_to_priv() to access the private data area in the mbuf. Signed-off-by: Dan Gora --- lib/librte_vhost/vhost_crypto.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c index f1650738a..57341ef8f 100644 --- a/lib/librte_vhost/vhost_crypto.c +++ b/lib/librte_vhost/vhost_crypto.c @@ -940,8 +940,7 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto, struct vhost_virtqueue *vq, struct rte_crypto_op *op, struct vring_desc *head, uint16_t desc_idx) { - struct vhost_crypto_data_req *vc_req = RTE_PTR_ADD(op->sym->m_src, - sizeof(struct rte_mbuf)); + struct vhost_crypto_data_req *vc_req = rte_mbuf_to_priv(op->sym->m_src); struct rte_cryptodev_sym_session *session; struct virtio_crypto_op_data_req *req, tmp_req; struct virtio_crypto_inhdr *inhdr; @@ -1062,8 +1061,7 @@ vhost_crypto_finalize_one_request(struct rte_crypto_op *op, { struct rte_mbuf *m_src = op->sym->m_src; struct rte_mbuf *m_dst = op->sym->m_dst; - struct vhost_crypto_data_req *vc_req = RTE_PTR_ADD(m_src, - sizeof(struct rte_mbuf)); + struct vhost_crypto_data_req *vc_req = rte_mbuf_to_priv(m_src); uint16_t desc_idx; int ret = 0;