~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/qed/qed_eth_if.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2 /* QLogic qed NIC Driver
  3  * Copyright (c) 2015-2017  QLogic Corporation
  4  * Copyright (c) 2019-2020 Marvell International Ltd.
  5  */
  6 
  7 #ifndef _QED_ETH_IF_H
  8 #define _QED_ETH_IF_H
  9 
 10 #include <linux/list.h>
 11 #include <linux/if_link.h>
 12 #include <linux/qed/eth_common.h>
 13 #include <linux/qed/qed_if.h>
 14 #include <linux/qed/qed_iov_if.h>
 15 
 16 /* 64 max queues * (1 rx + 4 tx-cos + 1 xdp) */
 17 #define QED_MIN_L2_CONS (2 + NUM_PHYS_TCS_4PORT_K2)
 18 #define QED_MAX_L2_CONS (64 * (QED_MIN_L2_CONS))
 19 
 20 struct qed_queue_start_common_params {
 21         /* Should always be relative to entity sending this. */
 22         u8 vport_id;
 23         u16 queue_id;
 24 
 25         /* Relative, but relevant only for PFs */
 26         u8 stats_id;
 27 
 28         struct qed_sb_info *p_sb;
 29         u8 sb_idx;
 30 
 31         u8 tc;
 32 };
 33 
 34 struct qed_rxq_start_ret_params {
 35         void __iomem *p_prod;
 36         void *p_handle;
 37 };
 38 
 39 struct qed_txq_start_ret_params {
 40         void __iomem *p_doorbell;
 41         void *p_handle;
 42 };
 43 
 44 enum qed_filter_config_mode {
 45         QED_FILTER_CONFIG_MODE_DISABLE,
 46         QED_FILTER_CONFIG_MODE_5_TUPLE,
 47         QED_FILTER_CONFIG_MODE_L4_PORT,
 48         QED_FILTER_CONFIG_MODE_IP_DEST,
 49         QED_FILTER_CONFIG_MODE_IP_SRC,
 50 };
 51 
 52 struct qed_ntuple_filter_params {
 53         /* Physically mapped address containing header of buffer to be used
 54          * as filter.
 55          */
 56         dma_addr_t addr;
 57 
 58         /* Length of header in bytes */
 59         u16 length;
 60 
 61         /* Relative queue-id to receive classified packet */
 62 #define QED_RFS_NTUPLE_QID_RSS ((u16)-1)
 63         u16 qid;
 64 
 65         /* Identifier can either be according to vport-id or vfid */
 66         bool b_is_vf;
 67         u8 vport_id;
 68         u8 vf_id;
 69 
 70         /* true iff this filter is to be added. Else to be removed */
 71         bool b_is_add;
 72 
 73         /* If flow needs to be dropped */
 74         bool b_is_drop;
 75 };
 76 
 77 struct qed_dev_eth_info {
 78         struct qed_dev_info common;
 79 
 80         u8      num_queues;
 81         u8      num_tc;
 82 
 83         u8      port_mac[ETH_ALEN];
 84         u16     num_vlan_filters;
 85         u16     num_mac_filters;
 86 
 87         /* Legacy VF - this affects the datapath, so qede has to know */
 88         bool is_legacy;
 89 
 90         /* Might depend on available resources [in case of VF] */
 91         bool xdp_supported;
 92 };
 93 
 94 struct qed_update_vport_rss_params {
 95         void    *rss_ind_table[128];
 96         u32     rss_key[10];
 97         u8      rss_caps;
 98 };
 99 
100 struct qed_update_vport_params {
101         u8 vport_id;
102         u8 update_vport_active_flg;
103         u8 vport_active_flg;
104         u8 update_tx_switching_flg;
105         u8 tx_switching_flg;
106         u8 update_accept_any_vlan_flg;
107         u8 accept_any_vlan;
108         u8 update_rss_flg;
109         struct qed_update_vport_rss_params rss_params;
110 };
111 
112 struct qed_start_vport_params {
113         bool remove_inner_vlan;
114         bool handle_ptp_pkts;
115         bool gro_enable;
116         bool drop_ttl0;
117         u8 vport_id;
118         u16 mtu;
119         bool clear_stats;
120 };
121 
122 enum qed_filter_rx_mode_type {
123         QED_FILTER_RX_MODE_TYPE_REGULAR,
124         QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC,
125         QED_FILTER_RX_MODE_TYPE_PROMISC,
126 };
127 
128 enum qed_filter_xcast_params_type {
129         QED_FILTER_XCAST_TYPE_ADD,
130         QED_FILTER_XCAST_TYPE_DEL,
131         QED_FILTER_XCAST_TYPE_REPLACE,
132 };
133 
134 struct qed_filter_ucast_params {
135         enum qed_filter_xcast_params_type type;
136         u8 vlan_valid;
137         u16 vlan;
138         u8 mac_valid;
139         unsigned char mac[ETH_ALEN];
140 };
141 
142 struct qed_filter_mcast_params {
143         enum qed_filter_xcast_params_type type;
144         u8 num;
145         unsigned char mac[64][ETH_ALEN];
146 };
147 
148 enum qed_filter_type {
149         QED_FILTER_TYPE_UCAST,
150         QED_FILTER_TYPE_MCAST,
151         QED_FILTER_TYPE_RX_MODE,
152         QED_MAX_FILTER_TYPES,
153 };
154 
155 struct qed_tunn_params {
156         u16 vxlan_port;
157         u8 update_vxlan_port;
158         u16 geneve_port;
159         u8 update_geneve_port;
160 };
161 
162 struct qed_eth_cb_ops {
163         struct qed_common_cb_ops common;
164         void (*force_mac) (void *dev, u8 *mac, bool forced);
165         void (*ports_update)(void *dev, u16 vxlan_port, u16 geneve_port);
166 };
167 
168 #define QED_MAX_PHC_DRIFT_PPB   291666666
169 
170 enum qed_ptp_filter_type {
171         QED_PTP_FILTER_NONE,
172         QED_PTP_FILTER_ALL,
173         QED_PTP_FILTER_V1_L4_EVENT,
174         QED_PTP_FILTER_V1_L4_GEN,
175         QED_PTP_FILTER_V2_L4_EVENT,
176         QED_PTP_FILTER_V2_L4_GEN,
177         QED_PTP_FILTER_V2_L2_EVENT,
178         QED_PTP_FILTER_V2_L2_GEN,
179         QED_PTP_FILTER_V2_EVENT,
180         QED_PTP_FILTER_V2_GEN
181 };
182 
183 enum qed_ptp_hwtstamp_tx_type {
184         QED_PTP_HWTSTAMP_TX_OFF,
185         QED_PTP_HWTSTAMP_TX_ON,
186 };
187 
188 #ifdef CONFIG_DCB
189 /* Prototype declaration of qed_eth_dcbnl_ops should match with the declaration
190  * of dcbnl_rtnl_ops structure.
191  */
192 struct qed_eth_dcbnl_ops {
193         /* IEEE 802.1Qaz std */
194         int (*ieee_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
195         int (*ieee_setpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
196         int (*ieee_getets)(struct qed_dev *cdev, struct ieee_ets *ets);
197         int (*ieee_setets)(struct qed_dev *cdev, struct ieee_ets *ets);
198         int (*ieee_peer_getets)(struct qed_dev *cdev, struct ieee_ets *ets);
199         int (*ieee_peer_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
200         int (*ieee_getapp)(struct qed_dev *cdev, struct dcb_app *app);
201         int (*ieee_setapp)(struct qed_dev *cdev, struct dcb_app *app);
202 
203         /* CEE std */
204         u8 (*getstate)(struct qed_dev *cdev);
205         u8 (*setstate)(struct qed_dev *cdev, u8 state);
206         void (*getpgtccfgtx)(struct qed_dev *cdev, int prio, u8 *prio_type,
207                              u8 *pgid, u8 *bw_pct, u8 *up_map);
208         void (*getpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 *bw_pct);
209         void (*getpgtccfgrx)(struct qed_dev *cdev, int prio, u8 *prio_type,
210                              u8 *pgid, u8 *bw_pct, u8 *up_map);
211         void (*getpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 *bw_pct);
212         void (*getpfccfg)(struct qed_dev *cdev, int prio, u8 *setting);
213         void (*setpfccfg)(struct qed_dev *cdev, int prio, u8 setting);
214         u8 (*getcap)(struct qed_dev *cdev, int capid, u8 *cap);
215         int (*getnumtcs)(struct qed_dev *cdev, int tcid, u8 *num);
216         u8 (*getpfcstate)(struct qed_dev *cdev);
217         int (*getapp)(struct qed_dev *cdev, u8 idtype, u16 id);
218         u8 (*getfeatcfg)(struct qed_dev *cdev, int featid, u8 *flags);
219 
220         /* DCBX configuration */
221         u8 (*getdcbx)(struct qed_dev *cdev);
222         void (*setpgtccfgtx)(struct qed_dev *cdev, int prio,
223                              u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map);
224         void (*setpgtccfgrx)(struct qed_dev *cdev, int prio,
225                              u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map);
226         void (*setpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 bw_pct);
227         void (*setpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 bw_pct);
228         u8 (*setall)(struct qed_dev *cdev);
229         int (*setnumtcs)(struct qed_dev *cdev, int tcid, u8 num);
230         void (*setpfcstate)(struct qed_dev *cdev, u8 state);
231         int (*setapp)(struct qed_dev *cdev, u8 idtype, u16 idval, u8 up);
232         u8 (*setdcbx)(struct qed_dev *cdev, u8 state);
233         u8 (*setfeatcfg)(struct qed_dev *cdev, int featid, u8 flags);
234 
235         /* Peer apps */
236         int (*peer_getappinfo)(struct qed_dev *cdev,
237                                struct dcb_peer_app_info *info,
238                                u16 *app_count);
239         int (*peer_getapptable)(struct qed_dev *cdev, struct dcb_app *table);
240 
241         /* CEE peer */
242         int (*cee_peer_getpfc)(struct qed_dev *cdev, struct cee_pfc *pfc);
243         int (*cee_peer_getpg)(struct qed_dev *cdev, struct cee_pg *pg);
244 };
245 #endif
246 
247 struct qed_eth_ptp_ops {
248         int (*cfg_filters)(struct qed_dev *, enum qed_ptp_filter_type,
249                            enum qed_ptp_hwtstamp_tx_type);
250         int (*read_rx_ts)(struct qed_dev *, u64 *);
251         int (*read_tx_ts)(struct qed_dev *, u64 *);
252         int (*read_cc)(struct qed_dev *, u64 *);
253         int (*disable)(struct qed_dev *);
254         int (*adjfreq)(struct qed_dev *, s32);
255         int (*enable)(struct qed_dev *);
256 };
257 
258 struct qed_eth_ops {
259         const struct qed_common_ops *common;
260 #ifdef CONFIG_QED_SRIOV
261         const struct qed_iov_hv_ops *iov;
262 #endif
263 #ifdef CONFIG_DCB
264         const struct qed_eth_dcbnl_ops *dcb;
265 #endif
266         const struct qed_eth_ptp_ops *ptp;
267 
268         int (*fill_dev_info)(struct qed_dev *cdev,
269                              struct qed_dev_eth_info *info);
270 
271         void (*register_ops)(struct qed_dev *cdev,
272                              struct qed_eth_cb_ops *ops,
273                              void *cookie);
274 
275          bool(*check_mac) (struct qed_dev *cdev, u8 *mac);
276 
277         int (*vport_start)(struct qed_dev *cdev,
278                            struct qed_start_vport_params *params);
279 
280         int (*vport_stop)(struct qed_dev *cdev,
281                           u8 vport_id);
282 
283         int (*vport_update)(struct qed_dev *cdev,
284                             struct qed_update_vport_params *params);
285 
286         int (*q_rx_start)(struct qed_dev *cdev,
287                           u8 rss_num,
288                           struct qed_queue_start_common_params *params,
289                           u16 bd_max_bytes,
290                           dma_addr_t bd_chain_phys_addr,
291                           dma_addr_t cqe_pbl_addr,
292                           u16 cqe_pbl_size,
293                           struct qed_rxq_start_ret_params *ret_params);
294 
295         int (*q_rx_stop)(struct qed_dev *cdev, u8 rss_id, void *handle);
296 
297         int (*q_tx_start)(struct qed_dev *cdev,
298                           u8 rss_num,
299                           struct qed_queue_start_common_params *params,
300                           dma_addr_t pbl_addr,
301                           u16 pbl_size,
302                           struct qed_txq_start_ret_params *ret_params);
303 
304         int (*q_tx_stop)(struct qed_dev *cdev, u8 rss_id, void *handle);
305 
306         int (*filter_config_rx_mode)(struct qed_dev *cdev,
307                                      enum qed_filter_rx_mode_type type);
308 
309         int (*filter_config_ucast)(struct qed_dev *cdev,
310                                    struct qed_filter_ucast_params *params);
311 
312         int (*filter_config_mcast)(struct qed_dev *cdev,
313                                    struct qed_filter_mcast_params *params);
314 
315         int (*fastpath_stop)(struct qed_dev *cdev);
316 
317         int (*eth_cqe_completion)(struct qed_dev *cdev,
318                                   u8 rss_id,
319                                   struct eth_slow_path_rx_cqe *cqe);
320 
321         void (*get_vport_stats)(struct qed_dev *cdev,
322                                 struct qed_eth_stats *stats);
323 
324         int (*tunn_config)(struct qed_dev *cdev,
325                            struct qed_tunn_params *params);
326 
327         int (*ntuple_filter_config)(struct qed_dev *cdev,
328                                     void *cookie,
329                                     struct qed_ntuple_filter_params *params);
330 
331         int (*configure_arfs_searcher)(struct qed_dev *cdev,
332                                        enum qed_filter_config_mode mode);
333         int (*get_coalesce)(struct qed_dev *cdev, u16 *coal, void *handle);
334         int (*req_bulletin_update_mac)(struct qed_dev *cdev, const u8 *mac);
335 };
336 
337 const struct qed_eth_ops *qed_get_eth_ops(void);
338 void qed_put_eth_ops(void);
339 
340 #endif
341 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php