aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/e1000e/es2lan.c8
-rw-r--r--drivers/net/e1000e/ethtool.c118
-rw-r--r--drivers/net/e1000e/ich8lan.c5
-rw-r--r--drivers/net/e1000e/lib.c6
-rw-r--r--drivers/net/e1000e/netdev.c21
-rw-r--r--drivers/net/e1000e/phy.c25
-rw-r--r--drivers/net/igb/e1000_82575.c37
-rw-r--r--drivers/net/igb/e1000_82575.h5
-rw-r--r--drivers/net/igb/e1000_hw.h6
-rw-r--r--drivers/net/igb/e1000_regs.h1
-rw-r--r--drivers/net/igb/igb.h1
-rw-r--r--drivers/net/igb/igb_main.c74
-rw-r--r--drivers/net/igbvf/igbvf.h1
-rw-r--r--drivers/net/igbvf/netdev.c9
-rw-r--r--drivers/net/igbvf/vf.c4
-rw-r--r--drivers/net/igbvf/vf.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c64
-rw-r--r--drivers/net/ixgbe/ixgbe_common.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c26
-rw-r--r--drivers/net/ixgbe/ixgbe_mbx.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_sriov.c52
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h13
-rw-r--r--drivers/net/ixgbe/ixgbe_x540.c2
-rw-r--r--drivers/net/ixgbevf/defines.h1
-rw-r--r--drivers/net/ixgbevf/ixgbevf.h4
-rw-r--r--drivers/net/ixgbevf/ixgbevf_main.c7
-rw-r--r--drivers/net/ixgbevf/vf.c6
-rw-r--r--drivers/net/ixgbevf/vf.h1
29 files changed, 381 insertions, 126 deletions
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index 24f8ac9cf703..b18c644e13d1 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -100,8 +100,8 @@
100 * with a lower bound at "index" and the upper bound at 100 * with a lower bound at "index" and the upper bound at
101 * "index + 5". 101 * "index + 5".
102 */ 102 */
103static const u16 e1000_gg82563_cable_length_table[] = 103static const u16 e1000_gg82563_cable_length_table[] = {
104 { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; 104 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF };
105#define GG82563_CABLE_LENGTH_TABLE_SIZE \ 105#define GG82563_CABLE_LENGTH_TABLE_SIZE \
106 ARRAY_SIZE(e1000_gg82563_cable_length_table) 106 ARRAY_SIZE(e1000_gg82563_cable_length_table)
107 107
@@ -426,8 +426,8 @@ static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
426{ 426{
427 u32 swfw_sync; 427 u32 swfw_sync;
428 428
429 while (e1000e_get_hw_semaphore(hw) != 0); 429 while (e1000e_get_hw_semaphore(hw) != 0)
430 /* Empty */ 430 ; /* Empty */
431 431
432 swfw_sync = er32(SW_FW_SYNC); 432 swfw_sync = er32(SW_FW_SYNC);
433 swfw_sync &= ~mask; 433 swfw_sync &= ~mask;
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 39349d6dcd0b..affcacf6f5a9 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -45,63 +45,67 @@ struct e1000_stats {
45 int stat_offset; 45 int stat_offset;
46}; 46};
47 47
48#define E1000_STAT(m) E1000_STATS, \ 48#define E1000_STAT(str, m) { \
49 sizeof(((struct e1000_adapter *)0)->m), \ 49 .stat_string = str, \
50 offsetof(struct e1000_adapter, m) 50 .type = E1000_STATS, \
51#define E1000_NETDEV_STAT(m) NETDEV_STATS, \ 51 .sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \
52 sizeof(((struct net_device *)0)->m), \ 52 .stat_offset = offsetof(struct e1000_adapter, m) }
53 offsetof(struct net_device, m) 53#define E1000_NETDEV_STAT(str, m) { \
54 .stat_string = str, \
55 .type = NETDEV_STATS, \
56 .sizeof_stat = sizeof(((struct net_device *)0)->m), \
57 .stat_offset = offsetof(struct net_device, m) }
54 58
55static const struct e1000_stats e1000_gstrings_stats[] = { 59static const struct e1000_stats e1000_gstrings_stats[] = {
56 { "rx_packets", E1000_STAT(stats.gprc) }, 60 E1000_STAT("rx_packets", stats.gprc),
57 { "tx_packets", E1000_STAT(stats.gptc) }, 61 E1000_STAT("tx_packets", stats.gptc),
58 { "rx_bytes", E1000_STAT(stats.gorc) }, 62 E1000_STAT("rx_bytes", stats.gorc),
59 { "tx_bytes", E1000_STAT(stats.gotc) }, 63 E1000_STAT("tx_bytes", stats.gotc),
60 { "rx_broadcast", E1000_STAT(stats.bprc) }, 64 E1000_STAT("rx_broadcast", stats.bprc),
61 { "tx_broadcast", E1000_STAT(stats.bptc) }, 65 E1000_STAT("tx_broadcast", stats.bptc),
62 { "rx_multicast", E1000_STAT(stats.mprc) }, 66 E1000_STAT("rx_multicast", stats.mprc),
63 { "tx_multicast", E1000_STAT(stats.mptc) }, 67 E1000_STAT("tx_multicast", stats.mptc),
64 { "rx_errors", E1000_NETDEV_STAT(stats.rx_errors) }, 68 E1000_NETDEV_STAT("rx_errors", stats.rx_errors),
65 { "tx_errors", E1000_NETDEV_STAT(stats.tx_errors) }, 69 E1000_NETDEV_STAT("tx_errors", stats.tx_errors),
66 { "tx_dropped", E1000_NETDEV_STAT(stats.tx_dropped) }, 70 E1000_NETDEV_STAT("tx_dropped", stats.tx_dropped),
67 { "multicast", E1000_STAT(stats.mprc) }, 71 E1000_STAT("multicast", stats.mprc),
68 { "collisions", E1000_STAT(stats.colc) }, 72 E1000_STAT("collisions", stats.colc),
69 { "rx_length_errors", E1000_NETDEV_STAT(stats.rx_length_errors) }, 73 E1000_NETDEV_STAT("rx_length_errors", stats.rx_length_errors),
70 { "rx_over_errors", E1000_NETDEV_STAT(stats.rx_over_errors) }, 74 E1000_NETDEV_STAT("rx_over_errors", stats.rx_over_errors),
71 { "rx_crc_errors", E1000_STAT(stats.crcerrs) }, 75 E1000_STAT("rx_crc_errors", stats.crcerrs),
72 { "rx_frame_errors", E1000_NETDEV_STAT(stats.rx_frame_errors) }, 76 E1000_NETDEV_STAT("rx_frame_errors", stats.rx_frame_errors),
73 { "rx_no_buffer_count", E1000_STAT(stats.rnbc) }, 77 E1000_STAT("rx_no_buffer_count", stats.rnbc),
74 { "rx_missed_errors", E1000_STAT(stats.mpc) }, 78 E1000_STAT("rx_missed_errors", stats.mpc),
75 { "tx_aborted_errors", E1000_STAT(stats.ecol) }, 79 E1000_STAT("tx_aborted_errors", stats.ecol),
76 { "tx_carrier_errors", E1000_STAT(stats.tncrs) }, 80 E1000_STAT("tx_carrier_errors", stats.tncrs),
77 { "tx_fifo_errors", E1000_NETDEV_STAT(stats.tx_fifo_errors) }, 81 E1000_NETDEV_STAT("tx_fifo_errors", stats.tx_fifo_errors),
78 { "tx_heartbeat_errors", E1000_NETDEV_STAT(stats.tx_heartbeat_errors) }, 82 E1000_NETDEV_STAT("tx_heartbeat_errors", stats.tx_heartbeat_errors),
79 { "tx_window_errors", E1000_STAT(stats.latecol) }, 83 E1000_STAT("tx_window_errors", stats.latecol),
80 { "tx_abort_late_coll", E1000_STAT(stats.latecol) }, 84 E1000_STAT("tx_abort_late_coll", stats.latecol),
81 { "tx_deferred_ok", E1000_STAT(stats.dc) }, 85 E1000_STAT("tx_deferred_ok", stats.dc),
82 { "tx_single_coll_ok", E1000_STAT(stats.scc) }, 86 E1000_STAT("tx_single_coll_ok", stats.scc),
83 { "tx_multi_coll_ok", E1000_STAT(stats.mcc) }, 87 E1000_STAT("tx_multi_coll_ok", stats.mcc),
84 { "tx_timeout_count", E1000_STAT(tx_timeout_count) }, 88 E1000_STAT("tx_timeout_count", tx_timeout_count),
85 { "tx_restart_queue", E1000_STAT(restart_queue) }, 89 E1000_STAT("tx_restart_queue", restart_queue),
86 { "rx_long_length_errors", E1000_STAT(stats.roc) }, 90 E1000_STAT("rx_long_length_errors", stats.roc),
87 { "rx_short_length_errors", E1000_STAT(stats.ruc) }, 91 E1000_STAT("rx_short_length_errors", stats.ruc),
88 { "rx_align_errors", E1000_STAT(stats.algnerrc) }, 92 E1000_STAT("rx_align_errors", stats.algnerrc),
89 { "tx_tcp_seg_good", E1000_STAT(stats.tsctc) }, 93 E1000_STAT("tx_tcp_seg_good", stats.tsctc),
90 { "tx_tcp_seg_failed", E1000_STAT(stats.tsctfc) }, 94 E1000_STAT("tx_tcp_seg_failed", stats.tsctfc),
91 { "rx_flow_control_xon", E1000_STAT(stats.xonrxc) }, 95 E1000_STAT("rx_flow_control_xon", stats.xonrxc),
92 { "rx_flow_control_xoff", E1000_STAT(stats.xoffrxc) }, 96 E1000_STAT("rx_flow_control_xoff", stats.xoffrxc),
93 { "tx_flow_control_xon", E1000_STAT(stats.xontxc) }, 97 E1000_STAT("tx_flow_control_xon", stats.xontxc),
94 { "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) }, 98 E1000_STAT("tx_flow_control_xoff", stats.xofftxc),
95 { "rx_long_byte_count", E1000_STAT(stats.gorc) }, 99 E1000_STAT("rx_long_byte_count", stats.gorc),
96 { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, 100 E1000_STAT("rx_csum_offload_good", hw_csum_good),
97 { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, 101 E1000_STAT("rx_csum_offload_errors", hw_csum_err),
98 { "rx_header_split", E1000_STAT(rx_hdr_split) }, 102 E1000_STAT("rx_header_split", rx_hdr_split),
99 { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, 103 E1000_STAT("alloc_rx_buff_failed", alloc_rx_buff_failed),
100 { "tx_smbus", E1000_STAT(stats.mgptc) }, 104 E1000_STAT("tx_smbus", stats.mgptc),
101 { "rx_smbus", E1000_STAT(stats.mgprc) }, 105 E1000_STAT("rx_smbus", stats.mgprc),
102 { "dropped_smbus", E1000_STAT(stats.mgpdc) }, 106 E1000_STAT("dropped_smbus", stats.mgpdc),
103 { "rx_dma_failed", E1000_STAT(rx_dma_failed) }, 107 E1000_STAT("rx_dma_failed", rx_dma_failed),
104 { "tx_dma_failed", E1000_STAT(tx_dma_failed) }, 108 E1000_STAT("tx_dma_failed", tx_dma_failed),
105}; 109};
106 110
107#define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats) 111#define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats)
@@ -749,8 +753,8 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data,
749 int reg, int offset, u32 mask, u32 write) 753 int reg, int offset, u32 mask, u32 write)
750{ 754{
751 u32 pat, val; 755 u32 pat, val;
752 static const u32 test[] = 756 static const u32 test[] = {
753 {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; 757 0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
754 for (pat = 0; pat < ARRAY_SIZE(test); pat++) { 758 for (pat = 0; pat < ARRAY_SIZE(test); pat++) {
755 E1000_WRITE_REG_ARRAY(&adapter->hw, reg, offset, 759 E1000_WRITE_REG_ARRAY(&adapter->hw, reg, offset,
756 (test[pat] & write)); 760 (test[pat] & write));
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 5080372b0fd7..d86cc0832720 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -2309,11 +2309,10 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
2309 */ 2309 */
2310 if (ret_val == 0) { 2310 if (ret_val == 0) {
2311 flash_data = er32flash(ICH_FLASH_FDATA0); 2311 flash_data = er32flash(ICH_FLASH_FDATA0);
2312 if (size == 1) { 2312 if (size == 1)
2313 *data = (u8)(flash_data & 0x000000FF); 2313 *data = (u8)(flash_data & 0x000000FF);
2314 } else if (size == 2) { 2314 else if (size == 2)
2315 *data = (u16)(flash_data & 0x0000FFFF); 2315 *data = (u16)(flash_data & 0x0000FFFF);
2316 }
2317 break; 2316 break;
2318 } else { 2317 } else {
2319 /* 2318 /*
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 8377523c054a..7e55170a601e 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -493,9 +493,8 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
493 * different link partner. 493 * different link partner.
494 */ 494 */
495 ret_val = e1000e_config_fc_after_link_up(hw); 495 ret_val = e1000e_config_fc_after_link_up(hw);
496 if (ret_val) { 496 if (ret_val)
497 e_dbg("Error configuring flow control\n"); 497 e_dbg("Error configuring flow control\n");
498 }
499 498
500 return ret_val; 499 return ret_val;
501} 500}
@@ -1496,9 +1495,8 @@ s32 e1000e_setup_led_generic(struct e1000_hw *hw)
1496{ 1495{
1497 u32 ledctl; 1496 u32 ledctl;
1498 1497
1499 if (hw->mac.ops.setup_led != e1000e_setup_led_generic) { 1498 if (hw->mac.ops.setup_led != e1000e_setup_led_generic)
1500 return -E1000_ERR_CONFIG; 1499 return -E1000_ERR_CONFIG;
1501 }
1502 1500
1503 if (hw->phy.media_type == e1000_media_type_fiber) { 1501 if (hw->phy.media_type == e1000_media_type_fiber) {
1504 ledctl = er32(LEDCTL); 1502 ledctl = er32(LEDCTL);
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index a45dafdf343a..fe50242aa9e6 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1325,7 +1325,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
1325 goto next_desc; 1325 goto next_desc;
1326 } 1326 }
1327 1327
1328#define rxtop rx_ring->rx_skb_top 1328#define rxtop (rx_ring->rx_skb_top)
1329 if (!(status & E1000_RXD_STAT_EOP)) { 1329 if (!(status & E1000_RXD_STAT_EOP)) {
1330 /* this descriptor is only the beginning (or middle) */ 1330 /* this descriptor is only the beginning (or middle) */
1331 if (!rxtop) { 1331 if (!rxtop) {
@@ -1806,9 +1806,8 @@ void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
1806 err = pci_enable_msix(adapter->pdev, 1806 err = pci_enable_msix(adapter->pdev,
1807 adapter->msix_entries, 1807 adapter->msix_entries,
1808 adapter->num_vectors); 1808 adapter->num_vectors);
1809 if (err == 0) { 1809 if (err == 0)
1810 return; 1810 return;
1811 }
1812 } 1811 }
1813 /* MSI-X failed, so fall through and try MSI */ 1812 /* MSI-X failed, so fall through and try MSI */
1814 e_err("Failed to initialize MSI-X interrupts. " 1813 e_err("Failed to initialize MSI-X interrupts. "
@@ -2198,9 +2197,8 @@ void e1000e_free_rx_resources(struct e1000_adapter *adapter)
2198 2197
2199 e1000_clean_rx_ring(adapter); 2198 e1000_clean_rx_ring(adapter);
2200 2199
2201 for (i = 0; i < rx_ring->count; i++) { 2200 for (i = 0; i < rx_ring->count; i++)
2202 kfree(rx_ring->buffer_info[i].ps_pages); 2201 kfree(rx_ring->buffer_info[i].ps_pages);
2203 }
2204 2202
2205 vfree(rx_ring->buffer_info); 2203 vfree(rx_ring->buffer_info);
2206 rx_ring->buffer_info = NULL; 2204 rx_ring->buffer_info = NULL;
@@ -2240,20 +2238,18 @@ static unsigned int e1000_update_itr(struct e1000_adapter *adapter,
2240 /* handle TSO and jumbo frames */ 2238 /* handle TSO and jumbo frames */
2241 if (bytes/packets > 8000) 2239 if (bytes/packets > 8000)
2242 retval = bulk_latency; 2240 retval = bulk_latency;
2243 else if ((packets < 5) && (bytes > 512)) { 2241 else if ((packets < 5) && (bytes > 512))
2244 retval = low_latency; 2242 retval = low_latency;
2245 }
2246 break; 2243 break;
2247 case low_latency: /* 50 usec aka 20000 ints/s */ 2244 case low_latency: /* 50 usec aka 20000 ints/s */
2248 if (bytes > 10000) { 2245 if (bytes > 10000) {
2249 /* this if handles the TSO accounting */ 2246 /* this if handles the TSO accounting */
2250 if (bytes/packets > 8000) { 2247 if (bytes/packets > 8000)
2251 retval = bulk_latency; 2248 retval = bulk_latency;
2252 } else if ((packets < 10) || ((bytes/packets) > 1200)) { 2249 else if ((packets < 10) || ((bytes/packets) > 1200))
2253 retval = bulk_latency; 2250 retval = bulk_latency;
2254 } else if ((packets > 35)) { 2251 else if ((packets > 35))
2255 retval = lowest_latency; 2252 retval = lowest_latency;
2256 }
2257 } else if (bytes/packets > 2000) { 2253 } else if (bytes/packets > 2000) {
2258 retval = bulk_latency; 2254 retval = bulk_latency;
2259 } else if (packets <= 2 && bytes < 512) { 2255 } else if (packets <= 2 && bytes < 512) {
@@ -2262,9 +2258,8 @@ static unsigned int e1000_update_itr(struct e1000_adapter *adapter,
2262 break; 2258 break;
2263 case bulk_latency: /* 250 usec aka 4000 ints/s */ 2259 case bulk_latency: /* 250 usec aka 4000 ints/s */
2264 if (bytes > 25000) { 2260 if (bytes > 25000) {
2265 if (packets > 35) { 2261 if (packets > 35)
2266 retval = low_latency; 2262 retval = low_latency;
2267 }
2268 } else if (bytes < 6000) { 2263 } else if (bytes < 6000) {
2269 retval = low_latency; 2264 retval = low_latency;
2270 } 2265 }
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 95da38693b77..1781efeb55e3 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -42,20 +42,20 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
42 u16 *data, bool read); 42 u16 *data, bool read);
43 43
44/* Cable length tables */ 44/* Cable length tables */
45static const u16 e1000_m88_cable_length_table[] = 45static const u16 e1000_m88_cable_length_table[] = {
46 { 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED }; 46 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
47#define M88E1000_CABLE_LENGTH_TABLE_SIZE \ 47#define M88E1000_CABLE_LENGTH_TABLE_SIZE \
48 ARRAY_SIZE(e1000_m88_cable_length_table) 48 ARRAY_SIZE(e1000_m88_cable_length_table)
49 49
50static const u16 e1000_igp_2_cable_length_table[] = 50static const u16 e1000_igp_2_cable_length_table[] = {
51 { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, 0, 0, 0, 3, 51 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, 0, 0, 0, 3,
52 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41, 6, 10, 14, 18, 22, 52 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41, 6, 10, 14, 18, 22,
53 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61, 21, 26, 31, 35, 40, 53 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61, 21, 26, 31, 35, 40,
54 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82, 40, 45, 51, 56, 61, 54 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82, 40, 45, 51, 56, 61,
55 66, 70, 75, 79, 83, 87, 91, 94, 98, 101, 104, 60, 66, 72, 77, 82, 55 66, 70, 75, 79, 83, 87, 91, 94, 98, 101, 104, 60, 66, 72, 77, 82,
56 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121, 83, 89, 95, 56 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121, 83, 89, 95,
57 100, 105, 109, 113, 116, 119, 122, 124, 104, 109, 114, 118, 121, 57 100, 105, 109, 113, 116, 119, 122, 124, 104, 109, 114, 118, 121,
58 124}; 58 124};
59#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \ 59#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \
60 ARRAY_SIZE(e1000_igp_2_cable_length_table) 60 ARRAY_SIZE(e1000_igp_2_cable_length_table)
61 61
@@ -1057,9 +1057,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
1057 1057
1058 e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); 1058 e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
1059 1059
1060 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { 1060 if (phy->autoneg_mask & ADVERTISE_1000_FULL)
1061 ret_val = e1e_wphy(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg); 1061 ret_val = e1e_wphy(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg);
1062 }
1063 1062
1064 return ret_val; 1063 return ret_val;
1065} 1064}
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index bc183f5487cb..0a2368fa6bc6 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -134,6 +134,8 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
134 case E1000_DEV_ID_82580_COPPER_DUAL: 134 case E1000_DEV_ID_82580_COPPER_DUAL:
135 case E1000_DEV_ID_DH89XXCC_SGMII: 135 case E1000_DEV_ID_DH89XXCC_SGMII:
136 case E1000_DEV_ID_DH89XXCC_SERDES: 136 case E1000_DEV_ID_DH89XXCC_SERDES:
137 case E1000_DEV_ID_DH89XXCC_BACKPLANE:
138 case E1000_DEV_ID_DH89XXCC_SFP:
137 mac->type = e1000_82580; 139 mac->type = e1000_82580;
138 break; 140 break;
139 case E1000_DEV_ID_I350_COPPER: 141 case E1000_DEV_ID_I350_COPPER:
@@ -1478,6 +1480,39 @@ out:
1478} 1480}
1479 1481
1480/** 1482/**
1483 * igb_vmdq_set_anti_spoofing_pf - enable or disable anti-spoofing
1484 * @hw: pointer to the hardware struct
1485 * @enable: state to enter, either enabled or disabled
1486 * @pf: Physical Function pool - do not set anti-spoofing for the PF
1487 *
1488 * enables/disables L2 switch anti-spoofing functionality.
1489 **/
1490void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf)
1491{
1492 u32 dtxswc;
1493
1494 switch (hw->mac.type) {
1495 case e1000_82576:
1496 case e1000_i350:
1497 dtxswc = rd32(E1000_DTXSWC);
1498 if (enable) {
1499 dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK |
1500 E1000_DTXSWC_VLAN_SPOOF_MASK);
1501 /* The PF can spoof - it has to in order to
1502 * support emulation mode NICs */
1503 dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS));
1504 } else {
1505 dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK |
1506 E1000_DTXSWC_VLAN_SPOOF_MASK);
1507 }
1508 wr32(E1000_DTXSWC, dtxswc);
1509 break;
1510 default:
1511 break;
1512 }
1513}
1514
1515/**
1481 * igb_vmdq_set_loopback_pf - enable or disable vmdq loopback 1516 * igb_vmdq_set_loopback_pf - enable or disable vmdq loopback
1482 * @hw: pointer to the hardware struct 1517 * @hw: pointer to the hardware struct
1483 * @enable: state to enter, either enabled or disabled 1518 * @enable: state to enter, either enabled or disabled
@@ -1578,7 +1613,7 @@ static s32 igb_reset_mdicnfg_82580(struct e1000_hw *hw)
1578{ 1613{
1579 s32 ret_val = 0; 1614 s32 ret_val = 0;
1580 u32 mdicnfg; 1615 u32 mdicnfg;
1581 u16 nvm_data; 1616 u16 nvm_data = 0;
1582 1617
1583 if (hw->mac.type != e1000_82580) 1618 if (hw->mac.type != e1000_82580)
1584 goto out; 1619 goto out;
diff --git a/drivers/net/igb/e1000_82575.h b/drivers/net/igb/e1000_82575.h
index cbd1e1259e4d..1d01af2472e7 100644
--- a/drivers/net/igb/e1000_82575.h
+++ b/drivers/net/igb/e1000_82575.h
@@ -194,6 +194,10 @@ struct e1000_adv_tx_context_desc {
194#define E1000_NVM_APME_82575 0x0400 194#define E1000_NVM_APME_82575 0x0400
195#define MAX_NUM_VFS 8 195#define MAX_NUM_VFS 8
196 196
197#define E1000_DTXSWC_MAC_SPOOF_MASK 0x000000FF /* Per VF MAC spoof control */
198#define E1000_DTXSWC_VLAN_SPOOF_MASK 0x0000FF00 /* Per VF VLAN spoof control */
199#define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */
200#define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8
197#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */ 201#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */
198 202
199/* Easy defines for setting default pool, would normally be left a zero */ 203/* Easy defines for setting default pool, would normally be left a zero */
@@ -243,6 +247,7 @@ struct e1000_adv_tx_context_desc {
243 247
244/* RX packet buffer size defines */ 248/* RX packet buffer size defines */
245#define E1000_RXPBS_SIZE_MASK_82576 0x0000007F 249#define E1000_RXPBS_SIZE_MASK_82576 0x0000007F
250void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *, bool, int);
246void igb_vmdq_set_loopback_pf(struct e1000_hw *, bool); 251void igb_vmdq_set_loopback_pf(struct e1000_hw *, bool);
247void igb_vmdq_set_replication_pf(struct e1000_hw *, bool); 252void igb_vmdq_set_replication_pf(struct e1000_hw *, bool);
248u16 igb_rxpbs_adjust_82580(u32 data); 253u16 igb_rxpbs_adjust_82580(u32 data);
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h
index c0b017f8d782..e2638afb8cdc 100644
--- a/drivers/net/igb/e1000_hw.h
+++ b/drivers/net/igb/e1000_hw.h
@@ -54,8 +54,10 @@ struct e1000_hw;
54#define E1000_DEV_ID_82580_SERDES 0x1510 54#define E1000_DEV_ID_82580_SERDES 0x1510
55#define E1000_DEV_ID_82580_SGMII 0x1511 55#define E1000_DEV_ID_82580_SGMII 0x1511
56#define E1000_DEV_ID_82580_COPPER_DUAL 0x1516 56#define E1000_DEV_ID_82580_COPPER_DUAL 0x1516
57#define E1000_DEV_ID_DH89XXCC_SGMII 0x0436 57#define E1000_DEV_ID_DH89XXCC_SGMII 0x0438
58#define E1000_DEV_ID_DH89XXCC_SERDES 0x0438 58#define E1000_DEV_ID_DH89XXCC_SERDES 0x043A
59#define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C
60#define E1000_DEV_ID_DH89XXCC_SFP 0x0440
59#define E1000_DEV_ID_I350_COPPER 0x1521 61#define E1000_DEV_ID_I350_COPPER 0x1521
60#define E1000_DEV_ID_I350_FIBER 0x1522 62#define E1000_DEV_ID_I350_FIBER 0x1522
61#define E1000_DEV_ID_I350_SERDES 0x1523 63#define E1000_DEV_ID_I350_SERDES 0x1523
diff --git a/drivers/net/igb/e1000_regs.h b/drivers/net/igb/e1000_regs.h
index abb7333a1fbf..8ac83c5190d5 100644
--- a/drivers/net/igb/e1000_regs.h
+++ b/drivers/net/igb/e1000_regs.h
@@ -301,6 +301,7 @@
301#define E1000_VFTE 0x00C90 /* VF Transmit Enables */ 301#define E1000_VFTE 0x00C90 /* VF Transmit Enables */
302#define E1000_QDE 0x02408 /* Queue Drop Enable - RW */ 302#define E1000_QDE 0x02408 /* Queue Drop Enable - RW */
303#define E1000_DTXSWC 0x03500 /* DMA Tx Switch Control - RW */ 303#define E1000_DTXSWC 0x03500 /* DMA Tx Switch Control - RW */
304#define E1000_WVBR 0x03554 /* VM Wrong Behavior - RWS */
304#define E1000_RPLOLR 0x05AF0 /* Replication Offload - RW */ 305#define E1000_RPLOLR 0x05AF0 /* Replication Offload - RW */
305#define E1000_UTA 0x0A000 /* Unicast Table Array - RW */ 306#define E1000_UTA 0x0A000 /* Unicast Table Array - RW */
306#define E1000_IOVTCL 0x05BBC /* IOV Control Register */ 307#define E1000_IOVTCL 0x05BBC /* IOV Control Register */
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index edab9c442399..92a4ef09e55c 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -324,6 +324,7 @@ struct igb_adapter {
324 unsigned int vfs_allocated_count; 324 unsigned int vfs_allocated_count;
325 struct vf_data_storage *vf_data; 325 struct vf_data_storage *vf_data;
326 u32 rss_queues; 326 u32 rss_queues;
327 u32 wvbr;
327}; 328};
328 329
329#define IGB_FLAG_HAS_MSI (1 << 0) 330#define IGB_FLAG_HAS_MSI (1 << 0)
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 62348fc60e53..58c665b7513d 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -73,6 +73,8 @@ static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = {
73 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER_DUAL), board_82575 }, 73 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER_DUAL), board_82575 },
74 { PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_SGMII), board_82575 }, 74 { PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_SGMII), board_82575 },
75 { PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_SERDES), board_82575 }, 75 { PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_SERDES), board_82575 },
76 { PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_BACKPLANE), board_82575 },
77 { PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_SFP), board_82575 },
76 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 }, 78 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 },
77 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS), board_82575 }, 79 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS), board_82575 },
78 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS_SERDES), board_82575 }, 80 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS_SERDES), board_82575 },
@@ -1654,7 +1656,7 @@ void igb_reset(struct igb_adapter *adapter)
1654 if (adapter->vfs_allocated_count) { 1656 if (adapter->vfs_allocated_count) {
1655 int i; 1657 int i;
1656 for (i = 0 ; i < adapter->vfs_allocated_count; i++) 1658 for (i = 0 ; i < adapter->vfs_allocated_count; i++)
1657 adapter->vf_data[i].flags = 0; 1659 adapter->vf_data[i].flags &= IGB_VF_FLAG_PF_SET_MAC;
1658 1660
1659 /* ping all the active vfs to let them know we are going down */ 1661 /* ping all the active vfs to let them know we are going down */
1660 igb_ping_all_vfs(adapter); 1662 igb_ping_all_vfs(adapter);
@@ -3364,6 +3366,45 @@ static void igb_set_rx_mode(struct net_device *netdev)
3364 igb_restore_vf_multicasts(adapter); 3366 igb_restore_vf_multicasts(adapter);
3365} 3367}
3366 3368
3369static void igb_check_wvbr(struct igb_adapter *adapter)
3370{
3371 struct e1000_hw *hw = &adapter->hw;
3372 u32 wvbr = 0;
3373
3374 switch (hw->mac.type) {
3375 case e1000_82576:
3376 case e1000_i350:
3377 if (!(wvbr = rd32(E1000_WVBR)))
3378 return;
3379 break;
3380 default:
3381 break;
3382 }
3383
3384 adapter->wvbr |= wvbr;
3385}
3386
3387#define IGB_STAGGERED_QUEUE_OFFSET 8
3388
3389static void igb_spoof_check(struct igb_adapter *adapter)
3390{
3391 int j;
3392
3393 if (!adapter->wvbr)
3394 return;
3395
3396 for(j = 0; j < adapter->vfs_allocated_count; j++) {
3397 if (adapter->wvbr & (1 << j) ||
3398 adapter->wvbr & (1 << (j + IGB_STAGGERED_QUEUE_OFFSET))) {
3399 dev_warn(&adapter->pdev->dev,
3400 "Spoof event(s) detected on VF %d\n", j);
3401 adapter->wvbr &=
3402 ~((1 << j) |
3403 (1 << (j + IGB_STAGGERED_QUEUE_OFFSET)));
3404 }
3405 }
3406}
3407
3367/* Need to wait a few seconds after link up to get diagnostic information from 3408/* Need to wait a few seconds after link up to get diagnostic information from
3368 * the phy */ 3409 * the phy */
3369static void igb_update_phy_info(unsigned long data) 3410static void igb_update_phy_info(unsigned long data)
@@ -3523,6 +3564,8 @@ static void igb_watchdog_task(struct work_struct *work)
3523 wr32(E1000_ICS, E1000_ICS_RXDMT0); 3564 wr32(E1000_ICS, E1000_ICS_RXDMT0);
3524 } 3565 }
3525 3566
3567 igb_spoof_check(adapter);
3568
3526 /* Reset the timer */ 3569 /* Reset the timer */
3527 if (!test_bit(__IGB_DOWN, &adapter->state)) 3570 if (!test_bit(__IGB_DOWN, &adapter->state))
3528 mod_timer(&adapter->watchdog_timer, 3571 mod_timer(&adapter->watchdog_timer,
@@ -4519,6 +4562,10 @@ static irqreturn_t igb_msix_other(int irq, void *data)
4519 if (icr & E1000_ICR_DOUTSYNC) { 4562 if (icr & E1000_ICR_DOUTSYNC) {
4520 /* HW is reporting DMA is out of sync */ 4563 /* HW is reporting DMA is out of sync */
4521 adapter->stats.doosync++; 4564 adapter->stats.doosync++;
4565 /* The DMA Out of Sync is also indication of a spoof event
4566 * in IOV mode. Check the Wrong VM Behavior register to
4567 * see if it is really a spoof event. */
4568 igb_check_wvbr(adapter);
4522 } 4569 }
4523 4570
4524 /* Check for a mailbox event */ 4571 /* Check for a mailbox event */
@@ -4971,8 +5018,8 @@ static int igb_set_vf_vlan(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
4971 5018
4972static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf) 5019static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf)
4973{ 5020{
4974 /* clear flags */ 5021 /* clear flags - except flag that indicates PF has set the MAC */
4975 adapter->vf_data[vf].flags &= ~(IGB_VF_FLAG_PF_SET_MAC); 5022 adapter->vf_data[vf].flags &= IGB_VF_FLAG_PF_SET_MAC;
4976 adapter->vf_data[vf].last_nack = jiffies; 5023 adapter->vf_data[vf].last_nack = jiffies;
4977 5024
4978 /* reset offloads to defaults */ 5025 /* reset offloads to defaults */
@@ -5026,7 +5073,7 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
5026 reg = rd32(E1000_VFRE); 5073 reg = rd32(E1000_VFRE);
5027 wr32(E1000_VFRE, reg | (1 << vf)); 5074 wr32(E1000_VFRE, reg | (1 << vf));
5028 5075
5029 adapter->vf_data[vf].flags = IGB_VF_FLAG_CTS; 5076 adapter->vf_data[vf].flags |= IGB_VF_FLAG_CTS;
5030 5077
5031 /* reply to reset with ack and vf mac address */ 5078 /* reply to reset with ack and vf mac address */
5032 msgbuf[0] = E1000_VF_RESET | E1000_VT_MSGTYPE_ACK; 5079 msgbuf[0] = E1000_VF_RESET | E1000_VT_MSGTYPE_ACK;
@@ -5105,7 +5152,14 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
5105 5152
5106 switch ((msgbuf[0] & 0xFFFF)) { 5153 switch ((msgbuf[0] & 0xFFFF)) {
5107 case E1000_VF_SET_MAC_ADDR: 5154 case E1000_VF_SET_MAC_ADDR:
5108 retval = igb_set_vf_mac_addr(adapter, msgbuf, vf); 5155 retval = -EINVAL;
5156 if (!(vf_data->flags & IGB_VF_FLAG_PF_SET_MAC))
5157 retval = igb_set_vf_mac_addr(adapter, msgbuf, vf);
5158 else
5159 dev_warn(&pdev->dev,
5160 "VF %d attempted to override administratively "
5161 "set MAC address\nReload the VF driver to "
5162 "resume operations\n", vf);
5109 break; 5163 break;
5110 case E1000_VF_SET_PROMISC: 5164 case E1000_VF_SET_PROMISC:
5111 retval = igb_set_vf_promisc(adapter, msgbuf, vf); 5165 retval = igb_set_vf_promisc(adapter, msgbuf, vf);
@@ -5117,8 +5171,12 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
5117 retval = igb_set_vf_rlpml(adapter, msgbuf[1], vf); 5171 retval = igb_set_vf_rlpml(adapter, msgbuf[1], vf);
5118 break; 5172 break;
5119 case E1000_VF_SET_VLAN: 5173 case E1000_VF_SET_VLAN:
5120 if (adapter->vf_data[vf].pf_vlan) 5174 retval = -1;
5121 retval = -1; 5175 if (vf_data->pf_vlan)
5176 dev_warn(&pdev->dev,
5177 "VF %d attempted to override administratively "
5178 "set VLAN tag\nReload the VF driver to "
5179 "resume operations\n", vf);
5122 else 5180 else
5123 retval = igb_set_vf_vlan(adapter, msgbuf, vf); 5181 retval = igb_set_vf_vlan(adapter, msgbuf, vf);
5124 break; 5182 break;
@@ -6582,6 +6640,8 @@ static void igb_vmm_control(struct igb_adapter *adapter)
6582 if (adapter->vfs_allocated_count) { 6640 if (adapter->vfs_allocated_count) {
6583 igb_vmdq_set_loopback_pf(hw, true); 6641 igb_vmdq_set_loopback_pf(hw, true);
6584 igb_vmdq_set_replication_pf(hw, true); 6642 igb_vmdq_set_replication_pf(hw, true);
6643 igb_vmdq_set_anti_spoofing_pf(hw, true,
6644 adapter->vfs_allocated_count);
6585 } else { 6645 } else {
6586 igb_vmdq_set_loopback_pf(hw, false); 6646 igb_vmdq_set_loopback_pf(hw, false);
6587 igb_vmdq_set_replication_pf(hw, false); 6647 igb_vmdq_set_replication_pf(hw, false);
diff --git a/drivers/net/igbvf/igbvf.h b/drivers/net/igbvf/igbvf.h
index 9d4d63e536d4..990c329e6c3b 100644
--- a/drivers/net/igbvf/igbvf.h
+++ b/drivers/net/igbvf/igbvf.h
@@ -97,6 +97,7 @@ struct igbvf_adapter;
97 97
98enum igbvf_boards { 98enum igbvf_boards {
99 board_vf, 99 board_vf,
100 board_i350_vf,
100}; 101};
101 102
102struct igbvf_queue_stats { 103struct igbvf_queue_stats {
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index 4fb023bce785..6352c8158e6d 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -64,8 +64,16 @@ static struct igbvf_info igbvf_vf_info = {
64 .init_ops = e1000_init_function_pointers_vf, 64 .init_ops = e1000_init_function_pointers_vf,
65}; 65};
66 66
67static struct igbvf_info igbvf_i350_vf_info = {
68 .mac = e1000_vfadapt_i350,
69 .flags = 0,
70 .pba = 10,
71 .init_ops = e1000_init_function_pointers_vf,
72};
73
67static const struct igbvf_info *igbvf_info_tbl[] = { 74static const struct igbvf_info *igbvf_info_tbl[] = {
68 [board_vf] = &igbvf_vf_info, 75 [board_vf] = &igbvf_vf_info,
76 [board_i350_vf] = &igbvf_i350_vf_info,
69}; 77};
70 78
71/** 79/**
@@ -2865,6 +2873,7 @@ static struct pci_error_handlers igbvf_err_handler = {
2865 2873
2866static DEFINE_PCI_DEVICE_TABLE(igbvf_pci_tbl) = { 2874static DEFINE_PCI_DEVICE_TABLE(igbvf_pci_tbl) = {
2867 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_VF), board_vf }, 2875 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_VF), board_vf },
2876 { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_VF), board_i350_vf },
2868 { } /* terminate list */ 2877 { } /* terminate list */
2869}; 2878};
2870MODULE_DEVICE_TABLE(pci, igbvf_pci_tbl); 2879MODULE_DEVICE_TABLE(pci, igbvf_pci_tbl);
diff --git a/drivers/net/igbvf/vf.c b/drivers/net/igbvf/vf.c
index 0cc13c6ed418..74486a8b009a 100644
--- a/drivers/net/igbvf/vf.c
+++ b/drivers/net/igbvf/vf.c
@@ -362,8 +362,8 @@ static s32 e1000_check_for_link_vf(struct e1000_hw *hw)
362 * or a virtual function reset 362 * or a virtual function reset
363 */ 363 */
364 364
365 /* If we were hit with a reset drop the link */ 365 /* If we were hit with a reset or timeout drop the link */
366 if (!mbx->ops.check_for_rst(hw)) 366 if (!mbx->ops.check_for_rst(hw) || !mbx->timeout)
367 mac->get_link_status = true; 367 mac->get_link_status = true;
368 368
369 if (!mac->get_link_status) 369 if (!mac->get_link_status)
diff --git a/drivers/net/igbvf/vf.h b/drivers/net/igbvf/vf.h
index c36ea21f17fa..d7ed58fcd9bb 100644
--- a/drivers/net/igbvf/vf.h
+++ b/drivers/net/igbvf/vf.h
@@ -39,6 +39,7 @@
39struct e1000_hw; 39struct e1000_hw;
40 40
41#define E1000_DEV_ID_82576_VF 0x10CA 41#define E1000_DEV_ID_82576_VF 0x10CA
42#define E1000_DEV_ID_I350_VF 0x1520
42#define E1000_REVISION_0 0 43#define E1000_REVISION_0 0
43#define E1000_REVISION_1 1 44#define E1000_REVISION_1 1
44#define E1000_REVISION_2 2 45#define E1000_REVISION_2 2
@@ -133,6 +134,7 @@ struct e1000_adv_tx_context_desc {
133enum e1000_mac_type { 134enum e1000_mac_type {
134 e1000_undefined = 0, 135 e1000_undefined = 0,
135 e1000_vfadapt, 136 e1000_vfadapt,
137 e1000_vfadapt_i350,
136 e1000_num_macs /* List is 1-based, so subtract 1 for true count. */ 138 e1000_num_macs /* List is 1-based, so subtract 1 for true count. */
137}; 139};
138 140
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 6827dddc383e..bfd3c227cd4a 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -2165,6 +2165,8 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2165 .fc_enable = &ixgbe_fc_enable_generic, 2165 .fc_enable = &ixgbe_fc_enable_generic,
2166 .init_uta_tables = &ixgbe_init_uta_tables_generic, 2166 .init_uta_tables = &ixgbe_init_uta_tables_generic,
2167 .setup_sfp = &ixgbe_setup_sfp_modules_82599, 2167 .setup_sfp = &ixgbe_setup_sfp_modules_82599,
2168 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing,
2169 .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing,
2168}; 2170};
2169 2171
2170static struct ixgbe_eeprom_operations eeprom_ops_82599 = { 2172static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index cc11e422ce9b..d5ede2df3e42 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -2809,3 +2809,67 @@ s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix,
2809wwn_prefix_out: 2809wwn_prefix_out:
2810 return 0; 2810 return 0;
2811} 2811}
2812
2813/**
2814 * ixgbe_set_mac_anti_spoofing - Enable/Disable MAC anti-spoofing
2815 * @hw: pointer to hardware structure
2816 * @enable: enable or disable switch for anti-spoofing
2817 * @pf: Physical Function pool - do not enable anti-spoofing for the PF
2818 *
2819 **/
2820void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf)
2821{
2822 int j;
2823 int pf_target_reg = pf >> 3;
2824 int pf_target_shift = pf % 8;
2825 u32 pfvfspoof = 0;
2826
2827 if (hw->mac.type == ixgbe_mac_82598EB)
2828 return;
2829
2830 if (enable)
2831 pfvfspoof = IXGBE_SPOOF_MACAS_MASK;
2832
2833 /*
2834 * PFVFSPOOF register array is size 8 with 8 bits assigned to
2835 * MAC anti-spoof enables in each register array element.
2836 */
2837 for (j = 0; j < IXGBE_PFVFSPOOF_REG_COUNT; j++)
2838 IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof);
2839
2840 /* If not enabling anti-spoofing then done */
2841 if (!enable)
2842 return;
2843
2844 /*
2845 * The PF should be allowed to spoof so that it can support
2846 * emulation mode NICs. Reset the bit assigned to the PF
2847 */
2848 pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(pf_target_reg));
2849 pfvfspoof ^= (1 << pf_target_shift);
2850 IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(pf_target_reg), pfvfspoof);
2851}
2852
2853/**
2854 * ixgbe_set_vlan_anti_spoofing - Enable/Disable VLAN anti-spoofing
2855 * @hw: pointer to hardware structure
2856 * @enable: enable or disable switch for VLAN anti-spoofing
2857 * @pf: Virtual Function pool - VF Pool to set for VLAN anti-spoofing
2858 *
2859 **/
2860void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf)
2861{
2862 int vf_target_reg = vf >> 3;
2863 int vf_target_shift = vf % 8 + IXGBE_SPOOF_VLANAS_SHIFT;
2864 u32 pfvfspoof;
2865
2866 if (hw->mac.type == ixgbe_mac_82598EB)
2867 return;
2868
2869 pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg));
2870 if (enable)
2871 pfvfspoof |= (1 << vf_target_shift);
2872 else
2873 pfvfspoof &= ~(1 << vf_target_shift);
2874 IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), pfvfspoof);
2875}
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index e1f980a8a09d..66ed045a8cf0 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -88,6 +88,8 @@ s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix,
88 u16 *wwpn_prefix); 88 u16 *wwpn_prefix);
89s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index); 89s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index);
90s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index); 90s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
91void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf);
92void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf);
91 93
92#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg))) 94#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
93 95
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index ca9036de49f9..38ab4f3f8197 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -3132,6 +3132,9 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter)
3132 3132
3133 /* enable Tx loopback for VF/PF communication */ 3133 /* enable Tx loopback for VF/PF communication */
3134 IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); 3134 IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
3135 /* Enable MAC Anti-Spoofing */
3136 hw->mac.ops.set_mac_anti_spoofing(hw, (adapter->num_vfs != 0),
3137 adapter->num_vfs);
3135} 3138}
3136 3139
3137static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) 3140static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter)
@@ -5960,6 +5963,26 @@ static void ixgbe_fdir_reinit_task(struct work_struct *work)
5960 netif_tx_start_all_queues(adapter->netdev); 5963 netif_tx_start_all_queues(adapter->netdev);
5961} 5964}
5962 5965
5966static void ixgbe_spoof_check(struct ixgbe_adapter *adapter)
5967{
5968 u32 ssvpc;
5969
5970 /* Do not perform spoof check for 82598 */
5971 if (adapter->hw.mac.type == ixgbe_mac_82598EB)
5972 return;
5973
5974 ssvpc = IXGBE_READ_REG(&adapter->hw, IXGBE_SSVPC);
5975
5976 /*
5977 * ssvpc register is cleared on read, if zero then no
5978 * spoofed packets in the last interval.
5979 */
5980 if (!ssvpc)
5981 return;
5982
5983 e_warn(drv, "%d Spoofed packets detected\n", ssvpc);
5984}
5985
5963static DEFINE_MUTEX(ixgbe_watchdog_lock); 5986static DEFINE_MUTEX(ixgbe_watchdog_lock);
5964 5987
5965/** 5988/**
@@ -6080,6 +6103,7 @@ static void ixgbe_watchdog_task(struct work_struct *work)
6080 } 6103 }
6081 } 6104 }
6082 6105
6106 ixgbe_spoof_check(adapter);
6083 ixgbe_update_stats(adapter); 6107 ixgbe_update_stats(adapter);
6084 mutex_unlock(&ixgbe_watchdog_lock); 6108 mutex_unlock(&ixgbe_watchdog_lock);
6085} 6109}
@@ -6889,7 +6913,7 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
6889 struct ixgbe_hw *hw = &adapter->hw; 6913 struct ixgbe_hw *hw = &adapter->hw;
6890 int err; 6914 int err;
6891 6915
6892 if (hw->mac.type != ixgbe_mac_82599EB || !max_vfs) 6916 if (hw->mac.type == ixgbe_mac_82598EB || !max_vfs)
6893 return; 6917 return;
6894 6918
6895 /* The 82599 supports up to 64 VFs per physical function 6919 /* The 82599 supports up to 64 VFs per physical function
diff --git a/drivers/net/ixgbe/ixgbe_mbx.c b/drivers/net/ixgbe/ixgbe_mbx.c
index 027c628c3aae..ea82c5a1cd3e 100644
--- a/drivers/net/ixgbe/ixgbe_mbx.c
+++ b/drivers/net/ixgbe/ixgbe_mbx.c
@@ -321,9 +321,11 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)
321 321
322 switch (hw->mac.type) { 322 switch (hw->mac.type) {
323 case ixgbe_mac_82599EB: 323 case ixgbe_mac_82599EB:
324 case ixgbe_mac_X540:
325 vflre = IXGBE_READ_REG(hw, IXGBE_VFLRE(reg_offset)); 324 vflre = IXGBE_READ_REG(hw, IXGBE_VFLRE(reg_offset));
326 break; 325 break;
326 case ixgbe_mac_X540:
327 vflre = IXGBE_READ_REG(hw, IXGBE_VFLREC(reg_offset));
328 break;
327 default: 329 default:
328 break; 330 break;
329 } 331 }
diff --git a/drivers/net/ixgbe/ixgbe_sriov.c b/drivers/net/ixgbe/ixgbe_sriov.c
index 6e3e94b5a5f6..47b15738b009 100644
--- a/drivers/net/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ixgbe/ixgbe_sriov.c
@@ -215,6 +215,11 @@ static inline void ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
215 reg |= (reg | (1 << vf_shift)); 215 reg |= (reg | (1 << vf_shift));
216 IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), reg); 216 IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), reg);
217 217
218 /* Enable counting of spoofed packets in the SSVPC register */
219 reg = IXGBE_READ_REG(hw, IXGBE_VMECM(reg_offset));
220 reg |= (1 << vf_shift);
221 IXGBE_WRITE_REG(hw, IXGBE_VMECM(reg_offset), reg);
222
218 ixgbe_vf_reset_event(adapter, vf); 223 ixgbe_vf_reset_event(adapter, vf);
219} 224}
220 225
@@ -227,6 +232,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
227 int entries; 232 int entries;
228 u16 *hash_list; 233 u16 *hash_list;
229 int add, vid; 234 int add, vid;
235 u8 *new_mac;
230 236
231 retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf); 237 retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
232 238
@@ -244,15 +250,22 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
244 250
245 if (msgbuf[0] == IXGBE_VF_RESET) { 251 if (msgbuf[0] == IXGBE_VF_RESET) {
246 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses; 252 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses;
247 u8 *addr = (u8 *)(&msgbuf[1]); 253 new_mac = (u8 *)(&msgbuf[1]);
248 e_info(probe, "VF Reset msg received from vf %d\n", vf); 254 e_info(probe, "VF Reset msg received from vf %d\n", vf);
249 adapter->vfinfo[vf].clear_to_send = false; 255 adapter->vfinfo[vf].clear_to_send = false;
250 ixgbe_vf_reset_msg(adapter, vf); 256 ixgbe_vf_reset_msg(adapter, vf);
251 adapter->vfinfo[vf].clear_to_send = true; 257 adapter->vfinfo[vf].clear_to_send = true;
252 258
259 if (is_valid_ether_addr(new_mac) &&
260 !adapter->vfinfo[vf].pf_set_mac)
261 ixgbe_set_vf_mac(adapter, vf, vf_mac);
262 else
263 ixgbe_set_vf_mac(adapter,
264 vf, adapter->vfinfo[vf].vf_mac_addresses);
265
253 /* reply to reset with ack and vf mac address */ 266 /* reply to reset with ack and vf mac address */
254 msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK; 267 msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK;
255 memcpy(addr, vf_mac, IXGBE_ETH_LENGTH_OF_ADDRESS); 268 memcpy(new_mac, vf_mac, IXGBE_ETH_LENGTH_OF_ADDRESS);
256 /* 269 /*
257 * Piggyback the multicast filter type so VF can compute the 270 * Piggyback the multicast filter type so VF can compute the
258 * correct vectors 271 * correct vectors
@@ -271,14 +284,16 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
271 284
272 switch ((msgbuf[0] & 0xFFFF)) { 285 switch ((msgbuf[0] & 0xFFFF)) {
273 case IXGBE_VF_SET_MAC_ADDR: 286 case IXGBE_VF_SET_MAC_ADDR:
274 { 287 new_mac = ((u8 *)(&msgbuf[1]));
275 u8 *new_mac = ((u8 *)(&msgbuf[1])); 288 if (is_valid_ether_addr(new_mac) &&
276 if (is_valid_ether_addr(new_mac) && 289 !adapter->vfinfo[vf].pf_set_mac) {
277 !adapter->vfinfo[vf].pf_set_mac) 290 ixgbe_set_vf_mac(adapter, vf, new_mac);
278 ixgbe_set_vf_mac(adapter, vf, new_mac); 291 } else if (memcmp(adapter->vfinfo[vf].vf_mac_addresses,
279 else 292 new_mac, ETH_ALEN)) {
280 ixgbe_set_vf_mac(adapter, 293 e_warn(drv, "VF %d attempted to override "
281 vf, adapter->vfinfo[vf].vf_mac_addresses); 294 "administratively set MAC address\nReload "
295 "the VF driver to resume operations\n", vf);
296 retval = -1;
282 } 297 }
283 break; 298 break;
284 case IXGBE_VF_SET_MULTICAST: 299 case IXGBE_VF_SET_MULTICAST:
@@ -295,7 +310,15 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
295 add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK) 310 add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK)
296 >> IXGBE_VT_MSGINFO_SHIFT; 311 >> IXGBE_VT_MSGINFO_SHIFT;
297 vid = (msgbuf[1] & IXGBE_VLVF_VLANID_MASK); 312 vid = (msgbuf[1] & IXGBE_VLVF_VLANID_MASK);
298 retval = ixgbe_set_vf_vlan(adapter, add, vid, vf); 313 if (adapter->vfinfo[vf].pf_vlan) {
314 e_warn(drv, "VF %d attempted to override "
315 "administratively set VLAN configuration\n"
316 "Reload the VF driver to resume operations\n",
317 vf);
318 retval = -1;
319 } else {
320 retval = ixgbe_set_vf_vlan(adapter, add, vid, vf);
321 }
299 break; 322 break;
300 default: 323 default:
301 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); 324 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);
@@ -394,6 +417,7 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
394{ 417{
395 int err = 0; 418 int err = 0;
396 struct ixgbe_adapter *adapter = netdev_priv(netdev); 419 struct ixgbe_adapter *adapter = netdev_priv(netdev);
420 struct ixgbe_hw *hw = &adapter->hw;
397 421
398 if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) 422 if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7))
399 return -EINVAL; 423 return -EINVAL;
@@ -402,7 +426,8 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
402 if (err) 426 if (err)
403 goto out; 427 goto out;
404 ixgbe_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf); 428 ixgbe_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf);
405 ixgbe_set_vmolr(&adapter->hw, vf, false); 429 ixgbe_set_vmolr(hw, vf, false);
430 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf);
406 adapter->vfinfo[vf].pf_vlan = vlan; 431 adapter->vfinfo[vf].pf_vlan = vlan;
407 adapter->vfinfo[vf].pf_qos = qos; 432 adapter->vfinfo[vf].pf_qos = qos;
408 dev_info(&adapter->pdev->dev, 433 dev_info(&adapter->pdev->dev,
@@ -419,7 +444,8 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
419 err = ixgbe_set_vf_vlan(adapter, false, 444 err = ixgbe_set_vf_vlan(adapter, false,
420 adapter->vfinfo[vf].pf_vlan, vf); 445 adapter->vfinfo[vf].pf_vlan, vf);
421 ixgbe_set_vmvir(adapter, vlan, vf); 446 ixgbe_set_vmvir(adapter, vlan, vf);
422 ixgbe_set_vmolr(&adapter->hw, vf, true); 447 ixgbe_set_vmolr(hw, vf, true);
448 hw->mac.ops.set_vlan_anti_spoofing(hw, false, vf);
423 adapter->vfinfo[vf].pf_vlan = 0; 449 adapter->vfinfo[vf].pf_vlan = 0;
424 adapter->vfinfo[vf].pf_qos = 0; 450 adapter->vfinfo[vf].pf_qos = 0;
425 } 451 }
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 59f6d0afe0fe..446f3467d3c7 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -230,6 +230,7 @@
230#define IXGBE_VT_CTL 0x051B0 230#define IXGBE_VT_CTL 0x051B0
231#define IXGBE_VFRE(_i) (0x051E0 + ((_i) * 4)) 231#define IXGBE_VFRE(_i) (0x051E0 + ((_i) * 4))
232#define IXGBE_VFTE(_i) (0x08110 + ((_i) * 4)) 232#define IXGBE_VFTE(_i) (0x08110 + ((_i) * 4))
233#define IXGBE_VMECM(_i) (0x08790 + ((_i) * 4))
233#define IXGBE_QDE 0x2F04 234#define IXGBE_QDE 0x2F04
234#define IXGBE_VMOLR(_i) (0x0F000 + ((_i) * 4)) /* 64 total */ 235#define IXGBE_VMOLR(_i) (0x0F000 + ((_i) * 4)) /* 64 total */
235#define IXGBE_UTA(_i) (0x0F400 + ((_i) * 4)) 236#define IXGBE_UTA(_i) (0x0F400 + ((_i) * 4))
@@ -284,7 +285,8 @@
284#define IXGBE_TDWBAH(_i) (0x0603C + ((_i) * 0x40)) 285#define IXGBE_TDWBAH(_i) (0x0603C + ((_i) * 0x40))
285#define IXGBE_DTXCTL 0x07E00 286#define IXGBE_DTXCTL 0x07E00
286 287
287#define IXGBE_DMATXCTL 0x04A80 288#define IXGBE_DMATXCTL 0x04A80
289#define IXGBE_PFVFSPOOF(_i) (0x08200 + ((_i) * 4)) /* 8 of these 0 - 7 */
288#define IXGBE_PFDTXGSWC 0x08220 290#define IXGBE_PFDTXGSWC 0x08220
289#define IXGBE_DTXMXSZRQ 0x08100 291#define IXGBE_DTXMXSZRQ 0x08100
290#define IXGBE_DTXTCPFLGL 0x04A88 292#define IXGBE_DTXTCPFLGL 0x04A88
@@ -298,6 +300,13 @@
298#define IXGBE_DMATXCTL_VT_SHIFT 16 /* VLAN EtherType */ 300#define IXGBE_DMATXCTL_VT_SHIFT 16 /* VLAN EtherType */
299 301
300#define IXGBE_PFDTXGSWC_VT_LBEN 0x1 /* Local L2 VT switch enable */ 302#define IXGBE_PFDTXGSWC_VT_LBEN 0x1 /* Local L2 VT switch enable */
303
304/* Anti-spoofing defines */
305#define IXGBE_SPOOF_MACAS_MASK 0xFF
306#define IXGBE_SPOOF_VLANAS_MASK 0xFF00
307#define IXGBE_SPOOF_VLANAS_SHIFT 8
308#define IXGBE_PFVFSPOOF_REG_COUNT 8
309
301#define IXGBE_DCA_TXCTRL(_i) (0x07200 + ((_i) * 4)) /* 16 of these (0-15) */ 310#define IXGBE_DCA_TXCTRL(_i) (0x07200 + ((_i) * 4)) /* 16 of these (0-15) */
302/* Tx DCA Control register : 128 of these (0-127) */ 311/* Tx DCA Control register : 128 of these (0-127) */
303#define IXGBE_DCA_TXCTRL_82599(_i) (0x0600C + ((_i) * 0x40)) 312#define IXGBE_DCA_TXCTRL_82599(_i) (0x0600C + ((_i) * 0x40))
@@ -2482,6 +2491,8 @@ struct ixgbe_mac_operations {
2482 s32 (*clear_vfta)(struct ixgbe_hw *); 2491 s32 (*clear_vfta)(struct ixgbe_hw *);
2483 s32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool); 2492 s32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool);
2484 s32 (*init_uta_tables)(struct ixgbe_hw *); 2493 s32 (*init_uta_tables)(struct ixgbe_hw *);
2494 void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
2495 void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
2485 2496
2486 /* Flow Control */ 2497 /* Flow Control */
2487 s32 (*fc_enable)(struct ixgbe_hw *, s32); 2498 s32 (*fc_enable)(struct ixgbe_hw *, s32);
diff --git a/drivers/net/ixgbe/ixgbe_x540.c b/drivers/net/ixgbe/ixgbe_x540.c
index cf88515c0ef8..3a8923993ce3 100644
--- a/drivers/net/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ixgbe/ixgbe_x540.c
@@ -685,6 +685,8 @@ static struct ixgbe_mac_operations mac_ops_X540 = {
685 .fc_enable = &ixgbe_fc_enable_generic, 685 .fc_enable = &ixgbe_fc_enable_generic,
686 .init_uta_tables = &ixgbe_init_uta_tables_generic, 686 .init_uta_tables = &ixgbe_init_uta_tables_generic,
687 .setup_sfp = NULL, 687 .setup_sfp = NULL,
688 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing,
689 .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing,
688}; 690};
689 691
690static struct ixgbe_eeprom_operations eeprom_ops_X540 = { 692static struct ixgbe_eeprom_operations eeprom_ops_X540 = {
diff --git a/drivers/net/ixgbevf/defines.h b/drivers/net/ixgbevf/defines.h
index f8a807d606c7..de643eb2ada6 100644
--- a/drivers/net/ixgbevf/defines.h
+++ b/drivers/net/ixgbevf/defines.h
@@ -30,6 +30,7 @@
30 30
31/* Device IDs */ 31/* Device IDs */
32#define IXGBE_DEV_ID_82599_VF 0x10ED 32#define IXGBE_DEV_ID_82599_VF 0x10ED
33#define IXGBE_DEV_ID_X540_VF 0x1515
33 34
34#define IXGBE_VF_IRQ_CLEAR_MASK 7 35#define IXGBE_VF_IRQ_CLEAR_MASK 7
35#define IXGBE_VF_MAX_TX_QUEUES 1 36#define IXGBE_VF_MAX_TX_QUEUES 1
diff --git a/drivers/net/ixgbevf/ixgbevf.h b/drivers/net/ixgbevf/ixgbevf.h
index 0cd6abcf9306..a63efcb2cf1b 100644
--- a/drivers/net/ixgbevf/ixgbevf.h
+++ b/drivers/net/ixgbevf/ixgbevf.h
@@ -275,9 +275,11 @@ enum ixbgevf_state_t {
275 275
276enum ixgbevf_boards { 276enum ixgbevf_boards {
277 board_82599_vf, 277 board_82599_vf,
278 board_X540_vf,
278}; 279};
279 280
280extern struct ixgbevf_info ixgbevf_vf_info; 281extern struct ixgbevf_info ixgbevf_82599_vf_info;
282extern struct ixgbevf_info ixgbevf_X540_vf_info;
281extern struct ixgbe_mac_operations ixgbevf_mbx_ops; 283extern struct ixgbe_mac_operations ixgbevf_mbx_ops;
282 284
283/* needed by ethtool.c */ 285/* needed by ethtool.c */
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
index 809e38ce8a13..464e6c9d3fc2 100644
--- a/drivers/net/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ixgbevf/ixgbevf_main.c
@@ -51,13 +51,14 @@ char ixgbevf_driver_name[] = "ixgbevf";
51static const char ixgbevf_driver_string[] = 51static const char ixgbevf_driver_string[] =
52 "Intel(R) 82599 Virtual Function"; 52 "Intel(R) 82599 Virtual Function";
53 53
54#define DRV_VERSION "1.0.12-k0" 54#define DRV_VERSION "1.0.19-k0"
55const char ixgbevf_driver_version[] = DRV_VERSION; 55const char ixgbevf_driver_version[] = DRV_VERSION;
56static char ixgbevf_copyright[] = 56static char ixgbevf_copyright[] =
57 "Copyright (c) 2009 - 2010 Intel Corporation."; 57 "Copyright (c) 2009 - 2010 Intel Corporation.";
58 58
59static const struct ixgbevf_info *ixgbevf_info_tbl[] = { 59static const struct ixgbevf_info *ixgbevf_info_tbl[] = {
60 [board_82599_vf] = &ixgbevf_vf_info, 60 [board_82599_vf] = &ixgbevf_82599_vf_info,
61 [board_X540_vf] = &ixgbevf_X540_vf_info,
61}; 62};
62 63
63/* ixgbevf_pci_tbl - PCI Device ID Table 64/* ixgbevf_pci_tbl - PCI Device ID Table
@@ -71,6 +72,8 @@ static const struct ixgbevf_info *ixgbevf_info_tbl[] = {
71static struct pci_device_id ixgbevf_pci_tbl[] = { 72static struct pci_device_id ixgbevf_pci_tbl[] = {
72 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF), 73 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF),
73 board_82599_vf}, 74 board_82599_vf},
75 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF),
76 board_X540_vf},
74 77
75 /* required last entry */ 78 /* required last entry */
76 {0, } 79 {0, }
diff --git a/drivers/net/ixgbevf/vf.c b/drivers/net/ixgbevf/vf.c
index 971019d819b4..eecd3bf6833f 100644
--- a/drivers/net/ixgbevf/vf.c
+++ b/drivers/net/ixgbevf/vf.c
@@ -381,8 +381,12 @@ static struct ixgbe_mac_operations ixgbevf_mac_ops = {
381 .set_vfta = ixgbevf_set_vfta_vf, 381 .set_vfta = ixgbevf_set_vfta_vf,
382}; 382};
383 383
384struct ixgbevf_info ixgbevf_vf_info = { 384struct ixgbevf_info ixgbevf_82599_vf_info = {
385 .mac = ixgbe_mac_82599_vf, 385 .mac = ixgbe_mac_82599_vf,
386 .mac_ops = &ixgbevf_mac_ops, 386 .mac_ops = &ixgbevf_mac_ops,
387}; 387};
388 388
389struct ixgbevf_info ixgbevf_X540_vf_info = {
390 .mac = ixgbe_mac_X540_vf,
391 .mac_ops = &ixgbevf_mac_ops,
392};
diff --git a/drivers/net/ixgbevf/vf.h b/drivers/net/ixgbevf/vf.h
index 144c99d5363a..23eb114c149f 100644
--- a/drivers/net/ixgbevf/vf.h
+++ b/drivers/net/ixgbevf/vf.h
@@ -73,6 +73,7 @@ struct ixgbe_mac_operations {
73enum ixgbe_mac_type { 73enum ixgbe_mac_type {
74 ixgbe_mac_unknown = 0, 74 ixgbe_mac_unknown = 0,
75 ixgbe_mac_82599_vf, 75 ixgbe_mac_82599_vf,
76 ixgbe_mac_X540_vf,
76 ixgbe_num_macs 77 ixgbe_num_macs
77}; 78};
78 79