cxgb_offload.h revision 237263
1243730Srwatson/************************************************************************** 2243730Srwatson 3243730SrwatsonCopyright (c) 2007-2008, Chelsio Inc. 4243730SrwatsonAll rights reserved. 5243730Srwatson 6243730SrwatsonRedistribution and use in source and binary forms, with or without 7243730Srwatsonmodification, are permitted provided that the following conditions are met: 8243730Srwatson 9243730Srwatson 1. Redistributions of source code must retain the above copyright notice, 10243730Srwatson this list of conditions and the following disclaimer. 11243730Srwatson 12243730Srwatson 2. Neither the name of the Chelsio Corporation nor the names of its 13243730Srwatson contributors may be used to endorse or promote products derived from 14243730Srwatson this software without specific prior written permission. 15243730Srwatson 16243730SrwatsonTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17243730SrwatsonAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18243730SrwatsonIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19243730SrwatsonARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20243730SrwatsonLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21243730SrwatsonCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22243730SrwatsonSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23243730SrwatsonINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24243730SrwatsonCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25243730SrwatsonARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26243730SrwatsonPOSSIBILITY OF SUCH DAMAGE. 27243730Srwatson 28243730Srwatson$FreeBSD: head/sys/dev/cxgb/cxgb_offload.h 237263 2012-06-19 07:34:13Z np $ 29243730Srwatson 30243730Srwatson***************************************************************************/ 31243730Srwatson 32243730Srwatson#ifndef _CXGB_OFFLOAD_H 33243730Srwatson#define _CXGB_OFFLOAD_H 34243730Srwatson 35243730Srwatson#ifdef TCP_OFFLOAD 36243730Srwatsonenum { 37243730Srwatson ULD_TOM = 1, 38243730Srwatson ULD_IWARP = 2, 39243730Srwatson}; 40243730Srwatson 41243730Srwatsonstruct adapter; 42243730Srwatsonstruct uld_info { 43243730Srwatson SLIST_ENTRY(uld_info) link; 44243730Srwatson int refcount; 45243730Srwatson int uld_id; 46243730Srwatson int (*activate)(struct adapter *); 47243730Srwatson int (*deactivate)(struct adapter *); 48243730Srwatson}; 49243730Srwatson 50243730Srwatsonstruct tom_tunables { 51243730Srwatson int sndbuf; 52243730Srwatson int ddp; 53243730Srwatson int indsz; 54243730Srwatson int ddp_thres; 55243730Srwatson}; 56243730Srwatson 57243730Srwatson/* CPL message priority levels */ 58243730Srwatsonenum { 59243730Srwatson CPL_PRIORITY_DATA = 0, /* data messages */ 60243730Srwatson CPL_PRIORITY_CONTROL = 1 /* offload control messages */ 61243730Srwatson}; 62243730Srwatson 63243730Srwatson#define S_HDR_NDESC 0 64243730Srwatson#define M_HDR_NDESC 0xf 65243730Srwatson#define V_HDR_NDESC(x) ((x) << S_HDR_NDESC) 66243730Srwatson#define G_HDR_NDESC(x) (((x) >> S_HDR_NDESC) & M_HDR_NDESC) 67243730Srwatson 68243730Srwatson#define S_HDR_QSET 4 69243730Srwatson#define M_HDR_QSET 0xf 70243730Srwatson#define V_HDR_QSET(x) ((x) << S_HDR_QSET) 71243730Srwatson#define G_HDR_QSET(x) (((x) >> S_HDR_QSET) & M_HDR_QSET) 72243730Srwatson 73243730Srwatson#define S_HDR_CTRL 8 74243730Srwatson#define V_HDR_CTRL(x) ((x) << S_HDR_CTRL) 75243730Srwatson#define F_HDR_CTRL V_HDR_CTRL(1U) 76243730Srwatson 77243730Srwatson#define S_HDR_DF 9 78243730Srwatson#define V_HDR_DF(x) ((x) << S_HDR_DF) 79243730Srwatson#define F_HDR_DF V_HDR_DF(1U) 80243730Srwatson 81243730Srwatson#define S_HDR_SGL 10 82243730Srwatson#define V_HDR_SGL(x) ((x) << S_HDR_SGL) 83243730Srwatson#define F_HDR_SGL V_HDR_SGL(1U) 84243730Srwatson 85243730Srwatsonstruct ofld_hdr 86243730Srwatson{ 87243730Srwatson void *sgl; /* SGL, if F_HDR_SGL set in flags */ 88243730Srwatson int plen; /* amount of payload (in bytes) */ 89243730Srwatson int flags; 90243730Srwatson}; 91243730Srwatson 92243730Srwatson/* 93243730Srwatson * Convenience function for fixed size CPLs that fit in 1 desc. 94243730Srwatson */ 95243730Srwatson#define M_GETHDR_OFLD(qset, ctrl, cpl) \ 96243730Srwatson m_gethdr_ofld(qset, ctrl, sizeof(*cpl), (void **)&cpl) 97243730Srwatsonstatic inline struct mbuf * 98243730Srwatsonm_gethdr_ofld(int qset, int ctrl, int cpllen, void **cpl) 99243730Srwatson{ 100243730Srwatson struct mbuf *m; 101243730Srwatson struct ofld_hdr *oh; 102243730Srwatson 103243730Srwatson m = m_gethdr(M_NOWAIT, MT_DATA); 104243730Srwatson if (m == NULL) 105243730Srwatson return (NULL); 106243730Srwatson 107243730Srwatson oh = mtod(m, struct ofld_hdr *); 108243730Srwatson oh->flags = V_HDR_NDESC(1) | V_HDR_QSET(qset) | V_HDR_CTRL(ctrl); 109243730Srwatson *cpl = (void *)(oh + 1); 110243730Srwatson m->m_pkthdr.len = m->m_len = sizeof(*oh) + cpllen; 111243730Srwatson 112243730Srwatson return (m); 113243730Srwatson} 114243730Srwatson 115243730Srwatsonint t3_register_uld(struct uld_info *); 116243730Srwatsonint t3_unregister_uld(struct uld_info *); 117243730Srwatsonint t3_activate_uld(struct adapter *, int); 118243730Srwatsonint t3_deactivate_uld(struct adapter *, int); 119243730Srwatson#endif /* TCP_OFFLOAD */ 120243730Srwatson 121243730Srwatson#define CXGB_UNIMPLEMENTED() \ 122243730Srwatson panic("IMPLEMENT: %s:%s:%d", __FUNCTION__, __FILE__, __LINE__) 123243730Srwatson 124243730Srwatson#endif 125243730Srwatson