Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next

+324 -84
+26 -12
drivers/net/ethernet/intel/igb/e1000_82575.c
··· 66 66 static s32 igb_reset_mdicnfg_82580(struct e1000_hw *hw); 67 67 static s32 igb_validate_nvm_checksum_82580(struct e1000_hw *hw); 68 68 static s32 igb_update_nvm_checksum_82580(struct e1000_hw *hw); 69 - static s32 igb_update_nvm_checksum_with_offset(struct e1000_hw *hw, 70 - u16 offset); 71 - static s32 igb_validate_nvm_checksum_with_offset(struct e1000_hw *hw, 72 - u16 offset); 73 69 static s32 igb_validate_nvm_checksum_i350(struct e1000_hw *hw); 74 70 static s32 igb_update_nvm_checksum_i350(struct e1000_hw *hw); 75 71 static const u16 e1000_82580_rxpbs_table[] = ··· 1580 1584 **/ 1581 1585 void igb_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable) 1582 1586 { 1583 - u32 dtxswc = rd32(E1000_DTXSWC); 1587 + u32 dtxswc; 1584 1588 1585 - if (enable) 1586 - dtxswc |= E1000_DTXSWC_VMDQ_LOOPBACK_EN; 1587 - else 1588 - dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN; 1589 + switch (hw->mac.type) { 1590 + case e1000_82576: 1591 + dtxswc = rd32(E1000_DTXSWC); 1592 + if (enable) 1593 + dtxswc |= E1000_DTXSWC_VMDQ_LOOPBACK_EN; 1594 + else 1595 + dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN; 1596 + wr32(E1000_DTXSWC, dtxswc); 1597 + break; 1598 + case e1000_i350: 1599 + dtxswc = rd32(E1000_TXSWC); 1600 + if (enable) 1601 + dtxswc |= E1000_DTXSWC_VMDQ_LOOPBACK_EN; 1602 + else 1603 + dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN; 1604 + wr32(E1000_TXSWC, dtxswc); 1605 + break; 1606 + default: 1607 + /* Currently no other hardware supports loopback */ 1608 + break; 1609 + } 1589 1610 1590 - wr32(E1000_DTXSWC, dtxswc); 1611 + 1591 1612 } 1592 1613 1593 1614 /** ··· 1833 1820 * Calculates the EEPROM checksum by reading/adding each word of the EEPROM 1834 1821 * and then verifies that the sum of the EEPROM is equal to 0xBABA. 1835 1822 **/ 1836 - s32 igb_validate_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset) 1823 + static s32 igb_validate_nvm_checksum_with_offset(struct e1000_hw *hw, 1824 + u16 offset) 1837 1825 { 1838 1826 s32 ret_val = 0; 1839 1827 u16 checksum = 0; ··· 1869 1855 * up to the checksum. Then calculates the EEPROM checksum and writes the 1870 1856 * value to the EEPROM. 1871 1857 **/ 1872 - s32 igb_update_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset) 1858 + static s32 igb_update_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset) 1873 1859 { 1874 1860 s32 ret_val; 1875 1861 u16 checksum = 0;
+1
drivers/net/ethernet/intel/igb/e1000_defines.h
··· 85 85 #define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ 86 86 #define E1000_RXD_STAT_TS 0x10000 /* Pkt was time stamped */ 87 87 88 + #define E1000_RXDEXT_STATERR_LB 0x00040000 88 89 #define E1000_RXDEXT_STATERR_CE 0x01000000 89 90 #define E1000_RXDEXT_STATERR_SE 0x02000000 90 91 #define E1000_RXDEXT_STATERR_SEQ 0x04000000
+1
drivers/net/ethernet/intel/igb/e1000_regs.h
··· 318 318 #define E1000_RPLOLR 0x05AF0 /* Replication Offload - RW */ 319 319 #define E1000_UTA 0x0A000 /* Unicast Table Array - RW */ 320 320 #define E1000_IOVTCL 0x05BBC /* IOV Control Register */ 321 + #define E1000_TXSWC 0x05ACC /* Tx Switch Control */ 321 322 /* These act per VF so an array friendly macro is used */ 322 323 #define E1000_P2VMAILBOX(_n) (0x00C00 + (4 * (_n))) 323 324 #define E1000_VMBMEM(_n) (0x00800 + (64 * (_n)))
+1
drivers/net/ethernet/intel/igb/igb.h
··· 245 245 246 246 enum e1000_ring_flags_t { 247 247 IGB_RING_FLAG_RX_SCTP_CSUM, 248 + IGB_RING_FLAG_RX_LB_VLAN_BSWAP, 248 249 IGB_RING_FLAG_TX_CTX_IDX, 249 250 IGB_RING_FLAG_TX_DETECT_HANG 250 251 };
+54 -58
drivers/net/ethernet/intel/igb/igb_main.c
··· 57 57 #include "igb.h" 58 58 59 59 #define MAJ 3 60 - #define MIN 0 61 - #define BUILD 6 60 + #define MIN 2 61 + #define BUILD 10 62 62 #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ 63 63 __stringify(BUILD) "-k" 64 64 char igb_driver_name[] = "igb"; ··· 563 563 * the lowest register is SYSTIMR instead of SYSTIML. However we never 564 564 * adjusted TIMINCA so SYSTIMR will just read as all 0s so ignore it. 565 565 */ 566 - if (hw->mac.type == e1000_82580) { 566 + if (hw->mac.type >= e1000_82580) { 567 567 stamp = rd32(E1000_SYSTIMR) >> 8; 568 568 shift = IGB_82580_TSYNC_SHIFT; 569 569 } ··· 735 735 /* set flag indicating ring supports SCTP checksum offload */ 736 736 if (adapter->hw.mac.type >= e1000_82576) 737 737 set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags); 738 + 739 + /* On i350, loopback VLAN packets have the tag byte-swapped. */ 740 + if (adapter->hw.mac.type == e1000_i350) 741 + set_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags); 742 + 738 743 adapter->rx_ring[i] = ring; 739 744 } 740 745 /* Restore the adapter's original node */ ··· 1267 1262 goto request_done; 1268 1263 /* fall back to MSI */ 1269 1264 igb_clear_interrupt_scheme(adapter); 1270 - if (!pci_enable_msi(adapter->pdev)) 1265 + if (!pci_enable_msi(pdev)) 1271 1266 adapter->flags |= IGB_FLAG_HAS_MSI; 1272 1267 igb_free_all_tx_resources(adapter); 1273 1268 igb_free_all_rx_resources(adapter); ··· 1289 1284 } 1290 1285 igb_setup_all_tx_resources(adapter); 1291 1286 igb_setup_all_rx_resources(adapter); 1292 - } else { 1293 - igb_assign_vector(adapter->q_vector[0], 0); 1294 1287 } 1295 1288 1289 + igb_assign_vector(adapter->q_vector[0], 0); 1290 + 1296 1291 if (adapter->flags & IGB_FLAG_HAS_MSI) { 1297 - err = request_irq(adapter->pdev->irq, igb_intr_msi, 0, 1292 + err = request_irq(pdev->irq, igb_intr_msi, 0, 1298 1293 netdev->name, adapter); 1299 1294 if (!err) 1300 1295 goto request_done; ··· 1304 1299 adapter->flags &= ~IGB_FLAG_HAS_MSI; 1305 1300 } 1306 1301 1307 - err = request_irq(adapter->pdev->irq, igb_intr, IRQF_SHARED, 1302 + err = request_irq(pdev->irq, igb_intr, IRQF_SHARED, 1308 1303 netdev->name, adapter); 1309 1304 1310 1305 if (err) 1311 - dev_err(&adapter->pdev->dev, "Error %d getting interrupt\n", 1306 + dev_err(&pdev->dev, "Error %d getting interrupt\n", 1312 1307 err); 1313 1308 1314 1309 request_done: ··· 1322 1317 1323 1318 free_irq(adapter->msix_entries[vector++].vector, adapter); 1324 1319 1325 - for (i = 0; i < adapter->num_q_vectors; i++) { 1326 - struct igb_q_vector *q_vector = adapter->q_vector[i]; 1320 + for (i = 0; i < adapter->num_q_vectors; i++) 1327 1321 free_irq(adapter->msix_entries[vector++].vector, 1328 - q_vector); 1329 - } 1322 + adapter->q_vector[i]); 1330 1323 } else { 1331 1324 free_irq(adapter->pdev->irq, adapter); 1332 1325 } ··· 1372 1369 struct e1000_hw *hw = &adapter->hw; 1373 1370 1374 1371 if (adapter->msix_entries) { 1375 - u32 ims = E1000_IMS_LSC | E1000_IMS_DOUTSYNC; 1372 + u32 ims = E1000_IMS_LSC | E1000_IMS_DOUTSYNC | E1000_IMS_DRSTA; 1376 1373 u32 regval = rd32(E1000_EIAC); 1377 1374 wr32(E1000_EIAC, regval | adapter->eims_enable_mask); 1378 1375 regval = rd32(E1000_EIAM); ··· 1382 1379 wr32(E1000_MBVFIMR, 0xFF); 1383 1380 ims |= E1000_IMS_VMMB; 1384 1381 } 1385 - if (adapter->hw.mac.type == e1000_82580) 1386 - ims |= E1000_IMS_DRSTA; 1387 - 1388 1382 wr32(E1000_IMS, ims); 1389 1383 } else { 1390 1384 wr32(E1000_IMS, IMS_ENABLE_MASK | ··· 1523 1523 1524 1524 clear_bit(__IGB_DOWN, &adapter->state); 1525 1525 1526 - for (i = 0; i < adapter->num_q_vectors; i++) { 1527 - struct igb_q_vector *q_vector = adapter->q_vector[i]; 1528 - napi_enable(&q_vector->napi); 1529 - } 1526 + for (i = 0; i < adapter->num_q_vectors; i++) 1527 + napi_enable(&(adapter->q_vector[i]->napi)); 1528 + 1530 1529 if (adapter->msix_entries) 1531 1530 igb_configure_msix(adapter); 1532 1531 else ··· 1577 1578 wrfl(); 1578 1579 msleep(10); 1579 1580 1580 - for (i = 0; i < adapter->num_q_vectors; i++) { 1581 - struct igb_q_vector *q_vector = adapter->q_vector[i]; 1582 - napi_disable(&q_vector->napi); 1583 - } 1581 + for (i = 0; i < adapter->num_q_vectors; i++) 1582 + napi_disable(&(adapter->q_vector[i]->napi)); 1584 1583 1585 1584 igb_irq_disable(adapter); 1586 1585 ··· 2543 2546 /* From here on the code is the same as igb_up() */ 2544 2547 clear_bit(__IGB_DOWN, &adapter->state); 2545 2548 2546 - for (i = 0; i < adapter->num_q_vectors; i++) { 2547 - struct igb_q_vector *q_vector = adapter->q_vector[i]; 2548 - napi_enable(&q_vector->napi); 2549 - } 2549 + for (i = 0; i < adapter->num_q_vectors; i++) 2550 + napi_enable(&(adapter->q_vector[i]->napi)); 2550 2551 2551 2552 /* Clear any pending interrupts. */ 2552 2553 rd32(E1000_ICR); ··· 3114 3119 srrctl |= (PAGE_SIZE / 2) >> E1000_SRRCTL_BSIZEPKT_SHIFT; 3115 3120 #endif 3116 3121 srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS; 3117 - if (hw->mac.type == e1000_82580) 3122 + if (hw->mac.type >= e1000_82580) 3118 3123 srrctl |= E1000_SRRCTL_TIMESTAMP; 3119 3124 /* Only set Drop Enable if we are supporting multiple queues */ 3120 3125 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1) ··· 3764 3769 /* Cause software interrupt to ensure rx ring is cleaned */ 3765 3770 if (adapter->msix_entries) { 3766 3771 u32 eics = 0; 3767 - for (i = 0; i < adapter->num_q_vectors; i++) { 3768 - struct igb_q_vector *q_vector = adapter->q_vector[i]; 3769 - eics |= q_vector->eims_value; 3770 - } 3772 + for (i = 0; i < adapter->num_q_vectors; i++) 3773 + eics |= adapter->q_vector[i]->eims_value; 3771 3774 wr32(E1000_EICS, eics); 3772 3775 } else { 3773 3776 wr32(E1000_ICS, E1000_ICS_RXDMT0); ··· 4465 4472 /* Do the reset outside of interrupt context */ 4466 4473 adapter->tx_timeout_count++; 4467 4474 4468 - if (hw->mac.type == e1000_82580) 4475 + if (hw->mac.type >= e1000_82580) 4469 4476 hw->dev_spec._82575.global_device_reset = true; 4470 4477 4471 4478 schedule_work(&adapter->reset_task); ··· 4771 4778 mod_timer(&adapter->watchdog_timer, jiffies + 1); 4772 4779 } 4773 4780 4774 - if (adapter->vfs_allocated_count) 4775 - wr32(E1000_IMS, E1000_IMS_LSC | 4776 - E1000_IMS_VMMB | 4777 - E1000_IMS_DOUTSYNC); 4778 - else 4779 - wr32(E1000_IMS, E1000_IMS_LSC | E1000_IMS_DOUTSYNC); 4780 4781 wr32(E1000_EIMS, adapter->eims_other); 4781 4782 4782 4783 return IRQ_HANDLED; ··· 5577 5590 * The 82580 starts with 1ns at bit 0 in RX/TXSTMPL, shift this up to 5578 5591 * 24 to match clock shift we setup earlier. 5579 5592 */ 5580 - if (adapter->hw.mac.type == e1000_82580) 5593 + if (adapter->hw.mac.type >= e1000_82580) 5581 5594 regval <<= IGB_82580_TSYNC_SHIFT; 5582 5595 5583 5596 ns = timecounter_cyc2time(&adapter->clock, regval); ··· 5869 5882 5870 5883 igb_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval); 5871 5884 } 5885 + 5886 + static void igb_rx_vlan(struct igb_ring *ring, 5887 + union e1000_adv_rx_desc *rx_desc, 5888 + struct sk_buff *skb) 5889 + { 5890 + if (igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { 5891 + u16 vid; 5892 + if (igb_test_staterr(rx_desc, E1000_RXDEXT_STATERR_LB) && 5893 + test_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags)) 5894 + vid = be16_to_cpu(rx_desc->wb.upper.vlan); 5895 + else 5896 + vid = le16_to_cpu(rx_desc->wb.upper.vlan); 5897 + 5898 + __vlan_hwaccel_put_tag(skb, vid); 5899 + } 5900 + } 5901 + 5872 5902 static inline u16 igb_get_hlen(union e1000_adv_rx_desc *rx_desc) 5873 5903 { 5874 5904 /* HW will not DMA in data larger than the given buffer, even if it ··· 5982 5978 igb_rx_hwtstamp(q_vector, rx_desc, skb); 5983 5979 igb_rx_hash(rx_ring, rx_desc, skb); 5984 5980 igb_rx_checksum(rx_ring, rx_desc, skb); 5985 - 5986 - if (igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { 5987 - u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan); 5988 - 5989 - __vlan_hwaccel_put_tag(skb, vid); 5990 - } 5981 + igb_rx_vlan(rx_ring, rx_desc, skb); 5991 5982 5992 5983 total_bytes += skb->len; 5993 5984 total_packets++; ··· 6284 6285 * timestamped, so enable timestamping in all packets as 6285 6286 * long as one rx filter was configured. 6286 6287 */ 6287 - if ((hw->mac.type == e1000_82580) && tsync_rx_ctl) { 6288 + if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) { 6288 6289 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; 6289 6290 tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; 6290 6291 } ··· 6670 6671 { 6671 6672 struct igb_adapter *adapter = netdev_priv(netdev); 6672 6673 struct e1000_hw *hw = &adapter->hw; 6674 + struct igb_q_vector *q_vector; 6673 6675 int i; 6674 6676 6675 - if (!adapter->msix_entries) { 6676 - struct igb_q_vector *q_vector = adapter->q_vector[0]; 6677 - igb_irq_disable(adapter); 6678 - napi_schedule(&q_vector->napi); 6679 - return; 6680 - } 6681 - 6682 6677 for (i = 0; i < adapter->num_q_vectors; i++) { 6683 - struct igb_q_vector *q_vector = adapter->q_vector[i]; 6684 - wr32(E1000_EIMC, q_vector->eims_value); 6678 + q_vector = adapter->q_vector[i]; 6679 + if (adapter->msix_entries) 6680 + wr32(E1000_EIMC, q_vector->eims_value); 6681 + else 6682 + igb_irq_disable(adapter); 6685 6683 napi_schedule(&q_vector->napi); 6686 6684 } 6687 6685 }
+4
drivers/net/ethernet/intel/ixgbe/ixgbe.h
··· 116 116 #define MAX_EMULATION_MAC_ADDRS 16 117 117 #define IXGBE_MAX_PF_MACVLANS 15 118 118 #define VMDQ_P(p) ((p) + adapter->num_vfs) 119 + #define IXGBE_82599_VF_DEVICE_ID 0x10ED 120 + #define IXGBE_X540_VF_DEVICE_ID 0x1515 119 121 120 122 struct vf_data_storage { 121 123 unsigned char vf_mac_addresses[ETH_ALEN]; ··· 514 512 struct hlist_head fdir_filter_list; 515 513 union ixgbe_atr_input fdir_mask; 516 514 int fdir_filter_count; 515 + u32 timer_event_accumulator; 516 + u32 vferr_refcount; 517 517 }; 518 518 519 519 struct ixgbe_fdir_filter {
+10 -2
drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
··· 318 318 .selector = DCB_APP_IDTYPE_ETHTYPE, 319 319 .protocol = ETH_P_FCOE, 320 320 }; 321 - u8 up = dcb_getapp(netdev, &app); 321 + u8 up; 322 + 323 + /* In IEEE mode, use the IEEE Ethertype selector value */ 324 + if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) { 325 + app.selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE; 326 + up = dcb_ieee_getapp_mask(netdev, &app); 327 + } else { 328 + up = dcb_getapp(netdev, &app); 329 + } 322 330 #endif 323 331 324 332 /* Fail command if not in CEE mode */ ··· 339 331 return DCB_NO_HW_CHG; 340 332 341 333 #ifdef IXGBE_FCOE 342 - if (up && (up != (1 << adapter->fcoe.up))) 334 + if (up && !(up & (1 << adapter->fcoe.up))) 343 335 adapter->dcb_set_bitmap |= BIT_APP_UPCHG; 344 336 345 337 /*
+2
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
··· 113 113 {"rx_fcoe_dropped", IXGBE_STAT(stats.fcoerpdc)}, 114 114 {"rx_fcoe_packets", IXGBE_STAT(stats.fcoeprc)}, 115 115 {"rx_fcoe_dwords", IXGBE_STAT(stats.fcoedwrc)}, 116 + {"fcoe_noddp", IXGBE_STAT(stats.fcoe_noddp)}, 117 + {"fcoe_noddp_ext_buff", IXGBE_STAT(stats.fcoe_noddp_ext_buff)}, 116 118 {"tx_fcoe_packets", IXGBE_STAT(stats.fcoeptc)}, 117 119 {"tx_fcoe_dwords", IXGBE_STAT(stats.fcoedwtc)}, 118 120 #endif /* IXGBE_FCOE */
+33 -11
drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
··· 145 145 u32 fcbuff, fcdmarw, fcfltrw, fcrxctl; 146 146 dma_addr_t addr = 0; 147 147 struct pci_pool *pool; 148 + unsigned int cpu; 148 149 149 150 if (!netdev || !sgl) 150 151 return 0; ··· 183 182 } 184 183 185 184 /* alloc the udl from per cpu ddp pool */ 186 - pool = *per_cpu_ptr(fcoe->pool, get_cpu()); 185 + cpu = get_cpu(); 186 + pool = *per_cpu_ptr(fcoe->pool, cpu); 187 187 ddp->udl = pci_pool_alloc(pool, GFP_ATOMIC, &ddp->udp); 188 188 if (!ddp->udl) { 189 189 e_err(drv, "failed allocated ddp context\n"); ··· 201 199 while (len) { 202 200 /* max number of buffers allowed in one DDP context */ 203 201 if (j >= IXGBE_BUFFCNT_MAX) { 204 - e_err(drv, "xid=%x:%d,%d,%d:addr=%llx " 205 - "not enough descriptors\n", 206 - xid, i, j, dmacount, (u64)addr); 202 + *per_cpu_ptr(fcoe->pcpu_noddp, cpu) += 1; 207 203 goto out_noddp_free; 208 204 } 209 205 ··· 241 241 */ 242 242 if (lastsize == bufflen) { 243 243 if (j >= IXGBE_BUFFCNT_MAX) { 244 - printk_once("Will NOT use DDP since there are not " 245 - "enough user buffers. We need an extra " 246 - "buffer because lastsize is bufflen. " 247 - "xid=%x:%d,%d,%d:addr=%llx\n", 248 - xid, i, j, dmacount, (u64)addr); 249 - 244 + *per_cpu_ptr(fcoe->pcpu_noddp_ext_buff, cpu) += 1; 250 245 goto out_noddp_free; 251 246 } 252 247 ··· 595 600 struct ixgbe_hw *hw = &adapter->hw; 596 601 struct ixgbe_fcoe *fcoe = &adapter->fcoe; 597 602 struct ixgbe_ring_feature *f = &adapter->ring_feature[RING_F_FCOE]; 603 + unsigned int cpu; 598 604 599 605 if (!fcoe->pool) { 600 606 spin_lock_init(&fcoe->lock); ··· 622 626 fcoe->extra_ddp_buffer_dma)) { 623 627 e_err(drv, "failed to map extra DDP buffer\n"); 624 628 goto out_extra_ddp_buffer; 629 + } 630 + 631 + /* Alloc per cpu mem to count the ddp alloc failure number */ 632 + fcoe->pcpu_noddp = alloc_percpu(u64); 633 + if (!fcoe->pcpu_noddp) { 634 + e_err(drv, "failed to alloc noddp counter\n"); 635 + goto out_pcpu_noddp_alloc_fail; 636 + } 637 + 638 + fcoe->pcpu_noddp_ext_buff = alloc_percpu(u64); 639 + if (!fcoe->pcpu_noddp_ext_buff) { 640 + e_err(drv, "failed to alloc noddp extra buff cnt\n"); 641 + goto out_pcpu_noddp_extra_buff_alloc_fail; 642 + } 643 + 644 + for_each_possible_cpu(cpu) { 645 + *per_cpu_ptr(fcoe->pcpu_noddp, cpu) = 0; 646 + *per_cpu_ptr(fcoe->pcpu_noddp_ext_buff, cpu) = 0; 625 647 } 626 648 } 627 649 ··· 678 664 IXGBE_WRITE_REG(hw, IXGBE_FCRXCTRL, IXGBE_FCRXCTRL_FCCRCBO | 679 665 (FC_FCOE_VER << IXGBE_FCRXCTRL_FCOEVER_SHIFT)); 680 666 return; 681 - 667 + out_pcpu_noddp_extra_buff_alloc_fail: 668 + free_percpu(fcoe->pcpu_noddp); 669 + out_pcpu_noddp_alloc_fail: 670 + dma_unmap_single(&adapter->pdev->dev, 671 + fcoe->extra_ddp_buffer_dma, 672 + IXGBE_FCBUFF_MIN, 673 + DMA_FROM_DEVICE); 682 674 out_extra_ddp_buffer: 683 675 kfree(fcoe->extra_ddp_buffer); 684 676 out_ddp_pools: ··· 713 693 fcoe->extra_ddp_buffer_dma, 714 694 IXGBE_FCBUFF_MIN, 715 695 DMA_FROM_DEVICE); 696 + free_percpu(fcoe->pcpu_noddp); 697 + free_percpu(fcoe->pcpu_noddp_ext_buff); 716 698 kfree(fcoe->extra_ddp_buffer); 717 699 ixgbe_fcoe_ddp_pools_free(fcoe); 718 700 }
+2
drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.h
··· 73 73 unsigned char *extra_ddp_buffer; 74 74 dma_addr_t extra_ddp_buffer_dma; 75 75 unsigned long mode; 76 + u64 __percpu *pcpu_noddp; 77 + u64 __percpu *pcpu_noddp_ext_buff; 76 78 #ifdef CONFIG_IXGBE_DCB 77 79 u8 up; 78 80 #endif
+188 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 5552 5552 u64 non_eop_descs = 0, restart_queue = 0, tx_busy = 0; 5553 5553 u64 alloc_rx_page_failed = 0, alloc_rx_buff_failed = 0; 5554 5554 u64 bytes = 0, packets = 0; 5555 + #ifdef IXGBE_FCOE 5556 + struct ixgbe_fcoe *fcoe = &adapter->fcoe; 5557 + unsigned int cpu; 5558 + u64 fcoe_noddp_counts_sum = 0, fcoe_noddp_ext_buff_counts_sum = 0; 5559 + #endif /* IXGBE_FCOE */ 5555 5560 5556 5561 if (test_bit(__IXGBE_DOWN, &adapter->state) || 5557 5562 test_bit(__IXGBE_RESETTING, &adapter->state)) ··· 5684 5679 hwstats->fcoeptc += IXGBE_READ_REG(hw, IXGBE_FCOEPTC); 5685 5680 hwstats->fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC); 5686 5681 hwstats->fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC); 5682 + /* Add up per cpu counters for total ddp aloc fail */ 5683 + if (fcoe->pcpu_noddp && fcoe->pcpu_noddp_ext_buff) { 5684 + for_each_possible_cpu(cpu) { 5685 + fcoe_noddp_counts_sum += 5686 + *per_cpu_ptr(fcoe->pcpu_noddp, cpu); 5687 + fcoe_noddp_ext_buff_counts_sum += 5688 + *per_cpu_ptr(fcoe-> 5689 + pcpu_noddp_ext_buff, cpu); 5690 + } 5691 + } 5692 + hwstats->fcoe_noddp = fcoe_noddp_counts_sum; 5693 + hwstats->fcoe_noddp_ext_buff = fcoe_noddp_ext_buff_counts_sum; 5687 5694 #endif /* IXGBE_FCOE */ 5688 5695 break; 5689 5696 default: ··· 6129 6112 clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); 6130 6113 } 6131 6114 6115 + #ifdef CONFIG_PCI_IOV 6116 + static void ixgbe_check_for_bad_vf(struct ixgbe_adapter *adapter) 6117 + { 6118 + int vf; 6119 + struct ixgbe_hw *hw = &adapter->hw; 6120 + struct net_device *netdev = adapter->netdev; 6121 + u32 gpc; 6122 + u32 ciaa, ciad; 6123 + 6124 + gpc = IXGBE_READ_REG(hw, IXGBE_TXDGPC); 6125 + if (gpc) /* If incrementing then no need for the check below */ 6126 + return; 6127 + /* 6128 + * Check to see if a bad DMA write target from an errant or 6129 + * malicious VF has caused a PCIe error. If so then we can 6130 + * issue a VFLR to the offending VF(s) and then resume without 6131 + * requesting a full slot reset. 6132 + */ 6133 + 6134 + for (vf = 0; vf < adapter->num_vfs; vf++) { 6135 + ciaa = (vf << 16) | 0x80000000; 6136 + /* 32 bit read so align, we really want status at offset 6 */ 6137 + ciaa |= PCI_COMMAND; 6138 + IXGBE_WRITE_REG(hw, IXGBE_CIAA_82599, ciaa); 6139 + ciad = IXGBE_READ_REG(hw, IXGBE_CIAD_82599); 6140 + ciaa &= 0x7FFFFFFF; 6141 + /* disable debug mode asap after reading data */ 6142 + IXGBE_WRITE_REG(hw, IXGBE_CIAA_82599, ciaa); 6143 + /* Get the upper 16 bits which will be the PCI status reg */ 6144 + ciad >>= 16; 6145 + if (ciad & PCI_STATUS_REC_MASTER_ABORT) { 6146 + netdev_err(netdev, "VF %d Hung DMA\n", vf); 6147 + /* Issue VFLR */ 6148 + ciaa = (vf << 16) | 0x80000000; 6149 + ciaa |= 0xA8; 6150 + IXGBE_WRITE_REG(hw, IXGBE_CIAA_82599, ciaa); 6151 + ciad = 0x00008000; /* VFLR */ 6152 + IXGBE_WRITE_REG(hw, IXGBE_CIAD_82599, ciad); 6153 + ciaa &= 0x7FFFFFFF; 6154 + IXGBE_WRITE_REG(hw, IXGBE_CIAA_82599, ciaa); 6155 + } 6156 + } 6157 + } 6158 + 6159 + #endif 6132 6160 /** 6133 6161 * ixgbe_service_timer - Timer Call-back 6134 6162 * @data: pointer to adapter cast into an unsigned long ··· 6182 6120 { 6183 6121 struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)data; 6184 6122 unsigned long next_event_offset; 6123 + bool ready = true; 6185 6124 6125 + #ifdef CONFIG_PCI_IOV 6126 + ready = false; 6127 + 6128 + /* 6129 + * don't bother with SR-IOV VF DMA hang check if there are 6130 + * no VFs or the link is down 6131 + */ 6132 + if (!adapter->num_vfs || 6133 + (adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE)) { 6134 + ready = true; 6135 + goto normal_timer_service; 6136 + } 6137 + 6138 + /* If we have VFs allocated then we must check for DMA hangs */ 6139 + ixgbe_check_for_bad_vf(adapter); 6140 + next_event_offset = HZ / 50; 6141 + adapter->timer_event_accumulator++; 6142 + 6143 + if (adapter->timer_event_accumulator >= 100) { 6144 + ready = true; 6145 + adapter->timer_event_accumulator = 0; 6146 + } 6147 + 6148 + goto schedule_event; 6149 + 6150 + normal_timer_service: 6151 + #endif 6186 6152 /* poll faster when waiting for link */ 6187 6153 if (adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE) 6188 6154 next_event_offset = HZ / 10; 6189 6155 else 6190 6156 next_event_offset = HZ * 2; 6191 6157 6158 + #ifdef CONFIG_PCI_IOV 6159 + schedule_event: 6160 + #endif 6192 6161 /* Reset the timer */ 6193 6162 mod_timer(&adapter->service_timer, next_event_offset + jiffies); 6194 6163 6195 - ixgbe_service_event_schedule(adapter); 6164 + if (ready) 6165 + ixgbe_service_event_schedule(adapter); 6196 6166 } 6197 6167 6198 6168 static void ixgbe_reset_subtask(struct ixgbe_adapter *adapter) ··· 7811 7717 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); 7812 7718 struct net_device *netdev = adapter->netdev; 7813 7719 7720 + #ifdef CONFIG_PCI_IOV 7721 + struct pci_dev *bdev, *vfdev; 7722 + u32 dw0, dw1, dw2, dw3; 7723 + int vf, pos; 7724 + u16 req_id, pf_func; 7725 + 7726 + if (adapter->hw.mac.type == ixgbe_mac_82598EB || 7727 + adapter->num_vfs == 0) 7728 + goto skip_bad_vf_detection; 7729 + 7730 + bdev = pdev->bus->self; 7731 + while (bdev && (bdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT)) 7732 + bdev = bdev->bus->self; 7733 + 7734 + if (!bdev) 7735 + goto skip_bad_vf_detection; 7736 + 7737 + pos = pci_find_ext_capability(bdev, PCI_EXT_CAP_ID_ERR); 7738 + if (!pos) 7739 + goto skip_bad_vf_detection; 7740 + 7741 + pci_read_config_dword(bdev, pos + PCI_ERR_HEADER_LOG, &dw0); 7742 + pci_read_config_dword(bdev, pos + PCI_ERR_HEADER_LOG + 4, &dw1); 7743 + pci_read_config_dword(bdev, pos + PCI_ERR_HEADER_LOG + 8, &dw2); 7744 + pci_read_config_dword(bdev, pos + PCI_ERR_HEADER_LOG + 12, &dw3); 7745 + 7746 + req_id = dw1 >> 16; 7747 + /* On the 82599 if bit 7 of the requestor ID is set then it's a VF */ 7748 + if (!(req_id & 0x0080)) 7749 + goto skip_bad_vf_detection; 7750 + 7751 + pf_func = req_id & 0x01; 7752 + if ((pf_func & 1) == (pdev->devfn & 1)) { 7753 + unsigned int device_id; 7754 + 7755 + vf = (req_id & 0x7F) >> 1; 7756 + e_dev_err("VF %d has caused a PCIe error\n", vf); 7757 + e_dev_err("TLP: dw0: %8.8x\tdw1: %8.8x\tdw2: " 7758 + "%8.8x\tdw3: %8.8x\n", 7759 + dw0, dw1, dw2, dw3); 7760 + switch (adapter->hw.mac.type) { 7761 + case ixgbe_mac_82599EB: 7762 + device_id = IXGBE_82599_VF_DEVICE_ID; 7763 + break; 7764 + case ixgbe_mac_X540: 7765 + device_id = IXGBE_X540_VF_DEVICE_ID; 7766 + break; 7767 + default: 7768 + device_id = 0; 7769 + break; 7770 + } 7771 + 7772 + /* Find the pci device of the offending VF */ 7773 + vfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, device_id, NULL); 7774 + while (vfdev) { 7775 + if (vfdev->devfn == (req_id & 0xFF)) 7776 + break; 7777 + vfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, 7778 + device_id, vfdev); 7779 + } 7780 + /* 7781 + * There's a slim chance the VF could have been hot plugged, 7782 + * so if it is no longer present we don't need to issue the 7783 + * VFLR. Just clean up the AER in that case. 7784 + */ 7785 + if (vfdev) { 7786 + e_dev_err("Issuing VFLR to VF %d\n", vf); 7787 + pci_write_config_dword(vfdev, 0xA8, 0x00008000); 7788 + } 7789 + 7790 + pci_cleanup_aer_uncorrect_error_status(pdev); 7791 + } 7792 + 7793 + /* 7794 + * Even though the error may have occurred on the other port 7795 + * we still need to increment the vf error reference count for 7796 + * both ports because the I/O resume function will be called 7797 + * for both of them. 7798 + */ 7799 + adapter->vferr_refcount++; 7800 + 7801 + return PCI_ERS_RESULT_RECOVERED; 7802 + 7803 + skip_bad_vf_detection: 7804 + #endif /* CONFIG_PCI_IOV */ 7814 7805 netif_device_detach(netdev); 7815 7806 7816 7807 if (state == pci_channel_io_perm_failure) ··· 7958 7779 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); 7959 7780 struct net_device *netdev = adapter->netdev; 7960 7781 7782 + #ifdef CONFIG_PCI_IOV 7783 + if (adapter->vferr_refcount) { 7784 + e_info(drv, "Resuming after VF err\n"); 7785 + adapter->vferr_refcount--; 7786 + return; 7787 + } 7788 + 7789 + #endif 7961 7790 if (netif_running(netdev)) 7962 7791 ixgbe_up(adapter); 7963 7792
+2
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
··· 2682 2682 u64 fcoeptc; 2683 2683 u64 fcoedwrc; 2684 2684 u64 fcoedwtc; 2685 + u64 fcoe_noddp; 2686 + u64 fcoe_noddp_ext_buff; 2685 2687 u64 b2ospc; 2686 2688 u64 b2ogprc; 2687 2689 u64 o2bgptc;