98ff493aec96f9ba7160a00643b309930590b2cf
[dpdk.git] / drivers / net / liquidio / lio_ethdev.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
34 #ifndef _LIO_ETHDEV_H_
35 #define _LIO_ETHDEV_H_
36
37 #include <stdint.h>
38
39 #include "lio_struct.h"
40
41 /* timeout to check link state updates from firmware in us */
42 #define LIO_LSC_TIMEOUT         100000 /* 100000us (100ms) */
43 #define LIO_MAX_CMD_TIMEOUT     10000 /* 10000ms (10s) */
44
45 #define LIO_DEV(_eth_dev)               ((_eth_dev)->data->dev_private)
46
47 enum lio_bus_speed {
48         LIO_LINK_SPEED_UNKNOWN  = 0,
49         LIO_LINK_SPEED_10000    = 10000
50 };
51
52 struct octeon_if_cfg_info {
53         uint64_t iqmask;        /** mask for IQs enabled for the port */
54         uint64_t oqmask;        /** mask for OQs enabled for the port */
55         struct octeon_link_info linfo; /** initial link information */
56         char lio_firmware_version[LIO_FW_VERSION_LENGTH];
57 };
58
59 union lio_if_cfg {
60         uint64_t if_cfg64;
61         struct {
62 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
63                 uint64_t base_queue : 16;
64                 uint64_t num_iqueues : 16;
65                 uint64_t num_oqueues : 16;
66                 uint64_t gmx_port_id : 8;
67                 uint64_t vf_id : 8;
68 #else
69                 uint64_t vf_id : 8;
70                 uint64_t gmx_port_id : 8;
71                 uint64_t num_oqueues : 16;
72                 uint64_t num_iqueues : 16;
73                 uint64_t base_queue : 16;
74 #endif
75         } s;
76 };
77
78 struct lio_if_cfg_resp {
79         uint64_t rh;
80         struct octeon_if_cfg_info cfg_info;
81         uint64_t status;
82 };
83
84 struct lio_link_status_resp {
85         uint64_t rh;
86         struct octeon_link_info link_info;
87         uint64_t status;
88 };
89 #endif  /* _LIO_ETHDEV_H_ */