Hello Jason,

thank you for taking a look. More comments in-line.
On Tue, Jul 04, 2023 at 09:03:29PM +0100, Jason McIntyre wrote:
</snip>
> > @@ -48,12 +48,25 @@ and retrieve statistics.
> >  The most commonly used functions are covered by
> >  .Xr pfctl 8 .
> >  .Pp
> > -Manipulations like loading a ruleset that involve more than a single
> > +Operations like loading or reading a ruleset that involve more than a 
> > single
> 
> you probably don;t need to add "or reading", since you already indicate
> that it is just an example ("like"), not an exhaustive list. or is there
> a specific reason to list reading a ruleset?

    I opted for: 'Operations loading or reading a ruleset...'
    the thing is I do really want 'reading' to appear there.
    previously we did not need to do anything after reading
    of rules was done. It's different now, because in some
    cases (snmpd et. al.) we must call DIOCXEND on ticket.

> 
> >  .Xr ioctl 2
> >  call require a so-called
> >  .Em ticket ,
> 
> should probably be Sy rather than Em, but don;t sweat it if such a
> change would make the rest of the manual inconsistent.

    looks like we can go for 'Sy' here, because this was the
    only occurrence of '.Em ticket'. Later we use '.Va ticket',
    but this is in context where ioctl(2) operations are described.
> 
> > -which prevents the occurrence of
> > -multiple concurrent manipulations.
> > +which allows
> > +.Xr pf 4
> > +to deal with concurrent operations.
> > +For certain
> > +.Xr ioctl 2
> > +commands (currently
> > +.Dv DIOCGETRULES )
> > +the number of tickets application can obtain is limited.
> 
> i'm not sure what this means. tickets per application? "tickets
> application" does not read correctly.

    may be if I say:
        'the number of tickets each program can obtain is limited.'
    what I want to say is there is a limit on tickets which
    each program can get DIOCGETRULES. To avoid hitting the limit
    program must use DIOCXEND to return ticket back to system
    when multi-ioctl operation is done.
> 
> > +The application must explicitly release the ticket using
> 
> s/using/using the/

    will use 'using the'

> > +.Dv DIOCXEND
> > +command to avoid hitting the limit.
> > +All tickets which are not freed by
> > +.Dv DIOCXEND
> > +are released when application closes
> 
> s/application/the application/

    opting for 'the program' to be consistent with new update.

> 
> > +.Pa /dev/pf .
> >  .Pp
> >  Fields of
> >  .Xr ioctl 2
> > @@ -132,6 +145,9 @@ for subsequent
> >  calls and the number
> >  .Va nr
> >  of rules in the active ruleset.
> > +The ticket should be released by
> 
> s/by/by the/
> 

    opting for 'released by the'

> or maybe just "released by DIOCXEND".
> 
> > +.Dv DIOCXEND
> > +command.
> >  .It Dv DIOCGETRULE Fa "struct pfioc_rule *pr"
> >  Get a
> >  .Va rule
> > @@ -792,6 +808,10 @@ inactive rulesets since the last
> >  .Dv DIOCXBEGIN .
> >  .Dv DIOCXROLLBACK
> >  will silently ignore rulesets for which the ticket is invalid.
> > +.It Dv DIOCXEND Fa "u_int32_t *ticket"
> > +Release ticket obtained by
> > +.Dv DIOCGETRULES
> > +command.
> 
> again, either "by the XXX command" or "by XXX".

    going for 'by the XXX command'

thanks for your help to put my update to pf(4) to shape.
updated diff is below.

regards
sashan

--------8<---------------8<---------------8<------------------8<--------
diff --git a/lib/libcrypto/ecdsa/ecs_ossl.c b/lib/libcrypto/ecdsa/ecs_ossl.c
index 0ca2651f255..4bc77a49204 100644
--- a/lib/libcrypto/ecdsa/ecs_ossl.c
+++ b/lib/libcrypto/ecdsa/ecs_ossl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ecs_ossl.c,v 1.71 2023/07/04 15:09:31 tb Exp $ */
+/* $OpenBSD: ecs_ossl.c,v 1.68 2023/07/04 10:53:42 tb Exp $ */
 /*
  * Written by Nils Larsch for the OpenSSL project
  */
@@ -122,11 +122,6 @@ ossl_ecdsa_sign(int type, const unsigned char *digest, int 
digest_len,
        return ret;
 }
 
-/*
- * FIPS 186-5, section 6.4.1, steps 3-8 and 11: Generate k, calculate r and
- * kinv, and clear it. If r == 0, try again with a new random k.
- */
-
 int
 ossl_ecdsa_sign_setup(EC_KEY *key, BN_CTX *in_ctx, BIGNUM **out_kinv,
     BIGNUM **out_r)
@@ -198,9 +193,7 @@ ossl_ecdsa_sign_setup(EC_KEY *key, BN_CTX *in_ctx, BIGNUM 
**out_kinv,
            !BN_set_bit(x, order_bits))
                goto err;
 
-       /* Step 11: repeat until r != 0. */
        do {
-               /* Step 3: generate random k. */
                if (!bn_rand_interval(k, BN_value_one(), order)) {
                        ECDSAerror(ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED);
                        goto err;
@@ -227,25 +220,22 @@ ossl_ecdsa_sign_setup(EC_KEY *key, BN_CTX *in_ctx, BIGNUM 
**out_kinv,
 
                BN_set_flags(k, BN_FLG_CONSTTIME);
 
-               /* Step 5: P = k * G. */
+               /* Compute r, the x-coordinate of G * k. */
                if (!EC_POINT_mul(group, point, k, NULL, NULL, ctx)) {
                        ECDSAerror(ERR_R_EC_LIB);
                        goto err;
                }
-               /* Steps 6 (and 7): from P = (x, y) retain the x-coordinate. */
                if (!EC_POINT_get_affine_coordinates(group, point, x, NULL,
                    ctx)) {
                        ECDSAerror(ERR_R_EC_LIB);
                        goto err;
                }
-               /* Step 8: r = x (mod order). */
                if (!BN_nnmod(r, x, order, ctx)) {
                        ECDSAerror(ERR_R_BN_LIB);
                        goto err;
                }
        } while (BN_is_zero(r));
 
-       /* Step 4: calculate kinv. */
        if (BN_mod_inverse_ct(k, k, order, ctx) == NULL) {
                ECDSAerror(ERR_R_BN_LIB);
                goto err;
@@ -316,16 +306,6 @@ ecdsa_compute_s(BIGNUM **out_s, const BIGNUM *e, const 
BIGNUM *kinv,
        if ((s = BN_new()) == NULL)
                goto err;
 
-       /*
-        * In a valid ECDSA signature, r must be in [1, order). Since r can be
-        * caller provided - either directly or by replacing sign_setup() - we
-        * can't rely on this being the case.
-        */
-       if (BN_cmp(r, BN_value_one()) < 0 || BN_cmp(r, order) >= 0) {
-               ECDSAerror(ECDSA_R_BAD_SIGNATURE);
-               goto err;
-       }
-
        if (!bn_rand_interval(b, BN_value_one(), order)) {
                ECDSAerror(ERR_R_BN_LIB);
                goto err;
@@ -363,7 +343,6 @@ ecdsa_compute_s(BIGNUM **out_s, const BIGNUM *e, const 
BIGNUM *kinv,
                goto err;
        }
 
-       /* Step 11: if s == 0 start over. */
        if (!BN_is_zero(s)) {
                *out_s = s;
                s = NULL;
@@ -385,12 +364,6 @@ ecdsa_compute_s(BIGNUM **out_s, const BIGNUM *e, const 
BIGNUM *kinv,
  */
 #define ECDSA_MAX_SIGN_ITERATIONS              32
 
-/*
- * FIPS 186-5: Section 6.4.1: ECDSA signature generation, steps 2-12.
- * The caller provides the hash of the message, thus performs step 1.
- * Step 10, zeroing k and kinv, is done by BN_free().
- */
-
 ECDSA_SIG *
 ossl_ecdsa_sign_sig(const unsigned char *digest, int digest_len,
     const BIGNUM *in_kinv, const BIGNUM *in_r, EC_KEY *key)
@@ -412,7 +385,6 @@ ossl_ecdsa_sign_sig(const unsigned char *digest, int 
digest_len,
        if ((e = BN_CTX_get(ctx)) == NULL)
                goto err;
 
-       /* Step 2: convert hash into an integer. */
        if (!ecdsa_prepare_digest(digest, digest_len, key, e))
                goto err;
 
@@ -435,7 +407,6 @@ ossl_ecdsa_sign_sig(const unsigned char *digest, int 
digest_len,
        }
 
        do {
-               /* Steps 3-8: calculate kinv and r. */
                if (!caller_supplied_values) {
                        if (!ECDSA_sign_setup(key, ctx, &kinv, &r)) {
                                ECDSAerror(ERR_R_ECDSA_LIB);
@@ -443,9 +414,7 @@ ossl_ecdsa_sign_sig(const unsigned char *digest, int 
digest_len,
                        }
                }
 
-               /*
-                * Steps 9 and 11: if s is non-NULL, we have a valid signature.
-                */
+               /* If s is non-NULL, we have a valid signature. */
                if (!ecdsa_compute_s(&s, e, kinv, r, key, ctx))
                        goto err;
                if (s != NULL)
@@ -462,7 +431,6 @@ ossl_ecdsa_sign_sig(const unsigned char *digest, int 
digest_len,
                }
        } while (1);
 
-       /* Step 12: output (r, s). */
        if ((sig = ECDSA_SIG_new()) == NULL) {
                ECDSAerror(ERR_R_MALLOC_FAILURE);
                goto err;
@@ -516,11 +484,6 @@ ossl_ecdsa_verify(int type, const unsigned char *digest, 
int digest_len,
        return ret;
 }
 
-/*
- * FIPS 186-5, section 6.4.2: ECDSA signature verification.
- * The caller provides us with the hash of the message, so has performed step 
2.
- */
-
 int
 ossl_ecdsa_verify_sig(const unsigned char *digest, int digest_len,
     const ECDSA_SIG *sig, EC_KEY *key)
@@ -530,7 +493,7 @@ ossl_ecdsa_verify_sig(const unsigned char *digest, int 
digest_len,
        EC_POINT *point = NULL;
        const BIGNUM *order;
        BN_CTX *ctx = NULL;
-       BIGNUM *e, *sinv, *u, *v, *x;
+       BIGNUM *u1, *u2, *e, *x;
        int ret = -1;
 
        if (key == NULL || sig == NULL) {
@@ -553,13 +516,11 @@ ossl_ecdsa_verify_sig(const unsigned char *digest, int 
digest_len,
 
        BN_CTX_start(ctx);
 
-       if ((e = BN_CTX_get(ctx)) == NULL)
+       if ((u1 = BN_CTX_get(ctx)) == NULL)
                goto err;
-       if ((sinv = BN_CTX_get(ctx)) == NULL)
+       if ((u2 = BN_CTX_get(ctx)) == NULL)
                goto err;
-       if ((u = BN_CTX_get(ctx)) == NULL)
-               goto err;
-       if ((v = BN_CTX_get(ctx)) == NULL)
+       if ((e = BN_CTX_get(ctx)) == NULL)
                goto err;
        if ((x = BN_CTX_get(ctx)) == NULL)
                goto err;
@@ -569,7 +530,7 @@ ossl_ecdsa_verify_sig(const unsigned char *digest, int 
digest_len,
                goto err;
        }
 
-       /* Step 1: verify that r and s are in the range [1, order). */
+       /* Verify that r and s are in the range [1, order). */
        if (BN_cmp(sig->r, BN_value_one()) < 0 || BN_cmp(sig->r, order) >= 0) {
                ECDSAerror(ECDSA_R_BAD_SIGNATURE);
                ret = 0;
@@ -581,35 +542,28 @@ ossl_ecdsa_verify_sig(const unsigned char *digest, int 
digest_len,
                goto err;
        }
 
-       /* Step 3: convert the hash into an integer. */
        if (!ecdsa_prepare_digest(digest, digest_len, key, e))
                goto err;
 
-       /* Step 4: compute the inverse of s modulo order. */
-       if (BN_mod_inverse_ct(sinv, sig->s, order, ctx) == NULL) {
+       if (BN_mod_inverse_ct(u2, sig->s, order, ctx) == NULL) { /* w = inv(s) 
*/
                ECDSAerror(ERR_R_BN_LIB);
                goto err;
        }
-       /* Step 5: compute u = s^-1 * e and v = s^-1 * r (modulo order). */
-       if (!BN_mod_mul(u, e, sinv, order, ctx)) {
+       if (!BN_mod_mul(u1, e, u2, order, ctx)) {               /* u1 = ew */
                ECDSAerror(ERR_R_BN_LIB);
                goto err;
        }
-       if (!BN_mod_mul(v, sig->r, sinv, order, ctx)) {
+       if (!BN_mod_mul(u2, sig->r, u2, order, ctx)) {          /* u2 = rw */
                ECDSAerror(ERR_R_BN_LIB);
                goto err;
        }
 
-       /*
-        * Steps 6 and 7: compute R = G * u + pub_key * v = (x, y). Reject if
-        * it's the point at infinity - getting affine coordinates fails. Keep
-        * the x coordinate.
-        */
+       /* Compute the x-coordinate of G * u1 + pub_key * u2. */
        if ((point = EC_POINT_new(group)) == NULL) {
                ECDSAerror(ERR_R_MALLOC_FAILURE);
                goto err;
        }
-       if (!EC_POINT_mul(group, point, u, pub_key, v, ctx)) {
+       if (!EC_POINT_mul(group, point, u1, pub_key, u2, ctx)) {
                ECDSAerror(ERR_R_EC_LIB);
                goto err;
        }
@@ -617,14 +571,13 @@ ossl_ecdsa_verify_sig(const unsigned char *digest, int 
digest_len,
                ECDSAerror(ERR_R_EC_LIB);
                goto err;
        }
-       /* Step 8: convert x to a number in [0, order). */
-       if (!BN_nnmod(x, x, order, ctx)) {
+       if (!BN_nnmod(u1, x, order, ctx)) {
                ECDSAerror(ERR_R_BN_LIB);
                goto err;
        }
 
-       /* Step 9: the signature is valid iff the x-coordinate is equal to r. */
-       ret = (BN_cmp(x, sig->r) == 0);
+       /* If the signature is correct, the x-coordinate is equal to sig->r. */
+       ret = (BN_cmp(u1, sig->r) == 0);
 
  err:
        BN_CTX_end(ctx);
diff --git a/share/man/man4/pf.4 b/share/man/man4/pf.4
index 92eeb45f657..7346c7e3194 100644
--- a/share/man/man4/pf.4
+++ b/share/man/man4/pf.4
@@ -48,12 +48,25 @@ and retrieve statistics.
 The most commonly used functions are covered by
 .Xr pfctl 8 .
 .Pp
-Manipulations like loading a ruleset that involve more than a single
+Operations loading or reading a ruleset that involve more than a single
 .Xr ioctl 2
 call require a so-called
-.Em ticket ,
-which prevents the occurrence of
-multiple concurrent manipulations.
+.Sy ticket ,
+which allows
+.Xr pf 4
+to deal with concurrent operations.
+For certain
+.Xr ioctl 2
+commands (currently
+.Dv DIOCGETRULES )
+the number of tickets program can get is limited.
+The program must explicitly release the ticket using the
+.Dv DIOCXEND
+command to avoid hitting the limit.
+All tickets which are not freed by
+.Dv DIOCXEND
+are released when the program closes
+.Pa /dev/pf .
 .Pp
 Fields of
 .Xr ioctl 2
@@ -132,6 +145,9 @@ for subsequent
 calls and the number
 .Va nr
 of rules in the active ruleset.
+The ticket should be released by the
+.Dv DIOCXEND
+command.
 .It Dv DIOCGETRULE Fa "struct pfioc_rule *pr"
 Get a
 .Va rule
@@ -792,6 +808,10 @@ inactive rulesets since the last
 .Dv DIOCXBEGIN .
 .Dv DIOCXROLLBACK
 will silently ignore rulesets for which the ticket is invalid.
+.It Dv DIOCXEND Fa "u_int32_t *ticket"
+Release ticket obtained by the
+.Dv DIOCGETRULES
+command.
 .It Dv DIOCSETHOSTID Fa "u_int32_t *hostid"
 Set the host ID, which is used by
 .Xr pfsync 4
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index d9980176657..eea800a78ff 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cpu.h,v 1.155 2023/07/04 17:29:32 cheloha Exp $       */
+/*     $OpenBSD: cpu.h,v 1.154 2022/11/29 21:41:39 guenther Exp $      */
 /*     $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $     */
 
 /*-
@@ -112,8 +112,10 @@ struct cpu_info {
 #define ci_PAGEALIGN   ci_dev
        struct device *ci_dev;          /* [I] */
        struct cpu_info *ci_self;       /* [I] */
+       struct schedstate_percpu ci_schedstate; /* scheduler state */
        struct cpu_info *ci_next;       /* [I] */
 
+       struct proc *ci_curproc;        /* [o] */
        u_int ci_cpuid;                 /* [I] */
        u_int ci_apicid;                /* [I] */
        u_int ci_acpi_proc_id;          /* [I] */
@@ -127,9 +129,6 @@ struct cpu_info {
        char            ci_mds_tmp[32]; /* [o] 32byte aligned */
        void            *ci_mds_buf;    /* [I] */
 
-       struct proc *ci_curproc;        /* [o] */
-       struct schedstate_percpu ci_schedstate; /* scheduler state */
-
        struct pmap *ci_proc_pmap;      /* last userspace pmap */
        struct pcb *ci_curpcb;          /* [o] */
        struct pcb *ci_idle_pcb;        /* [o] */
diff --git a/sys/arch/riscv64/conf/GENERIC b/sys/arch/riscv64/conf/GENERIC
index acf00b84a25..9b526541b2f 100644
--- a/sys/arch/riscv64/conf/GENERIC
+++ b/sys/arch/riscv64/conf/GENERIC
@@ -1,4 +1,4 @@
-#      $OpenBSD: GENERIC,v 1.43 2023/07/04 13:04:08 kettenis Exp $
+#      $OpenBSD: GENERIC,v 1.42 2023/01/24 13:28:31 jca Exp $
 #
 # For further information on compiling OpenBSD kernels, see the config(8)
 # man page.
@@ -83,7 +83,6 @@ gpiorestart*  at fdt?
 
 cad*           at fdt?
 dwge*          at fdt?
-dwqe*          at fdt?
 
 dwmmc*         at fdt?
 sdmmc*         at dwmmc?
diff --git a/sys/arch/riscv64/conf/RAMDISK b/sys/arch/riscv64/conf/RAMDISK
index 45bc8983aa0..8f114b63619 100644
--- a/sys/arch/riscv64/conf/RAMDISK
+++ b/sys/arch/riscv64/conf/RAMDISK
@@ -1,4 +1,4 @@
-#      $OpenBSD: RAMDISK,v 1.37 2023/07/04 13:04:08 kettenis Exp $
+#      $OpenBSD: RAMDISK,v 1.36 2023/04/25 14:04:47 kn Exp $
 
 machine                riscv64
 maxusers       4
@@ -73,7 +73,6 @@ gpiorestart*  at fdt?
 
 cad*           at fdt?
 dwge*          at fdt?
-dwqe*          at fdt?
 
 dwmmc*         at fdt?
 sdmmc*         at dwmmc?
diff --git a/sys/dev/fdt/if_dwqe_fdt.c b/sys/dev/fdt/if_dwqe_fdt.c
index 1e98c2e9d85..a9755691b3e 100644
--- a/sys/dev/fdt/if_dwqe_fdt.c
+++ b/sys/dev/fdt/if_dwqe_fdt.c
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_dwqe_fdt.c,v 1.13 2023/07/04 12:58:42 kettenis Exp $       
*/
+/*     $OpenBSD: if_dwqe_fdt.c,v 1.12 2023/05/30 08:30:01 jsg Exp $    */
 /*
  * Copyright (c) 2008, 2019 Mark Kettenis <kette...@openbsd.org>
  * Copyright (c) 2017, 2022 Patrick Wildt <patr...@blueri.se>
@@ -63,7 +63,6 @@
 
 int    dwqe_fdt_match(struct device *, void *, void *);
 void   dwqe_fdt_attach(struct device *, struct device *, void *);
-void   dwqe_setup_jh7110(struct dwqe_softc *);
 void   dwqe_setup_rk3568(struct dwqe_softc *);
 void   dwqe_mii_statchg_rk3568(struct device *);
 void   dwqe_mii_statchg_rk3588(struct device *);
@@ -79,8 +78,7 @@ dwqe_fdt_match(struct device *parent, void *cfdata, void *aux)
 {
        struct fdt_attach_args *faa = aux;
 
-       return OF_is_compatible(faa->fa_node, "snps,dwmac-4.20a") ||
-           OF_is_compatible(faa->fa_node, "snps,dwmac-5.20");
+       return OF_is_compatible(faa->fa_node, "snps,dwmac-4.20a");
 }
 
 void
@@ -105,16 +103,14 @@ dwqe_fdt_attach(struct device *parent, struct device 
*self, void *aux)
 
        /* Decide GMAC id through address */
        switch (faa->fa_reg[0].addr) {
-       case 0xfe2a0000:        /* RK3568 */
-       case 0x16030000:        /* JH7110 */
+       case 0xfe2a0000:
                sc->sc_gmac_id = 0;
                break;
-       case 0xfe010000:        /* RK3568 */
-       case 0x16040000:        /* JH7110 */
+       case 0xfe010000:
                sc->sc_gmac_id = 1;
                break;
        default:
-               printf(": unknown controller at 0x%llx\n", faa->fa_reg[0].addr);
+               printf(": unknown controller\n");
                return;
        }
 
@@ -147,13 +143,8 @@ dwqe_fdt_attach(struct device *parent, struct device 
*self, void *aux)
        /* Enable clocks. */
        clock_set_assigned(faa->fa_node);
        clock_enable(faa->fa_node, "stmmaceth");
-       clock_enable(faa->fa_node, "pclk");
        reset_deassert(faa->fa_node, "stmmaceth");
-       reset_deassert(faa->fa_node, "ahb");
-       if (OF_is_compatible(faa->fa_node, "starfive,jh7110-dwmac")) {
-               clock_enable(faa->fa_node, "tx");
-               clock_enable(faa->fa_node, "gtx");
-       } else if (OF_is_compatible(faa->fa_node, "rockchip,rk3568-gmac")) {
+       if (OF_is_compatible(faa->fa_node, "rockchip,rk3568-gmac")) {
                clock_enable(faa->fa_node, "mac_clk_rx");
                clock_enable(faa->fa_node, "mac_clk_tx");
                clock_enable(faa->fa_node, "aclk_mac");
@@ -162,9 +153,7 @@ dwqe_fdt_attach(struct device *parent, struct device *self, 
void *aux)
        delay(5000);
 
        /* Do hardware specific initializations. */
-       if (OF_is_compatible(faa->fa_node, "starfive,jh7110-dwmac"))
-               dwqe_setup_jh7110(sc);
-       else if (OF_is_compatible(faa->fa_node, "rockchip,rk3568-gmac"))
+       if (OF_is_compatible(faa->fa_node, "rockchip,rk3568-gmac"))
                dwqe_setup_rk3568(sc);
 
        /* Power up PHY. */
@@ -303,10 +292,6 @@ dwqe_reset_phy(struct dwqe_softc *sc, uint32_t phy)
        free(gpio, M_TEMP, len);
 }
 
-/* JH7110 registers */
-#define JH7110_PHY_INTF_RGMII          1
-#define JH7110_PHY_INTF_RMII           4
-
 /* RK3568 registers */
 #define RK3568_GRF_GMACx_CON0(x)       (0x0380 + (x) * 0x8)
 #define  RK3568_GMAC_CLK_RX_DL_CFG(val)                ((0x7f << 8) << 16 | 
((val) << 8))
@@ -319,48 +304,6 @@ dwqe_reset_phy(struct dwqe_softc *sc, uint32_t phy)
 
 void   dwqe_mii_statchg_rk3568_task(void *);
 
-void
-dwqe_setup_jh7110(struct dwqe_softc *sc)
-{
-       struct regmap *rm;
-       uint32_t cells[3];
-       uint32_t phandle, offset, reg, shift;
-       char phy_mode[32];
-       uint32_t iface;
-
-       if (OF_getpropintarray(sc->sc_node, "starfive,syscon", cells,
-           sizeof(cells)) != sizeof(cells)) {
-               printf("%s: failed to get starfive,syscon\n", __func__);
-               return;
-       }
-       phandle = cells[0];
-       offset = cells[1];
-       shift = cells[2];
-
-       rm = regmap_byphandle(phandle);
-       if (rm == NULL) {
-               printf("%s: failed to get regmap\n", __func__);
-               return;
-       }
-
-       if (OF_getprop(sc->sc_node, "phy-mode", phy_mode,
-           sizeof(phy_mode)) <= 0)
-               return;
-
-       if (strcmp(phy_mode, "rgmii") == 0 ||
-           strcmp(phy_mode, "rgmii-id") == 0) {
-               iface = JH7110_PHY_INTF_RGMII;
-       } else if (strcmp(phy_mode, "rmii") == 0) {
-               iface = JH7110_PHY_INTF_RMII;
-       } else
-               return;
-
-       reg = regmap_read_4(rm, offset);
-       reg &= ~(((1U << 3) - 1) << shift);
-       reg |= iface << shift;
-       regmap_write_4(rm, offset, reg);
-}
-
 void
 dwqe_setup_rk3568(struct dwqe_softc *sc)
 {
diff --git a/sys/dev/fdt/qcsmptp.c b/sys/dev/fdt/qcsmptp.c
index 40f68c97490..50fe85786ac 100644
--- a/sys/dev/fdt/qcsmptp.c
+++ b/sys/dev/fdt/qcsmptp.c
@@ -1,4 +1,4 @@
-/*     $OpenBSD: qcsmptp.c,v 1.2 2023/07/04 14:32:21 patrick Exp $     */
+/*     $OpenBSD: qcsmptp.c,v 1.1 2023/05/19 21:26:10 patrick Exp $     */
 /*
  * Copyright (c) 2023 Patrick Wildt <patr...@blueri.se>
  *
@@ -182,18 +182,6 @@ qcsmptp_deferred(struct device *self)
                return;
        }
 
-       if (qcsmem_alloc(sc->sc_remote_pid, sc->sc_smem_id[0],
-           sizeof(*sc->sc_in)) != 0) {
-               printf(": can't alloc smp2p item\n");
-               return;
-       }
-
-       sc->sc_in = qcsmem_get(sc->sc_remote_pid, sc->sc_smem_id[0], NULL);
-       if (sc->sc_in == NULL) {
-               printf(": can't get smp2p item\n");
-               return;
-       }
-
        if (qcsmem_alloc(sc->sc_remote_pid, sc->sc_smem_id[1],
            sizeof(*sc->sc_out)) != 0) {
                printf(": can't alloc smp2p item\n");
@@ -266,6 +254,15 @@ qcsmptp_intr(void *arg)
        uint32_t changed, val;
        int do_ack = 0, i;
 
+       /* Inbound item exists as soon as remoteproc is up. */
+       if (sc->sc_in == NULL)
+               sc->sc_in = qcsmem_get(sc->sc_remote_pid,
+                   sc->sc_smem_id[0], NULL);
+       if (sc->sc_in == NULL) {
+               printf("%s: can't get smp2p item\n", sc->sc_dev.dv_xname);
+               return 1;
+       }
+
        /* Do initial feature negotiation if inbound is new. */
        if (!sc->sc_negotiated) {
                if (sc->sc_in->version != sc->sc_out->version)
diff --git a/sys/net/if.c b/sys/net/if.c
index 30a36d844a6..8901f84b0ab 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if.c,v 1.703 2023/07/04 13:37:47 jan Exp $    */
+/*     $OpenBSD: if.c,v 1.702 2023/07/02 19:59:15 bluhm Exp $  */
 /*     $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $  */
 
 /*
@@ -3206,7 +3206,7 @@ ifsetlro(struct ifnet *ifp, int on)
        KERNEL_ASSERT_LOCKED(); /* for if_flags */
 
        if (on && !ISSET(ifp->if_xflags, IFXF_LRO)) {
-               if (ifp->if_type == IFT_ETHER && ether_brport_isset(ifp)) {
+               if (ether_brport_isset(ifp)) {
                        error = EBUSY;
                        goto out;
                }
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index f20632df590..6875f08ee0a 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pf_ioctl.c,v 1.414 2023/07/04 14:23:38 sashan Exp $ */
+/*     $OpenBSD: pf_ioctl.c,v 1.413 2023/07/04 11:34:19 sashan Exp $ */
 
 /*
  * Copyright (c) 2001 Daniel Hartmeier
@@ -179,10 +179,6 @@ void                        pf_rtlabel_copyout(struct 
pf_addr_wrap *);
 
 LIST_HEAD(, pf_trans)  pf_ioctl_trans = LIST_HEAD_INITIALIZER(pf_trans);
 
-/* counts transactions opened by a device */
-unsigned int pf_tcount[CLONE_MAPSZ * NBBY];
-#define pf_unit2idx(_unit_)    ((_unit_) >> CLONE_SHIFT)
-
 void
 pfattach(int num)
 {
@@ -1496,10 +1492,6 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
                NET_UNLOCK();
 
                t = pf_open_trans(minor(dev));
-               if (t == NULL) {
-                       error = EBUSY;
-                       goto fail;
-               }
                pf_init_tgetrule(t, ruleset->anchor, ruleset_version, rule);
                pr->ticket = t->pft_ticket;
 
@@ -3284,14 +3276,9 @@ pf_open_trans(uint32_t unit)
 
        rw_assert_wrlock(&pfioctl_rw);
 
-       KASSERT(pf_unit2idx(unit) < nitems(pf_tcount));
-       if (pf_tcount[pf_unit2idx(unit)] >= (PF_ANCHOR_STACK_MAX * 8))
-               return (NULL);
-
        t = malloc(sizeof(*t), M_PF, M_WAITOK|M_ZERO);
        t->pft_unit = unit;
        t->pft_ticket = ticket++;
-       pf_tcount[pf_unit2idx(unit)]++;
 
        LIST_INSERT_HEAD(&pf_ioctl_trans, t, pft_entry);
 
@@ -3345,11 +3332,6 @@ pf_free_trans(struct pf_trans *t)
                log(LOG_ERR, "%s unknown transaction type: %d\n",
                    __func__, t->pft_type);
        }
-
-       KASSERT(pf_unit2idx(t->pft_unit) < nitems(pf_tcount));
-       KASSERT(pf_tcount[pf_unit2idx(t->pft_unit)] >= 1);
-       pf_tcount[pf_unit2idx(t->pft_unit)]--;
-
        free(t, M_PF, sizeof(*t));
 }
 
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm 
b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 8e0481f65f7..5dfaa3f496a 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.289 2023/07/04 14:41:26 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.287 2023/06/13 09:07:17 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <es...@openbsd.org>
 #
@@ -1950,10 +1950,16 @@ sub _iso8601_to_time($s)
 {
        if ($s =~ m/^(\d{4})\-(\d{2})\-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})Z$/) {
                my ($year, $month, $day, $hour, $min, $sec) =
-                   ($1 - 1900, $2-1, $3, $4, $5, $6);
+                       ($1 - 1900, $2-1, $3, $4, $5, $6);
                require POSIX;
-               local $ENV{TZ} = 'UTC';
+               my $oldtz = $ENV{TZ};
+               $ENV{TZ} = 'UTC';
                my $t = POSIX::mktime($sec, $min, $hour, $day, $month, $year);
+               if (defined $oldtz) {
+                       $ENV{TZ} = $oldtz;
+               } else {
+                       delete $ENV{TZ};
+               }
                return $t;
        } else {
                die "Incorrect ISO8601 timestamp: $s";
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm 
b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
index 8c2ddca65a3..dbcf5eb0b21 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
@@ -1,6 +1,6 @@
 #! /usr/bin/perl
 # ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.194 2023/07/04 14:03:16 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.192 2023/06/20 14:50:05 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <es...@openbsd.org>
 #
@@ -373,9 +373,6 @@ sub check_version($, $, $)
 {
 }
 
-
-# Virtual PackingElements related to chunked gzips and LRU caching.
-# see save_history
 package OpenBSD::PackingElement::StreamMarker;
 our @ISA = qw(OpenBSD::PackingElement::Meta);
 sub new($class)
@@ -594,8 +591,7 @@ sub makesum_plist($self, $state, $plist)
        my $fname = $self->fullname;
        for (my $i = 1; ; $i++) {
                if (-e "$state->{base}/$fname-$i") {
-                       my $e = OpenBSD::PackingElement::File->add($plist, 
-                           $self->name."-".$i);
+                       my $e = OpenBSD::PackingElement::File->add($plist, 
$self->name."-".$i);
                        $e->compute_checksum($e, $state, $state->{base});
                } else {
                        last;
@@ -705,9 +701,7 @@ sub avert_duplicates_and_other_checks($self, $state)
        } elsif ($self->spec->is_valid) {
                my @m = $self->spec->filter($self->{def});
                if (@m == 0) {
-                       $state->error(
-                           "\@#1 #2\n".
-                           "  pattern #3 doesn't match default #4\n",
+                       $state->error("\@#1 #2\n  pattern #3 doesn't match 
default #4\n",
                            $self->keyword, $self->stringize,
                            $self->{pattern}, $self->{def});
                }
@@ -772,9 +766,7 @@ sub check_version($self, $state, $unsubst)
        my @l  = $self->parse($self->name);
        if (defined $l[0]) {
                if (!$unsubst =~ m/\$\{LIB$l[0]_VERSION\}/) {
-                       $state->error(
-                           "Incorrectly versioned shared library: #1", 
-                           $unsubst);
+                       $state->error("Incorrectly versioned shared library: 
#1", $unsubst);
                }
        } else {
                $state->error("Invalid shared library #1", $unsubst);
diff --git a/usr.sbin/pkg_add/pkg_create.1 b/usr.sbin/pkg_add/pkg_create.1
index 8204076e6c3..d2e28a90181 100644
--- a/usr.sbin/pkg_add/pkg_create.1
+++ b/usr.sbin/pkg_add/pkg_create.1
@@ -1,4 +1,4 @@
-.\"    $OpenBSD: pkg_create.1,v 1.130 2023/07/04 14:08:30 espie Exp $
+.\"    $OpenBSD: pkg_create.1,v 1.128 2023/01/25 13:25:07 espie Exp $
 .\"
 .\" Documentation and design originally from FreeBSD. All the code has
 .\" been rewritten since. We keep the documentation's notice:
@@ -21,7 +21,7 @@
 .\" [jkh] Took John's changes back and made some additional extensions for
 .\" better integration with FreeBSD's new ports collection.
 .\"
-.Dd $Mdocdate: July 4 2023 $
+.Dd $Mdocdate: January 25 2023 $
 .Dt PKG_CREATE 1
 .Os
 .Sh NAME
@@ -161,11 +161,6 @@ If set, disable the
 annotations in the generated package, rely on the normal
 .Xr tar 1
 timestamps instead.
-(Mostly used to create firmware "packages" since
-.Xr fw_update 1
-only handles a very small subset of the
-.Xr package 5
-format.)
 .It Cm USE_GROFF
 Set to 1 to have groff format manpages behind the scenes during
 package creation.
@@ -330,7 +325,7 @@ The
 .Dq packing-list
 format (see
 .Fl f )
-is fairly straightforward: basically a list of filenames and directory names
+is fairly simple, being basically a list of filenames and directory names
 to include in the package.
 .Pp
 Substitution of variables and inclusion of fragments is documented in the

Reply via email to