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 F33DD457A1 for ; Mon, 12 Aug 2024 16:52:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2103402BB; Mon, 12 Aug 2024 16:52:20 +0200 (CEST) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mails.dpdk.org (Postfix) with ESMTP id 4F8434014F for ; Mon, 12 Aug 2024 16:52:19 +0200 (CEST) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1fc56fd4de1so29143385ad.0 for ; Mon, 12 Aug 2024 07:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1723474338; x=1724079138; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=1jAIkq/hvrizeZ2WhIARWI2k5QCt8/TKUaF7czwnyfo=; b=Q/jEBz1gILkDEdm2fgFLU/gOuJevXWl7C41ufYaQ4WGeGWbIlImUlF5qH2x7o8mMUP wjA0NqBOSNkNj+UDpkecNs/MKFC9uef9xL3JV0bB2zCf7ondy1ATzOpqiPhrmqUSvhHC HUx6i6vLRzsdEEFodnOl+o3QEn3LavzonN2woztgg58Hgth+QhssiloHt4q3XaySS7tg WrMIPY1wamrRguVqK1NXzV06yEAJkuCF0hbOfAnAHtpXCxnBfa7vEnykTPcsnR9HmZnP TtTCqgh9K8Yo+UXaKmn9WIy41yvOorEMLSILOMlDKO2XkK8/0IJsob8JlQM+T8DBGUnl b94g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723474338; x=1724079138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1jAIkq/hvrizeZ2WhIARWI2k5QCt8/TKUaF7czwnyfo=; b=mHa0o/b8Nk+RYRH7K35/+2jVdI1t/V0TZ6XT8Yh4Fm0sTYUEL69yYTyKuiUq2KFUcH KBjGuxN9yWLLd+Rd/npqLfmAigs0kctrZ/KR4J7KSMxl9kwSiKYnv6f3g2kNoKLExZ55 NBKgTcmaZQwpdRs9tzovYz3ha07qbA8PrMUQZ0I0DtMI6YyMWy/67pyx20s5IkhKj1YY vlhZ32rNVt71IA6z8c2U16EsCqvmKo4V6Emiky08dfs+2Q5mduWDzdZqZD1cSkpQREIq g26/eLGhNCcEowMnDiKxiWU5CZhs9oepoEE7cERCm0E8k/v7S0GH615BfQbLhcrLMLrx 53HA== X-Gm-Message-State: AOJu0YwjNLY+bT8qxxTvaVYtu6JLOL96RsEBsBqpcOUHCkwS4em5iSeC ioKICq0zc6cn6am4Gc3VNbHw1SbRPoCKTwb4gIzn/ECh0iEE9SfcWCcgxRcGMKY= X-Google-Smtp-Source: AGHT+IGFM0CmTlrGd1gt24iBVKEpnineyFOg1gtkdwv+bXP0SUodO+NHhOik2Q/sBp16AP9uOtbaGg== X-Received: by 2002:a17:902:f549:b0:1fa:2b11:657d with SMTP id d9443c01a7336-201ca92d67bmr5942365ad.10.1723474338227; Mon, 12 Aug 2024 07:52:18 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-200bbb402dbsm38755425ad.295.2024.08.12.07.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 07:52:18 -0700 (PDT) Date: Mon, 12 Aug 2024 07:52:16 -0700 From: Stephen Hemminger To: Lokesh Chakka Cc: users Subject: Re: reuse the packets after tx burst Message-ID: <20240812075216.534be9db@hermes.local> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org On Mon, 12 Aug 2024 15:55:50 +0530 Lokesh Chakka wrote: > hello, > > Here is a small piece of code : > > while( condition ) > { > > if( rte_eth_tx_burst( port_id, 0, mbuf, num_of_pkts_per_queue ) != > num_of_pkts_per_queue ) > { > fprintf( stderr, "%d %s\n", rte_errno, rte_strerror(rte_errno) ); > rte_exit( EXIT_FAILURE, "%s %d rte_eth_tx_burst port id: %u\n", > __func__, __LINE__, port_id );//second iteration failing. > } > fprintf( stderr, "%s %d port: %u packet: %c sent %u packets\n", > __func__, __LINE__, port_id, argv[3][0], num_of_pkts_per_queue > );//printing once > for( pkt_count=0; pkt_count {//want to send same data again...!!! > mbuf[pkt_count]->pkt_len = mbuf[pkt_count]->data_len = dev_info.max_mtu; > > } > > } > > Can someone help me understand how to reuse the packets again to send the > same data ? > When packet is passed to tx_burst, the ownership of that mbuf is passed to the driver. The driver will free it after it is sent. One option would be to increase the reference count on the packet before sending. Using rte_mbuf_refcnt_update() function to add one to refcount. Then the driver will decrement refcount and the refcount will still be one (not freed). Assume this is some kind of packet generator.