DPDK usage discussions
 help / color / mirror / Atom feed
From: Shyam Shrivastav <shrivastav.shyam@gmail.com>
To: mikeb01@gmail.com
Cc: users <users@dpdk.org>
Subject: Re: [dpdk-users] Calculating Packet Length
Date: Sat, 29 Sep 2018 16:09:13 +0530	[thread overview]
Message-ID: <CAGSp03mLCXOn-hMUZhoVu9k5PW4xwKdK9J49PgxHB1Jto_LWGw@mail.gmail.com> (raw)
In-Reply-To: <CALwNKeSL7HHoC3UaZ2GEeexyVgcqCCHaF3FDkZXCgYwXQeiVfQ@mail.gmail.com>

We have to use sizeof(struct ether_hdr) , length set is wrong and 8 bytes
short

struct ether_hdr {
    struct ether_addr d_addr; /**< Destination address. */
    struct ether_addr s_addr; /**< Source address. */
    uint16_t ether_type;      /**< Frame type. */
} __attribute__((__packed__));


On Sat, Sep 29, 2018 at 3:49 PM Michael Barker <mikeb01@gmail.com> wrote:

> Hi,
>
> I've new to DPDK and have been started by sending ARP packets.  I have a
> question around how to set the mbuf data_len and pkt_size.  I Initially did
> the following:
>
>     struct rte_mbuf* arp_pkt = rte_pktmbuf_alloc(mbuf_pool);
>     const size_t pkt_size = sizeof(struct ether_addr) + sizeof(struct
> arp_hdr);
>
>     arp_pkt->data_len = pkt_size;
>     arp_pkt->pkt_len = pkt_size;
>
> Which is based on ptpclient.c sample code.  However after setting all of
> the fields, the packet either doesn't get sent or has some of the data
> truncated from the end of the packet when viewed in Wireshark.  If I modify
> the size to be the following:
>
>     const size_t pkt_size = sizeof(struct ether_addr) + sizeof(struct
> arp_hdr) + 8;
>
> It works as expected.  I'm wondering where the extra 8 bytes come from?  Is
> there a better way to calculate the packet length?
>
> Using dpdk 18.08, Linux - kernel 4.15.0-33.
>
> Mike.
>

  reply	other threads:[~2018-09-29 10:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-29 10:19 Michael Barker
2018-09-29 10:39 ` Shyam Shrivastav [this message]
2018-09-29 14:39 ` Wiles, Keith
2018-09-29 20:10   ` Michael Barker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGSp03mLCXOn-hMUZhoVu9k5PW4xwKdK9J49PgxHB1Jto_LWGw@mail.gmail.com \
    --to=shrivastav.shyam@gmail.com \
    --cc=mikeb01@gmail.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).