net/bnx2x: get cache line size from build configuration
[dpdk.git] / drivers / net / qede / qede_eth_if.h
1 /*
2  * Copyright (c) 2016 QLogic Corporation.
3  * All rights reserved.
4  * www.qlogic.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8
9 #ifndef _QEDE_ETH_IF_H
10 #define _QEDE_ETH_IF_H
11
12 #include "qede_if.h"
13
14 /*forward decl */
15 struct eth_slow_path_rx_cqe;
16
17 #define INIT_STRUCT_FIELD(field, value) .field = value
18
19 #define QED_ETH_INTERFACE_VERSION       609
20
21 #define QEDE_MAX_MCAST_FILTERS          64
22
23 enum qed_filter_rx_mode_type {
24         QED_FILTER_RX_MODE_TYPE_REGULAR,
25         QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC,
26         QED_FILTER_RX_MODE_TYPE_PROMISC,
27 };
28
29 enum qed_filter_xcast_params_type {
30         QED_FILTER_XCAST_TYPE_ADD,
31         QED_FILTER_XCAST_TYPE_DEL,
32         QED_FILTER_XCAST_TYPE_REPLACE,
33 };
34
35 enum qed_filter_type {
36         QED_FILTER_TYPE_UCAST,
37         QED_FILTER_TYPE_MCAST,
38         QED_FILTER_TYPE_RX_MODE,
39         QED_MAX_FILTER_TYPES,
40 };
41
42 struct qed_dev_eth_info {
43         struct qed_dev_info common;
44
45         uint8_t num_queues;
46         uint8_t num_tc;
47
48         struct ether_addr port_mac;
49         uint8_t num_vlan_filters;
50         uint32_t num_mac_addrs;
51 };
52
53 struct qed_update_vport_rss_params {
54         uint16_t rss_ind_table[128];
55         uint32_t rss_key[10];
56         u8 rss_caps;
57 };
58
59 struct qed_stop_rxq_params {
60         uint8_t rss_id;
61         uint8_t rx_queue_id;
62         uint8_t vport_id;
63         bool eq_completion_only;
64 };
65
66 struct qed_update_vport_params {
67         uint8_t vport_id;
68         uint8_t update_vport_active_flg;
69         uint8_t vport_active_flg;
70         uint8_t update_inner_vlan_removal_flg;
71         uint8_t inner_vlan_removal_flg;
72         uint8_t update_tx_switching_flg;
73         uint8_t tx_switching_flg;
74         uint8_t update_accept_any_vlan_flg;
75         uint8_t accept_any_vlan;
76         uint8_t update_rss_flg;
77         struct qed_update_vport_rss_params rss_params;
78 };
79
80 struct qed_start_vport_params {
81         bool remove_inner_vlan;
82         bool handle_ptp_pkts;
83         bool gro_enable;
84         bool drop_ttl0;
85         uint8_t vport_id;
86         uint16_t mtu;
87         bool clear_stats;
88 };
89
90 struct qed_stop_txq_params {
91         uint8_t rss_id;
92         uint8_t tx_queue_id;
93 };
94
95 struct qed_filter_ucast_params {
96         enum qed_filter_xcast_params_type type;
97         uint8_t vlan_valid;
98         uint16_t vlan;
99         uint8_t mac_valid;
100         unsigned char mac[ETHER_ADDR_LEN];
101 };
102
103 struct qed_filter_mcast_params {
104         enum qed_filter_xcast_params_type type;
105         uint8_t num;
106         unsigned char mac[QEDE_MAX_MCAST_FILTERS][ETHER_ADDR_LEN];
107 };
108
109 union qed_filter_type_params {
110         enum qed_filter_rx_mode_type accept_flags;
111         struct qed_filter_ucast_params ucast;
112         struct qed_filter_mcast_params mcast;
113 };
114
115 struct qed_filter_params {
116         enum qed_filter_type type;
117         union qed_filter_type_params filter;
118 };
119
120 struct qed_eth_ops {
121         const struct qed_common_ops *common;
122
123         int (*fill_dev_info)(struct ecore_dev *edev,
124                              struct qed_dev_eth_info *info);
125
126         int (*vport_start)(struct ecore_dev *edev,
127                            struct qed_start_vport_params *params);
128
129         int (*vport_stop)(struct ecore_dev *edev, uint8_t vport_id);
130
131         int (*vport_update)(struct ecore_dev *edev,
132                             struct qed_update_vport_params *params);
133
134         int (*q_rx_start)(struct ecore_dev *cdev,
135                           uint8_t rss_id, uint8_t rx_queue_id,
136                           uint8_t vport_id, uint16_t sb,
137                           uint8_t sb_index, uint16_t bd_max_bytes,
138                           dma_addr_t bd_chain_phys_addr,
139                           dma_addr_t cqe_pbl_addr,
140                           uint16_t cqe_pbl_size, void OSAL_IOMEM * *pp_prod);
141
142         int (*q_rx_stop)(struct ecore_dev *edev,
143                          struct qed_stop_rxq_params *params);
144
145         int (*q_tx_start)(struct ecore_dev *edev,
146                           uint8_t rss_id, uint16_t tx_queue_id,
147                           uint8_t vport_id, uint16_t sb,
148                           uint8_t sb_index,
149                           dma_addr_t pbl_addr,
150                           uint16_t pbl_size, void OSAL_IOMEM * *pp_doorbell);
151
152         int (*q_tx_stop)(struct ecore_dev *edev,
153                          struct qed_stop_txq_params *params);
154
155         int (*eth_cqe_completion)(struct ecore_dev *edev,
156                                   uint8_t rss_id,
157                                   struct eth_slow_path_rx_cqe *cqe);
158
159         int (*fastpath_stop)(struct ecore_dev *edev);
160
161         void (*get_vport_stats)(struct ecore_dev *edev,
162                                 struct ecore_eth_stats *stats);
163
164         int (*filter_config)(struct ecore_dev *edev,
165                              struct qed_filter_params *params);
166 };
167
168 /* externs */
169
170 extern const struct qed_common_ops qed_common_ops_pass;
171
172 const struct qed_eth_ops *qed_get_eth_ops();
173
174 int qed_configure_filter_rx_mode(struct ecore_dev *edev,
175                                  enum qed_filter_rx_mode_type type);
176
177 #endif /* _QEDE_ETH_IF_H */