From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700075.outbound.protection.outlook.com [40.107.70.75]) by dpdk.org (Postfix) with ESMTP id B72051B50D for ; Wed, 11 Jul 2018 10:42:33 +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:X-MS-Exchange-SenderADCheck; bh=r8Vv+SJjtK3A1DeYHWuysTB5Tyt3+yr+R3EjChGsJYI=; b=HfNtBDwj/0T0nHzmEy6a9Lkhj04Siley8bxx8XDTZoQXC1lPF9XEW7fI7jqbohxlNfjG21CIp+iDNcPkHGQtZZPcDQ6SlznFVdUmwNfzJfIZNIU5tCBQmtTzIxsMN/zSryvDfky4BPymqu7sUsYdgUla0/S7x2Feh79e5mVr32g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kiran.Kokkilagadda@cavium.com; Received: from kkokkilagadda.caveonetworks.com (111.93.218.67) by SN6PR07MB4959.namprd07.prod.outlook.com (2603:10b6:805:ac::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.21; Wed, 11 Jul 2018 08:42:29 +0000 From: Kiran Kumar To: thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com Cc: dev@dpdk.org, Kiran Kumar Date: Wed, 11 Jul 2018 14:11:59 +0530 Message-Id: <1531298519-8033-1-git-send-email-kkokkilagadda@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531236367-27067-1-git-send-email-kkokkilagadda@caviumnetworks.com> References: <1531236367-27067-1-git-send-email-kkokkilagadda@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR0101CA0046.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::32) To SN6PR07MB4959.namprd07.prod.outlook.com (2603:10b6:805:ac::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b66ac96-b9b7-4817-c548-08d5e70a3db6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4959; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4959; 3:neY5xqA0sS3vU0AVcUzhcGmc1mhANeXL/v17NTu09Ka/W/wSrKeWnh2GNCXDJVjM623yJbJKRZ4KchO/mMFVWKt2e25t9s/c6OxZ2SmeluW+1eUynVCiRrKn8mTW7y77sGijGhaCWFbmqABuAqESVch8zU7GsmrtW8icHuRgz/Uo5ir5CEe9YSsosD4ecgNxE926tdPGXf5ocPFN9p6q+iP5fLa1l/Kc69GTSg2sMG7owGiSh2+3JB7zEdtkYQtl; 25:IJw8HSvQ+MWpGZcfKGvhMlxSaRxMGmoZmX9k1rPs2UF95JQu9yEv/Dl692yQpMyR8cBfgQcudZ3JRn4Bihz+PxiNmDi8AIRqLeXI0eE8Wae6UZ9HXtyrNDTzUS8QLNzf+hivTPdQ8aHjXMmQq8NxUeqET18+QHQ+SQqdadUm1ToGzUN4oDq5Ddx78GhATMBaHXGFB61Z9Rvtw7WXQ0TSYKKpEsLkWrQ0o5R8NUuz4118Z28nQNX+kfih+tnuiuHg9H3h0a3W1rpwZqXOZz9hDGWLu/XZzqtbZw+q/jFdVyjSIUnEsfj4G3Bd9gBhQ+/sctWToSd4QJbsfvgycTQObg==; 31:GOdeZcnczQ1fod7yrmOSSORjPRYBK5DMqrnSoxRD9a06aSx9IQ5HqeUY7LzeW7qVBMihWqcoHlmKqI0Pku2AVsKaHzs/hewjlEuxYT8v1KNIe5wZ5kJwQMGtWW1eitzKseSNO0ds8XAJ1q4fl9JPVswGM7zl/oEuvp5B0nd/2LX0MfA4c+RT4OIxq6JBXJf/BJBXshn0XOS0p8uVt4KWUn+ILZ7A8mrJ8lTgogxNhEI= X-MS-TrafficTypeDiagnostic: SN6PR07MB4959: X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4959; 20:hgXjs5giEqKZ/JbyRxbfKooxMqmFx9nz/eq9v83TLx5sKQUuozYciaksxhqmxtr63b7Jbfwn67W4pxfbGpnVCZdS+iO9WxhKgOm4ziTqyW4SA8J/AoHI4q+dS9yq+Qc9wXO6pYLV97/nYdlDKlAaCKLzV5VCCB3/oT/rvYG9BuGooW+laaX61oo5oWd2ve+EF68rSKIYKCDVM1NwiGj/YgiQlQPKrVrxDSmlTdlObSfZuhT7jjYRmk1Hc5T8P5rkv435HIA5Dc3xxUpexcjZn8CRZ1DHOXes9Tok+6Ib0OgSJ3JTUziLkhL+DH5dM45td2hclCCSqJ6SOb1+5cFLhSd5OUEPcv5bNW3EL3Io4d4WPtetAld1McFbUGBRRR1WsQmolC5bPCVm1gZYxOyGs4ZMKOIN3ZHKbincD7C9uuCKoDErJ5CSk0XR/x0xKzCJWErAUU9NWf8jFHDKC1hqfhKiGfooumIoNsBnTFDHNPWtiUS6OSOiFrT8svlle4cNU9LpQbVejcrgwTI4j3E3R9CW9r8LQadv35Qumm3k9ybONLluRRT3Z+Jj2JgpgwqKU2NUDgeWXyK1Njqwe5LrkIUdUR8F4eX8bY1vC/qts5o=; 4:CL+jd661OMSced2GSaML6hbLyN93jWeyidnYNcWUKoDwhlo6JFGTUv824FolmiM5O2G2RE0juKorIMTIiiqbFlbbJup6/4CU4An0owziQGNGbcuTr1Wdt5dd6C/XeYbiio8srYojtFCLPkj9azNUpe+Zfi15yWZEKE+7/L54fJDltV75QFOL3CexvT2SNmzTg8d0a7l32pNTF1C3OpHVt8q2tp5AXRS7KCqQOGFrAYW7i0/9Pil2X6ss7mXrYQj3gQbpNjoOKZZi1iTM7WTUmA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(3231311)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:SN6PR07MB4959; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4959; X-Forefront-PRVS: 0730093765 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(136003)(376002)(396003)(189003)(199004)(4326008)(66066001)(3846002)(186003)(16526019)(53416004)(47776003)(25786009)(5660300001)(105586002)(106356001)(76176011)(52116002)(51416003)(6116002)(6512007)(386003)(6506007)(97736004)(26005)(6666003)(1857600001)(6486002)(2906002)(446003)(305945005)(2616005)(956004)(486006)(7736002)(11346002)(48376002)(50466002)(81156014)(81166006)(16586007)(42882007)(69596002)(8936002)(5009440100003)(107886003)(50226002)(8676002)(316002)(53936002)(36756003)(72206003)(478600001)(476003)(68736007)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4959; H:kkokkilagadda.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB4959; 23:rI8hDC/4XiqV/RqmDup0uY4yMOpdcgO3MXtqPf884?= =?us-ascii?Q?dZIH09ms6+UrnzKArwXguTO/etXwpt4tGo9fvP0crSyNrFQIv16Ji2+s4yKJ?= =?us-ascii?Q?Yg3+VW1bFbaOJQS2EQ9HSupW8PTnbaeOTWu8Heq42OTQ/otswi7WsXVnxRK4?= =?us-ascii?Q?wvGdskWiiIs1KHY/hQC2l8XqxITWY2GMvMt7v0k5gaeez5WS9N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t+gSf6yCAcvWmS9FRNZExpCJ73pumWNiMou1v32K654SzDDQeBZGHzEdRK8JfyuaDIRq93eiyK0xhYTIRVyO9BYMKGVzehxgALT12T/Z8gRGAmbEpAEAjb0BccAY9IJcQ==; 5:PT9YfIa5pS3hutc3j5Qsh/yHJR4MyTjbOH4AYqw4ueTSETuYfGJiZ8isJUakIuNTETVSvEm51bA4uclzVGXsgqNxopLGuRPBnHJbJpnNZ3AxZlkqL2YXTqxhdTzHKHhsvFtcuoBug5MncFBCG5pBXGFDktpzUzknEnkLyqmdKmE=; 24:n06f61v3AZ7vVk9L+TZOj1fQ9nfvu8e7OMOd6455W4TGitnzl1DTothwJiL579GOFOy+PapDJp8p/XWbeezeUZdddYIa4tDjrBjktmKCXyI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4959; 7:Q1nybSQ0b1MKaH/M0VR8DTl0GSMrjokALtZdekjH+2sT70nlK3z+9C/sPDYG9WX5RsDpKODsZxnfk4+RxsV9y/dve2flnwWikkm8Shy5ABhgbTHoLTyDNaoPSmjCzyawB2ljmAAywvZM2T5qoKMmD7thJDmlgc9Sp2e+8oSvEutu201NbX1kGPVsUpH93xYfu1I9E9AdrTs902NgHkW3MfMpJThYJPzdkOZNBNfYsace1pyoedneiTXipkmTjrgg X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2018 08:42:29.6178 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b66ac96-b9b7-4817-c548-08d5e70a3db6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4959 Subject: [dpdk-dev] [PATCH v2] ethdev: check queue stats mapping input arguments 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: Wed, 11 Jul 2018 08:42:34 -0000 With current implementation, we are not checking for queue_id range and stat_idx range in stats mapping function. This patch will add check for queue_id and stat_idx range. Fixes: 5de201df892 ("ethdev: add stats per queue") Signed-off-by: Kiran Kumar Acked-by: Andrew Rybchenko --- v2 changes: - changed summery lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index a9977df..0849016 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2457,6 +2457,16 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx, dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP); + + if (is_rx && (queue_id >= dev->data->nb_rx_queues)) + return -EINVAL; + + if (!is_rx && (queue_id >= dev->data->nb_tx_queues)) + return -EINVAL; + + if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS) + return -EINVAL; + return (*dev->dev_ops->queue_stats_mapping_set) (dev, queue_id, stat_idx, is_rx); } -- 2.7.4