Commit | Line | Data |
---|---|---|
25c089d7 YM |
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> | |
0b55e27d | 16 | #include <linux/qed/qed_iov_if.h> |
25c089d7 YM |
17 | |
18 | struct qed_dev_eth_info { | |
19 | struct qed_dev_info common; | |
20 | ||
21 | u8 num_queues; | |
22 | u8 num_tc; | |
23 | ||
24 | u8 port_mac[ETH_ALEN]; | |
25 | u8 num_vlan_filters; | |
26 | }; | |
27 | ||
cee4d264 MC |
28 | struct qed_update_vport_rss_params { |
29 | u16 rss_ind_table[128]; | |
30 | u32 rss_key[10]; | |
8c5ebd0c | 31 | u8 rss_caps; |
cee4d264 MC |
32 | }; |
33 | ||
34 | struct qed_update_vport_params { | |
35 | u8 vport_id; | |
36 | u8 update_vport_active_flg; | |
37 | u8 vport_active_flg; | |
3f9b4a69 YM |
38 | u8 update_accept_any_vlan_flg; |
39 | u8 accept_any_vlan; | |
cee4d264 MC |
40 | u8 update_rss_flg; |
41 | struct qed_update_vport_rss_params rss_params; | |
42 | }; | |
43 | ||
088c8618 MC |
44 | struct qed_start_vport_params { |
45 | bool remove_inner_vlan; | |
46 | bool gro_enable; | |
47 | bool drop_ttl0; | |
48 | u8 vport_id; | |
49 | u16 mtu; | |
50 | }; | |
51 | ||
cee4d264 MC |
52 | struct qed_stop_rxq_params { |
53 | u8 rss_id; | |
54 | u8 rx_queue_id; | |
55 | u8 vport_id; | |
56 | bool eq_completion_only; | |
57 | }; | |
58 | ||
59 | struct qed_stop_txq_params { | |
60 | u8 rss_id; | |
61 | u8 tx_queue_id; | |
62 | }; | |
63 | ||
64 | enum qed_filter_rx_mode_type { | |
65 | QED_FILTER_RX_MODE_TYPE_REGULAR, | |
66 | QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC, | |
67 | QED_FILTER_RX_MODE_TYPE_PROMISC, | |
68 | }; | |
69 | ||
70 | enum qed_filter_xcast_params_type { | |
71 | QED_FILTER_XCAST_TYPE_ADD, | |
72 | QED_FILTER_XCAST_TYPE_DEL, | |
73 | QED_FILTER_XCAST_TYPE_REPLACE, | |
74 | }; | |
75 | ||
76 | struct qed_filter_ucast_params { | |
77 | enum qed_filter_xcast_params_type type; | |
78 | u8 vlan_valid; | |
79 | u16 vlan; | |
80 | u8 mac_valid; | |
81 | unsigned char mac[ETH_ALEN]; | |
82 | }; | |
83 | ||
84 | struct qed_filter_mcast_params { | |
85 | enum qed_filter_xcast_params_type type; | |
86 | u8 num; | |
87 | unsigned char mac[64][ETH_ALEN]; | |
88 | }; | |
89 | ||
90 | union qed_filter_type_params { | |
91 | enum qed_filter_rx_mode_type accept_flags; | |
92 | struct qed_filter_ucast_params ucast; | |
93 | struct qed_filter_mcast_params mcast; | |
94 | }; | |
95 | ||
96 | enum qed_filter_type { | |
97 | QED_FILTER_TYPE_UCAST, | |
98 | QED_FILTER_TYPE_MCAST, | |
99 | QED_FILTER_TYPE_RX_MODE, | |
100 | QED_MAX_FILTER_TYPES, | |
101 | }; | |
102 | ||
103 | struct qed_filter_params { | |
104 | enum qed_filter_type type; | |
105 | union qed_filter_type_params filter; | |
106 | }; | |
107 | ||
108 | struct qed_queue_start_common_params { | |
109 | u8 rss_id; | |
110 | u8 queue_id; | |
111 | u8 vport_id; | |
112 | u16 sb; | |
113 | u16 sb_idx; | |
114 | }; | |
115 | ||
464f6645 MC |
116 | struct qed_tunn_params { |
117 | u16 vxlan_port; | |
118 | u8 update_vxlan_port; | |
119 | u16 geneve_port; | |
120 | u8 update_geneve_port; | |
121 | }; | |
122 | ||
cee4d264 MC |
123 | struct qed_eth_cb_ops { |
124 | struct qed_common_cb_ops common; | |
125 | }; | |
126 | ||
25c089d7 YM |
127 | struct qed_eth_ops { |
128 | const struct qed_common_ops *common; | |
0b55e27d YM |
129 | #ifdef CONFIG_QED_SRIOV |
130 | const struct qed_iov_hv_ops *iov; | |
131 | #endif | |
25c089d7 YM |
132 | |
133 | int (*fill_dev_info)(struct qed_dev *cdev, | |
134 | struct qed_dev_eth_info *info); | |
135 | ||
cc875c2e YM |
136 | void (*register_ops)(struct qed_dev *cdev, |
137 | struct qed_eth_cb_ops *ops, | |
138 | void *cookie); | |
139 | ||
cee4d264 | 140 | int (*vport_start)(struct qed_dev *cdev, |
088c8618 | 141 | struct qed_start_vport_params *params); |
cee4d264 MC |
142 | |
143 | int (*vport_stop)(struct qed_dev *cdev, | |
144 | u8 vport_id); | |
145 | ||
146 | int (*vport_update)(struct qed_dev *cdev, | |
147 | struct qed_update_vport_params *params); | |
148 | ||
149 | int (*q_rx_start)(struct qed_dev *cdev, | |
150 | struct qed_queue_start_common_params *params, | |
151 | u16 bd_max_bytes, | |
152 | dma_addr_t bd_chain_phys_addr, | |
153 | dma_addr_t cqe_pbl_addr, | |
154 | u16 cqe_pbl_size, | |
155 | void __iomem **pp_prod); | |
156 | ||
157 | int (*q_rx_stop)(struct qed_dev *cdev, | |
158 | struct qed_stop_rxq_params *params); | |
159 | ||
160 | int (*q_tx_start)(struct qed_dev *cdev, | |
161 | struct qed_queue_start_common_params *params, | |
162 | dma_addr_t pbl_addr, | |
163 | u16 pbl_size, | |
164 | void __iomem **pp_doorbell); | |
165 | ||
166 | int (*q_tx_stop)(struct qed_dev *cdev, | |
167 | struct qed_stop_txq_params *params); | |
168 | ||
169 | int (*filter_config)(struct qed_dev *cdev, | |
170 | struct qed_filter_params *params); | |
171 | ||
172 | int (*fastpath_stop)(struct qed_dev *cdev); | |
173 | ||
174 | int (*eth_cqe_completion)(struct qed_dev *cdev, | |
175 | u8 rss_id, | |
176 | struct eth_slow_path_rx_cqe *cqe); | |
9df2ed04 MC |
177 | |
178 | void (*get_vport_stats)(struct qed_dev *cdev, | |
179 | struct qed_eth_stats *stats); | |
464f6645 MC |
180 | |
181 | int (*tunn_config)(struct qed_dev *cdev, | |
182 | struct qed_tunn_params *params); | |
25c089d7 YM |
183 | }; |
184 | ||
95114344 | 185 | const struct qed_eth_ops *qed_get_eth_ops(void); |
25c089d7 YM |
186 | void qed_put_eth_ops(void); |
187 | ||
188 | #endif |