1 /* QLogic qed NIC Driver
2 * Copyright (c) 2015 QLogic Corporation
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
10 #include <linux/types.h>
12 #include <linux/kernel.h>
13 #include <linux/slab.h>
14 #include <linux/qed/qed_eth_if.h>
19 struct qed_sge_tpa_params
{
20 u8 max_buffers_per_cqe
;
25 u8 tpa_ipv4_tunn_en_flg
;
26 u8 tpa_ipv6_tunn_en_flg
;
28 u8 update_tpa_param_flg
;
30 u8 tpa_hdr_data_split_flg
;
31 u8 tpa_gro_consistent_flg
;
34 u16 tpa_min_size_to_start
;
35 u16 tpa_min_size_to_cont
;
38 enum qed_filter_opcode
{
42 QED_FILTER_REPLACE
, /* Delete all MACs and add new one instead */
43 QED_FILTER_FLUSH
, /* Removes all filters */
46 enum qed_filter_ucast_type
{
51 QED_FILTER_INNER_VLAN
,
52 QED_FILTER_INNER_PAIR
,
53 QED_FILTER_INNER_MAC_VNI_PAIR
,
54 QED_FILTER_MAC_VNI_PAIR
,
58 struct qed_filter_ucast
{
59 enum qed_filter_opcode opcode
;
60 enum qed_filter_ucast_type type
;
64 u8 vport_to_remove_from
;
65 unsigned char mac
[ETH_ALEN
];
71 struct qed_filter_mcast
{
72 /* MOVE is not supported for multicast */
73 enum qed_filter_opcode opcode
;
75 u8 vport_to_remove_from
;
77 #define QED_MAX_MC_ADDRS 64
78 unsigned char mac
[QED_MAX_MC_ADDRS
][ETH_ALEN
];
81 int qed_sp_eth_rx_queue_stop(struct qed_hwfn
*p_hwfn
,
83 bool eq_completion_only
, bool cqe_completion
);
85 int qed_sp_eth_tx_queue_stop(struct qed_hwfn
*p_hwfn
, u16 tx_queue_id
);
94 struct qed_sp_vport_start_params
{
95 enum qed_tpa_mode tpa_mode
;
96 bool remove_inner_vlan
;
100 u8 max_buffers_per_cqe
;
109 int qed_sp_eth_vport_start(struct qed_hwfn
*p_hwfn
,
110 struct qed_sp_vport_start_params
*p_params
);
112 struct qed_rss_params
{
113 u8 update_rss_config
;
116 u8 update_rss_capabilities
;
117 u8 update_rss_ind_table
;
120 u8 rss_table_size_log
;
121 u16 rss_ind_table
[QED_RSS_IND_TABLE_SIZE
];
122 u32 rss_key
[QED_RSS_KEY_SIZE
];
125 struct qed_filter_accept_flags
{
126 u8 update_rx_mode_config
;
127 u8 update_tx_mode_config
;
130 #define QED_ACCEPT_NONE 0x01
131 #define QED_ACCEPT_UCAST_MATCHED 0x02
132 #define QED_ACCEPT_UCAST_UNMATCHED 0x04
133 #define QED_ACCEPT_MCAST_MATCHED 0x08
134 #define QED_ACCEPT_MCAST_UNMATCHED 0x10
135 #define QED_ACCEPT_BCAST 0x20
138 struct qed_sp_vport_update_params
{
141 u8 update_vport_active_rx_flg
;
142 u8 vport_active_rx_flg
;
143 u8 update_vport_active_tx_flg
;
144 u8 vport_active_tx_flg
;
145 u8 update_inner_vlan_removal_flg
;
146 u8 inner_vlan_removal_flg
;
147 u8 silent_vlan_removal_flg
;
148 u8 update_default_vlan_enable_flg
;
149 u8 default_vlan_enable_flg
;
150 u8 update_default_vlan_flg
;
152 u8 update_tx_switching_flg
;
154 u8 update_approx_mcast_flg
;
155 u8 update_anti_spoofing_en_flg
;
157 u8 update_accept_any_vlan_flg
;
159 unsigned long bins
[8];
160 struct qed_rss_params
*rss_params
;
161 struct qed_filter_accept_flags accept_flags
;
162 struct qed_sge_tpa_params
*sge_tpa_params
;
165 int qed_sp_vport_update(struct qed_hwfn
*p_hwfn
,
166 struct qed_sp_vport_update_params
*p_params
,
167 enum spq_mode comp_mode
,
168 struct qed_spq_comp_cb
*p_comp_data
);
171 * @brief qed_sp_vport_stop -
173 * This ramrod closes a VPort after all its RX and TX queues are terminated.
174 * An Assert is generated if any queues are left open.
178 * @param vport_id VPort ID
182 int qed_sp_vport_stop(struct qed_hwfn
*p_hwfn
, u16 opaque_fid
, u8 vport_id
);
184 int qed_sp_eth_filter_ucast(struct qed_hwfn
*p_hwfn
,
186 struct qed_filter_ucast
*p_filter_cmd
,
187 enum spq_mode comp_mode
,
188 struct qed_spq_comp_cb
*p_comp_data
);
191 * @brief qed_sp_rx_eth_queues_update -
193 * This ramrod updates an RX queue. It is used for setting the active state
194 * of the queue and updating the TPA and SGE parameters.
196 * @note At the moment - only used by non-linux VFs.
199 * @param rx_queue_id RX Queue ID
200 * @param num_rxqs Allow to update multiple rx
201 * queues, from rx_queue_id to
202 * (rx_queue_id + num_rxqs)
203 * @param complete_cqe_flg Post completion to the CQE Ring if set
204 * @param complete_event_flg Post completion to the Event Ring if set
210 qed_sp_eth_rx_queues_update(struct qed_hwfn
*p_hwfn
,
214 u8 complete_event_flg
,
215 enum spq_mode comp_mode
,
216 struct qed_spq_comp_cb
*p_comp_data
);
218 void qed_get_vport_stats(struct qed_dev
*cdev
, struct qed_eth_stats
*stats
);
220 int qed_sp_eth_vport_start(struct qed_hwfn
*p_hwfn
,
221 struct qed_sp_vport_start_params
*p_params
);
223 int qed_sp_eth_rxq_start_ramrod(struct qed_hwfn
*p_hwfn
,
226 struct qed_queue_start_common_params
*params
,
229 dma_addr_t bd_chain_phys_addr
,
230 dma_addr_t cqe_pbl_addr
,
231 u16 cqe_pbl_size
, bool b_use_zone_a_prod
);
233 int qed_sp_eth_txq_start_ramrod(struct qed_hwfn
*p_hwfn
,
236 struct qed_queue_start_common_params
*p_params
,
240 union qed_qm_pq_params
*p_pq_params
);
242 u8
qed_mcast_bin_from_mac(u8
*mac
);
244 #endif /* _QED_L2_H */