MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ktls_check_rx

Function ktls_check_rx

freebsd/kern/uipc_ktls.c:1611–1654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1609}
1610
1611void
1612ktls_check_rx(struct sockbuf *sb)
1613{
1614 struct tls_record_layer hdr;
1615 struct ktls_wq *wq;
1616 struct socket *so;
1617 bool running;
1618
1619 SOCKBUF_LOCK_ASSERT(sb);
1620 KASSERT(sb->sb_flags & SB_TLS_RX, ("%s: sockbuf %p isn't TLS RX",
1621 __func__, sb));
1622 so = __containerof(sb, struct socket, so_rcv);
1623
1624 if (sb->sb_flags & SB_TLS_RX_RUNNING)
1625 return;
1626
1627 /* Is there enough queued for a TLS header? */
1628 if (sb->sb_tlscc < sizeof(hdr)) {
1629 if ((sb->sb_state & SBS_CANTRCVMORE) != 0 && sb->sb_tlscc != 0)
1630 so->so_error = EMSGSIZE;
1631 return;
1632 }
1633
1634 m_copydata(sb->sb_mtls, 0, sizeof(hdr), (void *)&hdr);
1635
1636 /* Is the entire record queued? */
1637 if (sb->sb_tlscc < sizeof(hdr) + ntohs(hdr.tls_length)) {
1638 if ((sb->sb_state & SBS_CANTRCVMORE) != 0)
1639 so->so_error = EMSGSIZE;
1640 return;
1641 }
1642
1643 sb->sb_flags |= SB_TLS_RX_RUNNING;
1644
1645 soref(so);
1646 wq = &ktls_wq[so->so_rcv.sb_tls_info->wq_index];
1647 mtx_lock(&wq->mtx);
1648 STAILQ_INSERT_TAIL(&wq->so_head, so, so_ktls_rx_list);
1649 running = wq->running;
1650 mtx_unlock(&wq->mtx);
1651 if (!running)
1652 wakeup(wq);
1653 counter_u64_add(ktls_cnt_rx_queued, 1);
1654}
1655
1656static struct mbuf *
1657ktls_detach_record(struct sockbuf *sb, int len)

Callers 3

ktls_enable_rxFunction · 0.85
socantrcvmore_lockedFunction · 0.85
sbappend_ktls_rxFunction · 0.85

Calls 5

m_copydataFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70
wakeupFunction · 0.70
counter_u64_addFunction · 0.50

Tested by

no test coverage detected