mirror of https://github.com/ipxe/ipxe.git
[pxe] Update UNDI transmit count before transmitting packet
It is possible that the UNDI ISR may be triggered before netdev_tx() returns control to pxenv_undi_transmit(). This means that pxenv_undi_isr() may see a zero undi_tx_count, and so not check for TX completions. This is not a significant problem, since it will check for TX completions on the next call to pxenv_undi_isr() anyway; it just means that the NBP will see a spurious IRQ that was apparently caused by nothing. Fix by updating the undi_tx_count before calling netdev_tx(), so that pxenv_undi_isr() can decrement it and report the TX completion.pull/1/head
parent
f186ada2d3
commit
c26a38b313
|
@ -316,18 +316,22 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Flag transmission as in-progress. Do this before starting
|
||||||
|
* to transmit the packet, because the ISR may trigger before
|
||||||
|
* we return from netdev_tx().
|
||||||
|
*/
|
||||||
|
undi_tx_count++;
|
||||||
|
|
||||||
/* Transmit packet */
|
/* Transmit packet */
|
||||||
DBG2 ( "\n" ); /* ISR may trigger before we return from netdev_tx() */
|
DBG2 ( "\n" );
|
||||||
if ( ( rc = netdev_tx ( pxe_netdev, iobuf ) ) != 0 ) {
|
if ( ( rc = netdev_tx ( pxe_netdev, iobuf ) ) != 0 ) {
|
||||||
DBG2 ( "PXENV_UNDI_TRANSMIT could not transmit: %s\n",
|
DBG2 ( "PXENV_UNDI_TRANSMIT could not transmit: %s\n",
|
||||||
strerror ( rc ) );
|
strerror ( rc ) );
|
||||||
|
undi_tx_count--;
|
||||||
undi_transmit->Status = PXENV_STATUS ( rc );
|
undi_transmit->Status = PXENV_STATUS ( rc );
|
||||||
return PXENV_EXIT_FAILURE;
|
return PXENV_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flag transmission as in-progress */
|
|
||||||
undi_tx_count++;
|
|
||||||
|
|
||||||
undi_transmit->Status = PXENV_STATUS_SUCCESS;
|
undi_transmit->Status = PXENV_STATUS_SUCCESS;
|
||||||
return PXENV_EXIT_SUCCESS;
|
return PXENV_EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue