Skip to content

Commit 4b565b7

Browse files
tomerdbzgalnoam
authored andcommitted
Issue #4308042: Fix read of invalid data from CQE
According to the PRM - section 8.20.3.2: "After seeing that the CQE is in SW ownership, SW should do memory barrier and re-read the CQE." It was removed as part of commit 88436b2 - causing us to sometimes observe “garbage” data. This commit returns the barrier as needed. Signed-off-by: Tomer Cabouly <[email protected]>
1 parent 198bd09 commit 4b565b7

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

src/core/dev/cq_mgr_rx_regrq.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ mem_buf_desc_t *cq_mgr_rx_regrq::poll(enum buff_status_e &status)
107107
xlio_mlx5_cqe *cqe = check_cqe();
108108
if (likely(cqe)) {
109109
++m_mlx5_cq.cq_ci;
110+
rmb();
110111
cqe_to_mem_buff_desc(cqe, m_rx_hot_buffer, status);
111112

112113
++m_hqrx_ptr->m_rq_data.tail;

src/core/dev/cq_mgr_rx_strq.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ mem_buf_desc_t *cq_mgr_rx_strq::poll(enum buff_status_e &status, mem_buf_desc_t
188188
xlio_mlx5_cqe *cqe = check_cqe();
189189
if (likely(cqe)) {
190190
++m_mlx5_cq.cq_ci;
191+
rmb();
191192

192193
bool is_filler = false;
193194
bool is_wqe_complete = strq_cqe_to_mem_buff_desc(cqe, status, is_filler);

src/core/dev/cq_mgr_tx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ inline struct xlio_mlx5_cqe *cq_mgr_tx::get_cqe_tx(uint32_t &num_polled_cqes)
144144
((m_mlx5_cq.cq_ci & (m_mlx5_cq.cqe_count - 1))
145145
<< m_mlx5_cq.cqe_size_log));
146146
}
147+
if (cqe_ret) {
148+
rmb();
149+
}
147150
return cqe_ret;
148151
}
149152

src/core/dev/ring_slave.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,9 @@ bool ring_slave::rx_process_buffer(mem_buf_desc_t *p_rx_wc_buf_desc, void *pv_fd
739739

740740
// Validate IP header as next protocol
741741
if (unlikely(h_proto != NET_ETH_P_IP) && unlikely(h_proto != NET_ETH_P_IPV6)) {
742-
ring_logwarn("Rx buffer dropped - Invalid Ethr Type (%#x : %#x, %#x)", p_eth_h->h_proto,
743-
NET_ETH_P_IP, NET_ETH_P_IPV6);
742+
ring_logwarn("Rx buffer dropped - Invalid Ethr Type (h_proto=%#x-p_eth_h->h_proto=%#x "
743+
": %#x, %#x)",
744+
h_proto, p_eth_h->h_proto, NET_ETH_P_IP, NET_ETH_P_IPV6);
744745
return false;
745746
}
746747
} break;

0 commit comments

Comments
 (0)