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> | |
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 | ||
cee4d264 MC |
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; | |
3f9b4a69 YM |
36 | u8 update_accept_any_vlan_flg; |
37 | u8 accept_any_vlan; | |
cee4d264 MC |
38 | u8 update_rss_flg; |
39 | struct qed_update_vport_rss_params rss_params; | |
40 | }; | |
41 | ||
088c8618 MC |
42 | struct qed_start_vport_params { |
43 | bool remove_inner_vlan; | |
44 | bool gro_enable; | |
45 | bool drop_ttl0; | |
46 | u8 vport_id; | |
47 | u16 mtu; | |
48 | }; | |
49 | ||
cee4d264 MC |
50 | struct qed_stop_rxq_params { |
51 | u8 rss_id; | |
52 | u8 rx_queue_id; | |
53 | u8 vport_id; | |
54 | bool eq_completion_only; | |
55 | }; | |
56 | ||
57 | struct qed_stop_txq_params { | |
58 | u8 rss_id; | |
59 | u8 tx_queue_id; | |
60 | }; | |
61 | ||
62 | enum qed_filter_rx_mode_type { | |
63 | QED_FILTER_RX_MODE_TYPE_REGULAR, | |
64 | QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC, | |
65 | QED_FILTER_RX_MODE_TYPE_PROMISC, | |
66 | }; | |
67 | ||
68 | enum qed_filter_xcast_params_type { | |
69 | QED_FILTER_XCAST_TYPE_ADD, | |
70 | QED_FILTER_XCAST_TYPE_DEL, | |
71 | QED_FILTER_XCAST_TYPE_REPLACE, | |
72 | }; | |
73 | ||
74 | struct qed_filter_ucast_params { | |
75 | enum qed_filter_xcast_params_type type; | |
76 | u8 vlan_valid; | |
77 | u16 vlan; | |
78 | u8 mac_valid; | |
79 | unsigned char mac[ETH_ALEN]; | |
80 | }; | |
81 | ||
82 | struct qed_filter_mcast_params { | |
83 | enum qed_filter_xcast_params_type type; | |
84 | u8 num; | |
85 | unsigned char mac[64][ETH_ALEN]; | |
86 | }; | |
87 | ||
88 | union qed_filter_type_params { | |
89 | enum qed_filter_rx_mode_type accept_flags; | |
90 | struct qed_filter_ucast_params ucast; | |
91 | struct qed_filter_mcast_params mcast; | |
92 | }; | |
93 | ||
94 | enum qed_filter_type { | |
95 | QED_FILTER_TYPE_UCAST, | |
96 | QED_FILTER_TYPE_MCAST, | |
97 | QED_FILTER_TYPE_RX_MODE, | |
98 | QED_MAX_FILTER_TYPES, | |
99 | }; | |
100 | ||
101 | struct qed_filter_params { | |
102 | enum qed_filter_type type; | |
103 | union qed_filter_type_params filter; | |
104 | }; | |
105 | ||
106 | struct qed_queue_start_common_params { | |
107 | u8 rss_id; | |
108 | u8 queue_id; | |
109 | u8 vport_id; | |
110 | u16 sb; | |
111 | u16 sb_idx; | |
112 | }; | |
113 | ||
114 | struct qed_eth_cb_ops { | |
115 | struct qed_common_cb_ops common; | |
116 | }; | |
117 | ||
25c089d7 YM |
118 | struct qed_eth_ops { |
119 | const struct qed_common_ops *common; | |
120 | ||
121 | int (*fill_dev_info)(struct qed_dev *cdev, | |
122 | struct qed_dev_eth_info *info); | |
123 | ||
cc875c2e YM |
124 | void (*register_ops)(struct qed_dev *cdev, |
125 | struct qed_eth_cb_ops *ops, | |
126 | void *cookie); | |
127 | ||
cee4d264 | 128 | int (*vport_start)(struct qed_dev *cdev, |
088c8618 | 129 | struct qed_start_vport_params *params); |
cee4d264 MC |
130 | |
131 | int (*vport_stop)(struct qed_dev *cdev, | |
132 | u8 vport_id); | |
133 | ||
134 | int (*vport_update)(struct qed_dev *cdev, | |
135 | struct qed_update_vport_params *params); | |
136 | ||
137 | int (*q_rx_start)(struct qed_dev *cdev, | |
138 | struct qed_queue_start_common_params *params, | |
139 | u16 bd_max_bytes, | |
140 | dma_addr_t bd_chain_phys_addr, | |
141 | dma_addr_t cqe_pbl_addr, | |
142 | u16 cqe_pbl_size, | |
143 | void __iomem **pp_prod); | |
144 | ||
145 | int (*q_rx_stop)(struct qed_dev *cdev, | |
146 | struct qed_stop_rxq_params *params); | |
147 | ||
148 | int (*q_tx_start)(struct qed_dev *cdev, | |
149 | struct qed_queue_start_common_params *params, | |
150 | dma_addr_t pbl_addr, | |
151 | u16 pbl_size, | |
152 | void __iomem **pp_doorbell); | |
153 | ||
154 | int (*q_tx_stop)(struct qed_dev *cdev, | |
155 | struct qed_stop_txq_params *params); | |
156 | ||
157 | int (*filter_config)(struct qed_dev *cdev, | |
158 | struct qed_filter_params *params); | |
159 | ||
160 | int (*fastpath_stop)(struct qed_dev *cdev); | |
161 | ||
162 | int (*eth_cqe_completion)(struct qed_dev *cdev, | |
163 | u8 rss_id, | |
164 | struct eth_slow_path_rx_cqe *cqe); | |
9df2ed04 MC |
165 | |
166 | void (*get_vport_stats)(struct qed_dev *cdev, | |
167 | struct qed_eth_stats *stats); | |
25c089d7 YM |
168 | }; |
169 | ||
170 | const struct qed_eth_ops *qed_get_eth_ops(u32 version); | |
171 | void qed_put_eth_ops(void); | |
172 | ||
173 | #endif |