xref: /freebsd/sys/dev/iavf/iavf_vc_common.h (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
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 /*$FreeBSD$*/
32 
33 /**
34  * @file iavf_vc_common.h
35  * @brief header for the virtchnl interface
36  *
37  * Contains function declarations for the virtchnl PF to VF communication
38  * interface.
39  */
40 #ifndef _IAVF_VC_COMMON_H_
41 #define _IAVF_VC_COMMON_H_
42 
43 #include "iavf_iflib.h"
44 
45 int iavf_send_pf_msg(struct iavf_sc *sc,
46 	enum virtchnl_ops op, u8 *msg, u16 len);
47 int iavf_verify_api_ver(struct iavf_sc *);
48 int iavf_send_api_ver(struct iavf_sc *sc);
49 int iavf_enable_queues(struct iavf_sc *sc);
50 int iavf_disable_queues(struct iavf_sc *sc);
51 int iavf_add_vlans(struct iavf_sc *sc);
52 int iavf_send_vf_config_msg(struct iavf_sc *sc);
53 int iavf_get_vf_config(struct iavf_sc *sc);
54 int iavf_del_vlans(struct iavf_sc *sc);
55 int iavf_add_ether_filters(struct iavf_sc *sc);
56 int iavf_del_ether_filters(struct iavf_sc *sc);
57 int iavf_request_reset(struct iavf_sc *sc);
58 int iavf_request_stats(struct iavf_sc *sc);
59 void iavf_update_stats_counters(struct iavf_sc *sc, struct iavf_eth_stats *es);
60 int iavf_config_rss_key(struct iavf_sc *sc);
61 int iavf_set_rss_hena(struct iavf_sc *sc);
62 int iavf_config_rss_lut(struct iavf_sc *sc);
63 int iavf_config_promisc_mode(struct iavf_sc *sc);
64 void	*iavf_vc_get_op_chan(struct iavf_sc *sc, uint32_t request);
65 int	iavf_vc_send_cmd(struct iavf_sc *sc, uint32_t request);
66 const char * iavf_vc_stat_str(struct iavf_hw *hw,
67     enum virtchnl_status_code stat_err);
68 const char *
69     iavf_vc_speed_to_string(enum virtchnl_link_speed link_speed);
70 const char * iavf_vc_opcode_str(uint16_t op);
71 void
72 iavf_vc_completion(struct iavf_sc *sc,
73     enum virtchnl_ops v_opcode,
74     enum virtchnl_status_code v_retval, u8 *msg, u16 msglen);
75 enum iavf_ext_link_speed iavf_adv_speed_to_ext_speed(u32 adv_link_speed);
76 u32 iavf_ext_speed_to_ifmedia(enum iavf_ext_link_speed link_speed);
77 enum iavf_ext_link_speed iavf_vc_speed_to_ext_speed(enum virtchnl_link_speed link_speed);
78 const char * iavf_ext_speed_to_str(enum iavf_ext_link_speed link_speed);
79 
80 int iavf_configure_queues(struct iavf_sc *sc);
81 int iavf_map_queues(struct iavf_sc *sc);
82 
83 #endif /* _IAVF_VC_COMMON_H_ */
84