4 * Copyright(c) 2017 Cavium, Inc.. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
34 #ifndef _LIO_23XX_VF_H_
35 #define _LIO_23XX_VF_H_
39 #include "lio_struct.h"
41 static const struct lio_config default_cn23xx_conf = {
42 .card_type = LIO_23XX,
43 .card_name = LIO_23XX_NAME,
46 .max_iqs = CN23XX_CFG_IO_QUEUES,
48 (CN23XX_MAX_IQ_DESCRIPTORS * CN23XX_CFG_IO_QUEUES),
49 .instr_type = OCTEON_64BYTE_INSTR,
54 .max_oqs = CN23XX_CFG_IO_QUEUES,
55 .info_ptr = OCTEON_OQ_INFOPTR_MODE,
56 .refill_threshold = CN23XX_OQ_REFIL_THRESHOLD,
59 .num_nic_ports = CN23XX_DEFAULT_NUM_PORTS,
60 .num_def_rx_descs = CN23XX_MAX_OQ_DESCRIPTORS,
61 .num_def_tx_descs = CN23XX_MAX_IQ_DESCRIPTORS,
62 .def_rx_buf_size = CN23XX_OQ_BUF_SIZE,
65 static inline const struct lio_config *
66 lio_get_conf(struct lio_device *lio_dev)
68 const struct lio_config *default_lio_conf = NULL;
70 /* check the LIO Device model & return the corresponding lio
73 default_lio_conf = &default_cn23xx_conf;
75 if (default_lio_conf == NULL) {
76 lio_dev_err(lio_dev, "Configuration verification failed\n");
80 return default_lio_conf;
83 /** Turns off the input and output queues for the device
84 * @param lio_dev which device io queues to disable
86 int cn23xx_vf_set_io_queues_off(struct lio_device *lio_dev);
88 #define CN23XX_VF_BUSY_READING_REG_LOOP_COUNT 100000
90 int cn23xx_pfvf_handshake(struct lio_device *lio_dev);
92 int cn23xx_vf_setup_device(struct lio_device *lio_dev);
94 void cn23xx_vf_handle_mbox(struct lio_device *lio_dev);
95 #endif /* _LIO_23XX_VF_H_ */