3301 if (ixgbe->param_adv_10000fdx_cap == 1)
3302 autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
3303
3304 if (ixgbe->param_adv_1000fdx_cap == 1)
3305 autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
3306
3307 if (ixgbe->param_adv_100fdx_cap == 1)
3308 autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL;
3309
3310 if (ixgbe->param_adv_autoneg_cap == 1 && autoneg_advertised == 0) {
3311 ixgbe_notice(ixgbe, "Invalid link settings. Setup link "
3312 "to autonegotiation with full link capabilities.");
3313
3314 autoneg_advertised = IXGBE_LINK_SPEED_10GB_FULL |
3315 IXGBE_LINK_SPEED_1GB_FULL |
3316 IXGBE_LINK_SPEED_100_FULL;
3317 }
3318
3319 if (setup_hw) {
3320 if (ixgbe_setup_link(&ixgbe->hw, autoneg_advertised,
3321 ixgbe->param_adv_autoneg_cap, B_TRUE) != IXGBE_SUCCESS) {
3322 ixgbe_notice(ixgbe, "Setup link failed on this "
3323 "device.");
3324 return (IXGBE_FAILURE);
3325 }
3326 }
3327
3328 return (IXGBE_SUCCESS);
3329 }
3330
3331 /*
3332 * ixgbe_driver_link_check - Link status processing.
3333 *
3334 * This function can be called in both kernel context and interrupt context
3335 */
3336 static void
3337 ixgbe_driver_link_check(ixgbe_t *ixgbe)
3338 {
3339 struct ixgbe_hw *hw = &ixgbe->hw;
3340 ixgbe_link_speed speed = IXGBE_LINK_SPEED_UNKNOWN;
3341 boolean_t link_up = B_FALSE;
3400 }
3401 }
3402
3403 /*
3404 * ixgbe_sfp_check - sfp module processing done in taskq only for 82599.
3405 */
3406 static void
3407 ixgbe_sfp_check(void *arg)
3408 {
3409 ixgbe_t *ixgbe = (ixgbe_t *)arg;
3410 uint32_t eicr = ixgbe->eicr;
3411 struct ixgbe_hw *hw = &ixgbe->hw;
3412
3413 mutex_enter(&ixgbe->gen_lock);
3414 if (eicr & IXGBE_EICR_GPI_SDP1) {
3415 /* clear the interrupt */
3416 IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1);
3417
3418 /* if link up, do multispeed fiber setup */
3419 (void) ixgbe_setup_link(hw, IXGBE_LINK_SPEED_82599_AUTONEG,
3420 B_TRUE, B_TRUE);
3421 ixgbe_driver_link_check(ixgbe);
3422 ixgbe_get_hw_state(ixgbe);
3423 } else if (eicr & IXGBE_EICR_GPI_SDP2) {
3424 /* clear the interrupt */
3425 IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP2);
3426
3427 /* if link up, do sfp module setup */
3428 (void) hw->mac.ops.setup_sfp(hw);
3429
3430 /* do multispeed fiber setup */
3431 (void) ixgbe_setup_link(hw, IXGBE_LINK_SPEED_82599_AUTONEG,
3432 B_TRUE, B_TRUE);
3433 ixgbe_driver_link_check(ixgbe);
3434 ixgbe_get_hw_state(ixgbe);
3435 }
3436 mutex_exit(&ixgbe->gen_lock);
3437
3438 /*
3439 * We need to fully re-check the link later.
3440 */
3441 ixgbe->link_check_complete = B_FALSE;
3442 ixgbe->link_check_hrtime = gethrtime() +
3443 (IXGBE_LINK_UP_TIME * 100000000ULL);
3444 }
3445
3446 /*
3447 * ixgbe_overtemp_check - overtemp module processing done in taskq
3448 *
3449 * This routine will only be called on adapters with temperature sensor.
3450 * The indication of over-temperature can be either SDP0 interrupt or the link
3451 * status change interrupt.
3452 */
4051 &atlas);
4052 atlas |= IXGBE_ATLAS_PDN_TX_1G_QL_ALL;
4053 (void) ixgbe_write_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_1G,
4054 atlas);
4055
4056 (void) ixgbe_read_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_AN,
4057 &atlas);
4058 atlas |= IXGBE_ATLAS_PDN_TX_AN_QL_ALL;
4059 (void) ixgbe_write_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_AN,
4060 atlas);
4061 break;
4062
4063 case ixgbe_mac_82599EB:
4064 case ixgbe_mac_X540:
4065 reg = IXGBE_READ_REG(&ixgbe->hw, IXGBE_AUTOC);
4066 reg |= (IXGBE_AUTOC_FLU |
4067 IXGBE_AUTOC_10G_KX4);
4068 IXGBE_WRITE_REG(&ixgbe->hw, IXGBE_AUTOC, reg);
4069
4070 (void) ixgbe_setup_link(&ixgbe->hw, IXGBE_LINK_SPEED_10GB_FULL,
4071 B_FALSE, B_TRUE);
4072 break;
4073
4074 default:
4075 break;
4076 }
4077 }
4078
4079 #pragma inline(ixgbe_intr_rx_work)
4080 /*
4081 * ixgbe_intr_rx_work - RX processing of ISR.
4082 */
4083 static void
4084 ixgbe_intr_rx_work(ixgbe_rx_ring_t *rx_ring)
4085 {
4086 mblk_t *mp;
4087
4088 mutex_enter(&rx_ring->rx_lock);
4089
4090 mp = ixgbe_ring_rx(rx_ring, IXGBE_POLL_NULL);
4091 mutex_exit(&rx_ring->rx_lock);
|
3301 if (ixgbe->param_adv_10000fdx_cap == 1)
3302 autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
3303
3304 if (ixgbe->param_adv_1000fdx_cap == 1)
3305 autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
3306
3307 if (ixgbe->param_adv_100fdx_cap == 1)
3308 autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL;
3309
3310 if (ixgbe->param_adv_autoneg_cap == 1 && autoneg_advertised == 0) {
3311 ixgbe_notice(ixgbe, "Invalid link settings. Setup link "
3312 "to autonegotiation with full link capabilities.");
3313
3314 autoneg_advertised = IXGBE_LINK_SPEED_10GB_FULL |
3315 IXGBE_LINK_SPEED_1GB_FULL |
3316 IXGBE_LINK_SPEED_100_FULL;
3317 }
3318
3319 if (setup_hw) {
3320 if (ixgbe_setup_link(&ixgbe->hw, autoneg_advertised,
3321 B_TRUE) != IXGBE_SUCCESS) {
3322 ixgbe_notice(ixgbe, "Setup link failed on this "
3323 "device.");
3324 return (IXGBE_FAILURE);
3325 }
3326 }
3327
3328 return (IXGBE_SUCCESS);
3329 }
3330
3331 /*
3332 * ixgbe_driver_link_check - Link status processing.
3333 *
3334 * This function can be called in both kernel context and interrupt context
3335 */
3336 static void
3337 ixgbe_driver_link_check(ixgbe_t *ixgbe)
3338 {
3339 struct ixgbe_hw *hw = &ixgbe->hw;
3340 ixgbe_link_speed speed = IXGBE_LINK_SPEED_UNKNOWN;
3341 boolean_t link_up = B_FALSE;
3400 }
3401 }
3402
3403 /*
3404 * ixgbe_sfp_check - sfp module processing done in taskq only for 82599.
3405 */
3406 static void
3407 ixgbe_sfp_check(void *arg)
3408 {
3409 ixgbe_t *ixgbe = (ixgbe_t *)arg;
3410 uint32_t eicr = ixgbe->eicr;
3411 struct ixgbe_hw *hw = &ixgbe->hw;
3412
3413 mutex_enter(&ixgbe->gen_lock);
3414 if (eicr & IXGBE_EICR_GPI_SDP1) {
3415 /* clear the interrupt */
3416 IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1);
3417
3418 /* if link up, do multispeed fiber setup */
3419 (void) ixgbe_setup_link(hw, IXGBE_LINK_SPEED_82599_AUTONEG,
3420 B_TRUE);
3421 ixgbe_driver_link_check(ixgbe);
3422 ixgbe_get_hw_state(ixgbe);
3423 } else if (eicr & IXGBE_EICR_GPI_SDP2) {
3424 /* clear the interrupt */
3425 IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP2);
3426
3427 /* if link up, do sfp module setup */
3428 (void) hw->mac.ops.setup_sfp(hw);
3429
3430 /* do multispeed fiber setup */
3431 (void) ixgbe_setup_link(hw, IXGBE_LINK_SPEED_82599_AUTONEG,
3432 B_TRUE);
3433 ixgbe_driver_link_check(ixgbe);
3434 ixgbe_get_hw_state(ixgbe);
3435 }
3436 mutex_exit(&ixgbe->gen_lock);
3437
3438 /*
3439 * We need to fully re-check the link later.
3440 */
3441 ixgbe->link_check_complete = B_FALSE;
3442 ixgbe->link_check_hrtime = gethrtime() +
3443 (IXGBE_LINK_UP_TIME * 100000000ULL);
3444 }
3445
3446 /*
3447 * ixgbe_overtemp_check - overtemp module processing done in taskq
3448 *
3449 * This routine will only be called on adapters with temperature sensor.
3450 * The indication of over-temperature can be either SDP0 interrupt or the link
3451 * status change interrupt.
3452 */
4051 &atlas);
4052 atlas |= IXGBE_ATLAS_PDN_TX_1G_QL_ALL;
4053 (void) ixgbe_write_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_1G,
4054 atlas);
4055
4056 (void) ixgbe_read_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_AN,
4057 &atlas);
4058 atlas |= IXGBE_ATLAS_PDN_TX_AN_QL_ALL;
4059 (void) ixgbe_write_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_AN,
4060 atlas);
4061 break;
4062
4063 case ixgbe_mac_82599EB:
4064 case ixgbe_mac_X540:
4065 reg = IXGBE_READ_REG(&ixgbe->hw, IXGBE_AUTOC);
4066 reg |= (IXGBE_AUTOC_FLU |
4067 IXGBE_AUTOC_10G_KX4);
4068 IXGBE_WRITE_REG(&ixgbe->hw, IXGBE_AUTOC, reg);
4069
4070 (void) ixgbe_setup_link(&ixgbe->hw, IXGBE_LINK_SPEED_10GB_FULL,
4071 B_TRUE);
4072 break;
4073
4074 default:
4075 break;
4076 }
4077 }
4078
4079 #pragma inline(ixgbe_intr_rx_work)
4080 /*
4081 * ixgbe_intr_rx_work - RX processing of ISR.
4082 */
4083 static void
4084 ixgbe_intr_rx_work(ixgbe_rx_ring_t *rx_ring)
4085 {
4086 mblk_t *mp;
4087
4088 mutex_enter(&rx_ring->rx_lock);
4089
4090 mp = ixgbe_ring_rx(rx_ring, IXGBE_POLL_NULL);
4091 mutex_exit(&rx_ring->rx_lock);
|