[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.0.1 62/73] igb: Fix Rx packet type encoding
From: |
Michael Tokarev |
Subject: |
[Stable-8.0.1 62/73] igb: Fix Rx packet type encoding |
Date: |
Sun, 28 May 2023 09:57:00 +0300 |
From: Akihiko Odaki <akihiko.odaki@daynix.com>
igb's advanced descriptor uses a packet type encoding different from
one used in e1000e's extended descriptor. Fix the logic to encode
Rx packet type accordingly.
Fixes: 3a977deebe ("Intrdocue igb device emulation")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit ed447c60b341f1714b3c800d7f9c68898e873f78)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c
index 8a9fd1f729..1c7f4eaf76 100644
--- a/hw/net/igb_core.c
+++ b/hw/net/igb_core.c
@@ -1226,7 +1226,6 @@ igb_build_rx_metadata(IGBCore *core,
struct virtio_net_hdr *vhdr;
bool hasip4, hasip6;
EthL4HdrProto l4hdr_proto;
- uint32_t pkt_type;
*status_flags = E1000_RXD_STAT_DD;
@@ -1265,28 +1264,29 @@ igb_build_rx_metadata(IGBCore *core,
trace_e1000e_rx_metadata_ack();
}
- if (hasip6 && (core->mac[RFCTL] & E1000_RFCTL_IPV6_DIS)) {
- trace_e1000e_rx_metadata_ipv6_filtering_disabled();
- pkt_type = E1000_RXD_PKT_MAC;
- } else if (l4hdr_proto == ETH_L4_HDR_PROTO_TCP ||
- l4hdr_proto == ETH_L4_HDR_PROTO_UDP) {
- pkt_type = hasip4 ? E1000_RXD_PKT_IP4_XDP : E1000_RXD_PKT_IP6_XDP;
- } else if (hasip4 || hasip6) {
- pkt_type = hasip4 ? E1000_RXD_PKT_IP4 : E1000_RXD_PKT_IP6;
- } else {
- pkt_type = E1000_RXD_PKT_MAC;
- }
+ if (pkt_info) {
+ *pkt_info = rss_info->enabled ? rss_info->type : 0;
- trace_e1000e_rx_metadata_pkt_type(pkt_type);
+ if (hasip4) {
+ *pkt_info |= E1000_ADVRXD_PKT_IP4;
+ }
- if (pkt_info) {
- if (rss_info->enabled) {
- *pkt_info = rss_info->type;
+ if (hasip6) {
+ *pkt_info |= E1000_ADVRXD_PKT_IP6;
}
- *pkt_info |= (pkt_type << 4);
- } else {
- *status_flags |= E1000_RXD_PKT_TYPE(pkt_type);
+ switch (l4hdr_proto) {
+ case ETH_L4_HDR_PROTO_TCP:
+ *pkt_info |= E1000_ADVRXD_PKT_TCP;
+ break;
+
+ case ETH_L4_HDR_PROTO_UDP:
+ *pkt_info |= E1000_ADVRXD_PKT_UDP;
+ break;
+
+ default:
+ break;
+ }
}
if (hdr_info) {
diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h
index c5c5b3c3b8..21ee9a3b2d 100644
--- a/hw/net/igb_regs.h
+++ b/hw/net/igb_regs.h
@@ -641,6 +641,11 @@ union e1000_adv_rx_desc {
#define E1000_STATUS_NUM_VFS_SHIFT 14
+#define E1000_ADVRXD_PKT_IP4 BIT(4)
+#define E1000_ADVRXD_PKT_IP6 BIT(6)
+#define E1000_ADVRXD_PKT_TCP BIT(8)
+#define E1000_ADVRXD_PKT_UDP BIT(9)
+
static inline uint8_t igb_ivar_entry_rx(uint8_t i)
{
return i < 8 ? i * 4 : (i - 8) * 4 + 2;
--
2.39.2
- [Stable-8.0.1 v3 00/59] Patch Round-up for stable 8.0.1, frozen on 2023-05-27, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 60/73] e1000e: Fix tx/rx counters, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 62/73] igb: Fix Rx packet type encoding,
Michael Tokarev <=
- [Stable-8.0.1 61/73] e1000x: Fix BPRC and MPRC, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 63/73] igb: Do not require CTRL.VME for tx VLAN tagging, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 66/73] e1000e: Always copy ethernet header, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 65/73] net/net_rx_pkt: Use iovec for net_rx_pkt_set_protocols(), Michael Tokarev, 2023/05/28
- [Stable-8.0.1 64/73] igb: Clear IMS bits when committing ICR access, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 67/73] igb: Always copy ethernet header, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 68/73] rtl8139: fix large_send_mss divide-by-zero, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 69/73] util/vfio-helpers: Use g_file_read_link(), Michael Tokarev, 2023/05/28
- [Stable-8.0.1 70/73] usb/ohci: Set pad to 0 after frame update, Michael Tokarev, 2023/05/28
- [Stable-8.0.1 72/73] machine: do not crash if default RAM backend name has been stolen, Michael Tokarev, 2023/05/28