ok guenther@

(Thanks!)

On Sat, Sep 10, 2022 at 10:20 AM Vitaliy Makkoveev <m...@openbsd.org> wrote:

> We have no interest on pru_rcvd() return value. Also, we call pru_rcvd()
> only if the socket's protocol have PR_WANTRCVD flag set. Such sockets
> are route domain, tcp(4) and unix(4) sockets.
>
> This diff keeps the PR_WANTRCVD check. In other hand we could always
> call pru_rcvd() and do "pru_rcvd != NULL" check within, but in the
> future with per buffer locking, we could have some re-locking around
> pru_rcvd() call and I want to do it outside wrapper.
>
>
> Index: sys/kern/uipc_usrreq.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v
> retrieving revision 1.185
> diff -u -p -r1.185 uipc_usrreq.c
> --- sys/kern/uipc_usrreq.c      3 Sep 2022 22:43:38 -0000       1.185
> +++ sys/kern/uipc_usrreq.c      10 Sep 2022 18:51:42 -0000
> @@ -363,7 +363,7 @@ uipc_shutdown(struct socket *so)
>         return (0);
>  }
>
> -int
> +void
>  uipc_rcvd(struct socket *so)
>  {
>         struct socket *so2;
> @@ -390,8 +390,6 @@ uipc_rcvd(struct socket *so)
>         default:
>                 panic("uipc 2");
>         }
> -
> -       return (0);
>  }
>
>  int
> Index: sys/net/rtsock.c
> ===================================================================
> RCS file: /cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.355
> diff -u -p -r1.355 rtsock.c
> --- sys/net/rtsock.c    8 Sep 2022 10:22:06 -0000       1.355
> +++ sys/net/rtsock.c    10 Sep 2022 18:51:42 -0000
> @@ -115,7 +115,7 @@ int route_attach(struct socket *, int);
>  int    route_detach(struct socket *);
>  int    route_disconnect(struct socket *);
>  int    route_shutdown(struct socket *);
> -int    route_rcvd(struct socket *);
> +void   route_rcvd(struct socket *);
>  int    route_send(struct socket *, struct mbuf *, struct mbuf *,
>             struct mbuf *);
>  int    route_abort(struct socket *);
> @@ -299,7 +299,7 @@ route_shutdown(struct socket *so)
>         return (0);
>  }
>
> -int
> +void
>  route_rcvd(struct socket *so)
>  {
>         struct rtpcb *rop = sotortpcb(so);
> @@ -314,8 +314,6 @@ route_rcvd(struct socket *so)
>             ((sbspace(rop->rop_socket, &rop->rop_socket->so_rcv) ==
>             rop->rop_socket->so_rcv.sb_hiwat)))
>                 rop->rop_flags &= ~ROUTECB_FLAG_FLUSH;
> -
> -       return (0);
>  }
>
>  int
> Index: sys/netinet/tcp_usrreq.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/tcp_usrreq.c,v
> retrieving revision 1.207
> diff -u -p -r1.207 tcp_usrreq.c
> --- sys/netinet/tcp_usrreq.c    3 Sep 2022 22:43:38 -0000       1.207
> +++ sys/netinet/tcp_usrreq.c    10 Sep 2022 18:51:42 -0000
> @@ -792,18 +792,17 @@ out:
>  /*
>   * After a receive, possibly send window update to peer.
>   */
> -int
> +void
>  tcp_rcvd(struct socket *so)
>  {
>         struct inpcb *inp;
>         struct tcpcb *tp;
> -       int error;
>         short ostate;
>
>         soassertlocked(so);
>
> -       if ((error = tcp_sogetpcb(so, &inp, &tp)))
> -               return (error);
> +       if (tcp_sogetpcb(so, &inp, &tp))
> +               return;
>
>         if (so->so_options & SO_DEBUG)
>                 ostate = tp->t_state;
> @@ -820,7 +819,6 @@ tcp_rcvd(struct socket *so)
>
>         if (so->so_options & SO_DEBUG)
>                 tcp_trace(TA_USER, ostate, tp, tp, NULL, PRU_RCVD, 0);
> -       return (0);
>  }
>
>  /*
> Index: sys/netinet/tcp_var.h
> ===================================================================
> RCS file: /cvs/src/sys/netinet/tcp_var.h,v
> retrieving revision 1.157
> diff -u -p -r1.157 tcp_var.h
> --- sys/netinet/tcp_var.h       3 Sep 2022 22:43:38 -0000       1.157
> +++ sys/netinet/tcp_var.h       10 Sep 2022 18:51:42 -0000
> @@ -725,7 +725,7 @@ int  tcp_connect(struct socket *, struct
>  int     tcp_accept(struct socket *, struct mbuf *);
>  int     tcp_disconnect(struct socket *);
>  int     tcp_shutdown(struct socket *);
> -int     tcp_rcvd(struct socket *);
> +void    tcp_rcvd(struct socket *);
>  int     tcp_send(struct socket *, struct mbuf *, struct mbuf *,
>              struct mbuf *);
>  int     tcp_abort(struct socket *);
> Index: sys/sys/protosw.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/protosw.h,v
> retrieving revision 1.55
> diff -u -p -r1.55 protosw.h
> --- sys/sys/protosw.h   5 Sep 2022 14:56:09 -0000       1.55
> +++ sys/sys/protosw.h   10 Sep 2022 18:51:42 -0000
> @@ -72,7 +72,7 @@ struct pr_usrreqs {
>         int     (*pru_accept)(struct socket *, struct mbuf *);
>         int     (*pru_disconnect)(struct socket *);
>         int     (*pru_shutdown)(struct socket *);
> -       int     (*pru_rcvd)(struct socket *);
> +       void    (*pru_rcvd)(struct socket *);
>         int     (*pru_send)(struct socket *, struct mbuf *, struct mbuf *,
>                     struct mbuf *);
>         int     (*pru_abort)(struct socket *);
> @@ -336,12 +336,10 @@ pru_shutdown(struct socket *so)
>         return (*so->so_proto->pr_usrreqs->pru_shutdown)(so);
>  }
>
> -static inline int
> +static inline void
>  pru_rcvd(struct socket *so)
>  {
> -       if (so->so_proto->pr_usrreqs->pru_rcvd)
> -               return (*so->so_proto->pr_usrreqs->pru_rcvd)(so);
> -       return (EOPNOTSUPP);
> +       (*so->so_proto->pr_usrreqs->pru_rcvd)(so);
>  }
>
>  static inline int
> Index: sys/sys/unpcb.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/unpcb.h,v
> retrieving revision 1.40
> diff -u -p -r1.40 unpcb.h
> --- sys/sys/unpcb.h     3 Sep 2022 22:43:39 -0000       1.40
> +++ sys/sys/unpcb.h     10 Sep 2022 18:51:42 -0000
> @@ -120,7 +120,7 @@ int uipc_connect(struct socket *, struct
>  int    uipc_accept(struct socket *, struct mbuf *);
>  int    uipc_disconnect(struct socket *);
>  int    uipc_shutdown(struct socket *);
> -int    uipc_rcvd(struct socket *);
> +void   uipc_rcvd(struct socket *);
>  int    uipc_send(struct socket *, struct mbuf *, struct mbuf *,
>             struct mbuf *);
>  int    uipc_abort(struct socket *);
>
>

Reply via email to