All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/5] sunhme: fix return values from sunhme_receive() during receive packet processing
Date: Sun, 30 Jun 2019 18:32:02 +0100	[thread overview]
Message-ID: <20190630173203.9620-5-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20190630173203.9620-1-mark.cave-ayland@ilande.co.uk>

The current return values in sunhme_receive() when processing incoming packets
are inverted from what they should be. Make sure that we return 0 to indicate
the packet was discarded (and polling is to be disabled) and -1 to indicate
that the packet was discarded but polling for incoming data is to be continued.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/net/sunhme.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c
index 14e7effb88..cd076d642b 100644
--- a/hw/net/sunhme.c
+++ b/hw/net/sunhme.c
@@ -728,7 +728,7 @@ static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf,
 
     /* Do nothing if MAC RX disabled */
     if (!(s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_ENABLE)) {
-        return -1;
+        return 0;
     }
 
     trace_sunhme_rx_filter_destmac(buf[0], buf[1], buf[2],
@@ -757,14 +757,14 @@ static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf,
                 /* Didn't match hash filter */
                 trace_sunhme_rx_filter_hash_nomatch();
                 trace_sunhme_rx_filter_reject();
-                return 0;
+                return -1;
             } else {
                 trace_sunhme_rx_filter_hash_match();
             }
         } else {
             /* Not for us */
             trace_sunhme_rx_filter_reject();
-            return 0;
+            return -1;
         }
     } else {
         trace_sunhme_rx_filter_promisc_match();
-- 
2.11.0



  parent reply	other threads:[~2019-06-30 17:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-30 17:31 [Qemu-devel] [PATCH 0/5] sunhme: misc fixes for tap mode Mark Cave-Ayland
2019-06-30 17:31 ` [Qemu-devel] [PATCH 1/5] sunhme: add trace event for logging PCI IRQ Mark Cave-Ayland
2019-06-30 17:32 ` [Qemu-devel] [PATCH 2/5] sunhme: fix incorrect constant in sunhme_can_receive() Mark Cave-Ayland
2019-06-30 17:32 ` [Qemu-devel] [PATCH 3/5] sunhme: flush any queued packets when HME_MAC_RXCFG_ENABLE bit is raised Mark Cave-Ayland
2019-06-30 17:32 ` Mark Cave-Ayland [this message]
2019-06-30 17:32 ` [Qemu-devel] [PATCH 5/5] sunhme: ensure that RX descriptor ring overflow is indicated to client driver Mark Cave-Ayland

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=20190630173203.9620-5-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.