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 93F281B20A for ; Sun, 8 Oct 2017 14:45:47 +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=jr+54yew6fZnWHLcfBYObhagOMObiHPrE13pXN+VYmE=; b=Q/wLhf3MIdl3RvXMwjHsDq3GGg4UgXw6wkS9YnjiERJedbV9V/xB+7XXGW1epojfkrPHgc7J9+c9tRawSY+cyY+mns/EgSmlTRNDCU5hZEAYONWA6GBXVHXE7ucTyg+b/qpcjxjC7DbVNWWlckCesXeWzm/jLwdl3aTStJVj5K8= 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:44 +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:14 +0530 Message-Id: <20171008124430.1866-11-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: 9e2307fc-f9fe-47b5-e722-08d50e4a7f11 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:QV2hvejIvjgWuORamSdbCZyo9wkUX1t5QMxh8wkznguU5+5tMI7+ztNqDvEyXdpWhESso2LtoGEKW+Owc6LYi/iUneoZNPFSyrKE3FK8Q99Qo6s21ogTPd+G6xb9yRUPuNgSiY4pvyYJbkTS5hny9c07VdQUQk1C/lT/XPmL2VNnz742nojM9JHaotOnjhKtOgEPxFLEPirJomY0KFbG7xeZ4/+I8pxUxkBoQqKy9fpABEjE6DRQS8p+DI+LWVFG; 25:hz3Q1NEkydmmlkwaUILhA6PW5jmSJYlWJmliJ731H7Kn3geNG/NgzOwvZl5kATDgGgKI7XMj+EDEy9lpFa150L4yAVBIFC2kPfxO89OCZr4HHMdvbGDabKbZygUYOApywHzsbrIiMdmuu+AYuZgZHbuEGMNGq8H7KXjarHNTei8CnUEOEW/rv+QaNL0P2DX2YmW7CdkfRuiEDsMFAL3anu1UvUytSpGWkzeXRJ1i6BTrZ9mvII7Z7o9yKZywzmxVfMcPiUpc/SrVDEiVb+9K1PHN4SC51ixyuOr8kF+IJ59HjEO4Ibp2YS1AvVNJDNeSY3fzreKY7A819Tg8X+IXZg==; 31:d6h9LimzEY89PqhKPz9ApLzJ29D7ILz0KlgXLXTGsYp9cROZoBoRCU5YW5sMNP1aNp/83GRjleezJodZK7sn28R46onrHz6XivygaVD/grMXyAq/9xKCrhWDwB5JI4V4swrCSdbLdDhiNmRnE6WtjcB911jgRnRdl3V/409iIr9lfAjVWl7rNa/ehhgPOISDKfq8DodninezM3FYlUj9nvW1gJjcIbMrhCe/Vum4JCs= X-MS-TrafficTypeDiagnostic: BN6PR07MB3089: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 20:qg2HAgGkrzTHA3wIH6i9CRYKRqJ+qeHoBaUdJaITTNYkfpsCZRB6vC5TEVxolMCtfKgLymkRoTL7gNMN9E2TIKR29ZO7U7L+x6J9vmudmcnIZeJbcbY0LPUYiMu1HH4V1/nWiNoLziYSHbF/CkiUTM30KB1N1viD0z7dtBu8UQ2468STYYlceT8TLL6nM5T0ZakcDgvwowmZHP4M0bWF92aUQOERAeDN5XsVMoFV4rXqNo5V626jPi0Y0bD8NgeJY2R1Lk2Pn/3rD9NZxBHfniXL0OglLXVNQukIYuFQH9hbRPCsIOcA3DJ/2o34JEIYLgxV+K63JhIM/IMNWkzdia2lQokB24D/0xOE4bgAPIuacJtMIeOsYofO+8NCGLh1X4LTnfeVY26Rx4eQZcCH2OkppK0Yv4tVyUj4quShDNNA2ztBXn8UhJeeUDhBBkB7vBYGKcj6ZQ5HoGXHmS7naOks3R0dIscJVuLXmyqvh6gn/H2UKCA52UIGbBKaUMAqlnxp+o9VebmT/ZuvFY58CwKufY93meNPPy76WhpI7g/dLcrcxH7jtHqd1ZyMXEEQf3buDaCfel0nd1CPSykkJYMbPw0I1Q5UvA5Wpi1XexI=; 4:lEE0tm5HDztrt7+igbrJRSSBjSeqASvtOwU7q6V1ekHktitQ4HA7wUllGQ3Q00nyFXfM2Mxoo8tW0lRe9M4ELPxvpJA+mn4tX7kJow3ZwDFL94sB84Cw1UnnxCifOrgvuQuO1abAGqz7YuyIMixopjdZR5bJi4b9X5XUAjFVQ5jMaSxRQJBmYAOGfuKOZanF1XMhDCh4tCXoIPIeTPFSZ1kdOjaoCSDuIIN1/Ufzc8+iam8qP3ZF2dJQrU5PSqDy 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)(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)(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:luB9WC8NbY2+TqPEo00vh6nKr3KSIybfn+YTsV/DG?= =?us-ascii?Q?n01vk+sg8AK4mr2cIHFY+yQUeMJVUiM1vLnebWfWZN8SDgzIZ8pRuK7MPQj4?= =?us-ascii?Q?PJNKANi4xnZV/ADwPGGCH2T+pyX1gqElLSm/wtBjxGmn+zZgjXRut5LGMatk?= =?us-ascii?Q?HG7ZlvXWz33nl2Ib1YmeOCgYAyx4g+XUhLLzaEHZAzW3LpYUYsCmgZIeG/1a?= =?us-ascii?Q?1U0+kFztEKd90GDviBD8WWBhfB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Q?5wZ12wZKxz+P5U9VdSqU/qGWuqZkyb+M/Kfx0ZbzzzZor07KLyhm0Jv15/eE?= =?us-ascii?Q?lxezAfmzSYkqju9vnBGp0OhwQh3hxt6UABP8VRXxW/80BYPRJ5w6J1R+w=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 6:auW6ZSrClIVFHC9F/jFlZLeRrQQlPMXJpzrMZfQMbSn3iIHIPJFDWORvud/QIpnHGxOw5YhTbEJi8dnhlW38ANVqDOzfTaQcfsc8f2315We95iYXYat91cSpZm9R+1/MGUqL463Fqk6sIpUyHlnnKtJ4bCdB5gZeIrFh4QAJEqSFCSxjG4WaB0mUXApiQ7EaPn95nsdifQlGXmxeKWESUJGjg0pVx/EdvQKrLF8QPCdkC2xXSj2tCoibMWPoI+fCQBT1CXzyVH7wyy+E5EoHctcAHIjsOGnEmXzZX8UOKU8zyHMMJaT2DPYxWDwtH7dSXiG+UFooXHBHTRYylBKjhA==; 5:/nwID3lA+X6MDPc/knxhgVPO+38PB67kgGaIxQF1JBdhLS58CuKvjotv/aEPEMJFGH1cjldDP0lQ5hwAHMFjuvkvY/uBxXirfbA/244KJYEI2e/JI1DAm6aC1LghC5cnPIp41zP3wuwhnGxUjO1kow==; 24:s3RI+nN1jlumOZW4wav/HMWG0uQb+MqKa0Fm+/y1naRChYQELhdS7PRTdKVijjXriSQSMEztos+cXvsYi/12TqpRlH/Ok13z0SALs61VHAU=; 7:DMWNOSMttA++/1EJZAVwsnJh/Tsp94x05hrcOBpdrhR8LkXpOc2sMHfi/ub994SpNfUCGI2vYJ8jca9i14NB4qioQlXu9s90NQysblog38kyFuvy+X0iYKT38ghMLdLBPqfOzM9sZWNTFloyKGxLFi/+rkMx+VpAsOM7hcXkq0OhQIuagNBQMXYFNHfjb8aXfxlwr5eF3bX1Ghq3wUKKneEkHEZx9XINIfsUxrd+n40= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2017 12:45:44.2828 (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 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: Sun, 08 Oct 2017 12:45:48 -0000 From: Jerin Jacob Adding remaining PKO operations like flow control, Tx channel query, etc. Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla Signed-off-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