blob: 67a7b41b70aaa2e6dc9ff1a849ab5c7416214a71 [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>
16
17struct 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 Chopracee4d262015-10-26 11:02:28 +020027struct qed_update_vport_rss_params {
28 u16 rss_ind_table[128];
29 u32 rss_key[10];
30};
31
32struct 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
40struct qed_stop_rxq_params {
41 u8 rss_id;
42 u8 rx_queue_id;
43 u8 vport_id;
44 bool eq_completion_only;
45};
46
47struct qed_stop_txq_params {
48 u8 rss_id;
49 u8 tx_queue_id;
50};
51
52enum 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
58enum 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
64struct 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
72struct qed_filter_mcast_params {
73 enum qed_filter_xcast_params_type type;
74 u8 num;
75 unsigned char mac[64][ETH_ALEN];
76};
77
78union 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
84enum 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
91struct qed_filter_params {
92 enum qed_filter_type type;
93 union qed_filter_type_params filter;
94};
95
96struct 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
104struct qed_eth_cb_ops {
105 struct qed_common_cb_ops common;
106};
107
Yuval Mintz25c089d2015-10-26 11:02:26 +0200108struct 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
Manish Chopracee4d262015-10-26 11:02:28 +0200114 int (*vport_start)(struct qed_dev *cdev,
115 u8 vport_id, u16 mtu,
116 u8 drop_ttl0_flg,
117 u8 inner_vlan_removal_en_flg);
118
119 int (*vport_stop)(struct qed_dev *cdev,
120 u8 vport_id);
121
122 int (*vport_update)(struct qed_dev *cdev,
123 struct qed_update_vport_params *params);
124
125 int (*q_rx_start)(struct qed_dev *cdev,
126 struct qed_queue_start_common_params *params,
127 u16 bd_max_bytes,
128 dma_addr_t bd_chain_phys_addr,
129 dma_addr_t cqe_pbl_addr,
130 u16 cqe_pbl_size,
131 void __iomem **pp_prod);
132
133 int (*q_rx_stop)(struct qed_dev *cdev,
134 struct qed_stop_rxq_params *params);
135
136 int (*q_tx_start)(struct qed_dev *cdev,
137 struct qed_queue_start_common_params *params,
138 dma_addr_t pbl_addr,
139 u16 pbl_size,
140 void __iomem **pp_doorbell);
141
142 int (*q_tx_stop)(struct qed_dev *cdev,
143 struct qed_stop_txq_params *params);
144
145 int (*filter_config)(struct qed_dev *cdev,
146 struct qed_filter_params *params);
147
148 int (*fastpath_stop)(struct qed_dev *cdev);
149
150 int (*eth_cqe_completion)(struct qed_dev *cdev,
151 u8 rss_id,
152 struct eth_slow_path_rx_cqe *cqe);
Yuval Mintz25c089d2015-10-26 11:02:26 +0200153};
154
155const struct qed_eth_ops *qed_get_eth_ops(u32 version);
156void qed_put_eth_ops(void);
157
158#endif