DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jeremy Spewock <jspewock@iol.unh.edu>
To: Dean Marx <dmarx@iol.unh.edu>
Cc: probb@iol.unh.edu, npratte@iol.unh.edu, luca.vizzarro@arm.com,
	 yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com,
	 paul.szczepanek@arm.com, juraj.linkes@pantheon.tech,
	dev@dpdk.org
Subject: Re: [PATCH v2] dts: add VLAN methods to testpmd shell
Date: Fri, 20 Sep 2024 14:33:43 -0400	[thread overview]
Message-ID: <CAAA20URU3RRCgvi0zOsxqb89s6Dkr-jFufZ325K7pihi=XSKTg@mail.gmail.com> (raw)
In-Reply-To: <20240918194127.11556-1-dmarx@iol.unh.edu>

On Wed, Sep 18, 2024 at 3:41 PM Dean Marx <dmarx@iol.unh.edu> wrote:
>
<snip>
> +
> +    def tx_vlan_set(self, port: int, vlan: int, verify: bool = True) -> None:

One thing to note is that I think this method (unlike rx_vlan_set for
some reason) requires the ports to be stopped for it to work, so we
should probably decorate this with @requires_stopped_ports to make it
more convenient for the developer.

> +        """Set hardware insertion of vlan tags in packets sent on a port.
> +
> +        Args:
> +            port: The port number to use, should be within 0-32.
> +            vlan: The vlan tag to insert, should be within 1-4094.
> +            verify: If :data:`True`, the output of the command is scanned to verify that
> +                vlan insertion was enabled on the specified port. If not, it is
> +                considered an error.
> +
> +        Raises:
> +            InteractiveCommandExecutionError: If `verify` is :data:`True` and the insertion
> +                tag is not set.
> +        """
> +        vlan_insert_output = self.send_command(f"tx_vlan set {port} {vlan}")
> +        if verify:
> +            if (
> +                "Please stop port" in vlan_insert_output
> +                or "Invalid vlan_id" in vlan_insert_output
> +                or "Invalid port" in vlan_insert_output
> +            ):
> +                self._logger.debug(
> +                    f"Failed to set vlan tag {vlan} on port {port}:\n{vlan_insert_output}"
> +                )
> +                raise InteractiveCommandExecutionError(
> +                    f"Testpmd failed to set vlan insertion tag {vlan} on port {port}."
> +                )
> +
> +    def tx_vlan_reset(self, port: int, verify: bool = True) -> None:

I believe this method also required ports to be stopped.

> +        """Disable hardware insertion of vlan tags in packets sent on a port.
> +
> +        Args:
> +            port: The port number to use, should be within 0-32.
> +            verify: If :data:`True`, the output of the command is scanned to verify that
> +                vlan insertion was disabled on the specified port. If not, it is
> +                considered an error.
> +
> +        Raises:
> +            InteractiveCommandExecutionError: If `verify` is :data:`True` and the insertion
> +                tag is not reset.
> +        """
> +        vlan_insert_output = self.send_command(f"tx_vlan reset {port}")
> +        if verify:
> +            if "Please stop port" in vlan_insert_output or "Invalid port" in vlan_insert_output:
> +                self._logger.debug(
> +                    f"Failed to reset vlan insertion on port {port}: \n{vlan_insert_output}"
> +                )
> +                raise InteractiveCommandExecutionError(
> +                    f"Testpmd failed to reset vlan insertion on port {port}."
> +                )
> +
<snip>
> 2.44.0
>

      reply	other threads:[~2024-09-20 18:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11 17:38 [PATCH v1] " Dean Marx
2024-09-12  2:17 ` Patrick Robb
2024-09-18 19:41 ` [PATCH v2] " Dean Marx
2024-09-20 18:33   ` Jeremy Spewock [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='CAAA20URU3RRCgvi0zOsxqb89s6Dkr-jFufZ325K7pihi=XSKTg@mail.gmail.com' \
    --to=jspewock@iol.unh.edu \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=dmarx@iol.unh.edu \
    --cc=juraj.linkes@pantheon.tech \
    --cc=luca.vizzarro@arm.com \
    --cc=npratte@iol.unh.edu \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    --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).