]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sys/dev/cxgb/ulp/tom/cxgb_defs.h
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / sys / dev / cxgb / ulp / tom / cxgb_defs.h
1
2 /**************************************************************************
3
4 Copyright (c) 2007, Chelsio Inc.
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9
10  1. Redistributions of source code must retain the above copyright notice,
11     this list of conditions and the following disclaimer.
12
13  2. Neither the name of the Chelsio Corporation nor the names of its
14     contributors may be used to endorse or promote products derived from
15     this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
28
29
30 $FreeBSD$
31
32 ***************************************************************************/
33 #ifndef CXGB_DEFS_H_
34 #define CXGB_DEFS_H_
35
36 #define VALIDATE_TID 0
37
38 #define TOEPCB(so)  ((struct toepcb *)(sototcpcb((so))->t_toe))
39 #define TOE_DEV(so) (TOEPCB((so))->tp_toedev)
40 #define toeptoso(toep) ((toep)->tp_tp->t_inpcb->inp_socket)
41 #define sototoep(so) (sototcpcb((so))->t_toe)
42
43 #define TRACE_ENTER printf("%s:%s entered\n", __FUNCTION__, __FILE__)
44 #define TRACE_EXIT printf("%s:%s:%d exited\n", __FUNCTION__, __FILE__, __LINE__)
45         
46 #define KTR_TOM KTR_SPARE2
47 #define KTR_TCB KTR_SPARE3
48
49 struct toepcb;
50 struct listen_ctx;
51
52 void cxgb_log_tcb(struct adapter *sc, unsigned int tid);
53 typedef void (*defer_handler_t)(struct toedev *dev, struct mbuf *m);
54
55 void t3tom_register_cpl_handler(unsigned int opcode, cxgb_cpl_handler_func h);
56 void t3_listen_start(struct toedev *dev, struct socket *so, struct t3cdev *cdev);
57 void t3_listen_stop(struct toedev *dev, struct socket *so, struct t3cdev *cdev);
58 int t3_push_frames(struct socket *so, int req_completion);
59 int t3_connect(struct toedev *tdev, struct socket *so, struct rtentry *rt,
60         struct sockaddr *nam);
61 void t3_init_listen_cpl_handlers(void);
62 int t3_init_cpl_io(void);
63 void t3_init_wr_tab(unsigned int wr_len);
64 uint32_t t3_send_rx_credits(struct tcpcb *tp, uint32_t credits, uint32_t dack, int nofail);
65 void t3_send_rx_modulate(struct toepcb *toep);
66 void t3_cleanup_rbuf(struct tcpcb *tp, int copied);
67
68 void t3_init_socket_ops(void);
69 void t3_install_socket_ops(struct socket *so);
70
71
72 void t3_disconnect_acceptq(struct socket *listen_so);
73 void t3_reset_synq(struct listen_ctx *ctx);
74 void t3_defer_reply(struct mbuf *m, struct toedev *dev, defer_handler_t handler);
75
76 struct toepcb *toepcb_alloc(void);
77 void toepcb_hold(struct toepcb *);
78 void toepcb_release(struct toepcb *);
79 void toepcb_init(struct toepcb *);
80
81 void t3_set_rcv_coalesce_enable(struct toepcb *toep, int on_off);
82 void t3_set_dack_mss(struct toepcb *toep, int on);
83 void t3_set_keepalive(struct toepcb *toep, int on_off);
84 void t3_set_ddp_tag(struct toepcb *toep, int buf_idx, unsigned int tag);
85 void t3_set_ddp_buf(struct toepcb *toep, int buf_idx, unsigned int offset,
86                     unsigned int len);
87 int t3_get_tcb(struct toepcb *toep);
88
89 int t3_ctloutput(struct socket *so, struct sockopt *sopt);
90
91 #endif