1325618Ssbruno/*
2325618Ssbruno *   BSD LICENSE
3325618Ssbruno *
4325618Ssbruno *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.
5325618Ssbruno *   All rights reserved.
6325618Ssbruno *
7325618Ssbruno *   Redistribution and use in source and binary forms, with or without
8325618Ssbruno *   modification, are permitted provided that the following conditions
9325618Ssbruno *   are met:
10325618Ssbruno *
11325618Ssbruno *     * Redistributions of source code must retain the above copyright
12325618Ssbruno *       notice, this list of conditions and the following disclaimer.
13325618Ssbruno *     * Redistributions in binary form must reproduce the above copyright
14325618Ssbruno *       notice, this list of conditions and the following disclaimer in
15325618Ssbruno *       the documentation and/or other materials provided with the
16325618Ssbruno *       distribution.
17325618Ssbruno *     * Neither the name of Cavium, Inc. nor the names of its
18325618Ssbruno *       contributors may be used to endorse or promote products derived
19325618Ssbruno *       from this software without specific prior written permission.
20325618Ssbruno *
21325618Ssbruno *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22325618Ssbruno *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23325618Ssbruno *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24325618Ssbruno *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25325618Ssbruno *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26325618Ssbruno *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27325618Ssbruno *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28325618Ssbruno *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29325618Ssbruno *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30325618Ssbruno *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31325618Ssbruno *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32325618Ssbruno */
33325618Ssbruno/*$FreeBSD: stable/11/sys/dev/liquidio/lio_rxtx.h 325618 2017-11-09 19:52:56Z sbruno $*/
34325618Ssbruno
35325618Ssbruno#ifndef _LIO_RXTX_H_
36325618Ssbruno#define _LIO_RXTX_H_
37325618Ssbruno
38325618Ssbruno/* Bit mask values for lio->ifstate */
39325618Ssbruno#define LIO_IFSTATE_DROQ_OPS	0x01
40325618Ssbruno#define LIO_IFSTATE_REGISTERED	0x02
41325618Ssbruno#define LIO_IFSTATE_RUNNING	0x04
42325618Ssbruno#define LIO_IFSTATE_DETACH	0x08
43325618Ssbruno#define LIO_IFSTATE_RESETTING	0x10
44325618Ssbruno
45325618Ssbruno
46325618Ssbruno/*
47325618Ssbruno * Structure of a node in list of gather components maintained by
48325618Ssbruno * NIC driver for each network device.
49325618Ssbruno */
50325618Ssbrunostruct lio_gather {
51325618Ssbruno	/* List manipulation. Next and prev pointers. */
52325618Ssbruno	struct lio_stailq_node	node;
53325618Ssbruno
54325618Ssbruno	/* Size of the gather component at sg in bytes. */
55325618Ssbruno	int	sg_size;
56325618Ssbruno
57325618Ssbruno	/*
58325618Ssbruno	 * Gather component that can accommodate max sized fragment list
59325618Ssbruno	 * received from the IP layer.
60325618Ssbruno	 */
61325618Ssbruno	struct lio_sg_entry	*sg;
62325618Ssbruno
63325618Ssbruno	uint64_t		sg_dma_ptr;
64325618Ssbruno};
65325618Ssbruno
66325618Ssbrunounion lio_tx_info {
67325618Ssbruno	uint64_t	tx_info64;
68325618Ssbruno	struct {
69325618Ssbruno#if _BYTE_ORDER == _BIG_ENDIAN
70325618Ssbruno		uint16_t	gso_size;
71325618Ssbruno		uint16_t	gso_segs;
72325618Ssbruno		uint32_t	reserved;
73325618Ssbruno#else	/* _BYTE_ORDER == _LITTLE_ENDIAN */
74325618Ssbruno		uint32_t	reserved;
75325618Ssbruno		uint16_t	gso_segs;
76325618Ssbruno		uint16_t	gso_size;
77325618Ssbruno#endif
78325618Ssbruno	}	s;
79325618Ssbruno};
80325618Ssbruno
81325618Ssbrunoint	lio_xmit(struct lio *lio, struct lio_instr_queue *iq,
82325618Ssbruno		 struct mbuf **m_headp);
83325618Ssbrunoint	lio_mq_start_locked(struct ifnet *ifp, struct lio_instr_queue *iq);
84325618Ssbrunoint	lio_mq_start(struct ifnet *ifp, struct mbuf *m);
85325618Ssbrunovoid	lio_qflush(struct ifnet *ifp);
86325618Ssbruno#endif	/* _LIO_RXTX_H_ */
87