Re: [PATCH v1] mv643xx_eth: only account for work done in rxq_process in poll callback.

From: Francois Romieu
Date: Wed Mar 04 2015 - 16:32:45 EST


Nicolas Schichan <nschichan@xxxxxxxxxx> :
[...]
> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index 1c75829..52bc56b 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
[...]
> @@ -1050,7 +1049,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
> __netif_tx_lock_bh(nq);
>
> reclaimed = 0;
> - while (reclaimed < budget && txq->tx_desc_count > 0) {
> + while (txq->tx_desc_count > 0) {
> int tx_index;
> struct tx_desc *desc;
> u32 cmd_sts;

You may use a local 'int count = txq->tx_desc_count' variable then
perform a single update at the end of the locked section.
txq->tx_used_desc could be reworked in a similar way.

> @@ -1105,8 +1104,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
>
> __netif_tx_unlock_bh(nq);
>
> - if (reclaimed < budget)
> - mp->work_tx &= ~(1 << txq->index);
> + mp->work_tx &= ~(1 << txq->index);
>
> return reclaimed;
> }

work_tx is also updated in irq context. I'd rather see "clear_flag() then
reclaim()" than "reclaim() then clear_flag()" in a subsequent patch.

--
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/