[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <412e6f7f0911140414x4918d8d2teb60ee585ebdfce9@mail.gmail.com>
Date: Sat, 14 Nov 2009 20:14:28 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH] check the return value of ndo_select_queue()
On Sat, Nov 14, 2009 at 3:54 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
>
>
> Please always use scripts/checkpatch.pl before sending patches
>
> } else if((select_queue = dev->netdev_ops->ndo_select_queue)) {
>
> A space is required after the "if"
>
Thanks.
> It seems to me this patch is not matching its ChangeLog :
>
> You moved the :
>
> if (sk && sk->sk_dst_cache)
> sk_tx_queue_set(sk, queue_index);
Maybe I did more in my patch, but I think these little changes doesn't
need separate patches.
>
> Why not using much readable patch like :
>
>
> [PATCH] check the return value of ndo_select_queue()
>
> check the return value of ndo_select_queue()
>
> Check the return value of ndo_select_queue(). If the value isn't smaller
> than the real_num_tx_queues, print a warning message, and reset it to zero.
>
> Signed-off-by: Changli Gao <xiaosuo@...il.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> ----
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index ad8e320..bbc9a41 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1845,6 +1845,20 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb)
> }
> EXPORT_SYMBOL(skb_tx_hash);
>
> +static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index)
> +{
> + if (unlikely(queue_index >= dev->real_num_tx_queues)) {
> + if (net_ratelimit()) {
> + WARN(1, "%s selects TX queue %d, but "
> + "real number of TX queues is %d\n",
> + dev->name, queue_index,
> + dev->real_num_tx_queues);
> + }
> + return 0;
> + }
> + return queue_index;
> +}
> +
> static struct netdev_queue *dev_pick_tx(struct net_device *dev,
> struct sk_buff *skb)
> {
> @@ -1858,6 +1872,7 @@ static struct netdev_queue *dev_pick_tx(struct net_device *dev,
>
> if (ops->ndo_select_queue) {
> queue_index = ops->ndo_select_queue(dev, skb);
> + queue_index = dev_cap_txqueue(dev, queue_index);
> } else {
> queue_index = 0;
> if (dev->real_num_tx_queues > 1)
>
>
>
It seems better than mime.
--
Regards,
Changli Gao(xiaosuo@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists