xref: /openbmc/linux/include/net/dcbnl.h (revision 3286f88f)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2008, Intel Corporation.
4  *
5  * Author: Lucy Liu <lucy.liu@intel.com>
6  */
7 
8 #ifndef __NET_DCBNL_H__
9 #define __NET_DCBNL_H__
10 
11 #include <linux/dcbnl.h>
12 
13 struct net_device;
14 
15 struct dcb_app_type {
16 	int	ifindex;
17 	struct dcb_app	  app;
18 	struct list_head  list;
19 	u8	dcbx;
20 };
21 
22 u16 dcb_getrewr(struct net_device *dev, struct dcb_app *app);
23 int dcb_setrewr(struct net_device *dev, struct dcb_app *app);
24 int dcb_delrewr(struct net_device *dev, struct dcb_app *app);
25 
26 int dcb_setapp(struct net_device *, struct dcb_app *);
27 u8 dcb_getapp(struct net_device *, struct dcb_app *);
28 int dcb_ieee_setapp(struct net_device *, struct dcb_app *);
29 int dcb_ieee_delapp(struct net_device *, struct dcb_app *);
30 u8 dcb_ieee_getapp_mask(struct net_device *, struct dcb_app *);
31 
32 struct dcb_rewr_prio_pcp_map {
33 	u16 map[IEEE_8021QAZ_MAX_TCS];
34 };
35 
36 void dcb_getrewr_prio_pcp_mask_map(const struct net_device *dev,
37 				   struct dcb_rewr_prio_pcp_map *p_map);
38 
39 struct dcb_ieee_app_prio_map {
40 	u64 map[IEEE_8021QAZ_MAX_TCS];
41 };
42 void dcb_ieee_getapp_prio_dscp_mask_map(const struct net_device *dev,
43 					struct dcb_ieee_app_prio_map *p_map);
44 
45 void dcb_getrewr_prio_dscp_mask_map(const struct net_device *dev,
46 				    struct dcb_ieee_app_prio_map *p_map);
47 
48 struct dcb_ieee_app_dscp_map {
49 	u8 map[64];
50 };
51 void dcb_ieee_getapp_dscp_prio_mask_map(const struct net_device *dev,
52 					struct dcb_ieee_app_dscp_map *p_map);
53 u8 dcb_ieee_getapp_default_prio_mask(const struct net_device *dev);
54 
55 int dcbnl_ieee_notify(struct net_device *dev, int event, int cmd,
56 		      u32 seq, u32 pid);
57 int dcbnl_cee_notify(struct net_device *dev, int event, int cmd,
58 		     u32 seq, u32 pid);
59 
60 /*
61  * Ops struct for the netlink callbacks.  Used by DCB-enabled drivers through
62  * the netdevice struct.
63  */
64 struct dcbnl_rtnl_ops {
65 	/* IEEE 802.1Qaz std */
66 	int (*ieee_getets) (struct net_device *, struct ieee_ets *);
67 	int (*ieee_setets) (struct net_device *, struct ieee_ets *);
68 	int (*ieee_getmaxrate) (struct net_device *, struct ieee_maxrate *);
69 	int (*ieee_setmaxrate) (struct net_device *, struct ieee_maxrate *);
70 	int (*ieee_getqcn) (struct net_device *, struct ieee_qcn *);
71 	int (*ieee_setqcn) (struct net_device *, struct ieee_qcn *);
72 	int (*ieee_getqcnstats) (struct net_device *, struct ieee_qcn_stats *);
73 	int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *);
74 	int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *);
75 	int (*ieee_getapp) (struct net_device *, struct dcb_app *);
76 	int (*ieee_setapp) (struct net_device *, struct dcb_app *);
77 	int (*ieee_delapp) (struct net_device *, struct dcb_app *);
78 	int (*ieee_peer_getets) (struct net_device *, struct ieee_ets *);
79 	int (*ieee_peer_getpfc) (struct net_device *, struct ieee_pfc *);
80 
81 	/* CEE std */
82 	u8   (*getstate)(struct net_device *);
83 	u8   (*setstate)(struct net_device *, u8);
84 	void (*getpermhwaddr)(struct net_device *, u8 *);
85 	void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8);
86 	void (*setpgbwgcfgtx)(struct net_device *, int, u8);
87 	void (*setpgtccfgrx)(struct net_device *, int, u8, u8, u8, u8);
88 	void (*setpgbwgcfgrx)(struct net_device *, int, u8);
89 	void (*getpgtccfgtx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *);
90 	void (*getpgbwgcfgtx)(struct net_device *, int, u8 *);
91 	void (*getpgtccfgrx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *);
92 	void (*getpgbwgcfgrx)(struct net_device *, int, u8 *);
93 	void (*setpfccfg)(struct net_device *, int, u8);
94 	void (*getpfccfg)(struct net_device *, int, u8 *);
95 	u8   (*setall)(struct net_device *);
96 	u8   (*getcap)(struct net_device *, int, u8 *);
97 	int  (*getnumtcs)(struct net_device *, int, u8 *);
98 	int  (*setnumtcs)(struct net_device *, int, u8);
99 	u8   (*getpfcstate)(struct net_device *);
100 	void (*setpfcstate)(struct net_device *, u8);
101 	void (*getbcncfg)(struct net_device *, int, u32 *);
102 	void (*setbcncfg)(struct net_device *, int, u32);
103 	void (*getbcnrp)(struct net_device *, int, u8 *);
104 	void (*setbcnrp)(struct net_device *, int, u8);
105 	int  (*setapp)(struct net_device *, u8, u16, u8);
106 	int  (*getapp)(struct net_device *, u8, u16);
107 	u8   (*getfeatcfg)(struct net_device *, int, u8 *);
108 	u8   (*setfeatcfg)(struct net_device *, int, u8);
109 
110 	/* DCBX configuration */
111 	u8   (*getdcbx)(struct net_device *);
112 	u8   (*setdcbx)(struct net_device *, u8);
113 
114 	/* peer apps */
115 	int (*peer_getappinfo)(struct net_device *, struct dcb_peer_app_info *,
116 			       u16 *);
117 	int (*peer_getapptable)(struct net_device *, struct dcb_app *);
118 
119 	/* CEE peer */
120 	int (*cee_peer_getpg) (struct net_device *, struct cee_pg *);
121 	int (*cee_peer_getpfc) (struct net_device *, struct cee_pfc *);
122 
123 	/* buffer settings */
124 	int (*dcbnl_getbuffer)(struct net_device *, struct dcbnl_buffer *);
125 	int (*dcbnl_setbuffer)(struct net_device *, struct dcbnl_buffer *);
126 
127 	/* apptrust */
128 	int (*dcbnl_setapptrust)(struct net_device *, u8 *, int);
129 	int (*dcbnl_getapptrust)(struct net_device *, u8 *, int *);
130 
131 	/* rewrite */
132 	int (*dcbnl_setrewr)(struct net_device *dev, struct dcb_app *app);
133 	int (*dcbnl_delrewr)(struct net_device *dev, struct dcb_app *app);
134 };
135 
136 #endif /* __NET_DCBNL_H__ */
137