From patchwork Mon Jun 18 23:35: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: 41239 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 5E70D2BBD; Tue, 19 Jun 2018 01:35:50 +0200 (CEST) Received: from mail-ot0-f194.google.com (mail-ot0-f194.google.com [74.125.82.194]) by dpdk.org (Postfix) with ESMTP id BE1662AA0 for ; Tue, 19 Jun 2018 01:35:48 +0200 (CEST) Received: by mail-ot0-f194.google.com with SMTP id p95-v6so20520852ota.5 for ; Mon, 18 Jun 2018 16:35:48 -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=DJEhK8kub6zpNT+xJ1xVG1DnPLFHxmDXU/A/FyGWr2E=; b=qLG+06/yfW3nasLQm849GvWRHqIqtN2+ji0EZClA4dGleEWlyeG28+RioMpko8tdE1 TwTBJo7HX7blNKZGTNTsetcqm0UPm9MDhl+2oRCPGJ67XS9GWts93lw0jfO+3KYl2tgn OIN36UB+6gcMZVoU/YBgBskDfCoYxPh/dGm4jWQTdAeKIte8F88MJ9c17h9a549uS46A vxeYXw6anAF5QH5L8U0NORO2iLN6u9Te0XSzwiUeSl9as4PzRa5WHs8VyR823f3u7KUo yMskFbdCZclhGPov4rkTEHcvv+/UF/lb5PunBnoDDkD+vTJvpIQ/dNI8ow3vaEMY7BLq 1UCg== 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=DJEhK8kub6zpNT+xJ1xVG1DnPLFHxmDXU/A/FyGWr2E=; b=AA/4LdZ4e7U+kYc5MSqSdvV1hWT/Z3zD5pjO76CwuMThb/WdGEMzLXTGWfmLfFneWd taxlGD0cXWag/punEqWR4LwA69wBYxdLtcE6YuWE/sUI8IZVIBk3ymSp0rObuI1Hbv8i 4mQ0r/qW7xnWUFR5e4eDxoEYAcCzVQVZ/FuzxK0foM9pF2tnvY5f3alSGUpv4pbtiM6I 2M9Sy0ze2vFHoYBxfJq5w+wyZiziFSl0utPfu1kL8Y1tlpH8RP4Tc3nM5OFZoDscNzXA 0DRjela8yYk1lOryVrPC0CkBosIE7LNc26zwncb9uWjFORLPderXEqtumW4i8UpO2PyX 4ABA== X-Gm-Message-State: APt69E2pPZA5m9ZDKIP4LiTSu8loWjkwHbxxaoEr1xeuA3TDHQcZHxrl T/eCTob8mk/PIt9m4SvdxAUPFQ== X-Google-Smtp-Source: ADUXVKIM8Npg6k9oJj/5MMq0GqRqmVXO+nJAOSYN/Vp5qBF+HP5T1gn84/PsgytAtDDRjH4LWmLbgw== X-Received: by 2002:a9d:428c:: with SMTP id r12-v6mr8453070ote.296.1529364947799; Mon, 18 Jun 2018 16:35:47 -0700 (PDT) Received: from linux.adax.com (172-11-198-60.lightspeed.sntcca.sbcglobal.net. [172.11.198.60]) by smtp.gmail.com with ESMTPSA id p128-v6sm7091635oia.31.2018.06.18.16.35.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jun 2018 16:35:47 -0700 (PDT) From: Dan Gora To: dev@dpdk.org Cc: Dan Gora , Olivier Matz Date: Mon, 18 Jun 2018 16:35:34 -0700 Message-Id: <20180618233534.21611-1-dg@adax.com> X-Mailer: git-send-email 2.18.0.rc1.1.g6f333ff2f Subject: [dpdk-dev] [PATCH v2 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. 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. No checks are made to ensure that a private data area actually exists in the buffer. Signed-off-by: Dan Gora Reviewed-by: Andrew Rybchenko Acked-by: Olivier Matz --- lib/librte_mbuf/rte_mbuf.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 8e6b4d292..08c58335d 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -728,6 +728,24 @@ 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. + * + * Note that no check is made to ensure that a private data area + * actually exists in the supplied mbuf. + * + * @param md + * The pointer to the mbuf. + * @return + * The starting address of the private data area of the given mbuf. + */ +static inline void * __rte_experimental +rte_mbuf_to_priv(struct rte_mbuf *m) +{ + return RTE_PTR_ADD(m, sizeof(struct rte_mbuf)); +} + /** * Returns TRUE if given mbuf is cloned by mbuf indirection, or FALSE * otherwise. From patchwork Mon Jun 18 23:36:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Gora X-Patchwork-Id: 41240 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 7184B2BEA; Tue, 19 Jun 2018 01:36:28 +0200 (CEST) Received: from mail-oi0-f67.google.com (mail-oi0-f67.google.com [209.85.218.67]) by dpdk.org (Postfix) with ESMTP id 2BF752BC8 for ; Tue, 19 Jun 2018 01:36:27 +0200 (CEST) Received: by mail-oi0-f67.google.com with SMTP id l22-v6so16498103oib.4 for ; Mon, 18 Jun 2018 16:36:27 -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=0Bm5xljVvGHuFYWUar4GYEJBOvI6WBdYxEBVkNvt7yg=; b=o2kfsYlruKQezgsLcBzdkEJdGnUvZAxUIjeeMiP+ytFi1dWSWVwWj4J1UT6P2H3N4x Wj8XgmT5ILouKbya5Avfxo7FdWfV0kNNJTA8tYzm69hA4ElhF7ZY8EEwYCLpEbtOKiXT bjgO7VEt0KovXrkiR1sen/r/+AOlbHIHUltunYq8v/sBlne+L2HlYOv/u5yQpgfsYPq5 q17lfxnmcF14u5KMWIcGO/qcGRowxsvUEIwFunZ3qecwEO/cQktY0Ft9Tlx3MuIjjvPk wX0qI4k7S3DW/4hGY8gg7slWInmx7rDKnIQEld9JYXIe8fXrdswUlx3Jmv4o2hS4QsK9 ebJQ== 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=0Bm5xljVvGHuFYWUar4GYEJBOvI6WBdYxEBVkNvt7yg=; b=pBCohSBY4JnjmLnp4hFGcnSEFNXef67fVPuYkpEC9UknBsJP2TLK5PvGnC9XwPs9IR Ghs/JSWYE5pSdeEZwE0F5nB1BUEXTO3qhYWQeKtWv8xXidTN+zAzm6IbV8Ok0e9eVMNC CxdbJM+E1Vaw+wHusotntawxVqZCVmRNMJ9paQ7CDyb9sObro9vMRDiiS/h60beYGIz9 EPKKmbRRqfHwx7KsDSvGbqWhvF3eihnmAyCcUxP4Ec7LHjk7XcguZHNpNClJO+av6Ncq vh96gFW8YowaXwv532cWJyx1Crg9bTe1eMlfSlwyRLaqG2n+/C9frVl8NyUhoCB4300E 7lzg== X-Gm-Message-State: APt69E0toGcDVDFeRWRSP0AKMGCpKCLSmkzG96PR5zkbiiXNpRoOltKq Uc/MdknQ6a8cd9uxRjNUkozzew== X-Google-Smtp-Source: ADUXVKI/1xyKatOWmIiis0TFOYop/lDG1tXqBScdLCpN7vDKzHlu1OZ1X4CU+XKNGCcHA9rKY2XrEA== X-Received: by 2002:aca:fc82:: with SMTP id a124-v6mr8566642oii.69.1529364986107; Mon, 18 Jun 2018 16:36:26 -0700 (PDT) Received: from linux.adax.com (172-11-198-60.lightspeed.sntcca.sbcglobal.net. [172.11.198.60]) by smtp.gmail.com with ESMTPSA id f14-v6sm9761160ote.53.2018.06.18.16.36.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jun 2018 16:36:25 -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: Mon, 18 Jun 2018 16:36:18 -0700 Message-Id: <20180618233618.21729-1-dg@adax.com> X-Mailer: git-send-email 2.18.0.rc1.1.g6f333ff2f Subject: [dpdk-dev] [PATCH v2 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 Mon Jun 18 23:36:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Gora X-Patchwork-Id: 41241 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 5126A2BC8; Tue, 19 Jun 2018 01:37:04 +0200 (CEST) Received: from mail-ot0-f196.google.com (mail-ot0-f196.google.com [74.125.82.196]) by dpdk.org (Postfix) with ESMTP id 99DEE2AA0 for ; Tue, 19 Jun 2018 01:37:03 +0200 (CEST) Received: by mail-ot0-f196.google.com with SMTP id r18-v6so20539016otk.1 for ; Mon, 18 Jun 2018 16:37:03 -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=MLOEPMVjAQWc+vC193wdKLeM6qwZesqTI9YZSiF/Ncs=; b=eKPtCl0zy6Mkchuo23hVUaKc6wDmNRHOP/9Ofja9Rx86Jirl90VWY4RTOpJbKY68xF I17XlO5ibQkbnY7EO9G0fvDAToZm7TFmzMsfvCyzac+upVcOVQltbNdzHYShAw3ZTHQ0 eVEqc+0/Pxlq8SjBVOQBiaOeyL7zBLxBPPjXwj9LseDajJiAiaUigShVWt0HLiChvyzo avJe1rlKmeXIukZQkFmjurABqw8apodNFHJ3Up7Hm2zMb7cC3MvLMyyn1jTFSfFvvEAy ZgfvNYg45bC/w2L1D0CaWGe2Cn/rH7hIzavJZkVAJlhByShi1fGs0G9vVo3tKSlB+8Gu 6s5A== 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=MLOEPMVjAQWc+vC193wdKLeM6qwZesqTI9YZSiF/Ncs=; b=VcSBePENaksE8AJkuima4cDLGbJommsdBh5VuKxBHRUlTdt7/hssT2tnT6oRXKvewj TU+FkYlc/OQbTWP0R3VmIDmt4/qRv7uKYXbY9WVQ0MDtGvTSSH3ma8Gk9W7m9NwtMPTA ZqlcNAlKUft0mXT8Nzl02yfyUgRouXFa+icNnk98m0q9poLPLJc4ZCLxBFHdBJfIT2GR XHvp4celzfv7L5Ntb0nmc9S9tXyLTS1PVo5atF6WagRkKagSWrofZKNpv27WrxfgGpoo lDNGLH5F/ckMLwkH7amNxYw6APjOsKpUjWZDSLX8FXpJ/PwvETlfwAM8P5jr7CgsHdoD CiCQ== X-Gm-Message-State: APt69E3ndi04QijCEgyMv0uJBDb5YdLJu5KET9Q80RtihE2LBuNoa0v3 7ESFmAHfYl5qdzcWcDDtvAsu6Q== X-Google-Smtp-Source: ADUXVKIj+psxiNqnXQRvFGib7mEg+G4Ww4ih11KfypF931uNZvEDB89+LgmGqMSZa95ob6wtzz0a5g== X-Received: by 2002:a9d:1904:: with SMTP id j4-v6mr8577027ota.21.1529365022652; Mon, 18 Jun 2018 16:37:02 -0700 (PDT) Received: from linux.adax.com (172-11-198-60.lightspeed.sntcca.sbcglobal.net. [172.11.198.60]) by smtp.gmail.com with ESMTPSA id 2-v6sm6576627oij.11.2018.06.18.16.37.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jun 2018 16:37:01 -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: Mon, 18 Jun 2018 16:36:56 -0700 Message-Id: <20180618233656.22008-1-dg@adax.com> X-Mailer: git-send-email 2.18.0.rc1.1.g6f333ff2f Subject: [dpdk-dev] [PATCH v2 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 Mon Jun 18 23:37: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: 41242 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 66C402BEB; Tue, 19 Jun 2018 01:38:19 +0200 (CEST) Received: from mail-ot0-f180.google.com (mail-ot0-f180.google.com [74.125.82.180]) by dpdk.org (Postfix) with ESMTP id 27E512BC8 for ; Tue, 19 Jun 2018 01:38:18 +0200 (CEST) Received: by mail-ot0-f180.google.com with SMTP id p95-v6so20525728ota.5 for ; Mon, 18 Jun 2018 16:38:18 -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=BUhEOwLgjfRMpf+njvWp58aq/HcvwCcisqjcvaosEl4=; b=cXfVqKlzL1vgmDF4BBsbcB+Vi0yUYN67WiFoPmO8e9xUdQEhLxHMisLBEKo9fUH7Ie BSuamjMOzZZvp/TZIuaAyeT1YB2jNKs4ltWH2yC2AynP0lGrfW5kS+814unsuRs2YE8i Y2PyVyf4bilFyXp+fAHc8qBS7ugwWv+4lOjMOQSB/KZjOIGleLMPa0iHSya0GSh/owuv ucRL30EBoISnWswAOK3oDyKQ0a3k1oGVWuBrbfaJj5/YNei069+vzQ2NzQZz8PT5xt6H HD2XKLczrHYQUFa2p3oxNpnkZXT+5vcjVkmxaCe4AyjCHxsRl5ZcEtyTunwoTwkqywsR kJHQ== 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=BUhEOwLgjfRMpf+njvWp58aq/HcvwCcisqjcvaosEl4=; b=DFz/FnB1gI9U1N+RNgzTasUyreV6zYq0a2L2NHWyc/Fn5ZcKxA9yU3qsFZ9H09YanH IudzCZh4Y2/vsHPc1j2csV2isTvqytJ970a+E7upcRAL93JkDQa6IkIibtzQ+2B29cfF Jj1RvNiWntfF22vmcP4IOhwwuTBXpKtepWEFnSyP+OMqK0G1O2r+YTbsfcCPgM+cZ+lp 1vJueXzrZY2OuYZRGLAeVrHou/XRxRBZWZiImurzMtVxCPjhwhjPjoZlFpRxVharXxZE XwMqQ4mTwzTO3wTasJ69nGRSW9pciMGX8MLxJknrqe614HsZ3UOGHNb1fIzRugmYQ58p yS4A== X-Gm-Message-State: APt69E1Uam8dZy9lGzyzRazZYYHHu3l0T9XMY20U6c+VYdt5aadkkH6U b++WEbbCpQjqPq4jt/dUuRvtcw== X-Google-Smtp-Source: ADUXVKI9ra1lKQXiO+bBjLTrpJ+3bXzHDUw6Y+smlcH/DzF2w8zn5zssLEd7VSifbwNQ2fT9sWEtgw== X-Received: by 2002:a9d:3684:: with SMTP id h4-v6mr9620004otc.186.1529365097178; Mon, 18 Jun 2018 16:38:17 -0700 (PDT) Received: from linux.adax.com (172-11-198-60.lightspeed.sntcca.sbcglobal.net. [172.11.198.60]) by smtp.gmail.com with ESMTPSA id t4-v6sm16343493otd.40.2018.06.18.16.38.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jun 2018 16:38:16 -0700 (PDT) From: Dan Gora To: dev@dpdk.org Cc: Dan Gora , Maxime Coquelin Date: Mon, 18 Jun 2018 16:37:33 -0700 Message-Id: <20180618233733.22353-1-dg@adax.com> X-Mailer: git-send-email 2.18.0.rc1.1.g6f333ff2f Subject: [dpdk-dev] [PATCH v2 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;