Merge tag 'bcachefs-2024-10-05' of git://evilpiepirate.org/bcachefs
[linux-2.6-block.git] / drivers / net / ethernet / qlogic / qed / qed_dcbx.h
CommitLineData
1f4d4ed6 1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
39651abd 2/* QLogic qed NIC Driver
e8f1cb50 3 * Copyright (c) 2015-2017 QLogic Corporation
663eacd8 4 * Copyright (c) 2019-2020 Marvell International Ltd.
39651abd
SRK
5 */
6
7#ifndef _QED_DCBX_H
8#define _QED_DCBX_H
9#include <linux/types.h>
10#include <linux/slab.h>
11#include "qed.h"
12#include "qed_hsi.h"
13#include "qed_hw.h"
14#include "qed_mcp.h"
15#include "qed_reg_addr.h"
16
17#define DCBX_CONFIG_MAX_APP_PROTOCOL 4
18
19enum qed_mib_read_type {
20 QED_DCBX_OPERATIONAL_MIB,
21 QED_DCBX_REMOTE_MIB,
22 QED_DCBX_LOCAL_MIB,
23 QED_DCBX_REMOTE_LLDP_MIB,
24 QED_DCBX_LOCAL_LLDP_MIB
25};
26
27struct qed_dcbx_app_data {
28 bool enable; /* DCB enabled */
dfc268f6 29 u8 update; /* Update indication */
39651abd
SRK
30 u8 priority; /* Priority */
31 u8 tc; /* Traffic Class */
0216da94 32 bool dont_add_vlan0; /* Do not insert a vlan tag with id 0 */
39651abd
SRK
33};
34
6ad8c632
SRK
35#define QED_DCBX_VERSION_DISABLED 0
36#define QED_DCBX_VERSION_IEEE 1
37#define QED_DCBX_VERSION_CEE 2
38
39struct qed_dcbx_set {
40#define QED_DCBX_OVERRIDE_STATE BIT(0)
41#define QED_DCBX_OVERRIDE_PFC_CFG BIT(1)
42#define QED_DCBX_OVERRIDE_ETS_CFG BIT(2)
43#define QED_DCBX_OVERRIDE_APP_CFG BIT(3)
44#define QED_DCBX_OVERRIDE_DSCP_CFG BIT(4)
45 u32 override_flags;
46 bool enabled;
47 struct qed_dcbx_admin_params config;
48 u32 ver_num;
49};
6ad8c632 50
39651abd
SRK
51struct qed_dcbx_results {
52 bool dcbx_enabled;
53 u8 pf_id;
54 struct qed_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE];
55};
56
57struct qed_dcbx_app_metadata {
58 enum dcbx_protocol_type id;
59 char *name;
60 enum qed_pci_personality personality;
61};
62
39651abd
SRK
63struct qed_dcbx_info {
64 struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS];
65 struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS];
66 struct dcbx_local_params local_admin;
67 struct qed_dcbx_results results;
68 struct dcbx_mib operational;
69 struct dcbx_mib remote;
6ad8c632 70 struct qed_dcbx_set set;
1e128c81 71 struct qed_dcbx_get get;
39651abd
SRK
72 u8 dcbx_cap;
73};
74
75struct qed_dcbx_mib_meta_data {
76 struct lldp_config_params_s *lldp_local;
77 struct lldp_status_params_s *lldp_remote;
78 struct dcbx_local_params *local_admin;
79 struct dcbx_mib *mib;
80 size_t size;
81 u32 addr;
82};
83
c6b7314d
AL
84extern const struct qed_eth_dcbnl_ops qed_dcbnl_ops_pass;
85
6ad8c632 86#ifdef CONFIG_DCB
ee824f4b
OK
87int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn,
88 struct qed_dcbx_set *params);
6ad8c632 89
ee824f4b
OK
90int qed_dcbx_config_params(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
91 struct qed_dcbx_set *params, bool hw_commit);
6ad8c632
SRK
92#endif
93
39651abd
SRK
94/* QED local interface routines */
95int
ee824f4b
OK
96qed_dcbx_mib_update_event(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
97 enum qed_mib_read_type type);
39651abd
SRK
98
99int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn);
270837b3 100void qed_dcbx_info_free(struct qed_hwfn *p_hwfn);
39651abd
SRK
101void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
102 struct pf_update_ramrod_data *p_dest);
103
2a1cb1bf
DB
104#define QED_DCBX_DEFAULT_TC 0
105
106u8 qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri);
39651abd 107#endif