blob: e0f6e6482031e366c8f4f096dd52e3af93d20dd1 [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 Mintz3f9b4a62016-02-18 17:00:39 +020038 u8 update_accept_any_vlan_flg;
39 u8 accept_any_vlan;
Manish Chopracee4d262015-10-26 11:02:28 +020040 u8 update_rss_flg;
41 struct qed_update_vport_rss_params rss_params;
42};
43
Manish Chopra088c8612016-03-04 12:35:05 -050044struct 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
Manish Chopracee4d262015-10-26 11:02:28 +020052struct qed_stop_rxq_params {
53 u8 rss_id;
54 u8 rx_queue_id;
55 u8 vport_id;
56 bool eq_completion_only;
57};
58
59struct qed_stop_txq_params {
60 u8 rss_id;
61 u8 tx_queue_id;
62};
63
64enum 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
70enum 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
76struct 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
84struct qed_filter_mcast_params {
85 enum qed_filter_xcast_params_type type;
86 u8 num;
87 unsigned char mac[64][ETH_ALEN];
88};
89
90union 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
96enum 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
103struct qed_filter_params {
104 enum qed_filter_type type;
105 union qed_filter_type_params filter;
106};
107
108struct 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
Manish Chopra464f6642016-04-14 01:38:29 -0400116struct qed_tunn_params {
117 u16 vxlan_port;
118 u8 update_vxlan_port;
119 u16 geneve_port;
120 u8 update_geneve_port;
121};
122
Manish Chopracee4d262015-10-26 11:02:28 +0200123struct qed_eth_cb_ops {
124 struct qed_common_cb_ops common;
Yuval Mintzeff16962016-05-11 16:36:21 +0300125 void (*force_mac) (void *dev, u8 *mac);
Manish Chopracee4d262015-10-26 11:02:28 +0200126};
127
Yuval Mintz25c089d2015-10-26 11:02:26 +0200128struct qed_eth_ops {
129 const struct qed_common_ops *common;
Yuval Mintz0b55e272016-05-11 16:36:15 +0300130#ifdef CONFIG_QED_SRIOV
131 const struct qed_iov_hv_ops *iov;
132#endif
Yuval Mintz25c089d2015-10-26 11:02:26 +0200133
134 int (*fill_dev_info)(struct qed_dev *cdev,
135 struct qed_dev_eth_info *info);
136
Yuval Mintzcc875c22015-10-26 11:02:31 +0200137 void (*register_ops)(struct qed_dev *cdev,
138 struct qed_eth_cb_ops *ops,
139 void *cookie);
140
Yuval Mintzeff16962016-05-11 16:36:21 +0300141 bool(*check_mac) (struct qed_dev *cdev, u8 *mac);
142
Manish Chopracee4d262015-10-26 11:02:28 +0200143 int (*vport_start)(struct qed_dev *cdev,
Manish Chopra088c8612016-03-04 12:35:05 -0500144 struct qed_start_vport_params *params);
Manish Chopracee4d262015-10-26 11:02:28 +0200145
146 int (*vport_stop)(struct qed_dev *cdev,
147 u8 vport_id);
148
149 int (*vport_update)(struct qed_dev *cdev,
150 struct qed_update_vport_params *params);
151
152 int (*q_rx_start)(struct qed_dev *cdev,
153 struct qed_queue_start_common_params *params,
154 u16 bd_max_bytes,
155 dma_addr_t bd_chain_phys_addr,
156 dma_addr_t cqe_pbl_addr,
157 u16 cqe_pbl_size,
158 void __iomem **pp_prod);
159
160 int (*q_rx_stop)(struct qed_dev *cdev,
161 struct qed_stop_rxq_params *params);
162
163 int (*q_tx_start)(struct qed_dev *cdev,
164 struct qed_queue_start_common_params *params,
165 dma_addr_t pbl_addr,
166 u16 pbl_size,
167 void __iomem **pp_doorbell);
168
169 int (*q_tx_stop)(struct qed_dev *cdev,
170 struct qed_stop_txq_params *params);
171
172 int (*filter_config)(struct qed_dev *cdev,
173 struct qed_filter_params *params);
174
175 int (*fastpath_stop)(struct qed_dev *cdev);
176
177 int (*eth_cqe_completion)(struct qed_dev *cdev,
178 u8 rss_id,
179 struct eth_slow_path_rx_cqe *cqe);
Manish Chopra9df2ed02015-10-26 11:02:33 +0200180
181 void (*get_vport_stats)(struct qed_dev *cdev,
182 struct qed_eth_stats *stats);
Manish Chopra464f6642016-04-14 01:38:29 -0400183
184 int (*tunn_config)(struct qed_dev *cdev,
185 struct qed_tunn_params *params);
Yuval Mintz25c089d2015-10-26 11:02:26 +0200186};
187
Rahul Verma95114342016-04-10 12:42:59 +0300188const struct qed_eth_ops *qed_get_eth_ops(void);
Yuval Mintz25c089d2015-10-26 11:02:26 +0200189void qed_put_eth_ops(void);
190
191#endif