New upstream version 18.02
[deb_dpdk.git] / drivers / net / liquidio / base / lio_23xx_vf.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Cavium, Inc
3  */
4
5 #ifndef _LIO_23XX_VF_H_
6 #define _LIO_23XX_VF_H_
7
8 #include <stdio.h>
9
10 #include "lio_struct.h"
11
12 static const struct lio_config default_cn23xx_conf      = {
13         .card_type                              = LIO_23XX,
14         .card_name                              = LIO_23XX_NAME,
15         /** IQ attributes */
16         .iq                                     = {
17                 .max_iqs                        = CN23XX_CFG_IO_QUEUES,
18                 .pending_list_size              =
19                         (CN23XX_MAX_IQ_DESCRIPTORS * CN23XX_CFG_IO_QUEUES),
20                 .instr_type                     = OCTEON_64BYTE_INSTR,
21         },
22
23         /** OQ attributes */
24         .oq                                     = {
25                 .max_oqs                        = CN23XX_CFG_IO_QUEUES,
26                 .info_ptr                       = OCTEON_OQ_INFOPTR_MODE,
27                 .refill_threshold               = CN23XX_OQ_REFIL_THRESHOLD,
28         },
29
30         .num_nic_ports                          = CN23XX_DEFAULT_NUM_PORTS,
31         .num_def_rx_descs                       = CN23XX_MAX_OQ_DESCRIPTORS,
32         .num_def_tx_descs                       = CN23XX_MAX_IQ_DESCRIPTORS,
33         .def_rx_buf_size                        = CN23XX_OQ_BUF_SIZE,
34 };
35
36 static inline const struct lio_config *
37 lio_get_conf(struct lio_device *lio_dev)
38 {
39         const struct lio_config *default_lio_conf = NULL;
40
41         /* check the LIO Device model & return the corresponding lio
42          * configuration
43          */
44         default_lio_conf = &default_cn23xx_conf;
45
46         if (default_lio_conf == NULL) {
47                 lio_dev_err(lio_dev, "Configuration verification failed\n");
48                 return NULL;
49         }
50
51         return default_lio_conf;
52 }
53
54 #define CN23XX_VF_BUSY_READING_REG_LOOP_COUNT   100000
55
56 void cn23xx_vf_ask_pf_to_do_flr(struct lio_device *lio_dev);
57
58 int cn23xx_pfvf_handshake(struct lio_device *lio_dev);
59
60 int cn23xx_vf_setup_device(struct lio_device  *lio_dev);
61
62 void cn23xx_vf_handle_mbox(struct lio_device *lio_dev);
63 #endif /* _LIO_23XX_VF_H_  */