From: Eric Dumazet <eric.dumazet@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Ben Greear <greearb@candelatech.com>,
NetDev <netdev@vger.kernel.org>,
robert@herjulf.net, "David S. Miller" <davem@davemloft.net>
Subject: Re: pktgen and spin_lock_bh in xmit path
Date: Tue, 20 Oct 2009 20:54:40 +0200 [thread overview]
Message-ID: <4ADE0770.8060708@gmail.com> (raw)
In-Reply-To: <4ADE0306.6060101@gmail.com>
Eric Dumazet a écrit :
> David, we are changing skb->mapping while transmitting it...
>
> So yes, it can break pktgen if its skbs are cloned.
>
> Maybe pktgen should call skb_record_rx_queue() instead of skb_set_queue_mapping()
>
> Or maybe we should avoid this +/- 1 thing we do in skb_record_rx_queue(), since
> we use same skb field for recording rx_queue or tx_queue :(
>
A possible fix would be :
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 86acdba..bbe4b2d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2554,7 +2554,6 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
__be16 *vlan_encapsulated_proto = NULL; /* packet type ID field (or len) for VLAN tag */
__be16 *svlan_tci = NULL; /* Encapsulates priority and SVLAN ID */
__be16 *svlan_encapsulated_proto = NULL; /* packet type ID field (or len) for SVLAN tag */
- u16 queue_map;
if (pkt_dev->nr_labels)
protocol = htons(ETH_P_MPLS_UC);
@@ -2565,7 +2564,6 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
/* Update any of the values, used when we're incrementing various
* fields.
*/
- queue_map = pkt_dev->cur_queue_map;
mod_cur_headers(pkt_dev);
datalen = (odev->hard_header_len + 16) & ~0xf;
@@ -2605,7 +2603,6 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
skb->network_header = skb->tail;
skb->transport_header = skb->network_header + sizeof(struct iphdr);
skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr));
- skb_set_queue_mapping(skb, queue_map);
iph = ip_hdr(skb);
udph = udp_hdr(skb);
@@ -2896,7 +2893,6 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
__be16 *vlan_encapsulated_proto = NULL; /* packet type ID field (or len) for VLAN tag */
__be16 *svlan_tci = NULL; /* Encapsulates priority and SVLAN ID */
__be16 *svlan_encapsulated_proto = NULL; /* packet type ID field (or len) for SVLAN tag */
- u16 queue_map;
if (pkt_dev->nr_labels)
protocol = htons(ETH_P_MPLS_UC);
@@ -2907,7 +2903,6 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
/* Update any of the values, used when we're incrementing various
* fields.
*/
- queue_map = pkt_dev->cur_queue_map;
mod_cur_headers(pkt_dev);
skb = __netdev_alloc_skb(odev,
@@ -2946,7 +2941,6 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
skb->network_header = skb->tail;
skb->transport_header = skb->network_header + sizeof(struct ipv6hdr);
skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr));
- skb_set_queue_mapping(skb, queue_map);
iph = ipv6_hdr(skb);
udph = udp_hdr(skb);
@@ -3437,7 +3431,13 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
if (pkt_dev->delay && pkt_dev->last_ok)
spin(pkt_dev, pkt_dev->next_tx);
- queue_map = skb_get_queue_mapping(pkt_dev->skb);
+ queue_map = pkt_dev->cur_queue_map;
+ /*
+ * tells skb_tx_hash() to use this tx queue.
+ * We should reset skb->mapping before each xmit() because
+ * xmit() might change it.
+ */
+ skb_record_rx_queue(pkt_dev->skb, queue_map);
txq = netdev_get_tx_queue(odev, queue_map);
__netif_tx_lock_bh(txq);
next prev parent reply other threads:[~2009-10-20 18:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-20 3:38 pktgen and spin_lock_bh in xmit path Ben Greear
2009-10-20 3:48 ` Eric Dumazet
2009-10-20 4:52 ` Ben Greear
2009-10-20 17:37 ` Ben Greear
2009-10-20 17:44 ` Eric Dumazet
2009-10-20 17:54 ` Ben Greear
2009-10-20 18:35 ` Eric Dumazet
2009-10-20 18:54 ` Eric Dumazet [this message]
2009-10-20 20:16 ` Ben Greear
2009-10-20 21:10 ` Ben Greear
2009-10-20 21:22 ` Eric Dumazet
2009-10-20 21:30 ` Ben Greear
2009-10-20 21:57 ` Eric Dumazet
2009-10-20 23:17 ` Ben Greear
2009-10-21 3:05 ` Ben Greear
2009-10-21 3:12 ` Eric Dumazet
2009-10-21 3:59 ` Eric Dumazet
2009-10-21 5:00 ` Ben Greear
2009-10-21 5:14 ` Eric Dumazet
2009-10-21 5:40 ` Ben Greear
2009-10-21 5:12 ` Krishna Kumar2
2009-10-21 5:32 ` Ben Greear
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ADE0770.8060708@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=greearb@candelatech.com \
--cc=netdev@vger.kernel.org \
--cc=robert@herjulf.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.