From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0068.outbound.protection.outlook.com [104.47.42.68]) by dpdk.org (Postfix) with ESMTP id 253306932 for ; Fri, 30 Sep 2016 14:06:58 +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=HxV69cBEgkAFcYA38ha4MiPJO8OUOUFMnGgGxhcTKq3ZqSokoNXZfQUqLn/pwjeiSP4wmRjlfA6U+zcN7/qvaULJtv1fucuj/y4fPr4+ZGmAgN3TKuwSMdkeCDiWe8S5ZM7MsrQm46shXGNvr7wuYcqOek7rHqvPR3kJcS1p+OM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@cavium.com; Received: from cavium1.semihalf.local (31.172.191.173) by CY4PR07MB3063.namprd07.prod.outlook.com (10.172.116.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Fri, 30 Sep 2016 12:06:54 +0000 From: Kamil Rytarowski To: CC: , , , , , , , Kamil Rytarowski Date: Fri, 30 Sep 2016 14:05:47 +0200 Message-ID: <1475237154-25388-9-git-send-email-krytarowski@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1475237154-25388-1-git-send-email-krytarowski@caviumnetworks.com> References: <1472230448-17490-1-git-send-email-krytarowski@caviumnetworks.com> <1475237154-25388-1-git-send-email-krytarowski@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: VI1PR07CA0001.eurprd07.prod.outlook.com (10.163.160.139) To CY4PR07MB3063.namprd07.prod.outlook.com (10.172.116.144) X-MS-Office365-Filtering-Correlation-Id: 8eeb12e3-8e87-4a84-c441-08d3e92a4626 X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3063; 2:1KAMMIBRxvL/cQNr12/QuK72n4eFlJ1SRtzyYJ0Ix9F4haMh4SCn21FGKLs16qw1yprUS9BTv9j+Ckhbn3+L7iRH0XI8T3zarcBqP9bYxP9npE8W5RSoUXGSewfoFRYLMvPrgY0y0084nzRhpuvcuFp3e7Be1b7dSUC9KgDbKBglyBuqkrHYtbwhn0JU/011; 3:gLpwY4I2fsEfxxxPghdrE3CphkNaK7kpILEwgfoeuiAuOP1emGowbWZ7BYXae12TcP76QpE59KGye2KRCqQuoXW+MzVaQWgfexaaOHPSi6Fsj5wxMmlZleeTrs6J7ej/ X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR07MB3063; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3063; 25:wItCssWZPlIKFaaRLBwulMoKbeH5Pwq6we7+4jxxFMO+q/Jf8by1sMWDGUnXhn3mbITWjObuGSFcTxQSfUZv+2SNhCrGW7xLrfF1tpH7My2uFIQm2KhLnxJqxxIpTBbBrtiDx1XQGNjyjGD4i2RrlqbrC2UXlup7XsTcZauxBfYT6n5fifBzgIwEERm136IV0EVPpoyxlw/+hnwpTQ4dXWaCQDrQqnoBBF+AHhx62NZFN1hOE2kY0Gi000Q/47BvIu6ftUbNQXnjUsnGVhITVpr0pUG2ciBQi6D9B8JYJh5WldEe0d+EaTxqWZxT7TVTrTZ8UwAoTTuyE6H+fNkVKdayS+KO+Z1V/bhiiOTs8SJSR8YXqcRK0hEP2GdE/UUGemvPPqsEvsA7ZcuFzLcZ9cEswZdEbxCATdvQKKNA/+NyykfaTs2kh17dSekdEEnRPbZac8IqNiAIAFMJrtPFScM8/I7zmGoI4Xp0Ru5TcKWVHrOtvFUJyYwzjqsLA75SZORWIIdfmhXq3VFraQwvcukZljK2l9dgwhostaLBgVNszlzQVd80NMQNt2nHipl07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5NH6fVn6Hep7Nyo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:CY4PR07MB3063; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3063; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3063; 4:SP9l7aP8DzKWFE9AQHHKXs15i8slKqk6mvZ583DW87BT/JLWsikZOPMa8MXhNEO2xnFrZuXm5oUBup1H2bv7EV23eWaHBW+SW6X4ZvpyxbrmUTxj0ieM7re63TpWJglI2zqlaXhEuSVcUtmn2k2KlC4gOjeKAgIjIwegqjj8qp/Qk/mEXOJDM97z3rsxUBWLdgVB6fHWs/wgy7NwXZObEmx9RNWX06aAMKEiai0yjRO+6imy2F11Ig/cEahLgUtqp+1a14F+DFohM8qd9Rftwifq90DOmuU8iuIda149ueYgK+8gLCkVRoKlMj1DkscCgaZnXD+dbqQEEYcJWT5PAuV7gYOOl5qD1KabPbPuIszzzXosqLZGbCSLpDG3QF/h+RyWigCuNZ+Iz0yyMH1aIA== X-Forefront-PRVS: 008184426E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(92566002)(3846002)(66066001)(189998001)(47776003)(42882006)(36756003)(105586002)(19580395003)(97736004)(6916009)(6666003)(68736007)(42186005)(19580405001)(50986999)(50226002)(77096005)(76176999)(5003940100001)(6116002)(7736002)(2950100002)(101416001)(586003)(106356001)(7846002)(5660300001)(4001430100002)(305945005)(33646002)(229853001)(110136003)(8676002)(4326007)(81166006)(107886002)(81156014)(50466002)(2906002)(48376002)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3063; 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-Micro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1gixf6aMAYd0G4otAjXgnR7FlGrktOXji87umF45F/9qs3bVW2hXTSNbLXTCUAmOgFDE8uR1UBf1Wy7Ojl5UhDwTGJ0IQdstfx6oijKq70HYDrxdYAEYsk0Ah5tvMuAgYlJkAFk8SHLtHWCAEZqyiBiCILnmTsuBQQsP9Dak5aF3T1d2NBPMNuMzzNnIDQJb4UFf8jqWp5oAvQieqNLARp9726jfLO6k2x0PNRIzzvQ/Dgs4OiSWJ1HeGqtYhi2P5zeT5AbiBCyAsonhynJ5y0+0jxkJsfG02K8F2hAz4xew1AtHmYduFAc7Q2iZAAna SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2016 12:06:54.7372 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3063 Subject: [dpdk-dev] [PATCH v2 08/15] 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, 30 Sep 2016 12:06:58 -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