0001
0002
0003
0004
0005
0006
0007 #ifndef _QED_ETH_IF_H
0008 #define _QED_ETH_IF_H
0009
0010 #include <linux/list.h>
0011 #include <linux/if_link.h>
0012 #include <linux/qed/eth_common.h>
0013 #include <linux/qed/qed_if.h>
0014 #include <linux/qed/qed_iov_if.h>
0015
0016
0017 #define QED_MIN_L2_CONS (2 + NUM_PHYS_TCS_4PORT_K2)
0018 #define QED_MAX_L2_CONS (64 * (QED_MIN_L2_CONS))
0019
0020 struct qed_queue_start_common_params {
0021
0022 u8 vport_id;
0023 u16 queue_id;
0024
0025
0026 u8 stats_id;
0027
0028 struct qed_sb_info *p_sb;
0029 u8 sb_idx;
0030
0031 u8 tc;
0032 };
0033
0034 struct qed_rxq_start_ret_params {
0035 void __iomem *p_prod;
0036 void *p_handle;
0037 };
0038
0039 struct qed_txq_start_ret_params {
0040 void __iomem *p_doorbell;
0041 void *p_handle;
0042 };
0043
0044 enum qed_filter_config_mode {
0045 QED_FILTER_CONFIG_MODE_DISABLE,
0046 QED_FILTER_CONFIG_MODE_5_TUPLE,
0047 QED_FILTER_CONFIG_MODE_L4_PORT,
0048 QED_FILTER_CONFIG_MODE_IP_DEST,
0049 QED_FILTER_CONFIG_MODE_IP_SRC,
0050 };
0051
0052 struct qed_ntuple_filter_params {
0053
0054
0055
0056 dma_addr_t addr;
0057
0058
0059 u16 length;
0060
0061
0062 #define QED_RFS_NTUPLE_QID_RSS ((u16)-1)
0063 u16 qid;
0064
0065
0066 bool b_is_vf;
0067 u8 vport_id;
0068 u8 vf_id;
0069
0070
0071 bool b_is_add;
0072
0073
0074 bool b_is_drop;
0075 };
0076
0077 struct qed_dev_eth_info {
0078 struct qed_dev_info common;
0079
0080 u8 num_queues;
0081 u8 num_tc;
0082
0083 u8 port_mac[ETH_ALEN];
0084 u16 num_vlan_filters;
0085 u16 num_mac_filters;
0086
0087
0088 bool is_legacy;
0089
0090
0091 bool xdp_supported;
0092 };
0093
0094 struct qed_update_vport_rss_params {
0095 void *rss_ind_table[128];
0096 u32 rss_key[10];
0097 u8 rss_caps;
0098 };
0099
0100 struct qed_update_vport_params {
0101 u8 vport_id;
0102 u8 update_vport_active_flg;
0103 u8 vport_active_flg;
0104 u8 update_tx_switching_flg;
0105 u8 tx_switching_flg;
0106 u8 update_accept_any_vlan_flg;
0107 u8 accept_any_vlan;
0108 u8 update_rss_flg;
0109 struct qed_update_vport_rss_params rss_params;
0110 };
0111
0112 struct qed_start_vport_params {
0113 bool remove_inner_vlan;
0114 bool handle_ptp_pkts;
0115 bool gro_enable;
0116 bool drop_ttl0;
0117 u8 vport_id;
0118 u16 mtu;
0119 bool clear_stats;
0120 };
0121
0122 enum qed_filter_rx_mode_type {
0123 QED_FILTER_RX_MODE_TYPE_REGULAR,
0124 QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC,
0125 QED_FILTER_RX_MODE_TYPE_PROMISC,
0126 };
0127
0128 enum qed_filter_xcast_params_type {
0129 QED_FILTER_XCAST_TYPE_ADD,
0130 QED_FILTER_XCAST_TYPE_DEL,
0131 QED_FILTER_XCAST_TYPE_REPLACE,
0132 };
0133
0134 struct qed_filter_ucast_params {
0135 enum qed_filter_xcast_params_type type;
0136 u8 vlan_valid;
0137 u16 vlan;
0138 u8 mac_valid;
0139 unsigned char mac[ETH_ALEN];
0140 };
0141
0142 struct qed_filter_mcast_params {
0143 enum qed_filter_xcast_params_type type;
0144 u8 num;
0145 unsigned char mac[64][ETH_ALEN];
0146 };
0147
0148 enum qed_filter_type {
0149 QED_FILTER_TYPE_UCAST,
0150 QED_FILTER_TYPE_MCAST,
0151 QED_FILTER_TYPE_RX_MODE,
0152 QED_MAX_FILTER_TYPES,
0153 };
0154
0155 struct qed_tunn_params {
0156 u16 vxlan_port;
0157 u8 update_vxlan_port;
0158 u16 geneve_port;
0159 u8 update_geneve_port;
0160 };
0161
0162 struct qed_eth_cb_ops {
0163 struct qed_common_cb_ops common;
0164 void (*force_mac) (void *dev, u8 *mac, bool forced);
0165 void (*ports_update)(void *dev, u16 vxlan_port, u16 geneve_port);
0166 };
0167
0168 #define QED_MAX_PHC_DRIFT_PPB 291666666
0169
0170 enum qed_ptp_filter_type {
0171 QED_PTP_FILTER_NONE,
0172 QED_PTP_FILTER_ALL,
0173 QED_PTP_FILTER_V1_L4_EVENT,
0174 QED_PTP_FILTER_V1_L4_GEN,
0175 QED_PTP_FILTER_V2_L4_EVENT,
0176 QED_PTP_FILTER_V2_L4_GEN,
0177 QED_PTP_FILTER_V2_L2_EVENT,
0178 QED_PTP_FILTER_V2_L2_GEN,
0179 QED_PTP_FILTER_V2_EVENT,
0180 QED_PTP_FILTER_V2_GEN
0181 };
0182
0183 enum qed_ptp_hwtstamp_tx_type {
0184 QED_PTP_HWTSTAMP_TX_OFF,
0185 QED_PTP_HWTSTAMP_TX_ON,
0186 };
0187
0188 #ifdef CONFIG_DCB
0189
0190
0191
0192 struct qed_eth_dcbnl_ops {
0193
0194 int (*ieee_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
0195 int (*ieee_setpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
0196 int (*ieee_getets)(struct qed_dev *cdev, struct ieee_ets *ets);
0197 int (*ieee_setets)(struct qed_dev *cdev, struct ieee_ets *ets);
0198 int (*ieee_peer_getets)(struct qed_dev *cdev, struct ieee_ets *ets);
0199 int (*ieee_peer_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
0200 int (*ieee_getapp)(struct qed_dev *cdev, struct dcb_app *app);
0201 int (*ieee_setapp)(struct qed_dev *cdev, struct dcb_app *app);
0202
0203
0204 u8 (*getstate)(struct qed_dev *cdev);
0205 u8 (*setstate)(struct qed_dev *cdev, u8 state);
0206 void (*getpgtccfgtx)(struct qed_dev *cdev, int prio, u8 *prio_type,
0207 u8 *pgid, u8 *bw_pct, u8 *up_map);
0208 void (*getpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 *bw_pct);
0209 void (*getpgtccfgrx)(struct qed_dev *cdev, int prio, u8 *prio_type,
0210 u8 *pgid, u8 *bw_pct, u8 *up_map);
0211 void (*getpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 *bw_pct);
0212 void (*getpfccfg)(struct qed_dev *cdev, int prio, u8 *setting);
0213 void (*setpfccfg)(struct qed_dev *cdev, int prio, u8 setting);
0214 u8 (*getcap)(struct qed_dev *cdev, int capid, u8 *cap);
0215 int (*getnumtcs)(struct qed_dev *cdev, int tcid, u8 *num);
0216 u8 (*getpfcstate)(struct qed_dev *cdev);
0217 int (*getapp)(struct qed_dev *cdev, u8 idtype, u16 id);
0218 u8 (*getfeatcfg)(struct qed_dev *cdev, int featid, u8 *flags);
0219
0220
0221 u8 (*getdcbx)(struct qed_dev *cdev);
0222 void (*setpgtccfgtx)(struct qed_dev *cdev, int prio,
0223 u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map);
0224 void (*setpgtccfgrx)(struct qed_dev *cdev, int prio,
0225 u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map);
0226 void (*setpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 bw_pct);
0227 void (*setpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 bw_pct);
0228 u8 (*setall)(struct qed_dev *cdev);
0229 int (*setnumtcs)(struct qed_dev *cdev, int tcid, u8 num);
0230 void (*setpfcstate)(struct qed_dev *cdev, u8 state);
0231 int (*setapp)(struct qed_dev *cdev, u8 idtype, u16 idval, u8 up);
0232 u8 (*setdcbx)(struct qed_dev *cdev, u8 state);
0233 u8 (*setfeatcfg)(struct qed_dev *cdev, int featid, u8 flags);
0234
0235
0236 int (*peer_getappinfo)(struct qed_dev *cdev,
0237 struct dcb_peer_app_info *info,
0238 u16 *app_count);
0239 int (*peer_getapptable)(struct qed_dev *cdev, struct dcb_app *table);
0240
0241
0242 int (*cee_peer_getpfc)(struct qed_dev *cdev, struct cee_pfc *pfc);
0243 int (*cee_peer_getpg)(struct qed_dev *cdev, struct cee_pg *pg);
0244 };
0245 #endif
0246
0247 struct qed_eth_ptp_ops {
0248 int (*cfg_filters)(struct qed_dev *, enum qed_ptp_filter_type,
0249 enum qed_ptp_hwtstamp_tx_type);
0250 int (*read_rx_ts)(struct qed_dev *, u64 *);
0251 int (*read_tx_ts)(struct qed_dev *, u64 *);
0252 int (*read_cc)(struct qed_dev *, u64 *);
0253 int (*disable)(struct qed_dev *);
0254 int (*adjfreq)(struct qed_dev *, s32);
0255 int (*enable)(struct qed_dev *);
0256 };
0257
0258 struct qed_eth_ops {
0259 const struct qed_common_ops *common;
0260 #ifdef CONFIG_QED_SRIOV
0261 const struct qed_iov_hv_ops *iov;
0262 #endif
0263 #ifdef CONFIG_DCB
0264 const struct qed_eth_dcbnl_ops *dcb;
0265 #endif
0266 const struct qed_eth_ptp_ops *ptp;
0267
0268 int (*fill_dev_info)(struct qed_dev *cdev,
0269 struct qed_dev_eth_info *info);
0270
0271 void (*register_ops)(struct qed_dev *cdev,
0272 struct qed_eth_cb_ops *ops,
0273 void *cookie);
0274
0275 bool(*check_mac) (struct qed_dev *cdev, u8 *mac);
0276
0277 int (*vport_start)(struct qed_dev *cdev,
0278 struct qed_start_vport_params *params);
0279
0280 int (*vport_stop)(struct qed_dev *cdev,
0281 u8 vport_id);
0282
0283 int (*vport_update)(struct qed_dev *cdev,
0284 struct qed_update_vport_params *params);
0285
0286 int (*q_rx_start)(struct qed_dev *cdev,
0287 u8 rss_num,
0288 struct qed_queue_start_common_params *params,
0289 u16 bd_max_bytes,
0290 dma_addr_t bd_chain_phys_addr,
0291 dma_addr_t cqe_pbl_addr,
0292 u16 cqe_pbl_size,
0293 struct qed_rxq_start_ret_params *ret_params);
0294
0295 int (*q_rx_stop)(struct qed_dev *cdev, u8 rss_id, void *handle);
0296
0297 int (*q_tx_start)(struct qed_dev *cdev,
0298 u8 rss_num,
0299 struct qed_queue_start_common_params *params,
0300 dma_addr_t pbl_addr,
0301 u16 pbl_size,
0302 struct qed_txq_start_ret_params *ret_params);
0303
0304 int (*q_tx_stop)(struct qed_dev *cdev, u8 rss_id, void *handle);
0305
0306 int (*filter_config_rx_mode)(struct qed_dev *cdev,
0307 enum qed_filter_rx_mode_type type);
0308
0309 int (*filter_config_ucast)(struct qed_dev *cdev,
0310 struct qed_filter_ucast_params *params);
0311
0312 int (*filter_config_mcast)(struct qed_dev *cdev,
0313 struct qed_filter_mcast_params *params);
0314
0315 int (*fastpath_stop)(struct qed_dev *cdev);
0316
0317 int (*eth_cqe_completion)(struct qed_dev *cdev,
0318 u8 rss_id,
0319 struct eth_slow_path_rx_cqe *cqe);
0320
0321 void (*get_vport_stats)(struct qed_dev *cdev,
0322 struct qed_eth_stats *stats);
0323
0324 int (*tunn_config)(struct qed_dev *cdev,
0325 struct qed_tunn_params *params);
0326
0327 int (*ntuple_filter_config)(struct qed_dev *cdev,
0328 void *cookie,
0329 struct qed_ntuple_filter_params *params);
0330
0331 int (*configure_arfs_searcher)(struct qed_dev *cdev,
0332 enum qed_filter_config_mode mode);
0333 int (*get_coalesce)(struct qed_dev *cdev, u16 *coal, void *handle);
0334 int (*req_bulletin_update_mac)(struct qed_dev *cdev, const u8 *mac);
0335 };
0336
0337 const struct qed_eth_ops *qed_get_eth_ops(void);
0338 void qed_put_eth_ops(void);
0339
0340 #endif