xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_dcbx.h (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
1 /*
2  * Copyright (c) 2017-2018 Cavium, Inc.
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
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
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  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef __ECORE_DCBX_H__
30 #define __ECORE_DCBX_H__
31 
32 #include "ecore.h"
33 #include "ecore_mcp.h"
34 #include "mcp_public.h"
35 #include "reg_addr.h"
36 #include "ecore_hw.h"
37 #include "ecore_hsi_common.h"
38 #include "ecore_dcbx_api.h"
39 
40 #define ECORE_DCBX_DSCP_DISABLED 0XFF
41 
42 struct ecore_dcbx_info {
43 	struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS];
44 	struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS];
45 	struct dcbx_local_params local_admin;
46 	struct ecore_dcbx_results results;
47 	struct dcb_dscp_map dscp_map;
48 	bool dscp_nig_update;
49 	struct dcbx_mib operational;
50 	struct dcbx_mib remote;
51 	struct ecore_dcbx_set set;
52 	struct ecore_dcbx_get get;
53 	u8 dcbx_cap;
54 	u16 iwarp_port;
55 };
56 
57 struct ecore_dcbx_mib_meta_data {
58 	struct lldp_config_params_s *lldp_local;
59 	struct lldp_status_params_s *lldp_remote;
60 	struct lldp_received_tlvs_s *lldp_tlvs;
61 	struct dcbx_local_params *local_admin;
62 	struct dcb_dscp_map *dscp_map;
63 	struct dcbx_mib *mib;
64 	osal_size_t size;
65 	u32 addr;
66 };
67 
68 /* ECORE local interface routines */
69 enum _ecore_status_t
70 ecore_dcbx_mib_update_event(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
71 			    enum ecore_mib_read_type type);
72 
73 enum _ecore_status_t ecore_dcbx_info_alloc(struct ecore_hwfn *p_hwfn);
74 void ecore_dcbx_info_free(struct ecore_hwfn *p_hwfn);
75 void ecore_dcbx_set_pf_update_params(struct ecore_dcbx_results *p_src,
76 				     struct pf_update_ramrod_data *p_dest);
77 
78 /* Returns TOS value for a given priority */
79 u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn, u8 pri);
80 
81 enum _ecore_status_t
82 ecore_lldp_mib_update_event(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
83 
84 #endif /* __ECORE_DCBX_H__ */
85