blob: 6ae8cb4a61d39969283a382076c8cf261a77bfa6 [file] [log] [blame]
Yuval Mintz25c089d2015-10-26 11:02:26 +02001/* 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>
Yuval Mintz0b55e272016-05-11 16:36:15 +030016#include <linux/qed/qed_iov_if.h>
Yuval Mintz25c089d2015-10-26 11:02:26 +020017
18struct 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
Manish Chopracee4d262015-10-26 11:02:28 +020028struct qed_update_vport_rss_params {
29 u16 rss_ind_table[128];
30 u32 rss_key[10];
Sudarsana Reddy Kalluru8c5ebd02016-04-10 12:43:00 +030031 u8 rss_caps;
Manish Chopracee4d262015-10-26 11:02:28 +020032};
33
34struct qed_update_vport_params {
35 u8 vport_id;
36 u8 update_vport_active_flg;
37 u8 vport_active_flg;
Yuval Mintz831bfb0e2016-05-11 16:36:25 +030038 u8 update_tx_switching_flg;
39 u8 tx_switching_flg;
Yuval Mintz3f9b4a62016-02-18 17:00:39 +020040 u8 update_accept_any_vlan_flg;
41 u8 accept_any_vlan;
Manish Chopracee4d262015-10-26 11:02:28 +020042 u8 update_rss_flg;
43 struct qed_update_vport_rss_params rss_params;
44};
45
Manish Chopra088c8612016-03-04 12:35:05 -050046struct qed_start_vport_params {
47 bool remove_inner_vlan;
48 bool gro_enable;
49 bool drop_ttl0;
50 u8 vport_id;
51 u16 mtu;
52};
53
Manish Chopracee4d262015-10-26 11:02:28 +020054struct qed_stop_rxq_params {
55 u8 rss_id;
56 u8 rx_queue_id;
57 u8 vport_id;
58 bool eq_completion_only;
59};
60
61struct qed_stop_txq_params {
62 u8 rss_id;
63 u8 tx_queue_id;
64};
65
66enum qed_filter_rx_mode_type {
67 QED_FILTER_RX_MODE_TYPE_REGULAR,
68 QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC,
69 QED_FILTER_RX_MODE_TYPE_PROMISC,
70};
71
72enum qed_filter_xcast_params_type {
73 QED_FILTER_XCAST_TYPE_ADD,
74 QED_FILTER_XCAST_TYPE_DEL,
75 QED_FILTER_XCAST_TYPE_REPLACE,
76};
77
78struct qed_filter_ucast_params {
79 enum qed_filter_xcast_params_type type;
80 u8 vlan_valid;
81 u16 vlan;
82 u8 mac_valid;
83 unsigned char mac[ETH_ALEN];
84};
85
86struct qed_filter_mcast_params {
87 enum qed_filter_xcast_params_type type;
88 u8 num;
89 unsigned char mac[64][ETH_ALEN];
90};
91
92union qed_filter_type_params {
93 enum qed_filter_rx_mode_type accept_flags;
94 struct qed_filter_ucast_params ucast;
95 struct qed_filter_mcast_params mcast;
96};
97
98enum qed_filter_type {
99 QED_FILTER_TYPE_UCAST,
100 QED_FILTER_TYPE_MCAST,
101 QED_FILTER_TYPE_RX_MODE,
102 QED_MAX_FILTER_TYPES,
103};
104
105struct qed_filter_params {
106 enum qed_filter_type type;
107 union qed_filter_type_params filter;
108};
109
110struct qed_queue_start_common_params {
111 u8 rss_id;
112 u8 queue_id;
113 u8 vport_id;
114 u16 sb;
115 u16 sb_idx;
116};
117
Manish Chopra464f6642016-04-14 01:38:29 -0400118struct qed_tunn_params {
119 u16 vxlan_port;
120 u8 update_vxlan_port;
121 u16 geneve_port;
122 u8 update_geneve_port;
123};
124
Manish Chopracee4d262015-10-26 11:02:28 +0200125struct qed_eth_cb_ops {
126 struct qed_common_cb_ops common;
Yuval Mintzeff16962016-05-11 16:36:21 +0300127 void (*force_mac) (void *dev, u8 *mac);
Manish Chopracee4d262015-10-26 11:02:28 +0200128};
129
Yuval Mintz25c089d2015-10-26 11:02:26 +0200130struct qed_eth_ops {
131 const struct qed_common_ops *common;
Yuval Mintz0b55e272016-05-11 16:36:15 +0300132#ifdef CONFIG_QED_SRIOV
133 const struct qed_iov_hv_ops *iov;
134#endif
Yuval Mintz25c089d2015-10-26 11:02:26 +0200135
136 int (*fill_dev_info)(struct qed_dev *cdev,
137 struct qed_dev_eth_info *info);
138
Yuval Mintzcc875c22015-10-26 11:02:31 +0200139 void (*register_ops)(struct qed_dev *cdev,
140 struct qed_eth_cb_ops *ops,
141 void *cookie);
142
Yuval Mintzeff16962016-05-11 16:36:21 +0300143 bool(*check_mac) (struct qed_dev *cdev, u8 *mac);
144
Manish Chopracee4d262015-10-26 11:02:28 +0200145 int (*vport_start)(struct qed_dev *cdev,
Manish Chopra088c8612016-03-04 12:35:05 -0500146 struct qed_start_vport_params *params);
Manish Chopracee4d262015-10-26 11:02:28 +0200147
148 int (*vport_stop)(struct qed_dev *cdev,
149 u8 vport_id);
150
151 int (*vport_update)(struct qed_dev *cdev,
152 struct qed_update_vport_params *params);
153
154 int (*q_rx_start)(struct qed_dev *cdev,
155 struct qed_queue_start_common_params *params,
156 u16 bd_max_bytes,
157 dma_addr_t bd_chain_phys_addr,
158 dma_addr_t cqe_pbl_addr,
159 u16 cqe_pbl_size,
160 void __iomem **pp_prod);
161
162 int (*q_rx_stop)(struct qed_dev *cdev,
163 struct qed_stop_rxq_params *params);
164
165 int (*q_tx_start)(struct qed_dev *cdev,
166 struct qed_queue_start_common_params *params,
167 dma_addr_t pbl_addr,
168 u16 pbl_size,
169 void __iomem **pp_doorbell);
170
171 int (*q_tx_stop)(struct qed_dev *cdev,
172 struct qed_stop_txq_params *params);
173
174 int (*filter_config)(struct qed_dev *cdev,
175 struct qed_filter_params *params);
176
177 int (*fastpath_stop)(struct qed_dev *cdev);
178
179 int (*eth_cqe_completion)(struct qed_dev *cdev,
180 u8 rss_id,
181 struct eth_slow_path_rx_cqe *cqe);
Manish Chopra9df2ed02015-10-26 11:02:33 +0200182
183 void (*get_vport_stats)(struct qed_dev *cdev,
184 struct qed_eth_stats *stats);
Manish Chopra464f6642016-04-14 01:38:29 -0400185
186 int (*tunn_config)(struct qed_dev *cdev,
187 struct qed_tunn_params *params);
Yuval Mintz25c089d2015-10-26 11:02:26 +0200188};
189
Rahul Verma95114342016-04-10 12:42:59 +0300190const struct qed_eth_ops *qed_get_eth_ops(void);
Yuval Mintz25c089d2015-10-26 11:02:26 +0200191void qed_put_eth_ops(void);
192
193#endif