Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

James Chapman and committed by
David S. Miller
c8657fd5 de3c7a18

+4 -28
+4 -28
net/l2tp/l2tp_ip.c
··· 32 32 /* inet_sock has to be the first member of l2tp_ip_sock */ 33 33 struct inet_sock inet; 34 34 35 - __u32 conn_id; 36 - __u32 peer_conn_id; 37 - 38 - __u64 tx_packets; 39 - __u64 tx_bytes; 40 - __u64 tx_errors; 41 - __u64 rx_packets; 42 - __u64 rx_bytes; 43 - __u64 rx_errors; 35 + u32 conn_id; 36 + u32 peer_conn_id; 44 37 }; 45 38 46 39 static DEFINE_RWLOCK(l2tp_ip_lock); ··· 291 298 static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) 292 299 { 293 300 struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *) uaddr; 294 - struct inet_sock *inet = inet_sk(sk); 295 301 int rc; 296 302 297 303 if (addr_len < sizeof(*lsa)) ··· 366 374 { 367 375 struct sk_buff *skb; 368 376 int rc; 369 - struct l2tp_ip_sock *lsa = l2tp_ip_sk(sk); 370 377 struct inet_sock *inet = inet_sk(sk); 371 378 struct rtable *rt = NULL; 372 379 struct flowi4 *fl4; ··· 464 473 rcu_read_unlock(); 465 474 466 475 error: 467 - /* Update stats */ 468 - if (rc >= 0) { 469 - lsa->tx_packets++; 470 - lsa->tx_bytes += len; 476 + if (rc >= 0) 471 477 rc = len; 472 - } else { 473 - lsa->tx_errors++; 474 - } 475 478 476 479 out: 477 480 release_sock(sk); ··· 483 498 size_t len, int noblock, int flags, int *addr_len) 484 499 { 485 500 struct inet_sock *inet = inet_sk(sk); 486 - struct l2tp_ip_sock *lsk = l2tp_ip_sk(sk); 487 501 size_t copied = 0; 488 502 int err = -EOPNOTSUPP; 489 503 struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; ··· 524 540 done: 525 541 skb_free_datagram(sk, skb); 526 542 out: 527 - if (err) { 528 - lsk->rx_errors++; 529 - return err; 530 - } 531 - 532 - lsk->rx_packets++; 533 - lsk->rx_bytes += copied; 534 - 535 - return copied; 543 + return err ? err : copied; 536 544 } 537 545 538 546 static struct proto l2tp_ip_prot = {