Lines Matching defs:wx

42 static void txgbe_check_minimum_link(struct wx *wx)
46 pdev = wx->pdev;
52 * @wx: wx structure
59 static int txgbe_enumerate_functions(struct wx *wx)
61 struct pci_dev *entry, *pdev = wx->pdev;
80 static void txgbe_up_complete(struct wx *wx)
82 struct net_device *netdev = wx->netdev;
84 txgbe_reinit_gpio_intr(wx);
85 wx_control_hw(wx, true);
86 wx_configure_vectors(wx);
90 wx_napi_enable_all(wx);
92 phylink_start(wx->phylink);
95 rd32(wx, WX_PX_IC(0));
96 rd32(wx, WX_PX_IC(1));
97 rd32(wx, WX_PX_MISC_IC);
98 txgbe_irq_enable(wx, true);
104 static void txgbe_reset(struct wx *wx)
106 struct net_device *netdev = wx->netdev;
110 err = txgbe_reset_hw(wx);
112 wx_err(wx, "Hardware Error: %d\n", err);
114 wx_start_hw(wx);
116 memcpy(old_addr, &wx->mac_table[0].addr, netdev->addr_len);
117 wx_flush_sw_mac_table(wx);
118 wx_mac_set_default_filter(wx, old_addr);
121 static void txgbe_disable_device(struct wx *wx)
123 struct net_device *netdev = wx->netdev;
126 wx_disable_pcie_master(wx);
128 wx_disable_rx(wx);
131 for (i = 0; i < wx->num_rx_queues; i++)
133 wx_disable_rx_queue(wx, wx->rx_ring[i]);
138 wx_irq_disable(wx);
139 wx_napi_disable_all(wx);
141 if (wx->bus.func < 2)
142 wr32m(wx, TXGBE_MIS_PRB_CTL, TXGBE_MIS_PRB_CTL_LAN_UP(wx->bus.func), 0);
144 wx_err(wx, "%s: invalid bus lan id %d\n",
145 __func__, wx->bus.func);
147 if (!(((wx->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) ||
148 ((wx->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP))) {
150 wr32m(wx, WX_MAC_TX_CFG, WX_MAC_TX_CFG_TE, 0);
154 for (i = 0; i < wx->num_tx_queues; i++) {
155 u8 reg_idx = wx->tx_ring[i]->reg_idx;
157 wr32(wx, WX_PX_TR_CFG(reg_idx), WX_PX_TR_CFG_SWFLSH);
161 wr32m(wx, WX_TDM_CTL, WX_TDM_CTL_TE, 0);
163 wx_update_stats(wx);
166 void txgbe_down(struct wx *wx)
168 txgbe_disable_device(wx);
169 txgbe_reset(wx);
170 phylink_stop(wx->phylink);
172 wx_clean_all_tx_rings(wx);
173 wx_clean_all_rx_rings(wx);
176 void txgbe_up(struct wx *wx)
178 wx_configure(wx);
179 txgbe_up_complete(wx);
184 * @wx: pointer to hardware structure
186 static void txgbe_init_type_code(struct wx *wx)
188 u8 device_type = wx->subsystem_device_id & 0xF0;
190 switch (wx->device_id) {
193 wx->mac.type = wx_mac_sp;
196 wx->mac.type = wx_mac_unknown;
202 wx->media_type = sp_media_fiber;
206 wx->media_type = sp_media_copper;
211 wx->media_type = sp_media_backplane;
214 if (wx->bus.func == 0)
215 wx->media_type = sp_media_fiber;
217 wx->media_type = sp_media_copper;
220 wx->media_type = sp_media_unknown;
226 * txgbe_sw_init - Initialize general software structures (struct wx)
227 * @wx: board private structure to initialize
229 static int txgbe_sw_init(struct wx *wx)
234 wx->mac.num_rar_entries = TXGBE_SP_RAR_ENTRIES;
235 wx->mac.max_tx_queues = TXGBE_SP_MAX_TX_QUEUES;
236 wx->mac.max_rx_queues = TXGBE_SP_MAX_RX_QUEUES;
237 wx->mac.mcft_size = TXGBE_SP_MC_TBL_SIZE;
238 wx->mac.vft_size = TXGBE_SP_VFT_TBL_SIZE;
239 wx->mac.rx_pb_size = TXGBE_SP_RX_PB_SIZE;
240 wx->mac.tx_pb_size = TXGBE_SP_TDB_PB_SZ;
243 err = wx_sw_init(wx);
247 txgbe_init_type_code(wx);
250 wx->max_q_vectors = TXGBE_MAX_MSIX_VECTORS;
251 err = wx_get_pcie_msix_counts(wx, &msix_count, TXGBE_MAX_MSIX_VECTORS);
253 wx_err(wx, "Do not support MSI-X\n");
254 wx->mac.max_msix_vectors = msix_count;
256 wx->ring_feature[RING_F_RSS].limit = min_t(int, TXGBE_MAX_RSS_INDICES,
258 wx->rss_enabled = true;
261 wx->rx_itr_setting = 1;
262 wx->tx_itr_setting = 1;
265 wx->tx_ring_count = TXGBE_DEFAULT_TXD;
266 wx->rx_ring_count = TXGBE_DEFAULT_RXD;
269 wx->tx_work_limit = TXGBE_DEFAULT_TX_WORK;
270 wx->rx_work_limit = TXGBE_DEFAULT_RX_WORK;
286 struct wx *wx = netdev_priv(netdev);
289 err = wx_setup_resources(wx);
293 wx_configure(wx);
295 err = txgbe_request_irq(wx);
300 err = netif_set_real_num_tx_queues(netdev, wx->num_tx_queues);
304 err = netif_set_real_num_rx_queues(netdev, wx->num_rx_queues);
308 txgbe_up_complete(wx);
313 wx_free_irq(wx);
315 wx_free_isb_resources(wx);
317 txgbe_reset(wx);
324 * @wx: the private wx struct
329 static void txgbe_close_suspend(struct wx *wx)
331 txgbe_disable_device(wx);
332 wx_free_resources(wx);
348 struct wx *wx = netdev_priv(netdev);
350 txgbe_down(wx);
351 wx_free_irq(wx);
352 wx_free_resources(wx);
353 wx_control_hw(wx, false);
360 struct wx *wx = pci_get_drvdata(pdev);
363 netdev = wx->netdev;
368 txgbe_close_suspend(wx);
371 wx_control_hw(wx, false);
395 struct wx *wx = netdev_priv(dev);
396 struct txgbe *txgbe = wx->priv;
405 txgbe_reset(wx);
408 wx_clear_interrupt_scheme(wx);
415 wx_init_interrupt_scheme(wx);
446 * The OS initialization, configuring of the wx private structure,
454 struct wx *wx = NULL;
485 sizeof(struct wx),
495 wx = netdev_priv(netdev);
496 wx->netdev = netdev;
497 wx->pdev = pdev;
499 wx->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1;
501 wx->hw_addr = devm_ioremap(&pdev->dev,
504 if (!wx->hw_addr) {
509 wx->driver_name = txgbe_driver_name;
514 err = txgbe_sw_init(wx);
519 err = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_PERST);
522 err = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_PWRRST);
526 err = wx_mng_present(wx);
532 err = txgbe_reset_hw(wx);
567 err = txgbe_validate_eeprom_checksum(wx, NULL);
570 wr32(wx, WX_MIS_RST, WX_MIS_RST_SW_RST);
575 eth_hw_addr_set(netdev, wx->mac.perm_addr);
576 wx_mac_set_default_filter(wx, wx->mac.perm_addr);
578 err = wx_init_interrupt_scheme(wx);
585 wx_read_ee_hostif(wx,
586 wx->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_H,
588 wx_read_ee_hostif(wx,
589 wx->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_L,
593 wx_read_ee_hostif(wx,
594 wx->eeprom.sw_region_offset + TXGBE_ISCSI_BOOT_CONFIG,
599 wx_read_ee_hostif(wx, offset + 0x84, &eeprom_cfg_blkh);
600 wx_read_ee_hostif(wx, offset + 0x83, &eeprom_cfg_blkl);
608 snprintf(wx->eeprom_id, sizeof(wx->eeprom_id),
612 snprintf(wx->eeprom_id, sizeof(wx->eeprom_id),
616 snprintf(wx->eeprom_id, sizeof(wx->eeprom_id),
629 txgbe->wx = wx;
630 wx->priv = txgbe;
644 pci_set_drvdata(pdev, wx);
654 expected_gts = txgbe_enumerate_functions(wx) * 10;
658 txgbe_check_minimum_link(wx);
669 wx_clear_interrupt_scheme(wx);
670 wx_control_hw(wx, false);
672 kfree(wx->mac_table);
692 struct wx *wx = pci_get_drvdata(pdev);
693 struct txgbe *txgbe = wx->priv;
696 netdev = wx->netdev;
705 kfree(wx->rss_key);
706 kfree(wx->mac_table);
707 wx_clear_interrupt_scheme(wx);