[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210123195916.2765481-11-jonas@norrbonn.se>
Date: Sat, 23 Jan 2021 20:59:10 +0100
From: Jonas Bonn <jonas@...rbonn.se>
To: laforge@...monks.org, netdev@...r.kernel.org, pbshelar@...com,
kuba@...nel.org
Cc: pablo@...filter.org, Jonas Bonn <jonas@...rbonn.se>
Subject: [RFC PATCH 10/16] gtp: refactor check_ms back into version specific handlers
This is preparatory work for adding flow based tunneling work by Pravin
Shelar.
Signed-off-by: Jonas Bonn <jonas@...rbonn.se>
---
drivers/net/gtp.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index b20e17988bfa..c42092bb505f 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -181,13 +181,8 @@ static bool gtp_check_ms(struct sk_buff *skb, struct pdp_ctx *pctx,
}
static int gtp_rx(struct pdp_ctx *pctx, struct sk_buff *skb,
- unsigned int hdrlen, unsigned int role)
+ unsigned int hdrlen)
{
- if (!gtp_check_ms(skb, pctx, hdrlen, role)) {
- netdev_dbg(pctx->dev, "No PDP ctx for this MS\n");
- return 1;
- }
-
/* Get rid of the GTP + UDP headers. */
if (iptunnel_pull_header(skb, hdrlen, skb->protocol,
!net_eq(sock_net(pctx->sk), dev_net(pctx->dev))))
@@ -234,7 +229,12 @@ static int gtp0_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)
return 1;
}
- return gtp_rx(pctx, skb, hdrlen, gtp->role);
+ if (!gtp_check_ms(skb, pctx, hdrlen, gtp->role)) {
+ netdev_dbg(pctx->dev, "No PDP ctx for this MS\n");
+ return 1;
+ }
+
+ return gtp_rx(pctx, skb, hdrlen);
}
static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)
@@ -276,7 +276,12 @@ static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)
return 1;
}
- return gtp_rx(pctx, skb, hdrlen, gtp->role);
+ if (!gtp_check_ms(skb, pctx, hdrlen, gtp->role)) {
+ netdev_dbg(pctx->dev, "No PDP ctx for this MS\n");
+ return 1;
+ }
+
+ return gtp_rx(pctx, skb, hdrlen);
}
static void __gtp_encap_destroy(struct sock *sk)
--
2.27.0
Powered by blists - more mailing lists