3 * Copyright (c) 2007, Chelsio Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
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.
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.
30 #ifndef CXGB_TOEPCB_H_
31 #define CXGB_TOEPCB_H_
33 #include <sys/condvar.h>
34 #include <dev/cxgb/sys/mbufq.h>
37 struct toedev *tp_toedev;
38 struct l2t_entry *tp_l2t;
39 pr_ctloutput_t *tp_ctloutput;
51 int tp_enqueued_bytes;
56 tcp_seq tp_delack_seq;
58 tcp_seq tp_copied_seq;
59 uint64_t tp_write_seq;
61 volatile int tp_refcount;
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;
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;
79 reset_wr_list(struct toepcb *toep)
82 mbufq_init(&toep->wr_list);
86 purge_wr_queue(struct toepcb *toep)
90 while ((m = mbufq_dequeue(&toep->wr_list)) != NULL)
95 enqueue_wr(struct toepcb *toep, struct mbuf *m)
98 mbufq_tail(&toep->wr_list, m);
101 static inline struct mbuf *
102 peek_wr(const struct toepcb *toep)
105 return (mbufq_peek(&toep->wr_list));
108 static inline struct mbuf *
109 dequeue_wr(struct toepcb *toep)
112 return (mbufq_dequeue(&toep->wr_list));
115 #define wr_queue_walk(toep, m) \
116 for (m = peek_wr(toep); m; m = m->m_nextpkt)