Thread (6 messages) flat view 6 messages, 2 authors, 2021-08-18
STALE1827d REVIEWED: 2 (2M)

1 review trailer.

[net-next PATCH] net: act_skbedit: Fix tc action skbedit queue_mapping

From: Amritha Nambiar <hidden>
Date: 2021-08-09 23:36:37
Subsystem: networking [general], tc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

For skbedit action queue_mapping to select the transmit queue,
queue_mapping takes the value N for tx-N (where N is the actual
queue number). However, current behavior is the following:
1. Queue selection is off by 1, tx queue N-1 is selected for
   action skbedit queue_mapping N. (If the general syntax for queue
   index is 1 based, i.e., action skbedit queue_mapping N would
   transmit to tx queue N-1, where N >=1, then the last queue cannot
   be used for transmit as this fails the upper bound check.)
2. Transmit to first queue of TCs other than TC0 selects the
   next queue.
3. It is not possible to transmit to the first queue (tx-0) as
   this fails the bounds check, in this case the fallback
   mechanism for hash calculation is used.

Fix the call to skb_set_queue_mapping(), the code retrieving the
transmit queue uses skb_get_rx_queue() which subtracts the queue
index by 1. This makes it so that "action skbedit queue_mapping N"
will transmit to tx-N (including the first and last queue).

Signed-off-by: Amritha Nambiar <redacted>
Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
---
 net/sched/act_skbedit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index e5f3fb8b00e3..a7bba15c74c4 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -59,7 +59,7 @@ static int tcf_skbedit_act(struct sk_buff *skb, const struct tc_action *a,
 	}
 	if (params->flags & SKBEDIT_F_QUEUE_MAPPING &&
 	    skb->dev->real_num_tx_queues > params->queue_mapping)
-		skb_set_queue_mapping(skb, params->queue_mapping);
+		skb_set_queue_mapping(skb, params->queue_mapping + 1);
 	if (params->flags & SKBEDIT_F_MARK) {
 		skb->mark &= ~params->mask;
 		skb->mark |= params->mark & params->mask;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help