]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / sys / dev / cxgb / ulp / tom / cxgb_tom_sysctl.c
1 /**************************************************************************
2
3 Copyright (c) 2007, Chelsio Inc.
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8
9  1. Redistributions of source code must retain the above copyright notice,
10     this list of conditions and the following disclaimer.
11
12  2. Neither the name of the Chelsio Corporation nor the names of its
13     contributors may be used to endorse or promote products derived from
14     this software without specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 POSSIBILITY OF SUCH DAMAGE.
27
28 ***************************************************************************/
29
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
32
33 #include <sys/param.h>
34 #include <sys/systm.h>
35 #include <sys/kernel.h>
36 #include <sys/fcntl.h>
37 #include <sys/limits.h>
38 #include <sys/lock.h>
39 #include <sys/mbuf.h>
40 #include <sys/module.h>
41 #include <sys/mutex.h>
42
43 #include <sys/sockopt.h>
44 #include <sys/sockstate.h>
45 #include <sys/sockbuf.h>
46 #include <sys/socket.h>
47 #include <sys/sysctl.h>
48
49 #include <sys/syslog.h>
50
51 #include <net/if.h>
52 #include <net/route.h>
53
54 #include <netinet/in.h>
55 #include <netinet/in_pcb.h>
56 #include <netinet/in_systm.h>
57 #include <netinet/in_var.h>
58
59 #include <cxgb_osdep.h>
60 #include <sys/mbufq.h>
61
62 #include <netinet/tcp.h>
63 #include <netinet/tcp_var.h>
64 #include <netinet/tcp_fsm.h>
65 #include <net/route.h>
66
67 #include <t3cdev.h>
68 #include <common/cxgb_firmware_exports.h>
69 #include <common/cxgb_tcb.h>
70 #include <common/cxgb_ctl_defs.h>
71 #include <common/cxgb_t3_cpl.h>
72 #include <cxgb_offload.h>
73 #include <cxgb_include.h>
74 #include <ulp/toecore/cxgb_toedev.h>
75 #include <ulp/tom/cxgb_tom.h>
76 #include <ulp/tom/cxgb_defs.h>
77 #include <ulp/tom/cxgb_t3_ddp.h>
78
79 /* Avoid clutter in the hw.* space, keep all toe tunables within hw.cxgb */
80 SYSCTL_DECL(_hw_cxgb);
81 SYSCTL_NODE(_hw_cxgb, OID_AUTO, toe, CTLFLAG_RD, 0, "TOE parameters");
82
83 static struct tom_tunables default_tunable_vals = {
84         .max_host_sndbuf = 32 * 1024,
85         .tx_hold_thres = 0,
86         .max_wrs = 15,
87         .rx_credit_thres = 15 * 1024,
88         .cong_alg = -1,
89         .mss = 16384,
90         .delack = 1,
91         .max_conn = -1,
92         .soft_backlog_limit = 0,
93         .ddp = 1,
94         .ddp_thres = 14 * 4096,
95         .ddp_copy_limit = 13 * 4096,
96         .ddp_push_wait = 1,
97         .ddp_rcvcoalesce = 0,
98         .zcopy_sosend_enabled = 0,      
99         .zcopy_sosend_partial_thres = 40960,
100         .zcopy_sosend_partial_copy = 4096 * 3,
101         .zcopy_sosend_thres = 128 * 1024,
102         .zcopy_sosend_copy = 4096 * 2,
103         .zcopy_sosend_ret_pending_dma = 1,
104         .activated = 1,
105 };
106
107 static int activated = 1;
108 TUNABLE_INT("hw.cxgb.toe.activated", &activated);
109 SYSCTL_UINT(_hw_cxgb_toe, OID_AUTO, activated, CTLFLAG_RDTUN, &activated, 0,
110     "enable TOE at init time");
111
112 static int ddp = 1;
113 TUNABLE_INT("hw.cxgb.toe.ddp", &ddp);
114 SYSCTL_UINT(_hw_cxgb_toe, OID_AUTO, ddp, CTLFLAG_RDTUN, &ddp, 0, "enable DDP");
115
116 void
117 t3_init_tunables(struct tom_data *t)
118 {
119         t->conf = default_tunable_vals;
120
121         /* Adjust tunables */
122         t->conf.activated = activated;
123         t->conf.ddp = ddp;
124
125         /* Now apply device specific fixups. */
126         t->conf.mss = T3C_DATA(t->cdev)->tx_max_chunk;
127         t->conf.max_wrs = T3C_DATA(t->cdev)->max_wrs;
128 }
129
130 void
131 t3_sysctl_register(struct adapter *sc, const struct tom_tunables *p)
132 {
133         struct sysctl_ctx_list *ctx;
134         struct sysctl_oid_list *children;
135
136         ctx = device_get_sysctl_ctx(sc->dev);
137         children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev));
138         
139 }
140