Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(c) 2018 Aquantia Corporation
3 : : */
4 : :
5 : : #include <rte_string_fns.h>
6 : : #include <ethdev_pci.h>
7 : : #include <rte_alarm.h>
8 : : #include <rte_thread.h>
9 : :
10 : : #include "atl_ethdev.h"
11 : : #include "atl_common.h"
12 : : #include "atl_hw_regs.h"
13 : : #include "atl_logs.h"
14 : : #include "hw_atl/hw_atl_llh.h"
15 : : #include "hw_atl/hw_atl_b0.h"
16 : : #include "hw_atl/hw_atl_b0_internal.h"
17 : :
18 : : static int eth_atl_dev_init(struct rte_eth_dev *eth_dev);
19 : : static int atl_dev_configure(struct rte_eth_dev *dev);
20 : : static int atl_dev_start(struct rte_eth_dev *dev);
21 : : static int atl_dev_stop(struct rte_eth_dev *dev);
22 : : static int atl_dev_set_link_up(struct rte_eth_dev *dev);
23 : : static int atl_dev_set_link_down(struct rte_eth_dev *dev);
24 : : static int atl_dev_close(struct rte_eth_dev *dev);
25 : : static int atl_dev_reset(struct rte_eth_dev *dev);
26 : : static int atl_dev_promiscuous_enable(struct rte_eth_dev *dev);
27 : : static int atl_dev_promiscuous_disable(struct rte_eth_dev *dev);
28 : : static int atl_dev_allmulticast_enable(struct rte_eth_dev *dev);
29 : : static int atl_dev_allmulticast_disable(struct rte_eth_dev *dev);
30 : : static int atl_dev_link_update(struct rte_eth_dev *dev, int wait);
31 : :
32 : : static int atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
33 : : struct rte_eth_xstat_name *xstats_names,
34 : : unsigned int size);
35 : :
36 : : static int atl_dev_stats_get(struct rte_eth_dev *dev,
37 : : struct rte_eth_stats *stats, struct eth_queue_stats *qstats);
38 : :
39 : : static int atl_dev_xstats_get(struct rte_eth_dev *dev,
40 : : struct rte_eth_xstat *stats, unsigned int n);
41 : :
42 : : static int atl_dev_stats_reset(struct rte_eth_dev *dev);
43 : :
44 : : static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
45 : : size_t fw_size);
46 : :
47 : : static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev,
48 : : size_t *no_of_elements);
49 : :
50 : : static int atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
51 : :
52 : : /* VLAN stuff */
53 : : static int atl_vlan_filter_set(struct rte_eth_dev *dev,
54 : : uint16_t vlan_id, int on);
55 : :
56 : : static int atl_vlan_offload_set(struct rte_eth_dev *dev, int mask);
57 : :
58 : : static void atl_vlan_strip_queue_set(struct rte_eth_dev *dev,
59 : : uint16_t queue_id, int on);
60 : :
61 : : static int atl_vlan_tpid_set(struct rte_eth_dev *dev,
62 : : enum rte_vlan_type vlan_type, uint16_t tpid);
63 : :
64 : : /* EEPROM */
65 : : static int atl_dev_get_eeprom_length(struct rte_eth_dev *dev);
66 : : static int atl_dev_get_eeprom(struct rte_eth_dev *dev,
67 : : struct rte_dev_eeprom_info *eeprom);
68 : : static int atl_dev_set_eeprom(struct rte_eth_dev *dev,
69 : : struct rte_dev_eeprom_info *eeprom);
70 : :
71 : : /* Regs */
72 : : static int atl_dev_get_regs(struct rte_eth_dev *dev,
73 : : struct rte_dev_reg_info *regs);
74 : :
75 : : /* Flow control */
76 : : static int atl_flow_ctrl_get(struct rte_eth_dev *dev,
77 : : struct rte_eth_fc_conf *fc_conf);
78 : : static int atl_flow_ctrl_set(struct rte_eth_dev *dev,
79 : : struct rte_eth_fc_conf *fc_conf);
80 : :
81 : : static void atl_dev_link_status_print(struct rte_eth_dev *dev);
82 : :
83 : : /* Interrupts */
84 : : static int atl_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);
85 : : static int atl_dev_lsc_interrupt_setup(struct rte_eth_dev *dev, uint8_t on);
86 : : static int atl_dev_interrupt_get_status(struct rte_eth_dev *dev);
87 : : static int atl_dev_interrupt_action(struct rte_eth_dev *dev,
88 : : struct rte_intr_handle *handle);
89 : : static void atl_dev_interrupt_handler(void *param);
90 : :
91 : :
92 : : static int atl_add_mac_addr(struct rte_eth_dev *dev,
93 : : struct rte_ether_addr *mac_addr,
94 : : uint32_t index, uint32_t pool);
95 : : static void atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index);
96 : : static int atl_set_default_mac_addr(struct rte_eth_dev *dev,
97 : : struct rte_ether_addr *mac_addr);
98 : :
99 : : static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev,
100 : : struct rte_ether_addr *mc_addr_set,
101 : : uint32_t nb_mc_addr);
102 : :
103 : : /* RSS */
104 : : static int atl_reta_update(struct rte_eth_dev *dev,
105 : : struct rte_eth_rss_reta_entry64 *reta_conf,
106 : : uint16_t reta_size);
107 : : static int atl_reta_query(struct rte_eth_dev *dev,
108 : : struct rte_eth_rss_reta_entry64 *reta_conf,
109 : : uint16_t reta_size);
110 : : static int atl_rss_hash_update(struct rte_eth_dev *dev,
111 : : struct rte_eth_rss_conf *rss_conf);
112 : : static int atl_rss_hash_conf_get(struct rte_eth_dev *dev,
113 : : struct rte_eth_rss_conf *rss_conf);
114 : :
115 : :
116 : : static int eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
117 : : struct rte_pci_device *pci_dev);
118 : : static int eth_atl_pci_remove(struct rte_pci_device *pci_dev);
119 : :
120 : : static int atl_dev_info_get(struct rte_eth_dev *dev,
121 : : struct rte_eth_dev_info *dev_info);
122 : :
123 : : /*
124 : : * The set of PCI devices this driver supports
125 : : */
126 : : static const struct rte_pci_id pci_id_atl_map[] = {
127 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_0001) },
128 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D100) },
129 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D107) },
130 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D108) },
131 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D109) },
132 : :
133 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC100) },
134 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC107) },
135 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC108) },
136 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC109) },
137 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111) },
138 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112) },
139 : :
140 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC100S) },
141 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC107S) },
142 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC108S) },
143 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC109S) },
144 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111S) },
145 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112S) },
146 : :
147 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111E) },
148 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112E) },
149 : : { .vendor_id = 0, /* sentinel */ },
150 : : };
151 : :
152 : : static struct rte_pci_driver rte_atl_pmd = {
153 : : .id_table = pci_id_atl_map,
154 : : .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
155 : : .probe = eth_atl_pci_probe,
156 : : .remove = eth_atl_pci_remove,
157 : : };
158 : :
159 : : #define ATL_RX_OFFLOADS (RTE_ETH_RX_OFFLOAD_VLAN_STRIP \
160 : : | RTE_ETH_RX_OFFLOAD_IPV4_CKSUM \
161 : : | RTE_ETH_RX_OFFLOAD_UDP_CKSUM \
162 : : | RTE_ETH_RX_OFFLOAD_TCP_CKSUM \
163 : : | RTE_ETH_RX_OFFLOAD_MACSEC_STRIP \
164 : : | RTE_ETH_RX_OFFLOAD_VLAN_FILTER)
165 : :
166 : : #define ATL_TX_OFFLOADS (RTE_ETH_TX_OFFLOAD_VLAN_INSERT \
167 : : | RTE_ETH_TX_OFFLOAD_IPV4_CKSUM \
168 : : | RTE_ETH_TX_OFFLOAD_UDP_CKSUM \
169 : : | RTE_ETH_TX_OFFLOAD_TCP_CKSUM \
170 : : | RTE_ETH_TX_OFFLOAD_TCP_TSO \
171 : : | RTE_ETH_TX_OFFLOAD_MACSEC_INSERT \
172 : : | RTE_ETH_TX_OFFLOAD_MULTI_SEGS)
173 : :
174 : : #define SFP_EEPROM_SIZE 0x100
175 : :
176 : : static const struct rte_eth_desc_lim rx_desc_lim = {
177 : : .nb_max = ATL_MAX_RING_DESC,
178 : : .nb_min = ATL_MIN_RING_DESC,
179 : : .nb_align = ATL_RXD_ALIGN,
180 : : };
181 : :
182 : : static const struct rte_eth_desc_lim tx_desc_lim = {
183 : : .nb_max = ATL_MAX_RING_DESC,
184 : : .nb_min = ATL_MIN_RING_DESC,
185 : : .nb_align = ATL_TXD_ALIGN,
186 : : .nb_seg_max = ATL_TX_MAX_SEG,
187 : : .nb_mtu_seg_max = ATL_TX_MAX_SEG,
188 : : };
189 : :
190 : : enum atl_xstats_type {
191 : : XSTATS_TYPE_MSM = 0,
192 : : XSTATS_TYPE_MACSEC,
193 : : };
194 : :
195 : : #define ATL_XSTATS_FIELD(name) { \
196 : : #name, \
197 : : offsetof(struct aq_stats_s, name), \
198 : : XSTATS_TYPE_MSM \
199 : : }
200 : :
201 : : #define ATL_MACSEC_XSTATS_FIELD(name) { \
202 : : #name, \
203 : : offsetof(struct macsec_stats, name), \
204 : : XSTATS_TYPE_MACSEC \
205 : : }
206 : :
207 : : struct atl_xstats_tbl_s {
208 : : const char *name;
209 : : unsigned int offset;
210 : : enum atl_xstats_type type;
211 : : };
212 : :
213 : : static struct atl_xstats_tbl_s atl_xstats_tbl[] = {
214 : : ATL_XSTATS_FIELD(uprc),
215 : : ATL_XSTATS_FIELD(mprc),
216 : : ATL_XSTATS_FIELD(bprc),
217 : : ATL_XSTATS_FIELD(erpt),
218 : : ATL_XSTATS_FIELD(uptc),
219 : : ATL_XSTATS_FIELD(mptc),
220 : : ATL_XSTATS_FIELD(bptc),
221 : : ATL_XSTATS_FIELD(erpr),
222 : : ATL_XSTATS_FIELD(ubrc),
223 : : ATL_XSTATS_FIELD(ubtc),
224 : : ATL_XSTATS_FIELD(mbrc),
225 : : ATL_XSTATS_FIELD(mbtc),
226 : : ATL_XSTATS_FIELD(bbrc),
227 : : ATL_XSTATS_FIELD(bbtc),
228 : : /* Ingress Common Counters */
229 : : ATL_MACSEC_XSTATS_FIELD(in_ctl_pkts),
230 : : ATL_MACSEC_XSTATS_FIELD(in_tagged_miss_pkts),
231 : : ATL_MACSEC_XSTATS_FIELD(in_untagged_miss_pkts),
232 : : ATL_MACSEC_XSTATS_FIELD(in_notag_pkts),
233 : : ATL_MACSEC_XSTATS_FIELD(in_untagged_pkts),
234 : : ATL_MACSEC_XSTATS_FIELD(in_bad_tag_pkts),
235 : : ATL_MACSEC_XSTATS_FIELD(in_no_sci_pkts),
236 : : ATL_MACSEC_XSTATS_FIELD(in_unknown_sci_pkts),
237 : : /* Ingress SA Counters */
238 : : ATL_MACSEC_XSTATS_FIELD(in_untagged_hit_pkts),
239 : : ATL_MACSEC_XSTATS_FIELD(in_not_using_sa),
240 : : ATL_MACSEC_XSTATS_FIELD(in_unused_sa),
241 : : ATL_MACSEC_XSTATS_FIELD(in_not_valid_pkts),
242 : : ATL_MACSEC_XSTATS_FIELD(in_invalid_pkts),
243 : : ATL_MACSEC_XSTATS_FIELD(in_ok_pkts),
244 : : ATL_MACSEC_XSTATS_FIELD(in_unchecked_pkts),
245 : : ATL_MACSEC_XSTATS_FIELD(in_validated_octets),
246 : : ATL_MACSEC_XSTATS_FIELD(in_decrypted_octets),
247 : : /* Egress Common Counters */
248 : : ATL_MACSEC_XSTATS_FIELD(out_ctl_pkts),
249 : : ATL_MACSEC_XSTATS_FIELD(out_unknown_sa_pkts),
250 : : ATL_MACSEC_XSTATS_FIELD(out_untagged_pkts),
251 : : ATL_MACSEC_XSTATS_FIELD(out_too_long),
252 : : /* Egress SC Counters */
253 : : ATL_MACSEC_XSTATS_FIELD(out_sc_protected_pkts),
254 : : ATL_MACSEC_XSTATS_FIELD(out_sc_encrypted_pkts),
255 : : /* Egress SA Counters */
256 : : ATL_MACSEC_XSTATS_FIELD(out_sa_hit_drop_redirect),
257 : : ATL_MACSEC_XSTATS_FIELD(out_sa_protected2_pkts),
258 : : ATL_MACSEC_XSTATS_FIELD(out_sa_protected_pkts),
259 : : ATL_MACSEC_XSTATS_FIELD(out_sa_encrypted_pkts),
260 : : };
261 : :
262 : : static const struct eth_dev_ops atl_eth_dev_ops = {
263 : : .dev_configure = atl_dev_configure,
264 : : .dev_start = atl_dev_start,
265 : : .dev_stop = atl_dev_stop,
266 : : .dev_set_link_up = atl_dev_set_link_up,
267 : : .dev_set_link_down = atl_dev_set_link_down,
268 : : .dev_close = atl_dev_close,
269 : : .dev_reset = atl_dev_reset,
270 : :
271 : : /* PROMISC */
272 : : .promiscuous_enable = atl_dev_promiscuous_enable,
273 : : .promiscuous_disable = atl_dev_promiscuous_disable,
274 : : .allmulticast_enable = atl_dev_allmulticast_enable,
275 : : .allmulticast_disable = atl_dev_allmulticast_disable,
276 : :
277 : : /* Link */
278 : : .link_update = atl_dev_link_update,
279 : :
280 : : .get_reg = atl_dev_get_regs,
281 : :
282 : : /* Stats */
283 : : .stats_get = atl_dev_stats_get,
284 : : .xstats_get = atl_dev_xstats_get,
285 : : .xstats_get_names = atl_dev_xstats_get_names,
286 : : .stats_reset = atl_dev_stats_reset,
287 : : .xstats_reset = atl_dev_stats_reset,
288 : :
289 : : .fw_version_get = atl_fw_version_get,
290 : : .dev_infos_get = atl_dev_info_get,
291 : : .dev_supported_ptypes_get = atl_dev_supported_ptypes_get,
292 : :
293 : : .mtu_set = atl_dev_mtu_set,
294 : :
295 : : /* VLAN */
296 : : .vlan_filter_set = atl_vlan_filter_set,
297 : : .vlan_offload_set = atl_vlan_offload_set,
298 : : .vlan_tpid_set = atl_vlan_tpid_set,
299 : : .vlan_strip_queue_set = atl_vlan_strip_queue_set,
300 : :
301 : : /* Queue Control */
302 : : .rx_queue_start = atl_rx_queue_start,
303 : : .rx_queue_stop = atl_rx_queue_stop,
304 : : .rx_queue_setup = atl_rx_queue_setup,
305 : : .rx_queue_release = atl_rx_queue_release,
306 : :
307 : : .tx_queue_start = atl_tx_queue_start,
308 : : .tx_queue_stop = atl_tx_queue_stop,
309 : : .tx_queue_setup = atl_tx_queue_setup,
310 : : .tx_queue_release = atl_tx_queue_release,
311 : :
312 : : .rx_queue_intr_enable = atl_dev_rx_queue_intr_enable,
313 : : .rx_queue_intr_disable = atl_dev_rx_queue_intr_disable,
314 : :
315 : : /* EEPROM */
316 : : .get_eeprom_length = atl_dev_get_eeprom_length,
317 : : .get_eeprom = atl_dev_get_eeprom,
318 : : .set_eeprom = atl_dev_set_eeprom,
319 : :
320 : : /* Flow Control */
321 : : .flow_ctrl_get = atl_flow_ctrl_get,
322 : : .flow_ctrl_set = atl_flow_ctrl_set,
323 : :
324 : : /* MAC */
325 : : .mac_addr_add = atl_add_mac_addr,
326 : : .mac_addr_remove = atl_remove_mac_addr,
327 : : .mac_addr_set = atl_set_default_mac_addr,
328 : : .set_mc_addr_list = atl_dev_set_mc_addr_list,
329 : : .rxq_info_get = atl_rxq_info_get,
330 : : .txq_info_get = atl_txq_info_get,
331 : :
332 : : .reta_update = atl_reta_update,
333 : : .reta_query = atl_reta_query,
334 : : .rss_hash_update = atl_rss_hash_update,
335 : : .rss_hash_conf_get = atl_rss_hash_conf_get,
336 : : };
337 : :
338 : : static inline int32_t
339 : : atl_reset_hw(struct aq_hw_s *hw)
340 : : {
341 : 0 : return hw_atl_b0_hw_reset(hw);
342 : : }
343 : :
344 : : static inline void
345 : : atl_enable_intr(struct rte_eth_dev *dev)
346 : : {
347 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
348 : :
349 : 0 : hw_atl_itr_irq_msk_setlsw_set(hw, 0xffffffff);
350 : : }
351 : :
352 : : static void
353 : 0 : atl_disable_intr(struct aq_hw_s *hw)
354 : : {
355 : 0 : PMD_INIT_FUNC_TRACE();
356 : 0 : hw_atl_itr_irq_msk_clearlsw_set(hw, 0xffffffff);
357 : 0 : }
358 : :
359 : : static int
360 : 0 : eth_atl_dev_init(struct rte_eth_dev *eth_dev)
361 : : {
362 : 0 : struct atl_adapter *adapter = eth_dev->data->dev_private;
363 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
364 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
365 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
366 : : int err = 0;
367 : :
368 : 0 : PMD_INIT_FUNC_TRACE();
369 : :
370 : 0 : eth_dev->dev_ops = &atl_eth_dev_ops;
371 : :
372 : 0 : eth_dev->rx_queue_count = atl_rx_queue_count;
373 : 0 : eth_dev->rx_descriptor_status = atl_dev_rx_descriptor_status;
374 : 0 : eth_dev->tx_descriptor_status = atl_dev_tx_descriptor_status;
375 : :
376 : 0 : eth_dev->rx_pkt_burst = &atl_recv_pkts;
377 : 0 : eth_dev->tx_pkt_burst = &atl_xmit_pkts;
378 : 0 : eth_dev->tx_pkt_prepare = &atl_prep_pkts;
379 : :
380 : : /* For secondary processes, the primary process has done all the work */
381 [ # # ]: 0 : if (rte_eal_process_type() != RTE_PROC_PRIMARY)
382 : : return 0;
383 : :
384 : 0 : eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
385 : :
386 : : /* Vendor and Device ID need to be set before init of shared code */
387 : 0 : hw->device_id = pci_dev->id.device_id;
388 : 0 : hw->vendor_id = pci_dev->id.vendor_id;
389 : 0 : hw->mmio = (void *)pci_dev->mem_resource[0].addr;
390 : :
391 : : /* Hardware configuration - hardcode */
392 : 0 : adapter->hw_cfg.is_lro = false;
393 : 0 : adapter->hw_cfg.wol = false;
394 : 0 : adapter->hw_cfg.is_rss = false;
395 : 0 : adapter->hw_cfg.num_rss_queues = HW_ATL_B0_RSS_MAX;
396 : :
397 : 0 : adapter->hw_cfg.link_speed_msk = AQ_NIC_RATE_10G |
398 : : AQ_NIC_RATE_5G |
399 : : AQ_NIC_RATE_2G5 |
400 : : AQ_NIC_RATE_1G |
401 : : AQ_NIC_RATE_100M;
402 : :
403 : 0 : adapter->hw_cfg.flow_control = (AQ_NIC_FC_RX | AQ_NIC_FC_TX);
404 : 0 : adapter->hw_cfg.aq_rss.indirection_table_size =
405 : : HW_ATL_B0_RSS_REDIRECTION_MAX;
406 : :
407 : 0 : hw->aq_nic_cfg = &adapter->hw_cfg;
408 : :
409 : 0 : rte_thread_mutex_init_shared(&hw->mbox_mutex);
410 : :
411 : : /* disable interrupt */
412 : 0 : atl_disable_intr(hw);
413 : :
414 : : /* Allocate memory for storing MAC addresses */
415 : 0 : eth_dev->data->mac_addrs = rte_zmalloc("atlantic",
416 : : RTE_ETHER_ADDR_LEN, 0);
417 [ # # ]: 0 : if (eth_dev->data->mac_addrs == NULL) {
418 : 0 : PMD_INIT_LOG(ERR, "MAC Malloc failed");
419 : 0 : return -ENOMEM;
420 : : }
421 : :
422 : 0 : err = hw_atl_utils_initfw(hw, &hw->aq_fw_ops);
423 [ # # ]: 0 : if (err)
424 : : return err;
425 : :
426 : : /* Copy the permanent MAC address */
427 [ # # ]: 0 : if (hw->aq_fw_ops->get_mac_permanent(hw,
428 : 0 : eth_dev->data->mac_addrs->addr_bytes) != 0)
429 : : return -EINVAL;
430 : :
431 : : /* Reset the hw statistics */
432 : 0 : atl_dev_stats_reset(eth_dev);
433 : :
434 : 0 : rte_intr_callback_register(intr_handle,
435 : : atl_dev_interrupt_handler, eth_dev);
436 : :
437 : : /* enable uio/vfio intr/eventfd mapping */
438 : 0 : rte_intr_enable(intr_handle);
439 : :
440 : : /* enable support intr */
441 : : atl_enable_intr(eth_dev);
442 : :
443 : 0 : return err;
444 : : }
445 : :
446 : : static int
447 : 0 : eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
448 : : struct rte_pci_device *pci_dev)
449 : : {
450 : 0 : return rte_eth_dev_pci_generic_probe(pci_dev,
451 : : sizeof(struct atl_adapter), eth_atl_dev_init);
452 : : }
453 : :
454 : : static int
455 : 0 : eth_atl_pci_remove(struct rte_pci_device *pci_dev)
456 : : {
457 : 0 : return rte_eth_dev_pci_generic_remove(pci_dev, atl_dev_close);
458 : : }
459 : :
460 : : static int
461 : 0 : atl_dev_configure(struct rte_eth_dev *dev)
462 : : {
463 : : struct atl_interrupt *intr =
464 : 0 : ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
465 : :
466 : 0 : PMD_INIT_FUNC_TRACE();
467 : :
468 : : /* set flag to update link status after init */
469 : 0 : intr->flags |= ATL_FLAG_NEED_LINK_UPDATE;
470 : :
471 : 0 : return 0;
472 : : }
473 : :
474 : : /*
475 : : * Configure device link speed and setup link.
476 : : * It returns 0 on success.
477 : : */
478 : : static int
479 : 0 : atl_dev_start(struct rte_eth_dev *dev)
480 : : {
481 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
482 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
483 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
484 : : uint32_t intr_vector = 0;
485 : : int status;
486 : : int err;
487 : :
488 : 0 : PMD_INIT_FUNC_TRACE();
489 : :
490 : : /* set adapter started */
491 : 0 : hw->adapter_stopped = 0;
492 : :
493 [ # # ]: 0 : if (dev->data->dev_conf.link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
494 : 0 : PMD_INIT_LOG(ERR,
495 : : "Invalid link_speeds for port %u, fix speed not supported",
496 : : dev->data->port_id);
497 : 0 : return -EINVAL;
498 : : }
499 : :
500 : : /* disable uio/vfio intr/eventfd mapping */
501 : 0 : rte_intr_disable(intr_handle);
502 : :
503 : : /* reinitialize adapter
504 : : * this calls reset and start
505 : : */
506 : : status = atl_reset_hw(hw);
507 [ # # ]: 0 : if (status != 0)
508 : : return -EIO;
509 : :
510 : 0 : err = hw_atl_b0_hw_init(hw, dev->data->mac_addrs->addr_bytes);
511 : :
512 : 0 : hw_atl_b0_hw_start(hw);
513 : : /* check and configure queue intr-vector mapping */
514 [ # # ]: 0 : if ((rte_intr_cap_multiple(intr_handle) ||
515 [ # # ]: 0 : !RTE_ETH_DEV_SRIOV(dev).active) &&
516 [ # # ]: 0 : dev->data->dev_conf.intr_conf.rxq != 0) {
517 : 0 : intr_vector = dev->data->nb_rx_queues;
518 [ # # ]: 0 : if (intr_vector > ATL_MAX_INTR_QUEUE_NUM) {
519 : 0 : PMD_INIT_LOG(ERR, "At most %d intr queues supported",
520 : : ATL_MAX_INTR_QUEUE_NUM);
521 : 0 : return -ENOTSUP;
522 : : }
523 [ # # ]: 0 : if (rte_intr_efd_enable(intr_handle, intr_vector)) {
524 : 0 : PMD_INIT_LOG(ERR, "rte_intr_efd_enable failed");
525 : 0 : return -1;
526 : : }
527 : : }
528 : :
529 [ # # ]: 0 : if (rte_intr_dp_is_en(intr_handle)) {
530 [ # # ]: 0 : if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
531 : 0 : dev->data->nb_rx_queues)) {
532 : 0 : PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
533 : : " intr_vec", dev->data->nb_rx_queues);
534 : 0 : return -ENOMEM;
535 : : }
536 : : }
537 : :
538 : : /* initialize transmission unit */
539 : 0 : atl_tx_init(dev);
540 : :
541 : : /* This can fail when allocating mbufs for descriptor rings */
542 : 0 : err = atl_rx_init(dev);
543 [ # # ]: 0 : if (err) {
544 : 0 : PMD_INIT_LOG(ERR, "Unable to initialize RX hardware");
545 : 0 : goto error;
546 : : }
547 : :
548 : 0 : PMD_INIT_LOG(DEBUG, "FW version: %u.%u.%u",
549 : : hw->fw_ver_actual >> 24,
550 : : (hw->fw_ver_actual >> 16) & 0xFF,
551 : : hw->fw_ver_actual & 0xFFFF);
552 : 0 : PMD_INIT_LOG(DEBUG, "Driver version: %s", ATL_PMD_DRIVER_VERSION);
553 : :
554 : 0 : err = atl_start_queues(dev);
555 [ # # ]: 0 : if (err < 0) {
556 : 0 : PMD_INIT_LOG(ERR, "Unable to start rxtx queues");
557 : 0 : goto error;
558 : : }
559 : :
560 : 0 : err = atl_dev_set_link_up(dev);
561 : :
562 : 0 : err = hw->aq_fw_ops->update_link_status(hw);
563 : :
564 [ # # ]: 0 : if (err)
565 : 0 : goto error;
566 : :
567 : 0 : dev->data->dev_link.link_status = hw->aq_link_status.mbps != 0;
568 : :
569 [ # # ]: 0 : if (rte_intr_allow_others(intr_handle)) {
570 : : /* check if lsc interrupt is enabled */
571 [ # # ]: 0 : if (dev->data->dev_conf.intr_conf.lsc != 0)
572 : : atl_dev_lsc_interrupt_setup(dev, true);
573 : : else
574 : : atl_dev_lsc_interrupt_setup(dev, false);
575 : : } else {
576 : 0 : rte_intr_callback_unregister(intr_handle,
577 : : atl_dev_interrupt_handler, dev);
578 [ # # ]: 0 : if (dev->data->dev_conf.intr_conf.lsc != 0)
579 : 0 : PMD_INIT_LOG(INFO, "lsc won't enable because of"
580 : : " no intr multiplex");
581 : : }
582 : :
583 : : /* check if rxq interrupt is enabled */
584 [ # # ]: 0 : if (dev->data->dev_conf.intr_conf.rxq != 0 &&
585 : 0 : rte_intr_dp_is_en(intr_handle))
586 : : atl_dev_rxq_interrupt_setup(dev);
587 : :
588 : : /* enable uio/vfio intr/eventfd mapping */
589 : 0 : rte_intr_enable(intr_handle);
590 : :
591 : : /* resume enabled intr since hw reset */
592 : : atl_enable_intr(dev);
593 : :
594 : 0 : return 0;
595 : :
596 : 0 : error:
597 : 0 : atl_stop_queues(dev);
598 : 0 : return -EIO;
599 : : }
600 : :
601 : : /*
602 : : * Stop device: disable rx and tx functions to allow for reconfiguring.
603 : : */
604 : : static int
605 : 0 : atl_dev_stop(struct rte_eth_dev *dev)
606 : : {
607 : : struct rte_eth_link link;
608 : 0 : struct aq_hw_s *hw =
609 : 0 : ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
610 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
611 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
612 : :
613 : 0 : PMD_INIT_FUNC_TRACE();
614 : 0 : dev->data->dev_started = 0;
615 : :
616 : : /* disable interrupts */
617 : 0 : atl_disable_intr(hw);
618 : :
619 : : /* reset the NIC */
620 : : atl_reset_hw(hw);
621 : 0 : hw->adapter_stopped = 1;
622 : :
623 : 0 : atl_stop_queues(dev);
624 : :
625 : : /* Clear stored conf */
626 : 0 : dev->data->scattered_rx = 0;
627 : 0 : dev->data->lro = 0;
628 : :
629 : : /* Clear recorded link status */
630 : : memset(&link, 0, sizeof(link));
631 : 0 : rte_eth_linkstatus_set(dev, &link);
632 : :
633 [ # # ]: 0 : if (!rte_intr_allow_others(intr_handle))
634 : : /* resume to the default handler */
635 : 0 : rte_intr_callback_register(intr_handle,
636 : : atl_dev_interrupt_handler,
637 : : (void *)dev);
638 : :
639 : : /* Clean datapath event and queue/vec mapping */
640 : 0 : rte_intr_efd_disable(intr_handle);
641 : 0 : rte_intr_vec_list_free(intr_handle);
642 : :
643 : 0 : return 0;
644 : : }
645 : :
646 : : /*
647 : : * Set device link up: enable tx.
648 : : */
649 : : static int
650 : 0 : atl_dev_set_link_up(struct rte_eth_dev *dev)
651 : : {
652 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
653 : 0 : uint32_t link_speeds = dev->data->dev_conf.link_speeds;
654 : : uint32_t speed_mask = 0;
655 : :
656 [ # # ]: 0 : if (link_speeds == RTE_ETH_LINK_SPEED_AUTONEG) {
657 : 0 : speed_mask = hw->aq_nic_cfg->link_speed_msk;
658 : : } else {
659 [ # # ]: 0 : if (link_speeds & RTE_ETH_LINK_SPEED_10G)
660 : : speed_mask |= AQ_NIC_RATE_10G;
661 [ # # ]: 0 : if (link_speeds & RTE_ETH_LINK_SPEED_5G)
662 : 0 : speed_mask |= AQ_NIC_RATE_5G;
663 [ # # ]: 0 : if (link_speeds & RTE_ETH_LINK_SPEED_1G)
664 : 0 : speed_mask |= AQ_NIC_RATE_1G;
665 [ # # ]: 0 : if (link_speeds & RTE_ETH_LINK_SPEED_2_5G)
666 : 0 : speed_mask |= AQ_NIC_RATE_2G5;
667 [ # # ]: 0 : if (link_speeds & RTE_ETH_LINK_SPEED_100M)
668 : 0 : speed_mask |= AQ_NIC_RATE_100M;
669 : : }
670 : :
671 : 0 : return hw->aq_fw_ops->set_link_speed(hw, speed_mask);
672 : : }
673 : :
674 : : /*
675 : : * Set device link down: disable tx.
676 : : */
677 : : static int
678 : 0 : atl_dev_set_link_down(struct rte_eth_dev *dev)
679 : : {
680 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
681 : :
682 : 0 : return hw->aq_fw_ops->set_link_speed(hw, 0);
683 : : }
684 : :
685 : : /*
686 : : * Reset and stop device.
687 : : */
688 : : static int
689 : 0 : atl_dev_close(struct rte_eth_dev *dev)
690 : : {
691 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
692 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
693 : : struct aq_hw_s *hw;
694 : : int ret;
695 : :
696 : 0 : PMD_INIT_FUNC_TRACE();
697 : :
698 [ # # ]: 0 : if (rte_eal_process_type() != RTE_PROC_PRIMARY)
699 : : return 0;
700 : :
701 : 0 : hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
702 : :
703 : 0 : ret = atl_dev_stop(dev);
704 : :
705 : 0 : atl_free_queues(dev);
706 : :
707 : : /* disable uio intr before callback unregister */
708 : 0 : rte_intr_disable(intr_handle);
709 : 0 : rte_intr_callback_unregister(intr_handle,
710 : : atl_dev_interrupt_handler, dev);
711 : :
712 : 0 : pthread_mutex_destroy(&hw->mbox_mutex);
713 : :
714 : 0 : return ret;
715 : : }
716 : :
717 : : static int
718 : 0 : atl_dev_reset(struct rte_eth_dev *dev)
719 : : {
720 : : int ret;
721 : :
722 : 0 : ret = atl_dev_close(dev);
723 [ # # ]: 0 : if (ret)
724 : : return ret;
725 : :
726 : 0 : ret = eth_atl_dev_init(dev);
727 : :
728 : 0 : return ret;
729 : : }
730 : :
731 : : static int
732 : 0 : atl_dev_configure_macsec(struct rte_eth_dev *dev)
733 : : {
734 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
735 : : struct aq_hw_cfg_s *cf = ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
736 : : struct aq_macsec_config *aqcfg = &cf->aq_macsec;
737 : : struct macsec_msg_fw_request msg_macsec;
738 : : struct macsec_msg_fw_response response;
739 : :
740 [ # # ]: 0 : if (!aqcfg->common.macsec_enabled ||
741 [ # # ]: 0 : hw->aq_fw_ops->send_macsec_req == NULL)
742 : : return 0;
743 : :
744 : : memset(&msg_macsec, 0, sizeof(msg_macsec));
745 : :
746 : : /* Creating set of sc/sa structures from parameters provided by DPDK */
747 : :
748 : : /* Configure macsec */
749 : : msg_macsec.msg_type = macsec_cfg_msg;
750 : 0 : msg_macsec.cfg.enabled = aqcfg->common.macsec_enabled;
751 : 0 : msg_macsec.cfg.interrupts_enabled = 1;
752 : :
753 : 0 : hw->aq_fw_ops->send_macsec_req(hw, &msg_macsec, &response);
754 : :
755 [ # # ]: 0 : if (response.result)
756 : : return -1;
757 : :
758 : : memset(&msg_macsec, 0, sizeof(msg_macsec));
759 : :
760 : : /* Configure TX SC */
761 : :
762 : 0 : msg_macsec.msg_type = macsec_add_tx_sc_msg;
763 : : msg_macsec.txsc.index = 0; /* TXSC always one (??) */
764 : 0 : msg_macsec.txsc.protect = aqcfg->common.encryption_enabled;
765 : :
766 : : /* MAC addr for TX */
767 [ # # ]: 0 : msg_macsec.txsc.mac_sa[0] = rte_bswap32(aqcfg->txsc.mac[1]);
768 [ # # ]: 0 : msg_macsec.txsc.mac_sa[1] = rte_bswap32(aqcfg->txsc.mac[0]);
769 : 0 : msg_macsec.txsc.sa_mask = 0x3f;
770 : :
771 : : msg_macsec.txsc.da_mask = 0;
772 : 0 : msg_macsec.txsc.tci = 0x0B;
773 : : msg_macsec.txsc.curr_an = 0; /* SA index which currently used */
774 : :
775 : : /*
776 : : * Creating SCI (Secure Channel Identifier).
777 : : * SCI constructed from Source MAC and Port identifier
778 : : */
779 : 0 : uint32_t sci_hi_part = (msg_macsec.txsc.mac_sa[1] << 16) |
780 : 0 : (msg_macsec.txsc.mac_sa[0] >> 16);
781 : 0 : uint32_t sci_low_part = (msg_macsec.txsc.mac_sa[0] << 16);
782 : :
783 : : uint32_t port_identifier = 1;
784 : :
785 : 0 : msg_macsec.txsc.sci[1] = sci_hi_part;
786 : 0 : msg_macsec.txsc.sci[0] = sci_low_part | port_identifier;
787 : :
788 : 0 : hw->aq_fw_ops->send_macsec_req(hw, &msg_macsec, &response);
789 : :
790 [ # # ]: 0 : if (response.result)
791 : : return -1;
792 : :
793 : : memset(&msg_macsec, 0, sizeof(msg_macsec));
794 : :
795 : : /* Configure RX SC */
796 : :
797 : 0 : msg_macsec.msg_type = macsec_add_rx_sc_msg;
798 : 0 : msg_macsec.rxsc.index = aqcfg->rxsc.pi;
799 : 0 : msg_macsec.rxsc.replay_protect =
800 : 0 : aqcfg->common.replay_protection_enabled;
801 : : msg_macsec.rxsc.anti_replay_window = 0;
802 : :
803 : : /* MAC addr for RX */
804 [ # # ]: 0 : msg_macsec.rxsc.mac_da[0] = rte_bswap32(aqcfg->rxsc.mac[1]);
805 [ # # ]: 0 : msg_macsec.rxsc.mac_da[1] = rte_bswap32(aqcfg->rxsc.mac[0]);
806 : : msg_macsec.rxsc.da_mask = 0;//0x3f;
807 : :
808 : : msg_macsec.rxsc.sa_mask = 0;
809 : :
810 : 0 : hw->aq_fw_ops->send_macsec_req(hw, &msg_macsec, &response);
811 : :
812 [ # # ]: 0 : if (response.result)
813 : : return -1;
814 : :
815 : : memset(&msg_macsec, 0, sizeof(msg_macsec));
816 : :
817 : : /* Configure RX SC */
818 : :
819 : 0 : msg_macsec.msg_type = macsec_add_tx_sa_msg;
820 : 0 : msg_macsec.txsa.index = aqcfg->txsa.idx;
821 : 0 : msg_macsec.txsa.next_pn = aqcfg->txsa.pn;
822 : :
823 [ # # ]: 0 : msg_macsec.txsa.key[0] = rte_bswap32(aqcfg->txsa.key[3]);
824 [ # # ]: 0 : msg_macsec.txsa.key[1] = rte_bswap32(aqcfg->txsa.key[2]);
825 [ # # ]: 0 : msg_macsec.txsa.key[2] = rte_bswap32(aqcfg->txsa.key[1]);
826 [ # # ]: 0 : msg_macsec.txsa.key[3] = rte_bswap32(aqcfg->txsa.key[0]);
827 : :
828 : 0 : hw->aq_fw_ops->send_macsec_req(hw, &msg_macsec, &response);
829 : :
830 [ # # ]: 0 : if (response.result)
831 : : return -1;
832 : :
833 : : memset(&msg_macsec, 0, sizeof(msg_macsec));
834 : :
835 : : /* Configure RX SA */
836 : :
837 : 0 : msg_macsec.msg_type = macsec_add_rx_sa_msg;
838 : 0 : msg_macsec.rxsa.index = aqcfg->rxsa.idx;
839 : 0 : msg_macsec.rxsa.next_pn = aqcfg->rxsa.pn;
840 : :
841 [ # # ]: 0 : msg_macsec.rxsa.key[0] = rte_bswap32(aqcfg->rxsa.key[3]);
842 [ # # ]: 0 : msg_macsec.rxsa.key[1] = rte_bswap32(aqcfg->rxsa.key[2]);
843 [ # # ]: 0 : msg_macsec.rxsa.key[2] = rte_bswap32(aqcfg->rxsa.key[1]);
844 [ # # ]: 0 : msg_macsec.rxsa.key[3] = rte_bswap32(aqcfg->rxsa.key[0]);
845 : :
846 : 0 : hw->aq_fw_ops->send_macsec_req(hw, &msg_macsec, &response);
847 : :
848 [ # # ]: 0 : if (response.result)
849 : 0 : return -1;
850 : :
851 : : return 0;
852 : : }
853 : :
854 : 0 : int atl_macsec_enable(struct rte_eth_dev *dev,
855 : : uint8_t encr, uint8_t repl_prot)
856 : : {
857 : : struct aq_hw_cfg_s *cfg =
858 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
859 : :
860 : 0 : cfg->aq_macsec.common.macsec_enabled = 1;
861 : 0 : cfg->aq_macsec.common.encryption_enabled = encr;
862 : 0 : cfg->aq_macsec.common.replay_protection_enabled = repl_prot;
863 : :
864 : 0 : return 0;
865 : : }
866 : :
867 : 0 : int atl_macsec_disable(struct rte_eth_dev *dev)
868 : : {
869 : : struct aq_hw_cfg_s *cfg =
870 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
871 : :
872 : 0 : cfg->aq_macsec.common.macsec_enabled = 0;
873 : :
874 : 0 : return 0;
875 : : }
876 : :
877 : 0 : int atl_macsec_config_txsc(struct rte_eth_dev *dev, uint8_t *mac)
878 : : {
879 : : struct aq_hw_cfg_s *cfg =
880 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
881 : :
882 : 0 : memset(&cfg->aq_macsec.txsc.mac, 0, sizeof(cfg->aq_macsec.txsc.mac));
883 : 0 : memcpy((uint8_t *)&cfg->aq_macsec.txsc.mac + 2, mac,
884 : : RTE_ETHER_ADDR_LEN);
885 : :
886 : 0 : return 0;
887 : : }
888 : :
889 : 0 : int atl_macsec_config_rxsc(struct rte_eth_dev *dev,
890 : : uint8_t *mac, uint16_t pi)
891 : : {
892 : : struct aq_hw_cfg_s *cfg =
893 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
894 : :
895 : 0 : memset(&cfg->aq_macsec.rxsc.mac, 0, sizeof(cfg->aq_macsec.rxsc.mac));
896 : 0 : memcpy((uint8_t *)&cfg->aq_macsec.rxsc.mac + 2, mac,
897 : : RTE_ETHER_ADDR_LEN);
898 : 0 : cfg->aq_macsec.rxsc.pi = pi;
899 : :
900 : 0 : return 0;
901 : : }
902 : :
903 : 0 : int atl_macsec_select_txsa(struct rte_eth_dev *dev,
904 : : uint8_t idx, uint8_t an,
905 : : uint32_t pn, uint8_t *key)
906 : : {
907 : : struct aq_hw_cfg_s *cfg =
908 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
909 : :
910 : 0 : cfg->aq_macsec.txsa.idx = idx;
911 : 0 : cfg->aq_macsec.txsa.pn = pn;
912 : 0 : cfg->aq_macsec.txsa.an = an;
913 : :
914 : 0 : memcpy(&cfg->aq_macsec.txsa.key, key, 16);
915 : 0 : return 0;
916 : : }
917 : :
918 : 0 : int atl_macsec_select_rxsa(struct rte_eth_dev *dev,
919 : : uint8_t idx, uint8_t an,
920 : : uint32_t pn, uint8_t *key)
921 : : {
922 : : struct aq_hw_cfg_s *cfg =
923 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
924 : :
925 : 0 : cfg->aq_macsec.rxsa.idx = idx;
926 : 0 : cfg->aq_macsec.rxsa.pn = pn;
927 : 0 : cfg->aq_macsec.rxsa.an = an;
928 : :
929 : 0 : memcpy(&cfg->aq_macsec.rxsa.key, key, 16);
930 : 0 : return 0;
931 : : }
932 : :
933 : : static int
934 : 0 : atl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
935 : : struct eth_queue_stats *qstats)
936 : : {
937 : 0 : struct atl_adapter *adapter = ATL_DEV_TO_ADAPTER(dev);
938 : 0 : struct aq_hw_s *hw = &adapter->hw;
939 : : struct atl_sw_stats *swstats = &adapter->sw_stats;
940 : : unsigned int i;
941 : :
942 : 0 : hw->aq_fw_ops->update_stats(hw);
943 : :
944 : : /* Fill out the rte_eth_stats statistics structure */
945 : 0 : stats->ipackets = hw->curr_stats.dma_pkt_rc;
946 : 0 : stats->ibytes = hw->curr_stats.dma_oct_rc;
947 : 0 : stats->imissed = hw->curr_stats.dpc;
948 : 0 : stats->ierrors = hw->curr_stats.erpt;
949 : :
950 : 0 : stats->opackets = hw->curr_stats.dma_pkt_tc;
951 : 0 : stats->obytes = hw->curr_stats.dma_oct_tc;
952 : 0 : stats->oerrors = 0;
953 : :
954 : 0 : stats->rx_nombuf = swstats->rx_nombuf;
955 : :
956 [ # # ]: 0 : if (qstats != NULL) {
957 [ # # ]: 0 : for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
958 : 0 : qstats->q_ipackets[i] = swstats->q_ipackets[i];
959 : 0 : qstats->q_opackets[i] = swstats->q_opackets[i];
960 : 0 : qstats->q_ibytes[i] = swstats->q_ibytes[i];
961 : 0 : qstats->q_obytes[i] = swstats->q_obytes[i];
962 : 0 : qstats->q_errors[i] = swstats->q_errors[i];
963 : : }
964 : : }
965 : 0 : return 0;
966 : : }
967 : :
968 : : static int
969 : 0 : atl_dev_stats_reset(struct rte_eth_dev *dev)
970 : : {
971 : 0 : struct atl_adapter *adapter = ATL_DEV_TO_ADAPTER(dev);
972 : 0 : struct aq_hw_s *hw = &adapter->hw;
973 : :
974 : 0 : hw->aq_fw_ops->update_stats(hw);
975 : :
976 : : /* Reset software totals */
977 : 0 : memset(&hw->curr_stats, 0, sizeof(hw->curr_stats));
978 : :
979 : 0 : memset(&adapter->sw_stats, 0, sizeof(adapter->sw_stats));
980 : :
981 : 0 : return 0;
982 : : }
983 : :
984 : : static int
985 : : atl_dev_xstats_get_count(struct rte_eth_dev *dev)
986 : : {
987 : 0 : struct atl_adapter *adapter =
988 : 0 : (struct atl_adapter *)dev->data->dev_private;
989 : :
990 : : struct aq_hw_s *hw = &adapter->hw;
991 : : unsigned int i, count = 0;
992 : :
993 [ # # # # ]: 0 : for (i = 0; i < RTE_DIM(atl_xstats_tbl); i++) {
994 [ # # # # ]: 0 : if (atl_xstats_tbl[i].type == XSTATS_TYPE_MACSEC &&
995 [ # # # # ]: 0 : ((hw->caps_lo & BIT(CAPS_LO_MACSEC)) == 0))
996 : 0 : continue;
997 : :
998 : 0 : count++;
999 : : }
1000 : :
1001 : 0 : return count;
1002 : : }
1003 : :
1004 : : static int
1005 : 0 : atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
1006 : : struct rte_eth_xstat_name *xstats_names,
1007 : : unsigned int size)
1008 : : {
1009 : : unsigned int i;
1010 : : unsigned int count = atl_dev_xstats_get_count(dev);
1011 : :
1012 [ # # ]: 0 : if (xstats_names) {
1013 [ # # ]: 0 : for (i = 0; i < size && i < count; i++) {
1014 : 0 : snprintf(xstats_names[i].name,
1015 : : RTE_ETH_XSTATS_NAME_SIZE, "%s",
1016 : : atl_xstats_tbl[i].name);
1017 : : }
1018 : : }
1019 : :
1020 : 0 : return count;
1021 : : }
1022 : :
1023 : : static int
1024 : 0 : atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
1025 : : unsigned int n)
1026 : : {
1027 : 0 : struct atl_adapter *adapter = dev->data->dev_private;
1028 : 0 : struct aq_hw_s *hw = &adapter->hw;
1029 : : struct get_stats req = { 0 };
1030 : 0 : struct macsec_msg_fw_request msg = { 0 };
1031 : 0 : struct macsec_msg_fw_response resp = { 0 };
1032 : : int err = -1;
1033 : : unsigned int i;
1034 : : unsigned int count = atl_dev_xstats_get_count(dev);
1035 : :
1036 [ # # ]: 0 : if (!stats)
1037 : : return count;
1038 : :
1039 [ # # ]: 0 : if (hw->aq_fw_ops->send_macsec_req != NULL) {
1040 : : req.ingress_sa_index = 0xff;
1041 : : req.egress_sc_index = 0xff;
1042 : : req.egress_sa_index = 0xff;
1043 : :
1044 : 0 : msg.msg_type = macsec_get_stats_msg;
1045 : 0 : msg.stats = req;
1046 : :
1047 : 0 : err = hw->aq_fw_ops->send_macsec_req(hw, &msg, &resp);
1048 : : }
1049 : :
1050 [ # # ]: 0 : for (i = 0; i < n && i < count; i++) {
1051 : 0 : stats[i].id = i;
1052 : :
1053 [ # # # ]: 0 : switch (atl_xstats_tbl[i].type) {
1054 : 0 : case XSTATS_TYPE_MSM:
1055 : 0 : stats[i].value = *(u64 *)((uint8_t *)&hw->curr_stats +
1056 : 0 : atl_xstats_tbl[i].offset);
1057 : 0 : break;
1058 : 0 : case XSTATS_TYPE_MACSEC:
1059 [ # # ]: 0 : if (!err) {
1060 : 0 : stats[i].value =
1061 : 0 : *(u64 *)((uint8_t *)&resp.stats +
1062 : 0 : atl_xstats_tbl[i].offset);
1063 : : }
1064 : : break;
1065 : : }
1066 : : }
1067 : :
1068 : 0 : return i;
1069 : : }
1070 : :
1071 : : static int
1072 : 0 : atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
1073 : : {
1074 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1075 : 0 : uint32_t fw_ver = 0;
1076 : : int ret = 0;
1077 : :
1078 : 0 : ret = hw_atl_utils_get_fw_version(hw, &fw_ver);
1079 [ # # ]: 0 : if (ret)
1080 : : return -EIO;
1081 : :
1082 : 0 : ret = snprintf(fw_version, fw_size, "%u.%u.%u", fw_ver >> 24,
1083 [ # # ]: 0 : (fw_ver >> 16) & 0xFFU, fw_ver & 0xFFFFU);
1084 [ # # ]: 0 : if (ret < 0)
1085 : : return -EINVAL;
1086 : :
1087 : 0 : ret += 1; /* add string null-terminator */
1088 [ # # ]: 0 : if (fw_size < (size_t)ret)
1089 : 0 : return ret;
1090 : :
1091 : : return 0;
1092 : : }
1093 : :
1094 : : static int
1095 : 0 : atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
1096 : : {
1097 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
1098 : :
1099 : 0 : dev_info->max_rx_queues = AQ_HW_MAX_RX_QUEUES;
1100 : 0 : dev_info->max_tx_queues = AQ_HW_MAX_TX_QUEUES;
1101 : :
1102 : 0 : dev_info->min_rx_bufsize = 1024;
1103 : 0 : dev_info->max_rx_pktlen = HW_ATL_B0_MTU_JUMBO;
1104 : 0 : dev_info->max_mac_addrs = HW_ATL_B0_MAC_MAX;
1105 : 0 : dev_info->max_vfs = pci_dev->max_vfs;
1106 : :
1107 : 0 : dev_info->max_hash_mac_addrs = 0;
1108 : 0 : dev_info->max_vmdq_pools = 0;
1109 : 0 : dev_info->vmdq_queue_num = 0;
1110 : :
1111 : 0 : dev_info->rx_offload_capa = ATL_RX_OFFLOADS;
1112 : :
1113 : 0 : dev_info->tx_offload_capa = ATL_TX_OFFLOADS;
1114 : :
1115 : :
1116 : 0 : dev_info->default_rxconf = (struct rte_eth_rxconf) {
1117 : : .rx_free_thresh = ATL_DEFAULT_RX_FREE_THRESH,
1118 : : };
1119 : :
1120 : 0 : dev_info->default_txconf = (struct rte_eth_txconf) {
1121 : : .tx_free_thresh = ATL_DEFAULT_TX_FREE_THRESH,
1122 : : };
1123 : :
1124 : 0 : dev_info->rx_desc_lim = rx_desc_lim;
1125 : 0 : dev_info->tx_desc_lim = tx_desc_lim;
1126 : :
1127 : 0 : dev_info->hash_key_size = HW_ATL_B0_RSS_HASHKEY_BITS / 8;
1128 : 0 : dev_info->reta_size = HW_ATL_B0_RSS_REDIRECTION_MAX;
1129 : 0 : dev_info->flow_type_rss_offloads = ATL_RSS_OFFLOAD_ALL;
1130 : :
1131 : : dev_info->speed_capa = RTE_ETH_LINK_SPEED_1G | RTE_ETH_LINK_SPEED_10G;
1132 : : dev_info->speed_capa |= RTE_ETH_LINK_SPEED_100M;
1133 : : dev_info->speed_capa |= RTE_ETH_LINK_SPEED_2_5G;
1134 : 0 : dev_info->speed_capa |= RTE_ETH_LINK_SPEED_5G;
1135 : :
1136 : 0 : return 0;
1137 : : }
1138 : :
1139 : : static const uint32_t *
1140 : 0 : atl_dev_supported_ptypes_get(struct rte_eth_dev *dev, size_t *no_of_elements)
1141 : : {
1142 : : static const uint32_t ptypes[] = {
1143 : : RTE_PTYPE_L2_ETHER,
1144 : : RTE_PTYPE_L2_ETHER_ARP,
1145 : : RTE_PTYPE_L2_ETHER_VLAN,
1146 : : RTE_PTYPE_L3_IPV4,
1147 : : RTE_PTYPE_L3_IPV6,
1148 : : RTE_PTYPE_L4_TCP,
1149 : : RTE_PTYPE_L4_UDP,
1150 : : RTE_PTYPE_L4_SCTP,
1151 : : RTE_PTYPE_L4_ICMP,
1152 : : };
1153 : :
1154 [ # # ]: 0 : if (dev->rx_pkt_burst == atl_recv_pkts) {
1155 : 0 : *no_of_elements = RTE_DIM(ptypes);
1156 : 0 : return ptypes;
1157 : : }
1158 : :
1159 : : return NULL;
1160 : : }
1161 : :
1162 : : static void
1163 : 0 : atl_dev_delayed_handler(void *param)
1164 : : {
1165 : : struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
1166 : :
1167 : 0 : atl_dev_configure_macsec(dev);
1168 : 0 : }
1169 : :
1170 : :
1171 : : /* return 0 means link status changed, -1 means not changed */
1172 : : static int
1173 : 0 : atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
1174 : : {
1175 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1176 : : struct rte_eth_link link, old;
1177 : 0 : u32 fc = AQ_NIC_FC_OFF;
1178 : : int err = 0;
1179 : :
1180 : 0 : link.link_status = RTE_ETH_LINK_DOWN;
1181 : 0 : link.link_speed = 0;
1182 : 0 : link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
1183 : 0 : link.link_autoneg = hw->is_autoneg ? RTE_ETH_LINK_AUTONEG : RTE_ETH_LINK_FIXED;
1184 : : memset(&old, 0, sizeof(old));
1185 : :
1186 : : /* load old link status */
1187 : 0 : rte_eth_linkstatus_get(dev, &old);
1188 : :
1189 : : /* read current link status */
1190 : 0 : err = hw->aq_fw_ops->update_link_status(hw);
1191 : :
1192 [ # # ]: 0 : if (err)
1193 : : return 0;
1194 : :
1195 [ # # ]: 0 : if (hw->aq_link_status.mbps == 0) {
1196 : : /* write default (down) link status */
1197 : 0 : rte_eth_linkstatus_set(dev, &link);
1198 [ # # ]: 0 : if (link.link_status == old.link_status)
1199 : : return -1;
1200 : 0 : return 0;
1201 : : }
1202 : :
1203 : 0 : link.link_status = RTE_ETH_LINK_UP;
1204 : : link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
1205 : 0 : link.link_speed = hw->aq_link_status.mbps;
1206 : :
1207 : 0 : rte_eth_linkstatus_set(dev, &link);
1208 : :
1209 [ # # ]: 0 : if (link.link_status == old.link_status)
1210 : : return -1;
1211 : :
1212 : : /* Driver has to update flow control settings on RX block
1213 : : * on any link event.
1214 : : * We should query FW whether it negotiated FC.
1215 : : */
1216 [ # # ]: 0 : if (hw->aq_fw_ops->get_flow_control) {
1217 : 0 : hw->aq_fw_ops->get_flow_control(hw, &fc);
1218 : 0 : hw_atl_b0_set_fc(hw, fc, 0U);
1219 : : }
1220 : :
1221 [ # # ]: 0 : if (rte_eal_alarm_set(1000 * 1000,
1222 : : atl_dev_delayed_handler, (void *)dev) < 0)
1223 : 0 : PMD_DRV_LOG(ERR, "rte_eal_alarm_set fail");
1224 : :
1225 : : return 0;
1226 : : }
1227 : :
1228 : : static int
1229 : 0 : atl_dev_promiscuous_enable(struct rte_eth_dev *dev)
1230 : : {
1231 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1232 : :
1233 : 0 : hw_atl_rpfl2promiscuous_mode_en_set(hw, true);
1234 : :
1235 : 0 : return 0;
1236 : : }
1237 : :
1238 : : static int
1239 : 0 : atl_dev_promiscuous_disable(struct rte_eth_dev *dev)
1240 : : {
1241 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1242 : :
1243 : 0 : hw_atl_rpfl2promiscuous_mode_en_set(hw, false);
1244 : :
1245 : 0 : return 0;
1246 : : }
1247 : :
1248 : : static int
1249 : 0 : atl_dev_allmulticast_enable(struct rte_eth_dev *dev)
1250 : : {
1251 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1252 : :
1253 : 0 : hw_atl_rpfl2_accept_all_mc_packets_set(hw, true);
1254 : :
1255 : 0 : return 0;
1256 : : }
1257 : :
1258 : : static int
1259 : 0 : atl_dev_allmulticast_disable(struct rte_eth_dev *dev)
1260 : : {
1261 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1262 : :
1263 [ # # ]: 0 : if (dev->data->promiscuous == 1)
1264 : : return 0; /* must remain in all_multicast mode */
1265 : :
1266 : 0 : hw_atl_rpfl2_accept_all_mc_packets_set(hw, false);
1267 : :
1268 : 0 : return 0;
1269 : : }
1270 : :
1271 : : /**
1272 : : * It clears the interrupt causes and enables the interrupt.
1273 : : * It will be called once only during nic initialized.
1274 : : *
1275 : : * @param dev
1276 : : * Pointer to struct rte_eth_dev.
1277 : : * @param on
1278 : : * Enable or Disable.
1279 : : *
1280 : : * @return
1281 : : * - On success, zero.
1282 : : * - On failure, a negative value.
1283 : : */
1284 : :
1285 : : static int
1286 : : atl_dev_lsc_interrupt_setup(struct rte_eth_dev *dev, uint8_t on __rte_unused)
1287 : : {
1288 : 0 : atl_dev_link_status_print(dev);
1289 : 0 : return 0;
1290 : : }
1291 : :
1292 : : static int
1293 : : atl_dev_rxq_interrupt_setup(struct rte_eth_dev *dev __rte_unused)
1294 : : {
1295 : : return 0;
1296 : : }
1297 : :
1298 : :
1299 : : static int
1300 : 0 : atl_dev_interrupt_get_status(struct rte_eth_dev *dev)
1301 : : {
1302 : : struct atl_interrupt *intr =
1303 : 0 : ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
1304 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1305 : 0 : u64 cause = 0;
1306 : :
1307 : 0 : hw_atl_b0_hw_irq_read(hw, &cause);
1308 : :
1309 : 0 : atl_disable_intr(hw);
1310 : :
1311 [ # # ]: 0 : if (cause & BIT(ATL_IRQ_CAUSE_LINK))
1312 : 0 : intr->flags |= ATL_FLAG_NEED_LINK_UPDATE;
1313 : :
1314 : 0 : return 0;
1315 : : }
1316 : :
1317 : : /**
1318 : : * It gets and then prints the link status.
1319 : : *
1320 : : * @param dev
1321 : : * Pointer to struct rte_eth_dev.
1322 : : *
1323 : : * @return
1324 : : * - On success, zero.
1325 : : * - On failure, a negative value.
1326 : : */
1327 : : static void
1328 : 0 : atl_dev_link_status_print(struct rte_eth_dev *dev)
1329 : : {
1330 : : struct rte_eth_link link;
1331 : :
1332 : : memset(&link, 0, sizeof(link));
1333 : 0 : rte_eth_linkstatus_get(dev, &link);
1334 [ # # ]: 0 : if (link.link_status) {
1335 [ # # ]: 0 : PMD_DRV_LOG(INFO, "Port %d: Link Up - speed %u Mbps - %s",
1336 : : (int)(dev->data->port_id),
1337 : : (unsigned int)link.link_speed,
1338 : : link.link_duplex == RTE_ETH_LINK_FULL_DUPLEX ?
1339 : : "full-duplex" : "half-duplex");
1340 : : } else {
1341 : 0 : PMD_DRV_LOG(INFO, " Port %d: Link Down",
1342 : : (int)(dev->data->port_id));
1343 : : }
1344 : :
1345 : :
1346 : : #ifdef DEBUG
1347 : : {
1348 : : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
1349 : :
1350 : : PMD_DRV_LOG(DEBUG, "PCI Address: " PCI_PRI_FMT,
1351 : : pci_dev->addr.domain,
1352 : : pci_dev->addr.bus,
1353 : : pci_dev->addr.devid,
1354 : : pci_dev->addr.function);
1355 : : }
1356 : : #endif
1357 : :
1358 : 0 : PMD_DRV_LOG(INFO, "Link speed:%d", link.link_speed);
1359 : 0 : }
1360 : :
1361 : : /*
1362 : : * It executes link_update after knowing an interrupt occurred.
1363 : : *
1364 : : * @param dev
1365 : : * Pointer to struct rte_eth_dev.
1366 : : *
1367 : : * @return
1368 : : * - On success, zero.
1369 : : * - On failure, a negative value.
1370 : : */
1371 : : static int
1372 : 0 : atl_dev_interrupt_action(struct rte_eth_dev *dev,
1373 : : struct rte_intr_handle *intr_handle)
1374 : : {
1375 : : struct atl_interrupt *intr =
1376 : 0 : ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
1377 : : struct atl_adapter *adapter = dev->data->dev_private;
1378 : 0 : struct aq_hw_s *hw = &adapter->hw;
1379 : :
1380 [ # # ]: 0 : if (!(intr->flags & ATL_FLAG_NEED_LINK_UPDATE))
1381 : 0 : goto done;
1382 : :
1383 : 0 : intr->flags &= ~ATL_FLAG_NEED_LINK_UPDATE;
1384 : :
1385 : : /* Notify userapp if link status changed */
1386 [ # # ]: 0 : if (!atl_dev_link_update(dev, 0)) {
1387 : 0 : atl_dev_link_status_print(dev);
1388 : 0 : rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
1389 : : } else {
1390 [ # # ]: 0 : if (hw->aq_fw_ops->send_macsec_req == NULL)
1391 : 0 : goto done;
1392 : :
1393 : : /* Check macsec Keys expired */
1394 : : struct get_stats req = { 0 };
1395 : 0 : struct macsec_msg_fw_request msg = { 0 };
1396 : 0 : struct macsec_msg_fw_response resp = { 0 };
1397 : :
1398 : : req.ingress_sa_index = 0x0;
1399 : : req.egress_sc_index = 0x0;
1400 : : req.egress_sa_index = 0x0;
1401 : 0 : msg.msg_type = macsec_get_stats_msg;
1402 : : msg.stats = req;
1403 : :
1404 : 0 : int err = hw->aq_fw_ops->send_macsec_req(hw, &msg, &resp);
1405 [ # # ]: 0 : if (err) {
1406 : 0 : PMD_DRV_LOG(ERR, "send_macsec_req fail");
1407 : 0 : goto done;
1408 : : }
1409 [ # # ]: 0 : if (resp.stats.egress_threshold_expired ||
1410 [ # # ]: 0 : resp.stats.ingress_threshold_expired ||
1411 [ # # ]: 0 : resp.stats.egress_expired ||
1412 [ # # ]: 0 : resp.stats.ingress_expired) {
1413 : 0 : PMD_DRV_LOG(INFO, "RTE_ETH_EVENT_MACSEC");
1414 : 0 : rte_eth_dev_callback_process(dev,
1415 : : RTE_ETH_EVENT_MACSEC, NULL);
1416 : : }
1417 : : }
1418 : 0 : done:
1419 : : atl_enable_intr(dev);
1420 : 0 : rte_intr_ack(intr_handle);
1421 : :
1422 : 0 : return 0;
1423 : : }
1424 : :
1425 : : /**
1426 : : * Interrupt handler triggered by NIC for handling
1427 : : * specific interrupt.
1428 : : *
1429 : : * @param handle
1430 : : * Pointer to interrupt handle.
1431 : : * @param param
1432 : : * The address of parameter (struct rte_eth_dev *) registered before.
1433 : : *
1434 : : * @return
1435 : : * void
1436 : : */
1437 : : static void
1438 : 0 : atl_dev_interrupt_handler(void *param)
1439 : : {
1440 : : struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
1441 : :
1442 : 0 : atl_dev_interrupt_get_status(dev);
1443 : 0 : atl_dev_interrupt_action(dev, dev->intr_handle);
1444 : 0 : }
1445 : :
1446 : :
1447 : : static int
1448 : 0 : atl_dev_get_eeprom_length(struct rte_eth_dev *dev __rte_unused)
1449 : : {
1450 : 0 : return SFP_EEPROM_SIZE;
1451 : : }
1452 : :
1453 : 0 : int atl_dev_get_eeprom(struct rte_eth_dev *dev,
1454 : : struct rte_dev_eeprom_info *eeprom)
1455 : : {
1456 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1457 : : uint32_t dev_addr = SMBUS_DEVICE_ID;
1458 : :
1459 [ # # ]: 0 : if (hw->aq_fw_ops->get_eeprom == NULL)
1460 : : return -ENOTSUP;
1461 : :
1462 [ # # ]: 0 : if (eeprom->length + eeprom->offset > SFP_EEPROM_SIZE ||
1463 [ # # ]: 0 : eeprom->data == NULL)
1464 : : return -EINVAL;
1465 : :
1466 [ # # ]: 0 : if (eeprom->magic > 0x7F)
1467 : : return -EINVAL;
1468 : :
1469 [ # # ]: 0 : if (eeprom->magic)
1470 : : dev_addr = eeprom->magic;
1471 : :
1472 : 0 : return hw->aq_fw_ops->get_eeprom(hw, dev_addr, eeprom->data,
1473 : : eeprom->length, eeprom->offset);
1474 : : }
1475 : :
1476 : 0 : int atl_dev_set_eeprom(struct rte_eth_dev *dev,
1477 : : struct rte_dev_eeprom_info *eeprom)
1478 : : {
1479 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1480 : : uint32_t dev_addr = SMBUS_DEVICE_ID;
1481 : :
1482 [ # # ]: 0 : if (hw->aq_fw_ops->set_eeprom == NULL)
1483 : : return -ENOTSUP;
1484 : :
1485 [ # # ]: 0 : if (eeprom->length + eeprom->offset > SFP_EEPROM_SIZE ||
1486 [ # # ]: 0 : eeprom->data == NULL)
1487 : : return -EINVAL;
1488 : :
1489 [ # # ]: 0 : if (eeprom->magic > 0x7F)
1490 : : return -EINVAL;
1491 : :
1492 [ # # ]: 0 : if (eeprom->magic)
1493 : : dev_addr = eeprom->magic;
1494 : :
1495 : 0 : return hw->aq_fw_ops->set_eeprom(hw, dev_addr, eeprom->data,
1496 : : eeprom->length, eeprom->offset);
1497 : : }
1498 : :
1499 : : static int
1500 : 0 : atl_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs)
1501 : : {
1502 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1503 : : u32 mif_id;
1504 : : int err;
1505 : :
1506 [ # # ]: 0 : if (regs->data == NULL) {
1507 : 0 : regs->length = hw_atl_utils_hw_get_reg_length();
1508 : 0 : regs->width = sizeof(u32);
1509 : 0 : return 0;
1510 : : }
1511 : :
1512 : : /* Only full register dump is supported */
1513 [ # # # # ]: 0 : if (regs->length && regs->length != hw_atl_utils_hw_get_reg_length())
1514 : : return -ENOTSUP;
1515 : :
1516 : 0 : err = hw_atl_utils_hw_get_regs(hw, regs->data);
1517 : :
1518 : : /* Device version */
1519 : 0 : mif_id = hw_atl_reg_glb_mif_id_get(hw);
1520 : 0 : regs->version = mif_id & 0xFFU;
1521 : :
1522 : 0 : return err;
1523 : : }
1524 : :
1525 : : static int
1526 : 0 : atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
1527 : : {
1528 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1529 : 0 : u32 fc = AQ_NIC_FC_OFF;
1530 : :
1531 [ # # ]: 0 : if (hw->aq_fw_ops->get_flow_control == NULL)
1532 : : return -ENOTSUP;
1533 : :
1534 : 0 : hw->aq_fw_ops->get_flow_control(hw, &fc);
1535 : :
1536 [ # # ]: 0 : if (fc == AQ_NIC_FC_OFF)
1537 : 0 : fc_conf->mode = RTE_ETH_FC_NONE;
1538 [ # # ]: 0 : else if ((fc & AQ_NIC_FC_RX) && (fc & AQ_NIC_FC_TX))
1539 : 0 : fc_conf->mode = RTE_ETH_FC_FULL;
1540 [ # # ]: 0 : else if (fc & AQ_NIC_FC_RX)
1541 : 0 : fc_conf->mode = RTE_ETH_FC_RX_PAUSE;
1542 [ # # ]: 0 : else if (fc & AQ_NIC_FC_TX)
1543 : 0 : fc_conf->mode = RTE_ETH_FC_TX_PAUSE;
1544 : :
1545 : : return 0;
1546 : : }
1547 : :
1548 : : static int
1549 : 0 : atl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
1550 : : {
1551 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1552 : 0 : uint32_t old_flow_control = hw->aq_nic_cfg->flow_control;
1553 : :
1554 : :
1555 [ # # ]: 0 : if (hw->aq_fw_ops->set_flow_control == NULL)
1556 : : return -ENOTSUP;
1557 : :
1558 [ # # ]: 0 : if (fc_conf->mode == RTE_ETH_FC_NONE)
1559 : 0 : hw->aq_nic_cfg->flow_control = AQ_NIC_FC_OFF;
1560 [ # # ]: 0 : else if (fc_conf->mode == RTE_ETH_FC_RX_PAUSE)
1561 : 0 : hw->aq_nic_cfg->flow_control = AQ_NIC_FC_RX;
1562 [ # # ]: 0 : else if (fc_conf->mode == RTE_ETH_FC_TX_PAUSE)
1563 : 0 : hw->aq_nic_cfg->flow_control = AQ_NIC_FC_TX;
1564 [ # # ]: 0 : else if (fc_conf->mode == RTE_ETH_FC_FULL)
1565 : 0 : hw->aq_nic_cfg->flow_control = (AQ_NIC_FC_RX | AQ_NIC_FC_TX);
1566 : :
1567 [ # # ]: 0 : if (old_flow_control != hw->aq_nic_cfg->flow_control)
1568 : 0 : return hw->aq_fw_ops->set_flow_control(hw);
1569 : :
1570 : : return 0;
1571 : : }
1572 : :
1573 : : static int
1574 : 0 : atl_update_mac_addr(struct rte_eth_dev *dev, uint32_t index,
1575 : : u8 *mac_addr, bool enable)
1576 : : {
1577 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1578 : : unsigned int h = 0U;
1579 : : unsigned int l = 0U;
1580 : : int err;
1581 : :
1582 [ # # ]: 0 : if (mac_addr) {
1583 : 0 : h = (mac_addr[0] << 8) | (mac_addr[1]);
1584 : 0 : l = (mac_addr[2] << 24) | (mac_addr[3] << 16) |
1585 : 0 : (mac_addr[4] << 8) | mac_addr[5];
1586 : : }
1587 : :
1588 : 0 : hw_atl_rpfl2_uc_flr_en_set(hw, 0U, index);
1589 : 0 : hw_atl_rpfl2unicast_dest_addresslsw_set(hw, l, index);
1590 : 0 : hw_atl_rpfl2unicast_dest_addressmsw_set(hw, h, index);
1591 : :
1592 [ # # ]: 0 : if (enable)
1593 : 0 : hw_atl_rpfl2_uc_flr_en_set(hw, 1U, index);
1594 : :
1595 : 0 : err = aq_hw_err_from_flags(hw);
1596 : :
1597 : 0 : return err;
1598 : : }
1599 : :
1600 : : static int
1601 [ # # ]: 0 : atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
1602 : : uint32_t index __rte_unused, uint32_t pool __rte_unused)
1603 : : {
1604 [ # # ]: 0 : if (rte_is_zero_ether_addr(mac_addr)) {
1605 : 0 : PMD_DRV_LOG(ERR, "Invalid Ethernet Address");
1606 : 0 : return -EINVAL;
1607 : : }
1608 : :
1609 : 0 : return atl_update_mac_addr(dev, index, (u8 *)mac_addr, true);
1610 : : }
1611 : :
1612 : : static void
1613 : 0 : atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
1614 : : {
1615 : 0 : atl_update_mac_addr(dev, index, NULL, false);
1616 : 0 : }
1617 : :
1618 : : static int
1619 : 0 : atl_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr)
1620 : : {
1621 : : atl_remove_mac_addr(dev, 0);
1622 : 0 : atl_add_mac_addr(dev, addr, 0, 0);
1623 : 0 : return 0;
1624 : : }
1625 : :
1626 : : static int
1627 : 0 : atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
1628 : : {
1629 : : struct rte_eth_dev_info dev_info;
1630 : : int ret;
1631 : 0 : uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
1632 : :
1633 : 0 : ret = atl_dev_info_get(dev, &dev_info);
1634 [ # # ]: 0 : if (ret != 0)
1635 : : return ret;
1636 : :
1637 [ # # # # ]: 0 : if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen)
1638 : 0 : return -EINVAL;
1639 : :
1640 : : return 0;
1641 : : }
1642 : :
1643 : : static int
1644 : 0 : atl_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
1645 : : {
1646 : : struct aq_hw_cfg_s *cfg =
1647 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
1648 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1649 : : int err = 0;
1650 : : int i = 0;
1651 : :
1652 : 0 : PMD_INIT_FUNC_TRACE();
1653 : :
1654 [ # # ]: 0 : for (i = 0; i < HW_ATL_B0_MAX_VLAN_IDS; i++) {
1655 [ # # ]: 0 : if (cfg->vlan_filter[i] == vlan_id) {
1656 [ # # ]: 0 : if (!on) {
1657 : : /* Disable VLAN filter. */
1658 : 0 : hw_atl_rpf_vlan_flr_en_set(hw, 0U, i);
1659 : :
1660 : : /* Clear VLAN filter entry */
1661 : 0 : cfg->vlan_filter[i] = 0;
1662 : : }
1663 : : break;
1664 : : }
1665 : : }
1666 : :
1667 : : /* VLAN_ID was not found. So, nothing to delete. */
1668 [ # # ]: 0 : if (i == HW_ATL_B0_MAX_VLAN_IDS && !on)
1669 : 0 : goto exit;
1670 : :
1671 : : /* VLAN_ID already exist, or already removed above. Nothing to do. */
1672 [ # # ]: 0 : if (i != HW_ATL_B0_MAX_VLAN_IDS)
1673 : 0 : goto exit;
1674 : :
1675 : : /* Try to found free VLAN filter to add new VLAN_ID */
1676 [ # # ]: 0 : for (i = 0; i < HW_ATL_B0_MAX_VLAN_IDS; i++) {
1677 [ # # ]: 0 : if (cfg->vlan_filter[i] == 0)
1678 : : break;
1679 : : }
1680 : :
1681 [ # # ]: 0 : if (i == HW_ATL_B0_MAX_VLAN_IDS) {
1682 : : /* We have no free VLAN filter to add new VLAN_ID*/
1683 : : err = -ENOMEM;
1684 : 0 : goto exit;
1685 : : }
1686 : :
1687 : 0 : cfg->vlan_filter[i] = vlan_id;
1688 : 0 : hw_atl_rpf_vlan_flr_act_set(hw, 1U, i);
1689 : 0 : hw_atl_rpf_vlan_id_flr_set(hw, vlan_id, i);
1690 : 0 : hw_atl_rpf_vlan_flr_en_set(hw, 1U, i);
1691 : :
1692 : 0 : exit:
1693 : : /* Enable VLAN promisc mode if vlan_filter empty */
1694 [ # # ]: 0 : for (i = 0; i < HW_ATL_B0_MAX_VLAN_IDS; i++) {
1695 [ # # ]: 0 : if (cfg->vlan_filter[i] != 0)
1696 : : break;
1697 : : }
1698 : :
1699 : 0 : hw_atl_rpf_vlan_prom_mode_en_set(hw, i == HW_ATL_B0_MAX_VLAN_IDS);
1700 : :
1701 : 0 : return err;
1702 : : }
1703 : :
1704 : : static int
1705 : 0 : atl_enable_vlan_filter(struct rte_eth_dev *dev, int en)
1706 : : {
1707 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1708 : : struct aq_hw_cfg_s *cfg =
1709 : : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
1710 : : int i;
1711 : :
1712 : 0 : PMD_INIT_FUNC_TRACE();
1713 : :
1714 [ # # ]: 0 : for (i = 0; i < HW_ATL_B0_MAX_VLAN_IDS; i++) {
1715 [ # # ]: 0 : if (cfg->vlan_filter[i])
1716 : 0 : hw_atl_rpf_vlan_flr_en_set(hw, en, i);
1717 : : }
1718 : 0 : return 0;
1719 : : }
1720 : :
1721 : : static int
1722 : 0 : atl_vlan_offload_set(struct rte_eth_dev *dev, int mask)
1723 : : {
1724 : : struct aq_hw_cfg_s *cfg =
1725 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
1726 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1727 : : int ret = 0;
1728 : : int i;
1729 : :
1730 : 0 : PMD_INIT_FUNC_TRACE();
1731 : :
1732 : 0 : ret = atl_enable_vlan_filter(dev, mask & RTE_ETH_VLAN_FILTER_MASK);
1733 : :
1734 : 0 : cfg->vlan_strip = !!(mask & RTE_ETH_VLAN_STRIP_MASK);
1735 : :
1736 [ # # ]: 0 : for (i = 0; i < dev->data->nb_rx_queues; i++)
1737 : 0 : hw_atl_rpo_rx_desc_vlan_stripping_set(hw, cfg->vlan_strip, i);
1738 : :
1739 [ # # ]: 0 : if (mask & RTE_ETH_VLAN_EXTEND_MASK)
1740 : : ret = -ENOTSUP;
1741 : :
1742 : 0 : return ret;
1743 : : }
1744 : :
1745 : : static int
1746 : 0 : atl_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type,
1747 : : uint16_t tpid)
1748 : : {
1749 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1750 : : int err = 0;
1751 : :
1752 : 0 : PMD_INIT_FUNC_TRACE();
1753 : :
1754 [ # # # ]: 0 : switch (vlan_type) {
1755 : 0 : case RTE_ETH_VLAN_TYPE_INNER:
1756 : 0 : hw_atl_rpf_vlan_inner_etht_set(hw, tpid);
1757 : 0 : break;
1758 : 0 : case RTE_ETH_VLAN_TYPE_OUTER:
1759 : 0 : hw_atl_rpf_vlan_outer_etht_set(hw, tpid);
1760 : 0 : break;
1761 : 0 : default:
1762 : 0 : PMD_DRV_LOG(ERR, "Unsupported VLAN type");
1763 : : err = -ENOTSUP;
1764 : : }
1765 : :
1766 : 0 : return err;
1767 : : }
1768 : :
1769 : : static void
1770 : 0 : atl_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue_id, int on)
1771 : : {
1772 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1773 : :
1774 : 0 : PMD_INIT_FUNC_TRACE();
1775 : :
1776 [ # # ]: 0 : if (queue_id > dev->data->nb_rx_queues) {
1777 : 0 : PMD_DRV_LOG(ERR, "Invalid queue id");
1778 : 0 : return;
1779 : : }
1780 : :
1781 : 0 : hw_atl_rpo_rx_desc_vlan_stripping_set(hw, on, queue_id);
1782 : : }
1783 : :
1784 : : static int
1785 : 0 : atl_dev_set_mc_addr_list(struct rte_eth_dev *dev,
1786 : : struct rte_ether_addr *mc_addr_set,
1787 : : uint32_t nb_mc_addr)
1788 : : {
1789 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1790 : : u32 i;
1791 : :
1792 [ # # ]: 0 : if (nb_mc_addr > AQ_HW_MULTICAST_ADDRESS_MAX - HW_ATL_B0_MAC_MIN)
1793 : : return -EINVAL;
1794 : :
1795 : : /* Update whole uc filters table */
1796 [ # # ]: 0 : for (i = 0; i < AQ_HW_MULTICAST_ADDRESS_MAX - HW_ATL_B0_MAC_MIN; i++) {
1797 : : u8 *mac_addr = NULL;
1798 : : u32 l = 0, h = 0;
1799 : :
1800 [ # # ]: 0 : if (i < nb_mc_addr) {
1801 : 0 : mac_addr = mc_addr_set[i].addr_bytes;
1802 : 0 : l = (mac_addr[2] << 24) | (mac_addr[3] << 16) |
1803 : 0 : (mac_addr[4] << 8) | mac_addr[5];
1804 : 0 : h = (mac_addr[0] << 8) | mac_addr[1];
1805 : : }
1806 : :
1807 : 0 : hw_atl_rpfl2_uc_flr_en_set(hw, 0U, HW_ATL_B0_MAC_MIN + i);
1808 : 0 : hw_atl_rpfl2unicast_dest_addresslsw_set(hw, l,
1809 : : HW_ATL_B0_MAC_MIN + i);
1810 : 0 : hw_atl_rpfl2unicast_dest_addressmsw_set(hw, h,
1811 : : HW_ATL_B0_MAC_MIN + i);
1812 : 0 : hw_atl_rpfl2_uc_flr_en_set(hw, !!mac_addr,
1813 : : HW_ATL_B0_MAC_MIN + i);
1814 : : }
1815 : :
1816 : : return 0;
1817 : : }
1818 : :
1819 : : static int
1820 : 0 : atl_reta_update(struct rte_eth_dev *dev,
1821 : : struct rte_eth_rss_reta_entry64 *reta_conf,
1822 : : uint16_t reta_size)
1823 : : {
1824 : : int i;
1825 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1826 : : struct aq_hw_cfg_s *cf = ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
1827 : :
1828 [ # # # # ]: 0 : for (i = 0; i < reta_size && i < cf->aq_rss.indirection_table_size; i++)
1829 : 0 : cf->aq_rss.indirection_table[i] = min(reta_conf->reta[i],
1830 : : dev->data->nb_rx_queues - 1);
1831 : :
1832 : 0 : hw_atl_b0_hw_rss_set(hw, &cf->aq_rss);
1833 : 0 : return 0;
1834 : : }
1835 : :
1836 : : static int
1837 : 0 : atl_reta_query(struct rte_eth_dev *dev,
1838 : : struct rte_eth_rss_reta_entry64 *reta_conf,
1839 : : uint16_t reta_size)
1840 : : {
1841 : : int i;
1842 : 0 : struct aq_hw_cfg_s *cf = ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
1843 : :
1844 [ # # # # ]: 0 : for (i = 0; i < reta_size && i < cf->aq_rss.indirection_table_size; i++)
1845 : 0 : reta_conf->reta[i] = cf->aq_rss.indirection_table[i];
1846 : 0 : reta_conf->mask = ~0U;
1847 : 0 : return 0;
1848 : : }
1849 : :
1850 : : static int
1851 : 0 : atl_rss_hash_update(struct rte_eth_dev *dev,
1852 : : struct rte_eth_rss_conf *rss_conf)
1853 : : {
1854 : 0 : struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1855 : : struct aq_hw_cfg_s *cfg =
1856 : : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
1857 : : static u8 def_rss_key[40] = {
1858 : : 0x1e, 0xad, 0x71, 0x87, 0x65, 0xfc, 0x26, 0x7d,
1859 : : 0x0d, 0x45, 0x67, 0x74, 0xcd, 0x06, 0x1a, 0x18,
1860 : : 0xb6, 0xc1, 0xf0, 0xc7, 0xbb, 0x18, 0xbe, 0xf8,
1861 : : 0x19, 0x13, 0x4b, 0xa9, 0xd0, 0x3e, 0xfe, 0x70,
1862 : : 0x25, 0x03, 0xab, 0x50, 0x6a, 0x8b, 0x82, 0x0c
1863 : : };
1864 : :
1865 : 0 : cfg->is_rss = !!rss_conf->rss_hf;
1866 [ # # ]: 0 : if (rss_conf->rss_key) {
1867 : 0 : memcpy(cfg->aq_rss.hash_secret_key, rss_conf->rss_key,
1868 : 0 : rss_conf->rss_key_len);
1869 : 0 : cfg->aq_rss.hash_secret_key_size = rss_conf->rss_key_len;
1870 : : } else {
1871 : 0 : memcpy(cfg->aq_rss.hash_secret_key, def_rss_key,
1872 : : sizeof(def_rss_key));
1873 : 0 : cfg->aq_rss.hash_secret_key_size = sizeof(def_rss_key);
1874 : : }
1875 : :
1876 : 0 : hw_atl_b0_hw_rss_set(hw, &cfg->aq_rss);
1877 : 0 : hw_atl_b0_hw_rss_hash_set(hw, &cfg->aq_rss);
1878 : 0 : return 0;
1879 : : }
1880 : :
1881 : : static int
1882 : 0 : atl_rss_hash_conf_get(struct rte_eth_dev *dev,
1883 : : struct rte_eth_rss_conf *rss_conf)
1884 : : {
1885 : : struct aq_hw_cfg_s *cfg =
1886 : 0 : ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
1887 : :
1888 [ # # ]: 0 : rss_conf->rss_hf = cfg->is_rss ? ATL_RSS_OFFLOAD_ALL : 0;
1889 [ # # ]: 0 : if (rss_conf->rss_key) {
1890 : 0 : rss_conf->rss_key_len = cfg->aq_rss.hash_secret_key_size;
1891 : 0 : memcpy(rss_conf->rss_key, cfg->aq_rss.hash_secret_key,
1892 : : rss_conf->rss_key_len);
1893 : : }
1894 : :
1895 : 0 : return 0;
1896 : : }
1897 : :
1898 : : static bool
1899 : : is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv)
1900 : : {
1901 : 0 : if (strcmp(dev->device->driver->name, drv->driver.name))
1902 : 0 : return false;
1903 : :
1904 : : return true;
1905 : : }
1906 : :
1907 : : bool
1908 [ # # ]: 0 : is_atlantic_supported(struct rte_eth_dev *dev)
1909 : : {
1910 : 0 : return is_device_supported(dev, &rte_atl_pmd);
1911 : : }
1912 : :
1913 : 286 : RTE_PMD_REGISTER_PCI(net_atlantic, rte_atl_pmd);
1914 : : RTE_PMD_REGISTER_PCI_TABLE(net_atlantic, pci_id_atl_map);
1915 : : RTE_PMD_REGISTER_KMOD_DEP(net_atlantic, "* igb_uio | uio_pci_generic");
1916 [ - + ]: 286 : RTE_LOG_REGISTER_SUFFIX(atl_logtype_init, init, NOTICE);
1917 [ - + ]: 286 : RTE_LOG_REGISTER_SUFFIX(atl_logtype_driver, driver, NOTICE);
|