Imported Upstream version 16.11.1
[deb_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_type {
30         QED_FILTER_TYPE_UCAST,
31         QED_FILTER_TYPE_MCAST,
32         QED_FILTER_TYPE_RX_MODE,
33         QED_MAX_FILTER_TYPES,
34 };
35
36 struct qed_dev_eth_info {
37         struct qed_dev_info common;
38
39         uint8_t num_queues;
40         uint8_t num_tc;
41
42         struct ether_addr port_mac;
43         uint16_t num_vlan_filters;
44         uint32_t num_mac_addrs;
45 };
46
47 struct qed_update_vport_rss_params {
48         uint16_t rss_ind_table[128];
49         uint32_t rss_key[10];
50         u8 rss_caps;
51 };
52
53 struct qed_stop_rxq_params {
54         uint8_t rss_id;
55         uint8_t rx_queue_id;
56         uint8_t vport_id;
57         bool eq_completion_only;
58 };
59
60 struct qed_update_vport_params {
61         uint8_t vport_id;
62         uint8_t update_vport_active_flg;
63         uint8_t vport_active_flg;
64         uint8_t update_inner_vlan_removal_flg;
65         uint8_t inner_vlan_removal_flg;
66         uint8_t update_tx_switching_flg;
67         uint8_t tx_switching_flg;
68         uint8_t update_accept_any_vlan_flg;
69         uint8_t accept_any_vlan;
70         uint8_t update_rss_flg;
71         struct qed_update_vport_rss_params rss_params;
72         uint16_t mtu;
73 };
74
75 struct qed_start_vport_params {
76         bool remove_inner_vlan;
77         bool handle_ptp_pkts;
78         bool gro_enable;
79         bool drop_ttl0;
80         uint8_t vport_id;
81         uint16_t mtu;
82         bool clear_stats;
83 };
84
85 struct qed_stop_txq_params {
86         uint8_t rss_id;
87         uint8_t tx_queue_id;
88 };
89
90 struct qed_eth_ops {
91         const struct qed_common_ops *common;
92
93         int (*fill_dev_info)(struct ecore_dev *edev,
94                              struct qed_dev_eth_info *info);
95
96         int (*vport_start)(struct ecore_dev *edev,
97                            struct qed_start_vport_params *params);
98
99         int (*vport_stop)(struct ecore_dev *edev, uint8_t vport_id);
100
101         int (*vport_update)(struct ecore_dev *edev,
102                             struct qed_update_vport_params *params);
103
104         int (*q_rx_start)(struct ecore_dev *cdev,
105                           uint8_t rss_num,
106                           struct ecore_queue_start_common_params *p_params,
107                           uint16_t bd_max_bytes,
108                           dma_addr_t bd_chain_phys_addr,
109                           dma_addr_t cqe_pbl_addr,
110                           uint16_t cqe_pbl_size, void OSAL_IOMEM * *pp_prod);
111
112         int (*q_rx_stop)(struct ecore_dev *edev,
113                          struct qed_stop_rxq_params *params);
114
115         int (*q_tx_start)(struct ecore_dev *edev,
116                           uint8_t rss_num,
117                           struct ecore_queue_start_common_params *p_params,
118                           dma_addr_t pbl_addr,
119                           uint16_t pbl_size, void OSAL_IOMEM * *pp_doorbell);
120
121         int (*q_tx_stop)(struct ecore_dev *edev,
122                          struct qed_stop_txq_params *params);
123
124         int (*eth_cqe_completion)(struct ecore_dev *edev,
125                                   uint8_t rss_id,
126                                   struct eth_slow_path_rx_cqe *cqe);
127
128         int (*fastpath_stop)(struct ecore_dev *edev);
129
130         void (*fastpath_start)(struct ecore_dev *edev);
131
132         void (*get_vport_stats)(struct ecore_dev *edev,
133                                 struct ecore_eth_stats *stats);
134 };
135
136 /* externs */
137
138 extern const struct qed_common_ops qed_common_ops_pass;
139
140 const struct qed_eth_ops *qed_get_eth_ops(void);
141
142 int qed_configure_filter_rx_mode(struct rte_eth_dev *eth_dev,
143                                  enum qed_filter_rx_mode_type type);
144
145 #endif /* _QEDE_ETH_IF_H */