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
1111 static int init_tti(struct s2io_nic *nic, int link, bool may_sleep)
1113 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1116 struct config_param *config = &nic->config;
1124 if (nic->device_type == XFRAME_II_DEVICE) {
1125 int count = (nic->config.bus_speed * 125)/2;
1139 if (nic->config.intr_type == MSI_X) {
1145 if ((nic->config.tx_steering_type ==
1148 (i >= nic->udp_fifo_idx) &&
1149 (i < (nic->udp_fifo_idx +
1150 nic->total_udp_fifos)))
1180 * @nic: device private variable
1187 static int init_nic(struct s2io_nic *nic)
1189 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1190 struct net_device *dev = nic->dev;
1198 struct config_param *config = &nic->config;
1199 struct mac_info *mac_control = &nic->mac_control;
1202 if (s2io_set_swapper(nic)) {
1210 if (nic->device_type & XFRAME_II_DEVICE) {
1226 if (nic->device_type == XFRAME_II_DEVICE) {
1255 if (nic->device_type & XFRAME_II_DEVICE) {
1321 if ((nic->device_type == XFRAME_I_DEVICE) && (nic->pdev->revision < 4))
1353 if (nic->device_type & XFRAME_II_DEVICE)
1634 if (rts_ds_steer(nic, i, 0) == FAILURE) {
1645 if (nic->device_type == XFRAME_II_DEVICE) {
1664 if (SUCCESS != init_tti(nic, nic->last_link_state, true))
1668 if (nic->device_type == XFRAME_II_DEVICE) {
1673 int count = (nic->config.bus_speed * 125)/4;
1686 if (nic->config.intr_type == MSI_X)
1744 if (nic->device_type == XFRAME_II_DEVICE)
1759 val64 |= RMAC_PAUSE_HG_PTIME(nic->mac_control.rmac_pause_time);
1771 nic->mac_control.mc_pause_threshold_q0q3)
1779 nic->mac_control.mc_pause_threshold_q4q7)
1792 if (nic->config.bus_speed == 266) {
1802 if (nic->device_type == XFRAME_II_DEVICE) {
1810 if (strstr(nic->product_name, "CX4")) {
1820 static int s2io_link_fault_indication(struct s2io_nic *nic)
1822 if (nic->device_type == XFRAME_II_DEVICE)
1850 static void en_dis_err_alarms(struct s2io_nic *nic, u16 mask, int flag)
1852 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1949 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER)
1971 nic->general_int_mask = gen_int_mask;
1974 nic->general_int_mask = 0;
1979 * @nic: device private variable,
1988 static void en_dis_able_nic_intrs(struct s2io_nic *nic, u16 mask, int flag)
1990 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1993 intr_mask = nic->general_int_mask;
2007 if (s2io_link_fault_indication(nic) ==
2064 nic->general_int_mask = readq(&bar0->general_int_mask);
2198 * @nic : device private variable.
2209 static int start_nic(struct s2io_nic *nic)
2211 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2212 struct net_device *dev = nic->dev;
2215 struct config_param *config = &nic->config;
2216 struct mac_info *mac_control = &nic->mac_control;
2226 if (nic->rxd_mode == RXD_MODE_1)
2230 if (nic->device_type == XFRAME_II_DEVICE)
2237 if (nic->rxd_mode == RXD_MODE_3B) {
2248 nic->vlan_strip_flag = 0;
2273 if (!verify_xena_quiescence(nic)) {
2293 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER) {
2298 schedule_work(&nic->set_link_task);
2301 subid = nic->pdev->subsystem_device;
2303 (nic->device_type == XFRAME_I_DEVICE)) {
2322 struct s2io_nic *nic = fifo_data->nic;
2329 dma_unmap_single(&nic->pdev->dev,
2340 dma_unmap_single(&nic->pdev->dev, (dma_addr_t)txds->Buffer_Pointer,
2349 dma_unmap_page(&nic->pdev->dev,
2360 * @nic : device private variable.
2366 static void free_tx_buffers(struct s2io_nic *nic)
2368 struct net_device *dev = nic->dev;
2373 struct config_param *config = &nic->config;
2374 struct mac_info *mac_control = &nic->mac_control;
2403 * stop_nic - To stop the nic
2404 * @nic : device private variable.
2412 static void stop_nic(struct s2io_nic *nic)
2414 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2419 en_dis_err_alarms(nic, ENA_ALL_INTRS, DISABLE_INTRS);
2422 en_dis_able_nic_intrs(nic, interruptible, DISABLE_INTRS);
2432 * @nic : device private variable.
2453 static int fill_rx_buffers(struct s2io_nic *nic, struct ring_info *ring,
2467 struct swStat *swstats = &ring->nic->mac_control.stats_info->sw_stat;
2516 skb = netdev_alloc_skb(nic->dev, size);
2539 if (dma_mapping_error(&nic->pdev->dev, rxdp1->Buffer0_ptr))
2574 if (dma_mapping_error(&nic->pdev->dev, rxdp3->Buffer0_ptr))
2595 if (dma_mapping_error(&nic->pdev->dev, rxdp3->Buffer2_ptr))
2605 if (dma_mapping_error(&nic->pdev->dev,
2738 static int s2io_chk_rx_buffers(struct s2io_nic *nic, struct ring_info *ring)
2740 if (fill_rx_buffers(nic, ring, 0) == -ENOMEM) {
2767 struct s2io_nic *nic = netdev_priv(dev);
2768 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2771 if (unlikely(!is_s2io_card_up(nic)))
2775 s2io_chk_rx_buffers(nic, ring);
2791 struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi);
2794 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2796 struct config_param *config = &nic->config;
2797 struct mac_info *mac_control = &nic->mac_control;
2799 if (unlikely(!is_s2io_card_up(nic)))
2805 s2io_chk_rx_buffers(nic, ring);
2832 struct s2io_nic *nic = netdev_priv(dev);
2833 const int irq = nic->pdev->irq;
2834 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2837 struct config_param *config = &nic->config;
2838 struct mac_info *mac_control = &nic->mac_control;
2840 if (pci_channel_offline(nic->pdev))
2865 if (fill_rx_buffers(nic, ring, 0) == -ENOMEM) {
2960 if (ring_data->nic->config.napi) {
2975 update_L3L4_header(ring_data->nic, lro);
2998 struct s2io_nic *nic = fifo_data->nic;
3005 struct stat_block *stats = nic->mac_control.stats_info;
3070 s2io_wake_tx_queue(fifo_data, pkt_cnt, nic->config.multiq);
3655 static int wait_for_msix_trans(struct s2io_nic *nic, int i)
3657 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3676 static void restore_xmsi_data(struct s2io_nic *nic)
3678 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3682 if (nic->device_type == XFRAME_I_DEVICE)
3687 writeq(nic->msix_info[i].addr, &bar0->xmsi_address);
3688 writeq(nic->msix_info[i].data, &bar0->xmsi_data);
3691 if (wait_for_msix_trans(nic, msix_index))
3697 static void store_xmsi_data(struct s2io_nic *nic)
3699 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3703 if (nic->device_type == XFRAME_I_DEVICE)
3711 if (wait_for_msix_trans(nic, msix_index)) {
3719 nic->msix_info[i].addr = addr;
3720 nic->msix_info[i].data = data;
3725 static int s2io_enable_msi_x(struct s2io_nic *nic)
3727 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3732 struct stat_block *stats = nic->mac_control.stats_info;
3735 size = nic->num_entries * sizeof(struct msix_entry);
3736 nic->entries = kzalloc(size, GFP_KERNEL);
3737 if (!nic->entries) {
3745 size = nic->num_entries * sizeof(struct s2io_msix_entry);
3746 nic->s2io_entries = kzalloc(size, GFP_KERNEL);
3747 if (!nic->s2io_entries) {
3751 kfree(nic->entries);
3753 += (nic->num_entries * sizeof(struct msix_entry));
3758 nic->entries[0].entry = 0;
3759 nic->s2io_entries[0].entry = 0;
3760 nic->s2io_entries[0].in_use = MSIX_FLG;
3761 nic->s2io_entries[0].type = MSIX_ALARM_TYPE;
3762 nic->s2io_entries[0].arg = &nic->mac_control.fifos;
3764 for (i = 1; i < nic->num_entries; i++) {
3765 nic->entries[i].entry = ((i - 1) * 8) + 1;
3766 nic->s2io_entries[i].entry = ((i - 1) * 8) + 1;
3767 nic->s2io_entries[i].arg = NULL;
3768 nic->s2io_entries[i].in_use = 0;
3772 for (j = 0; j < nic->config.rx_ring_num; j++) {
3774 nic->s2io_entries[j+1].arg = &nic->mac_control.rings[j];
3775 nic->s2io_entries[j+1].type = MSIX_RING_TYPE;
3776 nic->s2io_entries[j+1].in_use = MSIX_FLG;
3782 ret = pci_enable_msix_range(nic->pdev, nic->entries,
3783 nic->num_entries, nic->num_entries);
3787 kfree(nic->entries);
3788 swstats->mem_freed += nic->num_entries *
3790 kfree(nic->s2io_entries);
3791 swstats->mem_freed += nic->num_entries *
3793 nic->entries = NULL;
3794 nic->s2io_entries = NULL;
3802 pci_read_config_word(nic->pdev, 0x42, &msi_control);
3804 pci_write_config_word(nic->pdev, 0x42, msi_control);
4207 struct s2io_nic *sp = ring->nic;
4235 struct s2io_nic *sp = fifos->nic;
5410 * s2io_ethtool_set_led - To physically identify the nic on the system.
5676 static void s2io_vpd_read(struct s2io_nic *nic)
5682 struct swStat *swstats = &nic->mac_control.stats_info->sw_stat;
5684 if (nic->device_type == XFRAME_II_DEVICE) {
5685 strcpy(nic->product_name, "Xframe II 10GbE network adapter");
5688 strcpy(nic->product_name, "Xframe I 10GbE network adapter");
5691 strcpy(nic->serial_num, "NOT AVAILABLE");
5701 pci_write_config_byte(nic->pdev, (vpd_addr + 2), i);
5702 pci_read_config_byte(nic->pdev, (vpd_addr + 2), &data);
5703 pci_write_config_byte(nic->pdev, (vpd_addr + 3), 0);
5706 pci_read_config_byte(nic->pdev, (vpd_addr + 3), &data);
5715 pci_read_config_dword(nic->pdev, (vpd_addr + 4),
5726 memcpy(nic->serial_num,
5729 memset(nic->serial_num+len,
5740 memcpy(nic->product_name, &vpd_data[3], len);
5741 nic->product_name[len] = 0;
6039 * s2io_link_test - verifies the link state of the nic
6668 struct s2io_nic *nic = container_of(work, struct s2io_nic,
6670 struct net_device *dev = nic->dev;
6671 struct XENA_dev_config __iomem *bar0 = nic->bar0;
6680 if (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(nic->state))) {
6685 subid = nic->pdev->subsystem_device;
6686 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER) {
6697 if (verify_xena_quiescence(nic)) {
6702 nic->device_type, subid)) {
6711 nic->device_enabled_once = true;
6716 s2io_stop_all_tx_queue(nic);
6722 s2io_link(nic, LINK_UP);
6724 if (CARDS_WITH_FAULTY_LINK_INDICATORS(nic->device_type,
6735 s2io_link(nic, LINK_DOWN);
6737 clear_bit(__S2IO_STATE_LINK_TASK, &(nic->state));
7280 struct s2io_nic *sp = ring_data->nic;
7597 * @nic: device private variable
7605 static int rts_ds_steer(struct s2io_nic *nic, u8 ds_codepoint, u8 ring)
7607 struct XENA_dev_config __iomem *bar0 = nic->bar0;