DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Crafting a packet for transmission.
@ 2014-03-13 11:15 sabu kurian
  2014-03-13 11:48 ` Vladimir Medvedkin
  0 siblings, 1 reply; 3+ messages in thread
From: sabu kurian @ 2014-03-13 11:15 UTC (permalink / raw)
  To: dev

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 = &eth->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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] Crafting a packet for transmission.
  2014-03-13 11:15 [dpdk-dev] Crafting a packet for transmission sabu kurian
@ 2014-03-13 11:48 ` Vladimir Medvedkin
       [not found]   ` <CALySL4R9Nn0V7myS4wow_mOB4ENJPfFu4xci2OZeGSDX+tcVSQ@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Medvedkin @ 2014-03-13 11:48 UTC (permalink / raw)
  To: sabu kurian; +Cc: dev

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 <sabu2kurian@gmail.com>:

> 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 = &eth->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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] Crafting a packet for transmission.
       [not found]   ` <CALySL4R9Nn0V7myS4wow_mOB4ENJPfFu4xci2OZeGSDX+tcVSQ@mail.gmail.com>
@ 2014-03-13 12:51     ` Vladimir Medvedkin
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Medvedkin @ 2014-03-13 12:51 UTC (permalink / raw)
  To: Aravind; +Cc: dev

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 <altoarun@gmail.com>:

> 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 <medvedkinv@gmail.com>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 <sabu2kurian@gmail.com>:
>>
>> > 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 = &eth->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
>> >
>>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-13 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13 11:15 [dpdk-dev] Crafting a packet for transmission sabu kurian
2014-03-13 11:48 ` Vladimir Medvedkin
     [not found]   ` <CALySL4R9Nn0V7myS4wow_mOB4ENJPfFu4xci2OZeGSDX+tcVSQ@mail.gmail.com>
2014-03-13 12:51     ` Vladimir Medvedkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).