From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0079.outbound.protection.outlook.com [104.47.40.79]) by dpdk.org (Postfix) with ESMTP id C0AF35AAE for ; Fri, 26 Aug 2016 18:55:12 +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=q2crAHLGizdNOFxwaad8YBt8xqlSvfH7V3B1TPyp3sE=; b=ihzHrqsSSbFsp/R5RTd21u/pRRCshmGQ92IZiPTgZ0dTUplTP/UuNnMcZR+JwPYEVAP/nc/S7Z456hLspLU/a470I32C98AMr8p8SImf61OMoGDW4XUl6F2pwFQc3yqx3GoqHuZoOi2aJAhKZ2f9BOfNyvIYxK1/GcCH1xPk6u0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@cavium.com; Received: from cavium1.semihalf.local (31.172.191.173) by CY4PR07MB3064.namprd07.prod.outlook.com (10.172.116.145) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Fri, 26 Aug 2016 16:55:08 +0000 From: Kamil Rytarowski To: CC: , , , , , Kamil Rytarowski Date: Fri, 26 Aug 2016 18:54:03 +0200 Message-ID: <1472230448-17490-9-git-send-email-krytarowski@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472230448-17490-1-git-send-email-krytarowski@caviumnetworks.com> References: <1472230448-17490-1-git-send-email-krytarowski@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: HE1PR0201CA0008.eurprd02.prod.outlook.com (10.165.229.18) To CY4PR07MB3064.namprd07.prod.outlook.com (10.172.116.145) X-MS-Office365-Filtering-Correlation-Id: 4445fbf8-db2b-473f-3c66-08d3cdd1bd83 X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3064; 2:QbXf77KPBUHBbLzjWZ7NL09USoCn2f7o0jYX+cIIsqZM7vcUjnldzjeaAC0sn4wNJ/0Ym/jBWxxD+wKFOXA8zekmevBbrREcev5QueXb8NUKv3zKS0S3B8Ru1p56iqUI1Xe/aZToYf0yVYXDuTYti0ooHeAynBnZB4spWKp3+GXSgLb228g+FHSJKF1ri7c2; 3:9glqnSC7LO0J22Do2edLAhik2hAvNWXoP0hOvqw9RV570wMSU/jGcJ68ScOrknwwrf6bKx0B6UEqBSRDef46vDhOZ0T7cmiNsEpnIw3hmg4n4iAlKeGI9J2KrIuxdSAU X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR07MB3064; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3064; 25:yTruxslEkqcMGCgkzEhVqudxC83y3RclCDPgAI9Q6S6D+LK/KN7oS5R7oIgE+C/pgCQXvHbfQERZai3OSBwuyG0jl1ft6npsRK7VDk38gvE6d2MYNKXxBsM60aA+KLuY8zg7HslyuCSzuvDhajgIOGBC+teefyMzhvA4Grdt/mLpJhGtdOjOeIlEz+l5P90mXICUEEvAmsA7x4TpV5tfBZUNs/SVaj9AUtcZF5I2inOt9Hn2ORc94y+1uEqy2xvjZr4VPC/zC98/VTx9Nptj2TWogfb9Wqo4BtqBzXDIaKaauPYWGfhPQ2vk5WL2kVE/G5JGUWdVRszf50yPQAnI0d2Zpuj12QY+ko0UHDM9kaSfMC6QdK+MhbBAju+41j7H0lEh04R8Dj81xaMJJk1aD+aC5qf9nAtWxqNT0tbjg/AUH848UC5qScsxiwWNhNVLfTB7tE8ftTxlB2UrmJ1VGFpRR8SZPdTmpALXhooubqPPYPq3pppgLGbFgTl3i0hFYwIlV3VumvvG7N0nc2HCubSn9G/h9s3AuqQl8ftiTesGLsJKFni5ha6mbsIPbQea+V8GuzQv6VI0+bI7AZcJRIVaspbK7iERyuk5k+jTjJ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exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:CY4PR07MB3064; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3064; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3064; 4:KO9YODhmy2DRzwj65MTMPdB7oN/CW8XB88OIY/ODWHkmvOd91ibrHwcS+W3kxTzxAWE6h9PLizA7B+7Jgwrew49KrEdKz1HhGmCZBpw825hLSxHdPmWVSNbeaSW/VucCh6p3lip6jfErrm7XSeZbloLP5pq4sGnsvzz48Myt9R+tKhM8gTNMIoPQWow7VP7sYCYkLvpw9hghTsQtEyfhrIVUQmRbq5Z8TFD5Ef6wEOmp7X6icyv7grYUtFxPn2AOWCq3276Gl4poROddx0CI/WR6LkIx4Dd1np3zhDSMLUB8PqbUkXrayoqFX4DYfVQ4QKlcMpp8jGjE0fAuj6fHx4IdMwd4r3JC/SrFJQlfbq7OM83Vfm+gSjEX2LuvfU8x0mJD7Uq7VWst9fE16tJexQ== X-Forefront-PRVS: 00462943DE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(81156014)(36756003)(77096005)(189998001)(2906002)(229853001)(2351001)(105586002)(8676002)(101416001)(92566002)(5660300001)(81166006)(6116002)(4001430100002)(2950100001)(7736002)(47776003)(4326007)(66066001)(586003)(50466002)(106356001)(50226002)(5003940100001)(19580405001)(19580395003)(305945005)(50986999)(110136002)(76176999)(7846002)(48376002)(68736007)(42186005)(3846002)(107886002)(33646002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3064; H:cavium1.semihalf.local; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; CY4PR07MB3064; 23:iZ3vf45Juq9zprOPxBPPW4+xCdTJit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WptZEDmzqaU/KIYqo49D0XsxtMF7S8hkPmpoQNjLmFXMYfMrmPsp4arzAldwqIQFJ7FR4YCSJ7QV501IJqYf2snKn2rZ2D SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2016 16:55:08.2640 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3064 Subject: [dpdk-dev] [PATCH 08/13] net/thunderx: add helper utils for secondary qset support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 16:55:13 -0000 From: Kamil Rytarowski Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki Signed-off-by: Jerin Jacob --- drivers/net/thunderx/nicvf_ethdev.h | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.h b/drivers/net/thunderx/nicvf_ethdev.h index 34447e0..e162364 100644 --- a/drivers/net/thunderx/nicvf_ethdev.h +++ b/drivers/net/thunderx/nicvf_ethdev.h @@ -87,6 +87,17 @@ nicvf_mbuff_meta_length(struct rte_mbuf *mbuf) return (uint16_t)((uintptr_t)mbuf->buf_addr - (uintptr_t)mbuf); } +static inline uint16_t +nicvf_netdev_qidx(struct nicvf *nic, uint8_t local_qidx) +{ + uint16_t global_qidx = local_qidx; + + if (nic->sqs_mode) + global_qidx += ((nic->sqs_id + 1) * MAX_CMP_QUEUES_PER_QS); + + return global_qidx; +} + /* * Simple phy2virt functions assuming mbufs are in a single huge page * V = P + offset @@ -104,4 +115,32 @@ nicvf_mbuff_virt2phy(uintptr_t virt, uint64_t mbuf_phys_off) return (phys_addr_t)(virt - mbuf_phys_off); } +static inline void +nicvf_tx_range(struct rte_eth_dev *dev, struct nicvf *nic, uint16_t *tx_start, + uint16_t *tx_end) +{ + uint16_t tmp; + + *tx_start = RTE_ALIGN_FLOOR(nicvf_netdev_qidx(nic, 0), + MAX_SND_QUEUES_PER_QS); + tmp = RTE_ALIGN_CEIL(nicvf_netdev_qidx(nic, 0) + 1, + MAX_SND_QUEUES_PER_QS) - 1; + *tx_end = dev->data->nb_tx_queues ? + RTE_MIN(tmp, dev->data->nb_tx_queues - 1) : 0; +} + +static inline void +nicvf_rx_range(struct rte_eth_dev *dev, struct nicvf *nic, uint16_t *rx_start, + uint16_t *rx_end) +{ + uint16_t tmp; + + *rx_start = RTE_ALIGN_FLOOR(nicvf_netdev_qidx(nic, 0), + MAX_RCV_QUEUES_PER_QS); + tmp = RTE_ALIGN_CEIL(nicvf_netdev_qidx(nic, 0) + 1, + MAX_RCV_QUEUES_PER_QS) - 1; + *rx_end = dev->data->nb_rx_queues ? + RTE_MIN(tmp, dev->data->nb_rx_queues - 1) : 0; +} + #endif /* __THUNDERX_NICVF_ETHDEV_H__ */ -- 1.9.1