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 C1AEA43F81; Thu, 16 May 2024 17:44:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11C1840695; Thu, 16 May 2024 17:43:49 +0200 (CEST) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mails.dpdk.org (Postfix) with ESMTP id 00941402ED for ; Thu, 16 May 2024 17:43:44 +0200 (CEST) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6f44881ad9eso341191b3a.3 for ; Thu, 16 May 2024 08:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1715874224; x=1716479024; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=48/wBIK0Rg56e+UC+zjHPq/BPpLP+2PzmpWMiPh48wQ=; b=awbkXBAM7XUNSEkrpVb364b4bxUecHzASB/nCmieEO7UgytrX65w5+sOvU2nztMQXu DFeDa8GswyvpEV6OQUn3tsTxse3blhO7zDDh5y4L31VJhX+F5vLOOdx0Fu5cm1yhaDxW YFOJWDzc1PbpGpWo63QGiwsW4hxkHwQXgMmk8nEP4GhTUg+OZtf6i1H9iPDAKOSBtKtZ 17oSR4wmYR+Nw8uzABJ7DlmtFN73ft8tKRd3vA9BFNjRMlgzF7TdoSUtEe/1NRskyGEv b37Wg+8yAet5v7B8k9T26PmTYwB1cmmA8cZBWXHPVA7srNscdhvSHFquc6Qnsg6+KVyw hZcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715874224; x=1716479024; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=48/wBIK0Rg56e+UC+zjHPq/BPpLP+2PzmpWMiPh48wQ=; b=TwrHb9IYItdVpjEDlQKH6KEaBFYKMqo8o9k89Twlszg5eTfK8IHvlu7WCnWT4GRKjL d5HCx9/U11jzs1YE3vPPbRNo6DKl2RiEdRqB8LbrZYQlMGM1MAUqJhUbfZFvTah42elo gI/lz9O1N+KxagWKMdvq5okLYLig1/Ql22+dZ8m0M5whW9+FlFQJDz/bn6cM+BZ4f+xP r8UC5jiamjgR7H4TTDDQVTrTbzOKIdIMvUO1GsNVUj85rGFExF6frxjXli7gYUbWpIDx zL/w82Of5ueOtS15Eupxr0h47z98MBWQoNviZxpm3016Yht4IQB1w2a77i8g1yQGe+Y+ YAtA== X-Gm-Message-State: AOJu0YwjJOHH9XrjtJhTxSTT61rgUtFBRVm+YjTaHgOokoqUXTcRTArr PArr++q0WS3+YrI49yIX49Uv8lgsoqxjURG4+QWHxzNf15oWOTNXOBNvKZOc8qwZNSaUld+Nx0G qYUQ= X-Google-Smtp-Source: AGHT+IGg0p2oOFcFGvx3WqsINQJ36vZ5559kPnN9pTk7+sK7D1kRewldyihwRjrU2qUac86Tpp+GTg== X-Received: by 2002:a05:6a20:a11e:b0:1a7:5fe0:1c99 with SMTP id adf61e73a8af0-1afde1b27c0mr19967756637.46.1715874223984; Thu, 16 May 2024 08:43:43 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f67b526b44sm2457430b3a.149.2024.05.16.08.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 08:43:43 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Subject: [PATCH v5 6/9] test/pmd_ring: initialize mbufs Date: Thu, 16 May 2024 08:40:42 -0700 Message-ID: <20240516154327.64104-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240516154327.64104-1-stephen@networkplumber.org> References: <20240510050507.14381-1-stephen@networkplumber.org> <20240516154327.64104-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Do not pass uninitialized mbuf into the ring PMD. The mbuf should be initialized first so that length is zero. Signed-off-by: Stephen Hemminger --- app/test/test_pmd_ring.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c index e83b9dd6b8..9cd5ae46db 100644 --- a/app/test/test_pmd_ring.c +++ b/app/test/test_pmd_ring.c @@ -68,14 +68,16 @@ test_ethdev_configure_port(int port) static int test_send_basic_packets(void) { - struct rte_mbuf bufs[RING_SIZE]; - struct rte_mbuf *pbufs[RING_SIZE]; + struct rte_mbuf bufs[RING_SIZE]; + struct rte_mbuf *pbufs[RING_SIZE] = { }; int i; printf("Testing send and receive RING_SIZE/2 packets (tx_porta -> rx_portb)\n"); - for (i = 0; i < RING_SIZE/2; i++) + for (i = 0; i < RING_SIZE / 2; i++) { + rte_pktmbuf_reset(&bufs[i]); pbufs[i] = &bufs[i]; + } if (rte_eth_tx_burst(tx_porta, 0, pbufs, RING_SIZE/2) < RING_SIZE/2) { printf("Failed to transmit packet burst port %d\n", tx_porta); @@ -99,14 +101,16 @@ test_send_basic_packets(void) static int test_send_basic_packets_port(int port) { - struct rte_mbuf bufs[RING_SIZE]; - struct rte_mbuf *pbufs[RING_SIZE]; + struct rte_mbuf bufs[RING_SIZE]; + struct rte_mbuf *pbufs[RING_SIZE] = { }; int i; printf("Testing send and receive RING_SIZE/2 packets (cmdl_port0 -> cmdl_port0)\n"); - for (i = 0; i < RING_SIZE/2; i++) + for (i = 0; i < RING_SIZE / 2; i++) { + rte_pktmbuf_reset(&bufs[i]); pbufs[i] = &bufs[i]; + } if (rte_eth_tx_burst(port, 0, pbufs, RING_SIZE/2) < RING_SIZE/2) { printf("Failed to transmit packet burst port %d\n", port); @@ -134,10 +138,11 @@ test_get_stats(int port) struct rte_eth_stats stats; struct rte_mbuf buf, *pbuf = &buf; + rte_pktmbuf_reset(&buf); + printf("Testing ring PMD stats_get port %d\n", port); /* check stats of RXTX port, should all be zero */ - rte_eth_stats_get(port, &stats); if (stats.ipackets != 0 || stats.opackets != 0 || stats.ibytes != 0 || stats.obytes != 0 || @@ -173,6 +178,8 @@ test_stats_reset(int port) struct rte_eth_stats stats; struct rte_mbuf buf, *pbuf = &buf; + rte_pktmbuf_reset(&buf); + printf("Testing ring PMD stats_reset port %d\n", port); rte_eth_stats_reset(port); @@ -228,6 +235,7 @@ test_pmd_ring_pair_create_attach(void) int ret; memset(&null_conf, 0, sizeof(struct rte_eth_conf)); + rte_pktmbuf_reset(&buf); if ((rte_eth_dev_configure(rxtx_portd, 1, 1, &null_conf) < 0) || (rte_eth_dev_configure(rxtx_porte, 1, 1, -- 2.43.0