FreeBSD kernel CXGBE device code
cxgbei.h
Go to the documentation of this file.
1/*-
2 * Copyright (c) 2012, 2015 Chelsio Communications, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 *
28 */
29
30#ifndef __CXGBEI_OFLD_H__
31#define __CXGBEI_OFLD_H__
32
33#include <dev/iscsi/icl.h>
34
35#define CXGBEI_CONN_SIGNATURE 0x56788765
36
37struct cxgbei_cmp {
39
40 uint32_t tt; /* Transfer tag. */
41
43 uint32_t last_datasn;
44};
45LIST_HEAD(cxgbei_cmp_head, cxgbei_cmp);
46
48 struct icl_conn ic;
49
50 /* cxgbei specific stuff goes here. */
51 uint32_t icc_signature;
53 struct adapter *sc;
54 struct toepcb *toep;
55
56 /* Receive related. */
57 bool rx_active; /* protected by so_rcv lock */
58 bool rx_exiting; /* protected by so_rcv lock */
59 STAILQ_HEAD(, icl_pdu) rcvd_pdus; /* protected by so_rcv lock */
60 struct thread *rx_thread;
61
62 struct cxgbei_cmp_head *cmp_table; /* protected by cmp_lock */
63 struct mtx cmp_lock;
64 unsigned long cmp_hash_mask;
65
66 /* Transmit related. */
67 bool tx_active; /* protected by ic lock */
68 STAILQ_HEAD(, icl_pdu) sent_pdus; /* protected by ic lock */
69 struct thread *tx_thread;
70};
71
72static inline struct icl_cxgbei_conn *
73ic_to_icc(struct icl_conn *ic)
74{
75
76 return (__containerof(ic, struct icl_cxgbei_conn, ic));
77}
78
79/* PDU flags and signature. */
80enum {
81 ICPF_RX_HDR = 1 << 0, /* PDU header received. */
82 ICPF_RX_FLBUF = 1 << 1, /* PDU payload received in a freelist. */
83 ICPF_RX_DDP = 1 << 2, /* PDU payload DDP'd. */
84 ICPF_RX_STATUS = 1 << 3, /* Rx status received. */
85
86 CXGBEI_PDU_SIGNATURE = 0x12344321
87};
88
90 struct icl_pdu ip;
91
92 /* cxgbei specific stuff goes here. */
93 uint32_t icp_signature;
94 uint32_t icp_seq; /* For debug only */
95 u_int icp_flags;
96
97 u_int ref_cnt;
98 icl_pdu_cb cb;
99 int error;
100};
101
102static inline struct icl_cxgbei_pdu *
103ip_to_icp(struct icl_pdu *ip)
104{
105
106 return (__containerof(ip, struct icl_cxgbei_pdu, ip));
107}
108
112
115
116 struct sysctl_ctx_list ctx; /* from uld_activate to deactivate */
117};
118
119#define CXGBEI_MAX_ISO_PAYLOAD 65535
120
121/* cxgbei.c */
124void parse_pdus(struct icl_cxgbei_conn *, struct sockbuf *);
125
126/* icl_cxgbei.c */
127void cwt_tx_main(void *);
130struct icl_pdu *icl_cxgbei_new_pdu(int);
131void icl_cxgbei_new_pdu_set_conn(struct icl_pdu *, struct icl_conn *);
132void icl_cxgbei_conn_pdu_free(struct icl_conn *, struct icl_pdu *);
133struct cxgbei_cmp *cxgbei_find_cmp(struct icl_cxgbei_conn *, uint32_t);
134
135#endif
static struct icl_cxgbei_pdu * ip_to_icp(struct icl_pdu *ip)
Definition: cxgbei.h:103
int icl_cxgbei_mod_load(void)
static struct icl_cxgbei_conn * ic_to_icc(struct icl_conn *ic)
Definition: cxgbei.h:73
LIST_HEAD(cxgbei_cmp_head, cxgbei_cmp)
struct icl_pdu * icl_cxgbei_new_pdu(int)
void icl_cxgbei_conn_pdu_free(struct icl_conn *, struct icl_pdu *)
int icl_cxgbei_mod_unload(void)
void cwt_queue_for_tx(struct icl_cxgbei_conn *)
struct cxgbei_cmp * cxgbei_find_cmp(struct icl_cxgbei_conn *, uint32_t)
void cwt_tx_main(void *)
void parse_pdus(struct icl_cxgbei_conn *, struct sockbuf *)
void icl_cxgbei_new_pdu_set_conn(struct icl_pdu *, struct icl_conn *)
u_int cxgbei_select_worker_thread(struct icl_cxgbei_conn *)
@ CXGBEI_PDU_SIGNATURE
Definition: cxgbei.h:86
@ ICPF_RX_DDP
Definition: cxgbei.h:83
@ ICPF_RX_HDR
Definition: cxgbei.h:81
@ ICPF_RX_STATUS
Definition: cxgbei.h:84
@ ICPF_RX_FLBUF
Definition: cxgbei.h:82
uint32_t tt
Definition: cxgbei.h:40
uint32_t next_buffer_offset
Definition: cxgbei.h:42
LIST_ENTRY(cxgbei_cmp) link
uint32_t last_datasn
Definition: cxgbei.h:43
u_int max_tx_data_len
Definition: cxgbei.h:110
struct sysctl_ctx_list ctx
Definition: cxgbei.h:116
struct ppod_region pr
Definition: cxgbei.h:114
u_int ddp_threshold
Definition: cxgbei.h:113
u_int max_rx_data_len
Definition: cxgbei.h:111
STAILQ_HEAD(, icl_pdu) sent_pdus
STAILQ_HEAD(, icl_pdu) rcvd_pdus
struct thread * rx_thread
Definition: cxgbei.h:60
unsigned long cmp_hash_mask
Definition: cxgbei.h:64
bool tx_active
Definition: cxgbei.h:67
struct adapter * sc
Definition: cxgbei.h:53
struct mtx cmp_lock
Definition: cxgbei.h:63
uint32_t icc_signature
Definition: cxgbei.h:51
int ulp_submode
Definition: cxgbei.h:52
struct cxgbei_cmp_head * cmp_table
Definition: cxgbei.h:62
struct toepcb * toep
Definition: cxgbei.h:54
struct thread * tx_thread
Definition: cxgbei.h:69
bool rx_active
Definition: cxgbei.h:57
struct icl_conn ic
Definition: cxgbei.h:48
bool rx_exiting
Definition: cxgbei.h:58
uint32_t icp_signature
Definition: cxgbei.h:93
u_int icp_flags
Definition: cxgbei.h:95
icl_pdu_cb cb
Definition: cxgbei.h:98
uint32_t icp_seq
Definition: cxgbei.h:94
u_int ref_cnt
Definition: cxgbei.h:97
struct icl_pdu ip
Definition: cxgbei.h:90
Definition: t4_tom.h:182