From owner-freebsd-transport@freebsd.org Fri Oct 7 11:34:29 2016 Return-Path: Delivered-To: freebsd-transport@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E2BABEC4ED for ; Fri, 7 Oct 2016 11:34:29 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-qk0-x234.google.com (mail-qk0-x234.google.com [IPv6:2607:f8b0:400d:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 57BA0A48 for ; Fri, 7 Oct 2016 11:34:29 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-qk0-x234.google.com with SMTP id o68so40188510qkf.3 for ; Fri, 07 Oct 2016 04:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jgAFgvflI2j3EBpWiKgBPGvIJybBPpqawumo0SbvXI4=; b=RHie63XKQEVhxPMaYudD6wRgU5nMeDv9cU+uL0x1g6rIIOflXi7/406y5iWLdH4r16 ou3+N5UDsvqY2SyF3BDkPIAtauGgFzTzA9eX0vVfcwtKV18y8eqFi9+bRlzl/8ND9ZQm wEFCALiEM3G/0bkVRzRGZ2LyqHOjeyVXmKrEohL+iuQezO1/hZd5HXRXAa2NVjQnBmlz b3DKnHPU+1bfC4PvYfgbbH437T9FDV55XuezVS4U7EXbB+iPKU4fQty+pjOVdBsxcCpM oM+etz0bcFoczPwyzGT6luaGTVTxgjkaCG9IntzKknwLTgJwaXr3v8UCVzMmaipy0hho G2wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jgAFgvflI2j3EBpWiKgBPGvIJybBPpqawumo0SbvXI4=; b=XOAhmlFn1cV4C8no1jTuAHXmhAxOc25HMAbA1ZFcdyZTiBRcLiynMT88MSrTrPTNlU rLfiHsmTdQLmiRDShj558yWMc2guqR5vNScoNFbema5HXXw3n5pvYb/KnbcT6IxYK7Z0 6RCLQhgaLG6rYSS+tZ92B3A3I3hiqYAmANYdwhxlbmGiwR9guSHiZ1Z4M2Nb7OjcPnTB DYFyoh4lNRTDugaNDaDsHuiWzIc4NFarvZ4mLvst5EV+g+IU178hVQLpIkZXi3iTB15j sOeuibjJ4SuEiNGzpZzE7hKE32S0Jtz6X2LQI1+6OjB0NegYgO+NEWxUbmZTOcLycr15 1X5g== X-Gm-Message-State: AA6/9RnX/9pCEETTK4uvd+NpXEaz/GM4QsaheAgLoKph9sxFWJ8C1/wA/rfF4fTOLmDI8ZqR2ibsS93fkxpd2A== X-Received: by 10.55.149.67 with SMTP id x64mr20107172qkd.135.1475840068436; Fri, 07 Oct 2016 04:34:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.53.208 with HTTP; Fri, 7 Oct 2016 04:34:27 -0700 (PDT) In-Reply-To: References: From: Jonathan Looney Date: Fri, 7 Oct 2016 07:34:27 -0400 Message-ID: Subject: Re: Remove (struct tcpcb) from the API? To: Adrian Chadd Cc: "" X-Mailman-Approved-At: Fri, 07 Oct 2016 12:46:20 +0000 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-transport@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions of transport level network protocols in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2016 11:34:29 -0000 On Thu, Oct 6, 2016 at 4:21 PM, Adrian Chadd 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