sync with OpenBSD -current
This commit is contained in:
parent
ae019f102d
commit
bc7421a947
142 changed files with 4267 additions and 1365 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: mptramp.S,v 1.22 2022/12/01 00:26:15 guenther Exp $ */
|
||||
/* $OpenBSD: mptramp.S,v 1.23 2024/07/12 13:10:58 deraadt Exp $ */
|
||||
/* $NetBSD: mptramp.S,v 1.1 2003/04/26 18:39:30 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -233,6 +233,7 @@ GENTRY(cpu_spinup_finish)
|
|||
movl $CR0_DEFAULT,%eax
|
||||
movq %rax,%cr0
|
||||
call cpu_hatch
|
||||
movq $0,-8(%rsp)
|
||||
END(cpu_spinup_finish)
|
||||
/* NOTREACHED */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: files,v 1.733 2024/06/12 12:54:54 bluhm Exp $
|
||||
# $OpenBSD: files,v 1.734 2024/07/13 13:20:44 bluhm Exp $
|
||||
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
@ -898,7 +898,7 @@ file netinet/tcp_subr.c
|
|||
file netinet/tcp_timer.c
|
||||
file netinet/tcp_usrreq.c
|
||||
file netinet/udp_usrreq.c
|
||||
file netinet/ip_gre.c
|
||||
file netinet/ip_gre.c gre
|
||||
file netinet/ip_ipsp.c ipsec | tcp_signature
|
||||
file netinet/ip_spd.c ipsec | tcp_signature
|
||||
file netinet/ip_ipip.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: nvme.c,v 1.119 2024/07/08 16:07:36 krw Exp $ */
|
||||
/* $OpenBSD: nvme.c,v 1.121 2024/07/13 08:59:41 dv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
|
||||
|
|
|
@ -100,7 +100,7 @@ static int aldebaran_mode2_suspend_ip(struct amdgpu_device *adev)
|
|||
adev->ip_blocks[i].status.hw = false;
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -2052,12 +2052,13 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
|
|||
struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
|
||||
char reg_offset[11];
|
||||
uint32_t *new = NULL, *tmp = NULL;
|
||||
int ret, i = 0, len = 0;
|
||||
unsigned int len = 0;
|
||||
int ret, i = 0;
|
||||
|
||||
do {
|
||||
memset(reg_offset, 0, 11);
|
||||
if (copy_from_user(reg_offset, buf + len,
|
||||
min(10, ((int)size-len)))) {
|
||||
min(10, (size-len)))) {
|
||||
ret = -EFAULT;
|
||||
goto error_free;
|
||||
}
|
||||
|
|
|
@ -1187,7 +1187,8 @@ void amdgpu_gfx_cp_init_microcode(struct amdgpu_device *adev,
|
|||
fw_size = le32_to_cpu(cp_hdr_v2_0->data_size_bytes);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
dev_err(adev->dev, "Invalid ucode id %u\n", ucode_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
|
|
|
@ -446,6 +446,14 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev,
|
|||
|
||||
entry.ih = ih;
|
||||
entry.iv_entry = (const uint32_t *)&ih->ring[ring_index];
|
||||
|
||||
/*
|
||||
* timestamp is not supported on some legacy SOCs (cik, cz, iceland,
|
||||
* si and tonga), so initialize timestamp and timestamp_src to 0
|
||||
*/
|
||||
entry.timestamp = 0;
|
||||
entry.timestamp_src = 0;
|
||||
|
||||
amdgpu_ih_decode_iv(adev, &entry);
|
||||
|
||||
trace_amdgpu_iv(ih - &adev->irq.ih, &entry);
|
||||
|
|
|
@ -742,7 +742,8 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p,
|
|||
uint32_t created = 0;
|
||||
uint32_t allocated = 0;
|
||||
uint32_t tmp, handle = 0;
|
||||
uint32_t *size = &tmp;
|
||||
uint32_t dummy = 0xffffffff;
|
||||
uint32_t *size = &dummy;
|
||||
unsigned int idx;
|
||||
int i, r = 0;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ static int sienna_cichlid_mode2_suspend_ip(struct amdgpu_device *adev)
|
|||
adev->ip_blocks[i].status.hw = false;
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -264,7 +264,7 @@ static u32 dm_vblank_get_counter(struct amdgpu_device *adev, int crtc)
|
|||
static int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc,
|
||||
u32 *vbl, u32 *position)
|
||||
{
|
||||
u32 v_blank_start, v_blank_end, h_position, v_position;
|
||||
u32 v_blank_start = 0, v_blank_end = 0, h_position = 0, v_position = 0;
|
||||
struct amdgpu_crtc *acrtc = NULL;
|
||||
|
||||
if ((crtc < 0) || (crtc >= adev->mode_info.num_crtc))
|
||||
|
@ -801,7 +801,7 @@ static void dm_handle_hpd_work(struct work_struct *work)
|
|||
*/
|
||||
static void dm_dmub_outbox1_low_irq(void *interrupt_params)
|
||||
{
|
||||
struct dmub_notification notify;
|
||||
struct dmub_notification notify = {0};
|
||||
struct common_irq_params *irq_params = interrupt_params;
|
||||
struct amdgpu_device *adev = irq_params->adev;
|
||||
struct amdgpu_display_manager *dm = &adev->dm;
|
||||
|
@ -6899,7 +6899,7 @@ static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state,
|
|||
struct amdgpu_dm_connector *aconnector;
|
||||
struct dm_connector_state *dm_conn_state;
|
||||
int i, j, ret;
|
||||
int vcpi, pbn_div, pbn, slot_num = 0;
|
||||
int vcpi, pbn_div, pbn = 0, slot_num = 0;
|
||||
|
||||
for_each_new_connector_in_state(state, connector, new_con_state, i) {
|
||||
|
||||
|
@ -10070,7 +10070,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
|
|||
struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
|
||||
struct drm_dp_mst_topology_mgr *mgr;
|
||||
struct drm_dp_mst_topology_state *mst_state;
|
||||
struct dsc_mst_fairness_vars vars[MAX_PIPES];
|
||||
struct dsc_mst_fairness_vars vars[MAX_PIPES] = {0};
|
||||
|
||||
trace_amdgpu_dm_atomic_check_begin(state);
|
||||
|
||||
|
|
|
@ -1219,7 +1219,7 @@ static ssize_t dp_sdp_message_debugfs_write(struct file *f, const char __user *b
|
|||
size_t size, loff_t *pos)
|
||||
{
|
||||
int r;
|
||||
uint8_t data[36];
|
||||
uint8_t data[36] = {0};
|
||||
struct amdgpu_dm_connector *connector = file_inode(f)->i_private;
|
||||
struct dm_crtc_state *acrtc_state;
|
||||
uint32_t write_size = 36;
|
||||
|
@ -2929,7 +2929,7 @@ static int psr_read_residency(void *data, u64 *val)
|
|||
{
|
||||
struct amdgpu_dm_connector *connector = data;
|
||||
struct dc_link *link = connector->dc_link;
|
||||
u32 residency;
|
||||
u32 residency = 0;
|
||||
|
||||
link->dc->link_srv->edp_get_psr_residency(link, &residency);
|
||||
|
||||
|
|
|
@ -2385,6 +2385,9 @@ static struct audio *find_first_free_audio(
|
|||
{
|
||||
int i, available_audio_count;
|
||||
|
||||
if (id == ENGINE_ID_UNKNOWN)
|
||||
return NULL;
|
||||
|
||||
available_audio_count = pool->audio_count;
|
||||
|
||||
for (i = 0; i < available_audio_count; i++) {
|
||||
|
|
|
@ -211,8 +211,12 @@ bool dce110_vblank_set(struct irq_service *irq_service,
|
|||
info->ext_id);
|
||||
uint8_t pipe_offset = dal_irq_src - IRQ_TYPE_VBLANK;
|
||||
|
||||
struct timing_generator *tg =
|
||||
dc->current_state->res_ctx.pipe_ctx[pipe_offset].stream_res.tg;
|
||||
struct timing_generator *tg;
|
||||
|
||||
if (pipe_offset >= MAX_PIPES)
|
||||
return false;
|
||||
|
||||
tg = dc->current_state->res_ctx.pipe_ctx[pipe_offset].stream_res.tg;
|
||||
|
||||
if (enable) {
|
||||
if (!tg || !tg->funcs->arm_vert_intr(tg, 2)) {
|
||||
|
|
|
@ -158,6 +158,10 @@ static enum mod_hdcp_status read(struct mod_hdcp *hdcp,
|
|||
uint32_t cur_size = 0;
|
||||
uint32_t data_offset = 0;
|
||||
|
||||
if (msg_id == MOD_HDCP_MESSAGE_ID_INVALID) {
|
||||
return MOD_HDCP_STATUS_DDC_FAILURE;
|
||||
}
|
||||
|
||||
if (is_dp_hdcp(hdcp)) {
|
||||
while (buf_len > 0) {
|
||||
cur_size = MIN(buf_len, HDCP_MAX_AUX_TRANSACTION_SIZE);
|
||||
|
@ -217,6 +221,10 @@ static enum mod_hdcp_status write(struct mod_hdcp *hdcp,
|
|||
uint32_t cur_size = 0;
|
||||
uint32_t data_offset = 0;
|
||||
|
||||
if (msg_id == MOD_HDCP_MESSAGE_ID_INVALID) {
|
||||
return MOD_HDCP_STATUS_DDC_FAILURE;
|
||||
}
|
||||
|
||||
if (is_dp_hdcp(hdcp)) {
|
||||
while (buf_len > 0) {
|
||||
cur_size = MIN(buf_len, HDCP_MAX_AUX_TRANSACTION_SIZE);
|
||||
|
|
|
@ -702,7 +702,7 @@ struct atom_gpio_pin_lut_v2_1
|
|||
{
|
||||
struct atom_common_table_header table_header;
|
||||
/*the real number of this included in the structure is calcualted by using the (whole structure size - the header size)/size of atom_gpio_pin_lut */
|
||||
struct atom_gpio_pin_assignment gpio_pin[8];
|
||||
struct atom_gpio_pin_assignment gpio_pin[];
|
||||
};
|
||||
|
||||
|
||||
|
@ -3551,7 +3551,7 @@ struct atom_gpio_voltage_object_v4
|
|||
uint8_t phase_delay_us; // phase delay in unit of micro second
|
||||
uint8_t reserved;
|
||||
uint32_t gpio_mask_val; // GPIO Mask value
|
||||
struct atom_voltage_gpio_map_lut voltage_gpio_lut[1];
|
||||
struct atom_voltage_gpio_map_lut voltage_gpio_lut[] __counted_by(gpio_entry_num);
|
||||
};
|
||||
|
||||
struct atom_svid2_voltage_object_v4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: apldcp.c,v 1.1 2024/01/22 18:54:01 kettenis Exp $ */
|
||||
/* $OpenBSD: apldcp.c,v 1.2 2024/07/12 10:01:28 tobhe Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2023 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/pool.h>
|
||||
|
||||
#include <machine/intr.h>
|
||||
#include <machine/bus.h>
|
||||
|
@ -103,14 +104,19 @@ apldcp_activate(struct device *self, int act)
|
|||
|
||||
#include <arm64/dev/rtkit.h>
|
||||
|
||||
struct apple_rtkit_ep {
|
||||
struct apple_rtkit *rtk;
|
||||
uint8_t ep;
|
||||
|
||||
struct apple_rtkit_task {
|
||||
struct apple_rtkit_ep *rtkep;
|
||||
struct task task;
|
||||
uint64_t msg;
|
||||
};
|
||||
|
||||
struct apple_rtkit_ep {
|
||||
struct apple_rtkit *rtk;
|
||||
uint8_t ep;
|
||||
};
|
||||
|
||||
static struct pool rtktask_pool;
|
||||
|
||||
struct apple_rtkit {
|
||||
struct rtkit_state *state;
|
||||
struct apple_rtkit_ep ep[64];
|
||||
|
@ -170,10 +176,12 @@ apple_rtkit_logmap(void *cookie, bus_addr_t addr)
|
|||
void
|
||||
apple_rtkit_do_recv(void *arg)
|
||||
{
|
||||
struct apple_rtkit_ep *rtkep = arg;
|
||||
struct apple_rtkit_task *rtktask = arg;
|
||||
struct apple_rtkit_ep *rtkep = rtktask->rtkep;
|
||||
struct apple_rtkit *rtk = rtkep->rtk;
|
||||
|
||||
rtk->ops->recv_message(rtk->cookie, rtkep->ep, rtkep->msg);
|
||||
rtk->ops->recv_message(rtk->cookie, rtkep->ep, rtktask->msg);
|
||||
pool_put(&rtktask_pool, rtktask);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -181,9 +189,15 @@ apple_rtkit_recv(void *cookie, uint64_t msg)
|
|||
{
|
||||
struct apple_rtkit_ep *rtkep = cookie;
|
||||
struct apple_rtkit *rtk = rtkep->rtk;
|
||||
struct apple_rtkit_task *rtktask;
|
||||
|
||||
rtkep->msg = msg;
|
||||
task_add(rtk->tq, &rtkep->task);
|
||||
rtktask = pool_get(&rtktask_pool, PR_NOWAIT | PR_ZERO);
|
||||
KASSERT(rtktask != NULL);
|
||||
|
||||
rtktask->rtkep = rtkep;
|
||||
rtktask->msg = msg;
|
||||
task_set(&rtktask->task, apple_rtkit_do_recv, rtktask);
|
||||
task_add(rtk->tq, &rtktask->task);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -195,8 +209,6 @@ apple_rtkit_start_ep(struct apple_rtkit *rtk, uint8_t ep)
|
|||
rtkep = &rtk->ep[ep];
|
||||
rtkep->rtk = rtk;
|
||||
rtkep->ep = ep;
|
||||
task_set(&rtkep->task, apple_rtkit_do_recv, rtkep);
|
||||
|
||||
error = rtkit_start_endpoint(rtk->state, ep, apple_rtkit_recv, rtkep);
|
||||
return -error;
|
||||
}
|
||||
|
@ -239,6 +251,9 @@ devm_apple_rtkit_init(struct device *dev, void *cookie,
|
|||
return ERR_PTR(ENOMEM);
|
||||
}
|
||||
|
||||
pool_init(&rtktask_pool, sizeof(struct apple_rtkit_task), 0, IPL_TTY,
|
||||
0, "apldcp_rtkit", NULL);
|
||||
|
||||
rk = malloc(sizeof(*rk), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
rk->rk_cookie = rtk;
|
||||
rk->rk_dmat = pdev->dmat;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <linux/pseudo_fs.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/srcu.h>
|
||||
#include <linux/suspend.h>
|
||||
|
||||
#include <drm/drm_accel.h>
|
||||
#include <drm/drm_cache.h>
|
||||
|
@ -1548,10 +1549,19 @@ drm_activate(struct device *self, int act)
|
|||
|
||||
switch (act) {
|
||||
case DVACT_QUIESCE:
|
||||
#ifdef CONFIG_ACPI
|
||||
if (acpi_softc && acpi_softc->sc_state == ACPI_STATE_S3)
|
||||
pm_suspend_target_state = PM_SUSPEND_MEM;
|
||||
else
|
||||
pm_suspend_target_state = PM_SUSPEND_TO_IDLE;
|
||||
#else
|
||||
pm_suspend_target_state = PM_SUSPEND_TO_IDLE;
|
||||
#endif
|
||||
drm_quiesce(dev);
|
||||
break;
|
||||
case DVACT_WAKEUP:
|
||||
drm_wakeup(dev);
|
||||
pm_suspend_target_state = PM_SUSPEND_ON;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: drm_linux.c,v 1.114 2024/06/13 18:05:54 kettenis Exp $ */
|
||||
/* $OpenBSD: drm_linux.c,v 1.115 2024/07/13 15:38:21 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
|
||||
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include <linux/kthread.h>
|
||||
#include <linux/processor.h>
|
||||
#include <linux/sync_file.h>
|
||||
#include <linux/suspend.h>
|
||||
|
||||
#include <drm/drm_device.h>
|
||||
#include <drm/drm_connector.h>
|
||||
|
@ -1345,6 +1346,8 @@ vga_put(struct pci_dev *pdev, int rsrc)
|
|||
|
||||
#endif
|
||||
|
||||
suspend_state_t pm_suspend_target_state;
|
||||
|
||||
/*
|
||||
* ACPI types and interfaces.
|
||||
*/
|
||||
|
@ -1360,6 +1363,8 @@ vga_put(struct pci_dev *pdev, int rsrc)
|
|||
#include <dev/acpi/amltypes.h>
|
||||
#include <dev/acpi/dsdt.h>
|
||||
|
||||
struct acpi_fadt acpi_gbl_FADT;
|
||||
|
||||
acpi_status
|
||||
acpi_get_table(const char *sig, int instance,
|
||||
struct acpi_table_header **hdr)
|
||||
|
@ -2851,6 +2856,13 @@ drm_linux_init(void)
|
|||
|
||||
kmap_atomic_va =
|
||||
(vaddr_t)km_alloc(PAGE_SIZE, &kv_any, &kp_none, &kd_waitok);
|
||||
|
||||
#if NACPI > 0
|
||||
if (acpi_softc) {
|
||||
memcpy(&acpi_gbl_FADT, acpi_softc->sc_fadt,
|
||||
sizeof(acpi_gbl_FADT));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -427,6 +427,13 @@ static const struct dmi_system_id orientation_data[] = {
|
|||
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
|
||||
},
|
||||
.driver_data = (void *)&lcd800x1280_rightside_up,
|
||||
}, { /* Valve Steam Deck */
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galileo"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
|
||||
},
|
||||
.driver_data = (void *)&lcd800x1280_rightside_up,
|
||||
}, { /* VIOS LTH17 */
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
|
||||
|
|
|
@ -326,7 +326,6 @@ void intel_gt_suspend_prepare(struct intel_gt *gt)
|
|||
wait_for_suspend(gt);
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
static suspend_state_t pm_suspend_target(void)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_SUSPEND) && IS_ENABLED(CONFIG_PM_SLEEP)
|
||||
|
@ -335,7 +334,6 @@ static suspend_state_t pm_suspend_target(void)
|
|||
return PM_SUSPEND_TO_IDLE;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void intel_gt_suspend_late(struct intel_gt *gt)
|
||||
{
|
||||
|
@ -361,10 +359,8 @@ void intel_gt_suspend_late(struct intel_gt *gt)
|
|||
* powermanagement enabled, but we also retain system state and so
|
||||
* it remains safe to keep on using our allocated memory.
|
||||
*/
|
||||
#ifdef notyet
|
||||
if (pm_suspend_target() == PM_SUSPEND_TO_IDLE)
|
||||
return;
|
||||
#endif
|
||||
|
||||
with_intel_runtime_pm(gt->uncore->rpm, wakeref) {
|
||||
intel_rps_disable(>->rps);
|
||||
|
|
|
@ -93,5 +93,6 @@
|
|||
#endif
|
||||
|
||||
#if defined(SUSPEND) || defined(HIBERNATE)
|
||||
#define CONFIG_SUSPEND 1
|
||||
#define CONFIG_PM_SLEEP 1
|
||||
#endif
|
||||
|
|
|
@ -88,4 +88,7 @@ int unregister_acpi_notifier(struct notifier_block *);
|
|||
|
||||
int acpi_target_system_state(void);
|
||||
|
||||
extern struct acpi_fadt acpi_gbl_FADT;
|
||||
#define ACPI_FADT_LOW_POWER_S0 (1 << 21)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/* Public domain. */
|
||||
|
||||
#ifndef _LINUX_SUSPEND_H
|
||||
#define _LINUX_SUSPEND_H
|
||||
|
||||
typedef int suspend_state_t;
|
||||
|
||||
#define PM_SUSPEND_ON 0
|
||||
#define PM_SUSPEND_MEM 1
|
||||
#define PM_SUSPEND_TO_IDLE 2
|
||||
|
||||
extern suspend_state_t pm_suspend_target_state;
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_bwfm_pci.c,v 1.76 2024/05/24 06:02:53 jsg Exp $ */
|
||||
/* $OpenBSD: if_bwfm_pci.c,v 1.77 2024/07/12 08:33:25 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2010-2016 Broadcom Corporation
|
||||
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
|
||||
|
@ -126,6 +126,10 @@ struct bwfm_pci_softc {
|
|||
bus_space_handle_t sc_reg_ioh;
|
||||
bus_size_t sc_reg_ios;
|
||||
|
||||
bus_space_tag_t sc_pcie_iot;
|
||||
bus_space_handle_t sc_pcie_ioh;
|
||||
bus_size_t sc_pcie_ios;
|
||||
|
||||
bus_space_tag_t sc_tcm_iot;
|
||||
bus_space_handle_t sc_tcm_ioh;
|
||||
bus_size_t sc_tcm_ios;
|
||||
|
@ -371,6 +375,10 @@ bwfm_pci_attach(struct device *parent, struct device *self, void *aux)
|
|||
goto bar1;
|
||||
}
|
||||
|
||||
sc->sc_pcie_iot = sc->sc_reg_iot;
|
||||
bus_space_subregion(sc->sc_reg_iot, sc->sc_reg_ioh, 0x2000,
|
||||
sc->sc_reg_ios - 0x2000, &sc->sc_pcie_ioh);
|
||||
|
||||
sc->sc_pc = pa->pa_pc;
|
||||
sc->sc_tag = pa->pa_tag;
|
||||
sc->sc_id = pa->pa_id;
|
||||
|
@ -450,11 +458,11 @@ bwfm_pci_preinit(struct bwfm_softc *bwfm)
|
|||
#endif
|
||||
|
||||
bwfm_pci_select_core(sc, BWFM_AGENT_CORE_PCIE2);
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_CONFIGADDR, 0x4e0);
|
||||
reg = bus_space_read_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
reg = bus_space_read_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_CONFIGDATA);
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_CONFIGDATA, reg);
|
||||
|
||||
switch (bwfm->sc_chip.ch_chip) {
|
||||
|
@ -1430,10 +1438,10 @@ bwfm_pci_ring_bell(struct bwfm_pci_softc *sc,
|
|||
struct bwfm_pci_msgring *ring)
|
||||
{
|
||||
if (sc->sc_shared_flags & BWFM_SHARED_INFO_SHARED_DAR)
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_64_PCIE2REG_H2D_MAILBOX_0, 1);
|
||||
else
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_H2D_MAILBOX_0, 1);
|
||||
}
|
||||
|
||||
|
@ -1881,13 +1889,13 @@ bwfm_pci_buscore_reset(struct bwfm_softc *bwfm)
|
|||
};
|
||||
|
||||
for (i = 0; i < nitems(cfg_offset); i++) {
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_CONFIGADDR, cfg_offset[i]);
|
||||
reg = bus_space_read_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
reg = bus_space_read_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_CONFIGDATA);
|
||||
DPRINTFN(3, ("%s: config offset 0x%04x, value 0x%04x\n",
|
||||
DEVNAME(sc), cfg_offset[i], reg));
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_CONFIGDATA, reg);
|
||||
}
|
||||
}
|
||||
|
@ -2381,11 +2389,11 @@ void
|
|||
bwfm_pci_intr_enable(struct bwfm_pci_softc *sc)
|
||||
{
|
||||
if (sc->sc_pcireg64)
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_64_PCIE2REG_MAILBOXMASK,
|
||||
BWFM_PCI_64_PCIE2REG_MAILBOXMASK_INT_D2H_DB);
|
||||
else
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_MAILBOXMASK,
|
||||
BWFM_PCI_PCIE2REG_MAILBOXMASK_INT_FN0_0 |
|
||||
BWFM_PCI_PCIE2REG_MAILBOXMASK_INT_FN0_1 |
|
||||
|
@ -2396,10 +2404,10 @@ void
|
|||
bwfm_pci_intr_disable(struct bwfm_pci_softc *sc)
|
||||
{
|
||||
if (sc->sc_pcireg64)
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_64_PCIE2REG_MAILBOXMASK, 0);
|
||||
else
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_MAILBOXMASK, 0);
|
||||
}
|
||||
|
||||
|
@ -2407,10 +2415,10 @@ uint32_t
|
|||
bwfm_pci_intr_status(struct bwfm_pci_softc *sc)
|
||||
{
|
||||
if (sc->sc_pcireg64)
|
||||
return bus_space_read_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
return bus_space_read_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_64_PCIE2REG_MAILBOXINT);
|
||||
else
|
||||
return bus_space_read_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
return bus_space_read_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_MAILBOXINT);
|
||||
}
|
||||
|
||||
|
@ -2418,10 +2426,10 @@ void
|
|||
bwfm_pci_intr_ack(struct bwfm_pci_softc *sc, uint32_t status)
|
||||
{
|
||||
if (sc->sc_pcireg64)
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_64_PCIE2REG_MAILBOXINT, status);
|
||||
else
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_MAILBOXINT, status);
|
||||
}
|
||||
|
||||
|
@ -2429,10 +2437,10 @@ uint32_t
|
|||
bwfm_pci_intmask(struct bwfm_pci_softc *sc)
|
||||
{
|
||||
if (sc->sc_pcireg64)
|
||||
return bus_space_read_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
return bus_space_read_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_64_PCIE2REG_INTMASK);
|
||||
else
|
||||
return bus_space_read_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
return bus_space_read_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_INTMASK);
|
||||
}
|
||||
|
||||
|
@ -2443,10 +2451,10 @@ bwfm_pci_hostready(struct bwfm_pci_softc *sc)
|
|||
return;
|
||||
|
||||
if (sc->sc_shared_flags & BWFM_SHARED_INFO_SHARED_DAR)
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_64_PCIE2REG_H2D_MAILBOX_1, 1);
|
||||
else
|
||||
bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
|
||||
bus_space_write_4(sc->sc_pcie_iot, sc->sc_pcie_ioh,
|
||||
BWFM_PCI_PCIE2REG_H2D_MAILBOX_1, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: uipc_socket.c,v 1.336 2024/06/14 08:32:22 mvs Exp $ */
|
||||
/* $OpenBSD: uipc_socket.c,v 1.337 2024/07/12 17:20:18 mvs Exp $ */
|
||||
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -158,9 +158,8 @@ soalloc(const struct protosw *prp, int wait)
|
|||
case AF_INET6:
|
||||
switch (prp->pr_type) {
|
||||
case SOCK_RAW:
|
||||
so->so_snd.sb_flags |= SB_MTXLOCK;
|
||||
/* FALLTHROUGH */
|
||||
case SOCK_DGRAM:
|
||||
so->so_snd.sb_flags |= SB_MTXLOCK;
|
||||
so->so_rcv.sb_flags |= SB_MTXLOCK;
|
||||
break;
|
||||
}
|
||||
|
@ -628,7 +627,7 @@ restart:
|
|||
} else if (addr == NULL)
|
||||
snderr(EDESTADDRREQ);
|
||||
}
|
||||
space = sbspace(so, &so->so_snd);
|
||||
space = sbspace_locked(so, &so->so_snd);
|
||||
if (flags & MSG_OOB)
|
||||
space += 1024;
|
||||
if (so->so_proto->pr_domain->dom_family == AF_UNIX) {
|
||||
|
@ -1414,9 +1413,12 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv)
|
|||
|
||||
/* Splice so and sosp together. */
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
mtx_enter(&sosp->so_snd.sb_mtx);
|
||||
so->so_sp->ssp_socket = sosp;
|
||||
sosp->so_sp->ssp_soback = so;
|
||||
mtx_leave(&sosp->so_snd.sb_mtx);
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
|
||||
so->so_splicelen = 0;
|
||||
so->so_splicemax = max;
|
||||
if (tv)
|
||||
|
@ -1432,9 +1434,11 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv)
|
|||
*/
|
||||
if (somove(so, M_WAIT)) {
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
mtx_enter(&sosp->so_snd.sb_mtx);
|
||||
so->so_rcv.sb_flags |= SB_SPLICE;
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
sosp->so_snd.sb_flags |= SB_SPLICE;
|
||||
mtx_leave(&sosp->so_snd.sb_mtx);
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
}
|
||||
|
||||
release:
|
||||
|
@ -1454,11 +1458,13 @@ sounsplice(struct socket *so, struct socket *sosp, int freeing)
|
|||
|
||||
task_del(sosplice_taskq, &so->so_splicetask);
|
||||
timeout_del(&so->so_idleto);
|
||||
sosp->so_snd.sb_flags &= ~SB_SPLICE;
|
||||
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
mtx_enter(&sosp->so_snd.sb_mtx);
|
||||
so->so_rcv.sb_flags &= ~SB_SPLICE;
|
||||
sosp->so_snd.sb_flags &= ~SB_SPLICE;
|
||||
so->so_sp->ssp_socket = sosp->so_sp->ssp_soback = NULL;
|
||||
mtx_leave(&sosp->so_snd.sb_mtx);
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
|
||||
/* Do not wakeup a socket that is about to be freed. */
|
||||
|
@ -1571,21 +1577,26 @@ somove(struct socket *so, int wait)
|
|||
maxreached = 1;
|
||||
}
|
||||
}
|
||||
space = sbspace(sosp, &sosp->so_snd);
|
||||
mtx_enter(&sosp->so_snd.sb_mtx);
|
||||
space = sbspace_locked(sosp, &sosp->so_snd);
|
||||
if (so->so_oobmark && so->so_oobmark < len &&
|
||||
so->so_oobmark < space + 1024)
|
||||
space += 1024;
|
||||
if (space <= 0) {
|
||||
mtx_leave(&sosp->so_snd.sb_mtx);
|
||||
maxreached = 0;
|
||||
goto release;
|
||||
}
|
||||
if (space < len) {
|
||||
maxreached = 0;
|
||||
if (space < sosp->so_snd.sb_lowat)
|
||||
if (space < sosp->so_snd.sb_lowat) {
|
||||
mtx_leave(&sosp->so_snd.sb_mtx);
|
||||
goto release;
|
||||
}
|
||||
len = space;
|
||||
}
|
||||
sosp->so_snd.sb_state |= SS_ISSENDING;
|
||||
mtx_leave(&sosp->so_snd.sb_mtx);
|
||||
|
||||
SBLASTRECORDCHK(&so->so_rcv, "somove 1");
|
||||
SBLASTMBUFCHK(&so->so_rcv, "somove 1");
|
||||
|
@ -1780,9 +1791,12 @@ somove(struct socket *so, int wait)
|
|||
}
|
||||
}
|
||||
|
||||
mtx_enter(&sosp->so_snd.sb_mtx);
|
||||
/* Append all remaining data to drain socket. */
|
||||
if (so->so_rcv.sb_cc == 0 || maxreached)
|
||||
sosp->so_snd.sb_state &= ~SS_ISSENDING;
|
||||
mtx_leave(&sosp->so_snd.sb_mtx);
|
||||
|
||||
error = pru_send(sosp, m, NULL, NULL);
|
||||
if (error) {
|
||||
if (sosp->so_snd.sb_state & SS_CANTSENDMORE)
|
||||
|
@ -1796,7 +1810,10 @@ somove(struct socket *so, int wait)
|
|||
goto nextpkt;
|
||||
|
||||
release:
|
||||
mtx_enter(&sosp->so_snd.sb_mtx);
|
||||
sosp->so_snd.sb_state &= ~SS_ISSENDING;
|
||||
mtx_leave(&sosp->so_snd.sb_mtx);
|
||||
|
||||
if (!error && maxreached && so->so_splicemax == so->so_splicelen)
|
||||
error = EFBIG;
|
||||
if (error)
|
||||
|
@ -2346,7 +2363,7 @@ filt_sowrite(struct knote *kn, long hint)
|
|||
if ((so->so_snd.sb_flags & SB_MTXLOCK) == 0)
|
||||
soassertlocked_readonly(so);
|
||||
|
||||
kn->kn_data = sbspace(so, &so->so_snd);
|
||||
kn->kn_data = sbspace_locked(so, &so->so_snd);
|
||||
if (so->so_snd.sb_state & SS_CANTSENDMORE) {
|
||||
kn->kn_flags |= EV_EOF;
|
||||
if (kn->kn_flags & __EV_POLL) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: uipc_socket2.c,v 1.156 2024/06/28 21:30:24 mvs Exp $ */
|
||||
/* $OpenBSD: uipc_socket2.c,v 1.158 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -365,7 +365,7 @@ solock_shared(struct socket *so)
|
|||
switch (so->so_proto->pr_domain->dom_family) {
|
||||
case PF_INET:
|
||||
case PF_INET6:
|
||||
if (so->so_proto->pr_usrreqs->pru_lock != NULL) {
|
||||
if (ISSET(so->so_proto->pr_flags, PR_MPSOCKET)) {
|
||||
NET_LOCK_SHARED();
|
||||
rw_enter_write(&so->so_lock);
|
||||
} else
|
||||
|
@ -425,7 +425,7 @@ sounlock_shared(struct socket *so)
|
|||
switch (so->so_proto->pr_domain->dom_family) {
|
||||
case PF_INET:
|
||||
case PF_INET6:
|
||||
if (so->so_proto->pr_usrreqs->pru_unlock != NULL) {
|
||||
if (ISSET(so->so_proto->pr_flags, PR_MPSOCKET)) {
|
||||
rw_exit_write(&so->so_lock);
|
||||
NET_UNLOCK_SHARED();
|
||||
} else
|
||||
|
@ -460,7 +460,7 @@ soassertlocked(struct socket *so)
|
|||
if (rw_status(&netlock) == RW_READ) {
|
||||
NET_ASSERT_LOCKED();
|
||||
|
||||
if (splassert_ctl > 0 && pru_locked(so) == 0 &&
|
||||
if (splassert_ctl > 0 &&
|
||||
rw_status(&so->so_lock) != RW_WRITE)
|
||||
splassert_fail(0, RW_WRITE, __func__);
|
||||
} else
|
||||
|
@ -481,12 +481,12 @@ sosleep_nsec(struct socket *so, void *ident, int prio, const char *wmesg,
|
|||
switch (so->so_proto->pr_domain->dom_family) {
|
||||
case PF_INET:
|
||||
case PF_INET6:
|
||||
if (so->so_proto->pr_usrreqs->pru_unlock != NULL &&
|
||||
if (ISSET(so->so_proto->pr_flags, PR_MPSOCKET) &&
|
||||
rw_status(&netlock) == RW_READ) {
|
||||
rw_exit_write(&so->so_lock);
|
||||
}
|
||||
ret = rwsleep_nsec(ident, &netlock, prio, wmesg, nsecs);
|
||||
if (so->so_proto->pr_usrreqs->pru_lock != NULL &&
|
||||
if (ISSET(so->so_proto->pr_flags, PR_MPSOCKET) &&
|
||||
rw_status(&netlock) == RW_READ) {
|
||||
rw_enter_write(&so->so_lock);
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ sbappendaddr(struct socket *so, struct sockbuf *sb, const struct sockaddr *asa,
|
|||
if (n->m_next == NULL) /* keep pointer to last control buf */
|
||||
break;
|
||||
}
|
||||
if (space > sbspace(so, sb))
|
||||
if (space > sbspace_locked(so, sb))
|
||||
return (0);
|
||||
if (asa->sa_len > MLEN)
|
||||
return (0);
|
||||
|
@ -984,7 +984,7 @@ sbappendcontrol(struct socket *so, struct sockbuf *sb, struct mbuf *m0,
|
|||
m->m_flags &= ~M_EOR;
|
||||
}
|
||||
}
|
||||
if (space > sbspace(so, sb))
|
||||
if (space > sbspace_locked(so, sb))
|
||||
return (0);
|
||||
n->m_next = m0; /* concatenate data to control */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: vfs_subr.c,v 1.320 2024/07/05 05:42:08 jsg Exp $ */
|
||||
/* $OpenBSD: vfs_subr.c,v 1.322 2024/07/13 14:37:55 beck Exp $ */
|
||||
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: fifo_vnops.c,v 1.106 2024/06/28 21:30:24 mvs Exp $ */
|
||||
/* $OpenBSD: fifo_vnops.c,v 1.107 2024/07/12 17:20:18 mvs Exp $ */
|
||||
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -564,7 +564,7 @@ filt_fifowrite(struct knote *kn, long hint)
|
|||
|
||||
MUTEX_ASSERT_LOCKED(&so->so_snd.sb_mtx);
|
||||
|
||||
kn->kn_data = sbspace(so, &so->so_snd);
|
||||
kn->kn_data = sbspace_locked(so, &so->so_snd);
|
||||
if (so->so_snd.sb_state & SS_CANTSENDMORE) {
|
||||
kn->kn_flags |= EV_EOF;
|
||||
rv = 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pf.c,v 1.1201 2024/07/04 12:50:08 bluhm Exp $ */
|
||||
/* $OpenBSD: pf.c,v 1.1202 2024/07/12 09:25:27 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Daniel Hartmeier
|
||||
|
@ -7966,7 +7966,7 @@ done:
|
|||
if (pd.dir == PF_IN) {
|
||||
int flags = IP_REDIRECT;
|
||||
|
||||
switch (ip_forwarding) {
|
||||
switch (atomic_load_int(&ip_forwarding)) {
|
||||
case 2:
|
||||
SET(flags, IP_FORWARDING_IPSEC);
|
||||
/* FALLTHROUGH */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: rtsock.c,v 1.374 2024/06/14 08:32:22 mvs Exp $ */
|
||||
/* $OpenBSD: rtsock.c,v 1.375 2024/07/12 17:20:18 mvs Exp $ */
|
||||
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -316,7 +316,7 @@ route_rcvd(struct socket *so)
|
|||
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
if (((rop->rop_flags & ROUTECB_FLAG_FLUSH) != 0) &&
|
||||
((sbspace(so, &so->so_rcv) == so->so_rcv.sb_hiwat)))
|
||||
((sbspace_locked(so, &so->so_rcv) == so->so_rcv.sb_hiwat)))
|
||||
rop->rop_flags &= ~ROUTECB_FLAG_FLUSH;
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ rtm_sendup(struct socket *so, struct mbuf *m0)
|
|||
return (ENOMEM);
|
||||
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
if (sbspace(so, &so->so_rcv) < (2 * MSIZE) ||
|
||||
if (sbspace_locked(so, &so->so_rcv) < (2 * MSIZE) ||
|
||||
sbappendaddr(so, &so->so_rcv, &route_src, m, NULL) == 0)
|
||||
send_desync = 1;
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_pcb.c,v 1.302 2024/04/19 10:13:58 bluhm Exp $ */
|
||||
/* $OpenBSD: in_pcb.c,v 1.303 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -239,7 +239,6 @@ in_pcballoc(struct socket *so, struct inpcbtable *table, int wait)
|
|||
inp->inp_table = table;
|
||||
inp->inp_socket = so;
|
||||
refcnt_init_trace(&inp->inp_refcnt, DT_REFCNT_IDX_INPCB);
|
||||
mtx_init(&inp->inp_mtx, IPL_SOFTNET);
|
||||
inp->inp_seclevel.sl_auth = IPSEC_AUTH_LEVEL_DEFAULT;
|
||||
inp->inp_seclevel.sl_esp_trans = IPSEC_ESP_TRANS_LEVEL_DEFAULT;
|
||||
inp->inp_seclevel.sl_esp_network = IPSEC_ESP_NETWORK_LEVEL_DEFAULT;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_pcb.h,v 1.157 2024/04/19 10:13:58 bluhm Exp $ */
|
||||
/* $OpenBSD: in_pcb.h,v 1.158 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -80,7 +80,6 @@
|
|||
* N net lock
|
||||
* t inpt_mtx pcb table mutex
|
||||
* y inpt_notify pcb table rwlock for notify
|
||||
* p inpcb_mtx pcb mutex
|
||||
* L pf_inp_mtx link pf to inp mutex
|
||||
* s so_lock socket rwlock
|
||||
*/
|
||||
|
@ -94,8 +93,8 @@
|
|||
* needed, so that socket layer input have a consistent view at these
|
||||
* values.
|
||||
*
|
||||
* In soconnect() and sosend() pcb mutex cannot be used. They eventually
|
||||
* can call IP output which takes pf lock which is a sleeping lock.
|
||||
* In soconnect() and sosend() a per pcb mutex cannot be used. They
|
||||
* eventually call IP output which takes pf lock which is a sleeping lock.
|
||||
* Also connect(2) does a route lookup for source selection. There
|
||||
* route resolve happens, which creates a route, which sends a route
|
||||
* message, which needs route lock, which is a rw-lock.
|
||||
|
@ -106,15 +105,9 @@
|
|||
*
|
||||
* So there are three locks. Table mutex is for writing inp_[lf]addr/port
|
||||
* and lookup, socket rw-lock to separate sockets in system calls, and
|
||||
* pcb mutex to protect socket receive buffer. Changing inp_[lf]addr/port
|
||||
* takes both per socket rw-lock and global table mutex. Protocol
|
||||
* input only reads inp_[lf]addr/port during lookup and is safe. System
|
||||
* call only reads when holding socket rw-lock and is safe. The socket
|
||||
* layer needs pcb mutex only in soreceive().
|
||||
*
|
||||
* Function pru_lock() grabs the pcb mutex and its existence indicates
|
||||
* that a protocol is MP safe. Otherwise the exclusive net lock is
|
||||
* used.
|
||||
* socket buffer mutex to protect socket receive buffer. Changing
|
||||
* inp_[lf]addr/port takes both per socket rw-lock and global table mutex.
|
||||
* Protocol input only reads inp_[lf]addr/port during lookup and is safe.
|
||||
*/
|
||||
|
||||
struct pf_state_key;
|
||||
|
@ -149,7 +142,6 @@ struct inpcb {
|
|||
caddr_t inp_ppcb; /* pointer to per-protocol pcb */
|
||||
struct route inp_route; /* cached route */
|
||||
struct refcnt inp_refcnt; /* refcount PCB, delay memory free */
|
||||
struct mutex inp_mtx; /* protect PCB and socket members */
|
||||
int inp_flags; /* generic IP/datagram flags */
|
||||
union { /* Header prototype. */
|
||||
struct ip hu_ip;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_proto.c,v 1.104 2024/04/14 20:46:27 bluhm Exp $ */
|
||||
/* $OpenBSD: in_proto.c,v 1.106 2024/07/13 12:00:11 bluhm Exp $ */
|
||||
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -185,7 +185,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_UDP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_SPLICE,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_SPLICE|PR_MPSOCKET,
|
||||
.pr_input = udp_input,
|
||||
.pr_ctlinput = udp_ctlinput,
|
||||
.pr_ctloutput = ip_ctloutput,
|
||||
|
@ -210,7 +210,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_RAW,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET,
|
||||
.pr_input = rip_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
|
@ -219,7 +219,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_ICMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = icmp_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
|
@ -230,7 +230,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPV4,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
#if NGIF > 0
|
||||
.pr_input = in_gif_input,
|
||||
#else
|
||||
|
@ -246,7 +246,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPV6,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
#if NGIF > 0
|
||||
.pr_input = in_gif_input,
|
||||
#else
|
||||
|
@ -261,7 +261,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_MPLS,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = in_gif_input,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
},
|
||||
|
@ -270,7 +270,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IGMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = igmp_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
|
@ -284,7 +284,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_AH,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = ah46_input,
|
||||
.pr_ctlinput = ah4_ctlinput,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
|
@ -295,7 +295,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_ESP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = esp46_input,
|
||||
.pr_ctlinput = esp4_ctlinput,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
|
@ -306,7 +306,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPCOMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = ipcomp46_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
|
@ -318,7 +318,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_GRE,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = gre_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &gre_usrreqs,
|
||||
|
@ -330,7 +330,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_CARP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = carp_proto_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
|
@ -342,7 +342,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_PFSYNC,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = pfsync_input4,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
|
@ -354,7 +354,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_DIVERT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &divert_usrreqs,
|
||||
.pr_init = divert_init,
|
||||
|
@ -366,7 +366,7 @@ const struct protosw inetsw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_ETHERIP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = ip_etherip_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
|
@ -377,7 +377,7 @@ const struct protosw inetsw[] = {
|
|||
/* raw wildcard */
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET,
|
||||
.pr_input = rip_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_divert.c,v 1.95 2024/03/05 09:45:13 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_divert.c,v 1.96 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
|
||||
|
@ -65,9 +65,6 @@ const struct sysctl_bounded_args divertctl_vars[] = {
|
|||
const struct pr_usrreqs divert_usrreqs = {
|
||||
.pru_attach = divert_attach,
|
||||
.pru_detach = divert_detach,
|
||||
.pru_lock = divert_lock,
|
||||
.pru_unlock = divert_unlock,
|
||||
.pru_locked = divert_locked,
|
||||
.pru_bind = divert_bind,
|
||||
.pru_shutdown = divert_shutdown,
|
||||
.pru_send = divert_send,
|
||||
|
@ -296,32 +293,6 @@ divert_detach(struct socket *so)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
divert_lock(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
mtx_enter(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
divert_unlock(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
mtx_leave(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
int
|
||||
divert_locked(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
return mtx_owned(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
int
|
||||
divert_bind(struct socket *so, struct mbuf *addr, struct proc *p)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_divert.h,v 1.25 2024/02/03 22:50:09 mvs Exp $ */
|
||||
/* $OpenBSD: ip_divert.h,v 1.26 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
|
||||
|
@ -72,9 +72,6 @@ void divert_packet(struct mbuf *, int, u_int16_t);
|
|||
int divert_sysctl(int *, u_int, void *, size_t *, void *, size_t);
|
||||
int divert_attach(struct socket *, int, int);
|
||||
int divert_detach(struct socket *);
|
||||
void divert_lock(struct socket *);
|
||||
void divert_unlock(struct socket *);
|
||||
int divert_locked(struct socket *);
|
||||
int divert_bind(struct socket *, struct mbuf *, struct proc *);
|
||||
int divert_shutdown(struct socket *);
|
||||
int divert_send(struct socket *, struct mbuf *, struct mbuf *,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_gre.c,v 1.87 2023/12/15 00:24:56 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_gre.c,v 1.88 2024/07/13 13:20:44 bluhm Exp $ */
|
||||
/* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -36,10 +36,6 @@
|
|||
* This currently handles IPPROTO_GRE, IPPROTO_MOBILE
|
||||
*/
|
||||
|
||||
|
||||
#include "gre.h"
|
||||
#if NGRE > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
|
@ -114,5 +110,3 @@ gre_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
|
|||
#endif
|
||||
return rip_send(so, m, nam, control);
|
||||
}
|
||||
|
||||
#endif /* if NGRE > 0 */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_icmp.c,v 1.194 2024/06/20 19:25:04 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_icmp.c,v 1.195 2024/07/12 09:25:27 bluhm Exp $ */
|
||||
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -589,7 +589,8 @@ reflect:
|
|||
struct sockaddr_in ssrc;
|
||||
struct rtentry *newrt = NULL;
|
||||
|
||||
if (icmp_rediraccept == 0 || ip_forwarding != 0)
|
||||
if (icmp_rediraccept == 0 ||
|
||||
atomic_load_int(&ip_forwarding) != 0)
|
||||
goto freeit;
|
||||
if (code > 3)
|
||||
goto badcode;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_input.c,v 1.397 2024/07/02 18:33:47 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_input.c,v 1.398 2024/07/12 09:25:27 bluhm Exp $ */
|
||||
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -83,8 +83,15 @@
|
|||
#include <netinet/ip_carp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Locks used to protect global variables in this file:
|
||||
* I immutable after creation
|
||||
* a atomic operations
|
||||
* N net lock
|
||||
*/
|
||||
|
||||
/* values controllable via sysctl */
|
||||
int ip_forwarding = 0;
|
||||
int ip_forwarding = 0; /* [a] */
|
||||
int ipmforwarding = 0;
|
||||
int ipmultipath = 0;
|
||||
int ip_sendredirects = 1;
|
||||
|
@ -108,7 +115,6 @@ const struct sysctl_bounded_args ipctl_vars[] = {
|
|||
#ifdef MROUTING
|
||||
{ IPCTL_MRTPROTO, &ip_mrtproto, SYSCTL_INT_READONLY },
|
||||
#endif
|
||||
{ IPCTL_FORWARDING, &ip_forwarding, 0, 2 },
|
||||
{ IPCTL_SENDREDIRECTS, &ip_sendredirects, 0, 1 },
|
||||
{ IPCTL_DEFTTL, &ip_defttl, 0, 255 },
|
||||
{ IPCTL_DIRECTEDBCAST, &ip_directedbcast, 0, 1 },
|
||||
|
@ -465,7 +471,7 @@ ip_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
|
|||
SET(flags, IP_REDIRECT);
|
||||
#endif
|
||||
|
||||
switch (ip_forwarding) {
|
||||
switch (atomic_load_int(&ip_forwarding)) {
|
||||
case 2:
|
||||
SET(flags, IP_FORWARDING_IPSEC);
|
||||
/* FALLTHROUGH */
|
||||
|
@ -1792,6 +1798,9 @@ ip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
|
|||
atomic_inc_long(&rtgeneration);
|
||||
NET_UNLOCK();
|
||||
return (error);
|
||||
case IPCTL_FORWARDING:
|
||||
return (sysctl_int_bounded(oldp, oldlenp, newp, newlen,
|
||||
&ip_forwarding, 0, 2));
|
||||
default:
|
||||
NET_LOCK();
|
||||
error = sysctl_bounded_arr(ipctl_vars, nitems(ipctl_vars),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_var.h,v 1.119 2024/07/02 18:33:47 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_var.h,v 1.120 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -274,9 +274,6 @@ struct mbuf *
|
|||
rip_chkhdr(struct mbuf *, struct mbuf *);
|
||||
int rip_attach(struct socket *, int, int);
|
||||
int rip_detach(struct socket *);
|
||||
void rip_lock(struct socket *);
|
||||
void rip_unlock(struct socket *);
|
||||
int rip_locked(struct socket *);
|
||||
int rip_bind(struct socket *, struct mbuf *, struct proc *);
|
||||
int rip_connect(struct socket *, struct mbuf *);
|
||||
int rip_disconnect(struct socket *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: raw_ip.c,v 1.159 2024/04/17 20:48:51 bluhm Exp $ */
|
||||
/* $OpenBSD: raw_ip.c,v 1.160 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -106,9 +106,6 @@ struct inpcbtable rawcbtable;
|
|||
const struct pr_usrreqs rip_usrreqs = {
|
||||
.pru_attach = rip_attach,
|
||||
.pru_detach = rip_detach,
|
||||
.pru_lock = rip_lock,
|
||||
.pru_unlock = rip_unlock,
|
||||
.pru_locked = rip_locked,
|
||||
.pru_bind = rip_bind,
|
||||
.pru_connect = rip_connect,
|
||||
.pru_disconnect = rip_disconnect,
|
||||
|
@ -514,32 +511,6 @@ rip_detach(struct socket *so)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
rip_lock(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
mtx_enter(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
rip_unlock(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
mtx_leave(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
int
|
||||
rip_locked(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
return mtx_owned(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
int
|
||||
rip_bind(struct socket *so, struct mbuf *nam, struct proc *p)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: udp_usrreq.c,v 1.320 2024/04/17 20:48:51 bluhm Exp $ */
|
||||
/* $OpenBSD: udp_usrreq.c,v 1.321 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -125,9 +125,6 @@ u_int udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
|
|||
const struct pr_usrreqs udp_usrreqs = {
|
||||
.pru_attach = udp_attach,
|
||||
.pru_detach = udp_detach,
|
||||
.pru_lock = udp_lock,
|
||||
.pru_unlock = udp_unlock,
|
||||
.pru_locked = udp_locked,
|
||||
.pru_bind = udp_bind,
|
||||
.pru_connect = udp_connect,
|
||||
.pru_disconnect = udp_disconnect,
|
||||
|
@ -142,9 +139,6 @@ const struct pr_usrreqs udp_usrreqs = {
|
|||
const struct pr_usrreqs udp6_usrreqs = {
|
||||
.pru_attach = udp_attach,
|
||||
.pru_detach = udp_detach,
|
||||
.pru_lock = udp_lock,
|
||||
.pru_unlock = udp_unlock,
|
||||
.pru_locked = udp_locked,
|
||||
.pru_bind = udp_bind,
|
||||
.pru_connect = udp_connect,
|
||||
.pru_disconnect = udp_disconnect,
|
||||
|
@ -1140,32 +1134,6 @@ udp_detach(struct socket *so)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
udp_lock(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
mtx_enter(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
udp_unlock(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
mtx_leave(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
int
|
||||
udp_locked(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
return mtx_owned(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
int
|
||||
udp_bind(struct socket *so, struct mbuf *addr, struct proc *p)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: udp_var.h,v 1.51 2024/02/03 22:50:09 mvs Exp $ */
|
||||
/* $OpenBSD: udp_var.h,v 1.52 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -145,9 +145,6 @@ int udp6_output(struct inpcb *, struct mbuf *, struct mbuf *,
|
|||
int udp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
|
||||
int udp_attach(struct socket *, int, int);
|
||||
int udp_detach(struct socket *);
|
||||
void udp_lock(struct socket *);
|
||||
void udp_unlock(struct socket *);
|
||||
int udp_locked(struct socket *);
|
||||
int udp_bind(struct socket *, struct mbuf *, struct proc *);
|
||||
int udp_connect(struct socket *, struct mbuf *);
|
||||
int udp_disconnect(struct socket *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in6_proto.c,v 1.114 2024/04/16 12:40:40 bluhm Exp $ */
|
||||
/* $OpenBSD: in6_proto.c,v 1.115 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -136,7 +136,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_UDP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_SPLICE,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_SPLICE|PR_MPSOCKET,
|
||||
.pr_input = udp_input,
|
||||
.pr_ctlinput = udp6_ctlinput,
|
||||
.pr_ctloutput = ip6_ctloutput,
|
||||
|
@ -158,7 +158,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_RAW,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET,
|
||||
.pr_input = rip6_input,
|
||||
.pr_ctlinput = rip6_ctlinput,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
|
@ -169,7 +169,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_ICMPV6,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = icmp6_input,
|
||||
.pr_ctlinput = rip6_ctlinput,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
|
@ -204,7 +204,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_AH,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = ah46_input,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs,
|
||||
|
@ -214,7 +214,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_ESP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = esp46_input,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs,
|
||||
|
@ -224,7 +224,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_IPCOMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = ipcomp46_input,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs,
|
||||
|
@ -235,7 +235,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_IPV4,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
#if NGIF > 0
|
||||
.pr_input = in6_gif_input,
|
||||
#else
|
||||
|
@ -248,7 +248,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_IPV6,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
#if NGIF > 0
|
||||
.pr_input = in6_gif_input,
|
||||
#else
|
||||
|
@ -262,7 +262,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_MPLS,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
#if NGIF > 0
|
||||
.pr_input = in6_gif_input,
|
||||
#else
|
||||
|
@ -277,7 +277,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_CARP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = carp6_proto_input,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs,
|
||||
|
@ -289,7 +289,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_DIVERT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &divert6_usrreqs,
|
||||
.pr_init = divert6_init,
|
||||
|
@ -301,7 +301,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_ETHERIP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = ip6_etherip_input,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs,
|
||||
|
@ -312,7 +312,7 @@ const struct protosw inet6sw[] = {
|
|||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_GRE,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
|
||||
.pr_input = gre_input6,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs,
|
||||
|
@ -322,7 +322,7 @@ const struct protosw inet6sw[] = {
|
|||
/* raw wildcard */
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET,
|
||||
.pr_input = rip6_input,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip6_divert.c,v 1.95 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $OpenBSD: ip6_divert.c,v 1.96 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
|
||||
|
@ -68,9 +68,6 @@ const struct sysctl_bounded_args divert6ctl_vars[] = {
|
|||
const struct pr_usrreqs divert6_usrreqs = {
|
||||
.pru_attach = divert6_attach,
|
||||
.pru_detach = divert_detach,
|
||||
.pru_lock = divert_lock,
|
||||
.pru_unlock = divert_unlock,
|
||||
.pru_locked = divert_locked,
|
||||
.pru_bind = divert_bind,
|
||||
.pru_shutdown = divert_shutdown,
|
||||
.pru_send = divert6_send,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip6_forward.c,v 1.121 2024/07/09 09:33:13 bluhm Exp $ */
|
||||
/* $OpenBSD: ip6_forward.c,v 1.123 2024/07/13 10:09:40 bluhm Exp $ */
|
||||
/* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -45,6 +45,9 @@
|
|||
#include <net/if_var.h>
|
||||
#include <net/if_enc.h>
|
||||
#include <net/route.h>
|
||||
#if NPF > 0
|
||||
#include <net/pfvar.h>
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip_var.h>
|
||||
|
@ -53,20 +56,15 @@
|
|||
#include <netinet6/ip6_var.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include <netinet6/nd6.h>
|
||||
|
||||
#if NPF > 0
|
||||
#include <net/pfvar.h>
|
||||
#endif
|
||||
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcp_timer.h>
|
||||
#include <netinet/tcp_var.h>
|
||||
#ifdef IPSEC
|
||||
#include <netinet/ip_ipsp.h>
|
||||
#include <netinet/ip_ah.h>
|
||||
#include <netinet/ip_esp.h>
|
||||
#include <netinet/udp.h>
|
||||
#endif
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcp_timer.h>
|
||||
#include <netinet/tcp_var.h>
|
||||
|
||||
/*
|
||||
* Forward a packet. If some error occurs return the sender
|
||||
|
@ -145,10 +143,33 @@ ip6_forward(struct mbuf *m, struct route *ro, int flags)
|
|||
* Thanks to M_EXT, in most cases copy will not occur.
|
||||
* For small packets copy original onto stack instead of mbuf.
|
||||
*
|
||||
* For final protocol header like TCP or UDP, full header chain in
|
||||
* ICMP6 packet is not necessary. In this case only copy small
|
||||
* part of original packet and save it on stack instead of mbuf.
|
||||
* Although this violates RFC 4443 2.4. (c), it avoids additional
|
||||
* mbuf allocations. Also pf nat and rdr do not affect the shared
|
||||
* mbuf cluster.
|
||||
*
|
||||
* It is important to save it before IPsec processing as IPsec
|
||||
* processing may modify the mbuf.
|
||||
*/
|
||||
icmp_len = min(m->m_pkthdr.len, ICMPV6_PLD_MAXLEN);
|
||||
switch (ip6->ip6_nxt) {
|
||||
case IPPROTO_TCP:
|
||||
icmp_len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr) +
|
||||
MAX_TCPOPTLEN;
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
icmp_len = sizeof(struct ip6_hdr) + sizeof(struct udphdr);
|
||||
break;
|
||||
case IPPROTO_ESP:
|
||||
icmp_len = sizeof(struct ip6_hdr) + 2 * sizeof(u_int32_t);
|
||||
break;
|
||||
default:
|
||||
icmp_len = ICMPV6_PLD_MAXLEN;
|
||||
break;
|
||||
}
|
||||
if (icmp_len > m->m_pkthdr.len)
|
||||
icmp_len = m->m_pkthdr.len;
|
||||
if (icmp_len <= sizeof(icmp_buf)) {
|
||||
mflags = m->m_flags;
|
||||
pfflags = m->m_pkthdr.pf.flags;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip6_var.h,v 1.119 2024/07/04 12:50:08 bluhm Exp $ */
|
||||
/* $OpenBSD: ip6_var.h,v 1.120 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -354,9 +354,6 @@ int rip6_output(struct mbuf *, struct socket *, struct sockaddr *,
|
|||
struct mbuf *);
|
||||
int rip6_attach(struct socket *, int, int);
|
||||
int rip6_detach(struct socket *);
|
||||
void rip6_lock(struct socket *);
|
||||
void rip6_unlock(struct socket *);
|
||||
int rip6_locked(struct socket *);
|
||||
int rip6_bind(struct socket *, struct mbuf *, struct proc *);
|
||||
int rip6_connect(struct socket *, struct mbuf *);
|
||||
int rip6_disconnect(struct socket *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: raw_ip6.c,v 1.184 2024/04/17 20:48:51 bluhm Exp $ */
|
||||
/* $OpenBSD: raw_ip6.c,v 1.185 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -108,9 +108,6 @@ struct cpumem *rip6counters;
|
|||
const struct pr_usrreqs rip6_usrreqs = {
|
||||
.pru_attach = rip6_attach,
|
||||
.pru_detach = rip6_detach,
|
||||
.pru_lock = rip6_lock,
|
||||
.pru_unlock = rip6_unlock,
|
||||
.pru_locked = rip6_locked,
|
||||
.pru_bind = rip6_bind,
|
||||
.pru_connect = rip6_connect,
|
||||
.pru_disconnect = rip6_disconnect,
|
||||
|
@ -644,32 +641,6 @@ rip6_detach(struct socket *so)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
rip6_lock(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
mtx_enter(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
rip6_unlock(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
mtx_leave(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
int
|
||||
rip6_locked(struct socket *so)
|
||||
{
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
|
||||
return mtx_owned(&inp->inp_mtx);
|
||||
}
|
||||
|
||||
int
|
||||
rip6_bind(struct socket *so, struct mbuf *nam, struct proc *p)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: nfs_socket.c,v 1.150 2024/04/30 17:05:20 miod Exp $ */
|
||||
/* $OpenBSD: nfs_socket.c,v 1.151 2024/07/12 17:20:18 mvs Exp $ */
|
||||
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -374,7 +374,9 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep)
|
|||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
so->so_rcv.sb_flags |= SB_NOINTR;
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
mtx_enter(&so->so_snd.sb_mtx);
|
||||
so->so_snd.sb_flags |= SB_NOINTR;
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
sounlock(so);
|
||||
|
||||
m_freem(mopt);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: protosw.h,v 1.66 2024/04/14 20:46:27 bluhm Exp $ */
|
||||
/* $OpenBSD: protosw.h,v 1.67 2024/07/12 19:50:35 bluhm Exp $ */
|
||||
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -67,9 +67,6 @@ struct ifnet;
|
|||
struct pr_usrreqs {
|
||||
int (*pru_attach)(struct socket *, int, int);
|
||||
int (*pru_detach)(struct socket *);
|
||||
void (*pru_lock)(struct socket *);
|
||||
void (*pru_unlock)(struct socket *);
|
||||
int (*pru_locked)(struct socket *so);
|
||||
int (*pru_bind)(struct socket *, struct mbuf *, struct proc *);
|
||||
int (*pru_listen)(struct socket *);
|
||||
int (*pru_connect)(struct socket *, struct mbuf *);
|
||||
|
@ -133,6 +130,7 @@ struct protosw {
|
|||
socket */
|
||||
#define PR_SPLICE 0x0040 /* socket splicing is possible */
|
||||
#define PR_MPINPUT 0x0080 /* input runs with shared netlock */
|
||||
#define PR_MPSOCKET 0x0100 /* socket uses shared netlock */
|
||||
|
||||
/*
|
||||
* The arguments to usrreq are:
|
||||
|
@ -284,28 +282,6 @@ pru_detach(struct socket *so)
|
|||
return (*so->so_proto->pr_usrreqs->pru_detach)(so);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pru_lock(struct socket *so)
|
||||
{
|
||||
if (so->so_proto->pr_usrreqs->pru_lock)
|
||||
(*so->so_proto->pr_usrreqs->pru_lock)(so);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pru_unlock(struct socket *so)
|
||||
{
|
||||
if (so->so_proto->pr_usrreqs->pru_unlock)
|
||||
(*so->so_proto->pr_usrreqs->pru_unlock)(so);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pru_locked(struct socket *so)
|
||||
{
|
||||
if (so->so_proto->pr_usrreqs->pru_locked)
|
||||
return (*so->so_proto->pr_usrreqs->pru_locked)(so);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pru_bind(struct socket *so, struct mbuf *nam, struct proc *p)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: socketvar.h,v 1.131 2024/05/17 19:11:14 mvs Exp $ */
|
||||
/* $OpenBSD: socketvar.h,v 1.132 2024/07/12 17:20:18 mvs Exp $ */
|
||||
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -237,7 +237,7 @@ sb_notify(struct socket *so, struct sockbuf *sb)
|
|||
*/
|
||||
|
||||
static inline long
|
||||
sbspace(struct socket *so, struct sockbuf *sb)
|
||||
sbspace_locked(struct socket *so, struct sockbuf *sb)
|
||||
{
|
||||
if (sb->sb_flags & SB_MTXLOCK)
|
||||
sbmtxassertlocked(so, sb);
|
||||
|
@ -247,6 +247,18 @@ sbspace(struct socket *so, struct sockbuf *sb)
|
|||
return lmin(sb->sb_hiwat - sb->sb_cc, sb->sb_mbmax - sb->sb_mbcnt);
|
||||
}
|
||||
|
||||
static inline long
|
||||
sbspace(struct socket *so, struct sockbuf *sb)
|
||||
{
|
||||
long ret;
|
||||
|
||||
sb_mtx_lock(sb);
|
||||
ret = sbspace_locked(so, sb);
|
||||
sb_mtx_unlock(sb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* do we have to send all at once on a socket? */
|
||||
#define sosendallatonce(so) \
|
||||
((so)->so_proto->pr_flags & PR_ATOMIC)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: vnode.h,v 1.171 2024/07/05 05:42:08 jsg Exp $ */
|
||||
/* $OpenBSD: vnode.h,v 1.173 2024/07/13 14:37:55 beck Exp $ */
|
||||
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ext2fs_inode.c,v 1.66 2022/08/12 14:30:53 visa Exp $ */
|
||||
/* $OpenBSD: ext2fs_inode.c,v 1.68 2024/07/13 14:37:56 beck Exp $ */
|
||||
/* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ufs_inode.c,v 1.45 2024/02/03 18:51:58 beck Exp $ */
|
||||
/* $OpenBSD: ufs_inode.c,v 1.47 2024/07/13 14:37:56 beck Exp $ */
|
||||
/* $NetBSD: ufs_inode.c,v 1.7 1996/05/11 18:27:52 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue