Lines Matching +full:co +full:- +full:located

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2015 - 2022 Beijing WangXun Technology Co., Ltd. */
26 /* txgbe_pci_tbl - PCI Device ID Table
47 pdev = wx->pdev; in txgbe_check_minimum_link()
52 * txgbe_enumerate_functions - Get the number of ports this device has
55 * This function enumerates the phsyical functions co-located on a single slot,
62 struct pci_dev *entry, *pdev = wx->pdev; in txgbe_enumerate_functions()
65 list_for_each_entry(entry, &pdev->bus->devices, bus_list) { in txgbe_enumerate_functions()
69 * attached to a virtual machine using VT-d. in txgbe_enumerate_functions()
71 if (entry->vendor != pdev->vendor || in txgbe_enumerate_functions()
72 entry->device != pdev->device) in txgbe_enumerate_functions()
73 return -EINVAL; in txgbe_enumerate_functions()
83 struct net_device *netdev = wx->netdev; in txgbe_up_complete()
89 /* make sure to complete pre-operations */ in txgbe_up_complete()
93 phylink_start(wx->phylink); in txgbe_up_complete()
107 struct net_device *netdev = wx->netdev; in txgbe_reset()
117 memcpy(old_addr, &wx->mac_table[0].addr, netdev->addr_len); in txgbe_reset()
124 struct net_device *netdev = wx->netdev; in txgbe_disable_device()
132 for (i = 0; i < wx->num_rx_queues; i++) in txgbe_disable_device()
134 wx_disable_rx_queue(wx, wx->rx_ring[i]); in txgbe_disable_device()
142 if (wx->bus.func < 2) in txgbe_disable_device()
143 wr32m(wx, TXGBE_MIS_PRB_CTL, TXGBE_MIS_PRB_CTL_LAN_UP(wx->bus.func), 0); in txgbe_disable_device()
146 __func__, wx->bus.func); in txgbe_disable_device()
148 if (!(((wx->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) || in txgbe_disable_device()
149 ((wx->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP))) { in txgbe_disable_device()
155 for (i = 0; i < wx->num_tx_queues; i++) { in txgbe_disable_device()
156 u8 reg_idx = wx->tx_ring[i]->reg_idx; in txgbe_disable_device()
171 phylink_stop(wx->phylink); in txgbe_down()
184 * txgbe_init_type_code - Initialize the shared code
189 u8 device_type = wx->subsystem_device_id & 0xF0; in txgbe_init_type_code()
191 switch (wx->device_id) { in txgbe_init_type_code()
194 wx->mac.type = wx_mac_sp; in txgbe_init_type_code()
197 wx->mac.type = wx_mac_unknown; in txgbe_init_type_code()
203 wx->media_type = sp_media_fiber; in txgbe_init_type_code()
207 wx->media_type = sp_media_copper; in txgbe_init_type_code()
212 wx->media_type = sp_media_backplane; in txgbe_init_type_code()
215 if (wx->bus.func == 0) in txgbe_init_type_code()
216 wx->media_type = sp_media_fiber; in txgbe_init_type_code()
218 wx->media_type = sp_media_copper; in txgbe_init_type_code()
221 wx->media_type = sp_media_unknown; in txgbe_init_type_code()
227 * txgbe_sw_init - Initialize general software structures (struct wx)
235 wx->mac.num_rar_entries = TXGBE_SP_RAR_ENTRIES; in txgbe_sw_init()
236 wx->mac.max_tx_queues = TXGBE_SP_MAX_TX_QUEUES; in txgbe_sw_init()
237 wx->mac.max_rx_queues = TXGBE_SP_MAX_RX_QUEUES; in txgbe_sw_init()
238 wx->mac.mcft_size = TXGBE_SP_MC_TBL_SIZE; in txgbe_sw_init()
239 wx->mac.vft_size = TXGBE_SP_VFT_TBL_SIZE; in txgbe_sw_init()
240 wx->mac.rx_pb_size = TXGBE_SP_RX_PB_SIZE; in txgbe_sw_init()
241 wx->mac.tx_pb_size = TXGBE_SP_TDB_PB_SZ; in txgbe_sw_init()
251 wx->max_q_vectors = TXGBE_MAX_MSIX_VECTORS; in txgbe_sw_init()
254 wx_err(wx, "Do not support MSI-X\n"); in txgbe_sw_init()
255 wx->mac.max_msix_vectors = msix_count; in txgbe_sw_init()
257 wx->ring_feature[RING_F_RSS].limit = min_t(int, TXGBE_MAX_RSS_INDICES, in txgbe_sw_init()
259 wx->rss_enabled = true; in txgbe_sw_init()
261 wx->ring_feature[RING_F_FDIR].limit = min_t(int, TXGBE_MAX_FDIR_INDICES, in txgbe_sw_init()
263 set_bit(WX_FLAG_FDIR_CAPABLE, wx->flags); in txgbe_sw_init()
264 set_bit(WX_FLAG_FDIR_HASH, wx->flags); in txgbe_sw_init()
265 wx->atr_sample_rate = TXGBE_DEFAULT_ATR_SAMPLE_RATE; in txgbe_sw_init()
266 wx->atr = txgbe_atr; in txgbe_sw_init()
267 wx->configure_fdir = txgbe_configure_fdir; in txgbe_sw_init()
270 wx->rx_itr_setting = 1; in txgbe_sw_init()
271 wx->tx_itr_setting = 1; in txgbe_sw_init()
274 wx->tx_ring_count = TXGBE_DEFAULT_TXD; in txgbe_sw_init()
275 wx->rx_ring_count = TXGBE_DEFAULT_RXD; in txgbe_sw_init()
278 wx->tx_work_limit = TXGBE_DEFAULT_TX_WORK; in txgbe_sw_init()
279 wx->rx_work_limit = TXGBE_DEFAULT_RX_WORK; in txgbe_sw_init()
281 wx->do_reset = txgbe_do_reset; in txgbe_sw_init()
288 txgbe->fdir_filter_count = 0; in txgbe_init_fdir()
289 spin_lock_init(&txgbe->fdir_perfect_lock); in txgbe_init_fdir()
293 * txgbe_open - Called when a network interface is made active
317 err = netif_set_real_num_tx_queues(netdev, wx->num_tx_queues); in txgbe_open()
321 err = netif_set_real_num_rx_queues(netdev, wx->num_rx_queues); in txgbe_open()
340 * txgbe_close_suspend - actions necessary to both suspend and close flows
353 * txgbe_close - Disables a network interface
358 * The close entry point is called when an interface is de-activated
381 netdev = wx->netdev; in txgbe_dev_shutdown()
405 * txgbe_setup_tc - routine to configure net_device for multiple traffic
414 struct txgbe *txgbe = wx->priv; in txgbe_setup_tc()
446 netif_trans_update(wx->netdev); in txgbe_reinit_locked()
457 clear_bit(WX_STATE_RESETTING, wx->state); in txgbe_reinit_locked()
486 * txgbe_probe - Device Initialization Routine
513 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); in txgbe_probe()
515 dev_err(&pdev->dev, in txgbe_probe()
524 dev_err(&pdev->dev, in txgbe_probe()
531 netdev = devm_alloc_etherdev_mqs(&pdev->dev, in txgbe_probe()
536 err = -ENOMEM; in txgbe_probe()
540 SET_NETDEV_DEV(netdev, &pdev->dev); in txgbe_probe()
543 wx->netdev = netdev; in txgbe_probe()
544 wx->pdev = pdev; in txgbe_probe()
546 wx->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1; in txgbe_probe()
548 wx->hw_addr = devm_ioremap(&pdev->dev, in txgbe_probe()
551 if (!wx->hw_addr) { in txgbe_probe()
552 err = -EIO; in txgbe_probe()
556 wx->driver_name = txgbe_driver_name; in txgbe_probe()
558 netdev->netdev_ops = &txgbe_netdev_ops; in txgbe_probe()
575 dev_err(&pdev->dev, "Management capability is not present\n"); in txgbe_probe()
581 dev_err(&pdev->dev, "HW Init failed: %d\n", err); in txgbe_probe()
585 netdev->features = NETIF_F_SG | in txgbe_probe()
592 netdev->gso_partial_features = NETIF_F_GSO_ENCAP_ALL; in txgbe_probe()
593 netdev->features |= netdev->gso_partial_features; in txgbe_probe()
594 netdev->features |= NETIF_F_SCTP_CRC; in txgbe_probe()
595 netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID; in txgbe_probe()
596 netdev->hw_enc_features |= netdev->vlan_features; in txgbe_probe()
597 netdev->features |= NETIF_F_VLAN_FEATURES; in txgbe_probe()
599 netdev->hw_features |= netdev->features | NETIF_F_RXALL; in txgbe_probe()
600 netdev->hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC; in txgbe_probe()
601 netdev->features |= NETIF_F_HIGHDMA; in txgbe_probe()
602 netdev->hw_features |= NETIF_F_GRO; in txgbe_probe()
603 netdev->features |= NETIF_F_GRO; in txgbe_probe()
605 netdev->priv_flags |= IFF_UNICAST_FLT; in txgbe_probe()
606 netdev->priv_flags |= IFF_SUPP_NOFCS; in txgbe_probe()
607 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE; in txgbe_probe()
609 netdev->min_mtu = ETH_MIN_MTU; in txgbe_probe()
610 netdev->max_mtu = WX_MAX_JUMBO_FRAME_SIZE - in txgbe_probe()
616 dev_err(&pdev->dev, "The EEPROM Checksum Is Not Valid\n"); in txgbe_probe()
618 err = -EIO; in txgbe_probe()
622 eth_hw_addr_set(netdev, wx->mac.perm_addr); in txgbe_probe()
623 wx_mac_set_default_filter(wx, wx->mac.perm_addr); in txgbe_probe()
633 wx->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_H, in txgbe_probe()
636 wx->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_L, in txgbe_probe()
641 wx->eeprom.sw_region_offset + TXGBE_ISCSI_BOOT_CONFIG, in txgbe_probe()
655 snprintf(wx->eeprom_id, sizeof(wx->eeprom_id), in txgbe_probe()
659 snprintf(wx->eeprom_id, sizeof(wx->eeprom_id), in txgbe_probe()
663 snprintf(wx->eeprom_id, sizeof(wx->eeprom_id), in txgbe_probe()
668 dev_warn(&pdev->dev, "Please upgrade the firmware to 0x20010 or above.\n"); in txgbe_probe()
670 txgbe = devm_kzalloc(&pdev->dev, sizeof(*txgbe), GFP_KERNEL); in txgbe_probe()
672 err = -ENOMEM; in txgbe_probe()
676 txgbe->wx = wx; in txgbe_probe()
677 wx->priv = txgbe; in txgbe_probe()
709 dev_warn(&pdev->dev, "Failed to enumerate PF devices.\n"); in txgbe_probe()
721 kfree(wx->mac_table); in txgbe_probe()
731 * txgbe_remove - Device Removal Routine
736 * Hot-Plug event, or because the driver is going to be removed from
742 struct txgbe *txgbe = wx->priv; in txgbe_remove()
745 netdev = wx->netdev; in txgbe_remove()
755 kfree(wx->rss_key); in txgbe_remove()
756 kfree(wx->mac_table); in txgbe_remove()
773 MODULE_AUTHOR("Beijing WangXun Technology Co., Ltd, <software@trustnetic.com>");