Commit c5f7ec2a authored by HardenedBSD Sync Service's avatar HardenedBSD Sync Service
Browse files

Merge branch 'freebsd/current/main' into hardened/current/master

parents 8b35c974 3284f492
......@@ -397,6 +397,18 @@ passcleanup(struct cam_periph *periph)
*/
taskqueue_drain(taskqueue_thread, &softc->add_physpath_task);
/*
* It should be safe to destroy the zones from here, because all
* of the references to this peripheral have been freed, and all
* I/O has been terminated and freed. We check the zones for NULL
* because they may not have been allocated yet if the device went
* away before any asynchronous I/O has been issued.
*/
if (softc->pass_zone != NULL)
uma_zdestroy(softc->pass_zone);
if (softc->pass_io_zone != NULL)
uma_zdestroy(softc->pass_io_zone);
cam_periph_lock(periph);
free(softc, M_DEVBUF);
......@@ -1073,7 +1085,7 @@ passcreatezone(struct cam_periph *periph)
/*
* Set the flags appropriately and notify any other waiters.
*/
softc->flags &= PASS_FLAG_ZONE_INPROG;
softc->flags &= ~PASS_FLAG_ZONE_INPROG;
softc->flags |= PASS_FLAG_ZONE_VALID;
wakeup(&softc->pass_zone);
} else {
......
......@@ -347,17 +347,12 @@ xctrl_crash()
}
static void
xen_pv_shutdown_final(void *arg, int howto)
shutdown_final(void *arg, int howto)
{
/*
* Inform the hypervisor that shutdown is complete.
* This is not necessary in HVM domains since Xen
* emulates ACPI in that mode and FreeBSD's ACPI
* support will request this transition.
*/
if (howto & (RB_HALT | RB_POWEROFF))
/* Inform the hypervisor that shutdown is complete. */
if (howto & RB_POWEROFF)
HYPERVISOR_shutdown(SHUTDOWN_poweroff);
else
else if (howto & RB_POWERCYCLE)
HYPERVISOR_shutdown(SHUTDOWN_reboot);
}
......@@ -453,9 +448,8 @@ xctrl_attach(device_t dev)
xctrl->xctrl_watch.max_pending = 1;
xs_register_watch(&xctrl->xctrl_watch);
if (xen_pv_shutdown_handler())
EVENTHANDLER_REGISTER(shutdown_final, xen_pv_shutdown_final, NULL,
SHUTDOWN_PRI_LAST);
EVENTHANDLER_REGISTER(shutdown_final, shutdown_final, NULL,
SHUTDOWN_PRI_LAST);
return (0);
}
......
......@@ -820,7 +820,7 @@ static void
tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le)
{
/* Check if we need to recompute any checksums. */
if (le->m_head->m_pkthdr.lro_nsegs > 1) {
if (le->needs_merge) {
uint16_t csum;
switch (le->inner.data.lro_type) {
......@@ -921,6 +921,8 @@ tcp_set_entry_to_mbuf(struct lro_ctrl *lc, struct lro_entry *le,
le->next_seq = ntohl(th->th_seq) + tcp_data_len;
le->ack_seq = th->th_ack;
le->window = th->th_win;
le->flags = th->th_flags;
le->needs_merge = 0;
/* Setup new data pointers. */
le->m_head = m;
......@@ -962,10 +964,12 @@ tcp_push_and_replace(struct lro_ctrl *lc, struct lro_entry *le, struct mbuf *m)
}
static void
tcp_lro_mbuf_append_pkthdr(struct mbuf *m, const struct mbuf *p)
tcp_lro_mbuf_append_pkthdr(struct lro_entry *le, const struct mbuf *p)
{
struct mbuf *m;
uint32_t csum;
m = le->m_head;
if (m->m_pkthdr.lro_nsegs == 1) {
/* Compute relative checksum. */
csum = p->m_pkthdr.lro_tcp_d_csum;
......@@ -982,6 +986,7 @@ tcp_lro_mbuf_append_pkthdr(struct mbuf *m, const struct mbuf *p)
m->m_pkthdr.lro_tcp_d_csum = csum;
m->m_pkthdr.lro_tcp_d_len += p->m_pkthdr.lro_tcp_d_len;
m->m_pkthdr.lro_nsegs += p->m_pkthdr.lro_nsegs;
le->needs_merge = 1;
}
static void
......@@ -1088,10 +1093,12 @@ tcp_lro_condense(struct lro_ctrl *lc, struct lro_entry *le)
}
/* Try to append the new segment. */
if (__predict_false(ntohl(th->th_seq) != le->next_seq ||
((th->th_flags & TH_ACK) !=
(le->flags & TH_ACK)) ||
(tcp_data_len == 0 &&
le->ack_seq == th->th_ack &&
le->window == th->th_win))) {
/* Out of order packet or duplicate ACK. */
/* Out of order packet, non-ACK + ACK or dup ACK. */
tcp_push_and_replace(lc, le, m);
goto again;
}
......@@ -1100,8 +1107,12 @@ tcp_lro_condense(struct lro_ctrl *lc, struct lro_entry *le)
le->next_seq += tcp_data_len;
le->ack_seq = th->th_ack;
le->window = th->th_win;
le->needs_merge = 1;
} else if (th->th_ack == le->ack_seq) {
le->window = WIN_MAX(le->window, th->th_win);
if (WIN_GT(th->th_win, le->window)) {
le->window = th->th_win;
le->needs_merge = 1;
}
}
if (tcp_data_len == 0) {
......@@ -1110,7 +1121,7 @@ tcp_lro_condense(struct lro_ctrl *lc, struct lro_entry *le)
}
/* Merge TCP data checksum and length to head mbuf. */
tcp_lro_mbuf_append_pkthdr(le->m_head, m);
tcp_lro_mbuf_append_pkthdr(le, m);
/*
* Adjust the mbuf so that m_data points to the first byte of
......
......@@ -146,7 +146,9 @@ struct lro_entry {
uint16_t compressed;
uint16_t uncompressed;
uint16_t window;
uint16_t timestamp; /* flag, not a TCP hdr field. */
uint8_t flags;
uint8_t timestamp : 1;
uint8_t needs_merge : 1;
struct bintime alloc_time; /* time when entry was allocated */
};
......
......@@ -168,9 +168,6 @@ madt_x2apic_disable_reason(void)
return ("inside VMWare without intr redirection");
}
if (vm_guest == VM_GUEST_XEN)
return ("due to running under XEN");
if (vm_guest == VM_GUEST_NO &&
CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) == 0x2a) {
......
......@@ -56,13 +56,6 @@ xen_has_percpu_evtchn(void)
return (!xen_hvm_domain() || xen_vector_callback_enabled);
}
static inline bool
xen_pv_shutdown_handler(void)
{
return (xen_pv_domain());
}
static inline bool
xen_pv_disks_disabled(void)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment