]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/liquidio/lio_rxtx.h
MFV: r360512
[FreeBSD/FreeBSD.git] / sys / dev / liquidio / lio_rxtx.h
1 /*
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Cavium, Inc. nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 /*$FreeBSD$*/
34
35 #ifndef _LIO_RXTX_H_
36 #define _LIO_RXTX_H_
37
38 /* Bit mask values for lio->ifstate */
39 #define LIO_IFSTATE_DROQ_OPS    0x01
40 #define LIO_IFSTATE_REGISTERED  0x02
41 #define LIO_IFSTATE_RUNNING     0x04
42 #define LIO_IFSTATE_DETACH      0x08
43 #define LIO_IFSTATE_RESETTING   0x10
44
45
46 /*
47  * Structure of a node in list of gather components maintained by
48  * NIC driver for each network device.
49  */
50 struct lio_gather {
51         /* List manipulation. Next and prev pointers. */
52         struct lio_stailq_node  node;
53
54         /* Size of the gather component at sg in bytes. */
55         int     sg_size;
56
57         /*
58          * Gather component that can accommodate max sized fragment list
59          * received from the IP layer.
60          */
61         struct lio_sg_entry     *sg;
62
63         uint64_t                sg_dma_ptr;
64 };
65
66 union lio_tx_info {
67         uint64_t        tx_info64;
68         struct {
69 #if _BYTE_ORDER == _BIG_ENDIAN
70                 uint16_t        gso_size;
71                 uint16_t        gso_segs;
72                 uint32_t        reserved;
73 #else   /* _BYTE_ORDER == _LITTLE_ENDIAN */
74                 uint32_t        reserved;
75                 uint16_t        gso_segs;
76                 uint16_t        gso_size;
77 #endif
78         }       s;
79 };
80
81 int     lio_xmit(struct lio *lio, struct lio_instr_queue *iq,
82                  struct mbuf **m_headp);
83 int     lio_mq_start_locked(struct ifnet *ifp, struct lio_instr_queue *iq);
84 int     lio_mq_start(struct ifnet *ifp, struct mbuf *m);
85 void    lio_qflush(struct ifnet *ifp);
86 #endif  /* _LIO_RXTX_H_ */