mq: preserve queue mapping with bonding and VLAN devices
Subsystems (2)
PATCH 2/2 mq: preserve queue mapping with bonding and VLAN devices
Forwarded packet goes through dev_queue_xmit() more that once when using bonding or 802.1q VLAN devices, so we've lost rx-tx queue mapping index for real devices. This is because initial queue index value (as it recorded by skb_record_tx_queue()) is overwritten by skb_set_queue_mapping().
---
drivers/net/bnx2.c | 2 +- drivers/net/bnx2x_main.c | 2 +- drivers/net/gianfar.c | 6 +++--- drivers/net/igb/igb_main.c | 2 +- drivers/net/ixgbe/ixgbe_main.c | 6 +++--- drivers/net/mlx4/en_tx.c | 2 +- drivers/net/niu.c | 2 +- drivers/net/qlge/qlge_main.c | 2 +- drivers/net/s2io.c | 2 +- include/linux/skbuff.h | 14 ++------------ net/core/dev.c | 2 +- 11 files changed, 16 insertions(+), 26 deletions(-)
drivers/net/bnx2.c +1 -1
@@ -3199,7 +3199,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) skb->ip_summed =CHECKSUM_UNNECESSARY ; } -skb_record_rx_queue (skb, bnapi - &bp->bnx2_napi[0 ]); +skb_set_queue_mapping (skb, bnapi - &bp->bnx2_napi[0 ]);#ifdef BCM_VLAN if (hw_vlan)
drivers/net/bnx2x_main.c +1 -1
@@ -1681,7 +1681,7 @@ reuse_rx: } } -skb_record_rx_queue (skb, fp->index); +skb_set_queue_mapping (skb, fp->index);#ifdef BCM_VLAN if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
drivers/net/gianfar.c +3 -3
@@ -1934,7 +1934,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)unsigned int nr_frags, length; - rq = skb->queue_mapping; + rq =skb_get_queue_mapping (skb); tx_queue = priv->tx_queue[rq]; txq =netdev_get_tx_queue (dev, rq); base = tx_queue->tx_bd_base;
@@ -2466,7 +2466,7 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,/* Remove the FCB from the skb */ /* Remove the padded bytes, if there are any */ if (amount_pull) { -skb_record_rx_queue (skb, fcb->rq); +skb_set_queue_mapping (skb, fcb->rq);skb_pull (skb, amount_pull); }
@@ -2549,7 +2549,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)/* Remove the FCS from the packet length */ skb_put (skb, pkt_len); rx_queue->stats.rx_bytes += pkt_len; -skb_record_rx_queue (skb, rx_queue->qindex); +skb_set_queue_mapping (skb, rx_queue->qindex);gfar_process_frame (dev, skb, amount_pull); }else {
drivers/net/igb/igb_main.c +1 -1
@@ -3838,7 +3838,7 @@ static netdev_tx_t igb_xmit_frame_adv(struct sk_buff *skb,return NETDEV_TX_OK ; } - r_idx = skb->queue_mapping & (IGB_ABS_MAX_TX_QUEUES -1 ); + r_idx =skb_get_queue_mapping (skb) & (IGB_ABS_MAX_TX_QUEUES -1 ); tx_ring = adapter->multi_tx_table[r_idx];/* This goes back to the question of how to logically map a tx queue
drivers/net/ixgbe/ixgbe_main.c +3 -3
@@ -5668,17 +5668,17 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, tx_flags |=vlan_tx_tag_get (skb);if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { tx_flags &= ~IXGBE_TX_FLAGS_VLAN_PRIO_MASK ; - tx_flags |= ((skb->queue_mapping &0x7 ) <<13 ); + tx_flags |= ((skb_get_queue_mapping (skb) &0x7 ) <<13 ); } tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; tx_flags |=IXGBE_TX_FLAGS_VLAN ; }else if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { - tx_flags |= ((skb->queue_mapping &0x7 ) <<13 ); + tx_flags |= ((skb_get_queue_mapping (skb) &0x7 ) <<13 ); tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; tx_flags |=IXGBE_TX_FLAGS_VLAN ; } - tx_ring = adapter->tx_ring[skb->queue_mapping]; + tx_ring = adapter->tx_ring[skb_get_queue_mapping (skb)];if ((adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) && (skb->protocol ==htons (ETH_P_FCOE ))) {
drivers/net/mlx4/en_tx.c +1 -1
@@ -624,7 +624,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) goto tx_drop; } - tx_ind = skb->queue_mapping; + tx_ind =skb_get_queue_mapping (skb); ring = &priv->tx_ring[tx_ind];if (priv->vlgrp &&vlan_tx_tag_present (skb)) vlan_tag =vlan_tx_tag_get (skb);
drivers/net/niu.c +1 -1
@@ -3516,7 +3516,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, rp->rx_bytes += skb->len; skb->protocol =eth_type_trans (skb, np->dev); -skb_record_rx_queue (skb, rp->rx_channel); +skb_set_queue_mapping (skb, rp->rx_channel);napi_gro_receive (napi, skb);return num_rcr;
drivers/net/qlge/qlge_main.c +1 -1
@@ -2525,7 +2525,7 @@ static netdev_tx_t qlge_send(struct sk_buff *skb, struct net_device *ndev)struct ql_adapter *qdev =netdev_priv (ndev);int tso;struct tx_ring *tx_ring; -u32 tx_ring_idx = (u32 ) skb->queue_mapping; +u32 tx_ring_idx = (u32 )skb_get_queue_mapping (skb); tx_ring = &qdev->tx_ring[tx_ring_idx];
drivers/net/s2io.c +1 -1
@@ -7549,7 +7549,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) swstats->mem_freed += skb->truesize; send_up: -skb_record_rx_queue (skb, ring_no); +skb_set_queue_mapping (skb, ring_no);queue_rx_frame (skb,RXD_GET_VLAN_TAG (rxdp->Control_2)); aggregate: sp->mac_control.rings[ring_no].rx_bufs_left -=1 ;
include/linux/skbuff.h +2 -12
@@ -2014,12 +2014,12 @@ static inline void skb_init_secmark(struct sk_buff *skb)static inline void skb_set_queue_mapping (struct sk_buff *skb,u16 queue_mapping) { - skb->queue_mapping = queue_mapping; + skb->queue_mapping = queue_mapping +1 ; }static inline u16 skb_get_queue_mapping (const struct sk_buff *skb) { -return skb->queue_mapping; +return skb_rx_queue_recorded (skb) ? skb->queue_mapping -1 :0 ; }static inline void skb_copy_queue_mapping (struct sk_buff *to,const struct sk_buff *from)
@@ -2027,16 +2027,6 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu to->queue_mapping = from->queue_mapping; } -static inline void skb_record_rx_queue (struct sk_buff *skb,u16 rx_queue) -{ - skb->queue_mapping = rx_queue +1 ; -} - -static inline u16 skb_get_rx_queue (const struct sk_buff *skb) -{ -return skb->queue_mapping -1 ; -} -static inline bool skb_rx_queue_recorded (const struct sk_buff *skb) {return (skb->queue_mapping !=0 );
net/core/dev.c +1 -1
@@ -1938,7 +1938,7 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb)u32 hash;if (skb_rx_queue_recorded (skb)) { - hash =skb_get_rx_queue (skb); + hash = skb->queue_mapping -1 ;while (unlikely (hash >= dev->real_num_tx_queues)) hash -= dev->real_num_tx_queues;return hash;
---
Signature · 1 line
wbr, Oleg.
From: "\"Oleg A. Arkhangelsky\"" <[email protected]>
Date: Sat, 27 Feb 2010 16:28:52 +0300
Quoted 7 lines
Forwarded packet goes through
dev_queue_xmit()more that once when using bonding or 802.1q VLAN devices, so we've lost rx-tx queue mapping index for real devices. This is because initial queue index value (as it recorded byskb_record_tx_queue()) is overwritten byskb_set_queue_mapping().Signed-off-by Oleg A. Arkhangelsky <[email protected]>
Applied, thanks Oleg.
Patch #1 still needs work, please address Eric Dumazet's feedback.
Thanks!
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Sun, 28 Feb 2010 01:33:11 -0800 (PST)
Quoted 1 line
Applied, thanks Oleg.
Nevermind, this patch doesn't even build :-/ I'm reverting.
In file included from include/linux/netfilter.h:6,
from include/net/netns/x_tables.h:5,
from include/net/net_namespace.h:18,
from include/linux/init_task.h:13,
from arch/sparc/kernel/init_task.c:5:include/linux/skbuff.h: In function ‘skb_get_queue_mapping’:include/linux/skbuff.h:2022: error: implicit declaration of function ‘skb_rx_queue_recorded’ include/linux/skbuff.h: At top level:include/linux/skbuff.h:2030: error: conflicting types for ‘skb_rx_queue_recorded’ include/linux/skbuff.h:2022: note: previous implicit declaration of ‘skb_rx_queue_recorded’ was here
Quoted 7 lines
In file included from
include/linux/netfilter.h:6,
frominclude/net/netns/x_tables.h:5,
frominclude/net/net_namespace.h:18,
frominclude/linux/init_task.h:13,
fromarch/sparc/kernel/init_task.c:5:
include/linux/skbuff.h: In function ‘skb_get_queue_mapping’:
include/linux/skbuff.h:2022: error: implicit declaration of function ‘skb_rx_queue_recorded’
Silly me. :( Corrected.
---
Forwarded packet goes through dev_queue_xmit() more that once when using bonding or 802.1q VLAN devices, so we've lost rx-tx queue mapping index for real devices. This is because initial queue index value (as it recorded by skb_record_tx_queue()) is overwritten by skb_set_queue_mapping().
---
drivers/net/bnx2.c | 2 +- drivers/net/bnx2x_main.c | 2 +- drivers/net/gianfar.c | 6 +++--- drivers/net/igb/igb_main.c | 2 +- drivers/net/ixgbe/ixgbe_main.c | 6 +++--- drivers/net/mlx4/en_tx.c | 2 +- drivers/net/niu.c | 2 +- drivers/net/qlge/qlge_main.c | 2 +- drivers/net/s2io.c | 2 +- include/linux/skbuff.h | 24 +++++++----------------- net/core/dev.c | 2 +- 11 files changed, 21 insertions(+), 31 deletions(-)
drivers/net/bnx2.c +1 -1
@@ -3199,7 +3199,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) skb->ip_summed =CHECKSUM_UNNECESSARY ; } -skb_record_rx_queue (skb, bnapi - &bp->bnx2_napi[0 ]); +skb_set_queue_mapping (skb, bnapi - &bp->bnx2_napi[0 ]);#ifdef BCM_VLAN if (hw_vlan)
drivers/net/bnx2x_main.c +1 -1
@@ -1681,7 +1681,7 @@ reuse_rx: } } -skb_record_rx_queue (skb, fp->index); +skb_set_queue_mapping (skb, fp->index);#ifdef BCM_VLAN if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
drivers/net/gianfar.c +3 -3
@@ -1934,7 +1934,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)unsigned int nr_frags, length; - rq = skb->queue_mapping; + rq =skb_get_queue_mapping (skb); tx_queue = priv->tx_queue[rq]; txq =netdev_get_tx_queue (dev, rq); base = tx_queue->tx_bd_base;
@@ -2466,7 +2466,7 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,/* Remove the FCB from the skb */ /* Remove the padded bytes, if there are any */ if (amount_pull) { -skb_record_rx_queue (skb, fcb->rq); +skb_set_queue_mapping (skb, fcb->rq);skb_pull (skb, amount_pull); }
@@ -2549,7 +2549,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)/* Remove the FCS from the packet length */ skb_put (skb, pkt_len); rx_queue->stats.rx_bytes += pkt_len; -skb_record_rx_queue (skb, rx_queue->qindex); +skb_set_queue_mapping (skb, rx_queue->qindex);gfar_process_frame (dev, skb, amount_pull); }else {
drivers/net/igb/igb_main.c +1 -1
@@ -3838,7 +3838,7 @@ static netdev_tx_t igb_xmit_frame_adv(struct sk_buff *skb,return NETDEV_TX_OK ; } - r_idx = skb->queue_mapping & (IGB_ABS_MAX_TX_QUEUES -1 ); + r_idx =skb_get_queue_mapping (skb) & (IGB_ABS_MAX_TX_QUEUES -1 ); tx_ring = adapter->multi_tx_table[r_idx];/* This goes back to the question of how to logically map a tx queue
drivers/net/ixgbe/ixgbe_main.c +3 -3
@@ -5668,17 +5668,17 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, tx_flags |=vlan_tx_tag_get (skb);if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { tx_flags &= ~IXGBE_TX_FLAGS_VLAN_PRIO_MASK ; - tx_flags |= ((skb->queue_mapping &0x7 ) <<13 ); + tx_flags |= ((skb_get_queue_mapping (skb) &0x7 ) <<13 ); } tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; tx_flags |=IXGBE_TX_FLAGS_VLAN ; }else if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { - tx_flags |= ((skb->queue_mapping &0x7 ) <<13 ); + tx_flags |= ((skb_get_queue_mapping (skb) &0x7 ) <<13 ); tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; tx_flags |=IXGBE_TX_FLAGS_VLAN ; } - tx_ring = adapter->tx_ring[skb->queue_mapping]; + tx_ring = adapter->tx_ring[skb_get_queue_mapping (skb)];if ((adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) && (skb->protocol ==htons (ETH_P_FCOE ))) {
drivers/net/mlx4/en_tx.c +1 -1
@@ -624,7 +624,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) goto tx_drop; } - tx_ind = skb->queue_mapping; + tx_ind =skb_get_queue_mapping (skb); ring = &priv->tx_ring[tx_ind];if (priv->vlgrp &&vlan_tx_tag_present (skb)) vlan_tag =vlan_tx_tag_get (skb);
drivers/net/niu.c +1 -1
@@ -3516,7 +3516,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, rp->rx_bytes += skb->len; skb->protocol =eth_type_trans (skb, np->dev); -skb_record_rx_queue (skb, rp->rx_channel); +skb_set_queue_mapping (skb, rp->rx_channel);napi_gro_receive (napi, skb);return num_rcr;
drivers/net/qlge/qlge_main.c +1 -1
@@ -2525,7 +2525,7 @@ static netdev_tx_t qlge_send(struct sk_buff *skb, struct net_device *ndev)struct ql_adapter *qdev =netdev_priv (ndev);int tso;struct tx_ring *tx_ring; -u32 tx_ring_idx = (u32 ) skb->queue_mapping; +u32 tx_ring_idx = (u32 )skb_get_queue_mapping (skb); tx_ring = &qdev->tx_ring[tx_ring_idx];
drivers/net/s2io.c +1 -1
@@ -7549,7 +7549,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) swstats->mem_freed += skb->truesize; send_up: -skb_record_rx_queue (skb, ring_no); +skb_set_queue_mapping (skb, ring_no);queue_rx_frame (skb,RXD_GET_VLAN_TAG (rxdp->Control_2)); aggregate: sp->mac_control.rings[ring_no].rx_bufs_left -=1 ;
include/linux/skbuff.h +7 -17
@@ -2012,14 +2012,19 @@ static inline void skb_init_secmark(struct sk_buff *skb) { }#endif +static inline bool skb_rx_queue_recorded (const struct sk_buff *skb) +{ +return (skb->queue_mapping !=0 ); +} +static inline void skb_set_queue_mapping (struct sk_buff *skb,u16 queue_mapping) { - skb->queue_mapping = queue_mapping; + skb->queue_mapping = queue_mapping +1 ; }static inline u16 skb_get_queue_mapping (const struct sk_buff *skb) { -return skb->queue_mapping; +return skb_rx_queue_recorded (skb) ? skb->queue_mapping -1 :0 ; }static inline void skb_copy_queue_mapping (struct sk_buff *to,const struct sk_buff *from)
@@ -2027,21 +2032,6 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu to->queue_mapping = from->queue_mapping; } -static inline void skb_record_rx_queue (struct sk_buff *skb,u16 rx_queue) -{ - skb->queue_mapping = rx_queue +1 ; -} - -static inline u16 skb_get_rx_queue (const struct sk_buff *skb) -{ -return skb->queue_mapping -1 ; -} - -static inline bool skb_rx_queue_recorded (const struct sk_buff *skb) -{ -return (skb->queue_mapping !=0 ); -} -extern u16 skb_tx_hash (const struct net_device *dev,const struct sk_buff *skb);
net/core/dev.c +1 -1
@@ -1938,7 +1938,7 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb)u32 hash;if (skb_rx_queue_recorded (skb)) { - hash =skb_get_rx_queue (skb); + hash = skb->queue_mapping -1 ;while (unlikely (hash >= dev->real_num_tx_queues)) hash -= dev->real_num_tx_queues;return hash;
---
--
wbr, Oleg.
David Miller
maintainerFrom: "\"Oleg A. Arkhangelsky\"" <[email protected]>
Date: Sun, 28 Feb 2010 14:35:14 +0300
Quoted 9 lines
Quoted 7 lines
In file included from
include/linux/netfilter.h:6,
frominclude/net/netns/x_tables.h:5,
frominclude/net/net_namespace.h:18,
frominclude/linux/init_task.h:13,
fromarch/sparc/kernel/init_task.c:5:
include/linux/skbuff.h: In function ‘skb_get_queue_mapping’:
include/linux/skbuff.h:2022: error: implicit declaration of function ‘skb_rx_queue_recorded’Silly me. :( Corrected.
You're not testing your damn changes at all. You're not build testing it, and you're therefore certainly not run time testing it:
drivers/net/igb/igb_main.c: In function ‘igb_clean_rx_irq_adv’:drivers/net/igb/igb_main.c:5290: error: implicit declaration of function ‘skb_record_rx_queue’ make[3]: *** [drivers/net/igb/igb_main.o] Error 1
make[2]: *** [drivers/net/igb] Error 2
make[1]: *** [drivers/net] Error 2
And this makes me furious. You got one of the calls in this file, but not the other one, proving you didn't build test this part of your patch at all.
And you did this not once, but _TWICE_. You pushed a new version of this patch back at me so quickly that there is zero chance that you took any time to double check things.
How in the world can I possibly trust you and the quality of your work?
I think we can wait on your patches until the next merge window.
Sorry.