From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2EA34A0093; Fri, 22 Apr 2022 06:57:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E63F1410EF; Fri, 22 Apr 2022 06:57:51 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2052.outbound.protection.outlook.com [40.107.104.52]) by mails.dpdk.org (Postfix) with ESMTP id 1835B40042 for ; Fri, 22 Apr 2022 06:57:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=biXaEWsGV322Kr6MP8+GpJsdchWYvsQ9jVB7rfnCrmuMRUqQeuGegWMJPxh6gK6Nj9SAykJtIShjX7MKYDgiavjMO1MS9YFNjAIEyUxbiOoTyf197QzXhvZQzl0BD0nFvIX6fdhthm6B/5NdRgjH93IoSzPKK3afdNNoAdW2AEwGIJWKIHBLwSlYhGyMpcxxTRVuvjdonMAYEuDZXCB+0q+SJc/q2KuLvlRlQsVwxq5UJehklgpeHXRlgb6DgQg4q6WrgG6A0zIkVCISvbLOuK51QSYyRMUm9fu8UHDy2Ftjq2kJzHqztpr65HzSd2lFIAh5+rIEJTzbEr7T27ViXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WpiZqQFuHM1O2jox6Qrscy3oJgnXwK6x5DDJIXUTU+A=; b=LeTM7FcQSR5egaVEVxUMIt30YXXc6zppVskhklROrHJt0OMHd/z+EwmUVpbr2S3+QHvGe4W7vEE5NzNJYwD35nabDlzDsky0k54KbIuJamZzgEbitzQxbtP6FUz2yenCWY+oAcPfQvoDpg+Lslv37o8Hq+tPMrPEbVprbaqGftlLTj/4MJlCIGpsmxe3wTioKvl+hUwkzAAsDZ4+cmlx2YFSpR7H7tyXC5S/d3f1crgjri50mZS1W/sXR5tpoWXYPAu2m9il9TlEkgsI6nF4MFMoGmCW5199UJuOwuA8Qivu7GrJzBJKFtFJFW6y1LfRwiqj7IZuOLRZvvRsSUqHwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WpiZqQFuHM1O2jox6Qrscy3oJgnXwK6x5DDJIXUTU+A=; b=N6GeVqiXJCojp49PWwhIYI0n7783aI+UzoQxQ2ocEAIyJSGVQliex4lxMu1QYCtcq5bCh3ToIKlaE7HAmdYxQt+cCjUHQ3SHfl3+TGf+LtZeQtaiQWToSD/0BhyhExCJnMY1kiOpJzOHf2Tbvp0E3rqrD1B5Juj8kLGECX9mXOg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by HE1PR04MB3049.eurprd04.prod.outlook.com (2603:10a6:7:18::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Fri, 22 Apr 2022 04:57:47 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2%7]) with mapi id 15.20.5186.015; Fri, 22 Apr 2022 04:57:47 +0000 From: Gagandeep Singh To: dev@dpdk.org Cc: Gagandeep Singh Subject: [PATCH 2/4] net/dpaa2: support mempool debug Date: Fri, 22 Apr 2022 10:27:27 +0530 Message-Id: <20220422045729.3320637-2-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422045729.3320637-1-g.singh@nxp.com> References: <20220422045729.3320637-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2P153CA0016.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::17) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1296cfa-41ca-4106-749d-08da241ca50b X-MS-TrafficTypeDiagnostic: HE1PR04MB3049:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V39QSGwUkZBoK4F3WvxTWoKfrr9BCjPQGuu4WrWpAiykhEHANqfr6CzqbH3w8pDoAoxVv5GrutxD7EGIqTnQ+VH9j/g+DbO5w92ohPN8vRfxQ23tIkJDwrHO9ATOplg1ppH5QdqU0TY/HeJiqFnvDn24Eol15hN+PX0r0vTxLIiKdzSN+ChcjQhpNox/eCWILGmncNZf6VDcZrUUYt2HYjWjH2U6UIjt53w7CTaW0gwyr2zi6xdzxlbxr1Lqr0mJ83O+X5rBEDqPfSEr14itLIRsFtND+cM8XArmYmW6ZRCxUugCLmT5zVGmhteRsq76vs+CHa1YZYP5v+SIPmIqASdXUd1Sg7mzXwxK1pabkN4cG0GvVKwmnZnC941F8g1clAmEohkkb3AU9IKUD8/NvCM/mlXWrYhCEDMSzBcF9xNhpoPb9GPCu7doDl3raS3bofvPyQoq5v/bYJMuVH2tPrj85mhKMZXDP4+arS6gL542Nff/plJgLvXoButHbW3TaiH3g/SKGKWgCyxfIizUjilP/WkHKXv3LMGrc4Po5TZC0KUPifbxbYGk8qSBTbtth4tCsE+iVlRVEKZi2rYxfxdNlBgpIGDEjTyeaVUMfr89X8EgASQaBVzj8nDyRW3CoVUZI1l3Z91qNItiepbtQhUkyHDBR7O3XVObNJJUKH3IRp2jCK4L818I7b+7fcXVSnlh1M8JhbHk99C64P8Lbw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(1076003)(26005)(6512007)(186003)(6506007)(2616005)(55236004)(36756003)(508600001)(6486002)(5660300002)(8936002)(86362001)(8676002)(4326008)(2906002)(316002)(66946007)(66476007)(66556008)(52116002)(6666004)(83380400001)(38350700002)(38100700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WyutvKvCQQGUKbpsvpTbxH4Uhj39dXl2rNIp8BJh7tvwXdtIBXoGYOe3kGey?= =?us-ascii?Q?k6q1XCHtmRxO5CSwXcdxX/S37EqQJ6T0u6TUzETOwwH7YRLMq79Jvj+wBYBJ?= =?us-ascii?Q?xvSGETL1b0JMj8XKIeXNFO/4tWCpLTJ7vE+koykBvc1wHk7TRVgiBYaznKRA?= =?us-ascii?Q?H4xSafCilnUXuQzpclVrgN3xlPsy2ORYthGWrUAYSECWWq0pgzWhT7HisPuv?= =?us-ascii?Q?lyeT5hxLHTG+LBiez5vAdzTVZ3cBcv4gVs3ibisWiy1XmSfbbUmG12Dh/qhl?= =?us-ascii?Q?ylohGsJDSn5b4vGfGUQOebbRoSVHoHKR3WcrCiPB810O367o2O6bbtAAuyU8?= =?us-ascii?Q?ujVenvjelTXVKKPQ5bpmD+l6H0Z2gnQufGBpUUkxMeVSKyF6hn28eOVyOwpl?= =?us-ascii?Q?qPtAS/tE++n2Rte5aQmBChmbkQ+Q6zegsmzfyvujFI0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7/n4pAjIoQx1I0TZ4M6vds7bl/rhULxfoX?= =?us-ascii?Q?CPoUrjBjDDBUXncNPXPuFUZ/0g92uC2+AhVkpWrtuCPclfskksrWCOpELN6l?= =?us-ascii?Q?Sa7Eo7rXhySkxV152qXNfrGIINa5WEvIu3EqJMBG5V5JLNBQbaX9qr7iE56/?= =?us-ascii?Q?Jn2RRyBJY8ehtVkfjeLJSlzIGDnEjWLyLqyZvgqeuNfETCaGUiIyJCImMA9/?= =?us-ascii?Q?yV4NuoRUPnqY+lIFwvYTUo+xsNTsgjw0D6k8sz6S3rQjFKYV9fOB/zbwbSAm?= =?us-ascii?Q?lXXHe2SVK1+kGfTNtita6DgTAV0/Dw7/NImu62wF+CBaQaqFg33jJ1m2ahHD?= =?us-ascii?Q?Q+joeZ/Ha7RV6ekr75kMu+vjPe3yOvTWw3j/Zk4rY8px6OiF0bXVYtZg24+7?= =?us-ascii?Q?SJP1pLbTJw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1296cfa-41ca-4106-749d-08da241ca50b X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2022 04:57:47.6146 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HWXfAlTCF9KqAwz4th8UZkm84xep2B/nm7/VxRC8XvLZaUkSaDkC7jgHMllu7vgZ X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB3049 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch supports mempool debug to detect buffer overflows. Signed-off-by: Gagandeep Singh --- drivers/net/dpaa2/dpaa2_rxtx.c | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index b8844fbdf1..d536352895 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -312,6 +312,10 @@ eth_sg_fd_to_mbuf(const struct qbman_fd *fd, dpaa2_dev_rx_parse(first_seg, hw_annot_addr); rte_mbuf_refcnt_set(first_seg, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)first_seg), + (void **)&first_seg, 1, 1); +#endif cur_seg = first_seg; while (!DPAA2_SG_IS_FINAL(sge)) { sge = &sgt[i++]; @@ -324,6 +328,10 @@ eth_sg_fd_to_mbuf(const struct qbman_fd *fd, next_seg->data_len = sge->length & 0x1FFFF; first_seg->nb_segs += 1; rte_mbuf_refcnt_set(next_seg, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)next_seg), + (void **)&next_seg, 1, 1); +#endif cur_seg->next = next_seg; next_seg->next = NULL; cur_seg = next_seg; @@ -331,6 +339,10 @@ eth_sg_fd_to_mbuf(const struct qbman_fd *fd, temp = DPAA2_INLINE_MBUF_FROM_BUF(fd_addr, rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size); rte_mbuf_refcnt_set(temp, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)temp), + (void **)&temp, 1, 1); +#endif rte_pktmbuf_free_seg(temp); return (void *)first_seg; @@ -356,6 +368,10 @@ eth_fd_to_mbuf(const struct qbman_fd *fd, mbuf->port = port_id; mbuf->next = NULL; rte_mbuf_refcnt_set(mbuf, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)mbuf), + (void **)&mbuf, 1, 1); +#endif /* Parse the packet */ /* parse results for LX2 are there in FRC field of FD. @@ -404,6 +420,10 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, rte_mbuf_refcnt_update(temp, -1); } else { DPAA2_SET_ONLY_FD_BPID(fd, bpid); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)temp), + (void **)&temp, 1, 0); +#endif } DPAA2_SET_FD_OFFSET(fd, offset); } else { @@ -414,6 +434,10 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, } DPAA2_SET_ONLY_FD_BPID(fd, bpid); DPAA2_SET_FD_OFFSET(fd, temp->data_off); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)temp), + (void **)&temp, 1, 0); +#endif } DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(temp)); DPAA2_SET_FD_LEN(fd, mbuf->pkt_len); @@ -450,6 +474,10 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, } else { DPAA2_SET_FLE_BPID(sge, mempool_to_bpid(cur_seg->pool)); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)cur_seg), + (void **)&cur_seg, 1, 0); +#endif } } cur_seg = cur_seg->next; @@ -500,6 +528,11 @@ eth_mbuf_to_fd(struct rte_mbuf *mbuf, DPAA2_SET_FD_IVP(fd); rte_mbuf_refcnt_update(mbuf, -1); } +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + else + rte_mempool_check_cookies(rte_mempool_from_obj((void *)mbuf), + (void **)&mbuf, 1, 0); +#endif } else if (RTE_MBUF_HAS_EXTBUF(mbuf)) { DPAA2_SET_FD_IVP(fd); } else { @@ -539,6 +572,10 @@ eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf, DPAA2_MBUF_TO_CONTIG_FD(m, fd, bpid); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)m), + (void **)&m, 1, 0); +#endif DPAA2_PMD_DP_DEBUG( "mbuf: %p, BMAN buf addr: %p, fdaddr: %" PRIx64 ", bpid: %d," " meta: %d, off: %d, len: %d\n", @@ -1260,6 +1297,11 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } DPAA2_MBUF_TO_CONTIG_FD((*bufs), &fd_arr[loop], mempool_to_bpid(mp)); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies + (rte_mempool_from_obj((void *)*bufs), + (void **)bufs, 1, 0); +#endif bufs++; #ifdef RTE_LIBRTE_IEEE1588 enable_tx_tstamp(&fd_arr[loop]); -- 2.25.1