Commit c8657fd5 authored by James Chapman's avatar James Chapman Committed by David S. Miller

l2tp: remove unused stats from l2tp_ip socket

The l2tp_ip socket currently maintains packet/byte stats in its
private socket structure. But these counters aren't exposed to
userspace and so serve no purpose. The counters were also
smp-unsafe. So this patch just gets rid of the stats.

While here, change a couple of internal __u32 variables to u32.
Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de3c7a18
...@@ -32,15 +32,8 @@ struct l2tp_ip_sock { ...@@ -32,15 +32,8 @@ struct l2tp_ip_sock {
/* inet_sock has to be the first member of l2tp_ip_sock */ /* inet_sock has to be the first member of l2tp_ip_sock */
struct inet_sock inet; struct inet_sock inet;
__u32 conn_id; u32 conn_id;
__u32 peer_conn_id; u32 peer_conn_id;
__u64 tx_packets;
__u64 tx_bytes;
__u64 tx_errors;
__u64 rx_packets;
__u64 rx_bytes;
__u64 rx_errors;
}; };
static DEFINE_RWLOCK(l2tp_ip_lock); static DEFINE_RWLOCK(l2tp_ip_lock);
...@@ -298,7 +291,6 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -298,7 +291,6 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
{ {
struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *) uaddr; struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *) uaddr;
struct inet_sock *inet = inet_sk(sk);
int rc; int rc;
if (addr_len < sizeof(*lsa)) if (addr_len < sizeof(*lsa))
...@@ -374,7 +366,6 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m ...@@ -374,7 +366,6 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
{ {
struct sk_buff *skb; struct sk_buff *skb;
int rc; int rc;
struct l2tp_ip_sock *lsa = l2tp_ip_sk(sk);
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
struct rtable *rt = NULL; struct rtable *rt = NULL;
struct flowi4 *fl4; struct flowi4 *fl4;
...@@ -473,14 +464,8 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m ...@@ -473,14 +464,8 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
rcu_read_unlock(); rcu_read_unlock();
error: error:
/* Update stats */ if (rc >= 0)
if (rc >= 0) {
lsa->tx_packets++;
lsa->tx_bytes += len;
rc = len; rc = len;
} else {
lsa->tx_errors++;
}
out: out:
release_sock(sk); release_sock(sk);
...@@ -498,7 +483,6 @@ static int l2tp_ip_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m ...@@ -498,7 +483,6 @@ static int l2tp_ip_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
size_t len, int noblock, int flags, int *addr_len) size_t len, int noblock, int flags, int *addr_len)
{ {
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
struct l2tp_ip_sock *lsk = l2tp_ip_sk(sk);
size_t copied = 0; size_t copied = 0;
int err = -EOPNOTSUPP; int err = -EOPNOTSUPP;
struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name;
...@@ -540,15 +524,7 @@ static int l2tp_ip_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m ...@@ -540,15 +524,7 @@ static int l2tp_ip_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
done: done:
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
out: out:
if (err) { return err ? err : copied;
lsk->rx_errors++;
return err;
}
lsk->rx_packets++;
lsk->rx_bytes += copied;
return copied;
} }
static struct proto l2tp_ip_prot = { static struct proto l2tp_ip_prot = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment