From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by dpdk.org (Postfix) with ESMTP id 2F7A05A8B for ; Thu, 28 May 2015 16:52:41 +0200 (CEST) Received: by pdea3 with SMTP id a3so43371828pde.2 for ; Thu, 28 May 2015 07:52:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=ziQQOZ6VOPRzUSstdde+1J+f6omKIHD/pgJMWduaxXg=; b=OnQ2hVR7ZRKztTw+ksbr/zW3zH+Qaqg5xDSR48pfXm1BS6Dxh0WPbWJPojpRsWh7kh G4cKrFn7TQDph7bebpVuKIraCk7zMK4+710fcrkLrAptsXd1pbdSDxnKxQkn3q//gMXc Q3tbDjhjYT5sXiiA9aoXcdGI2Yxajeezl1T63otCLxKXXG/+C2UqSHG70poRK3IYLUJa cJbNATt9sDOLbWRH8hwucd3WAASKD48oCdL+DpOVeIzyWlbCLsTo096xD96DFbeABAyh 1OxEiTh4U2NYz+I9cUxUu2H8bs2Arg2VL0YGi3l2dwaniYkwYq6G5Vh5SJWc7wJTgHSS QZ6A== X-Gm-Message-State: ALoCoQmthjm/Aud9N4k2NyY8TS3PqXhafhs3fUi8+pebMS4GVf74+fCPV4SvQmU5uHOyP+zJdOgU X-Received: by 10.66.165.67 with SMTP id yw3mr6152826pab.95.1432824760492; Thu, 28 May 2015 07:52:40 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id zf1sm2653251pbc.43.2015.05.28.07.52.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 07:52:40 -0700 (PDT) Date: Thu, 28 May 2015 07:52:44 -0700 From: Stephen Hemminger To: Padam Jeet Singh Message-ID: <20150528075244.469b8557@urahara> In-Reply-To: <57F6A61F-5629-4D11-A78C-397DBB4E8381@inventum.net> References: <57F6A61F-5629-4D11-A78C-397DBB4E8381@inventum.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] Packet Cloning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2015 14:52:41 -0000 On Thu, 28 May 2015 17:15:42 +0530 Padam Jeet Singh wrote: > Hello, > > Is there a function in DPDK to completely clone a pkt_mbuf including the segments? > > I am trying to build a packet mirroring application which sends packet out through two separate interfaces, but the packet payload needs to be altered before send. > > Thanks, > Padam > > Isn't this what you want? /** * Creates a "clone" of the given packet mbuf. * * Walks through all segments of the given packet mbuf, and for each of them: * - Creates a new packet mbuf from the given pool. * - Attaches newly created mbuf to the segment. * Then updates pkt_len and nb_segs of the "clone" packet mbuf to match values * from the original packet mbuf. * * @param md * The packet mbuf to be cloned. * @param mp * The mempool from which the "clone" mbufs are allocated. * @return * - The pointer to the new "clone" mbuf on success. * - NULL if allocation fails. */ static inline struct rte_mbuf *rte_pktmbuf_clone(struct rte_mbuf *md, struct rte_mempool *mp)