From patchwork Mon Dec 13 14:43:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changli Gao X-Patchwork-Id: 75363 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4C0D4B6F11 for ; Tue, 14 Dec 2010 01:44:48 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754533Ab0LMOon (ORCPT ); Mon, 13 Dec 2010 09:44:43 -0500 Received: from mail-yw0-f46.google.com ([209.85.213.46]:38554 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754034Ab0LMOon (ORCPT ); Mon, 13 Dec 2010 09:44:43 -0500 Received: by ywl5 with SMTP id 5so3286033ywl.19 for ; Mon, 13 Dec 2010 06:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=N08W8ufYRNMtgMNqp2c3ho9WSHk68Z0y7hPlhGiK/ro=; b=czFffjG8e2VzltkbHzyuaZIzuRDxfCPnjH2vjCgYkTbAsGqEmb6JvltltUnvVmR7dS dJxBBl/fx6NNiAqNe57aaOegCZKlWwFfUBwvBkOA+eRIookYN4/GLe0PMPgOQlDFNqs4 l2hRptBsDYA+B1GjUWs0gEN0xC6t2QKs7OIeM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=jtXagG6rVgBuT3MUvTFRrQqJnng/qKLz6O0S3/Mxc9UNxiUzv3A69zmcGy6kRCxRvy ncraPfFCelsfWkgy8ccrrLRTnu1j7zPjZ2hsr+ct5kvyp/rU5tDkU+IB5yy0SBH2mZRf 2ih2cj9hY/ztrjvh8LWL2tYVRgUqD9lfbLSBc= Received: by 10.150.217.4 with SMTP id p4mr5433958ybg.371.1292251482538; Mon, 13 Dec 2010 06:44:42 -0800 (PST) Received: from localhost.localdomain ([221.239.34.230]) by mx.google.com with ESMTPS id l4sm2520938ybj.21.2010.12.13.06.44.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 13 Dec 2010 06:44:41 -0800 (PST) From: Changli Gao To: Jamal Hadi Salim Cc: "David S. Miller" , Jamal Hadi Salim , netdev@vger.kernel.org, Changli Gao Subject: [PATCH 5/5] net: add skb.old_queue_mapping Date: Mon, 13 Dec 2010 22:43:34 +0800 Message-Id: <1292251414-5154-5-git-send-email-xiaosuo@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1292251414-5154-1-git-send-email-xiaosuo@gmail.com> References: <1292251414-5154-1-git-send-email-xiaosuo@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For the skbs returned from ifb, we should use the queue_mapping saved before ifb. We save old queue_mapping in old_queue_mapping just before calling dev_queue_xmit, and restore the old_queue_mapping to queue_mapping just before reinjecting the skb. dev_pick_tx() use the current queue_mapping for the skbs reinjected by ifb. Signed-off-by: Changli Gao --- drivers/net/ifb.c | 1 + include/linux/skbuff.h | 3 +++ net/core/dev.c | 5 +++++ net/sched/act_mirred.c | 1 + 4 files changed, 10 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 16c767b..481e4b1 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -95,6 +95,7 @@ static void ri_tasklet(unsigned long _dev) u64_stats_update_end(&qp->syncp); skb->skb_iif = dev->ifindex; + skb->queue_mapping = skb->old_queue_mapping; if (from & AT_EGRESS) { dev_queue_xmit(skb); } else if (from & AT_INGRESS) { diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 19f37a6..2ce2a96 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -403,6 +403,9 @@ struct sk_buff { }; __u16 vlan_tci; +#ifdef CONFIG_NET_CLS_ACT + __u16 old_queue_mapping; +#endif sk_buff_data_t transport_header; sk_buff_data_t network_header; diff --git a/net/core/dev.c b/net/core/dev.c index d28b3a0..8e97cfd 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2190,6 +2190,11 @@ static struct netdev_queue *dev_pick_tx(struct net_device *dev, int queue_index; const struct net_device_ops *ops = dev->netdev_ops; +#ifdef CONFIG_NET_CLS_ACT + if (skb->tc_verd & TC_NCLS) + queue_index = skb_get_queue_mapping(skb); + else +#endif if (dev->real_num_tx_queues == 1) queue_index = 0; else if (ops->ndo_select_queue) { diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 0c311be..853eb30 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -197,6 +197,7 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, skb2->skb_iif = skb->dev->ifindex; skb2->dev = dev; + skb2->old_queue_mapping = skb->queue_mapping; dev_queue_xmit(skb2); err = 0;