diff options
author | David S. Miller <davem@davemloft.net> | 2011-05-15 01:08:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-15 01:08:23 -0400 |
commit | 89c64d755fbf04d7541d526931dc4b38301946d1 (patch) | |
tree | 734a5ef3cece35923b2486fff766523ca2a6d78b | |
parent | 4dc6ec26fe7d9f89349d4c0c654e2f07420f4b27 (diff) | |
parent | 4f6290cf610a7a48b39603ff7822746463453e01 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/jkirsher/net-next-2.6
-rw-r--r-- | drivers/net/e1000e/lib.c | 4 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe.h | 110 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_82599.c | 3 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_common.c | 22 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 1 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 972 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_mbx.h | 1 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_sriov.c | 98 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_type.h | 2 | ||||
-rw-r--r-- | drivers/net/ixgbevf/ixgbevf_main.c | 30 | ||||
-rw-r--r-- | drivers/net/ixgbevf/mbx.h | 1 | ||||
-rw-r--r-- | drivers/net/ixgbevf/vf.c | 34 | ||||
-rw-r--r-- | drivers/net/ixgbevf/vf.h | 1 |
13 files changed, 793 insertions, 486 deletions
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 6432ddab40ce..dd8ab05b5590 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -144,7 +144,7 @@ void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value) | |||
144 | * @hw: pointer to the HW structure | 144 | * @hw: pointer to the HW structure |
145 | * @rar_count: receive address registers | 145 | * @rar_count: receive address registers |
146 | * | 146 | * |
147 | * Setups the receive address registers by setting the base receive address | 147 | * Setup the receive address registers by setting the base receive address |
148 | * register to the devices MAC address and clearing all the other receive | 148 | * register to the devices MAC address and clearing all the other receive |
149 | * address registers to 0. | 149 | * address registers to 0. |
150 | **/ | 150 | **/ |
@@ -1181,7 +1181,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) | |||
1181 | * of pause frames. In this case, we had to advertise | 1181 | * of pause frames. In this case, we had to advertise |
1182 | * FULL flow control because we could not advertise Rx | 1182 | * FULL flow control because we could not advertise Rx |
1183 | * ONLY. Hence, we must now check to see if we need to | 1183 | * ONLY. Hence, we must now check to see if we need to |
1184 | * turn OFF the TRANSMISSION of PAUSE frames. | 1184 | * turn OFF the TRANSMISSION of PAUSE frames. |
1185 | */ | 1185 | */ |
1186 | if (hw->fc.requested_mode == e1000_fc_full) { | 1186 | if (hw->fc.requested_mode == e1000_fc_full) { |
1187 | hw->fc.current_mode = e1000_fc_full; | 1187 | hw->fc.current_mode = e1000_fc_full; |
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index 37ff531d59c0..e467b20ed1f0 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -106,6 +106,7 @@ | |||
106 | #define IXGBE_MAX_VF_FUNCTIONS 64 | 106 | #define IXGBE_MAX_VF_FUNCTIONS 64 |
107 | #define IXGBE_MAX_VFTA_ENTRIES 128 | 107 | #define IXGBE_MAX_VFTA_ENTRIES 128 |
108 | #define MAX_EMULATION_MAC_ADDRS 16 | 108 | #define MAX_EMULATION_MAC_ADDRS 16 |
109 | #define IXGBE_MAX_PF_MACVLANS 15 | ||
109 | #define VMDQ_P(p) ((p) + adapter->num_vfs) | 110 | #define VMDQ_P(p) ((p) + adapter->num_vfs) |
110 | 111 | ||
111 | struct vf_data_storage { | 112 | struct vf_data_storage { |
@@ -121,6 +122,15 @@ struct vf_data_storage { | |||
121 | u16 tx_rate; | 122 | u16 tx_rate; |
122 | }; | 123 | }; |
123 | 124 | ||
125 | struct vf_macvlans { | ||
126 | struct list_head l; | ||
127 | int vf; | ||
128 | int rar_entry; | ||
129 | bool free; | ||
130 | bool is_macvlan; | ||
131 | u8 vf_macvlan[ETH_ALEN]; | ||
132 | }; | ||
133 | |||
124 | /* wrapper around a pointer to a socket buffer, | 134 | /* wrapper around a pointer to a socket buffer, |
125 | * so a DMA handle can be stored along with the buffer */ | 135 | * so a DMA handle can be stored along with the buffer */ |
126 | struct ixgbe_tx_buffer { | 136 | struct ixgbe_tx_buffer { |
@@ -331,10 +341,52 @@ struct ixgbe_q_vector { | |||
331 | 341 | ||
332 | /* board specific private data structure */ | 342 | /* board specific private data structure */ |
333 | struct ixgbe_adapter { | 343 | struct ixgbe_adapter { |
334 | struct timer_list watchdog_timer; | 344 | unsigned long state; |
345 | |||
346 | /* Some features need tri-state capability, | ||
347 | * thus the additional *_CAPABLE flags. | ||
348 | */ | ||
349 | u32 flags; | ||
350 | #define IXGBE_FLAG_RX_CSUM_ENABLED (u32)(1) | ||
351 | #define IXGBE_FLAG_MSI_CAPABLE (u32)(1 << 1) | ||
352 | #define IXGBE_FLAG_MSI_ENABLED (u32)(1 << 2) | ||
353 | #define IXGBE_FLAG_MSIX_CAPABLE (u32)(1 << 3) | ||
354 | #define IXGBE_FLAG_MSIX_ENABLED (u32)(1 << 4) | ||
355 | #define IXGBE_FLAG_RX_1BUF_CAPABLE (u32)(1 << 6) | ||
356 | #define IXGBE_FLAG_RX_PS_CAPABLE (u32)(1 << 7) | ||
357 | #define IXGBE_FLAG_RX_PS_ENABLED (u32)(1 << 8) | ||
358 | #define IXGBE_FLAG_IN_NETPOLL (u32)(1 << 9) | ||
359 | #define IXGBE_FLAG_DCA_ENABLED (u32)(1 << 10) | ||
360 | #define IXGBE_FLAG_DCA_CAPABLE (u32)(1 << 11) | ||
361 | #define IXGBE_FLAG_IMIR_ENABLED (u32)(1 << 12) | ||
362 | #define IXGBE_FLAG_MQ_CAPABLE (u32)(1 << 13) | ||
363 | #define IXGBE_FLAG_DCB_ENABLED (u32)(1 << 14) | ||
364 | #define IXGBE_FLAG_RSS_ENABLED (u32)(1 << 16) | ||
365 | #define IXGBE_FLAG_RSS_CAPABLE (u32)(1 << 17) | ||
366 | #define IXGBE_FLAG_VMDQ_CAPABLE (u32)(1 << 18) | ||
367 | #define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 19) | ||
368 | #define IXGBE_FLAG_FAN_FAIL_CAPABLE (u32)(1 << 20) | ||
369 | #define IXGBE_FLAG_NEED_LINK_UPDATE (u32)(1 << 22) | ||
370 | #define IXGBE_FLAG_NEED_LINK_CONFIG (u32)(1 << 23) | ||
371 | #define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 24) | ||
372 | #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 25) | ||
373 | #define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 26) | ||
374 | #define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 27) | ||
375 | #define IXGBE_FLAG_SRIOV_CAPABLE (u32)(1 << 28) | ||
376 | #define IXGBE_FLAG_SRIOV_ENABLED (u32)(1 << 29) | ||
377 | |||
378 | u32 flags2; | ||
379 | #define IXGBE_FLAG2_RSC_CAPABLE (u32)(1) | ||
380 | #define IXGBE_FLAG2_RSC_ENABLED (u32)(1 << 1) | ||
381 | #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE (u32)(1 << 2) | ||
382 | #define IXGBE_FLAG2_TEMP_SENSOR_EVENT (u32)(1 << 3) | ||
383 | #define IXGBE_FLAG2_SEARCH_FOR_SFP (u32)(1 << 4) | ||
384 | #define IXGBE_FLAG2_SFP_NEEDS_RESET (u32)(1 << 5) | ||
385 | #define IXGBE_FLAG2_RESET_REQUESTED (u32)(1 << 6) | ||
386 | #define IXGBE_FLAG2_FDIR_REQUIRES_REINIT (u32)(1 << 7) | ||
387 | |||
335 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; | 388 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
336 | u16 bd_number; | 389 | u16 bd_number; |
337 | struct work_struct reset_task; | ||
338 | struct ixgbe_q_vector *q_vector[MAX_MSIX_Q_VECTORS]; | 390 | struct ixgbe_q_vector *q_vector[MAX_MSIX_Q_VECTORS]; |
339 | 391 | ||
340 | /* DCB parameters */ | 392 | /* DCB parameters */ |
@@ -377,43 +429,6 @@ struct ixgbe_adapter { | |||
377 | u32 alloc_rx_page_failed; | 429 | u32 alloc_rx_page_failed; |
378 | u32 alloc_rx_buff_failed; | 430 | u32 alloc_rx_buff_failed; |
379 | 431 | ||
380 | /* Some features need tri-state capability, | ||
381 | * thus the additional *_CAPABLE flags. | ||
382 | */ | ||
383 | u32 flags; | ||
384 | #define IXGBE_FLAG_RX_CSUM_ENABLED (u32)(1) | ||
385 | #define IXGBE_FLAG_MSI_CAPABLE (u32)(1 << 1) | ||
386 | #define IXGBE_FLAG_MSI_ENABLED (u32)(1 << 2) | ||
387 | #define IXGBE_FLAG_MSIX_CAPABLE (u32)(1 << 3) | ||
388 | #define IXGBE_FLAG_MSIX_ENABLED (u32)(1 << 4) | ||
389 | #define IXGBE_FLAG_RX_1BUF_CAPABLE (u32)(1 << 6) | ||
390 | #define IXGBE_FLAG_RX_PS_CAPABLE (u32)(1 << 7) | ||
391 | #define IXGBE_FLAG_RX_PS_ENABLED (u32)(1 << 8) | ||
392 | #define IXGBE_FLAG_IN_NETPOLL (u32)(1 << 9) | ||
393 | #define IXGBE_FLAG_DCA_ENABLED (u32)(1 << 10) | ||
394 | #define IXGBE_FLAG_DCA_CAPABLE (u32)(1 << 11) | ||
395 | #define IXGBE_FLAG_IMIR_ENABLED (u32)(1 << 12) | ||
396 | #define IXGBE_FLAG_MQ_CAPABLE (u32)(1 << 13) | ||
397 | #define IXGBE_FLAG_DCB_ENABLED (u32)(1 << 14) | ||
398 | #define IXGBE_FLAG_RSS_ENABLED (u32)(1 << 16) | ||
399 | #define IXGBE_FLAG_RSS_CAPABLE (u32)(1 << 17) | ||
400 | #define IXGBE_FLAG_VMDQ_CAPABLE (u32)(1 << 18) | ||
401 | #define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 19) | ||
402 | #define IXGBE_FLAG_FAN_FAIL_CAPABLE (u32)(1 << 20) | ||
403 | #define IXGBE_FLAG_NEED_LINK_UPDATE (u32)(1 << 22) | ||
404 | #define IXGBE_FLAG_IN_SFP_LINK_TASK (u32)(1 << 23) | ||
405 | #define IXGBE_FLAG_IN_SFP_MOD_TASK (u32)(1 << 24) | ||
406 | #define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 25) | ||
407 | #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 26) | ||
408 | #define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 27) | ||
409 | #define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 28) | ||
410 | #define IXGBE_FLAG_SRIOV_CAPABLE (u32)(1 << 29) | ||
411 | #define IXGBE_FLAG_SRIOV_ENABLED (u32)(1 << 30) | ||
412 | |||
413 | u32 flags2; | ||
414 | #define IXGBE_FLAG2_RSC_CAPABLE (u32)(1) | ||
415 | #define IXGBE_FLAG2_RSC_ENABLED (u32)(1 << 1) | ||
416 | #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE (u32)(1 << 2) | ||
417 | /* default to trying for four seconds */ | 432 | /* default to trying for four seconds */ |
418 | #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ) | 433 | #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ) |
419 | 434 | ||
@@ -434,7 +449,6 @@ struct ixgbe_adapter { | |||
434 | u32 rx_eitr_param; | 449 | u32 rx_eitr_param; |
435 | u32 tx_eitr_param; | 450 | u32 tx_eitr_param; |
436 | 451 | ||
437 | unsigned long state; | ||
438 | u64 tx_busy; | 452 | u64 tx_busy; |
439 | unsigned int tx_ring_count; | 453 | unsigned int tx_ring_count; |
440 | unsigned int rx_ring_count; | 454 | unsigned int rx_ring_count; |
@@ -443,15 +457,12 @@ struct ixgbe_adapter { | |||
443 | bool link_up; | 457 | bool link_up; |
444 | unsigned long link_check_timeout; | 458 | unsigned long link_check_timeout; |
445 | 459 | ||
446 | struct work_struct watchdog_task; | 460 | struct work_struct service_task; |
447 | struct work_struct sfp_task; | 461 | struct timer_list service_timer; |
448 | struct timer_list sfp_timer; | ||
449 | struct work_struct multispeed_fiber_task; | ||
450 | struct work_struct sfp_config_module_task; | ||
451 | u32 fdir_pballoc; | 462 | u32 fdir_pballoc; |
452 | u32 atr_sample_rate; | 463 | u32 atr_sample_rate; |
464 | unsigned long fdir_overflow; /* number of times ATR was backed off */ | ||
453 | spinlock_t fdir_perfect_lock; | 465 | spinlock_t fdir_perfect_lock; |
454 | struct work_struct fdir_reinit_task; | ||
455 | #ifdef IXGBE_FCOE | 466 | #ifdef IXGBE_FCOE |
456 | struct ixgbe_fcoe fcoe; | 467 | struct ixgbe_fcoe fcoe; |
457 | #endif /* IXGBE_FCOE */ | 468 | #endif /* IXGBE_FCOE */ |
@@ -462,7 +473,6 @@ struct ixgbe_adapter { | |||
462 | 473 | ||
463 | int node; | 474 | int node; |
464 | u32 led_reg; | 475 | u32 led_reg; |
465 | struct work_struct check_overtemp_task; | ||
466 | u32 interrupt_event; | 476 | u32 interrupt_event; |
467 | char lsc_int_name[IFNAMSIZ + 9]; | 477 | char lsc_int_name[IFNAMSIZ + 9]; |
468 | 478 | ||
@@ -471,13 +481,17 @@ struct ixgbe_adapter { | |||
471 | unsigned int num_vfs; | 481 | unsigned int num_vfs; |
472 | struct vf_data_storage *vfinfo; | 482 | struct vf_data_storage *vfinfo; |
473 | int vf_rate_link_speed; | 483 | int vf_rate_link_speed; |
484 | struct vf_macvlans vf_mvs; | ||
485 | struct vf_macvlans *mv_list; | ||
486 | bool antispoofing_enabled; | ||
474 | }; | 487 | }; |
475 | 488 | ||
476 | enum ixbge_state_t { | 489 | enum ixbge_state_t { |
477 | __IXGBE_TESTING, | 490 | __IXGBE_TESTING, |
478 | __IXGBE_RESETTING, | 491 | __IXGBE_RESETTING, |
479 | __IXGBE_DOWN, | 492 | __IXGBE_DOWN, |
480 | __IXGBE_SFP_MODULE_NOT_FOUND | 493 | __IXGBE_SERVICE_SCHED, |
494 | __IXGBE_IN_SFP_INIT, | ||
481 | }; | 495 | }; |
482 | 496 | ||
483 | struct ixgbe_rsc_cb { | 497 | struct ixgbe_rsc_cb { |
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c index dba5ca6e35c4..8ee661245af3 100644 --- a/drivers/net/ixgbe/ixgbe_82599.c +++ b/drivers/net/ixgbe/ixgbe_82599.c | |||
@@ -368,6 +368,9 @@ static enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw) | |||
368 | case IXGBE_DEV_ID_82599_T3_LOM: | 368 | case IXGBE_DEV_ID_82599_T3_LOM: |
369 | media_type = ixgbe_media_type_copper; | 369 | media_type = ixgbe_media_type_copper; |
370 | break; | 370 | break; |
371 | case IXGBE_DEV_ID_82599_LS: | ||
372 | media_type = ixgbe_media_type_fiber_lco; | ||
373 | break; | ||
371 | default: | 374 | default: |
372 | media_type = ixgbe_media_type_unknown; | 375 | media_type = ixgbe_media_type_unknown; |
373 | break; | 376 | break; |
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index c4730cd39b22..b894b42a741c 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -1189,6 +1189,28 @@ static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw) | |||
1189 | udelay(50); | 1189 | udelay(50); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | if (i == timeout) { | ||
1193 | hw_dbg(hw, "Driver can't access the Eeprom - SMBI Semaphore " | ||
1194 | "not granted.\n"); | ||
1195 | /* | ||
1196 | * this release is particularly important because our attempts | ||
1197 | * above to get the semaphore may have succeeded, and if there | ||
1198 | * was a timeout, we should unconditionally clear the semaphore | ||
1199 | * bits to free the driver to make progress | ||
1200 | */ | ||
1201 | ixgbe_release_eeprom_semaphore(hw); | ||
1202 | |||
1203 | udelay(50); | ||
1204 | /* | ||
1205 | * one last try | ||
1206 | * If the SMBI bit is 0 when we read it, then the bit will be | ||
1207 | * set and we have the semaphore | ||
1208 | */ | ||
1209 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); | ||
1210 | if (!(swsm & IXGBE_SWSM_SMBI)) | ||
1211 | status = 0; | ||
1212 | } | ||
1213 | |||
1192 | /* Now get the semaphore between SW/FW through the SWESMBI bit */ | 1214 | /* Now get the semaphore between SW/FW through the SWESMBI bit */ |
1193 | if (status == 0) { | 1215 | if (status == 0) { |
1194 | for (i = 0; i < timeout; i++) { | 1216 | for (i = 0; i < timeout; i++) { |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 1fdd075afe79..cb1555bc8548 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -84,6 +84,7 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = { | |||
84 | {"hw_rsc_flushed", IXGBE_STAT(rsc_total_flush)}, | 84 | {"hw_rsc_flushed", IXGBE_STAT(rsc_total_flush)}, |
85 | {"fdir_match", IXGBE_STAT(stats.fdirmatch)}, | 85 | {"fdir_match", IXGBE_STAT(stats.fdirmatch)}, |
86 | {"fdir_miss", IXGBE_STAT(stats.fdirmiss)}, | 86 | {"fdir_miss", IXGBE_STAT(stats.fdirmiss)}, |
87 | {"fdir_overflow", IXGBE_STAT(fdir_overflow)}, | ||
87 | {"rx_fifo_errors", IXGBE_NETDEV_STAT(rx_fifo_errors)}, | 88 | {"rx_fifo_errors", IXGBE_NETDEV_STAT(rx_fifo_errors)}, |
88 | {"rx_missed_errors", IXGBE_NETDEV_STAT(rx_missed_errors)}, | 89 | {"rx_missed_errors", IXGBE_NETDEV_STAT(rx_missed_errors)}, |
89 | {"tx_aborted_errors", IXGBE_NETDEV_STAT(tx_aborted_errors)}, | 90 | {"tx_aborted_errors", IXGBE_NETDEV_STAT(tx_aborted_errors)}, |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index a3e384bc50fe..2dce3d038188 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -126,6 +126,8 @@ static DEFINE_PCI_DEVICE_TABLE(ixgbe_pci_tbl) = { | |||
126 | board_X540 }, | 126 | board_X540 }, |
127 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_SFP_SF2), | 127 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_SFP_SF2), |
128 | board_82599 }, | 128 | board_82599 }, |
129 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_LS), | ||
130 | board_82599 }, | ||
129 | 131 | ||
130 | /* required last entry */ | 132 | /* required last entry */ |
131 | {0, } | 133 | {0, } |
@@ -191,6 +193,22 @@ static inline void ixgbe_disable_sriov(struct ixgbe_adapter *adapter) | |||
191 | adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED; | 193 | adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED; |
192 | } | 194 | } |
193 | 195 | ||
196 | static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) | ||
197 | { | ||
198 | if (!test_bit(__IXGBE_DOWN, &adapter->state) && | ||
199 | !test_and_set_bit(__IXGBE_SERVICE_SCHED, &adapter->state)) | ||
200 | schedule_work(&adapter->service_task); | ||
201 | } | ||
202 | |||
203 | static void ixgbe_service_event_complete(struct ixgbe_adapter *adapter) | ||
204 | { | ||
205 | BUG_ON(!test_bit(__IXGBE_SERVICE_SCHED, &adapter->state)); | ||
206 | |||
207 | /* flush memory to make sure state is correct before next watchog */ | ||
208 | smp_mb__before_clear_bit(); | ||
209 | clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); | ||
210 | } | ||
211 | |||
194 | struct ixgbe_reg_info { | 212 | struct ixgbe_reg_info { |
195 | u32 ofs; | 213 | u32 ofs; |
196 | char *name; | 214 | char *name; |
@@ -817,7 +835,19 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring) | |||
817 | #define DESC_NEEDED (TXD_USE_COUNT(IXGBE_MAX_DATA_PER_TXD) /* skb->data */ + \ | 835 | #define DESC_NEEDED (TXD_USE_COUNT(IXGBE_MAX_DATA_PER_TXD) /* skb->data */ + \ |
818 | MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1) /* for context */ | 836 | MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1) /* for context */ |
819 | 837 | ||
820 | static void ixgbe_tx_timeout(struct net_device *netdev); | 838 | /** |
839 | * ixgbe_tx_timeout_reset - initiate reset due to Tx timeout | ||
840 | * @adapter: driver private struct | ||
841 | **/ | ||
842 | static void ixgbe_tx_timeout_reset(struct ixgbe_adapter *adapter) | ||
843 | { | ||
844 | |||
845 | /* Do the reset outside of interrupt context */ | ||
846 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { | ||
847 | adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED; | ||
848 | ixgbe_service_event_schedule(adapter); | ||
849 | } | ||
850 | } | ||
821 | 851 | ||
822 | /** | 852 | /** |
823 | * ixgbe_clean_tx_irq - Reclaim resources after transmit completes | 853 | * ixgbe_clean_tx_irq - Reclaim resources after transmit completes |
@@ -899,7 +929,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, | |||
899 | adapter->tx_timeout_count + 1, tx_ring->queue_index); | 929 | adapter->tx_timeout_count + 1, tx_ring->queue_index); |
900 | 930 | ||
901 | /* schedule immediate reset if we believe we hung */ | 931 | /* schedule immediate reset if we believe we hung */ |
902 | ixgbe_tx_timeout(adapter->netdev); | 932 | ixgbe_tx_timeout_reset(adapter); |
903 | 933 | ||
904 | /* the adapter is about to reset, no point in enabling stuff */ | 934 | /* the adapter is about to reset, no point in enabling stuff */ |
905 | return true; | 935 | return true; |
@@ -1797,35 +1827,51 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) | |||
1797 | } | 1827 | } |
1798 | 1828 | ||
1799 | /** | 1829 | /** |
1800 | * ixgbe_check_overtemp_task - worker thread to check over tempurature | 1830 | * ixgbe_check_overtemp_subtask - check for over tempurature |
1801 | * @work: pointer to work_struct containing our data | 1831 | * @adapter: pointer to adapter |
1802 | **/ | 1832 | **/ |
1803 | static void ixgbe_check_overtemp_task(struct work_struct *work) | 1833 | static void ixgbe_check_overtemp_subtask(struct ixgbe_adapter *adapter) |
1804 | { | 1834 | { |
1805 | struct ixgbe_adapter *adapter = container_of(work, | ||
1806 | struct ixgbe_adapter, | ||
1807 | check_overtemp_task); | ||
1808 | struct ixgbe_hw *hw = &adapter->hw; | 1835 | struct ixgbe_hw *hw = &adapter->hw; |
1809 | u32 eicr = adapter->interrupt_event; | 1836 | u32 eicr = adapter->interrupt_event; |
1810 | 1837 | ||
1811 | if (!(adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE)) | 1838 | if (test_bit(__IXGBE_DOWN, &adapter->state)) |
1839 | return; | ||
1840 | |||
1841 | if (!(adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) && | ||
1842 | !(adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_EVENT)) | ||
1812 | return; | 1843 | return; |
1813 | 1844 | ||
1845 | adapter->flags2 &= ~IXGBE_FLAG2_TEMP_SENSOR_EVENT; | ||
1846 | |||
1814 | switch (hw->device_id) { | 1847 | switch (hw->device_id) { |
1815 | case IXGBE_DEV_ID_82599_T3_LOM: { | 1848 | case IXGBE_DEV_ID_82599_T3_LOM: |
1816 | u32 autoneg; | 1849 | /* |
1817 | bool link_up = false; | 1850 | * Since the warning interrupt is for both ports |
1851 | * we don't have to check if: | ||
1852 | * - This interrupt wasn't for our port. | ||
1853 | * - We may have missed the interrupt so always have to | ||
1854 | * check if we got a LSC | ||
1855 | */ | ||
1856 | if (!(eicr & IXGBE_EICR_GPI_SDP0) && | ||
1857 | !(eicr & IXGBE_EICR_LSC)) | ||
1858 | return; | ||
1859 | |||
1860 | if (!(eicr & IXGBE_EICR_LSC) && hw->mac.ops.check_link) { | ||
1861 | u32 autoneg; | ||
1862 | bool link_up = false; | ||
1818 | 1863 | ||
1819 | if (hw->mac.ops.check_link) | ||
1820 | hw->mac.ops.check_link(hw, &autoneg, &link_up, false); | 1864 | hw->mac.ops.check_link(hw, &autoneg, &link_up, false); |
1821 | 1865 | ||
1822 | if (((eicr & IXGBE_EICR_GPI_SDP0) && (!link_up)) || | 1866 | if (link_up) |
1823 | (eicr & IXGBE_EICR_LSC)) | 1867 | return; |
1824 | /* Check if this is due to overtemp */ | 1868 | } |
1825 | if (hw->phy.ops.check_overtemp(hw) == IXGBE_ERR_OVERTEMP) | 1869 | |
1826 | break; | 1870 | /* Check if this is not due to overtemp */ |
1827 | return; | 1871 | if (hw->phy.ops.check_overtemp(hw) != IXGBE_ERR_OVERTEMP) |
1828 | } | 1872 | return; |
1873 | |||
1874 | break; | ||
1829 | default: | 1875 | default: |
1830 | if (!(eicr & IXGBE_EICR_GPI_SDP0)) | 1876 | if (!(eicr & IXGBE_EICR_GPI_SDP0)) |
1831 | return; | 1877 | return; |
@@ -1835,8 +1881,8 @@ static void ixgbe_check_overtemp_task(struct work_struct *work) | |||
1835 | "Network adapter has been stopped because it has over heated. " | 1881 | "Network adapter has been stopped because it has over heated. " |
1836 | "Restart the computer. If the problem persists, " | 1882 | "Restart the computer. If the problem persists, " |
1837 | "power off the system and replace the adapter\n"); | 1883 | "power off the system and replace the adapter\n"); |
1838 | /* write to clear the interrupt */ | 1884 | |
1839 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0); | 1885 | adapter->interrupt_event = 0; |
1840 | } | 1886 | } |
1841 | 1887 | ||
1842 | static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr) | 1888 | static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr) |
@@ -1858,15 +1904,19 @@ static void ixgbe_check_sfp_event(struct ixgbe_adapter *adapter, u32 eicr) | |||
1858 | if (eicr & IXGBE_EICR_GPI_SDP2) { | 1904 | if (eicr & IXGBE_EICR_GPI_SDP2) { |
1859 | /* Clear the interrupt */ | 1905 | /* Clear the interrupt */ |
1860 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP2); | 1906 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP2); |
1861 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) | 1907 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { |
1862 | schedule_work(&adapter->sfp_config_module_task); | 1908 | adapter->flags2 |= IXGBE_FLAG2_SFP_NEEDS_RESET; |
1909 | ixgbe_service_event_schedule(adapter); | ||
1910 | } | ||
1863 | } | 1911 | } |
1864 | 1912 | ||
1865 | if (eicr & IXGBE_EICR_GPI_SDP1) { | 1913 | if (eicr & IXGBE_EICR_GPI_SDP1) { |
1866 | /* Clear the interrupt */ | 1914 | /* Clear the interrupt */ |
1867 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1); | 1915 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1); |
1868 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) | 1916 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { |
1869 | schedule_work(&adapter->multispeed_fiber_task); | 1917 | adapter->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; |
1918 | ixgbe_service_event_schedule(adapter); | ||
1919 | } | ||
1870 | } | 1920 | } |
1871 | } | 1921 | } |
1872 | 1922 | ||
@@ -1880,7 +1930,7 @@ static void ixgbe_check_lsc(struct ixgbe_adapter *adapter) | |||
1880 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { | 1930 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { |
1881 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_LSC); | 1931 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_LSC); |
1882 | IXGBE_WRITE_FLUSH(hw); | 1932 | IXGBE_WRITE_FLUSH(hw); |
1883 | schedule_work(&adapter->watchdog_task); | 1933 | ixgbe_service_event_schedule(adapter); |
1884 | } | 1934 | } |
1885 | } | 1935 | } |
1886 | 1936 | ||
@@ -1908,26 +1958,32 @@ static irqreturn_t ixgbe_msix_lsc(int irq, void *data) | |||
1908 | 1958 | ||
1909 | switch (hw->mac.type) { | 1959 | switch (hw->mac.type) { |
1910 | case ixgbe_mac_82599EB: | 1960 | case ixgbe_mac_82599EB: |
1911 | ixgbe_check_sfp_event(adapter, eicr); | ||
1912 | if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) && | ||
1913 | ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC))) { | ||
1914 | adapter->interrupt_event = eicr; | ||
1915 | schedule_work(&adapter->check_overtemp_task); | ||
1916 | } | ||
1917 | /* now fallthrough to handle Flow Director */ | ||
1918 | case ixgbe_mac_X540: | 1961 | case ixgbe_mac_X540: |
1919 | /* Handle Flow Director Full threshold interrupt */ | 1962 | /* Handle Flow Director Full threshold interrupt */ |
1920 | if (eicr & IXGBE_EICR_FLOW_DIR) { | 1963 | if (eicr & IXGBE_EICR_FLOW_DIR) { |
1964 | int reinit_count = 0; | ||
1921 | int i; | 1965 | int i; |
1922 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_FLOW_DIR); | ||
1923 | /* Disable transmits before FDIR Re-initialization */ | ||
1924 | netif_tx_stop_all_queues(netdev); | ||
1925 | for (i = 0; i < adapter->num_tx_queues; i++) { | 1966 | for (i = 0; i < adapter->num_tx_queues; i++) { |
1926 | struct ixgbe_ring *tx_ring = | 1967 | struct ixgbe_ring *ring = adapter->tx_ring[i]; |
1927 | adapter->tx_ring[i]; | ||
1928 | if (test_and_clear_bit(__IXGBE_TX_FDIR_INIT_DONE, | 1968 | if (test_and_clear_bit(__IXGBE_TX_FDIR_INIT_DONE, |
1929 | &tx_ring->state)) | 1969 | &ring->state)) |
1930 | schedule_work(&adapter->fdir_reinit_task); | 1970 | reinit_count++; |
1971 | } | ||
1972 | if (reinit_count) { | ||
1973 | /* no more flow director interrupts until after init */ | ||
1974 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_FLOW_DIR); | ||
1975 | eicr &= ~IXGBE_EICR_FLOW_DIR; | ||
1976 | adapter->flags2 |= IXGBE_FLAG2_FDIR_REQUIRES_REINIT; | ||
1977 | ixgbe_service_event_schedule(adapter); | ||
1978 | } | ||
1979 | } | ||
1980 | ixgbe_check_sfp_event(adapter, eicr); | ||
1981 | if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) && | ||
1982 | ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC))) { | ||
1983 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { | ||
1984 | adapter->interrupt_event = eicr; | ||
1985 | adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_EVENT; | ||
1986 | ixgbe_service_event_schedule(adapter); | ||
1931 | } | 1987 | } |
1932 | } | 1988 | } |
1933 | break; | 1989 | break; |
@@ -1937,8 +1993,10 @@ static irqreturn_t ixgbe_msix_lsc(int irq, void *data) | |||
1937 | 1993 | ||
1938 | ixgbe_check_fan_failure(adapter, eicr); | 1994 | ixgbe_check_fan_failure(adapter, eicr); |
1939 | 1995 | ||
1996 | /* re-enable the original interrupt state, no lsc, no queues */ | ||
1940 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) | 1997 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) |
1941 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); | 1998 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, eicr & |
1999 | ~(IXGBE_EIMS_LSC | IXGBE_EIMS_RTX_QUEUE)); | ||
1942 | 2000 | ||
1943 | return IRQ_HANDLED; | 2001 | return IRQ_HANDLED; |
1944 | } | 2002 | } |
@@ -2523,8 +2581,11 @@ static irqreturn_t ixgbe_intr(int irq, void *data) | |||
2523 | ixgbe_check_sfp_event(adapter, eicr); | 2581 | ixgbe_check_sfp_event(adapter, eicr); |
2524 | if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) && | 2582 | if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) && |
2525 | ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC))) { | 2583 | ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC))) { |
2526 | adapter->interrupt_event = eicr; | 2584 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { |
2527 | schedule_work(&adapter->check_overtemp_task); | 2585 | adapter->interrupt_event = eicr; |
2586 | adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_EVENT; | ||
2587 | ixgbe_service_event_schedule(adapter); | ||
2588 | } | ||
2528 | } | 2589 | } |
2529 | break; | 2590 | break; |
2530 | default: | 2591 | default: |
@@ -3188,7 +3249,9 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter) | |||
3188 | /* enable Tx loopback for VF/PF communication */ | 3249 | /* enable Tx loopback for VF/PF communication */ |
3189 | IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); | 3250 | IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); |
3190 | /* Enable MAC Anti-Spoofing */ | 3251 | /* Enable MAC Anti-Spoofing */ |
3191 | hw->mac.ops.set_mac_anti_spoofing(hw, (adapter->num_vfs != 0), | 3252 | hw->mac.ops.set_mac_anti_spoofing(hw, |
3253 | (adapter->antispoofing_enabled = | ||
3254 | (adapter->num_vfs != 0)), | ||
3192 | adapter->num_vfs); | 3255 | adapter->num_vfs); |
3193 | } | 3256 | } |
3194 | 3257 | ||
@@ -3497,7 +3560,7 @@ static int ixgbe_write_uc_addr_list(struct net_device *netdev) | |||
3497 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 3560 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
3498 | struct ixgbe_hw *hw = &adapter->hw; | 3561 | struct ixgbe_hw *hw = &adapter->hw; |
3499 | unsigned int vfn = adapter->num_vfs; | 3562 | unsigned int vfn = adapter->num_vfs; |
3500 | unsigned int rar_entries = hw->mac.num_rar_entries - (vfn + 1); | 3563 | unsigned int rar_entries = IXGBE_MAX_PF_MACVLANS; |
3501 | int count = 0; | 3564 | int count = 0; |
3502 | 3565 | ||
3503 | /* return ENOMEM indicating insufficient memory for addresses */ | 3566 | /* return ENOMEM indicating insufficient memory for addresses */ |
@@ -3770,31 +3833,16 @@ static inline bool ixgbe_is_sfp(struct ixgbe_hw *hw) | |||
3770 | **/ | 3833 | **/ |
3771 | static void ixgbe_sfp_link_config(struct ixgbe_adapter *adapter) | 3834 | static void ixgbe_sfp_link_config(struct ixgbe_adapter *adapter) |
3772 | { | 3835 | { |
3773 | struct ixgbe_hw *hw = &adapter->hw; | 3836 | /* |
3837 | * We are assuming the worst case scenerio here, and that | ||
3838 | * is that an SFP was inserted/removed after the reset | ||
3839 | * but before SFP detection was enabled. As such the best | ||
3840 | * solution is to just start searching as soon as we start | ||
3841 | */ | ||
3842 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) | ||
3843 | adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP; | ||
3774 | 3844 | ||
3775 | if (hw->phy.multispeed_fiber) { | 3845 | adapter->flags2 |= IXGBE_FLAG2_SFP_NEEDS_RESET; |
3776 | /* | ||
3777 | * In multispeed fiber setups, the device may not have | ||
3778 | * had a physical connection when the driver loaded. | ||
3779 | * If that's the case, the initial link configuration | ||
3780 | * couldn't get the MAC into 10G or 1G mode, so we'll | ||
3781 | * never have a link status change interrupt fire. | ||
3782 | * We need to try and force an autonegotiation | ||
3783 | * session, then bring up link. | ||
3784 | */ | ||
3785 | if (hw->mac.ops.setup_sfp) | ||
3786 | hw->mac.ops.setup_sfp(hw); | ||
3787 | if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK)) | ||
3788 | schedule_work(&adapter->multispeed_fiber_task); | ||
3789 | } else { | ||
3790 | /* | ||
3791 | * Direct Attach Cu and non-multispeed fiber modules | ||
3792 | * still need to be configured properly prior to | ||
3793 | * attempting link. | ||
3794 | */ | ||
3795 | if (!(adapter->flags & IXGBE_FLAG_IN_SFP_MOD_TASK)) | ||
3796 | schedule_work(&adapter->sfp_config_module_task); | ||
3797 | } | ||
3798 | } | 3846 | } |
3799 | 3847 | ||
3800 | /** | 3848 | /** |
@@ -3924,17 +3972,6 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
3924 | e_crit(drv, "Fan has stopped, replace the adapter\n"); | 3972 | e_crit(drv, "Fan has stopped, replace the adapter\n"); |
3925 | } | 3973 | } |
3926 | 3974 | ||
3927 | /* | ||
3928 | * For hot-pluggable SFP+ devices, a new SFP+ module may have | ||
3929 | * arrived before interrupts were enabled but after probe. Such | ||
3930 | * devices wouldn't have their type identified yet. We need to | ||
3931 | * kick off the SFP+ module setup first, then try to bring up link. | ||
3932 | * If we're not hot-pluggable SFP+, we just need to configure link | ||
3933 | * and bring it up. | ||
3934 | */ | ||
3935 | if (hw->phy.type == ixgbe_phy_none) | ||
3936 | schedule_work(&adapter->sfp_config_module_task); | ||
3937 | |||
3938 | /* enable transmits */ | 3975 | /* enable transmits */ |
3939 | netif_tx_start_all_queues(adapter->netdev); | 3976 | netif_tx_start_all_queues(adapter->netdev); |
3940 | 3977 | ||
@@ -3942,7 +3979,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
3942 | * link up interrupt but shouldn't be a problem */ | 3979 | * link up interrupt but shouldn't be a problem */ |
3943 | adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; | 3980 | adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; |
3944 | adapter->link_check_timeout = jiffies; | 3981 | adapter->link_check_timeout = jiffies; |
3945 | mod_timer(&adapter->watchdog_timer, jiffies); | 3982 | mod_timer(&adapter->service_timer, jiffies); |
3946 | 3983 | ||
3947 | /* Set PF Reset Done bit so PF/VF Mail Ops can work */ | 3984 | /* Set PF Reset Done bit so PF/VF Mail Ops can work */ |
3948 | ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); | 3985 | ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); |
@@ -3955,6 +3992,9 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
3955 | void ixgbe_reinit_locked(struct ixgbe_adapter *adapter) | 3992 | void ixgbe_reinit_locked(struct ixgbe_adapter *adapter) |
3956 | { | 3993 | { |
3957 | WARN_ON(in_interrupt()); | 3994 | WARN_ON(in_interrupt()); |
3995 | /* put off any impending NetWatchDogTimeout */ | ||
3996 | adapter->netdev->trans_start = jiffies; | ||
3997 | |||
3958 | while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) | 3998 | while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) |
3959 | usleep_range(1000, 2000); | 3999 | usleep_range(1000, 2000); |
3960 | ixgbe_down(adapter); | 4000 | ixgbe_down(adapter); |
@@ -3983,10 +4023,20 @@ void ixgbe_reset(struct ixgbe_adapter *adapter) | |||
3983 | struct ixgbe_hw *hw = &adapter->hw; | 4023 | struct ixgbe_hw *hw = &adapter->hw; |
3984 | int err; | 4024 | int err; |
3985 | 4025 | ||
4026 | /* lock SFP init bit to prevent race conditions with the watchdog */ | ||
4027 | while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) | ||
4028 | usleep_range(1000, 2000); | ||
4029 | |||
4030 | /* clear all SFP and link config related flags while holding SFP_INIT */ | ||
4031 | adapter->flags2 &= ~(IXGBE_FLAG2_SEARCH_FOR_SFP | | ||
4032 | IXGBE_FLAG2_SFP_NEEDS_RESET); | ||
4033 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; | ||
4034 | |||
3986 | err = hw->mac.ops.init_hw(hw); | 4035 | err = hw->mac.ops.init_hw(hw); |
3987 | switch (err) { | 4036 | switch (err) { |
3988 | case 0: | 4037 | case 0: |
3989 | case IXGBE_ERR_SFP_NOT_PRESENT: | 4038 | case IXGBE_ERR_SFP_NOT_PRESENT: |
4039 | case IXGBE_ERR_SFP_NOT_SUPPORTED: | ||
3990 | break; | 4040 | break; |
3991 | case IXGBE_ERR_MASTER_REQUESTS_PENDING: | 4041 | case IXGBE_ERR_MASTER_REQUESTS_PENDING: |
3992 | e_dev_err("master disable timed out\n"); | 4042 | e_dev_err("master disable timed out\n"); |
@@ -4004,6 +4054,8 @@ void ixgbe_reset(struct ixgbe_adapter *adapter) | |||
4004 | e_dev_err("Hardware Error: %d\n", err); | 4054 | e_dev_err("Hardware Error: %d\n", err); |
4005 | } | 4055 | } |
4006 | 4056 | ||
4057 | clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); | ||
4058 | |||
4007 | /* reprogram the RAR[0] in case user changed it. */ | 4059 | /* reprogram the RAR[0] in case user changed it. */ |
4008 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, adapter->num_vfs, | 4060 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, adapter->num_vfs, |
4009 | IXGBE_RAH_AV); | 4061 | IXGBE_RAH_AV); |
@@ -4132,26 +4184,12 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
4132 | struct net_device *netdev = adapter->netdev; | 4184 | struct net_device *netdev = adapter->netdev; |
4133 | struct ixgbe_hw *hw = &adapter->hw; | 4185 | struct ixgbe_hw *hw = &adapter->hw; |
4134 | u32 rxctrl; | 4186 | u32 rxctrl; |
4135 | u32 txdctl; | ||
4136 | int i; | 4187 | int i; |
4137 | int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; | 4188 | int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; |
4138 | 4189 | ||
4139 | /* signal that we are down to the interrupt handler */ | 4190 | /* signal that we are down to the interrupt handler */ |
4140 | set_bit(__IXGBE_DOWN, &adapter->state); | 4191 | set_bit(__IXGBE_DOWN, &adapter->state); |
4141 | 4192 | ||
4142 | /* disable receive for all VFs and wait one second */ | ||
4143 | if (adapter->num_vfs) { | ||
4144 | /* ping all the active vfs to let them know we are going down */ | ||
4145 | ixgbe_ping_all_vfs(adapter); | ||
4146 | |||
4147 | /* Disable all VFTE/VFRE TX/RX */ | ||
4148 | ixgbe_disable_tx_rx(adapter); | ||
4149 | |||
4150 | /* Mark all the VFs as inactive */ | ||
4151 | for (i = 0 ; i < adapter->num_vfs; i++) | ||
4152 | adapter->vfinfo[i].clear_to_send = 0; | ||
4153 | } | ||
4154 | |||
4155 | /* disable receives */ | 4193 | /* disable receives */ |
4156 | rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); | 4194 | rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); |
4157 | IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl & ~IXGBE_RXCTRL_RXEN); | 4195 | IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl & ~IXGBE_RXCTRL_RXEN); |
@@ -4165,11 +4203,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
4165 | 4203 | ||
4166 | netif_tx_stop_all_queues(netdev); | 4204 | netif_tx_stop_all_queues(netdev); |
4167 | 4205 | ||
4168 | clear_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state); | 4206 | /* call carrier off first to avoid false dev_watchdog timeouts */ |
4169 | del_timer_sync(&adapter->sfp_timer); | ||
4170 | del_timer_sync(&adapter->watchdog_timer); | ||
4171 | cancel_work_sync(&adapter->watchdog_task); | ||
4172 | |||
4173 | netif_carrier_off(netdev); | 4207 | netif_carrier_off(netdev); |
4174 | netif_tx_disable(netdev); | 4208 | netif_tx_disable(netdev); |
4175 | 4209 | ||
@@ -4177,6 +4211,25 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
4177 | 4211 | ||
4178 | ixgbe_napi_disable_all(adapter); | 4212 | ixgbe_napi_disable_all(adapter); |
4179 | 4213 | ||
4214 | adapter->flags2 &= ~(IXGBE_FLAG2_FDIR_REQUIRES_REINIT | | ||
4215 | IXGBE_FLAG2_RESET_REQUESTED); | ||
4216 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE; | ||
4217 | |||
4218 | del_timer_sync(&adapter->service_timer); | ||
4219 | |||
4220 | /* disable receive for all VFs and wait one second */ | ||
4221 | if (adapter->num_vfs) { | ||
4222 | /* ping all the active vfs to let them know we are going down */ | ||
4223 | ixgbe_ping_all_vfs(adapter); | ||
4224 | |||
4225 | /* Disable all VFTE/VFRE TX/RX */ | ||
4226 | ixgbe_disable_tx_rx(adapter); | ||
4227 | |||
4228 | /* Mark all the VFs as inactive */ | ||
4229 | for (i = 0 ; i < adapter->num_vfs; i++) | ||
4230 | adapter->vfinfo[i].clear_to_send = 0; | ||
4231 | } | ||
4232 | |||
4180 | /* Cleanup the affinity_hint CPU mask memory and callback */ | 4233 | /* Cleanup the affinity_hint CPU mask memory and callback */ |
4181 | for (i = 0; i < num_q_vectors; i++) { | 4234 | for (i = 0; i < num_q_vectors; i++) { |
4182 | struct ixgbe_q_vector *q_vector = adapter->q_vector[i]; | 4235 | struct ixgbe_q_vector *q_vector = adapter->q_vector[i]; |
@@ -4186,21 +4239,13 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
4186 | free_cpumask_var(q_vector->affinity_mask); | 4239 | free_cpumask_var(q_vector->affinity_mask); |
4187 | } | 4240 | } |
4188 | 4241 | ||
4189 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || | ||
4190 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) | ||
4191 | cancel_work_sync(&adapter->fdir_reinit_task); | ||
4192 | |||
4193 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) | ||
4194 | cancel_work_sync(&adapter->check_overtemp_task); | ||
4195 | |||
4196 | /* disable transmits in the hardware now that interrupts are off */ | 4242 | /* disable transmits in the hardware now that interrupts are off */ |
4197 | for (i = 0; i < adapter->num_tx_queues; i++) { | 4243 | for (i = 0; i < adapter->num_tx_queues; i++) { |
4198 | u8 reg_idx = adapter->tx_ring[i]->reg_idx; | 4244 | u8 reg_idx = adapter->tx_ring[i]->reg_idx; |
4199 | txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(reg_idx)); | 4245 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), IXGBE_TXDCTL_SWFLSH); |
4200 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), | ||
4201 | (txdctl & ~IXGBE_TXDCTL_ENABLE)); | ||
4202 | } | 4246 | } |
4203 | /* Disable the Tx DMA engine on 82599 */ | 4247 | |
4248 | /* Disable the Tx DMA engine on 82599 and X540 */ | ||
4204 | switch (hw->mac.type) { | 4249 | switch (hw->mac.type) { |
4205 | case ixgbe_mac_82599EB: | 4250 | case ixgbe_mac_82599EB: |
4206 | case ixgbe_mac_X540: | 4251 | case ixgbe_mac_X540: |
@@ -4275,25 +4320,8 @@ static void ixgbe_tx_timeout(struct net_device *netdev) | |||
4275 | { | 4320 | { |
4276 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 4321 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
4277 | 4322 | ||
4278 | adapter->tx_timeout_count++; | ||
4279 | |||
4280 | /* Do the reset outside of interrupt context */ | 4323 | /* Do the reset outside of interrupt context */ |
4281 | schedule_work(&adapter->reset_task); | 4324 | ixgbe_tx_timeout_reset(adapter); |
4282 | } | ||
4283 | |||
4284 | static void ixgbe_reset_task(struct work_struct *work) | ||
4285 | { | ||
4286 | struct ixgbe_adapter *adapter; | ||
4287 | adapter = container_of(work, struct ixgbe_adapter, reset_task); | ||
4288 | |||
4289 | /* If we're already down or resetting, just bail */ | ||
4290 | if (test_bit(__IXGBE_DOWN, &adapter->state) || | ||
4291 | test_bit(__IXGBE_RESETTING, &adapter->state)) | ||
4292 | return; | ||
4293 | |||
4294 | ixgbe_dump(adapter); | ||
4295 | netdev_err(adapter->netdev, "Reset adapter\n"); | ||
4296 | ixgbe_reinit_locked(adapter); | ||
4297 | } | 4325 | } |
4298 | 4326 | ||
4299 | /** | 4327 | /** |
@@ -5146,57 +5174,6 @@ void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter) | |||
5146 | } | 5174 | } |
5147 | 5175 | ||
5148 | /** | 5176 | /** |
5149 | * ixgbe_sfp_timer - worker thread to find a missing module | ||
5150 | * @data: pointer to our adapter struct | ||
5151 | **/ | ||
5152 | static void ixgbe_sfp_timer(unsigned long data) | ||
5153 | { | ||
5154 | struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)data; | ||
5155 | |||
5156 | /* | ||
5157 | * Do the sfp_timer outside of interrupt context due to the | ||
5158 | * delays that sfp+ detection requires | ||
5159 | */ | ||
5160 | schedule_work(&adapter->sfp_task); | ||
5161 | } | ||
5162 | |||
5163 | /** | ||
5164 | * ixgbe_sfp_task - worker thread to find a missing module | ||
5165 | * @work: pointer to work_struct containing our data | ||
5166 | **/ | ||
5167 | static void ixgbe_sfp_task(struct work_struct *work) | ||
5168 | { | ||
5169 | struct ixgbe_adapter *adapter = container_of(work, | ||
5170 | struct ixgbe_adapter, | ||
5171 | sfp_task); | ||
5172 | struct ixgbe_hw *hw = &adapter->hw; | ||
5173 | |||
5174 | if ((hw->phy.type == ixgbe_phy_nl) && | ||
5175 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { | ||
5176 | s32 ret = hw->phy.ops.identify_sfp(hw); | ||
5177 | if (ret == IXGBE_ERR_SFP_NOT_PRESENT) | ||
5178 | goto reschedule; | ||
5179 | ret = hw->phy.ops.reset(hw); | ||
5180 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { | ||
5181 | e_dev_err("failed to initialize because an unsupported " | ||
5182 | "SFP+ module type was detected.\n"); | ||
5183 | e_dev_err("Reload the driver after installing a " | ||
5184 | "supported module.\n"); | ||
5185 | unregister_netdev(adapter->netdev); | ||
5186 | } else { | ||
5187 | e_info(probe, "detected SFP+: %d\n", hw->phy.sfp_type); | ||
5188 | } | ||
5189 | /* don't need this routine any more */ | ||
5190 | clear_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state); | ||
5191 | } | ||
5192 | return; | ||
5193 | reschedule: | ||
5194 | if (test_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state)) | ||
5195 | mod_timer(&adapter->sfp_timer, | ||
5196 | round_jiffies(jiffies + (2 * HZ))); | ||
5197 | } | ||
5198 | |||
5199 | /** | ||
5200 | * ixgbe_sw_init - Initialize general software structures (struct ixgbe_adapter) | 5177 | * ixgbe_sw_init - Initialize general software structures (struct ixgbe_adapter) |
5201 | * @adapter: board private structure to initialize | 5178 | * @adapter: board private structure to initialize |
5202 | * | 5179 | * |
@@ -5992,23 +5969,66 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
5992 | } | 5969 | } |
5993 | 5970 | ||
5994 | /** | 5971 | /** |
5995 | * ixgbe_watchdog - Timer Call-back | 5972 | * ixgbe_fdir_reinit_subtask - worker thread to reinit FDIR filter table |
5996 | * @data: pointer to adapter cast into an unsigned long | 5973 | * @adapter - pointer to the device adapter structure |
5997 | **/ | 5974 | **/ |
5998 | static void ixgbe_watchdog(unsigned long data) | 5975 | static void ixgbe_fdir_reinit_subtask(struct ixgbe_adapter *adapter) |
5999 | { | 5976 | { |
6000 | struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)data; | ||
6001 | struct ixgbe_hw *hw = &adapter->hw; | 5977 | struct ixgbe_hw *hw = &adapter->hw; |
6002 | u64 eics = 0; | ||
6003 | int i; | 5978 | int i; |
6004 | 5979 | ||
6005 | /* | 5980 | if (!(adapter->flags2 & IXGBE_FLAG2_FDIR_REQUIRES_REINIT)) |
6006 | * Do the watchdog outside of interrupt context due to the lovely | 5981 | return; |
6007 | * delays that some of the newer hardware requires | 5982 | |
6008 | */ | 5983 | adapter->flags2 &= ~IXGBE_FLAG2_FDIR_REQUIRES_REINIT; |
6009 | 5984 | ||
5985 | /* if interface is down do nothing */ | ||
6010 | if (test_bit(__IXGBE_DOWN, &adapter->state)) | 5986 | if (test_bit(__IXGBE_DOWN, &adapter->state)) |
6011 | goto watchdog_short_circuit; | 5987 | return; |
5988 | |||
5989 | /* do nothing if we are not using signature filters */ | ||
5990 | if (!(adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)) | ||
5991 | return; | ||
5992 | |||
5993 | adapter->fdir_overflow++; | ||
5994 | |||
5995 | if (ixgbe_reinit_fdir_tables_82599(hw) == 0) { | ||
5996 | for (i = 0; i < adapter->num_tx_queues; i++) | ||
5997 | set_bit(__IXGBE_TX_FDIR_INIT_DONE, | ||
5998 | &(adapter->tx_ring[i]->state)); | ||
5999 | /* re-enable flow director interrupts */ | ||
6000 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); | ||
6001 | } else { | ||
6002 | e_err(probe, "failed to finish FDIR re-initialization, " | ||
6003 | "ignored adding FDIR ATR filters\n"); | ||
6004 | } | ||
6005 | } | ||
6006 | |||
6007 | /** | ||
6008 | * ixgbe_check_hang_subtask - check for hung queues and dropped interrupts | ||
6009 | * @adapter - pointer to the device adapter structure | ||
6010 | * | ||
6011 | * This function serves two purposes. First it strobes the interrupt lines | ||
6012 | * in order to make certain interrupts are occuring. Secondly it sets the | ||
6013 | * bits needed to check for TX hangs. As a result we should immediately | ||
6014 | * determine if a hang has occured. | ||
6015 | */ | ||
6016 | static void ixgbe_check_hang_subtask(struct ixgbe_adapter *adapter) | ||
6017 | { | ||
6018 | struct ixgbe_hw *hw = &adapter->hw; | ||
6019 | u64 eics = 0; | ||
6020 | int i; | ||
6021 | |||
6022 | /* If we're down or resetting, just bail */ | ||
6023 | if (test_bit(__IXGBE_DOWN, &adapter->state) || | ||
6024 | test_bit(__IXGBE_RESETTING, &adapter->state)) | ||
6025 | return; | ||
6026 | |||
6027 | /* Force detection of hung controller */ | ||
6028 | if (netif_carrier_ok(adapter->netdev)) { | ||
6029 | for (i = 0; i < adapter->num_tx_queues; i++) | ||
6030 | set_check_for_tx_hang(adapter->tx_ring[i]); | ||
6031 | } | ||
6012 | 6032 | ||
6013 | if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { | 6033 | if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { |
6014 | /* | 6034 | /* |
@@ -6018,108 +6038,172 @@ static void ixgbe_watchdog(unsigned long data) | |||
6018 | */ | 6038 | */ |
6019 | IXGBE_WRITE_REG(hw, IXGBE_EICS, | 6039 | IXGBE_WRITE_REG(hw, IXGBE_EICS, |
6020 | (IXGBE_EICS_TCP_TIMER | IXGBE_EICS_OTHER)); | 6040 | (IXGBE_EICS_TCP_TIMER | IXGBE_EICS_OTHER)); |
6021 | goto watchdog_reschedule; | 6041 | } else { |
6022 | } | 6042 | /* get one bit for every active tx/rx interrupt vector */ |
6023 | 6043 | for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { | |
6024 | /* get one bit for every active tx/rx interrupt vector */ | 6044 | struct ixgbe_q_vector *qv = adapter->q_vector[i]; |
6025 | for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { | 6045 | if (qv->rxr_count || qv->txr_count) |
6026 | struct ixgbe_q_vector *qv = adapter->q_vector[i]; | 6046 | eics |= ((u64)1 << i); |
6027 | if (qv->rxr_count || qv->txr_count) | 6047 | } |
6028 | eics |= ((u64)1 << i); | ||
6029 | } | 6048 | } |
6030 | 6049 | ||
6031 | /* Cause software interrupt to ensure rx rings are cleaned */ | 6050 | /* Cause software interrupt to ensure rings are cleaned */ |
6032 | ixgbe_irq_rearm_queues(adapter, eics); | 6051 | ixgbe_irq_rearm_queues(adapter, eics); |
6033 | 6052 | ||
6034 | watchdog_reschedule: | ||
6035 | /* Reset the timer */ | ||
6036 | mod_timer(&adapter->watchdog_timer, round_jiffies(jiffies + 2 * HZ)); | ||
6037 | |||
6038 | watchdog_short_circuit: | ||
6039 | schedule_work(&adapter->watchdog_task); | ||
6040 | } | 6053 | } |
6041 | 6054 | ||
6042 | /** | 6055 | /** |
6043 | * ixgbe_multispeed_fiber_task - worker thread to configure multispeed fiber | 6056 | * ixgbe_watchdog_update_link - update the link status |
6044 | * @work: pointer to work_struct containing our data | 6057 | * @adapter - pointer to the device adapter structure |
6058 | * @link_speed - pointer to a u32 to store the link_speed | ||
6045 | **/ | 6059 | **/ |
6046 | static void ixgbe_multispeed_fiber_task(struct work_struct *work) | 6060 | static void ixgbe_watchdog_update_link(struct ixgbe_adapter *adapter) |
6047 | { | 6061 | { |
6048 | struct ixgbe_adapter *adapter = container_of(work, | ||
6049 | struct ixgbe_adapter, | ||
6050 | multispeed_fiber_task); | ||
6051 | struct ixgbe_hw *hw = &adapter->hw; | 6062 | struct ixgbe_hw *hw = &adapter->hw; |
6052 | u32 autoneg; | 6063 | u32 link_speed = adapter->link_speed; |
6053 | bool negotiation; | 6064 | bool link_up = adapter->link_up; |
6065 | int i; | ||
6054 | 6066 | ||
6055 | adapter->flags |= IXGBE_FLAG_IN_SFP_LINK_TASK; | 6067 | if (!(adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE)) |
6056 | autoneg = hw->phy.autoneg_advertised; | 6068 | return; |
6057 | if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) | 6069 | |
6058 | hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation); | 6070 | if (hw->mac.ops.check_link) { |
6059 | hw->mac.autotry_restart = false; | 6071 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); |
6060 | if (hw->mac.ops.setup_link) | 6072 | } else { |
6061 | hw->mac.ops.setup_link(hw, autoneg, negotiation, true); | 6073 | /* always assume link is up, if no check link function */ |
6062 | adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; | 6074 | link_speed = IXGBE_LINK_SPEED_10GB_FULL; |
6063 | adapter->flags &= ~IXGBE_FLAG_IN_SFP_LINK_TASK; | 6075 | link_up = true; |
6076 | } | ||
6077 | if (link_up) { | ||
6078 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | ||
6079 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) | ||
6080 | hw->mac.ops.fc_enable(hw, i); | ||
6081 | } else { | ||
6082 | hw->mac.ops.fc_enable(hw, 0); | ||
6083 | } | ||
6084 | } | ||
6085 | |||
6086 | if (link_up || | ||
6087 | time_after(jiffies, (adapter->link_check_timeout + | ||
6088 | IXGBE_TRY_LINK_TIMEOUT))) { | ||
6089 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE; | ||
6090 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMC_LSC); | ||
6091 | IXGBE_WRITE_FLUSH(hw); | ||
6092 | } | ||
6093 | |||
6094 | adapter->link_up = link_up; | ||
6095 | adapter->link_speed = link_speed; | ||
6064 | } | 6096 | } |
6065 | 6097 | ||
6066 | /** | 6098 | /** |
6067 | * ixgbe_sfp_config_module_task - worker thread to configure a new SFP+ module | 6099 | * ixgbe_watchdog_link_is_up - update netif_carrier status and |
6068 | * @work: pointer to work_struct containing our data | 6100 | * print link up message |
6101 | * @adapter - pointer to the device adapter structure | ||
6069 | **/ | 6102 | **/ |
6070 | static void ixgbe_sfp_config_module_task(struct work_struct *work) | 6103 | static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter) |
6071 | { | 6104 | { |
6072 | struct ixgbe_adapter *adapter = container_of(work, | 6105 | struct net_device *netdev = adapter->netdev; |
6073 | struct ixgbe_adapter, | ||
6074 | sfp_config_module_task); | ||
6075 | struct ixgbe_hw *hw = &adapter->hw; | 6106 | struct ixgbe_hw *hw = &adapter->hw; |
6076 | u32 err; | 6107 | u32 link_speed = adapter->link_speed; |
6108 | bool flow_rx, flow_tx; | ||
6077 | 6109 | ||
6078 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; | 6110 | /* only continue if link was previously down */ |
6111 | if (netif_carrier_ok(netdev)) | ||
6112 | return; | ||
6079 | 6113 | ||
6080 | /* Time for electrical oscillations to settle down */ | 6114 | adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP; |
6081 | msleep(100); | ||
6082 | err = hw->phy.ops.identify_sfp(hw); | ||
6083 | 6115 | ||
6084 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 6116 | switch (hw->mac.type) { |
6085 | e_dev_err("failed to initialize because an unsupported SFP+ " | 6117 | case ixgbe_mac_82598EB: { |
6086 | "module type was detected.\n"); | 6118 | u32 frctl = IXGBE_READ_REG(hw, IXGBE_FCTRL); |
6087 | e_dev_err("Reload the driver after installing a supported " | 6119 | u32 rmcs = IXGBE_READ_REG(hw, IXGBE_RMCS); |
6088 | "module.\n"); | 6120 | flow_rx = !!(frctl & IXGBE_FCTRL_RFCE); |
6089 | unregister_netdev(adapter->netdev); | 6121 | flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X); |
6090 | return; | ||
6091 | } | 6122 | } |
6092 | if (hw->mac.ops.setup_sfp) | 6123 | break; |
6093 | hw->mac.ops.setup_sfp(hw); | 6124 | case ixgbe_mac_X540: |
6125 | case ixgbe_mac_82599EB: { | ||
6126 | u32 mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN); | ||
6127 | u32 fccfg = IXGBE_READ_REG(hw, IXGBE_FCCFG); | ||
6128 | flow_rx = !!(mflcn & IXGBE_MFLCN_RFCE); | ||
6129 | flow_tx = !!(fccfg & IXGBE_FCCFG_TFCE_802_3X); | ||
6130 | } | ||
6131 | break; | ||
6132 | default: | ||
6133 | flow_tx = false; | ||
6134 | flow_rx = false; | ||
6135 | break; | ||
6136 | } | ||
6137 | e_info(drv, "NIC Link is Up %s, Flow Control: %s\n", | ||
6138 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? | ||
6139 | "10 Gbps" : | ||
6140 | (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? | ||
6141 | "1 Gbps" : | ||
6142 | (link_speed == IXGBE_LINK_SPEED_100_FULL ? | ||
6143 | "100 Mbps" : | ||
6144 | "unknown speed"))), | ||
6145 | ((flow_rx && flow_tx) ? "RX/TX" : | ||
6146 | (flow_rx ? "RX" : | ||
6147 | (flow_tx ? "TX" : "None")))); | ||
6094 | 6148 | ||
6095 | if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK)) | 6149 | netif_carrier_on(netdev); |
6096 | /* This will also work for DA Twinax connections */ | 6150 | #ifdef HAVE_IPLINK_VF_CONFIG |
6097 | schedule_work(&adapter->multispeed_fiber_task); | 6151 | ixgbe_check_vf_rate_limit(adapter); |
6098 | adapter->flags &= ~IXGBE_FLAG_IN_SFP_MOD_TASK; | 6152 | #endif /* HAVE_IPLINK_VF_CONFIG */ |
6099 | } | 6153 | } |
6100 | 6154 | ||
6101 | /** | 6155 | /** |
6102 | * ixgbe_fdir_reinit_task - worker thread to reinit FDIR filter table | 6156 | * ixgbe_watchdog_link_is_down - update netif_carrier status and |
6103 | * @work: pointer to work_struct containing our data | 6157 | * print link down message |
6158 | * @adapter - pointer to the adapter structure | ||
6104 | **/ | 6159 | **/ |
6105 | static void ixgbe_fdir_reinit_task(struct work_struct *work) | 6160 | static void ixgbe_watchdog_link_is_down(struct ixgbe_adapter* adapter) |
6106 | { | 6161 | { |
6107 | struct ixgbe_adapter *adapter = container_of(work, | 6162 | struct net_device *netdev = adapter->netdev; |
6108 | struct ixgbe_adapter, | ||
6109 | fdir_reinit_task); | ||
6110 | struct ixgbe_hw *hw = &adapter->hw; | 6163 | struct ixgbe_hw *hw = &adapter->hw; |
6164 | |||
6165 | adapter->link_up = false; | ||
6166 | adapter->link_speed = 0; | ||
6167 | |||
6168 | /* only continue if link was up previously */ | ||
6169 | if (!netif_carrier_ok(netdev)) | ||
6170 | return; | ||
6171 | |||
6172 | /* poll for SFP+ cable when link is down */ | ||
6173 | if (ixgbe_is_sfp(hw) && hw->mac.type == ixgbe_mac_82598EB) | ||
6174 | adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP; | ||
6175 | |||
6176 | e_info(drv, "NIC Link is Down\n"); | ||
6177 | netif_carrier_off(netdev); | ||
6178 | } | ||
6179 | |||
6180 | /** | ||
6181 | * ixgbe_watchdog_flush_tx - flush queues on link down | ||
6182 | * @adapter - pointer to the device adapter structure | ||
6183 | **/ | ||
6184 | static void ixgbe_watchdog_flush_tx(struct ixgbe_adapter *adapter) | ||
6185 | { | ||
6111 | int i; | 6186 | int i; |
6187 | int some_tx_pending = 0; | ||
6112 | 6188 | ||
6113 | if (ixgbe_reinit_fdir_tables_82599(hw) == 0) { | 6189 | if (!netif_carrier_ok(adapter->netdev)) { |
6114 | for (i = 0; i < adapter->num_tx_queues; i++) | 6190 | for (i = 0; i < adapter->num_tx_queues; i++) { |
6115 | set_bit(__IXGBE_TX_FDIR_INIT_DONE, | 6191 | struct ixgbe_ring *tx_ring = adapter->tx_ring[i]; |
6116 | &(adapter->tx_ring[i]->state)); | 6192 | if (tx_ring->next_to_use != tx_ring->next_to_clean) { |
6117 | } else { | 6193 | some_tx_pending = 1; |
6118 | e_err(probe, "failed to finish FDIR re-initialization, " | 6194 | break; |
6119 | "ignored adding FDIR ATR filters\n"); | 6195 | } |
6196 | } | ||
6197 | |||
6198 | if (some_tx_pending) { | ||
6199 | /* We've lost link, so the controller stops DMA, | ||
6200 | * but we've got queued Tx work that's never going | ||
6201 | * to get done, so reset controller to flush Tx. | ||
6202 | * (Do the reset outside of interrupt context). | ||
6203 | */ | ||
6204 | adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED; | ||
6205 | } | ||
6120 | } | 6206 | } |
6121 | /* Done FDIR Re-initialization, enable transmits */ | ||
6122 | netif_tx_start_all_queues(adapter->netdev); | ||
6123 | } | 6207 | } |
6124 | 6208 | ||
6125 | static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) | 6209 | static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) |
@@ -6142,133 +6226,186 @@ static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) | |||
6142 | e_warn(drv, "%d Spoofed packets detected\n", ssvpc); | 6226 | e_warn(drv, "%d Spoofed packets detected\n", ssvpc); |
6143 | } | 6227 | } |
6144 | 6228 | ||
6145 | static DEFINE_MUTEX(ixgbe_watchdog_lock); | 6229 | /** |
6230 | * ixgbe_watchdog_subtask - check and bring link up | ||
6231 | * @adapter - pointer to the device adapter structure | ||
6232 | **/ | ||
6233 | static void ixgbe_watchdog_subtask(struct ixgbe_adapter *adapter) | ||
6234 | { | ||
6235 | /* if interface is down do nothing */ | ||
6236 | if (test_bit(__IXGBE_DOWN, &adapter->state)) | ||
6237 | return; | ||
6238 | |||
6239 | ixgbe_watchdog_update_link(adapter); | ||
6240 | |||
6241 | if (adapter->link_up) | ||
6242 | ixgbe_watchdog_link_is_up(adapter); | ||
6243 | else | ||
6244 | ixgbe_watchdog_link_is_down(adapter); | ||
6245 | |||
6246 | ixgbe_spoof_check(adapter); | ||
6247 | ixgbe_update_stats(adapter); | ||
6248 | |||
6249 | ixgbe_watchdog_flush_tx(adapter); | ||
6250 | } | ||
6146 | 6251 | ||
6147 | /** | 6252 | /** |
6148 | * ixgbe_watchdog_task - worker thread to bring link up | 6253 | * ixgbe_sfp_detection_subtask - poll for SFP+ cable |
6149 | * @work: pointer to work_struct containing our data | 6254 | * @adapter - the ixgbe adapter structure |
6150 | **/ | 6255 | **/ |
6151 | static void ixgbe_watchdog_task(struct work_struct *work) | 6256 | static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter) |
6152 | { | 6257 | { |
6153 | struct ixgbe_adapter *adapter = container_of(work, | ||
6154 | struct ixgbe_adapter, | ||
6155 | watchdog_task); | ||
6156 | struct net_device *netdev = adapter->netdev; | ||
6157 | struct ixgbe_hw *hw = &adapter->hw; | 6258 | struct ixgbe_hw *hw = &adapter->hw; |
6158 | u32 link_speed; | 6259 | s32 err; |
6159 | bool link_up; | ||
6160 | int i; | ||
6161 | struct ixgbe_ring *tx_ring; | ||
6162 | int some_tx_pending = 0; | ||
6163 | 6260 | ||
6164 | mutex_lock(&ixgbe_watchdog_lock); | 6261 | /* not searching for SFP so there is nothing to do here */ |
6262 | if (!(adapter->flags2 & IXGBE_FLAG2_SEARCH_FOR_SFP) && | ||
6263 | !(adapter->flags2 & IXGBE_FLAG2_SFP_NEEDS_RESET)) | ||
6264 | return; | ||
6165 | 6265 | ||
6166 | link_up = adapter->link_up; | 6266 | /* someone else is in init, wait until next service event */ |
6167 | link_speed = adapter->link_speed; | 6267 | if (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) |
6268 | return; | ||
6168 | 6269 | ||
6169 | if (adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE) { | 6270 | err = hw->phy.ops.identify_sfp(hw); |
6170 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); | 6271 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) |
6171 | if (link_up) { | 6272 | goto sfp_out; |
6172 | #ifdef CONFIG_DCB | ||
6173 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | ||
6174 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) | ||
6175 | hw->mac.ops.fc_enable(hw, i); | ||
6176 | } else { | ||
6177 | hw->mac.ops.fc_enable(hw, 0); | ||
6178 | } | ||
6179 | #else | ||
6180 | hw->mac.ops.fc_enable(hw, 0); | ||
6181 | #endif | ||
6182 | } | ||
6183 | 6273 | ||
6184 | if (link_up || | 6274 | if (err == IXGBE_ERR_SFP_NOT_PRESENT) { |
6185 | time_after(jiffies, (adapter->link_check_timeout + | 6275 | /* If no cable is present, then we need to reset |
6186 | IXGBE_TRY_LINK_TIMEOUT))) { | 6276 | * the next time we find a good cable. */ |
6187 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE; | 6277 | adapter->flags2 |= IXGBE_FLAG2_SFP_NEEDS_RESET; |
6188 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMC_LSC); | ||
6189 | } | ||
6190 | adapter->link_up = link_up; | ||
6191 | adapter->link_speed = link_speed; | ||
6192 | } | 6278 | } |
6193 | 6279 | ||
6194 | if (link_up) { | 6280 | /* exit on error */ |
6195 | if (!netif_carrier_ok(netdev)) { | 6281 | if (err) |
6196 | bool flow_rx, flow_tx; | 6282 | goto sfp_out; |
6197 | |||
6198 | switch (hw->mac.type) { | ||
6199 | case ixgbe_mac_82598EB: { | ||
6200 | u32 frctl = IXGBE_READ_REG(hw, IXGBE_FCTRL); | ||
6201 | u32 rmcs = IXGBE_READ_REG(hw, IXGBE_RMCS); | ||
6202 | flow_rx = !!(frctl & IXGBE_FCTRL_RFCE); | ||
6203 | flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X); | ||
6204 | } | ||
6205 | break; | ||
6206 | case ixgbe_mac_82599EB: | ||
6207 | case ixgbe_mac_X540: { | ||
6208 | u32 mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN); | ||
6209 | u32 fccfg = IXGBE_READ_REG(hw, IXGBE_FCCFG); | ||
6210 | flow_rx = !!(mflcn & IXGBE_MFLCN_RFCE); | ||
6211 | flow_tx = !!(fccfg & IXGBE_FCCFG_TFCE_802_3X); | ||
6212 | } | ||
6213 | break; | ||
6214 | default: | ||
6215 | flow_tx = false; | ||
6216 | flow_rx = false; | ||
6217 | break; | ||
6218 | } | ||
6219 | 6283 | ||
6220 | e_info(drv, "NIC Link is Up %s, Flow Control: %s\n", | 6284 | /* exit if reset not needed */ |
6221 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? | 6285 | if (!(adapter->flags2 & IXGBE_FLAG2_SFP_NEEDS_RESET)) |
6222 | "10 Gbps" : | 6286 | goto sfp_out; |
6223 | (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? | ||
6224 | "1 Gbps" : | ||
6225 | (link_speed == IXGBE_LINK_SPEED_100_FULL ? | ||
6226 | "100 Mbps" : | ||
6227 | "unknown speed"))), | ||
6228 | ((flow_rx && flow_tx) ? "RX/TX" : | ||
6229 | (flow_rx ? "RX" : | ||
6230 | (flow_tx ? "TX" : "None")))); | ||
6231 | |||
6232 | netif_carrier_on(netdev); | ||
6233 | ixgbe_check_vf_rate_limit(adapter); | ||
6234 | } else { | ||
6235 | /* Force detection of hung controller */ | ||
6236 | for (i = 0; i < adapter->num_tx_queues; i++) { | ||
6237 | tx_ring = adapter->tx_ring[i]; | ||
6238 | set_check_for_tx_hang(tx_ring); | ||
6239 | } | ||
6240 | } | ||
6241 | } else { | ||
6242 | adapter->link_up = false; | ||
6243 | adapter->link_speed = 0; | ||
6244 | if (netif_carrier_ok(netdev)) { | ||
6245 | e_info(drv, "NIC Link is Down\n"); | ||
6246 | netif_carrier_off(netdev); | ||
6247 | } | ||
6248 | } | ||
6249 | 6287 | ||
6250 | if (!netif_carrier_ok(netdev)) { | 6288 | adapter->flags2 &= ~IXGBE_FLAG2_SFP_NEEDS_RESET; |
6251 | for (i = 0; i < adapter->num_tx_queues; i++) { | ||
6252 | tx_ring = adapter->tx_ring[i]; | ||
6253 | if (tx_ring->next_to_use != tx_ring->next_to_clean) { | ||
6254 | some_tx_pending = 1; | ||
6255 | break; | ||
6256 | } | ||
6257 | } | ||
6258 | 6289 | ||
6259 | if (some_tx_pending) { | 6290 | /* |
6260 | /* We've lost link, so the controller stops DMA, | 6291 | * A module may be identified correctly, but the EEPROM may not have |
6261 | * but we've got queued Tx work that's never going | 6292 | * support for that module. setup_sfp() will fail in that case, so |
6262 | * to get done, so reset controller to flush Tx. | 6293 | * we should not allow that module to load. |
6263 | * (Do the reset outside of interrupt context). | 6294 | */ |
6264 | */ | 6295 | if (hw->mac.type == ixgbe_mac_82598EB) |
6265 | schedule_work(&adapter->reset_task); | 6296 | err = hw->phy.ops.reset(hw); |
6266 | } | 6297 | else |
6298 | err = hw->mac.ops.setup_sfp(hw); | ||
6299 | |||
6300 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) | ||
6301 | goto sfp_out; | ||
6302 | |||
6303 | adapter->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; | ||
6304 | e_info(probe, "detected SFP+: %d\n", hw->phy.sfp_type); | ||
6305 | |||
6306 | sfp_out: | ||
6307 | clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); | ||
6308 | |||
6309 | if ((err == IXGBE_ERR_SFP_NOT_SUPPORTED) && | ||
6310 | (adapter->netdev->reg_state == NETREG_REGISTERED)) { | ||
6311 | e_dev_err("failed to initialize because an unsupported " | ||
6312 | "SFP+ module type was detected.\n"); | ||
6313 | e_dev_err("Reload the driver after installing a " | ||
6314 | "supported module.\n"); | ||
6315 | unregister_netdev(adapter->netdev); | ||
6267 | } | 6316 | } |
6317 | } | ||
6268 | 6318 | ||
6269 | ixgbe_spoof_check(adapter); | 6319 | /** |
6270 | ixgbe_update_stats(adapter); | 6320 | * ixgbe_sfp_link_config_subtask - set up link SFP after module install |
6271 | mutex_unlock(&ixgbe_watchdog_lock); | 6321 | * @adapter - the ixgbe adapter structure |
6322 | **/ | ||
6323 | static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter) | ||
6324 | { | ||
6325 | struct ixgbe_hw *hw = &adapter->hw; | ||
6326 | u32 autoneg; | ||
6327 | bool negotiation; | ||
6328 | |||
6329 | if (!(adapter->flags & IXGBE_FLAG_NEED_LINK_CONFIG)) | ||
6330 | return; | ||
6331 | |||
6332 | /* someone else is in init, wait until next service event */ | ||
6333 | if (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) | ||
6334 | return; | ||
6335 | |||
6336 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; | ||
6337 | |||
6338 | autoneg = hw->phy.autoneg_advertised; | ||
6339 | if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) | ||
6340 | hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation); | ||
6341 | hw->mac.autotry_restart = false; | ||
6342 | if (hw->mac.ops.setup_link) | ||
6343 | hw->mac.ops.setup_link(hw, autoneg, negotiation, true); | ||
6344 | |||
6345 | adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; | ||
6346 | adapter->link_check_timeout = jiffies; | ||
6347 | clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); | ||
6348 | } | ||
6349 | |||
6350 | /** | ||
6351 | * ixgbe_service_timer - Timer Call-back | ||
6352 | * @data: pointer to adapter cast into an unsigned long | ||
6353 | **/ | ||
6354 | static void ixgbe_service_timer(unsigned long data) | ||
6355 | { | ||
6356 | struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)data; | ||
6357 | unsigned long next_event_offset; | ||
6358 | |||
6359 | /* poll faster when waiting for link */ | ||
6360 | if (adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE) | ||
6361 | next_event_offset = HZ / 10; | ||
6362 | else | ||
6363 | next_event_offset = HZ * 2; | ||
6364 | |||
6365 | /* Reset the timer */ | ||
6366 | mod_timer(&adapter->service_timer, next_event_offset + jiffies); | ||
6367 | |||
6368 | ixgbe_service_event_schedule(adapter); | ||
6369 | } | ||
6370 | |||
6371 | static void ixgbe_reset_subtask(struct ixgbe_adapter *adapter) | ||
6372 | { | ||
6373 | if (!(adapter->flags2 & IXGBE_FLAG2_RESET_REQUESTED)) | ||
6374 | return; | ||
6375 | |||
6376 | adapter->flags2 &= ~IXGBE_FLAG2_RESET_REQUESTED; | ||
6377 | |||
6378 | /* If we're already down or resetting, just bail */ | ||
6379 | if (test_bit(__IXGBE_DOWN, &adapter->state) || | ||
6380 | test_bit(__IXGBE_RESETTING, &adapter->state)) | ||
6381 | return; | ||
6382 | |||
6383 | ixgbe_dump(adapter); | ||
6384 | netdev_err(adapter->netdev, "Reset adapter\n"); | ||
6385 | adapter->tx_timeout_count++; | ||
6386 | |||
6387 | ixgbe_reinit_locked(adapter); | ||
6388 | } | ||
6389 | |||
6390 | /** | ||
6391 | * ixgbe_service_task - manages and runs subtasks | ||
6392 | * @work: pointer to work_struct containing our data | ||
6393 | **/ | ||
6394 | static void ixgbe_service_task(struct work_struct *work) | ||
6395 | { | ||
6396 | struct ixgbe_adapter *adapter = container_of(work, | ||
6397 | struct ixgbe_adapter, | ||
6398 | service_task); | ||
6399 | |||
6400 | ixgbe_reset_subtask(adapter); | ||
6401 | ixgbe_sfp_detection_subtask(adapter); | ||
6402 | ixgbe_sfp_link_config_subtask(adapter); | ||
6403 | ixgbe_check_overtemp_subtask(adapter); | ||
6404 | ixgbe_watchdog_subtask(adapter); | ||
6405 | ixgbe_fdir_reinit_subtask(adapter); | ||
6406 | ixgbe_check_hang_subtask(adapter); | ||
6407 | |||
6408 | ixgbe_service_event_complete(adapter); | ||
6272 | } | 6409 | } |
6273 | 6410 | ||
6274 | static int ixgbe_tso(struct ixgbe_adapter *adapter, | 6411 | static int ixgbe_tso(struct ixgbe_adapter *adapter, |
@@ -7107,6 +7244,8 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter, | |||
7107 | #ifdef CONFIG_PCI_IOV | 7244 | #ifdef CONFIG_PCI_IOV |
7108 | struct ixgbe_hw *hw = &adapter->hw; | 7245 | struct ixgbe_hw *hw = &adapter->hw; |
7109 | int err; | 7246 | int err; |
7247 | int num_vf_macvlans, i; | ||
7248 | struct vf_macvlans *mv_list; | ||
7110 | 7249 | ||
7111 | if (hw->mac.type == ixgbe_mac_82598EB || !max_vfs) | 7250 | if (hw->mac.type == ixgbe_mac_82598EB || !max_vfs) |
7112 | return; | 7251 | return; |
@@ -7123,6 +7262,26 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter, | |||
7123 | e_err(probe, "Failed to enable PCI sriov: %d\n", err); | 7262 | e_err(probe, "Failed to enable PCI sriov: %d\n", err); |
7124 | goto err_novfs; | 7263 | goto err_novfs; |
7125 | } | 7264 | } |
7265 | |||
7266 | num_vf_macvlans = hw->mac.num_rar_entries - | ||
7267 | (IXGBE_MAX_PF_MACVLANS + 1 + adapter->num_vfs); | ||
7268 | |||
7269 | adapter->mv_list = mv_list = kcalloc(num_vf_macvlans, | ||
7270 | sizeof(struct vf_macvlans), | ||
7271 | GFP_KERNEL); | ||
7272 | if (mv_list) { | ||
7273 | /* Initialize list of VF macvlans */ | ||
7274 | INIT_LIST_HEAD(&adapter->vf_mvs.l); | ||
7275 | for (i = 0; i < num_vf_macvlans; i++) { | ||
7276 | mv_list->vf = -1; | ||
7277 | mv_list->free = true; | ||
7278 | mv_list->rar_entry = hw->mac.num_rar_entries - | ||
7279 | (i + adapter->num_vfs + 1); | ||
7280 | list_add(&mv_list->l, &adapter->vf_mvs.l); | ||
7281 | mv_list++; | ||
7282 | } | ||
7283 | } | ||
7284 | |||
7126 | /* If call to enable VFs succeeded then allocate memory | 7285 | /* If call to enable VFs succeeded then allocate memory |
7127 | * for per VF control structures. | 7286 | * for per VF control structures. |
7128 | */ | 7287 | */ |
@@ -7293,22 +7452,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
7293 | hw->phy.mdio.mdio_read = ixgbe_mdio_read; | 7452 | hw->phy.mdio.mdio_read = ixgbe_mdio_read; |
7294 | hw->phy.mdio.mdio_write = ixgbe_mdio_write; | 7453 | hw->phy.mdio.mdio_write = ixgbe_mdio_write; |
7295 | 7454 | ||
7296 | /* set up this timer and work struct before calling get_invariants | ||
7297 | * which might start the timer | ||
7298 | */ | ||
7299 | init_timer(&adapter->sfp_timer); | ||
7300 | adapter->sfp_timer.function = ixgbe_sfp_timer; | ||
7301 | adapter->sfp_timer.data = (unsigned long) adapter; | ||
7302 | |||
7303 | INIT_WORK(&adapter->sfp_task, ixgbe_sfp_task); | ||
7304 | |||
7305 | /* multispeed fiber has its own tasklet, called from GPI SDP1 context */ | ||
7306 | INIT_WORK(&adapter->multispeed_fiber_task, ixgbe_multispeed_fiber_task); | ||
7307 | |||
7308 | /* a new SFP+ module arrival, called from GPI SDP2 context */ | ||
7309 | INIT_WORK(&adapter->sfp_config_module_task, | ||
7310 | ixgbe_sfp_config_module_task); | ||
7311 | |||
7312 | ii->get_invariants(hw); | 7455 | ii->get_invariants(hw); |
7313 | 7456 | ||
7314 | /* setup the private structure */ | 7457 | /* setup the private structure */ |
@@ -7342,17 +7485,9 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
7342 | hw->phy.reset_if_overtemp = false; | 7485 | hw->phy.reset_if_overtemp = false; |
7343 | if (err == IXGBE_ERR_SFP_NOT_PRESENT && | 7486 | if (err == IXGBE_ERR_SFP_NOT_PRESENT && |
7344 | hw->mac.type == ixgbe_mac_82598EB) { | 7487 | hw->mac.type == ixgbe_mac_82598EB) { |
7345 | /* | ||
7346 | * Start a kernel thread to watch for a module to arrive. | ||
7347 | * Only do this for 82598, since 82599 will generate | ||
7348 | * interrupts on module arrival. | ||
7349 | */ | ||
7350 | set_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state); | ||
7351 | mod_timer(&adapter->sfp_timer, | ||
7352 | round_jiffies(jiffies + (2 * HZ))); | ||
7353 | err = 0; | 7488 | err = 0; |
7354 | } else if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 7489 | } else if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
7355 | e_dev_err("failed to initialize because an unsupported SFP+ " | 7490 | e_dev_err("failed to load because an unsupported SFP+ " |
7356 | "module type was detected.\n"); | 7491 | "module type was detected.\n"); |
7357 | e_dev_err("Reload the driver after installing a supported " | 7492 | e_dev_err("Reload the driver after installing a supported " |
7358 | "module.\n"); | 7493 | "module.\n"); |
@@ -7444,12 +7579,11 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
7444 | (hw->mac.type == ixgbe_mac_82599EB)))) | 7579 | (hw->mac.type == ixgbe_mac_82599EB)))) |
7445 | hw->mac.ops.disable_tx_laser(hw); | 7580 | hw->mac.ops.disable_tx_laser(hw); |
7446 | 7581 | ||
7447 | init_timer(&adapter->watchdog_timer); | 7582 | setup_timer(&adapter->service_timer, &ixgbe_service_timer, |
7448 | adapter->watchdog_timer.function = ixgbe_watchdog; | 7583 | (unsigned long) adapter); |
7449 | adapter->watchdog_timer.data = (unsigned long)adapter; | ||
7450 | 7584 | ||
7451 | INIT_WORK(&adapter->reset_task, ixgbe_reset_task); | 7585 | INIT_WORK(&adapter->service_task, ixgbe_service_task); |
7452 | INIT_WORK(&adapter->watchdog_task, ixgbe_watchdog_task); | 7586 | clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); |
7453 | 7587 | ||
7454 | err = ixgbe_init_interrupt_scheme(adapter); | 7588 | err = ixgbe_init_interrupt_scheme(adapter); |
7455 | if (err) | 7589 | if (err) |
@@ -7536,13 +7670,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
7536 | /* carrier off reporting is important to ethtool even BEFORE open */ | 7670 | /* carrier off reporting is important to ethtool even BEFORE open */ |
7537 | netif_carrier_off(netdev); | 7671 | netif_carrier_off(netdev); |
7538 | 7672 | ||
7539 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || | ||
7540 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) | ||
7541 | INIT_WORK(&adapter->fdir_reinit_task, ixgbe_fdir_reinit_task); | ||
7542 | |||
7543 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) | ||
7544 | INIT_WORK(&adapter->check_overtemp_task, | ||
7545 | ixgbe_check_overtemp_task); | ||
7546 | #ifdef CONFIG_IXGBE_DCA | 7673 | #ifdef CONFIG_IXGBE_DCA |
7547 | if (dca_add_requester(&pdev->dev) == 0) { | 7674 | if (dca_add_requester(&pdev->dev) == 0) { |
7548 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; | 7675 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; |
@@ -7569,11 +7696,7 @@ err_sw_init: | |||
7569 | err_eeprom: | 7696 | err_eeprom: |
7570 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) | 7697 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) |
7571 | ixgbe_disable_sriov(adapter); | 7698 | ixgbe_disable_sriov(adapter); |
7572 | clear_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state); | 7699 | adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP; |
7573 | del_timer_sync(&adapter->sfp_timer); | ||
7574 | cancel_work_sync(&adapter->sfp_task); | ||
7575 | cancel_work_sync(&adapter->multispeed_fiber_task); | ||
7576 | cancel_work_sync(&adapter->sfp_config_module_task); | ||
7577 | iounmap(hw->hw_addr); | 7700 | iounmap(hw->hw_addr); |
7578 | err_ioremap: | 7701 | err_ioremap: |
7579 | free_netdev(netdev); | 7702 | free_netdev(netdev); |
@@ -7601,24 +7724,7 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
7601 | struct net_device *netdev = adapter->netdev; | 7724 | struct net_device *netdev = adapter->netdev; |
7602 | 7725 | ||
7603 | set_bit(__IXGBE_DOWN, &adapter->state); | 7726 | set_bit(__IXGBE_DOWN, &adapter->state); |
7604 | 7727 | cancel_work_sync(&adapter->service_task); | |
7605 | /* | ||
7606 | * The timers may be rescheduled, so explicitly disable them | ||
7607 | * from being rescheduled. | ||
7608 | */ | ||
7609 | clear_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state); | ||
7610 | del_timer_sync(&adapter->watchdog_timer); | ||
7611 | del_timer_sync(&adapter->sfp_timer); | ||
7612 | |||
7613 | cancel_work_sync(&adapter->watchdog_task); | ||
7614 | cancel_work_sync(&adapter->sfp_task); | ||
7615 | cancel_work_sync(&adapter->multispeed_fiber_task); | ||
7616 | cancel_work_sync(&adapter->sfp_config_module_task); | ||
7617 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || | ||
7618 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) | ||
7619 | cancel_work_sync(&adapter->fdir_reinit_task); | ||
7620 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) | ||
7621 | cancel_work_sync(&adapter->check_overtemp_task); | ||
7622 | 7728 | ||
7623 | #ifdef CONFIG_IXGBE_DCA | 7729 | #ifdef CONFIG_IXGBE_DCA |
7624 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { | 7730 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { |
diff --git a/drivers/net/ixgbe/ixgbe_mbx.h b/drivers/net/ixgbe/ixgbe_mbx.h index f53dc5bb28b7..b239bdac38da 100644 --- a/drivers/net/ixgbe/ixgbe_mbx.h +++ b/drivers/net/ixgbe/ixgbe_mbx.h | |||
@@ -67,6 +67,7 @@ | |||
67 | #define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ | 67 | #define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ |
68 | #define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */ | 68 | #define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */ |
69 | #define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */ | 69 | #define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */ |
70 | #define IXGBE_VF_SET_MACVLAN 0x06 /* VF requests PF for unicast filter */ | ||
70 | 71 | ||
71 | /* length of permanent address message returned from PF */ | 72 | /* length of permanent address message returned from PF */ |
72 | #define IXGBE_VF_PERMADDR_MSG_LEN 4 | 73 | #define IXGBE_VF_PERMADDR_MSG_LEN 4 |
diff --git a/drivers/net/ixgbe/ixgbe_sriov.c b/drivers/net/ixgbe/ixgbe_sriov.c index 47650278d414..ac99b0458fe2 100644 --- a/drivers/net/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ixgbe/ixgbe_sriov.c | |||
@@ -82,6 +82,21 @@ static int ixgbe_set_vf_multicasts(struct ixgbe_adapter *adapter, | |||
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | static void ixgbe_restore_vf_macvlans(struct ixgbe_adapter *adapter) | ||
86 | { | ||
87 | struct ixgbe_hw *hw = &adapter->hw; | ||
88 | struct list_head *pos; | ||
89 | struct vf_macvlans *entry; | ||
90 | |||
91 | list_for_each(pos, &adapter->vf_mvs.l) { | ||
92 | entry = list_entry(pos, struct vf_macvlans, l); | ||
93 | if (entry->free == false) | ||
94 | hw->mac.ops.set_rar(hw, entry->rar_entry, | ||
95 | entry->vf_macvlan, | ||
96 | entry->vf, IXGBE_RAH_AV); | ||
97 | } | ||
98 | } | ||
99 | |||
85 | void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter) | 100 | void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter) |
86 | { | 101 | { |
87 | struct ixgbe_hw *hw = &adapter->hw; | 102 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -102,6 +117,9 @@ void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter) | |||
102 | IXGBE_WRITE_REG(hw, IXGBE_MTA(vector_reg), mta_reg); | 117 | IXGBE_WRITE_REG(hw, IXGBE_MTA(vector_reg), mta_reg); |
103 | } | 118 | } |
104 | } | 119 | } |
120 | |||
121 | /* Restore any VF macvlans */ | ||
122 | ixgbe_restore_vf_macvlans(adapter); | ||
105 | } | 123 | } |
106 | 124 | ||
107 | static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, | 125 | static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, |
@@ -200,6 +218,61 @@ static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, | |||
200 | return 0; | 218 | return 0; |
201 | } | 219 | } |
202 | 220 | ||
221 | static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, | ||
222 | int vf, int index, unsigned char *mac_addr) | ||
223 | { | ||
224 | struct ixgbe_hw *hw = &adapter->hw; | ||
225 | struct list_head *pos; | ||
226 | struct vf_macvlans *entry; | ||
227 | |||
228 | if (index <= 1) { | ||
229 | list_for_each(pos, &adapter->vf_mvs.l) { | ||
230 | entry = list_entry(pos, struct vf_macvlans, l); | ||
231 | if (entry->vf == vf) { | ||
232 | entry->vf = -1; | ||
233 | entry->free = true; | ||
234 | entry->is_macvlan = false; | ||
235 | hw->mac.ops.clear_rar(hw, entry->rar_entry); | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * If index was zero then we were asked to clear the uc list | ||
242 | * for the VF. We're done. | ||
243 | */ | ||
244 | if (!index) | ||
245 | return 0; | ||
246 | |||
247 | entry = NULL; | ||
248 | |||
249 | list_for_each(pos, &adapter->vf_mvs.l) { | ||
250 | entry = list_entry(pos, struct vf_macvlans, l); | ||
251 | if (entry->free) | ||
252 | break; | ||
253 | } | ||
254 | |||
255 | /* | ||
256 | * If we traversed the entire list and didn't find a free entry | ||
257 | * then we're out of space on the RAR table. Also entry may | ||
258 | * be NULL because the original memory allocation for the list | ||
259 | * failed, which is not fatal but does mean we can't support | ||
260 | * VF requests for MACVLAN because we couldn't allocate | ||
261 | * memory for the list management required. | ||
262 | */ | ||
263 | if (!entry || !entry->free) | ||
264 | return -ENOSPC; | ||
265 | |||
266 | entry->free = false; | ||
267 | entry->is_macvlan = true; | ||
268 | entry->vf = vf; | ||
269 | memcpy(entry->vf_macvlan, mac_addr, ETH_ALEN); | ||
270 | |||
271 | hw->mac.ops.set_rar(hw, entry->rar_entry, mac_addr, vf, IXGBE_RAH_AV); | ||
272 | |||
273 | return 0; | ||
274 | } | ||
275 | |||
203 | int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask) | 276 | int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask) |
204 | { | 277 | { |
205 | unsigned char vf_mac_addr[6]; | 278 | unsigned char vf_mac_addr[6]; |
@@ -251,12 +324,12 @@ static inline void ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf) | |||
251 | static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) | 324 | static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) |
252 | { | 325 | { |
253 | u32 mbx_size = IXGBE_VFMAILBOX_SIZE; | 326 | u32 mbx_size = IXGBE_VFMAILBOX_SIZE; |
254 | u32 msgbuf[mbx_size]; | 327 | u32 msgbuf[IXGBE_VFMAILBOX_SIZE]; |
255 | struct ixgbe_hw *hw = &adapter->hw; | 328 | struct ixgbe_hw *hw = &adapter->hw; |
256 | s32 retval; | 329 | s32 retval; |
257 | int entries; | 330 | int entries; |
258 | u16 *hash_list; | 331 | u16 *hash_list; |
259 | int add, vid; | 332 | int add, vid, index; |
260 | u8 *new_mac; | 333 | u8 *new_mac; |
261 | 334 | ||
262 | retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf); | 335 | retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf); |
@@ -345,6 +418,24 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) | |||
345 | retval = ixgbe_set_vf_vlan(adapter, add, vid, vf); | 418 | retval = ixgbe_set_vf_vlan(adapter, add, vid, vf); |
346 | } | 419 | } |
347 | break; | 420 | break; |
421 | case IXGBE_VF_SET_MACVLAN: | ||
422 | index = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK) >> | ||
423 | IXGBE_VT_MSGINFO_SHIFT; | ||
424 | /* | ||
425 | * If the VF is allowed to set MAC filters then turn off | ||
426 | * anti-spoofing to avoid false positives. An index | ||
427 | * greater than 0 will indicate the VF is setting a | ||
428 | * macvlan MAC filter. | ||
429 | */ | ||
430 | if (index > 0 && adapter->antispoofing_enabled) { | ||
431 | hw->mac.ops.set_mac_anti_spoofing(hw, false, | ||
432 | adapter->num_vfs); | ||
433 | hw->mac.ops.set_vlan_anti_spoofing(hw, false, vf); | ||
434 | adapter->antispoofing_enabled = false; | ||
435 | } | ||
436 | retval = ixgbe_set_vf_macvlan(adapter, vf, index, | ||
437 | (unsigned char *)(&msgbuf[1])); | ||
438 | break; | ||
348 | default: | 439 | default: |
349 | e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); | 440 | e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); |
350 | retval = IXGBE_ERR_MBX; | 441 | retval = IXGBE_ERR_MBX; |
@@ -452,7 +543,8 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) | |||
452 | goto out; | 543 | goto out; |
453 | ixgbe_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf); | 544 | ixgbe_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf); |
454 | ixgbe_set_vmolr(hw, vf, false); | 545 | ixgbe_set_vmolr(hw, vf, false); |
455 | hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf); | 546 | if (adapter->antispoofing_enabled) |
547 | hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf); | ||
456 | adapter->vfinfo[vf].pf_vlan = vlan; | 548 | adapter->vfinfo[vf].pf_vlan = vlan; |
457 | adapter->vfinfo[vf].pf_qos = qos; | 549 | adapter->vfinfo[vf].pf_qos = qos; |
458 | dev_info(&adapter->pdev->dev, | 550 | dev_info(&adapter->pdev->dev, |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 70e6870be01f..fa43f2507f43 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -62,6 +62,7 @@ | |||
62 | #define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC | 62 | #define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC |
63 | #define IXGBE_DEV_ID_82599_COMBO_BACKPLANE 0x10F8 | 63 | #define IXGBE_DEV_ID_82599_COMBO_BACKPLANE 0x10F8 |
64 | #define IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ 0x000C | 64 | #define IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ 0x000C |
65 | #define IXGBE_DEV_ID_82599_LS 0x154F | ||
65 | #define IXGBE_DEV_ID_X540T 0x1528 | 66 | #define IXGBE_DEV_ID_X540T 0x1528 |
66 | 67 | ||
67 | /* General Registers */ | 68 | /* General Registers */ |
@@ -2395,6 +2396,7 @@ enum ixgbe_sfp_type { | |||
2395 | enum ixgbe_media_type { | 2396 | enum ixgbe_media_type { |
2396 | ixgbe_media_type_unknown = 0, | 2397 | ixgbe_media_type_unknown = 0, |
2397 | ixgbe_media_type_fiber, | 2398 | ixgbe_media_type_fiber, |
2399 | ixgbe_media_type_fiber_lco, | ||
2398 | ixgbe_media_type_copper, | 2400 | ixgbe_media_type_copper, |
2399 | ixgbe_media_type_backplane, | 2401 | ixgbe_media_type_backplane, |
2400 | ixgbe_media_type_cx4, | 2402 | ixgbe_media_type_cx4, |
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c index 05fa7c85deed..d7ab202fb95c 100644 --- a/drivers/net/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ixgbevf/ixgbevf_main.c | |||
@@ -1460,6 +1460,34 @@ static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter) | |||
1460 | } | 1460 | } |
1461 | } | 1461 | } |
1462 | 1462 | ||
1463 | static int ixgbevf_write_uc_addr_list(struct net_device *netdev) | ||
1464 | { | ||
1465 | struct ixgbevf_adapter *adapter = netdev_priv(netdev); | ||
1466 | struct ixgbe_hw *hw = &adapter->hw; | ||
1467 | int count = 0; | ||
1468 | |||
1469 | if ((netdev_uc_count(netdev)) > 10) { | ||
1470 | printk(KERN_ERR "Too many unicast filters - No Space\n"); | ||
1471 | return -ENOSPC; | ||
1472 | } | ||
1473 | |||
1474 | if (!netdev_uc_empty(netdev)) { | ||
1475 | struct netdev_hw_addr *ha; | ||
1476 | netdev_for_each_uc_addr(ha, netdev) { | ||
1477 | hw->mac.ops.set_uc_addr(hw, ++count, ha->addr); | ||
1478 | udelay(200); | ||
1479 | } | ||
1480 | } else { | ||
1481 | /* | ||
1482 | * If the list is empty then send message to PF driver to | ||
1483 | * clear all macvlans on this VF. | ||
1484 | */ | ||
1485 | hw->mac.ops.set_uc_addr(hw, 0, NULL); | ||
1486 | } | ||
1487 | |||
1488 | return count; | ||
1489 | } | ||
1490 | |||
1463 | /** | 1491 | /** |
1464 | * ixgbevf_set_rx_mode - Multicast set | 1492 | * ixgbevf_set_rx_mode - Multicast set |
1465 | * @netdev: network interface device structure | 1493 | * @netdev: network interface device structure |
@@ -1476,6 +1504,8 @@ static void ixgbevf_set_rx_mode(struct net_device *netdev) | |||
1476 | /* reprogram multicast list */ | 1504 | /* reprogram multicast list */ |
1477 | if (hw->mac.ops.update_mc_addr_list) | 1505 | if (hw->mac.ops.update_mc_addr_list) |
1478 | hw->mac.ops.update_mc_addr_list(hw, netdev); | 1506 | hw->mac.ops.update_mc_addr_list(hw, netdev); |
1507 | |||
1508 | ixgbevf_write_uc_addr_list(netdev); | ||
1479 | } | 1509 | } |
1480 | 1510 | ||
1481 | static void ixgbevf_napi_enable_all(struct ixgbevf_adapter *adapter) | 1511 | static void ixgbevf_napi_enable_all(struct ixgbevf_adapter *adapter) |
diff --git a/drivers/net/ixgbevf/mbx.h b/drivers/net/ixgbevf/mbx.h index b2b5bf5daa3d..ea393eb03f3a 100644 --- a/drivers/net/ixgbevf/mbx.h +++ b/drivers/net/ixgbevf/mbx.h | |||
@@ -81,6 +81,7 @@ | |||
81 | #define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ | 81 | #define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ |
82 | #define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */ | 82 | #define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */ |
83 | #define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */ | 83 | #define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */ |
84 | #define IXGBE_VF_SET_MACVLAN 0x06 /* VF requests PF for unicast filter */ | ||
84 | 85 | ||
85 | /* length of permanent address message returned from PF */ | 86 | /* length of permanent address message returned from PF */ |
86 | #define IXGBE_VF_PERMADDR_MSG_LEN 4 | 87 | #define IXGBE_VF_PERMADDR_MSG_LEN 4 |
diff --git a/drivers/net/ixgbevf/vf.c b/drivers/net/ixgbevf/vf.c index eecd3bf6833f..aa3682e8c473 100644 --- a/drivers/net/ixgbevf/vf.c +++ b/drivers/net/ixgbevf/vf.c | |||
@@ -216,6 +216,39 @@ static s32 ixgbevf_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr) | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr) | ||
220 | { | ||
221 | struct ixgbe_mbx_info *mbx = &hw->mbx; | ||
222 | u32 msgbuf[3]; | ||
223 | u8 *msg_addr = (u8 *)(&msgbuf[1]); | ||
224 | s32 ret_val; | ||
225 | |||
226 | memset(msgbuf, 0, sizeof(msgbuf)); | ||
227 | /* | ||
228 | * If index is one then this is the start of a new list and needs | ||
229 | * indication to the PF so it can do it's own list management. | ||
230 | * If it is zero then that tells the PF to just clear all of | ||
231 | * this VF's macvlans and there is no new list. | ||
232 | */ | ||
233 | msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT; | ||
234 | msgbuf[0] |= IXGBE_VF_SET_MACVLAN; | ||
235 | if (addr) | ||
236 | memcpy(msg_addr, addr, 6); | ||
237 | ret_val = mbx->ops.write_posted(hw, msgbuf, 3); | ||
238 | |||
239 | if (!ret_val) | ||
240 | ret_val = mbx->ops.read_posted(hw, msgbuf, 3); | ||
241 | |||
242 | msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | ||
243 | |||
244 | if (!ret_val) | ||
245 | if (msgbuf[0] == | ||
246 | (IXGBE_VF_SET_MACVLAN | IXGBE_VT_MSGTYPE_NACK)) | ||
247 | ret_val = -ENOMEM; | ||
248 | |||
249 | return ret_val; | ||
250 | } | ||
251 | |||
219 | /** | 252 | /** |
220 | * ixgbevf_set_rar_vf - set device MAC address | 253 | * ixgbevf_set_rar_vf - set device MAC address |
221 | * @hw: pointer to hardware structure | 254 | * @hw: pointer to hardware structure |
@@ -378,6 +411,7 @@ static struct ixgbe_mac_operations ixgbevf_mac_ops = { | |||
378 | .check_link = ixgbevf_check_mac_link_vf, | 411 | .check_link = ixgbevf_check_mac_link_vf, |
379 | .set_rar = ixgbevf_set_rar_vf, | 412 | .set_rar = ixgbevf_set_rar_vf, |
380 | .update_mc_addr_list = ixgbevf_update_mc_addr_list_vf, | 413 | .update_mc_addr_list = ixgbevf_update_mc_addr_list_vf, |
414 | .set_uc_addr = ixgbevf_set_uc_addr_vf, | ||
381 | .set_vfta = ixgbevf_set_vfta_vf, | 415 | .set_vfta = ixgbevf_set_vfta_vf, |
382 | }; | 416 | }; |
383 | 417 | ||
diff --git a/drivers/net/ixgbevf/vf.h b/drivers/net/ixgbevf/vf.h index 23eb114c149f..10306b492ee6 100644 --- a/drivers/net/ixgbevf/vf.h +++ b/drivers/net/ixgbevf/vf.h | |||
@@ -62,6 +62,7 @@ struct ixgbe_mac_operations { | |||
62 | 62 | ||
63 | /* RAR, Multicast, VLAN */ | 63 | /* RAR, Multicast, VLAN */ |
64 | s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32); | 64 | s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32); |
65 | s32 (*set_uc_addr)(struct ixgbe_hw *, u32, u8 *); | ||
65 | s32 (*init_rx_addrs)(struct ixgbe_hw *); | 66 | s32 (*init_rx_addrs)(struct ixgbe_hw *); |
66 | s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *); | 67 | s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *); |
67 | s32 (*enable_mc)(struct ixgbe_hw *); | 68 | s32 (*enable_mc)(struct ixgbe_hw *); |