2 * Copyright (c) 2012, 2015 Chelsio Communications, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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
30 #ifndef __CXGBEI_OFLD_H__
31 #define __CXGBEI_OFLD_H__
33 #include <dev/iscsi/icl.h>
42 struct cxgbei_worker_thread_softc {
45 volatile int cwt_state;
47 TAILQ_HEAD(, icl_cxgbei_conn) rx_head;
48 } __aligned(CACHE_LINE_SIZE);
50 #define CXGBEI_CONN_SIGNATURE 0x56788765
53 RXF_ACTIVE = 1 << 0, /* In the worker thread's queue */
56 struct icl_cxgbei_conn {
59 /* cxgbei specific stuff goes here. */
60 uint32_t icc_signature;
65 /* Receive related. */
66 u_int rx_flags; /* protected by so_rcv lock */
68 STAILQ_HEAD(, icl_pdu) rcvd_pdus; /* protected by so_rcv lock */
69 TAILQ_ENTRY(icl_cxgbei_conn) rx_link; /* protected by cwt lock */
72 static inline struct icl_cxgbei_conn *
73 ic_to_icc(struct icl_conn *ic)
76 return (__containerof(ic, struct icl_cxgbei_conn, ic));
79 /* PDU flags and signature. */
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 ICPF_HCRC_ERR = 1 << 4, /* Header digest error. */
86 ICPF_DCRC_ERR = 1 << 5, /* Data digest error. */
87 ICPF_PAD_ERR = 1 << 6, /* Padding error. */
89 CXGBEI_PDU_SIGNATURE = 0x12344321
92 struct icl_cxgbei_pdu {
95 /* cxgbei specific stuff goes here. */
96 uint32_t icp_signature;
97 uint32_t icp_seq; /* For debug only */
101 static inline struct icl_cxgbei_pdu *
102 ip_to_icp(struct icl_pdu *ip)
105 return (__containerof(ip, struct icl_cxgbei_pdu, ip));
109 u_int max_tx_pdu_len;
110 u_int max_rx_pdu_len;
113 struct ppod_region pr;
115 struct sysctl_ctx_list ctx; /* from uld_activate to deactivate */
116 counter_u64_t ddp_setup_ok;
117 counter_u64_t ddp_setup_error;
118 counter_u64_t ddp_bytes;
119 counter_u64_t ddp_pdus;
120 counter_u64_t fl_bytes;
121 counter_u64_t fl_pdus;
125 u_int cxgbei_select_worker_thread(struct icl_cxgbei_conn *);
128 int icl_cxgbei_mod_load(void);
129 int icl_cxgbei_mod_unload(void);