Skip to content

Commit

Permalink
Update sockinfo_tcp.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
tomerdbz authored Dec 17, 2024
1 parent e78f6dd commit 9620582
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/core/sock/sockinfo_tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,21 @@ ssize_t sockinfo_tcp::tcp_tx_slow_path(xlio_tx_call_attr_t &tx_arg)
return tcp_tx_handle_done_and_unlock(total_tx, errno_tmp, is_dummy, is_send_zerocopy);
}

static bool is_socket_in_error_state(const struct pbuf *p, struct tcp_pcb * pcb, uint16_t flags)
{
if (unlikely(is_set(flags, XLIO_TX_PACKET_REXMIT))) {
// this means a retransmit happened - let's check the error_state we'll put if we got error
// cqe
const mem_buf_desc_t * mem_buf_desc = (const mem_buf_desc_t *)p;
if (mem_buf_desc->m_flags & mem_buf_desc_t::INVALID) {
TCP_EVENT_ERR(pcb->errf, pcb->my_container, ERR_RST);
return true;
}
}

return false;
}

/*
* TODO Remove 'p' from the interface and use 'seg'.
* There are multiple places where ip_output() is used without allocating
Expand All @@ -1372,15 +1387,8 @@ err_t sockinfo_tcp::ip_output(struct pbuf *p, struct tcp_seg *seg, void *v_p_con
int count = 0;
void *cur_end;

if (unlikely(is_set(attr.flags, XLIO_TX_PACKET_REXMIT))) {
// this means a retransmit happened - let's check the error_state we'll put if we got error
// cqe
const auto mem_buf_desc = (mem_buf_desc_t *)p;
if (mem_buf_desc->m_flags & mem_buf_desc_t::INVALID) {
const auto pcb = (struct tcp_pcb *)v_p_conn;
TCP_EVENT_ERR(pcb->errf, pcb->my_container, ERR_RST);
return ERR_RST;
}
if (unlikely(is_socket_in_error_state(p, (struct tcp_pcb *)v_p_conn, flags))) {
return ERR_RST;
}

int rc = p_si_tcp->m_ops->postrouting(p, seg, attr);
Expand Down

0 comments on commit 9620582

Please sign in to comment.