All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@gmail.com>
To: Jason Wang <jasowang@redhat.com>
Cc: "Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>, 李强 <liq3ea@163.com>,
	"Qemu Developers" <qemu-devel@nongnu.org>,
	"Alexander Bulekov" <alxndr@bu.edu>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 2/2] e1000e: make TX reentrant
Date: Wed, 22 Jul 2020 19:24:23 +0800	[thread overview]
Message-ID: <CAKXe6SJ2=RFAyun+X44qVPooBT85NC1doa1svT6H4NFQgq2H8A@mail.gmail.com> (raw)
In-Reply-To: <20200722085747.6514-2-jasowang@redhat.com>

Jason Wang <jasowang@redhat.com> 于2020年7月22日周三 下午4:58写道:
>
> In loopback mode, e1000e RX can DMA into TX doorbell which requires
> TX to be reentrant. This patch make e1000e's TX routine reentrant by
> introducing a per device boolean for recording whether or not a TX
> rountine is being called and return early.
>

Could we introduce a per-queue 'sending' variable just like the RX.
So we can do this in net core layer.

Thanks,
Li Qiang

> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  hw/net/e1000e_core.c | 8 ++++++++
>  hw/net/e1000e_core.h | 1 +
>  2 files changed, 9 insertions(+)
>
> diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
> index bcd186cac5..8126a644a5 100644
> --- a/hw/net/e1000e_core.c
> +++ b/hw/net/e1000e_core.c
> @@ -923,6 +923,12 @@ e1000e_start_xmit(E1000ECore *core, const E1000E_TxRing *txr)
>          return;
>      }
>
> +    if (core->sending) {
> +        return;
> +    }
> +
> +    core->sending = true;
> +
>      while (!e1000e_ring_empty(core, txi)) {
>          base = e1000e_ring_head_descr(core, txi);
>
> @@ -940,6 +946,8 @@ e1000e_start_xmit(E1000ECore *core, const E1000E_TxRing *txr)
>      if (!ide || !e1000e_intrmgr_delay_tx_causes(core, &cause)) {
>          e1000e_set_interrupt_cause(core, cause);
>      }
> +
> +    core->sending = false;
>  }
>
>  static bool
> diff --git a/hw/net/e1000e_core.h b/hw/net/e1000e_core.h
> index aee32f7e48..4679c1761f 100644
> --- a/hw/net/e1000e_core.h
> +++ b/hw/net/e1000e_core.h
> @@ -114,6 +114,7 @@ struct E1000Core {
>      void (*owner_start_recv)(PCIDevice *d);
>
>      uint32_t msi_causes_pending;
> +    bool sending;
>  };
>
>  void
> --
> 2.20.1
>


  reply	other threads:[~2020-07-22 11:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  8:57 [PATCH 1/2] net: forbid the reentrant RX Jason Wang
2020-07-22  8:57 ` [PATCH 2/2] e1000e: make TX reentrant Jason Wang
2020-07-22 11:24   ` Li Qiang [this message]
2020-07-23  2:22     ` Jason Wang
2020-07-22 12:53   ` Michael Tokarev
2020-07-23  2:25     ` Jason Wang
2020-07-23 12:01       ` Stefan Hajnoczi
2020-07-23 10:36   ` Peter Maydell
2020-07-24  4:00     ` Jason Wang
2020-07-28  4:00 ` [PATCH 1/2] net: forbid the reentrant RX Jason Wang
2020-09-02 15:56   ` Alexander Bulekov
2020-09-03  3:56     ` Jason Wang
2020-09-03  4:02       ` Alexander Bulekov

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='CAKXe6SJ2=RFAyun+X44qVPooBT85NC1doa1svT6H4NFQgq2H8A@mail.gmail.com' \
    --to=liq3ea@gmail.com \
    --cc=alxndr@bu.edu \
    --cc=dmitry.fleytman@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=liq3ea@163.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 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.