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 D8B8EA0093; Fri, 23 Dec 2022 17:43:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7FD5841156; Fri, 23 Dec 2022 17:43:21 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id F3CB6410F9 for ; Fri, 23 Dec 2022 17:43:20 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id n4so5429256plp.1 for ; Fri, 23 Dec 2022 08:43:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; 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=hDnzGUm4n4qaWQPYkPtuFJVEtHjev6K73Kq7zN45Cek=; b=Y/iBx5UTkro/lqwtCCWhRqN1RYEddiLP/fKkRj0tsetggaBRlWaycu+5a5ZD1z78o3 9Y7YrFufBDEG5yTuudFQSffnfhF135/S5GtI9JEPOGvZgcCz91XxwJXYrP/tO5ILT7h6 msD7PueqB/6k2SZI+t1h+PeWE6j+dfCb8209erq8NEfXyek2xqeBoUO2B+tZeqNDLQgj +x/F9mtetquCqxFyxoMLVbsoysosX1ppFgCXN8EoqF1ghpNrFgF3PJZ8SL4KocqfgjYJ wA0lS10jo7NH5GdU62FYVWfY4bOAb7h+QnYG99JNeMI7lQeNBSmgOpFxr1gtKaaFhWWA M3oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=hDnzGUm4n4qaWQPYkPtuFJVEtHjev6K73Kq7zN45Cek=; b=VY4OML40KttJh27RIxZGmZGeJcu2fs26Pp3EqEKZLaKJE0WsQ6oCo+9NTp8Sv54/O2 SkLbrinNqp22Kc1vzoD16VqARzagCWD8/ZRlZ0Mr/uVBHswRRW6CrumszXM2ffjWMOB7 /cJ4XUai5AAyi0tyUX0lh4RRMMo02Q3VKb5mfYwi/MOkZVAjPWng+30YgUYaf7+pgIUt hvBFkN4vCNkY99TfFjWcU2JB7IQAbRhfmIqUgoyuR5UxLMtZStYGh7cw4iFJ8Bf3If3e ZOYp5Sj3nOzlk6aH4hEN6Ux8m6XmRYPGgw/ICxEvBzrHl9x5q18p28agOtaWdrezx0Xs wksA== X-Gm-Message-State: AFqh2kref3YlfETN7zkkVtDvLaJwI+WyxPPN7YaahOCxCHWtAG12JIdv eW+A2NSBKQ9so9gToAbzMNkRpjLGUejvohdq61U= X-Google-Smtp-Source: AMrXdXsCWDVQVjkJHx+7Cp+AELB+EKJmLVmZwo58LJzDCSC+cHxVowkbwBJcwDnw1mPGWv1Ft+2N+A== X-Received: by 2002:a17:90a:4308:b0:219:6626:3b63 with SMTP id q8-20020a17090a430800b0021966263b63mr11789433pjg.25.1671813800085; Fri, 23 Dec 2022 08:43:20 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id np15-20020a17090b4c4f00b00212c27abcaesm4960733pjb.17.2022.12.23.08.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Dec 2022 08:43:19 -0800 (PST) Date: Fri, 23 Dec 2022 08:43:17 -0800 From: Stephen Hemminger To: NAGENDRA BALAGANI Cc: "dev@dpdk.org" , Kapil Kumar Jain Subject: Re: Strange behavior with rte_pktmbuf_clone cal Message-ID: <20221223084317.580f966e@hermes.local> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Fri, 23 Dec 2022 07:00:40 +0000 NAGENDRA BALAGANI wrote: > Hi, > > I am seeing strange behavior where rte_pktmbuf_clone is not giving desired result. > Here is the detailed info, in my dpdk application , once I received the packet info in mbuf, I need to send the same packet to two destinations, the sequence I should follow is, > > (i) First, Tunnel the packet to one of desired destination, so I created the shallow copy using rte_pktmbuf_clone, had another mbuf for Outer IP Header for IPinIP tunnel and sent to NIC. > > (ii) Second, I need to modify the source and destination ip addresses of the packet and send out. As you showed, that won't work like you think. A shallow clone means that both versions share the same data area. If you modify one one instance both change. The best practice is to consider a clone (or any mbuf with refcount > 1) as read only.