Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Oct 2016 07:34:27 -0400
From:      Jonathan Looney <jonlooney@gmail.com>
To:        Adrian Chadd <adrian.chadd@gmail.com>
Cc:        "<freebsd-transport@freebsd.org>" <freebsd-transport@freebsd.org>
Subject:   Re: Remove (struct tcpcb) from the API?
Message-ID:  <CADrOrmsYa-JxBVA=yEOrXo%2B1XxVzxF%2BMi1L--kadTgGrH4x1Rw@mail.gmail.com>
In-Reply-To: <CAJ-VmokX%2BW=F-KNOwCPHm=9-Lp1JzQKS%2BUJo7N-dEEnH2z1sug@mail.gmail.com>
References:  <CADrOrmuG_GvqnenU8g9UXGN3uPDyMOapHm%2BX85iNa-RNHp1wUQ@mail.gmail.com> <CAJ-VmokX%2BW=F-KNOwCPHm=9-Lp1JzQKS%2BUJo7N-dEEnH2z1sug@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Oct 6, 2016 at 4:21 PM, Adrian Chadd <adrian.chadd@gmail.com> wrote:

> Wait, I thought we had xtcpcb or something to face userland?
>

Yes, but the xtcpcb structure includes the entire (struct tcpcb):

    struct  xtcpcb {
            size_t  xt_len;
            struct  inpcb   xt_inp;
            struct  tcpcb   xt_tp;
            struct  xsocket xt_socket;
            struct  xtcp_timer xt_timer;
            u_quad_t        xt_alignment_hack;
    };

And, in tcp_pcblist():

    struct xtcpcb xt;
    [...]
    inp_ppcb = inp->inp_ppcb;
    [...]
    bcopy(inp_ppcb, &xt.xt_tp, sizeof xt.xt_tp);


So, my proposal is to replace xt_tp with a minimal structure that includes
the (20 or so?) fields that userland actually cares about. Importantly, we
can then leave that structure as the stable API, while we are free to
modify the actual (struct tcpcb). Relatedly, this could cut down
substantially on the number of bytes we copy out for each TCP session
(which can really add up on a loaded box, and only adds to the overhead of
the locking).

Jonathan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADrOrmsYa-JxBVA=yEOrXo%2B1XxVzxF%2BMi1L--kadTgGrH4x1Rw>