Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/cxgbe/tom/t4_tom.h
Show All 28 Lines | |||||
* $FreeBSD$ | * $FreeBSD$ | ||||
* | * | ||||
*/ | */ | ||||
#ifndef __T4_TOM_H__ | #ifndef __T4_TOM_H__ | ||||
#define __T4_TOM_H__ | #define __T4_TOM_H__ | ||||
#include <sys/vmem.h> | #include <sys/vmem.h> | ||||
#include "common/t4_hw.h" | #include "common/t4_hw.h" | ||||
#include "common/t4_msg.h" | |||||
#include "tom/t4_tls.h" | #include "tom/t4_tls.h" | ||||
#define LISTEN_HASH_SIZE 32 | #define LISTEN_HASH_SIZE 32 | ||||
/* | /* | ||||
* Min receive window. We want it to be large enough to accommodate receive | * Min receive window. We want it to be large enough to accommodate receive | ||||
* coalescing, handle jumbo frames, and not trigger sender SWS avoidance. | * coalescing, handle jumbo frames, and not trigger sender SWS avoidance. | ||||
*/ | */ | ||||
Show All 36 Lines | enum { | ||||
DDP_BUF1_ACTIVE = (1 << 4), /* buffer 1 in use (not invalidated) */ | DDP_BUF1_ACTIVE = (1 << 4), /* buffer 1 in use (not invalidated) */ | ||||
DDP_TASK_ACTIVE = (1 << 5), /* requeue task is queued / running */ | DDP_TASK_ACTIVE = (1 << 5), /* requeue task is queued / running */ | ||||
DDP_DEAD = (1 << 6), /* toepcb is shutting down */ | DDP_DEAD = (1 << 6), /* toepcb is shutting down */ | ||||
}; | }; | ||||
struct sockopt; | struct sockopt; | ||||
struct offload_settings; | struct offload_settings; | ||||
/* | |||||
* Connection parameters for an offloaded connection. These are mostly (but not | |||||
* all) hardware TOE parameters. | |||||
*/ | |||||
struct conn_params { | |||||
int8_t rx_coalesce; | |||||
int8_t cong_algo; | |||||
int8_t tc_idx; | |||||
int8_t tstamp; | |||||
int8_t sack; | |||||
int8_t nagle; | |||||
int8_t keepalive; | |||||
int8_t wscale; | |||||
int8_t ecn; | |||||
int8_t mtu_idx; | |||||
int8_t ulp_mode; | |||||
int8_t tx_align; | |||||
int16_t txq_idx; /* ofld_txq = &sc->sge.ofld_txq[txq_idx] */ | |||||
int16_t rxq_idx; /* ofld_rxq = &sc->sge.ofld_rxq[rxq_idx] */ | |||||
int16_t l2t_idx; | |||||
uint16_t emss; | |||||
uint16_t opt0_bufsize; | |||||
u_int sndbuf; /* controls TP tx pages */ | |||||
}; | |||||
struct ofld_tx_sdesc { | struct ofld_tx_sdesc { | ||||
uint32_t plen; /* payload length */ | uint32_t plen; /* payload length */ | ||||
uint8_t tx_credits; /* firmware tx credits (unit is 16B) */ | uint8_t tx_credits; /* firmware tx credits (unit is 16B) */ | ||||
void *iv_buffer; /* optional buffer holding IVs for TLS */ | void *iv_buffer; /* optional buffer holding IVs for TLS */ | ||||
}; | }; | ||||
struct ppod_region { | struct ppod_region { | ||||
u_int pr_start; | u_int pr_start; | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | struct toepcb { | ||||
struct vnet *vnet; | struct vnet *vnet; | ||||
struct vi_info *vi; /* virtual interface */ | struct vi_info *vi; /* virtual interface */ | ||||
struct sge_wrq *ofld_txq; | struct sge_wrq *ofld_txq; | ||||
struct sge_ofld_rxq *ofld_rxq; | struct sge_ofld_rxq *ofld_rxq; | ||||
struct sge_wrq *ctrlq; | struct sge_wrq *ctrlq; | ||||
struct l2t_entry *l2te; /* L2 table entry used by this connection */ | struct l2t_entry *l2te; /* L2 table entry used by this connection */ | ||||
struct clip_entry *ce; /* CLIP table entry used by this tid */ | struct clip_entry *ce; /* CLIP table entry used by this tid */ | ||||
int tid; /* Connection identifier */ | int tid; /* Connection identifier */ | ||||
int tc_idx; /* traffic class that this tid is bound to */ | |||||
/* tx credit handling */ | /* tx credit handling */ | ||||
u_int tx_total; /* total tx WR credits (in 16B units) */ | u_int tx_total; /* total tx WR credits (in 16B units) */ | ||||
u_int tx_credits; /* tx WR credits (in 16B units) available */ | u_int tx_credits; /* tx WR credits (in 16B units) available */ | ||||
u_int tx_nocompl; /* tx WR credits since last compl request */ | u_int tx_nocompl; /* tx WR credits since last compl request */ | ||||
u_int plen_nocompl; /* payload since last compl request */ | u_int plen_nocompl; /* payload since last compl request */ | ||||
uint16_t opt0_rcv_bufsize; /* XXX: save full opt0/opt2 for later? */ | struct conn_params params; | ||||
uint16_t mtu_idx; | |||||
uint16_t emss; | |||||
uint16_t tcp_opt; | |||||
u_int ulp_mode; /* ULP mode */ | |||||
void *ulpcb; | void *ulpcb; | ||||
void *ulpcb2; | void *ulpcb2; | ||||
struct mbufq ulp_pduq; /* PDUs waiting to be sent out. */ | struct mbufq ulp_pduq; /* PDUs waiting to be sent out. */ | ||||
struct mbufq ulp_pdu_reclaimq; | struct mbufq ulp_pdu_reclaimq; | ||||
struct ddp_pcb ddp; | struct ddp_pcb ddp; | ||||
struct tls_ofld_info tls; | struct tls_ofld_info tls; | ||||
TAILQ_HEAD(, kaiocb) aiotx_jobq; | TAILQ_HEAD(, kaiocb) aiotx_jobq; | ||||
struct task aiotx_task; | struct task aiotx_task; | ||||
struct socket *aiotx_so; | struct socket *aiotx_so; | ||||
/* Tx software descriptor */ | /* Tx software descriptor */ | ||||
uint8_t txsd_total; | uint8_t txsd_total; | ||||
uint8_t txsd_pidx; | uint8_t txsd_pidx; | ||||
uint8_t txsd_cidx; | uint8_t txsd_cidx; | ||||
uint8_t txsd_avail; | uint8_t txsd_avail; | ||||
struct ofld_tx_sdesc txsd[]; | struct ofld_tx_sdesc txsd[]; | ||||
}; | }; | ||||
static inline int | |||||
ulp_mode(struct toepcb *toep) | |||||
{ | |||||
return (toep->params.ulp_mode); | |||||
} | |||||
#define DDP_LOCK(toep) mtx_lock(&(toep)->ddp.lock) | #define DDP_LOCK(toep) mtx_lock(&(toep)->ddp.lock) | ||||
#define DDP_UNLOCK(toep) mtx_unlock(&(toep)->ddp.lock) | #define DDP_UNLOCK(toep) mtx_unlock(&(toep)->ddp.lock) | ||||
#define DDP_ASSERT_LOCKED(toep) mtx_assert(&(toep)->ddp.lock, MA_OWNED) | #define DDP_ASSERT_LOCKED(toep) mtx_assert(&(toep)->ddp.lock, MA_OWNED) | ||||
struct flowc_tx_params { | |||||
uint32_t snd_nxt; | |||||
uint32_t rcv_nxt; | |||||
unsigned int snd_space; | |||||
unsigned int mss; | |||||
}; | |||||
/* | /* | ||||
* Compressed state for embryonic connections for a listener. | * Compressed state for embryonic connections for a listener. | ||||
*/ | */ | ||||
struct synq_entry { | struct synq_entry { | ||||
struct listen_ctx *lctx; /* backpointer to listen ctx */ | struct listen_ctx *lctx; /* backpointer to listen ctx */ | ||||
struct mbuf *syn; | struct mbuf *syn; | ||||
int flags; /* same as toepcb's tp_flags */ | int flags; /* same as toepcb's tp_flags */ | ||||
volatile int ok_to_respond; | volatile int ok_to_respond; | ||||
volatile u_int refcnt; | volatile u_int refcnt; | ||||
int tid; | int tid; | ||||
uint32_t iss; | uint32_t iss; | ||||
uint32_t irs; | uint32_t irs; | ||||
uint32_t ts; | uint32_t ts; | ||||
uint16_t txqid; | |||||
uint16_t rxqid; | |||||
uint16_t l2e_idx; | |||||
uint16_t ulp_mode; | |||||
uint16_t rcv_bufsize; | |||||
__be16 tcp_opt; /* from cpl_pass_establish */ | __be16 tcp_opt; /* from cpl_pass_establish */ | ||||
struct toepcb *toep; | struct toepcb *toep; | ||||
struct conn_params params; | |||||
}; | }; | ||||
/* listen_ctx flags */ | /* listen_ctx flags */ | ||||
#define LCTX_RPL_PENDING 1 /* waiting for a CPL_PASS_OPEN_RPL */ | #define LCTX_RPL_PENDING 1 /* waiting for a CPL_PASS_OPEN_RPL */ | ||||
struct listen_ctx { | struct listen_ctx { | ||||
LIST_ENTRY(listen_ctx) link; /* listen hash linkage */ | LIST_ENTRY(listen_ctx) link; /* listen hash linkage */ | ||||
volatile int refcount; | volatile int refcount; | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
mbuf_ulp_submode(struct mbuf *m) | mbuf_ulp_submode(struct mbuf *m) | ||||
{ | { | ||||
M_ASSERTPKTHDR(m); | M_ASSERTPKTHDR(m); | ||||
return (m->m_pkthdr.PH_per.eight[0]); | return (m->m_pkthdr.PH_per.eight[0]); | ||||
} | } | ||||
/* t4_tom.c */ | /* t4_tom.c */ | ||||
struct toepcb *alloc_toepcb(struct vi_info *, int, int, int); | struct toepcb *alloc_toepcb(struct vi_info *, int); | ||||
int init_toepcb(struct vi_info *, struct toepcb *); | |||||
struct toepcb *hold_toepcb(struct toepcb *); | struct toepcb *hold_toepcb(struct toepcb *); | ||||
void free_toepcb(struct toepcb *); | void free_toepcb(struct toepcb *); | ||||
void offload_socket(struct socket *, struct toepcb *); | void offload_socket(struct socket *, struct toepcb *); | ||||
void undo_offload_socket(struct socket *); | void undo_offload_socket(struct socket *); | ||||
void final_cpl_received(struct toepcb *); | void final_cpl_received(struct toepcb *); | ||||
void insert_tid(struct adapter *, int, void *, int); | void insert_tid(struct adapter *, int, void *, int); | ||||
void *lookup_tid(struct adapter *, int); | void *lookup_tid(struct adapter *, int); | ||||
void update_tid(struct adapter *, int, void *); | void update_tid(struct adapter *, int, void *); | ||||
void remove_tid(struct adapter *, int, int); | void remove_tid(struct adapter *, int, int); | ||||
int find_best_mtu_idx(struct adapter *, struct in_conninfo *, | |||||
struct offload_settings *); | |||||
u_long select_rcv_wnd(struct socket *); | u_long select_rcv_wnd(struct socket *); | ||||
int select_rcv_wscale(void); | int select_rcv_wscale(void); | ||||
uint64_t calc_opt0(struct socket *, struct vi_info *, struct l2t_entry *, | void init_conn_params(struct vi_info *, struct offload_settings *, | ||||
int, int, int, int, struct offload_settings *); | struct in_conninfo *, struct socket *, const struct tcp_options *, int16_t, | ||||
struct conn_params *cp); | |||||
__be64 calc_options0(struct vi_info *, struct conn_params *); | |||||
__be32 calc_options2(struct vi_info *, struct conn_params *); | |||||
uint64_t select_ntuple(struct vi_info *, struct l2t_entry *); | uint64_t select_ntuple(struct vi_info *, struct l2t_entry *); | ||||
int select_ulp_mode(struct socket *, struct adapter *, | |||||
struct offload_settings *); | |||||
void set_ulp_mode(struct toepcb *, int); | |||||
int negative_advice(int); | int negative_advice(int); | ||||
int add_tid_to_history(struct adapter *, u_int); | int add_tid_to_history(struct adapter *, u_int); | ||||
/* t4_connect.c */ | /* t4_connect.c */ | ||||
void t4_init_connect_cpl_handlers(void); | void t4_init_connect_cpl_handlers(void); | ||||
void t4_uninit_connect_cpl_handlers(void); | void t4_uninit_connect_cpl_handlers(void); | ||||
int t4_connect(struct toedev *, struct socket *, struct rtentry *, | int t4_connect(struct toedev *, struct socket *, struct rtentry *, | ||||
struct sockaddr *); | struct sockaddr *); | ||||
Show All 15 Lines | |||||
void synack_failure_cleanup(struct adapter *, int); | void synack_failure_cleanup(struct adapter *, int); | ||||
/* t4_cpl_io.c */ | /* t4_cpl_io.c */ | ||||
void aiotx_init_toep(struct toepcb *); | void aiotx_init_toep(struct toepcb *); | ||||
int t4_aio_queue_aiotx(struct socket *, struct kaiocb *); | int t4_aio_queue_aiotx(struct socket *, struct kaiocb *); | ||||
void t4_init_cpl_io_handlers(void); | void t4_init_cpl_io_handlers(void); | ||||
void t4_uninit_cpl_io_handlers(void); | void t4_uninit_cpl_io_handlers(void); | ||||
void send_abort_rpl(struct adapter *, struct sge_wrq *, int , int); | void send_abort_rpl(struct adapter *, struct sge_wrq *, int , int); | ||||
void send_flowc_wr(struct toepcb *, struct flowc_tx_params *); | void send_flowc_wr(struct toepcb *, struct tcpcb *); | ||||
void send_reset(struct adapter *, struct toepcb *, uint32_t); | void send_reset(struct adapter *, struct toepcb *, uint32_t); | ||||
int send_rx_credits(struct adapter *, struct toepcb *, int); | int send_rx_credits(struct adapter *, struct toepcb *, int); | ||||
void send_rx_modulate(struct adapter *, struct toepcb *); | void send_rx_modulate(struct adapter *, struct toepcb *); | ||||
void make_established(struct toepcb *, uint32_t, uint32_t, uint16_t); | void make_established(struct toepcb *, uint32_t, uint32_t, uint16_t); | ||||
int t4_close_conn(struct adapter *, struct toepcb *); | int t4_close_conn(struct adapter *, struct toepcb *); | ||||
void t4_rcvd(struct toedev *, struct tcpcb *); | void t4_rcvd(struct toedev *, struct tcpcb *); | ||||
void t4_rcvd_locked(struct toedev *, struct tcpcb *); | void t4_rcvd_locked(struct toedev *, struct tcpcb *); | ||||
int t4_tod_output(struct toedev *, struct tcpcb *); | int t4_tod_output(struct toedev *, struct tcpcb *); | ||||
int t4_send_fin(struct toedev *, struct tcpcb *); | int t4_send_fin(struct toedev *, struct tcpcb *); | ||||
int t4_send_rst(struct toedev *, struct tcpcb *); | int t4_send_rst(struct toedev *, struct tcpcb *); | ||||
void t4_set_tcb_field(struct adapter *, struct sge_wrq *, struct toepcb *, | void t4_set_tcb_field(struct adapter *, struct sge_wrq *, struct toepcb *, | ||||
uint16_t, uint64_t, uint64_t, int, int); | uint16_t, uint64_t, uint64_t, int, int); | ||||
void t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop); | void t4_push_frames(struct adapter *, struct toepcb *, int); | ||||
void t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop); | void t4_push_pdus(struct adapter *, struct toepcb *, int); | ||||
/* t4_ddp.c */ | /* t4_ddp.c */ | ||||
int t4_init_ppod_region(struct ppod_region *, struct t4_range *, u_int, | int t4_init_ppod_region(struct ppod_region *, struct t4_range *, u_int, | ||||
const char *); | const char *); | ||||
void t4_free_ppod_region(struct ppod_region *); | void t4_free_ppod_region(struct ppod_region *); | ||||
int t4_alloc_page_pods_for_ps(struct ppod_region *, struct pageset *); | int t4_alloc_page_pods_for_ps(struct ppod_region *, struct pageset *); | ||||
int t4_alloc_page_pods_for_buf(struct ppod_region *, vm_offset_t, int, | int t4_alloc_page_pods_for_buf(struct ppod_region *, vm_offset_t, int, | ||||
struct ppod_reservation *); | struct ppod_reservation *); | ||||
Show All 35 Lines |