Print this page
XXXX introduce drv_sectohz


4310                 e1000g_log(Adapter, CE_WARN,
4311                     "Invalid link settings. Setup link to "
4312                     "support autonegotiation with all link capabilities.");
4313                 mac->autoneg = B_TRUE;
4314                 phy->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT;
4315         }
4316 
4317 out:
4318         return (e1000_setup_link(&Adapter->shared));
4319 }
4320 
4321 static void
4322 e1000g_timer_tx_resched(struct e1000g *Adapter)
4323 {
4324         e1000g_tx_ring_t *tx_ring = Adapter->tx_ring;
4325 
4326         rw_enter(&Adapter->chip_lock, RW_READER);
4327 
4328         if (tx_ring->resched_needed &&
4329             ((ddi_get_lbolt() - tx_ring->resched_timestamp) >
4330             drv_usectohz(1000000)) &&
4331             (Adapter->e1000g_state & E1000G_STARTED) &&
4332             (tx_ring->tbd_avail >= DEFAULT_TX_NO_RESOURCE)) {
4333                 tx_ring->resched_needed = B_FALSE;
4334                 mac_tx_update(Adapter->mh);
4335                 E1000G_STAT(tx_ring->stat_reschedule);
4336                 E1000G_STAT(tx_ring->stat_timer_reschedule);
4337         }
4338 
4339         rw_exit(&Adapter->chip_lock);
4340 }
4341 
4342 static void
4343 e1000g_local_timer(void *ws)
4344 {
4345         struct e1000g *Adapter = (struct e1000g *)ws;
4346         struct e1000_hw *hw;
4347         e1000g_ether_addr_t ether_addr;
4348         boolean_t link_changed;
4349 
4350         hw = &Adapter->shared;


4623 }
4624 
4625 /*
4626  * e1000g_mtu2maxframe - convert given MTU to maximum frame size
4627  */
4628 static uint32_t
4629 e1000g_mtu2maxframe(uint32_t mtu)
4630 {
4631         uint32_t maxframe;
4632 
4633         maxframe = mtu + sizeof (struct ether_vlan_header) + ETHERFCSL;
4634 
4635         return (maxframe);
4636 }
4637 
4638 static void
4639 arm_watchdog_timer(struct e1000g *Adapter)
4640 {
4641         Adapter->watchdog_tid =
4642             timeout(e1000g_local_timer,
4643             (void *)Adapter, 1 * drv_usectohz(1000000));
4644 }
4645 #pragma inline(arm_watchdog_timer)
4646 
4647 static void
4648 enable_watchdog_timer(struct e1000g *Adapter)
4649 {
4650         mutex_enter(&Adapter->watchdog_lock);
4651 
4652         if (!Adapter->watchdog_timer_enabled) {
4653                 Adapter->watchdog_timer_enabled = B_TRUE;
4654                 Adapter->watchdog_timer_started = B_TRUE;
4655                 arm_watchdog_timer(Adapter);
4656         }
4657 
4658         mutex_exit(&Adapter->watchdog_lock);
4659 }
4660 
4661 static void
4662 disable_watchdog_timer(struct e1000g *Adapter)
4663 {




4310                 e1000g_log(Adapter, CE_WARN,
4311                     "Invalid link settings. Setup link to "
4312                     "support autonegotiation with all link capabilities.");
4313                 mac->autoneg = B_TRUE;
4314                 phy->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT;
4315         }
4316 
4317 out:
4318         return (e1000_setup_link(&Adapter->shared));
4319 }
4320 
4321 static void
4322 e1000g_timer_tx_resched(struct e1000g *Adapter)
4323 {
4324         e1000g_tx_ring_t *tx_ring = Adapter->tx_ring;
4325 
4326         rw_enter(&Adapter->chip_lock, RW_READER);
4327 
4328         if (tx_ring->resched_needed &&
4329             ((ddi_get_lbolt() - tx_ring->resched_timestamp) >
4330             drv_sectohz(1)) &&
4331             (Adapter->e1000g_state & E1000G_STARTED) &&
4332             (tx_ring->tbd_avail >= DEFAULT_TX_NO_RESOURCE)) {
4333                 tx_ring->resched_needed = B_FALSE;
4334                 mac_tx_update(Adapter->mh);
4335                 E1000G_STAT(tx_ring->stat_reschedule);
4336                 E1000G_STAT(tx_ring->stat_timer_reschedule);
4337         }
4338 
4339         rw_exit(&Adapter->chip_lock);
4340 }
4341 
4342 static void
4343 e1000g_local_timer(void *ws)
4344 {
4345         struct e1000g *Adapter = (struct e1000g *)ws;
4346         struct e1000_hw *hw;
4347         e1000g_ether_addr_t ether_addr;
4348         boolean_t link_changed;
4349 
4350         hw = &Adapter->shared;


4623 }
4624 
4625 /*
4626  * e1000g_mtu2maxframe - convert given MTU to maximum frame size
4627  */
4628 static uint32_t
4629 e1000g_mtu2maxframe(uint32_t mtu)
4630 {
4631         uint32_t maxframe;
4632 
4633         maxframe = mtu + sizeof (struct ether_vlan_header) + ETHERFCSL;
4634 
4635         return (maxframe);
4636 }
4637 
4638 static void
4639 arm_watchdog_timer(struct e1000g *Adapter)
4640 {
4641         Adapter->watchdog_tid =
4642             timeout(e1000g_local_timer,
4643             (void *)Adapter, drv_sectohz(1));
4644 }
4645 #pragma inline(arm_watchdog_timer)
4646 
4647 static void
4648 enable_watchdog_timer(struct e1000g *Adapter)
4649 {
4650         mutex_enter(&Adapter->watchdog_lock);
4651 
4652         if (!Adapter->watchdog_timer_enabled) {
4653                 Adapter->watchdog_timer_enabled = B_TRUE;
4654                 Adapter->watchdog_timer_started = B_TRUE;
4655                 arm_watchdog_timer(Adapter);
4656         }
4657 
4658         mutex_exit(&Adapter->watchdog_lock);
4659 }
4660 
4661 static void
4662 disable_watchdog_timer(struct e1000g *Adapter)
4663 {