From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0050.outbound.protection.outlook.com [104.47.36.50]) by dpdk.org (Postfix) with ESMTP id B073F7D18 for ; Thu, 31 Aug 2017 16:55:44 +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=aTybf28RHYPxUF9X6W1KnEOLM9FTYUIQpWVA6pHouaU=; b=ANdCsIvmYgrUzSSUQpPmHzs7odVomT+W28FMrg5gkUwkQ/zGLAz6FEk5Ndx+M7A2f0ehsMvY67JsrqDH3J8sx/woYcgG8PqNl1eWAjndcoGXLkmpAxSgkO1X6sAeho5G+RgDmjVWUvv3TZrho2fMwJVaFb/QLqMx8A1p5rcaU9I= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin.domain.name (171.76.126.71) by SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Thu, 31 Aug 2017 14:55:41 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: ferruh.yigit@intel.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Thu, 31 Aug 2017 20:24:20 +0530 Message-Id: <20170831145436.5397-11-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.76.126.71] X-ClientProxiedBy: MA1PR01CA0109.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::25) To SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20d22429-9293-4a31-0e96-08d4f0805ad0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN2PR07MB2526; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 3:oaLO4yzMV3vK7yeeqRgKXvm3iCLzWQ/W8hN1eDImFhfrnGXDSCEKILKVfHUpSTYcXLtuyKOI0JugUR1BhP0uScl81xawFE6a3tjzhAws/3XOpF3MdX+Lqdl6NDiapyYApEvlym+B+N9o6U4b1RbtmKym2SjkLGSPrrlEMLhA3QCYfnfBDQ+OPlx7Eaf9Ucry0CjmDkU6J/gCXo+2JQmSI9nM5VQlligvzBV1FebQPSNZjGDQBlS8e6MPgsC1wn3F; 25:z3gMiSG+nqgdNb4K29lmN3FXS17gCuf8D9Nt411rFIJCPxcTvx3ZVD/V9g99IGoSC1XlRUM1LHkI8cf2dbQX9Mu6PJRt01ln0JpibUuMh2H6PosD7uwCnv+LNhgn+7N6eyyA9RwmU7tKpe68C9Ak1d4fLvBSJQovX6zcgDuS70jPNl27MwCdPC8S02DBdnkYDKpqV+eBTS19HcG/I0vyQgMebqvN0ep9W4hDIZh0ao1+EU4hYmVXFmJKM5QcpVVki8qyWJd+kBYsDOI8/0IJiiFX+DZzCW4hYLTy26eFM/sElw8otQhn4wAMgZioNu1+XGowZvjGMLbThVn3SHNfJA==; 31:EF6hxu7R9hU8cEyPMZvKZFwTaza4iwfILM+aGbkiUL2MQu9tf6J3m1xbuHlbuDekmzMa2a0LFYACfr8ndO/ct5rb2hV8jcre13zpDxPC7eWMWqPdRUhUUdJA08jAF8yi75tdgWfJGy8HYCG4ZuDkLNzOch2jo26LnGT7OZMXOJa2Mo/jclLmxSgqlPamu2STkiCs6JVldy8UIxTR1QqnBp8sRrWrNAcOXzwQFJTRusw= X-MS-TrafficTypeDiagnostic: SN2PR07MB2526: X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 20:BvnPKFRonedHDIYt3FQzghw3pH7yVCrOsvH1/GwlDs6V5OZto4duk34u/6JjDY2mCxnx5TIUHFRXpquxlLil+aTQlAyEeFDyN49/v0OC+4HbvxS48VOV+pySLTsvd72QKWXFXpZAlG6DnIKckx+NXsugQNSOrGscQwjMI3qDNSxIz9A4insNjaZOnmIGw/CEd1Z5a8pbsy8VhKNymsgh0nzNFjQwnBioSknTHZe0Ebo9JQoEFFD/xUWXypofxR7OV76PVDqDoX0BbcV7+QeKTZDi0tlRnbH3GHsgK4Bay+ymAeEfFP7JxwtFRxrNrhK3ID/b4xL97t4ar5hq/B5wVL8L47c6m1RYaDtgY1cmvY4FcLXgNTBpvuAZQm/sP3DhPmJS7rjMi8EdqQZFspdvLuD+Fa6W8dSednfy4SxM+wbL0SiVcDkJPOZCLClpRpDtR2zo6HpnsrHYS02BaKJ9LV3eL1kzhfsEeD5lrdGHqEy+SNDQCnMN28EKHmVz7CW05pTRtGzQi22bwZm9i33PhDcJfdWkvZO2h5raUBMeHjo/yMN4exU+Tdb2JgPGF7zA+kmvDbYNSeBgalrJaU+/TAKUUBi/Q6XI+aKNoeqHN6E=; 4:Ze8EMJDByISqFCetisjMZvALOR/cW/6pP6UCn3Y5ZyGjqX6warAc7dmTHJ9me1LKROYnDbheIHHPRC+s1Q2TE68I/EGoEFP0mbwDfH0V6FLbZpicPzUK5EF/Tyc+boktDrXZN/qnR63aNP2rMI8GQgGwmOnHbm4MrgGHMeTnEXX4d/ihJ8m480BGF8T6RFVfddk/xDjkf4uO8CXsdLQe1iUlWuhcHJSwHgrCB8iZ1GONm+DyyzKdDIf6URVct9pv X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR07MB2526; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR07MB2526; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(25786009)(1076002)(53936002)(3846002)(6116002)(478600001)(110136004)(72206003)(7736002)(6666003)(107886003)(6512007)(305945005)(6506006)(36756003)(6486002)(68736007)(5003940100001)(189998001)(50986999)(42882006)(106356001)(101416001)(76176999)(2950100002)(6916009)(5660300001)(2361001)(33646002)(2351001)(2906002)(4326008)(97736004)(105586002)(48376002)(50466002)(81166006)(66066001)(69596002)(8936002)(47776003)(53416004)(8676002)(50226002)(81156014)(42186005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2526; H:jerin.domain.name; 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; SN2PR07MB2526; 23:2MOYDDyneMRz/IhcZkra/HLc2e36NNvaOpMFLda8S?= =?us-ascii?Q?0SUAqEH1y84cZvHiGhRTIDwAHj4T0GDwvMbfsVmYp8BC02QAdyB+LmXT5NPQ?= =?us-ascii?Q?QO4gOQ6WnWNORNupBSEDk5f7TMAJCKnedoej+NB5XQeh3X7vRSWF2amzwKvw?= =?us-ascii?Q?iIlTrhxc8Tq7CHLtWFcyz5IWZpG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riginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 14:55:41.8803 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2526 Subject: [dpdk-dev] [PATCH 10/26] net/octeontx/base: add remaining PKO 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: Thu, 31 Aug 2017 14:55:45 -0000 Adding remaining PKO operations like flow control, Tx channel query, etc. Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla --- drivers/net/octeontx/base/octeontx_pkovf.c | 114 +++++++++++++++++++++++++++++ drivers/net/octeontx/base/octeontx_pkovf.h | 17 +++++ 2 files changed, 131 insertions(+) diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c index 38693a9bc..cbcc0067b 100644 --- a/drivers/net/octeontx/base/octeontx_pkovf.c +++ b/drivers/net/octeontx/base/octeontx_pkovf.c @@ -404,6 +404,120 @@ octeontx_pko_channel_stop(int chanid) return 0; } +static inline int +octeontx_pko_channel_query(struct octeontx_pko_vf_ctl_s *ctl, uint64_t chanid, + void *out, size_t out_elem_size, + size_t dq_num, octeontx_pko_dq_getter_t getter) +{ + octeontx_dq_t curr; + unsigned int dq_vf; + unsigned int dq; + + RTE_SET_USED(out_elem_size); + memset(&curr, 0, sizeof(octeontx_dq_t)); + + dq_vf = dq_num / PKO_VF_NUM_DQ; + dq = dq_num % PKO_VF_NUM_DQ; + + if (!ctl->pko[dq_vf].bar0) + return -EINVAL; + + if (ctl->dq_map[dq_num].chanid != ~chanid) + return -EINVAL; + + uint8_t *iter = (uint8_t *)out; + curr.lmtline_va = ctl->pko[dq_vf].bar2; + curr.ioreg_va = (void *)((uintptr_t)ctl->pko[dq_vf].bar0 + + PKO_VF_DQ_OP_SEND((dq), 0)); + curr.fc_status_va = ctl->fc_ctl + dq; + + octeontx_log_dbg("lmtline=%p ioreg_va=%p fc_status_va=%p", + curr.lmtline_va, curr.ioreg_va, + curr.fc_status_va); + + getter(&curr, (void *)iter); + return 0; +} + +int +octeontx_pko_channel_query_dqs(int chanid, void *out, size_t out_elem_size, + size_t dq_num, octeontx_pko_dq_getter_t getter) +{ + struct octeontx_pko_vf_ctl_s *ctl = &pko_vf_ctl; + int dq_cnt; + + dq_cnt = octeontx_pko_channel_query(ctl, chanid, out, out_elem_size, + dq_num, getter); + if (dq_cnt < 0) + return -1; + + return dq_cnt; +} + +int +octeontx_pko_vf_count(void) +{ + int vf_cnt; + + vf_cnt = 0; + while (pko_vf_ctl.pko[vf_cnt].bar0) + vf_cnt++; + + return vf_cnt; +} + +int +octeontx_pko_init_fc(const size_t pko_vf_count) +{ + int dq_ix; + uint64_t reg; + uint8_t *vf_bar0; + size_t vf_idx; + size_t fc_mem_size; + + fc_mem_size = sizeof(struct octeontx_pko_fc_ctl_s) * + pko_vf_count * PKO_VF_NUM_DQ; + + pko_vf_ctl.fc_iomem.va = rte_malloc(NULL, fc_mem_size, 128); + if (unlikely(!pko_vf_ctl.fc_iomem.va)) { + octeontx_log_err("fc_iomem: not enough memory"); + return -ENOMEM; + } + + pko_vf_ctl.fc_iomem.iova = rte_malloc_virt2phy((void *) + pko_vf_ctl.fc_iomem.va); + pko_vf_ctl.fc_iomem.size = fc_mem_size; + + pko_vf_ctl.fc_ctl = + (struct octeontx_pko_fc_ctl_s *)pko_vf_ctl.fc_iomem.va; + + /* Configure Flow-Control feature for all DQs of open VFs */ + for (vf_idx = 0; vf_idx < pko_vf_count; vf_idx++) { + dq_ix = vf_idx * PKO_VF_NUM_DQ; + + vf_bar0 = pko_vf_ctl.pko[vf_idx].bar0; + + reg = (pko_vf_ctl.fc_iomem.iova + + (sizeof(struct octeontx_pko_fc_ctl_s) * dq_ix)) & ~0x7F; + reg |= /* BASE */ + (0x2 << 3) | /* HYST_BITS */ + (((PKO_DQ_FC_STRIDE == PKO_DQ_FC_STRIDE_16) ? 1 : 0) << 2) | + (0x1 << 0); /* ENABLE */ + + octeontx_write64(reg, vf_bar0 + PKO_VF_DQ_FC_CONFIG); + + octeontx_log_dbg("PKO: bar0 %p VF_idx %d DQ_FC_CONFIG= 0x%lx" + , vf_bar0, (int)vf_idx, reg); + } + return 0; +} + +void +octeontx_pko_fc_free(void) +{ + rte_free(pko_vf_ctl.fc_iomem.va); +} + static void octeontx_pkovf_setup(void) { diff --git a/drivers/net/octeontx/base/octeontx_pkovf.h b/drivers/net/octeontx/base/octeontx_pkovf.h index b33796a29..cfc3715d8 100644 --- a/drivers/net/octeontx/base/octeontx_pkovf.h +++ b/drivers/net/octeontx/base/octeontx_pkovf.h @@ -72,9 +72,26 @@ typedef struct octeontx_dq_s { void *fc_status_va; } octeontx_dq_t; +/** + * Function for extracting information out of a given DQ. + * + * It is intended to be used in slow path (configuration) in + * octeontx_pko_channel_query(). + * + * @param dq The DQ to extract information from. + * @param out Pointer to the user's structure he wants to fill. + */ +typedef void (*octeontx_pko_dq_getter_t)(octeontx_dq_t *dq, void *out); + +int +octeontx_pko_channel_query_dqs(int chanid, void *out, size_t out_elem_size, + size_t dq_num, octeontx_pko_dq_getter_t getter); int octeontx_pko_channel_open(int dq_base, int dq_num, int chanid); int octeontx_pko_channel_close(int chanid); int octeontx_pko_channel_start(int chanid); int octeontx_pko_channel_stop(int chanid); +int octeontx_pko_vf_count(void); +int octeontx_pko_init_fc(const size_t pko_vf_count); +void octeontx_pko_fc_free(void); #endif /* __OCTEONTX_PKO_H__ */ -- 2.14.1