Hey Dean, everything looks good here to me, but I had one thought
about how we do the verification below.

On Wed, Jul 3, 2024 at 2:08 PM Dean Marx <dm...@iol.unh.edu> wrote:
<snip>
> +
> +    def test_rx_queue_start_stop(self) -> None:
> +        """Verify packets are not received by port 0 when Rx queue is 
> disabled.
> +
> +        Test:
> +            Create an interactive testpmd session, stop Rx queue on port 0, 
> verify
> +            packets are not received.
> +        """
> +        testpmd = TestPmdShell(node=self.sut_node)
> +        testpmd.set_forward_mode(SimpleForwardingModes.mac)
> +        testpmd.stop_port_queue(0, 0, True)
> +
> +        testpmd.start()
> +        self.send_packet_and_verify(should_receive=False)
> +        stats = testpmd.show_port_stats(port_id=0)
> +        self.verify(
> +            stats.rx_packets == 0,
> +            "Packets were received on Rx queue when it should've been 
> disabled",
> +        )

Thinking more about this verification step, I think it makes a lot of
sense why we can verify here using port stats even though we usually
can't. One thing I was thinking about with this however is I think
there is a (probably small) chance that before you get the chance to
stop the port after opening testpmd, a packet is sent to it. When I
tested this it seemed like this verification step worked with some
NICs (like one I ran with on the bnxt_en driver), but specifically
because when you stop the Rx queue it clears all of the Rx stats on
the port. I'm not sure if this is something PMD specific or not, but
it might be worth putting a small comment in here that explains that
disabling the queue will reset the stats and that we then don't expect
the stat to grow from that point on at all.

If handling this number is something PMD specific, another alternative
route we could take would be taking the statistics that are returned
from the "stop" command. I think this would work because the
statistics from the stop command are only aggregated while packet
forwarding is running, and we know that we stopped the queue before
starting forwarding so that number should truly always be 0.



> +        testpmd.close()
> +
> +    def test_tx_queue_start_stop(self) -> None:
> +        """Verify packets are not forwarded by port 1 when Tx queue is 
> disabled.
> +
> +        Test:
> +            Create an interactive testpmd session, stop Tx queue on port 1, 
> verify
> +            packets are not forwarded.
> +        """
> +        testpmd = TestPmdShell(node=self.sut_node)
> +        testpmd.set_forward_mode(SimpleForwardingModes.mac)
> +        testpmd.stop_port_queue(1, 0, False)
> +        testpmd.start()
> +        self.send_packet_and_verify(should_receive=False)
> +        stats = testpmd.show_port_stats(port_id=1)
> +        self.verify(
> +            stats.tx_packets == 0,
> +            "Packets were forwarded on Tx queue when it should've been 
> disabled",
> +        )
> +        testpmd.close()
> --
> 2.44.0
>

Reply via email to