]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/cxgb/ulp/tom/cxgb_toepcb.h
This commit was generated by cvs2svn to compensate for changes in r178476,
[FreeBSD/FreeBSD.git] / sys / dev / cxgb / ulp / tom / cxgb_toepcb.h
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  * $FreeBSD$
29  */
30 #ifndef CXGB_TOEPCB_H_
31 #define CXGB_TOEPCB_H_
32 #include <sys/bus.h>
33 #include <sys/condvar.h>
34 #include <dev/cxgb/sys/mbufq.h>
35
36 struct toepcb {
37         struct toedev           *tp_toedev;
38         struct l2t_entry        *tp_l2t;
39         pr_ctloutput_t          *tp_ctloutput;
40         unsigned int            tp_tid;
41         int                     tp_wr_max;
42         int                     tp_wr_avail;
43         int                     tp_wr_unacked;
44         int                     tp_delack_mode;
45         int                     tp_mtu_idx;
46         int                     tp_ulp_mode;
47         int                     tp_qset_idx;
48         int                     tp_mss_clamp;
49         int                     tp_qset;
50         int                     tp_flags;
51         int                     tp_enqueued_bytes;
52         int                     tp_page_count;
53         int                     tp_state;
54
55         tcp_seq                 tp_iss;
56         tcp_seq                 tp_delack_seq;
57         tcp_seq                 tp_rcv_wup;
58         tcp_seq                 tp_copied_seq;
59         uint64_t                tp_write_seq;
60
61         volatile int            tp_refcount;
62         vm_page_t               *tp_pages;
63         
64         struct tcpcb            *tp_tp;
65         struct mbuf             *tp_m_last;
66         bus_dma_tag_t           tp_tx_dmat;
67         bus_dma_tag_t           tp_rx_dmat;
68         bus_dmamap_t            tp_dmamap;
69
70         LIST_ENTRY(toepcb)      synq_entry;
71         struct mbuf_head        wr_list;
72         struct mbuf_head        out_of_order_queue;
73         struct ddp_state        tp_ddp_state;
74         struct cv               tp_cv;
75                            
76 };
77
78 static inline void
79 reset_wr_list(struct toepcb *toep)
80 {
81
82         mbufq_init(&toep->wr_list);
83 }
84
85 static inline void
86 purge_wr_queue(struct toepcb *toep)
87 {
88         struct mbuf *m;
89         
90         while ((m = mbufq_dequeue(&toep->wr_list)) != NULL) 
91                 m_freem(m);
92 }
93
94 static inline void
95 enqueue_wr(struct toepcb *toep, struct mbuf *m)
96 {
97
98         mbufq_tail(&toep->wr_list, m);
99 }
100
101 static inline struct mbuf *
102 peek_wr(const struct toepcb *toep)
103 {
104
105         return (mbufq_peek(&toep->wr_list));
106 }
107
108 static inline struct mbuf *
109 dequeue_wr(struct toepcb *toep)
110 {
111
112         return (mbufq_dequeue(&toep->wr_list));
113 }
114
115 #define wr_queue_walk(toep, m) \
116         for (m = peek_wr(toep); m; m = m->m_nextpkt)
117
118
119
120 #endif
121