All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] PCnet: Allow more then two TMDs
Date: Tue, 15 Apr 2008 18:48:34 +0200	[thread overview]
Message-ID: <4804DC62.8080208@siemens.com> (raw)

A simple fix to let the PCnet emulation handle more than two fragments
for outgoing packets.

There is still a hard-coded limitation of three fragments for incoming
packets, but that didn't hurt so far, even with our test cases (the RX
code is a bit too hairy to remove that limitation without risking
regressions :->).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

---
 hw/pcnet.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Index: b/hw/pcnet.c
===================================================================
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1249,15 +1249,14 @@ static void pcnet_transmit(PCNetState *s
 #endif
         if (GET_FIELD(tmd.status, TMDS, STP)) {
             s->xmit_pos = 0;
-            if (!GET_FIELD(tmd.status, TMDS, ENP)) {
-                int bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
-                s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
-                                 s->buffer, bcnt, CSR_BSWP(s));
-                s->xmit_pos += bcnt;
-            }
             xmit_cxda = PHYSADDR(s,CSR_CXDA(s));
         }
-        if (GET_FIELD(tmd.status, TMDS, ENP) && (s->xmit_pos >= 0)) {
+        if (!GET_FIELD(tmd.status, TMDS, ENP)) {
+            int bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
+            s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
+                             s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
+            s->xmit_pos += bcnt;
+        } else if (s->xmit_pos >= 0) {
             int bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
             s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
                              s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));

                 reply	other threads:[~2008-04-15 16:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4804DC62.8080208@siemens.com \
    --to=jan.kiszka@siemens.com \
    --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.