Subject: Re: [PATCH net-next 4/4] be2net: Add a few inline functions to test TXQ conditions

From: Sergei Shtylyov <[email-masked]>
Date: Sun, 15 Feb 2015 15:37:49 +0300

Hello.

On 2/15/2015 10:45 AM, Sriharsha Basavapatna wrote:

> - Check qfull condition
> - Check qwake condition
> - Check pkts pending completion

> Signed-off-by: Sriharsha Basavapatna <[email-masked]>
> ---
>   drivers/net/ethernet/emulex/benet/be_main.c | 23 +++++++++++++++++++----
>   1 file changed, 19 insertions(+), 4 deletions(-)

> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
> index b37b099..028b093 100644
> --- a/drivers/net/ethernet/emulex/benet/be_main.c
> +++ b/drivers/net/ethernet/emulex/benet/be_main.c
> @@ -728,6 +728,22 @@ static u16 skb_ip_proto(struct sk_buff *skb)
>   		ip_hdr(skb)->protocol : ipv6_hdr(skb)->nexthdr;
>   }
>
> +static inline bool be_is_txq_full(struct be_tx_obj *txo)
> +{
> +	return ((atomic_read(&txo->q.used) + BE_MAX_TX_FRAG_COUNT) >=
> +		 txo->q.len);
> +}
> +
> +static inline bool be_can_txq_wake(struct be_tx_obj *txo)
> +{
> +	return (atomic_read(&txo->q.used) < txo->q.len / 2);
> +}
> +
> +static inline bool be_is_tx_compl_pending(struct be_tx_obj *txo)
> +{
> +	return (atomic_read(&txo->q.used) > txo->pend_wrb_cnt);
> +}
> +

    Parens not needed around the *return* expressions.

[...]

WBR, Sergei