Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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