Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 1 | /* QLogic qed NIC Driver |
| 2 | * Copyright (c) 2015 QLogic Corporation |
| 3 | * |
| 4 | * This software is available under the terms of the GNU General Public License |
| 5 | * (GPL) Version 2, available from the file COPYING in the main directory of |
| 6 | * this source tree. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _QED_ETH_IF_H |
| 10 | #define _QED_ETH_IF_H |
| 11 | |
| 12 | #include <linux/list.h> |
| 13 | #include <linux/if_link.h> |
| 14 | #include <linux/qed/eth_common.h> |
| 15 | #include <linux/qed/qed_if.h> |
| 16 | |
| 17 | struct qed_dev_eth_info { |
| 18 | struct qed_dev_info common; |
| 19 | |
| 20 | u8 num_queues; |
| 21 | u8 num_tc; |
| 22 | |
| 23 | u8 port_mac[ETH_ALEN]; |
| 24 | u8 num_vlan_filters; |
| 25 | }; |
| 26 | |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 27 | struct qed_update_vport_rss_params { |
| 28 | u16 rss_ind_table[128]; |
| 29 | u32 rss_key[10]; |
| 30 | }; |
| 31 | |
| 32 | struct qed_update_vport_params { |
| 33 | u8 vport_id; |
| 34 | u8 update_vport_active_flg; |
| 35 | u8 vport_active_flg; |
| 36 | u8 update_rss_flg; |
| 37 | struct qed_update_vport_rss_params rss_params; |
| 38 | }; |
| 39 | |
| 40 | struct qed_stop_rxq_params { |
| 41 | u8 rss_id; |
| 42 | u8 rx_queue_id; |
| 43 | u8 vport_id; |
| 44 | bool eq_completion_only; |
| 45 | }; |
| 46 | |
| 47 | struct qed_stop_txq_params { |
| 48 | u8 rss_id; |
| 49 | u8 tx_queue_id; |
| 50 | }; |
| 51 | |
| 52 | enum qed_filter_rx_mode_type { |
| 53 | QED_FILTER_RX_MODE_TYPE_REGULAR, |
| 54 | QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC, |
| 55 | QED_FILTER_RX_MODE_TYPE_PROMISC, |
| 56 | }; |
| 57 | |
| 58 | enum qed_filter_xcast_params_type { |
| 59 | QED_FILTER_XCAST_TYPE_ADD, |
| 60 | QED_FILTER_XCAST_TYPE_DEL, |
| 61 | QED_FILTER_XCAST_TYPE_REPLACE, |
| 62 | }; |
| 63 | |
| 64 | struct qed_filter_ucast_params { |
| 65 | enum qed_filter_xcast_params_type type; |
| 66 | u8 vlan_valid; |
| 67 | u16 vlan; |
| 68 | u8 mac_valid; |
| 69 | unsigned char mac[ETH_ALEN]; |
| 70 | }; |
| 71 | |
| 72 | struct qed_filter_mcast_params { |
| 73 | enum qed_filter_xcast_params_type type; |
| 74 | u8 num; |
| 75 | unsigned char mac[64][ETH_ALEN]; |
| 76 | }; |
| 77 | |
| 78 | union qed_filter_type_params { |
| 79 | enum qed_filter_rx_mode_type accept_flags; |
| 80 | struct qed_filter_ucast_params ucast; |
| 81 | struct qed_filter_mcast_params mcast; |
| 82 | }; |
| 83 | |
| 84 | enum qed_filter_type { |
| 85 | QED_FILTER_TYPE_UCAST, |
| 86 | QED_FILTER_TYPE_MCAST, |
| 87 | QED_FILTER_TYPE_RX_MODE, |
| 88 | QED_MAX_FILTER_TYPES, |
| 89 | }; |
| 90 | |
| 91 | struct qed_filter_params { |
| 92 | enum qed_filter_type type; |
| 93 | union qed_filter_type_params filter; |
| 94 | }; |
| 95 | |
| 96 | struct qed_queue_start_common_params { |
| 97 | u8 rss_id; |
| 98 | u8 queue_id; |
| 99 | u8 vport_id; |
| 100 | u16 sb; |
| 101 | u16 sb_idx; |
| 102 | }; |
| 103 | |
| 104 | struct qed_eth_cb_ops { |
| 105 | struct qed_common_cb_ops common; |
| 106 | }; |
| 107 | |
Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 108 | struct qed_eth_ops { |
| 109 | const struct qed_common_ops *common; |
| 110 | |
| 111 | int (*fill_dev_info)(struct qed_dev *cdev, |
| 112 | struct qed_dev_eth_info *info); |
| 113 | |
Yuval Mintz | cc875c2 | 2015-10-26 11:02:31 +0200 | [diff] [blame] | 114 | void (*register_ops)(struct qed_dev *cdev, |
| 115 | struct qed_eth_cb_ops *ops, |
| 116 | void *cookie); |
| 117 | |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 118 | int (*vport_start)(struct qed_dev *cdev, |
| 119 | u8 vport_id, u16 mtu, |
| 120 | u8 drop_ttl0_flg, |
| 121 | u8 inner_vlan_removal_en_flg); |
| 122 | |
| 123 | int (*vport_stop)(struct qed_dev *cdev, |
| 124 | u8 vport_id); |
| 125 | |
| 126 | int (*vport_update)(struct qed_dev *cdev, |
| 127 | struct qed_update_vport_params *params); |
| 128 | |
| 129 | int (*q_rx_start)(struct qed_dev *cdev, |
| 130 | struct qed_queue_start_common_params *params, |
| 131 | u16 bd_max_bytes, |
| 132 | dma_addr_t bd_chain_phys_addr, |
| 133 | dma_addr_t cqe_pbl_addr, |
| 134 | u16 cqe_pbl_size, |
| 135 | void __iomem **pp_prod); |
| 136 | |
| 137 | int (*q_rx_stop)(struct qed_dev *cdev, |
| 138 | struct qed_stop_rxq_params *params); |
| 139 | |
| 140 | int (*q_tx_start)(struct qed_dev *cdev, |
| 141 | struct qed_queue_start_common_params *params, |
| 142 | dma_addr_t pbl_addr, |
| 143 | u16 pbl_size, |
| 144 | void __iomem **pp_doorbell); |
| 145 | |
| 146 | int (*q_tx_stop)(struct qed_dev *cdev, |
| 147 | struct qed_stop_txq_params *params); |
| 148 | |
| 149 | int (*filter_config)(struct qed_dev *cdev, |
| 150 | struct qed_filter_params *params); |
| 151 | |
| 152 | int (*fastpath_stop)(struct qed_dev *cdev); |
| 153 | |
| 154 | int (*eth_cqe_completion)(struct qed_dev *cdev, |
| 155 | u8 rss_id, |
| 156 | struct eth_slow_path_rx_cqe *cqe); |
Manish Chopra | 9df2ed0 | 2015-10-26 11:02:33 +0200 | [diff] [blame^] | 157 | |
| 158 | void (*get_vport_stats)(struct qed_dev *cdev, |
| 159 | struct qed_eth_stats *stats); |
Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | const struct qed_eth_ops *qed_get_eth_ops(u32 version); |
| 163 | void qed_put_eth_ops(void); |
| 164 | |
| 165 | #endif |