1*11a6dbe7Smartin.\" $NetBSD: tcp_congctl.9,v 1.4 2008/04/30 13:10:58 martin Exp $ 2f3330397Srpaulo.\" 3f3330397Srpaulo.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 4f3330397Srpaulo.\" All rights reserved. 5f3330397Srpaulo.\" 6f3330397Srpaulo.\" This code is derived from software contributed to The NetBSD Foundation 7f3330397Srpaulo.\" by Rui Paulo. 8f3330397Srpaulo.\" 9f3330397Srpaulo.\" Redistribution and use in source and binary forms, with or without 10f3330397Srpaulo.\" modification, are permitted provided that the following conditions 11f3330397Srpaulo.\" are met: 12f3330397Srpaulo.\" 1. Redistributions of source code must retain the above copyright 13f3330397Srpaulo.\" notice, this list of conditions and the following disclaimer. 14f3330397Srpaulo.\" 2. Redistributions in binary form must reproduce the above copyright 15f3330397Srpaulo.\" notice, this list of conditions and the following disclaimer in the 16f3330397Srpaulo.\" documentation and/or other materials provided with the distribution. 17f3330397Srpaulo.\" 18f3330397Srpaulo.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19f3330397Srpaulo.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20f3330397Srpaulo.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21f3330397Srpaulo.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22f3330397Srpaulo.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23f3330397Srpaulo.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24f3330397Srpaulo.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25f3330397Srpaulo.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26f3330397Srpaulo.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27f3330397Srpaulo.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28f3330397Srpaulo.\" POSSIBILITY OF SUCH DAMAGE. 29f3330397Srpaulo.\" 30ebc62e8aSrpaulo.Dd October 15, 2006 31f3330397Srpaulo.Dt TCP_CONGCTL 9 32f3330397Srpaulo.Os 33f3330397Srpaulo.Sh NAME 34f3330397Srpaulo.Nm tcp_congctl 35f3330397Srpaulo.Nd TCP congestion control API 36f3330397Srpaulo.Sh SYNOPSIS 37f3330397Srpaulo.In netinet/tcp_congctl.h 38f3330397Srpaulo.\" 39f3330397Srpaulo.Ft int 40f3330397Srpaulo.Fn tcp_congctl_register "const char *" "struct tcp_congctl *" 41f3330397Srpaulo.\" 42f3330397Srpaulo.Ft int 43f3330397Srpaulo.Fn tcp_congctl_unregister "const char *" 44f3330397Srpaulo.\" 45f3330397Srpaulo.Sh DESCRIPTION 46f3330397SrpauloThe 47f3330397Srpaulo.Nm tcp_congctrl 48f3330397SrpauloAPI is used to add or remove TCP congestion control algorithms 49f3330397Srpauloon-the-fly and to modularize them. 50f3330397SrpauloIt includes basically two functions: 51f3330397Srpaulo.Bl -tag -width "xxxxx" 52f3330397Srpaulo.It Fn tcp_congctl_register "const char *" "struct tcp_congctl *" 53ca581239SwizRegisters a new congestion control algorithm. 54ca581239SwizThe 55f3330397Srpaulo.Fa struct tcp_congctl 56f3330397Srpauloargument must contain a list of callbacks like the following: 57f3330397Srpaulo.Bd -literal -offset indent 58f3330397Srpaulostruct tcp_congctl { 59f3330397Srpaulo int (*fast_retransmit)(struct tcpcb *, 60f3330397Srpaulo struct tcphdr *); 61f3330397Srpaulo void (*slow_retransmit)(struct tcpcb *); 62f3330397Srpaulo void (*fast_retransmit_newack)(struct tcpcb *, 63f3330397Srpaulo struct tcphdr *); 64f3330397Srpaulo void (*newack)(struct tcpcb *, 65f3330397Srpaulo struct tcphdr *); 66ebc62e8aSrpaulo void (*cong_exp)(struct tcpcb *); 67f3330397Srpaulo}; 68f3330397Srpaulo.Ed 69f3330397Srpaulo.It Fn tcp_congctl_unregister "const char *" 70f3330397SrpauloIf found, unregister the selected TCP congestion control algorithm. 71f3330397Srpaulo.El 72f3330397Srpaulo.Sh RETURN VALUES 73f3330397Srpaulo.Fn tcp_congctl_register 74f3330397Srpauloand 75f3330397Srpaulo.Fn tcp_congctl_unregister 76f3330397Srpauloboth return 77f3330397Srpaulo.Dv 0 78f3330397Srpaulowhen there is no error. 79f3330397SrpauloIf the name is already registered, 80f3330397Srpaulo.Fn tcp_congctl_register 81f3330397Srpaulowill return 82ca581239Swiz.Er EEXIST . 83f3330397Srpaulo.Fn tcp_congctl_unregister 84f3330397Srpaulocan return 85ca581239Swiz.Er ENOENT 86f3330397Srpauloif there is no congestion control algorithm by that name and can return 87ca581239Swiz.Er EBUSY 88f3330397Srpauloif the matched algorithm is being used by userspace applications. 89f3330397Srpaulo.Sh FILES 90f3330397SrpauloImplementation is in 91f3330397Srpaulo.Pa sys/netinet/tcp_congctl.c 92f3330397Srpauloand the interface is in 93f3330397Srpaulo.Pa sys/netinet/tcp_congctl.h . 94ca581239Swiz.Sh SEE ALSO 95ca581239Swiz.Xr tcp 4 96