Lines Matching +full:num +full:- +full:vectors

1 // SPDX-License-Identifier: GPL-2.0+
27 for (i = 0; i < priv->vectors.info_array_len; i++) { in hbg_all_irq_enable()
28 info = &priv->vectors.info_array[i]; in hbg_all_irq_enable()
29 hbg_hw_irq_enable(priv, info->mask, enabled); in hbg_all_irq_enable()
82 /* Only when not table_overflow, and netdev->flags not set IFF_PROMISC, in hbg_update_promisc_mode()
86 priv->filter.enabled = !(overflow || (netdev->flags & IFF_PROMISC)); in hbg_update_promisc_mode()
87 hbg_hw_set_mac_filter_enable(priv, priv->filter.enabled); in hbg_update_promisc_mode()
94 ether_addr_copy(priv->filter.mac_table[index].addr, addr); in hbg_set_mac_to_mac_table()
97 eth_zero_addr(priv->filter.mac_table[index].addr); in hbg_set_mac_to_mac_table()
107 for (i = 0; i < priv->filter.table_max_len; i++) in hbg_get_index_from_mac_table()
108 if (ether_addr_equal(priv->filter.mac_table[i].addr, addr)) { in hbg_get_index_from_mac_table()
113 return -EINVAL; in hbg_get_index_from_mac_table()
124 for (index = 0; index < priv->filter.table_max_len; index++) in hbg_add_mac_to_filter()
125 if (is_zero_ether_addr(priv->filter.mac_table[index].addr)) { in hbg_add_mac_to_filter()
130 return -ENOSPC; in hbg_add_mac_to_filter()
155 if (ether_addr_equal(netdev->dev_addr, (u8 *)addr)) in hbg_uc_unsync()
179 mac_addr = ((struct sockaddr *)addr)->sa_data; in hbg_net_set_mac_address()
182 return -EADDRNOTAVAIL; in hbg_net_set_mac_address()
204 return -EBUSY; in hbg_net_change_mtu()
206 dev_dbg(&priv->pdev->dev, in hbg_net_change_mtu()
207 "change mtu from %u to %u\n", netdev->mtu, new_mtu); in hbg_net_change_mtu()
210 WRITE_ONCE(netdev->mtu, new_mtu); in hbg_net_change_mtu()
218 struct hbg_ring *ring = &priv->tx_ring; in hbg_net_tx_timeout()
219 char *buf = ring->tout_log_buf; in hbg_net_tx_timeout()
222 priv->stats.tx_timeout_cnt++; in hbg_net_tx_timeout()
224 pos += scnprintf(buf + pos, HBG_TX_TIMEOUT_BUF_LEN - pos, in hbg_net_tx_timeout()
225 "tx_timeout cnt: %llu\n", priv->stats.tx_timeout_cnt); in hbg_net_tx_timeout()
226 pos += scnprintf(buf + pos, HBG_TX_TIMEOUT_BUF_LEN - pos, in hbg_net_tx_timeout()
227 "ring used num: %u, fifo used num: %u\n", in hbg_net_tx_timeout()
230 pos += scnprintf(buf + pos, HBG_TX_TIMEOUT_BUF_LEN - pos, in hbg_net_tx_timeout()
232 ring->ntc, ring->ntu, in hbg_net_tx_timeout()
242 struct hbg_stats *h_stats = &priv->stats; in hbg_net_get_stats()
248 stats->tx_fifo_errors += h_stats->tx_drop_cnt; in hbg_net_get_stats()
250 stats->tx_dropped += h_stats->tx_excessive_length_drop_cnt + in hbg_net_get_stats()
251 h_stats->tx_drop_cnt; in hbg_net_get_stats()
252 stats->tx_errors += h_stats->tx_add_cs_fail_cnt + in hbg_net_get_stats()
253 h_stats->tx_bufrl_err_cnt + in hbg_net_get_stats()
254 h_stats->tx_underrun_err_cnt + in hbg_net_get_stats()
255 h_stats->tx_crc_err_cnt; in hbg_net_get_stats()
256 stats->rx_errors += h_stats->rx_data_error_cnt; in hbg_net_get_stats()
257 stats->multicast += h_stats->rx_mc_pkt_cnt; in hbg_net_get_stats()
258 stats->rx_dropped += h_stats->rx_desc_drop; in hbg_net_get_stats()
259 stats->rx_length_errors += h_stats->rx_frame_very_long_err_cnt + in hbg_net_get_stats()
260 h_stats->rx_frame_long_err_cnt + in hbg_net_get_stats()
261 h_stats->rx_frame_runt_err_cnt + in hbg_net_get_stats()
262 h_stats->rx_frame_short_err_cnt + in hbg_net_get_stats()
263 h_stats->rx_lengthfield_err_cnt; in hbg_net_get_stats()
264 stats->rx_frame_errors += h_stats->rx_desc_l2_err_cnt + in hbg_net_get_stats()
265 h_stats->rx_desc_l3l4_err_cnt; in hbg_net_get_stats()
266 stats->rx_fifo_errors += h_stats->rx_overflow_cnt + in hbg_net_get_stats()
267 h_stats->rx_overrun_cnt; in hbg_net_get_stats()
268 stats->rx_crc_errors += h_stats->rx_fcs_error_cnt; in hbg_net_get_stats()
289 if (test_and_clear_bit(HBG_NIC_STATE_NEED_RESET, &priv->state)) in hbg_service_task()
292 if (test_and_clear_bit(HBG_NIC_STATE_NP_LINK_FAIL, &priv->state)) in hbg_service_task()
301 if (time_after(jiffies, priv->last_update_stats_time + 30 * HZ)) { in hbg_service_task()
303 priv->last_update_stats_time = jiffies; in hbg_service_task()
306 schedule_delayed_work(&priv->service_task, in hbg_service_task()
312 set_bit(HBG_NIC_STATE_NEED_RESET, &priv->state); in hbg_err_reset_task_schedule()
313 schedule_delayed_work(&priv->service_task, 0); in hbg_err_reset_task_schedule()
318 set_bit(HBG_NIC_STATE_NP_LINK_FAIL, &priv->state); in hbg_np_link_fail_task_schedule()
319 schedule_delayed_work(&priv->service_task, 0); in hbg_np_link_fail_task_schedule()
329 INIT_DELAYED_WORK(&priv->service_task, hbg_service_task); in hbg_delaywork_init()
330 schedule_delayed_work(&priv->service_task, 0); in hbg_delaywork_init()
331 return devm_add_action_or_reset(&priv->pdev->dev, in hbg_delaywork_init()
333 &priv->service_task); in hbg_delaywork_init()
338 struct hbg_dev_specs *dev_specs = &priv->dev_specs; in hbg_mac_filter_init()
339 struct hbg_mac_filter *filter = &priv->filter; in hbg_mac_filter_init()
342 tmp_table = devm_kcalloc(&priv->pdev->dev, dev_specs->uc_mac_num, in hbg_mac_filter_init()
345 return -ENOMEM; in hbg_mac_filter_init()
347 filter->mac_table = tmp_table; in hbg_mac_filter_init()
348 filter->table_max_len = dev_specs->uc_mac_num; in hbg_mac_filter_init()
349 filter->enabled = true; in hbg_mac_filter_init()
351 hbg_hw_set_mac_filter_enable(priv, filter->enabled); in hbg_mac_filter_init()
357 struct ethtool_pauseparam *pause_param = &priv->user_def.pause_param; in hbg_init_user_def()
359 priv->mac.pause_autoneg = HBG_STATUS_ENABLE; in hbg_init_user_def()
361 pause_param->autoneg = priv->mac.pause_autoneg; in hbg_init_user_def()
362 hbg_hw_get_pause_enable(priv, &pause_param->tx_pause, in hbg_init_user_def()
363 &pause_param->rx_pause); in hbg_init_user_def()
403 struct device *dev = &pdev->dev; in hbg_pci_init()
418 priv->io_base = pcim_iomap_table(pdev)[0]; in hbg_pci_init()
419 if (!priv->io_base) in hbg_pci_init()
420 return dev_err_probe(dev, -ENOMEM, "failed to get io base\n"); in hbg_pci_init()
428 struct device *dev = &pdev->dev; in hbg_probe()
435 return -ENOMEM; in hbg_probe()
441 priv->netdev = netdev; in hbg_probe()
442 priv->pdev = pdev; in hbg_probe()
453 netdev->features |= HBG_SUPPORT_FEATURES; in hbg_probe()
454 netdev->hw_features |= HBG_SUPPORT_FEATURES; in hbg_probe()
455 netdev->priv_flags |= IFF_UNICAST_FLT; in hbg_probe()
457 netdev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; in hbg_probe()
458 netdev->max_mtu = priv->dev_specs.max_mtu; in hbg_probe()
459 netdev->min_mtu = priv->dev_specs.min_mtu; in hbg_probe()
460 netdev->netdev_ops = &hbg_netdev_ops; in hbg_probe()
461 netdev->watchdog_timeo = 5 * HZ; in hbg_probe()
464 hbg_net_set_mac_address(priv->netdev, &priv->dev_specs.mac_addr); in hbg_probe()