From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-la0-x22f.google.com (mail-la0-x22f.google.com [IPv6:2a00:1450:4010:c03::22f]) by dpdk.org (Postfix) with ESMTP id 6C9975907 for ; Thu, 13 Mar 2014 13:50:19 +0100 (CET) Received: by mail-la0-f47.google.com with SMTP id y1so641021lam.6 for ; Thu, 13 Mar 2014 05:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=O7FItuaXhCVxMwKclPVeKjL2DAMjjKjpihknNK2efLo=; b=bOQ2OfMbW2W4yup8LRV5ORPN00KkM9p/XVE4V+ErJKXfzenmW47CdmnrpACcj6sN03 xHSBH1+setyQZnnQqaKsqkW/+HuM/Chyq3jsMV8Z4L4fp/P6zIR2jOyxbrV+mqJMiaRu gmfFV75iuGedRD6aOqas+WLnvz5WzpL8q5nC0DE0sQPjPxXJ7Op476uTlQpXQUJzTxEM z9XHife2WbQXNXHJ1lt2CZuHOWoKFkyGYNFAnPSec47DPhW8C7DdMqP986xdA3dgQSgQ Xb051LN+JvqjIar0Vc+KdZhh2tNO0JT4bS6jLMVZeIg0ebk4wXeZIFnlEFNZ+/EFKbSM XB/A== MIME-Version: 1.0 X-Received: by 10.112.200.130 with SMTP id js2mr1110231lbc.28.1394715108819; Thu, 13 Mar 2014 05:51:48 -0700 (PDT) Received: by 10.114.174.82 with HTTP; Thu, 13 Mar 2014 05:51:48 -0700 (PDT) In-Reply-To: References: Date: Thu, 13 Mar 2014 16:51:48 +0400 Message-ID: From: Vladimir Medvedkin To: Aravind Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] Crafting a packet for transmission. 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, 13 Mar 2014 12:50:19 -0000 Cast pointer to required struct pointer, for example for ipv4 struct ipv4_hdr *iph; iph = (struct ipv4_hdr *)rte_pktmbuf_append(m, sizeof(struct ipv4_hdr)); and fill in fields. Look in lib/librte_net/ directory. Regards, Vladimir 2014-03-13 16:04 GMT+04:00 Aravind : > Thank you for your reply Vladimir. > > I just went through the api reference for Intel DPDK. 'rte_pktmbuf_append' > funcion append len bytes to an mbuf and return a pointer to the start > address of the added data. But how am I suppose to fill in the packet > headers...? It would be great if you could guide me on this. > > > > > > The information contained in this communication is intended solely for the > use of the individual(individuals) or entity to whom it is addressed and > others authorized to receive it. It may contain confidential or legally > privileged information. If you are not the intended recipient, you are > hereby notified that any disclosure, copying, distribution or taking any > action in reliance on the contents of this information is strictly > prohibited and may be unlawful. If you have received this communication in > error, please notify me immediately by responding to this email and then > delete it from your system. Me myself is neither liable for the proper and > complete transmission of the information contained in this communication > nor for any delay in its receipt. > > > On Thu, Mar 13, 2014 at 5:18 PM, Vladimir Medvedkin wrote: > >> Hi, >> >> At first look at https://github.com/Pktgen/Pktgen-DPDK >> >> If you need your custom app: >> - alloc mbuf with rte_pktmbuf_alloc >> - fill up L2-4 headers fields (look at rte_pktmbuf_append func for >> example) >> - send packet via rte_eth_tx_burst >> >> Regards, >> Vladimir >> >> >> 2014-03-13 15:15 GMT+04:00 sabu kurian : >> >> > Hai friends, >> > >> > My requirement is to create a packet generator. So I could use >> > >> > struct rte_mbuf * m; >> > >> > to create a single packet holder. So how am I suppose to fill in the >> packet >> > details like the MAC source , destination and also the IP source , >> > destination (in case of IPv4 packets). >> > >> > Following the l2fwd example, which has got the TAP interface to write >> the >> > data to and read the data from. >> > >> > using the ether_hdr , one could read the MAC address from the packet >> > >> > eth = rte_pktmbuf_mtod(m, struct ether_hdr *); >> > tmp = ð->s_addr.addr_bytes[0]; >> > >> > But how am I suppose to craft a packet and supply in all these details >> , so >> > that I could sent the packet via rte_eth_tx_burst >> > >> > >> > Thanks in advance >> > >> > >