qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: deller@kernel.org
Cc: qemu-devel@nongnu.org,
	Richard Henderson <richard.henderson@linaro.org>,
	 Helge Deller <deller@gmx.de>, Jason Wang <jasowang@redhat.com>,
	 Soumyajyotii Ssarkar <soumyajyotisarkar23@gmail.com>
Subject: Re: [PULL v2 3/3] i82596: Implement enhanced TX/RX with packet queuing and filtering
Date: Thu, 6 Nov 2025 11:12:23 +0000	[thread overview]
Message-ID: <CAFEAcA-TqB=ePZv1LT22TRiH4JC9i4zkEjwYHrMS-EdYVDfd2A@mail.gmail.com> (raw)
In-Reply-To: <20251104152204.6261-4-deller@kernel.org>

On Tue, 4 Nov 2025 at 15:22, <deller@kernel.org> wrote:
>
> From: Soumyajyotii Ssarkar <soumyajyotisarkar23@gmail.com>
>
> In this patch I have added the following:
> - Rewrote transmit path with CSMA/CD collision handling and retry logic
> - Implemented flexible TX buffer descriptor (TBD) chain processing
> - Rewrote receive path with packet filtering and monitor mode support
> - Added RX packet queue for handling resource exhaustion
> - Implemented queue flush timer and management
> - Added RX state machine with proper state transitions
> - Implemented packet filtering (unicast, broadcast, multicast, promiscuous)
> - Added SCB RU_START enhancement to find usable RFDs
> - Implemented dump command support
> - Added bus throttle timer loading (LOAD_THROTTLE/LOAD_START commands)
> - Enhanced signal_ca with proper initialization sequence
> - Finally, adding self-test functionality
>
> Note:
> With this patch, and the previous ones in the patch series, we are able
> to achive proper 82596 NIC emulation.

Hi; Coverity notices a logic error in this function
(CID 1642873):

> +static ssize_t i82596_receive_packet(I82596State *s, const uint8_t *buf,
> +                                      size_t size, bool from_queue)
> +{

In this loop, I cut out the insides of some of the if() blocks
to make the structure clearer:

> +    do {
> +        if (simplified_mode && I596_LOOPBACK) {
              [...]
>          } else {
> -            s->scb_status &= ~SCB_STATUS_CX;
               [...]
> +            if (bytes_copied < payload_size) {
                   [...]
> +                }
> +            }
>          }
> -        update_scb_status(s);
> +        break;

This "break" is at the top level inside the do {} loop,
so it unconditionally exits it.

>
> -        /* Interrupt after doing cmd? */
> -        if (cmd & CMD_INTR) {
> -            s->send_irq = 1;
> +    } while (bytes_copied < payload_size);

So having a while() condition here is dead code, because
execution always stops at the "break" on the first
iteration, and doesn't reach the condition check.

Should the 'break' have been inside an if() somewhere?

thanks
-- PMM


  parent reply	other threads:[~2025-11-06 11:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 15:22 [PULL v2 0/3] I82596 fixes patches deller
2025-11-04 15:22 ` [PULL v2 1/3] hw/hppa: Enable LASI i82596 network on 715 machine deller
2025-11-04 15:22 ` [PULL v2 2/3] i82596: Added core infrastructure and helper functions deller
2025-11-04 15:22 ` [PULL v2 3/3] i82596: Implement enhanced TX/RX with packet queuing and filtering deller
2025-11-06 11:02   ` Peter Maydell
2025-11-06 11:12   ` Peter Maydell [this message]
2025-11-05 13:46 ` [PULL v2 0/3] I82596 fixes patches Richard Henderson

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='CAFEAcA-TqB=ePZv1LT22TRiH4JC9i4zkEjwYHrMS-EdYVDfd2A@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=deller@gmx.de \
    --cc=deller@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=soumyajyotisarkar23@gmail.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).