From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org, stefanha@redhat.com
Cc: Ding Hui <dinghui@sangfor.com.cn>, Jason Wang <jasowang@redhat.com>
Subject: [PULL 1/8] e1000e: set RX desc status with DD flag in a separate operation
Date: Tue, 27 Sep 2022 15:30:15 +0800 [thread overview]
Message-ID: <20220927073022.28378-2-jasowang@redhat.com> (raw)
In-Reply-To: <20220927073022.28378-1-jasowang@redhat.com>
From: Ding Hui <dinghui@sangfor.com.cn>
Like commit 034d00d48581 ("e1000: set RX descriptor status in
a separate operation"), there is also same issue in e1000e, which
would cause lost packets or stop sending packets to VM with DPDK.
Do similar fix in e1000e.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/402
Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/e1000e_core.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 52 insertions(+), 1 deletion(-)
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 82aa61f..fc9cdb4 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -1364,6 +1364,57 @@ struct NetRxPkt *pkt, const E1000E_RSSInfo *rss_info,
}
}
+static inline void
+e1000e_pci_dma_write_rx_desc(E1000ECore *core, dma_addr_t addr,
+ uint8_t *desc, dma_addr_t len)
+{
+ PCIDevice *dev = core->owner;
+
+ if (e1000e_rx_use_legacy_descriptor(core)) {
+ struct e1000_rx_desc *d = (struct e1000_rx_desc *) desc;
+ size_t offset = offsetof(struct e1000_rx_desc, status);
+ uint8_t status = d->status;
+
+ d->status &= ~E1000_RXD_STAT_DD;
+ pci_dma_write(dev, addr, desc, len);
+
+ if (status & E1000_RXD_STAT_DD) {
+ d->status = status;
+ pci_dma_write(dev, addr + offset, &status, sizeof(status));
+ }
+ } else {
+ if (core->mac[RCTL] & E1000_RCTL_DTYP_PS) {
+ union e1000_rx_desc_packet_split *d =
+ (union e1000_rx_desc_packet_split *) desc;
+ size_t offset = offsetof(union e1000_rx_desc_packet_split,
+ wb.middle.status_error);
+ uint32_t status = d->wb.middle.status_error;
+
+ d->wb.middle.status_error &= ~E1000_RXD_STAT_DD;
+ pci_dma_write(dev, addr, desc, len);
+
+ if (status & E1000_RXD_STAT_DD) {
+ d->wb.middle.status_error = status;
+ pci_dma_write(dev, addr + offset, &status, sizeof(status));
+ }
+ } else {
+ union e1000_rx_desc_extended *d =
+ (union e1000_rx_desc_extended *) desc;
+ size_t offset = offsetof(union e1000_rx_desc_extended,
+ wb.upper.status_error);
+ uint32_t status = d->wb.upper.status_error;
+
+ d->wb.upper.status_error &= ~E1000_RXD_STAT_DD;
+ pci_dma_write(dev, addr, desc, len);
+
+ if (status & E1000_RXD_STAT_DD) {
+ d->wb.upper.status_error = status;
+ pci_dma_write(dev, addr + offset, &status, sizeof(status));
+ }
+ }
+ }
+}
+
typedef struct e1000e_ba_state_st {
uint16_t written[MAX_PS_BUFFERS];
uint8_t cur_idx;
@@ -1600,7 +1651,7 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL,
rss_info, do_ps ? ps_hdr_len : 0, &bastate.written);
- pci_dma_write(d, base, &desc, core->rx_desc_len);
+ e1000e_pci_dma_write_rx_desc(core, base, desc, core->rx_desc_len);
e1000e_ring_advance(core, rxi,
core->rx_desc_len / E1000_MIN_RX_DESC_LEN);
--
2.7.4
next prev parent reply other threads:[~2022-09-27 8:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 7:30 [PULL 0/8] Net patches Jason Wang
2022-09-27 7:30 ` Jason Wang [this message]
2022-09-27 7:30 ` [PULL 2/8] vdpa: Make VhostVDPAState cvq_cmd_in_buffer control ack type Jason Wang
2022-09-27 7:30 ` [PULL 3/8] vdpa: extract vhost_vdpa_net_load_mac from vhost_vdpa_net_load Jason Wang
2022-09-27 7:30 ` [PULL 4/8] vdpa: Add vhost_vdpa_net_load_mq Jason Wang
2022-09-27 7:30 ` [PULL 5/8] vdpa: validate MQ CVQ commands Jason Wang
2022-09-27 7:30 ` [PULL 6/8] virtio-net: Update virtio-net curr_queue_pairs in vdpa backends Jason Wang
2022-09-27 7:30 ` [PULL 7/8] vdpa: Allow MQ feature in SVQ Jason Wang
2022-09-27 7:30 ` [PULL 8/8] virtio: del net client if net_init_tap_one failed Jason Wang
2022-09-27 18:40 ` [PULL 0/8] Net patches Stefan Hajnoczi
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=20220927073022.28378-2-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=dinghui@sangfor.com.cn \
--cc=peter.maydell@linaro.org \
--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 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).