From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0058.outbound.protection.outlook.com [104.47.36.58]) by dpdk.org (Postfix) with ESMTP id 36F621B1F1 for ; Sun, 8 Oct 2017 14:45:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=iZIq2TElR8yWgVsgCkyIPEO4GJp6I8opMOAoVlDUOv8=; b=LmxlRvK8t2XYgQhYY3PHZDYc3lfoKmXBRoHpeCvnKD+tTvYMrR/FlLDewtNHfDYI/Q5k0+IqEx1of+ei4ejHVRB2doEfaIbnzoNhH3ts6yd/i+xVE3ROAtT6Intii97YUFmqsigH3+QP+Kxv5OzHJ6PcOCGJ+/cygdg94ygzo4s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 8 Oct 2017 12:45:36 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, Santosh Shukla Date: Sun, 8 Oct 2017 18:14:11 +0530 Message-Id: <20171008124430.1866-8-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.56.157) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 795fac3a-c9b8-4592-1ee6-08d50e4a7a13 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:LtwN8mDNeXtuPS178UOCjZjgSKpNCBk6HLYRHQoxNdj7cGRx5KIhbCrKH0J14L4YdbXyiNxk58kgOJ5VcHFI5NPqjEbvjSC4Zb7GnRIAyrfw8Nnyadfxw/RYgbnwjlviubqoaQwd5S7iAR7BHb7R3M5ssvacxzJ8nJbrh90XVB5pnmPpGBqJeLwmI0uhhRngL1MfbKwJgauIj9VXSSHviG86CXfamCPDmv8raj4zzgoMXKvnDB6n/gcpUKNOdjOO; 25:zA8eQ7Eg4t9ulhZvYMSnlAwc838r33iPGzHV5SHcuy33z/oOSrGq+0QzUo4dUJEPSiQV7wtgXlBUPXmDArOTG7YpeEwCZEQlfNWgcqh6/kQxjw3oq1BSolefBiV5KyhPQFH5Se68ukgmfOsZIbERHp7RH3cWtgiSw+6vvranRXhxTZLDk2l6nTOCbmUSL+cXez4DOQN+UzpxixphpQL8/8jpPQDCoZB9LeyjuRCymtw/Ze6SL2vJF5Lwx3OVL+Mh1hTkOv8MtkQRgn6lRTgzMpxGCa893VsaEZssZupXn6awifUQ9bbQUnXrRzMGftNEQEakj4HJ/RkVXGspbNX1wg==; 31:xBSL2B/5UxPD9J+/gF2BBYzSs6X+xJBpnStHQT9+o1LV5uJQ2YMWQBPa9ujYo0//qpnq9XlPx5zFLfhjL72AY9tNI+iz5fh6Iaqcut+dIyiBxajCgNolMC2lVCBoXS3Pc1b/FGjvo/FOYHw77yC1ia9Fj2slwQKnwWttS7r01Nar180MyHnWizYC1W5HJOkAqVXZ3DFc6xqMMh7aYbuuINQOlqxDxSEecaIpX6wfR/0= X-MS-TrafficTypeDiagnostic: BN6PR07MB3089: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 20:9U4ATGp1CsW7ciBK5kOIxZb+xc66kDqEr0f2GnfeiAynMTHqQQ+INImNUHoXJAaIgb/k0xDBtgwpmBUZzJWr/qdXL9YmLAlguZjgj59rwR3D7DzE7pUXQwO6aQ4b4c1mQQ4WyypBzv/XWyCJHcXrlcKDolrKIrE5Zr6mbNhySQtlAFhlM+0lv4vB5vkUPYQ6iWM/xhya09+2d0DabDqXCDHK2jh5WVJE+ODBd1i0Ua+e0HyMBxQCDsZG1rn/qQZ5fDPM0iv3O872aDfmnJjiveh75emlcFsQVHygaT8QRC1TZyqr8Wx6hXqBrU2q/PuABXdi+Y2VO+0bWMfYY+dULiI0HrxBBazGeCCB9mBXCoApf01NlcQ7fYWsn/8rsy85KC52mKsvzsGZqW7jabFEy1VXJGCQ9kMOrlZ0LM/cvZRS8KBqvUpTUACn3VIQieDp/3jFrKQ6oJlhFTkOv4bBhFokHIA00F+AN9nMyRySLnKrGGxZu1CqEP1AX3VRtMf79m9e82Z+tNUBjx/I8+bgiDhmwKT7dIxFHPNlGgTW/1p624310qUf/WQRhvxRA4QMdMG0iaOtr+geejzal8quy4ceXwdlQSZiv3FL3p24l+s=; 4:55XB0M4qoxbp4exALxm2cZKhiBpmzuIwNc/j8xvcNzOAD3jjX4y/74C20yL7fatI5zlRg1yfnUwrvydMINPwnoymzOYJGyMY5LbbNacqHjRl/ChOpHVbSgl4bj1kBepePGWQV6XQEFqt22hX3q0B/xS3rCbYsguik2GCeE1vDoffSQxMg/pr7JD4hU+RfiFVpgssdfWKEnsBU8GuByEuphbt45dupnBsjRf7dsWraHSuCzB07J988k+q2uquNS6mgWPEJeVsz2kZNzjpLWZj9gkWMd72RVSX3xCEFcUi1L4= X-Exchange-Antispam-Report-Test: UriScan:(158342451672863); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(100000703101)(100105400095)(6041248)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 0454444834 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(376002)(346002)(199003)(189002)(6916009)(42882006)(81166006)(575784001)(2950100002)(81156014)(8936002)(50226002)(6486002)(16526018)(6666003)(189998001)(16586007)(316002)(6116002)(1076002)(6506006)(3846002)(7736002)(305945005)(8676002)(106356001)(105586002)(5009440100003)(53936002)(4326008)(66066001)(107886003)(47776003)(2906002)(5660300001)(6512007)(76176999)(5003940100001)(50986999)(97736004)(25786009)(101416001)(68736007)(48376002)(50466002)(478600001)(72206003)(2351001)(2361001)(33646002)(36756003)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB3089; 23:7ClLpvTrL9Lp1gpMNneB+XTD1/Co1sBh8jhBC8iku?= =?us-ascii?Q?DNP8VRu+nVwkae8Na9lOtlZPYHFv57JXBI8+49vCJhlsIFOzJviUQSM5wwWy?= =?us-ascii?Q?K7zdDNUqja633NXBVa1JhVXD+oWRZ+/vPPtNOm7mxo10sJDlCwiUZBYJ6PKy?= =?us-ascii?Q?rKJf39vk6fhscRGVXRoMbM/3ez5l/t8gX1c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LlittXq//Y4MF9YIvm9uhe6clzIJ0JMl4+mOW4+U6RxuREE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2017 12:45:36.2013 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v2 07/26] net/octeontx/base: add base PKI operations 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: , X-List-Received-Date: Sun, 08 Oct 2017 12:45:39 -0000 From: Jerin Jacob PKI is packet input unit, which receives the packet from the BGX interface. This patch adds the basic PKI operation like open, close, start and stop. These operations are implemented through mailbox messages and kernel PF driver being the server to process the message with the logical port identifier. Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla Signed-off-by: Santosh Shukla --- drivers/net/octeontx/base/octeontx_pkivf.c | 84 ++++++++++++++++++++++++++++++ drivers/net/octeontx/base/octeontx_pkivf.h | 67 ++++++++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 drivers/net/octeontx/base/octeontx_pkivf.h diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c index 724acf0e8..0e824cbc3 100644 --- a/drivers/net/octeontx/base/octeontx_pkivf.c +++ b/drivers/net/octeontx/base/octeontx_pkivf.c @@ -34,6 +34,90 @@ #include #include +#include "octeontx_pkivf.h" + +int +octeontx_pki_port_open(int port) +{ + struct octeontx_mbox_hdr hdr; + int res; + + hdr.coproc = OCTEONTX_PKI_COPROC; + hdr.msg = MBOX_PKI_PORT_OPEN; + hdr.vfid = port; + + res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + if (res < 0) + return -EACCES; + return res; +} + +int +octeontx_pki_port_close(int port) +{ + struct octeontx_mbox_hdr hdr; + int res; + + mbox_pki_port_t ptype; + int len = sizeof(mbox_pki_port_t); + memset(&ptype, 0, len); + ptype.port_type = OCTTX_PORT_TYPE_NET; + + hdr.coproc = OCTEONTX_PKI_COPROC; + hdr.msg = MBOX_PKI_PORT_CLOSE; + hdr.vfid = port; + + res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + if (res < 0) + return -EACCES; + + return res; +} + +int +octeontx_pki_port_start(int port) +{ + struct octeontx_mbox_hdr hdr; + int res; + + mbox_pki_port_t ptype; + int len = sizeof(mbox_pki_port_t); + memset(&ptype, 0, len); + ptype.port_type = OCTTX_PORT_TYPE_NET; + + hdr.coproc = OCTEONTX_PKI_COPROC; + hdr.msg = MBOX_PKI_PORT_START; + hdr.vfid = port; + + res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + if (res < 0) + return -EACCES; + + return res; +} + +int +octeontx_pki_port_stop(int port) +{ + struct octeontx_mbox_hdr hdr; + int res; + + mbox_pki_port_t ptype; + int len = sizeof(mbox_pki_port_t); + memset(&ptype, 0, len); + ptype.port_type = OCTTX_PORT_TYPE_NET; + + hdr.coproc = OCTEONTX_PKI_COPROC; + hdr.msg = MBOX_PKI_PORT_STOP; + hdr.vfid = port; + + res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + if (res < 0) + return -EACCES; + + return res; +} + #define PCI_VENDOR_ID_CAVIUM 0x177D #define PCI_DEVICE_ID_OCTEONTX_PKI_VF 0xA0DD diff --git a/drivers/net/octeontx/base/octeontx_pkivf.h b/drivers/net/octeontx/base/octeontx_pkivf.h new file mode 100644 index 000000000..fe850d0f7 --- /dev/null +++ b/drivers/net/octeontx/base/octeontx_pkivf.h @@ -0,0 +1,67 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium Inc. 2017. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium networks nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __OCTEONTX_PKI_H__ +#define __OCTEONTX_PKI_H__ + +#include + +#include + +#define OCTEONTX_PKI_COPROC 5 + +/* PKI messages */ + +#define MBOX_PKI_PORT_OPEN 1 +#define MBOX_PKI_PORT_START 2 +#define MBOX_PKI_PORT_STOP 3 +#define MBOX_PKI_PORT_CLOSE 4 + +/* Interface types: */ +enum { + OCTTX_PORT_TYPE_NET, /* Network interface ports */ + OCTTX_PORT_TYPE_INT, /* CPU internal interface ports */ + OCTTX_PORT_TYPE_PCI, /* DPI/PCIe interface ports */ + OCTTX_PORT_TYPE_MAX +}; + +/* pki port config */ +typedef struct mbox_pki_port_type { + uint8_t port_type; +} mbox_pki_port_t; + +int octeontx_pki_port_open(int port); +int octeontx_pki_port_close(int port); +int octeontx_pki_port_start(int port); +int octeontx_pki_port_stop(int port); + +#endif /* __OCTEONTX_PKI_H__ */ -- 2.14.1