Lines Matching +full:mac +full:- +full:s

22  * Copyright (c) 2003 - 2005 Chelsio Communications, Inc.                    *
46 #include <linux/dma-mapping.h>
62 schedule_delayed_work(&ap->stats_update_task, secs * HZ); in schedule_mac_stats_update()
67 cancel_delayed_work(&ap->stats_update_task); in cancel_mac_stats_update()
113 * Setup MAC to receive the types of packets we want.
117 struct adapter *adapter = dev->ml_priv; in t1_set_rxmode()
118 struct cmac *mac = adapter->port[dev->if_port].mac; in t1_set_rxmode() local
122 mac->ops->set_rx_mode(mac, &rm); in t1_set_rxmode()
127 if (!netif_carrier_ok(p->dev)) in link_report()
128 netdev_info(p->dev, "link down\n"); in link_report()
130 const char *s = "10Mbps"; in link_report() local
132 switch (p->link_config.speed) { in link_report()
133 case SPEED_10000: s = "10Gbps"; break; in link_report()
134 case SPEED_1000: s = "1000Mbps"; break; in link_report()
135 case SPEED_100: s = "100Mbps"; break; in link_report()
138 netdev_info(p->dev, "link up, %s, %s-duplex\n", in link_report()
139 s, p->link_config.duplex == DUPLEX_FULL in link_report()
147 struct port_info *p = &adapter->port[port_id]; in t1_link_negotiated()
149 if (link_stat != netif_carrier_ok(p->dev)) { in t1_link_negotiated()
151 netif_carrier_on(p->dev); in t1_link_negotiated()
153 netif_carrier_off(p->dev); in t1_link_negotiated()
156 /* multi-ports: inform toe */ in t1_link_negotiated()
157 if ((speed > 0) && (adapter->params.nports > 1)) { in t1_link_negotiated()
170 t1_sched_update_parms(adapter->sge, port_id, 0, sched_speed); in t1_link_negotiated()
177 struct cmac *mac = p->mac; in link_start() local
179 mac->ops->reset(mac); in link_start()
180 if (mac->ops->macaddress_set) in link_start()
181 mac->ops->macaddress_set(mac, p->dev->dev_addr); in link_start()
182 t1_set_rxmode(p->dev); in link_start()
183 t1_link_start(p->phy, mac, &p->link_config); in link_start()
184 mac->ops->enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); in link_start()
189 if (adapter->port[0].dev->hw_features & NETIF_F_TSO) in enable_hw_csum()
190 t1_tp_set_ip_checksum_offload(adapter->tp, 1); /* for TSO only */ in enable_hw_csum()
191 t1_tp_set_tcp_checksum_offload(adapter->tp, 1); in enable_hw_csum()
202 if (!(adapter->flags & FULL_INIT_DONE)) { in cxgb_up()
208 adapter->flags |= FULL_INIT_DONE; in cxgb_up()
213 adapter->params.has_msi = !disable_msi && !pci_enable_msi(adapter->pdev); in cxgb_up()
214 err = request_threaded_irq(adapter->pdev->irq, t1_interrupt, in cxgb_up()
216 adapter->params.has_msi ? 0 : IRQF_SHARED, in cxgb_up()
217 adapter->name, adapter); in cxgb_up()
219 if (adapter->params.has_msi) in cxgb_up()
220 pci_disable_msi(adapter->pdev); in cxgb_up()
225 t1_sge_start(adapter->sge); in cxgb_up()
236 t1_sge_stop(adapter->sge); in cxgb_down()
238 free_irq(adapter->pdev->irq, adapter); in cxgb_down()
239 if (adapter->params.has_msi) in cxgb_down()
240 pci_disable_msi(adapter->pdev); in cxgb_down()
246 struct adapter *adapter = dev->ml_priv; in cxgb_open()
247 int other_ports = adapter->open_device_map & PORT_MASK; in cxgb_open()
249 napi_enable(&adapter->napi); in cxgb_open()
250 if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0) { in cxgb_open()
251 napi_disable(&adapter->napi); in cxgb_open()
255 __set_bit(dev->if_port, &adapter->open_device_map); in cxgb_open()
256 link_start(&adapter->port[dev->if_port]); in cxgb_open()
258 if (!other_ports && adapter->params.stats_update_period) in cxgb_open()
260 adapter->params.stats_update_period); in cxgb_open()
262 t1_vlan_mode(adapter, dev->features); in cxgb_open()
268 struct adapter *adapter = dev->ml_priv; in cxgb_close()
269 struct port_info *p = &adapter->port[dev->if_port]; in cxgb_close()
270 struct cmac *mac = p->mac; in cxgb_close() local
273 napi_disable(&adapter->napi); in cxgb_close()
274 mac->ops->disable(mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX); in cxgb_close()
277 clear_bit(dev->if_port, &adapter->open_device_map); in cxgb_close()
278 if (adapter->params.stats_update_period && in cxgb_close()
279 !(adapter->open_device_map & PORT_MASK)) { in cxgb_close()
282 spin_lock(&adapter->work_lock); /* sync with update task */ in cxgb_close()
283 spin_unlock(&adapter->work_lock); in cxgb_close()
287 if (!adapter->open_device_map) in cxgb_close()
294 struct adapter *adapter = dev->ml_priv; in t1_get_stats()
295 struct port_info *p = &adapter->port[dev->if_port]; in t1_get_stats()
296 struct net_device_stats *ns = &dev->stats; in t1_get_stats()
299 /* Do a full update of the MAC stats */ in t1_get_stats()
300 pstats = p->mac->ops->statistics_update(p->mac, in t1_get_stats()
303 ns->tx_packets = pstats->TxUnicastFramesOK + in t1_get_stats()
304 pstats->TxMulticastFramesOK + pstats->TxBroadcastFramesOK; in t1_get_stats()
306 ns->rx_packets = pstats->RxUnicastFramesOK + in t1_get_stats()
307 pstats->RxMulticastFramesOK + pstats->RxBroadcastFramesOK; in t1_get_stats()
309 ns->tx_bytes = pstats->TxOctetsOK; in t1_get_stats()
310 ns->rx_bytes = pstats->RxOctetsOK; in t1_get_stats()
312 ns->tx_errors = pstats->TxLateCollisions + pstats->TxLengthErrors + in t1_get_stats()
313 pstats->TxUnderrun + pstats->TxFramesAbortedDueToXSCollisions; in t1_get_stats()
314 ns->rx_errors = pstats->RxDataErrors + pstats->RxJabberErrors + in t1_get_stats()
315 pstats->RxFCSErrors + pstats->RxAlignErrors + in t1_get_stats()
316 pstats->RxSequenceErrors + pstats->RxFrameTooLongErrors + in t1_get_stats()
317 pstats->RxSymbolErrors + pstats->RxRuntErrors; in t1_get_stats()
319 ns->multicast = pstats->RxMulticastFramesOK; in t1_get_stats()
320 ns->collisions = pstats->TxTotalCollisions; in t1_get_stats()
323 ns->rx_length_errors = pstats->RxFrameTooLongErrors + in t1_get_stats()
324 pstats->RxJabberErrors; in t1_get_stats()
325 ns->rx_over_errors = 0; in t1_get_stats()
326 ns->rx_crc_errors = pstats->RxFCSErrors; in t1_get_stats()
327 ns->rx_frame_errors = pstats->RxAlignErrors; in t1_get_stats()
328 ns->rx_fifo_errors = 0; in t1_get_stats()
329 ns->rx_missed_errors = 0; in t1_get_stats()
332 ns->tx_aborted_errors = pstats->TxFramesAbortedDueToXSCollisions; in t1_get_stats()
333 ns->tx_carrier_errors = 0; in t1_get_stats()
334 ns->tx_fifo_errors = pstats->TxUnderrun; in t1_get_stats()
335 ns->tx_heartbeat_errors = 0; in t1_get_stats()
336 ns->tx_window_errors = pstats->TxLateCollisions; in t1_get_stats()
342 struct adapter *adapter = dev->ml_priv; in get_msglevel()
344 return adapter->msg_enable; in get_msglevel()
349 struct adapter *adapter = dev->ml_priv; in set_msglevel()
351 adapter->msg_enable = val; in set_msglevel()
430 struct adapter *adapter = dev->ml_priv; in get_drvinfo()
432 strscpy(info->driver, DRV_NAME, sizeof(info->driver)); in get_drvinfo()
433 strscpy(info->bus_info, pci_name(adapter->pdev), in get_drvinfo()
434 sizeof(info->bus_info)); in get_drvinfo()
443 return -EOPNOTSUPP; in get_sset_count()
456 struct adapter *adapter = dev->ml_priv; in get_stats()
457 struct cmac *mac = adapter->port[dev->if_port].mac; in get_stats() local
458 const struct cmac_statistics *s; in get_stats() local
462 s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); in get_stats()
463 t = t1_sge_get_intr_counts(adapter->sge); in get_stats()
464 t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); in get_stats()
466 *data++ = s->TxOctetsOK; in get_stats()
467 *data++ = s->TxOctetsBad; in get_stats()
468 *data++ = s->TxUnicastFramesOK; in get_stats()
469 *data++ = s->TxMulticastFramesOK; in get_stats()
470 *data++ = s->TxBroadcastFramesOK; in get_stats()
471 *data++ = s->TxPauseFrames; in get_stats()
472 *data++ = s->TxFramesWithDeferredXmissions; in get_stats()
473 *data++ = s->TxLateCollisions; in get_stats()
474 *data++ = s->TxTotalCollisions; in get_stats()
475 *data++ = s->TxFramesAbortedDueToXSCollisions; in get_stats()
476 *data++ = s->TxUnderrun; in get_stats()
477 *data++ = s->TxLengthErrors; in get_stats()
478 *data++ = s->TxInternalMACXmitError; in get_stats()
479 *data++ = s->TxFramesWithExcessiveDeferral; in get_stats()
480 *data++ = s->TxFCSErrors; in get_stats()
481 *data++ = s->TxJumboFramesOK; in get_stats()
482 *data++ = s->TxJumboOctetsOK; in get_stats()
484 *data++ = s->RxOctetsOK; in get_stats()
485 *data++ = s->RxOctetsBad; in get_stats()
486 *data++ = s->RxUnicastFramesOK; in get_stats()
487 *data++ = s->RxMulticastFramesOK; in get_stats()
488 *data++ = s->RxBroadcastFramesOK; in get_stats()
489 *data++ = s->RxPauseFrames; in get_stats()
490 *data++ = s->RxFCSErrors; in get_stats()
491 *data++ = s->RxAlignErrors; in get_stats()
492 *data++ = s->RxSymbolErrors; in get_stats()
493 *data++ = s->RxDataErrors; in get_stats()
494 *data++ = s->RxSequenceErrors; in get_stats()
495 *data++ = s->RxRuntErrors; in get_stats()
496 *data++ = s->RxJabberErrors; in get_stats()
497 *data++ = s->RxInternalMACRcvError; in get_stats()
498 *data++ = s->RxInRangeLengthErrors; in get_stats()
499 *data++ = s->RxOutOfRangeLengthField; in get_stats()
500 *data++ = s->RxFrameTooLongErrors; in get_stats()
501 *data++ = s->RxJumboFramesOK; in get_stats()
502 *data++ = s->RxJumboOctetsOK; in get_stats()
511 *data++ = t->rx_drops; in get_stats()
512 *data++ = t->pure_rsps; in get_stats()
513 *data++ = t->unhandled_irqs; in get_stats()
514 *data++ = t->respQ_empty; in get_stats()
515 *data++ = t->respQ_overflow; in get_stats()
516 *data++ = t->freelistQ_empty; in get_stats()
517 *data++ = t->pkt_too_big; in get_stats()
518 *data++ = t->pkt_mismatch; in get_stats()
519 *data++ = t->cmdQ_full[0]; in get_stats()
520 *data++ = t->cmdQ_full[1]; in get_stats()
522 if (adapter->espi) { in get_stats()
525 e = t1_espi_get_intr_counts(adapter->espi); in get_stats()
526 *data++ = e->DIP2_parity_err; in get_stats()
527 *data++ = e->DIP4_err; in get_stats()
528 *data++ = e->rx_drops; in get_stats()
529 *data++ = e->tx_drops; in get_stats()
530 *data++ = e->rx_ovflw; in get_stats()
531 *data++ = e->parity_err; in get_stats()
541 *p++ = readl(ap->regs + start); in reg_block_dump()
547 struct adapter *ap = dev->ml_priv; in get_regs()
552 regs->version = 2; in get_regs()
570 struct adapter *adapter = dev->ml_priv; in get_link_ksettings()
571 struct port_info *p = &adapter->port[dev->if_port]; in get_link_ksettings()
574 supported = p->link_config.supported; in get_link_ksettings()
575 advertising = p->link_config.advertising; in get_link_ksettings()
578 cmd->base.speed = p->link_config.speed; in get_link_ksettings()
579 cmd->base.duplex = p->link_config.duplex; in get_link_ksettings()
581 cmd->base.speed = SPEED_UNKNOWN; in get_link_ksettings()
582 cmd->base.duplex = DUPLEX_UNKNOWN; in get_link_ksettings()
585 cmd->base.port = (supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE; in get_link_ksettings()
586 cmd->base.phy_address = p->phy->mdio.prtad; in get_link_ksettings()
587 cmd->base.autoneg = p->link_config.autoneg; in get_link_ksettings()
589 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, in get_link_ksettings()
591 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, in get_link_ksettings()
635 struct adapter *adapter = dev->ml_priv; in set_link_ksettings()
636 struct port_info *p = &adapter->port[dev->if_port]; in set_link_ksettings()
637 struct link_config *lc = &p->link_config; in set_link_ksettings()
641 cmd->link_modes.advertising); in set_link_ksettings()
643 if (!(lc->supported & SUPPORTED_Autoneg)) in set_link_ksettings()
644 return -EOPNOTSUPP; /* can't change speed/duplex */ in set_link_ksettings()
646 if (cmd->base.autoneg == AUTONEG_DISABLE) { in set_link_ksettings()
647 u32 speed = cmd->base.speed; in set_link_ksettings()
648 int cap = speed_duplex_to_caps(speed, cmd->base.duplex); in set_link_ksettings()
650 if (!(lc->supported & cap) || (speed == SPEED_1000)) in set_link_ksettings()
651 return -EINVAL; in set_link_ksettings()
652 lc->requested_speed = speed; in set_link_ksettings()
653 lc->requested_duplex = cmd->base.duplex; in set_link_ksettings()
654 lc->advertising = 0; in set_link_ksettings()
657 if (advertising & (advertising - 1)) in set_link_ksettings()
658 advertising = lc->supported; in set_link_ksettings()
659 advertising &= lc->supported; in set_link_ksettings()
661 return -EINVAL; in set_link_ksettings()
662 lc->requested_speed = SPEED_INVALID; in set_link_ksettings()
663 lc->requested_duplex = DUPLEX_INVALID; in set_link_ksettings()
664 lc->advertising = advertising | ADVERTISED_Autoneg; in set_link_ksettings()
666 lc->autoneg = cmd->base.autoneg; in set_link_ksettings()
668 t1_link_start(p->phy, p->mac, lc); in set_link_ksettings()
675 struct adapter *adapter = dev->ml_priv; in get_pauseparam()
676 struct port_info *p = &adapter->port[dev->if_port]; in get_pauseparam()
678 epause->autoneg = (p->link_config.requested_fc & PAUSE_AUTONEG) != 0; in get_pauseparam()
679 epause->rx_pause = (p->link_config.fc & PAUSE_RX) != 0; in get_pauseparam()
680 epause->tx_pause = (p->link_config.fc & PAUSE_TX) != 0; in get_pauseparam()
686 struct adapter *adapter = dev->ml_priv; in set_pauseparam()
687 struct port_info *p = &adapter->port[dev->if_port]; in set_pauseparam()
688 struct link_config *lc = &p->link_config; in set_pauseparam()
690 if (epause->autoneg == AUTONEG_DISABLE) in set_pauseparam()
691 lc->requested_fc = 0; in set_pauseparam()
692 else if (lc->supported & SUPPORTED_Autoneg) in set_pauseparam()
693 lc->requested_fc = PAUSE_AUTONEG; in set_pauseparam()
695 return -EINVAL; in set_pauseparam()
697 if (epause->rx_pause) in set_pauseparam()
698 lc->requested_fc |= PAUSE_RX; in set_pauseparam()
699 if (epause->tx_pause) in set_pauseparam()
700 lc->requested_fc |= PAUSE_TX; in set_pauseparam()
701 if (lc->autoneg == AUTONEG_ENABLE) { in set_pauseparam()
703 t1_link_start(p->phy, p->mac, lc); in set_pauseparam()
705 lc->fc = lc->requested_fc & (PAUSE_RX | PAUSE_TX); in set_pauseparam()
707 p->mac->ops->set_speed_duplex_fc(p->mac, -1, -1, in set_pauseparam()
708 lc->fc); in set_pauseparam()
717 struct adapter *adapter = dev->ml_priv; in get_sge_param()
720 e->rx_max_pending = MAX_RX_BUFFERS; in get_sge_param()
721 e->rx_jumbo_max_pending = MAX_RX_JUMBO_BUFFERS; in get_sge_param()
722 e->tx_max_pending = MAX_CMDQ_ENTRIES; in get_sge_param()
724 e->rx_pending = adapter->params.sge.freelQ_size[!jumbo_fl]; in get_sge_param()
725 e->rx_jumbo_pending = adapter->params.sge.freelQ_size[jumbo_fl]; in get_sge_param()
726 e->tx_pending = adapter->params.sge.cmdQ_size[0]; in get_sge_param()
733 struct adapter *adapter = dev->ml_priv; in set_sge_param()
736 if (e->rx_pending > MAX_RX_BUFFERS || e->rx_mini_pending || in set_sge_param()
737 e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS || in set_sge_param()
738 e->tx_pending > MAX_CMDQ_ENTRIES || in set_sge_param()
739 e->rx_pending < MIN_FL_ENTRIES || in set_sge_param()
740 e->rx_jumbo_pending < MIN_FL_ENTRIES || in set_sge_param()
741 e->tx_pending < (adapter->params.nports + 1) * (MAX_SKB_FRAGS + 1)) in set_sge_param()
742 return -EINVAL; in set_sge_param()
744 if (adapter->flags & FULL_INIT_DONE) in set_sge_param()
745 return -EBUSY; in set_sge_param()
747 adapter->params.sge.freelQ_size[!jumbo_fl] = e->rx_pending; in set_sge_param()
748 adapter->params.sge.freelQ_size[jumbo_fl] = e->rx_jumbo_pending; in set_sge_param()
749 adapter->params.sge.cmdQ_size[0] = e->tx_pending; in set_sge_param()
750 adapter->params.sge.cmdQ_size[1] = e->tx_pending > MAX_CMDQ1_ENTRIES ? in set_sge_param()
751 MAX_CMDQ1_ENTRIES : e->tx_pending; in set_sge_param()
759 struct adapter *adapter = dev->ml_priv; in set_coalesce()
761 adapter->params.sge.rx_coalesce_usecs = c->rx_coalesce_usecs; in set_coalesce()
762 adapter->params.sge.coalesce_enable = c->use_adaptive_rx_coalesce; in set_coalesce()
763 adapter->params.sge.sample_interval_usecs = c->rate_sample_interval; in set_coalesce()
764 t1_sge_set_coalesce_params(adapter->sge, &adapter->params.sge); in set_coalesce()
772 struct adapter *adapter = dev->ml_priv; in get_coalesce()
774 c->rx_coalesce_usecs = adapter->params.sge.rx_coalesce_usecs; in get_coalesce()
775 c->rate_sample_interval = adapter->params.sge.sample_interval_usecs; in get_coalesce()
776 c->use_adaptive_rx_coalesce = adapter->params.sge.coalesce_enable; in get_coalesce()
782 struct adapter *adapter = dev->ml_priv; in get_eeprom_len()
788 (PCI_VENDOR_ID_CHELSIO | ((ap)->params.chip_version << 16))
795 struct adapter *adapter = dev->ml_priv; in get_eeprom()
797 e->magic = EEPROM_MAGIC(adapter); in get_eeprom()
798 for (i = e->offset & ~3; i < e->offset + e->len; i += sizeof(u32)) in get_eeprom()
800 memcpy(data, buf + e->offset, e->len); in get_eeprom()
831 struct adapter *adapter = dev->ml_priv; in t1_ioctl()
832 struct mdio_if_info *mdio = &adapter->port[dev->if_port].phy->mdio; in t1_ioctl()
840 struct adapter *adapter = dev->ml_priv; in t1_change_mtu()
841 struct cmac *mac = adapter->port[dev->if_port].mac; in t1_change_mtu() local
843 if (!mac->ops->set_mtu) in t1_change_mtu()
844 return -EOPNOTSUPP; in t1_change_mtu()
845 if ((ret = mac->ops->set_mtu(mac, new_mtu))) in t1_change_mtu()
847 WRITE_ONCE(dev->mtu, new_mtu); in t1_change_mtu()
853 struct adapter *adapter = dev->ml_priv; in t1_set_mac_addr()
854 struct cmac *mac = adapter->port[dev->if_port].mac; in t1_set_mac_addr() local
857 if (!mac->ops->macaddress_set) in t1_set_mac_addr()
858 return -EOPNOTSUPP; in t1_set_mac_addr()
860 eth_hw_addr_set(dev, addr->sa_data); in t1_set_mac_addr()
861 mac->ops->macaddress_set(mac, dev->dev_addr); in t1_set_mac_addr()
882 netdev_features_t changed = dev->features ^ features; in t1_set_features()
883 struct adapter *adapter = dev->ml_priv; in t1_set_features()
894 struct adapter *adapter = dev->ml_priv; in t1_netpoll()
897 t1_interrupt(adapter->pdev->irq, adapter); in t1_netpoll()
903 * Periodic accumulation of MAC statistics. This is used only if the MAC
913 struct port_info *p = &adapter->port[i]; in mac_stats_task()
915 if (netif_running(p->dev)) in mac_stats_task()
916 p->mac->ops->statistics_update(p->mac, in mac_stats_task()
921 spin_lock(&adapter->work_lock); in mac_stats_task()
922 if (adapter->open_device_map & PORT_MASK) in mac_stats_task()
924 adapter->params.stats_update_period); in mac_stats_task()
925 spin_unlock(&adapter->work_lock); in mac_stats_task()
958 pr_err("%s: cannot find PCI device memory base address\n", in init_one()
960 err = -ENODEV; in init_one()
964 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); in init_one()
966 pr_err("%s: no usable DMA configuration\n", pci_name(pdev)); in init_one()
972 pr_err("%s: cannot obtain PCI resources\n", pci_name(pdev)); in init_one()
980 bi = t1_get_board_info(ent->driver_data); in init_one()
982 for (i = 0; i < bi->port_number; ++i) { in init_one()
987 err = -ENOMEM; in init_one()
991 SET_NETDEV_DEV(netdev, &pdev->dev); in init_one()
995 adapter->pdev = pdev; in init_one()
996 adapter->port[0].dev = netdev; /* so we don't leak it */ in init_one()
998 adapter->regs = ioremap(mmio_start, mmio_len); in init_one()
999 if (!adapter->regs) { in init_one()
1000 pr_err("%s: cannot map device registers\n", in init_one()
1002 err = -ENOMEM; in init_one()
1006 if (t1_get_board_rev(adapter, bi, &adapter->params)) { in init_one()
1007 err = -ENODEV; /* Can't handle this chip rev */ in init_one()
1011 adapter->name = pci_name(pdev); in init_one()
1012 adapter->msg_enable = dflt_msg_enable; in init_one()
1013 adapter->mmio_len = mmio_len; in init_one()
1015 spin_lock_init(&adapter->tpi_lock); in init_one()
1016 spin_lock_init(&adapter->work_lock); in init_one()
1017 spin_lock_init(&adapter->async_lock); in init_one()
1018 spin_lock_init(&adapter->mac_lock); in init_one()
1020 INIT_DELAYED_WORK(&adapter->stats_update_task, in init_one()
1026 pi = &adapter->port[i]; in init_one()
1027 pi->dev = netdev; in init_one()
1029 netdev->irq = pdev->irq; in init_one()
1030 netdev->if_port = i; in init_one()
1031 netdev->mem_start = mmio_start; in init_one()
1032 netdev->mem_end = mmio_start + mmio_len - 1; in init_one()
1033 netdev->ml_priv = adapter; in init_one()
1034 netdev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | in init_one()
1036 netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | in init_one()
1038 netdev->lltx = true; in init_one()
1041 netdev->features |= in init_one()
1044 netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; in init_one()
1047 if (!(is_T2(adapter)) || bi->port_number != 4) { in init_one()
1048 netdev->hw_features |= NETIF_F_TSO; in init_one()
1049 netdev->features |= NETIF_F_TSO; in init_one()
1053 netdev->netdev_ops = &cxgb_netdev_ops; in init_one()
1054 netdev->hard_header_len += (netdev->hw_features & NETIF_F_TSO) ? in init_one()
1057 netif_napi_add(netdev, &adapter->napi, t1_poll); in init_one()
1059 netdev->ethtool_ops = &t1_ethtool_ops; in init_one()
1061 switch (bi->board) { in init_one()
1066 netdev->max_mtu = PM3393_MAX_FRAME_SIZE - in init_one()
1070 netdev->max_mtu = VSC7326_MAX_MTU; in init_one()
1073 netdev->max_mtu = ETH_DATA_LEN; in init_one()
1079 err = -ENODEV; in init_one()
1089 for (i = 0; i < bi->port_number; ++i) { in init_one()
1090 err = register_netdev(adapter->port[i].dev); in init_one()
1092 pr_warn("%s: cannot register net device %s, skipping\n", in init_one()
1093 pci_name(pdev), adapter->port[i].dev->name); in init_one()
1099 if (!adapter->registered_device_map) in init_one()
1100 adapter->name = adapter->port[i].dev->name; in init_one()
1102 __set_bit(i, &adapter->registered_device_map); in init_one()
1105 if (!adapter->registered_device_map) { in init_one()
1106 pr_err("%s: could not register any net devices\n", in init_one()
1108 err = -EINVAL; in init_one()
1112 pr_info("%s: %s (rev %d), %s %dMHz/%d-bit\n", in init_one()
1113 adapter->name, bi->desc, adapter->params.chip_revision, in init_one()
1114 adapter->params.pci.is_pcix ? "PCIX" : "PCI", in init_one()
1115 adapter->params.pci.speed, adapter->params.pci.width); in init_one()
1121 adapter->t1powersave = LCLOCK; /* HW default is powersave mode. */ in init_one()
1123 adapter->t1powersave = HCLOCK; in init_one()
1133 if (adapter->regs) in init_one()
1134 iounmap(adapter->regs); in init_one()
1135 for (i = bi->port_number - 1; i >= 0; --i) in init_one()
1136 if (adapter->port[i].dev) in init_one()
1137 free_netdev(adapter->port[i].dev); in init_one()
1156 for (i = (nbits - 1); i > -1; i--) { in bit_bang()
1207 return -ENODEV; /* Can't re-clock this chip. */ in t1_clock()
1212 if ((adapter->t1powersave & 1) == (mode & 1)) in t1_clock()
1213 return -EALREADY; /* ASIC already running in mode. */ in t1_clock()
1218 adapter->t1powersave = HCLOCK; /* overclock */ in t1_clock()
1222 adapter->t1powersave = LCLOCK; /* underclock */ in t1_clock()
1226 spin_lock(&adapter->tpi_lock); in t1_clock()
1288 spin_unlock(&adapter->tpi_lock); in t1_clock()
1302 struct adapter *adapter = dev->ml_priv; in remove_one()
1306 if (test_bit(i, &adapter->registered_device_map)) in remove_one()
1307 unregister_netdev(adapter->port[i].dev); in remove_one()
1311 iounmap(adapter->regs); in remove_one()
1313 while (--i >= 0) { in remove_one()
1314 if (adapter->port[i].dev) in remove_one()
1315 free_netdev(adapter->port[i].dev); in remove_one()