Skip to content

Commit

Permalink
Fix receive.
Browse files Browse the repository at this point in the history
Tx and Rx should be working. First succesful boot!
  • Loading branch information
Daniel Wyatt authored and Daniel Wyatt committed Jul 22, 2012
1 parent 45b22e5 commit b1e1b9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/drivers/net/bnx2.c
Expand Up @@ -742,7 +742,6 @@ static void bnx2_refill_rx ( struct bnx2_nic *bnx2 ) {
struct bnx2_rx_bd *rxbd;
struct io_buffer *iobuf;
unsigned int rx_idx;
unsigned int rx_tail;

while ( ( rxr->prod - rxr->cons ) < BNX2_RX_FILL ) {
iobuf = alloc_iob ( RX_BUF_SIZE );
Expand All @@ -754,7 +753,6 @@ static void bnx2_refill_rx ( struct bnx2_nic *bnx2 ) {
if ( ( ( rxr->prod - 1 ) & ( MAX_RX_DESC_CNT - 1 ) ) == ( MAX_RX_DESC_CNT - 1 ) )
rxr->prod++;

rx_tail = ( rxr->prod % RX_DESC_CNT );
rxbd = &rxr->desc[rx_idx];

memset ( iobuf->data, 0, RX_BUF_SIZE );
Expand All @@ -763,7 +761,7 @@ static void bnx2_refill_rx ( struct bnx2_nic *bnx2 ) {

bnx2->rx_iobuf[rx_idx] = iobuf;

writew ( rx_tail, bnx2->regs + MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BDIDX );
writew ( rxr->prod, bnx2->regs + MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BDIDX );
writel ( rxr->prod_bseq, bnx2->regs + MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BSEQ );
}
}
Expand Down Expand Up @@ -853,6 +851,9 @@ static void bnx2_poll_rx ( struct net_device *netdev ) {
int i;

rmb();
if ( ( hw_cons & MAX_RX_DESC_CNT ) == MAX_RX_DESC_CNT )
hw_cons++;

while ( rxr->cons != hw_cons ) {
rx_idx = ( rxr->cons % RX_DESC_CNT );
rxbd = &rxr->desc[rx_idx];
Expand All @@ -862,14 +863,14 @@ static void bnx2_poll_rx ( struct net_device *netdev ) {
hdr = ( struct l2_fhdr * ) iobuf->data;
iobuf->data += sizeof ( struct l2_fhdr ) + 2;
length = hdr->pkt_len - 4 + sizeof ( struct l2_fhdr ) + 2;

iob_put ( iobuf, length );
if ( hdr->errors )
netdev_rx_err ( netdev, iobuf, -EIO );
else
netdev_rx ( netdev, iobuf );

rxr->cons = NEXT_RX_BD ( rxr->cons );
//rxr->cons++;
}
}

Expand All @@ -880,7 +881,6 @@ static void bnx2_poll_rx ( struct net_device *netdev ) {
*/
static void bnx2_poll ( struct net_device *netdev ) {
struct bnx2_nic *bnx2 = netdev->priv;

bnx2_poll_tx ( netdev );
bnx2_poll_rx ( netdev );
bnx2_refill_rx ( bnx2 );
Expand Down

0 comments on commit b1e1b9f

Please sign in to comment.