|
Lines 143-148
Link Here
|
| 143 |
static int em_get_buf(struct em_rx_buffer *, struct adapter *, |
143 |
static int em_get_buf(struct em_rx_buffer *, struct adapter *, |
| 144 |
struct mbuf *); |
144 |
struct mbuf *); |
| 145 |
static void em_enable_vlans(struct adapter *adapter); |
145 |
static void em_enable_vlans(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 */ |
| 954 |
return; |
970 |
return; |
| 955 |
} |
971 |
} |
| 956 |
|
972 |
|
|
Lines 970-975
Link Here
|
| 970 |
|
986 |
|
| 971 |
ifp = &adapter->interface_data.ac_if; |
987 |
ifp = &adapter->interface_data.ac_if; |
| 972 |
|
988 |
|
|
|
989 |
#ifdef DEVICE_POLLING |
| 990 |
if (ifp->if_ipending & IFF_POLLING) |
| 991 |
return; |
| 992 |
|
| 993 |
if (ether_poll_register(em_poll, ifp)) { |
| 994 |
em_disable_intr(adapter); |
| 995 |
em_poll(ifp, 0, 1); |
| 996 |
return; |
| 997 |
} |
| 998 |
#endif /* DEVICE_POLLING */ |
| 999 |
|
| 973 |
em_disable_intr(adapter); |
1000 |
em_disable_intr(adapter); |
| 974 |
while (loop_cnt > 0 && |
1001 |
while (loop_cnt > 0 && |
| 975 |
(reg_icr = E1000_READ_REG(&adapter->hw, ICR)) != 0) { |
1002 |
(reg_icr = E1000_READ_REG(&adapter->hw, ICR)) != 0) { |
|
Lines 1892-1897
Link Here
|
| 1892 |
} |
1919 |
} |
| 1893 |
|
1920 |
|
| 1894 |
while (current_desc->status & E1000_RXD_STAT_DD) { |
1921 |
while (current_desc->status & E1000_RXD_STAT_DD) { |
|
|
1922 |
#ifdef DEVICE_POLLING |
| 1923 |
if (ifp->if_ipending & IFF_POLLING) { |
| 1924 |
if (adapter->rxcycles <= 0) |
| 1925 |
break; |
| 1926 |
adapter->rxcycles--; |
| 1927 |
} |
| 1928 |
#endif /* DEVICE_POLLING */ |
| 1895 |
|
1929 |
|
| 1896 |
/* Get a pointer to the actual receive buffer */ |
1930 |
/* Get a pointer to the actual receive buffer */ |
| 1897 |
rx_buffer = STAILQ_FIRST(&adapter->rx_buffer_list); |
1931 |
rx_buffer = STAILQ_FIRST(&adapter->rx_buffer_list); |
|
Lines 2366-2368
Link Here
|
| 2366 |
return; |
2400 |
return; |
| 2367 |
} |
2401 |
} |
| 2368 |
|
2402 |
|
|
|
2403 |
#ifdef DEVICE_POLLING |
| 2404 |
static void |
| 2405 |
em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) |
| 2406 |
{ |
| 2407 |
struct adapter *adapter = ifp->if_softc; |
| 2408 |
u_int32_t loop_cnt = EM_MAX_INTR; |
| 2409 |
u_int32_t reg_icr; |
| 2410 |
|
| 2411 |
if (cmd == POLL_DEREGISTER) { |
| 2412 |
em_enable_intr(adapter); |
| 2413 |
return; |
| 2414 |
} |
| 2415 |
|
| 2416 |
adapter->rxcycles = count; |
| 2417 |
em_process_receive_interrupts(adapter); |
| 2418 |
em_clean_transmit_interrupts(adapter); |
| 2419 |
if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL) |
| 2420 |
em_start(ifp); |
| 2421 |
|
| 2422 |
if (cmd == POLL_AND_CHECK_STATUS) { |
| 2423 |
while (loop_cnt > 0 && (reg_icr = E1000_READ_REG(&adapter->hw, |
| 2424 |
ICR)) != 0) { |
| 2425 |
/* Link status change */ |
| 2426 |
if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { |
| 2427 |
untimeout(em_local_timer, adapter, |
| 2428 |
adapter->timer_handle); |
| 2429 |
adapter->hw.get_link_status = 1; |
| 2430 |
em_check_for_link(&adapter->hw); |
| 2431 |
em_print_link_status(adapter); |
| 2432 |
adapter->timer_handle = timeout(em_local_timer, |
| 2433 |
adapter, 2*hz); |
| 2434 |
} |
| 2435 |
|
| 2436 |
if (ifp->if_flags & IFF_RUNNING) { |
| 2437 |
em_process_receive_interrupts(adapter); |
| 2438 |
em_clean_transmit_interrupts(adapter); |
| 2439 |
} |
| 2440 |
loop_cnt--; |
| 2441 |
} |
| 2442 |
} |
| 2443 |
} |
| 2444 |
#endif /* DEVICE_POLLING */ |