summaryrefslogtreecommitdiffstats
path: root/net/mpls/af_mpls.c
diff options
context:
space:
mode:
authorKangmin Park <l4stpr0gr4m@gmail.com>2021-07-22 20:50:28 +0200
committerDavid S. Miller <davem@davemloft.net>2021-07-23 18:17:56 +0200
commit6a6b83ca471c50a05d1b07bd9594469986106bed (patch)
tree2b87644abea848de3b7087a77c20471ac8fa560e /net/mpls/af_mpls.c
parentwwan: core: Fix missing RTM_NEWLINK event for default link (diff)
downloadlinux-6a6b83ca471c50a05d1b07bd9594469986106bed.tar.xz
linux-6a6b83ca471c50a05d1b07bd9594469986106bed.zip
mpls: defer ttl decrement in mpls_forward()
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 <l4stpr0gr4m@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mpls/af_mpls.c')
-rw-r--r--net/mpls/af_mpls.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 05a21dd072df..ffeb2df8be7a 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -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);
@@ -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))