View | Details | Raw Unified | Return to bug 39977 | Differences between
and this patch

Collapse All | Expand All

(-)if_em.c (+77 lines)
Lines 143-148 Link Here
143
static int em_get_buf __P((struct em_rx_buffer *, struct adapter *,
143
static int em_get_buf __P((struct em_rx_buffer *, struct adapter *,
144
			   struct mbuf *));
144
			   struct mbuf *));
145
static void em_enable_vlans __P((struct adapter *adapter));
145
static void em_enable_vlans __P((struct adapter *adapter));
146
#ifdef DEVICE_POLLING
147
static poll_handler_t em_poll;
148
#endif /* DEVICE_POLLING */
146
149
147
/*********************************************************************
150
/*********************************************************************
148
 *  FreeBSD Device Interface Entry Points                    
151
 *  FreeBSD Device Interface Entry Points                    
Lines 631-636 Link Here
631
			em_set_multi(adapter);
634
			em_set_multi(adapter);
632
			if (adapter->hw.mac_type == em_82542_rev2_0)
635
			if (adapter->hw.mac_type == em_82542_rev2_0)
633
				em_initialize_receive_unit(adapter);
636
				em_initialize_receive_unit(adapter);
637
#ifdef DEVICE_POLLING
638
			if (ifp->if_ipending & IFF_POLLING)
639
				break;
640
			else
641
#endif /* DEVICE_POLLING */
634
			em_enable_intr(adapter);
642
			em_enable_intr(adapter);
635
		}
643
		}
636
		break;
644
		break;
Lines 919-924 Link Here
919
927
920
	adapter->timer_handle = timeout(em_local_timer, adapter, 2*hz);
928
	adapter->timer_handle = timeout(em_local_timer, adapter, 2*hz);
921
	em_clear_hw_cntrs(&adapter->hw);
929
	em_clear_hw_cntrs(&adapter->hw);
930
#ifdef DEVICE_POLLING
931
	if (ifp->if_ipending & IFF_POLLING)
932
		em_disable_intr(adapter);
933
	else
934
#endif /* DEVICE_POLLING */
922
	em_enable_intr(adapter);
935
	em_enable_intr(adapter);
923
936
924
	splx(s);
937
	splx(s);
Lines 951-956 Link Here
951
	/* Tell the stack that the interface is no longer active */
964
	/* Tell the stack that the interface is no longer active */
952
	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
965
	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
953
966
967
#ifdef DEVICE_POLLING
968
	ether_poll_deregister(ifp);
969
#endif /* DEVICE_POLLING */
970
954
	return;
971
	return;
955
}
972
}
956
973
Lines 970-975 Link Here
970
987
971
	ifp = &adapter->interface_data.ac_if;
988
	ifp = &adapter->interface_data.ac_if;
972
989
990
#ifdef DEVICE_POLLING
991
	if (ifp->if_ipending & IFF_POLLING)
992
		return;
993
994
	if (ether_poll_register(em_poll, ifp)) {
995
		em_disable_intr(adapter);
996
		em_poll(ifp, 0, 1);
997
		return;
998
	}
999
#endif /* DEVICE_POLLING */
1000
973
	em_disable_intr(adapter);
1001
	em_disable_intr(adapter);
974
	while (loop_cnt > 0 && 
1002
	while (loop_cnt > 0 && 
975
	       (reg_icr = E1000_READ_REG(&adapter->hw, ICR)) != 0) {
1003
	       (reg_icr = E1000_READ_REG(&adapter->hw, ICR)) != 0) {
Lines 1892-1897 Link Here
1892
	}
1920
	}
1893
1921
1894
	while (current_desc->status & E1000_RXD_STAT_DD) {
1922
	while (current_desc->status & E1000_RXD_STAT_DD) {
1923
#ifdef DEVICE_POLLING
1924
		if (ifp->if_ipending & IFF_POLLING) {
1925
			if (adapter->rxcycles <= 0)
1926
				break;
1927
			adapter->rxcycles--;
1928
		}
1929
#endif /* DEVICE_POLLING */
1895
1930
1896
		/* Get a pointer to the actual receive buffer */
1931
		/* Get a pointer to the actual receive buffer */
1897
		rx_buffer = STAILQ_FIRST(&adapter->rx_buffer_list);
1932
		rx_buffer = STAILQ_FIRST(&adapter->rx_buffer_list);
Lines 2366-2368 Link Here
2366
	return;
2401
	return;
2367
}
2402
}
2368
2403
2404
#ifdef DEVICE_POLLING
2405
static void
2406
em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
2407
{
2408
	struct adapter	*adapter = ifp->if_softc;
2409
	u_int32_t	loop_cnt = EM_MAX_INTR;
2410
	u_int32_t	reg_icr;
2411
2412
	if (cmd == POLL_DEREGISTER) {
2413
		em_enable_intr(adapter);
2414
		return;
2415
	}
2416
2417
	adapter->rxcycles = count;
2418
	em_process_receive_interrupts(adapter);
2419
	em_clean_transmit_interrupts(adapter);
2420
	if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL)
2421
		em_start(ifp);
2422
2423
	if (cmd == POLL_AND_CHECK_STATUS) {
2424
		while (loop_cnt > 0 && (reg_icr = E1000_READ_REG(&adapter->hw,
2425
		    ICR)) != 0) {
2426
			/* Link status change */
2427
			if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
2428
				untimeout(em_local_timer, adapter,
2429
				    adapter->timer_handle);
2430
				adapter->hw.get_link_status = 1;
2431
				em_check_for_link(&adapter->hw);
2432
				em_print_link_status(adapter);
2433
				adapter->timer_handle = timeout(em_local_timer,
2434
				    adapter, 2*hz);
2435
			}
2436
2437
			if (ifp->if_flags & IFF_RUNNING) {
2438
				em_process_receive_interrupts(adapter);
2439
				em_clean_transmit_interrupts(adapter);
2440
			}
2441
			loop_cnt--;
2442
		}
2443
	}
2444
}
2445
#endif /* DEVICE_POLLING */
(-)if_em.h (+4 lines)
Lines 245-250 Link Here
245
#endif
245
#endif
246
246
247
	struct em_hw_stats stats;
247
	struct em_hw_stats stats;
248
249
#ifdef DEVICE_POLLING
250
	int		rxcycles;
251
#endif /* DEVICE_POLLING */
248
};
252
};
249
253
250
#endif                                                  /* _EM_H_DEFINED_ */
254
#endif                                                  /* _EM_H_DEFINED_ */

Return to bug 39977