Lines Matching defs:priv

22 static void hbg_all_irq_enable(struct hbg_priv *priv, bool enabled)
27 for (i = 0; i < priv->vectors.info_array_len; i++) {
28 info = &priv->vectors.info_array[i];
29 hbg_hw_irq_enable(priv, info->mask, enabled);
35 struct hbg_priv *priv = netdev_priv(netdev);
38 ret = hbg_txrx_init(priv);
42 hbg_all_irq_enable(priv, true);
43 hbg_hw_mac_enable(priv, HBG_STATUS_ENABLE);
45 hbg_phy_start(priv);
51 static int hbg_hw_txrx_clear(struct hbg_priv *priv)
58 ret = hbg_hw_event_notify(priv, HBG_HW_EVENT_RESET);
63 return hbg_rebuild(priv);
68 struct hbg_priv *priv = netdev_priv(netdev);
70 hbg_phy_stop(priv);
72 hbg_hw_mac_enable(priv, HBG_STATUS_DISABLE);
73 hbg_all_irq_enable(priv, false);
74 hbg_txrx_uninit(priv);
75 return hbg_hw_txrx_clear(priv);
80 struct hbg_priv *priv = netdev_priv(netdev);
86 priv->filter.enabled = !(overflow || (netdev->flags & IFF_PROMISC));
87 hbg_hw_set_mac_filter_enable(priv, priv->filter.enabled);
90 static void hbg_set_mac_to_mac_table(struct hbg_priv *priv,
94 ether_addr_copy(priv->filter.mac_table[index].addr, addr);
95 hbg_hw_set_uc_addr(priv, ether_addr_to_u64(addr), index);
97 eth_zero_addr(priv->filter.mac_table[index].addr);
98 hbg_hw_set_uc_addr(priv, 0, index);
102 static int hbg_get_index_from_mac_table(struct hbg_priv *priv,
107 for (i = 0; i < priv->filter.table_max_len; i++)
108 if (ether_addr_equal(priv->filter.mac_table[i].addr, addr)) {
116 static int hbg_add_mac_to_filter(struct hbg_priv *priv, const u8 *addr)
121 if (!hbg_get_index_from_mac_table(priv, addr, &index))
124 for (index = 0; index < priv->filter.table_max_len; index++)
125 if (is_zero_ether_addr(priv->filter.mac_table[index].addr)) {
126 hbg_set_mac_to_mac_table(priv, index, addr);
133 static void hbg_del_mac_from_filter(struct hbg_priv *priv, const u8 *addr)
138 if (hbg_get_index_from_mac_table(priv, addr, &index))
141 hbg_set_mac_to_mac_table(priv, index, NULL);
146 struct hbg_priv *priv = netdev_priv(netdev);
148 return hbg_add_mac_to_filter(priv, addr);
153 struct hbg_priv *priv = netdev_priv(netdev);
158 hbg_del_mac_from_filter(priv, addr);
174 struct hbg_priv *priv = netdev_priv(netdev);
189 exists = !hbg_get_index_from_mac_table(priv, mac_addr, &index);
190 hbg_set_mac_to_mac_table(priv, 0, mac_addr);
192 hbg_set_mac_to_mac_table(priv, index, NULL);
194 hbg_hw_set_rx_pause_mac_addr(priv, ether_addr_to_u64(mac_addr));
201 struct hbg_priv *priv = netdev_priv(netdev);
206 dev_dbg(&priv->pdev->dev,
209 hbg_hw_set_mtu(priv, new_mtu);
217 struct hbg_priv *priv = netdev_priv(netdev);
218 struct hbg_ring *ring = &priv->tx_ring;
222 priv->stats.tx_timeout_cnt++;
225 "tx_timeout cnt: %llu\n", priv->stats.tx_timeout_cnt);
229 hbg_hw_get_fifo_used_num(priv, HBG_DIR_TX));
233 hbg_hw_irq_is_enabled(priv, HBG_INT_MSK_TX_B));
241 struct hbg_priv *priv = netdev_priv(netdev);
242 struct hbg_stats *h_stats = &priv->stats;
244 hbg_update_stats(priv);
286 struct hbg_priv *priv = container_of(work, struct hbg_priv,
289 if (test_and_clear_bit(HBG_NIC_STATE_NEED_RESET, &priv->state))
290 hbg_err_reset(priv);
292 if (test_and_clear_bit(HBG_NIC_STATE_NP_LINK_FAIL, &priv->state))
293 hbg_fix_np_link_fail(priv);
295 hbg_diagnose_message_push(priv);
301 if (time_after(jiffies, priv->last_update_stats_time + 30 * HZ)) {
302 hbg_update_stats(priv);
303 priv->last_update_stats_time = jiffies;
306 schedule_delayed_work(&priv->service_task,
310 void hbg_err_reset_task_schedule(struct hbg_priv *priv)
312 set_bit(HBG_NIC_STATE_NEED_RESET, &priv->state);
313 schedule_delayed_work(&priv->service_task, 0);
316 void hbg_np_link_fail_task_schedule(struct hbg_priv *priv)
318 set_bit(HBG_NIC_STATE_NP_LINK_FAIL, &priv->state);
319 schedule_delayed_work(&priv->service_task, 0);
327 static int hbg_delaywork_init(struct hbg_priv *priv)
329 INIT_DELAYED_WORK(&priv->service_task, hbg_service_task);
330 schedule_delayed_work(&priv->service_task, 0);
331 return devm_add_action_or_reset(&priv->pdev->dev,
333 &priv->service_task);
336 static int hbg_mac_filter_init(struct hbg_priv *priv)
338 struct hbg_dev_specs *dev_specs = &priv->dev_specs;
339 struct hbg_mac_filter *filter = &priv->filter;
342 tmp_table = devm_kcalloc(&priv->pdev->dev, dev_specs->uc_mac_num,
351 hbg_hw_set_mac_filter_enable(priv, filter->enabled);
355 static void hbg_init_user_def(struct hbg_priv *priv)
357 struct ethtool_pauseparam *pause_param = &priv->user_def.pause_param;
359 priv->mac.pause_autoneg = HBG_STATUS_ENABLE;
361 pause_param->autoneg = priv->mac.pause_autoneg;
362 hbg_hw_get_pause_enable(priv, &pause_param->tx_pause,
366 static int hbg_init(struct hbg_priv *priv)
370 ret = hbg_hw_event_notify(priv, HBG_HW_EVENT_INIT);
374 ret = hbg_hw_init(priv);
378 ret = hbg_irq_init(priv);
382 ret = hbg_mdio_init(priv);
386 ret = hbg_mac_filter_init(priv);
390 ret = hbg_delaywork_init(priv);
394 hbg_debugfs_init(priv);
395 hbg_init_user_def(priv);
402 struct hbg_priv *priv = netdev_priv(netdev);
418 priv->io_base = pcim_iomap_table(pdev)[0];
419 if (!priv->io_base)
430 struct hbg_priv *priv;
440 priv = netdev_priv(netdev);
441 priv->netdev = netdev;
442 priv->pdev = pdev;
448 ret = hbg_init(priv);
458 netdev->max_mtu = priv->dev_specs.max_mtu;
459 netdev->min_mtu = priv->dev_specs.min_mtu;
463 hbg_hw_set_mtu(priv, ETH_DATA_LEN);
464 hbg_net_set_mac_address(priv->netdev, &priv->dev_specs.mac_addr);