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