* [PATCH net-next 1/7] l2tp: remove pppol2tp_session_close()
2018-06-25 14:07 [PATCH net-next 0/7] l2tp: trivial cleanups Guillaume Nault
@ 2018-06-25 14:07 ` Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 2/7] l2tp: remove .show from struct l2tp_tunnel Guillaume Nault
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2018-06-25 14:07 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
l2tp_core.c verifies that ->session_close() is defined before calling
it. There's no need for a stub.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_ppp.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 55188382845c..eea5d7844473 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -424,12 +424,6 @@ static void pppol2tp_put_sk(struct rcu_head *head)
sock_put(ps->__sk);
}
-/* Called by l2tp_core when a session socket is being closed.
- */
-static void pppol2tp_session_close(struct l2tp_session *session)
-{
-}
-
/* Really kill the session socket. (Called from sock_put() if
* refcnt == 0.)
*/
@@ -573,7 +567,6 @@ static void pppol2tp_session_init(struct l2tp_session *session)
struct dst_entry *dst;
session->recv_skb = pppol2tp_recv;
- session->session_close = pppol2tp_session_close;
#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
session->show = pppol2tp_show;
#endif
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH net-next 2/7] l2tp: remove .show from struct l2tp_tunnel
2018-06-25 14:07 [PATCH net-next 0/7] l2tp: trivial cleanups Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 1/7] l2tp: remove pppol2tp_session_close() Guillaume Nault
@ 2018-06-25 14:07 ` Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 3/7] l2tp: remove l2tp_tunnel_priv() Guillaume Nault
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2018-06-25 14:07 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
This callback has never been implemented.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_core.h | 3 ---
net/l2tp/l2tp_debugfs.c | 3 ---
2 files changed, 6 deletions(-)
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
index c199020f8a8a..b21c20a4e08f 100644
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -180,9 +180,6 @@ struct l2tp_tunnel {
struct net *l2tp_net; /* the net we belong to */
refcount_t ref_count;
-#ifdef CONFIG_DEBUG_FS
- void (*show)(struct seq_file *m, void *arg);
-#endif
int (*recv_payload_hook)(struct sk_buff *skb);
void (*old_sk_destruct)(struct sock *);
struct sock *sock; /* Parent socket */
diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c
index e87686f7d63c..b5d7dde003ef 100644
--- a/net/l2tp/l2tp_debugfs.c
+++ b/net/l2tp/l2tp_debugfs.c
@@ -177,9 +177,6 @@ static void l2tp_dfs_seq_tunnel_show(struct seq_file *m, void *v)
atomic_long_read(&tunnel->stats.rx_packets),
atomic_long_read(&tunnel->stats.rx_bytes),
atomic_long_read(&tunnel->stats.rx_errors));
-
- if (tunnel->show != NULL)
- tunnel->show(m, tunnel);
}
static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v)
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH net-next 3/7] l2tp: remove l2tp_tunnel_priv()
2018-06-25 14:07 [PATCH net-next 0/7] l2tp: trivial cleanups Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 1/7] l2tp: remove pppol2tp_session_close() Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 2/7] l2tp: remove .show from struct l2tp_tunnel Guillaume Nault
@ 2018-06-25 14:07 ` Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 4/7] l2tp: don't export l2tp_session_queue_purge() Guillaume Nault
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2018-06-25 14:07 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
This function, and the associated .priv field, are unused.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_core.h | 7 -------
1 file changed, 7 deletions(-)
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
index b21c20a4e08f..15e1171ecf7b 100644
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -187,8 +187,6 @@ struct l2tp_tunnel {
* was created by userspace */
struct work_struct del_work;
-
- uint8_t priv[0]; /* private data */
};
struct l2tp_nl_cmd_ops {
@@ -198,11 +196,6 @@ struct l2tp_nl_cmd_ops {
int (*session_delete)(struct l2tp_session *session);
};
-static inline void *l2tp_tunnel_priv(struct l2tp_tunnel *tunnel)
-{
- return &tunnel->priv[0];
-}
-
static inline void *l2tp_session_priv(struct l2tp_session *session)
{
return &session->priv[0];
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH net-next 4/7] l2tp: don't export l2tp_session_queue_purge()
2018-06-25 14:07 [PATCH net-next 0/7] l2tp: trivial cleanups Guillaume Nault
` (2 preceding siblings ...)
2018-06-25 14:07 ` [PATCH net-next 3/7] l2tp: remove l2tp_tunnel_priv() Guillaume Nault
@ 2018-06-25 14:07 ` Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 5/7] l2tp: don't export l2tp_tunnel_closeall() Guillaume Nault
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2018-06-25 14:07 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
This function is only used in l2tp_core.c.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_core.c | 3 +--
net/l2tp/l2tp_core.h | 1 -
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 40261cb68e83..3adef4c35a3a 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -783,7 +783,7 @@ EXPORT_SYMBOL(l2tp_recv_common);
/* Drop skbs from the session's reorder_q
*/
-int l2tp_session_queue_purge(struct l2tp_session *session)
+static int l2tp_session_queue_purge(struct l2tp_session *session)
{
struct sk_buff *skb = NULL;
BUG_ON(!session);
@@ -794,7 +794,6 @@ int l2tp_session_queue_purge(struct l2tp_session *session)
}
return 0;
}
-EXPORT_SYMBOL_GPL(l2tp_session_queue_purge);
/* Internal UDP receive frame. Do the real work of receiving an L2TP data frame
* here. The skb is not on a list when we get here.
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
index 15e1171ecf7b..0a6e582f84d3 100644
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -234,7 +234,6 @@ void l2tp_session_free(struct l2tp_session *session);
void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
unsigned char *ptr, unsigned char *optr, u16 hdrflags,
int length, int (*payload_hook)(struct sk_buff *skb));
-int l2tp_session_queue_purge(struct l2tp_session *session);
int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb);
void l2tp_session_set_header_len(struct l2tp_session *session, int version);
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH net-next 5/7] l2tp: don't export l2tp_tunnel_closeall()
2018-06-25 14:07 [PATCH net-next 0/7] l2tp: trivial cleanups Guillaume Nault
` (3 preceding siblings ...)
2018-06-25 14:07 ` [PATCH net-next 4/7] l2tp: don't export l2tp_session_queue_purge() Guillaume Nault
@ 2018-06-25 14:07 ` Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 6/7] l2tp: avoid duplicate l2tp_pernet() calls Guillaume Nault
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2018-06-25 14:07 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
This function is only used in l2tp_core.c.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_core.c | 3 +--
net/l2tp/l2tp_core.h | 1 -
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 3adef4c35a3a..96e31f2ae7cd 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1192,7 +1192,7 @@ static void l2tp_tunnel_destruct(struct sock *sk)
/* When the tunnel is closed, all the attached sessions need to go too.
*/
-void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel)
+static void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel)
{
int hash;
struct hlist_node *walk;
@@ -1241,7 +1241,6 @@ void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel)
}
write_unlock_bh(&tunnel->hlist_lock);
}
-EXPORT_SYMBOL_GPL(l2tp_tunnel_closeall);
/* Tunnel socket destroy hook for UDP encapsulation */
static void l2tp_udp_encap_destroy(struct sock *sk)
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
index 0a6e582f84d3..a5c09d3a5698 100644
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -219,7 +219,6 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id,
int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net,
struct l2tp_tunnel_cfg *cfg);
-void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel);
void l2tp_tunnel_delete(struct l2tp_tunnel *tunnel);
struct l2tp_session *l2tp_session_create(int priv_size,
struct l2tp_tunnel *tunnel,
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH net-next 6/7] l2tp: avoid duplicate l2tp_pernet() calls
2018-06-25 14:07 [PATCH net-next 0/7] l2tp: trivial cleanups Guillaume Nault
` (4 preceding siblings ...)
2018-06-25 14:07 ` [PATCH net-next 5/7] l2tp: don't export l2tp_tunnel_closeall() Guillaume Nault
@ 2018-06-25 14:07 ` Guillaume Nault
2018-06-25 14:07 ` [PATCH net-next 7/7] l2tp: make l2tp_xmit_core() return void Guillaume Nault
2018-06-26 13:56 ` [PATCH net-next 0/7] l2tp: trivial cleanups David Miller
7 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2018-06-25 14:07 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
Replace 'l2tp_pernet(tunnel->l2tp_net)' with 'pn', which has been set
on the preceding line.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 96e31f2ae7cd..88c3001531b4 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -322,8 +322,7 @@ int l2tp_session_register(struct l2tp_session *session,
if (tunnel->version == L2TP_HDR_VER_3) {
pn = l2tp_pernet(tunnel->l2tp_net);
- g_head = l2tp_session_id_hash_2(l2tp_pernet(tunnel->l2tp_net),
- session->session_id);
+ g_head = l2tp_session_id_hash_2(pn, session->session_id);
spin_lock_bh(&pn->l2tp_session_hlist_lock);
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH net-next 7/7] l2tp: make l2tp_xmit_core() return void
2018-06-25 14:07 [PATCH net-next 0/7] l2tp: trivial cleanups Guillaume Nault
` (5 preceding siblings ...)
2018-06-25 14:07 ` [PATCH net-next 6/7] l2tp: avoid duplicate l2tp_pernet() calls Guillaume Nault
@ 2018-06-25 14:07 ` Guillaume Nault
2018-06-26 13:56 ` [PATCH net-next 0/7] l2tp: trivial cleanups David Miller
7 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2018-06-25 14:07 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
It always returns 0, and nobody reads the return value anyway.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 88c3001531b4..1ea285bad84b 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1007,8 +1007,8 @@ static int l2tp_build_l2tpv3_header(struct l2tp_session *session, void *buf)
return bufp - optr;
}
-static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb,
- struct flowi *fl, size_t data_len)
+static void l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb,
+ struct flowi *fl, size_t data_len)
{
struct l2tp_tunnel *tunnel = session->tunnel;
unsigned int len = skb->len;
@@ -1050,8 +1050,6 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb,
atomic_long_inc(&tunnel->stats.tx_errors);
atomic_long_inc(&session->stats.tx_errors);
}
-
- return 0;
}
/* If caller requires the skb to have a ppp header, the header must be
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH net-next 0/7] l2tp: trivial cleanups
2018-06-25 14:07 [PATCH net-next 0/7] l2tp: trivial cleanups Guillaume Nault
` (6 preceding siblings ...)
2018-06-25 14:07 ` [PATCH net-next 7/7] l2tp: make l2tp_xmit_core() return void Guillaume Nault
@ 2018-06-26 13:56 ` David Miller
7 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2018-06-26 13:56 UTC (permalink / raw)
To: g.nault; +Cc: netdev, jchapman
From: Guillaume Nault <g.nault@alphalink.fr>
Date: Mon, 25 Jun 2018 16:07:17 +0200
> Just a set of unrelated trivial cleanups (remove unused code, make
> local functions static, etc.).
Series applied, thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread