Skip to content

Commit

Permalink
mpls: defer ttl decrement in mpls_forward()
Browse files Browse the repository at this point in the history
Defer ttl decrement to optimize in tx_err case. There is no need
to decrease ttl in the case of goto tx_err.

Signed-off-by: Kangmin Park <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
pr0gr4m authored and davem330 committed Jul 23, 2021
1 parent 8cc236d commit 6a6b83c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/mpls/af_mpls.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev,
/* Verify ttl is valid */
if (dec.ttl <= 1)
goto err;
dec.ttl -= 1;

/* Find the output device */
out_dev = rcu_dereference(nh->nh_dev);
Expand All @@ -431,6 +430,7 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev,
skb->dev = out_dev;
skb->protocol = htons(ETH_P_MPLS_UC);

dec.ttl -= 1;
if (unlikely(!new_header_size && dec.bos)) {
/* Penultimate hop popping */
if (!mpls_egress(dev_net(out_dev), rt, skb, dec))
Expand Down

0 comments on commit 6a6b83c

Please sign in to comment.