DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nicholas Pratte <npratte@iol.unh.edu>
To: Jeremy Spewock <jspewock@iol.unh.edu>
Cc: thomas@monjalon.net, Luca.Vizzarro@arm.com,
	Honnappa.Nagarahalli@arm.com,  probb@iol.unh.edu,
	yoan.picchi@foss.arm.com, wathsala.vithanage@arm.com,
	 juraj.linkes@pantheon.tech, paul.szczepanek@arm.com,
	dev@dpdk.org
Subject: Re: [PATCH v3 1/4] dts: add send_packets to test suites and rework packet addressing
Date: Thu, 29 Aug 2024 15:42:36 -0400	[thread overview]
Message-ID: <CAKXZ7ejQ_5zFbOar5FB7d-7q7TgOTzE61MNpxcahpMp7cUPfdQ@mail.gmail.com> (raw)
In-Reply-To: <CAAA20UTiiGcMwOsF+2V7Yam2zLz4zP1K8Wt=fK7xBkV7AzGN8g@mail.gmail.com>

Hi Jeremy, sorry for the delay! See my comments below.

<snip>
> > >          Assumptions:
> > >              Two links between SUT and TG, one link is TG -> SUT, the other SUT -> TG.
> > >
> > >          Args:
> > > -            packet: The packet to modify.
> > > +            packets: The packets to modify.
> > >              expected: If :data:`True`, the direction is SUT -> TG,
> > >                  otherwise the direction is TG -> SUT.
> > >          """
> > > -        if expected:
> > > -            # The packet enters the TG from SUT
> > > -            # update l2 addresses
> > > -            packet.src = self._sut_port_egress.mac_address
> > > -            packet.dst = self._tg_port_ingress.mac_address
> > > +        ret_packets = []
> > > +        for packet in packets:
> > > +            default_pkt_src = type(packet)().src
> > > +            default_pkt_dst = type(packet)().dst
> >
> > This is really just a probing question for my sake, but what is the
> > difference between the solution you have above type(packet)().src and
> > Ether().src? Is there a preferred means of doing this?
>
> There isn't really a functional difference at all under the assumption
> that every packet we send will start with an Ethernet header. This
> obviously isn't an unreasonable assumption to make, so maybe I was
> reaching for flexibility that isn't really needed here by making it
> work with any theoretical first layer that has a source address. I
> wanted to do the same thing for the payload, but that causes issues
> when the following layer with an address isn't the very next layer
> after Ether.

Makes sense to me! It's probably best to not to make the Ether
assumption regardless of whether or not it will likely always be
present.

>
> >
> > > +            default_pkt_payload_src = IP().src if hasattr(packet.payload, "src") else None
> > > +            default_pkt_payload_dst = IP().dst if hasattr(packet.payload, "dst") else None
> > > +            # If `expected` is :data:`True`, the packet enters the TG from SUT, otherwise the
> > > +            # packet leaves the TG towards the SUT
> > >
> > > -            # The packet is routed from TG egress to TG ingress
> > > -            # update l3 addresses
> > > -            packet.payload.src = self._tg_ip_address_egress.ip.exploded
> > > -            packet.payload.dst = self._tg_ip_address_ingress.ip.exploded
> >
> > This is where it gets a little tricky. There will be circumstances,
> > albeit probably infrequently, where a user-created packet has more
> > than one IP layer, such as the ones I am using in the ipgre and nvgre
> > test suites that I am writing. In these cases, you need to specify an
> > index of the IP layer you want to modify, otherwise it will modify the
> > outermost IP layer in the packet (the IP layer outside the GRE layer.
> > See my previous comment for an example packet). Should be pretty easy
> > to fix, you just need to check if a packet contains an GRE layer, and
> > if it does, modify the packet by doing something like
> > packet[IP][1].src = self._tg_ip_address_egress.ip.exploded.
>
> I'm not as familiar with how GRE affects the packets, do you need to
> have the address on the inner IP layer at all times, or are you saying
> you need it on both IP layers?

Basically, GRE is a header that encapsulates a traditional packet.
Practically speaking, this means that a scapy packet with GRE will
look something like 'Ether() / IP() / GRE() / IP() / UDP() / Raw()'.
If you try to modify layer 3 addresses in the way the framework does
it now (packet.payload.src), and more than one IP layer is present in
a given packet, it will modify the the front-most IP layer (in this
case, the IP layer before the GRE layer is the packet I listed
before). If there are multiple IP layers, you can choose which layer
you want to modify by doing something like 'packet[IP][1] = address'
to modify the inner IP layer.

It is my understanding that GRE packets need to have an inner IP layer
as well as an outer IP layer. Here is a quick readup on what GRE is
(scroll to the bottom of the article and look at the diagram of a
regular datagram vs a GRE datagram as the rest of the article isn't
super important).

https://ipwithease.com/generic-routing-encapsulation-gre/
<snip>

-Nicholas

  reply	other threads:[~2024-08-29 19:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 15:53 [PATCH v1 0/4] dts: add dynamic queue configuration test suite jspewock
2024-06-25 15:53 ` [PATCH v1 1/4] dts: add send_packets to test suites and rework packet addressing jspewock
2024-06-25 15:53 ` [PATCH v1 2/4] dts: add port queue modification and forwarding stats to testpmd jspewock
2024-06-25 15:53 ` [PATCH v1 3/4] dts: add dynamic queue test suite jspewock
2024-06-25 15:53 ` [PATCH v1 4/4] dts: add dynamic queue conf to the yaml schema jspewock
2024-07-03 21:58 ` [PATCH v2 0/4] dts: add dynamic queue configuration test suite jspewock
2024-07-03 21:58   ` [PATCH v2 1/4] dts: add send_packets to test suites and rework packet addressing jspewock
2024-07-03 21:58   ` [PATCH v2 2/4] dts: add port queue modification and forwarding stats to testpmd jspewock
2024-07-03 21:58   ` [PATCH v2 3/4] dts: add dynamic queue test suite jspewock
2024-07-03 21:58   ` [PATCH v2 4/4] dts: add dynamic queue conf to the yaml schema jspewock
2024-07-24 15:07 ` [PATCH v3 0/4] dts: add dynamic queue configuration test suite jspewock
2024-07-24 15:07   ` [PATCH v3 1/4] dts: add send_packets to test suites and rework packet addressing jspewock
2024-07-26 14:37     ` Nicholas Pratte
2024-07-26 19:00     ` Nicholas Pratte
2024-07-26 19:13       ` Jeremy Spewock
2024-08-29 19:42         ` Nicholas Pratte [this message]
2024-07-24 15:07   ` [PATCH v3 2/4] dts: add port queue modification and forwarding stats to testpmd jspewock
2024-07-24 15:07   ` [PATCH v3 3/4] dts: add dynamic queue test suite jspewock
2024-07-24 15:07   ` [PATCH v3 4/4] dts: add dynamic queue conf to the yaml schema jspewock
2024-09-04 15:49 ` [PATCH v4 0/2] dts: add dynamic queue configuration test suite jspewock
2024-09-04 15:49   ` [PATCH v4 1/2] dts: add port queue modification and forwarding stats to testpmd jspewock
2024-09-04 15:49   ` [PATCH v4 2/2] dts: add dynamic queue test suite jspewock
2024-09-25 19:20 ` [PATCH v5 0/2] dts: add dynamic queue configuration " jspewock
2024-09-25 19:20   ` [PATCH v5 1/2] dts: add port queue modification and forwarding stats to testpmd jspewock
2024-09-25 19:20   ` [PATCH v5 2/2] dts: add dynamic queue test suite jspewock

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=CAKXZ7ejQ_5zFbOar5FB7d-7q7TgOTzE61MNpxcahpMp7cUPfdQ@mail.gmail.com \
    --to=npratte@iol.unh.edu \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=Luca.Vizzarro@arm.com \
    --cc=dev@dpdk.org \
    --cc=jspewock@iol.unh.edu \
    --cc=juraj.linkes@pantheon.tech \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    --cc=thomas@monjalon.net \
    --cc=wathsala.vithanage@arm.com \
    --cc=yoan.picchi@foss.arm.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).