xref: /freebsd/sys/dev/iavf/iavf_vc_common.h (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*  Copyright (c) 2021, Intel Corporation
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *
8  *   1. Redistributions of source code must retain the above copyright notice,
9  *      this list of conditions and the following disclaimer.
10  *
11  *   2. Redistributions in binary form must reproduce the above copyright
12  *      notice, this list of conditions and the following disclaimer in the
13  *      documentation and/or other materials provided with the distribution.
14  *
15  *   3. Neither the name of the Intel Corporation nor the names of its
16  *      contributors may be used to endorse or promote products derived from
17  *      this software without specific prior written permission.
18  *
19  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  *  POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /**
33  * @file iavf_vc_common.h
34  * @brief header for the virtchnl interface
35  *
36  * Contains function declarations for the virtchnl PF to VF communication
37  * interface.
38  */
39 #ifndef _IAVF_VC_COMMON_H_
40 #define _IAVF_VC_COMMON_H_
41 
42 #include "iavf_iflib.h"
43 
44 int iavf_send_pf_msg(struct iavf_sc *sc,
45 	enum virtchnl_ops op, u8 *msg, u16 len);
46 int iavf_verify_api_ver(struct iavf_sc *);
47 int iavf_send_api_ver(struct iavf_sc *sc);
48 int iavf_enable_queues(struct iavf_sc *sc);
49 int iavf_disable_queues(struct iavf_sc *sc);
50 int iavf_add_vlans(struct iavf_sc *sc);
51 int iavf_send_vf_config_msg(struct iavf_sc *sc);
52 int iavf_get_vf_config(struct iavf_sc *sc);
53 int iavf_del_vlans(struct iavf_sc *sc);
54 int iavf_add_ether_filters(struct iavf_sc *sc);
55 int iavf_del_ether_filters(struct iavf_sc *sc);
56 int iavf_request_reset(struct iavf_sc *sc);
57 int iavf_request_stats(struct iavf_sc *sc);
58 void iavf_update_stats_counters(struct iavf_sc *sc, struct iavf_eth_stats *es);
59 int iavf_config_rss_key(struct iavf_sc *sc);
60 int iavf_set_rss_hena(struct iavf_sc *sc);
61 int iavf_config_rss_lut(struct iavf_sc *sc);
62 int iavf_config_promisc_mode(struct iavf_sc *sc);
63 void	*iavf_vc_get_op_chan(struct iavf_sc *sc, uint32_t request);
64 int	iavf_vc_send_cmd(struct iavf_sc *sc, uint32_t request);
65 const char * iavf_vc_stat_str(struct iavf_hw *hw,
66     enum virtchnl_status_code stat_err);
67 const char *
68     iavf_vc_speed_to_string(enum virtchnl_link_speed link_speed);
69 const char * iavf_vc_opcode_str(uint16_t op);
70 void
71 iavf_vc_completion(struct iavf_sc *sc,
72     enum virtchnl_ops v_opcode,
73     enum virtchnl_status_code v_retval, u8 *msg, u16 msglen);
74 enum iavf_ext_link_speed iavf_adv_speed_to_ext_speed(u32 adv_link_speed);
75 u32 iavf_ext_speed_to_ifmedia(enum iavf_ext_link_speed link_speed);
76 enum iavf_ext_link_speed iavf_vc_speed_to_ext_speed(enum virtchnl_link_speed link_speed);
77 const char * iavf_ext_speed_to_str(enum iavf_ext_link_speed link_speed);
78 
79 int iavf_configure_queues(struct iavf_sc *sc);
80 int iavf_map_queues(struct iavf_sc *sc);
81 
82 #endif /* _IAVF_VC_COMMON_H_ */
83