sync with OpenBSD -current

This commit is contained in:
purplerain 2024-04-12 02:10:46 +00:00
parent 0e1b66badd
commit 7514c4f262
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
20 changed files with 438 additions and 166 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: a_time_tm.c,v 1.36 2024/04/10 14:55:12 beck Exp $ */
/* $OpenBSD: a_time_tm.c,v 1.38 2024/04/11 06:49:19 tb Exp $ */
/*
* Copyright (c) 2015 Bob Beck <beck@openbsd.org>
*
@ -35,29 +35,29 @@ int
ASN1_time_tm_cmp(struct tm *tm1, struct tm *tm2)
{
if (tm1->tm_year < tm2->tm_year)
return (-1);
return -1;
if (tm1->tm_year > tm2->tm_year)
return (1);
return 1;
if (tm1->tm_mon < tm2->tm_mon)
return (-1);
return -1;
if (tm1->tm_mon > tm2->tm_mon)
return (1);
return 1;
if (tm1->tm_mday < tm2->tm_mday)
return (-1);
return -1;
if (tm1->tm_mday > tm2->tm_mday)
return (1);
return 1;
if (tm1->tm_hour < tm2->tm_hour)
return (-1);
return -1;
if (tm1->tm_hour > tm2->tm_hour)
return (1);
return 1;
if (tm1->tm_min < tm2->tm_min)
return (-1);
return -1;
if (tm1->tm_min > tm2->tm_min)
return (1);
return 1;
if (tm1->tm_sec < tm2->tm_sec)
return (-1);
return -1;
if (tm1->tm_sec > tm2->tm_sec)
return (1);
return 1;
return 0;
}
@ -78,31 +78,24 @@ ASN1_time_tm_clamp_notafter(struct tm *tm)
}
/* Convert time to GeneralizedTime, X.690, 11.7. */
ASN1_TIME *
static int
tm_to_gentime(struct tm *tm, ASN1_TIME *atime)
{
char *time_str = NULL;
int year;
year = tm->tm_year + 1900;
if (year < 0 || year > 9999) {
if (tm->tm_year < -1900 || tm->tm_year > 9999 - 1900) {
ASN1error(ASN1_R_ILLEGAL_TIME_VALUE);
goto err;
}
if (asprintf(&time_str, "%04u%02u%02u%02u%02u%02uZ", year,
tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min,
tm->tm_sec) == -1) {
time_str = NULL;
ASN1error(ERR_R_MALLOC_FAILURE);
goto err;
return 0;
}
if (atime == NULL)
atime = ASN1_TIME_new();
if (atime == NULL) {
return 1;
if (asprintf(&time_str, "%04u%02u%02u%02u%02u%02uZ", tm->tm_year + 1900,
tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min,
tm->tm_sec) == -1) {
ASN1error(ERR_R_MALLOC_FAILURE);
goto err;
return 0;
}
free(atime->data);
@ -110,38 +103,28 @@ tm_to_gentime(struct tm *tm, ASN1_TIME *atime)
atime->length = GENTIME_LENGTH;
atime->type = V_ASN1_GENERALIZEDTIME;
return (atime);
err:
free(time_str);
return (NULL);
return 1;
}
/* Convert time to UTCTime, X.690, 11.8. */
ASN1_TIME *
static int
tm_to_utctime(struct tm *tm, ASN1_TIME *atime)
{
char *time_str = NULL;
if (tm->tm_year >= 150 || tm->tm_year < 50) {
ASN1error(ASN1_R_ILLEGAL_TIME_VALUE);
goto err;
return 0;
}
if (atime == NULL)
return 1;
if (asprintf(&time_str, "%02u%02u%02u%02u%02u%02uZ",
tm->tm_year % 100, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec) == -1) {
time_str = NULL;
ASN1error(ERR_R_MALLOC_FAILURE);
goto err;
}
if (atime == NULL)
atime = ASN1_TIME_new();
if (atime == NULL) {
ASN1error(ERR_R_MALLOC_FAILURE);
goto err;
return 0;
}
free(atime->data);
@ -149,21 +132,16 @@ tm_to_utctime(struct tm *tm, ASN1_TIME *atime)
atime->length = UTCTIME_LENGTH;
atime->type = V_ASN1_UTCTIME;
return (atime);
err:
free(time_str);
return (NULL);
return 1;
}
ASN1_TIME *
static int
tm_to_rfc5280_time(struct tm *tm, ASN1_TIME *atime)
{
if (tm->tm_year >= 50 && tm->tm_year < 150)
return (tm_to_utctime(tm, atime));
return tm_to_utctime(tm, atime);
return (tm_to_gentime(tm, atime));
return tm_to_gentime(tm, atime);
}
@ -320,7 +298,7 @@ ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode)
CBS cbs;
if (bytes == NULL)
return (-1);
return -1;
CBS_init(&cbs, bytes, len);
@ -344,71 +322,80 @@ ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode)
static int
ASN1_TIME_set_string_internal(ASN1_TIME *s, const char *str, int mode)
{
ASN1_TIME *atime = s;
struct tm tm;
int type;
int ret = 0;
if ((type = ASN1_time_parse(str, strlen(str), &tm, mode)) == -1)
return (0);
return 0;
switch (mode) {
case V_ASN1_UTCTIME:
ret = (type == mode && (atime = tm_to_utctime(&tm, s)) != NULL);
break;
return type == mode && tm_to_utctime(&tm, s);
case V_ASN1_GENERALIZEDTIME:
ret = (type == mode && (atime = tm_to_gentime(&tm, s)) != NULL);
break;
return type == mode && tm_to_gentime(&tm, s);
case RFC5280:
ret = ((atime = tm_to_rfc5280_time(&tm, s)) != NULL);
break;
return tm_to_rfc5280_time(&tm, s);
default:
ret = 0;
break;
return 0;
}
if (atime != s)
ASN1_TIME_free(atime);
return ret;
}
static ASN1_TIME *
ASN1_TIME_adj_internal(ASN1_TIME *s, time_t t, int offset_day, long offset_sec,
int mode)
{
ASN1_TIME *atime = s;
struct tm tm;
if (!asn1_time_time_t_to_tm(&t, &tm))
return (NULL);
goto err;
if (offset_day != 0 || offset_sec != 0) {
if (!OPENSSL_gmtime_adj(&tm, offset_day, offset_sec))
return (NULL);
goto err;
}
if (atime == NULL)
atime = ASN1_TIME_new();
if (atime == NULL)
goto err;
switch (mode) {
case V_ASN1_UTCTIME:
return (tm_to_utctime(&tm, s));
if (!tm_to_utctime(&tm, atime))
goto err;
break;
case V_ASN1_GENERALIZEDTIME:
return (tm_to_gentime(&tm, s));
if (!tm_to_gentime(&tm, atime))
goto err;
break;
case RFC5280:
return (tm_to_rfc5280_time(&tm, s));
if (!tm_to_rfc5280_time(&tm, atime))
goto err;
break;
default:
return (NULL);
goto err;
}
return atime;
err:
if (atime != s)
ASN1_TIME_free(atime);
return NULL;
}
ASN1_TIME *
ASN1_TIME_set(ASN1_TIME *s, time_t t)
{
return (ASN1_TIME_adj(s, t, 0, 0));
return ASN1_TIME_adj(s, t, 0, 0);
}
LCRYPTO_ALIAS(ASN1_TIME_set);
ASN1_TIME *
ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day, long offset_sec)
{
return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, RFC5280));
return ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, RFC5280);
}
LCRYPTO_ALIAS(ASN1_TIME_adj);
@ -416,8 +403,8 @@ int
ASN1_TIME_check(const ASN1_TIME *t)
{
if (t->type != V_ASN1_GENERALIZEDTIME && t->type != V_ASN1_UTCTIME)
return (0);
return (t->type == ASN1_time_parse(t->data, t->length, NULL, t->type));
return 0;
return t->type == ASN1_time_parse(t->data, t->length, NULL, t->type);
}
LCRYPTO_ALIAS(ASN1_TIME_check);
@ -428,26 +415,36 @@ ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, ASN1_GENERALIZEDTIME **out)
struct tm tm;
if (t->type != V_ASN1_GENERALIZEDTIME && t->type != V_ASN1_UTCTIME)
return (NULL);
goto err;
if (t->type != ASN1_time_parse(t->data, t->length, &tm, t->type))
return (NULL);
goto err;
if (out == NULL || (agt = *out) == NULL)
agt = ASN1_TIME_new();
if (agt == NULL)
goto err;
if (!tm_to_gentime(&tm, agt))
goto err;
if (out != NULL)
agt = *out;
if ((agt = tm_to_gentime(&tm, agt)) == NULL)
return (NULL);
if (out != NULL)
*out = agt;
return (agt);
return agt;
err:
if (out == NULL || *out != agt)
ASN1_TIME_free(agt);
return NULL;
}
LCRYPTO_ALIAS(ASN1_TIME_to_generalizedtime);
int
ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
{
return (ASN1_TIME_set_string_internal(s, str, RFC5280));
return ASN1_TIME_set_string_internal(s, str, RFC5280);
}
LCRYPTO_ALIAS(ASN1_TIME_set_string);
@ -516,8 +513,8 @@ int
ASN1_UTCTIME_check(const ASN1_UTCTIME *d)
{
if (d->type != V_ASN1_UTCTIME)
return (0);
return (d->type == ASN1_time_parse(d->data, d->length, NULL, d->type));
return 0;
return d->type == ASN1_time_parse(d->data, d->length, NULL, d->type);
}
LCRYPTO_ALIAS(ASN1_UTCTIME_check);
@ -525,23 +522,23 @@ int
ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str)
{
if (s != NULL && s->type != V_ASN1_UTCTIME)
return (0);
return (ASN1_TIME_set_string_internal(s, str, V_ASN1_UTCTIME));
return 0;
return ASN1_TIME_set_string_internal(s, str, V_ASN1_UTCTIME);
}
LCRYPTO_ALIAS(ASN1_UTCTIME_set_string);
ASN1_UTCTIME *
ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
{
return (ASN1_UTCTIME_adj(s, t, 0, 0));
return ASN1_UTCTIME_adj(s, t, 0, 0);
}
LCRYPTO_ALIAS(ASN1_UTCTIME_set);
ASN1_UTCTIME *
ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, int offset_day, long offset_sec)
{
return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,
V_ASN1_UTCTIME));
return ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,
V_ASN1_UTCTIME);
}
LCRYPTO_ALIAS(ASN1_UTCTIME_adj);
@ -562,8 +559,8 @@ int
ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *d)
{
if (d->type != V_ASN1_GENERALIZEDTIME)
return (0);
return (d->type == ASN1_time_parse(d->data, d->length, NULL, d->type));
return 0;
return d->type == ASN1_time_parse(d->data, d->length, NULL, d->type);
}
LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_check);
@ -571,15 +568,15 @@ int
ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
{
if (s != NULL && s->type != V_ASN1_GENERALIZEDTIME)
return (0);
return (ASN1_TIME_set_string_internal(s, str, V_ASN1_GENERALIZEDTIME));
return 0;
return ASN1_TIME_set_string_internal(s, str, V_ASN1_GENERALIZEDTIME);
}
LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_set_string);
ASN1_GENERALIZEDTIME *
ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, time_t t)
{
return (ASN1_GENERALIZEDTIME_adj(s, t, 0, 0));
return ASN1_GENERALIZEDTIME_adj(s, t, 0, 0);
}
LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_set);
@ -587,8 +584,8 @@ ASN1_GENERALIZEDTIME *
ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day,
long offset_sec)
{
return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,
V_ASN1_GENERALIZEDTIME));
return ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,
V_ASN1_GENERALIZEDTIME);
}
LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_adj);
@ -601,7 +598,7 @@ ASN1_TIME_normalize(ASN1_TIME *t)
return 0;
if (!ASN1_TIME_to_tm(t, &tm))
return 0;
return tm_to_rfc5280_time(&tm, t) != NULL;
return tm_to_rfc5280_time(&tm, t);
}
LCRYPTO_ALIAS(ASN1_TIME_normalize);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kvm_sparc64.c,v 1.13 2021/12/01 21:45:19 deraadt Exp $ */
/* $OpenBSD: kvm_sparc64.c,v 1.14 2024/04/11 18:58:44 miod Exp $ */
/* $NetBSD: kvm_sparc64.c,v 1.7 2001/08/05 03:33:15 matt Exp $ */
/*-
@ -53,7 +53,7 @@
#include <machine/param.h>
#include <machine/vmparam.h>
#include <machine/pmap.h>
#include <machine/pte.h>
#include <machine/kcore.h>
#include <limits.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: specialreg.h,v 1.110 2024/03/17 05:49:41 guenther Exp $ */
/* $OpenBSD: specialreg.h,v 1.111 2024/04/11 23:00:13 jsg Exp $ */
/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */
/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */
@ -116,7 +116,7 @@
#define XFEATURE_HWP 0x00010000 /* HW P-states */
#define XFEATURE_TILECFG 0x00020000 /* AMX state */
#define XFEATURE_TILEDATA 0x00040000 /* AMX state */
#define XFEATURE_AMX (XFEATURE_TILEDATA | XFEATURE_TILEDATA)
#define XFEATURE_AMX (XFEATURE_TILECFG | XFEATURE_TILEDATA)
/* valid only in xcomp_bv field: */
#define XFEATURE_COMPRESSED (1ULL << 63) /* compressed format */

View File

@ -4228,6 +4228,8 @@ int amdgpu_device_prepare(struct drm_device *dev)
if (r)
return r;
flush_delayed_work(&adev->gfx.gfx_off_delay_work);
for (i = 0; i < adev->num_ip_blocks; i++) {
if (!adev->ip_blocks[i].status.valid)
continue;

View File

@ -586,7 +586,16 @@ int drm_gem_map_attach(struct dma_buf *dma_buf,
{
struct drm_gem_object *obj = dma_buf->priv;
/*
* drm_gem_map_dma_buf() requires obj->get_sg_table(), but drivers
* that implement their own ->map_dma_buf() do not.
*/
#ifdef notyet
if (dma_buf->ops->map_dma_buf == drm_gem_map_dma_buf &&
!obj->funcs->get_sg_table)
#else
if (!obj->funcs->get_sg_table)
#endif
return -ENOSYS;
return drm_gem_pin(obj);

View File

@ -1,4 +1,4 @@
# $OpenBSD: files.drm,v 1.62 2024/01/22 18:54:01 kettenis Exp $
# $OpenBSD: files.drm,v 1.63 2024/04/11 03:40:05 jsg Exp $
#file dev/pci/drm/aperture.c drm
file dev/pci/drm/dma-resv.c drm
@ -292,6 +292,7 @@ file dev/pci/drm/i915/gt/intel_ggtt_gmch.c inteldrm
file dev/pci/drm/i915/gt/intel_gsc.c inteldrm
file dev/pci/drm/i915/gt/intel_gt.c inteldrm
file dev/pci/drm/i915/gt/intel_gt_buffer_pool.c inteldrm
file dev/pci/drm/i915/gt/intel_gt_ccs_mode.c inteldrm
file dev/pci/drm/i915/gt/intel_gt_clock_utils.c inteldrm
file dev/pci/drm/i915/gt/intel_gt_debugfs.c inteldrm
file dev/pci/drm/i915/gt/intel_gt_engines_debugfs.c inteldrm

View File

@ -916,6 +916,23 @@ static intel_engine_mask_t init_engine_mask(struct intel_gt *gt)
info->engine_mask &= ~BIT(GSC0);
}
/*
* Do not create the command streamer for CCS slices beyond the first.
* All the workload submitted to the first engine will be shared among
* all the slices.
*
* Once the user will be allowed to customize the CCS mode, then this
* check needs to be removed.
*/
if (IS_DG2(gt->i915)) {
u8 first_ccs = __ffs(CCS_MASK(gt));
/* Mask off all the CCS engine */
info->engine_mask &= ~GENMASK(CCS3, CCS0);
/* Put back in the first CCS engine */
info->engine_mask |= BIT(_CCS(first_ccs));
}
return info->engine_mask;
}

View File

@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
/*
* Copyright © 2024 Intel Corporation
*/
#include "i915_drv.h"
#include "intel_gt.h"
#include "intel_gt_ccs_mode.h"
#include "intel_gt_regs.h"
void intel_gt_apply_ccs_mode(struct intel_gt *gt)
{
int cslice;
u32 mode = 0;
int first_ccs = __ffs(CCS_MASK(gt));
if (!IS_DG2(gt->i915))
return;
/* Build the value for the fixed CCS load balancing */
for (cslice = 0; cslice < I915_MAX_CCS; cslice++) {
if (CCS_MASK(gt) & BIT(cslice))
/*
* If available, assign the cslice
* to the first available engine...
*/
mode |= XEHP_CCS_MODE_CSLICE(cslice, first_ccs);
else
/*
* ... otherwise, mark the cslice as
* unavailable if no CCS dispatches here
*/
mode |= XEHP_CCS_MODE_CSLICE(cslice,
XEHP_CCS_MODE_CSLICE_MASK);
}
intel_uncore_write(gt->uncore, XEHP_CCS_MODE, mode);
}

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2024 Intel Corporation
*/
#ifndef __INTEL_GT_CCS_MODE_H__
#define __INTEL_GT_CCS_MODE_H__
struct intel_gt;
void intel_gt_apply_ccs_mode(struct intel_gt *gt);
#endif /* __INTEL_GT_CCS_MODE_H__ */

View File

@ -1468,8 +1468,14 @@
#define ECOBITS_PPGTT_CACHE4B (0 << 8)
#define GEN12_RCU_MODE _MMIO(0x14800)
#define XEHP_RCU_MODE_FIXED_SLICE_CCS_MODE REG_BIT(1)
#define GEN12_RCU_MODE_CCS_ENABLE REG_BIT(0)
#define XEHP_CCS_MODE _MMIO(0x14804)
#define XEHP_CCS_MODE_CSLICE_MASK REG_GENMASK(2, 0) /* CCS0-3 + rsvd */
#define XEHP_CCS_MODE_CSLICE_WIDTH ilog2(XEHP_CCS_MODE_CSLICE_MASK + 1)
#define XEHP_CCS_MODE_CSLICE(cslice, ccs) (ccs << (cslice * XEHP_CCS_MODE_CSLICE_WIDTH))
#define CHV_FUSE_GT _MMIO(VLV_GUNIT_BASE + 0x2168)
#define CHV_FGT_DISABLE_SS0 (1 << 10)
#define CHV_FGT_DISABLE_SS1 (1 << 11)

View File

@ -10,6 +10,7 @@
#include "intel_engine_regs.h"
#include "intel_gpu_commands.h"
#include "intel_gt.h"
#include "intel_gt_ccs_mode.h"
#include "intel_gt_mcr.h"
#include "intel_gt_regs.h"
#include "intel_ring.h"
@ -50,7 +51,8 @@
* registers belonging to BCS, VCS or VECS should be implemented in
* xcs_engine_wa_init(). Workarounds for registers not belonging to a specific
* engine's MMIO range but that are part of of the common RCS/CCS reset domain
* should be implemented in general_render_compute_wa_init().
* should be implemented in general_render_compute_wa_init(). The settings
* about the CCS load balancing should be added in ccs_engine_wa_mode().
*
* - GT workarounds: the list of these WAs is applied whenever these registers
* revert to their default values: on GPU reset, suspend/resume [1]_, etc.
@ -2823,6 +2825,28 @@ add_render_compute_tuning_settings(struct intel_gt *gt,
wa_write_clr(wal, GEN8_GARBCNTL, GEN12_BUS_HASH_CTL_BIT_EXC);
}
static void ccs_engine_wa_mode(struct intel_engine_cs *engine, struct i915_wa_list *wal)
{
struct intel_gt *gt = engine->gt;
if (!IS_DG2(gt->i915))
return;
/*
* Wa_14019159160: This workaround, along with others, leads to
* significant challenges in utilizing load balancing among the
* CCS slices. Consequently, an architectural decision has been
* made to completely disable automatic CCS load balancing.
*/
wa_masked_en(wal, GEN12_RCU_MODE, XEHP_RCU_MODE_FIXED_SLICE_CCS_MODE);
/*
* After having disabled automatic load balancing we need to
* assign all slices to a single CCS. We will call it CCS mode 1
*/
intel_gt_apply_ccs_mode(gt);
}
/*
* The workarounds in this function apply to shared registers in
* the general render reset domain that aren't tied to a
@ -2970,8 +2994,10 @@ engine_init_workarounds(struct intel_engine_cs *engine, struct i915_wa_list *wal
* to a single RCS/CCS engine's workaround list since
* they're reset as part of the general render domain reset.
*/
if (engine->flags & I915_ENGINE_FIRST_RENDER_COMPUTE)
if (engine->flags & I915_ENGINE_FIRST_RENDER_COMPUTE) {
general_render_compute_wa_init(engine, wal);
ccs_engine_wa_mode(engine, wal);
}
if (engine->class == COMPUTE_CLASS)
ccs_engine_wa_init(engine, wal);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_mcx.c,v 1.111 2023/11/10 15:51:20 bluhm Exp $ */
/* $OpenBSD: if_mcx.c,v 1.113 2024/04/11 06:42:12 jmatthew Exp $ */
/*
* Copyright (c) 2017 David Gwynne <dlg@openbsd.org>
@ -199,6 +199,19 @@ CTASSERT(MCX_MAX_QUEUES * MCX_WQ_DOORBELL_STRIDE <
#define MCX_ETHER_CAP_50G_CR2 30
#define MCX_ETHER_CAP_50G_KR2 31
#define MCX_ETHER_EXT_CAP_SGMII_100 0
#define MCX_ETHER_EXT_CAP_1000_X 1
#define MCX_ETHER_EXT_CAP_5G_R 3
#define MCX_ETHER_EXT_CAP_XAUI 4
#define MCX_ETHER_EXT_CAP_XLAUI 5
#define MCX_ETHER_EXT_CAP_25G_AUI1 6
#define MCX_ETHER_EXT_CAP_50G_AUI2 7
#define MCX_ETHER_EXT_CAP_50G_AUI1 8
#define MCX_ETHER_EXT_CAP_CAUI4 9
#define MCX_ETHER_EXT_CAP_100G_AUI2 10
#define MCX_ETHER_EXT_CAP_200G_AUI4 12
#define MCX_ETHER_EXT_CAP_400G_AUI8 15
#define MCX_MAX_CQE 32
#define MCX_CMD_QUERY_HCA_CAP 0x100
@ -406,11 +419,14 @@ struct mcx_reg_ptys {
uint8_t rp_reserved2;
uint8_t rp_proto_mask;
#define MCX_REG_PTYS_PROTO_MASK_ETH (1 << 2)
uint8_t rp_reserved3[8];
uint8_t rp_reserved3[4];
uint32_t rp_ext_eth_proto_cap;
uint32_t rp_eth_proto_cap;
uint8_t rp_reserved4[8];
uint8_t rp_reserved4[4];
uint32_t rp_ext_eth_proto_admin;
uint32_t rp_eth_proto_admin;
uint8_t rp_reserved5[8];
uint8_t rp_reserved5[4];
uint32_t rp_ext_eth_proto_oper;
uint32_t rp_eth_proto_oper;
uint8_t rp_reserved6[24];
} __packed __aligned(4);
@ -2657,6 +2673,7 @@ static const struct pci_matchid mcx_devices[] = {
{ PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT28800 },
{ PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT28800VF },
{ PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT28908 },
{ PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT28908VF },
{ PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT2892 },
{ PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT2894 },
};
@ -2691,6 +2708,21 @@ static const struct mcx_eth_proto_capability mcx_eth_cap_map[] = {
[MCX_ETHER_CAP_50G_KR2] = { IFM_50G_KR2, IF_Gbps(50) },
};
static const struct mcx_eth_proto_capability mcx_ext_eth_cap_map[] = {
[MCX_ETHER_EXT_CAP_SGMII_100] = { IFM_100_FX, IF_Mbps(100) },
[MCX_ETHER_EXT_CAP_1000_X] = { IFM_1000_SX, IF_Gbps(1) },
[MCX_ETHER_EXT_CAP_5G_R] = { IFM_5000_T, IF_Gbps(5) },
[MCX_ETHER_EXT_CAP_XAUI] = { IFM_10G_SFI, IF_Gbps(10) },
[MCX_ETHER_EXT_CAP_XLAUI] = { IFM_40G_XLPPI, IF_Gbps(40) },
[MCX_ETHER_EXT_CAP_25G_AUI1] = { 0 /*IFM_25G_AUI*/, IF_Gbps(25) },
[MCX_ETHER_EXT_CAP_50G_AUI2] = { 0 /*IFM_50G_AUI*/, IF_Gbps(50) },
[MCX_ETHER_EXT_CAP_50G_AUI1] = { 0 /*IFM_50G_AUI*/, IF_Gbps(50) },
[MCX_ETHER_EXT_CAP_CAUI4] = { 0 /*IFM_100G_AUI*/, IF_Gbps(100) },
[MCX_ETHER_EXT_CAP_100G_AUI2] = { 0 /*IFM_100G_AUI*/, IF_Gbps(100) },
[MCX_ETHER_EXT_CAP_200G_AUI4] = { 0 /*IFM_200G_AUI*/, IF_Gbps(200) },
[MCX_ETHER_EXT_CAP_400G_AUI8] = { 0 /*IFM_400G_AUI*/, IF_Gbps(400) },
};
static int
mcx_get_id(uint32_t val)
{
@ -7956,6 +7988,19 @@ mcx_media_add_types(struct mcx_softc *sc)
ifmedia_add(&sc->sc_media, IFM_ETHER | cap->cap_media, 0, NULL);
}
proto_cap = betoh32(ptys.rp_ext_eth_proto_cap);
for (i = 0; i < nitems(mcx_ext_eth_cap_map); i++) {
const struct mcx_eth_proto_capability *cap;
if (!ISSET(proto_cap, 1 << i))
continue;
cap = &mcx_ext_eth_cap_map[i];
if (cap->cap_media == 0)
continue;
ifmedia_add(&sc->sc_media, IFM_ETHER | cap->cap_media, 0, NULL);
}
}
static void
@ -7965,6 +8010,7 @@ mcx_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
struct mcx_reg_ptys ptys;
int i;
uint32_t proto_oper;
uint32_t ext_proto_oper;
uint64_t media_oper;
memset(&ptys, 0, sizeof(ptys));
@ -7979,6 +8025,7 @@ mcx_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
}
proto_oper = betoh32(ptys.rp_eth_proto_oper);
ext_proto_oper = betoh32(ptys.rp_ext_eth_proto_oper);
media_oper = 0;
@ -7993,8 +8040,21 @@ mcx_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
media_oper = cap->cap_media;
}
if (media_oper == 0) {
for (i = 0; i < nitems(mcx_ext_eth_cap_map); i++) {
const struct mcx_eth_proto_capability *cap;
if (!ISSET(ext_proto_oper, 1 << i))
continue;
cap = &mcx_ext_eth_cap_map[i];
if (cap->cap_media != 0)
media_oper = cap->cap_media;
}
}
ifmr->ifm_status = IFM_AVALID;
if (proto_oper != 0) {
if ((proto_oper | ext_proto_oper) != 0) {
ifmr->ifm_status |= IFM_ACTIVE;
ifmr->ifm_active = IFM_ETHER | IFM_AUTO | media_oper;
/* txpause, rxpause, duplex? */
@ -8010,6 +8070,7 @@ mcx_media_change(struct ifnet *ifp)
struct mcx_reg_ptys ptys;
struct mcx_reg_paos paos;
uint32_t media;
uint32_t ext_media;
int i, error;
if (IFM_TYPE(sc->sc_media.ifm_media) != IFM_ETHER)
@ -8032,6 +8093,7 @@ mcx_media_change(struct ifnet *ifp)
}
media = betoh32(ptys.rp_eth_proto_cap);
ext_media = betoh32(ptys.rp_ext_eth_proto_cap);
} else {
/* map media type */
media = 0;
@ -8045,6 +8107,17 @@ mcx_media_change(struct ifnet *ifp)
break;
}
}
for (i = 0; i < nitems(mcx_ext_eth_cap_map); i++) {
const struct mcx_eth_proto_capability *cap;
cap = &mcx_ext_eth_cap_map[i];
if (cap->cap_media ==
IFM_SUBTYPE(sc->sc_media.ifm_media)) {
media = (1 << i);
break;
}
}
}
/* disable the port */
@ -8063,6 +8136,7 @@ mcx_media_change(struct ifnet *ifp)
ptys.rp_local_port = 1;
ptys.rp_proto_mask = MCX_REG_PTYS_PROTO_MASK_ETH;
ptys.rp_eth_proto_admin = htobe32(media);
ptys.rp_ext_eth_proto_admin = htobe32(ext_media);
if (mcx_access_hca_reg(sc, MCX_REG_PTYS, MCX_REG_OP_WRITE, &ptys,
sizeof(ptys), MCX_CMDQ_SLOT_IOCTL) != 0) {
printf("%s: unable to set port media type/speed\n",
@ -8107,10 +8181,11 @@ mcx_port_change(void *xsc)
if (mcx_access_hca_reg(sc, MCX_REG_PTYS, MCX_REG_OP_READ, &ptys,
sizeof(ptys), slot) == 0) {
uint32_t proto_oper = betoh32(ptys.rp_eth_proto_oper);
uint32_t ext_proto_oper = betoh32(ptys.rp_ext_eth_proto_oper);
uint64_t baudrate = 0;
unsigned int i;
if (proto_oper != 0)
if ((proto_oper | ext_proto_oper) != 0)
link_state = LINK_STATE_FULL_DUPLEX;
for (i = 0; i < nitems(mcx_eth_cap_map); i++) {
@ -8126,6 +8201,21 @@ mcx_port_change(void *xsc)
break;
}
if (baudrate == 0) {
for (i = 0; i < nitems(mcx_ext_eth_cap_map); i++) {
const struct mcx_eth_proto_capability *cap;
if (!ISSET(ext_proto_oper, 1 << i))
continue;
cap = &mcx_ext_eth_cap_map[i];
if (cap->cap_baudrate == 0)
continue;
baudrate = cap->cap_baudrate;
break;
}
}
ifp->if_baudrate = baudrate;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sys_socket.c,v 1.63 2024/03/31 13:50:00 mvs Exp $ */
/* $OpenBSD: sys_socket.c,v 1.64 2024/04/11 08:33:37 mvs Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
@ -145,7 +145,7 @@ soo_stat(struct file *fp, struct stat *ub, struct proc *p)
memset(ub, 0, sizeof (*ub));
ub->st_mode = S_IFSOCK;
solock(so);
solock_shared(so);
mtx_enter(&so->so_rcv.sb_mtx);
if ((so->so_rcv.sb_state & SS_CANTRCVMORE) == 0 ||
so->so_rcv.sb_cc != 0)
@ -156,7 +156,7 @@ soo_stat(struct file *fp, struct stat *ub, struct proc *p)
ub->st_uid = so->so_euid;
ub->st_gid = so->so_egid;
(void)pru_sense(so, ub);
sounlock(so);
sounlock_shared(so);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket.c,v 1.328 2024/04/10 12:04:41 mvs Exp $ */
/* $OpenBSD: uipc_socket.c,v 1.329 2024/04/11 13:32:51 mvs Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@ -66,6 +66,7 @@ void soreaper(void *);
void soput(void *);
int somove(struct socket *, int);
void sorflush(struct socket *);
void sorflush_locked(struct socket *);
void filt_sordetach(struct knote *kn);
int filt_soread(struct knote *kn, long hint);
@ -143,6 +144,8 @@ soalloc(const struct protosw *prp, int wait)
return (NULL);
rw_init_flags(&so->so_lock, dp->dom_name, RWL_DUPOK);
refcnt_init(&so->so_refcnt);
rw_init(&so->so_rcv.sb_lock, "sbufrcv");
rw_init(&so->so_snd.sb_lock, "sbufsnd");
mtx_init(&so->so_rcv.sb_mtx, IPL_MPFLOOR);
mtx_init(&so->so_snd.sb_mtx, IPL_MPFLOOR);
klist_init_mutex(&so->so_rcv.sb_klist, &so->so_rcv.sb_mtx);
@ -156,15 +159,15 @@ soalloc(const struct protosw *prp, int wait)
case AF_INET6:
switch (prp->pr_type) {
case SOCK_DGRAM:
so->so_rcv.sb_flags |= SB_OWNLOCK;
/* FALLTHROUGH */
case SOCK_RAW:
so->so_rcv.sb_flags |= SB_MTXLOCK;
break;
case SOCK_RAW:
so->so_rcv.sb_flags |= SB_MTXLOCK | SB_OWNLOCK;
break;
}
break;
case AF_UNIX:
so->so_rcv.sb_flags |= SB_MTXLOCK | SB_OWNLOCK;
so->so_rcv.sb_flags |= SB_MTXLOCK;
break;
}
@ -346,9 +349,22 @@ sofree(struct socket *so, int keep_lock)
}
#endif /* SOCKET_SPLICE */
sbrelease(so, &so->so_snd);
sorflush(so);
if (!keep_lock)
/*
* Regardless on '_locked' postfix, must release solock() before
* call sorflush_locked() for SB_OWNLOCK marked socket. Can't
* release solock() and call sorflush() because solock() release
* is unwanted for tcp(4) socket.
*/
if (so->so_rcv.sb_flags & SB_OWNLOCK)
sounlock(so);
sorflush_locked(so);
if (!((so->so_rcv.sb_flags & SB_OWNLOCK) || keep_lock))
sounlock(so);
#ifdef SOCKET_SPLICE
if (so->so_sp) {
/* Reuse splice idle, sounsplice() has been called before. */
@ -807,6 +823,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
const struct protosw *pr = so->so_proto;
struct mbuf *nextrecord;
size_t resid, orig_resid = uio->uio_resid;
int dosolock = ((so->so_rcv.sb_flags & SB_OWNLOCK) == 0);
mp = mp0;
if (paddr)
@ -836,12 +853,11 @@ bad:
if (mp)
*mp = NULL;
solock_shared(so);
if (dosolock)
solock_shared(so);
restart:
if ((error = sblock(so, &so->so_rcv, SBLOCKWAIT(flags))) != 0) {
sounlock_shared(so);
return (error);
}
if ((error = sblock(so, &so->so_rcv, SBLOCKWAIT(flags))) != 0)
goto out;
sb_mtx_lock(&so->so_rcv);
m = so->so_rcv.sb_mb;
@ -906,14 +922,16 @@ restart:
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 1");
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 1");
if (so->so_rcv.sb_flags & SB_OWNLOCK) {
if (so->so_rcv.sb_flags & (SB_MTXLOCK | SB_OWNLOCK)) {
sbunlock_locked(so, &so->so_rcv);
sounlock_shared(so);
if (dosolock)
sounlock_shared(so);
error = sbwait_locked(so, &so->so_rcv);
sb_mtx_unlock(&so->so_rcv);
if (error)
return (error);
solock_shared(so);
if (dosolock)
solock_shared(so);
} else {
sb_mtx_unlock(&so->so_rcv);
sbunlock(so, &so->so_rcv);
@ -990,11 +1008,13 @@ dontblock:
if (controlp) {
if (pr->pr_domain->dom_externalize) {
sb_mtx_unlock(&so->so_rcv);
sounlock_shared(so);
if (dosolock)
sounlock_shared(so);
error =
(*pr->pr_domain->dom_externalize)
(cm, controllen, flags);
solock_shared(so);
if (dosolock)
solock_shared(so);
sb_mtx_lock(&so->so_rcv);
}
*controlp = cm;
@ -1073,9 +1093,11 @@ dontblock:
SBLASTMBUFCHK(&so->so_rcv, "soreceive uiomove");
resid = uio->uio_resid;
sb_mtx_unlock(&so->so_rcv);
sounlock_shared(so);
if (dosolock)
sounlock_shared(so);
uio_error = uiomove(mtod(m, caddr_t) + moff, len, uio);
solock_shared(so);
if (dosolock)
solock_shared(so);
sb_mtx_lock(&so->so_rcv);
if (uio_error)
uio->uio_resid = resid - len;
@ -1158,14 +1180,22 @@ dontblock:
break;
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 2");
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 2");
sb_mtx_unlock(&so->so_rcv);
error = sbwait(so, &so->so_rcv);
if (error) {
sbunlock(so, &so->so_rcv);
sounlock_shared(so);
return (0);
if (dosolock) {
sb_mtx_unlock(&so->so_rcv);
error = sbwait(so, &so->so_rcv);
if (error) {
sbunlock(so, &so->so_rcv);
sounlock_shared(so);
return (0);
}
sb_mtx_lock(&so->so_rcv);
} else {
if (sbwait_locked(so, &so->so_rcv)) {
sb_mtx_unlock(&so->so_rcv);
sbunlock(so, &so->so_rcv);
return (0);
}
}
sb_mtx_lock(&so->so_rcv);
if ((m = so->so_rcv.sb_mb) != NULL)
nextrecord = m->m_nextpkt;
}
@ -1214,7 +1244,9 @@ dontblock:
release:
sb_mtx_unlock(&so->so_rcv);
sbunlock(so, &so->so_rcv);
sounlock_shared(so);
out:
if (dosolock)
sounlock_shared(so);
return (error);
}
@ -1223,7 +1255,6 @@ soshutdown(struct socket *so, int how)
{
int error = 0;
solock(so);
switch (how) {
case SHUT_RD:
sorflush(so);
@ -1232,25 +1263,29 @@ soshutdown(struct socket *so, int how)
sorflush(so);
/* FALLTHROUGH */
case SHUT_WR:
solock(so);
error = pru_shutdown(so);
sounlock(so);
break;
default:
error = EINVAL;
break;
}
sounlock(so);
return (error);
}
void
sorflush(struct socket *so)
sorflush_locked(struct socket *so)
{
struct sockbuf *sb = &so->so_rcv;
struct mbuf *m;
const struct protosw *pr = so->so_proto;
int error;
if ((sb->sb_flags & SB_OWNLOCK) == 0)
soassertlocked(so);
error = sblock(so, sb, SBL_WAIT | SBL_NOINTR);
/* with SBL_WAIT and SLB_NOINTR sblock() must not fail */
KASSERT(error == 0);
@ -1267,6 +1302,16 @@ sorflush(struct socket *so)
m_purge(m);
}
void
sorflush(struct socket *so)
{
if ((so->so_rcv.sb_flags & SB_OWNLOCK) == 0)
solock_shared(so);
sorflush_locked(so);
if ((so->so_rcv.sb_flags & SB_OWNLOCK) == 0)
sounlock_shared(so);
}
#ifdef SOCKET_SPLICE
#define so_splicelen so_sp->ssp_len
@ -1905,7 +1950,8 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m)
if ((long)cnt <= 0)
cnt = 1;
solock(so);
if (((sb->sb_flags & SB_OWNLOCK) == 0))
solock(so);
mtx_enter(&sb->sb_mtx);
switch (optname) {
@ -1931,7 +1977,8 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m)
}
mtx_leave(&sb->sb_mtx);
sounlock(so);
if (((sb->sb_flags & SB_OWNLOCK) == 0))
sounlock(so);
break;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket2.c,v 1.148 2024/04/10 12:04:41 mvs Exp $ */
/* $OpenBSD: uipc_socket2.c,v 1.149 2024/04/11 13:32:51 mvs Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@ -322,7 +322,9 @@ socantsendmore(struct socket *so)
void
socantrcvmore(struct socket *so)
{
soassertlocked(so);
if ((so->so_rcv.sb_flags & SB_OWNLOCK) == 0)
soassertlocked(so);
mtx_enter(&so->so_rcv.sb_mtx);
so->so_rcv.sb_state |= SS_CANTRCVMORE;
mtx_leave(&so->so_rcv.sb_mtx);
@ -529,6 +531,17 @@ sblock(struct socket *so, struct sockbuf *sb, int flags)
{
int error = 0, prio = PSOCK;
if (sb->sb_flags & SB_OWNLOCK) {
int rwflags = RW_WRITE;
if (!(flags & SBL_NOINTR || sb->sb_flags & SB_NOINTR))
rwflags |= RW_INTR;
if (!(flags & SBL_WAIT))
rwflags |= RW_NOSLEEP;
return rw_enter(&sb->sb_lock, rwflags);
}
soassertlocked(so);
mtx_enter(&sb->sb_mtx);
@ -561,6 +574,11 @@ out:
void
sbunlock_locked(struct socket *so, struct sockbuf *sb)
{
if (sb->sb_flags & SB_OWNLOCK) {
rw_exit(&sb->sb_lock);
return;
}
MUTEX_ASSERT_LOCKED(&sb->sb_mtx);
sb->sb_flags &= ~SB_LOCK;
@ -573,6 +591,11 @@ sbunlock_locked(struct socket *so, struct sockbuf *sb)
void
sbunlock(struct socket *so, struct sockbuf *sb)
{
if (sb->sb_flags & SB_OWNLOCK) {
rw_exit(&sb->sb_lock);
return;
}
mtx_enter(&sb->sb_mtx);
sbunlock_locked(so, sb);
mtx_leave(&sb->sb_mtx);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if.h,v 1.215 2023/11/11 14:24:03 bluhm Exp $ */
/* $OpenBSD: if.h,v 1.216 2024/04/11 15:08:18 bluhm Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@ -219,7 +219,7 @@ struct if_status_description {
/* flags set internally only: */
#define IFF_CANTCHANGE \
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
(IFF_BROADCAST|IFF_LOOPBACK|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
#define IFXF_MPSAFE 0x1 /* [I] if_start is mpsafe */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: socketvar.h,v 1.128 2024/04/10 12:04:41 mvs Exp $ */
/* $OpenBSD: socketvar.h,v 1.129 2024/04/11 13:32:51 mvs Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
@ -105,7 +105,8 @@ struct socket {
* Variables for socket buffering.
*/
struct sockbuf {
struct mutex sb_mtx;
struct rwlock sb_lock;
struct mutex sb_mtx;
/* The following fields are all zeroed on flush. */
#define sb_startzero sb_cc
u_long sb_cc; /* actual chars in buffer */
@ -134,7 +135,7 @@ struct socket {
#define SB_SPLICE 0x0020 /* buffer is splice source or drain */
#define SB_NOINTR 0x0040 /* operations not interruptible */
#define SB_MTXLOCK 0x0080 /* use sb_mtx for sockbuf protection */
#define SB_OWNLOCK 0x0100 /* sb_mtx used standalone */
#define SB_OWNLOCK 0x0100 /* sblock() doesn't need solock() */
void (*so_upcall)(struct socket *so, caddr_t arg, int waitf);
caddr_t so_upcallarg; /* Arg for above */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ffs_extern.h,v 1.46 2024/02/03 18:51:58 beck Exp $ */
/* $OpenBSD: ffs_extern.h,v 1.47 2024/04/11 16:31:30 otto Exp $ */
/* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */
/*
@ -58,6 +58,7 @@
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "sd_tickdelay", CTLTYPE_INT }, \
{ "sd_worklist_push", CTLTYPE_INT }, \
{ "sd_blk_limit_push", CTLTYPE_INT }, \

View File

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.460 2024/04/09 12:40:01 claudio Exp $ */
/* $OpenBSD: parse.y,v 1.461 2024/04/11 18:07:55 tb Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -272,7 +272,7 @@ typedef struct {
%token <v.number> NUMBER
%type <v.number> asnumber as4number as4number_any optnumber
%type <v.number> espah af safi restart origincode nettype
%type <v.number> yesno inout restricted expires enforce
%type <v.number> yesno inout restricted expires
%type <v.number> yesnoenforce enforce
%type <v.number> validity aspa_validity
%type <v.number> addpathextra addpathmax

View File

@ -1,4 +1,4 @@
/* $OpenBSD: session.c,v 1.469 2024/04/10 09:05:32 claudio Exp $ */
/* $OpenBSD: session.c,v 1.470 2024/04/11 08:33:15 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@ -1257,10 +1257,10 @@ get_alternate_addr(struct bgpd_addr *local, struct bgpd_addr *remote,
continue;
if (sa_equal(local, match->ifa_addr)) {
if (match->ifa_flags & IFF_POINTOPOINT &&
match->ifa_dstaddr) {
match->ifa_dstaddr != NULL) {
if (sa_equal(remote, match->ifa_dstaddr))
connected = 1;
} else if (match->ifa_netmask) {
} else if (match->ifa_netmask != NULL) {
plen = mask2prefixlen(
match->ifa_addr->sa_family,
match->ifa_netmask);