Lines Matching refs:nic
557 * @nic: Device private variable.
563 static int init_shared_mem(struct s2io_nic *nic)
571 struct net_device *dev = nic->dev;
574 struct config_param *config = &nic->config;
575 struct mac_info *mac_control = &nic->mac_control;
635 fifo->nic = nic;
643 tmp_v = dma_alloc_coherent(&nic->pdev->dev, PAGE_SIZE,
661 tmp_v = dma_alloc_coherent(&nic->pdev->dev,
701 if (rx_cfg->num_rxd % (rxd_count[nic->rxd_mode] + 1)) {
709 (rxd_count[nic->rxd_mode] + 1);
712 if (nic->rxd_mode == RXD_MODE_1)
727 ring->nic = nic;
730 blk_cnt = rx_cfg->num_rxd / (rxd_count[nic->rxd_mode] + 1);
738 tmp_v_addr = dma_alloc_coherent(&nic->pdev->dev, size,
753 rxd_count[nic->rxd_mode];
760 for (l = 0; l < rxd_count[nic->rxd_mode]; l++) {
763 (rxd_size[nic->rxd_mode] * l);
766 (rxd_size[nic->rxd_mode] * l);
784 if (nic->rxd_mode == RXD_MODE_3B) {
794 (rxd_count[nic->rxd_mode] + 1);
804 (rxd_count[nic->rxd_mode] + 1);
809 while (k != rxd_count[nic->rxd_mode]) {
839 dma_alloc_coherent(&nic->pdev->dev, size,
857 dev_name(&nic->pdev->dev), (unsigned long long)tmp_p_addr);
864 * @nic: Device private variable.
869 static void free_shared_mem(struct s2io_nic *nic)
882 if (!nic)
885 dev = nic->dev;
887 config = &nic->config;
888 mac_control = &nic->mac_control;
910 dma_free_coherent(&nic->pdev->dev, PAGE_SIZE,
919 dma_free_coherent(&nic->pdev->dev, PAGE_SIZE,
943 dma_free_coherent(&nic->pdev->dev, size, tmp_v_addr,
948 rxd_count[nic->rxd_mode];
952 if (nic->rxd_mode == RXD_MODE_3B) {
959 (rxd_count[nic->rxd_mode] + 1);
964 while (k != rxd_count[nic->rxd_mode]) {
976 (rxd_count[nic->rxd_mode] + 1);
984 for (i = 0; i < nic->config.tx_fifo_num; i++) {
997 dma_free_coherent(&nic->pdev->dev, mac_control->stats_mem_sz,
1007 static int s2io_verify_pci_mode(struct s2io_nic *nic)
1009 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1041 static int s2io_print_pci_mode(struct s2io_nic *nic)
1043 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1046 struct config_param *config = &nic->config;
1057 if (s2io_on_nec_bridge(nic->pdev)) {
1059 nic->dev->name);
1094 nic->dev->name, val64 & PCI_MODE_32_BITS ? 32 : 64, pcimode);
1101 * @nic: device private variable
1109 static int init_tti(struct s2io_nic *nic, int link)
1111 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1114 struct config_param *config = &nic->config;
1122 if (nic->device_type == XFRAME_II_DEVICE) {
1123 int count = (nic->config.bus_speed * 125)/2;
1137 if (nic->config.intr_type == MSI_X) {
1143 if ((nic->config.tx_steering_type ==
1146 (i >= nic->udp_fifo_idx) &&
1147 (i < (nic->udp_fifo_idx +
1148 nic->total_udp_fifos)))
1178 * @nic: device private variable
1185 static int init_nic(struct s2io_nic *nic)
1187 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1188 struct net_device *dev = nic->dev;
1196 struct config_param *config = &nic->config;
1197 struct mac_info *mac_control = &nic->mac_control;
1200 if (s2io_set_swapper(nic)) {
1208 if (nic->device_type & XFRAME_II_DEVICE) {
1224 if (nic->device_type == XFRAME_II_DEVICE) {
1253 if (nic->device_type & XFRAME_II_DEVICE) {
1319 if ((nic->device_type == XFRAME_I_DEVICE) && (nic->pdev->revision < 4))
1351 if (nic->device_type & XFRAME_II_DEVICE)
1632 if (rts_ds_steer(nic, i, 0) == FAILURE) {
1643 if (nic->device_type == XFRAME_II_DEVICE) {
1662 if (SUCCESS != init_tti(nic, nic->last_link_state))
1666 if (nic->device_type == XFRAME_II_DEVICE) {
1671 int count = (nic->config.bus_speed * 125)/4;
1684 if (nic->config.intr_type == MSI_X)
1742 if (nic->device_type == XFRAME_II_DEVICE)
1757 val64 |= RMAC_PAUSE_HG_PTIME(nic->mac_control.rmac_pause_time);
1769 nic->mac_control.mc_pause_threshold_q0q3)
1777 nic->mac_control.mc_pause_threshold_q4q7)
1790 if (nic->config.bus_speed == 266) {
1800 if (nic->device_type == XFRAME_II_DEVICE) {
1808 if (strstr(nic->product_name, "CX4")) {
1818 static int s2io_link_fault_indication(struct s2io_nic *nic)
1820 if (nic->device_type == XFRAME_II_DEVICE)
1848 static void en_dis_err_alarms(struct s2io_nic *nic, u16 mask, int flag)
1850 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1947 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER)
1969 nic->general_int_mask = gen_int_mask;
1972 nic->general_int_mask = 0;
1977 * @nic: device private variable,
1986 static void en_dis_able_nic_intrs(struct s2io_nic *nic, u16 mask, int flag)
1988 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1991 intr_mask = nic->general_int_mask;
2005 if (s2io_link_fault_indication(nic) ==
2062 nic->general_int_mask = readq(&bar0->general_int_mask);
2196 * @nic : device private variable.
2207 static int start_nic(struct s2io_nic *nic)
2209 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2210 struct net_device *dev = nic->dev;
2213 struct config_param *config = &nic->config;
2214 struct mac_info *mac_control = &nic->mac_control;
2224 if (nic->rxd_mode == RXD_MODE_1)
2228 if (nic->device_type == XFRAME_II_DEVICE)
2235 if (nic->rxd_mode == RXD_MODE_3B) {
2246 nic->vlan_strip_flag = 0;
2271 if (!verify_xena_quiescence(nic)) {
2291 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER) {
2296 schedule_work(&nic->set_link_task);
2299 subid = nic->pdev->subsystem_device;
2301 (nic->device_type == XFRAME_I_DEVICE)) {
2320 struct s2io_nic *nic = fifo_data->nic;
2327 dma_unmap_single(&nic->pdev->dev,
2338 dma_unmap_single(&nic->pdev->dev, (dma_addr_t)txds->Buffer_Pointer,
2347 dma_unmap_page(&nic->pdev->dev,
2358 * @nic : device private variable.
2364 static void free_tx_buffers(struct s2io_nic *nic)
2366 struct net_device *dev = nic->dev;
2371 struct config_param *config = &nic->config;
2372 struct mac_info *mac_control = &nic->mac_control;
2401 * stop_nic - To stop the nic
2402 * @nic : device private variable.
2410 static void stop_nic(struct s2io_nic *nic)
2412 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2417 en_dis_err_alarms(nic, ENA_ALL_INTRS, DISABLE_INTRS);
2420 en_dis_able_nic_intrs(nic, interruptible, DISABLE_INTRS);
2430 * @nic : device private variable.
2451 static int fill_rx_buffers(struct s2io_nic *nic, struct ring_info *ring,
2465 struct swStat *swstats = &ring->nic->mac_control.stats_info->sw_stat;
2514 skb = netdev_alloc_skb(nic->dev, size);
2537 if (dma_mapping_error(&nic->pdev->dev, rxdp1->Buffer0_ptr))
2572 if (dma_mapping_error(&nic->pdev->dev, rxdp3->Buffer0_ptr))
2593 if (dma_mapping_error(&nic->pdev->dev, rxdp3->Buffer2_ptr))
2603 if (dma_mapping_error(&nic->pdev->dev,
2736 static int s2io_chk_rx_buffers(struct s2io_nic *nic, struct ring_info *ring)
2738 if (fill_rx_buffers(nic, ring, 0) == -ENOMEM) {
2765 struct s2io_nic *nic = netdev_priv(dev);
2766 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2769 if (unlikely(!is_s2io_card_up(nic)))
2773 s2io_chk_rx_buffers(nic, ring);
2789 struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi);
2792 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2794 struct config_param *config = &nic->config;
2795 struct mac_info *mac_control = &nic->mac_control;
2797 if (unlikely(!is_s2io_card_up(nic)))
2803 s2io_chk_rx_buffers(nic, ring);
2830 struct s2io_nic *nic = netdev_priv(dev);
2831 const int irq = nic->pdev->irq;
2832 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2835 struct config_param *config = &nic->config;
2836 struct mac_info *mac_control = &nic->mac_control;
2838 if (pci_channel_offline(nic->pdev))
2863 if (fill_rx_buffers(nic, ring, 0) == -ENOMEM) {
2958 if (ring_data->nic->config.napi) {
2973 update_L3L4_header(ring_data->nic, lro);
2996 struct s2io_nic *nic = fifo_data->nic;
3003 struct stat_block *stats = nic->mac_control.stats_info;
3068 s2io_wake_tx_queue(fifo_data, pkt_cnt, nic->config.multiq);
3651 static int wait_for_msix_trans(struct s2io_nic *nic, int i)
3653 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3672 static void restore_xmsi_data(struct s2io_nic *nic)
3674 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3678 if (nic->device_type == XFRAME_I_DEVICE)
3683 writeq(nic->msix_info[i].addr, &bar0->xmsi_address);
3684 writeq(nic->msix_info[i].data, &bar0->xmsi_data);
3687 if (wait_for_msix_trans(nic, msix_index))
3693 static void store_xmsi_data(struct s2io_nic *nic)
3695 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3699 if (nic->device_type == XFRAME_I_DEVICE)
3707 if (wait_for_msix_trans(nic, msix_index)) {
3715 nic->msix_info[i].addr = addr;
3716 nic->msix_info[i].data = data;
3721 static int s2io_enable_msi_x(struct s2io_nic *nic)
3723 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3728 struct stat_block *stats = nic->mac_control.stats_info;
3731 size = nic->num_entries * sizeof(struct msix_entry);
3732 nic->entries = kzalloc(size, GFP_KERNEL);
3733 if (!nic->entries) {
3741 size = nic->num_entries * sizeof(struct s2io_msix_entry);
3742 nic->s2io_entries = kzalloc(size, GFP_KERNEL);
3743 if (!nic->s2io_entries) {
3747 kfree(nic->entries);
3749 += (nic->num_entries * sizeof(struct msix_entry));
3754 nic->entries[0].entry = 0;
3755 nic->s2io_entries[0].entry = 0;
3756 nic->s2io_entries[0].in_use = MSIX_FLG;
3757 nic->s2io_entries[0].type = MSIX_ALARM_TYPE;
3758 nic->s2io_entries[0].arg = &nic->mac_control.fifos;
3760 for (i = 1; i < nic->num_entries; i++) {
3761 nic->entries[i].entry = ((i - 1) * 8) + 1;
3762 nic->s2io_entries[i].entry = ((i - 1) * 8) + 1;
3763 nic->s2io_entries[i].arg = NULL;
3764 nic->s2io_entries[i].in_use = 0;
3768 for (j = 0; j < nic->config.rx_ring_num; j++) {
3770 nic->s2io_entries[j+1].arg = &nic->mac_control.rings[j];
3771 nic->s2io_entries[j+1].type = MSIX_RING_TYPE;
3772 nic->s2io_entries[j+1].in_use = MSIX_FLG;
3778 ret = pci_enable_msix_range(nic->pdev, nic->entries,
3779 nic->num_entries, nic->num_entries);
3783 kfree(nic->entries);
3784 swstats->mem_freed += nic->num_entries *
3786 kfree(nic->s2io_entries);
3787 swstats->mem_freed += nic->num_entries *
3789 nic->entries = NULL;
3790 nic->s2io_entries = NULL;
3798 pci_read_config_word(nic->pdev, 0x42, &msi_control);
3800 pci_write_config_word(nic->pdev, 0x42, msi_control);
4203 struct s2io_nic *sp = ring->nic;
4231 struct s2io_nic *sp = fifos->nic;
5406 * s2io_ethtool_set_led - To physically identify the nic on the system.
5669 static void s2io_vpd_read(struct s2io_nic *nic)
5675 struct swStat *swstats = &nic->mac_control.stats_info->sw_stat;
5677 if (nic->device_type == XFRAME_II_DEVICE) {
5678 strcpy(nic->product_name, "Xframe II 10GbE network adapter");
5681 strcpy(nic->product_name, "Xframe I 10GbE network adapter");
5684 strcpy(nic->serial_num, "NOT AVAILABLE");
5694 pci_write_config_byte(nic->pdev, (vpd_addr + 2), i);
5695 pci_read_config_byte(nic->pdev, (vpd_addr + 2), &data);
5696 pci_write_config_byte(nic->pdev, (vpd_addr + 3), 0);
5699 pci_read_config_byte(nic->pdev, (vpd_addr + 3), &data);
5708 pci_read_config_dword(nic->pdev, (vpd_addr + 4),
5719 memcpy(nic->serial_num,
5722 memset(nic->serial_num+len,
5733 memcpy(nic->product_name, &vpd_data[3], len);
5734 nic->product_name[len] = 0;
6032 * s2io_link_test - verifies the link state of the nic
6661 struct s2io_nic *nic = container_of(work, struct s2io_nic,
6663 struct net_device *dev = nic->dev;
6664 struct XENA_dev_config __iomem *bar0 = nic->bar0;
6673 if (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(nic->state))) {
6678 subid = nic->pdev->subsystem_device;
6679 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER) {
6690 if (verify_xena_quiescence(nic)) {
6695 nic->device_type, subid)) {
6704 nic->device_enabled_once = true;
6709 s2io_stop_all_tx_queue(nic);
6715 s2io_link(nic, LINK_UP);
6717 if (CARDS_WITH_FAULTY_LINK_INDICATORS(nic->device_type,
6728 s2io_link(nic, LINK_DOWN);
6730 clear_bit(__S2IO_STATE_LINK_TASK, &(nic->state));
7273 struct s2io_nic *sp = ring_data->nic;
7591 * @nic: device private variable
7599 static int rts_ds_steer(struct s2io_nic *nic, u8 ds_codepoint, u8 ring)
7601 struct XENA_dev_config __iomem *bar0 = nic->bar0;