Changeset 2f11e6c9 in mainline


Ignore:
Timestamp:
2014-08-11T20:42:56Z (10 years ago)
Author:
Agnieszka Tabaka <nufcia@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2ff9876
Parents:
a41b691
Message:

Add proper TX busy handling, normalize log message levels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/rtl8169/driver.c

    ra41b691 r2f11e6c9  
    2727 */
    2828
    29 #define _DDF_DATA_IMPLANT
    30 
    3129#include <assert.h>
    3230#include <errno.h>
     
    439437        nic_set_ddf_fun(nic_data, fun);
    440438        ddf_fun_set_ops(fun, &rtl8169_dev_ops);
    441 //      ddf_fun_data_implant(fun, nic_data);
    442439
    443440        rc = ddf_fun_bind(fun);
     
    739736        pio_write_16(rtl8169->regs + RMS, BUFFER_SIZE);
    740737
    741         ddf_msg(LVL_NOTE, "RCR: 0x%08x", pio_read_32(rtl8169->regs + RCR));
    742 
    743 
    744738        pio_write_16(rtl8169->regs + IMR, 0xffff);
    745739        irc_enable_interrupt(rtl8169->irq);
     
    816810        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
    817811        rtl8169_descr_t *descr;
    818 
    819         ddf_msg(LVL_NOTE, "rtl8169_transmit_done()");
     812        int sent = 0;
     813
     814        ddf_msg(LVL_DEBUG, "rtl8169_transmit_done()");
    820815
    821816        fibril_mutex_lock(&rtl8169->tx_lock);
     
    828823                descr->control &= (~CONTROL_OWN);
    829824                write_barrier();
    830                 ddf_msg(LVL_NOTE, "TX status for descr %d: 0x%08x", tail, descr->control);
     825                ddf_msg(LVL_DEBUG, "TX status for descr %d: 0x%08x", tail, descr->control);
    831826       
    832827                tail = (tail + 1) % TX_BUFFERS_COUNT;
    833         }
     828                sent++;
     829        }
     830
     831        if (sent != 0)
     832                nic_set_tx_busy(nic_data, 0);
    834833
    835834        rtl8169->tx_tail = tail;
     
    849848        int frame_size;
    850849
    851         ddf_msg(LVL_NOTE, "rtl8169_receive_done()");
     850        ddf_msg(LVL_DEBUG, "rtl8169_receive_done()");
    852851
    853852        fibril_mutex_lock(&rtl8169->rx_lock);
     
    862861
    863862                if (descr->control & RXSTATUS_RES) {
    864                         ddf_msg(LVL_NOTE, "error at slot %d: 0x%08x\n", tail, descr->control);
     863                        ddf_msg(LVL_WARN, "error at slot %d: 0x%08x\n", tail, descr->control);
    865864                        tail = (tail + 1) % RX_BUFFERS_COUNT;
    866865                        continue;
     
    871870               
    872871                if (descr->control & CONTROL_LS) {
    873 
    874                         ddf_msg(LVL_NOTE, "received message at slot %d, control 0x%08x", tail, descr->control);
     872                        ddf_msg(LVL_DEBUG, "received message at slot %d, control 0x%08x", tail, descr->control);
    875873
    876874                        if (fsidx != tail)
     
    907905        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
    908906
    909         ddf_msg(LVL_NOTE, "rtl8169_irq_handler(): isr=0x%04x", isr);
     907        ddf_msg(LVL_DEBUG, "rtl8169_irq_handler(): isr=0x%04x", isr);
    910908        pio_write_16(rtl8169->regs + IMR, 0xffff);
    911909
     
    963961        fibril_mutex_lock(&rtl8169->tx_lock);
    964962
    965         ddf_msg(LVL_NOTE, "send_frame: size: %zu, tx_head=%d tx_tail=%d",
     963        ddf_msg(LVL_DEBUG, "send_frame: size: %zu, tx_head=%d tx_tail=%d",
    966964            size, rtl8169->tx_head, rtl8169->tx_tail);
    967965
     
    986984        prev = &rtl8169->tx_ring[(head - 1) % TX_BUFFERS_COUNT];
    987985
    988         ddf_msg(LVL_NOTE, "current_descr=%p, prev_descr=%p", descr, prev);
     986        ddf_msg(LVL_DEBUG, "current_descr=%p, prev_descr=%p", descr, prev);
    989987
    990988        descr->control = CONTROL_OWN | CONTROL_FS | CONTROL_LS;
Note: See TracChangeset for help on using the changeset viewer.