ecore_dcbx.h revision 337519
113049Sasami/*
213049Sasami * Copyright (c) 2017-2018 Cavium, Inc.
313049Sasami * All rights reserved.
413049Sasami *
513049Sasami *  Redistribution and use in source and binary forms, with or without
613049Sasami *  modification, are permitted provided that the following conditions
713049Sasami *  are met:
813049Sasami *
913049Sasami *  1. Redistributions of source code must retain the above copyright
1013049Sasami *     notice, this list of conditions and the following disclaimer.
1113049Sasami *  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 * $FreeBSD: stable/10/sys/dev/qlnx/qlnxe/ecore_dcbx.h 337519 2018-08-09 01:39:47Z davidcs $
28 *
29 */
30
31#ifndef __ECORE_DCBX_H__
32#define __ECORE_DCBX_H__
33
34#include "ecore.h"
35#include "ecore_mcp.h"
36#include "mcp_public.h"
37#include "reg_addr.h"
38#include "ecore_hw.h"
39#include "ecore_hsi_common.h"
40#include "ecore_dcbx_api.h"
41
42#define ECORE_DCBX_DSCP_DISABLED 0XFF
43
44struct ecore_dcbx_info {
45	struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS];
46	struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS];
47	struct dcbx_local_params local_admin;
48	struct ecore_dcbx_results results;
49	struct dcb_dscp_map dscp_map;
50	bool dscp_nig_update;
51	struct dcbx_mib operational;
52	struct dcbx_mib remote;
53	struct ecore_dcbx_set set;
54	struct ecore_dcbx_get get;
55	u8 dcbx_cap;
56	u16 iwarp_port;
57};
58
59struct ecore_dcbx_mib_meta_data {
60	struct lldp_config_params_s *lldp_local;
61	struct lldp_status_params_s *lldp_remote;
62	struct lldp_received_tlvs_s *lldp_tlvs;
63	struct dcbx_local_params *local_admin;
64	struct dcb_dscp_map *dscp_map;
65	struct dcbx_mib *mib;
66	osal_size_t size;
67	u32 addr;
68};
69
70/* ECORE local interface routines */
71enum _ecore_status_t
72ecore_dcbx_mib_update_event(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
73			    enum ecore_mib_read_type type);
74
75enum _ecore_status_t ecore_dcbx_info_alloc(struct ecore_hwfn *p_hwfn);
76void ecore_dcbx_info_free(struct ecore_hwfn *p_hwfn);
77void ecore_dcbx_set_pf_update_params(struct ecore_dcbx_results *p_src,
78				     struct pf_update_ramrod_data *p_dest);
79
80/* Returns TOS value for a given priority */
81u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn, u8 pri);
82
83enum _ecore_status_t
84ecore_lldp_mib_update_event(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
85
86#endif /* __ECORE_DCBX_H__ */
87