DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andriy Berestovskyy <aber@semihalf.com>
To: 최익성 <pnk003@naver.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] Questions about reading/writing/modifying packet header.
Date: Mon, 18 Apr 2016 17:47:33 +0200	[thread overview]
Message-ID: <CAOysbxoOGUioM2uJvzwYZUOatGE+7xguTjR9_2Uimob3tAOxPA@mail.gmail.com> (raw)
In-Reply-To: <6b15729351b224d4ad9a7ae4ceeb13@cweb23.nm.nhnsystem.com>

Hi Ick-Sung,
Please see inline.

On Mon, Apr 18, 2016 at 2:14 PM, 최익성 <pnk003@naver.com> wrote:
> If I take an example, the worker assignment method using &amp; (not %) in load balancing was not fixed yet.

If the code works, there is nothing to fix, right? ;)


> Question #1) I would like to know how can I read/write/modify TCP/UDP/ICMP/IGMP/...  headers from packet in rte_mbuf.
>   I will really appreciate if I can be given an example code. I guess it would be somewhat complex.

For an example please have a look at parse_ethernet() in test-pmd:
http://dpdk.org/browse/dpdk/tree/app/test-pmd/csumonly.c#n171

The example usage is in the same file:

eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
parse_ethernet(eth_hdr, &info);
l3_hdr = (char *)eth_hdr + info.l2_len;

if (info.l4_proto == IPPROTO_UDP) {
    udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info.l3_len);
    udp_hdr->dst_port = ...
}

Then you might need to recalculate the L4 checksum, so have a look at
rte_ipv4_udptcp_cksum().


> Question #2) The IP checksum does not include 6 the ptr. 6 th ptr (ptr16[5]) is missing in the example code. Is it right?
>   ( ip_cksum += ptr16[5]; in the following code.)

The code seems fine, ptr16[5] is the checksum itself. It should be
zero, so we can skip it.


There is a users@dpdk.org mailing list now, so please use it for your
further questions. Here is the link for your convenience:
http://dpdk.org/ml

Regards,
Andriy

      reply	other threads:[~2016-04-18 15:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 12:14 최익성
2016-04-18 15:47 ` Andriy Berestovskyy [this message]

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=CAOysbxoOGUioM2uJvzwYZUOatGE+7xguTjR9_2Uimob3tAOxPA@mail.gmail.com \
    --to=aber@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=pnk003@naver.com \
    /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).